@calmlens/sdk 0.16.3 → 0.17.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.
Files changed (112) hide show
  1. package/README.md +398 -163
  2. package/cjs/BrowserUpload-DZ0Vbmxi.js +10 -0
  3. package/cjs/BrowserUpload-uZjVFGfP.d.ts +11 -0
  4. package/cjs/CalmLensAppClient-CV_K26Ce.d.ts +40 -0
  5. package/cjs/CalmLensAppClient-DBGmaDlG.js +89 -0
  6. package/cjs/CalmLensConnection-K1TAD1Z-.js +659 -0
  7. package/cjs/CalmLensServerClient-C-pxiz0C.js +645 -0
  8. package/cjs/CalmLensServerClient-JtP687a3.d.ts +235 -0
  9. package/cjs/CalmLensTypes-9Vt16pc7.d.ts +40400 -0
  10. package/cjs/Classification-94kSYWZw-CMnQKW13.d.ts +5873 -0
  11. package/cjs/CryptoUtils-B_x8lMIx-YBW1-bvL.js +42 -0
  12. package/cjs/FileIcons-Ob003MdS.js +175 -0
  13. package/cjs/Jurisdiction-FusEXb4U-zVs21tDv.js +91 -0
  14. package/cjs/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +67 -0
  15. package/cjs/ModerationContextLimits-Dj1YAl3G.js +1311 -0
  16. package/cjs/ReactUpload-DxtFMr06.js +54 -0
  17. package/cjs/ReactUpload-nZahpmyg.d.ts +17 -0
  18. package/cjs/TestTriggers-By07LR31-CmK0yTyR.d.ts +271 -0
  19. package/cjs/TestTriggers-DcArt0Nu-CvoaONUB.js +1326 -0
  20. package/cjs/UploadController-BBkN4Ni6.js +618 -0
  21. package/{esm/index-C9Xw1aid.d.ts → cjs/WebhookPayload-2aL31v0J.d.ts} +131 -155
  22. package/cjs/app.d.ts +7 -44
  23. package/cjs/app.js +11 -89
  24. package/cjs/elements.d.ts +88 -0
  25. package/cjs/elements.js +555 -0
  26. package/cjs/file-icons.d.ts +67 -0
  27. package/cjs/file-icons.js +10 -0
  28. package/cjs/index-CI4BzN4W.d.ts +252 -0
  29. package/cjs/index.d.ts +6 -4
  30. package/cjs/index.js +9 -4
  31. package/cjs/react-native.d.ts +56 -0
  32. package/cjs/react-native.js +495 -0
  33. package/cjs/react.d.ts +30 -0
  34. package/cjs/react.js +370 -0
  35. package/cjs/server.d.ts +12 -191
  36. package/cjs/server.js +18 -378
  37. package/cjs/test-inputs.d.ts +2 -2
  38. package/cjs/test-inputs.js +9 -264
  39. package/cjs/testing.d.ts +285 -190
  40. package/cjs/testing.js +2393 -1203
  41. package/cjs/ui-CgZpgpNo.d.ts +526 -0
  42. package/cjs/ui-KceuoVCM.js +583 -0
  43. package/cjs/ui.d.ts +2 -0
  44. package/cjs/ui.js +27 -0
  45. package/cjs/vue.d.ts +490 -0
  46. package/cjs/vue.js +419 -0
  47. package/esm/BrowserUpload-D7-zNmc0.js +5 -0
  48. package/esm/BrowserUpload-uZjVFGfP.d.ts +11 -0
  49. package/esm/CalmLensAppClient-CV_K26Ce.d.ts +40 -0
  50. package/esm/CalmLensAppClient-FVMwrHlH.js +84 -0
  51. package/esm/CalmLensConnection-iyNQHA8L.js +582 -0
  52. package/esm/CalmLensServerClient-JtP687a3.d.ts +235 -0
  53. package/esm/CalmLensServerClient-fQEYKLw4.js +586 -0
  54. package/esm/CalmLensTypes-9Vt16pc7.d.ts +40400 -0
  55. package/esm/Classification-94kSYWZw-CMnQKW13.d.ts +5873 -0
  56. package/esm/CryptoUtils-B_x8lMIx-DhuWGzqn.js +25 -0
  57. package/esm/FileIcons-M6dzjFxd.js +128 -0
  58. package/esm/Jurisdiction-FusEXb4U-1ov6m5yE.js +46 -0
  59. package/esm/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +67 -0
  60. package/esm/ModerationContextLimits-D1x_WAtP.js +1114 -0
  61. package/esm/ReactUpload-D6yBCkcw.js +37 -0
  62. package/esm/ReactUpload-nZahpmyg.d.ts +17 -0
  63. package/esm/TestTriggers-By07LR31-CmK0yTyR.d.ts +271 -0
  64. package/esm/TestTriggers-DcArt0Nu-s0AQZuWE.js +1266 -0
  65. package/esm/UploadController-txp5NuzH.js +589 -0
  66. package/{cjs/index-C9Xw1aid.d.ts → esm/WebhookPayload-2aL31v0J.d.ts} +131 -155
  67. package/esm/app.d.ts +7 -44
  68. package/esm/app.js +3 -86
  69. package/esm/elements.d.ts +88 -0
  70. package/esm/elements.js +528 -0
  71. package/esm/file-icons.d.ts +67 -0
  72. package/esm/file-icons.js +1 -0
  73. package/esm/index-CI4BzN4W.d.ts +252 -0
  74. package/esm/index.d.ts +6 -4
  75. package/esm/index.js +1 -1
  76. package/esm/react-native.d.ts +56 -0
  77. package/esm/react-native.js +467 -0
  78. package/esm/react.d.ts +30 -0
  79. package/esm/react.js +343 -0
  80. package/esm/server.d.ts +12 -191
  81. package/esm/server.js +3 -369
  82. package/esm/styles.css +147 -0
  83. package/esm/svelte/CalmLensMedia.svelte +134 -0
  84. package/esm/svelte/CalmLensUploader.svelte +175 -0
  85. package/esm/svelte/Icon.svelte +7 -0
  86. package/esm/svelte/index.d.ts +37 -0
  87. package/esm/svelte/index.js +6 -0
  88. package/esm/test-inputs.d.ts +2 -2
  89. package/esm/test-inputs.js +1 -256
  90. package/esm/testing.d.ts +285 -190
  91. package/esm/testing.js +2329 -1122
  92. package/esm/ui-Ca_SpJXf.js +458 -0
  93. package/esm/ui-CgZpgpNo.d.ts +526 -0
  94. package/esm/ui.d.ts +2 -0
  95. package/esm/ui.js +3 -0
  96. package/esm/vue.d.ts +490 -0
  97. package/esm/vue.js +392 -0
  98. package/package.json +110 -11
  99. package/cjs/CalmLensConnection-BNUHp_AQ.js +0 -234
  100. package/cjs/CalmLensUtils-o171ownK.js +0 -699
  101. package/cjs/CalmLensVersion-DwhgxQK5.js +0 -480
  102. package/cjs/CalmLensWebhooks-BKrq30Yp.js +0 -201
  103. package/cjs/Classification-BNhgwGEm-DmA9VEuE.d.ts +0 -4806
  104. package/cjs/TestTriggers-CRKtulyp-vrzEq2wm.d.ts +0 -44
  105. package/cjs/WebhookPayload-CJoIkGBD.d.ts +0 -11753
  106. package/esm/CalmLensConnection-XTqmlwzG.js +0 -193
  107. package/esm/CalmLensUtils-DsF8Aa_x.js +0 -574
  108. package/esm/CalmLensVersion-DcifRKsx.js +0 -415
  109. package/esm/CalmLensWebhooks-BvGyk5d3.js +0 -148
  110. package/esm/Classification-BNhgwGEm-DmA9VEuE.d.ts +0 -4806
  111. package/esm/TestTriggers-CRKtulyp-vrzEq2wm.d.ts +0 -44
  112. package/esm/WebhookPayload-CJoIkGBD.d.ts +0 -11753
