km-card-layout-core
v0.1.31
Published
Shared render helpers for CardLayout layout JSON (binding resolution, layout normalization).
Downloads
50
Readme
km-card-layout-core
Utilities for working with card layout schemas: sanitize layouts, handle bindings, convert style units, and apply background/decoration helpers. Rendering now uses CardElement directly without intermediate RenderNode conversion.
API
normalizeLayout(layout): sanitize layout objects and fill defaults.resolveBindingValue(path, data, context?): read bound data with optional context.styleObjectToString(style, unit?): convert a style object to a CSS string.addUnit(value, unit): append px/rpx to numbers or numeric strings.- Background helper:
backgroundChangeto apply template background colors.
Usage
Use the layout schema and card elements directly for rendering on web or mini-program targets—no extra RenderNode transformation layer is required. The core is platform-agnostic and can be imported via require('km-card-layout-core').
