brumate 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +2 -2
  2. package/check.d.ts +49 -0
  3. package/dist/{boot-C25Sa6vq.d.ts → boot-DLlRmD9z.d.ts} +8 -10
  4. package/dist/cli.js +275 -15
  5. package/dist/cli.js.map +1 -1
  6. package/dist/client-BvDsC6Qr.js +3463 -0
  7. package/dist/client-BvDsC6Qr.js.map +1 -0
  8. package/dist/{client-D0CqSxoO.d.ts → client-DBwL2wKQ.d.ts} +390 -181
  9. package/dist/{client-routes-JTbGtukf.js → client-routes-BtGpYCef.js} +60 -30
  10. package/dist/client-routes-BtGpYCef.js.map +1 -0
  11. package/dist/{cookies-BzllthiF.js → cookies-Cnbf4w-S.js} +14 -7
  12. package/dist/cookies-Cnbf4w-S.js.map +1 -0
  13. package/dist/{defer-BbD7JQhj.js → defer-CKWZLv2K.js} +4 -4
  14. package/dist/defer-CKWZLv2K.js.map +1 -0
  15. package/dist/{devtools-CQgD7NPB.js → devtools-4uTPwR_v.js} +56 -82
  16. package/dist/devtools-4uTPwR_v.js.map +1 -0
  17. package/dist/{devtools-panel-BVB-W5q4.js → devtools-panel-Be9pxYgv.js} +397 -333
  18. package/dist/devtools-panel-Be9pxYgv.js.map +1 -0
  19. package/dist/{events-CSs7OwIC.js → events-LgLdp1R7.js} +34 -5
  20. package/dist/events-LgLdp1R7.js.map +1 -0
  21. package/dist/features-CHY5Ekku.js +30 -0
  22. package/dist/features-CHY5Ekku.js.map +1 -0
  23. package/dist/files-WW4RlajL.js +506 -0
  24. package/dist/files-WW4RlajL.js.map +1 -0
  25. package/dist/{forms-Cl21hkHt.d.ts → forms-j1xPAR14.d.ts} +3 -3
  26. package/dist/{forms-Bg-CwGqX.js → forms-nXK7-Lv_.js} +78 -44
  27. package/dist/forms-nXK7-Lv_.js.map +1 -0
  28. package/dist/highlight.js +31 -22
  29. package/dist/highlight.js.map +1 -1
  30. package/dist/{html-mNTKzaDD.js → html-BtKRyi7g.js} +86 -22
  31. package/dist/html-BtKRyi7g.js.map +1 -0
  32. package/dist/{html-Bq1rFxX_.d.ts → html-Bw9Qwu6F.d.ts} +20 -5
  33. package/dist/index.d.ts +96 -10
  34. package/dist/index.js +639 -104
  35. package/dist/index.js.map +1 -1
  36. package/dist/{inspect-BHpOw1LF.js → inspect-Y6y4uNZp.js} +3751 -676
  37. package/dist/inspect-Y6y4uNZp.js.map +1 -0
  38. package/dist/{loader-Dos_3NP0.js → loader-BjKGJzLN.js} +20 -14
  39. package/dist/loader-BjKGJzLN.js.map +1 -0
  40. package/dist/logo-DQ_OYhBi.js +10 -0
  41. package/dist/logo-DQ_OYhBi.js.map +1 -0
  42. package/dist/{navigate-O78d_zGN.js → navigate-CfOr-TRF.js} +94 -31
  43. package/dist/navigate-CfOr-TRF.js.map +1 -0
  44. package/dist/nesting-DA5vJw9X.js +265 -0
  45. package/dist/nesting-DA5vJw9X.js.map +1 -0
  46. package/dist/{produce-Doc91GkX.js → produce-B7X9ori9.js} +137 -9
  47. package/dist/produce-B7X9ori9.js.map +1 -0
  48. package/dist/{produce-D0V0ICkz.d.ts → produce-DIgHBVwL.d.ts} +39 -5
  49. package/dist/{rpc-ygMRPmN4.js → rpc-Q-XkLwFh.js} +11 -6
  50. package/dist/rpc-Q-XkLwFh.js.map +1 -0
  51. package/dist/runtime/batch.js +9 -7
  52. package/dist/runtime/batch.js.map +1 -1
  53. package/dist/runtime/client.d.ts +4 -4
  54. package/dist/runtime/client.js +4 -4
  55. package/dist/runtime/devtools.d.ts +11 -29
  56. package/dist/runtime/devtools.js +3 -1
  57. package/dist/runtime/env.js +14 -2
  58. package/dist/runtime/env.js.map +1 -1
  59. package/dist/runtime/events.d.ts +23 -1
  60. package/dist/runtime/events.js +1 -1
  61. package/dist/runtime/forms.d.ts +2 -2
  62. package/dist/runtime/forms.js +1 -1
  63. package/dist/runtime/hot.d.ts +1 -1
  64. package/dist/runtime/hot.js +5 -2
  65. package/dist/runtime/hot.js.map +1 -1
  66. package/dist/runtime/html.d.ts +2 -2
  67. package/dist/runtime/html.js +1 -1
  68. package/dist/runtime/loader.d.ts +2 -2
  69. package/dist/runtime/loader.js +2 -2
  70. package/dist/runtime/routes.js +4 -1
  71. package/dist/runtime/routes.js.map +1 -1
  72. package/dist/runtime/server.d.ts +5 -5
  73. package/dist/runtime/server.js +5 -5
  74. package/dist/runtime/signals.d.ts +38 -1
  75. package/dist/runtime/signals.js +33 -1
  76. package/dist/runtime/signals.js.map +1 -1
  77. package/dist/runtime/static-loader.d.ts +2 -2
  78. package/dist/runtime/static-loader.js +1 -1
  79. package/dist/runtime/testing.d.ts +18 -3
  80. package/dist/runtime/testing.js +150 -33
  81. package/dist/runtime/testing.js.map +1 -1
  82. package/dist/{server-DuFYRXrd.d.ts → server-BvPIg9pT.d.ts} +84 -22
  83. package/dist/{server-CxVDYE_V.js → server-DjyOVJtJ.js} +598 -164
  84. package/dist/server-DjyOVJtJ.js.map +1 -0
  85. package/dist/{static-loader-Drpr0AzI.d.ts → static-loader-BGgdp_Y5.d.ts} +2 -2
  86. package/dist/{static-loader-nZssh66R.js → static-loader-BZR17hSw.js} +78 -99
  87. package/dist/static-loader-BZR17hSw.js.map +1 -0
  88. package/dist/{stream-DCYZO4IF.js → stream-BP5AVmg5.js} +102 -16
  89. package/dist/stream-BP5AVmg5.js.map +1 -0
  90. package/dist/vite.d.ts +13 -20
  91. package/dist/vite.js +1890 -548
  92. package/dist/vite.js.map +1 -1
  93. package/elements.d.ts +951 -0
  94. package/forms/forms.brm.ts +3 -3
  95. package/package.json +12 -3
  96. package/skills/brumate/SKILL.md +58 -0
  97. package/skills/brumate/references/errors.md +2078 -0
  98. package/skills/brumate/references/events.md +117 -0
  99. package/skills/brumate/references/signals.md +61 -0
  100. package/skills/brumate/references/state.md +235 -0
  101. package/skills/brumate/references/syntax.md +250 -0
  102. package/types.d.ts +4 -4
  103. package/dist/client-BD6XT-s5.js +0 -1968
  104. package/dist/client-BD6XT-s5.js.map +0 -1
  105. package/dist/client-routes-JTbGtukf.js.map +0 -1
  106. package/dist/cookies-BzllthiF.js.map +0 -1
  107. package/dist/defer-BbD7JQhj.js.map +0 -1
  108. package/dist/devtools-CQgD7NPB.js.map +0 -1
  109. package/dist/devtools-panel-BVB-W5q4.js.map +0 -1
  110. package/dist/events-CSs7OwIC.js.map +0 -1
  111. package/dist/files-BXSSrQgc.js +0 -205
  112. package/dist/files-BXSSrQgc.js.map +0 -1
  113. package/dist/forms-Bg-CwGqX.js.map +0 -1
  114. package/dist/html-mNTKzaDD.js.map +0 -1
  115. package/dist/inspect-BHpOw1LF.js.map +0 -1
  116. package/dist/loader-Dos_3NP0.js.map +0 -1
  117. package/dist/navigate-O78d_zGN.js.map +0 -1
  118. package/dist/produce-Doc91GkX.js.map +0 -1
  119. package/dist/rpc-ygMRPmN4.js.map +0 -1
  120. package/dist/server-CxVDYE_V.js.map +0 -1
  121. package/dist/static-loader-nZssh66R.js.map +0 -1
  122. package/dist/stream-DCYZO4IF.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools-panel-Be9pxYgv.js","names":[],"sources":["../src/runtime/devtools-panel.ts"],"sourcesContent":["// The panel of the devtools overlay. It reads the core through the hooks in\n// `devtools.ts`, and asks the dev server about each component. It docks at\n// the bottom of the page, and its height can be dragged.\n//\n// - Overview: the versions, the page, and each component on it.\n// - Errors: errors of a render on the server, of Vite and of the browser,\n// with the code of the selected place highlighted by twinkleplop, in place\n// of Vite's overlay.\n// - Components: the scopes of each component, and the value of each slot by\n// name. A value can be edited, which writes it as a handler does.\n// - Elements: the element that Pick found: its scope and anchor, its place in\n// the file, its handlers with their parts, and the values its updates read.\n// - Graph: the values and markup of a component that change in the browser,\n// and what reads what. A write marks its node and the nodes after it.\n// - Log: handlers, writes and server function calls.\n// - Blocks: the `#loading`, `#defer`, `#client` blocks and `$client`\n// callbacks of the page, with their state. A trigger can fire now.\n// - Report: the inspect report of a component.\n\nimport type { TraceEntry } from './request.ts';\nimport type * as Highlight from '../highlight.ts';\nimport type { Scope } from './client.ts';\nimport type { ScopeId } from './shared.ts';\nimport { LOGO, preview, findRootScope } from './devtools.ts';\nimport type {\n BlockEntry,\n DevtoolsEntry,\n DevtoolsState,\n ErrorEntry,\n Interaction,\n} from './devtools.ts';\n\n/** What the dev server tells about a component: see the inspect endpoint of the plugin. */\ninterface ComponentInfo {\n name: string;\n file: string;\n /** Each scope of the component, by its number in the compiled component. */\n scopes: Record<number, { label: string; slots: string[]; readers?: string[][] }>;\n graph?: {\n nodes: GraphNode[];\n /** Pairs of node indexes: the first is read by the second. */\n edges: [number, number][];\n };\n /** The inspect report as text. */\n text: string;\n /** The absolute path of the file, for the editor. */\n path?: string;\n /** The URL that the browser loads the client code of the component from. */\n url?: string;\n /** Each anchor of each scope: what it is, its place in the file and what its updates read. */\n anchors?: Record<number, Record<number, { label: string; at?: string; reads: string[] }>>;\n}\n\n/** A node of the graph of a component. */\ninterface GraphNode {\n kind: string;\n label: string;\n scope: number;\n slot?: number;\n}\n\nconst STYLE = `\n:host { all: initial; }\n.panel {\n --bg: #121113; --surface: #19181a; --raised: #222023; --hover: #2a282c; --line: #2f2c31;\n --text: #ece8e4; --dim: #a39a92; --faint: #6f6862; --accent: #ee7a3e;\n --blue: #7cb7ff; --purple: #c49bff; --green: #7fd99a; --yellow: #ffd166; --red: #ff7a7a;\n --mono: ui-monospace, SFMono-Regular, Menlo, monospace;\n position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147483647;\n display: flex; flex-direction: column; min-height: 160px; max-height: 90vh;\n background: var(--bg); color: var(--text); border-top: 1px solid var(--line);\n box-shadow: 0 -8px 32px #0007; font: 12px/1.5 system-ui, -apple-system, sans-serif;\n color-scheme: dark;\n}\n.resize { position: absolute; top: -4px; left: 0; right: 0; height: 8px; cursor: ns-resize; }\n.top { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; overflow: hidden; }\n.brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; letter-spacing: -0.01em; }\n.brand i { display: inline-block; width: 18px; height: 18px; }\n.chip { padding: 1px 7px; border-radius: 999px; background: var(--raised); color: var(--dim); font: 11px var(--mono); }\n.chip.accent { background: #ee7a3e22; color: #ffb48a; }\n.route { font: 12px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; }\n.stats { color: var(--dim); overflow: hidden; text-overflow: ellipsis; }\n.spacer { flex: 1; }\nbutton, select, input { font: inherit; color: inherit; }\nbutton { background: none; border: 1px solid transparent; border-radius: 6px; padding: 2px 8px; cursor: pointer; }\nbutton:hover { background: var(--hover); }\nbutton:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }\nbutton.tool { display: inline-flex; align-items: center; gap: 6px; border-color: var(--line); background: var(--surface); }\nbutton.tool .icon { color: var(--dim); flex: none; }\nbutton.tool:hover .icon { color: var(--text); }\nbutton.tool.only { padding: 3px 5px; }\n.link { display: inline-flex; align-items: center; gap: 4px; }\n.link .icon { opacity: 0.7; }\n.zoom button.tool { background: var(--raised); }\nbutton.tool[aria-pressed=\"true\"] { border-color: var(--accent); background: #ee7a3e22; color: #ffb48a; }\nselect, input[type=\"search\"] { background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }\n.main { flex: 1; display: flex; min-height: 0; }\n.nav { display: flex; flex-direction: column; gap: 1px; padding: 6px; width: 156px; flex: none; border-right: 1px solid var(--line); background: var(--surface); overflow: auto; }\n.nav .tab { display: flex; justify-content: space-between; align-items: center; text-align: left; padding: 4px 8px; color: var(--dim); }\n.nav .tab { gap: 8px; }\n.nav .tab .label { flex: 1; }\n.icon { flex: none; }\n.nav .tab .icon { color: var(--faint); transition: color 0.15s; }\n.nav .tab:hover .icon { color: var(--dim); }\n.nav .tab[aria-selected=\"true\"] { background: var(--raised); color: var(--text); box-shadow: 0 0 0 1px var(--line); }\n.nav .tab[aria-selected=\"true\"] .icon { color: var(--accent); }\n.badge { min-width: 16px; padding: 0 5px; border-radius: 999px; background: var(--raised); color: var(--dim); font: 10px/16px var(--mono); text-align: center; }\n.badge:empty { display: none; }\n.tab[aria-selected=\"true\"] .badge { background: var(--hover); }\n.badge.warn { background: #ffd16622; color: var(--yellow); }\n.badge.error, .tab[aria-selected=\"true\"] .badge.error { background: #e5484d; color: #fff; }\n.error-message { margin: 0 0 8px; color: var(--red); font: 600 14px/1.4 var(--mono); white-space: pre-wrap; }\n.error-row { display: block; width: 100%; text-align: left; padding: 6px 8px; border-radius: 6px; }\n.error-row[aria-current=\"true\"] { background: #e5484d14; box-shadow: 0 0 0 1px #e5484d40; }\n.error-row .text { display: block; color: var(--text); font: 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.error-row .when { color: var(--faint); font-size: 11px; }\n.code { margin: 6px 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #0d1117; overflow: auto; }\n.code .twinkleplop { margin: 0; padding: 8px 0; font: 12px/1.6 var(--mono); background: none; white-space: normal; }\n.code .l { display: block; padding: 0 12px 0 0; white-space: pre; min-height: 1.6em; }\n.code .ln { display: inline-block; width: 44px; padding-right: 12px; text-align: right; color: var(--faint); user-select: none; }\n.code .l.error-line { background: #e5484d24; }\n.code .l.error-line .ln { color: var(--red); }\n.code .error-mark { text-decoration: wavy underline #e5484d; text-underline-offset: 3px; }\n.code pre.plain { margin: 0; padding: 8px 12px; font: 12px/1.6 var(--mono); white-space: pre; }\n.frames { display: flex; flex-direction: column; gap: 1px; }\n.frame { display: flex; gap: 10px; width: 100%; text-align: left; padding: 3px 8px; border-radius: 5px; font: 11.5px var(--mono); }\n.frame .fn { color: var(--text); white-space: nowrap; }\n.frame .where { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.frame.library .fn, .frame.library .where { color: var(--faint); }\n.frame[aria-current=\"true\"] { background: #ee7a3e14; box-shadow: 0 0 0 1px #ee7a3e40; }\n.frame[aria-current=\"true\"] .fn { color: #ffb48a; }\n.body { flex: 1; overflow: auto; padding: 12px 14px; min-width: 0; }\n.split { display: flex; height: calc(100% + 24px); margin: -12px -14px; }\n.split > .list { width: 280px; flex: none; overflow: auto; border-right: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 1px; }\n.split > .list input { margin-bottom: 6px; }\n.split > .detail { flex: 1; overflow: auto; padding: 12px 14px; min-width: 0; }\nh2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }\nh3 { margin: 14px 0 6px; font-size: 11px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }\n.sub { color: var(--dim); font-weight: 400; }\n.mono { font-family: var(--mono); }\n.empty { color: var(--faint); padding: 16px 0; }\n.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }\n.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 6px; }\n.card { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }\n.card .label { color: var(--dim); font-size: 11px; }\n.card .value { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }\n.card .note { color: var(--faint); font-size: 11px; }\n.rows { width: 100%; border-collapse: collapse; }\n.rows th { text-align: left; color: var(--faint); font-weight: 500; font-size: 11px; }\n.rows td, .rows th { padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }\n.rows tr:hover td { background: #ffffff05; }\n.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; align-items: baseline; }\n.kv > :nth-child(odd) { color: var(--dim); }\n.pill { display: inline-block; padding: 0 7px; border-radius: 999px; font: 11px/18px var(--mono); background: var(--raised); color: var(--dim); white-space: nowrap; }\n.pill.blue { background: #7cb7ff1f; color: var(--blue); } .pill.purple { background: #c49bff1f; color: var(--purple); }\n.pill.green { background: #7fd99a1f; color: var(--green); } .pill.yellow { background: #ffd1661f; color: var(--yellow); }\n.pill.red { background: #ff7a7a1f; color: var(--red); } .pill.accent { background: #ee7a3e22; color: #ffb48a; }\n.pill .name { color: #ffc28f; }\n.link { color: var(--blue); padding: 0; border: 0; font-family: var(--mono); text-align: left; }\n.link:hover { background: none; text-decoration: underline; }\n.tree-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 2px 6px; border-radius: 5px; }\n.tree-row.component { font-weight: 600; margin-top: 4px; }\n.tree-row .file { color: var(--faint); font: 11px var(--mono); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.tree-row[aria-current=\"true\"] { background: #ee7a3e14; box-shadow: 0 0 0 1px #ee7a3e40; }\n.tree-row[aria-current=\"true\"] > span:first-child { color: #ffb48a; }\n.written { animation: flash 0.8s; }\n@keyframes flash { from { background: #ffd16633; } to { background: transparent; } }\n.slots td.name { color: #ffc28f; font-family: var(--mono); width: 1%; white-space: nowrap; }\n.slots td.type { color: var(--faint); font-family: var(--mono); width: 1%; white-space: nowrap; }\n.slot .value { font-family: var(--mono); cursor: text; border-bottom: 1px dotted var(--faint); }\n.slot .value.fixed { cursor: default; border: 0; }\n.slot input { font: 12px var(--mono); color: var(--text); background: #000; border: 1px solid var(--accent); border-radius: 4px; padding: 1px 6px; width: 100%; box-sizing: border-box; }\n.filters label { display: inline-flex; gap: 4px; align-items: center; padding: 1px 8px; border-radius: 999px; background: var(--raised); cursor: pointer; }\n.entry td { font-family: var(--mono); }\n.entry .time { color: var(--faint); white-space: nowrap; width: 1%; }\n.kind-handler { color: var(--blue); } .kind-part { color: var(--green); } .kind-write { color: var(--yellow); } .kind-call { color: #ff9ecf; }\n.bar-cell { width: 40%; min-width: 160px; }\n.navigation { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }\n.navigation .routes { display: flex; flex-direction: column; gap: 3px; }\ntr.large td, tr.busy td { color: var(--yellow); }\ntr.ended td { color: var(--faint); }\n.bar-track { position: relative; height: 12px; }\n.bar { position: absolute; top: 2px; height: 8px; min-width: 3px; border-radius: 3px; background: var(--blue); }\n.bar.failed { background: var(--red); }\n.bar.render { background: var(--accent); } .bar.memo { background: var(--green); } .bar.body { background: var(--purple); } .bar.stream { background: var(--faint); }\ntr.failed td:not(.bar-cell) { color: var(--red); }\n.interaction { margin-bottom: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }\n.run-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }\n.run-head .what { font-weight: 600; }\n.run-head .ref { color: var(--dim); font: 11.5px var(--mono); }\n.run-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 90px; align-items: center; gap: 10px; font: 11.5px var(--mono); color: var(--dim); }\n.run-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.run-row .took { text-align: right; color: var(--text); }\n.track { position: relative; height: 14px; overflow: hidden; border-radius: 4px; background-color: #ffffff08; }\n.ruler { position: relative; height: 16px; color: var(--faint); font: 10.5px var(--mono); }\n.ruler span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }\n.ruler span:first-child { transform: none; }\n.ruler span.end { transform: translateX(-100%); }\n.seg { position: absolute; top: 3px; height: 8px; min-width: 2px; border-radius: 3px; }\n.seg.wait { background: repeating-linear-gradient(45deg, var(--faint) 0 3px, transparent 3px 6px); }\n.seg.run { background: var(--blue); }\n.seg.async { background: #7cb7ff55; }\n.seg.call { background: #ff9ecf88; }\n.seg.server { background: #ff9ecf; }\n.seg.update { background: var(--green); }\n.seg.failed { background: var(--red); }\n.legend { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; color: var(--dim); }\n.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }\n.graph-wrap { display: flex; gap: 10px; height: calc(100% - 42px); min-height: 180px; }\n.graph-view { position: relative; flex: 1; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: radial-gradient(circle, #ffffff12 1px, transparent 1px) 0 0 / 16px 16px; cursor: grab; touch-action: none; }\n.graph-view.dragging { cursor: grabbing; }\n.graph-view svg { display: block; width: 100%; height: 100%; }\n.graph-side { width: 250px; flex: none; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }\n.zoom { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; }\n.zoom button { background: var(--raised); border-color: var(--line); min-width: 28px; }\nsvg .node rect.box { fill: var(--surface); stroke: var(--line); }\nsvg .node .kind { fill: var(--faint); }\nsvg .node .name { fill: var(--text); font: 600 11.5px var(--mono); }\nsvg .node .meta { fill: var(--dim); font: 10.5px var(--mono); }\nsvg .node { cursor: pointer; }\nsvg .node:hover rect.box { stroke: var(--dim); }\nsvg .k-signal .kind, svg .k-prop .kind { fill: var(--blue); }\nsvg .k-memo .kind { fill: var(--purple); }\nsvg .k-effect .kind { fill: var(--green); }\nsvg .node.selected rect.box { stroke: var(--accent); stroke-width: 1.5; }\nsvg .node.hot rect.box { fill: #3a3020; stroke: var(--yellow); }\nsvg .node.faded { opacity: 0.3; }\nsvg path.edge { fill: none; stroke: #8a828066; stroke-width: 1.25; }\nsvg path.edge.lit { stroke: var(--accent); stroke-width: 1.75; }\nsvg path.edge.hot-edge { stroke: var(--yellow); stroke-width: 1.75; }\nsvg path.edge.faded { opacity: 0.15; }\npre.report { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: 11.5px/1.55 var(--mono); white-space: pre-wrap; }\n.inspect-card { position: fixed; z-index: 2147483647; display: flex; flex-direction: column; gap: 5px; max-width: 340px; padding: 9px 11px; border: 1px solid var(--line, #2f2c31); border-radius: 10px; background: #19181aee; color: #ece8e4; font: 12px/1.4 system-ui, -apple-system, sans-serif; box-shadow: 0 10px 28px #0008; pointer-events: none; backdrop-filter: blur(6px); }\n.inspect-card .card-head { display: flex; justify-content: space-between; gap: 12px; color: #ffb48a; }\n.inspect-card .card-component { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }\n.inspect-card .card-pills { display: flex; flex-wrap: wrap; gap: 4px; }\n.inspect-card .card-hint { margin-top: 2px; padding-top: 6px; border-top: 1px solid #2f2c31; color: #6f6862; font-size: 11px; }\n.outline { position: fixed; pointer-events: none; border: 2px solid #ee7a3e; background: #ee7a3e22; border-radius: 3px; z-index: 2147483646; }\n`;\n\ntype Tab =\n | 'overview'\n | 'errors'\n | 'scopes'\n | 'elements'\n | 'graph'\n | 'log'\n | 'timeline'\n | 'state'\n | 'effects'\n | 'navigation'\n | 'server'\n | 'blocks'\n | 'report';\nconst TABS: [Tab, string][] = [\n ['overview', 'Overview'],\n ['errors', 'Errors'],\n ['scopes', 'Components'],\n ['elements', 'Elements'],\n ['graph', 'Graph'],\n ['log', 'Log'],\n ['timeline', 'Timeline'],\n ['state', 'Page state'],\n ['effects', 'Effects'],\n ['navigation', 'Navigation'],\n ['server', 'Server'],\n ['blocks', 'Blocks'],\n ['report', 'Report'],\n];\nconst KINDS: DevtoolsEntry['kind'][] = ['handler', 'write', 'call'];\n/** How long a write marks the nodes of the graph. */\nconst HOT_MS = 1500;\n/** The height of the panel, kept between pages. */\nconst HEIGHT_KEY = 'brumate:devtools:height';\n\nconst components = new Map<string, Promise<ComponentInfo | undefined>>();\nconst known = new Map<string, ComponentInfo>();\n\n/** Asks the dev server about a component, once. */\nfunction componentInfo(state: DevtoolsState, id: string): Promise<ComponentInfo | undefined> {\n let info = components.get(id);\n if (!info) {\n info = fetch(`${state.endpoint}/${encodeURIComponent(id)}`)\n .then((response) => (response.ok ? (response.json() as Promise<ComponentInfo>) : undefined))\n .then((value) => {\n if (value) {\n known.set(id, value);\n }\n return value;\n })\n .catch(() => undefined);\n components.set(id, info);\n }\n return info;\n}\n\n/** The IDs of the components that instances in a list belong to. */\nfunction collectModules(instances: Scope[]): Set<string> {\n const ids = new Set<string>();\n for (const scope of instances) {\n ids.add(scope.m!);\n }\n return ids;\n}\n/** How many blocks of the page are in a state. */\nfunction countBlocks(blocks: Iterable<BlockEntry>, blockState: BlockEntry['state']): number {\n let count = 0;\n for (const block of blocks) {\n if (block.state === blockState) {\n count++;\n }\n }\n return count;\n}\n\n/** The infos of many components, in the order of their IDs. */\nfunction loadComponents(\n state: DevtoolsState,\n ids: Iterable<string>,\n): Promise<(ComponentInfo | undefined)[]> {\n const pending: Promise<ComponentInfo | undefined>[] = [];\n for (const id of ids) {\n pending.push(componentInfo(state, id));\n }\n return Promise.all(pending);\n}\n\nfunction element<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n attributes: Record<string, string> = {},\n ...children: (Node | string)[]\n): HTMLElementTagNameMap[K] {\n const node = document.createElement(tag);\n for (const [name, value] of Object.entries(attributes)) {\n node.setAttribute(name, value);\n }\n node.append(...children);\n return node;\n}\n\nfunction svg(\n tag: string,\n attributes: Record<string, string | number>,\n ...children: Node[]\n): SVGElement {\n const node = document.createElementNS('http://www.w3.org/2000/svg', tag);\n for (const [name, value] of Object.entries(attributes)) {\n node.setAttribute(name, String(value));\n }\n node.append(...children);\n return node;\n}\n\n/**\n * The icons of the panel: strokes on a grid of 24, in the colour of the text.\n */\nconst ICONS = {\n overview:\n '<rect x=\"3.5\" y=\"3.5\" width=\"7\" height=\"7\" rx=\"1.75\"/><rect x=\"13.5\" y=\"3.5\" width=\"7\" height=\"7\" rx=\"1.75\"/><rect x=\"3.5\" y=\"13.5\" width=\"7\" height=\"7\" rx=\"1.75\"/><rect x=\"13.5\" y=\"13.5\" width=\"7\" height=\"7\" rx=\"1.75\"/>',\n errors:\n '<path d=\"M10.3 4.6a2 2 0 0 1 3.4 0l7 12.2a2 2 0 0 1-1.7 3H5a2 2 0 0 1-1.7-3z\"/><path d=\"M12 9.5v4\"/><path d=\"M12 16.8v.2\"/>',\n scopes:\n '<rect x=\"9\" y=\"3\" width=\"6\" height=\"5\" rx=\"1.25\"/><rect x=\"3\" y=\"16\" width=\"6\" height=\"5\" rx=\"1.25\"/><rect x=\"15\" y=\"16\" width=\"6\" height=\"5\" rx=\"1.25\"/><path d=\"M12 8v4M6 16v-2.25A1.75 1.75 0 0 1 7.75 12h8.5A1.75 1.75 0 0 1 18 13.75V16\"/>',\n elements: '<path d=\"M5 4.5 18 10l-5.5 2L10 17.5z\"/><path d=\"m13 13 5.5 5.5\"/>',\n graph:\n '<circle cx=\"6\" cy=\"12\" r=\"2.5\"/><circle cx=\"18\" cy=\"6\" r=\"2.5\"/><circle cx=\"18\" cy=\"18\" r=\"2.5\"/><path d=\"m8.3 10.8 7.4-3.6M8.3 13.2l7.4 3.6\"/>',\n log: '<path d=\"M9 6h11M9 12h11M9 18h11\"/><path d=\"M4.5 6h.01M4.5 12h.01M4.5 18h.01\" stroke-width=\"2.6\"/>',\n loading: '<path d=\"M4 6h7M8 12h9M13 18h7\"/>',\n state:\n '<ellipse cx=\"12\" cy=\"6\" rx=\"7.5\" ry=\"2.75\"/><path d=\"M4.5 6v6c0 1.5 3.4 2.75 7.5 2.75s7.5-1.25 7.5-2.75V6\"/><path d=\"M4.5 12v6c0 1.5 3.4 2.75 7.5 2.75s7.5-1.25 7.5-2.75v-6\"/>',\n effects: '<path d=\"M19.5 12a7.5 7.5 0 1 1-2.2-5.3\"/><path d=\"M19.5 4v4h-4\"/>',\n navigation:\n '<path d=\"M4 7h11M4 7l3.5-3.5M4 7l3.5 3.5\"/><path d=\"M20 17H9M20 17l-3.5-3.5M20 17l-3.5 3.5\"/>',\n server:\n '<rect x=\"4\" y=\"4\" width=\"16\" height=\"6.5\" rx=\"1.5\"/><rect x=\"4\" y=\"13.5\" width=\"16\" height=\"6.5\" rx=\"1.5\"/><path d=\"M7.5 7.25h.01M7.5 16.75h.01\" stroke-width=\"2.6\"/>',\n timeline: '<circle cx=\"12\" cy=\"13\" r=\"7.5\"/><path d=\"M12 9.5V13l2.5 1.6M10 3h4\"/>',\n blocks:\n '<path d=\"M12 3.5 3.5 8 12 12.5 20.5 8z\"/><path d=\"M3.5 12 12 16.5 20.5 12M3.5 16 12 20.5 20.5 16\"/>',\n report:\n '<path d=\"M14 3.5H7a1.5 1.5 0 0 0-1.5 1.5v14A1.5 1.5 0 0 0 7 20.5h10a1.5 1.5 0 0 0 1.5-1.5V8z\"/><path d=\"M14 3.5V8h4.5M9 12.5h6M9 16h6\"/>',\n flash:\n '<path d=\"M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1\"/><circle cx=\"12\" cy=\"12\" r=\"2.5\"/>',\n pick: '<circle cx=\"12\" cy=\"12\" r=\"7\"/><path d=\"M12 2.5v4M12 17.5v4M2.5 12h4M17.5 12h4\"/><circle cx=\"12\" cy=\"12\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\"/>',\n close: '<path d=\"m6 9.5 6 6 6-6\"/>',\n trash:\n '<path d=\"M4.5 7h15M9.5 7V5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v2M6.5 7l.9 12.1a1.5 1.5 0 0 0 1.5 1.4h6.2a1.5 1.5 0 0 0 1.5-1.4L17.5 7\"/>',\n pause: '<path d=\"M9 5.5v13M15 5.5v13\"/>',\n play: '<path d=\"M8 5.5v13l10.5-6.5z\"/>',\n fit: '<path d=\"M4 9V5a1 1 0 0 1 1-1h4M20 9V5a1 1 0 0 0-1-1h-4M4 15v4a1 1 0 0 0 1 1h4M20 15v4a1 1 0 0 1-1 1h-4\"/>',\n plus: '<path d=\"M12 5v14M5 12h14\"/>',\n minus: '<path d=\"M5 12h14\"/>',\n bolt: '<path d=\"M13 3 5 13.5h6L10 21l9-11h-6z\"/>',\n open: '<path d=\"M14 4h6v6M20 4l-8.5 8.5M18 14v4.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 4 18.5v-11A1.5 1.5 0 0 1 5.5 6H10\"/>',\n} as const;\n\n/** An icon by its name, for a button or a tab. */\nfunction icon(name: keyof typeof ICONS, size = 14): SVGElement {\n const node = svg('svg', {\n class: 'icon',\n viewBox: '0 0 24 24',\n width: size,\n height: size,\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': 1.8,\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round',\n 'aria-hidden': 'true',\n });\n node.innerHTML = ICONS[name];\n return node;\n}\n\n/** A button with an icon, and its text or, for an icon alone, its label for screen readers. */\nfunction iconButton(\n name: keyof typeof ICONS,\n text: string,\n attributes: Record<string, string> = {},\n iconOnly = false,\n): HTMLButtonElement {\n const button = element(\n 'button',\n { class: `tool${iconOnly ? ' only' : ''}`, ...attributes },\n icon(name),\n );\n if (iconOnly) {\n button.setAttribute('aria-label', text);\n button.title ||= text;\n } else {\n button.append(text);\n }\n return button;\n}\n\n/** A value that can be edited as text: what JSON can hold. */\nfunction editable(value: unknown): boolean {\n if (value === null || ['string', 'number', 'boolean'].includes(typeof value)) {\n return true;\n }\n if (typeof value !== 'object' || value instanceof Element) {\n return false;\n }\n try {\n JSON.stringify(value);\n return true;\n } catch {\n return false;\n }\n}\n\n/** Reads what a person typed: JSON, or else the text as a string. */\nfunction parseValue(text: string): unknown {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n}\n\n/** The type of a value, for the column next to it. */\nfunction readType(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return 'array';\n }\n if (value instanceof Element) {\n return 'element';\n }\n if (typeof value === 'object') {\n const name = value.constructor?.name;\n return name && name !== 'Object' ? name : 'object';\n }\n return typeof value;\n}\n\n/** A write with the name of its slot, once the dev server has said what it is. */\nfunction describe(entry: DevtoolsEntry): string {\n const write = entry.write;\n const info = write && known.get(write.component);\n const name = info?.scopes[write!.k]?.slots[write!.slot];\n return name\n ? `${info!.name} ${name} = ${entry.text.split(' = ').slice(1).join(' = ')}`\n : entry.text;\n}\n\nfunction ms(time: number): string {\n return `${Math.round(time)} ms`;\n}\nfunction seconds(time: number): string {\n return `${(time / 1000).toFixed(2)} s`;\n}\nfunction kilobytes(bytes: number): string {\n return `${(bytes / 1024).toFixed(1)} kB`;\n}\n\n/** The keys and values of an object, a map or a set, or the items of an array, in a row. */\nfunction listEntries(value: object): unknown[] {\n if (value instanceof Map) {\n return [...value].flat();\n }\n if (value instanceof Set || Array.isArray(value)) {\n return [...value];\n }\n return Object.entries(value).flat();\n}\n\n/**\n * About how many bytes a value takes in the page state. The state is code\n * that seroval writes, which this follows closely enough to compare values.\n */\nfunction measureSize(value: unknown, seen = new Set<object>()): number {\n if (value === null || value === undefined) {\n return 6;\n }\n switch (typeof value) {\n case 'string':\n return value.length + 2;\n case 'number':\n case 'boolean':\n case 'bigint':\n return String(value).length;\n case 'function':\n // A reference to client code: its ID and its scope.\n return 24;\n case 'object': {\n if (seen.has(value)) {\n // A reference to a value that is in the state already.\n return 6;\n }\n seen.add(value);\n if (value instanceof Date) {\n return 30;\n }\n const entries = listEntries(value);\n let bytes = 2;\n for (const entry of entries) {\n bytes += measureSize(entry, seen) + 1;\n }\n return bytes;\n }\n default:\n return 8;\n }\n}\n\n/** The bytes of the state records of the page. */\nfunction stateBytes(): number {\n let bytes = 0;\n for (const script of document.querySelectorAll('script[b-state]')) {\n bytes += script.textContent?.length ?? 0;\n }\n return bytes;\n}\n\n/** The value of a name that a scope or one of the scopes around it holds. */\nfunction readValue(scope: Scope, name: string): string | undefined {\n for (let current: Scope | undefined = scope; current; current = current.p) {\n const slots = known.get(findRootScope(current).m ?? '')?.scopes[current.k]?.slots;\n const slot = slots?.indexOf(name) ?? -1;\n if (slot !== -1) {\n return preview(current.s[slot]);\n }\n if (current.m !== undefined) {\n break;\n }\n }\n return undefined;\n}\n\nconst STATE_COLORS: Record<BlockEntry['state'], string> = {\n waiting: '',\n loading: 'blue',\n streaming: 'blue',\n rendered: 'green',\n failed: 'red',\n};\n\n/** The colour of a node in the graph. Other kinds are blue when they hold a value. */\nfunction nodeColor(kind: string, slot: number | undefined): string {\n if (kind === 'memo') {\n return 'purple';\n }\n if (kind === 'effect') {\n return 'green';\n }\n return slot === undefined ? '' : 'blue';\n}\n\n/** The colour of how long a run took, in milliseconds. */\nfunction speedColor(total: number): string {\n if (total < 100) {\n return 'green';\n }\n return total < 300 ? 'yellow' : 'red';\n}\n\nfunction blockLabel(block: BlockEntry): string {\n return block.kind === '$client' ? '$client' : `#${block.kind}`;\n}\n\nfunction pill(text: string, color = ''): HTMLElement {\n return element('span', { class: `pill ${color}` }, text);\n}\n\n/** A row of cells, as a table row. */\nfunction row(cells: (Node | string)[], tag: 'td' | 'th' = 'td'): HTMLElement {\n const items: HTMLElement[] = [];\n for (const cell of cells) {\n items.push(element(tag, {}, cell));\n }\n return element('tr', {}, ...items);\n}\n\n/** A card of a number, with a label above and a note below. */\nfunction card(label: string, value: string, note: string): HTMLElement {\n return element(\n 'div',\n { class: 'card' },\n element('div', { class: 'label' }, label),\n element('div', { class: 'value' }, value),\n element('div', { class: 'note' }, note),\n );\n}\n\n/** A square of colour and its meaning, for a legend. */\nfunction key(color: string, text: string): HTMLElement {\n return element('span', {}, element('i', { style: `background: ${color}` }), text);\n}\n\n/** A button that opens a place of a file in the editor, through the dev server. */\nfunction source(info: ComponentInfo | undefined, at = '1:1'): Node | string {\n if (!info) {\n return '';\n }\n const label = at === '1:1' ? info.file : `${info.file}:${at}`;\n if (!info.path) {\n return element('span', { class: 'mono sub' }, label);\n }\n const open = element(\n 'button',\n { class: 'link', title: 'Open in the editor' },\n label,\n icon('open', 12),\n );\n open.addEventListener('click', () => {\n void fetch(`/__open-in-editor?file=${encodeURIComponent(`${info.path}:${at}`)}`);\n });\n return open;\n}\n\n/**\n * Places the nodes of a graph in columns, left to right, by the longest\n * path from a value that nothing feeds. Within a column, nodes are ordered\n * by the average place of the nodes they connect to, a few times in each\n * direction, so edges cross less. Each column is as wide as its widest node.\n */\nexport function layoutGraph(\n nodes: unknown[],\n edges: [number, number][],\n getWidth: (index: number) => number,\n): { x: number; y: number; width: number }[] {\n // Depth of each node: the longest path from a value that nothing feeds.\n const depth: number[] = [];\n for (let index = 0; index < nodes.length; index++) {\n depth.push(0);\n }\n for (let round = 0, changed = true; changed && round < nodes.length; round++) {\n changed = false;\n for (const [from, to] of edges) {\n if (depth[from]! + 1 > depth[to]!) {\n depth[to] = depth[from]! + 1;\n changed = true;\n }\n }\n }\n // Group the nodes in columns by depth, and keep the columns that hold a node.\n const columns: number[][] = [];\n for (let index = 0; index < nodes.length; index++) {\n (columns[depth[index]!] ??= []).push(index);\n }\n const filled: number[][] = [];\n for (const column of columns) {\n if (column) {\n filled.push(column);\n }\n }\n const order = new Map<number, number>();\n for (const column of filled) {\n for (const [index, node] of column.entries()) {\n order.set(node, index);\n }\n }\n const before: number[][] = [];\n const after: number[][] = [];\n for (let index = 0; index < nodes.length; index++) {\n before.push([]);\n after.push([]);\n }\n for (const [from, to] of edges) {\n after[from]!.push(to);\n before[to]!.push(from);\n }\n function average(list: number[], fallback: number): number {\n if (list.length === 0) {\n return fallback;\n }\n let sum = 0;\n for (const node of list) {\n sum += order.get(node)!;\n }\n return sum / list.length;\n }\n // Sweep back and forth, ordering each column by the average place of its neighbours.\n for (let sweep = 0; sweep < 8; sweep++) {\n const forward = sweep % 2 === 0;\n const sequence = forward ? filled.slice(1) : filled.slice(0, -1).toReversed();\n for (const column of sequence) {\n const weight = new Map<number, number>();\n for (const node of column) {\n weight.set(node, average(forward ? before[node]! : after[node]!, order.get(node)!));\n }\n column.sort((a, b) => weight.get(a)! - weight.get(b)!);\n for (const [index, node] of column.entries()) {\n order.set(node, index);\n }\n }\n }\n const ROW = 50;\n const GAP = 72;\n let tallest = 1;\n for (const column of filled) {\n tallest = Math.max(tallest, column.length);\n }\n const result: { x: number; y: number; width: number }[] = [];\n let x = 16;\n for (const column of filled) {\n let width = -Infinity;\n for (const node of column) {\n width = Math.max(width, getWidth(node));\n }\n // Each column is centred against the tallest one.\n const top = 16 + ((tallest - column.length) * ROW) / 2;\n for (const [index, node] of column.entries()) {\n result[node] = { x, y: top + index * ROW, width };\n }\n x += width + GAP;\n }\n return result;\n}\n\n/** The scopes of a component instance, without the components inside it. */\nfunction countScopes(scope: Scope): number {\n let count = 1;\n for (const child of scope.children ?? []) {\n if (child.m === undefined) {\n count += countScopes(child);\n }\n }\n return count;\n}\n\n/** A label cut to the width of a node of the graph. */\nfunction clip(text: string): string {\n return text.length > 34 ? `${text.slice(0, 33)}…` : text;\n}\n\n/** The text of an entry of the log. */\nfunction readText(entry: DevtoolsEntry): string {\n return entry.kind === 'write' ? describe(entry) : entry.text;\n}\n\n/** A place in a file that a stack names. */\ninterface Frame {\n fn: string;\n file: string;\n line: number;\n column: number;\n /** True for code of a dependency, of the runtime of brumate, or of Node. */\n library: boolean;\n /** True for code that the browser ran, whose lines are of the compiled code. */\n compiled: boolean;\n /** The URL of the module that the browser ran, for a frame that no source map maps. */\n url?: string;\n}\n\n/** The places of a stack, with their files as the dev server can read them. */\nfunction parseFrames(stack: string | undefined): Frame[] {\n const frames: Frame[] = [];\n for (const line of (stack ?? '').split('\\n')) {\n const match = /^\\s*at (?:(.*?) \\()?(.+?):(\\d+):(\\d+)\\)?\\s*$/.exec(line);\n if (!match) {\n continue;\n }\n let file = match[2]!;\n let compiled = false;\n // Code of a browser extension, or code without a file, is not code of the app.\n if (/^[a-z-]+-extension:/.test(file) || file.startsWith('<')) {\n continue;\n }\n if (/^https?:/.test(file)) {\n const url = new URL(file);\n if (url.origin !== location.origin) {\n continue;\n }\n compiled = true;\n file = url.pathname.startsWith('/@fs/') ? url.pathname.slice(4) : url.pathname;\n } else if (file.startsWith('file://')) {\n file = decodeURIComponent(new URL(file).pathname);\n }\n frames.push({\n fn: match[1] ?? '(anonymous)',\n file,\n line: Number(match[3]),\n column: Number(match[4]),\n library:\n file.startsWith('node:') ||\n file.includes('/node_modules/') ||\n /\\/brumate\\/(?:src|dist)\\/runtime\\//.test(file) ||\n file.includes('/@vite/'),\n compiled,\n });\n }\n return frames;\n}\n\n/** The places in the sources of frames that the browser ran, by their compiled place. */\nconst mapped = new Map<string, Promise<Frame>>();\n\n/**\n * Maps the frames that the browser ran to their sources, by the source maps\n * of the dev server, so a frame of a component or a module function names\n * its own file and line. A frame that the dev server cannot map stays as it is.\n */\nfunction mapFrames(frames: Frame[], urls: string[]): Promise<Frame[]> {\n const results: (Frame | Promise<Frame>)[] = [];\n for (const [index, frame] of frames.entries()) {\n const url = urls[index];\n if (!frame.compiled || frame.library || !url) {\n results.push(frame);\n continue;\n }\n // A frame that the source map does not map shows the code that the browser ran.\n const unmapped = { ...frame, url };\n const key = `${url}:${frame.line}:${frame.column}`;\n let result = mapped.get(key);\n if (!result) {\n const query = new URLSearchParams({\n url,\n line: String(frame.line),\n column: String(frame.column),\n });\n result = fetch(`/__brumate/position?${query}`)\n .then((response) => (response.ok ? response.json() : null))\n .then((place: { file: string; line: number; column: number } | null) =>\n place ? { ...frame, ...place, compiled: false } : unmapped,\n )\n .catch(() => unmapped);\n mapped.set(key, result);\n }\n results.push(result);\n }\n return Promise.all(results);\n}\n\n/** The URLs that the frames of a stack name, as the dev server knows the modules. */\nfunction frameUrls(stack: string | undefined): string[] {\n const urls: string[] = [];\n for (const line of (stack ?? '').split('\\n')) {\n const match = /^\\s*at (?:(.*?) \\()?(.+?):(\\d+):(\\d+)\\)?\\s*$/.exec(line);\n const file = match?.[2];\n if (!file || /^[a-z-]+-extension:/.test(file) || file.startsWith('<')) {\n continue;\n }\n if (/^https?:/.test(file)) {\n const url = new URL(file);\n urls.push(url.origin === location.origin ? url.pathname + url.search : '');\n if (url.origin !== location.origin) {\n urls.pop();\n }\n } else {\n urls.push('');\n }\n }\n return urls;\n}\n\n/** The highlighter, which loads with the first code that the Errors tab shows. */\nlet highlighter: Promise<typeof Highlight> | undefined;\n/** The sources of files, by path. */\nconst sources = new Map<string, Promise<string | undefined>>();\n\n/** The code of a module as the dev server sent it to the browser. */\nfunction fetchCompiled(url: string): Promise<string | undefined> {\n let text = sources.get(url);\n if (!text) {\n text = fetch(url)\n .then((response) => (response.ok ? response.text() : undefined))\n .catch(() => undefined);\n sources.set(url, text);\n }\n return text;\n}\n\nfunction fetchSource(file: string): Promise<string | undefined> {\n let text = sources.get(file);\n if (!text) {\n text = fetch(`/__brumate/source?file=${encodeURIComponent(file)}`)\n .then((response) => (response.ok ? response.text() : undefined))\n .catch(() => undefined);\n sources.set(file, text);\n }\n return text;\n}\n\n/**\n * The lines around a place of a file, highlighted by twinkleplop, with the\n * line of the place and the word at its column marked. Without the source,\n * the frame of the error is shown as it is.\n */\nasync function codeView(\n place: { file: string; line: number; column: number; url?: string },\n fallback?: string,\n): Promise<HTMLElement> {\n const box = element('div', { class: 'code' });\n const [text, module] = await Promise.all([\n place.url ? fetchCompiled(place.url) : fetchSource(place.file),\n (highlighter ??= import('../highlight.ts')),\n ]);\n if (text === undefined) {\n box.append(\n element('pre', { class: 'plain' }, fallback ?? 'The dev server cannot read this file.'),\n );\n return box;\n }\n const lines = text.split('\\n');\n const start = Math.max(1, place.line - 6);\n const end = Math.min(lines.length, place.line + 6);\n const target = place.line;\n const word = /^[\\w$.]*/.exec(lines[place.line - 1]?.slice(place.column - 1) ?? '')?.[0] ?? '';\n // The colours of the theme, in the box, since the styles of the page do not reach the panel.\n box.append(element('style', {}, module.themeCSS('dark')));\n // The whole file is highlighted, so lines inside a script or a comment have their context. Then\n // only the lines around the place stay, each line one `.l` element.\n box.insertAdjacentHTML(\n 'beforeend',\n module.highlightFile(place.url ? 'compiled.ts' : place.file, text, {\n line_numbers: { start: 1 },\n line: (index) => (index === target ? { class: 'error-line' } : undefined),\n overlays:\n word.length > 0\n ? [\n {\n start: { line: target, character: place.column - 1 },\n end: { line: target, character: place.column - 1 + word.length },\n class: 'error-mark',\n },\n ]\n : [],\n }),\n );\n const shown = [...box.querySelectorAll('code > .l')];\n for (const [index, line] of shown.entries()) {\n if (index + 1 < start || index + 1 > end) {\n // The line break after a line goes with it.\n if (line.nextSibling?.nodeType === Node.TEXT_NODE) {\n line.nextSibling.remove();\n }\n line.remove();\n }\n }\n return box;\n}\n\n/** The name of a handler, such as `Index h16`, once the dev server said the component. */\nfunction handlerName(ref: string): string {\n const [component, name = ''] = ref.split('#') as [string, string];\n return `${known.get(component)?.name ?? component} ${name}`;\n}\n\n/** A round step for the ticks of a ruler: 1, 2 or 5 times a power of ten, at least `rough`. */\nfunction tickStep(rough: number): number {\n const power = 10 ** Math.floor(Math.log10(rough));\n for (const factor of [1, 2, 5]) {\n if (factor * power >= rough) {\n return factor * power;\n }\n }\n return 10 * power;\n}\n\nlet panel: HTMLElement | undefined;\n/** Switches the tab of the open panel. */\nlet showTab: ((tab: Tab) => void) | undefined;\n/** Stops picking, with its outline and card, when the panel closes. */\nlet endPick: (() => void) | undefined;\n\n/** Opens the panel on a tab, or switches to it when the panel is open. */\nexport function openPanel(root: ShadowRoot, state: DevtoolsState, tab: string): void {\n if (panel) {\n showTab?.(tab as Tab);\n } else {\n togglePanel(root, state, tab as Tab);\n }\n}\n\n/** Opens the panel, or closes it when it is open. */\nexport function togglePanel(\n root: ShadowRoot,\n state: DevtoolsState,\n initial: Tab = 'overview',\n): void {\n const opener = root.querySelector<HTMLElement>('button.open');\n if (panel) {\n // Pick has no button, nor the styles of its card, without the panel.\n endPick?.();\n endPick = undefined;\n panel.remove();\n panel = undefined;\n state.changed = undefined;\n document.documentElement.style.removeProperty('padding-bottom');\n if (opener) {\n opener.hidden = false;\n }\n state.resize = undefined;\n state.resized = undefined;\n showTab = undefined;\n return;\n }\n let tab: Tab = initial;\n // The error and the place of its stack that the Errors tab shows.\n let selectedError: ErrorEntry | undefined;\n let selectedFrame = -1;\n let selected: string | undefined;\n let selectedScope: ScopeId | undefined;\n let editing: { scope: ScopeId; slot: number } | undefined;\n let paused = false;\n let filter = '';\n let logSearch = '';\n const shown = new Set<DevtoolsEntry['kind']>(KINDS);\n // The log as it was when Pause was pressed.\n let frozen: DevtoolsEntry[] | undefined;\n // The element that Pick found, for the Elements tab.\n let picked: Element | undefined;\n // The node of the graph that was clicked, and the pan and zoom of the graph.\n let graphNode: number | undefined;\n let view = { x: 0, y: 0, scale: 1, fitted: '' };\n\n let height = 340;\n try {\n height = Number(localStorage.getItem(HEIGHT_KEY)) || height;\n } catch {\n // Storage can be off. The default height stays.\n }\n // The page of an error of the server has nothing else to show.\n const errorPage = document.getElementById('brumate-error') !== null;\n if (errorPage) {\n height = window.innerHeight;\n }\n\n const body = element('div', { class: 'body' });\n const nav = element('div', { class: 'nav', role: 'tablist', 'aria-orientation': 'vertical' });\n const badges = new Map<Tab, HTMLElement>();\n for (const [name, label] of TABS) {\n const badge = element('span', { class: 'badge' });\n const button = element(\n 'button',\n { class: 'tab', role: 'tab', 'data-tab': name },\n icon(name === 'scopes' ? 'scopes' : name, 15),\n element('span', { class: 'label' }, label),\n badge,\n );\n badges.set(name, badge);\n button.addEventListener('click', () => {\n tab = name;\n draw();\n });\n nav.append(button);\n }\n\n const routeText = element('span', { class: 'route', title: 'The page' });\n const stats = element('span', { class: 'stats' });\n const pick = iconButton('pick', 'Pick', {\n 'aria-pressed': 'false',\n title: 'Click an element of the page to see its scope, handlers and code',\n });\n // Outlines the elements that change on the page, as updates write them.\n const flash = iconButton('flash', 'Updates', {\n 'aria-pressed': String(state.flash),\n title: 'Outline the elements that change: green now and then, red often',\n });\n flash.addEventListener('click', () => {\n state.setFlash?.(!state.flash);\n flash.setAttribute('aria-pressed', String(state.flash));\n });\n const close = iconButton('close', 'Close the devtools (Alt+Shift+D)', {}, true);\n close.addEventListener('click', () => togglePanel(root, state));\n const versions: HTMLElement[] = [\n element(\n 'span',\n { class: 'chip accent', title: 'The version of brumate' },\n `v${state.meta.version ?? '?'}`,\n ),\n ];\n if (state.meta.vite) {\n versions.push(\n element('span', { class: 'chip', title: 'The version of Vite' }, `Vite ${state.meta.vite}`),\n );\n }\n const logo = element('i');\n logo.innerHTML = LOGO;\n const resize = element('div', { class: 'resize', title: 'Drag to resize' });\n panel = element(\n 'div',\n { class: 'panel', role: 'region', 'aria-label': 'brumate devtools' },\n element('style', {}, STYLE),\n resize,\n element(\n 'div',\n { class: 'top' },\n element('span', { class: 'brand' }, logo, 'brumate'),\n ...versions,\n routeText,\n stats,\n element('span', { class: 'spacer' }),\n flash,\n pick,\n close,\n ),\n element('div', { class: 'main' }, nav, body),\n );\n function applyHeight(): void {\n panel!.style.height = `${height}px`;\n if (errorPage) {\n panel!.style.maxHeight = 'none';\n }\n // The page can scroll past the panel.\n document.documentElement.style.paddingBottom = `${height}px`;\n }\n applyHeight();\n root.append(panel);\n // The tab hides while the panel is open. Close, or Alt+Shift+D, closes it.\n if (opener) {\n opener.hidden = true;\n }\n state.resize = (clientY) => {\n height = Math.min(Math.max(window.innerHeight - clientY, 160), window.innerHeight * 0.9);\n applyHeight();\n };\n state.resized = () => {\n try {\n localStorage.setItem(HEIGHT_KEY, String(Math.round(height)));\n } catch {\n // Storage can be off.\n }\n draw();\n };\n resize.addEventListener('pointerdown', (event) => {\n event.preventDefault();\n // oxlint-disable-next-line unicorn/consistent-function-scoping -- It writes the height of this panel.\n function move(next: PointerEvent): void {\n state.resize?.(next.clientY);\n }\n function up(): void {\n window.removeEventListener('pointermove', move);\n window.removeEventListener('pointerup', up);\n state.resized?.();\n }\n window.addEventListener('pointermove', move);\n window.addEventListener('pointerup', up);\n });\n // Without an event, the core has not loaded yet, and nothing knows the components of the page.\n if (!state.scopes) {\n document.dispatchEvent(new Event('brumate:core'));\n }\n\n // Outlines the elements of a scope on the page.\n const outlines: HTMLElement[] = [];\n function outline(scope?: ScopeId): void {\n for (const box of outlines.splice(0)) {\n box.remove();\n }\n if (scope === undefined) {\n return;\n }\n for (const target of document.querySelectorAll(`[b-b^=\"${scope}:\"]`)) {\n const rect = target.getBoundingClientRect();\n const box = element('div', {\n class: 'outline',\n style: `left:${rect.left}px;top:${rect.top}px;width:${rect.width}px;height:${rect.height}px`,\n });\n root.append(box);\n outlines.push(box);\n }\n }\n\n // Pick: the next click on the page shows its element in the Elements tab.\n function onPick(event: MouseEvent): void {\n const clicked = event.target as Element | null;\n if (!clicked?.closest || event.composedPath().includes(panel!)) {\n return;\n }\n event.preventDefault();\n event.stopImmediatePropagation();\n stopPicking();\n picked = clicked;\n const id = clicked.closest('[b-b]')?.getAttribute('b-b')!.split(':')[0];\n if (id !== undefined) {\n selectedScope = /^-?\\d+$/.test(id) ? Number(id) : id;\n const scope = state.scopes?.get(selectedScope);\n selected = scope ? findRootScope(scope).m : selected;\n }\n tab = 'elements';\n draw();\n }\n // While picking, the element under the pointer is outlined, with a card of what brumate knows\n // about it: its component, its place in the file, its scope, its handlers and what it reads.\n const inspectCard = element('div', { class: 'inspect-card', role: 'tooltip' });\n const hoverBox = element('div', { class: 'outline' });\n let hovered: Element | undefined;\n let hoverToken = 0;\n function onHover(event: PointerEvent): void {\n const target = event.target as Element | null;\n if (!target?.closest || event.composedPath().includes(panel!) || target === hovered) {\n return;\n }\n hovered = target;\n void inspect(target);\n }\n async function inspect(target: Element): Promise<void> {\n const token = ++hoverToken;\n const rect = target.getBoundingClientRect();\n hoverBox.style.cssText = `left:${rect.left}px;top:${rect.top}px;width:${rect.width}px;height:${rect.height}px`;\n root.append(hoverBox, inspectCard);\n const tag = target.tagName.toLowerCase();\n let classes = '';\n for (const name of [...target.classList].slice(0, 2)) {\n classes += `.${name}`;\n }\n const rows: (Node | string)[] = [\n element(\n 'div',\n { class: 'card-head' },\n element('span', { class: 'mono' }, `${tag}${classes}`),\n element('span', { class: 'sub' }, `${Math.round(rect.width)} × ${Math.round(rect.height)}`),\n ),\n ];\n const anchored = target.closest('[b-b]');\n const [id = '', anchorText = '0'] = anchored?.getAttribute('b-b')!.split(':') ?? [];\n const scope = anchored ? findScope(id) : undefined;\n if (scope) {\n const { info, component: owner, place } = await findAnchor(scope, Number(anchorText));\n if (token !== hoverToken) {\n return;\n }\n rows.push(\n element(\n 'div',\n { class: 'card-component' },\n element('strong', {}, info?.name ?? owner.m ?? 'component'),\n element(\n 'span',\n { class: 'mono sub' },\n place?.at ? `${info?.file}:${place.at}` : (info?.file ?? ''),\n ),\n ),\n element(\n 'div',\n { class: 'sub' },\n `scope ${scope.id} · ${info?.scopes[scope.k]?.label ?? 'scope'}${anchored === target ? '' : ` · in ${place?.label ?? 'an element'}`}`,\n ),\n );\n const handled = target.closest('[b-on]');\n if (handled && anchored!.contains(handled)) {\n const handlers = element('div', { class: 'card-pills' });\n for (const raw of (handled.getAttribute('b-on') ?? '').split(/\\s+/)) {\n if (!raw) {\n continue;\n }\n const [head] = raw.split('=') as [string];\n handlers.append(pill(head));\n }\n rows.push(handlers);\n }\n if (place && place.reads.length > 0) {\n rows.push(\n element('div', { class: 'card-pills' }, ...drawReads(scope, place.reads.slice(0, 4))),\n );\n }\n } else {\n rows.push(element('div', { class: 'sub' }, 'Nothing in the browser updates this element.'));\n }\n rows.push(element('div', { class: 'card-hint' }, 'Click to see it in Elements · Esc to stop'));\n inspectCard.replaceChildren(...rows);\n // Below the element, or above it when there is no room, and inside the window.\n const cardHeight = inspectCard.offsetHeight;\n const top =\n rect.bottom + 8 + cardHeight < window.innerHeight\n ? rect.bottom + 8\n : Math.max(8, rect.top - 8 - cardHeight);\n const left = Math.min(Math.max(8, rect.left), window.innerWidth - inspectCard.offsetWidth - 8);\n inspectCard.style.cssText = `top:${top}px;left:${left}px`;\n }\n function onEscape(event: KeyboardEvent): void {\n if (event.key === 'Escape') {\n stopPicking();\n }\n }\n endPick = (): void => stopPicking();\n function stopPicking(): void {\n pick.setAttribute('aria-pressed', 'false');\n window.removeEventListener('click', onPick, true);\n window.removeEventListener('pointermove', onHover, true);\n window.removeEventListener('keydown', onEscape, true);\n document.documentElement.style.cursor = '';\n hovered = undefined;\n hoverToken++;\n hoverBox.remove();\n inspectCard.remove();\n }\n pick.addEventListener('click', () => {\n if (pick.getAttribute('aria-pressed') === 'true') {\n stopPicking();\n return;\n }\n pick.setAttribute('aria-pressed', 'true');\n document.documentElement.style.cursor = 'crosshair';\n // On the window, so it runs before the listeners of the loader on the document.\n window.addEventListener('click', onPick, true);\n window.addEventListener('pointermove', onHover, true);\n window.addEventListener('keydown', onEscape, true);\n });\n\n /** The scopes of component instances. */\n function roots(): Scope[] {\n const result: Scope[] = [];\n for (const scope of state.scopes?.values() ?? []) {\n if (scope.m !== undefined) {\n result.push(scope);\n }\n }\n return result;\n }\n function findScope(id: string): Scope | undefined {\n return state.scopes?.get(/^-?\\d+$/.test(id) ? Number(id) : id);\n }\n /** The header and the counts of the tabs. */\n function drawChrome(): void {\n for (const button of nav.querySelectorAll('.tab')) {\n button.setAttribute('aria-selected', String((button as HTMLElement).dataset.tab === tab));\n }\n const list = roots();\n routeText.textContent = location.pathname + location.search;\n stats.textContent = [\n `${collectModules(list).size} components`,\n `${state.scopes?.size ?? 0} scopes`,\n `state ${kilobytes(stateBytes())}`,\n ].join(' · ');\n const waiting = countBlocks(state.blocks.values(), 'waiting');\n const counts: Partial<Record<Tab, [number, string?]>> = {\n errors: [state.errors.length, 'Errors'],\n scopes: [collectModules(list).size],\n log: [state.log.length],\n blocks: waiting > 0 ? [waiting, 'Blocks that wait for their trigger'] : [state.blocks.size],\n };\n for (const [name, badge] of badges) {\n const [count = 0, warning] = counts[name] ?? [];\n badge.textContent = count > 0 ? String(count) : '';\n let kind = warning ? ' warn' : '';\n if (name === 'errors') {\n kind = ' error';\n }\n badge.className = `badge${kind}`;\n badge.title = warning ?? '';\n }\n }\n\n /** A select of the components on the page, for Graph and Report. */\n function chooser(current: string | undefined): HTMLElement {\n const select = element('select', { 'aria-label': 'Component' });\n for (const id of collectModules(roots())) {\n const info = known.get(id);\n const option = element('option', { value: id }, info ? `${info.name} · ${info.file}` : id);\n option.selected = id === current;\n select.append(option);\n }\n select.addEventListener('change', () => {\n selected = select.value;\n graphNode = undefined;\n draw();\n });\n return select;\n }\n\n async function drawErrors(): Promise<void> {\n if (state.errors.length === 0) {\n body.replaceChildren(\n element('h2', {}, 'Errors'),\n element(\n 'p',\n { class: 'sub' },\n 'No errors. Errors of a render on the server, of Vite, such as a compile error after an edit, and of code in the browser show here.',\n ),\n );\n return;\n }\n if (!selectedError || !state.errors.includes(selectedError)) {\n selectedError = state.errors.at(-1);\n selectedFrame = -1;\n }\n const error = selectedError!;\n const list = element('div', { class: 'list' });\n for (const entry of state.errors.toReversed()) {\n const button = element(\n 'button',\n { class: 'error-row', 'aria-current': String(entry === error) },\n element('span', { class: 'text' }, entry.message.split('\\n')[0]!),\n element('span', { class: 'when' }, `${entry.source} · ${seconds(entry.time)}`),\n );\n button.addEventListener('click', () => {\n selectedError = entry;\n selectedFrame = -1;\n draw();\n });\n list.append(button);\n }\n const clear = iconButton('trash', 'Clear');\n clear.addEventListener('click', () => {\n state.errors.length = 0;\n state.errorCount?.();\n draw();\n });\n list.append(element('div', { style: 'margin-top: 8px' }, clear));\n\n // The place to show: a frame that was clicked, the place of a compile error, or the first\n // frame of the app's code.\n const frames = await mapFrames(parseFrames(error.stack), frameUrls(error.stack));\n if (selectedFrame === -1) {\n selectedFrame = -2;\n if (!error.loc) {\n // The first frame of the app's code, or -1 when there is none.\n selectedFrame = -1;\n for (const [index, item] of frames.entries()) {\n if (!item.library && !item.compiled) {\n selectedFrame = index;\n break;\n }\n }\n }\n }\n const frame = selectedFrame >= 0 ? frames[selectedFrame] : undefined;\n const place = selectedFrame === -2 ? error.loc : frame;\n const detail = element('div', { class: 'detail' });\n detail.append(\n element('pre', { class: 'error-message' }, error.message),\n element(\n 'div',\n { class: 'toolbar' },\n pill(error.source, error.source === 'browser' ? 'yellow' : 'red'),\n error.plugin ? pill(`plugin ${error.plugin}`) : '',\n place && !('url' in place && place.url) ? open(place) : '',\n ),\n );\n if (place) {\n detail.append(await codeView(place, error.frame));\n } else if (error.frame) {\n detail.append(\n element('div', { class: 'code' }, element('pre', { class: 'plain' }, error.frame)),\n );\n }\n if (frames.length > 0) {\n const stack = element('div', { class: 'frames' });\n for (const [index, item] of frames.entries()) {\n const button = element(\n 'button',\n {\n class: `frame${item.library ? ' library' : ''}`,\n 'aria-current': String(index === selectedFrame),\n title: item.compiled ? 'The lines of code that the browser ran' : 'Show this code',\n },\n element('span', { class: 'fn' }, item.fn),\n element('span', { class: 'where' }, `${item.file}:${item.line}:${item.column}`),\n );\n button.addEventListener('click', () => {\n selectedFrame = index;\n draw();\n });\n stack.append(button);\n }\n detail.append(element('h3', {}, 'Stack'), stack);\n }\n body.replaceChildren(element('div', { class: 'split' }, list, detail));\n }\n\n /** A button that opens a place of a file in the editor. */\n function open(place: { file: string; line: number; column: number }): HTMLElement {\n const button = element(\n 'button',\n { class: 'link', title: 'Open in the editor' },\n `${place.file.replace(/^.*\\/(src|test|routes)\\//, '$1/')}:${place.line}:${place.column}`,\n icon('open', 12),\n );\n button.addEventListener('click', () => {\n void fetch(\n `/__open-in-editor?file=${encodeURIComponent(`${place.file}:${place.line}:${place.column}`)}`,\n );\n });\n return button;\n }\n\n async function drawOverview(): Promise<void> {\n const list = roots();\n const ids = [...collectModules(list)];\n const infos = await loadComponents(state, ids);\n const blocks = [...state.blocks.values()];\n let handlers = 0;\n let calls = 0;\n for (const entry of state.log) {\n if (entry.kind === 'handler') {\n handlers++;\n } else if (entry.kind === 'call') {\n calls++;\n }\n }\n const table = element(\n 'table',\n { class: 'rows' },\n row(['component', 'file', 'instances', 'scopes'], 'th'),\n );\n for (const [index, id] of ids.entries()) {\n const info = infos[index];\n const instances: Scope[] = [];\n let scopeCount = 0;\n for (const scope of list) {\n if (scope.m === id) {\n instances.push(scope);\n scopeCount += countScopes(scope);\n }\n }\n const name = element('button', { class: 'link', title: 'Show its scopes' }, info?.name ?? id);\n name.addEventListener('click', () => {\n selected = id;\n selectedScope = instances[0]?.id;\n tab = 'scopes';\n draw();\n });\n table.append(row([name, source(info), String(instances.length), String(scopeCount)]));\n }\n body.replaceChildren(\n element(\n 'div',\n { class: 'kv', style: 'margin-bottom: 12px' },\n element('span', {}, 'Page'),\n element('span', { class: 'mono' }, location.href),\n element('span', {}, 'brumate'),\n element('span', { class: 'mono' }, state.meta.version ?? 'unknown'),\n element('span', {}, 'Vite'),\n element('span', { class: 'mono' }, state.meta.vite ?? 'unknown'),\n element('span', {}, 'Open for'),\n element('span', { class: 'mono' }, seconds(performance.now())),\n ),\n element(\n 'div',\n { class: 'cards' },\n card('Components', String(ids.length), `${state.scopes?.size ?? 0} scopes in the browser`),\n card('Page state', kilobytes(stateBytes()), 'state records from the server'),\n card(\n 'Blocks',\n String(blocks.length),\n `${countBlocks(blocks, 'waiting')} waiting, ${countBlocks(blocks, 'rendered')} rendered`,\n ),\n card('Handlers run', String(handlers), `${calls} server function calls`),\n ),\n element('h3', {}, 'Components on the page'),\n ids.length > 0\n ? table\n : element('div', { class: 'empty' }, 'No components with client state yet.'),\n );\n }\n\n /** A slot with its name, type and value. A value that JSON can hold can be edited. */\n function drawSlot(scope: Scope, slot: number, name: string): HTMLElement {\n const value = scope.s[slot];\n const cell = element('td');\n const line = element(\n 'tr',\n { class: 'slot' },\n element('td', { class: 'name' }, name),\n element('td', { class: 'type' }, readType(value)),\n cell,\n );\n if (editing?.scope === scope.id && editing.slot === slot) {\n const input = element('input', { 'aria-label': `New value of ${name}` });\n input.value = JSON.stringify(value) ?? '';\n input.addEventListener('keydown', (event) => {\n if (event.key === 'Enter') {\n editing = undefined;\n state.set?.(scope, slot, parseValue(input.value));\n draw();\n } else if (event.key === 'Escape') {\n editing = undefined;\n draw();\n }\n });\n cell.append(input);\n queueMicrotask(() => input.focus());\n return line;\n }\n const canEdit = editable(value) && state.set !== undefined;\n const text = element('span', { class: canEdit ? 'value' : 'value fixed' }, preview(value));\n if (canEdit) {\n text.title = 'Click to edit. Enter JSON, or text for a string.';\n text.addEventListener('click', () => {\n editing = { scope: scope.id, slot };\n draw();\n });\n }\n cell.append(text);\n return line;\n }\n\n async function drawScopes(): Promise<void> {\n const list = roots();\n const listed: string[] = [];\n for (const scope of list) {\n listed.push(scope.m!);\n }\n const infos = await loadComponents(state, listed);\n if (list.length === 0) {\n body.replaceChildren(\n element('div', { class: 'empty' }, 'No scopes yet. The first event loads them.'),\n );\n return;\n }\n const current = (selectedScope !== undefined && state.scopes?.get(selectedScope)) || list[0]!;\n const search = element('input', {\n type: 'search',\n placeholder: 'Filter components and values',\n 'aria-label': 'Filter scopes',\n });\n search.value = filter;\n search.addEventListener('input', () => {\n filter = search.value;\n void drawScopes().then(() => {\n const next = body.querySelector<HTMLInputElement>('input[type=\"search\"]');\n next?.focus();\n next?.setSelectionRange(filter.length, filter.length);\n });\n });\n const tree = element('div', { class: 'list' }, search);\n function visit(scope: Scope, info: ComponentInfo | undefined, depth: number): void {\n const label =\n scope.m === undefined\n ? `${info?.scopes[scope.k]?.label ?? 'scope'}${scope.h ? ' · hidden' : ''}`\n : (info?.name ?? scope.m);\n const classes = ['tree-row'];\n if (scope.m !== undefined) {\n classes.push('component');\n }\n if (state.written.has(scope.id)) {\n classes.push('written');\n }\n const button = element(\n 'button',\n {\n class: classes.join(' '),\n style: `padding-left: ${6 + depth * 14}px`,\n 'aria-current': String(scope === current),\n },\n element('span', {}, label),\n element(\n 'span',\n { class: 'file' },\n scope.m === undefined ? `#${scope.id}` : (info?.file ?? ''),\n ),\n );\n button.addEventListener('click', () => {\n selectedScope = scope.id;\n selected = findRootScope(scope).m;\n draw();\n });\n button.addEventListener('mouseenter', () => outline(scope.id));\n button.addEventListener('mouseleave', () => outline());\n tree.append(button);\n for (const child of scope.children ?? []) {\n if (child.m === undefined) {\n visit(child, info, depth + 1);\n }\n }\n }\n const needle = filter.trim().toLowerCase();\n for (const [index, scope] of list.entries()) {\n const info = infos[index];\n if (\n needle &&\n !`${info?.name ?? scope.m} ${info?.file ?? ''}`.toLowerCase().includes(needle)\n ) {\n // The name does not match, so look for a value that does.\n let matched = false;\n for (const value of scope.s) {\n if (preview(value).toLowerCase().includes(needle)) {\n matched = true;\n break;\n }\n }\n if (!matched) {\n continue;\n }\n }\n visit(scope, info, 0);\n }\n\n // The scope that is selected, with its slots.\n const component = findRootScope(current);\n const info = known.get(component.m ?? '');\n const plan = info?.scopes[current.k];\n const slots = element('table', { class: 'rows slots' }, row(['name', 'type', 'value'], 'th'));\n for (let slot = 0; slot < current.s.length; slot++) {\n slots.append(drawSlot(current, slot, plan?.slots[slot] ?? `slot ${slot}`));\n }\n const graph = iconButton('graph', 'Show the graph');\n graph.addEventListener('click', () => {\n selected = component.m;\n tab = 'graph';\n draw();\n });\n const detail = element(\n 'div',\n { class: `detail${state.written.has(current.id) ? ' written' : ''}` },\n element(\n 'h2',\n {},\n info?.name ?? component.m ?? '',\n element('span', { class: 'sub' }, ` · ${plan?.label ?? 'scope'}`),\n ),\n element(\n 'div',\n { class: 'toolbar' },\n pill(`scope ${current.id}`),\n current.h ? pill('hidden', 'yellow') : '',\n source(info),\n element('span', { class: 'spacer' }),\n graph,\n ),\n current.s.length > 0\n ? slots\n : element('div', { class: 'empty' }, 'This scope holds no values.'),\n );\n body.replaceChildren(element('div', { class: 'split' }, tree, detail));\n body.querySelector('[aria-current=\"true\"]')?.scrollIntoView({ block: 'nearest' });\n }\n\n /** What the dev server says about an anchor of a scope, with the component that has it. */\n async function findAnchor(scope: Scope, anchor: number) {\n const component = findRootScope(scope);\n const info = component.m ? await componentInfo(state, component.m) : undefined;\n return { info, component, place: info?.anchors?.[scope.k]?.[anchor] };\n }\n\n /** The names that an anchor reads, with their values in the scope. */\n function drawReads(scope: Scope, reads: string[]): Node[] {\n const pills: Node[] = [];\n for (const name of reads) {\n const value = readValue(scope, name);\n pills.push(\n element(\n 'span',\n { class: 'pill', style: 'margin: 0 4px 2px 0' },\n element('span', { class: 'name' }, name),\n value === undefined ? '' : ` = ${value}`,\n ),\n );\n }\n return pills;\n }\n\n /** The handlers of an element, from its `b-on`. */\n function drawHandlers(target: Element): HTMLElement {\n const table = element('table', { class: 'rows' }, row(['event', 'handler'], 'th'));\n for (const raw of (target.getAttribute('b-on') ?? '').split(/\\s+/)) {\n if (!raw) {\n continue;\n }\n const [head, ref = ''] = raw.split('=') as [string, string];\n const [type, ...modifiers] = head.split(':');\n const [component, name = ''] = ref.split('@')[0]!.split('#') as [string, string];\n const info = known.get(component);\n table.append(\n row([\n element('span', { class: 'mono' }, [type, ...modifiers].join(':')),\n element('span', { class: 'mono' }, `${info?.name ?? component} ${name}`),\n ]),\n );\n }\n return table;\n }\n\n async function drawElements(): Promise<void> {\n if (!picked?.isConnected) {\n const start = iconButton('pick', 'Pick an element');\n start.addEventListener('click', () => pick.click());\n body.replaceChildren(\n element('h2', {}, 'Elements'),\n element(\n 'p',\n { class: 'sub' },\n 'Pick an element of the page to see the component that renders it, its place in the file, its handlers and the values that update it.',\n ),\n start,\n );\n return;\n }\n const tag = `<${picked.tagName.toLowerCase()}>`;\n const content = element('div');\n const anchored = picked.closest('[b-b]');\n const [id = '', anchorText = '0'] = anchored?.getAttribute('b-b')!.split(':') ?? [];\n const scope = anchored ? findScope(id) : undefined;\n if (scope) {\n const anchor = Number(anchorText);\n const { info, component, place } = await findAnchor(scope, anchor);\n const scopeButton = element(\n 'button',\n { class: 'link', title: 'Show the scope' },\n `scope ${scope.id}${info?.scopes[scope.k] ? ` · ${info.scopes[scope.k]!.label}` : ''}`,\n );\n scopeButton.addEventListener('click', () => {\n selectedScope = scope.id;\n tab = 'scopes';\n draw();\n });\n content.append(\n element(\n 'h2',\n {},\n picked === anchored ? (place?.label ?? tag) : `${tag} in ${place?.label ?? 'an element'}`,\n element('span', { class: 'sub' }, ` · ${info?.name ?? component.m}`),\n ),\n element(\n 'div',\n { class: 'kv' },\n element('span', {}, 'source'),\n element('span', {}, place?.at ? source(info, place.at) : '—'),\n element('span', {}, 'scope'),\n element('span', {}, scopeButton),\n element('span', {}, 'anchor'),\n element('span', { class: 'mono' }, String(anchor)),\n element('span', {}, 'reads'),\n element(\n 'span',\n {},\n ...(place && place.reads.length > 0 ? drawReads(scope, place.reads) : ['—']),\n ),\n ),\n );\n const handled = picked.closest('[b-on]');\n if (handled && anchored!.contains(handled)) {\n content.append(element('h3', {}, 'Handlers'), drawHandlers(handled));\n }\n } else {\n content.append(\n element('h2', {}, tag),\n element(\n 'div',\n { class: 'empty' },\n anchored\n ? `Scope ${id} is not in the browser yet.`\n : 'Nothing in the browser updates this element or the elements around it.',\n ),\n );\n }\n // The inserts and blocks inside the element, which have markers instead of `b-b`.\n const markers: { data: string; scope: Scope; anchor: number }[] = [];\n const walker = document.createTreeWalker(picked, NodeFilter.SHOW_COMMENT);\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n const data = (node as Comment).data;\n const match = /^[tb](-?[\\d.]+):(\\d+)/.exec(data);\n const markerScope = match && findScope(match[1]!);\n if (markerScope) {\n markers.push({ data, scope: markerScope, anchor: Number(match![2]) });\n }\n }\n const pending: ReturnType<typeof findAnchor>[] = [];\n for (const marker of markers) {\n pending.push(findAnchor(marker.scope, marker.anchor));\n }\n const places = await Promise.all(pending);\n const inside = element('table', { class: 'rows' }, row(['marker', 'source', 'reads'], 'th'));\n for (const [index, marker] of markers.entries()) {\n const { info, place } = places[index]!;\n inside.append(\n row([\n element('span', { class: 'mono' }, place?.label ?? marker.data),\n place?.at ? source(info, place.at) : '',\n element('span', {}, ...drawReads(marker.scope, place?.reads ?? [])),\n ]),\n );\n }\n if (markers.length > 0) {\n content.append(element('h3', {}, 'Inside it'), inside);\n }\n body.replaceChildren(content);\n }\n\n let cooling: ReturnType<typeof setTimeout> | undefined;\n\n async function drawGraph(): Promise<void> {\n const id = selected ?? roots()[0]?.m;\n const info = id ? await componentInfo(state, id) : undefined;\n if (!id || !info) {\n body.replaceChildren(element('div', { class: 'empty' }, 'No component yet.'));\n return;\n }\n if (!info.graph) {\n body.replaceChildren(\n element('div', { class: 'toolbar' }, chooser(id)),\n element(\n 'div',\n { class: 'empty' },\n 'The dev server sent no graph. It runs an older brumate than this panel: restart it.',\n ),\n );\n return;\n }\n const { nodes, edges } = info.graph;\n // The current value of each value node, from the first instance of the component.\n let instance: Scope | undefined;\n for (const scope of roots()) {\n if (scope.m === id) {\n instance = scope;\n break;\n }\n }\n const scopeOfNode = new Map<number, Scope>();\n function visit(scope: Scope): void {\n if (!scopeOfNode.has(scope.k)) {\n scopeOfNode.set(scope.k, scope);\n }\n for (const child of scope.children ?? []) {\n if (child.m === undefined) {\n visit(child);\n }\n }\n }\n if (instance) {\n visit(instance);\n }\n // Nodes that a recent write reached: the written value, and what reads it.\n const now = performance.now();\n const hot = new Set<number>();\n for (const entry of state.log) {\n if (entry.write?.component === id && now - entry.time < HOT_MS) {\n for (const [index, node] of nodes.entries()) {\n if (node.scope === entry.write!.k && node.slot === entry.write!.slot) {\n hot.add(index);\n }\n }\n }\n }\n for (let grew = true; grew;) {\n grew = false;\n for (const [from, to] of edges) {\n if (hot.has(from) && !hot.has(to)) {\n hot.add(to);\n grew = true;\n }\n }\n }\n // A markup node is named by what it is and its place in the file, such as `insert 9:42`.\n const parts: {\n name: string;\n meta: string;\n value: string | undefined;\n at: string | undefined;\n }[] = [];\n for (const node of nodes) {\n const at = /^(.*) (\\d+:\\d+)$/.exec(node.label);\n const owner = node.slot === undefined ? undefined : scopeOfNode.get(node.scope);\n const value = owner && node.slot !== undefined ? preview(owner.s[node.slot]) : undefined;\n let meta = at ? `${node.kind} · ${at[2]}` : node.kind;\n if (value !== undefined) {\n meta = `= ${value}`;\n }\n parts.push({\n name: at ? at[1]! : node.label,\n meta,\n value,\n at: at?.[2],\n });\n }\n function getNodeWidth(index: number): number {\n return Math.min(\n 262,\n Math.max(\n 112,\n 36 + 7 * Math.max(clip(parts[index]!.name).length, clip(parts[index]!.meta).length),\n ),\n );\n }\n const position = layoutGraph(nodes, edges, getNodeWidth);\n // What the clicked node reads, and what reads it, all the way.\n const related = new Set<number>();\n if (graphNode !== undefined && graphNode < nodes.length) {\n related.add(graphNode);\n for (const [from, to] of [\n [0, 1],\n [1, 0],\n ] as const) {\n const queue = [graphNode];\n while (queue.length > 0) {\n const next = queue.pop()!;\n for (const edge of edges) {\n if (edge[from] === next && !related.has(edge[to])) {\n related.add(edge[to]);\n queue.push(edge[to]);\n }\n }\n }\n }\n }\n let graphWidth = 0;\n let graphHeight = 0;\n for (const place of position) {\n graphWidth = Math.max(graphWidth, place.x + place.width);\n graphHeight = Math.max(graphHeight, place.y);\n }\n graphWidth += 16;\n graphHeight += 56;\n const layer = svg('g', { class: 'layer' });\n for (const [from, to] of edges) {\n const a = position[from]!;\n const b = position[to]!;\n const x1 = a.x + a.width;\n const y1 = a.y + 19;\n const x2 = b.x - 3;\n const y2 = b.y + 19;\n const bend = Math.max(28, (x2 - x1) / 2);\n const classes = ['edge'];\n if (hot.has(from) && hot.has(to)) {\n classes.push('hot-edge');\n } else if (related.size > 0) {\n classes.push(related.has(from) && related.has(to) ? 'lit' : 'faded');\n }\n layer.append(\n svg('path', {\n class: classes.join(' '),\n d: `M${x1},${y1} C${x1 + bend},${y1} ${x2 - bend},${y2} ${x2},${y2}`,\n 'marker-end': 'url(#arrow)',\n }),\n );\n }\n for (const [index, node] of nodes.entries()) {\n const { x, y, width: nodeWidth } = position[index]!;\n const part = parts[index]!;\n const classes = ['node', `k-${node.kind}`];\n if (hot.has(index)) {\n classes.push('hot');\n }\n if (graphNode === index) {\n classes.push('selected');\n }\n if (related.size > 0 && !related.has(index)) {\n classes.push('faded');\n }\n const name = svg('text', { class: 'name', x: x + 23, y: y + 16 });\n name.textContent = clip(part.name);\n const meta = svg('text', { class: 'meta', x: x + 23, y: y + 30 });\n meta.textContent = clip(part.meta);\n const title = svg('title', {});\n title.textContent = `${node.kind} ${node.label}${part.value === undefined ? '' : ` = ${part.value}`}`;\n const group = svg(\n 'g',\n { class: classes.join(' '), 'data-node': index },\n svg('rect', { class: 'box', x, y, width: nodeWidth, height: 38, rx: 7 }),\n svg('circle', { class: 'kind', cx: x + 13, cy: y + 12.5, r: 3.5 }),\n name,\n meta,\n title,\n );\n group.addEventListener('click', (event) => {\n event.stopPropagation();\n graphNode = graphNode === index ? undefined : index;\n draw();\n });\n layer.append(group);\n }\n const canvas = svg(\n 'svg',\n { role: 'img', 'aria-label': `Graph of ${info.name}` },\n svg(\n 'defs',\n {},\n svg(\n 'marker',\n {\n id: 'arrow',\n viewBox: '0 0 8 8',\n refX: 7,\n refY: 4,\n markerWidth: 6,\n markerHeight: 6,\n orient: 'auto',\n },\n svg('path', { d: 'M0,0 L8,4 L0,8 z', fill: '#8a8280' }),\n ),\n ),\n layer,\n );\n const frame = element('div', { class: 'graph-view' }, canvas);\n function apply(): void {\n layer.setAttribute('transform', `translate(${view.x},${view.y}) scale(${view.scale})`);\n }\n function fit(): void {\n const box = frame.getBoundingClientRect();\n if (box.width === 0) {\n return;\n }\n view.scale = Math.min(\n 1.2,\n Math.max(0.3, Math.min(box.width / graphWidth, box.height / graphHeight)),\n );\n view.x = (box.width - graphWidth * view.scale) / 2;\n view.y = Math.max(0, (box.height - graphHeight * view.scale) / 2);\n apply();\n }\n function zoomAt(factor: number, px: number, py: number): void {\n const next = Math.min(3, Math.max(0.2, view.scale * factor));\n view.x = px - ((px - view.x) * next) / view.scale;\n view.y = py - ((py - view.y) * next) / view.scale;\n view.scale = next;\n apply();\n }\n // Drag to pan, and scroll to zoom around the pointer.\n frame.addEventListener(\n 'wheel',\n (event) => {\n event.preventDefault();\n const box = frame.getBoundingClientRect();\n zoomAt(event.deltaY < 0 ? 1.1 : 1 / 1.1, event.clientX - box.left, event.clientY - box.top);\n },\n { passive: false },\n );\n frame.addEventListener('pointerdown', (event) => {\n if ((event.target as Element).closest('.node, button')) {\n return;\n }\n const start = { x: event.clientX - view.x, y: event.clientY - view.y };\n frame.classList.add('dragging');\n function move(next: PointerEvent): void {\n view.x = next.clientX - start.x;\n view.y = next.clientY - start.y;\n apply();\n }\n function up(): void {\n frame.classList.remove('dragging');\n window.removeEventListener('pointermove', move);\n window.removeEventListener('pointerup', up);\n }\n window.addEventListener('pointermove', move);\n window.addEventListener('pointerup', up);\n });\n canvas.addEventListener('click', () => {\n if (graphNode !== undefined) {\n graphNode = undefined;\n draw();\n }\n });\n function zoomButton(name: 'plus' | 'minus', title: string, factor: number): HTMLElement {\n const button = iconButton(name, title, {}, true);\n button.addEventListener('click', () => {\n const box = frame.getBoundingClientRect();\n zoomAt(factor, box.width / 2, box.height / 2);\n });\n return button;\n }\n const fitButton = iconButton('fit', 'Fit the graph in view', {}, true);\n fitButton.addEventListener('click', fit);\n frame.append(\n element(\n 'div',\n { class: 'zoom' },\n zoomButton('minus', 'Zoom out', 1 / 1.2),\n zoomButton('plus', 'Zoom in', 1.2),\n fitButton,\n ),\n );\n\n // The side: the node that was clicked, or how to read the graph.\n const side = element('div', { class: 'graph-side' });\n if (graphNode !== undefined && graphNode < nodes.length) {\n const node = nodes[graphNode]!;\n const part = parts[graphNode]!;\n function list(indexes: number[]): Node {\n if (indexes.length === 0) {\n return element('div', { class: 'sub' }, 'nothing');\n }\n const labels: HTMLElement[] = [];\n for (const index of indexes) {\n labels.push(element('div', { class: 'mono' }, nodes[index]!.label));\n }\n return element('div', {}, ...labels);\n }\n // The nodes that this node reads, and the nodes that read it.\n const reads: number[] = [];\n const readBy: number[] = [];\n for (const [from, to] of edges) {\n if (to === graphNode) {\n reads.push(from);\n }\n if (from === graphNode) {\n readBy.push(to);\n }\n }\n const color = nodeColor(node.kind, node.slot);\n side.append(\n element('h2', {}, part.name),\n element(\n 'div',\n { class: 'toolbar' },\n pill(node.kind, color),\n part.at ? source(info, part.at) : '',\n ),\n ...(part.value === undefined\n ? []\n : [element('h3', {}, 'Value'), element('div', { class: 'mono' }, part.value)]),\n element('h3', {}, 'Reads'),\n list(reads),\n element('h3', {}, 'Read by'),\n list(readBy),\n );\n } else {\n side.append(\n element('h2', {}, info.name),\n element(\n 'p',\n { class: 'sub', style: 'margin-top: 0' },\n 'What changes in the browser, and what reads what, left to right. Click a node to follow it. Drag to pan, and scroll to zoom.',\n ),\n element(\n 'div',\n { class: 'legend', style: 'flex-direction: column; align-items: flex-start; gap: 4px' },\n key('var(--blue)', 'signals and props'),\n key('var(--purple)', 'memos'),\n key('var(--faint)', 'markup'),\n key('var(--green)', 'effects'),\n key('var(--yellow)', 'what a change reached'),\n ),\n );\n }\n body.replaceChildren(\n element(\n 'div',\n { class: 'toolbar' },\n chooser(id),\n element('span', { class: 'sub' }, `${nodes.length} nodes · ${edges.length} edges`),\n ),\n nodes.length > 0\n ? element('div', { class: 'graph-wrap' }, frame, side)\n : element('div', { class: 'empty' }, 'Nothing in this component changes in the browser.'),\n );\n // A new component fits the view. Otherwise the pan and zoom stay.\n if (view.fitted === id) {\n apply();\n } else {\n view = { x: 0, y: 0, scale: 1, fitted: id };\n apply();\n requestAnimationFrame(fit);\n }\n // Draws again when the marks of the last write expire.\n if (hot.size > 0) {\n clearTimeout(cooling);\n cooling = setTimeout(() => state.changed?.(), HOT_MS);\n }\n }\n\n function drawLog(): void {\n const filters = element('div', { class: 'toolbar filters' });\n for (const kind of KINDS) {\n const box = element('input', { type: 'checkbox' });\n box.checked = shown.has(kind);\n box.addEventListener('change', () => {\n if (box.checked) {\n shown.add(kind);\n } else {\n shown.delete(kind);\n }\n draw();\n });\n filters.append(element('label', { class: `kind-${kind}` }, box, kind));\n }\n const search = element('input', {\n type: 'search',\n placeholder: 'Search the log',\n 'aria-label': 'Search the log',\n });\n search.value = logSearch;\n search.addEventListener('input', () => {\n logSearch = search.value;\n drawLog();\n const next = body.querySelector<HTMLInputElement>('input[type=\"search\"]');\n next?.focus();\n next?.setSelectionRange(logSearch.length, logSearch.length);\n });\n const pause = iconButton(paused ? 'play' : 'pause', paused ? 'Resume' : 'Pause', {\n 'aria-pressed': String(paused),\n });\n pause.addEventListener('click', () => {\n paused = !paused;\n frozen = paused ? [...state.log] : undefined;\n draw();\n });\n const clear = iconButton('trash', 'Clear');\n clear.addEventListener('click', () => {\n state.log.length = 0;\n frozen = paused ? [] : undefined;\n draw();\n });\n filters.append(search, pause, clear);\n const needle = logSearch.trim().toLowerCase();\n const entries: DevtoolsEntry[] = [];\n for (const entry of frozen ?? state.log) {\n if (shown.has(entry.kind) && (!needle || readText(entry).toLowerCase().includes(needle))) {\n entries.push(entry);\n }\n }\n const list = element('table', { class: 'rows' });\n for (const entry of entries.toReversed()) {\n list.append(\n element(\n 'tr',\n { class: `entry ${entry.kind}` },\n element('td', { class: 'time' }, seconds(entry.time)),\n element('td', { class: `kind-${entry.kind}`, style: 'width: 1%' }, entry.kind),\n element('td', {}, readText(entry)),\n ),\n );\n }\n body.replaceChildren(\n filters,\n entries.length > 0 ? list : element('div', { class: 'empty' }, 'Nothing to show.'),\n );\n }\n\n async function drawState(): Promise<void> {\n const scopes: Scope[] = [];\n const ids = new Set<string>();\n for (const scope of state.scopes?.values() ?? []) {\n // The scopes that the browser made are not in the state that the server sent.\n if (typeof scope.id !== 'number' || scope.id >= 0) {\n scopes.push(scope);\n const id = findRootScope(scope).m ?? '';\n if (id) {\n ids.add(id);\n }\n }\n }\n await loadComponents(state, ids);\n // The slots of every instance of a scope add up, such as the items of a list.\n const slots = new Map<\n string,\n { component: string; k: number; slot: number; bytes: number; count: number }\n >();\n for (const scope of scopes) {\n const component = findRootScope(scope).m ?? '';\n for (const [slot, value] of scope.s.entries()) {\n const key = `${component}:${scope.k}:${slot}`;\n const entry = slots.get(key) ?? { component, k: scope.k, slot, bytes: 0, count: 0 };\n entry.bytes += measureSize(value);\n entry.count++;\n slots.set(key, entry);\n }\n }\n const sorted = [...slots.values()].toSorted((a, b) => b.bytes - a.bytes);\n const first = document.querySelector('script[b-state][b-scopes]')?.textContent?.length ?? 0;\n const table = element(\n 'table',\n { class: 'rows' },\n row(['component', 'scope', 'value', 'instances', 'about', 'read in the browser by'], 'th'),\n );\n for (const entry of sorted.slice(0, 200)) {\n const info = known.get(entry.component);\n const layout = info?.scopes[entry.k];\n const readers = layout?.readers?.[entry.slot] ?? [];\n const tr = element(\n 'tr',\n {},\n element('td', {}, info?.name ?? entry.component),\n element('td', { class: 'mono' }, layout?.label ?? String(entry.k)),\n element('td', { class: 'mono' }, layout?.slots[entry.slot] ?? `slot ${entry.slot}`),\n element('td', { class: 'mono' }, String(entry.count)),\n element('td', { class: 'mono', style: 'white-space: nowrap' }, kilobytes(entry.bytes)),\n element('td', { class: 'mono' }, readers.join(', ') || '—'),\n );\n // A large value is worth a look: does the browser need all of it?\n if (entry.bytes > 1024) {\n tr.className = 'large';\n tr.title = 'More than 1 kB. Send only the fields that the browser reads.';\n }\n table.append(tr);\n }\n body.replaceChildren(\n element(\n 'div',\n { class: 'cards' },\n card('Page state', kilobytes(stateBytes()), 'every state record of the page'),\n card('First record', kilobytes(first), 'the state that the page started with'),\n card('Values', String(slots.size), `in ${scopes.length} scopes`),\n ),\n element(\n 'div',\n { class: 'legend', style: 'margin: 10px 0 6px' },\n element(\n 'span',\n { class: 'sub' },\n 'A value is sent because code in the browser reads it. Sizes are about what the state takes, and a value of many instances adds them up.',\n ),\n ),\n slots.size > 0 ? table : element('div', { class: 'empty' }, 'The page sent no state.'),\n );\n }\n\n /** The effects and `$client` callbacks, with how often each ran and when its cleanup ran. */\n async function drawEffects(): Promise<void> {\n const effects = [...state.effects.values()];\n const ids = new Set<string>();\n for (const effect of effects) {\n ids.add(effect.component);\n }\n await loadComponents(state, ids);\n const now = performance.now();\n // Runs in the last second, which is how an effect that runs too often shows.\n function lastSecond(recent: number[]): number {\n let count = 0;\n for (const at of recent) {\n if (now - at < 1000) {\n count++;\n }\n }\n return count;\n }\n const sorted = effects.toSorted(\n (a, b) => lastSecond(b.recent) - lastSecond(a.recent) || b.runs - a.runs,\n );\n const table = element(\n 'table',\n { class: 'rows' },\n row(\n ['component', 'scope', 'name', 'runs', 'last second', 'time', 'cleanups', 'last run'],\n 'th',\n ),\n );\n for (const effect of sorted) {\n const info = known.get(effect.component);\n const recent = lastSecond(effect.recent);\n const last = effect.recent.at(-1);\n const tr = element(\n 'tr',\n {},\n element('td', {}, info?.name ?? effect.component),\n element('td', { class: 'mono' }, info?.scopes[effect.k]?.label ?? String(effect.scope)),\n element(\n 'td',\n {},\n pill(\n effect.name.startsWith('c') ? '$client' : '$effect',\n effect.name.startsWith('c') ? 'purple' : 'blue',\n ),\n ' ',\n element('span', { class: 'mono' }, effect.name),\n ),\n element('td', { class: 'mono' }, String(effect.runs)),\n element('td', { class: 'mono' }, String(recent)),\n element('td', { class: 'mono' }, ms(effect.time)),\n element('td', { class: 'mono' }, String(effect.cleanups)),\n element('td', { class: 'mono' }, last === undefined ? '' : `${seconds(now - last)} ago`),\n );\n if (recent >= 10) {\n tr.className = 'busy';\n tr.title = 'It ran 10 times or more in the last second. Check what it reads.';\n } else if (!effect.active) {\n tr.className = 'ended';\n tr.title = 'Its cleanup ran, and it has not run again, such as in a scope that went.';\n }\n table.append(tr);\n }\n let active = 0;\n let runs = 0;\n let busy = 0;\n for (const effect of effects) {\n if (effect.active) {\n active++;\n }\n runs += effect.runs;\n if (lastSecond(effect.recent) >= 10) {\n busy++;\n }\n }\n body.replaceChildren(\n element(\n 'div',\n { class: 'cards' },\n card('Active', String(active), `of ${effects.length} that ran`),\n card('Runs', String(runs), 'since the page loaded'),\n card('Busy', String(busy), 'ran 10 times or more in the last second'),\n ),\n effects.length > 0\n ? table\n : element('div', { class: 'empty' }, 'No effect or $client callback has run yet.'),\n );\n }\n\n /**\n * The client navigations of the page, newest first: the routes that\n * stayed, those that were replaced, or the whole page, and how far the\n * IDs of the new page moved.\n */\n async function drawNavigation(): Promise<void> {\n const list = state.navigations.toReversed();\n const items: HTMLElement[] = [];\n for (const navigation of list) {\n const path = new URL(navigation.url).pathname + new URL(navigation.url).search;\n const routes = element('div', { class: 'routes' });\n if (navigation.full) {\n routes.append(\n element(\n 'div',\n { class: 'sub' },\n navigation.kind === 'form'\n ? 'The whole page: a form changes what can show anywhere on it.'\n : 'The whole page: its root route or its layouts did not match the page before.',\n ),\n );\n } else {\n for (const key of navigation.kept) {\n routes.append(element('div', { class: 'mono' }, pill('kept', 'green'), ' ', key));\n }\n for (const change of navigation.replaced) {\n routes.append(\n element(\n 'div',\n { class: 'mono' },\n pill('replaced', 'yellow'),\n ` ${change.slot}: ${change.from} → ${change.to}`,\n ),\n );\n }\n }\n items.push(\n element(\n 'div',\n { class: 'navigation' },\n element(\n 'div',\n { class: 'toolbar' },\n element('span', { class: 'mono' }, path),\n pill(navigation.kind, navigation.kind === 'form' ? 'purple' : 'blue'),\n element('span', { class: 'sub' }, `${ms(navigation.time)} until the page changed`),\n navigation.shift === undefined\n ? ''\n : element('span', { class: 'sub' }, `IDs moved by ${navigation.shift}`),\n ),\n routes,\n ),\n );\n }\n body.replaceChildren(\n ...(items.length > 0\n ? items\n : [\n element(\n 'div',\n { class: 'empty' },\n 'No client navigation yet. Follow a link of the page to see what it keeps.',\n ),\n ]),\n );\n }\n\n /**\n * What the server did for the last page that loaded: the render until the\n * page could stream, each memo that loaded and each server function call,\n * each `#loading` body, and the rest of the stream, on one scale. The\n * server writes it at the end of the page, in development.\n */\n async function drawServer(): Promise<void> {\n const script = [...document.querySelectorAll('script[b-trace]')].at(-1);\n let trace: { route: string; entries: TraceEntry[] } | undefined;\n try {\n trace = script ? JSON.parse(script.textContent ?? '') : undefined;\n } catch {\n trace = undefined;\n }\n if (!trace) {\n body.replaceChildren(\n element(\n 'div',\n { class: 'empty' },\n 'No trace yet. The dev server writes one at the end of each page that it renders.',\n ),\n );\n return;\n }\n const entries = trace.entries.toSorted((a, b) => a.start - b.start);\n let total = 1;\n for (const entry of entries) {\n total = Math.max(total, entry.end ?? entry.start);\n }\n const table = element(\n 'table',\n { class: 'rows' },\n row(['step', 'what', 'took', `when, 0 to ${ms(total)}`], 'th'),\n );\n for (const entry of entries) {\n const end = entry.end ?? total;\n const tr = element(\n 'tr',\n {},\n element('td', {}, pill(entry.kind, entry.failed ? 'red' : '')),\n element('td', { class: 'mono' }, entry.label),\n element('td', { class: 'mono' }, entry.end === undefined ? '…' : ms(end - entry.start)),\n element(\n 'td',\n { class: 'bar-cell' },\n element(\n 'div',\n { class: 'bar-track' },\n element('span', {\n class: `bar ${entry.failed ? 'failed' : entry.kind}`,\n style: `left:${(entry.start / total) * 100}%;width:${((end - entry.start) / total) * 100}%`,\n title: `${ms(entry.start)} to ${ms(end)}`,\n }),\n ),\n ),\n );\n if (entry.failed) {\n tr.className = 'failed';\n }\n table.append(tr);\n }\n let render: TraceEntry | undefined;\n const counts = new Map<TraceEntry['kind'], number>();\n for (const entry of entries) {\n if (entry.kind === 'render' && !render) {\n render = entry;\n }\n counts.set(entry.kind, (counts.get(entry.kind) ?? 0) + 1);\n }\n function count(kind: TraceEntry['kind']): number {\n return counts.get(kind) ?? 0;\n }\n body.replaceChildren(\n element(\n 'div',\n { class: 'cards' },\n card(\n 'Until it streamed',\n render?.end === undefined ? '…' : ms(render.end),\n `the render of ${trace.route}`,\n ),\n card('Whole page', ms(total), 'until the last body streamed'),\n card('Memos that loaded', String(count('memo')), `${count('call')} server function calls`),\n card('Bodies', String(count('body')), '#loading bodies that streamed'),\n ),\n element(\n 'div',\n { class: 'legend', style: 'margin: 10px 0 6px' },\n key('var(--accent)', 'render'),\n key('var(--green)', 'memo'),\n key('var(--blue)', 'server function call'),\n key('var(--purple)', '#loading body'),\n key('var(--faint)', 'the rest of the stream'),\n element('span', { class: 'sub' }, 'Of the last page that the dev server rendered.'),\n ),\n table,\n );\n }\n\n async function drawTimeline(): Promise<void> {\n const runs = state.timeline.toReversed().slice(0, 40);\n const ids = new Set<string>();\n for (const run of runs) {\n ids.add(run.ref.split('#')[0]!);\n }\n await loadComponents(state, ids);\n if (runs.length === 0) {\n body.replaceChildren(\n element('h2', {}, 'Timeline'),\n element(\n 'p',\n { class: 'sub' },\n 'Each handler that runs shows here, with the time its code took to load, its own run, the server functions it called and the updates that followed.',\n ),\n );\n return;\n }\n const now = performance.now();\n const totals: number[] = [];\n for (const run of runs) {\n totals.push((run.settled ?? now) - run.begun);\n }\n function segment(\n run: Interaction,\n scale: number,\n start: number,\n end: number,\n kind: string,\n title: string,\n ): HTMLElement {\n // Inside the track: a bar that starts before the run, or ends after the scale, is cut.\n const left = Math.min(Math.max(((start - run.begun) / scale) * 100, 0), 100);\n const width = Math.min(Math.max(((end - start) / scale) * 100, 0), 100 - left);\n return element('span', {\n class: `seg ${kind}`,\n style: `left:${left}%;width:${width}%`,\n title,\n });\n }\n const list = element('div');\n for (const [index, run] of runs.entries()) {\n const total = totals[index]!;\n let last = run.settled ?? now;\n for (const call of run.calls) {\n last = Math.max(last, call.end ?? now);\n }\n for (const update of run.updates) {\n last = Math.max(last, update.end);\n }\n // The scale ends at a round tick past the last bar, so the ruler reads in round numbers.\n const step = tickStep(Math.max(last - run.begun, 1) / 4);\n const scale = Math.ceil(Math.max(last - run.begun, 1) / step) * step;\n const ticks = element('div', { class: 'ruler' });\n for (let time = 0; time <= scale + step / 2; time += step) {\n const at = (time / scale) * 100;\n ticks.append(\n element('span', { class: at > 99 ? 'end' : '', style: `left:${at}%` }, ms(time)),\n );\n }\n // Lines through the tracks at each tick.\n const grid = `background-image: repeating-linear-gradient(to right, #ffffff1a 0 1px, transparent 1px ${(step / scale) * 100}%)`;\n const handler = element(\n 'div',\n { class: 'track', style: grid },\n ...(run.ready - run.begun > 0.5\n ? [\n segment(\n run,\n scale,\n run.begun,\n run.ready,\n 'wait',\n `waiting for its code and the handlers before it: ${ms(run.ready - run.begun)}`,\n ),\n ]\n : []),\n segment(\n run,\n scale,\n run.ready,\n run.end,\n run.failed ? 'failed' : 'run',\n `its run: ${ms(run.end - run.ready)}`,\n ),\n ...(run.settled !== undefined && run.settled - run.end > 0.5\n ? [\n segment(\n run,\n scale,\n run.end,\n run.settled,\n 'async',\n `its promise: ${ms(run.settled - run.end)}`,\n ),\n ]\n : []),\n );\n const rows: HTMLElement[] = [\n element('div', { class: 'run-row' }, element('span'), ticks, element('span')),\n element(\n 'div',\n { class: 'run-row' },\n element('span', { class: 'name' }, 'handler'),\n handler,\n element('span', { class: 'took' }, run.settled === undefined ? '…' : ms(total)),\n ),\n ];\n for (const call of run.calls) {\n const end = call.end ?? now;\n const parts = [\n segment(\n run,\n scale,\n call.start,\n end,\n call.status === 'failed' ? 'failed' : 'call',\n `the round trip: ${ms(end - call.start)}`,\n ),\n ];\n if (call.server !== undefined) {\n // The time on the server, in the middle of the round trip.\n const middle = call.start + (end - call.start - call.server) / 2;\n parts.push(\n segment(\n run,\n scale,\n middle,\n middle + call.server,\n 'server',\n `on the server: ${ms(call.server)}`,\n ),\n );\n }\n rows.push(\n element(\n 'div',\n { class: 'run-row' },\n element('span', { class: 'name', title: call.name }, `call ${handlerName(call.name)}`),\n element('div', { class: 'track', style: grid }, ...parts),\n element(\n 'span',\n { class: 'took' },\n call.end === undefined\n ? '…'\n : `${ms(end - call.start)}${call.server === undefined ? '' : ` (${ms(call.server)})`}`,\n ),\n ),\n );\n }\n // The batches of updates share a row, each on its own bar.\n if (run.updates.length > 0) {\n let count = 0;\n let took = 0;\n const updateSegments: HTMLElement[] = [];\n for (const update of run.updates) {\n count += update.count;\n took += update.end - update.start;\n updateSegments.push(\n segment(\n run,\n scale,\n update.start,\n update.end,\n 'update',\n `${update.count} ${update.count === 1 ? 'update' : 'updates'} and their effects: ${ms(update.end - update.start)}`,\n ),\n );\n }\n const batches = run.updates.length;\n rows.push(\n element(\n 'div',\n { class: 'run-row' },\n element(\n 'span',\n { class: 'name' },\n `${count} ${count === 1 ? 'update' : 'updates'}${batches > 1 ? `, ${batches} batches` : ''}`,\n ),\n element('div', { class: 'track', style: grid }, ...updateSegments),\n element('span', { class: 'took' }, ms(took)),\n ),\n );\n }\n const speed = speedColor(total);\n list.append(\n element(\n 'div',\n { class: 'interaction' },\n element(\n 'div',\n { class: 'run-head' },\n element('span', { class: 'what' }, run.label),\n element('span', { class: 'ref' }, handlerName(run.ref)),\n element('span', { class: 'spacer' }),\n run.failed ? pill('failed', 'red') : '',\n pill(\n run.settled === undefined ? 'running' : ms(total),\n run.settled === undefined ? 'blue' : speed,\n ),\n element('span', { class: 'sub' }, seconds(run.begun)),\n ),\n ...rows,\n ),\n );\n }\n const settled: number[] = [];\n let callCount = 0;\n for (const [index, run] of runs.entries()) {\n if (run.settled !== undefined) {\n settled.push(totals[index]!);\n }\n callCount += run.calls.length;\n }\n const clear = iconButton('trash', 'Clear');\n clear.addEventListener('click', () => {\n state.timeline.length = 0;\n draw();\n });\n body.replaceChildren(\n element(\n 'div',\n { class: 'cards' },\n card('Handlers', String(state.timeline.length), 'the last 40 show here'),\n card(\n 'Slowest',\n settled.length > 0 ? ms(Math.max(...settled)) : '—',\n 'from the event to the end of its promise',\n ),\n card('Server calls', String(callCount), 'made by these handlers'),\n ),\n element(\n 'div',\n { class: 'toolbar', style: 'margin-top: 8px' },\n element(\n 'div',\n { class: 'legend' },\n element(\n 'span',\n {},\n element('i', {\n style:\n 'background: repeating-linear-gradient(45deg, var(--faint) 0 2px, transparent 2px 4px)',\n }),\n 'waiting for code',\n ),\n key('var(--blue)', 'run'),\n key('#7cb7ff55', 'its promise'),\n key('#ff9ecf88', 'server call'),\n key('#ff9ecf', 'on the server'),\n key('var(--green)', 'updates'),\n ),\n element('span', { class: 'spacer' }),\n clear,\n ),\n list,\n );\n }\n\n function drawBlocks(): void {\n const blocks = [...state.blocks.values()];\n const table = element(\n 'table',\n { class: 'rows' },\n row(['block', 'id', 'trigger', 'state', 'fired', 'rendered', ''], 'th'),\n );\n for (const block of blocks) {\n const action = element('span');\n if (block.state === 'waiting' && (block.kind === 'defer' || block.kind === 'client')) {\n const fire = iconButton('bolt', 'Fire', { title: 'Fire the trigger now' });\n fire.addEventListener('click', () => {\n state.fire?.(block);\n draw();\n });\n action.append(fire);\n }\n // A body that the page swapped in, whose fallback it kept, can show its fallback again.\n const kept = (globalThis as { $bD?: Record<string, unknown> }).$bD?.[block.id];\n if (\n block.state === 'rendered' &&\n kept &&\n (block.kind === 'loading' || block.kind === 'defer')\n ) {\n const toggle = iconButton(\n block.fallback ? 'play' : 'pause',\n block.fallback ? 'Body' : 'Fallback',\n {\n title: block.fallback\n ? 'Show the body again'\n : 'Show the fallback in place of the body',\n 'aria-pressed': String(block.fallback === true),\n },\n );\n toggle.addEventListener('click', () => {\n state.showFallback?.(block, !block.fallback);\n draw();\n });\n action.append(toggle);\n }\n let took = '';\n if (block.rendered !== undefined) {\n took =\n block.fired === undefined\n ? seconds(block.rendered)\n : `+${ms(block.rendered - block.fired)}`;\n }\n table.append(\n row([\n pill(blockLabel(block), block.kind === '$client' ? 'blue' : 'accent'),\n element('span', { class: 'mono' }, block.id),\n block.trigger ?? '',\n pill(block.state, STATE_COLORS[block.state]),\n block.fired === undefined ? '' : seconds(block.fired),\n took,\n action,\n ]),\n );\n }\n body.replaceChildren(\n element('h2', {}, 'Blocks that render after the page'),\n element(\n 'p',\n { class: 'sub', style: 'margin-top: 0' },\n 'Streaming bodies come with the page. Waiting ones wait for their trigger, and Fire runs it now. Fallback shows the fallback of a body again, to check both sides.',\n ),\n blocks.length > 0\n ? table\n : element('div', { class: 'empty' }, 'No blocks that render later on this page.'),\n );\n }\n\n async function drawReport(): Promise<void> {\n const id = selected ?? roots()[0]?.m;\n const info = id ? await componentInfo(state, id) : undefined;\n body.replaceChildren(\n ...(info\n ? [\n element('div', { class: 'toolbar' }, chooser(id), source(info)),\n element('pre', { class: 'report' }, info.text),\n ]\n : [element('div', { class: 'empty' }, 'No component yet.')]),\n );\n }\n\n /** The draw of each tab that loads what it shows. Log and Blocks draw at once. */\n const drawTab: Record<Exclude<Tab, 'log' | 'blocks'>, () => Promise<void>> = {\n overview: drawOverview,\n errors: drawErrors,\n scopes: drawScopes,\n elements: drawElements,\n state: drawState,\n effects: drawEffects,\n navigation: drawNavigation,\n server: drawServer,\n timeline: drawTimeline,\n graph: drawGraph,\n report: drawReport,\n };\n\n let queued = false;\n function draw(): void {\n drawChrome();\n if (tab === 'log') {\n drawLog();\n return;\n }\n if (tab === 'blocks') {\n drawBlocks();\n return;\n }\n const drawing = tab;\n const drawn = drawTab[tab]();\n void drawn.then(() => {\n // A tab that waited for the dev server, and that the user left meanwhile, drew over the\n // tab that is open now, so that one draws again.\n if (tab !== drawing) {\n draw();\n return;\n }\n drawChrome();\n // Marks of writes show once, on the next draw of the scopes.\n if (tab === 'scopes') {\n state.written.clear();\n }\n });\n }\n // Changes come in bursts, so the panel draws once per frame. It waits while a value is edited\n // or a search is typed.\n state.changed = () => {\n const typing = root.activeElement?.matches?.('input[type=\"search\"]');\n if (!queued && !editing && !typing && !(paused && tab === 'log')) {\n queued = true;\n requestAnimationFrame(() => {\n queued = false;\n if (panel) {\n draw();\n }\n });\n }\n };\n showTab = (next) => {\n tab = next;\n draw();\n };\n draw();\n}\n"],"mappings":";;;AA6DA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiMd,MAAM,OAAwB;CAC5B,CAAC,YAAY,UAAU;CACvB,CAAC,UAAU,QAAQ;CACnB,CAAC,UAAU,YAAY;CACvB,CAAC,YAAY,UAAU;CACvB,CAAC,SAAS,OAAO;CACjB,CAAC,OAAO,KAAK;CACb,CAAC,YAAY,UAAU;CACvB,CAAC,SAAS,YAAY;CACtB,CAAC,WAAW,SAAS;CACrB,CAAC,cAAc,YAAY;CAC3B,CAAC,UAAU,QAAQ;CACnB,CAAC,UAAU,QAAQ;CACnB,CAAC,UAAU,QAAQ;AACrB;AACA,MAAM,QAAiC;CAAC;CAAW;CAAS;AAAM;;AAElE,MAAM,SAAS;;AAEf,MAAM,aAAa;AAEnB,MAAM,6BAAa,IAAI,IAAgD;AACvE,MAAM,wBAAQ,IAAI,IAA2B;;AAG7C,SAAS,cAAc,OAAsB,IAAgD;CAC3F,IAAI,OAAO,WAAW,IAAI,EAAE;CAC5B,IAAI,CAAC,MAAM;EACT,OAAO,MAAM,GAAG,MAAM,SAAS,GAAG,mBAAmB,EAAE,GAAG,CAAC,CACxD,MAAM,aAAc,SAAS,KAAM,SAAS,KAAK,IAA+B,KAAA,CAAU,CAAC,CAC3F,MAAM,UAA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AC,UAAU,EAAE,UAAU,QAAQ,QAAQ;GAChE,SAAS;GACT,4BAA4B;IAC1B,SAAS;IACT,IAAI,OACF,KAAK;GAET,CAAC;EACH;CACF;CACA,WAAW,SAAS;EAClB,MAAM;EACN,KAAK;CACP;CACA,KAAK;AACP"}
