@cahyo-dimas/freeday 1.24.0 → 1.25.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/CHANGELOG.md +30 -0
- package/COMPONENTS.md +5 -0
- package/README.id.md +1 -1
- package/README.md +1 -1
- package/dist/freeday-upload.js +19 -5
- package/dist/freeday.js +19 -5
- package/docs/getting-started.md +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
Semua perubahan penting dicatat di sini. Format longgar mengikuti
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/); tiap versi = git tag.
|
|
5
5
|
|
|
6
|
+
## [1.25.0] — 2026-08-13
|
|
7
|
+
Improvement note #42, found while adopting 1.24.0 — the other half of the same integration.
|
|
8
|
+
### Fixed
|
|
9
|
+
- **`fdy-upload-remove` now fires on the dropzone**, the same element as `fdy-upload-add`. It was
|
|
10
|
+
dispatched on the *row*, which lives in the file list — and the kit's own markup contract puts that
|
|
11
|
+
list as a **sibling** of the dropzone, so the event never bubbled through the zone. A consumer
|
|
12
|
+
following the documentation got `add` and never got `remove`: no error, right event name, right
|
|
13
|
+
element, and the other event on that element working. Their state kept a file the user had already
|
|
14
|
+
taken away.
|
|
15
|
+
The kit's own header comment was the source of the mistake — it said both events are emitted "on the
|
|
16
|
+
dropzone" while the code dispatched one of them somewhere else. It now states the target for each,
|
|
17
|
+
and why (a row in a sibling list can never reach the zone). `COMPONENTS.md` says it once beside the
|
|
18
|
+
row state table, with the removal listener in the worked example.
|
|
19
|
+
### Notes on the shape of the fix
|
|
20
|
+
- The report proposed dispatching on **both** the row and the zone, for backward compatibility. Not
|
|
21
|
+
taken, and the guard proves why: when the file list is **nested inside** the dropzone — which
|
|
22
|
+
`data-filelist` permits — the row already bubbles through the zone, so a second dispatch makes a
|
|
23
|
+
plain zone listener fire **twice** per removal. Firing on both also leaves the pair asymmetric (one
|
|
24
|
+
`add`, two `remove`s for anyone delegating on a common ancestor), which is the same class of silent
|
|
25
|
+
bug this note is about. One canonical target is the honest fix.
|
|
26
|
+
- Dispatching on the zone also fixes the **listless** case from 1.24.0: a row that was never attached
|
|
27
|
+
to the document bubbles to nothing at all, so its × was previously unobservable.
|
|
28
|
+
- *Migration:* a consumer that worked around the old behaviour by listening on the file list must
|
|
29
|
+
move that listener to the dropzone. That position was never documented — it was the bug.
|
|
30
|
+
### Added — guards
|
|
31
|
+
- `browser/upload-states.mjs` gains a second spec: removal fires on the dropzone **exactly once**, in
|
|
32
|
+
both layouts (list as sibling, list nested inside the zone), and delegation on a shared ancestor
|
|
33
|
+
sees no duplicates. Mutation-checked against *both* rejected designs — reverting to the row target
|
|
34
|
+
fails it, and so does the report's dispatch-on-both.
|
|
35
|
+
|
|
6
36
|
## [1.24.0] — 2026-08-13
|
|
7
37
|
Improvement note #41: the upload row had no "chosen, not yet sent" state, so every consumer-driven
|
|
8
38
|
integration showed a transfer that had not started.
|
package/COMPONENTS.md
CHANGED
|
@@ -482,6 +482,10 @@ Click/Enter opens the file dialog; drop works too. Needs `freeday-upload.js`.
|
|
|
482
482
|
— the kit fakes a transfer to `done()`; never set it in an app)
|
|
483
483
|
- A11y: the dropzone is `role="button" tabindex="0"` + `aria-label`.
|
|
484
484
|
|
|
485
|
+
**Both events fire on the dropzone** — `fdy-upload-add` *and* `fdy-upload-remove`. One listener, one
|
|
486
|
+
element. (The file list may be anywhere in the document; nothing is dispatched on the row, because a
|
|
487
|
+
row in a sibling list would never bubble through the zone.)
|
|
488
|
+
|
|
485
489
|
**The row is yours to drive.** `fdy-upload-add` carries `detail.row`, a small state machine over the
|
|
486
490
|
rendered `.fdy-file`. A dropped file **rests** — it shows its size and nothing else — until you say a
|
|
487
491
|
transfer started; the kit never claims one it is not performing.
|
|
@@ -506,6 +510,7 @@ zone.addEventListener('fdy-upload-add', (e) => {
|
|
|
506
510
|
row.done();
|
|
507
511
|
};
|
|
508
512
|
});
|
|
513
|
+
zone.addEventListener('fdy-upload-remove', (e) => forget(e.detail.file)); // same element
|
|
509
514
|
```
|
|
510
515
|
|
|
511
516
|
**Bring your own row:** omit the file list entirely (no `data-filelist`, and no `.fdy-filelist`
|
package/README.id.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> **Lebih banyak _free day_ buat dev — UI kit-nya sudah siap pakai.**
|
|
6
6
|
|
|
7
7
|
[](https://cahyo-dimas.github.io/freeday-ui-kit/)
|
|
8
|
-
[](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v1.25.0)
|
|
9
9
|
|
|
10
10
|
UI KIT yang token-driven & framework-agnostic — satu sumber kebenaran untuk warna, tipografi,
|
|
11
11
|
spasi, dan komponen. Blueprint: `docs/superpowers/specs/2026-07-21-freeday-ui-kit-design.md`.
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> **More free days for devs — the UI kit is ready to use.**
|
|
6
6
|
|
|
7
7
|
[](https://cahyo-dimas.github.io/freeday-ui-kit/)
|
|
8
|
-
[](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v1.25.0)
|
|
9
9
|
|
|
10
10
|
A token-driven, framework-agnostic UI kit — one source of truth for color, typography,
|
|
11
11
|
spacing, and components. Blueprint: `docs/superpowers/specs/2026-07-21-freeday-ui-kit-design.md`.
|
package/dist/freeday-upload.js
CHANGED
|
@@ -15,8 +15,15 @@
|
|
|
15
15
|
* </div>
|
|
16
16
|
* <div class="fdy-filelist" id="dz-list"></div>
|
|
17
17
|
*
|
|
18
|
-
* Emits bubbling CustomEvents on the dropzone
|
|
19
|
-
*
|
|
18
|
+
* Emits bubbling CustomEvents — BOTH on the dropzone element, which is the one target a consumer
|
|
19
|
+
* needs to listen on:
|
|
20
|
+
* "fdy-upload-add" {file, rejected, reason, row}
|
|
21
|
+
* "fdy-upload-remove" {file}
|
|
22
|
+
* `row` is the state machine over the rendered .fdy-file:
|
|
23
|
+
* .ready() (rest — where a dropped file starts) / .uploading() / .setProgress(pct) / .done() /
|
|
24
|
+
* .fail(msg) / .el
|
|
25
|
+
* Note the file list is a SIBLING of the dropzone above, so nothing dispatched on a row would ever
|
|
26
|
+
* bubble through the zone — which is why removal fires on the zone and not on the row.
|
|
20
27
|
*/
|
|
21
28
|
(function () {
|
|
22
29
|
'use strict';
|
|
@@ -43,7 +50,7 @@
|
|
|
43
50
|
});
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
function makeRow(file) {
|
|
53
|
+
function makeRow(file, zone) {
|
|
47
54
|
var el = document.createElement('div');
|
|
48
55
|
el.className = 'fdy-file';
|
|
49
56
|
var icon = document.createElement('span');
|
|
@@ -65,7 +72,14 @@
|
|
|
65
72
|
remove.setAttribute('aria-label', 'Hapus ' + file.name);
|
|
66
73
|
remove.innerHTML = '×';
|
|
67
74
|
remove.addEventListener('click', function () {
|
|
68
|
-
|
|
75
|
+
/* Dispatched on the ZONE, not on the row — the same target as fdy-upload-add, so one listener
|
|
76
|
+
on the dropzone gets both. The row lives in the file list, which the kit's own markup
|
|
77
|
+
contract puts as a SIBLING of the dropzone, so a row event never bubbles through the zone:
|
|
78
|
+
a consumer following the docs saw `add` arrive and `remove` never fire, with no error.
|
|
79
|
+
Firing on both would look safer, but it makes the pair asymmetric — one `add` and, for
|
|
80
|
+
anyone delegating on a common ancestor, two `remove`s — which is its own silent bug. It
|
|
81
|
+
also fixes the listless case: a row that was never attached bubbles to nothing at all. */
|
|
82
|
+
zone.dispatchEvent(new CustomEvent('fdy-upload-remove', { bubbles: true, detail: { file: file } }));
|
|
69
83
|
el.remove();
|
|
70
84
|
});
|
|
71
85
|
el.appendChild(icon);
|
|
@@ -191,7 +205,7 @@
|
|
|
191
205
|
var reason = null;
|
|
192
206
|
if (!accepts(file, acceptAttr)) reason = 'Tipe berkas tidak didukung.';
|
|
193
207
|
else if (maxSize && file.size > maxSize) reason = 'Ukuran melebihi batas (' + fmtSize(maxSize) + ').';
|
|
194
|
-
var row = makeRow(file);
|
|
208
|
+
var row = makeRow(file, zone);
|
|
195
209
|
if (list) list.appendChild(row.el);
|
|
196
210
|
if (reason) {
|
|
197
211
|
row.fail(reason);
|
package/dist/freeday.js
CHANGED
|
@@ -3590,8 +3590,15 @@
|
|
|
3590
3590
|
* </div>
|
|
3591
3591
|
* <div class="fdy-filelist" id="dz-list"></div>
|
|
3592
3592
|
*
|
|
3593
|
-
* Emits bubbling CustomEvents on the dropzone
|
|
3594
|
-
*
|
|
3593
|
+
* Emits bubbling CustomEvents — BOTH on the dropzone element, which is the one target a consumer
|
|
3594
|
+
* needs to listen on:
|
|
3595
|
+
* "fdy-upload-add" {file, rejected, reason, row}
|
|
3596
|
+
* "fdy-upload-remove" {file}
|
|
3597
|
+
* `row` is the state machine over the rendered .fdy-file:
|
|
3598
|
+
* .ready() (rest — where a dropped file starts) / .uploading() / .setProgress(pct) / .done() /
|
|
3599
|
+
* .fail(msg) / .el
|
|
3600
|
+
* Note the file list is a SIBLING of the dropzone above, so nothing dispatched on a row would ever
|
|
3601
|
+
* bubble through the zone — which is why removal fires on the zone and not on the row.
|
|
3595
3602
|
*/
|
|
3596
3603
|
(function () {
|
|
3597
3604
|
'use strict';
|
|
@@ -3618,7 +3625,7 @@
|
|
|
3618
3625
|
});
|
|
3619
3626
|
}
|
|
3620
3627
|
|
|
3621
|
-
function makeRow(file) {
|
|
3628
|
+
function makeRow(file, zone) {
|
|
3622
3629
|
var el = document.createElement('div');
|
|
3623
3630
|
el.className = 'fdy-file';
|
|
3624
3631
|
var icon = document.createElement('span');
|
|
@@ -3640,7 +3647,14 @@
|
|
|
3640
3647
|
remove.setAttribute('aria-label', 'Hapus ' + file.name);
|
|
3641
3648
|
remove.innerHTML = '×';
|
|
3642
3649
|
remove.addEventListener('click', function () {
|
|
3643
|
-
|
|
3650
|
+
/* Dispatched on the ZONE, not on the row — the same target as fdy-upload-add, so one listener
|
|
3651
|
+
on the dropzone gets both. The row lives in the file list, which the kit's own markup
|
|
3652
|
+
contract puts as a SIBLING of the dropzone, so a row event never bubbles through the zone:
|
|
3653
|
+
a consumer following the docs saw `add` arrive and `remove` never fire, with no error.
|
|
3654
|
+
Firing on both would look safer, but it makes the pair asymmetric — one `add` and, for
|
|
3655
|
+
anyone delegating on a common ancestor, two `remove`s — which is its own silent bug. It
|
|
3656
|
+
also fixes the listless case: a row that was never attached bubbles to nothing at all. */
|
|
3657
|
+
zone.dispatchEvent(new CustomEvent('fdy-upload-remove', { bubbles: true, detail: { file: file } }));
|
|
3644
3658
|
el.remove();
|
|
3645
3659
|
});
|
|
3646
3660
|
el.appendChild(icon);
|
|
@@ -3766,7 +3780,7 @@
|
|
|
3766
3780
|
var reason = null;
|
|
3767
3781
|
if (!accepts(file, acceptAttr)) reason = 'Tipe berkas tidak didukung.';
|
|
3768
3782
|
else if (maxSize && file.size > maxSize) reason = 'Ukuran melebihi batas (' + fmtSize(maxSize) + ').';
|
|
3769
|
-
var row = makeRow(file);
|
|
3783
|
+
var row = makeRow(file, zone);
|
|
3770
3784
|
if (list) list.appendChild(row.el);
|
|
3771
3785
|
if (reason) {
|
|
3772
3786
|
row.fail(reason);
|
package/docs/getting-started.md
CHANGED
|
@@ -184,7 +184,7 @@ live docs also have a copy button per component.
|
|
|
184
184
|
```bash
|
|
185
185
|
npm i @cahyo-dimas/freeday
|
|
186
186
|
```
|
|
187
|
-
Lands in `package.json` as `"@cahyo-dimas/freeday": "^1.
|
|
187
|
+
Lands in `package.json` as `"@cahyo-dimas/freeday": "^1.25.0"` (public npm package). `dist/` is
|
|
188
188
|
committed and published → no build step; `npm ci` runs without auth.
|
|
189
189
|
|
|
190
190
|
### 2. Import the CSS + enhancers **once** in your entry (`src/main.ts`)
|