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
@@ -1,5 +1,5 @@
1
- import { Y as CalmLensError, a as appendAssetLocation, c as toUrlViewerClaims, s as getAssetInfo, v as serializeTransform, x as transformSelector } from "./ModerationContextLimits-tu_PY4fn.js";
2
- import { o as placeholderHashToDataURL } from "./UploadController-Dqjf23bS.js";
1
+ import { Y as CalmLensError, a as appendAssetLocation, c as toUrlViewerClaims, s as getAssetInfo, v as serializeTransform, x as transformSelector } from "./ModerationContextLimits-Tev2lxE0.js";
2
+ import { o as placeholderHashToDataURL } from "./UploadController-D7XmzO-p.js";
3
3
  import { a as getFileIcon, c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
4
4
  // src/ui/viewers/ViewerAsset.ts
5
5
  /** Spreadsheet MIME types, as `content.format` reports them (compared lower-cased). */
@@ -89,7 +89,7 @@ const VIEWER_STYLES = `
89
89
  /* An opaque surface of its own, so sticky headers and the toolbar cover what scrolls under them. */
90
90
  background: var(--calmlens-viewer-background, Canvas); color: var(--calmlens-viewer-text, CanvasText);
91
91
  }
92
- .calmlens-viewer:is([data-kind="text"], [data-kind="document"], [data-kind="spreadsheet"], [data-kind="website"]) > .calmlens-viewer__frame { min-height: 320px; }
92
+ .calmlens-viewer:is([data-kind="text"], [data-kind="document"], [data-kind="spreadsheet"]) > .calmlens-viewer__frame { min-height: 320px; }
93
93
  .calmlens-viewer :focus-visible {
94
94
  outline: 2px solid var(--calmlens-focus-ring); outline-offset: -2px;
95
95
  }
@@ -110,18 +110,6 @@ const VIEWER_STYLES = `
110
110
  .calmlens-viewer__spacer { flex: 1; }
111
111
  .calmlens-viewer__link { text-decoration: none; overflow-wrap: anywhere; }
112
112
  .calmlens-viewer__scroll { flex: 1; min-height: 0; overflow: auto; position: relative; }
113
- /* Images fit inside the frame, keeping their shape; without a frame height, the box takes it. */
114
- .calmlens-viewer[data-kind="image"] > .calmlens-viewer__frame { aspect-ratio: var(--calmlens-viewer-ratio, auto); max-height: 100%; }
115
- .calmlens-viewer[data-kind="image"] > .calmlens-viewer__frame > img {
116
- position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
117
- }
118
- .calmlens-viewer:not([data-kind="image"]) .calmlens-viewer__placeholder {
119
- position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top;
120
- }
121
- .calmlens-viewer__placeholder { filter: blur(12px); transform: scale(1.05); }
122
- .calmlens-viewer__image { opacity: 0; transition: opacity 250ms; }
123
- .calmlens-viewer[data-state="loaded"] .calmlens-viewer__image { opacity: 1; }
124
- .calmlens-viewer[data-kind="website"] .calmlens-viewer__image { position: relative; display: block; width: 100%; height: auto; }
125
113
  .calmlens-viewer__text {
126
114
  margin: 0 auto; padding: 20px 24px; max-width: 75ch; white-space: pre-wrap; overflow-wrap: anywhere;
127
115
  font-family: inherit; font-size: 1rem; line-height: 1.6;
@@ -178,6 +166,20 @@ const decodePlaceholderHash = (hash) => {
178
166
  }
179
167
  return decodedPlaceholders.get(hash);
180
168
  };
169
+ /** Default responsive widths offered for full rendered images, up to 2560px. */
170
+ const DEFAULT_IMAGE_WIDTHS = [
171
+ 320,
172
+ 640,
173
+ 960,
174
+ 1280,
175
+ 1920,
176
+ 2560
177
+ ];
178
+ const hasExplicitSize = (transform) => {
179
+ if (!transform) return false;
180
+ if (typeof transform === "string") return /(?:^|,)\s*(?:width|height)=/i.test(transform);
181
+ return transform.width !== void 0 || transform.height !== void 0;
182
+ };
181
183
  const withWidth = (base, width) => {
182
184
  if (width === void 0) return base;
183
185
  if (base === void 0 || typeof base !== "string") return {
@@ -255,17 +257,30 @@ const getAssetView = (options, state) => {
255
257
  };
256
258
  const image = options.image ?? {};
257
259
  const still = (resource, size) => {
258
- const widths = [...new Set(image.widths ?? [])].filter((width) => Number.isSafeInteger(width) && width > 0).sort((a, b) => a - b);
259
260
  const build = (width) => url(resource, {
260
261
  lens: image.lens,
261
262
  transform: withWidth(image.transform, width)
262
263
  });
263
- const sources = widths.map((width) => ({
264
+ const explicitWidths = image.widths !== void 0;
265
+ let sources;
266
+ if (explicitWidths) sources = [...new Set(image.widths ?? [])].filter((width) => Number.isSafeInteger(width) && width > 0).sort((a, b) => a - b).map((width) => ({
264
267
  src: build(width),
265
268
  width
266
269
  }));
270
+ else if (resource === "rendered" && !image.lens && !hasExplicitSize(image.transform)) {
271
+ const maxWidth = size?.width ?? void 0;
272
+ const candidates = DEFAULT_IMAGE_WIDTHS.filter((width) => !maxWidth || width < maxWidth);
273
+ sources = candidates.map((width) => ({
274
+ src: build(width),
275
+ width
276
+ }));
277
+ if (maxWidth && candidates.length > 0 && maxWidth <= DEFAULT_IMAGE_WIDTHS.at(-1)) sources.push({
278
+ src: build(),
279
+ width: maxWidth
280
+ });
281
+ } else sources = [];
267
282
  return {
268
- src: sources.at(-1)?.src ?? build(),
283
+ src: explicitWidths ? sources.at(-1)?.src ?? build() : build(),
269
284
  srcSet: sources.length ? sources.map(({ src: source, width }) => `${source} ${width}w`).join(", ") : void 0,
270
285
  sources: sources.length ? sources : void 0,
271
286
  width: size?.width ?? void 0,
@@ -363,6 +378,13 @@ const pickAssetSource = (view, displayWidth) => {
363
378
  const getPeakHeights = (peaks) => peaks.map((peak) => Math.round(Math.min(1, Math.max(.02, peak)) * 1e3) / 10);
364
379
  /** How much of a media element has played, in percent, to one decimal place. */
365
380
  const getPlayedPercent = (media) => Number.isFinite(media.duration) && media.duration > 0 ? Math.round(Math.min(1, Math.max(0, media.currentTime / media.duration)) * 1e3) / 10 : 0;
381
+ /**
382
+ * How soon after an image element mounts an `onload` still counts as a browser cache hit (such as
383
+ * the HTTP disk cache, where `complete` is false on mount) and appears immediately without fading.
384
+ */
385
+ const INSTANT_LOAD_MS = 50;
386
+ /** True when an image element is already decoded in the browser's memory cache. */
387
+ const isImageReady = (image) => Boolean(image?.complete && image.naturalWidth > 0);
366
388
  const codeOf = (error) => CalmLensError.isCalmLensError(error) ? error.code : void 0;
367
389
  /**
368
390
  * One `CalmLensAsset`'s connection to the CDN. Each render calls `update` with the options and
@@ -793,7 +815,7 @@ const CALMLENS_STYLES = `
793
815
  }
794
816
  .calmlens-icon-button:hover { background: color-mix(in srgb, var(--calmlens-accent) 8%, transparent); border-color: var(--calmlens-border); }
795
817
  @media (prefers-reduced-motion: reduce) {
796
- .calmlens-dropzone, .calmlens-dropzone__icon, .calmlens-asset__content { transition: none; }
818
+ .calmlens-dropzone, .calmlens-dropzone__icon { transition: none; }
797
819
  .calmlens-progress:indeterminate {
798
820
  --calmlens-progress-animation: calmlens-indeterminate-still 1s both;
799
821
  }
@@ -812,9 +834,17 @@ const CALMLENS_STYLES = `
812
834
  .calmlens-asset:not([data-sized]) .calmlens-asset__content { position: relative; height: auto; }
813
835
  .calmlens-asset:not([data-sized])[data-kind="age-restricted"], .calmlens-asset:not([data-sized])[data-kind="unavailable"],
814
836
  .calmlens-asset:not([data-sized])[data-state="error"] { min-height: 160px; }
815
- .calmlens-asset__placeholder { transform: scale(1.1); filter: blur(12px); }
816
- .calmlens-asset__content { opacity: 0; transition: opacity 250ms; }
837
+ .calmlens-asset__placeholder { transform: scale(1.1); filter: blur(12px); opacity: 1; pointer-events: none; }
838
+ .calmlens-asset__content { opacity: 0; }
817
839
  .calmlens-asset[data-state="loaded"] .calmlens-asset__content { opacity: 1; }
840
+ .calmlens-asset[data-state="loaded"]:not([data-kind="age-restricted"]) .calmlens-asset__placeholder { opacity: 0; visibility: hidden; }
841
+ @media (prefers-reduced-motion: no-preference) {
842
+ .calmlens-asset[data-state="loaded"]:not([data-instant]) { transition: background-color 250ms; }
843
+ .calmlens-asset[data-state="loaded"]:not([data-instant]) .calmlens-asset__content { transition: opacity 250ms; }
844
+ .calmlens-asset[data-state="loaded"]:not([data-kind="age-restricted"], [data-instant]) .calmlens-asset__placeholder {
845
+ transition: opacity 250ms, visibility 0s linear 250ms;
846
+ }
847
+ }
818
848
  .calmlens-asset[data-kind="video"] .calmlens-asset__content, .calmlens-asset[data-kind="audio"] .calmlens-asset__content { opacity: 1; }
819
849
  /* Documents, text and spreadsheets fill the box with their viewer; a document shows its first
820
850
  page's still and an open link until the viewer loads. */
@@ -866,4 +896,4 @@ const CALMLENS_STYLES = `
866
896
  ${VIEWER_STYLES}`;
867
897
  /** Identifies the stylesheet, so React adds it once however many components render. */
868
898
  const CALMLENS_STYLES_ID = "calmlens-styles";
869
- export { CALMLENS_THEME as C, isSpreadsheetFormat as E, VIEWER_STYLES as S, getAssetViewerKind as T, getAssetView as _, describeUploadItem as a, getPlayedPercent as b, formatMessage as c, getUploadItemOutcome as d, resolveMessages as f, getAssetAspectRatio as g, AssetSession as h, DEFAULT_MESSAGES as i, getDropzoneHint as l, ICON_ATTRIBUTES as m, CALMLENS_STYLES_ID as n, describeUploader as o, ICONS as p, ASSET_FILE_ICON_SIZE as r, formatBytes as s, CALMLENS_STYLES as t, getUploadItemMessage as u, getAssetViewKey as v, resolveTheme as w, pickAssetSource as x, getPeakHeights as y };
899
+ export { pickAssetSource as C, getAssetViewerKind as D, resolveTheme as E, isSpreadsheetFormat as O, isImageReady as S, CALMLENS_THEME as T, getAssetAspectRatio as _, describeUploadItem as a, getPeakHeights as b, formatMessage as c, getUploadItemOutcome as d, resolveMessages as f, INSTANT_LOAD_MS as g, AssetSession as h, DEFAULT_MESSAGES as i, getDropzoneHint as l, ICON_ATTRIBUTES as m, CALMLENS_STYLES_ID as n, describeUploader as o, ICONS as p, ASSET_FILE_ICON_SIZE as r, formatBytes as s, CALMLENS_STYLES as t, getUploadItemMessage as u, getAssetView as v, VIEWER_STYLES as w, getPlayedPercent as x, getAssetViewKey as y };
@@ -7,12 +7,6 @@ import { o as UploadFileIconFamily } from "./FileIcons-4qSX7DW2.js";
7
7
  */
8
8
  interface ViewerMessages {
9
9
  loading: string;
10
- /** An image that can't be loaded. */
11
- imageFailed: string;
12
- /** The website viewer's link to the original page; `{host}` is the page's host name. */
13
- openWebsite: string;
14
- /** The website screenshot's accessible name when no `label` is set. */
15
- websiteLabel: string;
16
10
  textLabel: string;
17
11
  textFailed: string;
18
12
  documentLabel: string;
@@ -151,11 +145,6 @@ interface ViewerTextOptions {
151
145
  */
152
146
  getText?: () => Promise<string>;
153
147
  }
154
- interface ImageViewerOptions extends ViewerOptions {
155
- /** The `sizes` attribute of a public image's responsive widths. Defaults to `100vw`. */
156
- sizes?: string;
157
- }
158
- type WebsiteViewerOptions = ViewerOptions;
159
148
  type TextViewerOptions = ViewerOptions & ViewerTextOptions;
160
149
  interface SpreadsheetViewerOptions extends ViewerOptions, ViewerTextOptions {
161
150
  /** Rows shown at a time. Defaults to 100. */
@@ -364,6 +353,16 @@ declare const getPlayedPercent: (media: {
364
353
  currentTime: number;
365
354
  duration: number;
366
355
  }) => number;
356
+ /**
357
+ * How soon after an image element mounts an `onload` still counts as a browser cache hit (such as
358
+ * the HTTP disk cache, where `complete` is false on mount) and appears immediately without fading.
359
+ */
360
+ declare const INSTANT_LOAD_MS = 50;
361
+ /** True when an image element is already decoded in the browser's memory cache. */
362
+ declare const isImageReady: (image: {
363
+ complete: boolean;
364
+ naturalWidth: number;
365
+ } | null | undefined) => boolean;
367
366
  /** Where a video or audio element was when its URL failed, to resume once a fresh one loads. */
368
367
  interface MediaPlayback {
369
368
  position: number;
@@ -831,4 +830,4 @@ declare const CALMLENS_THEME: {
831
830
  * as the stylesheet mixes them from the page's text colour.
832
831
  */
833
832
  declare const resolveTheme: (overrides?: Partial<CalmLensTheme>) => CalmLensTheme;
834
- export { getAssetAspectRatio as $, CustomUploadContext as A, isFileAccepted as B, formatMessage as C, resolveMessages as D, getUploadItemOutcome as E, UploadFile as F, AssetImageSource as G, AssetDisplay as H, UploadItem as I, AssetSessionState as J, AssetOptions as K, UploadSnapshot as L, UploadClient as M, UploadController as N, CalmLensProvidedOptions as O, UploadControllerOptions as P, MediaPlayback as Q, UploadStage as R, formatBytes as S, getUploadItemMessage as T, AssetDocumentOptions as U, withProvidedOptions as V, AssetImageOptions as W, AssetVideoOptions as X, AssetSpreadsheetOptions as Y, AssetView as Z, DEFAULT_MESSAGES as _, DEFAULT_VIEWER_MESSAGES as _t, ProgressFetchOptions as a, AssetViewerKind as at, describeUploadItem as b, resolveViewerMessages as bt, ICON_ATTRIBUTES as c, PdfAssetOptions as ct, AssetDisplayOptions as d, ViewerAsset as dt, getAssetView as et, AssetEventHandlers as f, ViewerOptions as ft, CalmLensMessages as g, isSpreadsheetFormat as gt, UploaderProps as h, getAssetViewerKind as ht, CALMLENS_STYLES as i, pickAssetSource as it, CustomUploadResult as j, CalmLensUpload as k, IconName as l, SpreadsheetViewerOptions as lt, UploaderDisplayOptions as m, WebsiteViewerOptions as mt, CalmLensTheme as n, getPeakHeights as nt, createProgressFetch as o, DocumentViewerOptions as ot, AssetProps as p, ViewerTextOptions as pt, AssetSession as q, resolveTheme as r, getPlayedPercent as rt, ICONS as s, ImageViewerOptions as st, CALMLENS_THEME as t, getAssetViewKey as tt, ASSET_FILE_ICON_SIZE as u, TextViewerOptions as ut, UploadItemView as v, ViewerMessages as vt, getDropzoneHint as w, describeUploader as x, UploaderView as y, formatViewerMessage as yt, createUploadController as z };
833
+ export { MediaPlayback as $, CustomUploadContext as A, isFileAccepted as B, formatMessage as C, resolveMessages as D, getUploadItemOutcome as E, UploadFile as F, AssetImageSource as G, AssetDisplay as H, UploadItem as I, AssetSessionState as J, AssetOptions as K, UploadSnapshot as L, UploadClient as M, UploadController as N, CalmLensProvidedOptions as O, UploadControllerOptions as P, INSTANT_LOAD_MS as Q, UploadStage as R, formatBytes as S, getUploadItemMessage as T, AssetDocumentOptions as U, withProvidedOptions as V, AssetImageOptions as W, AssetVideoOptions as X, AssetSpreadsheetOptions as Y, AssetView as Z, DEFAULT_MESSAGES as _, DEFAULT_VIEWER_MESSAGES as _t, ProgressFetchOptions as a, isImageReady as at, describeUploadItem as b, resolveViewerMessages as bt, ICON_ATTRIBUTES as c, DocumentViewerOptions as ct, AssetDisplayOptions as d, TextViewerOptions as dt, getAssetAspectRatio as et, AssetEventHandlers as f, ViewerAsset as ft, CalmLensMessages as g, isSpreadsheetFormat as gt, UploaderProps as h, getAssetViewerKind as ht, CALMLENS_STYLES as i, getPlayedPercent as it, CustomUploadResult as j, CalmLensUpload as k, IconName as l, PdfAssetOptions as lt, UploaderDisplayOptions as m, ViewerTextOptions as mt, CalmLensTheme as n, getAssetViewKey as nt, createProgressFetch as o, pickAssetSource as ot, AssetProps as p, ViewerOptions as pt, AssetSession as q, resolveTheme as r, getPeakHeights as rt, ICONS as s, AssetViewerKind as st, CALMLENS_THEME as t, getAssetView as tt, ASSET_FILE_ICON_SIZE as u, SpreadsheetViewerOptions as ut, UploadItemView as v, ViewerMessages as vt, getDropzoneHint as w, describeUploader as x, UploaderView as y, formatViewerMessage as yt, createUploadController as z };
@@ -1052,7 +1052,7 @@ const listPages = (fetchPage, { cursor, feed = false } = {}) => {
1052
1052
  };
1053
1053
  // src/client/CalmLensVersion.ts
1054
1054
  /** This SDK's version, from its package.json. */
1055
- const SDK_VERSION = "0.27.4";
1055
+ const SDK_VERSION = "0.27.5";
1056
1056
  const runtimeName = () => {
1057
1057
  const runtime = globalThis;
1058
1058
  if (isReactNativeRuntime()) return "react-native";
@@ -1,4 +1,4 @@
1
- import { i as withProvidedOptions, n as createUploadController } from "./UploadController-Dqjf23bS.js";
1
+ import { i as withProvidedOptions, n as createUploadController } from "./UploadController-D7XmzO-p.js";
2
2
  import { createContext, createElement, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
3
3
  // src/ui/ReactUpload.ts
4
4
  const CalmLensContext = createContext(void 0);
@@ -1,4 +1,4 @@
1
- import { F as UploadFile, L as UploadSnapshot, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions } from "./Core-BXeXyiNv.js";
1
+ import { F as UploadFile, L as UploadSnapshot, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions } from "./Core-CTO_Eh0l.js";
2
2
  import { ReactNode } from "react";
3
3
  type CalmLensProviderProps<F extends UploadFile = File> = CalmLensProvidedOptions<F> & {
4
4
  children?: ReactNode;
@@ -1,5 +1,5 @@
1
- import { Y as CalmLensError, ot as SDK_ERROR_CODES } from "./ModerationContextLimits-tu_PY4fn.js";
2
- import { t as CalmLensAppClient } from "./CalmLensAppClient-C1cpQEYR.js";
1
+ import { Y as CalmLensError, ot as SDK_ERROR_CODES } from "./ModerationContextLimits-Tev2lxE0.js";
2
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-BxkCVPCl.js";
3
3
  // src/contract/PlaceholderHashDecode.js
4
4
  /**
5
5
  * Decodes a ThumbHash to an RGBA image. RGB is not be premultiplied by A.
package/esm/app.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 { t as CalmLensAppClient } from "./CalmLensAppClient-C1cpQEYR.js";
3
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-BxkCVPCl.js";
4
4
  export { AUTO_PAGING_TO_ARRAY_MAX, CALMLENS_ERROR_CODES, CDN_RESOURCES, CalmLensApiError, CalmLensAppClient, CalmLensAuthenticationError, CalmLensBadRequestError, CalmLensCancelledError, CalmLensConfigurationError, CalmLensConflictError, CalmLensConnectionError, CalmLensError, CalmLensInvalidArgumentError, CalmLensInvalidResponseError, CalmLensNotFoundError, CalmLensPayloadTooLargeError, CalmLensPermissionDeniedError, CalmLensRateLimitError, CalmLensServerError, CalmLensTimeoutError, CalmLensUnprocessableEntityError, CalmLensWebhookVerificationError, DEFAULT_CDN_BASE_URL, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, SDK_VERSION, getAssetInfo, selectModerationContextItems };
package/esm/elements.d.ts CHANGED
@@ -1,15 +1,14 @@
1
1
  import { i as AssetAvailability } from "./CalmLensTypes-OWZsGvBX.js";
2
- 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, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, 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, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as pickAssetSource, j as CustomUploadResult, 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 } from "./Core-BXeXyiNv.js";
3
- import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-CFtjSpBI.js";
4
- 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";
2
+ 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, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, 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, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, 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 } from "./Core-CTO_Eh0l.js";
3
+ import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-DJZY1LSU.js";
4
+ 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";
5
5
  declare const BaseElement$1: typeof HTMLElement;
6
6
  /**
7
7
  * An asset viewer element. Set the `src` attribute to the asset URL (public or signed) and the
8
8
  * `asset` property to its display info or the asset from the API, and `onExpired` to refresh a
9
- * signed URL; other attributes: `label`, `viewer-claims` (JSON), `sizes` (images), `page-size`
10
- * (spreadsheets) and `initial-page` (documents). The `text` and `getText` properties supply text
11
- * and spreadsheet viewers' text, `messages` replaces their text and `pdf` sets where pdf.js loads
12
- * its files from.
9
+ * signed URL; other attributes: `label`, `viewer-claims` (JSON), `page-size` (spreadsheets) and
10
+ * `initial-page` (documents). The `text` and `getText` properties supply text and spreadsheet
11
+ * viewers' text, `messages` replaces their text and `pdf` sets where pdf.js loads its files from.
13
12
  */
14
13
  declare abstract class ViewerElement<K extends AssetViewerName> extends BaseElement$1 {
15
14
  #private;
@@ -36,14 +35,6 @@ declare abstract class ViewerElement<K extends AssetViewerName> extends BaseElem
36
35
  attributeChangedCallback(): void;
37
36
  disconnectedCallback(): void;
38
37
  }
39
- /** `<calmlens-image-viewer>`: an image asset's rendered file, fitted to the element. */
40
- export declare class CalmLensImageViewerElement extends ViewerElement<"image"> {
41
- protected readonly kind = "image";
42
- }
43
- /** `<calmlens-website-viewer>`: a website's screenshot and a link to the page. */
44
- export declare class CalmLensWebsiteViewerElement extends ViewerElement<"website"> {
45
- protected readonly kind = "website";
46
- }
47
38
  /** `<calmlens-text-viewer>`: text, escaped, in a scrolling region. */
48
39
  export declare class CalmLensTextViewerElement extends ViewerElement<"text"> {
49
40
  protected readonly kind = "text";
@@ -60,8 +51,6 @@ export declare class CalmLensSpreadsheetViewerElement extends ViewerElement<"spr
60
51
  export declare const defineCalmLensViewerElements: () => void;
61
52
  declare global {
62
53
  interface HTMLElementTagNameMap {
63
- "calmlens-image-viewer": CalmLensImageViewerElement;
64
- "calmlens-website-viewer": CalmLensWebsiteViewerElement;
65
54
  "calmlens-text-viewer": CalmLensTextViewerElement;
66
55
  "calmlens-document-viewer": CalmLensDocumentViewerElement;
67
56
  "calmlens-spreadsheet-viewer": CalmLensSpreadsheetViewerElement;
@@ -186,4 +175,4 @@ declare global {
186
175
  "calmlens-timeupdate": CustomEvent<number>;
187
176
  }
188
177
  }
189
- 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 };
178
+ 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 };
package/esm/elements.js CHANGED
@@ -1,8 +1,8 @@
1
- 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";
2
- import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-Dqjf23bS.js";
3
- 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, 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";
1
+ 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";
2
+ 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, 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";
3
+ import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-D7XmzO-p.js";
4
4
  import { c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
5
- import { t as createUploadController } from "./BrowserUpload-BE8OVeBC.js";
5
+ import { t as createUploadController } from "./BrowserUpload-CejeWw5r.js";
6
6
  // src/viewers/Elements.ts
7
7
  const BaseElement$1 = typeof HTMLElement === "undefined" ? class {} : HTMLElement;
8
8
  const PROPERTIES = [
@@ -16,10 +16,9 @@ const PROPERTIES = [
16
16
  /**
17
17
  * An asset viewer element. Set the `src` attribute to the asset URL (public or signed) and the
18
18
  * `asset` property to its display info or the asset from the API, and `onExpired` to refresh a
19
- * signed URL; other attributes: `label`, `viewer-claims` (JSON), `sizes` (images), `page-size`
20
- * (spreadsheets) and `initial-page` (documents). The `text` and `getText` properties supply text
21
- * and spreadsheet viewers' text, `messages` replaces their text and `pdf` sets where pdf.js loads
22
- * its files from.
19
+ * signed URL; other attributes: `label`, `viewer-claims` (JSON), `page-size` (spreadsheets) and
20
+ * `initial-page` (documents). The `text` and `getText` properties supply text and spreadsheet
21
+ * viewers' text, `messages` replaces their text and `pdf` sets where pdf.js loads its files from.
23
22
  */
24
23
  var ViewerElement = class extends BaseElement$1 {
25
24
  static {
@@ -27,7 +26,6 @@ var ViewerElement = class extends BaseElement$1 {
27
26
  "src",
28
27
  "label",
29
28
  "viewer-claims",
30
- "sizes",
31
29
  "page-size",
32
30
  "initial-page"
33
31
  ];
@@ -119,7 +117,6 @@ var ViewerElement = class extends BaseElement$1 {
119
117
  pdf: this.#pdf,
120
118
  label: this.getAttribute("label") ?? void 0,
121
119
  viewerClaims: claims ? JSON.parse(claims) : void 0,
122
- sizes: this.getAttribute("sizes") ?? void 0,
123
120
  pageSize: pageSize ? Number(pageSize) : void 0,
124
121
  initialPage: initialPage ? Number(initialPage) : void 0
125
122
  };
@@ -127,44 +124,28 @@ var ViewerElement = class extends BaseElement$1 {
127
124
  else this.#viewer = ASSET_VIEWERS[this.kind](this, options);
128
125
  }
129
126
  };
130
- /** `<calmlens-image-viewer>`: an image asset's rendered file, fitted to the element. */
131
- var CalmLensImageViewerElement = class extends ViewerElement {
132
- constructor(..._args) {
133
- super(..._args);
134
- this.kind = "image";
135
- }
136
- };
137
- /** `<calmlens-website-viewer>`: a website's screenshot and a link to the page. */
138
- var CalmLensWebsiteViewerElement = class extends ViewerElement {
139
- constructor(..._args2) {
140
- super(..._args2);
141
- this.kind = "website";
142
- }
143
- };
144
127
  /** `<calmlens-text-viewer>`: text, escaped, in a scrolling region. */
145
128
  var CalmLensTextViewerElement = class extends ViewerElement {
146
- constructor(..._args3) {
147
- super(..._args3);
129
+ constructor(..._args) {
130
+ super(..._args);
148
131
  this.kind = "text";
149
132
  }
150
133
  };
151
134
  /** `<calmlens-document-viewer>`: a PDF a page at a time, with pdf.js loaded lazily. */
152
135
  var CalmLensDocumentViewerElement = class extends ViewerElement {
153
- constructor(..._args4) {
154
- super(..._args4);
136
+ constructor(..._args2) {
137
+ super(..._args2);
155
138
  this.kind = "document";
156
139
  }
157
140
  };
158
141
  /** `<calmlens-spreadsheet-viewer>`: a spreadsheet's sheets as tabs and paged tables. */
159
142
  var CalmLensSpreadsheetViewerElement = class extends ViewerElement {
160
- constructor(..._args5) {
161
- super(..._args5);
143
+ constructor(..._args3) {
144
+ super(..._args3);
162
145
  this.kind = "spreadsheet";
163
146
  }
164
147
  };
165
148
  const ELEMENTS = {
166
- "calmlens-image-viewer": CalmLensImageViewerElement,
167
- "calmlens-website-viewer": CalmLensWebsiteViewerElement,
168
149
  "calmlens-text-viewer": CalmLensTextViewerElement,
169
150
  "calmlens-document-viewer": CalmLensDocumentViewerElement,
170
151
  "calmlens-spreadsheet-viewer": CalmLensSpreadsheetViewerElement
@@ -755,13 +736,18 @@ var CalmLensAssetElement = class extends BaseElement {
755
736
  }
756
737
  this.#loadKey = loadKey;
757
738
  this.dataset.state = "loading";
739
+ delete this.dataset.instant;
758
740
  this.#viewers.destroy();
759
741
  const messages = resolveMessages(this.#messages);
760
742
  const { alt } = options;
761
- const loaded = () => {
743
+ const loaded = (instant = false) => {
762
744
  this.#session.loaded();
745
+ if (this.dataset.state === "loaded") return;
746
+ if (instant) {
747
+ this.dataset.instant = "";
748
+ this.querySelector(":scope > .calmlens-asset__placeholder")?.remove();
749
+ }
763
750
  this.dataset.state = "loaded";
764
- this.querySelector(":scope > .calmlens-asset__placeholder")?.remove();
765
751
  this.#emit("calmlens-load");
766
752
  };
767
753
  const placeholderUrl = "placeholderUrl" in view ? view.placeholderUrl : void 0;
@@ -791,11 +777,12 @@ var CalmLensAssetElement = class extends BaseElement {
791
777
  return media;
792
778
  };
793
779
  const image = (shown) => {
780
+ const startedAt = performance.now();
794
781
  const content = el("img", {
795
782
  class: "calmlens-asset__content",
796
783
  src: shown.src,
797
784
  srcset: shown.srcSet,
798
- sizes: shown.srcSet ? options.image.sizes : void 0,
785
+ sizes: shown.srcSet ? options.image.sizes ?? (this.hasAttribute("eager") ? "100vw" : "auto, 100vw") : void 0,
799
786
  alt,
800
787
  width: shown.width,
801
788
  height: shown.height,
@@ -803,7 +790,7 @@ var CalmLensAssetElement = class extends BaseElement {
803
790
  decoding: "async",
804
791
  fetchpriority: this.getAttribute("fetch-priority") ?? void 0
805
792
  });
806
- content.addEventListener("load", loaded);
793
+ content.addEventListener("load", () => loaded(performance.now() - startedAt < 50));
807
794
  content.addEventListener("error", () => this.#session.failed());
808
795
  return content;
809
796
  };
@@ -831,19 +818,26 @@ var CalmLensAssetElement = class extends BaseElement {
831
818
  ]));
832
819
  }
833
820
  } else if (view.kind === "pending") present(placeholder);
834
- else if (view.kind === "image") present(placeholder, image(view));
835
- else if (view.kind === "website") present(placeholder, view.link ? el("div", { class: "calmlens-asset__bar" }, [el("a", {
836
- class: "calmlens-button",
837
- href: view.link,
838
- target: "_blank",
839
- rel: "noopener noreferrer nofollow"
840
- }, [formatMessage(messages.openWebsite, { host: new URL(view.link).host })])]) : void 0, el("div", {
841
- class: "calmlens-asset__scroll",
842
- role: "region",
843
- "aria-label": alt || void 0,
844
- tabindex: 0
845
- }, [image(view)]));
846
- else if (view.kind === "video") present(playable(el("video", {
821
+ else if (view.kind === "image") {
822
+ const content = image(view);
823
+ present(placeholder, content);
824
+ if (isImageReady(content)) loaded(true);
825
+ } else if (view.kind === "website") {
826
+ const bar = view.link ? el("div", { class: "calmlens-asset__bar" }, [el("a", {
827
+ class: "calmlens-button",
828
+ href: view.link,
829
+ target: "_blank",
830
+ rel: "noopener noreferrer nofollow"
831
+ }, [formatMessage(messages.openWebsite, { host: new URL(view.link).host })])]) : void 0;
832
+ const content = image(view);
833
+ present(placeholder, bar, el("div", {
834
+ class: "calmlens-asset__scroll",
835
+ role: "region",
836
+ "aria-label": alt || void 0,
837
+ tabindex: 0
838
+ }, [content]));
839
+ if (isImageReady(content)) loaded(true);
840
+ } else if (view.kind === "video") present(playable(el("video", {
847
841
  class: "calmlens-asset__content",
848
842
  src: view.stream ? void 0 : view.src,
849
843
  poster: view.poster,
@@ -930,4 +924,4 @@ const defineCalmLensElements = () => {
930
924
  if (!customElements.get("calmlens-asset")) customElements.define("calmlens-asset", CalmLensAssetElement);
931
925
  };
932
926
  defineCalmLensElements();
933
- export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, CalmLensAssetElement, CalmLensDocumentViewerElement, CalmLensImageViewerElement, CalmLensSpreadsheetViewerElement, CalmLensTextViewerElement, CalmLensUploaderElement, CalmLensWebsiteViewerElement, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, ICONS, ICON_ATTRIBUTES, MediaStreamPlayer, UploadController, VIEWER_STYLES, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, defineCalmLensElements, defineCalmLensViewerElements, 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 };
927
+ export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, CalmLensAssetElement, CalmLensDocumentViewerElement, CalmLensSpreadsheetViewerElement, CalmLensTextViewerElement, CalmLensUploaderElement, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, MediaStreamPlayer, UploadController, VIEWER_STYLES, createDocumentViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, defineCalmLensElements, defineCalmLensViewerElements, 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 };
package/esm/index.js CHANGED
@@ -1 +1 @@
1
- export { I as AUTO_PAGING_TO_ARRAY_MAX, V as CALMLENS_ERROR_CODES, i as CDN_RESOURCES, H as CalmLensApiError, U as CalmLensAuthenticationError, W as CalmLensBadRequestError, G as CalmLensCancelledError, K as CalmLensConfigurationError, q as CalmLensConflictError, J as CalmLensConnectionError, Y as CalmLensError, X as CalmLensInvalidArgumentError, Z as CalmLensInvalidResponseError, Q as CalmLensNotFoundError, $ as CalmLensPayloadTooLargeError, et as CalmLensPermissionDeniedError, tt as CalmLensRateLimitError, nt as CalmLensServerError, rt as CalmLensTimeoutError, it as CalmLensUnprocessableEntityError, at as CalmLensWebhookVerificationError, u as DEFAULT_CDN_BASE_URL, t as MODERATION_CONTEXT_USED_CHARACTERS, n as MODERATION_CONTEXT_USED_ITEMS, N as SDK_VERSION, s as getAssetInfo, r as selectModerationContextItems } from "./ModerationContextLimits-tu_PY4fn.js";
1
+ export { I as AUTO_PAGING_TO_ARRAY_MAX, V as CALMLENS_ERROR_CODES, i as CDN_RESOURCES, H as CalmLensApiError, U as CalmLensAuthenticationError, W as CalmLensBadRequestError, G as CalmLensCancelledError, K as CalmLensConfigurationError, q as CalmLensConflictError, J as CalmLensConnectionError, Y as CalmLensError, X as CalmLensInvalidArgumentError, Z as CalmLensInvalidResponseError, Q as CalmLensNotFoundError, $ as CalmLensPayloadTooLargeError, et as CalmLensPermissionDeniedError, tt as CalmLensRateLimitError, nt as CalmLensServerError, rt as CalmLensTimeoutError, it as CalmLensUnprocessableEntityError, at as CalmLensWebhookVerificationError, u as DEFAULT_CDN_BASE_URL, t as MODERATION_CONTEXT_USED_CHARACTERS, n as MODERATION_CONTEXT_USED_ITEMS, N as SDK_VERSION, s as getAssetInfo, r as selectModerationContextItems } from "./ModerationContextLimits-Tev2lxE0.js";
@@ -1,5 +1,5 @@
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, a as ProgressFetchOptions, b as describeUploadItem, c as ICON_ATTRIBUTES, d as AssetDisplayOptions, et as getAssetView, f as AssetEventHandlers, g as CalmLensMessages, h as UploaderProps, i as CALMLENS_STYLES, it as pickAssetSource, j as CustomUploadResult, k as CalmLensUpload, l as IconName, m as UploaderDisplayOptions, n as CalmLensTheme, nt as getPeakHeights, o as createProgressFetch, p as AssetProps, q as AssetSession, r as resolveTheme, rt as getPlayedPercent, s as ICONS, t as CALMLENS_THEME, tt as getAssetViewKey, u as ASSET_FILE_ICON_SIZE, v as UploadItemView, w as getDropzoneHint, x as describeUploader, y as UploaderView, z as createUploadController } from "./Core-BXeXyiNv.js";
2
- import { i as useCalmLensUpload, n as CalmLensProviderProps, r as UseCalmLensUploadResult, t as CalmLensProvider } from "./ReactUpload-C47UrgH2.js";
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, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, c as ICON_ATTRIBUTES, d as AssetDisplayOptions, et as getAssetAspectRatio, f as AssetEventHandlers, g as CalmLensMessages, h as UploaderProps, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, k as CalmLensUpload, l as IconName, m as UploaderDisplayOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, v as UploadItemView, w as getDropzoneHint, x as describeUploader, y as UploaderView, z as createUploadController } from "./Core-CTO_Eh0l.js";
2
+ import { i as useCalmLensUpload, n as CalmLensProviderProps, r as UseCalmLensUploadResult, t as CalmLensProvider } from "./ReactUpload-BDXV4aHT.js";
3
3
  import { ReactNode } from "react";
4
4
  import { StyleProp, ViewStyle } from "react-native";
5
5
  /** What the uploader asks your picker for. */
@@ -94,4 +94,4 @@ export type CalmLensAssetProps = Omit<AssetOptions, "document" | "spreadsheet">
94
94
  * reveal button; content the CDN refuses shows the unavailable notice.
95
95
  */
96
96
  export declare function CalmLensAsset(props: CalmLensAssetProps): import("react").JSX.Element;
97
- export { ASSET_FILE_ICON_SIZE, 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, CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensProvidedOptions, CalmLensProvider, type CalmLensProviderProps, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, type IconName, type MediaPlayback, type ProgressFetchOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, type UseCalmLensUploadResult, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getDropzoneHint, getPeakHeights, getPlayedPercent, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickAssetSource, resolveMessages, resolveTheme, useCalmLensUpload, withProvidedOptions };
97
+ export { ASSET_FILE_ICON_SIZE, 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, CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensProvidedOptions, CalmLensProvider, type CalmLensProviderProps, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, type IconName, type MediaPlayback, type ProgressFetchOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, type UseCalmLensUploadResult, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getDropzoneHint, getPeakHeights, getPlayedPercent, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isImageReady, pickAssetSource, resolveMessages, resolveTheme, useCalmLensUpload, withProvidedOptions };
@@ -1,8 +1,8 @@
1
- import { a as appendAssetLocation } from "./ModerationContextLimits-tu_PY4fn.js";
2
- import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-Dqjf23bS.js";
3
- import { C as CALMLENS_THEME, _ 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, 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";
1
+ import { a as appendAssetLocation } from "./ModerationContextLimits-Tev2lxE0.js";
2
+ import { C as pickAssetSource, E as resolveTheme, 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, 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, x as getPlayedPercent, y as getAssetViewKey } from "./Core-B85V5dxv.js";
3
+ import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-D7XmzO-p.js";
4
4
  import { a as getFileIcon, o as getFileIconLabel, t as FILE_ICON_COLORS } from "./FileIcons-M6dzjFxd.js";
5
- import { i as useUploadSnapshot, n as useCalmLensUpload, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-BsbisXS6.js";
5
+ import { i as useUploadSnapshot, n as useCalmLensUpload, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-B7QXMSWJ.js";
6
6
  import { useEffect, useMemo, useRef, useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Image, Linking, PixelRatio, Pressable, StyleSheet, Text, View } from "react-native";
@@ -594,4 +594,4 @@ function CalmLensAsset(props) {
594
594
  ]
595
595
  });
596
596
  }
597
- export { ASSET_FILE_ICON_SIZE, AssetSession, CALMLENS_STYLES, CALMLENS_THEME, CHOOSE_TEST_ID, CalmLensAsset, CalmLensProvider, CalmLensUploader, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, UploadController, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getDropzoneHint, getPeakHeights, getPlayedPercent, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickAssetSource, resolveMessages, resolveTheme, useCalmLensUpload, withProvidedOptions };
597
+ export { ASSET_FILE_ICON_SIZE, AssetSession, CALMLENS_STYLES, CALMLENS_THEME, CHOOSE_TEST_ID, CalmLensAsset, CalmLensProvider, CalmLensUploader, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, UploadController, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getDropzoneHint, getPeakHeights, getPlayedPercent, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isImageReady, pickAssetSource, resolveMessages, resolveTheme, useCalmLensUpload, withProvidedOptions };
package/esm/react.d.ts CHANGED
@@ -1,7 +1,7 @@
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, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, 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, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as pickAssetSource, j as CustomUploadResult, 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 } from "./Core-BXeXyiNv.js";
2
- import { n as CalmLensProviderProps, t as CalmLensProvider } from "./ReactUpload-C47UrgH2.js";
3
- import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, o as UseCalmLensUploadResult, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-CFtjSpBI.js";
4
- 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";
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, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, 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, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, 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 } from "./Core-CTO_Eh0l.js";
2
+ import { n as CalmLensProviderProps, t as CalmLensProvider } from "./ReactUpload-BDXV4aHT.js";
3
+ import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, o as UseCalmLensUploadResult, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-DJZY1LSU.js";
4
+ 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";
5
5
  import { CSSProperties, HTMLAttributes, ReactNode } from "react";
6
6
  type ElementProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
7
7
  /** Leaves out the stylesheet the viewers render, so you can style the `calmlens-*` classes. */
@@ -9,15 +9,9 @@ type ElementProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
9
9
  className?: string;
10
10
  style?: CSSProperties;
11
11
  };
12
- export type CalmLensImageViewerProps = ImageViewerOptions & ElementProps;
13
- export type CalmLensWebsiteViewerProps = WebsiteViewerOptions & ElementProps;
14
12
  export type CalmLensTextViewerProps = TextViewerOptions & ElementProps;
15
13
  export type CalmLensDocumentViewerProps = DocumentViewerOptions & ElementProps;
16
14
  export type CalmLensSpreadsheetViewerProps = SpreadsheetViewerOptions & ElementProps;
17
- /** Shows an image asset's rendered file, fitted to the element, over its placeholder. */
18
- export declare function CalmLensImageViewer(props: CalmLensImageViewerProps): import("react").JSX.Element;
19
- /** Shows a website asset's screenshot with a link to the original page. */
20
- export declare function CalmLensWebsiteViewer(props: CalmLensWebsiteViewerProps): import("react").JSX.Element;
21
15
  /** Shows a text asset's text, escaped, in a scrolling region. */
22
16
  export declare function CalmLensTextViewer(props: CalmLensTextViewerProps): import("react").JSX.Element;
23
17
  /** Shows a PDF, or a document rendered as one, a page at a time with pdf.js (loaded lazily). */
@@ -61,4 +55,4 @@ export type CalmLensAssetProps = AssetProps & StyleOptions & Omit<HTMLAttributes
61
55
  * and a reveal button; content the CDN refuses shows the unavailable notice.
62
56
  */
63
57
  export declare function CalmLensAsset(props: CalmLensAssetProps): import("react").JSX.Element;
64
- 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, CalmLensProvider, type CalmLensProviderProps, 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, type UseCalmLensUploadResult, 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 };
58
+ 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, CalmLensProvider, type CalmLensProviderProps, 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, type UseCalmLensUploadResult, 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 };