@jogak/ui 0.1.0-alpha.8 → 0.1.0-alpha.9
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 +13 -137
- package/dist/app/App.d.ts +10 -2
- package/dist/components/Preview/IframeMount.d.ts +8 -3
- package/dist/components/Preview/index.d.ts +7 -3
- package/dist/host/index.cjs +1 -0
- package/dist/host/index.d.ts +12 -3
- package/dist/host/index.mjs +18 -18
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +354 -344
- package/package.json +6 -6
- package/src/app/App.tsx +16 -3
- package/src/app/main.tsx +6 -7
- package/src/app/preview-frame.tsx +45 -30
- package/src/components/Preview/IframeMount.tsx +11 -5
- package/src/components/Preview/index.tsx +28 -17
- package/src/vite-env.d.ts +11 -1
- package/dist/host/index.js +0 -1
- package/dist/index.js +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { jsxs as j, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { defaultActionChannel as
|
|
4
|
-
import { useRegistryMeta as
|
|
5
|
-
import { themes as
|
|
6
|
-
import { createPortal as
|
|
7
|
-
function
|
|
2
|
+
import { useState as b, useEffect as h, useRef as E, useMemo as R, useCallback as $ } from "react";
|
|
3
|
+
import { defaultActionChannel as L, ComponentRegistry as Y, defaultRegistry as F } from "@jogak/core";
|
|
4
|
+
import { useRegistryMeta as Z, useEntry as K, reactAdapter as _, JogakProvider as T, useRegistry as oo } from "@jogak/react";
|
|
5
|
+
import { themes as H, Highlight as ao } from "prism-react-renderer";
|
|
6
|
+
import { createPortal as eo } from "react-dom";
|
|
7
|
+
function q(o) {
|
|
8
8
|
var a, r, t = "";
|
|
9
9
|
if (typeof o == "string" || typeof o == "number") t += o;
|
|
10
10
|
else if (typeof o == "object") if (Array.isArray(o)) {
|
|
11
|
-
var
|
|
12
|
-
for (a = 0; a <
|
|
11
|
+
var g = o.length;
|
|
12
|
+
for (a = 0; a < g; a++) o[a] && (r = q(o[a])) && (t && (t += " "), t += r);
|
|
13
13
|
} else for (r in o) o[r] && (t && (t += " "), t += r);
|
|
14
14
|
return t;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
for (var o, a, r = 0, t = "",
|
|
16
|
+
function N() {
|
|
17
|
+
for (var o, a, r = 0, t = "", g = arguments.length; r < g; r++) (o = arguments[r]) && (a = q(o)) && (t && (t += " "), t += a);
|
|
18
18
|
return t;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function ro({
|
|
21
21
|
selectedEntryId: o,
|
|
22
22
|
selectedJogakName: a,
|
|
23
23
|
onSelect: r
|
|
24
24
|
}) {
|
|
25
|
-
const [t,
|
|
25
|
+
const [t, g] = b(""), { metaTree: n, searchMeta: s } = Z(), l = t.trim().length > 0 ? s(t) : null;
|
|
26
26
|
return /* @__PURE__ */ j(
|
|
27
27
|
"aside",
|
|
28
28
|
{
|
|
@@ -35,15 +35,15 @@ function eo({
|
|
|
35
35
|
type: "search",
|
|
36
36
|
placeholder: "Search components...",
|
|
37
37
|
value: t,
|
|
38
|
-
onChange: (
|
|
39
|
-
|
|
38
|
+
onChange: (i) => {
|
|
39
|
+
g(i.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
45
|
/* @__PURE__ */ e("nav", { className: "jogak:flex-1 jogak:overflow-auto jogak:py-2", children: l !== null ? /* @__PURE__ */ e(
|
|
46
|
-
|
|
46
|
+
to,
|
|
47
47
|
{
|
|
48
48
|
metas: l,
|
|
49
49
|
selectedEntryId: o,
|
|
@@ -51,7 +51,7 @@ function eo({
|
|
|
51
51
|
onSelect: r
|
|
52
52
|
}
|
|
53
53
|
) : /* @__PURE__ */ e(
|
|
54
|
-
|
|
54
|
+
G,
|
|
55
55
|
{
|
|
56
56
|
node: n,
|
|
57
57
|
selectedEntryId: o,
|
|
@@ -63,107 +63,107 @@ function eo({
|
|
|
63
63
|
}
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function to({
|
|
67
67
|
metas: o,
|
|
68
68
|
selectedEntryId: a,
|
|
69
69
|
selectedJogakName: r,
|
|
70
70
|
onSelect: t
|
|
71
71
|
}) {
|
|
72
|
-
return o.length === 0 ? /* @__PURE__ */ e("p", { className: "jogak:px-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px]", children: "No results" }) : /* @__PURE__ */ e("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0", children: o.map((
|
|
73
|
-
|
|
72
|
+
return o.length === 0 ? /* @__PURE__ */ e("p", { className: "jogak:px-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px]", children: "No results" }) : /* @__PURE__ */ e("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0", children: o.map((g) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
73
|
+
I,
|
|
74
74
|
{
|
|
75
|
-
meta:
|
|
75
|
+
meta: g,
|
|
76
76
|
selectedEntryId: a,
|
|
77
77
|
selectedJogakName: r,
|
|
78
78
|
onSelect: t,
|
|
79
79
|
indent: 0
|
|
80
80
|
}
|
|
81
|
-
) },
|
|
81
|
+
) }, g.id)) });
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function G({
|
|
84
84
|
node: o,
|
|
85
85
|
selectedEntryId: a,
|
|
86
86
|
selectedJogakName: r,
|
|
87
87
|
onSelect: t,
|
|
88
|
-
depth:
|
|
88
|
+
depth: g = 0
|
|
89
89
|
}) {
|
|
90
90
|
return /* @__PURE__ */ e(
|
|
91
91
|
"ul",
|
|
92
92
|
{
|
|
93
93
|
className: "jogak:list-none jogak:m-0 jogak:pr-0 jogak:py-0 jogak:pl-[var(--jogak-tree-pl)]",
|
|
94
|
-
style: { "--jogak-tree-pl": `${
|
|
95
|
-
children: Object.entries(o).map(([n,
|
|
96
|
-
|
|
94
|
+
style: { "--jogak-tree-pl": `${g * 12}px` },
|
|
95
|
+
children: Object.entries(o).map(([n, s]) => /* @__PURE__ */ e("li", { children: "id" in s ? /* @__PURE__ */ e(
|
|
96
|
+
I,
|
|
97
97
|
{
|
|
98
|
-
meta:
|
|
98
|
+
meta: s,
|
|
99
99
|
selectedEntryId: a,
|
|
100
100
|
selectedJogakName: r,
|
|
101
101
|
onSelect: t,
|
|
102
102
|
indent: 0
|
|
103
103
|
}
|
|
104
104
|
) : /* @__PURE__ */ e(
|
|
105
|
-
|
|
105
|
+
no,
|
|
106
106
|
{
|
|
107
107
|
label: n,
|
|
108
|
-
node:
|
|
108
|
+
node: s,
|
|
109
109
|
selectedEntryId: a,
|
|
110
110
|
selectedJogakName: r,
|
|
111
111
|
onSelect: t,
|
|
112
|
-
depth:
|
|
112
|
+
depth: g + 1
|
|
113
113
|
}
|
|
114
114
|
) }, n))
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function no({
|
|
119
119
|
label: o,
|
|
120
120
|
node: a,
|
|
121
121
|
selectedEntryId: r,
|
|
122
122
|
selectedJogakName: t,
|
|
123
|
-
onSelect:
|
|
123
|
+
onSelect: g,
|
|
124
124
|
depth: n
|
|
125
125
|
}) {
|
|
126
|
-
const [
|
|
126
|
+
const [s, l] = b(!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
|
-
l((
|
|
133
|
+
l((i) => !i);
|
|
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": s,
|
|
137
137
|
children: [
|
|
138
|
-
/* @__PURE__ */ e("span", { children:
|
|
138
|
+
/* @__PURE__ */ e("span", { children: s ? "▾" : "▸" }),
|
|
139
139
|
o
|
|
140
140
|
]
|
|
141
141
|
}
|
|
142
142
|
),
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
s && /* @__PURE__ */ e(
|
|
144
|
+
G,
|
|
145
145
|
{
|
|
146
146
|
node: a,
|
|
147
147
|
selectedEntryId: r,
|
|
148
148
|
selectedJogakName: t,
|
|
149
|
-
onSelect:
|
|
149
|
+
onSelect: g,
|
|
150
150
|
depth: n
|
|
151
151
|
}
|
|
152
152
|
)
|
|
153
153
|
] });
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function I({
|
|
156
156
|
meta: o,
|
|
157
157
|
selectedEntryId: a,
|
|
158
158
|
selectedJogakName: r,
|
|
159
159
|
onSelect: t,
|
|
160
|
-
indent:
|
|
160
|
+
indent: g
|
|
161
161
|
}) {
|
|
162
|
-
const n = o.id === a, [
|
|
163
|
-
|
|
162
|
+
const n = o.id === a, [s, l] = b(n);
|
|
163
|
+
h(() => {
|
|
164
164
|
n && l(!0);
|
|
165
165
|
}, [n]);
|
|
166
|
-
const
|
|
166
|
+
const i = o.title.split("/").pop() ?? o.title, d = 16 + g * 12;
|
|
167
167
|
return /* @__PURE__ */ j("div", { children: [
|
|
168
168
|
/* @__PURE__ */ j(
|
|
169
169
|
"button",
|
|
@@ -171,57 +171,57 @@ function G({
|
|
|
171
171
|
type: "button",
|
|
172
172
|
onClick: () => {
|
|
173
173
|
if (n)
|
|
174
|
-
l((
|
|
174
|
+
l((k) => !k);
|
|
175
175
|
else {
|
|
176
176
|
l(!0);
|
|
177
|
-
const
|
|
178
|
-
|
|
177
|
+
const k = o.jogakNames[0];
|
|
178
|
+
k !== void 0 && t(o.id, k);
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
|
-
className:
|
|
181
|
+
className: N(
|
|
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
|
n ? "jogak:bg-[var(--jogak-color-accent-bg)] jogak:text-[var(--jogak-color-accent)] jogak:font-medium" : "jogak:bg-transparent jogak:text-[var(--jogak-color-fg)] jogak:font-normal"
|
|
186
186
|
),
|
|
187
|
-
style: { "--jogak-entry-pl": `${
|
|
188
|
-
"aria-expanded":
|
|
187
|
+
style: { "--jogak-entry-pl": `${d}px` },
|
|
188
|
+
"aria-expanded": s,
|
|
189
189
|
children: [
|
|
190
|
-
/* @__PURE__ */ e("span", { className: "jogak:text-[10px] jogak:shrink-0 jogak:leading-none", children:
|
|
191
|
-
|
|
190
|
+
/* @__PURE__ */ e("span", { className: "jogak:text-[10px] jogak:shrink-0 jogak:leading-none", children: s ? "▾" : "▸" }),
|
|
191
|
+
i
|
|
192
192
|
]
|
|
193
193
|
}
|
|
194
194
|
),
|
|
195
|
-
|
|
196
|
-
const
|
|
195
|
+
s && /* @__PURE__ */ e("ul", { className: "jogak:list-none jogak:m-0 jogak:p-0", children: o.jogakNames.map((k) => {
|
|
196
|
+
const c = n && k === r;
|
|
197
197
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
198
198
|
"button",
|
|
199
199
|
{
|
|
200
200
|
type: "button",
|
|
201
201
|
onClick: () => {
|
|
202
|
-
t(o.id,
|
|
202
|
+
t(o.id, k);
|
|
203
203
|
},
|
|
204
|
-
className:
|
|
204
|
+
className: N(
|
|
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
|
+
c ? "jogak:bg-[var(--jogak-color-accent-bg-soft)] jogak:text-[var(--jogak-color-accent-fg)] jogak:font-medium" : "jogak:bg-transparent jogak:text-[var(--jogak-color-fg-muted)] jogak:font-normal"
|
|
209
209
|
),
|
|
210
|
-
style: { "--jogak-jogak-pl": `${
|
|
211
|
-
"aria-current":
|
|
212
|
-
children:
|
|
210
|
+
style: { "--jogak-jogak-pl": `${d + 18}px` },
|
|
211
|
+
"aria-current": c ? "true" : void 0,
|
|
212
|
+
children: k
|
|
213
213
|
}
|
|
214
|
-
) },
|
|
214
|
+
) }, k);
|
|
215
215
|
}) })
|
|
216
216
|
] });
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
const r = a == null ? void 0 : a.control, t = (a == null ? void 0 : a.action) !== void 0 && a.action !== !1,
|
|
220
|
-
return t ||
|
|
218
|
+
function go(o, a) {
|
|
219
|
+
const r = a == null ? void 0 : a.control, t = (a == null ? void 0 : a.action) !== void 0 && a.action !== !1, g = (a == null ? void 0 : a.type) === "function" || typeof o == "function";
|
|
220
|
+
return t || g ? "action" : r === "boolean" || typeof o == "boolean" ? "boolean" : r === "number" || r === "range" || typeof o == "number" ? "number" : r === "select" || r === "radio" || (a == null ? void 0 : a.options) !== void 0 && a.options.length > 0 ? "select" : r === "text" || r === "color" || typeof o == "string" ? "text" : "json";
|
|
221
221
|
}
|
|
222
|
-
const
|
|
223
|
-
function
|
|
224
|
-
switch (
|
|
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]", O = "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)]", P = "jogak:px-5 jogak:py-2 jogak:align-middle jogak:border-b jogak:border-[var(--jogak-color-border-muted)]";
|
|
223
|
+
function so({ argKey: o, value: a, argType: r, onArgChange: t }) {
|
|
224
|
+
switch (go(a, r)) {
|
|
225
225
|
case "boolean":
|
|
226
226
|
return /* @__PURE__ */ e(
|
|
227
227
|
"input",
|
|
@@ -243,7 +243,7 @@ function go({ argKey: o, value: a, argType: r, onArgChange: t }) {
|
|
|
243
243
|
onChange: (n) => {
|
|
244
244
|
t(o, n.target.valueAsNumber);
|
|
245
245
|
},
|
|
246
|
-
className:
|
|
246
|
+
className: M
|
|
247
247
|
}
|
|
248
248
|
);
|
|
249
249
|
case "select": {
|
|
@@ -252,11 +252,11 @@ function go({ argKey: o, value: a, argType: r, onArgChange: t }) {
|
|
|
252
252
|
"select",
|
|
253
253
|
{
|
|
254
254
|
value: String(a ?? ""),
|
|
255
|
-
onChange: (
|
|
256
|
-
t(o,
|
|
255
|
+
onChange: (s) => {
|
|
256
|
+
t(o, s.target.value);
|
|
257
257
|
},
|
|
258
|
-
className:
|
|
259
|
-
children: n.map((
|
|
258
|
+
className: M,
|
|
259
|
+
children: n.map((s) => /* @__PURE__ */ e("option", { value: String(s), children: String(s) }, String(s)))
|
|
260
260
|
}
|
|
261
261
|
);
|
|
262
262
|
}
|
|
@@ -269,7 +269,7 @@ function go({ argKey: o, value: a, argType: r, onArgChange: t }) {
|
|
|
269
269
|
onChange: (n) => {
|
|
270
270
|
t(o, n.target.value);
|
|
271
271
|
},
|
|
272
|
-
className:
|
|
272
|
+
className: M
|
|
273
273
|
}
|
|
274
274
|
);
|
|
275
275
|
case "action":
|
|
@@ -278,45 +278,45 @@ function go({ argKey: o, value: a, argType: r, onArgChange: t }) {
|
|
|
278
278
|
return /* @__PURE__ */ e("code", { className: "jogak:text-[12px] jogak:text-[var(--jogak-color-fg-muted)] jogak:font-[family-name:var(--jogak-font-mono)]", children: JSON.stringify(a) });
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
const
|
|
281
|
+
function lo({ args: o, argTypes: a, onArgChange: r }) {
|
|
282
|
+
const g = Array.from(/* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(a)])).map((n) => [n, o[n]]);
|
|
283
283
|
return /* @__PURE__ */ j("div", { className: "jogak:border-t-2 jogak:border-[var(--jogak-color-border)]", children: [
|
|
284
284
|
/* @__PURE__ */ e("div", { className: "jogak:px-5 jogak:py-1.5 jogak:text-[11px] jogak:font-bold jogak:text-[var(--jogak-color-fg-subtle)] jogak:uppercase jogak:tracking-[0.08em] jogak:border-b jogak:border-[var(--jogak-color-border)] jogak:bg-[var(--jogak-color-bg-subtle)]", children: "Controls" }),
|
|
285
|
-
|
|
285
|
+
g.length === 0 ? /* @__PURE__ */ e("div", { className: "jogak:px-5 jogak:py-3 jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[13px]", children: "No args defined" }) : /* @__PURE__ */ j("table", { className: "jogak:w-full jogak:border-collapse jogak:text-[13px]", children: [
|
|
286
286
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ j("tr", { children: [
|
|
287
|
-
/* @__PURE__ */ e("th", { className:
|
|
288
|
-
/* @__PURE__ */ e("th", { className:
|
|
289
|
-
/* @__PURE__ */ e("th", { className:
|
|
287
|
+
/* @__PURE__ */ e("th", { className: O, children: "Name" }),
|
|
288
|
+
/* @__PURE__ */ e("th", { className: O, children: "Control" }),
|
|
289
|
+
/* @__PURE__ */ e("th", { className: O, children: "Description" })
|
|
290
290
|
] }) }),
|
|
291
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
291
|
+
/* @__PURE__ */ e("tbody", { children: g.map(([n, s]) => {
|
|
292
292
|
const l = a[n];
|
|
293
293
|
return /* @__PURE__ */ j("tr", { children: [
|
|
294
294
|
/* @__PURE__ */ e(
|
|
295
295
|
"td",
|
|
296
296
|
{
|
|
297
|
-
className:
|
|
298
|
-
|
|
297
|
+
className: N(
|
|
298
|
+
P,
|
|
299
299
|
"jogak:font-[family-name:var(--jogak-font-mono)] jogak:text-[12px] jogak:text-[var(--jogak-color-fg)] jogak:whitespace-nowrap"
|
|
300
300
|
),
|
|
301
301
|
children: n
|
|
302
302
|
}
|
|
303
303
|
),
|
|
304
|
-
/* @__PURE__ */ e("td", { className:
|
|
305
|
-
|
|
304
|
+
/* @__PURE__ */ e("td", { className: P, children: /* @__PURE__ */ e(
|
|
305
|
+
so,
|
|
306
306
|
{
|
|
307
307
|
argKey: n,
|
|
308
|
-
value:
|
|
308
|
+
value: s,
|
|
309
309
|
argType: l,
|
|
310
310
|
onArgChange: r
|
|
311
311
|
}
|
|
312
312
|
) }),
|
|
313
|
-
/* @__PURE__ */ e("td", { className:
|
|
313
|
+
/* @__PURE__ */ e("td", { className: N(P, "jogak:text-[var(--jogak-color-fg-subtle)]"), children: (l == null ? void 0 : l.description) ?? "" })
|
|
314
314
|
] }, n);
|
|
315
315
|
}) })
|
|
316
316
|
] })
|
|
317
317
|
] });
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function ko(o) {
|
|
320
320
|
if (o.length === 0) return "()";
|
|
321
321
|
try {
|
|
322
322
|
return o.map((a) => {
|
|
@@ -334,13 +334,13 @@ function lo(o) {
|
|
|
334
334
|
return "[unserializable]";
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
|
-
function
|
|
338
|
-
const a = new Date(o), r = a.getHours().toString().padStart(2, "0"), t = a.getMinutes().toString().padStart(2, "0"),
|
|
339
|
-
return `${r}:${t}:${
|
|
337
|
+
function io(o) {
|
|
338
|
+
const a = new Date(o), r = a.getHours().toString().padStart(2, "0"), t = a.getMinutes().toString().padStart(2, "0"), g = a.getSeconds().toString().padStart(2, "0"), n = a.getMilliseconds().toString().padStart(3, "0");
|
|
339
|
+
return `${r}:${t}:${g}.${n}`;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
const [o, a] =
|
|
343
|
-
|
|
341
|
+
function jo() {
|
|
342
|
+
const [o, a] = b(() => L.getLogs());
|
|
343
|
+
h(() => L.subscribe(a), []);
|
|
344
344
|
const r = o.length === 0;
|
|
345
345
|
return /* @__PURE__ */ j("div", { className: "jogak:h-full jogak:flex jogak:flex-col", children: [
|
|
346
346
|
/* @__PURE__ */ j("div", { className: "jogak:px-5 jogak:py-1.5 jogak:text-[11px] jogak:font-bold jogak:text-[var(--jogak-color-fg-subtle)] jogak:uppercase jogak:tracking-[0.08em] jogak:border-b jogak:border-[var(--jogak-color-border)] jogak:bg-[var(--jogak-color-bg-subtle)] jogak:flex jogak:items-center jogak:justify-between jogak:shrink-0", children: [
|
|
@@ -353,10 +353,10 @@ function io() {
|
|
|
353
353
|
{
|
|
354
354
|
type: "button",
|
|
355
355
|
onClick: () => {
|
|
356
|
-
|
|
356
|
+
L.clear();
|
|
357
357
|
},
|
|
358
358
|
disabled: r,
|
|
359
|
-
className:
|
|
359
|
+
className: N(
|
|
360
360
|
"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
361
|
r ? "jogak:text-[var(--jogak-color-fg-subtle)] jogak:cursor-default" : "jogak:text-[var(--jogak-color-fg)] jogak:cursor-pointer"
|
|
362
362
|
),
|
|
@@ -369,11 +369,11 @@ function io() {
|
|
|
369
369
|
{
|
|
370
370
|
className: "jogak:flex jogak:items-baseline jogak:gap-[10px] jogak:px-5 jogak:py-1.5 jogak:border-b jogak:border-[var(--jogak-color-border-muted)]",
|
|
371
371
|
children: [
|
|
372
|
-
/* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[11px] jogak:min-w-[92px]", children:
|
|
372
|
+
/* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-fg-subtle)] jogak:text-[11px] jogak:min-w-[92px]", children: io(t.timestamp) }),
|
|
373
373
|
/* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-violet)] jogak:font-semibold", children: t.name }),
|
|
374
374
|
/* @__PURE__ */ j("span", { className: "jogak:text-[var(--jogak-color-fg)] jogak:break-all jogak:flex-1", children: [
|
|
375
375
|
"(",
|
|
376
|
-
|
|
376
|
+
ko(t.args),
|
|
377
377
|
")"
|
|
378
378
|
] })
|
|
379
379
|
]
|
|
@@ -382,83 +382,84 @@ function io() {
|
|
|
382
382
|
)) }) })
|
|
383
383
|
] });
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function co({
|
|
386
386
|
children: o,
|
|
387
387
|
className: a,
|
|
388
388
|
style: r,
|
|
389
389
|
"data-testid": t
|
|
390
390
|
}) {
|
|
391
|
-
const
|
|
392
|
-
return
|
|
393
|
-
const l =
|
|
391
|
+
const g = E(null), [n, s] = b(null);
|
|
392
|
+
return h(() => {
|
|
393
|
+
const l = g.current;
|
|
394
394
|
if (l === null) return;
|
|
395
|
-
const
|
|
396
|
-
|
|
395
|
+
const i = l.shadowRoot ?? l.attachShadow({ mode: "open" });
|
|
396
|
+
s(i);
|
|
397
397
|
}, []), /* @__PURE__ */ e(
|
|
398
398
|
"div",
|
|
399
399
|
{
|
|
400
|
-
ref:
|
|
400
|
+
ref: g,
|
|
401
401
|
className: a,
|
|
402
402
|
"data-testid": t,
|
|
403
403
|
style: r,
|
|
404
|
-
children: n !== null ?
|
|
404
|
+
children: n !== null ? eo(o, n) : null
|
|
405
405
|
}
|
|
406
406
|
);
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function uo({
|
|
409
409
|
entry: o,
|
|
410
410
|
args: a,
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
411
|
+
userPreviewUrl: r,
|
|
412
|
+
previewEntryPath: t,
|
|
413
|
+
className: g,
|
|
414
|
+
"data-testid": n
|
|
414
415
|
}) {
|
|
415
|
-
const
|
|
416
|
-
return
|
|
417
|
-
const
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
420
|
-
const
|
|
421
|
-
|
|
416
|
+
const s = E(null), [l, i] = b(!1), d = r !== "" ? `${r}${t}` : "/preview-frame.html";
|
|
417
|
+
return h(() => {
|
|
418
|
+
const k = (c) => {
|
|
419
|
+
const x = s.current;
|
|
420
|
+
if (x === null || c.source !== x.contentWindow) return;
|
|
421
|
+
const p = c.data;
|
|
422
|
+
p == null || typeof p != "object" || p.type === "jogak:ready" && i(!0);
|
|
422
423
|
};
|
|
423
|
-
return window.addEventListener("message",
|
|
424
|
-
window.removeEventListener("message",
|
|
424
|
+
return window.addEventListener("message", k), () => {
|
|
425
|
+
window.removeEventListener("message", k);
|
|
425
426
|
};
|
|
426
|
-
}, []),
|
|
427
|
-
var
|
|
428
|
-
if (!
|
|
429
|
-
const
|
|
430
|
-
|
|
427
|
+
}, []), h(() => {
|
|
428
|
+
var c;
|
|
429
|
+
if (!l) return;
|
|
430
|
+
const k = s.current;
|
|
431
|
+
k !== null && ((c = k.contentWindow) == null || c.postMessage(
|
|
431
432
|
{ type: "jogak:setProps", entryId: o.id, args: a },
|
|
432
433
|
"*"
|
|
433
434
|
));
|
|
434
|
-
}, [
|
|
435
|
-
const
|
|
435
|
+
}, [l, o, a]), h(() => {
|
|
436
|
+
const k = s.current;
|
|
436
437
|
return () => {
|
|
437
|
-
|
|
438
|
-
var
|
|
439
|
-
(
|
|
438
|
+
k !== null && queueMicrotask(() => {
|
|
439
|
+
var c;
|
|
440
|
+
(c = k.contentWindow) == null || c.postMessage({ type: "jogak:unmount" }, "*");
|
|
440
441
|
});
|
|
441
442
|
};
|
|
442
443
|
}, []), /* @__PURE__ */ e(
|
|
443
444
|
"iframe",
|
|
444
445
|
{
|
|
445
|
-
ref:
|
|
446
|
-
src:
|
|
446
|
+
ref: s,
|
|
447
|
+
src: d,
|
|
447
448
|
title: "Preview",
|
|
448
|
-
className:
|
|
449
|
-
"data-testid":
|
|
449
|
+
className: g,
|
|
450
|
+
"data-testid": n
|
|
450
451
|
}
|
|
451
452
|
);
|
|
452
453
|
}
|
|
453
|
-
const
|
|
454
|
+
const Q = {
|
|
454
455
|
mobile: 375,
|
|
455
456
|
tablet: 768,
|
|
456
457
|
desktop: "none"
|
|
457
|
-
},
|
|
458
|
+
}, po = {
|
|
458
459
|
mobile: "Mobile",
|
|
459
460
|
tablet: "Tablet",
|
|
460
461
|
desktop: "Desktop"
|
|
461
|
-
},
|
|
462
|
+
}, V = {
|
|
462
463
|
white: {
|
|
463
464
|
"--jogak-canvas-bg": "#ffffff",
|
|
464
465
|
"--jogak-canvas-bg-image": "none",
|
|
@@ -477,23 +478,24 @@ const I = {
|
|
|
477
478
|
"--jogak-canvas-bg-size": "16px 16px",
|
|
478
479
|
"--jogak-canvas-bg-position": "0 0, 0 8px, 8px -8px, -8px 0px"
|
|
479
480
|
}
|
|
480
|
-
},
|
|
481
|
-
function
|
|
482
|
-
return
|
|
481
|
+
}, B = "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)]";
|
|
482
|
+
function fo(o) {
|
|
483
|
+
return H[o] ?? H.vsDark;
|
|
483
484
|
}
|
|
484
|
-
function
|
|
485
|
+
function mo({
|
|
485
486
|
entryId: o,
|
|
486
487
|
jogakName: a,
|
|
487
488
|
overrideArgs: r,
|
|
488
489
|
onArgChange: t,
|
|
489
|
-
onReset:
|
|
490
|
+
onReset: g,
|
|
490
491
|
codeTheme: n,
|
|
491
|
-
onResolveJogak:
|
|
492
|
+
onResolveJogak: s,
|
|
492
493
|
previewIsolation: l = "iframe",
|
|
493
|
-
|
|
494
|
+
userPreviewUrl: i = "",
|
|
495
|
+
previewEntryPath: d = "/__jogak_preview__/index.html"
|
|
494
496
|
}) {
|
|
495
|
-
const
|
|
496
|
-
return
|
|
497
|
+
const k = K(o), [c, x] = b("desktop"), [p, S] = b("white"), [y, v] = b("controls"), w = fo(n);
|
|
498
|
+
return k.status === "unknown" ? /* @__PURE__ */ j(
|
|
497
499
|
"div",
|
|
498
500
|
{
|
|
499
501
|
"data-testid": "preview-not-found",
|
|
@@ -503,7 +505,7 @@ function fo({
|
|
|
503
505
|
o
|
|
504
506
|
]
|
|
505
507
|
}
|
|
506
|
-
) :
|
|
508
|
+
) : k.status === "error" ? /* @__PURE__ */ j(
|
|
507
509
|
"div",
|
|
508
510
|
{
|
|
509
511
|
"data-testid": "preview-error",
|
|
@@ -513,49 +515,50 @@ function fo({
|
|
|
513
515
|
"Failed to load entry: ",
|
|
514
516
|
o
|
|
515
517
|
] }),
|
|
516
|
-
/* @__PURE__ */ e("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:
|
|
518
|
+
/* @__PURE__ */ e("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: k.error.message })
|
|
517
519
|
]
|
|
518
520
|
}
|
|
519
|
-
) :
|
|
520
|
-
|
|
521
|
+
) : k.status === "loading" ? /* @__PURE__ */ e(
|
|
522
|
+
bo,
|
|
521
523
|
{
|
|
522
|
-
meta:
|
|
524
|
+
meta: k.meta,
|
|
523
525
|
jogakName: a,
|
|
524
|
-
viewport:
|
|
525
|
-
bgMode:
|
|
526
|
-
onViewportChange:
|
|
527
|
-
onBgModeChange:
|
|
526
|
+
viewport: c,
|
|
527
|
+
bgMode: p,
|
|
528
|
+
onViewportChange: x,
|
|
529
|
+
onBgModeChange: S
|
|
528
530
|
}
|
|
529
531
|
) : /* @__PURE__ */ e(
|
|
530
|
-
|
|
532
|
+
xo,
|
|
531
533
|
{
|
|
532
|
-
entry:
|
|
534
|
+
entry: k.entry,
|
|
533
535
|
jogakName: a,
|
|
534
536
|
overrideArgs: r,
|
|
535
537
|
onArgChange: t,
|
|
536
|
-
onReset:
|
|
537
|
-
onResolveJogak:
|
|
538
|
-
viewport:
|
|
539
|
-
bgMode:
|
|
540
|
-
bottomTab:
|
|
541
|
-
onViewportChange:
|
|
542
|
-
onBgModeChange:
|
|
543
|
-
onBottomTabChange:
|
|
544
|
-
prismTheme:
|
|
538
|
+
onReset: g,
|
|
539
|
+
onResolveJogak: s,
|
|
540
|
+
viewport: c,
|
|
541
|
+
bgMode: p,
|
|
542
|
+
bottomTab: y,
|
|
543
|
+
onViewportChange: x,
|
|
544
|
+
onBgModeChange: S,
|
|
545
|
+
onBottomTabChange: v,
|
|
546
|
+
prismTheme: w,
|
|
545
547
|
previewIsolation: l,
|
|
546
|
-
|
|
548
|
+
userPreviewUrl: i,
|
|
549
|
+
previewEntryPath: d
|
|
547
550
|
}
|
|
548
551
|
);
|
|
549
552
|
}
|
|
550
|
-
function
|
|
553
|
+
function bo({
|
|
551
554
|
meta: o,
|
|
552
555
|
jogakName: a,
|
|
553
556
|
viewport: r,
|
|
554
557
|
bgMode: t,
|
|
555
|
-
onViewportChange:
|
|
558
|
+
onViewportChange: g,
|
|
556
559
|
onBgModeChange: n
|
|
557
560
|
}) {
|
|
558
|
-
const
|
|
561
|
+
const s = a ?? o.jogakNames[0] ?? "...", l = Q[r];
|
|
559
562
|
return /* @__PURE__ */ j(
|
|
560
563
|
"div",
|
|
561
564
|
{
|
|
@@ -563,13 +566,13 @@ function mo({
|
|
|
563
566
|
className: "jogak:flex jogak:flex-col jogak:h-full",
|
|
564
567
|
children: [
|
|
565
568
|
/* @__PURE__ */ e(
|
|
566
|
-
|
|
569
|
+
X,
|
|
567
570
|
{
|
|
568
571
|
title: o.title,
|
|
569
|
-
jogakName:
|
|
572
|
+
jogakName: s,
|
|
570
573
|
viewport: r,
|
|
571
574
|
bgMode: t,
|
|
572
|
-
onViewportChange:
|
|
575
|
+
onViewportChange: g,
|
|
573
576
|
onBgModeChange: n,
|
|
574
577
|
showReset: !1,
|
|
575
578
|
onReset: () => {
|
|
@@ -579,8 +582,8 @@ function mo({
|
|
|
579
582
|
/* @__PURE__ */ e(
|
|
580
583
|
"div",
|
|
581
584
|
{
|
|
582
|
-
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${
|
|
583
|
-
style:
|
|
585
|
+
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${B}`,
|
|
586
|
+
style: V[t],
|
|
584
587
|
children: /* @__PURE__ */ e(
|
|
585
588
|
"div",
|
|
586
589
|
{
|
|
@@ -601,80 +604,82 @@ function mo({
|
|
|
601
604
|
}
|
|
602
605
|
);
|
|
603
606
|
}
|
|
604
|
-
function
|
|
607
|
+
function xo({
|
|
605
608
|
entry: o,
|
|
606
609
|
jogakName: a,
|
|
607
610
|
overrideArgs: r,
|
|
608
611
|
onArgChange: t,
|
|
609
|
-
onReset:
|
|
612
|
+
onReset: g,
|
|
610
613
|
onResolveJogak: n,
|
|
611
|
-
viewport:
|
|
614
|
+
viewport: s,
|
|
612
615
|
bgMode: l,
|
|
613
|
-
bottomTab:
|
|
614
|
-
onViewportChange:
|
|
615
|
-
onBgModeChange:
|
|
616
|
-
onBottomTabChange:
|
|
617
|
-
prismTheme:
|
|
618
|
-
previewIsolation:
|
|
619
|
-
|
|
616
|
+
bottomTab: i,
|
|
617
|
+
onViewportChange: d,
|
|
618
|
+
onBgModeChange: k,
|
|
619
|
+
onBottomTabChange: c,
|
|
620
|
+
prismTheme: x,
|
|
621
|
+
previewIsolation: p,
|
|
622
|
+
userPreviewUrl: S,
|
|
623
|
+
previewEntryPath: y
|
|
620
624
|
}) {
|
|
621
|
-
var
|
|
622
|
-
const
|
|
623
|
-
if (
|
|
624
|
-
a === null &&
|
|
625
|
-
}, [a,
|
|
625
|
+
var z;
|
|
626
|
+
const v = a ?? ((z = o.jogaks[0]) == null ? void 0 : z.name) ?? null;
|
|
627
|
+
if (h(() => {
|
|
628
|
+
a === null && v !== null && n !== void 0 && n(o.id, v);
|
|
629
|
+
}, [a, v, o.id, n]), v === null)
|
|
626
630
|
return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
|
|
627
631
|
"Entry has no jogaks: ",
|
|
628
632
|
o.id
|
|
629
633
|
] });
|
|
630
|
-
const
|
|
631
|
-
if (
|
|
634
|
+
const w = o.jogaks.find((C) => C.name === v);
|
|
635
|
+
if (w === void 0)
|
|
632
636
|
return /* @__PURE__ */ j("div", { className: "jogak:p-6 jogak:text-[var(--jogak-color-error)]", children: [
|
|
633
637
|
"Jogak not found: ",
|
|
634
|
-
|
|
638
|
+
v
|
|
635
639
|
] });
|
|
636
|
-
const
|
|
640
|
+
const A = { ...w.args ?? {}, ...r }, u = {
|
|
637
641
|
...o.meta.argTypes ?? {},
|
|
638
|
-
...
|
|
639
|
-
},
|
|
642
|
+
...w.argTypes ?? {}
|
|
643
|
+
}, f = Object.keys(r).length > 0, m = Q[s];
|
|
640
644
|
return /* @__PURE__ */ j("div", { className: "jogak:flex jogak:flex-col jogak:h-full", children: [
|
|
641
645
|
/* @__PURE__ */ e(
|
|
642
|
-
|
|
646
|
+
X,
|
|
643
647
|
{
|
|
644
648
|
title: o.title,
|
|
645
|
-
jogakName:
|
|
646
|
-
viewport:
|
|
649
|
+
jogakName: w.name,
|
|
650
|
+
viewport: s,
|
|
647
651
|
bgMode: l,
|
|
648
|
-
onViewportChange:
|
|
649
|
-
onBgModeChange:
|
|
650
|
-
showReset:
|
|
651
|
-
onReset:
|
|
652
|
+
onViewportChange: d,
|
|
653
|
+
onBgModeChange: k,
|
|
654
|
+
showReset: f,
|
|
655
|
+
onReset: g
|
|
652
656
|
}
|
|
653
657
|
),
|
|
654
658
|
/* @__PURE__ */ e(
|
|
655
659
|
"div",
|
|
656
660
|
{
|
|
657
|
-
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${
|
|
658
|
-
style:
|
|
661
|
+
className: `jogak:flex-1 jogak:overflow-auto jogak:min-h-[320px] ${B}`,
|
|
662
|
+
style: V[l],
|
|
659
663
|
children: /* @__PURE__ */ e(
|
|
660
664
|
"div",
|
|
661
665
|
{
|
|
662
666
|
"data-jogak-content": !0,
|
|
663
667
|
className: "jogak:mx-auto jogak:p-6 jogak:max-w-[var(--jogak-canvas-mw)]",
|
|
664
668
|
style: {
|
|
665
|
-
"--jogak-canvas-mw":
|
|
669
|
+
"--jogak-canvas-mw": m === "none" ? "100%" : `${m}px`
|
|
666
670
|
},
|
|
667
671
|
children: /* @__PURE__ */ e(
|
|
668
|
-
|
|
672
|
+
ho,
|
|
669
673
|
{
|
|
670
674
|
entry: o,
|
|
671
|
-
args:
|
|
675
|
+
args: A,
|
|
672
676
|
source: o.source,
|
|
673
|
-
theme:
|
|
674
|
-
previewIsolation:
|
|
675
|
-
|
|
677
|
+
theme: x,
|
|
678
|
+
previewIsolation: p,
|
|
679
|
+
userPreviewUrl: S,
|
|
680
|
+
previewEntryPath: y
|
|
676
681
|
},
|
|
677
|
-
`${o.id}/${
|
|
682
|
+
`${o.id}/${w.name}`
|
|
678
683
|
)
|
|
679
684
|
}
|
|
680
685
|
)
|
|
@@ -691,49 +696,49 @@ function bo({
|
|
|
691
696
|
{
|
|
692
697
|
role: "tablist",
|
|
693
698
|
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",
|
|
694
|
-
children: ["controls", "actions"].map((
|
|
695
|
-
const
|
|
699
|
+
children: ["controls", "actions"].map((C) => {
|
|
700
|
+
const D = i === C;
|
|
696
701
|
return /* @__PURE__ */ e(
|
|
697
702
|
"button",
|
|
698
703
|
{
|
|
699
704
|
type: "button",
|
|
700
705
|
role: "tab",
|
|
701
|
-
"aria-selected":
|
|
706
|
+
"aria-selected": D,
|
|
702
707
|
onClick: () => {
|
|
703
|
-
|
|
708
|
+
c(C);
|
|
704
709
|
},
|
|
705
|
-
className:
|
|
710
|
+
className: N(
|
|
706
711
|
"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",
|
|
707
|
-
|
|
712
|
+
D ? "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"
|
|
708
713
|
),
|
|
709
|
-
children:
|
|
714
|
+
children: C
|
|
710
715
|
},
|
|
711
|
-
|
|
716
|
+
C
|
|
712
717
|
);
|
|
713
718
|
})
|
|
714
719
|
}
|
|
715
720
|
),
|
|
716
|
-
/* @__PURE__ */ e("div", { className: "jogak:flex-1 jogak:min-h-0 jogak:overflow-auto", children:
|
|
717
|
-
|
|
721
|
+
/* @__PURE__ */ e("div", { className: "jogak:flex-1 jogak:min-h-0 jogak:overflow-auto", children: i === "controls" ? /* @__PURE__ */ e(
|
|
722
|
+
lo,
|
|
718
723
|
{
|
|
719
|
-
args:
|
|
720
|
-
argTypes:
|
|
724
|
+
args: A,
|
|
725
|
+
argTypes: u,
|
|
721
726
|
onArgChange: t
|
|
722
727
|
}
|
|
723
|
-
) : /* @__PURE__ */ e(
|
|
728
|
+
) : /* @__PURE__ */ e(jo, {}) })
|
|
724
729
|
]
|
|
725
730
|
}
|
|
726
731
|
)
|
|
727
732
|
] });
|
|
728
733
|
}
|
|
729
|
-
function
|
|
734
|
+
function X({
|
|
730
735
|
title: o,
|
|
731
736
|
jogakName: a,
|
|
732
737
|
viewport: r,
|
|
733
738
|
bgMode: t,
|
|
734
|
-
onViewportChange:
|
|
739
|
+
onViewportChange: g,
|
|
735
740
|
onBgModeChange: n,
|
|
736
|
-
showReset:
|
|
741
|
+
showReset: s,
|
|
737
742
|
onReset: l
|
|
738
743
|
}) {
|
|
739
744
|
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: [
|
|
@@ -742,41 +747,41 @@ function U({
|
|
|
742
747
|
/* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-border-strong)] jogak:mx-1.5 jogak:leading-none", children: "/" }),
|
|
743
748
|
/* @__PURE__ */ e("span", { className: "jogak:text-[var(--jogak-color-fg-strong)] jogak:font-semibold", children: a })
|
|
744
749
|
] }),
|
|
745
|
-
/* @__PURE__ */ e("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((
|
|
750
|
+
/* @__PURE__ */ e("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((i) => /* @__PURE__ */ e(
|
|
746
751
|
"button",
|
|
747
752
|
{
|
|
748
753
|
type: "button",
|
|
749
754
|
onClick: () => {
|
|
750
|
-
|
|
755
|
+
g(i);
|
|
751
756
|
},
|
|
752
|
-
"aria-pressed": r ===
|
|
753
|
-
className:
|
|
757
|
+
"aria-pressed": r === i,
|
|
758
|
+
className: N(
|
|
754
759
|
"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",
|
|
755
|
-
r ===
|
|
760
|
+
r === i ? "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"
|
|
756
761
|
),
|
|
757
|
-
children:
|
|
762
|
+
children: po[i]
|
|
758
763
|
},
|
|
759
|
-
|
|
764
|
+
i
|
|
760
765
|
)) }),
|
|
761
|
-
/* @__PURE__ */ e("div", { className: "jogak:flex jogak:gap-1 jogak:items-center", children: ["white", "dark", "transparent"].map((
|
|
766
|
+
/* @__PURE__ */ e("div", { className: "jogak:flex jogak:gap-1 jogak:items-center", children: ["white", "dark", "transparent"].map((i) => /* @__PURE__ */ e(
|
|
762
767
|
"button",
|
|
763
768
|
{
|
|
764
769
|
type: "button",
|
|
765
770
|
onClick: () => {
|
|
766
|
-
n(
|
|
771
|
+
n(i);
|
|
767
772
|
},
|
|
768
|
-
"aria-pressed": t ===
|
|
769
|
-
"aria-label": `${
|
|
770
|
-
className:
|
|
773
|
+
"aria-pressed": t === i,
|
|
774
|
+
"aria-label": `${i} background`,
|
|
775
|
+
className: N(
|
|
771
776
|
"jogak:w-5 jogak:h-5 jogak:rounded-[var(--jogak-radius-md)] jogak:border-2 jogak:cursor-pointer jogak:p-0 jogak:shrink-0",
|
|
772
|
-
|
|
773
|
-
t ===
|
|
777
|
+
B,
|
|
778
|
+
t === i ? "jogak:border-[var(--jogak-color-accent)]" : "jogak:border-[var(--jogak-color-border-strong)]"
|
|
774
779
|
),
|
|
775
|
-
style:
|
|
780
|
+
style: V[i]
|
|
776
781
|
},
|
|
777
|
-
|
|
782
|
+
i
|
|
778
783
|
)) }),
|
|
779
|
-
|
|
784
|
+
s && /* @__PURE__ */ e(
|
|
780
785
|
"button",
|
|
781
786
|
{
|
|
782
787
|
type: "button",
|
|
@@ -787,15 +792,16 @@ function U({
|
|
|
787
792
|
)
|
|
788
793
|
] });
|
|
789
794
|
}
|
|
790
|
-
function
|
|
791
|
-
const [
|
|
795
|
+
function ho({ entry: o, args: a, source: r, theme: t, previewIsolation: g, userPreviewUrl: n, previewEntryPath: s }) {
|
|
796
|
+
const [l, i] = b(!1), d = /* @__PURE__ */ j("div", { className: "jogak:relative", children: [
|
|
792
797
|
/* @__PURE__ */ e(
|
|
793
|
-
|
|
798
|
+
vo,
|
|
794
799
|
{
|
|
795
800
|
entry: o,
|
|
796
801
|
args: a,
|
|
797
|
-
previewIsolation:
|
|
798
|
-
|
|
802
|
+
previewIsolation: g,
|
|
803
|
+
userPreviewUrl: n,
|
|
804
|
+
previewEntryPath: s
|
|
799
805
|
}
|
|
800
806
|
),
|
|
801
807
|
/* @__PURE__ */ e(
|
|
@@ -803,90 +809,91 @@ function xo({ entry: o, args: a, source: r, theme: t, previewIsolation: s, userV
|
|
|
803
809
|
{
|
|
804
810
|
type: "button",
|
|
805
811
|
onClick: () => {
|
|
806
|
-
|
|
812
|
+
i((k) => !k);
|
|
807
813
|
},
|
|
808
|
-
"aria-pressed":
|
|
809
|
-
"aria-label":
|
|
810
|
-
className:
|
|
814
|
+
"aria-pressed": l,
|
|
815
|
+
"aria-label": l ? "Hide source code" : "Show source code",
|
|
816
|
+
className: N(
|
|
811
817
|
"jogak:absolute jogak:bottom-2 jogak:right-2 jogak:px-[9px] jogak:py-1",
|
|
812
818
|
"jogak:text-[11px] jogak:font-[family-name:var(--jogak-font-mono)] jogak:font-semibold jogak:tracking-[0.02em]",
|
|
813
819
|
"jogak:text-[var(--jogak-color-bg)] jogak:border-none jogak:rounded-[5px] jogak:cursor-pointer",
|
|
814
820
|
"jogak:shadow-[0_1px_4px_rgba(0,0,0,0.2)] jogak:transition-[background-color] jogak:duration-150 jogak:leading-none",
|
|
815
|
-
|
|
821
|
+
l ? "jogak:bg-[var(--jogak-color-accent)]" : "jogak:bg-[#1e293b]"
|
|
816
822
|
),
|
|
817
823
|
children: "</>"
|
|
818
824
|
}
|
|
819
825
|
)
|
|
820
826
|
] });
|
|
821
827
|
return /* @__PURE__ */ j("div", { children: [
|
|
822
|
-
|
|
823
|
-
|
|
828
|
+
d,
|
|
829
|
+
l && /* @__PURE__ */ e("div", { className: "jogak:mt-2 jogak:rounded-[var(--jogak-radius-xl)] jogak:overflow-hidden jogak:h-[320px] jogak:shadow-[0_0_0_1px_rgba(0,0,0,0.08),_0_4px_16px_rgba(0,0,0,0.12)]", children: /* @__PURE__ */ e(yo, { source: r, theme: t }) })
|
|
824
830
|
] });
|
|
825
831
|
}
|
|
826
|
-
const
|
|
827
|
-
function
|
|
832
|
+
const J = "jogak:border jogak:border-dashed jogak:border-[var(--jogak-color-border)] jogak:rounded-[var(--jogak-radius-xl)] jogak:p-4 jogak:pb-9";
|
|
833
|
+
function vo({ entry: o, args: a, previewIsolation: r, userPreviewUrl: t, previewEntryPath: g }) {
|
|
828
834
|
return r === "shadow" ? /* @__PURE__ */ e(
|
|
829
|
-
|
|
835
|
+
co,
|
|
830
836
|
{
|
|
831
837
|
"data-testid": "preview-content",
|
|
832
|
-
className:
|
|
833
|
-
children: /* @__PURE__ */ e(
|
|
838
|
+
className: J,
|
|
839
|
+
children: /* @__PURE__ */ e(No, { entry: o, args: a })
|
|
834
840
|
}
|
|
835
841
|
) : r === "iframe" ? /* @__PURE__ */ e(
|
|
836
|
-
|
|
842
|
+
uo,
|
|
837
843
|
{
|
|
838
844
|
entry: o,
|
|
839
845
|
args: a,
|
|
840
|
-
|
|
846
|
+
userPreviewUrl: t,
|
|
847
|
+
previewEntryPath: g,
|
|
841
848
|
"data-testid": "preview-content",
|
|
842
|
-
className: `${
|
|
849
|
+
className: `${J} jogak:block jogak:w-full jogak:bg-transparent jogak:min-h-[256px]`
|
|
843
850
|
}
|
|
844
|
-
) : /* @__PURE__ */ e(
|
|
851
|
+
) : /* @__PURE__ */ e(wo, { entry: o, args: a });
|
|
845
852
|
}
|
|
846
|
-
function
|
|
847
|
-
const r =
|
|
848
|
-
return
|
|
853
|
+
function wo({ entry: o, args: a }) {
|
|
854
|
+
const r = E(null);
|
|
855
|
+
return h(() => {
|
|
849
856
|
const t = r.current;
|
|
850
857
|
if (t !== null)
|
|
851
|
-
return
|
|
858
|
+
return _.render(o, a, t), () => {
|
|
852
859
|
queueMicrotask(() => {
|
|
853
|
-
|
|
860
|
+
_.unmount(t);
|
|
854
861
|
});
|
|
855
862
|
};
|
|
856
|
-
}, [o]),
|
|
863
|
+
}, [o]), h(() => {
|
|
857
864
|
const t = r.current;
|
|
858
|
-
t !== null &&
|
|
865
|
+
t !== null && _.render(o, a, t);
|
|
859
866
|
}, [o, a]), /* @__PURE__ */ e(
|
|
860
867
|
"div",
|
|
861
868
|
{
|
|
862
869
|
ref: r,
|
|
863
870
|
"data-testid": "preview-content",
|
|
864
|
-
className:
|
|
871
|
+
className: J
|
|
865
872
|
}
|
|
866
873
|
);
|
|
867
874
|
}
|
|
868
|
-
function
|
|
869
|
-
const r =
|
|
870
|
-
return
|
|
875
|
+
function No({ entry: o, args: a }) {
|
|
876
|
+
const r = E(null);
|
|
877
|
+
return h(() => {
|
|
871
878
|
const t = r.current;
|
|
872
879
|
if (t !== null)
|
|
873
|
-
return
|
|
880
|
+
return _.render(o, a, t), () => {
|
|
874
881
|
queueMicrotask(() => {
|
|
875
|
-
|
|
882
|
+
_.unmount(t);
|
|
876
883
|
});
|
|
877
884
|
};
|
|
878
|
-
}, [o]),
|
|
885
|
+
}, [o]), h(() => {
|
|
879
886
|
const t = r.current;
|
|
880
|
-
t !== null &&
|
|
887
|
+
t !== null && _.render(o, a, t);
|
|
881
888
|
}, [o, a]), /* @__PURE__ */ e("div", { ref: r, "data-testid": "preview-content-shadow" });
|
|
882
889
|
}
|
|
883
|
-
function
|
|
884
|
-
const [r, t] =
|
|
890
|
+
function yo({ source: o, theme: a }) {
|
|
891
|
+
const [r, t] = b(!1), g = a.plain.backgroundColor ?? "#1e293b";
|
|
885
892
|
return o === void 0 ? /* @__PURE__ */ e(
|
|
886
893
|
"div",
|
|
887
894
|
{
|
|
888
895
|
className: "jogak:h-full jogak:flex jogak:items-center jogak:justify-center jogak:bg-[var(--jogak-source-bg)] jogak:text-[#94a3b8] jogak:text-[13px]",
|
|
889
|
-
style: { "--jogak-source-bg":
|
|
896
|
+
style: { "--jogak-source-bg": g },
|
|
890
897
|
children: "Source not available"
|
|
891
898
|
}
|
|
892
899
|
) : /* @__PURE__ */ j("div", { className: "jogak:relative jogak:h-full", children: [
|
|
@@ -905,128 +912,131 @@ function No({ source: o, theme: a }) {
|
|
|
905
912
|
children: r ? "✓ Copied" : "Copy"
|
|
906
913
|
}
|
|
907
914
|
),
|
|
908
|
-
/* @__PURE__ */ e(
|
|
915
|
+
/* @__PURE__ */ e(ao, { code: o.trim(), language: "tsx", theme: a, children: ({ style: s, tokens: l, getLineProps: i, getTokenProps: d }) => /* @__PURE__ */ e(
|
|
909
916
|
"pre",
|
|
910
917
|
{
|
|
911
918
|
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",
|
|
912
|
-
style:
|
|
913
|
-
children: l.map((
|
|
919
|
+
style: s,
|
|
920
|
+
children: l.map((k, c) => /* @__PURE__ */ j(
|
|
914
921
|
"div",
|
|
915
922
|
{
|
|
916
|
-
...
|
|
923
|
+
...i({ line: k }),
|
|
917
924
|
className: "jogak:flex jogak:pr-6",
|
|
918
|
-
style:
|
|
925
|
+
style: i({ line: k }).style,
|
|
919
926
|
children: [
|
|
920
|
-
/* @__PURE__ */ e("span", { className: "jogak:select-none jogak:min-w-10 jogak:pl-[14px] jogak:pr-[14px] jogak:text-right jogak:text-[rgba(148,163,184,0.45)] jogak:shrink-0 jogak:leading-[1.7]", children:
|
|
921
|
-
/* @__PURE__ */ e("span", { children:
|
|
927
|
+
/* @__PURE__ */ e("span", { className: "jogak:select-none jogak:min-w-10 jogak:pl-[14px] jogak:pr-[14px] jogak:text-right jogak:text-[rgba(148,163,184,0.45)] jogak:shrink-0 jogak:leading-[1.7]", children: c + 1 }),
|
|
928
|
+
/* @__PURE__ */ e("span", { children: k.map((x, p) => /* @__PURE__ */ e("span", { ...d({ token: x }) }, p)) })
|
|
922
929
|
]
|
|
923
930
|
},
|
|
924
|
-
|
|
931
|
+
c
|
|
925
932
|
))
|
|
926
933
|
}
|
|
927
934
|
) })
|
|
928
935
|
] });
|
|
929
936
|
}
|
|
930
|
-
function
|
|
937
|
+
function U() {
|
|
931
938
|
if (typeof window > "u") return null;
|
|
932
939
|
const o = new URLSearchParams(window.location.search), a = o.get("entry");
|
|
933
940
|
if (a === null) return null;
|
|
934
941
|
const r = o.get("jogak");
|
|
935
942
|
return { entryId: a, jogakName: r };
|
|
936
943
|
}
|
|
937
|
-
function
|
|
944
|
+
function So(o, a) {
|
|
938
945
|
const r = new URLSearchParams();
|
|
939
946
|
r.set("entry", o), r.set("jogak", a), window.history.pushState({}, "", `?${r.toString()}`);
|
|
940
947
|
}
|
|
941
|
-
function
|
|
948
|
+
function Lo({
|
|
942
949
|
entries: o,
|
|
943
950
|
metas: a,
|
|
944
951
|
codeTheme: r = "vsDark",
|
|
945
952
|
previewIsolation: t = "iframe",
|
|
946
|
-
|
|
953
|
+
userPreviewUrl: g = "",
|
|
954
|
+
previewEntryPath: n = "/__jogak_preview__/index.html",
|
|
955
|
+
userViteUrl: s
|
|
947
956
|
} = {}) {
|
|
948
|
-
const
|
|
957
|
+
const l = g !== "" ? g : s ?? "", i = R(() => {
|
|
949
958
|
if (o !== void 0) {
|
|
950
959
|
a !== void 0 && console.warn(
|
|
951
960
|
"[jogak] JogakApp received both `entries` and `metas` — `entries` (eager) takes precedence."
|
|
952
961
|
);
|
|
953
|
-
const
|
|
954
|
-
for (const
|
|
955
|
-
return
|
|
962
|
+
const u = new Y();
|
|
963
|
+
for (const f of o) u.register(f);
|
|
964
|
+
return u;
|
|
956
965
|
}
|
|
957
966
|
if (a !== void 0)
|
|
958
|
-
for (const
|
|
959
|
-
return
|
|
960
|
-
}, [o, a]),
|
|
961
|
-
(
|
|
962
|
-
), [
|
|
963
|
-
(
|
|
964
|
-
), [
|
|
965
|
-
|
|
966
|
-
const
|
|
967
|
-
const
|
|
968
|
-
|
|
967
|
+
for (const u of a) F.registerMeta(u);
|
|
968
|
+
return F;
|
|
969
|
+
}, [o, a]), d = R(() => U(), []), [k, c] = b(
|
|
970
|
+
(d == null ? void 0 : d.entryId) ?? null
|
|
971
|
+
), [x, p] = b(
|
|
972
|
+
(d == null ? void 0 : d.jogakName) ?? null
|
|
973
|
+
), [S, y] = b({});
|
|
974
|
+
h(() => {
|
|
975
|
+
const u = () => {
|
|
976
|
+
const f = U();
|
|
977
|
+
f !== null ? (c(f.entryId), p(f.jogakName), y({})) : (c(null), p(null));
|
|
969
978
|
};
|
|
970
|
-
return window.addEventListener("popstate",
|
|
971
|
-
window.removeEventListener("popstate",
|
|
979
|
+
return window.addEventListener("popstate", u), () => {
|
|
980
|
+
window.removeEventListener("popstate", u);
|
|
972
981
|
};
|
|
973
982
|
}, []);
|
|
974
|
-
const
|
|
975
|
-
|
|
976
|
-
}, []),
|
|
977
|
-
if (
|
|
978
|
-
const
|
|
979
|
-
|
|
983
|
+
const v = $((u, f) => {
|
|
984
|
+
c(u), p(f), y({}), So(u, f);
|
|
985
|
+
}, []), w = $((u, f) => {
|
|
986
|
+
if (c((m) => m === u ? u : m), p((m) => m ?? f), typeof window < "u") {
|
|
987
|
+
const m = new URLSearchParams(window.location.search);
|
|
988
|
+
m.get("entry") === u && m.get("jogak") === null && (m.set("jogak", f), window.history.replaceState({}, "", `?${m.toString()}`));
|
|
980
989
|
}
|
|
981
|
-
}, []),
|
|
982
|
-
|
|
983
|
-
}, []),
|
|
984
|
-
|
|
990
|
+
}, []), W = $((u, f) => {
|
|
991
|
+
y((m) => ({ ...m, [u]: f }));
|
|
992
|
+
}, []), A = $(() => {
|
|
993
|
+
y({});
|
|
985
994
|
}, []);
|
|
986
|
-
return /* @__PURE__ */ e(
|
|
995
|
+
return /* @__PURE__ */ e(T, { registry: i, children: /* @__PURE__ */ j(
|
|
987
996
|
"div",
|
|
988
997
|
{
|
|
989
998
|
"data-jogak-shell": !0,
|
|
990
999
|
className: "jogak:grid jogak:grid-cols-[260px_1fr] jogak:h-dvh jogak:overflow-hidden",
|
|
991
1000
|
children: [
|
|
992
1001
|
/* @__PURE__ */ e(
|
|
993
|
-
|
|
1002
|
+
ro,
|
|
994
1003
|
{
|
|
995
|
-
selectedEntryId:
|
|
996
|
-
selectedJogakName:
|
|
997
|
-
onSelect:
|
|
1004
|
+
selectedEntryId: k,
|
|
1005
|
+
selectedJogakName: x,
|
|
1006
|
+
onSelect: v
|
|
998
1007
|
}
|
|
999
1008
|
),
|
|
1000
|
-
/* @__PURE__ */ e("main", { className: "jogak:overflow-hidden jogak:min-h-0", children:
|
|
1001
|
-
|
|
1009
|
+
/* @__PURE__ */ e("main", { className: "jogak:overflow-hidden jogak:min-h-0", children: k !== null ? /* @__PURE__ */ e(
|
|
1010
|
+
mo,
|
|
1002
1011
|
{
|
|
1003
|
-
entryId:
|
|
1004
|
-
jogakName:
|
|
1005
|
-
overrideArgs:
|
|
1006
|
-
onArgChange:
|
|
1007
|
-
onReset:
|
|
1012
|
+
entryId: k,
|
|
1013
|
+
jogakName: x,
|
|
1014
|
+
overrideArgs: S,
|
|
1015
|
+
onArgChange: W,
|
|
1016
|
+
onReset: A,
|
|
1008
1017
|
codeTheme: r,
|
|
1009
|
-
onResolveJogak:
|
|
1018
|
+
onResolveJogak: w,
|
|
1010
1019
|
previewIsolation: t,
|
|
1011
|
-
|
|
1020
|
+
userPreviewUrl: l,
|
|
1021
|
+
previewEntryPath: n
|
|
1012
1022
|
}
|
|
1013
1023
|
) : /* @__PURE__ */ e("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" }) })
|
|
1014
1024
|
]
|
|
1015
1025
|
}
|
|
1016
1026
|
) });
|
|
1017
1027
|
}
|
|
1018
|
-
function
|
|
1019
|
-
const o =
|
|
1020
|
-
() => (
|
|
1028
|
+
function Mo() {
|
|
1029
|
+
const o = oo(), a = R(() => o.getAll(), [o]), r = R(() => o.getTree(), [o]), t = R(
|
|
1030
|
+
() => (g) => o.search(g),
|
|
1021
1031
|
[o]
|
|
1022
1032
|
);
|
|
1023
1033
|
return { entries: a, tree: r, search: t };
|
|
1024
1034
|
}
|
|
1025
1035
|
export {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1036
|
+
jo as Actions,
|
|
1037
|
+
lo as Controls,
|
|
1038
|
+
Lo as JogakApp,
|
|
1039
|
+
mo as Preview,
|
|
1040
|
+
ro as Sidebar,
|
|
1041
|
+
Mo as useRegistry
|
|
1032
1042
|
};
|