marko 6.3.44 → 6.3.46
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 +7 -3
- 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 +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-ky42a_qY.mjs → dom-CIt3_Sdm.mjs} +7 -1
- package/dist/debug/{dom-DBuLwSOh.js → dom-WyMgkHne.js} +12 -0
- package/dist/debug/dom.js +2 -1
- package/dist/debug/dom.mjs +2 -2
- package/dist/debug/html.js +16 -14
- package/dist/debug/html.mjs +16 -14
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +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-var.feat.js +1 -1
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/resume.d.ts +1 -0
- package/dist/{dom-BSAs0ur8.mjs → dom-DN6BTUmH.mjs} +2 -1
- package/dist/{dom-DHJCbngT.js → dom-R3sALHJt.js} +53 -47
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +24 -24
- package/dist/dom.mjs +2 -2
- package/dist/html.js +6 -6
- package/dist/html.mjs +6 -6
- package/dist/translator/index.js +238 -525
- package/dist/translator/interop/index.d.ts +8 -0
- package/dist/translator/util/entry-builder.d.ts +17 -3
- package/dist/translator/util/known-tag.d.ts +1 -5
- package/dist/translator/util/references.d.ts +10 -1
- package/dist/translator/util/sections.d.ts +3 -1
- package/dist/translator/util/serialize-reasons.d.ts +3 -1
- package/dist/translator/util/set-tag-sections-downstream.d.ts +2 -2
- package/dist/translator/util/signals.d.ts +4 -1
- package/dist/translator/util/tag-name-type.d.ts +2 -0
- package/dist/translator/visitors/import-declaration.d.ts +4 -0
- package/dist/translator/visitors/program/index.d.ts +1 -0
- package/package.json +4 -4
package/cheatsheet.md
CHANGED
|
@@ -7,7 +7,7 @@ Marko 6 = HTML superset, not JSX and not Marko 4/5 syntax. `.marko` files are co
|
|
|
7
7
|
1. Text interpolation: `${expr}` inside tag bodies. A bare line at the template root parses as a tag (concise mode): `Welcome aboard` fails to compile, but `p is a tag` compiles **silently** to `<p is a tag></p>`, since any line starting with a real tag name loses its words to attributes. Wrap text in an element (`<p>Welcome aboard</p>`) or prefix the line with `--` and a space (`-- Welcome ${name}`). Attributes take raw JS after `=` with no braces or quotes: `<div title=user.name data-n=1 + 1>`.
|
|
8
8
|
2. A top-level `>` hugging its operand in an attribute value **ends the tag** silently: `<button disabled=count>=8 onClick() {…}>More</button>` is `disabled=count` plus the text `=8 onClick() {…}>`, so the handler never binds. Space a `>=` (`disabled=count >= 8`), and parenthesize a bare `>` comparison (`hidden=(a > b)`) and a TS type argument `<let/s=(new Set<string>())>`. Do not move the type onto the tag variable instead: `<let/s:Set<string>=new Set()>` compiles but fails type-check with TS2322 (the annotation does not flow into the initializer). A `>` nested inside `(…)`/`{…}`/`[…]` is safe (`class={ big: n > 1 }`). `<` never closes a tag (`disabled=count<=1` is fine).
|
|
9
9
|
3. State: `<let/name=initial>` (slash then var name!). Update by plain assignment in an event handler: `count++`, `text = "hi"`. No setState, no hooks.
|
|
10
|
-
4. Derived values: `<const/total=items.length * price>` auto-recomputes. Never use an effect to derive state. A tag variable is whatever the tag returns, not the attribute you passed. `<let/draft=input.text>` re-runs on every `input.text` change but returns state it controls, so `draft` keeps your edits. Pick by intent: recomputes → `<const>`, seeds then diverges → `<let>`. A `<let>` you never assign is just a frozen `<const>`. Updates batch: mid-handler a reassigned `<let>` reads current but its derived `<const>` reads stale, so recompute from the `<let>`.
|
|
10
|
+
4. Derived values: `<const/total=items.length * price>` auto-recomputes. Never use an effect to derive state. A tag variable is whatever the tag returns, not the attribute you passed. `<let/draft=input.text>` re-runs on every `input.text` change but returns state it controls, so `draft` keeps your edits; only a controllable `<let>` (`valueChange=`, or `<let/draft:=input.text>`) takes the new value. Pick by intent: recomputes → `<const>`, seeds then diverges → `<let>`. A `<let>` you never assign is just a frozen `<const>`. Updates batch: mid-handler a reassigned `<let>` reads current but its derived `<const>` reads stale, so recompute from the `<let>`.
|
|
11
11
|
5. Never mutate state in place: `items.push(x)` does not update the UI. Always reassign:
|
|
12
12
|
- add: `items = items.concat(x)`
|
|
13
13
|
- remove: `items = items.toSpliced(i, 1)`
|
|
@@ -15,9 +15,9 @@ Marko 6 = HTML superset, not JSX and not Marko 4/5 syntax. `.marko` files are co
|
|
|
15
15
|
- object: `user = { ...user, name }`
|
|
16
16
|
6. Events: method shorthand `onClick() { ... }` or `onClick=fn`. Handlers receive `(event, element)`; delegation means the element is the second parameter, not `event.currentTarget`: `onSubmit(e) { e.preventDefault(); save() }`, `onClick(e, el) { el.focus() }`. Don't sync input values through `onInput`/`onChange`; that's what the change handlers below are for. Prefix with `async` to `await` in the body: `async onClick() { await save() }`.
|
|
17
17
|
7. Native inputs are uncontrolled by default: `value=` sets the default value — later writes update what `form.reset()` restores, never a dirty field's display. Adding the matching `*Change` handler is what makes them controlled: `valueChange` on `<input>`/`<textarea>`/`<select>`, `checkedChange` on checkboxes/radios, `openChange` on `<details>`/`<dialog>`. `value:=text` is the shorthand for `value=text valueChange(v) { text = v }`. (`<textarea value:=text/>`: value attribute, not body.) `:=` differs by operand: on an identifier (`value:=text`) it assigns that variable; on a member expression (`<let/count:=input.count>` in a child) it wires `input.countChange`, so the child is controlled when the parent passes that handler and keeps its own state when it doesn't.
|
|
18
|
-
8. Transform in the handler when needed; number inputs give strings: `<input type="number" value=n valueChange(v) { n = +v }>`, or `value:parseFloat:=n`.
|
|
18
|
+
8. Transform in the handler when needed; number inputs give strings: `<input type="number" value=n valueChange(v) { n = +v }>`, or `value:parseFloat:=n`. Uncommitted edits (debounce, commit on blur) never sync through a `<script>`; that is rule 4's derive-by-effect trap. Pair a controllable `<let/value:=input.value>` with `<let/pending=null>`, show `<const/draft=pending ?? value>`, collect with `valueChange(v) { pending = v }`, and commit by assigning `value = pending; pending = null`. Prefer that to calling `input.valueChange(...)`, which throws unless every caller controls the tag.
|
|
19
19
|
9. Radio/checkbox groups: `checkedValue:=picked` on each input (shared var, distinct `value=`); the match is checked; array var for multi-checkbox. Dropdown: `<select value:=picked>`.
|
|
20
|
-
10. Module-level values, helpers and type aliases need `static`: `static const LIMIT = 10`, `static function fmt(n) {…}`, `static type Row = {…}`. Without it `function fmt(n) {` parses as a tag: ``Unable to find entry point for custom tag `<function>` ``, an error that
|
|
20
|
+
10. Module-level values, helpers and type aliases need `static`: `static const LIMIT = 10`, `static function fmt(n) {…}`, `static type Row = {…}`. Without it `function fmt(n) {` parses as a tag: ``Unable to find entry point for custom tag `<function>` ``, an error that points at `static`. Prefer it to `<const>` for anything that never changes: `<const/LIMIT=10>` emits a per-instance signal plus a `$setup` call. `server`/`client` narrow `static` to one platform (`client import { Chart } from "chart"`); the binding is `undefined` on the other, so read a `client` one only from `<script>`/handlers/`<lifecycle>` — reading it while rendering throws `is not a function` during SSR.
|
|
21
21
|
|
|
22
22
|
## Canonical component
|
|
23
23
|
|
|
@@ -129,6 +129,7 @@ Don't fetch while rendering: start data loads early, pass the promise through th
|
|
|
129
129
|
- Conditional attrs: `false`/`null` attrs are omitted from HTML. `aria-selected` etc. want strings: `aria-selected=(i === active && "true")`.
|
|
130
130
|
- `class=` / `style=` accept strings, objects, arrays: `class=["btn", { active }]`, `style={ color }` (single braces). `style=` keys are kebab-case CSS names (`{ "background-color": c }`), not camelCase.
|
|
131
131
|
- `<id/x>` mints a collision-free id for label/input wiring (`<label for=x>`/`<input id=x>`); don't hardcode ids in reusable tags; `<id/x=input.id>` reuses a caller's.
|
|
132
|
+
- Head tags render where written: a `<title>`/`<meta>`/`<link>` inside a nested component stays in the body, giving a second title or an inert canonical. `<head>` is already written by the time descendants render, so page meta has to be known before it: under @marko/run declare it in the route's `+meta.*` file and read `$global.meta` from the layout that owns `<head>`, otherwise pass it down or set it on `$global` at the render call.
|
|
132
133
|
|
|
133
134
|
## Sharing data (`$global`)
|
|
134
135
|
|
|
@@ -201,6 +202,7 @@ Each left-hand habit is an error or silently wrong.
|
|
|
201
202
|
| `const [x, setX] = useState()` / `state` / `class {}` block | `<let/x=0>` then `x = 1` |
|
|
202
203
|
| `$ const y = x * 2;` (scriptlets are removed) | `<const/y=x * 2>` |
|
|
203
204
|
| `<let/n=a + b>` for a value that should recompute | `<const/n=a + b>`; `<let>` seeds an initial value, then de-syncs by design |
|
|
205
|
+
| `<let/x=input.x>` expecting it to track `input.x` | `<const/x=input.x>`, or `<let/x:=input.x>` to make it controllable |
|
|
204
206
|
| `function fmt(n) {…}` / `const LIMIT = 10` at module level | `static function fmt(n) {…}` / `static const LIMIT = 10` |
|
|
205
207
|
| `type Row = {…}` at module level | `static type Row = {…}` |
|
|
206
208
|
| `<let x=0>` | `<let/x=0>` |
|
|
@@ -213,6 +215,7 @@ Each left-hand habit is an error or silently wrong.
|
|
|
213
215
|
| bare text on its own line at template root | wrap in an element (`<p>...`), or prefix the line with `--` and a space |
|
|
214
216
|
| `by=item` using the loop variable | `by="propName"` or `by=(item) => key`; `by=` is evaluated outside the loop |
|
|
215
217
|
| `onInput(e) { q = e.target.value }` to sync an input | `value:=q`; the change handler owns the value |
|
|
218
|
+
| `<script>` syncing a draft field back from `value` | `<const/draft=pending ?? value>`; a `<let>` holds only the uncommitted edit |
|
|
216
219
|
| fetching inside the component that renders the data | start the promise early (route handler / top of template), pass it down to `<await>` |
|
|
217
220
|
| `style={ backgroundColor: c }` (camelCase keys) | `style={ "background-color": c }` (kebab-case) |
|
|
218
221
|
| `this.querySelector` / `this.getRootNode()` in `<script>` | element ref getter: `<div/el>` then `el()` (there is no `this`) |
|
|
@@ -221,6 +224,7 @@ Each left-hand habit is an error or silently wrong.
|
|
|
221
224
|
| hand-rolled `IntersectionObserver` to defer a widget's JS | `import W from "<w>" with { load: "visible#sel" }` |
|
|
222
225
|
| imperative lib wired through `<script>` mount + cleanup | `<lifecycle onMount/onUpdate/onDestroy>` (keeps `this` across all three) |
|
|
223
226
|
| `createContext`/provider to share data | `input` (prop drilling) or request-scoped `$global` |
|
|
227
|
+
| `<title>`/`<meta>` in a nested component | put page meta in the layout that owns `<head>`; head tags never hoist |
|
|
224
228
|
| `$global.x` in client-reactive code, not allow-listed | `$global.serializedGlobals = { x: true }` first; otherwise the read is `undefined` |
|
|
225
229
|
| hand-namespaced global classes (`.my-card-title`) | `<style/styles>` + `class=styles.card` (scoped CSS modules) |
|
|
226
230
|
| `tsc --noEmit` to type check templates | `mtc`; `tsc` skips `.marko` files and exits 0 |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { An as
|
|
1
|
+
import { An as PendingEffects, Sn as Scope, g as renderCatch, jn as PendingRenders, kn as ParentBranch, nn as installCatch, rn as placeholderShown, tn as caughtError, wn as ClosestBranch, xn as Pending } from "../dom-CIt3_Sdm.mjs";
|
|
2
2
|
//#region src/dom/catch.feat.ts
|
|
3
3
|
const handlePendingTry = (fn, scope, branch) => {
|
|
4
4
|
while (branch) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-WyMgkHne.js");
|
|
3
3
|
//#region src/dom/controllable-input.feat.ts
|
|
4
4
|
require_control_flow.controllableScripts[0] = require_control_flow._attr_input_checked_script;
|
|
5
5
|
require_control_flow.controllableScripts[1] = require_control_flow._attr_input_checkedValue_script;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-
|
|
1
|
+
import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-CIt3_Sdm.mjs";
|
|
2
2
|
//#region src/dom/controllable-input.feat.ts
|
|
3
3
|
controllableScripts[0] = _attr_input_checked_script;
|
|
4
4
|
controllableScripts[1] = _attr_input_checkedValue_script;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-WyMgkHne.js");
|
|
3
3
|
//#region src/dom/controllable-open.feat.ts
|
|
4
4
|
require_control_flow.controllableScripts[4] = require_control_flow._attr_details_or_dialog_open_script;
|
|
5
5
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-
|
|
1
|
+
import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-CIt3_Sdm.mjs";
|
|
2
2
|
//#region src/dom/controllable-open.feat.ts
|
|
3
3
|
controllableScripts[4] = _attr_details_or_dialog_open_script;
|
|
4
4
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-WyMgkHne.js");
|
|
3
3
|
//#region src/dom/controllable-select.feat.ts
|
|
4
4
|
require_control_flow.controllableScripts[3] = require_control_flow._attr_select_value_script;
|
|
5
5
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as _attr_select_value_script, z as controllableScripts } from "../dom-
|
|
1
|
+
import { N as _attr_select_value_script, z as controllableScripts } from "../dom-CIt3_Sdm.mjs";
|
|
2
2
|
//#region src/dom/controllable-select.feat.ts
|
|
3
3
|
controllableScripts[3] = _attr_select_value_script;
|
|
4
4
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-WyMgkHne.js");
|
|
3
3
|
//#region src/dom/controllable-textarea.feat.ts
|
|
4
4
|
require_control_flow.controllableScripts[2] = require_control_flow._attr_input_value_script;
|
|
5
5
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as _attr_input_value_script, z as controllableScripts } from "../dom-
|
|
1
|
+
import { A as _attr_input_value_script, z as controllableScripts } from "../dom-CIt3_Sdm.mjs";
|
|
2
2
|
//#region src/dom/controllable-textarea.feat.ts
|
|
3
3
|
controllableScripts[2] = _attr_input_value_script;
|
|
4
4
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-
|
|
1
|
+
import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-CIt3_Sdm.mjs";
|
|
2
2
|
import "./controllable-input.feat.mjs";
|
|
3
3
|
import "./controllable-open.feat.mjs";
|
|
4
4
|
import "./controllable-select.feat.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-WyMgkHne.js");
|
|
3
3
|
//#region src/dom/dynamic-tag-var.feat.ts
|
|
4
4
|
const elementGetter = (branch) => () => require_control_flow._el_read(branch[require_control_flow.StartNode]);
|
|
5
5
|
require_control_flow.installDynamicTagVar((branch) => branch[require_control_flow.TagVariable](elementGetter(branch)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nn as StartNode, Pn as TagVariable, Zt as DYNAMIC_TAG_VAR_REGISTER_ID, gt as _resume, kt as _el_read, m as installDynamicTagVar } from "../dom-CIt3_Sdm.mjs";
|
|
2
2
|
//#region src/dom/dynamic-tag-var.feat.ts
|
|
3
3
|
const elementGetter = (branch) => () => _el_read(branch[StartNode]);
|
|
4
4
|
installDynamicTagVar((branch) => branch[TagVariable](elementGetter(branch)));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_control_flow = require("../dom-
|
|
2
|
+
const require_control_flow = require("../dom-WyMgkHne.js");
|
|
3
3
|
//#region src/dom/placeholder.feat.ts
|
|
4
4
|
require_control_flow.registeredValues[require_control_flow.PLACEHOLDER_DISMISS_REGISTER_ID] = (tryBranch) => {
|
|
5
5
|
if (tryBranch["#PlaceholderBranch"]) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ct as registeredValues, Kt as destroyBranch, Mn as PlaceholderBranch, Qt as PLACEHOLDER_DISMISS_REGISTER_ID } from "../dom-CIt3_Sdm.mjs";
|
|
2
2
|
//#region src/dom/placeholder.feat.ts
|
|
3
3
|
registeredValues[PLACEHOLDER_DISMISS_REGISTER_ID] = (tryBranch) => {
|
|
4
4
|
if (tryBranch["#PlaceholderBranch"]) {
|
|
@@ -859,11 +859,17 @@ const registeredValues = {};
|
|
|
859
859
|
let curRenders;
|
|
860
860
|
let embedRenders;
|
|
861
861
|
let readyIds;
|
|
862
|
+
let failedIds;
|
|
862
863
|
let lazyEnabled;
|
|
863
864
|
function ready(readyId) {
|
|
864
865
|
(readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
|
|
865
866
|
for (const renderId in curRenders) runResumeEffects(curRenders[renderId]);
|
|
866
867
|
}
|
|
868
|
+
function readyFailed(readyId) {
|
|
869
|
+
if (failedIds?.has(readyId) || readyIds?.has(readyId)) return;
|
|
870
|
+
(failedIds ||= /* @__PURE__ */ new Set()).add(readyId);
|
|
871
|
+
console.error(`The lazy module for "${readyId}" failed to load; its server-rendered content cannot become interactive.`);
|
|
872
|
+
}
|
|
867
873
|
function withLazy(runtime) {
|
|
868
874
|
lazyEnabled = 1;
|
|
869
875
|
return runtime;
|
|
@@ -2077,4 +2083,4 @@ function byFirstArg(name) {
|
|
|
2077
2083
|
return name;
|
|
2078
2084
|
}
|
|
2079
2085
|
//#endregion
|
|
2080
|
-
export { _attrs_script as $, $
|
|
2086
|
+
export { _attrs_script as $, $signal as $t, _attr_input_value_script as A, PendingEffects as An, _for_closure as At, _attr as B, _return as Bt, _attr_input_checkedValue_script as C, AwaitCounter as Cn, registeredValues as Ct, _attr_input_value_attribute_default as D, Global as Dn, _closure_get as Dt, _attr_input_value as E, Gen$1 as En, _closure as Et, _controllable_open as F, _id as Ft, _attr_nonce as G, _assert_init as Gt, _attr_class_item as H, _script as Ht, _controllable_select as I, _if_closure as It, _attr_style_items as J, removeAndDestroyBranch as Jt, _attr_style as K, destroyBranch as Kt, _controllable_textarea as L, _let as Lt, _attr_select_value_default as M, PlaceholderBranch as Mn, _global_read as Mt, _attr_select_value_script as N, StartNode as Nn, _hoist as Nt, _attr_input_value_default as O, Load as On, _const as Ot, _controllable_input as P, TagVariable as Pn, _hoist_resume as Pt, _attrs_partial_content as Q, PLACEHOLDER_DISMISS_REGISTER_ID as Qt, controllableRenders as R, _let_change as Rt, _attr_input_checkedValue_default as S, Scope as Sn, readyFailed as St, _attr_input_checked_script as T, EndNode as Tn, _child_setup as Tt, _attr_class_items as U, _var as Ut, _attr_class as V, _return_change as Vt, _attr_content as W, _var_change as Wt, _attrs_content as X, _on as Xt, _attrs as Y, syncGen as Yt, _attrs_partial as Z, DYNAMIC_TAG_VAR_REGISTER_ID as Zt, _attr_details_or_dialog_open as _, Clone as _n, _var_resume as _t, _for_in as a, queueAsyncRender as an, _text_content as at, _attr_input_checked as b, Setup as bn, initEmbedded as bt, _for_until as c, runEffects as cn, toInsertNode as ct, _show as d, forOf as dn, _content_resume as dt, $signalReset as en, _html as et, _try as f, forTo as fn, createAndSetupBranch as ft, renderCatch as g, _call as gn, _resume as gt, patchDynamicTag as h, _hoist_read_error as hn, _el as ht, _dynamic_tag_content as i, prepareEffects as in, _text as it, _attr_select_value as j, PendingRenders as jn, _for_selector as jt, _attr_input_value_dynamic_default as k, ParentBranch as kn, _el_read as kt, _if as l, runId as ln, _content as lt, installDynamicTagVar as m, _assert_hoist as mn, setupBranch as mt, _await_promise as n, installCatch as nn, _style_rule_item as nt, _for_of as o, queueEffect as on, _to_text as ot, addAwaitCounter as p, forUntil as pn, createBranch as pt, _attr_style_item as q, insertBranchBefore as qt, _dynamic_tag as r, placeholderShown as rn, _style_shell as rt, _for_to as s, run as sn, insertChildNodes as st, _await_content as t, caughtError as tn, _lifecycle as tt, _resume_dynamic_tag as u, forIn as un, _content_closures as ut, _attr_details_or_dialog_open_default as v, Owner as vn, getRegisteredWithScope as vt, _attr_input_checked_default as w, ClosestBranch as wn, withLazy as wt, _attr_input_checkedValue as x, Pending as xn, ready as xt, _attr_details_or_dialog_open_script as y, Params as yn, init as yt, controllableScripts as z, _or as zt };
|
|
@@ -860,11 +860,17 @@ const registeredValues = {};
|
|
|
860
860
|
let curRenders;
|
|
861
861
|
let embedRenders;
|
|
862
862
|
let readyIds;
|
|
863
|
+
let failedIds;
|
|
863
864
|
let lazyEnabled;
|
|
864
865
|
function ready(readyId) {
|
|
865
866
|
(readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
|
|
866
867
|
for (const renderId in curRenders) runResumeEffects(curRenders[renderId]);
|
|
867
868
|
}
|
|
869
|
+
function readyFailed(readyId) {
|
|
870
|
+
if (failedIds?.has(readyId) || readyIds?.has(readyId)) return;
|
|
871
|
+
(failedIds ||= /* @__PURE__ */ new Set()).add(readyId);
|
|
872
|
+
console.error(`The lazy module for "${readyId}" failed to load; its server-rendered content cannot become interactive.`);
|
|
873
|
+
}
|
|
868
874
|
function withLazy(runtime) {
|
|
869
875
|
lazyEnabled = 1;
|
|
870
876
|
return runtime;
|
|
@@ -2864,6 +2870,12 @@ Object.defineProperty(exports, "ready", {
|
|
|
2864
2870
|
return ready;
|
|
2865
2871
|
}
|
|
2866
2872
|
});
|
|
2873
|
+
Object.defineProperty(exports, "readyFailed", {
|
|
2874
|
+
enumerable: true,
|
|
2875
|
+
get: function() {
|
|
2876
|
+
return readyFailed;
|
|
2877
|
+
}
|
|
2878
|
+
});
|
|
2867
2879
|
Object.defineProperty(exports, "registeredValues", {
|
|
2868
2880
|
enumerable: true,
|
|
2869
2881
|
get: function() {
|
package/dist/debug/dom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_control_flow = require("./dom-
|
|
3
|
+
const require_control_flow = require("./dom-WyMgkHne.js");
|
|
4
4
|
//#region src/common/attr-tag.ts
|
|
5
5
|
const empty = [];
|
|
6
6
|
const rest = Symbol("Attribute Tag");
|
|
@@ -413,4 +413,5 @@ exports.forUntil = require_control_flow.forUntil;
|
|
|
413
413
|
exports.init = require_control_flow.init;
|
|
414
414
|
exports.initEmbedded = require_control_flow.initEmbedded;
|
|
415
415
|
exports.ready = require_control_flow.ready;
|
|
416
|
+
exports.readyFailed = require_control_flow.readyFailed;
|
|
416
417
|
exports.run = require_control_flow.run;
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as _attrs_script, $t as $
|
|
1
|
+
import { $ as _attrs_script, $t as $signal, A as _attr_input_value_script, At as _for_closure, B as _attr, Bt as _return, C as _attr_input_checkedValue_script, D as _attr_input_value_attribute_default, Dn as Global, Dt as _closure_get, E as _attr_input_value, Et as _closure, F as _controllable_open, Ft as _id, G as _attr_nonce, Gt as _assert_init, H as _attr_class_item, Ht as _script, I as _controllable_select, It as _if_closure, J as _attr_style_items, Jt as removeAndDestroyBranch, K as _attr_style, Kt as destroyBranch, L as _controllable_textarea, Lt as _let, M as _attr_select_value_default, Mt as _global_read, N as _attr_select_value_script, Nn as StartNode, Nt as _hoist, O as _attr_input_value_default, On as Load, Ot as _const, P as _controllable_input, Pn as TagVariable, Pt as _hoist_resume, Q as _attrs_partial_content, Rt as _let_change, S as _attr_input_checkedValue_default, St as readyFailed, T as _attr_input_checked_script, Tn as EndNode, Tt as _child_setup, U as _attr_class_items, Ut as _var, V as _attr_class, Vt as _return_change, W as _attr_content, Wt as _var_change, X as _attrs_content, Xt as _on, Y as _attrs, Yt as syncGen, Z as _attrs_partial, _ as _attr_details_or_dialog_open, _n as Clone, _t as _var_resume, a as _for_in, an as queueAsyncRender, at as _text_content, b as _attr_input_checked, bn as Setup, bt as initEmbedded, c as _for_until, cn as runEffects, ct as toInsertNode, d as _show, dn as forOf, dt as _content_resume, en as $signalReset, et as _html, f as _try, fn as forTo, ft as createAndSetupBranch, g as renderCatch, gn as _call, gt as _resume, h as patchDynamicTag, hn as _hoist_read_error, ht as _el, i as _dynamic_tag_content, in as prepareEffects, it as _text, j as _attr_select_value, jt as _for_selector, k as _attr_input_value_dynamic_default, kt as _el_read, l as _if, ln as runId, lt as _content, mn as _assert_hoist, mt as setupBranch, n as _await_promise, nt as _style_rule_item, o as _for_of, on as queueEffect, ot as _to_text, p as addAwaitCounter, pn as forUntil, pt as createBranch, q as _attr_style_item, qt as insertBranchBefore, r as _dynamic_tag, rt as _style_shell, s as _for_to, sn as run, st as insertChildNodes, t as _await_content, tt as _lifecycle, u as _resume_dynamic_tag, un as forIn, ut as _content_closures, v as _attr_details_or_dialog_open_default, vn as Owner, vt as getRegisteredWithScope, w as _attr_input_checked_default, wt as withLazy, x as _attr_input_checkedValue, xt as ready, y as _attr_details_or_dialog_open_script, yn as Params, yt as init, zt as _or } from "./dom-CIt3_Sdm.mjs";
|
|
2
2
|
//#region src/common/attr-tag.ts
|
|
3
3
|
const empty = [];
|
|
4
4
|
const rest = Symbol("Attribute Tag");
|
|
@@ -294,4 +294,4 @@ function getSelectorOrResolve(selector, resolve) {
|
|
|
294
294
|
return document.querySelector(selector) || (console.warn(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`), resolve());
|
|
295
295
|
}
|
|
296
296
|
//#endregion
|
|
297
|
-
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, _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, _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 };
|
|
297
|
+
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, _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, _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, readyFailed, run };
|
package/dist/debug/html.js
CHANGED
|
@@ -300,16 +300,16 @@ function _escape_comment(val) {
|
|
|
300
300
|
//#endregion
|
|
301
301
|
//#region src/html/serializer.ts
|
|
302
302
|
const K_SCOPE_ID = Symbol("Scope ID");
|
|
303
|
-
const kTouchedIterator = Symbol.for("marko.touchedIterator");
|
|
303
|
+
const kTouchedIterator = /* @__PURE__ */ Symbol.for("marko.touchedIterator");
|
|
304
304
|
const { hasOwnProperty } = {};
|
|
305
305
|
const objectProto = Object.prototype;
|
|
306
306
|
const arrayProto = Array.prototype;
|
|
307
|
-
const Generator = (function* () {})().constructor;
|
|
308
|
-
const AsyncGenerator = (async function* () {})().constructor;
|
|
307
|
+
const Generator = (/* @__PURE__ */ (function* () {})()).constructor;
|
|
308
|
+
const AsyncGenerator = (/* @__PURE__ */ (async function* () {})()).constructor;
|
|
309
309
|
patchIteratorNext(Generator.prototype);
|
|
310
310
|
patchIteratorNext(AsyncGenerator.prototype);
|
|
311
311
|
const REGISTRY = /* @__PURE__ */ new WeakMap();
|
|
312
|
-
const KNOWN_SYMBOLS = (() => {
|
|
312
|
+
const KNOWN_SYMBOLS = /* @__PURE__ */ (() => {
|
|
313
313
|
const KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
314
314
|
for (const name of Object.getOwnPropertyNames(Symbol)) {
|
|
315
315
|
const symbol = Symbol[name];
|
|
@@ -317,7 +317,7 @@ const KNOWN_SYMBOLS = (() => {
|
|
|
317
317
|
}
|
|
318
318
|
return KNOWN_SYMBOLS;
|
|
319
319
|
})();
|
|
320
|
-
const KNOWN_FUNCTIONS = /* @__PURE__ */ new Map([
|
|
320
|
+
const KNOWN_FUNCTIONS = /* @__PURE__ */ (() => /* @__PURE__ */ new Map([
|
|
321
321
|
[AggregateError, "AggregateError"],
|
|
322
322
|
[Array, "Array"],
|
|
323
323
|
[Array.from, "Array.from"],
|
|
@@ -535,8 +535,8 @@ const KNOWN_FUNCTIONS = /* @__PURE__ */ new Map([
|
|
|
535
535
|
[URIError, "URIError"],
|
|
536
536
|
[WeakMap, "WeakMap"],
|
|
537
537
|
[WeakSet, "WeakSet"]
|
|
538
|
-
]);
|
|
539
|
-
const KNOWN_OBJECTS = /* @__PURE__ */ new Map([
|
|
538
|
+
]))();
|
|
539
|
+
const KNOWN_OBJECTS = /* @__PURE__ */ (() => /* @__PURE__ */ new Map([
|
|
540
540
|
[Atomics, "Atomics"],
|
|
541
541
|
[console, "console"],
|
|
542
542
|
[globalThis, "globalThis"],
|
|
@@ -545,7 +545,7 @@ const KNOWN_OBJECTS = /* @__PURE__ */ new Map([
|
|
|
545
545
|
[JSON, "JSON"],
|
|
546
546
|
[Math, "Math"],
|
|
547
547
|
[Reflect, "Reflect"]
|
|
548
|
-
]);
|
|
548
|
+
]))();
|
|
549
549
|
var State$1 = class {
|
|
550
550
|
ids = 0;
|
|
551
551
|
flushId = 0;
|
|
@@ -1011,7 +1011,8 @@ const replaceUnsafeRegExpSourceChar = (match) => {
|
|
|
1011
1011
|
};
|
|
1012
1012
|
function writeRegExp(state, val) {
|
|
1013
1013
|
const { source } = val;
|
|
1014
|
-
state.buf.push(
|
|
1014
|
+
if (source.includes("<")) state.buf.push(`RegExp(${quote(source, 0)}${val.flags ? ",\"" + val.flags + "\"" : ""})`);
|
|
1015
|
+
else state.buf.push("/" + (unsafeRegExpSourceDetect.test(source) ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags);
|
|
1015
1016
|
return true;
|
|
1016
1017
|
}
|
|
1017
1018
|
function writePromise(state, val, ref) {
|
|
@@ -2314,7 +2315,7 @@ function tryCatch(content, catchContent) {
|
|
|
2314
2315
|
const chunk = $chunk;
|
|
2315
2316
|
const { boundary } = chunk;
|
|
2316
2317
|
const { state } = boundary;
|
|
2317
|
-
const catchBoundary = new Boundary(state,
|
|
2318
|
+
const catchBoundary = new Boundary(state, boundary.signal, boundary);
|
|
2318
2319
|
const body = chunk.fork(catchBoundary, null);
|
|
2319
2320
|
const bodyEnd = body.render(content);
|
|
2320
2321
|
if (catchBoundary.signal.aborted) {
|
|
@@ -3149,7 +3150,7 @@ function _content(id, fn, scopeId) {
|
|
|
3149
3150
|
function _content_resume(id, fn, scopeId) {
|
|
3150
3151
|
return _resume(_content(id, fn, scopeId), id, scopeId);
|
|
3151
3152
|
}
|
|
3152
|
-
const patchDynamicTag = ((originalDynamicTag) => (patch) => {
|
|
3153
|
+
const patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
|
|
3153
3154
|
_dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
|
|
3154
3155
|
const patched = patch(tag, scopeId, accessor);
|
|
3155
3156
|
if (patched !== tag) patched["id"] = tag;
|
|
@@ -3439,7 +3440,7 @@ function flush(g, html) {
|
|
|
3439
3440
|
const { id, triggers } = assets[di];
|
|
3440
3441
|
const deferHTML = assetFlush(g, "defer", id);
|
|
3441
3442
|
if (triggers) {
|
|
3442
|
-
if (deferHTML) writeTriggerScript(deferHTML, triggers);
|
|
3443
|
+
if (deferHTML) writeTriggerScript(id, deferHTML, triggers);
|
|
3443
3444
|
} else result += deferHTML;
|
|
3444
3445
|
}
|
|
3445
3446
|
g[kBlockIndex] = bi;
|
|
@@ -3463,8 +3464,9 @@ function addAsset(g, id, triggers) {
|
|
|
3463
3464
|
if (JSON.stringify(existing.triggers) !== JSON.stringify(triggers)) console.error(`The lazy asset "${id}" is imported with different \`load\` triggers; an asset must use one consistent trigger.`);
|
|
3464
3465
|
}
|
|
3465
3466
|
}
|
|
3466
|
-
function writeTriggerScript(html, triggers) {
|
|
3467
|
+
function writeTriggerScript(id, html, triggers) {
|
|
3467
3468
|
const htmlStr = _escape_script(JSON.stringify(html));
|
|
3469
|
+
const insert = `(d=new Range().createContextualFragment(h),d.querySelectorAll("script").forEach(s=>s.onerror=()=>console.error(${_escape_script(JSON.stringify(`The lazy module for "${id}" failed to load; its server-rendered content cannot become interactive.`))})),p.after(d))`;
|
|
3468
3470
|
const exprs = triggers.map((trigger) => {
|
|
3469
3471
|
const options = trigger.options && toObjectExpression(trigger.options);
|
|
3470
3472
|
switch (trigger.type) {
|
|
@@ -3474,7 +3476,7 @@ function writeTriggerScript(html, triggers) {
|
|
|
3474
3476
|
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
|
|
3475
3477
|
}
|
|
3476
3478
|
});
|
|
3477
|
-
writeScript(`((p,h,d,l=$=>{d
|
|
3479
|
+
writeScript(`((p,h,d,l=$=>{d||${insert}})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(document.currentScript,${htmlStr})`);
|
|
3478
3480
|
}
|
|
3479
3481
|
function querySelectorOrLoad(selector) {
|
|
3480
3482
|
return `document.querySelector(${JSON.stringify(selector)})||${`(console.warn(${JSON.stringify(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`)}),l())`}`;
|
package/dist/debug/html.mjs
CHANGED
|
@@ -298,16 +298,16 @@ function _escape_comment(val) {
|
|
|
298
298
|
//#endregion
|
|
299
299
|
//#region src/html/serializer.ts
|
|
300
300
|
const K_SCOPE_ID = Symbol("Scope ID");
|
|
301
|
-
const kTouchedIterator = Symbol.for("marko.touchedIterator");
|
|
301
|
+
const kTouchedIterator = /* @__PURE__ */ Symbol.for("marko.touchedIterator");
|
|
302
302
|
const { hasOwnProperty } = {};
|
|
303
303
|
const objectProto = Object.prototype;
|
|
304
304
|
const arrayProto = Array.prototype;
|
|
305
|
-
const Generator = (function* () {})().constructor;
|
|
306
|
-
const AsyncGenerator = (async function* () {})().constructor;
|
|
305
|
+
const Generator = (/* @__PURE__ */ (function* () {})()).constructor;
|
|
306
|
+
const AsyncGenerator = (/* @__PURE__ */ (async function* () {})()).constructor;
|
|
307
307
|
patchIteratorNext(Generator.prototype);
|
|
308
308
|
patchIteratorNext(AsyncGenerator.prototype);
|
|
309
309
|
const REGISTRY = /* @__PURE__ */ new WeakMap();
|
|
310
|
-
const KNOWN_SYMBOLS = (() => {
|
|
310
|
+
const KNOWN_SYMBOLS = /* @__PURE__ */ (() => {
|
|
311
311
|
const KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
312
312
|
for (const name of Object.getOwnPropertyNames(Symbol)) {
|
|
313
313
|
const symbol = Symbol[name];
|
|
@@ -315,7 +315,7 @@ const KNOWN_SYMBOLS = (() => {
|
|
|
315
315
|
}
|
|
316
316
|
return KNOWN_SYMBOLS;
|
|
317
317
|
})();
|
|
318
|
-
const KNOWN_FUNCTIONS = /* @__PURE__ */ new Map([
|
|
318
|
+
const KNOWN_FUNCTIONS = /* @__PURE__ */ (() => /* @__PURE__ */ new Map([
|
|
319
319
|
[AggregateError, "AggregateError"],
|
|
320
320
|
[Array, "Array"],
|
|
321
321
|
[Array.from, "Array.from"],
|
|
@@ -533,8 +533,8 @@ const KNOWN_FUNCTIONS = /* @__PURE__ */ new Map([
|
|
|
533
533
|
[URIError, "URIError"],
|
|
534
534
|
[WeakMap, "WeakMap"],
|
|
535
535
|
[WeakSet, "WeakSet"]
|
|
536
|
-
]);
|
|
537
|
-
const KNOWN_OBJECTS = /* @__PURE__ */ new Map([
|
|
536
|
+
]))();
|
|
537
|
+
const KNOWN_OBJECTS = /* @__PURE__ */ (() => /* @__PURE__ */ new Map([
|
|
538
538
|
[Atomics, "Atomics"],
|
|
539
539
|
[console, "console"],
|
|
540
540
|
[globalThis, "globalThis"],
|
|
@@ -543,7 +543,7 @@ const KNOWN_OBJECTS = /* @__PURE__ */ new Map([
|
|
|
543
543
|
[JSON, "JSON"],
|
|
544
544
|
[Math, "Math"],
|
|
545
545
|
[Reflect, "Reflect"]
|
|
546
|
-
]);
|
|
546
|
+
]))();
|
|
547
547
|
var State$1 = class {
|
|
548
548
|
ids = 0;
|
|
549
549
|
flushId = 0;
|
|
@@ -1009,7 +1009,8 @@ const replaceUnsafeRegExpSourceChar = (match) => {
|
|
|
1009
1009
|
};
|
|
1010
1010
|
function writeRegExp(state, val) {
|
|
1011
1011
|
const { source } = val;
|
|
1012
|
-
state.buf.push(
|
|
1012
|
+
if (source.includes("<")) state.buf.push(`RegExp(${quote(source, 0)}${val.flags ? ",\"" + val.flags + "\"" : ""})`);
|
|
1013
|
+
else state.buf.push("/" + (unsafeRegExpSourceDetect.test(source) ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags);
|
|
1013
1014
|
return true;
|
|
1014
1015
|
}
|
|
1015
1016
|
function writePromise(state, val, ref) {
|
|
@@ -2312,7 +2313,7 @@ function tryCatch(content, catchContent) {
|
|
|
2312
2313
|
const chunk = $chunk;
|
|
2313
2314
|
const { boundary } = chunk;
|
|
2314
2315
|
const { state } = boundary;
|
|
2315
|
-
const catchBoundary = new Boundary(state,
|
|
2316
|
+
const catchBoundary = new Boundary(state, boundary.signal, boundary);
|
|
2316
2317
|
const body = chunk.fork(catchBoundary, null);
|
|
2317
2318
|
const bodyEnd = body.render(content);
|
|
2318
2319
|
if (catchBoundary.signal.aborted) {
|
|
@@ -3147,7 +3148,7 @@ function _content(id, fn, scopeId) {
|
|
|
3147
3148
|
function _content_resume(id, fn, scopeId) {
|
|
3148
3149
|
return _resume(_content(id, fn, scopeId), id, scopeId);
|
|
3149
3150
|
}
|
|
3150
|
-
const patchDynamicTag = ((originalDynamicTag) => (patch) => {
|
|
3151
|
+
const patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
|
|
3151
3152
|
_dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
|
|
3152
3153
|
const patched = patch(tag, scopeId, accessor);
|
|
3153
3154
|
if (patched !== tag) patched["id"] = tag;
|
|
@@ -3437,7 +3438,7 @@ function flush(g, html) {
|
|
|
3437
3438
|
const { id, triggers } = assets[di];
|
|
3438
3439
|
const deferHTML = assetFlush(g, "defer", id);
|
|
3439
3440
|
if (triggers) {
|
|
3440
|
-
if (deferHTML) writeTriggerScript(deferHTML, triggers);
|
|
3441
|
+
if (deferHTML) writeTriggerScript(id, deferHTML, triggers);
|
|
3441
3442
|
} else result += deferHTML;
|
|
3442
3443
|
}
|
|
3443
3444
|
g[kBlockIndex] = bi;
|
|
@@ -3461,8 +3462,9 @@ function addAsset(g, id, triggers) {
|
|
|
3461
3462
|
if (JSON.stringify(existing.triggers) !== JSON.stringify(triggers)) console.error(`The lazy asset "${id}" is imported with different \`load\` triggers; an asset must use one consistent trigger.`);
|
|
3462
3463
|
}
|
|
3463
3464
|
}
|
|
3464
|
-
function writeTriggerScript(html, triggers) {
|
|
3465
|
+
function writeTriggerScript(id, html, triggers) {
|
|
3465
3466
|
const htmlStr = _escape_script(JSON.stringify(html));
|
|
3467
|
+
const insert = `(d=new Range().createContextualFragment(h),d.querySelectorAll("script").forEach(s=>s.onerror=()=>console.error(${_escape_script(JSON.stringify(`The lazy module for "${id}" failed to load; its server-rendered content cannot become interactive.`))})),p.after(d))`;
|
|
3466
3468
|
const exprs = triggers.map((trigger) => {
|
|
3467
3469
|
const options = trigger.options && toObjectExpression(trigger.options);
|
|
3468
3470
|
switch (trigger.type) {
|
|
@@ -3472,7 +3474,7 @@ function writeTriggerScript(html, triggers) {
|
|
|
3472
3474
|
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
|
|
3473
3475
|
}
|
|
3474
3476
|
});
|
|
3475
|
-
writeScript(`((p,h,d,l=$=>{d
|
|
3477
|
+
writeScript(`((p,h,d,l=$=>{d||${insert}})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(document.currentScript,${htmlStr})`);
|
|
3476
3478
|
}
|
|
3477
3479
|
function querySelectorOrLoad(selector) {
|
|
3478
3480
|
return `document.querySelector(${JSON.stringify(selector)})||${`(console.warn(${JSON.stringify(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`)}),l())`}`;
|
package/dist/dom/catch.feat.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
let require_control_flow = require("../dom-
|
|
1
|
+
let require_control_flow = require("../dom-R3sALHJt.js"), handlePendingTry = (fn, scope, branch) => {
|
|
2
2
|
for (; branch;) {
|
|
3
3
|
if (branch.O?.i) return (branch.J ||= []).push(fn, scope);
|
|
4
4
|
branch = branch.N;
|
|
5
5
|
}
|
|
6
6
|
};
|
|
7
7
|
//#region src/dom/catch.feat.ts
|
|
8
|
-
require_control_flow
|
|
9
|
-
if (checkPending || require_control_flow.
|
|
8
|
+
require_control_flow.en((runEffects) => (effects, checkPending = require_control_flow.tn.has(effects)) => {
|
|
9
|
+
if (checkPending || require_control_flow.$t.has(effects)) {
|
|
10
10
|
let i = 0, fn, scope, branch;
|
|
11
11
|
for (; i < effects.length;) fn = effects[i++], scope = effects[i++], (branch = scope.F)?.H !== 0 && !(checkPending && handlePendingTry(fn, scope, branch)) && fn(scope);
|
|
12
12
|
} else runEffects(effects);
|
package/dist/dom/catch.feat.mjs
CHANGED
|
@@ -4,7 +4,7 @@ let handlePendingTry = (fn, scope, branch) => {
|
|
|
4
4
|
branch = branch.N;
|
|
5
5
|
}
|
|
6
6
|
};
|
|
7
|
-
import { $t as
|
|
7
|
+
import { $t as caughtError, en as installCatch, g as renderCatch, tn as placeholderShown } from "../dom-DN6BTUmH.mjs";
|
|
8
8
|
//#region src/dom/catch.feat.ts
|
|
9
9
|
installCatch((runEffects) => (effects, checkPending = placeholderShown.has(effects)) => {
|
|
10
10
|
if (checkPending || caughtError.has(effects)) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
let require_control_flow = require("../dom-
|
|
1
|
+
let require_control_flow = require("../dom-R3sALHJt.js");
|
|
2
2
|
require_control_flow.z[0] = require_control_flow.T, require_control_flow.z[1] = require_control_flow.C, require_control_flow.z[2] = require_control_flow.A;
|
|
3
3
|
//#endregion
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-
|
|
1
|
+
import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-DN6BTUmH.mjs";
|
|
2
2
|
controllableScripts[0] = _attr_input_checked_script, controllableScripts[1] = _attr_input_checkedValue_script, controllableScripts[2] = _attr_input_value_script;
|
|
3
3
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-
|
|
1
|
+
import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-DN6BTUmH.mjs";
|
|
2
2
|
//#region src/dom/controllable-open.feat.ts
|
|
3
3
|
controllableScripts[4] = _attr_details_or_dialog_open_script;
|
|
4
4
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as _attr_select_value_script, z as controllableScripts } from "../dom-
|
|
1
|
+
import { N as _attr_select_value_script, z as controllableScripts } from "../dom-DN6BTUmH.mjs";
|
|
2
2
|
//#region src/dom/controllable-select.feat.ts
|
|
3
3
|
controllableScripts[3] = _attr_select_value_script;
|
|
4
4
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as _attr_input_value_script, z as controllableScripts } from "../dom-
|
|
1
|
+
import { A as _attr_input_value_script, z as controllableScripts } from "../dom-DN6BTUmH.mjs";
|
|
2
2
|
//#region src/dom/controllable-textarea.feat.ts
|
|
3
3
|
controllableScripts[2] = _attr_input_value_script;
|
|
4
4
|
//#endregion
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
let require_control_flow = require("../dom-
|
|
1
|
+
let require_control_flow = require("../dom-R3sALHJt.js");
|
|
2
2
|
require("./controllable-input.feat.js"), require("./controllable-open.feat.js"), require("./controllable-select.feat.js"), require_control_flow.R.INPUT = require_control_flow.P, require_control_flow.R.TEXTAREA = require_control_flow.L, require_control_flow.R.SELECT = require_control_flow.I, require_control_flow.R.DETAILS = require_control_flow.R.DIALOG = require_control_flow.F;
|
|
3
3
|
//#endregion
|