@calmlens/sdk 0.16.3 → 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.
Files changed (114) hide show
  1. package/README.md +425 -181
  2. package/bin/calmlens.js +16016 -0
  3. package/bin/package.json +1 -0
  4. package/cjs/BrowserUpload-BT091eOB.d.ts +11 -0
  5. package/cjs/BrowserUpload-CQwXEGFv.js +10 -0
  6. package/cjs/CalmLensAppClient-CHQGu-Do.js +89 -0
  7. package/cjs/CalmLensAppClient-CV_K26Ce.d.ts +40 -0
  8. package/cjs/CalmLensConnection-B8Bu2j3y.js +659 -0
  9. package/cjs/CalmLensServerClient-C5o2A8MW.js +645 -0
  10. package/cjs/CalmLensServerClient-JtP687a3.d.ts +235 -0
  11. package/cjs/CalmLensTypes-9Vt16pc7.d.ts +40400 -0
  12. package/cjs/Classification-94kSYWZw-CMnQKW13.d.ts +5873 -0
  13. package/cjs/CryptoUtils-B_x8lMIx-YBW1-bvL.js +42 -0
  14. package/cjs/FileIcons-Ob003MdS.js +175 -0
  15. package/cjs/Jurisdiction-FusEXb4U-zVs21tDv.js +91 -0
  16. package/cjs/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +67 -0
  17. package/cjs/ModerationContextLimits-DelWfmiJ.js +1311 -0
  18. package/cjs/ReactUpload-CAyCsyG6.d.ts +17 -0
  19. package/cjs/ReactUpload-Cfg5JYUq.js +54 -0
  20. package/cjs/TestTriggers-By07LR31-CmK0yTyR.d.ts +271 -0
  21. package/cjs/TestTriggers-DTc_iMJF-BjMPq4_3.js +1327 -0
  22. package/cjs/UploadController-BGO1eyzb.js +618 -0
  23. package/{esm/index-C9Xw1aid.d.ts → cjs/WebhookPayload-2aL31v0J.d.ts} +131 -155
  24. package/cjs/app.d.ts +7 -44
  25. package/cjs/app.js +11 -89
  26. package/cjs/elements.d.ts +88 -0
  27. package/cjs/elements.js +555 -0
  28. package/cjs/file-icons.d.ts +67 -0
  29. package/cjs/file-icons.js +10 -0
  30. package/cjs/index-CI4BzN4W.d.ts +252 -0
  31. package/cjs/index.d.ts +6 -4
  32. package/cjs/index.js +9 -4
  33. package/cjs/react-native.d.ts +56 -0
  34. package/cjs/react-native.js +495 -0
  35. package/cjs/react.d.ts +30 -0
  36. package/cjs/react.js +370 -0
  37. package/cjs/server.d.ts +12 -191
  38. package/cjs/server.js +18 -378
  39. package/cjs/test-inputs.d.ts +2 -2
  40. package/cjs/test-inputs.js +9 -264
  41. package/cjs/testing.d.ts +285 -190
  42. package/cjs/testing.js +2393 -1203
  43. package/cjs/ui-CC1GOoMg.js +583 -0
  44. package/cjs/ui-wIiMfqMB.d.ts +526 -0
  45. package/cjs/ui.d.ts +2 -0
  46. package/cjs/ui.js +27 -0
  47. package/cjs/vue.d.ts +490 -0
  48. package/cjs/vue.js +419 -0
  49. package/esm/BrowserUpload-BT091eOB.d.ts +11 -0
  50. package/esm/BrowserUpload-D2xBWqhm.js +5 -0
  51. package/esm/CalmLensAppClient-CV_K26Ce.d.ts +40 -0
  52. package/esm/CalmLensAppClient-DuFas_dW.js +84 -0
  53. package/esm/CalmLensConnection-MxwwLXdl.js +582 -0
  54. package/esm/CalmLensServerClient-D80_mKpW.js +586 -0
  55. package/esm/CalmLensServerClient-JtP687a3.d.ts +235 -0
  56. package/esm/CalmLensTypes-9Vt16pc7.d.ts +40400 -0
  57. package/esm/Classification-94kSYWZw-CMnQKW13.d.ts +5873 -0
  58. package/esm/CryptoUtils-B_x8lMIx-DhuWGzqn.js +25 -0
  59. package/esm/FileIcons-M6dzjFxd.js +128 -0
  60. package/esm/Jurisdiction-FusEXb4U-1ov6m5yE.js +46 -0
  61. package/esm/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +67 -0
  62. package/esm/ModerationContextLimits-BaX2QnU8.js +1114 -0
  63. package/esm/ReactUpload-CAyCsyG6.d.ts +17 -0
  64. package/esm/ReactUpload-CL2XC8WS.js +37 -0
  65. package/esm/TestTriggers-By07LR31-CmK0yTyR.d.ts +271 -0
  66. package/esm/TestTriggers-DTc_iMJF-HfB533Gx.js +1267 -0
  67. package/esm/UploadController-qjoYGCwx.js +589 -0
  68. package/{cjs/index-C9Xw1aid.d.ts → esm/WebhookPayload-2aL31v0J.d.ts} +131 -155
  69. package/esm/app.d.ts +7 -44
  70. package/esm/app.js +3 -86
  71. package/esm/elements.d.ts +88 -0
  72. package/esm/elements.js +528 -0
  73. package/esm/file-icons.d.ts +67 -0
  74. package/esm/file-icons.js +1 -0
  75. package/esm/index-CI4BzN4W.d.ts +252 -0
  76. package/esm/index.d.ts +6 -4
  77. package/esm/index.js +1 -1
  78. package/esm/react-native.d.ts +56 -0
  79. package/esm/react-native.js +467 -0
  80. package/esm/react.d.ts +30 -0
  81. package/esm/react.js +343 -0
  82. package/esm/server.d.ts +12 -191
  83. package/esm/server.js +3 -369
  84. package/esm/styles.css +147 -0
  85. package/esm/svelte/CalmLensMedia.svelte +134 -0
  86. package/esm/svelte/CalmLensUploader.svelte +175 -0
  87. package/esm/svelte/Icon.svelte +7 -0
  88. package/esm/svelte/index.d.ts +37 -0
  89. package/esm/svelte/index.js +6 -0
  90. package/esm/test-inputs.d.ts +2 -2
  91. package/esm/test-inputs.js +1 -256
  92. package/esm/testing.d.ts +285 -190
  93. package/esm/testing.js +2329 -1122
  94. package/esm/ui-CCY3yXFn.js +458 -0
  95. package/esm/ui-wIiMfqMB.d.ts +526 -0
  96. package/esm/ui.d.ts +2 -0
  97. package/esm/ui.js +3 -0
  98. package/esm/vue.d.ts +490 -0
  99. package/esm/vue.js +392 -0
  100. package/package.json +118 -13
  101. package/cjs/CalmLensConnection-BNUHp_AQ.js +0 -234
  102. package/cjs/CalmLensUtils-o171ownK.js +0 -699
  103. package/cjs/CalmLensVersion-DwhgxQK5.js +0 -480
  104. package/cjs/CalmLensWebhooks-BKrq30Yp.js +0 -201
  105. package/cjs/Classification-BNhgwGEm-DmA9VEuE.d.ts +0 -4806
  106. package/cjs/TestTriggers-CRKtulyp-vrzEq2wm.d.ts +0 -44
  107. package/cjs/WebhookPayload-CJoIkGBD.d.ts +0 -11753
  108. package/esm/CalmLensConnection-XTqmlwzG.js +0 -193
  109. package/esm/CalmLensUtils-DsF8Aa_x.js +0 -574
  110. package/esm/CalmLensVersion-DcifRKsx.js +0 -415
  111. package/esm/CalmLensWebhooks-BvGyk5d3.js +0 -148
  112. package/esm/Classification-BNhgwGEm-DmA9VEuE.d.ts +0 -4806
  113. package/esm/TestTriggers-CRKtulyp-vrzEq2wm.d.ts +0 -44
  114. 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-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
