@marko/runtime-tags 6.1.14 → 6.1.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.
@@ -9,5 +9,6 @@ export declare function isEventHandler(name: string): name is `on${string}`;
9
9
  export declare function getEventHandlerName(name: `on${string}`): string;
10
10
  export declare function isVoid(value: unknown): value is false | null | undefined;
11
11
  export declare function isNotVoid(value: unknown): boolean;
12
+ export declare function isPromise(value: unknown): value is Promise<unknown>;
12
13
  export declare function normalizeDynamicRenderer<Renderer>(value: any): Renderer | string | undefined;
13
14
  export declare const decodeAccessor: (num: number) => string;
package/dist/debug/dom.js CHANGED
@@ -101,10 +101,17 @@ function getEventHandlerName(name) {
101
101
  function isNotVoid(value) {
102
102
  return value != null && value !== false;
103
103
  }
104
+ function isPromise(value) {
105
+ return value != null && typeof value.then === "function";
106
+ }
104
107
  function normalizeDynamicRenderer(value) {
105
108
  if (value) {
106
109
  if (typeof value === "string") return value;
107
110
  const normalized = value.content || value.default || value;
111
+ if (!((typeof normalized === "object" || typeof normalized === "function") && "id" in normalized)) {
112
+ if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
113
+ if (typeof value !== "object" && typeof value !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received a ${typeof value}.`);
114
+ }
108
115
  if ("id" in normalized) return normalized;
109
116
  }
110
117
  }
@@ -1321,6 +1328,15 @@ function _await_promise(nodeAccessor, params) {
1321
1328
  const branchAccessor = "BranchScopes:" + nodeAccessor;
1322
1329
  _enable_catch();
1323
1330
  return (scope, promise) => {
1331
+ if (!isPromise(promise)) {
1332
+ if (!scope[promiseAccessor]) {
1333
+ const resolve = () => resolveAwait(scope, branchAccessor, nodeAccessor, scope[nodeAccessor], params, promise);
1334
+ if (scope[branchAccessor]) resolve();
1335
+ else scope[promiseAccessor] = resolve;
1336
+ return;
1337
+ }
1338
+ promise = Promise.resolve(promise);
1339
+ }
1324
1340
  let awaitBranch = scope[branchAccessor];
1325
1341
  const tryPlaceholder = findBranchWithKey(scope, "#PlaceholderContent");
1326
1342
  const tryBranch = tryPlaceholder || awaitBranch;
@@ -1357,14 +1373,7 @@ function _await_promise(nodeAccessor, params) {
1357
1373
  const referenceNode = scope[nodeAccessor];
1358
1374
  scope[promiseAccessor] = 0;
1359
1375
  queueAsyncRender(scope, () => {
1360
- if ((awaitBranch = scope[branchAccessor])["#DetachedAwait"]) {
1361
- awaitBranch["#PendingScopes"] = awaitBranch["#PendingScopes"]?.forEach(syncGen);
1362
- setupBranch(awaitBranch["#DetachedAwait"], awaitBranch);
1363
- awaitBranch["#DetachedAwait"] = 0;
1364
- insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
1365
- referenceNode.remove();
1366
- }
1367
- params?.(awaitBranch, [data]);
1376
+ awaitBranch = resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, data);
1368
1377
  const pendingRenders = awaitBranch["#PendingRenders"];
1369
1378
  awaitBranch["#PendingRenders"] = 0;
1370
1379
  pendingRenders?.forEach(queuePendingRender);
@@ -1395,12 +1404,30 @@ function _await_promise(nodeAccessor, params) {
1395
1404
  });
1396
1405
  };
1397
1406
  }
1407
+ function resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, value) {
1408
+ const awaitBranch = scope[branchAccessor];
1409
+ if (awaitBranch["#DetachedAwait"]) {
1410
+ awaitBranch["#PendingScopes"] = awaitBranch["#PendingScopes"]?.forEach(syncGen);
1411
+ setupBranch(awaitBranch["#DetachedAwait"], awaitBranch);
1412
+ awaitBranch["#DetachedAwait"] = 0;
1413
+ insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
1414
+ referenceNode.remove();
1415
+ }
1416
+ params?.(awaitBranch, [value]);
1417
+ return awaitBranch;
1418
+ }
1398
1419
  function _await_content(nodeAccessor, template, walks, setup) {
1399
1420
  const branchAccessor = "BranchScopes:" + nodeAccessor;
1421
+ const promiseAccessor = "Promise:" + nodeAccessor;
1400
1422
  const renderer = _content("", template, walks, setup)();
1401
1423
  return (scope) => {
1402
1424
  const pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope["$global"], renderer, scope, scope[nodeAccessor].parentNode))["#DetachedAwait"] = renderer);
1403
1425
  scope[branchAccessor]["#PendingScopes"] = pendingScopes;
1426
+ const resolveSync = scope[promiseAccessor];
1427
+ if (typeof resolveSync === "function") {
1428
+ scope[promiseAccessor] = 0;
1429
+ resolveSync();
1430
+ }
1404
1431
  };
1405
1432
  }
1406
1433
  function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "#PlaceholderContent")) {
@@ -1515,6 +1542,18 @@ let _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
1515
1542
  }
1516
1543
  };
1517
1544
  };
1545
+ function _dynamic_tag_content(nodeAccessor) {
1546
+ const childScopeAccessor = "BranchScopes:" + nodeAccessor;
1547
+ const rendererAccessor = "ConditionalRenderer:" + nodeAccessor;
1548
+ enableBranches();
1549
+ return (scope, renderer) => {
1550
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer?.["id"] || renderer)) {
1551
+ setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
1552
+ if (renderer?.["accessor"]) subscribeToScopeSet(renderer["owner"], renderer["accessor"], scope[childScopeAccessor]);
1553
+ }
1554
+ if (renderer) for (const accessor in renderer["localClosures"]) renderer["localClosures"][accessor](scope[childScopeAccessor], renderer["localClosureValues"][accessor]);
1555
+ };
1556
+ }
1518
1557
  function _resume_dynamic_tag() {
1519
1558
  _resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript);
1520
1559
  }
@@ -2132,6 +2171,7 @@ Object.defineProperty(exports, "_dynamic_tag", {
2132
2171
  return _dynamic_tag;
2133
2172
  }
2134
2173
  });
2174
+ exports._dynamic_tag_content = _dynamic_tag_content;
2135
2175
  exports._el = _el;
2136
2176
  exports._el_read = _el_read;
2137
2177
  exports._enable_catch = _enable_catch;
@@ -99,10 +99,17 @@ function getEventHandlerName(name) {
99
99
  function isNotVoid(value) {
100
100
  return value != null && value !== false;
101
101
  }
102
+ function isPromise(value) {
103
+ return value != null && typeof value.then === "function";
104
+ }
102
105
  function normalizeDynamicRenderer(value) {
103
106
  if (value) {
104
107
  if (typeof value === "string") return value;
105
108
  const normalized = value.content || value.default || value;
109
+ if (!((typeof normalized === "object" || typeof normalized === "function") && "id" in normalized)) {
110
+ if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
111
+ if (typeof value !== "object" && typeof value !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received a ${typeof value}.`);
112
+ }
106
113
  if ("id" in normalized) return normalized;
107
114
  }
108
115
  }
@@ -1319,6 +1326,15 @@ function _await_promise(nodeAccessor, params) {
1319
1326
  const branchAccessor = "BranchScopes:" + nodeAccessor;
1320
1327
  _enable_catch();
1321
1328
  return (scope, promise) => {
1329
+ if (!isPromise(promise)) {
1330
+ if (!scope[promiseAccessor]) {
1331
+ const resolve = () => resolveAwait(scope, branchAccessor, nodeAccessor, scope[nodeAccessor], params, promise);
1332
+ if (scope[branchAccessor]) resolve();
1333
+ else scope[promiseAccessor] = resolve;
1334
+ return;
1335
+ }
1336
+ promise = Promise.resolve(promise);
1337
+ }
1322
1338
  let awaitBranch = scope[branchAccessor];
1323
1339
  const tryPlaceholder = findBranchWithKey(scope, "#PlaceholderContent");
1324
1340
  const tryBranch = tryPlaceholder || awaitBranch;
@@ -1355,14 +1371,7 @@ function _await_promise(nodeAccessor, params) {
1355
1371
  const referenceNode = scope[nodeAccessor];
1356
1372
  scope[promiseAccessor] = 0;
1357
1373
  queueAsyncRender(scope, () => {
1358
- if ((awaitBranch = scope[branchAccessor])["#DetachedAwait"]) {
1359
- awaitBranch["#PendingScopes"] = awaitBranch["#PendingScopes"]?.forEach(syncGen);
1360
- setupBranch(awaitBranch["#DetachedAwait"], awaitBranch);
1361
- awaitBranch["#DetachedAwait"] = 0;
1362
- insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
1363
- referenceNode.remove();
1364
- }
1365
- params?.(awaitBranch, [data]);
1374
+ awaitBranch = resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, data);
1366
1375
  const pendingRenders = awaitBranch["#PendingRenders"];
1367
1376
  awaitBranch["#PendingRenders"] = 0;
1368
1377
  pendingRenders?.forEach(queuePendingRender);
@@ -1393,12 +1402,30 @@ function _await_promise(nodeAccessor, params) {
1393
1402
  });
1394
1403
  };
1395
1404
  }
1405
+ function resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, value) {
1406
+ const awaitBranch = scope[branchAccessor];
1407
+ if (awaitBranch["#DetachedAwait"]) {
1408
+ awaitBranch["#PendingScopes"] = awaitBranch["#PendingScopes"]?.forEach(syncGen);
1409
+ setupBranch(awaitBranch["#DetachedAwait"], awaitBranch);
1410
+ awaitBranch["#DetachedAwait"] = 0;
1411
+ insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
1412
+ referenceNode.remove();
1413
+ }
1414
+ params?.(awaitBranch, [value]);
1415
+ return awaitBranch;
1416
+ }
1396
1417
  function _await_content(nodeAccessor, template, walks, setup) {
1397
1418
  const branchAccessor = "BranchScopes:" + nodeAccessor;
1419
+ const promiseAccessor = "Promise:" + nodeAccessor;
1398
1420
  const renderer = _content("", template, walks, setup)();
1399
1421
  return (scope) => {
1400
1422
  const pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope["$global"], renderer, scope, scope[nodeAccessor].parentNode))["#DetachedAwait"] = renderer);
