@jogak/ui 0.1.0-alpha.11 → 0.1.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -7
- package/dist/index.mjs +268 -242
- package/package.json +2 -2
- package/src/components/Controls/index.tsx +36 -0
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as j, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useState as h, useEffect as x, useRef as
|
|
3
|
-
import { defaultActionChannel as
|
|
2
|
+
import { useState as h, useEffect as x, useRef as E, useMemo as _, useCallback as A } from "react";
|
|
3
|
+
import { defaultActionChannel as P, ComponentRegistry as Z, defaultRegistry as H } from "@jogak/core";
|
|
4
4
|
import { useRegistryMeta as K, useEntry as T, reactAdapter as $, JogakProvider as oo, useRegistry as ao } from "@jogak/core/renderers/react";
|
|
5
5
|
import { themes as F, Highlight as eo } from "prism-react-renderer";
|
|
6
6
|
import { createPortal as to } from "react-dom";
|
|
@@ -13,7 +13,7 @@ function U(o) {
|
|
|
13
13
|
} else for (e in o) o[e] && (r && (r += " "), r += e);
|
|
14
14
|
return r;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function w() {
|
|
17
17
|
for (var o, a, e = 0, r = "", s = arguments.length; e < s; e++) (o = arguments[e]) && (a = U(o)) && (r && (r += " "), r += a);
|
|
18
18
|
return r;
|
|
19
19
|
}
|
|
@@ -22,7 +22,7 @@ function ro({
|
|
|
22
22
|
selectedJogakName: a,
|
|
23
23
|
onSelect: e
|
|
24
24
|
}) {
|
|
25
|
-
const [r, s] = h(""), { metaTree:
|
|
25
|
+
const [r, s] = h(""), { metaTree: g, searchMeta: n } = K(), k = r.trim().length > 0 ? n(r) : null;
|
|
26
26
|
return /* @__PURE__ */ j(
|
|
27
27
|
"aside",
|
|
28
28
|
{
|
|
@@ -35,17 +35,17 @@ function ro({
|
|
|
35
35
|
type: "search",
|
|
36
36
|
placeholder: "Search components...",
|
|
37
37
|
value: r,
|
|
38
|
-
onChange: (
|
|
39
|
-
s(
|
|
38
|
+
onChange: (l) => {
|
|
39
|
+
s(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__ */ t("nav", { className: "jogak:flex-1 jogak:overflow-auto jogak:py-2", children:
|
|
45
|
+
/* @__PURE__ */ t("nav", { className: "jogak:flex-1 jogak:overflow-auto jogak:py-2", children: k !== null ? /* @__PURE__ */ t(
|
|
46
46
|
no,
|
|
47
47
|
{
|
|
48
|
-
metas:
|
|
48
|
+
metas: k,
|
|
49
49
|
selectedEntryId: o,
|
|
50
50
|
selectedJogakName: a,
|
|
51
51
|
onSelect: e
|
|
@@ -53,7 +53,7 @@ function ro({
|
|
|
53
53
|
) : /* @__PURE__ */ t(
|
|
54
54
|
q,
|
|
55
55
|
{
|
|
56
|
-
node:
|
|
56
|
+
node: g,
|
|
57
57
|
selectedEntryId: o,
|
|
58
58
|
selectedJogakName: a,
|
|
59
59
|
onSelect: e
|
|
@@ -92,10 +92,10 @@ function q({
|
|
|
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": `${s * 12}px` },
|
|
95
|
-
children: Object.entries(o).map(([
|
|
95
|
+
children: Object.entries(o).map(([g, n]) => /* @__PURE__ */ t("li", { children: "id" in n ? /* @__PURE__ */ t(
|
|
96
96
|
G,
|
|
97
97
|
{
|
|
98
|
-
meta:
|
|
98
|
+
meta: n,
|
|
99
99
|
selectedEntryId: a,
|
|
100
100
|
selectedJogakName: e,
|
|
101
101
|
onSelect: r,
|
|
@@ -104,14 +104,14 @@ function q({
|
|
|
104
104
|
) : /* @__PURE__ */ t(
|
|
105
105
|
go,
|
|
106
106
|
{
|
|
107
|
-
label:
|
|
108
|
-
node:
|
|
107
|
+
label: g,
|
|
108
|
+
node: n,
|
|
109
109
|
selectedEntryId: a,
|
|
110
110
|
selectedJogakName: e,
|
|
111
111
|
onSelect: r,
|
|
112
112
|
depth: s + 1
|
|
113
113
|
}
|
|
114
|
-
) },
|
|
114
|
+
) }, g))
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
117
|
}
|
|
@@ -121,33 +121,33 @@ function go({
|
|
|
121
121
|
selectedEntryId: e,
|
|
122
122
|
selectedJogakName: r,
|
|
123
123
|
onSelect: s,
|
|
124
|
-
depth:
|
|
124
|
+
depth: g
|
|
125
125
|
}) {
|
|
126
|
-
const [
|
|
126
|
+
const [n, k] = 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
|
+
k((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__ */ t("span", { children:
|
|
138
|
+
/* @__PURE__ */ t("span", { children: n ? "▾" : "▸" }),
|
|
139
139
|
o
|
|
140
140
|
]
|
|
141
141
|
}
|
|
142
142
|
),
|
|
143
|
-
|
|
143
|
+
n && /* @__PURE__ */ t(
|
|
144
144
|
q,
|
|
145
145
|
{
|
|
146
146
|
node: a,
|
|
147
147
|
selectedEntryId: e,
|
|
148
148
|
selectedJogakName: r,
|
|
149
149
|
onSelect: s,
|
|
150
|
-
depth:
|
|
150
|
+
depth: g
|
|
151
151
|
}
|
|
152
152
|
)
|
|
153
153
|
] });
|
|
@@ -159,49 +159,49 @@ function G({
|
|
|
159
159
|
onSelect: r,
|
|
160
160
|
indent: s
|
|
161
161
|
}) {
|
|
162
|
-
const
|
|
162
|
+
const g = o.id === a, [n, k] = h(g);
|
|
163
163
|
x(() => {
|
|
164
|
-
|
|
165
|
-
}, [
|
|
166
|
-
const
|
|
164
|
+
g && k(!0);
|
|
165
|
+
}, [g]);
|
|
166
|
+
const l = o.title.split("/").pop() ?? o.title, d = 16 + s * 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 (g)
|
|
174
|
+
k((i) => !i);
|
|
175
175
|
else {
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
|
|
176
|
+
k(!0);
|
|
177
|
+
const i = o.jogakNames[0];
|
|
178
|
+
i !== void 0 && r(o.id, i);
|
|
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
|
+
g ? "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__ */ t("span", { className: "jogak:text-[10px] jogak:shrink-0 jogak:leading-none", children:
|
|
191
|
-
|
|
190
|
+
/* @__PURE__ */ t("span", { className: "jogak:text-[10px] jogak:shrink-0 jogak:leading-none", children: n ? "▾" : "▸" }),
|
|
191
|
+
l
|
|
192
192
|
]
|
|
193
193
|
}
|
|
194
194
|
),
|
|
195
|
-
|
|
196
|
-
const c =
|
|
195
|
+
n && /* @__PURE__ */ t("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0", children: o.jogakNames.map((i) => {
|
|
196
|
+
const c = g && i === e;
|
|
197
197
|
return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
198
198
|
"button",
|
|
199
199
|
{
|
|
200
200
|
type: "button",
|
|
201
201
|
onClick: () => {
|
|
202
|
-
r(o.id,
|
|
202
|
+
r(o.id, i);
|
|
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]",
|
|
@@ -209,9 +209,9 @@ function G({
|
|
|
209
209
|
),
|
|
210
210
|
style: { "--jogak-jogak-pl": `${d + 18}px` },
|
|
211
211
|
"aria-current": c ? "true" : void 0,
|
|
212
|
-
children:
|
|
212
|
+
children: i
|
|
213
213
|
}
|
|
214
|
-
) },
|
|
214
|
+
) }, i);
|
|
215
215
|
}) })
|
|
216
216
|
] });
|
|
217
217
|
}
|
|
@@ -219,7 +219,7 @@ function so(o, a) {
|
|
|
219
219
|
const e = a == null ? void 0 : a.control, r = (a == null ? void 0 : a.action) !== void 0 && a.action !== !1, s = (a == null ? void 0 : a.type) === "function" || typeof o == "function";
|
|
220
220
|
return r || s ? "action" : e === "boolean" || typeof o == "boolean" ? "boolean" : e === "number" || e === "range" || typeof o == "number" ? "number" : e === "select" || e === "radio" || (a == null ? void 0 : a.options) !== void 0 && a.options.length > 0 ? "select" : e === "text" || e === "color" || typeof o == "string" ? "text" : "json";
|
|
221
221
|
}
|
|
222
|
-
const
|
|
222
|
+
const M = "jogak:px-2 jogak:py-1 jogak:border jogak:border-[var(--jogak-color-border-strong)] jogak:rounded-[var(--jogak-radius-md)] jogak:text-[13px] jogak:w-full jogak:max-w-[280px]", L = "jogak:px-5 jogak:py-1.5 jogak:text-left jogak:text-[var(--jogak-color-fg-muted)] jogak:font-medium jogak:text-[12px] jogak:border-b jogak:border-[var(--jogak-color-border)]", O = "jogak:px-5 jogak:py-2 jogak:align-middle jogak:border-b jogak:border-[var(--jogak-color-border-muted)]";
|
|
223
223
|
function lo({ argKey: o, value: a, argType: e, onArgChange: r }) {
|
|
224
224
|
switch (so(a, e)) {
|
|
225
225
|
case "boolean":
|
|
@@ -228,8 +228,8 @@ function lo({ argKey: o, value: a, argType: e, onArgChange: r }) {
|
|
|
228
228
|
{
|
|
229
229
|
type: "checkbox",
|
|
230
230
|
checked: a === !0,
|
|
231
|
-
onChange: (
|
|
232
|
-
r(o,
|
|
231
|
+
onChange: (g) => {
|
|
232
|
+
r(o, g.target.checked);
|
|
233
233
|
},
|
|
234
234
|
className: "jogak:cursor-pointer jogak:w-4 jogak:h-4 jogak:accent-[var(--jogak-color-accent)]"
|
|
235
235
|
}
|
|
@@ -240,23 +240,23 @@ function lo({ argKey: o, value: a, argType: e, onArgChange: r }) {
|
|
|
240
240
|
{
|
|
241
241
|
type: "number",
|
|
242
242
|
value: typeof a == "number" ? a : "",
|
|
243
|
-
onChange: (
|
|
244
|
-
r(o,
|
|
243
|
+
onChange: (g) => {
|
|
244
|
+
r(o, g.target.valueAsNumber);
|
|
245
245
|
},
|
|
246
|
-
className:
|
|
246
|
+
className: M
|
|
247
247
|
}
|
|
248
248
|
);
|
|
249
249
|
case "select": {
|
|
250
|
-
const
|
|
250
|
+
const g = (e == null ? void 0 : e.options) ?? [];
|
|
251
251
|
return /* @__PURE__ */ t(
|
|
252
252
|
"select",
|
|
253
253
|
{
|
|
254
254
|
value: String(a ?? ""),
|
|
255
|
-
onChange: (
|
|
256
|
-
r(o,
|
|
255
|
+
onChange: (n) => {
|
|
256
|
+
r(o, n.target.value);
|
|
257
257
|
},
|
|
258
|
-
className:
|
|
259
|
-
children:
|
|
258
|
+
className: M,
|
|
259
|
+
children: g.map((n) => /* @__PURE__ */ t("option", { value: String(n), children: String(n) }, String(n)))
|
|
260
260
|
}
|
|
261
261
|
);
|
|
262
262
|
}
|
|
@@ -266,10 +266,10 @@ function lo({ argKey: o, value: a, argType: e, onArgChange: r }) {
|
|
|
266
266
|
{
|
|
267
267
|
type: "text",
|
|
268
268
|
value: typeof a == "string" ? a : String(a ?? ""),
|
|
269
|
-
onChange: (
|
|
270
|
-
r(o,
|
|
269
|
+
onChange: (g) => {
|
|
270
|
+
r(o, g.target.value);
|
|
271
271
|
},
|
|
272
|
-
className:
|
|
272
|
+
className: M
|
|
273
273
|
}
|
|
274
274
|
);
|
|
275
275
|
case "action":
|
|
@@ -279,44 +279,70 @@ function lo({ argKey: o, value: a, argType: e, onArgChange: r }) {
|
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
function io({ args: o, argTypes: a, onArgChange: e }) {
|
|
282
|
-
const s = Array.from(/* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(a)])).map((n) => [n, o[n]])
|
|
282
|
+
const s = Array.from(/* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(a)])).map((n) => [n, o[n]]), g = s.some(
|
|
283
|
+
([n]) => {
|
|
284
|
+
var k;
|
|
285
|
+
return ((k = a[n]) == null ? void 0 : k.defaultValue) !== void 0;
|
|
286
|
+
}
|
|
287
|
+
);
|
|
283
288
|
return /* @__PURE__ */ j("div", { className: "jogak:border-t-2 jogak:border-[var(--jogak-color-border)]", children: [
|
|
284
289
|
/* @__PURE__ */ t("div", { className: "jogak:px-5 jogak:py-1.5 jogak:text-[11px] jogak:font-bold jogak:text-[var(--jogak-color-fg-subtle)] jogak:uppercase jogak:tracking-[0.08em] jogak:border-b jogak:border-[var(--jogak-color-border)] jogak:bg-[var(--jogak-color-bg-subtle)]", children: "Controls" }),
|
|
285
290
|
s.length === 0 ? /* @__PURE__ */ t("div", { className: "jogak:px-5 jogak:py-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px]", children: "No args defined" }) : /* @__PURE__ */ j("table", { className: "jogak:w-full jogak:border-collapse jogak:text-[13px]", children: [
|
|
286
291
|
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ j("tr", { children: [
|
|
287
|
-
/* @__PURE__ */ t("th", { className:
|
|
288
|
-
/* @__PURE__ */ t("th", { className:
|
|
289
|
-
/* @__PURE__ */ t("th", { className:
|
|
292
|
+
/* @__PURE__ */ t("th", { className: L, children: "Name" }),
|
|
293
|
+
/* @__PURE__ */ t("th", { className: L, children: "Control" }),
|
|
294
|
+
g && /* @__PURE__ */ t("th", { className: L, children: "Default" }),
|
|
295
|
+
/* @__PURE__ */ t("th", { className: L, children: "Description" })
|
|
290
296
|
] }) }),
|
|
291
|
-
/* @__PURE__ */ t("tbody", { children: s.map(([n,
|
|
292
|
-
const
|
|
297
|
+
/* @__PURE__ */ t("tbody", { children: s.map(([n, k]) => {
|
|
298
|
+
const l = a[n];
|
|
293
299
|
return /* @__PURE__ */ j("tr", { children: [
|
|
294
300
|
/* @__PURE__ */ t(
|
|
295
301
|
"td",
|
|
296
302
|
{
|
|
297
|
-
className:
|
|
298
|
-
|
|
303
|
+
className: w(
|
|
304
|
+
O,
|
|
299
305
|
"jogak:font-[family-name:var(--jogak-font-mono)] jogak:text-[12px] jogak:text-[var(--jogak-color-fg)] jogak:whitespace-nowrap"
|
|
300
306
|
),
|
|
301
307
|
children: n
|
|
302
308
|
}
|
|
303
309
|
),
|
|
304
|
-
/* @__PURE__ */ t("td", { className:
|
|
310
|
+
/* @__PURE__ */ t("td", { className: O, children: /* @__PURE__ */ t(
|
|
305
311
|
lo,
|
|
306
312
|
{
|
|
307
313
|
argKey: n,
|
|
308
|
-
value:
|
|
309
|
-
argType:
|
|
314
|
+
value: k,
|
|
315
|
+
argType: l,
|
|
310
316
|
onArgChange: e
|
|
311
317
|
}
|
|
312
318
|
) }),
|
|
313
|
-
/* @__PURE__ */ t(
|
|
319
|
+
g && /* @__PURE__ */ t(
|
|
320
|
+
"td",
|
|
321
|
+
{
|
|
322
|
+
className: w(
|
|
323
|
+
O,
|
|
324
|
+
"jogak:font-[family-name:var(--jogak-font-mono)] jogak:text-[12px] jogak:text-[var(--jogak-color-fg-muted)] jogak:whitespace-nowrap"
|
|
325
|
+
),
|
|
326
|
+
children: (l == null ? void 0 : l.defaultValue) !== void 0 ? ko(l.defaultValue) : ""
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
/* @__PURE__ */ t("td", { className: w(O, "jogak:text-[var(--jogak-color-fg-subtle)]"), children: (l == null ? void 0 : l.description) ?? "" })
|
|
314
330
|
] }, n);
|
|
315
331
|
}) })
|
|
316
332
|
] })
|
|
317
333
|
] });
|
|
318
334
|
}
|
|
319
335
|
function ko(o) {
|
|
336
|
+
if (typeof o == "string") return `'${o}'`;
|
|
337
|
+
if (typeof o == "number" || typeof o == "boolean" || o === null)
|
|
338
|
+
return String(o);
|
|
339
|
+
try {
|
|
340
|
+
return JSON.stringify(o);
|
|
341
|
+
} catch {
|
|
342
|
+
return String(o);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function co(o) {
|
|
320
346
|
if (o.length === 0) return "()";
|
|
321
347
|
try {
|
|
322
348
|
return o.map((a) => {
|
|
@@ -334,13 +360,13 @@ function ko(o) {
|
|
|
334
360
|
return "[unserializable]";
|
|
335
361
|
}
|
|
336
362
|
}
|
|
337
|
-
function
|
|
338
|
-
const a = new Date(o), e = a.getHours().toString().padStart(2, "0"), r = a.getMinutes().toString().padStart(2, "0"), s = a.getSeconds().toString().padStart(2, "0"),
|
|
339
|
-
return `${e}:${r}:${s}.${
|
|
363
|
+
function jo(o) {
|
|
364
|
+
const a = new Date(o), e = a.getHours().toString().padStart(2, "0"), r = a.getMinutes().toString().padStart(2, "0"), s = a.getSeconds().toString().padStart(2, "0"), g = a.getMilliseconds().toString().padStart(3, "0");
|
|
365
|
+
return `${e}:${r}:${s}.${g}`;
|
|
340
366
|
}
|
|
341
|
-
function
|
|
342
|
-
const [o, a] = h(() =>
|
|
343
|
-
x(() =>
|
|
367
|
+
function uo() {
|
|
368
|
+
const [o, a] = h(() => P.getLogs());
|
|
369
|
+
x(() => P.subscribe(a), []);
|
|
344
370
|
const e = o.length === 0;
|
|
345
371
|
return /* @__PURE__ */ j("div", { className: "jogak:h-full jogak:flex jogak:flex-col", children: [
|
|
346
372
|
/* @__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: [
|
|
@@ -353,10 +379,10 @@ function jo() {
|
|
|
353
379
|
{
|
|
354
380
|
type: "button",
|
|
355
381
|
onClick: () => {
|
|
356
|
-
|
|
382
|
+
P.clear();
|
|
357
383
|
},
|
|
358
384
|
disabled: e,
|
|
359
|
-
className:
|
|
385
|
+
className: w(
|
|
360
386
|
"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
387
|
e ? "jogak:text-[var(--jogak-color-fg-subtle)] jogak:cursor-default" : "jogak:text-[var(--jogak-color-fg)] jogak:cursor-pointer"
|
|
362
388
|
),
|
|
@@ -369,11 +395,11 @@ function jo() {
|
|
|
369
395
|
{
|
|
370
396
|
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
397
|
children: [
|
|
372
|
-
/* @__PURE__ */ t("span", { className: "jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[11px] jogak:min-w-[92px]", children:
|
|
398
|
+
/* @__PURE__ */ t("span", { className: "jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[11px] jogak:min-w-[92px]", children: jo(r.timestamp) }),
|
|
373
399
|
/* @__PURE__ */ t("span", { className: "jogak:text-[var(--jogak-color-violet)] jogak:font-semibold", children: r.name }),
|
|
374
400
|
/* @__PURE__ */ j("span", { className: "jogak:text-[var(--jogak-color-fg)] jogak:break-all jogak:flex-1", children: [
|
|
375
401
|
"(",
|
|
376
|
-
|
|
402
|
+
co(r.args),
|
|
377
403
|
")"
|
|
378
404
|
] })
|
|
379
405
|
]
|
|
@@ -382,18 +408,18 @@ function jo() {
|
|
|
382
408
|
)) }) })
|
|
383
409
|
] });
|
|
384
410
|
}
|
|
385
|
-
function
|
|
411
|
+
function po({
|
|
386
412
|
children: o,
|
|
387
413
|
className: a,
|
|
388
414
|
style: e,
|
|
389
415
|
"data-testid": r
|
|
390
416
|
}) {
|
|
391
|
-
const s =
|
|
417
|
+
const s = E(null), [g, n] = h(null);
|
|
392
418
|
return x(() => {
|
|
393
|
-
const
|
|
394
|
-
if (
|
|
395
|
-
const
|
|
396
|
-
|
|
419
|
+
const k = s.current;
|
|
420
|
+
if (k === null) return;
|
|
421
|
+
const l = k.shadowRoot ?? k.attachShadow({ mode: "open" });
|
|
422
|
+
n(l);
|
|
397
423
|
}, []), /* @__PURE__ */ t(
|
|
398
424
|
"div",
|
|
399
425
|
{
|
|
@@ -401,77 +427,77 @@ function uo({
|
|
|
401
427
|
className: a,
|
|
402
428
|
"data-testid": r,
|
|
403
429
|
style: e,
|
|
404
|
-
children:
|
|
430
|
+
children: g !== null ? to(o, g) : null
|
|
405
431
|
}
|
|
406
432
|
);
|
|
407
433
|
}
|
|
408
|
-
function
|
|
434
|
+
function fo({
|
|
409
435
|
entry: o,
|
|
410
436
|
args: a,
|
|
411
437
|
userPreviewUrl: e,
|
|
412
438
|
previewEntryPath: r,
|
|
413
439
|
className: s,
|
|
414
|
-
"data-testid":
|
|
440
|
+
"data-testid": g
|
|
415
441
|
}) {
|
|
416
|
-
const
|
|
442
|
+
const n = E(null), [k, l] = h(!1), d = e !== "" ? `${e}${r}` : "/preview-frame.html";
|
|
417
443
|
return x(() => {
|
|
418
|
-
const
|
|
419
|
-
const p =
|
|
444
|
+
const i = (c) => {
|
|
445
|
+
const p = n.current;
|
|
420
446
|
if (p === null || c.source !== p.contentWindow) return;
|
|
421
447
|
const f = c.data;
|
|
422
|
-
f == null || typeof f != "object" || f.type === "jogak:ready" &&
|
|
448
|
+
f == null || typeof f != "object" || f.type === "jogak:ready" && l(!0);
|
|
423
449
|
};
|
|
424
|
-
return window.addEventListener("message",
|
|
425
|
-
window.removeEventListener("message",
|
|
450
|
+
return window.addEventListener("message", i), () => {
|
|
451
|
+
window.removeEventListener("message", i);
|
|
426
452
|
};
|
|
427
453
|
}, []), x(() => {
|
|
428
454
|
var c;
|
|
429
|
-
if (!
|
|
430
|
-
const
|
|
431
|
-
|
|
455
|
+
if (!k) return;
|
|
456
|
+
const i = n.current;
|
|
457
|
+
i !== null && ((c = i.contentWindow) == null || c.postMessage(
|
|
432
458
|
{ type: "jogak:setProps", entryId: o.id, args: a },
|
|
433
459
|
"*"
|
|
434
460
|
));
|
|
435
|
-
}, [
|
|
436
|
-
const
|
|
461
|
+
}, [k, o, a]), x(() => {
|
|
462
|
+
const i = n.current;
|
|
437
463
|
return () => {
|
|
438
|
-
|
|
464
|
+
i !== null && queueMicrotask(() => {
|
|
439
465
|
var c;
|
|
440
|
-
(c =
|
|
466
|
+
(c = i.contentWindow) == null || c.postMessage({ type: "jogak:unmount" }, "*");
|
|
441
467
|
});
|
|
442
468
|
};
|
|
443
469
|
}, []), /* @__PURE__ */ t(
|
|
444
470
|
"iframe",
|
|
445
471
|
{
|
|
446
|
-
ref:
|
|
472
|
+
ref: n,
|
|
447
473
|
src: d,
|
|
448
474
|
title: "Preview",
|
|
449
475
|
className: s,
|
|
450
|
-
"data-testid":
|
|
476
|
+
"data-testid": g
|
|
451
477
|
}
|
|
452
478
|
);
|
|
453
479
|
}
|
|
454
|
-
const
|
|
455
|
-
function
|
|
456
|
-
const e =
|
|
457
|
-
if (d.length <=
|
|
480
|
+
const mo = 60;
|
|
481
|
+
function bo(o, a) {
|
|
482
|
+
const e = ho(o), { children: r, restProps: s } = xo(a), g = Object.entries(s).filter(([, c]) => c !== void 0).map(([c, p]) => wo(c, p)), n = vo(r), k = n !== null, l = g.length === 0 ? "" : " " + g.join(" "), d = k ? `<${e}${l}>${n ?? ""}</${e}>` : `<${e}${l} />`;
|
|
483
|
+
if (d.length <= mo && !d.includes(`
|
|
458
484
|
`))
|
|
459
485
|
return d;
|
|
460
|
-
const
|
|
461
|
-
` +
|
|
486
|
+
const i = g.length === 0 ? "" : `
|
|
487
|
+
` + g.join(`
|
|
462
488
|
`) + `
|
|
463
489
|
`;
|
|
464
|
-
if (
|
|
465
|
-
const c = (
|
|
490
|
+
if (k) {
|
|
491
|
+
const c = (n ?? "").split(`
|
|
466
492
|
`).map((p) => ` ${p}`).join(`
|
|
467
493
|
`);
|
|
468
|
-
return `<${e}${
|
|
494
|
+
return `<${e}${i}>
|
|
469
495
|
${c}
|
|
470
496
|
</${e}>`;
|
|
471
497
|
}
|
|
472
|
-
return `<${e}${
|
|
498
|
+
return `<${e}${i}/>`;
|
|
473
499
|
}
|
|
474
|
-
function
|
|
500
|
+
function ho(o) {
|
|
475
501
|
const a = o.meta.component;
|
|
476
502
|
if (a !== void 0) {
|
|
477
503
|
if (typeof a.displayName == "string" && a.displayName.length > 0)
|
|
@@ -482,14 +508,14 @@ function bo(o) {
|
|
|
482
508
|
const e = o.title.split("/").pop();
|
|
483
509
|
return e !== void 0 && e.length > 0 ? e : "Component";
|
|
484
510
|
}
|
|
485
|
-
function
|
|
511
|
+
function xo(o) {
|
|
486
512
|
const { children: a, ...e } = o;
|
|
487
513
|
return { children: a, restProps: e };
|
|
488
514
|
}
|
|
489
|
-
function
|
|
515
|
+
function vo(o) {
|
|
490
516
|
return o == null ? null : typeof o == "string" ? o.length === 0 ? null : o : typeof o == "number" || typeof o == "bigint" ? `{${o.toString()}}` : typeof o == "boolean" ? null : `{${Q(o)}}`;
|
|
491
517
|
}
|
|
492
|
-
function
|
|
518
|
+
function wo(o, a) {
|
|
493
519
|
if (a === !0) return o;
|
|
494
520
|
if (a === !1) return `${o}={false}`;
|
|
495
521
|
if (a === null) return `${o}={null}`;
|
|
@@ -510,11 +536,11 @@ const X = {
|
|
|
510
536
|
mobile: 375,
|
|
511
537
|
tablet: 768,
|
|
512
538
|
desktop: "none"
|
|
513
|
-
},
|
|
539
|
+
}, No = {
|
|
514
540
|
mobile: "Mobile",
|
|
515
541
|
tablet: "Tablet",
|
|
516
542
|
desktop: "Desktop"
|
|
517
|
-
},
|
|
543
|
+
}, J = {
|
|
518
544
|
white: {
|
|
519
545
|
"--jogak-canvas-bg": "#ffffff",
|
|
520
546
|
"--jogak-canvas-bg-image": "none",
|
|
@@ -533,24 +559,24 @@ const X = {
|
|
|
533
559
|
"--jogak-canvas-bg-size": "16px 16px",
|
|
534
560
|
"--jogak-canvas-bg-position": "0 0, 0 8px, 8px -8px, -8px 0px"
|
|
535
561
|
}
|
|
536
|
-
},
|
|
537
|
-
function
|
|
562
|
+
}, D = "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)]";
|
|
563
|
+
function yo(o) {
|
|
538
564
|
return F[o] ?? F.vsDark;
|
|
539
565
|
}
|
|
540
|
-
function
|
|
566
|
+
function So({
|
|
541
567
|
entryId: o,
|
|
542
568
|
jogakName: a,
|
|
543
569
|
overrideArgs: e,
|
|
544
570
|
onArgChange: r,
|
|
545
571
|
onReset: s,
|
|
546
|
-
codeTheme:
|
|
547
|
-
onResolveJogak:
|
|
548
|
-
previewIsolation:
|
|
549
|
-
userPreviewUrl:
|
|
572
|
+
codeTheme: g,
|
|
573
|
+
onResolveJogak: n,
|
|
574
|
+
previewIsolation: k = "iframe",
|
|
575
|
+
userPreviewUrl: l = "",
|
|
550
576
|
previewEntryPath: d = "/__jogak_preview__/index.html"
|
|
551
577
|
}) {
|
|
552
|
-
const
|
|
553
|
-
return
|
|
578
|
+
const i = T(o), [c, p] = h("desktop"), [f, S] = h("white"), [y, v] = h("controls"), N = yo(g);
|
|
579
|
+
return i.status === "unknown" ? /* @__PURE__ */ j(
|
|
554
580
|
"div",
|
|
555
581
|
{
|
|
556
582
|
"data-testid": "preview-not-found",
|
|
@@ -560,7 +586,7 @@ function yo({
|
|
|
560
586
|
o
|
|
561
587
|
]
|
|
562
588
|
}
|
|
563
|
-
) :
|
|
589
|
+
) : i.status === "error" ? /* @__PURE__ */ j(
|
|
564
590
|
"div",
|
|
565
591
|
{
|
|
566
592
|
"data-testid": "preview-error",
|
|
@@ -570,13 +596,13 @@ function yo({
|
|
|
570
596
|
"Failed to load entry: ",
|
|
571
597
|
o
|
|
572
598
|
] }),
|
|
573
|
-
/* @__PURE__ */ t("pre", { className: "jogak:m-0 jogak:p-3 jogak:bg-[var(--jogak-color-bg)] jogak:border jogak:border-[var(--jogak-color-error-border)] jogak:rounded-[var(--jogak-radius-lg)] jogak:text-[12px] jogak:whitespace-pre-wrap jogak:max-w-full", children:
|
|
599
|
+
/* @__PURE__ */ t("pre", { className: "jogak:m-0 jogak:p-3 jogak:bg-[var(--jogak-color-bg)] jogak:border jogak:border-[var(--jogak-color-error-border)] jogak:rounded-[var(--jogak-radius-lg)] jogak:text-[12px] jogak:whitespace-pre-wrap jogak:max-w-full", children: i.error.message })
|
|
574
600
|
]
|
|
575
601
|
}
|
|
576
|
-
) :
|
|
577
|
-
|
|
602
|
+
) : i.status === "loading" ? /* @__PURE__ */ t(
|
|
603
|
+
Co,
|
|
578
604
|
{
|
|
579
|
-
meta:
|
|
605
|
+
meta: i.meta,
|
|
580
606
|
jogakName: a,
|
|
581
607
|
viewport: c,
|
|
582
608
|
bgMode: f,
|
|
@@ -584,36 +610,36 @@ function yo({
|
|
|
584
610
|
onBgModeChange: S
|
|
585
611
|
}
|
|
586
612
|
) : /* @__PURE__ */ t(
|
|
587
|
-
|
|
613
|
+
$o,
|
|
588
614
|
{
|
|
589
|
-
entry:
|
|
615
|
+
entry: i.entry,
|
|
590
616
|
jogakName: a,
|
|
591
617
|
overrideArgs: e,
|
|
592
618
|
onArgChange: r,
|
|
593
619
|
onReset: s,
|
|
594
|
-
onResolveJogak:
|
|
620
|
+
onResolveJogak: n,
|
|
595
621
|
viewport: c,
|
|
596
622
|
bgMode: f,
|
|
597
623
|
bottomTab: y,
|
|
598
624
|
onViewportChange: p,
|
|
599
625
|
onBgModeChange: S,
|
|
600
626
|
onBottomTabChange: v,
|
|
601
|
-
prismTheme:
|
|
602
|
-
previewIsolation:
|
|
603
|
-
userPreviewUrl:
|
|
627
|
+
prismTheme: N,
|
|
628
|
+
previewIsolation: k,
|
|
629
|
+
userPreviewUrl: l,
|
|
604
630
|
previewEntryPath: d
|
|
605
631
|
}
|
|
606
632
|
);
|
|
607
633
|
}
|
|
608
|
-
function
|
|
634
|
+
function Co({
|
|
609
635
|
meta: o,
|
|
610
636
|
jogakName: a,
|
|
611
637
|
viewport: e,
|
|
612
638
|
bgMode: r,
|
|
613
639
|
onViewportChange: s,
|
|
614
|
-
onBgModeChange:
|
|
640
|
+
onBgModeChange: g
|
|
615
641
|
}) {
|
|
616
|
-
const
|
|
642
|
+
const n = a ?? o.jogakNames[0] ?? "...", k = X[e];
|
|
617
643
|
return /* @__PURE__ */ j(
|
|
618
644
|
"div",
|
|
619
645
|
{
|
|
@@ -624,11 +650,11 @@ function So({
|
|
|
624
650
|
Y,
|
|
625
651
|
{
|
|
626
652
|
title: o.title,
|
|
627
|
-
jogakName:
|
|
653
|
+
jogakName: n,
|
|
628
654
|
viewport: e,
|
|
629
655
|
bgMode: r,
|
|
630
656
|
onViewportChange: s,
|
|
631
|
-
onBgModeChange:
|
|
657
|
+
onBgModeChange: g,
|
|
632
658
|
showReset: !1,
|
|
633
659
|
onReset: () => {
|
|
634
660
|
}
|
|
@@ -637,14 +663,14 @@ function So({
|
|
|
637
663
|
/* @__PURE__ */ t(
|
|
638
664
|
"div",
|
|
639
665
|
{
|
|
640
|
-
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${
|
|
641
|
-
style:
|
|
666
|
+
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${D}`,
|
|
667
|
+
style: J[r],
|
|
642
668
|
children: /* @__PURE__ */ t(
|
|
643
669
|
"div",
|
|
644
670
|
{
|
|
645
671
|
className: "jogak:mx-auto jogak:p-6 jogak:max-w-[var(--jogak-canvas-mw)]",
|
|
646
672
|
style: {
|
|
647
|
-
"--jogak-canvas-mw":
|
|
673
|
+
"--jogak-canvas-mw": k === "none" ? "100%" : `${k}px`
|
|
648
674
|
},
|
|
649
675
|
children: /* @__PURE__ */ j("div", { className: "jogak-skeleton-shimmer jogak:border jogak:border-dashed jogak:border-[var(--jogak-color-border)] jogak:rounded-[var(--jogak-radius-xl)] jogak:p-4 jogak:flex jogak:items-center jogak:justify-center jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px] jogak:min-h-[256px]", children: [
|
|
650
676
|
"Loading ",
|
|
@@ -659,53 +685,53 @@ function So({
|
|
|
659
685
|
}
|
|
660
686
|
);
|
|
661
687
|
}
|
|
662
|
-
function
|
|
688
|
+
function $o({
|
|
663
689
|
entry: o,
|
|
664
690
|
jogakName: a,
|
|
665
691
|
overrideArgs: e,
|
|
666
692
|
onArgChange: r,
|
|
667
693
|
onReset: s,
|
|
668
|
-
onResolveJogak:
|
|
669
|
-
viewport:
|
|
670
|
-
bgMode:
|
|
671
|
-
bottomTab:
|
|
694
|
+
onResolveJogak: g,
|
|
695
|
+
viewport: n,
|
|
696
|
+
bgMode: k,
|
|
697
|
+
bottomTab: l,
|
|
672
698
|
onViewportChange: d,
|
|
673
|
-
onBgModeChange:
|
|
699
|
+
onBgModeChange: i,
|
|
674
700
|
onBottomTabChange: c,
|
|
675
701
|
prismTheme: p,
|
|
676
702
|
previewIsolation: f,
|
|
677
703
|
userPreviewUrl: S,
|
|
678
704
|
previewEntryPath: y
|
|
679
705
|
}) {
|
|
680
|
-
var
|
|
681
|
-
const v = a ?? ((
|
|
706
|
+
var W;
|
|
707
|
+
const v = a ?? ((W = o.jogaks[0]) == null ? void 0 : W.name) ?? null;
|
|
682
708
|
if (x(() => {
|
|
683
|
-
a === null && v !== null &&
|
|
684
|
-
}, [a, v, o.id,
|
|
709
|
+
a === null && v !== null && g !== void 0 && g(o.id, v);
|
|
710
|
+
}, [a, v, o.id, g]), v === null)
|
|
685
711
|
return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
|
|
686
712
|
"Entry has no jogaks: ",
|
|
687
713
|
o.id
|
|
688
714
|
] });
|
|
689
|
-
const
|
|
690
|
-
if (
|
|
715
|
+
const N = o.jogaks.find((C) => C.name === v);
|
|
716
|
+
if (N === void 0)
|
|
691
717
|
return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
|
|
692
718
|
"Jogak not found: ",
|
|
693
719
|
v
|
|
694
720
|
] });
|
|
695
|
-
const R = { ...
|
|
721
|
+
const R = { ...N.args ?? {}, ...e }, u = {
|
|
696
722
|
...o.meta.argTypes ?? {},
|
|
697
|
-
...
|
|
698
|
-
}, m = Object.keys(e).length > 0, b = X[
|
|
723
|
+
...N.argTypes ?? {}
|
|
724
|
+
}, m = Object.keys(e).length > 0, b = X[n];
|
|
699
725
|
return /* @__PURE__ */ j("div", { className: "jogak:flex jogak:flex-col jogak:h-full", children: [
|
|
700
726
|
/* @__PURE__ */ t(
|
|
701
727
|
Y,
|
|
702
728
|
{
|
|
703
729
|
title: o.title,
|
|
704
|
-
jogakName:
|
|
705
|
-
viewport:
|
|
706
|
-
bgMode:
|
|
730
|
+
jogakName: N.name,
|
|
731
|
+
viewport: n,
|
|
732
|
+
bgMode: k,
|
|
707
733
|
onViewportChange: d,
|
|
708
|
-
onBgModeChange:
|
|
734
|
+
onBgModeChange: i,
|
|
709
735
|
showReset: m,
|
|
710
736
|
onReset: s
|
|
711
737
|
}
|
|
@@ -713,8 +739,8 @@ function Co({
|
|
|
713
739
|
/* @__PURE__ */ t(
|
|
714
740
|
"div",
|
|
715
741
|
{
|
|
716
|
-
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${
|
|
717
|
-
style:
|
|
742
|
+
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${D}`,
|
|
743
|
+
style: J[k],
|
|
718
744
|
children: /* @__PURE__ */ t(
|
|
719
745
|
"div",
|
|
720
746
|
{
|
|
@@ -724,7 +750,7 @@ function Co({
|
|
|
724
750
|
"--jogak-canvas-mw": b === "none" ? "100%" : `${b}px`
|
|
725
751
|
},
|
|
726
752
|
children: /* @__PURE__ */ t(
|
|
727
|
-
|
|
753
|
+
_o,
|
|
728
754
|
{
|
|
729
755
|
entry: o,
|
|
730
756
|
args: R,
|
|
@@ -733,7 +759,7 @@ function Co({
|
|
|
733
759
|
userPreviewUrl: S,
|
|
734
760
|
previewEntryPath: y
|
|
735
761
|
},
|
|
736
|
-
`${o.id}/${
|
|
762
|
+
`${o.id}/${N.name}`
|
|
737
763
|
)
|
|
738
764
|
}
|
|
739
765
|
)
|
|
@@ -751,19 +777,19 @@ function Co({
|
|
|
751
777
|
role: "tablist",
|
|
752
778
|
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
779
|
children: ["controls", "actions"].map((C) => {
|
|
754
|
-
const
|
|
780
|
+
const z = l === C;
|
|
755
781
|
return /* @__PURE__ */ t(
|
|
756
782
|
"button",
|
|
757
783
|
{
|
|
758
784
|
type: "button",
|
|
759
785
|
role: "tab",
|
|
760
|
-
"aria-selected":
|
|
786
|
+
"aria-selected": z,
|
|
761
787
|
onClick: () => {
|
|
762
788
|
c(C);
|
|
763
789
|
},
|
|
764
|
-
className:
|
|
790
|
+
className: w(
|
|
765
791
|
"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
|
-
|
|
792
|
+
z ? "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
793
|
),
|
|
768
794
|
children: C
|
|
769
795
|
},
|
|
@@ -772,14 +798,14 @@ function Co({
|
|
|
772
798
|
})
|
|
773
799
|
}
|
|
774
800
|
),
|
|
775
|
-
/* @__PURE__ */ t("div", { className: "jogak:flex-1 jogak:min-h-0 jogak:overflow-auto", children:
|
|
801
|
+
/* @__PURE__ */ t("div", { className: "jogak:flex-1 jogak:min-h-0 jogak:overflow-auto", children: l === "controls" ? /* @__PURE__ */ t(
|
|
776
802
|
io,
|
|
777
803
|
{
|
|
778
804
|
args: R,
|
|
779
805
|
argTypes: u,
|
|
780
806
|
onArgChange: r
|
|
781
807
|
}
|
|
782
|
-
) : /* @__PURE__ */ t(
|
|
808
|
+
) : /* @__PURE__ */ t(uo, {}) })
|
|
783
809
|
]
|
|
784
810
|
}
|
|
785
811
|
)
|
|
@@ -791,9 +817,9 @@ function Y({
|
|
|
791
817
|
viewport: e,
|
|
792
818
|
bgMode: r,
|
|
793
819
|
onViewportChange: s,
|
|
794
|
-
onBgModeChange:
|
|
795
|
-
showReset:
|
|
796
|
-
onReset:
|
|
820
|
+
onBgModeChange: g,
|
|
821
|
+
showReset: n,
|
|
822
|
+
onReset: k
|
|
797
823
|
}) {
|
|
798
824
|
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
825
|
/* @__PURE__ */ j("div", { className: "jogak:flex-1 jogak:text-[13px]", children: [
|
|
@@ -801,61 +827,61 @@ function Y({
|
|
|
801
827
|
/* @__PURE__ */ t("span", { className: "jogak:text-[var(--jogak-color-border-strong)] jogak:mx-1.5 jogak:leading-none", children: "/" }),
|
|
802
828
|
/* @__PURE__ */ t("span", { className: "jogak:text-[var(--jogak-color-fg-strong)] jogak:font-semibold", children: a })
|
|
803
829
|
] }),
|
|
804
|
-
/* @__PURE__ */ t("div", { className: "jogak:flex jogak:gap-0.5 jogak:bg-[var(--jogak-color-bg-subtle)] jogak:rounded-[var(--jogak-radius-lg)] jogak:p-0.5", children: ["mobile", "tablet", "desktop"].map((
|
|
830
|
+
/* @__PURE__ */ t("div", { className: "jogak:flex jogak:gap-0.5 jogak:bg-[var(--jogak-color-bg-subtle)] jogak:rounded-[var(--jogak-radius-lg)] jogak:p-0.5", children: ["mobile", "tablet", "desktop"].map((l) => /* @__PURE__ */ t(
|
|
805
831
|
"button",
|
|
806
832
|
{
|
|
807
833
|
type: "button",
|
|
808
834
|
onClick: () => {
|
|
809
|
-
s(
|
|
835
|
+
s(l);
|
|
810
836
|
},
|
|
811
|
-
"aria-pressed": e ===
|
|
812
|
-
className:
|
|
837
|
+
"aria-pressed": e === l,
|
|
838
|
+
className: w(
|
|
813
839
|
"jogak:px-[9px] jogak:py-[3px] jogak:text-[12px] jogak:border-none jogak:rounded-[var(--jogak-radius-md)] jogak:cursor-pointer jogak:transition-all jogak:duration-100",
|
|
814
|
-
e ===
|
|
840
|
+
e === 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
841
|
),
|
|
816
|
-
children:
|
|
842
|
+
children: No[l]
|
|
817
843
|
},
|
|
818
|
-
|
|
844
|
+
l
|
|
819
845
|
)) }),
|
|
820
|
-
/* @__PURE__ */ t("div", { className: "jogak:flex jogak:gap-1 jogak:items-center", children: ["white", "dark", "transparent"].map((
|
|
846
|
+
/* @__PURE__ */ t("div", { className: "jogak:flex jogak:gap-1 jogak:items-center", children: ["white", "dark", "transparent"].map((l) => /* @__PURE__ */ t(
|
|
821
847
|
"button",
|
|
822
848
|
{
|
|
823
849
|
type: "button",
|
|
824
850
|
onClick: () => {
|
|
825
|
-
|
|
851
|
+
g(l);
|
|
826
852
|
},
|
|
827
|
-
"aria-pressed": r ===
|
|
828
|
-
"aria-label": `${
|
|
829
|
-
className:
|
|
853
|
+
"aria-pressed": r === l,
|
|
854
|
+
"aria-label": `${l} background`,
|
|
855
|
+
className: w(
|
|
830
856
|
"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
|
-
r ===
|
|
857
|
+
D,
|
|
858
|
+
r === l ? "jogak:border-[var(--jogak-color-accent)]" : "jogak:border-[var(--jogak-color-border-strong)]"
|
|
833
859
|
),
|
|
834
|
-
style:
|
|
860
|
+
style: J[l]
|
|
835
861
|
},
|
|
836
|
-
|
|
862
|
+
l
|
|
837
863
|
)) }),
|
|
838
|
-
|
|
864
|
+
n && /* @__PURE__ */ t(
|
|
839
865
|
"button",
|
|
840
866
|
{
|
|
841
867
|
type: "button",
|
|
842
|
-
onClick:
|
|
868
|
+
onClick: k,
|
|
843
869
|
className: "jogak:px-[10px] jogak:py-[3px] jogak:text-[12px] jogak:border jogak:border-[var(--jogak-color-border-strong)] jogak:rounded-[var(--jogak-radius-md)] jogak:bg-[var(--jogak-color-bg)] jogak:cursor-pointer jogak:text-[var(--jogak-color-fg)] jogak:leading-none",
|
|
844
870
|
children: "Reset"
|
|
845
871
|
}
|
|
846
872
|
)
|
|
847
873
|
] });
|
|
848
874
|
}
|
|
849
|
-
function
|
|
850
|
-
const [
|
|
875
|
+
function _o({ entry: o, args: a, theme: e, previewIsolation: r, userPreviewUrl: s, previewEntryPath: g }) {
|
|
876
|
+
const [n, k] = h(!1), l = bo(o, a), d = /* @__PURE__ */ j("div", { className: "jogak:relative", children: [
|
|
851
877
|
/* @__PURE__ */ t(
|
|
852
|
-
|
|
878
|
+
Ro,
|
|
853
879
|
{
|
|
854
880
|
entry: o,
|
|
855
881
|
args: a,
|
|
856
882
|
previewIsolation: r,
|
|
857
883
|
userPreviewUrl: s,
|
|
858
|
-
previewEntryPath:
|
|
884
|
+
previewEntryPath: g
|
|
859
885
|
}
|
|
860
886
|
),
|
|
861
887
|
/* @__PURE__ */ t(
|
|
@@ -863,16 +889,16 @@ function $o({ entry: o, args: a, theme: e, previewIsolation: r, userPreviewUrl:
|
|
|
863
889
|
{
|
|
864
890
|
type: "button",
|
|
865
891
|
onClick: () => {
|
|
866
|
-
|
|
892
|
+
k((i) => !i);
|
|
867
893
|
},
|
|
868
|
-
"aria-pressed":
|
|
869
|
-
"aria-label":
|
|
870
|
-
className:
|
|
894
|
+
"aria-pressed": n,
|
|
895
|
+
"aria-label": n ? "Hide source code" : "Show source code",
|
|
896
|
+
className: w(
|
|
871
897
|
"jogak:absolute jogak:bottom-2 jogak:right-2 jogak:px-[9px] jogak:py-1",
|
|
872
898
|
"jogak:text-[11px] jogak:font-[family-name:var(--jogak-font-mono)] jogak:font-semibold jogak:tracking-[0.02em]",
|
|
873
899
|
"jogak:text-[var(--jogak-color-bg)] jogak:border-none jogak:rounded-[5px] jogak:cursor-pointer",
|
|
874
900
|
"jogak:shadow-[0_1px_4px_rgba(0,0,0,0.2)] jogak:transition-[background-color] jogak:duration-150 jogak:leading-none",
|
|
875
|
-
|
|
901
|
+
n ? "jogak:bg-[var(--jogak-color-accent)]" : "jogak:bg-[#1e293b]"
|
|
876
902
|
),
|
|
877
903
|
children: "</>"
|
|
878
904
|
}
|
|
@@ -880,32 +906,32 @@ function $o({ entry: o, args: a, theme: e, previewIsolation: r, userPreviewUrl:
|
|
|
880
906
|
] });
|
|
881
907
|
return /* @__PURE__ */ j("div", { children: [
|
|
882
908
|
d,
|
|
883
|
-
|
|
909
|
+
n && /* @__PURE__ */ t("div", { className: "jogak:mt-2 jogak:rounded-[var(--jogak-radius-xl)] jogak:overflow-hidden jogak:h-[320px] jogak:shadow-[0_0_0_1px_rgba(0,0,0,0.08),_0_4px_16px_rgba(0,0,0,0.12)]", children: /* @__PURE__ */ t(Oo, { source: l, theme: e }) })
|
|
884
910
|
] });
|
|
885
911
|
}
|
|
886
|
-
const
|
|
887
|
-
function
|
|
912
|
+
const V = "jogak:border jogak:border-dashed jogak:border-[var(--jogak-color-border)] jogak:rounded-[var(--jogak-radius-xl)] jogak:p-4 jogak:pb-9";
|
|
913
|
+
function Ro({ entry: o, args: a, previewIsolation: e, userPreviewUrl: r, previewEntryPath: s }) {
|
|
888
914
|
return e === "shadow" ? /* @__PURE__ */ t(
|
|
889
|
-
|
|
915
|
+
po,
|
|
890
916
|
{
|
|
891
917
|
"data-testid": "preview-content",
|
|
892
|
-
className:
|
|
893
|
-
children: /* @__PURE__ */ t(
|
|
918
|
+
className: V,
|
|
919
|
+
children: /* @__PURE__ */ t(Lo, { entry: o, args: a })
|
|
894
920
|
}
|
|
895
921
|
) : e === "iframe" ? /* @__PURE__ */ t(
|
|
896
|
-
|
|
922
|
+
fo,
|
|
897
923
|
{
|
|
898
924
|
entry: o,
|
|
899
925
|
args: a,
|
|
900
926
|
userPreviewUrl: r,
|
|
901
927
|
previewEntryPath: s,
|
|
902
928
|
"data-testid": "preview-content",
|
|
903
|
-
className: `${
|
|
929
|
+
className: `${V} jogak:block jogak:w-full jogak:bg-transparent jogak:min-h-[256px]`
|
|
904
930
|
}
|
|
905
|
-
) : /* @__PURE__ */ t(
|
|
931
|
+
) : /* @__PURE__ */ t(Ao, { entry: o, args: a });
|
|
906
932
|
}
|
|
907
|
-
function
|
|
908
|
-
const e =
|
|
933
|
+
function Ao({ entry: o, args: a }) {
|
|
934
|
+
const e = E(null);
|
|
909
935
|
return x(() => {
|
|
910
936
|
const r = e.current;
|
|
911
937
|
if (r !== null)
|
|
@@ -922,12 +948,12 @@ function Ro({ entry: o, args: a }) {
|
|
|
922
948
|
{
|
|
923
949
|
ref: e,
|
|
924
950
|
"data-testid": "preview-content",
|
|
925
|
-
className:
|
|
951
|
+
className: V
|
|
926
952
|
}
|
|
927
953
|
);
|
|
928
954
|
}
|
|
929
|
-
function
|
|
930
|
-
const e =
|
|
955
|
+
function Lo({ entry: o, args: a }) {
|
|
956
|
+
const e = E(null);
|
|
931
957
|
return x(() => {
|
|
932
958
|
const r = e.current;
|
|
933
959
|
if (r !== null)
|
|
@@ -941,7 +967,7 @@ function Ao({ entry: o, args: a }) {
|
|
|
941
967
|
r !== null && $.render(o, a, r);
|
|
942
968
|
}, [o, a]), /* @__PURE__ */ t("div", { ref: e, "data-testid": "preview-content-shadow" });
|
|
943
969
|
}
|
|
944
|
-
function
|
|
970
|
+
function Oo({ source: o, theme: a }) {
|
|
945
971
|
const [e, r] = h(!1), s = a.plain.backgroundColor ?? "#1e293b";
|
|
946
972
|
return o === void 0 ? /* @__PURE__ */ t(
|
|
947
973
|
"div",
|
|
@@ -966,20 +992,20 @@ function Lo({ source: o, theme: a }) {
|
|
|
966
992
|
children: e ? "✓ Copied" : "Copy"
|
|
967
993
|
}
|
|
968
994
|
),
|
|
969
|
-
/* @__PURE__ */ t(eo, { code: o.trim(), language: "tsx", theme: a, children: ({ style:
|
|
995
|
+
/* @__PURE__ */ t(eo, { code: o.trim(), language: "tsx", theme: a, children: ({ style: n, tokens: k, getLineProps: l, getTokenProps: d }) => /* @__PURE__ */ t(
|
|
970
996
|
"pre",
|
|
971
997
|
{
|
|
972
998
|
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:
|
|
999
|
+
style: n,
|
|
1000
|
+
children: k.map((i, c) => /* @__PURE__ */ j(
|
|
975
1001
|
"div",
|
|
976
1002
|
{
|
|
977
|
-
...
|
|
1003
|
+
...l({ line: i }),
|
|
978
1004
|
className: "jogak:flex jogak:pr-6",
|
|
979
|
-
style:
|
|
1005
|
+
style: l({ line: i }).style,
|
|
980
1006
|
children: [
|
|
981
1007
|
/* @__PURE__ */ t("span", { className: "jogak:select-none jogak:min-w-10 jogak:pl-[14px] jogak:pr-[14px] jogak:text-right jogak:text-[rgba(148,163,184,0.45)] jogak:shrink-0 jogak:leading-[1.7]", children: c + 1 }),
|
|
982
|
-
/* @__PURE__ */ t("span", { children:
|
|
1008
|
+
/* @__PURE__ */ t("span", { children: i.map((p, f) => /* @__PURE__ */ t("span", { ...d({ token: p }) }, f)) })
|
|
983
1009
|
]
|
|
984
1010
|
},
|
|
985
1011
|
c
|
|
@@ -1005,10 +1031,10 @@ function Wo({
|
|
|
1005
1031
|
codeTheme: e = "vsDark",
|
|
1006
1032
|
previewIsolation: r = "iframe",
|
|
1007
1033
|
userPreviewUrl: s = "",
|
|
1008
|
-
previewEntryPath:
|
|
1009
|
-
userViteUrl:
|
|
1034
|
+
previewEntryPath: g = "/__jogak_preview__/index.html",
|
|
1035
|
+
userViteUrl: n
|
|
1010
1036
|
} = {}) {
|
|
1011
|
-
const
|
|
1037
|
+
const k = s !== "" ? s : n ?? "", l = _(() => {
|
|
1012
1038
|
if (o !== void 0) {
|
|
1013
1039
|
a !== void 0 && console.warn(
|
|
1014
1040
|
"[jogak] JogakApp received both `entries` and `metas` — `entries` (eager) takes precedence."
|
|
@@ -1020,7 +1046,7 @@ function Wo({
|
|
|
1020
1046
|
if (a !== void 0)
|
|
1021
1047
|
for (const u of a) H.registerMeta(u);
|
|
1022
1048
|
return H;
|
|
1023
|
-
}, [o, a]), d = _(() => I(), []), [
|
|
1049
|
+
}, [o, a]), d = _(() => I(), []), [i, c] = h(
|
|
1024
1050
|
(d == null ? void 0 : d.entryId) ?? null
|
|
1025
1051
|
), [p, f] = h(
|
|
1026
1052
|
(d == null ? void 0 : d.jogakName) ?? null
|
|
@@ -1036,17 +1062,17 @@ function Wo({
|
|
|
1036
1062
|
}, []);
|
|
1037
1063
|
const v = A((u, m) => {
|
|
1038
1064
|
c(u), f(m), y({}), Eo(u, m);
|
|
1039
|
-
}, []),
|
|
1065
|
+
}, []), N = A((u, m) => {
|
|
1040
1066
|
if (c((b) => b === u ? u : b), f((b) => b ?? m), typeof window < "u") {
|
|
1041
1067
|
const b = new URLSearchParams(window.location.search);
|
|
1042
1068
|
b.get("entry") === u && b.get("jogak") === null && (b.set("jogak", m), window.history.replaceState({}, "", `?${b.toString()}`));
|
|
1043
1069
|
}
|
|
1044
|
-
}, []),
|
|
1070
|
+
}, []), B = A((u, m) => {
|
|
1045
1071
|
y((b) => ({ ...b, [u]: m }));
|
|
1046
1072
|
}, []), R = A(() => {
|
|
1047
1073
|
y({});
|
|
1048
1074
|
}, []);
|
|
1049
|
-
return /* @__PURE__ */ t(oo, { registry:
|
|
1075
|
+
return /* @__PURE__ */ t(oo, { registry: l, children: /* @__PURE__ */ j(
|
|
1050
1076
|
"div",
|
|
1051
1077
|
{
|
|
1052
1078
|
"data-jogak-shell": !0,
|
|
@@ -1055,24 +1081,24 @@ function Wo({
|
|
|
1055
1081
|
/* @__PURE__ */ t(
|
|
1056
1082
|
ro,
|
|
1057
1083
|
{
|
|
1058
|
-
selectedEntryId:
|
|
1084
|
+
selectedEntryId: i,
|
|
1059
1085
|
selectedJogakName: p,
|
|
1060
1086
|
onSelect: v
|
|
1061
1087
|
}
|
|
1062
1088
|
),
|
|
1063
|
-
/* @__PURE__ */ t("main", { className: "jogak:overflow-hidden jogak:min-h-0", children:
|
|
1064
|
-
|
|
1089
|
+
/* @__PURE__ */ t("main", { className: "jogak:overflow-hidden jogak:min-h-0", children: i !== null ? /* @__PURE__ */ t(
|
|
1090
|
+
So,
|
|
1065
1091
|
{
|
|
1066
|
-
entryId:
|
|
1092
|
+
entryId: i,
|
|
1067
1093
|
jogakName: p,
|
|
1068
1094
|
overrideArgs: S,
|
|
1069
|
-
onArgChange:
|
|
1095
|
+
onArgChange: B,
|
|
1070
1096
|
onReset: R,
|
|
1071
1097
|
codeTheme: e,
|
|
1072
|
-
onResolveJogak:
|
|
1098
|
+
onResolveJogak: N,
|
|
1073
1099
|
previewIsolation: r,
|
|
1074
|
-
userPreviewUrl:
|
|
1075
|
-
previewEntryPath:
|
|
1100
|
+
userPreviewUrl: k,
|
|
1101
|
+
previewEntryPath: g
|
|
1076
1102
|
}
|
|
1077
1103
|
) : /* @__PURE__ */ t("div", { className: "jogak:flex jogak:items-center jogak:justify-center jogak:h-full jogak:text-[var(--jogak-color-fg-subtle)]", children: "Select a component from the sidebar" }) })
|
|
1078
1104
|
]
|
|
@@ -1087,10 +1113,10 @@ function zo() {
|
|
|
1087
1113
|
return { entries: a, tree: e, search: r };
|
|
1088
1114
|
}
|
|
1089
1115
|
export {
|
|
1090
|
-
|
|
1116
|
+
uo as Actions,
|
|
1091
1117
|
io as Controls,
|
|
1092
1118
|
Wo as JogakApp,
|
|
1093
|
-
|
|
1119
|
+
So as Preview,
|
|
1094
1120
|
ro as Sidebar,
|
|
1095
1121
|
zo as useRegistry
|
|
1096
1122
|
};
|