declarative-forms 2.0.1 → 2.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "declarative-forms",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "Declarative, data-driven form dialogs for the web. Zero dependencies, framework agnostic, with async options, cross-field reactivity, tabs and modal stacking.",
5
5
  "type": "module",
6
6
  "sideEffects": [
package/CHANGELOG.md DELETED
@@ -1,148 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project are documented here.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
- The next release is a **major** one: the stylesheet you get by default changes.
11
-
12
- ### Changed
13
-
14
- - **Breaking: `declarative-forms/styles.css` is now the modern theme.** It was
15
- the v1 look; the modern light/dark redesign that 2.0 shipped as an opt-in
16
- `theme.css` is what a plain `styles.css` import renders from now on. A first
17
- install should look current without having to find a second import.
18
- - **The v1 look moved to `declarative-forms/classic.css`.** It is byte-for-byte
19
- the same stylesheet, still tokenised, still shipped. Installations whose
20
- overrides were written against it need a one-word import change.
21
- - `declarative-forms/assets/default.css` — the v1 export path — now maps to
22
- `classic.css`, which is the file it always rendered. A migration that kept
23
- that path sees no change at all.
24
- - `declarative-forms/theme.css` still resolves, now to the same file as
25
- `styles.css`, so a 2.0 opt-in import keeps working. Prefer `styles.css`.
26
- - Consequently, **checkboxes are keyboard-reachable by default**: the input is
27
- styled with `appearance: none` rather than hidden behind a pseudo-element.
28
- `classic.css` keeps the old, unreachable markup.
29
-
30
- ### Migration
31
-
32
- - Want the new look: change nothing.
33
- - Want the old look: `import 'declarative-forms/classic.css'` instead of
34
- `styles.css`.
35
- - Overrides that assumed the classic geometry (400px fields, 416px dialogs) or
36
- painted the checkbox pseudo-element need either `classic.css` or the
37
- `--dl-field-width` / `--dl-modal-width` tokens. See
38
- [Themes](https://wolfoo2931.github.io/declarative-forms/guide/theme).
39
-
40
- ## [2.0.0] — 2026-08-16
41
-
42
- ### Added
43
-
44
- - A second stylesheet, `declarative-forms/theme.css`: a modern redesign with
45
- automatic light and dark mode (`prefers-color-scheme`, overridable with
46
- `data-dl-theme`), focus rings, fluid widths and a fuller token set. It is a
47
- standalone alternative to `styles.css`, renders the identical DOM, and mirrors
48
- the default stylesheet's selectors and specificity so existing overrides keep
49
- winning. The default stylesheet is unchanged.
50
- - Under the modern theme, checkboxes are **keyboard-reachable**: the input is
51
- styled directly with `appearance: none` rather than hidden behind a
52
- pseudo-element. The default stylesheet keeps its existing behaviour.
53
- - Two wrapper classes for stacked dialogs: `dl-modal-stacked` on a dialog opened
54
- on top of another, and `dl-modal-restored` on one revealed again after being
55
- covered. Both mark a backdrop that is already on screen, so a theme can skip
56
- its entrance animation. A stacked wrapper also carries `--dl-stack-depth`, the
57
- number of dialogs underneath it.
58
- - Under the modern theme, a stacked dialog now **shows the stack**: the dialogs
59
- below it, which are hidden, are drawn as card edges peeking out above the
60
- dialog on top — one edge for a single dialog below, two for more. Sized with
61
- `--dl-stack-peek` and `--dl-stack-inset`. The default stylesheet is unchanged.
62
-
63
- ### Fixed
64
-
65
- - Opening or closing a stacked dialog no longer flashes the page under the
66
- backdrop. The covered dialog was hidden in the same frame the new one started
67
- fading in, leaving nothing over the page for the length of the animation; the
68
- modern theme now skips that animation for stacked and restored dialogs. The
69
- default stylesheet was never affected — it has no animations.
70
-
71
- ## [2.0.0-alpha.0]
72
-
73
- Complete rewrite in TypeScript with an object-oriented design.
74
-
75
- **The JavaScript API is a clean break; the rendered DOM is deliberately
76
- unchanged.** Stylesheets and DOM-based end-to-end selectors written against v1
77
- keep working. See the [migration guide](https://wolfoo2931.github.io/declarative-forms/migration-v1).
78
-
79
- ### Added
80
-
81
- - Discriminated `kind` on field descriptors, making them fully typable.
82
- - `form.field(name)` — a typed handle with `getValue`, `setValue`, `focus`,
83
- `setLoading`, `element` and `wrapper`.
84
- - `FieldRegistry`, so applications can register their own field kinds.
85
- - Pluggable `TooltipProvider`, with a native zero-dependency default.
86
- - `html()` / `escapeHtml()` for explicit, opt-in markup.
87
- - `whenReady()`, `destroy()`, and an unsubscribe return from
88
- `subscribeOnInput()`.
89
- - `dl-error` event on file-upload failure.
90
- - A `--dl-*` design-token layer and a dark theme.
91
- - Documentation site, and a live example playground under `examples/`.
92
-
93
- ### Changed
94
-
95
- - Package renamed to `declarative-forms`; the export is now named
96
- (`import { DeclarativeForm }`).
97
- - Constructor takes a single options object instead of five positional
98
- arguments.
99
- - Descriptor callbacks receive one context object instead of per-callback
100
- positional argument lists.
101
- - Renamed: `mapFiledsOnEdit` → `mapFieldsOnEdit`,
102
- `onValuesCalculationFailedMessage` → `onOptionsError`,
103
- `closeModalIfOpen` → `close`, `updateCalculatedFields` →
104
- `updateComputedFields`, `mulitple-allowed` → `multiple`.
105
- - `descriptor.domElement` replaced by `form.field(name)`; the library no longer
106
- mutates caller-supplied descriptors.
107
- - Dialog buttons are `<button type="button">` rather than `<div>`, keeping the
108
- `.btn` class.
109
- - Content is rendered as text by default; markup requires `html()`.
110
- - `message` fields no longer appear in `getValues()`.
111
- - `buttons` and `onConfirm` are independent — a single-button map no longer
112
- silently replaces `onConfirm`.
113
- - Test tooling replaced with Vitest, Playwright and tsup.
114
-
115
- ### Removed
116
-
117
- - All runtime dependencies: `tippy.js`, `@popperjs/core`,
118
- `@react-hookz/deep-equal`, and the unused `uuid`.
119
- - The v1 Karma/Jasmine/wdio/Browserify setup, which could not run — its
120
- packages were referenced by scripts but absent from `devDependencies`.
121
-
122
- ### Fixed
123
-
124
- - `<label for>` pointed at a field name that was never an element id, so no
125
- field was ever labelled for assistive technology.
126
- - Checkbox ids collided between a parent form and its array sub-form.
127
- - `getValues()` could not represent `''`, `0` or `false`.
128
- - The internal promise list grew without bound and was never cleared.
129
- - Tabs and tooltips were resolved with `document.querySelector`, so two open
130
- forms fought over each other's state.
131
- - A slow options load could overwrite a newer one; loads are now
132
- generation-guarded.
133
- - Caller data was interpolated as HTML in 21 places.
134
- - Option values containing a quote threw a `DOMException`.
135
- - A keydown listener and a stylesheet were installed as import side effects,
136
- breaking server-side rendering.
137
- - `class DlSelect extends HTMLElement` was evaluated at module load, so simply
138
- importing the package threw `HTMLElement is not defined` in Node and broke
139
- any server-rendered or prerendered app.
140
- - `classList.remove` was written as `Element.remove()`, deleting the confirm
141
- button whenever it showed its loading state.
142
- - `<dl-option>` was never registered as a custom element.
143
- - Buttons flashed disabled on every keystroke, and a well-timed click could be
144
- dropped.
145
-
146
- [Unreleased]: https://github.com/wolfoo2931/declarative-forms/compare/v2.0.0...HEAD
147
- [2.0.0]: https://github.com/wolfoo2931/declarative-forms/compare/v2.0.0-alpha.0...v2.0.0
148
- [2.0.0-alpha.0]: https://github.com/wolfoo2931/declarative-forms/releases/tag/v2.0.0-alpha.0