@sprlab/wccompiler 0.8.1 → 0.8.2

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 +9 -3
  2. package/package.json +1 -1
package/lib/codegen.js CHANGED
@@ -1149,8 +1149,11 @@ export function generateComponent(parseResult, options = {}) {
1149
1149
  lines.push(` this.${b.varName}.textContent = this._s_${b.name}() ?? '';`);
1150
1150
  lines.push(' }));');
1151
1151
  } else if (b.type === 'signal') {
1152
+ // Check if this is a model var (needs _m_ prefix instead of _)
1153
+ const modelPropName = modelVarMap.get(b.name);
1154
+ const signalRef = modelPropName ? `this._m_${modelPropName}()` : `this._${b.name}()`;
1152
1155
  lines.push(' this.__disposers.push(__effect(() => {');
1153
- lines.push(` this.${b.varName}.textContent = this._${b.name}() ?? '';`);
1156
+ lines.push(` this.${b.varName}.textContent = ${signalRef} ?? '';`);
1154
1157
  lines.push(' }));');
1155
1158
  } else if (b.type === 'computed') {
1156
1159
  lines.push(' this.__disposers.push(__effect(() => {');
@@ -1201,7 +1204,8 @@ export function generateComponent(parseResult, options = {}) {
1201
1204
  } else if (pb.type === 'computed') {
1202
1205
  ref = `this._c_${pb.expr}()`;
1203
1206
  } else if (pb.type === 'signal') {
1204
- ref = `this._${pb.expr}()`;
1207
+ const modelPropName = modelVarMap.get(pb.expr);
1208
+ ref = modelPropName ? `this._m_${modelPropName}()` : `this._${pb.expr}()`;
1205
1209
  } else if (pb.type === 'constant') {
1206
1210
  ref = `this._const_${pb.expr}`;
1207
1211
  } else {
@@ -1725,7 +1729,9 @@ export function generateComponent(parseResult, options = {}) {
1725
1729
  if (b.type === 'prop') {
1726
1730
  lines.push(` __effect(() => { ${b.varName}.textContent = this._s_${b.name}() ?? ''; });`);
1727
1731
  } else if (b.type === 'signal') {
1728
- lines.push(` __effect(() => { ${b.varName}.textContent = this._${b.name}() ?? ''; });`);
1732
+ const modelPropName = modelVarMap.get(b.name);
1733
+ const signalRef = modelPropName ? `this._m_${modelPropName}()` : `this._${b.name}()`;
1734
+ lines.push(` __effect(() => { ${b.varName}.textContent = ${signalRef} ?? ''; });`);
1729
1735
  } else if (b.type === 'computed') {
1730
1736
  lines.push(` __effect(() => { ${b.varName}.textContent = this._c_${b.name}() ?? ''; });`);
1731
1737
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprlab/wccompiler",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
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": {