calmlens 0.27.4 → 0.27.5

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.
Files changed (62) hide show
  1. package/bin/calmlens.js +1 -1
  2. package/cjs/{BrowserUpload-CFtjSpBI.d.ts → BrowserUpload-DJZY1LSU.d.ts} +2 -2
  3. package/cjs/{BrowserUpload-Ch9y2ZDx.js → BrowserUpload-DhruIgFN.js} +1 -1
  4. package/cjs/{CalmLensAppClient-DGtj1vUV.js → CalmLensAppClient-BA_xaNHY.js} +2 -2
  5. package/cjs/{CalmLensOptionKeys-DbL03fZj.js → CalmLensOptionKeys-BvLQghl-.js} +1 -1
  6. package/cjs/{CalmLensServerClient-D62AeRAi.js → CalmLensServerClient-D55xDZm4.js} +2 -2
  7. package/cjs/{Core-BXeXyiNv.d.ts → Core-CTO_Eh0l.d.ts} +11 -12
  8. package/cjs/{Core-Cv2zLAJ-.js → Core-kKGmyk5V.js} +63 -21
  9. package/cjs/{ModerationContextLimits-DjacyIkw.js → ModerationContextLimits-Cxaob3tc.js} +1 -1
  10. package/cjs/{ReactUpload-C47UrgH2.d.ts → ReactUpload-BDXV4aHT.d.ts} +1 -1
  11. package/cjs/{ReactUpload-CytoQTh_.js → ReactUpload-Cx3Hi7xt.js} +1 -1
  12. package/cjs/{UploadController-fpTC5TUO.js → UploadController-CC1afxmL.js} +2 -2
  13. package/cjs/app.js +2 -2
  14. package/cjs/elements.d.ts +7 -18
  15. package/cjs/elements.js +45 -53
  16. package/cjs/index.js +1 -1
  17. package/cjs/react-native.d.ts +3 -3
  18. package/cjs/react-native.js +6 -4
  19. package/cjs/react.d.ts +5 -11
  20. package/cjs/react.js +29 -36
  21. package/cjs/server.js +2 -2
  22. package/cjs/testing.js +5 -5
  23. package/cjs/{ui-5IdEYYpC.d.ts → ui-DAbpyM2Z.d.ts} +2 -8
  24. package/cjs/{ui-BvyDbJBb.js → ui-I75EvP9r.js} +2 -201
  25. package/cjs/ui.d.ts +3 -3
  26. package/cjs/ui.js +5 -5
  27. package/cjs/vue.d.ts +4 -317
  28. package/cjs/vue.js +27 -17
  29. package/esm/{BrowserUpload-BE8OVeBC.js → BrowserUpload-CejeWw5r.js} +1 -1
  30. package/esm/{BrowserUpload-CFtjSpBI.d.ts → BrowserUpload-DJZY1LSU.d.ts} +2 -2
  31. package/esm/{CalmLensAppClient-C1cpQEYR.js → CalmLensAppClient-BxkCVPCl.js} +2 -2
  32. package/esm/{CalmLensOptionKeys-DoCKKuLT.js → CalmLensOptionKeys-DC9FUO43.js} +1 -1
  33. package/esm/{CalmLensServerClient-CSCrJ7wX.js → CalmLensServerClient-D-TIIQp2.js} +2 -2
  34. package/esm/{Core-Df2PSa1n.js → Core-B85V5dxv.js} +52 -22
  35. package/esm/{Core-BXeXyiNv.d.ts → Core-CTO_Eh0l.d.ts} +11 -12
  36. package/esm/{ModerationContextLimits-tu_PY4fn.js → ModerationContextLimits-Tev2lxE0.js} +1 -1
  37. package/esm/{ReactUpload-BsbisXS6.js → ReactUpload-B7QXMSWJ.js} +1 -1
  38. package/esm/{ReactUpload-C47UrgH2.d.ts → ReactUpload-BDXV4aHT.d.ts} +1 -1
  39. package/esm/{UploadController-Dqjf23bS.js → UploadController-D7XmzO-p.js} +2 -2
  40. package/esm/app.js +2 -2
  41. package/esm/elements.d.ts +7 -18
  42. package/esm/elements.js +44 -50
  43. package/esm/index.js +1 -1
  44. package/esm/react-native.d.ts +3 -3
  45. package/esm/react-native.js +5 -5
  46. package/esm/react.d.ts +5 -11
  47. package/esm/react.js +29 -34
  48. package/esm/server.js +2 -2
  49. package/esm/styles.css +12 -16
  50. package/esm/svelte/CalmLensAsset.svelte +22 -4
  51. package/esm/svelte/index.d.ts +0 -6
  52. package/esm/svelte/index.js +0 -2
  53. package/esm/testing.js +5 -5
  54. package/esm/{ui-5IdEYYpC.d.ts → ui-DAbpyM2Z.d.ts} +2 -8
  55. package/esm/{ui-DF7-9mB3.js → ui-cE1lyljs.js} +3 -190
  56. package/esm/ui.d.ts +3 -3
  57. package/esm/ui.js +4 -4
  58. package/esm/vue.d.ts +4 -317
  59. package/esm/vue.js +26 -14
  60. package/package.json +1 -1
  61. package/esm/svelte/CalmLensImageViewer.svelte +0 -7
  62. package/esm/svelte/CalmLensWebsiteViewer.svelte +0 -7
