@praxisjs/devtools 0.2.34 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/assets/uno.generated.css +5 -0
  3. package/dist/assets/logo.svg.js +4 -0
  4. package/dist/assets/tailwind-v4.css.js +4 -0
  5. package/dist/assets/uno.generated.css.js +4 -0
  6. package/dist/core/event-bus.js +21 -0
  7. package/dist/core/profiler.js +79 -0
  8. package/dist/core/registry.js +147 -0
  9. package/dist/decorators/debug.js +126 -0
  10. package/dist/decorators/trace.js +45 -0
  11. package/dist/icons/ellipsis-vertical.js +38 -0
  12. package/dist/icons/panel-bottom.js +28 -0
  13. package/dist/icons/panel-left.js +28 -0
  14. package/dist/icons/panel-right.js +28 -0
  15. package/dist/icons/panel-top.js +28 -0
  16. package/dist/icons/x.js +22 -0
  17. package/dist/index.d.ts +96 -3
  18. package/dist/index.js +10 -1157
  19. package/dist/plugins/components/components/component-detail.js +53 -0
  20. package/dist/plugins/components/components/component-row.js +22 -0
  21. package/dist/plugins/components/components/detail-row.js +15 -0
  22. package/dist/plugins/components/components/detail-section.js +14 -0
  23. package/dist/plugins/components/components/status-dot.js +15 -0
  24. package/dist/plugins/components/components-tab.js +54 -0
  25. package/dist/plugins/components/index.js +9 -0
  26. package/dist/plugins/performance/index.js +9 -0
  27. package/dist/plugins/performance/performance-tab.js +62 -0
  28. package/dist/plugins/signals/components/signal-detail.js +29 -0
  29. package/dist/plugins/signals/components/signal-row.js +17 -0
  30. package/dist/plugins/signals/index.js +9 -0
  31. package/dist/plugins/signals/signals-tab.js +53 -0
  32. package/dist/plugins/timeline/components/badge.js +16 -0
  33. package/dist/plugins/timeline/components/timeline-row.js +33 -0
  34. package/dist/plugins/timeline/constants.js +54 -0
  35. package/dist/plugins/timeline/index.js +9 -0
  36. package/dist/plugins/timeline/timeline-tab.js +46 -0
  37. package/dist/ui/dev-tools.js +74 -0
  38. package/dist/ui/panel.js +106 -0
  39. package/dist/ui/shared/empty-state.js +14 -0
  40. package/dist/ui/shared/icon-button.js +17 -0
  41. package/dist/ui/shared/panel-section.js +14 -0
  42. package/dist/ui/shared/search-input.js +17 -0
  43. package/dist/ui/shared/side-panel.js +15 -0
  44. package/dist/utils/format-time.js +7 -0
  45. package/dist/utils/format-value.js +14 -0
  46. package/package.json +14 -6
  47. package/src/core/profiler.ts +162 -0
  48. package/src/core/registry.ts +23 -21
  49. package/src/decorators/debug.ts +96 -32
  50. package/src/decorators/index.ts +1 -0
  51. package/src/decorators/trace.ts +27 -4
  52. package/src/index.ts +5 -0
  53. package/src/plugins/performance/index.ts +9 -0
  54. package/src/plugins/performance/performance-tab.tsx +111 -0
  55. package/src/ui/dev-tools.tsx +5 -0
  56. package/src/__tests__/debug.test.ts +0 -333
  57. package/src/__tests__/event-bus.test.ts +0 -123
  58. package/src/__tests__/format-time.test.ts +0 -52
  59. package/src/__tests__/format-value.test.ts +0 -46
  60. package/src/__tests__/plugins.test.ts +0 -101
  61. package/src/__tests__/registry.test.ts +0 -386
  62. package/src/__tests__/trace.test.ts +0 -200
  63. package/tsconfig.json +0 -21
  64. package/uno.config.ts +0 -57
  65. package/vite.config.ts +0 -38
