marko 6.3.39 → 6.3.41
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 +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +10 -0
- package/dist/debug/dom/placeholder.feat.mjs +9 -0
- package/dist/debug/{dom-BkYlHM4b.js → dom-BbtmY5_5.js} +25 -0
- package/dist/debug/{dom-woc_wRhN.mjs → dom-DYV177a1.mjs} +2 -1
- package/dist/debug/dom.js +5 -1
- package/dist/debug/dom.mjs +5 -2
- package/dist/debug/html.js +59 -14
- package/dist/debug/html.mjs +59 -14
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/compat.d.ts +1 -0
- package/dist/dom/controllable-input.feat.js +1 -1
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +1 -1
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +1 -1
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +1 -1
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +1 -1
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +1 -1
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.d.ts +1 -0
- package/dist/dom/placeholder.feat.js +6 -0
- package/dist/dom/placeholder.feat.mjs +6 -0
- package/dist/dom/resume.d.ts +1 -0
- package/dist/{dom-CPUybM_C.mjs → dom-BVNolGe1.mjs} +2 -1
- package/dist/{dom-B15s3PHD.js → dom-BfloYt04.js} +55 -44
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +27 -24
- package/dist/dom.mjs +5 -2
- package/dist/html/compat.d.ts +2 -0
- package/dist/html/writer.d.ts +2 -0
- package/dist/html.js +35 -13
- package/dist/html.mjs +35 -13
- package/dist/translator/index.js +7 -4
- package/dist/translator/util/references.d.ts +4 -0
- package/dist/translator/util/runtime.d.ts +1 -1
- package/package.json +6 -3
package/dist/dom.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
let require_control_flow = require("./dom-
|
|
1
|
+
let require_control_flow = require("./dom-BfloYt04.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
|
|
2
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
6
|
patchDynamicTag: require_control_flow.h,
|
|
7
|
-
queueEffect: require_control_flow.
|
|
7
|
+
queueEffect: require_control_flow.nn,
|
|
8
8
|
init(warp10Noop) {
|
|
9
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) {
|
|
@@ -16,6 +16,9 @@ let require_control_flow = require("./dom-B15s3PHD.js"), empty = [], rest = Symb
|
|
|
16
16
|
setClassEventResolver(fn) {
|
|
17
17
|
classEventResolver = fn;
|
|
18
18
|
},
|
|
19
|
+
resumeClassFunction(id, build) {
|
|
20
|
+
require_control_flow.gt(id, build);
|
|
21
|
+
},
|
|
19
22
|
getScope($global, scopeId) {
|
|
20
23
|
return getRenderScopes($global)?.[scopeId];
|
|
21
24
|
},
|
|
@@ -35,10 +38,10 @@ let require_control_flow = require("./dom-B15s3PHD.js"), empty = [], rest = Symb
|
|
|
35
38
|
branch.S = startNode, branch.K = endNode;
|
|
36
39
|
},
|
|
37
40
|
runComponentEffects() {
|
|
38
|
-
this.effects && require_control_flow.
|
|
41
|
+
this.effects && require_control_flow.in(this.effects);
|
|
39
42
|
},
|
|
40
43
|
runComponentDestroy() {
|
|
41
|
-
this.scope && require_control_flow.
|
|
44
|
+
this.scope && require_control_flow.Wt(this.scope);
|
|
42
45
|
},
|
|
43
46
|
resolveRegistered(value, $global) {
|
|
44
47
|
return Array.isArray(value) && typeof value[0] == "string" ? require_control_flow.vt(value[0], getRenderScopes($global)?.[value[1]]) : value;
|
|
@@ -57,23 +60,23 @@ let require_control_flow = require("./dom-B15s3PHD.js"), empty = [], rest = Symb
|
|
|
57
60
|
let input = args[0], normalizedInput = args[0] = {};
|
|
58
61
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
59
62
|
}
|
|
60
|
-
if (component.effects = require_control_flow
|
|
63
|
+
if (component.effects = require_control_flow.en(() => {
|
|
61
64
|
branch ||= (created = 1, component.scope = require_control_flow.ft(out.global, renderer, renderer.e, document.body)), renderer.d?.(branch, renderer._ ? args[0] : args);
|
|
62
65
|
}), created) return require_control_flow.ct(branch.S, branch.K);
|
|
63
66
|
}
|
|
64
67
|
}, _template = (id, template, walks, setup, inputSignal) => {
|
|
65
68
|
let renderer = require_control_flow.lt(id, template, walks, setup, inputSignal)();
|
|
66
69
|
return renderer.mount = mount, renderer._ = renderer, require_control_flow.gt(id, renderer);
|
|
67
|
-
}, _load_template = /*@__PURE__*/ require_control_flow.
|
|
70
|
+
}, _load_template = /*@__PURE__*/ require_control_flow.Ct((id, load) => {
|
|
68
71
|
let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
|
|
69
72
|
let awaitCounter = require_control_flow.p(branch);
|
|
70
73
|
branch.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((renderer) => {
|
|
71
|
-
Object.assign(lazyTemplate, renderer), require_control_flow.
|
|
74
|
+
Object.assign(lazyTemplate, renderer), require_control_flow.tn(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
|
|
72
75
|
}, loadFailed(branch, awaitCounter));
|
|
73
76
|
}, _load_signal(() => (pending ||= load()).then((r) => ({ _: r.d }))));
|
|
74
77
|
return lazyTemplate;
|
|
75
|
-
}), _load_setup = /*@__PURE__*/ require_control_flow.
|
|
76
|
-
nodeAccessor = require_control_flow.
|
|
78
|
+
}), _load_setup = /*@__PURE__*/ require_control_flow.Ct((nodeAccessor, childScopeAccessor, load) => {
|
|
79
|
+
nodeAccessor = require_control_flow.pn(nodeAccessor), childScopeAccessor = require_control_flow.pn(childScopeAccessor);
|
|
77
80
|
let pending, renderer;
|
|
78
81
|
return (owner) => {
|
|
79
82
|
let child = owner[childScopeAccessor];
|
|
@@ -81,14 +84,14 @@ let require_control_flow = require("./dom-B15s3PHD.js"), empty = [], rest = Symb
|
|
|
81
84
|
else {
|
|
82
85
|
let awaitCounter = require_control_flow.p(owner);
|
|
83
86
|
child.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((mod) => {
|
|
84
|
-
renderer = require_control_flow.lt("", ...mod._)(), require_control_flow.
|
|
87
|
+
renderer = require_control_flow.lt("", ...mod._)(), require_control_flow.tn(child, (child) => insertLoaded(renderer, child, owner[nodeAccessor], awaitCounter));
|
|
85
88
|
}, loadFailed(child, awaitCounter));
|
|
86
89
|
}
|
|
87
90
|
};
|
|
88
|
-
}), _load_signal = /*@__PURE__*/ require_control_flow.
|
|
91
|
+
}), _load_signal = /*@__PURE__*/ require_control_flow.Ct((load) => {
|
|
89
92
|
let pending, signal;
|
|
90
93
|
return (scope, value) => {
|
|
91
|
-
pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.
|
|
94
|
+
pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.an ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, { a: value }) : signal ? signal(scope, value) : pending.then((mod) => require_control_flow.tn(scope, signal = mod._, value), () => 0);
|
|
92
95
|
};
|
|
93
96
|
});
|
|
94
97
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -128,25 +131,25 @@ function mount(input = {}, reference, position) {
|
|
|
128
131
|
parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
|
129
132
|
break;
|
|
130
133
|
}
|
|
131
|
-
let curValue, args = this.d, effects = require_control_flow
|
|
134
|
+
let curValue, args = this.d, effects = require_control_flow.en(() => {
|
|
132
135
|
branch = require_control_flow.pt($global, this, void 0, parentNode), branch.T = (newValue) => {
|
|
133
136
|
curValue = newValue;
|
|
134
137
|
}, this.c?.(branch), args?.(branch, input);
|
|
135
138
|
});
|
|
136
|
-
return require_control_flow.st(parentNode, nextSibling, branch.S, branch.K), require_control_flow.
|
|
139
|
+
return require_control_flow.st(parentNode, nextSibling, branch.S, branch.K), require_control_flow.in(effects), {
|
|
137
140
|
get value() {
|
|
138
141
|
return curValue;
|
|
139
142
|
},
|
|
140
143
|
set value(newValue) {
|
|
141
|
-
require_control_flow.
|
|
144
|
+
require_control_flow.Ht(branch, newValue);
|
|
142
145
|
},
|
|
143
146
|
update(newInput = {}) {
|
|
144
|
-
args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.
|
|
147
|
+
args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.in(require_control_flow.en(() => {
|
|
145
148
|
args(branch, newInput);
|
|
146
149
|
})));
|
|
147
150
|
},
|
|
148
151
|
destroy() {
|
|
149
|
-
require_control_flow.
|
|
152
|
+
require_control_flow.Kt(branch);
|
|
150
153
|
}
|
|
151
154
|
};
|
|
152
155
|
}
|
|
@@ -154,20 +157,20 @@ function mount(input = {}, reference, position) {
|
|
|
154
157
|
//#region src/dom/load.ts
|
|
155
158
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
156
159
|
let parent = marker.parentNode, values = branch.X, insert = () => {
|
|
157
|
-
require_control_flow.
|
|
160
|
+
require_control_flow.Gt(branch, parent, marker), marker.remove(), awaitCounter?.c();
|
|
158
161
|
}, remaining;
|
|
159
|
-
if (require_control_flow.
|
|
162
|
+
if (require_control_flow.qt(branch), renderer.b(branch, parent.namespaceURI), branch.X = 0, remaining = values?.size) {
|
|
160
163
|
let fail = loadFailed(branch, awaitCounter);
|
|
161
164
|
for (let [promise, entry] of values) promise.then((signal) => {
|
|
162
|
-
entry.b = signal, --remaining || require_control_flow.
|
|
163
|
-
require_control_flow.
|
|
165
|
+
entry.b = signal, --remaining || require_control_flow.tn(branch, (branch) => {
|
|
166
|
+
require_control_flow.qt(branch), renderer.c?.(branch), values.forEach((e) => e.b._(branch, e.a)), insert();
|
|
164
167
|
});
|
|
165
168
|
}, (error) => remaining > 0 && (remaining = 0, fail(error)));
|
|
166
169
|
} else require_control_flow.mt(renderer, branch), insert();
|
|
167
170
|
}
|
|
168
171
|
function loadFailed(scope, awaitCounter) {
|
|
169
172
|
return (error) => {
|
|
170
|
-
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.c()), require_control_flow.
|
|
173
|
+
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.c()), require_control_flow.tn(scope, require_control_flow.g, error);
|
|
171
174
|
};
|
|
172
175
|
}
|
|
173
176
|
function _load_visible_trigger(selector, options) {
|
|
@@ -193,9 +196,9 @@ function _load_race_trigger(...triggers) {
|
|
|
193
196
|
function getSelectorOrResolve(selector, resolve) {
|
|
194
197
|
return document.querySelector(selector) || resolve();
|
|
195
198
|
}
|
|
196
|
-
exports.$signal = require_control_flow.
|
|
199
|
+
exports.$signal = require_control_flow.Yt, exports.$signalReset = require_control_flow.Xt, exports._assert_hoist = require_control_flow.un, exports._assert_init = require_control_flow.Ut, 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.fn, exports._child_setup = require_control_flow.wt, exports._closure = require_control_flow.Tt, exports._closure_get = require_control_flow.Et, exports._const = require_control_flow.Dt, 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", {
|
|
197
200
|
enumerable: !0,
|
|
198
201
|
get: function() {
|
|
199
202
|
return require_control_flow.r;
|
|
200
203
|
}
|
|
201
|
-
}), exports._dynamic_tag_content = require_control_flow.i, exports._el = require_control_flow.ht, exports._el_read = require_control_flow.
|
|
204
|
+
}), exports._dynamic_tag_content = require_control_flow.i, exports._el = require_control_flow.ht, exports._el_read = require_control_flow.Ot, exports._for_closure = require_control_flow.kt, exports._for_in = require_control_flow.a, exports._for_of = require_control_flow.o, exports._for_selector = require_control_flow.At, exports._for_to = require_control_flow.s, exports._for_until = require_control_flow.c, exports._hoist = require_control_flow.jt, exports._hoist_read_error = require_control_flow.dn, exports._hoist_resume = require_control_flow.Mt, exports._html = require_control_flow.et, exports._id = require_control_flow.Nt, exports._if = require_control_flow.l, exports._if_closure = require_control_flow.Pt, exports._let = require_control_flow.Ft, exports._let_change = require_control_flow.It, 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.Jt, exports._or = require_control_flow.Lt, exports._resume = require_control_flow.gt, exports._resume_dynamic_tag = require_control_flow.u, exports._return = require_control_flow.Rt, exports._return_change = require_control_flow.zt, exports._script = require_control_flow.Bt, 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.Vt, exports._var_change = require_control_flow.Ht, exports._var_resume = require_control_flow._t, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = require_control_flow.on, exports.forOf = require_control_flow.sn, exports.forTo = require_control_flow.cn, exports.forUntil = require_control_flow.ln, exports.init = require_control_flow.yt, exports.initEmbedded = require_control_flow.bt, exports.ready = require_control_flow.xt, exports.run = require_control_flow.rn;
|
package/dist/dom.mjs
CHANGED
|
@@ -16,6 +16,9 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
|
|
|
16
16
|
setClassEventResolver(fn) {
|
|
17
17
|
classEventResolver = fn;
|
|
18
18
|
},
|
|
19
|
+
resumeClassFunction(id, build) {
|
|
20
|
+
_resume(id, build);
|
|
21
|
+
},
|
|
19
22
|
getScope($global, scopeId) {
|
|
20
23
|
return getRenderScopes($global)?.[scopeId];
|
|
21
24
|
},
|
|
@@ -91,7 +94,7 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
|
|
|
91
94
|
pending ||= load(), scope.X || !("X" in scope) && scope.H === runId ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, { a: value }) : signal ? signal(scope, value) : pending.then((mod) => queueAsyncRender(scope, signal = mod._, value), () => 0);
|
|
92
95
|
};
|
|
93
96
|
});
|
|
94
|
-
import { $ as _attrs_script,
|
|
97
|
+
import { $ as _attrs_script, A as _attr_input_value_script, At as _for_selector, B as _attr, Bt as _script, C as _attr_input_checkedValue_script, Ct as withLazy, D as _attr_input_value_attribute_default, Dt as _const, E as _attr_input_value, Et as _closure_get, F as _controllable_open, Ft as _let, G as _attr_nonce, Gt as insertBranchBefore, H as _attr_class_item, Ht as _var_change, I as _controllable_select, It as _let_change, J as _attr_style_items, Jt as _on, K as _attr_style, Kt as removeAndDestroyBranch, L as _controllable_textarea, Lt as _or, M as _attr_select_value_default, Mt as _hoist_resume, N as _attr_select_value_script, Nt as _id, O as _attr_input_value_default, Ot as _el_read, P as _controllable_input, Pt as _if_closure, Q as _attrs_partial_content, Rt as _return, S as _attr_input_checkedValue_default, T as _attr_input_checked_script, Tt as _closure, U as _attr_class_items, Ut as _assert_init, V as _attr_class, Vt as _var, W as _attr_content, Wt as destroyBranch, X as _attrs_content, Xt as $signalReset, Y as _attrs, Yt as $signal, Z as _attrs_partial, _ as _attr_details_or_dialog_open, _t as _var_resume, a as _for_in, an as runId, at as _text_content, b as _attr_input_checked, bt as initEmbedded, c as _for_until, cn as forTo, ct as toInsertNode, d as _show, dn as _hoist_read_error, dt as _content_resume, en as prepareEffects, et as _html, f as _try, fn as _call, ft as createAndSetupBranch, g as renderCatch, gt as _resume, h as patchDynamicTag, ht as _el, i as _dynamic_tag_content, in as runEffects, it as _text, j as _attr_select_value, jt as _hoist, k as _attr_input_value_dynamic_default, kt as _for_closure, l as _if, ln as forUntil, lt as _content, mt as setupBranch, n as _await_promise, nn as queueEffect, nt as _style_rule_item, o as _for_of, on as forIn, ot as _to_text, p as addAwaitCounter, pn as decodeAccessor, pt as createBranch, q as _attr_style_item, qt as syncGen, r as _dynamic_tag, rn as run, rt as _style_shell, s as _for_to, sn as forOf, st as insertChildNodes, t as _await_content, tn as queueAsyncRender, tt as _lifecycle, u as _resume_dynamic_tag, un as _assert_hoist, ut as _content_closures, v as _attr_details_or_dialog_open_default, vt as getRegisteredWithScope, w as _attr_input_checked_default, wt as _child_setup, x as _attr_input_checkedValue, xt as ready, y as _attr_details_or_dialog_open_script, yt as init, zt as _return_change } from "./dom-BVNolGe1.mjs";
|
|
95
98
|
//#region src/common/attr-tag.ts
|
|
96
99
|
function attrTag(attrs) {
|
|
97
100
|
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
|
@@ -194,4 +197,4 @@ function getSelectorOrResolve(selector, resolve) {
|
|
|
194
197
|
return document.querySelector(selector) || resolve();
|
|
195
198
|
}
|
|
196
199
|
//#endregion
|
|
197
|
-
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_attribute_default, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_dynamic_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, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _for_closure, _for_in, _for_of, _for_selector, _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, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, run };
|
|
200
|
+
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_attribute_default, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_dynamic_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, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _for_closure, _for_in, _for_of, _for_selector, _for_to, _for_until, _hoist, _hoist_read_error, _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, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, run };
|
package/dist/html/compat.d.ts
CHANGED
|
@@ -23,4 +23,6 @@ export declare const compat: {
|
|
|
23
23
|
register: typeof register;
|
|
24
24
|
registerRenderBody(fn: any): void;
|
|
25
25
|
registerClassFunctions(input: any): void;
|
|
26
|
+
registerClassFunction<T extends WeakKey>($global: object, id: string, fn: T, hostId: string): T;
|
|
27
|
+
hasPendingClassFunctions($global: object): boolean;
|
|
26
28
|
};
|
package/dist/html/writer.d.ts
CHANGED
package/dist/html.js
CHANGED
|
@@ -347,7 +347,13 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
347
347
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
348
348
|
}
|
|
349
349
|
head.render(() => {
|
|
350
|
-
if (
|
|
350
|
+
if (this.hasPendingClassFunctions(classAPIOut.global) && drainClassFunctions(classAPIOut.global, (hostId) => {
|
|
351
|
+
let fnScopeId = _scope_id(), scope = writeScope(fnScopeId, {
|
|
352
|
+
m5c: component.id,
|
|
353
|
+
m5h: hostId
|
|
354
|
+
});
|
|
355
|
+
return _script(fnScopeId, SET_SCOPE_REGISTER_ID), scope;
|
|
356
|
+
}), willRerender || registerChildScope) {
|
|
351
357
|
let scopeId = _peek_scope_id();
|
|
352
358
|
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
353
359
|
}
|
|
@@ -377,8 +383,19 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
377
383
|
let value = input[key];
|
|
378
384
|
typeof value == "function" && !getRegistered(value) && register(RENDER_BODY_ID, value);
|
|
379
385
|
}
|
|
386
|
+
},
|
|
387
|
+
registerClassFunction($global, id, fn, hostId) {
|
|
388
|
+
let pending = pendingClassFunctions.get($global);
|
|
389
|
+
return pending || pendingClassFunctions.set($global, pending = []), pending.push([
|
|
390
|
+
id,
|
|
391
|
+
fn,
|
|
392
|
+
hostId
|
|
393
|
+
]), fn;
|
|
394
|
+
},
|
|
395
|
+
hasPendingClassFunctions($global) {
|
|
396
|
+
return !!pendingClassFunctions.get($global)?.length;
|
|
380
397
|
}
|
|
381
|
-
};
|
|
398
|
+
}, pendingClassFunctions = /* @__PURE__ */ new WeakMap();
|
|
382
399
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
383
400
|
//#region src/common/attr-tag.ts
|
|
384
401
|
function attrTag(attrs) {
|
|
@@ -1499,16 +1516,14 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
1499
1516
|
});
|
|
1500
1517
|
}
|
|
1501
1518
|
function _try(scopeId, accessor, content, input) {
|
|
1502
|
-
let branchId = _peek_scope_id();
|
|
1503
|
-
$chunk.writeHTML($chunk.boundary.state.mark("[", ""))
|
|
1504
|
-
let catchContent = input.catch ? normalizeDynamicRenderer(input.catch) || 0 : void 0, placeholderContent = normalizeDynamicRenderer(input.placeholder);
|
|
1505
|
-
catchContent === void 0 ? placeholderContent ? tryPlaceholder(content, placeholderContent, branchId) : content() : tryCatch(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId) : content, catchContent || (() => {})), writeScope(branchId, {
|
|
1519
|
+
let catchContent = input.catch ? normalizeDynamicRenderer(input.catch) || 0 : void 0, placeholderContent = normalizeDynamicRenderer(input.placeholder), placeholderBranchId = placeholderContent ? _scope_id() : 0, branchId = _peek_scope_id();
|
|
1520
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), catchContent === void 0 ? placeholderContent ? tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId) : content() : tryCatch(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId) : content, catchContent || (() => {})), writeScope(branchId, {
|
|
1506
1521
|
C: accessor,
|
|
1507
1522
|
E: catchContent,
|
|
1508
1523
|
Q: placeholderContent
|
|
1509
1524
|
}), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1510
1525
|
}
|
|
1511
|
-
function tryPlaceholder(content, placeholder, branchId) {
|
|
1526
|
+
function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBranchId) {
|
|
1512
1527
|
let chunk = $chunk, { boundary } = chunk, body = chunk.fork(boundary, null);
|
|
1513
1528
|
if (body === body.render(content)) {
|
|
1514
1529
|
chunk.append(body);
|
|
@@ -1517,7 +1532,9 @@ function tryPlaceholder(content, placeholder, branchId) {
|
|
|
1517
1532
|
chunk.next = $chunk = chunk.fork(boundary, chunk.next), chunk.placeholder = {
|
|
1518
1533
|
body,
|
|
1519
1534
|
render: placeholder,
|
|
1520
|
-
branchId
|
|
1535
|
+
branchId,
|
|
1536
|
+
scopeId,
|
|
1537
|
+
placeholderBranchId
|
|
1521
1538
|
};
|
|
1522
1539
|
}
|
|
1523
1540
|
function tryCatch(content, catchContent) {
|
|
@@ -1666,10 +1683,10 @@ var State = class {
|
|
|
1666
1683
|
if (placeholder) {
|
|
1667
1684
|
let body = placeholder.body.consume();
|
|
1668
1685
|
if (body.async) {
|
|
1669
|
-
let { state } = this.boundary, reorderId = body.reorderId =
|
|
1686
|
+
let { state } = this.boundary, { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId ? branchId + "" : state.nextReorderId();
|
|
1670
1687
|
this.writeHTML(state.mark("!^", reorderId));
|
|
1671
|
-
let after = this.render(placeholder.render);
|
|
1672
|
-
after
|
|
1688
|
+
let { effects } = this, beforeBranch = deferBranchStart(this), after = this.render(() => withBranchId(placeholderBranchId, placeholder.render)), stateful = after === this && this.effects !== effects;
|
|
1689
|
+
applyBranchStart(this, beforeBranch, stateful), after === this ? stateful && (this.render(() => writeScope(branchId, { P: scopeWithId(state, placeholderBranchId) })), this.writeHTML(state.mark("]", scopeId + " " + ("P" + branchId) + " " + placeholderBranchId)), body.writeEffect(branchId, "f")) : this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), this.writeHTML(state.mark("!", reorderId)), state.reorder(body);
|
|
1673
1690
|
} else body.next = this.next, this.next = body;
|
|
1674
1691
|
this.placeholder = null;
|
|
1675
1692
|
}
|
|
@@ -1720,7 +1737,7 @@ var State = class {
|
|
|
1720
1737
|
}
|
|
1721
1738
|
readyResumeScripts && (needsWalk = !0);
|
|
1722
1739
|
let effects = this.async ? "" : this.effects, { html, scripts } = this;
|
|
1723
|
-
if (state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\""), state.
|
|
1740
|
+
if (state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\""), state.writeReorders) {
|
|
1724
1741
|
let carried = null;
|
|
1725
1742
|
for (let reorderedChunk of state.writeReorders) {
|
|
1726
1743
|
if (reorderedChunk.async && reorderedChunk.consumed) {
|
|
@@ -1746,7 +1763,7 @@ var State = class {
|
|
|
1746
1763
|
}
|
|
1747
1764
|
state.writeReorders = carried;
|
|
1748
1765
|
}
|
|
1749
|
-
return needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
|
|
1766
|
+
return flushSerializer(boundary, state), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")") : (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]"))), needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
|
|
1750
1767
|
}
|
|
1751
1768
|
flushHTML() {
|
|
1752
1769
|
let { boundary } = this, { state } = boundary;
|
|
@@ -2232,6 +2249,11 @@ function toObjectExpression(options) {
|
|
|
2232
2249
|
//#region src/common/compat-meta.ts
|
|
2233
2250
|
//#endregion
|
|
2234
2251
|
//#region src/html/compat.ts
|
|
2252
|
+
function drainClassFunctions($global, writeScope) {
|
|
2253
|
+
let pending = pendingClassFunctions.get($global), scopeByHost = {};
|
|
2254
|
+
for (let [id, fn, hostId] of pending) register(id, fn, scopeByHost[hostId] ||= writeScope(hostId));
|
|
2255
|
+
pending.length = 0;
|
|
2256
|
+
}
|
|
2235
2257
|
function NOOP() {}
|
|
2236
2258
|
exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr = _attr, exports._attr_and = _attr_and, exports._attr_class = _attr_class, exports._attr_content = _attr_content, exports._attr_details_open = _attr_details_or_dialog_open, exports._attr_dialog_open = _attr_details_or_dialog_open, exports._attr_input_checked = _attr_input_checked, exports._attr_input_checkedValue = _attr_input_checkedValue, exports._attr_input_value = _attr_input_value, exports._attr_nonce = _attr_nonce, exports._attr_nullish = _attr_nullish, exports._attr_option_value = _attr_option_value, exports._attr_or = _attr_or, exports._attr_select_value = _attr_select_value, exports._attr_style = _attr_style, exports._attr_textarea_value = _attr_textarea_value, exports._attrs = _attrs, exports._attrs_content = _attrs_content, exports._attrs_partial = _attrs_partial, exports._attrs_partial_content = _attrs_partial_content, exports._await = _await, exports._content = _content, exports._content_resume = _content_resume, Object.defineProperty(exports, "_dynamic_tag", {
|
|
2237
2259
|
enumerable: !0,
|
package/dist/html.mjs
CHANGED
|
@@ -347,7 +347,13 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
347
347
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
348
348
|
}
|
|
349
349
|
head.render(() => {
|
|
350
|
-
if (
|
|
350
|
+
if (this.hasPendingClassFunctions(classAPIOut.global) && drainClassFunctions(classAPIOut.global, (hostId) => {
|
|
351
|
+
let fnScopeId = _scope_id(), scope = writeScope(fnScopeId, {
|
|
352
|
+
m5c: component.id,
|
|
353
|
+
m5h: hostId
|
|
354
|
+
});
|
|
355
|
+
return _script(fnScopeId, SET_SCOPE_REGISTER_ID), scope;
|
|
356
|
+
}), willRerender || registerChildScope) {
|
|
351
357
|
let scopeId = _peek_scope_id();
|
|
352
358
|
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
353
359
|
}
|
|
@@ -377,8 +383,19 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
377
383
|
let value = input[key];
|
|
378
384
|
typeof value == "function" && !getRegistered(value) && register(RENDER_BODY_ID, value);
|
|
379
385
|
}
|
|
386
|
+
},
|
|
387
|
+
registerClassFunction($global, id, fn, hostId) {
|
|
388
|
+
let pending = pendingClassFunctions.get($global);
|
|
389
|
+
return pending || pendingClassFunctions.set($global, pending = []), pending.push([
|
|
390
|
+
id,
|
|
391
|
+
fn,
|
|
392
|
+
hostId
|
|
393
|
+
]), fn;
|
|
394
|
+
},
|
|
395
|
+
hasPendingClassFunctions($global) {
|
|
396
|
+
return !!pendingClassFunctions.get($global)?.length;
|
|
380
397
|
}
|
|
381
|
-
};
|
|
398
|
+
}, pendingClassFunctions = /* @__PURE__ */ new WeakMap();
|
|
382
399
|
//#region src/common/attr-tag.ts
|
|
383
400
|
function attrTag(attrs) {
|
|
384
401
|
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
|
@@ -1498,16 +1515,14 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
1498
1515
|
});
|
|
1499
1516
|
}
|
|
1500
1517
|
function _try(scopeId, accessor, content, input) {
|
|
1501
|
-
let branchId = _peek_scope_id();
|
|
1502
|
-
$chunk.writeHTML($chunk.boundary.state.mark("[", ""))
|
|
1503
|
-
let catchContent = input.catch ? normalizeDynamicRenderer(input.catch) || 0 : void 0, placeholderContent = normalizeDynamicRenderer(input.placeholder);
|
|
1504
|
-
catchContent === void 0 ? placeholderContent ? tryPlaceholder(content, placeholderContent, branchId) : content() : tryCatch(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId) : content, catchContent || (() => {})), writeScope(branchId, {
|
|
1518
|
+
let catchContent = input.catch ? normalizeDynamicRenderer(input.catch) || 0 : void 0, placeholderContent = normalizeDynamicRenderer(input.placeholder), placeholderBranchId = placeholderContent ? _scope_id() : 0, branchId = _peek_scope_id();
|
|
1519
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), catchContent === void 0 ? placeholderContent ? tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId) : content() : tryCatch(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId) : content, catchContent || (() => {})), writeScope(branchId, {
|
|
1505
1520
|
C: accessor,
|
|
1506
1521
|
E: catchContent,
|
|
1507
1522
|
Q: placeholderContent
|
|
1508
1523
|
}), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1509
1524
|
}
|
|
1510
|
-
function tryPlaceholder(content, placeholder, branchId) {
|
|
1525
|
+
function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBranchId) {
|
|
1511
1526
|
let chunk = $chunk, { boundary } = chunk, body = chunk.fork(boundary, null);
|
|
1512
1527
|
if (body === body.render(content)) {
|
|
1513
1528
|
chunk.append(body);
|
|
@@ -1516,7 +1531,9 @@ function tryPlaceholder(content, placeholder, branchId) {
|
|
|
1516
1531
|
chunk.next = $chunk = chunk.fork(boundary, chunk.next), chunk.placeholder = {
|
|
1517
1532
|
body,
|
|
1518
1533
|
render: placeholder,
|
|
1519
|
-
branchId
|
|
1534
|
+
branchId,
|
|
1535
|
+
scopeId,
|
|
1536
|
+
placeholderBranchId
|
|
1520
1537
|
};
|
|
1521
1538
|
}
|
|
1522
1539
|
function tryCatch(content, catchContent) {
|
|
@@ -1665,10 +1682,10 @@ var State = class {
|
|
|
1665
1682
|
if (placeholder) {
|
|
1666
1683
|
let body = placeholder.body.consume();
|
|
1667
1684
|
if (body.async) {
|
|
1668
|
-
let { state } = this.boundary, reorderId = body.reorderId =
|
|
1685
|
+
let { state } = this.boundary, { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId ? branchId + "" : state.nextReorderId();
|
|
1669
1686
|
this.writeHTML(state.mark("!^", reorderId));
|
|
1670
|
-
let after = this.render(placeholder.render);
|
|
1671
|
-
after
|
|
1687
|
+
let { effects } = this, beforeBranch = deferBranchStart(this), after = this.render(() => withBranchId(placeholderBranchId, placeholder.render)), stateful = after === this && this.effects !== effects;
|
|
1688
|
+
applyBranchStart(this, beforeBranch, stateful), after === this ? stateful && (this.render(() => writeScope(branchId, { P: scopeWithId(state, placeholderBranchId) })), this.writeHTML(state.mark("]", scopeId + " " + ("P" + branchId) + " " + placeholderBranchId)), body.writeEffect(branchId, "f")) : this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), this.writeHTML(state.mark("!", reorderId)), state.reorder(body);
|
|
1672
1689
|
} else body.next = this.next, this.next = body;
|
|
1673
1690
|
this.placeholder = null;
|
|
1674
1691
|
}
|
|
@@ -1719,7 +1736,7 @@ var State = class {
|
|
|
1719
1736
|
}
|
|
1720
1737
|
readyResumeScripts && (needsWalk = !0);
|
|
1721
1738
|
let effects = this.async ? "" : this.effects, { html, scripts } = this;
|
|
1722
|
-
if (state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\""), state.
|
|
1739
|
+
if (state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\""), state.writeReorders) {
|
|
1723
1740
|
let carried = null;
|
|
1724
1741
|
for (let reorderedChunk of state.writeReorders) {
|
|
1725
1742
|
if (reorderedChunk.async && reorderedChunk.consumed) {
|
|
@@ -1745,7 +1762,7 @@ var State = class {
|
|
|
1745
1762
|
}
|
|
1746
1763
|
state.writeReorders = carried;
|
|
1747
1764
|
}
|
|
1748
|
-
return needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
|
|
1765
|
+
return flushSerializer(boundary, state), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")") : (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]"))), needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
|
|
1749
1766
|
}
|
|
1750
1767
|
flushHTML() {
|
|
1751
1768
|
let { boundary } = this, { state } = boundary;
|
|
@@ -2231,6 +2248,11 @@ function toObjectExpression(options) {
|
|
|
2231
2248
|
//#region src/common/compat-meta.ts
|
|
2232
2249
|
//#endregion
|
|
2233
2250
|
//#region src/html/compat.ts
|
|
2251
|
+
function drainClassFunctions($global, writeScope) {
|
|
2252
|
+
let pending = pendingClassFunctions.get($global), scopeByHost = {};
|
|
2253
|
+
for (let [id, fn, hostId] of pending) register(id, fn, scopeByHost[hostId] ||= writeScope(hostId));
|
|
2254
|
+
pending.length = 0;
|
|
2255
|
+
}
|
|
2234
2256
|
function NOOP() {}
|
|
2235
2257
|
//#endregion
|
|
2236
2258
|
export { $global, _assert_hoist, _attr, _attr_and, _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_nullish, _attr_option_value, _attr_or, _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, _escape_style_value, _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, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _style_html, _subscribe, _template, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };
|
package/dist/translator/index.js
CHANGED
|
@@ -4173,6 +4173,7 @@ var html_default = { translate: {
|
|
|
4173
4173
|
});
|
|
4174
4174
|
},
|
|
4175
4175
|
exit(program) {
|
|
4176
|
+
if (program.node.extra.hasGlobalRead) getHTMLSectionStatements(getSection(program)).push(_marko_compiler.types.variableDeclaration("const", [_marko_compiler.types.variableDeclarator(_marko_compiler.types.identifier("$global"), callRuntime("$global"))]));
|
|
4176
4177
|
flushInto(program);
|
|
4177
4178
|
writeHTMLResumeStatements(program);
|
|
4178
4179
|
traverseReplace(program.node, "body", replaceNode);
|
|
@@ -7292,6 +7293,7 @@ function setReferencesScope(path) {
|
|
|
7292
7293
|
}
|
|
7293
7294
|
const [getGlobalBinding] = createProgramState(() => createBinding("$global", 7, getOrCreateSection((0, _marko_compiler_babel_utils.getProgram)())));
|
|
7294
7295
|
function trackGlobalReference(path) {
|
|
7296
|
+
(0, _marko_compiler_babel_utils.getProgram)().node.extra.hasGlobalRead = true;
|
|
7295
7297
|
trackReference(path, getGlobalBinding());
|
|
7296
7298
|
}
|
|
7297
7299
|
function createBindingsAndTrackReferences(lVal, type, scope, section, upstreamAlias, property, excludeProperties, restOffset) {
|
|
@@ -7998,13 +8000,13 @@ function getReadReplacement(node, signal) {
|
|
|
7998
8000
|
const inlined = getSignals(extra.section).get(readBinding)?.inline?.value;
|
|
7999
8001
|
if (inlined) replacement = _marko_compiler.types.cloneNode(inlined, true);
|
|
8000
8002
|
else if (signal?.referencedBindings === readBinding && !signal.hasSideEffect) replacement = getSignalValueIdentifier(signal);
|
|
8001
|
-
else if (read.getter?.hoisted) replacement = _marko_compiler.types.callExpression(getBindingGetterIdentifier(readBinding, read.getter.hoisted), [getScopeExpression(extra.section, read.getter.hoisted)]);
|
|
8003
|
+
else if (read.getter?.hoisted) replacement = readBinding.upstreamAlias ? callRuntime("_hoist_read_error") : _marko_compiler.types.callExpression(getBindingGetterIdentifier(readBinding, read.getter.hoisted), [getScopeExpression(extra.section, read.getter.hoisted)]);
|
|
8002
8004
|
else if (readBinding.type === 0) {
|
|
8003
8005
|
if (read.getter) replacement = _marko_compiler.types.callExpression(getBindingGetterIdentifier(readBinding, readBinding.section), [getScopeExpression(extra.section, readBinding.section)]);
|
|
8004
8006
|
} else if (!isOptimize() && read.ownVar) replacement = callRuntime("_assert_init", extra.section ? getScopeExpression(extra.section, readBinding.section) : scopeIdentifier, getScopeAccessorLiteral(readBinding));
|
|
8005
8007
|
else replacement = createScopeReadExpression(readBinding, extra.section);
|
|
8006
8008
|
} else if (node.type !== "Identifier") replacement = _marko_compiler.types.identifier(readBinding.name);
|
|
8007
|
-
else if (read.getter?.hoisted) replacement = getBindingGetterIdentifier(readBinding, read.getter.hoisted);
|
|
8009
|
+
else if (read.getter?.hoisted) replacement = readBinding.upstreamAlias ? callRuntime("_hoist_read_error") : getBindingGetterIdentifier(readBinding, read.getter.hoisted);
|
|
8008
8010
|
else if (readBinding.type === 0) {
|
|
8009
8011
|
if (readBinding.getters.has(readBinding.section)) replacement = getBindingGetterIdentifier(readBinding, readBinding.section);
|
|
8010
8012
|
} else if (readBinding.name !== node.name) node.name = readBinding.name;
|
|
@@ -9638,8 +9640,10 @@ var try_default = {
|
|
|
9638
9640
|
const section = getSection(tag);
|
|
9639
9641
|
const bodySection = getSectionForBody(tag.get("body"));
|
|
9640
9642
|
const signal = getSignal(section, nodeRef, "try");
|
|
9643
|
+
const hasPlaceholder = !!tag.node.extra?.attributeTags?.["@placeholder"];
|
|
9641
9644
|
signal.build = () => {
|
|
9642
9645
|
importRuntimeFeature("catch");
|
|
9646
|
+
if (hasPlaceholder) importRuntimeFeature("placeholder");
|
|
9643
9647
|
return callRuntime("_try", getScopeAccessorLiteral(nodeRef, true), ...replaceNullishAndEmptyFunctionsWith0(getBranchRendererArgs(bodySection)));
|
|
9644
9648
|
};
|
|
9645
9649
|
if (translatedAttrs.statements.length) addStatement("render", section, referencedBindings, translatedAttrs.statements);
|
|
@@ -10096,8 +10100,7 @@ var referenced_identifier_default = {
|
|
|
10096
10100
|
if (identifier.scope.hasBinding(name)) return;
|
|
10097
10101
|
switch (name) {
|
|
10098
10102
|
case "$global":
|
|
10099
|
-
if (isOutputHTML()) identifier.replaceWith(_marko_compiler.types.
|
|
10100
|
-
else identifier.replaceWith(_marko_compiler.types.memberExpression(scopeIdentifier, _marko_compiler.types.identifier(getAccessorProp().Global)));
|
|
10103
|
+
if (!isOutputHTML()) identifier.replaceWith(_marko_compiler.types.memberExpression(scopeIdentifier, _marko_compiler.types.identifier(getAccessorProp().Global)));
|
|
10101
10104
|
break;
|
|
10102
10105
|
case "$signal": if (isOutputHTML()) identifier.replaceWith(_marko_compiler.types.callExpression(_marko_compiler.types.arrowFunctionExpression([], _marko_compiler.types.blockStatement([_marko_compiler.types.throwStatement(_marko_compiler.types.newExpression(_marko_compiler.types.identifier("Error"), [_marko_compiler.types.stringLiteral("Cannot use $signal in a server render.")]))])), []));
|
|
10103
10106
|
else {
|
|
@@ -82,6 +82,10 @@ interface ExtraRead {
|
|
|
82
82
|
localFn?: ReferencedFunctionExtra;
|
|
83
83
|
}
|
|
84
84
|
declare module "@marko/compiler/dist/types" {
|
|
85
|
+
interface ProgramExtra {
|
|
86
|
+
/** This template reads `$global`, so HTML output declares a const for it. */
|
|
87
|
+
hasGlobalRead?: true;
|
|
88
|
+
}
|
|
85
89
|
interface NodeExtra {
|
|
86
90
|
section?: Section;
|
|
87
91
|
referencedBindings?: ReferencedBindings;
|
|
@@ -5,7 +5,7 @@ export type DOMRuntimeHelpers = keyof typeof import("../../dom");
|
|
|
5
5
|
export type HTMLRuntimeHelpers = keyof typeof import("../../html");
|
|
6
6
|
export declare function importRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers): t.Identifier;
|
|
7
7
|
export declare function callRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers, ...args: Array<Parameters<typeof t.callExpression>[1][number] | Falsy>): t.CallExpression;
|
|
8
|
-
export type DOMRuntimeFeature = "catch" | "controllable" | "controllable-input" | "controllable-open" | "controllable-select" | "controllable-textarea" | "dynamic-tag-var";
|
|
8
|
+
export type DOMRuntimeFeature = "catch" | "controllable" | "controllable-input" | "controllable-open" | "controllable-select" | "controllable-textarea" | "dynamic-tag-var" | "placeholder";
|
|
9
9
|
export declare function importRuntimeFeature(feature: DOMRuntimeFeature): void;
|
|
10
10
|
export declare function getHTMLRuntime(): {
|
|
11
11
|
_escape: typeof _escape;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.41",
|
|
4
4
|
"description": "Optimized runtime for Marko templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"magic-string": "^0.30.21"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"marko": "
|
|
58
|
-
"
|
|
57
|
+
"@marko/runtime-tags": "npm:marko@6.3.41",
|
|
58
|
+
"marko": "5.39.35"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=22"
|
|
@@ -64,6 +64,9 @@
|
|
|
64
64
|
".": {
|
|
65
65
|
"types": "./index.d.ts"
|
|
66
66
|
},
|
|
67
|
+
"./tags-html": {
|
|
68
|
+
"types": "./tags-html.d.ts"
|
|
69
|
+
},
|
|
67
70
|
"./cheatsheet.md": "./cheatsheet.md",
|
|
68
71
|
"./package.json": "./package.json",
|
|
69
72
|
"./translator": "./src/translator/index.ts",
|