brumate 0.4.4 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{boot-D3NjfyUX.d.ts → boot-Difa0qdg.d.ts} +2 -8
- package/dist/cli.js +2 -2
- package/dist/{client-iZ9a1Nut.js → client-BYHGusTe.js} +990 -369
- package/dist/client-BYHGusTe.js.map +1 -0
- package/dist/{client-DNva05jp.d.ts → client-DvsU9qxG.d.ts} +107 -23
- package/dist/{defer-DP7dMS2y.js → defer-B63oF5Oa.js} +2 -2
- package/dist/{defer-DP7dMS2y.js.map → defer-B63oF5Oa.js.map} +1 -1
- package/dist/{devtools-BJB_MMeL.js → devtools-D_SQpXTg.js} +4 -4
- package/dist/{devtools-BJB_MMeL.js.map → devtools-D_SQpXTg.js.map} +1 -1
- package/dist/{devtools-panel-CUV6A4ZE.js → devtools-panel-B9yokst5.js} +2 -2
- package/dist/{devtools-panel-CUV6A4ZE.js.map → devtools-panel-B9yokst5.js.map} +1 -1
- package/dist/{features-CHY5Ekku.js → features-D5kLyihb.js} +19 -2
- package/dist/features-D5kLyihb.js.map +1 -0
- package/dist/{files-BZRjz9Mx.js → files-s4wmjcZV.js} +2 -2
- package/dist/{files-BZRjz9Mx.js.map → files-s4wmjcZV.js.map} +1 -1
- package/dist/index.d.ts +1 -8
- package/dist/index.js +1 -1
- package/dist/{inspect-BLOdfj7o.js → inspect-BLPt-dZZ.js} +891 -142
- package/dist/inspect-BLPt-dZZ.js.map +1 -0
- package/dist/{loader-CheV6t0N.js → loader-DKxhLjJw.js} +4 -4
- package/dist/{loader-CheV6t0N.js.map → loader-DKxhLjJw.js.map} +1 -1
- package/dist/{navigate-CfOr-TRF.js → navigate-BcV1qkkx.js} +2 -2
- package/dist/navigate-BcV1qkkx.js.map +1 -0
- package/dist/{produce-DS-dQaUX.js → produce-Cq6KKi7b.js} +2 -2
- package/dist/{produce-DS-dQaUX.js.map → produce-Cq6KKi7b.js.map} +1 -1
- package/dist/{rpc-DvTwGfL_.js → rpc-CIVU4Ktx.js} +5 -5
- package/dist/rpc-CIVU4Ktx.js.map +1 -0
- package/dist/runtime/bundles.d.ts +9 -0
- package/dist/runtime/bundles.js +60 -0
- package/dist/runtime/bundles.js.map +1 -0
- package/dist/runtime/client.d.ts +2 -2
- package/dist/runtime/client.js +3 -3
- package/dist/runtime/devtools.d.ts +1 -1
- package/dist/runtime/devtools.js +1 -1
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/loader.d.ts +2 -2
- package/dist/runtime/loader.js +2 -2
- package/dist/runtime/server.d.ts +3 -3
- package/dist/runtime/server.js +4 -4
- package/dist/runtime/static-loader.d.ts +2 -2
- package/dist/runtime/static-loader.js +1 -1
- package/dist/runtime/testing.d.ts +2 -2
- package/dist/runtime/testing.js +2 -2
- package/dist/{server-BXMH3Z9T.d.ts → server-CAwIqrXl.d.ts} +44 -5
- package/dist/{server-O_rC-RRL.js → server-Doy5HR7r.js} +106 -17
- package/dist/server-Doy5HR7r.js.map +1 -0
- package/dist/{static-loader-BiUaZaag.d.ts → static-loader-9Nc1GvF0.d.ts} +2 -2
- package/dist/{static-loader-BLJYvTKc.js → static-loader-Bdet7g76.js} +3 -26
- package/dist/static-loader-Bdet7g76.js.map +1 -0
- package/dist/{stream-JGRPr7u5.js → stream-BdhzvPQO.js} +2 -2
- package/dist/{stream-JGRPr7u5.js.map → stream-BdhzvPQO.js.map} +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +129 -51
- package/dist/vite.js.map +1 -1
- package/package.json +5 -1
- package/skills/brumate/references/errors.md +19 -5
- package/dist/client-iZ9a1Nut.js.map +0 -1
- package/dist/features-CHY5Ekku.js.map +0 -1
- package/dist/inspect-BLOdfj7o.js.map +0 -1
- package/dist/navigate-CfOr-TRF.js.map +0 -1
- package/dist/rpc-DvTwGfL_.js.map +0 -1
- package/dist/server-O_rC-RRL.js.map +0 -1
- package/dist/static-loader-BLJYvTKc.js.map +0 -1
|
@@ -52,6 +52,14 @@ declare function fill(scope: Scope, anchor: number, render: Render, kinds?: numb
|
|
|
52
52
|
* scope ID in the compiled component.
|
|
53
53
|
*/
|
|
54
54
|
declare function offscreen(scope: Scope, anchor: number, value: unknown, render: Render, kind: number, holderKind?: number, holderAnchor?: number): void;
|
|
55
|
+
/**
|
|
56
|
+
* Hides the body of a `#loading (memo)` block that has shown, and shows its fallback after it,
|
|
57
|
+
* while a memo of the header loads, then shows the body again. The body stays in the page and
|
|
58
|
+
* follows the `#offscreen` rules. A body that has not shown yet has no markers in the page, so
|
|
59
|
+
* its boundary shows the fallback. `kind` is the body's scope ID in the compiled component, and
|
|
60
|
+
* `kinds` are the scope IDs inside the fallback, whose instances go with it.
|
|
61
|
+
*/
|
|
62
|
+
declare function held(scope: Scope, anchor: number, pending: boolean, kind: number, render: Render | undefined, kinds: number[], holderKind?: number, holderAnchor?: number): void;
|
|
55
63
|
/** A hidden `#offscreen` body: its scope, and the ranges of its markup and of its portals. */
|
|
56
64
|
interface HiddenBody {
|
|
57
65
|
scope: Scope;
|
|
@@ -110,13 +118,6 @@ interface ClientModule {
|
|
|
110
118
|
props: Record<string, number>;
|
|
111
119
|
/** Scope kind, then slot, to the updates that read it. */
|
|
112
120
|
g: Record<number, Record<number, Update[]>>;
|
|
113
|
-
/** The handlers that can write a slot of another component. The others write only their own. */
|
|
114
|
-
w?: string[];
|
|
115
|
-
/**
|
|
116
|
-
* Imports a part of the module. A module without it holds every part
|
|
117
|
-
* itself, as a small component's module does.
|
|
118
|
-
*/
|
|
119
|
-
load?: (part: string) => Promise<Part>;
|
|
120
121
|
/**
|
|
121
122
|
* The render functions of components that this component sends as values, such as in a
|
|
122
123
|
* prop. The state holds only their IDs, so `dynamic` finds them here.
|
|
@@ -134,8 +135,6 @@ interface ClientModule {
|
|
|
134
135
|
*/
|
|
135
136
|
t?: Record<number, [owner: number, anchor: number, body: string, fallback: string, kinds: number[], holderKind?: number, holderAnchor?: number]>;
|
|
136
137
|
}
|
|
137
|
-
/** A part of a client module: one client root, or the updates. */
|
|
138
|
-
type Part = Record<string, unknown>;
|
|
139
138
|
/** The instance of a scope in the page. */
|
|
140
139
|
interface Scope {
|
|
141
140
|
id: ScopeId;
|
|
@@ -190,6 +189,11 @@ interface Scope {
|
|
|
190
189
|
* the start comments of text inserts.
|
|
191
190
|
*/
|
|
192
191
|
n?: Node[];
|
|
192
|
+
/**
|
|
193
|
+
* The latest value written at each place of the markup that was ever given a promise, by
|
|
194
|
+
* anchor, or anchor and attribute name, so an older promise that settles later writes nothing.
|
|
195
|
+
*/
|
|
196
|
+
q?: Record<string, unknown>;
|
|
193
197
|
}
|
|
194
198
|
interface CoreOptions {
|
|
195
199
|
/** The exports of the serial entry, for the values of the app in the page state. */
|
|
@@ -199,10 +203,6 @@ interface CoreOptions {
|
|
|
199
203
|
* has no client code, which a build leaves out.
|
|
200
204
|
*/
|
|
201
205
|
load: (id: string) => Promise<ClientModule> | undefined;
|
|
202
|
-
/** Loads the bundle of a root component of the page, before the modules in it. */
|
|
203
|
-
loadBundle?: (id: string) => Promise<unknown> | undefined;
|
|
204
|
-
/** Imports a part of a module, once for each part, as the loader preloads it. */
|
|
205
|
-
loadPart?: (module: ClientModule, part: string) => Promise<Part>;
|
|
206
206
|
/** Adds event listeners for the `b-on` attributes in new markup. */
|
|
207
207
|
listen: (root: ParentNode) => void;
|
|
208
208
|
/** Tells the loader that the markup that `listen` scanned is in the page now. */
|
|
@@ -382,7 +382,6 @@ declare function nameComment(place: Comment, data: string): void;
|
|
|
382
382
|
//#endregion
|
|
383
383
|
//#region src/runtime/client/code.d.ts
|
|
384
384
|
declare function loadModule(id: string): Promise<ClientModule>;
|
|
385
|
-
declare function loadPart(module: ClientModule, name: string): Promise<Part>;
|
|
386
385
|
//#endregion
|
|
387
386
|
//#region src/runtime/client/errors.d.ts
|
|
388
387
|
/**
|
|
@@ -395,6 +394,97 @@ declare function loadPart(module: ClientModule, name: string): Promise<Part>;
|
|
|
395
394
|
*/
|
|
396
395
|
declare function fail(scope: Scope | undefined, error: unknown): void;
|
|
397
396
|
//#endregion
|
|
397
|
+
//#region src/runtime/client/waits.d.ts
|
|
398
|
+
/** What a render function of the browser returns. */
|
|
399
|
+
type Out = string | DocumentFragment;
|
|
400
|
+
/**
|
|
401
|
+
* The body of a `#try` that the browser renders, in a boundary of its own that counts as one wait
|
|
402
|
+
* of the boundary around it. A wait of the body that fails ends there, so a `#loading` around the
|
|
403
|
+
* `#try` shows its body, and `fail` renders the `#catch` body in place of the `#try`. Outside a
|
|
404
|
+
* boundary, the body fills in place.
|
|
405
|
+
*/
|
|
406
|
+
declare function attempt(body: () => Out): DocumentFragment;
|
|
407
|
+
/**
|
|
408
|
+
* The wait of cloned markup that reads memos which never change: `write` runs once the ones
|
|
409
|
+
* that are promises settle, as no update writes their values. It counts in the boundary of the
|
|
410
|
+
* render, as `wait` does. A rejection goes to `fail`, once per error and scope, then to `fault`.
|
|
411
|
+
* A scope that goes during the wait ends it with `leave`.
|
|
412
|
+
*/
|
|
413
|
+
declare function fillSettled(id: ScopeId | Scope, values: unknown[], write: (...values: unknown[]) => void): void;
|
|
414
|
+
/**
|
|
415
|
+
* A value of markup that the browser writes, in text or an attribute, which can be a promise.
|
|
416
|
+
* A value that is not one is written at once. A promise counts in the boundary of the render, as
|
|
417
|
+
* a memo of `fillSettled` does, and `write` gets its value once it settles. The scope keeps the
|
|
418
|
+
* latest value of each place, by `key`, so a promise that an update replaced before it settled
|
|
419
|
+
* writes nothing: the latest wins.
|
|
420
|
+
*/
|
|
421
|
+
declare function fillValue(id: ScopeId | Scope, key: number | string, value: unknown, write: (value: unknown) => void): void;
|
|
422
|
+
/**
|
|
423
|
+
* A text insert of cloned markup whose value can be a promise, as `keepText` writes it, or as
|
|
424
|
+
* `appendText` does at the end of the element when `append` is set. A promise leaves an empty
|
|
425
|
+
* text node, which the scope keeps, so an update finds it, and its value takes the place of that
|
|
426
|
+
* node once it settles, in or out of the page.
|
|
427
|
+
*/
|
|
428
|
+
declare function keepValue(id: ScopeId, anchor: number, place: Comment | Element, value: unknown, at?: ScopeId | Scope, append?: boolean): void;
|
|
429
|
+
/**
|
|
430
|
+
* The update of the spreads of an element whose values can be promises, as `attrs` writes them.
|
|
431
|
+
* An attribute whose value is a promise keeps what it shows until the promise settles.
|
|
432
|
+
*/
|
|
433
|
+
declare function fillAttrs(scope: Scope, anchor: number, values: Record<string, unknown>, own?: string[]): void;
|
|
434
|
+
/**
|
|
435
|
+
* The spreads of an element of cloned markup whose values can be promises, as `setSpread` writes
|
|
436
|
+
* them. An attribute whose value is a promise is written once it settles. `place` names the
|
|
437
|
+
* element among the places of the scope: its anchor, which the update of the spread uses too.
|
|
438
|
+
*/
|
|
439
|
+
declare function fillSpread(id: ScopeId, place: number | string, element: Element, attributes: Record<string, unknown>, on?: string[], names?: boolean): void;
|
|
440
|
+
/**
|
|
441
|
+
* The rest of a render after `const x = await $memo(...)`. `slots` are the slots that the code
|
|
442
|
+
* before the `await` set, with the value of the memo at `slot`, and `rest` gets them back.
|
|
443
|
+
*
|
|
444
|
+
* A value goes on at once, in the same render. A promise leaves a range of two comments, and
|
|
445
|
+
* the scope holds `slots` while it waits, so a parent can write its props. The rest renders when
|
|
446
|
+
* the slot holds a value: the first load's, or a newer load's that a prop started, whichever
|
|
447
|
+
* settles as the latest. Its markup fills the range. A rejection, or a throw of `rest`, goes to
|
|
448
|
+
* `fail`. A scope that goes during the wait ends it, and its boundary counts down.
|
|
449
|
+
*/
|
|
450
|
+
declare function wait(id: ScopeId, slots: unknown[], slot: number, rest: (slots: any[]) => Out): Out;
|
|
451
|
+
/**
|
|
452
|
+
* Starts the load of an awaited memo before its `await`, where its inputs are ready. A throw
|
|
453
|
+
* becomes a rejected promise, and a rejection is handled here, so neither surfaces before the
|
|
454
|
+
* `await` waits for the load, which gets the same rejection.
|
|
455
|
+
*/
|
|
456
|
+
declare function started(load: () => unknown): unknown;
|
|
457
|
+
/**
|
|
458
|
+
* Starts the load of an awaited memo that reads other awaited memos once their loads settle.
|
|
459
|
+
* `load` gets their values. A rejection of theirs rejects it too.
|
|
460
|
+
*/
|
|
461
|
+
declare function after(loads: unknown[], load: (...values: any[]) => unknown): unknown;
|
|
462
|
+
/**
|
|
463
|
+
* Counts the memos that markup of a browser render reads and that still load, in the boundary of
|
|
464
|
+
* the render, as the server waits for them. The compiler passes the memos of a scope that markup
|
|
465
|
+
* outside every `#loading` body reads, and the memos that a `#loading` body reads from outside.
|
|
466
|
+
* Each counts down when its value settles. A rejection goes to `fail` and `fault`, as in
|
|
467
|
+
* `fillSettled`. Outside a boundary, the markup fills in when the values arrive.
|
|
468
|
+
*/
|
|
469
|
+
declare function countLoads(id: ScopeId | Scope, values: unknown[]): void;
|
|
470
|
+
/** The order of a `#reveal` block. */
|
|
471
|
+
type RevealOrder = "sequential" | "backwards" | "together" | "natural";
|
|
472
|
+
/**
|
|
473
|
+
* A `#reveal` block in a browser render: the `#loading` blocks that its body renders, also in
|
|
474
|
+
* the components inside it, join one group, as on the server. The group ends with the render,
|
|
475
|
+
* before any body settles, so a block that a later update adds there is not ordered.
|
|
476
|
+
*/
|
|
477
|
+
declare function reveal(order: RevealOrder, collapsed: boolean, body: () => Out): DocumentFragment;
|
|
478
|
+
/**
|
|
479
|
+
* A `#loading` block that the browser renders, as a streamed one shows: the body at once when
|
|
480
|
+
* nothing that it reads loads, and otherwise the fallback, until every wait of the body ends.
|
|
481
|
+
* The body renders now, in a boundary of its own, and enters the page in one insert with its
|
|
482
|
+
* work. A body whose wait fails keeps the fallback, and `fail` reported the error. The `#reveal`
|
|
483
|
+
* block around it can hold a body that is ready for its turn. Updates after that keep the
|
|
484
|
+
* content, since they render no boundary.
|
|
485
|
+
*/
|
|
486
|
+
declare function loading(body: () => Out, fallback?: () => Out): DocumentFragment;
|
|
487
|
+
//#endregion
|
|
398
488
|
//#region src/runtime/client/guesses.d.ts
|
|
399
489
|
/**
|
|
400
490
|
* Writes a guess into an optimistic value. It goes back to its source when
|
|
@@ -430,7 +520,7 @@ declare function attrs(scope: Scope, anchor: number, values: Record<string, unkn
|
|
|
430
520
|
/** The items of a `#for` list: an array as it is, since `list` only reads it, or any iterable as an array. */
|
|
431
521
|
declare function toList(value: Iterable<unknown> | ArrayLike<unknown>): unknown[];
|
|
432
522
|
/** Updates the items of `#for` or `#repeat`, keeping the elements of items whose keys stay. */
|
|
433
|
-
declare function list(scope: Scope, anchor: number, items: unknown[], key: (item: unknown, index: number) => unknown, given: Render, assign: (scope: Scope, item: unknown, index: number) => void, givenFallback: Render | undefined, fallbackKinds: number[], holderKind?: number, holderAnchor?: number,
|
|
523
|
+
declare function list(scope: Scope, anchor: number, items: unknown[], key: (item: unknown, index: number) => unknown, given: Render, assign: (scope: Scope, item: unknown, index: number) => void, givenFallback: Render | undefined, fallbackKinds: number[], holderKind?: number, holderAnchor?: number, givenPark?: Parking): void;
|
|
434
524
|
/**
|
|
435
525
|
* Renders the items of a windowed list that are in view, from `#for … window(height, count)`,
|
|
436
526
|
* with `list`, between the spacers that the server wrote before and after the block. Items that
|
|
@@ -577,12 +667,6 @@ declare function putText(place: Comment, value: unknown, at?: ScopeId | Scope):
|
|
|
577
667
|
declare function setSpread(element: Element, attributes: Record<string, unknown>, on?: string[], names?: boolean): void;
|
|
578
668
|
/** Writes the `b-on` of an element of cloned markup with spreads, as `onAttribute` does. */
|
|
579
669
|
declare function setOn(element: Element, on: string[], own: string): void;
|
|
580
|
-
/**
|
|
581
|
-
* Writes cloned markup that reads memos which never change, once the ones that are promises
|
|
582
|
-
* settle, as no update writes their values. A rejection goes to the nearest `#try` around the
|
|
583
|
-
* scope, or `onError`.
|
|
584
|
-
*/
|
|
585
|
-
declare function fillSettled(scope: ScopeId | Scope, values: unknown[], write: (...values: unknown[]) => void): void;
|
|
586
670
|
/** Writes the content of an element of cloned markup, as `insert` writes it in HTML. */
|
|
587
671
|
declare function setContent(element: Element, value: unknown, at?: ScopeId | Scope): void;
|
|
588
672
|
//#endregion
|
|
@@ -678,5 +762,5 @@ declare const loader: {
|
|
|
678
762
|
updateRoute: typeof updateRoute;
|
|
679
763
|
};
|
|
680
764
|
//#endregion
|
|
681
|
-
export {
|
|
682
|
-
//# sourceMappingURL=client-
|
|
765
|
+
export { windowStart as $, component as $t, setAttrText as A, removeRoot as At, removeScope as B, updateContext as Bt, keep as C, nameComment as Ct, nodes as D, leavePage as Dt, markBlock as E, init as Et, afterInsert as F, spread as Ft, addHead as G, DevtoolsHooks as Gt, sink as H, ClientModule as Ht, createScope as I, submitAction as It, deferInBrowser as J, hooks as Jt, addPortal as K, Scope as Kt, descendants as L, consumeContext as Lt, setOn as M, handle as Mt, setSpread as N, handlerProp as Nt, putText as O, leaveRoutes as Ot, template as P, rpc as Pt, windowList as Q, Component as Qt, getScope as R, provideValue as Rt, fillList as S, loadModule as St, listNodes as T, forget as Tt, prop as U, CoreOptions as Ut, setOwner as V, updateRoute as Vt, spreadProps as W, DEVTOOLS as Wt, list as X, scopes as Xt, setVar as Y, rpcPrefix as Yt, toList as Z, skew as Zt, title as _, retag as _n, loading as _t, cells as a, place as an, text as at, clone as b, wait as bt, isBound as c, children as cn, track as ct, resolve as d, branch as dn, countLoads as dt, componentNodes as en, attr as et, set as f, fill as fn, fillAttrs as ft, updated as g, reset as gn, keepValue as gt, update as h, rekey as hn, fillValue as ht, bindings as i, foreignNodes as in, restRef as it, setContent as j, action as jt, setAttr as k, remount as kt, memo as l, insert as ln, after as lt, unreadMemo as m, offscreen as mn, fillSpread as mt, asyncMemo as n, dynamicNodes as nn, content as nt, effect as o, setItem as on, writeText as ot, timed as p, held as pn, fillSettled as pt, addStyle as q, build as qt, binding as r, elementAt as rn, portalTo as rt, get as s, setSlots as sn, guess as st, loader as t, dynamic as tn, attrs as tt, pending as u, HiddenBody as un, attempt as ut, appendText as v, NavigationReport as vn, reveal as vt, keepText as w, dispose as wt, fillBranch as x, fail as xt, branchNodes as y, started as yt, makeId as z, setGlobal as zt };
|
|
766
|
+
//# sourceMappingURL=client-DvsU9qxG.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dn as skew, sn as build } from "./client-BYHGusTe.js";
|
|
2
2
|
import { n as trustedHTML, r as trustedScript } from "./skew-FRmAy9iy.js";
|
|
3
3
|
//#region src/runtime/defer.ts
|
|
4
4
|
/** The nonce of a script. Browsers hide the attribute once the page loads, and keep the property. */
|
|
@@ -53,4 +53,4 @@ async function loadDeferred(template) {
|
|
|
53
53
|
//#endregion
|
|
54
54
|
export { loadDeferred };
|
|
55
55
|
|
|
56
|
-
//# sourceMappingURL=defer-
|
|
56
|
+
//# sourceMappingURL=defer-B63oF5Oa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defer-
|
|
1
|
+
{"version":3,"file":"defer-B63oF5Oa.js","names":[],"sources":["../src/runtime/defer.ts"],"sourcesContent":["// Loads the body of a `#defer` block. The loader imports this module when\n// the block's trigger fires, so a page without `#defer` does not load it.\n//\n// The server renders the route again for the request and answers with what\n// it streams for a `#loading` body that is ready: the body in a\n// `<template b-l>`, the script that swaps it in, and its state records.\n// This module adds that markup to the page and runs its scripts, in order.\n\nimport { build, skew } from './client.ts';\nimport { trustedHTML, trustedScript } from './trusted.ts';\n/** The nonce of a script. Browsers hide the attribute once the page loads, and keep the property. */\nfunction readNonce(script: HTMLScriptElement): string | null {\n return script.nonce || script.getAttribute('nonce');\n}\n\n/** The Content Security Policy nonce of the page, which the scripts of the answer need to run. */\nfunction pageNonce(): string | undefined {\n for (const script of document.querySelectorAll('script')) {\n const nonce = readNonce(script);\n if (nonce) {\n return nonce;\n }\n }\n return undefined;\n}\n\n/** The templates whose bodies were asked for. */\nconst requested = new WeakSet<Element>();\n\n/**\n * Asks the server for the body of the `#defer` block of a `<template\n * b-defer>`, and puts it in place of the fallback. When the server cannot\n * render it, such as a page that changed since it loaded, or a static host\n * that answers with the whole page, the fallback stays.\n */\nexport async function loadDeferred(template: Element): Promise<void> {\n // Once, so the devtools can fire the trigger before the loader does.\n if (requested.has(template)) {\n return;\n }\n requested.add(template);\n const [, boundary, base] = template.getAttribute('b-defer')!.split(':') as [\n string,\n string,\n string,\n ];\n const response = await fetch(location.href, {\n headers: {\n 'x-brumate-defer': `${boundary} ${template.getAttribute('b-b')}`,\n 'x-brumate-base': base,\n ...(build === undefined ? {} : { 'x-brumate-build': build }),\n },\n });\n if (response.status === 409 && response.headers.get('x-brumate-build')) {\n // The site changed since the page loaded. The fallback stays, and the next page loads in full.\n skew('defer');\n return;\n }\n if (!response.ok || response.headers.get('x-brumate-defer') !== boundary) {\n return;\n }\n const parsed = document.createElement('template');\n parsed.innerHTML = trustedHTML(await response.text());\n const nonce = pageNonce();\n // A copy, because appending moves nodes out of the live list.\n for (const node of Array.from(parsed.content.childNodes)) {\n if (node.nodeName !== 'SCRIPT') {\n document.body.append(node);\n continue;\n }\n // A script from `innerHTML` does not run, so a copy goes in its place.\n const script = node as HTMLScriptElement;\n const copy = document.createElement('script');\n for (const attribute of script.attributes) {\n if (attribute.name !== 'nonce') {\n copy.setAttribute(attribute.name, attribute.value);\n }\n }\n if (nonce) {\n copy.nonce = nonce;\n }\n copy.textContent = trustedScript(script.textContent ?? '');\n document.body.append(copy);\n }\n}\n"],"mappings":";;;;AAWA,SAAS,UAAU,QAA0C;CAC3D,OAAO,OAAO,SAAS,OAAO,aAAa,OAAO;AACpD;;AAGA,SAAS,YAAgC;CACvC,KAAK,MAAM,UAAU,SAAS,iBAAiB,QAAQ,GAAG;EACxD,MAAM,QAAQ,UAAU,MAAM;EAC9B,IAAI,OACF,OAAO;CAEX;AAEF;;AAGA,MAAM,4BAAY,IAAI,QAAiB;;;;;;;AAQvC,eAAsB,aAAa,UAAkC;CAEnE,IAAI,UAAU,IAAI,QAAQ,GACxB;CAEF,UAAU,IAAI,QAAQ;CACtB,MAAM,GAAG,UAAU,QAAQ,SAAS,aAAa,SAAS,CAAC,CAAE,MAAM,GAAG;CAKtE,MAAM,WAAW,MAAM,MAAM,SAAS,MAAM,EAC1C,SAAS;EACP,mBAAmB,GAAG,SAAS,GAAG,SAAS,aAAa,KAAK;EAC7D,kBAAkB;EAClB,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,mBAAmB,MAAM;CAC5D,EACF,CAAC;CACD,IAAI,SAAS,WAAW,OAAO,SAAS,QAAQ,IAAI,iBAAiB,GAAG;EAEtE,KAAK,OAAO;EACZ;CACF;CACA,IAAI,CAAC,SAAS,MAAM,SAAS,QAAQ,IAAI,iBAAiB,MAAM,UAC9D;CAEF,MAAM,SAAS,SAAS,cAAc,UAAU;CAChD,OAAO,YAAY,YAAY,MAAM,SAAS,KAAK,CAAC;CACpD,MAAM,QAAQ,UAAU;CAExB,KAAK,MAAM,QAAQ,MAAM,KAAK,OAAO,QAAQ,UAAU,GAAG;EACxD,IAAI,KAAK,aAAa,UAAU;GAC9B,SAAS,KAAK,OAAO,IAAI;GACzB;EACF;EAEA,MAAM,SAAS;EACf,MAAM,OAAO,SAAS,cAAc,QAAQ;EAC5C,KAAK,MAAM,aAAa,OAAO,YAC7B,IAAI,UAAU,SAAS,SACrB,KAAK,aAAa,UAAU,MAAM,UAAU,KAAK;EAGrD,IAAI,OACF,KAAK,QAAQ;EAEf,KAAK,cAAc,cAAc,OAAO,eAAe,EAAE;EACzD,SAAS,KAAK,OAAO,IAAI;CAC3B;AACF"}
|
|
@@ -136,7 +136,7 @@ function reportError(state, payload, source) {
|
|
|
136
136
|
}
|
|
137
137
|
/** The code of the panel, which loads when it opens. */
|
|
138
138
|
function panelModule() {
|
|
139
|
-
return import("./devtools-panel-
|
|
139
|
+
return import("./devtools-panel-B9yokst5.js");
|
|
140
140
|
}
|
|
141
141
|
/** Where the choice to outline changed elements is kept. */
|
|
142
142
|
const FLASH_KEY = "brumate:devtools:flash";
|
|
@@ -438,7 +438,7 @@ function installDevtools(endpoint = "/__brumate/inspect", rpc = "/_brumate", met
|
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
440
|
state.fire = (block) => {
|
|
441
|
-
if (block.kind === "defer" && block.template) deferred(block.template, import("./defer-
|
|
441
|
+
if (block.kind === "defer" && block.template) deferred(block.template, import("./defer-B63oF5Oa.js").then((module) => module.loadDeferred(block.template)));
|
|
442
442
|
else if (block.template && block.ref) state.handle?.(block.template, block.ref);
|
|
443
443
|
};
|
|
444
444
|
if (typeof MutationObserver !== "undefined") {
|
|
@@ -543,7 +543,7 @@ function installDevtools(endpoint = "/__brumate/inspect", rpc = "/_brumate", met
|
|
|
543
543
|
}
|
|
544
544
|
});
|
|
545
545
|
state.open = (tab) => {
|
|
546
|
-
import("./devtools-panel-
|
|
546
|
+
import("./devtools-panel-B9yokst5.js").then(({ openPanel }) => openPanel(root, state, tab));
|
|
547
547
|
};
|
|
548
548
|
root.append(style, button);
|
|
549
549
|
installFlash(state, root, host);
|
|
@@ -594,4 +594,4 @@ function installDevtools(endpoint = "/__brumate/inspect", rpc = "/_brumate", met
|
|
|
594
594
|
//#endregion
|
|
595
595
|
export { scanBlocks as a, reportError as i, installDevtools as n, preview as r, findRootScope as t };
|
|
596
596
|
|
|
597
|
-
//# sourceMappingURL=devtools-
|
|
597
|
+
//# sourceMappingURL=devtools-D_SQpXTg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-BJB_MMeL.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' | '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/** 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/** 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 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\nimport { LOGO } from './logo.ts';\n\nexport { LOGO };\n\n/** The root scope of a scope, whose `m` names its component. */\nexport function findRootScope(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 function 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. */\nfunction panelModule(): Promise<typeof Panel> {\n return import('./devtools-panel.ts');\n}\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 function 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 let added = 0;\n for (const node of record.addedNodes) {\n if (node.nodeType === 1) {\n pending.add(node as Element);\n added++;\n }\n }\n if (added > 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. */\nfunction foreign(stack: string | undefined, file = ''): boolean {\n return (\n /^[a-z-]+-extension:/.test(file) ||\n (stack !== undefined &&\n /[a-z-]+-extension:\\/\\//.test(stack) &&\n !stack.includes(location.origin))\n );\n}\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 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 function 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 function 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 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 if (element.tagName === 'TEMPLATE') {\n let block: BlockEntry | undefined;\n for (const item of state.blocks.values()) {\n if (item.template === element) {\n block = item;\n break;\n }\n }\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 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: findRootScope(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 = findRootScope(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 let anchor: Node | undefined;\n for (const node of shown) {\n if (node.parentNode) {\n anchor = node;\n break;\n }\n }\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 function deferred(template: Element, done: Promise<unknown>): void {\n let block: BlockEntry | undefined;\n for (const item of state.blocks.values()) {\n if (item.template === template) {\n block = item;\n break;\n }\n }\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 function 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 function 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 function 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 const remaining: ErrorEntry[] = [];\n for (const error of state.errors) {\n if (error.source !== 'compile') {\n remaining.push(error);\n }\n }\n state.errors = remaining;\n if (state.errors.length !== before) {\n state.errorCount?.();\n state.changed?.();\n }\n });\n function 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;AAyK9C,MAAM,UAAU;;AAOhB,SAAgB,cAAc,OAAqB;CACjD,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,aAAa;EAChC,OAAO,QAAQ,SAAS,WAAW,OAAO,I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IAAI,MAAM,OAAO,WAAW,QAAQ;GAClC,MAAM,aAAa;GACnB,MAAM,UAAU;EAClB;CACF,CAAC;CACD,SAAS,SAAe;EAEtB,SAAS,gBAAgB,OAAO,IAAI;CACtC;CACA,IAAI,SAAS,eAAe,WAC1B,SAAS,iBAAiB,oBAAoB,MAAM;MAEpD,OAAO;CAET,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"devtools-D_SQpXTg.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' | '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/** 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/** 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 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\nimport { LOGO } from './logo.ts';\n\nexport { LOGO };\n\n/** The root scope of a scope, whose `m` names its component. */\nexport function findRootScope(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 function 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. */\nfunction panelModule(): Promise<typeof Panel> {\n return import('./devtools-panel.ts');\n}\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 function 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 let added = 0;\n for (const node of record.addedNodes) {\n if (node.nodeType === 1) {\n pending.add(node as Element);\n added++;\n }\n }\n if (added > 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. */\nfunction foreign(stack: string | undefined, file = ''): boolean {\n return (\n /^[a-z-]+-extension:/.test(file) ||\n (stack !== undefined &&\n /[a-z-]+-extension:\\/\\//.test(stack) &&\n !stack.includes(location.origin))\n );\n}\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 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 function 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 function 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 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 if (element.tagName === 'TEMPLATE') {\n let block: BlockEntry | undefined;\n for (const item of state.blocks.values()) {\n if (item.template === element) {\n block = item;\n break;\n }\n }\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 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: findRootScope(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 = findRootScope(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 let anchor: Node | undefined;\n for (const node of shown) {\n if (node.parentNode) {\n anchor = node;\n break;\n }\n }\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 function deferred(template: Element, done: Promise<unknown>): void {\n let block: BlockEntry | undefined;\n for (const item of state.blocks.values()) {\n if (item.template === template) {\n block = item;\n break;\n }\n }\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 function 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 function 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 function 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 const remaining: ErrorEntry[] = [];\n for (const error of state.errors) {\n if (error.source !== 'compile') {\n remaining.push(error);\n }\n }\n state.errors = remaining;\n if (state.errors.length !== before) {\n state.errorCount?.();\n state.changed?.();\n }\n });\n function 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;AAyK9C,MAAM,UAAU;;AAOhB,SAAgB,cAAc,OAAqB;CACjD,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,aAAa;EAChC,OAAO,QAAQ,SAAS,WAAW,OAAO,IAAI,OAAO,KAAK,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;CAC1F;CACA,OAAO,OAAO,KAAK;AACrB;;;;;;;;;;;AAYA,SAAgB,WAAW,OAA+B;CACxD,MAAM,MAAM,YAAY,IAAI;CAC5B,IAAI,UAAU;CACd,MAAM,uBAAO,IAAI,IAAqB;CACtC,MAAM,0BAAU,IAAI,IAAqB;CACzC,MAAM,SAAS,SAAS,iBAAiB,UAAU,WAAW,YAAY;CAC1E,KAAK,IAAI,OAAO,OAAO,SAAS,GAAG,MAAM,OAAO,OAAO,SAAS,GAAG;EACjE,MAAM,OAAQ,KAAiB;EAC/B,IAAI,aAAa,KAAK,IAAI,GACxB,KAAK,IAAI,KAAK,MAAM,CAAC,GAAG,IAAe;OAClC,IAAI,iBAAiB,KAAK,IAAI,GACnC,QAAQ,IAAI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O,WAAW,MAAM;GAAS,OAAO,OAAO;EAAM,GAChE,SACF;CACF,CAAC;CACD,iBAAiB,uBAAuB,UAAU;EAChD,MAAM,SAAS,MAAM;EACrB,IAAI,QAAQ,QAAQ,KAAK,GACvB;EAEF,YACE,OACA;GAAE,SAAS,QAAQ,WAAW,OAAO,MAAM,MAAM;GAAG,OAAO,QAAQ;EAAM,GACzE,SACF;CACF,CAAC;CAGD,iBAAiB,kBAAkB,UAAU;EAC3C,MAAM,QAAS,MAA0C,OAAO;EAChE,YACE,OACA;GAAE,SAAS,OAAO,WAAW,OAAO,KAAK;GAAG,OAAO,OAAO;EAAM,GAChE,SACF;CACF,CAAC;CAGD,KAAK,GAAG,eAAe,YAAmC;EACxD,YAAY,OAAO,QAAQ,KAAK,SAAS;CAC3C,CAAC;CACD,KAAK,GAAG,0BAA0B;EAChC,MAAM,SAAS,MAAM,OAAO;EAC5B,MAAM,YAA0B,CAAC;EACjC,KAAK,MAAM,SAAS,MAAM,QACxB,IAAI,MAAM,WAAW,WACnB,UAAU,KAAK,KAAK;EAGxB,MAAM,SAAS;EACf,IAAI,MAAM,OAAO,WAAW,QAAQ;GAClC,MAAM,aAAa;GACnB,MAAM,UAAU;EAClB;CACF,CAAC;CACD,SAAS,SAAe;EAEtB,SAAS,gBAAgB,OAAO,IAAI;CACtC;CACA,IAAI,SAAS,eAAe,WAC1B,SAAS,iBAAiB,oBAAoB,MAAM;MAEpD,OAAO;CAET,OAAO;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as LOGO } from "./logo-DQ_OYhBi.js";
|
|
2
|
-
import { r as preview, t as findRootScope } from "./devtools-
|
|
2
|
+
import { r as preview, t as findRootScope } from "./devtools-D_SQpXTg.js";
|
|
3
3
|
//#region src/runtime/devtools-panel.ts
|
|
4
4
|
const STYLE = `
|
|
5
5
|
:host { all: initial; }
|
|
@@ -1991,4 +1991,4 @@ function togglePanel(root, state, initial = "overview") {
|
|
|
1991
1991
|
//#endregion
|
|
1992
1992
|
export { layoutGraph, openPanel, togglePanel };
|
|
1993
1993
|
|
|
1994
|
-
//# sourceMappingURL=devtools-panel-
|
|
1994
|
+
//# sourceMappingURL=devtools-panel-B9yokst5.js.map
|