marko 6.0.0-3.9 → 6.0.0-next.3.16

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/dist/html.js CHANGED
@@ -129,7 +129,7 @@ function isVoid(value) {
129
129
  return value == null || value === !1;
130
130
  }
131
131
  function normalizeDynamicRenderer(value) {
132
- if (value) return value.renderBody || value.default || value;
132
+ if (value) return value.content || value.default || value;
133
133
  }
134
134
 
135
135
  // src/html/content.ts
@@ -1043,33 +1043,33 @@ function ensureScopeWithId(scopeId) {
1043
1043
  function $global() {
1044
1044
  return $chunk.boundary.state.$global;
1045
1045
  }
1046
- function fork(promise, renderBody) {
1046
+ function fork(promise, content) {
1047
1047
  if (!isPromise(promise)) {
1048
- renderBody(promise);
1048
+ content(promise);
1049
1049
  return;
1050
1050
  }
1051
1051
  let chunk = $chunk, { boundary } = chunk;
1052
1052
  chunk.next = $chunk = new Chunk(boundary, chunk.next, chunk.context), chunk.async = !0, chunk.context?.[kPendingContexts] && (chunk.context = { ...chunk.context, [kPendingContexts]: 0 }), boundary.startAsync(), promise.then(
1053
1053
  (value) => {
1054
- chunk.async && (chunk.async = !1, boundary.signal.aborted || (chunk.render(renderBody, value), boundary.endAsync(chunk)));
1054
+ chunk.async && (chunk.async = !1, boundary.signal.aborted || (chunk.render(content, value), boundary.endAsync(chunk)));
1055
1055
  },
1056
1056
  (err) => {
1057
1057
  chunk.async = !1, boundary.abort(err);
1058
1058
  }
1059
1059
  );
1060
1060
  }
1061
- function tryPlaceholder(renderBody, renderPlaceholder) {
1061
+ function tryPlaceholder(content, placeholder) {
1062
1062
  let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context);
1063
- if (body === body.render(renderBody)) {
1063
+ if (body === body.render(content)) {
1064
1064
  chunk.append(body);
1065
1065
  return;
1066
1066
  }
1067
- chunk.next = $chunk = new Chunk(boundary, chunk.next, body.context), chunk.placeholderBody = body, chunk.placeholderRender = renderPlaceholder;
1067
+ chunk.next = $chunk = new Chunk(boundary, chunk.next, body.context), chunk.placeholderBody = body, chunk.placeholderRender = placeholder;
1068
1068
  }
1069
- function tryCatch(renderBody, renderCatch) {
1070
- let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state), body = new Chunk(catchBoundary, null, chunk.context), bodyEnd = body.render(renderBody);
1069
+ function tryCatch(content, catchContent) {
1070
+ let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state), body = new Chunk(catchBoundary, null, chunk.context), bodyEnd = body.render(content);
1071
1071
  if (catchBoundary.signal.aborted) {
1072
- renderCatch(catchBoundary.signal.reason);
1072
+ catchContent(catchBoundary.signal.reason);
1073
1073
  return;
1074
1074
  }
1075
1075
  if (body === bodyEnd) {
@@ -1088,7 +1088,7 @@ function tryCatch(renderBody, renderCatch) {
1088
1088
  } while (cur !== bodyNext);
1089
1089
  }
1090
1090
  let catchChunk = new Chunk(boundary, null, chunk.context);
1091
- catchChunk.reorderId = reorderId, catchChunk.render(renderCatch, catchBoundary.signal.reason), state.reorder(catchChunk), boundary.endAsync();
1091
+ catchChunk.reorderId = reorderId, catchChunk.render(catchContent, catchBoundary.signal.reason), state.reorder(catchChunk), boundary.endAsync();
1092
1092
  } else catchBoundary.done ? boundary.endAsync() : boundary.onNext();
1093
1093
  };
1094
1094
  }
@@ -1208,11 +1208,11 @@ var State2 = class {
1208
1208
  }
1209
1209
  return cur;
1210
1210
  }
