@molecule/app-file-dropzone-svelte 1.1.3 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,13 +3,13 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-26T01:31:05.016Z
6
+ Generated: 2026-11-28T22:53:51.460Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-file-dropzone-svelte
10
10
 
11
11
  Svelte file dropzone — drag-drop + click-to-browse file picker with
12
- accept / max-size filtering. Pure UI: it emits the chosen `File[]`
12
+ accept / max-size filtering. Pure UI: it emits `readonly PickedFile[]`
13
13
  and the host app performs the actual upload.
14
14
 
15
15
  Exports `FileDropzone` and its `FileDropzoneProps`. It is the Svelte
@@ -31,7 +31,11 @@ DOM for the same input.
31
31
  accept="image/*"
32
32
  multiple={false}
33
33
  maxSize={5 * 1024 * 1024}
34
- onFiles={(files) => uploadAvatar(files[0])}
34
+ onFiles={(files) => {
35
+ const form = new FormData()
36
+ files[0]?.appendTo(form, 'avatar')
37
+ uploadAvatar(form)
38
+ }}
35
39
  onRejected={(files) => showError(files[0].name)}
36
40
  />
37
41
  ```
@@ -56,8 +60,8 @@ Props for {@link FileDropzone}.
56
60
 
57
61
  ```typescript
