marko 6.3.35 → 6.3.36
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/common/meta.d.ts +1 -0
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +7 -0
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +6 -0
- package/dist/debug/{dom-Bt4OoZ-j.js → dom-BbFAdZEB.js} +22 -3
- package/dist/debug/{dom-B57LrRnX.mjs → dom-ClMc0GK9.mjs} +11 -4
- package/dist/debug/dom.js +1 -1
- package/dist/debug/dom.mjs +1 -1
- package/dist/debug/html.js +6 -4
- package/dist/debug/html.mjs +6 -4
- package/dist/dom/catch.feat.js +4 -4
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/control-flow.d.ts +2 -0
- package/dist/dom/controllable-input.feat.js +2 -2
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +2 -2
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +2 -2
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +2 -2
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +2 -2
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.d.ts +1 -0
- package/dist/dom/dynamic-tag-var.feat.js +3 -0
- package/dist/dom/dynamic-tag-var.feat.mjs +4 -0
- package/dist/{dom-BeF9xIzO.js → dom-59H9kVUF.js} +115 -107
- package/dist/{dom-BP2XSglG.mjs → dom-BKDjlXIl.mjs} +7 -4
- package/dist/dom.js +34 -34
- package/dist/dom.mjs +1 -1
- package/dist/html.js +4 -4
- package/dist/html.mjs +4 -4
- package/dist/translator/index.js +150 -31
- package/dist/translator/util/references.d.ts +1 -0
- package/dist/translator/util/runtime.d.ts +1 -1
- package/dist/translator/util/traverse.d.ts +2 -0
- package/package.json +4 -4
|
@@ -52,7 +52,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
52
52
|
let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
|
|
53
53
|
return (scope, newRenderer, getInput) => {
|
|
54
54
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
|
55
|
-
if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor] ? scope[childScopeAccessor].T = (value) => getTagVar()(scope, value) : getTagVar()(scope, void 0)), typeof normalizedRenderer == "string") {
|
|
55
|
+
if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor] ? (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value), typeof normalizedRenderer == "string" && bindNativeTagVar?.(scope[childScopeAccessor])) : getTagVar()(scope, void 0)), typeof normalizedRenderer == "string") {
|
|
56
56
|
if (getContent) {
|
|
57
57
|
let content = getContent(scope);
|
|
58
58
|
setConditionalRenderer(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
|
|
@@ -80,7 +80,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
|
|
|
80
80
|
return (scope, renderer) => {
|
|
81
81
|
if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(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]);
|
|
82
82
|
};
|
|
83
|
-
}), _resume_dynamic_tag = /*@__PURE__*/ withBranches(() => _resume("d", dynamicTagScript)), loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, walks, setup, params) => {
|
|
83
|
+
}), bindNativeTagVar, _resume_dynamic_tag = /*@__PURE__*/ withBranches(() => _resume("d", dynamicTagScript)), loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, walks, setup, params) => {
|
|
84
84
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
85
85
|
let scopesAccessor = "A" + nodeAccessor, keyedScopesAccessor = "O" + nodeAccessor, renderer = _content("", template, walks, setup)();
|
|
86
86
|
return (scope, value) => {
|
|
@@ -693,7 +693,7 @@ function _attr_style_item(element, name, value) {
|
|
|
693
693
|
}
|
|
694
694
|
function _style_shell(scope, nodeAccessor) {
|
|
695
695
|
let element = scope[nodeAccessor], id = _id(scope);
|
|
696
|
-
_attr_nonce(scope, nodeAccessor), element
|
|
696
|
+
_attr_nonce(scope, nodeAccessor), _attr(element, "class", id), _text_content(element, "." + id + "~*{}");
|
|
697
697
|
}
|
|
698
698
|
function _style_rule_item(element, name, value) {
|
|
699
699
|
let text = element.textContent, decl = name + ":" + escapeStyleValue(_to_text(value)) + ";", start = text.indexOf("{" + name + ":");
|
|
@@ -1129,6 +1129,9 @@ function rendererKey(renderer) {
|
|
|
1129
1129
|
function patchDynamicTag(fn) {
|
|
1130
1130
|
_dynamic_tag = fn(_dynamic_tag);
|
|
1131
1131
|
}
|
|
1132
|
+
function installDynamicTagVar(bind) {
|
|
1133
|
+
bindNativeTagVar = bind;
|
|
1134
|
+
}
|
|
1132
1135
|
function dynamicTagScript(branch) {
|
|
1133
1136
|
_attrs_script(branch, "a");
|
|
1134
1137
|
}
|
|
@@ -1147,4 +1150,4 @@ function byFirstArg(name) {
|
|
|
1147
1150
|
return name;
|
|
1148
1151
|
}
|
|
1149
1152
|
//#endregion
|
|
1150
|
-
export {
|
|
1153
|
+
export { _attrs_script as $, queueAsyncRender as $t, _attr_input_value_script as A, _hoist_resume as At, _attr as B, _var_change as Bt, _attr_input_checkedValue_script as C, _closure as Ct, _attr_input_value_attribute_default as D, _for_closure as Dt, _attr_input_value as E, _el_read as Et, _controllable_open as F, _or as Ft, _attr_nonce as G, syncGen as Gt, _attr_class_item as H, destroyBranch as Ht, _controllable_select as I, _return as It, _attr_style_items as J, $signalReset as Jt, _attr_style as K, _on as Kt, _controllable_textarea as L, _return_change as Lt, _attr_select_value_default as M, _if_closure as Mt, _attr_select_value_script as N, _let as Nt, _attr_input_value_default as O, _for_selector as Ot, _controllable_input as P, _let_change as Pt, _attrs_partial_content as Q, prepareEffects as Qt, controllableRenders as R, _script as Rt, _attr_input_checkedValue_default as S, _child_setup as St, _attr_input_checked_script as T, _const as Tt, _attr_class_items as U, insertBranchBefore as Ut, _attr_class as V, _assert_init as Vt, _attr_content as W, removeAndDestroyBranch as Wt, _attrs_content as X, installCatch as Xt, _attrs as Y, caughtError as Yt, _attrs_partial as Z, placeholderShown as Zt, _attr_details_or_dialog_open as _, _var_resume as _t, _for_in as a, forOf as an, _text_content as at, _attr_input_checked as b, initEmbedded as bt, _for_until as c, _assert_hoist as cn, toInsertNode as ct, _show as d, _content_resume as dt, queueEffect as en, _html as et, _try as f, createAndSetupBranch as ft, renderCatch as g, _resume as gt, patchDynamicTag as h, _el as ht, _dynamic_tag_content as i, forIn as in, _text as it, _attr_select_value as j, _id as jt, _attr_input_value_dynamic_default as k, _hoist as kt, _if as l, _call as ln, _content as lt, installDynamicTagVar as m, setupBranch as mt, _await_promise as n, runEffects as nn, _style_rule_item as nt, _for_of as o, forTo as on, _to_text as ot, addAwaitCounter as p, createBranch as pt, _attr_style_item as q, $signal as qt, _dynamic_tag as r, runId as rn, _style_shell as rt, _for_to as s, forUntil as sn, insertChildNodes as st, _await_content as t, run as tn, _lifecycle as tt, _resume_dynamic_tag as u, decodeAccessor as un, _content_closures as ut, _attr_details_or_dialog_open_default as v, getRegisteredWithScope as vt, _attr_input_checked_default as w, _closure_get as wt, _attr_input_checkedValue as x, ready as xt, _attr_details_or_dialog_open_script as y, init as yt, controllableScripts as z, _var as zt };
|
package/dist/dom.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
let require_control_flow = require("./dom-
|
|
2
|
-
require_control_flow.
|
|
1
|
+
let require_control_flow = require("./dom-59H9kVUF.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
|
|
2
|
+
require_control_flow.yt($global.runtimeId);
|
|
3
3
|
let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
|
|
4
4
|
return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
|
|
5
5
|
}, compat = {
|
|
6
|
-
patchDynamicTag: require_control_flow.
|
|
7
|
-
queueEffect: require_control_flow
|
|
6
|
+
patchDynamicTag: require_control_flow.h,
|
|
7
|
+
queueEffect: require_control_flow.en,
|
|
8
8
|
init(warp10Noop) {
|
|
9
|
-
require_control_flow.
|
|
9
|
+
require_control_flow.gt("$C_s", (scope) => {
|
|
10
10
|
if (getRenderScopes(scope.$)[scope.L] = scope, scope.m5c && classIdToBranch.set(scope.m5c, scope), classEventResolver) for (let key in scope) {
|
|
11
11
|
let resolved = classEventResolver(scope[key], scope);
|
|
12
12
|
resolved !== scope[key] && (scope[key] = resolved);
|
|
13
13
|
}
|
|
14
|
-
}), require_control_flow.
|
|
14
|
+
}), require_control_flow.gt("$C_b", warp10Noop);
|
|
15
15
|
},
|
|
16
16
|
setClassEventResolver(fn) {
|
|
17
17
|
classEventResolver = fn;
|
|
@@ -35,35 +35,35 @@ let require_control_flow = require("./dom-BeF9xIzO.js"), empty = [], rest = Symb
|
|
|
35
35
|
branch.S = startNode, branch.K = endNode;
|
|
36
36
|
},
|
|
37
37
|
runComponentEffects() {
|
|
38
|
-
this.effects && require_control_flow.
|
|
38
|
+
this.effects && require_control_flow.nn(this.effects);
|
|
39
39
|
},
|
|
40
40
|
runComponentDestroy() {
|
|
41
|
-
this.scope && require_control_flow.
|
|
41
|
+
this.scope && require_control_flow.Ht(this.scope);
|
|
42
42
|
},
|
|
43
43
|
resolveRegistered(value, $global) {
|
|
44
|
-
return Array.isArray(value) && typeof value[0] == "string" ? require_control_flow.
|
|
44
|
+
return Array.isArray(value) && typeof value[0] == "string" ? require_control_flow.vt(value[0], getRenderScopes($global)?.[value[1]]) : value;
|
|
45
45
|
},
|
|
46
46
|
createRenderer(params, clone) {
|
|
47
|
-
let renderer = require_control_flow.
|
|
47
|
+
let renderer = require_control_flow.lt("", 0, 0, 0, params)();
|
|
48
48
|
return renderer.b = (branch) => {
|
|
49
49
|
let cloned = clone();
|
|
50
50
|
branch.S = cloned.startNode, branch.K = cloned.endNode;
|
|
51
51
|
}, renderer;
|
|
52
52
|
},
|
|
53
53
|
render(out, component, renderer, args) {
|
|
54
|
-
require_control_flow.
|
|
54
|
+
require_control_flow.yt(out.global.runtimeId);
|
|
55
55
|
let branch = component.scope, created = 0;
|
|
56
56
|
if (!branch && (branch = classIdToBranch.get(component.id)) && (component.scope = branch, classIdToBranch.delete(component.id)), args[0] && typeof args[0] == "object" && "renderBody" in args[0]) {
|
|
57
57
|
let input = args[0], normalizedInput = args[0] = {};
|
|
58
58
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
59
59
|
}
|
|
60
|
-
if (component.effects = require_control_flow.
|
|
61
|
-
branch ||= (created = 1, component.scope = require_control_flow.
|
|
62
|
-
}), created) return require_control_flow.
|
|
60
|
+
if (component.effects = require_control_flow.Qt(() => {
|
|
61
|
+
branch ||= (created = 1, component.scope = require_control_flow.ft(out.global, renderer, renderer.e, document.body)), renderer.d?.(branch, renderer._ ? args[0] : args);
|
|
62
|
+
}), created) return require_control_flow.ct(branch.S, branch.K);
|
|
63
63
|
}
|
|
64
64
|
}, _template = (id, template, walks, setup, inputSignal) => {
|
|
65
|
-
let renderer = require_control_flow.
|
|
66
|
-
return renderer.mount = mount, renderer._ = renderer, require_control_flow.
|
|
65
|
+
let renderer = require_control_flow.lt(id, template, walks, setup, inputSignal)();
|
|
66
|
+
return renderer.mount = mount, renderer._ = renderer, require_control_flow.gt(id, renderer);
|
|
67
67
|
};
|
|
68
68
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
69
69
|
//#region src/common/attr-tag.ts
|
|
@@ -102,25 +102,25 @@ function mount(input = {}, reference, position) {
|
|
|
102
102
|
parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
|
-
let curValue, args = this.d, effects = require_control_flow.
|
|
106
|
-
branch = require_control_flow.
|
|
105
|
+
let curValue, args = this.d, effects = require_control_flow.Qt(() => {
|
|
106
|
+
branch = require_control_flow.pt($global, this, void 0, parentNode), branch.T = (newValue) => {
|
|
107
107
|
curValue = newValue;
|
|
108
108
|
}, this.c?.(branch), args?.(branch, input);
|
|
109
109
|
});
|
|
110
|
-
return require_control_flow.
|
|
110
|
+
return require_control_flow.st(parentNode, nextSibling, branch.S, branch.K), require_control_flow.nn(effects), {
|
|
111
111
|
get value() {
|
|
112
112
|
return curValue;
|
|
113
113
|
},
|
|
114
114
|
set value(newValue) {
|
|
115
|
-
require_control_flow.
|
|
115
|
+
require_control_flow.Bt(branch, newValue);
|
|
116
116
|
},
|
|
117
117
|
update(newInput = {}) {
|
|
118
|
-
args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.
|
|
118
|
+
args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.nn(require_control_flow.Qt(() => {
|
|
119
119
|
args(branch, newInput);
|
|
120
120
|
})));
|
|
121
121
|
},
|
|
122
122
|
destroy() {
|
|
123
|
-
require_control_flow.
|
|
123
|
+
require_control_flow.Wt(branch);
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
}
|
|
@@ -130,13 +130,13 @@ function _load_template(id, load) {
|
|
|
130
130
|
let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
|
|
131
131
|
let awaitCounter = require_control_flow.p(branch);
|
|
132
132
|
branch.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((renderer) => {
|
|
133
|
-
Object.assign(lazyTemplate, renderer), require_control_flow
|
|
133
|
+
Object.assign(lazyTemplate, renderer), require_control_flow.$t(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
|
|
134
134
|
}, loadFailed(branch, awaitCounter));
|
|
135
135
|
}, _load_signal(() => (pending ||= load()).then((r) => ({ _: r.d }))));
|
|
136
136
|
return lazyTemplate;
|
|
137
137
|
}
|
|
138
138
|
function _load_setup(nodeAccessor, childScopeAccessor, load) {
|
|
139
|
-
nodeAccessor = require_control_flow.
|
|
139
|
+
nodeAccessor = require_control_flow.un(nodeAccessor), childScopeAccessor = require_control_flow.un(childScopeAccessor);
|
|
140
140
|
let pending, renderer;
|
|
141
141
|
return (owner) => {
|
|
142
142
|
let child = owner[childScopeAccessor];
|
|
@@ -144,33 +144,33 @@ function _load_setup(nodeAccessor, childScopeAccessor, load) {
|
|
|
144
144
|
else {
|
|
145
145
|
let awaitCounter = require_control_flow.p(owner);
|
|
146
146
|
child.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((mod) => {
|
|
147
|
-
renderer = require_control_flow.
|
|
147
|
+
renderer = require_control_flow.lt("", ...mod._)(), require_control_flow.$t(child, (child) => insertLoaded(renderer, child, owner[nodeAccessor], awaitCounter));
|
|
148
148
|
}, loadFailed(child, awaitCounter));
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
153
153
|
let parent = marker.parentNode, values = branch.X, insert = () => {
|
|
154
|
-
require_control_flow.
|
|
154
|
+
require_control_flow.Ut(branch, parent, marker), marker.remove(), awaitCounter?.c();
|
|
155
155
|
}, remaining;
|
|
156
|
-
if (require_control_flow.
|
|
156
|
+
if (require_control_flow.Gt(branch), renderer.b(branch, parent.namespaceURI), branch.X = 0, remaining = values?.size) {
|
|
157
157
|
let fail = loadFailed(branch, awaitCounter);
|
|
158
158
|
for (let [promise, entry] of values) promise.then((signal) => {
|
|
159
|
-
entry.b = signal, --remaining || require_control_flow
|
|
160
|
-
require_control_flow.
|
|
159
|
+
entry.b = signal, --remaining || require_control_flow.$t(branch, (branch) => {
|
|
160
|
+
require_control_flow.Gt(branch), renderer.c?.(branch), values.forEach((e) => e.b._(branch, e.a)), insert();
|
|
161
161
|
});
|
|
162
162
|
}, (error) => remaining > 0 && (remaining = 0, fail(error)));
|
|
163
|
-
} else require_control_flow.
|
|
163
|
+
} else require_control_flow.mt(renderer, branch), insert();
|
|
164
164
|
}
|
|
165
165
|
function loadFailed(scope, awaitCounter) {
|
|
166
166
|
return (error) => {
|
|
167
|
-
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.c()), require_control_flow
|
|
167
|
+
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.c()), require_control_flow.$t(scope, require_control_flow.g, error);
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
function _load_signal(load) {
|
|
171
171
|
let pending, signal;
|
|
172
172
|
return (scope, value) => {
|
|
173
|
-
pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.
|
|
173
|
+
pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.rn ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, { a: value }) : signal ? signal(scope, value) : pending.then((mod) => require_control_flow.$t(scope, signal = mod._, value), () => 0);
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
176
|
function _load_visible_trigger(selector, options) {
|
|
@@ -196,9 +196,9 @@ function _load_race_trigger(...triggers) {
|
|
|
196
196
|
function getSelectorOrResolve(selector, resolve) {
|
|
197
197
|
return document.querySelector(selector) || resolve();
|
|
198
198
|
}
|
|
199
|
-
exports.$signal = require_control_flow.
|
|
199
|
+
exports.$signal = require_control_flow.qt, exports.$signalReset = require_control_flow.Jt, exports._assert_hoist = require_control_flow.cn, exports._assert_init = require_control_flow.Vt, exports._attr = require_control_flow.B, exports._attr_class = require_control_flow.V, exports._attr_class_item = require_control_flow.H, exports._attr_class_items = require_control_flow.U, exports._attr_content = require_control_flow.W, exports._attr_details_open = require_control_flow._, exports._attr_dialog_open = require_control_flow._, exports._attr_details_open_default = require_control_flow.v, exports._attr_dialog_open_default = require_control_flow.v, exports._attr_details_open_script = require_control_flow.y, exports._attr_dialog_open_script = require_control_flow.y, exports._attr_input_checked = require_control_flow.b, exports._attr_input_checkedValue = require_control_flow.x, exports._attr_input_checkedValue_default = require_control_flow.S, exports._attr_input_checkedValue_script = require_control_flow.C, exports._attr_input_checked_default = require_control_flow.w, exports._attr_input_checked_script = require_control_flow.T, exports._attr_input_value = require_control_flow.E, exports._attr_textarea_value = require_control_flow.E, exports._attr_input_value_attribute_default = require_control_flow.D, exports._attr_input_value_default = require_control_flow.O, exports._attr_textarea_value_default = require_control_flow.O, exports._attr_input_value_dynamic_default = require_control_flow.k, exports._attr_input_value_script = require_control_flow.A, exports._attr_textarea_value_script = require_control_flow.A, exports._attr_nonce = require_control_flow.G, exports._attr_select_value = require_control_flow.j, exports._attr_select_value_default = require_control_flow.M, exports._attr_select_value_script = require_control_flow.N, exports._attr_style = require_control_flow.K, exports._attr_style_item = require_control_flow.q, exports._attr_style_items = require_control_flow.J, exports._attrs = require_control_flow.Y, exports._attrs_content = require_control_flow.X, exports._attrs_partial = require_control_flow.Z, exports._attrs_partial_content = require_control_flow.Q, exports._attrs_script = require_control_flow.$, exports._await_content = require_control_flow.t, exports._await_promise = require_control_flow.n, exports._call = require_control_flow.ln, exports._child_setup = require_control_flow.St, exports._closure = require_control_flow.Ct, exports._closure_get = require_control_flow.wt, exports._const = require_control_flow.Tt, exports._content = require_control_flow.lt, exports._content_closures = require_control_flow.ut, exports._content_resume = require_control_flow.dt, exports._controllable_input = require_control_flow.P, exports._controllable_open = require_control_flow.F, exports._controllable_select = require_control_flow.I, exports._controllable_textarea = require_control_flow.L, Object.defineProperty(exports, "_dynamic_tag", {
|
|
200
200
|
enumerable: !0,
|
|
201
201
|
get: function() {
|
|
202
202
|
return require_control_flow.r;
|
|
203
203
|
}
|
|
204
|
-
}), exports._dynamic_tag_content = require_control_flow.i, exports._el = require_control_flow.
|
|
204
|
+
}), exports._dynamic_tag_content = require_control_flow.i, exports._el = require_control_flow.ht, exports._el_read = require_control_flow.Et, exports._for_closure = require_control_flow.Dt, exports._for_in = require_control_flow.a, exports._for_of = require_control_flow.o, exports._for_selector = require_control_flow.Ot, exports._for_to = require_control_flow.s, exports._for_until = require_control_flow.c, exports._hoist = require_control_flow.kt, exports._hoist_resume = require_control_flow.At, exports._html = require_control_flow.et, exports._id = require_control_flow.jt, exports._if = require_control_flow.l, exports._if_closure = require_control_flow.Mt, exports._let = require_control_flow.Nt, exports._let_change = require_control_flow.Pt, exports._lifecycle = require_control_flow.tt, 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 = require_control_flow.Kt, exports._or = require_control_flow.Ft, exports._resume = require_control_flow.gt, exports._resume_dynamic_tag = require_control_flow.u, exports._return = require_control_flow.It, exports._return_change = require_control_flow.Lt, exports._script = require_control_flow.Rt, exports._show = require_control_flow.d, exports._style_rule_item = require_control_flow.nt, exports._style_shell = require_control_flow.rt, exports._template = _template, exports._text = require_control_flow.it, exports._text_content = require_control_flow.at, exports._to_text = require_control_flow.ot, exports._try = require_control_flow.f, exports._var = require_control_flow.zt, exports._var_change = require_control_flow.Bt, exports._var_resume = require_control_flow._t, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = require_control_flow.in, exports.forOf = require_control_flow.an, exports.forTo = require_control_flow.on, exports.forUntil = require_control_flow.sn, exports.init = require_control_flow.yt, exports.initEmbedded = require_control_flow.bt, exports.ready = require_control_flow.xt, exports.run = require_control_flow.tn;
|
package/dist/dom.mjs
CHANGED
|
@@ -65,7 +65,7 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
|
|
|
65
65
|
let renderer = _content(id, template, walks, setup, inputSignal)();
|
|
66
66
|
return renderer.mount = mount, renderer._ = renderer, _resume(id, renderer);
|
|
67
67
|
};
|
|
68
|
-
import { $ as
|
|
68
|
+
import { $ as _attrs_script, $t as queueAsyncRender, A as _attr_input_value_script, At as _hoist_resume, B as _attr, Bt as _var_change, C as _attr_input_checkedValue_script, Ct as _closure, D as _attr_input_value_attribute_default, Dt as _for_closure, E as _attr_input_value, Et as _el_read, F as _controllable_open, Ft as _or, G as _attr_nonce, Gt as syncGen, H as _attr_class_item, Ht as destroyBranch, I as _controllable_select, It as _return, J as _attr_style_items, Jt as $signalReset, K as _attr_style, Kt as _on, L as _controllable_textarea, Lt as _return_change, M as _attr_select_value_default, Mt as _if_closure, N as _attr_select_value_script, Nt as _let, O as _attr_input_value_default, Ot as _for_selector, P as _controllable_input, Pt as _let_change, Q as _attrs_partial_content, Qt as prepareEffects, Rt as _script, S as _attr_input_checkedValue_default, St as _child_setup, T as _attr_input_checked_script, Tt as _const, U as _attr_class_items, Ut as insertBranchBefore, V as _attr_class, Vt as _assert_init, W as _attr_content, Wt as removeAndDestroyBranch, X as _attrs_content, Y as _attrs, Z as _attrs_partial, _ as _attr_details_or_dialog_open, _t as _var_resume, a as _for_in, an as forOf, at as _text_content, b as _attr_input_checked, bt as initEmbedded, c as _for_until, cn as _assert_hoist, ct as toInsertNode, d as _show, dt as _content_resume, en as queueEffect, et as _html, f as _try, ft as createAndSetupBranch, g as renderCatch, gt as _resume, h as patchDynamicTag, ht as _el, i as _dynamic_tag_content, in as forIn, it as _text, j as _attr_select_value, jt as _id, k as _attr_input_value_dynamic_default, kt as _hoist, l as _if, ln as _call, lt as _content, mt as setupBranch, n as _await_promise, nn as runEffects, nt as _style_rule_item, o as _for_of, on as forTo, ot as _to_text, p as addAwaitCounter, pt as createBranch, q as _attr_style_item, qt as $signal, r as _dynamic_tag, rn as runId, rt as _style_shell, s as _for_to, sn as forUntil, st as insertChildNodes, t as _await_content, tn as run, tt as _lifecycle, u as _resume_dynamic_tag, un as decodeAccessor, ut as _content_closures, v as _attr_details_or_dialog_open_default, vt as getRegisteredWithScope, w as _attr_input_checked_default, wt as _closure_get, x as _attr_input_checkedValue, xt as ready, y as _attr_details_or_dialog_open_script, yt as init, zt as _var } from "./dom-BKDjlXIl.mjs";
|
|
69
69
|
//#region src/common/attr-tag.ts
|
|
70
70
|
function attrTag(attrs) {
|
|
71
71
|
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
package/dist/html.js
CHANGED
|
@@ -255,15 +255,15 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
255
255
|
if (_scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
256
256
|
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
257
257
|
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange, 1));
|
|
258
|
-
else
|
|
259
|
-
if (typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
260
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent, 1) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
258
|
+
else {
|
|
259
|
+
if (renderContent && typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
260
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason) : void 0, 1) : renderContent && _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
261
261
|
}
|
|
262
262
|
_html(`</${renderer}>`);
|
|
263
263
|
}
|
|
264
264
|
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
265
265
|
needsScript && _script(branchId, "d"), (shouldResume || needsScript) && _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
266
|
-
})();
|
|
266
|
+
})(), result = _el(branchId, "e");
|
|
267
267
|
} else {
|
|
268
268
|
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
269
269
|
if (renderer) try {
|
package/dist/html.mjs
CHANGED
|
@@ -255,15 +255,15 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
255
255
|
if (_scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
256
256
|
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
257
257
|
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange, 1));
|
|
258
|
-
else
|
|
259
|
-
if (typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
260
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent, 1) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
258
|
+
else {
|
|
259
|
+
if (renderContent && typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
260
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason) : void 0, 1) : renderContent && _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
261
261
|
}
|
|
262
262
|
_html(`</${renderer}>`);
|
|
263
263
|
}
|
|
264
264
|
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
265
265
|
needsScript && _script(branchId, "d"), (shouldResume || needsScript) && _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
266
|
-
})();
|
|
266
|
+
})(), result = _el(branchId, "e");
|
|
267
267
|
} else {
|
|
268
268
|
let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
|
|
269
269
|
if (renderer) try {
|
package/dist/translator/index.js
CHANGED
|
@@ -377,6 +377,7 @@ const Generator = (function* () {})().constructor;
|
|
|
377
377
|
const AsyncGenerator = (async function* () {})().constructor;
|
|
378
378
|
patchIteratorNext(Generator.prototype);
|
|
379
379
|
patchIteratorNext(AsyncGenerator.prototype);
|
|
380
|
+
const REGISTRY = /* @__PURE__ */ new WeakMap();
|
|
380
381
|
(() => {
|
|
381
382
|
const KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
382
383
|
for (const name of Object.getOwnPropertyNames(Symbol)) {
|
|
@@ -387,10 +388,88 @@ patchIteratorNext(AsyncGenerator.prototype);
|
|
|
387
388
|
})();
|
|
388
389
|
Array.from, Array.isArray, Array.of, ArrayBuffer.isView, Atomics.add, Atomics.and, Atomics.compareExchange, Atomics.exchange, Atomics.isLockFree, Atomics.load, Atomics.notify, Atomics.or, Atomics.store, Atomics.sub, Atomics.wait, BigInt.asIntN, BigInt.asUintN, BigInt64Array, BigInt64Array.from, BigInt64Array.of, BigUint64Array, BigUint64Array.from, BigUint64Array.of, console.timeStamp, Date.now, Date.parse, Date.UTC, Float32Array.from, Float32Array.of, Float64Array.from, Float64Array.of, globalThis.atob, globalThis.btoa, globalThis.clearImmediate, globalThis.clearInterval, globalThis.clearTimeout, globalThis.crypto?.getRandomValues, globalThis.crypto?.randomUUID, globalThis.fetch, globalThis.performance?.now, globalThis.queueMicrotask, globalThis.setImmediate, globalThis.setInterval, globalThis.setTimeout, globalThis.structuredClone, globalThis.URL, globalThis.URLSearchParams, globalThis.WritableStream, Int16Array.from, Int16Array.of, Int32Array.from, Int32Array.of, Int8Array.from, Int8Array.of, Intl.Collator, Intl.DateTimeFormat, Intl.DisplayNames, Intl.getCanonicalLocales, Intl.ListFormat, Intl.Locale, Intl.NumberFormat, Intl.PluralRules, Intl.RelativeTimeFormat, Intl.Segmenter, Intl.supportedValuesOf, Map.groupBy, Number.isFinite, Number.isInteger, Number.isNaN, Number.isSafeInteger, Number.parseFloat, Number.parseInt, String.fromCharCode, String.fromCodePoint, String.raw, Symbol.for, Uint16Array.from, Uint16Array.of, Uint32Array.from, Uint32Array.of, Uint8Array.from, Uint8Array.of, Uint8ClampedArray.from, Uint8ClampedArray.of;
|
|
389
390
|
Atomics, globalThis.crypto;
|
|
391
|
+
function register(id, val, scope) {
|
|
392
|
+
REGISTRY.set(val, {
|
|
393
|
+
id,
|
|
394
|
+
scope,
|
|
395
|
+
access: "_._" + toAccess(toObjectKey(id))
|
|
396
|
+
});
|
|
397
|
+
return val;
|
|
398
|
+
}
|
|
399
|
+
function toObjectKey(name) {
|
|
400
|
+
if (name === "") return "\"\"";
|
|
401
|
+
if (name === "__proto__") return "[\"__proto__\"]";
|
|
402
|
+
const len = name.length;
|
|
403
|
+
const c0 = name.charCodeAt(0);
|
|
404
|
+
if (c0 >= 48 && c0 <= 57) if (c0 === 48) {
|
|
405
|
+
if (len !== 1) return quote(name, 1);
|
|
406
|
+
} else {
|
|
407
|
+
for (let i = 1; i < len; i++) {
|
|
408
|
+
const c = name.charCodeAt(i);
|
|
409
|
+
if (c < 48 || c > 57) return quote(name, i);
|
|
410
|
+
}
|
|
411
|
+
if (len > 15 && "" + +name !== name) return quote(name, 0);
|
|
412
|
+
}
|
|
413
|
+
else if (c0 >= 97 && c0 <= 122 || c0 >= 65 && c0 <= 90 || c0 === 95 || c0 === 36) for (let i = 1; i < len; i++) {
|
|
414
|
+
const c = name.charCodeAt(i);
|
|
415
|
+
if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 95 || c === 36)) return quote(name, i);
|
|
416
|
+
}
|
|
417
|
+
else return quote(name, 0);
|
|
418
|
+
return name;
|
|
419
|
+
}
|
|
390
420
|
function toAccess(accessor) {
|
|
391
421
|
const start = accessor[0];
|
|
392
422
|
return start === "[" ? accessor : start === "\"" || start >= "0" && start <= "9" ? "[" + accessor + "]" : "." + accessor;
|
|
393
423
|
}
|
|
424
|
+
const unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u;
|
|
425
|
+
function quote(str, startPos) {
|
|
426
|
+
if (!unsafeQuoteReg.test(str)) return "\"" + str + "\"";
|
|
427
|
+
let result = "";
|
|
428
|
+
let lastPos = 0;
|
|
429
|
+
for (let i = startPos; i < str.length; i++) {
|
|
430
|
+
let replacement;
|
|
431
|
+
const code = str.charCodeAt(i);
|
|
432
|
+
switch (code) {
|
|
433
|
+
case 34:
|
|
434
|
+
replacement = "\\\"";
|
|
435
|
+
break;
|
|
436
|
+
case 92:
|
|
437
|
+
replacement = "\\\\";
|
|
438
|
+
break;
|
|
439
|
+
case 60:
|
|
440
|
+
replacement = "\\x3C";
|
|
441
|
+
break;
|
|
442
|
+
case 10:
|
|
443
|
+
replacement = "\\n";
|
|
444
|
+
break;
|
|
445
|
+
case 13:
|
|
446
|
+
replacement = "\\r";
|
|
447
|
+
break;
|
|
448
|
+
case 8232:
|
|
449
|
+
replacement = "\\u2028";
|
|
450
|
+
break;
|
|
451
|
+
case 8233:
|
|
452
|
+
replacement = "\\u2029";
|
|
453
|
+
break;
|
|
454
|
+
case 0:
|
|
455
|
+
replacement = "\\x00";
|
|
456
|
+
break;
|
|
457
|
+
default:
|
|
458
|
+
if (code < 55296 || code > 57343) continue;
|
|
459
|
+
if (code < 56320) {
|
|
460
|
+
const next = str.charCodeAt(i + 1);
|
|
461
|
+
if (next >= 56320 && next <= 57343) {
|
|
462
|
+
i++;
|
|
463
|
+
continue;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
replacement = "\\u" + code.toString(16);
|
|
467
|
+
}
|
|
468
|
+
result += str.slice(lastPos, i) + replacement;
|
|
469
|
+
lastPos = i + 1;
|
|
470
|
+
}
|
|
471
|
+
return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
|
|
472
|
+
}
|
|
394
473
|
function patchIteratorNext(proto) {
|
|
395
474
|
if (proto.next[kTouchedIterator]) return;
|
|
396
475
|
const { next } = proto;
|
|
@@ -425,16 +504,37 @@ function traverseReplace(container, key, enter, state) {
|
|
|
425
504
|
}
|
|
426
505
|
}
|
|
427
506
|
function traverseContains(node, check) {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
507
|
+
return !!traverseFind(node, check);
|
|
508
|
+
}
|
|
509
|
+
function traverseFind(node, check) {
|
|
510
|
+
if (node) if (Array.isArray(node)) for (const item of node) {
|
|
511
|
+
const found = traverseFind(item, check);
|
|
512
|
+
if (found) return found;
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
431
515
|
switch (check(node)) {
|
|
432
|
-
case true: return
|
|
433
|
-
case skip: return
|
|
516
|
+
case true: return node;
|
|
517
|
+
case skip: return;
|
|
518
|
+
}
|
|
519
|
+
for (const key of _marko_compiler.types.VISITOR_KEYS[node.type]) {
|
|
520
|
+
const found = traverseFind(node[key], check);
|
|
521
|
+
if (found) return found;
|
|
434
522
|
}
|
|
435
|
-
for (const key of _marko_compiler.types.VISITOR_KEYS[node.type]) if (traverseContains(node[key], check)) return true;
|
|
436
523
|
}
|
|
437
|
-
|
|
524
|
+
}
|
|
525
|
+
function traverseFindAwait(node) {
|
|
526
|
+
return traverseFind(node, (child) => {
|
|
527
|
+
switch (child.type) {
|
|
528
|
+
case "ForOfStatement": return child.await;
|
|
529
|
+
case "FunctionDeclaration":
|
|
530
|
+
case "FunctionExpression":
|
|
531
|
+
case "ArrowFunctionExpression":
|
|
532
|
+
case "ClassMethod":
|
|
533
|
+
case "ObjectMethod":
|
|
534
|
+
case "ClassPrivateMethod": return skip;
|
|
535
|
+
case "AwaitExpression": return true;
|
|
536
|
+
}
|
|
537
|
+
});
|
|
438
538
|
}
|
|
439
539
|
function traverse(visit, node, parent, grandParent) {
|
|
440
540
|
if (node) {
|
|
@@ -1443,7 +1543,7 @@ function getNodeContentType(path, extraMember, contentInfo) {
|
|
|
1443
1543
|
case "for":
|
|
1444
1544
|
case "if":
|
|
1445
1545
|
case "await":
|
|
1446
|
-
case "try":
|
|
1546
|
+
case "try": return 1;
|
|
1447
1547
|
case "show": return 1;
|
|
1448
1548
|
default: return null;
|
|
1449
1549
|
}
|
|
@@ -1565,6 +1665,13 @@ function isNativeNode(tag) {
|
|
|
1565
1665
|
const [getReferencesByFn] = createProgramState(() => /* @__PURE__ */ new Map());
|
|
1566
1666
|
const [getReferencesByImportedFn] = createProgramState(() => /* @__PURE__ */ new Map());
|
|
1567
1667
|
var function_default = { analyze(fn) {
|
|
1668
|
+
const awaitNode = isMarkoAttribute(fn.parentPath) && _marko_compiler.types.isFunctionExpression(fn.node) && !fn.node.async && traverseFindAwait(fn.node.body);
|
|
1669
|
+
if (awaitNode) {
|
|
1670
|
+
const file = (0, _marko_compiler_babel_utils.getFile)();
|
|
1671
|
+
const start = file.code.indexOf("await", awaitNode.start ?? 0);
|
|
1672
|
+
const highlight = start >= 0 && (awaitNode.end == null || start < awaitNode.end) ? (0, _marko_compiler_babel_utils.withLoc)(file, _marko_compiler.types.cloneNode(awaitNode), start, start + 5) : awaitNode;
|
|
1673
|
+
throw fn.hub.buildError(highlight, "Attribute methods containing `await` must be `async`. Add `async` before the method name.");
|
|
1674
|
+
}
|
|
1568
1675
|
if (fn !== getFnRoot(fn)) return;
|
|
1569
1676
|
const exprRoot = getExprRoot(fn);
|
|
1570
1677
|
const markoRoot = getMarkoRoot(exprRoot);
|
|
@@ -1928,8 +2035,6 @@ const regexpCharsReg = /[\\^$.*+?()[\]{}|]/g;
|
|
|
1928
2035
|
function escapeRegExp(str) {
|
|
1929
2036
|
return str.replace(regexpCharsReg, "\\$&");
|
|
1930
2037
|
}
|
|
1931
|
-
//#endregion
|
|
1932
|
-
//#region src/common/errors.ts
|
|
1933
2038
|
function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
1934
2039
|
if (attrs) {
|
|
1935
2040
|
let exclusiveAttrs;
|
|
@@ -2032,6 +2137,12 @@ function _script(scopeId, registryId) {
|
|
|
2032
2137
|
$chunk.boundary.state.needsMainRuntime = true;
|
|
2033
2138
|
$chunk.writeEffect(scopeId, registryId);
|
|
2034
2139
|
}
|
|
2140
|
+
function _resume(val, id, scopeId) {
|
|
2141
|
+
return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
|
|
2142
|
+
}
|
|
2143
|
+
function _el(scopeId, id) {
|
|
2144
|
+
return _resume(() => void 0, id, scopeId);
|
|
2145
|
+
}
|
|
2035
2146
|
function _resume_branch(scopeId) {
|
|
2036
2147
|
const branchId = $chunk.context?.[kBranchId];
|
|
2037
2148
|
if (branchId !== void 0 && branchId !== scopeId) writeScope(scopeId, { [ClosestBranchId$1]: branchId });
|
|
@@ -2056,6 +2167,9 @@ let writeScope = (scopeId, partialScope) => {
|
|
|
2056
2167
|
target.flushScopes = true;
|
|
2057
2168
|
return scope;
|
|
2058
2169
|
};
|
|
2170
|
+
function _scope_with_id(scopeId) {
|
|
2171
|
+
return scopeWithId($chunk.boundary.state, scopeId);
|
|
2172
|
+
}
|
|
2059
2173
|
function scopeWithId(state, scopeId) {
|
|
2060
2174
|
const { scopes } = state;
|
|
2061
2175
|
let scope = scopes.get(scopeId);
|
|
@@ -2250,10 +2364,10 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
2250
2364
|
if (!voidElementsReg.test(renderer)) {
|
|
2251
2365
|
const renderContent = content || normalizeDynamicRenderer(input.content);
|
|
2252
2366
|
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange, 1));
|
|
2253
|
-
else
|
|
2254
|
-
if (typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
2255
|
-
if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent, 1);
|
|
2256
|
-
else _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
2367
|
+
else {
|
|
2368
|
+
if (renderContent && typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
2369
|
+
if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason) : void 0, 1);
|
|
2370
|
+
else if (renderContent) _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
2257
2371
|
}
|
|
2258
2372
|
_html(`</${renderer}>`);
|
|
2259
2373
|
}
|
|
@@ -2263,6 +2377,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
2263
2377
|
if (shouldResume || needsScript) _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
2264
2378
|
};
|
|
2265
2379
|
renderNative();
|
|
2380
|
+
result = _el(branchId, "e");
|
|
2266
2381
|
} else {
|
|
2267
2382
|
const chunk = void 0;
|
|
2268
2383
|
const beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0;
|
|
@@ -2334,10 +2449,17 @@ const pureDOMFunctions = /* @__PURE__ */ new Set([
|
|
|
2334
2449
|
"_load_media_trigger",
|
|
2335
2450
|
"_load_race_trigger"
|
|
2336
2451
|
]);
|
|
2452
|
+
const [getRuntimeImports] = createProgramState(() => /* @__PURE__ */ new Map());
|
|
2337
2453
|
function importRuntime(name) {
|
|
2338
2454
|
if (!isTranslate()) throw new Error(`\`importRuntime(${JSON.stringify(name)})\` may only be called during the translate stage.`);
|
|
2339
2455
|
const { output } = getMarkoOpts();
|
|
2340
|
-
|
|
2456
|
+
const imports = getRuntimeImports();
|
|
2457
|
+
let localName = imports.get(name);
|
|
2458
|
+
if (!localName) {
|
|
2459
|
+
localName = (0, _marko_compiler_babel_utils.importNamed)((0, _marko_compiler_babel_utils.getFile)(), getRuntimePath(output), name).name;
|
|
2460
|
+
imports.set(name, localName);
|
|
2461
|
+
}
|
|
2462
|
+
return _marko_compiler.types.identifier(localName);
|
|
2341
2463
|
}
|
|
2342
2464
|
function callRuntime(name, ...args) {
|
|
2343
2465
|
const callExpression = _marko_compiler.types.callExpression(importRuntime(name), filterArguments(args));
|
|
@@ -6966,6 +7088,7 @@ function createBinding(name, type, refSection, upstreamAlias, property, excludeP
|
|
|
6966
7088
|
const declared = sameSection && refDeclared;
|
|
6967
7089
|
const binding = {
|
|
6968
7090
|
id,
|
|
7091
|
+
uid: id,
|
|
6969
7092
|
name,
|
|
6970
7093
|
originalName: void 0,
|
|
6971
7094
|
type,
|
|
@@ -7096,7 +7219,7 @@ function trackReferencesForBinding(babelBinding, binding) {
|
|
|
7096
7219
|
for (const ref of referencePaths) {
|
|
7097
7220
|
const refSection = getOrCreateSection(ref);
|
|
7098
7221
|
const markoRoot = getMarkoRoot(ref);
|
|
7099
|
-
if (markoRoot?.type === "MarkoAttribute" && markoRoot.parentPath === babelBinding.path) throw ref.buildCodeFrameError(`\`${ref.node.name}\` is the [tag variable](https://markojs.com/docs/reference/language#tag-variables) this tag declares, so its own attributes cannot read it.`);
|
|
7222
|
+
if (markoRoot?.type === "MarkoAttribute" && markoRoot.parentPath === babelBinding.path && !getFnRoot(ref)) throw ref.buildCodeFrameError(`\`${ref.node.name}\` is the [tag variable](https://markojs.com/docs/reference/language#tag-variables) this tag declares, so its own attributes cannot read it.`);
|
|
7100
7223
|
else if (isReferenceHoisted(babelBinding.path, ref)) {
|
|
7101
7224
|
const invoked = isInvokedFunction(ref);
|
|
7102
7225
|
if (invoked) setReferencesScope(ref);
|
|
@@ -7658,7 +7781,7 @@ function unionParamSources(a, b) {
|
|
|
7658
7781
|
return merged;
|
|
7659
7782
|
}
|
|
7660
7783
|
const bindingUtil = new Sorted(function compareBindings(a, b) {
|
|
7661
|
-
return a === b ? 0 : a.section.id - b.section.id || (a.type !== b.type && (a.type === 0 || b.type === 0) ? a.type - b.type || a.id - b.id : a.id - b.id);
|
|
7784
|
+
return a === b ? 0 : a.section.id - b.section.id || (a.type !== b.type && (a.type === 0 || b.type === 0) ? a.type - b.type || a.id - b.id : a.id - b.id) || a.uid - b.uid;
|
|
7662
7785
|
});
|
|
7663
7786
|
const propsUtil = new Sorted(function compareProps(a, b) {
|
|
7664
7787
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
@@ -8881,7 +9004,7 @@ var script_default = {
|
|
|
8881
9004
|
const end = body[body.length - 1]?.end;
|
|
8882
9005
|
const bodyStatements = (0, _marko_compiler_babel_utils.parseStatements)(tag.hub.file, code, start, end);
|
|
8883
9006
|
if (bodyStatements.length) {
|
|
8884
|
-
const valueFn = _marko_compiler.types.arrowFunctionExpression([], _marko_compiler.types.blockStatement(bodyStatements),
|
|
9007
|
+
const valueFn = _marko_compiler.types.arrowFunctionExpression([], _marko_compiler.types.blockStatement(bodyStatements), !!traverseFindAwait(bodyStatements));
|
|
8885
9008
|
node.attributes.push(_marko_compiler.types.markoAttribute("value", valueFn));
|
|
8886
9009
|
}
|
|
8887
9010
|
node.body.body = [];
|
|
@@ -8942,19 +9065,6 @@ var script_default = {
|
|
|
8942
9065
|
}],
|
|
8943
9066
|
types: runtime_info_default.name + "/tags/script.d.marko"
|
|
8944
9067
|
};
|
|
8945
|
-
function isAwaitExpression(node) {
|
|
8946
|
-
switch (node.type) {
|
|
8947
|
-
case "ForOfStatement": return node.await;
|
|
8948
|
-
case "FunctionDeclaration":
|
|
8949
|
-
case "FunctionExpression":
|
|
8950
|
-
case "ArrowFunctionExpression":
|
|
8951
|
-
case "ClassMethod":
|
|
8952
|
-
case "ObjectMethod":
|
|
8953
|
-
case "ClassPrivateMethod": return skip;
|
|
8954
|
-
case "AwaitExpression": return true;
|
|
8955
|
-
default: return false;
|
|
8956
|
-
}
|
|
8957
|
-
}
|
|
8958
9068
|
function isReturnedFunction(node) {
|
|
8959
9069
|
switch (node.type) {
|
|
8960
9070
|
case "FunctionDeclaration":
|
|
@@ -10228,6 +10338,7 @@ function optionalValueToNode(value) {
|
|
|
10228
10338
|
const kDOMBinding = Symbol("dynamic tag dom binding");
|
|
10229
10339
|
const kChildOffsetScopeBinding = Symbol("custom tag scope offset");
|
|
10230
10340
|
const importedDynamicTagResume = /* @__PURE__ */ new WeakSet();
|
|
10341
|
+
const importedDynamicTagVarResume = /* @__PURE__ */ new WeakSet();
|
|
10231
10342
|
const [getCompatRegistrations] = createProgramState(() => /* @__PURE__ */ new Set());
|
|
10232
10343
|
const [getCompatBoundaryCalls] = createProgramState(() => /* @__PURE__ */ new Map());
|
|
10233
10344
|
function pushCompatRegistration(key, statement) {
|
|
@@ -10384,6 +10495,7 @@ var dynamic_tag_default = {
|
|
|
10384
10495
|
}
|
|
10385
10496
|
if (!isClassAPI) {
|
|
10386
10497
|
enableDynamicTagResume(tag);
|
|
10498
|
+
enableDynamicTagVarResume(tag);
|
|
10387
10499
|
enableDynamicTagControllables(tag);
|
|
10388
10500
|
}
|
|
10389
10501
|
addValue(section, tagExtra.referencedBindings, signal, tagExpression);
|
|
@@ -10401,6 +10513,13 @@ function enableDynamicTagControllables(tag) {
|
|
|
10401
10513
|
return;
|
|
10402
10514
|
}
|
|
10403
10515
|
}
|
|
10516
|
+
function enableDynamicTagVarResume(tag) {
|
|
10517
|
+
const program = (0, _marko_compiler_babel_utils.getProgram)().node;
|
|
10518
|
+
if (tag.node.var && !importedDynamicTagVarResume.has(program) && analyzeTagNameType(tag, true) !== 1) {
|
|
10519
|
+
importedDynamicTagVarResume.add(program);
|
|
10520
|
+
importRuntimeFeature("dynamic-tag-var");
|
|
10521
|
+
}
|
|
10522
|
+
}
|
|
10404
10523
|
function enableDynamicTagResume(tag) {
|
|
10405
10524
|
const program = (0, _marko_compiler_babel_utils.getProgram)().node;
|
|
10406
10525
|
if (!importedDynamicTagResume.has(program) && analyzeTagNameType(tag, true) !== 1) {
|