package/dist/index.js CHANGED
@@ -1,1157 +1,10 @@
1
- import { StatefulComponent as e, StatelessComponent as t } from "@praxisjs/core";
2
- import { ClassBehavior as n, Component as r, Emit as i, Prop as a, State as o, createClassDecorator as s, createFieldDecorator as c, createGetterObserverDecorator as l, createMethodDecorator as u } from "@praxisjs/decorators";
3
- import { jsx as d, jsxs as f } from "@praxisjs/jsx/jsx-runtime";
4
- import { render as p } from "@praxisjs/runtime";
5
- import { computed as ee } from "@praxisjs/core/internal";
6
- //#region assets/logo.svg
7
- var m = "data:image/svg+xml,%3csvg%20width='1024'%20height='1024'%20viewBox='0%200%201024%201024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M605.411%20445.66L641.322%20498.293L641.342%20498.278L697.538%20578.57L742.673%20512.806L512.5%20178.878L281.327%20512.806L512.5%20848.182L603.519%20715.561L650.559%20782.134L512.701%20983L187%20510.478L512.701%2040L837%20510.478L698.206%20712.709L668.895%20671.104L604.033%20578.775L512%20712.504L373.199%20511.5L512.233%20309.092L584.13%20414.469L536.746%20480.456L513.69%20445.66L466.305%20511.5L512.166%20577.425L556.48%20513.91L605.411%20445.66Z'%20fill='url(%23paint0_linear_3024_20)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_3024_20'%20x1='512'%20y1='40'%20x2='512'%20y2='983'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%239B76FF'%20stop-opacity='0.86'/%3e%3cstop%20offset='1'%20stop-color='%232D246B'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e", h = "*,:before,:after,::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 #0000;--un-ring-shadow:0 0 #0000;--un-shadow-inset: ;--un-shadow:0 0 #0000;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:#93c5fd80;--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }:host{all:initial;font-family:Inter,ui-sans-serif,system-ui,-apple-system,sans-serif;display:block}*{box-sizing:border-box}input::placeholder{color:#6f6a8f}input:focus{outline:none;box-shadow:0 0 0 2px #9b90e64d}::-webkit-scrollbar{width:4px;height:4px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:#9b90e633;border-radius:2px}::-webkit-scrollbar-thumb:hover{background:#9b90e666}.container{width:100%}@media (width>=640px){.container{max-width:640px}}@media (width>=768px){.container{max-width:768px}}@media (width>=1024px){.container{max-width:1024px}}@media (width>=1280px){.container{max-width:1280px}}@media (width>=1536px){.container{max-width:1536px}}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.bottom-0{bottom:0}.bottom-5{bottom:1.25rem}.left-0{left:0}.right-0{right:0}.right-5{right:1.25rem}.top-0{top:0}.top-full{top:100%}.z-\\[2147483647\\]{z-index:2147483647}.z-10{z-index:10}.grid{display:grid}.grid-cols-\\[1\\.2fr_0\\.8fr_1fr_auto\\]{grid-template-columns:1.2fr .8fr 1fr auto}.m6{margin:1.5rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mr-\\[2px\\]{margin-right:2px}.ms{margin-inline-start:1rem}.mt-1{margin-top:.25rem}.box-border{box-sizing:border-box}.inline-block{display:inline-block}.h-\\[13px\\]{height:13px}.h-\\[22px\\]{height:22px}.h-\\[2px\\]{height:2px}.h-\\[32px\\]{height:32px}.h-\\[6px\\]{height:6px}.h-1,.h1{height:.25rem}.h-10{height:2.5rem}.h-3,.h3{height:.75rem}.h-7{height:1.75rem}.h-full{height:100%}.h-screen{height:100vh}.h2{height:.5rem}.max-w-\\[200px\\]{max-width:200px}.min-w-0{min-width:0}.w-\\[13px\\]{width:13px}.w-\\[22px\\]{width:22px}.w-\\[2px\\]{width:2px}.w-\\[6px\\]{width:6px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-4{width:1rem}.w-full{width:100%}.w-px{width:1px}.flex{display:flex}.flex-1{flex:1}.shrink-0{flex-shrink:0}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.cursor-\\[ew-resize\\]{cursor:ew-resize}.cursor-\\[ns-resize\\]{cursor:ns-resize}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-\\[2px\\]{gap:2px}.gap-\\[3px\\]{gap:3px}.gap-\\[6px\\]{gap:6px}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.b,.border{border-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-border{--un-border-opacity:.25;border-color:rgba(155, 144, 230, var(--un-border-opacity))}.border-warn{--un-border-opacity:1;border-color:rgb(217 119 6/var(--un-border-opacity))}.hover\\:border-accent:hover{--un-border-opacity:1;border-color:rgb(155 144 230/var(--un-border-opacity))}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.bg-\\[rgba\\(124\\,109\\,214\\,0\\.14\\)\\]{--un-bg-opacity:.14;background-color:rgba(124, 109, 214, var(--un-bg-opacity)) }.bg-\\[rgba\\(14\\,165\\,122\\,0\\.14\\)\\]{--un-bg-opacity:.14;background-color:rgba(14, 165, 122, var(--un-bg-opacity)) }.bg-\\[rgba\\(155\\,144\\,230\\,0\\.14\\)\\]{--un-bg-opacity:.14;background-color:rgba(155, 144, 230, var(--un-bg-opacity)) }.bg-\\[rgba\\(217\\,119\\,6\\,0\\.14\\)\\]{--un-bg-opacity:.14;background-color:rgba(217, 119, 6, var(--un-bg-opacity)) }.bg-\\[rgba\\(220\\,38\\,38\\,0\\.14\\)\\]{--un-bg-opacity:.14;background-color:rgba(220, 38, 38, var(--un-bg-opacity)) }.bg-\\[rgba\\(74\\,222\\,128\\,0\\.12\\)\\]{--un-bg-opacity:.12;background-color:rgba(74, 222, 128, var(--un-bg-opacity)) }.bg-accent{--un-bg-opacity:1;background-color:rgb(155 144 230/var(--un-bg-opacity)) }.bg-bg{--un-bg-opacity:1;background-color:rgb(15 13 23/var(--un-bg-opacity)) }.bg-border{--un-bg-opacity:.25;background-color:rgba(155, 144, 230, var(--un-bg-opacity)) }.bg-header{--un-bg-opacity:1;background-color:rgb(22 19 38/var(--un-bg-opacity)) }.bg-input,.bg-section{--un-bg-opacity:1;background-color:rgb(27 24 48/var(--un-bg-opacity)) }.bg-selected{--un-bg-opacity:1;background-color:rgb(34 30 61/var(--un-bg-opacity)) }.bg-soft{--un-bg-opacity:.18;background-color:rgba(155, 144, 230, var(--un-bg-opacity)) }.bg-subtle{--un-bg-opacity:1;background-color:rgb(111 106 143/var(--un-bg-opacity)) }.bg-success{--un-bg-opacity:1;background-color:rgb(14 165 122/var(--un-bg-opacity)) }.bg-transparent{background-color:#0000}.hover\\:bg-accent:hover{--un-bg-opacity:1;background-color:rgb(155 144 230/var(--un-bg-opacity)) }.hover\\:bg-section:hover{--un-bg-opacity:1;background-color:rgb(27 24 48/var(--un-bg-opacity)) }.hover\\:bg-soft:hover{--un-bg-opacity:.18;background-color:rgba(155, 144, 230, var(--un-bg-opacity)) }.p-1{padding:.25rem}.px{padding-left:1rem;padding-right:1rem}.px-\\[6px\\]{padding-left:6px;padding-right:6px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-\\[2px\\]{padding-top:2px;padding-bottom:2px}.py-\\[3px\\]{padding-top:3px;padding-bottom:3px}.py-\\[4px\\]{padding-top:4px;padding-bottom:4px}.py-\\[5px\\]{padding-top:5px;padding-bottom:5px}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pl-\\[10px\\]{padding-left:10px}.pl-\\[56px\\]{padding-left:56px}.pl-1{padding-left:.25rem}.pr-\\[14px\\]{padding-right:14px}.pr-3{padding-right:.75rem}.text-center{text-align:center}.text-right{text-align:right}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[20px\\]{font-size:20px}.text-\\[9px\\]{font-size:9px}.text-\\[\\#0ea57a\\]{--un-text-opacity:1;color:rgb(14 165 122/var(--un-text-opacity)) }.text-\\[\\#4ade80\\]{--un-text-opacity:1;color:rgb(74 222 128/var(--un-text-opacity)) }.text-\\[\\#7c6dd6\\]{--un-text-opacity:1;color:rgb(124 109 214/var(--un-text-opacity)) }.text-\\[\\#9b90e6\\],.text-accent{--un-text-opacity:1;color:rgb(155 144 230/var(--un-text-opacity)) }.text-\\[\\#d97706\\],.text-warn{--un-text-opacity:1;color:rgb(217 119 6/var(--un-text-opacity)) }.text-\\[\\#dc2626\\]{--un-text-opacity:1;color:rgb(220 38 38/var(--un-text-opacity)) }.text-muted{--un-text-opacity:1;color:rgb(199 195 230/var(--un-text-opacity)) }.text-subtle{--un-text-opacity:1;color:rgb(111 106 143/var(--un-text-opacity)) }.text-text,.hover\\:text-text:hover{--un-text-opacity:1;color:rgb(244 242 255/var(--un-text-opacity)) }.color-white{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity)) }.hover\\:color-muted:hover{--un-text-opacity:1;color:rgb(199 195 230/var(--un-text-opacity)) }.font-bold{font-weight:700}.font-semibold{font-weight:600}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-\\[0\\.07em\\]{letter-spacing:.07em}.tracking-\\[0\\.12em\\]{letter-spacing:.12em}.tracking-widest{letter-spacing:.1em}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.uppercase{text-transform:uppercase}.tabular-nums{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.tab{tab-size:4}.shadow{--un-shadow:var(--un-shadow-inset) 0 1px 3px 0 var(--un-shadow-color,#0000001a),var(--un-shadow-inset) 0 1px 2px -1px var(--un-shadow-color,#0000001a);box-shadow:var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)}.shadow-\\[0_8px_32px_rgba\\(0\\,0\\,0\\,0\\.7\\)\\]{--un-shadow:0 8px 32px var(--un-shadow-color,#000000b3);box-shadow:var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)}.shadow-lg{--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color,#0000001a),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color,#0000001a);box-shadow:var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)}.hover\\:shadow-\\[0_8px_32px_rgba\\(56\\,189\\,248\\,0\\.1\\)\\]:hover{--un-shadow:0 8px 32px var(--un-shadow-color,#38bdf81a);box-shadow:var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)}.outline-none{outline-offset:2px;outline:2px solid #0000}.filter{filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-shadow{transition-property:box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-100{transition-duration:.1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}", g = class {
8
- handlers = /* @__PURE__ */ new Map();
9
- on(e, t) {
10
- return this.handlers.has(e) || this.handlers.set(e, /* @__PURE__ */ new Set()), this.handlers.get(e).add(t), () => this.handlers.get(e)?.delete(t);
11
- }
12
- emit(e, t) {
13
- let n = this.handlers.get(e);
14
- if (!n) return;
15
- let r = [];
16
- for (let e of n) try {
17
- e(t);
18
- } catch (e) {
19
- r.push(e);
20
- }
21
- if (r.length === 1) throw r[0];
22
- if (r.length > 1) throw AggregateError(r, "Multiple event handler errors");
23
- }
24
- }, _ = 200, v = 0;
25
- function y() {
26
- return `v${(++v).toString()}_${Date.now().toString(36)}`;
27
- }
28
- var b = class e {
29
- static _instance = null;
30
- static get instance() {
31
- return e._instance ??= new e(), e._instance;
32
- }
33
- bus = new g();
34
- instanceIds = /* @__PURE__ */ new WeakMap();
35
- signals = /* @__PURE__ */ new Map();
36
- components = /* @__PURE__ */ new Map();
37
- timeline = [];
38
- getInstanceId(e) {
39
- return this.instanceIds.has(e) || this.instanceIds.set(e, y()), this.instanceIds.get(e);
40
- }
41
- registerSignal(e, t, n, r) {
42
- let i = this.getInstanceId(e), a = `${i}:${t}`, o = {
43
- id: a,
44
- label: t,
45
- componentId: i,
46
- componentName: r,
47
- value: n,
48
- history: [{
49
- value: n,
50
- timestamp: Date.now()
51
- }],
52
- changedAt: Date.now()
53
- };
54
- this.signals.set(a, o), this.bus.emit("signal:registered", o);
55
- }
56
- updateSignal(e, t, n, r) {
57
- let i = `${this.getInstanceId(e)}:${t}`, a = this.signals.get(i);
58
- if (!a) return;
59
- let o = [...a.history, {
60
- value: n,
61
- timestamp: Date.now()
62
- }].slice(-20), s = {
63
- ...a,
64
- value: n,
65
- history: o,
66
- changedAt: Date.now()
67
- };
68
- this.signals.set(i, s), this.bus.emit("signal:changed", {
69
- entry: s,
70
- oldValue: r
71
- }), this.pushTimeline({
72
- type: "signal:change",
73
- label: `${a.componentName}.${t}`,
74
- data: {
75
- old: r,
76
- new: n,
77
- signalId: i
78
- }
79
- });
80
- }
81
- registerComponent(e, t) {
82
- let n = this.getInstanceId(e), r = {
83
- id: n,
84
- name: t,
85
- renderCount: 0,
86
- lastRenderDuration: 0,
87
- mountedAt: Date.now(),
88
- status: "mounted",
89
- lifecycle: []
90
- };
91
- this.components.set(n, r), this.bus.emit("component:registered", r);
92
- }
93
- recordRender(e, t) {
94
- let n = this.getInstanceId(e), r = this.components.get(n);
95
- r && (r.renderCount++, r.lastRenderDuration = t, this.bus.emit("component:render", { ...r }), this.pushTimeline({
96
- type: "component:render",
97
- label: `<${r.name}>`,
98
- data: {
99
- componentId: n,
100
- duration: +t.toFixed(3),
101
- renderCount: r.renderCount
102
- }
103
- }));
104
- }
105
- recordLifecycle(e, t) {
106
- let n = this.getInstanceId(e), r = this.components.get(n);
107
- if (!r) return;
108
- let i = {
109
- hook: t,
110
- timestamp: Date.now()
111
- };
112
- r.lifecycle.push(i), this.bus.emit("lifecycle", {
113
- componentId: n,
114
- name: r.name,
115
- hook: t
116
- });
117
- let a = t === "onUnmount" ? "component:unmount" : t === "onBeforeMount" ? "component:mount" : "lifecycle";
118
- if (this.pushTimeline({
119
- type: a,
120
- label: `<${r.name}>.${t}`,
121
- data: {
122
- componentId: n,
123
- hook: t
124
- }
125
- }), t === "onUnmount") {
126
- r.status = "unmounted", this.bus.emit("component:unmount", { ...r }), this.components.delete(n);
127
- for (let [e, t] of this.signals) t.componentId === n && this.signals.delete(e);
128
- }
129
- }
130
- recordMethodCall(e, t, n, r, i, a) {
131
- let o = this.getInstanceId(e);
132
- this.pushTimeline({
133
- type: "method:call",
134
- label: `${a}.${t}()`,
135
- data: {
136
- componentId: o,
137
- args: n,
138
- result: r,
139
- duration: +i.toFixed(3)
140
- }
141
- });
142
- }
143
- getSignals() {
144
- return [...this.signals.values()];
145
- }
146
- getComponents() {
147
- return [...this.components.values()];
148
- }
149
- getTimeline() {
150
- return [...this.timeline];
151
- }
152
- getSignalsByComponent(e) {
153
- return this.getSignals().filter((t) => t.componentId === e);
154
- }
155
- pushTimeline(e) {
156
- let t = {
157
- id: y(),
158
- timestamp: Date.now(),
159
- ...e
160
- };
161
- this.timeline.push(t), this.timeline.length > _ && this.timeline.shift(), this.bus.emit("timeline:push", t);
162
- }
163
- }, x = @r() class extends t {
164
- render() {
165
- return /* @__PURE__ */ f("div", {
166
- class: "flex flex-col items-center justify-center gap-2 py-12",
167
- children: [/* @__PURE__ */ d("span", {
168
- class: "text-subtle text-[20px] leading-none select-none font-mono",
169
- children: "—"
170
- }), /* @__PURE__ */ d("p", {
171
- class: "text-subtle text-[11px] text-center leading-relaxed max-w-[200px]",
172
- children: this.props.message
173
- })]
174
- });
175
- }
176
- }, S = @r() class extends t {
177
- render() {
178
- let { children: e, width: t = "280px" } = this.props;
179
- return /* @__PURE__ */ d("div", {
180
- class: "shrink-0 border-l border-border flex flex-col overflow-hidden",
181
- style: { width: t },
182
- children: e
183
- });
184
- }
185
- };
186
- //#endregion
187
- //#region src/utils/format-value.ts
188
- function C(e) {
189
- if (e === null) return "null";
190
- if (e === void 0) return "undefined";
191
- if (typeof e == "string") return `"${e}"`;
192
- if (typeof e == "object") try {
193
- return JSON.stringify(e);
194
- } catch {
195
- return "[object]";
196
- }
197
- return String(e);
198
- }
199
- //#endregion
200
- //#region src/plugins/components/components/detail-row.tsx
201
- var w = @r() class extends t {
202
- render() {
203
- let { k: e, v: t, signal: n } = this.props;
204
- return /* @__PURE__ */ f("div", {
205
- class: "flex justify-between items-center px-3 py-2 border-b border-border gap-3",
206
- children: [/* @__PURE__ */ d("span", {
207
- class: `text-[11px] font-mono shrink-0 ${n ? "text-accent" : "text-muted"}`,
208
- children: e
209
- }), /* @__PURE__ */ d("span", {
210
- class: "text-[11px] text-text font-mono truncate text-right",
211
- children: t
212
- })]
213
- });
214
- }
215
- }, T = @r() class extends t {
216
- render() {
217
- return /* @__PURE__ */ f("div", {
218
- class: "border-b border-border",
219
- children: [/* @__PURE__ */ d("div", {
220
- class: "px-3 py-[4px] text-[9px] text-subtle font-bold tracking-[0.12em] uppercase bg-section border-b border-border",
221
- children: this.props.label
222
- }), this.props.children]
223
- });
224
- }
225
- }, E = @r() class extends t {
226
- render() {
227
- let { status: e } = this.props;
228
- return /* @__PURE__ */ d("span", {
229
- class: `inline-block w-[6px] h-[6px] rounded-full shrink-0 ${e === "mounted" ? "bg-success" : "bg-subtle"}`,
230
- style: e === "mounted" ? { boxShadow: "0 0 6px rgba(14,165,122,0.7)" } : void 0
231
- });
232
- }
233
- }, te = @r() class extends t {
234
- render() {
235
- let { entry: e, signals: t } = this.props;
236
- return /* @__PURE__ */ f(S, { children: [/* @__PURE__ */ f("div", {
237
- class: "px-3 py-2 border-b border-border flex items-center gap-2 bg-bg shrink-0",
238
- children: [/* @__PURE__ */ d(E, { status: e.status }), /* @__PURE__ */ f("span", {
239
- class: "text-accent font-mono text-[11px] font-semibold truncate pl-1",
240
- children: [
241
- "<",
242
- e.name,
243
- ">"
244
- ]
245
- })]
246
- }), /* @__PURE__ */ f("div", {
247
- class: "flex-1 overflow-y-auto",
248
- children: [
249
- /* @__PURE__ */ f(T, {
250
- label: "Stats",
251
- children: [
252
- /* @__PURE__ */ d(w, {
253
- k: "renders",
254
- v: String(e.renderCount)
255
- }),
256
- /* @__PURE__ */ d(w, {
257
- k: "last render",
258
- v: `${e.lastRenderDuration.toFixed(3)}ms`
259
- }),
260
- /* @__PURE__ */ d(w, {
261
- k: "status",
262
- v: e.status
263
- })
264
- ]
265
- }),
266
- t.length > 0 && /* @__PURE__ */ d(T, {
267
- label: "State",
268
- children: t.map((e) => /* @__PURE__ */ d(w, {
269
- k: e.label,
270
- v: C(e.value),
271
- signal: !0
272
- }, e.id))
273
- }),
274
- e.lifecycle.length > 0 && /* @__PURE__ */ d(T, {
275
- label: "Lifecycle",
276
- children: [...e.lifecycle].reverse().slice(0, 20).map((e, t) => /* @__PURE__ */ f("div", {
277
- class: "px-3 py-2 flex justify-between items-center border-b border-border",
278
- children: [/* @__PURE__ */ d("span", {
279
- class: "text-[11px] text-text font-mono",
280
- children: e.hook
281
- }), /* @__PURE__ */ d("span", {
282
- class: "text-[10px] text-subtle tabular-nums",
283
- children: new Date(e.timestamp).toLocaleTimeString()
284
- })]
285
- }, String(t)))
286
- })
287
- ]
288
- })] });
289
- }
290
- }, ne = @r() class extends t {
291
- render() {
292
- let { entry: e, selected: t, onClick: n } = this.props;
293
- return /* @__PURE__ */ f("div", {
294
- onClick: n,
295
- class: () => `relative flex items-center gap-2 px-3 py-2 cursor-pointer border-b border-border transition-colors duration-100 ${t() ? "bg-selected" : "hover:bg-section"}`,
296
- children: [
297
- () => t() && /* @__PURE__ */ d("span", { class: "absolute left-0 top-0 bottom-0 w-[2px] bg-accent rounded-r" }),
298
- /* @__PURE__ */ d(E, { status: e.status }),
299
- /* @__PURE__ */ f("span", {
300
- class: "text-accent font-mono text-[11px] flex-1 truncate pl-1",
301
- children: [
302
- "<",
303
- e.name,
304
- ">"
305
- ]
306
- }),
307
- /* @__PURE__ */ f("span", {
308
- class: "text-muted text-[11px] tabular-nums",
309
- children: ["×", e.renderCount]
310
- }),
311
- /* @__PURE__ */ f("span", {
312
- class: `text-[10px] tabular-nums w-12 text-right ${e.lastRenderDuration > 16 ? "text-warn" : "text-subtle"}`,
313
- children: [e.lastRenderDuration.toFixed(1), "ms"]
314
- })
315
- ]
316
- });
317
- }
318
- }, D = {
319
- id: "components",
320
- label: "Components",
321
- component: @r() class extends e {
322
- @o() components = [];
323
- @o() selectedId = null;
324
- @a() registry;
325
- _handlers = [];
326
- onMount() {
327
- this.components = this.registry.getComponents();
328
- let e = () => {
329
- this.components = this.registry.getComponents();
330
- };
331
- this._handlers = [
332
- "component:registered",
333
- "component:render",
334
- "component:unmount",
335
- "lifecycle",
336
- "signal:registered",
337
- "signal:changed"
338
- ].map((t) => this.registry.bus.on(t, e));
339
- }
340
- onUnmount() {
341
- this._handlers.forEach((e) => {
342
- e();
343
- });
344
- }
345
- render() {
346
- let { registry: e } = this;
347
- return /* @__PURE__ */ f("div", {
348
- class: "flex h-full overflow-hidden",
349
- children: [/* @__PURE__ */ f("div", {
350
- class: "flex-1 flex flex-col overflow-hidden min-w-0",
351
- children: [/* @__PURE__ */ f("div", {
352
- class: "flex items-center px-3 h-7 text-[9px] text-subtle font-bold tracking-[0.12em] uppercase border-b border-border bg-section gap-2 shrink-0",
353
- children: [
354
- /* @__PURE__ */ d("span", {
355
- class: "flex-1",
356
- children: "Component"
357
- }),
358
- /* @__PURE__ */ d("span", { children: "Renders" }),
359
- /* @__PURE__ */ d("span", {
360
- class: "w-12 text-right",
361
- children: "Last"
362
- })
363
- ]
364
- }), /* @__PURE__ */ d("div", {
365
- class: "flex-1 overflow-y-auto",
366
- children: () => this.components.length === 0 ? /* @__PURE__ */ d(x, { message: "No components tracked. Add @Trace() to component classes." }) : this.components.map((e) => /* @__PURE__ */ d(ne, {
367
- entry: e,
368
- selected: () => this.selectedId === e.id,
369
- onClick: () => {
370
- this.selectedId = this.selectedId === e.id ? null : e.id;
371
- }
372
- }, e.id))
373
- })]
374
- }), () => {
375
- let t = this.selectedId, n = t ? this.components.find((e) => e.id === t) ?? null : null, r = t ? e.getSignalsByComponent(t) : [];
376
- return n ? /* @__PURE__ */ d(te, {
377
- entry: n,
378
- signals: r
379
- }) : null;
380
- }]
381
- });
382
- }
383
- }
384
- }, O = @r() class extends t {
385
- render() {
386
- let { placeholder: e, onInput: t } = this.props;
387
- return /* @__PURE__ */ d("input", {
388
- type: "text",
389
- placeholder: e,
390
- class: "w-full bg-input border border-border rounded-lg text-text text-[11px] px-3 py-[5px] outline-none box-border transition-shadow duration-150",
391
- onInput: (e) => {
392
- t(e.target.value);
393
- }
394
- });
395
- }
396
- }, k = @r() class extends t {
397
- render() {
398
- return /* @__PURE__ */ f("div", {
399
- class: "border-b border-border",
400
- children: [/* @__PURE__ */ d("div", {
401
- class: "px-3 py-[4px] text-[9px] text-subtle font-bold tracking-[0.12em] uppercase bg-section border-b border-border",
402
- children: this.props.label
403
- }), this.props.children]
404
- });
405
- }
406
- };
407
- //#endregion
408
- //#region src/utils/format-time.ts
409
- function A(e, t) {
410
- let n = t ? ` ${t}` : "", r = Date.now() - e;
411
- return r < 1e3 ? `${r.toString()}ms${n}` : r < 6e4 ? `${(r / 1e3).toFixed(1)}s${n}` : `${Math.floor(r / 6e4).toString()}m${n}`;
412
- }
413
- //#endregion
414
- //#region src/plugins/signals/components/signal-detail.tsx
415
- var j = @r() class extends t {
416
- render() {
417
- let { entry: e } = this.props;
418
- return /* @__PURE__ */ d(S, {
419
- width: "260px",
420
- children: /* @__PURE__ */ d(k, {
421
- label: "History",
422
- children: /* @__PURE__ */ f("div", {
423
- class: "overflow-y-auto",
424
- children: [[...e.history].reverse().map((e, t) => /* @__PURE__ */ f("div", {
425
- class: "px-3 py-2 border-b border-border flex justify-between items-center gap-3",
426
- children: [/* @__PURE__ */ d("span", {
427
- class: "font-mono text-[11px] text-text truncate",
428
- children: C(e.value)
429
- }), /* @__PURE__ */ d("span", {
430
- class: "text-[10px] text-subtle shrink-0 tabular-nums",
431
- children: A(e.timestamp, "ago")
432
- })]
433
- }, String(t))), e.history.length === 0 && /* @__PURE__ */ d("p", {
434
- class: "px-3 py-6 text-[11px] text-subtle text-center",
435
- children: "No history yet."
436
- })]
437
- })
438
- })
439
- });
440
- }
441
- }, M = @r() class extends t {
442
- render() {
443
- let { entry: e, selected: t, onClick: n } = this.props;
444
- return /* @__PURE__ */ f("div", {
445
- onClick: n,
446
- class: `relative grid grid-cols-[1.2fr_0.8fr_1fr_auto] items-center px-3 py-2 cursor-pointer border-b border-border transition-colors duration-100 ${t ? "bg-selected" : "hover:bg-section"}`,
447
- children: [
448
- t && /* @__PURE__ */ d("span", { class: "absolute left-0 top-0 bottom-0 w-[2px] bg-accent rounded-r" }),
449
- /* @__PURE__ */ d("span", {
450
- class: "text-accent font-mono text-[11px] truncate pl-1",
451
- children: e.label
452
- }),
453
- /* @__PURE__ */ d("span", {
454
- class: "text-muted text-[11px] truncate",
455
- children: e.componentName
456
- }),
457
- /* @__PURE__ */ d("span", {
458
- class: "text-text font-mono text-[11px] truncate",
459
- children: C(e.value)
460
- }),
461
- /* @__PURE__ */ d("span", {
462
- class: "text-subtle text-[10px] text-right tabular-nums",
463
- children: A(e.changedAt, "ago")
464
- })
465
- ]
466
- });
467
- }
468
- }, N = {
469
- id: "signals",
470
- label: "Signals",
471
- component: @r() class extends e {
472
- @o() signals = [];
473
- @o() search = "";
474
- @o() selectedId = null;
475
- @a() registry;
476
- _handlers = [];
477
- onMount() {
478
- this.signals = this.registry.getSignals(), this._handlers = [this.registry.bus.on("signal:registered", () => {
479
- this.signals = this.registry.getSignals();
480
- }), this.registry.bus.on("signal:changed", () => {
481
- this.signals = this.registry.getSignals();
482
- })];
483
- }
484
- onUnmount() {
485
- this._handlers.forEach((e) => {
486
- e();
487
- });
488
- }
489
- render() {
490
- return /* @__PURE__ */ f("div", {
491
- class: "flex h-full overflow-hidden",
492
- children: [/* @__PURE__ */ f("div", {
493
- class: "flex-1 flex flex-col overflow-hidden min-w-0",
494
- children: [
495
- /* @__PURE__ */ d("div", {
496
- class: "px-3 py-2 border-b border-border bg-bg shrink-0",
497
- children: /* @__PURE__ */ d(O, {
498
- placeholder: "Search signals…",
499
- onInput: (e) => {
500
- this.search = e;
501
- }
502
- })
503
- }),
504
- /* @__PURE__ */ f("div", {
505
- class: "grid grid-cols-[1.2fr_0.8fr_1fr_auto] items-center px-3 h-7 text-[9px] text-subtle font-bold tracking-[0.12em] uppercase border-b border-border bg-section gap-2 shrink-0",
506
- children: [
507
- /* @__PURE__ */ d("span", { children: "Signal" }),
508
- /* @__PURE__ */ d("span", { children: "Component" }),
509
- /* @__PURE__ */ d("span", { children: "Value" }),
510
- /* @__PURE__ */ d("span", { children: "Age" })
511
- ]
512
- }),
513
- /* @__PURE__ */ d("div", {
514
- class: "flex-1 overflow-y-auto",
515
- children: () => {
516
- let e = this.search.toLowerCase(), t = e === "" ? this.signals : this.signals.filter((t) => t.label.toLowerCase().includes(e) || t.componentName.toLowerCase().includes(e));
517
- return t.length === 0 ? /* @__PURE__ */ d(x, { message: this.signals.length === 0 ? "No signals tracked. Add @Debug() on top of @State() properties." : "No signals match your search." }) : t.map((e) => /* @__PURE__ */ d(M, {
518
- entry: e,
519
- selected: this.selectedId === e.id,
520
- onClick: () => {
521
- this.selectedId = this.selectedId === e.id ? null : e.id;
522
- }
523
- }, e.id));
524
- }
525
- })
526
- ]
527
- }), () => {
528
- let e = this.selectedId, t = e ? this.signals.find((t) => t.id === e) ?? null : null;
529
- return t ? /* @__PURE__ */ d(j, { entry: t }) : null;
530
- }]
531
- });
532
- }
533
- }
534
- }, P = {
535
- "signal:change": {
536
- label: "signal",
537
- cls: "text-[#9b90e6] bg-[rgba(155,144,230,0.14)]"
538
- },
539
- "component:render": {
540
- label: "render",
541
- cls: "text-[#4ade80] bg-[rgba(74,222,128,0.12)]"
542
- },
543
- "component:mount": {
544
- label: "mount",
545
- cls: "text-[#0ea57a] bg-[rgba(14,165,122,0.14)]"
546
- },
547
- "component:unmount": {
548
- label: "unmount",
549
- cls: "text-[#dc2626] bg-[rgba(220,38,38,0.14)]"
550
- },
551
- lifecycle: {
552
- label: "lifecycle",
553
- cls: "text-[#d97706] bg-[rgba(217,119,6,0.14)]"
554
- },
555
- "method:call": {
556
- label: "method",
557
- cls: "text-[#7c6dd6] bg-[rgba(124,109,214,0.14)]"
558
- }
559
- }, F = [
560
- {
561
- value: "all",
562
- label: "All"
563
- },
564
- {
565
- value: "signal:change",
566
- label: "Signals"
567
- },
568
- {
569
- value: "component:render",
570
- label: "Renders"
571
- },
572
- {
573
- value: "component:mount",
574
- label: "Mount"
575
- },
576
- {
577
- value: "lifecycle",
578
- label: "Lifecycle"
579
- },
580
- {
581
- value: "method:call",
582
- label: "Methods"
583
- }
584
- ], I = @r() class extends t {
585
- render() {
586
- let e = P[this.props.type];
587
- return /* @__PURE__ */ d("span", {
588
- class: `text-[9px] px-[6px] py-[2px] rounded font-bold uppercase tracking-[0.07em] shrink-0 ${e.cls}`,
589
- children: e.label
590
- });
591
- }
592
- }, L = @r() class extends e {
593
- @o() open = !1;
594
- @a() entry;
595
- render() {
596
- let e = this.entry;
597
- if (!e) return null;
598
- let t = Object.keys(e.data).length > 0;
599
- return /* @__PURE__ */ f("div", {
600
- class: "border-b border-border",
601
- children: [/* @__PURE__ */ f("div", {
602
- onClick: () => {
603
- t && (this.open = !this.open);
604
- },
605
- class: `flex items-center gap-2 px-3 py-2 transition-colors duration-100 ${t ? "cursor-pointer hover:bg-section" : "cursor-default"}`,
606
- children: [
607
- /* @__PURE__ */ d("span", {
608
- class: "text-subtle text-[10px] w-10 shrink-0 text-right tabular-nums font-mono",
609
- children: A(e.timestamp)
610
- }),
611
- /* @__PURE__ */ d(I, { type: e.type }),
612
- /* @__PURE__ */ d("span", {
613
- class: "flex-1 text-text font-mono text-[11px] truncate",
614
- children: e.label
615
- }),
616
- t && /* @__PURE__ */ d("span", {
617
- class: "text-subtle text-[11px] shrink-0 w-4 text-center",
618
- children: () => this.open ? "▾" : "▸"
619
- })
620
- ]
621
- }), () => this.open && t ? /* @__PURE__ */ d("div", {
622
- class: "px-3 py-2 pl-[56px] font-mono text-[11px] bg-section border-t border-border",
623
- children: Object.entries(e.data).map(([e, t]) => /* @__PURE__ */ f("div", {
624
- class: "flex gap-3 py-[3px]",
625
- children: [/* @__PURE__ */ f("span", {
626
- class: "text-accent shrink-0",
627
- children: [e, ":"]
628
- }), /* @__PURE__ */ d("span", {
629
- class: "text-muted truncate",
630
- children: typeof t == "object" ? JSON.stringify(t) : String(t)
631
- })]
632
- }, e))
633
- }) : null]
634
- });
635
- }
636
- }, R = {
637
- id: "timeline",
638
- label: "Timeline",
639
- component: @r() class extends e {
640
- @o() entries = [];
641
- @o() filter = "all";
642
- @o() paused = !1;
643
- @a() registry;
644
- _handlers = [];
645
- onMount() {
646
- this.entries = this.registry.getTimeline(), this._handlers = [this.registry.bus.on("timeline:push", () => {
647
- this.paused || (this.entries = this.registry.getTimeline());
648
- })];
649
- }
650
- onUnmount() {
651
- this._handlers.forEach((e) => {
652
- e();
653
- });
654
- }
655
- render() {
656
- return /* @__PURE__ */ f("div", {
657
- class: "flex flex-col h-full overflow-hidden",
658
- children: [/* @__PURE__ */ f("div", {
659
- class: "flex items-center gap-[3px] px-2 py-2 border-b border-border bg-bg shrink-0 flex-wrap",
660
- children: [
661
- F.map((e) => /* @__PURE__ */ d("button", {
662
- onClick: () => {
663
- this.filter = e.value;
664
- },
665
- class: () => this.filter === e.value ? "text-[11px] px-2 py-[3px] rounded cursor-pointer font-sans bg-soft text-accent font-semibold" : "text-[11px] px-2 py-[3px] rounded cursor-pointer font-sans text-muted hover:text-text hover:bg-section transition-colors duration-150",
666
- children: e.label
667
- }, e.value)),
668
- /* @__PURE__ */ d("div", { class: "flex-1" }),
669
- /* @__PURE__ */ d("button", {
670
- onClick: () => {
671
- this.paused && (this.entries = this.registry.getTimeline()), this.paused = !this.paused;
672
- },
673
- class: () => `text-[11px] px-2 py-[3px] rounded cursor-pointer font-sans border border-border transition-colors duration-150 ${this.paused ? "text-warn border-warn" : "text-muted hover:text-text"}`,
674
- children: () => this.paused ? "Resume" : "Pause"
675
- }),
676
- /* @__PURE__ */ d("button", {
677
- onClick: () => {
678
- this.entries = [];
679
- },
680
- class: "text-[11px] px-2 py-[3px] rounded cursor-pointer font-sans border border-border text-muted hover:text-text transition-colors duration-150",
681
- children: "Clear"
682
- })
683
- ]
684
- }), /* @__PURE__ */ d("div", {
685
- class: "flex-1 overflow-y-auto",
686
- children: () => {
687
- let e = this.filter, t = e === "all" ? this.entries : this.entries.filter((t) => t.type === e || e === "component:mount" && t.type === "component:unmount");
688
- return t.length === 0 ? /* @__PURE__ */ d(x, { message: "No events yet. Interact with your app to see the timeline." }) : [...t].reverse().map((e) => /* @__PURE__ */ d(L, { entry: e }, e.id));
689
- }
690
- })]
691
- });
692
- }
693
- }
694
- }, z = "*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}", B = @r() class extends t {
695
- render() {
696
- return /* @__PURE__ */ f("svg", {
697
- xmlns: "http://www.w3.org/2000/svg",
698
- width: "24",
699
- height: "24",
700
- viewBox: "0 0 24 24",
701
- fill: "none",
702
- stroke: "currentColor",
703
- "stroke-width": "2",
704
- "stroke-linecap": "round",
705
- "stroke-linejoin": "round",
706
- class: "lucide lucide-ellipsis-vertical-icon lucide-ellipsis-vertical",
707
- children: [
708
- /* @__PURE__ */ d("circle", {
709
- cx: "12",
710
- cy: "12",
711
- r: "1"
712
- }),
713
- /* @__PURE__ */ d("circle", {
714
- cx: "12",
715
- cy: "5",
716
- r: "1"
717
- }),
718
- /* @__PURE__ */ d("circle", {
719
- cx: "12",
720
- cy: "19",
721
- r: "1"
722
- })
723
- ]
724
- });
725
- }
726
- }, V = @r() class extends t {
727
- render() {
728
- return /* @__PURE__ */ f("svg", {
729
- xmlns: "http://www.w3.org/2000/svg",
730
- width: "24",
731
- height: "24",
732
- viewBox: "0 0 24 24",
733
- fill: "none",
734
- stroke: "currentColor",
735
- "stroke-width": "2",
736
- "stroke-linecap": "round",
737
- "stroke-linejoin": "round",
738
- class: "lucide lucide-panel-bottom-icon lucide-panel-bottom",
739
- children: [/* @__PURE__ */ d("rect", {
740
- width: "18",
741
- height: "18",
742
- x: "3",
743
- y: "3",
744
- rx: "2"
745
- }), /* @__PURE__ */ d("path", { d: "M3 15h18" })]
746
- });
747
- }
748
- }, H = @r() class extends t {
749
- render() {
750
- return /* @__PURE__ */ f("svg", {
751
- xmlns: "http://www.w3.org/2000/svg",
752
- width: "24",
753
- height: "24",
754
- viewBox: "0 0 24 24",
755
- fill: "none",
756
- stroke: "currentColor",
757
- "stroke-width": "2",
758
- "stroke-linecap": "round",
759
- "stroke-linejoin": "round",
760
- class: "lucide lucide-panel-left-icon lucide-panel-left",
761
- children: [/* @__PURE__ */ d("rect", {
762
- width: "18",
763
- height: "18",
764
- x: "3",
765
- y: "3",
766
- rx: "2"
767
- }), /* @__PURE__ */ d("path", { d: "M9 3v18" })]
768
- });
769
- }
770
- }, U = @r() class extends t {
771
- render() {
772
- return /* @__PURE__ */ f("svg", {
773
- xmlns: "http://www.w3.org/2000/svg",
774
- width: "24",
775
- height: "24",
776
- viewBox: "0 0 24 24",
777
- fill: "none",
778
- stroke: "currentColor",
779
- "stroke-width": "2",
780
- "stroke-linecap": "round",
781
- "stroke-linejoin": "round",
782
- class: "lucide lucide-panel-right-icon lucide-panel-right",
783
- children: [/* @__PURE__ */ d("rect", {
784
- width: "18",
785
- height: "18",
786
- x: "3",
787
- y: "3",
788
- rx: "2"
789
- }), /* @__PURE__ */ d("path", { d: "M15 3v18" })]
790
- });
791
- }
792
- }, re = @r() class extends t {
793
- render() {
794
- return /* @__PURE__ */ f("svg", {
795
- xmlns: "http://www.w3.org/2000/svg",
796
- width: "24",
797
- height: "24",
798
- viewBox: "0 0 24 24",
799
- fill: "none",
800
- stroke: "currentColor",
801
- "stroke-width": "2",
802
- "stroke-linecap": "round",
803
- "stroke-linejoin": "round",
804
- class: "lucide lucide-panel-top-icon lucide-panel-top",
805
- children: [/* @__PURE__ */ d("rect", {
806
- width: "18",
807
- height: "18",
808
- x: "3",
809
- y: "3",
810
- rx: "2"
811
- }), /* @__PURE__ */ d("path", { d: "M3 9h18" })]
812
- });
813
- }
814
- }, W = @r() class extends t {
815
- render() {
816
- return /* @__PURE__ */ f("svg", {
817
- xmlns: "http://www.w3.org/2000/svg",
818
- width: "24",
819
- height: "24",
820
- viewBox: "0 0 24 24",
821
- fill: "none",
822
- stroke: "currentColor",
823
- "stroke-width": "2",
824
- "stroke-linecap": "round",
825
- "stroke-linejoin": "round",
826
- class: "lucide lucide-x-icon lucide-x",
827
- children: [/* @__PURE__ */ d("path", { d: "M18 6 6 18" }), /* @__PURE__ */ d("path", { d: "m6 6 12 12" })]
828
- });
829
- }
830
- }, G = @r() class extends t {
831
- render() {
832
- let { title: e, active: t, icon: n, onClick: r } = this.props;
833
- return /* @__PURE__ */ d("button", {
834
- title: e,
835
- onClick: r,
836
- class: () => `w-[22px] h-[22px] flex items-center justify-center rounded-md text-[11px] cursor-pointer transition-colors duration-150 ${(typeof t == "function" ? t() : t) ? "text-accent bg-soft color-white" : "text-subtle hover:color-muted hover:bg-section"}`,
837
- children: /* @__PURE__ */ d(n, {})
838
- });
839
- }
840
- }, K = 180, q = 300, J = 240, Y = 380, X = {
841
- bottom: V,
842
- top: re,
843
- left: H,
844
- right: U
845
- }, ie = @r() class extends e {
846
- @o() activeTab = "";
847
- @o() dock = "bottom";
848
- @o() dockMenuOpen = !1;
849
- @o() bottomSize = q;
850
- @o() vertSize = Y;
851
- @a() plugins = [];
852
- @a() registry;
853
- @i("onClose") handleClose() {}
854
- onMount() {
855
- this.plugins.length > 0 && (this.activeTab = this.plugins[0].id);
856
- }
857
- handleMouseDown(e) {
858
- e.preventDefault();
859
- let t = e.clientX, n = e.clientY, r = this.dock, i = r === "bottom" || r === "top" ? this.bottomSize : this.vertSize, a = (e) => {
860
- let r = this.dock;
861
- r === "bottom" ? this.bottomSize = Math.max(K, Math.min(window.innerHeight * .85, i + (n - e.clientY))) : r === "top" ? this.bottomSize = Math.max(K, Math.min(window.innerHeight * .85, i + (e.clientY - n))) : r === "left" ? this.vertSize = Math.max(J, Math.min(window.innerWidth * .6, i + (e.clientX - t))) : this.vertSize = Math.max(J, Math.min(window.innerWidth * .6, i + (t - e.clientX)));
862
- }, o = () => {
863
- document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", o);
864
- };
865
- document.addEventListener("mousemove", a), document.addEventListener("mouseup", o);
866
- }
867
- render() {
868
- return /* @__PURE__ */ f("div", {
869
- class: () => {
870
- let e = this.dock;
871
- return e === "top" ? "flex flex-col-reverse fixed top-0 left-0 w-full z-[2147483647]" : e === "left" ? "flex flex-row-reverse fixed left-0 top-0 h-screen z-[2147483647]" : e === "right" ? "flex fixed right-0 top-0 h-screen z-[2147483647]" : "flex flex-col fixed bottom-0 left-0 w-full z-[2147483647]";
872
- },
873
- children: [/* @__PURE__ */ d("div", {
874
- class: () => {
875
- let e = this.dock;
876
- return e === "bottom" || e === "top" ? "h-1 cursor-[ns-resize] bg-transparent hover:bg-accent transition-colors duration-200" : "w-1 cursor-[ew-resize] bg-transparent hover:bg-accent transition-colors duration-200";
877
- },
878
- onMouseDown: (e) => {
879
- this.handleMouseDown(e);
880
- }
881
- }), /* @__PURE__ */ d("div", {
882
- class: () => {
883
- let e = this.dock;
884
- return e === "top" ? "w-full h-full bg-bg border-b border-border" : e === "left" ? "w-full h-full bg-bg border-r border-border" : e === "right" ? "w-full h-full bg-bg border-l border-border" : "w-full h-full bg-bg border-t border-border";
885
- },
886
- style: () => {
887
- let e = this.dock;
888
- return e === "bottom" || e === "top" ? { height: `${this.bottomSize.toString()}px` } : { width: `${this.vertSize.toString()}px` };
889
- },
890
- children: /* @__PURE__ */ f("div", {
891
- class: "flex flex-col flex-1 w-full h-full overflow-hidden",
892
- children: [/* @__PURE__ */ f("div", {
893
- class: "flex h-10 items-stretch border-b border-border bg-header shrink-0 px-2 gap-[2px]",
894
- children: [
895
- /* @__PURE__ */ f("div", {
896
- class: "flex items-center gap-[6px] pr-3 mr-[2px] border-r border-border shrink-0",
897
- children: [/* @__PURE__ */ d("img", {
898
- class: "h-[13px] w-[13px]",
899
- src: m
900
- }), /* @__PURE__ */ d("span", {
901
- class: "text-[10px] font-bold text-accent tracking-widest uppercase",
902
- children: "praxisjs"
903
- })]
904
- }),
905
- /* @__PURE__ */ d("div", {
906
- class: "flex items-stretch flex-1",
907
- children: () => this.plugins.map((e) => /* @__PURE__ */ f("button", {
908
- class: () => this.activeTab === e.id ? "relative flex items-center px-3 text-[11px] font-semibold text-accent cursor-pointer" : "flex items-center px-3 text-[11px] text-muted cursor-pointer hover:text-text transition-colors duration-150",
909
- onClick: () => {
910
- this.activeTab = e.id;
911
- },
912
- children: [e.label, () => this.activeTab === e.id ? /* @__PURE__ */ d("span", { class: "absolute bottom-0 left-0 right-0 h-[2px] bg-accent" }) : null]
913
- }, e.id))
914
- }),
915
- /* @__PURE__ */ f("div", {
916
- class: "flex items-center gap-[2px] shrink-0",
917
- children: [
918
- /* @__PURE__ */ f("div", {
919
- class: "relative",
920
- children: [/* @__PURE__ */ d(G, {
921
- title: "Dock position",
922
- icon: B,
923
- active: () => this.dockMenuOpen,
924
- onClick: () => {
925
- this.dockMenuOpen = !this.dockMenuOpen;
926
- }
927
- }), () => this.dockMenuOpen ? /* @__PURE__ */ d("div", {
928
- class: "absolute right-0 top-full mt-1 flex gap-[2px] bg-bg border border-border rounded-md shadow-lg p-1 z-10",
929
- children: [
930
- "bottom",
931
- "top",
932
- "left",
933
- "right"
934
- ].map((e) => /* @__PURE__ */ d(G, {
935
- title: `Dock ${e}`,
936
- active: () => this.dock === e,
937
- icon: X[e],
938
- onClick: () => {
939
- this.dock = e, this.dockMenuOpen = !1;
940
- }
941
- }, e))
942
- }) : null]
943
- }),
944
- /* @__PURE__ */ d("div", { class: "w-px h-3 bg-border mx-1" }),
945
- /* @__PURE__ */ d(G, {
946
- title: "Close",
947
- icon: W,
948
- onClick: () => {
949
- this.handleClose();
950
- }
951
- })
952
- ]
953
- })
954
- ]
955
- }), /* @__PURE__ */ d("div", {
956
- class: "flex-1 overflow-hidden flex flex-col",
957
- children: () => {
958
- let e = this.plugins.find((e) => e.id === this.activeTab)?.component;
959
- return e ? /* @__PURE__ */ d(e, { registry: this.registry }) : null;
960
- }
961
- })]
962
- })
963
- })]
964
- });
965
- }
966
- }, ae = [
967
- N,
968
- D,
969
- R
970
- ], Z = @r() class extends e {
971
- @o() open = !1;
972
- @a() plugins = [];
973
- @a() registry;
974
- render() {
975
- return /* @__PURE__ */ d("div", { children: () => this.open ? /* @__PURE__ */ d(ie, {
976
- plugins: this.plugins,
977
- registry: this.registry,
978
- onClose: () => {
979
- this.open = !1;
980
- }
981
- }) : /* @__PURE__ */ f("button", {
982
- onClick: () => {
983
- this.open = !0;
984
- },
985
- class: "fixed bottom-5 right-5 z-[2147483647] flex items-center gap-1 pl-[10px] pr-[14px] h-[32px] rounded-xl font-sans font-semibold text-[12px] text-accent bg-header border border-border cursor-pointer select-none shadow-[0_8px_32px_rgba(0,0,0,0.7)] transition-all duration-200 hover:border-accent hover:bg-soft hover:shadow-[0_8px_32px_rgba(56,189,248,0.1)]",
986
- children: [/* @__PURE__ */ d("img", {
987
- class: "h-[13px] w-[13px]",
988
- src: m
989
- }), /* @__PURE__ */ d("span", {
990
- class: "text-[10px] font-bold text-accent tracking-widest uppercase",
991
- children: "devtools"
992
- })]
993
- }) });
994
- }
995
- }, oe = {
996
- plugins: [...ae],
997
- host: null,
998
- cleanup: null,
999
- init(e = {}) {
1000
- if (this.host) return;
1001
- e.plugins && (this.plugins = e.plugins), this.plugins.forEach((e) => e.setup?.(b.instance));
1002
- let t = document.createElement("div");
1003
- t.id = "praxisjs-devtools", document.body.appendChild(t), this.host = t;
1004
- let n = t.attachShadow({ mode: "open" }), r = document.createElement("style");
1005
- r.textContent = z + h, n.appendChild(r);
1006
- let i = document.createElement("div");
1007
- n.appendChild(i), this.cleanup = p(() => /* @__PURE__ */ d(Z, {
1008
- plugins: this.plugins,
1009
- registry: b.instance
1010
- }), i);
1011
- },
1012
- registerPlugin(e) {
1013
- this.plugins.find((t) => t.id === e.id) || (e.setup?.(b.instance), this.plugins.push(e), this.remount());
1014
- },
1015
- get registry() {
1016
- return b.instance;
1017
- },
1018
- remount() {
1019
- if (!this.host) return;
1020
- let e = this.host.shadowRoot.querySelector("div:last-child");
1021
- this.cleanup?.(), this.cleanup = p(() => /* @__PURE__ */ d(Z, {
1022
- plugins: this.plugins,
1023
- registry: b.instance
1024
- }), e);
1025
- }
1026
- };
1027
- //#endregion
1028
- //#region src/decorators/debug.ts
1029
- function Q(e) {
1030
- return typeof e == "function" && typeof e.subscribe == "function" && !("set" in e);
1031
- }
1032
- function $(e = {}) {
1033
- return function(t, n) {
1034
- let r = e.label ?? n.name;
1035
- if (n.kind === "method") {
1036
- let e = t;
1037
- u({ wrap(t, n, i) {
1038
- return function(...t) {
1039
- let n = this.constructor.name, i = performance.now(), a, o = !1;
1040
- try {
1041
- a = e.apply(this, t);
1042
- } catch (e) {
1043
- throw o = !0, a = e, e;
1044
- } finally {
1045
- let e = performance.now() - i;
1046
- b.instance.recordMethodCall(this, r, t, o ? `throw ${String(a)}` : a, e, n);
1047
- }
1048
- return a;
1049
- };
1050
- } })(e, n);
1051
- return;
1052
- }
1053
- if (n.kind === "getter") {
1054
- let e = t;
1055
- l({ observe(e, t, n) {
1056
- let i = t.constructor.name;
1057
- queueMicrotask(() => {
1058
- let n = ee(() => e.call(t)), a = !0, o = n();
1059
- b.instance.registerSignal(t, r, o, i), n.subscribe((e) => {
1060
- if (a) {
1061
- a = !1;
1062
- return;
1063
- }
1064
- b.instance.updateSignal(t, r, e, o), o = e;
1065
- });
1066
- });
1067
- } })(e, n);
1068
- return;
1069
- }
1070
- c({ bind(e, t, n) {
1071
- let i = e.constructor.name, a = Object.getOwnPropertyDescriptor(e, t);
1072
- if (a?.get && a.set) {
1073
- let t = a.get, n = a.set;
1074
- return b.instance.registerSignal(e, r, t.call(e), i), { descriptor: {
1075
- get() {
1076
- return t.call(this);
1077
- },
1078
- set(e) {
1079
- let i = t.call(this);
1080
- n.call(this, e), b.instance.updateSignal(this, r, e, i);
1081
- }
1082
- } };
1083
- }
1084
- let o = n;
1085
- if (!Q(o)) return o !== void 0 && console.warn(`[PraxisJS DevTools] @Debug() on "${i}.${t}": expected a computed() value but got ${typeof o}. Skipping.`), {};
1086
- let s;
1087
- function c(t) {
1088
- let n = !0, a = t(), o = t.subscribe((t) => {
1089
- if (n) {
1090
- n = !1;
1091
- return;
1092
- }
1093
- b.instance.updateSignal(e, r, t, a), a = t;
1094
- });
1095
- return b.instance.registerSignal(e, r, a, i), o;
1096
- }
1097
- return s = {
1098
- computed: o,
1099
- unsub: c(o)
1100
- }, { descriptor: {
1101
- get() {
1102
- return s.computed;
1103
- },
1104
- set(e) {
1105
- if (s.unsub(), !Q(e)) {
1106
- console.warn(`[PraxisJS DevTools] @Debug() on "${i}.${t}": expected a computed() value but got ${typeof e}. Skipping.`);
1107
- return;
1108
- }
1109
- s = {
1110
- computed: e,
1111
- unsub: c(e)
1112
- };
1113
- }
1114
- } };
1115
- } })(void 0, n);
1116
- };
1117
- }
1118
- //#endregion
1119
- //#region src/decorators/trace.ts
1120
- var se = [
1121
- "onBeforeUpdate",
1122
- "onUpdate",
1123
- "onAfterUpdate"
1124
- ], ce = new class extends n {
1125
- create(e) {
1126
- let t = b.instance;
1127
- return {
1128
- onMount() {
1129
- t.recordLifecycle(e, "onMount");
1130
- },
1131
- onUnmount() {
1132
- t.recordLifecycle(e, "onUnmount");
1133
- },
1134
- render(n) {
1135
- let r = performance.now(), i = n(), a = performance.now() - r;
1136
- return t.recordRender(e, a), i;
1137
- }
1138
- };
1139
- }
1140
- initialize(e, t) {
1141
- let n = t.name, r = b.instance, i = e.prototype, a = i.onBeforeMount;
1142
- i.onBeforeMount = function(...e) {
1143
- return r.registerComponent(this, n), r.recordLifecycle(this, "onBeforeMount"), a?.call(this, ...e);
1144
- };
1145
- for (let e of se) {
1146
- let t = i[e];
1147
- i[e] = function(...n) {
1148
- return r.recordLifecycle(this, e), t?.call(this, ...n);
1149
- };
1150
- }
1151
- }
1152
- }();
1153
- function le() {
1154
- return s(ce);
1155
- }
1156
- //#endregion
1157
- export { D as ComponentsPlugin, $ as Debug, oe as DevTools, b as Registry, N as SignalsPlugin, R as TimelinePlugin, le as Trace };
1
+ import { Profiler as e } from "./core/profiler.js";
2
+ import { Registry as t } from "./core/registry.js";
3
+ import { ComponentsPlugin as n } from "./plugins/components/index.js";
4
+ import { PerformancePlugin as r } from "./plugins/performance/index.js";
5
+ import { SignalsPlugin as i } from "./plugins/signals/index.js";
6
+ import { TimelinePlugin as a } from "./plugins/timeline/index.js";
7
+ import { DevTools as o } from "./ui/dev-tools.js";
8
+ import { Debug as s } from "./decorators/debug.js";
9
+ import { Trace as c } from "./decorators/trace.js";
10
+ export { n as ComponentsPlugin, s as Debug, o as DevTools, r as PerformancePlugin, e as Profiler, t as Registry, i as SignalsPlugin, a as TimelinePlugin, c as Trace };