calmlens 0.19.0 → 0.21.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 +13 -9
- package/bin/calmlens.js +1646 -706
- package/cjs/{BrowserUpload-CJ4Xc9bR.js → BrowserUpload-CeSwiMo5.js} +1 -1
- package/{esm/BrowserUpload-RkxV_Vv7.d.ts → cjs/BrowserUpload-D-NnAN7g.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-LHMEQ-UZ.js → CalmLensAppClient-0UVCuNqW.js} +30 -10
- package/cjs/{CalmLensAppClient-B5gfOB6J.d.ts → CalmLensAppClient-gG16T2py.d.ts} +13 -3
- package/cjs/{CalmLensOptionKeys-BUj7v5AG.js → CalmLensOptionKeys-CYY6elxg.js} +242 -345
- package/cjs/{CalmLensServerClient-DCSbwIBs.d.ts → CalmLensServerClient-BHx3x_nZ.d.ts} +107 -49
- package/cjs/{CalmLensServerClient-BVOEUT_v.js → CalmLensServerClient-nfu6_YEW.js} +297 -92
- package/cjs/{CalmLensTypes-DpU-hXq2.d.ts → CalmLensTypes-CUB0YYVz.d.ts} +26601 -27354
- package/cjs/{Classification-D3SkprrQ-CMnQKW13.d.ts → Classification-Q5zGpR8l-CEWjnE39.d.ts} +731 -607
- package/cjs/Core-C82YmjjX.d.ts +823 -0
- package/cjs/Core-Dc3cteU7.js +998 -0
- package/cjs/FileIcons-4qSX7DW2.d.ts +67 -0
- package/cjs/{ModerationContextLimits-FDpQmw_T.js → ModerationContextLimits-BxOmeSqq.js} +970 -278
- package/cjs/{ReactUpload-BvpW4hJi.js → ReactUpload-BK2O3dnK.js} +1 -1
- package/cjs/{ReactUpload-huIMnOJ4.d.ts → ReactUpload-DiiXfKvj.d.ts} +1 -1
- package/cjs/{TestTriggers-CMwMrbjy-K0YBzu2a.js → TestTriggers-BTyXtX0Q-ATuFDhLX.js} +343 -35
- package/{esm/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts → cjs/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts} +146 -8
- package/cjs/{UploadController-D4qOZZc3.js → UploadController-DLyiLDTB.js} +34 -14
- package/cjs/{WebhookPayload-CQg8BBZQ.d.ts → WebhookPayload-BLT2y_Jy.d.ts} +93 -86
- package/cjs/app.d.ts +6 -7
- package/cjs/app.js +4 -3
- package/cjs/elements.d.ts +123 -22
- package/cjs/elements.js +553 -156
- package/cjs/file-icons.d.ts +2 -67
- package/cjs/index-CKRgjV16.d.ts +16 -0
- package/cjs/index.d.ts +5 -6
- package/cjs/index.js +3 -2
- package/cjs/react-native.d.ts +52 -11
- package/cjs/react-native.js +231 -99
- package/cjs/react.d.ts +42 -9
- package/cjs/react.js +381 -118
- package/cjs/server.d.ts +48 -7
- package/cjs/server.js +7 -3
- package/cjs/test-inputs.d.ts +2 -2
- package/cjs/test-inputs.js +13 -9
- package/cjs/testing.d.ts +29 -16
- package/cjs/testing.js +1511 -397
- package/cjs/ui-CTBUxnVp.d.ts +139 -0
- package/cjs/ui-CZ8exACq.js +1359 -0
- package/cjs/ui.d.ts +3 -2
- package/cjs/ui.js +45 -22
- package/cjs/vue.d.ts +802 -199
- package/cjs/vue.js +359 -127
- package/{cjs/BrowserUpload-RkxV_Vv7.d.ts → esm/BrowserUpload-D-NnAN7g.d.ts} +2 -2
- package/esm/{BrowserUpload-DpzS2bbj.js → BrowserUpload-i9OhCzMJ.js} +1 -1
- package/esm/{CalmLensAppClient-BjlvBweS.js → CalmLensAppClient-CK4_Py0c.js} +30 -10
- package/esm/{CalmLensAppClient-B5gfOB6J.d.ts → CalmLensAppClient-gG16T2py.d.ts} +13 -3
- package/esm/{CalmLensOptionKeys-BKez0Wiw.js → CalmLensOptionKeys-BGZlIsT2.js} +235 -338
- package/esm/{CalmLensServerClient-DCSbwIBs.d.ts → CalmLensServerClient-BHx3x_nZ.d.ts} +107 -49
- package/esm/{CalmLensServerClient-DemxbNMn.js → CalmLensServerClient-dAQUcDWb.js} +274 -93
- package/esm/{CalmLensTypes-DpU-hXq2.d.ts → CalmLensTypes-CUB0YYVz.d.ts} +26601 -27354
- package/esm/{Classification-D3SkprrQ-CMnQKW13.d.ts → Classification-Q5zGpR8l-CEWjnE39.d.ts} +731 -607
- package/esm/Core-BxeIud_S.js +843 -0
- package/esm/Core-C82YmjjX.d.ts +823 -0
- package/esm/FileIcons-4qSX7DW2.d.ts +67 -0
- package/esm/{ModerationContextLimits-lLfmyLni.js → ModerationContextLimits-B6_RalCQ.js} +911 -261
- package/esm/{ReactUpload-huIMnOJ4.d.ts → ReactUpload-DiiXfKvj.d.ts} +1 -1
- package/esm/{ReactUpload-6klucehl.js → ReactUpload-DxwVqfX1.js} +1 -1
- package/esm/{TestTriggers-CMwMrbjy-bdowBBKw.js → TestTriggers-BTyXtX0Q-GRB9jQwo.js} +320 -36
- package/{cjs/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts → esm/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts} +146 -8
- package/esm/{UploadController-UxP6gj7A.js → UploadController-D9Z-h00Q.js} +34 -14
- package/esm/{WebhookPayload-CQg8BBZQ.d.ts → WebhookPayload-BLT2y_Jy.d.ts} +93 -86
- package/esm/app.d.ts +6 -7
- package/esm/app.js +3 -3
- package/esm/elements.d.ts +123 -22
- package/esm/elements.js +497 -128
- package/esm/file-icons.d.ts +2 -67
- package/esm/index-CKRgjV16.d.ts +16 -0
- package/esm/index.d.ts +5 -6
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +52 -11
- package/esm/react-native.js +205 -75
- package/esm/react.d.ts +42 -9
- package/esm/react.js +327 -91
- package/esm/server.d.ts +48 -7
- package/esm/server.js +3 -3
- package/esm/styles.css +142 -22
- package/esm/svelte/AssetViewer.svelte +25 -0
- package/esm/svelte/CalmLensAsset.svelte +318 -0
- package/esm/svelte/CalmLensDocumentViewer.svelte +7 -0
- package/esm/svelte/CalmLensImageViewer.svelte +7 -0
- package/esm/svelte/CalmLensSpreadsheetViewer.svelte +7 -0
- package/esm/svelte/CalmLensTextViewer.svelte +7 -0
- package/esm/svelte/CalmLensWebsiteViewer.svelte +7 -0
- package/esm/svelte/index.d.ts +29 -6
- package/esm/svelte/index.js +7 -2
- package/esm/test-inputs.d.ts +2 -2
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +29 -16
- package/esm/testing.js +1507 -393
- package/esm/ui-CTBUxnVp.d.ts +139 -0
- package/esm/ui-Cr7s6JHm.js +1258 -0
- package/esm/ui.d.ts +3 -2
- package/esm/ui.js +4 -3
- package/esm/vue.d.ts +802 -199
- package/esm/vue.js +308 -103
- package/package.json +3 -1
- package/cjs/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +0 -67
- package/cjs/index-BcDDQJF2.d.ts +0 -253
- package/cjs/ui-B23r8BvW.d.ts +0 -539
- package/cjs/ui-Dq-cm6Rx.js +0 -586
- package/esm/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +0 -67
- package/esm/index-BcDDQJF2.d.ts +0 -253
- package/esm/svelte/CalmLensMedia.svelte +0 -134
- package/esm/ui-B23r8BvW.d.ts +0 -539
- package/esm/ui-Bn29rfAi.js +0 -461
package/esm/index-BcDDQJF2.d.ts
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import "./ModerationContext-9lGm-Mna-CcmbRnOy.js";
|
|
2
|
-
import { q as GetAssetUrlOptions } from "./CalmLensTypes-DpU-hXq2.js";
|
|
3
|
-
import "./WebhookPayload-CQg8BBZQ.js";
|
|
4
|
-
import "./Classification-D3SkprrQ-CMnQKW13.js";
|
|
5
|
-
import * as zod from "zod";
|
|
6
|
-
declare const DEFAULT_CDN_BASE_URL = "https://cdn.calmlens.com/v1";
|
|
7
|
-
/**
|
|
8
|
-
* Builds an asset's CDN URL without a client: no API key and no request, so it works in browsers.
|
|
9
|
-
* `CalmLensServerClient`'s `cdn.getAssetUrl` uses it too.
|
|
10
|
-
*
|
|
11
|
-
* `resource` is `rendered` (default), `original` or `placeholder`. Only `rendered` takes a lens or
|
|
12
|
-
* transform, and it serves images in the best format the browser accepts. A
|
|
13
|
-
* placeholder is a small blurred PNG that the CDN serves publicly for every asset whatever its
|
|
14
|
-
* visibility or moderation status, without requiring age confirmation.
|
|
15
|
-
*/
|
|
16
|
-
declare const getAssetUrl: ({ projectId, assetIdentifier, cdnBaseUrl, resource, ...options }: GetAssetUrlOptions) => string;
|
|
17
|
-
/** This SDK's version, from its package.json. */
|
|
18
|
-
declare const SDK_VERSION: string;
|
|
19
|
-
/**
|
|
20
|
-
* Optional analyses a request can turn on or off with `processingOptions.features.<id>`. The
|
|
21
|
-
* catalog is the single source for the request and result schemas, cache keys and metering. Each
|
|
22
|
-
* feature's `activation` sets what a request that doesn't mention it gets; there is no
|
|
23
|
-
* project-level default.
|
|
24
|
-
*/
|
|
25
|
-
/** How mature a feature is. Beta results may change shape. */
|
|
26
|
-
declare const PROCESSING_FEATURE_STAGES: readonly ["beta", "ga"];
|
|
27
|
-
type ProcessingFeatureStage = (typeof PROCESSING_FEATURE_STAGES)[number];
|
|
28
|
-
declare const PROCESSING_FEATURE_IDS: readonly ["ocr", "personDetection", "faceDetection", "linkDetection", "aiGeneratedDetection"];
|
|
29
|
-
type ProcessingFeatureId = (typeof PROCESSING_FEATURE_IDS)[number];
|
|
30
|
-
declare const PROCESSING_FEATURES_SCHEMA: zod.ZodObject<{
|
|
31
|
-
ocr: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
|
|
32
|
-
enabled: zod.ZodBoolean;
|
|
33
|
-
}, zod.core.$strict>>>;
|
|
34
|
-
personDetection: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
|
|
35
|
-
enabled: zod.ZodBoolean;
|
|
36
|
-
}, zod.core.$strict>>>;
|
|
37
|
-
faceDetection: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
|
|
38
|
-
enabled: zod.ZodBoolean;
|
|
39
|
-
ageEstimation: zod.ZodOptional<zod.ZodBoolean>;
|
|
40
|
-
}, zod.core.$strict>>>;
|
|
41
|
-
linkDetection: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
|
|
42
|
-
enabled: zod.ZodBoolean;
|
|
43
|
-
}, zod.core.$strict>>>;
|
|
44
|
-
aiGeneratedDetection: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
|
|
45
|
-
enabled: zod.ZodBoolean;
|
|
46
|
-
}, zod.core.$strict>>>;
|
|
47
|
-
}, zod.core.$strict>;
|
|
48
|
-
type ProcessingFeatures = zod.infer<typeof PROCESSING_FEATURES_SCHEMA>;
|
|
49
|
-
/** Position and size as fractions of the image width and height, from 0 to 1. */
|
|
50
|
-
declare const BOUNDING_BOX_SCHEMA: zod.ZodObject<{
|
|
51
|
-
left: zod.ZodNumber;
|
|
52
|
-
top: zod.ZodNumber;
|
|
53
|
-
width: zod.ZodNumber;
|
|
54
|
-
height: zod.ZodNumber;
|
|
55
|
-
}, zod.core.$strict>;
|
|
56
|
-
type BoundingBox = zod.infer<typeof BOUNDING_BOX_SCHEMA>;
|
|
57
|
-
declare const AGE_RANGE_SCHEMA: zod.ZodObject<{
|
|
58
|
-
low: zod.ZodNumber;
|
|
59
|
-
high: zod.ZodNumber;
|
|
60
|
-
}, zod.core.$strict>;
|
|
61
|
-
type AgeRange = zod.infer<typeof AGE_RANGE_SCHEMA>;
|
|
62
|
-
declare const DETECTED_PERSON_SCHEMA: zod.ZodObject<{
|
|
63
|
-
box: zod.ZodObject<{
|
|
64
|
-
left: zod.ZodNumber;
|
|
65
|
-
top: zod.ZodNumber;
|
|
66
|
-
width: zod.ZodNumber;
|
|
67
|
-
height: zod.ZodNumber;
|
|
68
|
-
}, zod.core.$strict>;
|
|
69
|
-
confidence: zod.ZodNumber;
|
|
70
|
-
}, zod.core.$strict>;
|
|
71
|
-
type DetectedPerson = zod.infer<typeof DETECTED_PERSON_SCHEMA>;
|
|
72
|
-
declare const DETECTED_FACE_SCHEMA: zod.ZodObject<{
|
|
73
|
-
box: zod.ZodObject<{
|
|
74
|
-
left: zod.ZodNumber;
|
|
75
|
-
top: zod.ZodNumber;
|
|
76
|
-
width: zod.ZodNumber;
|
|
77
|
-
height: zod.ZodNumber;
|
|
78
|
-
}, zod.core.$strict>;
|
|
79
|
-
confidence: zod.ZodNumber;
|
|
80
|
-
ageRange: zod.ZodOptional<zod.ZodObject<{
|
|
81
|
-
low: zod.ZodNumber;
|
|
82
|
-
high: zod.ZodNumber;
|
|
83
|
-
}, zod.core.$strict>>;
|
|
84
|
-
}, zod.core.$strict>;
|
|
85
|
-
type DetectedFace = zod.infer<typeof DETECTED_FACE_SCHEMA>;
|
|
86
|
-
declare const PROCESSING_FEATURE_RESULTS_SCHEMA: zod.ZodObject<{
|
|
87
|
-
personDetection: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
88
|
-
status: zod.ZodLiteral<"evaluated">;
|
|
89
|
-
stage: zod.ZodEnum<{
|
|
90
|
-
beta: "beta";
|
|
91
|
-
ga: "ga";
|
|
92
|
-
}>;
|
|
93
|
-
people: zod.ZodArray<zod.ZodObject<{
|
|
94
|
-
box: zod.ZodObject<{
|
|
95
|
-
left: zod.ZodNumber;
|
|
96
|
-
top: zod.ZodNumber;
|
|
97
|
-
width: zod.ZodNumber;
|
|
98
|
-
height: zod.ZodNumber;
|
|
99
|
-
}, zod.core.$strict>;
|
|
100
|
-
confidence: zod.ZodNumber;
|
|
101
|
-
}, zod.core.$strict>>;
|
|
102
|
-
}, zod.core.$strict>, zod.ZodObject<{
|
|
103
|
-
status: zod.ZodLiteral<"not-evaluated">;
|
|
104
|
-
stage: zod.ZodEnum<{
|
|
105
|
-
beta: "beta";
|
|
106
|
-
ga: "ga";
|
|
107
|
-
}>;
|
|
108
|
-
reason: zod.ZodEnum<{
|
|
109
|
-
"not-supported": "not-supported";
|
|
110
|
-
unavailable: "unavailable";
|
|
111
|
-
}>;
|
|
112
|
-
}, zod.core.$strict>], "status">>;
|
|
113
|
-
faceDetection: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
114
|
-
status: zod.ZodLiteral<"evaluated">;
|
|
115
|
-
stage: zod.ZodEnum<{
|
|
116
|
-
beta: "beta";
|
|
117
|
-
ga: "ga";
|
|
118
|
-
}>;
|
|
119
|
-
faces: zod.ZodArray<zod.ZodObject<{
|
|
120
|
-
box: zod.ZodObject<{
|
|
121
|
-
left: zod.ZodNumber;
|
|
122
|
-
top: zod.ZodNumber;
|
|
123
|
-
width: zod.ZodNumber;
|
|
124
|
-
height: zod.ZodNumber;
|
|
125
|
-
}, zod.core.$strict>;
|
|
126
|
-
confidence: zod.ZodNumber;
|
|
127
|
-
ageRange: zod.ZodOptional<zod.ZodObject<{
|
|
128
|
-
low: zod.ZodNumber;
|
|
129
|
-
high: zod.ZodNumber;
|
|
130
|
-
}, zod.core.$strict>>;
|
|
131
|
-
}, zod.core.$strict>>;
|
|
132
|
-
}, zod.core.$strict>, zod.ZodObject<{
|
|
133
|
-
status: zod.ZodLiteral<"not-evaluated">;
|
|
134
|
-
stage: zod.ZodEnum<{
|
|
135
|
-
beta: "beta";
|
|
136
|
-
ga: "ga";
|
|
137
|
-
}>;
|
|
138
|
-
reason: zod.ZodEnum<{
|
|
139
|
-
"not-supported": "not-supported";
|
|
140
|
-
unavailable: "unavailable";
|
|
141
|
-
}>;
|
|
142
|
-
}, zod.core.$strict>], "status">>;
|
|
143
|
-
linkDetection: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
144
|
-
status: zod.ZodLiteral<"evaluated">;
|
|
145
|
-
stage: zod.ZodEnum<{
|
|
146
|
-
beta: "beta";
|
|
147
|
-
ga: "ga";
|
|
148
|
-
}>;
|
|
149
|
-
qrCodes: zod.ZodArray<zod.ZodObject<{
|
|
150
|
-
value: zod.ZodString;
|
|
151
|
-
box: zod.ZodObject<{
|
|
152
|
-
left: zod.ZodNumber;
|
|
153
|
-
top: zod.ZodNumber;
|
|
154
|
-
width: zod.ZodNumber;
|
|
155
|
-
height: zod.ZodNumber;
|
|
156
|
-
}, zod.core.$strict>;
|
|
157
|
-
}, zod.core.$strict>>;
|
|
158
|
-
links: zod.ZodArray<zod.ZodObject<{
|
|
159
|
-
url: zod.ZodString;
|
|
160
|
-
source: zod.ZodEnum<{
|
|
161
|
-
"qr-code": "qr-code";
|
|
162
|
-
text: "text";
|
|
163
|
-
}>;
|
|
164
|
-
}, zod.core.$strict>>;
|
|
165
|
-
}, zod.core.$strict>, zod.ZodObject<{
|
|
166
|
-
status: zod.ZodLiteral<"not-evaluated">;
|
|
167
|
-
stage: zod.ZodEnum<{
|
|
168
|
-
beta: "beta";
|
|
169
|
-
ga: "ga";
|
|
170
|
-
}>;
|
|
171
|
-
reason: zod.ZodEnum<{
|
|
172
|
-
"not-supported": "not-supported";
|
|
173
|
-
unavailable: "unavailable";
|
|
174
|
-
}>;
|
|
175
|
-
}, zod.core.$strict>], "status">>;
|
|
176
|
-
linkSafety: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
177
|
-
status: zod.ZodLiteral<"evaluated">;
|
|
178
|
-
stage: zod.ZodEnum<{
|
|
179
|
-
beta: "beta";
|
|
180
|
-
ga: "ga";
|
|
181
|
-
}>;
|
|
182
|
-
links: zod.ZodArray<zod.ZodObject<{
|
|
183
|
-
url: zod.ZodString;
|
|
184
|
-
finalUrl: zod.ZodNullable<zod.ZodString>;
|
|
185
|
-
redirects: zod.ZodNumber;
|
|
186
|
-
source: zod.ZodEnum<{
|
|
187
|
-
"qr-code": "qr-code";
|
|
188
|
-
text: "text";
|
|
189
|
-
}>;
|
|
190
|
-
verdict: zod.ZodEnum<{
|
|
191
|
-
adult: "adult";
|
|
192
|
-
gambling: "gambling";
|
|
193
|
-
malware: "malware";
|
|
194
|
-
phishing: "phishing";
|
|
195
|
-
safe: "safe";
|
|
196
|
-
unresolved: "unresolved";
|
|
197
|
-
}>;
|
|
198
|
-
evidence: zod.ZodArray<zod.ZodObject<{
|
|
199
|
-
check: zod.ZodEnum<{
|
|
200
|
-
"domain-categories": "domain-categories";
|
|
201
|
-
"threat-lists": "threat-lists";
|
|
202
|
-
}>;
|
|
203
|
-
status: zod.ZodEnum<{
|
|
204
|
-
checked: "checked";
|
|
205
|
-
failed: "failed";
|
|
206
|
-
}>;
|
|
207
|
-
labels: zod.ZodArray<zod.ZodString>;
|
|
208
|
-
}, zod.core.$strict>>;
|
|
209
|
-
}, zod.core.$strict>>;
|
|
210
|
-
}, zod.core.$strict>, zod.ZodObject<{
|
|
211
|
-
status: zod.ZodLiteral<"not-evaluated">;
|
|
212
|
-
stage: zod.ZodEnum<{
|
|
213
|
-
beta: "beta";
|
|
214
|
-
ga: "ga";
|
|
215
|
-
}>;
|
|
216
|
-
reason: zod.ZodEnum<{
|
|
217
|
-
"not-supported": "not-supported";
|
|
218
|
-
unavailable: "unavailable";
|
|
219
|
-
}>;
|
|
220
|
-
}, zod.core.$strict>], "status">>;
|
|
221
|
-
aiGeneratedDetection: zod.ZodOptional<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
222
|
-
status: zod.ZodLiteral<"evaluated">;
|
|
223
|
-
stage: zod.ZodEnum<{
|
|
224
|
-
beta: "beta";
|
|
225
|
-
ga: "ga";
|
|
226
|
-
}>;
|
|
227
|
-
provenance: zod.ZodEnum<{
|
|
228
|
-
"ai-edited": "ai-edited";
|
|
229
|
-
"ai-generated": "ai-generated";
|
|
230
|
-
unknown: "unknown";
|
|
231
|
-
}>;
|
|
232
|
-
signals: zod.ZodArray<zod.ZodObject<{
|
|
233
|
-
kind: zod.ZodEnum<{
|
|
234
|
-
c2pa: "c2pa";
|
|
235
|
-
"generator-metadata": "generator-metadata";
|
|
236
|
-
"iptc-digital-source-type": "iptc-digital-source-type";
|
|
237
|
-
}>;
|
|
238
|
-
value: zod.ZodString;
|
|
239
|
-
}, zod.core.$strict>>;
|
|
240
|
-
}, zod.core.$strict>, zod.ZodObject<{
|
|
241
|
-
status: zod.ZodLiteral<"not-evaluated">;
|
|
242
|
-
stage: zod.ZodEnum<{
|
|
243
|
-
beta: "beta";
|
|
244
|
-
ga: "ga";
|
|
245
|
-
}>;
|
|
246
|
-
reason: zod.ZodEnum<{
|
|
247
|
-
"not-supported": "not-supported";
|
|
248
|
-
unavailable: "unavailable";
|
|
249
|
-
}>;
|
|
250
|
-
}, zod.core.$strict>], "status">>;
|
|
251
|
-
}, zod.core.$strict>;
|
|
252
|
-
type ProcessingFeatureResults = zod.infer<typeof PROCESSING_FEATURE_RESULTS_SCHEMA>;
|
|
253
|
-
export { ProcessingFeatureId as a, ProcessingFeatures as c, getAssetUrl as d, DetectedPerson as i, SDK_VERSION as l, BoundingBox as n, ProcessingFeatureResults as o, DetectedFace as r, ProcessingFeatureStage as s, AgeRange as t, DEFAULT_CDN_BASE_URL as u };
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { onMount } from "svelte";
|
|
3
|
-
import {
|
|
4
|
-
getMediaAspectRatio,
|
|
5
|
-
getMediaLoadKey,
|
|
6
|
-
getMediaState,
|
|
7
|
-
getMediaUnavailableMessage,
|
|
8
|
-
type MediaOptions,
|
|
9
|
-
type MediaProps,
|
|
10
|
-
resolveMediaProps,
|
|
11
|
-
resolveMessages,
|
|
12
|
-
} from "../ui.js";
|
|
13
|
-
import Icon from "./Icon.svelte";
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
alt = "",
|
|
17
|
-
aspectRatio,
|
|
18
|
-
width,
|
|
19
|
-
height,
|
|
20
|
-
sizes,
|
|
21
|
-
averageColor,
|
|
22
|
-
fit,
|
|
23
|
-
position,
|
|
24
|
-
lazy = true,
|
|
25
|
-
fetchPriority,
|
|
26
|
-
controls = true,
|
|
27
|
-
messages: overrides,
|
|
28
|
-
onReveal,
|
|
29
|
-
...options
|
|
30
|
-
}: MediaProps = $props();
|
|
31
|
-
|
|
32
|
-
const messages = $derived(resolveMessages(overrides));
|
|
33
|
-
// An `asset` fills in what isn't passed: the source, status and type, and its preview's size.
|
|
34
|
-
const view = $derived(
|
|
35
|
-
resolveMediaProps({ ...(options as MediaOptions), width, height, averageColor }),
|
|
36
|
-
);
|
|
37
|
-
const state = $derived(getMediaState(view));
|
|
38
|
-
const loadKey = $derived(getMediaLoadKey(state));
|
|
39
|
-
const ratio = $derived(
|
|
40
|
-
getMediaAspectRatio({ aspectRatio, width: view.width, height: view.height }),
|
|
41
|
-
);
|
|
42
|
-
let load: "loading" | "loaded" | "error" = $state("loading");
|
|
43
|
-
let image: HTMLImageElement | undefined = $state();
|
|
44
|
-
|
|
45
|
-
$effect.pre(() => {
|
|
46
|
-
void loadKey;
|
|
47
|
-
load = "loading";
|
|
48
|
-
});
|
|
49
|
-
onMount(() => {
|
|
50
|
-
// An image that loaded before hydration fires no load event.
|
|
51
|
-
if (image?.complete && image.naturalWidth > 0) load = "loaded";
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const onError = () => {
|
|
55
|
-
load = "error";
|
|
56
|
-
};
|
|
57
|
-
const placeholderUrl = $derived(
|
|
58
|
-
state.kind === "audio" || state.kind === "unavailable" ? undefined : state.placeholderUrl,
|
|
59
|
-
);
|
|
60
|
-
const showPlaceholder = $derived(
|
|
61
|
-
placeholderUrl && (state.kind === "gated" || (state.kind === "image" && load !== "loaded")),
|
|
62
|
-
);
|
|
63
|
-
const failed = $derived(load === "error");
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
<figure
|
|
67
|
-
class="calmlens-media"
|
|
68
|
-
data-kind={state.kind}
|
|
69
|
-
data-state={load}
|
|
70
|
-
data-sized={ratio ? "" : undefined}
|
|
71
|
-
style:aspect-ratio={ratio}
|
|
72
|
-
style:background-color={view.averageColor}
|
|
73
|
-
style:--calmlens-fit={fit}
|
|
74
|
-
style:--calmlens-position={position}
|
|
75
|
-
>
|
|
76
|
-
{#if showPlaceholder}
|
|
77
|
-
<img class="calmlens-media__placeholder" src={placeholderUrl} alt="" aria-hidden="true" />
|
|
78
|
-
{/if}
|
|
79
|
-
{#if state.kind === "image" && !failed}
|
|
80
|
-
{#key loadKey}
|
|
81
|
-
<img
|
|
82
|
-
bind:this={image}
|
|
83
|
-
class="calmlens-media__content"
|
|
84
|
-
src={state.src}
|
|
85
|
-
srcset={state.srcSet}
|
|
86
|
-
{sizes}
|
|
87
|
-
{alt}
|
|
88
|
-
width={view.width}
|
|
89
|
-
height={view.height}
|
|
90
|
-
loading={lazy ? "lazy" : undefined}
|
|
91
|
-
decoding="async"
|
|
92
|
-
fetchpriority={fetchPriority}
|
|
93
|
-
onload={() => (load = "loaded")}
|
|
94
|
-
onerror={onError}
|
|
95
|
-
/>
|
|
96
|
-
{/key}
|
|
97
|
-
{:else if state.kind === "video" && !failed}
|
|
98
|
-
<!-- svelte-ignore a11y_media_has_caption -->
|
|
99
|
-
<!-- biome-ignore lint/a11y/useMediaCaption: captions are your app's to add -->
|
|
100
|
-
<video
|
|
101
|
-
class="calmlens-media__content"
|
|
102
|
-
src={state.src}
|
|
103
|
-
{controls}
|
|
104
|
-
playsinline
|
|
105
|
-
preload="metadata"
|
|
106
|
-
aria-label={alt || undefined}
|
|
107
|
-
onerror={() => (load = "error")}
|
|
108
|
-
></video>
|
|
109
|
-
{:else if state.kind === "audio" && !failed}
|
|
110
|
-
<!-- biome-ignore lint/a11y/useMediaCaption: audio has no captions track to add here -->
|
|
111
|
-
<audio
|
|
112
|
-
class="calmlens-media__content"
|
|
113
|
-
src={state.src}
|
|
114
|
-
{controls}
|
|
115
|
-
preload="metadata"
|
|
116
|
-
aria-label={alt || undefined}
|
|
117
|
-
onerror={() => (load = "error")}
|
|
118
|
-
></audio>
|
|
119
|
-
{/if}
|
|
120
|
-
{#if state.kind === "gated"}
|
|
121
|
-
<figcaption class="calmlens-media__notice">
|
|
122
|
-
<strong>{messages.sensitiveTitle}</strong>
|
|
123
|
-
<p>{messages.sensitiveBody}</p>
|
|
124
|
-
{#if onReveal}
|
|
125
|
-
<button type="button" class="calmlens-button" onclick={onReveal}>{messages.reveal}</button>
|
|
126
|
-
{/if}
|
|
127
|
-
</figcaption>
|
|
128
|
-
{/if}
|
|
129
|
-
{#if state.kind === "unavailable" || failed}
|
|
130
|
-
<figcaption class="calmlens-media__notice">
|
|
131
|
-
<p><Icon name="unavailable" /><span class="calmlens-media__label">{getMediaUnavailableMessage(state, messages)}</span></p>
|
|
132
|
-
</figcaption>
|
|
133
|
-
{/if}
|
|
134
|
-
</figure>
|