+ 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.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",
@@ -16,17 +16,25 @@
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
  },
26
+ "bin": {
27
+ "calmlens": "bin/calmlens.js"
28
+ },
23
29
  "scripts": {
24
30
  "prepublishOnly": "npm run check && npm run test && npm run build",
25
- "test": "bun test --parallel=4 tests",
31
+ "test": "bun test --parallel=4 ./tests/",
26
32
  "check:fix": "tsc --noEmit --project tsconfig.json && npx @biomejs/biome check --write",
27
33
  "check": "tsc --noEmit --project tsconfig.json && npx @biomejs/biome check",
28
34
  "cleanup": "rimraf esm && rimraf cjs && rimraf bin",
29
- "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",
30
38
  "verify:package": "node scripts/verify-package.mjs"
31
39
  },
32
40
  "keywords": [
@@ -45,20 +53,25 @@
45
53
  "LICENSE",
46
54
  "README.md",
47
55
  "esm/",
48
- "cjs/"
56
+ "cjs/",
57
+ "bin/"
49
58
  ],
50
59
  "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",
60
+ "@biomejs/biome": "^2.6.3",
61
+ "@oxc-project/runtime": "0.155.0",
62
+ "@types/bun": "^1.4.4",
63
+ "@types/node": "26.6.5",
64
+ "@types/react": "19.3.0",
65
+ "react-native": "0.86.3",
55
66
  "rimraf": "6.1.3",
