brumate 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{boot-DQuAhAd5.d.ts → boot-ej-9NRT3.d.ts} +20 -2
- package/dist/cli.js +88 -82
- package/dist/cli.js.map +1 -1
- package/dist/{client-CwVcmymi.js → client-B-ww-PQ7.js} +304 -48
- package/dist/client-B-ww-PQ7.js.map +1 -0
- package/dist/{client-4eabQtYJ.d.ts → client-Do6IBIhI.d.ts} +35 -9
- package/dist/{defer-BaXWydb0.js → defer-JD2FK9mV.js} +5 -3
- package/dist/defer-JD2FK9mV.js.map +1 -0
- package/dist/{devtools-calls-DGW6nLZ2.js → devtools-calls-DCjuSkim.js} +3 -3
- package/dist/{devtools-calls-DGW6nLZ2.js.map → devtools-calls-DCjuSkim.js.map} +1 -1
- package/dist/{devtools-panel-Cq8LpsyW.js → devtools-panel-DLeWTPhU.js} +4 -4
- package/dist/{devtools-panel-Cq8LpsyW.js.map → devtools-panel-DLeWTPhU.js.map} +1 -1
- package/dist/{devtools-CMuj12yR.js → devtools-tuq7ATGN.js} +10 -7
- package/dist/devtools-tuq7ATGN.js.map +1 -0
- package/dist/{error-catalog-DakxjSgj.js → error-catalog-BBWB7w-E.js} +11 -4
- package/dist/error-catalog-BBWB7w-E.js.map +1 -0
- package/dist/{error-catalog-VxLbz-6p.js → error-catalog-CbmQqfat.js} +1 -1
- package/dist/{events-LgLdp1R7.js → events-BDVITj3P.js} +3 -5
- package/dist/events-BDVITj3P.js.map +1 -0
- package/dist/{features-DwMYKBIC.js → features-Cte5aj20.js} +8 -2
- package/dist/features-Cte5aj20.js.map +1 -0
- package/dist/{files-DXS8RAtZ.js → files-Bz0lAQzD.js} +2 -2
- package/dist/{files-DXS8RAtZ.js.map → files-Bz0lAQzD.js.map} +1 -1
- package/dist/{html-Cf5uKhLs.js → html-BYuHDvxy.js} +10 -3
- package/dist/html-BYuHDvxy.js.map +1 -0
- package/dist/index.d.ts +71 -19
- package/dist/index.js +3 -3
- package/dist/{inspect-B5AoHh5O.js → inspect-fpaBJ5pm.js} +1247 -62
- package/dist/inspect-fpaBJ5pm.js.map +1 -0
- package/dist/{loader-CTeT6ie9.js → loader-DMxuZ6He.js} +14 -6
- package/dist/loader-DMxuZ6He.js.map +1 -0
- package/dist/{navigate-Bj73X4ZS.js → navigate-C5PjwYMh.js} +101 -20
- package/dist/navigate-C5PjwYMh.js.map +1 -0
- package/dist/{produce-CLABZ8k2.d.ts → produce-BDkCsGH7.d.ts} +3 -3
- package/dist/{rpc-kVB0Ujdx.js → rpc-DOdrekhP.js} +23 -13
- package/dist/rpc-DOdrekhP.js.map +1 -0
- package/dist/runtime/bundles.d.ts +1 -1
- package/dist/runtime/bundles.js +6 -2
- package/dist/runtime/bundles.js.map +1 -1
- package/dist/runtime/client.d.ts +4 -3
- package/dist/runtime/client.js +5 -5
- package/dist/runtime/devtools.d.ts +3 -1
- package/dist/runtime/devtools.js +1 -1
- package/dist/runtime/events.js +1 -1
- package/dist/runtime/hot.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/otel.d.ts +18 -0
- package/dist/runtime/otel.js +127 -0
- package/dist/runtime/otel.js.map +1 -0
- package/dist/runtime/server.d.ts +4 -3
- package/dist/runtime/server.js +5 -5
- package/dist/runtime/signals.d.ts +2 -2
- package/dist/runtime/signals.js +4 -1
- package/dist/runtime/signals.js.map +1 -1
- package/dist/runtime/static-loader.d.ts +2 -2
- package/dist/runtime/static-loader.js +1 -1
- package/dist/runtime/store.d.ts +2 -2
- package/dist/runtime/store.js +1 -1
- package/dist/runtime/testing.d.ts +2 -2
- package/dist/runtime/testing.js +2 -2
- package/dist/search-params-qGERTLi3.js +382 -0
- package/dist/search-params-qGERTLi3.js.map +1 -0
- package/dist/{serial-ribg9NAj.js → serial-B2AJ9VGx.js} +1 -1
- package/dist/{serial-ioa17MuY.js → serial-Cj6pDGOq.js} +6 -6
- package/dist/{serial-ioa17MuY.js.map → serial-Cj6pDGOq.js.map} +1 -1
- package/dist/{server-DesBZv5g.d.ts → server-2-LS_KFo.d.ts} +125 -9
- package/dist/{server-BUuf7XPZ.js → server-CRGZMWnK.js} +545 -236
- package/dist/server-CRGZMWnK.js.map +1 -0
- package/dist/{shared-CX_YacDm.js → shared-CUBWrbiM.js} +4 -4
- package/dist/{shared-CX_YacDm.js.map → shared-CUBWrbiM.js.map} +1 -1
- package/dist/sheets-B9Zr50mf.js +105 -0
- package/dist/sheets-B9Zr50mf.js.map +1 -0
- package/dist/{signals-7VVD9C_H.d.ts → signals-BgsJK-uT.d.ts} +16 -6
- package/dist/{static-loader-BM0-wdIc.js → static-loader-BDBtWsdg.js} +107 -19
- package/dist/static-loader-BDBtWsdg.js.map +1 -0
- package/dist/{static-loader-BSAyFqG0.d.ts → static-loader-CAFn6p0l.d.ts} +2 -2
- package/dist/{store-9_oa0HG1.d.ts → store-BwWg-Iei.d.ts} +79 -2
- package/dist/store-DNr24Z8L.js +950 -0
- package/dist/store-DNr24Z8L.js.map +1 -0
- package/dist/{stream-read-BTsYstJY.js → stream-read-CiLDH60b.js} +2 -2
- package/dist/{stream-read-BTsYstJY.js.map → stream-read-CiLDH60b.js.map} +1 -1
- package/dist/{stream-read-Dek3HnqO.js → stream-read-DVoregpA.js} +1 -1
- package/dist/trace-DT7RGRAV.d.ts +52 -0
- package/dist/trace-browser-C7MFMove.js +170 -0
- package/dist/trace-browser-C7MFMove.js.map +1 -0
- package/dist/trace-flag-Dy267snx.js +7 -0
- package/dist/trace-flag-Dy267snx.js.map +1 -0
- package/dist/{trusted-g_zUJbh2.js → trusted-Bmwg4_hf.js} +12 -5
- package/dist/trusted-Bmwg4_hf.js.map +1 -0
- package/dist/view-transitions-BpnVwtS4.js +141 -0
- package/dist/view-transitions-BpnVwtS4.js.map +1 -0
- package/dist/vite.d.ts +8 -1
- package/dist/vite.js +356 -46
- package/dist/vite.js.map +1 -1
- package/elements.d.ts +8 -0
- package/package.json +13 -1
- package/skills/brumate/SKILL.md +9 -5
- package/skills/brumate/references/errors.md +95 -14
- package/skills/brumate/references/events.md +27 -1
- package/skills/brumate/references/signals.md +4 -4
- package/skills/brumate/references/state.md +79 -4
- package/skills/brumate/references/syntax.md +58 -9
- package/dist/client-CwVcmymi.js.map +0 -1
- package/dist/defer-BaXWydb0.js.map +0 -1
- package/dist/devtools-CMuj12yR.js.map +0 -1
- package/dist/error-catalog-DakxjSgj.js.map +0 -1
- package/dist/events-LgLdp1R7.js.map +0 -1
- package/dist/features-DwMYKBIC.js.map +0 -1
- package/dist/html-Cf5uKhLs.js.map +0 -1
- package/dist/inspect-B5AoHh5O.js.map +0 -1
- package/dist/loader-CTeT6ie9.js.map +0 -1
- package/dist/navigate-Bj73X4ZS.js.map +0 -1
- package/dist/rpc-kVB0Ujdx.js.map +0 -1
- package/dist/search-params-Wg-0FsMj.js +0 -148
- package/dist/search-params-Wg-0FsMj.js.map +0 -1
- package/dist/server-BUuf7XPZ.js.map +0 -1
- package/dist/static-loader-BM0-wdIc.js.map +0 -1
- package/dist/store-Cy4EEyZ7.js +0 -439
- package/dist/store-Cy4EEyZ7.js.map +0 -1
- package/dist/trusted-g_zUJbh2.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundles.js","names":[],"sources":["../../src/runtime/bundles.ts"],"sourcesContent":["// The `load` of a build, which `virtual:brumate/manifest` exports. The server names the bundles\n// that a page needs in the `b-load` attribute of its state records, so the client entry holds\n// no table of the bundles of the app.\n\nimport type { ClientModule } from './client.ts';\nimport { HAS_BRIDGES } from './features.ts';\n\n/** The client modules of the bundles that loaded, by component ID. */\nconst loaded = new Map<string, ClientModule>();\n/** The bundles that load or loaded, by URL. */\nconst pending = new Map<string, Promise<void>>();\n/** Why the bundles that failed to load failed, by URL, until a load of them lands. */\nconst failed = new Map<string, unknown>();\n/** The state records whose `b-load` was read. */\nconst read = new WeakSet<Element>();\n\n/**\n * Loads a URL that a state record names: a bundle, with the client modules of the components\n * that it holds, or a stylesheet that a module of a bundle imports. A URL is relative to this\n * chunk, as the server writes it for a base of \"./\".\n */\nfunction loadBundle(url: string, nonce: string | null): Promise<void> | undefined {\n const href = new URL(url, import.meta.url).href;\n // A stylesheet goes in the head unless the page has it, such as from the head of the page.\n if (url.endsWith('.css')) {\n for (const link of document.querySelectorAll<HTMLLinkElement>('link[rel=stylesheet]')) {\n if (link.href === href) {\n return undefined;\n }\n }\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = href;\n // The nonce of the record, for a policy on styles. A navigation keeps the link (`b-bundle`),\n // as it keeps the code of the bundle.\n if (nonce) {\n link.setAttribute('nonce', nonce);\n }\n link.setAttribute('b-bundle', '');\n document.head.append(link);\n return
|
|
1
|
+
{"version":3,"file":"bundles.js","names":[],"sources":["../../src/runtime/bundles.ts"],"sourcesContent":["// The `load` of a build, which `virtual:brumate/manifest` exports. The server names the bundles\n// that a page needs in the `b-load` attribute of its state records, so the client entry holds\n// no table of the bundles of the app.\n\nimport type { ClientModule } from './client.ts';\nimport { HAS_BRIDGES } from './features.ts';\n\n/** The client modules of the bundles that loaded, by component ID. */\nconst loaded = new Map<string, ClientModule>();\n/** The bundles that load or loaded, by URL. */\nconst pending = new Map<string, Promise<void>>();\n/** Why the bundles that failed to load failed, by URL, until a load of them lands. */\nconst failed = new Map<string, unknown>();\n/** The state records whose `b-load` was read. */\nconst read = new WeakSet<Element>();\n\n/**\n * Loads a URL that a state record names: a bundle, with the client modules of the components\n * that it holds, or a stylesheet that a module of a bundle imports. A URL is relative to this\n * chunk, as the server writes it for a base of \"./\".\n */\nfunction loadBundle(url: string, nonce: string | null): Promise<void> | undefined {\n const href = new URL(url, import.meta.url).href;\n // A stylesheet goes in the head unless the page has it, such as from the head of the page.\n // `load` waits for it, so a component that the browser renders does not show unstyled.\n if (url.endsWith('.css')) {\n for (const link of document.querySelectorAll<HTMLLinkElement>('link[rel=stylesheet]')) {\n if (link.href === href) {\n return undefined;\n }\n }\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = href;\n // The nonce of the record, for a policy on styles. A navigation keeps the link (`b-bundle`),\n // as it keeps the code of the bundle.\n if (nonce) {\n link.setAttribute('nonce', nonce);\n }\n link.setAttribute('b-bundle', '');\n // A stylesheet that fails to load does not stop the component: it shows without it.\n const sheet = new Promise<void>((resolve) => {\n link.onload = link.onerror = () => resolve();\n });\n pending.set(url, sheet);\n document.head.append(link);\n return sheet;\n }\n let promise = pending.get(url);\n if (!promise) {\n promise = import(/* @vite-ignore */ href).then(\n (bundle: { modules: Record<string, ClientModule> }) => {\n failed.delete(url);\n for (const [id, module] of Object.entries(bundle.modules)) {\n loaded.set(id, module);\n }\n },\n );\n pending.set(url, promise);\n // A load that fails starts again only when a new record names the URL.\n promise.catch((error: unknown) => {\n pending.delete(url);\n failed.set(url, error);\n });\n }\n return promise;\n}\n\n/** Loads what the state records of the page that were not read yet name. */\nfunction readRecords(): void {\n for (const script of document.querySelectorAll('script[b-load]')) {\n if (!read.has(script)) {\n read.add(script);\n for (const url of script.getAttribute('b-load')!.split(' ')) {\n // Browsers hide the attribute once the page loads, and keep the property.\n const nonce = (script as HTMLScriptElement).nonce || script.getAttribute('nonce');\n void loadBundle(url, nonce)?.catch(() => {});\n }\n }\n }\n}\n\n// The bundles of the page start with the entry, so the code of the page comes in the same round\n// trip as the core. The rest of a page that the browser reads after an `async` entry comes later.\nreadRecords();\nif (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', readRecords);\n}\n\n/**\n * The client module of a component, from the bundles that the state records of the page name.\n * Undefined for a component with no client code. Rejects when a bundle failed to load and the\n * component is not in the others.\n */\nexport function load(id: string): Promise<ClientModule> | undefined {\n // A bridge of `<script module>` is named by its component, which holds its code.\n if (HAS_BRIDGES && id.startsWith('bridge:')) {\n id = id.slice(7);\n }\n if (loaded.has(id)) {\n return Promise.resolve(loaded.get(id)!);\n }\n // The records that the page added since, such as those of a navigation or a `#defer` body.\n readRecords();\n const waiting = [...pending.values()];\n if (waiting.length === 0 && failed.size === 0) {\n return undefined;\n }\n return Promise.allSettled(waiting).then(() => {\n if (!loaded.has(id)) {\n // A bundle that failed may hold the code, so the caller gets the error, as it does for a\n // module that throws. After a deploy, a gone bundle takes the page to the skew reload.\n for (const error of failed.values()) {\n throw error;\n }\n }\n return loaded.get(id)!;\n });\n}\n"],"mappings":";;;AAQA,MAAM,yBAAS,IAAI,IAA0B;;AAE7C,MAAM,0BAAU,IAAI,IAA2B;;AAE/C,MAAM,yBAAS,IAAI,IAAqB;;AAExC,MAAM,uBAAO,IAAI,QAAiB;;;;;;AAOlC,SAAS,WAAW,KAAa,OAAiD;CAChF,MAAM,OAAO,IAAI,IAAI,KAAK,YAAY,GAAG,CAAC,CAAC;CAG3C,IAAI,IAAI,SAAS,MAAM,GAAG;EACxB,KAAK,MAAM,QAAQ,SAAS,iBAAkC,sBAAsB,GAClF,IAAI,KAAK,SAAS,MAChB;EAGJ,MAAM,OAAO,SAAS,cAAc,MAAM;EAC1C,KAAK,MAAM;EACX,KAAK,OAAO;EAGZ,IAAI,OACF,KAAK,aAAa,SAAS,KAAK;EAElC,KAAK,aAAa,YAAY,EAAE;EAEhC,MAAM,QAAQ,IAAI,SAAe,YAAY;GAC3C,KAAK,SAAS,KAAK,gBAAgB,QAAQ;EAC7C,CAAC;EACD,QAAQ,IAAI,KAAK,KAAK;EACtB,SAAS,KAAK,OAAO,IAAI;EACzB,OAAO;CACT;CACA,IAAI,UAAU,QAAQ,IAAI,GAAG;CAC7B,IAAI,CAAC,SAAS;EACZ,UAAU;;GAA0B;CAAK,CAAC,MACvC,WAAsD;GACrD,OAAO,OAAO,GAAG;GACjB,KAAK,MAAM,CAAC,IAAI,WAAW,OAAO,QAAQ,OAAO,OAAO,GACtD,OAAO,IAAI,IAAI,MAAM;EAEzB,CACF;EACA,QAAQ,IAAI,KAAK,OAAO;EAExB,QAAQ,OAAO,UAAmB;GAChC,QAAQ,OAAO,GAAG;GAClB,OAAO,IAAI,KAAK,KAAK;EACvB,CAAC;CACH;CACA,OAAO;AACT;;AAGA,SAAS,cAAoB;CAC3B,KAAK,MAAM,UAAU,SAAS,iBAAiB,gBAAgB,GAC7D,IAAI,CAAC,KAAK,IAAI,MAAM,GAAG;EACrB,KAAK,IAAI,MAAM;EACf,KAAK,MAAM,OAAO,OAAO,aAAa,QAAQ,CAAC,CAAE,MAAM,GAAG,GAGxD,WAAgB,KADD,OAA6B,SAAS,OAAO,aAAa,OAAO,CACtD,CAAC,EAAE,YAAY,CAAC,CAAC;CAE/C;AAEJ;AAIA,YAAY;AACZ,IAAI,SAAS,eAAe,WAC1B,SAAS,iBAAiB,oBAAoB,WAAW;;;;;;AAQ3D,SAAgB,KAAK,IAA+C;CAElE,IAAI,eAAe,GAAG,WAAW,SAAS,GACxC,KAAK,GAAG,MAAM,CAAC;CAEjB,IAAI,OAAO,IAAI,EAAE,GACf,OAAO,QAAQ,QAAQ,OAAO,IAAI,EAAE,CAAE;CAGxC,YAAY;CACZ,MAAM,UAAU,CAAC,GAAG,QAAQ,OAAO,CAAC;CACpC,IAAI,QAAQ,WAAW,KAAK,OAAO,SAAS,GAC1C;CAEF,OAAO,QAAQ,WAAW,OAAO,CAAC,CAAC,WAAW;EAC5C,IAAI,CAAC,OAAO,IAAI,EAAE,GAGhB,KAAK,MAAM,SAAS,OAAO,OAAO,GAChC,MAAM;EAGV,OAAO,OAAO,IAAI,EAAE;CACtB,CAAC;AACH"}
|
package/dist/runtime/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { c as navigationContext, l as routeContext, o as createContext } from "../context-BNgBXVUQ.js";
|
|
2
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 {
|
|
4
|
-
import { t as
|
|
5
|
-
|
|
3
|
+
import { i as TraceSpan, n as TraceHandler, r as TraceName } from "../trace-DT7RGRAV.js";
|
|
4
|
+
import { $ as setVar, $t as DevtoolsHooks, A as listNodes, At as dispose, B as afterInsert, Bt as rpc, C as appendText, Cn as branch, Ct as loading, D as fillList, Dn as rekey, Dt as fail, E as fillBranch, En as offscreen, Et as wait, F as setAttrText, Ft as remount, G as setOwner, Gt as provideValue, H as descendants, Ht as submitAction, I as setContent, It as removeRoot, J as spreadProps, Jt as toStore, K as sink, Kt as setGlobal, L as setOn, Lt as action, M as nodes, Mt as init, N as putText, Nt as leavePage, O as keep, On as reset, Ot as loadModule, P as setAttr, Pt as leaveRoutes, Q as deferInBrowser, Qt as DEVTOOLS, R as setSpread, Rt as handle, S as asyncEffect, Sn as HiddenBody, St as keepValue, T as clone, Tn as held, Tt as started, U as makeId, Ut as consumeContext, V as createScope, Vt as spread, W as removeScope, Wt as consumeStore, X as addPortal, Xt as ClientModule, Y as addHead, Yt as updateRoute, Z as addStyle, Zt as CoreOptions, _ as update, _n as setItem, _t as fillAttrs, a as cells, an as skew, at as attrs, b as paramEffect, bn as insert, bt as fillSpread, c as get, cn as componentNodes, ct as restRef, d as pend, dn as elementAt, dt as guess, en as Scope, et as list, f as pending, fn as foreignNodes, ft as optimisticStore, g as unreadMemo, gn as renderMemo, gt as countLoads, h as timed, hn as readMemo, ht as attempt, i as bindings, in as scopes, it as attr, j as markBlock, jt as forget, k as keepText, kn as retag, kt as nameComment, l as isBound, ln as dynamic, lt as text, m as set, mn as place, mt as after, n as asyncMemo, nn as hooks, nt as windowList, o as effect, on as Component, ot as content, p as resolve, pn as memoNow, pt as track, q as prop, qt as storeUpdate, r as binding, rn as rpcPrefix, rt as windowStart, s as gate, sn as component, st as portalTo, t as loader, tn as build, tt as toList, u as memo, un as dynamicNodes, ut as writeText, v as updated, vn as setSlots, vt as fillPend, w as branchNodes, wn as fill, wt as reveal, x as searchParam, xn as templateCall, xt as fillValue, y as title, yn as children, yt as fillSettled, z as template, zt as handlerProp } from "../client-Do6IBIhI.js";
|
|
5
|
+
import { t as produce } from "../produce-BDkCsGH7.js";
|
|
6
|
+
export { type ClientModule, type Component, type CoreOptions, DEVTOOLS, type DevtoolsHooks, type HiddenBody, type Raw, type Scope, type TraceHandler, type TraceName, type TraceSpan, action, addHead, addPortal, addStyle, affix, after, afterInsert, appendText, asyncEffect, 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, fillPend, fillSettled, fillSpread, fillValue, foreignNodes, forget, gate, gateValue, get, guess, handle, handlerProp, held, hooks, init, insert, internal, isBound, keep, keepText, keepValue, leavePage, leaveRoutes, list, listNodes, loadModule, loader, loading, makeId, markBlock, memo, memoNow, mergeAttributes, nameComment, navigationContext, nodes, offscreen, onAttribute, optimisticStore, paramEffect, pend, 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,6 +1,6 @@
|
|
|
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 { C as unbind, f as gateValue, l as SCOPE_IDS } from "../shared-
|
|
3
|
-
import { i as produce } 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-BYuHDvxy.js";
|
|
2
|
+
import { C as unbind, f as gateValue, l as SCOPE_IDS } from "../shared-CUBWrbiM.js";
|
|
3
|
+
import { i as produce } from "../search-params-qGERTLi3.js";
|
|
4
4
|
import { a as navigationContext, o as routeContext, r as createContext } from "../context-CU4Fpn5a.js";
|
|
5
|
-
import { $ as
|
|
6
|
-
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, fillPend, fillSettled, fillSpread, fillValue, foreignNodes, forget, gate, gateValue, get,
|
|
5
|
+
import { $ as setItem, $t as set, A as loading, At as submitAction, B as writeText, Bt as updateRoute, C as countLoads, Cn as skew, Ct as remount, D as fillSpread, Dt as handlerProp, E as fillSettled, Et as handle, F as attrs, Ft as consumeStore, G as dynamic, Gt as effect, H as spreadProps, Ht as binding, I as content, It as provideValue, J as foreignNodes, Jt as isBound, K as dynamicNodes, Kt as gate, L as portalTo, Lt as setGlobal, M as started, Mt as optimisticStore, N as wait, Nt as track, O as fillValue, Ot as rpc, P as attr, Pt as consumeContext, Q as renderMemo, Qt as resolve, R as restRef, Rt as storeUpdate, S as attempt, Sn as scopes, St as leaveRoutes, T as fillPend, Tt as action, U as component, Ut as bindings, V as prop, Vt as asyncMemo, W as componentNodes, Wt as cells, X as place, Xt as pend, Y as memoNow, Yt as memo, Z as readMemo, Zt as pending, _ as offscreen, _n as loadModule, _t as template, a as addHead, an as children, at as fillList, b as retag, bn as hooks, bt as init, c as deferInBrowser, cn as title, ct as listNodes, d as toList, dn as descendants, dt as putText, en as timed, et as setSlots, f as windowList, fn as makeId, ft as setAttr, g as held, gn as nameComment, gt as setSpread, h as fill, hn as sink, ht as setOn, i as asyncEffect, in as fail, it as fillBranch, j as reveal, jt as guess, k as keepValue, kt as spread, l as setVar, ln as afterInsert, lt as markBlock, m as branch, mn as setOwner, mt as setContent, n as paramEffect, nn as update, nt as branchNodes, o as addPortal, on as insert, ot as keep, p as windowStart, pn as removeScope, pt as setAttrText, q as elementAt, qt as get, r as searchParam, rn as updated, rt as clone, s as addStyle, sn as templateCall, st as keepText, t as loader, tn as unreadMemo, tt as appendText, u as list, un as createScope, ut as nodes, v as rekey, vn as DEVTOOLS, vt as dispose, w as fillAttrs, wt as removeRoot, x as after, xn as rpcPrefix, xt as leavePage, y as reset, yn as build, yt as forget, z as text, zt as toStore } from "../client-B-ww-PQ7.js";
|
|
6
|
+
export { DEVTOOLS, action, addHead, addPortal, addStyle, affix, after, afterInsert, appendText, asyncEffect, 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, fillPend, fillSettled, fillSpread, fillValue, foreignNodes, forget, gate, gateValue, get, guess, handle, handlerProp, held, hooks, init, insert, internal, isBound, keep, keepText, keepValue, leavePage, leaveRoutes, list, listNodes, loadModule, loader, loading, makeId, markBlock, memo, memoNow, mergeAttributes, nameComment, navigationContext, nodes, offscreen, onAttribute, optimisticStore, paramEffect, pend, 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
1
|
import { c as ScopeId } from "../shared-CuJdWifz.js";
|
|
2
|
-
import {
|
|
2
|
+
import { An as NavigationReport, en as Scope } from "../client-Do6IBIhI.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
|
|
@@ -187,6 +187,8 @@ export interface EffectEntry {
|
|
|
187
187
|
time: number;
|
|
188
188
|
cleanups: number;
|
|
189
189
|
lastCleanup?: number;
|
|
190
|
+
/** True while a run of an async callback has not settled. */
|
|
191
|
+
pending?: boolean;
|
|
190
192
|
/** False once its cleanup ran and it has not run again, such as in a removed scope. */
|
|
191
193
|
active: boolean;
|
|
192
194
|
}
|
package/dist/runtime/devtools.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as preview, i as nextBlockState, n as installDevtools, o as reportError, r as moveBlock, s as scanBlocks, t as findRootScope } from "../devtools-
|
|
1
|
+
import { a as preview, i as nextBlockState, n as installDevtools, o as reportError, r as moveBlock, s as scanBlocks, t as findRootScope } from "../devtools-tuq7ATGN.js";
|
|
2
2
|
import { t as LOGO } from "../logo-DQ_OYhBi.js";
|
|
3
3
|
export { LOGO, findRootScope, installDevtools, moveBlock, nextBlockState, preview, reportError, scanBlocks };
|
package/dist/runtime/events.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as KEY_NAMES, n as MODIFIERS, r as cancelWhen, i as capture, a as once, o as prevent, s as stop, c as transition } from "../events-
|
|
1
|
+
export { t as KEY_NAMES, n as MODIFIERS, r as cancelWhen, i as capture, a as once, o as prevent, s as stop, c as transition } from "../events-BDVITj3P.js";
|
package/dist/runtime/hot.d.ts
CHANGED
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-BYuHDvxy.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-ej-9NRT3.js";
|
|
2
|
+
import { t as startWithoutNavigation } from "../static-loader-CAFn6p0l.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-BDBtWsdg.js";
|
|
2
|
+
import { t as start } from "../loader-DMxuZ6He.js";
|
|
3
3
|
export { start, startWithoutNavigation };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { i as TraceSpan, n as TraceHandler } from "../trace-DT7RGRAV.js";
|
|
2
|
+
import * as Api from "@opentelemetry/api";
|
|
3
|
+
//#region src/runtime/otel.d.ts
|
|
4
|
+
type OtelApi = typeof Api;
|
|
5
|
+
export interface OtelOptions {
|
|
6
|
+
/** The name of the tracer. Defaults to `brumate`. */
|
|
7
|
+
tracerName?: string;
|
|
8
|
+
/** The `@opentelemetry/api` module. Without it, the adapter imports the package. */
|
|
9
|
+
api?: OtelApi;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Makes an OpenTelemetry span for each brumate span, with the same trace and parent ids, times,
|
|
13
|
+
* attributes and status. The SDK makes the span ids.
|
|
14
|
+
*/
|
|
15
|
+
export declare function otel(options?: OtelOptions): TraceHandler;
|
|
16
|
+
//#endregion
|
|
17
|
+
export type { TraceHandler, TraceSpan };
|
|
18
|
+
//# sourceMappingURL=otel.d.ts.map
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
//#region src/runtime/otel.ts
|
|
2
|
+
/** How long a span waits for its parent, in milliseconds. */
|
|
3
|
+
const PARENT_WAIT = 6e4;
|
|
4
|
+
/** How often the waiting spans are checked for age, in milliseconds. */
|
|
5
|
+
const SWEEP_EVERY = 5e3;
|
|
6
|
+
/** The most spans that wait; past it the oldest are exported as roots. */
|
|
7
|
+
const MAX_WAITING = 1e4;
|
|
8
|
+
/**
|
|
9
|
+
* Makes an OpenTelemetry span for each brumate span, with the same trace and parent ids, times,
|
|
10
|
+
* attributes and status. The SDK makes the span ids.
|
|
11
|
+
*/
|
|
12
|
+
function otel(options = {}) {
|
|
13
|
+
const name = options.tracerName ?? "brumate";
|
|
14
|
+
const ready = loadApi(options.api);
|
|
15
|
+
const waiting = {
|
|
16
|
+
byParent: /* @__PURE__ */ new Map(),
|
|
17
|
+
count: 0,
|
|
18
|
+
lastSweep: 0
|
|
19
|
+
};
|
|
20
|
+
let reported = false;
|
|
21
|
+
return async function onTrace(span) {
|
|
22
|
+
const loaded = await ready;
|
|
23
|
+
if (loaded instanceof Error) {
|
|
24
|
+
if (reported) return;
|
|
25
|
+
reported = true;
|
|
26
|
+
throw loaded;
|
|
27
|
+
}
|
|
28
|
+
const tracer = loaded.trace.getTracer(name);
|
|
29
|
+
const now = Date.now();
|
|
30
|
+
if (now - waiting.lastSweep >= SWEEP_EVERY) {
|
|
31
|
+
waiting.lastSweep = now;
|
|
32
|
+
sweep(waiting, now, PARENT_WAIT, (orphan) => {
|
|
33
|
+
exportTree(loaded, tracer, orphan, waiting, void 0);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (span.parentId !== void 0 && span.name !== "brumate.request") {
|
|
37
|
+
const list = waiting.byParent.get(span.parentId) ?? [];
|
|
38
|
+
list.push({
|
|
39
|
+
span,
|
|
40
|
+
since: now
|
|
41
|
+
});
|
|
42
|
+
waiting.byParent.set(span.parentId, list);
|
|
43
|
+
waiting.count += 1;
|
|
44
|
+
if (waiting.count > MAX_WAITING) sweep(waiting, now, -1, (orphan) => {
|
|
45
|
+
exportTree(loaded, tracer, orphan, waiting, void 0);
|
|
46
|
+
}, waiting.count - MAX_WAITING);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
exportTree(loaded, tracer, span, waiting, void 0);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
async function loadApi(api) {
|
|
53
|
+
if (api) return api;
|
|
54
|
+
try {
|
|
55
|
+
return await import("@opentelemetry/api");
|
|
56
|
+
} catch {
|
|
57
|
+
return /* @__PURE__ */ new Error("brumate/otel needs the package '@opentelemetry/api'. Install it with `npm install @opentelemetry/api`, or pass it as the `api` option.");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Exports the spans that waited longer than `age`, as roots, at most `limit` of them. Groups are
|
|
62
|
+
* in insertion order, so the oldest go first.
|
|
63
|
+
*/
|
|
64
|
+
function sweep(queue, now, age, onOrphan, limit = Infinity) {
|
|
65
|
+
let left = limit;
|
|
66
|
+
for (const [parentId, list] of queue.byParent) {
|
|
67
|
+
if (left <= 0) return;
|
|
68
|
+
const kept = [];
|
|
69
|
+
const expired = [];
|
|
70
|
+
for (const item of list) if (left > 0 && now - item.since > age) {
|
|
71
|
+
expired.push(item.span);
|
|
72
|
+
left -= 1;
|
|
73
|
+
} else kept.push(item);
|
|
74
|
+
if (expired.length === 0) continue;
|
|
75
|
+
queue.count -= expired.length;
|
|
76
|
+
if (kept.length === 0) queue.byParent.delete(parentId);
|
|
77
|
+
else queue.byParent.set(parentId, kept);
|
|
78
|
+
for (const span of expired) onOrphan(span);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function exportTree(api, tracer, span, waiting, parent) {
|
|
82
|
+
let context = api.ROOT_CONTEXT;
|
|
83
|
+
if (parent) context = api.trace.setSpan(context, parent);
|
|
84
|
+
else if (span.parentId !== void 0) context = api.trace.setSpanContext(context, {
|
|
85
|
+
traceId: span.traceId,
|
|
86
|
+
spanId: span.parentId,
|
|
87
|
+
traceFlags: api.TraceFlags.SAMPLED,
|
|
88
|
+
isRemote: true
|
|
89
|
+
});
|
|
90
|
+
const made = tracer.startSpan(span.name, {
|
|
91
|
+
kind: getKind(api, span),
|
|
92
|
+
startTime: span.start,
|
|
93
|
+
attributes: {
|
|
94
|
+
...span.attributes,
|
|
95
|
+
"brumate.label": span.label,
|
|
96
|
+
"brumate.trace_id": span.traceId,
|
|
97
|
+
"brumate.span_id": span.spanId,
|
|
98
|
+
...span.parentId === void 0 ? {} : { "brumate.parent_id": span.parentId }
|
|
99
|
+
}
|
|
100
|
+
}, context);
|
|
101
|
+
if (span.status === "error") {
|
|
102
|
+
const message = span.error?.message ?? "";
|
|
103
|
+
made.recordException({
|
|
104
|
+
name: "Error",
|
|
105
|
+
message
|
|
106
|
+
}, span.end);
|
|
107
|
+
made.setStatus({
|
|
108
|
+
code: api.SpanStatusCode.ERROR,
|
|
109
|
+
message
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
made.end(span.end);
|
|
113
|
+
const children = waiting.byParent.get(span.spanId);
|
|
114
|
+
if (!children) return;
|
|
115
|
+
waiting.byParent.delete(span.spanId);
|
|
116
|
+
waiting.count -= children.length;
|
|
117
|
+
for (const child of children) exportTree(api, tracer, child.span, waiting, made);
|
|
118
|
+
}
|
|
119
|
+
function getKind(api, span) {
|
|
120
|
+
if (span.name === "brumate.request") return api.SpanKind.SERVER;
|
|
121
|
+
if (span.name === "brumate.fetch" || span.name === "brumate.navigation") return api.SpanKind.CLIENT;
|
|
122
|
+
return api.SpanKind.INTERNAL;
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
export { otel };
|
|
126
|
+
|
|
127
|
+
//# sourceMappingURL=otel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otel.js","names":[],"sources":["../../src/runtime/otel.ts"],"sourcesContent":["import type * as Api from '@opentelemetry/api';\nimport type { TraceHandler, TraceSpan } from './trace.ts';\n\ntype OtelApi = typeof Api;\n\nexport type { TraceHandler, TraceSpan };\n\nexport interface OtelOptions {\n /** The name of the tracer. Defaults to `brumate`. */\n tracerName?: string;\n /** The `@opentelemetry/api` module. Without it, the adapter imports the package. */\n api?: OtelApi;\n}\n\n/** How long a span waits for its parent, in milliseconds. */\nconst PARENT_WAIT = 60_000;\n/** How often the waiting spans are checked for age, in milliseconds. */\nconst SWEEP_EVERY = 5_000;\n/** The most spans that wait; past it the oldest are exported as roots. */\nconst MAX_WAITING = 10_000;\n\ninterface Queue {\n /** Spans by the id of the parent they wait for. */\n byParent: Map<string, Waiting[]>;\n count: number;\n lastSweep: number;\n}\n\ninterface Waiting {\n span: TraceSpan;\n since: number;\n}\n\n/**\n * Makes an OpenTelemetry span for each brumate span, with the same trace and parent ids, times,\n * attributes and status. The SDK makes the span ids.\n */\nexport function otel(options: OtelOptions = {}): TraceHandler {\n const name = options.tracerName ?? 'brumate';\n const ready = loadApi(options.api);\n // Spans arrive child first, so a span waits here until its parent ends. A span with no parent\n // here, or with one from an incoming traceparent, starts the export of its tree.\n const waiting: Queue = { byParent: new Map(), count: 0, lastSweep: 0 };\n let reported = false;\n\n return async function onTrace(span) {\n const loaded = await ready;\n if (loaded instanceof Error) {\n // Throw once; the server logs it.\n if (reported) {\n return;\n }\n reported = true;\n throw loaded;\n }\n const tracer = loaded.trace.getTracer(name);\n const now = Date.now();\n if (now - waiting.lastSweep >= SWEEP_EVERY) {\n waiting.lastSweep = now;\n sweep(waiting, now, PARENT_WAIT, (orphan) => {\n exportTree(loaded, tracer, orphan, waiting, undefined);\n });\n }\n if (span.parentId !== undefined && span.name !== 'brumate.request') {\n const list = waiting.byParent.get(span.parentId) ?? [];\n list.push({ span, since: now });\n waiting.byParent.set(span.parentId, list);\n waiting.count += 1;\n if (waiting.count > MAX_WAITING) {\n // Too many wait: export the oldest, which are first in insertion order.\n sweep(\n waiting,\n now,\n -1,\n (orphan) => {\n exportTree(loaded, tracer, orphan, waiting, undefined);\n },\n waiting.count - MAX_WAITING,\n );\n }\n return;\n }\n exportTree(loaded, tracer, span, waiting, undefined);\n };\n}\n\nasync function loadApi(api: OtelApi | undefined): Promise<OtelApi | Error> {\n if (api) {\n return api;\n }\n try {\n return await import('@opentelemetry/api');\n } catch {\n return new Error(\n \"brumate/otel needs the package '@opentelemetry/api'. Install it with `npm install @opentelemetry/api`, or pass it as the `api` option.\",\n );\n }\n}\n\n/**\n * Exports the spans that waited longer than `age`, as roots, at most `limit` of them. Groups are\n * in insertion order, so the oldest go first.\n */\nfunction sweep(\n queue: Queue,\n now: number,\n age: number,\n onOrphan: (span: TraceSpan) => void,\n limit = Infinity,\n): void {\n let left = limit;\n for (const [parentId, list] of queue.byParent) {\n if (left <= 0) {\n return;\n }\n const kept: Waiting[] = [];\n const expired: TraceSpan[] = [];\n for (const item of list) {\n if (left > 0 && now - item.since > age) {\n expired.push(item.span);\n left -= 1;\n } else {\n kept.push(item);\n }\n }\n if (expired.length === 0) {\n continue;\n }\n queue.count -= expired.length;\n if (kept.length === 0) {\n queue.byParent.delete(parentId);\n } else {\n queue.byParent.set(parentId, kept);\n }\n for (const span of expired) {\n onOrphan(span);\n }\n }\n}\n\nfunction exportTree(\n api: OtelApi,\n tracer: Api.Tracer,\n span: TraceSpan,\n waiting: Queue,\n parent: Api.Span | undefined,\n): void {\n // A root of ours has the traceparent's parent, which the app does not export.\n let context = api.ROOT_CONTEXT;\n if (parent) {\n context = api.trace.setSpan(context, parent);\n } else if (span.parentId !== undefined) {\n context = api.trace.setSpanContext(context, {\n traceId: span.traceId,\n spanId: span.parentId,\n traceFlags: api.TraceFlags.SAMPLED,\n isRemote: true,\n });\n }\n const made = tracer.startSpan(\n span.name,\n {\n kind: getKind(api, span),\n startTime: span.start,\n attributes: {\n ...span.attributes,\n 'brumate.label': span.label,\n 'brumate.trace_id': span.traceId,\n 'brumate.span_id': span.spanId,\n ...(span.parentId === undefined ? {} : { 'brumate.parent_id': span.parentId }),\n },\n },\n context,\n );\n if (span.status === 'error') {\n const message = span.error?.message ?? '';\n made.recordException({ name: 'Error', message }, span.end);\n made.setStatus({ code: api.SpanStatusCode.ERROR, message });\n }\n made.end(span.end);\n const children = waiting.byParent.get(span.spanId);\n if (!children) {\n return;\n }\n waiting.byParent.delete(span.spanId);\n waiting.count -= children.length;\n for (const child of children) {\n exportTree(api, tracer, child.span, waiting, made);\n }\n}\n\nfunction getKind(api: OtelApi, span: TraceSpan): Api.SpanKind {\n if (span.name === 'brumate.request') {\n return api.SpanKind.SERVER;\n }\n if (span.name === 'brumate.fetch' || span.name === 'brumate.navigation') {\n return api.SpanKind.CLIENT;\n }\n return api.SpanKind.INTERNAL;\n}\n"],"mappings":";;AAeA,MAAM,cAAc;;AAEpB,MAAM,cAAc;;AAEpB,MAAM,cAAc;;;;;AAkBpB,SAAgB,KAAK,UAAuB,CAAC,GAAiB;CAC5D,MAAM,OAAO,QAAQ,cAAc;CACnC,MAAM,QAAQ,QAAQ,QAAQ,GAAG;CAGjC,MAAM,UAAiB;EAAE,0BAAU,IAAI,IAAI;EAAG,OAAO;EAAG,WAAW;CAAE;CACrE,IAAI,WAAW;CAEf,OAAO,eAAe,QAAQ,MAAM;EAClC,MAAM,SAAS,MAAM;EACrB,IAAI,kBAAkB,OAAO;GAE3B,IAAI,UACF;GAEF,WAAW;GACX,MAAM;EACR;EACA,MAAM,SAAS,OAAO,MAAM,UAAU,IAAI;EAC1C,MAAM,MAAM,KAAK,IAAI;EACrB,IAAI,MAAM,QAAQ,aAAa,aAAa;GAC1C,QAAQ,YAAY;GACpB,MAAM,SAAS,KAAK,cAAc,WAAW;IAC3C,WAAW,QAAQ,QAAQ,QAAQ,SAAS,KAAA,CAAS;GACvD,CAAC;EACH;EACA,IAAI,KAAK,aAAa,KAAA,KAAa,KAAK,SAAS,mBAAmB;GAClE,MAAM,OAAO,QAAQ,SAAS,IAAI,KAAK,QAAQ,KAAK,CAAC;GACrD,KAAK,KAAK;IAAE;IAAM,OAAO;GAAI,CAAC;GAC9B,QAAQ,SAAS,IAAI,KAAK,UAAU,IAAI;GACxC,QAAQ,SAAS;GACjB,IAAI,QAAQ,QAAQ,aAElB,MACE,SACA,KACA,KACC,WAAW;IACV,WAAW,QAAQ,QAAQ,QAAQ,SAAS,KAAA,CAAS;GACvD,GACA,QAAQ,QAAQ,WAClB;GAEF;EACF;EACA,WAAW,QAAQ,QAAQ,MAAM,SAAS,KAAA,CAAS;CACrD;AACF;AAEA,eAAe,QAAQ,KAAoD;CACzE,IAAI,KACF,OAAO;CAET,IAAI;EACF,OAAO,MAAM,OAAO;CACtB,QAAQ;EACN,uBAAO,IAAI,MACT,wIACF;CACF;AACF;;;;;AAMA,SAAS,MACP,OACA,KACA,KACA,UACA,QAAQ,UACF;CACN,IAAI,OAAO;CACX,KAAK,MAAM,CAAC,UAAU,SAAS,MAAM,UAAU;EAC7C,IAAI,QAAQ,GACV;EAEF,MAAM,OAAkB,CAAC;EACzB,MAAM,UAAuB,CAAC;EAC9B,KAAK,MAAM,QAAQ,MACjB,IAAI,OAAO,KAAK,MAAM,KAAK,QAAQ,KAAK;GACtC,QAAQ,KAAK,KAAK,IAAI;GACtB,QAAQ;EACV,OACE,KAAK,KAAK,IAAI;EAGlB,IAAI,QAAQ,WAAW,GACrB;EAEF,MAAM,SAAS,QAAQ;EACvB,IAAI,KAAK,WAAW,GAClB,MAAM,SAAS,OAAO,QAAQ;OAE9B,MAAM,SAAS,IAAI,UAAU,IAAI;EAEnC,KAAK,MAAM,QAAQ,SACjB,SAAS,IAAI;CAEjB;AACF;AAEA,SAAS,WACP,KACA,QACA,MACA,SACA,QACM;CAEN,IAAI,UAAU,IAAI;CAClB,IAAI,QACF,UAAU,IAAI,MAAM,QAAQ,SAAS,MAAM;MACtC,IAAI,KAAK,aAAa,KAAA,GAC3B,UAAU,IAAI,MAAM,eAAe,SAAS;EAC1C,SAAS,KAAK;EACd,QAAQ,KAAK;EACb,YAAY,IAAI,WAAW;EAC3B,UAAU;CACZ,CAAC;CAEH,MAAM,OAAO,OAAO,UAClB,KAAK,MACL;EACE,MAAM,QAAQ,KAAK,IAAI;EACvB,WAAW,KAAK;EAChB,YAAY;GACV,GAAG,KAAK;GACR,iBAAiB,KAAK;GACtB,oBAAoB,KAAK;GACzB,mBAAmB,KAAK;GACxB,GAAI,KAAK,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,qBAAqB,KAAK,SAAS;EAC9E;CACF,GACA,OACF;CACA,IAAI,KAAK,WAAW,SAAS;EAC3B,MAAM,UAAU,KAAK,OAAO,WAAW;EACvC,KAAK,gBAAgB;GAAE,MAAM;GAAS;EAAQ,GAAG,KAAK,GAAG;EACzD,KAAK,UAAU;GAAE,MAAM,IAAI,eAAe;GAAO;EAAQ,CAAC;CAC5D;CACA,KAAK,IAAI,KAAK,GAAG;CACjB,MAAM,WAAW,QAAQ,SAAS,IAAI,KAAK,MAAM;CACjD,IAAI,CAAC,UACH;CAEF,QAAQ,SAAS,OAAO,KAAK,MAAM;CACnC,QAAQ,SAAS,SAAS;CAC1B,KAAK,MAAM,SAAS,UAClB,WAAW,KAAK,QAAQ,MAAM,MAAM,SAAS,IAAI;AAErD;AAEA,SAAS,QAAQ,KAAc,MAA+B;CAC5D,IAAI,KAAK,SAAS,mBAChB,OAAO,IAAI,SAAS;CAEtB,IAAI,KAAK,SAAS,mBAAmB,KAAK,SAAS,sBACjD,OAAO,IAAI,SAAS;CAEtB,OAAO,IAAI,SAAS;AACtB"}
|
package/dist/runtime/server.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { a as Route, c as navigationContext, l as routeContext, o as createContext, r as NavigationState } from "../context-BNgBXVUQ.js";
|
|
2
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
|
-
import {
|
|
3
|
+
import { i as TraceSpan, n as TraceHandler, r as TraceName } from "../trace-DT7RGRAV.js";
|
|
4
|
+
import { t as produce } from "../produce-BDkCsGH7.js";
|
|
4
5
|
import { t as StandardSchemaV1 } from "../standard-schema-BNY82yX3.js";
|
|
5
6
|
import { f as Intent, v as SubmissionResult } from "../forms-j1xPAR14.js";
|
|
6
|
-
import { $ as
|
|
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 };
|
|
7
|
+
import { $ as runAction, $t as searchParam, A as component, At as FailedSubmission, B as keptPage, Bt as fieldErrors, C as action, Cn as toNodeHeaders, Ct as RateLimitMiddleware, D as caught, Dt as clientAddress, E as binding, Et as Window, F as handleRoute, Ft as SuccessfulSubmission, G as pageKey, Gt as Handler, H as logError, Ht as parseForm, I as inlineBodies, It as parseSubmission, J as render, Jt as MiddlewareLoader, K as read, Kt as Loader, L as insert, Lt as ParseResult, M as dynamic, Mt as ReplyOptions, N as errorAnswer, Nt as Submission, O as children, Ot as configureRateLimit, P as handleRequest, Pt as SubmissionOptions, Q as respond, Qt as matchRoute, R as isCrossSite, Rt as ValidationError, S as StreamOptions, Sn as serializeCookie, St as RateLimitError, T as attribute, Tt as RateLimitStore, U as memo, Ut as safeParse, V as lazy, Vt as parse, W as packState, Wt as EndpointLoader, X as renderToStream, Xt as RouteNode, Y as renderError, Yt as RouteMatch, Z as resolveView, Zt as RouteView, _ as RevealOrder, _n as CookieOptions, _t as revalidate, a as DocumentOptions, an as RequestEventOptions, at as stateScript, b as StateAttributes, bn as createSession, bt as RateLimit, c as Mark, cn as ServerErrorHandler, ct as streamState, d as NotReady, dn as dedupe, dt as IdempotentOptions, en as EntryMiddleware, et as setClientBundles, f as PageCache, fn as defineMiddleware, ft as idempotent, g as ResolvedView, gn as withEvent, gt as memoryStore, h as RequestOptions, hn as redirect, ht as cached, i as DeferTarget, in as RequestEvent, it as start, j as deferTarget, jt as IntentSubmission, k as clientBundles, kt as rateLimit, l as Memo, ln as ServerErrorInfo, lt as wait, m as RenderResult, mn as isRedirect, mt as CachedOptions, n as Component, nn as Redirect, nt as spacerTag, o as ItemSource, on as RequestKind, ot as stateValue, p as RenderOptions, pn as getEvent, pt as CacheStore, q as ready, qt as Middleware, r as Context, rn as RequestCall, rt as spread, s as Lazy, sn as ServerError, st as streamParts, t as ClientBundles, tn as Locals, tt as settled, u as NOTHING_PENDING, un as ServerErrorKind, ut as waitAll, v as RouteOptions, vn as Session, vt as setCacheStore, w as actionResult, wt as RateLimitOptions, x as StateMap, xn as parseCookies, xt as RateLimitConfig, y as ScopeEntry, yn as SessionOptions, yt as storageStore, z as keepPage, zt as ValidationIssue } from "../server-2-LS_KFo.js";
|
|
8
|
+
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, NOTHING_PENDING, 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, ResolvedView, 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, type TraceHandler, type TraceName, type TraceSpan, ValidationError, type ValidationIssue, type Window, action, actionResult, affix, attribute, binding, cached, caught, children, classAttribute, clientAddress, clientBundles, component, configureRateLimit, createContext, createSession, dedupe, deferTarget, defineMiddleware, dynamic, errorAnswer, escape, escapeAttribute, fieldErrors, gateValue, getEvent, handleRequest, handleRoute, idempotent, inlineBodies, insert, internal, isCrossSite, isRedirect, keepPage, keptPage, lazy, logError, matchRoute, memo, memoryStore, mergeAttributes, navigationContext, onAttribute, packState, pageKey, parse, parseCookies, parseForm, parseSubmission, produce, rateLimit, raw, read, ready, redirect, render, renderError, renderToStream, resolveView, respond, revalidate, routeContext, runAction, 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,7 +1,7 @@
|
|
|
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-BYuHDvxy.js";
|
|
2
2
|
import { a as serializeCookie, i as parseCookies, s as toNodeHeaders, t as createSession } from "../cookies-Cnbf4w-S.js";
|
|
3
|
-
import { C as unbind, a as FunctionReference, f as gateValue, i as ElementReference, w as useSerialEntry } from "../shared-
|
|
4
|
-
import { $ as
|
|
5
|
-
import { i as produce, n as searchParam } from "../search-params-
|
|
3
|
+
import { C as unbind, a as FunctionReference, f as gateValue, i as ElementReference, w as useSerialEntry } from "../shared-CUBWrbiM.js";
|
|
4
|
+
import { $ as fieldErrors, A as renderError, B as stateScript, C as logError, D as read, E as pageKey, F as setClientBundles, G as waitAll, H as streamParts, I as settled, J as clientAddress, K as idempotent, L as spacerTag, M as resolveView, N as respond, O as ready, P as runAction, Q as ValidationError, R as spread, S as lazy, T as packState, U as streamState, V as stateValue, W as wait, X as rateLimit, Y as configureRateLimit, Z as parseSubmission, _ as inlineBodies, a as actionResult, at as memoryStore, b as keepPage, c as caught, ct as storageStore, d as component, dt as dedupe, et as parse, f as deferTarget, ft as defineMiddleware, g as handleRoute, gt as withEvent, h as handleRequest, ht as redirect, i as action, it as cached, j as renderToStream, k as render, l as children, lt as RequestEvent, m as errorAnswer, mt as isRedirect, n as NOTHING_PENDING, nt as safeParse, o as attribute, ot as revalidate, p as dynamic, pt as getEvent, q as RateLimitError, r as NotReady, rt as matchRoute, s as binding, st as setCacheStore, t as Context, tt as parseForm, u as clientBundles, ut as ServerError, v as insert, w as memo, x as keptPage, y as isCrossSite, z as start } from "../server-CRGZMWnK.js";
|
|
5
|
+
import { i as produce, n as searchParam } from "../search-params-qGERTLi3.js";
|
|
6
6
|
import { a as navigationContext, o as routeContext, r as createContext } from "../context-CU4Fpn5a.js";
|
|
7
|
-
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 };
|
|
7
|
+
export { Context, ElementReference, FunctionReference, NOTHING_PENDING, NotReady, RateLimitError, RequestEvent, ServerError, ValidationError, action, actionResult, affix, attribute, binding, cached, caught, children, classAttribute, clientAddress, clientBundles, component, configureRateLimit, createContext, createSession, dedupe, deferTarget, defineMiddleware, dynamic, errorAnswer, escape, escapeAttribute, fieldErrors, gateValue, getEvent, handleRequest, handleRoute, idempotent, inlineBodies, insert, internal, isCrossSite, isRedirect, keepPage, keptPage, lazy, logError, matchRoute, memo, memoryStore, mergeAttributes, navigationContext, onAttribute, packState, pageKey, parse, parseCookies, parseForm, parseSubmission, produce, rateLimit, raw, read, ready, redirect, render, renderError, renderToStream, resolveView, respond, revalidate, routeContext, runAction, safeParse, searchParam, serializeCookie, setCacheStore, setClientBundles, settled, spacerTag, spread, start, stateScript, stateValue, storageStore, streamParts, streamState, toNodeHeaders, unbind, useSerialEntry, vars, wait, waitAll, withEvent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as BoundSignal, C as $store, D as $untrack, E as $toStore, F as flush, M as
|
|
2
|
-
export { $action, $bind, $client, $debounced, $effect, $gate, $getContext, $handler, $id, $isBound, $isPassed, $isPending, $memo, $navigation, $optimistic, $produce, $props, $resolve, $route, $searchParam, $setContext, $signal, $store, $throttled, $title, $toStore, $untrack, Bindable, BindableMark, BoundSignal, MemoValue, SearchParamOptions, Unbound, WritableMark, flush };
|
|
1
|
+
import { A as BoundSignal, C as $store, D as $untrack, E as $toStore, F as WritableMark, I as flush, M as MemoValue, N as SearchParamOptions, O as Bindable, P as Unbound, S as $signal, T as $title, _ as $props, a as $effect, b as $searchParam, c as $handler, d as $isPassed, f as $isPending, g as $produce, h as $optimistic, i as $debounced, j as Cleanup, k as BindableMark, l as $id, m as $navigation, n as $bind, o as $gate, p as $memo, r as $client, s as $getContext, t as $action, u as $isBound, v as $resolve, w as $throttled, x as $setContext, y as $route } from "../signals-BgsJK-uT.js";
|
|
2
|
+
export { $action, $bind, $client, $debounced, $effect, $gate, $getContext, $handler, $id, $isBound, $isPassed, $isPending, $memo, $navigation, $optimistic, $produce, $props, $resolve, $route, $searchParam, $setContext, $signal, $store, $throttled, $title, $toStore, $untrack, Bindable, BindableMark, BoundSignal, Cleanup, MemoValue, SearchParamOptions, Unbound, WritableMark, flush };
|
package/dist/runtime/signals.js
CHANGED
|
@@ -56,7 +56,10 @@ function $throttled(_value, _ms) {
|
|
|
56
56
|
function $optimistic(_source) {
|
|
57
57
|
return compileTimeOnly("$optimistic");
|
|
58
58
|
}
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Runs a callback when the values it reads change, after the page resumes. Never on load. An
|
|
61
|
+
* `async` callback runs one at a time, and its cleanup waits for the run to settle.
|
|
62
|
+
*/
|
|
60
63
|
function $effect(_callback) {
|
|
61
64
|
compileTimeOnly("$effect");
|
|
62
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signals.js","names":[],"sources":["../../src/runtime/signals.ts"],"sourcesContent":["// The compile-time functions of `.brm` files. The compiler replaces every\n// call and removes the import, so this module only gives them their types.\n// A call outside a `.brm` file throws.\n\nimport type { Context, NavigationState, Route } from './context.ts';\nimport type { RoutePath, RouteParams } from './routes.ts';\nimport type { Store, StoreLike } from './store.ts';\n\nfunction compileTimeOnly(name: string): never {\n throw new Error(`${name} works only in .brm files, which the brumate compiler compiles`);\n}\n\ndeclare const BINDABLE: unique symbol;\ndeclare const WRITES: unique symbol;\n\n/** The mark of a prop that a parent can bind. It has no value at runtime. */\nexport interface BindableMark<T> {\n readonly [BINDABLE]: T;\n}\n\n/**\n * What a binding writes. A binding of a signal of `T` takes a prop that writes `W` when `W` is\n * assignable to `T`, as a signal of `HTMLElement | undefined` takes the ref of a `div`.\n */\nexport interface WritableMark<W> {\n readonly [WRITES]: (value: W) => void;\n}\n\n/** What `$bind` returns: the mark of a prop, and the write side that checks the type of a ref. */\n// oxlint-disable-next-line typescript/no-empty-object-type, typescript/no-empty-interface -- An interface keeps its name in messages.\nexport interface BoundSignal<T> extends BindableMark<T>, WritableMark<T> {}\n\n/**\n * Marks a prop that a parent can bind with `$bind`, such as\n * `open?: Bindable<boolean>`. The parent passes `T` or `$bind(name)`.\n * Inside the component, `$props<T>()` gives `T`.\n */\nexport type Bindable<T> = T | BindableMark<T>;\n\n/** The props as the component reads them, with `Bindable<T>` as `T`. */\nexport type Unbound<T> = { [K in keyof T]: Exclude<T[K], BindableMark<unknown>> };\n\n/**\n * Returns the props of the component. Destructure the call to keep each prop\n * reactive. Destructure it with `let` to write props, such as\n * `let { open = false } = $props()`.\n */\n// oxlint-disable-next-line typescript/no-explicit-any -- Props are any object unless typed.\nexport function $props<T = Record<string, any>>(): Unbound<T> {\n return compileTimeOnly('$props');\n}\n\n/** Declares writable state. The variable reads and writes the signal. */\nexport function $signal<T>(value: T): T;\nexport function $signal<T>(): T | undefined;\nexport function $signal(): never {\n return compileTimeOnly('$signal');\n}\n\n/** The value of a memo: what a promise settles to, or the latest value of an async iterable. */\nexport type MemoValue<T> = Awaited<T> extends AsyncIterable<infer U> ? U : Awaited<T>;\n\n/**\n * Declares a value computed from other values. A promise is awaited where it\n * is read. An async iterable gives each of its values in turn.\n */\nexport function $memo<T>(_value: T): MemoValue<T> {\n return compileTimeOnly('$memo');\n}\n\n/**\n * Declares a memo that takes a new value only when the guard returns true.\n * Otherwise it keeps its value and its readers do not run. The first value\n * passes without the guard, and the server has no history, so it renders the\n * value. The guard runs in the browser, on changes only, with the value the\n * memo holds and the new one. A throw in the guard is held like a throw in\n * a memo. The value cannot be a promise.\n */\nexport function $gate<T>(_value: T, _guard: (prev: T, next: T) => boolean): T {\n return compileTimeOnly('$gate');\n}\n\n/**\n * Declares a memo that takes the value once it stops changing for `ms`\n * milliseconds, such as a search query while the user types. On the server,\n * and until the value first changes, it is the value.\n */\nexport function $debounced<T>(_value: T, _ms: number): MemoValue<T> {\n return compileTimeOnly('$debounced');\n}\n\n/**\n * Declares a memo that takes the value at most once every `ms`\n * milliseconds, and the last value after the wait, such as a position while\n * the pointer moves. On the server, and until the value first changes, it is the value.\n */\nexport function $throttled<T>(_value: T, _ms: number): MemoValue<T> {\n return compileTimeOnly('$throttled');\n}\n\n/**\n * Declares a value that follows a memo, and that handlers can write. A write\n * shows a guess, such as a new item while the form that adds it posts. The\n * value goes back to the memo when the memo changes, or when the server\n * calls of the page finish, such as after a failed post.\n */\nexport function $optimistic<T>(_source: T): T {\n return compileTimeOnly('$optimistic');\n}\n\n/** Runs a callback when the values it reads change, after the page resumes. Never on load. */\nexport function $effect(_callback: () => void | (() => void)): void {\n compileTimeOnly('$effect');\n}\n\n/** Runs a callback in the browser when a trigger fires. */\nexport function $client(\n _callback: () => void | (() => void),\n _trigger?: 'visible' | 'idle' | 'load',\n): void {\n compileTimeOnly('$client');\n}\n\n/** Reads a value without depending on it. */\nexport function $untrack<T>(_value: T): T {\n return compileTimeOnly('$untrack');\n}\n\n/** True while a new value of one of the memos, or of a memo one reads, loads on the client. Always false on the server. */\nexport function $isPending(..._memos: unknown[]): boolean {\n return compileTimeOnly('$isPending');\n}\n\n/**\n * Waits for a memo to have its value, and gives it. It resolves at once when the memo is settled,\n * and after the load when the memo loads its first value or loads again. When the inputs of the\n * memo change while it waits, it waits for the load of the current inputs. It rejects with the\n * error of the memo, when `timeout` milliseconds pass, or when `signal` aborts. Use it in a handler,\n * an effect or a `$client` callback, never where a memo computes or markup renders.\n */\nexport function $resolve<T>(\n _memo: T,\n _options?: { timeout?: number; signal?: AbortSignal },\n): Promise<Awaited<T>> {\n return compileTimeOnly('$resolve');\n}\n\n/**\n * True when the parent passed a prop with `$bind`, so a write of it reaches the parent. The prop is\n * one that the component destructures with `let`. Always false on the server, where nothing writes.\n */\nexport function $isBound(_prop: unknown): boolean {\n return compileTimeOnly('$isBound');\n}\n\n/**\n * True when the caller passed the prop, even as `undefined`. A part uses it to tell a controlled\n * value, such as `value=(null)`, from no value. Declare it with `const` in the component script.\n */\nexport function $isPassed(_prop: unknown): boolean {\n return compileTimeOnly('$isPassed');\n}\n\n/** Returns an ID that is unique in the page and the same on the server and the client. */\nexport function $id(): string {\n return compileTimeOnly('$id');\n}\n\n/** Provides a value of a context to the components inside this one. */\nexport function $setContext<T>(_context: Context<T>, _value: T): void {\n compileTimeOnly('$setContext');\n}\n\n/**\n * Reads a context from the nearest component above that provides it. Without a provider it throws,\n * or, with a second argument, gives `fallback`: `$getContext(Field, undefined)` is a read that may\n * have no provider. A fallback that is not a literal runs only when no provider is above, once per\n * read.\n */\nexport function $getContext<T>(_context: Context<T>): T;\nexport function $getContext<T, F>(_context: Context<T>, _fallback: F): T | F;\nexport function $getContext<T, F>(_context: Context<T>, _fallback?: F): T | F {\n return compileTimeOnly('$getContext');\n}\n\n/**\n * Binds a store to a variable. The store is any value with the functions `get`, `subscribe`\n * (which returns a function that stops it) and, optionally, `set`. The source gives a store:\n * `$store(field.state)` for `const field = $getContext(FieldContext)`,\n * `$store($getContext(FieldContext))` for a context that holds a store, an import, a prop, a local\n * `store(0)` or a call. A source that gives no store throws a `TypeError`. For a context that may\n * have no provider, guard on its value, `const s = field ? $store(field.state) : undefined` with\n * `const field = $getContext(FieldContext, undefined)`, or give a store as the fallback,\n * `$store($getContext(LocaleContext, store('en-US')))`. It runs once and is not tracked, and the\n * subscription ends with the scope. On resume the browser keeps the value that the server\n * rendered, runs the source again when it is not a context, and writes the variable once if the\n * store's value differs.\n *\n * `const x = $store(source)` is one-way: the store writes the variable. `let x = $store(source)`\n * is two-way: a write to the variable, such as `x = next` or `x++`, calls `set` of the store, and\n * a store without `set` throws a `TypeError` when the variable registers.\n */\nexport function $store<T>(_source: StoreLike<T>): T {\n return compileTimeOnly('$store');\n}\n\n/**\n * The store of a memo, a signal or a prop, for a value of `$setContext`. It adds no reactive\n * value: the provider's update writes it. A store of a signal has a `set` that writes the\n * signal; a store of a memo or a prop is read-only.\n */\nexport function $toStore<T>(_value: T): Store<T> {\n return compileTimeOnly('$toStore');\n}\n\n/**\n * The route of the page: its URL, its query string and its params, typed\n * from the route files as `href` is. The server reads the request, and the\n * browser reads `location`. It changes when navigation changes the URL.\n */\nexport function $route<P extends RoutePath = RoutePath>(_path?: P): Route<RouteParams<P>> {\n return compileTimeOnly('$route');\n}\n\n/** The options of `$searchParam`. */\nexport interface SearchParamOptions<T> {\n /** The value while the parameter is not in the URL. A write of this value leaves the parameter out. */\n default?: T;\n /** Converts the text of the parameter to a value. Defaults to the text. */\n parse?: (text: string) => T;\n /** Converts a value to the text of the parameter. Defaults to `String`. */\n serialize?: (value: T) => string;\n /** `'push'` adds an entry to the history for each change, and `'replace'` (the default) changes the entry. */\n history?: 'push' | 'replace';\n /** True asks the server for the page again when the parameter changes, as a link to the new URL does. */\n server?: boolean;\n}\n\n/**\n * A signal bound to one parameter of the query string. The server reads the URL of the request.\n * A write in the browser changes the URL with `history.replaceState`, or `pushState` with\n * `{ history: 'push' }`, and asks the server nothing. Back and forward write the signal.\n */\nexport function $searchParam(name: string, options?: SearchParamOptions<string>): string | null;\nexport function $searchParam<T>(name: string, options: SearchParamOptions<T> & { default: T }): T;\nexport function $searchParam<T>(\n name: string,\n options: SearchParamOptions<T> & { parse: (text: string) => T },\n): T | null;\nexport function $searchParam(): never {\n return compileTimeOnly('$searchParam');\n}\n\n/** The navigation that loads, with `pending` false when none does. Always `{ pending: false }` on the server. */\nexport function $navigation(): NavigationState {\n return compileTimeOnly('$navigation');\n}\n\n/** Changes an object or an array in a signal through a draft, and writes the signal with the result. */\nexport function $produce<T>(_signal: T, _recipe: (draft: T) => T | void): void {\n compileTimeOnly('$produce');\n}\n\n/** Sets the title of the page. The last component that sets it wins. */\nexport function $title(_value: unknown): void {\n compileTimeOnly('$title');\n}\n\n/**\n * The latest result of a server function that a form of this component posts\n * to, or undefined before the first post. Pending while the form sends.\n */\nexport function $action<F extends (...args: never[]) => unknown>(\n _fn: F,\n): Awaited<ReturnType<F>> | undefined {\n return compileTimeOnly('$action');\n}\n\n/**\n * Passes a child a signal, or a prop that the component writes, so a write\n * of the prop in the child writes it. The child destructures the prop with\n * `let`. Pass it as the value of a prop: `<Dialog open=$bind(open) />`.\n *\n * - Only a prop of type `Bindable<T>` takes it.\n * - With `set`, a write calls `set(next)` in place of writing the signal.\n */\nexport function $bind<T>(signal: T, set?: (next: T) => unknown): BoundSignal<T>;\nexport function $bind(): never {\n return compileTimeOnly('$bind');\n}\n\n/**\n * Marks a function that a script makes as an event handler, so a spread can\n * pass it on, as it passes on a handler that a caller writes in markup.\n * `args` are JSON values that go with the handler, and it runs as\n * `fn(...args, event)`.\n */\nexport function $handler<A extends unknown[], E = Event>(\n fn: (...args: [...A, E]) => unknown,\n ...args: A\n): (event: E) => unknown;\n/** A function that does not read the event. */\nexport function $handler<A extends unknown[]>(\n fn: (...args: A) => unknown,\n ...args: A\n): (event: Event) => unknown;\nexport function $handler(): never {\n return compileTimeOnly('$handler');\n}\n\n/**\n * Writes what the writes of the handler so far changed to the page, so the code after it can read\n * the DOM, such as to focus or measure what a write rendered. A handler is one pass, and the page\n * changes when it returns. Does nothing outside a handler, and on the server.\n */\nexport function flush(): void {\n (globalThis as { [key: symbol]: (() => void) | undefined })[Symbol.for('brumate.flush')]?.();\n}\n"],"mappings":";AAQA,SAAS,gBAAgB,MAAqB;CAC5C,MAAM,IAAI,MAAM,GAAG,KAAK,+DAA+D;AACzF;;;;;;AAsCA,SAAgB,SAA8C;CAC5D,OAAO,gBAAgB,QAAQ;AACjC;AAKA,SAAgB,UAAiB;CAC/B,OAAO,gBAAgB,SAAS;AAClC;;;;;AASA,SAAgB,MAAS,QAAyB;CAChD,OAAO,gBAAgB,OAAO;AAChC;;;;;;;;;AAUA,SAAgB,MAAS,QAAW,QAA0C;CAC5E,OAAO,gBAAgB,OAAO;AAChC;;;;;;AAOA,SAAgB,WAAc,QAAW,KAA2B;CAClE,OAAO,gBAAgB,YAAY;AACrC;;;;;;AAOA,SAAgB,WAAc,QAAW,KAA2B;CAClE,OAAO,gBAAgB,YAAY;AACrC;;;;;;;AAQA,SAAgB,YAAe,SAAe;CAC5C,OAAO,gBAAgB,aAAa;AACtC;;AAGA,SAAgB,QAAQ,WAA4C;CAClE,gBAAgB,SAAS;AAC3B;;AAGA,SAAgB,QACd,WACA,UACM;CACN,gBAAgB,SAAS;AAC3B;;AAGA,SAAgB,SAAY,QAAc;CACxC,OAAO,gBAAgB,UAAU;AACnC;;AAGA,SAAgB,WAAW,GAAG,QAA4B;CACxD,OAAO,gBAAgB,YAAY;AACrC;;;;;;;;AASA,SAAgB,SACd,OACA,UACqB;CACrB,OAAO,gBAAgB,UAAU;AACnC;;;;;AAMA,SAAgB,SAAS,OAAyB;CAChD,OAAO,gBAAgB,UAAU;AACnC;;;;;AAMA,SAAgB,UAAU,OAAyB;CACjD,OAAO,gBAAgB,WAAW;AACpC;;AAGA,SAAgB,MAAc;CAC5B,OAAO,gBAAgB,KAAK;AAC9B;;AAGA,SAAgB,YAAe,UAAsB,QAAiB;CACpE,gBAAgB,aAAa;AAC/B;AAUA,SAAgB,YAAkB,UAAsB,WAAsB;CAC5E,OAAO,gBAAgB,aAAa;AACtC;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,OAAU,SAA0B;CAClD,OAAO,gBAAgB,QAAQ;AACjC;;;;;;AAOA,SAAgB,SAAY,QAAqB;CAC/C,OAAO,gBAAgB,UAAU;AACnC;;;;;;AAOA,SAAgB,OAAwC,OAAkC;CACxF,OAAO,gBAAgB,QAAQ;AACjC;AA2BA,SAAgB,eAAsB;CACpC,OAAO,gBAAgB,cAAc;AACvC;;AAGA,SAAgB,cAA+B;CAC7C,OAAO,gBAAgB,aAAa;AACtC;;AAGA,SAAgB,SAAY,SAAY,SAAuC;CAC7E,gBAAgB,UAAU;AAC5B;;AAGA,SAAgB,OAAO,QAAuB;CAC5C,gBAAgB,QAAQ;AAC1B;;;;;AAMA,SAAgB,QACd,KACoC;CACpC,OAAO,gBAAgB,SAAS;AAClC;AAWA,SAAgB,QAAe;CAC7B,OAAO,gBAAgB,OAAO;AAChC;AAiBA,SAAgB,WAAkB;CAChC,OAAO,gBAAgB,UAAU;AACnC;;;;;;AAOA,SAAgB,QAAc;CAC5B,WAA4D,OAAO,IAAI,eAAe,EAAE,GAAG;AAC7F"}
|
|
1
|
+
{"version":3,"file":"signals.js","names":[],"sources":["../../src/runtime/signals.ts"],"sourcesContent":["// The compile-time functions of `.brm` files. The compiler replaces every\n// call and removes the import, so this module only gives them their types.\n// A call outside a `.brm` file throws.\n\nimport type { Context, NavigationState, Route } from './context.ts';\nimport type { RoutePath, RouteParams } from './routes.ts';\nimport type { Store, StoreLike } from './store.ts';\n\nfunction compileTimeOnly(name: string): never {\n throw new Error(`${name} works only in .brm files, which the brumate compiler compiles`);\n}\n\ndeclare const BINDABLE: unique symbol;\ndeclare const WRITES: unique symbol;\n\n/** The mark of a prop that a parent can bind. It has no value at runtime. */\nexport interface BindableMark<T> {\n readonly [BINDABLE]: T;\n}\n\n/**\n * What a binding writes. A binding of a signal of `T` takes a prop that writes `W` when `W` is\n * assignable to `T`, as a signal of `HTMLElement | undefined` takes the ref of a `div`.\n */\nexport interface WritableMark<W> {\n readonly [WRITES]: (value: W) => void;\n}\n\n/** What `$bind` returns: the mark of a prop, and the write side that checks the type of a ref. */\n// oxlint-disable-next-line typescript/no-empty-object-type, typescript/no-empty-interface -- An interface keeps its name in messages.\nexport interface BoundSignal<T> extends BindableMark<T>, WritableMark<T> {}\n\n/**\n * Marks a prop that a parent can bind with `$bind`, such as\n * `open?: Bindable<boolean>`. The parent passes `T` or `$bind(name)`.\n * Inside the component, `$props<T>()` gives `T`.\n */\nexport type Bindable<T> = T | BindableMark<T>;\n\n/** The props as the component reads them, with `Bindable<T>` as `T`. */\nexport type Unbound<T> = { [K in keyof T]: Exclude<T[K], BindableMark<unknown>> };\n\n/**\n * Returns the props of the component. Destructure the call to keep each prop\n * reactive. Destructure it with `let` to write props, such as\n * `let { open = false } = $props()`.\n */\n// oxlint-disable-next-line typescript/no-explicit-any -- Props are any object unless typed.\nexport function $props<T = Record<string, any>>(): Unbound<T> {\n return compileTimeOnly('$props');\n}\n\n/** Declares writable state. The variable reads and writes the signal. */\nexport function $signal<T>(value: T): T;\nexport function $signal<T>(): T | undefined;\nexport function $signal(): never {\n return compileTimeOnly('$signal');\n}\n\n/** The value of a memo: what a promise settles to, or the latest value of an async iterable. */\nexport type MemoValue<T> = Awaited<T> extends AsyncIterable<infer U> ? U : Awaited<T>;\n\n/**\n * Declares a value computed from other values. A promise is awaited where it\n * is read. An async iterable gives each of its values in turn.\n */\nexport function $memo<T>(_value: T): MemoValue<T> {\n return compileTimeOnly('$memo');\n}\n\n/**\n * Declares a memo that takes a new value only when the guard returns true.\n * Otherwise it keeps its value and its readers do not run. The first value\n * passes without the guard, and the server has no history, so it renders the\n * value. The guard runs in the browser, on changes only, with the value the\n * memo holds and the new one. A throw in the guard is held like a throw in\n * a memo. The value cannot be a promise.\n */\nexport function $gate<T>(_value: T, _guard: (prev: T, next: T) => boolean): T {\n return compileTimeOnly('$gate');\n}\n\n/**\n * Declares a memo that takes the value once it stops changing for `ms`\n * milliseconds, such as a search query while the user types. On the server,\n * and until the value first changes, it is the value.\n */\nexport function $debounced<T>(_value: T, _ms: number): MemoValue<T> {\n return compileTimeOnly('$debounced');\n}\n\n/**\n * Declares a memo that takes the value at most once every `ms`\n * milliseconds, and the last value after the wait, such as a position while\n * the pointer moves. On the server, and until the value first changes, it is the value.\n */\nexport function $throttled<T>(_value: T, _ms: number): MemoValue<T> {\n return compileTimeOnly('$throttled');\n}\n\n/**\n * Declares a value that follows a memo, and that handlers can write. A write\n * shows a guess, such as a new item while the form that adds it posts. The\n * value goes back to the memo when the memo changes, or when the server\n * calls of the page finish, such as after a failed post.\n */\nexport function $optimistic<T>(_source: T): T {\n return compileTimeOnly('$optimistic');\n}\n\n/**\n * What a callback of `$effect` or `$client` can return to clean up its run: a function, an async\n * function, or an object with `[Symbol.dispose]` or `[Symbol.asyncDispose]`. The type says `object`\n * for the disposables, since `Disposable` is in `esnext.disposable`, which a project may not have in\n * its `lib`.\n */\nexport type Cleanup = (() => void | Promise<void>) | object;\n\n/**\n * Runs a callback when the values it reads change, after the page resumes. Never on load. An\n * `async` callback runs one at a time, and its cleanup waits for the run to settle.\n */\nexport function $effect(_callback: () => void | Cleanup | Promise<void | Cleanup>): void {\n compileTimeOnly('$effect');\n}\n\n/** Runs a callback in the browser when a trigger fires. */\nexport function $client(\n _callback: () => void | Cleanup | Promise<void | Cleanup>,\n _trigger?: 'visible' | 'idle' | 'load',\n): void {\n compileTimeOnly('$client');\n}\n\n/** Reads a value without depending on it. */\nexport function $untrack<T>(_value: T): T {\n return compileTimeOnly('$untrack');\n}\n\n/** True while a new value of one of the memos, or of a memo one reads, loads on the client. Always false on the server. */\nexport function $isPending(..._memos: unknown[]): boolean {\n return compileTimeOnly('$isPending');\n}\n\n/**\n * Waits for a memo to have its value, and gives it. It resolves at once when the memo is settled,\n * and after the load when the memo loads its first value or loads again. When the inputs of the\n * memo change while it waits, it waits for the load of the current inputs. It rejects with the\n * error of the memo, when `timeout` milliseconds pass, or when `signal` aborts. Use it in a handler,\n * an effect or a `$client` callback, never where a memo computes or markup renders.\n */\nexport function $resolve<T>(\n _memo: T,\n _options?: { timeout?: number; signal?: AbortSignal },\n): Promise<Awaited<T>> {\n return compileTimeOnly('$resolve');\n}\n\n/**\n * True when the parent passed a prop with `$bind`, so a write of it reaches the parent. The prop is\n * one that the component destructures with `let`. Always false on the server, where nothing writes.\n */\nexport function $isBound(_prop: unknown): boolean {\n return compileTimeOnly('$isBound');\n}\n\n/**\n * True when the caller passed the prop, even as `undefined`. A part uses it to tell a controlled\n * value, such as `value=(null)`, from no value. Declare it with `const` in the component script.\n */\nexport function $isPassed(_prop: unknown): boolean {\n return compileTimeOnly('$isPassed');\n}\n\n/** Returns an ID that is unique in the page and the same on the server and the client. */\nexport function $id(): string {\n return compileTimeOnly('$id');\n}\n\n/** Provides a value of a context to the components inside this one. */\nexport function $setContext<T>(_context: Context<T>, _value: T): void {\n compileTimeOnly('$setContext');\n}\n\n/**\n * Reads a context from the nearest component above that provides it. Without a provider it throws,\n * or, with a second argument, gives `fallback`: `$getContext(Field, undefined)` is a read that may\n * have no provider. A fallback that is not a literal runs only when no provider is above, once per\n * read.\n */\nexport function $getContext<T>(_context: Context<T>): T;\nexport function $getContext<T, F>(_context: Context<T>, _fallback: F): T | F;\nexport function $getContext<T, F>(_context: Context<T>, _fallback?: F): T | F {\n return compileTimeOnly('$getContext');\n}\n\n/**\n * Binds a store to a variable. The store is any value with the functions `get`, `subscribe`\n * (which returns a function that stops it) and, optionally, `set`. The source gives a store:\n * `$store(field.state)` for `const field = $getContext(FieldContext)`,\n * `$store($getContext(FieldContext))` for a context that holds a store, an import, a prop, a local\n * `store(0)` or a call. A source that gives no store throws a `TypeError`. For a context that may\n * have no provider, guard on its value, `const s = field ? $store(field.state) : undefined` with\n * `const field = $getContext(FieldContext, undefined)`, or give a store as the fallback,\n * `$store($getContext(LocaleContext, store('en-US')))`. It runs once and is not tracked, and the\n * subscription ends with the scope. On resume the browser keeps the value that the server\n * rendered, runs the source again when it is not a context, and writes the variable once if the\n * store's value differs.\n *\n * `const x = $store(source)` is one-way: the store writes the variable. `let x = $store(source)`\n * is two-way: a write to the variable, such as `x = next` or `x++`, calls `set` of the store, and\n * a store without `set` throws a `TypeError` when the variable registers.\n */\nexport function $store<T>(_source: StoreLike<T>): T {\n return compileTimeOnly('$store');\n}\n\n/**\n * The store of a memo, a signal or a prop, for a value of `$setContext`. It adds no reactive\n * value: the provider's update writes it. A store of a signal has a `set` that writes the\n * signal; a store of a memo or a prop is read-only.\n */\nexport function $toStore<T>(_value: T): Store<T> {\n return compileTimeOnly('$toStore');\n}\n\n/**\n * The route of the page: its URL, its query string and its params, typed\n * from the route files as `href` is. The server reads the request, and the\n * browser reads `location`. It changes when navigation changes the URL.\n */\nexport function $route<P extends RoutePath = RoutePath>(_path?: P): Route<RouteParams<P>> {\n return compileTimeOnly('$route');\n}\n\n/** The options of `$searchParam`. */\nexport interface SearchParamOptions<T> {\n /** The value while the parameter is not in the URL. A write of this value leaves the parameter out. */\n default?: T;\n /** Converts the text of the parameter to a value. Defaults to the text. */\n parse?: (text: string) => T;\n /** Converts a value to the text of the parameter. Defaults to `String`. */\n serialize?: (value: T) => string;\n /** `'push'` adds an entry to the history for each change, and `'replace'` (the default) changes the entry. */\n history?: 'push' | 'replace';\n /** True asks the server for the page again when the parameter changes, as a link to the new URL does. */\n server?: boolean;\n}\n\n/**\n * A signal bound to one parameter of the query string. The server reads the URL of the request.\n * A write in the browser changes the URL with `history.replaceState`, or `pushState` with\n * `{ history: 'push' }`, and asks the server nothing. Back and forward write the signal.\n */\nexport function $searchParam(name: string, options?: SearchParamOptions<string>): string | null;\nexport function $searchParam<T>(name: string, options: SearchParamOptions<T> & { default: T }): T;\nexport function $searchParam<T>(\n name: string,\n options: SearchParamOptions<T> & { parse: (text: string) => T },\n): T | null;\nexport function $searchParam(): never {\n return compileTimeOnly('$searchParam');\n}\n\n/** The navigation that loads, with `pending` false when none does. Always `{ pending: false }` on the server. */\nexport function $navigation(): NavigationState {\n return compileTimeOnly('$navigation');\n}\n\n/** Changes an object or an array in a signal through a draft, and writes the signal with the result. */\nexport function $produce<T>(_signal: T, _recipe: (draft: T) => T | void): void {\n compileTimeOnly('$produce');\n}\n\n/** Sets the title of the page. The last component that sets it wins. */\nexport function $title(_value: unknown): void {\n compileTimeOnly('$title');\n}\n\n/**\n * The latest result of a server function that a form of this component posts\n * to, or undefined before the first post. Pending while the form sends.\n */\nexport function $action<F extends (...args: never[]) => unknown>(\n _fn: F,\n): Awaited<ReturnType<F>> | undefined {\n return compileTimeOnly('$action');\n}\n\n/**\n * Passes a child a signal, or a prop that the component writes, so a write\n * of the prop in the child writes it. The child destructures the prop with\n * `let`. Pass it as the value of a prop: `<Dialog open=$bind(open) />`.\n *\n * - Only a prop of type `Bindable<T>` takes it.\n * - With `set`, a write calls `set(next)` in place of writing the signal.\n */\nexport function $bind<T>(signal: T, set?: (next: T) => unknown): BoundSignal<T>;\nexport function $bind(): never {\n return compileTimeOnly('$bind');\n}\n\n/**\n * Marks a function that a script makes as an event handler, so a spread can\n * pass it on, as it passes on a handler that a caller writes in markup.\n * `args` are JSON values that go with the handler, and it runs as\n * `fn(...args, event)`.\n */\nexport function $handler<A extends unknown[], E = Event>(\n fn: (...args: [...A, E]) => unknown,\n ...args: A\n): (event: E) => unknown;\n/** A function that does not read the event. */\nexport function $handler<A extends unknown[]>(\n fn: (...args: A) => unknown,\n ...args: A\n): (event: Event) => unknown;\nexport function $handler(): never {\n return compileTimeOnly('$handler');\n}\n\n/**\n * Writes what the writes of the handler so far changed to the page, so the code after it can read\n * the DOM, such as to focus or measure what a write rendered. A handler is one pass, and the page\n * changes when it returns. Does nothing outside a handler, and on the server.\n */\nexport function flush(): void {\n (globalThis as { [key: symbol]: (() => void) | undefined })[Symbol.for('brumate.flush')]?.();\n}\n"],"mappings":";AAQA,SAAS,gBAAgB,MAAqB;CAC5C,MAAM,IAAI,MAAM,GAAG,KAAK,+DAA+D;AACzF;;;;;;AAsCA,SAAgB,SAA8C;CAC5D,OAAO,gBAAgB,QAAQ;AACjC;AAKA,SAAgB,UAAiB;CAC/B,OAAO,gBAAgB,SAAS;AAClC;;;;;AASA,SAAgB,MAAS,QAAyB;CAChD,OAAO,gBAAgB,OAAO;AAChC;;;;;;;;;AAUA,SAAgB,MAAS,QAAW,QAA0C;CAC5E,OAAO,gBAAgB,OAAO;AAChC;;;;;;AAOA,SAAgB,WAAc,QAAW,KAA2B;CAClE,OAAO,gBAAgB,YAAY;AACrC;;;;;;AAOA,SAAgB,WAAc,QAAW,KAA2B;CAClE,OAAO,gBAAgB,YAAY;AACrC;;;;;;;AAQA,SAAgB,YAAe,SAAe;CAC5C,OAAO,gBAAgB,aAAa;AACtC;;;;;AAcA,SAAgB,QAAQ,WAAiE;CACvF,gBAAgB,SAAS;AAC3B;;AAGA,SAAgB,QACd,WACA,UACM;CACN,gBAAgB,SAAS;AAC3B;;AAGA,SAAgB,SAAY,QAAc;CACxC,OAAO,gBAAgB,UAAU;AACnC;;AAGA,SAAgB,WAAW,GAAG,QAA4B;CACxD,OAAO,gBAAgB,YAAY;AACrC;;;;;;;;AASA,SAAgB,SACd,OACA,UACqB;CACrB,OAAO,gBAAgB,UAAU;AACnC;;;;;AAMA,SAAgB,SAAS,OAAyB;CAChD,OAAO,gBAAgB,UAAU;AACnC;;;;;AAMA,SAAgB,UAAU,OAAyB;CACjD,OAAO,gBAAgB,WAAW;AACpC;;AAGA,SAAgB,MAAc;CAC5B,OAAO,gBAAgB,KAAK;AAC9B;;AAGA,SAAgB,YAAe,UAAsB,QAAiB;CACpE,gBAAgB,aAAa;AAC/B;AAUA,SAAgB,YAAkB,UAAsB,WAAsB;CAC5E,OAAO,gBAAgB,aAAa;AACtC;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,OAAU,SAA0B;CAClD,OAAO,gBAAgB,QAAQ;AACjC;;;;;;AAOA,SAAgB,SAAY,QAAqB;CAC/C,OAAO,gBAAgB,UAAU;AACnC;;;;;;AAOA,SAAgB,OAAwC,OAAkC;CACxF,OAAO,gBAAgB,QAAQ;AACjC;AA2BA,SAAgB,eAAsB;CACpC,OAAO,gBAAgB,cAAc;AACvC;;AAGA,SAAgB,cAA+B;CAC7C,OAAO,gBAAgB,aAAa;AACtC;;AAGA,SAAgB,SAAY,SAAY,SAAuC;CAC7E,gBAAgB,UAAU;AAC5B;;AAGA,SAAgB,OAAO,QAAuB;CAC5C,gBAAgB,QAAQ;AAC1B;;;;;AAMA,SAAgB,QACd,KACoC;CACpC,OAAO,gBAAgB,SAAS;AAClC;AAWA,SAAgB,QAAe;CAC7B,OAAO,gBAAgB,OAAO;AAChC;AAiBA,SAAgB,WAAkB;CAChC,OAAO,gBAAgB,UAAU;AACnC;;;;;;AAOA,SAAgB,QAAc;CAC5B,WAA4D,OAAO,IAAI,eAAe,EAAE,GAAG;AAC7F"}
|
|
@@ -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-ej-9NRT3.js";
|
|
2
|
+
import { t as startWithoutNavigation } from "../static-loader-CAFn6p0l.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-BDBtWsdg.js";
|
package/dist/runtime/store.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as setBridgeLoader, S as
|
|
2
|
-
export { Bridge, BridgeOptions, Bridged, BridgedStore, Store, StoreLike, StoreOrigin, Stores, StoresValues, bridge, canSet, derived, findStored, isBridged, isContext, isContract, isForeignStore, isStore, nameBridge, sameData, sendStore, sentForeignStore, setBridgeLoader, store };
|
|
1
|
+
import { A as sameData, C as isContract, D as nameBridge, E as memoStore, M as sentForeignStore, N as setBridgeLoader, O as onServer, P as store, S as isContext, T as isStore, _ as bridge, a as HOLDS, b as findStored, c as MemoStore, d as Store, f as StoreLike, g as Waiting, h as StoresValues, i as BridgedStore, j as sendStore, k as pendingOf, l as PENDING, m as Stores, n as BridgeOptions, o as MemoFace, p as StoreOrigin, r as Bridged, s as MemoOptions, t as Bridge, u as Pendable, v as canSet, w as isForeignStore, x as isBridged, y as derived } from "../store-BwWg-Iei.js";
|
|
2
|
+
export { Bridge, BridgeOptions, Bridged, BridgedStore, HOLDS, MemoFace, MemoOptions, MemoStore, PENDING, Pendable, Store, StoreLike, StoreOrigin, Stores, StoresValues, Waiting, bridge, canSet, derived, findStored, isBridged, isContext, isContract, isForeignStore, isStore, memoStore, nameBridge, onServer, pendingOf, sameData, sendStore, sentForeignStore, setBridgeLoader, store };
|
package/dist/runtime/store.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Bridged, n as
|
|
1
|
+
export { t as Bridged, n as HOLDS, r as PENDING, i as Store, a as Waiting, o as bridge, s as canSet, c as derived, l as findStored, u as isBridged, d as isContext, f as isContract, p as isForeignStore, m as isStore, h as memoStore, g as nameBridge, _ as onServer, v as pendingOf, y as sameData, b as sendStore, x as sentForeignStore, S as setBridgeLoader, C as store } from "../store-DNr24Z8L.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Xt as ClientModule } from "../client-Do6IBIhI.js";
|
|
2
|
+
import { cn as ServerErrorHandler, en as EntryMiddleware, n as Component, p as RenderOptions } from "../server-2-LS_KFo.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 {
|
|
2
|
-
import { t as start } from "../loader-
|
|
1
|
+
import { h as handleRequest, k as render } from "../server-CRGZMWnK.js";
|
|
2
|
+
import { t as start } from "../loader-DMxuZ6He.js";
|
|
3
3
|
//#region src/runtime/nodes.ts
|
|
4
4
|
const VOID = /* @__PURE__ */ new Set([
|
|
5
5
|
"area",
|