@jogak/ui 0.1.0-alpha.1 → 0.1.0-alpha.10.3

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,1217 +1,1096 @@
1
- import { jsxs as c, jsx as n } from "react/jsx-runtime";
2
- import { useState as x, useEffect as v, useRef as V, useMemo as w, useCallback as R } from "react";
3
- import { defaultActionChannel as z, ComponentRegistry as U, defaultRegistry as F } from "@jogak/core";
4
- import { useRegistryMeta as _, useEntry as G, reactAdapter as j, JogakProvider as T, useRegistry as q } from "@jogak/react";
5
- import { themes as L, Highlight as Q } from "prism-react-renderer";
6
- function Y({
7
- selectedEntryId: e,
8
- selectedJogakName: t,
9
- onSelect: o
1
+ import { jsxs as j, jsx as t } from "react/jsx-runtime";
2
+ import { useState as h, useEffect as x, useRef as L, useMemo as _, useCallback as A } from "react";
3
+ import { defaultActionChannel as E, ComponentRegistry as Z, defaultRegistry as H } from "@jogak/core";
4
+ import { useRegistryMeta as K, useEntry as T, reactAdapter as $, JogakProvider as oo, useRegistry as ao } from "@jogak/core/renderers/react";
5
+ import { themes as F, Highlight as eo } from "prism-react-renderer";
6
+ import { createPortal as to } from "react-dom";
7
+ function U(o) {
8
+ var a, e, r = "";
9
+ if (typeof o == "string" || typeof o == "number") r += o;
10
+ else if (typeof o == "object") if (Array.isArray(o)) {
11
+ var s = o.length;
12
+ for (a = 0; a < s; a++) o[a] && (e = U(o[a])) && (r && (r += " "), r += e);
13
+ } else for (e in o) o[e] && (r && (r += " "), r += e);
14
+ return r;
15
+ }
16
+ function N() {
17
+ for (var o, a, e = 0, r = "", s = arguments.length; e < s; e++) (o = arguments[e]) && (a = U(o)) && (r && (r += " "), r += a);
18
+ return r;
19
+ }
20
+ function ro({
21
+ selectedEntryId: o,
22
+ selectedJogakName: a,
23
+ onSelect: e
10
24
  }) {
11
- const [i, d] = x(""), { metaTree: r, searchMeta: s } = _(), l = i.trim().length > 0 ? s(i) : null;
12
- return /* @__PURE__ */ c(
25
+ const [r, s] = h(""), { metaTree: n, searchMeta: g } = K(), i = r.trim().length > 0 ? g(r) : null;
26
+ return /* @__PURE__ */ j(
13
27
  "aside",
14
28
  {
15
29
  "data-testid": "sidebar",
16
- style: {
17
- borderRight: "1px solid #e5e7eb",
18
- height: "100%",
19
- overflow: "auto",
20
- display: "flex",
21
- flexDirection: "column"
22
- },
30
+ className: "jogak:flex jogak:flex-col jogak:h-full jogak:overflow-auto jogak:border-r jogak:border-[var(--jogak-color-border)]",
23
31
  children: [
24
- /* @__PURE__ */ n("div", { style: { padding: "12px", borderBottom: "1px solid #e5e7eb" }, children: /* @__PURE__ */ n(
32
+ /* @__PURE__ */ t("div", { className: "jogak:p-3 jogak:border-b jogak:border-[var(--jogak-color-border)]", children: /* @__PURE__ */ t(
25
33
  "input",
26
34
  {
27
35
  type: "search",
28
36
  placeholder: "Search components...",
29
- value: i,
30
- onChange: (a) => {
31
- d(a.target.value);
32
- },
33
- style: {
34
- width: "100%",
35
- padding: "6px 8px",
36
- border: "1px solid #d1d5db",
37
- borderRadius: 4
37
+ value: r,
38
+ onChange: (k) => {
39
+ s(k.target.value);
38
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)]",
39
42
  "aria-label": "Search components"
40
43
  }
41
44
  ) }),
42
- /* @__PURE__ */ n("nav", { style: { flex: 1, overflow: "auto", padding: "8px 0" }, children: l !== null ? /* @__PURE__ */ n(
43
- X,
45
+ /* @__PURE__ */ t("nav", { className: "jogak:flex-1 jogak:overflow-auto jogak:py-2", children: i !== null ? /* @__PURE__ */ t(
46
+ no,
44
47
  {
45
- metas: l,
46
- selectedEntryId: e,
47
- selectedJogakName: t,
48
- onSelect: o
48
+ metas: i,
49
+ selectedEntryId: o,
50
+ selectedJogakName: a,
51
+ onSelect: e
49
52
  }
50
- ) : /* @__PURE__ */ n(
51
- H,
53
+ ) : /* @__PURE__ */ t(
54
+ q,
52
55
  {
53
- node: r,
54
- selectedEntryId: e,
55
- selectedJogakName: t,
56
- onSelect: o
56
+ node: n,
57
+ selectedEntryId: o,
58
+ selectedJogakName: a,
59
+ onSelect: e
57
60
  }
58
61
  ) })
59
62
  ]
60
63
  }
61
64
  );
62
65
  }
63
- function X({
64
- metas: e,
65
- selectedEntryId: t,
66
- selectedJogakName: o,
67
- onSelect: i
66
+ function no({
67
+ metas: o,
68
+ selectedEntryId: a,
69
+ selectedJogakName: e,
70
+ onSelect: r
68
71
  }) {
69
- return e.length === 0 ? /* @__PURE__ */ n("p", { style: { padding: "0 12px", color: "#9ca3af", fontSize: 13 }, children: "No results" }) : /* @__PURE__ */ n("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, children: e.map((d) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
70
- D,
72
+ return o.length === 0 ? /* @__PURE__ */ t("p", { className: "jogak:px-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px]", children: "No results" }) : /* @__PURE__ */ t("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0", children: o.map((s) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
73
+ G,
71
74
  {
72
- meta: d,
73
- selectedEntryId: t,
74
- selectedJogakName: o,
75
- onSelect: i,
75
+ meta: s,
76
+ selectedEntryId: a,
77
+ selectedJogakName: e,
78
+ onSelect: r,
76
79
  indent: 0
77
80
  }
78
- ) }, d.id)) });
81
+ ) }, s.id)) });
79
82
  }
80
- function H({
81
- node: e,
82
- selectedEntryId: t,
83
- selectedJogakName: o,
84
- onSelect: i,
85
- depth: d = 0
83
+ function q({
84
+ node: o,
85
+ selectedEntryId: a,
86
+ selectedJogakName: e,
87
+ onSelect: r,
88
+ depth: s = 0
86
89
  }) {
87
- return /* @__PURE__ */ n(
90
+ return /* @__PURE__ */ t(
88
91
  "ul",
89
92
  {
90
- style: {
91
- listStyle: "none",
92
- margin: 0,
93
- padding: `0 0 0 ${d * 12}px`
94
- },
95
- children: Object.entries(e).map(([r, s]) => /* @__PURE__ */ n("li", { children: "id" in s ? /* @__PURE__ */ n(
96
- D,
93
+ className: "jogak:list-none jogak:m-0 jogak:pr-0 jogak:py-0 jogak:pl-[var(--jogak-tree-pl)]",
94
+ style: { "--jogak-tree-pl": `${s * 12}px` },
95
+ children: Object.entries(o).map(([n, g]) => /* @__PURE__ */ t("li", { children: "id" in g ? /* @__PURE__ */ t(
96
+ G,
97
97
  {
98
- meta: s,
99
- selectedEntryId: t,
100
- selectedJogakName: o,
101
- onSelect: i,
98
+ meta: g,
99
+ selectedEntryId: a,
100
+ selectedJogakName: e,
101
+ onSelect: r,
102
102
  indent: 0
103
103
  }
104
- ) : /* @__PURE__ */ n(
105
- Z,
104
+ ) : /* @__PURE__ */ t(
105
+ go,
106
106
  {
107
- label: r,
108
- node: s,
109
- selectedEntryId: t,
110
- selectedJogakName: o,
111
- onSelect: i,
112
- depth: d + 1
107
+ label: n,
108
+ node: g,
109
+ selectedEntryId: a,
110
+ selectedJogakName: e,
111
+ onSelect: r,
112
+ depth: s + 1
113
113
  }
114
- ) }, r))
114
+ ) }, n))
115
115
  }
116
116
  );
117
117
  }
118
- function Z({
119
- label: e,
120
- node: t,
121
- selectedEntryId: o,
122
- selectedJogakName: i,
123
- onSelect: d,
124
- depth: r
118
+ function go({
119
+ label: o,
120
+ node: a,
121
+ selectedEntryId: e,
122
+ selectedJogakName: r,
123
+ onSelect: s,
124
+ depth: n
125
125
  }) {
126
- const [s, l] = x(!0);
127
- return /* @__PURE__ */ c("div", { children: [
128
- /* @__PURE__ */ c(
126
+ const [g, i] = h(!0);
127
+ return /* @__PURE__ */ j("div", { children: [
128
+ /* @__PURE__ */ j(
129
129
  "button",
130
130
  {
131
131
  type: "button",
132
132
  onClick: () => {
133
- l((a) => !a);
134
- },
135
- style: {
136
- display: "flex",
137
- alignItems: "center",
138
- gap: 4,
139
- width: "100%",
140
- padding: "4px 12px",
141
- background: "none",
142
- border: "none",
143
- cursor: "pointer",
144
- fontSize: 12,
145
- fontWeight: 600,
146
- color: "#6b7280",
147
- textTransform: "uppercase",
148
- letterSpacing: "0.05em"
133
+ i((k) => !k);
149
134
  },
150
- "aria-expanded": s,
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",
136
+ "aria-expanded": g,
151
137
  children: [
152
- /* @__PURE__ */ n("span", { children: s ? "▾" : "▸" }),
153
- e
138
+ /* @__PURE__ */ t("span", { children: g ? "▾" : "▸" }),
139
+ o
154
140
  ]
155
141
  }
156
142
  ),
157
- s && /* @__PURE__ */ n(
158
- H,
143
+ g && /* @__PURE__ */ t(
144
+ q,
159
145
  {
160
- node: t,
161
- selectedEntryId: o,
162
- selectedJogakName: i,
163
- onSelect: d,
164
- depth: r
146
+ node: a,
147
+ selectedEntryId: e,
148
+ selectedJogakName: r,
149
+ onSelect: s,
150
+ depth: n
165
151
  }
166
152
  )
167
153
  ] });
168
154
  }
169
- function D({
170
- meta: e,
171
- selectedEntryId: t,
172
- selectedJogakName: o,
173
- onSelect: i,
174
- indent: d
155
+ function G({
156
+ meta: o,
157
+ selectedEntryId: a,
158
+ selectedJogakName: e,
159
+ onSelect: r,
160
+ indent: s
175
161
  }) {
176
- const r = e.id === t, [s, l] = x(r);
177
- v(() => {
178
- r && l(!0);
179
- }, [r]);
180
- const a = e.title.split("/").pop() ?? e.title, m = 16 + d * 12;
181
- return /* @__PURE__ */ c("div", { children: [
182
- /* @__PURE__ */ c(
162
+ const n = o.id === a, [g, i] = h(n);
163
+ x(() => {
164
+ n && i(!0);
165
+ }, [n]);
166
+ const k = o.title.split("/").pop() ?? o.title, d = 16 + s * 12;
167
+ return /* @__PURE__ */ j("div", { children: [
168
+ /* @__PURE__ */ j(
183
169
  "button",
184
170
  {
185
171
  type: "button",
186
172
  onClick: () => {
187
- if (r)
188
- l((p) => !p);
173
+ if (n)
174
+ i((l) => !l);
189
175
  else {
190
- l(!0);
191
- const p = e.jogakNames[0];
192
- p !== void 0 && i(e.id, p);
176
+ i(!0);
177
+ const l = o.jogakNames[0];
178
+ l !== void 0 && r(o.id, l);
193
179
  }
194
180
  },
195
- style: {
196
- display: "flex",
197
- alignItems: "center",
198
- gap: 6,
199
- width: "100%",
200
- padding: `5px 12px 5px ${m}px`,
201
- background: r ? "#eff6ff" : "none",
202
- border: "none",
203
- cursor: "pointer",
204
- fontSize: 13,
205
- color: r ? "#2563eb" : "#374151",
206
- fontWeight: r ? 500 : 400,
207
- textAlign: "left"
208
- },
209
- "aria-expanded": s,
181
+ className: N(
182
+ "jogak:flex jogak:items-center jogak:gap-1.5 jogak:w-full jogak:pr-3 jogak:py-[5px]",
183
+ "jogak:pl-[var(--jogak-entry-pl)]",
184
+ "jogak:border-none jogak:cursor-pointer jogak:text-left jogak:text-[13px]",
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"
186
+ ),
187
+ style: { "--jogak-entry-pl": `${d}px` },
188
+ "aria-expanded": g,
210
189
  children: [
211
- /* @__PURE__ */ n("span", { style: { fontSize: 10, flexShrink: 0, lineHeight: 1 }, children: s ? "▾" : "▸" }),
212
- a
190
+ /* @__PURE__ */ t("span", { className: "jogak:text-[10px] jogak:shrink-0 jogak:leading-none", children: g ? "▾" : "▸" }),
191
+ k
213
192
  ]
214
193
  }
215
194
  ),
216
- s && /* @__PURE__ */ n("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, children: e.jogakNames.map((p) => {
217
- const h = r && p === o;
218
- return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
195
+ g && /* @__PURE__ */ t("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0", children: o.jogakNames.map((l) => {
196
+ const c = n && l === e;
197
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
219
198
  "button",
220
199
  {
221
200
  type: "button",
222
201
  onClick: () => {
223
- i(e.id, p);
224
- },
225
- style: {
226
- display: "block",
227
- width: "100%",
228
- textAlign: "left",
229
- padding: `4px 12px 4px ${m + 18}px`,
230
- background: h ? "#dbeafe" : "none",
231
- border: "none",
232
- cursor: "pointer",
233
- fontSize: 12,
234
- color: h ? "#1d4ed8" : "#6b7280",
235
- fontWeight: h ? 500 : 400
202
+ r(o.id, l);
236
203
  },
237
- "aria-current": h ? "true" : void 0,
238
- children: p
204
+ className: N(
205
+ "jogak:block jogak:w-full jogak:text-left jogak:pr-3 jogak:py-1",
206
+ "jogak:pl-[var(--jogak-jogak-pl)]",
207
+ "jogak:border-none jogak:cursor-pointer jogak:text-[12px]",
208
+ c ? "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"
209
+ ),
210
+ style: { "--jogak-jogak-pl": `${d + 18}px` },
211
+ "aria-current": c ? "true" : void 0,
212
+ children: l
239
213
  }
240
- ) }, p);
214
+ ) }, l);
241
215
  }) })
242
216
  ] });
243
217
  }
244
- function K(e, t) {
245
- const o = t == null ? void 0 : t.control, i = (t == null ? void 0 : t.action) !== void 0 && t.action !== !1, d = (t == null ? void 0 : t.type) === "function" || typeof e == "function";
246
- return i || d ? "action" : o === "boolean" || typeof e == "boolean" ? "boolean" : o === "number" || o === "range" || typeof e == "number" ? "number" : o === "select" || o === "radio" || (t == null ? void 0 : t.options) !== void 0 && t.options.length > 0 ? "select" : o === "text" || o === "color" || typeof e == "string" ? "text" : "json";
218
+ function so(o, a) {
219
+ const e = a == null ? void 0 : a.control, r = (a == null ? void 0 : a.action) !== void 0 && a.action !== !1, s = (a == null ? void 0 : a.type) === "function" || typeof o == "function";
220
+ return r || s ? "action" : e === "boolean" || typeof o == "boolean" ? "boolean" : e === "number" || e === "range" || typeof o == "number" ? "number" : e === "select" || e === "radio" || (a == null ? void 0 : a.options) !== void 0 && a.options.length > 0 ? "select" : e === "text" || e === "color" || typeof o == "string" ? "text" : "json";
247
221
  }
248
- function ee({ argKey: e, value: t, argType: o, onArgChange: i }) {
249
- switch (K(t, o)) {
222
+ const O = "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]", P = "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)]", M = "jogak:px-5 jogak:py-2 jogak:align-middle jogak:border-b jogak:border-[var(--jogak-color-border-muted)]";
223
+ function lo({ argKey: o, value: a, argType: e, onArgChange: r }) {
224
+ switch (so(a, e)) {
250
225
  case "boolean":
251
- return /* @__PURE__ */ n(
226
+ return /* @__PURE__ */ t(
252
227
  "input",
253
228
  {
254
229
  type: "checkbox",
255
- checked: t === !0,
256
- onChange: (r) => {
257
- i(e, r.target.checked);
230
+ checked: a === !0,
231
+ onChange: (n) => {
232
+ r(o, n.target.checked);
258
233
  },
259
- style: { cursor: "pointer", width: 16, height: 16, accentColor: "#2563eb" }
234
+ className: "jogak:cursor-pointer jogak:w-4 jogak:h-4 jogak:accent-[var(--jogak-color-accent)]"
260
235
  }
261
236
  );
262
237
  case "number":
263
- return /* @__PURE__ */ n(
238
+ return /* @__PURE__ */ t(
264
239
  "input",
265
240
  {
266
241
  type: "number",
267
- value: typeof t == "number" ? t : "",
268
- onChange: (r) => {
269
- i(e, r.target.valueAsNumber);
242
+ value: typeof a == "number" ? a : "",
243
+ onChange: (n) => {
244
+ r(o, n.target.valueAsNumber);
270
245
  },
271
- style: W
246
+ className: O
272
247
  }
273
248
  );
274
249
  case "select": {
275
- const r = (o == null ? void 0 : o.options) ?? [];
276
- return /* @__PURE__ */ n(
250
+ const n = (e == null ? void 0 : e.options) ?? [];
251
+ return /* @__PURE__ */ t(
277
252
  "select",
278
253
  {
279
- value: String(t ?? ""),
280
- onChange: (s) => {
281
- i(e, s.target.value);
254
+ value: String(a ?? ""),
255
+ onChange: (g) => {
256
+ r(o, g.target.value);
282
257
  },
283
- style: W,
284
- children: r.map((s) => /* @__PURE__ */ n("option", { value: String(s), children: String(s) }, String(s)))
258
+ className: O,
259
+ children: n.map((g) => /* @__PURE__ */ t("option", { value: String(g), children: String(g) }, String(g)))
285
260
  }
286
261
  );
287
262
  }
288
263
  case "text":
289
- return /* @__PURE__ */ n(
264
+ return /* @__PURE__ */ t(
290
265
  "input",
291
266
  {
292
267
  type: "text",
293
- value: typeof t == "string" ? t : String(t ?? ""),
294
- onChange: (r) => {
295
- i(e, r.target.value);
268
+ value: typeof a == "string" ? a : String(a ?? ""),
269
+ onChange: (n) => {
270
+ r(o, n.target.value);
296
271
  },
297
- style: W
272
+ className: O
298
273
  }
299
274
  );
300
275
  case "action":
301
- return /* @__PURE__ */ n(
302
- "span",
303
- {
304
- style: {
305
- display: "inline-block",
306
- padding: "2px 8px",
307
- fontSize: 11,
308
- fontWeight: 600,
309
- color: "#7c3aed",
310
- background: "#f5f3ff",
311
- border: "1px solid #ddd6fe",
312
- borderRadius: 4,
313
- fontFamily: "monospace"
314
- },
315
- children: "(action)"
316
- }
317
- );
276
+ return /* @__PURE__ */ t("span", { className: "jogak:inline-block jogak:px-2 jogak:py-0.5 jogak:text-[11px] jogak:font-semibold jogak:text-[var(--jogak-color-violet)] jogak:bg-[var(--jogak-color-violet-bg)] jogak:border jogak:border-[var(--jogak-color-violet-border)] jogak:rounded-[var(--jogak-radius-md)] jogak:font-[family-name:var(--jogak-font-mono)] jogak:leading-none", children: "(action)" });
318
277
  case "json":
319
- return /* @__PURE__ */ n("code", { style: { fontSize: 12, color: "#6b7280", fontFamily: "monospace" }, children: JSON.stringify(t) });
278
+ return /* @__PURE__ */ t("code", { className: "jogak:text-[12px] jogak:text-[var(--jogak-color-fg-muted)] jogak:font-[family-name:var(--jogak-font-mono)]", children: JSON.stringify(a) });
320
279
  }
321
280
  }
322
- const W = {
323
- padding: "4px 8px",
324
- border: "1px solid #d1d5db",
325
- borderRadius: 4,
326
- fontSize: 13,
327
- width: "100%",
328
- maxWidth: 280
329
- }, A = {
330
- padding: "6px 20px",
331
- textAlign: "left",
332
- color: "#6b7280",
333
- fontWeight: 500,
334
- fontSize: 12,
335
- borderBottom: "1px solid #e5e7eb"
336
- }, B = {
337
- padding: "8px 20px",
338
- verticalAlign: "middle",
339
- borderBottom: "1px solid #f3f4f6"
340
- };
341
- function te({ args: e, argTypes: t, onArgChange: o }) {
342
- const d = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])).map((r) => [r, e[r]]);
343
- return /* @__PURE__ */ c("div", { style: { borderTop: "2px solid #e5e7eb" }, children: [
344
- /* @__PURE__ */ n(
345
- "div",
346
- {
347
- style: {
348
- padding: "6px 20px",
349
- fontSize: 11,
350
- fontWeight: 700,
351
- color: "#9ca3af",
352
- textTransform: "uppercase",
353
- letterSpacing: "0.08em",
354
- borderBottom: "1px solid #e5e7eb",
355
- background: "#f9fafb"
356
- },
357
- children: "Controls"
358
- }
359
- ),
360
- d.length === 0 ? /* @__PURE__ */ n("div", { style: { padding: "12px 20px", color: "#9ca3af", fontSize: 13 }, children: "No args defined" }) : /* @__PURE__ */ c("table", { style: { width: "100%", borderCollapse: "collapse", fontSize: 13 }, children: [
361
- /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ c("tr", { children: [
362
- /* @__PURE__ */ n("th", { style: A, children: "Name" }),
363
- /* @__PURE__ */ n("th", { style: A, children: "Control" }),
364
- /* @__PURE__ */ n("th", { style: A, children: "Description" })
281
+ function io({ args: o, argTypes: a, onArgChange: e }) {
282
+ const s = Array.from(/* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(a)])).map((n) => [n, o[n]]);
283
+ return /* @__PURE__ */ j("div", { className: "jogak:border-t-2 jogak:border-[var(--jogak-color-border)]", children: [
284
+ /* @__PURE__ */ t("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" }),
285
+ s.length === 0 ? /* @__PURE__ */ t("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: [
286
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ j("tr", { children: [
287
+ /* @__PURE__ */ t("th", { className: P, children: "Name" }),
288
+ /* @__PURE__ */ t("th", { className: P, children: "Control" }),
289
+ /* @__PURE__ */ t("th", { className: P, children: "Description" })
365
290
  ] }) }),
366
- /* @__PURE__ */ n("tbody", { children: d.map(([r, s]) => {
367
- const l = t[r];
368
- return /* @__PURE__ */ c("tr", { children: [
369
- /* @__PURE__ */ n(
291
+ /* @__PURE__ */ t("tbody", { children: s.map(([n, g]) => {
292
+ const i = a[n];
293
+ return /* @__PURE__ */ j("tr", { children: [
294
+ /* @__PURE__ */ t(
370
295
  "td",
371
296
  {
372
- style: {
373
- ...B,
374
- fontFamily: "monospace",
375
- fontSize: 12,
376
- color: "#374151",
377
- whiteSpace: "nowrap"
378
- },
379
- children: r
297
+ className: N(
298
+ M,
299
+ "jogak:font-[family-name:var(--jogak-font-mono)] jogak:text-[12px] jogak:text-[var(--jogak-color-fg)] jogak:whitespace-nowrap"
300
+ ),
301
+ children: n
380
302
  }
381
303
  ),
382
- /* @__PURE__ */ n("td", { style: B, children: /* @__PURE__ */ n(
383
- ee,
304
+ /* @__PURE__ */ t("td", { className: M, children: /* @__PURE__ */ t(
305
+ lo,
384
306
  {
385
- argKey: r,
386
- value: s,
387
- argType: l,
388
- onArgChange: o
307
+ argKey: n,
308
+ value: g,
309
+ argType: i,
310
+ onArgChange: e
389
311
  }
390
312
  ) }),
391
- /* @__PURE__ */ n("td", { style: { ...B, color: "#9ca3af" }, children: (l == null ? void 0 : l.description) ?? "" })
392
- ] }, r);
313
+ /* @__PURE__ */ t("td", { className: N(M, "jogak:text-[var(--jogak-color-fg-subtle)]"), children: (i == null ? void 0 : i.description) ?? "" })
314
+ ] }, n);
393
315
  }) })
394
316
  ] })
395
317
  ] });
396
318
  }
397
- function ne(e) {
398
- if (e.length === 0) return "()";
319
+ function ko(o) {
320
+ if (o.length === 0) return "()";
399
321
  try {
400
- return e.map((t) => {
401
- var o;
402
- if (t === null) return "null";
403
- if (t === void 0) return "undefined";
404
- if (typeof t == "function") return "[Function]";
405
- if (typeof t == "object") {
406
- const i = ((o = t.constructor) == null ? void 0 : o.name) ?? "Object";
407
- return i !== "Object" && i !== "Array" ? `[${i}]` : JSON.stringify(t);
322
+ return o.map((a) => {
323
+ var e;
324
+ if (a === null) return "null";
325
+ if (a === void 0) return "undefined";
326
+ if (typeof a == "function") return "[Function]";
327
+ if (typeof a == "object") {
328
+ const r = ((e = a.constructor) == null ? void 0 : e.name) ?? "Object";
329
+ return r !== "Object" && r !== "Array" ? `[${r}]` : JSON.stringify(a);
408
330
  }
409
- return JSON.stringify(t);
331
+ return JSON.stringify(a);
410
332
  }).join(", ");
411
333
  } catch {
412
334
  return "[unserializable]";
413
335
  }
414
336
  }
415
- function oe(e) {
416
- const t = new Date(e), o = t.getHours().toString().padStart(2, "0"), i = t.getMinutes().toString().padStart(2, "0"), d = t.getSeconds().toString().padStart(2, "0"), r = t.getMilliseconds().toString().padStart(3, "0");
417
- return `${o}:${i}:${d}.${r}`;
337
+ function co(o) {
338
+ const a = new Date(o), e = a.getHours().toString().padStart(2, "0"), r = a.getMinutes().toString().padStart(2, "0"), s = a.getSeconds().toString().padStart(2, "0"), n = a.getMilliseconds().toString().padStart(3, "0");
339
+ return `${e}:${r}:${s}.${n}`;
418
340
  }
419
- function re() {
420
- const [e, t] = x(() => z.getLogs());
421
- return v(() => z.subscribe(t), []), /* @__PURE__ */ c("div", { style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
422
- /* @__PURE__ */ c(
423
- "div",
424
- {
425
- style: {
426
- padding: "6px 20px",
427
- fontSize: 11,
428
- fontWeight: 700,
429
- color: "#9ca3af",
430
- textTransform: "uppercase",
431
- letterSpacing: "0.08em",
432
- borderBottom: "1px solid #e5e7eb",
433
- background: "#f9fafb",
434
- display: "flex",
435
- alignItems: "center",
436
- justifyContent: "space-between",
437
- flexShrink: 0
438
- },
439
- children: [
440
- /* @__PURE__ */ c("span", { children: [
441
- "Actions ",
442
- e.length > 0 && `(${e.length.toString()})`
443
- ] }),
444
- /* @__PURE__ */ n(
445
- "button",
446
- {
447
- type: "button",
448
- onClick: () => {
449
- z.clear();
450
- },
451
- disabled: e.length === 0,
452
- style: {
453
- fontSize: 10,
454
- fontWeight: 600,
455
- padding: "2px 8px",
456
- border: "1px solid #d1d5db",
457
- borderRadius: 3,
458
- background: "#fff",
459
- color: e.length === 0 ? "#9ca3af" : "#374151",
460
- cursor: e.length === 0 ? "default" : "pointer",
461
- textTransform: "none",
462
- letterSpacing: 0
463
- },
464
- children: "Clear"
465
- }
466
- )
467
- ]
468
- }
469
- ),
470
- /* @__PURE__ */ n("div", { style: { flex: 1, overflow: "auto" }, children: e.length === 0 ? /* @__PURE__ */ n(
471
- "div",
472
- {
473
- style: {
474
- padding: "12px 20px",
475
- color: "#9ca3af",
476
- fontSize: 13
477
- },
478
- children: "함수 prop이 호출되면 여기에 기록됩니다"
479
- }
480
- ) : /* @__PURE__ */ n("ul", { style: { listStyle: "none", margin: 0, padding: 0, fontFamily: "monospace", fontSize: 12 }, children: e.map((o) => /* @__PURE__ */ c(
341
+ function jo() {
342
+ const [o, a] = h(() => E.getLogs());
343
+ x(() => E.subscribe(a), []);
344
+ const e = o.length === 0;
345
+ return /* @__PURE__ */ j("div", { className: "jogak:h-full jogak:flex jogak:flex-col", children: [
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: [
347
+ /* @__PURE__ */ j("span", { children: [
348
+ "Actions ",
349
+ o.length > 0 && `(${o.length.toString()})`
350
+ ] }),
351
+ /* @__PURE__ */ t(
352
+ "button",
353
+ {
354
+ type: "button",
355
+ onClick: () => {
356
+ E.clear();
357
+ },
358
+ disabled: e,
359
+ className: N(
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",
361
+ e ? "jogak:text-[var(--jogak-color-fg-subtle)] jogak:cursor-default" : "jogak:text-[var(--jogak-color-fg)] jogak:cursor-pointer"
362
+ ),
363
+ children: "Clear"
364
+ }
365
+ )
366
+ ] }),
367
+ /* @__PURE__ */ t("div", { className: "jogak:flex-1 jogak:overflow-auto", children: e ? /* @__PURE__ */ t("div", { className: "jogak:px-5 jogak:py-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px] jogak:leading-none", children: "함수 prop이 호출되면 여기에 기록됩니다" }) : /* @__PURE__ */ t("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0 jogak:font-[family-name:var(--jogak-font-mono)] jogak:text-[12px]", children: o.map((r) => /* @__PURE__ */ j(
481
368
  "li",
482
369
  {
483
- style: {
484
- display: "flex",
485
- alignItems: "baseline",
486
- gap: 10,
487
- padding: "6px 20px",
488
- borderBottom: "1px solid #f3f4f6"
489
- },
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)]",
490
371
  children: [
491
- /* @__PURE__ */ n("span", { style: { color: "#9ca3af", fontSize: 11, minWidth: 92 }, children: oe(o.timestamp) }),
492
- /* @__PURE__ */ n("span", { style: { color: "#7c3aed", fontWeight: 600 }, children: o.name }),
493
- /* @__PURE__ */ c("span", { style: { color: "#374151", wordBreak: "break-all", flex: 1 }, children: [
372
+ /* @__PURE__ */ t("span", { className: "jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[11px] jogak:min-w-[92px]", children: co(r.timestamp) }),
373
+ /* @__PURE__ */ t("span", { className: "jogak:text-[var(--jogak-color-violet)] jogak:font-semibold", children: r.name }),
374
+ /* @__PURE__ */ j("span", { className: "jogak:text-[var(--jogak-color-fg)] jogak:break-all jogak:flex-1", children: [
494
375
  "(",
495
- ne(o.args),
376
+ ko(r.args),
496
377
  ")"
497
378
  ] })
498
379
  ]
499
380
  },
500
- o.id
381
+ r.id
501
382
  )) }) })
502
383
  ] });
503
384
  }
504
- const N = {
385
+ function uo({
386
+ children: o,
387
+ className: a,
388
+ style: e,
389
+ "data-testid": r
390
+ }) {
391
+ const s = L(null), [n, g] = h(null);
392
+ return x(() => {
393
+ const i = s.current;
394
+ if (i === null) return;
395
+ const k = i.shadowRoot ?? i.attachShadow({ mode: "open" });
396
+ g(k);
397
+ }, []), /* @__PURE__ */ t(
398
+ "div",
399
+ {
400
+ ref: s,
401
+ className: a,
402
+ "data-testid": r,
403
+ style: e,
404
+ children: n !== null ? to(o, n) : null
405
+ }
406
+ );
407
+ }
408
+ function po({
409
+ entry: o,
410
+ args: a,
411
+ userPreviewUrl: e,
412
+ previewEntryPath: r,
413
+ className: s,
414
+ "data-testid": n
415
+ }) {
416
+ const g = L(null), [i, k] = h(!1), d = e !== "" ? `${e}${r}` : "/preview-frame.html";
417
+ return x(() => {
418
+ const l = (c) => {
419
+ const p = g.current;
420
+ if (p === null || c.source !== p.contentWindow) return;
421
+ const f = c.data;
422
+ f == null || typeof f != "object" || f.type === "jogak:ready" && k(!0);
423
+ };
424
+ return window.addEventListener("message", l), () => {
425
+ window.removeEventListener("message", l);
426
+ };
427
+ }, []), x(() => {
428
+ var c;
429
+ if (!i) return;
430
+ const l = g.current;
431
+ l !== null && ((c = l.contentWindow) == null || c.postMessage(
432
+ { type: "jogak:setProps", entryId: o.id, args: a },
433
+ "*"
434
+ ));
435
+ }, [i, o, a]), x(() => {
436
+ const l = g.current;
437
+ return () => {
438
+ l !== null && queueMicrotask(() => {
439
+ var c;
440
+ (c = l.contentWindow) == null || c.postMessage({ type: "jogak:unmount" }, "*");
441
+ });
442
+ };
443
+ }, []), /* @__PURE__ */ t(
444
+ "iframe",
445
+ {
446
+ ref: g,
447
+ src: d,
448
+ title: "Preview",
449
+ className: s,
450
+ "data-testid": n
451
+ }
452
+ );
453
+ }
454
+ const fo = 60;
455
+ function mo(o, a) {
456
+ const e = bo(o), { children: r, restProps: s } = ho(a), n = Object.entries(s).filter(([, c]) => c !== void 0).map(([c, p]) => vo(c, p)), g = xo(r), i = g !== null, k = n.length === 0 ? "" : " " + n.join(" "), d = i ? `<${e}${k}>${g ?? ""}</${e}>` : `<${e}${k} />`;
457
+ if (d.length <= fo && !d.includes(`
458
+ `))
459
+ return d;
460
+ const l = n.length === 0 ? "" : `
461
+ ` + n.join(`
462
+ `) + `
463
+ `;
464
+ if (i) {
465
+ const c = (g ?? "").split(`
466
+ `).map((p) => ` ${p}`).join(`
467
+ `);
468
+ return `<${e}${l}>
469
+ ${c}
470
+ </${e}>`;
471
+ }
472
+ return `<${e}${l}/>`;
473
+ }
474
+ function bo(o) {
475
+ const a = o.meta.component;
476
+ if (a !== void 0) {
477
+ if (typeof a.displayName == "string" && a.displayName.length > 0)
478
+ return a.displayName;
479
+ if (typeof a.name == "string" && a.name.length > 0)
480
+ return a.name;
481
+ }
482
+ const e = o.title.split("/").pop();
483
+ return e !== void 0 && e.length > 0 ? e : "Component";
484
+ }
485
+ function ho(o) {
486
+ const { children: a, ...e } = o;
487
+ return { children: a, restProps: e };
488
+ }
489
+ function xo(o) {
490
+ return o == null ? null : typeof o == "string" ? o.length === 0 ? null : o : typeof o == "number" || typeof o == "bigint" ? `{${o.toString()}}` : typeof o == "boolean" ? null : `{${Q(o)}}`;
491
+ }
492
+ function vo(o, a) {
493
+ if (a === !0) return o;
494
+ if (a === !1) return `${o}={false}`;
495
+ if (a === null) return `${o}={null}`;
496
+ if (typeof a == "string") {
497
+ const e = a.replace(/"/gu, "&quot;");
498
+ return `${o}="${e}"`;
499
+ }
500
+ return typeof a == "number" || typeof a == "bigint" ? `${o}={${a.toString()}}` : typeof a == "function" ? `${o}={fn}` : `${o}={${Q(a)}}`;
501
+ }
502
+ function Q(o) {
503
+ try {
504
+ return JSON.stringify(o);
505
+ } catch {
506
+ return String(o);
507
+ }
508
+ }
509
+ const X = {
505
510
  mobile: 375,
506
511
  tablet: 768,
507
512
  desktop: "none"
508
- }, ie = {
513
+ }, wo = {
509
514
  mobile: "Mobile",
510
515
  tablet: "Tablet",
511
516
  desktop: "Desktop"
512
- }, M = {
513
- white: { background: "#ffffff" },
514
- dark: { background: "#1f2937" },
517
+ }, V = {
518
+ white: {
519
+ "--jogak-canvas-bg": "#ffffff",
520
+ "--jogak-canvas-bg-image": "none",
521
+ "--jogak-canvas-bg-size": "auto",
522
+ "--jogak-canvas-bg-position": "0 0"
523
+ },
524
+ dark: {
525
+ "--jogak-canvas-bg": "#1f2937",
526
+ "--jogak-canvas-bg-image": "none",
527
+ "--jogak-canvas-bg-size": "auto",
528
+ "--jogak-canvas-bg-position": "0 0"
529
+ },
515
530
  transparent: {
516
- backgroundImage: [
517
- "linear-gradient(45deg, #e2e8f0 25%, transparent 25%)",
518
- "linear-gradient(-45deg, #e2e8f0 25%, transparent 25%)",
519
- "linear-gradient(45deg, transparent 75%, #e2e8f0 75%)",
520
- "linear-gradient(-45deg, transparent 75%, #e2e8f0 75%)"
521
- ].join(", "),
522
- backgroundSize: "16px 16px",
523
- backgroundPosition: "0 0, 0 8px, 8px -8px, -8px 0px",
524
- backgroundColor: "#ffffff"
531
+ "--jogak-canvas-bg": "#ffffff",
532
+ "--jogak-canvas-bg-image": "linear-gradient(45deg, #e2e8f0 25%, transparent 25%), linear-gradient(-45deg, #e2e8f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e2e8f0 75%), linear-gradient(-45deg, transparent 75%, #e2e8f0 75%)",
533
+ "--jogak-canvas-bg-size": "16px 16px",
534
+ "--jogak-canvas-bg-position": "0 0, 0 8px, 8px -8px, -8px 0px"
525
535
  }
526
- }, I = 320;
527
- function de(e) {
528
- return L[e] ?? L.vsDark;
536
+ }, B = "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)]";
537
+ function No(o) {
538
+ return F[o] ?? F.vsDark;
529
539
  }
530
- function le({
531
- entryId: e,
532
- jogakName: t,
533
- overrideArgs: o,
534
- onArgChange: i,
535
- onReset: d,
536
- codeTheme: r,
537
- onResolveJogak: s
540
+ function yo({
541
+ entryId: o,
542
+ jogakName: a,
543
+ overrideArgs: e,
544
+ onArgChange: r,
545
+ onReset: s,
546
+ codeTheme: n,
547
+ onResolveJogak: g,
548
+ previewIsolation: i = "iframe",
549
+ userPreviewUrl: k = "",
550
+ previewEntryPath: d = "/__jogak_preview__/index.html"
538
551
  }) {
539
- const l = G(e), [a, m] = x("desktop"), [p, h] = x("white"), [S, b] = x("controls"), y = de(r);
540
- return l.status === "unknown" ? /* @__PURE__ */ c("div", { "data-testid": "preview-not-found", style: { padding: 24, color: "#ef4444" }, children: [
541
- "Entry not found: ",
542
- e
543
- ] }) : l.status === "error" ? /* @__PURE__ */ c(
552
+ const l = T(o), [c, p] = h("desktop"), [f, S] = h("white"), [y, v] = h("controls"), w = No(n);
553
+ return l.status === "unknown" ? /* @__PURE__ */ j(
554
+ "div",
555
+ {
556
+ "data-testid": "preview-not-found",
557
+ className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]",
558
+ children: [
559
+ "Entry not found: ",
560
+ o
561
+ ]
562
+ }
563
+ ) : l.status === "error" ? /* @__PURE__ */ j(
544
564
  "div",
545
565
  {
546
566
  "data-testid": "preview-error",
547
- style: {
548
- padding: 24,
549
- color: "#b91c1c",
550
- background: "#fef2f2",
551
- height: "100%",
552
- display: "flex",
553
- flexDirection: "column",
554
- gap: 12,
555
- alignItems: "flex-start"
556
- },
567
+ className: "jogak:p-6 jogak:text-[var(--jogak-color-error-fg)] jogak:bg-[var(--jogak-color-bg-error)] jogak:h-full jogak:flex jogak:flex-col jogak:gap-3 jogak:items-start",
557
568
  children: [
558
- /* @__PURE__ */ c("div", { style: { fontWeight: 600 }, children: [
569
+ /* @__PURE__ */ j("div", { className: "jogak:font-semibold", children: [
559
570
  "Failed to load entry: ",
560
- e
571
+ o
561
572
  ] }),
562
- /* @__PURE__ */ n(
563
- "pre",
564
- {
565
- style: {
566
- margin: 0,
567
- padding: 12,
568
- background: "#fff",
569
- border: "1px solid #fecaca",
570
- borderRadius: 6,
571
- fontSize: 12,
572
- whiteSpace: "pre-wrap",
573
- maxWidth: "100%"
574
- },
575
- children: l.error.message
576
- }
577
- )
573
+ /* @__PURE__ */ t("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: l.error.message })
578
574
  ]
579
575
  }
580
- ) : l.status === "loading" ? /* @__PURE__ */ n(
581
- se,
576
+ ) : l.status === "loading" ? /* @__PURE__ */ t(
577
+ So,
582
578
  {
583
579
  meta: l.meta,
584
- jogakName: t,
585
- viewport: a,
586
- bgMode: p,
587
- onViewportChange: m,
588
- onBgModeChange: h
580
+ jogakName: a,
581
+ viewport: c,
582
+ bgMode: f,
583
+ onViewportChange: p,
584
+ onBgModeChange: S
589
585
  }
590
- ) : /* @__PURE__ */ n(
591
- ae,
586
+ ) : /* @__PURE__ */ t(
587
+ Co,
592
588
  {
593
589
  entry: l.entry,
594
- jogakName: t,
595
- overrideArgs: o,
596
- onArgChange: i,
597
- onReset: d,
598
- onResolveJogak: s,
599
- viewport: a,
600
- bgMode: p,
601
- bottomTab: S,
602
- onViewportChange: m,
603
- onBgModeChange: h,
604
- onBottomTabChange: b,
605
- prismTheme: y
590
+ jogakName: a,
591
+ overrideArgs: e,
592
+ onArgChange: r,
593
+ onReset: s,
594
+ onResolveJogak: g,
595
+ viewport: c,
596
+ bgMode: f,
597
+ bottomTab: y,
598
+ onViewportChange: p,
599
+ onBgModeChange: S,
600
+ onBottomTabChange: v,
601
+ prismTheme: w,
602
+ previewIsolation: i,
603
+ userPreviewUrl: k,
604
+ previewEntryPath: d
606
605
  }
607
606
  );
608
607
  }
609
- function se({
610
- meta: e,
611
- jogakName: t,
612
- viewport: o,
613
- bgMode: i,
614
- onViewportChange: d,
615
- onBgModeChange: r
608
+ function So({
609
+ meta: o,
610
+ jogakName: a,
611
+ viewport: e,
612
+ bgMode: r,
613
+ onViewportChange: s,
614
+ onBgModeChange: n
616
615
  }) {
617
- const s = t ?? e.jogakNames[0] ?? "...", l = N[o];
618
- return /* @__PURE__ */ c(
616
+ const g = a ?? o.jogakNames[0] ?? "...", i = X[e];
617
+ return /* @__PURE__ */ j(
619
618
  "div",
620
619
  {
621
620
  "data-testid": "preview-loading",
622
- style: { display: "flex", flexDirection: "column", height: "100%" },
621
+ className: "jogak:flex jogak:flex-col jogak:h-full",
623
622
  children: [
624
- /* @__PURE__ */ n(
625
- J,
623
+ /* @__PURE__ */ t(
624
+ Y,
626
625
  {
627
- title: e.title,
628
- jogakName: s,
629
- viewport: o,
630
- bgMode: i,
631
- onViewportChange: d,
632
- onBgModeChange: r,
626
+ title: o.title,
627
+ jogakName: g,
628
+ viewport: e,
629
+ bgMode: r,
630
+ onViewportChange: s,
631
+ onBgModeChange: n,
633
632
  showReset: !1,
634
633
  onReset: () => {
635
634
  }
636
635
  }
637
636
  ),
638
- /* @__PURE__ */ n(
637
+ /* @__PURE__ */ t(
639
638
  "div",
640
639
  {
641
- style: {
642
- flex: 1,
643
- minHeight: I,
644
- overflow: "auto",
645
- ...M[i]
646
- },
647
- children: /* @__PURE__ */ n(
640
+ className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${B}`,
641
+ style: V[r],
642
+ children: /* @__PURE__ */ t(
648
643
  "div",
649
644
  {
645
+ className: "jogak:mx-auto jogak:p-6 jogak:max-w-[var(--jogak-canvas-mw)]",
650
646
  style: {
651
- maxWidth: l === "none" ? "100%" : l,
652
- margin: "0 auto",
653
- padding: 24
647
+ "--jogak-canvas-mw": i === "none" ? "100%" : `${i}px`
654
648
  },
655
- children: /* @__PURE__ */ c(
656
- "div",
657
- {
658
- style: {
659
- border: "1px dashed #e5e7eb",
660
- borderRadius: 8,
661
- padding: 16,
662
- minHeight: I - 64,
663
- display: "flex",
664
- alignItems: "center",
665
- justifyContent: "center",
666
- color: "#9ca3af",
667
- fontSize: 13,
668
- background: "linear-gradient(90deg, rgba(229,231,235,0) 0%, rgba(229,231,235,0.45) 50%, rgba(229,231,235,0) 100%)",
669
- backgroundSize: "200% 100%",
670
- animation: "jogakSkeleton 1.4s ease-in-out infinite"
671
- },
672
- children: [
673
- "Loading ",
674
- e.title,
675
- "…"
676
- ]
677
- }
678
- )
649
+ 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: [
650
+ "Loading ",
651
+ o.title,
652
+ "…"
653
+ ] })
679
654
  }
680
655
  )
681
656
  }
682
- ),
683
- /* @__PURE__ */ n("style", { children: "@keyframes jogakSkeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }" })
657
+ )
684
658
  ]
685
659
  }
686
660
  );
687
661
  }
688
- function ae({
689
- entry: e,
690
- jogakName: t,
691
- overrideArgs: o,
692
- onArgChange: i,
693
- onReset: d,
694
- onResolveJogak: r,
695
- viewport: s,
696
- bgMode: l,
697
- bottomTab: a,
698
- onViewportChange: m,
699
- onBgModeChange: p,
700
- onBottomTabChange: h,
701
- prismTheme: S
662
+ function Co({
663
+ entry: o,
664
+ jogakName: a,
665
+ overrideArgs: e,
666
+ onArgChange: r,
667
+ onReset: s,
668
+ onResolveJogak: n,
669
+ viewport: g,
670
+ bgMode: i,
671
+ bottomTab: k,
672
+ onViewportChange: d,
673
+ onBgModeChange: l,
674
+ onBottomTabChange: c,
675
+ prismTheme: p,
676
+ previewIsolation: f,
677
+ userPreviewUrl: S,
678
+ previewEntryPath: y
702
679
  }) {
703
- var $;
704
- const b = t ?? (($ = e.jogaks[0]) == null ? void 0 : $.name) ?? null;
705
- if (v(() => {
706
- t === null && b !== null && r !== void 0 && r(e.id, b);
707
- }, [t, b, e.id, r]), b === null)
708
- return /* @__PURE__ */ c("div", { style: { padding: 24, color: "#ef4444" }, children: [
680
+ var z;
681
+ const v = a ?? ((z = o.jogaks[0]) == null ? void 0 : z.name) ?? null;
682
+ if (x(() => {
683
+ a === null && v !== null && n !== void 0 && n(o.id, v);
684
+ }, [a, v, o.id, n]), v === null)
685
+ return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
709
686
  "Entry has no jogaks: ",
710
- e.id
687
+ o.id
711
688
  ] });
712
- const y = e.jogaks.find((k) => k.name === b);
713
- if (y === void 0)
714
- return /* @__PURE__ */ c("div", { style: { padding: 24, color: "#ef4444" }, children: [
689
+ const w = o.jogaks.find((C) => C.name === v);
690
+ if (w === void 0)
691
+ return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
715
692
  "Jogak not found: ",
716
- b
693
+ v
717
694
  ] });
718
- const u = { ...y.args ?? {}, ...o }, g = {
719
- ...e.meta.argTypes ?? {},
720
- ...y.argTypes ?? {}
721
- }, P = Object.keys(o).length > 0, O = N[s];
722
- return /* @__PURE__ */ c("div", { style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
723
- /* @__PURE__ */ n(
724
- J,
695
+ const R = { ...w.args ?? {}, ...e }, u = {
696
+ ...o.meta.argTypes ?? {},
697
+ ...w.argTypes ?? {}
698
+ }, m = Object.keys(e).length > 0, b = X[g];
699
+ return /* @__PURE__ */ j("div", { className: "jogak:flex jogak:flex-col jogak:h-full", children: [
700
+ /* @__PURE__ */ t(
701
+ Y,
725
702
  {
726
- title: e.title,
727
- jogakName: y.name,
728
- viewport: s,
729
- bgMode: l,
730
- onViewportChange: m,
731
- onBgModeChange: p,
732
- showReset: P,
733
- onReset: d
703
+ title: o.title,
704
+ jogakName: w.name,
705
+ viewport: g,
706
+ bgMode: i,
707
+ onViewportChange: d,
708
+ onBgModeChange: l,
709
+ showReset: m,
710
+ onReset: s
734
711
  }
735
712
  ),
736
- /* @__PURE__ */ n(
713
+ /* @__PURE__ */ t(
737
714
  "div",
738
715
  {
739
- style: {
740
- flex: 1,
741
- minHeight: I,
742
- overflow: "auto",
743
- ...M[l]
744
- },
745
- children: /* @__PURE__ */ n(
716
+ className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${B}`,
717
+ style: V[i],
718
+ children: /* @__PURE__ */ t(
746
719
  "div",
747
720
  {
721
+ "data-jogak-content": !0,
722
+ className: "jogak:mx-auto jogak:p-6 jogak:max-w-[var(--jogak-canvas-mw)]",
748
723
  style: {
749
- maxWidth: O === "none" ? "100%" : O,
750
- margin: "0 auto",
751
- padding: 24
724
+ "--jogak-canvas-mw": b === "none" ? "100%" : `${b}px`
752
725
  },
753
- children: /* @__PURE__ */ n(
754
- ce,
726
+ children: /* @__PURE__ */ t(
727
+ $o,
755
728
  {
756
- entry: e,
757
- args: u,
758
- source: e.source,
759
- theme: S
729
+ entry: o,
730
+ args: R,
731
+ theme: p,
732
+ previewIsolation: f,
733
+ userPreviewUrl: S,
734
+ previewEntryPath: y
760
735
  },
761
- `${e.id}/${y.name}`
736
+ `${o.id}/${w.name}`
762
737
  )
763
738
  }
764
739
  )
765
740
  }
766
741
  ),
767
- /* @__PURE__ */ c(
742
+ /* @__PURE__ */ j(
768
743
  "div",
769
744
  {
770
- style: {
771
- height: 260,
772
- flexShrink: 0,
773
- display: "flex",
774
- flexDirection: "column",
775
- borderTop: "2px solid #e5e7eb"
776
- },
745
+ "data-testid": "bottom-panel",
746
+ className: "jogak:h-[260px] jogak:shrink-0 jogak:flex jogak:flex-col jogak:border-t-2 jogak:border-[var(--jogak-color-border)]",
777
747
  children: [
778
- /* @__PURE__ */ n(
748
+ /* @__PURE__ */ t(
779
749
  "div",
780
750
  {
781
751
  role: "tablist",
782
- style: {
783
- display: "flex",
784
- gap: 4,
785
- padding: "4px 12px 0",
786
- background: "#fff",
787
- borderBottom: "1px solid #e5e7eb",
788
- flexShrink: 0
789
- },
790
- children: ["controls", "actions"].map((k) => {
791
- const C = a === k;
792
- return /* @__PURE__ */ n(
752
+ 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",
753
+ children: ["controls", "actions"].map((C) => {
754
+ const D = k === C;
755
+ return /* @__PURE__ */ t(
793
756
  "button",
794
757
  {
795
758
  type: "button",
796
759
  role: "tab",
797
- "aria-selected": C,
760
+ "aria-selected": D,
798
761
  onClick: () => {
799
- h(k);
800
- },
801
- style: {
802
- padding: "6px 14px",
803
- fontSize: 12,
804
- fontWeight: C ? 600 : 500,
805
- color: C ? "#111827" : "#6b7280",
806
- background: "transparent",
807
- border: "none",
808
- borderBottom: C ? "2px solid #2563eb" : "2px solid transparent",
809
- marginBottom: -1,
810
- cursor: "pointer",
811
- textTransform: "capitalize"
762
+ c(C);
812
763
  },
813
- children: k
764
+ className: N(
765
+ "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",
766
+ D ? "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"
767
+ ),
768
+ children: C
814
769
  },
815
- k
770
+ C
816
771
  );
817
772
  })
818
773
  }
819
774
  ),
820
- /* @__PURE__ */ n("div", { style: { flex: 1, minHeight: 0, overflow: "auto" }, children: a === "controls" ? /* @__PURE__ */ n(
821
- te,
775
+ /* @__PURE__ */ t("div", { className: "jogak:flex-1 jogak:min-h-0 jogak:overflow-auto", children: k === "controls" ? /* @__PURE__ */ t(
776
+ io,
822
777
  {
823
- args: u,
824
- argTypes: g,
825
- onArgChange: i
778
+ args: R,
779
+ argTypes: u,
780
+ onArgChange: r
826
781
  }
827
- ) : /* @__PURE__ */ n(re, {}) })
782
+ ) : /* @__PURE__ */ t(jo, {}) })
828
783
  ]
829
784
  }
830
785
  )
831
786
  ] });
832
787
  }
833
- function J({
834
- title: e,
835
- jogakName: t,
836
- viewport: o,
837
- bgMode: i,
838
- onViewportChange: d,
839
- onBgModeChange: r,
840
- showReset: s,
841
- onReset: l
788
+ function Y({
789
+ title: o,
790
+ jogakName: a,
791
+ viewport: e,
792
+ bgMode: r,
793
+ onViewportChange: s,
794
+ onBgModeChange: n,
795
+ showReset: g,
796
+ onReset: i
842
797
  }) {
843
- return /* @__PURE__ */ c(
844
- "div",
845
- {
846
- style: {
847
- display: "flex",
848
- alignItems: "center",
849
- gap: 10,
850
- padding: "7px 14px",
851
- borderBottom: "1px solid #e5e7eb",
852
- background: "#fff",
853
- flexShrink: 0
798
+ 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: [
799
+ /* @__PURE__ */ j("div", { className: "jogak:flex-1 jogak:text-[13px]", children: [
800
+ /* @__PURE__ */ t("span", { className: "jogak:text-[var(--jogak-color-fg-subtle)]", children: o }),
801
+ /* @__PURE__ */ t("span", { className: "jogak:text-[var(--jogak-color-border-strong)] jogak:mx-1.5 jogak:leading-none", children: "/" }),
802
+ /* @__PURE__ */ t("span", { className: "jogak:text-[var(--jogak-color-fg-strong)] jogak:font-semibold", children: a })
803
+ ] }),
804
+ /* @__PURE__ */ t("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((k) => /* @__PURE__ */ t(
805
+ "button",
806
+ {
807
+ type: "button",
808
+ onClick: () => {
809
+ s(k);
810
+ },
811
+ "aria-pressed": e === k,
812
+ className: N(
813
+ "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",
814
+ e === k ? "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"
815
+ ),
816
+ children: wo[k]
854
817
  },
855
- children: [
856
- /* @__PURE__ */ c("div", { style: { flex: 1, fontSize: 13 }, children: [
857
- /* @__PURE__ */ n("span", { style: { color: "#9ca3af" }, children: e }),
858
- /* @__PURE__ */ n("span", { style: { color: "#d1d5db", margin: "0 6px" }, children: "/" }),
859
- /* @__PURE__ */ n("span", { style: { color: "#111827", fontWeight: 600 }, children: t })
860
- ] }),
861
- /* @__PURE__ */ n(
862
- "div",
863
- {
864
- style: {
865
- display: "flex",
866
- gap: 2,
867
- background: "#f3f4f6",
868
- borderRadius: 6,
869
- padding: 2
870
- },
871
- children: ["mobile", "tablet", "desktop"].map((a) => /* @__PURE__ */ n(
872
- "button",
873
- {
874
- type: "button",
875
- onClick: () => {
876
- d(a);
877
- },
878
- "aria-pressed": o === a,
879
- style: {
880
- padding: "3px 9px",
881
- fontSize: 12,
882
- border: "none",
883
- borderRadius: 4,
884
- cursor: "pointer",
885
- background: o === a ? "#fff" : "transparent",
886
- color: o === a ? "#111827" : "#6b7280",
887
- fontWeight: o === a ? 600 : 400,
888
- boxShadow: o === a ? "0 1px 2px rgba(0,0,0,0.08)" : "none",
889
- transition: "all 0.1s"
890
- },
891
- children: ie[a]
892
- },
893
- a
894
- ))
895
- }
818
+ k
819
+ )) }),
820
+ /* @__PURE__ */ t("div", { className: "jogak:flex jogak:gap-1 jogak:items-center", children: ["white", "dark", "transparent"].map((k) => /* @__PURE__ */ t(
821
+ "button",
822
+ {
823
+ type: "button",
824
+ onClick: () => {
825
+ n(k);
826
+ },
827
+ "aria-pressed": r === k,
828
+ "aria-label": `${k} background`,
829
+ className: N(
830
+ "jogak:w-5 jogak:h-5 jogak:rounded-[var(--jogak-radius-md)] jogak:border-2 jogak:cursor-pointer jogak:p-0 jogak:shrink-0",
831
+ B,
832
+ r === k ? "jogak:border-[var(--jogak-color-accent)]" : "jogak:border-[var(--jogak-color-border-strong)]"
896
833
  ),
897
- /* @__PURE__ */ n("div", { style: { display: "flex", gap: 4, alignItems: "center" }, children: ["white", "dark", "transparent"].map((a) => /* @__PURE__ */ n(
898
- "button",
899
- {
900
- type: "button",
901
- onClick: () => {
902
- r(a);
903
- },
904
- "aria-pressed": i === a,
905
- "aria-label": `${a} background`,
906
- style: {
907
- width: 20,
908
- height: 20,
909
- borderRadius: 4,
910
- border: i === a ? "2px solid #2563eb" : "2px solid #d1d5db",
911
- cursor: "pointer",
912
- padding: 0,
913
- flexShrink: 0,
914
- ...M[a]
915
- }
916
- },
917
- a
918
- )) }),
919
- s && /* @__PURE__ */ n(
920
- "button",
921
- {
922
- type: "button",
923
- onClick: l,
924
- style: {
925
- padding: "3px 10px",
926
- fontSize: 12,
927
- border: "1px solid #d1d5db",
928
- borderRadius: 4,
929
- background: "#fff",
930
- cursor: "pointer",
931
- color: "#374151"
932
- },
933
- children: "Reset"
934
- }
935
- )
936
- ]
937
- }
938
- );
834
+ style: V[k]
835
+ },
836
+ k
837
+ )) }),
838
+ g && /* @__PURE__ */ t(
839
+ "button",
840
+ {
841
+ type: "button",
842
+ onClick: i,
843
+ 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",
844
+ children: "Reset"
845
+ }
846
+ )
847
+ ] });
939
848
  }
940
- function ce({ entry: e, args: t, source: o, theme: i }) {
941
- const d = V(null), [r, s] = x(!1);
942
- return v(() => {
943
- const l = d.current;
944
- if (l !== null)
945
- return j.render(e, t, l), () => {
946
- j.unmount(l);
947
- };
948
- }, [e]), v(() => {
949
- const l = d.current;
950
- l !== null && j.render(e, t, l);
951
- }, [e, t]), /* @__PURE__ */ c("div", { children: [
952
- /* @__PURE__ */ c("div", { style: { position: "relative" }, children: [
953
- /* @__PURE__ */ n(
954
- "div",
955
- {
956
- ref: d,
957
- "data-testid": "preview-content",
958
- style: {
959
- border: "1px dashed #e5e7eb",
960
- borderRadius: 8,
961
- padding: 16,
962
- paddingBottom: 36
963
- }
964
- }
965
- ),
966
- /* @__PURE__ */ n(
967
- "button",
968
- {
969
- type: "button",
970
- onClick: () => {
971
- s((l) => !l);
972
- },
973
- "aria-pressed": r,
974
- "aria-label": r ? "Hide source code" : "Show source code",
975
- style: {
976
- position: "absolute",
977
- bottom: 8,
978
- right: 8,
979
- padding: "4px 9px",
980
- fontSize: 11,
981
- fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",
982
- fontWeight: 600,
983
- letterSpacing: "0.02em",
984
- background: r ? "#2563eb" : "#1e293b",
985
- color: "#fff",
986
- border: "none",
987
- borderRadius: 5,
988
- cursor: "pointer",
989
- boxShadow: "0 1px 4px rgba(0,0,0,0.2)",
990
- transition: "background 0.15s"
991
- },
992
- children: "</>"
993
- }
994
- )
995
- ] }),
996
- r && /* @__PURE__ */ n(
997
- "div",
849
+ function $o({ entry: o, args: a, theme: e, previewIsolation: r, userPreviewUrl: s, previewEntryPath: n }) {
850
+ const [g, i] = h(!1), k = mo(o, a), d = /* @__PURE__ */ j("div", { className: "jogak:relative", children: [
851
+ /* @__PURE__ */ t(
852
+ _o,
998
853
  {
999
- style: {
1000
- marginTop: 8,
1001
- borderRadius: 8,
1002
- overflow: "hidden",
1003
- height: 320,
1004
- boxShadow: "0 0 0 1px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.12)"
854
+ entry: o,
855
+ args: a,
856
+ previewIsolation: r,
857
+ userPreviewUrl: s,
858
+ previewEntryPath: n
859
+ }
860
+ ),
861
+ /* @__PURE__ */ t(
862
+ "button",
863
+ {
864
+ type: "button",
865
+ onClick: () => {
866
+ i((l) => !l);
1005
867
  },
1006
- children: /* @__PURE__ */ n(pe, { source: o, theme: i })
868
+ "aria-pressed": g,
869
+ "aria-label": g ? "Hide source code" : "Show source code",
870
+ className: N(
871
+ "jogak:absolute jogak:bottom-2 jogak:right-2 jogak:px-[9px] jogak:py-1",
872
+ "jogak:text-[11px] jogak:font-[family-name:var(--jogak-font-mono)] jogak:font-semibold jogak:tracking-[0.02em]",
873
+ "jogak:text-[var(--jogak-color-bg)] jogak:border-none jogak:rounded-[5px] jogak:cursor-pointer",
874
+ "jogak:shadow-[0_1px_4px_rgba(0,0,0,0.2)] jogak:transition-[background-color] jogak:duration-150 jogak:leading-none",
875
+ g ? "jogak:bg-[var(--jogak-color-accent)]" : "jogak:bg-[#1e293b]"
876
+ ),
877
+ children: "</>"
1007
878
  }
1008
879
  )
1009
880
  ] });
881
+ return /* @__PURE__ */ j("div", { children: [
882
+ d,
883
+ g && /* @__PURE__ */ t("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__ */ t(Lo, { source: k, theme: e }) })
884
+ ] });
1010
885
  }
1011
- function pe({ source: e, theme: t }) {
1012
- const [o, i] = x(!1), d = t.plain.backgroundColor ?? "#1e293b";
1013
- return e === void 0 ? /* @__PURE__ */ n(
886
+ const J = "jogak:border jogak:border-dashed jogak:border-[var(--jogak-color-border)] jogak:rounded-[var(--jogak-radius-xl)] jogak:p-4 jogak:pb-9";
887
+ function _o({ entry: o, args: a, previewIsolation: e, userPreviewUrl: r, previewEntryPath: s }) {
888
+ return e === "shadow" ? /* @__PURE__ */ t(
889
+ uo,
890
+ {
891
+ "data-testid": "preview-content",
892
+ className: J,
893
+ children: /* @__PURE__ */ t(Ao, { entry: o, args: a })
894
+ }
895
+ ) : e === "iframe" ? /* @__PURE__ */ t(
896
+ po,
897
+ {
898
+ entry: o,
899
+ args: a,
900
+ userPreviewUrl: r,
901
+ previewEntryPath: s,
902
+ "data-testid": "preview-content",
903
+ className: `${J} jogak:block jogak:w-full jogak:bg-transparent jogak:min-h-[256px]`
904
+ }
905
+ ) : /* @__PURE__ */ t(Ro, { entry: o, args: a });
906
+ }
907
+ function Ro({ entry: o, args: a }) {
908
+ const e = L(null);
909
+ return x(() => {
910
+ const r = e.current;
911
+ if (r !== null)
912
+ return $.render(o, a, r), () => {
913
+ queueMicrotask(() => {
914
+ $.unmount(r);
915
+ });
916
+ };
917
+ }, [o]), x(() => {
918
+ const r = e.current;
919
+ r !== null && $.render(o, a, r);
920
+ }, [o, a]), /* @__PURE__ */ t(
1014
921
  "div",
1015
922
  {
1016
- style: {
1017
- height: "100%",
1018
- display: "flex",
1019
- alignItems: "center",
1020
- justifyContent: "center",
1021
- background: d,
1022
- color: "#94a3b8",
1023
- fontSize: 13
1024
- },
923
+ ref: e,
924
+ "data-testid": "preview-content",
925
+ className: J
926
+ }
927
+ );
928
+ }
929
+ function Ao({ entry: o, args: a }) {
930
+ const e = L(null);
931
+ return x(() => {
932
+ const r = e.current;
933
+ if (r !== null)
934
+ return $.render(o, a, r), () => {
935
+ queueMicrotask(() => {
936
+ $.unmount(r);
937
+ });
938
+ };
939
+ }, [o]), x(() => {
940
+ const r = e.current;
941
+ r !== null && $.render(o, a, r);
942
+ }, [o, a]), /* @__PURE__ */ t("div", { ref: e, "data-testid": "preview-content-shadow" });
943
+ }
944
+ function Lo({ source: o, theme: a }) {
945
+ const [e, r] = h(!1), s = a.plain.backgroundColor ?? "#1e293b";
946
+ return o === void 0 ? /* @__PURE__ */ t(
947
+ "div",
948
+ {
949
+ className: "jogak:h-full jogak:flex jogak:items-center jogak:justify-center jogak:bg-[var(--jogak-source-bg)] jogak:text-[#94a3b8] jogak:text-[13px]",
950
+ style: { "--jogak-source-bg": s },
1025
951
  children: "Source not available"
1026
952
  }
1027
- ) : /* @__PURE__ */ c("div", { style: { position: "relative", height: "100%" }, children: [
1028
- /* @__PURE__ */ n(
953
+ ) : /* @__PURE__ */ j("div", { className: "jogak:relative jogak:h-full", children: [
954
+ /* @__PURE__ */ t(
1029
955
  "button",
1030
956
  {
1031
957
  type: "button",
1032
958
  onClick: () => {
1033
- navigator.clipboard.writeText(e).then(() => {
1034
- i(!0), setTimeout(() => {
1035
- i(!1);
959
+ navigator.clipboard.writeText(o).then(() => {
960
+ r(!0), setTimeout(() => {
961
+ r(!1);
1036
962
  }, 2e3);
1037
963
  });
1038
964
  },
1039
- style: {
1040
- position: "absolute",
1041
- top: 10,
1042
- right: 12,
1043
- zIndex: 1,
1044
- padding: "3px 9px",
1045
- fontSize: 11,
1046
- background: "rgba(255,255,255,0.1)",
1047
- color: "#e2e8f0",
1048
- border: "1px solid rgba(255,255,255,0.18)",
1049
- borderRadius: 4,
1050
- cursor: "pointer"
1051
- },
1052
- children: o ? "✓ Copied" : "Copy"
965
+ className: "jogak:absolute jogak:top-[10px] jogak:right-3 jogak:z-[1] jogak:px-[9px] jogak:py-[3px] jogak:text-[11px] jogak:bg-[rgba(255,255,255,0.1)] jogak:text-[#e2e8f0] jogak:border jogak:border-[rgba(255,255,255,0.18)] jogak:rounded-[var(--jogak-radius-md)] jogak:cursor-pointer jogak:leading-none",
966
+ children: e ? "✓ Copied" : "Copy"
1053
967
  }
1054
968
  ),
1055
- /* @__PURE__ */ n(Q, { code: e.trim(), language: "tsx", theme: t, children: ({ style: s, tokens: l, getLineProps: a, getTokenProps: m }) => /* @__PURE__ */ n(
969
+ /* @__PURE__ */ t(eo, { code: o.trim(), language: "tsx", theme: a, children: ({ style: g, tokens: i, getLineProps: k, getTokenProps: d }) => /* @__PURE__ */ t(
1056
970
  "pre",
1057
971
  {
1058
- style: {
1059
- ...s,
1060
- margin: 0,
1061
- padding: "12px 0",
1062
- fontSize: 12.5,
1063
- lineHeight: 1.7,
1064
- fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",
1065
- height: "100%",
1066
- boxSizing: "border-box",
1067
- overflow: "auto"
1068
- },
1069
- children: l.map((p, h) => /* @__PURE__ */ c(
972
+ 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",
973
+ style: g,
974
+ children: i.map((l, c) => /* @__PURE__ */ j(
1070
975
  "div",
1071
976
  {
1072
- ...a({ line: p }),
1073
- style: {
1074
- ...a({ line: p }).style,
1075
- display: "flex",
1076
- paddingRight: 24
1077
- },
977
+ ...k({ line: l }),
978
+ className: "jogak:flex jogak:pr-6",
979
+ style: k({ line: l }).style,
1078
980
  children: [
1079
- /* @__PURE__ */ n(
1080
- "span",
1081
- {
1082
- style: {
1083
- userSelect: "none",
1084
- minWidth: 40,
1085
- paddingLeft: 14,
1086
- paddingRight: 14,
1087
- textAlign: "right",
1088
- color: "rgba(148,163,184,0.45)",
1089
- flexShrink: 0
1090
- },
1091
- children: h + 1
1092
- }
1093
- ),
1094
- /* @__PURE__ */ n("span", { children: p.map((S, b) => /* @__PURE__ */ n("span", { ...m({ token: S }) }, b)) })
981
+ /* @__PURE__ */ t("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: c + 1 }),
982
+ /* @__PURE__ */ t("span", { children: l.map((p, f) => /* @__PURE__ */ t("span", { ...d({ token: p }) }, f)) })
1095
983
  ]
1096
984
  },
1097
- h
985
+ c
1098
986
  ))
1099
987
  }
1100
988
  ) })
1101
989
  ] });
1102
990
  }
1103
- function E() {
991
+ function I() {
1104
992
  if (typeof window > "u") return null;
1105
- const e = new URLSearchParams(window.location.search), t = e.get("entry");
1106
- if (t === null) return null;
1107
- const o = e.get("jogak");
1108
- return { entryId: t, jogakName: o };
993
+ const o = new URLSearchParams(window.location.search), a = o.get("entry");
994
+ if (a === null) return null;
995
+ const e = o.get("jogak");
996
+ return { entryId: a, jogakName: e };
1109
997
  }
1110
- function fe(e, t) {
1111
- const o = new URLSearchParams();
1112
- o.set("entry", e), o.set("jogak", t), window.history.pushState({}, "", `?${o.toString()}`);
998
+ function Eo(o, a) {
999
+ const e = new URLSearchParams();
1000
+ e.set("entry", o), e.set("jogak", a), window.history.pushState({}, "", `?${e.toString()}`);
1113
1001
  }
1114
- function me({
1115
- entries: e,
1116
- metas: t,
1117
- codeTheme: o = "vsDark"
1002
+ function Wo({
1003
+ entries: o,
1004
+ metas: a,
1005
+ codeTheme: e = "vsDark",
1006
+ previewIsolation: r = "iframe",
1007
+ userPreviewUrl: s = "",
1008
+ previewEntryPath: n = "/__jogak_preview__/index.html",
1009
+ userViteUrl: g
1118
1010
  } = {}) {
1119
- const i = w(() => {
1120
- if (e !== void 0) {
1121
- t !== void 0 && console.warn(
1011
+ const i = s !== "" ? s : g ?? "", k = _(() => {
1012
+ if (o !== void 0) {
1013
+ a !== void 0 && console.warn(
1122
1014
  "[jogak] JogakApp received both `entries` and `metas` — `entries` (eager) takes precedence."
1123
1015
  );
1124
- const f = new U();
1125
- for (const u of e) f.register(u);
1126
- return f;
1016
+ const u = new Z();
1017
+ for (const m of o) u.register(m);
1018
+ return u;
1127
1019
  }
1128
- if (t !== void 0)
1129
- for (const f of t) F.registerMeta(f);
1130
- return F;
1131
- }, [e, t]), d = w(() => E(), []), [r, s] = x(
1020
+ if (a !== void 0)
1021
+ for (const u of a) H.registerMeta(u);
1022
+ return H;
1023
+ }, [o, a]), d = _(() => I(), []), [l, c] = h(
1132
1024
  (d == null ? void 0 : d.entryId) ?? null
1133
- ), [l, a] = x(
1025
+ ), [p, f] = h(
1134
1026
  (d == null ? void 0 : d.jogakName) ?? null
1135
- ), [m, p] = x({});
1136
- v(() => {
1137
- const f = () => {
1138
- const u = E();
1139
- u !== null ? (s(u.entryId), a(u.jogakName), p({})) : (s(null), a(null));
1027
+ ), [S, y] = h({});
1028
+ x(() => {
1029
+ const u = () => {
1030
+ const m = I();
1031
+ m !== null ? (c(m.entryId), f(m.jogakName), y({})) : (c(null), f(null));
1140
1032
  };
1141
- return window.addEventListener("popstate", f), () => {
1142
- window.removeEventListener("popstate", f);
1033
+ return window.addEventListener("popstate", u), () => {
1034
+ window.removeEventListener("popstate", u);
1143
1035
  };
1144
1036
  }, []);
1145
- const h = R((f, u) => {
1146
- s(f), a(u), p({}), fe(f, u);
1147
- }, []), S = R((f, u) => {
1148
- if (s((g) => g === f ? f : g), a((g) => g ?? u), typeof window < "u") {
1149
- const g = new URLSearchParams(window.location.search);
1150
- g.get("entry") === f && g.get("jogak") === null && (g.set("jogak", u), window.history.replaceState({}, "", `?${g.toString()}`));
1037
+ const v = A((u, m) => {
1038
+ c(u), f(m), y({}), Eo(u, m);
1039
+ }, []), w = A((u, m) => {
1040
+ if (c((b) => b === u ? u : b), f((b) => b ?? m), typeof window < "u") {
1041
+ const b = new URLSearchParams(window.location.search);
1042
+ b.get("entry") === u && b.get("jogak") === null && (b.set("jogak", m), window.history.replaceState({}, "", `?${b.toString()}`));
1151
1043
  }
1152
- }, []), b = R((f, u) => {
1153
- p((g) => ({ ...g, [f]: u }));
1154
- }, []), y = R(() => {
1155
- p({});
1044
+ }, []), W = A((u, m) => {
1045
+ y((b) => ({ ...b, [u]: m }));
1046
+ }, []), R = A(() => {
1047
+ y({});
1156
1048
  }, []);
1157
- return /* @__PURE__ */ n(T, { registry: i, children: /* @__PURE__ */ c(
1049
+ return /* @__PURE__ */ t(oo, { registry: k, children: /* @__PURE__ */ j(
1158
1050
  "div",
1159
1051
  {
1160
- style: {
1161
- display: "grid",
1162
- gridTemplateColumns: "260px 1fr",
1163
- height: "100dvh",
1164
- overflow: "hidden"
1165
- },
1052
+ "data-jogak-shell": !0,
1053
+ className: "jogak:grid jogak:grid-cols-[260px_1fr] jogak:h-dvh jogak:overflow-hidden",
1166
1054
  children: [
1167
- /* @__PURE__ */ n(
1168
- Y,
1055
+ /* @__PURE__ */ t(
1056
+ ro,
1169
1057
  {
1170
- selectedEntryId: r,
1171
- selectedJogakName: l,
1172
- onSelect: h
1058
+ selectedEntryId: l,
1059
+ selectedJogakName: p,
1060
+ onSelect: v
1173
1061
  }
1174
1062
  ),
1175
- /* @__PURE__ */ n("main", { style: { overflow: "hidden", minHeight: 0 }, children: r !== null ? /* @__PURE__ */ n(
1176
- le,
1063
+ /* @__PURE__ */ t("main", { className: "jogak:overflow-hidden jogak:min-h-0", children: l !== null ? /* @__PURE__ */ t(
1064
+ yo,
1177
1065
  {
1178
- entryId: r,
1179
- jogakName: l,
1180
- overrideArgs: m,
1181
- onArgChange: b,
1182
- onReset: y,
1183
- codeTheme: o,
1184
- onResolveJogak: S
1066
+ entryId: l,
1067
+ jogakName: p,
1068
+ overrideArgs: S,
1069
+ onArgChange: W,
1070
+ onReset: R,
1071
+ codeTheme: e,
1072
+ onResolveJogak: w,
1073
+ previewIsolation: r,
1074
+ userPreviewUrl: i,
1075
+ previewEntryPath: n
1185
1076
  }
1186
- ) : /* @__PURE__ */ n(
1187
- "div",
1188
- {
1189
- style: {
1190
- display: "flex",
1191
- alignItems: "center",
1192
- justifyContent: "center",
1193
- height: "100%",
1194
- color: "#9ca3af"
1195
- },
1196
- children: "Select a component from the sidebar"
1197
- }
1198
- ) })
1077
+ ) : /* @__PURE__ */ t("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" }) })
1199
1078
  ]
1200
1079
  }
1201
1080
  ) });
1202
1081
  }
1203
- function ye() {
1204
- const e = q(), t = w(() => e.getAll(), [e]), o = w(() => e.getTree(), [e]), i = w(
1205
- () => (d) => e.search(d),
1206
- [e]
1082
+ function zo() {
1083
+ const o = ao(), a = _(() => o.getAll(), [o]), e = _(() => o.getTree(), [o]), r = _(
1084
+ () => (s) => o.search(s),
1085
+ [o]
1207
1086
  );
1208
- return { entries: t, tree: o, search: i };
1087
+ return { entries: a, tree: e, search: r };
1209
1088
  }
1210
1089
  export {
1211
- re as Actions,
1212
- te as Controls,
1213
- me as JogakApp,
1214
- le as Preview,
1215
- Y as Sidebar,
1216
- ye as useRegistry
1090
+ jo as Actions,
1091
+ io as Controls,
1092
+ Wo as JogakApp,
1093
+ yo as Preview,
1094
+ ro as Sidebar,
1095
+ zo as useRegistry
1217
1096
  };