marko 6.0.101 → 6.0.103

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.
@@ -135,14 +135,29 @@ var AccessorPrefix = /* @__PURE__ */ ((AccessorPrefix4) => {
135
135
  return AccessorPrefix4;
136
136
  })(AccessorPrefix || {});
137
137
  var AccessorProp = /* @__PURE__ */ ((AccessorProp4) => {
138
+ AccessorProp4["Global"] = "$global";
138
139
  AccessorProp4["Owner"] = "_";
140
+ AccessorProp4["AbortControllers"] = "#AbortControllers";
141
+ AccessorProp4["AbortScopes"] = "#AbortScopes";
142
+ AccessorProp4["Args"] = "#Args";
139
143
  AccessorProp4["BranchAccessor"] = "#BranchAccessor";
144
+ AccessorProp4["BranchScopes"] = "#BranchScopes";
140
145
  AccessorProp4["CatchContent"] = "#CatchContent";
146
+ AccessorProp4["ClosestBranch"] = "#ClosestBranch";
147
+ AccessorProp4["ClosestBranchId"] = "#ClosestBranchId";
148
+ AccessorProp4["Creating"] = "#Creating";
149
+ AccessorProp4["Destroyed"] = "#Destroyed";
150
+ AccessorProp4["Effects"] = "#Effects";
151
+ AccessorProp4["EndNode"] = "#EndNode";
152
+ AccessorProp4["Id"] = "#Id";
153
+ AccessorProp4["ParentBranch"] = "#ParentBranch";
154
+ AccessorProp4["PendingAsyncCount"] = "#PendingAsyncCount";
141
155
  AccessorProp4["PlaceholderBranch"] = "#PlaceholderBranch";
142
156
  AccessorProp4["PlaceholderContent"] = "#PlaceholderContent";
157
+ AccessorProp4["Renderer"] = "#Renderer";
158
+ AccessorProp4["StartNode"] = "#StartNode";
143
159
  AccessorProp4["TagVariable"] = "#TagVariable";
144
160
  AccessorProp4["TagVariableChange"] = "#TagVariableChange";
145
- AccessorProp4["ClosestBranchId"] = "#ClosestBranchId";
146
161
  return AccessorProp4;
147
162
  })(AccessorProp || {});
148
163
 
@@ -238,6 +253,57 @@ function isNullableExpr(expr) {
238
253
  var import_compiler35 = require("@marko/compiler");
239
254
  var import_babel_utils25 = require("@marko/compiler/babel-utils");
240
255
 
256
+ // src/common/helpers.ts
257
+ function classValue(classValue2) {
258
+ return toDelimitedString(classValue2, " ", stringifyClassObject);
259
+ }
260
+ function stringifyClassObject(name2, value) {
261
+ return value ? name2 : "";
262
+ }
263
+ function styleValue(styleValue2) {
264
+ return toDelimitedString(styleValue2, ";", stringifyStyleObject);
265
+ }
266
+ function stringifyStyleObject(name2, value) {
267
+ return value || value === 0 ? name2 + ":" + value : "";
268
+ }
269
+ function toDelimitedString(val, delimiter, stringify) {
270
+ let str = "";
271
+ let sep = "";
272
+ let part;
273
+ if (val) {
274
+ if (typeof val !== "object") {
275
+ str += val;
276
+ } else if (Array.isArray(val)) {
277
+ for (const v of val) {
278
+ part = toDelimitedString(v, delimiter, stringify);
279
+ if (part) {
280
+ str += sep + part;
281
+ sep = delimiter;
282
+ }
283
+ }
284
+ } else {
285
+ for (const name2 in val) {
286
+ part = stringify(name2, val[name2]);
287
+ if (part) {
288
+ str += sep + part;
289
+ sep = delimiter;
290
+ }
291
+ }
292
+ }
293
+ }
294
+ return str;
295
+ }
296
+ function isEventHandler(name2) {
297
+ return /^on[A-Z-]/.test(name2);
298
+ }
299
+ function getEventHandlerName(name2) {
300
+ return name2[2] === "-" ? name2.slice(3) : name2.slice(2).toLowerCase();
301
+ }
302
+ function isVoid(value) {
303
+ return value == null || value === false;
304
+ }
305
+ var decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36);
306
+
241
307
  // src/html/serializer.ts
242
308
  var kTouchedIterator = Symbol();
243
309
  var { hasOwnProperty } = {};
@@ -1202,32 +1268,47 @@ var import_compiler5 = require("@marko/compiler");
1202
1268
 
1203
1269
  // src/common/accessor.ts
1204
1270
  var AccessorPrefix2 = /* @__PURE__ */ ((AccessorPrefix4) => {
1205
- AccessorPrefix4["ClosureScopes"] = "a";
1206
- AccessorPrefix4["ClosureSignalIndex"] = "b";
1207
- AccessorPrefix4["ConditionalRenderer"] = "c";
1208
- AccessorPrefix4["ConditionalScope"] = "d";
1209
- AccessorPrefix4["ControlledHandler"] = "e";
1210
- AccessorPrefix4["ControlledType"] = "f";
1211
- AccessorPrefix4["ControlledValue"] = "g";
1212
- AccessorPrefix4["DynamicPlaceholderLastChild"] = "h";
1213
- AccessorPrefix4["EventAttributes"] = "i";
1214
- AccessorPrefix4["Getter"] = "j";
1215
- AccessorPrefix4["LifecycleAbortController"] = "k";
1216
- AccessorPrefix4["LoopScopeArray"] = "l";
1217
- AccessorPrefix4["LoopScopeMap"] = "m";
1218
- AccessorPrefix4["Promise"] = "n";
1219
- AccessorPrefix4["TagVariableChange"] = "o";
1271
+ AccessorPrefix4["ClosureScopes"] = "A";
1272
+ AccessorPrefix4["ClosureSignalIndex"] = "B";
1273
+ AccessorPrefix4["ConditionalRenderer"] = "C";
1274
+ AccessorPrefix4["ConditionalScope"] = "D";
1275
+ AccessorPrefix4["ControlledHandler"] = "E";
1276
+ AccessorPrefix4["ControlledType"] = "F";
1277
+ AccessorPrefix4["ControlledValue"] = "G";
1278
+ AccessorPrefix4["DynamicPlaceholderLastChild"] = "H";
1279
+ AccessorPrefix4["EventAttributes"] = "I";
1280
+ AccessorPrefix4["Getter"] = "J";
1281
+ AccessorPrefix4["LifecycleAbortController"] = "K";
1282
+ AccessorPrefix4["LoopScopeArray"] = "L";
1283
+ AccessorPrefix4["LoopScopeMap"] = "M";
1284
+ AccessorPrefix4["Promise"] = "N";
1285
+ AccessorPrefix4["TagVariableChange"] = "O";
1220
1286
  return AccessorPrefix4;
1221
1287
  })(AccessorPrefix2 || {});
