brumate 0.8.0 → 0.9.0

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.
Files changed (122) hide show
  1. package/dist/{boot-BkUdiYOF.d.ts → boot-ej-9NRT3.d.ts} +20 -2
  2. package/dist/cli.js +88 -82
  3. package/dist/cli.js.map +1 -1
  4. package/dist/{client-B0FXW5Kw.js → client-B-ww-PQ7.js} +402 -63
  5. package/dist/client-B-ww-PQ7.js.map +1 -0
  6. package/dist/{client-Cq6aTiDs.d.ts → client-Do6IBIhI.d.ts} +58 -14
  7. package/dist/{defer-BMIMP4Hq.js → defer-JD2FK9mV.js} +5 -3
  8. package/dist/defer-JD2FK9mV.js.map +1 -0
  9. package/dist/{devtools-calls-DGW6nLZ2.js → devtools-calls-DCjuSkim.js} +3 -3
  10. package/dist/{devtools-calls-DGW6nLZ2.js.map → devtools-calls-DCjuSkim.js.map} +1 -1
  11. package/dist/{devtools-panel-B1nF1KB7.js → devtools-panel-DLeWTPhU.js} +4 -4
  12. package/dist/{devtools-panel-B1nF1KB7.js.map → devtools-panel-DLeWTPhU.js.map} +1 -1
  13. package/dist/{devtools-B4prrxht.js → devtools-tuq7ATGN.js} +10 -7
  14. package/dist/devtools-tuq7ATGN.js.map +1 -0
  15. package/dist/{error-catalog-DakxjSgj.js → error-catalog-BBWB7w-E.js} +11 -4
  16. package/dist/error-catalog-BBWB7w-E.js.map +1 -0
  17. package/dist/{error-catalog-VxLbz-6p.js → error-catalog-CbmQqfat.js} +1 -1
  18. package/dist/{events-LgLdp1R7.js → events-BDVITj3P.js} +3 -5
  19. package/dist/events-BDVITj3P.js.map +1 -0
  20. package/dist/{features-DwMYKBIC.js → features-Cte5aj20.js} +8 -2
  21. package/dist/features-Cte5aj20.js.map +1 -0
  22. package/dist/{files-D5GtxwEQ.js → files-Bz0lAQzD.js} +2 -2
  23. package/dist/{files-D5GtxwEQ.js.map → files-Bz0lAQzD.js.map} +1 -1
  24. package/dist/{html-Cf5uKhLs.js → html-BYuHDvxy.js} +10 -3
  25. package/dist/html-BYuHDvxy.js.map +1 -0
  26. package/dist/index.d.ts +71 -19
  27. package/dist/index.js +3 -3
  28. package/dist/{inspect-CGl5Y8q6.js → inspect-fpaBJ5pm.js} +1305 -75
  29. package/dist/inspect-fpaBJ5pm.js.map +1 -0
  30. package/dist/{loader-BsaSuIoG.js → loader-DMxuZ6He.js} +14 -6
  31. package/dist/loader-DMxuZ6He.js.map +1 -0
  32. package/dist/{navigate-BlowKvhB.js → navigate-C5PjwYMh.js} +108 -20
  33. package/dist/navigate-C5PjwYMh.js.map +1 -0
  34. package/dist/{produce-CLABZ8k2.d.ts → produce-BDkCsGH7.d.ts} +3 -3
  35. package/dist/{rpc-C1jYVNAe.js → rpc-DOdrekhP.js} +23 -13
  36. package/dist/rpc-DOdrekhP.js.map +1 -0
  37. package/dist/runtime/bundles.d.ts +3 -2
  38. package/dist/runtime/bundles.js +20 -5
  39. package/dist/runtime/bundles.js.map +1 -1
  40. package/dist/runtime/client.d.ts +4 -3
  41. package/dist/runtime/client.js +5 -5
  42. package/dist/runtime/devtools.d.ts +3 -1
  43. package/dist/runtime/devtools.js +1 -1
  44. package/dist/runtime/events.js +1 -1
  45. package/dist/runtime/hot.d.ts +1 -1
  46. package/dist/runtime/html.js +1 -1
  47. package/dist/runtime/loader.d.ts +2 -2
  48. package/dist/runtime/loader.js +2 -2
  49. package/dist/runtime/otel.d.ts +18 -0
  50. package/dist/runtime/otel.js +127 -0
  51. package/dist/runtime/otel.js.map +1 -0
  52. package/dist/runtime/server.d.ts +4 -3
  53. package/dist/runtime/server.js +5 -5
  54. package/dist/runtime/signals.d.ts +2 -2
  55. package/dist/runtime/signals.js +4 -1
  56. package/dist/runtime/signals.js.map +1 -1
  57. package/dist/runtime/static-loader.d.ts +2 -2
  58. package/dist/runtime/static-loader.js +1 -1
  59. package/dist/runtime/store.d.ts +2 -2
  60. package/dist/runtime/store.js +1 -1
  61. package/dist/runtime/testing.d.ts +2 -2
  62. package/dist/runtime/testing.js +2 -2
  63. package/dist/search-params-qGERTLi3.js +382 -0
  64. package/dist/search-params-qGERTLi3.js.map +1 -0
  65. package/dist/{serial-ribg9NAj.js → serial-B2AJ9VGx.js} +1 -1
  66. package/dist/{serial-ioa17MuY.js → serial-Cj6pDGOq.js} +6 -6
  67. package/dist/{serial-ioa17MuY.js.map → serial-Cj6pDGOq.js.map} +1 -1
  68. package/dist/{server-DesBZv5g.d.ts → server-2-LS_KFo.d.ts} +125 -9
  69. package/dist/{server-BUuf7XPZ.js → server-CRGZMWnK.js} +545 -236
  70. package/dist/server-CRGZMWnK.js.map +1 -0
  71. package/dist/{shared-CX_YacDm.js → shared-CUBWrbiM.js} +4 -4
  72. package/dist/{shared-CX_YacDm.js.map → shared-CUBWrbiM.js.map} +1 -1
  73. package/dist/sheets-B9Zr50mf.js +105 -0
  74. package/dist/sheets-B9Zr50mf.js.map +1 -0
  75. package/dist/{signals-7VVD9C_H.d.ts → signals-BgsJK-uT.d.ts} +16 -6
  76. package/dist/{static-loader-C_en-4v8.js → static-loader-BDBtWsdg.js} +107 -19
  77. package/dist/static-loader-BDBtWsdg.js.map +1 -0
  78. package/dist/{static-loader-UKnK11Em.d.ts → static-loader-CAFn6p0l.d.ts} +2 -2
  79. package/dist/{store-9_oa0HG1.d.ts → store-BwWg-Iei.d.ts} +79 -2
  80. package/dist/store-DNr24Z8L.js +950 -0
  81. package/dist/store-DNr24Z8L.js.map +1 -0
  82. package/dist/{stream-read-BTsYstJY.js → stream-read-CiLDH60b.js} +2 -2
  83. package/dist/{stream-read-BTsYstJY.js.map → stream-read-CiLDH60b.js.map} +1 -1
  84. package/dist/{stream-read-Dek3HnqO.js → stream-read-DVoregpA.js} +1 -1
  85. package/dist/trace-DT7RGRAV.d.ts +52 -0
  86. package/dist/trace-browser-C7MFMove.js +170 -0
  87. package/dist/trace-browser-C7MFMove.js.map +1 -0
  88. package/dist/trace-flag-Dy267snx.js +7 -0
  89. package/dist/trace-flag-Dy267snx.js.map +1 -0
  90. package/dist/{trusted-g_zUJbh2.js → trusted-Bmwg4_hf.js} +12 -5
  91. package/dist/trusted-Bmwg4_hf.js.map +1 -0
  92. package/dist/view-transitions-BpnVwtS4.js +141 -0
  93. package/dist/view-transitions-BpnVwtS4.js.map +1 -0
  94. package/dist/vite.d.ts +8 -1
  95. package/dist/vite.js +356 -46
  96. package/dist/vite.js.map +1 -1
  97. package/elements.d.ts +8 -0
  98. package/package.json +13 -1
  99. package/skills/brumate/SKILL.md +9 -5
  100. package/skills/brumate/references/errors.md +95 -14
  101. package/skills/brumate/references/events.md +27 -1
  102. package/skills/brumate/references/signals.md +4 -4
  103. package/skills/brumate/references/state.md +79 -4
  104. package/skills/brumate/references/syntax.md +58 -9
  105. package/dist/client-B0FXW5Kw.js.map +0 -1
  106. package/dist/defer-BMIMP4Hq.js.map +0 -1
  107. package/dist/devtools-B4prrxht.js.map +0 -1
  108. package/dist/error-catalog-DakxjSgj.js.map +0 -1
  109. package/dist/events-LgLdp1R7.js.map +0 -1
  110. package/dist/features-DwMYKBIC.js.map +0 -1
  111. package/dist/html-Cf5uKhLs.js.map +0 -1
  112. package/dist/inspect-CGl5Y8q6.js.map +0 -1
  113. package/dist/loader-BsaSuIoG.js.map +0 -1
  114. package/dist/navigate-BlowKvhB.js.map +0 -1
  115. package/dist/rpc-C1jYVNAe.js.map +0 -1
  116. package/dist/search-params-Wg-0FsMj.js +0 -148
  117. package/dist/search-params-Wg-0FsMj.js.map +0 -1
  118. package/dist/server-BUuf7XPZ.js.map +0 -1
  119. package/dist/static-loader-C_en-4v8.js.map +0 -1
  120. package/dist/store-Cy4EEyZ7.js +0 -439
  121. package/dist/store-Cy4EEyZ7.js.map +0 -1
  122. package/dist/trusted-g_zUJbh2.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { b as ownValue, t as Internal, x as raw } from "./html-Cf5uKhLs.js";
2
- import { a as HAS_CHILDREN, h as HAS_STORES, i as HAS_BRIDGES, n as HAS_BINDINGS } from "./features-DwMYKBIC.js";
3
- import { n as Store, t as Bridged } from "./store-Cy4EEyZ7.js";
1
+ import { _ as HAS_STORES, a as HAS_CHILDREN, i as HAS_BRIDGES, n as HAS_BINDINGS } from "./features-Cte5aj20.js";
2
+ import { b as ownValue, t as Internal, x as raw } from "./html-BYuHDvxy.js";
3
+ import { i as Store, t as Bridged } from "./store-DNr24Z8L.js";
4
4
  //#region src/runtime/shared.ts
5
5
  /** The plugins of values of the app, by tag, which the entry `src/serial.ts` exports. */
6
6
  const valuePlugins = /* @__PURE__ */ new Map();
