@molecule/app-file-upload-filepond 1.0.0 → 1.0.2
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 +146 -0
- package/package.json +14 -7
package/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-08-04T01:50:44.265Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# @molecule/app-file-upload-filepond
|
|
10
|
+
|
|
11
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
+
|
|
15
|
+
FilePond file upload provider for the molecule file upload interface.
|
|
16
|
+
|
|
17
|
+
Implements `FileUploadProvider` from `@molecule/app-file-upload` using a
|
|
18
|
+
headless upload engine with validation, progress tracking, concurrency
|
|
19
|
+
control, and image preview generation following FilePond's patterns.
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { provider } from '@molecule/app-file-upload-filepond'
|
|
25
|
+
import { setProvider } from '@molecule/app-file-upload'
|
|
26
|
+
|
|
27
|
+
setProvider(provider)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Type
|
|
31
|
+
|
|
32
|
+
`provider`
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @molecule/app-file-upload-filepond @molecule/app-file-upload @molecule/app-i18n
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## API
|
|
41
|
+
|
|
42
|
+
### Interfaces
|
|
43
|
+
|
|
44
|
+
#### `FilepondConfig`
|
|
45
|
+
|
|
46
|
+
Configuration options for the FilePond file upload provider.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
interface FilepondConfig {
|
|
50
|
+
/**
|
|
51
|
+
* Timeout in milliseconds for individual upload requests.
|
|
52
|
+
* Set to `0` for no timeout. Defaults to `0`.
|
|
53
|
+
*/
|
|
54
|
+
timeout?: number
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Functions
|
|
59
|
+
|
|
60
|
+
#### `createFilepondProvider(config)`
|
|
61
|
+
|
|
62
|
+
Creates a FilePond-style file upload provider.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
function createFilepondProvider(config?: FilepondConfig): FileUploadProvider
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- `config` — Optional FilePond-specific configuration.
|
|
69
|
+
|
|
70
|
+
**Returns:** A `FileUploadProvider` backed by FilePond-style processing.
|
|
71
|
+
|
|
72
|
+
### Constants
|
|
73
|
+
|
|
74
|
+
#### `provider`
|
|
75
|
+
|
|
76
|
+
Default FilePond file upload provider instance.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
const provider: FileUploadProvider
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Core Interface
|
|
83
|
+
|
|
84
|
+
Implements `@molecule/app-file-upload` interface.
|
|
85
|
+
|
|
86
|
+
## Bond Wiring
|
|
87
|
+
|
|
88
|
+
Setup function to register this provider with the core interface:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { setProvider } from '@molecule/app-file-upload'
|
|
92
|
+
import { provider } from '@molecule/app-file-upload-filepond'
|
|
93
|
+
|
|
94
|
+
export function setupFileUploadFilepond(): void {
|
|
95
|
+
setProvider(provider)
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Injection Notes
|
|
100
|
+
|
|
101
|
+
### Requirements
|
|
102
|
+
|
|
103
|
+
Peer dependencies:
|
|
104
|
+
|
|
105
|
+
- `@molecule/app-file-upload` >=1.0.1
|
|
106
|
+
- `@molecule/app-i18n` >=1.0.1
|
|
107
|
+
|
|
108
|
+
### Runtime Dependencies
|
|
109
|
+
|
|
110
|
+
- `@molecule/app-file-upload`
|
|
111
|
+
- `@molecule/app-i18n`
|
|
112
|
+
|
|
113
|
+
Transport is ONE multipart/form-data request per file to
|
|
114
|
+
`destination.url` (default method POST, default field name `'file'`,
|
|
115
|
+
`additionalData` appended as extra fields); the response is parsed as
|
|
116
|
+
JSON when possible (else raw text) and can be reshaped with
|
|
117
|
+
`destination.parseResponse`. This is NOT FilePond's process/revert server
|
|
118
|
+
protocol — any endpoint accepting a multipart POST works. Files that fail
|
|
119
|
+
validation are reported via `events.onValidationError` and NEVER enter
|
|
120
|
+
the queue (they won't appear in `getFiles()`). `timeout` defaults to 0
|
|
121
|
+
(no timeout). Every error/validation message routes through `t()` under the
|
|
122
|
+
`fileUpload.error.*` namespace with an English `defaultValue`, so English
|
|
123
|
+
works out of the box. There is no dedicated companion locale bond yet —
|
|
124
|
+
to translate these, register `fileUpload.error.*` keys with your i18n
|
|
125
|
+
provider (e.g. `addTranslations('fr', { 'fileUpload.error.timedOut': '…' })`).
|
|
126
|
+
Interpolated messages expose `{{maxSize}}`, `{{minSize}}`, `{{type}}`,
|
|
127
|
+
`{{extension}}`, `{{maxFiles}}`, and `{{status}}`.
|
|
128
|
+
|
|
129
|
+
## E2E Tests
|
|
130
|
+
|
|
131
|
+
Integration checklist — drive the real UI (live preview, no mocks), adapt
|
|
132
|
+
each item to this app's actual screens/flows, and check every box off one
|
|
133
|
+
by one. A box you can't check is an integration bug to fix — not a skip:
|
|
134
|
+
|
|
135
|
+
- [ ] Picking a valid file via the picker starts the upload and shows
|
|
136
|
+
per-file progress through to a completed state.
|
|
137
|
+
- [ ] Dragging and dropping a file onto the drop zone uploads it the same
|
|
138
|
+
way.
|
|
139
|
+
- [ ] The completed upload appears wherever this app uses it (file list,
|
|
140
|
+
avatar, attachment) — completion is not just a toast.
|
|
141
|
+
- [ ] A file that fails validation (too large, wrong type) is rejected with
|
|
142
|
+
a visible message and is never sent to the server.
|
|
143
|
+
- [ ] With multiple files (if enabled), each file's progress and completion
|
|
144
|
+
track independently and all complete.
|
|
145
|
+
- [ ] Canceling/removing a queued or in-flight file stops it and clears it
|
|
146
|
+
from the queue.
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-file-upload-filepond",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "FilePond-style file upload provider for @molecule/app-file-upload",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-file-upload-filepond",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "dist/index.js",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +18,8 @@
|
|
|
17
18
|
}
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
20
|
-
"dist"
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
21
23
|
],
|
|
22
24
|
"keywords": [
|
|
23
25
|
"molecule",
|
|
@@ -26,15 +28,20 @@
|
|
|
26
28
|
"filepond"
|
|
27
29
|
],
|
|
28
30
|
"license": "Apache-2.0",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
34
|
+
"directory": "packages/app/bonds/file-upload/filepond"
|
|
35
|
+
},
|
|
29
36
|
"peerDependencies": {
|
|
30
|
-
"@molecule/app-file-upload": ">=1.0.
|
|
31
|
-
"@molecule/app-i18n": ">=1.0.
|
|
37
|
+
"@molecule/app-file-upload": ">=1.0.1",
|
|
38
|
+
"@molecule/app-i18n": ">=1.0.1"
|
|
32
39
|
},
|
|
33
40
|
"devDependencies": {
|
|
34
|
-
"@molecule/app-file-upload": "1.0.
|
|
35
|
-
"@molecule/app-i18n": "1.0.
|
|
41
|
+
"@molecule/app-file-upload": "1.0.2",
|
|
42
|
+
"@molecule/app-i18n": "1.0.2",
|
|
36
43
|
"@types/node": "26.1.2",
|
|
37
44
|
"typescript": "6.0.3",
|
|
38
|
-
"vitest": "4.1.
|
|
45
|
+
"vitest": "4.1.11"
|
|
39
46
|
}
|
|
40
47
|
}
|