1222
1288
  var AccessorProp2 = /* @__PURE__ */ ((AccessorProp4) => {
1289
+ AccessorProp4["Global"] = "$";
1223
1290
  AccessorProp4["Owner"] = "_";
1224
- AccessorProp4["BranchAccessor"] = "a";
1225
- AccessorProp4["CatchContent"] = "b";
1226
- AccessorProp4["PlaceholderBranch"] = "c";
1227
- AccessorProp4["PlaceholderContent"] = "d";
1228
- AccessorProp4["TagVariable"] = "e";
1229
- AccessorProp4["TagVariableChange"] = "f";
1230
- AccessorProp4["ClosestBranchId"] = "g";
1291
+ AccessorProp4["AbortControllers"] = "A";
1292
+ AccessorProp4["AbortScopes"] = "B";
1293
+ AccessorProp4["Args"] = "C";
1294
+ AccessorProp4["BranchAccessor"] = "D";
1295
+ AccessorProp4["BranchScopes"] = "E";
1296
+ AccessorProp4["CatchContent"] = "F";
1297
+ AccessorProp4["ClosestBranch"] = "G";
1298
+ AccessorProp4["ClosestBranchId"] = "H";
1299
+ AccessorProp4["Creating"] = "I";
1300
+ AccessorProp4["Destroyed"] = "J";
1301
+ AccessorProp4["Effects"] = "K";
1302
+ AccessorProp4["EndNode"] = "L";
1303
+ AccessorProp4["Id"] = "M";
1304
+ AccessorProp4["ParentBranch"] = "N";
1305
+ AccessorProp4["PendingAsyncCount"] = "O";
1306
+ AccessorProp4["PlaceholderBranch"] = "P";
1307
+ AccessorProp4["PlaceholderContent"] = "Q";
1308
+ AccessorProp4["Renderer"] = "R";
1309
+ AccessorProp4["StartNode"] = "S";
1310
+ AccessorProp4["TagVariable"] = "T";
1311
+ AccessorProp4["TagVariableChange"] = "U";
1231
1312
  return AccessorProp4;
1232
1313
  })(AccessorProp2 || {});
1233
1314
 
