@jogak/ui 0.1.0-alpha.7 → 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/CHANGELOG.md +30 -0
- package/README.md +28 -23
- package/dist/components/Preview/ShadowMount.d.ts +13 -14
- package/dist/host/index.d.ts +2 -2
- package/dist/index.js +1 -2
- package/dist/index.mjs +207 -222
- package/package.json +3 -3
- package/src/app/App.tsx +1 -1
- package/src/app/main.tsx +10 -6
- package/src/components/Preview/IframeMount.tsx +4 -2
- package/src/components/Preview/ShadowMount.tsx +15 -59
- package/src/components/Preview/index.tsx +10 -3
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as j, jsx as e } from "react/jsx-runtime";
|
|
2
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
|
|
4
|
-
import { useRegistryMeta as
|
|
5
|
-
import { themes as z, Highlight as
|
|
6
|
-
import { createPortal as
|
|
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
7
|
function F(o) {
|
|
8
8
|
var a, r, t = "";
|
|
9
9
|
if (typeof o == "string" || typeof o == "number") t += o;
|
|
10
10
|
else if (typeof o == "object") if (Array.isArray(o)) {
|
|
11
|
-
var
|
|
12
|
-
for (a = 0; a <
|
|
11
|
+
var k = o.length;
|
|
12
|
+
for (a = 0; a < k; a++) o[a] && (r = F(o[a])) && (t && (t += " "), t += r);
|
|
13
13
|
} else for (r in o) o[r] && (t && (t += " "), t += r);
|
|
14
14
|
return t;
|
|
15
15
|
}
|
|
16
16
|
function v() {
|
|
17
|
-
for (var o, a, r = 0, t = "",
|
|
17
|
+
for (var o, a, r = 0, t = "", k = arguments.length; r < k; r++) (o = arguments[r]) && (a = F(o)) && (t && (t += " "), t += a);
|
|
18
18
|
return t;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function ao({
|
|
21
21
|
selectedEntryId: o,
|
|
22
22
|
selectedJogakName: a,
|
|
23
23
|
onSelect: r
|
|
24
24
|
}) {
|
|
25
|
-
const [t,
|
|
26
|
-
return /* @__PURE__ */
|
|
25
|
+
const [t, k] = m(""), { metaTree: n, searchMeta: s } = X(), l = t.trim().length > 0 ? s(t) : null;
|
|
26
|
+
return /* @__PURE__ */ j(
|
|
27
27
|
"aside",
|
|
28
28
|
{
|
|
29
29
|
"data-testid": "sidebar",
|
|
@@ -36,16 +36,16 @@ function eo({
|
|
|
36
36
|
placeholder: "Search components...",
|
|
37
37
|
value: t,
|
|
38
38
|
onChange: (g) => {
|
|
39
|
-
|
|
39
|
+
k(g.target.value);
|
|
40
40
|
},
|
|
41
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)]",
|
|
42
42
|
"aria-label": "Search components"
|
|
43
43
|
}
|
|
44
44
|
) }),
|
|
45
|
-
/* @__PURE__ */ e("nav", { className: "jogak:flex-1 jogak:overflow-auto jogak:py-2", children:
|
|
46
|
-
|
|
45
|
+
/* @__PURE__ */ e("nav", { className: "jogak:flex-1 jogak:overflow-auto jogak:py-2", children: l !== null ? /* @__PURE__ */ e(
|
|
46
|
+
eo,
|
|
47
47
|
{
|
|
48
|
-
metas:
|
|
48
|
+
metas: l,
|
|
49
49
|
selectedEntryId: o,
|
|
50
50
|
selectedJogakName: a,
|
|
51
51
|
onSelect: r
|
|
@@ -63,35 +63,35 @@ function eo({
|
|
|
63
63
|
}
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function eo({
|
|
67
67
|
metas: o,
|
|
68
68
|
selectedEntryId: a,
|
|
69
69
|
selectedJogakName: r,
|
|
70
70
|
onSelect: t
|
|
71
71
|
}) {
|
|
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((
|
|
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
73
|
U,
|
|
74
74
|
{
|
|
75
|
-
meta:
|
|
75
|
+
meta: k,
|
|
76
76
|
selectedEntryId: a,
|
|
77
77
|
selectedJogakName: r,
|
|
78
78
|
onSelect: t,
|
|
79
79
|
indent: 0
|
|
80
80
|
}
|
|
81
|
-
) },
|
|
81
|
+
) }, k.id)) });
|
|
82
82
|
}
|
|
83
83
|
function H({
|
|
84
84
|
node: o,
|
|
85
85
|
selectedEntryId: a,
|
|
86
86
|
selectedJogakName: r,
|
|
87
87
|
onSelect: t,
|
|
88
|
-
depth:
|
|
88
|
+
depth: k = 0
|
|
89
89
|
}) {
|
|
90
90
|
return /* @__PURE__ */ e(
|
|
91
91
|
"ul",
|
|
92
92
|
{
|
|
93
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": `${
|
|
94
|
+
style: { "--jogak-tree-pl": `${k * 12}px` },
|
|
95
95
|
children: Object.entries(o).map(([n, s]) => /* @__PURE__ */ e("li", { children: "id" in s ? /* @__PURE__ */ e(
|
|
96
96
|
U,
|
|
97
97
|
{
|
|
@@ -102,35 +102,35 @@ function H({
|
|
|
102
102
|
indent: 0
|
|
103
103
|
}
|
|
104
104
|
) : /* @__PURE__ */ e(
|
|
105
|
-
|
|
105
|
+
ro,
|
|
106
106
|
{
|
|
107
107
|
label: n,
|
|
108
108
|
node: s,
|
|
109
109
|
selectedEntryId: a,
|
|
110
110
|
selectedJogakName: r,
|
|
111
111
|
onSelect: t,
|
|
112
|
-
depth:
|
|
112
|
+
depth: k + 1
|
|
113
113
|
}
|
|
114
114
|
) }, n))
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function ro({
|
|
119
119
|
label: o,
|
|
120
120
|
node: a,
|
|
121
121
|
selectedEntryId: r,
|
|
122
122
|
selectedJogakName: t,
|
|
123
|
-
onSelect:
|
|
123
|
+
onSelect: k,
|
|
124
124
|
depth: n
|
|
125
125
|
}) {
|
|
126
|
-
const [s,
|
|
127
|
-
return /* @__PURE__ */
|
|
128
|
-
/* @__PURE__ */
|
|
126
|
+
const [s, l] = m(!0);
|
|
127
|
+
return /* @__PURE__ */ j("div", { children: [
|
|
128
|
+
/* @__PURE__ */ j(
|
|
129
129
|
"button",
|
|
130
130
|
{
|
|
131
131
|
type: "button",
|
|
132
132
|
onClick: () => {
|
|
133
|
-
|
|
133
|
+
l((g) => !g);
|
|
134
134
|
},
|
|
135
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
136
|
"aria-expanded": s,
|
|
@@ -146,7 +146,7 @@ function to({
|
|
|
146
146
|
node: a,
|
|
147
147
|
selectedEntryId: r,
|
|
148
148
|
selectedJogakName: t,
|
|
149
|
-
onSelect:
|
|
149
|
+
onSelect: k,
|
|
150
150
|
depth: n
|
|
151
151
|
}
|
|
152
152
|
)
|
|
@@ -157,25 +157,25 @@ function U({
|
|
|
157
157
|
selectedEntryId: a,
|
|
158
158
|
selectedJogakName: r,
|
|
159
159
|
onSelect: t,
|
|
160
|
-
indent:
|
|
160
|
+
indent: k
|
|
161
161
|
}) {
|
|
162
|
-
const n = o.id === a, [s,
|
|
162
|
+
const n = o.id === a, [s, l] = m(n);
|
|
163
163
|
b(() => {
|
|
164
|
-
n &&
|
|
164
|
+
n && l(!0);
|
|
165
165
|
}, [n]);
|
|
166
|
-
const g = o.title.split("/").pop() ?? o.title,
|
|
167
|
-
return /* @__PURE__ */
|
|
168
|
-
/* @__PURE__ */
|
|
166
|
+
const g = o.title.split("/").pop() ?? o.title, i = 16 + k * 12;
|
|
167
|
+
return /* @__PURE__ */ j("div", { children: [
|
|
168
|
+
/* @__PURE__ */ j(
|
|
169
169
|
"button",
|
|
170
170
|
{
|
|
171
171
|
type: "button",
|
|
172
172
|
onClick: () => {
|
|
173
173
|
if (n)
|
|
174
|
-
|
|
174
|
+
l((c) => !c);
|
|
175
175
|
else {
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
|
|
176
|
+
l(!0);
|
|
177
|
+
const c = o.jogakNames[0];
|
|
178
|
+
c !== void 0 && t(o.id, c);
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
181
|
className: v(
|
|
@@ -184,7 +184,7 @@ function U({
|
|
|
184
184
|
"jogak:border-none jogak:cursor-pointer jogak:text-left jogak:text-[13px]",
|
|
185
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
186
|
),
|
|
187
|
-
style: { "--jogak-entry-pl": `${
|
|
187
|
+
style: { "--jogak-entry-pl": `${i}px` },
|
|
188
188
|
"aria-expanded": s,
|
|
189
189
|
children: [
|
|
190
190
|
/* @__PURE__ */ e("span", { className: "jogak:text-[10px] jogak:shrink-0 jogak:leading-none", children: s ? "▾" : "▸" }),
|
|
@@ -192,14 +192,14 @@ function U({
|
|
|
192
192
|
]
|
|
193
193
|
}
|
|
194
194
|
),
|
|
195
|
-
s && /* @__PURE__ */ e("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0", children: o.jogakNames.map((
|
|
196
|
-
const p = n &&
|
|
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;
|
|
197
197
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
198
198
|
"button",
|
|
199
199
|
{
|
|
200
200
|
type: "button",
|
|
201
201
|
onClick: () => {
|
|
202
|
-
t(o.id,
|
|
202
|
+
t(o.id, c);
|
|
203
203
|
},
|
|
204
204
|
className: v(
|
|
205
205
|
"jogak:block jogak:w-full jogak:text-left jogak:pr-3 jogak:py-1",
|
|
@@ -207,21 +207,21 @@ function U({
|
|
|
207
207
|
"jogak:border-none jogak:cursor-pointer jogak:text-[12px]",
|
|
208
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"
|
|
209
209
|
),
|
|
210
|
-
style: { "--jogak-jogak-pl": `${
|
|
210
|
+
style: { "--jogak-jogak-pl": `${i + 18}px` },
|
|
211
211
|
"aria-current": p ? "true" : void 0,
|
|
212
|
-
children:
|
|
212
|
+
children: c
|
|
213
213
|
}
|
|
214
|
-
) },
|
|
214
|
+
) }, c);
|
|
215
215
|
}) })
|
|
216
216
|
] });
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
const r = a == null ? void 0 : a.control, t = (a == null ? void 0 : a.action) !== void 0 && a.action !== !1,
|
|
220
|
-
return t ||
|
|
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";
|
|
221
221
|
}
|
|
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)]",
|
|
223
|
-
function
|
|
224
|
-
switch (
|
|
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)) {
|
|
225
225
|
case "boolean":
|
|
226
226
|
return /* @__PURE__ */ e(
|
|
227
227
|
"input",
|
|
@@ -278,45 +278,45 @@ function go({ argKey: o, value: a, argType: r, onArgChange: t }) {
|
|
|
278
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) });
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
const
|
|
283
|
-
return /* @__PURE__ */
|
|
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]]);
|
|
283
|
+
return /* @__PURE__ */ j("div", { className: "jogak:border-t-2 jogak:border-[var(--jogak-color-border)]", children: [
|
|
284
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" }),
|
|
285
|
-
|
|
286
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
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: [
|
|
286
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ j("tr", { children: [
|
|
287
287
|
/* @__PURE__ */ e("th", { className: L, children: "Name" }),
|
|
288
288
|
/* @__PURE__ */ e("th", { className: L, children: "Control" }),
|
|
289
289
|
/* @__PURE__ */ e("th", { className: L, children: "Description" })
|
|
290
290
|
] }) }),
|
|
291
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
292
|
-
const
|
|
293
|
-
return /* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ e("tbody", { children: k.map(([n, s]) => {
|
|
292
|
+
const l = a[n];
|
|
293
|
+
return /* @__PURE__ */ j("tr", { children: [
|
|
294
294
|
/* @__PURE__ */ e(
|
|
295
295
|
"td",
|
|
296
296
|
{
|
|
297
297
|
className: v(
|
|
298
|
-
|
|
298
|
+
E,
|
|
299
299
|
"jogak:font-[family-name:var(--jogak-font-mono)] jogak:text-[12px] jogak:text-[var(--jogak-color-fg)] jogak:whitespace-nowrap"
|
|
300
300
|
),
|
|
301
301
|
children: n
|
|
302
302
|
}
|
|
303
303
|
),
|
|
304
|
-
/* @__PURE__ */ e("td", { className:
|
|
305
|
-
|
|
304
|
+
/* @__PURE__ */ e("td", { className: E, children: /* @__PURE__ */ e(
|
|
305
|
+
no,
|
|
306
306
|
{
|
|
307
307
|
argKey: n,
|
|
308
308
|
value: s,
|
|
309
|
-
argType:
|
|
309
|
+
argType: l,
|
|
310
310
|
onArgChange: r
|
|
311
311
|
}
|
|
312
312
|
) }),
|
|
313
|
-
/* @__PURE__ */ e("td", { className: v(
|
|
313
|
+
/* @__PURE__ */ e("td", { className: v(E, "jogak:text-[var(--jogak-color-fg-subtle)]"), children: (l == null ? void 0 : l.description) ?? "" })
|
|
314
314
|
] }, n);
|
|
315
315
|
}) })
|
|
316
316
|
] })
|
|
317
317
|
] });
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function so(o) {
|
|
320
320
|
if (o.length === 0) return "()";
|
|
321
321
|
try {
|
|
322
322
|
return o.map((a) => {
|
|
@@ -335,16 +335,16 @@ function lo(o) {
|
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
function ko(o) {
|
|
338
|
-
const a = new Date(o), r = a.getHours().toString().padStart(2, "0"), t = a.getMinutes().toString().padStart(2, "0"),
|
|
339
|
-
return `${r}:${t}:${
|
|
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}`;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function lo() {
|
|
342
342
|
const [o, a] = m(() => A.getLogs());
|
|
343
343
|
b(() => A.subscribe(a), []);
|
|
344
344
|
const r = o.length === 0;
|
|
345
|
-
return /* @__PURE__ */
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
/* @__PURE__ */
|
|
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
348
|
"Actions ",
|
|
349
349
|
o.length > 0 && `(${o.length.toString()})`
|
|
350
350
|
] }),
|
|
@@ -364,16 +364,16 @@ function co() {
|
|
|
364
364
|
}
|
|
365
365
|
)
|
|
366
366
|
] }),
|
|
367
|
-
/* @__PURE__ */ e("div", { className: "jogak:flex-1 jogak:overflow-auto", children: r ? /* @__PURE__ */ e("div", { className: "jogak:px-5 jogak:py-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px] jogak:leading-none", children: "함수 prop이 호출되면 여기에 기록됩니다" }) : /* @__PURE__ */ e("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((t) => /* @__PURE__ */
|
|
367
|
+
/* @__PURE__ */ e("div", { className: "jogak:flex-1 jogak:overflow-auto", children: r ? /* @__PURE__ */ e("div", { className: "jogak:px-5 jogak:py-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px] jogak:leading-none", children: "함수 prop이 호출되면 여기에 기록됩니다" }) : /* @__PURE__ */ e("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((t) => /* @__PURE__ */ j(
|
|
368
368
|
"li",
|
|
369
369
|
{
|
|
370
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)]",
|
|
371
371
|
children: [
|
|
372
372
|
/* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[11px] jogak:min-w-[92px]", children: ko(t.timestamp) }),
|
|
373
373
|
/* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-violet)] jogak:font-semibold", children: t.name }),
|
|
374
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ j("span", { className: "jogak:text-[var(--jogak-color-fg)] jogak:break-all jogak:flex-1", children: [
|
|
375
375
|
"(",
|
|
376
|
-
|
|
376
|
+
so(t.args),
|
|
377
377
|
")"
|
|
378
378
|
] })
|
|
379
379
|
]
|
|
@@ -388,69 +388,50 @@ function jo({
|
|
|
388
388
|
style: r,
|
|
389
389
|
"data-testid": t
|
|
390
390
|
}) {
|
|
391
|
-
const
|
|
391
|
+
const k = _(null), [n, s] = m(null);
|
|
392
392
|
return b(() => {
|
|
393
|
-
const
|
|
394
|
-
if (
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
const j = io(g);
|
|
398
|
-
return () => {
|
|
399
|
-
j.disconnect();
|
|
400
|
-
};
|
|
393
|
+
const l = k.current;
|
|
394
|
+
if (l === null) return;
|
|
395
|
+
const g = l.shadowRoot ?? l.attachShadow({ mode: "open" });
|
|
396
|
+
s(g);
|
|
401
397
|
}, []), /* @__PURE__ */ e(
|
|
402
398
|
"div",
|
|
403
399
|
{
|
|
404
|
-
ref:
|
|
400
|
+
ref: k,
|
|
405
401
|
className: a,
|
|
406
402
|
"data-testid": t,
|
|
407
403
|
style: r,
|
|
408
|
-
children: n !== null ?
|
|
404
|
+
children: n !== null ? oo(o, n) : null
|
|
409
405
|
}
|
|
410
406
|
);
|
|
411
407
|
}
|
|
412
|
-
function
|
|
413
|
-
const a = [];
|
|
414
|
-
for (const r of Array.from(document.styleSheets))
|
|
415
|
-
try {
|
|
416
|
-
const t = r.cssRules, l = new CSSStyleSheet(), n = Array.from(t).map((s) => s.cssText).join(`
|
|
417
|
-
`);
|
|
418
|
-
l.replaceSync(n), a.push(l);
|
|
419
|
-
} catch {
|
|
420
|
-
}
|
|
421
|
-
o.adoptedStyleSheets = a;
|
|
422
|
-
}
|
|
423
|
-
function io(o) {
|
|
424
|
-
const a = new MutationObserver(() => {
|
|
425
|
-
G(o);
|
|
426
|
-
});
|
|
427
|
-
return a.observe(document.head, { childList: !0, subtree: !0 }), a;
|
|
428
|
-
}
|
|
429
|
-
function uo({
|
|
408
|
+
function io({
|
|
430
409
|
entry: o,
|
|
431
410
|
args: a,
|
|
432
411
|
className: r,
|
|
433
412
|
"data-testid": t
|
|
434
413
|
}) {
|
|
435
|
-
const
|
|
414
|
+
const k = _(null), n = _(!1);
|
|
436
415
|
return b(() => {
|
|
437
|
-
const s =
|
|
416
|
+
const s = k.current;
|
|
438
417
|
if (s === null) return;
|
|
439
|
-
const
|
|
440
|
-
var g,
|
|
441
|
-
n.current = !0, (
|
|
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 });
|
|
442
421
|
};
|
|
443
|
-
return s.addEventListener("load",
|
|
444
|
-
|
|
445
|
-
|
|
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
|
+
});
|
|
446
427
|
};
|
|
447
428
|
}, []), b(() => {
|
|
448
|
-
var s,
|
|
449
|
-
n.current && ((g = (
|
|
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 }));
|
|
450
431
|
}, [o, a]), /* @__PURE__ */ e(
|
|
451
432
|
"iframe",
|
|
452
433
|
{
|
|
453
|
-
ref:
|
|
434
|
+
ref: k,
|
|
454
435
|
src: "/preview-frame.html",
|
|
455
436
|
title: "Preview",
|
|
456
437
|
className: r,
|
|
@@ -458,11 +439,11 @@ function uo({
|
|
|
458
439
|
}
|
|
459
440
|
);
|
|
460
441
|
}
|
|
461
|
-
const
|
|
442
|
+
const q = {
|
|
462
443
|
mobile: 375,
|
|
463
444
|
tablet: 768,
|
|
464
445
|
desktop: "none"
|
|
465
|
-
},
|
|
446
|
+
}, co = {
|
|
466
447
|
mobile: "Mobile",
|
|
467
448
|
tablet: "Tablet",
|
|
468
449
|
desktop: "Desktop"
|
|
@@ -486,21 +467,21 @@ const I = {
|
|
|
486
467
|
"--jogak-canvas-bg-position": "0 0, 0 8px, 8px -8px, -8px 0px"
|
|
487
468
|
}
|
|
488
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)]";
|
|
489
|
-
function
|
|
470
|
+
function uo(o) {
|
|
490
471
|
return z[o] ?? z.vsDark;
|
|
491
472
|
}
|
|
492
|
-
function
|
|
473
|
+
function po({
|
|
493
474
|
entryId: o,
|
|
494
475
|
jogakName: a,
|
|
495
476
|
overrideArgs: r,
|
|
496
477
|
onArgChange: t,
|
|
497
|
-
onReset:
|
|
478
|
+
onReset: k,
|
|
498
479
|
codeTheme: n,
|
|
499
480
|
onResolveJogak: s,
|
|
500
|
-
previewIsolation:
|
|
481
|
+
previewIsolation: l = "shadow"
|
|
501
482
|
}) {
|
|
502
|
-
const g =
|
|
503
|
-
return g.status === "unknown" ? /* @__PURE__ */
|
|
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(
|
|
504
485
|
"div",
|
|
505
486
|
{
|
|
506
487
|
"data-testid": "preview-not-found",
|
|
@@ -510,13 +491,13 @@ function mo({
|
|
|
510
491
|
o
|
|
511
492
|
]
|
|
512
493
|
}
|
|
513
|
-
) : g.status === "error" ? /* @__PURE__ */
|
|
494
|
+
) : g.status === "error" ? /* @__PURE__ */ j(
|
|
514
495
|
"div",
|
|
515
496
|
{
|
|
516
497
|
"data-testid": "preview-error",
|
|
517
498
|
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",
|
|
518
499
|
children: [
|
|
519
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ j("div", { className: "jogak:font-semibold", children: [
|
|
520
501
|
"Failed to load entry: ",
|
|
521
502
|
o
|
|
522
503
|
] }),
|
|
@@ -524,58 +505,58 @@ function mo({
|
|
|
524
505
|
]
|
|
525
506
|
}
|
|
526
507
|
) : g.status === "loading" ? /* @__PURE__ */ e(
|
|
527
|
-
|
|
508
|
+
fo,
|
|
528
509
|
{
|
|
529
510
|
meta: g.meta,
|
|
530
511
|
jogakName: a,
|
|
531
|
-
viewport:
|
|
512
|
+
viewport: i,
|
|
532
513
|
bgMode: p,
|
|
533
|
-
onViewportChange:
|
|
514
|
+
onViewportChange: c,
|
|
534
515
|
onBgModeChange: w
|
|
535
516
|
}
|
|
536
517
|
) : /* @__PURE__ */ e(
|
|
537
|
-
|
|
518
|
+
mo,
|
|
538
519
|
{
|
|
539
520
|
entry: g.entry,
|
|
540
521
|
jogakName: a,
|
|
541
522
|
overrideArgs: r,
|
|
542
523
|
onArgChange: t,
|
|
543
|
-
onReset:
|
|
524
|
+
onReset: k,
|
|
544
525
|
onResolveJogak: s,
|
|
545
|
-
viewport:
|
|
526
|
+
viewport: i,
|
|
546
527
|
bgMode: p,
|
|
547
528
|
bottomTab: N,
|
|
548
|
-
onViewportChange:
|
|
529
|
+
onViewportChange: c,
|
|
549
530
|
onBgModeChange: w,
|
|
550
531
|
onBottomTabChange: h,
|
|
551
532
|
prismTheme: x,
|
|
552
|
-
previewIsolation:
|
|
533
|
+
previewIsolation: l
|
|
553
534
|
}
|
|
554
535
|
);
|
|
555
536
|
}
|
|
556
|
-
function
|
|
537
|
+
function fo({
|
|
557
538
|
meta: o,
|
|
558
539
|
jogakName: a,
|
|
559
540
|
viewport: r,
|
|
560
541
|
bgMode: t,
|
|
561
|
-
onViewportChange:
|
|
542
|
+
onViewportChange: k,
|
|
562
543
|
onBgModeChange: n
|
|
563
544
|
}) {
|
|
564
|
-
const s = a ?? o.jogakNames[0] ?? "...",
|
|
565
|
-
return /* @__PURE__ */
|
|
545
|
+
const s = a ?? o.jogakNames[0] ?? "...", l = q[r];
|
|
546
|
+
return /* @__PURE__ */ j(
|
|
566
547
|
"div",
|
|
567
548
|
{
|
|
568
549
|
"data-testid": "preview-loading",
|
|
569
550
|
className: "jogak:flex jogak:flex-col jogak:h-full",
|
|
570
551
|
children: [
|
|
571
552
|
/* @__PURE__ */ e(
|
|
572
|
-
|
|
553
|
+
G,
|
|
573
554
|
{
|
|
574
555
|
title: o.title,
|
|
575
556
|
jogakName: s,
|
|
576
557
|
viewport: r,
|
|
577
558
|
bgMode: t,
|
|
578
|
-
onViewportChange:
|
|
559
|
+
onViewportChange: k,
|
|
579
560
|
onBgModeChange: n,
|
|
580
561
|
showReset: !1,
|
|
581
562
|
onReset: () => {
|
|
@@ -592,9 +573,9 @@ function bo({
|
|
|
592
573
|
{
|
|
593
574
|
className: "jogak:mx-auto jogak:p-6 jogak:max-w-[var(--jogak-canvas-mw)]",
|
|
594
575
|
style: {
|
|
595
|
-
"--jogak-canvas-mw":
|
|
576
|
+
"--jogak-canvas-mw": l === "none" ? "100%" : `${l}px`
|
|
596
577
|
},
|
|
597
|
-
children: /* @__PURE__ */
|
|
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: [
|
|
598
579
|
"Loading ",
|
|
599
580
|
o.title,
|
|
600
581
|
"…"
|
|
@@ -607,18 +588,18 @@ function bo({
|
|
|
607
588
|
}
|
|
608
589
|
);
|
|
609
590
|
}
|
|
610
|
-
function
|
|
591
|
+
function mo({
|
|
611
592
|
entry: o,
|
|
612
593
|
jogakName: a,
|
|
613
594
|
overrideArgs: r,
|
|
614
595
|
onArgChange: t,
|
|
615
|
-
onReset:
|
|
596
|
+
onReset: k,
|
|
616
597
|
onResolveJogak: n,
|
|
617
598
|
viewport: s,
|
|
618
|
-
bgMode:
|
|
599
|
+
bgMode: l,
|
|
619
600
|
bottomTab: g,
|
|
620
|
-
onViewportChange:
|
|
621
|
-
onBgModeChange:
|
|
601
|
+
onViewportChange: i,
|
|
602
|
+
onBgModeChange: c,
|
|
622
603
|
onBottomTabChange: p,
|
|
623
604
|
prismTheme: w,
|
|
624
605
|
previewIsolation: N
|
|
@@ -628,39 +609,39 @@ function ho({
|
|
|
628
609
|
if (b(() => {
|
|
629
610
|
a === null && h !== null && n !== void 0 && n(o.id, h);
|
|
630
611
|
}, [a, h, o.id, n]), h === null)
|
|
631
|
-
return /* @__PURE__ */
|
|
612
|
+
return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
|
|
632
613
|
"Entry has no jogaks: ",
|
|
633
614
|
o.id
|
|
634
615
|
] });
|
|
635
616
|
const x = o.jogaks.find((y) => y.name === h);
|
|
636
617
|
if (x === void 0)
|
|
637
|
-
return /* @__PURE__ */
|
|
618
|
+
return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
|
|
638
619
|
"Jogak not found: ",
|
|
639
620
|
h
|
|
640
621
|
] });
|
|
641
622
|
const u = { ...x.args ?? {}, ...r }, f = {
|
|
642
623
|
...o.meta.argTypes ?? {},
|
|
643
624
|
...x.argTypes ?? {}
|
|
644
|
-
},
|
|
645
|
-
return /* @__PURE__ */
|
|
625
|
+
}, I = Object.keys(r).length > 0, J = q[s];
|
|
626
|
+
return /* @__PURE__ */ j("div", { className: "jogak:flex jogak:flex-col jogak:h-full", children: [
|
|
646
627
|
/* @__PURE__ */ e(
|
|
647
|
-
|
|
628
|
+
G,
|
|
648
629
|
{
|
|
649
630
|
title: o.title,
|
|
650
631
|
jogakName: x.name,
|
|
651
632
|
viewport: s,
|
|
652
|
-
bgMode:
|
|
653
|
-
onViewportChange:
|
|
654
|
-
onBgModeChange:
|
|
655
|
-
showReset:
|
|
656
|
-
onReset:
|
|
633
|
+
bgMode: l,
|
|
634
|
+
onViewportChange: i,
|
|
635
|
+
onBgModeChange: c,
|
|
636
|
+
showReset: I,
|
|
637
|
+
onReset: k
|
|
657
638
|
}
|
|
658
639
|
),
|
|
659
640
|
/* @__PURE__ */ e(
|
|
660
641
|
"div",
|
|
661
642
|
{
|
|
662
643
|
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${M}`,
|
|
663
|
-
style: P[
|
|
644
|
+
style: P[l],
|
|
664
645
|
children: /* @__PURE__ */ e(
|
|
665
646
|
"div",
|
|
666
647
|
{
|
|
@@ -670,7 +651,7 @@ function ho({
|
|
|
670
651
|
"--jogak-canvas-mw": J === "none" ? "100%" : `${J}px`
|
|
671
652
|
},
|
|
672
653
|
children: /* @__PURE__ */ e(
|
|
673
|
-
|
|
654
|
+
bo,
|
|
674
655
|
{
|
|
675
656
|
entry: o,
|
|
676
657
|
args: u,
|
|
@@ -684,7 +665,7 @@ function ho({
|
|
|
684
665
|
)
|
|
685
666
|
}
|
|
686
667
|
),
|
|
687
|
-
/* @__PURE__ */
|
|
668
|
+
/* @__PURE__ */ j(
|
|
688
669
|
"div",
|
|
689
670
|
{
|
|
690
671
|
"data-testid": "bottom-panel",
|
|
@@ -718,30 +699,30 @@ function ho({
|
|
|
718
699
|
}
|
|
719
700
|
),
|
|
720
701
|
/* @__PURE__ */ e("div", { className: "jogak:flex-1 jogak:min-h-0 jogak:overflow-auto", children: g === "controls" ? /* @__PURE__ */ e(
|
|
721
|
-
|
|
702
|
+
go,
|
|
722
703
|
{
|
|
723
704
|
args: u,
|
|
724
705
|
argTypes: f,
|
|
725
706
|
onArgChange: t
|
|
726
707
|
}
|
|
727
|
-
) : /* @__PURE__ */ e(
|
|
708
|
+
) : /* @__PURE__ */ e(lo, {}) })
|
|
728
709
|
]
|
|
729
710
|
}
|
|
730
711
|
)
|
|
731
712
|
] });
|
|
732
713
|
}
|
|
733
|
-
function
|
|
714
|
+
function G({
|
|
734
715
|
title: o,
|
|
735
716
|
jogakName: a,
|
|
736
717
|
viewport: r,
|
|
737
718
|
bgMode: t,
|
|
738
|
-
onViewportChange:
|
|
719
|
+
onViewportChange: k,
|
|
739
720
|
onBgModeChange: n,
|
|
740
721
|
showReset: s,
|
|
741
|
-
onReset:
|
|
722
|
+
onReset: l
|
|
742
723
|
}) {
|
|
743
|
-
return /* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
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: [
|
|
725
|
+
/* @__PURE__ */ j("div", { className: "jogak:flex-1 jogak:text-[13px]", children: [
|
|
745
726
|
/* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-fg-subtle)]", children: o }),
|
|
746
727
|
/* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-border-strong)] jogak:mx-1.5 jogak:leading-none", children: "/" }),
|
|
747
728
|
/* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-fg-strong)] jogak:font-semibold", children: a })
|
|
@@ -751,14 +732,14 @@ function q({
|
|
|
751
732
|
{
|
|
752
733
|
type: "button",
|
|
753
734
|
onClick: () => {
|
|
754
|
-
|
|
735
|
+
k(g);
|
|
755
736
|
},
|
|
756
737
|
"aria-pressed": r === g,
|
|
757
738
|
className: v(
|
|
758
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",
|
|
759
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"
|
|
760
741
|
),
|
|
761
|
-
children:
|
|
742
|
+
children: co[g]
|
|
762
743
|
},
|
|
763
744
|
g
|
|
764
745
|
)) }),
|
|
@@ -784,21 +765,21 @@ function q({
|
|
|
784
765
|
"button",
|
|
785
766
|
{
|
|
786
767
|
type: "button",
|
|
787
|
-
onClick:
|
|
768
|
+
onClick: l,
|
|
788
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",
|
|
789
770
|
children: "Reset"
|
|
790
771
|
}
|
|
791
772
|
)
|
|
792
773
|
] });
|
|
793
774
|
}
|
|
794
|
-
function
|
|
795
|
-
const [n, s] = m(!1),
|
|
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: [
|
|
796
777
|
/* @__PURE__ */ e(
|
|
797
|
-
|
|
778
|
+
ho,
|
|
798
779
|
{
|
|
799
780
|
entry: o,
|
|
800
781
|
args: a,
|
|
801
|
-
previewIsolation:
|
|
782
|
+
previewIsolation: k
|
|
802
783
|
}
|
|
803
784
|
),
|
|
804
785
|
/* @__PURE__ */ e(
|
|
@@ -821,37 +802,39 @@ function xo({ entry: o, args: a, source: r, theme: t, previewIsolation: l }) {
|
|
|
821
802
|
}
|
|
822
803
|
)
|
|
823
804
|
] });
|
|
824
|
-
return /* @__PURE__ */
|
|
825
|
-
|
|
826
|
-
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(
|
|
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 }) })
|
|
827
808
|
] });
|
|
828
809
|
}
|
|
829
|
-
const
|
|
830
|
-
function
|
|
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 }) {
|
|
831
812
|
return r === "shadow" ? /* @__PURE__ */ e(
|
|
832
813
|
jo,
|
|
833
814
|
{
|
|
834
815
|
"data-testid": "preview-content",
|
|
835
|
-
className:
|
|
836
|
-
children: /* @__PURE__ */ e(
|
|
816
|
+
className: O,
|
|
817
|
+
children: /* @__PURE__ */ e(vo, { entry: o, args: a })
|
|
837
818
|
}
|
|
838
819
|
) : r === "iframe" ? /* @__PURE__ */ e(
|
|
839
|
-
|
|
820
|
+
io,
|
|
840
821
|
{
|
|
841
822
|
entry: o,
|
|
842
823
|
args: a,
|
|
843
824
|
"data-testid": "preview-content",
|
|
844
|
-
className: `${
|
|
825
|
+
className: `${O} jogak:block jogak:w-full jogak:bg-transparent jogak:min-h-[256px]`
|
|
845
826
|
}
|
|
846
|
-
) : /* @__PURE__ */ e(
|
|
827
|
+
) : /* @__PURE__ */ e(xo, { entry: o, args: a });
|
|
847
828
|
}
|
|
848
|
-
function
|
|
829
|
+
function xo({ entry: o, args: a }) {
|
|
849
830
|
const r = _(null);
|
|
850
831
|
return b(() => {
|
|
851
832
|
const t = r.current;
|
|
852
833
|
if (t !== null)
|
|
853
834
|
return S.render(o, a, t), () => {
|
|
854
|
-
|
|
835
|
+
queueMicrotask(() => {
|
|
836
|
+
S.unmount(t);
|
|
837
|
+
});
|
|
855
838
|
};
|
|
856
839
|
}, [o]), b(() => {
|
|
857
840
|
const t = r.current;
|
|
@@ -861,33 +844,35 @@ function wo({ entry: o, args: a }) {
|
|
|
861
844
|
{
|
|
862
845
|
ref: r,
|
|
863
846
|
"data-testid": "preview-content",
|
|
864
|
-
className:
|
|
847
|
+
className: O
|
|
865
848
|
}
|
|
866
849
|
);
|
|
867
850
|
}
|
|
868
|
-
function
|
|
851
|
+
function vo({ entry: o, args: a }) {
|
|
869
852
|
const r = _(null);
|
|
870
853
|
return b(() => {
|
|
871
854
|
const t = r.current;
|
|
872
855
|
if (t !== null)
|
|
873
856
|
return S.render(o, a, t), () => {
|
|
874
|
-
|
|
857
|
+
queueMicrotask(() => {
|
|
858
|
+
S.unmount(t);
|
|
859
|
+
});
|
|
875
860
|
};
|
|
876
861
|
}, [o]), b(() => {
|
|
877
862
|
const t = r.current;
|
|
878
863
|
t !== null && S.render(o, a, t);
|
|
879
864
|
}, [o, a]), /* @__PURE__ */ e("div", { ref: r, "data-testid": "preview-content-shadow" });
|
|
880
865
|
}
|
|
881
|
-
function
|
|
882
|
-
const [r, t] = m(!1),
|
|
866
|
+
function wo({ source: o, theme: a }) {
|
|
867
|
+
const [r, t] = m(!1), k = a.plain.backgroundColor ?? "#1e293b";
|
|
883
868
|
return o === void 0 ? /* @__PURE__ */ e(
|
|
884
869
|
"div",
|
|
885
870
|
{
|
|
886
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]",
|
|
887
|
-
style: { "--jogak-source-bg":
|
|
872
|
+
style: { "--jogak-source-bg": k },
|
|
888
873
|
children: "Source not available"
|
|
889
874
|
}
|
|
890
|
-
) : /* @__PURE__ */
|
|
875
|
+
) : /* @__PURE__ */ j("div", { className: "jogak:relative jogak:h-full", children: [
|
|
891
876
|
/* @__PURE__ */ e(
|
|
892
877
|
"button",
|
|
893
878
|
{
|
|
@@ -903,20 +888,20 @@ function yo({ source: o, theme: a }) {
|
|
|
903
888
|
children: r ? "✓ Copied" : "Copy"
|
|
904
889
|
}
|
|
905
890
|
),
|
|
906
|
-
/* @__PURE__ */ e(
|
|
891
|
+
/* @__PURE__ */ e(T, { code: o.trim(), language: "tsx", theme: a, children: ({ style: s, tokens: l, getLineProps: g, getTokenProps: i }) => /* @__PURE__ */ e(
|
|
907
892
|
"pre",
|
|
908
893
|
{
|
|
909
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",
|
|
910
895
|
style: s,
|
|
911
|
-
children:
|
|
896
|
+
children: l.map((c, p) => /* @__PURE__ */ j(
|
|
912
897
|
"div",
|
|
913
898
|
{
|
|
914
|
-
...g({ line:
|
|
899
|
+
...g({ line: c }),
|
|
915
900
|
className: "jogak:flex jogak:pr-6",
|
|
916
|
-
style: g({ line:
|
|
901
|
+
style: g({ line: c }).style,
|
|
917
902
|
children: [
|
|
918
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 }),
|
|
919
|
-
/* @__PURE__ */ e("span", { children:
|
|
904
|
+
/* @__PURE__ */ e("span", { children: c.map((w, N) => /* @__PURE__ */ e("span", { ...i({ token: w }) }, N)) })
|
|
920
905
|
]
|
|
921
906
|
},
|
|
922
907
|
p
|
|
@@ -932,46 +917,46 @@ function D() {
|
|
|
932
917
|
const r = o.get("jogak");
|
|
933
918
|
return { entryId: a, jogakName: r };
|
|
934
919
|
}
|
|
935
|
-
function
|
|
920
|
+
function No(o, a) {
|
|
936
921
|
const r = new URLSearchParams();
|
|
937
922
|
r.set("entry", o), r.set("jogak", a), window.history.pushState({}, "", `?${r.toString()}`);
|
|
938
923
|
}
|
|
939
|
-
function
|
|
924
|
+
function $o({
|
|
940
925
|
entries: o,
|
|
941
926
|
metas: a,
|
|
942
927
|
codeTheme: r = "vsDark",
|
|
943
|
-
previewIsolation: t = "
|
|
928
|
+
previewIsolation: t = "shadow"
|
|
944
929
|
} = {}) {
|
|
945
|
-
const
|
|
930
|
+
const k = C(() => {
|
|
946
931
|
if (o !== void 0) {
|
|
947
932
|
a !== void 0 && console.warn(
|
|
948
933
|
"[jogak] JogakApp received both `entries` and `metas` — `entries` (eager) takes precedence."
|
|
949
934
|
);
|
|
950
|
-
const d = new
|
|
935
|
+
const d = new Q();
|
|
951
936
|
for (const u of o) d.register(u);
|
|
952
937
|
return d;
|
|
953
938
|
}
|
|
954
939
|
if (a !== void 0)
|
|
955
940
|
for (const d of a) W.registerMeta(d);
|
|
956
941
|
return W;
|
|
957
|
-
}, [o, a]), n = C(() => D(), []), [s,
|
|
942
|
+
}, [o, a]), n = C(() => D(), []), [s, l] = m(
|
|
958
943
|
(n == null ? void 0 : n.entryId) ?? null
|
|
959
|
-
), [g,
|
|
944
|
+
), [g, i] = m(
|
|
960
945
|
(n == null ? void 0 : n.jogakName) ?? null
|
|
961
|
-
), [
|
|
946
|
+
), [c, p] = m({});
|
|
962
947
|
b(() => {
|
|
963
948
|
const d = () => {
|
|
964
949
|
const u = D();
|
|
965
|
-
u !== null ? (
|
|
950
|
+
u !== null ? (l(u.entryId), i(u.jogakName), p({})) : (l(null), i(null));
|
|
966
951
|
};
|
|
967
952
|
return window.addEventListener("popstate", d), () => {
|
|
968
953
|
window.removeEventListener("popstate", d);
|
|
969
954
|
};
|
|
970
955
|
}, []);
|
|
971
956
|
const w = R((d, u) => {
|
|
972
|
-
|
|
957
|
+
l(d), i(u), p({}), No(d, u);
|
|
973
958
|
}, []), N = R((d, u) => {
|
|
974
|
-
if (
|
|
959
|
+
if (l((f) => f === d ? d : f), i((f) => f ?? u), typeof window < "u") {
|
|
975
960
|
const f = new URLSearchParams(window.location.search);
|
|
976
961
|
f.get("entry") === d && f.get("jogak") === null && (f.set("jogak", u), window.history.replaceState({}, "", `?${f.toString()}`));
|
|
977
962
|
}
|
|
@@ -980,14 +965,14 @@ function Oo({
|
|
|
980
965
|
}, []), x = R(() => {
|
|
981
966
|
p({});
|
|
982
967
|
}, []);
|
|
983
|
-
return /* @__PURE__ */ e(
|
|
968
|
+
return /* @__PURE__ */ e(Z, { registry: k, children: /* @__PURE__ */ j(
|
|
984
969
|
"div",
|
|
985
970
|
{
|
|
986
971
|
"data-jogak-shell": !0,
|
|
987
972
|
className: "jogak:grid jogak:grid-cols-[260px_1fr] jogak:h-dvh jogak:overflow-hidden",
|
|
988
973
|
children: [
|
|
989
974
|
/* @__PURE__ */ e(
|
|
990
|
-
|
|
975
|
+
ao,
|
|
991
976
|
{
|
|
992
977
|
selectedEntryId: s,
|
|
993
978
|
selectedJogakName: g,
|
|
@@ -995,11 +980,11 @@ function Oo({
|
|
|
995
980
|
}
|
|
996
981
|
),
|
|
997
982
|
/* @__PURE__ */ e("main", { className: "jogak:overflow-hidden jogak:min-h-0", children: s !== null ? /* @__PURE__ */ e(
|
|
998
|
-
|
|
983
|
+
po,
|
|
999
984
|
{
|
|
1000
985
|
entryId: s,
|
|
1001
986
|
jogakName: g,
|
|
1002
|
-
overrideArgs:
|
|
987
|
+
overrideArgs: c,
|
|
1003
988
|
onArgChange: h,
|
|
1004
989
|
onReset: x,
|
|
1005
990
|
codeTheme: r,
|
|
@@ -1011,18 +996,18 @@ function Oo({
|
|
|
1011
996
|
}
|
|
1012
997
|
) });
|
|
1013
998
|
}
|
|
1014
|
-
function
|
|
1015
|
-
const o =
|
|
1016
|
-
() => (
|
|
999
|
+
function Lo() {
|
|
1000
|
+
const o = K(), a = C(() => o.getAll(), [o]), r = C(() => o.getTree(), [o]), t = C(
|
|
1001
|
+
() => (k) => o.search(k),
|
|
1017
1002
|
[o]
|
|
1018
1003
|
);
|
|
1019
1004
|
return { entries: a, tree: r, search: t };
|
|
1020
1005
|
}
|
|
1021
1006
|
export {
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1007
|
+
lo as Actions,
|
|
1008
|
+
go as Controls,
|
|
1009
|
+
$o as JogakApp,
|
|
1010
|
+
po as Preview,
|
|
1011
|
+
ao as Sidebar,
|
|
1012
|
+
Lo as useRegistry
|
|
1028
1013
|
};
|