calmlens 0.27.4 → 0.27.6
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/README.md +2 -2
- package/bin/calmlens.js +26 -15
- package/cjs/{BrowserUpload-CFtjSpBI.d.ts → BrowserUpload-CdOfuIcV.d.ts} +2 -2
- package/cjs/{BrowserUpload-Ch9y2ZDx.js → BrowserUpload-GQtZti-D.js} +1 -1
- package/{esm/CalmLensAppClient-DzoSqUgG.d.ts → cjs/CalmLensAppClient-Btp8f-34.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-DGtj1vUV.js → CalmLensAppClient-Bwt3gP0C.js} +3 -3
- package/cjs/{CalmLensOptionKeys-DbL03fZj.js → CalmLensOptionKeys--gTpTkwt.js} +1 -1
- package/cjs/{CalmLensServerClient-D62AeRAi.js → CalmLensServerClient-BYMzGkQK.js} +7 -7
- package/cjs/{CalmLensServerClient-D3K5HS9v.d.ts → CalmLensServerClient-C3kaPLUZ.d.ts} +2 -2
- package/cjs/{CalmLensTypes-OWZsGvBX.d.ts → CalmLensTypes-DxxyZt2L.d.ts} +73 -5
- package/cjs/{Core-Cv2zLAJ-.js → Core-52DVaX7d.js} +63 -21
- package/{esm/Core-BXeXyiNv.d.ts → cjs/Core-Dhijt6JU.d.ts} +13 -14
- package/cjs/{CryptoUtils-B_x8lMIx-YBW1-bvL.js → CryptoUtils-BLCa-oZe-leCkr1ko.js} +1 -2
- package/cjs/{ModerationContextLimits-DjacyIkw.js → ModerationContextLimits-DJyIjzIn.js} +21 -3
- package/cjs/{ReactUpload-C47UrgH2.d.ts → ReactUpload-BuqLPgNr.d.ts} +1 -1
- package/cjs/{ReactUpload-CytoQTh_.js → ReactUpload-DHuhGYsr.js} +1 -1
- package/cjs/{TestTriggers-Cvi7e2KA-DcT1pc_W.js → TestTriggers-DP4m92jg-C0HD-A4r.js} +14 -14
- package/cjs/{UploadController-fpTC5TUO.js → UploadController-ChzDPMmm.js} +2 -2
- package/{esm/WebhookPayload-CrMU6lg0.d.ts → cjs/WebhookPayload-D_yWJA9M.d.ts} +5 -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-BDxmVi-G.d.ts → index-CUA-HDNu.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/test-inputs.js +13 -13
- package/cjs/testing.d.ts +4 -4
- package/cjs/testing.js +54 -32
- package/cjs/{ui-5IdEYYpC.d.ts → ui-BSm_qphN.d.ts} +3 -9
- package/cjs/{ui-BvyDbJBb.js → ui-C1_SDSiq.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-BE8OVeBC.js → BrowserUpload-BaKFKEBz.js} +1 -1
- package/esm/{BrowserUpload-CFtjSpBI.d.ts → BrowserUpload-CdOfuIcV.d.ts} +2 -2
- package/{cjs/CalmLensAppClient-DzoSqUgG.d.ts → esm/CalmLensAppClient-Btp8f-34.d.ts} +2 -2
- package/esm/{CalmLensAppClient-C1cpQEYR.js → CalmLensAppClient-DM6c3pGC.js} +3 -3
- package/esm/{CalmLensOptionKeys-DoCKKuLT.js → CalmLensOptionKeys-CKZs8i3_.js} +1 -1
- package/esm/{CalmLensServerClient-D3K5HS9v.d.ts → CalmLensServerClient-C3kaPLUZ.d.ts} +2 -2
- package/esm/{CalmLensServerClient-CSCrJ7wX.js → CalmLensServerClient-Da2UfUo4.js} +3 -3
- package/esm/{CalmLensTypes-OWZsGvBX.d.ts → CalmLensTypes-DxxyZt2L.d.ts} +73 -5
- package/{cjs/Core-BXeXyiNv.d.ts → esm/Core-Dhijt6JU.d.ts} +13 -14
- package/esm/{Core-Df2PSa1n.js → Core-kYMRW5C1.js} +52 -22
- package/esm/{CryptoUtils-B_x8lMIx-DhuWGzqn.js → CryptoUtils-BLCa-oZe-DKr3LmN6.js} +1 -2
- package/esm/{ModerationContextLimits-tu_PY4fn.js → ModerationContextLimits-ZIlK9n2X.js} +21 -3
- package/esm/{ReactUpload-C47UrgH2.d.ts → ReactUpload-BuqLPgNr.d.ts} +1 -1
- package/esm/{ReactUpload-BsbisXS6.js → ReactUpload-CipY3cmO.js} +1 -1
- package/esm/{TestTriggers-Cvi7e2KA-BA83CRJb.js → TestTriggers-DP4m92jg-DhOI4S1V.js} +11 -11
- package/esm/{UploadController-Dqjf23bS.js → UploadController-D-14HWII.js} +2 -2
- package/{cjs/WebhookPayload-CrMU6lg0.d.ts → esm/WebhookPayload-D_yWJA9M.d.ts} +5 -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-BDxmVi-G.d.ts → index-CUA-HDNu.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/test-inputs.js +1 -1
- package/esm/testing.d.ts +4 -4
- package/esm/testing.js +45 -23
- package/esm/{ui-5IdEYYpC.d.ts → ui-BSm_qphN.d.ts} +3 -9
- package/esm/{ui-DF7-9mB3.js → ui-CgIG3knW.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
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-DxxyZt2L.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-Dhijt6JU.js";
|
|
3
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-CdOfuIcV.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-BSm_qphN.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-CgIG3knW.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-kYMRW5C1.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-D-14HWII.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-BaKFKEBz.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-DxxyZt2L.js";
|
|
3
|
+
import "./WebhookPayload-D_yWJA9M.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
|
/**
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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 { i as getAssetInfo, n as DEFAULT_CDN_BASE_URL, r as CDN_RESOURCES, t as SDK_VERSION } from "./index-
|
|
4
|
-
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-DxxyZt2L.js";
|
|
3
|
+
import { i as getAssetInfo, n as DEFAULT_CDN_BASE_URL, r as CDN_RESOURCES, t as SDK_VERSION } from "./index-CUA-HDNu.js";
|
|
4
|
+
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-D_yWJA9M.js";
|
|
5
5
|
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, 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/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-
|
|
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-ZIlK9n2X.js";
|
package/esm/react-native.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { i as useCalmLensUpload, n as CalmLensProviderProps, r as UseCalmLensUploadResult, t as CalmLensProvider } from "./ReactUpload-
|
|
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-Dhijt6JU.js";
|
|
2
|
+
import { i as useCalmLensUpload, n as CalmLensProviderProps, r as UseCalmLensUploadResult, t as CalmLensProvider } from "./ReactUpload-BuqLPgNr.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 };
|
package/esm/react-native.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as appendAssetLocation } from "./ModerationContextLimits-
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
1
|
+
import { a as appendAssetLocation } from "./ModerationContextLimits-ZIlK9n2X.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-kYMRW5C1.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-D-14HWII.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-
|
|
5
|
+
import { i as useUploadSnapshot, n as useCalmLensUpload, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-CipY3cmO.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
|
|
2
|
-
import { n as CalmLensProviderProps, t as CalmLensProvider } from "./ReactUpload-
|
|
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-
|
|
4
|
-
import {
|
|
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-Dhijt6JU.js";
|
|
2
|
+
import { n as CalmLensProviderProps, t as CalmLensProvider } from "./ReactUpload-BuqLPgNr.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-CdOfuIcV.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-BSm_qphN.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,
|
|
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 };
|
package/esm/react.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
2
|
+
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-CgIG3knW.js";
|
|
3
|
+
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, n as CALMLENS_STYLES_ID, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-kYMRW5C1.js";
|
|
4
|
+
import { a as createProgressFetch, i as withProvidedOptions, r as isFileAccepted, t as UploadController } from "./UploadController-D-14HWII.js";
|
|
5
5
|
import { c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
|
|
6
|
-
import { i as useUploadSnapshot, n as useCalmLensUpload$1, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-
|
|
7
|
-
import { t as createUploadController } from "./BrowserUpload-
|
|
8
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { i as useUploadSnapshot, n as useCalmLensUpload$1, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-CipY3cmO.js";
|
|
7
|
+
import { t as createUploadController } from "./BrowserUpload-BaKFKEBz.js";
|
|
8
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
const OPTION_NAMES = /* @__PURE__ */ new Set([
|
|
11
11
|
"src",
|
|
@@ -15,7 +15,6 @@ const OPTION_NAMES = /* @__PURE__ */ new Set([
|
|
|
15
15
|
"viewerClaims",
|
|
16
16
|
"label",
|
|
17
17
|
"messages",
|
|
18
|
-
"sizes",
|
|
19
18
|
"text",
|
|
20
19
|
"getText",
|
|
21
20
|
"pageSize",
|
|
@@ -61,20 +60,6 @@ function Viewer({ kind, props }) {
|
|
|
61
60
|
"data-kind": kind
|
|
62
61
|
})] });
|
|
63
62
|
}
|
|
64
|
-
/** Shows an image asset's rendered file, fitted to the element, over its placeholder. */
|
|
65
|
-
function CalmLensImageViewer(props) {
|
|
66
|
-
return /* @__PURE__ */ jsx(Viewer, {
|
|
67
|
-
kind: "image",
|
|
68
|
-
props
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/** Shows a website asset's screenshot with a link to the original page. */
|
|
72
|
-
function CalmLensWebsiteViewer(props) {
|
|
73
|
-
return /* @__PURE__ */ jsx(Viewer, {
|
|
74
|
-
kind: "website",
|
|
75
|
-
props
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
63
|
/** Shows a text asset's text, escaped, in a scrolling region. */
|
|
79
64
|
function CalmLensTextViewer(props) {
|
|
80
65
|
return /* @__PURE__ */ jsx(Viewer, {
|
|
@@ -287,6 +272,7 @@ function CalmLensUploader({ disabled, capture, messages: overrides, unstyled, co
|
|
|
287
272
|
]
|
|
288
273
|
});
|
|
289
274
|
}
|
|
275
|
+
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
290
276
|
/** Audio's waveform: the preview still, with the played part of its peaks drawn over it. */
|
|
291
277
|
const Waveform = ({ url, peaks, played }) => {
|
|
292
278
|
if (!url && !peaks) return null;
|
|
@@ -356,14 +342,17 @@ function CalmLensAsset(props) {
|
|
|
356
342
|
const loadKey = getAssetViewKey(view);
|
|
357
343
|
const [load, setLoad] = useState({
|
|
358
344
|
key: loadKey,
|
|
359
|
-
state: "loading"
|
|
345
|
+
state: "loading",
|
|
346
|
+
instant: false
|
|
360
347
|
});
|
|
361
348
|
const current = load.key === loadKey ? load : {
|
|
362
349
|
key: loadKey,
|
|
363
|
-
state: "loading"
|
|
350
|
+
state: "loading",
|
|
351
|
+
instant: false
|
|
364
352
|
};
|
|
365
353
|
const [played, setPlayed] = useState(0);
|
|
366
354
|
const imageRef = useRef(null);
|
|
355
|
+
const loadStartedAt = useRef(0);
|
|
367
356
|
const media = useRef(null);
|
|
368
357
|
const viewerRoot = useRef(null);
|
|
369
358
|
const callbacks = useRef({
|
|
@@ -378,16 +367,18 @@ function CalmLensAsset(props) {
|
|
|
378
367
|
};
|
|
379
368
|
useEffect(() => setMounted(true), []);
|
|
380
369
|
useEffect(() => session.load());
|
|
381
|
-
|
|
382
|
-
|
|
370
|
+
useIsomorphicLayoutEffect(() => {
|
|
371
|
+
loadStartedAt.current = performance.now();
|
|
372
|
+
if (isImageReady(imageRef.current)) setLoad({
|
|
383
373
|
key: loadKey,
|
|
384
|
-
state: "loaded"
|
|
374
|
+
state: "loaded",
|
|
375
|
+
instant: true
|
|
385
376
|
});
|
|
386
377
|
}, [loadKey]);
|
|
387
378
|
useEffect(() => {
|
|
388
379
|
if (current.state === "loaded") callbacks.current.onLoad?.();
|
|
389
380
|
if (current.state === "error") callbacks.current.onError?.();
|
|
390
|
-
}, [current.state]);
|
|
381
|
+
}, [current.key, current.state]);
|
|
391
382
|
const availability = view.kind === "unavailable" ? "unavailable" : view.kind === "age-restricted" ? "age-restricted" : view.kind === "pending" ? void 0 : "available";
|
|
392
383
|
useEffect(() => {
|
|
393
384
|
if (availability) callbacks.current.onAvailabilityChange?.(availability);
|
|
@@ -397,7 +388,8 @@ function CalmLensAsset(props) {
|
|
|
397
388
|
viewers.update(viewerRoot.current, viewerKind, getMountedViewerOptions(options, session), (viewerState) => {
|
|
398
389
|
if (viewerState !== "loading") setLoad({
|
|
399
390
|
key: loadKey,
|
|
400
|
-
state: viewerState
|
|
391
|
+
state: viewerState,
|
|
392
|
+
instant: false
|
|
401
393
|
});
|
|
402
394
|
});
|
|
403
395
|
});
|
|
@@ -405,7 +397,7 @@ function CalmLensAsset(props) {
|
|
|
405
397
|
useEffect(() => streams.update(media.current, view));
|
|
406
398
|
useEffect(() => () => streams.stop(), [streams]);
|
|
407
399
|
const ratio = getAssetAspectRatio(view, state.info, aspectRatio);
|
|
408
|
-
const placeholderUrl = "placeholderUrl" in view && (view.kind === "age-restricted" || view.kind === "pending" || current.state !== "loaded") ? view.placeholderUrl : void 0;
|
|
400
|
+
const placeholderUrl = "placeholderUrl" in view && (view.kind === "age-restricted" || view.kind === "pending" || current.state !== "error" && !(current.state === "loaded" && current.instant)) ? view.placeholderUrl : void 0;
|
|
409
401
|
const onMediaError = (element) => {
|
|
410
402
|
if (streams.recover(element)) return;
|
|
411
403
|
session.mediaFailed({
|
|
@@ -418,7 +410,8 @@ function CalmLensAsset(props) {
|
|
|
418
410
|
session.mediaLoaded(event.currentTarget);
|
|
419
411
|
setLoad({
|
|
420
412
|
key: loadKey,
|
|
421
|
-
state: "loaded"
|
|
413
|
+
state: "loaded",
|
|
414
|
+
instant: false
|
|
422
415
|
});
|
|
423
416
|
},
|
|
424
417
|
onError: (event) => onMediaError(event.currentTarget),
|
|
@@ -435,7 +428,7 @@ function CalmLensAsset(props) {
|
|
|
435
428
|
className: "calmlens-asset__content",
|
|
436
429
|
src: shown.src,
|
|
437
430
|
srcSet: shown.srcSet,
|
|
438
|
-
sizes: shown.srcSet ? image?.sizes : void 0,
|
|
431
|
+
sizes: shown.srcSet ? image?.sizes ?? (lazy ? "auto, 100vw" : "100vw") : void 0,
|
|
439
432
|
alt,
|
|
440
433
|
width: shown.width,
|
|
441
434
|
height: shown.height,
|
|
@@ -444,9 +437,10 @@ function CalmLensAsset(props) {
|
|
|
444
437
|
fetchPriority,
|
|
445
438
|
onLoad: () => {
|
|
446
439
|
session.loaded();
|
|
447
|
-
setLoad({
|
|
440
|
+
setLoad((prev) => prev.key === loadKey && prev.state === "loaded" ? prev : {
|
|
448
441
|
key: loadKey,
|
|
449
|
-
state: "loaded"
|
|
442
|
+
state: "loaded",
|
|
443
|
+
instant: performance.now() - loadStartedAt.current < 50
|
|
450
444
|
});
|
|
451
445
|
},
|
|
452
446
|
onError: () => session.failed()
|
|
@@ -456,6 +450,7 @@ function CalmLensAsset(props) {
|
|
|
456
450
|
className: joinClassNames("calmlens-asset", className),
|
|
457
451
|
"data-kind": view.kind,
|
|
458
452
|
"data-state": current.state,
|
|
453
|
+
"data-instant": current.instant ? "" : void 0,
|
|
459
454
|
"data-sized": ratio ? "" : void 0,
|
|
460
455
|
"aria-busy": view.kind === "pending" ? true : void 0,
|
|
461
456
|
style: {
|
|
@@ -570,4 +565,4 @@ function CalmLensAsset(props) {
|
|
|
570
565
|
]
|
|
571
566
|
});
|
|
572
567
|
}
|
|
573
|
-
export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, CalmLensAsset, CalmLensDocumentViewer,
|
|
568
|
+
export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, CalmLensAsset, CalmLensDocumentViewer, CalmLensProvider, CalmLensSpreadsheetViewer, CalmLensTextViewer, CalmLensUploader, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, MediaStreamPlayer, UploadController, VIEWER_STYLES, createDocumentViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isImageReady, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, useCalmLensUpload, withProvidedOptions };
|