@vscode/component-explorer 0.1.1-8 → 0.2.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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/SECURITY.md +14 -0
  3. package/dist/components/Explorer.d.ts +4 -3
  4. package/dist/components/Explorer.d.ts.map +1 -1
  5. package/dist/components/ExplorerModel.d.ts +18 -2
  6. package/dist/components/ExplorerModel.d.ts.map +1 -1
  7. package/dist/components/FixturePreviewItem.d.ts +1 -0
  8. package/dist/components/FixturePreviewItem.d.ts.map +1 -1
  9. package/dist/components/LeftSidebar.d.ts.map +1 -1
  10. package/dist/components/PreviewArea.d.ts.map +1 -1
  11. package/dist/components/ReportComparisonRow.d.ts +16 -0
  12. package/dist/components/ReportComparisonRow.d.ts.map +1 -0
  13. package/dist/components/ScreenshotComparisonRow.d.ts.map +1 -1
  14. package/dist/components/SearchInput.d.ts +6 -0
  15. package/dist/components/SearchInput.d.ts.map +1 -0
  16. package/dist/components/TitleBar.d.ts.map +1 -1
  17. package/dist/components/TreeView.d.ts.map +1 -1
  18. package/dist/components/index.d.ts +3 -1
  19. package/dist/components/index.d.ts.map +1 -1
  20. package/dist/components/styles.d.ts +32 -32
  21. package/dist/components/treeFilter.d.ts +3 -0
  22. package/dist/components/treeFilter.d.ts.map +1 -0
  23. package/dist/components/types.d.ts +3 -1
  24. package/dist/components/types.d.ts.map +1 -1
  25. package/dist/core/ComponentRenderer.d.ts +17 -0
  26. package/dist/core/ComponentRenderer.d.ts.map +1 -0
  27. package/dist/core/ErrorInfo.d.ts +16 -0
  28. package/dist/core/ErrorInfo.d.ts.map +1 -0
  29. package/dist/core/FixtureNode.d.ts +16 -4
  30. package/dist/core/FixtureNode.d.ts.map +1 -1
  31. package/dist/core/FixturePath.d.ts +8 -0
  32. package/dist/core/FixturePath.d.ts.map +1 -0
  33. package/dist/core/FixtureRegistry.d.ts +3 -25
  34. package/dist/core/FixtureRegistry.d.ts.map +1 -1
  35. package/dist/core/fixtureApi.d.ts +358 -0
  36. package/dist/core/fixtureApi.d.ts.map +1 -0
  37. package/dist/core/fixtureApiConsumer.d.ts +84 -0
  38. package/dist/core/fixtureApiConsumer.d.ts.map +1 -0
  39. package/dist/core/index.d.ts +15 -8
  40. package/dist/core/index.d.ts.map +1 -1
  41. package/dist/daemon/DaemonConfig.d.ts +5 -11
  42. package/dist/daemon/DaemonConfig.d.ts.map +1 -1
  43. package/dist/daemon/DaemonModel.d.ts +7 -4
  44. package/dist/daemon/DaemonModel.d.ts.map +1 -1
  45. package/dist/daemon/index.d.ts +1 -2
  46. package/dist/daemon/index.d.ts.map +1 -1
  47. package/dist/index.d.ts +9 -33
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +10 -3506
  50. package/dist/index.js.map +1 -1
  51. package/dist/lib/explorerQueryParams.d.ts +4 -0
  52. package/dist/lib/explorerQueryParams.d.ts.map +1 -0
  53. package/dist/lib/explorerShadowHost.d.ts +3 -0
  54. package/dist/lib/explorerShadowHost.d.ts.map +1 -0
  55. package/dist/lib/fixtureFocusTrap.d.ts +2 -0
  56. package/dist/lib/fixtureFocusTrap.d.ts.map +1 -0
  57. package/dist/lib/fixtureSizeCache.d.ts +3 -0
  58. package/dist/lib/fixtureSizeCache.d.ts.map +1 -1
  59. package/dist/lib/queryParamObservable.d.ts +4 -0
  60. package/dist/lib/queryParamObservable.d.ts.map +1 -0
  61. package/dist/modes/EmbeddedMode.d.ts +15 -0
  62. package/dist/modes/EmbeddedMode.d.ts.map +1 -0
  63. package/dist/modes/ExplorerUIMode.d.ts +16 -0
  64. package/dist/modes/ExplorerUIMode.d.ts.map +1 -0
  65. package/dist/{core/CliRuntime.d.ts → modes/HeadlessMode.d.ts} +20 -25
  66. package/dist/modes/HeadlessMode.d.ts.map +1 -0
  67. package/dist/report/ReportModel.d.ts +23 -0
  68. package/dist/report/ReportModel.d.ts.map +1 -0
  69. package/dist/report/ScreenshotReport.d.ts +26 -0
  70. package/dist/report/ScreenshotReport.d.ts.map +1 -0
  71. package/dist/report/index.d.ts +3 -0
  72. package/dist/report/index.d.ts.map +1 -0
  73. package/dist/runtimeVersion-CnnW4nSy.js +84 -0
  74. package/dist/runtimeVersion-CnnW4nSy.js.map +1 -0
  75. package/dist/runtimeVersion.d.ts +3 -0
  76. package/dist/runtimeVersion.d.ts.map +1 -0
  77. package/dist/viewer.d.ts +34 -0
  78. package/dist/viewer.d.ts.map +1 -0
  79. package/dist/viewer.js +4104 -0
  80. package/dist/viewer.js.map +1 -0
  81. package/package.json +29 -9
  82. package/dist/core/CliRuntime.d.ts.map +0 -1
  83. package/dist/core/ComponentDefinition.d.ts +0 -70
  84. package/dist/core/ComponentDefinition.d.ts.map +0 -1
  85. package/dist/core/defineFixture.d.ts +0 -109
  86. package/dist/core/defineFixture.d.ts.map +0 -1
  87. package/dist/index.css +0 -1
