laif-ds 0.2.78 → 0.2.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +25 -0
- package/dist/_virtual/index3.js +5 -5
- package/dist/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +4 -4
- package/dist/agent-docs/adoption-report.json +10 -10
- package/dist/agent-docs/components/AppEditor.md +4 -4
- package/dist/agent-docs/components/AppSelect.md +46 -0
- package/dist/agent-docs/manifest.json +5 -3
- package/dist/components/editor/editor-ui/content-editable.js +15 -8
- package/dist/components/ui/app-editor.js +88 -76
- package/dist/components/ui/app-select.js +232 -143
- package/dist/components/ui/date-picker.js +184 -153
- package/dist/components/ui/markdown-renderer.js +40 -30
- package/dist/index.d.ts +3 -1
- package/dist/node_modules/comma-separated-tokens/index.js +16 -5
- package/dist/node_modules/entities/dist/esm/decode-codepoint.js +39 -0
- package/dist/node_modules/entities/dist/esm/decode.js +246 -0
- package/dist/node_modules/entities/dist/esm/generated/decode-data-html.js +8 -0
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/hast-util-from-parse5/lib/index.js +146 -0
- package/dist/node_modules/hast-util-parse-selector/lib/index.js +21 -0
- package/dist/node_modules/hast-util-raw/lib/index.js +218 -0
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/hast-util-to-parse5/lib/index.js +119 -0
- package/dist/node_modules/hastscript/lib/create-h.js +113 -0
- package/dist/node_modules/hastscript/lib/index.js +9 -0
- package/dist/node_modules/hastscript/lib/svg-case-sensitive-tag-names.js +45 -0
- package/dist/node_modules/parse5/dist/common/doctype.js +99 -0
- package/dist/node_modules/parse5/dist/common/error-codes.js +8 -0
- package/dist/node_modules/parse5/dist/common/foreign-content.js +211 -0
- package/dist/node_modules/parse5/dist/common/html.js +251 -0
- package/dist/node_modules/parse5/dist/common/token.js +15 -0
- package/dist/node_modules/parse5/dist/common/unicode.js +74 -0
- package/dist/node_modules/parse5/dist/parser/formatting-element-list.js +85 -0
- package/dist/node_modules/parse5/dist/parser/index.js +2272 -0
- package/dist/node_modules/parse5/dist/parser/open-element-stack.js +241 -0
- package/dist/node_modules/parse5/dist/serializer/index.js +3 -0
- package/dist/node_modules/parse5/dist/tokenizer/index.js +1941 -0
- package/dist/node_modules/parse5/dist/tokenizer/preprocessor.js +89 -0
- package/dist/node_modules/parse5/dist/tree-adapters/default.js +163 -0
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/rehype-raw/lib/index.js +13 -0
- package/dist/node_modules/space-separated-tokens/index.js +8 -3
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/node_modules/vfile-location/lib/index.js +43 -0
- package/dist/node_modules/web-namespaces/index.js +12 -0
- package/dist/styles.v3.css +1 -1
- package/package.json +2 -1
|
@@ -1,127 +1,143 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import * as
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { designTokens as
|
|
6
|
-
import { Calendar as
|
|
7
|
-
import { Icon as
|
|
8
|
-
import { Label as
|
|
9
|
-
import { Popover as
|
|
10
|
-
import { cn as
|
|
11
|
-
import { TimePickerColumn as
|
|
12
|
-
import { it as
|
|
13
|
-
import { formatDate as
|
|
14
|
-
import { isSameDay as
|
|
15
|
-
const
|
|
16
|
-
if (!Number.isFinite(
|
|
17
|
-
const
|
|
18
|
-
return Math.min(59, Math.max(1,
|
|
2
|
+
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import * as c from "react";
|
|
4
|
+
import { useCallback as X, useMemo as H, useEffect as G } from "react";
|
|
5
|
+
import { designTokens as l } from "../design-tokens.js";
|
|
6
|
+
import { Calendar as J, CalendarDayButton as Ce } from "./calendar.js";
|
|
7
|
+
import { Icon as K } from "./icon.js";
|
|
8
|
+
import { Label as xe } from "./label.js";
|
|
9
|
+
import { Popover as be, PopoverTrigger as De, PopoverContent as Me } from "./popover.js";
|
|
10
|
+
import { cn as Q } from "../../lib/utils.js";
|
|
11
|
+
import { TimePickerColumn as R } from "./app-time-picker.js";
|
|
12
|
+
import { it as Se } from "../../node_modules/date-fns/locale/it.js";
|
|
13
|
+
import { formatDate as z } from "../../node_modules/date-fns/format.js";
|
|
14
|
+
import { isSameDay as O } from "../../node_modules/date-fns/isSameDay.js";
|
|
15
|
+
const W = (o) => {
|
|
16
|
+
if (!Number.isFinite(o)) return 1;
|
|
17
|
+
const M = Math.trunc(o);
|
|
18
|
+
return Math.min(59, Math.max(1, M));
|
|
19
19
|
};
|
|
20
|
-
function
|
|
20
|
+
function Te(o) {
|
|
21
21
|
const {
|
|
22
|
-
placeholder:
|
|
23
|
-
dateFormat:
|
|
24
|
-
className:
|
|
22
|
+
placeholder: M = "Seleziona data",
|
|
23
|
+
dateFormat: Y,
|
|
24
|
+
className: Z,
|
|
25
25
|
disabled: d = !1,
|
|
26
|
-
size:
|
|
27
|
-
firstDate:
|
|
28
|
-
lastDate:
|
|
29
|
-
availableDates:
|
|
30
|
-
locale: u =
|
|
31
|
-
initialCalendarMonth:
|
|
32
|
-
customCalendarProps:
|
|
33
|
-
label:
|
|
34
|
-
labelClassName:
|
|
35
|
-
wrpClassName:
|
|
36
|
-
id:
|
|
37
|
-
"data-testid":
|
|
38
|
-
minDate:
|
|
39
|
-
maxDate:
|
|
40
|
-
numberOfMonths:
|
|
41
|
-
clearable:
|
|
42
|
-
onClear:
|
|
43
|
-
} =
|
|
44
|
-
|
|
45
|
-
), [
|
|
46
|
-
|
|
47
|
-
), [
|
|
48
|
-
|
|
49
|
-
), [
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
),
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
}, [
|
|
59
|
-
() => Array.from({ length: 24 }, (e,
|
|
26
|
+
size: v = "default",
|
|
27
|
+
firstDate: E,
|
|
28
|
+
lastDate: F,
|
|
29
|
+
availableDates: I,
|
|
30
|
+
locale: u = Se,
|
|
31
|
+
initialCalendarMonth: w,
|
|
32
|
+
customCalendarProps: S,
|
|
33
|
+
label: T,
|
|
34
|
+
labelClassName: $,
|
|
35
|
+
wrpClassName: ee,
|
|
36
|
+
id: te,
|
|
37
|
+
"data-testid": ne,
|
|
38
|
+
minDate: A,
|
|
39
|
+
maxDate: _,
|
|
40
|
+
numberOfMonths: oe,
|
|
41
|
+
clearable: ae = !1,
|
|
42
|
+
onClear: j
|
|
43
|
+
} = o, a = o.mode === "range", C = !a && o.showTime === !0, N = !a && o.withSeconds === !0, p = a ? 1 : W(o.minuteStep), k = a ? 1 : W(o.secondStep), P = Y ?? (C ? N ? "dd/MM/yyyy HH:mm:ss" : "dd/MM/yyyy HH:mm" : "dd/MM/yyyy"), [i, x] = c.useState(
|
|
44
|
+
a ? void 0 : o.value
|
|
45
|
+
), [n, b] = c.useState(
|
|
46
|
+
a ? o.value : void 0
|
|
47
|
+
), [L, D] = c.useState(
|
|
48
|
+
w
|
|
49
|
+
), [B, V] = c.useState(!1), re = (e) => {
|
|
50
|
+
const t = e ? new Date(e) : void 0;
|
|
51
|
+
C && t && i && t.setHours(
|
|
52
|
+
i.getHours(),
|
|
53
|
+
i.getMinutes(),
|
|
54
|
+
i.getSeconds()
|
|
55
|
+
), x(t), t && D(t), !a && o.onChange && o.onChange(t), !C && t && V(!1);
|
|
56
|
+
}, ie = X(() => {
|
|
57
|
+
a ? (b(void 0), o.onChange && o.onChange(void 0)) : (x(void 0), o.onChange && o.onChange(void 0)), j?.();
|
|
58
|
+
}, [a, o.onChange, j]), se = i?.getHours(), le = i?.getMinutes(), fe = i?.getSeconds(), de = H(
|
|
59
|
+
() => Array.from({ length: 24 }, (e, t) => t),
|
|
60
60
|
[]
|
|
61
|
-
),
|
|
61
|
+
), me = H(
|
|
62
62
|
() => Array.from(
|
|
63
|
-
{ length: Math.floor(59 /
|
|
64
|
-
(e,
|
|
63
|
+
{ length: Math.floor(59 / p) + 1 },
|
|
64
|
+
(e, t) => t * p
|
|
65
65
|
),
|
|
66
|
-
[
|
|
67
|
-
),
|
|
66
|
+
[p]
|
|
67
|
+
), ce = H(
|
|
68
68
|
() => Array.from(
|
|
69
|
-
{ length: Math.floor(59 /
|
|
70
|
-
(e,
|
|
69
|
+
{ length: Math.floor(59 / k) + 1 },
|
|
70
|
+
(e, t) => t * k
|
|
71
71
|
),
|
|
72
|
-
[
|
|
73
|
-
),
|
|
74
|
-
(e,
|
|
75
|
-
const
|
|
76
|
-
|
|
72
|
+
[k]
|
|
73
|
+
), y = X(
|
|
74
|
+
(e, t) => {
|
|
75
|
+
const s = i ? new Date(i) : /* @__PURE__ */ new Date();
|
|
76
|
+
i || s.setHours(0, 0, 0, 0), e === "hour" ? s.setHours(t) : e === "minute" ? s.setMinutes(t) : e === "second" && s.setSeconds(t), x(s), !a && o.onChange && o.onChange(s);
|
|
77
77
|
},
|
|
78
|
-
[
|
|
79
|
-
),
|
|
80
|
-
|
|
78
|
+
[i, a, o.onChange]
|
|
79
|
+
), ue = (e, t) => {
|
|
80
|
+
let s;
|
|
81
|
+
!n || !n.from ? s = { from: t, to: void 0 } : n.from && !n.to ? t < n.from ? s = { from: t, to: void 0 } : s = { from: n.from, to: t } : n.from && n.to && (s = { from: t, to: void 0 }), b(s), s?.from && D(s.from), a && o.onChange && o.onChange(s);
|
|
81
82
|
};
|
|
82
|
-
let
|
|
83
|
-
|
|
84
|
-
(e) => !
|
|
85
|
-
(
|
|
83
|
+
let m = [];
|
|
84
|
+
E && m.push({ before: E }), F && m.push({ after: F }), I?.length && m.push(
|
|
85
|
+
(e) => !I.some(
|
|
86
|
+
(t) => O(t, e)
|
|
86
87
|
)
|
|
87
|
-
), d && (
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
const e =
|
|
91
|
-
|
|
88
|
+
), d && (m = [!0]), G(() => {
|
|
89
|
+
if (a) {
|
|
90
|
+
b(o.value);
|
|
91
|
+
const e = o.value?.from;
|
|
92
|
+
D(e ?? w);
|
|
92
93
|
} else
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
x(o.value), D(
|
|
95
|
+
o.value ?? w
|
|
95
96
|
);
|
|
96
|
-
}, [
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
}, [o.value, a, w]);
|
|
98
|
+
const [h, g] = c.useState(
|
|
99
|
+
null
|
|
100
|
+
);
|
|
101
|
+
G(() => {
|
|
102
|
+
const e = () => {
|
|
103
|
+
h && (g(null), a && o.onChange && o.onChange(n));
|
|
104
|
+
};
|
|
105
|
+
return window.addEventListener("pointerup", e), () => window.removeEventListener("pointerup", e);
|
|
106
|
+
}, [h, a, o.onChange, n]);
|
|
107
|
+
const he = (e, t) => {
|
|
108
|
+
!a || !n || !n.from || !n.to || (O(e, n.from) ? (g("from"), t.preventDefault()) : O(e, n.to) && (g("to"), t.preventDefault()));
|
|
109
|
+
}, ge = (e) => {
|
|
110
|
+
if (!h || !n || !n.from || !n.to) return;
|
|
111
|
+
let t = { ...n };
|
|
112
|
+
h === "from" ? e <= n.to ? t.from = e : (t.from = n.to, t.to = e, g("to")) : h === "to" && (e >= n.from ? t.to = e : (t.to = n.from, t.from = e, g("from"))), b(t);
|
|
113
|
+
}, ve = c.useId(), q = te ?? ve, U = a ? !!n?.from : !!i, we = () => a && n ? /* @__PURE__ */ f("span", { children: [
|
|
114
|
+
n.from && z(n.from, P, { locale: u }),
|
|
115
|
+
n.from && n.to && " - ",
|
|
116
|
+
n.to && z(n.to, P, { locale: u })
|
|
117
|
+
] }) : !a && i ? /* @__PURE__ */ r("span", { children: z(i, P, { locale: u }) }) : /* @__PURE__ */ r("span", { className: "text-d-muted-foreground", children: M });
|
|
118
|
+
return /* @__PURE__ */ f("div", { className: Q("flex flex-col gap-1.5", ee), children: [
|
|
119
|
+
T && /* @__PURE__ */ r(xe, { htmlFor: q, className: $, children: T }),
|
|
120
|
+
/* @__PURE__ */ f(be, { open: d ? !1 : B, onOpenChange: V, modal: !0, children: [
|
|
121
|
+
/* @__PURE__ */ r(De, { asChild: !0, children: /* @__PURE__ */ f(
|
|
106
122
|
"div",
|
|
107
123
|
{
|
|
108
124
|
id: q,
|
|
109
|
-
"data-testid":
|
|
110
|
-
className:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
125
|
+
"data-testid": ne,
|
|
126
|
+
className: Q(
|
|
127
|
+
l.input.base,
|
|
128
|
+
l.radius.default,
|
|
129
|
+
l.text.base,
|
|
130
|
+
l.interaction.disabled,
|
|
115
131
|
"flex items-center gap-2 font-normal whitespace-nowrap [&>span]:line-clamp-1",
|
|
116
|
-
|
|
117
|
-
|
|
132
|
+
l.focusRing,
|
|
133
|
+
B && l.activeRing,
|
|
118
134
|
"hover:border-d-ring cursor-pointer transition-colors",
|
|
119
|
-
!
|
|
135
|
+
!U && "text-d-muted-foreground",
|
|
120
136
|
d && "cursor-not-allowed opacity-50",
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
137
|
+
v === "default" && l.sizes.default,
|
|
138
|
+
v === "sm" && l.sizes.sm,
|
|
139
|
+
v === "lg" && l.sizes.lg,
|
|
140
|
+
Z
|
|
125
141
|
),
|
|
126
142
|
"aria-disabled": d,
|
|
127
143
|
role: "button",
|
|
@@ -129,20 +145,20 @@ function Oe(t) {
|
|
|
129
145
|
onClick: d ? void 0 : () => {
|
|
130
146
|
},
|
|
131
147
|
children: [
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
148
|
+
/* @__PURE__ */ r(K, { name: "Calendar", size: v === "lg" ? "sm" : "xs" }),
|
|
149
|
+
/* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: we() }),
|
|
150
|
+
ae && U && /* @__PURE__ */ r(
|
|
135
151
|
"div",
|
|
136
152
|
{
|
|
137
153
|
role: "button",
|
|
138
154
|
className: "bg-d-accent hover:bg-d-accent/80 border-d-border flex shrink-0 cursor-pointer items-center justify-center rounded-full border p-1 transition-colors",
|
|
139
155
|
onClick: (e) => {
|
|
140
|
-
e.stopPropagation(), e.preventDefault(),
|
|
156
|
+
e.stopPropagation(), e.preventDefault(), ie();
|
|
141
157
|
},
|
|
142
158
|
onMouseDown: (e) => e.preventDefault(),
|
|
143
159
|
"aria-label": "Clear selection",
|
|
144
|
-
children: /* @__PURE__ */
|
|
145
|
-
|
|
160
|
+
children: /* @__PURE__ */ r(
|
|
161
|
+
K,
|
|
146
162
|
{
|
|
147
163
|
name: "X",
|
|
148
164
|
size: "xs",
|
|
@@ -155,83 +171,98 @@ function Oe(t) {
|
|
|
155
171
|
}
|
|
156
172
|
) }),
|
|
157
173
|
" ",
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
|
|
174
|
+
/* @__PURE__ */ f(
|
|
175
|
+
Me,
|
|
160
176
|
{
|
|
161
177
|
className: "flex max-h-[500px] min-h-0 w-auto flex-row p-0 shadow",
|
|
162
178
|
align: "start",
|
|
163
179
|
children: [
|
|
164
|
-
|
|
165
|
-
|
|
180
|
+
a ? /* @__PURE__ */ r(
|
|
181
|
+
J,
|
|
166
182
|
{
|
|
167
|
-
...
|
|
183
|
+
...S || {},
|
|
168
184
|
mode: "range",
|
|
169
|
-
selected:
|
|
170
|
-
onSelect:
|
|
185
|
+
selected: n,
|
|
186
|
+
onSelect: ue,
|
|
171
187
|
autoFocus: !0,
|
|
172
|
-
disabled:
|
|
188
|
+
disabled: m,
|
|
173
189
|
locale: u,
|
|
174
|
-
defaultMonth:
|
|
175
|
-
numberOfMonths:
|
|
176
|
-
minDate:
|
|
177
|
-
maxDate:
|
|
190
|
+
defaultMonth: L,
|
|
191
|
+
numberOfMonths: oe ?? 1,
|
|
192
|
+
minDate: A,
|
|
193
|
+
maxDate: _,
|
|
194
|
+
components: {
|
|
195
|
+
...S?.components,
|
|
196
|
+
DayButton: (e) => /* @__PURE__ */ r(
|
|
197
|
+
Ce,
|
|
198
|
+
{
|
|
199
|
+
...e,
|
|
200
|
+
onPointerDown: (t) => {
|
|
201
|
+
e.onPointerDown && e.onPointerDown(t), he(e.day.date, t);
|
|
202
|
+
},
|
|
203
|
+
onPointerEnter: (t) => {
|
|
204
|
+
e.onPointerEnter && e.onPointerEnter(t), ge(e.day.date);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
}
|
|
178
209
|
}
|
|
179
|
-
) : /* @__PURE__ */
|
|
180
|
-
|
|
210
|
+
) : /* @__PURE__ */ r(
|
|
211
|
+
J,
|
|
181
212
|
{
|
|
182
|
-
...
|
|
213
|
+
...S || {},
|
|
183
214
|
mode: "single",
|
|
184
|
-
selected:
|
|
185
|
-
onSelect:
|
|
215
|
+
selected: i,
|
|
216
|
+
onSelect: re,
|
|
186
217
|
autoFocus: !0,
|
|
187
|
-
disabled:
|
|
218
|
+
disabled: m,
|
|
188
219
|
locale: u,
|
|
189
|
-
defaultMonth:
|
|
190
|
-
minDate:
|
|
191
|
-
maxDate:
|
|
220
|
+
defaultMonth: L,
|
|
221
|
+
minDate: A,
|
|
222
|
+
maxDate: _
|
|
192
223
|
}
|
|
193
224
|
),
|
|
194
|
-
|
|
195
|
-
/* @__PURE__ */
|
|
225
|
+
C && /* @__PURE__ */ f("div", { className: "border-d-border/50 relative flex shrink-0 flex-row overflow-hidden border-l", children: [
|
|
226
|
+
/* @__PURE__ */ f(
|
|
196
227
|
"div",
|
|
197
228
|
{
|
|
198
229
|
className: "invisible flex h-0 flex-row overflow-hidden opacity-0 select-none",
|
|
199
230
|
"aria-hidden": "true",
|
|
200
231
|
children: [
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
|
|
232
|
+
/* @__PURE__ */ r("div", { className: "w-12 shrink-0 sm:w-14" }),
|
|
233
|
+
/* @__PURE__ */ r("div", { className: "w-12 shrink-0 sm:w-14" }),
|
|
234
|
+
N && /* @__PURE__ */ r("div", { className: "w-12 shrink-0 sm:w-14" })
|
|
204
235
|
]
|
|
205
236
|
}
|
|
206
237
|
),
|
|
207
|
-
/* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
|
|
238
|
+
/* @__PURE__ */ f("div", { className: "absolute inset-0 flex h-full w-full flex-row overflow-y-auto", children: [
|
|
239
|
+
/* @__PURE__ */ r(
|
|
240
|
+
R,
|
|
210
241
|
{
|
|
211
242
|
type: "hour",
|
|
212
|
-
value:
|
|
213
|
-
options:
|
|
214
|
-
onChange: (e) =>
|
|
243
|
+
value: se,
|
|
244
|
+
options: de,
|
|
245
|
+
onChange: (e) => y("hour", e),
|
|
215
246
|
className: "flex flex-1"
|
|
216
247
|
}
|
|
217
248
|
),
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
|
|
249
|
+
/* @__PURE__ */ r(
|
|
250
|
+
R,
|
|
220
251
|
{
|
|
221
252
|
type: "minute",
|
|
222
|
-
value:
|
|
223
|
-
options:
|
|
224
|
-
onChange: (e) =>
|
|
253
|
+
value: le,
|
|
254
|
+
options: me,
|
|
255
|
+
onChange: (e) => y("minute", e),
|
|
225
256
|
className: "flex flex-1"
|
|
226
257
|
}
|
|
227
258
|
),
|
|
228
|
-
|
|
229
|
-
|
|
259
|
+
N && /* @__PURE__ */ r(
|
|
260
|
+
R,
|
|
230
261
|
{
|
|
231
262
|
type: "second",
|
|
232
|
-
value:
|
|
233
|
-
options:
|
|
234
|
-
onChange: (e) =>
|
|
263
|
+
value: fe,
|
|
264
|
+
options: ce,
|
|
265
|
+
onChange: (e) => y("second", e),
|
|
235
266
|
className: "flex flex-1"
|
|
236
267
|
}
|
|
237
268
|
)
|
|
@@ -244,5 +275,5 @@ function Oe(t) {
|
|
|
244
275
|
] });
|
|
245
276
|
}
|
|
246
277
|
export {
|
|
247
|
-
|
|
278
|
+
Te as DatePicker
|
|
248
279
|
};
|
|
@@ -1,30 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as t, jsxs as p, Fragment as y } from "react/jsx-runtime";
|
|
3
3
|
import g, { Suspense as x } from "react";
|
|
4
4
|
import { CopyButton as k } from "./copy-button.js";
|
|
5
5
|
import { cn as m } from "../../lib/utils.js";
|
|
6
|
-
import { Markdown as
|
|
6
|
+
import { Markdown as w } from "../../node_modules/react-markdown/lib/index.js";
|
|
7
|
+
import N from "../../node_modules/rehype-raw/lib/index.js";
|
|
7
8
|
import v from "../../node_modules/remark-gfm/lib/index.js";
|
|
8
|
-
function
|
|
9
|
-
return /* @__PURE__ */
|
|
9
|
+
function B({ children: e }) {
|
|
10
|
+
return /* @__PURE__ */ t("div", { className: "space-y-3", children: /* @__PURE__ */ t(
|
|
11
|
+
w,
|
|
12
|
+
{
|
|
13
|
+
remarkPlugins: [v],
|
|
14
|
+
rehypePlugins: [N],
|
|
15
|
+
components: S,
|
|
16
|
+
children: e
|
|
17
|
+
}
|
|
18
|
+
) });
|
|
10
19
|
}
|
|
11
|
-
const
|
|
12
|
-
async ({ children: e, language:
|
|
20
|
+
const u = g.memo(
|
|
21
|
+
async ({ children: e, language: o, ...n }) => {
|
|
13
22
|
const { codeToTokens: i, bundledLanguages: d } = await import("../../node_modules/shiki/dist/index.js");
|
|
14
|
-
if (!(
|
|
15
|
-
return /* @__PURE__ */
|
|
23
|
+
if (!(o in d))
|
|
24
|
+
return /* @__PURE__ */ t("pre", { ...n, children: e });
|
|
16
25
|
const { tokens: l } = await i(e, {
|
|
17
|
-
lang:
|
|
26
|
+
lang: o,
|
|
18
27
|
defaultColor: !1,
|
|
19
28
|
themes: {
|
|
20
29
|
light: "github-light",
|
|
21
30
|
dark: "github-dark"
|
|
22
31
|
}
|
|
23
32
|
});
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ t("pre", { ...n, children: /* @__PURE__ */ t("code", { children: l.map((h, c) => /* @__PURE__ */ p(y, { children: [
|
|
34
|
+
/* @__PURE__ */ t("span", { children: h.map((a, b) => {
|
|
26
35
|
const f = typeof a.htmlStyle == "string" ? void 0 : a.htmlStyle;
|
|
27
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ t(
|
|
28
37
|
"span",
|
|
29
38
|
{
|
|
30
39
|
className: "text-shiki-light bg-shiki-light-bg dark:text-shiki-dark dark:bg-shiki-dark-bg",
|
|
@@ -39,53 +48,54 @@ const h = g.memo(
|
|
|
39
48
|
] })) }) });
|
|
40
49
|
}
|
|
41
50
|
);
|
|
42
|
-
|
|
43
|
-
const
|
|
51
|
+
u.displayName = "HighlightedCode";
|
|
52
|
+
const C = ({
|
|
44
53
|
children: e,
|
|
45
|
-
className:
|
|
54
|
+
className: o,
|
|
46
55
|
language: n,
|
|
47
56
|
...i
|
|
48
57
|
}) => {
|
|
49
58
|
const d = typeof e == "string" ? e : s(e), l = m(
|
|
50
59
|
"overflow-x-scroll rounded-md border border-d-border bg-d-background/50 p-4 font-mono text-sm [scrollbar-width:none]",
|
|
51
|
-
|
|
60
|
+
o
|
|
52
61
|
);
|
|
53
62
|
return /* @__PURE__ */ p("div", { className: "group/code relative mb-4", children: [
|
|
54
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ t(
|
|
55
64
|
x,
|
|
56
65
|
{
|
|
57
|
-
fallback: /* @__PURE__ */
|
|
58
|
-
children: /* @__PURE__ */
|
|
66
|
+
fallback: /* @__PURE__ */ t("pre", { className: l, ...i, children: e }),
|
|
67
|
+
children: /* @__PURE__ */ t(u, { language: n, className: l, children: d })
|
|
59
68
|
}
|
|
60
69
|
),
|
|
61
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ t("div", { className: "invisible absolute top-2 right-2 flex space-x-1 rounded-lg p-1 opacity-0 transition-all duration-200 group-hover/code:visible group-hover/code:opacity-100", children: /* @__PURE__ */ t(k, { content: d, copyMessage: "Copied code to clipboard" }) })
|
|
62
71
|
] });
|
|
63
72
|
};
|
|
64
73
|
function s(e) {
|
|
65
74
|
if (typeof e == "string")
|
|
66
75
|
return e;
|
|
67
76
|
if (g.isValidElement(e) && e.props && typeof e.props == "object" && "children" in e.props) {
|
|
68
|
-
const
|
|
69
|
-
return
|
|
77
|
+
const o = e.props.children;
|
|
78
|
+
return o && typeof o == "object" && Array.isArray(o) ? o.map((n) => s(n)).join("") : s(o);
|
|
70
79
|
}
|
|
71
80
|
return "";
|
|
72
81
|
}
|
|
73
|
-
const
|
|
82
|
+
const S = {
|
|
74
83
|
h1: r("h1", "text-2xl font-semibold"),
|
|
75
84
|
h2: r("h2", "font-semibold text-xl"),
|
|
76
85
|
h3: r("h3", "font-semibold text-lg"),
|
|
77
86
|
h4: r("h4", "font-semibold text-base"),
|
|
78
87
|
h5: r("h5", "font-medium"),
|
|
79
88
|
strong: r("strong", "font-semibold"),
|
|
89
|
+
u: r("u", "underline"),
|
|
80
90
|
a: r("a", "text-d-primary underline underline-offset-2"),
|
|
81
91
|
blockquote: r("blockquote", "border-l-2 border-d-primary pl-4"),
|
|
82
92
|
code: ({
|
|
83
93
|
children: e,
|
|
84
|
-
className:
|
|
94
|
+
className: o,
|
|
85
95
|
...n
|
|
86
96
|
}) => {
|
|
87
|
-
const i = /language-(\w+)/.exec(
|
|
88
|
-
return i ? /* @__PURE__ */
|
|
97
|
+
const i = /language-(\w+)/.exec(o || "");
|
|
98
|
+
return i ? /* @__PURE__ */ t(C, { className: o, language: i[1], ...n, children: e }) : /* @__PURE__ */ t(
|
|
89
99
|
"code",
|
|
90
100
|
{
|
|
91
101
|
className: m(
|
|
@@ -116,13 +126,13 @@ const C = {
|
|
|
116
126
|
p: r("p", "whitespace-pre-wrap"),
|
|
117
127
|
hr: r("hr", "border-foreground/20")
|
|
118
128
|
};
|
|
119
|
-
function r(e,
|
|
129
|
+
function r(e, o) {
|
|
120
130
|
const n = ({
|
|
121
131
|
...i
|
|
122
|
-
}) => /* @__PURE__ */
|
|
132
|
+
}) => /* @__PURE__ */ t(e, { className: o, ...i });
|
|
123
133
|
return n.displayName = String(e), n;
|
|
124
134
|
}
|
|
125
135
|
export {
|
|
126
|
-
|
|
127
|
-
|
|
136
|
+
B as MarkdownRenderer,
|
|
137
|
+
B as default
|
|
128
138
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -260,7 +260,7 @@ export declare interface AppDialogProps extends Omit<DialogContentProps, "title"
|
|
|
260
260
|
preventClose?: "overlay" | "all";
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
export declare function AppEditor({ defaultValue, onMarkdownEdit, plugins, toolbars, placeholder, onlyMarkdown, className, }: AppEditorProps): JSX.Element;
|
|
263
|
+
export declare function AppEditor({ defaultValue, onMarkdownEdit, plugins, toolbars, placeholder, onlyMarkdown, className, wrpClassName, }: AppEditorProps): JSX.Element;
|
|
264
264
|
|
|
265
265
|
declare type AppEditorPlugin = "clear" | "counter";
|
|
266
266
|
|
|
@@ -272,6 +272,7 @@ declare interface AppEditorProps {
|
|
|
272
272
|
placeholder?: string;
|
|
273
273
|
onlyMarkdown?: boolean;
|
|
274
274
|
className?: string;
|
|
275
|
+
wrpClassName?: string;
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
declare type AppEditorToolbar = "block-format" | "font-format" | "history";
|
|
@@ -2594,6 +2595,7 @@ declare type MultiSelectProps = BaseProps & {
|
|
|
2594
2595
|
defaultValue?: (string | number)[];
|
|
2595
2596
|
onValueChange?: (value: (string | number)[]) => void;
|
|
2596
2597
|
renderValue?: (option: AppSelectOption) => React.ReactNode;
|
|
2598
|
+
selectableAll?: boolean;
|
|
2597
2599
|
};
|
|
2598
2600
|
|
|
2599
2601
|
export declare interface NavGroup {
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
function f(n) {
|
|
3
|
+
const i = [], t = String(n || "");
|
|
4
|
+
let e = t.indexOf(","), s = 0, r = !1;
|
|
5
|
+
for (; !r; ) {
|
|
6
|
+
e === -1 && (e = t.length, r = !0);
|
|
7
|
+
const o = t.slice(s, e).trim();
|
|
8
|
+
(o || !r) && i.push(o), s = e + 1, e = t.indexOf(",", s);
|
|
9
|
+
}
|
|
10
|
+
return i;
|
|
11
|
+
}
|
|
12
|
+
function c(n, i) {
|
|
13
|
+
const t = i || {};
|
|
14
|
+
return (n[n.length - 1] === "" ? [...n, ""] : n).join(
|
|
15
|
+
(t.padRight ? " " : "") + "," + (t.padLeft === !1 ? "" : " ")
|
|
6
16
|
).trim();
|
|
7
17
|
}
|
|
8
18
|
export {
|
|
9
|
-
|
|
19
|
+
f as parse,
|
|
20
|
+
c as stringify
|
|
10
21
|
};
|