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