@@ -1514,38 +1595,37 @@ function createSectionState(key, init) {
1514
1595
  var import_compiler6 = require("@marko/compiler");
1515
1596
  var import_babel_utils9 = require("@marko/compiler/babel-utils");
1516
1597
  var MARKO_FILE_REG = /^<.*>$|\.marko$/;
1517
- function analyzeTagNameType(tag) {
1598
+ function analyzeTagNameType(tag, allowDynamic) {
1518
1599
  const extra = tag.node.extra ??= {};
1519
1600
  if (extra.tagNameType === void 0) {
1520
1601
  const name2 = tag.get("name");
1521
1602
  if (name2.isStringLiteral()) {
1522
1603
  extra.tagNameType = name2.node.value[0] === "@" ? 3 /* AttributeTag */ : (0, import_babel_utils9.isNativeTag)(tag) ? 0 /* NativeTag */ : 1 /* CustomTag */;
1523
- extra.tagNameNullable = extra.tagNameNullable = false;
1524
- } else if (name2.isIdentifier()) {
1525
- analyzeExpressionTagName(name2, extra);
1526
- if (extra.tagNameType === 0 /* NativeTag */) {
1527
- extra.tagNameType = 2 /* DynamicTag */;
1528
- }
1604
+ extra.tagNameNullable = extra.tagNameDynamic = false;
1529
1605
  } else if (name2.isTemplateLiteral() && !name2.node.expressions.length) {
1530
1606
  extra.tagNameType = 0 /* NativeTag */;
1607
+ extra.tagNameNullable = extra.tagNameDynamic = false;
1608
+ } else if (name2.isIdentifier()) {
1609
+ analyzeExpressionTagName(name2, extra);
1610
+ extra.tagNameDynamic = !extra.tagNameImported;
1531
1611
  } else {
1532
- extra.tagNameType = 2 /* DynamicTag */;
1533
- }
1534
- if (extra.tagNameType === void 0) {
1535
- extra.tagNameType = 2 /* DynamicTag */;
1612
+ analyzeExpressionTagName(name2, extra);
1613
+ extra.tagNameDynamic = true;
1536
1614
  }
1537
- if (extra.tagNameType === 1 /* CustomTag */ && !isCoreTag(tag)) {
1615
+ if (!extra.tagNameDynamic && extra.tagNameType === 1 /* CustomTag */ && !isCoreTag(tag)) {
1538
1616
  const childFile = (0, import_babel_utils9.loadFileForTag)(tag);
1539
1617
  if (!childFile) {
1540
1618
  extra.tagNameType = 2 /* DynamicTag */;
1619
+ extra.tagNameDynamic = true;
1541
1620
  } else if (childFile.ast.program.extra.featureType === "class") {
1542
1621
  extra.tagNameType = 2 /* DynamicTag */;
1622
+ extra.tagNameDynamic = true;
1543
1623
  extra.featureType = "class";
1544
1624
  ((0, import_babel_utils9.getProgram)().node.extra ??= {}).needsCompat = true;
1545
1625
  }
1546
1626
  }
1547
1627
  }
1548
- return extra.tagNameType;
1628
+ return !allowDynamic && extra.tagNameDynamic ? 2 /* DynamicTag */ : extra.tagNameType;
1549
1629
  }
1550
1630
  function analyzeExpressionTagName(name2, extra) {
1551
1631
  const pending = [name2];
@@ -1569,9 +1649,9 @@ function analyzeExpressionTagName(name2, extra) {
1569
1649
  } else if (path5.isAssignmentExpression()) {
1570
1650
  pending.push(path5.get("right"));
1571
1651
  } else if (path5.isBinaryExpression()) {
1572
- type = path5.node.operator !== "+" || type !== void 0 ? 2 /* DynamicTag */ : 0 /* NativeTag */;
1652
+ type = path5.node.operator !== "+" || type === void 0 || type === 0 /* NativeTag */ ? 0 /* NativeTag */ : 2 /* DynamicTag */;
1573
1653
  } else if (path5.isStringLiteral() || path5.isTemplateLiteral()) {
1574
- type = type !== void 0 ? 2 /* DynamicTag */ : 0 /* NativeTag */;
1654
+ type = type === void 0 || type === 0 /* NativeTag */ ? 0 /* NativeTag */ : 2 /* DynamicTag */;
1575
1655
  } else if (path5.isNullLiteral()) {
1576
1656
  nullable = true;
1577
1657
  } else if (path5.isIdentifier()) {
@@ -1588,12 +1668,14 @@ function analyzeExpressionTagName(name2, extra) {
1588
1668
  const decl = binding.path.parent;
1589
1669
  if (MARKO_FILE_REG.test(decl.source.value) && decl.specifiers.some((it) => import_compiler6.types.isImportDefaultSpecifier(it))) {
1590
1670
  const resolvedImport = (0, import_babel_utils9.resolveTagImport)(name2, decl.source.value) || decl.source.value;
1591
- if (type === 0 /* NativeTag */ || tagNameImported && tagNameImported !== resolvedImport) {
1592
- type = 2 /* DynamicTag */;
1593
- tagNameImported = void 0;
1594
- } else {
1671
+ if (type === void 0) {
1595
1672
  type = 1 /* CustomTag */;
1596
1673
  tagNameImported = resolvedImport;
1674
+ } else if (type === 0 /* NativeTag */) {
1675
+ type = 2 /* DynamicTag */;
1676
+ tagNameImported = void 0;
1677
+ } else if (tagNameImported !== resolvedImport) {
1678
+ tagNameImported = void 0;
1597
1679
  }
1598
1680
  } else {
1599
1681
  type = 2 /* DynamicTag */;
@@ -1620,9 +1702,8 @@ function analyzeExpressionTagName(name2, extra) {
1620
1702
  type = 2 /* DynamicTag */;
1621
1703
  }
1622
1704
  }
1623
- extra.tagNameType = type;
1705
+ extra.tagNameType = type ?? 2 /* DynamicTag */;
1624
1706
  extra.tagNameNullable = nullable;
1625
- extra.tagNameDynamic = true;
1626
1707
  if (type === 1 /* CustomTag */ && tagNameImported) {
1627
1708
  extra.tagNameImported = tagNameImported;
1628
1709
  }
@@ -2254,54 +2335,48 @@ var import_babel_utils13 = require("@marko/compiler/babel-utils");
2254
2335
  // src/common/attr-tag.ts
2255
2336
  var rest = false ? Symbol("Attribute Tag") : Symbol();
2256
2337
 
2257
- // src/common/helpers.ts
2258
- function classValue(classValue2) {
2259
- return toDelimitedString(classValue2, " ", stringifyClassObject);
2260
- }
2261
- function stringifyClassObject(name2, value) {
2262
- return value ? name2 : "";
2263
- }
2264
- function styleValue(styleValue2) {
2265
- return toDelimitedString(styleValue2, ";", stringifyStyleObject);
2266
- }
2267
- function stringifyStyleObject(name2, value) {
2268
- return value || value === 0 ? name2 + ":" + value : "";
2269
- }
2270
- function toDelimitedString(val, delimiter, stringify) {
2271
- let str = "";
2272
- let sep = "";
2273
- let part;
2274
- if (val) {
2275
- if (typeof val !== "object") {
2276
- str += val;
2277
- } else if (Array.isArray(val)) {
2278
- for (const v of val) {
2279
- part = toDelimitedString(v, delimiter, stringify);
2280
- if (part) {
2281
- str += sep + part;
2282
- sep = delimiter;
2283
- }
2338
+ // src/common/errors.ts
2339
+ function assertExclusiveAttrs(attrs, onError = throwErr) {
2340
+ if (attrs) {
2341
+ let exclusiveAttrs;
2342
+ if (attrs.checkedChange) {
2343
+ (exclusiveAttrs ||= []).push("checkedChange");
2344
+ }
2345
+ if (attrs.checkedValue) {
2346
+ (exclusiveAttrs ||= []).push("checkedValue");
2347
+ if (attrs.checked) {
2348
+ exclusiveAttrs.push("checked");
2284
2349
  }
2285
- } else {
2286
- for (const name2 in val) {
2287
- part = stringify(name2, val[name2]);
2288
- if (part) {
2289
- str += sep + part;
2290
- sep = delimiter;
2291
- }
2350
+ } else if (attrs.checkedValueChange) {
2351
+ (exclusiveAttrs ||= []).push("checkedValueChange");
2352
+ if (attrs.checked) {
2353
+ exclusiveAttrs.push("checked");
2292
2354
  }
2293
2355
  }
2356
+ if (attrs.valueChange) {
2357
+ (exclusiveAttrs ||= []).push("valueChange");
2358
+ }
2359
+ if (exclusiveAttrs && exclusiveAttrs.length > 1) {
2360
+ onError(
2361
+ `The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`
2362
+ );
2363
+ }
2294
2364
  }
2295
- return str;
2296
2365
  }
2297
- function isEventHandler(name2) {
2298
- return /^on[A-Z-]/.test(name2);
2299
- }
2300
- function getEventHandlerName(name2) {
2301
- return name2[2] === "-" ? name2.slice(3) : name2.slice(2).toLowerCase();
2366
+ function throwErr(msg) {
2367
+ throw new Error(msg);
2302
2368
  }
2303
- function isVoid(value) {
2304
- return value == null || value === false;
2369
+ function joinWithAnd(a) {
2370
+ switch (a.length) {
2371
+ case 0:
2372
+ return "";
2373
+ case 1:
2374
+ return a[0];
2375
+ case 2:
2376
+ return `${a[0]} and ${a[1]}`;
2377
+ default:
2378
+ return `${a.slice(0, -1).join(", ")}, and ${a[a.length - 1]}`;
2379
+ }
2305
2380
  }
2306
2381
 
2307
2382
  // src/html/content.ts
@@ -3170,10 +3245,10 @@ function getScopeExpression(section, targetSection) {
3170
3245
  }
3171
3246
  return scope;
3172
3247
  }
3173
- function createScopeReadExpression(section, reference) {
3248
+ function createScopeReadExpression(reference, section) {
3174
3249
  const propName = toPropertyName(getScopeAccessor(reference));
3175
3250
  return import_compiler19.types.memberExpression(
3176
- reference.type === 4 /* local */ ? scopeIdentifier : getScopeExpression(section, reference.section),
3251
+ section && reference.type !== 4 /* local */ ? getScopeExpression(section, reference.section) : scopeIdentifier,
3177
3252
  propName,
3178
3253
  propName.type !== "Identifier"
3179
3254
  );
@@ -3320,7 +3395,7 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
3320
3395
  import_compiler22.types.numericLiteral(id),
3321
3396
  getSignalFn(signal),
3322
3397
  scopeOffset || referencedBindings.length > 2 ? import_compiler22.types.numericLiteral(referencedBindings.length - 1) : void 0,
3323
- scopeOffset && getScopeAccessorLiteral(scopeOffset)
3398
+ scopeOffset && getScopeAccessorLiteral(scopeOffset, true)
3324
3399
  );
3325
3400
  };
3326
3401
  } else if (referencedBindings.section !== section && bindingUtil.find(section.referencedClosures, referencedBindings)) {
@@ -3330,7 +3405,7 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
3330
3405
  const closureSignalBuilder = getClosureSignalBuilder(section);
3331
3406
  return !closureSignalBuilder || isDynamicClosure(section, canonicalClosure) ? callRuntime(
3332
3407
  "_closure_get",
3333
- getScopeAccessorLiteral(canonicalClosure),
3408
+ getScopeAccessorLiteral(canonicalClosure, true),
3334
3409
  render,
3335
3410
  isImmediateOwner(section, canonicalClosure) ? void 0 : import_compiler22.types.arrowFunctionExpression(
3336
3411
  [scopeIdentifier],
@@ -3353,11 +3428,10 @@ function initValue(binding, isLet = false) {
3353
3428
  }
3354
3429
  return callRuntime(
3355
3430
  isLet ? "_let" : "_const",
3356
- getScopeAccessorLiteral(binding, isLet),
3431
+ getScopeAccessorLiteral(binding, true, isLet),
3357
3432
  fn
3358
3433
  );
3359
3434
  };
3360
- signal.valueAccessor = getScopeAccessorLiteral(binding);
3361
3435
  for (const alias of binding.aliases) {
3362
3436
  initValue(alias);
3363
3437
  }
@@ -3418,7 +3492,7 @@ function getSignalFn(signal) {
3418
3492
  ...getTranslatedExtraArgs(aliasSignal)
3419
3493
  ])
3420
3494
  ),
3421
- [createScopeReadExpression(binding.section, binding)]
3495
+ [createScopeReadExpression(binding)]
3422
3496
  )
3423
3497
  )
3424
3498
  );
@@ -3427,7 +3501,7 @@ function getSignalFn(signal) {
3427
3501
  import_compiler22.types.expressionStatement(
3428
3502
  import_compiler22.types.callExpression(aliasSignal.identifier, [
3429
3503
  scopeIdentifier,
3430
- createScopeReadExpression(binding.section, binding),
3504
+ createScopeReadExpression(binding),
3431
3505
  ...getTranslatedExtraArgs(aliasSignal)
3432
3506
  ])
3433
3507
  )
@@ -3442,7 +3516,7 @@ function getSignalFn(signal) {
3442
3516
  import_compiler22.types.callExpression(aliasSignal.identifier, [
3443
3517
  scopeIdentifier,
3444
3518
  toMemberExpression(
3445
- createScopeReadExpression(binding.section, binding),
3519
+ createScopeReadExpression(binding),
3446
3520
  key,
3447
3521
  binding.nullable
3448
3522
  ),
@@ -3454,10 +3528,7 @@ function getSignalFn(signal) {
3454
3528
  if (assertsHoists) {
3455
3529
  signal.render.push(
3456
3530
  import_compiler22.types.expressionStatement(
3457
- callRuntime(
3458
- "_assert_hoist",
3459
- createScopeReadExpression(binding.section, binding)
3460
- )
3531
+ callRuntime("_assert_hoist", createScopeReadExpression(binding))
3461
3532
  )
3462
3533
  );
3463
3534
  }
@@ -3799,9 +3870,7 @@ function writeDomGetters(section) {
3799
3870
  callRuntime(
3800
3871
  "_el",
3801
3872
  import_compiler22.types.stringLiteral(registerId),
3802
- import_compiler22.types.stringLiteral(
3803
- getAccessorPrefix().Getter + getScopeAccessorLiteral(binding).value
3804
- )
3873
+ getScopeAccessorLiteral(binding, true)
3805
3874
  )
3806
3875
  )
3807
3876
  ])
@@ -3814,7 +3883,7 @@ function writeHoists(section) {
3814
3883
  const accessors = [
3815
3884
  binding.type === 0 /* dom */ ? import_compiler22.types.stringLiteral(
3816
3885
  getAccessorPrefix().Getter + getScopeAccessor(binding)
3817
- ) : getScopeAccessorLiteral(binding)
3886
+ ) : getScopeAccessorLiteral(binding, true)
3818
3887
  ];
3819
3888
  let currentSection = section;
3820
3889
  while (currentSection && currentSection !== hoistedBinding.section) {
@@ -4105,7 +4174,7 @@ function replaceBindingReadNode(node) {
4105
4174
  const { extra } = node.callee;
4106
4175
  const binding = extra?.read?.binding;
4107
4176
  if (binding?.type === 0 /* dom */) {
4108
- const replacement = createScopeReadExpression(extra.section, binding);
4177
+ const replacement = createScopeReadExpression(binding, extra.section);
4109
4178
  return isOptimize() ? replacement : callRuntime("_el_read", replacement);
4110
4179
  }
4111
4180
  break;
@@ -4132,7 +4201,7 @@ function replaceAssignedNode(node) {
4132
4201
  extra.section,
4133
4202
  import_compiler22.types.binaryExpression(
4134
4203
  node.operator === "++" ? "+" : "-",
4135
- createScopeReadExpression(extra.section, extra.assignment),
4204
+ createScopeReadExpression(extra.assignment, extra.section),
4136
4205
  import_compiler22.types.numericLiteral(1)
4137
4206
  )
4138
4207
  );
@@ -4163,8 +4232,8 @@ function replaceAssignedNode(node) {
4163
4232
  -1
4164
4233
  ),
4165
4234
  createScopeReadExpression(
4166
- extra.section,
4167
- extra.assignment
4235
+ extra.assignment,
4236
+ extra.section
4168
4237
  ),
4169
4238
  node.right
4170
4239
  )
@@ -4228,7 +4297,7 @@ function getBuildAssignment(extra) {
4228
4297
  return (section, value) => {
4229
4298
  const replacement = callRuntime(
4230
4299
  "_call",
4231
- createScopeReadExpression(section, assignmentTo),
4300
+ createScopeReadExpression(assignmentTo, section),
4232
4301
  value
4233
4302
  );
4234
4303
  updateExpressions.add(replacement);
@@ -4359,7 +4428,7 @@ var dom_default = {
4359
4428
  const objProps = [];
4360
4429
  forEach(childSection.referencedLocalClosures, (closure) => {
4361
4430
  const closureSignal = getSignal(childSection, closure);
4362
- const key = toPropertyName(getScopeAccessor(closure));
4431
+ const key = toPropertyName(getScopeAccessor(closure, true));
4363
4432
  if (signalHasStatements(closureSignal)) {
4364
4433
  const expr = getSignalFn(closureSignal);
4365
4434
  if (import_compiler23.types.isFunction(expr) && import_compiler23.types.isBlockStatement(expr.body)) {
@@ -5267,10 +5336,10 @@ function translateVar(tag, initialValue, kind = "const") {
5267
5336
  }
5268
5337
  forEachIdentifierPath(tag.get("var"), (id) => {
5269
5338
  const binding = id.node.extra?.binding;
5270
- if (!binding || !binding.upstreamAlias || !binding.assignmentSections || id.node === tagVar) {
5339
+ if (!binding || !binding.upstreamAlias || !binding.assignmentSections || binding.property === void 0 || id.node === tagVar) {
5271
5340
  return;
5272
5341
  }
5273
- const changeName = binding.name + "Change";
5342
+ const changeName = binding.property + "Change";
5274
5343
  const changeBinding = binding.upstreamAlias.propertyAliases.get(changeName);
5275
5344
  if (changeBinding && changeName !== changeBinding.name) {
5276
5345
  getDestructurePattern(id)?.pushContainer(
@@ -5371,7 +5440,9 @@ var native_tag_default = {
5371
5440
  attrExprExtras = push(attrExprExtras, valueExtra);
5372
5441
  }
5373
5442
  }
5374
- assertExclusiveControllableGroups(tag, seen);
5443
+ assertExclusiveAttrs(seen, (msg) => {
5444
+ throw tag.get("name").buildCodeFrameError(msg);
5445
+ });
5375
5446
  if (node.var || hasEventHandlers || hasDynamicAttributes || getRelatedControllable(tagName, seen)?.special) {
5376
5447
  const tagExtra = node.extra ??= {};
5377
5448
  const tagSection = getOrCreateSection(tag);
@@ -5682,7 +5753,7 @@ var native_tag_default = {
5682
5753
  const write = writeTo(tag);
5683
5754
  const tagSection = getSection(tag);
5684
5755
  const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
5685
- if (visitAccessor) {
5756
+ if (nodeBinding) {
5686
5757
  visit(tag, 32 /* Get */);
5687
5758
  }
5688
5759
  write`<${tag.node.name}`;
@@ -5726,11 +5797,7 @@ var native_tag_default = {
5726
5797
  if (confident) {
5727
5798
  write`${getHTMLRuntime()[helper](computed)}`;
5728
5799
  } else {
5729
- const nodeExpr = import_compiler30.types.memberExpression(
5730
- scopeIdentifier,
5731
- visitAccessor,
5732
- true
5733
- );
5800
+ const nodeExpr = createScopeReadExpression(nodeBinding);
5734
5801
  const meta = {
5735
5802
  staticItems: void 0,
5736
5803
  dynamicItems: void 0,
@@ -5794,7 +5861,7 @@ var native_tag_default = {
5794
5861
  import_compiler30.types.expressionStatement(
5795
5862
  callRuntime(
5796
5863
  "_on",
5797
- import_compiler30.types.memberExpression(scopeIdentifier, visitAccessor, true),
5864
+ createScopeReadExpression(nodeBinding),
5798
5865
  import_compiler30.types.stringLiteral(getEventHandlerName(name2)),
5799
5866
  value
5800
5867
  )
@@ -5808,7 +5875,7 @@ var native_tag_default = {
5808
5875
  import_compiler30.types.expressionStatement(
5809
5876
  callRuntime(
5810
5877
  "_attr",
5811
- import_compiler30.types.memberExpression(scopeIdentifier, visitAccessor, true),
5878
+ createScopeReadExpression(nodeBinding),
5812
5879
  import_compiler30.types.stringLiteral(name2),
5813
5880
  value
5814
5881
  )
@@ -5903,19 +5970,6 @@ var native_tag_default = {
5903
5970
  }
5904
5971
  })
5905
5972
  };
5906
- function assertExclusiveControllableGroups(tag, attrs) {
5907
- const exclusiveGroups = [
5908
- attrs.open || attrs.openChange,
5909
- attrs.checked || attrs.checkedChange,
5910
- attrs.checkedValue || attrs.checkedValueChange,
5911
- attrs.valueChange
5912
- ].filter(Boolean);
5913
- if (exclusiveGroups.length > 1) {
5914
- throw tag.get("name").buildCodeFrameError(
5915
- `The attributes ${exclusiveGroups.map((attr) => `"${attr.name}"`).join(", ")} are mutually exclusive.`
5916
- );
5917
- }
5918
- }
5919
5973
  function getRelatedControllable(tagName, attrs) {
5920
5974
  switch (tagName) {
5921
5975
  case "input":
@@ -6343,7 +6397,7 @@ var for_default = {
6343
6397
  setClosureSignalBuilder(tag, (_closure, render) => {
6344
6398
  return callRuntime(
6345
6399
  "_for_closure",
6346
- getScopeAccessorLiteral(nodeRef),
6400
+ getScopeAccessorLiteral(nodeRef, true),
6347
6401
  render
6348
6402
  );
6349
6403
  });
@@ -6352,7 +6406,7 @@ var for_default = {
6352
6406
  signal.build = () => {
6353
6407
  return callRuntime(
6354
6408
  forTypeToDOMRuntime(forType),
6355
- getScopeAccessorLiteral(nodeRef),
6409
+ getScopeAccessorLiteral(nodeRef, true),
6356
6410
  import_compiler32.types.identifier(bodySection.name)
6357
6411
  );
6358
6412
  };
@@ -6873,7 +6927,7 @@ function buildContent(body) {
6873
6927
  scopeIdentifier,
6874
6928
  import_compiler33.types.objectExpression(
6875
6929
  toArray(bodySection.referencedLocalClosures, (ref) => {
6876
- const accessor = getScopeAccessor(ref);
6930
+ const accessor = getScopeAccessor(ref, true);
6877
6931
  const isShorthand = accessor === ref.name;
6878
6932
  return import_compiler33.types.objectProperty(
6879
6933
  toPropertyName(accessor),
@@ -7097,7 +7151,7 @@ function knownTagTranslateDOM(tag, propTree, getBindingIdentifier, callSetup) {
7097
7151
  source.register = true;
7098
7152
  source.buildAssignment = (valueSection, value) => {
7099
7153
  const changeArgs = [
7100
- createScopeReadExpression(valueSection, childScopeBinding),
7154
+ createScopeReadExpression(childScopeBinding, valueSection),
7101
7155
  value
7102
7156
  ];
7103
7157
  if (!isOptimize()) {
@@ -7113,7 +7167,7 @@ function knownTagTranslateDOM(tag, propTree, getBindingIdentifier, callSetup) {
7113
7167
  callRuntime(
7114
7168
  "_var",
7115
7169
  scopeIdentifier,
7116
- getScopeAccessorLiteral(childScopeBinding),
7170
+ getScopeAccessorLiteral(childScopeBinding, true),
7117
7171
  source.identifier
7118
7172
  )
7119
7173
  )
@@ -7366,7 +7420,7 @@ function writeParamsToSignals(tag, propTree, importAlias, info) {
7366
7420
  );
7367
7421
  }
7368
7422
  let renderArgs = [
7369
- createScopeReadExpression(info.tagSection, info.childScopeBinding)
7423
+ createScopeReadExpression(info.childScopeBinding, info.tagSection)
7370
7424
  ];
7371
7425
  if (tag.node.arguments) {
7372
7426
  renderArgs = [...renderArgs, ...tag.node.arguments];
@@ -7401,8 +7455,8 @@ function writeParamsToSignals(tag, propTree, importAlias, info) {
7401
7455
  import_compiler34.types.expressionStatement(
7402
7456
  import_compiler34.types.callExpression(argExportIdentifier, [
7403
7457
  createScopeReadExpression(
7404
- info.tagSection,
7405
- info.childScopeBinding
7458
+ info.childScopeBinding,
7459
+ info.tagSection
7406
7460
  ),
7407
7461
  arg
7408
7462
  ])
@@ -7474,7 +7528,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7474
7528
  referencedBindings,
7475
7529
  import_compiler34.types.expressionStatement(
7476
7530
  import_compiler34.types.callExpression(tagInputIdentifier, [
7477
- createScopeReadExpression(info.tagSection, info.childScopeBinding),
7531
+ createScopeReadExpression(info.childScopeBinding, info.tagSection),
7478
7532
  translatedProps
7479
7533
  ])
7480
7534
  )
@@ -7558,8 +7612,8 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7558
7612
  import_compiler34.types.expressionStatement(
7559
7613
  import_compiler34.types.callExpression(attrExportIdentifier, [
7560
7614
  createScopeReadExpression(
7561
- info.tagSection,
7562
- info.childScopeBinding
7615
+ info.childScopeBinding,
7616
+ info.tagSection
7563
7617
  ),
7564
7618
  getAttrTagIdentifier(attrTagMeta)
7565
7619
  ])
@@ -7583,7 +7637,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7583
7637
  // TODO: pretty sure content needs to have the reference group of it's param defaults.
7584
7638
  import_compiler34.types.expressionStatement(
7585
7639
  import_compiler34.types.callExpression(contentExportIdentifier, [
7586
- createScopeReadExpression(info.tagSection, info.childScopeBinding),
7640
+ createScopeReadExpression(info.childScopeBinding, info.tagSection),
7587
7641
  import_compiler34.types.callExpression(import_compiler34.types.identifier(bodySection.name), [scopeIdentifier])
7588
7642
  ])
7589
7643
  )
@@ -7622,7 +7676,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7622
7676
  attr.value.extra?.referencedBindings,
7623
7677
  import_compiler34.types.expressionStatement(
7624
7678
  import_compiler34.types.callExpression(attrExportIdentifier, [
7625
- createScopeReadExpression(info.tagSection, info.childScopeBinding),
7679
+ createScopeReadExpression(info.childScopeBinding, info.tagSection),
7626
7680
  attr.value
7627
7681
  ])
7628
7682
  )
@@ -7655,7 +7709,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7655
7709
  referencedBindings,
7656
7710
  import_compiler34.types.expressionStatement(
7657
7711
  import_compiler34.types.callExpression(attrExportIdentifier, [
7658
- createScopeReadExpression(info.tagSection, info.childScopeBinding),
7712
+ createScopeReadExpression(info.childScopeBinding, info.tagSection),
7659
7713
  getMissingPropValue(name2)
7660
7714
  ])
7661
7715
  )
@@ -7757,9 +7811,13 @@ function trackDomVarReferences(tag, binding) {
7757
7811
  const babelBinding = tag.scope.getBinding(tagVar.name);
7758
7812
  const section = getOrCreateSection(tag);
7759
7813
  if (babelBinding.constantViolations.length) {
7760
- throw babelBinding.constantViolations[0].buildCodeFrameError(
7761
- "Tag variables on native elements cannot be assigned to."
7762
- );
7814
+ for (const ref of babelBinding.constantViolations) {
7815
+ throw ref.type === "MarkoTag" ? ref.get("var").buildCodeFrameError(
7816
+ `Duplicate declaration ${JSON.stringify(binding.name)}`
7817
+ ) : ref.buildCodeFrameError(
7818
+ "Tag variables on native elements cannot be assigned to."
7819
+ );
7820
+ }
7763
7821
  }
7764
7822
  let registerId;
7765
7823
  for (const ref of babelBinding.referencePaths) {
@@ -7931,6 +7989,11 @@ function trackReferencesForBinding(babelBinding, binding) {
7931
7989
  }
7932
7990
  }
7933
7991
  for (const ref of constantViolations) {
7992
+ if (ref.type === "MarkoTag") {
7993
+ throw ref.get("var").buildCodeFrameError(
7994
+ `Duplicate declaration ${JSON.stringify(binding.name)}`
7995
+ );
7996
+ }
7934
7997
  if (isReferenceHoisted(babelBinding.path, ref)) {
7935
7998
  throw ref.buildCodeFrameError("Cannot assign to hoisted tag variable.");
7936
7999
  }
@@ -8678,21 +8741,23 @@ function getAllTagReferenceNodes(tag, referenceNodes = []) {
8678
8741
  }
8679
8742
  return referenceNodes;
8680
8743
  }
8681
- function getScopeAccessorLiteral(binding, includeId) {
8744
+ function getScopeAccessorLiteral(binding, encoded, includeId) {
8682
8745
  const canonicalBinding = getCanonicalBinding(binding);
8683
8746
  if (isOptimize()) {
8684
- return import_compiler35.types.numericLiteral(canonicalBinding.id);
8747
+ return encoded ? import_compiler35.types.numericLiteral(canonicalBinding.id) : import_compiler35.types.stringLiteral(decodeAccessor(canonicalBinding.id));
8748
+ } else if (includeId || canonicalBinding.type === 0 /* dom */) {
8749
+ return import_compiler35.types.stringLiteral(`${canonicalBinding.name}/${canonicalBinding.id}`);
8685
8750
  }
8686
- return import_compiler35.types.stringLiteral(
8687
- canonicalBinding.name + (includeId || canonicalBinding.type === 0 /* dom */ ? `/${canonicalBinding.id}` : "")
8688
- );
8751
+ return import_compiler35.types.stringLiteral(canonicalBinding.name);
8689
8752
  }
8690
- function getScopeAccessor(binding, includeId) {
8753
+ function getScopeAccessor(binding, encoded, includeId) {
8691
8754
  const canonicalBinding = getCanonicalBinding(binding);
8692
8755
  if (isOptimize()) {
8693
- return canonicalBinding.id + "";
8756
+ return encoded ? canonicalBinding.id + "" : decodeAccessor(canonicalBinding.id);
8757
+ } else if (includeId || canonicalBinding.type === 0 /* dom */) {
8758
+ return `${canonicalBinding.name}/${canonicalBinding.id}`;
8694
8759
  }
8695
- return canonicalBinding.name + (includeId || canonicalBinding.type === 0 /* dom */ ? `/${canonicalBinding.id}` : "");
8760
+ return canonicalBinding.name;
8696
8761
  }
8697
8762
  function getDebugScopeAccess(binding) {
8698
8763
  let root = binding;
@@ -8755,7 +8820,7 @@ function getReadReplacement(node) {
8755
8820
  [getScopeExpression(extra.section, readBinding.section)]
8756
8821
  );
8757
8822
  } else {
8758
- replacement = createScopeReadExpression(extra.section, readBinding);
8823
+ replacement = createScopeReadExpression(readBinding, extra.section);
8759
8824
  }
8760
8825
  } else {
8761
8826
  if (node.type !== "Identifier") {
@@ -8769,7 +8834,7 @@ function getReadReplacement(node) {
8769
8834
  let curNode = node;
8770
8835
  let curBinding = read.binding;
8771
8836
  let replaceMember;
8772
- replacement = isOutputDOM() ? createScopeReadExpression(extra.section, read.binding) : import_compiler35.types.identifier(read.binding.name);
8837
+ replacement = isOutputDOM() ? createScopeReadExpression(read.binding, extra.section) : import_compiler35.types.identifier(read.binding.name);
8773
8838
  while (props.length && (curNode.type === "MemberExpression" || curNode.type === "OptionalMemberExpression")) {
8774
8839
  const prop = props.pop();
8775
8840
  const memberProp = getMemberExpressionPropString(curNode);
@@ -9148,7 +9213,7 @@ var await_default = {
9148
9213
  signal.build = () => {
9149
9214
  return callRuntime(
9150
9215
  "_await",
9151
- getScopeAccessorLiteral(nodeRef),
9216
+ getScopeAccessorLiteral(nodeRef, true),
9152
9217
  import_compiler36.types.identifier(bodySection.name)
9153
9218
  );
9154
9219
  };
@@ -9236,11 +9301,17 @@ var const_default = {
9236
9301
  const binding = trackVarReferences(tag, 5 /* derived */, upstreamAlias);
9237
9302
  if (binding) {
9238
9303
  if (node.var.type === "Identifier") {
9239
- const assignment = tag.scope.getBinding(node.var.name)?.constantViolations?.[0];
9240
- if (assignment) {
9241
- throw assignment.buildCodeFrameError(
9242
- `${node.var.name} is readonly and cannot be mutated.`
9243
- );
9304
+ const constantViolations = tag.scope.getBinding(
9305
+ node.var.name
9306
+ )?.constantViolations;
9307
+ if (constantViolations?.length) {
9308
+ for (const assignment of constantViolations) {
9309
+ if (assignment.type !== "MarkoTag") {
9310
+ throw assignment.buildCodeFrameError(
9311
+ `${node.var.name} is readonly and cannot be mutated.`
9312
+ );
9313
+ }
9314
+ }
9244
9315
  }
9245
9316
  }
9246
9317
  if (!valueExtra.nullable) binding.nullable = false;
@@ -9612,11 +9683,7 @@ var html_comment_default = {
9612
9683
  import_compiler43.types.expressionStatement(
9613
9684
  callRuntime(
9614
9685
  "_text",
9615
- import_compiler43.types.memberExpression(
9616
- scopeIdentifier,
9617
- getScopeAccessorLiteral(nodeBinding),
9618
- true
9619
- ),
9686
+ createScopeReadExpression(nodeBinding),
9620
9687
  textLiteral
9621
9688
  )
9622
9689
  )
@@ -9751,8 +9818,7 @@ var html_script_default = {
9751
9818
  if (isHTML) {
9752
9819
  translateDomVar(tag, nodeBinding);
9753
9820
  }
9754
- const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
9755
- if (visitAccessor) {
9821
+ if (nodeBinding) {
9756
9822
  visit(tag, 32 /* Get */);
9757
9823
  }
9758
9824
  write`<script`;
@@ -9778,7 +9844,7 @@ var html_script_default = {
9778
9844
  import_compiler44.types.expressionStatement(
9779
9845
  callRuntime(
9780
9846
  helper,
9781
- import_compiler44.types.memberExpression(scopeIdentifier, visitAccessor, true),
9847
+ createScopeReadExpression(nodeBinding),
9782
9848
  value
9783
9849
  )
9784
9850
  )
@@ -9803,7 +9869,7 @@ var html_script_default = {
9803
9869
  import_compiler44.types.expressionStatement(
9804
9870
  callRuntime(
9805
9871
  "_on",
9806
- import_compiler44.types.memberExpression(scopeIdentifier, visitAccessor, true),
9872
+ createScopeReadExpression(nodeBinding),
9807
9873
  import_compiler44.types.stringLiteral(getEventHandlerName(name2)),
9808
9874
  value
9809
9875
  )
@@ -9817,7 +9883,7 @@ var html_script_default = {
9817
9883
  import_compiler44.types.expressionStatement(
9818
9884
  callRuntime(
9819
9885
  "_attr",
9820
- import_compiler44.types.memberExpression(scopeIdentifier, visitAccessor, true),
9886
+ createScopeReadExpression(nodeBinding),
9821
9887
  import_compiler44.types.stringLiteral(name2),
9822
9888
  value
9823
9889
  )
@@ -9828,6 +9894,7 @@ var html_script_default = {
9828
9894
  }
9829
9895
  }
9830
9896
  if (spreadExpression) {
9897
+ const visitAccessor = getScopeAccessorLiteral(nodeBinding);
9831
9898
  if (isHTML) {
9832
9899
  addHTMLEffectCall(tagSection, tagExtra.referencedBindings);
9833
9900
  if (skipExpression) {
@@ -9905,11 +9972,7 @@ var html_script_default = {
9905
9972
  import_compiler44.types.expressionStatement(
9906
9973
  callRuntime(
9907
9974
  "_text_content",
9908
- import_compiler44.types.memberExpression(
9909
- scopeIdentifier,
9910
- getScopeAccessorLiteral(nodeBinding),
9911
- true
9912
- ),
9975
+ createScopeReadExpression(nodeBinding),
9913
9976
  textLiteral
9914
9977
  )
9915
9978
  )
@@ -10096,8 +10159,7 @@ var html_style_default = {
10096
10159
  if (isHTML) {
10097
10160
  translateDomVar(tag, nodeBinding);
10098
10161
  }
10099
- const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
10100
- if (visitAccessor) {
10162
+ if (nodeBinding) {
10101
10163
  visit(tag, 32 /* Get */);
10102
10164
  }
10103
10165
  write`<style`;
@@ -10123,7 +10185,7 @@ var html_style_default = {
10123
10185
  import_compiler45.types.expressionStatement(
10124
10186
  callRuntime(
10125
10187
  helper,
10126
- import_compiler45.types.memberExpression(scopeIdentifier, visitAccessor, true),
10188
+ createScopeReadExpression(nodeBinding),
10127
10189
  value
10128
10190
  )
10129
10191
  )
@@ -10148,7 +10210,7 @@ var html_style_default = {
10148
10210
  import_compiler45.types.expressionStatement(
10149
10211
  callRuntime(
10150
10212
  "_on",
10151
- import_compiler45.types.memberExpression(scopeIdentifier, visitAccessor, true),
10213
+ createScopeReadExpression(nodeBinding),
10152
10214
  import_compiler45.types.stringLiteral(getEventHandlerName(name2)),
10153
10215
  value
10154
10216
  )
@@ -10162,7 +10224,7 @@ var html_style_default = {
10162
10224
  import_compiler45.types.expressionStatement(
10163
10225
  callRuntime(
10164
10226
  "_attr",
10165
- import_compiler45.types.memberExpression(scopeIdentifier, visitAccessor, true),
10227
+ createScopeReadExpression(nodeBinding),
10166
10228
  import_compiler45.types.stringLiteral(name2),
10167
10229
  value
10168
10230
  )
@@ -10173,6 +10235,7 @@ var html_style_default = {
10173
10235
  }
10174
10236
  }
10175
10237
  if (spreadExpression) {
10238
+ const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
10176
10239
  if (isHTML) {
10177
10240
  addHTMLEffectCall(tagSection, tagExtra.referencedBindings);
10178
10241
  if (skipExpression) {
@@ -10250,11 +10313,7 @@ var html_style_default = {
10250
10313
  import_compiler45.types.expressionStatement(
10251
10314
  callRuntime(
10252
10315
  "_text_content",
10253
- import_compiler45.types.memberExpression(
10254
- scopeIdentifier,
10255
- getScopeAccessorLiteral(nodeBinding),
10256
- true
10257
- ),
10316
+ createScopeReadExpression(nodeBinding),
10258
10317
  textLiteral
10259
10318
  )
10260
10319
  )
@@ -10621,7 +10680,7 @@ var IfTag = {
10621
10680
  setClosureSignalBuilder(branchTag, (_closure, render) => {
10622
10681
  return callRuntime(
10623
10682
  "_if_closure",
10624
- getScopeAccessorLiteral(nodeRef),
10683
+ getScopeAccessorLiteral(nodeRef, true),
10625
10684
  import_compiler48.types.numericLiteral(i),
10626
10685
  render
10627
10686
  );
@@ -10634,7 +10693,7 @@ var IfTag = {
10634
10693
  signal.build = () => {
10635
10694
  return callRuntime(
10636
10695
  "_if",
10637
- getScopeAccessorLiteral(nodeRef),
10696
+ getScopeAccessorLiteral(nodeRef, true),
10638
10697
  ...rendererIdentifiers.reverse()
10639
10698
  );
10640
10699
  };
@@ -10694,7 +10753,7 @@ function assertValidCondition(tag) {
10694
10753
  function assertHasPrecedingCondition(tag) {
10695
10754
  let prev = tag.getPrevSibling();
10696
10755
  while (prev.node && prev.isMarkoComment()) prev = prev.getPrevSibling();
10697
- if (!isConditionTag(prev) || getTagName(prev) !== "else" && !prev.node.attributes.length) {
10756
+ if (!isConditionTag(prev) || getTagName(prev) === "else" && !prev.node.attributes.length) {
10698
10757
  throw tag.buildCodeFrameError(
10699
10758
  `The [\`<${getTagName(tag)}>\` tag](https://markojs.com/docs/reference/core-tag#if--else) must have a preceding \`<if=cond>\` or \`<else if=cond>\`.`
10700
10759
  );
@@ -10734,7 +10793,7 @@ function assertOptionalIfAttribute(tag) {
10734
10793
  const { node } = tag;
10735
10794
  const [ifAttr] = node.attributes;
10736
10795
  if (node.attributes.length > 1 || ifAttr && ifAttr.name !== "if") {
10737
- const start = node.attributes[1].loc?.start;
10796
+ const start = node.attributes[0].loc?.start;
10738
10797
  const end = node.attributes[node.attributes.length - 1].loc?.end;
10739
10798
  const msg = `The [\`${getTagName(tag)}\` tag](https://markojs.com/docs/reference/core-tag#if--else) only supports an \`if=\` attribute.`;
10740
10799
  if (start == null || end == null) {
@@ -10973,7 +11032,7 @@ var lifecycle_default = {
10973
11032
  callRuntime(
10974
11033
  "_lifecycle",
10975
11034
  scopeIdentifier,
10976
- getScopeAccessorLiteral(lifecycleAttrsRef),
11035
+ getScopeAccessorLiteral(lifecycleAttrsRef, true),
10977
11036
  propsToExpression(translatedAttrs.properties)
10978
11037
  )
10979
11038
  )
@@ -11506,7 +11565,7 @@ var try_default = {
11506
11565
  signal.build = () => {
11507
11566
  return callRuntime(
11508
11567
  "_try",
11509
- getScopeAccessorLiteral(nodeRef),
11568
+ getScopeAccessorLiteral(nodeRef, true),
11510
11569
  import_compiler57.types.identifier(bodySection.name)
11511
11570
  );
11512
11571
  };
@@ -11742,11 +11801,7 @@ var placeholder_default = {
11742
11801
  import_compiler59.types.expressionStatement(
11743
11802
  method === "_text" ? callRuntime(
11744
11803
  "_text",
11745
- import_compiler59.types.memberExpression(
11746
- scopeIdentifier,
11747
- getScopeAccessorLiteral(nodeBinding),
11748
- true
11749
- ),
11804
+ createScopeReadExpression(nodeBinding),
11750
11805
  value
11751
11806
  ) : callRuntime(
11752
11807
  "_html",
@@ -12102,7 +12157,7 @@ function translateDOM(tag) {
12102
12157
  void 0,
12103
12158
  import_compiler62.types.expressionStatement(
12104
12159
  import_compiler62.types.callExpression(import_compiler62.types.identifier(childExports.setup), [
12105
- createScopeReadExpression(section, childBinding)
12160
+ createScopeReadExpression(childBinding, section)
12106
12161
  ])
12107
12162
  )
12108
12163
  );
@@ -12133,7 +12188,7 @@ function translateDOM(tag) {
12133
12188
  childExports.setup,
12134
12189
  tagName
12135
12190
  ),
12136
- [createScopeReadExpression(section, childBinding)]
12191
+ [createScopeReadExpression(childBinding, section)]
12137
12192
  )
12138
12193
  )
12139
12194
  );
@@ -12188,6 +12243,7 @@ var import_compiler63 = require("@marko/compiler");
12188
12243
  var import_babel_utils51 = require("@marko/compiler/babel-utils");
12189
12244
  var kDOMBinding3 = Symbol("dynamic tag dom binding");
12190
12245
  var kChildOffsetScopeBinding2 = Symbol("custom tag scope offset");
12246
+ var importedDynamicTagResume = /* @__PURE__ */ new WeakSet();
12191
12247
  var dynamic_tag_default = {
12192
12248
  analyze: {
12193
12249
  enter(tag) {
@@ -12277,7 +12333,7 @@ var dynamic_tag_default = {
12277
12333
  import_compiler63.types.callExpression(
12278
12334
  import_compiler63.types.memberExpression(signal.identifier, import_compiler63.types.identifier("_")),
12279
12335
  [
12280
- createScopeReadExpression(section, childBinding),
12336
+ createScopeReadExpression(childBinding, section),
12281
12337
  getScopeExpression(section, definedBodySection.parent)
12282
12338
  ]
12283
12339
  )
@@ -12459,7 +12515,7 @@ var dynamic_tag_default = {
12459
12515
  signal.build = () => {
12460
12516
  return callRuntime(
12461
12517
  "_dynamic_tag",
12462
- getScopeAccessorLiteral(nodeBinding),
12518
+ getScopeAccessorLiteral(nodeBinding, true),
12463
12519
  bodySection && import_compiler63.types.identifier(bodySection.name),
12464
12520
  tagVarSignal ? import_compiler63.types.arrowFunctionExpression([], tagVarSignal.identifier) : void 0,
12465
12521
  hasTagArgs && import_compiler63.types.numericLiteral(1)
@@ -12478,12 +12534,27 @@ var dynamic_tag_default = {
12478
12534
  ];
12479
12535
  }
12480
12536
  }
12537
+ enableDynamicTagResume(tag);
12481
12538
  addValue(section, tagExtra.referencedBindings, signal, tagExpression);
12482
12539
  tag.remove();
12483
12540
  }
12484
12541
  }
12485
12542
  }
12486
12543
  };
12544
+ function enableDynamicTagResume(tag) {
12545
+ const program = (0, import_babel_utils51.getProgram)().node;
12546
+ if (!importedDynamicTagResume.has(program) && analyzeTagNameType(tag, true) !== 1 /* CustomTag */) {
12547
+ for (const attr of tag.node.attributes) {
12548
+ if (attr.type === "MarkoSpreadAttribute" || attr.type === "MarkoAttribute" && isEventOrChangeHandler(attr.name)) {
12549
+ importedDynamicTagResume.add(program);
12550
+ program.body.push(
12551
+ import_compiler63.types.expressionStatement(callRuntime("_resume_dynamic_tag"))
12552
+ );
12553
+ return;
12554
+ }
12555
+ }
12556
+ }
12557
+ }
12487
12558
 
12488
12559
  // src/translator/visitors/tag/index.ts
12489
12560
  var tag_default = {
@@ -12549,7 +12620,8 @@ var tag_default = {
12549
12620
  }
12550
12621
  }
12551
12622
  }
12552
- if (extra.tagNameDynamic && extra.tagNameNullable && !tag.get("name").isIdentifier() && isOutputHTML()) {
12623
+ const type = analyzeTagNameType(tag);
12624
+ if (extra.tagNameDynamic && extra.tagNameNullable && type === 0 /* NativeTag */ && !tag.get("name").isIdentifier() && isOutputHTML()) {
12553
12625
  const tagNameId = generateUidIdentifier("tagName");
12554
12626
  const [tagNameVarPath] = tag.insertBefore(
12555
12627
  import_compiler64.types.variableDeclaration("const", [
@@ -12559,7 +12631,7 @@ var tag_default = {
12559
12631
  tagNameVarPath.skip();
12560
12632
  tag.set("name", tagNameId);
12561
12633
  }
12562
- switch (extra.tagNameType) {
12634
+ switch (type) {
12563
12635
  case 0 /* NativeTag */:
12564
12636
  native_tag_default.translate.enter(tag);
12565
12637
  break;
@@ -12580,7 +12652,7 @@ var tag_default = {
12580
12652
  exit(translator.hook, tag);
12581
12653
  return;
12582
12654
  }
12583
- switch (tag.node.extra.tagNameType) {
12655
+ switch (analyzeTagNameType(tag)) {
12584
12656
  case 0 /* NativeTag */:
12585
12657
  native_tag_default.translate.exit(tag);
12586
12658
  break;