@devalok/shilp-sutra 0.42.1 → 0.44.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/MIGRATION.md +78 -0
- package/dist/_chunks/chat.js +164 -163
- package/dist/_chunks/chat.js.map +1 -1
- package/dist/_chunks/mention-suggestion.js +35 -33
- package/dist/_chunks/mention-suggestion.js.map +1 -1
- package/dist/_chunks/oauth-button.js +102 -97
- package/dist/_chunks/oauth-button.js.map +1 -1
- package/dist/_chunks/popover.js +1 -1
- package/dist/_chunks/popover.js.map +1 -1
- package/dist/_chunks/shared.js +1 -1
- package/dist/_chunks/shared.js.map +1 -1
- package/dist/_chunks/tree-view.js +1 -1
- package/dist/_chunks/tree-view.js.map +1 -1
- package/dist/ai/command-bar.js +1 -1
- package/dist/ai/command-bar.js.map +1 -1
- package/dist/composed/bulk-action-bar.js +1 -1
- package/dist/composed/bulk-action-bar.js.map +1 -1
- package/dist/composed/command-palette.js +4 -4
- package/dist/composed/command-palette.js.map +1 -1
- package/dist/composed/content-card.d.ts +6 -0
- package/dist/composed/content-card.d.ts.map +1 -1
- package/dist/composed/content-card.js +1 -1
- package/dist/composed/content-card.js.map +1 -1
- package/dist/composed/error-boundary.js +1 -1
- package/dist/composed/error-boundary.js.map +1 -1
- package/dist/composed/extensions/emoji-suggestion.js +1 -1
- package/dist/composed/extensions/emoji-suggestion.js.map +1 -1
- package/dist/composed/extensions/file-attachment.d.ts.map +1 -1
- package/dist/composed/file-preview/audio-preview.d.ts.map +1 -1
- package/dist/composed/file-preview.d.ts.map +1 -1
- package/dist/composed/file-preview.js +147 -143
- package/dist/composed/file-preview.js.map +1 -1
- package/dist/composed/filter-bar.js +5 -2
- package/dist/composed/filter-bar.js.map +1 -1
- package/dist/composed/master-detail.js +1 -1
- package/dist/composed/master-detail.js.map +1 -1
- package/dist/composed/page-header.js +1 -1
- package/dist/composed/page-header.js.map +1 -1
- package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/audio-player.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -1
- package/dist/composed/rich-chat-input.js +600 -591
- package/dist/composed/rich-chat-input.js.map +1 -1
- package/dist/composed/rich-text-editor.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.js +166 -164
- package/dist/composed/rich-text-editor.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +102 -98
- package/dist/shell/notification-center.js.map +1 -1
- package/dist/shell/sidebar.d.ts +6 -0
- package/dist/shell/sidebar.d.ts.map +1 -1
- package/dist/shell/sidebar.js +142 -118
- package/dist/shell/sidebar.js.map +1 -1
- package/dist/shell/top-bar.d.ts.map +1 -1
- package/dist/shell/top-bar.js +87 -84
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/tokens/semantic.css +9 -2
- package/dist/ui/alert-dialog.js +1 -1
- package/dist/ui/alert-dialog.js.map +1 -1
- package/dist/ui/autocomplete.js +1 -1
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/avatar.js +1 -1
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/breadcrumb.js +2 -2
- package/dist/ui/breadcrumb.js.map +1 -1
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/card.d.ts +82 -7
- package/dist/ui/card.d.ts.map +1 -1
- package/dist/ui/card.js +76 -110
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/chat/message.d.ts.map +1 -1
- package/dist/ui/color-input.js +1 -1
- package/dist/ui/color-input.js.map +1 -1
- package/dist/ui/combobox.js +3 -3
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/context-menu.js +2 -2
- package/dist/ui/context-menu.js.map +1 -1
- package/dist/ui/data-table-bulk-actions.js +1 -1
- package/dist/ui/data-table-bulk-actions.js.map +1 -1
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/dropdown-menu.js +11 -5
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/hover-card.js +1 -1
- package/dist/ui/hover-card.js.map +1 -1
- package/dist/ui/index.d.ts +3 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +58 -56
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/input-otp.js +1 -1
- package/dist/ui/input-otp.js.map +1 -1
- package/dist/ui/menubar.js +12 -6
- package/dist/ui/menubar.js.map +1 -1
- package/dist/ui/navigation-menu.js +1 -1
- package/dist/ui/navigation-menu.js.map +1 -1
- package/dist/ui/oauth-button/oauth-button.d.ts.map +1 -1
- package/dist/ui/select.js +6 -3
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/sidebar.js +74 -74
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/split-button.js +1 -1
- package/dist/ui/split-button.js.map +1 -1
- package/dist/ui/stat-card.d.ts +26 -3
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +183 -150
- package/dist/ui/stat-card.js.map +1 -1
- package/dist/ui/stat-flash.d.ts +46 -0
- package/dist/ui/stat-flash.d.ts.map +1 -0
- package/dist/ui/stat-flash.js +114 -0
- package/dist/ui/stat-flash.js.map +1 -0
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +5 -2
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/toast.js +2 -2
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/truncated-text.d.ts +37 -0
- package/dist/ui/truncated-text.d.ts.map +1 -0
- package/dist/ui/truncated-text.js +53 -0
- package/dist/ui/truncated-text.js.map +1 -0
- package/docs/components/ui/card.md +13 -4
- package/docs/components/ui/stat-card.md +18 -3
- package/docs/components/ui/stat-flash.md +44 -0
- package/docs/components/ui/truncated-text.md +49 -0
- package/llms-full.txt +125 -8
- package/make-kit/components/card.md +14 -4
- package/package.json +1 -1
- package/skill/SKILL.md +1 -1
- package/skill/references/components-full.md +125 -8
|
@@ -5,22 +5,23 @@ import { Icon as r } from "../ui/icon.js";
|
|
|
5
5
|
import { n as i } from "../_chunks/badge-group.js";
|
|
6
6
|
import { Button as a } from "../ui/button.js";
|
|
7
7
|
import { Skeleton as o } from "../ui/skeleton.js";
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
8
|
+
import { TruncatedText as s } from "../ui/truncated-text.js";
|
|
9
|
+
import { a as c, i as l, t as u } from "../_chunks/shared.js";
|
|
10
|
+
import * as d from "react";
|
|
11
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
12
|
+
import { IconDownload as m, IconMaximize as h, IconPlayerPause as g, IconPlayerPlay as _ } from "@tabler/icons-react";
|
|
13
|
+
import { AnimatePresence as v, motion as y } from "framer-motion";
|
|
13
14
|
//#region src/composed/file-preview/audio-preview.tsx
|
|
14
|
-
function
|
|
15
|
-
let i =
|
|
16
|
-
|
|
15
|
+
function b({ url: e, fileName: t, onError: n }) {
|
|
16
|
+
let i = d.useRef(null), o = d.useRef(null), [m, h] = d.useState(!1), [v, y] = d.useState(0), [b, x] = d.useState(0), [S, C] = d.useState(0), [w, T] = d.useState(1), [E, D] = d.useState(!1), [O, k] = d.useState(!1), [A, j] = d.useState(null);
|
|
17
|
+
d.useEffect(() => {
|
|
17
18
|
function e(e) {
|
|
18
19
|
let t = o.current;
|
|
19
20
|
if (!t || !t.contains(document.activeElement) && document.activeElement !== t) return;
|
|
20
21
|
let n = i.current;
|
|
21
22
|
if (n) switch (e.key) {
|
|
22
23
|
case " ":
|
|
23
|
-
e.preventDefault(),
|
|
24
|
+
e.preventDefault(), h((e) => (e ? n.pause() : n.play(), !e));
|
|
24
25
|
break;
|
|
25
26
|
case "ArrowRight":
|
|
26
27
|
e.preventDefault(), n.currentTime = Math.min(n.duration || 0, n.currentTime + 5);
|
|
@@ -29,120 +30,122 @@ function y({ url: e, fileName: t, onError: n }) {
|
|
|
29
30
|
e.preventDefault(), n.currentTime = Math.max(0, n.currentTime - 5);
|
|
30
31
|
break;
|
|
31
32
|
case "m":
|
|
32
|
-
e.preventDefault(),
|
|
33
|
+
e.preventDefault(), D((e) => (n.muted = !e, !e));
|
|
33
34
|
break;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
37
38
|
}, []);
|
|
38
|
-
function
|
|
39
|
-
i.current && (
|
|
39
|
+
function M() {
|
|
40
|
+
i.current && (m ? i.current.pause() : i.current.play(), h(!m));
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
if (!i.current || !
|
|
42
|
+
function N(e) {
|
|
43
|
+
if (!i.current || !b) return;
|
|
43
44
|
let t = e.currentTarget.getBoundingClientRect(), n = Math.max(0, Math.min(1, (e.clientX - t.left) / t.width));
|
|
44
|
-
i.current.currentTime = n *
|
|
45
|
+
i.current.currentTime = n * b;
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
-
if (!
|
|
47
|
+
function P(e) {
|
|
48
|
+
if (!b) return;
|
|
48
49
|
let t = e.currentTarget.getBoundingClientRect();
|
|
49
|
-
|
|
50
|
+
j((e.clientX - t.left) / t.width * b);
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
+
function F() {
|
|
52
53
|
if (!i.current) return;
|
|
53
|
-
let e = !
|
|
54
|
-
|
|
54
|
+
let e = !E;
|
|
55
|
+
D(e), i.current.muted = e;
|
|
55
56
|
}
|
|
56
|
-
return
|
|
57
|
+
return O ? /* @__PURE__ */ f(u, {
|
|
57
58
|
message: "Could not load audio",
|
|
58
59
|
url: e
|
|
59
|
-
}) : /* @__PURE__ */
|
|
60
|
+
}) : /* @__PURE__ */ p("div", {
|
|
60
61
|
ref: o,
|
|
61
|
-
className: "rounded-surface
|
|
62
|
+
className: "rounded-surface bg-surface-raised shadow-raised overflow-hidden",
|
|
62
63
|
tabIndex: -1,
|
|
63
64
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ f("audio", {
|
|
65
66
|
ref: i,
|
|
66
67
|
src: e,
|
|
67
68
|
onTimeUpdate: () => {
|
|
68
|
-
i.current && (
|
|
69
|
+
i.current && (C(i.current.currentTime), i.current.duration && y(i.current.currentTime / i.current.duration * 100));
|
|
69
70
|
},
|
|
70
|
-
onLoadedMetadata: () =>
|
|
71
|
-
onEnded: () =>
|
|
71
|
+
onLoadedMetadata: () => x(i.current?.duration ?? 0),
|
|
72
|
+
onEnded: () => h(!1),
|
|
72
73
|
onError: () => {
|
|
73
|
-
|
|
74
|
+
k(!0), n?.("Audio failed to load");
|
|
74
75
|
}
|
|
75
76
|
}),
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ p("div", {
|
|
77
78
|
className: "relative h-1 w-full cursor-pointer bg-surface-sunken group/bar",
|
|
78
|
-
onClick:
|
|
79
|
-
onMouseMove:
|
|
80
|
-
onMouseLeave: () =>
|
|
79
|
+
onClick: N,
|
|
80
|
+
onMouseMove: P,
|
|
81
|
+
onMouseLeave: () => j(null),
|
|
81
82
|
role: "slider",
|
|
82
83
|
"aria-label": "Audio progress",
|
|
83
|
-
"aria-valuenow": Math.round(
|
|
84
|
+
"aria-valuenow": Math.round(v),
|
|
84
85
|
"aria-valuemin": 0,
|
|
85
86
|
"aria-valuemax": 100,
|
|
86
87
|
tabIndex: 0,
|
|
87
88
|
children: [
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ f("div", {
|
|
89
90
|
className: "absolute left-0 top-0 h-full bg-accent-9 transition-[width] duration-75",
|
|
90
|
-
style: { width: `${
|
|
91
|
+
style: { width: `${v}%` }
|
|
91
92
|
}),
|
|
92
|
-
|
|
93
|
+
A !== null && /* @__PURE__ */ f("div", {
|
|
93
94
|
className: "absolute -top-7 -translate-x-1/2 rounded-control-inner bg-surface-overlay px-1.5 py-0.5 text-[10px] font-mono text-surface-fg shadow-floating pointer-events-none",
|
|
94
|
-
style: { left: `${
|
|
95
|
-
children:
|
|
95
|
+
style: { left: `${A / (b || 1) * 100}%` },
|
|
96
|
+
children: c(A)
|
|
96
97
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ f("div", {
|
|
98
99
|
className: "absolute top-1/2 -translate-y-1/2 h-2.5 w-2.5 rounded-pill bg-accent-9 shadow-raised opacity-0 group-hover/bar:opacity-100 transition-opacity",
|
|
99
100
|
style: {
|
|
100
|
-
left: `${
|
|
101
|
+
left: `${v}%`,
|
|
101
102
|
marginLeft: "-5px"
|
|
102
103
|
}
|
|
103
104
|
})
|
|
104
105
|
]
|
|
105
106
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ p("div", {
|
|
107
108
|
className: "flex items-center gap-ds-04 px-ds-05 py-ds-04",
|
|
108
109
|
children: [
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ f(a, {
|
|
110
111
|
variant: "solid",
|
|
111
112
|
size: "icon-sm",
|
|
112
|
-
onClick:
|
|
113
|
-
"aria-label":
|
|
114
|
-
title:
|
|
113
|
+
onClick: M,
|
|
114
|
+
"aria-label": m ? "Pause" : "Play",
|
|
115
|
+
title: m ? "Pause" : "Play",
|
|
115
116
|
className: "shrink-0",
|
|
116
|
-
children:
|
|
117
|
-
icon: h,
|
|
118
|
-
size: "sm"
|
|
119
|
-
}) : /* @__PURE__ */ d(r, {
|
|
117
|
+
children: m ? /* @__PURE__ */ f(r, {
|
|
120
118
|
icon: g,
|
|
119
|
+
size: "sm"
|
|
120
|
+
}) : /* @__PURE__ */ f(r, {
|
|
121
|
+
icon: _,
|
|
121
122
|
size: "sm",
|
|
122
123
|
className: "ml-0.5"
|
|
123
124
|
})
|
|
124
125
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ p("div", {
|
|
126
127
|
className: "flex-1 min-w-0",
|
|
127
|
-
children: [t && /* @__PURE__ */
|
|
128
|
-
|
|
128
|
+
children: [t && /* @__PURE__ */ f(s, {
|
|
129
|
+
as: "p",
|
|
130
|
+
mode: "middle",
|
|
131
|
+
className: "text-ds-sm font-semibold text-surface-fg",
|
|
129
132
|
children: t
|
|
130
|
-
}), /* @__PURE__ */
|
|
133
|
+
}), /* @__PURE__ */ p("p", {
|
|
131
134
|
className: "text-ds-xs font-mono text-surface-fg-muted tabular-nums",
|
|
132
135
|
children: [
|
|
133
|
-
|
|
136
|
+
c(S),
|
|
134
137
|
" / ",
|
|
135
|
-
|
|
138
|
+
c(b)
|
|
136
139
|
]
|
|
137
140
|
})]
|
|
138
141
|
}),
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
volume:
|
|
141
|
-
muted:
|
|
142
|
+
/* @__PURE__ */ f(l, {
|
|
143
|
+
volume: w,
|
|
144
|
+
muted: E,
|
|
142
145
|
onVolumeChange: (e) => {
|
|
143
|
-
|
|
146
|
+
T(e), i.current && (i.current.volume = e), e > 0 && E && (D(!1), i.current && (i.current.muted = !1));
|
|
144
147
|
},
|
|
145
|
-
onMuteToggle:
|
|
148
|
+
onMuteToggle: F,
|
|
146
149
|
variant: "light"
|
|
147
150
|
})
|
|
148
151
|
]
|
|
@@ -152,20 +155,20 @@ function y({ url: e, fileName: t, onError: n }) {
|
|
|
152
155
|
}
|
|
153
156
|
//#endregion
|
|
154
157
|
//#region src/composed/file-preview/embed-preview.tsx
|
|
155
|
-
function
|
|
156
|
-
let [i, a] =
|
|
157
|
-
return
|
|
158
|
+
function x({ url: e, embedUrl: n, onError: r }) {
|
|
159
|
+
let [i, a] = d.useState(!1), [s, c] = d.useState(!1);
|
|
160
|
+
return d.useEffect(() => {
|
|
158
161
|
let e = setTimeout(() => {
|
|
159
162
|
i || (c(!0), r?.("Embed timed out"));
|
|
160
163
|
}, 15e3);
|
|
161
164
|
return () => clearTimeout(e);
|
|
162
|
-
}, [i, r]), s ? /* @__PURE__ */
|
|
165
|
+
}, [i, r]), s ? /* @__PURE__ */ f(u, {
|
|
163
166
|
message: "Could not load embed",
|
|
164
167
|
url: e
|
|
165
|
-
}) : /* @__PURE__ */
|
|
168
|
+
}) : /* @__PURE__ */ p("div", {
|
|
166
169
|
className: "relative w-full rounded-control overflow-hidden",
|
|
167
170
|
style: { aspectRatio: "16 / 9" },
|
|
168
|
-
children: [!i && /* @__PURE__ */
|
|
171
|
+
children: [!i && /* @__PURE__ */ f(o, { className: "absolute inset-0" }), /* @__PURE__ */ f(y.iframe, {
|
|
169
172
|
src: n,
|
|
170
173
|
title: "Embedded content",
|
|
171
174
|
onLoad: () => a(!0),
|
|
@@ -182,7 +185,7 @@ function b({ url: e, embedUrl: n, onError: r }) {
|
|
|
182
185
|
}
|
|
183
186
|
//#endregion
|
|
184
187
|
//#region src/composed/file-preview/video-preview.tsx
|
|
185
|
-
var
|
|
188
|
+
var S = [
|
|
186
189
|
.5,
|
|
187
190
|
.75,
|
|
188
191
|
1,
|
|
@@ -190,9 +193,9 @@ var x = [
|
|
|
190
193
|
1.5,
|
|
191
194
|
2
|
|
192
195
|
];
|
|
193
|
-
function
|
|
194
|
-
let a =
|
|
195
|
-
|
|
196
|
+
function C({ url: n, onError: i }) {
|
|
197
|
+
let a = d.useRef(null), o = d.useRef(null), [s, m] = d.useState(!1), [b, x] = d.useState(0), [C, w] = d.useState(0), [T, E] = d.useState(0), [D, O] = d.useState(!1), [k, A] = d.useState(!1), [j, M] = d.useState(!0), [N, P] = d.useState(1), F = d.useRef(void 0);
|
|
198
|
+
d.useEffect(() => () => clearTimeout(F.current), []), d.useEffect(() => {
|
|
196
199
|
function e(e) {
|
|
197
200
|
let t = o.current;
|
|
198
201
|
if (!t || !t.contains(document.activeElement) && document.activeElement !== t) return;
|
|
@@ -200,7 +203,7 @@ function S({ url: n, onError: i }) {
|
|
|
200
203
|
if (n) switch (e.key) {
|
|
201
204
|
case " ":
|
|
202
205
|
case "k":
|
|
203
|
-
e.preventDefault(),
|
|
206
|
+
e.preventDefault(), m((e) => (e ? n.pause() : n.play(), !e));
|
|
204
207
|
break;
|
|
205
208
|
case "ArrowRight":
|
|
206
209
|
e.preventDefault(), n.currentTime = Math.min(n.duration, n.currentTime + 5);
|
|
@@ -231,11 +234,11 @@ function S({ url: n, onError: i }) {
|
|
|
231
234
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
232
235
|
}, []);
|
|
233
236
|
function I(e) {
|
|
234
|
-
let t =
|
|
237
|
+
let t = S.indexOf(N), n = S[Math.max(0, Math.min(S.length - 1, t + e))];
|
|
235
238
|
P(n), a.current && (a.current.playbackRate = n);
|
|
236
239
|
}
|
|
237
240
|
function L() {
|
|
238
|
-
a.current && (
|
|
241
|
+
a.current && (s ? a.current.pause() : a.current.play(), m(!s));
|
|
239
242
|
}
|
|
240
243
|
function R(e) {
|
|
241
244
|
if (!a.current || !C) return;
|
|
@@ -243,37 +246,37 @@ function S({ url: n, onError: i }) {
|
|
|
243
246
|
a.current.currentTime = n * C;
|
|
244
247
|
}
|
|
245
248
|
function z() {
|
|
246
|
-
M(!0), clearTimeout(F.current),
|
|
249
|
+
M(!0), clearTimeout(F.current), s && (F.current = setTimeout(() => M(!1), 3e3));
|
|
247
250
|
}
|
|
248
|
-
return k ? /* @__PURE__ */
|
|
251
|
+
return k ? /* @__PURE__ */ f(u, {
|
|
249
252
|
message: "Could not load video",
|
|
250
253
|
url: n
|
|
251
|
-
}) : /* @__PURE__ */
|
|
254
|
+
}) : /* @__PURE__ */ p("div", {
|
|
252
255
|
ref: o,
|
|
253
256
|
className: "group relative rounded-control bg-black overflow-hidden",
|
|
254
257
|
onMouseMove: z,
|
|
255
|
-
onMouseLeave: () =>
|
|
258
|
+
onMouseLeave: () => s && M(!1),
|
|
256
259
|
tabIndex: -1,
|
|
257
260
|
children: [
|
|
258
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ f("video", {
|
|
259
262
|
ref: a,
|
|
260
263
|
src: n,
|
|
261
264
|
className: "max-h-[70vh] w-full",
|
|
262
265
|
onClick: L,
|
|
263
266
|
muted: D,
|
|
264
267
|
onTimeUpdate: () => {
|
|
265
|
-
a.current && (E(a.current.currentTime), a.current.duration &&
|
|
268
|
+
a.current && (E(a.current.currentTime), a.current.duration && x(a.current.currentTime / a.current.duration * 100));
|
|
266
269
|
},
|
|
267
270
|
onLoadedMetadata: () => w(a.current?.duration ?? 0),
|
|
268
271
|
onEnded: () => {
|
|
269
|
-
|
|
272
|
+
m(!1), M(!0);
|
|
270
273
|
},
|
|
271
274
|
onError: () => {
|
|
272
275
|
A(!0), i?.("Video failed to load");
|
|
273
276
|
},
|
|
274
277
|
playsInline: !0
|
|
275
278
|
}),
|
|
276
|
-
!
|
|
279
|
+
!s && /* @__PURE__ */ f(y.button, {
|
|
277
280
|
initial: {
|
|
278
281
|
opacity: 0,
|
|
279
282
|
scale: .8
|
|
@@ -286,16 +289,16 @@ function S({ url: n, onError: i }) {
|
|
|
286
289
|
onClick: L,
|
|
287
290
|
className: "absolute inset-0 flex items-center justify-center bg-black/30",
|
|
288
291
|
"aria-label": "Play video",
|
|
289
|
-
children: /* @__PURE__ */
|
|
292
|
+
children: /* @__PURE__ */ f("div", {
|
|
290
293
|
className: "flex h-14 w-14 items-center justify-center rounded-pill bg-white/90 shadow-floating",
|
|
291
|
-
children: /* @__PURE__ */
|
|
292
|
-
icon:
|
|
294
|
+
children: /* @__PURE__ */ f(r, {
|
|
295
|
+
icon: _,
|
|
293
296
|
size: "xl",
|
|
294
297
|
className: "text-surface-fg ml-0.5"
|
|
295
298
|
})
|
|
296
299
|
})
|
|
297
300
|
}),
|
|
298
|
-
/* @__PURE__ */
|
|
301
|
+
/* @__PURE__ */ f(v, { children: j && C > 0 && /* @__PURE__ */ p(y.div, {
|
|
299
302
|
initial: {
|
|
300
303
|
opacity: 0,
|
|
301
304
|
y: 10
|
|
@@ -310,7 +313,7 @@ function S({ url: n, onError: i }) {
|
|
|
310
313
|
},
|
|
311
314
|
transition: t.fade,
|
|
312
315
|
className: "absolute bottom-0 left-0 right-0 bg-linear-to-t from-black/80 to-transparent px-ds-04 pb-ds-04 pt-ds-08",
|
|
313
|
-
children: [/* @__PURE__ */
|
|
316
|
+
children: [/* @__PURE__ */ p("div", {
|
|
314
317
|
className: "relative h-1 w-full cursor-pointer rounded-pill bg-white/30 mb-ds-03 group/progress",
|
|
315
318
|
onClick: R,
|
|
316
319
|
role: "slider",
|
|
@@ -319,33 +322,33 @@ function S({ url: n, onError: i }) {
|
|
|
319
322
|
"aria-valuemin": 0,
|
|
320
323
|
"aria-valuemax": 100,
|
|
321
324
|
tabIndex: 0,
|
|
322
|
-
children: [/* @__PURE__ */
|
|
325
|
+
children: [/* @__PURE__ */ f("div", {
|
|
323
326
|
className: "absolute left-0 top-0 h-full rounded-pill bg-white transition-[width] duration-75",
|
|
324
327
|
style: { width: `${b}%` }
|
|
325
|
-
}), /* @__PURE__ */
|
|
328
|
+
}), /* @__PURE__ */ f("div", {
|
|
326
329
|
className: "absolute top-1/2 -translate-y-1/2 h-3 w-3 rounded-pill bg-white shadow-raised opacity-0 group-hover/progress:opacity-100 transition-opacity",
|
|
327
330
|
style: {
|
|
328
331
|
left: `${b}%`,
|
|
329
332
|
marginLeft: "-6px"
|
|
330
333
|
}
|
|
331
334
|
})]
|
|
332
|
-
}), /* @__PURE__ */
|
|
335
|
+
}), /* @__PURE__ */ p("div", {
|
|
333
336
|
className: "flex items-center gap-ds-03",
|
|
334
337
|
children: [
|
|
335
|
-
/* @__PURE__ */
|
|
338
|
+
/* @__PURE__ */ f("button", {
|
|
336
339
|
onClick: L,
|
|
337
340
|
className: "text-white hover:text-white/80",
|
|
338
|
-
"aria-label":
|
|
339
|
-
title:
|
|
340
|
-
children:
|
|
341
|
-
icon: h,
|
|
342
|
-
size: "lg"
|
|
343
|
-
}) : /* @__PURE__ */ d(r, {
|
|
341
|
+
"aria-label": s ? "Pause" : "Play",
|
|
342
|
+
title: s ? "Pause" : "Play",
|
|
343
|
+
children: s ? /* @__PURE__ */ f(r, {
|
|
344
344
|
icon: g,
|
|
345
345
|
size: "lg"
|
|
346
|
+
}) : /* @__PURE__ */ f(r, {
|
|
347
|
+
icon: _,
|
|
348
|
+
size: "lg"
|
|
346
349
|
})
|
|
347
350
|
}),
|
|
348
|
-
/* @__PURE__ */
|
|
351
|
+
/* @__PURE__ */ f(l, {
|
|
349
352
|
volume: +!D,
|
|
350
353
|
muted: D,
|
|
351
354
|
onVolumeChange: (e) => {
|
|
@@ -356,28 +359,28 @@ function S({ url: n, onError: i }) {
|
|
|
356
359
|
},
|
|
357
360
|
variant: "dark"
|
|
358
361
|
}),
|
|
359
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ p("span", {
|
|
360
363
|
className: "text-[11px] font-mono text-white/70 tabular-nums",
|
|
361
364
|
children: [
|
|
362
|
-
|
|
365
|
+
c(T),
|
|
363
366
|
" / ",
|
|
364
|
-
|
|
367
|
+
c(C)
|
|
365
368
|
]
|
|
366
369
|
}),
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ f("div", { className: "flex-1" }),
|
|
371
|
+
/* @__PURE__ */ p("button", {
|
|
369
372
|
onClick: () => I(1),
|
|
370
373
|
className: "text-[11px] font-mono text-white/70 hover:text-white px-1 rounded-control-inner hover:bg-white/10 transition-colors",
|
|
371
374
|
"aria-label": `Playback speed: ${N}x`,
|
|
372
375
|
children: [N, "x"]
|
|
373
376
|
}),
|
|
374
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ f("button", {
|
|
375
378
|
onClick: () => a.current?.requestFullscreen?.(),
|
|
376
379
|
className: "text-white hover:text-white/80",
|
|
377
380
|
"aria-label": "Fullscreen (F)",
|
|
378
381
|
title: "Fullscreen",
|
|
379
|
-
children: /* @__PURE__ */
|
|
380
|
-
icon:
|
|
382
|
+
children: /* @__PURE__ */ f(r, {
|
|
383
|
+
icon: h,
|
|
381
384
|
size: "sm"
|
|
382
385
|
})
|
|
383
386
|
})
|
|
@@ -389,8 +392,8 @@ function S({ url: n, onError: i }) {
|
|
|
389
392
|
}
|
|
390
393
|
//#endregion
|
|
391
394
|
//#region src/composed/file-preview.tsx
|
|
392
|
-
var
|
|
393
|
-
function
|
|
395
|
+
var w = d.lazy(() => import("../_chunks/image-preview.js")), T = d.lazy(() => import("../_chunks/document-preview.js"));
|
|
396
|
+
function E(e, t) {
|
|
394
397
|
if (t) {
|
|
395
398
|
if (t.startsWith("image/")) return "image";
|
|
396
399
|
if (t === "application/pdf") return "pdf";
|
|
@@ -420,7 +423,7 @@ function T(e, t) {
|
|
|
420
423
|
"flac"
|
|
421
424
|
].includes(n ?? "") ? "audio" : e.includes("figma.com") || e.includes("loom.com") || e.includes("youtube.com") || e.includes("youtu.be") || e.includes("vimeo.com") ? "embed" : "image";
|
|
422
425
|
}
|
|
423
|
-
function
|
|
426
|
+
function D(e) {
|
|
424
427
|
let t = e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&?]+)/);
|
|
425
428
|
if (t) return `https://www.youtube.com/embed/${t[1]}`;
|
|
426
429
|
let n = e.match(/vimeo\.com\/(\d+)/);
|
|
@@ -429,61 +432,62 @@ function E(e) {
|
|
|
429
432
|
let r = e.match(/loom\.com\/share\/([^?]+)/);
|
|
430
433
|
return r ? `https://www.loom.com/embed/${r[1]}` : e;
|
|
431
434
|
}
|
|
432
|
-
function
|
|
433
|
-
let
|
|
434
|
-
return /* @__PURE__ */
|
|
435
|
-
className: n("flex flex-col gap-ds-03",
|
|
436
|
-
...
|
|
435
|
+
function O({ url: e, type: t, mimeType: c, alt: l, initialPage: u = 1, fileName: h, fileSize: g, onError: _, className: v, ...y }) {
|
|
436
|
+
let S = t ?? E(e, c), O = /* @__PURE__ */ f(o, { className: "h-64 w-full rounded-control" });
|
|
437
|
+
return /* @__PURE__ */ p("div", {
|
|
438
|
+
className: n("flex flex-col gap-ds-03", v),
|
|
439
|
+
...y,
|
|
437
440
|
children: [
|
|
438
|
-
(
|
|
441
|
+
(h || g) && /* @__PURE__ */ p("div", {
|
|
439
442
|
className: "flex items-center gap-ds-03",
|
|
440
|
-
children: [
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
443
|
+
children: [h && /* @__PURE__ */ f(s, {
|
|
444
|
+
mode: "middle",
|
|
445
|
+
className: "min-w-0 text-ds-sm font-semibold text-surface-fg",
|
|
446
|
+
children: h
|
|
447
|
+
}), g && /* @__PURE__ */ f(i, {
|
|
444
448
|
variant: "subtle",
|
|
445
449
|
size: "xs",
|
|
446
|
-
children:
|
|
450
|
+
children: g
|
|
447
451
|
})]
|
|
448
452
|
}),
|
|
449
|
-
|
|
450
|
-
fallback:
|
|
451
|
-
children: /* @__PURE__ */
|
|
453
|
+
S === "image" && /* @__PURE__ */ f(d.Suspense, {
|
|
454
|
+
fallback: O,
|
|
455
|
+
children: /* @__PURE__ */ f(w, {
|
|
452
456
|
url: e,
|
|
453
|
-
alt:
|
|
454
|
-
onError:
|
|
457
|
+
alt: l,
|
|
458
|
+
onError: _
|
|
455
459
|
})
|
|
456
460
|
}),
|
|
457
|
-
|
|
458
|
-
fallback:
|
|
459
|
-
children: /* @__PURE__ */
|
|
461
|
+
S === "pdf" && /* @__PURE__ */ f(d.Suspense, {
|
|
462
|
+
fallback: O,
|
|
463
|
+
children: /* @__PURE__ */ f(T, {
|
|
460
464
|
url: e,
|
|
461
|
-
initialPage:
|
|
462
|
-
onError:
|
|
465
|
+
initialPage: u,
|
|
466
|
+
onError: _
|
|
463
467
|
})
|
|
464
468
|
}),
|
|
465
|
-
|
|
469
|
+
S === "video" && /* @__PURE__ */ f(C, {
|
|
466
470
|
url: e,
|
|
467
|
-
onError:
|
|
471
|
+
onError: _
|
|
468
472
|
}),
|
|
469
|
-
|
|
473
|
+
S === "audio" && /* @__PURE__ */ f(b, {
|
|
470
474
|
url: e,
|
|
471
|
-
fileName:
|
|
472
|
-
onError:
|
|
475
|
+
fileName: h,
|
|
476
|
+
onError: _
|
|
473
477
|
}),
|
|
474
|
-
|
|
478
|
+
S === "embed" && /* @__PURE__ */ f(x, {
|
|
475
479
|
url: e,
|
|
476
|
-
embedUrl:
|
|
477
|
-
onError:
|
|
480
|
+
embedUrl: D(e),
|
|
481
|
+
onError: _
|
|
478
482
|
}),
|
|
479
|
-
|
|
483
|
+
S !== "audio" && /* @__PURE__ */ f("div", {
|
|
480
484
|
className: "flex justify-end",
|
|
481
|
-
children: /* @__PURE__ */
|
|
485
|
+
children: /* @__PURE__ */ f(a, {
|
|
482
486
|
variant: "ghost",
|
|
483
487
|
size: "xs",
|
|
484
|
-
startIcon: /* @__PURE__ */
|
|
488
|
+
startIcon: /* @__PURE__ */ f(r, { icon: m }),
|
|
485
489
|
asChild: !0,
|
|
486
|
-
children: /* @__PURE__ */
|
|
490
|
+
children: /* @__PURE__ */ f("a", {
|
|
487
491
|
href: e,
|
|
488
492
|
download: !0,
|
|
489
493
|
target: "_blank",
|
|
@@ -496,4 +500,4 @@ function D({ url: e, type: t, mimeType: s, alt: c, initialPage: l = 1, fileName:
|
|
|
496
500
|
});
|
|
497
501
|
}
|
|
498
502
|
//#endregion
|
|
499
|
-
export {
|
|
503
|
+
export { O as FilePreview };
|