@jogak/ui 0.1.0-alpha.9.2 → 1.0.0-beta.0
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 +128 -0
- package/dist/components/Preview/format-usage.d.ts +6 -0
- package/dist/components/Preview/index.d.ts +1 -1
- package/dist/host/index.cjs +1 -1
- package/dist/host/index.d.ts +1 -1
- package/dist/host/index.mjs +12 -12
- package/dist/index.cjs +9 -1
- package/dist/index.mjs +637 -462
- package/dist/lib/adapter-for.d.ts +17 -0
- package/package.json +10 -7
- package/src/app/App.tsx +1 -1
- package/src/app/preview-frame.tsx +21 -4
- package/src/components/Controls/index.tsx +36 -0
- package/src/components/Preview/format-usage.test.ts +115 -0
- package/src/components/Preview/format-usage.ts +132 -0
- package/src/components/Preview/index.tsx +72 -15
- package/src/components/Sidebar/index.tsx +1 -1
- package/src/hooks/useRegistry.ts +1 -1
- package/src/lib/adapter-for.ts +173 -0
package/dist/index.mjs
CHANGED
|
@@ -1,379 +1,464 @@
|
|
|
1
|
-
import { jsxs as j, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { defaultActionChannel as
|
|
4
|
-
import { useRegistryMeta as
|
|
5
|
-
import { themes as
|
|
6
|
-
import { createPortal as
|
|
7
|
-
function
|
|
8
|
-
var
|
|
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
9
|
if (typeof o == "string" || typeof o == "number") t += o;
|
|
10
10
|
else if (typeof o == "object") if (Array.isArray(o)) {
|
|
11
11
|
var g = o.length;
|
|
12
|
-
for (
|
|
13
|
-
} else for (
|
|
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
14
|
return t;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
for (var o,
|
|
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
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 [t, g] =
|
|
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
37
|
value: t,
|
|
38
|
-
onChange: (
|
|
39
|
-
g(
|
|
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
|
-
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:
|
|
68
|
+
selectedEntryId: e,
|
|
69
|
+
selectedJogakName: a,
|
|
70
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
75
|
meta: g,
|
|
76
|
-
selectedEntryId:
|
|
77
|
-
selectedJogakName:
|
|
76
|
+
selectedEntryId: e,
|
|
77
|
+
selectedJogakName: a,
|
|
78
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:
|
|
85
|
+
selectedEntryId: e,
|
|
86
|
+
selectedJogakName: a,
|
|
87
87
|
onSelect: t,
|
|
88
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
94
|
style: { "--jogak-tree-pl": `${g * 12}px` },
|
|
95
|
-
children: Object.entries(o).map(([
|
|
96
|
-
|
|
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:
|
|
98
|
+
meta: n,
|
|
99
|
+
selectedEntryId: e,
|
|
100
|
+
selectedJogakName: a,
|
|
101
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:
|
|
107
|
+
label: s,
|
|
108
|
+
node: n,
|
|
109
|
+
selectedEntryId: e,
|
|
110
|
+
selectedJogakName: a,
|
|
111
111
|
onSelect: t,
|
|
112
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:
|
|
120
|
+
node: e,
|
|
121
|
+
selectedEntryId: a,
|
|
122
122
|
selectedJogakName: t,
|
|
123
123
|
onSelect: g,
|
|
124
|
-
depth:
|
|
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
|
-
|
|
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:
|
|
146
|
+
node: e,
|
|
147
|
+
selectedEntryId: a,
|
|
148
148
|
selectedJogakName: t,
|
|
149
149
|
onSelect: g,
|
|
150
|
-
depth:
|
|
150
|
+
depth: s
|
|
151
151
|
}
|
|
152
152
|
)
|
|
153
153
|
] });
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function X({
|
|
156
156
|
meta: o,
|
|
157
|
-
selectedEntryId:
|
|
158
|
-
selectedJogakName:
|
|
157
|
+
selectedEntryId: e,
|
|
158
|
+
selectedJogakName: a,
|
|
159
159
|
onSelect: t,
|
|
160
160
|
indent: g
|
|
161
161
|
}) {
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}, [
|
|
166
|
-
const
|
|
162
|
+
const s = o.id === e, [n, i] = h(s);
|
|
163
|
+
x(() => {
|
|
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
|
-
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
|
-
t(o.id,
|
|
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
|
+
}
|
|
221
251
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
t(o,
|
|
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
|
-
t(o,
|
|
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
|
-
t(o,
|
|
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
|
-
t(o,
|
|
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 g = Array.from(/* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(
|
|
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
|
-
g.length === 0 ? /* @__PURE__ */
|
|
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 l =
|
|
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:
|
|
373
|
+
value: i,
|
|
309
374
|
argType: l,
|
|
310
|
-
onArgChange:
|
|
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 t = ((
|
|
329
|
-
return t !== "Object" && t !== "Array" ? `[${t}]` : JSON.stringify(
|
|
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
|
-
|
|
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
|
]
|
|
@@ -382,84 +467,139 @@ function jo() {
|
|
|
382
467
|
)) }) })
|
|
383
468
|
] });
|
|
384
469
|
}
|
|
385
|
-
function
|
|
470
|
+
function vo({
|
|
386
471
|
children: o,
|
|
387
|
-
className:
|
|
388
|
-
style:
|
|
472
|
+
className: e,
|
|
473
|
+
style: a,
|
|
389
474
|
"data-testid": t
|
|
390
475
|
}) {
|
|
391
|
-
const g =
|
|
392
|
-
return
|
|
393
|
-
const
|
|
394
|
-
if (
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
}, []), /* @__PURE__ */
|
|
476
|
+
const g = $(null), [s, n] = h(null);
|
|
477
|
+
return x(() => {
|
|
478
|
+
const i = g.current;
|
|
479
|
+
if (i === null) return;
|
|
480
|
+
const l = i.shadowRoot ?? i.attachShadow({ mode: "open" });
|
|
481
|
+
n(l);
|
|
482
|
+
}, []), /* @__PURE__ */ r(
|
|
398
483
|
"div",
|
|
399
484
|
{
|
|
400
485
|
ref: g,
|
|
401
|
-
className:
|
|
486
|
+
className: e,
|
|
402
487
|
"data-testid": t,
|
|
403
|
-
style:
|
|
404
|
-
children:
|
|
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:
|
|
495
|
+
args: e,
|
|
496
|
+
userPreviewUrl: a,
|
|
412
497
|
previewEntryPath: t,
|
|
413
498
|
className: g,
|
|
414
|
-
"data-testid":
|
|
499
|
+
"data-testid": s
|
|
415
500
|
}) {
|
|
416
|
-
const
|
|
417
|
-
return
|
|
418
|
-
const
|
|
419
|
-
const
|
|
420
|
-
if (
|
|
421
|
-
const p =
|
|
422
|
-
p == null || typeof p != "object" || p.type === "jogak:ready" &&
|
|
501
|
+
const n = $(null), [i, l] = h(!1), d = a !== "" ? `${a}${t}` : "/preview-frame.html";
|
|
502
|
+
return x(() => {
|
|
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
|
-
}, []),
|
|
428
|
-
var
|
|
429
|
-
if (!
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
{ type: "jogak:setProps", entryId: o.id, args:
|
|
512
|
+
}, []), x(() => {
|
|
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 },
|
|
433
518
|
"*"
|
|
434
519
|
));
|
|
435
|
-
}, [
|
|
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
534
|
className: g,
|
|
450
|
-
"data-testid":
|
|
535
|
+
"data-testid": s
|
|
451
536
|
}
|
|
452
537
|
);
|
|
453
538
|
}
|
|
454
|
-
const
|
|
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(`
|
|
543
|
+
`))
|
|
544
|
+
return d;
|
|
545
|
+
const c = s.length === 0 ? "" : `
|
|
546
|
+
` + s.join(`
|
|
547
|
+
`) + `
|
|
548
|
+
`;
|
|
549
|
+
if (i) {
|
|
550
|
+
const k = (n ?? "").split(`
|
|
551
|
+
`).map((f) => ` ${f}`).join(`
|
|
552
|
+
`);
|
|
553
|
+
return `<${a}${c}>
|
|
554
|
+
${k}
|
|
555
|
+
</${a}>`;
|
|
556
|
+
}
|
|
557
|
+
return `<${a}${c}/>`;
|
|
558
|
+
}
|
|
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;
|
|
566
|
+
}
|
|
567
|
+
const a = o.title.split("/").pop();
|
|
568
|
+
return a !== void 0 && a.length > 0 ? a : "Component";
|
|
569
|
+
}
|
|
570
|
+
function So(o) {
|
|
571
|
+
const { children: e, ...a } = o;
|
|
572
|
+
return { children: e, restProps: a };
|
|
573
|
+
}
|
|
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)}}`;
|
|
576
|
+
}
|
|
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}"`;
|
|
584
|
+
}
|
|
585
|
+
return typeof e == "number" || typeof e == "bigint" ? `${o}={${e.toString()}}` : typeof e == "function" ? `${o}={fn}` : `${o}={${Y(e)}}`;
|
|
586
|
+
}
|
|
587
|
+
function Y(o) {
|
|
588
|
+
try {
|
|
589
|
+
return JSON.stringify(o);
|
|
590
|
+
} catch {
|
|
591
|
+
return String(o);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
const Z = {
|
|
455
595
|
mobile: 375,
|
|
456
596
|
tablet: 768,
|
|
457
597
|
desktop: "none"
|
|
458
|
-
},
|
|
598
|
+
}, Ao = {
|
|
459
599
|
mobile: "Mobile",
|
|
460
600
|
tablet: "Tablet",
|
|
461
601
|
desktop: "Desktop"
|
|
462
|
-
},
|
|
602
|
+
}, J = {
|
|
463
603
|
white: {
|
|
464
604
|
"--jogak-canvas-bg": "#ffffff",
|
|
465
605
|
"--jogak-canvas-bg-image": "none",
|
|
@@ -478,24 +618,24 @@ const Q = {
|
|
|
478
618
|
"--jogak-canvas-bg-size": "16px 16px",
|
|
479
619
|
"--jogak-canvas-bg-position": "0 0, 0 8px, 8px -8px, -8px 0px"
|
|
480
620
|
}
|
|
481
|
-
},
|
|
482
|
-
function
|
|
483
|
-
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;
|
|
484
624
|
}
|
|
485
|
-
function
|
|
625
|
+
function Eo({
|
|
486
626
|
entryId: o,
|
|
487
|
-
jogakName:
|
|
488
|
-
overrideArgs:
|
|
627
|
+
jogakName: e,
|
|
628
|
+
overrideArgs: a,
|
|
489
629
|
onArgChange: t,
|
|
490
630
|
onReset: g,
|
|
491
|
-
codeTheme:
|
|
492
|
-
onResolveJogak:
|
|
493
|
-
previewIsolation:
|
|
494
|
-
userPreviewUrl:
|
|
631
|
+
codeTheme: s,
|
|
632
|
+
onResolveJogak: n,
|
|
633
|
+
previewIsolation: i = "iframe",
|
|
634
|
+
userPreviewUrl: l = "",
|
|
495
635
|
previewEntryPath: d = "/__jogak_preview__/index.html"
|
|
496
636
|
}) {
|
|
497
|
-
const
|
|
498
|
-
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(
|
|
499
639
|
"div",
|
|
500
640
|
{
|
|
501
641
|
"data-testid": "preview-not-found",
|
|
@@ -505,7 +645,7 @@ function mo({
|
|
|
505
645
|
o
|
|
506
646
|
]
|
|
507
647
|
}
|
|
508
|
-
) :
|
|
648
|
+
) : c.status === "error" ? /* @__PURE__ */ j(
|
|
509
649
|
"div",
|
|
510
650
|
{
|
|
511
651
|
"data-testid": "preview-error",
|
|
@@ -515,81 +655,81 @@ function mo({
|
|
|
515
655
|
"Failed to load entry: ",
|
|
516
656
|
o
|
|
517
657
|
] }),
|
|
518
|
-
/* @__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 })
|
|
519
659
|
]
|
|
520
660
|
}
|
|
521
|
-
) :
|
|
522
|
-
|
|
661
|
+
) : c.status === "loading" ? /* @__PURE__ */ r(
|
|
662
|
+
Lo,
|
|
523
663
|
{
|
|
524
|
-
meta:
|
|
525
|
-
jogakName:
|
|
526
|
-
viewport:
|
|
664
|
+
meta: c.meta,
|
|
665
|
+
jogakName: e,
|
|
666
|
+
viewport: k,
|
|
527
667
|
bgMode: p,
|
|
528
|
-
onViewportChange:
|
|
529
|
-
onBgModeChange:
|
|
668
|
+
onViewportChange: f,
|
|
669
|
+
onBgModeChange: C
|
|
530
670
|
}
|
|
531
|
-
) : /* @__PURE__ */
|
|
532
|
-
|
|
671
|
+
) : /* @__PURE__ */ r(
|
|
672
|
+
Oo,
|
|
533
673
|
{
|
|
534
|
-
entry:
|
|
535
|
-
jogakName:
|
|
536
|
-
overrideArgs:
|
|
674
|
+
entry: c.entry,
|
|
675
|
+
jogakName: e,
|
|
676
|
+
overrideArgs: a,
|
|
537
677
|
onArgChange: t,
|
|
538
678
|
onReset: g,
|
|
539
|
-
onResolveJogak:
|
|
540
|
-
viewport:
|
|
679
|
+
onResolveJogak: n,
|
|
680
|
+
viewport: k,
|
|
541
681
|
bgMode: p,
|
|
542
682
|
bottomTab: y,
|
|
543
|
-
onViewportChange:
|
|
544
|
-
onBgModeChange:
|
|
683
|
+
onViewportChange: f,
|
|
684
|
+
onBgModeChange: C,
|
|
545
685
|
onBottomTabChange: v,
|
|
546
|
-
prismTheme:
|
|
547
|
-
previewIsolation:
|
|
548
|
-
userPreviewUrl:
|
|
686
|
+
prismTheme: N,
|
|
687
|
+
previewIsolation: i,
|
|
688
|
+
userPreviewUrl: l,
|
|
549
689
|
previewEntryPath: d
|
|
550
690
|
}
|
|
551
691
|
);
|
|
552
692
|
}
|
|
553
|
-
function
|
|
693
|
+
function Lo({
|
|
554
694
|
meta: o,
|
|
555
|
-
jogakName:
|
|
556
|
-
viewport:
|
|
695
|
+
jogakName: e,
|
|
696
|
+
viewport: a,
|
|
557
697
|
bgMode: t,
|
|
558
698
|
onViewportChange: g,
|
|
559
|
-
onBgModeChange:
|
|
699
|
+
onBgModeChange: s
|
|
560
700
|
}) {
|
|
561
|
-
const
|
|
701
|
+
const n = e ?? o.jogakNames[0] ?? "...", i = Z[a];
|
|
562
702
|
return /* @__PURE__ */ j(
|
|
563
703
|
"div",
|
|
564
704
|
{
|
|
565
705
|
"data-testid": "preview-loading",
|
|
566
706
|
className: "jogak:flex jogak:flex-col jogak:h-full",
|
|
567
707
|
children: [
|
|
568
|
-
/* @__PURE__ */
|
|
569
|
-
|
|
708
|
+
/* @__PURE__ */ r(
|
|
709
|
+
K,
|
|
570
710
|
{
|
|
571
711
|
title: o.title,
|
|
572
|
-
jogakName:
|
|
573
|
-
viewport:
|
|
712
|
+
jogakName: n,
|
|
713
|
+
viewport: a,
|
|
574
714
|
bgMode: t,
|
|
575
715
|
onViewportChange: g,
|
|
576
|
-
onBgModeChange:
|
|
716
|
+
onBgModeChange: s,
|
|
577
717
|
showReset: !1,
|
|
578
718
|
onReset: () => {
|
|
579
719
|
}
|
|
580
720
|
}
|
|
581
721
|
),
|
|
582
|
-
/* @__PURE__ */
|
|
722
|
+
/* @__PURE__ */ r(
|
|
583
723
|
"div",
|
|
584
724
|
{
|
|
585
|
-
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${
|
|
586
|
-
style:
|
|
587
|
-
children: /* @__PURE__ */
|
|
725
|
+
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${z}`,
|
|
726
|
+
style: J[t],
|
|
727
|
+
children: /* @__PURE__ */ r(
|
|
588
728
|
"div",
|
|
589
729
|
{
|
|
590
730
|
className: "jogak:mx-auto jogak:p-6 jogak:max-w-[var(--jogak-canvas-mw)]",
|
|
591
731
|
style: {
|
|
592
|
-
"--jogak-canvas-mw":
|
|
732
|
+
"--jogak-canvas-mw": i === "none" ? "100%" : `${i}px`
|
|
593
733
|
},
|
|
594
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: [
|
|
595
735
|
"Loading ",
|
|
@@ -604,82 +744,81 @@ function bo({
|
|
|
604
744
|
}
|
|
605
745
|
);
|
|
606
746
|
}
|
|
607
|
-
function
|
|
747
|
+
function Oo({
|
|
608
748
|
entry: o,
|
|
609
|
-
jogakName:
|
|
610
|
-
overrideArgs:
|
|
749
|
+
jogakName: e,
|
|
750
|
+
overrideArgs: a,
|
|
611
751
|
onArgChange: t,
|
|
612
752
|
onReset: g,
|
|
613
|
-
onResolveJogak:
|
|
614
|
-
viewport:
|
|
615
|
-
bgMode:
|
|
616
|
-
bottomTab:
|
|
753
|
+
onResolveJogak: s,
|
|
754
|
+
viewport: n,
|
|
755
|
+
bgMode: i,
|
|
756
|
+
bottomTab: l,
|
|
617
757
|
onViewportChange: d,
|
|
618
|
-
onBgModeChange:
|
|
619
|
-
onBottomTabChange:
|
|
620
|
-
prismTheme:
|
|
758
|
+
onBgModeChange: c,
|
|
759
|
+
onBottomTabChange: k,
|
|
760
|
+
prismTheme: f,
|
|
621
761
|
previewIsolation: p,
|
|
622
|
-
userPreviewUrl:
|
|
762
|
+
userPreviewUrl: C,
|
|
623
763
|
previewEntryPath: y
|
|
624
764
|
}) {
|
|
625
|
-
var
|
|
626
|
-
const v =
|
|
627
|
-
if (
|
|
628
|
-
|
|
629
|
-
}, [
|
|
765
|
+
var B;
|
|
766
|
+
const v = e ?? ((B = o.jogaks[0]) == null ? void 0 : B.name) ?? null;
|
|
767
|
+
if (x(() => {
|
|
768
|
+
e === null && v !== null && s !== void 0 && s(o.id, v);
|
|
769
|
+
}, [e, v, o.id, s]), v === null)
|
|
630
770
|
return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
|
|
631
771
|
"Entry has no jogaks: ",
|
|
632
772
|
o.id
|
|
633
773
|
] });
|
|
634
|
-
const
|
|
635
|
-
if (
|
|
774
|
+
const N = o.jogaks.find((S) => S.name === v);
|
|
775
|
+
if (N === void 0)
|
|
636
776
|
return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
|
|
637
777
|
"Jogak not found: ",
|
|
638
778
|
v
|
|
639
779
|
] });
|
|
640
|
-
const A = { ...
|
|
780
|
+
const A = { ...N.args ?? {}, ...a }, u = {
|
|
641
781
|
...o.meta.argTypes ?? {},
|
|
642
|
-
...
|
|
643
|
-
},
|
|
782
|
+
...N.argTypes ?? {}
|
|
783
|
+
}, m = Object.keys(a).length > 0, b = Z[n];
|
|
644
784
|
return /* @__PURE__ */ j("div", { className: "jogak:flex jogak:flex-col jogak:h-full", children: [
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
|
|
785
|
+
/* @__PURE__ */ r(
|
|
786
|
+
K,
|
|
647
787
|
{
|
|
648
788
|
title: o.title,
|
|
649
|
-
jogakName:
|
|
650
|
-
viewport:
|
|
651
|
-
bgMode:
|
|
789
|
+
jogakName: N.name,
|
|
790
|
+
viewport: n,
|
|
791
|
+
bgMode: i,
|
|
652
792
|
onViewportChange: d,
|
|
653
|
-
onBgModeChange:
|
|
654
|
-
showReset:
|
|
793
|
+
onBgModeChange: c,
|
|
794
|
+
showReset: m,
|
|
655
795
|
onReset: g
|
|
656
796
|
}
|
|
657
797
|
),
|
|
658
|
-
/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ r(
|
|
659
799
|
"div",
|
|
660
800
|
{
|
|
661
|
-
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${
|
|
662
|
-
style:
|
|
663
|
-
children: /* @__PURE__ */
|
|
801
|
+
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${z}`,
|
|
802
|
+
style: J[i],
|
|
803
|
+
children: /* @__PURE__ */ r(
|
|
664
804
|
"div",
|
|
665
805
|
{
|
|
666
806
|
"data-jogak-content": !0,
|
|
667
807
|
className: "jogak:mx-auto jogak:p-6 jogak:max-w-[var(--jogak-canvas-mw)]",
|
|
668
808
|
style: {
|
|
669
|
-
"--jogak-canvas-mw":
|
|
809
|
+
"--jogak-canvas-mw": b === "none" ? "100%" : `${b}px`
|
|
670
810
|
},
|
|
671
|
-
children: /* @__PURE__ */
|
|
672
|
-
|
|
811
|
+
children: /* @__PURE__ */ r(
|
|
812
|
+
Po,
|
|
673
813
|
{
|
|
674
814
|
entry: o,
|
|
675
815
|
args: A,
|
|
676
|
-
|
|
677
|
-
theme: x,
|
|
816
|
+
theme: f,
|
|
678
817
|
previewIsolation: p,
|
|
679
|
-
userPreviewUrl:
|
|
818
|
+
userPreviewUrl: C,
|
|
680
819
|
previewEntryPath: y
|
|
681
820
|
},
|
|
682
|
-
`${o.id}/${
|
|
821
|
+
`${o.id}/${N.name}`
|
|
683
822
|
)
|
|
684
823
|
}
|
|
685
824
|
)
|
|
@@ -691,134 +830,134 @@ function xo({
|
|
|
691
830
|
"data-testid": "bottom-panel",
|
|
692
831
|
className: "jogak:h-[260px] jogak:shrink-0 jogak:flex jogak:flex-col jogak:border-t-2 jogak:border-[var(--jogak-color-border)]",
|
|
693
832
|
children: [
|
|
694
|
-
/* @__PURE__ */
|
|
833
|
+
/* @__PURE__ */ r(
|
|
695
834
|
"div",
|
|
696
835
|
{
|
|
697
836
|
role: "tablist",
|
|
698
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",
|
|
699
|
-
children: ["controls", "actions"].map((
|
|
700
|
-
const
|
|
701
|
-
return /* @__PURE__ */
|
|
838
|
+
children: ["controls", "actions"].map((S) => {
|
|
839
|
+
const H = l === S;
|
|
840
|
+
return /* @__PURE__ */ r(
|
|
702
841
|
"button",
|
|
703
842
|
{
|
|
704
843
|
type: "button",
|
|
705
844
|
role: "tab",
|
|
706
|
-
"aria-selected":
|
|
845
|
+
"aria-selected": H,
|
|
707
846
|
onClick: () => {
|
|
708
|
-
|
|
847
|
+
k(S);
|
|
709
848
|
},
|
|
710
|
-
className:
|
|
849
|
+
className: w(
|
|
711
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",
|
|
712
|
-
|
|
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"
|
|
713
852
|
),
|
|
714
|
-
children:
|
|
853
|
+
children: S
|
|
715
854
|
},
|
|
716
|
-
|
|
855
|
+
S
|
|
717
856
|
);
|
|
718
857
|
})
|
|
719
858
|
}
|
|
720
859
|
),
|
|
721
|
-
/* @__PURE__ */
|
|
722
|
-
|
|
860
|
+
/* @__PURE__ */ r("div", { className: "jogak:flex-1 jogak:min-h-0 jogak:overflow-auto", children: l === "controls" ? /* @__PURE__ */ r(
|
|
861
|
+
po,
|
|
723
862
|
{
|
|
724
863
|
args: A,
|
|
725
864
|
argTypes: u,
|
|
726
865
|
onArgChange: t
|
|
727
866
|
}
|
|
728
|
-
) : /* @__PURE__ */
|
|
867
|
+
) : /* @__PURE__ */ r(xo, {}) })
|
|
729
868
|
]
|
|
730
869
|
}
|
|
731
870
|
)
|
|
732
871
|
] });
|
|
733
872
|
}
|
|
734
|
-
function
|
|
873
|
+
function K({
|
|
735
874
|
title: o,
|
|
736
|
-
jogakName:
|
|
737
|
-
viewport:
|
|
875
|
+
jogakName: e,
|
|
876
|
+
viewport: a,
|
|
738
877
|
bgMode: t,
|
|
739
878
|
onViewportChange: g,
|
|
740
|
-
onBgModeChange:
|
|
741
|
-
showReset:
|
|
742
|
-
onReset:
|
|
879
|
+
onBgModeChange: s,
|
|
880
|
+
showReset: n,
|
|
881
|
+
onReset: i
|
|
743
882
|
}) {
|
|
744
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: [
|
|
745
884
|
/* @__PURE__ */ j("div", { className: "jogak:flex-1 jogak:text-[13px]", children: [
|
|
746
|
-
/* @__PURE__ */
|
|
747
|
-
/* @__PURE__ */
|
|
748
|
-
/* @__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 })
|
|
749
888
|
] }),
|
|
750
|
-
/* @__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(
|
|
751
890
|
"button",
|
|
752
891
|
{
|
|
753
892
|
type: "button",
|
|
754
893
|
onClick: () => {
|
|
755
|
-
g(
|
|
894
|
+
g(l);
|
|
756
895
|
},
|
|
757
|
-
"aria-pressed":
|
|
758
|
-
className:
|
|
896
|
+
"aria-pressed": a === l,
|
|
897
|
+
className: w(
|
|
759
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",
|
|
760
|
-
|
|
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"
|
|
761
900
|
),
|
|
762
|
-
children:
|
|
901
|
+
children: Ao[l]
|
|
763
902
|
},
|
|
764
|
-
|
|
903
|
+
l
|
|
765
904
|
)) }),
|
|
766
|
-
/* @__PURE__ */
|
|
905
|
+
/* @__PURE__ */ r("div", { className: "jogak:flex jogak:gap-1 jogak:items-center", children: ["white", "dark", "transparent"].map((l) => /* @__PURE__ */ r(
|
|
767
906
|
"button",
|
|
768
907
|
{
|
|
769
908
|
type: "button",
|
|
770
909
|
onClick: () => {
|
|
771
|
-
|
|
910
|
+
s(l);
|
|
772
911
|
},
|
|
773
|
-
"aria-pressed": t ===
|
|
774
|
-
"aria-label": `${
|
|
775
|
-
className:
|
|
912
|
+
"aria-pressed": t === l,
|
|
913
|
+
"aria-label": `${l} background`,
|
|
914
|
+
className: w(
|
|
776
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",
|
|
777
|
-
|
|
778
|
-
t ===
|
|
916
|
+
z,
|
|
917
|
+
t === l ? "jogak:border-[var(--jogak-color-accent)]" : "jogak:border-[var(--jogak-color-border-strong)]"
|
|
779
918
|
),
|
|
780
|
-
style:
|
|
919
|
+
style: J[l]
|
|
781
920
|
},
|
|
782
|
-
|
|
921
|
+
l
|
|
783
922
|
)) }),
|
|
784
|
-
|
|
923
|
+
n && /* @__PURE__ */ r(
|
|
785
924
|
"button",
|
|
786
925
|
{
|
|
787
926
|
type: "button",
|
|
788
|
-
onClick:
|
|
927
|
+
onClick: i,
|
|
789
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",
|
|
790
929
|
children: "Reset"
|
|
791
930
|
}
|
|
792
931
|
)
|
|
793
932
|
] });
|
|
794
933
|
}
|
|
795
|
-
function
|
|
796
|
-
const [
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
-
|
|
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,
|
|
799
938
|
{
|
|
800
939
|
entry: o,
|
|
801
|
-
args:
|
|
802
|
-
previewIsolation:
|
|
803
|
-
userPreviewUrl:
|
|
940
|
+
args: e,
|
|
941
|
+
previewIsolation: t,
|
|
942
|
+
userPreviewUrl: g,
|
|
804
943
|
previewEntryPath: s
|
|
805
944
|
}
|
|
806
945
|
),
|
|
807
|
-
/* @__PURE__ */
|
|
946
|
+
/* @__PURE__ */ r(
|
|
808
947
|
"button",
|
|
809
948
|
{
|
|
810
949
|
type: "button",
|
|
811
950
|
onClick: () => {
|
|
812
|
-
i((
|
|
951
|
+
i((c) => !c);
|
|
813
952
|
},
|
|
814
|
-
"aria-pressed":
|
|
815
|
-
"aria-label":
|
|
816
|
-
className:
|
|
953
|
+
"aria-pressed": n,
|
|
954
|
+
"aria-label": n ? "Hide source code" : "Show source code",
|
|
955
|
+
className: w(
|
|
817
956
|
"jogak:absolute jogak:bottom-2 jogak:right-2 jogak:px-[9px] jogak:py-1",
|
|
818
957
|
"jogak:text-[11px] jogak:font-[family-name:var(--jogak-font-mono)] jogak:font-semibold jogak:tracking-[0.02em]",
|
|
819
958
|
"jogak:text-[var(--jogak-color-bg)] jogak:border-none jogak:rounded-[5px] jogak:cursor-pointer",
|
|
820
959
|
"jogak:shadow-[0_1px_4px_rgba(0,0,0,0.2)] jogak:transition-[background-color] jogak:duration-150 jogak:leading-none",
|
|
821
|
-
|
|
960
|
+
n ? "jogak:bg-[var(--jogak-color-accent)]" : "jogak:bg-[#1e293b]"
|
|
822
961
|
),
|
|
823
962
|
children: "</>"
|
|
824
963
|
}
|
|
@@ -826,70 +965,106 @@ function ho({ entry: o, args: a, source: r, theme: t, previewIsolation: g, userP
|
|
|
826
965
|
] });
|
|
827
966
|
return /* @__PURE__ */ j("div", { children: [
|
|
828
967
|
d,
|
|
829
|
-
|
|
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 }) })
|
|
830
969
|
] });
|
|
831
970
|
}
|
|
832
|
-
const
|
|
833
|
-
function
|
|
834
|
-
return
|
|
835
|
-
|
|
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,
|
|
836
975
|
{
|
|
837
976
|
"data-testid": "preview-content",
|
|
838
|
-
className:
|
|
839
|
-
children: /* @__PURE__ */
|
|
977
|
+
className: V,
|
|
978
|
+
children: /* @__PURE__ */ r(Vo, { entry: o, args: e })
|
|
840
979
|
}
|
|
841
|
-
) :
|
|
842
|
-
|
|
980
|
+
) : a === "iframe" ? /* @__PURE__ */ r(
|
|
981
|
+
wo,
|
|
843
982
|
{
|
|
844
983
|
entry: o,
|
|
845
|
-
args:
|
|
984
|
+
args: e,
|
|
846
985
|
userPreviewUrl: t,
|
|
847
986
|
previewEntryPath: g,
|
|
848
987
|
"data-testid": "preview-content",
|
|
849
|
-
className: `${
|
|
988
|
+
className: `${V} jogak:block jogak:w-full jogak:bg-transparent jogak:min-h-[256px]`
|
|
850
989
|
}
|
|
851
|
-
) : /* @__PURE__ */
|
|
990
|
+
) : /* @__PURE__ */ r(Wo, { entry: o, args: e });
|
|
852
991
|
}
|
|
853
|
-
function
|
|
854
|
-
const
|
|
855
|
-
return
|
|
856
|
-
const
|
|
857
|
-
if (
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
992
|
+
function Wo({ entry: o, args: e }) {
|
|
993
|
+
const a = $(null), t = $(null);
|
|
994
|
+
return x(() => {
|
|
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
|
+
};
|
|
1008
|
+
}, [o]), x(() => {
|
|
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(
|
|
867
1024
|
"div",
|
|
868
1025
|
{
|
|
869
|
-
ref:
|
|
1026
|
+
ref: a,
|
|
870
1027
|
"data-testid": "preview-content",
|
|
871
|
-
className:
|
|
1028
|
+
className: V
|
|
872
1029
|
}
|
|
873
1030
|
);
|
|
874
1031
|
}
|
|
875
|
-
function
|
|
876
|
-
const
|
|
877
|
-
return
|
|
878
|
-
const
|
|
879
|
-
if (
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
1032
|
+
function Vo({ entry: o, args: e }) {
|
|
1033
|
+
const a = $(null), t = $(null);
|
|
1034
|
+
return x(() => {
|
|
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
|
+
};
|
|
1048
|
+
}, [o]), x(() => {
|
|
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" });
|
|
889
1064
|
}
|
|
890
|
-
function
|
|
891
|
-
const [
|
|
892
|
-
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(
|
|
893
1068
|
"div",
|
|
894
1069
|
{
|
|
895
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]",
|
|
@@ -897,7 +1072,7 @@ function yo({ source: o, theme: a }) {
|
|
|
897
1072
|
children: "Source not available"
|
|
898
1073
|
}
|
|
899
1074
|
) : /* @__PURE__ */ j("div", { className: "jogak:relative jogak:h-full", children: [
|
|
900
|
-
/* @__PURE__ */
|
|
1075
|
+
/* @__PURE__ */ r(
|
|
901
1076
|
"button",
|
|
902
1077
|
{
|
|
903
1078
|
type: "button",
|
|
@@ -909,134 +1084,134 @@ function yo({ source: o, theme: a }) {
|
|
|
909
1084
|
});
|
|
910
1085
|
},
|
|
911
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",
|
|
912
|
-
children:
|
|
1087
|
+
children: a ? "✓ Copied" : "Copy"
|
|
913
1088
|
}
|
|
914
1089
|
),
|
|
915
|
-
/* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ r(ro, { code: o.trim(), language: "tsx", theme: e, children: ({ style: n, tokens: i, getLineProps: l, getTokenProps: d }) => /* @__PURE__ */ r(
|
|
916
1091
|
"pre",
|
|
917
1092
|
{
|
|
918
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",
|
|
919
|
-
style:
|
|
920
|
-
children:
|
|
1094
|
+
style: n,
|
|
1095
|
+
children: i.map((c, k) => /* @__PURE__ */ j(
|
|
921
1096
|
"div",
|
|
922
1097
|
{
|
|
923
|
-
...
|
|
1098
|
+
...l({ line: c }),
|
|
924
1099
|
className: "jogak:flex jogak:pr-6",
|
|
925
|
-
style:
|
|
1100
|
+
style: l({ line: c }).style,
|
|
926
1101
|
children: [
|
|
927
|
-
/* @__PURE__ */
|
|
928
|
-
/* @__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)) })
|
|
929
1104
|
]
|
|
930
1105
|
},
|
|
931
|
-
|
|
1106
|
+
k
|
|
932
1107
|
))
|
|
933
1108
|
}
|
|
934
1109
|
) })
|
|
935
1110
|
] });
|
|
936
1111
|
}
|
|
937
|
-
function
|
|
1112
|
+
function G() {
|
|
938
1113
|
if (typeof window > "u") return null;
|
|
939
|
-
const o = new URLSearchParams(window.location.search),
|
|
940
|
-
if (
|
|
941
|
-
const
|
|
942
|
-
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 };
|
|
943
1118
|
}
|
|
944
|
-
function
|
|
945
|
-
const
|
|
946
|
-
|
|
1119
|
+
function zo(o, e) {
|
|
1120
|
+
const a = new URLSearchParams();
|
|
1121
|
+
a.set("entry", o), a.set("jogak", e), window.history.pushState({}, "", `?${a.toString()}`);
|
|
947
1122
|
}
|
|
948
|
-
function
|
|
1123
|
+
function Go({
|
|
949
1124
|
entries: o,
|
|
950
|
-
metas:
|
|
951
|
-
codeTheme:
|
|
1125
|
+
metas: e,
|
|
1126
|
+
codeTheme: a = "vsDark",
|
|
952
1127
|
previewIsolation: t = "iframe",
|
|
953
1128
|
userPreviewUrl: g = "",
|
|
954
|
-
previewEntryPath:
|
|
955
|
-
userViteUrl:
|
|
1129
|
+
previewEntryPath: s = "/__jogak_preview__/index.html",
|
|
1130
|
+
userViteUrl: n
|
|
956
1131
|
} = {}) {
|
|
957
|
-
const
|
|
1132
|
+
const i = g !== "" ? g : n ?? "", l = _(() => {
|
|
958
1133
|
if (o !== void 0) {
|
|
959
|
-
|
|
1134
|
+
e !== void 0 && console.warn(
|
|
960
1135
|
"[jogak] JogakApp received both `entries` and `metas` — `entries` (eager) takes precedence."
|
|
961
1136
|
);
|
|
962
|
-
const u = new
|
|
963
|
-
for (const
|
|
1137
|
+
const u = new T();
|
|
1138
|
+
for (const m of o) u.register(m);
|
|
964
1139
|
return u;
|
|
965
1140
|
}
|
|
966
|
-
if (
|
|
967
|
-
for (const u of
|
|
1141
|
+
if (e !== void 0)
|
|
1142
|
+
for (const u of e) F.registerMeta(u);
|
|
968
1143
|
return F;
|
|
969
|
-
}, [o,
|
|
1144
|
+
}, [o, e]), d = _(() => G(), []), [c, k] = h(
|
|
970
1145
|
(d == null ? void 0 : d.entryId) ?? null
|
|
971
|
-
), [
|
|
1146
|
+
), [f, p] = h(
|
|
972
1147
|
(d == null ? void 0 : d.jogakName) ?? null
|
|
973
|
-
), [
|
|
974
|
-
|
|
1148
|
+
), [C, y] = h({});
|
|
1149
|
+
x(() => {
|
|
975
1150
|
const u = () => {
|
|
976
|
-
const
|
|
977
|
-
|
|
1151
|
+
const m = G();
|
|
1152
|
+
m !== null ? (k(m.entryId), p(m.jogakName), y({})) : (k(null), p(null));
|
|
978
1153
|
};
|
|
979
1154
|
return window.addEventListener("popstate", u), () => {
|
|
980
1155
|
window.removeEventListener("popstate", u);
|
|
981
1156
|
};
|
|
982
1157
|
}, []);
|
|
983
|
-
const v =
|
|
984
|
-
|
|
985
|
-
}, []),
|
|
986
|
-
if (
|
|
987
|
-
const
|
|
988
|
-
|
|
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") {
|
|
1162
|
+
const b = new URLSearchParams(window.location.search);
|
|
1163
|
+
b.get("entry") === u && b.get("jogak") === null && (b.set("jogak", m), window.history.replaceState({}, "", `?${b.toString()}`));
|
|
989
1164
|
}
|
|
990
|
-
}, []),
|
|
991
|
-
y((
|
|
992
|
-
}, []), A =
|
|
1165
|
+
}, []), D = R((u, m) => {
|
|
1166
|
+
y((b) => ({ ...b, [u]: m }));
|
|
1167
|
+
}, []), A = R(() => {
|
|
993
1168
|
y({});
|
|
994
1169
|
}, []);
|
|
995
|
-
return /* @__PURE__ */
|
|
1170
|
+
return /* @__PURE__ */ r(ao, { registry: l, children: /* @__PURE__ */ j(
|
|
996
1171
|
"div",
|
|
997
1172
|
{
|
|
998
1173
|
"data-jogak-shell": !0,
|
|
999
1174
|
className: "jogak:grid jogak:grid-cols-[260px_1fr] jogak:h-dvh jogak:overflow-hidden",
|
|
1000
1175
|
children: [
|
|
1001
|
-
/* @__PURE__ */
|
|
1002
|
-
|
|
1176
|
+
/* @__PURE__ */ r(
|
|
1177
|
+
go,
|
|
1003
1178
|
{
|
|
1004
|
-
selectedEntryId:
|
|
1005
|
-
selectedJogakName:
|
|
1179
|
+
selectedEntryId: c,
|
|
1180
|
+
selectedJogakName: f,
|
|
1006
1181
|
onSelect: v
|
|
1007
1182
|
}
|
|
1008
1183
|
),
|
|
1009
|
-
/* @__PURE__ */
|
|
1010
|
-
|
|
1184
|
+
/* @__PURE__ */ r("main", { className: "jogak:overflow-hidden jogak:min-h-0", children: c !== null ? /* @__PURE__ */ r(
|
|
1185
|
+
Eo,
|
|
1011
1186
|
{
|
|
1012
|
-
entryId:
|
|
1013
|
-
jogakName:
|
|
1014
|
-
overrideArgs:
|
|
1015
|
-
onArgChange:
|
|
1187
|
+
entryId: c,
|
|
1188
|
+
jogakName: f,
|
|
1189
|
+
overrideArgs: C,
|
|
1190
|
+
onArgChange: D,
|
|
1016
1191
|
onReset: A,
|
|
1017
|
-
codeTheme:
|
|
1018
|
-
onResolveJogak:
|
|
1192
|
+
codeTheme: a,
|
|
1193
|
+
onResolveJogak: N,
|
|
1019
1194
|
previewIsolation: t,
|
|
1020
|
-
userPreviewUrl:
|
|
1021
|
-
previewEntryPath:
|
|
1195
|
+
userPreviewUrl: i,
|
|
1196
|
+
previewEntryPath: s
|
|
1022
1197
|
}
|
|
1023
|
-
) : /* @__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" }) })
|
|
1024
1199
|
]
|
|
1025
1200
|
}
|
|
1026
1201
|
) });
|
|
1027
1202
|
}
|
|
1028
|
-
function
|
|
1029
|
-
const o =
|
|
1203
|
+
function Io() {
|
|
1204
|
+
const o = to(), e = _(() => o.getAll(), [o]), a = _(() => o.getTree(), [o]), t = _(
|
|
1030
1205
|
() => (g) => o.search(g),
|
|
1031
1206
|
[o]
|
|
1032
1207
|
);
|
|
1033
|
-
return { entries:
|
|
1208
|
+
return { entries: e, tree: a, search: t };
|
|
1034
1209
|
}
|
|
1035
1210
|
export {
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1211
|
+
xo as Actions,
|
|
1212
|
+
po as Controls,
|
|
1213
|
+
Go as JogakApp,
|
|
1214
|
+
Eo as Preview,
|
|
1215
|
+
go as Sidebar,
|
|
1216
|
+
Io as useRegistry
|
|
1042
1217
|
};
|