@jogak/ui 0.1.0-alpha.11 → 0.1.0-alpha.14.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 +15 -0
- package/dist/index.cjs +6 -6
- package/dist/index.mjs +650 -529
- package/dist/lib/adapter-for.d.ts +17 -0
- package/package.json +2 -2
- package/src/app/preview-frame.tsx +21 -4
- package/src/components/Controls/index.tsx +36 -0
- package/src/components/Preview/format-usage.ts +4 -1
- package/src/components/Preview/index.tsx +66 -10
package/dist/index.mjs
CHANGED
|
@@ -1,520 +1,605 @@
|
|
|
1
|
-
import { jsxs as j, jsx as
|
|
2
|
-
import { useState as h, useEffect as x, useRef as
|
|
3
|
-
import { defaultActionChannel 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
|
-
function
|
|
17
|
-
for (var o,
|
|
18
|
-
return
|
|
16
|
+
function w() {
|
|
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:
|
|
38
|
-
onChange: (
|
|
39
|
-
|
|
37
|
+
value: t,
|
|
38
|
+
onChange: (l) => {
|
|
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
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
|
-
meta:
|
|
99
|
-
selectedEntryId:
|
|
100
|
-
selectedJogakName:
|
|
101
|
-
onSelect:
|
|
98
|
+
meta: n,
|
|
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:
|
|
108
|
-
node:
|
|
109
|
-
selectedEntryId:
|
|
110
|
-
selectedJogakName:
|
|
111
|
-
onSelect:
|
|
112
|
-
depth:
|
|
107
|
+
label: s,
|
|
108
|
+
node: n,
|
|
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 [
|
|
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
|
-
i((
|
|
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
|
-
"aria-expanded":
|
|
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
|
-
|
|
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
|
|
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
|
-
i((
|
|
173
|
+
if (s)
|
|
174
|
+
i((c) => !c);
|
|
175
175
|
else {
|
|
176
176
|
i(!0);
|
|
177
|
-
const
|
|
178
|
-
|
|
177
|
+
const c = o.jogakNames[0];
|
|
178
|
+
c !== void 0 && t(o.id, c);
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
|
-
className:
|
|
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
|
-
"aria-expanded":
|
|
188
|
+
"aria-expanded": n,
|
|
189
189
|
children: [
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
|
|
190
|
+
/* @__PURE__ */ r("span", { className: "jogak:text-[10px] jogak:shrink-0 jogak:leading-none", children: n ? "▾" : "▸" }),
|
|
191
|
+
l
|
|
192
192
|
]
|
|
193
193
|
}
|
|
194
194
|
),
|
|
195
|
-
|
|
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
|
-
className:
|
|
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
|
+
}
|
|
232
|
+
}
|
|
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);
|
|
221
257
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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(
|
|
255
|
-
onChange: (
|
|
256
|
-
|
|
313
|
+
value: String(e ?? ""),
|
|
314
|
+
onChange: (n) => {
|
|
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(
|
|
342
|
+
([n]) => {
|
|
343
|
+
var i;
|
|
344
|
+
return ((i = e[n]) == null ? void 0 : i.defaultValue) !== void 0;
|
|
345
|
+
}
|
|
346
|
+
);
|
|
283
347
|
return /* @__PURE__ */ j("div", { className: "jogak:border-t-2 jogak:border-[var(--jogak-color-border)]", children: [
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
/* @__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" })
|
|
290
355
|
] }) }),
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
const
|
|
356
|
+
/* @__PURE__ */ r("tbody", { children: g.map(([n, i]) => {
|
|
357
|
+
const l = e[n];
|
|
293
358
|
return /* @__PURE__ */ j("tr", { children: [
|
|
294
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ r(
|
|
295
360
|
"td",
|
|
296
361
|
{
|
|
297
|
-
className:
|
|
298
|
-
|
|
362
|
+
className: w(
|
|
363
|
+
L,
|
|
299
364
|
"jogak:font-[family-name:var(--jogak-font-mono)] jogak:text-[12px] jogak:text-[var(--jogak-color-fg)] jogak:whitespace-nowrap"
|
|
300
365
|
),
|
|
301
366
|
children: n
|
|
302
367
|
}
|
|
303
368
|
),
|
|
304
|
-
/* @__PURE__ */
|
|
305
|
-
|
|
369
|
+
/* @__PURE__ */ r("td", { className: L, children: /* @__PURE__ */ r(
|
|
370
|
+
fo,
|
|
306
371
|
{
|
|
307
372
|
argKey: n,
|
|
308
|
-
value:
|
|
309
|
-
argType:
|
|
310
|
-
onArgChange:
|
|
373
|
+
value: i,
|
|
374
|
+
argType: l,
|
|
375
|
+
onArgChange: a
|
|
311
376
|
}
|
|
312
377
|
) }),
|
|
313
|
-
/* @__PURE__ */
|
|
378
|
+
s && /* @__PURE__ */ r(
|
|
379
|
+
"td",
|
|
380
|
+
{
|
|
381
|
+
className: w(
|
|
382
|
+
L,
|
|
383
|
+
"jogak:font-[family-name:var(--jogak-font-mono)] jogak:text-[12px] jogak:text-[var(--jogak-color-fg-muted)] jogak:whitespace-nowrap"
|
|
384
|
+
),
|
|
385
|
+
children: (l == null ? void 0 : l.defaultValue) !== void 0 ? mo(l.defaultValue) : ""
|
|
386
|
+
}
|
|
387
|
+
),
|
|
388
|
+
/* @__PURE__ */ r("td", { className: w(L, "jogak:text-[var(--jogak-color-fg-subtle)]"), children: (l == null ? void 0 : l.description) ?? "" })
|
|
314
389
|
] }, n);
|
|
315
390
|
}) })
|
|
316
391
|
] })
|
|
317
392
|
] });
|
|
318
393
|
}
|
|
319
|
-
function
|
|
394
|
+
function mo(o) {
|
|
395
|
+
if (typeof o == "string") return `'${o}'`;
|
|
396
|
+
if (typeof o == "number" || typeof o == "boolean" || o === null)
|
|
397
|
+
return String(o);
|
|
398
|
+
try {
|
|
399
|
+
return JSON.stringify(o);
|
|
400
|
+
} catch {
|
|
401
|
+
return String(o);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
function bo(o) {
|
|
320
405
|
if (o.length === 0) return "()";
|
|
321
406
|
try {
|
|
322
|
-
return o.map((
|
|
323
|
-
var
|
|
324
|
-
if (
|
|
325
|
-
if (
|
|
326
|
-
if (typeof
|
|
327
|
-
if (typeof
|
|
328
|
-
const
|
|
329
|
-
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);
|
|
330
415
|
}
|
|
331
|
-
return JSON.stringify(
|
|
416
|
+
return JSON.stringify(e);
|
|
332
417
|
}).join(", ");
|
|
333
418
|
} catch {
|
|
334
419
|
return "[unserializable]";
|
|
335
420
|
}
|
|
336
421
|
}
|
|
337
|
-
function
|
|
338
|
-
const
|
|
339
|
-
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}`;
|
|
340
425
|
}
|
|
341
|
-
function
|
|
342
|
-
const [o,
|
|
343
|
-
x(() =>
|
|
344
|
-
const
|
|
426
|
+
function xo() {
|
|
427
|
+
const [o, e] = h(() => P.getLogs());
|
|
428
|
+
x(() => P.subscribe(e), []);
|
|
429
|
+
const a = o.length === 0;
|
|
345
430
|
return /* @__PURE__ */ j("div", { className: "jogak:h-full jogak:flex jogak:flex-col", children: [
|
|
346
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: [
|
|
347
432
|
/* @__PURE__ */ j("span", { children: [
|
|
348
433
|
"Actions ",
|
|
349
434
|
o.length > 0 && `(${o.length.toString()})`
|
|
350
435
|
] }),
|
|
351
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ r(
|
|
352
437
|
"button",
|
|
353
438
|
{
|
|
354
439
|
type: "button",
|
|
355
440
|
onClick: () => {
|
|
356
|
-
|
|
441
|
+
P.clear();
|
|
357
442
|
},
|
|
358
|
-
disabled:
|
|
359
|
-
className:
|
|
443
|
+
disabled: a,
|
|
444
|
+
className: w(
|
|
360
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",
|
|
361
|
-
|
|
446
|
+
a ? "jogak:text-[var(--jogak-color-fg-subtle)] jogak:cursor-default" : "jogak:text-[var(--jogak-color-fg)] jogak:cursor-pointer"
|
|
362
447
|
),
|
|
363
448
|
children: "Clear"
|
|
364
449
|
}
|
|
365
450
|
)
|
|
366
451
|
] }),
|
|
367
|
-
/* @__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(
|
|
368
453
|
"li",
|
|
369
454
|
{
|
|
370
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)]",
|
|
371
456
|
children: [
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
/* @__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 }),
|
|
374
459
|
/* @__PURE__ */ j("span", { className: "jogak:text-[var(--jogak-color-fg)] jogak:break-all jogak:flex-1", children: [
|
|
375
460
|
"(",
|
|
376
|
-
|
|
461
|
+
bo(t.args),
|
|
377
462
|
")"
|
|
378
463
|
] })
|
|
379
464
|
]
|
|
380
465
|
},
|
|
381
|
-
|
|
466
|
+
t.id
|
|
382
467
|
)) }) })
|
|
383
468
|
] });
|
|
384
469
|
}
|
|
385
|
-
function
|
|
470
|
+
function vo({
|
|
386
471
|
children: o,
|
|
387
|
-
className:
|
|
388
|
-
style:
|
|
389
|
-
"data-testid":
|
|
472
|
+
className: e,
|
|
473
|
+
style: a,
|
|
474
|
+
"data-testid": t
|
|
390
475
|
}) {
|
|
391
|
-
const
|
|
476
|
+
const g = $(null), [s, n] = h(null);
|
|
392
477
|
return x(() => {
|
|
393
|
-
const i =
|
|
478
|
+
const i = g.current;
|
|
394
479
|
if (i === null) return;
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
}, []), /* @__PURE__ */
|
|
480
|
+
const l = i.shadowRoot ?? i.attachShadow({ mode: "open" });
|
|
481
|
+
n(l);
|
|
482
|
+
}, []), /* @__PURE__ */ r(
|
|
398
483
|
"div",
|
|
399
484
|
{
|
|
400
|
-
ref:
|
|
401
|
-
className:
|
|
402
|
-
"data-testid":
|
|
403
|
-
style:
|
|
404
|
-
children:
|
|
485
|
+
ref: g,
|
|
486
|
+
className: e,
|
|
487
|
+
"data-testid": t,
|
|
488
|
+
style: a,
|
|
489
|
+
children: s !== null ? no(o, s) : null
|
|
405
490
|
}
|
|
406
491
|
);
|
|
407
492
|
}
|
|
408
|
-
function
|
|
493
|
+
function wo({
|
|
409
494
|
entry: o,
|
|
410
|
-
args:
|
|
411
|
-
userPreviewUrl:
|
|
412
|
-
previewEntryPath:
|
|
413
|
-
className:
|
|
414
|
-
"data-testid":
|
|
495
|
+
args: e,
|
|
496
|
+
userPreviewUrl: a,
|
|
497
|
+
previewEntryPath: t,
|
|
498
|
+
className: g,
|
|
499
|
+
"data-testid": s
|
|
415
500
|
}) {
|
|
416
|
-
const
|
|
501
|
+
const n = $(null), [i, l] = h(!1), d = a !== "" ? `${a}${t}` : "/preview-frame.html";
|
|
417
502
|
return x(() => {
|
|
418
|
-
const
|
|
419
|
-
const
|
|
420
|
-
if (
|
|
421
|
-
const
|
|
422
|
-
|
|
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);
|
|
423
508
|
};
|
|
424
|
-
return window.addEventListener("message",
|
|
425
|
-
window.removeEventListener("message",
|
|
509
|
+
return window.addEventListener("message", c), () => {
|
|
510
|
+
window.removeEventListener("message", c);
|
|
426
511
|
};
|
|
427
512
|
}, []), x(() => {
|
|
428
|
-
var
|
|
513
|
+
var k;
|
|
429
514
|
if (!i) return;
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
{ type: "jogak:setProps", entryId: o.id, args:
|
|
515
|
+
const c = n.current;
|
|
516
|
+
c !== null && ((k = c.contentWindow) == null || k.postMessage(
|
|
517
|
+
{ type: "jogak:setProps", entryId: o.id, args: e },
|
|
433
518
|
"*"
|
|
434
519
|
));
|
|
435
|
-
}, [i, o,
|
|
436
|
-
const
|
|
520
|
+
}, [i, o, e]), x(() => {
|
|
521
|
+
const c = n.current;
|
|
437
522
|
return () => {
|
|
438
|
-
|
|
439
|
-
var
|
|
440
|
-
(
|
|
523
|
+
c !== null && queueMicrotask(() => {
|
|
524
|
+
var k;
|
|
525
|
+
(k = c.contentWindow) == null || k.postMessage({ type: "jogak:unmount" }, "*");
|
|
441
526
|
});
|
|
442
527
|
};
|
|
443
|
-
}, []), /* @__PURE__ */
|
|
528
|
+
}, []), /* @__PURE__ */ r(
|
|
444
529
|
"iframe",
|
|
445
530
|
{
|
|
446
|
-
ref:
|
|
531
|
+
ref: n,
|
|
447
532
|
src: d,
|
|
448
533
|
title: "Preview",
|
|
449
|
-
className:
|
|
450
|
-
"data-testid":
|
|
534
|
+
className: g,
|
|
535
|
+
"data-testid": s
|
|
451
536
|
}
|
|
452
537
|
);
|
|
453
538
|
}
|
|
454
|
-
const
|
|
455
|
-
function
|
|
456
|
-
const
|
|
457
|
-
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(`
|
|
458
543
|
`))
|
|
459
544
|
return d;
|
|
460
|
-
const
|
|
461
|
-
` +
|
|
545
|
+
const c = s.length === 0 ? "" : `
|
|
546
|
+
` + s.join(`
|
|
462
547
|
`) + `
|
|
463
548
|
`;
|
|
464
549
|
if (i) {
|
|
465
|
-
const
|
|
466
|
-
`).map((
|
|
550
|
+
const k = (n ?? "").split(`
|
|
551
|
+
`).map((f) => ` ${f}`).join(`
|
|
467
552
|
`);
|
|
468
|
-
return `<${
|
|
469
|
-
${
|
|
470
|
-
</${
|
|
553
|
+
return `<${a}${c}>
|
|
554
|
+
${k}
|
|
555
|
+
</${a}>`;
|
|
471
556
|
}
|
|
472
|
-
return `<${
|
|
557
|
+
return `<${a}${c}/>`;
|
|
473
558
|
}
|
|
474
|
-
function
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
if (typeof
|
|
478
|
-
return
|
|
479
|
-
if (typeof
|
|
480
|
-
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;
|
|
481
566
|
}
|
|
482
|
-
const
|
|
483
|
-
return
|
|
567
|
+
const a = o.title.split("/").pop();
|
|
568
|
+
return a !== void 0 && a.length > 0 ? a : "Component";
|
|
484
569
|
}
|
|
485
|
-
function
|
|
486
|
-
const { children:
|
|
487
|
-
return { children:
|
|
570
|
+
function So(o) {
|
|
571
|
+
const { children: e, ...a } = o;
|
|
572
|
+
return { children: e, restProps: a };
|
|
488
573
|
}
|
|
489
|
-
function
|
|
490
|
-
return o == null ? null : typeof o == "string" ? o.length === 0 ? null : o : typeof o == "number" || typeof o == "bigint" ? `{${o.toString()}}` : typeof o == "boolean" ? null : `{${
|
|
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)}}`;
|
|
491
576
|
}
|
|
492
|
-
function
|
|
493
|
-
if (
|
|
494
|
-
if (
|
|
495
|
-
if (
|
|
496
|
-
if (typeof
|
|
497
|
-
const
|
|
498
|
-
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}"`;
|
|
499
584
|
}
|
|
500
|
-
return typeof
|
|
585
|
+
return typeof e == "number" || typeof e == "bigint" ? `${o}={${e.toString()}}` : typeof e == "function" ? `${o}={fn}` : `${o}={${Y(e)}}`;
|
|
501
586
|
}
|
|
502
|
-
function
|
|
587
|
+
function Y(o) {
|
|
503
588
|
try {
|
|
504
589
|
return JSON.stringify(o);
|
|
505
590
|
} catch {
|
|
506
591
|
return String(o);
|
|
507
592
|
}
|
|
508
593
|
}
|
|
509
|
-
const
|
|
594
|
+
const Z = {
|
|
510
595
|
mobile: 375,
|
|
511
596
|
tablet: 768,
|
|
512
597
|
desktop: "none"
|
|
513
|
-
},
|
|
598
|
+
}, Ao = {
|
|
514
599
|
mobile: "Mobile",
|
|
515
600
|
tablet: "Tablet",
|
|
516
601
|
desktop: "Desktop"
|
|
517
|
-
},
|
|
602
|
+
}, J = {
|
|
518
603
|
white: {
|
|
519
604
|
"--jogak-canvas-bg": "#ffffff",
|
|
520
605
|
"--jogak-canvas-bg-image": "none",
|
|
@@ -533,24 +618,24 @@ const X = {
|
|
|
533
618
|
"--jogak-canvas-bg-size": "16px 16px",
|
|
534
619
|
"--jogak-canvas-bg-position": "0 0, 0 8px, 8px -8px, -8px 0px"
|
|
535
620
|
}
|
|
536
|
-
},
|
|
537
|
-
function
|
|
538
|
-
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;
|
|
539
624
|
}
|
|
540
|
-
function
|
|
625
|
+
function Eo({
|
|
541
626
|
entryId: o,
|
|
542
|
-
jogakName:
|
|
543
|
-
overrideArgs:
|
|
544
|
-
onArgChange:
|
|
545
|
-
onReset:
|
|
546
|
-
codeTheme:
|
|
547
|
-
onResolveJogak:
|
|
627
|
+
jogakName: e,
|
|
628
|
+
overrideArgs: a,
|
|
629
|
+
onArgChange: t,
|
|
630
|
+
onReset: g,
|
|
631
|
+
codeTheme: s,
|
|
632
|
+
onResolveJogak: n,
|
|
548
633
|
previewIsolation: i = "iframe",
|
|
549
|
-
userPreviewUrl:
|
|
634
|
+
userPreviewUrl: l = "",
|
|
550
635
|
previewEntryPath: d = "/__jogak_preview__/index.html"
|
|
551
636
|
}) {
|
|
552
|
-
const
|
|
553
|
-
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(
|
|
554
639
|
"div",
|
|
555
640
|
{
|
|
556
641
|
"data-testid": "preview-not-found",
|
|
@@ -560,7 +645,7 @@ function yo({
|
|
|
560
645
|
o
|
|
561
646
|
]
|
|
562
647
|
}
|
|
563
|
-
) :
|
|
648
|
+
) : c.status === "error" ? /* @__PURE__ */ j(
|
|
564
649
|
"div",
|
|
565
650
|
{
|
|
566
651
|
"data-testid": "preview-error",
|
|
@@ -570,76 +655,76 @@ function yo({
|
|
|
570
655
|
"Failed to load entry: ",
|
|
571
656
|
o
|
|
572
657
|
] }),
|
|
573
|
-
/* @__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 })
|
|
574
659
|
]
|
|
575
660
|
}
|
|
576
|
-
) :
|
|
577
|
-
|
|
661
|
+
) : c.status === "loading" ? /* @__PURE__ */ r(
|
|
662
|
+
Lo,
|
|
578
663
|
{
|
|
579
|
-
meta:
|
|
580
|
-
jogakName:
|
|
581
|
-
viewport:
|
|
582
|
-
bgMode:
|
|
583
|
-
onViewportChange:
|
|
584
|
-
onBgModeChange:
|
|
664
|
+
meta: c.meta,
|
|
665
|
+
jogakName: e,
|
|
666
|
+
viewport: k,
|
|
667
|
+
bgMode: p,
|
|
668
|
+
onViewportChange: f,
|
|
669
|
+
onBgModeChange: C
|
|
585
670
|
}
|
|
586
|
-
) : /* @__PURE__ */
|
|
587
|
-
|
|
671
|
+
) : /* @__PURE__ */ r(
|
|
672
|
+
Oo,
|
|
588
673
|
{
|
|
589
|
-
entry:
|
|
590
|
-
jogakName:
|
|
591
|
-
overrideArgs:
|
|
592
|
-
onArgChange:
|
|
593
|
-
onReset:
|
|
594
|
-
onResolveJogak:
|
|
595
|
-
viewport:
|
|
596
|
-
bgMode:
|
|
674
|
+
entry: c.entry,
|
|
675
|
+
jogakName: e,
|
|
676
|
+
overrideArgs: a,
|
|
677
|
+
onArgChange: t,
|
|
678
|
+
onReset: g,
|
|
679
|
+
onResolveJogak: n,
|
|
680
|
+
viewport: k,
|
|
681
|
+
bgMode: p,
|
|
597
682
|
bottomTab: y,
|
|
598
|
-
onViewportChange:
|
|
599
|
-
onBgModeChange:
|
|
683
|
+
onViewportChange: f,
|
|
684
|
+
onBgModeChange: C,
|
|
600
685
|
onBottomTabChange: v,
|
|
601
|
-
prismTheme:
|
|
686
|
+
prismTheme: N,
|
|
602
687
|
previewIsolation: i,
|
|
603
|
-
userPreviewUrl:
|
|
688
|
+
userPreviewUrl: l,
|
|
604
689
|
previewEntryPath: d
|
|
605
690
|
}
|
|
606
691
|
);
|
|
607
692
|
}
|
|
608
|
-
function
|
|
693
|
+
function Lo({
|
|
609
694
|
meta: o,
|
|
610
|
-
jogakName:
|
|
611
|
-
viewport:
|
|
612
|
-
bgMode:
|
|
613
|
-
onViewportChange:
|
|
614
|
-
onBgModeChange:
|
|
695
|
+
jogakName: e,
|
|
696
|
+
viewport: a,
|
|
697
|
+
bgMode: t,
|
|
698
|
+
onViewportChange: g,
|
|
699
|
+
onBgModeChange: s
|
|
615
700
|
}) {
|
|
616
|
-
const
|
|
701
|
+
const n = e ?? o.jogakNames[0] ?? "...", i = Z[a];
|
|
617
702
|
return /* @__PURE__ */ j(
|
|
618
703
|
"div",
|
|
619
704
|
{
|
|
620
705
|
"data-testid": "preview-loading",
|
|
621
706
|
className: "jogak:flex jogak:flex-col jogak:h-full",
|
|
622
707
|
children: [
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
|
|
708
|
+
/* @__PURE__ */ r(
|
|
709
|
+
K,
|
|
625
710
|
{
|
|
626
711
|
title: o.title,
|
|
627
|
-
jogakName:
|
|
628
|
-
viewport:
|
|
629
|
-
bgMode:
|
|
630
|
-
onViewportChange:
|
|
631
|
-
onBgModeChange:
|
|
712
|
+
jogakName: n,
|
|
713
|
+
viewport: a,
|
|
714
|
+
bgMode: t,
|
|
715
|
+
onViewportChange: g,
|
|
716
|
+
onBgModeChange: s,
|
|
632
717
|
showReset: !1,
|
|
633
718
|
onReset: () => {
|
|
634
719
|
}
|
|
635
720
|
}
|
|
636
721
|
),
|
|
637
|
-
/* @__PURE__ */
|
|
722
|
+
/* @__PURE__ */ r(
|
|
638
723
|
"div",
|
|
639
724
|
{
|
|
640
|
-
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${
|
|
641
|
-
style:
|
|
642
|
-
children: /* @__PURE__ */
|
|
725
|
+
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${z}`,
|
|
726
|
+
style: J[t],
|
|
727
|
+
children: /* @__PURE__ */ r(
|
|
643
728
|
"div",
|
|
644
729
|
{
|
|
645
730
|
className: "jogak:mx-auto jogak:p-6 jogak:max-w-[var(--jogak-canvas-mw)]",
|
|
@@ -659,63 +744,63 @@ function So({
|
|
|
659
744
|
}
|
|
660
745
|
);
|
|
661
746
|
}
|
|
662
|
-
function
|
|
747
|
+
function Oo({
|
|
663
748
|
entry: o,
|
|
664
|
-
jogakName:
|
|
665
|
-
overrideArgs:
|
|
666
|
-
onArgChange:
|
|
667
|
-
onReset:
|
|
668
|
-
onResolveJogak:
|
|
669
|
-
viewport:
|
|
749
|
+
jogakName: e,
|
|
750
|
+
overrideArgs: a,
|
|
751
|
+
onArgChange: t,
|
|
752
|
+
onReset: g,
|
|
753
|
+
onResolveJogak: s,
|
|
754
|
+
viewport: n,
|
|
670
755
|
bgMode: i,
|
|
671
|
-
bottomTab:
|
|
756
|
+
bottomTab: l,
|
|
672
757
|
onViewportChange: d,
|
|
673
|
-
onBgModeChange:
|
|
674
|
-
onBottomTabChange:
|
|
675
|
-
prismTheme:
|
|
676
|
-
previewIsolation:
|
|
677
|
-
userPreviewUrl:
|
|
758
|
+
onBgModeChange: c,
|
|
759
|
+
onBottomTabChange: k,
|
|
760
|
+
prismTheme: f,
|
|
761
|
+
previewIsolation: p,
|
|
762
|
+
userPreviewUrl: C,
|
|
678
763
|
previewEntryPath: y
|
|
679
764
|
}) {
|
|
680
|
-
var
|
|
681
|
-
const v =
|
|
765
|
+
var B;
|
|
766
|
+
const v = e ?? ((B = o.jogaks[0]) == null ? void 0 : B.name) ?? null;
|
|
682
767
|
if (x(() => {
|
|
683
|
-
|
|
684
|
-
}, [
|
|
768
|
+
e === null && v !== null && s !== void 0 && s(o.id, v);
|
|
769
|
+
}, [e, v, o.id, s]), v === null)
|
|
685
770
|
return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
|
|
686
771
|
"Entry has no jogaks: ",
|
|
687
772
|
o.id
|
|
688
773
|
] });
|
|
689
|
-
const
|
|
690
|
-
if (
|
|
774
|
+
const N = o.jogaks.find((S) => S.name === v);
|
|
775
|
+
if (N === void 0)
|
|
691
776
|
return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
|
|
692
777
|
"Jogak not found: ",
|
|
693
778
|
v
|
|
694
779
|
] });
|
|
695
|
-
const
|
|
780
|
+
const A = { ...N.args ?? {}, ...a }, u = {
|
|
696
781
|
...o.meta.argTypes ?? {},
|
|
697
|
-
...
|
|
698
|
-
}, m = Object.keys(
|
|
782
|
+
...N.argTypes ?? {}
|
|
783
|
+
}, m = Object.keys(a).length > 0, b = Z[n];
|
|
699
784
|
return /* @__PURE__ */ j("div", { className: "jogak:flex jogak:flex-col jogak:h-full", children: [
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
|
|
785
|
+
/* @__PURE__ */ r(
|
|
786
|
+
K,
|
|
702
787
|
{
|
|
703
788
|
title: o.title,
|
|
704
|
-
jogakName:
|
|
705
|
-
viewport:
|
|
789
|
+
jogakName: N.name,
|
|
790
|
+
viewport: n,
|
|
706
791
|
bgMode: i,
|
|
707
792
|
onViewportChange: d,
|
|
708
|
-
onBgModeChange:
|
|
793
|
+
onBgModeChange: c,
|
|
709
794
|
showReset: m,
|
|
710
|
-
onReset:
|
|
795
|
+
onReset: g
|
|
711
796
|
}
|
|
712
797
|
),
|
|
713
|
-
/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ r(
|
|
714
799
|
"div",
|
|
715
800
|
{
|
|
716
|
-
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${
|
|
717
|
-
style:
|
|
718
|
-
children: /* @__PURE__ */
|
|
801
|
+
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${z}`,
|
|
802
|
+
style: J[i],
|
|
803
|
+
children: /* @__PURE__ */ r(
|
|
719
804
|
"div",
|
|
720
805
|
{
|
|
721
806
|
"data-jogak-content": !0,
|
|
@@ -723,17 +808,17 @@ function Co({
|
|
|
723
808
|
style: {
|
|
724
809
|
"--jogak-canvas-mw": b === "none" ? "100%" : `${b}px`
|
|
725
810
|
},
|
|
726
|
-
children: /* @__PURE__ */
|
|
727
|
-
|
|
811
|
+
children: /* @__PURE__ */ r(
|
|
812
|
+
Po,
|
|
728
813
|
{
|
|
729
814
|
entry: o,
|
|
730
|
-
args:
|
|
731
|
-
theme:
|
|
732
|
-
previewIsolation:
|
|
733
|
-
userPreviewUrl:
|
|
815
|
+
args: A,
|
|
816
|
+
theme: f,
|
|
817
|
+
previewIsolation: p,
|
|
818
|
+
userPreviewUrl: C,
|
|
734
819
|
previewEntryPath: y
|
|
735
820
|
},
|
|
736
|
-
`${o.id}/${
|
|
821
|
+
`${o.id}/${N.name}`
|
|
737
822
|
)
|
|
738
823
|
}
|
|
739
824
|
)
|
|
@@ -745,97 +830,97 @@ function Co({
|
|
|
745
830
|
"data-testid": "bottom-panel",
|
|
746
831
|
className: "jogak:h-[260px] jogak:shrink-0 jogak:flex jogak:flex-col jogak:border-t-2 jogak:border-[var(--jogak-color-border)]",
|
|
747
832
|
children: [
|
|
748
|
-
/* @__PURE__ */
|
|
833
|
+
/* @__PURE__ */ r(
|
|
749
834
|
"div",
|
|
750
835
|
{
|
|
751
836
|
role: "tablist",
|
|
752
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",
|
|
753
|
-
children: ["controls", "actions"].map((
|
|
754
|
-
const
|
|
755
|
-
return /* @__PURE__ */
|
|
838
|
+
children: ["controls", "actions"].map((S) => {
|
|
839
|
+
const H = l === S;
|
|
840
|
+
return /* @__PURE__ */ r(
|
|
756
841
|
"button",
|
|
757
842
|
{
|
|
758
843
|
type: "button",
|
|
759
844
|
role: "tab",
|
|
760
|
-
"aria-selected":
|
|
845
|
+
"aria-selected": H,
|
|
761
846
|
onClick: () => {
|
|
762
|
-
|
|
847
|
+
k(S);
|
|
763
848
|
},
|
|
764
|
-
className:
|
|
849
|
+
className: w(
|
|
765
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",
|
|
766
|
-
|
|
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"
|
|
767
852
|
),
|
|
768
|
-
children:
|
|
853
|
+
children: S
|
|
769
854
|
},
|
|
770
|
-
|
|
855
|
+
S
|
|
771
856
|
);
|
|
772
857
|
})
|
|
773
858
|
}
|
|
774
859
|
),
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
|
|
860
|
+
/* @__PURE__ */ r("div", { className: "jogak:flex-1 jogak:min-h-0 jogak:overflow-auto", children: l === "controls" ? /* @__PURE__ */ r(
|
|
861
|
+
po,
|
|
777
862
|
{
|
|
778
|
-
args:
|
|
863
|
+
args: A,
|
|
779
864
|
argTypes: u,
|
|
780
|
-
onArgChange:
|
|
865
|
+
onArgChange: t
|
|
781
866
|
}
|
|
782
|
-
) : /* @__PURE__ */
|
|
867
|
+
) : /* @__PURE__ */ r(xo, {}) })
|
|
783
868
|
]
|
|
784
869
|
}
|
|
785
870
|
)
|
|
786
871
|
] });
|
|
787
872
|
}
|
|
788
|
-
function
|
|
873
|
+
function K({
|
|
789
874
|
title: o,
|
|
790
|
-
jogakName:
|
|
791
|
-
viewport:
|
|
792
|
-
bgMode:
|
|
793
|
-
onViewportChange:
|
|
794
|
-
onBgModeChange:
|
|
795
|
-
showReset:
|
|
875
|
+
jogakName: e,
|
|
876
|
+
viewport: a,
|
|
877
|
+
bgMode: t,
|
|
878
|
+
onViewportChange: g,
|
|
879
|
+
onBgModeChange: s,
|
|
880
|
+
showReset: n,
|
|
796
881
|
onReset: i
|
|
797
882
|
}) {
|
|
798
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: [
|
|
799
884
|
/* @__PURE__ */ j("div", { className: "jogak:flex-1 jogak:text-[13px]", children: [
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
/* @__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 })
|
|
803
888
|
] }),
|
|
804
|
-
/* @__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(
|
|
805
890
|
"button",
|
|
806
891
|
{
|
|
807
892
|
type: "button",
|
|
808
893
|
onClick: () => {
|
|
809
|
-
|
|
894
|
+
g(l);
|
|
810
895
|
},
|
|
811
|
-
"aria-pressed":
|
|
812
|
-
className:
|
|
896
|
+
"aria-pressed": a === l,
|
|
897
|
+
className: w(
|
|
813
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",
|
|
814
|
-
|
|
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"
|
|
815
900
|
),
|
|
816
|
-
children:
|
|
901
|
+
children: Ao[l]
|
|
817
902
|
},
|
|
818
|
-
|
|
903
|
+
l
|
|
819
904
|
)) }),
|
|
820
|
-
/* @__PURE__ */
|
|
905
|
+
/* @__PURE__ */ r("div", { className: "jogak:flex jogak:gap-1 jogak:items-center", children: ["white", "dark", "transparent"].map((l) => /* @__PURE__ */ r(
|
|
821
906
|
"button",
|
|
822
907
|
{
|
|
823
908
|
type: "button",
|
|
824
909
|
onClick: () => {
|
|
825
|
-
|
|
910
|
+
s(l);
|
|
826
911
|
},
|
|
827
|
-
"aria-pressed":
|
|
828
|
-
"aria-label": `${
|
|
829
|
-
className:
|
|
912
|
+
"aria-pressed": t === l,
|
|
913
|
+
"aria-label": `${l} background`,
|
|
914
|
+
className: w(
|
|
830
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",
|
|
831
|
-
|
|
832
|
-
|
|
916
|
+
z,
|
|
917
|
+
t === l ? "jogak:border-[var(--jogak-color-accent)]" : "jogak:border-[var(--jogak-color-border-strong)]"
|
|
833
918
|
),
|
|
834
|
-
style:
|
|
919
|
+
style: J[l]
|
|
835
920
|
},
|
|
836
|
-
|
|
921
|
+
l
|
|
837
922
|
)) }),
|
|
838
|
-
|
|
923
|
+
n && /* @__PURE__ */ r(
|
|
839
924
|
"button",
|
|
840
925
|
{
|
|
841
926
|
type: "button",
|
|
@@ -846,33 +931,33 @@ function Y({
|
|
|
846
931
|
)
|
|
847
932
|
] });
|
|
848
933
|
}
|
|
849
|
-
function
|
|
850
|
-
const [
|
|
851
|
-
/* @__PURE__ */
|
|
852
|
-
|
|
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,
|
|
853
938
|
{
|
|
854
939
|
entry: o,
|
|
855
|
-
args:
|
|
856
|
-
previewIsolation:
|
|
857
|
-
userPreviewUrl:
|
|
858
|
-
previewEntryPath:
|
|
940
|
+
args: e,
|
|
941
|
+
previewIsolation: t,
|
|
942
|
+
userPreviewUrl: g,
|
|
943
|
+
previewEntryPath: s
|
|
859
944
|
}
|
|
860
945
|
),
|
|
861
|
-
/* @__PURE__ */
|
|
946
|
+
/* @__PURE__ */ r(
|
|
862
947
|
"button",
|
|
863
948
|
{
|
|
864
949
|
type: "button",
|
|
865
950
|
onClick: () => {
|
|
866
|
-
i((
|
|
951
|
+
i((c) => !c);
|
|
867
952
|
},
|
|
868
|
-
"aria-pressed":
|
|
869
|
-
"aria-label":
|
|
870
|
-
className:
|
|
953
|
+
"aria-pressed": n,
|
|
954
|
+
"aria-label": n ? "Hide source code" : "Show source code",
|
|
955
|
+
className: w(
|
|
871
956
|
"jogak:absolute jogak:bottom-2 jogak:right-2 jogak:px-[9px] jogak:py-1",
|
|
872
957
|
"jogak:text-[11px] jogak:font-[family-name:var(--jogak-font-mono)] jogak:font-semibold jogak:tracking-[0.02em]",
|
|
873
958
|
"jogak:text-[var(--jogak-color-bg)] jogak:border-none jogak:rounded-[5px] jogak:cursor-pointer",
|
|
874
959
|
"jogak:shadow-[0_1px_4px_rgba(0,0,0,0.2)] jogak:transition-[background-color] jogak:duration-150 jogak:leading-none",
|
|
875
|
-
|
|
960
|
+
n ? "jogak:bg-[var(--jogak-color-accent)]" : "jogak:bg-[#1e293b]"
|
|
876
961
|
),
|
|
877
962
|
children: "</>"
|
|
878
963
|
}
|
|
@@ -880,217 +965,253 @@ function $o({ entry: o, args: a, theme: e, previewIsolation: r, userPreviewUrl:
|
|
|
880
965
|
] });
|
|
881
966
|
return /* @__PURE__ */ j("div", { children: [
|
|
882
967
|
d,
|
|
883
|
-
|
|
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 }) })
|
|
884
969
|
] });
|
|
885
970
|
}
|
|
886
|
-
const
|
|
887
|
-
function
|
|
888
|
-
return
|
|
889
|
-
|
|
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";
|
|
972
|
+
function Mo({ entry: o, args: e, previewIsolation: a, userPreviewUrl: t, previewEntryPath: g }) {
|
|
973
|
+
return a === "shadow" ? /* @__PURE__ */ r(
|
|
974
|
+
vo,
|
|
890
975
|
{
|
|
891
976
|
"data-testid": "preview-content",
|
|
892
|
-
className:
|
|
893
|
-
children: /* @__PURE__ */
|
|
977
|
+
className: V,
|
|
978
|
+
children: /* @__PURE__ */ r(Vo, { entry: o, args: e })
|
|
894
979
|
}
|
|
895
|
-
) :
|
|
896
|
-
|
|
980
|
+
) : a === "iframe" ? /* @__PURE__ */ r(
|
|
981
|
+
wo,
|
|
897
982
|
{
|
|
898
983
|
entry: o,
|
|
899
|
-
args:
|
|
900
|
-
userPreviewUrl:
|
|
901
|
-
previewEntryPath:
|
|
984
|
+
args: e,
|
|
985
|
+
userPreviewUrl: t,
|
|
986
|
+
previewEntryPath: g,
|
|
902
987
|
"data-testid": "preview-content",
|
|
903
|
-
className: `${
|
|
988
|
+
className: `${V} jogak:block jogak:w-full jogak:bg-transparent jogak:min-h-[256px]`
|
|
904
989
|
}
|
|
905
|
-
) : /* @__PURE__ */
|
|
990
|
+
) : /* @__PURE__ */ r(Wo, { entry: o, args: e });
|
|
906
991
|
}
|
|
907
|
-
function
|
|
908
|
-
const
|
|
992
|
+
function Wo({ entry: o, args: e }) {
|
|
993
|
+
const a = $(null), t = $(null);
|
|
909
994
|
return x(() => {
|
|
910
|
-
const
|
|
911
|
-
if (
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
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
|
+
};
|
|
917
1008
|
}, [o]), x(() => {
|
|
918
|
-
const
|
|
919
|
-
|
|
920
|
-
|
|
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(
|
|
921
1024
|
"div",
|
|
922
1025
|
{
|
|
923
|
-
ref:
|
|
1026
|
+
ref: a,
|
|
924
1027
|
"data-testid": "preview-content",
|
|
925
|
-
className:
|
|
1028
|
+
className: V
|
|
926
1029
|
}
|
|
927
1030
|
);
|
|
928
1031
|
}
|
|
929
|
-
function
|
|
930
|
-
const
|
|
1032
|
+
function Vo({ entry: o, args: e }) {
|
|
1033
|
+
const a = $(null), t = $(null);
|
|
931
1034
|
return x(() => {
|
|
932
|
-
const
|
|
933
|
-
if (
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
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
|
+
};
|
|
939
1048
|
}, [o]), x(() => {
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
|
|
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" });
|
|
943
1064
|
}
|
|
944
|
-
function
|
|
945
|
-
const [
|
|
946
|
-
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(
|
|
947
1068
|
"div",
|
|
948
1069
|
{
|
|
949
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]",
|
|
950
|
-
style: { "--jogak-source-bg":
|
|
1071
|
+
style: { "--jogak-source-bg": g },
|
|
951
1072
|
children: "Source not available"
|
|
952
1073
|
}
|
|
953
1074
|
) : /* @__PURE__ */ j("div", { className: "jogak:relative jogak:h-full", children: [
|
|
954
|
-
/* @__PURE__ */
|
|
1075
|
+
/* @__PURE__ */ r(
|
|
955
1076
|
"button",
|
|
956
1077
|
{
|
|
957
1078
|
type: "button",
|
|
958
1079
|
onClick: () => {
|
|
959
1080
|
navigator.clipboard.writeText(o).then(() => {
|
|
960
|
-
|
|
961
|
-
|
|
1081
|
+
t(!0), setTimeout(() => {
|
|
1082
|
+
t(!1);
|
|
962
1083
|
}, 2e3);
|
|
963
1084
|
});
|
|
964
1085
|
},
|
|
965
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",
|
|
966
|
-
children:
|
|
1087
|
+
children: a ? "✓ Copied" : "Copy"
|
|
967
1088
|
}
|
|
968
1089
|
),
|
|
969
|
-
/* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ r(ro, { code: o.trim(), language: "tsx", theme: e, children: ({ style: n, tokens: i, getLineProps: l, getTokenProps: d }) => /* @__PURE__ */ r(
|
|
970
1091
|
"pre",
|
|
971
1092
|
{
|
|
972
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",
|
|
973
|
-
style:
|
|
974
|
-
children: i.map((
|
|
1094
|
+
style: n,
|
|
1095
|
+
children: i.map((c, k) => /* @__PURE__ */ j(
|
|
975
1096
|
"div",
|
|
976
1097
|
{
|
|
977
|
-
...
|
|
1098
|
+
...l({ line: c }),
|
|
978
1099
|
className: "jogak:flex jogak:pr-6",
|
|
979
|
-
style:
|
|
1100
|
+
style: l({ line: c }).style,
|
|
980
1101
|
children: [
|
|
981
|
-
/* @__PURE__ */
|
|
982
|
-
/* @__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)) })
|
|
983
1104
|
]
|
|
984
1105
|
},
|
|
985
|
-
|
|
1106
|
+
k
|
|
986
1107
|
))
|
|
987
1108
|
}
|
|
988
1109
|
) })
|
|
989
1110
|
] });
|
|
990
1111
|
}
|
|
991
|
-
function
|
|
1112
|
+
function G() {
|
|
992
1113
|
if (typeof window > "u") return null;
|
|
993
|
-
const o = new URLSearchParams(window.location.search),
|
|
994
|
-
if (
|
|
995
|
-
const
|
|
996
|
-
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 };
|
|
997
1118
|
}
|
|
998
|
-
function
|
|
999
|
-
const
|
|
1000
|
-
|
|
1119
|
+
function zo(o, e) {
|
|
1120
|
+
const a = new URLSearchParams();
|
|
1121
|
+
a.set("entry", o), a.set("jogak", e), window.history.pushState({}, "", `?${a.toString()}`);
|
|
1001
1122
|
}
|
|
1002
|
-
function
|
|
1123
|
+
function Go({
|
|
1003
1124
|
entries: o,
|
|
1004
|
-
metas:
|
|
1005
|
-
codeTheme:
|
|
1006
|
-
previewIsolation:
|
|
1007
|
-
userPreviewUrl:
|
|
1008
|
-
previewEntryPath:
|
|
1009
|
-
userViteUrl:
|
|
1125
|
+
metas: e,
|
|
1126
|
+
codeTheme: a = "vsDark",
|
|
1127
|
+
previewIsolation: t = "iframe",
|
|
1128
|
+
userPreviewUrl: g = "",
|
|
1129
|
+
previewEntryPath: s = "/__jogak_preview__/index.html",
|
|
1130
|
+
userViteUrl: n
|
|
1010
1131
|
} = {}) {
|
|
1011
|
-
const i =
|
|
1132
|
+
const i = g !== "" ? g : n ?? "", l = _(() => {
|
|
1012
1133
|
if (o !== void 0) {
|
|
1013
|
-
|
|
1134
|
+
e !== void 0 && console.warn(
|
|
1014
1135
|
"[jogak] JogakApp received both `entries` and `metas` — `entries` (eager) takes precedence."
|
|
1015
1136
|
);
|
|
1016
|
-
const u = new
|
|
1137
|
+
const u = new T();
|
|
1017
1138
|
for (const m of o) u.register(m);
|
|
1018
1139
|
return u;
|
|
1019
1140
|
}
|
|
1020
|
-
if (
|
|
1021
|
-
for (const u of
|
|
1022
|
-
return
|
|
1023
|
-
}, [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(
|
|
1024
1145
|
(d == null ? void 0 : d.entryId) ?? null
|
|
1025
|
-
), [
|
|
1146
|
+
), [f, p] = h(
|
|
1026
1147
|
(d == null ? void 0 : d.jogakName) ?? null
|
|
1027
|
-
), [
|
|
1148
|
+
), [C, y] = h({});
|
|
1028
1149
|
x(() => {
|
|
1029
1150
|
const u = () => {
|
|
1030
|
-
const m =
|
|
1031
|
-
m !== null ? (
|
|
1151
|
+
const m = G();
|
|
1152
|
+
m !== null ? (k(m.entryId), p(m.jogakName), y({})) : (k(null), p(null));
|
|
1032
1153
|
};
|
|
1033
1154
|
return window.addEventListener("popstate", u), () => {
|
|
1034
1155
|
window.removeEventListener("popstate", u);
|
|
1035
1156
|
};
|
|
1036
1157
|
}, []);
|
|
1037
|
-
const v =
|
|
1038
|
-
|
|
1039
|
-
}, []),
|
|
1040
|
-
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") {
|
|
1041
1162
|
const b = new URLSearchParams(window.location.search);
|
|
1042
1163
|
b.get("entry") === u && b.get("jogak") === null && (b.set("jogak", m), window.history.replaceState({}, "", `?${b.toString()}`));
|
|
1043
1164
|
}
|
|
1044
|
-
}, []),
|
|
1165
|
+
}, []), D = R((u, m) => {
|
|
1045
1166
|
y((b) => ({ ...b, [u]: m }));
|
|
1046
|
-
}, []),
|
|
1167
|
+
}, []), A = R(() => {
|
|
1047
1168
|
y({});
|
|
1048
1169
|
}, []);
|
|
1049
|
-
return /* @__PURE__ */
|
|
1170
|
+
return /* @__PURE__ */ r(ao, { registry: l, children: /* @__PURE__ */ j(
|
|
1050
1171
|
"div",
|
|
1051
1172
|
{
|
|
1052
1173
|
"data-jogak-shell": !0,
|
|
1053
1174
|
className: "jogak:grid jogak:grid-cols-[260px_1fr] jogak:h-dvh jogak:overflow-hidden",
|
|
1054
1175
|
children: [
|
|
1055
|
-
/* @__PURE__ */
|
|
1056
|
-
|
|
1176
|
+
/* @__PURE__ */ r(
|
|
1177
|
+
go,
|
|
1057
1178
|
{
|
|
1058
|
-
selectedEntryId:
|
|
1059
|
-
selectedJogakName:
|
|
1179
|
+
selectedEntryId: c,
|
|
1180
|
+
selectedJogakName: f,
|
|
1060
1181
|
onSelect: v
|
|
1061
1182
|
}
|
|
1062
1183
|
),
|
|
1063
|
-
/* @__PURE__ */
|
|
1064
|
-
|
|
1184
|
+
/* @__PURE__ */ r("main", { className: "jogak:overflow-hidden jogak:min-h-0", children: c !== null ? /* @__PURE__ */ r(
|
|
1185
|
+
Eo,
|
|
1065
1186
|
{
|
|
1066
|
-
entryId:
|
|
1067
|
-
jogakName:
|
|
1068
|
-
overrideArgs:
|
|
1069
|
-
onArgChange:
|
|
1070
|
-
onReset:
|
|
1071
|
-
codeTheme:
|
|
1072
|
-
onResolveJogak:
|
|
1073
|
-
previewIsolation:
|
|
1187
|
+
entryId: c,
|
|
1188
|
+
jogakName: f,
|
|
1189
|
+
overrideArgs: C,
|
|
1190
|
+
onArgChange: D,
|
|
1191
|
+
onReset: A,
|
|
1192
|
+
codeTheme: a,
|
|
1193
|
+
onResolveJogak: N,
|
|
1194
|
+
previewIsolation: t,
|
|
1074
1195
|
userPreviewUrl: i,
|
|
1075
|
-
previewEntryPath:
|
|
1196
|
+
previewEntryPath: s
|
|
1076
1197
|
}
|
|
1077
|
-
) : /* @__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" }) })
|
|
1078
1199
|
]
|
|
1079
1200
|
}
|
|
1080
1201
|
) });
|
|
1081
1202
|
}
|
|
1082
|
-
function
|
|
1083
|
-
const o =
|
|
1084
|
-
() => (
|
|
1203
|
+
function Io() {
|
|
1204
|
+
const o = to(), e = _(() => o.getAll(), [o]), a = _(() => o.getTree(), [o]), t = _(
|
|
1205
|
+
() => (g) => o.search(g),
|
|
1085
1206
|
[o]
|
|
1086
1207
|
);
|
|
1087
|
-
return { entries:
|
|
1208
|
+
return { entries: e, tree: a, search: t };
|
|
1088
1209
|
}
|
|
1089
1210
|
export {
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1211
|
+
xo as Actions,
|
|
1212
|
+
po as Controls,
|
|
1213
|
+
Go as JogakApp,
|
|
1214
|
+
Eo as Preview,
|
|
1215
|
+
go as Sidebar,
|
|
1216
|
+
Io as useRegistry
|
|
1096
1217
|
};
|