1401
1423
  scope[branchAccessor]["#PendingScopes"] = pendingScopes;
1424
+ const resolveSync = scope[promiseAccessor];
1425
+ if (typeof resolveSync === "function") {
1426
+ scope[promiseAccessor] = 0;
1427
+ resolveSync();
1428
+ }
1402
1429
  };
1403
1430
  }
1404
1431
  function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "#PlaceholderContent")) {
@@ -1513,6 +1540,18 @@ let _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
1513
1540
  }
1514
1541
  };
1515
1542
  };
1543
+ function _dynamic_tag_content(nodeAccessor) {
1544
+ const childScopeAccessor = "BranchScopes:" + nodeAccessor;
1545
+ const rendererAccessor = "ConditionalRenderer:" + nodeAccessor;
1546
+ enableBranches();
1547
+ return (scope, renderer) => {
1548
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer?.["id"] || renderer)) {
1549
+ setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
1550
+ if (renderer?.["accessor"]) subscribeToScopeSet(renderer["owner"], renderer["accessor"], scope[childScopeAccessor]);
1551
+ }
1552
+ if (renderer) for (const accessor in renderer["localClosures"]) renderer["localClosures"][accessor](scope[childScopeAccessor], renderer["localClosureValues"][accessor]);
1553
+ };
1554
+ }
1516
1555
  function _resume_dynamic_tag() {
1517
1556
  _resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript);
