@sprlab/wccompiler 0.16.5 → 0.16.6

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.
Files changed (2) hide show
  1. package/lib/codegen.js +4 -2
  2. package/package.json +1 -1
package/lib/codegen.js CHANGED
@@ -1940,8 +1940,10 @@ export function generateComponent(parseResult, options = {}) {
1940
1940
  // _modelSet methods (one per defineModel prop — emits events on internal write)
1941
1941
  // Emits:
1942
1942
  // 1. wcc:model — canonical event for vanilla JS, WCC-to-WCC, React adapter, Vue plugin
1943
- // 2. propNameChange — for Angular [(prop)] banana-box syntax (zero-config)
1943
+ // 2. propName-changedkebab-case for Web Components standard and parent listeners
1944
1944
  for (const md of modelDefs) {
1945
+ // Convert camelCase to kebab-case for event name (e.g., userName → user-name-changed)
1946
+ const eventName = md.name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() + '-changed';
1945
1947
  lines.push(` _modelSet_${md.name}(newVal) {`);
1946
1948
  lines.push(` const oldVal = this._m_${md.name}();`);
1947
1949
  lines.push(` this._m_${md.name}(newVal);`);
@@ -1950,7 +1952,7 @@ export function generateComponent(parseResult, options = {}) {
1950
1952
  lines.push(` bubbles: true,`);
1951
1953
  lines.push(` composed: true`);
1952
1954
  lines.push(` }));`);
1953
- lines.push(` this.dispatchEvent(new CustomEvent('${md.name}Change', { detail: newVal, bubbles: true }));`);
1955
+ lines.push(` this.dispatchEvent(new CustomEvent('${eventName}', { detail: newVal, bubbles: true }));`);
1954
1956
  lines.push(' }');
1955
1957
  lines.push('');
1956
1958
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprlab/wccompiler",
3
- "version": "0.16.5",
3
+ "version": "0.16.6",
4
4
  "description": "Zero-runtime compiler that transforms .wcc single-file components into native web components with signals-based reactivity",
5
5
  "type": "module",
6
6
  "exports": {