package/dist/index.js CHANGED
@@ -1,3509 +1,13 @@
1
- var it = Object.defineProperty;
2
- var ot = (s, e, t) => e in s ? it(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var c = (s, e, t) => ot(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { createRoot as at } from "react-dom/client";
5
- import { createElement as dt } from "react";
6
- import { jsx as a, jsxs as p, Fragment as ce } from "react/jsx-runtime";
7
- import { ViewModel as N, prop as f, viewWithModel as V, view as D } from "@vscode/observables-react";
8
- const lt = {
9
- mobile: { width: 390, height: 844 },
10
- tablet: { width: 768, height: 1024 },
11
- desktop: { width: 1440, height: 900 }
12
- };
13
- function ct(s) {
14
- return typeof s == "string" ? { name: s, ...lt[s] } : s;
15
- }
16
- function ht(s) {
17
- const e = {};
18
- for (const t of s)
19
- e[t.name] = t.defaultValue;
20
- return e;
21
- }
22
- function qn(s) {
23
- return typeof s == "object" && s !== null && "render" in s && typeof s.render == "function" && "id" in s && "name" in s;
24
- }
25
- const Ne = Symbol("singleFixture"), Ve = Symbol("fixtureGroup"), De = Symbol("fixtureVariants");
26
- function ut(s) {
27
- return typeof s == "object" && s !== null && Ne in s;
28
- }
29
- function ft(s) {
30
- return typeof s == "object" && s !== null && Ve in s;
31
- }
32
- function pt(s) {
33
- return typeof s == "object" && s !== null && De in s;
34
- }
35
- function gt(s, e, t) {
36
- return {
37
- id: e,
38
- name: t,
39
- description: s.description,
40
- isolation: s.isolation ?? "shadow-dom",
41
- displayMode: s.displayMode ?? { type: "component" },
42
- styles: s.styles,
43
- background: s.background ?? "light",
44
- properties: s.properties ?? [],
45
- render: s.render
46
- };
47
- }
48
- function J(s) {
49
- return {
50
- [Ne]: !0,
51
- _options: s,
52
- _createDefinition: (e, t) => gt(s, e, t)
53
- };
54
- }
55
- function Kn(s) {
56
- return {
57
- [Ve]: !0,
58
- _entries: s
59
- };
60
- }
61
- function Jn(s) {
62
- return {
63
- [De]: !0,
64
- _variants: s
65
- };
66
- }
67
- function re(s) {
68
- const e = {
69
- id: "",
70
- name: "Components",
71
- type: "folder",
72
- children: []
73
- };
74
- for (const [t, n] of s) {
75
- const r = vt(t);
76
- Ae(e, [r], n);
77
- }
78
- return e;
79
- }
80
- function vt(s) {
81
- return (s.split("/").pop() ?? s).replace(/\.fixture\.(tsx?|jsx?)$/, "");
82
- }
83
- function Ae(s, e, t) {
84
- var n;
85
- if (ut(t)) {
86
- const r = e.join("/"), i = e[e.length - 1], o = {
87
- id: r,
88
- name: i,
89
- type: "component",
90
- component: t._createDefinition(r, i)
91
- };
92
- s.children || (s.children = []), s.children.push(o);
93
- } else if (ft(t)) {
94
- const r = e[e.length - 1], i = e.join("/");
95
- let o = (n = s.children) == null ? void 0 : n.find(
96
- (d) => d.type === "folder" && d.name === r
97
- );
98
- o || (o = {
99
- id: i,
100
- name: r,
101
- type: "folder",
102
- children: []
103
- }, s.children || (s.children = []), s.children.push(o));
104
- for (const [d, l] of Object.entries(t._entries))
105
- Ae(o, [...e, d], l);
106
- } else if (pt(t)) {
107
- const r = e[e.length - 1], o = {
108
- id: e.join("/"),
109
- name: r,
110
- type: "variants",
111
- children: []
112
- };
113
- s.children || (s.children = []), s.children.push(o);
114
- for (const [d, l] of Object.entries(t._variants)) {
115
- const g = [...e, d].join("/"), b = {
116
- id: g,
117
- name: d,
118
- type: "component",
119
- component: l._createDefinition(g, d)
120
- };
121
- o.children.push(b);
122
- }
123
- }
124
- }
125
- function ve(s, e) {
126
- if (e.length === 0)
127
- return s;
128
- let t = s;
129
- for (const n of e) {
130
- if (!t || !t.children)
131
- return;
132
- t = t.children.find((r) => r.name === n);
133
- }
134
- return t;
135
- }
136
- function mt(s) {
137
- if (s.type === "component" && s.component)
138
- return [s.component];
139
- const e = [];
140
- for (const t of s.children ?? [])
141
- e.push(...mt(t));
142
- return e;
143
- }
144
- let B;
145
- function Be(s) {
146
- B ? B instanceof me ? B.loggers.push(s) : B = new me([B, s]) : B = s;
147
- }
148
- function v() {
149
- return B;
150
- }
151
- let ie;
152
- function _t(s) {
153
- ie = s;
154
- }
155
- function bt(s) {
156
- ie && ie(s);
157
- }
158
- class me {
159
- constructor(e) {
160
- this.loggers = e;
161
- }
162
- handleObservableCreated(e, t) {
163
- for (const n of this.loggers)
164
- n.handleObservableCreated(e, t);
165
- }
166
- handleOnListenerCountChanged(e, t) {
167
- for (const n of this.loggers)
168
- n.handleOnListenerCountChanged(e, t);
169
- }
170
- handleObservableUpdated(e, t) {
171
- for (const n of this.loggers)
172
- n.handleObservableUpdated(e, t);
173
- }
174
- handleAutorunCreated(e, t) {
175
- for (const n of this.loggers)
176
- n.handleAutorunCreated(e, t);
177
- }
178
- handleAutorunDisposed(e) {
179
- for (const t of this.loggers)
180
- t.handleAutorunDisposed(e);
181
- }
182
- handleAutorunDependencyChanged(e, t, n) {
183
- for (const r of this.loggers)
184
- r.handleAutorunDependencyChanged(e, t, n);
185
- }
186
- handleAutorunStarted(e) {
187
- for (const t of this.loggers)
188
- t.handleAutorunStarted(e);
189
- }
190
- handleAutorunFinished(e) {
191
- for (const t of this.loggers)
192
- t.handleAutorunFinished(e);
193
- }
194
- handleDerivedDependencyChanged(e, t, n) {
195
- for (const r of this.loggers)
196
- r.handleDerivedDependencyChanged(e, t, n);
197
- }
198
- handleDerivedCleared(e) {
199
- for (const t of this.loggers)
200
- t.handleDerivedCleared(e);
201
- }
202
- handleBeginTransaction(e) {
203
- for (const t of this.loggers)
204
- t.handleBeginTransaction(e);
205
- }
206
- handleEndTransaction(e) {
207
- for (const t of this.loggers)
208
- t.handleEndTransaction(e);
209
- }
210
- }
211
- var R;
212
- (function(s) {
213
- let e = !1;
214
- function t() {
215
- e = !0;
216
- }
217
- s.enable = t;
218
- function n() {
219
- return r(1);
220
- }
221
- s.ofCaller = n;
222
- function r(i) {
223
- if (!e)
224
- return;
225
- const o = Error, d = o.stackTraceLimit;
226
- o.stackTraceLimit = 3;
227
- const l = new Error().stack;
228
- return o.stackTraceLimit = d, he.fromStack(l, i + 1);
229
- }
230
- s.ofNthCaller = r;
231
- })(R || (R = {}));
232
- class he {
233
- static fromStack(e, t) {
234
- const n = e.split(`
235
- `), r = yt(n[t + 1]);
236
- if (r)
237
- return new he(r.fileName, r.line, r.column, r.id);
238
- }
239
- constructor(e, t, n, r) {
240
- this.fileName = e, this.line = t, this.column = n, this.id = r;
241
- }
242
- }
243
- function yt(s) {
244
- if (!s)
245
- return;
246
- const e = s.match(/\((.*):(\d+):(\d+)\)/);
247
- if (e)
248
- return {
249
- fileName: e[1],
250
- line: parseInt(e[2]),
251
- column: parseInt(e[3]),
252
- id: s
253
- };
254
- const t = s.match(/at ([^\(\)]*):(\d+):(\d+)/);
255
- if (t)
256
- return {
257
- fileName: t[1],
258
- line: parseInt(t[2]),
259
- column: parseInt(t[3]),
260
- id: s
261
- };
262
- }
263
- class F {
264
- constructor(e, t, n) {
265
- this.owner = e, this.debugNameSource = t, this.referenceFn = n;
266
- }
267
- getDebugName(e) {
268
- return Ct(e, this);
269
- }
270
- }
271
- const _e = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new WeakMap();
272
- function Ct(s, e) {
273
- const t = oe.get(s);
274
- if (t)
275
- return t;
276
- const n = xt(s, e);
277
- if (n) {
278
- let r = _e.get(n) ?? 0;
279
- r++, _e.set(n, r);
280
- const i = r === 1 ? n : `${n}#${r}`;
281
- return oe.set(s, i), i;
282
- }
283
- }
284
- function xt(s, e) {
285
- const t = oe.get(s);
286
- if (t)
287
- return t;
288
- const n = e.owner ? wt(e.owner) + "." : "";
289
- let r;
290
- const i = e.debugNameSource;
291
- if (i !== void 0)
292
- if (typeof i == "function") {
293
- if (r = i(), r !== void 0)
294
- return n + r;
295
- } else
296
- return n + i;
297
- const o = e.referenceFn;
298
- if (o !== void 0 && (r = ue(o), r !== void 0))
299
- return n + r;
300
- if (e.owner !== void 0) {
301
- const d = St(e.owner, s);
302
- if (d !== void 0)
303
- return n + d;
304
- }
305
- }
306
- function St(s, e) {
307
- for (const t in s)
308
- if (s[t] === e)
309
- return t;
310
- }
311
- const be = /* @__PURE__ */ new Map(), ye = /* @__PURE__ */ new WeakMap();
312
- function wt(s) {
313
- const e = ye.get(s);
314
- if (e)
315
- return e;
316
- const t = Me(s) ?? "Object";
317
- let n = be.get(t) ?? 0;
318
- n++, be.set(t, n);
319
- const r = n === 1 ? t : `${t}#${n}`;
320
- return ye.set(s, r), r;
321
- }
322
- function Me(s) {
323
- const e = s.constructor;
324
- if (e)
325
- return e.name === "Object" ? void 0 : e.name;
326
- }
327
- function ue(s) {
328
- const e = s.toString(), n = /\/\*\*\s*@description\s*([^*]*)\*\//.exec(e), r = n ? n[1] : void 0;
329
- return r == null ? void 0 : r.trim();
330
- }
331
- let ae;
332
- function It(s) {
333
- ae = s;
334
- }
335
- let Fe;
336
- function Ot(s) {
337
- Fe = s;
338
- }
339
- let Ee;
340
- function Tt(s) {
341
- Ee = s;
342
- }
343
- let ze;
344
- function Rt(s) {
345
- ze = s;
346
- }
347
- class kt {
348
- get TChange() {
349
- return null;
350
- }
351
- reportChanges() {
352
- this.get();
353
- }
354
- /** @sealed */
355
- read(e) {
356
- return e ? e.readObservable(this) : this.get();
357
- }
358
- map(e, t, n = R.ofCaller()) {
359
- const r = t === void 0 ? void 0 : e, i = t === void 0 ? e : t;
360
- return ae({
361
- owner: r,
362
- debugName: () => {
363
- const o = ue(i);
364
- if (o !== void 0)
365
- return o;
366
- const l = /^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(i.toString());
367
- if (l)
368
- return `${this.debugName}.${l[2]}`;
369
- if (!r)
370
- return `${this.debugName} (mapped)`;
371
- },
372
- debugReferenceFn: i
373
- }, (o) => i(this.read(o), o), n);
374
- }
375
- /**
376
- * @sealed
377
- * Converts an observable of an observable value into a direct observable of the value.
378
- */
379
- flatten() {
380
- return ae({
381
- owner: void 0,
382
- debugName: () => `${this.debugName} (flattened)`
383
- }, (e) => this.read(e).read(e));
384
- }
385
- recomputeInitiallyAndOnChange(e, t) {
386
- return e.add(Fe(this, t)), this;
387
- }
388
- /**
389
- * Ensures that this observable is observed. This keeps the cache alive.
390
- * However, in case of deriveds, it does not force eager evaluation (only when the value is read/get).
391
- * Use `recomputeInitiallyAndOnChange` for eager evaluation.
392
- */
393
- keepObserved(e) {
394
- return e.add(Ee(this)), this;
395
- }
396
- get debugValue() {
397
- return this.get();
398
- }
399
- debugGetDependencyGraph() {
400
- return ze(this);
401
- }
402
- }
403
- class fe extends kt {
404
- constructor(e) {
405
- var t;
406
- super(), this._observers = /* @__PURE__ */ new Set(), (t = v()) == null || t.handleObservableCreated(this, e);
407
- }
408
- addObserver(e) {
409
- var n;
410
- const t = this._observers.size;
411
- this._observers.add(e), t === 0 && this.onFirstObserverAdded(), t !== this._observers.size && ((n = v()) == null || n.handleOnListenerCountChanged(this, this._observers.size));
412
- }
413
- removeObserver(e) {
414
- var n;
415
- const t = this._observers.delete(e);
416
- t && this._observers.size === 0 && this.onLastObserverRemoved(), t && ((n = v()) == null || n.handleOnListenerCountChanged(this, this._observers.size));
417
- }
418
- onFirstObserverAdded() {
419
- }
420
- onLastObserverRemoved() {
421
- }
422
- log() {
423
- var t;
424
- const e = !!v();
425
- return bt(this), e || (t = v()) == null || t.handleObservableCreated(this, R.ofCaller()), this;
426
- }
427
- debugGetObservers() {
428
- return this._observers;
429
- }
430
- }
431
- function He(s) {
432
- return {
433
- dispose: s
434
- };
435
- }
436
- class x extends Error {
437
- constructor(e) {
438
- super(e || "An unexpected bug occurred."), Object.setPrototypeOf(this, x.prototype);
439
- }
440
- }
441
- function X(s) {
442
- throw s;
443
- }
444
- function de(s) {
445
- console.error("Unexpected error:", s);
446
- }
447
- const q = (s, e) => s === e;
448
- function G(s) {
449
- return s != null;
450
- }
451
- class Y {
452
- constructor() {
453
- this.disposables = [], this._isDisposed = !1;
454
- }
455
- get isDisposed() {
456
- return this._isDisposed;
457
- }
458
- dispose() {
459
- this.clear(), this._isDisposed = !0;
460
- }
461
- add(e) {
462
- return e && this.disposables.push(e), e;
463
- }
464
- remove(e) {
465
- if (!e)
466
- return e;
467
- const t = this.disposables.indexOf(e);
468
- return t !== -1 && this.disposables.splice(t, 1), e;
469
- }
470
- clear() {
471
- for (const e of this.disposables)
472
- e.dispose();
473
- this.disposables = [];
474
- }
475
- leakItems() {
476
- this.disposables = [];
477
- }
478
- }
479
- function Nt(s) {
480
- switch (s) {
481
- case 0:
482
- return "initial";
483
- case 1:
484
- return "dependenciesMightHaveChanged";
485
- case 2:
486
- return "stale";
487
- case 3:
488
- return "upToDate";
489
- default:
490
- return "<unknown>";
491
- }
492
- }
493
- class y extends fe {
494
- get debugName() {
495
- return this._debugNameData.getDebugName(this) ?? "(anonymous)";
496
- }
497
- constructor(e, t, n, r = void 0, i, o) {
498
- var d;
499
- super(o), this._debugNameData = e, this._computeFn = t, this._changeTracker = n, this._handleLastObserverRemoved = r, this._equalityComparator = i, this._state = 0, this._value = void 0, this._updateCount = 0, this._dependencies = /* @__PURE__ */ new Set(), this._dependenciesToBeRemoved = /* @__PURE__ */ new Set(), this._changeSummary = void 0, this._isUpdating = !1, this._isComputing = !1, this._didReportChange = !1, this._isInBeforeUpdate = !1, this._isReaderValid = !1, this._store = void 0, this._delayedStore = void 0, this._removedObserverToCallEndUpdateOn = null, this._changeSummary = (d = this._changeTracker) == null ? void 0 : d.createChangeSummary(void 0);
500
- }
501
- onLastObserverRemoved() {
502
- var e, t;
503
- this._state = 0, this._value = void 0, (e = v()) == null || e.handleDerivedCleared(this);
504
- for (const n of this._dependencies)
505
- n.removeObserver(this);
506
- this._dependencies.clear(), this._store !== void 0 && (this._store.dispose(), this._store = void 0), this._delayedStore !== void 0 && (this._delayedStore.dispose(), this._delayedStore = void 0), (t = this._handleLastObserverRemoved) == null || t.call(this);
507
- }
508
- get() {
509
- var t, n;
510
- if (this._isComputing, this._observers.size === 0) {
511
- let r;
512
- try {
513
- this._isReaderValid = !0;
514
- let i;
515
- this._changeTracker && (i = this._changeTracker.createChangeSummary(void 0), (n = (t = this._changeTracker).beforeUpdate) == null || n.call(t, this, i)), r = this._computeFn(this, i);
516
- } finally {
517
- this._isReaderValid = !1;
518
- }
519
- return this.onLastObserverRemoved(), r;
520
- } else {
521
- do {
522
- if (this._state === 1) {
523
- for (const r of this._dependencies)
524
- if (r.reportChanges(), this._state === 2)
525
- break;
526
- }
527
- this._state === 1 && (this._state = 3), this._state !== 3 && this._recompute();
528
- } while (this._state !== 3);
529
- return this._value;
530
- }
531
- }
532
- _recompute() {
533
- var n, r, i, o;
534
- let e = !1;
535
- this._isComputing = !0, this._didReportChange = !1;
536
- const t = this._dependenciesToBeRemoved;
537
- this._dependenciesToBeRemoved = this._dependencies, this._dependencies = t;
538
- try {
539
- const d = this._changeSummary;
540
- this._isReaderValid = !0, this._changeTracker && (this._isInBeforeUpdate = !0, (r = (n = this._changeTracker).beforeUpdate) == null || r.call(n, this, d), this._isInBeforeUpdate = !1, this._changeSummary = (i = this._changeTracker) == null ? void 0 : i.createChangeSummary(d));
541
- const l = this._state !== 0, h = this._value;
542
- this._state = 3;
543
- const g = this._delayedStore;
544
- g !== void 0 && (this._delayedStore = void 0);
545
- try {
546
- this._store !== void 0 && (this._store.dispose(), this._store = void 0), this._value = this._computeFn(this, d);
547
- } finally {
548
- this._isReaderValid = !1;
549
- for (const b of this._dependenciesToBeRemoved)
550
- b.removeObserver(this);
551
- this._dependenciesToBeRemoved.clear(), g !== void 0 && g.dispose();
552
- }
553
- e = this._didReportChange || l && !this._equalityComparator(h, this._value), (o = v()) == null || o.handleObservableUpdated(this, {
554
- oldValue: h,
555
- newValue: this._value,
556
- change: void 0,
557
- didChange: e,
558
- hadValue: l
559
- });
560
- } catch (d) {
561
- X(d);
562
- }
563
- if (this._isComputing = !1, !this._didReportChange && e)
564
- for (const d of this._observers)
565
- d.handleChange(this, void 0);
566
- else
567
- this._didReportChange = !1;
568
- }
569
- toString() {
570
- return `LazyDerived<${this.debugName}>`;
571
- }
572
- // IObserver Implementation
573
- beginUpdate(e) {
574
- if (this._isUpdating)
575
- throw new x("Cyclic deriveds are not supported yet!");
576
- this._updateCount++, this._isUpdating = !0;
577
- try {
578
- const t = this._updateCount === 1;
579
- if (this._state === 3 && (this._state = 1, !t))
580
- for (const n of this._observers)
581
- n.handlePossibleChange(this);
582
- if (t)
583
- for (const n of this._observers)
584
- n.beginUpdate(this);
585
- } finally {
586
- this._isUpdating = !1;
587
- }
588
- }
589
- endUpdate(e) {
590
- if (this._updateCount--, this._updateCount === 0) {
591
- const t = [...this._observers];
592
- for (const n of t)
593
- n.endUpdate(this);
594
- if (this._removedObserverToCallEndUpdateOn) {
595
- const n = [...this._removedObserverToCallEndUpdateOn];
596
- this._removedObserverToCallEndUpdateOn = null;
597
- for (const r of n)
598
- r.endUpdate(this);
599
- }
600
- }
601
- }
602
- handlePossibleChange(e) {
603
- if (this._state === 3 && this._dependencies.has(e) && !this._dependenciesToBeRemoved.has(e)) {
604
- this._state = 1;
605
- for (const t of this._observers)
606
- t.handlePossibleChange(this);
607
- }
608
- }
609
- handleChange(e, t) {
610
- var n;
611
- if (this._dependencies.has(e) && !this._dependenciesToBeRemoved.has(e) || this._isInBeforeUpdate) {
612
- (n = v()) == null || n.handleDerivedDependencyChanged(this, e, t);
613
- let r = !1;
614
- try {
615
- r = this._changeTracker ? this._changeTracker.handleChange({
616
- changedObservable: e,
617
- change: t,
618
- didChange: (o) => o === e
619
- }, this._changeSummary) : !0;
620
- } catch (o) {
621
- X(o);
622
- }
623
- const i = this._state === 3;
624
- if (r && (this._state === 1 || i) && (this._state = 2, i))
625
- for (const o of this._observers)
626
- o.handlePossibleChange(this);
627
- }
628
- }
629
- // IReader Implementation
630
- _ensureReaderValid() {
631
- if (!this._isReaderValid)
632
- throw new x("The reader object cannot be used outside its compute function!");
633
- }
634
- readObservable(e) {
635
- this._ensureReaderValid(), e.addObserver(this);
636
- const t = e.get();
637
- return this._dependencies.add(e), this._dependenciesToBeRemoved.delete(e), t;
638
- }
639
- reportChange(e) {
640
- this._ensureReaderValid(), this._didReportChange = !0;
641
- for (const t of this._observers)
642
- t.handleChange(this, e);
643
- }
644
- get store() {
645
- return this._ensureReaderValid(), this._store === void 0 && (this._store = new Y()), this._store;
646
- }
647
- get delayedStore() {
648
- return this._ensureReaderValid(), this._delayedStore === void 0 && (this._delayedStore = new Y()), this._delayedStore;
649
- }
650
- addObserver(e) {
651
- const t = !this._observers.has(e) && this._updateCount > 0;
652
- super.addObserver(e), t && (this._removedObserverToCallEndUpdateOn && this._removedObserverToCallEndUpdateOn.has(e) ? this._removedObserverToCallEndUpdateOn.delete(e) : e.beginUpdate(this));
653
- }
654
- removeObserver(e) {
655
- this._observers.has(e) && this._updateCount > 0 && (this._removedObserverToCallEndUpdateOn || (this._removedObserverToCallEndUpdateOn = /* @__PURE__ */ new Set()), this._removedObserverToCallEndUpdateOn.add(e)), super.removeObserver(e);
656
- }
657
- debugGetState() {
658
- return {
659
- state: this._state,
660
- stateStr: Nt(this._state),
661
- updateCount: this._updateCount,
662
- isComputing: this._isComputing,
663
- dependencies: this._dependencies,
664
- value: this._value
665
- };
666
- }
667
- debugSetValue(e) {
668
- this._value = e;
669
- }
670
- debugRecompute() {
671
- this._isComputing ? this._state = 2 : this._recompute();
672
- }
673
- setValue(e, t, n) {
674
- this._value = e;
675
- const r = this._observers;
676
- t.updateObserver(this, this);
677
- for (const i of r)
678
- i.handleChange(this, n);
679
- }
680
- }
681
- function j(s, e, t = R.ofCaller()) {
682
- return e !== void 0 ? new y(new F(s, void 0, e), e, void 0, void 0, q, t) : new y(new F(void 0, void 0, s), s, void 0, void 0, q, t);
683
- }
684
- function Vt(s, e, t = R.ofCaller()) {
685
- return new y(new F(s.owner, s.debugName, s.debugReferenceFn), e, void 0, s.onLastObserverRemoved, s.equalsFn ?? q, t);
686
- }
687
- It(Vt);
688
- function Dt(s) {
689
- switch (s) {
690
- case 1:
691
- return "dependenciesMightHaveChanged";
692
- case 2:
693
- return "stale";
694
- case 3:
695
- return "upToDate";
696
- default:
697
- return "<unknown>";
698
- }
699
- }
700
- class Q {
701
- get debugName() {
702
- return this._debugNameData.getDebugName(this) ?? "(anonymous)";
703
- }
704
- constructor(e, t, n, r) {
705
- var i, o;
706
- this._debugNameData = e, this._runFn = t, this._changeTracker = n, this._state = 2, this._updateCount = 0, this._disposed = !1, this._dependencies = /* @__PURE__ */ new Set(), this._dependenciesToBeRemoved = /* @__PURE__ */ new Set(), this._isRunning = !1, this._store = void 0, this._delayedStore = void 0, this._changeSummary = (i = this._changeTracker) == null ? void 0 : i.createChangeSummary(void 0), (o = v()) == null || o.handleAutorunCreated(this, r), this._run();
707
- }
708
- dispose() {
709
- var e;
710
- if (!this._disposed) {
711
- this._disposed = !0;
712
- for (const t of this._dependencies)
713
- t.removeObserver(this);
714
- this._dependencies.clear(), this._store !== void 0 && this._store.dispose(), this._delayedStore !== void 0 && this._delayedStore.dispose(), (e = v()) == null || e.handleAutorunDisposed(this);
715
- }
716
- }
717
- _run() {
718
- var t, n, r, i;
719
- const e = this._dependenciesToBeRemoved;
720
- this._dependenciesToBeRemoved = this._dependencies, this._dependencies = e, this._state = 3;
721
- try {
722
- if (!this._disposed) {
723
- (t = v()) == null || t.handleAutorunStarted(this);
724
- const o = this._changeSummary, d = this._delayedStore;
725
- d !== void 0 && (this._delayedStore = void 0);
726
- try {
727
- this._isRunning = !0, this._changeTracker && ((r = (n = this._changeTracker).beforeUpdate) == null || r.call(n, this, o), this._changeSummary = this._changeTracker.createChangeSummary(o)), this._store !== void 0 && (this._store.dispose(), this._store = void 0), this._runFn(this, o);
728
- } catch (l) {
729
- X(l);
730
- } finally {
731
- this._isRunning = !1, d !== void 0 && d.dispose();
732
- }
733
- }
734
- } finally {
735
- this._disposed || (i = v()) == null || i.handleAutorunFinished(this);
736
- for (const o of this._dependenciesToBeRemoved)
737
- o.removeObserver(this);
738
- this._dependenciesToBeRemoved.clear();
739
- }
740
- }
741
- toString() {
742
- return `Autorun<${this.debugName}>`;
743
- }
744
- // IObserver implementation
745
- beginUpdate(e) {
746
- this._state === 3 && (this._state = 1), this._updateCount++;
747
- }
748
- endUpdate(e) {
749
- try {
750
- if (this._updateCount === 1)
751
- do {
752
- if (this._state === 1) {
753
- this._state = 3;
754
- for (const t of this._dependencies)
755
- if (t.reportChanges(), this._state === 2)
756
- break;
757
- }
758
- this._state !== 3 && this._run();
759
- } while (this._state !== 3);
760
- } finally {
761
- this._updateCount--;
762
- }
763
- }
764
- handlePossibleChange(e) {
765
- this._state === 3 && this._isDependency(e) && (this._state = 1);
766
- }
767
- handleChange(e, t) {
768
- var n;
769
- if (this._isDependency(e)) {
770
- (n = v()) == null || n.handleAutorunDependencyChanged(this, e, t);
771
- try {
772
- (this._changeTracker ? this._changeTracker.handleChange({
773
- changedObservable: e,
774
- change: t,
775
- didChange: (i) => i === e
776
- }, this._changeSummary) : !0) && (this._state = 2);
777
- } catch (r) {
778
- X(r);
779
- }
780
- }
781
- }
782
- _isDependency(e) {
783
- return this._dependencies.has(e) && !this._dependenciesToBeRemoved.has(e);
784
- }
785
- // IReader implementation
786
- _ensureNoRunning() {
787
- if (!this._isRunning)
788
- throw new x("The reader object cannot be used outside its compute function!");
789
- }
790
- readObservable(e) {
791
- if (this._ensureNoRunning(), this._disposed)
792
- return e.get();
793
- e.addObserver(this);
794
- const t = e.get();
795
- return this._dependencies.add(e), this._dependenciesToBeRemoved.delete(e), t;
796
- }
797
- get store() {
798
- if (this._ensureNoRunning(), this._disposed)
799
- throw new x("Cannot access store after dispose");
800
- return this._store === void 0 && (this._store = new Y()), this._store;
801
- }
802
- get delayedStore() {
803
- if (this._ensureNoRunning(), this._disposed)
804
- throw new x("Cannot access store after dispose");
805
- return this._delayedStore === void 0 && (this._delayedStore = new Y()), this._delayedStore;
806
- }
807
- debugGetState() {
808
- return {
809
- isRunning: this._isRunning,
810
- updateCount: this._updateCount,
811
- dependencies: this._dependencies,
812
- state: this._state,
813
- stateStr: Dt(this._state)
814
- };
815
- }
816
- debugRerun() {
817
- this._isRunning ? this._state = 2 : this._run();
818
- }
819
- }
820
- function Le(s, e = R.ofCaller()) {
821
- return new Q(new F(void 0, void 0, s), s, void 0, e);
822
- }
823
- function Ce(s) {
824
- const e = new Error("BugIndicatingErrorRecovery: " + s);
825
- de(e), console.error("recovered from an error that indicates a bug", e);
826
- }
827
- function $e(s, e) {
828
- const t = new Ue(s, e);
829
- try {
830
- s(t);
831
- } finally {
832
- t.finish();
833
- }
834
- }
835
- function At(s, e, t) {
836
- s ? e(s) : $e(e, t);
837
- }
838
- class Ue {
839
- constructor(e, t) {
840
- var n;
841
- this._fn = e, this._getDebugName = t, this._updatingObservers = [], (n = v()) == null || n.handleBeginTransaction(this);
842
- }
843
- getDebugName() {
844
- return this._getDebugName ? this._getDebugName() : ue(this._fn);
845
- }
846
- updateObserver(e, t) {
847
- if (!this._updatingObservers) {
848
- Ce("Transaction already finished!"), $e((n) => {
849
- n.updateObserver(e, t);
850
- });
851
- return;
852
- }
853
- this._updatingObservers.push({ observer: e, observable: t }), e.beginUpdate(t);
854
- }
855
- finish() {
856
- var t;
857
- const e = this._updatingObservers;
858
- if (!e) {
859
- Ce("transaction.finish() has already been called!");
860
- return;
861
- }
862
- for (let n = 0; n < e.length; n++) {
863
- const { observer: r, observable: i } = e[n];
864
- r.endUpdate(i);
865
- }
866
- this._updatingObservers = null, (t = v()) == null || t.handleEndTransaction(this);
867
- }
868
- debugGetUpdatingObservers() {
869
- return this._updatingObservers;
870
- }
871
- }
872
- function _(s, e, t = R.ofCaller()) {
873
- let n;
874
- return typeof s == "string" ? n = new F(void 0, s, void 0) : n = new F(s, void 0, void 0), new ee(n, e, q, t);
875
- }
876
- class ee extends fe {
877
- get debugName() {
878
- return this._debugNameData.getDebugName(this) ?? "ObservableValue";
879
- }
880
- constructor(e, t, n, r) {
881
- var i;
882
- super(r), this._debugNameData = e, this._equalityComparator = n, this._value = t, (i = v()) == null || i.handleObservableUpdated(this, { hadValue: !1, newValue: t, change: void 0, didChange: !0, oldValue: void 0 });
883
- }
884
- get() {
885
- return this._value;
886
- }
887
- set(e, t, n) {
888
- var i;
889
- if (n === void 0 && this._equalityComparator(this._value, e))
890
- return;
891
- let r;
892
- t || (t = r = new Ue(() => {
893
- }, () => `Setting ${this.debugName}`));
894
- try {
895
- const o = this._value;
896
- this._setValue(e), (i = v()) == null || i.handleObservableUpdated(this, { oldValue: o, newValue: e, change: n, didChange: !0, hadValue: !0 });
897
- for (const d of this._observers)
898
- t.updateObserver(d, this), d.handleChange(this, n);
899
- } finally {
900
- r && r.finish();
901
- }
902
- }
903
- toString() {
904
- return `${this.debugName}: ${this._value}`;
905
- }
906
- _setValue(e) {
907
- this._value = e;
908
- }
909
- debugGetState() {
910
- return {
911
- value: this._value
912
- };
913
- }
914
- debugSetValue(e) {
915
- this._value = e;
916
- }
917
- }
918
- function xe(...s) {
919
- let e, t, n, r;
920
- return s.length === 2 ? [t, n] = s : [e, t, n, r] = s, new k(new F(e, void 0, n), t, n, () => k.globalTransaction, q, r ?? R.ofCaller());
921
- }
922
- class k extends fe {
923
- constructor(e, t, n, r, i, o) {
924
- super(o), this._debugNameData = e, this.event = t, this._getValue = n, this._getTransaction = r, this._equalityComparator = i, this._hasValue = !1, this.handleEvent = (d) => {
925
- var I;
926
- const l = this._getValue(d), h = this._value, g = !this._hasValue || !this._equalityComparator(h, l);
927
- let b = !1;
928
- g && (this._value = l, this._hasValue && (b = !0, At(this._getTransaction(), (S) => {
929
- var K;
930
- (K = v()) == null || K.handleObservableUpdated(this, { oldValue: h, newValue: l, change: void 0, didChange: g, hadValue: this._hasValue });
931
- for (const E of this._observers)
932
- S.updateObserver(E, this), E.handleChange(this, void 0);
933
- }, () => {
934
- const S = this.getDebugName();
935
- return "Event fired" + (S ? `: ${S}` : "");
936
- })), this._hasValue = !0), b || (I = v()) == null || I.handleObservableUpdated(this, { oldValue: h, newValue: l, change: void 0, didChange: g, hadValue: this._hasValue });
937
- };
938
- }
939
- getDebugName() {
940
- return this._debugNameData.getDebugName(this);
941
- }
942
- get debugName() {
943
- const e = this.getDebugName();
944
- return "From Event" + (e ? `: ${e}` : "");
945
- }
946
- onFirstObserverAdded() {
947
- this._subscription = this.event(this.handleEvent);
948
- }
949
- onLastObserverRemoved() {
950
- this._subscription.dispose(), this._subscription = void 0, this._hasValue = !1, this._value = void 0;
951
- }
952
- get() {
953
- return this._subscription ? (this._hasValue || this.handleEvent(void 0), this._value) : this._getValue(void 0);
954
- }
955
- debugSetValue(e) {
956
- this._value = e;
957
- }
958
- debugGetState() {
959
- return { value: this._value, hasValue: this._hasValue };
960
- }
961
- }
962
- (function(s) {
963
- s.Observer = k;
964
- function e(t, n) {
965
- let r = !1;
966
- k.globalTransaction === void 0 && (k.globalTransaction = t, r = !0);
967
- try {
968
- n();
969
- } finally {
970
- r && (k.globalTransaction = void 0);
971
- }
972
- }
973
- s.batchEventsGlobally = e;
974
- })(xe || (xe = {}));
975
- function Bt(s) {
976
- const e = new je(!1, void 0);
977
- return s.addObserver(e), He(() => {
978
- s.removeObserver(e);
979
- });
980
- }
981
- Tt(Bt);
982
- function Mt(s, e) {
983
- const t = new je(!0, e);
984
- s.addObserver(t);
985
- try {
986
- t.beginUpdate(s);
987
- } finally {
988
- t.endUpdate(s);
989
- }
990
- return He(() => {
991
- s.removeObserver(t);
992
- });
993
- }
994
- Ot(Mt);
995
- class je {
996
- constructor(e, t) {
997
- this._forceRecompute = e, this._handleValue = t, this._counter = 0;
998
- }
999
- beginUpdate(e) {
1000
- this._counter++;
1001
- }
1002
- endUpdate(e) {
1003
- this._counter === 1 && this._forceRecompute && (this._handleValue ? this._handleValue(e.get()) : e.reportChanges()), this._counter--;
1004
- }
1005
- handlePossibleChange(e) {
1006
- }
1007
- handleChange(e, t) {
1008
- }
1009
- }
1010
- let Z;
1011
- function Ft(s) {
1012
- Z || (Z = new Et(), Be(Z)), Z.addFilteredObj(s);
1013
- }
1014
- class Et {
1015
- constructor() {
1016
- this.indentation = 0, this.changedObservablesSets = /* @__PURE__ */ new WeakMap();
1017
- }
1018
- addFilteredObj(e) {
1019
- this._filteredObjects || (this._filteredObjects = /* @__PURE__ */ new Set()), this._filteredObjects.add(e);
1020
- }
1021
- _isIncluded(e) {
1022
- var t;
1023
- return ((t = this._filteredObjects) == null ? void 0 : t.has(e)) ?? !0;
1024
- }
1025
- textToConsoleArgs(e) {
1026
- return zt([
1027
- z($t("| ", this.indentation)),
1028
- e
1029
- ]);
1030
- }
1031
- formatInfo(e) {
1032
- return e.hadValue ? e.didChange ? [
1033
- z(" "),
1034
- C(T(e.oldValue, 70), {
1035
- color: "red",
1036
- strikeThrough: !0
1037
- }),
1038
- z(" "),
1039
- C(T(e.newValue, 60), {
1040
- color: "green"
1041
- })
1042
- ] : [z(" (unchanged)")] : [
1043
- z(" "),
1044
- C(T(e.newValue, 60), {
1045
- color: "green"
1046
- }),
1047
- z(" (initial)")
1048
- ];
1049
- }
1050
- handleObservableCreated(e) {
1051
- if (e instanceof y) {
1052
- const t = e;
1053
- this.changedObservablesSets.set(t, /* @__PURE__ */ new Set());
1054
- }
1055
- }
1056
- handleOnListenerCountChanged(e, t) {
1057
- }
1058
- handleObservableUpdated(e, t) {
1059
- if (this._isIncluded(e)) {
1060
- if (e instanceof y) {
1061
- this._handleDerivedRecomputed(e, t);
1062
- return;
1063
- }
1064
- console.log(...this.textToConsoleArgs([
1065
- H("observable value changed"),
1066
- C(e.debugName, { color: "BlueViolet" }),
1067
- ...this.formatInfo(t)
1068
- ]));
1069
- }
1070
- }
1071
- formatChanges(e) {
1072
- if (e.size !== 0)
1073
- return C(" (changed deps: " + [...e].map((t) => t.debugName).join(", ") + ")", { color: "gray" });
1074
- }
1075
- handleDerivedDependencyChanged(e, t, n) {
1076
- var r;
1077
- this._isIncluded(e) && ((r = this.changedObservablesSets.get(e)) == null || r.add(t));
1078
- }
1079
- _handleDerivedRecomputed(e, t) {
1080
- if (!this._isIncluded(e))
1081
- return;
1082
- const n = this.changedObservablesSets.get(e);
1083
- n && (console.log(...this.textToConsoleArgs([
1084
- H("derived recomputed"),
1085
- C(e.debugName, { color: "BlueViolet" }),
1086
- ...this.formatInfo(t),
1087
- this.formatChanges(n),
1088
- { data: [{ fn: e._debugNameData.referenceFn ?? e._computeFn }] }
1089
- ])), n.clear());
1090
- }
1091
- handleDerivedCleared(e) {
1092
- this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1093
- H("derived cleared"),
1094
- C(e.debugName, { color: "BlueViolet" })
1095
- ]));
1096
- }
1097
- handleFromEventObservableTriggered(e, t) {
1098
- this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1099
- H("observable from event triggered"),
1100
- C(e.debugName, { color: "BlueViolet" }),
1101
- ...this.formatInfo(t),
1102
- { data: [{ fn: e._getValue }] }
1103
- ]));
1104
- }
1105
- handleAutorunCreated(e) {
1106
- this._isIncluded(e) && this.changedObservablesSets.set(e, /* @__PURE__ */ new Set());
1107
- }
1108
- handleAutorunDisposed(e) {
1109
- }
1110
- handleAutorunDependencyChanged(e, t, n) {
1111
- this._isIncluded(e) && this.changedObservablesSets.get(e).add(t);
1112
- }
1113
- handleAutorunStarted(e) {
1114
- const t = this.changedObservablesSets.get(e);
1115
- t && (this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1116
- H("autorun"),
1117
- C(e.debugName, { color: "BlueViolet" }),
1118
- this.formatChanges(t),
1119
- { data: [{ fn: e._debugNameData.referenceFn ?? e._runFn }] }
1120
- ])), t.clear(), this.indentation++);
1121
- }
1122
- handleAutorunFinished(e) {
1123
- this.indentation--;
1124
- }
1125
- handleBeginTransaction(e) {
1126
- let t = e.getDebugName();
1127
- t === void 0 && (t = ""), this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1128
- H("transaction"),
1129
- C(t, { color: "BlueViolet" }),
1130
- { data: [{ fn: e._fn }] }
1131
- ])), this.indentation++;
1132
- }
1133
- handleEndTransaction() {
1134
- this.indentation--;
1135
- }
1136
- }
1137
- function zt(s) {
1138
- const e = new Array(), t = [];
1139
- let n = "";
1140
- function r(o) {
1141
- if ("length" in o)
1142
- for (const d of o)
1143
- d && r(d);
1144
- else "text" in o ? (n += `%c${o.text}`, e.push(o.style), o.data && t.push(...o.data)) : "data" in o && t.push(...o.data);
1145
- }
1146
- r(s);
1147
- const i = [n, ...e];
1148
- return i.push(...t), i;
1149
- }
1150
- function z(s) {
1151
- return C(s, { color: "black" });
1152
- }
1153
- function H(s) {
1154
- return C(Ut(`${s}: `, 10), { color: "black", bold: !0 });
1155
- }
1156
- function C(s, e = {
1157
- color: "black"
1158
- }) {
1159
- function t(r) {
1160
- return Object.entries(r).reduce((i, [o, d]) => `${i}${o}:${d};`, "");
1161
- }
1162
- const n = {
1163
- color: e.color
1164
- };
1165
- return e.strikeThrough && (n["text-decoration"] = "line-through"), e.bold && (n["font-weight"] = "bold"), {
1166
- text: s,
1167
- style: t(n)
1168
- };
1169
- }
1170
- function T(s, e) {
1171
- switch (typeof s) {
1172
- case "number":
1173
- return "" + s;
1174
- case "string":
1175
- return s.length + 2 <= e ? `"${s}"` : `"${s.substr(0, e - 7)}"+...`;
1176
- case "boolean":
1177
- return s ? "true" : "false";
1178
- case "undefined":
1179
- return "undefined";
1180
- case "object":
1181
- return s === null ? "null" : Array.isArray(s) ? Ht(s, e) : Lt(s, e);
1182
- case "symbol":
1183
- return s.toString();
1184
- case "function":
1185
- return `[[Function${s.name ? " " + s.name : ""}]]`;
1186
- default:
1187
- return "" + s;
1188
- }
1189
- }
1190
- function Ht(s, e) {
1191
- let t = "[ ", n = !0;
1192
- for (const r of s) {
1193
- if (n || (t += ", "), t.length - 5 > e) {
1194
- t += "...";
1195
- break;
1196
- }
1197
- n = !1, t += `${T(r, e - t.length)}`;
1198
- }
1199
- return t += " ]", t;
1200
- }
1201
- function Lt(s, e) {
1202
- if (typeof s.toString == "function" && s.toString !== Object.prototype.toString) {
1203
- const i = s.toString();
1204
- return i.length <= e ? i : i.substring(0, e - 3) + "...";
1205
- }
1206
- const t = Me(s);
1207
- let n = t ? t + "(" : "{ ", r = !0;
1208
- for (const [i, o] of Object.entries(s)) {
1209
- if (r || (n += ", "), n.length - 5 > e) {
1210
- n += "...";
1211
- break;
1212
- }
1213
- r = !1, n += `${i}: ${T(o, e - n.length)}`;
1214
- }
1215
- return n += t ? ")" : " }", n;
1216
- }
1217
- function $t(s, e) {
1218
- let t = "";
1219
- for (let n = 1; n <= e; n++)
1220
- t += s;
1221
- return t;
1222
- }
1223
- function Ut(s, e) {
1224
- for (; s.length < e; )
1225
- s += " ";
1226
- return s;
1227
- }
1228
- class te {
1229
- static createHost(e, t) {
1230
- return new te(e, t);
1231
- }
1232
- static createClient(e, t) {
1233
- return new te(e, t);
1234
- }
1235
- constructor(e, t) {
1236
- this._channelFactory = e, this._getHandler = t, this._channel = this._channelFactory({
1237
- handleNotification: (i) => {
1238
- const o = i, d = this._getHandler().notifications[o[0]];
1239
- if (!d)
1240
- throw new Error(`Unknown notification "${o[0]}"!`);
1241
- d(...o[1]);
1242
- },
1243
- handleRequest: (i) => {
1244
- const o = i;
1245
- try {
1246
- return { type: "result", value: this._getHandler().requests[o[0]](...o[1]) };
1247
- } catch (d) {
1248
- return { type: "error", value: d };
1249
- }
1250
- }
1251
- });
1252
- const n = new Proxy({}, {
1253
- get: (i, o) => async (...d) => {
1254
- const l = await this._channel.sendRequest([o, d]);
1255
- if (l.type === "error")
1256
- throw l.value;
1257
- return l.value;
1258
- }
1259
- }), r = new Proxy({}, {
1260
- get: (i, o) => (...d) => {
1261
- this._channel.sendNotification([o, d]);
1262
- }
1263
- });
1264
- this.api = { notifications: r, requests: n };
1265
- }
1266
- }
1267
- function jt(s, e) {
1268
- const t = globalThis;
1269
- let n = [], r;
1270
- const { channel: i, handler: o } = Pt({
1271
- sendNotification: (l) => {
1272
- r ? r.sendNotification(l) : n.push(l);
1273
- }
1274
- });
1275
- let d;
1276
- return (t.$$debugValueEditor_debugChannels ?? (t.$$debugValueEditor_debugChannels = {}))[s] = (l) => {
1277
- d = e(), r = l;
1278
- for (const h of n)
1279
- l.sendNotification(h);
1280
- return n = [], o;
1281
- }, te.createClient(i, () => {
1282
- if (!d)
1283
- throw new Error("Not supported");
1284
- return d;
1285
- });
1286
- }
1287
- function Pt(s) {
1288
- let e;
1289
- return {
1290
- channel: (n) => (e = n, {
1291
- sendNotification: (r) => {
1292
- s.sendNotification(r);
1293
- },
1294
- sendRequest: (r) => {
1295
- throw new Error("not supported");
1296
- }
1297
- }),
1298
- handler: {
1299
- handleRequest: (n) => n.type === "notification" ? e == null ? void 0 : e.handleNotification(n.data) : e == null ? void 0 : e.handleRequest(n.data)
1300
- }
1301
- };
1302
- }
1303
- class Gt {
1304
- constructor() {
1305
- this._timeout = void 0;
1306
- }
1307
- throttle(e, t) {
1308
- this._timeout === void 0 && (this._timeout = setTimeout(() => {
1309
- this._timeout = void 0, e();
1310
- }, t));
1311
- }
1312
- dispose() {
1313
- this._timeout !== void 0 && clearTimeout(this._timeout);
1314
- }
1315
- }
1316
- function Pe(s, e) {
1317
- for (const t in e)
1318
- s[t] && typeof s[t] == "object" && e[t] && typeof e[t] == "object" ? Pe(s[t], e[t]) : s[t] = e[t];
1319
- }
1320
- function Ge(s, e) {
1321
- for (const t in e)
1322
- e[t] === null ? delete s[t] : s[t] && typeof s[t] == "object" && e[t] && typeof e[t] == "object" ? Ge(s[t], e[t]) : s[t] = e[t];
1323
- }
1324
- class M {
1325
- static getInstance() {
1326
- return M._instance === void 0 && (M._instance = new M()), M._instance;
1327
- }
1328
- getTransactionState() {
1329
- const e = [], t = [...this._activeTransactions];
1330
- if (t.length === 0)
1331
- return;
1332
- const n = t.flatMap((i) => i.debugGetUpdatingObservers() ?? []).map((i) => i.observer), r = /* @__PURE__ */ new Set();
1333
- for (; n.length > 0; ) {
1334
- const i = n.shift();
1335
- if (r.has(i))
1336
- continue;
1337
- r.add(i);
1338
- const o = this._getInfo(i, (d) => {
1339
- r.has(d) || n.push(d);
1340
- });
1341
- o && e.push(o);
1342
- }
1343
- return { names: t.map((i) => i.getDebugName() ?? "tx"), affected: e };
1344
- }
1345
- _getObservableInfo(e) {
1346
- const t = this._instanceInfos.get(e);
1347
- if (!t) {
1348
- de(new x("No info found"));
1349
- return;
1350
- }
1351
- return t;
1352
- }
1353
- _getAutorunInfo(e) {
1354
- const t = this._instanceInfos.get(e);
1355
- if (!t) {
1356
- de(new x("No info found"));
1357
- return;
1358
- }
1359
- return t;
1360
- }
1361
- _getInfo(e, t) {
1362
- if (e instanceof y) {
1363
- const n = [...e.debugGetObservers()];
1364
- for (const l of n)
1365
- t(l);
1366
- const r = this._getObservableInfo(e);
1367
- if (!r)
1368
- return;
1369
- const i = e.debugGetState(), o = { name: e.debugName, instanceId: r.instanceId, updateCount: i.updateCount }, d = [...r.changedObservables].map((l) => {
1370
- var h;
1371
- return (h = this._instanceInfos.get(l)) == null ? void 0 : h.instanceId;
1372
- }).filter(G);
1373
- if (i.isComputing)
1374
- return { ...o, type: "observable/derived", state: "updating", changedDependencies: d, initialComputation: !1 };
1375
- switch (i.state) {
1376
- case 0:
1377
- return { ...o, type: "observable/derived", state: "noValue" };
1378
- case 3:
1379
- return { ...o, type: "observable/derived", state: "upToDate" };
1380
- case 2:
1381
- return { ...o, type: "observable/derived", state: "stale", changedDependencies: d };
1382
- case 1:
1383
- return { ...o, type: "observable/derived", state: "possiblyStale" };
1384
- }
1385
- } else if (e instanceof Q) {
1386
- const n = this._getAutorunInfo(e);
1387
- if (!n)
1388
- return;
1389
- const r = { name: e.debugName, instanceId: n.instanceId, updateCount: n.updateCount }, i = [...n.changedObservables].map((o) => this._instanceInfos.get(o).instanceId);
1390
- if (e.debugGetState().isRunning)
1391
- return { ...r, type: "autorun", state: "updating", changedDependencies: i };
1392
- switch (e.debugGetState().state) {
1393
- case 3:
1394
- return { ...r, type: "autorun", state: "upToDate" };
1395
- case 2:
1396
- return { ...r, type: "autorun", state: "stale", changedDependencies: i };
1397
- case 1:
1398
- return { ...r, type: "autorun", state: "possiblyStale" };
1399
- }
1400
- }
1401
- }
1402
- _formatObservable(e) {
1403
- const t = this._getObservableInfo(e);
1404
- if (t)
1405
- return { name: e.debugName, instanceId: t.instanceId };
1406
- }
1407
- _formatObserver(e) {
1408
- var n;
1409
- if (e instanceof y)
1410
- return { name: e.toString(), instanceId: (n = this._getObservableInfo(e)) == null ? void 0 : n.instanceId };
1411
- const t = this._getAutorunInfo(e);
1412
- if (t)
1413
- return { name: e.toString(), instanceId: t.instanceId };
1414
- }
1415
- constructor() {
1416
- this._declarationId = 0, this._instanceId = 0, this._declarations = /* @__PURE__ */ new Map(), this._instanceInfos = /* @__PURE__ */ new WeakMap(), this._aliveInstances = /* @__PURE__ */ new Map(), this._activeTransactions = /* @__PURE__ */ new Set(), this._channel = jt("observableDevTools", () => ({
1417
- notifications: {
1418
- setDeclarationIdFilter: (e) => {
1419
- },
1420
- logObservableValue: (e) => {
1421
- console.log("logObservableValue", e);
1422
- },
1423
- flushUpdates: () => {
1424
- this._flushUpdates();
1425
- },
1426
- resetUpdates: () => {
1427
- this._pendingChanges = null, this._channel.api.notifications.handleChange(this._fullState, !0);
1428
- }
1429
- },
1430
- requests: {
1431
- getDeclarations: () => {
1432
- const e = {};
1433
- for (const t of this._declarations.values())
1434
- e[t.id] = t;
1435
- return { decls: e };
1436
- },
1437
- getSummarizedInstances: () => null,
1438
- getObservableValueInfo: (e) => ({
1439
- observers: [...this._aliveInstances.get(e).debugGetObservers()].map((n) => this._formatObserver(n)).filter(G)
1440
- }),
1441
- getDerivedInfo: (e) => {
1442
- const t = this._aliveInstances.get(e);
1443
- return {
1444
- dependencies: [...t.debugGetState().dependencies].map((n) => this._formatObservable(n)).filter(G),
1445
- observers: [...t.debugGetObservers()].map((n) => this._formatObserver(n)).filter(G)
1446
- };
1447
- },
1448
- getAutorunInfo: (e) => ({
1449
- dependencies: [...this._aliveInstances.get(e).debugGetState().dependencies].map((n) => this._formatObservable(n)).filter(G)
1450
- }),
1451
- getTransactionState: () => this.getTransactionState(),
1452
- setValue: (e, t) => {
1453
- const n = this._aliveInstances.get(e);
1454
- if (n instanceof y)
1455
- n.debugSetValue(t);
1456
- else if (n instanceof ee)
1457
- n.debugSetValue(t);
1458
- else if (n instanceof k)
1459
- n.debugSetValue(t);
1460
- else
1461
- throw new x("Observable is not supported");
1462
- const r = [...n.debugGetObservers()];
1463
- for (const i of r)
1464
- i.beginUpdate(n);
1465
- for (const i of r)
1466
- i.handleChange(n, void 0);
1467
- for (const i of r)
1468
- i.endUpdate(n);
1469
- },
1470
- getValue: (e) => {
1471
- const t = this._aliveInstances.get(e);
1472
- if (t instanceof y)
1473
- return T(t.debugGetState().value, 200);
1474
- if (t instanceof ee)
1475
- return T(t.debugGetState().value, 200);
1476
- },
1477
- logValue: (e) => {
1478
- const t = this._aliveInstances.get(e);
1479
- if (t && "get" in t)
1480
- console.log("Logged Value:", t.get());
1481
- else
1482
- throw new x("Observable is not supported");
1483
- },
1484
- rerun: (e) => {
1485
- const t = this._aliveInstances.get(e);
1486
- if (t instanceof y)
1487
- t.debugRecompute();
1488
- else if (t instanceof Q)
1489
- t.debugRerun();
1490
- else
1491
- throw new x("Observable is not supported");
1492
- }
1493
- }
1494
- })), this._pendingChanges = null, this._changeThrottler = new Gt(), this._fullState = {}, this._flushUpdates = () => {
1495
- this._pendingChanges !== null && (this._channel.api.notifications.handleChange(this._pendingChanges, !1), this._pendingChanges = null);
1496
- }, R.enable();
1497
- }
1498
- _handleChange(e) {
1499
- Ge(this._fullState, e), this._pendingChanges === null ? this._pendingChanges = e : Pe(this._pendingChanges, e), this._changeThrottler.throttle(this._flushUpdates, 10);
1500
- }
1501
- _getDeclarationId(e, t) {
1502
- if (!t)
1503
- return -1;
1504
- let n = this._declarations.get(t.id);
1505
- return n === void 0 && (n = {
1506
- id: this._declarationId++,
1507
- type: e,
1508
- url: t.fileName,
1509
- line: t.line,
1510
- column: t.column
1511
- }, this._declarations.set(t.id, n), this._handleChange({ decls: { [n.id]: n } })), n.id;
1512
- }
1513
- handleObservableCreated(e, t) {
1514
- const r = {
1515
- declarationId: this._getDeclarationId("observable/value", t),
1516
- instanceId: this._instanceId++,
1517
- listenerCount: 0,
1518
- lastValue: void 0,
1519
- updateCount: 0,
1520
- changedObservables: /* @__PURE__ */ new Set()
1521
- };
1522
- this._instanceInfos.set(e, r);
1523
- }
1524
- handleOnListenerCountChanged(e, t) {
1525
- const n = this._getObservableInfo(e);
1526
- if (n) {
1527
- if (n.listenerCount === 0 && t > 0) {
1528
- const r = e instanceof y ? "observable/derived" : "observable/value";
1529
- this._aliveInstances.set(n.instanceId, e), this._handleChange({
1530
- instances: {
1531
- [n.instanceId]: {
1532
- instanceId: n.instanceId,
1533
- declarationId: n.declarationId,
1534
- formattedValue: n.lastValue,
1535
- type: r,
1536
- name: e.debugName
1537
- }
1538
- }
1539
- });
1540
- } else n.listenerCount > 0 && t === 0 && (this._handleChange({
1541
- instances: { [n.instanceId]: null }
1542
- }), this._aliveInstances.delete(n.instanceId));
1543
- n.listenerCount = t;
1544
- }
1545
- }
1546
- handleObservableUpdated(e, t) {
1547
- if (e instanceof y) {
1548
- this._handleDerivedRecomputed(e, t);
1549
- return;
1550
- }
1551
- const n = this._getObservableInfo(e);
1552
- n && t.didChange && (n.lastValue = T(t.newValue, 30), n.listenerCount > 0 && this._handleChange({
1553
- instances: { [n.instanceId]: { formattedValue: n.lastValue } }
1554
- }));
1555
- }
1556
- handleAutorunCreated(e, t) {
1557
- const r = {
1558
- declarationId: this._getDeclarationId("autorun", t),
1559
- instanceId: this._instanceId++,
1560
- updateCount: 0,
1561
- changedObservables: /* @__PURE__ */ new Set()
1562
- };
1563
- this._instanceInfos.set(e, r), this._aliveInstances.set(r.instanceId, e), r && this._handleChange({
1564
- instances: {
1565
- [r.instanceId]: {
1566
- instanceId: r.instanceId,
1567
- declarationId: r.declarationId,
1568
- runCount: 0,
1569
- type: "autorun",
1570
- name: e.debugName
1571
- }
1572
- }
1573
- });
1574
- }
1575
- handleAutorunDisposed(e) {
1576
- const t = this._getAutorunInfo(e);
1577
- t && (this._handleChange({
1578
- instances: { [t.instanceId]: null }
1579
- }), this._instanceInfos.delete(e), this._aliveInstances.delete(t.instanceId));
1580
- }
1581
- handleAutorunDependencyChanged(e, t, n) {
1582
- const r = this._getAutorunInfo(e);
1583
- r && r.changedObservables.add(t);
1584
- }
1585
- handleAutorunStarted(e) {
1586
- }
1587
- handleAutorunFinished(e) {
1588
- const t = this._getAutorunInfo(e);
1589
- t && (t.changedObservables.clear(), t.updateCount++, this._handleChange({
1590
- instances: { [t.instanceId]: { runCount: t.updateCount } }
1591
- }));
1592
- }
1593
- handleDerivedDependencyChanged(e, t, n) {
1594
- const r = this._getObservableInfo(e);
1595
- r && r.changedObservables.add(t);
1596
- }
1597
- _handleDerivedRecomputed(e, t) {
1598
- const n = this._getObservableInfo(e);
1599
- if (!n)
1600
- return;
1601
- const r = T(t.newValue, 30);
1602
- n.updateCount++, n.changedObservables.clear(), n.lastValue = r, n.listenerCount > 0 && this._handleChange({
1603
- instances: { [n.instanceId]: { formattedValue: r, recomputationCount: n.updateCount } }
1604
- });
1605
- }
1606
- handleDerivedCleared(e) {
1607
- const t = this._getObservableInfo(e);
1608
- t && (t.lastValue = void 0, t.changedObservables.clear(), t.listenerCount > 0 && this._handleChange({
1609
- instances: {
1610
- [t.instanceId]: {
1611
- formattedValue: void 0
1612
- }
1613
- }
1614
- }));
1615
- }
1616
- handleBeginTransaction(e) {
1617
- this._activeTransactions.add(e);
1618
- }
1619
- handleEndTransaction(e) {
1620
- this._activeTransactions.delete(e);
1621
- }
1622
- }
1623
- M._instance = void 0;
1624
- function Wt(s, e) {
1625
- const t = (e == null ? void 0 : e.debugNamePostProcessor) ?? ((i) => i), n = w.from(s, t);
1626
- return n ? We(n, 0, /* @__PURE__ */ new Set()).trim() : "";
1627
- }
1628
- function We(s, e, t) {
1629
- const n = " ".repeat(e), r = [];
1630
- if (t.has(s.sourceObj))
1631
- return r.push(`${n}* ${s.type} ${s.name} (already listed)`), r.join(`
1632
- `);
1633
- if (t.add(s.sourceObj), r.push(`${n}* ${s.type} ${s.name}:`), r.push(`${n} value: ${T(s.value, 50)}`), r.push(`${n} state: ${s.state}`), s.dependencies.length > 0) {
1634
- r.push(`${n} dependencies:`);
1635
- for (const o of s.dependencies)
1636
- r.push(We(o, e + 1, t));
1637
- }
1638
- return r.join(`
1639
- `);
1640
- }
1641
- class w {
1642
- static from(e, t) {
1643
- if (e instanceof Q) {
1644
- const n = e.debugGetState();
1645
- return new w(e, t(e.debugName), "autorun", void 0, n.stateStr, Array.from(n.dependencies).map((r) => w.from(r, t) || w.unknown(r)));
1646
- } else if (e instanceof y) {
1647
- const n = e.debugGetState();
1648
- return new w(e, t(e.debugName), "derived", n.value, n.stateStr, Array.from(n.dependencies).map((r) => w.from(r, t) || w.unknown(r)));
1649
- } else if (e instanceof ee) {
1650
- const n = e.debugGetState();
1651
- return new w(e, t(e.debugName), "observableValue", n.value, "upToDate", []);
1652
- } else if (e instanceof k) {
1653
- const n = e.debugGetState();
1654
- return new w(e, t(e.debugName), "fromEvent", n.value, n.hasValue ? "upToDate" : "initial", []);
1655
- }
1656
- }
1657
- static unknown(e) {
1658
- return new w(e, "(unknown)", "unknown", void 0, "unknown", []);
1659
- }
1660
- constructor(e, t, n, r, i, o) {
1661
- this.sourceObj = e, this.name = t, this.type = n, this.value = r, this.state = i, this.dependencies = o;
1662
- }
1663
- }
1664
- Rt(Wt);
1665
- _t(Ft);
1666
- Be(M.getInstance());
1667
- class qe {
1668
- constructor() {
1669
- c(this, "_fixtures", _(this, /* @__PURE__ */ new Map()));
1670
- /** Observable root of the fixture tree */
1671
- c(this, "root", j(this, (e) => {
1672
- const t = this._fixtures.read(e);
1673
- return re(t);
1674
- }));
1675
- }
1676
- /**
1677
- * Registers a fixture file.
1678
- * @param path The file path (e.g., 'components/Button.fixture.tsx')
1679
- * @param fixtureExport The exported fixture object
1680
- */
1681
- register(e, t) {
1682
- const n = new Map(this._fixtures.get());
1683
- n.set(e, t), this._fixtures.set(n, void 0);
1684
- }
1685
- /**
1686
- * Unregisters a fixture file.
1687
- * @param path The file path to remove
1688
- */
1689
- unregister(e) {
1690
- const t = new Map(this._fixtures.get());
1691
- t.delete(e) && this._fixtures.set(t, void 0);
1692
- }
1693
- /**
1694
- * Clears all registered fixtures.
1695
- */
1696
- clear() {
1697
- this._fixtures.set(/* @__PURE__ */ new Map(), void 0);
1698
- }
1699
- /**
1700
- * Gets a node by path.
1701
- */
1702
- getNode(e, t) {
1703
- const n = this.root.read(e);
1704
- return ve(n, t);
1705
- }
1706
- /**
1707
- * Gets a component by path (non-reactive, for use in preview iframe).
1708
- * @param path Array of path segments (e.g., ['Button', 'Primary'])
1709
- */
1710
- getComponentByPath(e) {
1711
- const t = this._fixtures.get(), n = re(t), r = ve(n, e);
1712
- return r == null ? void 0 : r.component;
1713
- }
1714
- }
1715
- class Zn {
1716
- constructor(e, t) {
1717
- c(this, "sessionId", Math.random().toString(36).slice(2));
1718
- c(this, "_updateVersion", 0);
1719
- c(this, "_root");
1720
- c(this, "_fixtureModules");
1721
- c(this, "_currentDisposable");
1722
- c(this, "_currentContainer");
1723
- this._containerElement = e, this._fixtureModules = t, this._root = this._buildRegistry(), this._installGlobalApi();
1724
- const n = this._flattenFixtures(this._root).length;
1725
- console.log("[cli] CLI entry initialized, sessionId:", this.sessionId, "version:", this._updateVersion, "fixtures:", n);
1726
- }
1727
- get updateVersion() {
1728
- return this._updateVersion;
1729
- }
1730
- updateFixtures(e) {
1731
- this._fixtureModules = e, this._root = this._buildRegistry(), this._updateVersion++;
1732
- const t = this._flattenFixtures(this._root).length;
1733
- console.log("[cli] Registry rebuilt, version:", this._updateVersion, "fixtures:", t);
1734
- }
1735
- bumpVersion() {
1736
- this._updateVersion++, console.log("[cli] Version bumped:", this._updateVersion);
1737
- }
1738
- listFixtures() {
1739
- return this._flattenFixtures(this._root);
1740
- }
1741
- async renderFixture(e) {
1742
- const t = this._findFixtureNode(this._root, e);
1743
- if (!t || !t.component)
1744
- throw new Error("Fixture not found: " + e);
1745
- this._currentDisposable && (this._currentDisposable.dispose(), this._currentDisposable = void 0), this._currentContainer && (this._currentContainer.remove(), this._currentContainer = void 0);
1746
- const n = document.createElement("div");
1747
- n.style.display = "inline-block", this._containerElement.appendChild(n), this._currentContainer = n;
1748
- const r = t.component, i = ht(r.properties);
1749
- let o = n;
1750
- if (r.isolation === "shadow-dom") {
1751
- const l = n.attachShadow({ mode: "open" });
1752
- o = document.createElement("div"), l.appendChild(o);
1753
- }
1754
- const d = r.render(o, i);
1755
- this._currentDisposable = d && typeof d == "object" && "dispose" in d ? d : void 0, await new Promise((l) => requestAnimationFrame(() => requestAnimationFrame(() => l())));
1756
- }
1757
- _buildRegistry() {
1758
- const e = /* @__PURE__ */ new Map();
1759
- for (const [t, n] of Object.entries(this._fixtureModules)) {
1760
- const r = n.default;
1761
- r && typeof r == "object" && e.set(t, r);
1762
- }
1763
- return re(e);
1764
- }
1765
- _flattenFixtures(e, t = []) {
1766
- const n = [];
1767
- e.type === "component" && n.push({ fixtureId: e.id, fixtureName: e.name, groupPath: t });
1768
- for (const r of e.children ?? []) {
1769
- const i = e.id ? [...t, e.name] : t;
1770
- n.push(...this._flattenFixtures(r, i));
1771
- }
1772
- return n;
1773
- }
1774
- _findFixtureNode(e, t) {
1775
- if (e.id === t) return e;
1776
- for (const n of e.children ?? []) {
1777
- const r = this._findFixtureNode(n, t);
1778
- if (r) return r;
1779
- }
1780
- }
1781
- _installGlobalApi() {
1782
- window.__componentExplorerCli__ = {
1783
- sessionId: this.sessionId,
1784
- get updateVersion() {
1785
- return 0;
1786
- },
1787
- listFixtures: () => this.listFixtures(),
1788
- renderFixture: (e) => this.renderFixture(e)
1789
- }, Object.defineProperty(window.__componentExplorerCli__, "updateVersion", {
1790
- get: () => this._updateVersion
1791
- });
1792
- }
1793
- }
1794
- function Ke(s) {
1795
- var e;
1796
- return {
1797
- id: s.id,
1798
- name: s.name,
1799
- type: s.type,
1800
- children: (e = s.children) == null ? void 0 : e.map(Ke),
1801
- component: s.component
1802
- };
1803
- }
1804
- function W(s, e) {
1805
- const {
1806
- storageKey: t,
1807
- defaultValue: n,
1808
- serialize: r = JSON.stringify,
1809
- deserialize: i = JSON.parse
1810
- } = e;
1811
- let o = n;
1812
- try {
1813
- const h = localStorage.getItem(t);
1814
- h !== null && (o = i(h));
1815
- } catch {
1816
- }
1817
- const d = _(s, o), l = d.set.bind(d);
1818
- return d.set = (h, g) => {
1819
- try {
1820
- localStorage.setItem(t, r(h));
1821
- } catch {
1822
- }
1823
- l(h, g);
1824
- }, d;
1825
- }
1826
- class qt extends N({
1827
- registry: f.const(),
1828
- daemonModel: f.const()
1829
- }) {
1830
- constructor() {
1831
- super(...arguments);
1832
- c(this, "leftSidebarVisible", W(this, {
1833
- storageKey: "component-explorer:leftSidebarVisible",
1834
- defaultValue: !0
1835
- }));
1836
- c(this, "rightSidebarVisible", W(this, {
1837
- storageKey: "component-explorer:rightSidebarVisible",
1838
- defaultValue: !0
1839
- }));
1840
- c(this, "isDarkTheme", W(this, {
1841
- storageKey: "component-explorer:isDarkTheme",
1842
- defaultValue: !0
1843
- }));
1844
- c(this, "selectedNodeId", W(this, {
1845
- storageKey: "component-explorer:selectedNodeId",
1846
- defaultValue: void 0
1847
- }));
1848
- c(this, "expandedNodeIds", _(this, /* @__PURE__ */ new Set()));
1849
- c(this, "viewMode", W(this, {
1850
- storageKey: "component-explorer:viewMode",
1851
- defaultValue: "session"
1852
- }));
1853
- /** The explorer's tree derived from the registry */
1854
- c(this, "tree", j(this, (t) => {
1855
- const n = this.props.registry.root.read(t);
1856
- return Ke(n);
1857
- }));
1858
- c(this, "selectedNode", j(this, (t) => {
1859
- const n = this.selectedNodeId.read(t);
1860
- if (!n) return;
1861
- const r = this.tree.read(t);
1862
- return this._findNode(r.children ?? [], n);
1863
- }));
1864
- /** List of preview rows to render based on current selection and view mode */
1865
- c(this, "selectedFixtures", j(this, (t) => {
1866
- const n = this.selectedNode.read(t);
1867
- return n ? this.viewMode.read(t) === "diff" && this.daemonAvailable ? this._collectDiffRows(n, n.name) : this._collectPreviewRows(n, n.name) : [];
1868
- }));
1869
- c(this, "setViewMode", (t) => {
1870
- this.viewMode.set(t, void 0);
1871
- });
1872
- c(this, "navigateToSession", (t) => {
1873
- const n = this.props.daemonModel;
1874
- if (!n) return;
1875
- const r = n.getSessionExplorerUrl(t);
1876
- r && (window.location.href = r);
1877
- });
1878
- c(this, "toggleLeftSidebar", () => {
1879
- this.leftSidebarVisible.set(!this.leftSidebarVisible.get(), void 0);
1880
- });
1881
- c(this, "toggleRightSidebar", () => {
1882
- this.rightSidebarVisible.set(!this.rightSidebarVisible.get(), void 0);
1883
- });
1884
- c(this, "toggleTheme", () => {
1885
- this.isDarkTheme.set(!this.isDarkTheme.get(), void 0);
1886
- });
1887
- c(this, "selectNode", (t) => {
1888
- this.selectedNodeId.set(t, void 0);
1889
- });
1890
- c(this, "toggleNodeExpanded", (t) => {
1891
- const n = this.expandedNodeIds.get(), r = new Set(n);
1892
- r.has(t) ? r.delete(t) : r.add(t), this.expandedNodeIds.set(r, void 0);
1893
- });
1894
- }
1895
- get daemonAvailable() {
1896
- return this.props.daemonModel !== void 0;
1897
- }
1898
- get daemon() {
1899
- return this.props.daemonModel;
1900
- }
1901
- isNodeExpanded(t, n) {
1902
- return this.expandedNodeIds.read(n).has(t);
1903
- }
1904
- _findNode(t, n) {
1905
- for (const r of t) {
1906
- if (r.id === n) return r;
1907
- if (r.children) {
1908
- const i = this._findNode(r.children, n);
1909
- if (i) return i;
1910
- }
1911
- }
1912
- }
1913
- _collectPreviewRows(t, n) {
1914
- if (t.type === "component" && t.component)
1915
- return [{
1916
- type: "single",
1917
- fixture: {
1918
- id: t.id,
1919
- name: t.name,
1920
- path: n,
1921
- component: t.component
1922
- }
1923
- }];
1924
- if (t.type === "variants") {
1925
- const i = [];
1926
- for (const o of t.children ?? [])
1927
- o.type === "component" && o.component && i.push({
1928
- id: o.id,
1929
- name: o.name,
1930
- path: `${n} / ${o.name}`,
1931
- component: o.component
1932
- });
1933
- return i.length > 0 ? [{
1934
- type: "variants",
1935
- id: t.id,
1936
- name: t.name,
1937
- path: n,
1938
- fixtures: i
1939
- }] : [];
1940
- }
1941
- const r = [];
1942
- for (const i of t.children ?? []) {
1943
- const o = n ? `${n} / ${i.name}` : i.name;
1944
- r.push(...this._collectPreviewRows(i, o));
1945
- }
1946
- return r;
1947
- }
1948
- /**
1949
- * In diff mode: fixtures become screenshot comparison items showing current vs baseline.
1950
- * Variants become comparison groups.
1951
- */
1952
- _collectDiffRows(t, n) {
1953
- if (t.type === "component")
1954
- return [{
1955
- type: "screenshot-comparison",
1956
- id: t.id,
1957
- name: t.name,
1958
- path: n,
1959
- items: [{
1960
- fixtureId: t.id,
1961
- name: t.name,
1962
- path: n
1963
- }]
1964
- }];
1965
- if (t.type === "variants") {
1966
- const i = [];
1967
- for (const o of t.children ?? [])
1968
- o.type === "component" && i.push({
1969
- fixtureId: o.id,
1970
- name: o.name,
1971
- path: `${n} / ${o.name}`
1972
- });
1973
- return i.length > 0 ? [{
1974
- type: "screenshot-comparison",
1975
- id: t.id,
1976
- name: t.name,
1977
- path: n,
1978
- items: i
1979
- }] : [];
1980
- }
1981
- const r = [];
1982
- for (const i of t.children ?? []) {
1983
- const o = n ? `${n} / ${i.name}` : i.name;
1984
- r.push(...this._collectDiffRows(i, o));
1985
- }
1986
- return r;
1987
- }
1988
- }
1989
- const u = {
1990
- container: {
1991
- display: "flex",
1992
- flexDirection: "row",
1993
- height: "100%",
1994
- width: "100%",
1995
- fontFamily: "var(--vscode-font-family)",
1996
- fontSize: "var(--vscode-font-size)",
1997
- color: "var(--vscode-foreground)",
1998
- backgroundColor: "var(--vscode-editor-background)"
1999
- },
2000
- centerArea: {
2001
- display: "flex",
2002
- flexDirection: "column",
2003
- flex: 1,
2004
- overflow: "hidden"
2005
- },
2006
- titleBar: {
2007
- display: "flex",
2008
- alignItems: "center",
2009
- justifyContent: "space-between",
2010
- height: "35px",
2011
- minHeight: "35px",
2012
- padding: "0 10px",
2013
- backgroundColor: "var(--vscode-titleBar-activeBackground)",
2014
- color: "var(--vscode-titleBar-activeForeground)",
2015
- borderBottom: "1px solid var(--vscode-titleBar-border, var(--vscode-panel-border))"
2016
- },
2017
- titleBarSection: {
2018
- display: "flex",
2019
- alignItems: "center",
2020
- gap: "2px"
2021
- },
2022
- titleBarCenter: {
2023
- display: "flex",
2024
- alignItems: "center",
2025
- gap: "4px",
2026
- fontSize: "13px",
2027
- fontWeight: 400
2028
- },
2029
- titleBarButton: {
2030
- display: "flex",
2031
- alignItems: "center",
2032
- justifyContent: "center",
2033
- width: "28px",
2034
- height: "28px",
2035
- border: "none",
2036
- background: "transparent",
2037
- color: "var(--vscode-titleBar-activeForeground)",
2038
- cursor: "pointer",
2039
- borderRadius: "4px"
2040
- },
2041
- titleBarButtonHover: {
2042
- backgroundColor: "var(--vscode-toolbar-hoverBackground)"
2043
- },
2044
- titleBarButtonActive: {
2045
- backgroundColor: "var(--vscode-toolbar-activeBackground)",
2046
- color: "var(--vscode-focusBorder)"
2047
- },
2048
- sidebar: {
2049
- display: "flex",
2050
- flexDirection: "column",
2051
- width: "260px",
2052
- minWidth: "200px",
2053
- backgroundColor: "var(--vscode-sideBar-background)",
2054
- borderRight: "1px solid var(--vscode-titleBar-border, var(--vscode-panel-border))"
2055
- },
2056
- sidebarRight: {
2057
- borderRight: "none",
2058
- borderLeft: "1px solid var(--vscode-titleBar-border, var(--vscode-panel-border))"
2059
- },
2060
- sidebarHeader: {
2061
- display: "flex",
2062
- alignItems: "center",
2063
- height: "35px",
2064
- minHeight: "35px",
2065
- padding: "0 12px",
2066
- fontSize: "11px",
2067
- fontWeight: 700,
2068
- textTransform: "uppercase",
2069
- letterSpacing: "0.04em",
2070
- color: "var(--vscode-titleBar-activeForeground)",
2071
- backgroundColor: "var(--vscode-titleBar-activeBackground)",
2072
- borderBottom: "1px solid var(--vscode-titleBar-border, var(--vscode-panel-border))"
2073
- },
2074
- sidebarContent: {
2075
- flex: 1,
2076
- overflow: "auto",
2077
- padding: "4px 0"
2078
- },
2079
- treeItem: {
2080
- display: "flex",
2081
- alignItems: "center",
2082
- height: "22px",
2083
- paddingRight: "8px",
2084
- cursor: "pointer",
2085
- userSelect: "none"
2086
- },
2087
- treeItemSelected: {
2088
- backgroundColor: "var(--vscode-list-activeSelectionBackground)",
2089
- color: "var(--vscode-list-activeSelectionForeground)"
2090
- },
2091
- treeItemHover: {
2092
- backgroundColor: "var(--vscode-list-hoverBackground)"
2093
- },
2094
- treeItemChevron: {
2095
- display: "flex",
2096
- alignItems: "center",
2097
- justifyContent: "center",
2098
- width: "16px",
2099
- height: "16px",
2100
- color: "var(--vscode-foreground)",
2101
- opacity: 0.8,
2102
- cursor: "pointer"
2103
- },
2104
- treeItemChevronPlaceholder: {
2105
- width: "16px"
2106
- },
2107
- treeItemIcon: {
2108
- display: "flex",
2109
- alignItems: "center",
2110
- justifyContent: "center",
2111
- width: "16px",
2112
- height: "16px",
2113
- marginRight: "4px"
2114
- },
2115
- treeItemLabel: {
2116
- flex: 1,
2117
- overflow: "hidden",
2118
- textOverflow: "ellipsis",
2119
- whiteSpace: "nowrap",
2120
- fontSize: "13px"
2121
- },
2122
- treeItemCount: {
2123
- marginLeft: "8px",
2124
- fontSize: "11px",
2125
- color: "var(--vscode-descriptionForeground)"
2126
- },
2127
- mainContent: {
2128
- flex: 1,
2129
- display: "flex",
2130
- alignItems: "center",
2131
- justifyContent: "center",
2132
- backgroundColor: "var(--vscode-editor-background)",
2133
- color: "var(--vscode-descriptionForeground)",
2134
- fontSize: "14px"
2135
- },
2136
- propertiesPanel: {
2137
- padding: "12px"
2138
- },
2139
- propertyRow: {
2140
- marginBottom: "12px"
2141
- },
2142
- propertyLabel: {
2143
- fontSize: "12px",
2144
- color: "var(--vscode-foreground)",
2145
- marginBottom: "4px"
2146
- },
2147
- propertyDescription: {
2148
- fontSize: "11px",
2149
- color: "var(--vscode-descriptionForeground)",
2150
- marginTop: "2px"
2151
- },
2152
- propertyInput: {
2153
- width: "100%",
2154
- height: "26px",
2155
- padding: "0 8px",
2156
- fontSize: "13px",
2157
- color: "var(--vscode-input-foreground)",
2158
- backgroundColor: "var(--vscode-input-background)",
2159
- border: "1px solid var(--vscode-input-border, transparent)",
2160
- borderRadius: "2px",
2161
- outline: "none",
2162
- boxSizing: "border-box"
2163
- },
2164
- propertySelect: {
2165
- width: "100%",
2166
- height: "26px",
2167
- padding: "0 8px",
2168
- fontSize: "13px",
2169
- color: "var(--vscode-dropdown-foreground)",
2170
- backgroundColor: "var(--vscode-dropdown-background)",
2171
- border: "1px solid var(--vscode-dropdown-border)",
2172
- borderRadius: "2px",
2173
- outline: "none",
2174
- boxSizing: "border-box",
2175
- cursor: "pointer"
2176
- }
2177
- };
2178
- function pe(...s) {
2179
- return Object.assign({}, ...s.filter(Boolean));
2180
- }
2181
- class Kt extends N({
2182
- active: f()
2183
- }) {
2184
- constructor() {
2185
- super(...arguments);
2186
- c(this, "isHovered", _(this, !1));
2187
- c(this, "setHovered", (t) => {
2188
- this.isHovered.set(t, void 0);
2189
- });
2190
- }
2191
- get active() {
2192
- return this.props.active;
2193
- }
2194
- }
2195
- const se = V(
2196
- Kt,
2197
- {
2198
- onClick: f.const(),
2199
- title: f.const(),
2200
- children: f.const()
2201
- },
2202
- (s, e, t) => {
2203
- const n = e.isHovered.read(s), r = e.active.read(s), i = pe(
2204
- u.titleBarButton,
2205
- n && !r && u.titleBarButtonHover,
2206
- r && u.titleBarButtonActive
2207
- );
2208
- return /* @__PURE__ */ a(
2209
- "button",
2210
- {
2211
- style: i,
2212
- onClick: t.onClick,
2213
- title: t.title,
2214
- onMouseEnter: () => e.setHovered(!0),
2215
- onMouseLeave: () => e.setHovered(!1),
2216
- children: t.children
2217
- }
2218
- );
2219
- }
2220
- ), Jt = ({ style: s }) => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", style: s, children: /* @__PURE__ */ a("path", { d: "M5.7 13.7L5 13l4.6-4.6L5 3.7l.7-.7 5.3 5.4-5.3 5.3z" }) }), Zt = ({ style: s }) => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", style: s, children: /* @__PURE__ */ a("path", { d: "M11 5.5L6 10.5L5.3 9.8L9.6 5.5L5.3 1.2L6 0.5L11 5.5z", transform: "rotate(90 8 5.5)" }) }), Xt = ({ style: s }) => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", style: s, children: /* @__PURE__ */ a("path", { d: "M14.5 2H9l-.35.15-.65.64-.65-.64L7 2H1.5l-.5.5v10l.5.5H7l.35-.15.65-.64.65.64.35.15h5.5l.5-.5v-10l-.5-.5zm-7 10H2V3h5v.86L5.85 5l1.15 1.14V10l-1.15-1.14L7 7.72V12zm6 0H8V7.72l1.15 1.14L8 10V6.14L9.15 5 8 3.86V3h5v9z" }) }), Yt = ({ style: s }) => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", style: s, children: /* @__PURE__ */ a("path", { d: "M14.5 3H7.71l-.85-.85L6.5 2h-5l-.5.5v11l.5.5h13l.5-.5v-10l-.5-.5zm-.5 10H2V6h12v7zm0-8H2V3h4.29l.85.85.36.15H14v1z" }) }), Qt = () => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ a("path", { d: "M2 2v12h12V2H2zm11 11H6V3h7v10zM3 3h2v10H3V3z" }) }), en = () => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ a("path", { d: "M2 2v12h12V2H2zm6 11V3h5v10H8zM3 3h4v10H3V3z" }) }), tn = () => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ a("path", { d: "M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z" }) }), nn = () => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ a("path", { d: "M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z" }) }), sn = D(
2221
- { model: f.const() },
2222
- (s, e) => {
2223
- var d, l;
2224
- const t = e.model, n = t.viewMode.read(s), r = ((d = t.daemon) == null ? void 0 : d.sessions.read(s)) ?? [], i = (l = t.daemon) == null ? void 0 : l.sessionName, o = r.filter((h) => h.name !== i);
2225
- return /* @__PURE__ */ p("div", { style: U.container, children: [
2226
- /* @__PURE__ */ p("div", { style: U.segmentedControl, children: [
2227
- /* @__PURE__ */ a(Se, { label: "Live", mode: "session", active: n === "session", onClick: () => t.setViewMode("session") }),
2228
- /* @__PURE__ */ a(Se, { label: "Diff", mode: "diff", active: n === "diff", onClick: () => t.setViewMode("diff") })
2229
- ] }),
2230
- o.length > 0 && /* @__PURE__ */ a("div", { style: U.sessionLinks, children: o.map((h) => /* @__PURE__ */ p(
2231
- "button",
2232
- {
2233
- style: U.sessionLink,
2234
- onClick: () => t.navigateToSession(h.name),
2235
- title: `Switch to ${h.name} session`,
2236
- children: [
2237
- "→ ",
2238
- h.name
2239
- ]
2240
- },
2241
- h.name
2242
- )) })
2243
- ] });
2244
- }
2245
- );
2246
- function Se({ label: s, mode: e, active: t, onClick: n }) {
2247
- return /* @__PURE__ */ a(
2248
- "button",
2249
- {
2250
- style: t ? U.segmentActive : U.segment,
2251
- onClick: n,
2252
- children: s
2253
- }
2254
- );
2255
- }
2256
- const rn = D(
2257
- {
2258
- model: f.const()
2259
- },
2260
- (s, e) => {
2261
- const t = e.model, n = t.leftSidebarVisible.read(s), r = t.rightSidebarVisible.read(s), i = t.isDarkTheme.read(s), o = t.selectedNode.read(s);
2262
- return /* @__PURE__ */ p("div", { style: u.titleBar, children: [
2263
- /* @__PURE__ */ a("div", { style: u.titleBarSection, children: /* @__PURE__ */ a(
2264
- se,
2265
- {
2266
- active: n,
2267
- onClick: t.toggleLeftSidebar,
2268
- title: "Toggle left sidebar",
2269
- children: /* @__PURE__ */ a(Qt, {})
2270
- }
2271
- ) }),
2272
- /* @__PURE__ */ p("div", { style: u.titleBarCenter, children: [
2273
- t.daemonAvailable && /* @__PURE__ */ a(sn, { model: t }),
2274
- o ? /* @__PURE__ */ p(ce, { children: [
2275
- /* @__PURE__ */ a("span", { style: { color: "var(--vscode-textLink-foreground)" }, children: "<" }),
2276
- /* @__PURE__ */ a("span", { children: o.name }),
2277
- /* @__PURE__ */ a("span", { style: { color: "var(--vscode-textLink-foreground)" }, children: "/>" })
2278
- ] }) : /* @__PURE__ */ a("span", { style: { color: "var(--vscode-descriptionForeground)" }, children: "No component selected" })
2279
- ] }),
2280
- /* @__PURE__ */ p("div", { style: u.titleBarSection, children: [
2281
- /* @__PURE__ */ a(
2282
- se,
2283
- {
2284
- active: !1,
2285
- onClick: t.toggleTheme,
2286
- title: i ? "Switch to light theme" : "Switch to dark theme",
2287
- children: i ? /* @__PURE__ */ a(tn, {}) : /* @__PURE__ */ a(nn, {})
2288
- }
2289
- ),
2290
- /* @__PURE__ */ a(
2291
- se,
2292
- {
2293
- active: r,
2294
- onClick: t.toggleRightSidebar,
2295
- title: "Toggle right sidebar",
2296
- children: /* @__PURE__ */ a(en, {})
2297
- }
2298
- )
2299
- ] })
2300
- ] });
2301
- }
2302
- ), U = {
2303
- container: {
2304
- display: "flex",
2305
- alignItems: "center",
2306
- gap: 8,
2307
- marginRight: 12
2308
- },
2309
- segmentedControl: {
2310
- display: "flex",
2311
- borderRadius: 4,
2312
- overflow: "hidden",
2313
- border: "1px solid var(--vscode-panel-border)"
2314
- },
2315
- segment: {
2316
- padding: "2px 10px",
2317
- fontSize: 11,
2318
- fontWeight: 500,
2319
- border: "none",
2320
- background: "transparent",
2321
- color: "var(--vscode-descriptionForeground)",
2322
- cursor: "pointer"
2323
- },
2324
- segmentActive: {
2325
- padding: "2px 10px",
2326
- fontSize: 11,
2327
- fontWeight: 500,
2328
- border: "none",
2329
- background: "var(--vscode-button-background)",
2330
- color: "var(--vscode-button-foreground)",
2331
- cursor: "pointer"
2332
- },
2333
- sessionLinks: {
2334
- display: "flex",
2335
- gap: 4
2336
- },
2337
- sessionLink: {
2338
- padding: "2px 8px",
2339
- fontSize: 11,
2340
- border: "1px solid var(--vscode-panel-border)",
2341
- borderRadius: 4,
2342
- background: "transparent",
2343
- color: "var(--vscode-textLink-foreground)",
2344
- cursor: "pointer"
2345
- }
2346
- }, Je = D(
2347
- {
2348
- model: f.const(),
2349
- nodes: f.const(),
2350
- depth: f.const()
2351
- },
2352
- (s, e) => /* @__PURE__ */ a(ce, { children: e.nodes.map((t) => /* @__PURE__ */ a(an, { model: e.model, node: t, depth: e.depth }, t.id)) })
2353
- );
2354
- class on extends N({
2355
- model: f.const(),
2356
- node: f.const(),
2357
- depth: f.const()
2358
- }) {
2359
- constructor() {
2360
- super(...arguments);
2361
- c(this, "isHovered", _(this, !1));
2362
- c(this, "setHovered", (t) => {
2363
- this.isHovered.set(t, void 0);
2364
- });
2365
- c(this, "handleClick", () => {
2366
- this.props.model.selectNode(this.props.node.id);
2367
- });
2368
- c(this, "handleDoubleClick", () => {
2369
- this._hasChildren && this.props.model.toggleNodeExpanded(this.props.node.id);
2370
- });
2371
- c(this, "handleChevronClick", (t) => {
2372
- t.stopPropagation(), this.props.model.toggleNodeExpanded(this.props.node.id);
2373
- });
2374
- }
2375
- // Expose props for render function
2376
- get explorerModel() {
2377
- return this.props.model;
2378
- }
2379
- get treeNode() {
2380
- return this.props.node;
2381
- }
2382
- get treeDepth() {
2383
- return this.props.depth;
2384
- }
2385
- get _hasChildren() {
2386
- return !!(this.props.node.children && this.props.node.children.length > 0);
2387
- }
2388
- }
2389
- const an = V(on, {}, (s, e) => {
2390
- const t = e.explorerModel, n = e.treeNode, r = e.treeDepth, i = !!(n.children && n.children.length > 0), o = i ? t.isNodeExpanded(n.id, s) : !1, l = t.selectedNodeId.read(s) === n.id, h = e.isHovered.read(s), g = pe(
2391
- u.treeItem,
2392
- { paddingLeft: `${8 + r * 12}px` },
2393
- l && u.treeItemSelected,
2394
- !l && h && u.treeItemHover
2395
- );
2396
- return /* @__PURE__ */ p(ce, { children: [
2397
- /* @__PURE__ */ p(
2398
- "div",
2399
- {
2400
- style: g,
2401
- onClick: e.handleClick,
2402
- onDoubleClick: e.handleDoubleClick,
2403
- onMouseEnter: () => e.setHovered(!0),
2404
- onMouseLeave: () => e.setHovered(!1),
2405
- children: [
2406
- i ? /* @__PURE__ */ a("div", { style: u.treeItemChevron, onClick: e.handleChevronClick, children: o ? /* @__PURE__ */ a(Zt, {}) : /* @__PURE__ */ a(Jt, {}) }) : /* @__PURE__ */ a("div", { style: u.treeItemChevronPlaceholder }),
2407
- /* @__PURE__ */ a("div", { style: u.treeItemIcon, children: n.type === "folder" ? /* @__PURE__ */ a(Yt, { style: { color: "var(--vscode-symbolIcon-folderForeground)" } }) : /* @__PURE__ */ a(Xt, { style: { color: "#deb45b" } }) }),
2408
- /* @__PURE__ */ a("span", { style: u.treeItemLabel, children: n.name }),
2409
- i && /* @__PURE__ */ a("span", { style: u.treeItemCount, children: n.children.length })
2410
- ]
2411
- }
2412
- ),
2413
- i && o && /* @__PURE__ */ a(Je, { model: t, nodes: n.children, depth: r + 1 })
2414
- ] });
2415
- }), dn = D(
2416
- {
2417
- model: f.const()
2418
- },
2419
- (s, e) => {
2420
- const t = e.model.tree.read(s);
2421
- return /* @__PURE__ */ p("div", { style: u.sidebar, children: [
2422
- /* @__PURE__ */ a("div", { style: u.sidebarHeader, children: "Explorer" }),
2423
- /* @__PURE__ */ a("div", { style: u.sidebarContent, children: /* @__PURE__ */ a(Je, { model: e.model, nodes: t.children ?? [], depth: 0 }) })
2424
- ] });
2425
- }
2426
- );
2427
- class ln extends N({}) {
2428
- constructor() {
2429
- super(...arguments);
2430
- c(this, "checked", _(this, !1));
2431
- c(this, "toggle", () => {
2432
- this.checked.set(!this.checked.get(), void 0);
2433
- });
2434
- }
2435
- }
2436
- const cn = V(ln, {}, (s, e) => {
2437
- const t = e.checked.read(s), n = {
2438
- position: "relative",
2439
- width: "36px",
2440
- height: "18px",
2441
- backgroundColor: t ? "var(--vscode-button-background)" : "var(--vscode-input-background)",
2442
- borderRadius: "9px",
2443
- cursor: "pointer",
2444
- transition: "background-color 0.2s",
2445
- border: "1px solid var(--vscode-input-border, transparent)"
2446
- }, r = {
2447
- position: "absolute",
2448
- top: "2px",
2449
- left: t ? "18px" : "2px",
2450
- width: "12px",
2451
- height: "12px",
2452
- backgroundColor: "var(--vscode-foreground)",
2453
- borderRadius: "50%",
2454
- transition: "left 0.2s"
2455
- };
2456
- return /* @__PURE__ */ a("div", { style: n, onClick: e.toggle, children: /* @__PURE__ */ a("div", { style: r }) });
2457
- }), hn = D(
2458
- {
2459
- node: f.const()
2460
- },
2461
- (s, e) => e.node.type !== "component" ? /* @__PURE__ */ a("div", { style: { padding: "12px", color: "var(--vscode-descriptionForeground)", fontSize: "12px" }, children: "Select a component (not a folder) to view its properties" }) : /* @__PURE__ */ p("div", { style: u.propertiesPanel, children: [
2462
- /* @__PURE__ */ p("div", { style: u.propertyRow, children: [
2463
- /* @__PURE__ */ p("div", { style: u.propertyLabel, children: [
2464
- "children",
2465
- /* @__PURE__ */ a("span", { style: { color: "var(--vscode-descriptionForeground)" }, children: " : string" })
2466
- ] }),
2467
- /* @__PURE__ */ a(
2468
- "input",
2469
- {
2470
- type: "text",
2471
- style: u.propertyInput,
2472
- defaultValue: "Click me",
2473
- placeholder: "Enter text..."
2474
- }
2475
- ),
2476
- /* @__PURE__ */ a("div", { style: u.propertyDescription, children: "Button text content" })
2477
- ] }),
2478
- /* @__PURE__ */ p("div", { style: u.propertyRow, children: [
2479
- /* @__PURE__ */ p("div", { style: u.propertyLabel, children: [
2480
- "variant",
2481
- /* @__PURE__ */ a("span", { style: { color: "var(--vscode-descriptionForeground)" }, children: " : select" })
2482
- ] }),
2483
- /* @__PURE__ */ p("select", { style: u.propertySelect, defaultValue: "default", children: [
2484
- /* @__PURE__ */ a("option", { value: "default", children: "default" }),
2485
- /* @__PURE__ */ a("option", { value: "primary", children: "primary" }),
2486
- /* @__PURE__ */ a("option", { value: "secondary", children: "secondary" }),
2487
- /* @__PURE__ */ a("option", { value: "destructive", children: "destructive" })
2488
- ] }),
2489
- /* @__PURE__ */ a("div", { style: u.propertyDescription, children: "Visual style variant" })
2490
- ] }),
2491
- /* @__PURE__ */ p("div", { style: u.propertyRow, children: [
2492
- /* @__PURE__ */ p("div", { style: u.propertyLabel, children: [
2493
- "size",
2494
- /* @__PURE__ */ a("span", { style: { color: "var(--vscode-descriptionForeground)" }, children: " : select" })
2495
- ] }),
2496
- /* @__PURE__ */ p("select", { style: u.propertySelect, defaultValue: "default", children: [
2497
- /* @__PURE__ */ a("option", { value: "sm", children: "sm" }),
2498
- /* @__PURE__ */ a("option", { value: "default", children: "default" }),
2499
- /* @__PURE__ */ a("option", { value: "lg", children: "lg" })
2500
- ] }),
2501
- /* @__PURE__ */ a("div", { style: u.propertyDescription, children: "Button size" })
2502
- ] }),
2503
- /* @__PURE__ */ p("div", { style: u.propertyRow, children: [
2504
- /* @__PURE__ */ p("div", { style: u.propertyLabel, children: [
2505
- "disabled",
2506
- /* @__PURE__ */ a("span", { style: { color: "var(--vscode-descriptionForeground)" }, children: " : boolean" })
2507
- ] }),
2508
- /* @__PURE__ */ a(cn, {}),
2509
- /* @__PURE__ */ a("div", { style: u.propertyDescription, children: "Disable the button" })
2510
- ] })
2511
- ] })
2512
- ), un = D(
2513
- {
2514
- selectedNode: f.const()
2515
- },
2516
- (s, e) => /* @__PURE__ */ p("div", { style: pe(u.sidebar, u.sidebarRight), children: [
2517
- /* @__PURE__ */ p("div", { style: u.sidebarHeader, children: [
2518
- /* @__PURE__ */ a("span", { style: { marginRight: "6px", color: "var(--vscode-textLink-foreground)" }, children: "</>" }),
2519
- "Props"
2520
- ] }),
2521
- /* @__PURE__ */ a("div", { style: u.sidebarContent, children: e.selectedNode ? /* @__PURE__ */ a(hn, { node: e.selectedNode }) : /* @__PURE__ */ a("div", { style: { padding: "12px", color: "var(--vscode-descriptionForeground)", fontSize: "12px" }, children: "Select a component to view its properties" }) })
2522
- ] })
2523
- );
2524
- class fn extends N({
2525
- fixture: f.const(),
2526
- compact: f.const()
2527
- }) {
2528
- constructor() {
2529
- super(...arguments);
2530
- c(this, "_containerRef", null);
2531
- c(this, "_shadowRoot", null);
2532
- c(this, "_renderContainer", null);
2533
- c(this, "_disposable", null);
2534
- c(this, "_resizeObserver", null);
2535
- c(this, "measuredWidth", _(this, void 0));
2536
- c(this, "measuredHeight", _(this, void 0));
2537
- c(this, "setContainerRef", (t) => {
2538
- if (t === this._containerRef || (this._cleanup(), this._containerRef = t, !t)) return;
2539
- const n = this.fixture.component;
2540
- n.isolation === "shadow-dom" ? this._renderInShadowDom(t, n) : this._renderDirect(t, n);
2541
- const r = this._renderContainer ?? t;
2542
- this._resizeObserver = new ResizeObserver((i) => {
2543
- for (const o of i) {
2544
- const { width: d, height: l } = o.contentRect;
2545
- l > 0 && (this.measuredWidth.set(Math.round(d), void 0), this.measuredHeight.set(Math.round(l), void 0));
2546
- }
2547
- }), this._resizeObserver.observe(r);
2548
- });
2549
- }
2550
- get fixture() {
2551
- return this.props.fixture;
2552
- }
2553
- get compact() {
2554
- return this.props.compact ?? !1;
2555
- }
2556
- _renderInShadowDom(t, n) {
2557
- if (t.shadowRoot) {
2558
- for (this._shadowRoot = t.shadowRoot; this._shadowRoot.firstChild; )
2559
- this._shadowRoot.removeChild(this._shadowRoot.firstChild);
2560
- this._shadowRoot.adoptedStyleSheets = [];
2561
- } else
2562
- this._shadowRoot = t.attachShadow({ mode: "open" });
2563
- if (n.styles)
2564
- for (const o of n.styles)
2565
- if (o.type === "css") {
2566
- const d = document.createElement("style");
2567
- d.textContent = o.content, this._shadowRoot.appendChild(d);
2568
- } else if (o.type === "url") {
2569
- const d = document.createElement("link");
2570
- d.rel = "stylesheet", d.href = o.href, this._shadowRoot.appendChild(d);
2571
- } else o.type === "adopted" && (this._shadowRoot.adoptedStyleSheets = [
2572
- ...this._shadowRoot.adoptedStyleSheets,
2573
- o.sheet
2574
- ]);
2575
- const r = document.createElement("div");
2576
- r.style.display = "inline-block", this._renderContainer = r, this._shadowRoot.appendChild(r);
2577
- const i = this._getDefaultProps(n);
2578
- this._disposable = n.render(r, i);
2579
- }
2580
- _renderDirect(t, n) {
2581
- this._renderContainer = t;
2582
- const r = this._getDefaultProps(n);
2583
- this._disposable = n.render(t, r);
2584
- }
2585
- _getDefaultProps(t) {
2586
- const n = {};
2587
- for (const r of t.properties)
2588
- n[r.name] = r.defaultValue;
2589
- return n;
2590
- }
2591
- _cleanup() {
2592
- var t;
2593
- this._disposable && (typeof this._disposable == "function" ? this._disposable() : typeof this._disposable.dispose == "function" && this._disposable.dispose()), this._disposable = null, (t = this._resizeObserver) == null || t.disconnect(), this._resizeObserver = null, this._shadowRoot = null, this._renderContainer = null;
2594
- }
2595
- dispose() {
2596
- this._cleanup();
2597
- }
2598
- }
2599
- const Ze = V(
2600
- fn,
2601
- {},
2602
- (s, e) => {
2603
- const t = e.fixture, n = t.component, r = n.displayMode, i = e.measuredWidth.read(s), o = e.measuredHeight.read(s), d = e.compact;
2604
- let l;
2605
- if (r.type === "page") {
2606
- const I = r.viewports[0], S = ct(I);
2607
- l = {
2608
- width: S.width,
2609
- height: S.height,
2610
- overflow: "auto"
2611
- };
2612
- } else
2613
- l = {
2614
- display: "inline-block"
2615
- };
2616
- const h = i && o ? `${i} × ${o}` : "", g = d ? $.wrapperCompact : $.wrapper, b = d ? $.nameCompact : $.name;
2617
- return /* @__PURE__ */ p("div", { style: g, children: [
2618
- /* @__PURE__ */ p("div", { style: $.labelRow, children: [
2619
- /* @__PURE__ */ a("span", { style: b, children: t.name }),
2620
- !d && h && /* @__PURE__ */ a("span", { style: $.dimensions, children: h })
2621
- ] }),
2622
- /* @__PURE__ */ a("div", { style: mn(n.background), children: /* @__PURE__ */ a("div", { ref: e.setContainerRef, style: l }) })
2623
- ] });
2624
- }
2625
- ), L = 8;
2626
- function Xe(s, e) {
2627
- return `
2628
- linear-gradient(45deg, ${e} 25%, transparent 25%),
2629
- linear-gradient(-45deg, ${e} 25%, transparent 25%),
2630
- linear-gradient(45deg, transparent 75%, ${e} 75%),
2631
- linear-gradient(-45deg, transparent 75%, ${e} 75%)
2632
- `;
2633
- }
2634
- const pn = {
2635
- backgroundColor: "#ffffff",
2636
- backgroundImage: Xe("#ffffff", "#e5e5e5")
2637
- }, gn = {
2638
- backgroundColor: "#1e1e1e",
2639
- backgroundImage: Xe("#1e1e1e", "#2d2d2d")
2640
- }, vn = {
2641
- display: "inline-block",
2642
- padding: "12px",
2643
- borderRadius: "4px",
2644
- backgroundSize: `${L * 2}px ${L * 2}px`,
2645
- backgroundPosition: `0 0, 0 ${L}px, ${L}px -${L}px, -${L}px 0`,
2646
- boxShadow: "0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08)"
2647
- };
2648
- function mn(s) {
2649
- const e = s === "dark" ? gn : pn;
2650
- return {
2651
- ...vn,
2652
- backgroundColor: e.backgroundColor,
2653
- backgroundImage: e.backgroundImage
2654
- };
2655
- }
2656
- const $ = {
2657
- wrapper: {
2658
- marginBottom: "32px"
2659
- },
2660
- wrapperCompact: {
2661
- marginBottom: "0"
2662
- },
2663
- labelRow: {
2664
- display: "flex",
2665
- alignItems: "baseline",
2666
- gap: "8px",
2667
- marginBottom: "8px"
2668
- },
2669
- name: {
2670
- fontSize: "12px",
2671
- fontWeight: 500,
2672
- color: "var(--vscode-foreground)"
2673
- },
2674
- nameCompact: {
2675
- fontSize: "11px",
2676
- fontWeight: 500,
2677
- color: "var(--vscode-descriptionForeground)"
2678
- },
2679
- dimensions: {
2680
- fontSize: "11px",
2681
- color: "var(--vscode-descriptionForeground)",
2682
- fontFamily: "var(--vscode-editor-font-family, monospace)"
2683
- }
2684
- };
2685
- class _n extends N({
2686
- fixtureId: f.const(),
2687
- sessionName: f.const(),
2688
- daemon: f.const()
2689
- }) {
2690
- constructor(t) {
2691
- super(t);
2692
- c(this, "screenshot", _(this, { status: "idle" }));
2693
- c(this, "_fetchVersion", 0);
2694
- this._store.add(Le((n) => {
2695
- this.props.daemon.sourceTreeIds.read(n).get(this.props.sessionName) && this._fetchScreenshot();
2696
- }));
2697
- }
2698
- get fixtureId() {
2699
- return this.props.fixtureId;
2700
- }
2701
- async _fetchScreenshot() {
2702
- const t = ++this._fetchVersion;
2703
- this.screenshot.set({ status: "loading" }, void 0);
2704
- try {
2705
- const n = await this.props.daemon.getScreenshot(this.props.sessionName, this.props.fixtureId);
2706
- t === this._fetchVersion && this.screenshot.set({ status: "ready", data: n }, void 0);
2707
- } catch (n) {
2708
- t === this._fetchVersion && this.screenshot.set({ status: "error", message: String(n) }, void 0);
2709
- }
2710
- }
2711
- }
2712
- const we = V(
2713
- _n,
2714
- {},
2715
- (s, e) => {
2716
- const t = e.screenshot.read(s);
2717
- if (t.status === "idle" || t.status === "loading")
2718
- return /* @__PURE__ */ a("div", { style: A.placeholder, children: /* @__PURE__ */ a("div", { style: A.shimmer }) });
2719
- if (t.status === "error")
2720
- return /* @__PURE__ */ a("div", { style: A.error, children: /* @__PURE__ */ a("span", { style: A.errorText, children: "Screenshot failed" }) });
2721
- const { data: n } = t;
2722
- return n.image ? /* @__PURE__ */ a(
2723
- "img",
2724
- {
2725
- src: `data:image/png;base64,${n.image}`,
2726
- style: A.image,
2727
- alt: `Screenshot of ${e.fixtureId}`
2728
- }
2729
- ) : /* @__PURE__ */ a("div", { style: A.placeholder, children: /* @__PURE__ */ a("span", { style: A.hashText, children: n.hash.slice(0, 12) }) });
2730
- }
2731
- ), A = {
2732
- placeholder: {
2733
- minHeight: 80,
2734
- display: "flex",
2735
- alignItems: "center",
2736
- justifyContent: "center",
2737
- backgroundColor: "var(--vscode-editor-background)",
2738
- border: "1px solid var(--vscode-panel-border)",
2739
- borderRadius: 4,
2740
- overflow: "hidden"
2741
- },
2742
- shimmer: {
2743
- width: "100%",
2744
- height: 80,
2745
- background: "linear-gradient(90deg, var(--vscode-editor-background) 25%, var(--vscode-list-hoverBackground) 50%, var(--vscode-editor-background) 75%)",
2746
- backgroundSize: "200% 100%",
2747
- animation: "shimmer 1.5s infinite"
2748
- },
2749
- error: {
2750
- minHeight: 80,
2751
- display: "flex",
2752
- alignItems: "center",
2753
- justifyContent: "center",
2754
- backgroundColor: "var(--vscode-inputValidation-errorBackground)",
2755
- border: "1px solid var(--vscode-inputValidation-errorBorder)",
2756
- borderRadius: 4
2757
- },
2758
- errorText: {
2759
- fontSize: 12,
2760
- color: "var(--vscode-errorForeground)"
2761
- },
2762
- hashText: {
2763
- fontSize: 11,
2764
- color: "var(--vscode-descriptionForeground)",
2765
- fontFamily: "var(--vscode-editor-font-family, monospace)"
2766
- },
2767
- image: {
2768
- maxWidth: "100%",
2769
- display: "block",
2770
- borderRadius: 4,
2771
- border: "1px solid var(--vscode-panel-border)"
2772
- }
2773
- };
2774
- class bn extends N({
2775
- fixtureId: f.const(),
2776
- daemon: f.const(),
2777
- baselineSession: f.const(),
2778
- currentSession: f.const()
2779
- }) {
2780
- constructor(t) {
2781
- super(t);
2782
- c(this, "comparisonStatus", _(this, { status: "loading" }));
2783
- this._store.add(Le((n) => {
2784
- const r = this.props.daemon.sourceTreeIds.read(n), i = r.get(this.props.baselineSession), o = r.get(this.props.currentSession);
2785
- i && o && this._fetchComparison();
2786
- }));
2787
- }
2788
- get fixtureId() {
2789
- return this.props.fixtureId;
2790
- }
2791
- get daemon() {
2792
- return this.props.daemon;
2793
- }
2794
- get baselineSession() {
2795
- return this.props.baselineSession;
2796
- }
2797
- get currentSession() {
2798
- return this.props.currentSession;
2799
- }
2800
- async _fetchComparison() {
2801
- this.comparisonStatus.set({ status: "loading" }, void 0);
2802
- try {
2803
- const t = await this.props.daemon.compare(
2804
- this.props.fixtureId,
2805
- this.props.baselineSession,
2806
- this.props.currentSession
2807
- );
2808
- this.comparisonStatus.set({ status: "ready", match: t.match }, void 0);
2809
- } catch (t) {
2810
- this.comparisonStatus.set({ status: "error", message: String(t) }, void 0);
2811
- }
2812
- }
2813
- }
2814
- const yn = V(
2815
- bn,
2816
- {},
2817
- (s, e) => {
2818
- const t = e.comparisonStatus.read(s), n = t.status === "loading" ? /* @__PURE__ */ a("span", { style: m.badgeLoading, children: "comparing..." }) : t.status === "error" ? /* @__PURE__ */ a("span", { style: m.badgeError, children: "error" }) : t.match ? /* @__PURE__ */ a("span", { style: m.badgeMatch, children: "✓ match" }) : /* @__PURE__ */ a("span", { style: m.badgeChanged, children: "● changed" });
2819
- return /* @__PURE__ */ p("div", { style: m.fixtureRow, children: [
2820
- /* @__PURE__ */ p("div", { style: m.fixtureLabel, children: [
2821
- /* @__PURE__ */ a("span", { style: m.fixtureName, children: e.fixtureId }),
2822
- n
2823
- ] }),
2824
- /* @__PURE__ */ p("div", { style: m.sideBySide, children: [
2825
- /* @__PURE__ */ p("div", { style: m.screenshotColumn, children: [
2826
- /* @__PURE__ */ a("span", { style: m.columnLabel, children: "Current" }),
2827
- /* @__PURE__ */ a(
2828
- we,
2829
- {
2830
- fixtureId: e.fixtureId,
2831
- sessionName: e.currentSession,
2832
- daemon: e.daemon
2833
- }
2834
- )
2835
- ] }),
2836
- /* @__PURE__ */ p("div", { style: m.screenshotColumn, children: [
2837
- /* @__PURE__ */ a("span", { style: m.columnLabel, children: "Baseline" }),
2838
- /* @__PURE__ */ a(
2839
- we,
2840
- {
2841
- fixtureId: e.fixtureId,
2842
- sessionName: e.baselineSession,
2843
- daemon: e.daemon
2844
- }
2845
- )
2846
- ] })
2847
- ] })
2848
- ] });
2849
- }
2850
- ), Cn = D(
2851
- {
2852
- name: f.const(),
2853
- path: f.const(),
2854
- items: f.const(),
2855
- daemon: f.const(),
2856
- baselineSession: f.const(),
2857
- currentSession: f.const()
2858
- },
2859
- (s, e) => /* @__PURE__ */ p("div", { children: [
2860
- /* @__PURE__ */ a("div", { style: m.groupHeader, children: /* @__PURE__ */ a("span", { style: m.groupTitle, children: e.path }) }),
2861
- /* @__PURE__ */ a("div", { style: m.groupContent, children: e.items.map((t) => /* @__PURE__ */ a(
2862
- yn,
2863
- {
2864
- fixtureId: t.fixtureId,
2865
- daemon: e.daemon,
2866
- baselineSession: e.baselineSession,
2867
- currentSession: e.currentSession
2868
- },
2869
- t.fixtureId
2870
- )) })
2871
- ] })
2872
- ), m = {
2873
- groupHeader: {
2874
- marginBottom: 12
2875
- },
2876
- groupTitle: {
2877
- fontSize: 13,
2878
- fontWeight: 500,
2879
- color: "var(--vscode-foreground)"
2880
- },
2881
- groupContent: {
2882
- display: "flex",
2883
- flexDirection: "column",
2884
- gap: 24
2885
- },
2886
- fixtureRow: {
2887
- display: "flex",
2888
- flexDirection: "column",
2889
- gap: 8
2890
- },
2891
- fixtureLabel: {
2892
- display: "flex",
2893
- alignItems: "center",
2894
- gap: 8
2895
- },
2896
- fixtureName: {
2897
- fontSize: 12,
2898
- fontWeight: 500,
2899
- color: "var(--vscode-foreground)"
2900
- },
2901
- sideBySide: {
2902
- display: "flex",
2903
- flexDirection: "row",
2904
- gap: 16
2905
- },
2906
- screenshotColumn: {
2907
- flex: 1,
2908
- display: "flex",
2909
- flexDirection: "column",
2910
- gap: 4,
2911
- minWidth: 0
2912
- },
2913
- columnLabel: {
2914
- fontSize: 11,
2915
- fontWeight: 500,
2916
- color: "var(--vscode-descriptionForeground)",
2917
- textTransform: "uppercase",
2918
- letterSpacing: "0.05em"
2919
- },
2920
- badgeMatch: {
2921
- fontSize: 11,
2922
- color: "var(--vscode-testing-iconPassed)",
2923
- fontWeight: 500
2924
- },
2925
- badgeChanged: {
2926
- fontSize: 11,
2927
- color: "var(--vscode-testing-iconFailed)",
2928
- fontWeight: 500
2929
- },
2930
- badgeLoading: {
2931
- fontSize: 11,
2932
- color: "var(--vscode-descriptionForeground)",
2933
- fontStyle: "italic"
2934
- },
2935
- badgeError: {
2936
- fontSize: 11,
2937
- color: "var(--vscode-errorForeground)",
2938
- fontWeight: 500
2939
- }
2940
- }, Ye = "component-explorer:fixtureHeights", Ie = 500;
2941
- let O = null;
2942
- function Qe() {
2943
- if (O !== null) return O;
2944
- try {
2945
- const s = localStorage.getItem(Ye);
2946
- if (s)
2947
- return O = JSON.parse(s), O;
2948
- } catch {
2949
- }
2950
- return O = {}, O;
2951
- }
2952
- function xn() {
2953
- if (O !== null)
2954
- try {
2955
- const s = Object.entries(O);
2956
- s.length > Ie && (O = Object.fromEntries(s.slice(-Ie))), localStorage.setItem(Ye, JSON.stringify(O));
2957
- } catch {
2958
- }
2959
- }
2960
- function Sn(s, e) {
2961
- const t = Qe();
2962
- t[s] = e, xn();
2963
- }
2964
- function wn() {
2965
- return new Map(Object.entries(Qe()));
2966
- }
2967
- const In = 280, On = 32, ne = 32, Oe = 400, et = "component-explorer:scrollAnchors", Te = 100;
2968
- function tt() {
2969
- try {
2970
- const s = localStorage.getItem(et);
2971
- if (s) return JSON.parse(s);
2972
- } catch {
2973
- }
2974
- return {};
2975
- }
2976
- function Tn(s, e) {
2977
- try {
2978
- const t = tt();
2979
- t[s] = e;
2980
- const n = Object.entries(t), r = n.length > Te ? Object.fromEntries(n.slice(-Te)) : t;
2981
- localStorage.setItem(et, JSON.stringify(r));
2982
- } catch {
2983
- }
2984
- }
2985
- function Rn(s) {
2986
- return tt()[s];
2987
- }
2988
- function nt(s) {
2989
- return s.type === "single" ? s.fixture.id : s.id;
2990
- }
2991
- function kn(s, e) {
2992
- const t = new Array(s.length);
2993
- let n = ne;
2994
- for (let r = 0; r < s.length; r++) {
2995
- const i = e.get(nt(s[r])) ?? In;
2996
- t[r] = { top: n, height: i }, n += i + On;
2997
- }
2998
- return t;
2999
- }
3000
- function Nn(s) {
3001
- if (s.length === 0) return 0;
3002
- const e = s[s.length - 1];
3003
- return e.top + e.height + ne;
3004
- }
3005
- function st(s, e) {
3006
- let t = 0, n = s.length;
3007
- for (; t < n; ) {
3008
- const r = t + n >> 1;
3009
- s[r].top + s[r].height < e ? t = r + 1 : n = r;
3010
- }
3011
- return t;
3012
- }
3013
- function Vn(s, e, t) {
3014
- if (s.length === 0) return { start: 0, end: 0 };
3015
- const n = st(s, e - Oe);
3016
- let r = n;
3017
- const i = e + t + Oe;
3018
- for (; r < s.length && s[r].top < i; )
3019
- r++;
3020
- return { start: n, end: r };
3021
- }
3022
- function Re(s, e) {
3023
- if (s.length === 0) return;
3024
- const t = st(s, e), n = Math.min(t, s.length - 1);
3025
- return {
3026
- rowIndex: n,
3027
- offsetFromViewport: s[n].top - e
3028
- };
3029
- }
3030
- function ke(s, e) {
3031
- return e.rowIndex >= s.length ? 0 : s[e.rowIndex].top - e.offsetFromViewport;
3032
- }
3033
- class Dn extends N({
3034
- model: f.const()
3035
- }) {
3036
- constructor() {
3037
- super(...arguments);
3038
- c(this, "_rowHeights", _(this, wn()));
3039
- c(this, "_scrollTop", _(this, 0));
3040
- c(this, "_viewportHeight", _(this, 0));
3041
- c(this, "_scrollContainerRef", null);
3042
- c(this, "_resizeObserver", null);
3043
- c(this, "_viewportResizeObserver", null);
3044
- c(this, "_currentNodeId");
3045
- c(this, "_scrollSaveTimeout", null);
3046
- c(this, "_suppressScrollHandler", !1);
3047
- c(this, "layout", j(this, (t) => {
3048
- const n = this.explorerModel.selectedFixtures.read(t), r = this._rowHeights.read(t);
3049
- return kn(n, r);
3050
- }));
3051
- c(this, "visibleRowRange", j(this, (t) => {
3052
- const n = this.layout.read(t), r = this._scrollTop.read(t), i = this._viewportHeight.read(t);
3053
- return Vn(n, r, i);
3054
- }));
3055
- c(this, "setScrollContainerRef", (t) => {
3056
- var n;
3057
- this._scrollContainerRef && this._scrollContainerRef.removeEventListener("scroll", this._handleScroll), (n = this._viewportResizeObserver) == null || n.disconnect(), this._scrollContainerRef = t, t && (t.addEventListener("scroll", this._handleScroll, { passive: !0 }), this._viewportHeight.set(t.clientHeight, void 0), this._viewportResizeObserver = new ResizeObserver(([r]) => {
3058
- this._viewportHeight.set(Math.round(r.contentRect.height), void 0);
3059
- }), this._viewportResizeObserver.observe(t), this._restoreScrollPosition());
3060
- });
3061
- c(this, "_handleScroll", () => {
3062
- this._scrollContainerRef && (this._scrollTop.set(this._scrollContainerRef.scrollTop, void 0), !(this._suppressScrollHandler || !this._currentNodeId) && (this._scrollSaveTimeout && clearTimeout(this._scrollSaveTimeout), this._scrollSaveTimeout = setTimeout(() => {
3063
- if (!this._currentNodeId) return;
3064
- const t = this.layout.get(), n = Re(t, this._scrollTop.get());
3065
- n && Tn(this._currentNodeId, n);
3066
- }, 150)));
3067
- });
3068
- c(this, "observeRowElement", (t, n) => {
3069
- t && (this._resizeObserver || (this._resizeObserver = new ResizeObserver((r) => {
3070
- const i = this._rowHeights.get();
3071
- let o;
3072
- for (const d of r) {
3073
- const l = d.target.getAttribute("data-row-id");
3074
- if (!l) continue;
3075
- const h = Math.round(d.contentRect.height);
3076
- h > 0 && i.get(l) !== h && (o || (o = new Map(i)), o.set(l, h), Sn(l, h));
3077
- }
3078
- if (o) {
3079
- const d = this.layout.get(), l = Re(d, this._scrollTop.get());
3080
- if (this._rowHeights.set(o, void 0), l && this._scrollContainerRef) {
3081
- const h = this.layout.get(), g = ke(h, l);
3082
- this._suppressScrollHandler = !0, this._scrollContainerRef.scrollTop = g, this._scrollTop.set(g, void 0), requestAnimationFrame(() => {
3083
- this._suppressScrollHandler = !1;
3084
- });
3085
- }
3086
- }
3087
- })), t.setAttribute("data-row-id", n), this._resizeObserver.observe(t));
3088
- });
3089
- }
3090
- get explorerModel() {
3091
- return this.props.model;
3092
- }
3093
- updateForSelection(t) {
3094
- this._currentNodeId !== t && (this._currentNodeId = t, this._restoreScrollPosition());
3095
- }
3096
- _restoreScrollPosition() {
3097
- if (!this._scrollContainerRef || !this._currentNodeId) return;
3098
- const t = Rn(this._currentNodeId);
3099
- if (!t) return;
3100
- const n = this.layout.get(), r = ke(n, t);
3101
- this._suppressScrollHandler = !0, this._scrollContainerRef.scrollTop = r, this._scrollTop.set(r, void 0), requestAnimationFrame(() => {
3102
- this._suppressScrollHandler = !1;
3103
- });
3104
- }
3105
- dispose() {
3106
- var t, n;
3107
- (t = this._resizeObserver) == null || t.disconnect(), (n = this._viewportResizeObserver) == null || n.disconnect(), this._scrollContainerRef && this._scrollContainerRef.removeEventListener("scroll", this._handleScroll), this._scrollSaveTimeout && clearTimeout(this._scrollSaveTimeout);
3108
- }
3109
- }
3110
- const An = V(
3111
- Dn,
3112
- {},
3113
- (s, e) => {
3114
- const t = e.explorerModel.selectedFixtures.read(s), n = e.explorerModel.selectedNodeId.read(s), r = e.layout.read(s), { start: i, end: o } = e.visibleRowRange.read(s);
3115
- if (e.updateForSelection(n), t.length === 0)
3116
- return /* @__PURE__ */ a("div", { style: P.emptyState, children: /* @__PURE__ */ a("span", { style: P.emptyText, children: "Select a component or folder to preview" }) });
3117
- const d = Nn(r);
3118
- return /* @__PURE__ */ a("div", { ref: e.setScrollContainerRef, style: P.scrollContainer, children: /* @__PURE__ */ a("div", { style: { position: "relative", height: d }, children: t.slice(i, o).map((l, h) => {
3119
- const g = i + h, { top: b } = r[g], I = nt(l);
3120
- return /* @__PURE__ */ a(
3121
- "div",
3122
- {
3123
- ref: (S) => e.observeRowElement(S, I),
3124
- style: { position: "absolute", top: b, left: ne, right: ne },
3125
- children: l.type === "single" ? /* @__PURE__ */ a(Ze, { fixture: l.fixture, compact: !1 }) : l.type === "variants" ? /* @__PURE__ */ a(Bn, { row: l }) : l.type === "screenshot-comparison" && e.explorerModel.daemon ? /* @__PURE__ */ a(
3126
- Cn,
3127
- {
3128
- name: l.name,
3129
- path: l.path,
3130
- items: l.items,
3131
- daemon: e.explorerModel.daemon,
3132
- baselineSession: "baseline",
3133
- currentSession: "current"
3134
- }
3135
- ) : null
3136
- },
3137
- I
3138
- );
3139
- }) }) });
3140
- }
3141
- ), Bn = D(
3142
- { row: f.const() },
3143
- (s, e) => {
3144
- const t = e.row;
3145
- return /* @__PURE__ */ p("div", { children: [
3146
- /* @__PURE__ */ a("div", { style: P.variantsHeader, children: /* @__PURE__ */ a("span", { style: P.variantsTitle, children: t.path }) }),
3147
- /* @__PURE__ */ a("div", { style: P.variantsContent, children: t.fixtures.map((n) => /* @__PURE__ */ a(Ze, { fixture: n, compact: !0 }, n.id)) })
3148
- ] });
3149
- }
3150
- ), P = {
3151
- scrollContainer: {
3152
- flex: 1,
3153
- overflow: "auto",
3154
- backgroundColor: "var(--vscode-editor-background)"
3155
- },
3156
- emptyState: {
3157
- flex: 1,
3158
- display: "flex",
3159
- alignItems: "center",
3160
- justifyContent: "center",
3161
- backgroundColor: "var(--vscode-editor-background)"
3162
- },
3163
- emptyText: {
3164
- color: "var(--vscode-descriptionForeground)",
3165
- fontSize: "14px"
3166
- },
3167
- variantsHeader: {
3168
- marginBottom: "12px"
3169
- },
3170
- variantsTitle: {
3171
- fontSize: "13px",
3172
- fontWeight: 500,
3173
- color: "var(--vscode-foreground)"
3174
- },
3175
- variantsContent: {
3176
- display: "flex",
3177
- flexDirection: "row",
3178
- flexWrap: "wrap",
3179
- gap: "16px"
3180
- }
3181
- }, rt = V(
3182
- qt,
3183
- { daemonModel: f.const() },
3184
- (s, e) => {
3185
- const t = e.leftSidebarVisible.read(s), n = e.rightSidebarVisible.read(s), r = e.isDarkTheme.read(s), i = e.selectedNode.read(s);
3186
- return /* @__PURE__ */ p("div", { className: r ? "vscode-theme default-dark-plus" : "vscode-theme default-light-plus", style: u.container, children: [
3187
- t && /* @__PURE__ */ a(dn, { model: e }),
3188
- /* @__PURE__ */ p("div", { style: u.centerArea, children: [
3189
- /* @__PURE__ */ a(rn, { model: e }),
3190
- /* @__PURE__ */ a(An, { model: e })
3191
- ] }),
3192
- n && /* @__PURE__ */ a(un, { selectedNode: i })
3193
- ] });
3194
- }
3195
- );
3196
- function Mn() {
3197
- const s = new qe();
3198
- return s.register("components/Button.fixture.tsx", J({
3199
- Primary: {
3200
- render: (e) => (e.innerHTML = "<button>Primary Button</button>", { dispose: () => {
3201
- e.innerHTML = "";
3202
- } })
3203
- },
3204
- Icon: {
3205
- render: (e) => (e.innerHTML = "<button>🔔 Icon Button</button>", { dispose: () => {
3206
- e.innerHTML = "";
3207
- } })
3208
- }
3209
- })), s.register("components/Input.fixture.tsx", J({
3210
- Text: {
3211
- render: (e) => (e.innerHTML = '<input type="text" placeholder="Text Input" />', { dispose: () => {
3212
- e.innerHTML = "";
3213
- } })
3214
- },
3215
- Search: {
3216
- render: (e) => (e.innerHTML = '<input type="search" placeholder="Search..." />', { dispose: () => {
3217
- e.innerHTML = "";
3218
- } })
3219
- }
3220
- })), s.register("components/Card.fixture.tsx", J({
3221
- Basic: {
3222
- render: (e) => (e.innerHTML = '<div style="border: 1px solid #ccc; padding: 16px;">Basic Card</div>', { dispose: () => {
3223
- e.innerHTML = "";
3224
- } })
3225
- }
3226
- })), s.register("components/Feedback.fixture.tsx", J({
3227
- Badge: {
3228
- render: (e) => (e.innerHTML = '<span style="background: blue; color: white; padding: 2px 8px; border-radius: 4px;">Badge</span>', { dispose: () => {
3229
- e.innerHTML = "";
3230
- } })
3231
- },
3232
- Alert: {
3233
- render: (e) => (e.innerHTML = '<div style="background: #ffffcc; padding: 8px; border: 1px solid #cc0;">Alert message</div>', { dispose: () => {
3234
- e.innerHTML = "";
3235
- } })
3236
- }
3237
- })), s;
3238
- }
3239
- function Xn() {
3240
- const s = Mn();
3241
- return /* @__PURE__ */ a(rt, { registry: s });
3242
- }
3243
- var Fn = class le {
3244
- constructor(e) {
3245
- this.iterator = e;
3246
- }
3247
- static fromIterable(e) {
3248
- return new le(e[Symbol.asyncIterator]());
3249
- }
3250
- static fromFn(e) {
3251
- return new le(e());
3252
- }
3253
- [Symbol.asyncIterator]() {
3254
- return this.iterator;
3255
- }
3256
- }, En = class extends Error {
3257
- constructor(s, e, t) {
3258
- super(t), this.statusCode = s, this.method = e, this.name = "ApiError";
3259
- }
3260
- }, zn = class {
3261
- constructor(s) {
3262
- c(this, "methods", this._createProxy(""));
3263
- this._request = s;
3264
- }
3265
- _createProxy(s) {
3266
- return new Proxy(() => {
3267
- }, {
3268
- apply: async (e, t, n) => await this._request(s, n[0]),
3269
- get: (e, t) => this._createProxy(`${s}${s ? "/" : ""}${t}`)
3270
- });
3271
- }
3272
- };
3273
- function Hn(s, e) {
3274
- return new zn(async (t, n) => {
3275
- var d;
3276
- const r = await fetch(`${s}/${t}`, {
3277
- method: "POST",
3278
- headers: {
3279
- "Content-Type": "application/json",
3280
- ...(d = e == null ? void 0 : e.getHeaders) == null ? void 0 : d.call(e)
3281
- },
3282
- body: JSON.stringify(n)
3283
- });
3284
- if (r.status !== 200) {
3285
- const l = await r.json().catch(() => null);
3286
- let h;
3287
- throw l && typeof l == "object" && "errorMessage" in l ? h = `${l.errorMessage}` : h = `Error calling API method ${t}: ${JSON.stringify(l)} (Status: ${r.status}, Status Text: ${r.statusText})`, new En(r.status, t, h);
3288
- }
3289
- const i = r.headers.get("Content-Type");
3290
- return i != null && i.startsWith("application/jsonl") ? Fn.fromFn(async function* () {
3291
- var I;
3292
- const l = (I = r.body) == null ? void 0 : I.getReader();
3293
- if (!l)
3294
- return;
3295
- let h = "";
3296
- const g = new TextDecoder("utf-8");
3297
- for (; ; ) {
3298
- const { done: S, value: K } = await l.read();
3299
- if (S)
3300
- break;
3301
- h += g.decode(K, { stream: !0 });
3302
- let E;
3303
- for (; (E = h.indexOf(`
3304
- `)) >= 0; ) {
3305
- const ge = h.slice(0, E).trim();
3306
- h = h.slice(E + 1), ge.length > 0 && (yield JSON.parse(ge));
3307
- }
3308
- }
3309
- const b = h.trim();
3310
- b.length > 0 && (yield JSON.parse(b));
3311
- }) : await r.json();
3312
- });
3313
- }
3314
- class Ln {
3315
- constructor(e) {
3316
- c(this, "_sourceTreeIds", _(this, /* @__PURE__ */ new Map()));
3317
- c(this, "_sessions", _(this, []));
3318
- c(this, "_screenshotCache", /* @__PURE__ */ new Map());
3319
- c(this, "_client");
3320
- c(this, "_eventStreamAbort", null);
3321
- c(this, "sessionName");
3322
- /** Observable map of sessionName → current sourceTreeId */
3323
- c(this, "sourceTreeIds", this._sourceTreeIds);
3324
- /** Observable list of sessions from the daemon */
3325
- c(this, "sessions", this._sessions);
3326
- this.config = e, this.sessionName = e.sessionName, this._client = Hn("/__explorer/daemon-api");
3327
- }
3328
- /**
3329
- * Initializes the model: fetches initial session info and starts listening to events.
3330
- * Call this once after construction.
3331
- */
3332
- async initialize() {
3333
- await this._fetchSessionInfos(), this._startEventStream();
3334
- }
3335
- /**
3336
- * Get a screenshot for a fixture in a session, using cache when available.
3337
- * Cache is keyed on sessionName + fixtureId and invalidated when sourceTreeId changes.
3338
- */
3339
- async getScreenshot(e, t) {
3340
- const n = this._sourceTreeIds.get().get(e);
3341
- if (!n)
3342
- throw new Error(`No sourceTreeId known for session '${e}'`);
3343
- const r = `${e}:${t}`, i = this._screenshotCache.get(r);
3344
- if (i && i.sourceTreeId === n)
3345
- return i.data;
3346
- const o = await this._client.methods.screenshots.take({
3347
- fixtureId: t,
3348
- sessionName: e,
3349
- sourceTreeId: n,
3350
- includeImage: !0
3351
- });
3352
- return this._screenshotCache.set(r, { sourceTreeId: n, data: o }), o;
3353
- }
3354
- /**
3355
- * Compare a fixture across two sessions. Returns match status and hashes (no images).
3356
- */
3357
- async compare(e, t, n) {
3358
- const r = this._sourceTreeIds.get().get(t), i = this._sourceTreeIds.get().get(n);
3359
- if (!r || !i)
3360
- throw new Error("Missing sourceTreeId for sessions");
3361
- return this._client.methods.screenshots.compare({
3362
- fixtureId: e,
3363
- baselineSessionName: t,
3364
- baselineSourceTreeId: r,
3365
- currentSessionName: n,
3366
- currentSourceTreeId: i,
3367
- includeImages: !1
3368
- });
3369
- }
3370
- /**
3371
- * List fixtures from a session.
3372
- */
3373
- async listFixtures(e) {
3374
- const t = this._sourceTreeIds.get().get(e);
3375
- if (!t)
3376
- throw new Error(`No sourceTreeId known for session '${e}'`);
3377
- return this._client.methods.fixtures.list({ sessionName: e, sourceTreeId: t });
3378
- }
3379
- /**
3380
- * Get the explorer URL for a different session (for session switching via full navigation).
3381
- */
3382
- getSessionExplorerUrl(e) {
3383
- const t = this._sessions.get().find((n) => n.name === e);
3384
- if (t)
3385
- return t.serverUrl + "/___explorer";
3386
- }
3387
- dispose() {
3388
- var e;
3389
- (e = this._eventStreamAbort) == null || e.abort(), this._eventStreamAbort = null;
3390
- }
3391
- // ---------------------------------------------------------------------------
3392
- // Private
3393
- // ---------------------------------------------------------------------------
3394
- async _fetchSessionInfos() {
3395
- const e = await this._client.methods.sessions(), t = /* @__PURE__ */ new Map(), n = [];
3396
- for (const r of e)
3397
- t.set(r.name, r.sourceTreeId), n.push({ name: r.name, serverUrl: r.serverUrl });
3398
- this._sourceTreeIds.set(t, void 0), this._sessions.set(n, void 0);
3399
- }
3400
- async _startEventStream() {
3401
- this._eventStreamAbort = new AbortController();
3402
- const e = this._eventStreamAbort.signal;
3403
- try {
3404
- const t = await this._client.methods.events();
3405
- for await (const n of t) {
3406
- if (e.aborted) break;
3407
- this._handleEvent(n);
3408
- }
3409
- } catch (t) {
3410
- e.aborted || (console.error("[DaemonModel] Event stream error:", t), setTimeout(() => {
3411
- e.aborted || this._startEventStream();
3412
- }, 2e3));
3413
- }
3414
- }
3415
- _handleEvent(e) {
3416
- if (e.type === "source-change") {
3417
- const t = new Map(this._sourceTreeIds.get());
3418
- t.set(e.sessionName, e.sourceTreeId), this._sourceTreeIds.set(t, void 0);
3419
- for (const n of this._screenshotCache.keys())
3420
- n.startsWith(`${e.sessionName}:`) && this._screenshotCache.delete(n);
3421
- }
3422
- }
3423
- }
3424
- function $n() {
3425
- return window.__EXPLORER_DAEMON__;
3426
- }
3427
- class Yn {
3428
- constructor(e, t) {
3429
- c(this, "_root");
3430
- c(this, "_registry", new qe());
3431
- c(this, "_daemonModel");
3432
- this._populateRegistry(t), this._daemonModel = this._initializeDaemonModel(), this._root = at(e), this._root.render(dt(rt, { registry: this._registry, daemonModel: this._daemonModel }));
3433
- }
3434
- _initializeDaemonModel() {
3435
- const e = $n();
3436
- if (!e)
3437
- return;
3438
- const t = new Ln(e);
3439
- return t.initialize().catch((n) => {
3440
- console.error("[ExplorerApp] Failed to initialize DaemonModel:", n);
3441
- }), t;
3442
- }
3443
- _populateRegistry(e) {
3444
- this._registry.clear();
3445
- for (const [t, n] of Object.entries(e)) {
3446
- const r = n.default;
3447
- r && typeof r == "object" && this._registry.register(t, r);
3448
- }
3449
- }
3450
- /**
3451
- * Updates the fixtures. The UI will update automatically since the registry is observable.
3452
- */
3453
- updateFixtures(e) {
3454
- this._populateRegistry(e);
3455
- }
3456
- /**
3457
- * No-op for ExplorerApp (only meaningful for CliRuntime).
3458
- * Present so the plugin's HMR wiring can call it polymorphically.
3459
- */
3460
- bumpVersion() {
3461
- }
3462
- /**
3463
- * Unmounts the explorer and cleans up resources.
3464
- */
3465
- dispose() {
3466
- var e;
3467
- (e = this._daemonModel) == null || e.dispose(), this._root.unmount();
3468
- }
3469
- }
1
+ import { _ as r } from "./runtimeVersion-CnnW4nSy.js";
2
+ import { d as s, a as n, b as t, f as u, c as f, r as o, s as d } from "./runtimeVersion-CnnW4nSy.js";
3
+ globalThis._buildInfo = r;
3470
4
  export {
3471
- Zt as ChevronDownIcon,
3472
- Jt as ChevronRightIcon,
3473
- Zn as CliRuntime,
3474
- Xt as ComponentIcon,
3475
- Ln as DaemonModel,
3476
- rt as Explorer,
3477
- Yn as ExplorerApp,
3478
- qt as ExplorerModel,
3479
- Xn as ExplorerWithDefaults,
3480
- qe as FixtureRegistry,
3481
- Yt as FolderIcon,
3482
- dn as LeftSidebar,
3483
- nn as MoonIcon,
3484
- Qt as PanelLeftIcon,
3485
- en as PanelRightIcon,
3486
- un as RightSidebar,
3487
- tn as SunIcon,
3488
- rn as TitleBar,
3489
- se as TitleBarButton,
3490
- an as TreeItem,
3491
- Je as TreeView,
3492
- lt as VIEWPORT_SIZES,
3493
- mt as collectComponents,
3494
- re as createFixtureTree,
3495
- J as defineFixture,
3496
- Kn as defineFixtureGroup,
3497
- Jn as defineFixtureVariants,
3498
- ve as findNodeByPath,
3499
- ht as getDefaultPropertyValues,
3500
- qn as isComponentDefinition,
3501
- ft as isFixtureGroup,
3502
- pt as isFixtureVariants,
3503
- ut as isSingleFixture,
3504
- pe as mergeStyles,
3505
- ct as resolveViewport,
3506
- u as styles,
3507
- Ke as toExplorerTree
5
+ s as defineFixture,
6
+ n as defineFixtureGroup,
7
+ t as defineFixtureVariants,
8
+ u as fixtureGroupBrand,
9
+ f as fixtureVariantsBrand,
10
+ o as runtimeVersion,
11
+ d as singleFixtureBrand
3508
12
  };
3509
13
  //# sourceMappingURL=index.js.map