1518
1557
  }
@@ -2075,4 +2114,4 @@ function getSelectorOrResolve(selector, resolve) {
2075
2114
  return document.querySelector(selector) || (console.warn(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`), resolve());
2076
2115
  }
2077
2116
  //#endregion
2078
- export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _dynamic_tag, _el, _el_read, _enable_catch, _for_closure, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resume, _resume_dynamic_tag, _return, _return_change, _script, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, run };
2117
+ export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _enable_catch, _for_closure, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resume, _resume_dynamic_tag, _return, _return_change, _script, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, run };
@@ -100,10 +100,17 @@ function isVoid(value) {
100
100
  function isNotVoid(value) {
101
101
  return value != null && value !== false;
102
102
  }
103
+ function isPromise(value) {
104
+ return value != null && typeof value.then === "function";
105
+ }
103
106
  function normalizeDynamicRenderer(value) {
104
107
  if (value) {
105
108
  if (typeof value === "string") return value;
106
109
  const normalized = value.content || value.default || value;
110
+ if (!((typeof normalized === "object" || typeof normalized === "function") && "id" in normalized)) {
111
+ if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
112
+ if (typeof value !== "object" && typeof value !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received a ${typeof value}.`);
113
+ }
107
114
  if ("id" in normalized) return normalized;
108
115
  }
109
116
  }