1211
- render(renderBody, val) {
1211
+ render(content, val) {
1212
1212
  let prev = $chunk;
1213
1213
  $chunk = this;
1214
1214
  try {
1215
- return renderBody(val), $chunk;
1215
+ return content(val), $chunk;
1216
1216
  } catch (err) {
1217
1217
  return this.boundary.abort(err), this;
1218
1218
  } finally {
@@ -1320,14 +1320,14 @@ function optionValueAttr(value) {
1320
1320
  return attr("value", value) + (!isVoid(value) && (Array.isArray(value) ? selectedValue.includes(value) : selectedValue === value) ? " selected" : "");
1321
1321
  }
1322
1322
  var kSelectedValue = Symbol("selectedValue");
1323
- function controllable_select_value(scopeId, nodeAccessor, value, valueChange, renderBody) {
1323
+ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, content) {
1324
1324
  valueChange && writeControlledScope(
1325
1325
  3 /* SelectValue */,
1326
1326
  scopeId,
1327
1327
  nodeAccessor,
1328
1328
  value,
1329
1329
  valueChange
1330
- ), renderBody && withContext(kSelectedValue, value, renderBody);
1330
+ ), content && withContext(kSelectedValue, value, content);
1331
1331
  }
1332
1332
  function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
1333
1333
  return valueChange && writeControlledScope(
@@ -1435,7 +1435,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
1435
1435
  result += styleAttr(val);
1436
1436
  break;
1437
1437
  case "":
1438
- case "renderBody":
1438
+ case "content":
1439
1439
  break;
1440
1440
  default:
1441
1441
  isVoid(val) || (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, {
@@ -1497,8 +1497,8 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
1497
1497
 
1498
1498
  // src/html/dynamic-tag.ts
1499
1499
  var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
1500
- function dynamicTagInput(scope, tag, input, renderBody, tagVar) {
1501
- if (!tag && !renderBody) return;
1500
+ function dynamicTagInput(scope, tag, input, content, tagVar) {
1501
+ if (!tag && !content) return;
1502
1502
  let scopeId = getScopeId(scope);
1503
1503
  return write(`${markResumeScopeStart(scopeId)}`), writeScope(scopeId, scope), tag ? typeof tag == "string" ? (nextScopeId(), write(
1504
1504
  `<${tag}${attrs(input, 0, scopeId, tag)}>`
@@ -1509,13 +1509,13 @@ function dynamicTagInput(scope, tag, input, renderBody, tagVar) {
1509
1509
  input.value,
1510
1510
  input.valueChange
1511
1511
  )
1512
- ) : renderBody && (tag === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
1512
+ ) : content && (tag === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
1513
1513
  scopeId,
1514
1514
  0,
1515
1515
  input.value,
1516
1516
  input.valueChange,
1517
- renderBody
1518
- ) : renderBody()), write(`</${tag}>`)), null) : getDynamicRenderer(tag)(renderBody ? { ...input, renderBody } : input, tagVar) : renderBody();
1517
+ content
1518
+ ) : content()), write(`</${tag}>`)), null) : getDynamicRenderer(tag)(content ? { ...input, content } : input, tagVar) : content();
1519
1519
  }
1520
1520
  function dynamicTagArgs(scope, tag, args) {
1521
1521
  if (!tag) return;
@@ -1565,13 +1565,18 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
1565
1565
  boundary,
1566
1566
  null,
1567
1567
  null
1568
- );
1568
+ ), normalizedInput = input;
1569
+ if ("renderBody" in input) {
1570
+ normalizedInput = {};
1571
+ for (let key in input)
1572
+ normalizedInput[key === "renderBody" ? "content" : key] = input[key];
1573
+ }
1569
1574
  head.render(() => {
1570
1575
  if (willRerender) {
1571
1576
  let scopeId = peekNextScopeId();
1572
1577
  writeScope(scopeId, { m5c: component.id }), writeEffect(scopeId, SET_SCOPE_REGISTER_ID);
1573
1578
  }
1574
- renderer(input);
1579
+ renderer(normalizedInput);
1575
1580
  });
1576
1581
  let asyncOut = classAPIOut.beginAsync();