58
62
  interface FileDropzoneProps {
59
- /** Called with the File[] the user selected or dropped. */
60
- onFiles: (files: File[]) => void
63
+ /** Called with the files the user selected or dropped, in selection order. */
64
+ onFiles: (files: readonly PickedFile[]) => void
61
65
  /** Accept attribute (e.g. `'image/*'` or `'.pdf,.docx'`). */
62
66
  accept?: string
63
67
  /** Allow multi-file selection. Defaults to false. */
@@ -65,7 +69,7 @@ interface FileDropzoneProps {
65
69
  /** Max file size in bytes. Files exceeding are rejected. */
66
70
  maxSize?: number
67
71
  /** Called with rejected files (wrong type or size). */
68
- onRejected?: (files: File[]) => void
72
+ onRejected?: (files: readonly PickedFile[]) => void
69
73
  /** Optional content rendered inside the dropzone (defaults to standard upload copy). */
70
74
  children?: Snippet
71
75
  /** Disabled state. */
@@ -90,7 +94,7 @@ const FileDropzone: LegacyComponentType
90
94
  Peer dependencies:
91
95
 
92
96
  - `@molecule/app-filesystem` ^1.1.0
93
- - `@molecule/app-svelte` ^3.13.0
97
+ - `@molecule/app-svelte` ^3.13.0 || ^4.0.0
94
98
  - `@molecule/app-ui` ^1.0.1
95
99
  - `@molecule/app-ui-svelte` ^1.1.0
96
100
  - `svelte` ^5.0.0
@@ -6,7 +6,7 @@
6
6
  string goes through `t()` so a locale switch re-renders it.
7
7
  -->
8
8
  <script lang="ts">
9
- import { createBrowserFileInput } from '@molecule/app-filesystem'
9
+ import { createBrowserFileInput, fromBrowserFile } from '@molecule/app-filesystem'
10
10
  import { contentNodes, useTranslation } from '@molecule/app-svelte'
11
11
  import { getClassMap } from '@molecule/app-ui'
12
12
 
@@ -31,7 +31,7 @@
31
31
  const handlers = createBrowserFileInput(
32
32
  () => inputEl,
33
33
  () => ({ accept, disabled, maxSize, multiple, onFiles, onRejected }),
34
- (file) => file,
34
+ fromBrowserFile,
35
35
  )
36
36
 
37
37
  // Every `t(…)` runs inside a `$derived`: it reads the i18n version under the
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Svelte file dropzone — drag-drop + click-to-browse file picker with
3
- * accept / max-size filtering. Pure UI: it emits the chosen `File[]`
3
+ * accept / max-size filtering. Pure UI: it emits `readonly PickedFile[]`
4
4
  * and the host app performs the actual upload.
5
5
  *
6
6
  * Exports `FileDropzone` and its `FileDropzoneProps`. It is the Svelte
@@ -17,7 +17,11 @@
17
17
  * accept="image/*"
18
18
  * multiple={false}
19
19
  * maxSize={5 * 1024 * 1024}
20
- * onFiles={(files) => uploadAvatar(files[0])}
20
+ * onFiles={(files) => {
21
+ * const form = new FormData()
22
+ * files[0]?.appendTo(form, 'avatar')
23
+ * uploadAvatar(form)
24
+ * }}
21
25
  * onRejected={(files) => showError(files[0].name)}
22
26
  * />
23
27
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Svelte file dropzone — drag-drop + click-to-browse file picker with
3
- * accept / max-size filtering. Pure UI: it emits the chosen `File[]`
3
+ * accept / max-size filtering. Pure UI: it emits `readonly PickedFile[]`
4
4
  * and the host app performs the actual upload.
5
5
  *
6
6
  * Exports `FileDropzone` and its `FileDropzoneProps`. It is the Svelte
@@ -17,7 +17,11 @@
17
17
  * accept="image/*"
18
18
  * multiple={false}
19
19
  * maxSize={5 * 1024 * 1024}
20
- * onFiles={(files) => uploadAvatar(files[0])}
20
+ * onFiles={(files) => {
21
+ * const form = new FormData()
22
+ * files[0]?.appendTo(form, 'avatar')
23
+ * uploadAvatar(form)
24
+ * }}
21
25
  * onRejected={(files) => showError(files[0].name)}
22
26
  * />
23
27
  * ```
package/dist/types.d.ts CHANGED
@@ -5,10 +5,11 @@
5
5
  * @module
6
6
  */
7
7
  import type { Snippet } from 'svelte';
8
+ import type { PickedFile } from '@molecule/app-filesystem';
8
9
  /** Props for {@link FileDropzone}. */
9
10
  export interface FileDropzoneProps {
10
- /** Called with the File[] the user selected or dropped. */
11
- onFiles: (files: File[]) => void;
11
+ /** Called with the files the user selected or dropped, in selection order. */
12
+ onFiles: (files: readonly PickedFile[]) => void;
12
13
  /** Accept attribute (e.g. `'image/*'` or `'.pdf,.docx'`). */
13
14
  accept?: string;
14
15
  /** Allow multi-file selection. Defaults to false. */
@@ -16,7 +17,7 @@ export interface FileDropzoneProps {
16
17
  /** Max file size in bytes. Files exceeding are rejected. */
17
18
  maxSize?: number;
18
19
  /** Called with rejected files (wrong type or size). */
19
- onRejected?: (files: File[]) => void;
20
+ onRejected?: (files: readonly PickedFile[]) => void;
20
21
  /** Optional content rendered inside the dropzone (defaults to standard upload copy). */
21
22
  children?: Snippet;
22
23
  /** Disabled state. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAA;IAChC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uDAAuD;IACvD,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAA;IACpC,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,KAAK,IAAI,CAAA;IAC/C,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uDAAuD;IACvD,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,KAAK,IAAI,CAAA;IACnD,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-file-dropzone-svelte",
3
- "version": "1.1.3",
3
+ "version": "2.0.1",
4
4
  "description": "Drag-drop file upload area with click-to-browse, accept/size filtering, and a content slot",
5
5
  "homepage": "https://www.molecule.dev/packages/app-file-dropzone-svelte",
6
6
  "type": "module",
@@ -49,19 +49,19 @@
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@molecule/app-filesystem": "^1.1.0",
52
- "@molecule/app-svelte": "^3.13.0",
52
+ "@molecule/app-svelte": "^3.13.0 || ^4.0.0",
53
53
  "@molecule/app-ui": "^1.0.1",
54
54
  "@molecule/app-ui-svelte": "^1.1.0",
55
55
  "svelte": "^5.0.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@molecule/app-filesystem": "1.1.0",
58
+ "@molecule/app-filesystem": "1.1.1",
59
59
  "@molecule/app-framework-conformance": "0.0.0",
60
- "@molecule/app-i18n": "1.3.0",
60
+ "@molecule/app-i18n": "1.4.0",
61
61
  "@molecule/app-icons": "1.0.4",
62
- "@molecule/app-svelte": "3.16.0",
63
- "@molecule/app-ui": "1.13.0",
64
- "@molecule/app-ui-svelte": "1.9.0",
62
+ "@molecule/app-svelte": "4.0.0",
63
+ "@molecule/app-ui": "1.17.0",
64
+ "@molecule/app-ui-svelte": "1.12.2",
65
65
  "@sveltejs/package": "3.0.2",
66
66
  "@sveltejs/vite-plugin-svelte": "7.1.2",
67
67
  "@types/node": "26.6.5",