package/esm/vue.js ADDED
@@ -0,0 +1,392 @@
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-Ca_SpJXf.js";
2
+ import { i as createProgressFetch, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-txp5NuzH.js";
3
+ import { t as createUploadController } from "./BrowserUpload-D7-zNmc0.js";
4
+ import { computed, defineComponent, h, onMounted, onScopeDispose, ref, shallowRef, toValue, watch, watchEffect } from "vue";
5
+ // src/vue.ts
6
+ const icon = (name) => h("svg", ICON_ATTRIBUTES, [h("path", { d: ICONS[name] })]);
7
+ /** Keeps a ref to a controller's snapshot, following the controller if it changes. */
8
+ const subscribeSnapshot = (controller) => {
9
+ const snapshot = shallowRef(toValue(controller).getSnapshot());
10
+ watch(() => toValue(controller), (current, _previous, onCleanup) => {
11
+ onCleanup(current.subscribe((next) => {
12
+ snapshot.value = next;
13
+ }));
14
+ }, { immediate: true });
15
+ return snapshot;
16
+ };
17
+ /**
18
+ * Uploads files through an upload preset and keeps `snapshot` up to date as each one uploads and
19
+ * is checked. Use it to build your own upload UI; `CalmLensUploader` is built on it. Uploads
20
+ * still running when the component unmounts are cancelled.
21
+ */
22
+ const useCalmLensUpload = (options) => {
23
+ const controller = createUploadController$1(toValue(options));
24
+ watchEffect(() => controller.setOptions(toValue(options)));
25
+ const snapshot = subscribeSnapshot(controller);
26
+ onScopeDispose(() => controller.clear());
27
+ return {
28
+ snapshot,
29
+ controller,
30
+ addFiles: (files) => controller.addFiles(files),
31
+ retry: (key) => controller.retry(key),
32
+ cancel: (key) => controller.cancel(key),
33
+ remove: (key) => controller.remove(key),
34
+ clear: () => controller.clear(),
35
+ start: () => controller.start()
36
+ };
37
+ };
38
+ const optional = (type) => ({
39
+ type,
40
+ default: void 0
41
+ });
42
+ const messagesProp = optional(Object);
43
+ /**
44
+ * A drop zone and file list that uploads through an upload preset, shows each file's progress
45
+ * and moderation decision, and emits `uploaded` for finished uploads.
46
+ */
47
+ const CalmLensUploader = defineComponent({
48
+ name: "CalmLensUploader",
49
+ props: {
50
+ uploadPresetId: optional(String),
51
+ upload: optional(Function),
52
+ checkStatus: optional(Function),
53
+ createClient: optional(Function),
54
+ token: optional([String, Function]),
55
+ tokenUrl: optional(String),
56
+ accept: optional(String),
57
+ maxFileSize: optional(Number),
58
+ autoUpload: {
59
+ type: Boolean,
60
+ default: true
61
+ },
62
+ multiple: {
63
+ type: Boolean,
64
+ default: false
65
+ },
66
+ maxFiles: optional(Number),
67
+ concurrency: optional(Number),
68
+ decisionTimeoutMs: optional(Number),
69
+ baseUrl: optional(String),
70
+ disabled: {
71
+ type: Boolean,
72
+ default: false
73
+ },
74
+ capture: optional(String),
75
+ messages: messagesProp,
76
+ controller: optional(Object)
77
+ },
78
+ emits: {
79
+ uploaded: (_upload) => true,
80
+ rejected: (_item) => true,
81
+ failed: (_item) => true,
82
+ removed: (_item) => true
83
+ },
84
+ setup(props, { emit }) {
85
+ const own = useCalmLensUpload(() => ({
86
+ uploadPresetId: props.uploadPresetId,
87
+ upload: props.upload,
88
+ checkStatus: props.checkStatus,
89
+ createClient: props.createClient,
90
+ token: props.token,
91
+ tokenUrl: props.tokenUrl,
92
+ accept: props.accept,
93
+ maxFileSize: props.maxFileSize,
94
+ autoUpload: props.autoUpload,
95
+ multiple: props.multiple,
96
+ maxFiles: props.maxFiles,
97
+ concurrency: props.concurrency,
98
+ decisionTimeoutMs: props.decisionTimeoutMs,
99
+ baseUrl: props.baseUrl,
100
+ onUploaded: (value) => emit("uploaded", value),
101
+ onRejected: (item) => emit("rejected", item),
102
+ onFailed: (item) => emit("failed", item),
103
+ onRemoved: (item) => emit("removed", item)
104
+ }));
105
+ const controller = computed(() => props.controller ?? own.controller);
106
+ const snapshot = subscribeSnapshot(controller);
107
+ const messages = computed(() => resolveMessages(props.messages));
108
+ const dragging = ref(false);
109
+ const input = ref();
110
+ const openPicker = () => {
111
+ if (!props.disabled) input.value?.click();
112
+ };
113
+ const onDragOver = (event) => {
114
+ event.preventDefault();
115
+ if (!props.disabled) dragging.value = true;
116
+ };
117
+ return () => {
118
+ const text = messages.value;
119
+ const queue = controller.value;
120
+ const { accept, multiple } = queue.options;
121
+ const items = snapshot.value.items;
122
+ const view = describeUploader(snapshot.value, queue.options, text);
123
+ return h("div", { class: "calmlens-uploader" }, [
124
+ view.showDropzone && h("div", {
125
+ class: "calmlens-dropzone",
126
+ "data-dragging": dragging.value || void 0,
127
+ "data-disabled": props.disabled || void 0,
128
+ onClick: openPicker,
129
+ onDragover: onDragOver,
130
+ onDragenter: onDragOver,
131
+ onDragleave: (event) => {
132
+ if (!event.currentTarget.contains(event.relatedTarget)) dragging.value = false;
133
+ },
134
+ onDrop: (event) => {
135
+ event.preventDefault();
136
+ dragging.value = false;
137
+ if (!props.disabled && event.dataTransfer) queue.addFiles(event.dataTransfer.files);
138
+ },
139
+ onPaste: (event) => {
140
+ const files = event.clipboardData?.files;
141
+ if (!props.disabled && files?.length) queue.addFiles(files);
142
+ }
143
+ }, [
144
+ h("span", { class: "calmlens-dropzone__icon" }, [icon("upload")]),
145
+ h("div", { class: "calmlens-dropzone__text" }, [h("p", { class: "calmlens-dropzone__title" }, dragging.value ? text.dropzoneTitleDragging : text.dropzoneTitle), view.hint && h("p", { class: "calmlens-dropzone__hint" }, view.hint)]),
146
+ h("button", {
147
+ type: "button",
148
+ class: "calmlens-button",
149
+ "data-variant": "outline",
150
+ disabled: props.disabled,
151
+ onClick: (event) => {
152
+ event.stopPropagation();
153
+ openPicker();
154
+ }
155
+ }, view.chooseLabel)
156
+ ]),
157
+ h("input", {
158
+ ref: input,
159
+ type: "file",
160
+ hidden: true,
161
+ accept,
162
+ multiple,
163
+ capture: props.capture,
164
+ disabled: props.disabled,
165
+ onChange: (event) => {
166
+ const target = event.target;
167
+ if (target.files) queue.addFiles(target.files);
168
+ target.value = "";
169
+ }
170
+ }),
171
+ items.length > 0 && h("ul", { class: "calmlens-uploads" }, items.map((item) => {
172
+ const itemView = describeUploadItem(item, text);
173
+ return h("li", {
174
+ key: item.key,
175
+ class: "calmlens-upload",
176
+ "data-stage": item.stage,
177
+ "data-outcome": itemView.outcome
178
+ }, [
179
+ item.previewUrl ? h("img", {
180
+ class: "calmlens-upload__thumb",
181
+ src: item.previewUrl,
182
+ alt: ""
183
+ }) : h("span", {
184
+ class: "calmlens-upload__thumb",
185
+ "data-kind": "file",
186
+ "aria-hidden": "true",
187
+ innerHTML: itemView.fileIcon
188
+ }),
189
+ h("div", { class: "calmlens-upload__body" }, [
190
+ h("span", { class: "calmlens-upload__name" }, item.file.name),
191
+ h("span", { class: "calmlens-upload__size" }, itemView.size),
192
+ itemView.busy && h("div", {
193
+ class: "calmlens-progress",
194
+ role: "progressbar",
195
+ "aria-label": itemView.message,
196
+ "aria-valuemin": 0,
197
+ "aria-valuemax": 100,
198
+ "aria-valuenow": itemView.progressPercent
199
+ }, [h("div", {
200
+ class: "calmlens-progress__bar",
201
+ style: itemView.progressPercent === void 0 ? void 0 : { width: `${itemView.progressPercent}%` }
202
+ })]),
203
+ itemView.message && h("p", {
204
+ class: "calmlens-upload__message",
205
+ role: "status"
206
+ }, itemView.message)
207
+ ]),
208
+ h("div", { class: "calmlens-upload__actions" }, [
209
+ !view.showDropzone && h("button", {
210
+ type: "button",
211
+ class: "calmlens-button",
212
+ "data-variant": "outline",
213
+ "data-size": "small",
214
+ disabled: props.disabled,
215
+ onClick: openPicker
216
+ }, text.chooseAnother),
217
+ itemView.canRetry && h("button", {
218
+ type: "button",
219
+ class: "calmlens-icon-button",
220
+ "aria-label": text.retry,
221
+ title: text.retry,
222
+ onClick: () => queue.retry(item.key)
223
+ }, [icon("retry")]),
224
+ h("button", {
225
+ type: "button",
226
+ class: "calmlens-icon-button",
227
+ "aria-label": itemView.removeLabel,
228
+ title: itemView.removeLabel,
229
+ onClick: () => queue.remove(item.key)
230
+ }, [icon("remove")])
231
+ ])
232
+ ]);
233
+ }))
234
+ ]);
235
+ };
236
+ }
237
+ });
238
+ /**
239
+ * Shows an asset from the CalmLens CDN with responsive widths and a blurred placeholder while
240
+ * it loads. Age-restricted assets stay behind the placeholder and a reveal button until
241
+ * `ageConfirmed` is set; blocked and purged assets show an unavailable notice.
242
+ */
243
+ const CalmLensMedia = defineComponent({
244
+ name: "CalmLensMedia",
245
+ props: {
246
+ /** An asset from the API, which supplies the project, ID, status, type and preview. */
247
+ asset: optional(Object),
248
+ /** Required without `asset`. */
249
+ projectId: optional(String),
250
+ /** Required without `asset`. */
251
+ assetId: optional(String),
252
+ status: optional(String),
253
+ contentRemoved: optional(Boolean),
254
+ type: optional(String),
255
+ resource: optional(String),
256
+ lens: optional(String),
257
+ transform: optional([
258
+ String,
259
+ Object,
260
+ Array
261
+ ]),
262
+ widths: optional(Array),
263
+ url: optional(String),
264
+ placeholder: {
265
+ type: Boolean,
266
+ default: true
267
+ },
268
+ placeholderHash: optional(String),
269
+ placeholderUrl: optional(String),
270
+ averageColor: optional(String),
271
+ cdnBaseUrl: optional(String),
272
+ viewerClaims: optional(Object),
273
+ alt: {
274
+ type: String,
275
+ default: ""
276
+ },
277
+ aspectRatio: optional(Number),
278
+ width: optional(Number),
279
+ height: optional(Number),
280
+ sizes: optional(String),
281
+ fit: optional(String),
282
+ position: optional(String),
283
+ lazy: {
284
+ type: Boolean,
285
+ default: true
286
+ },
287
+ fetchPriority: optional(String),
288
+ controls: {
289
+ type: Boolean,
290
+ default: true
291
+ },
292
+ messages: messagesProp,
293
+ /** Bound by `@reveal`; declared as a prop so the button shows only when something listens. */
294
+ onReveal: optional(Function)
295
+ },
296
+ setup(props) {
297
+ const messages = computed(() => resolveMessages(props.messages));
298
+ const resolved = computed(() => resolveMediaProps(props));
299
+ const state = computed(() => getMediaState(resolved.value));
300
+ const loadKey = computed(() => getMediaLoadKey(state.value));
301
+ const load = ref("loading");
302
+ const image = ref();
303
+ watch(loadKey, () => {
304
+ load.value = "loading";
305
+ });
306
+ onMounted(() => {
307
+ if (image.value?.complete && image.value.naturalWidth > 0) load.value = "loaded";
308
+ });
309
+ const onError = () => {
310
+ load.value = "error";
311
+ };
312
+ return () => {
313
+ const current = state.value;
314
+ const text = messages.value;
315
+ const view = resolved.value;
316
+ const ratio = getMediaAspectRatio(view);
317
+ const failed = load.value === "error";
318
+ const placeholderUrl = current.kind === "audio" || current.kind === "unavailable" ? void 0 : current.placeholderUrl;
319
+ const showPlaceholder = placeholderUrl && (current.kind === "gated" || current.kind === "image" && load.value !== "loaded");
320
+ const notice = (children) => h("figcaption", { class: "calmlens-media__notice" }, children);
321
+ return h("figure", {
322
+ class: "calmlens-media",
323
+ "data-kind": current.kind,
324
+ "data-state": load.value,
325
+ "data-sized": ratio ? "" : void 0,
326
+ style: {
327
+ aspectRatio: ratio,
328
+ backgroundColor: view.averageColor,
329
+ "--calmlens-fit": props.fit,
330
+ "--calmlens-position": props.position
331
+ }
332
+ }, [
333
+ showPlaceholder && h("img", {
334
+ class: "calmlens-media__placeholder",
335
+ src: placeholderUrl,
336
+ alt: "",
337
+ "aria-hidden": "true"
338
+ }),
339
+ current.kind === "image" && !failed && h("img", {
340
+ key: loadKey.value,
341
+ ref: image,
342
+ class: "calmlens-media__content",
343
+ src: current.src,
344
+ srcset: current.srcSet,
345
+ sizes: props.sizes,
346
+ alt: props.alt,
347
+ width: view.width,
348
+ height: view.height,
349
+ loading: props.lazy ? "lazy" : void 0,
350
+ decoding: "async",
351
+ fetchpriority: props.fetchPriority,
352
+ onLoad: () => {
353
+ load.value = "loaded";
354
+ },
355
+ onError
356
+ }),
357
+ current.kind === "video" && !failed && h("video", {
358
+ class: "calmlens-media__content",
359
+ src: current.src,
360
+ controls: props.controls,
361
+ playsinline: true,
362
+ preload: "metadata",
363
+ "aria-label": props.alt || void 0,
364
+ onError: () => {
365
+ load.value = "error";
366
+ }
367
+ }),
368
+ current.kind === "audio" && !failed && h("audio", {
369
+ class: "calmlens-media__content",
370
+ src: current.src,
371
+ controls: props.controls,
372
+ preload: "metadata",
373
+ "aria-label": props.alt || void 0,
374
+ onError: () => {
375
+ load.value = "error";
376
+ }
377
+ }),
378
+ current.kind === "gated" && notice([
379
+ h("strong", text.sensitiveTitle),
380
+ h("p", text.sensitiveBody),
381
+ props.onReveal && h("button", {
382
+ type: "button",
383
+ class: "calmlens-button",
384
+ onClick: props.onReveal
385
+ }, text.reveal)
386
+ ]),
387
+ (current.kind === "unavailable" || failed) && notice([h("p", [icon("unavailable"), h("span", { class: "calmlens-media__label" }, getMediaUnavailableMessage(current, text))])])
388
+ ]);
389
+ };
390
+ }
391
+ });
392
+ export { CALMLENS_STYLES, CALMLENS_THEME, CalmLensMedia, CalmLensUploader, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, UploadController, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme, useCalmLensUpload };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calmlens/sdk",
3
- "version": "0.16.3",
3
+ "version": "0.17.1",
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",
@@ -16,13 +16,16 @@
16
16
  "main": "cjs/index.js",
17
17
  "types": "cjs/index.d.ts",
18
18
  "module": "esm/index.js",
19
- "sideEffects": false,
19
+ "sideEffects": [
20
+ "./esm/elements.js",
21
+ "./cjs/elements.js"
22
+ ],
20
23
  "engines": {
21
24
  "node": ">=22"
22
25
  },
23
26
  "scripts": {
24
27
  "prepublishOnly": "npm run check && npm run test && npm run build",
25
- "test": "bun test --parallel=4 tests",
28
+ "test": "bun test --parallel=4 ./tests/",
26
29
  "check:fix": "tsc --noEmit --project tsconfig.json && npx @biomejs/biome check --write",
27
30
  "check": "tsc --noEmit --project tsconfig.json && npx @biomejs/biome check",
28
31
  "cleanup": "rimraf esm && rimraf cjs && rimraf bin",
@@ -48,17 +51,21 @@
48
51
  "cjs/"
49
52
  ],
50
53
  "devDependencies": {
51
- "@biomejs/biome": "^2.5.15",
52
- "@oxc-project/runtime": "0.148.0",
53
- "@types/bun": "^1.4.2",
54
- "@types/node": "26.6.1",
54
+ "@biomejs/biome": "^2.6.3",
55
+ "@oxc-project/runtime": "0.155.0",
56
+ "@types/bun": "^1.4.4",
57
+ "@types/node": "26.6.5",
58
+ "@types/react": "19.3.0",
59
+ "react-native": "0.86.3",
55
60
  "rimraf": "6.1.3",
56
- "rolldown": "1.2.13",
57
- "rolldown-plugin-dts": "0.28.7",
58
- "typescript": "7.0.2"
61
+ "rolldown": "1.2.15",
62
+ "rolldown-plugin-dts": "0.28.8",
63
+ "svelte": "5.57.2",
64
+ "typescript": "7.0.2",
65
+ "vue": "3.5.44"
59
66
  },
60
67
  "dependencies": {
61
- "zod": "^4.6.5",
68
+ "zod": "^4.6.7",
62
69
  "json-schema-to-ts": "^3.1.1"
63
70
  },
64
71
  "exports": {
@@ -95,6 +102,78 @@
95
102
  },
96
103
  "default": "./esm/app.js"
97
104
  },