1577
1582
  (boundary.onNext = () => {
package/dist/html.mjs CHANGED
@@ -56,7 +56,7 @@ function isVoid(value) {
56
56
  return value == null || value === !1;
57
57
  }
58
58
  function normalizeDynamicRenderer(value) {
59
- if (value) return value.renderBody || value.default || value;
59
+ if (value) return value.content || value.default || value;
60
60
  }
61
61
 
62
62
  // src/html/content.ts
@@ -970,33 +970,33 @@ function ensureScopeWithId(scopeId) {
970
970
  function $global() {
971
971
  return $chunk.boundary.state.$global;
972
972
  }
973
- function fork(promise, renderBody) {
973
+ function fork(promise, content) {
974
974
  if (!isPromise(promise)) {
975
- renderBody(promise);
975
+ content(promise);
976
976
  return;
977
977
  }
978
978
  let chunk = $chunk, { boundary } = chunk;
979
979
  chunk.next = $chunk = new Chunk(boundary, chunk.next, chunk.context), chunk.async = !0, chunk.context?.[kPendingContexts] && (chunk.context = { ...chunk.context, [kPendingContexts]: 0 }), boundary.startAsync(), promise.then(
980
980
  (value) => {
981
- chunk.async && (chunk.async = !1, boundary.signal.aborted || (chunk.render(renderBody, value), boundary.endAsync(chunk)));
981
+ chunk.async && (chunk.async = !1, boundary.signal.aborted || (chunk.render(content, value), boundary.endAsync(chunk)));
982
982
  },
983
983
  (err) => {
984
984
  chunk.async = !1, boundary.abort(err);
985
985
  }
986
986
  );
987
987
  }
988
- function tryPlaceholder(renderBody, renderPlaceholder) {
988
+ function tryPlaceholder(content, placeholder) {
989
989
  let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context);
990
- if (body === body.render(renderBody)) {
990
+ if (body === body.render(content)) {
991
991
  chunk.append(body);
992
992
  return;
993
993
  }
994
- chunk.next = $chunk = new Chunk(boundary, chunk.next, body.context), chunk.placeholderBody = body, chunk.placeholderRender = renderPlaceholder;
994
+ chunk.next = $chunk = new Chunk(boundary, chunk.next, body.context), chunk.placeholderBody = body, chunk.placeholderRender = placeholder;
995
995
  }
996
- function tryCatch(renderBody, renderCatch) {
997
- let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state), body = new Chunk(catchBoundary, null, chunk.context), bodyEnd = body.render(renderBody);
996
+ function tryCatch(content, catchContent) {
997
+ let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state), body = new Chunk(catchBoundary, null, chunk.context), bodyEnd = body.render(content);
998
998
  if (catchBoundary.signal.aborted) {
999
- renderCatch(catchBoundary.signal.reason);
999
+ catchContent(catchBoundary.signal.reason);
1000
1000
  return;
1001
1001
  }
1002
1002
  if (body === bodyEnd) {
@@ -1015,7 +1015,7 @@ function tryCatch(renderBody, renderCatch) {
1015
1015
  } while (cur !== bodyNext);
1016
1016
  }
1017
1017
  let catchChunk = new Chunk(boundary, null, chunk.context);
1018
- catchChunk.reorderId = reorderId, catchChunk.render(renderCatch, catchBoundary.signal.reason), state.reorder(catchChunk), boundary.endAsync();
1018
+ catchChunk.reorderId = reorderId, catchChunk.render(catchContent, catchBoundary.signal.reason), state.reorder(catchChunk), boundary.endAsync();
1019
1019
  } else catchBoundary.done ? boundary.endAsync() : boundary.onNext();
1020
1020
  };
1021
1021
  }
@@ -1135,11 +1135,11 @@ var State2 = class {
1135
1135
  }
1136
1136
  return cur;
1137
1137
  }
1138
- render(renderBody, val) {
1138
+ render(content, val) {
1139
1139
  let prev = $chunk;
1140
1140
  $chunk = this;
1141
1141
  try {
1142
- return renderBody(val), $chunk;
1142
+ return content(val), $chunk;
1143
1143
  } catch (err) {
1144
1144
  return this.boundary.abort(err), this;
1145
1145
  } finally {
@@ -1247,14 +1247,14 @@ function optionValueAttr(value) {
1247
1247
  return attr("value", value) + (!isVoid(value) && (Array.isArray(value) ? selectedValue.includes(value) : selectedValue === value) ? " selected" : "");
1248
1248
  }
1249
1249
  var kSelectedValue = Symbol("selectedValue");
1250
- function controllable_select_value(scopeId, nodeAccessor, value, valueChange, renderBody) {
1250
+ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, content) {
1251
1251
  valueChange && writeControlledScope(
1252
1252
  3 /* SelectValue */,
1253
1253
  scopeId,
1254
1254
  nodeAccessor,
1255
1255
  value,
1256
1256
  valueChange
1257
- ), renderBody && withContext(kSelectedValue, value, renderBody);
1257
+ ), content && withContext(kSelectedValue, value, content);
1258
1258
  }
1259
1259
  function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
1260
1260
  return valueChange && writeControlledScope(
@@ -1362,7 +1362,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
1362
1362
  result += styleAttr(val);
1363
1363
  break;
1364
1364
  case "":
1365
- case "renderBody":
1365
+ case "content":
1366
1366
  break;
1367
1367
  default:
1368
1368
  isVoid(val) || (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, {
@@ -1424,8 +1424,8 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
1424
1424
 
1425
1425
  // src/html/dynamic-tag.ts
1426
1426
  var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
1427
- function dynamicTagInput(scope, tag, input, renderBody, tagVar) {
1428
- if (!tag && !renderBody) return;
1427
+ function dynamicTagInput(scope, tag, input, content, tagVar) {
1428
+ if (!tag && !content) return;
1429
1429
  let scopeId = getScopeId(scope);
1430
1430
  return write(`${markResumeScopeStart(scopeId)}`), writeScope(scopeId, scope), tag ? typeof tag == "string" ? (nextScopeId(), write(
1431
1431
  `<${tag}${attrs(input, 0, scopeId, tag)}>`
@@ -1436,13 +1436,13 @@ function dynamicTagInput(scope, tag, input, renderBody, tagVar) {
1436
1436
  input.value,
1437
1437
  input.valueChange
1438
1438
  )
1439
- ) : renderBody && (tag === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
1439
+ ) : content && (tag === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
1440
1440
  scopeId,
1441
1441
  0,
1442
1442
  input.value,
1443
1443
  input.valueChange,
1444
- renderBody
1445
- ) : renderBody()), write(`</${tag}>`)), null) : getDynamicRenderer(tag)(renderBody ? { ...input, renderBody } : input, tagVar) : renderBody();
1444
+ content
1445
+ ) : content()), write(`</${tag}>`)), null) : getDynamicRenderer(tag)(content ? { ...input, content } : input, tagVar) : content();
1446
1446
  }
1447
1447
  function dynamicTagArgs(scope, tag, args) {
1448
1448
  if (!tag) return;
@@ -1492,13 +1492,18 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
1492
1492
  boundary,
1493
1493
  null,
1494
1494
  null
1495
- );
1495
+ ), normalizedInput = input;
1496
+ if ("renderBody" in input) {
1497
+ normalizedInput = {};
1498
+ for (let key in input)
1499
+ normalizedInput[key === "renderBody" ? "content" : key] = input[key];
1500
+ }
1496
1501
  head.render(() => {
1497
1502
  if (willRerender) {
1498
1503
  let scopeId = peekNextScopeId();
1499
1504
  writeScope(scopeId, { m5c: component.id }), writeEffect(scopeId, SET_SCOPE_REGISTER_ID);
1500
1505
  }
1501
- renderer(input);
1506
+ renderer(normalizedInput);
1502
1507
  });
1503
1508
  let asyncOut = classAPIOut.beginAsync();
1504
1509
  (boundary.onNext = () => {
@@ -1,5 +1,7 @@
1
1
  import type { Config } from "@marko/compiler";
2
+ export declare const tagDiscoveryDirs: string[];
2
3
  export { default as internalEntryBuilder } from "./util/entry-builder";
4
+ export declare const preferAPI = "tags";
3
5
  export declare const transform: import("@marko/compiler/babel-types").Visitor<unknown>, analyze: import("@marko/compiler/babel-types").Visitor<unknown>, translate: import("@marko/compiler/babel-types").Visitor<unknown>;
4
6
  export declare const taglibs: (string | {
5
7
  migrate: import("@marko/compiler/babel-types").Visitor<unknown>;