marko 6.4.6 → 6.4.7
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/cheatsheet.md +2 -1
- package/dist/common/errors.d.ts +1 -0
- package/dist/debug/dom/catch.feat.js +2 -2
- package/dist/debug/dom/catch.feat.mjs +2 -2
- 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-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +2 -2
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -2
- package/dist/debug/dom/lazy.feat.js +1 -1
- package/dist/debug/dom/lazy.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-o9jQjchF.mjs → dom-CFCBDift.mjs} +97 -99
- package/dist/debug/{dom-CNgQ6lj9.js → dom-D8znnhpf.js} +102 -104
- package/dist/debug/dom.js +18 -19
- package/dist/debug/dom.mjs +19 -19
- package/dist/debug/html.js +15 -12
- package/dist/debug/html.mjs +15 -13
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +2 -2
- package/dist/dom/control-flow.d.ts +1 -1
- 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-script.feat.js +2 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +3 -3
- package/dist/dom/dynamic-tag-var.feat.mjs +2 -2
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +2 -2
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/renderer.d.ts +1 -3
- package/dist/dom/resume.d.ts +2 -3
- package/dist/dom/signals.d.ts +2 -7
- package/dist/{dom-60R4bRWD.js → dom-Bpkm72vV.js} +123 -132
- package/dist/{dom-Ci2W4l1P.mjs → dom-CVAevsbz.mjs} +77 -81
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +33 -33
- package/dist/dom.mjs +19 -19
- package/dist/html/assets.d.ts +1 -1
- package/dist/html/control-flow.d.ts +1 -1
- package/dist/html/inlined-runtimes.d.ts +2 -2
- package/dist/html/inlined-runtimes.debug.d.ts +2 -2
- package/dist/html/template.d.ts +1 -1
- package/dist/html.d.ts +1 -1
- package/dist/html.js +16 -19
- package/dist/html.mjs +16 -19
- package/dist/translator/index.js +6946 -6830
- package/dist/translator/util/assert.d.ts +7 -0
- package/dist/translator/util/bindings.d.ts +11 -3
- package/dist/translator/util/cyclic-memo.d.ts +6 -2
- package/dist/translator/util/entry-builder.d.ts +0 -1
- package/dist/translator/util/finalize-references.d.ts +4 -2
- package/dist/translator/util/for-selector.d.ts +1 -1
- package/dist/translator/util/generate-uid.d.ts +1 -0
- package/dist/translator/util/known-tag.d.ts +4 -1
- package/dist/translator/util/optional.d.ts +1 -1
- package/dist/translator/util/reasons.d.ts +4 -1
- package/dist/translator/util/references.d.ts +2 -0
- package/dist/translator/util/sections.d.ts +5 -5
- package/dist/translator/util/signals.d.ts +3 -3
- package/dist/translator/util/slots.d.ts +2 -2
- package/dist/translator/util/state.d.ts +4 -2
- package/dist/translator/visitors/import-declaration.d.ts +2 -0
- package/dist/translator/visitors/program/pre-analyze.d.ts +2 -0
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +1 -0
- package/package.json +4 -4
package/dist/dom.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
let require_control_flow = require("./dom-
|
|
2
|
+
let require_control_flow = require("./dom-Bpkm72vV.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
|
|
3
3
|
require_control_flow.Et($global.runtimeId);
|
|
4
4
|
let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
|
|
5
5
|
return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
|
|
6
6
|
}, compat = {
|
|
7
7
|
patchDynamicTag: require_control_flow._,
|
|
8
|
-
queueEffect: require_control_flow.
|
|
8
|
+
queueEffect: require_control_flow.ln,
|
|
9
9
|
init(warp10Noop) {
|
|
10
10
|
require_control_flow.Ct.$C_s = (scope) => {
|
|
11
11
|
if (getRenderScopes(scope.$)[scope.L] = scope, scope.m5c && classIdToBranch.set(scope.m5c, scope), classEventResolver) for (let key in scope) {
|
|
@@ -39,10 +39,10 @@ let require_control_flow = require("./dom-60R4bRWD.js"), empty = [], rest = Symb
|
|
|
39
39
|
branch.S = startNode, branch.K = endNode;
|
|
40
40
|
},
|
|
41
41
|
runComponentEffects() {
|
|
42
|
-
this.effects && require_control_flow.
|
|
42
|
+
this.effects && require_control_flow.pn(this.effects);
|
|
43
43
|
},
|
|
44
44
|
runComponentDestroy() {
|
|
45
|
-
this.scope && require_control_flow.
|
|
45
|
+
this.scope && require_control_flow.Zt(this.scope);
|
|
46
46
|
},
|
|
47
47
|
resolveRegistered(value, $global) {
|
|
48
48
|
return Array.isArray(value) && typeof value[0] == "string" ? require_control_flow.Tt(value[0], getRenderScopes($global)?.[value[1]]) : value;
|
|
@@ -61,10 +61,10 @@ let require_control_flow = require("./dom-60R4bRWD.js"), empty = [], rest = Symb
|
|
|
61
61
|
let input = args[0], normalizedInput = args[0] = {};
|
|
62
62
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
63
63
|
}
|
|
64
|
-
let renderBranch = () => {
|
|
65
|
-
branch ||= (created = 1, component.scope = require_control_flow.vt(out.global, renderer, renderer.e, document.body)), renderer.d?.(branch, renderer._ ? args[0] : args);
|
|
64
|
+
let renderBranch = (_) => {
|
|
65
|
+
branch ||= (created = 1, component.scope = require_control_flow.vt(out.global, renderer, renderer.e, document.body)), renderer.g?.(branch), renderer.d?.(branch, renderer._ ? args[0] : args);
|
|
66
66
|
};
|
|
67
|
-
if (component.effects = require_control_flow.
|
|
67
|
+
if (component.effects = require_control_flow.dn ? renderBranch() : require_control_flow.sn(renderBranch), created) return require_control_flow.pt(branch.S, branch.K);
|
|
68
68
|
}
|
|
69
69
|
}, _template = (id, template, walks, setup, inputSignal) => {
|
|
70
70
|
let renderer = require_control_flow.mt(id, template, walks, setup, inputSignal)();
|
|
@@ -105,25 +105,25 @@ function mount(input = {}, reference, position) {
|
|
|
105
105
|
break;
|
|
106
106
|
case "afterend": parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
|
107
107
|
}
|
|
108
|
-
let curValue, args = this.d, effects = require_control_flow.
|
|
108
|
+
let curValue, args = this.d, effects = require_control_flow.sn((_) => {
|
|
109
109
|
branch = require_control_flow.yt($global, this, void 0, parentNode), branch.T = (newValue) => {
|
|
110
110
|
curValue = newValue;
|
|
111
111
|
}, this.c?.(branch), args?.(branch, input);
|
|
112
112
|
});
|
|
113
|
-
return require_control_flow.ft(parentNode, nextSibling, branch.S, branch.K), require_control_flow.
|
|
113
|
+
return require_control_flow.ft(parentNode, nextSibling, branch.S, branch.K), require_control_flow.pn(effects), {
|
|
114
114
|
get value() {
|
|
115
115
|
return curValue;
|
|
116
116
|
},
|
|
117
117
|
set value(newValue) {
|
|
118
|
-
require_control_flow.
|
|
118
|
+
require_control_flow.Yt(branch, newValue);
|
|
119
119
|
},
|
|
120
120
|
update(newInput = {}) {
|
|
121
|
-
args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.
|
|
121
|
+
args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.pn(require_control_flow.sn((_) => {
|
|
122
122
|
args(branch, newInput);
|
|
123
123
|
})));
|
|
124
124
|
},
|
|
125
125
|
destroy() {
|
|
126
|
-
require_control_flow
|
|
126
|
+
require_control_flow.$t(branch);
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
}
|
|
@@ -133,74 +133,74 @@ function _load_template(id, load) {
|
|
|
133
133
|
let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
|
|
134
134
|
let awaitCounter = require_control_flow.b(branch);
|
|
135
135
|
branch.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((renderer) => {
|
|
136
|
-
Object.assign(lazyTemplate, renderer), require_control_flow.
|
|
136
|
+
Object.assign(lazyTemplate, renderer), require_control_flow.cn(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
|
|
137
137
|
}, loadFailed(branch, awaitCounter));
|
|
138
|
-
}, _load_signal(() => (pending ||= load()).then((r) => ({ _: r.d || noop }))));
|
|
138
|
+
}, _load_signal((_) => (pending ||= load()).then((r) => ({ _: r.d || noop }))));
|
|
139
139
|
return lazyTemplate;
|
|
140
140
|
}
|
|
141
141
|
function _load_setup(load) {
|
|
142
142
|
let pending, renderer, insertCached = (child, marker) => insertLoaded(renderer, child, marker);
|
|
143
143
|
return (owner, child, marker) => {
|
|
144
|
-
if (renderer) require_control_flow.
|
|
144
|
+
if (child.X ||= /* @__PURE__ */ new Map(), renderer) require_control_flow.un(child, insertCached, -1, marker);
|
|
145
145
|
else {
|
|
146
146
|
let awaitCounter = require_control_flow.b(owner);
|
|
147
|
-
|
|
148
|
-
renderer ||= require_control_flow.mt("", ...mod._)(), require_control_flow.
|
|
147
|
+
(pending ||= load()).then((mod) => {
|
|
148
|
+
renderer ||= require_control_flow.mt("", ...mod._)(), require_control_flow.cn(child, (child) => insertLoaded(renderer, child, marker, awaitCounter));
|
|
149
149
|
}, loadFailed(child, awaitCounter));
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
154
|
-
let parent = () => marker.parentNode, values = branch.X,
|
|
155
|
-
require_control_flow.
|
|
156
|
-
}, insert = () => {
|
|
157
|
-
require_control_flow
|
|
154
|
+
let parent = (_) => marker.parentNode, values = branch.X, create = (_) => {
|
|
155
|
+
require_control_flow.en(branch), renderer.b(branch, parent().namespaceURI), branch.X = 0, require_control_flow.bt(renderer, branch);
|
|
156
|
+
}, insert = (_) => {
|
|
157
|
+
require_control_flow.Qt(branch, parent(), marker), marker.remove(), awaitCounter?.c();
|
|
158
158
|
}, remaining;
|
|
159
159
|
if (remaining = values?.size) {
|
|
160
160
|
awaitCounter ||= require_control_flow.b(branch);
|
|
161
161
|
let fail = loadFailed(branch, awaitCounter);
|
|
162
|
-
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.
|
|
163
|
-
|
|
162
|
+
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.cn(branch, (branch) => {
|
|
163
|
+
create(), values.forEach(([value, apply]) => apply(branch, value)), insert();
|
|
164
164
|
}), (error) => remaining > 0 && (remaining = 0, fail(error))));
|
|
165
|
-
} else
|
|
165
|
+
} else create(), insert();
|
|
166
166
|
}
|
|
167
167
|
function loadFailed(scope, awaitCounter) {
|
|
168
168
|
return (error) => {
|
|
169
|
-
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.i && awaitCounter.c()), require_control_flow.
|
|
169
|
+
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.i && awaitCounter.c()), require_control_flow.cn(scope, require_control_flow.v, error);
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
function _load_signal(load) {
|
|
173
173
|
let pending, apply = (scope, value) => {
|
|
174
|
-
pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.
|
|
174
|
+
pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.mn ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, [value, apply]) : apply._ ? apply._(scope, value) : pending.then((mod) => require_control_flow.cn(scope, apply._ = mod._, value), noop);
|
|
175
175
|
};
|
|
176
176
|
return apply;
|
|
177
177
|
}
|
|
178
178
|
function _load_visible_trigger(selector, options) {
|
|
179
179
|
let pending, el;
|
|
180
|
-
return (load) => () => (pending ||= new Promise((resolve) => (el = getSelectorOrResolve(selector, resolve)) && new IntersectionObserver((entries, io) => entries.some((entry) => entry.isIntersecting) && resolve(io.disconnect()), options).observe(el))).then(load);
|
|
180
|
+
return (load) => (_) => (pending ||= new Promise((resolve) => (el = getSelectorOrResolve(selector, resolve)) && new IntersectionObserver((entries, io) => entries.some((entry) => entry.isIntersecting) && resolve(io.disconnect()), options).observe(el))).then(load);
|
|
181
181
|
}
|
|
182
182
|
function _load_idle_trigger(options) {
|
|
183
183
|
let pending;
|
|
184
|
-
return (load) => () => (pending ||= new Promise((resolve) => (self.requestIdleCallback || resolve)(resolve, options))).then(load);
|
|
184
|
+
return (load) => (_) => (pending ||= new Promise((resolve) => (self.requestIdleCallback || resolve)(resolve, options))).then(load);
|
|
185
185
|
}
|
|
186
186
|
function _load_event_trigger(event, selector) {
|
|
187
187
|
let pending;
|
|
188
|
-
return (load) => () => (pending ||= new Promise((resolve) => getSelectorOrResolve(selector, resolve)?.addEventListener(event, resolve, { once: !0 }))).then(load);
|
|
188
|
+
return (load) => (_) => (pending ||= new Promise((resolve) => getSelectorOrResolve(selector, resolve)?.addEventListener(event, resolve, { once: !0 }))).then(load);
|
|
189
189
|
}
|
|
190
190
|
function _load_media_trigger(query) {
|
|
191
191
|
let pending, mql;
|
|
192
|
-
return (load) => () => (pending ||= new Promise((resolve) => (mql = matchMedia(query)).matches ? resolve() : mql.addEventListener("change", resolve, { once: !0 }))).then(load);
|
|
192
|
+
return (load) => (_) => (pending ||= new Promise((resolve) => (mql = matchMedia(query)).matches ? resolve() : mql.addEventListener("change", resolve, { once: !0 }))).then(load);
|
|
193
193
|
}
|
|
194
194
|
function _load_race_trigger(...triggers) {
|
|
195
195
|
let pending;
|
|
196
|
-
return (load) => () => (pending ||= Promise.race(triggers.map((t) => t(noop)()))).then(load);
|
|
196
|
+
return (load) => (_) => (pending ||= Promise.race(triggers.map((t) => t(noop)()))).then(load);
|
|
197
197
|
}
|
|
198
198
|
function getSelectorOrResolve(selector, resolve) {
|
|
199
199
|
return document.querySelector(selector) || resolve();
|
|
200
200
|
}
|
|
201
|
-
exports.$signal = require_control_flow.
|
|
201
|
+
exports.$signal = require_control_flow.nn, exports.$signalReset = require_control_flow.rn, exports._assert_class_toggles = require_control_flow.yn, exports._assert_hoist = require_control_flow.bn, exports._assert_init = require_control_flow.Xt, exports._attr = require_control_flow.W, exports._attr_class = require_control_flow.G, exports._attr_class_item = require_control_flow.K, exports._attr_class_items = require_control_flow.q, exports._attr_class_names = require_control_flow.J, exports._attr_content = require_control_flow.Y, exports._attr_details_open = require_control_flow.x, exports._attr_dialog_open = require_control_flow.x, exports._attr_details_open_default = require_control_flow.S, exports._attr_dialog_open_default = require_control_flow.S, exports._attr_details_open_script = require_control_flow.C, exports._attr_dialog_open_script = require_control_flow.C, exports._attr_input_checked = require_control_flow.w, exports._attr_input_checkedValue = require_control_flow.T, exports._attr_input_checkedValue_default = require_control_flow.E, exports._attr_input_checkedValue_script = require_control_flow.D, exports._attr_input_checked_default = require_control_flow.O, exports._attr_input_checked_script = require_control_flow.k, exports._attr_input_value = require_control_flow.A, exports._attr_textarea_value = require_control_flow.A, exports._attr_input_value_attribute_default = require_control_flow.j, exports._attr_input_value_default = require_control_flow.M, exports._attr_textarea_value_default = require_control_flow.M, exports._attr_input_value_dynamic_default = require_control_flow.N, exports._attr_input_value_script = require_control_flow.P, exports._attr_textarea_value_script = require_control_flow.P, exports._attr_nonce = require_control_flow.X, exports._attr_select_value = require_control_flow.F, exports._attr_select_value_default = require_control_flow.I, exports._attr_select_value_script = require_control_flow.L, exports._attr_style = require_control_flow.Z, exports._attr_style_item = require_control_flow.Q, exports._attr_style_items = require_control_flow.$, exports._attrs = require_control_flow.et, exports._attrs_content = require_control_flow.tt, exports._attrs_partial = require_control_flow.nt, exports._attrs_partial_content = require_control_flow.rt, exports._attrs_script = require_control_flow.it, exports._await_content = require_control_flow.t, exports._await_promise = require_control_flow.n, exports._call = require_control_flow.Sn, exports._closure = require_control_flow.jt, exports._closure_get = require_control_flow.Mt, exports._const = require_control_flow.Nt, exports._content = require_control_flow.mt, exports._content_closures = require_control_flow.ht, exports._content_resume = require_control_flow.gt, exports._controllable_input = require_control_flow.R, exports._controllable_open = require_control_flow.z, exports._controllable_select = require_control_flow.B, exports._controllable_textarea = require_control_flow.V, Object.defineProperty(exports, "_dynamic_tag", {
|
|
202
202
|
enumerable: !0,
|
|
203
203
|
get: function() {
|
|
204
204
|
return require_control_flow.r;
|
|
205
205
|
}
|
|
206
|
-
}), exports._dynamic_tag_content = require_control_flow.i, exports._dynamic_tag_var_resume = require_control_flow.xt, exports._el = require_control_flow.St, exports._el_read = require_control_flow.
|
|
206
|
+
}), exports._dynamic_tag_content = require_control_flow.i, exports._dynamic_tag_var_resume = require_control_flow.xt, exports._el = require_control_flow.St, exports._el_read = require_control_flow.Pt, exports._for_closure = require_control_flow.Ft, exports._for_in = require_control_flow.a, exports._for_of = require_control_flow.o, exports._for_of_unkeyed = require_control_flow.s, exports._for_selector = require_control_flow.It, exports._for_to = require_control_flow.c, exports._for_to_unkeyed = require_control_flow.l, exports._for_until = require_control_flow.u, exports._for_until_unkeyed = require_control_flow.d, exports._global_read = require_control_flow.Lt, exports._hoist = require_control_flow.Rt, exports._hoist_read_error = require_control_flow.xn, exports._hoist_resume = require_control_flow.zt, exports._html = require_control_flow.at, exports._id = require_control_flow.Bt, exports._if = require_control_flow.f, exports._if_closure = require_control_flow.Vt, exports._let = require_control_flow.Ht, exports._let_change = require_control_flow.Ut, exports._lifecycle = require_control_flow.ot, 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.tn, exports._or = require_control_flow.Wt, exports._resumed = require_control_flow.Ct, exports._return = require_control_flow.Gt, exports._return_change = require_control_flow.Kt, exports._return_setup = require_control_flow._t, exports._script = require_control_flow.qt, exports._show = require_control_flow.p, exports._style_rule_item = require_control_flow.st, exports._style_shell = require_control_flow.ct, exports._template = _template, exports._text = require_control_flow.lt, exports._text_content = require_control_flow.ut, exports._to_text = require_control_flow.dt, exports._try = require_control_flow.m, exports._var = require_control_flow.Jt, exports._var_change = require_control_flow.Yt, exports._var_resume = require_control_flow.wt, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = require_control_flow.hn, exports.forOf = require_control_flow.gn, exports.forTo = require_control_flow._n, exports.forUntil = require_control_flow.vn, exports.init = require_control_flow.Et, exports.initEmbedded = require_control_flow.Dt, exports.ready = require_control_flow.Ot, exports.readyFailed = require_control_flow.kt, exports.run = require_control_flow.fn;
|
package/dist/dom.mjs
CHANGED
|
@@ -60,8 +60,8 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
|
|
|
60
60
|
let input = args[0], normalizedInput = args[0] = {};
|
|
61
61
|
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
62
62
|
}
|
|
63
|
-
let renderBranch = () => {
|
|
64
|
-
branch ||= (created = 1, component.scope = createAndSetupBranch(out.global, renderer, renderer.e, document.body)), renderer.d?.(branch, renderer._ ? args[0] : args);
|
|
63
|
+
let renderBranch = (_) => {
|
|
64
|
+
branch ||= (created = 1, component.scope = createAndSetupBranch(out.global, renderer, renderer.e, document.body)), renderer.g?.(branch), renderer.d?.(branch, renderer._ ? args[0] : args);
|
|
65
65
|
};
|
|
66
66
|
if (component.effects = rendering ? renderBranch() : prepareEffects(renderBranch), created) return toInsertNode(branch.S, branch.K);
|
|
67
67
|
}
|
|
@@ -69,7 +69,7 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
|
|
|
69
69
|
let renderer = _content(id, template, walks, setup, inputSignal)();
|
|
70
70
|
return renderer.mount = mount, renderer._ = renderer, _resumed[id] = renderer;
|
|
71
71
|
}, noop = (_) => 0;
|
|
72
|
-
import { $ as _attr_style_items, $t as
|
|
72
|
+
import { $ as _attr_style_items, $t as removeAndDestroyBranch, A as _attr_input_value, B as _controllable_select, Bt as _id, C as _attr_details_or_dialog_open_script, Ct as _resumed, D as _attr_input_checkedValue_script, Dt as initEmbedded, E as _attr_input_checkedValue_default, Et as init, F as _attr_select_value, Ft as _for_closure, G as _attr_class, Gt as _return, Ht as _let, I as _attr_select_value_default, It as _for_selector, J as _attr_class_names, Jt as _var, K as _attr_class_item, Kt as _return_change, L as _attr_select_value_script, Lt as _global_read, M as _attr_input_value_default, Mt as _closure_get, N as _attr_input_value_dynamic_default, Nt as _const, O as _attr_input_checked_default, Ot as ready, P as _attr_input_value_script, Pt as _el_read, Q as _attr_style_item, Qt as insertBranchBefore, R as _controllable_input, Rt as _hoist, S as _attr_details_or_dialog_open_default, Sn as _call, St as _el, T as _attr_input_checkedValue, Tt as getRegisteredWithScope, Ut as _let_change, V as _controllable_textarea, Vt as _if_closure, W as _attr, Wt as _or, X as _attr_nonce, Xt as _assert_init, Y as _attr_content, Yt as _var_change, Z as _attr_style, Zt as destroyBranch, _ as patchDynamicTag, _n as forTo, _t as _return_setup, a as _for_in, at as _html, b as startAwait, bn as _assert_hoist, bt as setupBranch, c as _for_to, cn as queueAsyncRender, ct as _style_shell, d as _for_until_unkeyed, dn as rendering, dt as _to_text, en as syncGen, et as _attrs, f as _if, fn as run, ft as insertChildNodes, gn as forOf, gt as _content_resume, hn as forIn, ht as _content_closures, i as _dynamic_tag_content, it as _attrs_script, j as _attr_input_value_attribute_default, jt as _closure, k as _attr_input_checked_script, kt as readyFailed, l as _for_to_unkeyed, ln as queueEffect, lt as _text, m as _try, mn as runId, mt as _content, n as _await_promise, nn as $signal, nt as _attrs_partial, o as _for_of, ot as _lifecycle, p as _show, pn as runEffects, pt as toInsertNode, q as _attr_class_items, qt as _script, r as _dynamic_tag, rn as $signalReset, rt as _attrs_partial_content, s as _for_of_unkeyed, sn as prepareEffects, st as _style_rule_item, t as _await_content, tn as _on, tt as _attrs_content, u as _for_until, un as queueRender, ut as _text_content, v as renderCatch, vn as forUntil, vt as createAndSetupBranch, w as _attr_input_checked, wt as _var_resume, x as _attr_details_or_dialog_open, xn as _hoist_read_error, xt as _dynamic_tag_var_resume, yn as _assert_class_toggles, yt as createBranch, z as _controllable_open, zt as _hoist_resume } from "./dom-CVAevsbz.mjs";
|
|
73
73
|
//#region src/common/attr-tag.ts
|
|
74
74
|
function attrTag(attrs) {
|
|
75
75
|
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
|
@@ -104,7 +104,7 @@ function mount(input = {}, reference, position) {
|
|
|
104
104
|
break;
|
|
105
105
|
case "afterend": parentNode = reference.parentNode, nextSibling = reference.nextSibling;
|
|
106
106
|
}
|
|
107
|
-
let curValue, args = this.d, effects = prepareEffects(() => {
|
|
107
|
+
let curValue, args = this.d, effects = prepareEffects((_) => {
|
|
108
108
|
branch = createBranch($global, this, void 0, parentNode), branch.T = (newValue) => {
|
|
109
109
|
curValue = newValue;
|
|
110
110
|
}, this.c?.(branch), args?.(branch, input);
|
|
@@ -117,7 +117,7 @@ function mount(input = {}, reference, position) {
|
|
|
117
117
|
_var_change(branch, newValue);
|
|
118
118
|
},
|
|
119
119
|
update(newInput = {}) {
|
|
120
|
-
args && (newInput.$global && ({$global, ...newInput} = newInput), runEffects(prepareEffects(() => {
|
|
120
|
+
args && (newInput.$global && ({$global, ...newInput} = newInput), runEffects(prepareEffects((_) => {
|
|
121
121
|
args(branch, newInput);
|
|
122
122
|
})));
|
|
123
123
|
},
|
|
@@ -134,34 +134,34 @@ function _load_template(id, load) {
|
|
|
134
134
|
branch.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((renderer) => {
|
|
135
135
|
Object.assign(lazyTemplate, renderer), queueAsyncRender(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
|
|
136
136
|
}, loadFailed(branch, awaitCounter));
|
|
137
|
-
}, _load_signal(() => (pending ||= load()).then((r) => ({ _: r.d || noop }))));
|
|
137
|
+
}, _load_signal((_) => (pending ||= load()).then((r) => ({ _: r.d || noop }))));
|
|
138
138
|
return lazyTemplate;
|
|
139
139
|
}
|
|
140
140
|
function _load_setup(load) {
|
|
141
141
|
let pending, renderer, insertCached = (child, marker) => insertLoaded(renderer, child, marker);
|
|
142
142
|
return (owner, child, marker) => {
|
|
143
|
-
if (renderer) queueRender(child, insertCached, -1, marker);
|
|
143
|
+
if (child.X ||= /* @__PURE__ */ new Map(), renderer) queueRender(child, insertCached, -1, marker);
|
|
144
144
|
else {
|
|
145
145
|
let awaitCounter = startAwait(owner);
|
|
146
|
-
|
|
146
|
+
(pending ||= load()).then((mod) => {
|
|
147
147
|
renderer ||= _content("", ...mod._)(), queueAsyncRender(child, (child) => insertLoaded(renderer, child, marker, awaitCounter));
|
|
148
148
|
}, loadFailed(child, awaitCounter));
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
153
|
-
let parent = () => marker.parentNode, values = branch.X,
|
|
154
|
-
syncGen(branch), renderer.b(branch, parent().namespaceURI), branch.X = 0;
|
|
155
|
-
}, insert = () => {
|
|
153
|
+
let parent = (_) => marker.parentNode, values = branch.X, create = (_) => {
|
|
154
|
+
syncGen(branch), renderer.b(branch, parent().namespaceURI), branch.X = 0, setupBranch(renderer, branch);
|
|
155
|
+
}, insert = (_) => {
|
|
156
156
|
insertBranchBefore(branch, parent(), marker), marker.remove(), awaitCounter?.c();
|
|
157
157
|
}, remaining;
|
|
158
158
|
if (remaining = values?.size) {
|
|
159
159
|
awaitCounter ||= startAwait(branch);
|
|
160
160
|
let fail = loadFailed(branch, awaitCounter);
|
|
161
161
|
values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && queueAsyncRender(branch, (branch) => {
|
|
162
|
-
|
|
162
|
+
create(), values.forEach(([value, apply]) => apply(branch, value)), insert();
|
|
163
163
|
}), (error) => remaining > 0 && (remaining = 0, fail(error))));
|
|
164
|
-
} else
|
|
164
|
+
} else create(), insert();
|
|
165
165
|
}
|
|
166
166
|
function loadFailed(scope, awaitCounter) {
|
|
167
167
|
return (error) => {
|
|
@@ -176,26 +176,26 @@ function _load_signal(load) {
|
|
|
176
176
|
}
|
|
177
177
|
function _load_visible_trigger(selector, options) {
|
|
178
178
|
let pending, el;
|
|
179
|
-
return (load) => () => (pending ||= new Promise((resolve) => (el = getSelectorOrResolve(selector, resolve)) && new IntersectionObserver((entries, io) => entries.some((entry) => entry.isIntersecting) && resolve(io.disconnect()), options).observe(el))).then(load);
|
|
179
|
+
return (load) => (_) => (pending ||= new Promise((resolve) => (el = getSelectorOrResolve(selector, resolve)) && new IntersectionObserver((entries, io) => entries.some((entry) => entry.isIntersecting) && resolve(io.disconnect()), options).observe(el))).then(load);
|
|
180
180
|
}
|
|
181
181
|
function _load_idle_trigger(options) {
|
|
182
182
|
let pending;
|
|
183
|
-
return (load) => () => (pending ||= new Promise((resolve) => (self.requestIdleCallback || resolve)(resolve, options))).then(load);
|
|
183
|
+
return (load) => (_) => (pending ||= new Promise((resolve) => (self.requestIdleCallback || resolve)(resolve, options))).then(load);
|
|
184
184
|
}
|
|
185
185
|
function _load_event_trigger(event, selector) {
|
|
186
186
|
let pending;
|
|
187
|
-
return (load) => () => (pending ||= new Promise((resolve) => getSelectorOrResolve(selector, resolve)?.addEventListener(event, resolve, { once: !0 }))).then(load);
|
|
187
|
+
return (load) => (_) => (pending ||= new Promise((resolve) => getSelectorOrResolve(selector, resolve)?.addEventListener(event, resolve, { once: !0 }))).then(load);
|
|
188
188
|
}
|
|
189
189
|
function _load_media_trigger(query) {
|
|
190
190
|
let pending, mql;
|
|
191
|
-
return (load) => () => (pending ||= new Promise((resolve) => (mql = matchMedia(query)).matches ? resolve() : mql.addEventListener("change", resolve, { once: !0 }))).then(load);
|
|
191
|
+
return (load) => (_) => (pending ||= new Promise((resolve) => (mql = matchMedia(query)).matches ? resolve() : mql.addEventListener("change", resolve, { once: !0 }))).then(load);
|
|
192
192
|
}
|
|
193
193
|
function _load_race_trigger(...triggers) {
|
|
194
194
|
let pending;
|
|
195
|
-
return (load) => () => (pending ||= Promise.race(triggers.map((t) => t(noop)()))).then(load);
|
|
195
|
+
return (load) => (_) => (pending ||= Promise.race(triggers.map((t) => t(noop)()))).then(load);
|
|
196
196
|
}
|
|
197
197
|
function getSelectorOrResolve(selector, resolve) {
|
|
198
198
|
return document.querySelector(selector) || resolve();
|
|
199
199
|
}
|
|
200
200
|
//#endregion
|
|
201
|
-
export { $signal, $signalReset, _assert_class_toggles, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_class_names, _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,
|
|
201
|
+
export { $signal, $signalReset, _assert_class_toggles, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_class_names, _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, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _dynamic_tag_var_resume, _el, _el_read, _for_closure, _for_in, _for_of, _for_of_unkeyed, _for_selector, _for_to, _for_to_unkeyed, _for_until, _for_until_unkeyed, _global_read, _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, _resumed, _return, _return_change, _return_setup, _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, readyFailed, run };
|
package/dist/html/assets.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ declare module "../common/types" {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
type AssetFlush = (g: $Global, type: "block" | "defer", asset: string) => string;
|
|
49
|
-
export declare function withLoadAssets(
|
|
49
|
+
export declare function withLoadAssets(template: () => ServerRenderer, id: string, flush: AssetFlush, assetId: string, triggers?: Trigger[]): ServerRenderer;
|
|
50
50
|
export declare function writeLoadAsset(assetId: string, flush: AssetFlush, triggers?: Trigger[]): void;
|
|
51
51
|
export declare function withPageAssets(template: ServerRenderer & Template, flush: AssetFlush, assetId: string, runtimeId?: string): Template;
|
|
52
52
|
export declare function _flush_head(): string;
|
|
@@ -17,4 +17,4 @@ export declare function _if(cb: () => void | number, scopeId: number, accessor:
|
|
|
17
17
|
export declare function _await<T>(scopeId: number, accessor: Accessor, promise: Promise<T> | T, content: (value: T) => void, markerGuard?: number): void;
|
|
18
18
|
export declare function _try(scopeId: number, accessor: Accessor, content: () => void, placeholderContent?: ServerRenderer, catchContent?: ServerRenderer, placeholderId?: string, catchId?: string): void;
|
|
19
19
|
export declare function tryBoundary(content: () => void, catchContent: ServerRenderer | undefined, branchId: number, renderers: () => void): boolean;
|
|
20
|
-
export declare function writeTryRenderers(branchId: number, catchContent:
|
|
20
|
+
export declare function writeTryRenderers(branchId: number, catchContent: unknown, placeholderContent: unknown): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const WALKER_RUNTIME_CODE = "(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,
|
|
2
|
-
export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=
|
|
1
|
+
export declare const WALKER_RUNTIME_CODE = "(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,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))";
|
|
2
|
+
export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=e=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:1,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=i=>g()||n(e.r)))}})";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const WALKER_RUNTIME_CODE = "((runtimeId) => (self[runtimeId] ||= (\n renderId,\n prefix = runtimeId + renderId,\n prefixLen = prefix.length,\n lookup = {},\n visits = [],\n doc = document,\n walker = doc.createTreeWalker(\n doc,\n 129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,\n ),\n) =>\n doc = (self[runtimeId][renderId] = {\n i: prefix,\n
|
|
2
|
-
export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = () => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n // The writer streams a reorder only after its markers.\n i: 1,\n r: id,\n // Resume may still walk markers inside the dropped placeholder, so\n // park it in any detached parent (a bare <t> clone is the cheapest).\n c(start = runtime.l[\"^\" + id], removed = node.cloneNode()) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n removed.prepend(\n (nextSibling = runtime.l[id].previousSibling || start),\n ),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // Opens the chunk's visits for resume to parent to the root's branch; the\n // walk that this chunk's own script triggers closes it.\n runtime.v.push({ data: runtime.i + \"*\" + placeholder.r });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = () => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
|
|
1
|
+
export declare const WALKER_RUNTIME_CODE = "((runtimeId) => (self[runtimeId] ||= (\n renderId,\n prefix = runtimeId + renderId,\n prefixLen = prefix.length,\n lookup = {},\n visits = [],\n doc = document,\n walker = doc.createTreeWalker(\n doc,\n 129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,\n ),\n) =>\n doc = (self[runtimeId][renderId] = {\n i: prefix,\n l: lookup,\n v: visits,\n x() {},\n w(node, op, id) {\n while ((node = walker.nextNode())) {\n // Only reorder markers (\"#\", \"!\") are ever looked up, so only they are\n // kept: the lookup lives as long as the page, and every node marker\n // would otherwise stay referenced in it after resume consumed it.\n doc.x(\n (op =\n (op = node.data) &&\n !op.indexOf(prefix) &&\n ((id = op.slice(prefixLen + 1)),\n (op = op[prefixLen]) > \"#\" || (lookup[id] = node),\n op)),\n id,\n node,\n );\n\n if (op > \"#\") {\n visits.push(node);\n }\n }\n },\n })\n, self[runtimeId]))";
|
|
2
|
+
export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = (_) => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n // The writer streams a reorder only after its markers.\n i: 1,\n r: id,\n // Resume may still walk markers inside the dropped placeholder, so\n // park it in any detached parent (a bare <t> clone is the cheapest).\n c(start = runtime.l[\"^\" + id], removed = node.cloneNode()) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n removed.prepend(\n (nextSibling = runtime.l[id].previousSibling || start),\n ),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // Opens the chunk's visits for resume to parent to the root's branch; the\n // walk that this chunk's own script triggers closes it.\n runtime.v.push({ data: runtime.i + \"*\" + placeholder.r });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = (_) => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
|
package/dist/html/template.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export type ServerRenderer = ((...args: unknown[]) => unknown) & {
|
|
|
7
7
|
[RendererProp.Lazy]?: 1;
|
|
8
8
|
};
|
|
9
9
|
export declare const _template: (templateId: string, renderer: ServerRenderer, page?: 1) => Template;
|
|
10
|
-
export declare function startRender(template:
|
|
10
|
+
export declare function startRender(template: ServerRenderer, input: TemplateInput, StateClass: typeof State): RenderedTemplate;
|
package/dist/html.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { attrTag, attrTags } from "./common/attr-tag";
|
|
2
|
-
export { _assert_class_toggles, _assert_hoist, _el_read_error, _hoist_read_error, } from "./common/errors";
|
|
2
|
+
export { _assert_class_toggles, _assert_hoist, _el_read_error, _hoist_read_error, _signal_read_error, } from "./common/errors";
|
|
3
3
|
export { _flush_head, withLoadAssets, withPageAssets } from "./html/assets";
|
|
4
4
|
export { _attr, _attr_and, _attr_class, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_select_value, _attrs_textarea_value, _style_html, _textarea_value, } from "./html/attrs";
|
|
5
5
|
export { compat } from "./html/compat";
|
package/dist/html.js
CHANGED
|
@@ -255,12 +255,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
255
255
|
rendered = !0, (() => {
|
|
256
256
|
if (_scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
257
257
|
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
258
|
-
|
|
259
|
-
else {
|
|
260
|
-
if (renderContent && typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
261
|
-
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, markerGuard) : void 0, 1) : renderContent && _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard);
|
|
262
|
-
}
|
|
263
|
-
_html(`</${renderer}>`);
|
|
258
|
+
renderer === "textarea" ? _html(_attrs_textarea_value(branchId, "a", input)) : 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, markerGuard) : void 0, 1) : renderContent && _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard), _html(`</${renderer}>`);
|
|
264
259
|
}
|
|
265
260
|
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
266
261
|
needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("(", scopeId + " " + accessor + " " + branchId));
|
|
@@ -285,7 +280,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
285
280
|
let patched = patch(tag, scopeId, accessor);
|
|
286
281
|
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, markerGuard, tagVar);
|
|
287
282
|
};
|
|
288
|
-
})(_dynamic_tag),
|
|
283
|
+
})(_dynamic_tag), _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), kAssets = Symbol(), kHead = Symbol(), SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_ID = "$C_b", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
289
284
|
$global,
|
|
290
285
|
writeLoadAsset,
|
|
291
286
|
fork: _await,
|
|
@@ -354,7 +349,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
354
349
|
let { boundary } = chunk, { state } = boundary, html = "", scripts = "";
|
|
355
350
|
if (reorders) for (let reorder of reorders) state.reorder(reorder);
|
|
356
351
|
if (boundary.flush() === 0 && ({html, scripts} = chunk.flush(boundary)), boundary.aborted) throw boundary.reason;
|
|
357
|
-
if (boundary.count) throw
|
|
352
|
+
if (boundary.count) throw /* @__PURE__ */ Error();
|
|
358
353
|
return {
|
|
359
354
|
html,
|
|
360
355
|
scripts
|
|
@@ -486,6 +481,7 @@ function normalizeDynamicRenderer(value) {
|
|
|
486
481
|
function _assert_class_toggles(classes, toggles) {}
|
|
487
482
|
function _el_read_error() {}
|
|
488
483
|
function _hoist_read_error() {}
|
|
484
|
+
function _signal_read_error() {}
|
|
489
485
|
function _assert_hoist(value) {}
|
|
490
486
|
//#endregion
|
|
491
487
|
//#region src/common/opt.ts
|
|
@@ -1710,7 +1706,7 @@ var State = class {
|
|
|
1710
1706
|
flushSerializer(boundary, this);
|
|
1711
1707
|
}
|
|
1712
1708
|
runtimeScript() {
|
|
1713
|
-
return "(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,
|
|
1709
|
+
return "(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,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + this.$global.runtimeId + "\")(\"" + this.$global.renderId + "\")";
|
|
1714
1710
|
}
|
|
1715
1711
|
keepsTryMarks(chunk, resumeWrites) {
|
|
1716
1712
|
return chunk !== $chunk || chunk.boundary.resumeWrites !== resumeWrites;
|
|
@@ -1867,7 +1863,7 @@ var State = class {
|
|
|
1867
1863
|
let { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId + "";
|
|
1868
1864
|
this.writeHTML(state.mark("!^", reorderId));
|
|
1869
1865
|
let { effects } = this, beforeBranch = deferBranchStart(this);
|
|
1870
|
-
if (this.render(withBranchId, placeholderBranchId, placeholder.render) !== this && this.boundary.abort(/* @__PURE__ */ Error(
|
|
1866
|
+
if (this.render(withBranchId, placeholderBranchId, placeholder.render) !== this && this.boundary.abort(/* @__PURE__ */ Error()), this.boundary.aborted) return !0;
|
|
1871
1867
|
let stateful = this.effects !== effects;
|
|
1872
1868
|
return applyBranchStart(this, beforeBranch, stateful), stateful && (this.render(writeScope, branchId, { P: scopeWithId(state, placeholderBranchId) }), this.writeHTML(state.mark("]", scopeId + " " + ("P" + branchId) + " " + placeholderBranchId)), dismissChunk(end, body).writeEffect(branchId, "_f")), this.writeHTML(state.mark("!", reorderId)), this.deferredReorder = body, !1;
|
|
1873
1869
|
}
|
|
@@ -1932,7 +1928,7 @@ var State = class {
|
|
|
1932
1928
|
let reordered = "", needsResumeArray = !1;
|
|
1933
1929
|
if (state.writeReorders) {
|
|
1934
1930
|
for (let reorderedChunk of state.writeReorders) {
|
|
1935
|
-
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=
|
|
1931
|
+
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=e=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:1,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=i=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
1936
1932
|
let { reorderId, reorderBranch } = reorderedChunk, rootBranch = reorderBranch || +reorderId, readyReservations = [], reorderHTML = "", reorderEffects = "", effectsBoundary = reorderedChunk.boundary, reorderScripts = "", cur = reorderedChunk.boundary.aborted ? null : reorderedChunk;
|
|
1937
1933
|
for (reorderedChunk.reorderId = null; cur;) {
|
|
1938
1934
|
cur.markCatchRange(), cur.queueDeferredReorder(), cur.deferOwnReady();
|
|
@@ -2189,7 +2185,7 @@ var ServerRendered = class {
|
|
|
2189
2185
|
});
|
|
2190
2186
|
},
|
|
2191
2187
|
return(value) {
|
|
2192
|
-
return done || aborted || boundary?.abort(/* @__PURE__ */ Error(
|
|
2188
|
+
return done || aborted || boundary?.abort(/* @__PURE__ */ Error()), Promise.resolve({
|
|
2193
2189
|
value,
|
|
2194
2190
|
done: !0
|
|
2195
2191
|
});
|
|
@@ -2238,7 +2234,7 @@ var ServerRendered = class {
|
|
|
2238
2234
|
#promise() {
|
|
2239
2235
|
return this.#cachedPromise ||= new Promise((resolve, reject) => {
|
|
2240
2236
|
let head = this.#head;
|
|
2241
|
-
if (this.#head = null, !head) return reject(/* @__PURE__ */ Error(
|
|
2237
|
+
if (this.#head = null, !head) return reject(/* @__PURE__ */ Error());
|
|
2242
2238
|
let { boundary } = head, html = "";
|
|
2243
2239
|
(boundary.onNext = () => {
|
|
2244
2240
|
switch (!boundary.count && boundary.flush()) {
|
|
@@ -2255,7 +2251,7 @@ var ServerRendered = class {
|
|
|
2255
2251
|
#read(onWrite, onAbort, onClose) {
|
|
2256
2252
|
let tick = !0, flushing = !1, again = !1, head = this.#head;
|
|
2257
2253
|
if (this.#head = null, !head) {
|
|
2258
|
-
onAbort(/* @__PURE__ */ Error(
|
|
2254
|
+
onAbort(/* @__PURE__ */ Error());
|
|
2259
2255
|
return;
|
|
2260
2256
|
}
|
|
2261
2257
|
let { boundary } = head, onNext = boundary.onNext = (write) => {
|
|
@@ -2288,9 +2284,9 @@ var ServerRendered = class {
|
|
|
2288
2284
|
}
|
|
2289
2285
|
toString() {
|
|
2290
2286
|
let head = this.#head;
|
|
2291
|
-
if (this.#head = null, !head) throw Error(
|
|
2287
|
+
if (this.#head = null, !head) throw /* @__PURE__ */ Error();
|
|
2292
2288
|
let { boundary } = head, html = boundary.flush() === 0 ? head.consume(boundary).flushHTML(boundary) : "";
|
|
2293
|
-
if (boundary.count && boundary.abort(/* @__PURE__ */ Error(
|
|
2289
|
+
if (boundary.count && boundary.abort(/* @__PURE__ */ Error()), settle(boundary), boundary.aborted) throw boundary.reason;
|
|
2294
2290
|
return html;
|
|
2295
2291
|
}
|
|
2296
2292
|
};
|
|
@@ -2300,8 +2296,9 @@ function settle(boundary) {
|
|
|
2300
2296
|
function NOOP$1() {}
|
|
2301
2297
|
//#endregion
|
|
2302
2298
|
//#region src/html/assets.ts
|
|
2303
|
-
function withLoadAssets(
|
|
2304
|
-
|
|
2299
|
+
function withLoadAssets(template, id, flush, assetId, triggers) {
|
|
2300
|
+
let renderer = (input) => (writeLoadAsset(assetId, flush, triggers), writeWaitReady(assetId, template(), input));
|
|
2301
|
+
return _template(id, renderer), renderer;
|
|
2305
2302
|
}
|
|
2306
2303
|
function writeLoadAsset(assetId, flush, triggers) {
|
|
2307
2304
|
let g = $global();
|
|
@@ -2604,4 +2601,4 @@ exports.$global = $global, exports._assert_class_toggles = _assert_class_toggles
|
|
|
2604
2601
|
get: function() {
|
|
2605
2602
|
return _dynamic_tag;
|
|
2606
2603
|
}
|
|
2607
|
-
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._html_resume = _html_resume, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._resume_locals = _resume_locals, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._set_scope_reason = _set_scope_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._text_resume = _text_resume, exports._textarea_value = _textarea_value, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports._write_guard = _write_guard, exports._write_if = _write_if, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forOf = forOf, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
|
|
2604
|
+
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._html_resume = _html_resume, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._resume_locals = _resume_locals, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._set_scope_reason = _set_scope_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._signal_read_error = _signal_read_error, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._text_resume = _text_resume, exports._textarea_value = _textarea_value, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports._write_guard = _write_guard, exports._write_if = _write_if, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forOf = forOf, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
|