105
+ "./ui": {
106
+ "import": {
107
+ "types": "./esm/ui.d.ts",
108
+ "default": "./esm/ui.js"
109
+ },
110
+ "require": {
111
+ "types": "./cjs/ui.d.ts",
112
+ "default": "./cjs/ui.js"
113
+ },
114
+ "default": "./esm/ui.js"
115
+ },
116
+ "./file-icons": {
117
+ "import": {
118
+ "types": "./esm/file-icons.d.ts",
119
+ "default": "./esm/file-icons.js"
120
+ },
121
+ "require": {
122
+ "types": "./cjs/file-icons.d.ts",
123
+ "default": "./cjs/file-icons.js"
124
+ },
125
+ "default": "./esm/file-icons.js"
126
+ },
127
+ "./react": {
128
+ "import": {
129
+ "types": "./esm/react.d.ts",
130
+ "default": "./esm/react.js"
131
+ },
132
+ "require": {
133
+ "types": "./cjs/react.d.ts",
134
+ "default": "./cjs/react.js"
135
+ },
136
+ "default": "./esm/react.js"
137
+ },
138
+ "./react-native": {
139
+ "import": {
140
+ "types": "./esm/react-native.d.ts",
141
+ "default": "./esm/react-native.js"
142
+ },
143
+ "require": {
144
+ "types": "./cjs/react-native.d.ts",
145
+ "default": "./cjs/react-native.js"
146
+ },
147
+ "default": "./esm/react-native.js"
148
+ },
149
+ "./vue": {
150
+ "import": {
151
+ "types": "./esm/vue.d.ts",
152
+ "default": "./esm/vue.js"
153
+ },
154
+ "require": {
155
+ "types": "./cjs/vue.d.ts",
156
+ "default": "./cjs/vue.js"
157
+ },
158
+ "default": "./esm/vue.js"
159
+ },
160
+ "./svelte": {
161
+ "types": "./esm/svelte/index.d.ts",
162
+ "svelte": "./esm/svelte/index.js",
163
+ "default": "./esm/svelte/index.js"
164
+ },
165
+ "./elements": {
166
+ "import": {
167
+ "types": "./esm/elements.d.ts",
168
+ "default": "./esm/elements.js"
169
+ },
170
+ "require": {
171
+ "types": "./cjs/elements.d.ts",
172
+ "default": "./cjs/elements.js"
173
+ },
174
+ "default": "./esm/elements.js"
175
+ },
176
+ "./styles.css": "./esm/styles.css",
98
177
  "./testing": {
99
178
  "import": {
100
179
  "types": "./esm/testing.d.ts",
@@ -121,5 +200,25 @@
121
200
  },
122
201
  "bugs": {
123
202
  "url": "https://github.com/CalmLens/sdks/issues"
203
+ },
204
+ "peerDependencies": {
205
+ "react": ">=19",
206
+ "react-native": ">=0.79",
207
+ "svelte": ">=5",
208
+ "vue": ">=3.3"
209
+ },
210
+ "peerDependenciesMeta": {
211
+ "react": {
212
+ "optional": true
213
+ },
214
+ "react-native": {
215
+ "optional": true
216
+ },
217
+ "svelte": {
218
+ "optional": true
219
+ },
220
+ "vue": {
221
+ "optional": true
222
+ }
124
223
  }
125
224
  }