package/esm/react.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- import { _ as loadPdfJs, a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createImageViewer, f as createWebsiteViewer, g as resolveViewerMessages, h as formatViewerMessage, i as isMountedViewerKind, l as parseSpreadsheetText, m as DEFAULT_VIEWER_MESSAGES, n as AssetViewerMount, o as createSpreadsheetViewer, p as createDocumentViewer, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-DF7-9mB3.js";
3
- import { a as createProgressFetch, i as withProvidedOptions, r as isFileAccepted, t as UploadController } from "./UploadController-Dqjf23bS.js";
4
- import { C as CALMLENS_THEME, E as isSpreadsheetFormat, S as VIEWER_STYLES, T as getAssetViewerKind, _ as getAssetView, a as describeUploadItem, b as getPlayedPercent, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as getAssetAspectRatio, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, n as CALMLENS_STYLES_ID, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetViewKey, w as resolveTheme, x as pickAssetSource, y as getPeakHeights } from "./Core-Df2PSa1n.js";
2
+ import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-cE1lyljs.js";
3
+ import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, n as CALMLENS_STYLES_ID, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-B85V5dxv.js";
4
+ import { a as createProgressFetch, i as withProvidedOptions, r as isFileAccepted, t as UploadController } from "./UploadController-D7XmzO-p.js";
5
5
  import { c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
6
- import { i as useUploadSnapshot, n as useCalmLensUpload$1, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-BsbisXS6.js";
7
- import { t as createUploadController } from "./BrowserUpload-BE8OVeBC.js";
8
- import { useEffect, useMemo, useRef, useState } from "react";
6
+ import { i as useUploadSnapshot, n as useCalmLensUpload$1, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-B7QXMSWJ.js";
7
+ import { t as createUploadController } from "./BrowserUpload-CejeWw5r.js";
8
+ import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
10
  const OPTION_NAMES = /* @__PURE__ */ new Set([
11
11
  "src",
@@ -15,7 +15,6 @@ const OPTION_NAMES = /* @__PURE__ */ new Set([
15
15
  "viewerClaims",
16
16
  "label",
17
17
  "messages",
18
- "sizes",
19
18
  "text",
20
19
  "getText",
21
20
  "pageSize",
@@ -61,20 +60,6 @@ function Viewer({ kind, props }) {
61
60
  "data-kind": kind
62
61
  })] });
63
62
  }
64
- /** Shows an image asset's rendered file, fitted to the element, over its placeholder. */
65
- function CalmLensImageViewer(props) {
66
- return /* @__PURE__ */ jsx(Viewer, {
67
- kind: "image",
68
- props
69
- });
70
- }
71
- /** Shows a website asset's screenshot with a link to the original page. */
72
- function CalmLensWebsiteViewer(props) {
73
- return /* @__PURE__ */ jsx(Viewer, {
74
- kind: "website",
75
- props
76
- });
77
- }
78
63
  /** Shows a text asset's text, escaped, in a scrolling region. */
79
64
  function CalmLensTextViewer(props) {
80
65
  return /* @__PURE__ */ jsx(Viewer, {
@@ -287,6 +272,7 @@ function CalmLensUploader({ disabled, capture, messages: overrides, unstyled, co
287
272
  ]
288
273
  });
289
274
  }
275
+ const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
290
276
  /** Audio's waveform: the preview still, with the played part of its peaks drawn over it. */
291
277
  const Waveform = ({ url, peaks, played }) => {
292
278
  if (!url && !peaks) return null;
@@ -356,14 +342,17 @@ function CalmLensAsset(props) {
356
342
  const loadKey = getAssetViewKey(view);
357
343
  const [load, setLoad] = useState({
358
344
  key: loadKey,
359
- state: "loading"
345
+ state: "loading",
346
+ instant: false
360
347
  });
361
348
  const current = load.key === loadKey ? load : {
362
349
  key: loadKey,
363
- state: "loading"
350
+ state: "loading",
351
+ instant: false
364
352
  };
365
353
  const [played, setPlayed] = useState(0);
366
354
  const imageRef = useRef(null);
355
+ const loadStartedAt = useRef(0);
367
356
  const media = useRef(null);
368
357
  const viewerRoot = useRef(null);
369
358
  const callbacks = useRef({
@@ -378,16 +367,18 @@ function CalmLensAsset(props) {
378
367
  };
379
368
  useEffect(() => setMounted(true), []);
380
369
  useEffect(() => session.load());
381
- useEffect(() => {
382
- if (imageRef.current?.complete && imageRef.current.naturalWidth > 0) setLoad({
370
+ useIsomorphicLayoutEffect(() => {
371
+ loadStartedAt.current = performance.now();
372
+ if (isImageReady(imageRef.current)) setLoad({
383
373
  key: loadKey,
384
- state: "loaded"
374
+ state: "loaded",
375
+ instant: true
385
376
  });
386
377
  }, [loadKey]);
387
378
  useEffect(() => {
388
379
  if (current.state === "loaded") callbacks.current.onLoad?.();
389
380
  if (current.state === "error") callbacks.current.onError?.();
390
- }, [current.state]);
381
+ }, [current.key, current.state]);
391
382
  const availability = view.kind === "unavailable" ? "unavailable" : view.kind === "age-restricted" ? "age-restricted" : view.kind === "pending" ? void 0 : "available";
392
383
  useEffect(() => {
393
384
  if (availability) callbacks.current.onAvailabilityChange?.(availability);
@@ -397,7 +388,8 @@ function CalmLensAsset(props) {
397
388
  viewers.update(viewerRoot.current, viewerKind, getMountedViewerOptions(options, session), (viewerState) => {
398
389
  if (viewerState !== "loading") setLoad({
399
390
  key: loadKey,
400
- state: viewerState
391
+ state: viewerState,
392
+ instant: false
401
393
  });
402
394
  });
403
395
  });
@@ -405,7 +397,7 @@ function CalmLensAsset(props) {
405
397
  useEffect(() => streams.update(media.current, view));
406
398
  useEffect(() => () => streams.stop(), [streams]);
407
399
  const ratio = getAssetAspectRatio(view, state.info, aspectRatio);
408
- const placeholderUrl = "placeholderUrl" in view && (view.kind === "age-restricted" || view.kind === "pending" || current.state !== "loaded") ? view.placeholderUrl : void 0;
400
+ const placeholderUrl = "placeholderUrl" in view && (view.kind === "age-restricted" || view.kind === "pending" || current.state !== "error" && !(current.state === "loaded" && current.instant)) ? view.placeholderUrl : void 0;
409
401
  const onMediaError = (element) => {
410
402
  if (streams.recover(element)) return;
411
403
  session.mediaFailed({
@@ -418,7 +410,8 @@ function CalmLensAsset(props) {
418
410
  session.mediaLoaded(event.currentTarget);
419
411
  setLoad({
420
412
  key: loadKey,
421
- state: "loaded"
413
+ state: "loaded",
414
+ instant: false
422
415
  });
423
416
  },
424
417
  onError: (event) => onMediaError(event.currentTarget),
@@ -435,7 +428,7 @@ function CalmLensAsset(props) {
435
428
  className: "calmlens-asset__content",
436
429
  src: shown.src,
437
430
  srcSet: shown.srcSet,
438
- sizes: shown.srcSet ? image?.sizes : void 0,
431
+ sizes: shown.srcSet ? image?.sizes ?? (lazy ? "auto, 100vw" : "100vw") : void 0,
439
432
  alt,
440
433
  width: shown.width,
441
434
  height: shown.height,
@@ -444,9 +437,10 @@ function CalmLensAsset(props) {
444
437
  fetchPriority,
445
438
  onLoad: () => {
446
439
  session.loaded();
447
- setLoad({
440
+ setLoad((prev) => prev.key === loadKey && prev.state === "loaded" ? prev : {
448
441
  key: loadKey,
449
- state: "loaded"
442
+ state: "loaded",
443
+ instant: performance.now() - loadStartedAt.current < 50
450
444
  });
451
445
  },
452
446
  onError: () => session.failed()
@@ -456,6 +450,7 @@ function CalmLensAsset(props) {
456
450
  className: joinClassNames("calmlens-asset", className),
457
451
  "data-kind": view.kind,
458
452
  "data-state": current.state,
453
+ "data-instant": current.instant ? "" : void 0,
459
454
  "data-sized": ratio ? "" : void 0,
460
455
  "aria-busy": view.kind === "pending" ? true : void 0,
461
456
  style: {
@@ -570,4 +565,4 @@ function CalmLensAsset(props) {
570
565
  ]
571
566
  });
572
567
  }
573
- export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, CalmLensAsset, CalmLensDocumentViewer, CalmLensImageViewer, CalmLensProvider, CalmLensSpreadsheetViewer, CalmLensTextViewer, CalmLensUploader, CalmLensWebsiteViewer, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, ICONS, ICON_ATTRIBUTES, MediaStreamPlayer, UploadController, VIEWER_STYLES, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, useCalmLensUpload, withProvidedOptions };
568
+ export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, CalmLensAsset, CalmLensDocumentViewer, CalmLensProvider, CalmLensSpreadsheetViewer, CalmLensTextViewer, CalmLensUploader, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, MediaStreamPlayer, UploadController, VIEWER_STYLES, createDocumentViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isImageReady, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, useCalmLensUpload, withProvidedOptions };
package/esm/server.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as CalmLensPayloadTooLargeError, G as CalmLensCancelledError, H as CalmLensApiError, I as AUTO_PAGING_TO_ARRAY_MAX, J as CalmLensConnectionError, K as CalmLensConfigurationError, N as SDK_VERSION, Q as CalmLensNotFoundError, U as CalmLensAuthenticationError, V as CALMLENS_ERROR_CODES, W as CalmLensBadRequestError, X as CalmLensInvalidArgumentError, Y as CalmLensError, Z as CalmLensInvalidResponseError, at as CalmLensWebhookVerificationError, et as CalmLensPermissionDeniedError, i as CDN_RESOURCES, it as CalmLensUnprocessableEntityError, n as MODERATION_CONTEXT_USED_ITEMS, nt as CalmLensServerError, q as CalmLensConflictError, r as selectModerationContextItems, rt as CalmLensTimeoutError, s as getAssetInfo, t as MODERATION_CONTEXT_USED_CHARACTERS, tt as CalmLensRateLimitError, u as DEFAULT_CDN_BASE_URL } from "./ModerationContextLimits-tu_PY4fn.js";
1
+ import { $ as CalmLensPayloadTooLargeError, G as CalmLensCancelledError, H as CalmLensApiError, I as AUTO_PAGING_TO_ARRAY_MAX, J as CalmLensConnectionError, K as CalmLensConfigurationError, N as SDK_VERSION, Q as CalmLensNotFoundError, U as CalmLensAuthenticationError, V as CALMLENS_ERROR_CODES, W as CalmLensBadRequestError, X as CalmLensInvalidArgumentError, Y as CalmLensError, Z as CalmLensInvalidResponseError, at as CalmLensWebhookVerificationError, et as CalmLensPermissionDeniedError, i as CDN_RESOURCES, it as CalmLensUnprocessableEntityError, n as MODERATION_CONTEXT_USED_ITEMS, nt as CalmLensServerError, q as CalmLensConflictError, r as selectModerationContextItems, rt as CalmLensTimeoutError, s as getAssetInfo, t as MODERATION_CONTEXT_USED_CHARACTERS, tt as CalmLensRateLimitError, u as DEFAULT_CDN_BASE_URL } from "./ModerationContextLimits-Tev2lxE0.js";
2
2
  import "./index.js";
3
- import { a as WEBHOOK_TIMESTAMP_HEADER, c as isNewerAssetEvent, d as verifyWebhookSignature, i as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, l as isTestWebhookEvent, n as WEBHOOK_DELIVERY_HEADER, o as getEventFact, r as WEBHOOK_SIGNATURE_HEADER, s as getEventFacts, t as CalmLensServerClient, u as parseWebhookEvent } from "./CalmLensServerClient-CSCrJ7wX.js";
3
+ import { a as WEBHOOK_TIMESTAMP_HEADER, c as isNewerAssetEvent, d as verifyWebhookSignature, i as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, l as isTestWebhookEvent, n as WEBHOOK_DELIVERY_HEADER, o as getEventFact, r as WEBHOOK_SIGNATURE_HEADER, s as getEventFacts, t as CalmLensServerClient, u as parseWebhookEvent } from "./CalmLensServerClient-D-TIIQp2.js";
4
4
  export { AUTO_PAGING_TO_ARRAY_MAX, CALMLENS_ERROR_CODES, CDN_RESOURCES, CalmLensApiError, CalmLensAuthenticationError, CalmLensBadRequestError, CalmLensCancelledError, CalmLensConfigurationError, CalmLensConflictError, CalmLensConnectionError, CalmLensError, CalmLensInvalidArgumentError, CalmLensInvalidResponseError, CalmLensNotFoundError, CalmLensPayloadTooLargeError, CalmLensPermissionDeniedError, CalmLensRateLimitError, CalmLensServerClient, CalmLensServerError, CalmLensTimeoutError, CalmLensUnprocessableEntityError, CalmLensWebhookVerificationError, DEFAULT_CDN_BASE_URL, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, SDK_VERSION, WEBHOOK_DELIVERY_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, WEBHOOK_TIMESTAMP_HEADER, getAssetInfo, getEventFact, getEventFacts, isNewerAssetEvent, isTestWebhookEvent, parseWebhookEvent, selectModerationContextItems, verifyWebhookSignature };
package/esm/styles.css CHANGED
@@ -123,7 +123,7 @@
123
123
  }
124
124
  .calmlens-icon-button:hover { background: color-mix(in srgb, var(--calmlens-accent) 8%, transparent); border-color: var(--calmlens-border); }
125
125
  @media (prefers-reduced-motion: reduce) {
126
- .calmlens-dropzone, .calmlens-dropzone__icon, .calmlens-asset__content { transition: none; }
126
+ .calmlens-dropzone, .calmlens-dropzone__icon { transition: none; }
127
127
  .calmlens-progress:indeterminate {
128
128
  --calmlens-progress-animation: calmlens-indeterminate-still 1s both;
129
129
  }
@@ -142,9 +142,17 @@
142
142
  .calmlens-asset:not([data-sized]) .calmlens-asset__content { position: relative; height: auto; }
143
143
  .calmlens-asset:not([data-sized])[data-kind="age-restricted"], .calmlens-asset:not([data-sized])[data-kind="unavailable"],
144
144
  .calmlens-asset:not([data-sized])[data-state="error"] { min-height: 160px; }
145
- .calmlens-asset__placeholder { transform: scale(1.1); filter: blur(12px); }
146
- .calmlens-asset__content { opacity: 0; transition: opacity 250ms; }
145
+ .calmlens-asset__placeholder { transform: scale(1.1); filter: blur(12px); opacity: 1; pointer-events: none; }
146
+ .calmlens-asset__content { opacity: 0; }
147
147
  .calmlens-asset[data-state="loaded"] .calmlens-asset__content { opacity: 1; }
148
+ .calmlens-asset[data-state="loaded"]:not([data-kind="age-restricted"]) .calmlens-asset__placeholder { opacity: 0; visibility: hidden; }
149
+ @media (prefers-reduced-motion: no-preference) {
150
+ .calmlens-asset[data-state="loaded"]:not([data-instant]) { transition: background-color 250ms; }
151
+ .calmlens-asset[data-state="loaded"]:not([data-instant]) .calmlens-asset__content { transition: opacity 250ms; }
152
+ .calmlens-asset[data-state="loaded"]:not([data-kind="age-restricted"], [data-instant]) .calmlens-asset__placeholder {
153
+ transition: opacity 250ms, visibility 0s linear 250ms;
154
+ }
155
+ }
148
156
  .calmlens-asset[data-kind="video"] .calmlens-asset__content, .calmlens-asset[data-kind="audio"] .calmlens-asset__content { opacity: 1; }
149
157
  /* Documents, text and spreadsheets fill the box with their viewer; a document shows its first
150
158
  page's still and an open link until the viewer loads. */
@@ -215,7 +223,7 @@
215
223
  /* An opaque surface of its own, so sticky headers and the toolbar cover what scrolls under them. */
216
224
  background: var(--calmlens-viewer-background, Canvas); color: var(--calmlens-viewer-text, CanvasText);
217
225
  }
218
- .calmlens-viewer:is([data-kind="text"], [data-kind="document"], [data-kind="spreadsheet"], [data-kind="website"]) > .calmlens-viewer__frame { min-height: 320px; }
226
+ .calmlens-viewer:is([data-kind="text"], [data-kind="document"], [data-kind="spreadsheet"]) > .calmlens-viewer__frame { min-height: 320px; }
219
227
  .calmlens-viewer :focus-visible {
220
228
  outline: 2px solid var(--calmlens-focus-ring); outline-offset: -2px;
221
229
  }
@@ -236,18 +244,6 @@
236
244
  .calmlens-viewer__spacer { flex: 1; }
237
245
  .calmlens-viewer__link { text-decoration: none; overflow-wrap: anywhere; }
238
246
  .calmlens-viewer__scroll { flex: 1; min-height: 0; overflow: auto; position: relative; }
239
- /* Images fit inside the frame, keeping their shape; without a frame height, the box takes it. */
240
- .calmlens-viewer[data-kind="image"] > .calmlens-viewer__frame { aspect-ratio: var(--calmlens-viewer-ratio, auto); max-height: 100%; }
241
- .calmlens-viewer[data-kind="image"] > .calmlens-viewer__frame > img {
242
- position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
243
- }
244
- .calmlens-viewer:not([data-kind="image"]) .calmlens-viewer__placeholder {
245
- position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top;
246
- }
247
- .calmlens-viewer__placeholder { filter: blur(12px); transform: scale(1.05); }
248
- .calmlens-viewer__image { opacity: 0; transition: opacity 250ms; }
249
- .calmlens-viewer[data-state="loaded"] .calmlens-viewer__image { opacity: 1; }
250
- .calmlens-viewer[data-kind="website"] .calmlens-viewer__image { position: relative; display: block; width: 100%; height: auto; }
251
247
  .calmlens-viewer__text {
252
248
  margin: 0 auto; padding: 20px 24px; max-width: 75ch; white-space: pre-wrap; overflow-wrap: anywhere;
253
249
  font-family: inherit; font-size: 1rem; line-height: 1.6;
@@ -14,6 +14,8 @@
14
14
  getMountedViewerOptions,
15
15
  getPeakHeights,
16
16
  getPlayedPercent,
17
+ INSTANT_LOAD_MS,
18
+ isImageReady,
17
19
  isMountedViewerKind,
18
20
  MediaStreamPlayer,
19
21
  resolveMessages,
@@ -75,6 +77,8 @@
75
77
  const loadKey = $derived(getAssetViewKey(view));
76
78
  const ratio = $derived(getAssetAspectRatio(view, sessionState.info, aspectRatio));
77
79
  let load: "loading" | "loaded" | "error" = $state("loading");
80
+ let instant = $state(false);
81
+ let loadStartedAt = 0;
78
82
  let played = $state(0);
79
83
  let mounted = $state(false);
80
84
  let image: HTMLImageElement | undefined = $state();
@@ -109,8 +113,6 @@
109
113
  });
110
114
  onMount(() => {
111
115
  mounted = true;
112
- // An image that loaded before hydration fires no load event.
113
- if (image?.complete && image.naturalWidth > 0) load = "loaded";
114
116
  return () => {
115
117
  streams.stop();
116
118
  viewers.destroy();
@@ -119,6 +121,17 @@
119
121
  $effect.pre(() => {
120
122
  void loadKey;
121
123
  load = "loading";
124
+ instant = false;
125
+ });
126
+ $effect(() => {
127
+ void loadKey;
128
+ if (!image) return;
129
+ loadStartedAt = performance.now();
130
+ // An image that loaded before hydration or from the browser cache shows without fading.
131
+ if (isImageReady(image)) {
132
+ instant = true;
133
+ load = "loaded";
134
+ }
122
135
  });
123
136
  $effect(() => {
124
137
  if (load === "loaded") onLoad?.();
@@ -152,11 +165,15 @@
152
165
  };
153
166
  const onImageLoad = () => {
154
167
  session.loaded();
168
+ if (load === "loaded") return;
169
+ instant = performance.now() - loadStartedAt < INSTANT_LOAD_MS;
155
170
  load = "loaded";
156
171
  };
157
172
  const placeholderUrl = $derived(
158
173
  "placeholderUrl" in view &&
159
- (view.kind === "age-restricted" || view.kind === "pending" || load !== "loaded")
174
+ (view.kind === "age-restricted" ||
175
+ view.kind === "pending" ||
176
+ (load !== "error" && !(load === "loaded" && instant)))
160
177
  ? view.placeholderUrl
161
178
  : undefined,
162
179
  );
@@ -172,7 +189,7 @@
172
189
  class="calmlens-asset__content"
173
190
  src={shown.src}
174
191
  srcset={shown.srcSet}
175
- sizes={shown.srcSet ? imageOptions?.sizes : undefined}
192
+ sizes={shown.srcSet ? (imageOptions?.sizes ?? (lazy ? "auto, 100vw" : "100vw")) : undefined}
176
193
  {alt}
177
194
  width={shown.width}
178
195
  height={shown.height}
@@ -189,6 +206,7 @@
189
206
  class="calmlens-asset"
190
207
  data-kind={view.kind}
191
208
  data-state={load}
209
+ data-instant={instant ? "" : undefined}
192
210
  data-sized={ratio ? "" : undefined}
193
211
  aria-busy={view.kind === "pending" ? "true" : undefined}
194
212
  style:aspect-ratio={ratio}
@@ -8,12 +8,10 @@ import type {
8
8
  UploadItem as CoreUploadItem,
9
9
  UploadSnapshot as CoreUploadSnapshot,
10
10
  DocumentViewerOptions,
11
- ImageViewerOptions,
12
11
  SpreadsheetViewerOptions,
13
12
  TextViewerOptions,
14
13
  UploadController,
15
14
  UploadFile,
16
- WebsiteViewerOptions,
17
15
  } from "../ui.js";
18
16
 
19
17
  // The browser's files are `File`s, so the upload types default to `File` here.
@@ -58,10 +56,6 @@ export declare const CalmLensAsset: Component<
58
56
  }
59
57
  >;
60
58
 
61
- /** Shows an image asset's rendered file, fitted to the element, over its placeholder (preview). */
62
- export declare const CalmLensImageViewer: Component<ImageViewerOptions>;
63
- /** Shows a website asset's screenshot with a link to the original page (preview). */
64
- export declare const CalmLensWebsiteViewer: Component<WebsiteViewerOptions>;
65
59
  /** Shows a text asset's text, escaped, in a scrolling region (preview). */
66
60
  export declare const CalmLensTextViewer: Component<TextViewerOptions>;
67
61
  /** Shows a PDF, or a document rendered as one, a page at a time with pdf.js (preview). */
@@ -4,9 +4,7 @@
4
4
  export * from "../ui.js";
5
5
  export { default as CalmLensAsset } from "./CalmLensAsset.svelte";
6
6
  export { default as CalmLensDocumentViewer } from "./CalmLensDocumentViewer.svelte";
7
- export { default as CalmLensImageViewer } from "./CalmLensImageViewer.svelte";
8
7
  export { default as CalmLensSpreadsheetViewer } from "./CalmLensSpreadsheetViewer.svelte";
9
8
  export { default as CalmLensTextViewer } from "./CalmLensTextViewer.svelte";
10
9
  export { default as CalmLensUploader } from "./CalmLensUploader.svelte";
11
- export { default as CalmLensWebsiteViewer } from "./CalmLensWebsiteViewer.svelte";
12
10
  export { getCalmLensContext, setCalmLensContext } from "./context.js";
package/esm/testing.js CHANGED
@@ -1,9 +1,9 @@
1
- import { A as normalizeUploadMimeType, D as MAX_IMAGE_UPLOAD_BYTES, M as sleep, S as validateAppClientOptions, Y as CalmLensError, _ as randomUuid, ct as invalidConfig, f as checkTransformOptions, h as parseTransformSelector, k as getRejectedUploadMimeTypeError, lt as API_ERROR_CODES, m as isAcceptedUploadMimeType, ot as SDK_ERROR_CODES, r as selectModerationContextItems, st as invalidArgument, ut as API_ERROR_DEFINITIONS, w as validateServerClientOptions } from "./ModerationContextLimits-tu_PY4fn.js";
2
- import { a as WEBHOOK_TIMESTAMP_HEADER, f as signUploadTokenWithApiKey, m as stringifyJsonCanonical, n as WEBHOOK_DELIVERY_HEADER, p as decodeUploadToken, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient } from "./CalmLensServerClient-CSCrJ7wX.js";
3
- import { _ as validateAssetPayload, a as MOCK_HOOKS, g as assetToData, h as assetDataToUint8Array } from "./CalmLensOptionKeys-DoCKKuLT.js";
1
+ import { A as normalizeUploadMimeType, D as MAX_IMAGE_UPLOAD_BYTES, M as sleep, S as validateAppClientOptions, Y as CalmLensError, _ as randomUuid, ct as invalidConfig, f as checkTransformOptions, h as parseTransformSelector, k as getRejectedUploadMimeTypeError, lt as API_ERROR_CODES, m as isAcceptedUploadMimeType, ot as SDK_ERROR_CODES, r as selectModerationContextItems, st as invalidArgument, ut as API_ERROR_DEFINITIONS, w as validateServerClientOptions } from "./ModerationContextLimits-Tev2lxE0.js";
2
+ import { a as WEBHOOK_TIMESTAMP_HEADER, f as signUploadTokenWithApiKey, m as stringifyJsonCanonical, n as WEBHOOK_DELIVERY_HEADER, p as decodeUploadToken, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient } from "./CalmLensServerClient-D-TIIQp2.js";
3
+ import { _ as validateAssetPayload, a as MOCK_HOOKS, g as assetToData, h as assetDataToUint8Array } from "./CalmLensOptionKeys-DC9FUO43.js";
4
4
  import { t as hmacSha256Hex } from "./CryptoUtils-B_x8lMIx-DhuWGzqn.js";
5
- import { t as CalmLensAppClient } from "./CalmLensAppClient-C1cpQEYR.js";
6
- import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-Dqjf23bS.js";
5
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-BxkCVPCl.js";
6
+ import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-D7XmzO-p.js";
7
7
  import { d as getTestInputTag, h as CLASSIFICATION_CATEGORIES, m as lazySchema } from "./TestTriggers-Cvi7e2KA-BA83CRJb.js";
8
8
  import * as zod from "zod";
9
9
  // src/contract/MediaTestTriggers.js
@@ -1,5 +1,5 @@
1
1
  import "./CalmLensTypes-OWZsGvBX.js";
2
- import { K as AssetOptions, Z as AssetView, ct as PdfAssetOptions, ft as ViewerOptions, lt as SpreadsheetViewerOptions, mt as WebsiteViewerOptions, ot as DocumentViewerOptions, q as AssetSession, st as ImageViewerOptions, ut as TextViewerOptions } from "./Core-BXeXyiNv.js";
2
+ import { K as AssetOptions, Z as AssetView, ct as DocumentViewerOptions, dt as TextViewerOptions, lt as PdfAssetOptions, pt as ViewerOptions, q as AssetSession, ut as SpreadsheetViewerOptions } from "./Core-CTO_Eh0l.js";
3
3
  import "pdfjs-dist";
4
4
  /** A viewer mounted into an element, which it owns the children of. */
5
5
  interface AssetViewer<O extends ViewerOptions = ViewerOptions> {
@@ -11,10 +11,6 @@ interface AssetViewer<O extends ViewerOptions = ViewerOptions> {
11
11
  type ViewerState = "loading" | "loaded" | "error";
12
12
  /** Shows a PDF, or a document rendered as one, in `root`. */
13
13
  declare const createDocumentViewer: (root: HTMLElement, options: DocumentViewerOptions) => AssetViewer<DocumentViewerOptions>;
14
- /** Shows an image asset's rendered file in `root`. */
15
- declare const createImageViewer: (root: HTMLElement, options: ImageViewerOptions) => AssetViewer<ImageViewerOptions>;
16
- /** Shows a website asset's screenshot and a link to the page in `root`. */
17
- declare const createWebsiteViewer: (root: HTMLElement, options: WebsiteViewerOptions) => AssetViewer<WebsiteViewerOptions>;
18
14
  type PdfJs = typeof import("pdfjs-dist");
19
15
  /**
20
16
  * Loads pdf.js, the first time a document viewer needs it: never at import, so pages without
@@ -83,8 +79,6 @@ declare const createSpreadsheetViewer: (root: HTMLElement, options: SpreadsheetV
83
79
  declare const VIEWER_STYLES: string;
84
80
  /** Each viewer's options, by the kind of viewer `getAssetViewerKind` names. */
85
81
  interface AssetViewerOptionsByKind {
86
- image: ImageViewerOptions;
87
- website: WebsiteViewerOptions;
88
82
  text: TextViewerOptions;
89
83
  document: DocumentViewerOptions;
90
84
  spreadsheet: SpreadsheetViewerOptions;
@@ -136,4 +130,4 @@ declare class MediaStreamPlayer {
136
130
  /** Stops the stream, when the component unmounts. */
137
131
  stop(): void;
138
132
  }
139
- export { ViewerState as C, AssetViewer as S, spreadsheetColumnIndex as _, isMountedViewerKind as a, createWebsiteViewer as b, AssetViewerOptionsByKind as c, createTextViewer as d, SpreadsheetCell as f, parseSpreadsheetText as g, getSpreadsheetPage as h, getMountedViewerOptions as i, VIEWER_STYLES as l, SpreadsheetSheet as m, AssetViewerMount as n, ASSET_VIEWERS as o, SpreadsheetRow as p, MountedViewerKind as r, AssetViewerName as s, MediaStreamPlayer as t, createSpreadsheetViewer as u, loadPdfJs as v, createDocumentViewer as x, createImageViewer as y };
133
+ export { spreadsheetColumnIndex as _, isMountedViewerKind as a, AssetViewer as b, AssetViewerOptionsByKind as c, createTextViewer as d, SpreadsheetCell as f, parseSpreadsheetText as g, getSpreadsheetPage as h, getMountedViewerOptions as i, VIEWER_STYLES as l, SpreadsheetSheet as m, AssetViewerMount as n, ASSET_VIEWERS as o, SpreadsheetRow as p, MountedViewerKind as r, AssetViewerName as s, MediaStreamPlayer as t, createSpreadsheetViewer as u, loadPdfJs as v, ViewerState as x, createDocumentViewer as y };
@@ -1,6 +1,5 @@
1
- import { a as appendAssetLocation } from "./ModerationContextLimits-tu_PY4fn.js";
2
- import { o as placeholderHashToDataURL } from "./UploadController-Dqjf23bS.js";
3
- import "./Core-Df2PSa1n.js";
1
+ import { a as appendAssetLocation } from "./ModerationContextLimits-Tev2lxE0.js";
2
+ import "./Core-B85V5dxv.js";
4
3
  // src/ui/viewers/PdfLoader.ts
5
4
  let loading;
6
5
  /**
@@ -38,9 +37,6 @@ const openPdfDocument = async (url, options = {}) => {
38
37
  // src/ui/viewers/ViewerMessages.ts
39
38
  const DEFAULT_VIEWER_MESSAGES = {
40
39
  loading: "Loading…",
41
- imageFailed: "This image can't be shown.",
42
- openWebsite: "Open {host}",
43
- websiteLabel: "Website screenshot",
44
40
  textLabel: "Text",
45
41
  textFailed: "This text can't be shown.",
46
42
  documentLabel: "Document",
@@ -576,187 +572,6 @@ const createDocumentViewer = (root, options) => {
576
572
  viewer.update(options);
577
573
  return viewer;
578
574
  };
579
- // src/ui/viewers/ImageViewers.ts
580
- /** Widths offered for a public image, so the browser fetches the smallest that fills the frame. */
581
- const IMAGE_WIDTHS = [
582
- 320,
583
- 640,
584
- 960,
585
- 1280,
586
- 1920,
587
- 2560
588
- ];
589
- /** The blurred placeholder shown while the image loads: the stored ThumbHash, or the CDN's. */
590
- const placeholderFor = (asset, urls) => {
591
- const hash = asset.content?.preview?.thumbhash;
592
- if (hash) try {
593
- return placeholderHashToDataURL(hash);
594
- } catch {}
595
- return asset.content?.rendered || asset.content?.preview ? urls.url("placeholder") : void 0;
596
- };
597
- /**
598
- * Loads the rendered image into `image` at responsive widths, asking once for a fresh asset URL
599
- * when it fails to load (as an expired signed one does).
600
- */
601
- const loadRenderedImage = async (urls, image, { sizes, width }, signal, done) => {
602
- const widths = IMAGE_WIDTHS.filter((candidate) => !width || candidate < width);
603
- const setSources = (src) => {
604
- if (widths.length) {
605
- image.srcset = [...widths, ...width ? [width] : []].map((candidate) => `${urls.url("rendered", { width: candidate })} ${candidate}w`).join(", ");
606
- image.sizes = sizes;
607
- }
608
- image.src = src;
609
- };
610
- image.addEventListener("load", () => {
611
- urls.loaded("rendered");
612
- done("loaded");
613
- });
614
- image.addEventListener("error", () => {
615
- const fresh = urls.refresh("rendered");
616
- if (!fresh) return done("error");
617
- fresh.then((url) => {
618
- if (!signal.aborted) setSources(url);
619
- }, () => done("error"));
620
- });
621
- const url = await urls.get("rendered");
622
- if (!signal.aborted) setSources(url);
623
- };
624
- /**
625
- * Shows an image asset's rendered file, fitted inside the element (the whole frame, for an embed
626
- * page), over its blurred placeholder until it loads.
627
- */
628
- var ImageViewer = class extends ViewerBase {
629
- constructor(root) {
630
- super(root, "image");
631
- }
632
- describe({ asset, sizes }) {
633
- return [
634
- asset.content?.rendered,
635
- asset.content?.preview?.thumbhash,
636
- sizes
637
- ];
638
- }
639
- async load(signal) {
640
- const { asset, label = "", sizes = "100vw" } = this.options;
641
- const rendered = asset.content?.rendered;
642
- if (rendered?.width && rendered.height) this.root.style.setProperty("--calmlens-viewer-ratio", `${rendered.width} / ${rendered.height}`);
643
- const placeholderUrl = placeholderFor(asset, this.urls);
644
- const placeholder = placeholderUrl && el("img", {
645
- class: "calmlens-viewer__placeholder",
646
- src: placeholderUrl,
647
- alt: "",
648
- "aria-hidden": "true"
649
- });
650
- const image = el("img", {
651
- class: "calmlens-viewer__image",
652
- alt: label,
653
- width: rendered?.width ?? void 0,
654
- height: rendered?.height ?? void 0,
655
- decoding: "async"
656
- });
657
- this.frame.replaceChildren(...[placeholder, image].filter((node) => !!node));
658
- await loadRenderedImage(this.urls, image, {
659
- sizes,
660
- width: rendered?.width
661
- }, signal, (outcome) => {
662
- if (signal.aborted) return;
663
- if (outcome === "error") return this.fail();
664
- this.state = "loaded";
665
- if (placeholder) placeholder.remove();
666
- });
667
- }
668
- fail() {
669
- this.state = "error";
670
- this.frame.replaceChildren(this.notice(this.messages.imageFailed));
671
- }
672
- };
673
- /** The page's address, if it is a web address the viewer may link to. */
674
- const websiteUrl = (asset) => {
675
- if (!asset.externalUrl) return void 0;
676
- try {
677
- const url = new URL(asset.externalUrl);
678
- return url.protocol === "https:" || url.protocol === "http:" ? url : void 0;
679
- } catch {
680
- return;
681
- }
682
- };
683
- /**
684
- * Shows a website asset: a link to the original page, then its screenshot at the element's width,
685
- * scrolling down the page.
686
- */
687
- var WebsiteViewer = class extends ViewerBase {
688
- constructor(root) {
689
- super(root, "website");
690
- }
691
- describe({ asset }) {
692
- return [
693
- asset.content?.rendered,
694
- asset.content?.preview?.thumbhash,
695
- asset.externalUrl
696
- ];
697
- }
698
- #link() {
699
- const url = websiteUrl(this.options.asset);
700
- return url ? el("div", { class: "calmlens-viewer__bar" }, [el("a", {
701
- class: "calmlens-button calmlens-viewer__link",
702
- href: url.href,
703
- target: "_blank",
704
- rel: "noopener noreferrer nofollow"
705
- }, [formatViewerMessage(this.messages.openWebsite, { host: url.host })])]) : void 0;
706
- }
707
- async load(signal) {
708
- const { asset, label } = this.options;
709
- const rendered = asset.content?.rendered;
710
- if (!rendered) return this.fail();
711
- const name = label || this.messages.websiteLabel;
712
- const placeholderUrl = placeholderFor(asset, this.urls);
713
- const placeholder = placeholderUrl && el("img", {
714
- class: "calmlens-viewer__placeholder",
715
- src: placeholderUrl,
716
- alt: "",
717
- "aria-hidden": "true"
718
- });
719
- const image = el("img", {
720
- class: "calmlens-viewer__image",
721
- alt: name,
722
- width: rendered.width ?? void 0,
723
- height: rendered.height ?? void 0,
724
- decoding: "async"
725
- });
726
- const page = el("div", {
727
- class: "calmlens-viewer__scroll",
728
- role: "region",
729
- "aria-label": name,
730
- tabindex: 0
731
- }, [placeholder, image]);
732
- this.frame.replaceChildren(...[this.#link(), page].filter((node) => !!node));
733
- await loadRenderedImage(this.urls, image, {
734
- sizes: "100vw",
735
- width: rendered.width
736
- }, signal, (outcome) => {
737
- if (signal.aborted) return;
738
- if (outcome === "error") return this.fail();
739
- this.state = "loaded";
740
- if (placeholder) placeholder.remove();
741
- });
742
- }
743
- fail() {
744
- this.state = "error";
745
- this.frame.replaceChildren(...[this.#link(), this.notice(this.messages.imageFailed)].filter((node) => !!node));
746
- }
747
- };
748
- /** Shows an image asset's rendered file in `root`. */
749
- const createImageViewer = (root, options) => {
750
- const viewer = new ImageViewer(root);
751
- viewer.update(options);
752
- return viewer;
753
- };
754
- /** Shows a website asset's screenshot and a link to the page in `root`. */
755
- const createWebsiteViewer = (root, options) => {
756
- const viewer = new WebsiteViewer(root);
757
- viewer.update(options);
758
- return viewer;
759
- };
760
575
  // src/ui/viewers/Spreadsheet.ts
761
576
  const SHEET_LINE = /^# Sheet "((?:[^"\\]|\\.)*)"( \(hidden\))?$/;
762
577
  const ROW_LINE = /^Row (\d+)( \(hidden\))?: (.*)$/;
@@ -1074,8 +889,6 @@ const createSpreadsheetViewer = (root, options) => {
1074
889
  // src/ui/viewers/index.ts
1075
890
  /** Mounts each viewer, by kind, for the bindings. */
1076
891
  const ASSET_VIEWERS = {
1077
- image: createImageViewer,
1078
- website: createWebsiteViewer,
1079
892
  text: createTextViewer,
1080
893
  document: createDocumentViewer,
1081
894
  spreadsheet: createSpreadsheetViewer
@@ -1257,4 +1070,4 @@ var MediaStreamPlayer = class {
1257
1070
  this.#key = void 0;
1258
1071
  }
1259
1072
  };
1260
- export { loadPdfJs as _, ASSET_VIEWERS as a, getSpreadsheetPage as c, createImageViewer as d, createWebsiteViewer as f, resolveViewerMessages as g, formatViewerMessage as h, isMountedViewerKind as i, parseSpreadsheetText as l, DEFAULT_VIEWER_MESSAGES as m, AssetViewerMount as n, createSpreadsheetViewer as o, createDocumentViewer as p, getMountedViewerOptions as r, createTextViewer as s, MediaStreamPlayer as t, spreadsheetColumnIndex as u };
1073
+ export { ASSET_VIEWERS as a, getSpreadsheetPage as c, createDocumentViewer as d, DEFAULT_VIEWER_MESSAGES as f, loadPdfJs as h, isMountedViewerKind as i, parseSpreadsheetText as l, resolveViewerMessages as m, AssetViewerMount as n, createSpreadsheetViewer as o, formatViewerMessage as p, getMountedViewerOptions as r, createTextViewer as s, MediaStreamPlayer as t, spreadsheetColumnIndex as u };
package/esm/ui.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as getAssetAspectRatio, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, I as UploadItem, J as AssetSessionState, K as AssetOptions, L as UploadSnapshot, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions, Q as MediaPlayback, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as AssetViewerKind, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as PdfAssetOptions, d as AssetDisplayOptions, dt as ViewerAsset, et as getAssetView, f as AssetEventHandlers, ft as ViewerOptions, g as CalmLensMessages, gt as isSpreadsheetFormat, h as UploaderProps, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as pickAssetSource, j as CustomUploadResult, k as CalmLensUpload, l as IconName, lt as SpreadsheetViewerOptions, m as UploaderDisplayOptions, mt as WebsiteViewerOptions, n as CalmLensTheme, nt as getPeakHeights, o as createProgressFetch, ot as DocumentViewerOptions, p as AssetProps, pt as ViewerTextOptions, q as AssetSession, r as resolveTheme, rt as getPlayedPercent, s as ICONS, st as ImageViewerOptions, t as CALMLENS_THEME, tt as getAssetViewKey, u as ASSET_FILE_ICON_SIZE, ut as TextViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage, z as createUploadController } from "./Core-BXeXyiNv.js";
2
- import { C as ViewerState, S as AssetViewer, _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as createWebsiteViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as createDocumentViewer, y as createImageViewer } from "./ui-5IdEYYpC.js";
3
- export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, type AssetDisplay, type AssetDisplayOptions, type AssetDocumentOptions, type AssetEventHandlers, type AssetImageOptions, type AssetImageSource, type AssetOptions, type AssetProps, AssetSession, type AssetSessionState, type AssetSpreadsheetOptions, type AssetVideoOptions, type AssetView, type AssetViewer, type AssetViewerKind, AssetViewerMount, AssetViewerName, AssetViewerOptionsByKind, CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensProvidedOptions, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, type DocumentViewerOptions, ICONS, ICON_ATTRIBUTES, type IconName, type ImageViewerOptions, type MediaPlayback, MediaStreamPlayer, type MountedViewerKind, type PdfAssetOptions, type ProgressFetchOptions, type SpreadsheetCell, type SpreadsheetRow, type SpreadsheetSheet, type SpreadsheetViewerOptions, type TextViewerOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, VIEWER_STYLES, type ViewerAsset, type ViewerMessages, type ViewerOptions, type ViewerState, type ViewerTextOptions, type WebsiteViewerOptions, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, withProvidedOptions };
1
+ import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, I as UploadItem, J as AssetSessionState, K as AssetOptions, L as UploadSnapshot, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, h as UploaderProps, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, k as CalmLensUpload, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage, z as createUploadController } from "./Core-CTO_Eh0l.js";
2
+ import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-DAbpyM2Z.js";
3
+ export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, type AssetDisplay, type AssetDisplayOptions, type AssetDocumentOptions, type AssetEventHandlers, type AssetImageOptions, type AssetImageSource, type AssetOptions, type AssetProps, AssetSession, type AssetSessionState, type AssetSpreadsheetOptions, type AssetVideoOptions, type AssetView, type AssetViewer, type AssetViewerKind, AssetViewerMount, AssetViewerName, AssetViewerOptionsByKind, CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensProvidedOptions, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, type DocumentViewerOptions, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, type IconName, type MediaPlayback, MediaStreamPlayer, type MountedViewerKind, type PdfAssetOptions, type ProgressFetchOptions, type SpreadsheetCell, type SpreadsheetRow, type SpreadsheetSheet, type SpreadsheetViewerOptions, type TextViewerOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, VIEWER_STYLES, type ViewerAsset, type ViewerMessages, type ViewerOptions, type ViewerState, type ViewerTextOptions, createDocumentViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isImageReady, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, withProvidedOptions };