@@ -17,7 +17,18 @@ const KEY_NAMES = [
17
17
  "PageUp",
18
18
  "PageDown",
19
19
  "ContextMenu",
20
- ...Array.from({ length: 12 }, (_, index) => `F${index + 1}`)
20
+ "F1",
21
+ "F2",
22
+ "F3",
23
+ "F4",
24
+ "F5",
25
+ "F6",
26
+ "F7",
27
+ "F8",
28
+ "F9",
29
+ "F10",
30
+ "F11",
31
+ "F12"
21
32
  ];
22
33
  /** The modifiers of a handler, which `spread` writes into `b-on`. A symbol of the registry. */
23
34
  const MODIFIERS = Symbol.for("brumate.modifiers");
@@ -62,10 +73,10 @@ function transition(handler, ...types) {
62
73
  const copy = ((...args) => {
63
74
  if (typeof document === "undefined" || typeof document.startViewTransition !== "function" || matchMedia("(prefers-reduced-motion: reduce)").matches) return handler(...args);
64
75
  let result;
65
- const update = () => {
76
+ function update() {
66
77
  result = handler(...args);
67
78
  return globalThis[UPDATED]?.();
68
- };
79
+ }
69
80
  return (types.length > 0 && typeof ViewTransition !== "undefined" && "types" in ViewTransition.prototype ? document.startViewTransition({
70
81
  update,
71
82
  types
@@ -79,7 +90,25 @@ function transition(handler, ...types) {
79
90
  function capture(handler) {
80
91
  return tagged(handler, "capture");
81
92
  }
93
+ /** A symbol of the registry, under which the loader registers `cancelWhen`. */
94
+ const CANCEL = Symbol.for("brumate.cancel");
95
+ /**
96
+ * Cancels an event of the element, or of an element inside it, before any handler of brumate
97
+ * runs, while `check` returns true. The document listener of brumate calls `preventDefault()` and
98
+ * runs no brumate handler for the event. It does not stop the event, so listeners that were added
99
+ * with `addEventListener` still run, and they can read `event.defaultPrevented`.
100
+ *
101
+ * Returns a function that removes the check.
102
+ *
103
+ * ```ts
104
+ * const stop = cancelWhen(form, 'submit', () => form.hasAttribute('data-pending'));
105
+ * ```
106
+ */
107
+ function cancelWhen(element, type, check) {
108
+ const register = globalThis[CANCEL];
109
+ return register ? register(element, type, check) : () => {};
110
+ }
82
111
  //#endregion
83
- export { prevent as a, once as i, MODIFIERS as n, stop as o, capture as r, transition as s, KEY_NAMES as t };
112
+ export { once as a, transition as c, capture as i, MODIFIERS as n, prevent as o, cancelWhen as r, stop as s, KEY_NAMES as t };
84
113
 
85
- //# sourceMappingURL=events-CSs7OwIC.js.map
114
+ //# sourceMappingURL=events-LgLdp1R7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events-LgLdp1R7.js","names":[],"sources":["../src/runtime/events.ts"],"sourcesContent":["// Wrappers for event handlers that act before the handler's code loads. The\n// compiler reads the calls in markup and writes them into `b-on`, so the\n// loader applies them on the first event. At run time, each returns a copy of\n// the handler that carries its modifiers, so a handler passed on as a prop\n// keeps them.\n\n/** The keys that `prevent` can name, by their `event.key`. `Space` is the space bar. */\nexport const KEY_NAMES: readonly string[] = [\n 'Enter',\n 'Escape',\n 'Tab',\n 'Space',\n 'Backspace',\n 'Delete',\n 'Insert',\n 'ArrowUp',\n 'ArrowDown',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n 'PageUp',\n 'PageDown',\n 'ContextMenu',\n 'F1',\n 'F2',\n 'F3',\n 'F4',\n 'F5',\n 'F6',\n 'F7',\n 'F8',\n 'F9',\n 'F10',\n 'F11',\n 'F12',\n];\n\ntype Letter =\n | 'a'\n | 'b'\n | 'c'\n | 'd'\n | 'e'\n | 'f'\n | 'g'\n | 'h'\n | 'i'\n | 'j'\n | 'k'\n | 'l'\n | 'm'\n | 'n'\n | 'o'\n | 'p'\n | 'q'\n | 'r'\n | 's'\n | 't'\n | 'u'\n | 'v'\n | 'w'\n | 'x'\n | 'y'\n | 'z';\ntype Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';\ntype FunctionKey = `F${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}`;\n\n/**\n * A key of `prevent`: a key by its `event.key`, or that key with a modifier that must be held,\n * such as `Mod+ArrowDown`. A key alone matches only while Ctrl, Meta and Alt are up, so the\n * shortcuts of the browser, such as Cmd+Left or Alt+Left, keep their default. `Mod` is Ctrl or\n * Meta.\n */\nexport type KeyName = Key | `${'Mod' | 'Ctrl' | 'Meta' | 'Alt'}+${Key}`;\n\n/** A key by its `event.key`: a named key, a letter or a digit. */\ntype Key =\n | 'Enter'\n | 'Escape'\n | 'Tab'\n | 'Space'\n | 'Backspace'\n | 'Delete'\n | 'Insert'\n | 'ArrowUp'\n | 'ArrowDown'\n | 'ArrowLeft'\n | 'ArrowRight'\n | 'Home'\n | 'End'\n | 'PageUp'\n | 'PageDown'\n | 'ContextMenu'\n | FunctionKey\n | Letter\n | Uppercase<Letter>\n | Digit;\n\n/** The modifiers of a handler, which `spread` writes into `b-on`. A symbol of the registry. */\nexport const MODIFIERS: unique symbol = Symbol.for('brumate.modifiers');\n\n/** A handler with the modifiers of its wrappers. */\n// oxlint-disable-next-line typescript/no-explicit-any -- Handlers take any event.\ntype Handler = (...args: any[]) => unknown;\n\nfunction tagged<H extends Handler>(handler: H, modifier: string): H {\n const copy = ((...args: unknown[]) => handler(...args)) as H & { [MODIFIERS]?: string[] };\n copy[MODIFIERS] = [...((handler as { [MODIFIERS]?: string[] })[MODIFIERS] ?? []), modifier];\n return copy;\n}\n\n/**\n * Prevents the default action of the event, before the handler's code\n * loads. With keys, on a keyboard event, it prevents only those keys, and\n * the handler still runs for every key.\n */\nexport function prevent<H extends Handler>(handler: H, ...keys: KeyName[]): H {\n return tagged(handler, keys.length > 0 ? `prevent(${keys.join(',')})` : 'prevent');\n}\n\n/** Stops the event at this element, so the handlers of the elements around it do not run. */\nexport function stop<H extends Handler>(handler: H): H {\n return tagged(handler, 'stop');\n}\n\n/** Runs the handler for the first event only. */\nexport function once<H extends Handler>(handler: H): H {\n return tagged(handler, 'once');\n}\n\n/** Waits for the updates that writes started, such as those whose code is loading. A symbol of the registry. */\nconst UPDATED = Symbol.for('brumate.updated');\n\n/**\n * Runs the handler inside a view transition, so the browser animates the\n * change of the page, such as an element that `#if` removes or a list that\n * changes order. CSS styles the animation, with `view-transition-name` and\n * `::view-transition-*`.\n *\n * - The transition holds the writes that the handler makes before its first\n * `await`. Writes after it, such as after a server call, change the page\n * without an animation.\n * - `types` are the types of the transition, which `:active-view-transition-type()`\n * matches in CSS.\n * - Without view transitions, or with `prefers-reduced-motion`, the handler\n * runs as it is.\n */\nexport function transition<H extends Handler>(handler: H, ...types: string[]): H {\n const copy = ((...args: unknown[]): unknown => {\n if (\n typeof document === 'undefined' ||\n typeof document.startViewTransition !== 'function' ||\n matchMedia('(prefers-reduced-motion: reduce)').matches\n ) {\n return handler(...args);\n }\n let result: unknown;\n function update(): unknown {\n result = handler(...args);\n // The page shows the new state once the updates of the writes have run.\n return (globalThis as { [UPDATED]?: () => Promise<void> })[UPDATED]?.();\n }\n // Browsers that have transitions without types take only a callback.\n const started =\n types.length > 0 &&\n typeof ViewTransition !== 'undefined' &&\n 'types' in ViewTransition.prototype\n ? document.startViewTransition({ update, types })\n : document.startViewTransition(update);\n return started.updateCallbackDone.then(() => result);\n }) as H & { [MODIFIERS]?: string[] };\n const modifiers = (handler as { [MODIFIERS]?: string[] })[MODIFIERS];\n if (modifiers) {\n copy[MODIFIERS] = modifiers;\n }\n return copy;\n}\n\n/** Runs the handler before the handlers of the elements inside, as a listener in the capture phase. */\nexport function capture<H extends Handler>(handler: H): H {\n return tagged(handler, 'capture');\n}\n\n/** A symbol of the registry, under which the loader registers `cancelWhen`. */\nconst CANCEL = Symbol.for('brumate.cancel');\n\n/** The events that `cancelWhen` can cancel. Scroll-type events cannot be, for their listeners are passive. */\nexport type CancelableEvent = 'click' | 'submit';\n\n/**\n * Cancels an event of the element, or of an element inside it, before any handler of brumate\n * runs, while `check` returns true. The document listener of brumate calls `preventDefault()` and\n * runs no brumate handler for the event. It does not stop the event, so listeners that were added\n * with `addEventListener` still run, and they can read `event.defaultPrevented`.\n *\n * Returns a function that removes the check.\n *\n * ```ts\n * const stop = cancelWhen(form, 'submit', () => form.hasAttribute('data-pending'));\n * ```\n */\nexport function cancelWhen<T extends CancelableEvent>(\n element: Element,\n type: T,\n check: (event: HTMLElementEventMap[T]) => boolean,\n): () => void {\n const register = (globalThis as { [CANCEL]?: typeof cancelWhen })[CANCEL];\n return register ? register(element, type, check) : () => {};\n}\n"],"mappings":";;AAOA,MAAa,YAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAgEA,MAAa,YAA2B,OAAO,IAAI,mBAAmB;AAMtE,SAAS,OAA0B,SAAY,UAAqB;CAClE,MAAM,SAAS,GAAG,SAAoB,QAAQ,GAAG,IAAI;CACrD,KAAK,aAAa,CAAC,GAAK,QAAuC,cAAc,CAAC,GAAI,QAAQ;CAC1F,OAAO;AACT;;;;;;AAOA,SAAgB,QAA2B,SAAY,GAAG,MAAoB;CAC5E,OAAO,OAAO,SAAS,KAAK,SAAS,IAAI,WAAW,KAAK,KAAK,GAAG,EAAE,KAAK,SAAS;AACnF;;AAGA,SAAgB,KAAwB,SAAe;CACrD,OAAO,OAAO,SAAS,MAAM;AAC/B;;AAGA,SAAgB,KAAwB,SAAe;CACrD,OAAO,OAAO,SAAS,MAAM;AAC/B;;AAGA,MAAM,UAAU,OAAO,IAAI,iBAAiB;;;;;;;;;;;;;;;AAgB5C,SAAgB,WAA8B,SAAY,GAAG,OAAoB;CAC/E,MAAM,SAAS,GAAG,SAA6B;EAC7C,IACE,OAAO,aAAa,eACpB,OAAO,SAAS,wBAAwB,cACxC,WAAW,kCAAkC,CAAC,CAAC,SAE/C,OAAO,QAAQ,GAAG,IAAI;EAExB,IAAI;EACJ,SAAS,SAAkB;GACzB,SAAS,QAAQ,GAAG,IAAI;GAExB,OAAQ,WAAmD,QAAQ,GAAG;EACxE;EAQA,QALE,MAAM,SAAS,KACf,OAAO,mBAAmB,eAC1B,WAAW,eAAe,YACtB,SAAS,oBAAoB;GAAE;GAAQ;EAAM,CAAC,IAC9C,SAAS,oBAAoB,MAAM,EAAA,CAC1B,mBAAmB,WAAW,MAAM;CACrD;CACA,MAAM,YAAa,QAAuC;CAC1D,IAAI,WACF,KAAK,aAAa;CAEpB,OAAO;AACT;;AAGA,SAAgB,QAA2B,SAAe;CACxD,OAAO,OAAO,SAAS,SAAS;AAClC;;AAGA,MAAM,SAAS,OAAO,IAAI,gBAAgB;;;;;;;;;;;;;AAiB1C,SAAgB,WACd,SACA,MACA,OACY;CACZ,MAAM,WAAY,WAAgD;CAClE,OAAO,WAAW,SAAS,SAAS,MAAM,KAAK,UAAU,CAAC;AAC5D"}
@@ -0,0 +1,30 @@
1
+ //#region src/runtime/features.ts
2
+ /** Children that the browser renders with an export of their own, each time they are inserted. */
3
+ const HAS_CHILDREN = typeof __BRUMATE_HAS_CHILDREN__ === "undefined" || __BRUMATE_HAS_CHILDREN__;
4
+ /** `#template` values that the browser calls, such as a template that a prop holds. */
5
+ const HAS_TEMPLATES = typeof __BRUMATE_HAS_TEMPLATES__ === "undefined" || __BRUMATE_HAS_TEMPLATES__;
6
+ /** `<title>` elements in markup, which set the title of the page. */
7
+ const HAS_TITLES = typeof __BRUMATE_HAS_TITLES__ === "undefined" || __BRUMATE_HAS_TITLES__;
8
+ /** `$bind` that a component passes to another, which the page state can hold. */
9
+ const HAS_BINDINGS = typeof __BRUMATE_HAS_BINDINGS__ === "undefined" || __BRUMATE_HAS_BINDINGS__;
10
+ /**
11
+ * Markup that comes into the page after it loads, from others than the core: the bodies of
12
+ * `#loading` and `#defer`, the items of a list that streams, and the pages of client navigation.
13
+ * Without it, the core finds every marker in the markup that it reads or inserts itself.
14
+ */
15
+ const HAS_LATE_MARKUP = typeof __BRUMATE_HAS_LATE_MARKUP__ === "undefined" || __BRUMATE_HAS_LATE_MARKUP__;
16
+ /** `$client` callbacks and `#defer` blocks, which start on a trigger. */
17
+ const HAS_BLOCKS = typeof __BRUMATE_HAS_BLOCKS__ === "undefined" || __BRUMATE_HAS_BLOCKS__;
18
+ /** Handlers of the window or the document. */
19
+ const HAS_LISTENERS = typeof __BRUMATE_HAS_LISTENERS__ === "undefined" || __BRUMATE_HAS_LISTENERS__;
20
+ /** Forms of an `$action`, which send their data with `fetch`. */
21
+ const HAS_ACTIONS = typeof __BRUMATE_HAS_ACTIONS__ === "undefined" || __BRUMATE_HAS_ACTIONS__;
22
+ /**
23
+ * Markup that the browser renders as HTML, not as a clone of a template. Without it, the core
24
+ * indexes each insert at once, and HTML holds no places for clones.
25
+ */
26
+ const HAS_CLIENT_HTML = typeof __BRUMATE_HAS_CLIENT_HTML__ === "undefined" || __BRUMATE_HAS_CLIENT_HTML__;
27
+ //#endregion
28
+ export { HAS_CLIENT_HTML as a, HAS_TEMPLATES as c, HAS_CHILDREN as i, HAS_TITLES as l, HAS_BINDINGS as n, HAS_LATE_MARKUP as o, HAS_BLOCKS as r, HAS_LISTENERS as s, HAS_ACTIONS as t };
29
+
30
+ //# sourceMappingURL=features-CHY5Ekku.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features-CHY5Ekku.js","names":[],"sources":["../src/runtime/features.ts"],"sourcesContent":["// The features of the core that a build uses. Each is on, unless the build names it. The Vite\n// plugin names them in the client build of an app, and turns off the features that none of its\n// components use, so the bundler leaves out their code. They are globals that the plugin\n// replaces, so the build of this package does not fold them.\n\ndeclare const __BRUMATE_HAS_CHILDREN__: boolean | undefined;\ndeclare const __BRUMATE_HAS_TEMPLATES__: boolean | undefined;\ndeclare const __BRUMATE_HAS_TITLES__: boolean | undefined;\ndeclare const __BRUMATE_HAS_BINDINGS__: boolean | undefined;\ndeclare const __BRUMATE_HAS_LATE_MARKUP__: boolean | undefined;\ndeclare const __BRUMATE_HAS_BLOCKS__: boolean | undefined;\ndeclare const __BRUMATE_HAS_LISTENERS__: boolean | undefined;\ndeclare const __BRUMATE_HAS_ACTIONS__: boolean | undefined;\ndeclare const __BRUMATE_HAS_CLIENT_HTML__: boolean | undefined;\n\n/** Children that the browser renders with an export of their own, each time they are inserted. */\nexport const HAS_CHILDREN: boolean =\n typeof __BRUMATE_HAS_CHILDREN__ === 'undefined' || __BRUMATE_HAS_CHILDREN__;\n\n/** `#template` values that the browser calls, such as a template that a prop holds. */\nexport const HAS_TEMPLATES: boolean =\n typeof __BRUMATE_HAS_TEMPLATES__ === 'undefined' || __BRUMATE_HAS_TEMPLATES__;\n\n/** `<title>` elements in markup, which set the title of the page. */\nexport const HAS_TITLES: boolean =\n typeof __BRUMATE_HAS_TITLES__ === 'undefined' || __BRUMATE_HAS_TITLES__;\n\n/** `$bind` that a component passes to another, which the page state can hold. */\nexport const HAS_BINDINGS: boolean =\n typeof __BRUMATE_HAS_BINDINGS__ === 'undefined' || __BRUMATE_HAS_BINDINGS__;\n\n/**\n * Markup that comes into the page after it loads, from others than the core: the bodies of\n * `#loading` and `#defer`, the items of a list that streams, and the pages of client navigation.\n * Without it, the core finds every marker in the markup that it reads or inserts itself.\n */\nexport const HAS_LATE_MARKUP: boolean =\n typeof __BRUMATE_HAS_LATE_MARKUP__ === 'undefined' || __BRUMATE_HAS_LATE_MARKUP__;\n\n/** `$client` callbacks and `#defer` blocks, which start on a trigger. */\nexport const HAS_BLOCKS: boolean =\n typeof __BRUMATE_HAS_BLOCKS__ === 'undefined' || __BRUMATE_HAS_BLOCKS__;\n\n/** Handlers of the window or the document. */\nexport const HAS_LISTENERS: boolean =\n typeof __BRUMATE_HAS_LISTENERS__ === 'undefined' || __BRUMATE_HAS_LISTENERS__;\n\n/** Forms of an `$action`, which send their data with `fetch`. */\nexport const HAS_ACTIONS: boolean =\n typeof __BRUMATE_HAS_ACTIONS__ === 'undefined' || __BRUMATE_HAS_ACTIONS__;\n\n/**\n * Markup that the browser renders as HTML, not as a clone of a template. Without it, the core\n * indexes each insert at once, and HTML holds no places for clones.\n */\nexport const HAS_CLIENT_HTML: boolean =\n typeof __BRUMATE_HAS_CLIENT_HTML__ === 'undefined' || __BRUMATE_HAS_CLIENT_HTML__;\n"],"mappings":";;AAgBA,MAAa,eACX,OAAO,6BAA6B,eAAe;;AAGrD,MAAa,gBACX,OAAO,8BAA8B,eAAe;;AAGtD,MAAa,aACX,OAAO,2BAA2B,eAAe;;AAGnD,MAAa,eACX,OAAO,6BAA6B,eAAe;;;;;;AAOrD,MAAa,kBACX,OAAO,gCAAgC,eAAe;;AAGxD,MAAa,aACX,OAAO,2BAA2B,eAAe;;AAGnD,MAAa,gBACX,OAAO,8BAA8B,eAAe;;AAGtD,MAAa,cACX,OAAO,4BAA4B,eAAe;;;;;AAMpD,MAAa,kBACX,OAAO,gCAAgC,eAAe"}