@photon-ai/pho-ui 4.25.0 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/chunks/{avatar-PgBOfszL.js → avatar-BJvgi8ON.js} +24 -30
- package/dist/chunks/avatar-BJvgi8ON.js.map +1 -0
- package/dist/chunks/{basic-page-DYBjCadG.js → basic-page-DSPzDKrZ.js} +80 -83
- package/dist/chunks/basic-page-DSPzDKrZ.js.map +1 -0
- package/dist/chunks/{box-search-CMl5bQ7Y.js → box-search-DD2EPtDy.js} +18 -19
- package/dist/chunks/box-search-DD2EPtDy.js.map +1 -0
- package/dist/chunks/{calendar-DDWITGo4.js → calendar-s-QRks1Z.js} +66 -69
- package/dist/chunks/calendar-s-QRks1Z.js.map +1 -0
- package/dist/chunks/{chat-D98GCjbe.js → chat-D6SGRahp.js} +226 -276
- package/dist/chunks/chat-D6SGRahp.js.map +1 -0
- package/dist/chunks/{checkbox-D8smFViR.js → checkbox-B3fVczYP.js} +2 -2
- package/dist/chunks/checkbox-B3fVczYP.js.map +1 -0
- package/dist/chunks/{close-button-Ck4rY1Fp.js → close-button-Bwv_OoCZ.js} +2 -2
- package/dist/chunks/close-button-Bwv_OoCZ.js.map +1 -0
- package/dist/chunks/{code-block-CthLWfxd.js → code-block-CiZWZBO2.js} +169 -238
- package/dist/chunks/code-block-CiZWZBO2.js.map +1 -0
- package/dist/chunks/copy-button-DNNZu6r4.js +69 -0
- package/dist/chunks/copy-button-DNNZu6r4.js.map +1 -0
- package/dist/chunks/{data-table-C1tLUdw0.js → data-table-CshUlqIu.js} +11 -12
- package/dist/chunks/data-table-CshUlqIu.js.map +1 -0
- package/dist/chunks/{date-picker-D-sWo3i8.js → date-picker-BaAkim2u.js} +126 -151
- package/dist/chunks/date-picker-BaAkim2u.js.map +1 -0
- package/dist/chunks/{description-list-DcTvBHzI.js → description-list-VTNz1MmJ.js} +2 -2
- package/dist/chunks/{description-list-DcTvBHzI.js.map → description-list-VTNz1MmJ.js.map} +1 -1
- package/dist/chunks/{dialog-H72fZGtf.js → dialog-C116Qr0w.js} +2 -2
- package/dist/chunks/{dialog-H72fZGtf.js.map → dialog-C116Qr0w.js.map} +1 -1
- package/dist/chunks/{filter-bar-D_sBAT5Y.js → filter-bar-DI5JO1Cd.js} +63 -72
- package/dist/chunks/filter-bar-DI5JO1Cd.js.map +1 -0
- package/dist/chunks/{ghost-search-CMUI2UH0.js → ghost-search-DhADxaWi.js} +11 -12
- package/dist/chunks/ghost-search-DhADxaWi.js.map +1 -0
- package/dist/chunks/icons-eq5FZ3Yc.js +1254 -0
- package/dist/chunks/icons-eq5FZ3Yc.js.map +1 -0
- package/dist/chunks/{input-DWnb33UF.js → input-hrrPhzXp.js} +37 -56
- package/dist/chunks/input-hrrPhzXp.js.map +1 -0
- package/dist/chunks/{select-Dux2SBVc.js → select-DlyDd7AB.js} +10 -10
- package/dist/chunks/select-DlyDd7AB.js.map +1 -0
- package/dist/chunks/{sidebar-ttBkgGRh.js → sidebar-DTRcoxrB.js} +95 -111
- package/dist/chunks/sidebar-DTRcoxrB.js.map +1 -0
- package/dist/chunks/{toast-Cbnn8lcA.js → toast-Btwu5Kjk.js} +7 -7
- package/dist/chunks/toast-Btwu5Kjk.js.map +1 -0
- package/dist/chunks/{trace-ClMpG82z.js → trace-CKYAff2U.js} +498 -607
- package/dist/chunks/trace-CKYAff2U.js.map +1 -0
- package/dist/components/avatar.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/chat.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/code-block.js +1 -1
- package/dist/components/command.js +36 -37
- package/dist/components/command.js.map +1 -1
- package/dist/components/copy-button.js +1 -1
- package/dist/components/data-table.js +2 -2
- package/dist/components/date-picker.js +1 -1
- package/dist/components/description-list.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/error.js +252 -11
- package/dist/components/error.js.map +1 -0
- package/dist/components/filter-bar.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/notification.js +27 -34
- package/dist/components/notification.js.map +1 -1
- package/dist/components/phone-input.js +3 -4
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/scope.js +52 -53
- package/dist/components/scope.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/theme-toggle.js +69 -95
- package/dist/components/theme-toggle.js.map +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/trace.js +1 -1
- package/dist/icons.js +235 -78
- package/dist/icons.js.map +1 -1
- package/dist/index.js +158 -158
- package/dist/sections/basic-page.js +2 -2
- package/dist/sections/sidebar.js +1 -1
- package/dist/src/components/avatar/avatar.d.ts +1 -1
- package/dist/src/components/notification/notification.d.ts +2 -2
- package/dist/src/components/trace/decorations.d.ts +3 -3
- package/dist/src/icons/index.d.ts +1 -0
- package/dist/src/icons/photon/icons.d.ts +315 -0
- package/dist/src/icons/photon/index.d.ts +2 -0
- package/dist/src/icons/photon/photon-icon.d.ts +51 -0
- package/package.json +5 -3
- package/src/styles/fonts.css +2 -1
- package/src/styles/theme.css +3 -1
- package/dist/chunks/IconArrowUpRight-OK8Fp0KQ.js +0 -14
- package/dist/chunks/IconArrowUpRight-OK8Fp0KQ.js.map +0 -1
- package/dist/chunks/IconCheck-DwSMn1wK.js +0 -11
- package/dist/chunks/IconCheck-DwSMn1wK.js.map +0 -1
- package/dist/chunks/IconChevronDown-Cd68NnX2.js +0 -11
- package/dist/chunks/IconChevronDown-Cd68NnX2.js.map +0 -1
- package/dist/chunks/IconChevronLeft-CptqhdxO.js +0 -11
- package/dist/chunks/IconChevronLeft-CptqhdxO.js.map +0 -1
- package/dist/chunks/IconChevronRight-BNkXCTk6.js +0 -11
- package/dist/chunks/IconChevronRight-BNkXCTk6.js.map +0 -1
- package/dist/chunks/IconChevronUp-Bxllwz8J.js +0 -11
- package/dist/chunks/IconChevronUp-Bxllwz8J.js.map +0 -1
- package/dist/chunks/IconInfoCircle-CTAynhe8.js +0 -21
- package/dist/chunks/IconInfoCircle-CTAynhe8.js.map +0 -1
- package/dist/chunks/IconSearch-DkcWWZ1H.js +0 -14
- package/dist/chunks/IconSearch-DkcWWZ1H.js.map +0 -1
- package/dist/chunks/IconX-DnPlFC68.js +0 -14
- package/dist/chunks/IconX-DnPlFC68.js.map +0 -1
- package/dist/chunks/avatar-PgBOfszL.js.map +0 -1
- package/dist/chunks/basic-page-DYBjCadG.js.map +0 -1
- package/dist/chunks/box-search-CMl5bQ7Y.js.map +0 -1
- package/dist/chunks/calendar-DDWITGo4.js.map +0 -1
- package/dist/chunks/chat-D98GCjbe.js.map +0 -1
- package/dist/chunks/checkbox-D8smFViR.js.map +0 -1
- package/dist/chunks/close-button-Ck4rY1Fp.js.map +0 -1
- package/dist/chunks/code-block-CthLWfxd.js.map +0 -1
- package/dist/chunks/copy-button-BLvirhXk.js +0 -76
- package/dist/chunks/copy-button-BLvirhXk.js.map +0 -1
- package/dist/chunks/data-table-C1tLUdw0.js.map +0 -1
- package/dist/chunks/date-picker-D-sWo3i8.js.map +0 -1
- package/dist/chunks/error-BT71wcUd.js +0 -270
- package/dist/chunks/error-BT71wcUd.js.map +0 -1
- package/dist/chunks/filter-bar-D_sBAT5Y.js.map +0 -1
- package/dist/chunks/ghost-search-CMUI2UH0.js.map +0 -1
- package/dist/chunks/input-DWnb33UF.js.map +0 -1
- package/dist/chunks/select-Dux2SBVc.js.map +0 -1
- package/dist/chunks/sidebar-ttBkgGRh.js.map +0 -1
- package/dist/chunks/toast-Cbnn8lcA.js.map +0 -1
- package/dist/chunks/trace-ClMpG82z.js.map +0 -1
|
@@ -1,82 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as he } from "./IconChevronUp-Bxllwz8J.js";
|
|
7
|
-
import { n as fe } from "./copy-button-BLvirhXk.js";
|
|
2
|
+
import { t as L } from "./cn-CPbhpG1q.js";
|
|
3
|
+
import { a as ut } from "./button-KM0lAQ4x.js";
|
|
4
|
+
import { $ as dt, B as mt, F as ht, M as ft } from "./icons-eq5FZ3Yc.js";
|
|
5
|
+
import { t as yt } from "./createReactComponent-yKZn9MIX.js";
|
|
8
6
|
import { t as d } from "./scroll-area-DjdSnx2p.js";
|
|
9
|
-
import { n as
|
|
7
|
+
import { n as gt } from "./copy-button-DNNZu6r4.js";
|
|
8
|
+
import { n as xt } from "./toggle-DeFSPgIj.js";
|
|
10
9
|
import { t as g } from "./tooltip-4J1PUJmB.js";
|
|
11
|
-
import { useEffect as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
var
|
|
14
|
-
["path", {
|
|
15
|
-
d: "M16 4l4 0l0 4",
|
|
16
|
-
key: "svg-0"
|
|
17
|
-
}],
|
|
18
|
-
["path", {
|
|
19
|
-
d: "M14 10l6 -6",
|
|
20
|
-
key: "svg-1"
|
|
21
|
-
}],
|
|
22
|
-
["path", {
|
|
23
|
-
d: "M8 20l-4 0l0 -4",
|
|
24
|
-
key: "svg-2"
|
|
25
|
-
}],
|
|
26
|
-
["path", {
|
|
27
|
-
d: "M4 20l6 -6",
|
|
28
|
-
key: "svg-3"
|
|
29
|
-
}],
|
|
30
|
-
["path", {
|
|
31
|
-
d: "M16 20l4 0l0 -4",
|
|
32
|
-
key: "svg-4"
|
|
33
|
-
}],
|
|
34
|
-
["path", {
|
|
35
|
-
d: "M14 14l6 6",
|
|
36
|
-
key: "svg-5"
|
|
37
|
-
}],
|
|
38
|
-
["path", {
|
|
39
|
-
d: "M8 4l-4 0l0 4",
|
|
40
|
-
key: "svg-6"
|
|
41
|
-
}],
|
|
42
|
-
["path", {
|
|
43
|
-
d: "M4 4l6 6",
|
|
44
|
-
key: "svg-7"
|
|
45
|
-
}]
|
|
46
|
-
], ke = z("outline", "arrows-maximize", "ArrowsMaximize", we), be = [
|
|
47
|
-
["path", {
|
|
48
|
-
d: "M5 9l4 0l0 -4",
|
|
49
|
-
key: "svg-0"
|
|
50
|
-
}],
|
|
51
|
-
["path", {
|
|
52
|
-
d: "M3 3l6 6",
|
|
53
|
-
key: "svg-1"
|
|
54
|
-
}],
|
|
55
|
-
["path", {
|
|
56
|
-
d: "M5 15l4 0l0 4",
|
|
57
|
-
key: "svg-2"
|
|
58
|
-
}],
|
|
59
|
-
["path", {
|
|
60
|
-
d: "M3 21l6 -6",
|
|
61
|
-
key: "svg-3"
|
|
62
|
-
}],
|
|
63
|
-
["path", {
|
|
64
|
-
d: "M19 9l-4 0l0 -4",
|
|
65
|
-
key: "svg-4"
|
|
66
|
-
}],
|
|
67
|
-
["path", {
|
|
68
|
-
d: "M15 9l6 -6",
|
|
69
|
-
key: "svg-5"
|
|
70
|
-
}],
|
|
71
|
-
["path", {
|
|
72
|
-
d: "M19 15l-4 0l0 4",
|
|
73
|
-
key: "svg-6"
|
|
74
|
-
}],
|
|
75
|
-
["path", {
|
|
76
|
-
d: "M15 15l6 6",
|
|
77
|
-
key: "svg-7"
|
|
78
|
-
}]
|
|
79
|
-
], Me = z("outline", "arrows-minimize", "ArrowsMinimize", be), Ce = [
|
|
10
|
+
import { useEffect as wt, useMemo as D, useState as H, useSyncExternalStore as bt } from "react";
|
|
11
|
+
import { Fragment as vt, jsx as o, jsxs as m } from "react/jsx-runtime";
|
|
12
|
+
var kt = [
|
|
80
13
|
["path", {
|
|
81
14
|
d: "M4 6l16 0",
|
|
82
15
|
key: "svg-0"
|
|
@@ -89,7 +22,7 @@ var we = [
|
|
|
89
22
|
d: "M4 12h13a3 3 0 0 1 0 6h-4l2 -2m0 4l-2 -2",
|
|
90
23
|
key: "svg-2"
|
|
91
24
|
}]
|
|
92
|
-
],
|
|
25
|
+
], Ct = yt("outline", "text-wrap", "TextWrap", kt), J = {
|
|
93
26
|
json: () => import("@shikijs/langs/json"),
|
|
94
27
|
jsonc: () => import("@shikijs/langs/jsonc"),
|
|
95
28
|
javascript: () => import("@shikijs/langs/javascript"),
|
|
@@ -117,7 +50,7 @@ var we = [
|
|
|
117
50
|
http: () => import("@shikijs/langs/http"),
|
|
118
51
|
markdown: () => import("@shikijs/langs/markdown"),
|
|
119
52
|
diff: () => import("@shikijs/langs/diff")
|
|
120
|
-
},
|
|
53
|
+
}, F = {
|
|
121
54
|
js: "javascript",
|
|
122
55
|
ts: "typescript",
|
|
123
56
|
bash: "shellscript",
|
|
@@ -133,10 +66,10 @@ var we = [
|
|
|
133
66
|
md: "markdown",
|
|
134
67
|
htm: "html"
|
|
135
68
|
};
|
|
136
|
-
function
|
|
137
|
-
return Object.hasOwn(
|
|
69
|
+
function w(t) {
|
|
70
|
+
return Object.hasOwn(F, t) ? F[t] : Object.hasOwn(J, t) ? t : null;
|
|
138
71
|
}
|
|
139
|
-
var
|
|
72
|
+
var V = {
|
|
140
73
|
key: "text-pho-code-key",
|
|
141
74
|
string: "text-pho-code-string",
|
|
142
75
|
number: "text-pho-code-number",
|
|
@@ -147,17 +80,17 @@ var Y = {
|
|
|
147
80
|
type: "text-pho-code-type",
|
|
148
81
|
plain: void 0
|
|
149
82
|
};
|
|
150
|
-
function
|
|
151
|
-
return `var(--color-pho-code-${
|
|
83
|
+
function Nt(t) {
|
|
84
|
+
return `var(--color-pho-code-${t})`;
|
|
152
85
|
}
|
|
153
|
-
function
|
|
154
|
-
const
|
|
155
|
-
return
|
|
86
|
+
function St(t) {
|
|
87
|
+
const e = t?.match(/^var\(--color-pho-code-([a-z]+)\)$/)?.[1];
|
|
88
|
+
return e != null && e in V && e !== "plain" ? e : "plain";
|
|
156
89
|
}
|
|
157
|
-
var s = (
|
|
158
|
-
scope:
|
|
159
|
-
settings: { foreground:
|
|
160
|
-
}),
|
|
90
|
+
var s = (t, e) => ({
|
|
91
|
+
scope: e,
|
|
92
|
+
settings: { foreground: t === "plain" ? "var(--color-pho-code-fg)" : Nt(t) }
|
|
93
|
+
}), Tt = {
|
|
161
94
|
name: "pho",
|
|
162
95
|
type: "light",
|
|
163
96
|
fg: "var(--color-pho-code-fg)",
|
|
@@ -229,33 +162,33 @@ var s = (e, t) => ({
|
|
|
229
162
|
"meta.brace"
|
|
230
163
|
])
|
|
231
164
|
]
|
|
232
|
-
},
|
|
233
|
-
function
|
|
234
|
-
return
|
|
235
|
-
themes: [
|
|
165
|
+
}, N = null, K = null, S = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map();
|
|
166
|
+
function Et() {
|
|
167
|
+
return K ??= Promise.all([import("shiki/core"), import("shiki/engine/javascript")]).then(([{ createHighlighterCore: t }, { createJavaScriptRegexEngine: e }]) => t({
|
|
168
|
+
themes: [Tt],
|
|
236
169
|
langs: [],
|
|
237
|
-
engine:
|
|
238
|
-
})).then((
|
|
170
|
+
engine: e({ forgiving: !0 })
|
|
171
|
+
})).then((t) => (N = t, t)), K;
|
|
239
172
|
}
|
|
240
|
-
function
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
let n =
|
|
244
|
-
return n == null && (n = Promise.all([
|
|
245
|
-
|
|
173
|
+
function Ot(t) {
|
|
174
|
+
const e = w(t);
|
|
175
|
+
if (e == null || S.has(e)) return Promise.resolve();
|
|
176
|
+
let n = E.get(e);
|
|
177
|
+
return n == null && (n = Promise.all([Et(), J[e]()]).then(([r, a]) => r.loadLanguage(...a.default)).then(() => {
|
|
178
|
+
S.add(e);
|
|
246
179
|
}).finally(() => {
|
|
247
|
-
|
|
248
|
-
}),
|
|
180
|
+
E.delete(e);
|
|
181
|
+
}), E.set(e, n)), n;
|
|
249
182
|
}
|
|
250
|
-
function
|
|
251
|
-
const
|
|
252
|
-
return
|
|
183
|
+
function ee(t) {
|
|
184
|
+
const e = w(t);
|
|
185
|
+
return e != null && N != null && S.has(e);
|
|
253
186
|
}
|
|
254
|
-
function
|
|
255
|
-
return
|
|
187
|
+
function Lt(t) {
|
|
188
|
+
return t.map((e) => {
|
|
256
189
|
const n = [];
|
|
257
|
-
for (const r of
|
|
258
|
-
const a =
|
|
190
|
+
for (const r of e) {
|
|
191
|
+
const a = St(r.color), i = n[n.length - 1];
|
|
259
192
|
i != null && i.type === a ? i.text += r.content : n.push({
|
|
260
193
|
type: a,
|
|
261
194
|
text: r.content
|
|
@@ -264,253 +197,251 @@ function Oe(e) {
|
|
|
264
197
|
return n;
|
|
265
198
|
});
|
|
266
199
|
}
|
|
267
|
-
function
|
|
268
|
-
const n =
|
|
269
|
-
return n == null ||
|
|
200
|
+
function Y(t, e) {
|
|
201
|
+
const n = w(e);
|
|
202
|
+
return n == null || N == null || !S.has(n) ? null : Lt(N.codeToTokensBase(t, {
|
|
270
203
|
lang: n,
|
|
271
204
|
theme: "pho"
|
|
272
205
|
}));
|
|
273
206
|
}
|
|
274
|
-
function
|
|
275
|
-
return
|
|
276
|
-
`).map((
|
|
207
|
+
function M(t) {
|
|
208
|
+
return t.split(`
|
|
209
|
+
`).map((e) => [{
|
|
277
210
|
type: "plain",
|
|
278
|
-
text:
|
|
211
|
+
text: e
|
|
279
212
|
}]);
|
|
280
213
|
}
|
|
281
|
-
async function
|
|
282
|
-
return
|
|
214
|
+
async function Mt(t, e) {
|
|
215
|
+
return w(e) == null ? M(t) : (await Ot(e), Y(t, e) ?? M(t));
|
|
283
216
|
}
|
|
284
|
-
var
|
|
285
|
-
function
|
|
286
|
-
const n = h.get(
|
|
217
|
+
var jt = 200, h = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Set();
|
|
218
|
+
function U(t, e) {
|
|
219
|
+
const n = h.get(t);
|
|
287
220
|
if (n != null) return n;
|
|
288
|
-
if (h.size >=
|
|
221
|
+
if (h.size >= jt) {
|
|
289
222
|
const r = h.keys().next().value;
|
|
290
223
|
r != null && h.delete(r);
|
|
291
224
|
}
|
|
292
|
-
return h.set(
|
|
225
|
+
return h.set(t, e), e;
|
|
293
226
|
}
|
|
294
|
-
function
|
|
295
|
-
return
|
|
296
|
-
|
|
227
|
+
function _t(t) {
|
|
228
|
+
return j.add(t), () => {
|
|
229
|
+
j.delete(t);
|
|
297
230
|
};
|
|
298
231
|
}
|
|
299
|
-
function
|
|
300
|
-
for (const
|
|
232
|
+
function At() {
|
|
233
|
+
for (const t of j) t();
|
|
301
234
|
}
|
|
302
|
-
function
|
|
303
|
-
return `${
|
|
235
|
+
function It(t, e) {
|
|
236
|
+
return `${t}\0${e}`;
|
|
304
237
|
}
|
|
305
|
-
function
|
|
306
|
-
const n =
|
|
238
|
+
function $t(t, e) {
|
|
239
|
+
const n = w(e), r = n != null ? It(n, t) : null, a = bt(_t, () => {
|
|
307
240
|
if (r == null) return null;
|
|
308
241
|
const i = h.get(r);
|
|
309
242
|
if (i != null) return i;
|
|
310
|
-
const l =
|
|
311
|
-
return l != null ?
|
|
243
|
+
const l = Y(t, e);
|
|
244
|
+
return l != null ? U(r, l) : null;
|
|
312
245
|
}, () => null);
|
|
313
|
-
return
|
|
314
|
-
r == null || h.has(r) ||
|
|
315
|
-
|
|
246
|
+
return wt(() => {
|
|
247
|
+
r == null || h.has(r) || Mt(t, e).then((i) => {
|
|
248
|
+
U(r, i), At();
|
|
316
249
|
}, () => {
|
|
317
250
|
});
|
|
318
251
|
}, [
|
|
319
252
|
r,
|
|
320
|
-
|
|
321
|
-
|
|
253
|
+
t,
|
|
254
|
+
e
|
|
322
255
|
]), a;
|
|
323
256
|
}
|
|
324
|
-
var
|
|
325
|
-
function
|
|
326
|
-
const
|
|
257
|
+
var O = /("(?:[^"\\]|\\.)*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|\b(true|false|null)\b|([{}[\]:,])/g;
|
|
258
|
+
function Pt(t) {
|
|
259
|
+
const e = [];
|
|
327
260
|
let n = 0;
|
|
328
|
-
|
|
329
|
-
for (let r =
|
|
330
|
-
r.index > n &&
|
|
261
|
+
O.lastIndex = 0;
|
|
262
|
+
for (let r = O.exec(t); r != null; r = O.exec(t)) {
|
|
263
|
+
r.index > n && e.push({
|
|
331
264
|
type: "plain",
|
|
332
|
-
text:
|
|
265
|
+
text: t.slice(n, r.index)
|
|
333
266
|
});
|
|
334
|
-
const [, a, i, l, f,
|
|
335
|
-
a != null ? (
|
|
267
|
+
const [, a, i, l, f, b] = r;
|
|
268
|
+
a != null ? (e.push({
|
|
336
269
|
type: i != null ? "key" : "string",
|
|
337
270
|
text: a
|
|
338
|
-
}), i != null &&
|
|
271
|
+
}), i != null && e.push({
|
|
339
272
|
type: "punctuation",
|
|
340
273
|
text: i
|
|
341
|
-
})) : l != null ?
|
|
274
|
+
})) : l != null ? e.push({
|
|
342
275
|
type: "number",
|
|
343
276
|
text: l
|
|
344
|
-
}) : f != null ?
|
|
277
|
+
}) : f != null ? e.push({
|
|
345
278
|
type: "keyword",
|
|
346
279
|
text: f
|
|
347
|
-
}) :
|
|
280
|
+
}) : b != null && e.push({
|
|
348
281
|
type: "punctuation",
|
|
349
|
-
text:
|
|
282
|
+
text: b
|
|
350
283
|
}), n = r.index + r[0].length;
|
|
351
284
|
}
|
|
352
|
-
return n <
|
|
285
|
+
return n < t.length && e.push({
|
|
353
286
|
type: "plain",
|
|
354
|
-
text:
|
|
355
|
-
}),
|
|
287
|
+
text: t.slice(n)
|
|
288
|
+
}), e;
|
|
356
289
|
}
|
|
357
|
-
var
|
|
358
|
-
function
|
|
359
|
-
if (
|
|
360
|
-
if (typeof
|
|
290
|
+
var zt = "rounded-base border border-pho-secondary bg-pho-code-bg text-pho-code-fg", Rt = "1.25rem", Bt = "0.75rem";
|
|
291
|
+
function Gt(t) {
|
|
292
|
+
if (t == null) return "";
|
|
293
|
+
if (typeof t == "string") return t;
|
|
361
294
|
try {
|
|
362
|
-
return JSON.stringify(
|
|
295
|
+
return JSON.stringify(t, null, 2) ?? "";
|
|
363
296
|
} catch {
|
|
364
|
-
return String(
|
|
297
|
+
return String(t);
|
|
365
298
|
}
|
|
366
299
|
}
|
|
367
|
-
function
|
|
368
|
-
return
|
|
369
|
-
`).map((n) =>
|
|
300
|
+
function Wt(t, e) {
|
|
301
|
+
return e === "json" || e === "jsonc" ? t.split(`
|
|
302
|
+
`).map((n) => Pt(n)) : M(t);
|
|
370
303
|
}
|
|
371
|
-
var
|
|
304
|
+
var Dt = [
|
|
372
305
|
void 0,
|
|
373
306
|
"pr-12",
|
|
374
307
|
"pr-20",
|
|
375
308
|
"pr-28"
|
|
376
309
|
];
|
|
377
|
-
function
|
|
378
|
-
return /* @__PURE__ */ m(g.Root, { children: [/* @__PURE__ */ o(g.Trigger, { render: /* @__PURE__ */ o(
|
|
310
|
+
function q({ label: t, pressed: e, onPressedChange: n, children: r }) {
|
|
311
|
+
return /* @__PURE__ */ m(g.Root, { children: [/* @__PURE__ */ o(g.Trigger, { render: /* @__PURE__ */ o(xt, {
|
|
379
312
|
size: "sm",
|
|
380
|
-
pressed:
|
|
313
|
+
pressed: e,
|
|
381
314
|
onPressedChange: n,
|
|
382
|
-
"aria-label":
|
|
315
|
+
"aria-label": t,
|
|
383
316
|
className: "rounded-sm",
|
|
384
317
|
children: r
|
|
385
|
-
}) }), /* @__PURE__ */ o(g.Portal, { children: /* @__PURE__ */ o(g.Positioner, { children: /* @__PURE__ */ o(g.Popup, { children:
|
|
318
|
+
}) }), /* @__PURE__ */ o(g.Portal, { children: /* @__PURE__ */ o(g.Positioner, { children: /* @__PURE__ */ o(g.Popup, { children: t }) }) })] });
|
|
386
319
|
}
|
|
387
|
-
function
|
|
388
|
-
return /* @__PURE__ */ o("code", { children:
|
|
320
|
+
function Ht({ lines: t, lineNumbers: e, digits: n, wrap: r }) {
|
|
321
|
+
return /* @__PURE__ */ o("code", { children: t.map((a, i) => /* @__PURE__ */ m("span", {
|
|
389
322
|
"data-line": "",
|
|
390
|
-
className:
|
|
391
|
-
children: [
|
|
323
|
+
className: L("min-h-5", e ? "flex items-start" : "block", e && !r && "min-w-max"),
|
|
324
|
+
children: [e ? /* @__PURE__ */ o("span", {
|
|
392
325
|
"data-line-number": "",
|
|
393
326
|
"aria-hidden": !0,
|
|
394
327
|
className: "text-pho-placeholder bg-pho-code-bg sticky left-0 z-[1] box-content shrink-0 pr-3 pl-3 text-right font-mono text-xs leading-5 tabular-nums select-none",
|
|
395
328
|
style: { width: `${n}ch` },
|
|
396
329
|
children: i + 1
|
|
397
330
|
}) : null, /* @__PURE__ */ o("span", {
|
|
398
|
-
className:
|
|
331
|
+
className: e ? "min-w-0 flex-1" : void 0,
|
|
399
332
|
children: a.map((l, f) => l.type === "plain" ? l.text : /* @__PURE__ */ o("span", {
|
|
400
|
-
className:
|
|
333
|
+
className: V[l.type],
|
|
401
334
|
children: l.text
|
|
402
335
|
}, f))
|
|
403
336
|
})]
|
|
404
337
|
}, i)) });
|
|
405
338
|
}
|
|
406
|
-
function
|
|
407
|
-
const x =
|
|
408
|
-
const u =
|
|
339
|
+
function Ft({ code: t, language: e = "text", title: n, maxLines: r = 30, overflow: a = "scroll", wrap: i, defaultWrap: l = !1, onWrapChange: f, expandToggle: b = !0, wrapToggle: Q = !0, lineNumbers: _ = !1, copy: X = !0, empty: Z = "Nothing to show.", actions: T, className: tt, ...et }) {
|
|
340
|
+
const x = D(() => Gt(t), [t]), y = $t(x, e), c = D(() => {
|
|
341
|
+
const u = Wt(x, e);
|
|
409
342
|
return y != null && y.length === u.length ? y : u;
|
|
410
343
|
}, [
|
|
411
344
|
x,
|
|
412
|
-
|
|
345
|
+
e,
|
|
413
346
|
y
|
|
414
|
-
]), [
|
|
415
|
-
i == null &&
|
|
416
|
-
}, [p,
|
|
417
|
-
|
|
418
|
-
/* @__PURE__ */ m(g.Provider, { children: [
|
|
419
|
-
label:
|
|
347
|
+
]), [nt, rt] = H(l), v = i ?? nt, ot = (u) => {
|
|
348
|
+
i == null && rt(u), f?.(u);
|
|
349
|
+
}, [p, A] = H(!1), k = c.length > r, I = a === "scroll" && k && !p, it = a === "expand" && k && !p ? c.slice(0, r) : c, C = x === "", $ = a === "scroll" && b && k && !C, P = Q && !C, z = X && !C, R = n != null, B = Number($) + Number(P) + Number(z), at = T != null || B > 0, lt = typeof n == "string" ? n.toLowerCase() : "code", st = typeof n == "string" ? n : "Code", pt = p ? `Collapse to ${r} lines` : `Show all ${c.length} lines`, ct = String(Math.max(c.length, 1)).length, G = /* @__PURE__ */ m(vt, { children: [
|
|
350
|
+
T,
|
|
351
|
+
/* @__PURE__ */ m(g.Provider, { children: [$ ? /* @__PURE__ */ o(q, {
|
|
352
|
+
label: pt,
|
|
420
353
|
pressed: p,
|
|
421
|
-
onPressedChange:
|
|
422
|
-
children: p ? /* @__PURE__ */ o(
|
|
423
|
-
}) : null, P ? /* @__PURE__ */ o(
|
|
354
|
+
onPressedChange: A,
|
|
355
|
+
children: p ? /* @__PURE__ */ o(mt, { "aria-hidden": !0 }) : /* @__PURE__ */ o(dt, { "aria-hidden": !0 })
|
|
356
|
+
}) : null, P ? /* @__PURE__ */ o(q, {
|
|
424
357
|
label: "Wrap long lines",
|
|
425
|
-
pressed:
|
|
426
|
-
onPressedChange:
|
|
427
|
-
children: /* @__PURE__ */ o(
|
|
358
|
+
pressed: v,
|
|
359
|
+
onPressedChange: ot,
|
|
360
|
+
children: /* @__PURE__ */ o(Ct, { "aria-hidden": !0 })
|
|
428
361
|
}) : null] }),
|
|
429
|
-
|
|
362
|
+
z ? /* @__PURE__ */ o(gt, {
|
|
430
363
|
value: x,
|
|
431
|
-
label:
|
|
364
|
+
label: lt,
|
|
432
365
|
size: "md"
|
|
433
366
|
}) : null
|
|
434
|
-
] }),
|
|
435
|
-
className:
|
|
436
|
-
children: /* @__PURE__ */ o(
|
|
437
|
-
lines:
|
|
438
|
-
lineNumbers:
|
|
439
|
-
digits:
|
|
440
|
-
wrap:
|
|
367
|
+
] }), W = /* @__PURE__ */ o("pre", {
|
|
368
|
+
className: L("m-0 min-w-0 py-3 font-mono text-xs leading-5", _ ? "pr-3 pl-0" : "px-3", !R && Dt[Math.min(B + (T != null ? 1 : 0), 3)], v ? "[overflow-wrap:anywhere] whitespace-pre-wrap" : I ? "w-max min-w-full whitespace-pre" : "max-w-full overflow-x-auto whitespace-pre"),
|
|
369
|
+
children: /* @__PURE__ */ o(Ht, {
|
|
370
|
+
lines: it,
|
|
371
|
+
lineNumbers: _,
|
|
372
|
+
digits: ct,
|
|
373
|
+
wrap: v
|
|
441
374
|
})
|
|
442
375
|
});
|
|
443
376
|
return /* @__PURE__ */ m("div", {
|
|
444
377
|
"data-code-block": "",
|
|
445
|
-
"data-language":
|
|
378
|
+
"data-language": e,
|
|
446
379
|
"data-overflow": a,
|
|
447
380
|
"data-highlighted": y != null && c === y ? "" : void 0,
|
|
448
|
-
className:
|
|
449
|
-
...
|
|
381
|
+
className: L(zt, "relative flex w-full min-w-0 flex-col overflow-hidden", tt),
|
|
382
|
+
...et,
|
|
450
383
|
children: [
|
|
451
|
-
|
|
384
|
+
R ? /* @__PURE__ */ m("div", {
|
|
452
385
|
className: "border-pho-secondary flex min-h-10 items-center gap-2 border-b py-1 pr-1.5 pl-3",
|
|
453
386
|
children: [/* @__PURE__ */ o("div", {
|
|
454
387
|
className: "text-pho-secondary min-w-0 flex-1 truncate text-xs font-medium",
|
|
455
388
|
children: n
|
|
456
|
-
}),
|
|
457
|
-
}) :
|
|
389
|
+
}), G]
|
|
390
|
+
}) : at ? /* @__PURE__ */ o("div", {
|
|
458
391
|
className: "bg-pho-code-bg absolute top-1 right-1.5 z-10 flex items-center gap-2 rounded-sm",
|
|
459
|
-
children:
|
|
392
|
+
children: G
|
|
460
393
|
}) : null,
|
|
461
|
-
|
|
394
|
+
C ? /* @__PURE__ */ o("p", {
|
|
462
395
|
className: "text-pho-description m-0 px-3 py-3 text-base",
|
|
463
|
-
children:
|
|
464
|
-
}) :
|
|
396
|
+
children: Z
|
|
397
|
+
}) : I ? /* @__PURE__ */ o("section", {
|
|
465
398
|
className: "min-w-0",
|
|
466
399
|
children: /* @__PURE__ */ m(d.Root, {
|
|
467
400
|
fade: !1,
|
|
468
401
|
"data-code-scroll": "",
|
|
469
402
|
className: "min-w-0 rounded-b-[inherit]",
|
|
470
|
-
style: { height: `calc(${r} * ${
|
|
403
|
+
style: { height: `calc(${r} * ${Rt} + ${Bt} * 2)` },
|
|
471
404
|
children: [
|
|
472
405
|
/* @__PURE__ */ o(d.Viewport, {
|
|
473
406
|
tabIndex: 0,
|
|
474
|
-
"aria-label":
|
|
475
|
-
children: /* @__PURE__ */ o(d.Content, { children:
|
|
407
|
+
"aria-label": st,
|
|
408
|
+
children: /* @__PURE__ */ o(d.Content, { children: W })
|
|
476
409
|
}),
|
|
477
410
|
/* @__PURE__ */ o(d.Scrollbar, { children: /* @__PURE__ */ o(d.Thumb, {}) }),
|
|
478
|
-
|
|
411
|
+
v ? null : /* @__PURE__ */ o(d.Scrollbar, {
|
|
479
412
|
orientation: "horizontal",
|
|
480
413
|
children: /* @__PURE__ */ o(d.Thumb, {})
|
|
481
414
|
})
|
|
482
415
|
]
|
|
483
416
|
})
|
|
484
|
-
}) :
|
|
485
|
-
a === "expand" &&
|
|
417
|
+
}) : W,
|
|
418
|
+
a === "expand" && k ? /* @__PURE__ */ o("div", {
|
|
486
419
|
className: "border-pho-secondary flex items-center border-t px-1.5 py-1",
|
|
487
|
-
children: /* @__PURE__ */ o(
|
|
420
|
+
children: /* @__PURE__ */ o(ut, {
|
|
488
421
|
variant: "ghost",
|
|
489
422
|
size: "sm",
|
|
490
423
|
"aria-expanded": p,
|
|
491
|
-
prefix: p ?
|
|
492
|
-
onClick: () =>
|
|
424
|
+
prefix: p ? ht : ft,
|
|
425
|
+
onClick: () => A((u) => !u),
|
|
493
426
|
children: p ? "Show less" : `Show all ${c.length} lines`
|
|
494
427
|
})
|
|
495
428
|
}) : null
|
|
496
429
|
]
|
|
497
430
|
});
|
|
498
431
|
}
|
|
499
|
-
|
|
432
|
+
Ft.displayName = "CodeBlock";
|
|
500
433
|
export {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
Ue as t,
|
|
513
|
-
K as u
|
|
434
|
+
ee as a,
|
|
435
|
+
V as c,
|
|
436
|
+
w as d,
|
|
437
|
+
Y as i,
|
|
438
|
+
J as l,
|
|
439
|
+
Pt as n,
|
|
440
|
+
Ot as o,
|
|
441
|
+
Mt as r,
|
|
442
|
+
$t as s,
|
|
443
|
+
Ft as t,
|
|
444
|
+
F as u
|
|
514
445
|
};
|
|
515
446
|
|
|
516
|
-
//# sourceMappingURL=code-block-
|
|
447
|
+
//# sourceMappingURL=code-block-CiZWZBO2.js.map
|