km-card-layout-core 0.1.23 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bindings.ts CHANGED
@@ -54,7 +54,6 @@ export function applyItemCollectBindings(
54
54
  else delete base.defaultValue;
55
55
  if (key !== undefined) base.key = key;
56
56
  else delete base.key;
57
- // sync icon name for text elements from template meta.extra.icon
58
57
  if (el.type === 'text' && meta?.extra?.icon) {
59
58
  base.icon = { ...(base.icon || {}), name: meta.extra.icon };
60
59
  }
package/dist/bindings.js CHANGED
@@ -51,7 +51,6 @@ function applyItemCollectBindings(layouts = [], items = []) {
51
51
  base.key = key;
52
52
  else
53
53
  delete base.key;
54
- // sync icon name for text elements from template meta.extra.icon
55
54
  if (el.type === 'text' && ((_a = meta === null || meta === void 0 ? void 0 : meta.extra) === null || _a === void 0 ? void 0 : _a.icon)) {
56
55
  base.icon = { ...(base.icon || {}), name: meta.extra.icon };
57
56
  }
@@ -83,7 +83,8 @@ const buildImageContentStyle = (el, unit) => {
83
83
  const buildTextIcon = (el, unit) => {
84
84
  var _a, _b, _c, _d, _e;
85
85
  const icon = el.icon;
86
- if (!icon || icon.enable === false)
86
+ const enabled = (icon === null || icon === void 0 ? void 0 : icon.enable) === true;
87
+ if (!icon || !enabled)
87
88
  return undefined;
88
89
  const style = icon.style || 'fill';
89
90
  const baseName = icon.name || el.key || el.binding || el.id;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "km-card-layout-core",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "Shared render helpers for CardMaster layout JSON (binding resolution, layout normalization).",
5
5
  "main": "dist/index.js",
6
6
  "types": "types.d.ts",
7
7
  "license": "MIT",
8
8
  "scripts": {
9
9
  "build": "tsc -p tsconfig.build.json",
10
+ "watch": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
10
11
  "release": "pnpm run build && npm publish --access public"
11
12
  }
12
13
  }
package/render/builder.ts CHANGED
@@ -125,7 +125,8 @@ const buildTextIcon = (
125
125
  unit: 'px' | 'rpx'
126
126
  ): RenderNode['icon'] | undefined => {
127
127
  const icon = el.icon;
128
- if (!icon || icon.enable === false) return undefined;
128
+ const enabled = icon?.enable === true;
129
+ if (!icon || !enabled) return undefined;
129
130
 
130
131
  const style = icon.style || 'fill';
131
132
  const baseName = icon.name || el.key || el.binding || el.id;