@vscode/component-explorer 0.2.1-6 → 0.2.1-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/viewer.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var Qo = Object.defineProperty;
2
2
  var Ko = (r, e, o) => e in r ? Qo(r, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[e] = o;
3
3
  var l = (r, e, o) => Ko(r, typeof e != "symbol" ? e + "" : e, o);
4
- import { f as De, c as Ne, s as Ae, S as me, r as ae, _ as Jo } from "./runtimeVersion-BpYdhxdg.js";
5
- import { e as zt, d as Pt, a as Wt, b as $t, g as jt } from "./runtimeVersion-BpYdhxdg.js";
4
+ import { f as De, c as Ne, s as Ae, S as me, r as ae, _ as Jo } from "./runtimeVersion-C3nZZ7xj.js";
5
+ import { e as Pt, d as Wt, a as jt, b as $t, g as Ut } from "./runtimeVersion-C3nZZ7xj.js";
6
6
  import { createRoot as Yo } from "react-dom/client";
7
7
  import * as uo from "react";
8
8
  import { createContext as mo, useReducer as Zo, useState as Xo, useContext as er, useEffect as Ge, createElement as or } from "react";
@@ -17,16 +17,16 @@ function Re(r) {
17
17
  function Ee(r) {
18
18
  return typeof r == "object" && r !== null && Ne in r && r[Ne] === !0 && "_variants" in r && typeof r._variants == "object";
19
19
  }
20
- function Mt(r) {
20
+ function Ot(r) {
21
21
  return Ie(r) ? { success: !0, data: r } : Re(r) ? { success: !0, data: r } : Ee(r) ? { success: !0, data: r } : { success: !1, error: "Value is not a valid fixture export (missing brand symbol or _options/_entries/_variants)" };
22
22
  }
23
- function Ot(r) {
23
+ function Vt(r) {
24
24
  return Ie(r) ? { success: !0, data: r } : { success: !1, error: "Value is not a SingleFixtureExport" };
25
25
  }
26
- function Vt(r) {
26
+ function Lt(r) {
27
27
  return Re(r) ? { success: !0, data: r } : { success: !1, error: "Value is not a FixtureGroupExport" };
28
28
  }
29
- function Lt(r) {
29
+ function Dt(r) {
30
30
  return Ee(r) ? { success: !0, data: r } : { success: !1, error: "Value is not a FixtureVariantsExport" };
31
31
  }
32
32
  function ze(r, e, o, n, t = []) {
@@ -45,7 +45,7 @@ function ze(r, e, o, n, t = []) {
45
45
  render: i.render
46
46
  };
47
47
  }
48
- function Dt(r) {
48
+ function Nt(r) {
49
49
  return typeof r == "object" && r !== null && "render" in r && typeof r.render == "function" && "id" in r && "name" in r;
50
50
  }
51
51
  class M {
@@ -124,7 +124,7 @@ function xo(r, e, o, n = [], t = "", i = []) {
124
124
  s.push(b);
125
125
  const _ = new M(s.join("/"));
126
126
  let y = (g = a.children) == null ? void 0 : g.find(
127
- (v) => v.type === "folder" && v.name === b
127
+ (k) => k.type === "folder" && k.name === b
128
128
  );
129
129
  y || (y = {
130
130
  id: _,
@@ -158,7 +158,7 @@ function xo(r, e, o, n = [], t = "", i = []) {
158
158
  labels: [...o._labels ?? []]
159
159
  }, a.children || (a.children = []), a.children.push(x));
160
160
  for (const [b, _] of Object.entries(o._entries)) {
161
- const y = o._expectedVisualDescriptions, v = y ? typeof y == "string" ? [y] : [...y] : [], C = [...i, ...v];
161
+ const y = o._expectedVisualDescriptions, k = y ? typeof y == "string" ? [y] : [...y] : [], C = [...i, ...k];
162
162
  xo(x, [b], _, s, t, C);
163
163
  }
164
164
  } else if (Ee(o)) {
@@ -171,14 +171,14 @@ function xo(r, e, o, n = [], t = "", i = []) {
171
171
  };
172
172
  a.children || (a.children = []), a.children.push(x);
173
173
  for (const [b, _] of Object.entries(o._variants)) {
174
- const y = o._expectedVisualDescriptions, v = y ? typeof y == "string" ? [y] : [...y] : [], C = [...i, ...v], F = new M([...s, b].join("/")), k = {
174
+ const y = o._expectedVisualDescriptions, k = y ? typeof y == "string" ? [y] : [...y] : [], C = [...i, ...k], F = new M([...s, b].join("/")), v = {
175
175
  id: F,
176
176
  name: b,
177
177
  type: "component",
178
178
  component: ze(_, F.value, b, t, C),
179
179
  labels: [..._._options.labels ?? []]
180
180
  };
181
- x.children.push(k);
181
+ x.children.push(v);
182
182
  }
183
183
  }
184
184
  }
@@ -201,12 +201,12 @@ function ir(r) {
201
201
  e.push(...ir(o));
202
202
  return e;
203
203
  }
204
- let P;
204
+ let z;
205
205
  function ar(r) {
206
- P ? P instanceof $e ? P.loggers.push(r) : P = new $e([P, r]) : P = r;
206
+ z ? z instanceof je ? z.loggers.push(r) : z = new je([z, r]) : z = r;
207
207
  }
208
208
  function B() {
209
- return P;
209
+ return z;
210
210
  }
211
211
  let xe;
212
212
  function cr(r) {
@@ -215,7 +215,7 @@ function cr(r) {
215
215
  function sr(r) {
216
216
  xe && xe(r);
217
217
  }
218
- class $e {
218
+ class je {
219
219
  constructor(e) {
220
220
  this.loggers = e;
221
221
  }
@@ -320,7 +320,7 @@ function dr(r) {
320
320
  id: r
321
321
  };
322
322
  }
323
- class G {
323
+ class A {
324
324
  constructor(e, o, n) {
325
325
  this.owner = e, this.debugNameSource = o, this.referenceFn = n;
326
326
  }
@@ -328,15 +328,15 @@ class G {
328
328
  return lr(e, this);
329
329
  }
330
330
  }
331
- const je = /* @__PURE__ */ new Map(), be = /* @__PURE__ */ new WeakMap();
331
+ const $e = /* @__PURE__ */ new Map(), be = /* @__PURE__ */ new WeakMap();
332
332
  function lr(r, e) {
333
333
  const o = be.get(r);
334
334
  if (o)
335
335
  return o;
336
336
  const n = pr(r, e);
337
337
  if (n) {
338
- let t = je.get(n) ?? 0;
339
- t++, je.set(n, t);
338
+ let t = $e.get(n) ?? 0;
339
+ t++, $e.set(n, t);
340
340
  const i = t === 1 ? n : `${n}#${t}`;
341
341
  return be.set(r, i), i;
342
342
  }
@@ -493,9 +493,9 @@ function wo(r) {
493
493
  dispose: r
494
494
  };
495
495
  }
496
- class $ extends Error {
496
+ class W extends Error {
497
497
  constructor(e) {
498
- super(e || "An unexpected bug occurred."), Object.setPrototypeOf(this, $.prototype);
498
+ super(e || "An unexpected bug occurred."), Object.setPrototypeOf(this, W.prototype);
499
499
  }
500
500
  }
501
501
  function se(r) {
@@ -629,7 +629,7 @@ class j extends Me {
629
629
  // IObserver Implementation
630
630
  beginUpdate(e) {
631
631
  if (this._isUpdating)
632
- throw new $("Cyclic deriveds are not supported yet!");
632
+ throw new W("Cyclic deriveds are not supported yet!");
633
633
  this._updateCount++, this._isUpdating = !0;
634
634
  try {
635
635
  const o = this._updateCount === 1;
@@ -686,7 +686,7 @@ class j extends Me {
686
686
  // IReader Implementation
687
687
  _ensureReaderValid() {
688
688
  if (!this._isReaderValid)
689
- throw new $("The reader object cannot be used outside its compute function!");
689
+ throw new W("The reader object cannot be used outside its compute function!");
690
690
  }
691
691
  readObservable(e) {
692
692
  this._ensureReaderValid(), e.addObserver(this);
@@ -736,17 +736,17 @@ class j extends Me {
736
736
  }
737
737
  }
738
738
  function I(r, e, o = O.ofCaller()) {
739
- return e !== void 0 ? new j(new G(r, void 0, e), e, void 0, void 0, oe, o) : new j(new G(void 0, void 0, r), r, void 0, void 0, oe, o);
739
+ return e !== void 0 ? new j(new A(r, void 0, e), e, void 0, void 0, oe, o) : new j(new A(void 0, void 0, r), r, void 0, void 0, oe, o);
740
740
  }
741
741
  function yr(r, e, o = O.ofCaller()) {
742
- return new j(new G(r.owner, r.debugName, r.debugReferenceFn), e, void 0, r.onLastObserverRemoved, r.equalsFn ?? oe, o);
742
+ return new j(new A(r.owner, r.debugName, r.debugReferenceFn), e, void 0, r.onLastObserverRemoved, r.equalsFn ?? oe, o);
743
743
  }
744
744
  mr(yr);
745
745
  function wr(r, e, o = O.ofCaller()) {
746
746
  let n, t;
747
747
  n = r, t = void 0;
748
748
  let i;
749
- return new j(new G(t, void 0, n), (a) => {
749
+ return new j(new A(t, void 0, n), (a) => {
750
750
  i ? i.clear() : i = new re();
751
751
  const s = n(a);
752
752
  return s && i.add(s), s;
@@ -854,7 +854,7 @@ class Bo {
854
854
  // IReader implementation
855
855
  _ensureNoRunning() {
856
856
  if (!this._isRunning)
857
- throw new $("The reader object cannot be used outside its compute function!");
857
+ throw new W("The reader object cannot be used outside its compute function!");
858
858
  }
859
859
  readObservable(e) {
860
860
  if (this._ensureNoRunning(), this._disposed)
@@ -865,12 +865,12 @@ class Bo {
865
865
  }
866
866
  get store() {
867
867
  if (this._ensureNoRunning(), this._disposed)
868
- throw new $("Cannot access store after dispose");
868
+ throw new W("Cannot access store after dispose");
869
869
  return this._store === void 0 && (this._store = new re()), this._store;
870
870
  }
871
871
  get delayedStore() {
872
872
  if (this._ensureNoRunning(), this._disposed)
873
- throw new $("Cannot access store after dispose");
873
+ throw new W("Cannot access store after dispose");
874
874
  return this._delayedStore === void 0 && (this._delayedStore = new re()), this._delayedStore;
875
875
  }
876
876
  debugGetState() {
@@ -887,7 +887,7 @@ class Bo {
887
887
  }
888
888
  }
889
889
  function _o(r, e = O.ofCaller()) {
890
- return new Bo(new G(void 0, void 0, r), r, void 0, e);
890
+ return new Bo(new A(void 0, void 0, r), r, void 0, e);
891
891
  }
892
892
  function Qe(r) {
893
893
  const e = new Error("BugIndicatingErrorRecovery: " + r);
@@ -940,7 +940,7 @@ class So {
940
940
  }
941
941
  function w(r, e, o = O.ofCaller()) {
942
942
  let n;
943
- return typeof r == "string" ? n = new G(void 0, r, void 0) : n = new G(r, void 0, void 0), new Fo(n, e, oe, o);
943
+ return typeof r == "string" ? n = new A(void 0, r, void 0) : n = new A(r, void 0, void 0), new Fo(n, e, oe, o);
944
944
  }
945
945
  class Fo extends Me {
946
946
  get debugName() {
@@ -986,9 +986,9 @@ class Fo extends Me {
986
986
  }
987
987
  function Ke(...r) {
988
988
  let e, o, n, t;
989
- return r.length === 2 ? [o, n] = r : [e, o, n, t] = r, new W(new G(e, void 0, n), o, n, () => W.globalTransaction, oe, t ?? O.ofCaller());
989
+ return r.length === 2 ? [o, n] = r : [e, o, n, t] = r, new P(new A(e, void 0, n), o, n, () => P.globalTransaction, oe, t ?? O.ofCaller());
990
990
  }
991
- class W extends Me {
991
+ class P extends Me {
992
992
  constructor(e, o, n, t, i, a) {
993
993
  super(a), this._debugNameData = e, this.event = o, this._getValue = n, this._getTransaction = t, this._equalityComparator = i, this._hasValue = !1, this.handleEvent = (s) => {
994
994
  var x;
@@ -1029,14 +1029,14 @@ class W extends Me {
1029
1029
  }
1030
1030
  }
1031
1031
  (function(r) {
1032
- r.Observer = W;
1032
+ r.Observer = P;
1033
1033
  function e(o, n) {
1034
1034
  let t = !1;
1035
- W.globalTransaction === void 0 && (W.globalTransaction = o, t = !0);
1035
+ P.globalTransaction === void 0 && (P.globalTransaction = o, t = !0);
1036
1036
  try {
1037
1037
  n();
1038
1038
  } finally {
1039
- t && (W.globalTransaction = void 0);
1039
+ t && (P.globalTransaction = void 0);
1040
1040
  }
1041
1041
  }
1042
1042
  r.batchEventsGlobally = e;
@@ -1338,7 +1338,7 @@ class H {
1338
1338
  } else if (e instanceof Fo) {
1339
1339
  const n = e.debugGetState();
1340
1340
  return new H(e, o(e.debugName), "observableValue", n.value, "upToDate", []);
1341
- } else if (e instanceof W) {
1341
+ } else if (e instanceof P) {
1342
1342
  const n = e.debugGetState();
1343
1343
  return new H(e, o(e.debugName), "fromEvent", n.value, n.hasValue ? "upToDate" : "initial", []);
1344
1344
  }
@@ -1461,7 +1461,7 @@ class zr {
1461
1461
  function Pr(r) {
1462
1462
  return r[fe] || (r[fe] = mo(void 0)), r[fe];
1463
1463
  }
1464
- function D(r = {}) {
1464
+ function L(r = {}) {
1465
1465
  var e;
1466
1466
  return e = class extends zr {
1467
1467
  }, e._props = r, e;
@@ -1479,8 +1479,8 @@ const Wr = new Dr((r) => {
1479
1479
  e.rendered || e.forceUpdate();
1480
1480
  });
1481
1481
  });
1482
- let $r = 0;
1483
- class jr {
1482
+ let jr = 0;
1483
+ class $r {
1484
1484
  constructor(e, o) {
1485
1485
  this.debugName = e, this.renderFactory = o, this._obsProps = void 0, this.forceUpdate = void 0, this._render = void 0, this._disposable = void 0, this.contextValues = /* @__PURE__ */ new Map(), this.cleanupEffect = () => () => {
1486
1486
  var n;
@@ -1500,7 +1500,7 @@ class jr {
1500
1500
  }
1501
1501
  }
1502
1502
  function Oe(r, e, o) {
1503
- const n = (a) => a + 1, t = () => new jr(r + ++$r, e), i = function(a) {
1503
+ const n = (a) => a + 1, t = () => new $r(r + ++jr, e), i = function(a) {
1504
1504
  const s = Zo(n, 0)[1], d = Xo(t)[0];
1505
1505
  for (const p of o ?? [])
1506
1506
  d.contextValues.set(p, er(p));
@@ -1535,17 +1535,17 @@ function Ur(r) {
1535
1535
  }
1536
1536
  return e;
1537
1537
  }
1538
- function N(r, e, o) {
1538
+ function D(r, e, o) {
1539
1539
  const n = typeof e == "function" ? {} : e, t = typeof e == "function" ? e : o, i = "_props" in r ? r._props : {}, a = Ur({ ...i, ...n }), s = Pr(r), d = [...a, s];
1540
1540
  return Oe("viewWithModel", (p, g) => {
1541
- const f = g(), x = f.get(s), b = "_props" in r ? Z(r._props, (v, C) => v.create((F) => p.read(F)[C], f.get(v._requiredContext))) : {}, _ = x ? { read: () => x, dispose: () => {
1542
- } } : wr((v) => {
1543
- const C = Z(b, (F) => F.read(v));
1541
+ const f = g(), x = f.get(s), b = "_props" in r ? Z(r._props, (k, C) => k.create((F) => p.read(F)[C], f.get(k._requiredContext))) : {}, _ = x ? { read: () => x, dispose: () => {
1542
+ } } : wr((k) => {
1543
+ const C = Z(b, (F) => F.read(k));
1544
1544
  return new r(C);
1545
- }), y = Z(n, (v, C) => v.create((F) => p.read(F)[C], f.get(v._requiredContext)));
1546
- return (v) => {
1547
- const C = _.read(v), F = Z(y, (k) => k.read(v));
1548
- return t(v, C, F);
1545
+ }), y = Z(n, (k, C) => k.create((F) => p.read(F)[C], f.get(k._requiredContext)));
1546
+ return (k) => {
1547
+ const C = _.read(k), F = Z(y, (v) => v.read(k));
1548
+ return t(k, C, F);
1549
1549
  };
1550
1550
  }, d.length > 0 ? d : void 0);
1551
1551
  }
@@ -1629,7 +1629,7 @@ function Ho(r, e) {
1629
1629
  const o = new URLSearchParams(location.search);
1630
1630
  return o.set(r, e), location.pathname + "?" + o.toString();
1631
1631
  }
1632
- class Kr extends D({
1632
+ class Kr extends L({
1633
1633
  registry: m.const(),
1634
1634
  daemonModel: m.const(),
1635
1635
  reportModel: m.const()
@@ -2034,7 +2034,7 @@ const h = {
2034
2034
  function Ve(...r) {
2035
2035
  return Object.assign({}, ...r.filter(Boolean));
2036
2036
  }
2037
- class Jr extends D({
2037
+ class Jr extends L({
2038
2038
  active: m()
2039
2039
  }) {
2040
2040
  constructor() {
@@ -2048,7 +2048,7 @@ class Jr extends D({
2048
2048
  return this.props.active;
2049
2049
  }
2050
2050
  }
2051
- const he = N(
2051
+ const he = D(
2052
2052
  Jr,
2053
2053
  {
2054
2054
  onClick: m.const(),
@@ -2230,7 +2230,7 @@ const dn = {
2230
2230
  },
2231
2231
  (r, e) => /* @__PURE__ */ c(Fe, { children: e.nodes.map((o) => /* @__PURE__ */ c(pn, { model: e.model, node: o, depth: e.depth }, o.id.value)) })
2232
2232
  );
2233
- class ln extends D({
2233
+ class ln extends L({
2234
2234
  model: m.const(),
2235
2235
  node: m.const(),
2236
2236
  depth: m.const()
@@ -2265,7 +2265,7 @@ class ln extends D({
2265
2265
  return !!(this.props.node.children && this.props.node.children.length > 0);
2266
2266
  }
2267
2267
  }
2268
- const pn = N(ln, {}, (r, e) => {
2268
+ const pn = D(ln, {}, (r, e) => {
2269
2269
  const o = e.explorerModel, n = e.treeNode, t = e.treeDepth, i = !!(n.children && n.children.length > 0), a = i ? o.isNodeExpanded(n.id.value, r) : !1, d = o.selectedNodeId.read(r) === n.id.value, p = e.isHovered.read(r), g = Ve(
2270
2270
  h.treeItem,
2271
2271
  { paddingLeft: `${8 + t * 12}px` },
@@ -2379,7 +2379,7 @@ const pn = N(ln, {}, (r, e) => {
2379
2379
  ] });
2380
2380
  }
2381
2381
  );
2382
- class bn extends D({}) {
2382
+ class bn extends L({}) {
2383
2383
  constructor() {
2384
2384
  super(...arguments);
2385
2385
  l(this, "checked", w(this, !1));
@@ -2388,7 +2388,7 @@ class bn extends D({}) {
2388
2388
  });
2389
2389
  }
2390
2390
  }
2391
- const vn = N(bn, {}, (r, e) => {
2391
+ const vn = D(bn, {}, (r, e) => {
2392
2392
  const o = e.checked.read(r), n = {
2393
2393
  position: "relative",
2394
2394
  width: "36px",
@@ -2593,7 +2593,7 @@ function Fn(r, e, o) {
2593
2593
  o.adoptedStyleSheets = o.adoptedStyleSheets.filter((t) => t !== n);
2594
2594
  }
2595
2595
  class Le {
2596
- constructor(e, o, n) {
2596
+ constructor(e, o) {
2597
2597
  l(this, "renderTarget");
2598
2598
  l(this, "iframe", null);
2599
2599
  l(this, "_abortController", new AbortController());
@@ -2601,31 +2601,33 @@ class Le {
2601
2601
  l(this, "_injectedElements", []);
2602
2602
  l(this, "_adoptedSheets", []);
2603
2603
  l(this, "_styleTarget", document);
2604
+ l(this, "_disposables", []);
2604
2605
  l(this, "_rendered");
2605
- l(this, "_onError");
2606
- l(this, "_errorReported", !1);
2607
- l(this, "error");
2608
- this.component = o, this._onError = n == null ? void 0 : n.onError;
2609
- const t = o.isolation;
2610
- if (t === "shadow-dom") {
2611
- const a = e.attachShadow({ mode: "open" });
2612
- if (this._styleTarget = a, o.styles) {
2613
- const { injectedElements: s, adoptedSheets: d } = Xe(o.styles, a);
2614
- this._injectedElements = s, this._adoptedSheets = d;
2606
+ this.component = o;
2607
+ const n = o.isolation;
2608
+ if (n === "shadow-dom") {
2609
+ const i = e.attachShadow({ mode: "open" });
2610
+ if (this._styleTarget = i, o.styles) {
2611
+ const { injectedElements: a, adoptedSheets: s } = Xe(o.styles, i);
2612
+ this._injectedElements = a, this._adoptedSheets = s;
2615
2613
  }
2616
- this.renderTarget = document.createElement("div"), a.appendChild(this.renderTarget);
2617
- } else if (t === "iframe") {
2618
- const a = document.createElement("iframe");
2619
- a.style.border = "none", a.style.display = "block", a.style.width = "100%", a.style.height = (Cn(o.id) ?? 0) + "px";
2620
- const s = new URL(location.pathname, location.origin);
2621
- s.searchParams.set("mode", "embedded"), s.searchParams.set("fixture", o.id), s.searchParams.set("file", o.sourceFile), a.src = s.toString(), e.appendChild(a), this.iframe = a;
2614
+ this.renderTarget = document.createElement("div"), i.appendChild(this.renderTarget);
2615
+ } else if (n === "iframe") {
2616
+ const i = document.createElement("iframe");
2617
+ i.style.border = "none", i.style.display = "block", i.style.width = "100%", i.style.height = (Cn(o.id) ?? 0) + "px";
2618
+ const a = new URL(location.pathname, location.origin);
2619
+ a.searchParams.set("mode", "embedded"), a.searchParams.set("fixture", o.id), a.searchParams.set("file", o.sourceFile), i.src = a.toString(), e.appendChild(i), this.iframe = i;
2620
+ let s;
2622
2621
  const d = (p) => {
2623
2622
  var g, f, x;
2624
- if (p.source === a.contentWindow)
2623
+ if (p.source === i.contentWindow)
2625
2624
  if (((g = p.data) == null ? void 0 : g.type) === "component-explorer:resize") {
2626
2625
  const b = p.data.height;
2627
- a.style.height = b + "px", _n(o.id, b);
2628
- } else ((f = p.data) == null ? void 0 : f.type) === "component-explorer:error" ? this._reportError(p.data.error) : ((x = p.data) == null ? void 0 : x.type) === "component-explorer:console" && de.getInstance().addEvent(
2626
+ i.style.height = b + "px", _n(o.id, b);
2627
+ } else if (((f = p.data) == null ? void 0 : f.type) === "component-explorer:error") {
2628
+ const b = p.data.error;
2629
+ this._resolvedResult = { error: b }, s == null || s(b), s = void 0;
2630
+ } else ((x = p.data) == null ? void 0 : x.type) === "component-explorer:console" && de.getInstance().addEvent(
2629
2631
  p.data.eventType,
2630
2632
  p.data.message,
2631
2633
  p.data.stack
@@ -2633,44 +2635,45 @@ class Le {
2633
2635
  };
2634
2636
  window.addEventListener("message", d), this._abortController.signal.addEventListener("abort", () => {
2635
2637
  window.removeEventListener("message", d);
2636
- }), this.renderTarget = a, this._rendered = Promise.resolve(void 0);
2638
+ }), this.renderTarget = i, this._rendered = new Promise((p, g) => {
2639
+ s = g;
2640
+ });
2637
2641
  return;
2638
2642
  } else {
2639
2643
  if (o.styles) {
2640
- const { injectedElements: a, adoptedSheets: s } = Xe(o.styles, document);
2641
- this._injectedElements = a, this._adoptedSheets = s;
2644
+ const { injectedElements: i, adoptedSheets: a } = Xe(o.styles, document);
2645
+ this._injectedElements = i, this._adoptedSheets = a;
2642
2646
  }
2643
2647
  this.renderTarget = document.createElement("div"), e.appendChild(this.renderTarget);
2644
2648
  }
2645
- let i;
2649
+ let t;
2646
2650
  try {
2647
- i = o.render(this.renderTarget, {
2648
- signal: this._abortController.signal
2651
+ t = o.render(this.renderTarget, {
2652
+ signal: this._abortController.signal,
2653
+ addDisposable: (i) => (this._disposables.push(i), i)
2649
2654
  });
2650
- } catch (a) {
2651
- this._reportError({
2652
- message: a instanceof Error ? a.message : String(a),
2653
- stack: a instanceof Error ? a.stack : void 0
2654
- }), this._rendered = Promise.resolve(void 0);
2655
+ } catch (i) {
2656
+ const a = {
2657
+ message: i instanceof Error ? i.message : String(i),
2658
+ stack: i instanceof Error ? i.stack : void 0
2659
+ };
2660
+ this._resolvedResult = { error: a }, this._rendered = Promise.reject(a);
2655
2661
  return;
2656
2662
  }
2657
- i instanceof Promise ? this._rendered = i.then((a) => {
2658
- var s;
2663
+ t instanceof Promise ? this._rendered = t.then((i) => {
2664
+ var a;
2659
2665
  if (this._abortController.signal.aborted) {
2660
- (s = a == null ? void 0 : a.dispose) == null || s.call(a);
2666
+ (a = i == null ? void 0 : i.dispose) == null || a.call(i);
2661
2667
  return;
2662
2668
  }
2663
- return this._resolvedResult = a ?? void 0, this._resolvedResult;
2664
- }).catch((a) => {
2665
- this._reportError({
2666
- message: a instanceof Error ? a.message : String(a),
2667
- stack: a instanceof Error ? a.stack : void 0
2668
- });
2669
- }) : (this._resolvedResult = i ?? void 0, this._rendered = Promise.resolve(this._resolvedResult));
2670
- }
2671
- _reportError(e) {
2672
- var o;
2673
- this._errorReported || (this._errorReported = !0, this.error = e, (o = this._onError) == null || o.call(this, e));
2669
+ return this._resolvedResult = i ?? void 0, this._resolvedResult;
2670
+ }).catch((i) => {
2671
+ const a = {
2672
+ message: i instanceof Error ? i.message : String(i),
2673
+ stack: i instanceof Error ? i.stack : void 0
2674
+ };
2675
+ throw this._resolvedResult = { error: a }, a;
2676
+ }) : (this._resolvedResult = t ?? void 0, this._rendered = Promise.resolve(this._resolvedResult));
2674
2677
  }
2675
2678
  async waitForRendering() {
2676
2679
  const e = await this._rendered;
@@ -2678,7 +2681,10 @@ class Le {
2678
2681
  }
2679
2682
  dispose() {
2680
2683
  var e, o;
2681
- this._abortController.abort(), (o = (e = this._resolvedResult) == null ? void 0 : e.dispose) == null || o.call(e), this._resolvedResult = void 0, Fn(this._injectedElements, this._adoptedSheets, this._styleTarget);
2684
+ this._abortController.abort(), this._resolvedResult && !("error" in this._resolvedResult) && ((o = (e = this._resolvedResult).dispose) == null || o.call(e)), this._resolvedResult = void 0;
2685
+ for (const n of this._disposables)
2686
+ n.dispose();
2687
+ this._disposables.length = 0, Fn(this._injectedElements, this._adoptedSheets, this._styleTarget);
2682
2688
  }
2683
2689
  }
2684
2690
  let _e;
@@ -2707,7 +2713,7 @@ function Tn(r) {
2707
2713
  No.add(r);
2708
2714
  }
2709
2715
  let Hn = 0;
2710
- class Mn extends D({
2716
+ class Mn extends L({
2711
2717
  fixture: m.const(),
2712
2718
  compact: m.const(),
2713
2719
  onSelect: m.const()
@@ -2733,10 +2739,10 @@ class Mn extends D({
2733
2739
  } else
2734
2740
  t.style.all = "initial", t.style.display = "inline-block";
2735
2741
  n.appendChild(t), this._fixtureContainer = t, Tn(t);
2736
- const s = new Le(t, i, {
2737
- onError: (d) => this.error.set(d, void 0)
2738
- });
2739
- this._rendering = s, this._resizeObserver = new ResizeObserver((d) => {
2742
+ const s = new Le(t, i);
2743
+ this._rendering = s, s.waitForRendering().catch((d) => {
2744
+ this.error.set(d, void 0);
2745
+ }), this._resizeObserver = new ResizeObserver((d) => {
2740
2746
  for (const p of d) {
2741
2747
  const { width: g, height: f } = p.contentRect;
2742
2748
  f > 0 && (this.measuredWidth.set(Math.round(g), void 0), this.measuredHeight.set(Math.round(f), void 0));
@@ -2761,7 +2767,7 @@ class Mn extends D({
2761
2767
  this._cleanup();
2762
2768
  }
2763
2769
  }
2764
- const Ao = N(
2770
+ const Ao = D(
2765
2771
  Mn,
2766
2772
  {},
2767
2773
  (r, e) => {
@@ -2883,7 +2889,8 @@ const ne = {
2883
2889
  cursor: "pointer",
2884
2890
  textAlign: "left",
2885
2891
  fontFamily: "var(--component-explorer-editor-font-family, monospace)",
2886
- fontSize: "12px"
2892
+ fontSize: "12px",
2893
+ userSelect: "text"
2887
2894
  },
2888
2895
  chevron: {
2889
2896
  fontSize: "10px",
@@ -2893,7 +2900,8 @@ const ne = {
2893
2900
  },
2894
2901
  message: {
2895
2902
  color: "#f77",
2896
- wordBreak: "break-word"
2903
+ wordBreak: "break-word",
2904
+ userSelect: "text"
2897
2905
  },
2898
2906
  stack: {
2899
2907
  margin: 0,
@@ -2903,10 +2911,11 @@ const ne = {
2903
2911
  color: "var(--component-explorer-descriptionForeground)",
2904
2912
  whiteSpace: "pre-wrap",
2905
2913
  wordBreak: "break-word",
2906
- lineHeight: 1.4
2914
+ lineHeight: 1.4,
2915
+ userSelect: "text"
2907
2916
  }
2908
2917
  };
2909
- class An extends D({
2918
+ class An extends L({
2910
2919
  fixtureId: m.const(),
2911
2920
  sessionName: m.const(),
2912
2921
  daemon: m.const()
@@ -2933,27 +2942,27 @@ class An extends D({
2933
2942
  }
2934
2943
  }
2935
2944
  }
2936
- const oo = N(
2945
+ const oo = D(
2937
2946
  An,
2938
2947
  {},
2939
2948
  (r, e) => {
2940
2949
  var t;
2941
2950
  const o = e.screenshot.read(r);
2942
2951
  if (o.status === "idle" || o.status === "loading")
2943
- return /* @__PURE__ */ c("div", { style: z.placeholder, children: /* @__PURE__ */ c("div", { style: z.shimmer }) });
2952
+ return /* @__PURE__ */ c("div", { style: G.placeholder, children: /* @__PURE__ */ c("div", { style: G.shimmer }) });
2944
2953
  if (o.status === "error")
2945
- return /* @__PURE__ */ c("div", { style: z.error, children: /* @__PURE__ */ c("span", { style: z.errorText, children: "Screenshot failed" }) });
2954
+ return /* @__PURE__ */ c("div", { style: G.error, children: /* @__PURE__ */ c("span", { style: G.errorText, children: "Screenshot failed" }) });
2946
2955
  const { data: n } = o;
2947
2956
  return n.image ? /* @__PURE__ */ c(
2948
2957
  "img",
2949
2958
  {
2950
2959
  src: `data:image/png;base64,${n.image}`,
2951
- style: z.image,
2960
+ style: G.image,
2952
2961
  alt: `Screenshot of ${e.fixtureId}`
2953
2962
  }
2954
- ) : /* @__PURE__ */ c("div", { style: z.placeholder, children: /* @__PURE__ */ c("span", { style: z.hashText, children: (t = n.hash) == null ? void 0 : t.slice(0, 12) }) });
2963
+ ) : /* @__PURE__ */ c("div", { style: G.placeholder, children: /* @__PURE__ */ c("span", { style: G.hashText, children: (t = n.hash) == null ? void 0 : t.slice(0, 12) }) });
2955
2964
  }
2956
- ), z = {
2965
+ ), G = {
2957
2966
  placeholder: {
2958
2967
  minHeight: 80,
2959
2968
  display: "flex",
@@ -2996,7 +3005,7 @@ const oo = N(
2996
3005
  border: "1px solid var(--component-explorer-panel-border)"
2997
3006
  }
2998
3007
  };
2999
- class Gn extends D({
3008
+ class Gn extends L({
3000
3009
  fixtureId: m.const(),
3001
3010
  daemon: m.const(),
3002
3011
  baselineSession: m.const(),
@@ -3036,7 +3045,7 @@ class Gn extends D({
3036
3045
  }
3037
3046
  }
3038
3047
  }
3039
- const zn = N(
3048
+ const zn = D(
3040
3049
  Gn,
3041
3050
  {},
3042
3051
  (r, e) => {
@@ -3163,10 +3172,10 @@ function zo(r, e) {
3163
3172
  const Wn = {
3164
3173
  backgroundColor: "#ffffff",
3165
3174
  backgroundImage: zo("#ffffff", "#e5e5e5")
3166
- }, $n = {
3175
+ }, jn = {
3167
3176
  backgroundColor: "#1e1e1e",
3168
3177
  backgroundImage: zo("#1e1e1e", "#2d2d2d")
3169
- }, jn = {
3178
+ }, $n = {
3170
3179
  display: "inline-block",
3171
3180
  padding: "12px",
3172
3181
  borderRadius: "4px",
@@ -3175,9 +3184,9 @@ const Wn = {
3175
3184
  boxShadow: "0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08)"
3176
3185
  };
3177
3186
  function Un(r) {
3178
- const e = r === "dark" ? $n : Wn;
3187
+ const e = r === "dark" ? jn : Wn;
3179
3188
  return {
3180
- ...jn,
3189
+ ...$n,
3181
3190
  backgroundColor: e.backgroundColor,
3182
3191
  backgroundImage: e.backgroundImage
3183
3192
  };
@@ -3328,14 +3337,14 @@ function Yn(r, e) {
3328
3337
  function Zn(r) {
3329
3338
  return Wo()[r];
3330
3339
  }
3331
- function $o(r) {
3340
+ function jo(r) {
3332
3341
  return r.type === "single" ? r.fixture.id : r.id;
3333
3342
  }
3334
3343
  function Xn(r, e) {
3335
3344
  const o = new Array(r.length);
3336
3345
  let n = le;
3337
3346
  for (let t = 0; t < r.length; t++) {
3338
- const i = e.get($o(r[t])) ?? Kn;
3347
+ const i = e.get(jo(r[t])) ?? Kn;
3339
3348
  o[t] = { top: n, height: i }, n += i + Jn;
3340
3349
  }
3341
3350
  return o;
@@ -3345,7 +3354,7 @@ function Ce(r) {
3345
3354
  const e = r[r.length - 1];
3346
3355
  return e.top + e.height + le;
3347
3356
  }
3348
- function jo(r, e) {
3357
+ function $o(r, e) {
3349
3358
  let o = 0, n = r.length;
3350
3359
  for (; o < n; ) {
3351
3360
  const t = o + n >> 1;
@@ -3355,7 +3364,7 @@ function jo(r, e) {
3355
3364
  }
3356
3365
  function et(r, e, o) {
3357
3366
  if (r.length === 0) return { start: 0, end: 0 };
3358
- const n = jo(r, e - no);
3367
+ const n = $o(r, e - no);
3359
3368
  let t = n;
3360
3369
  const i = e + o + no;
3361
3370
  for (; t < r.length && r[t].top < i; )
@@ -3364,7 +3373,7 @@ function et(r, e, o) {
3364
3373
  }
3365
3374
  function io(r, e) {
3366
3375
  if (r.length === 0) return;
3367
- const o = jo(r, e), n = Math.min(o, r.length - 1);
3376
+ const o = $o(r, e), n = Math.min(o, r.length - 1);
3368
3377
  return {
3369
3378
  rowIndex: n,
3370
3379
  offsetFromViewport: r[n].top - e
@@ -3406,7 +3415,7 @@ function nt(r) {
3406
3415
  borderBottom: r === 0 ? "1px solid var(--component-explorer-widget-border, var(--component-explorer-panel-border, rgba(128,128,128,0.35)))" : void 0
3407
3416
  };
3408
3417
  }
3409
- class tt extends D({
3418
+ class tt extends L({
3410
3419
  model: m.const()
3411
3420
  }) {
3412
3421
  constructor() {
@@ -3510,7 +3519,7 @@ class tt extends D({
3510
3519
  (o = this._resizeObserver) == null || o.disconnect(), (n = this._viewportResizeObserver) == null || n.disconnect(), this._scrollContainerRef && this._scrollContainerRef.removeEventListener("scroll", this._handleScroll), this._scrollSaveTimeout && clearTimeout(this._scrollSaveTimeout);
3511
3520
  }
3512
3521
  }
3513
- const it = N(
3522
+ const it = D(
3514
3523
  tt,
3515
3524
  {},
3516
3525
  (r, e) => {
@@ -3520,37 +3529,37 @@ const it = N(
3520
3529
  if (d) {
3521
3530
  const p = d.state.read(r);
3522
3531
  if (p.status === "loading")
3523
- return /* @__PURE__ */ c("div", { style: L.emptyState, children: /* @__PURE__ */ c("span", { style: L.emptyText, children: "Loading report..." }) });
3532
+ return /* @__PURE__ */ c("div", { style: V.emptyState, children: /* @__PURE__ */ c("span", { style: V.emptyText, children: "Loading report..." }) });
3524
3533
  if (p.status === "error")
3525
- return /* @__PURE__ */ c("div", { style: L.emptyState, children: /* @__PURE__ */ u("span", { style: { ...L.emptyText, color: "var(--component-explorer-errorForeground)" }, children: [
3534
+ return /* @__PURE__ */ c("div", { style: V.emptyState, children: /* @__PURE__ */ u("span", { style: { ...V.emptyText, color: "var(--component-explorer-errorForeground)" }, children: [
3526
3535
  "Failed to load report: ",
3527
3536
  p.message
3528
3537
  ] }) });
3529
3538
  }
3530
- return /* @__PURE__ */ c("div", { style: L.emptyState, children: /* @__PURE__ */ c("span", { style: L.emptyText, children: "Select a component or folder to preview" }) });
3539
+ return /* @__PURE__ */ c("div", { style: V.emptyState, children: /* @__PURE__ */ c("span", { style: V.emptyText, children: "Select a component or folder to preview" }) });
3531
3540
  }
3532
3541
  const s = Ce(t);
3533
- return /* @__PURE__ */ c("div", { ref: e.setScrollContainerRef, style: L.scrollContainer, children: /* @__PURE__ */ c("div", { style: { position: "relative", height: s }, children: o.slice(i, a).map((d, p) => {
3534
- const g = i + p, { top: f } = t[g], x = $o(d), b = so(co(d)), _ = g > 0 ? so(co(o[g - 1])) : void 0, y = ot(b, _, x);
3542
+ return /* @__PURE__ */ c("div", { ref: e.setScrollContainerRef, style: V.scrollContainer, children: /* @__PURE__ */ c("div", { style: { position: "relative", height: s }, children: o.slice(i, a).map((d, p) => {
3543
+ const g = i + p, { top: f } = t[g], x = jo(d), b = so(co(d)), _ = g > 0 ? so(co(o[g - 1])) : void 0, y = ot(b, _, x);
3535
3544
  return /* @__PURE__ */ u(
3536
3545
  "div",
3537
3546
  {
3538
- ref: (v) => e.observeRowElement(v, x),
3547
+ ref: (k) => e.observeRowElement(k, x),
3539
3548
  style: { position: "absolute", top: f, left: le, right: le },
3540
3549
  children: [
3541
- y.map((v) => {
3542
- const C = rt(v.depth);
3543
- return /* @__PURE__ */ c(C, { style: nt(v.depth), children: /* @__PURE__ */ c(
3550
+ y.map((k) => {
3551
+ const C = rt(k.depth);
3552
+ return /* @__PURE__ */ c(C, { style: nt(k.depth), children: /* @__PURE__ */ c(
3544
3553
  "a",
3545
3554
  {
3546
- href: Ho("fixture", v.nodeId),
3547
- style: L.headingLink,
3555
+ href: Ho("fixture", k.nodeId),
3556
+ style: V.headingLink,
3548
3557
  onClick: (F) => {
3549
- F.preventDefault(), e.explorerModel.selectNode(v.nodeId);
3558
+ F.preventDefault(), e.explorerModel.selectNode(k.nodeId);
3550
3559
  },
3551
- children: v.name
3560
+ children: k.name
3552
3561
  }
3553
- ) }, v.depth);
3562
+ ) }, k.depth);
3554
3563
  }),
3555
3564
  d.type === "single" ? /* @__PURE__ */ c(Ao, { fixture: d.fixture, compact: !1, onSelect: e.explorerModel.selectNode }) : d.type === "variants" ? /* @__PURE__ */ c(at, { row: d, onSelect: e.explorerModel.selectNode }) : d.type === "screenshot-comparison" && e.explorerModel.daemon ? /* @__PURE__ */ c(
3556
3565
  Pn,
@@ -3584,9 +3593,9 @@ const it = N(
3584
3593
  },
3585
3594
  (r, e) => {
3586
3595
  const o = e.row;
3587
- return /* @__PURE__ */ c("div", { style: L.variantsContent, children: o.fixtures.map((n) => /* @__PURE__ */ c(Ao, { fixture: n, compact: !0, onSelect: e.onSelect }, n.id)) });
3596
+ return /* @__PURE__ */ c("div", { style: V.variantsContent, children: o.fixtures.map((n) => /* @__PURE__ */ c(Ao, { fixture: n, compact: !0, onSelect: e.onSelect }, n.id)) });
3588
3597
  }
3589
- ), L = {
3598
+ ), V = {
3590
3599
  scrollContainer: {
3591
3600
  flex: 1,
3592
3601
  overflow: "auto",
@@ -3614,7 +3623,7 @@ const it = N(
3614
3623
  color: "inherit"
3615
3624
  }
3616
3625
  };
3617
- class ct extends D({
3626
+ class ct extends L({
3618
3627
  store: m.const()
3619
3628
  }) {
3620
3629
  constructor() {
@@ -3631,28 +3640,28 @@ class ct extends D({
3631
3640
  this.store.clear();
3632
3641
  }
3633
3642
  }
3634
- const st = N(
3643
+ const st = D(
3635
3644
  ct,
3636
3645
  { store: m.const() },
3637
3646
  (r, e) => {
3638
3647
  const o = e.store, n = o.events.read(r), t = o.errorCount.read(r), i = e.expanded.read(r);
3639
- return n.length === 0 ? null : /* @__PURE__ */ u("div", { style: A.container, children: [
3648
+ return n.length === 0 ? null : /* @__PURE__ */ u("div", { style: N.container, children: [
3640
3649
  /* @__PURE__ */ u(
3641
3650
  "button",
3642
3651
  {
3643
- style: A.header,
3652
+ style: N.header,
3644
3653
  onClick: () => e.toggleExpanded(),
3645
3654
  children: [
3646
- /* @__PURE__ */ u("span", { style: A.headerLeft, children: [
3647
- /* @__PURE__ */ c("span", { style: A.chevron, children: i ? "▼" : "▶" }),
3655
+ /* @__PURE__ */ u("span", { style: N.headerLeft, children: [
3656
+ /* @__PURE__ */ c("span", { style: N.chevron, children: i ? "▼" : "▶" }),
3648
3657
  /* @__PURE__ */ c("span", { children: "Console" }),
3649
- t > 0 && /* @__PURE__ */ c("span", { style: A.errorBadge, children: t }),
3650
- n.length > t && /* @__PURE__ */ c("span", { style: A.warnBadge, children: n.length - t })
3658
+ t > 0 && /* @__PURE__ */ c("span", { style: N.errorBadge, children: t }),
3659
+ n.length > t && /* @__PURE__ */ c("span", { style: N.warnBadge, children: n.length - t })
3651
3660
  ] }),
3652
3661
  /* @__PURE__ */ c(
3653
3662
  "button",
3654
3663
  {
3655
- style: A.clearButton,
3664
+ style: N.clearButton,
3656
3665
  onClick: (a) => {
3657
3666
  a.stopPropagation(), e.clear();
3658
3667
  },
@@ -3663,7 +3672,7 @@ const st = N(
3663
3672
  ]
3664
3673
  }
3665
3674
  ),
3666
- i && /* @__PURE__ */ c("div", { style: A.content, children: n.map((a) => /* @__PURE__ */ c(dt, { event: a }, a.id)) })
3675
+ i && /* @__PURE__ */ c("div", { style: N.content, children: n.map((a) => /* @__PURE__ */ c(dt, { event: a }, a.id)) })
3667
3676
  ] });
3668
3677
  }
3669
3678
  );
@@ -3680,24 +3689,24 @@ function dt({ event: r }) {
3680
3689
  children: [
3681
3690
  /* @__PURE__ */ c("span", { style: Y.time, children: a }),
3682
3691
  /* @__PURE__ */ c("span", { style: { ...Y.type, color: n ? "#f77" : t ? "#fc0" : "#888" }, children: r.type.replace("window.", "").replace("console.", "") }),
3683
- /* @__PURE__ */ u(
3684
- "span",
3685
- {
3686
- style: { ...Y.message, cursor: r.stack ? "pointer" : "default" },
3687
- onClick: () => r.stack && o(!e),
3688
- title: r.stack ? "Click to toggle stack trace" : void 0,
3689
- children: [
3690
- r.message,
3691
- r.stack && /* @__PURE__ */ c("span", { style: Y.stackIndicator, children: " ▾" })
3692
- ]
3693
- }
3694
- ),
3692
+ /* @__PURE__ */ u("span", { style: Y.message, children: [
3693
+ r.message,
3694
+ r.stack && /* @__PURE__ */ c(
3695
+ "span",
3696
+ {
3697
+ style: Y.stackIndicator,
3698
+ onClick: () => o(!e),
3699
+ title: "Toggle stack trace",
3700
+ children: e ? " " : " ▾"
3701
+ }
3702
+ )
3703
+ ] }),
3695
3704
  e && r.stack && /* @__PURE__ */ c("pre", { style: Y.stack, children: r.stack })
3696
3705
  ]
3697
3706
  }
3698
3707
  );
3699
3708
  }
3700
- const A = {
3709
+ const N = {
3701
3710
  container: {
3702
3711
  borderTop: "1px solid var(--component-explorer-panel-border)",
3703
3712
  backgroundColor: "var(--component-explorer-editor-background)",
@@ -3758,7 +3767,9 @@ const A = {
3758
3767
  },
3759
3768
  content: {
3760
3769
  maxHeight: "200px",
3761
- overflowY: "auto"
3770
+ overflowY: "auto",
3771
+ userSelect: "text",
3772
+ cursor: "text"
3762
3773
  }
3763
3774
  }, Y = {
3764
3775
  container: {
@@ -3784,7 +3795,9 @@ const A = {
3784
3795
  },
3785
3796
  stackIndicator: {
3786
3797
  fontSize: "10px",
3787
- opacity: 0.5
3798
+ opacity: 0.5,
3799
+ cursor: "pointer",
3800
+ userSelect: "none"
3788
3801
  },
3789
3802
  stack: {
3790
3803
  gridColumn: "1 / -1",
@@ -3818,13 +3831,13 @@ const go = {
3818
3831
  borderTopColor: "transparent",
3819
3832
  borderRadius: "50%",
3820
3833
  animation: "explorer-spin 0.8s linear infinite"
3821
- }, pt = N(
3834
+ }, pt = D(
3822
3835
  Kr,
3823
3836
  { daemonModel: m.const(), reportModel: m.const() },
3824
3837
  (r, e) => {
3825
3838
  const o = e.isDarkTheme.read(r), n = e.loading.read(r), t = e.error.read(r), i = o ? "vscode-theme default-dark-plus" : "vscode-theme default-light-plus";
3826
3839
  if (t)
3827
- return /* @__PURE__ */ c("div", { className: i, style: { ...h.container, backgroundColor: "var(--component-explorer-editor-background)" }, children: /* @__PURE__ */ u("div", { style: go, children: [
3840
+ return /* @__PURE__ */ c("div", { className: i, style: { ...h.container, backgroundColor: "var(--component-explorer-editor-background)" }, children: /* @__PURE__ */ u("div", { style: { ...go, userSelect: "text", cursor: "text" }, children: [
3828
3841
  /* @__PURE__ */ c("span", { style: { color: "var(--component-explorer-errorForeground)" }, children: "Failed to load fixtures" }),
3829
3842
  /* @__PURE__ */ c("pre", { style: { fontSize: "12px", opacity: 0.7, whiteSpace: "pre-wrap", wordBreak: "break-word", margin: 0, fontFamily: "inherit" }, children: t })
3830
3843
  ] }) });
@@ -3917,11 +3930,11 @@ ${b}` : ""}`;
3917
3930
  if (_)
3918
3931
  break;
3919
3932
  g += f.decode(y, { stream: !0 });
3920
- let v;
3921
- for (; (v = g.indexOf(`
3933
+ let k;
3934
+ for (; (k = g.indexOf(`
3922
3935
  `)) >= 0; ) {
3923
- const C = g.slice(0, v).trim();
3924
- g = g.slice(v + 1), C.length > 0 && (yield JSON.parse(C));
3936
+ const C = g.slice(0, k).trim();
3937
+ g = g.slice(k + 1), C.length > 0 && (yield JSON.parse(C));
3925
3938
  }
3926
3939
  }
3927
3940
  const x = g.trim();
@@ -4161,7 +4174,8 @@ class wt {
4161
4174
  (e = this._daemonModel) == null || e.dispose(), this._root.unmount();
4162
4175
  }
4163
4176
  }
4164
- class Bt {
4177
+ const Bt = window.setTimeout;
4178
+ class _t {
4165
4179
  constructor(e, o) {
4166
4180
  /** Random ID generated on construction — changes on full page reload. */
4167
4181
  l(this, "pageInstanceId", Math.random().toString(36).slice(2));
@@ -4203,6 +4217,8 @@ class Bt {
4203
4217
  this._currentRendering && (this._currentRendering.dispose(), this._currentRendering = void 0), this._currentContainer && (this._currentContainer.remove(), this._currentContainer = void 0);
4204
4218
  }
4205
4219
  async renderFixture(e) {
4220
+ if (await this._loadPromise, this._loadError)
4221
+ throw new Error(this._loadError);
4206
4222
  const o = this._findFixtureNode(this._root, e);
4207
4223
  if (!o || !o.component)
4208
4224
  throw new Error("Fixture not found: " + e);
@@ -4211,20 +4227,20 @@ class Bt {
4211
4227
  n.style.display = "inline-block", this._containerElement.appendChild(n), this._currentContainer = n;
4212
4228
  const t = o.component, i = [];
4213
4229
  let a;
4214
- const s = (k) => {
4215
- a || (a = k);
4230
+ const s = (v) => {
4231
+ a || (a = v);
4216
4232
  }, d = console.error, p = console.warn, g = console.log;
4217
- console.error = (...k) => {
4218
- i.push({ type: "console.error", message: k.map(String).join(" ") }), d.apply(console, k);
4219
- }, console.warn = (...k) => {
4220
- i.push({ type: "console.warn", message: k.map(String).join(" ") }), p.apply(console, k);
4221
- }, console.log = (...k) => {
4222
- i.push({ type: "console.log", message: k.map(String).join(" ") }), g.apply(console, k);
4233
+ console.error = (...v) => {
4234
+ i.push({ type: "console.error", message: v.map(String).join(" ") }), d.apply(console, v);
4235
+ }, console.warn = (...v) => {
4236
+ i.push({ type: "console.warn", message: v.map(String).join(" ") }), p.apply(console, v);
4237
+ }, console.log = (...v) => {
4238
+ i.push({ type: "console.log", message: v.map(String).join(" ") }), g.apply(console, v);
4223
4239
  };
4224
- const f = (k) => {
4225
- i.push({ type: "window.error", message: k.message });
4226
- }, x = (k) => {
4227
- const V = k.reason, ge = V instanceof Error ? V.message : String(V);
4240
+ const f = (v) => {
4241
+ i.push({ type: "window.error", message: v.message });
4242
+ }, x = (v) => {
4243
+ const $ = v.reason, ge = $ instanceof Error ? $.message : String($);
4228
4244
  i.push({ type: "window.unhandledrejection", message: ge });
4229
4245
  };
4230
4246
  window.addEventListener("error", f), window.addEventListener("unhandledrejection", x);
@@ -4232,20 +4248,21 @@ class Bt {
4232
4248
  const _ = performance.now();
4233
4249
  let y;
4234
4250
  try {
4235
- const k = new Le(n, t);
4236
- y = performance.now() - _, this._currentRendering = k;
4237
- const V = 3e3, ge = new Promise((St, qo) => setTimeout(() => qo(new Error(`Fixture timed out after ${V}ms`)), V)), ue = await Promise.race([k.waitForRendering(), ge]);
4251
+ const v = new Le(n, t);
4252
+ y = performance.now() - _, this._currentRendering = v;
4253
+ const $ = 3e3, ge = new Promise(
4254
+ (Ft, qo) => Bt(() => qo(new Error(`Fixture timed out after ${$}ms`)), $)
4255
+ ), ue = await Promise.race([v.waitForRendering(), ge]);
4238
4256
  b = ue == null ? void 0 : ue.data;
4239
- } catch (k) {
4240
- const V = k instanceof Error ? k : new Error(String(k));
4241
- s({ message: V.message, stack: V.stack });
4257
+ } catch (v) {
4258
+ v instanceof Error ? s({ message: v.message, stack: v.stack }) : v && typeof v == "object" && "message" in v ? s({ message: String(v.message), stack: String(v.stack ?? "") || void 0 }) : s({ message: String(v) });
4242
4259
  } finally {
4243
4260
  console.error = d, console.warn = p, console.log = g;
4244
4261
  }
4245
- a || await new Promise((k) => requestAnimationFrame(() => requestAnimationFrame(() => k())));
4246
- const v = performance.now() - _;
4262
+ a || await new Promise((v) => requestAnimationFrame(() => requestAnimationFrame(() => v())));
4263
+ const k = performance.now() - _;
4247
4264
  window.removeEventListener("error", f), window.removeEventListener("unhandledrejection", x);
4248
- const C = !!a || i.some((k) => k.type !== "console.log" && k.type !== "console.warn"), F = { sync: Math.round(y ?? v), total: Math.round(v) };
4265
+ const C = !!a || i.some((v) => v.type !== "console.log" && v.type !== "console.warn"), F = { sync: Math.round(y ?? k), total: Math.round(k) };
4249
4266
  return { hasError: C, error: a, events: i, resultData: b, renderTimeMs: F };
4250
4267
  }
4251
4268
  _buildTree(e) {
@@ -4287,7 +4304,7 @@ class Bt {
4287
4304
  window.__componentExplorer__ = o;
4288
4305
  }
4289
4306
  }
4290
- class _t {
4307
+ class Ct {
4291
4308
  constructor(e, o, n) {
4292
4309
  l(this, "_root");
4293
4310
  l(this, "_rendering");
@@ -4303,7 +4320,7 @@ class _t {
4303
4320
  const i = t instanceof Error ? t.stack ?? t.message : String(t);
4304
4321
  console.error("[EmbeddedMode] Failed to load fixtures:", i), this._container.innerHTML = "";
4305
4322
  const a = document.createElement("div");
4306
- a.style.cssText = "padding:16px;color:#f44;font-size:13px;font-family:monospace;white-space:pre-wrap;", a.textContent = `Failed to load fixture:
4323
+ a.style.cssText = "padding:16px;color:#f44;font-size:13px;font-family:monospace;white-space:pre-wrap;user-select:text;cursor:text;", a.textContent = `Failed to load fixture:
4307
4324
  ${i}`, this._container.appendChild(a), this._postError({ message: t instanceof Error ? t.message : String(t), stack: t instanceof Error ? t.stack : void 0 });
4308
4325
  }
4309
4326
  );
@@ -4355,10 +4372,10 @@ ${i}`, this._container.appendChild(a), this._postError({ message: t instanceof E
4355
4372
  try {
4356
4373
  const d = new Le(this._container, o);
4357
4374
  this._rendering = d, d.waitForRendering().catch((p) => {
4358
- this._postError({ message: p instanceof Error ? p.message : String(p), stack: p instanceof Error ? p.stack : void 0 });
4375
+ p && typeof p == "object" && "message" in p ? this._postError(p) : this._postError({ message: p instanceof Error ? p.message : String(p), stack: p instanceof Error ? p.stack : void 0 });
4359
4376
  });
4360
4377
  } catch (d) {
4361
- this._postError({ message: d instanceof Error ? d.message : String(d), stack: d instanceof Error ? d.stack : void 0 });
4378
+ this._postError({ message: d instanceof Error ? d.message : String(d), stack: d instanceof Error ? d.stack : void 0 }), console.error("[EmbeddedMode] Error during rendering:", d);
4362
4379
  return;
4363
4380
  }
4364
4381
  const n = this._rendering, t = this._fixtureId, i = () => {
@@ -4388,7 +4405,7 @@ ${i}`, this._container.appendChild(a), this._postError({ message: t instanceof E
4388
4405
  }
4389
4406
  }
4390
4407
  }
4391
- function Ct(r) {
4408
+ function St(r) {
4392
4409
  const e = r.get("mode");
4393
4410
  return {
4394
4411
  mode: e === "headless" || e === "embedded" ? e : void 0,
@@ -4398,20 +4415,20 @@ function Ct(r) {
4398
4415
  };
4399
4416
  }
4400
4417
  globalThis._buildInfo = Jo;
4401
- class Nt {
4418
+ class At {
4402
4419
  constructor(e, o) {
4403
4420
  l(this, "_runtime");
4404
4421
  const n = globalThis._buildInfo;
4405
4422
  n && console.log(`[component-explorer] v${n.version} (built ${n.date})`);
4406
- const t = new URLSearchParams(location.search), i = Ct(t), a = i.fixture;
4423
+ const t = new URLSearchParams(location.search), i = St(t), a = i.fixture;
4407
4424
  if (i.mode === "embedded") {
4408
4425
  if (!a)
4409
4426
  throw new Error("Embedded mode requires a fixture query parameter");
4410
4427
  const s = i.file, d = o.loadFixtures(s ? { file: s } : void 0);
4411
- this._runtime = new _t(e, a, d);
4428
+ this._runtime = new Ct(e, a, d);
4412
4429
  } else {
4413
4430
  const s = o.loadFixtures();
4414
- this._runtime = i.mode === "headless" ? new Bt(e, s) : new wt(e, s, o.daemonConfig);
4431
+ this._runtime = i.mode === "headless" ? new _t(e, s) : new wt(e, s, o.daemonConfig);
4415
4432
  }
4416
4433
  }
4417
4434
  updateFixtures(e) {
@@ -4427,7 +4444,7 @@ export {
4427
4444
  Xr as ComponentIcon,
4428
4445
  ht as DaemonModel,
4429
4446
  pt as Explorer,
4430
- Nt as ExplorerApp,
4447
+ At as ExplorerApp,
4431
4448
  Kr as ExplorerModel,
4432
4449
  M as FixturePath,
4433
4450
  Lr as FixtureRegistry,
@@ -4444,29 +4461,29 @@ export {
4444
4461
  pn as TreeItem,
4445
4462
  Oo as TreeView,
4446
4463
  rr as VIEWPORT_SIZES,
4447
- zt as asyncRender,
4464
+ Pt as asyncRender,
4448
4465
  ir as collectComponents,
4449
4466
  ze as createComponentDefinition,
4450
4467
  ce as createFixtureTree,
4451
- Pt as defineFixture,
4452
- Wt as defineFixtureGroup,
4468
+ Wt as defineFixture,
4469
+ jt as defineFixtureGroup,
4453
4470
  $t as defineFixtureVariants,
4454
4471
  We as findNodeByPath,
4455
4472
  De as fixtureGroupBrand,
4456
4473
  Ne as fixtureVariantsBrand,
4457
- Dt as isComponentDefinition,
4474
+ Nt as isComponentDefinition,
4458
4475
  Re as isFixtureGroup,
4459
4476
  Ee as isFixtureVariants,
4460
4477
  Ie as isSingleFixture,
4461
4478
  Ve as mergeStyles,
4462
- Mt as parseFixtureExport,
4463
- Vt as parseFixtureGroup,
4464
- Lt as parseFixtureVariants,
4465
- Ot as parseSingleFixture,
4479
+ Ot as parseFixtureExport,
4480
+ Lt as parseFixtureGroup,
4481
+ Dt as parseFixtureVariants,
4482
+ Vt as parseSingleFixture,
4466
4483
  nr as resolveViewport,
4467
4484
  Ae as singleFixtureBrand,
4468
4485
  h as styles,
4469
- jt as syncRender,
4486
+ Ut as syncRender,
4470
4487
  Eo as toExplorerTree
4471
4488
  };
4472
4489
  //# sourceMappingURL=viewer.js.map