@calmlens/sdk 0.17.1 → 0.18.0
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 +46 -37
- package/bin/calmlens.js +16016 -0
- package/bin/package.json +1 -0
- package/{esm/BrowserUpload-uZjVFGfP.d.ts → cjs/BrowserUpload-BT091eOB.d.ts} +2 -2
- package/cjs/{BrowserUpload-DZ0Vbmxi.js → BrowserUpload-CQwXEGFv.js} +1 -1
- package/cjs/{CalmLensAppClient-DBGmaDlG.js → CalmLensAppClient-CHQGu-Do.js} +2 -2
- package/cjs/{CalmLensConnection-K1TAD1Z-.js → CalmLensConnection-B8Bu2j3y.js} +2 -2
- package/cjs/{CalmLensServerClient-C-pxiz0C.js → CalmLensServerClient-C5o2A8MW.js} +3 -3
- package/cjs/{ModerationContextLimits-Dj1YAl3G.js → ModerationContextLimits-DelWfmiJ.js} +1 -1
- package/cjs/{ReactUpload-nZahpmyg.d.ts → ReactUpload-CAyCsyG6.d.ts} +1 -1
- package/cjs/{ReactUpload-DxtFMr06.js → ReactUpload-Cfg5JYUq.js} +1 -1
- package/cjs/{TestTriggers-DcArt0Nu-CvoaONUB.js → TestTriggers-DTc_iMJF-BjMPq4_3.js} +10 -9
- package/cjs/{UploadController-BBkN4Ni6.js → UploadController-BGO1eyzb.js} +2 -2
- package/cjs/app.js +2 -2
- package/cjs/elements.d.ts +2 -2
- package/cjs/elements.js +3 -3
- package/cjs/index.js +1 -1
- package/cjs/react-native.d.ts +2 -2
- package/cjs/react-native.js +3 -3
- package/cjs/react.d.ts +2 -2
- package/cjs/react.js +4 -4
- package/cjs/server.js +2 -2
- package/cjs/test-inputs.js +9 -9
- package/cjs/testing.d.ts +1 -1
- package/cjs/testing.js +8 -8
- package/cjs/{ui-KceuoVCM.js → ui-CC1GOoMg.js} +4 -4
- package/{esm/ui-CgZpgpNo.d.ts → cjs/ui-wIiMfqMB.d.ts} +3 -3
- package/cjs/ui.d.ts +1 -1
- package/cjs/ui.js +2 -2
- package/cjs/vue.d.ts +2 -2
- package/cjs/vue.js +3 -3
- package/{cjs/BrowserUpload-uZjVFGfP.d.ts → esm/BrowserUpload-BT091eOB.d.ts} +2 -2
- package/esm/{BrowserUpload-D7-zNmc0.js → BrowserUpload-D2xBWqhm.js} +1 -1
- package/esm/{CalmLensAppClient-FVMwrHlH.js → CalmLensAppClient-DuFas_dW.js} +2 -2
- package/esm/{CalmLensConnection-iyNQHA8L.js → CalmLensConnection-MxwwLXdl.js} +2 -2
- package/esm/{CalmLensServerClient-fQEYKLw4.js → CalmLensServerClient-D80_mKpW.js} +3 -3
- package/esm/{ModerationContextLimits-D1x_WAtP.js → ModerationContextLimits-BaX2QnU8.js} +1 -1
- package/esm/{ReactUpload-nZahpmyg.d.ts → ReactUpload-CAyCsyG6.d.ts} +1 -1
- package/esm/{ReactUpload-D6yBCkcw.js → ReactUpload-CL2XC8WS.js} +1 -1
- package/esm/{TestTriggers-DcArt0Nu-s0AQZuWE.js → TestTriggers-DTc_iMJF-HfB533Gx.js} +10 -9
- package/esm/{UploadController-txp5NuzH.js → UploadController-qjoYGCwx.js} +2 -2
- package/esm/app.js +2 -2
- package/esm/elements.d.ts +2 -2
- package/esm/elements.js +3 -3
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +2 -2
- package/esm/react-native.js +3 -3
- package/esm/react.d.ts +2 -2
- package/esm/react.js +4 -4
- package/esm/server.js +2 -2
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +1 -1
- package/esm/testing.js +6 -6
- package/esm/{ui-Ca_SpJXf.js → ui-CCY3yXFn.js} +4 -4
- package/{cjs/ui-CgZpgpNo.d.ts → esm/ui-wIiMfqMB.d.ts} +3 -3
- package/esm/ui.d.ts +1 -1
- package/esm/ui.js +2 -2
- package/esm/vue.d.ts +2 -2
- package/esm/vue.js +3 -3
- package/package.json +9 -3
package/esm/react-native.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, F as UploadItem, G as MediaState, H as MediaOptions, I as UploadSnapshot, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, N as UploadControllerOptions, O as CalmLensUpload, P as UploadFile, R as createUploadController, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, f as UploaderProps, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-
|
|
2
|
-
import { n as useCalmLensUpload, t as UseCalmLensUploadResult } from "./ReactUpload-
|
|
1
|
+
import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, F as UploadItem, G as MediaState, H as MediaOptions, I as UploadSnapshot, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, N as UploadControllerOptions, O as CalmLensUpload, P as UploadFile, R as createUploadController, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, f as UploaderProps, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-wIiMfqMB.js";
|
|
2
|
+
import { n as useCalmLensUpload, t as UseCalmLensUploadResult } from "./ReactUpload-CAyCsyG6.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import { StyleProp, ViewStyle } from "react-native";
|
|
5
5
|
/** What the uploader asks your picker for. */
|
package/esm/react-native.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-
|
|
2
|
-
import { i as createProgressFetch, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-
|
|
1
|
+
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-CCY3yXFn.js";
|
|
2
|
+
import { i as createProgressFetch, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-qjoYGCwx.js";
|
|
3
3
|
import { a as getFileIcon, o as getFileIconLabel, t as FILE_ICON_COLORS } from "./FileIcons-M6dzjFxd.js";
|
|
4
|
-
import { n as useOwnController, r as useUploadSnapshot, t as useCalmLensUpload } from "./ReactUpload-
|
|
4
|
+
import { n as useOwnController, r as useUploadSnapshot, t as useCalmLensUpload } from "./ReactUpload-CL2XC8WS.js";
|
|
5
5
|
import { useMemo, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { Image, PixelRatio, Pressable, StyleSheet, Text, View } from "react-native";
|
package/esm/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, G as MediaState, H as MediaOptions, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, P as UploadFile, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-
|
|
2
|
-
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, o as UseCalmLensUploadResult, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-
|
|
1
|
+
import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, G as MediaState, H as MediaOptions, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, P as UploadFile, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-wIiMfqMB.js";
|
|
2
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, o as UseCalmLensUploadResult, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-BT091eOB.js";
|
|
3
3
|
import { CSSProperties, HTMLAttributes } from "react";
|
|
4
4
|
/**
|
|
5
5
|
* Uploads files through an upload preset and re-renders as each one uploads and is checked. Use
|
package/esm/react.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, n as CALMLENS_STYLES_ID, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-
|
|
3
|
-
import { i as createProgressFetch, r as isFileAccepted, t as UploadController } from "./UploadController-
|
|
4
|
-
import { n as useOwnController, r as useUploadSnapshot, t as useCalmLensUpload$1 } from "./ReactUpload-
|
|
5
|
-
import { t as createUploadController } from "./BrowserUpload-
|
|
2
|
+
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, n as CALMLENS_STYLES_ID, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-CCY3yXFn.js";
|
|
3
|
+
import { i as createProgressFetch, r as isFileAccepted, t as UploadController } from "./UploadController-qjoYGCwx.js";
|
|
4
|
+
import { n as useOwnController, r as useUploadSnapshot, t as useCalmLensUpload$1 } from "./ReactUpload-CL2XC8WS.js";
|
|
5
|
+
import { t as createUploadController } from "./BrowserUpload-D2xBWqhm.js";
|
|
6
6
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
// src/react.tsx
|
package/esm/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as CALMLENS_ERROR_CODES, O as CalmLensError, c as DEFAULT_CDN_BASE_URL, i as SDK_VERSION, n as MODERATION_CONTEXT_USED_ITEMS, r as selectModerationContextItems, t as MODERATION_CONTEXT_USED_CHARACTERS, u as getAssetUrl } from "./ModerationContextLimits-
|
|
1
|
+
import { D as CALMLENS_ERROR_CODES, O as CalmLensError, c as DEFAULT_CDN_BASE_URL, i as SDK_VERSION, n as MODERATION_CONTEXT_USED_ITEMS, r as selectModerationContextItems, t as MODERATION_CONTEXT_USED_CHARACTERS, u as getAssetUrl } from "./ModerationContextLimits-BaX2QnU8.js";
|
|
2
2
|
import "./index.js";
|
|
3
|
-
import { a as WEBHOOK_TIMESTAMP_HEADER, c as verifyWebhookSignature, i as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, n as WEBHOOK_DELIVERY_HEADER, o as isTestWebhookEvent, r as WEBHOOK_SIGNATURE_HEADER, s as parseWebhookEvent, t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
3
|
+
import { a as WEBHOOK_TIMESTAMP_HEADER, c as verifyWebhookSignature, i as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, n as WEBHOOK_DELIVERY_HEADER, o as isTestWebhookEvent, r as WEBHOOK_SIGNATURE_HEADER, s as parseWebhookEvent, t as CalmLensServerClient } from "./CalmLensServerClient-D80_mKpW.js";
|
|
4
4
|
export { CALMLENS_ERROR_CODES, CalmLensError, CalmLensServerClient, DEFAULT_CDN_BASE_URL, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, SDK_VERSION, WEBHOOK_DELIVERY_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, WEBHOOK_TIMESTAMP_HEADER, getAssetUrl, isTestWebhookEvent, parseWebhookEvent, selectModerationContextItems, verifyWebhookSignature };
|
package/esm/test-inputs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as TEST_INPUT_KEY_PATTERN, n as TEST_INPUT_PRESETS, r as detectTestImage, i as detectTestTrigger, a as generateTestTextCode, o as getImageTestCategories, c as paintTestImage, l as testInputForSignal } from "./TestTriggers-
|
|
1
|
+
export { t as TEST_INPUT_KEY_PATTERN, n as TEST_INPUT_PRESETS, r as detectTestImage, i as detectTestTrigger, a as generateTestTextCode, o as getImageTestCategories, c as paintTestImage, l as testInputForSignal } from "./TestTriggers-DTc_iMJF-HfB533Gx.js";
|
package/esm/testing.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { t as ClassificationTestSignal } from "./TestTriggers-By07LR31-CmK0yTyR.
|
|
|
6
6
|
import "zod";
|
|
7
7
|
/**
|
|
8
8
|
* Signs a single-use upload token with `apiKey`, locally. `CalmLensServerClient` and
|
|
9
|
-
* `MockCalmLensServerClient` share it so both check options the same way.
|
|
9
|
+
* `MockCalmLensServerClient` share it so both check options the same way. `calmlens/testing`
|
|
10
10
|
* exports it as `signUploadToken`, whose fixed `now` (milliseconds since the epoch) and `nonce`
|
|
11
11
|
* give the same token every time, for comparing with known tokens in tests.
|
|
12
12
|
*/
|
package/esm/testing.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { A as invalidArgument, C as MAX_IMAGE_UPLOAD_BYTES, E as isRejectedUploadMimeType, M as API_ERROR_CODES, N as API_ERROR_DEFINITIONS, O as CalmLensError, T as getRejectedUploadMimeTypeError, _ as validateAppClientOptions, b as validateServerClientOptions, f as randomUuid, j as invalidConfig, k as SDK_ERROR_CODES, r as selectModerationContextItems, w as MIN_MULTIPART_IMAGE_UPLOAD_BYTES } from "./ModerationContextLimits-
|
|
2
|
-
import { a as WEBHOOK_TIMESTAMP_HEADER, l as signUploadTokenWithApiKey, n as WEBHOOK_DELIVERY_HEADER, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient, u as stringifyJsonCanonical } from "./CalmLensServerClient-
|
|
3
|
-
import { d as assetDataToUint8Array, f as assetToData, n as MOCK_HOOKS, p as validateAssetPayload, u as sleep } from "./CalmLensConnection-
|
|
1
|
+
import { A as invalidArgument, C as MAX_IMAGE_UPLOAD_BYTES, E as isRejectedUploadMimeType, M as API_ERROR_CODES, N as API_ERROR_DEFINITIONS, O as CalmLensError, T as getRejectedUploadMimeTypeError, _ as validateAppClientOptions, b as validateServerClientOptions, f as randomUuid, j as invalidConfig, k as SDK_ERROR_CODES, r as selectModerationContextItems, w as MIN_MULTIPART_IMAGE_UPLOAD_BYTES } from "./ModerationContextLimits-BaX2QnU8.js";
|
|
2
|
+
import { a as WEBHOOK_TIMESTAMP_HEADER, l as signUploadTokenWithApiKey, n as WEBHOOK_DELIVERY_HEADER, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient, u as stringifyJsonCanonical } from "./CalmLensServerClient-D80_mKpW.js";
|
|
3
|
+
import { d as assetDataToUint8Array, f as assetToData, n as MOCK_HOOKS, p as validateAssetPayload, u as sleep } from "./CalmLensConnection-MxwwLXdl.js";
|
|
4
4
|
import { t as hmacSha256Hex } from "./CryptoUtils-B_x8lMIx-DhuWGzqn.js";
|
|
5
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
6
|
-
import { a as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-
|
|
7
|
-
import { s as getTestInputTag, u as CLASSIFICATION_CATEGORIES } from "./TestTriggers-
|
|
5
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-DuFas_dW.js";
|
|
6
|
+
import { a as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-qjoYGCwx.js";
|
|
7
|
+
import { s as getTestInputTag, u as CLASSIFICATION_CATEGORIES } from "./TestTriggers-DTc_iMJF-HfB533Gx.js";
|
|
8
8
|
import * as zod from "zod";
|
|
9
9
|
// src/contract/MediaTestTriggers.js
|
|
10
10
|
const MEDIA_TEST_SIGNALS = [...CLASSIFICATION_CATEGORIES, "violence.graphic"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as transformSelector, p as serializeTransform, u as getAssetUrl } from "./ModerationContextLimits-
|
|
1
|
+
import { g as transformSelector, p as serializeTransform, u as getAssetUrl } from "./ModerationContextLimits-BaX2QnU8.js";
|
|
2
2
|
import { t as EU_COUNTRIES } from "./Jurisdiction-FusEXb4U-1ov6m5yE.js";
|
|
3
|
-
import { a as placeholderHashToDataURL } from "./UploadController-
|
|
3
|
+
import { a as placeholderHashToDataURL } from "./UploadController-qjoYGCwx.js";
|
|
4
4
|
import { a as getFileIcon, c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
|
|
5
5
|
// src/ui/Icons.ts
|
|
6
6
|
/** Path data for the components' 24×24 stroke icons, so every framework draws the same ones. */
|
|
@@ -298,9 +298,9 @@ const resolveTheme = (overrides = {}) => {
|
|
|
298
298
|
};
|
|
299
299
|
// src/ui/Styles.ts
|
|
300
300
|
/**
|
|
301
|
-
* The components' stylesheet, also shipped as
|
|
301
|
+
* The components' stylesheet, also shipped as `calmlens/styles.css`. The React components
|
|
302
302
|
* render it themselves (React hoists it into the head, on the server too); with Vue, Svelte or
|
|
303
|
-
* the web components, import or link
|
|
303
|
+
* the web components, import or link `calmlens/styles.css` once. Nothing is added to the page
|
|
304
304
|
* at runtime. Theme it with the `--calmlens-*` custom properties, or leave it out and style the
|
|
305
305
|
* `calmlens-*` classes yourself.
|
|
306
306
|
*/
|
|
@@ -256,7 +256,7 @@ interface UploadControllerOptions<F extends UploadFile = UploadFile> {
|
|
|
256
256
|
baseUrl?: string;
|
|
257
257
|
/**
|
|
258
258
|
* Creates the client for each upload. Defaults to `CalmLensAppClient`; tests can return a
|
|
259
|
-
* `MockCalmLensAppClient` from
|
|
259
|
+
* `MockCalmLensAppClient` from `calmlens/testing` instead.
|
|
260
260
|
*/
|
|
261
261
|
createClient?: (options: CalmLensAppClientOptions) => UploadClient;
|
|
262
262
|
/**
|
|
@@ -477,9 +477,9 @@ declare const ICON_ATTRIBUTES: {
|
|
|
477
477
|
*/
|
|
478
478
|
declare const createProgressFetch: (onProgress: (sentBytes: number, totalBytes: number) => void) => ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>);
|
|
479
479
|
/**
|
|
480
|
-
* The components' stylesheet, also shipped as
|
|
480
|
+
* The components' stylesheet, also shipped as `calmlens/styles.css`. The React components
|
|
481
481
|
* render it themselves (React hoists it into the head, on the server too); with Vue, Svelte or
|
|
482
|
-
* the web components, import or link
|
|
482
|
+
* the web components, import or link `calmlens/styles.css` once. Nothing is added to the page
|
|
483
483
|
* at runtime. Theme it with the `--calmlens-*` custom properties, or leave it out and style the
|
|
484
484
|
* `calmlens-*` classes yourself.
|
|
485
485
|
*/
|
package/esm/ui.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, F as UploadItem, G as MediaState, H as MediaOptions, I as UploadSnapshot, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, N as UploadControllerOptions, O as CalmLensUpload, P as UploadFile, R as createUploadController, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, f as UploaderProps, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-
|
|
1
|
+
import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, F as UploadItem, G as MediaState, H as MediaOptions, I as UploadSnapshot, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, N as UploadControllerOptions, O as CalmLensUpload, P as UploadFile, R as createUploadController, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, f as UploaderProps, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-wIiMfqMB.js";
|
|
2
2
|
export { CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, type IconName, type MediaAsset, type MediaDisplayOptions, type MediaImageSource, type MediaOptions, type MediaProps, type MediaSettings, type MediaSource, type MediaState, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme };
|
package/esm/ui.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-
|
|
2
|
-
import { i as createProgressFetch, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-
|
|
1
|
+
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-CCY3yXFn.js";
|
|
2
|
+
import { i as createProgressFetch, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-qjoYGCwx.js";
|
|
3
3
|
export { CALMLENS_STYLES, CALMLENS_THEME, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, UploadController, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme };
|
package/esm/vue.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dt as ViewerClaims, k as CdnTransform, m as AssetModerationStatus, w as CalmLensAppClientOptions } from "./CalmLensTypes-9Vt16pc7.js";
|
|
2
2
|
import "./index-CI4BzN4W.js";
|
|
3
|
-
import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, G as MediaState, H as MediaOptions, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, P as UploadFile, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-
|
|
4
|
-
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-
|
|
3
|
+
import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, G as MediaState, H as MediaOptions, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, P as UploadFile, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-wIiMfqMB.js";
|
|
4
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-BT091eOB.js";
|
|
5
5
|
import { MaybeRefOrGetter, PropType, ShallowRef } from "vue";
|
|
6
6
|
export interface UseCalmLensUploadResult<F extends UploadFile = File> {
|
|
7
7
|
snapshot: Readonly<ShallowRef<UploadSnapshot<F>>>;
|
package/esm/vue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-
|
|
2
|
-
import { i as createProgressFetch, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-
|
|
3
|
-
import { t as createUploadController } from "./BrowserUpload-
|
|
1
|
+
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-CCY3yXFn.js";
|
|
2
|
+
import { i as createProgressFetch, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-qjoYGCwx.js";
|
|
3
|
+
import { t as createUploadController } from "./BrowserUpload-D2xBWqhm.js";
|
|
4
4
|
import { computed, defineComponent, h, onMounted, onScopeDispose, ref, shallowRef, toValue, watch, watchEffect } from "vue";
|
|
5
5
|
// src/vue.ts
|
|
6
6
|
const icon = (name) => h("svg", ICON_ATTRIBUTES, [h("path", { d: ICONS[name] })]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calmlens/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
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",
|
|
@@ -23,13 +23,18 @@
|
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=22"
|
|
25
25
|
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"calmlens": "bin/calmlens.js"
|
|
28
|
+
},
|
|
26
29
|
"scripts": {
|
|
27
30
|
"prepublishOnly": "npm run check && npm run test && npm run build",
|
|
28
31
|
"test": "bun test --parallel=4 ./tests/",
|
|
29
32
|
"check:fix": "tsc --noEmit --project tsconfig.json && npx @biomejs/biome check --write",
|
|
30
33
|
"check": "tsc --noEmit --project tsconfig.json && npx @biomejs/biome check",
|
|
31
34
|
"cleanup": "rimraf esm && rimraf cjs && rimraf bin",
|
|
32
|
-
"build": "npm run cleanup && rolldown -c rolldown.config.mjs && node scripts/post-build.js && npm run verify:package",
|
|
35
|
+
"build": "npm run cleanup && rolldown -c rolldown.config.mjs && node scripts/post-build.js && npm run build:cli && npm run verify:package",
|
|
36
|
+
"build:cli": "bun scripts/build-cli.ts",
|
|
37
|
+
"build:cli:binary": "bun scripts/build-cli.ts --binary",
|
|
33
38
|
"verify:package": "node scripts/verify-package.mjs"
|
|
34
39
|
},
|
|
35
40
|
"keywords": [
|
|
@@ -48,7 +53,8 @@
|
|
|
48
53
|
"LICENSE",
|
|
49
54
|
"README.md",
|
|
50
55
|
"esm/",
|
|
51
|
-
"cjs/"
|
|
56
|
+
"cjs/",
|
|
57
|
+
"bin/"
|
|
52
58
|
],
|
|
53
59
|
"devDependencies": {
|
|
54
60
|
"@biomejs/biome": "^2.6.3",
|