56
- "rolldown": "1.2.13",
57
- "rolldown-plugin-dts": "0.28.7",
58
- "typescript": "7.0.2"
67
+ "rolldown": "1.2.15",
68
+ "rolldown-plugin-dts": "0.28.8",
69
+ "svelte": "5.57.2",
70
+ "typescript": "7.0.2",
71
+ "vue": "3.5.44"
59
72
  },
60
73
  "dependencies": {
61
- "zod": "^4.6.5",
74
+ "zod": "^4.6.7",
62
75
  "json-schema-to-ts": "^3.1.1"
63
76
  },
64
77
  "exports": {
@@ -95,6 +108,78 @@
95
108
  },
96
109
  "default": "./esm/app.js"
97
110
  },
111
+ "./ui": {
112
+ "import": {
113
+ "types": "./esm/ui.d.ts",
114
+ "default": "./esm/ui.js"
115
+ },
116
+ "require": {
117
+ "types": "./cjs/ui.d.ts",
118
+ "default": "./cjs/ui.js"
119
+ },
120
+ "default": "./esm/ui.js"
121
+ },
122
+ "./file-icons": {
123
+ "import": {
124
+ "types": "./esm/file-icons.d.ts",
125
+ "default": "./esm/file-icons.js"
126
+ },
127
+ "require": {
128
+ "types": "./cjs/file-icons.d.ts",
129
+ "default": "./cjs/file-icons.js"
130
+ },
131
+ "default": "./esm/file-icons.js"
132
+ },
133
+ "./react": {
134
+ "import": {
135
+ "types": "./esm/react.d.ts",
136
+ "default": "./esm/react.js"
137
+ },
138
+ "require": {
139
+ "types": "./cjs/react.d.ts",
140
+ "default": "./cjs/react.js"
141
+ },
142
+ "default": "./esm/react.js"
143
+ },
144
+ "./react-native": {
145
+ "import": {
146
+ "types": "./esm/react-native.d.ts",
147
+ "default": "./esm/react-native.js"
148
+ },
149
+ "require": {
150
+ "types": "./cjs/react-native.d.ts",
151
+ "default": "./cjs/react-native.js"
152
+ },
153
+ "default": "./esm/react-native.js"
154
+ },
155
+ "./vue": {
156
+ "import": {
157
+ "types": "./esm/vue.d.ts",
158
+ "default": "./esm/vue.js"
159
+ },
160
+ "require": {
161
+ "types": "./cjs/vue.d.ts",
162
+ "default": "./cjs/vue.js"
163
+ },
164
+ "default": "./esm/vue.js"
165
+ },
166
+ "./svelte": {
167
+ "types": "./esm/svelte/index.d.ts",
168
+ "svelte": "./esm/svelte/index.js",
169
+ "default": "./esm/svelte/index.js"
170
+ },
171
+ "./elements": {
172
+ "import": {
173
+ "types": "./esm/elements.d.ts",
174
+ "default": "./esm/elements.js"
175
+ },
176
+ "require": {
177
+ "types": "./cjs/elements.d.ts",
178
+ "default": "./cjs/elements.js"
179
+ },
180
+ "default": "./esm/elements.js"
181
+ },
182
+ "./styles.css": "./esm/styles.css",
98
183
  "./testing": {
99
184
  "import": {
100
185
  "types": "./esm/testing.d.ts",
@@ -121,5 +206,25 @@
121
206
  },
122
207
  "bugs": {
123
208
  "url": "https://github.com/CalmLens/sdks/issues"
209
+ },
210
+ "peerDependencies": {
211
+ "react": ">=19",
212
+ "react-native": ">=0.79",
213
+ "svelte": ">=5",
214
+ "vue": ">=3.3"
215
+ },
216
+ "peerDependenciesMeta": {
217
+ "react": {
218
+ "optional": true
219
+ },
220
+ "react-native": {
221
+ "optional": true
222
+ },
223
+ "svelte": {
224
+ "optional": true
225
+ },
226
+ "vue": {
227
+ "optional": true
228
+ }
124
229
  }
125
230
  }