calmlens 0.27.3 → 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.
- package/bin/calmlens.js +1 -1
- package/cjs/{BrowserUpload-Dt1zocK4.d.ts → BrowserUpload-DJZY1LSU.d.ts} +2 -2
- package/cjs/{BrowserUpload-ldUKNpff.js → BrowserUpload-DhruIgFN.js} +1 -1
- package/cjs/{CalmLensAppClient--O7TSwy3.js → CalmLensAppClient-BA_xaNHY.js} +2 -2
- package/{esm/CalmLensAppClient-CTMmq7Dx.d.ts → cjs/CalmLensAppClient-DzoSqUgG.d.ts} +1 -1
- package/cjs/{CalmLensOptionKeys-BHl-sxlg.js → CalmLensOptionKeys-BvLQghl-.js} +1 -1
- package/cjs/{CalmLensServerClient--9ScUitp.d.ts → CalmLensServerClient-D3K5HS9v.d.ts} +2 -2
- package/cjs/{CalmLensServerClient-BTN0LFs6.js → CalmLensServerClient-D55xDZm4.js} +2 -2
- package/cjs/{CalmLensTypes-CRAOkOV4.d.ts → CalmLensTypes-OWZsGvBX.d.ts} +7 -2
- package/{esm/Core-BIs7IQ84.d.ts → cjs/Core-CTO_Eh0l.d.ts} +13 -14
- package/cjs/{Core-BdyadK2Y.js → Core-kKGmyk5V.js} +63 -21
- package/cjs/{ModerationContextLimits-Cyg__fp3.js → ModerationContextLimits-Cxaob3tc.js} +1 -1
- package/{esm/ReactUpload-DsF4ahE6.d.ts → cjs/ReactUpload-BDXV4aHT.d.ts} +1 -1
- package/cjs/{ReactUpload-C7-EzsLW.js → ReactUpload-Cx3Hi7xt.js} +1 -1
- package/cjs/{UploadController-wKETVSZ8.js → UploadController-CC1afxmL.js} +2 -2
- package/{esm/WebhookPayload-Cth0Xvpz.d.ts → cjs/WebhookPayload-CrMU6lg0.d.ts} +1 -1
- package/cjs/app.d.ts +4 -4
- package/cjs/app.js +2 -2
- package/cjs/elements.d.ts +8 -19
- package/cjs/elements.js +45 -53
- package/cjs/{index-BsUWhlwp.d.ts → index-BDxmVi-G.d.ts} +2 -2
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +1 -1
- package/cjs/react-native.d.ts +3 -3
- package/cjs/react-native.js +6 -4
- package/cjs/react.d.ts +5 -11
- package/cjs/react.js +29 -36
- package/cjs/server.d.ts +4 -4
- package/cjs/server.js +2 -2
- package/cjs/testing.d.ts +4 -4
- package/cjs/testing.js +5 -5
- package/cjs/{ui-CmRjBpMv.d.ts → ui-DAbpyM2Z.d.ts} +3 -9
- package/cjs/{ui-DZHhU1_I.js → ui-I75EvP9r.js} +2 -201
- package/cjs/ui.d.ts +3 -3
- package/cjs/ui.js +5 -5
- package/cjs/vue.d.ts +6 -319
- package/cjs/vue.js +27 -17
- package/esm/{BrowserUpload-DI_N79Hf.js → BrowserUpload-CejeWw5r.js} +1 -1
- package/esm/{BrowserUpload-Dt1zocK4.d.ts → BrowserUpload-DJZY1LSU.d.ts} +2 -2
- package/esm/{CalmLensAppClient-hBV8phqu.js → CalmLensAppClient-BxkCVPCl.js} +2 -2
- package/{cjs/CalmLensAppClient-CTMmq7Dx.d.ts → esm/CalmLensAppClient-DzoSqUgG.d.ts} +1 -1
- package/esm/{CalmLensOptionKeys-Cx6zlZBW.js → CalmLensOptionKeys-DC9FUO43.js} +1 -1
- package/esm/{CalmLensServerClient-C-Y82hbC.js → CalmLensServerClient-D-TIIQp2.js} +2 -2
- package/esm/{CalmLensServerClient--9ScUitp.d.ts → CalmLensServerClient-D3K5HS9v.d.ts} +2 -2
- package/esm/{CalmLensTypes-CRAOkOV4.d.ts → CalmLensTypes-OWZsGvBX.d.ts} +7 -2
- package/esm/{Core-KP_nIj1_.js → Core-B85V5dxv.js} +52 -22
- package/{cjs/Core-BIs7IQ84.d.ts → esm/Core-CTO_Eh0l.d.ts} +13 -14
- package/esm/{ModerationContextLimits-BTzR81IP.js → ModerationContextLimits-Tev2lxE0.js} +1 -1
- package/esm/{ReactUpload-DHMtN7ap.js → ReactUpload-B7QXMSWJ.js} +1 -1
- package/{cjs/ReactUpload-DsF4ahE6.d.ts → esm/ReactUpload-BDXV4aHT.d.ts} +1 -1
- package/esm/{UploadController-BlQqCkhK.js → UploadController-D7XmzO-p.js} +2 -2
- package/{cjs/WebhookPayload-Cth0Xvpz.d.ts → esm/WebhookPayload-CrMU6lg0.d.ts} +1 -1
- package/esm/app.d.ts +4 -4
- package/esm/app.js +2 -2
- package/esm/elements.d.ts +8 -19
- package/esm/elements.js +44 -50
- package/esm/{index-BsUWhlwp.d.ts → index-BDxmVi-G.d.ts} +2 -2
- package/esm/index.d.ts +3 -3
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +3 -3
- package/esm/react-native.js +5 -5
- package/esm/react.d.ts +5 -11
- package/esm/react.js +29 -34
- package/esm/server.d.ts +4 -4
- package/esm/server.js +2 -2
- package/esm/styles.css +12 -16
- package/esm/svelte/CalmLensAsset.svelte +22 -4
- package/esm/svelte/index.d.ts +0 -6
- package/esm/svelte/index.js +0 -2
- package/esm/testing.d.ts +4 -4
- package/esm/testing.js +5 -5
- package/esm/{ui-CmRjBpMv.d.ts → ui-DAbpyM2Z.d.ts} +3 -9
- package/esm/{ui-SnbQ4vk1.js → ui-cE1lyljs.js} +3 -190
- package/esm/ui.d.ts +3 -3
- package/esm/ui.js +4 -4
- package/esm/vue.d.ts +6 -319
- package/esm/vue.js +26 -14
- package/package.json +1 -1
- package/esm/svelte/CalmLensImageViewer.svelte +0 -7
- package/esm/svelte/CalmLensWebsiteViewer.svelte +0 -7
|
@@ -5017,6 +5017,7 @@ declare const ASSET_CLASSIFICATION_SCHEMA: zod.ZodObject<{
|
|
|
5017
5017
|
"processing-error": "processing-error";
|
|
5018
5018
|
"resolution-limit": "resolution-limit";
|
|
5019
5019
|
"too-many-items": "too-many-items";
|
|
5020
|
+
"website-unavailable": "website-unavailable";
|
|
5020
5021
|
"type-mismatch": "type-mismatch";
|
|
5021
5022
|
"undecodable-content": "undecodable-content";
|
|
5022
5023
|
"unsupported-format": "unsupported-format";
|
|
@@ -10139,6 +10140,7 @@ declare const ASSET_SCHEMA: zod.ZodObject<{
|
|
|
10139
10140
|
"processing-error": "processing-error";
|
|
10140
10141
|
"resolution-limit": "resolution-limit";
|
|
10141
10142
|
"too-many-items": "too-many-items";
|
|
10143
|
+
"website-unavailable": "website-unavailable";
|
|
10142
10144
|
"type-mismatch": "type-mismatch";
|
|
10143
10145
|
"undecodable-content": "undecodable-content";
|
|
10144
10146
|
"unsupported-format": "unsupported-format";
|
|
@@ -15394,6 +15396,7 @@ declare const ASSET_SEARCH_RESULT_SCHEMA: zod.ZodObject<{
|
|
|
15394
15396
|
"processing-error": "processing-error";
|
|
15395
15397
|
"resolution-limit": "resolution-limit";
|
|
15396
15398
|
"too-many-items": "too-many-items";
|
|
15399
|
+
"website-unavailable": "website-unavailable";
|
|
15397
15400
|
"type-mismatch": "type-mismatch";
|
|
15398
15401
|
"undecodable-content": "undecodable-content";
|
|
15399
15402
|
"unsupported-format": "unsupported-format";
|
|
@@ -36365,6 +36368,7 @@ declare const EVENT_TYPE_INFO: {
|
|
|
36365
36368
|
"processing-error": "processing-error";
|
|
36366
36369
|
"resolution-limit": "resolution-limit";
|
|
36367
36370
|
"too-many-items": "too-many-items";
|
|
36371
|
+
"website-unavailable": "website-unavailable";
|
|
36368
36372
|
"type-mismatch": "type-mismatch";
|
|
36369
36373
|
"undecodable-content": "undecodable-content";
|
|
36370
36374
|
"unsupported-format": "unsupported-format";
|
|
@@ -36377,7 +36381,7 @@ declare const EVENT_TYPE_INFO: {
|
|
|
36377
36381
|
assetType?: "audio" | "file" | "image" | "multimedia-document" | "plaintext-document" | "video" | "website" | null | undefined;
|
|
36378
36382
|
parentAsset?: string | undefined;
|
|
36379
36383
|
previousStatus?: "completed" | "failed" | "processing" | "queued" | null | undefined;
|
|
36380
|
-
failureReason: "duration-limit" | "file-too-large" | "free-uploads-exhausted" | "media-limit" | "multiple-tracks" | "processing-error" | "resolution-limit" | "too-many-items" | "type-mismatch" | "undecodable-content" | "unsupported-format" | "uploads-paused";
|
|
36384
|
+
failureReason: "duration-limit" | "file-too-large" | "free-uploads-exhausted" | "media-limit" | "multiple-tracks" | "processing-error" | "resolution-limit" | "too-many-items" | "type-mismatch" | "undecodable-content" | "unsupported-format" | "uploads-paused" | "website-unavailable";
|
|
36381
36385
|
}>;
|
|
36382
36386
|
factInfo: {
|
|
36383
36387
|
label: string;
|
|
@@ -36427,6 +36431,7 @@ declare const EVENT_TYPE_INFO: {
|
|
|
36427
36431
|
"processing-error": "processing-error";
|
|
36428
36432
|
"resolution-limit": "resolution-limit";
|
|
36429
36433
|
"too-many-items": "too-many-items";
|
|
36434
|
+
"website-unavailable": "website-unavailable";
|
|
36430
36435
|
"type-mismatch": "type-mismatch";
|
|
36431
36436
|
"undecodable-content": "undecodable-content";
|
|
36432
36437
|
"unsupported-format": "unsupported-format";
|
|
@@ -42462,7 +42467,7 @@ type AssetClassificationStatus = AssetClassificationStatus$1 | (string & {});
|
|
|
42462
42467
|
/**
|
|
42463
42468
|
* Why processing failed: `file-too-large`, `duration-limit`, `resolution-limit`,
|
|
42464
42469
|
* `unsupported-format`, `undecodable-content`, `multiple-tracks`, `type-mismatch`,
|
|
42465
|
-
* `free-uploads-exhausted`, `media-limit`, `uploads-paused`, `too-many-items` or `processing-error`.
|
|
42470
|
+
* `free-uploads-exhausted`, `media-limit`, `uploads-paused`, `too-many-items`, `website-unavailable` or `processing-error`.
|
|
42466
42471
|
*/
|
|
42467
42472
|
type AssetClassificationFailureReason = NonNullable<AssetClassification$1["failureReason"]> | (string & {});
|
|
42468
42473
|
/**
|
|
@@ -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-
|
|
2
|
-
import { o as placeholderHashToDataURL } from "./UploadController-
|
|
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"]
|
|
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
|
|
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
|
|
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;
|
|
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 {
|
|
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as CdnTransform, O as CalmLensAppClientOptions, en as ViewerClaims, g as AssetModerationStatus, i as AssetAvailability } from "./CalmLensTypes-
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
1
|
+
import { F as CdnTransform, O as CalmLensAppClientOptions, en as ViewerClaims, g as AssetModerationStatus, i as AssetAvailability } from "./CalmLensTypes-OWZsGvBX.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-DzoSqUgG.js";
|
|
3
3
|
import { o as UploadFileIconFamily } from "./FileIcons-4qSX7DW2.js";
|
|
4
4
|
/**
|
|
5
5
|
* The text the asset viewers show, keyed by name. `{name}` placeholders are filled in when shown.
|
|
@@ -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 {
|
|
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.
|
|
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-
|
|
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-
|
|
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-
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
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.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn as EventAsset, ln as TypedEvent, sn as Actor } from "./CalmLensTypes-
|
|
1
|
+
import { cn as EventAsset, ln as TypedEvent, sn as Actor } from "./CalmLensTypes-OWZsGvBX.js";
|
|
2
2
|
import * as zod from "zod";
|
|
3
3
|
/** Error codes the CalmLens API documents, by name. */
|
|
4
4
|
declare const API_ERROR_CODES: {
|
package/esm/app.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as ClassificationNotEvaluatedReason, c as ModerationQualifier, d as HashListEntry, f as ModerationContext, g as selectModerationContextItems, h as ModerationContextItem, i as ClassificationCategoryReport, l as PolicyAction, m as MODERATION_CONTEXT_USED_ITEMS, n as ClassificationCategories, o as ClassificationQualifierResults, p as MODERATION_CONTEXT_USED_CHARACTERS, r as ClassificationCategory, s as Likelihood, u as HashList } from "./Classification-CMM2tZpJ-IdIh63n0.js";
|
|
2
|
-
import { $ as FolderPage, $t as VerifyWebhookSignatureOptions, A as CdnAssetLocation, An as Policy, At as RetrieveAssetOptions, B as CreateHashListOptions, Bn as AssetRendered, Bt as UpdateAssetOptions, C as AssetUploadStatus, Cn as BoundingBox, Ct as MultipartUploadPartOptions, D as BatchAssetsResponse, Dn as ProcessingFeatureResults, Dt as RequestAttempt, E as BatchAssetsOptions, En as ProcessingFeatureId, Et as RemoveAssetContentOptions, F as CdnTransform, Ft as SignUploadTokenOptions, G as DeleteAssetOptions, Gn as FileMetadata, Gt as UpdateProjectSettingsOptions, H as CreateMultipartUploadPartOptions, Hn as AssetSafetyHold, Ht as UpdateHashListOptions, I as ClassifyTextOptions, In as AssetInfo, It as SignedAssetUrl, J as EnsureLensesOptions, Jt as UploadPresetDefinition, K as DeleteMetadataFieldOptions, Kn as MetadataItem, Kt as UpgradePolicyOptions, L as ClientRequestDefaults, Ln as AssetHls, Lt as SignedUploadToken, M as CdnAssetUrlOptions, Mn as LensType, Mt as SearchAssetsOptions, N as CdnResource, Nn as AssetSearchMatchField, Nt as SetPolicyAutomaticUpdatesOptions, O as CalmLensAppClientOptions, On as ProcessingFeatureStage, Ot as RequestOptions, P as CdnServeOptions, Pn as AssetSearchQuery, Pt as SignAssetUrlOptions, Q as FolderIdOptions, Qt as UploadedAsset, R as ConnectionOptions, Rn as AssetHlsRendition, Rt as StreamingFeatureOptions, S as AssetUpload, Sn as AgeRange, St as MultipartUploadOptions, T as AssignPolicyOptions, Tn as DetectedPerson, Tt as PolicyPage, U as CreatePolicyOptions, Un as AssetSafetyHoldReason, Ut as UpdateLensOptions, V as CreateLensOptions, Vn as AssetRenderedKind, Vt as UpdateFolderOptions, W as DecideAssetOptions, Wn as ExtractedText, Wt as UpdatePolicyOptions, X as EnsureUploadPresetsOptions, Xt as UploadPresetPage, Y as EnsureMetadataFieldsOptions, Yt as UploadPresetIdOptions, Z as EnsureUploadPresetsResponse, Zt as UploadPresetSubmitAssetOptions, _ as AssetPage, _n as Folder, _t as ListLensesOptions, a as AssetChecksums, an as AssetTimelineSegment, at as IdempotencyOptions, b as AssetTimelinePage, bn as PublicProjectSettings, bt as MoveAssetOptions, c as AssetClassificationFailureReason, cn as EventAsset, ct as LensIdOptions, d as AssetContentOptions, dn as EventFact, dt as ListAssetTimelineOptions, en as ViewerClaims, et as GetAssetInfoOptions, f as AssetContentRemovalReason, fn as EventFactValues, ft as ListAssetsOptions, g as AssetModerationStatus, gt as ListHashListsOptions, h as AssetModerationDecision, hn as EventType, ht as ListHashListEntriesOptions, i as AssetAvailability, in as AssetBatchOperation, it as HashListPage, j as CdnAssetReference, jn as CursorPage, jt as RetryAssetOptions, k as CalmLensServerClientOptions, kn as ProcessingFeatures, kt as ResetPolicyOptions, l as AssetClassificationStatus, ln as TypedEvent, lt as LensPage, m as AssetModeration, mn as EventSeverity, mt as ListFoldersOptions, n as AppInfo, nn as WebhookHeadersInput, nt as HashListEntryPage, o as AssetChildrenPage, on as GetEventsResponse, ot as ImageTransformOptions, p as AssetContentStatus, pn as EventFacts, pt as ListEventsOptions, q as EnsureLensOptions, qn as ProcessingOptions, qt as UploadAssetPartOptions, r as Asset, rn as WebhookPayloadInput, rt as HashListIdOptions, s as AssetClassification, st as Lens, t as AddHashListEntryOptions, tn as WaitForAssetDecisionOptions, tt as HashListEntryIdOptions, u as AssetContent, un as EventCategory, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vn as MetadataFieldsResource, vt as ListPoliciesOptions, w as AssetVisibility, wn as DetectedFace, wt as PolicyIdOptions, x as AssetType, xn as UploadPreset, xt as MoveFolderOptions, y as AssetSearchResult, yn as ProjectSettingsResource, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zn as AssetPreview, zt as SubmitAssetOptions } from "./CalmLensTypes-
|
|
3
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
4
|
-
import { i as getAssetInfo, n as DEFAULT_CDN_BASE_URL, r as CDN_RESOURCES, t as SDK_VERSION } from "./index-
|
|
5
|
-
import { A as CalmLensRateLimitError, C as CalmLensErrorKind, D as CalmLensNotFoundError, E as CalmLensInvalidResponseError, F as SdkErrorCode, I as ApiErrorCode, M as CalmLensTimeoutError, N as CalmLensUnprocessableEntityError, O as CalmLensPayloadTooLargeError, P as CalmLensWebhookVerificationError, S as CalmLensErrorDetails, T as CalmLensInvalidArgumentError, _ as CalmLensConfigurationError, a as AUTO_PAGING_TO_ARRAY_MAX, b as CalmLensError, c as CalmLensLastResponse, d as ListPromise, f as CALMLENS_ERROR_CODES, g as CalmLensCancelledError, h as CalmLensBadRequestError, i as ServedAssetInfo, j as CalmLensServerError, k as CalmLensPermissionDeniedError, l as CalmLensResponse, m as CalmLensAuthenticationError, o as AutoPaging, p as CalmLensApiError, r as CdnResponse, s as AutoPagingToArrayOptions, t as ReceivedWebhookEventPayload, u as ListPage, v as CalmLensConflictError, w as CalmLensErrorOptions, x as CalmLensErrorCode, y as CalmLensConnectionError } from "./WebhookPayload-
|
|
2
|
+
import { $ as FolderPage, $t as VerifyWebhookSignatureOptions, A as CdnAssetLocation, An as Policy, At as RetrieveAssetOptions, B as CreateHashListOptions, Bn as AssetRendered, Bt as UpdateAssetOptions, C as AssetUploadStatus, Cn as BoundingBox, Ct as MultipartUploadPartOptions, D as BatchAssetsResponse, Dn as ProcessingFeatureResults, Dt as RequestAttempt, E as BatchAssetsOptions, En as ProcessingFeatureId, Et as RemoveAssetContentOptions, F as CdnTransform, Ft as SignUploadTokenOptions, G as DeleteAssetOptions, Gn as FileMetadata, Gt as UpdateProjectSettingsOptions, H as CreateMultipartUploadPartOptions, Hn as AssetSafetyHold, Ht as UpdateHashListOptions, I as ClassifyTextOptions, In as AssetInfo, It as SignedAssetUrl, J as EnsureLensesOptions, Jt as UploadPresetDefinition, K as DeleteMetadataFieldOptions, Kn as MetadataItem, Kt as UpgradePolicyOptions, L as ClientRequestDefaults, Ln as AssetHls, Lt as SignedUploadToken, M as CdnAssetUrlOptions, Mn as LensType, Mt as SearchAssetsOptions, N as CdnResource, Nn as AssetSearchMatchField, Nt as SetPolicyAutomaticUpdatesOptions, O as CalmLensAppClientOptions, On as ProcessingFeatureStage, Ot as RequestOptions, P as CdnServeOptions, Pn as AssetSearchQuery, Pt as SignAssetUrlOptions, Q as FolderIdOptions, Qt as UploadedAsset, R as ConnectionOptions, Rn as AssetHlsRendition, Rt as StreamingFeatureOptions, S as AssetUpload, Sn as AgeRange, St as MultipartUploadOptions, T as AssignPolicyOptions, Tn as DetectedPerson, Tt as PolicyPage, U as CreatePolicyOptions, Un as AssetSafetyHoldReason, Ut as UpdateLensOptions, V as CreateLensOptions, Vn as AssetRenderedKind, Vt as UpdateFolderOptions, W as DecideAssetOptions, Wn as ExtractedText, Wt as UpdatePolicyOptions, X as EnsureUploadPresetsOptions, Xt as UploadPresetPage, Y as EnsureMetadataFieldsOptions, Yt as UploadPresetIdOptions, Z as EnsureUploadPresetsResponse, Zt as UploadPresetSubmitAssetOptions, _ as AssetPage, _n as Folder, _t as ListLensesOptions, a as AssetChecksums, an as AssetTimelineSegment, at as IdempotencyOptions, b as AssetTimelinePage, bn as PublicProjectSettings, bt as MoveAssetOptions, c as AssetClassificationFailureReason, cn as EventAsset, ct as LensIdOptions, d as AssetContentOptions, dn as EventFact, dt as ListAssetTimelineOptions, en as ViewerClaims, et as GetAssetInfoOptions, f as AssetContentRemovalReason, fn as EventFactValues, ft as ListAssetsOptions, g as AssetModerationStatus, gt as ListHashListsOptions, h as AssetModerationDecision, hn as EventType, ht as ListHashListEntriesOptions, i as AssetAvailability, in as AssetBatchOperation, it as HashListPage, j as CdnAssetReference, jn as CursorPage, jt as RetryAssetOptions, k as CalmLensServerClientOptions, kn as ProcessingFeatures, kt as ResetPolicyOptions, l as AssetClassificationStatus, ln as TypedEvent, lt as LensPage, m as AssetModeration, mn as EventSeverity, mt as ListFoldersOptions, n as AppInfo, nn as WebhookHeadersInput, nt as HashListEntryPage, o as AssetChildrenPage, on as GetEventsResponse, ot as ImageTransformOptions, p as AssetContentStatus, pn as EventFacts, pt as ListEventsOptions, q as EnsureLensOptions, qn as ProcessingOptions, qt as UploadAssetPartOptions, r as Asset, rn as WebhookPayloadInput, rt as HashListIdOptions, s as AssetClassification, st as Lens, t as AddHashListEntryOptions, tn as WaitForAssetDecisionOptions, tt as HashListEntryIdOptions, u as AssetContent, un as EventCategory, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vn as MetadataFieldsResource, vt as ListPoliciesOptions, w as AssetVisibility, wn as DetectedFace, wt as PolicyIdOptions, x as AssetType, xn as UploadPreset, xt as MoveFolderOptions, y as AssetSearchResult, yn as ProjectSettingsResource, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zn as AssetPreview, zt as SubmitAssetOptions } from "./CalmLensTypes-OWZsGvBX.js";
|
|
3
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-DzoSqUgG.js";
|
|
4
|
+
import { i as getAssetInfo, n as DEFAULT_CDN_BASE_URL, r as CDN_RESOURCES, t as SDK_VERSION } from "./index-BDxmVi-G.js";
|
|
5
|
+
import { A as CalmLensRateLimitError, C as CalmLensErrorKind, D as CalmLensNotFoundError, E as CalmLensInvalidResponseError, F as SdkErrorCode, I as ApiErrorCode, M as CalmLensTimeoutError, N as CalmLensUnprocessableEntityError, O as CalmLensPayloadTooLargeError, P as CalmLensWebhookVerificationError, S as CalmLensErrorDetails, T as CalmLensInvalidArgumentError, _ as CalmLensConfigurationError, a as AUTO_PAGING_TO_ARRAY_MAX, b as CalmLensError, c as CalmLensLastResponse, d as ListPromise, f as CALMLENS_ERROR_CODES, g as CalmLensCancelledError, h as CalmLensBadRequestError, i as ServedAssetInfo, j as CalmLensServerError, k as CalmLensPermissionDeniedError, l as CalmLensResponse, m as CalmLensAuthenticationError, o as AutoPaging, p as CalmLensApiError, r as CdnResponse, s as AutoPagingToArrayOptions, t as ReceivedWebhookEventPayload, u as ListPage, v as CalmLensConflictError, w as CalmLensErrorOptions, x as CalmLensErrorCode, y as CalmLensConnectionError } from "./WebhookPayload-CrMU6lg0.js";
|
|
6
6
|
export { AUTO_PAGING_TO_ARRAY_MAX, type AddHashListEntryOptions, type AgeRange, type ApiErrorCode, type AppInfo, type Asset, type AssetAvailability, type AssetBatchOperation, type AssetChecksums, type AssetChildrenPage, type AssetClassification, type AssetClassificationFailureReason, type AssetClassificationStatus, type AssetContent, type AssetContentOptions, type AssetContentRemovalReason, type AssetContentStatus, type AssetHls, type AssetHlsRendition, type AssetInfo, type AssetModeration, type AssetModerationDecision, type AssetModerationStatus, type AssetPage, type AssetPreview, type AssetRendered, type AssetRenderedKind, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetTimelinePage, type AssetTimelineSegment, type AssetType, type AssetUpload, type AssetUploadStatus, type AssetVisibility, type AssignPolicyOptions, type AutoPaging, type AutoPagingToArrayOptions, type BatchAssetsOptions, type BatchAssetsResponse, type BoundingBox, CALMLENS_ERROR_CODES, CDN_RESOURCES, CalmLensApiError, CalmLensAppClient, type CalmLensAppClientOptions, CalmLensAuthenticationError, CalmLensBadRequestError, CalmLensCancelledError, CalmLensConfigurationError, CalmLensConflictError, CalmLensConnectionError, CalmLensError, type CalmLensErrorCode, type CalmLensErrorDetails, type CalmLensErrorKind, type CalmLensErrorOptions, CalmLensInvalidArgumentError, CalmLensInvalidResponseError, type CalmLensLastResponse, CalmLensNotFoundError, CalmLensPayloadTooLargeError, CalmLensPermissionDeniedError, CalmLensRateLimitError, type CalmLensResponse, type CalmLensServerClientOptions, CalmLensServerError, CalmLensTimeoutError, CalmLensUnprocessableEntityError, CalmLensWebhookVerificationError, type CdnAssetLocation, type CdnAssetReference, type CdnAssetUrlOptions, type CdnResource, type CdnResponse, type CdnServeOptions, type CdnTransform, type ClassificationCategories, type ClassificationCategory, type ClassificationCategoryReport, type ClassificationNotEvaluatedReason, type ClassificationQualifierResults, type ClassifyTextOptions, type ClientRequestDefaults, type ConnectionOptions, type CreateFolderOptions, type CreateHashListOptions, type CreateLensOptions, type CreateMultipartUploadPartOptions, type CreatePolicyOptions, type CursorPage, DEFAULT_CDN_BASE_URL, type DecideAssetOptions, type DeleteAssetOptions, type DeleteMetadataFieldOptions, type DetectedFace, type DetectedPerson, type EnsureLensOptions, type EnsureLensesOptions, type EnsureMetadataFieldsOptions, type EnsureUploadPresetsOptions, type EnsureUploadPresetsResponse, type EventAsset, type EventCategory, type EventFact, type EventFactValues, type EventFacts, type EventSeverity, type EventType, type GetEventsResponse as EventsPage, type ExtractedText, type FileMetadata, type Folder, type FolderIdOptions, type FolderPage, type GetAssetInfoOptions, type HashList, type HashListEntry, type HashListEntryIdOptions, type HashListEntryPage, type HashListIdOptions, type HashListPage, type IdempotencyOptions, type ImageTransformOptions, type Lens, type LensIdOptions, type LensPage, type LensType, type Likelihood, type ListAssetChildrenOptions, type ListAssetTimelineOptions, type ListAssetsOptions, type ListEventsOptions, type ListFoldersOptions, type ListHashListEntriesOptions, type ListHashListsOptions, type ListLensesOptions, type ListPage, type ListPoliciesOptions, type ListPromise, type ListUploadPresetsOptions, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, type MetadataFieldsResource, type MetadataItem, type ModerationContext, type ModerationContextItem, type ModerationQualifier, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type Policy, type PolicyAction, type PolicyIdOptions, type PolicyPage, type ProcessingFeatureId, type ProcessingFeatureResults, type ProcessingFeatureStage, type ProcessingFeatures, type ProcessingOptions, type ProjectSettingsResource, type PublicProjectSettings, type RemoveAssetContentOptions, type RequestAttempt, type RequestOptions, type ResetPolicyOptions, type RetrieveAssetOptions, type RetryAssetOptions, SDK_VERSION, type SdkErrorCode, type SearchAssetsOptions, type ServedAssetInfo, type SetPolicyAutomaticUpdatesOptions, type SignAssetUrlOptions, type SignUploadTokenOptions, type SignedAssetUrl, type SignedUploadToken, type StreamingFeatureOptions, type SubmitAssetOptions, type TypedEvent, type UpdateAssetOptions, type UpdateFolderOptions, type UpdateHashListOptions, type UpdateLensOptions, type UpdatePolicyOptions, type UpdateProjectSettingsOptions, type UpgradePolicyOptions, type UploadAssetPartOptions, type UploadPreset, type UploadPresetDefinition, type UploadPresetIdOptions, type UploadPresetPage, type UploadPresetSubmitAssetOptions, type UploadedAsset, type VerifyWebhookSignatureOptions, type ViewerClaims, type WaitForAssetDecisionOptions, type ReceivedWebhookEventPayload as WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput, getAssetInfo, selectModerationContextItems };
|
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-
|
|
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-
|
|
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
|
-
import { i as AssetAvailability } from "./CalmLensTypes-
|
|
2
|
-
import { $ as
|
|
3
|
-
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-
|
|
4
|
-
import {
|
|
1
|
+
import { i as AssetAvailability } from "./CalmLensTypes-OWZsGvBX.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), `
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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,
|
|
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 {
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
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-
|
|
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), `
|
|
20
|
-
*
|
|
21
|
-
*
|
|
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(...
|
|
147
|
-
super(...
|
|
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(...
|
|
154
|
-
super(...
|
|
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(...
|
|
161
|
-
super(...
|
|
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")
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
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,
|
|
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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./Classification-CMM2tZpJ-IdIh63n0.js";
|
|
2
|
-
import { In as AssetInfo, N as CdnResource, et as GetAssetInfoOptions } from "./CalmLensTypes-
|
|
3
|
-
import "./WebhookPayload-
|
|
2
|
+
import { In as AssetInfo, N as CdnResource, et as GetAssetInfoOptions } from "./CalmLensTypes-OWZsGvBX.js";
|
|
3
|
+
import "./WebhookPayload-CrMU6lg0.js";
|
|
4
4
|
/** Every CDN resource beneath an asset URL, as `getAssetUrl` and `signAssetUrl` accept them. */
|
|
5
5
|
declare const CDN_RESOURCES: CdnResource[];
|
|
6
6
|
/**
|