nexa-compiler 0.8.0 → 0.8.1

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.
@@ -176,7 +176,7 @@ export function generateComponentCode(sfc, filename) {
176
176
  const componentBindings = renderBindings.map(b => /^[A-Z]/.test(b) ? `${b}: _ntc_${b}` : b);
177
177
  const allRenderBindings = [...componentBindings, ...usedBuiltIns.map(b => `${b}: _ntc_${b}`)];
178
178
  if (allRenderBindings.length > 0) {
179
- lines.push(` const { ${allRenderBindings.join(', ')} } = ctx`);
179
+ lines.push(` let { ${allRenderBindings.join(', ')} } = ctx`);
180
180
  }
181
181
  lines.push(generateRenderCode(sfc.template, scopeId || undefined));
182
182
  lines.push('}');
@@ -161,9 +161,22 @@ function genProps(attrs, tag) {
161
161
  const parts_name = propName.split('.');
162
162
  const realName = parts_name[0];
163
163
  const modifiers = parts_name.slice(1);
164
- let handler = typeof attr.value === 'string' && /^\w+$/.test(attr.value)
165
- ? attr.value
166
- : `($event) => { ${attr.value} }`;
164
+ let handler;
165
+ if (typeof attr.value === 'string') {
166
+ const assignMatch = attr.value.match(/^(\w+)\s*=\s*(.+)$/);
167
+ if (assignMatch) {
168
+ handler = `($event) => { ${assignMatch[1]}.value = ${assignMatch[2]} }`;
169
+ }
170
+ else if (/^\w+$/.test(attr.value)) {
171
+ handler = attr.value;
172
+ }
173
+ else {
174
+ handler = `($event) => { ${attr.value} }`;
175
+ }
176
+ }
177
+ else {
178
+ handler = `($event) => { ${attr.value} }`;
179
+ }
167
180
  const keyMap = {
168
181
  enter: 'Enter', esc: 'Escape', tab: 'Tab',
169
182
  space: ' ', up: 'ArrowUp', down: 'ArrowDown',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexa-compiler",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",