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