@webmate-studio/builder 0.2.173 → 0.2.175

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmate-studio/builder",
3
- "version": "0.2.173",
3
+ "version": "0.2.175",
4
4
  "type": "module",
5
5
  "description": "Webmate Studio Component Builder",
6
6
  "keywords": [
@@ -81,18 +81,25 @@ function transformIslandsToDataAttributes(html, availableIslands = [], component
81
81
  return kebabTag;
82
82
  }
83
83
 
84
- // Parse attributes string into HTML attributes
84
+ // Parse attributes string into a data-island-props JSON attribute.
85
+ // This preserves camelCase prop names (HTML attributes are case-insensitive
86
+ // and get lowercased by the browser, breaking camelCase like bgGray → bggray).
85
87
  function parseAttrs(attrsString) {
86
- const attrs = [];
87
- const attrPattern = /([a-z][a-zA-Z0-9]*)\s*=\s*(?:\{([^}]+)\}|"([^"]*)"|'([^']*)')/g;
88
+ const props = {};
89
+ const attrPattern = /([a-zA-Z][a-zA-Z0-9]*)\s*=\s*(?:\{([^}]+)\}|"([^"]*)"|'([^']*)')/g;
88
90
  let attrMatch;
89
91
  while ((attrMatch = attrPattern.exec(attrsString)) !== null) {
90
92
  const propName = attrMatch[1];
91
93
  const propValue = attrMatch[2] || attrMatch[3] || attrMatch[4];
92
- const value = attrMatch[2] ? `{${propValue}}` : propValue;
93
- attrs.push(`${propName}="${value}"`);
94
+ // For {expression} values, use __WM_EXPR:name__ marker instead of {name}
95
+ // to prevent the template processor from evaluating them.
96
+ // ComponentLoader resolves these markers at runtime.
97
+ props[propName] = attrMatch[2] ? `__WM_EXPR:${propValue}__` : propValue;
94
98
  }
95
- return attrs.length > 0 ? ' ' + attrs.join(' ') : '';
99
+ if (Object.keys(props).length === 0) return '';
100
+ // Encode as JSON in data-island-props (preserves camelCase)
101
+ const json = JSON.stringify(props).replace(/"/g, '"');
102
+ return ` data-island-props="${json}"`;
96
103
  }
97
104
 
98
105
  // 1. Self-closing: <ComponentName attrs... />