@@ -193,6 +200,10 @@ function joinWithAnd(a) {
193
200
  const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
194
201
  //#endregion
195
202
  //#region src/html/content.ts
203
+ function _to_text(val) {
204
+ assertValidTextValue(val);
205
+ return val || val === 0 ? val + "" : "";
206
+ }
196
207
  function _unescaped(val) {
197
208
  assertValidTextValue(val);
198
209
  return val ? val + "" : val === 0 ? "0" : "";
@@ -2418,9 +2429,6 @@ function flushTickQueue() {
2418
2429
  tickQueue = void 0;
2419
2430
  for (const cb of queue) cb(true);
2420
2431
  }
2421
- function isPromise(value) {
2422
- return value != null && typeof value.then === "function";
2423
- }
2424
2432
  function getFilteredGlobals($global) {
2425
2433
  if (!$global) return 0;
2426
2434
  const serializedGlobals = $global.serializedGlobals;
@@ -2643,7 +2651,6 @@ const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta
2643
2651
  let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
2644
2652
  const shouldResume = serializeReason !== 0;
2645
2653
  const renderer = normalizeDynamicRenderer(tag);
2646
- if (renderer && typeof renderer !== "function" && typeof renderer !== "string") throw new Error(`Invalid renderer passed for dynamic tag: ${renderer}`);
2647
2654
  const state = getState();
2648
2655
  const branchId = _peek_scope_id();
2649
2656
  let rendered;
@@ -3196,6 +3203,7 @@ exports._serialize_if = _serialize_if;
3196
3203
  exports._set_serialize_reason = _set_serialize_reason;
3197
3204
  exports._subscribe = _subscribe;
3198
3205
  exports._template = _template;
3206
+ exports._to_text = _to_text;
3199
3207
  exports._trailers = _trailers;
3200
3208
  exports._try = _try;
3201
3209
  exports._unescaped = _unescaped;
@@ -98,10 +98,17 @@ function isVoid(value) {
98
98
  function isNotVoid(value) {
99
99
  return value != null && value !== false;
100
100
  }
101
+ function isPromise(value) {
102
+ return value != null && typeof value.then === "function";
103
+ }
101
104
  function normalizeDynamicRenderer(value) {
102
105
  if (value) {
103
106
  if (typeof value === "string") return value;
104
107
  const normalized = value.content || value.default || value;
108
+ if (!((typeof normalized === "object" || typeof normalized === "function") && "id" in normalized)) {
109
+ if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
110
+ if (typeof value !== "object" && typeof value !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received a ${typeof value}.`);
111
+ }
105
112
  if ("id" in normalized) return normalized;
106
113
  }
107
114
  }
@@ -191,6 +198,10 @@ function joinWithAnd(a) {
191
198
  const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
192
199
  //#endregion
193
200
  //#region src/html/content.ts
201
+ function _to_text(val) {
202
+ assertValidTextValue(val);
203
+ return val || val === 0 ? val + "" : "";
204
+ }
194
205
  function _unescaped(val) {
195
206
  assertValidTextValue(val);
196
207
  return val ? val + "" : val === 0 ? "0" : "";
@@ -2416,9 +2427,6 @@ function flushTickQueue() {
2416
2427
  tickQueue = void 0;
2417
2428
  for (const cb of queue) cb(true);
2418
2429
  }
2419
- function isPromise(value) {
2420
- return value != null && typeof value.then === "function";
2421
- }
2422
2430
  function getFilteredGlobals($global) {
2423
2431
  if (!$global) return 0;
2424
2432
  const serializedGlobals = $global.serializedGlobals;
@@ -2641,7 +2649,6 @@ const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta
2641
2649
  let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
2642
2650
  const shouldResume = serializeReason !== 0;
2643
2651
  const renderer = normalizeDynamicRenderer(tag);
2644
- if (renderer && typeof renderer !== "function" && typeof renderer !== "string") throw new Error(`Invalid renderer passed for dynamic tag: ${renderer}`);
2645
2652
  const state = getState();
2646
2653
  const branchId = _peek_scope_id();
2647
2654
  let rendered;
@@ -3129,4 +3136,4 @@ const compat = {
3129
3136
  };
3130
3137
  function NOOP() {}
3131
3138
  //#endregion
3132
- export { $global, _assert_hoist, _attr, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _subscribe, _template, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, withLoadAssets, withPageAssets };
3139
+ export { $global, _assert_hoist, _attr, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _subscribe, _template, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, withLoadAssets, withPageAssets };
@@ -12,6 +12,7 @@ export declare function renderCatch(scope: Scope, error: unknown): void;
12
12
  export declare function _if(nodeAccessor: EncodedAccessor, ...branchesArgs: (string | SetupFn | 0)[]): (scope: Scope, newBranch: number) => void;
13
13
  export declare function patchDynamicTag(fn: <T extends typeof _dynamic_tag>(cond: T) => T): void;
14
14
  export declare let _dynamic_tag: (nodeAccessor: EncodedAccessor, getContent?: ((scope: Scope) => Renderer) | 0, getTagVar?: (() => Signal<unknown>) | 0, inputIsArgs?: 1) => Signal<Renderer | string | undefined>;
15
+ export declare function _dynamic_tag_content(nodeAccessor: EncodedAccessor): Signal<Renderer | undefined>;
15
16
  export declare function _resume_dynamic_tag(): void;
16
17
  export declare function setConditionalRenderer<T>(scope: Scope, nodeAccessor: Accessor, newRenderer: T, createBranch: ($global: Scope[AccessorProp.Global], renderer: NonNullable<T>, parentScope: Scope, parentNode: ParentNode) => BranchScope): void;
17
18
  export declare const _for_of: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [all: unknown[], by?: ((item: unknown, index: number) => unknown) | undefined]) => void;
package/dist/dom.d.ts CHANGED
@@ -4,7 +4,7 @@ export { forIn, forOf, forTo, forUntil } from "./common/for";
4
4
  export { _call } from "./common/helpers";
5
5
  export { $signal, $signalReset } from "./dom/abort-signal";
6
6
  export { compat } from "./dom/compat";
7
- export { _await_content, _await_promise, _dynamic_tag, _for_in, _for_of, _for_to, _for_until, _if, _resume_dynamic_tag, _try, } from "./dom/control-flow";
7
+ export { _await_content, _await_promise, _dynamic_tag, _dynamic_tag_content, _for_in, _for_of, _for_to, _for_until, _if, _resume_dynamic_tag, _try, } from "./dom/control-flow";
8
8
  export { _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checked_default, _attr_input_checked_script, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_value, _attr_input_value_default, _attr_input_value_script, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_input_value as _attr_textarea_value, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_script as _attr_textarea_value_script, } from "./dom/controllable";
9
9
  export { _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_nonce, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _html, _lifecycle, _text, _text_content, _to_text, } from "./dom/dom";
10
10
  export { _on } from "./dom/event";
package/dist/dom.js CHANGED
@@ -138,6 +138,9 @@ function getEventHandlerName(name) {
138
138
  function isNotVoid(value) {
139
139
  return value != null && value !== !1;
140
140
  }
141
+ function isPromise(value) {
142
+ return value != null && typeof value.then == "function";
143
+ }
141
144
  function normalizeDynamicRenderer(value) {
142
145
  if (value) {
143
146
  if (typeof value == "string") return value;
@@ -872,6 +875,14 @@ function _await_promise(nodeAccessor, params) {
872
875
  nodeAccessor = decodeAccessor(nodeAccessor);
873
876
  let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor;
874
877
  return _enable_catch(), (scope, promise) => {
878
+ if (!isPromise(promise)) {
879
+ if (!scope[promiseAccessor]) {
880
+ let resolve = () => resolveAwait(scope, branchAccessor, nodeAccessor, scope[nodeAccessor], params, promise);
881
+ scope[branchAccessor] ? resolve() : scope[promiseAccessor] = resolve;
882
+ return;
883
+ }
884
+ promise = Promise.resolve(promise);
885
+ }
875
886
  let awaitBranch = scope[branchAccessor], tryPlaceholder = findBranchWithKey(scope, "Q"), tryBranch = tryPlaceholder || awaitBranch, awaitCounter = tryBranch.O;
876
887
  placeholderShown.add(pendingEffects), tryPlaceholder ? scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), awaitCounter = addAwaitCounter(scope, tryPlaceholder)) : (awaitCounter?.i || (awaitCounter = tryBranch.O = {
877
888
  i: 0,
@@ -886,7 +897,7 @@ function _await_promise(nodeAccessor, params) {
886
897
  if (thisPromise === scope[promiseAccessor]) {
887
898
  let referenceNode = scope[nodeAccessor];
888
899
  scope[promiseAccessor] = 0, queueAsyncRender(scope, () => {
889
- (awaitBranch = scope[branchAccessor]).V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [data]);
900
+ awaitBranch = resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, data);
890
901
  let pendingRenders = awaitBranch.W;
891
902
  if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
892
903
  let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
@@ -906,12 +917,18 @@ function _await_promise(nodeAccessor, params) {
906
917
  });
907
918
  };
908
919
  }
920
+ function resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, value) {
921
+ let awaitBranch = scope[branchAccessor];
922
+ return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
923
+ }
909
924
  function _await_content(nodeAccessor, template, walks, setup) {
910
925
  nodeAccessor = decodeAccessor(nodeAccessor);
911
- let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
926
+ let branchAccessor = "A" + nodeAccessor, promiseAccessor = "L" + nodeAccessor, renderer = _content("", template, walks, setup)();
912
927
  return (scope) => {
913
928
  let pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope.$, renderer, scope, scope[nodeAccessor].parentNode)).V = renderer);
914
929
  scope[branchAccessor].Y = pendingScopes;
930
+ let resolveSync = scope[promiseAccessor];
931
+ typeof resolveSync == "function" && (scope[promiseAccessor] = 0, resolveSync());
915
932
  };
916
933
  }
917
934
  function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
@@ -962,6 +979,13 @@ function _if(nodeAccessor, ...branchesArgs) {
962
979
  function patchDynamicTag(fn) {
963
980
  _dynamic_tag = fn(_dynamic_tag);
964
981
  }
982
+ function _dynamic_tag_content(nodeAccessor) {
983
+ nodeAccessor = decodeAccessor(nodeAccessor);
984
+ let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
985
+ return enableBranches(), (scope, renderer) => {
986
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer?.a || renderer) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
987
+ };
988
+ }
965
989
  function _resume_dynamic_tag() {
966
990
  _resume("d", dynamicTagScript);
967
991
  }
@@ -1257,4 +1281,4 @@ exports.$signal = $signal, exports.$signalReset = $signalReset, exports._assert_
1257
1281
  get: function() {
1258
1282
  return _dynamic_tag;
1259
1283
  }
1260
- }), exports._el = _el, exports._el_read = _el_read, exports._enable_catch = _enable_catch, exports._for_closure = _for_closure, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_resume = _hoist_resume, exports._html = _html, exports._id = _id, exports._if = _if, exports._if_closure = _if_closure, exports._let = _let, exports._let_change = _let_change, exports._lifecycle = _lifecycle, exports._load_event_trigger = _load_event_trigger, exports._load_idle_trigger = _load_idle_trigger, exports._load_media_trigger = _load_media_trigger, exports._load_race_trigger = _load_race_trigger, exports._load_setup = _load_setup, exports._load_signal = _load_signal, exports._load_template = _load_template, exports._load_visible_trigger = _load_visible_trigger, exports._on = _on, exports._or = _or, exports._resume = _resume, exports._resume_dynamic_tag = _resume_dynamic_tag, exports._return = _return, exports._return_change = _return_change, exports._script = _script, exports._template = _template, exports._text = _text, exports._text_content = _text_content, exports._to_text = _to_text, exports._try = _try, exports._var = _var, exports._var_change = _var_change, exports._var_resume = _var_resume, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forOf = forOf, exports.forTo = forTo, exports.forUntil = forUntil, exports.init = init, exports.initEmbedded = initEmbedded, exports.ready = ready, exports.run = run;
1284
+ }), exports._dynamic_tag_content = _dynamic_tag_content, exports._el = _el, exports._el_read = _el_read, exports._enable_catch = _enable_catch, exports._for_closure = _for_closure, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_resume = _hoist_resume, exports._html = _html, exports._id = _id, exports._if = _if, exports._if_closure = _if_closure, exports._let = _let, exports._let_change = _let_change, exports._lifecycle = _lifecycle, exports._load_event_trigger = _load_event_trigger, exports._load_idle_trigger = _load_idle_trigger, exports._load_media_trigger = _load_media_trigger, exports._load_race_trigger = _load_race_trigger, exports._load_setup = _load_setup, exports._load_signal = _load_signal, exports._load_template = _load_template, exports._load_visible_trigger = _load_visible_trigger, exports._on = _on, exports._or = _or, exports._resume = _resume, exports._resume_dynamic_tag = _resume_dynamic_tag, exports._return = _return, exports._return_change = _return_change, exports._script = _script, exports._template = _template, exports._text = _text, exports._text_content = _text_content, exports._to_text = _to_text, exports._try = _try, exports._var = _var, exports._var_change = _var_change, exports._var_resume = _var_resume, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forOf = forOf, exports.forTo = forTo, exports.forUntil = forUntil, exports.init = init, exports.initEmbedded = initEmbedded, exports.ready = ready, exports.run = run;
package/dist/dom.mjs CHANGED
@@ -137,6 +137,9 @@ function getEventHandlerName(name) {
137
137
  function isNotVoid(value) {
138
138
  return value != null && value !== !1;
139
139
  }
140
+ function isPromise(value) {
141
+ return value != null && typeof value.then == "function";
142
+ }
140
143
  function normalizeDynamicRenderer(value) {
141
144
  if (value) {
142
145
  if (typeof value == "string") return value;
@@ -871,6 +874,14 @@ function _await_promise(nodeAccessor, params) {
871
874
  nodeAccessor = decodeAccessor(nodeAccessor);
872
875
  let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor;
873
876
  return _enable_catch(), (scope, promise) => {
877
+ if (!isPromise(promise)) {
878
+ if (!scope[promiseAccessor]) {
879
+ let resolve = () => resolveAwait(scope, branchAccessor, nodeAccessor, scope[nodeAccessor], params, promise);
880
+ scope[branchAccessor] ? resolve() : scope[promiseAccessor] = resolve;
881
+ return;
882
+ }
883
+ promise = Promise.resolve(promise);
884
+ }
874
885
  let awaitBranch = scope[branchAccessor], tryPlaceholder = findBranchWithKey(scope, "Q"), tryBranch = tryPlaceholder || awaitBranch, awaitCounter = tryBranch.O;
875
886
  placeholderShown.add(pendingEffects), tryPlaceholder ? scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), awaitCounter = addAwaitCounter(scope, tryPlaceholder)) : (awaitCounter?.i || (awaitCounter = tryBranch.O = {
876
887
  i: 0,
@@ -885,7 +896,7 @@ function _await_promise(nodeAccessor, params) {
885
896
  if (thisPromise === scope[promiseAccessor]) {
886
897
  let referenceNode = scope[nodeAccessor];
887
898
  scope[promiseAccessor] = 0, queueAsyncRender(scope, () => {
888
- (awaitBranch = scope[branchAccessor]).V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [data]);
899
+ awaitBranch = resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, data);
889
900
  let pendingRenders = awaitBranch.W;
890
901
  if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
891
902
  let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
@@ -905,12 +916,18 @@ function _await_promise(nodeAccessor, params) {
905
916
  });
906
917
  };
907
918
  }
919
+ function resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, value) {
920
+ let awaitBranch = scope[branchAccessor];
921
+ return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
922
+ }
908
923
  function _await_content(nodeAccessor, template, walks, setup) {
909
924
  nodeAccessor = decodeAccessor(nodeAccessor);
910
- let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
925
+ let branchAccessor = "A" + nodeAccessor, promiseAccessor = "L" + nodeAccessor, renderer = _content("", template, walks, setup)();
911
926
  return (scope) => {
912
927
  let pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope.$, renderer, scope, scope[nodeAccessor].parentNode)).V = renderer);
913
928
  scope[branchAccessor].Y = pendingScopes;
929
+ let resolveSync = scope[promiseAccessor];
930
+ typeof resolveSync == "function" && (scope[promiseAccessor] = 0, resolveSync());
914
931
  };
915
932
  }
916
933
  function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
@@ -961,6 +978,13 @@ function _if(nodeAccessor, ...branchesArgs) {
961
978
  function patchDynamicTag(fn) {
962
979
  _dynamic_tag = fn(_dynamic_tag);
963
980
  }
981
+ function _dynamic_tag_content(nodeAccessor) {
982
+ nodeAccessor = decodeAccessor(nodeAccessor);
983
+ let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
984
+ return enableBranches(), (scope, renderer) => {
985
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer?.a || renderer) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
986
+ };
987
+ }
964
988
  function _resume_dynamic_tag() {
965
989
  _resume("d", dynamicTagScript);
966
990
  }
@@ -1252,4 +1276,4 @@ function getSelectorOrResolve(selector, resolve) {
1252
1276
  return document.querySelector(selector) || resolve();
1253
1277
  }
1254
1278
  //#endregion
1255
- export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _dynamic_tag, _el, _el_read, _enable_catch, _for_closure, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resume, _resume_dynamic_tag, _return, _return_change, _script, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, run };
1279
+ export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _enable_catch, _for_closure, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resume, _resume_dynamic_tag, _return, _return_change, _script, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, run };
@@ -1,3 +1,4 @@
1
+ export declare function _to_text(val: unknown): string;
1
2
  export declare function _unescaped(val: unknown): string;
2
3
  export declare function _escape(val: unknown): string;
3
4
  export declare function _escape_script(val: unknown): string;
package/dist/html.d.ts CHANGED
@@ -3,7 +3,7 @@ export { _assert_hoist, _el_read_error, _hoist_read_error, } from "./common/erro
3
3
  export { _flush_head, withLoadAssets, withPageAssets } from "./html/assets";
4
4
  export { _attr, _attr_class, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, } from "./html/attrs";
5
5
  export { compat } from "./html/compat";
6
- export { _escape, _escape_comment, _escape_script, _escape_style, _unescaped, } from "./html/content";
6
+ export { _escape, _escape_comment, _escape_script, _escape_style, _to_text, _unescaped, } from "./html/content";
7
7
  export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
8
8
  export { forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, } from "./html/for";
9
9
  export { _template } from "./html/template";
package/dist/html.js CHANGED
@@ -387,6 +387,9 @@ function isVoid(value) {
387
387
  function isNotVoid(value) {
388
388
  return value != null && value !== !1;
389
389
  }
390
+ function isPromise(value) {
391
+ return value != null && typeof value.then == "function";
392
+ }
390
393
  function normalizeDynamicRenderer(value) {
391
394
  if (value) {
392
395
  if (typeof value == "string") return value;
@@ -401,6 +404,9 @@ function _hoist_read_error() {}
401
404
  function _assert_hoist(value) {}
402
405
  //#endregion
403
406
  //#region src/html/content.ts
407
+ function _to_text(val) {
408
+ return val || val === 0 ? val + "" : "";
409
+ }
404
410
  function _unescaped(val) {
405
411
  return val ? val + "" : val === 0 ? "0" : "";
406
412
  }
@@ -1574,9 +1580,6 @@ function flushTickQueue() {
1574
1580
  tickQueue = void 0;
1575
1581
  for (let cb of queue) cb(!0);
1576
1582
  }
1577
- function isPromise(value) {
1578
- return value != null && typeof value.then == "function";
1579
- }
1580
1583
  function getFilteredGlobals($global) {
1581
1584
  if (!$global) return 0;
1582
1585
  let serializedGlobals = $global.serializedGlobals;
@@ -1969,4 +1972,4 @@ exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr
1969
1972
  get: function() {
1970
1973
  return _dynamic_tag;
1971
1974
  }
1972
- }), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._sep = _sep, exports._serialize_guard = _serialize_guard, exports._serialize_if = _serialize_if, exports._set_serialize_reason = _set_serialize_reason, exports._subscribe = _subscribe, exports._template = _template, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forInBy = forInBy, exports.forOf = forOf, exports.forOfBy = forOfBy, exports.forStepBy = forStepBy, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
1975
+ }), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._sep = _sep, exports._serialize_guard = _serialize_guard, exports._serialize_if = _serialize_if, exports._set_serialize_reason = _set_serialize_reason, exports._subscribe = _subscribe, exports._template = _template, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forInBy = forInBy, exports.forOf = forOf, exports.forOfBy = forOfBy, exports.forStepBy = forStepBy, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
package/dist/html.mjs CHANGED
@@ -386,6 +386,9 @@ function isVoid(value) {
386
386
  function isNotVoid(value) {
387
387
  return value != null && value !== !1;
388
388
  }
389
+ function isPromise(value) {
390
+ return value != null && typeof value.then == "function";
391
+ }
389
392
  function normalizeDynamicRenderer(value) {
390
393
  if (value) {
391
394
  if (typeof value == "string") return value;
@@ -400,6 +403,9 @@ function _hoist_read_error() {}
400
403
  function _assert_hoist(value) {}
401
404
  //#endregion
402
405
  //#region src/html/content.ts
406
+ function _to_text(val) {
407
+ return val || val === 0 ? val + "" : "";
408
+ }
403
409
  function _unescaped(val) {
404
410
  return val ? val + "" : val === 0 ? "0" : "";
405
411
  }
@@ -1573,9 +1579,6 @@ function flushTickQueue() {
1573
1579
  tickQueue = void 0;
1574
1580
  for (let cb of queue) cb(!0);
1575
1581
  }
1576
- function isPromise(value) {
1577
- return value != null && typeof value.then == "function";
1578
- }
1579
1582
  function getFilteredGlobals($global) {
1580
1583
  if (!$global) return 0;
1581
1584
  let serializedGlobals = $global.serializedGlobals;
@@ -1964,4 +1967,4 @@ function toObjectExpression(options) {
1964
1967
  //#region src/html/compat.ts
1965
1968
  function NOOP() {}
1966
1969
  //#endregion
1967
- export { $global, _assert_hoist, _attr, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _subscribe, _template, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, withLoadAssets, withPageAssets };
1970
+ export { $global, _assert_hoist, _attr, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _subscribe, _template, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, withLoadAssets, withPageAssets };
@@ -86,3 +86,4 @@ export declare const ElseTag: {
86
86
  html?: boolean;
87
87
  };
88
88
  };
89
+ export declare function flattenTextOnlyConditional(rootTag: t.NodePath<t.MarkoTag>): void;
@@ -1,3 +1,8 @@
1
1
  import { type Tag } from "@marko/compiler/babel-utils";
2
+ declare module "@marko/compiler/dist/types" {
3
+ interface NodeExtra {
4
+ styleImportPath?: string | null;
5
+ }
6
+ }
2
7
  declare const _default: Tag;
3
8
  export default _default;