brumate 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{boot-Cs_P8cDu.d.ts → boot-CMy0f_iC.d.ts} +2 -2
- package/dist/cli.js +2 -2
- package/dist/{client-DYIZ7BYK.js → client-Bm0XbjHr.js} +7 -5
- package/dist/{client-DYIZ7BYK.js.map → client-Bm0XbjHr.js.map} +1 -1
- package/dist/{client-BDPsTd4q.d.ts → client-DnFF9_lv.d.ts} +2 -2
- package/dist/{defer-7JDhFxQq.js → defer-BWwxv7Qf.js} +2 -2
- package/dist/{defer-7JDhFxQq.js.map → defer-BWwxv7Qf.js.map} +1 -1
- package/dist/{devtools-CzSp1GGq.js → devtools-Cl6AhENB.js} +4 -4
- package/dist/{devtools-CzSp1GGq.js.map → devtools-Cl6AhENB.js.map} +1 -1
- package/dist/{devtools-panel-DugGrz7L.js → devtools-panel-DLIeWcAj.js} +2 -2
- package/dist/{devtools-panel-DugGrz7L.js.map → devtools-panel-DLIeWcAj.js.map} +1 -1
- package/dist/events-LgLdp1R7.js.map +1 -1
- package/dist/{files-XX5yW3KL.js → files-BuQvpBwF.js} +2 -2
- package/dist/{files-XX5yW3KL.js.map → files-BuQvpBwF.js.map} +1 -1
- package/dist/{html-t1JpkODI.js → html-Cf5uKhLs.js} +3 -3
- package/dist/html-Cf5uKhLs.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{inspect-B9cRF6AM.js → inspect-BSHv1_25.js} +70 -7
- package/dist/inspect-BSHv1_25.js.map +1 -0
- package/dist/{loader-BGSXt_Eb.js → loader-BPNSRA2A.js} +2 -2
- package/dist/{loader-BGSXt_Eb.js.map → loader-BPNSRA2A.js.map} +1 -1
- package/dist/{rpc-B9EkaPdU.js → rpc-DqfCaYgF.js} +3 -3
- package/dist/{rpc-B9EkaPdU.js.map → rpc-DqfCaYgF.js.map} +1 -1
- package/dist/runtime/bundles.d.ts +1 -1
- package/dist/runtime/client.d.ts +2 -2
- package/dist/runtime/client.js +3 -3
- package/dist/runtime/devtools.d.ts +2 -2
- package/dist/runtime/devtools.js +1 -1
- package/dist/runtime/events.d.ts +1 -1
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/html.d.ts +1 -1
- package/dist/runtime/html.js +1 -1
- package/dist/runtime/loader.d.ts +2 -2
- package/dist/runtime/loader.js +2 -2
- package/dist/runtime/server.d.ts +2 -2
- package/dist/runtime/server.js +3 -3
- package/dist/runtime/static-loader.d.ts +2 -2
- package/dist/runtime/static-loader.js +1 -1
- package/dist/runtime/testing.d.ts +2 -2
- package/dist/runtime/testing.js +2 -2
- package/dist/{search-params-Cy3uRphR.js → search-params-C64liRBj.js} +2 -2
- package/dist/{search-params-Cy3uRphR.js.map → search-params-C64liRBj.js.map} +1 -1
- package/dist/{server-CavhuoFI.d.ts → server-0rS5vUW1.d.ts} +7 -4
- package/dist/{server-C1OTFH4r.js → server-BVObWh-w.js} +8 -5
- package/dist/server-BVObWh-w.js.map +1 -0
- package/dist/{shared-CRduzyi3.d.ts → shared-CuJdWifz.d.ts} +2 -2
- package/dist/{static-loader-D5hvLQK7.d.ts → static-loader-BYbXVJDY.d.ts} +2 -2
- package/dist/{static-loader-XGXMzfJR.js → static-loader-V4V1Oy6G.js} +12 -4
- package/dist/static-loader-V4V1Oy6G.js.map +1 -0
- package/dist/{stream-BBnArf_5.js → stream-RXLadXx1.js} +3 -3
- package/dist/{stream-BBnArf_5.js.map → stream-RXLadXx1.js.map} +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +2 -2
- package/elements.d.ts +83 -60
- package/package.json +1 -1
- package/dist/html-t1JpkODI.js.map +0 -1
- package/dist/inspect-B9cRF6AM.js.map +0 -1
- package/dist/server-C1OTFH4r.js.map +0 -1
- package/dist/static-loader-XGXMzfJR.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { m as HAS_SEARCH_PARAMS } from "./features-DwMYKBIC.js";
|
|
2
2
|
import { n as ROUTE_KEY, t as NAVIGATION_KEY } from "./context-CU4Fpn5a.js";
|
|
3
|
-
import { n as boot, r as importCore } from "./static-loader-
|
|
3
|
+
import { n as boot, r as importCore } from "./static-loader-V4V1Oy6G.js";
|
|
4
4
|
//#region src/runtime/loader.ts
|
|
5
5
|
/**
|
|
6
6
|
* Starts resuming the page. Listens to the events in `b-on` attributes
|
|
@@ -148,4 +148,4 @@ function navigation({ options, listen, core, start: startCore, scan }) {
|
|
|
148
148
|
//#endregion
|
|
149
149
|
export { start as t };
|
|
150
150
|
|
|
151
|
-
//# sourceMappingURL=loader-
|
|
151
|
+
//# sourceMappingURL=loader-BPNSRA2A.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader-BGSXt_Eb.js","names":[],"sources":["../src/runtime/loader.ts"],"sourcesContent":["import type * as Routes from './client-routes.ts';\nimport { boot, importCore } from './boot.ts';\nimport { NAVIGATION_KEY, ROUTE_KEY } from './context.ts';\nimport { HAS_SEARCH_PARAMS } from './features.ts';\nimport type { Core, LoaderOptions, Navigation } from './boot.ts';\n\nexport type { LoaderOptions, NavigateOptions } from './boot.ts';\nexport { startWithoutNavigation } from './static-loader.ts';\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 * Returns a function that removes the listeners and stops the core.\n */\nexport function start(options: LoaderOptions): () => void {\n return boot(options, options.navigate === false ? undefined : navigation);\n}\n\n/** Starts loading the page of a link, unless the link asks not to. */\nfunction prefetch(link: HTMLAnchorElement | undefined): void {\n if (link && link.getAttribute('data-prefetch') !== 'none') {\n void import('./navigate.ts').then((module) => module.prefetch(link.href));\n }\n}\n\n/**\n * Imports the code with which the core reads the pages that navigation adds.\n * A core that runs loads it when the loader navigates. A core that starts\n * later loads it with the core, when the page has records that navigation\n * marked.\n */\nfunction routes(): (typeof Routes)['ready'] {\n return import('./client-routes.ts').then((module) => module.ready);\n}\n\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. Returns how the loader imports\n * the core.\n */\nfunction navigation({\n options,\n listen,\n core,\n start: startCore,\n scan,\n}: Navigation): () => Promise<Core> {\n const rpc = `${options.rpc ?? '/_brumate'}/`;\n const settings = typeof options.navigate === 'object' ? options.navigate : {};\n // The page without its hash, to tell a change of the hash from a change of the page.\n let page = String(location.href).split('#')[0];\n // True once the site changed since the page loaded: the next page loads in full, with new code.\n let skewed = false;\n listen(document, 'brumate:skew', () => {\n skewed = true;\n });\n // The core when the page reads a context of navigation, which it starts for them, or when it runs.\n function reader(key: string): Promise<Core> | undefined {\n const running = core();\n if (running) {\n return running;\n }\n for (const script of document.querySelectorAll('script[b-state]')) {\n if (script.textContent?.includes(key)) {\n return startCore();\n }\n }\n return undefined;\n }\n function state(value: { pending: boolean; from?: string; to?: string }): void {\n void reader(NAVIGATION_KEY)?.then((client) => client.setGlobal(NAVIGATION_KEY, value));\n }\n function go(\n url: string,\n init?: RequestInit,\n push = true,\n reload = false,\n scroll = true,\n ): Promise<void> {\n const from = location.href;\n if (skewed) {\n // A form post cannot be a full page load: the page loads again, and the form is lost with\n // the rest of the state of the page.\n if (init) {\n location.reload();\n } else {\n location.assign(url);\n }\n return Promise.resolve();\n }\n page = url.split('#')[0]!;\n if (core()) {\n void routes();\n }\n // CSS can show a progress bar while a page loads, with no client code in the page.\n document.documentElement.setAttribute('data-navigating', '');\n state({ pending: true, from, to: new URL(url, from).href });\n function done(): void {\n document.documentElement.removeAttribute('data-navigating');\n state({ pending: false });\n }\n return import('./navigate.ts')\n .then((module) =>\n module.navigate({\n url,\n init,\n push,\n reload,\n scroll,\n build: options.build,\n focus: settings.focus !== false,\n transition: settings.transition === true,\n // The core forgets the old page, or only stops reading, when layouts stay.\n leave: async (partial) => {\n if (core()) {\n (await routes())(partial);\n }\n },\n enter: () => {\n // The core took the serial entry when it started.\n void core()?.then((client) =>\n client.init({ ...options, serial: undefined, listen: scan }),\n );\n // Code that reads the route, such as in a layout that stays, gets the new one.\n void reader(ROUTE_KEY)?.then((client) => client.updateRoute());\n page = location.href.split('#')[0]!;\n },\n }),\n )\n .finally(done);\n }\n // `navigate(href, options)` from `brumate/routes`.\n listen(document, 'brumate:navigate', (event) => {\n const detail = (\n event as CustomEvent<{ url: string; replace: boolean; scroll: boolean; done: () => void }>\n ).detail;\n event.preventDefault();\n void go(detail.url, undefined, !detail.replace, false, detail.scroll).then(detail.done);\n });\n // A link to another page of this site, which the loader loads itself.\n function pageLink(target: EventTarget | null): HTMLAnchorElement | undefined {\n const link = (target as Element | null)?.closest?.('a[href]') as HTMLAnchorElement | null;\n return link &&\n !link.target &&\n !link.matches('[download],[data-reload]') &&\n link.origin === location.origin &&\n // A link to a place in the same page scrolls there.\n !(link.hash && link.href.split('#')[0] === page)\n ? link\n : undefined;\n }\n listen(document, 'click', (event) => {\n const mouse = event as MouseEvent;\n const link = pageLink(event.target);\n if (\n !link ||\n event.defaultPrevented ||\n mouse.button ||\n mouse.metaKey ||\n mouse.ctrlKey ||\n mouse.shiftKey ||\n mouse.altKey\n ) {\n return;\n }\n event.preventDefault();\n void go(link.href);\n });\n // A page loads when the pointer rests on its link, or the link gets focus, so a click finds it loading.\n let resting: ReturnType<typeof setTimeout> | undefined;\n listen(\n document,\n 'pointerover',\n (event) => {\n const link = pageLink(event.target);\n if (link) {\n clearTimeout(resting);\n resting = setTimeout(() => prefetch(link), 80);\n }\n },\n { passive: true },\n );\n listen(document, 'pointerout', () => clearTimeout(resting), { passive: true });\n listen(document, 'focusin', (event) => prefetch(pageLink(event.target)));\n listen(document, 'submit', (event) => {\n const form = event.target as HTMLFormElement;\n const submitter = (event as SubmitEvent).submitter;\n const action = submitter?.getAttribute('formaction') ?? form.getAttribute('action') ?? '';\n const method = submitter?.getAttribute('formmethod') ?? form.getAttribute('method');\n if (\n event.defaultPrevented ||\n method?.toLowerCase() !== 'post' ||\n !action.startsWith(rpc) ||\n // After a deploy, the browser posts the form itself, and the page that answers is new.\n skewed\n ) {\n return;\n }\n event.preventDefault();\n void go(action, { method: 'POST', body: new FormData(form, submitter) });\n });\n // A server function that redirects, from `rpc.ts`. Another site loads in full.\n listen(document, 'brumate:redirect', (event) => {\n const url = new URL((event as CustomEvent<string>).detail, location.href);\n if (url.origin === location.origin) {\n event.preventDefault();\n void go(url.href, undefined, true, true);\n }\n });\n // A hot update whose markup changed loads the page again, in place. With `init`, the whole\n // page is replaced, as for a form, so layouts render again too, and it keeps the scroll.\n listen(document, 'brumate:reload', () => void go(location.href, { method: 'GET' }, false));\n // The query string moved by `$searchParam` stays on the page, so the next change is told from it.\n if (HAS_SEARCH_PARAMS) {\n listen(document, 'brumate:search', () => {\n page = location.href.split('#')[0]!;\n });\n }\n listen(window, 'popstate', () => {\n // A change of the hash only stays on the page.\n const target = location.href.split('#')[0]!;\n if (target !== page) {\n // `$searchParam` follows the history itself when only its parameters changed.\n const follow = HAS_SEARCH_PARAMS\n ? (globalThis as Record<symbol, ((from: string) => boolean) | undefined>)[\n Symbol.for('brumate.search')\n ]\n : undefined;\n if (follow?.(page)) {\n page = target;\n } else {\n void go(location.href, undefined, false);\n }\n }\n });\n return () =>\n Promise.all([importCore(), document.querySelector('[b-offset],[b-roots]') && routes()]).then(\n ([client]) => client,\n );\n}\n"],"mappings":";;;;;;;;;AAcA,SAAgB,MAAM,SAAoC;CACxD,OAAO,KAAK,SAAS,QAAQ,aAAa,QAAQ,KAAA,IAAY,UAAU;AAC1E;;AAGA,SAAS,SAAS,MAA2C;CAC3D,IAAI,QAAQ,KAAK,aAAa,eAAe,MAAM,QACjD,OAAY,yBAAgB,CAAC,MAAM,WAAW,OAAO,SAAS,KAAK,IAAI,CAAC;AAE5E;;;;;;;AAQA,SAAS,SAAmC;CAC1C,OAAO,OAAO,8BAAqB,CAAC,MAAM,WAAW,OAAO,KAAK;AACnE;;;;;;;AAQA,SAAS,WAAW,EAClB,SACA,QACA,MACA,OAAO,WACP,QACkC;C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YAAY,MAChB;AACJ"}
|
|
1
|
+
{"version":3,"file":"loader-BPNSRA2A.js","names":[],"sources":["../src/runtime/loader.ts"],"sourcesContent":["import type * as Routes from './client-routes.ts';\nimport { boot, importCore } from './boot.ts';\nimport { NAVIGATION_KEY, ROUTE_KEY } from './context.ts';\nimport { HAS_SEARCH_PARAMS } from './features.ts';\nimport type { Core, LoaderOptions, Navigation } from './boot.ts';\n\nexport type { LoaderOptions, NavigateOptions } from './boot.ts';\nexport { startWithoutNavigation } from './static-loader.ts';\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 * Returns a function that removes the listeners and stops the core.\n */\nexport function start(options: LoaderOptions): () => void {\n return boot(options, options.navigate === false ? undefined : navigation);\n}\n\n/** Starts loading the page of a link, unless the link asks not to. */\nfunction prefetch(link: HTMLAnchorElement | undefined): void {\n if (link && link.getAttribute('data-prefetch') !== 'none') {\n void import('./navigate.ts').then((module) => module.prefetch(link.href));\n }\n}\n\n/**\n * Imports the code with which the core reads the pages that navigation adds.\n * A core that runs loads it when the loader navigates. A core that starts\n * later loads it with the core, when the page has records that navigation\n * marked.\n */\nfunction routes(): (typeof Routes)['ready'] {\n return import('./client-routes.ts').then((module) => module.ready);\n}\n\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. Returns how the loader imports\n * the core.\n */\nfunction navigation({\n options,\n listen,\n core,\n start: startCore,\n scan,\n}: Navigation): () => Promise<Core> {\n const rpc = `${options.rpc ?? '/_brumate'}/`;\n const settings = typeof options.navigate === 'object' ? options.navigate : {};\n // The page without its hash, to tell a change of the hash from a change of the page.\n let page = String(location.href).split('#')[0];\n // True once the site changed since the page loaded: the next page loads in full, with new code.\n let skewed = false;\n listen(document, 'brumate:skew', () => {\n skewed = true;\n });\n // The core when the page reads a context of navigation, which it starts for them, or when it runs.\n function reader(key: string): Promise<Core> | undefined {\n const running = core();\n if (running) {\n return running;\n }\n for (const script of document.querySelectorAll('script[b-state]')) {\n if (script.textContent?.includes(key)) {\n return startCore();\n }\n }\n return undefined;\n }\n function state(value: { pending: boolean; from?: string; to?: string }): void {\n void reader(NAVIGATION_KEY)?.then((client) => client.setGlobal(NAVIGATION_KEY, value));\n }\n function go(\n url: string,\n init?: RequestInit,\n push = true,\n reload = false,\n scroll = true,\n ): Promise<void> {\n const from = location.href;\n if (skewed) {\n // A form post cannot be a full page load: the page loads again, and the form is lost with\n // the rest of the state of the page.\n if (init) {\n location.reload();\n } else {\n location.assign(url);\n }\n return Promise.resolve();\n }\n page = url.split('#')[0]!;\n if (core()) {\n void routes();\n }\n // CSS can show a progress bar while a page loads, with no client code in the page.\n document.documentElement.setAttribute('data-navigating', '');\n state({ pending: true, from, to: new URL(url, from).href });\n function done(): void {\n document.documentElement.removeAttribute('data-navigating');\n state({ pending: false });\n }\n return import('./navigate.ts')\n .then((module) =>\n module.navigate({\n url,\n init,\n push,\n reload,\n scroll,\n build: options.build,\n focus: settings.focus !== false,\n transition: settings.transition === true,\n // The core forgets the old page, or only stops reading, when layouts stay.\n leave: async (partial) => {\n if (core()) {\n (await routes())(partial);\n }\n },\n enter: () => {\n // The core took the serial entry when it started.\n void core()?.then((client) =>\n client.init({ ...options, serial: undefined, listen: scan }),\n );\n // Code that reads the route, such as in a layout that stays, gets the new one.\n void reader(ROUTE_KEY)?.then((client) => client.updateRoute());\n page = location.href.split('#')[0]!;\n },\n }),\n )\n .finally(done);\n }\n // `navigate(href, options)` from `brumate/routes`.\n listen(document, 'brumate:navigate', (event) => {\n const detail = (\n event as CustomEvent<{ url: string; replace: boolean; scroll: boolean; done: () => void }>\n ).detail;\n event.preventDefault();\n void go(detail.url, undefined, !detail.replace, false, detail.scroll).then(detail.done);\n });\n // A link to another page of this site, which the loader loads itself.\n function pageLink(target: EventTarget | null): HTMLAnchorElement | undefined {\n const link = (target as Element | null)?.closest?.('a[href]') as HTMLAnchorElement | null;\n return link &&\n !link.target &&\n !link.matches('[download],[data-reload]') &&\n link.origin === location.origin &&\n // A link to a place in the same page scrolls there.\n !(link.hash && link.href.split('#')[0] === page)\n ? link\n : undefined;\n }\n listen(document, 'click', (event) => {\n const mouse = event as MouseEvent;\n const link = pageLink(event.target);\n if (\n !link ||\n event.defaultPrevented ||\n mouse.button ||\n mouse.metaKey ||\n mouse.ctrlKey ||\n mouse.shiftKey ||\n mouse.altKey\n ) {\n return;\n }\n event.preventDefault();\n void go(link.href);\n });\n // A page loads when the pointer rests on its link, or the link gets focus, so a click finds it loading.\n let resting: ReturnType<typeof setTimeout> | undefined;\n listen(\n document,\n 'pointerover',\n (event) => {\n const link = pageLink(event.target);\n if (link) {\n clearTimeout(resting);\n resting = setTimeout(() => prefetch(link), 80);\n }\n },\n { passive: true },\n );\n listen(document, 'pointerout', () => clearTimeout(resting), { passive: true });\n listen(document, 'focusin', (event) => prefetch(pageLink(event.target)));\n listen(document, 'submit', (event) => {\n const form = event.target as HTMLFormElement;\n const submitter = (event as SubmitEvent).submitter;\n const action = submitter?.getAttribute('formaction') ?? form.getAttribute('action') ?? '';\n const method = submitter?.getAttribute('formmethod') ?? form.getAttribute('method');\n if (\n event.defaultPrevented ||\n method?.toLowerCase() !== 'post' ||\n !action.startsWith(rpc) ||\n // After a deploy, the browser posts the form itself, and the page that answers is new.\n skewed\n ) {\n return;\n }\n event.preventDefault();\n void go(action, { method: 'POST', body: new FormData(form, submitter) });\n });\n // A server function that redirects, from `rpc.ts`. Another site loads in full.\n listen(document, 'brumate:redirect', (event) => {\n const url = new URL((event as CustomEvent<string>).detail, location.href);\n if (url.origin === location.origin) {\n event.preventDefault();\n void go(url.href, undefined, true, true);\n }\n });\n // A hot update whose markup changed loads the page again, in place. With `init`, the whole\n // page is replaced, as for a form, so layouts render again too, and it keeps the scroll.\n listen(document, 'brumate:reload', () => void go(location.href, { method: 'GET' }, false));\n // The query string moved by `$searchParam` stays on the page, so the next change is told from it.\n if (HAS_SEARCH_PARAMS) {\n listen(document, 'brumate:search', () => {\n page = location.href.split('#')[0]!;\n });\n }\n listen(window, 'popstate', () => {\n // A change of the hash only stays on the page.\n const target = location.href.split('#')[0]!;\n if (target !== page) {\n // `$searchParam` follows the history itself when only its parameters changed.\n const follow = HAS_SEARCH_PARAMS\n ? (globalThis as Record<symbol, ((from: string) => boolean) | undefined>)[\n Symbol.for('brumate.search')\n ]\n : undefined;\n if (follow?.(page)) {\n page = target;\n } else {\n void go(location.href, undefined, false);\n }\n }\n });\n return () =>\n Promise.all([importCore(), document.querySelector('[b-offset],[b-roots]') && routes()]).then(\n ([client]) => client,\n );\n}\n"],"mappings":";;;;;;;;;AAcA,SAAgB,MAAM,SAAoC;CACxD,OAAO,KAAK,SAAS,QAAQ,aAAa,QAAQ,KAAA,IAAY,UAAU;AAC1E;;AAGA,SAAS,SAAS,MAA2C;CAC3D,IAAI,QAAQ,KAAK,aAAa,eAAe,MAAM,QACjD,OAAY,yBAAgB,CAAC,MAAM,WAAW,OAAO,SAAS,KAAK,IAAI,CAAC;AAE5E;;;;;;;AAQA,SAAS,SAAmC;CAC1C,OAAO,OAAO,8BAAqB,CAAC,MAAM,WAAW,OAAO,KAAK;AACnE;;;;;;;AAQA,SAAS,WAAW,EAClB,SACA,QACA,MACA,OAAO,WACP,QACkC;CAClC,MAAM,MAAM,GAAG,QAAQ,OAAO,YAAY;CAC1C,MAAM,WAAW,OAAO,QAAQ,aAAa,WAAW,QAAQ,WAAW,CAAC;CAE5E,IAAI,OAAO,OAAO,SAAS,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;CAE5C,IAAI,SAAS;CACb,OAAO,UAAU,sBAAsB;EACrC,SAAS;CACX,CAAC;CAED,SAAS,OAAO,KAAwC;EACtD,MAAM,UAAU,KAAK;EACrB,IAAI,SACF,OAAO;EAET,KAAK,MAAM,UAAU,SAAS,iBAAiB,iBAAiB,GAC9D,IAAI,OAAO,aAAa,SAAS,GAAG,GAClC,OAAO,UAAU;CAIvB;CACA,SAAS,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AAM,SAAS;EAAE,CAAC;CACzE,CAAC;CAED,OAAO,UAAU,qBAAqB,UAAU;EAC9C,MAAM,MAAM,IAAI,IAAK,MAA8B,QAAQ,SAAS,IAAI;EACxE,IAAI,IAAI,WAAW,SAAS,QAAQ;GAClC,MAAM,eAAe;GACrB,GAAQ,IAAI,MAAM,KAAA,GAAW,MAAM,IAAI;EACzC;CACF,CAAC;CAGD,OAAO,UAAU,wBAAwB,KAAK,GAAG,SAAS,MAAM,EAAE,QAAQ,MAAM,GAAG,KAAK,CAAC;CAEzF,IAAI,mBACF,OAAO,UAAU,wBAAwB;EACvC,OAAO,SAAS,KAAK,MAAM,GAAG,CAAC,CAAC;CAClC,CAAC;CAEH,OAAO,QAAQ,kBAAkB;EAE/B,MAAM,SAAS,SAAS,KAAK,MAAM,GAAG,CAAC,CAAC;EACxC,IAAI,WAAW,MAAM;GAOnB,KALe,oBACV,WACC,OAAO,IAAI,gBAAgB,KAE7B,KAAA,EAAA,GACS,IAAI,GACf,OAAO;QAEP,GAAQ,SAAS,MAAM,KAAA,GAAW,KAAK;EAE3C;CACF,CAAC;CACD,aACE,QAAQ,IAAI,CAAC,WAAW,GAAG,SAAS,cAAc,sBAAsB,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,MACrF,CAAC,YAAY,MAChB;AACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as callPlugins, n as fromChunkStream, s as serialOptions } from "./stream-
|
|
2
|
-
import { hn as build, yn as skew } from "./client-
|
|
1
|
+
import { a as callPlugins, n as fromChunkStream, s as serialOptions } from "./stream-RXLadXx1.js";
|
|
2
|
+
import { hn as build, yn as skew } from "./client-Bm0XbjHr.js";
|
|
3
3
|
import { toJSONAsync } from "seroval";
|
|
4
4
|
//#region src/runtime/rpc.ts
|
|
5
5
|
/**
|
|
@@ -146,4 +146,4 @@ function sendAction(form, submitter) {
|
|
|
146
146
|
//#endregion
|
|
147
147
|
export { call, sendAction };
|
|
148
148
|
|
|
149
|
-
//# sourceMappingURL=rpc-
|
|
149
|
+
//# sourceMappingURL=rpc-DqfCaYgF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-B9EkaPdU.js","names":[],"sources":["../src/runtime/rpc.ts"],"sourcesContent":["import { toJSONAsync } from 'seroval';\nimport { build, skew } from './client.ts';\nimport type { Scope } from './client.ts';\nimport { callPlugins, serialOptions } from './serial.ts';\nimport { fromChunkStream } from './stream.ts';\n\n/**\n * Calls a server function. It is a separate module, so pages that never call\n * one never load seroval's serializer.\n *\n * Files and blobs in the arguments, anywhere in them, go as parts of\n * multipart form data. `signal` aborts the call.\n */\nexport async function call(\n prefix: string,\n id: string,\n args: unknown[],\n signal?: AbortSignal,\n): Promise<unknown> {\n // The plugin of uploads takes each file and blob in the arguments, wherever it is.\n const files: Blob[] = [];\n const json = JSON.stringify(\n await toJSONAsync(args, { plugins: callPlugins(files), ...serialOptions() }),\n );\n let init: RequestInit;\n if (files.length > 0) {\n const form = new FormData();\n form.set('args', json);\n // A blob of another DOM is copied, because form data takes only its own.\n const copies: (Blob | Promise<Blob>)[] = [];\n for (const file of files) {\n // Typed as a Blob, so the check narrows a blob of another DOM to never.\n copies.push(\n file instanceof Blob\n ? file\n : (file as Blob)\n .arrayBuffer()\n .then((data) => new Blob([data], { type: (file as Blob).type })),\n );\n }\n const blobs = await Promise.all(copies);\n for (const [index, blob] of blobs.entries()) {\n form.set(`file${index}`, blob, (files[index] as Partial<File>).name ?? 'blob');\n }\n init = { headers: { 'x-brumate-args': 'form' }, body: form };\n } else {\n init = { headers: { 'content-type': 'application/json' }, body: json };\n }\n return post(prefix, id, { ...init, signal });\n}\n\n/**\n * Sends a form to a server function, and returns its result. The form data\n * goes as it is, files included, as when the browser posts the form.\n */\nexport async function submit(\n prefix: string,\n id: string,\n form: FormData,\n key?: string | null,\n): Promise<unknown> {\n return post(prefix, id, { headers: { 'x-brumate-result': '1' }, body: form }, key);\n}\n\n/** Posts to a server function, and reads its answer. */\nasync function post(\n prefix: string,\n id: string,\n init: RequestInit,\n key?: string | null,\n): Promise<unknown> {\n const headers = new Headers(init.headers);\n // The build of the page, so the server can tell a call from before a deploy.\n if (build !== undefined) {\n headers.set('x-brumate-build', build);\n }\n // The key of a form of a function that `idempotent` made.\n const query = key ? `?__key=${encodeURIComponent(key)}` : '';\n return answer(\n id,\n await fetch(`${prefix}/${encodeURIComponent(id)}${query}`, {\n ...init,\n headers,\n method: 'POST',\n }),\n );\n}\n\n/** Reads the answer of a server function: its result, a redirect or an error. */\nasync function answer(id: string, response: Response): Promise<unknown> {\n // The server functions whose memos load again, from `refresh` on the server.\n const refreshed = response.headers.get('x-brumate-refresh');\n if (refreshed) {\n const ids = refreshed.split(',');\n void refreshMemos(ids);\n document.dispatchEvent(new CustomEvent('brumate:refresh', { detail: ids }));\n }\n const location = response.headers.get('x-brumate-redirect');\n if (location !== null) {\n // The loader navigates on the client when it can. Without client navigation, the page loads in full.\n const redirect = new CustomEvent('brumate:redirect', { detail: location, cancelable: true });\n if (document.dispatchEvent(redirect)) {\n window.location.assign(location);\n }\n // The page is leaving, so the call never settles.\n return new Promise(() => {});\n }\n if (!response.ok) {\n // The site changed, and this page is from before. The next page loads in full.\n if (response.status === 409 && response.headers.get('x-brumate-build')) {\n skew('call');\n }\n let message = `Server function \"${id}\" failed with status ${response.status}`;\n try {\n message = ((await response.json()) as { error: string }).error;\n } catch {\n // The body is not the error of a server function.\n }\n const retryAfter = Number(response.headers.get('retry-after'));\n throw Object.assign(new Error(message), {\n name: 'ServerError',\n status: response.status,\n // The seconds to wait, for a call that a rate limit refused.\n ...(retryAfter > 0 ? { retryAfter } : {}),\n });\n }\n // Promises and async iterables in the result settle as the rest of the answer arrives.\n return fromChunkStream(response.body!);\n}\n\n// The code below reads the core with `import()`, not a static import: a module that imports\n// the core statically would make the package build move the core into a chunk of its own, behind\n// a module that only re-exports it, which a page loads one after the other. The core is loaded\n// already when it runs, so the import costs no request. It names the exports it uses, so a build\n// keeps only them.\n\n/**\n * Loads again the memos that call these server functions, after a server\n * function named them with `refresh`. Each component on the page knows its\n * own memos, from its client module. It is here, and not in the core, because\n * only the answer of a server call starts it.\n */\nexport function refreshMemos(ids: string[]): Promise<void> {\n return import('./client.ts').then(({ descendants, loadModule, scopes }) => {\n for (const root of scopes.values()) {\n if (!root.m) {\n continue;\n }\n void loadModule(root.m).then(async (module) => {\n const entries: NonNullable<typeof module.refresh>[string] = [];\n for (const id of ids) {\n entries.push(...(module.refresh?.[id] ?? []));\n }\n if (entries.length === 0) {\n return;\n }\n const updates = module as unknown as Record<string, unknown>;\n for (const [kind, name] of entries) {\n for (const target of kind === root.k ? [root] : descendants(root, kind)) {\n if (scopes.has(target.id)) {\n (updates[name] as (scope: Scope) => void)(target);\n }\n }\n }\n });\n }\n });\n}\n\n/** Gives a form a new key in its URL, for its next post. */\nfunction renewKey(form: HTMLFormElement, url: URL): void {\n url.searchParams.set('__key', crypto.randomUUID());\n form.setAttribute('action', `${url.pathname}${url.search}`);\n}\n\n/**\n * Sends a form to the server function of its `$action`, and writes the\n * result into the `$action` when it arrives. It is pending until then. See\n * `submitAction` in the core.\n */\nexport function sendAction(form: HTMLFormElement, submitter: HTMLElement | null): Promise<void> {\n const [scopeText, slotText] = form.getAttribute('b-result')!.split(':') as [string, string];\n const scopeId = Number(scopeText);\n const slot = Number(slotText);\n const data = new FormData(form, submitter);\n const action = form.getAttribute('b-action')!;\n return import('./client.ts').then(({ asyncMemo, rpcPrefix, scopes, track }) => {\n const scope = scopes.get(scopeId);\n if (scope) {\n // A form of a function that `idempotent` made sends its key, and gets a new one once the\n // server answered, so a post that the user means again runs again.\n const url = new URL(form.getAttribute('action') ?? '', location.href);\n const key = url.searchParams.get('__key');\n const result = submit(rpcPrefix, action, data, key);\n if (key) {\n void result.then(\n () => renewKey(form, url),\n () => {},\n );\n }\n const answered = result.catch((error: unknown) => {\n // The site changed since the page loaded. The form posts again without scripts, and the\n // page that answers is of the new build.\n if ((error as { status?: number }).status === 409 && build !== undefined) {\n form.submit();\n return new Promise(() => {});\n }\n throw error;\n });\n asyncMemo(scope, slot, track(answered));\n }\n });\n}\n"],"mappings":";;;;;;;;;;;AAaA,eAAsB,KACpB,QACA,IACA,MACA,QACkB;CAElB,MAAM,QAAgB,CAAC;CACvB,MAAM,OAAO,KAAK,UAChB,MAAM,YAAY,MAAM;EAAE,SAAS,YAAY,KAAK;EAAG,GAAG,cAAc;CAAE,CAAC,CAC7E;CACA,IAAI;CACJ,IAAI,MAAM,SAAS,GAAG;EACpB,MAAM,OAAO,IAAI,SAAS;EAC1B,KAAK,IAAI,QAAQ,IAAI;EAErB,MAAM,SAAmC,CAAC;EAC1C,KAAK,MAAM,QAAQ,OAEjB,OAAO,KACL,gBAAgB,OACZ,OACC,KACE,YAAY,CAAC,CACb,MAAM,SAAS,IAAI,KAAK,CAAC,IAAI,GAAG,EAAE,MAAO,KAAc,KAAK,CAAC,CAAC,CACvE;EAEF,MAAM,QAAQ,MAAM,QAAQ,IAAI,MAAM;EACtC,KAAK,MAAM,CAAC,OAAO,SAAS,MAAM,QAAQ,GACxC,KAAK,IAAI,OAAO,SAAS,MAAO,MAAM,MAAM,CAAmB,QAAQ,MAAM;EAE/E,OAAO;GAAE,SAAS,EAAE,kBAAkB,OAAO;GAAG,MAAM;EAAK;CAC7D,OACE,OAAO;EAAE,SAAS,EAAE,gBAAgB,mBAAmB;EAAG,MAAM;CAAK;CAEvE,OAAO,KAAK,QAAQ,IAAI;EAAE,GAAG;EAAM;CAAO,CAAC;AAC7C;;;;;AAMA,eAAsB,OACpB,QACA,IACA,MACA,KACkB;CAClB,OAAO,KAAK,QAAQ,IAAI;EAAE,SAAS,EAAE,oBAAoB,IAAI;EAAG,MAAM;CAAK,GAAG,GAAG;AACnF;;AAGA,eAAe,KACb,QACA,IACA,MACA,KACkB;CAClB,MAAM,UAAU,IAAI,QAAQ,KAAK,OAAO;CAExC,IAAI,UAAU,KAAA,GACZ,QAAQ,IAAI,mBAAm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GAAG,SAClB,CAAC,CACT;GAEF,MAAM,WAAW,OAAO,OAAO,UAAmB;IAGhD,IAAK,MAA8B,WAAW,OAAO,UAAU,KAAA,GAAW;KACxE,KAAK,OAAO;KACZ,OAAO,IAAI,cAAc,CAAC,CAAC;IAC7B;IACA,MAAM;GACR,CAAC;GACD,UAAU,OAAO,MAAM,MAAM,QAAQ,CAAC;EACxC;CACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"rpc-DqfCaYgF.js","names":[],"sources":["../src/runtime/rpc.ts"],"sourcesContent":["import { toJSONAsync } from 'seroval';\nimport { build, skew } from './client.ts';\nimport type { Scope } from './client.ts';\nimport { callPlugins, serialOptions } from './serial.ts';\nimport { fromChunkStream } from './stream.ts';\n\n/**\n * Calls a server function. It is a separate module, so pages that never call\n * one never load seroval's serializer.\n *\n * Files and blobs in the arguments, anywhere in them, go as parts of\n * multipart form data. `signal` aborts the call.\n */\nexport async function call(\n prefix: string,\n id: string,\n args: unknown[],\n signal?: AbortSignal,\n): Promise<unknown> {\n // The plugin of uploads takes each file and blob in the arguments, wherever it is.\n const files: Blob[] = [];\n const json = JSON.stringify(\n await toJSONAsync(args, { plugins: callPlugins(files), ...serialOptions() }),\n );\n let init: RequestInit;\n if (files.length > 0) {\n const form = new FormData();\n form.set('args', json);\n // A blob of another DOM is copied, because form data takes only its own.\n const copies: (Blob | Promise<Blob>)[] = [];\n for (const file of files) {\n // Typed as a Blob, so the check narrows a blob of another DOM to never.\n copies.push(\n file instanceof Blob\n ? file\n : (file as Blob)\n .arrayBuffer()\n .then((data) => new Blob([data], { type: (file as Blob).type })),\n );\n }\n const blobs = await Promise.all(copies);\n for (const [index, blob] of blobs.entries()) {\n form.set(`file${index}`, blob, (files[index] as Partial<File>).name ?? 'blob');\n }\n init = { headers: { 'x-brumate-args': 'form' }, body: form };\n } else {\n init = { headers: { 'content-type': 'application/json' }, body: json };\n }\n return post(prefix, id, { ...init, signal });\n}\n\n/**\n * Sends a form to a server function, and returns its result. The form data\n * goes as it is, files included, as when the browser posts the form.\n */\nexport async function submit(\n prefix: string,\n id: string,\n form: FormData,\n key?: string | null,\n): Promise<unknown> {\n return post(prefix, id, { headers: { 'x-brumate-result': '1' }, body: form }, key);\n}\n\n/** Posts to a server function, and reads its answer. */\nasync function post(\n prefix: string,\n id: string,\n init: RequestInit,\n key?: string | null,\n): Promise<unknown> {\n const headers = new Headers(init.headers);\n // The build of the page, so the server can tell a call from before a deploy.\n if (build !== undefined) {\n headers.set('x-brumate-build', build);\n }\n // The key of a form of a function that `idempotent` made.\n const query = key ? `?__key=${encodeURIComponent(key)}` : '';\n return answer(\n id,\n await fetch(`${prefix}/${encodeURIComponent(id)}${query}`, {\n ...init,\n headers,\n method: 'POST',\n }),\n );\n}\n\n/** Reads the answer of a server function: its result, a redirect or an error. */\nasync function answer(id: string, response: Response): Promise<unknown> {\n // The server functions whose memos load again, from `refresh` on the server.\n const refreshed = response.headers.get('x-brumate-refresh');\n if (refreshed) {\n const ids = refreshed.split(',');\n void refreshMemos(ids);\n document.dispatchEvent(new CustomEvent('brumate:refresh', { detail: ids }));\n }\n const location = response.headers.get('x-brumate-redirect');\n if (location !== null) {\n // The loader navigates on the client when it can. Without client navigation, the page loads in full.\n const redirect = new CustomEvent('brumate:redirect', { detail: location, cancelable: true });\n if (document.dispatchEvent(redirect)) {\n window.location.assign(location);\n }\n // The page is leaving, so the call never settles.\n return new Promise(() => {});\n }\n if (!response.ok) {\n // The site changed, and this page is from before. The next page loads in full.\n if (response.status === 409 && response.headers.get('x-brumate-build')) {\n skew('call');\n }\n let message = `Server function \"${id}\" failed with status ${response.status}`;\n try {\n message = ((await response.json()) as { error: string }).error;\n } catch {\n // The body is not the error of a server function.\n }\n const retryAfter = Number(response.headers.get('retry-after'));\n throw Object.assign(new Error(message), {\n name: 'ServerError',\n status: response.status,\n // The seconds to wait, for a call that a rate limit refused.\n ...(retryAfter > 0 ? { retryAfter } : {}),\n });\n }\n // Promises and async iterables in the result settle as the rest of the answer arrives.\n return fromChunkStream(response.body!);\n}\n\n// The code below reads the core with `import()`, not a static import: a module that imports\n// the core statically would make the package build move the core into a chunk of its own, behind\n// a module that only re-exports it, which a page loads one after the other. The core is loaded\n// already when it runs, so the import costs no request. It names the exports it uses, so a build\n// keeps only them.\n\n/**\n * Loads again the memos that call these server functions, after a server\n * function named them with `refresh`. Each component on the page knows its\n * own memos, from its client module. It is here, and not in the core, because\n * only the answer of a server call starts it.\n */\nexport function refreshMemos(ids: string[]): Promise<void> {\n return import('./client.ts').then(({ descendants, loadModule, scopes }) => {\n for (const root of scopes.values()) {\n if (!root.m) {\n continue;\n }\n void loadModule(root.m).then(async (module) => {\n const entries: NonNullable<typeof module.refresh>[string] = [];\n for (const id of ids) {\n entries.push(...(module.refresh?.[id] ?? []));\n }\n if (entries.length === 0) {\n return;\n }\n const updates = module as unknown as Record<string, unknown>;\n for (const [kind, name] of entries) {\n for (const target of kind === root.k ? [root] : descendants(root, kind)) {\n if (scopes.has(target.id)) {\n (updates[name] as (scope: Scope) => void)(target);\n }\n }\n }\n });\n }\n });\n}\n\n/** Gives a form a new key in its URL, for its next post. */\nfunction renewKey(form: HTMLFormElement, url: URL): void {\n url.searchParams.set('__key', crypto.randomUUID());\n form.setAttribute('action', `${url.pathname}${url.search}`);\n}\n\n/**\n * Sends a form to the server function of its `$action`, and writes the\n * result into the `$action` when it arrives. It is pending until then. See\n * `submitAction` in the core.\n */\nexport function sendAction(form: HTMLFormElement, submitter: HTMLElement | null): Promise<void> {\n const [scopeText, slotText] = form.getAttribute('b-result')!.split(':') as [string, string];\n const scopeId = Number(scopeText);\n const slot = Number(slotText);\n const data = new FormData(form, submitter);\n const action = form.getAttribute('b-action')!;\n return import('./client.ts').then(({ asyncMemo, rpcPrefix, scopes, track }) => {\n const scope = scopes.get(scopeId);\n if (scope) {\n // A form of a function that `idempotent` made sends its key, and gets a new one once the\n // server answered, so a post that the user means again runs again.\n const url = new URL(form.getAttribute('action') ?? '', location.href);\n const key = url.searchParams.get('__key');\n const result = submit(rpcPrefix, action, data, key);\n if (key) {\n void result.then(\n () => renewKey(form, url),\n () => {},\n );\n }\n const answered = result.catch((error: unknown) => {\n // The site changed since the page loaded. The form posts again without scripts, and the\n // page that answers is of the new build.\n if ((error as { status?: number }).status === 409 && build !== undefined) {\n form.submit();\n return new Promise(() => {});\n }\n throw error;\n });\n asyncMemo(scope, slot, track(answered));\n }\n });\n}\n"],"mappings":";;;;;;;;;;;AAaA,eAAsB,KACpB,QACA,IACA,MACA,QACkB;CAElB,MAAM,QAAgB,CAAC;CACvB,MAAM,OAAO,KAAK,UAChB,MAAM,YAAY,MAAM;EAAE,SAAS,YAAY,KAAK;EAAG,GAAG,cAAc;CAAE,CAAC,CAC7E;CACA,IAAI;CACJ,IAAI,MAAM,SAAS,GAAG;EACpB,MAAM,OAAO,IAAI,SAAS;EAC1B,KAAK,IAAI,QAAQ,IAAI;EAErB,MAAM,SAAmC,CAAC;EAC1C,KAAK,MAAM,QAAQ,OAEjB,OAAO,KACL,gBAAgB,OACZ,OACC,KACE,YAAY,CAAC,CACb,MAAM,SAAS,IAAI,KAAK,CAAC,IAAI,GAAG,EAAE,MAAO,KAAc,KAAK,CAAC,CAAC,CACvE;EAEF,MAAM,QAAQ,MAAM,QAAQ,IAAI,MAAM;EACtC,KAAK,MAAM,CAAC,OAAO,SAAS,MAAM,QAAQ,GACxC,KAAK,IAAI,OAAO,SAAS,MAAO,MAAM,MAAM,CAAmB,QAAQ,MAAM;EAE/E,OAAO;GAAE,SAAS,EAAE,kBAAkB,OAAO;GAAG,MAAM;EAAK;CAC7D,OACE,OAAO;EAAE,SAAS,EAAE,gBAAgB,mBAAmB;EAAG,MAAM;CAAK;CAEvE,OAAO,KAAK,QAAQ,IAAI;EAAE,GAAG;EAAM;CAAO,CAAC;AAC7C;;;;;AAMA,eAAsB,OACpB,QACA,IACA,MACA,KACkB;CAClB,OAAO,KAAK,QAAQ,IAAI;EAAE,SAAS,EAAE,oBAAoB,IAAI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AAa,QAAQ,KAAK,IAAI,SAAS,IAAI;GACpE,MAAM,MAAM,IAAI,aAAa,IAAI,OAAO;GACxC,MAAM,SAAS,OAAO,WAAW,QAAQ,MAAM,GAAG;GAClD,IAAI,KACF,OAAY,WACJ,SAAS,MAAM,GAAG,SAClB,CAAC,CACT;GAEF,MAAM,WAAW,OAAO,OAAO,UAAmB;IAGhD,IAAK,MAA8B,WAAW,OAAO,UAAU,KAAA,GAAW;KACxE,KAAK,OAAO;KACZ,OAAO,IAAI,cAAc,CAAC,CAAC;IAC7B;IACA,MAAM;GACR,CAAC;GACD,UAAU,OAAO,MAAM,MAAM,QAAQ,CAAC;EACxC;CACF,CAAC;AACH"}
|
package/dist/runtime/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as navigationContext, l as routeContext, o as createContext } from "../context-BNgBXVUQ.js";
|
|
2
|
-
import { A as mergeAttributes, C as escape, D as internal, P as raw, _ as affix, d as unbind, j as onAttribute, m as Raw, s as SCOPE_IDS, u as gateValue, v as attribute, x as classAttribute, z as vars } from "../shared-
|
|
3
|
-
import { $ as list, $t as hooks, A as nodes, At as leavePage, B as descendants, Bt as consumeContext, C as clone, Cn as rekey, Ct as wait, D as keepText, Dt as dispose, E as keep, Et as nameComment, F as setOn, Ft as handle, G as sink, Gt as toStore, H as makeId, Ht as provideValue, I as setSpread, It as handlerProp, J as addHead, Jt as CoreOptions, K as prop, Kt as updateRoute, L as template, Lt as rpc, M as setAttr, Mt as remount, N as setAttrText, Nt as removeRoot, O as listNodes, Ot as forget, P as setContent, Pt as action, Q as setVar, Qt as build, R as afterInsert, Rt as spread, S as branchNodes, Sn as offscreen, St as started, T as fillList, Tn as retag, Tt as loadModule, U as removeScope, Ut as setGlobal, V as getScope, Vt as consumeStore, W as setOwner, Wt as storeUpdate, X as addStyle, Xt as DevtoolsHooks, Y as addPortal, Yt as DEVTOOLS, Z as deferInBrowser, Zt as Scope, _ as updated, _n as templateCall, _t as fillSpread, a as cells, an as componentNodes, at as content, b as searchParam, bn as fill, bt as loading, c as get, cn as elementAt, ct as text, d as pending, dn as readMemo, dt as track, en as rpcPrefix, et as toList, f as resolve, fn as renderMemo, ft as after, g as update, gn as insert, gt as fillSettled, h as unreadMemo, hn as children, ht as fillAttrs, i as bindings, in as component, it as attrs, j as putText, jt as leaveRoutes, k as markBlock, kt as init, l as isBound, ln as foreignNodes, lt as writeText, m as timed, mn as setSlots, mt as countLoads, n as asyncMemo, nn as skew, nt as windowStart, o as effect, on as dynamic, ot as portalTo, p as set, pn as setItem, pt as attempt, q as spreadProps, qt as ClientModule, r as binding, rn as Component, rt as attr, s as gate, sn as dynamicNodes, st as restRef, t as loader, tn as scopes, tt as windowList, u as memo, un as place, ut as guess, v as title, vn as HiddenBody, vt as fillValue, w as fillBranch, wn as reset, wt as fail, x as appendText, xn as held, xt as reveal, y as paramEffect, yn as branch, yt as keepValue, z as createScope, zt as submitAction } from "../client-
|
|
2
|
+
import { A as mergeAttributes, C as escape, D as internal, P as raw, _ as affix, d as unbind, j as onAttribute, m as Raw, s as SCOPE_IDS, u as gateValue, v as attribute, x as classAttribute, z as vars } from "../shared-CuJdWifz.js";
|
|
3
|
+
import { $ as list, $t as hooks, A as nodes, At as leavePage, B as descendants, Bt as consumeContext, C as clone, Cn as rekey, Ct as wait, D as keepText, Dt as dispose, E as keep, Et as nameComment, F as setOn, Ft as handle, G as sink, Gt as toStore, H as makeId, Ht as provideValue, I as setSpread, It as handlerProp, J as addHead, Jt as CoreOptions, K as prop, Kt as updateRoute, L as template, Lt as rpc, M as setAttr, Mt as remount, N as setAttrText, Nt as removeRoot, O as listNodes, Ot as forget, P as setContent, Pt as action, Q as setVar, Qt as build, R as afterInsert, Rt as spread, S as branchNodes, Sn as offscreen, St as started, T as fillList, Tn as retag, Tt as loadModule, U as removeScope, Ut as setGlobal, V as getScope, Vt as consumeStore, W as setOwner, Wt as storeUpdate, X as addStyle, Xt as DevtoolsHooks, Y as addPortal, Yt as DEVTOOLS, Z as deferInBrowser, Zt as Scope, _ as updated, _n as templateCall, _t as fillSpread, a as cells, an as componentNodes, at as content, b as searchParam, bn as fill, bt as loading, c as get, cn as elementAt, ct as text, d as pending, dn as readMemo, dt as track, en as rpcPrefix, et as toList, f as resolve, fn as renderMemo, ft as after, g as update, gn as insert, gt as fillSettled, h as unreadMemo, hn as children, ht as fillAttrs, i as bindings, in as component, it as attrs, j as putText, jt as leaveRoutes, k as markBlock, kt as init, l as isBound, ln as foreignNodes, lt as writeText, m as timed, mn as setSlots, mt as countLoads, n as asyncMemo, nn as skew, nt as windowStart, o as effect, on as dynamic, ot as portalTo, p as set, pn as setItem, pt as attempt, q as spreadProps, qt as ClientModule, r as binding, rn as Component, rt as attr, s as gate, sn as dynamicNodes, st as restRef, t as loader, tn as scopes, tt as windowList, u as memo, un as place, ut as guess, v as title, vn as HiddenBody, vt as fillValue, w as fillBranch, wn as reset, wt as fail, x as appendText, xn as held, xt as reveal, y as paramEffect, yn as branch, yt as keepValue, z as createScope, zt as submitAction } from "../client-DnFF9_lv.js";
|
|
4
4
|
import { t as produce } from "../produce-CLABZ8k2.js";
|
|
5
5
|
export { type ClientModule, type Component, type CoreOptions, DEVTOOLS, type DevtoolsHooks, type HiddenBody, type Raw, type Scope, action, addHead, addPortal, addStyle, affix, after, afterInsert, appendText, asyncMemo, attempt, attr, attribute, attrs, binding, bindings, branch, branchNodes, build, cells, children, classAttribute, clone, component, componentNodes, consumeContext, consumeStore, content, countLoads, createContext, createScope, deferInBrowser, descendants, dispose, dynamic, dynamicNodes, effect, elementAt, escape, fail, fill, fillAttrs, fillBranch, fillList, fillSettled, fillSpread, fillValue, foreignNodes, forget, gate, gateValue, get, getScope, guess, handle, handlerProp, held, hooks, init, insert, internal, isBound, keep, keepText, keepValue, leavePage, leaveRoutes, list, listNodes, loadModule, loader, loading, makeId, markBlock, memo, mergeAttributes, nameComment, navigationContext, nodes, offscreen, onAttribute, paramEffect, pending, place, portalTo, produce, prop, provideValue, putText, raw, readMemo, rekey, remount, removeRoot, removeScope, renderMemo, reset, resolve, restRef, retag, reveal, routeContext, rpc, rpcPrefix, SCOPE_IDS as scopeIds, scopes, searchParam, set, setAttr, setAttrText, setContent, setGlobal, setItem, setOn, setOwner, setSlots, setSpread, setVar, sink, skew, spread, spreadProps, started, storeUpdate, submitAction, template, templateCall, text, timed, title, toList, toStore, track, unbind, unreadMemo, update, updateRoute, updated, vars, wait, windowList, windowStart, writeText };
|
package/dist/runtime/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as vars, _ as mergeAttributes, a as attribute, c as classAttribute, i as affix, m as internal, u as escape, v as onAttribute, x as raw } from "../html-
|
|
2
|
-
import { D as unbind, g as gateValue, i as produce, p as SCOPE_IDS } from "../search-params-
|
|
1
|
+
import { E as vars, _ as mergeAttributes, a as attribute, c as classAttribute, i as affix, m as internal, u as escape, v as onAttribute, x as raw } from "../html-Cf5uKhLs.js";
|
|
2
|
+
import { D as unbind, g as gateValue, i as produce, p as SCOPE_IDS } from "../search-params-C64liRBj.js";
|
|
3
3
|
import { a as navigationContext, o as routeContext, r as createContext } from "../context-CU4Fpn5a.js";
|
|
4
|
-
import { $ as branchNodes, $t as fail, A as started, At as consumeContext, B as spreadProps, Bt as cells, C as fillAttrs, Ct as handle, D as keepValue, Dt as submitAction, E as fillValue, Et as spread, F as portalTo, Ft as toStore, G as elementAt, Gt as memo, H as componentNodes, Ht as gate, I as restRef, It as updateRoute, J as readMemo, Jt as set, K as foreignNodes, Kt as pending, L as text, Lt as asyncMemo, M as attr, Mt as provideValue, N as attrs, Nt as setGlobal, O as loading, Ot as guess, P as content, Pt as storeUpdate, Q as appendText, Qt as updated, R as writeText, Rt as binding, S as countLoads, St as action, T as fillSpread, Tt as rpc, U as dynamic, Ut as get, V as component, Vt as effect, W as dynamicNodes, Wt as isBound, X as setItem, Xt as unreadMemo, Y as renderMemo, Yt as timed, Z as setSlots, Zt as update, _ as rekey, _n as rpcPrefix, _t as init, a as addPortal, an as createScope, at as listNodes, b as after, bt as remount, c as setVar, cn as makeId, ct as putText, d as windowList, dn as sink, dt as setContent, en as children, et as clone, f as windowStart, fn as nameComment, ft as setOn, g as offscreen, gn as hooks, gt as forget, h as held, hn as build, ht as dispose, i as addHead, in as afterInsert, it as keepText, j as wait, jt as consumeStore, k as reveal, kt as track, l as list, ln as removeScope, lt as setAttr, m as fill, mn as DEVTOOLS, mt as template, n as paramEffect, nn as templateCall, nt as fillList, o as addStyle, on as descendants, ot as markBlock, p as branch, pn as loadModule, pt as setSpread, q as place, qt as resolve, r as searchParam, rn as title, rt as keep, s as deferInBrowser, sn as getScope, st as nodes, t as loader, tn as insert, tt as fillBranch, u as toList, un as setOwner, ut as setAttrText, v as reset, vn as scopes, vt as leavePage, w as fillSettled, wt as handlerProp, x as attempt, xt as removeRoot, y as retag, yn as skew, yt as leaveRoutes, z as prop, zt as bindings } from "../client-
|
|
4
|
+
import { $ as branchNodes, $t as fail, A as started, At as consumeContext, B as spreadProps, Bt as cells, C as fillAttrs, Ct as handle, D as keepValue, Dt as submitAction, E as fillValue, Et as spread, F as portalTo, Ft as toStore, G as elementAt, Gt as memo, H as componentNodes, Ht as gate, I as restRef, It as updateRoute, J as readMemo, Jt as set, K as foreignNodes, Kt as pending, L as text, Lt as asyncMemo, M as attr, Mt as provideValue, N as attrs, Nt as setGlobal, O as loading, Ot as guess, P as content, Pt as storeUpdate, Q as appendText, Qt as updated, R as writeText, Rt as binding, S as countLoads, St as action, T as fillSpread, Tt as rpc, U as dynamic, Ut as get, V as component, Vt as effect, W as dynamicNodes, Wt as isBound, X as setItem, Xt as unreadMemo, Y as renderMemo, Yt as timed, Z as setSlots, Zt as update, _ as rekey, _n as rpcPrefix, _t as init, a as addPortal, an as createScope, at as listNodes, b as after, bt as remount, c as setVar, cn as makeId, ct as putText, d as windowList, dn as sink, dt as setContent, en as children, et as clone, f as windowStart, fn as nameComment, ft as setOn, g as offscreen, gn as hooks, gt as forget, h as held, hn as build, ht as dispose, i as addHead, in as afterInsert, it as keepText, j as wait, jt as consumeStore, k as reveal, kt as track, l as list, ln as removeScope, lt as setAttr, m as fill, mn as DEVTOOLS, mt as template, n as paramEffect, nn as templateCall, nt as fillList, o as addStyle, on as descendants, ot as markBlock, p as branch, pn as loadModule, pt as setSpread, q as place, qt as resolve, r as searchParam, rn as title, rt as keep, s as deferInBrowser, sn as getScope, st as nodes, t as loader, tn as insert, tt as fillBranch, u as toList, un as setOwner, ut as setAttrText, v as reset, vn as scopes, vt as leavePage, w as fillSettled, wt as handlerProp, x as attempt, xt as removeRoot, y as retag, yn as skew, yt as leaveRoutes, z as prop, zt as bindings } from "../client-Bm0XbjHr.js";
|
|
5
5
|
export { DEVTOOLS, action, addHead, addPortal, addStyle, affix, after, afterInsert, appendText, asyncMemo, attempt, attr, attribute, attrs, binding, bindings, branch, branchNodes, build, cells, children, classAttribute, clone, component, componentNodes, consumeContext, consumeStore, content, countLoads, createContext, createScope, deferInBrowser, descendants, dispose, dynamic, dynamicNodes, effect, elementAt, escape, fail, fill, fillAttrs, fillBranch, fillList, fillSettled, fillSpread, fillValue, foreignNodes, forget, gate, gateValue, get, getScope, guess, handle, handlerProp, held, hooks, init, insert, internal, isBound, keep, keepText, keepValue, leavePage, leaveRoutes, list, listNodes, loadModule, loader, loading, makeId, markBlock, memo, mergeAttributes, nameComment, navigationContext, nodes, offscreen, onAttribute, paramEffect, pending, place, portalTo, produce, prop, provideValue, putText, raw, readMemo, rekey, remount, removeRoot, removeScope, renderMemo, reset, resolve, restRef, retag, reveal, routeContext, rpc, rpcPrefix, SCOPE_IDS as scopeIds, scopes, searchParam, set, setAttr, setAttrText, setContent, setGlobal, setItem, setOn, setOwner, setSlots, setSpread, setVar, sink, skew, spread, spreadProps, started, storeUpdate, submitAction, template, templateCall, text, timed, title, toList, toStore, track, unbind, unreadMemo, update, updateRoute, updated, vars, wait, windowList, windowStart, writeText };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as ScopeId } from "../shared-
|
|
2
|
-
import { En as NavigationReport, Zt as Scope } from "../client-
|
|
1
|
+
import { c as ScopeId } from "../shared-CuJdWifz.js";
|
|
2
|
+
import { En as NavigationReport, Zt as Scope } from "../client-DnFF9_lv.js";
|
|
3
3
|
//#region src/runtime/logo.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* The logo of brumate: the pole and the bowl of a b, in outline, where the
|
package/dist/runtime/devtools.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as LOGO } from "../logo-DQ_OYhBi.js";
|
|
2
|
-
import { a as preview, i as nextBlockState, n as installDevtools, o as reportError, r as moveBlock, s as scanBlocks, t as findRootScope } from "../devtools-
|
|
2
|
+
import { a as preview, i as nextBlockState, n as installDevtools, o as reportError, r as moveBlock, s as scanBlocks, t as findRootScope } from "../devtools-Cl6AhENB.js";
|
|
3
3
|
export { LOGO, findRootScope, installDevtools, moveBlock, nextBlockState, preview, reportError, scanBlocks };
|
package/dist/runtime/events.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ type FunctionKey = `F${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}`;
|
|
|
8
8
|
* A key of `prevent`: a key by its `event.key`, or that key with a modifier that must be held,
|
|
9
9
|
* such as `Mod+ArrowDown`. A key alone matches only while Ctrl, Meta and Alt are up, so the
|
|
10
10
|
* shortcuts of the browser, such as Cmd+Left or Alt+Left, keep their default. `Mod` is Ctrl or
|
|
11
|
-
* Meta.
|
|
11
|
+
* Meta. A letter after a modifier matches in either case.
|
|
12
12
|
*/
|
|
13
13
|
export type KeyName = Key | `${"Mod" | "Ctrl" | "Meta" | "Alt"}+${Key}`;
|
|
14
14
|
/** A key by its `event.key`: a named key, a letter or a digit. */
|
package/dist/runtime/hot.d.ts
CHANGED
package/dist/runtime/html.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as mergeAttributes, C as escape, D as internal, E as insertValue, F as rawHTML, I as spread, L as styleElement, M as onValue, N as ownValue, O as isInternal, P as raw, R as textValue, S as classValue, T as handlerEntry, _ as affix, b as bindEntry, g as actionAttributes, h as VOID_ELEMENTS, j as onAttribute, k as isRaw, m as Raw, p as Internal, v as attribute, w as escapeAttribute, x as classAttribute, y as attributeText, z as vars } from "../shared-
|
|
1
|
+
import { A as mergeAttributes, C as escape, D as internal, E as insertValue, F as rawHTML, I as spread, L as styleElement, M as onValue, N as ownValue, O as isInternal, P as raw, R as textValue, S as classValue, T as handlerEntry, _ as affix, b as bindEntry, g as actionAttributes, h as VOID_ELEMENTS, j as onAttribute, k as isRaw, m as Raw, p as Internal, v as attribute, w as escapeAttribute, x as classAttribute, y as attributeText, z as vars } from "../shared-CuJdWifz.js";
|
|
2
2
|
export { Internal, Raw, VOID_ELEMENTS, actionAttributes, affix, attribute, attributeText, bindEntry, classAttribute, classValue, escape, escapeAttribute, handlerEntry, insertValue, internal, isInternal, isRaw, mergeAttributes, onAttribute, onValue, ownValue, raw, rawHTML, spread, styleElement, textValue, vars };
|
package/dist/runtime/html.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Internal, n as VOID_ELEMENTS, r as actionAttributes, i as affix, a as attribute, o as attributeText, s as bindEntry, c as classAttribute, l as classValue, u as escape, d as escapeAttribute, f as handlerEntry, p as insertValue, m as internal, h as isInternal, g as isRaw, _ as mergeAttributes, v as onAttribute, y as onValue, b as ownValue, x as raw, S as rawHTML, C as spread, w as styleElement, T as textValue, E as vars } from "../html-
|
|
1
|
+
export { t as Internal, n as VOID_ELEMENTS, r as actionAttributes, i as affix, a as attribute, o as attributeText, s as bindEntry, c as classAttribute, l as classValue, u as escape, d as escapeAttribute, f as handlerEntry, p as insertValue, m as internal, h as isInternal, g as isRaw, _ as mergeAttributes, v as onAttribute, y as onValue, b as ownValue, x as raw, S as rawHTML, C as spread, w as styleElement, T as textValue, E as vars } from "../html-Cf5uKhLs.js";
|
package/dist/runtime/loader.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as NavigateOptions, t as LoaderOptions } from "../boot-
|
|
2
|
-
import { t as startWithoutNavigation } from "../static-loader-
|
|
1
|
+
import { n as NavigateOptions, t as LoaderOptions } from "../boot-CMy0f_iC.js";
|
|
2
|
+
import { t as startWithoutNavigation } from "../static-loader-BYbXVJDY.js";
|
|
3
3
|
//#region src/runtime/loader.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Starts resuming the page. Listens to the events in `b-on` attributes
|
package/dist/runtime/loader.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as startWithoutNavigation } from "../static-loader-
|
|
2
|
-
import { t as start } from "../loader-
|
|
1
|
+
import { t as startWithoutNavigation } from "../static-loader-V4V1Oy6G.js";
|
|
2
|
+
import { t as start } from "../loader-BPNSRA2A.js";
|
|
3
3
|
export { start, startWithoutNavigation };
|
package/dist/runtime/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Route, c as navigationContext, l as routeContext, o as createContext, r as NavigationState } from "../context-BNgBXVUQ.js";
|
|
2
|
-
import { A as mergeAttributes, C as escape, D as internal, P as raw, _ as affix, a as PageState, c as ScopeId, d as unbind, f as useSerialEntry, j as onAttribute, l as ScopeState, m as Raw, n as ElementReference, r as FunctionReference, u as gateValue, w as escapeAttribute, x as classAttribute, z as vars } from "../shared-
|
|
2
|
+
import { A as mergeAttributes, C as escape, D as internal, P as raw, _ as affix, a as PageState, c as ScopeId, d as unbind, f as useSerialEntry, j as onAttribute, l as ScopeState, m as Raw, n as ElementReference, r as FunctionReference, u as gateValue, w as escapeAttribute, x as classAttribute, z as vars } from "../shared-CuJdWifz.js";
|
|
3
3
|
import { t as produce } from "../produce-CLABZ8k2.js";
|
|
4
4
|
import { t as StandardSchemaV1 } from "../standard-schema-BNY82yX3.js";
|
|
5
5
|
import { f as Intent, v as SubmissionResult } from "../forms-j1xPAR14.js";
|
|
6
|
-
import { $ as idempotent, $t as defineMiddleware, A as handleRoute, At as safeParse, B as renderToStream, Bt as searchParam, C as attribute, Ct as parseSubmission, D as component, Dt as fieldErrors, E as children, Et as ValidationIssue, F as memo, Ft as MiddlewareLoader, G as start, Gt as RequestEvent, H as settled, Ht as Locals, I as packState, It as RouteMatch, J as streamParts, Jt as ServerError, K as stateScript, Kt as RequestEventOptions, L as read, Lt as RouteNode, M as insert, Mt as Handler, N as isCrossSite, Nt as Loader, O as dynamic, Ot as parse, P as lazy, Pt as Middleware, Q as IdempotentOptions, Qt as dedupe, R as ready, Rt as RouteView, S as actionResult, St as SuccessfulSubmission, T as caught, Tt as ValidationError, U as spacerTag, Ut as Redirect, V as setClientBundles, Vt as EntryMiddleware, W as spread, Wt as RequestCall, X as wait, Xt as ServerErrorInfo, Y as streamState, Yt as ServerErrorHandler, Z as waitAll, Zt as ServerErrorKind, _ as ScopeEntry, _t as FailedSubmission, a as DocumentOptions, an as Session, at as setCacheStore, b as StreamOptions, bt as Submission, c as Mark, cn as parseCookies, ct as RateLimitConfig, d as PageCache, dt as RateLimitOptions, en as getEvent, et as CacheStore, f as RenderOptions, ft as RateLimitStore, g as RouteOptions, gt as rateLimit, h as RevealOrder, ht as configureRateLimit, i as DeferTarget, in as CookieOptions, it as revalidate, j as inlineBodies, jt as EndpointLoader, k as handleRequest, kt as parseForm, l as Memo, ln as serializeCookie, lt as RateLimitError, m as RequestOptions, mt as clientAddress, n as Component, nn as redirect, nt as cached, o as ItemSource, on as SessionOptions, ot as storageStore, p as RenderResult, pt as Window, q as stateValue, qt as RequestKind, r as Context, rn as withEvent, rt as memoryStore, s as Lazy, sn as createSession, st as RateLimit, t as ClientBundles, tn as isRedirect, tt as CachedOptions, u as NotReady, un as toNodeHeaders, ut as RateLimitMiddleware, v as StateAttributes, vt as IntentSubmission, w as binding, wt as ParseResult, x as action, xt as SubmissionOptions, y as StateMap, yt as ReplyOptions, z as render, zt as matchRoute } from "../server-
|
|
6
|
+
import { $ as idempotent, $t as defineMiddleware, A as handleRoute, At as safeParse, B as renderToStream, Bt as searchParam, C as attribute, Ct as parseSubmission, D as component, Dt as fieldErrors, E as children, Et as ValidationIssue, F as memo, Ft as MiddlewareLoader, G as start, Gt as RequestEvent, H as settled, Ht as Locals, I as packState, It as RouteMatch, J as streamParts, Jt as ServerError, K as stateScript, Kt as RequestEventOptions, L as read, Lt as RouteNode, M as insert, Mt as Handler, N as isCrossSite, Nt as Loader, O as dynamic, Ot as parse, P as lazy, Pt as Middleware, Q as IdempotentOptions, Qt as dedupe, R as ready, Rt as RouteView, S as actionResult, St as SuccessfulSubmission, T as caught, Tt as ValidationError, U as spacerTag, Ut as Redirect, V as setClientBundles, Vt as EntryMiddleware, W as spread, Wt as RequestCall, X as wait, Xt as ServerErrorInfo, Y as streamState, Yt as ServerErrorHandler, Z as waitAll, Zt as ServerErrorKind, _ as ScopeEntry, _t as FailedSubmission, a as DocumentOptions, an as Session, at as setCacheStore, b as StreamOptions, bt as Submission, c as Mark, cn as parseCookies, ct as RateLimitConfig, d as PageCache, dt as RateLimitOptions, en as getEvent, et as CacheStore, f as RenderOptions, ft as RateLimitStore, g as RouteOptions, gt as rateLimit, h as RevealOrder, ht as configureRateLimit, i as DeferTarget, in as CookieOptions, it as revalidate, j as inlineBodies, jt as EndpointLoader, k as handleRequest, kt as parseForm, l as Memo, ln as serializeCookie, lt as RateLimitError, m as RequestOptions, mt as clientAddress, n as Component, nn as redirect, nt as cached, o as ItemSource, on as SessionOptions, ot as storageStore, p as RenderResult, pt as Window, q as stateValue, qt as RequestKind, r as Context, rn as withEvent, rt as memoryStore, s as Lazy, sn as createSession, st as RateLimit, t as ClientBundles, tn as isRedirect, tt as CachedOptions, u as NotReady, un as toNodeHeaders, ut as RateLimitMiddleware, v as StateAttributes, vt as IntentSubmission, w as binding, wt as ParseResult, x as action, xt as SubmissionOptions, y as StateMap, yt as ReplyOptions, z as render, zt as matchRoute } from "../server-0rS5vUW1.js";
|
|
7
7
|
export { type CacheStore, type CachedOptions, ClientBundles, Component, Context, type CookieOptions, DeferTarget, DocumentOptions, ElementReference, type EndpointLoader, type EntryMiddleware, type FailedSubmission, FunctionReference, type Handler, type IdempotentOptions, type Intent, type IntentSubmission, ItemSource, Lazy, type Loader, type Locals, Mark, Memo, type Middleware, type MiddlewareLoader, type NavigationState, NotReady, PageCache, type PageState, type ParseResult, type RateLimit, type RateLimitConfig, RateLimitError, type RateLimitMiddleware, type RateLimitOptions, type RateLimitStore, type Raw, type Redirect, RenderOptions, RenderResult, type ReplyOptions, type RequestCall, RequestEvent, type RequestEventOptions, type RequestKind, RequestOptions, RevealOrder, type Route, type RouteMatch, type RouteNode, RouteOptions, type RouteView, ScopeEntry, type ScopeId, type ScopeState, ServerError, type ServerErrorHandler, type ServerErrorInfo, type ServerErrorKind, type Session, type SessionOptions, type StandardSchemaV1, StateAttributes, StateMap, StreamOptions, type Submission, type SubmissionOptions, type SubmissionResult, type SuccessfulSubmission, ValidationError, type ValidationIssue, type Window, action, actionResult, affix, attribute, binding, cached, caught, children, classAttribute, clientAddress, component, configureRateLimit, createContext, createSession, dedupe, defineMiddleware, dynamic, escape, escapeAttribute, fieldErrors, gateValue, getEvent, handleRequest, handleRoute, idempotent, inlineBodies, insert, internal, isCrossSite, isRedirect, lazy, matchRoute, memo, memoryStore, mergeAttributes, navigationContext, onAttribute, packState, parse, parseCookies, parseForm, parseSubmission, produce, rateLimit, raw, read, ready, redirect, render, renderToStream, revalidate, routeContext, safeParse, searchParam, serializeCookie, setCacheStore, setClientBundles, settled, spacerTag, spread, start, stateScript, stateValue, storageStore, streamParts, streamState, toNodeHeaders, unbind, useSerialEntry, vars, wait, waitAll, withEvent };
|
package/dist/runtime/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as vars, _ as mergeAttributes, c as classAttribute, d as escapeAttribute, i as affix, m as internal, u as escape, v as onAttribute, x as raw } from "../html-
|
|
1
|
+
import { E as vars, _ as mergeAttributes, c as classAttribute, d as escapeAttribute, i as affix, m as internal, u as escape, v as onAttribute, x as raw } from "../html-Cf5uKhLs.js";
|
|
2
2
|
import { a as serializeCookie, i as parseCookies, s as toNodeHeaders, t as createSession } from "../cookies-Cnbf4w-S.js";
|
|
3
|
-
import { D as unbind, O as useSerialEntry, c as ElementReference, g as gateValue, i as produce, l as FunctionReference, n as searchParam } from "../search-params-
|
|
4
|
-
import { $ as dedupe, A as streamParts, B as ValidationError, C as setClientBundles, D as start, E as spread, F as RateLimitError, G as matchRoute, H as parse, I as clientAddress, J as revalidate, K as cached, L as configureRateLimit, M as wait, N as waitAll, O as stateScript, P as idempotent, Q as ServerError, R as rateLimit, S as renderToStream, T as spacerTag, U as parseForm, V as fieldErrors, W as safeParse, X as storageStore, Y as setCacheStore, Z as RequestEvent, _ as memo, a as attribute, b as ready, c as children, d as handleRequest, et as defineMiddleware, f as handleRoute, g as lazy, h as isCrossSite, i as actionResult, it as withEvent, j as streamState, k as stateValue, l as component, m as insert, n as NotReady, nt as isRedirect, o as binding, p as inlineBodies, q as memoryStore, r as action, rt as redirect, s as caught, t as Context, tt as getEvent, u as dynamic, v as packState, w as settled, x as render, y as read, z as parseSubmission } from "../server-
|
|
3
|
+
import { D as unbind, O as useSerialEntry, c as ElementReference, g as gateValue, i as produce, l as FunctionReference, n as searchParam } from "../search-params-C64liRBj.js";
|
|
4
|
+
import { $ as dedupe, A as streamParts, B as ValidationError, C as setClientBundles, D as start, E as spread, F as RateLimitError, G as matchRoute, H as parse, I as clientAddress, J as revalidate, K as cached, L as configureRateLimit, M as wait, N as waitAll, O as stateScript, P as idempotent, Q as ServerError, R as rateLimit, S as renderToStream, T as spacerTag, U as parseForm, V as fieldErrors, W as safeParse, X as storageStore, Y as setCacheStore, Z as RequestEvent, _ as memo, a as attribute, b as ready, c as children, d as handleRequest, et as defineMiddleware, f as handleRoute, g as lazy, h as isCrossSite, i as actionResult, it as withEvent, j as streamState, k as stateValue, l as component, m as insert, n as NotReady, nt as isRedirect, o as binding, p as inlineBodies, q as memoryStore, r as action, rt as redirect, s as caught, t as Context, tt as getEvent, u as dynamic, v as packState, w as settled, x as render, y as read, z as parseSubmission } from "../server-BVObWh-w.js";
|
|
5
5
|
import { a as navigationContext, o as routeContext, r as createContext } from "../context-CU4Fpn5a.js";
|
|
6
6
|
export { Context, ElementReference, FunctionReference, NotReady, RateLimitError, RequestEvent, ServerError, ValidationError, action, actionResult, affix, attribute, binding, cached, caught, children, classAttribute, clientAddress, component, configureRateLimit, createContext, createSession, dedupe, defineMiddleware, dynamic, escape, escapeAttribute, fieldErrors, gateValue, getEvent, handleRequest, handleRoute, idempotent, inlineBodies, insert, internal, isCrossSite, isRedirect, lazy, matchRoute, memo, memoryStore, mergeAttributes, navigationContext, onAttribute, packState, parse, parseCookies, parseForm, parseSubmission, produce, rateLimit, raw, read, ready, redirect, render, renderToStream, revalidate, routeContext, safeParse, searchParam, serializeCookie, setCacheStore, setClientBundles, settled, spacerTag, spread, start, stateScript, stateValue, storageStore, streamParts, streamState, toNodeHeaders, unbind, useSerialEntry, vars, wait, waitAll, withEvent };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as LoaderOptions } from "../boot-
|
|
2
|
-
import { t as startWithoutNavigation } from "../static-loader-
|
|
1
|
+
import { t as LoaderOptions } from "../boot-CMy0f_iC.js";
|
|
2
|
+
import { t as startWithoutNavigation } from "../static-loader-BYbXVJDY.js";
|
|
3
3
|
export { type LoaderOptions, startWithoutNavigation };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as startWithoutNavigation } from "../static-loader-
|
|
1
|
+
export { t as startWithoutNavigation } from "../static-loader-V4V1Oy6G.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { qt as ClientModule } from "../client-
|
|
2
|
-
import { Vt as EntryMiddleware, Yt as ServerErrorHandler, f as RenderOptions, n as Component } from "../server-
|
|
1
|
+
import { qt as ClientModule } from "../client-DnFF9_lv.js";
|
|
2
|
+
import { Vt as EntryMiddleware, Yt as ServerErrorHandler, f as RenderOptions, n as Component } from "../server-0rS5vUW1.js";
|
|
3
3
|
//#region src/runtime/testing.d.ts
|
|
4
4
|
/** The middleware of files of server functions, by function ID. */
|
|
5
5
|
type FileMiddleware = Record<string, EntryMiddleware>;
|
package/dist/runtime/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as handleRequest, x as render } from "../server-
|
|
2
|
-
import { t as start } from "../loader-
|
|
1
|
+
import { d as handleRequest, x as render } from "../server-BVObWh-w.js";
|
|
2
|
+
import { t as start } from "../loader-BPNSRA2A.js";
|
|
3
3
|
//#region src/runtime/nodes.ts
|
|
4
4
|
const VOID = /* @__PURE__ */ new Set([
|
|
5
5
|
"area",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as ownValue, t as Internal, x as raw } from "./html-
|
|
1
|
+
import { b as ownValue, t as Internal, x as raw } from "./html-Cf5uKhLs.js";
|
|
2
2
|
import { a as HAS_CHILDREN, h as HAS_STORES, i as HAS_BRIDGES, n as HAS_BINDINGS } from "./features-DwMYKBIC.js";
|
|
3
3
|
import { n as Store, t as Bridged } from "./store-BIBAYZo-.js";
|
|
4
4
|
import { o as routeContext } from "./context-CU4Fpn5a.js";
|
|
@@ -448,4 +448,4 @@ function searchParam(context, name, options) {
|
|
|
448
448
|
//#endregion
|
|
449
449
|
export { onSerialOptions as C, unbind as D, stateValues as E, useSerialEntry as O, mergeHandlers as S, parseId as T, isAsyncIterable as _, Binding as a, isSlotReference as b, ElementReference as c, PARTS as d, PropPromise as f, gateValue as g, addEntryHandlers as h, produce as i, FunctionReference as l, SlotReference as m, searchParam as n, CHILDREN_REF as o, SCOPE_IDS as p, writeParam as r, ChildrenReference as s, readParam as t, MemoError as u, isBinding as v, onValuePlugin as w, madeStores as x, isPropWrapper as y };
|
|
450
450
|
|
|
451
|
-
//# sourceMappingURL=search-params-
|
|
451
|
+
//# sourceMappingURL=search-params-C64liRBj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-params-Cy3uRphR.js","names":[],"sources":["../src/runtime/shared.ts","../src/runtime/produce.ts","../src/runtime/search-params.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","const DRAFT = Symbol('brumate.draft');\n\ninterface DraftState {\n base: Record<PropertyKey, unknown>;\n /** A shallow copy, made on the first change. */\n copy: Record<PropertyKey, unknown> | undefined;\n parent: DraftState | undefined;\n /** Drafts of the objects inside, by key. */\n children: Map<PropertyKey, DraftState & { proxy: object }>;\n modified: boolean;\n}\n\n/** Plain objects and arrays can be drafted. Other values, such as `Map`, are used as they are. */\nfunction isDraftable(value: unknown): value is Record<PropertyKey, unknown> {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n if (Array.isArray(value)) {\n return true;\n }\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction latest(state: DraftState): Record<PropertyKey, unknown> {\n return state.copy ?? state.base;\n}\n\n/** Copies an object and its parents on the first change. */\nfunction prepare(state: DraftState): Record<PropertyKey, unknown> {\n for (\n let current: DraftState | undefined = state;\n current && !current.modified;\n current = current.parent\n ) {\n current.modified = true;\n current.copy = (\n Array.isArray(current.base) ? [...current.base] : { ...current.base }\n ) as Record<PropertyKey, unknown>;\n }\n return state.copy!;\n}\n\nfunction getDraftState(value: unknown): DraftState | undefined {\n return typeof value === 'object' && value !== null\n ? ((value as Record<PropertyKey, unknown>)[DRAFT] as DraftState | undefined)\n : undefined;\n}\n\nfunction createDraft(\n base: Record<PropertyKey, unknown>,\n parent: DraftState | undefined,\n): DraftState & { proxy: object } {\n const state = {\n base,\n copy: undefined,\n parent,\n children: new Map(),\n modified: false,\n } as DraftState & {\n proxy: object;\n };\n // An empty target, so the draft can report the keys of the copy.\n const target = Array.isArray(base) ? [] : Object.create(Object.getPrototypeOf(base));\n state.proxy = new Proxy(target, {\n get(_, key) {\n if (key === DRAFT) {\n return state;\n }\n const source = latest(state);\n const value = source[key];\n if (!Object.hasOwn(source, key) || !isDraftable(value) || value !== state.base[key]) {\n return value;\n }\n let child = state.children.get(key);\n if (!child) {\n child = createDraft(value, state);\n state.children.set(key, child);\n }\n return child.proxy;\n },\n set(_, key, value) {\n const source = latest(state);\n if (Object.is(source[key], value) && Object.hasOwn(source, key)) {\n return true;\n }\n prepare(state)[key] = value;\n state.children.delete(key);\n return true;\n },\n deleteProperty(_, key) {\n if (Object.hasOwn(latest(state), key)) {\n delete prepare(state)[key];\n state.children.delete(key);\n }\n return true;\n },\n has(_, key) {\n return key in latest(state);\n },\n ownKeys() {\n return Reflect.ownKeys(latest(state));\n },\n getOwnPropertyDescriptor(_, key) {\n const descriptor = Reflect.getOwnPropertyDescriptor(latest(state), key);\n if (descriptor && key !== 'length') {\n descriptor.configurable = true;\n descriptor.writable = true;\n }\n return descriptor;\n },\n defineProperty(_, key, descriptor) {\n prepare(state);\n return Reflect.defineProperty(state.copy!, key, descriptor);\n },\n });\n return state;\n}\n\n/** Returns the final value of a draft: the base if nothing changed, or a new object that shares what did not. */\nfunction finalize(state: DraftState): unknown {\n if (!state.modified) {\n // A child can change without its parent being copied yet.\n for (const child of state.children.values()) {\n if (child.modified) {\n prepare(state);\n break;\n }\n }\n if (!state.modified) {\n return state.base;\n }\n }\n const copy = state.copy!;\n for (const [key, child] of state.children) {\n if (copy[key] === child.base) {\n copy[key] = finalize(child);\n }\n }\n // Drafts can also be assigned to other keys, such as when an array is reordered.\n for (const key of Reflect.ownKeys(copy)) {\n const draft = getDraftState(copy[key]);\n if (draft) {\n copy[key] = finalize(draft);\n }\n }\n return copy;\n}\n\n/**\n * Returns a changed copy of a value. The recipe changes a draft as if it\n * were the value. Objects that it does not change keep their identity, and\n * if it changes nothing, the value itself is returned. A recipe can also\n * return a new value. Only plain objects and arrays are drafted.\n */\nexport function produce<T>(base: T, recipe: (draft: T) => T | void): T {\n if (!isDraftable(base)) {\n const result = recipe(base);\n return result === undefined ? base : result;\n }\n const state = createDraft(base, undefined);\n const result = recipe(state.proxy as T);\n if (result !== undefined && result !== state.proxy) {\n return resolve(result, new Set()) as T;\n }\n return finalize(state) as T;\n}\n\n/** Replaces the drafts in a value that a recipe returns, such as the result of `draft.filter(…)`. */\nfunction resolve(value: unknown, seen: Set<unknown>): unknown {\n const draft = getDraftState(value);\n if (draft) {\n return finalize(draft);\n }\n if (!isDraftable(value) || seen.has(value)) {\n return value;\n }\n seen.add(value);\n for (const key of Reflect.ownKeys(value)) {\n value[key] = resolve(value[key], seen);\n }\n return value;\n}\n","// `$searchParam`: the value of a parameter of the query string. The server and the browser read\n// it the same way, and the browser writes it back with `client/search.ts`.\nimport type { SearchParamOptions } from './signals.ts';\nimport { routeContext } from './context.ts';\nimport type { Context } from './context.ts';\n\n/** The value of a parameter in a query string: its text parsed, or the default when it is absent. */\nexport function readParam(\n search: URLSearchParams,\n name: string,\n options?: SearchParamOptions<unknown>,\n): unknown {\n const text = search.get(name);\n if (text === null) {\n return options?.default ?? null;\n }\n return options?.parse ? options.parse(text) : text;\n}\n\n/** The text of a value in the URL, or null for the default, which leaves the parameter out. */\nexport function writeParam(value: unknown, options?: SearchParamOptions<unknown>): string | null {\n const own = formatParam(value, options);\n return own === formatParam(options?.default, options) ? null : own;\n}\n\nfunction formatParam(value: unknown, options?: SearchParamOptions<unknown>): string | null {\n if (value === null || value === undefined) {\n return null;\n }\n return options?.serialize ? options.serialize(value) : String(value);\n}\n\n/** `$searchParam` on the server: the parameter of the request's URL. */\nexport function searchParam(\n context: { consume<T>(context: Context<T>, scope: number): T },\n name: string,\n options?: SearchParamOptions<unknown>,\n): unknown {\n return readParam(context.consume(routeContext, 0).search, name, options);\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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AA,IAAY,OAAO;CACvC;CACA,MAAM,QAAQ,YAAY,MAAM,KAAA,CAAS;CACzC,MAAM,SAAS,OAAO,MAAM,KAAU;CACtC,IAAI,WAAW,KAAA,KAAa,WAAW,MAAM,OAC3C,OAAO,QAAQ,wBAAQ,IAAI,IAAI,CAAC;CAElC,OAAO,SAAS,KAAK;AACvB;;AAGA,SAAS,QAAQ,OAAgB,MAA6B;CAC5D,MAAM,QAAQ,cAAc,KAAK;CACjC,IAAI,OACF,OAAO,SAAS,KAAK;CAEvB,IAAI,CAAC,YAAY,KAAK,KAAK,KAAK,IAAI,KAAK,GACvC,OAAO;CAET,KAAK,IAAI,KAAK;CACd,KAAK,MAAM,OAAO,QAAQ,QAAQ,KAAK,GACrC,MAAM,OAAO,QAAQ,MAAM,MAAM,IAAI;CAEvC,OAAO;AACT;;;;AC/KA,SAAgB,UACd,QACA,MACA,SACS;CACT,MAAM,OAAO,OAAO,IAAI,IAAI;CAC5B,IAAI,SAAS,MACX,OAAO,SAAS,WAAW;CAE7B,OAAO,SAAS,QAAQ,QAAQ,MAAM,IAAI,IAAI;AAChD;;AAGA,SAAgB,WAAW,OAAgB,SAAsD;CAC/F,MAAM,MAAM,YAAY,OAAO,OAAO;CACtC,OAAO,QAAQ,YAAY,SAAS,SAAS,OAAO,IAAI,OAAO;AACjE;AAEA,SAAS,YAAY,OAAgB,SAAsD;CACzF,IAAI,UAAU,QAAQ,UAAU,KAAA,GAC9B,OAAO;CAET,OAAO,SAAS,YAAY,QAAQ,UAAU,KAAK,IAAI,OAAO,KAAK;AACrE;;AAGA,SAAgB,YACd,SACA,MACA,SACS;CACT,OAAO,UAAU,QAAQ,QAAQ,cAAc,CAAC,CAAC,CAAC,QAAQ,MAAM,OAAO;AACzE"}
|
|
1
|
+
{"version":3,"file":"search-params-C64liRBj.js","names":[],"sources":["../src/runtime/shared.ts","../src/runtime/produce.ts","../src/runtime/search-params.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","const DRAFT = Symbol('brumate.draft');\n\ninterface DraftState {\n base: Record<PropertyKey, unknown>;\n /** A shallow copy, made on the first change. */\n copy: Record<PropertyKey, unknown> | undefined;\n parent: DraftState | undefined;\n /** Drafts of the objects inside, by key. */\n children: Map<PropertyKey, DraftState & { proxy: object }>;\n modified: boolean;\n}\n\n/** Plain objects and arrays can be drafted. Other values, such as `Map`, are used as they are. */\nfunction isDraftable(value: unknown): value is Record<PropertyKey, unknown> {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n if (Array.isArray(value)) {\n return true;\n }\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction latest(state: DraftState): Record<PropertyKey, unknown> {\n return state.copy ?? state.base;\n}\n\n/** Copies an object and its parents on the first change. */\nfunction prepare(state: DraftState): Record<PropertyKey, unknown> {\n for (\n let current: DraftState | undefined = state;\n current && !current.modified;\n current = current.parent\n ) {\n current.modified = true;\n current.copy = (\n Array.isArray(current.base) ? [...current.base] : { ...current.base }\n ) as Record<PropertyKey, unknown>;\n }\n return state.copy!;\n}\n\nfunction getDraftState(value: unknown): DraftState | undefined {\n return typeof value === 'object' && value !== null\n ? ((value as Record<PropertyKey, unknown>)[DRAFT] as DraftState | undefined)\n : undefined;\n}\n\nfunction createDraft(\n base: Record<PropertyKey, unknown>,\n parent: DraftState | undefined,\n): DraftState & { proxy: object } {\n const state = {\n base,\n copy: undefined,\n parent,\n children: new Map(),\n modified: false,\n } as DraftState & {\n proxy: object;\n };\n // An empty target, so the draft can report the keys of the copy.\n const target = Array.isArray(base) ? [] : Object.create(Object.getPrototypeOf(base));\n state.proxy = new Proxy(target, {\n get(_, key) {\n if (key === DRAFT) {\n return state;\n }\n const source = latest(state);\n const value = source[key];\n if (!Object.hasOwn(source, key) || !isDraftable(value) || value !== state.base[key]) {\n return value;\n }\n let child = state.children.get(key);\n if (!child) {\n child = createDraft(value, state);\n state.children.set(key, child);\n }\n return child.proxy;\n },\n set(_, key, value) {\n const source = latest(state);\n if (Object.is(source[key], value) && Object.hasOwn(source, key)) {\n return true;\n }\n prepare(state)[key] = value;\n state.children.delete(key);\n return true;\n },\n deleteProperty(_, key) {\n if (Object.hasOwn(latest(state), key)) {\n delete prepare(state)[key];\n state.children.delete(key);\n }\n return true;\n },\n has(_, key) {\n return key in latest(state);\n },\n ownKeys() {\n return Reflect.ownKeys(latest(state));\n },\n getOwnPropertyDescriptor(_, key) {\n const descriptor = Reflect.getOwnPropertyDescriptor(latest(state), key);\n if (descriptor && key !== 'length') {\n descriptor.configurable = true;\n descriptor.writable = true;\n }\n return descriptor;\n },\n defineProperty(_, key, descriptor) {\n prepare(state);\n return Reflect.defineProperty(state.copy!, key, descriptor);\n },\n });\n return state;\n}\n\n/** Returns the final value of a draft: the base if nothing changed, or a new object that shares what did not. */\nfunction finalize(state: DraftState): unknown {\n if (!state.modified) {\n // A child can change without its parent being copied yet.\n for (const child of state.children.values()) {\n if (child.modified) {\n prepare(state);\n break;\n }\n }\n if (!state.modified) {\n return state.base;\n }\n }\n const copy = state.copy!;\n for (const [key, child] of state.children) {\n if (copy[key] === child.base) {\n copy[key] = finalize(child);\n }\n }\n // Drafts can also be assigned to other keys, such as when an array is reordered.\n for (const key of Reflect.ownKeys(copy)) {\n const draft = getDraftState(copy[key]);\n if (draft) {\n copy[key] = finalize(draft);\n }\n }\n return copy;\n}\n\n/**\n * Returns a changed copy of a value. The recipe changes a draft as if it\n * were the value. Objects that it does not change keep their identity, and\n * if it changes nothing, the value itself is returned. A recipe can also\n * return a new value. Only plain objects and arrays are drafted.\n */\nexport function produce<T>(base: T, recipe: (draft: T) => T | void): T {\n if (!isDraftable(base)) {\n const result = recipe(base);\n return result === undefined ? base : result;\n }\n const state = createDraft(base, undefined);\n const result = recipe(state.proxy as T);\n if (result !== undefined && result !== state.proxy) {\n return resolve(result, new Set()) as T;\n }\n return finalize(state) as T;\n}\n\n/** Replaces the drafts in a value that a recipe returns, such as the result of `draft.filter(…)`. */\nfunction resolve(value: unknown, seen: Set<unknown>): unknown {\n const draft = getDraftState(value);\n if (draft) {\n return finalize(draft);\n }\n if (!isDraftable(value) || seen.has(value)) {\n return value;\n }\n seen.add(value);\n for (const key of Reflect.ownKeys(value)) {\n value[key] = resolve(value[key], seen);\n }\n return value;\n}\n","// `$searchParam`: the value of a parameter of the query string. The server and the browser read\n// it the same way, and the browser writes it back with `client/search.ts`.\nimport type { SearchParamOptions } from './signals.ts';\nimport { routeContext } from './context.ts';\nimport type { Context } from './context.ts';\n\n/** The value of a parameter in a query string: its text parsed, or the default when it is absent. */\nexport function readParam(\n search: URLSearchParams,\n name: string,\n options?: SearchParamOptions<unknown>,\n): unknown {\n const text = search.get(name);\n if (text === null) {\n return options?.default ?? null;\n }\n return options?.parse ? options.parse(text) : text;\n}\n\n/** The text of a value in the URL, or null for the default, which leaves the parameter out. */\nexport function writeParam(value: unknown, options?: SearchParamOptions<unknown>): string | null {\n const own = formatParam(value, options);\n return own === formatParam(options?.default, options) ? null : own;\n}\n\nfunction formatParam(value: unknown, options?: SearchParamOptions<unknown>): string | null {\n if (value === null || value === undefined) {\n return null;\n }\n return options?.serialize ? options.serialize(value) : String(value);\n}\n\n/** `$searchParam` on the server: the parameter of the request's URL. */\nexport function searchParam(\n context: { consume<T>(context: Context<T>, scope: number): T },\n name: string,\n options?: SearchParamOptions<unknown>,\n): unknown {\n return readParam(context.consume(routeContext, 0).search, name, options);\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;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M,OAC3C,OAAO,QAAQ,wBAAQ,IAAI,IAAI,CAAC;CAElC,OAAO,SAAS,KAAK;AACvB;;AAGA,SAAS,QAAQ,OAAgB,MAA6B;CAC5D,MAAM,QAAQ,cAAc,KAAK;CACjC,IAAI,OACF,OAAO,SAAS,KAAK;CAEvB,IAAI,CAAC,YAAY,KAAK,KAAK,KAAK,IAAI,KAAK,GACvC,OAAO;CAET,KAAK,IAAI,KAAK;CACd,KAAK,MAAM,OAAO,QAAQ,QAAQ,KAAK,GACrC,MAAM,OAAO,QAAQ,MAAM,MAAM,IAAI;CAEvC,OAAO;AACT;;;;AC/KA,SAAgB,UACd,QACA,MACA,SACS;CACT,MAAM,OAAO,OAAO,IAAI,IAAI;CAC5B,IAAI,SAAS,MACX,OAAO,SAAS,WAAW;CAE7B,OAAO,SAAS,QAAQ,QAAQ,MAAM,IAAI,IAAI;AAChD;;AAGA,SAAgB,WAAW,OAAgB,SAAsD;CAC/F,MAAM,MAAM,YAAY,OAAO,OAAO;CACtC,OAAO,QAAQ,YAAY,SAAS,SAAS,OAAO,IAAI,OAAO;AACjE;AAEA,SAAS,YAAY,OAAgB,SAAsD;CACzF,IAAI,UAAU,QAAQ,UAAU,KAAA,GAC9B,OAAO;CAET,OAAO,SAAS,YAAY,QAAQ,UAAU,KAAK,IAAI,OAAO,KAAK;AACrE;;AAGA,SAAgB,YACd,SACA,MACA,SACS;CACT,OAAO,UAAU,QAAQ,QAAQ,cAAc,CAAC,CAAC,CAAC,QAAQ,MAAM,OAAO;AACzE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as Context$1 } from "./context-BNgBXVUQ.js";
|
|
2
|
-
import { a as PageState, c as ScopeId, i as PackedState, l as ScopeState, m as Raw, n as ElementReference, o as PropSink, t as Binding } from "./shared-
|
|
2
|
+
import { a as PageState, c as ScopeId, i as PackedState, l as ScopeState, m as Raw, n as ElementReference, o as PropSink, t as Binding } from "./shared-CuJdWifz.js";
|
|
3
3
|
import { a as Store } from "./store-xlTzAM_r.js";
|
|
4
4
|
import { M as SearchParamOptions } from "./signals-DBnq9QRW.js";
|
|
5
5
|
import { t as StandardSchemaV1 } from "./standard-schema-BNY82yX3.js";
|
|
@@ -917,6 +917,8 @@ declare class Context {
|
|
|
917
917
|
private rpcPrefix;
|
|
918
918
|
/** The ID of the build, for forms that post to server functions. See `RenderOptions`. */
|
|
919
919
|
build: string | undefined;
|
|
920
|
+
/** The Content Security Policy nonce of the render, for the `<style>` elements. */
|
|
921
|
+
nonce: string | undefined;
|
|
920
922
|
/** True in development, where a memo that failed or a `#catch` sends its error to the browser. */
|
|
921
923
|
development: boolean;
|
|
922
924
|
/** Results of server functions that a form posted to this page, for `$action`. */
|
|
@@ -1404,8 +1406,9 @@ interface RenderOptions {
|
|
|
1404
1406
|
*/
|
|
1405
1407
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
1406
1408
|
/**
|
|
1407
|
-
* A Content Security Policy nonce for the inline scripts
|
|
1408
|
-
* records, and the scripts that swap in `#loading` bodies
|
|
1409
|
+
* A Content Security Policy nonce for the inline scripts (the state
|
|
1410
|
+
* records, and the scripts that swap in `#loading` bodies) and the
|
|
1411
|
+
* `<style>` elements of components.
|
|
1409
1412
|
*/
|
|
1410
1413
|
nonce?: string;
|
|
1411
1414
|
/**
|
|
@@ -1641,4 +1644,4 @@ declare function handleRoute(tree: RouteNode, request: Request, options?: RouteO
|
|
|
1641
1644
|
declare function spread(attributes: Record<string, unknown>, on?: string[], names?: boolean): string | Promise<string>;
|
|
1642
1645
|
//#endregion
|
|
1643
1646
|
export { idempotent as $, defineMiddleware as $t, handleRoute as A, safeParse as At, renderToStream as B, searchParam as Bt, attribute as C, parseSubmission as Ct, component as D, fieldErrors as Dt, children as E, ValidationIssue as Et, memo as F, MiddlewareLoader as Ft, start as G, RequestEvent as Gt, settled as H, Locals as Ht, packState as I, RouteMatch as It, streamParts as J, ServerError as Jt, stateScript as K, RequestEventOptions as Kt, read as L, RouteNode as Lt, insert as M, Handler as Mt, isCrossSite as N, Loader as Nt, dynamic as O, parse as Ot, lazy as P, Middleware as Pt, IdempotentOptions as Q, dedupe as Qt, ready as R, RouteView as Rt, actionResult as S, SuccessfulSubmission as St, caught as T, ValidationError as Tt, spacerTag as U, Redirect as Ut, setClientBundles as V, EntryMiddleware as Vt, spread as W, RequestCall as Wt, wait as X, ServerErrorInfo as Xt, streamState as Y, ServerErrorHandler as Yt, waitAll as Z, ServerErrorKind as Zt, ScopeEntry as _, FailedSubmission as _t, DocumentOptions as a, Session as an, setCacheStore as at, StreamOptions as b, Submission as bt, Mark as c, parseCookies as cn, RateLimitConfig as ct, PageCache as d, RateLimitOptions as dt, getEvent as en, CacheStore as et, RenderOptions as f, RateLimitStore as ft, RouteOptions as g, rateLimit as gt, RevealOrder as h, configureRateLimit as ht, DeferTarget as i, CookieOptions as in, revalidate as it, inlineBodies as j, EndpointLoader as jt, handleRequest as k, parseForm as kt, Memo as l, serializeCookie as ln, RateLimitError as lt, RequestOptions as m, clientAddress as mt, Component as n, redirect as nn, cached as nt, ItemSource as o, SessionOptions as on, storageStore as ot, RenderResult as p, Window as pt, stateValue as q, RequestKind as qt, Context as r, withEvent as rn, memoryStore as rt, Lazy as s, createSession as sn, RateLimit as st, ClientBundles as t, isRedirect as tn, CachedOptions as tt, NotReady as u, toNodeHeaders as un, RateLimitMiddleware as ut, StateAttributes as v, IntentSubmission as vt, binding as w, ParseResult as wt, action as x, SubmissionOptions as xt, StateMap as y, ReplyOptions as yt, render as z, matchRoute as zt };
|
|
1644
|
-
//# sourceMappingURL=server-
|
|
1647
|
+
//# sourceMappingURL=server-0rS5vUW1.d.ts.map
|