@uni-design-system/uni-angular 8.4.0 → 9.0.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 CHANGED
@@ -1,5 +1,252 @@
1
1
  # @uni-design-system/uni-angular
2
2
 
3
+ ## 9.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`c0c6056`](https://github.com/uni-design-system/uni/commit/c0c6056c61e994a45af9c379f3c99f55eebcb79a) Thanks [@gaenglish](https://github.com/gaenglish)! - Box learns `flex` / `shrink` / `basis` and `marginInline`.
8
+
9
+ **`flex`.** `grow` emits `flex-grow` alone, which leaves `flex-basis: auto` — so
10
+ it cannot express `flex: 1`, and any layout wanting siblings to share space
11
+ evenly regardless of content width had to stay in CSS. `[flex]="1"` now emits
12
+ the shorthand; `shrink` and `basis` cover the rest. `grow` is unchanged, so no
13
+ existing layout moves.
14
+
15
+ These three go through a new `ThemeService.styleIfSet()`, which treats only
16
+ `undefined` as unset — the shared `style()` helper drops falsy values, which
17
+ would have silently swallowed `[shrink]="0"`, the single most useful value.
18
+
19
+ **`marginInline`.** `margin: 0 auto` on a max-width container had no Box
20
+ equivalent, so page shells kept an inline style for it. `marginInline="auto"`
21
+ centers such a container, and a spacing token works too.
22
+
23
+ ```html
24
+ <main box-layout maxWidth="1200px" marginInline="auto" padding="lg">…</main>
25
+ ```
26
+
27
+ Only the inline axis is exposed. Block margins collapse and fight `gap`, which
28
+ is why the primitives carry no margin otherwise — inline margins do neither, so
29
+ this is a deliberate line rather than a crack in the token-only surface.
30
+
31
+ - [`8250162`](https://github.com/uni-design-system/uni/commit/8250162c35e418f976080904df4c20783feeb6e2) Thanks [@gaenglish](https://github.com/gaenglish)! - Every deprecated API is removed. The library now carries no `@deprecated`
32
+ symbols at all.
33
+
34
+ **Per-component duration options → the `motion` scale.** Six components carried
35
+ their own duration knob that predated the motion scale and _won over_ it:
36
+ `expand.transitionSpeed`, `callout.transitionMs`, `radio.transitionSpeed`,
37
+ `menuItem.transitionSpeed`, `alert.transitionSpeed` and
38
+ `snackbar.transitionDelay`. All are gone, along with the precedence branch each
39
+ one required — timing now comes from the token, full stop.
40
+
41
+ Retime the token instead; one edit covers every component pointing at it. To
42
+ retime a single component, define a token of your own and point that
43
+ component's `motion` option at it:
44
+
45
+ ```ts
46
+ createTheme({
47
+ …,
48
+ motion: { productive: { duration: 110, easing: 'ease' } },
49
+ components: { menuItem: { options: { motion: 'productive' } } },
50
+ });
51
+ ```
52
+
53
+ A `duration: 0` token is how a theme opts out of motion — that is what
54
+ `transitionSpeed: 0` used to mean. Both showcase themes are migrated this way
55
+ (Carbon to a 110ms `productive` token, Wellsourced to an `instant` one).
56
+
57
+ **Options that never did anything.** `card.transitionSpeed` and
58
+ `inputBox.transitionSpeed` were read by nothing and never had been. Delete them
59
+ from your theme; nothing replaces them.
60
+
61
+ **Renames and obsolete APIs**
62
+ - `inputBox.typeFace` → `typeface` (the casing every other component uses).
63
+ - `uni-tooltip`'s `appendToBody` input — inert since the tooltip moved to the
64
+ native top layer, which escapes any overflow context by itself.
65
+ - Box's `elevation` input → `shadow`, in both the Angular and React packages.
66
+ It was a second name for the same thing.
67
+ - The Angular `icons` re-export → import `BaseIcons` from
68
+ `@uni-design-system/uni-core`. The default set ships with every theme.
69
+
70
+ **The HSL color legacy is gone from uni-core.** `uniColor`, `randomRangeValue`,
71
+ `CategorySaturation` and `CategoryLightness` are removed, superseded by the
72
+ deterministic OKLCH engine (`generateThemes` / `generatePalette`) — same input,
73
+ same theme, WCAG-checked. `RoleHues` and the `UniColor` type go with them: they
74
+ were reachable only through `uniColor`, and `RoleHues` had gone stale enough to
75
+ hold saturation values in a table of hues.
76
+
77
+ **Deferred output renames.** Three outputs were held back because renaming is
78
+ breaking; this is that release. Each also drops an eslint escape it needed for
79
+ shadowing a native event name or using an `on` prefix.
80
+
81
+ | Component | Before | After |
82
+ | -------------------- | ----------------- | ---------------- |
83
+ | `uni-debounce-input` | `(change)` | `(valueChange)` |
84
+ | `uni-search-input` | `(change)` | `(searchChange)` |
85
+ | `uni-search-input` | `(search)` | `(searchSubmit)` |
86
+ | `dragAndDrop` | `(onFileDropped)` | `(fileDropped)` |
87
+
88
+ **`uni-dropdown`'s `color` input → `containerColor`,** completing the rule the
89
+ layout directives set: every container-pair input in the library is now
90
+ `containerColor`, and plain `color` always means the CSS property.
91
+
92
+ **`ThemeService.getSpacing('none')` now returns `0`, not the string `'none'`.**
93
+ `'none'` is not a valid length, so it was silently dropped wherever it landed —
94
+ `uni-menu` carried a comment working around exactly that, which is now deleted.
95
+
96
+ - [`c0c6056`](https://github.com/uni-design-system/uni/commit/c0c6056c61e994a45af9c379f3c99f55eebcb79a) Thanks [@gaenglish](https://github.com/gaenglish)! - `uni-input` gets a `type`, and the input chrome stops needing a wrapper div.
97
+
98
+ **Types.** `uni-input` was text-only with no `type` at all, so every email, URL,
99
+ number and phone field had to fall back to `uni-input-box` plus a hand-written
100
+ native `<input>`, and `type="password"` could not go through it. It now takes
101
+ the text-like types: `text` (default), `email`, `password`, `search`, `tel`,
102
+ `url`, `number`.
103
+
104
+ Non-text types (`checkbox`, `radio`, `file`, `range`, `color`) stay out — they
105
+ break both the input chrome and the `FormValueControl<string>` value contract —
106
+ as do `date` / `time` / `datetime-local`, which have dedicated components.
107
+
108
+ **Native passthroughs.** `autocomplete`, `inputMode`, `list` (a `<datalist>` id),
109
+ `step` and `spellcheck` are plain passthroughs; an unset one emits no attribute.
110
+ `readonly`, `name`, `min`, `max`, `minLength`, `maxLength` and `pattern` are
111
+ Signal Forms' own optional control inputs, so the `[field]` directive syncs them
112
+ from your validators exactly as it already syncs `required` — and they are
113
+ reflected onto the native element so the browser contributes too. Signal Forms
114
+ treats multiple `pattern`s as all-must-match, which the native attribute cannot
115
+ express, so it is reflected only when there is exactly one.
116
+
117
+ `uni-textarea` gains `readonly`, `name`, `minLength`, `maxLength`, `autocomplete`
118
+ and `spellcheck`; `uni-debounce-input` gains `type`, `autocomplete` and
119
+ `inputMode`.
120
+
121
+ **Sizing.** `uni-input-box`'s host is `display: contents`, so a width or layout
122
+ attribute set on the element itself was silently dropped and every call site
123
+ needed a wrapper `<div>`. It now takes `width`, `fullWidth` and `grow` (joining
124
+ `minWidth`), which reach the real box inside; `uni-input`, `uni-textarea` and
125
+ `uni-select` forward all four. The `display: contents` behavior is now documented
126
+ too — it stays surprising even once sizing works.
127
+
128
+ Both `uni-input` and `uni-debounce-input` now accept the adornment slots as
129
+ either element or attribute selectors (`<span pre-input>` as well as
130
+ `<pre-input>`), which had drifted apart between them.
131
+
132
+ - [`c0c6056`](https://github.com/uni-design-system/uni/commit/c0c6056c61e994a45af9c379f3c99f55eebcb79a) Thanks [@gaenglish](https://github.com/gaenglish)! - The layout primitives and `uni-text` are now **directives**, so they compose.
133
+
134
+ They were components with attribute-only selectors, which meant any two of them
135
+ on one element threw NG0300 ("multiple components match"). `<div row-layout
136
+ uni-text="title-small">` — the most natural thing to write — threw in dev only,
137
+ so it reached production as a silent style mismatch. `<uni-card box-layout>`
138
+ was blocked for the same reason, and `box.component.ts` documented the
139
+ wrap-it-in-a-div workaround as permanent.
140
+
141
+ All eight are pure host-styling wrappers (an `<ng-content>`-only template plus a
142
+ `[class]` host binding), so as directives they render identically and now stack
143
+ freely — with each other, with `uni-text`, and with a component's own host
144
+ element. Angular reconciles the host `class` bindings additively, so each
145
+ contributor's styles survive rather than one silently winning; there is a spec
146
+ pinning that.
147
+
148
+ ```html
149
+ <div row-layout uni-text="title-small" padding="md">Heading</div>
150
+ <uni-card box-layout padding="lg">…</uni-card>
151
+ ```
152
+
153
+ **BREAKING: class renames.** `UniBoxComponent` → `UniBoxDirective`, and likewise
154
+ for Row, Stack, Center, Wrap, Grid, GridArea and Text. No compatibility aliases:
155
+ a major is where the break belongs, and an alias shipped on day one of a major
156
+ tends to survive to the next one. Rename the symbols in your `imports: []`.
157
+
158
+ **BREAKING: the layout directives' `color` is now `containerColor`.**
159
+
160
+ Composing the two directives exposed a name collision. `color` was an input on
161
+ both — a _container pair_ on the layout primitives, the CSS `color` property on
162
+ `uni-text` — so on a shared element one binding fed both: the box painted the
163
+ surface, the text took the same token, and the text rendered as ink on identical
164
+ ink. A deprecated alias would have kept that path alive, so there isn't one.
165
+
166
+ `color` belongs to `uni-text`, which maps it straight to the CSS property. The
167
+ container pair is an invented concept and now says so:
168
+
169
+ ```html
170
+ <!-- before -->
171
+ <div box-layout color="surface">
172
+ <!-- after -->
173
+ <div box-layout containerColor="surface"></div>
174
+ </div>
175
+ ```
176
+
177
+ This applies to all seven layout directives (Box and its subclasses) and to
178
+ `uni-scroll-area`, which is attribute-selected too and carried the identical
179
+ hazard. `backgroundColor`, which sets only the background and no paired
180
+ on-color, is unchanged, as is `color` on `uni-icon` / `uni-skeleton` /
181
+ `uni-badge` — there it already means a foreground color, the same sense as
182
+ `uni-text`'s.
183
+
184
+ Codemod: rename `color` → `containerColor` on any element carrying a `*-layout`
185
+ or `scroll-area` attribute; leave `color` alone everywhere else.
186
+
187
+ The rename fixed the input collision; a second one sat underneath it in CSS.
188
+ `containerColor` emits a background **and** its paired on-color, so both
189
+ directives write `color` to the element — at equal specificity, which left the
190
+ cascade to Emotion's insertion order (text won on `row-layout`, lost on
191
+ `scroll-area`). An explicit `uni-text` `color` is now emitted at doubled
192
+ specificity, so it deterministically wins; with no explicit color, the
193
+ container's on-color still shows through as intended.
194
+
195
+ `uni-dropdown` still names its container pair `color`. It is an element selector
196
+ (`<uni-dropdown>`), so the collision needs someone to put `uni-text` on a
197
+ component host — possible, but not the natural path the layout attributes are.
198
+
199
+ **New: `UNI_LAYOUT` and `UNI_FORMS`.** These are attribute selectors, so an
200
+ element carrying one whose directive was never imported compiles cleanly and
201
+ silently does nothing. Spreading a family is the cheapest guard:
202
+
203
+ ```ts
204
+ imports: [...UNI_LAYOUT];
205
+ ```
206
+
207
+ - [`c0c6056`](https://github.com/uni-design-system/uni/commit/c0c6056c61e994a45af9c379f3c99f55eebcb79a) Thanks [@gaenglish](https://github.com/gaenglish)! - The spacing scale is open, and `createTheme` finally accepts one.
208
+
209
+ The scale was a closed seven-name union on a doubling curve (2/4/8/16/32/64px).
210
+ Real layouts are rarely built exclusively on one — the gaps between 8 and 16,
211
+ and 16 and 32, are where a lot of real spacing lives — and there was no way to
212
+ add a step, because **`ThemeConfig` had no `spacing` field at all**:
213
+ `createTheme` hardcoded the base scale. The Wellsourced showcase theme had to
214
+ bolt its scale on after the fact with a post-hoc spread.
215
+
216
+ Three changes, which only work together:
217
+ - `NullableSize` gains a `(string & {})` arm, so any name the theme defines is a
218
+ valid `padding` / `gap` / `marginInline` value while the seven named steps keep
219
+ their autocomplete. `Size` itself stays closed — it also types _component_
220
+ sizes, where an arbitrary name has nothing to resolve against.
221
+ - `Spacing` is spelled out as named-optional-keys plus an index signature
222
+ (mirroring `Typography`), rather than a `Partial<Record<…>>` that would
223
+ collapse to a plain string record and lose the named steps.
224
+ - `createTheme({ spacing })` merges over the base scale.
225
+
226
+ ```ts
227
+ createTheme({ id, name, colors, spacing: { tight: '6px', snug: '10px' } });
228
+ ```
229
+
230
+ ```html
231
+ <div stack-layout padding="tight" gap="snug">…</div>
232
+ ```
233
+
234
+ Because the scale is open, a mistyped token can no longer be a compile error. It
235
+ is dropped — an `undefined` CSS value simply does not render — and
236
+ `ThemeService` now warns once per unknown token in development, naming the
237
+ tokens the active theme does define. Scaffolded `uni-theme.ts` files carry a
238
+ `spacing` block so the static theme file stays the editable source of truth.
239
+
240
+ **Behavior change:** `xxl` was in the `Size` union but defined by no base theme,
241
+ so `padding="xxl"` type-checked and rendered nothing. It is now `128px`,
242
+ completing the doubling — any element relying on the silent drop will start
243
+ showing spacing.
244
+
245
+ ### Patch Changes
246
+
247
+ - Updated dependencies [[`8250162`](https://github.com/uni-design-system/uni/commit/8250162c35e418f976080904df4c20783feeb6e2), [`c0c6056`](https://github.com/uni-design-system/uni/commit/c0c6056c61e994a45af9c379f3c99f55eebcb79a)]:
248
+ - @uni-design-system/uni-core@9.0.0
249
+
3
250
  ## 8.4.0
4
251
 
5
252
  ### Minor Changes