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
package/esm/vue.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
|
import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, onScopeDispose, provide, ref, shallowRef, toValue, watch, watchEffect } from "vue";
|
|
7
7
|
// src/viewers/Vue.ts
|
|
8
8
|
const optional$1 = (type) => ({
|
|
@@ -28,8 +28,6 @@ const viewer = (name, kind) => defineComponent({
|
|
|
28
28
|
viewerClaims: optional$1(Object),
|
|
29
29
|
label: optional$1(String),
|
|
30
30
|
messages: optional$1(Object),
|
|
31
|
-
/** Images: the `sizes` of a public image's responsive widths. */
|
|
32
|
-
sizes: optional$1(String),
|
|
33
31
|
/** Text and spreadsheets: text your app already has. */
|
|
34
32
|
text: optional$1(String),
|
|
35
33
|
/** Text and spreadsheets: reads the text yourself. */
|
|
@@ -60,10 +58,6 @@ const viewer = (name, kind) => defineComponent({
|
|
|
60
58
|
});
|
|
61
59
|
}
|
|
62
60
|
});
|
|
63
|
-
/** Shows an image asset's rendered file, fitted to the element, over its placeholder. */
|
|
64
|
-
const CalmLensImageViewer = viewer("CalmLensImageViewer", "image");
|
|
65
|
-
/** Shows a website asset's screenshot with a link to the original page. */
|
|
66
|
-
const CalmLensWebsiteViewer = viewer("CalmLensWebsiteViewer", "website");
|
|
67
61
|
/** Shows a text asset's text, escaped, in a scrolling region. */
|
|
68
62
|
const CalmLensTextViewer = viewer("CalmLensTextViewer", "text");
|
|
69
63
|
/** Shows a PDF, or a document rendered as one, a page at a time with pdf.js (loaded lazily). */
|
|
@@ -409,6 +403,8 @@ const CalmLensAsset = defineComponent({
|
|
|
409
403
|
const view = computed(() => getAssetView(options.value, state.value));
|
|
410
404
|
const loadKey = computed(() => getAssetViewKey(view.value));
|
|
411
405
|
const load = ref("loading");
|
|
406
|
+
const instant = ref(false);
|
|
407
|
+
let loadStartedAt = 0;
|
|
412
408
|
const played = ref(0);
|
|
413
409
|
const mounted = ref(false);
|
|
414
410
|
const image = ref();
|
|
@@ -445,7 +441,16 @@ const CalmLensAsset = defineComponent({
|
|
|
445
441
|
});
|
|
446
442
|
watch(loadKey, () => {
|
|
447
443
|
load.value = "loading";
|
|
444
|
+
instant.value = false;
|
|
448
445
|
});
|
|
446
|
+
watch([loadKey, image], () => {
|
|
447
|
+
if (!image.value) return;
|
|
448
|
+
loadStartedAt = performance.now();
|
|
449
|
+
if (isImageReady(image.value)) {
|
|
450
|
+
instant.value = true;
|
|
451
|
+
load.value = "loaded";
|
|
452
|
+
}
|
|
453
|
+
}, { flush: "post" });
|
|
449
454
|
watch(load, (value) => {
|
|
450
455
|
if (value === "loaded") emit("load");
|
|
451
456
|
if (value === "error") emit("error");
|
|
@@ -456,7 +461,11 @@ const CalmLensAsset = defineComponent({
|
|
|
456
461
|
}, { immediate: true });
|
|
457
462
|
onMounted(() => {
|
|
458
463
|
mounted.value = true;
|
|
459
|
-
|
|
464
|
+
loadStartedAt = performance.now();
|
|
465
|
+
if (isImageReady(image.value)) {
|
|
466
|
+
instant.value = true;
|
|
467
|
+
load.value = "loaded";
|
|
468
|
+
}
|
|
460
469
|
});
|
|
461
470
|
const onMediaError = (event) => {
|
|
462
471
|
const element = event.target;
|
|
@@ -480,7 +489,7 @@ const CalmLensAsset = defineComponent({
|
|
|
480
489
|
const current = view.value;
|
|
481
490
|
const text = messages.value;
|
|
482
491
|
const ratio = getAssetAspectRatio(current, state.value.info, props.aspectRatio);
|
|
483
|
-
const placeholderUrl = "placeholderUrl" in current && (current.kind === "age-restricted" || current.kind === "pending" || load.value !== "loaded") ? current.placeholderUrl : void 0;
|
|
492
|
+
const placeholderUrl = "placeholderUrl" in current && (current.kind === "age-restricted" || current.kind === "pending" || load.value !== "error" && !(load.value === "loaded" && instant.value)) ? current.placeholderUrl : void 0;
|
|
484
493
|
const notice = (children) => h("figcaption", { class: "calmlens-asset__notice" }, children);
|
|
485
494
|
const video = props.video ?? {};
|
|
486
495
|
const imageElement = (shown) => h("img", {
|
|
@@ -489,7 +498,7 @@ const CalmLensAsset = defineComponent({
|
|
|
489
498
|
class: "calmlens-asset__content",
|
|
490
499
|
src: shown.src,
|
|
491
500
|
srcset: shown.srcSet,
|
|
492
|
-
sizes: shown.srcSet ? props.image?.sizes : void 0,
|
|
501
|
+
sizes: shown.srcSet ? props.image?.sizes ?? (props.lazy ? "auto, 100vw" : "100vw") : void 0,
|
|
493
502
|
alt: props.alt,
|
|
494
503
|
width: shown.width,
|
|
495
504
|
height: shown.height,
|
|
@@ -498,6 +507,8 @@ const CalmLensAsset = defineComponent({
|
|
|
498
507
|
fetchpriority: props.fetchPriority,
|
|
499
508
|
onLoad: () => {
|
|
500
509
|
session.loaded();
|
|
510
|
+
if (load.value === "loaded") return;
|
|
511
|
+
instant.value = performance.now() - loadStartedAt < 50;
|
|
501
512
|
load.value = "loaded";
|
|
502
513
|
},
|
|
503
514
|
onError: () => session.failed()
|
|
@@ -508,6 +519,7 @@ const CalmLensAsset = defineComponent({
|
|
|
508
519
|
class: "calmlens-asset",
|
|
509
520
|
"data-kind": current.kind,
|
|
510
521
|
"data-state": load.value,
|
|
522
|
+
"data-instant": instant.value ? "" : void 0,
|
|
511
523
|
"data-sized": ratio ? "" : void 0,
|
|
512
524
|
"aria-busy": current.kind === "pending" ? "true" : void 0,
|
|
513
525
|
style: {
|
|
@@ -605,4 +617,4 @@ const CalmLensAsset = defineComponent({
|
|
|
605
617
|
};
|
|
606
618
|
}
|
|
607
619
|
});
|
|
608
|
-
export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, CalmLensAsset, CalmLensDocumentViewer,
|
|
620
|
+
export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, CalmLensAsset, CalmLensDocumentViewer, 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, provideCalmLens, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, useCalmLensUpload, withProvidedOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "calmlens",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.5",
|
|
4
4
|
"description": "Official CalmLens SDK for JavaScript and TypeScript: content moderation, asset storage and CDN delivery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://calmlens.com/docs/sdk/javascript",
|