brumate 0.1.1 → 0.3.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-DN1ZU8Hg.d.ts → boot-C25Sa6vq.d.ts} +27 -2
- package/dist/cli.js +2 -2
- package/dist/client-BD6XT-s5.js +1968 -0
- package/dist/client-BD6XT-s5.js.map +1 -0
- package/dist/{client-DwJInP_a.d.ts → client-D0CqSxoO.d.ts} +211 -30
- package/dist/{client-routes-DakuM32C.js → client-routes-JTbGtukf.js} +28 -15
- package/dist/client-routes-JTbGtukf.js.map +1 -0
- package/dist/context-CTiSzQRc.js +27 -0
- package/dist/context-CTiSzQRc.js.map +1 -0
- package/dist/context-btHuB01Z.d.ts +42 -0
- package/dist/{cookies-Av5WFmcf.js → cookies-BzllthiF.js} +2 -1
- package/dist/cookies-BzllthiF.js.map +1 -0
- package/dist/defer-BbD7JQhj.js +56 -0
- package/dist/defer-BbD7JQhj.js.map +1 -0
- package/dist/devtools-CQgD7NPB.js +623 -0
- package/dist/devtools-CQgD7NPB.js.map +1 -0
- package/dist/devtools-panel-BVB-W5q4.js +1930 -0
- package/dist/devtools-panel-BVB-W5q4.js.map +1 -0
- package/dist/events-CSs7OwIC.js +85 -0
- package/dist/events-CSs7OwIC.js.map +1 -0
- package/dist/{files-DdT84mPy.js → files-BXSSrQgc.js} +34 -6
- package/dist/files-BXSSrQgc.js.map +1 -0
- package/dist/forms-Bg-CwGqX.js +406 -0
- package/dist/forms-Bg-CwGqX.js.map +1 -0
- package/dist/forms-Cl21hkHt.d.ts +281 -0
- package/dist/highlight.d.ts +17 -0
- package/dist/highlight.js +269 -0
- package/dist/highlight.js.map +1 -0
- package/dist/html-Bq1rFxX_.d.ts +92 -0
- package/dist/html-mNTKzaDD.js +241 -0
- package/dist/html-mNTKzaDD.js.map +1 -0
- package/dist/index.d.ts +123 -30
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/{inspect-BPchdWbU.js → inspect-BHpOw1LF.js} +1400 -121
- package/dist/inspect-BHpOw1LF.js.map +1 -0
- package/dist/{loader-Dc9OwY5I.js → loader-Dos_3NP0.js} +47 -11
- package/dist/loader-Dos_3NP0.js.map +1 -0
- package/dist/{navigate-CzLjnoPH.js → navigate-O78d_zGN.js} +115 -13
- package/dist/navigate-O78d_zGN.js.map +1 -0
- package/dist/produce-D0V0ICkz.d.ts +114 -0
- package/dist/produce-Doc91GkX.js +274 -0
- package/dist/produce-Doc91GkX.js.map +1 -0
- package/dist/routes-BZNt7DSZ.d.ts +38 -0
- package/dist/{rpc-9fSqL_YK.js → rpc-ygMRPmN4.js} +39 -23
- package/dist/rpc-ygMRPmN4.js.map +1 -0
- package/dist/runtime/batch.d.ts +23 -0
- package/dist/runtime/batch.js +69 -0
- package/dist/runtime/batch.js.map +1 -0
- package/dist/runtime/client.d.ts +5 -5
- package/dist/runtime/client.js +5 -1345
- package/dist/runtime/context.d.ts +2 -2
- package/dist/runtime/context.js +1 -1
- package/dist/runtime/devtools.d.ts +191 -5
- package/dist/runtime/devtools.js +1 -1
- package/dist/runtime/env.d.ts +44 -0
- package/dist/runtime/env.js +61 -0
- package/dist/runtime/env.js.map +1 -0
- package/dist/runtime/events.d.ts +42 -0
- package/dist/runtime/events.js +1 -0
- package/dist/runtime/forms.d.ts +2 -0
- package/dist/runtime/forms.js +1 -0
- package/dist/runtime/gather.d.ts +25 -0
- package/dist/runtime/gather.js +33 -0
- package/dist/runtime/gather.js.map +1 -0
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/html.d.ts +2 -2
- 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/routes.d.ts +2 -21
- package/dist/runtime/routes.js +31 -1
- package/dist/runtime/routes.js.map +1 -1
- package/dist/runtime/server.d.ts +7 -5
- package/dist/runtime/server.js +6 -7
- package/dist/runtime/signals.d.ts +60 -3
- package/dist/runtime/signals.js +40 -2
- 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/testing.d.ts +46 -5
- package/dist/runtime/testing.js +240 -33
- package/dist/runtime/testing.js.map +1 -1
- package/dist/runtime/values.d.ts +2 -0
- package/dist/runtime/values.js +24 -0
- package/dist/runtime/values.js.map +1 -0
- package/dist/secrets-BxagsJxJ.js +23 -0
- package/dist/secrets-BxagsJxJ.js.map +1 -0
- package/dist/server-CxVDYE_V.js +3417 -0
- package/dist/server-CxVDYE_V.js.map +1 -0
- package/dist/server-DuFYRXrd.d.ts +1460 -0
- package/dist/skew-FRmAy9iy.js +49 -0
- package/dist/skew-FRmAy9iy.js.map +1 -0
- package/dist/standard-schema-BNY82yX3.d.ts +63 -0
- package/dist/{static-loader-BcFh4ebX.d.ts → static-loader-Drpr0AzI.d.ts} +2 -2
- package/dist/static-loader-nZssh66R.js +333 -0
- package/dist/static-loader-nZssh66R.js.map +1 -0
- package/dist/stream-DCYZO4IF.js +424 -0
- package/dist/stream-DCYZO4IF.js.map +1 -0
- package/dist/values-B8C7CLvG.d.ts +63 -0
- package/dist/vite.d.ts +49 -1
- package/dist/vite.js +598 -68
- package/dist/vite.js.map +1 -1
- package/forms/forms.brm.ts +141 -0
- package/package.json +45 -3
- package/types.d.ts +9 -1
- package/dist/client-routes-DakuM32C.js.map +0 -1
- package/dist/context-BG8KCF3v.js +0 -15
- package/dist/context-BG8KCF3v.js.map +0 -1
- package/dist/context-aeo9esY9.d.ts +0 -16
- package/dist/cookies-Av5WFmcf.js.map +0 -1
- package/dist/devtools-BKjnHrnv.js +0 -113
- package/dist/devtools-BKjnHrnv.js.map +0 -1
- package/dist/devtools-panel-AWOn0VK2.js +0 -434
- package/dist/devtools-panel-AWOn0VK2.js.map +0 -1
- package/dist/files-DdT84mPy.js.map +0 -1
- package/dist/html-DEeoepg3.js +0 -152
- package/dist/html-DEeoepg3.js.map +0 -1
- package/dist/html-Du8jY2Cc.d.ts +0 -53
- package/dist/inspect-BPchdWbU.js.map +0 -1
- package/dist/loader-Dc9OwY5I.js.map +0 -1
- package/dist/navigate-CzLjnoPH.js.map +0 -1
- package/dist/produce-BRGHP7e0.js +0 -126
- package/dist/produce-BRGHP7e0.js.map +0 -1
- package/dist/produce-CtZ32UGG.d.ts +0 -60
- package/dist/rpc-9fSqL_YK.js.map +0 -1
- package/dist/runtime/client.js.map +0 -1
- package/dist/server-BxqjLUnV.d.ts +0 -753
- package/dist/server-DZsgnPKS.js +0 -1615
- package/dist/server-DZsgnPKS.js.map +0 -1
- package/dist/shared-CWYOd0H3.js +0 -40
- package/dist/shared-CWYOd0H3.js.map +0 -1
- package/dist/static-loader-ClNkHZGn.js +0 -185
- package/dist/static-loader-ClNkHZGn.js.map +0 -1
- package/dist/stream-bgNCMcaA.js +0 -280
- package/dist/stream-bgNCMcaA.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devtools-CQgD7NPB.js","names":[],"sources":["../src/runtime/devtools.ts"],"sourcesContent":["// The devtools overlay of development builds. This module only listens to\n// the core and shows a button. The panel loads when the button is pressed,\n// so the page behaves as in production until then.\n\nimport type { NavigationReport } from './navigate.ts';\nimport type { DevtoolsHooks, Scope } from './client.ts';\nimport type * as Panel from './devtools-panel.ts';\nimport type { ScopeId } from './shared.ts';\n\n// The same key as the core's, without importing the core.\nconst DEVTOOLS = Symbol.for('brumate.devtools');\n\n/** Something that happened on the page, for the log of the panel. */\nexport interface DevtoolsEntry {\n time: number;\n kind: 'handler' | 'part' | 'write' | 'call';\n text: string;\n /** The scope of a write, so the panel can mark it. */\n scope?: ScopeId;\n /** For a write: the component, the scope in the compiled component, and the slot. */\n write?: { component: string; k: number; slot: number };\n}\n\n/** What the plugin tells the devtools about the dev server. */\nexport interface DevtoolsMeta {\n version?: string;\n vite?: string;\n}\n\n/** An error for the Errors tab: of a render on the server, of Vite, or of code in the browser. */\nexport interface ErrorEntry {\n time: number;\n source: 'server' | 'compile' | 'browser';\n message: string;\n stack?: string;\n /** The lines around the error, as Vite's overlay shows them. */\n frame?: string;\n /** The place of the error, such as a compile error in a `.brm` file. */\n loc?: { file: string; line: number; column: number };\n /** The plugin that threw it, such as `brumate`. */\n plugin?: string;\n}\n\n/** What Vite's overlay gets, and what `errorPage` sends. */\nexport interface ErrorPayload {\n message: string;\n stack?: string;\n frame?: string;\n plugin?: string;\n id?: string;\n loc?: { file?: string; line: number; column: number };\n}\n\n/** The part of `import.meta.hot` that the devtools listen to. */\ninterface HotContext {\n on(event: string, listener: (payload: never) => void): void;\n}\n\n/** Code of a component that loaded, or is loading, for the Loading tab. */\nexport interface LoadEntry {\n component: string;\n /** The part, such as `h3` or `update`, `entry` for the module, or `all` for a merged module. */\n part: string;\n /**\n * Why it loaded: `event`, `block`, `call`, `template`, `state`, `write`, `error`, `reset` or\n * `prop`, or a preload: `hover`, `visible`, `idle` or `eager`.\n */\n reason: string;\n start: number;\n end?: number;\n failed?: boolean;\n /** For a preload: true once something ran the code, such as a handler. */\n used: boolean;\n}\n\n/** A server function call, for the Timeline tab. */\nexport interface CallTiming {\n name: string;\n start: number;\n end?: number;\n /** The status of the answer, `redirect` for a redirect, or `failed`. */\n status?: number | 'redirect' | 'failed';\n /** How long the function took on the server, from the `Server-Timing` of the dev server. */\n server?: number;\n}\n\n/** A batch of updates that a write ran, with its effects. */\nexport interface UpdateTiming {\n count: number;\n start: number;\n end: number;\n}\n\n/**\n * A handler that ran, for the Timeline tab: when its event came, when its\n * code was ready and the handlers before it had started, when its call\n * returned, and when the promise of an async handler settled. The server\n * calls and the updates that ran meanwhile are its own.\n */\nexport interface Interaction {\n ref: string;\n /** What happened, such as `click on <button>`. */\n label: string;\n begun: number;\n ready: number;\n end: number;\n settled?: number;\n failed?: boolean;\n calls: CallTiming[];\n updates: UpdateTiming[];\n}\n\n/** A block of the page that renders later, for the Blocks tab. */\nexport interface BlockEntry {\n kind: 'loading' | 'defer' | 'client' | '$client';\n /** The boundary of `#loading` and `#defer`, or the `b-b` of the template of the others. */\n id: string;\n /** The trigger of `#defer`, `#client` and `$client`. */\n trigger?: string;\n /** The reference that `#client` and `$client` run. */\n ref?: string;\n /** The template that the loader reads for `#defer`, `#client` and `$client`. */\n template?: Element;\n state: 'waiting' | 'loading' | 'streaming' | 'rendered' | 'failed';\n /** When the panel first saw the block, when its trigger fired, and when it rendered. */\n seen: number;\n fired?: number;\n rendered?: number;\n /** True while the devtools show its fallback in place of its body. */\n fallback?: boolean;\n}\n\n/** The loads that are preloads, which the Loading tab marks when nothing used them. */\nexport const PRELOADS: ReadonlySet<string> = new Set(['hover', 'visible', 'idle', 'eager']);\n\n/** An effect or a `$client` callback of a scope, with how it ran. */\nexport interface EffectEntry {\n scope: ScopeId;\n /** The ID of the component of the scope, and the scope's number in it. */\n component: string;\n k: number;\n /** Its name in the update code: `e<n>` for an effect, `c<n>` for a `$client` callback. */\n name: string;\n runs: number;\n /** When its last runs were, the newest last, at most 50. */\n recent: number[];\n /** The time of all its runs, in milliseconds. */\n time: number;\n cleanups: number;\n lastCleanup?: number;\n /** False once its cleanup ran and it has not run again, such as in a removed scope. */\n active: boolean;\n}\n\nexport interface DevtoolsState {\n scopes?: Map<ScopeId, Scope>;\n /** Writes a slot, as a handler does, so the page updates. */\n set?: (scope: Scope, slot: number, value: unknown) => void;\n /** Runs a reference for an element, as the loader does for a trigger. */\n handle?: (element: Element, ref: string, event?: Event) => Promise<unknown>;\n log: DevtoolsEntry[];\n /** The code that loaded, by `component:part`, in the order it started. */\n loads: Map<string, LoadEntry>;\n /** The blocks of the page, by kind and ID. */\n blocks: Map<string, BlockEntry>;\n /** Asks the server for the body of a `#defer` block now. */\n fire?: (block: BlockEntry) => void;\n /**\n * Shows the fallback of a `#loading` or `#defer` block in place of its\n * body, or its body again. False when the page did not keep its fallback.\n */\n showFallback?: (block: BlockEntry, on: boolean) => boolean;\n /** The scopes written since the panel last drew, by scope ID. */\n written: Set<ScopeId>;\n /** The URL prefix of the inspect endpoint of the dev server. */\n endpoint: string;\n /** The versions of brumate and Vite, from the plugin. */\n meta: DevtoolsMeta;\n /** The errors of the page, oldest first. */\n errors: ErrorEntry[];\n /** The handlers that ran, oldest first, with their calls and updates. */\n timeline: Interaction[];\n /** The effects and `$client` callbacks that ran, by scope and name. */\n effects: Map<string, EffectEntry>;\n /** The client navigations of the page, newest last, at most 20. */\n navigations: NavigationReport[];\n /** Opens the panel on a tab, such as `errors`. */\n open?: (tab: string) => void;\n /** Shows the number of errors on the tab. */\n errorCount?: () => void;\n /** True while the elements that change are outlined on the page. */\n flash: boolean;\n /** Turns the outlines of changed elements on or off, and keeps the choice. */\n setFlash?: (on: boolean) => void;\n /** While the panel is open: sets its top edge to a place of the pointer, and keeps it. */\n resize?: (clientY: number) => void;\n resized?: () => void;\n /** Called after each change, while the panel is open. */\n changed?: () => void;\n}\n\nconst MAX_LOG = 300;\n\n/**\n * The logo of brumate: the pole and the bowl of a b, in outline, where the\n * pole runs through the left of the bowl. The part they share is orange.\n */\nexport const LOGO = `<svg viewBox=\"0 0 32 32\" width=\"100%\" height=\"100%\" aria-hidden=\"true\"><defs><linearGradient id=\"brumate-logo-fill\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\"><stop offset=\"0\" stop-color=\"#ffc38a\"/><stop offset=\".5\" stop-color=\"#ee7a3e\"/><stop offset=\"1\" stop-color=\"#e0445a\"/></linearGradient><clipPath id=\"brumate-logo-pole\"><rect x=\"7.5\" y=\"2.5\" width=\"8\" height=\"27\" rx=\"4\"/></clipPath></defs><circle cx=\"18\" cy=\"19.5\" r=\"10\" fill=\"url(#brumate-logo-fill)\" clip-path=\"url(#brumate-logo-pole)\"/><g fill=\"none\" stroke=\"#ece8e4\" stroke-width=\"2.2\"><rect x=\"7.5\" y=\"2.5\" width=\"8\" height=\"27\" rx=\"4\"/><circle cx=\"18\" cy=\"19.5\" r=\"10\"/></g></svg>`;\n\n/** The root scope of a scope, whose `m` names its component. */\nexport function rootOf(scope: Scope): Scope {\n let root = scope;\n while (root.p) {\n root = root.p;\n }\n return root;\n}\n\n/** A short text for a value in the log. */\nexport function preview(value: unknown): string {\n if (typeof value === 'string') {\n return JSON.stringify(value.length > 40 ? `${value.slice(0, 40)}…` : value);\n }\n if (typeof value === 'function') {\n return 'function';\n }\n if (Array.isArray(value)) {\n return `Array(${value.length})`;\n }\n if (value instanceof Element) {\n return `<${value.tagName.toLowerCase()}>`;\n }\n if (value !== null && typeof value === 'object') {\n const name = value.constructor?.name;\n return name && name !== 'Object' ? name : `{${Object.keys(value).slice(0, 3).join(', ')}}`;\n }\n return String(value);\n}\n\n/**\n * Reads the blocks of the page from their markers, and updates their state.\n * Returns true when something changed.\n *\n * - `#defer`: a `<template b-defer>`, and `<!--l…-->` around its fallback until its body arrives.\n * - `#loading`: `<!--l…-->` around its fallback until the server streams its body.\n * - `#client`: a `<template b-client>` with a `#k` reference, and a marker that gets `:1` once\n * its body rendered.\n * - `$client`: a `<template b-client>` with a `#c` reference.\n */\nexport function scanBlocks(state: DevtoolsState): boolean {\n const now = performance.now();\n let changed = false;\n const open = new Map<string, Comment>();\n const markers = new Map<string, Comment>();\n const walker = document.createTreeWalker(document, NodeFilter.SHOW_COMMENT);\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n const data = (node as Comment).data;\n if (/^l[\\d.-]+$/.test(data)) {\n open.set(data.slice(1), node as Comment);\n } else if (/^b-?[\\d.]+:\\d+/.test(data)) {\n markers.set(data.slice(1).split(':').slice(0, 2).join(':'), node as Comment);\n }\n }\n const seen = new Set<string>();\n const update = (key: string, make: () => BlockEntry, next: BlockEntry['state']): void => {\n seen.add(key);\n let block = state.blocks.get(key);\n if (!block) {\n block = make();\n state.blocks.set(key, block);\n changed = true;\n }\n if (block.state === 'rendered' || block.state === next) {\n return;\n }\n // A `#defer` that asked for its body and still shows its fallback did not get it.\n if (block.state === 'loading' && next === 'waiting') {\n return;\n }\n block.state = next;\n if (next === 'rendered') {\n block.rendered = now;\n }\n changed = true;\n };\n const deferBoundaries = new Set<string>();\n for (const template of document.querySelectorAll('template[b-defer]')) {\n const [trigger, boundary] = template.getAttribute('b-defer')!.split(':') as [string, string];\n deferBoundaries.add(boundary);\n update(\n `defer:${boundary}`,\n () => ({ kind: 'defer', id: boundary, trigger, template, state: 'waiting', seen: now }),\n open.has(boundary) ? 'waiting' : 'rendered',\n );\n }\n for (const boundary of open.keys()) {\n if (!deferBoundaries.has(boundary)) {\n update(\n `loading:${boundary}`,\n () => ({ kind: 'loading', id: boundary, state: 'streaming', seen: now }),\n 'streaming',\n );\n }\n }\n for (const template of document.querySelectorAll('template[b-client]')) {\n const [trigger, ref] = template.getAttribute('b-client')!.split('=') as [string, string];\n const id = template.getAttribute('b-b') ?? '';\n const block = /#k\\d+$/.test(ref);\n const marker = markers.get(id);\n update(\n `client:${id}`,\n () => ({\n kind: block ? 'client' : '$client',\n id,\n trigger,\n ref,\n template,\n state: 'waiting',\n seen: now,\n }),\n // A `$client` callback has run once its trigger fired.\n (\n block\n ? marker && marker.data.split(':').length > 2\n : state.blocks.get(`client:${id}`)?.fired\n )\n ? 'rendered'\n : 'waiting',\n );\n }\n // A `#loading` block whose markers are gone rendered its body. Other blocks that left the page,\n // such as on navigation, are dropped.\n for (const [key, block] of state.blocks) {\n if (seen.has(key)) {\n continue;\n }\n if (block.kind === 'loading') {\n if (block.state === 'streaming') {\n block.state = 'rendered';\n block.rendered = now;\n changed = true;\n }\n } else if (!block.template?.isConnected) {\n state.blocks.delete(key);\n changed = true;\n }\n }\n return changed;\n}\n\n/**\n * Adds an error to the Errors tab. An error of the server or of Vite opens\n * the panel on it, as Vite's overlay would. An error of the browser only\n * counts on the button.\n */\nexport function reportError(\n state: DevtoolsState,\n payload: ErrorPayload,\n source: ErrorEntry['source'],\n): void {\n const file = payload.loc?.file ?? payload.id;\n const entry: ErrorEntry = {\n time: performance.now(),\n // An error of a plugin, such as a compile error, is one, even when a render met it.\n source: source === 'server' && payload.plugin ? 'compile' : source,\n message: payload.message,\n ...(payload.stack ? { stack: payload.stack } : {}),\n ...(payload.frame ? { frame: payload.frame } : {}),\n ...(payload.plugin ? { plugin: payload.plugin } : {}),\n ...(payload.loc && file\n ? { loc: { file, line: payload.loc.line, column: payload.loc.column } }\n : {}),\n };\n // The same error again, such as on each request for the page, counts once.\n const last = state.errors.at(-1);\n if (last?.message !== entry.message || last.stack !== entry.stack) {\n state.errors.push(entry);\n if (state.errors.length > 50) {\n state.errors.shift();\n }\n }\n state.errorCount?.();\n state.changed?.();\n if (source !== 'browser') {\n state.open?.('errors');\n }\n}\n\n/** The code of the panel, which loads when it opens. */\nconst panelModule = (): Promise<typeof Panel> => import('./devtools-panel.ts');\n\n/** Where the choice to outline changed elements is kept. */\nconst FLASH_KEY = 'brumate:devtools:flash';\n/** How long an outline shows. */\nconst FLASH_MS = 700;\n/** The most outlines that one frame draws, so a big change does not stall the page. */\nconst MAX_FLASHES = 200;\n\n/** The class of an outline, by how many times the element changed in the last second. */\nfunction heatClass(count: number): string {\n if (count >= 5) {\n return 'hot';\n }\n return count >= 2 ? 'warm' : '';\n}\n\n/**\n * Outlines the elements that change, as an update writes them: green for an\n * element that changes now and then, yellow and red for one that changes\n * often. A MutationObserver sees every change of the page, so it needs no\n * hook of the core. The outlines are drawn in the shadow root, so the page\n * itself does not change.\n */\nfunction installFlash(state: DevtoolsState, root: ShadowRoot, host: Element): void {\n const layer = document.createElement('div');\n layer.className = 'flashes';\n root.append(layer);\n // How many times each element changed lately, for its colour.\n const heat = new WeakMap<Element, { count: number; time: number }>();\n const pending = new Set<Element>();\n let frame = 0;\n const draw = (): void => {\n frame = 0;\n let drawn = 0;\n for (const target of pending) {\n if (drawn >= MAX_FLASHES) {\n break;\n }\n const rect = target.getBoundingClientRect();\n if (rect.width === 0 && rect.height === 0) {\n continue;\n }\n const now = performance.now();\n const last = heat.get(target);\n const count = last && now - last.time < 1000 ? last.count + 1 : 1;\n heat.set(target, { count, time: now });\n const box = document.createElement('div');\n box.className = `flash ${heatClass(count)}`;\n box.style.cssText = `left:${rect.left}px;top:${rect.top}px;width:${rect.width}px;height:${rect.height}px`;\n layer.append(box);\n setTimeout(() => box.remove(), FLASH_MS);\n drawn++;\n }\n pending.clear();\n };\n const observer = new MutationObserver((records) => {\n for (const record of records) {\n let target: Node | null = record.target;\n if (record.type === 'childList') {\n // The elements that came in, or else the element that lost some.\n const added = [...record.addedNodes].filter((node) => node.nodeType === 1);\n for (const node of added) {\n pending.add(node as Element);\n }\n if (added.length > 0) {\n continue;\n }\n }\n if (target.nodeType !== 1) {\n target = target.parentElement;\n }\n if (\n target &&\n target !== host &&\n target !== document.documentElement &&\n target !== document.body\n ) {\n pending.add(target as Element);\n }\n }\n for (const target of pending) {\n // The devtools change their own markup, and the host carries their styles.\n if (target === host || host.contains(target)) {\n pending.delete(target);\n }\n }\n if (pending.size > 0 && frame === 0) {\n frame = requestAnimationFrame(draw);\n }\n });\n state.setFlash = (on) => {\n state.flash = on;\n if (on) {\n observer.observe(document.documentElement, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true,\n });\n } else {\n observer.disconnect();\n pending.clear();\n layer.replaceChildren();\n }\n try {\n localStorage.setItem(FLASH_KEY, on ? '1' : '0');\n } catch {\n // Storage can be off.\n }\n state.changed?.();\n };\n let saved = false;\n try {\n saved = localStorage.getItem(FLASH_KEY) === '1';\n } catch {\n // Storage can be off.\n }\n if (saved) {\n state.setFlash(true);\n }\n}\n\n/** True for an error of code that is not of the page, such as of a browser extension. */\nconst foreign = (stack: string | undefined, file = ''): boolean =>\n /^[a-z-]+-extension:/.test(file) ||\n (stack !== undefined && /[a-z-]+-extension:\\/\\//.test(stack) && !stack.includes(location.origin));\n\n/** Listens to the core, and adds the button that opens the panel. */\nexport function installDevtools(\n endpoint = '/__brumate/inspect',\n rpc = '/_brumate',\n meta: DevtoolsMeta = {},\n hot?: HotContext,\n): DevtoolsState {\n const state: DevtoolsState = {\n log: [],\n loads: new Map(),\n blocks: new Map(),\n written: new Set(),\n endpoint,\n meta,\n errors: [],\n timeline: [],\n effects: new Map(),\n navigations: [],\n flash: false,\n };\n /** The handler that a server call or an update that starts now belongs to. */\n const owner = (time: number): Interaction | undefined => {\n for (let index = state.timeline.length - 1; index >= 0; index--) {\n const run = state.timeline[index]!;\n // An update of the answer of a call comes a moment after the handler settled.\n if (run.begun <= time && (run.settled === undefined || time <= run.settled + 32)) {\n return run;\n }\n }\n return undefined;\n };\n const load = (component: string, part: string, reason: string, done: Promise<unknown>): void => {\n const key = `${component}:${part}`;\n const known = state.loads.get(key);\n if (known) {\n // The same code again, for a reason that is not a preload: the preload was used.\n if (!PRELOADS.has(reason)) {\n known.used = true;\n }\n return;\n }\n const entry: LoadEntry = { component, part, reason, start: performance.now(), used: false };\n state.loads.set(key, entry);\n done.then(\n () => {\n entry.end = performance.now();\n state.changed?.();\n },\n () => {\n entry.end = performance.now();\n entry.failed = true;\n state.changed?.();\n },\n );\n state.changed?.();\n };\n const add = (entry: Omit<DevtoolsEntry, 'time'>): void => {\n state.log.push({ ...entry, time: performance.now() });\n if (state.log.length > MAX_LOG) {\n state.log.splice(0, state.log.length - MAX_LOG);\n }\n state.changed?.();\n };\n const hooks: DevtoolsHooks = {\n attach(core) {\n state.scopes = core.scopes;\n state.set = core.set;\n state.handle = core.handle;\n state.changed?.();\n },\n load,\n handled(run) {\n const entry: Interaction = {\n ref: run.ref,\n label: `${run.event ?? 'call'} on <${run.element.tagName.toLowerCase()}>`,\n begun: run.begun,\n ready: run.ready,\n end: run.end,\n calls: [],\n updates: [],\n };\n if (run.result instanceof Promise) {\n run.result.then(\n () => {\n entry.settled = performance.now();\n state.changed?.();\n },\n () => {\n entry.settled = performance.now();\n entry.failed = true;\n state.changed?.();\n },\n );\n } else {\n entry.settled = run.end;\n }\n state.timeline.push(entry);\n if (state.timeline.length > 100) {\n state.timeline.shift();\n }\n state.changed?.();\n },\n updated(count, start, end) {\n if (count > 0) {\n owner(start)?.updates.push({ count, start, end });\n }\n },\n defer(template, done) {\n deferred(template, done);\n },\n handler(ref, element, event) {\n // The code of a handler runs, so a preload of its part was used.\n const [component, name] = ref.split('@')[0]!.split('#') as [string, string];\n const part = state.loads.get(`${component}:${/^[hct]\\d/.test(name) ? name : 'update'}`);\n if (part) {\n part.used = true;\n }\n if (element.tagName === 'TEMPLATE') {\n const block = [...state.blocks.values()].find((item) => item.template === element);\n if (block && block.fired === undefined) {\n block.fired = performance.now();\n if (block.kind === '$client') {\n block.state = 'rendered';\n block.rendered = block.fired;\n }\n }\n }\n add({\n kind: 'handler',\n text: `${event?.type ?? 'call'} on <${element.tagName.toLowerCase()}>: ${ref}`,\n });\n },\n part(component, name) {\n add({ kind: 'part', text: `loaded ${component} ${name}` });\n },\n effect(scope, name, kind, time) {\n const key = `${scope.id}:${name}`;\n let entry = state.effects.get(key);\n if (!entry) {\n entry = {\n scope: scope.id,\n component: rootOf(scope).m ?? '',\n k: scope.k,\n name,\n runs: 0,\n recent: [],\n time: 0,\n cleanups: 0,\n active: false,\n };\n state.effects.set(key, entry);\n }\n const now = performance.now();\n if (kind === 'run') {\n entry.runs++;\n entry.time += time;\n entry.recent.push(now);\n if (entry.recent.length > 50) {\n entry.recent.shift();\n }\n entry.active = true;\n } else {\n entry.cleanups++;\n entry.lastCleanup = now;\n entry.active = false;\n }\n state.changed?.();\n },\n navigated(report) {\n state.navigations.push(report);\n if (state.navigations.length > 20) {\n state.navigations.shift();\n }\n state.changed?.();\n },\n write(scope, slot, value) {\n state.written.add(scope.id);\n const root = rootOf(scope);\n add({\n kind: 'write',\n text: `scope ${scope.id} slot ${slot} = ${preview(value)}`,\n scope: scope.id,\n write: { component: root.m ?? '', k: scope.k, slot },\n });\n },\n };\n (globalThis as Record<symbol, DevtoolsHooks | undefined>)[DEVTOOLS] = hooks;\n\n // The swap of a body keeps its fallback in development, by boundary, so the fallback can show\n // again. While it shows, the body is out of the page, and updates of its nodes wait there.\n state.showFallback = (block, on) => {\n const kept = (globalThis as { $bD?: Record<string, { f: Node[]; b: Node[] }> }).$bD?.[block.id];\n if (!kept || (block.fallback ?? false) === on) {\n return false;\n }\n const [shown, hidden] = on ? [kept.b, kept.f] : [kept.f, kept.b];\n const anchor = shown.find((node) => node.parentNode);\n if (!anchor) {\n return false;\n }\n for (const node of hidden) {\n anchor.parentNode!.insertBefore(node, anchor);\n }\n for (const node of shown) {\n node.parentNode?.removeChild(node);\n }\n block.fallback = on;\n state.changed?.();\n return true;\n };\n\n // Server function calls, with how long each took and how it answered.\n const original = globalThis.fetch.bind(globalThis);\n globalThis.fetch = async (input, init) => {\n const url = new URL(input instanceof Request ? input.url : String(input), location.href);\n if (url.origin !== location.origin || !url.pathname.startsWith(`${rpc}/`)) {\n return original(input, init);\n }\n const name = decodeURIComponent(url.pathname.slice(rpc.length + 1));\n const started = performance.now();\n const call: CallTiming = { name, start: started };\n owner(started)?.calls.push(call);\n try {\n const response = await original(input, init);\n const took = Math.round(performance.now() - started);\n const redirect = response.headers.get('x-brumate-redirect');\n call.end = performance.now();\n call.status = redirect ? 'redirect' : response.status;\n const server = /brumate;dur=([\\d.]+)/.exec(response.headers.get('server-timing') ?? '');\n if (server) {\n call.server = Number(server[1]);\n }\n state.changed?.();\n add({\n kind: 'call',\n text: `${name}: ${redirect ? `redirect to ${redirect}` : response.status} in ${took} ms`,\n });\n return response;\n } catch (error) {\n call.end = performance.now();\n call.status = 'failed';\n add({\n kind: 'call',\n text: `${name}: failed, ${error instanceof Error ? error.message : String(error)}`,\n });\n throw error;\n }\n };\n\n // Blocks: the markers of the page tell their state, so the panel follows the changes of the DOM.\n const deferred = (template: Element, done: Promise<unknown>): void => {\n const block = [...state.blocks.values()].find((item) => item.template === template);\n if (block) {\n block.fired ??= performance.now();\n block.state = 'loading';\n }\n void done.finally(() => {\n scanBlocks(state);\n state.changed?.();\n });\n };\n state.fire = (block) => {\n if (block.kind === 'defer' && block.template) {\n deferred(\n block.template,\n import('./defer.ts').then((module) => module.loadDeferred(block.template!)),\n );\n } else if (block.template && block.ref) {\n void state.handle?.(block.template, block.ref);\n }\n };\n if (typeof MutationObserver !== 'undefined') {\n let queued = false;\n new MutationObserver(() => {\n if (!queued) {\n queued = true;\n queueMicrotask(() => {\n queued = false;\n if (scanBlocks(state)) {\n state.changed?.();\n }\n });\n }\n }).observe(document, { childList: true, subtree: true, characterData: true });\n }\n scanBlocks(state);\n\n const host = document.createElement('brumate-devtools');\n const root = host.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = `\n.open { position: fixed; left: 50%; bottom: 0; z-index: 2147483647; transform: translateX(-50%); display: flex; justify-content: center; padding: 8px 16px 0; border: 0; background: none; color: #ece8e4; font: 600 12px/1 system-ui, -apple-system, sans-serif; cursor: pointer; touch-action: none; outline: none; }\n.open[hidden] { display: none; }\n.grip { width: 40px; height: 5px; border-radius: 4px 4px 0 0; background: rgb(25 24 26 / 0.88); box-shadow: 0 0 0 1px rgb(255 255 255 / 0.3); transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1), width 150ms cubic-bezier(0.4, 0, 0.2, 1); }\n.open[data-errors] .grip { width: 56px; background: #e5484d; }\n.content { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 100%); display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 10px; white-space: nowrap; background: #222023; border: 1px solid #2f2c31; border-bottom: 0; border-radius: 10px 10px 0 0; box-shadow: 0 -4px 16px rgb(0 0 0 / 0.3); opacity: 0; pointer-events: none; transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1), opacity 150ms cubic-bezier(0.4, 0, 0.2, 1); }\n.open:hover .content, .open:focus-visible .content, .open:active .content { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }\n.open:hover .grip, .open:focus-visible .grip, .open:active .grip { opacity: 0; }\n.open:focus-visible .content { border-color: #ee7a3e; }\n.mark { display: inline-flex; width: 16px; height: 16px; }\n.version { padding: 1px 8px; border-radius: 999px; background: rgb(238 122 62 / 0.16); color: #ffb48a; font: 600 12px/20px ui-monospace, SFMono-Regular, Menlo, monospace; }\n.chevron { width: 12px; height: 12px; color: #a39a92; }\n.count { min-width: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: #e5484d; color: #fff; font: 600 11px/18px system-ui, sans-serif; text-align: center; }\n.count:empty { display: none; }\n.flashes { position: fixed; inset: 0; pointer-events: none; z-index: 2147483646; }\n.flash { position: fixed; box-sizing: border-box; border: 2px solid #7fd99a; border-radius: 3px; background: rgb(127 217 154 / 0.08); animation: flash 700ms ease-out forwards; }\n.flash.warm { border-color: #ffd166; background: rgb(255 209 102 / 0.1); }\n.flash.hot { border-color: #ff7a7a; background: rgb(255 122 122 / 0.12); }\n@keyframes flash { from { opacity: 1; } to { opacity: 0; } }\n@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }\n@media (prefers-reduced-motion: reduce) { .grip, .content { transition: none; } }\n`;\n // The closed panel: a grip on the bottom edge that grows into a pull tab on hover or focus, so\n // it covers almost none of the page. A click, or a drag up, opens the panel.\n const button = document.createElement('button');\n button.type = 'button';\n button.className = 'open';\n button.title = 'brumate devtools (Alt+Shift+D)';\n button.innerHTML = `<span class=\"grip\"></span><span class=\"content\"><span class=\"mark\">${LOGO}</span><span class=\"version\"></span><span class=\"count\"></span><svg class=\"chevron\" viewBox=\"0 0 12 12\" aria-hidden=\"true\"><path d=\"M3 7.5 6 4.5 9 7.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg></span>`;\n // The version of brumate, next to its mark.\n button.querySelector('.version')!.textContent = meta.version ? `v${meta.version}` : 'brumate';\n const label = (): void => {\n const errors = state.errors.length;\n button.setAttribute(\n 'aria-label',\n `Open the brumate devtools${meta.version ? `, version ${meta.version}` : ''}${errors > 0 ? `, ${errors} errors` : ''}`,\n );\n };\n label();\n // The number of errors, in red on the tab, and a red grip, so an error shows while it is closed.\n const count = button.querySelector<HTMLElement>('.count')!;\n state.errorCount = (): void => {\n count.textContent = state.errors.length > 0 ? String(state.errors.length) : '';\n button.toggleAttribute('data-errors', state.errors.length > 0);\n label();\n };\n // Dragging the tab up past a few pixels opens the panel under the pointer. A press that does not\n // move is left to the click.\n let dragged = false;\n button.addEventListener('pointerdown', (event) => {\n if (event.button !== 0) {\n return;\n }\n const start = event.clientY;\n let opened = false;\n dragged = false;\n const move = (next: PointerEvent): void => {\n if (!opened) {\n if (start - next.clientY < 4) {\n return;\n }\n opened = true;\n dragged = true;\n void panelModule().then(({ openPanel }) => {\n openPanel(root, state, 'overview');\n state.resize?.(next.clientY);\n });\n return;\n }\n state.resize?.(next.clientY);\n };\n // The tab hides as the panel opens, so the pointer is followed on the window.\n const end = (): void => {\n removeEventListener('pointermove', move);\n removeEventListener('pointerup', end);\n removeEventListener('pointercancel', end);\n if (opened) {\n state.resized?.();\n }\n };\n addEventListener('pointermove', move);\n addEventListener('pointerup', end);\n addEventListener('pointercancel', end);\n });\n button.addEventListener('click', () => {\n if (dragged) {\n dragged = false;\n return;\n }\n void panelModule().then(({ togglePanel }) => togglePanel(root, state));\n });\n // Alt+Shift+D opens and closes the panel. `code`, because Alt changes the key on macOS.\n addEventListener('keydown', (event) => {\n if (event.altKey && event.shiftKey && event.code === 'KeyD') {\n event.preventDefault();\n void panelModule().then(({ togglePanel }) => togglePanel(root, state));\n }\n });\n state.open = (tab) => {\n void import('./devtools-panel.ts').then(({ openPanel }) => openPanel(root, state, tab));\n };\n root.append(style, button);\n installFlash(state, root, host);\n\n // Errors of code of the page in the browser. Errors of other code are left out.\n addEventListener('error', (event) => {\n const stack = (event.error as Error | undefined)?.stack;\n if (foreign(stack, event.filename)) {\n return;\n }\n const error = event.error as Error | undefined;\n // The message of the error, without the `Uncaught` that the browser puts before it.\n reportError(\n state,\n { message: error?.message ?? event.message, stack: error?.stack },\n 'browser',\n );\n });\n addEventListener('unhandledrejection', (event) => {\n const reason = event.reason as Error | undefined;\n if (foreign(reason?.stack)) {\n return;\n }\n reportError(\n state,\n { message: reason?.message ?? String(event.reason), stack: reason?.stack },\n 'browser',\n );\n });\n // Errors of handlers and updates that no `#try` caught. The core catches them, so they do not\n // reach the listeners above.\n addEventListener('brumate:error', (event) => {\n const error = (event as CustomEvent<{ error: unknown }>).detail.error as Error | undefined;\n reportError(\n state,\n { message: error?.message ?? String(error), stack: error?.stack },\n 'browser',\n );\n });\n // Errors of Vite, such as a compile error after an edit, which its overlay would show. A good\n // update after them clears them.\n hot?.on('vite:error', (payload: { err: ErrorPayload }) => {\n reportError(state, payload.err, 'compile');\n });\n hot?.on('vite:afterUpdate', () => {\n const before = state.errors.length;\n state.errors = state.errors.filter((error) => error.source !== 'compile');\n if (state.errors.length !== before) {\n state.errorCount?.();\n state.changed?.();\n }\n });\n const append = (): void => {\n // Navigation replaces the body, so the button goes on the document element.\n document.documentElement.append(host);\n };\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', append);\n } else {\n append();\n }\n return state;\n}\n"],"mappings":";AAUA,MAAM,WAAW,OAAO,IAAI,kBAAkB;;AA2H9C,MAAa,2BAAgC,IAAI,IAAI;CAAC;CAAS;CAAW;CAAQ;AAAO,CAAC;AAoE1F,MAAM,UAAU;;;;;AAMhB,MAAa,OAAO;;AAGpB,SAAgB,OAAO,OAAqB;CAC1C,IAAI,OAAO;CACX,OAAO,KAAK,GACV,OAAO,KAAK;CAEd,OAAO;AACT;;AAGA,SAAgB,QAAQ,OAAwB;CAC9C,IAAI,OAAO,UAAU,UACnB,OAAO,KAAK,UAAU,MAAM,SAAS,KAAK,GAAG,MAAM,MAAM,GAAG,EAAE,EAAE,KAAK,KAAK;CAE5E,IAAI,OAAO,UAAU,YACnB,OAAO;CAET,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,SAAS,MAAM,OAAO;CAE/B,IAAI,iBAAiB,SACnB,OAAO,IAAI,MAAM,QAAQ,YAAY,EAAE;CAEzC,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;EAC/C,MAAM,OAAO,MAAM,a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