@jogak/ui 0.1.0-alpha.6 → 0.1.0-alpha.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,27 +1,28 @@
1
1
  import { jsxs as j, jsx as e } from "react/jsx-runtime";
2
- import { useState as f, useEffect as w, useRef as H, useMemo as y, useCallback as C } from "react";
3
- import { defaultActionChannel as S, ComponentRegistry as I, defaultRegistry as V } from "@jogak/core";
4
- import { useRegistryMeta as q, useEntry as Q, reactAdapter as A, JogakProvider as X, useRegistry as Y } from "@jogak/react";
5
- import { themes as B, Highlight as Z } from "prism-react-renderer";
6
- function z(o) {
2
+ import { useState as m, useEffect as b, useRef as _, useMemo as C, useCallback as R } from "react";
3
+ import { defaultActionChannel as A, ComponentRegistry as Q, defaultRegistry as W } from "@jogak/core";
4
+ import { useRegistryMeta as X, useEntry as Y, reactAdapter as S, JogakProvider as Z, useRegistry as K } from "@jogak/react";
5
+ import { themes as z, Highlight as T } from "prism-react-renderer";
6
+ import { createPortal as oo } from "react-dom";
7
+ function F(o) {
7
8
  var a, r, t = "";
8
9
  if (typeof o == "string" || typeof o == "number") t += o;
9
10
  else if (typeof o == "object") if (Array.isArray(o)) {
10
- var g = o.length;
11
- for (a = 0; a < g; a++) o[a] && (r = z(o[a])) && (t && (t += " "), t += r);
11
+ var k = o.length;
12
+ for (a = 0; a < k; a++) o[a] && (r = F(o[a])) && (t && (t += " "), t += r);
12
13
  } else for (r in o) o[r] && (t && (t += " "), t += r);
13
14
  return t;
14
15
  }
15
- function h() {
16
- for (var o, a, r = 0, t = "", g = arguments.length; r < g; r++) (o = arguments[r]) && (a = z(o)) && (t && (t += " "), t += a);
16
+ function v() {
17
+ for (var o, a, r = 0, t = "", k = arguments.length; r < k; r++) (o = arguments[r]) && (a = F(o)) && (t && (t += " "), t += a);
17
18
  return t;
18
19
  }
19
- function K({
20
+ function ao({
20
21
  selectedEntryId: o,
21
22
  selectedJogakName: a,
22
23
  onSelect: r
23
24
  }) {
24
- const [t, g] = f(""), { metaTree: n, searchMeta: k } = q(), s = t.trim().length > 0 ? k(t) : null;
25
+ const [t, k] = m(""), { metaTree: n, searchMeta: s } = X(), l = t.trim().length > 0 ? s(t) : null;
25
26
  return /* @__PURE__ */ j(
26
27
  "aside",
27
28
  {
@@ -34,23 +35,23 @@ function K({
34
35
  type: "search",
35
36
  placeholder: "Search components...",
36
37
  value: t,
37
- onChange: (l) => {
38
- g(l.target.value);
38
+ onChange: (g) => {
39
+ k(g.target.value);
39
40
  },
40
41
  className: "jogak:w-full jogak:px-2 jogak:py-1.5 jogak:border jogak:border-[var(--jogak-color-border-strong)] jogak:rounded-[var(--jogak-radius-md)]",
41
42
  "aria-label": "Search components"
42
43
  }
43
44
  ) }),
44
- /* @__PURE__ */ e("nav", { className: "jogak:flex-1 jogak:overflow-auto jogak:py-2", children: s !== null ? /* @__PURE__ */ e(
45
- T,
45
+ /* @__PURE__ */ e("nav", { className: "jogak:flex-1 jogak:overflow-auto jogak:py-2", children: l !== null ? /* @__PURE__ */ e(
46
+ eo,
46
47
  {
47
- metas: s,
48
+ metas: l,
48
49
  selectedEntryId: o,
49
50
  selectedJogakName: a,
50
51
  onSelect: r
51
52
  }
52
53
  ) : /* @__PURE__ */ e(
53
- D,
54
+ H,
54
55
  {
55
56
  node: n,
56
57
  selectedEntryId: o,
@@ -62,107 +63,107 @@ function K({
62
63
  }
63
64
  );
64
65
  }
65
- function T({
66
+ function eo({
66
67
  metas: o,
67
68
  selectedEntryId: a,
68
69
  selectedJogakName: r,
69
70
  onSelect: t
70
71
  }) {
71
- return o.length === 0 ? /* @__PURE__ */ e("p", { className: "jogak:px-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px]", children: "No results" }) : /* @__PURE__ */ e("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0", children: o.map((g) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
72
- F,
72
+ return o.length === 0 ? /* @__PURE__ */ e("p", { className: "jogak:px-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px]", children: "No results" }) : /* @__PURE__ */ e("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0", children: o.map((k) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
73
+ U,
73
74
  {
74
- meta: g,
75
+ meta: k,
75
76
  selectedEntryId: a,
76
77
  selectedJogakName: r,
77
78
  onSelect: t,
78
79
  indent: 0
79
80
  }
80
- ) }, g.id)) });
81
+ ) }, k.id)) });
81
82
  }
82
- function D({
83
+ function H({
83
84
  node: o,
84
85
  selectedEntryId: a,
85
86
  selectedJogakName: r,
86
87
  onSelect: t,
87
- depth: g = 0
88
+ depth: k = 0
88
89
  }) {
89
90
  return /* @__PURE__ */ e(
90
91
  "ul",
91
92
  {
92
93
  className: "jogak:list-none jogak:m-0 jogak:pr-0 jogak:py-0 jogak:pl-[var(--jogak-tree-pl)]",
93
- style: { "--jogak-tree-pl": `${g * 12}px` },
94
- children: Object.entries(o).map(([n, k]) => /* @__PURE__ */ e("li", { children: "id" in k ? /* @__PURE__ */ e(
95
- F,
94
+ style: { "--jogak-tree-pl": `${k * 12}px` },
95
+ children: Object.entries(o).map(([n, s]) => /* @__PURE__ */ e("li", { children: "id" in s ? /* @__PURE__ */ e(
96
+ U,
96
97
  {
97
- meta: k,
98
+ meta: s,
98
99
  selectedEntryId: a,
99
100
  selectedJogakName: r,
100
101
  onSelect: t,
101
102
  indent: 0
102
103
  }
103
104
  ) : /* @__PURE__ */ e(
104
- oo,
105
+ ro,
105
106
  {
106
107
  label: n,
107
- node: k,
108
+ node: s,
108
109
  selectedEntryId: a,
109
110
  selectedJogakName: r,
110
111
  onSelect: t,
111
- depth: g + 1
112
+ depth: k + 1
112
113
  }
113
114
  ) }, n))
114
115
  }
115
116
  );
116
117
  }
117
- function oo({
118
+ function ro({
118
119
  label: o,
119
120
  node: a,
120
121
  selectedEntryId: r,
121
122
  selectedJogakName: t,
122
- onSelect: g,
123
+ onSelect: k,
123
124
  depth: n
124
125
  }) {
125
- const [k, s] = f(!0);
126
+ const [s, l] = m(!0);
126
127
  return /* @__PURE__ */ j("div", { children: [
127
128
  /* @__PURE__ */ j(
128
129
  "button",
129
130
  {
130
131
  type: "button",
131
132
  onClick: () => {
132
- s((l) => !l);
133
+ l((g) => !g);
133
134
  },
134
135
  className: "jogak:flex jogak:items-center jogak:gap-1 jogak:w-full jogak:px-3 jogak:py-1 jogak:bg-transparent jogak:border-none jogak:cursor-pointer jogak:text-[12px] jogak:font-semibold jogak:text-[var(--jogak-color-fg-muted)] jogak:uppercase jogak:tracking-wider",
135
- "aria-expanded": k,
136
+ "aria-expanded": s,
136
137
  children: [
137
- /* @__PURE__ */ e("span", { children: k ? "▾" : "▸" }),
138
+ /* @__PURE__ */ e("span", { children: s ? "▾" : "▸" }),
138
139
  o
139
140
  ]
140
141
  }
141
142
  ),
142
- k && /* @__PURE__ */ e(
143
- D,
143
+ s && /* @__PURE__ */ e(
144
+ H,
144
145
  {
145
146
  node: a,
146
147
  selectedEntryId: r,
147
148
  selectedJogakName: t,
148
- onSelect: g,
149
+ onSelect: k,
149
150
  depth: n
150
151
  }
151
152
  )
152
153
  ] });
153
154
  }
154
- function F({
155
+ function U({
155
156
  meta: o,
156
157
  selectedEntryId: a,
157
158
  selectedJogakName: r,
158
159
  onSelect: t,
159
- indent: g
160
+ indent: k
160
161
  }) {
161
- const n = o.id === a, [k, s] = f(n);
162
- w(() => {
163
- n && s(!0);
162
+ const n = o.id === a, [s, l] = m(n);
163
+ b(() => {
164
+ n && l(!0);
164
165
  }, [n]);
165
- const l = o.title.split("/").pop() ?? o.title, b = 16 + g * 12;
166
+ const g = o.title.split("/").pop() ?? o.title, i = 16 + k * 12;
166
167
  return /* @__PURE__ */ j("div", { children: [
167
168
  /* @__PURE__ */ j(
168
169
  "button",
@@ -170,57 +171,57 @@ function F({
170
171
  type: "button",
171
172
  onClick: () => {
172
173
  if (n)
173
- s((i) => !i);
174
+ l((c) => !c);
174
175
  else {
175
- s(!0);
176
- const i = o.jogakNames[0];
177
- i !== void 0 && t(o.id, i);
176
+ l(!0);
177
+ const c = o.jogakNames[0];
178
+ c !== void 0 && t(o.id, c);
178
179
  }
179
180
  },
180
- className: h(
181
+ className: v(
181
182
  "jogak:flex jogak:items-center jogak:gap-1.5 jogak:w-full jogak:pr-3 jogak:py-[5px]",
182
183
  "jogak:pl-[var(--jogak-entry-pl)]",
183
184
  "jogak:border-none jogak:cursor-pointer jogak:text-left jogak:text-[13px]",
184
185
  n ? "jogak:bg-[var(--jogak-color-accent-bg)] jogak:text-[var(--jogak-color-accent)] jogak:font-medium" : "jogak:bg-transparent jogak:text-[var(--jogak-color-fg)] jogak:font-normal"
185
186
  ),
186
- style: { "--jogak-entry-pl": `${b}px` },
187
- "aria-expanded": k,
187
+ style: { "--jogak-entry-pl": `${i}px` },
188
+ "aria-expanded": s,
188
189
  children: [
189
- /* @__PURE__ */ e("span", { className: "jogak:text-[10px] jogak:shrink-0 jogak:leading-none", children: k ? "▾" : "▸" }),
190
- l
190
+ /* @__PURE__ */ e("span", { className: "jogak:text-[10px] jogak:shrink-0 jogak:leading-none", children: s ? "▾" : "▸" }),
191
+ g
191
192
  ]
192
193
  }
193
194
  ),
194
- k && /* @__PURE__ */ e("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0", children: o.jogakNames.map((i) => {
195
- const u = n && i === r;
195
+ s && /* @__PURE__ */ e("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0", children: o.jogakNames.map((c) => {
196
+ const p = n && c === r;
196
197
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
197
198
  "button",
198
199
  {
199
200
  type: "button",
200
201
  onClick: () => {
201
- t(o.id, i);
202
+ t(o.id, c);
202
203
  },
203
- className: h(
204
+ className: v(
204
205
  "jogak:block jogak:w-full jogak:text-left jogak:pr-3 jogak:py-1",
205
206
  "jogak:pl-[var(--jogak-jogak-pl)]",
206
207
  "jogak:border-none jogak:cursor-pointer jogak:text-[12px]",
207
- u ? "jogak:bg-[var(--jogak-color-accent-bg-soft)] jogak:text-[var(--jogak-color-accent-fg)] jogak:font-medium" : "jogak:bg-transparent jogak:text-[var(--jogak-color-fg-muted)] jogak:font-normal"
208
+ p ? "jogak:bg-[var(--jogak-color-accent-bg-soft)] jogak:text-[var(--jogak-color-accent-fg)] jogak:font-medium" : "jogak:bg-transparent jogak:text-[var(--jogak-color-fg-muted)] jogak:font-normal"
208
209
  ),
209
- style: { "--jogak-jogak-pl": `${b + 18}px` },
210
- "aria-current": u ? "true" : void 0,
211
- children: i
210
+ style: { "--jogak-jogak-pl": `${i + 18}px` },
211
+ "aria-current": p ? "true" : void 0,
212
+ children: c
212
213
  }
213
- ) }, i);
214
+ ) }, c);
214
215
  }) })
215
216
  ] });
216
217
  }
217
- function ao(o, a) {
218
- const r = a == null ? void 0 : a.control, t = (a == null ? void 0 : a.action) !== void 0 && a.action !== !1, g = (a == null ? void 0 : a.type) === "function" || typeof o == "function";
219
- return t || g ? "action" : r === "boolean" || typeof o == "boolean" ? "boolean" : r === "number" || r === "range" || typeof o == "number" ? "number" : r === "select" || r === "radio" || (a == null ? void 0 : a.options) !== void 0 && a.options.length > 0 ? "select" : r === "text" || r === "color" || typeof o == "string" ? "text" : "json";
218
+ function to(o, a) {
219
+ const r = a == null ? void 0 : a.control, t = (a == null ? void 0 : a.action) !== void 0 && a.action !== !1, k = (a == null ? void 0 : a.type) === "function" || typeof o == "function";
220
+ return t || k ? "action" : r === "boolean" || typeof o == "boolean" ? "boolean" : r === "number" || r === "range" || typeof o == "number" ? "number" : r === "select" || r === "radio" || (a == null ? void 0 : a.options) !== void 0 && a.options.length > 0 ? "select" : r === "text" || r === "color" || typeof o == "string" ? "text" : "json";
220
221
  }
221
- const R = "jogak:px-2 jogak:py-1 jogak:border jogak:border-[var(--jogak-color-border-strong)] jogak:rounded-[var(--jogak-radius-md)] jogak:text-[13px] jogak:w-full jogak:max-w-[280px]", _ = "jogak:px-5 jogak:py-1.5 jogak:text-left jogak:text-[var(--jogak-color-fg-muted)] jogak:font-medium jogak:text-[12px] jogak:border-b jogak:border-[var(--jogak-color-border)]", $ = "jogak:px-5 jogak:py-2 jogak:align-middle jogak:border-b jogak:border-[var(--jogak-color-border-muted)]";
222
- function eo({ argKey: o, value: a, argType: r, onArgChange: t }) {
223
- switch (ao(a, r)) {
222
+ const $ = "jogak:px-2 jogak:py-1 jogak:border jogak:border-[var(--jogak-color-border-strong)] jogak:rounded-[var(--jogak-radius-md)] jogak:text-[13px] jogak:w-full jogak:max-w-[280px]", L = "jogak:px-5 jogak:py-1.5 jogak:text-left jogak:text-[var(--jogak-color-fg-muted)] jogak:font-medium jogak:text-[12px] jogak:border-b jogak:border-[var(--jogak-color-border)]", E = "jogak:px-5 jogak:py-2 jogak:align-middle jogak:border-b jogak:border-[var(--jogak-color-border-muted)]";
223
+ function no({ argKey: o, value: a, argType: r, onArgChange: t }) {
224
+ switch (to(a, r)) {
224
225
  case "boolean":
225
226
  return /* @__PURE__ */ e(
226
227
  "input",
@@ -242,7 +243,7 @@ function eo({ argKey: o, value: a, argType: r, onArgChange: t }) {
242
243
  onChange: (n) => {
243
244
  t(o, n.target.valueAsNumber);
244
245
  },
245
- className: R
246
+ className: $
246
247
  }
247
248
  );
248
249
  case "select": {
@@ -251,11 +252,11 @@ function eo({ argKey: o, value: a, argType: r, onArgChange: t }) {
251
252
  "select",
252
253
  {
253
254
  value: String(a ?? ""),
254
- onChange: (k) => {
255
- t(o, k.target.value);
255
+ onChange: (s) => {
256
+ t(o, s.target.value);
256
257
  },
257
- className: R,
258
- children: n.map((k) => /* @__PURE__ */ e("option", { value: String(k), children: String(k) }, String(k)))
258
+ className: $,
259
+ children: n.map((s) => /* @__PURE__ */ e("option", { value: String(s), children: String(s) }, String(s)))
259
260
  }
260
261
  );
261
262
  }
@@ -268,7 +269,7 @@ function eo({ argKey: o, value: a, argType: r, onArgChange: t }) {
268
269
  onChange: (n) => {
269
270
  t(o, n.target.value);
270
271
  },
271
- className: R
272
+ className: $
272
273
  }
273
274
  );
274
275
  case "action":
@@ -277,45 +278,45 @@ function eo({ argKey: o, value: a, argType: r, onArgChange: t }) {
277
278
  return /* @__PURE__ */ e("code", { className: "jogak:text-[12px] jogak:text-[var(--jogak-color-fg-muted)] jogak:font-[family-name:var(--jogak-font-mono)]", children: JSON.stringify(a) });
278
279
  }
279
280
  }
280
- function ro({ args: o, argTypes: a, onArgChange: r }) {
281
- const g = Array.from(/* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(a)])).map((n) => [n, o[n]]);
281
+ function go({ args: o, argTypes: a, onArgChange: r }) {
282
+ const k = Array.from(/* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(a)])).map((n) => [n, o[n]]);
282
283
  return /* @__PURE__ */ j("div", { className: "jogak:border-t-2 jogak:border-[var(--jogak-color-border)]", children: [
283
284
  /* @__PURE__ */ e("div", { className: "jogak:px-5 jogak:py-1.5 jogak:text-[11px] jogak:font-bold jogak:text-[var(--jogak-color-fg-subtle)] jogak:uppercase jogak:tracking-[0.08em] jogak:border-b jogak:border-[var(--jogak-color-border)] jogak:bg-[var(--jogak-color-bg-subtle)]", children: "Controls" }),
284
- g.length === 0 ? /* @__PURE__ */ e("div", { className: "jogak:px-5 jogak:py-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px]", children: "No args defined" }) : /* @__PURE__ */ j("table", { className: "jogak:w-full jogak:border-collapse jogak:text-[13px]", children: [
285
+ k.length === 0 ? /* @__PURE__ */ e("div", { className: "jogak:px-5 jogak:py-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px]", children: "No args defined" }) : /* @__PURE__ */ j("table", { className: "jogak:w-full jogak:border-collapse jogak:text-[13px]", children: [
285
286
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ j("tr", { children: [
286
- /* @__PURE__ */ e("th", { className: _, children: "Name" }),
287
- /* @__PURE__ */ e("th", { className: _, children: "Control" }),
288
- /* @__PURE__ */ e("th", { className: _, children: "Description" })
287
+ /* @__PURE__ */ e("th", { className: L, children: "Name" }),
288
+ /* @__PURE__ */ e("th", { className: L, children: "Control" }),
289
+ /* @__PURE__ */ e("th", { className: L, children: "Description" })
289
290
  ] }) }),
290
- /* @__PURE__ */ e("tbody", { children: g.map(([n, k]) => {
291
- const s = a[n];
291
+ /* @__PURE__ */ e("tbody", { children: k.map(([n, s]) => {
292
+ const l = a[n];
292
293
  return /* @__PURE__ */ j("tr", { children: [
293
294
  /* @__PURE__ */ e(
294
295
  "td",
295
296
  {
296
- className: h(
297
- $,
297
+ className: v(
298
+ E,
298
299
  "jogak:font-[family-name:var(--jogak-font-mono)] jogak:text-[12px] jogak:text-[var(--jogak-color-fg)] jogak:whitespace-nowrap"
299
300
  ),
300
301
  children: n
301
302
  }
302
303
  ),
303
- /* @__PURE__ */ e("td", { className: $, children: /* @__PURE__ */ e(
304
- eo,
304
+ /* @__PURE__ */ e("td", { className: E, children: /* @__PURE__ */ e(
305
+ no,
305
306
  {
306
307
  argKey: n,
307
- value: k,
308
- argType: s,
308
+ value: s,
309
+ argType: l,
309
310
  onArgChange: r
310
311
  }
311
312
  ) }),
312
- /* @__PURE__ */ e("td", { className: h($, "jogak:text-[var(--jogak-color-fg-subtle)]"), children: (s == null ? void 0 : s.description) ?? "" })
313
+ /* @__PURE__ */ e("td", { className: v(E, "jogak:text-[var(--jogak-color-fg-subtle)]"), children: (l == null ? void 0 : l.description) ?? "" })
313
314
  ] }, n);
314
315
  }) })
315
316
  ] })
316
317
  ] });
317
318
  }
318
- function to(o) {
319
+ function so(o) {
319
320
  if (o.length === 0) return "()";
320
321
  try {
321
322
  return o.map((a) => {
@@ -333,13 +334,13 @@ function to(o) {
333
334
  return "[unserializable]";
334
335
  }
335
336
  }
336
- function no(o) {
337
- const a = new Date(o), r = a.getHours().toString().padStart(2, "0"), t = a.getMinutes().toString().padStart(2, "0"), g = a.getSeconds().toString().padStart(2, "0"), n = a.getMilliseconds().toString().padStart(3, "0");
338
- return `${r}:${t}:${g}.${n}`;
337
+ function ko(o) {
338
+ const a = new Date(o), r = a.getHours().toString().padStart(2, "0"), t = a.getMinutes().toString().padStart(2, "0"), k = a.getSeconds().toString().padStart(2, "0"), n = a.getMilliseconds().toString().padStart(3, "0");
339
+ return `${r}:${t}:${k}.${n}`;
339
340
  }
340
- function go() {
341
- const [o, a] = f(() => S.getLogs());
342
- w(() => S.subscribe(a), []);
341
+ function lo() {
342
+ const [o, a] = m(() => A.getLogs());
343
+ b(() => A.subscribe(a), []);
343
344
  const r = o.length === 0;
344
345
  return /* @__PURE__ */ j("div", { className: "jogak:h-full jogak:flex jogak:flex-col", children: [
345
346
  /* @__PURE__ */ j("div", { className: "jogak:px-5 jogak:py-1.5 jogak:text-[11px] jogak:font-bold jogak:text-[var(--jogak-color-fg-subtle)] jogak:uppercase jogak:tracking-[0.08em] jogak:border-b jogak:border-[var(--jogak-color-border)] jogak:bg-[var(--jogak-color-bg-subtle)] jogak:flex jogak:items-center jogak:justify-between jogak:shrink-0", children: [
@@ -352,10 +353,10 @@ function go() {
352
353
  {
353
354
  type: "button",
354
355
  onClick: () => {
355
- S.clear();
356
+ A.clear();
356
357
  },
357
358
  disabled: r,
358
- className: h(
359
+ className: v(
359
360
  "jogak:text-[10px] jogak:font-semibold jogak:px-2 jogak:py-0.5 jogak:border jogak:border-[var(--jogak-color-border-strong)] jogak:rounded-[var(--jogak-radius-sm)] jogak:bg-[var(--jogak-color-bg)] jogak:normal-case jogak:tracking-normal",
360
361
  r ? "jogak:text-[var(--jogak-color-fg-subtle)] jogak:cursor-default" : "jogak:text-[var(--jogak-color-fg)] jogak:cursor-pointer"
361
362
  ),
@@ -368,11 +369,11 @@ function go() {
368
369
  {
369
370
  className: "jogak:flex jogak:items-baseline jogak:gap-[10px] jogak:px-5 jogak:py-1.5 jogak:border-b jogak:border-[var(--jogak-color-border-muted)]",
370
371
  children: [
371
- /* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[11px] jogak:min-w-[92px]", children: no(t.timestamp) }),
372
+ /* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[11px] jogak:min-w-[92px]", children: ko(t.timestamp) }),
372
373
  /* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-violet)] jogak:font-semibold", children: t.name }),
373
374
  /* @__PURE__ */ j("span", { className: "jogak:text-[var(--jogak-color-fg)] jogak:break-all jogak:flex-1", children: [
374
375
  "(",
375
- to(t.args),
376
+ so(t.args),
376
377
  ")"
377
378
  ] })
378
379
  ]
@@ -381,15 +382,72 @@ function go() {
381
382
  )) }) })
382
383
  ] });
383
384
  }
384
- const U = {
385
+ function jo({
386
+ children: o,
387
+ className: a,
388
+ style: r,
389
+ "data-testid": t
390
+ }) {
391
+ const k = _(null), [n, s] = m(null);
392
+ return b(() => {
393
+ const l = k.current;
394
+ if (l === null) return;
395
+ const g = l.shadowRoot ?? l.attachShadow({ mode: "open" });
396
+ s(g);
397
+ }, []), /* @__PURE__ */ e(
398
+ "div",
399
+ {
400
+ ref: k,
401
+ className: a,
402
+ "data-testid": t,
403
+ style: r,
404
+ children: n !== null ? oo(o, n) : null
405
+ }
406
+ );
407
+ }
408
+ function io({
409
+ entry: o,
410
+ args: a,
411
+ className: r,
412
+ "data-testid": t
413
+ }) {
414
+ const k = _(null), n = _(!1);
415
+ return b(() => {
416
+ const s = k.current;
417
+ if (s === null) return;
418
+ const l = () => {
419
+ var g, i;
420
+ n.current = !0, (i = (g = s.contentWindow) == null ? void 0 : g.__jogak_setProps__) == null || i.call(g, { entry: o, args: a });
421
+ };
422
+ return s.addEventListener("load", l), () => {
423
+ s.removeEventListener("load", l), queueMicrotask(() => {
424
+ var g, i;
425
+ (i = (g = s.contentWindow) == null ? void 0 : g.__jogak_unmount__) == null || i.call(g);
426
+ });
427
+ };
428
+ }, []), b(() => {
429
+ var s, l, g;
430
+ n.current && ((g = (l = (s = k.current) == null ? void 0 : s.contentWindow) == null ? void 0 : l.__jogak_setProps__) == null || g.call(l, { entry: o, args: a }));
431
+ }, [o, a]), /* @__PURE__ */ e(
432
+ "iframe",
433
+ {
434
+ ref: k,
435
+ src: "/preview-frame.html",
436
+ title: "Preview",
437
+ className: r,
438
+ "data-testid": t
439
+ }
440
+ );
441
+ }
442
+ const q = {
385
443
  mobile: 375,
386
444
  tablet: 768,
387
445
  desktop: "none"
388
- }, so = {
446
+ }, co = {
389
447
  mobile: "Mobile",
390
448
  tablet: "Tablet",
391
449
  desktop: "Desktop"
392
- }, O = {
450
+ }, P = {
393
451
  white: {
394
452
  "--jogak-canvas-bg": "#ffffff",
395
453
  "--jogak-canvas-bg-image": "none",
@@ -408,21 +466,22 @@ const U = {
408
466
  "--jogak-canvas-bg-size": "16px 16px",
409
467
  "--jogak-canvas-bg-position": "0 0, 0 8px, 8px -8px, -8px 0px"
410
468
  }
411
- }, L = "jogak:bg-[var(--jogak-canvas-bg)] jogak:bg-[image:var(--jogak-canvas-bg-image)] jogak:bg-[length:var(--jogak-canvas-bg-size)] jogak:bg-[position:var(--jogak-canvas-bg-position)]";
412
- function ko(o) {
413
- return B[o] ?? B.vsDark;
469
+ }, M = "jogak:bg-[var(--jogak-canvas-bg)] jogak:bg-[image:var(--jogak-canvas-bg-image)] jogak:bg-[length:var(--jogak-canvas-bg-size)] jogak:bg-[position:var(--jogak-canvas-bg-position)]";
470
+ function uo(o) {
471
+ return z[o] ?? z.vsDark;
414
472
  }
415
- function lo({
473
+ function po({
416
474
  entryId: o,
417
475
  jogakName: a,
418
476
  overrideArgs: r,
419
477
  onArgChange: t,
420
- onReset: g,
478
+ onReset: k,
421
479
  codeTheme: n,
422
- onResolveJogak: k
480
+ onResolveJogak: s,
481
+ previewIsolation: l = "shadow"
423
482
  }) {
424
- const s = Q(o), [l, b] = f("desktop"), [i, u] = f("white"), [v, m] = f("controls"), x = ko(n);
425
- return s.status === "unknown" ? /* @__PURE__ */ j(
483
+ const g = Y(o), [i, c] = m("desktop"), [p, w] = m("white"), [N, h] = m("controls"), x = uo(n);
484
+ return g.status === "unknown" ? /* @__PURE__ */ j(
426
485
  "div",
427
486
  {
428
487
  "data-testid": "preview-not-found",
@@ -432,7 +491,7 @@ function lo({
432
491
  o
433
492
  ]
434
493
  }
435
- ) : s.status === "error" ? /* @__PURE__ */ j(
494
+ ) : g.status === "error" ? /* @__PURE__ */ j(
436
495
  "div",
437
496
  {
438
497
  "data-testid": "preview-error",
@@ -442,47 +501,48 @@ function lo({
442
501
  "Failed to load entry: ",
443
502
  o
444
503
  ] }),
445
- /* @__PURE__ */ e("pre", { className: "jogak:m-0 jogak:p-3 jogak:bg-[var(--jogak-color-bg)] jogak:border jogak:border-[var(--jogak-color-error-border)] jogak:rounded-[var(--jogak-radius-lg)] jogak:text-[12px] jogak:whitespace-pre-wrap jogak:max-w-full", children: s.error.message })
504
+ /* @__PURE__ */ e("pre", { className: "jogak:m-0 jogak:p-3 jogak:bg-[var(--jogak-color-bg)] jogak:border jogak:border-[var(--jogak-color-error-border)] jogak:rounded-[var(--jogak-radius-lg)] jogak:text-[12px] jogak:whitespace-pre-wrap jogak:max-w-full", children: g.error.message })
446
505
  ]
447
506
  }
448
- ) : s.status === "loading" ? /* @__PURE__ */ e(
449
- jo,
507
+ ) : g.status === "loading" ? /* @__PURE__ */ e(
508
+ fo,
450
509
  {
451
- meta: s.meta,
510
+ meta: g.meta,
452
511
  jogakName: a,
453
- viewport: l,
454
- bgMode: i,
455
- onViewportChange: b,
456
- onBgModeChange: u
512
+ viewport: i,
513
+ bgMode: p,
514
+ onViewportChange: c,
515
+ onBgModeChange: w
457
516
  }
458
517
  ) : /* @__PURE__ */ e(
459
- io,
518
+ mo,
460
519
  {
461
- entry: s.entry,
520
+ entry: g.entry,
462
521
  jogakName: a,
463
522
  overrideArgs: r,
464
523
  onArgChange: t,
465
- onReset: g,
466
- onResolveJogak: k,
467
- viewport: l,
468
- bgMode: i,
469
- bottomTab: v,
470
- onViewportChange: b,
471
- onBgModeChange: u,
472
- onBottomTabChange: m,
473
- prismTheme: x
524
+ onReset: k,
525
+ onResolveJogak: s,
526
+ viewport: i,
527
+ bgMode: p,
528
+ bottomTab: N,
529
+ onViewportChange: c,
530
+ onBgModeChange: w,
531
+ onBottomTabChange: h,
532
+ prismTheme: x,
533
+ previewIsolation: l
474
534
  }
475
535
  );
476
536
  }
477
- function jo({
537
+ function fo({
478
538
  meta: o,
479
539
  jogakName: a,
480
540
  viewport: r,
481
541
  bgMode: t,
482
- onViewportChange: g,
542
+ onViewportChange: k,
483
543
  onBgModeChange: n
484
544
  }) {
485
- const k = a ?? o.jogakNames[0] ?? "...", s = U[r];
545
+ const s = a ?? o.jogakNames[0] ?? "...", l = q[r];
486
546
  return /* @__PURE__ */ j(
487
547
  "div",
488
548
  {
@@ -490,13 +550,13 @@ function jo({
490
550
  className: "jogak:flex jogak:flex-col jogak:h-full",
491
551
  children: [
492
552
  /* @__PURE__ */ e(
493
- W,
553
+ G,
494
554
  {
495
555
  title: o.title,
496
- jogakName: k,
556
+ jogakName: s,
497
557
  viewport: r,
498
558
  bgMode: t,
499
- onViewportChange: g,
559
+ onViewportChange: k,
500
560
  onBgModeChange: n,
501
561
  showReset: !1,
502
562
  onReset: () => {
@@ -506,14 +566,14 @@ function jo({
506
566
  /* @__PURE__ */ e(
507
567
  "div",
508
568
  {
509
- className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${L}`,
510
- style: O[t],
569
+ className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${M}`,
570
+ style: P[t],
511
571
  children: /* @__PURE__ */ e(
512
572
  "div",
513
573
  {
514
574
  className: "jogak:mx-auto jogak:p-6 jogak:max-w-[var(--jogak-canvas-mw)]",
515
575
  style: {
516
- "--jogak-canvas-mw": s === "none" ? "100%" : `${s}px`
576
+ "--jogak-canvas-mw": l === "none" ? "100%" : `${l}px`
517
577
  },
518
578
  children: /* @__PURE__ */ j("div", { className: "jogak-skeleton-shimmer jogak:border jogak:border-dashed jogak:border-[var(--jogak-color-border)] jogak:rounded-[var(--jogak-radius-xl)] jogak:p-4 jogak:flex jogak:items-center jogak:justify-center jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px] jogak:min-h-[256px]", children: [
519
579
  "Loading ",
@@ -528,74 +588,76 @@ function jo({
528
588
  }
529
589
  );
530
590
  }
531
- function io({
591
+ function mo({
532
592
  entry: o,
533
593
  jogakName: a,
534
594
  overrideArgs: r,
535
595
  onArgChange: t,
536
- onReset: g,
596
+ onReset: k,
537
597
  onResolveJogak: n,
538
- viewport: k,
539
- bgMode: s,
540
- bottomTab: l,
541
- onViewportChange: b,
542
- onBgModeChange: i,
543
- onBottomTabChange: u,
544
- prismTheme: v
598
+ viewport: s,
599
+ bgMode: l,
600
+ bottomTab: g,
601
+ onViewportChange: i,
602
+ onBgModeChange: c,
603
+ onBottomTabChange: p,
604
+ prismTheme: w,
605
+ previewIsolation: N
545
606
  }) {
546
- var J;
547
- const m = a ?? ((J = o.jogaks[0]) == null ? void 0 : J.name) ?? null;
548
- if (w(() => {
549
- a === null && m !== null && n !== void 0 && n(o.id, m);
550
- }, [a, m, o.id, n]), m === null)
607
+ var V;
608
+ const h = a ?? ((V = o.jogaks[0]) == null ? void 0 : V.name) ?? null;
609
+ if (b(() => {
610
+ a === null && h !== null && n !== void 0 && n(o.id, h);
611
+ }, [a, h, o.id, n]), h === null)
551
612
  return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
552
613
  "Entry has no jogaks: ",
553
614
  o.id
554
615
  ] });
555
- const x = o.jogaks.find((N) => N.name === m);
616
+ const x = o.jogaks.find((y) => y.name === h);
556
617
  if (x === void 0)
557
618
  return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
558
619
  "Jogak not found: ",
559
- m
620
+ h
560
621
  ] });
561
- const d = { ...x.args ?? {}, ...r }, p = {
622
+ const u = { ...x.args ?? {}, ...r }, f = {
562
623
  ...o.meta.argTypes ?? {},
563
624
  ...x.argTypes ?? {}
564
- }, G = Object.keys(r).length > 0, E = U[k];
625
+ }, I = Object.keys(r).length > 0, J = q[s];
565
626
  return /* @__PURE__ */ j("div", { className: "jogak:flex jogak:flex-col jogak:h-full", children: [
566
627
  /* @__PURE__ */ e(
567
- W,
628
+ G,
568
629
  {
569
630
  title: o.title,
570
631
  jogakName: x.name,
571
- viewport: k,
572
- bgMode: s,
573
- onViewportChange: b,
574
- onBgModeChange: i,
575
- showReset: G,
576
- onReset: g
632
+ viewport: s,
633
+ bgMode: l,
634
+ onViewportChange: i,
635
+ onBgModeChange: c,
636
+ showReset: I,
637
+ onReset: k
577
638
  }
578
639
  ),
579
640
  /* @__PURE__ */ e(
580
641
  "div",
581
642
  {
582
- className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${L}`,
583
- style: O[s],
643
+ className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${M}`,
644
+ style: P[l],
584
645
  children: /* @__PURE__ */ e(
585
646
  "div",
586
647
  {
587
648
  "data-jogak-content": !0,
588
649
  className: "jogak:mx-auto jogak:p-6 jogak:max-w-[var(--jogak-canvas-mw)]",
589
650
  style: {
590
- "--jogak-canvas-mw": E === "none" ? "100%" : `${E}px`
651
+ "--jogak-canvas-mw": J === "none" ? "100%" : `${J}px`
591
652
  },
592
653
  children: /* @__PURE__ */ e(
593
- co,
654
+ bo,
594
655
  {
595
656
  entry: o,
596
- args: d,
657
+ args: u,
597
658
  source: o.source,
598
- theme: v
659
+ theme: w,
660
+ previewIsolation: N
599
661
  },
600
662
  `${o.id}/${x.name}`
601
663
  )
@@ -614,50 +676,50 @@ function io({
614
676
  {
615
677
  role: "tablist",
616
678
  className: "jogak:flex jogak:gap-1 jogak:pt-1 jogak:px-3 jogak:pb-0 jogak:bg-[var(--jogak-color-bg)] jogak:border-b jogak:border-[var(--jogak-color-border)] jogak:shrink-0",
617
- children: ["controls", "actions"].map((N) => {
618
- const P = l === N;
679
+ children: ["controls", "actions"].map((y) => {
680
+ const B = g === y;
619
681
  return /* @__PURE__ */ e(
620
682
  "button",
621
683
  {
622
684
  type: "button",
623
685
  role: "tab",
624
- "aria-selected": P,
686
+ "aria-selected": B,
625
687
  onClick: () => {
626
- u(N);
688
+ p(y);
627
689
  },
628
- className: h(
690
+ className: v(
629
691
  "jogak:px-[14px] jogak:py-[6px] jogak:text-[12px] jogak:bg-transparent jogak:border-x-0 jogak:border-t-0 jogak:border-b-2 jogak:border-solid jogak:-mb-px jogak:cursor-pointer jogak:capitalize",
630
- P ? "jogak:font-semibold jogak:text-[var(--jogak-color-fg-strong)] jogak:border-[var(--jogak-color-accent)]" : "jogak:font-medium jogak:text-[var(--jogak-color-fg-muted)] jogak:border-transparent"
692
+ B ? "jogak:font-semibold jogak:text-[var(--jogak-color-fg-strong)] jogak:border-[var(--jogak-color-accent)]" : "jogak:font-medium jogak:text-[var(--jogak-color-fg-muted)] jogak:border-transparent"
631
693
  ),
632
- children: N
694
+ children: y
633
695
  },
634
- N
696
+ y
635
697
  );
636
698
  })
637
699
  }
638
700
  ),
639
- /* @__PURE__ */ e("div", { className: "jogak:flex-1 jogak:min-h-0 jogak:overflow-auto", children: l === "controls" ? /* @__PURE__ */ e(
640
- ro,
701
+ /* @__PURE__ */ e("div", { className: "jogak:flex-1 jogak:min-h-0 jogak:overflow-auto", children: g === "controls" ? /* @__PURE__ */ e(
702
+ go,
641
703
  {
642
- args: d,
643
- argTypes: p,
704
+ args: u,
705
+ argTypes: f,
644
706
  onArgChange: t
645
707
  }
646
- ) : /* @__PURE__ */ e(go, {}) })
708
+ ) : /* @__PURE__ */ e(lo, {}) })
647
709
  ]
648
710
  }
649
711
  )
650
712
  ] });
651
713
  }
652
- function W({
714
+ function G({
653
715
  title: o,
654
716
  jogakName: a,
655
717
  viewport: r,
656
718
  bgMode: t,
657
- onViewportChange: g,
719
+ onViewportChange: k,
658
720
  onBgModeChange: n,
659
- showReset: k,
660
- onReset: s
721
+ showReset: s,
722
+ onReset: l
661
723
  }) {
662
724
  return /* @__PURE__ */ j("div", { className: "jogak:flex jogak:items-center jogak:gap-[10px] jogak:px-[14px] jogak:py-[7px] jogak:border-b jogak:border-[var(--jogak-color-border)] jogak:bg-[var(--jogak-color-bg)] jogak:shrink-0", children: [
663
725
  /* @__PURE__ */ j("div", { className: "jogak:flex-1 jogak:text-[13px]", children: [
@@ -665,102 +727,149 @@ function W({
665
727
  /* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-border-strong)] jogak:mx-1.5 jogak:leading-none", children: "/" }),
666
728
  /* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-fg-strong)] jogak:font-semibold", children: a })
667
729
  ] }),
668
- /* @__PURE__ */ e("div", { className: "jogak:flex jogak:gap-0.5 jogak:bg-[var(--jogak-color-bg-subtle)] jogak:rounded-[var(--jogak-radius-lg)] jogak:p-0.5", children: ["mobile", "tablet", "desktop"].map((l) => /* @__PURE__ */ e(
730
+ /* @__PURE__ */ e("div", { className: "jogak:flex jogak:gap-0.5 jogak:bg-[var(--jogak-color-bg-subtle)] jogak:rounded-[var(--jogak-radius-lg)] jogak:p-0.5", children: ["mobile", "tablet", "desktop"].map((g) => /* @__PURE__ */ e(
669
731
  "button",
670
732
  {
671
733
  type: "button",
672
734
  onClick: () => {
673
- g(l);
735
+ k(g);
674
736
  },
675
- "aria-pressed": r === l,
676
- className: h(
737
+ "aria-pressed": r === g,
738
+ className: v(
677
739
  "jogak:px-[9px] jogak:py-[3px] jogak:text-[12px] jogak:border-none jogak:rounded-[var(--jogak-radius-md)] jogak:cursor-pointer jogak:transition-all jogak:duration-100",
678
- r === l ? "jogak:bg-[var(--jogak-color-bg-elevated)] jogak:text-[var(--jogak-color-fg-strong)] jogak:font-semibold jogak:shadow-[0_1px_2px_rgba(0,0,0,0.08)]" : "jogak:bg-transparent jogak:text-[var(--jogak-color-fg-muted)] jogak:font-normal jogak:shadow-none"
740
+ r === g ? "jogak:bg-[var(--jogak-color-bg-elevated)] jogak:text-[var(--jogak-color-fg-strong)] jogak:font-semibold jogak:shadow-[0_1px_2px_rgba(0,0,0,0.08)]" : "jogak:bg-transparent jogak:text-[var(--jogak-color-fg-muted)] jogak:font-normal jogak:shadow-none"
679
741
  ),
680
- children: so[l]
742
+ children: co[g]
681
743
  },
682
- l
744
+ g
683
745
  )) }),
684
- /* @__PURE__ */ e("div", { className: "jogak:flex jogak:gap-1 jogak:items-center", children: ["white", "dark", "transparent"].map((l) => /* @__PURE__ */ e(
746
+ /* @__PURE__ */ e("div", { className: "jogak:flex jogak:gap-1 jogak:items-center", children: ["white", "dark", "transparent"].map((g) => /* @__PURE__ */ e(
685
747
  "button",
686
748
  {
687
749
  type: "button",
688
750
  onClick: () => {
689
- n(l);
751
+ n(g);
690
752
  },
691
- "aria-pressed": t === l,
692
- "aria-label": `${l} background`,
693
- className: h(
753
+ "aria-pressed": t === g,
754
+ "aria-label": `${g} background`,
755
+ className: v(
694
756
  "jogak:w-5 jogak:h-5 jogak:rounded-[var(--jogak-radius-md)] jogak:border-2 jogak:cursor-pointer jogak:p-0 jogak:shrink-0",
695
- L,
696
- t === l ? "jogak:border-[var(--jogak-color-accent)]" : "jogak:border-[var(--jogak-color-border-strong)]"
757
+ M,
758
+ t === g ? "jogak:border-[var(--jogak-color-accent)]" : "jogak:border-[var(--jogak-color-border-strong)]"
697
759
  ),
698
- style: O[l]
760
+ style: P[g]
699
761
  },
700
- l
762
+ g
701
763
  )) }),
702
- k && /* @__PURE__ */ e(
764
+ s && /* @__PURE__ */ e(
703
765
  "button",
704
766
  {
705
767
  type: "button",
706
- onClick: s,
768
+ onClick: l,
707
769
  className: "jogak:px-[10px] jogak:py-[3px] jogak:text-[12px] jogak:border jogak:border-[var(--jogak-color-border-strong)] jogak:rounded-[var(--jogak-radius-md)] jogak:bg-[var(--jogak-color-bg)] jogak:cursor-pointer jogak:text-[var(--jogak-color-fg)] jogak:leading-none",
708
770
  children: "Reset"
709
771
  }
710
772
  )
711
773
  ] });
712
774
  }
713
- function co({ entry: o, args: a, source: r, theme: t }) {
714
- const g = H(null), [n, k] = f(!1);
715
- return w(() => {
716
- const s = g.current;
717
- if (s !== null)
718
- return A.render(o, a, s), () => {
719
- A.unmount(s);
720
- };
721
- }, [o]), w(() => {
722
- const s = g.current;
723
- s !== null && A.render(o, a, s);
724
- }, [o, a]), /* @__PURE__ */ j("div", { children: [
725
- /* @__PURE__ */ j("div", { className: "jogak:relative", children: [
726
- /* @__PURE__ */ e(
727
- "div",
728
- {
729
- ref: g,
730
- "data-testid": "preview-content",
731
- className: "jogak:border jogak:border-dashed jogak:border-[var(--jogak-color-border)] jogak:rounded-[var(--jogak-radius-xl)] jogak:p-4 jogak:pb-9"
732
- }
733
- ),
734
- /* @__PURE__ */ e(
735
- "button",
736
- {
737
- type: "button",
738
- onClick: () => {
739
- k((s) => !s);
740
- },
741
- "aria-pressed": n,
742
- "aria-label": n ? "Hide source code" : "Show source code",
743
- className: h(
744
- "jogak:absolute jogak:bottom-2 jogak:right-2 jogak:px-[9px] jogak:py-1",
745
- "jogak:text-[11px] jogak:font-[family-name:var(--jogak-font-mono)] jogak:font-semibold jogak:tracking-[0.02em]",
746
- "jogak:text-[var(--jogak-color-bg)] jogak:border-none jogak:rounded-[5px] jogak:cursor-pointer",
747
- "jogak:shadow-[0_1px_4px_rgba(0,0,0,0.2)] jogak:transition-[background-color] jogak:duration-150 jogak:leading-none",
748
- n ? "jogak:bg-[var(--jogak-color-accent)]" : "jogak:bg-[#1e293b]"
749
- ),
750
- children: "</>"
751
- }
752
- )
753
- ] }),
754
- n && /* @__PURE__ */ e("div", { className: "jogak:mt-2 jogak:rounded-[var(--jogak-radius-xl)] jogak:overflow-hidden jogak:h-[320px] jogak:shadow-[0_0_0_1px_rgba(0,0,0,0.08),_0_4px_16px_rgba(0,0,0,0.12)]", children: /* @__PURE__ */ e(po, { source: r, theme: t }) })
775
+ function bo({ entry: o, args: a, source: r, theme: t, previewIsolation: k }) {
776
+ const [n, s] = m(!1), l = /* @__PURE__ */ j("div", { className: "jogak:relative", children: [
777
+ /* @__PURE__ */ e(
778
+ ho,
779
+ {
780
+ entry: o,
781
+ args: a,
782
+ previewIsolation: k
783
+ }
784
+ ),
785
+ /* @__PURE__ */ e(
786
+ "button",
787
+ {
788
+ type: "button",
789
+ onClick: () => {
790
+ s((g) => !g);
791
+ },
792
+ "aria-pressed": n,
793
+ "aria-label": n ? "Hide source code" : "Show source code",
794
+ className: v(
795
+ "jogak:absolute jogak:bottom-2 jogak:right-2 jogak:px-[9px] jogak:py-1",
796
+ "jogak:text-[11px] jogak:font-[family-name:var(--jogak-font-mono)] jogak:font-semibold jogak:tracking-[0.02em]",
797
+ "jogak:text-[var(--jogak-color-bg)] jogak:border-none jogak:rounded-[5px] jogak:cursor-pointer",
798
+ "jogak:shadow-[0_1px_4px_rgba(0,0,0,0.2)] jogak:transition-[background-color] jogak:duration-150 jogak:leading-none",
799
+ n ? "jogak:bg-[var(--jogak-color-accent)]" : "jogak:bg-[#1e293b]"
800
+ ),
801
+ children: "</>"
802
+ }
803
+ )
804
+ ] });
805
+ return /* @__PURE__ */ j("div", { children: [
806
+ l,
807
+ n && /* @__PURE__ */ e("div", { className: "jogak:mt-2 jogak:rounded-[var(--jogak-radius-xl)] jogak:overflow-hidden jogak:h-[320px] jogak:shadow-[0_0_0_1px_rgba(0,0,0,0.08),_0_4px_16px_rgba(0,0,0,0.12)]", children: /* @__PURE__ */ e(wo, { source: r, theme: t }) })
755
808
  ] });
756
809
  }
757
- function po({ source: o, theme: a }) {
758
- const [r, t] = f(!1), g = a.plain.backgroundColor ?? "#1e293b";
810
+ const O = "jogak:border jogak:border-dashed jogak:border-[var(--jogak-color-border)] jogak:rounded-[var(--jogak-radius-xl)] jogak:p-4 jogak:pb-9";
811
+ function ho({ entry: o, args: a, previewIsolation: r }) {
812
+ return r === "shadow" ? /* @__PURE__ */ e(
813
+ jo,
814
+ {
815
+ "data-testid": "preview-content",
816
+ className: O,
817
+ children: /* @__PURE__ */ e(vo, { entry: o, args: a })
818
+ }
819
+ ) : r === "iframe" ? /* @__PURE__ */ e(
820
+ io,
821
+ {
822
+ entry: o,
823
+ args: a,
824
+ "data-testid": "preview-content",
825
+ className: `${O} jogak:block jogak:w-full jogak:bg-transparent jogak:min-h-[256px]`
826
+ }
827
+ ) : /* @__PURE__ */ e(xo, { entry: o, args: a });
828
+ }
829
+ function xo({ entry: o, args: a }) {
830
+ const r = _(null);
831
+ return b(() => {
832
+ const t = r.current;
833
+ if (t !== null)
834
+ return S.render(o, a, t), () => {
835
+ queueMicrotask(() => {
836
+ S.unmount(t);
837
+ });
838
+ };
839
+ }, [o]), b(() => {
840
+ const t = r.current;
841
+ t !== null && S.render(o, a, t);
842
+ }, [o, a]), /* @__PURE__ */ e(
843
+ "div",
844
+ {
845
+ ref: r,
846
+ "data-testid": "preview-content",
847
+ className: O
848
+ }
849
+ );
850
+ }
851
+ function vo({ entry: o, args: a }) {
852
+ const r = _(null);
853
+ return b(() => {
854
+ const t = r.current;
855
+ if (t !== null)
856
+ return S.render(o, a, t), () => {
857
+ queueMicrotask(() => {
858
+ S.unmount(t);
859
+ });
860
+ };
861
+ }, [o]), b(() => {
862
+ const t = r.current;
863
+ t !== null && S.render(o, a, t);
864
+ }, [o, a]), /* @__PURE__ */ e("div", { ref: r, "data-testid": "preview-content-shadow" });
865
+ }
866
+ function wo({ source: o, theme: a }) {
867
+ const [r, t] = m(!1), k = a.plain.backgroundColor ?? "#1e293b";
759
868
  return o === void 0 ? /* @__PURE__ */ e(
760
869
  "div",
761
870
  {
762
871
  className: "jogak:h-full jogak:flex jogak:items-center jogak:justify-center jogak:bg-[var(--jogak-source-bg)] jogak:text-[#94a3b8] jogak:text-[13px]",
763
- style: { "--jogak-source-bg": g },
872
+ style: { "--jogak-source-bg": k },
764
873
  children: "Source not available"
765
874
  }
766
875
  ) : /* @__PURE__ */ j("div", { className: "jogak:relative jogak:h-full", children: [
@@ -779,124 +888,126 @@ function po({ source: o, theme: a }) {
779
888
  children: r ? "✓ Copied" : "Copy"
780
889
  }
781
890
  ),
782
- /* @__PURE__ */ e(Z, { code: o.trim(), language: "tsx", theme: a, children: ({ style: k, tokens: s, getLineProps: l, getTokenProps: b }) => /* @__PURE__ */ e(
891
+ /* @__PURE__ */ e(T, { code: o.trim(), language: "tsx", theme: a, children: ({ style: s, tokens: l, getLineProps: g, getTokenProps: i }) => /* @__PURE__ */ e(
783
892
  "pre",
784
893
  {
785
894
  className: "jogak:m-0 jogak:py-3 jogak:px-0 jogak:text-[12.5px] jogak:leading-[1.7] jogak:font-[family-name:var(--jogak-font-mono)] jogak:h-full jogak:box-border jogak:overflow-auto",
786
- style: k,
787
- children: s.map((i, u) => /* @__PURE__ */ j(
895
+ style: s,
896
+ children: l.map((c, p) => /* @__PURE__ */ j(
788
897
  "div",
789
898
  {
790
- ...l({ line: i }),
899
+ ...g({ line: c }),
791
900
  className: "jogak:flex jogak:pr-6",
792
- style: l({ line: i }).style,
901
+ style: g({ line: c }).style,
793
902
  children: [
794
- /* @__PURE__ */ e("span", { className: "jogak:select-none jogak:min-w-10 jogak:pl-[14px] jogak:pr-[14px] jogak:text-right jogak:text-[rgba(148,163,184,0.45)] jogak:shrink-0 jogak:leading-[1.7]", children: u + 1 }),
795
- /* @__PURE__ */ e("span", { children: i.map((v, m) => /* @__PURE__ */ e("span", { ...b({ token: v }) }, m)) })
903
+ /* @__PURE__ */ e("span", { className: "jogak:select-none jogak:min-w-10 jogak:pl-[14px] jogak:pr-[14px] jogak:text-right jogak:text-[rgba(148,163,184,0.45)] jogak:shrink-0 jogak:leading-[1.7]", children: p + 1 }),
904
+ /* @__PURE__ */ e("span", { children: c.map((w, N) => /* @__PURE__ */ e("span", { ...i({ token: w }) }, N)) })
796
905
  ]
797
906
  },
798
- u
907
+ p
799
908
  ))
800
909
  }
801
910
  ) })
802
911
  ] });
803
912
  }
804
- function M() {
913
+ function D() {
805
914
  if (typeof window > "u") return null;
806
915
  const o = new URLSearchParams(window.location.search), a = o.get("entry");
807
916
  if (a === null) return null;
808
917
  const r = o.get("jogak");
809
918
  return { entryId: a, jogakName: r };
810
919
  }
811
- function uo(o, a) {
920
+ function No(o, a) {
812
921
  const r = new URLSearchParams();
813
922
  r.set("entry", o), r.set("jogak", a), window.history.pushState({}, "", `?${r.toString()}`);
814
923
  }
815
- function vo({
924
+ function $o({
816
925
  entries: o,
817
926
  metas: a,
818
- codeTheme: r = "vsDark"
927
+ codeTheme: r = "vsDark",
928
+ previewIsolation: t = "shadow"
819
929
  } = {}) {
820
- const t = y(() => {
930
+ const k = C(() => {
821
931
  if (o !== void 0) {
822
932
  a !== void 0 && console.warn(
823
933
  "[jogak] JogakApp received both `entries` and `metas` — `entries` (eager) takes precedence."
824
934
  );
825
- const c = new I();
826
- for (const d of o) c.register(d);
827
- return c;
935
+ const d = new Q();
936
+ for (const u of o) d.register(u);
937
+ return d;
828
938
  }
829
939
  if (a !== void 0)
830
- for (const c of a) V.registerMeta(c);
831
- return V;
832
- }, [o, a]), g = y(() => M(), []), [n, k] = f(
833
- (g == null ? void 0 : g.entryId) ?? null
834
- ), [s, l] = f(
835
- (g == null ? void 0 : g.jogakName) ?? null
836
- ), [b, i] = f({});
837
- w(() => {
838
- const c = () => {
839
- const d = M();
840
- d !== null ? (k(d.entryId), l(d.jogakName), i({})) : (k(null), l(null));
940
+ for (const d of a) W.registerMeta(d);
941
+ return W;
942
+ }, [o, a]), n = C(() => D(), []), [s, l] = m(
943
+ (n == null ? void 0 : n.entryId) ?? null
944
+ ), [g, i] = m(
945
+ (n == null ? void 0 : n.jogakName) ?? null
946
+ ), [c, p] = m({});
947
+ b(() => {
948
+ const d = () => {
949
+ const u = D();
950
+ u !== null ? (l(u.entryId), i(u.jogakName), p({})) : (l(null), i(null));
841
951
  };
842
- return window.addEventListener("popstate", c), () => {
843
- window.removeEventListener("popstate", c);
952
+ return window.addEventListener("popstate", d), () => {
953
+ window.removeEventListener("popstate", d);
844
954
  };
845
955
  }, []);
846
- const u = C((c, d) => {
847
- k(c), l(d), i({}), uo(c, d);
848
- }, []), v = C((c, d) => {
849
- if (k((p) => p === c ? c : p), l((p) => p ?? d), typeof window < "u") {
850
- const p = new URLSearchParams(window.location.search);
851
- p.get("entry") === c && p.get("jogak") === null && (p.set("jogak", d), window.history.replaceState({}, "", `?${p.toString()}`));
956
+ const w = R((d, u) => {
957
+ l(d), i(u), p({}), No(d, u);
958
+ }, []), N = R((d, u) => {
959
+ if (l((f) => f === d ? d : f), i((f) => f ?? u), typeof window < "u") {
960
+ const f = new URLSearchParams(window.location.search);
961
+ f.get("entry") === d && f.get("jogak") === null && (f.set("jogak", u), window.history.replaceState({}, "", `?${f.toString()}`));
852
962
  }
853
- }, []), m = C((c, d) => {
854
- i((p) => ({ ...p, [c]: d }));
855
- }, []), x = C(() => {
856
- i({});
963
+ }, []), h = R((d, u) => {
964
+ p((f) => ({ ...f, [d]: u }));
965
+ }, []), x = R(() => {
966
+ p({});
857
967
  }, []);
858
- return /* @__PURE__ */ e(X, { registry: t, children: /* @__PURE__ */ j(
968
+ return /* @__PURE__ */ e(Z, { registry: k, children: /* @__PURE__ */ j(
859
969
  "div",
860
970
  {
861
971
  "data-jogak-shell": !0,
862
972
  className: "jogak:grid jogak:grid-cols-[260px_1fr] jogak:h-dvh jogak:overflow-hidden",
863
973
  children: [
864
974
  /* @__PURE__ */ e(
865
- K,
975
+ ao,
866
976
  {
867
- selectedEntryId: n,
868
- selectedJogakName: s,
869
- onSelect: u
977
+ selectedEntryId: s,
978
+ selectedJogakName: g,
979
+ onSelect: w
870
980
  }
871
981
  ),
872
- /* @__PURE__ */ e("main", { className: "jogak:overflow-hidden jogak:min-h-0", children: n !== null ? /* @__PURE__ */ e(
873
- lo,
982
+ /* @__PURE__ */ e("main", { className: "jogak:overflow-hidden jogak:min-h-0", children: s !== null ? /* @__PURE__ */ e(
983
+ po,
874
984
  {
875
- entryId: n,
876
- jogakName: s,
877
- overrideArgs: b,
878
- onArgChange: m,
985
+ entryId: s,
986
+ jogakName: g,
987
+ overrideArgs: c,
988
+ onArgChange: h,
879
989
  onReset: x,
880
990
  codeTheme: r,
881
- onResolveJogak: v
991
+ onResolveJogak: N,
992
+ previewIsolation: t
882
993
  }
883
994
  ) : /* @__PURE__ */ e("div", { className: "jogak:flex jogak:items-center jogak:justify-center jogak:h-full jogak:text-[var(--jogak-color-fg-subtle)]", children: "Select a component from the sidebar" }) })
884
995
  ]
885
996
  }
886
997
  ) });
887
998
  }
888
- function No() {
889
- const o = Y(), a = y(() => o.getAll(), [o]), r = y(() => o.getTree(), [o]), t = y(
890
- () => (g) => o.search(g),
999
+ function Lo() {
1000
+ const o = K(), a = C(() => o.getAll(), [o]), r = C(() => o.getTree(), [o]), t = C(
1001
+ () => (k) => o.search(k),
891
1002
  [o]
892
1003
  );
893
1004
  return { entries: a, tree: r, search: t };
894
1005
  }
895
1006
  export {
896
- go as Actions,
897
- ro as Controls,
898
- vo as JogakApp,
899
- lo as Preview,
900
- K as Sidebar,
901
- No as useRegistry
1007
+ lo as Actions,
1008
+ go as Controls,
1009
+ $o as JogakApp,
1010
+ po as Preview,
1011
+ ao as Sidebar,
1012
+ Lo as useRegistry
902
1013
  };