@@ -303,4 +303,4 @@ const SCOPE_IDS = {
303
303
  //#endregion
304
304
  export { unbind as C, stateValues as S, madeStores as _, FunctionReference as a, onValuePlugin as b, PropPromise as c, addEntryHandlers as d, gateValue as f, isSlotReference as g, isPropWrapper as h, ElementReference as i, SCOPE_IDS as l, isBinding as m, CHILDREN_REF as n, MemoError as o, isAsyncIterable as p, ChildrenReference as r, PARTS as s, Binding as t, SlotReference as u, mergeHandlers as v, useSerialEntry as w, parseId as x, onSerialOptions as y };
305
305
 
306
- //# sourceMappingURL=shared-CX_YacDm.js.map
306
+ //# sourceMappingURL=shared-CUBWrbiM.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared-CX_YacDm.js","names":[],"sources":["../src/runtime/shared.ts"],"sourcesContent":["// Values and types that the server and the browser share. It does not import\n// seroval, so the core, which reads the page state without it, stays small.\n// The plugins that write and read these values are in `serial.ts`.\n\nimport { HAS_BINDINGS, HAS_BRIDGES, HAS_CHILDREN, HAS_STORES } from './features.ts';\nimport { Internal, ownValue, raw } from './html.ts';\nimport type { Raw } from './html.ts';\nimport { Bridged, Store } from './store.ts';\nimport type { SerialEntry, ValuePlugin } from './values.ts';\n\n/** The plugins of values of the app, by tag, which the entry `src/serial.ts` exports. */\nconst valuePlugins = new Map<string, ValuePlugin>();\nconst pluginListeners: ((plugin: ValuePlugin) => void)[] = [];\n/** The options of the entry, which the serializer reads when it loads. */\nlet entryOptions: Omit<SerialEntry, 'plugins'> = {};\nconst optionListeners: ((options: Omit<SerialEntry, 'plugins'>) => void)[] = [];\n\n/**\n * Takes the exports of the serial entry: its plugins and the options that it\n * changes. The server and the loader call it before the first value is\n * written or read.\n */\nexport function useSerialEntry(entry: SerialEntry): void {\n const { plugins = [], ...options } = entry;\n if (options.disabledFeatures !== undefined || options.depthLimit !== undefined) {\n entryOptions = options;\n for (const listener of optionListeners) {\n listener(options);\n }\n }\n registerValues(plugins);\n}\n\n/** Calls `listener` with the options of the entry, now and when they change. */\nexport function onSerialOptions(listener: (options: Omit<SerialEntry, 'plugins'>) => void): void {\n optionListeners.push(listener);\n listener(entryOptions);\n}\n\n/** Adds plugins of values of the app. */\nfunction registerValues(plugins: readonly ValuePlugin[]): void {\n for (const plugin of plugins) {\n if (valuePlugins.get(plugin.tag) === plugin) {\n continue;\n }\n valuePlugins.set(plugin.tag, plugin);\n for (const listener of pluginListeners) {\n listener(plugin);\n }\n }\n}\n\n/** Calls `listener` for each plugin of the app, those added so far and those added later. */\nexport function onValuePlugin(listener: (plugin: ValuePlugin) => void): void {\n pluginListeners.push(listener);\n for (const plugin of valuePlugins.values()) {\n listener(plugin);\n }\n}\n\n/**\n * The ID of a scope or of a `#loading` boundary. The rest of the page numbers\n * its scopes from the base of the render, such as `3`. A `#loading` body\n * numbers its own from 0 after the ID of its boundary and a dot, such as\n * `5.0` and `5.1`, so its IDs do not depend on when its data arrives.\n */\nexport type ScopeId = number | string;\n\n/** Reads a scope or boundary ID from markup. */\nexport function parseId(text: string): ScopeId {\n return /^-?\\d+$/.test(text) ? Number(text) : text;\n}\n\n/** Adds a number to an ID. An ID inside a boundary moves with its boundary. */\nexport function shiftId(id: ScopeId, by: number): ScopeId {\n if (typeof id === 'number') {\n return id + by;\n }\n const dot = id.indexOf('.');\n return `${Number(id.slice(0, dot)) + by}${id.slice(dot)}`;\n}\n\n/** An element that the server rendered. The client finds it by its anchor. */\nexport class ElementReference {\n readonly scope: ScopeId;\n readonly anchor: number;\n\n constructor(scope: ScopeId, anchor: number) {\n this.scope = scope;\n this.anchor = anchor;\n }\n}\n\n/** A client function: an export of a client module, and the scope it reads. */\n/** The key of the reference of children on the server, which the page state sends. */\nexport const CHILDREN_REF: unique symbol = Symbol.for('brumate.children') as never;\n\n/**\n * The children of a component in the page state: the export that renders them in the browser,\n * such as `Page_1a2b#n0`, and the scope that they were written in. Each insert renders them\n * again, with new scopes, as the body of a block does.\n */\nexport class ChildrenReference {\n readonly ref: string;\n readonly scope: ScopeId;\n /** The scope and the anchor of the insert where the server rendered them, if it did. */\n at: ScopeId | undefined;\n anchor: number | undefined;\n\n constructor(ref: string, scope: ScopeId, at?: ScopeId, anchor?: number) {\n this.ref = ref;\n this.scope = scope;\n this.at = at;\n this.anchor = anchor;\n }\n}\n\nexport class FunctionReference {\n /** `<component id>#<export name>`. */\n readonly ref: string;\n readonly scope: ScopeId;\n /** The arguments of a handler that `$handler` made, which come before the event. */\n readonly args: unknown[] | undefined;\n /** The modifiers of the wrappers of a handler, such as `prevent`, for the `b-on` of a spread. */\n readonly modifiers: string[] | undefined;\n\n constructor(ref: string, scope: ScopeId, args?: unknown[] | null, modifiers?: string[]) {\n this.ref = ref;\n this.scope = scope;\n this.args = args ?? undefined;\n this.modifiers = modifiers;\n }\n}\n\n/** The handlers that a merged handler calls, in order. A symbol of the registry. */\nexport const PARTS: unique symbol = Symbol.for('brumate.parts');\n\n// oxlint-disable-next-line typescript/no-explicit-any -- Handlers take any event.\ntype Handler = (...args: any[]) => unknown;\n\n/**\n * One handler that calls each of `handlers` in order, with the same arguments. A prop holds one\n * handler per event, and the browser takes one `b-on` entry for each part. Merged handlers in\n * `handlers` give their parts, so the list stays flat.\n */\nexport function mergeHandlers(handlers: Handler[]): Handler {\n const parts: Handler[] = [];\n for (const handler of handlers) {\n parts.push(...((handler as { [PARTS]?: Handler[] })[PARTS] ?? [handler]));\n }\n return Object.assign(\n (...args: unknown[]): void => {\n for (const part of parts) {\n part(...args);\n }\n },\n { [PARTS]: parts },\n );\n}\n\n/**\n * Adds a handler prop, such as `onClick`, for each entry of the scoped `b-on` of a dynamic tag\n * that names a component. `make` makes the handler of a reference. A handler of the same event in\n * `props`, such as a rest prop passed on, is merged with it and runs first.\n */\nexport function addEntryHandlers(\n props: Record<string, unknown>,\n entries: unknown,\n scope: ScopeId | undefined,\n make: (reference: FunctionReference) => Handler,\n): void {\n for (const entry of (ownValue('b-on', entries) as string | undefined)?.split(' ') ?? []) {\n const [event, target] = entry.split('=') as [string, string];\n const [name, ...modifiers] = event.split(':') as [string, ...string[]];\n const [ref, at] = target.split('@') as [string, string?];\n const handler = make(\n new FunctionReference(\n ref,\n /^\\d+$/.test(at ?? '') ? Number(at) : (at ?? scope!),\n undefined,\n modifiers.length > 0 ? modifiers : undefined,\n ),\n );\n const key = `on${name[0]!.toUpperCase()}${name.slice(1)}`;\n const before = props[key];\n props[key] =\n typeof before === 'function' ? mergeHandlers([before as Handler, handler]) : handler;\n }\n}\n\n// Brands of bindings and slot references, under keys of the registry, so two copies of the\n// runtime, such as a component's and the render context's, know each other's.\nconst BINDING = Symbol.for('brumate.binding');\nconst SLOT = Symbol.for('brumate.slot');\n\n/** A slot of a scope, which a write of a bound prop goes to. */\nexport class SlotReference {\n readonly scope: ScopeId;\n readonly slot: number;\n\n constructor(scope: ScopeId, slot: number) {\n this.scope = scope;\n this.slot = slot;\n }\n}\n\n(SlotReference.prototype as unknown as Record<symbol, boolean>)[SLOT] = true;\n\n/** True for a slot reference of any copy of the runtime. */\nexport function isSlotReference(value: unknown): value is SlotReference {\n return typeof value === 'object' && value !== null && SLOT in value;\n}\n\n/** True for a binding of any copy of the runtime. */\nexport function isBinding(value: unknown): value is Binding {\n return typeof value === 'object' && value !== null && BINDING in value;\n}\n\n/**\n * What `$bind(name)` passes a child: the value of the name, and its slot,\n * which the child's writes of the prop go to.\n */\nexport class Binding<T = unknown> {\n readonly value: T;\n readonly ref: SlotReference;\n /** The function of `$bind(name, fn)`, which a write calls in place of writing the slot. */\n readonly set: unknown;\n\n constructor(value: T, ref: SlotReference, set?: unknown) {\n this.value = value;\n this.ref = ref;\n this.set = set;\n }\n\n /** What a write of the bound prop goes to: the setter, or else the slot. */\n get target(): unknown {\n return this.set ?? this.ref;\n }\n}\n\n(Binding.prototype as unknown as Record<symbol, boolean>)[BINDING] = true;\n\n/**\n * The props that a component destructures, with the values of their\n * bindings. `names` are the props that it destructures by name: the others,\n * which a rest prop holds, keep their bindings, so a spread passes them on.\n * Without `names`, every binding gives its value. `omit` are props that a rest\n * leaves out, because another `$props()` call of the component names them.\n */\nexport function unbind(\n props: Record<string, unknown>,\n names?: readonly string[],\n omit?: readonly string[],\n sink?: PropSink,\n): Record<string, unknown> {\n let result: Record<string, unknown> | undefined;\n // The props that another `$props()` call of the component names, which a rest leaves out.\n if (omit) {\n result = { ...props };\n for (const key of omit) {\n delete result[key];\n }\n props = result;\n }\n for (const key of names ?? Object.keys(props)) {\n const value = props[key];\n if (sink && value instanceof Promise) {\n (sink.props ??= []).push(value);\n }\n if (isBinding(value)) {\n result ??= { ...props };\n result[key] = value.value;\n }\n }\n return result ?? props;\n}\n\n/**\n * What the slot of a memo holds while its compute throws or its promise rejects, and a memo that\n * failed on the server holds from the page state. Each read of the slot throws the error.\n */\nexport class MemoError {\n readonly error: unknown;\n\n constructor(error: unknown) {\n this.error = error;\n }\n}\n\n/**\n * A promise that a parent passed as a prop. It stays a promise in the child, so `await` and\n * `then` work on it. The page state holds it in this wrapper, so the browser knows the slot is\n * a prop and does not replace the promise with its value, as it does for a memo that streams.\n */\nexport class PropPromise {\n readonly promise: Promise<unknown>;\n\n constructor(promise: Promise<unknown>) {\n this.promise = promise;\n (this as Record<symbol, unknown>)[PROP_WRAPPER] = true;\n }\n}\n\n// Symbol.for, so copies of the runtime agree on the marks.\nconst PROP_WRAPPER = Symbol.for('brumate.propWrapper');\n\n/** A scope that collects the promise props that its component receives. */\nexport interface PropSink {\n props?: Promise<unknown>[] | undefined;\n}\n\n/** True for the wrapper that holds a promise prop in the page state. */\nexport function isPropWrapper(value: unknown): value is PropPromise {\n return typeof value === 'object' && value !== null && PROP_WRAPPER in value;\n}\n\n/** A component, which the compiler marks with its ID. */\nexport type ComponentValue = ((...args: never[]) => unknown) & { brumateId: string };\n\n/** The value of a feature that the build turned off, which no page state of it holds. */\nfunction unused(): never {\n throw new Error('The page state holds a value of a feature that no component of the build uses');\n}\n\n/**\n * Makes the values of brumate's plugins. A state record calls them as `$b`,\n * with one letter each, and the plugins read nodes of server function calls\n * with them too, so both give the same values.\n */\nexport const stateValues: {\n /** An element that the server rendered, by its scope and anchor. */\n e: (scope: ScopeId, anchor: number) => ElementReference;\n /** A client function, by its reference and scope. */\n f: (\n ref: string,\n scope: ScopeId,\n args?: unknown[] | null,\n modifiers?: string[],\n ) => FunctionReference;\n /** The parts of a merged handler, which `callable` makes one handler of. */\n m: (parts: FunctionReference[]) => FunctionReference[];\n /** A value of an attribute that brumate writes, such as the scope attribute of a style. */\n i: (value: unknown) => Internal;\n /** HTML that the client may insert again. */\n r: (html: string) => Raw;\n /** Children, by the export that renders them and their scope. */\n n: (ref: string, scope: ScopeId, at?: ScopeId, anchor?: number) => ChildrenReference;\n /**\n * A component, such as the value of a dynamic tag. The client gets a\n * function with the same ID that renders nothing. The client code that\n * changes the value uses the component's render module instead.\n */\n c: (id: string) => ComponentValue;\n /** A slot of a scope, which a bound prop writes. */\n l: (scope: ScopeId, slot: number) => SlotReference;\n /** A binding that a rest prop holds, with its value and its slot. */\n b: (value: unknown, scope: ScopeId, slot: number, set?: unknown) => Binding;\n /** A promise prop. See `PropPromise`. */\n q: (promise: Promise<unknown>) => PropPromise;\n /** The error of a memo that failed on the server. See `MemoError`. */\n x: (error: unknown) => MemoError;\n /** A value of the app, which a plugin of the entry makes from its data. */\n u: (tag: string, data: unknown) => unknown;\n /** A store, with its value, and where `$toStore` made it. See `madeStores`. */\n s: (value: unknown, scope?: ScopeId, site?: number, slot?: number) => Store<unknown>;\n /** A store of `bridge()`, with the data of the server and the name of its bridge. */\n g: (snapshot: unknown, id: string, writable?: number) => Bridged<unknown, unknown>;\n} = {\n e: (scope, anchor) => new ElementReference(scope, anchor),\n f: (ref, scope, args, modifiers) => new FunctionReference(ref, scope, args, modifiers),\n m: (parts) => Object.assign(parts, { [PARTS]: parts }),\n i: (value) => new Internal(value),\n r: raw,\n n: HAS_CHILDREN\n ? (ref, scope, at, anchor) => new ChildrenReference(ref, scope, at, anchor)\n : unused,\n c: (id) => Object.assign(() => '', { brumateId: id }),\n l: (scope, slot) => new SlotReference(scope, slot),\n b: HAS_BINDINGS\n ? (value, scope, slot, set) => new Binding(value, new SlotReference(scope, slot), set)\n : unused,\n q: (promise) => new PropPromise(promise),\n x: (error) => new MemoError(error),\n u: (tag, data) => {\n const plugin = valuePlugins.get(tag);\n if (!plugin) {\n throw new Error(\n `No plugin reads the value \"${tag}\". Export it in the plugins of the serial entry, src/serial.ts`,\n );\n }\n return plugin.fromData(data);\n },\n s: HAS_STORES\n ? (value, scope, site, slot) => {\n const made = new Store(value);\n if (scope !== undefined) {\n made.o = slot === undefined ? [scope, site!] : [scope, site!, slot];\n madeStores.push(made);\n }\n return made;\n }\n : unused,\n g: HAS_BRIDGES\n ? (snapshot, id, writable) =>\n new Bridged<unknown, unknown>(undefined, undefined, id, snapshot, writable === 1)\n : unused,\n};\n\n/**\n * The stores of providers that the page state made, until the core links them to their scopes:\n * a store of `$toStore(signal)` writes the signal of its provider.\n */\nexport const madeStores: Store<unknown>[] = [];\n\n/** The value of a `$gate`, which cannot be a promise or a stream. A throw is held like a memo error. */\nexport function gateValue<T>(value: T): T {\n if (\n (value !== null &&\n typeof value === 'object' &&\n typeof (value as { then?: unknown }).then === 'function') ||\n isAsyncIterable(value)\n ) {\n throw new TypeError(\n 'The value of $gate is a promise or a stream. Use $memo for a value that loads',\n );\n }\n return value;\n}\n\n/** True for a value that `for await` reads, such as the result of an async generator. */\nexport function isAsyncIterable(value: unknown): value is AsyncIterable<unknown> {\n return (\n value !== null &&\n typeof value === 'object' &&\n typeof (value as AsyncIterable<unknown>)[Symbol.asyncIterator] === 'function'\n );\n}\n\n/**\n * A read of `$store`: the key of the context, or the index of the source in the exports `z` of\n * the component; the slot; the key of the store in the value of the context; and 1 when `let`\n * writes the store.\n */\nexport type StoreRead = [from: string | number, slot: number, path?: string, write?: 1];\n\n/** The state of one scope in the page. */\nexport interface ScopeState {\n /** The scope's ID in the compiled component. */\n k?: number;\n /** The ID of the scope that contains this one. Component root scopes have none. */\n p?: ScopeId;\n /** The component ID of a component's root scope. */\n m?: string;\n /** The item of a list item scope. */\n i?: unknown;\n /** The scope that rendered a component's root scope, for finding contexts. */\n o?: ScopeId;\n /**\n * For a scope of children that a component inserted, the scope where they\n * are, which contexts are found from in place of `p` and `o`.\n */\n t?: ScopeId;\n /** For a component that passes its children on, the scope where they are finally inserted. */\n f?: ScopeId;\n /** For the scope of a template, the scope where it was called, which errors go to. */\n l?: ScopeId;\n /** The values that the scope provides, by context key. */\n v?: Record<string, unknown>;\n /** The slots that hold the contexts that the scope reads, by context key. */\n x?: Record<string, number>;\n /**\n * The slots that hold the values of stores that `$store` reads: the key of the context, the\n * slot, and the key of the context value that holds the store, when it is not the value.\n */\n z?: StoreRead[];\n /** Slot values, in the order of the scope's layout. */\n s?: unknown[];\n /** The scope IDs of child components, by anchor index. */\n c?: Record<number, ScopeId>;\n /**\n * What the bound props of a component write, by the slot of the prop: a\n * slot of a parent, or the function of `$bind(name, fn)`.\n */\n b?: Record<number, unknown>;\n /**\n * The setters of `ref=$bind(x, fn)` that reached an element through rest props, by the anchor\n * of the element. The client calls each once on resume.\n */\n r?: Record<number, unknown>;\n}\n\n/** The state of a page, by scope ID. */\nexport type PageState = Record<ScopeId, ScopeState>;\n\n/**\n * The flags of a group of scope records in `PackedState`:\n * - `ITEM_SLOT`: the item of each scope is its first slot.\n * - `ITEM`: each scope has its item after its slots.\n * - `CHILDREN`: each scope has its child components after that.\n * - `OWNER`: the scopes are component root scopes. `base` is the distance from the scope that\n * rendered each one, `o`, to the scope, and the first gap is from 0. Otherwise `base` is the\n * parent, `p`, of every scope.\n * - `MODULE`: the group has the component ID of its scopes after its header.\n * - `SOURCE`: the scopes are the items of a list whose list is a slot of an enclosing scope.\n * The header then has that scope's ID and the slot's index, and the items are not written:\n * the item of the scope at position `n` in the group is the value at `n` of the list, or of\n * `Array.from` of a Set. With `ITEM_SLOT`, each scope writes its slots after the first.\n * - `PREFIX`: the scopes are inside a `#loading` body. The header ends with the prefix of\n * their IDs, such as `5.`, and the gaps count the numbers after it.\n */\nexport const ITEM_SLOT = 1;\nexport const ITEM = 2;\nexport const CHILDREN = 4;\nexport const OWNER = 8;\nexport const MODULE = 16;\nexport const SOURCE = 32;\nexport const PREFIX = 64;\n\n/**\n * The page state as the server writes it. Records of scopes that share their\n * kind, their parent or owner, and their shape are in one group of `g`,\n * such as the items of a list, instead of one object each. A group is a flat\n * array: `[kind, base, flags, slotCount, module?, source?, sourceSlot?, prefix?, ...scopes]`, and each scope\n * is its ID as the gap from the one before it (the first from `base`), its\n * slots, and then its item and its child components, as `flags` says.\n */\nexport type PackedState = PageState & { g?: unknown[][] };\n\n/**\n * How a field of a state record holds scope IDs:\n * - `none`: no ID.\n * - `id`: the value is an ID.\n * - `ids`: an object whose values are IDs.\n * - `value`: a value that may hold references, such as an item.\n * - `values`: an array of such values.\n * - `map`: an object whose values are such values.\n */\nexport type FieldKind = 'none' | 'id' | 'ids' | 'value' | 'values' | 'map';\n\n/**\n * A table of the fields of a state record and the reference classes that hold\n * a scope ID, which each keep it in `scope`. Code that moves the IDs reads it.\n * A new field of `ScopeState` fails to compile until it is in `fields`, and\n * `holders` are the classes that keep references in their own fields, such as\n * `Binding`, whose `ref` and `set` hold IDs. `scope-ids.test.ts` parses this\n * file and fails for any class in it, of any shape, that is not in\n * `references` or `holders` or in the test's list of classes without IDs.\n * It checks class names only, so a person decides which list a new class\n * belongs in.\n */\nexport const SCOPE_IDS: {\n fields: Record<keyof ScopeState, FieldKind>;\n references: readonly (abstract new (...args: never[]) => { scope: ScopeId })[];\n holders: readonly (abstract new (...args: never[]) => object)[];\n} = {\n fields: {\n k: 'none',\n p: 'id',\n m: 'none',\n i: 'value',\n o: 'id',\n t: 'id',\n f: 'id',\n l: 'id',\n v: 'map',\n x: 'none',\n z: 'none',\n s: 'values',\n c: 'ids',\n b: 'map',\n r: 'map',\n },\n references: [ElementReference, FunctionReference, ChildrenReference, SlotReference],\n holders: [Binding],\n};\n"],"mappings":";;;;;AAWA,MAAM,+BAAe,IAAI,IAAyB;AAClD,MAAM,kBAAqD,CAAC;;AAE5D,IAAI,eAA6C,CAAC;AAClD,MAAM,kBAAuE,CAAC;;;;;;AAO9E,SAAgB,eAAe,OAA0B;CACvD,MAAM,EAAE,UAAU,CAAC,GAAG,GAAG,YAAY;CACrC,IAAI,QAAQ,qBAAqB,KAAA,KAAa,QAAQ,eAAe,KAAA,GAAW;EAC9E,eAAe;EACf,KAAK,MAAM,YAAY,iBACrB,SAAS,OAAO;CAEpB;CACA,eAAe,OAAO;AACxB;;AAGA,SAAgB,gBAAgB,UAAiE;CAC/F,gBAAgB,KAAK,QAAQ;CAC7B,SAAS,YAAY;AACvB;;AAGA,SAAS,eAAe,SAAuC;CAC7D,KAAK,MAAM,UAAU,SAAS;EAC5B,IAAI,aAAa,IAAI,OAAO,GAAG,MAAM,QACnC;EAEF,aAAa,IAAI,OAAO,KAAK,MAAM;EACnC,KAAK,MAAM,YAAY,iBACrB,SAAS,MAAM;CAEnB;AACF;;AAGA,SAAgB,cAAc,UAA+C;CAC3E,gBAAgB,KAAK,QAAQ;CAC7B,KAAK,MAAM,UAAU,aAAa,OAAO,GACvC,SAAS,MAAM;AAEnB;;AAWA,SAAgB,QAAQ,MAAuB;CAC7C,OAAO,UAAU,KAAK,IAAI,IAAI,OAAO,IAAI,IAAI;AAC/C;;AAYA,IAAa,mBAAb,MAA8B;CAC5B;CACA;CAEA,YAAY,OAA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B,IAAI,UAAU,KAAA,GAAW;GACvB,KAAK,IAAI,SAAS,KAAA,IAAY,CAAC,OAAO,IAAK,IAAI;IAAC;IAAO;IAAO;GAAI;GAClE,WAAW,KAAK,IAAI;EACtB;EACA,OAAO;CACT,IACA;CACJ,GAAG,eACE,UAAU,IAAI,aACb,IAAI,QAA0B,KAAA,GAAW,KAAA,GAAW,IAAI,UAAU,aAAa,CAAC,IAClF;AACN;;;;;AAMA,MAAa,aAA+B,CAAC;;AAG7C,SAAgB,UAAa,OAAa;CACxC,IACG,UAAU,QACT,OAAO,UAAU,YACjB,OAAQ,MAA6B,SAAS,cAChD,gBAAgB,KAAK,GAErB,MAAM,IAAI,UACR,+EACF;CAEF,OAAO;AACT;;AAGA,SAAgB,gBAAgB,OAAiD;CAC/E,OACE,UAAU,QACV,OAAO,UAAU,YACjB,OAAQ,MAAiC,OAAO,mBAAmB;AAEvE;;;;;;;;;;;;AAkHA,MAAa,YAIT;CACF,QAAQ;EACN,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;CACL;CACA,YAAY;EAAC;EAAkB;EAAmB;EAAmB;CAAa;CAClF,SAAS,CAAC,OAAO;AACnB"}
1
+ {"version":3,"file":"shared-CUBWrbiM.js","names":[],"sources":["../src/runtime/shared.ts"],"sourcesContent":["// Values and types that the server and the browser share. It does not import\n// seroval, so the core, which reads the page state without it, stays small.\n// The plugins that write and read these values are in `serial.ts`.\n\nimport { HAS_BINDINGS, HAS_BRIDGES, HAS_CHILDREN, HAS_STORES } from './features.ts';\nimport { Internal, ownValue, raw } from './html.ts';\nimport type { Raw } from './html.ts';\nimport { Bridged, Store } from './store.ts';\nimport type { SerialEntry, ValuePlugin } from './values.ts';\n\n/** The plugins of values of the app, by tag, which the entry `src/serial.ts` exports. */\nconst valuePlugins = new Map<string, ValuePlugin>();\nconst pluginListeners: ((plugin: ValuePlugin) => void)[] = [];\n/** The options of the entry, which the serializer reads when it loads. */\nlet entryOptions: Omit<SerialEntry, 'plugins'> = {};\nconst optionListeners: ((options: Omit<SerialEntry, 'plugins'>) => void)[] = [];\n\n/**\n * Takes the exports of the serial entry: its plugins and the options that it\n * changes. The server and the loader call it before the first value is\n * written or read.\n */\nexport function useSerialEntry(entry: SerialEntry): void {\n const { plugins = [], ...options } = entry;\n if (options.disabledFeatures !== undefined || options.depthLimit !== undefined) {\n entryOptions = options;\n for (const listener of optionListeners) {\n listener(options);\n }\n }\n registerValues(plugins);\n}\n\n/** Calls `listener` with the options of the entry, now and when they change. */\nexport function onSerialOptions(listener: (options: Omit<SerialEntry, 'plugins'>) => void): void {\n optionListeners.push(listener);\n listener(entryOptions);\n}\n\n/** Adds plugins of values of the app. */\nfunction registerValues(plugins: readonly ValuePlugin[]): void {\n for (const plugin of plugins) {\n if (valuePlugins.get(plugin.tag) === plugin) {\n continue;\n }\n valuePlugins.set(plugin.tag, plugin);\n for (const listener of pluginListeners) {\n listener(plugin);\n }\n }\n}\n\n/** Calls `listener` for each plugin of the app, those added so far and those added later. */\nexport function onValuePlugin(listener: (plugin: ValuePlugin) => void): void {\n pluginListeners.push(listener);\n for (const plugin of valuePlugins.values()) {\n listener(plugin);\n }\n}\n\n/**\n * The ID of a scope or of a `#loading` boundary. The rest of the page numbers\n * its scopes from the base of the render, such as `3`. A `#loading` body\n * numbers its own from 0 after the ID of its boundary and a dot, such as\n * `5.0` and `5.1`, so its IDs do not depend on when its data arrives.\n */\nexport type ScopeId = number | string;\n\n/** Reads a scope or boundary ID from markup. */\nexport function parseId(text: string): ScopeId {\n return /^-?\\d+$/.test(text) ? Number(text) : text;\n}\n\n/** Adds a number to an ID. An ID inside a boundary moves with its boundary. */\nexport function shiftId(id: ScopeId, by: number): ScopeId {\n if (typeof id === 'number') {\n return id + by;\n }\n const dot = id.indexOf('.');\n return `${Number(id.slice(0, dot)) + by}${id.slice(dot)}`;\n}\n\n/** An element that the server rendered. The client finds it by its anchor. */\nexport class ElementReference {\n readonly scope: ScopeId;\n readonly anchor: number;\n\n constructor(scope: ScopeId, anchor: number) {\n this.scope = scope;\n this.anchor = anchor;\n }\n}\n\n/** A client function: an export of a client module, and the scope it reads. */\n/** The key of the reference of children on the server, which the page state sends. */\nexport const CHILDREN_REF: unique symbol = Symbol.for('brumate.children') as never;\n\n/**\n * The children of a component in the page state: the export that renders them in the browser,\n * such as `Page_1a2b#n0`, and the scope that they were written in. Each insert renders them\n * again, with new scopes, as the body of a block does.\n */\nexport class ChildrenReference {\n readonly ref: string;\n readonly scope: ScopeId;\n /** The scope and the anchor of the insert where the server rendered them, if it did. */\n at: ScopeId | undefined;\n anchor: number | undefined;\n\n constructor(ref: string, scope: ScopeId, at?: ScopeId, anchor?: number) {\n this.ref = ref;\n this.scope = scope;\n this.at = at;\n this.anchor = anchor;\n }\n}\n\nexport class FunctionReference {\n /** `<component id>#<export name>`. */\n readonly ref: string;\n readonly scope: ScopeId;\n /** The arguments of a handler that `$handler` made, which come before the event. */\n readonly args: unknown[] | undefined;\n /** The modifiers of the wrappers of a handler, such as `prevent`, for the `b-on` of a spread. */\n readonly modifiers: string[] | undefined;\n\n constructor(ref: string, scope: ScopeId, args?: unknown[] | null, modifiers?: string[]) {\n this.ref = ref;\n this.scope = scope;\n this.args = args ?? undefined;\n this.modifiers = modifiers;\n }\n}\n\n/** The handlers that a merged handler calls, in order. A symbol of the registry. */\nexport const PARTS: unique symbol = Symbol.for('brumate.parts');\n\n// oxlint-disable-next-line typescript/no-explicit-any -- Handlers take any event.\ntype Handler = (...args: any[]) => unknown;\n\n/**\n * One handler that calls each of `handlers` in order, with the same arguments. A prop holds one\n * handler per event, and the browser takes one `b-on` entry for each part. Merged handlers in\n * `handlers` give their parts, so the list stays flat.\n */\nexport function mergeHandlers(handlers: Handler[]): Handler {\n const parts: Handler[] = [];\n for (const handler of handlers) {\n parts.push(...((handler as { [PARTS]?: Handler[] })[PARTS] ?? [handler]));\n }\n return Object.assign(\n (...args: unknown[]): void => {\n for (const part of parts) {\n part(...args);\n }\n },\n { [PARTS]: parts },\n );\n}\n\n/**\n * Adds a handler prop, such as `onClick`, for each entry of the scoped `b-on` of a dynamic tag\n * that names a component. `make` makes the handler of a reference. A handler of the same event in\n * `props`, such as a rest prop passed on, is merged with it and runs first.\n */\nexport function addEntryHandlers(\n props: Record<string, unknown>,\n entries: unknown,\n scope: ScopeId | undefined,\n make: (reference: FunctionReference) => Handler,\n): void {\n for (const entry of (ownValue('b-on', entries) as string | undefined)?.split(' ') ?? []) {\n const [event, target] = entry.split('=') as [string, string];\n const [name, ...modifiers] = event.split(':') as [string, ...string[]];\n const [ref, at] = target.split('@') as [string, string?];\n const handler = make(\n new FunctionReference(\n ref,\n /^\\d+$/.test(at ?? '') ? Number(at) : (at ?? scope!),\n undefined,\n modifiers.length > 0 ? modifiers : undefined,\n ),\n );\n const key = `on${name[0]!.toUpperCase()}${name.slice(1)}`;\n const before = props[key];\n props[key] =\n typeof before === 'function' ? mergeHandlers([before as Handler, handler]) : handler;\n }\n}\n\n// Brands of bindings and slot references, under keys of the registry, so two copies of the\n// runtime, such as a component's and the render context's, know each other's.\nconst BINDING = Symbol.for('brumate.binding');\nconst SLOT = Symbol.for('brumate.slot');\n\n/** A slot of a scope, which a write of a bound prop goes to. */\nexport class SlotReference {\n readonly scope: ScopeId;\n readonly slot: number;\n\n constructor(scope: ScopeId, slot: number) {\n this.scope = scope;\n this.slot = slot;\n }\n}\n\n(SlotReference.prototype as unknown as Record<symbol, boolean>)[SLOT] = true;\n\n/** True for a slot reference of any copy of the runtime. */\nexport function isSlotReference(value: unknown): value is SlotReference {\n return typeof value === 'object' && value !== null && SLOT in value;\n}\n\n/** True for a binding of any copy of the runtime. */\nexport function isBinding(value: unknown): value is Binding {\n return typeof value === 'object' && value !== null && BINDING in value;\n}\n\n/**\n * What `$bind(name)` passes a child: the value of the name, and its slot,\n * which the child's writes of the prop go to.\n */\nexport class Binding<T = unknown> {\n readonly value: T;\n readonly ref: SlotReference;\n /** The function of `$bind(name, fn)`, which a write calls in place of writing the slot. */\n readonly set: unknown;\n\n constructor(value: T, ref: SlotReference, set?: unknown) {\n this.value = value;\n this.ref = ref;\n this.set = set;\n }\n\n /** What a write of the bound prop goes to: the setter, or else the slot. */\n get target(): unknown {\n return this.set ?? this.ref;\n }\n}\n\n(Binding.prototype as unknown as Record<symbol, boolean>)[BINDING] = true;\n\n/**\n * The props that a component destructures, with the values of their\n * bindings. `names` are the props that it destructures by name: the others,\n * which a rest prop holds, keep their bindings, so a spread passes them on.\n * Without `names`, every binding gives its value. `omit` are props that a rest\n * leaves out, because another `$props()` call of the component names them.\n */\nexport function unbind(\n props: Record<string, unknown>,\n names?: readonly string[],\n omit?: readonly string[],\n sink?: PropSink,\n): Record<string, unknown> {\n let result: Record<string, unknown> | undefined;\n // The props that another `$props()` call of the component names, which a rest leaves out.\n if (omit) {\n result = { ...props };\n for (const key of omit) {\n delete result[key];\n }\n props = result;\n }\n for (const key of names ?? Object.keys(props)) {\n const value = props[key];\n if (sink && value instanceof Promise) {\n (sink.props ??= []).push(value);\n }\n if (isBinding(value)) {\n result ??= { ...props };\n result[key] = value.value;\n }\n }\n return result ?? props;\n}\n\n/**\n * What the slot of a memo holds while its compute throws or its promise rejects, and a memo that\n * failed on the server holds from the page state. Each read of the slot throws the error.\n */\nexport class MemoError {\n readonly error: unknown;\n\n constructor(error: unknown) {\n this.error = error;\n }\n}\n\n/**\n * A promise that a parent passed as a prop. It stays a promise in the child, so `await` and\n * `then` work on it. The page state holds it in this wrapper, so the browser knows the slot is\n * a prop and does not replace the promise with its value, as it does for a memo that streams.\n */\nexport class PropPromise {\n readonly promise: Promise<unknown>;\n\n constructor(promise: Promise<unknown>) {\n this.promise = promise;\n (this as Record<symbol, unknown>)[PROP_WRAPPER] = true;\n }\n}\n\n// Symbol.for, so copies of the runtime agree on the marks.\nconst PROP_WRAPPER = Symbol.for('brumate.propWrapper');\n\n/** A scope that collects the promise props that its component receives. */\nexport interface PropSink {\n props?: Promise<unknown>[] | undefined;\n}\n\n/** True for the wrapper that holds a promise prop in the page state. */\nexport function isPropWrapper(value: unknown): value is PropPromise {\n return typeof value === 'object' && value !== null && PROP_WRAPPER in value;\n}\n\n/** A component, which the compiler marks with its ID. */\nexport type ComponentValue = ((...args: never[]) => unknown) & { brumateId: string };\n\n/** The value of a feature that the build turned off, which no page state of it holds. */\nfunction unused(): never {\n throw new Error('The page state holds a value of a feature that no component of the build uses');\n}\n\n/**\n * Makes the values of brumate's plugins. A state record calls them as `$b`,\n * with one letter each, and the plugins read nodes of server function calls\n * with them too, so both give the same values.\n */\nexport const stateValues: {\n /** An element that the server rendered, by its scope and anchor. */\n e: (scope: ScopeId, anchor: number) => ElementReference;\n /** A client function, by its reference and scope. */\n f: (\n ref: string,\n scope: ScopeId,\n args?: unknown[] | null,\n modifiers?: string[],\n ) => FunctionReference;\n /** The parts of a merged handler, which `callable` makes one handler of. */\n m: (parts: FunctionReference[]) => FunctionReference[];\n /** A value of an attribute that brumate writes, such as the scope attribute of a style. */\n i: (value: unknown) => Internal;\n /** HTML that the client may insert again. */\n r: (html: string) => Raw;\n /** Children, by the export that renders them and their scope. */\n n: (ref: string, scope: ScopeId, at?: ScopeId, anchor?: number) => ChildrenReference;\n /**\n * A component, such as the value of a dynamic tag. The client gets a\n * function with the same ID that renders nothing. The client code that\n * changes the value uses the component's render module instead.\n */\n c: (id: string) => ComponentValue;\n /** A slot of a scope, which a bound prop writes. */\n l: (scope: ScopeId, slot: number) => SlotReference;\n /** A binding that a rest prop holds, with its value and its slot. */\n b: (value: unknown, scope: ScopeId, slot: number, set?: unknown) => Binding;\n /** A promise prop. See `PropPromise`. */\n q: (promise: Promise<unknown>) => PropPromise;\n /** The error of a memo that failed on the server. See `MemoError`. */\n x: (error: unknown) => MemoError;\n /** A value of the app, which a plugin of the entry makes from its data. */\n u: (tag: string, data: unknown) => unknown;\n /** A store, with its value, and where `$toStore` made it. See `madeStores`. */\n s: (value: unknown, scope?: ScopeId, site?: number, slot?: number) => Store<unknown>;\n /** A store of `bridge()`, with the data of the server and the name of its bridge. */\n g: (snapshot: unknown, id: string, writable?: number) => Bridged<unknown, unknown>;\n} = {\n e: (scope, anchor) => new ElementReference(scope, anchor),\n f: (ref, scope, args, modifiers) => new FunctionReference(ref, scope, args, modifiers),\n m: (parts) => Object.assign(parts, { [PARTS]: parts }),\n i: (value) => new Internal(value),\n r: raw,\n n: HAS_CHILDREN\n ? (ref, scope, at, anchor) => new ChildrenReference(ref, scope, at, anchor)\n : unused,\n c: (id) => Object.assign(() => '', { brumateId: id }),\n l: (scope, slot) => new SlotReference(scope, slot),\n b: HAS_BINDINGS\n ? (value, scope, slot, set) => new Binding(value, new SlotReference(scope, slot), set)\n : unused,\n q: (promise) => new PropPromise(promise),\n x: (error) => new MemoError(error),\n u: (tag, data) => {\n const plugin = valuePlugins.get(tag);\n if (!plugin) {\n throw new Error(\n `No plugin reads the value \"${tag}\". Export it in the plugins of the serial entry, src/serial.ts`,\n );\n }\n return plugin.fromData(data);\n },\n s: HAS_STORES\n ? (value, scope, site, slot) => {\n const made = new Store(value);\n if (scope !== undefined) {\n made.o = slot === undefined ? [scope, site!] : [scope, site!, slot];\n madeStores.push(made);\n }\n return made;\n }\n : unused,\n g: HAS_BRIDGES\n ? (snapshot, id, writable) =>\n new Bridged<unknown, unknown>(undefined, undefined, id, snapshot, writable === 1)\n : unused,\n};\n\n/**\n * The stores of providers that the page state made, until the core links them to their scopes:\n * a store of `$toStore(signal)` writes the signal of its provider.\n */\nexport const madeStores: Store<unknown>[] = [];\n\n/** The value of a `$gate`, which cannot be a promise or a stream. A throw is held like a memo error. */\nexport function gateValue<T>(value: T): T {\n if (\n (value !== null &&\n typeof value === 'object' &&\n typeof (value as { then?: unknown }).then === 'function') ||\n isAsyncIterable(value)\n ) {\n throw new TypeError(\n 'The value of $gate is a promise or a stream. Use $memo for a value that loads',\n );\n }\n return value;\n}\n\n/** True for a value that `for await` reads, such as the result of an async generator. */\nexport function isAsyncIterable(value: unknown): value is AsyncIterable<unknown> {\n return (\n value !== null &&\n typeof value === 'object' &&\n typeof (value as AsyncIterable<unknown>)[Symbol.asyncIterator] === 'function'\n );\n}\n\n/**\n * A read of `$store`: the key of the context, or the index of the source in the exports `z` of\n * the component; the slot; the key of the store in the value of the context; and 1 when `let`\n * writes the store.\n */\nexport type StoreRead = [from: string | number, slot: number, path?: string, write?: 1];\n\n/** The state of one scope in the page. */\nexport interface ScopeState {\n /** The scope's ID in the compiled component. */\n k?: number;\n /** The ID of the scope that contains this one. Component root scopes have none. */\n p?: ScopeId;\n /** The component ID of a component's root scope. */\n m?: string;\n /** The item of a list item scope. */\n i?: unknown;\n /** The scope that rendered a component's root scope, for finding contexts. */\n o?: ScopeId;\n /**\n * For a scope of children that a component inserted, the scope where they\n * are, which contexts are found from in place of `p` and `o`.\n */\n t?: ScopeId;\n /** For a component that passes its children on, the scope where they are finally inserted. */\n f?: ScopeId;\n /** For the scope of a template, the scope where it was called, which errors go to. */\n l?: ScopeId;\n /** The values that the scope provides, by context key. */\n v?: Record<string, unknown>;\n /** The slots that hold the contexts that the scope reads, by context key. */\n x?: Record<string, number>;\n /**\n * The slots that hold the values of stores that `$store` reads: the key of the context, the\n * slot, and the key of the context value that holds the store, when it is not the value.\n */\n z?: StoreRead[];\n /** Slot values, in the order of the scope's layout. */\n s?: unknown[];\n /** The scope IDs of child components, by anchor index. */\n c?: Record<number, ScopeId>;\n /**\n * What the bound props of a component write, by the slot of the prop: a\n * slot of a parent, or the function of `$bind(name, fn)`.\n */\n b?: Record<number, unknown>;\n /**\n * The setters of `ref=$bind(x, fn)` that reached an element through rest props, by the anchor\n * of the element. The client calls each once on resume.\n */\n r?: Record<number, unknown>;\n}\n\n/** The state of a page, by scope ID. */\nexport type PageState = Record<ScopeId, ScopeState>;\n\n/**\n * The flags of a group of scope records in `PackedState`:\n * - `ITEM_SLOT`: the item of each scope is its first slot.\n * - `ITEM`: each scope has its item after its slots.\n * - `CHILDREN`: each scope has its child components after that.\n * - `OWNER`: the scopes are component root scopes. `base` is the distance from the scope that\n * rendered each one, `o`, to the scope, and the first gap is from 0. Otherwise `base` is the\n * parent, `p`, of every scope.\n * - `MODULE`: the group has the component ID of its scopes after its header.\n * - `SOURCE`: the scopes are the items of a list whose list is a slot of an enclosing scope.\n * The header then has that scope's ID and the slot's index, and the items are not written:\n * the item of the scope at position `n` in the group is the value at `n` of the list, or of\n * `Array.from` of a Set. With `ITEM_SLOT`, each scope writes its slots after the first.\n * - `PREFIX`: the scopes are inside a `#loading` body. The header ends with the prefix of\n * their IDs, such as `5.`, and the gaps count the numbers after it.\n */\nexport const ITEM_SLOT = 1;\nexport const ITEM = 2;\nexport const CHILDREN = 4;\nexport const OWNER = 8;\nexport const MODULE = 16;\nexport const SOURCE = 32;\nexport const PREFIX = 64;\n\n/**\n * The page state as the server writes it. Records of scopes that share their\n * kind, their parent or owner, and their shape are in one group of `g`,\n * such as the items of a list, instead of one object each. A group is a flat\n * array: `[kind, base, flags, slotCount, module?, source?, sourceSlot?, prefix?, ...scopes]`, and each scope\n * is its ID as the gap from the one before it (the first from `base`), its\n * slots, and then its item and its child components, as `flags` says.\n */\nexport type PackedState = PageState & { g?: unknown[][] };\n\n/**\n * How a field of a state record holds scope IDs:\n * - `none`: no ID.\n * - `id`: the value is an ID.\n * - `ids`: an object whose values are IDs.\n * - `value`: a value that may hold references, such as an item.\n * - `values`: an array of such values.\n * - `map`: an object whose values are such values.\n */\nexport type FieldKind = 'none' | 'id' | 'ids' | 'value' | 'values' | 'map';\n\n/**\n * A table of the fields of a state record and the reference classes that hold\n * a scope ID, which each keep it in `scope`. Code that moves the IDs reads it.\n * A new field of `ScopeState` fails to compile until it is in `fields`, and\n * `holders` are the classes that keep references in their own fields, such as\n * `Binding`, whose `ref` and `set` hold IDs. `scope-ids.test.ts` parses this\n * file and fails for any class in it, of any shape, that is not in\n * `references` or `holders` or in the test's list of classes without IDs.\n * It checks class names only, so a person decides which list a new class\n * belongs in.\n */\nexport const SCOPE_IDS: {\n fields: Record<keyof ScopeState, FieldKind>;\n references: readonly (abstract new (...args: never[]) => { scope: ScopeId })[];\n holders: readonly (abstract new (...args: never[]) => object)[];\n} = {\n fields: {\n k: 'none',\n p: 'id',\n m: 'none',\n i: 'value',\n o: 'id',\n t: 'id',\n f: 'id',\n l: 'id',\n v: 'map',\n x: 'none',\n z: 'none',\n s: 'values',\n c: 'ids',\n b: 'map',\n r: 'map',\n },\n references: [ElementReference, FunctionReference, ChildrenReference, SlotReference],\n holders: [Binding],\n};\n"],"mappings":";;;;;AAWA,MAAM,+BAAe,IAAI,IAAyB;AAClD,MAAM,kBAAqD,CAAC;;AAE5D,IAAI,eAA6C,CAAC;AAClD,MAAM,kBAAuE,CAAC;;;;;;AAO9E,SAAgB,eAAe,OAA0B;CACvD,MAAM,EAAE,UAAU,CAAC,GAAG,GAAG,YAAY;CACrC,IAAI,QAAQ,qBAAqB,KAAA,KAAa,QAAQ,eAAe,KAAA,GAAW;EAC9E,eAAe;EACf,KAAK,MAAM,YAAY,iBACrB,SAAS,OAAO;CAEpB;CACA,eAAe,OAAO;AACxB;;AAGA,SAAgB,gBAAgB,UAAiE;CAC/F,gBAAgB,KAAK,QAAQ;CAC7B,SAAS,YAAY;AACvB;;AAGA,SAAS,eAAe,SAAuC;CAC7D,KAAK,MAAM,UAAU,SAAS;EAC5B,IAAI,aAAa,IAAI,OAAO,GAAG,MAAM,QACnC;EAEF,aAAa,IAAI,OAAO,KAAK,MAAM;EACnC,KAAK,MAAM,YAAY,iBACrB,SAAS,MAAM;CAEnB;AACF;;AAGA,SAAgB,cAAc,UAA+C;CAC3E,gBAAgB,KAAK,QAAQ;CAC7B,KAAK,MAAM,UAAU,aAAa,OAAO,GACvC,SAAS,MAAM;AAEnB;;AAWA,SAAgB,QAAQ,MAAuB;CAC7C,OAAO,UAAU,KAAK,IAAI,IA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B;CACA,GAAG,cACE,OAAO,OAAO,MAAM,SAAS;EAC5B,MAAM,OAAO,IAAI,MAAM,KAAK;EAC5B,IAAI,UAAU,KAAA,GAAW;GACvB,KAAK,IAAI,SAAS,KAAA,IAAY,CAAC,OAAO,IAAK,IAAI;IAAC;IAAO;IAAO;GAAI;GAClE,WAAW,KAAK,IAAI;EACtB;EACA,OAAO;CACT,IACA;CACJ,GAAG,eACE,UAAU,IAAI,aACb,IAAI,QAA0B,KAAA,GAAW,KAAA,GAAW,IAAI,UAAU,aAAa,CAAC,IAClF;AACN;;;;;AAMA,MAAa,aAA+B,CAAC;;AAG7C,SAAgB,UAAa,OAAa;CACxC,IACG,UAAU,QACT,OAAO,UAAU,YACjB,OAAQ,MAA6B,SAAS,cAChD,gBAAgB,KAAK,GAErB,MAAM,IAAI,UACR,+EACF;CAEF,OAAO;AACT;;AAGA,SAAgB,gBAAgB,OAAiD;CAC/E,OACE,UAAU,QACV,OAAO,UAAU,YACjB,OAAQ,MAAiC,OAAO,mBAAmB;AAEvE;;;;;;;;;;;;AAkHA,MAAa,YAIT;CACF,QAAQ;EACN,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;CACL;CACA,YAAY;EAAC;EAAkB;EAAmB;EAAmB;CAAa;CAClF,SAAS,CAAC,OAAO;AACnB"}
@@ -0,0 +1,105 @@
1
+ //#region src/runtime/sheets.ts
2
+ /** A stylesheet link. */
3
+ const SHEET = "link[rel~=\"stylesheet\"][href]";
4
+ /** How long a swap waits for a stylesheet, in milliseconds. A stylesheet that is slower shows late. */
5
+ const WAIT = 4e3;
6
+ /** The URL of a stylesheet link, which is what makes two links the same stylesheet. */
7
+ function sheetKey(link) {
8
+ return new URL(link.getAttribute("href"), location.href).href;
9
+ }
10
+ /** True when a stylesheet link of the page, other than those in `ignore`, has this URL. */
11
+ function hasSheet(key, ignore) {
12
+ for (const link of document.querySelectorAll(SHEET)) if (link.isConnected && !ignore?.has(link) && sheetKey(link) === key) return true;
13
+ return false;
14
+ }
15
+ /**
16
+ * Makes stylesheets of the preloads that a first load writes (`b-sheet`). A page that a navigation
17
+ * fetches can have them, such as from a static host that ignores the request headers, and the
18
+ * swap must wait for them like for any stylesheet.
19
+ */
20
+ function linkPreloads(root) {
21
+ for (const link of root.querySelectorAll("link[rel=preload][b-sheet]")) {
22
+ link.setAttribute("rel", "stylesheet");
23
+ link.removeAttribute("as");
24
+ link.removeAttribute("b-sheet");
25
+ }
26
+ for (const fallback of root.querySelectorAll("noscript[b-sheet]")) fallback.remove();
27
+ }
28
+ /** The stylesheet links of a tree, including those in the content of its `<template>` elements. */
29
+ function findSheets(root) {
30
+ const found = [...root.querySelectorAll(SHEET)];
31
+ for (const template of root.querySelectorAll("template")) found.push(...findSheets(template.content));
32
+ return found;
33
+ }
34
+ /**
35
+ * Loads the stylesheets that a tree of markup links and the page does not have yet, so they are in
36
+ * the cache when the markup comes in and no frame shows it unstyled. It waits for each one to load
37
+ * or fail, and stops waiting after a few seconds, or when the signal aborts. The links that the
38
+ * page has stay: a URL loads once.
39
+ */
40
+ async function preloadSheets(root, signal) {
41
+ const waits = [];
42
+ const started = /* @__PURE__ */ new Set();
43
+ const added = [];
44
+ for (const link of findSheets(root)) {
45
+ const key = sheetKey(link);
46
+ if (started.has(key) || hasSheet(key)) continue;
47
+ started.add(key);
48
+ const preload = document.createElement("link");
49
+ preload.rel = "preload";
50
+ preload.as = "style";
51
+ preload.href = key;
52
+ const nonce = link.getAttribute("nonce");
53
+ if (nonce) preload.setAttribute("nonce", nonce);
54
+ waits.push(new Promise((resolve) => {
55
+ preload.onload = preload.onerror = () => resolve();
56
+ }));
57
+ added.push(preload);
58
+ document.head.append(preload);
59
+ }
60
+ if (added.length === 0) return;
61
+ let timer;
62
+ let stop;
63
+ try {
64
+ await Promise.race([
65
+ Promise.all(waits),
66
+ new Promise((resolve) => {
67
+ timer = setTimeout(resolve, WAIT);
68
+ }),
69
+ new Promise((resolve) => {
70
+ stop = () => resolve();
71
+ signal?.addEventListener("abort", stop, { once: true });
72
+ })
73
+ ]);
74
+ } finally {
75
+ clearTimeout(timer);
76
+ if (stop) signal?.removeEventListener("abort", stop);
77
+ for (const preload of added) preload.remove();
78
+ }
79
+ }
80
+ /** The scopes (`b-c-<hash>`) that the rules of a loaded stylesheet use, by link. */
81
+ const scopes = /* @__PURE__ */ new WeakMap();
82
+ /** The scope attributes of a stylesheet, or none when it is not loaded or cannot be read. */
83
+ function scopesOf(link) {
84
+ let found = scopes.get(link);
85
+ if (!found) {
86
+ found = [];
87
+ try {
88
+ const names = /* @__PURE__ */ new Set();
89
+ for (const rule of link.sheet ? Array.from(link.sheet.cssRules) : []) for (const name of rule.cssText.match(/b-c-[\w-]+/g) ?? []) names.add(name);
90
+ found = [...names];
91
+ } catch {}
92
+ if (link.sheet) scopes.set(link, found);
93
+ }
94
+ return found;
95
+ }
96
+ /** True when an element of the page uses one of the scopes. No scopes means a global stylesheet. */
97
+ function inUse(names) {
98
+ if (names.length === 0) return true;
99
+ for (const name of names) if (document.querySelector(`[${name}]`)) return true;
100
+ return false;
101
+ }
102
+ //#endregion
103
+ export { inUse as a, scopes as c, hasSheet as i, scopesOf as l, WAIT as n, linkPreloads as o, findSheets as r, preloadSheets as s, SHEET as t, sheetKey as u };
104
+
105
+ //# sourceMappingURL=sheets-B9Zr50mf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sheets-B9Zr50mf.js","names":[],"sources":["../src/runtime/sheets.ts"],"sourcesContent":["// Stylesheet links that a page swaps in: loading them before the swap, and telling which ones a\n// page still needs. Client navigation and the body of a `#defer` block share it.\n\n/** A stylesheet link. */\nexport const SHEET = 'link[rel~=\"stylesheet\"][href]';\n\n/** How long a swap waits for a stylesheet, in milliseconds. A stylesheet that is slower shows late. */\nexport const WAIT = 4000;\n\n/** The URL of a stylesheet link, which is what makes two links the same stylesheet. */\nexport function sheetKey(link: Element): string {\n return new URL(link.getAttribute('href')!, location.href).href;\n}\n\n/** True when a stylesheet link of the page, other than those in `ignore`, has this URL. */\nexport function hasSheet(key: string, ignore?: ReadonlySet<Element>): boolean {\n for (const link of document.querySelectorAll(SHEET)) {\n if (link.isConnected && !ignore?.has(link) && sheetKey(link) === key) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Makes stylesheets of the preloads that a first load writes (`b-sheet`). A page that a navigation\n * fetches can have them, such as from a static host that ignores the request headers, and the\n * swap must wait for them like for any stylesheet.\n */\nexport function linkPreloads(root: ParentNode): void {\n for (const link of root.querySelectorAll('link[rel=preload][b-sheet]')) {\n link.setAttribute('rel', 'stylesheet');\n link.removeAttribute('as');\n link.removeAttribute('b-sheet');\n }\n // The same links for a page without scripts, which a parser without scripting reads as elements.\n for (const fallback of root.querySelectorAll('noscript[b-sheet]')) {\n fallback.remove();\n }\n}\n\n/** The stylesheet links of a tree, including those in the content of its `<template>` elements. */\nexport function findSheets(root: ParentNode): Element[] {\n const found = [...root.querySelectorAll(SHEET)];\n for (const template of root.querySelectorAll('template')) {\n found.push(...findSheets(template.content));\n }\n return found;\n}\n\n/**\n * Loads the stylesheets that a tree of markup links and the page does not have yet, so they are in\n * the cache when the markup comes in and no frame shows it unstyled. It waits for each one to load\n * or fail, and stops waiting after a few seconds, or when the signal aborts. The links that the\n * page has stay: a URL loads once.\n */\nexport async function preloadSheets(root: ParentNode, signal?: AbortSignal): Promise<void> {\n const waits: Promise<void>[] = [];\n const started = new Set<string>();\n const added: HTMLLinkElement[] = [];\n for (const link of findSheets(root)) {\n const key = sheetKey(link);\n if (started.has(key) || hasSheet(key)) {\n continue;\n }\n started.add(key);\n const preload = document.createElement('link');\n preload.rel = 'preload';\n preload.as = 'style';\n preload.href = key;\n // The attribute of the parsed page: browsers hide it, and the policy checks the nonce.\n const nonce = link.getAttribute('nonce');\n if (nonce) {\n preload.setAttribute('nonce', nonce);\n }\n waits.push(\n new Promise<void>((resolve) => {\n preload.onload = preload.onerror = () => resolve();\n }),\n );\n added.push(preload);\n document.head.append(preload);\n }\n if (added.length === 0) {\n return;\n }\n let timer: ReturnType<typeof setTimeout> | undefined;\n let stop: (() => void) | undefined;\n try {\n await Promise.race([\n Promise.all(waits),\n new Promise<void>((resolve) => {\n timer = setTimeout(resolve, WAIT);\n }),\n new Promise<void>((resolve) => {\n stop = () => resolve();\n signal?.addEventListener('abort', stop, { once: true });\n }),\n ]);\n } finally {\n clearTimeout(timer);\n if (stop) {\n signal?.removeEventListener('abort', stop);\n }\n for (const preload of added) {\n preload.remove();\n }\n }\n}\n\n/** The scopes (`b-c-<hash>`) that the rules of a loaded stylesheet use, by link. */\nexport const scopes: WeakMap<Element, string[]> = new WeakMap();\n\n/** The scope attributes of a stylesheet, or none when it is not loaded or cannot be read. */\nexport function scopesOf(link: HTMLLinkElement): string[] {\n let found = scopes.get(link);\n if (!found) {\n found = [];\n try {\n const names = new Set<string>();\n for (const rule of link.sheet ? Array.from(link.sheet.cssRules) : []) {\n for (const name of rule.cssText.match(/b-c-[\\w-]+/g) ?? []) {\n names.add(name);\n }\n }\n found = [...names];\n } catch {\n // A stylesheet of another origin without CORS cannot be read.\n }\n // Only a loaded sheet is remembered.\n if (link.sheet) {\n scopes.set(link, found);\n }\n }\n return found;\n}\n\n/** True when an element of the page uses one of the scopes. No scopes means a global stylesheet. */\nexport function inUse(names: string[]): boolean {\n if (names.length === 0) {\n return true;\n }\n for (const name of names) {\n if (document.querySelector(`[${name}]`)) {\n return true;\n }\n }\n return false;\n}\n"],"mappings":";;AAIA,MAAa,QAAQ;;AAGrB,MAAa,OAAO;;AAGpB,SAAgB,SAAS,MAAuB;CAC9C,OAAO,IAAI,IAAI,KAAK,aAAa,MAAM,GAAI,SAAS,IAAI,CAAC,CAAC;AAC5D;;AAGA,SAAgB,SAAS,KAAa,QAAwC;CAC5E,KAAK,MAAM,QAAQ,SAAS,iBAAiB,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AM,QAAQ,KAAK;GACjB,QAAQ,IAAI,KAAK;GACjB,IAAI,SAAe,YAAY;IAC7B,QAAQ,WAAW,SAAS,IAAI;GAClC,CAAC;GACD,IAAI,SAAe,YAAY;IAC7B,aAAa,QAAQ;IACrB,QAAQ,iBAAiB,SAAS,MAAM,EAAE,MAAM,KAAK,CAAC;GACxD,CAAC;EACH,CAAC;CACH,UAAU;EACR,aAAa,KAAK;EAClB,IAAI,MACF,QAAQ,oBAAoB,SAAS,IAAI;EAE3C,KAAK,MAAM,WAAW,OACpB,QAAQ,OAAO;CAEnB;AACF;;AAGA,MAAa,yBAAqC,IAAI,QAAQ;;AAG9D,SAAgB,SAAS,MAAiC;CACxD,IAAI,QAAQ,OAAO,IAAI,IAAI;CAC3B,IAAI,CAAC,OAAO;EACV,QAAQ,CAAC;EACT,IAAI;GACF,MAAM,wBAAQ,IAAI,IAAY;GAC9B,KAAK,MAAM,QAAQ,KAAK,QAAQ,MAAM,KAAK,KAAK,MAAM,QAAQ,IAAI,CAAC,GACjE,KAAK,MAAM,QAAQ,KAAK,QAAQ,MAAM,aAAa,KAAK,CAAC,GACvD,MAAM,IAAI,IAAI;GAGlB,QAAQ,CAAC,GAAG,KAAK;EACnB,QAAQ,CAER;EAEA,IAAI,KAAK,OACP,OAAO,IAAI,MAAM,KAAK;CAE1B;CACA,OAAO;AACT;;AAGA,SAAgB,MAAM,OAA0B;CAC9C,IAAI,MAAM,WAAW,GACnB,OAAO;CAET,KAAK,MAAM,QAAQ,OACjB,IAAI,SAAS,cAAc,IAAI,KAAK,EAAE,GACpC,OAAO;CAGX,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
1
  import { a as Route, r as NavigationState, t as Context } from "./context-BNgBXVUQ.js";
2
- import { a as Store, o as StoreLike } from "./store-9_oa0HG1.js";
2
+ import { d as Store, f as StoreLike } from "./store-BwWg-Iei.js";
3
3
  import { n as RouteParams, r as RoutePath } from "./routes-BZNt7DSZ.js";
4
4
  //#region src/runtime/signals.d.ts
5
5
  declare const BINDABLE: unique symbol;
@@ -69,10 +69,20 @@ declare function $throttled<T>(_value: T, _ms: number): MemoValue<T>;
69
69
  * calls of the page finish, such as after a failed post.
70
70
  */
71
71
  declare function $optimistic<T>(_source: T): T;
72
- /** Runs a callback when the values it reads change, after the page resumes. Never on load. */
73
- declare function $effect(_callback: () => void | (() => void)): void;
72
+ /**
73
+ * What a callback of `$effect` or `$client` can return to clean up its run: a function, an async
74
+ * function, or an object with `[Symbol.dispose]` or `[Symbol.asyncDispose]`. The type says `object`
75
+ * for the disposables, since `Disposable` is in `esnext.disposable`, which a project may not have in
76
+ * its `lib`.
77
+ */
78
+ type Cleanup = (() => void | Promise<void>) | object;
79
+ /**
80
+ * Runs a callback when the values it reads change, after the page resumes. Never on load. An
81
+ * `async` callback runs one at a time, and its cleanup waits for the run to settle.
82
+ */
83
+ declare function $effect(_callback: () => void | Cleanup | Promise<void | Cleanup>): void;
74
84
  /** Runs a callback in the browser when a trigger fires. */
75
- declare function $client(_callback: () => void | (() => void), _trigger?: "visible" | "idle" | "load"): void;
85
+ declare function $client(_callback: () => void | Cleanup | Promise<void | Cleanup>, _trigger?: "visible" | "idle" | "load"): void;
76
86
  /** Reads a value without depending on it. */
77
87
  declare function $untrack<T>(_value: T): T;
78
88
  /** True while a new value of one of the memos, or of a memo one reads, loads on the client. Always false on the server. */
@@ -201,5 +211,5 @@ declare function $handler<A extends unknown[]>(fn: (...args: A) => unknown, ...a
201
211
  */
202
212
  declare function flush(): void;
203
213
  //#endregion
204
- export { BoundSignal as A, $store as C, $untrack as D, $toStore as E, flush as F, SearchParamOptions as M, Unbound as N, Bindable as O, WritableMark as P, $signal as S, $title as T, $props as _, $effect as a, $searchParam as b, $handler as c, $isPassed as d, $isPending as f, $produce as g, $optimistic as h, $debounced as i, MemoValue as j, BindableMark as k, $id as l, $navigation as m, $bind as n, $gate as o, $memo as p, $client as r, $getContext as s, $action as t, $isBound as u, $resolve as v, $throttled as w, $setContext as x, $route as y };
205
- //# sourceMappingURL=signals-7VVD9C_H.d.ts.map
214
+ export { BoundSignal as A, $store as C, $untrack as D, $toStore as E, WritableMark as F, flush as I, MemoValue as M, SearchParamOptions as N, Bindable as O, Unbound as P, $signal as S, $title as T, $props as _, $effect as a, $searchParam as b, $handler as c, $isPassed as d, $isPending as f, $produce as g, $optimistic as h, $debounced as i, Cleanup as j, BindableMark as k, $id as l, $navigation as m, $bind as n, $gate as o, $memo as p, $client as r, $getContext as s, $action as t, $isBound as u, $resolve as v, $throttled as w, $setContext as x, $route as y };
215
+ //# sourceMappingURL=signals-BgsJK-uT.d.ts.map
@@ -1,4 +1,7 @@
1
- import { l as HAS_LATE_MARKUP, r as HAS_BLOCKS, t as HAS_ACTIONS, u as HAS_LISTENERS } from "./features-DwMYKBIC.js";
1
+ import { h as HAS_SCRIPTS, l as HAS_LATE_MARKUP, r as HAS_BLOCKS, t as HAS_ACTIONS, u as HAS_LISTENERS } from "./features-Cte5aj20.js";
2
+ import { n as trustedScript } from "./trusted-Bmwg4_hf.js";
3
+ import { t as TRACE } from "./trace-flag-Dy267snx.js";
4
+ import { i as traceEvent, n as setTraceHandler } from "./trace-browser-C7MFMove.js";
2
5
  //#region src/runtime/boot.ts
3
6
  /** True on the dev server. A Vite build replaces it with `false`, so the devtools calls go. */
4
7
  const DEV = import.meta.env?.DEV;
@@ -32,6 +35,27 @@ const importCore = () => corePromise ??= import("./runtime/client.js").then((cli
32
35
  /** Runs a function when the browser is idle. */
33
36
  const idle = (fn) => (window.requestIdleCallback ?? setTimeout)(fn);
34
37
  /**
38
+ * Applies the stylesheets of the bundles that the first load only preloaded (`b-sheet`), so the
39
+ * page does not wait for them to paint. They load after the page, for the components that the
40
+ * browser renders later and for navigation.
41
+ */
42
+ function applySheets() {
43
+ const apply = () => {
44
+ for (const link of document.querySelectorAll("link[rel=preload][b-sheet]")) {
45
+ let have = false;
46
+ for (const other of document.querySelectorAll("link[rel~=stylesheet]")) have ||= other.href === link.href;
47
+ if (have) link.remove();
48
+ else {
49
+ link.rel = "stylesheet";
50
+ link.removeAttribute("as");
51
+ link.removeAttribute("b-sheet");
52
+ }
53
+ }
54
+ };
55
+ if (document.readyState === "complete") apply();
56
+ else addEventListener("load", apply, { once: true });
57
+ }
58
+ /**
35
59
  * Starts resuming the page. Listens to the events in `b-on` attributes
36
60
  * and loads `brumate/client` and the component's module on the first one.
37
61
  * `navigate` adds client navigation, and returns how to import the core.
@@ -40,6 +64,9 @@ const idle = (fn) => (window.requestIdleCallback ?? setTimeout)(fn);
40
64
  function boot(options, navigate) {
41
65
  let core;
42
66
  let stopped = false;
67
+ let coreReady = false;
68
+ if (TRACE) setTraceHandler(options.onTrace);
69
+ else if (DEV && options.onTrace) console.warn("onTrace is set, but the build leaves the spans of the browser out. Set `trace: true` in the options of the brumate plugin.");
43
70
  /** The event types that the document listens to, and whether each listener is passive. */
44
71
  const types = /* @__PURE__ */ new Map();
45
72
  const removers = [];
@@ -70,12 +97,18 @@ function boot(options, navigate) {
70
97
  inserted,
71
98
  serial
72
99
  });
100
+ coreReady = true;
73
101
  return client;
74
102
  });
75
103
  listen(document, "brumate:core", () => void loadCore());
76
104
  const run = (element, ref, event) => {
77
105
  if (stopped) return;
78
- loadCore().then((client) => client.handle(element, ref, event));
106
+ const trace = TRACE ? traceEvent(event, ref, !coreReady) : void 0;
107
+ const started = loadCore().then((client) => client.handle(element, ref, event, void 0, trace));
108
+ if (TRACE && trace) started.catch((error) => {
109
+ trace.fail(error);
110
+ throw error;
111
+ });
79
112
  };
80
113
  /**
81
114
  * A key of `prevent` matches its `event.key` while only the modifier that it names is held. A
@@ -201,6 +234,42 @@ function boot(options, navigate) {
201
234
  passive: !prevents(entry)
202
235
  });
203
236
  };
237
+ const waiting = [];
238
+ const inputs = [
239
+ "pointerdown",
240
+ "keydown",
241
+ "touchstart",
242
+ "scroll"
243
+ ];
244
+ const when = (trigger, next, go) => {
245
+ if (trigger === "idle") idle(go);
246
+ else if (trigger === "visible" && next && typeof IntersectionObserver !== "undefined") {
247
+ const observer = new IntersectionObserver((records) => {
248
+ if (records.some((record) => record.isIntersecting)) {
249
+ observer.disconnect();
250
+ go();
251
+ }
252
+ });
253
+ observer.observe(next);
254
+ } else if (HAS_SCRIPTS && trigger === "interaction") {
255
+ waiting.push(go);
256
+ if (waiting.length === 1) {
257
+ const fire = () => {
258
+ for (const type of inputs) removeEventListener(type, fire, true);
259
+ for (const run of waiting.splice(0)) run();
260
+ };
261
+ for (const type of inputs) listen(window, type, fire, {
262
+ capture: true,
263
+ passive: true
264
+ });
265
+ }
266
+ } else go();
267
+ };
268
+ const after = (template) => {
269
+ let next = template.nextElementSibling;
270
+ while (next?.tagName === "TEMPLATE") next = next.nextElementSibling;
271
+ return next;
272
+ };
204
273
  const onBlock = (root, template) => {
205
274
  const client = template.getAttribute("b-client");
206
275
  const [trigger, ref] = (client ?? template.getAttribute("b-defer")).split(client ? "=" : ":");
@@ -209,32 +278,49 @@ function boot(options, navigate) {
209
278
  run(template, ref);
210
279
  return;
211
280
  }
212
- const done = import("./defer-BMIMP4Hq.js").then((module) => module.loadDeferred(template));
281
+ const done = import("./defer-JD2FK9mV.js").then((module) => module.loadDeferred(template));
213
282
  if (DEV) devtools()?.defer?.(template, done);
214
283
  };
215
284
  const near = template.getAttribute("b-near");
216
- let after = template.nextElementSibling;
217
- while (after?.tagName === "TEMPLATE") after = after.nextElementSibling;
218
285
  const selector = `[b-b="${near}"],[b-r="${near}"]`;
219
- const next = near && (root.querySelector(selector) ?? document.querySelector(selector)) || after;
220
- if (trigger === "idle") idle(go);
221
- else if (trigger === "visible" && next && typeof IntersectionObserver !== "undefined") {
222
- const observer = new IntersectionObserver((records) => {
223
- if (records.some((record) => record.isIntersecting)) {
224
- observer.disconnect();
225
- go();
226
- }
227
- });
228
- observer.observe(next);
229
- } else go();
286
+ const next = near && (root.querySelector(selector) ?? document.querySelector(selector)) || after(template);
287
+ when(trigger, next, go);
288
+ };
289
+ const loaded = /* @__PURE__ */ new Set();
290
+ const pageNonce = (template) => {
291
+ for (const script of document.scripts) if (script.nonce) return script.nonce;
292
+ return template.nonce || template.getAttribute("nonce") || void 0;
293
+ };
294
+ const onScript = (template) => {
295
+ const code = template.content?.firstElementChild?.textContent ?? "";
296
+ const src = template.getAttribute("src");
297
+ const url = src === null ? void 0 : new URL(src, document.baseURI);
298
+ const key = url ? url.href : code;
299
+ const trigger = template.getAttribute("b-script");
300
+ const run = () => {
301
+ if (loaded.has(key) || !template.isConnected) return;
302
+ loaded.add(key);
303
+ const script = document.createElement("script");
304
+ for (const { name, value } of template.attributes) if (name === "src") script.setAttribute(name, trustedScript(value, true));
305
+ else if (!name.startsWith("b-") && name !== "nonce") script.setAttribute(name, value);
306
+ const nonce = pageNonce(template);
307
+ if (nonce) {
308
+ script.nonce = nonce;
309
+ script.setAttribute("nonce", nonce);
310
+ }
311
+ if (src === null) script.textContent = trustedScript(code);
312
+ document.head.append(script);
313
+ };
314
+ when(trigger, after(template), () => trigger === "load" ? queueMicrotask(run) : run());
230
315
  };
231
- const SCANNED = "[b-on],template[b-listen],template[b-client],template[b-defer]";
316
+ const SCANNED = "[b-on],template[b-listen],template[b-client],template[b-defer]" + (HAS_SCRIPTS ? ",template[b-script]" : "");
232
317
  const scan = (root) => {
233
318
  if (stopped) return;
234
319
  const blocks = [];
235
320
  for (const element of select(root, SCANNED)) {
236
321
  if (element.tagName === "TEMPLATE") {
237
- if (HAS_LISTENERS && element.hasAttribute("b-listen")) onListener(element);
322
+ if (HAS_SCRIPTS && element.hasAttribute("b-script")) onScript(element);
323
+ else if (HAS_LISTENERS && element.hasAttribute("b-listen")) onListener(element);
238
324
  else if (HAS_BLOCKS && (element.hasAttribute("b-client") || element.hasAttribute("b-defer") && !element.hasAttribute("b-hole"))) blocks.push(element);
239
325
  continue;
240
326
  }
@@ -274,9 +360,11 @@ function boot(options, navigate) {
274
360
  const inserted = () => {
275
361
  observer?.takeRecords();
276
362
  };
363
+ applySheets();
277
364
  loadCore().catch(() => {});
278
365
  return () => {
279
366
  stopped = true;
367
+ if (TRACE) setTraceHandler(void 0);
280
368
  observer?.disconnect();
281
369
  for (const remove of removers.splice(0)) remove();
282
370
  core?.then((client) => client.dispose());
@@ -295,4 +383,4 @@ function startWithoutNavigation(options) {
295
383
  //#endregion
296
384
  export { boot as n, importCore as r, startWithoutNavigation as t };
297
385
 
298
- //# sourceMappingURL=static-loader-C_en-4v8.js.map
386
+ //# sourceMappingURL=static-loader-BDBtWsdg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-loader-BDBtWsdg.js","names":[],"sources":["../src/runtime/boot.ts","../src/runtime/static-loader.ts"],"sourcesContent":["// The loader's code that every page runs. `loader.ts` adds client navigation,\n// and `static-loader.ts` starts it without, so a site that turns navigation\n// off does not have its code, or the parts of the core that only it uses, in\n// its bundle.\n//\n// This file keeps its arrow functions and its Array methods, for size: the loader ships to every\n// page, and the function declarations and loops measured 20 to 50 bytes of gzip larger.\n\nimport {\n HAS_ACTIONS,\n HAS_BLOCKS,\n HAS_LATE_MARKUP,\n HAS_LISTENERS,\n HAS_SCRIPTS,\n} from './features.ts';\nimport { trustedScript } from './trusted.ts';\nimport type * as Client from './client.ts';\nimport type { ClientModule, DevtoolsHooks } from './client.ts';\nimport type { SerialEntry } from './values.ts';\nimport { TRACE } from './trace-flag.ts';\nimport { setTraceHandler, traceEvent } from './trace-browser.ts';\nimport type { TraceHandler } from './trace.ts';\n\n/** True on the dev server. A Vite build replaces it with `false`, so the devtools calls go. */\nconst DEV = (import.meta as { env?: { DEV?: boolean } }).env?.DEV;\n\n/** The hooks of the devtools overlay, under the same key as the core's. */\nfunction devtools(): DevtoolsHooks | undefined {\n return (globalThis as Record<symbol, DevtoolsHooks | undefined>)[Symbol.for('brumate.devtools')];\n}\n\nexport interface LoaderOptions {\n /**\n * Imports the client module of a component, by component ID. Undefined for\n * a component that has no client code.\n */\n load: (id: string) => Promise<ClientModule> | undefined;\n /** The URL prefix of server function calls. */\n rpc?: string;\n /** Imports the serial entry, which the core takes before it reads the page state. */\n serial?: () => Promise<SerialEntry>;\n /**\n * Loads pages without a full page load: links to the same origin, the back\n * and forward buttons, forms that post to a server function, and redirects\n * from server functions to the same origin. Defaults to true.\n */\n navigate?: boolean | NavigateOptions;\n /**\n * The ID of the build of the page, for skew protection. The Vite plugin\n * sets it. Calls send it, and a page of another build, or a call that\n * answers 409 after a deploy, makes the next navigation a full page load.\n */\n build?: string;\n /**\n * Receives every error of client code first: of a handler, an effect, a\n * `$client` callback or a memo that loads, such as for a reporting\n * service. `scope` is the ID of the scope that the code belongs to. The\n * error then renders the `#catch` body of the nearest `#try`, or the page\n * gets a `brumate:error` event on `window` and the error is logged.\n */\n onError?: (error: unknown, info: { scope?: number | string }) => void;\n /**\n * Receives a span for each event with the load and the run of its handler, for each server\n * function that the page calls and for each navigation. See `TraceSpan`.\n *\n * - A server function call and a navigation send `traceparent` to the same origin, so the spans\n * of the server join the trace. A request to another origin sends none, and neither does a\n * page that a link loaded early (before the click, so it cannot join a trace). A request that\n * the server redirects to another origin keeps the header.\n * - A call or a navigation joins the trace of a handler only when the handler makes it before\n * its first `await`. Handlers overlap, so a later call could belong to another handler. A\n * call after an `await`, from a memo or from a form, is the root of a trace of its own.\n * - A span has no argument, result, query string or form value. A navigation has the route\n * pattern, such as `/items/[id]`, once the page arrives, and none when it fails.\n * - The Vite plugin leaves the code out of a build whose entry does not pass `onTrace` to the\n * loader. See the `trace` option of the plugin when the entry is elsewhere.\n */\n onTrace?: TraceHandler;\n}\n\nexport interface NavigateOptions {\n /**\n * Swaps the page inside a view transition, where the browser has them.\n * CSS can tell links, the back and forward buttons and forms apart with\n * the types `push`, `traverse` and `form`. A redirect from a server\n * function has the type `form`.\n */\n transition?: boolean;\n /**\n * After a navigation, moves the focus to the first `<h1>` of the routes\n * that changed, or to `<main>`, as a full page load starts it at the top.\n * Defaults to true.\n */\n focus?: boolean;\n}\n\ninterface Entry {\n raw: string;\n type: string;\n modifiers: string[];\n ref: string;\n}\n\n// Parsed `b-on` values, so repeated events do not parse them again.\nconst parsed = new Map<string, Entry[]>();\n\nexport function entries(element: Element): Entry[] {\n const value = element.getAttribute('b-on') ?? '';\n return (parsed.get(value) ??\n parsed\n .set(\n value,\n value\n .split(' ')\n .filter(Boolean)\n .map((entry) => {\n const [name, ref] = entry.split('=') as [string, string];\n const [type, ...modifiers] = name.split(':') as [string, ...string[]];\n return { raw: entry, type, modifiers, ref };\n }),\n )\n .get(value))!;\n}\n\n/** The functions of the core that the loader calls. */\nexport type Core = (typeof Client)['loader'];\n\n/**\n * Imports the core. It reads one export by name, so a build keeps only it and\n * the helpers that compiled components call.\n */\nlet corePromise: Promise<Core> | undefined;\nexport const importCore = (): Promise<Core> =>\n (corePromise ??= import('./client.ts').then(\n (client) => client.loader,\n (error: unknown) => {\n // A load that fails can start again, such as after the network comes back.\n corePromise = undefined;\n throw error;\n },\n ));\n\n/** Runs a function when the browser is idle. */\nconst idle = (fn: () => void): unknown => (window.requestIdleCallback ?? setTimeout)(fn);\n\n/** What the loader gives the code that loads pages without a full page load. */\nexport interface Navigation {\n options: LoaderOptions;\n listen: (\n target: EventTarget,\n type: string,\n listener: (event: Event) => void,\n flags?: AddEventListenerOptions | boolean,\n ) => void;\n core: () => Promise<Core> | undefined;\n /** Starts the core, or returns the one that runs. */\n start: () => Promise<Core>;\n scan: (root: ParentNode) => void;\n}\n\n/**\n * Applies the stylesheets of the bundles that the first load only preloaded (`b-sheet`), so the\n * page does not wait for them to paint. They load after the page, for the components that the\n * browser renders later and for navigation.\n */\nfunction applySheets(): void {\n const apply = (): void => {\n for (const link of document.querySelectorAll<HTMLLinkElement>('link[rel=preload][b-sheet]')) {\n // The loader may have linked it for a component that it renders.\n let have = false;\n for (const other of document.querySelectorAll<HTMLLinkElement>('link[rel~=stylesheet]')) {\n have ||= other.href === link.href;\n }\n if (have) {\n link.remove();\n } else {\n // A stylesheet like any other from here on.\n link.rel = 'stylesheet';\n link.removeAttribute('as');\n link.removeAttribute('b-sheet');\n }\n }\n };\n if (document.readyState === 'complete') {\n apply();\n } else {\n addEventListener('load', apply, { once: true });\n }\n}\n\n/**\n * Starts resuming the page. Listens to the events in `b-on` attributes\n * and loads `brumate/client` and the component's module on the first one.\n * `navigate` adds client navigation, and returns how to import the core.\n * Returns a function that removes the listeners and stops the core.\n */\nexport function boot(\n options: LoaderOptions,\n navigate?: (navigation: Navigation) => () => Promise<Core>,\n): () => void {\n let core: Promise<Core> | undefined;\n // Once stopped, the loader starts nothing, also from markup that the core inserts later with the\n // hooks that this loader gave it. A new loader can reuse the IDs of client scopes, so a stale\n // start would run in a scope of the new page.\n let stopped = false;\n // True once the core started, so an event after it has no code of the core to wait for.\n let coreReady = false;\n if (TRACE) {\n setTraceHandler(options.onTrace);\n } else if (DEV && options.onTrace) {\n console.warn(\n 'onTrace is set, but the build leaves the spans of the browser out. Set `trace: true` in the options of the brumate plugin.',\n );\n }\n /** The event types that the document listens to, and whether each listener is passive. */\n const types = new Map<string, boolean>();\n const removers: (() => void)[] = [];\n const listen = (\n target: EventTarget,\n type: string,\n listener: (event: Event) => void,\n flags?: AddEventListenerOptions | boolean,\n ): void => {\n target.addEventListener(type, listener, flags);\n removers.push(() => target.removeEventListener(type, listener, flags));\n };\n\n // Client navigation imports the core with the code that reads the pages it adds.\n let load = importCore;\n // The modules that the loader asked for, which the core takes, so a handler whose\n // code loaded runs without another `import()`. In Chrome, an `import()` of a module that is\n // loaded already still resolves in a task of its own, which can wait for the next frame.\n const modules = new Map<string, Promise<ClientModule> | undefined>();\n const loadModule = (id: string): Promise<ClientModule> | undefined => {\n if (modules.has(id)) {\n return modules.get(id);\n }\n const promise = options.load(id);\n modules.set(id, promise);\n // A load that fails can start again, such as after the network comes back.\n promise?.catch(() => modules.delete(id));\n return promise;\n };\n // The serial entry loads with the core, so the core can make the values of the app.\n let serialLoad: Promise<SerialEntry> | undefined;\n const loadSerial = (): Promise<SerialEntry> | undefined => {\n serialLoad ??= options.serial?.();\n serialLoad?.catch(() => (serialLoad = undefined));\n return serialLoad;\n };\n const loadCore = (): Promise<Core> =>\n (core ??= Promise.all([load(), loadSerial()]).then(([client, serial]) => {\n client.init({ ...options, load: loadModule, listen: scanInsert, inserted, serial });\n coreReady = true;\n return client;\n }));\n\n // The devtools panel asks for the core when it opens, so it can show the page before any event.\n listen(document, 'brumate:core', () => void loadCore());\n\n const run = (element: Element, ref: string, event?: Event): void => {\n if (stopped) {\n return;\n }\n const trace = TRACE ? traceEvent(event, ref, !coreReady) : undefined;\n const started = loadCore().then((client) =>\n client.handle(element, ref, event, undefined, trace),\n );\n if (TRACE && trace) {\n started.catch((error: unknown) => {\n trace.fail(error);\n throw error;\n });\n } else {\n void started;\n }\n };\n\n /**\n * A key of `prevent` matches its `event.key` while only the modifier that it names is held. A\n * key alone matches while Ctrl, Meta and Alt are up, so the shortcuts of the browser, such as\n * Cmd+Left or Alt+Left, keep their default. `Mod+` is Ctrl or Meta. Shift does not count. A\n * single letter after a modifier matches in either case, as the browser sends `k` for Cmd+K and\n * `K` for Cmd+Shift+K. A letter alone keeps its case, as `a` and `A` type different text.\n */\n const keyMatches = (key: string, event: KeyboardEvent): boolean => {\n const plus = key.indexOf('+', 1);\n const modifier = plus > 0 ? key.slice(0, plus) : '';\n let name = plus > 0 ? key.slice(plus + 1) : key;\n let pressed = event.key === ' ' ? 'Space' : event.key;\n if (plus > 0 && name.length === 1) {\n name = name.toLowerCase();\n pressed = pressed.toLowerCase();\n }\n if (pressed !== name) {\n return false;\n }\n switch (modifier) {\n case 'Mod':\n return (event.ctrlKey || event.metaKey) && !event.altKey;\n case 'Ctrl':\n return event.ctrlKey && !event.metaKey && !event.altKey;\n case 'Meta':\n return event.metaKey && !event.ctrlKey && !event.altKey;\n case 'Alt':\n return event.altKey && !event.ctrlKey && !event.metaKey;\n default:\n return !event.ctrlKey && !event.metaKey && !event.altKey;\n }\n };\n\n const apply = (event: Event, element: Element, entry: Entry): boolean => {\n for (const modifier of entry.modifiers) {\n // `prevent(ArrowDown,Enter)` prevents only these keys, by `event.key`. A key that commits\n // or moves within the text of an input method, such as Enter while it composes, is the\n // input method's, so it keeps its default.\n if (\n modifier === 'prevent' ||\n (modifier.startsWith('prevent(') &&\n !(event as KeyboardEvent).isComposing &&\n modifier\n .slice(8, -1)\n .split(',')\n .some((key) => keyMatches(key, event as KeyboardEvent)))\n ) {\n event.preventDefault();\n }\n }\n if (entry.modifiers.includes('once')) {\n element.setAttribute(\n 'b-on',\n entries(element)\n .map((item) => item.raw)\n .filter((raw) => raw !== entry.raw)\n .join(' '),\n );\n }\n run(element, entry.ref, event);\n return entry.modifiers.includes('stop');\n };\n\n /**\n * Handlers run as if each element had its own listener: those with\n * `capture` from the outside in, then the others from the target outwards.\n * An event that does not bubble, such as `focus`, reaches only the others\n * of its target. `stop` ends the event where it is.\n */\n const onEvent = (event: Event): void => {\n // The checks of `cancelWhen`, from the target up, run before any handler.\n for (let node = event.target as Node | null; node; node = node.parentNode) {\n for (const [type, check] of cancels.get(node as Element) ?? []) {\n if (type !== event.type) {\n continue;\n }\n let cancel = false;\n try {\n cancel = check(event);\n } catch (error) {\n // A check that throws cancels nothing, and the other checks and the handlers still run.\n console.error(error);\n }\n if (cancel) {\n event.preventDefault();\n return;\n }\n }\n }\n const path: Element[] = [];\n for (\n let node = event.target as Node | null;\n node && node !== document;\n node = node.parentNode\n ) {\n if (node.nodeType === 1 && (node as Element).hasAttribute('b-on')) {\n path.push(node as Element);\n }\n }\n const phase = (elements: Element[], capture: boolean): boolean => {\n for (const element of elements) {\n let stop = false;\n for (const entry of entries(element)) {\n if (\n entry.type === event.type &&\n entry.modifiers.includes('capture') === capture &&\n apply(event, element, entry)\n ) {\n stop = true;\n }\n }\n if (stop) {\n event.stopPropagation();\n return true;\n }\n }\n return false;\n };\n if (!phase([...path].reverse(), true)) {\n phase(event.bubbles ? path : path.filter((element) => element === event.target), false);\n }\n };\n\n // The checks of `cancelWhen`, by element. `events.ts` reaches them through a symbol of the registry.\n const cancels = new WeakMap<Node, Set<[string, (event: Event) => boolean]>>();\n (globalThis as { [key: symbol]: unknown })[Symbol.for('brumate.cancel')] = (\n element: Element,\n type: string,\n check: (event: Event) => boolean,\n ): (() => void) => {\n const entry: [string, typeof check] = [type, check];\n let set = cancels.get(element);\n if (!set) {\n cancels.set(element, (set = new Set()));\n }\n set.add(entry);\n delegate(type, false);\n return () => void set.delete(entry);\n };\n\n /** True for an entry that prevents the default action, which a passive listener cannot do. */\n const prevents = (entry: Entry): boolean =>\n entry.modifiers.some((modifier) => modifier.startsWith('prevent'));\n\n /**\n * Listens to an event type on the document. The listener is passive, so\n * scrolling does not wait for it, until an entry of the type prevents. `click` and `submit` never\n * scroll, so they are never passive: a `prevent` that is written after load cancels them.\n */\n const delegate = (type: string, cancel: boolean): void => {\n const prevent = cancel || type === 'click' || type === 'submit';\n const passive = types.get(type);\n if (passive === false || (passive === true && !prevent)) {\n return;\n }\n if (passive) {\n document.removeEventListener(type, onEvent, true);\n }\n types.set(type, !prevent);\n listen(document, type, onEvent, { capture: true, passive: !prevent });\n };\n\n // Templates are started once, even when markup is scanned again.\n const started = new WeakSet<Element>();\n const select = (root: ParentNode, selector: string): Element[] => {\n const found: Element[] = [];\n const add = (element: Element): void => {\n if (element.tagName === 'TEMPLATE') {\n if (started.has(element)) {\n return;\n }\n started.add(element);\n }\n found.push(element);\n };\n if ((root as Element).matches?.(selector)) {\n add(root as Element);\n }\n for (const element of root.querySelectorAll(selector)) {\n add(element);\n }\n return found;\n };\n\n // The values of `b-on` whose event types the document listens to already. The rows of a\n // list repeat the same few values.\n const delegated = new Set<string>();\n const onElement = (element: Element): void => {\n const value = element.getAttribute('b-on')!;\n if (!delegated.has(value)) {\n delegated.add(value);\n for (const entry of entries(element)) {\n delegate(entry.type, prevents(entry));\n }\n }\n };\n const onListener = (template: Element): void => {\n const target = template.getAttribute('b-listen') === 'window' ? window : document;\n for (const entry of entries(template)) {\n // Markup that is gone, such as a page that navigation replaced, no longer listens.\n listen(\n target,\n entry.type,\n (event) => {\n if (template.isConnected) {\n apply(event, template, entry);\n }\n },\n { capture: entry.modifiers.includes('capture'), passive: !prevents(entry) },\n );\n }\n };\n const waiting: (() => void)[] = [];\n const inputs = ['pointerdown', 'keydown', 'touchstart', 'scroll'];\n // Runs `go` when the trigger fires. `visible` watches `next`, the element after the markers.\n const when = (trigger: string, next: Element | null, go: () => void): void => {\n if (trigger === 'idle') {\n idle(go);\n } else if (trigger === 'visible' && next && typeof IntersectionObserver !== 'undefined') {\n const observer = new IntersectionObserver((records) => {\n if (records.some((record) => record.isIntersecting)) {\n observer.disconnect();\n go();\n }\n });\n observer.observe(next);\n } else if (HAS_SCRIPTS && trigger === 'interaction') {\n // One set of listeners serves every script that waits, so a block that closes first leaves\n // only its entry in the list, which `go` drops once it sees the template is gone.\n waiting.push(go);\n if (waiting.length === 1) {\n const fire = (): void => {\n for (const type of inputs) {\n removeEventListener(type, fire, true);\n }\n for (const run of waiting.splice(0)) {\n run();\n }\n };\n for (const type of inputs) {\n listen(window, type, fire, { capture: true, passive: true });\n }\n }\n } else {\n go();\n }\n };\n // The element after a marker that a trigger watches. Other markers can follow it, and a\n // template has no box, so it is never in view.\n const after = (template: Element): Element | null => {\n let next = template.nextElementSibling;\n while (next?.tagName === 'TEMPLATE') {\n next = next.nextElementSibling;\n }\n return next;\n };\n // A `#defer` block whose body the server sends in the same response, with `b-hole`, waits for it.\n const onBlock = (root: ParentNode, template: Element): void => {\n const client = template.getAttribute('b-client');\n const [trigger, ref] = (client ?? template.getAttribute('b-defer')!).split(\n client ? '=' : ':',\n ) as [string, string];\n // A `#defer` block asks the server for its body, with a module that only it needs.\n const go = (): void => {\n if (client) {\n run(template, ref);\n return;\n }\n const done = import('./defer.ts').then((module) => module.loadDeferred(template));\n if (DEV) {\n devtools()?.defer?.(template, done);\n }\n };\n // The element that a `$client` callback reads through `ref` (`b-b`), or that a component\n // forwards to its signal (`b-r`), or the one after the marker.\n const near = template.getAttribute('b-near');\n const selector = `[b-b=\"${near}\"],[b-r=\"${near}\"]`;\n const next =\n (near && (root.querySelector(selector) ?? document.querySelector(selector))) ||\n after(template);\n when(trigger, next, go);\n };\n // A page runs a script once, by its `src` or by its code.\n const loaded = new Set<string>();\n // The nonce that the policy of the loaded page knows. A page that navigation brought has the\n // nonce of its own response, which the policy does not.\n const pageNonce = (template: Element): string | undefined => {\n for (const script of document.scripts) {\n if (script.nonce) {\n return script.nonce;\n }\n }\n return (template as HTMLElement).nonce || template.getAttribute('nonce') || undefined;\n };\n // A `<script>` of markup, as a template with the attributes of the script, and its code in an\n // inert script. The browser runs a script that it inserts, once the trigger fires.\n const onScript = (template: Element): void => {\n const code = (template as HTMLTemplateElement).content?.firstElementChild?.textContent ?? '';\n const src = template.getAttribute('src');\n const url = src === null ? undefined : new URL(src, document.baseURI);\n const key = url ? url.href : code;\n const trigger = template.getAttribute('b-script')!;\n const run = (): void => {\n // Markup that is gone, such as a page that navigation replaced, starts no script.\n if (loaded.has(key) || !template.isConnected) {\n return;\n }\n loaded.add(key);\n const script = document.createElement('script');\n for (const { name, value } of template.attributes) {\n if (name === 'src') {\n script.setAttribute(name, trustedScript(value, true));\n } else if (!name.startsWith('b-') && name !== 'nonce') {\n script.setAttribute(name, value);\n }\n }\n const nonce = pageNonce(template);\n if (nonce) {\n script.nonce = nonce;\n // A DOM without the property, such as in tests, reads the attribute.\n script.setAttribute('nonce', nonce);\n }\n if (src === null) {\n script.textContent = trustedScript(code);\n }\n document.head.append(script);\n };\n // The core scans markup before it is in the page, so `load` waits a moment for the insert.\n when(trigger, after(template), () => (trigger === 'load' ? queueMicrotask(run) : run()));\n };\n const SCANNED =\n '[b-on],template[b-listen],template[b-client],template[b-defer]' +\n (HAS_SCRIPTS ? ',template[b-script]' : '');\n // One query of the markup for everything that the loader starts. The blocks start after the\n // rest, as they did when each kind had its own query.\n const scan = (root: ParentNode): void => {\n if (stopped) {\n return;\n }\n const blocks: Element[] = [];\n for (const element of select(root, SCANNED)) {\n if (element.tagName === 'TEMPLATE') {\n if (HAS_SCRIPTS && element.hasAttribute('b-script')) {\n onScript(element);\n } else if (HAS_LISTENERS && element.hasAttribute('b-listen')) {\n onListener(element);\n } else if (\n HAS_BLOCKS &&\n (element.hasAttribute('b-client') ||\n (element.hasAttribute('b-defer') && !element.hasAttribute('b-hole')))\n ) {\n blocks.push(element);\n }\n continue;\n }\n if (element.hasAttribute('b-on')) {\n onElement(element);\n }\n }\n for (const template of blocks) {\n onBlock(root, template);\n }\n };\n\n // A form of an `$action` sends its data with `fetch`, and the core writes the result into the page.\n listen(document, 'submit', (event) => {\n const form = event.target as HTMLFormElement;\n if (!HAS_ACTIONS || event.defaultPrevented || !form.hasAttribute?.('b-result')) {\n return;\n }\n event.preventDefault();\n const submitter = (event as SubmitEvent).submitter;\n void loadCore().then((client) => client.submitAction(form, submitter));\n });\n\n if (navigate) {\n load = navigate({ options, listen, core: () => core, start: loadCore, scan });\n } else {\n // A hot update whose markup changed loads the page again.\n listen(document, 'brumate:reload', () => location.reload());\n }\n\n scan(document);\n // Markup that streams in later, such as a `#loading` body, has handlers too.\n const scanAdded = (records: MutationRecord[]): void => {\n for (const record of records) {\n for (const node of record.addedNodes) {\n if (node.nodeType === 1) {\n scan(node as Element);\n }\n }\n }\n };\n // Without markup that others insert, the core scans all that comes into the page. The rest of\n // the page that the browser reads after an `async` script starts is scanned when it ends.\n const observer = HAS_LATE_MARKUP ? new MutationObserver(scanAdded) : undefined;\n observer?.observe(document, { childList: true, subtree: true });\n if (!HAS_LATE_MARKUP && document.readyState === 'loading') {\n listen(document, 'DOMContentLoaded', () => scan(document));\n }\n // The core scans the markup that it inserts before the insert, so the records of the insert\n // are dropped instead of scanned again. The markup that others inserted first is scanned\n // first.\n const scanInsert = (root: ParentNode): void => {\n if (observer) {\n scanAdded(observer.takeRecords());\n }\n scan(root);\n };\n const inserted = (): void => {\n observer?.takeRecords();\n };\n\n applySheets();\n // The core starts at once and loads the code of the components on the page, so a call of a\n // function of another component, such as a function prop, runs at once and in order.\n void loadCore().catch(() => {});\n return () => {\n stopped = true;\n if (TRACE) {\n setTraceHandler(undefined);\n }\n observer?.disconnect();\n for (const remove of removers.splice(0)) {\n remove();\n }\n void core?.then((client) => client.dispose());\n };\n}\n","// The loader without client navigation, for `navigate: false`. It is a module\n// of its own, so a bundle that starts it has no import of the navigation code,\n// and keeps none of the core's exports that only navigation reads.\n\nimport { boot } from './boot.ts';\nimport type { LoaderOptions } from './boot.ts';\n\nexport type { LoaderOptions } from './boot.ts';\n\n/**\n * `start` for a site that loads every page with a full page load, as with\n * `navigate: false`. A bundle that only calls it leaves out the code of\n * client navigation.\n */\nexport function startWithoutNavigation(options: LoaderOptions): () => void {\n return boot(options);\n}\n"],"mappings":";;;;;;AAwBA,MAAM,MAAO,YAA4C,KAAK;;AAG9D,SAAS,WAAsC;CAC7C,OAAQ,WAAyD,OAAO,IAAI,kBAAkB;AAChG;AA2EA,MAAM,yBAAS,IAAI,IAAqB;AAExC,SAAgB,QAAQ,SAA2B;CACjD,MAAM,QAAQ,QAAQ,aAAa,MAAM,KAAK;CAC9C,OAAQ,OAAO,IAAI,KAAK,KACtB,OACG,IACC,OACA,MACG,MAAM,GAAG,CAAC,CACV,OAAO,OAAO,CAAC,CACf,KAAK,UAAU;EACd,MAAM,CAAC,MAAM,OAAO,MAAM,MAAM,GAAG;EACnC,MAAM,CAAC,MAAM,GAAG,aAAa,KAAK,MAAM,GAAG;EAC3C,OAAO;GAAE,KAAK;GAAO;GAAM;GAAW;EAAI;CAC5C,CAAC,CACL,CAAC,CACA,IAAI,KAAK;AAChB;;;;;AASA,IAAI;AACJ,MAAa,mBACV,gBAAgB,OAAO,sBAAc,CAAC,MACpC,WAAW,OAAO,SAClB,UAAmB;CAElB,cAAc,KAAA;CACd,MAAM;AACR,CACF;;AAGF,MAAM,QAAQ,QAA6B,OAAO,uBAAuB,WAAA,CAAY,EAAE;;;;;;AAsBvF,SAAS,cAAoB;CAC3B,MAAM,cAAoB;EACxB,KAAK,MAA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3
3
  /**
4
4
  * `start` for a site that loads every page with a full page load, as with
@@ -8,4 +8,4 @@ import { t as LoaderOptions } from "./boot-BkUdiYOF.js";
8
8
  declare function startWithoutNavigation(options: LoaderOptions): () => void;
9
9
  //#endregion
10
10
  export { startWithoutNavigation as t };
11
- //# sourceMappingURL=static-loader-UKnK11Em.d.ts.map
11
+ //# sourceMappingURL=static-loader-CAFn6p0l.d.ts.map