@anvia/react-ui 1.3.0 → 1.3.1
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/attachment/index.d.ts +3 -21
- package/dist/attachment/index.js +3 -12
- package/dist/attachment-DsKTPumt.js +89 -0
- package/dist/attachment-DsKTPumt.js.map +1 -0
- package/dist/chat/index.d.ts +3 -152
- package/dist/chat/index.js +3 -25
- package/dist/chat-CAnvUEAv.js +1210 -0
- package/dist/chat-CAnvUEAv.js.map +1 -0
- package/dist/completion/index.d.ts +3 -29
- package/dist/completion/index.js +3 -16
- package/dist/completion-DDTKoZRJ.js +124 -0
- package/dist/completion-DDTKoZRJ.js.map +1 -0
- package/dist/connection-DeNq8wHS.js +203 -0
- package/dist/connection-DeNq8wHS.js.map +1 -0
- package/dist/contexts-B4ijG24z.js +212 -0
- package/dist/contexts-B4ijG24z.js.map +1 -0
- package/dist/elements-D4vmkkF8.js +19 -0
- package/dist/elements-D4vmkkF8.js.map +1 -0
- package/dist/graph-explorer/index.d.ts +54 -73
- package/dist/graph-explorer/index.d.ts.map +1 -0
- package/dist/graph-explorer/index.js +181 -248
- package/dist/graph-explorer/index.js.map +1 -1
- package/dist/human-input/index.d.ts +3 -78
- package/dist/human-input/index.js +3 -21
- package/dist/human-input-CsCbZomZ.js +314 -0
- package/dist/human-input-CsCbZomZ.js.map +1 -0
- package/dist/image/index.d.ts +3 -40
- package/dist/image/index.js +3 -12
- package/dist/image-D_7vaQCR.js +302 -0
- package/dist/image-D_7vaQCR.js.map +1 -0
- package/dist/index-B1Qs2Cjv.d.ts +145 -0
- package/dist/index-B1Qs2Cjv.d.ts.map +1 -0
- package/dist/index-BCBVcl0D.d.ts +277 -0
- package/dist/index-BCBVcl0D.d.ts.map +1 -0
- package/dist/index-CE22tsua.d.ts +20 -0
- package/dist/index-CE22tsua.d.ts.map +1 -0
- package/dist/index-CGqtpc6b.d.ts +25 -0
- package/dist/index-CGqtpc6b.d.ts.map +1 -0
- package/dist/index-DqdyM0Jm.d.ts +7 -0
- package/dist/index-DqdyM0Jm.d.ts.map +1 -0
- package/dist/index-Mw3ltwSG.d.ts +318 -0
- package/dist/index-Mw3ltwSG.d.ts.map +1 -0
- package/dist/index.d.ts +7 -40
- package/dist/index.js +34 -118
- package/dist/index.js.map +1 -1
- package/dist/message/index.d.ts +3 -105
- package/dist/message/index.js +3 -20
- package/dist/message-Dn3wW6yy.js +783 -0
- package/dist/message-Dn3wW6yy.js.map +1 -0
- package/dist/primitives-xfE7zfwJ.js +15 -0
- package/dist/primitives-xfE7zfwJ.js.map +1 -0
- package/dist/refs-Djj9rSvB.js +10 -0
- package/dist/refs-Djj9rSvB.js.map +1 -0
- package/dist/sandbox-desktop/index.d.ts +100 -104
- package/dist/sandbox-desktop/index.d.ts.map +1 -0
- package/dist/sandbox-desktop/index.js +344 -342
- package/dist/sandbox-desktop/index.js.map +1 -1
- package/dist/sandbox-terminal/index.d.ts +52 -56
- package/dist/sandbox-terminal/index.d.ts.map +1 -0
- package/dist/sandbox-terminal/index.js +217 -208
- package/dist/sandbox-terminal/index.js.map +1 -1
- package/dist/selection-toolbar/index.d.ts +3 -21
- package/dist/selection-toolbar/index.js +3 -13
- package/dist/selection-toolbar-CIkOoM-7.js +171 -0
- package/dist/selection-toolbar-CIkOoM-7.js.map +1 -0
- package/dist/shared-BSYElFU2.d.ts +2 -0
- package/dist/shared.d.ts +4 -14
- package/dist/shared.js +1 -43
- package/dist/stream/index.d.ts +2 -22
- package/dist/stream/index.js +1 -8
- package/dist/stream-CAO0x8_1.js +298 -0
- package/dist/stream-CAO0x8_1.js.map +1 -0
- package/dist/thread-list/index.d.ts +3 -47
- package/dist/thread-list/index.js +3 -18
- package/dist/thread-list-xJbGXFrE.js +228 -0
- package/dist/thread-list-xJbGXFrE.js.map +1 -0
- package/dist/ticket-CoJHBpdF.d.ts +32 -0
- package/dist/ticket-CoJHBpdF.d.ts.map +1 -0
- package/dist/value-BGGrx72L.js +13 -0
- package/dist/value-BGGrx72L.js.map +1 -0
- package/package.json +22 -22
- package/dist/attachment/index.js.map +0 -1
- package/dist/attachment-mbjsroli.d.ts +0 -9
- package/dist/chat/index.js.map +0 -1
- package/dist/chat-PSj1Fo4W.d.ts +0 -88
- package/dist/chunk-22EZJUPM.js +0 -120
- package/dist/chunk-22EZJUPM.js.map +0 -1
- package/dist/chunk-5FZKTDZR.js +0 -201
- package/dist/chunk-5FZKTDZR.js.map +0 -1
- package/dist/chunk-6XOJFLX4.js +0 -22
- package/dist/chunk-6XOJFLX4.js.map +0 -1
- package/dist/chunk-CKA4CE26.js +0 -25
- package/dist/chunk-CKA4CE26.js.map +0 -1
- package/dist/chunk-DLBNFBXQ.js +0 -425
- package/dist/chunk-DLBNFBXQ.js.map +0 -1
- package/dist/chunk-E73S3SOF.js +0 -404
- package/dist/chunk-E73S3SOF.js.map +0 -1
- package/dist/chunk-F6AKBUO3.js +0 -380
- package/dist/chunk-F6AKBUO3.js.map +0 -1
- package/dist/chunk-HGOPGZNQ.js +0 -195
- package/dist/chunk-HGOPGZNQ.js.map +0 -1
- package/dist/chunk-KHB5CHAU.js +0 -220
- package/dist/chunk-KHB5CHAU.js.map +0 -1
- package/dist/chunk-LHABOAOP.js +0 -316
- package/dist/chunk-LHABOAOP.js.map +0 -1
- package/dist/chunk-N5XQU36W.js +0 -410
- package/dist/chunk-N5XQU36W.js.map +0 -1
- package/dist/chunk-T3ZFZ3NP.js +0 -30
- package/dist/chunk-T3ZFZ3NP.js.map +0 -1
- package/dist/chunk-T4IYUEPH.js +0 -1612
- package/dist/chunk-T4IYUEPH.js.map +0 -1
- package/dist/chunk-W2AHKMRS.js +0 -1092
- package/dist/chunk-W2AHKMRS.js.map +0 -1
- package/dist/completion/index.js.map +0 -1
- package/dist/completion-input-DHlwrhxB.d.ts +0 -24
- package/dist/composer-6iCSIq6L.d.ts +0 -111
- package/dist/human-input/index.js.map +0 -1
- package/dist/human-input-CkLrZ8IC.d.ts +0 -27
- package/dist/image/index.js.map +0 -1
- package/dist/image-VZv6Ddsn.d.ts +0 -14
- package/dist/message/index.js.map +0 -1
- package/dist/message-CNRnZQwU.d.ts +0 -14
- package/dist/render-CRKWam2v.d.ts +0 -8
- package/dist/selection-toolbar/index.js.map +0 -1
- package/dist/selection-toolbar-Cwjbuv5S.d.ts +0 -14
- package/dist/shared.js.map +0 -1
- package/dist/stream/index.js.map +0 -1
- package/dist/thread-Bz6-1zaJ.d.ts +0 -12
- package/dist/thread-list/index.js.map +0 -1
- package/dist/thread-list-On8db4XL.d.ts +0 -34
- package/dist/ticket-pexI1zIa.d.ts +0 -33
package/dist/chunk-DLBNFBXQ.js
DELETED
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
composeRefs,
|
|
3
|
-
renderPrimitive
|
|
4
|
-
} from "./chunk-T3ZFZ3NP.js";
|
|
5
|
-
import {
|
|
6
|
-
InternalImageProvider,
|
|
7
|
-
useImage,
|
|
8
|
-
useOptionalAttachment
|
|
9
|
-
} from "./chunk-E73S3SOF.js";
|
|
10
|
-
|
|
11
|
-
// src/image/parts.tsx
|
|
12
|
-
import {
|
|
13
|
-
forwardRef,
|
|
14
|
-
useCallback,
|
|
15
|
-
useEffect,
|
|
16
|
-
useMemo,
|
|
17
|
-
useRef,
|
|
18
|
-
useState
|
|
19
|
-
} from "react";
|
|
20
|
-
import { createPortal } from "react-dom";
|
|
21
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
-
var ImageRoot = forwardRef(function ImageRoot2({ attachment: attachmentProp, children, renderWhen = "image", ...props }, ref) {
|
|
23
|
-
const attachmentContext = useOptionalAttachment();
|
|
24
|
-
const attachment = attachmentProp ?? attachmentContext?.attachment;
|
|
25
|
-
const [zoomOpen, setZoomOpen] = useState(false);
|
|
26
|
-
if (attachment === void 0) {
|
|
27
|
-
throw new Error(
|
|
28
|
-
"ImagePrimitive.Root requires an attachment prop or AttachmentPrimitive context."
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
const src = imageSource(attachment);
|
|
32
|
-
const isImage = isImageAttachment(attachment);
|
|
33
|
-
const value = useMemo(() => {
|
|
34
|
-
const context = {
|
|
35
|
-
attachment,
|
|
36
|
-
isImage,
|
|
37
|
-
zoomOpen,
|
|
38
|
-
setZoomOpen
|
|
39
|
-
};
|
|
40
|
-
if (src !== void 0) context.src = src;
|
|
41
|
-
if (attachment.name !== void 0) context.name = attachment.name;
|
|
42
|
-
if (attachment.mediaType !== void 0) context.mediaType = attachment.mediaType;
|
|
43
|
-
return context;
|
|
44
|
-
}, [attachment, isImage, src, zoomOpen]);
|
|
45
|
-
if (!isImage && renderWhen !== "always") {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
const renderedChildren = typeof children === "function" ? children(value) : children;
|
|
49
|
-
return /* @__PURE__ */ jsx(InternalImageProvider, { value, children: renderPrimitive(
|
|
50
|
-
"figure",
|
|
51
|
-
{
|
|
52
|
-
...props,
|
|
53
|
-
children: renderedChildren ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
|
-
/* @__PURE__ */ jsx(ImagePreview, {}),
|
|
55
|
-
/* @__PURE__ */ jsx(ImageName, {})
|
|
56
|
-
] }),
|
|
57
|
-
"data-state": src === void 0 ? "unavailable" : "ready"
|
|
58
|
-
},
|
|
59
|
-
ref
|
|
60
|
-
) });
|
|
61
|
-
});
|
|
62
|
-
var ImagePreview = forwardRef(function ImagePreview2({ alt, errorFallback, loadingFallback, ...props }, ref) {
|
|
63
|
-
const image = useImage();
|
|
64
|
-
const src = image.src;
|
|
65
|
-
const [state, setState] = useState(
|
|
66
|
-
src === void 0 ? "error" : "loading"
|
|
67
|
-
);
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
setState(src === void 0 ? "error" : "loading");
|
|
70
|
-
}, [src]);
|
|
71
|
-
const fallback = state === "loading" ? loadingFallback ?? "Loading image" : state === "error" ? errorFallback ?? "Image unavailable" : null;
|
|
72
|
-
return renderPrimitive(
|
|
73
|
-
"div",
|
|
74
|
-
{
|
|
75
|
-
...props,
|
|
76
|
-
children: src === void 0 ? fallback : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
77
|
-
state === "ready" ? null : /* @__PURE__ */ jsx("span", { children: fallback }),
|
|
78
|
-
/* @__PURE__ */ jsx(
|
|
79
|
-
"img",
|
|
80
|
-
{
|
|
81
|
-
alt: alt ?? image.name ?? "Image",
|
|
82
|
-
hidden: state !== "ready",
|
|
83
|
-
onError: () => setState("error"),
|
|
84
|
-
onLoad: () => setState("ready"),
|
|
85
|
-
src
|
|
86
|
-
}
|
|
87
|
-
)
|
|
88
|
-
] }),
|
|
89
|
-
"data-state": state
|
|
90
|
-
},
|
|
91
|
-
ref
|
|
92
|
-
);
|
|
93
|
-
});
|
|
94
|
-
var ImageName = forwardRef(
|
|
95
|
-
function ImageName2(props, ref) {
|
|
96
|
-
const image = useImage();
|
|
97
|
-
return renderPrimitive(
|
|
98
|
-
"figcaption",
|
|
99
|
-
{
|
|
100
|
-
...props,
|
|
101
|
-
children: props.children ?? image.name ?? image.mediaType ?? image.attachment.type
|
|
102
|
-
},
|
|
103
|
-
ref
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
var ImageActions = forwardRef(
|
|
108
|
-
function ImageActions2(props, ref) {
|
|
109
|
-
return renderPrimitive(
|
|
110
|
-
"div",
|
|
111
|
-
{
|
|
112
|
-
...props
|
|
113
|
-
},
|
|
114
|
-
ref
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
);
|
|
118
|
-
var ImageCopy = forwardRef(function ImageCopy2({ onClick, ...props }, ref) {
|
|
119
|
-
const image = useImage();
|
|
120
|
-
const [copyState, setCopyState] = useState("idle");
|
|
121
|
-
const disabled = props.disabled ?? image.src === void 0;
|
|
122
|
-
const handleClick = useCallback(
|
|
123
|
-
async (event) => {
|
|
124
|
-
onClick?.(event);
|
|
125
|
-
if (event.defaultPrevented || disabled || image.src === void 0) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
try {
|
|
129
|
-
await copyImage(image);
|
|
130
|
-
setCopyState("done");
|
|
131
|
-
} catch {
|
|
132
|
-
setCopyState("error");
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
[disabled, image, onClick]
|
|
136
|
-
);
|
|
137
|
-
return renderPrimitive(
|
|
138
|
-
"button",
|
|
139
|
-
{
|
|
140
|
-
...props,
|
|
141
|
-
children: props.children ?? "Copy image",
|
|
142
|
-
disabled,
|
|
143
|
-
onClick: handleClick,
|
|
144
|
-
type: props.type ?? "button",
|
|
145
|
-
"data-state": copyState
|
|
146
|
-
},
|
|
147
|
-
ref
|
|
148
|
-
);
|
|
149
|
-
});
|
|
150
|
-
var ImageDownload = forwardRef(function ImageDownload2({ filename, onClick, ...props }, ref) {
|
|
151
|
-
const image = useImage();
|
|
152
|
-
const disabled = props.disabled ?? image.src === void 0;
|
|
153
|
-
const handleClick = useCallback(
|
|
154
|
-
async (event) => {
|
|
155
|
-
onClick?.(event);
|
|
156
|
-
if (event.defaultPrevented || disabled || image.src === void 0) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
try {
|
|
160
|
-
await downloadImage(image, filename);
|
|
161
|
-
} catch {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
[disabled, filename, image, onClick]
|
|
166
|
-
);
|
|
167
|
-
return renderPrimitive(
|
|
168
|
-
"button",
|
|
169
|
-
{
|
|
170
|
-
...props,
|
|
171
|
-
children: props.children ?? "Download",
|
|
172
|
-
disabled,
|
|
173
|
-
onClick: handleClick,
|
|
174
|
-
type: props.type ?? "button",
|
|
175
|
-
"data-state": disabled ? "disabled" : "enabled"
|
|
176
|
-
},
|
|
177
|
-
ref
|
|
178
|
-
);
|
|
179
|
-
});
|
|
180
|
-
var ImageZoomTrigger = forwardRef(
|
|
181
|
-
function ImageZoomTrigger2({ onClick, ...props }, ref) {
|
|
182
|
-
const image = useImage();
|
|
183
|
-
const disabled = props.disabled ?? image.src === void 0;
|
|
184
|
-
const handleClick = useCallback(
|
|
185
|
-
(event) => {
|
|
186
|
-
onClick?.(event);
|
|
187
|
-
if (event.defaultPrevented || disabled) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
image.setZoomOpen(true);
|
|
191
|
-
},
|
|
192
|
-
[disabled, image, onClick]
|
|
193
|
-
);
|
|
194
|
-
return renderPrimitive(
|
|
195
|
-
"button",
|
|
196
|
-
{
|
|
197
|
-
...props,
|
|
198
|
-
children: props.children ?? "Open image",
|
|
199
|
-
disabled,
|
|
200
|
-
onClick: handleClick,
|
|
201
|
-
type: props.type ?? "button",
|
|
202
|
-
"data-state": disabled ? "disabled" : "enabled"
|
|
203
|
-
},
|
|
204
|
-
ref
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
);
|
|
208
|
-
var ImageZoomOverlay = forwardRef(
|
|
209
|
-
function ImageZoomOverlay2({ container, onClick, onKeyDown, ...props }, ref) {
|
|
210
|
-
const image = useImage();
|
|
211
|
-
const portalContainer = container ?? globalThis.document?.body;
|
|
212
|
-
const overlayRef = useRef(null);
|
|
213
|
-
const composedRef = useMemo(() => composeRefs(overlayRef, ref), [ref]);
|
|
214
|
-
useEffect(() => {
|
|
215
|
-
if (!image.zoomOpen) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
const document = globalThis.document;
|
|
219
|
-
if (document === void 0) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
const handleKeyDown2 = (event) => {
|
|
223
|
-
if (event.key === "Escape") {
|
|
224
|
-
image.setZoomOpen(false);
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
document.addEventListener("keydown", handleKeyDown2);
|
|
228
|
-
return () => {
|
|
229
|
-
document.removeEventListener("keydown", handleKeyDown2);
|
|
230
|
-
};
|
|
231
|
-
}, [image]);
|
|
232
|
-
useEffect(() => {
|
|
233
|
-
if (!image.zoomOpen) {
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
const activeElement = globalThis.document?.activeElement;
|
|
237
|
-
const previousFocus = activeElement instanceof HTMLElement ? activeElement : void 0;
|
|
238
|
-
focusOverlay(overlayRef.current);
|
|
239
|
-
return () => {
|
|
240
|
-
if (previousFocus?.isConnected === true) {
|
|
241
|
-
previousFocus.focus();
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
}, [image.zoomOpen]);
|
|
245
|
-
const handleClick = useCallback(
|
|
246
|
-
(event) => {
|
|
247
|
-
onClick?.(event);
|
|
248
|
-
if (!event.defaultPrevented) {
|
|
249
|
-
image.setZoomOpen(false);
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
[image, onClick]
|
|
253
|
-
);
|
|
254
|
-
const handleKeyDown = useCallback(
|
|
255
|
-
(event) => {
|
|
256
|
-
onKeyDown?.(event);
|
|
257
|
-
if (event.defaultPrevented) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
if (event.key === "Escape") {
|
|
261
|
-
image.setZoomOpen(false);
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
if (event.key === "Tab") {
|
|
265
|
-
trapOverlayFocus(event, overlayRef.current);
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
[image, onKeyDown]
|
|
269
|
-
);
|
|
270
|
-
if (!image.zoomOpen || image.src === void 0 || portalContainer === void 0) {
|
|
271
|
-
return null;
|
|
272
|
-
}
|
|
273
|
-
const overlay = renderPrimitive(
|
|
274
|
-
"div",
|
|
275
|
-
{
|
|
276
|
-
...props,
|
|
277
|
-
children: /* @__PURE__ */ jsx("img", { alt: image.name ?? "Image", src: image.src }),
|
|
278
|
-
onClick: handleClick,
|
|
279
|
-
onKeyDown: handleKeyDown,
|
|
280
|
-
"aria-modal": props["aria-modal"] ?? true,
|
|
281
|
-
role: props.role ?? "dialog",
|
|
282
|
-
tabIndex: props.tabIndex ?? -1
|
|
283
|
-
},
|
|
284
|
-
composedRef
|
|
285
|
-
);
|
|
286
|
-
return createPortal(overlay, portalContainer);
|
|
287
|
-
}
|
|
288
|
-
);
|
|
289
|
-
function isImageAttachment(attachment) {
|
|
290
|
-
return attachment.type === "image" || attachment.mediaType?.startsWith("image/") === true;
|
|
291
|
-
}
|
|
292
|
-
function imageSource(attachment) {
|
|
293
|
-
if (!isImageAttachment(attachment)) {
|
|
294
|
-
return attachment.url;
|
|
295
|
-
}
|
|
296
|
-
if (attachment.url !== void 0) {
|
|
297
|
-
return attachment.url;
|
|
298
|
-
}
|
|
299
|
-
if (attachment.data !== void 0 && attachment.mediaType !== void 0) {
|
|
300
|
-
return `data:${attachment.mediaType};base64,${attachment.data}`;
|
|
301
|
-
}
|
|
302
|
-
return void 0;
|
|
303
|
-
}
|
|
304
|
-
async function copyImage(image) {
|
|
305
|
-
if (image.src === void 0) {
|
|
306
|
-
throw new Error("Image source is unavailable.");
|
|
307
|
-
}
|
|
308
|
-
const clipboard = globalThis.navigator?.clipboard;
|
|
309
|
-
const ClipboardItemConstructor = globalThis.ClipboardItem;
|
|
310
|
-
if (clipboard?.write === void 0 || ClipboardItemConstructor === void 0) {
|
|
311
|
-
throw new Error("Clipboard image copy is unavailable.");
|
|
312
|
-
}
|
|
313
|
-
const blob = await imageBlob(image);
|
|
314
|
-
await clipboard.write([new ClipboardItemConstructor({ [blob.type]: blob })]);
|
|
315
|
-
}
|
|
316
|
-
async function imageBlob(image) {
|
|
317
|
-
if (image.attachment.data !== void 0) {
|
|
318
|
-
return base64ToBlob(
|
|
319
|
-
image.attachment.data,
|
|
320
|
-
image.attachment.mediaType ?? image.mediaType ?? "image/png"
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
if (image.src === void 0 || globalThis.fetch === void 0) {
|
|
324
|
-
throw new Error("Image source is unavailable.");
|
|
325
|
-
}
|
|
326
|
-
const response = await fetch(image.src);
|
|
327
|
-
return response.blob();
|
|
328
|
-
}
|
|
329
|
-
function base64ToBlob(data, mediaType) {
|
|
330
|
-
const binary = globalThis.atob(data);
|
|
331
|
-
const bytes = new Uint8Array(binary.length);
|
|
332
|
-
for (let index = 0; index < binary.length; index += 1) {
|
|
333
|
-
bytes[index] = binary.charCodeAt(index);
|
|
334
|
-
}
|
|
335
|
-
return new Blob([bytes], { type: mediaType });
|
|
336
|
-
}
|
|
337
|
-
async function downloadImage(image, filename) {
|
|
338
|
-
const document = globalThis.document;
|
|
339
|
-
const url = globalThis.URL;
|
|
340
|
-
if (image.src === void 0 || document === void 0 || url?.createObjectURL === void 0) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
const blobUrl = url.createObjectURL(await imageBlob(image));
|
|
344
|
-
const link = document.createElement("a");
|
|
345
|
-
try {
|
|
346
|
-
link.href = blobUrl;
|
|
347
|
-
link.download = filename ?? image.name ?? defaultImageFilename(image);
|
|
348
|
-
link.rel = "noopener";
|
|
349
|
-
document.body.append(link);
|
|
350
|
-
link.click();
|
|
351
|
-
} finally {
|
|
352
|
-
link.remove();
|
|
353
|
-
url.revokeObjectURL(blobUrl);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
function defaultImageFilename(image) {
|
|
357
|
-
const extension = image.mediaType?.split("/")[1]?.split(";")[0] ?? "png";
|
|
358
|
-
return `image.${extension}`;
|
|
359
|
-
}
|
|
360
|
-
function focusOverlay(overlay) {
|
|
361
|
-
if (overlay === null) {
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
const [firstFocusable] = focusableElements(overlay);
|
|
365
|
-
(firstFocusable ?? overlay).focus();
|
|
366
|
-
}
|
|
367
|
-
function trapOverlayFocus(event, overlay) {
|
|
368
|
-
if (overlay === null) {
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
const focusable = focusableElements(overlay);
|
|
372
|
-
if (focusable.length === 0) {
|
|
373
|
-
event.preventDefault();
|
|
374
|
-
overlay.focus();
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
const firstFocusable = focusable[0];
|
|
378
|
-
const lastFocusable = focusable[focusable.length - 1];
|
|
379
|
-
const activeElement = globalThis.document?.activeElement;
|
|
380
|
-
if (event.shiftKey && activeElement === firstFocusable) {
|
|
381
|
-
event.preventDefault();
|
|
382
|
-
lastFocusable?.focus();
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
if (!event.shiftKey && activeElement === lastFocusable) {
|
|
386
|
-
event.preventDefault();
|
|
387
|
-
firstFocusable?.focus();
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
if (activeElement instanceof Node && !overlay.contains(activeElement)) {
|
|
391
|
-
event.preventDefault();
|
|
392
|
-
(event.shiftKey ? lastFocusable : firstFocusable)?.focus();
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
function focusableElements(container) {
|
|
396
|
-
return Array.from(
|
|
397
|
-
container.querySelectorAll(
|
|
398
|
-
[
|
|
399
|
-
"a[href]",
|
|
400
|
-
"button:not(:disabled)",
|
|
401
|
-
"input:not(:disabled)",
|
|
402
|
-
"select:not(:disabled)",
|
|
403
|
-
"textarea:not(:disabled)",
|
|
404
|
-
"[tabindex]"
|
|
405
|
-
].join(",")
|
|
406
|
-
)
|
|
407
|
-
).filter((element) => element.tabIndex >= 0 && element.getAttribute("aria-hidden") !== "true");
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// src/image/index.ts
|
|
411
|
-
var ImagePrimitive = {
|
|
412
|
-
Root: ImageRoot,
|
|
413
|
-
Preview: ImagePreview,
|
|
414
|
-
Name: ImageName,
|
|
415
|
-
Actions: ImageActions,
|
|
416
|
-
Copy: ImageCopy,
|
|
417
|
-
Download: ImageDownload,
|
|
418
|
-
ZoomTrigger: ImageZoomTrigger,
|
|
419
|
-
ZoomOverlay: ImageZoomOverlay
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
export {
|
|
423
|
-
ImagePrimitive
|
|
424
|
-
};
|
|
425
|
-
//# sourceMappingURL=chunk-DLBNFBXQ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/image/parts.tsx","../src/image/index.ts"],"sourcesContent":["import type { UIAttachment } from \"@anvia/client\";\nimport {\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport {\n type ImageContextValue,\n InternalImageProvider,\n useImage,\n useOptionalAttachment,\n} from \"../contexts\";\nimport { composeRefs, type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype ImageRootChildren = ReactNode | ((image: ImageContextValue) => ReactNode);\ntype ImageRenderWhen = \"image\" | \"always\";\n\ntype ImageRootProps = Omit<PrimitiveProps<\"figure\">, \"children\"> & {\n attachment?: UIAttachment;\n children?: ImageRootChildren;\n renderWhen?: ImageRenderWhen;\n};\n\nconst ImageRoot = forwardRef<HTMLElement, ImageRootProps>(function ImageRoot(\n { attachment: attachmentProp, children, renderWhen = \"image\", ...props },\n ref,\n) {\n const attachmentContext = useOptionalAttachment();\n const attachment = attachmentProp ?? attachmentContext?.attachment;\n const [zoomOpen, setZoomOpen] = useState(false);\n\n if (attachment === undefined) {\n throw new Error(\n \"ImagePrimitive.Root requires an attachment prop or AttachmentPrimitive context.\",\n );\n }\n\n const src = imageSource(attachment);\n const isImage = isImageAttachment(attachment);\n const value = useMemo<ImageContextValue>(() => {\n const context: ImageContextValue = {\n attachment,\n isImage,\n zoomOpen,\n setZoomOpen,\n };\n if (src !== undefined) context.src = src;\n if (attachment.name !== undefined) context.name = attachment.name;\n if (attachment.mediaType !== undefined) context.mediaType = attachment.mediaType;\n return context;\n }, [attachment, isImage, src, zoomOpen]);\n if (!isImage && renderWhen !== \"always\") {\n return null;\n }\n\n const renderedChildren = typeof children === \"function\" ? children(value) : children;\n\n return (\n <InternalImageProvider value={value}>\n {renderPrimitive(\n \"figure\",\n {\n ...props,\n children: renderedChildren ?? (\n <>\n <ImagePreview />\n <ImageName />\n </>\n ),\n \"data-state\": src === undefined ? \"unavailable\" : \"ready\",\n } as PrimitiveProps<\"figure\">,\n ref,\n )}\n </InternalImageProvider>\n );\n});\n\ntype ImagePreviewProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n alt?: string;\n errorFallback?: ReactNode;\n loadingFallback?: ReactNode;\n};\n\nconst ImagePreview = forwardRef<HTMLDivElement, ImagePreviewProps>(function ImagePreview(\n { alt, errorFallback, loadingFallback, ...props },\n ref,\n) {\n const image = useImage();\n const src = image.src;\n const [state, setState] = useState<\"loading\" | \"ready\" | \"error\">(\n src === undefined ? \"error\" : \"loading\",\n );\n\n useEffect(() => {\n setState(src === undefined ? \"error\" : \"loading\");\n }, [src]);\n\n const fallback =\n state === \"loading\"\n ? (loadingFallback ?? \"Loading image\")\n : state === \"error\"\n ? (errorFallback ?? \"Image unavailable\")\n : null;\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children:\n src === undefined ? (\n fallback\n ) : (\n <>\n {state === \"ready\" ? null : <span>{fallback}</span>}\n <img\n alt={alt ?? image.name ?? \"Image\"}\n hidden={state !== \"ready\"}\n onError={() => setState(\"error\")}\n onLoad={() => setState(\"ready\")}\n src={src}\n />\n </>\n ),\n \"data-state\": state,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\nconst ImageName = forwardRef<HTMLElement, PrimitiveProps<\"figcaption\">>(\n function ImageName(props, ref) {\n const image = useImage();\n\n return renderPrimitive(\n \"figcaption\",\n {\n ...props,\n children: props.children ?? image.name ?? image.mediaType ?? image.attachment.type,\n } as PrimitiveProps<\"figcaption\">,\n ref,\n );\n },\n);\n\nconst ImageActions = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function ImageActions(props, ref) {\n return renderPrimitive(\n \"div\",\n {\n ...props,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype ImageActionState = \"idle\" | \"done\" | \"error\";\n\nconst ImageCopy = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(function ImageCopy(\n { onClick, ...props },\n ref,\n) {\n const image = useImage();\n const [copyState, setCopyState] = useState<ImageActionState>(\"idle\");\n const disabled = props.disabled ?? image.src === undefined;\n\n const handleClick = useCallback(\n async (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || image.src === undefined) {\n return;\n }\n try {\n await copyImage(image);\n setCopyState(\"done\");\n } catch {\n setCopyState(\"error\");\n }\n },\n [disabled, image, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Copy image\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-state\": copyState,\n } as PrimitiveProps<\"button\">,\n ref,\n );\n});\n\ntype ImageDownloadProps = PrimitiveProps<\"button\"> & {\n filename?: string;\n};\n\nconst ImageDownload = forwardRef<HTMLButtonElement, ImageDownloadProps>(function ImageDownload(\n { filename, onClick, ...props },\n ref,\n) {\n const image = useImage();\n const disabled = props.disabled ?? image.src === undefined;\n\n const handleClick = useCallback(\n async (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || image.src === undefined) {\n return;\n }\n try {\n await downloadImage(image, filename);\n } catch {\n return;\n }\n },\n [disabled, filename, image, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Download\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n});\n\nconst ImageZoomTrigger = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function ImageZoomTrigger({ onClick, ...props }, ref) {\n const image = useImage();\n const disabled = props.disabled ?? image.src === undefined;\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n image.setZoomOpen(true);\n },\n [disabled, image, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Open image\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\ntype ImageZoomOverlayProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n container?: Element | DocumentFragment;\n};\n\nconst ImageZoomOverlay = forwardRef<HTMLDivElement, ImageZoomOverlayProps>(\n function ImageZoomOverlay({ container, onClick, onKeyDown, ...props }, ref) {\n const image = useImage();\n const portalContainer = container ?? globalThis.document?.body;\n const overlayRef = useRef<HTMLDivElement | null>(null);\n const composedRef = useMemo(() => composeRefs(overlayRef, ref), [ref]);\n\n useEffect(() => {\n if (!image.zoomOpen) {\n return;\n }\n const document = globalThis.document;\n if (document === undefined) {\n return;\n }\n const handleKeyDown = (event: globalThis.KeyboardEvent) => {\n if (event.key === \"Escape\") {\n image.setZoomOpen(false);\n }\n };\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [image]);\n\n useEffect(() => {\n if (!image.zoomOpen) {\n return;\n }\n const activeElement = globalThis.document?.activeElement;\n const previousFocus = activeElement instanceof HTMLElement ? activeElement : undefined;\n focusOverlay(overlayRef.current);\n return () => {\n if (previousFocus?.isConnected === true) {\n previousFocus.focus();\n }\n };\n }, [image.zoomOpen]);\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n image.setZoomOpen(false);\n }\n },\n [image, onClick],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) {\n return;\n }\n if (event.key === \"Escape\") {\n image.setZoomOpen(false);\n return;\n }\n if (event.key === \"Tab\") {\n trapOverlayFocus(event, overlayRef.current);\n }\n },\n [image, onKeyDown],\n );\n\n if (!image.zoomOpen || image.src === undefined || portalContainer === undefined) {\n return null;\n }\n\n const overlay = renderPrimitive(\n \"div\",\n {\n ...props,\n children: <img alt={image.name ?? \"Image\"} src={image.src} />,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n \"aria-modal\": props[\"aria-modal\"] ?? true,\n role: props.role ?? \"dialog\",\n tabIndex: props.tabIndex ?? -1,\n } as PrimitiveProps<\"div\">,\n composedRef,\n );\n\n return createPortal(overlay, portalContainer);\n },\n);\n\nfunction isImageAttachment(attachment: UIAttachment): boolean {\n return attachment.type === \"image\" || attachment.mediaType?.startsWith(\"image/\") === true;\n}\n\nfunction imageSource(attachment: UIAttachment): string | undefined {\n if (!isImageAttachment(attachment)) {\n return attachment.url;\n }\n if (attachment.url !== undefined) {\n return attachment.url;\n }\n if (attachment.data !== undefined && attachment.mediaType !== undefined) {\n return `data:${attachment.mediaType};base64,${attachment.data}`;\n }\n return undefined;\n}\n\nasync function copyImage(image: ImageContextValue): Promise<void> {\n if (image.src === undefined) {\n throw new Error(\"Image source is unavailable.\");\n }\n const clipboard = globalThis.navigator?.clipboard as\n | (Clipboard & { write?: (items: ClipboardItem[]) => Promise<void> })\n | undefined;\n const ClipboardItemConstructor = globalThis.ClipboardItem;\n if (clipboard?.write === undefined || ClipboardItemConstructor === undefined) {\n throw new Error(\"Clipboard image copy is unavailable.\");\n }\n const blob = await imageBlob(image);\n await clipboard.write([new ClipboardItemConstructor({ [blob.type]: blob })]);\n}\n\nasync function imageBlob(image: ImageContextValue): Promise<Blob> {\n if (image.attachment.data !== undefined) {\n return base64ToBlob(\n image.attachment.data,\n image.attachment.mediaType ?? image.mediaType ?? \"image/png\",\n );\n }\n if (image.src === undefined || globalThis.fetch === undefined) {\n throw new Error(\"Image source is unavailable.\");\n }\n const response = await fetch(image.src);\n return response.blob();\n}\n\nfunction base64ToBlob(data: string, mediaType: string): Blob {\n const binary = globalThis.atob(data);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) {\n bytes[index] = binary.charCodeAt(index);\n }\n return new Blob([bytes], { type: mediaType });\n}\n\nasync function downloadImage(\n image: ImageContextValue,\n filename: string | undefined,\n): Promise<void> {\n const document = globalThis.document;\n const url = globalThis.URL;\n if (image.src === undefined || document === undefined || url?.createObjectURL === undefined) {\n return;\n }\n const blobUrl = url.createObjectURL(await imageBlob(image));\n const link = document.createElement(\"a\");\n try {\n link.href = blobUrl;\n link.download = filename ?? image.name ?? defaultImageFilename(image);\n link.rel = \"noopener\";\n document.body.append(link);\n link.click();\n } finally {\n link.remove();\n url.revokeObjectURL(blobUrl);\n }\n}\n\nfunction defaultImageFilename(image: ImageContextValue): string {\n const extension = image.mediaType?.split(\"/\")[1]?.split(\";\")[0] ?? \"png\";\n return `image.${extension}`;\n}\n\nfunction focusOverlay(overlay: HTMLDivElement | null): void {\n if (overlay === null) {\n return;\n }\n const [firstFocusable] = focusableElements(overlay);\n (firstFocusable ?? overlay).focus();\n}\n\nfunction trapOverlayFocus(\n event: KeyboardEvent<HTMLDivElement>,\n overlay: HTMLDivElement | null,\n): void {\n if (overlay === null) {\n return;\n }\n const focusable = focusableElements(overlay);\n if (focusable.length === 0) {\n event.preventDefault();\n overlay.focus();\n return;\n }\n\n const firstFocusable = focusable[0];\n const lastFocusable = focusable[focusable.length - 1];\n const activeElement = globalThis.document?.activeElement;\n if (event.shiftKey && activeElement === firstFocusable) {\n event.preventDefault();\n lastFocusable?.focus();\n return;\n }\n if (!event.shiftKey && activeElement === lastFocusable) {\n event.preventDefault();\n firstFocusable?.focus();\n return;\n }\n if (activeElement instanceof Node && !overlay.contains(activeElement)) {\n event.preventDefault();\n (event.shiftKey ? lastFocusable : firstFocusable)?.focus();\n }\n}\n\nfunction focusableElements(container: HTMLElement): HTMLElement[] {\n return Array.from(\n container.querySelectorAll<HTMLElement>(\n [\n \"a[href]\",\n \"button:not(:disabled)\",\n \"input:not(:disabled)\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n \"[tabindex]\",\n ].join(\",\"),\n ),\n ).filter((element) => element.tabIndex >= 0 && element.getAttribute(\"aria-hidden\") !== \"true\");\n}\n\nexport {\n ImageActions,\n ImageCopy,\n ImageDownload,\n ImageName,\n ImagePreview,\n ImageRoot,\n ImageZoomOverlay,\n ImageZoomTrigger,\n};\n","import {\n ImageActions,\n ImageCopy,\n ImageDownload,\n ImageName,\n ImagePreview,\n ImageRoot,\n ImageZoomOverlay,\n ImageZoomTrigger,\n} from \"./parts\";\n\nexport const ImagePrimitive = {\n Root: ImageRoot,\n Preview: ImagePreview,\n Name: ImageName,\n Actions: ImageActions,\n Copy: ImageCopy,\n Download: ImageDownload,\n ZoomTrigger: ImageZoomTrigger,\n ZoomOverlay: ImageZoomOverlay,\n} as const;\n\nexport type { ImageContextValue } from \"../contexts\";\nexport { useImage } from \"../contexts\";\n"],"mappings":";;;;;;;;;;;AACA;AAAA,EACE;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AA4DjB,mBACE,KADF;AAzCZ,IAAM,YAAY,WAAwC,SAASA,WACjE,EAAE,YAAY,gBAAgB,UAAU,aAAa,SAAS,GAAG,MAAM,GACvE,KACA;AACA,QAAM,oBAAoB,sBAAsB;AAChD,QAAM,aAAa,kBAAkB,mBAAmB;AACxD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAE9C,MAAI,eAAe,QAAW;AAC5B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,MAAM,YAAY,UAAU;AAClC,QAAM,UAAU,kBAAkB,UAAU;AAC5C,QAAM,QAAQ,QAA2B,MAAM;AAC7C,UAAM,UAA6B;AAAA,MACjC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,QAAI,QAAQ,OAAW,SAAQ,MAAM;AACrC,QAAI,WAAW,SAAS,OAAW,SAAQ,OAAO,WAAW;AAC7D,QAAI,WAAW,cAA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f;","names":["ImageRoot","ImagePreview","ImageName","ImageActions","ImageCopy","ImageDownload","ImageZoomTrigger","ImageZoomOverlay","handleKeyDown"]}
|