calmlens 0.25.0 → 0.27.1
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 +15 -15
- package/bin/calmlens.js +2383 -677
- package/cjs/{BrowserUpload-AO2-2U5Z.js → BrowserUpload-CTqIjCV5.js} +1 -1
- package/{esm/BrowserUpload-D2lemMIU.d.ts → cjs/BrowserUpload-D4sEmd0X.d.ts} +2 -2
- package/{esm/CalmLensAppClient-Dt0t9Bk6.d.ts → cjs/CalmLensAppClient-CCeFnKX8.d.ts} +5 -11
- package/cjs/{CalmLensAppClient-nv6qwja0.js → CalmLensAppClient-CZm-9g22.js} +23 -16
- package/cjs/{CalmLensOptionKeys-BvCac9NO.js → CalmLensOptionKeys-C1w3SqmL.js} +165 -95
- package/cjs/CalmLensServerClient-B7PfocET.d.ts +346 -0
- package/cjs/{CalmLensServerClient-B60kCBCR.js → CalmLensServerClient-ucq3ITjd.js} +281 -315
- package/cjs/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-HUERg5hI.d.ts} +142 -155
- package/cjs/{Classification-CxRedzgH-C9qlYW_J.d.ts → Classification-CMM2tZpJ-IdIh63n0.d.ts} +6 -7
- package/cjs/{Core-Cw4IxFUq.js → Core-D-1KCqT7.js} +39 -16
- package/cjs/{Core-DSMxC2GL.d.ts → Core-DXAs8mcx.d.ts} +10 -3
- package/{esm/ModerationContextLimits-Bqr0duav.js → cjs/ModerationContextLimits-BcYKgU2X.js} +859 -44
- package/cjs/ReactUpload-BTciTpwB.d.ts +27 -0
- package/cjs/{ReactUpload--oDFltw2.js → ReactUpload-BymgWiC8.js} +38 -2
- package/cjs/{TestTriggers-CiFcTHX3-BmfH4J3f.js → TestTriggers-Cvi7e2KA-DcT1pc_W.js} +91 -22
- package/{esm/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts → cjs/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts} +1 -1
- package/cjs/{UploadController-ObdgTaBl.js → UploadController-C8GPbDKI.js} +16 -3
- package/{esm/WebhookPayload-DLGGOGW6.d.ts → cjs/WebhookPayload-mUmOFH55.d.ts} +152 -9
- package/cjs/app.d.ts +6 -6
- package/cjs/app.js +20 -2
- package/cjs/elements.d.ts +5 -5
- package/cjs/elements.js +105 -68
- package/cjs/{index-AAWuerkU.d.ts → index-Ck7x1YjM.d.ts} +3 -3
- package/cjs/index.d.ts +5 -5
- package/cjs/index.js +19 -1
- package/cjs/react-native.d.ts +3 -3
- package/cjs/react-native.js +7 -5
- package/cjs/react.d.ts +5 -4
- package/cjs/react.js +11 -15
- package/cjs/server.d.ts +6 -6
- package/cjs/server.js +20 -2
- package/cjs/test-inputs.d.ts +1 -1
- package/cjs/test-inputs.js +13 -13
- package/cjs/testing.d.ts +18 -21
- package/cjs/testing.js +99 -147
- package/cjs/{ui-CcuGKTcL.d.ts → ui-BfJNO3c6.d.ts} +2 -2
- package/cjs/{ui-CA16jyfZ.js → ui-CW8BqtZk.js} +7 -5
- package/cjs/ui.d.ts +3 -3
- package/cjs/ui.js +4 -3
- package/cjs/vue.d.ts +15 -8
- package/cjs/vue.js +30 -17
- package/esm/{BrowserUpload-Co4T6uGk.js → BrowserUpload-C01iLeOs.js} +1 -1
- package/{cjs/BrowserUpload-D2lemMIU.d.ts → esm/BrowserUpload-D4sEmd0X.d.ts} +2 -2
- package/{cjs/CalmLensAppClient-Dt0t9Bk6.d.ts → esm/CalmLensAppClient-CCeFnKX8.d.ts} +5 -11
- package/esm/{CalmLensAppClient-BRzy4dwn.js → CalmLensAppClient-CgDogQQC.js} +23 -16
- package/esm/{CalmLensOptionKeys-bE3rb5PN.js → CalmLensOptionKeys-CEwNbpEz.js} +160 -96
- package/esm/CalmLensServerClient-B7PfocET.d.ts +346 -0
- package/esm/{CalmLensServerClient-_PRi90wI.js → CalmLensServerClient-TT6zrAG5.js} +281 -315
- package/esm/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-HUERg5hI.d.ts} +142 -155
- package/esm/{Classification-CxRedzgH-C9qlYW_J.d.ts → Classification-CMM2tZpJ-IdIh63n0.d.ts} +6 -7
- package/esm/{Core-CtbYmeXG.js → Core-CP6NaqJz.js} +39 -16
- package/esm/{Core-DSMxC2GL.d.ts → Core-DXAs8mcx.d.ts} +10 -3
- package/{cjs/ModerationContextLimits-Cn9RvnZH.js → esm/ModerationContextLimits-BmV8QD32.js} +476 -301
- package/esm/{ReactUpload-B5itHBSF.js → ReactUpload-B72Oq3qE.js} +34 -4
- package/esm/ReactUpload-BTciTpwB.d.ts +27 -0
- package/esm/{TestTriggers-CiFcTHX3-BK2-sgOC.js → TestTriggers-Cvi7e2KA-BA83CRJb.js} +87 -23
- package/{cjs/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts → esm/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts} +1 -1
- package/esm/{UploadController-C7fL3Iz9.js → UploadController-Q7xTqh5w.js} +11 -4
- package/{cjs/WebhookPayload-DLGGOGW6.d.ts → esm/WebhookPayload-mUmOFH55.d.ts} +152 -9
- package/esm/app.d.ts +6 -6
- package/esm/app.js +3 -3
- package/esm/elements.d.ts +5 -5
- package/esm/elements.js +105 -69
- package/esm/{index-AAWuerkU.d.ts → index-Ck7x1YjM.d.ts} +3 -3
- package/esm/index.d.ts +5 -5
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +3 -3
- package/esm/react-native.js +6 -6
- package/esm/react.d.ts +5 -4
- package/esm/react.js +10 -16
- package/esm/server.d.ts +6 -6
- package/esm/server.js +3 -3
- package/esm/styles.css +37 -14
- package/esm/svelte/CalmLensAsset.svelte +1 -1
- package/esm/svelte/CalmLensUploader.svelte +17 -17
- package/esm/svelte/context.js +21 -0
- package/esm/svelte/index.d.ts +12 -0
- package/esm/svelte/index.js +1 -0
- package/esm/test-inputs.d.ts +1 -1
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +18 -21
- package/esm/testing.js +93 -141
- package/esm/{ui-B98AucZA.js → ui-BBDJJkFL.js} +7 -5
- package/esm/{ui-CcuGKTcL.d.ts → ui-BfJNO3c6.d.ts} +2 -2
- package/esm/ui.d.ts +3 -3
- package/esm/ui.js +4 -4
- package/esm/vue.d.ts +15 -8
- package/esm/vue.js +30 -19
- package/package.json +16 -6
- package/cjs/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
- package/cjs/ReactUpload-CW4NzAsh.d.ts +0 -17
- package/esm/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
- package/esm/ReactUpload-CW4NzAsh.d.ts +0 -17
|
@@ -1109,7 +1109,12 @@ declare const CLASSIFICATION_NOT_EVALUATED_REASON_SCHEMA: zod.ZodEnum<{
|
|
|
1109
1109
|
unavailable: "unavailable";
|
|
1110
1110
|
}>;
|
|
1111
1111
|
type ClassificationNotEvaluatedReason = zod.infer<typeof CLASSIFICATION_NOT_EVALUATED_REASON_SCHEMA>;
|
|
1112
|
-
|
|
1112
|
+
/**
|
|
1113
|
+
* Qualifier results keyed by qualifier. Keys from removed or renamed qualifiers are dropped rather
|
|
1114
|
+
* than failing the report; known keys are still validated. Typed as the strict schema: the filter
|
|
1115
|
+
* changes neither the accepted shape of known keys nor the JSON schema.
|
|
1116
|
+
*/
|
|
1117
|
+
declare const CLASSIFICATION_QUALIFIER_RESULTS_SCHEMA: zod.ZodRecord<zod.ZodEnum<{
|
|
1113
1118
|
"criminal-activity-alcohol": "criminal-activity-alcohol";
|
|
1114
1119
|
"criminal-activity-coded-incitement": "criminal-activity-coded-incitement";
|
|
1115
1120
|
"criminal-activity-csam": "criminal-activity-csam";
|
|
@@ -1266,12 +1271,6 @@ declare const STRICT_QUALIFIER_RESULTS_SCHEMA: zod.ZodRecord<zod.ZodEnum<{
|
|
|
1266
1271
|
unavailable: "unavailable";
|
|
1267
1272
|
}>;
|
|
1268
1273
|
}, zod.core.$strict>], "status">>;
|
|
1269
|
-
/**
|
|
1270
|
-
* Qualifier results keyed by qualifier. Keys from removed or renamed qualifiers are dropped rather
|
|
1271
|
-
* than failing the report; known keys are still validated. Typed as the strict schema: the filter
|
|
1272
|
-
* changes neither the accepted shape of known keys nor the JSON schema.
|
|
1273
|
-
*/
|
|
1274
|
-
declare const CLASSIFICATION_QUALIFIER_RESULTS_SCHEMA: typeof STRICT_QUALIFIER_RESULTS_SCHEMA;
|
|
1275
1274
|
type ClassificationQualifierResults = zod.infer<typeof CLASSIFICATION_QUALIFIER_RESULTS_SCHEMA>;
|
|
1276
1275
|
declare const CLASSIFICATION_CATEGORY_REPORT_SCHEMA: zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
1277
1276
|
status: zod.ZodLiteral<"evaluated">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Y as CalmLensError, a as appendAssetLocation, c as toUrlViewerClaims, s as getAssetInfo, v as serializeTransform, x as transformSelector } from "./ModerationContextLimits-BmV8QD32.js";
|
|
2
|
+
import { o as placeholderHashToDataURL } from "./UploadController-Q7xTqh5w.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). */
|
|
@@ -126,7 +126,8 @@ const VIEWER_STYLES = `
|
|
|
126
126
|
margin: 0 auto; padding: 20px 24px; max-width: 75ch; white-space: pre-wrap; overflow-wrap: anywhere;
|
|
127
127
|
font-family: inherit; font-size: 1rem; line-height: 1.6;
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
/* Fit to width, the page fills the viewer edge to edge; zoomed out, it sits centred. */
|
|
130
|
+
.calmlens-viewer__pages { flex: 1; min-height: 0; overflow: auto; text-align: center; }
|
|
130
131
|
.calmlens-viewer__page { display: inline-block; position: relative; vertical-align: top; }
|
|
131
132
|
.calmlens-viewer__page canvas { display: block; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.2); }
|
|
132
133
|
.calmlens-viewer__page-field { width: 4.5em; min-height: 36px; padding: 4px 6px; font: inherit; border: 1px solid var(--calmlens-border); border-radius: calc(var(--calmlens-radius) / 2); background: transparent; color: inherit; }
|
|
@@ -687,7 +688,8 @@ const CALMLENS_STYLES = `
|
|
|
687
688
|
}
|
|
688
689
|
.calmlens-uploader *, .calmlens-asset * { box-sizing: border-box; }
|
|
689
690
|
.calmlens-uploader { display: grid; gap: 12px; }
|
|
690
|
-
.calmlens-uploader > [hidden]
|
|
691
|
+
.calmlens-uploader > [hidden],
|
|
692
|
+
.calmlens-uploader .calmlens-upload [hidden] { display: none; }
|
|
691
693
|
.calmlens-dropzone {
|
|
692
694
|
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
|
|
693
695
|
padding: 40px 24px; text-align: center;
|
|
@@ -759,16 +761,31 @@ const CALMLENS_STYLES = `
|
|
|
759
761
|
.calmlens-upload__size { font-size: 0.875em; color: var(--calmlens-muted); }
|
|
760
762
|
.calmlens-upload__message { font-size: 0.875em; margin: 0; }
|
|
761
763
|
.calmlens-progress {
|
|
762
|
-
|
|
764
|
+
appearance: none; display: block; inline-size: 100%; block-size: 4px;
|
|
765
|
+
border: 0; border-radius: 2px; overflow: clip; background: var(--calmlens-border);
|
|
766
|
+
container-type: inline-size;
|
|
763
767
|
}
|
|
764
|
-
.calmlens-
|
|
765
|
-
|
|
766
|
-
|
|
768
|
+
.calmlens-progress::-webkit-progress-bar { background: transparent; }
|
|
769
|
+
.calmlens-progress::-webkit-progress-value {
|
|
770
|
+
background: var(--calmlens-accent); border-radius: 2px; animation: var(--calmlens-progress-animation, none);
|
|
767
771
|
}
|
|
768
|
-
.calmlens-progress
|
|
769
|
-
|
|
772
|
+
.calmlens-progress::-moz-progress-bar {
|
|
773
|
+
background: var(--calmlens-accent); border-radius: 2px; animation: var(--calmlens-progress-animation, none);
|
|
774
|
+
}
|
|
775
|
+
.calmlens-progress:indeterminate {
|
|
776
|
+
--calmlens-progress-animation: calmlens-indeterminate 1.1s ease-in-out infinite;
|
|
777
|
+
}
|
|
778
|
+
.calmlens-progress:indeterminate:where(:dir(rtl)) {
|
|
779
|
+
--calmlens-progress-animation: calmlens-indeterminate 1.1s ease-in-out infinite reverse;
|
|
780
|
+
}
|
|
781
|
+
@keyframes calmlens-indeterminate {
|
|
782
|
+
from, to { inline-size: 35%; margin-right: auto; }
|
|
783
|
+
from { translate: -100%; }
|
|
784
|
+
to { translate: 100cqi; }
|
|
785
|
+
}
|
|
786
|
+
@keyframes calmlens-indeterminate-still {
|
|
787
|
+
from, to { inline-size: 35%; margin-inline: auto; }
|
|
770
788
|
}
|
|
771
|
-
@keyframes calmlens-indeterminate { from { left: -35%; } to { left: 100%; } }
|
|
772
789
|
.calmlens-upload__actions { display: flex; gap: 8px; align-items: center; }
|
|
773
790
|
.calmlens-icon-button {
|
|
774
791
|
display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border-radius: 8px; cursor: pointer;
|
|
@@ -776,14 +793,18 @@ const CALMLENS_STYLES = `
|
|
|
776
793
|
}
|
|
777
794
|
.calmlens-icon-button:hover { background: color-mix(in srgb, var(--calmlens-accent) 8%, transparent); border-color: var(--calmlens-border); }
|
|
778
795
|
@media (prefers-reduced-motion: reduce) {
|
|
779
|
-
.calmlens-
|
|
780
|
-
.calmlens-progress:
|
|
796
|
+
.calmlens-dropzone, .calmlens-dropzone__icon, .calmlens-asset__content { transition: none; }
|
|
797
|
+
.calmlens-progress:indeterminate {
|
|
798
|
+
--calmlens-progress-animation: calmlens-indeterminate-still 1s both;
|
|
799
|
+
}
|
|
781
800
|
}
|
|
782
801
|
|
|
783
802
|
.calmlens-asset {
|
|
784
803
|
position: relative; display: block; overflow: hidden; margin: 0; border-radius: var(--calmlens-media-radius, 0);
|
|
785
804
|
background: var(--calmlens-surface);
|
|
786
805
|
}
|
|
806
|
+
/* The average colour stands in while the content loads; transparent content and notices show the surface. */
|
|
807
|
+
.calmlens-asset:not([data-state="loaded"], [data-state="error"], [data-kind="unavailable"]) { background-color: var(--calmlens-average-color, var(--calmlens-surface)); }
|
|
787
808
|
.calmlens-asset__placeholder, .calmlens-asset__content {
|
|
788
809
|
position: absolute; inset: 0; width: 100%; height: 100%; object-fit: var(--calmlens-fit, contain);
|
|
789
810
|
object-position: var(--calmlens-position, center);
|
|
@@ -798,8 +819,8 @@ const CALMLENS_STYLES = `
|
|
|
798
819
|
/* Documents, text and spreadsheets fill the box with their viewer; a document shows its first
|
|
799
820
|
page's still and an open link until the viewer loads. */
|
|
800
821
|
.calmlens-asset__viewer { position: absolute; inset: 0; }
|
|
801
|
-
|
|
802
|
-
.calmlens-asset:not([data-sized])[data-kind="spreadsheet"] { height: 480px; }
|
|
822
|
+
/* A default height only: any height the page gives the element (a class, a style) wins. */
|
|
823
|
+
:where(.calmlens-asset:not([data-sized]):is([data-kind="document"], [data-kind="text"], [data-kind="spreadsheet"])) { height: 480px; }
|
|
803
824
|
.calmlens-asset[data-kind="document"] .calmlens-asset__content { opacity: 1; }
|
|
804
825
|
.calmlens-asset__open { position: absolute; right: 8px; bottom: 8px; text-decoration: none; }
|
|
805
826
|
/* A website's screenshot scrolls beneath the link to its page. */
|
|
@@ -829,7 +850,9 @@ const CALMLENS_STYLES = `
|
|
|
829
850
|
}
|
|
830
851
|
.calmlens-asset__notice p { margin: 0; display: flex; gap: 6px; align-items: center; }
|
|
831
852
|
/* Thumbnails keep the notice's icon and leave its text to screen readers. */
|
|
832
|
-
|
|
853
|
+
/* A notice has no content of its own to size the box, so it can always measure its width. */
|
|
854
|
+
.calmlens-asset[data-sized], .calmlens-asset[data-kind="unavailable"], .calmlens-asset[data-kind="age-restricted"],
|
|
855
|
+
.calmlens-asset[data-state="error"] { container-type: inline-size; }
|
|
833
856
|
@container (max-width: 119px) {
|
|
834
857
|
.calmlens-asset__label, .calmlens-asset__notice > strong, .calmlens-asset__notice > p:not(:has(svg)) {
|
|
835
858
|
position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
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-HUERg5hI.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-CCeFnKX8.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.
|
|
@@ -592,6 +592,13 @@ declare class UploadController<F extends UploadFile = UploadFile> {
|
|
|
592
592
|
clear(): void;
|
|
593
593
|
}
|
|
594
594
|
declare const createUploadController: <F extends UploadFile = UploadFile>(options: UploadControllerOptions<F>) => UploadController<F>;
|
|
595
|
+
/**
|
|
596
|
+
* The upload options a provider (`CalmLensProvider`, `provideCalmLens`, `setCalmLensContext`)
|
|
597
|
+
* gives every uploader and upload hook beneath it.
|
|
598
|
+
*/
|
|
599
|
+
type CalmLensProvidedOptions<F extends UploadFile = UploadFile> = Pick<UploadControllerOptions<F>, "uploadPresetId" | "token" | "tokenUrl" | "baseUrl" | "createClient" | "upload" | "checkStatus">;
|
|
600
|
+
/** `options` over what a provider gives: an option an uploader sets (not `undefined`) wins. */
|
|
601
|
+
declare const withProvidedOptions: <O extends object>(provided: CalmLensProvidedOptions<any> | undefined, options: O) => O;
|
|
595
602
|
/**
|
|
596
603
|
* The text the components show. Pass `messages` to any component to replace some or all of it,
|
|
597
604
|
* for example to translate it. Keys other than the named ones are error codes, so you can give
|
|
@@ -824,4 +831,4 @@ declare const CALMLENS_THEME: {
|
|
|
824
831
|
* as the stylesheet mixes them from the page's text colour.
|
|
825
832
|
*/
|
|
826
833
|
declare const resolveTheme: (overrides?: Partial<CalmLensTheme>) => CalmLensTheme;
|
|
827
|
-
export {
|
|
834
|
+
export { getAssetAspectRatio as $, CustomUploadContext as A, isFileAccepted as B, formatMessage as C, resolveMessages as D, getUploadItemOutcome as E, UploadFile as F, AssetImageSource as G, AssetDisplay as H, UploadItem as I, AssetSessionState as J, AssetOptions as K, UploadSnapshot as L, UploadClient as M, UploadController as N, CalmLensProvidedOptions as O, UploadControllerOptions as P, MediaPlayback as Q, UploadStage as R, formatBytes as S, getUploadItemMessage as T, AssetDocumentOptions as U, withProvidedOptions as V, AssetImageOptions as W, AssetVideoOptions as X, AssetSpreadsheetOptions as Y, AssetView as Z, DEFAULT_MESSAGES as _, DEFAULT_VIEWER_MESSAGES as _t, ProgressFetchOptions as a, AssetViewerKind as at, describeUploadItem as b, resolveViewerMessages as bt, ICON_ATTRIBUTES as c, PdfAssetOptions as ct, AssetDisplayOptions as d, ViewerAsset as dt, getAssetView as et, AssetEventHandlers as f, ViewerOptions as ft, CalmLensMessages as g, isSpreadsheetFormat as gt, UploaderProps as h, getAssetViewerKind as ht, CALMLENS_STYLES as i, pickAssetSource as it, CustomUploadResult as j, CalmLensUpload as k, IconName as l, SpreadsheetViewerOptions as lt, UploaderDisplayOptions as m, WebsiteViewerOptions as mt, CalmLensTheme as n, getPeakHeights as nt, createProgressFetch as o, DocumentViewerOptions as ot, AssetProps as p, ViewerTextOptions as pt, AssetSession as q, resolveTheme as r, getPlayedPercent as rt, ICONS as s, ImageViewerOptions as st, CALMLENS_THEME as t, getAssetViewKey as tt, ASSET_FILE_ICON_SIZE as u, TextViewerOptions as ut, UploadItemView as v, ViewerMessages as vt, getDropzoneHint as w, describeUploader as x, UploaderView as y, formatViewerMessage as yt, createUploadController as z };
|