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