@zazz-ui/core 0.7.0 → 0.8.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/AUTHORING.md +21 -20
- package/CHANGELOG.md +145 -0
- package/README.md +4 -4
- package/dist/sri.json +84 -83
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/editor/zazz.css-data.json +4129 -1410
- package/editor/zazz.html-data.json +15 -3
- package/editor/zazz.language-data.json +99 -97
- package/editor/zazz.lint-data.json +1609 -1283
- package/package.json +1 -1
- package/src/base/_defaults.css +48 -2
- package/src/base/_properties-2xl.css +12 -0
- package/src/base/_properties-active.css +20 -0
- package/src/base/_properties-checked.css +20 -0
- package/src/base/_properties-current.css +20 -0
- package/src/base/_properties-disabled.css +20 -0
- package/src/base/_properties-focus-visible.css +20 -0
- package/src/base/_properties-focus-within.css +20 -0
- package/src/base/_properties-hover.css +20 -0
- package/src/base/_properties-lg.css +12 -0
- package/src/base/_properties-md.css +12 -0
- package/src/base/_properties-open.css +20 -0
- package/src/base/_properties-sm.css +12 -0
- package/src/base/_properties-starting.css +10 -0
- package/src/base/_properties-stuck.css +10 -0
- package/src/base/_properties-xl.css +12 -0
- package/src/base/_properties.css +46 -6
- package/src/base/_shadows.css +46 -0
- package/src/base/_utilities-box.css +182 -9
- package/src/base/_utilities-color.css +1 -0
- package/src/base/_utilities-effects.css +41 -139
- package/src/base/_utilities-flow.css +1 -0
- package/src/base/_utilities-grid.css +1 -0
- package/src/base/_utilities-margin.css +1 -0
- package/src/base/_utilities-pseudo.css +58 -4
- package/src/base/_utilities-sizing.css +1 -0
- package/src/base/_utilities-spacing.css +173 -0
- package/src/base/_utilities-tier-2xl.css +6 -0
- package/src/base/_utilities-tier-active.css +10 -0
- package/src/base/_utilities-tier-checked.css +10 -0
- package/src/base/_utilities-tier-current.css +10 -0
- package/src/base/_utilities-tier-disabled.css +10 -0
- package/src/base/_utilities-tier-focus-visible.css +10 -0
- package/src/base/_utilities-tier-focus-within.css +10 -0
- package/src/base/_utilities-tier-hover.css +10 -0
- package/src/base/_utilities-tier-lg.css +6 -0
- package/src/base/_utilities-tier-md.css +6 -0
- package/src/base/_utilities-tier-open.css +10 -0
- package/src/base/_utilities-tier-sm.css +6 -0
- package/src/base/_utilities-tier-starting.css +5 -0
- package/src/base/_utilities-tier-stuck.css +5 -0
- package/src/base/_utilities-tier-xl.css +6 -0
- package/src/base/_utilities-typography.css +1 -0
- package/src/base/_variables.css +5 -85
- package/src/base/kit-styling.d.ts.map +1 -1
- package/src/base/kit-styling.js +173 -136
- package/src/base/kit-styling.ts +173 -136
- package/src/base/reveal.d.ts +3 -3
- package/src/base/reveal.d.ts.map +1 -1
- package/src/base/reveal.js +34 -18
- package/src/base/reveal.ts +42 -20
- package/src/base/utilities.d.ts +18 -8
- package/src/base/utilities.d.ts.map +1 -1
- package/src/base/utilities.js +112 -18
- package/src/base/utilities.ts +124 -22
- package/src/index.css +1 -0
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +1 -0
- package/src/manifest.ts +1 -0
- package/src/primitives/avatar/avatar.html +2 -2
- package/src/primitives/badge/badge.css +14 -10
- package/src/primitives/button/button.css +17 -13
- package/src/primitives/button-group/button-group.css +13 -6
- package/src/primitives/callout/callout.css +6 -2
- package/src/primitives/card/card-subgrid.html +3 -3
- package/src/primitives/card/card.css +8 -4
- package/src/primitives/card/card.html +2 -2
- package/src/primitives/carousel/carousel.html +12 -12
- package/src/primitives/checkbox/checkbox.css +6 -2
- package/src/primitives/combobox/combobox.css +8 -4
- package/src/primitives/debug/audit-core.d.ts.map +1 -1
- package/src/primitives/debug/audit-core.js +8 -4
- package/src/primitives/debug/audit-core.ts +9 -4
- package/src/primitives/dialog/dialog-with-form.html +1 -1
- package/src/primitives/dialog/dialog.css +35 -14
- package/src/primitives/fields/fields.css +8 -4
- package/src/primitives/input/input.css +6 -2
- package/src/primitives/input-group/input-group.css +5 -1
- package/src/primitives/kbd/kbd.css +6 -2
- package/src/primitives/layout/layout.html +1 -1
- package/src/primitives/lightbox/lightbox.css +12 -16
- package/src/primitives/lightbox/lightbox.html +1 -1
- package/src/primitives/menu/menu.css +3 -3
- package/src/primitives/meter/meter.css +6 -2
- package/src/primitives/mobile-menu/mobile-menu.css +2 -2
- package/src/primitives/mobile-menu/mobile-menu.html +1 -1
- package/src/primitives/navigation-menu/navigation-menu-featured.html +1 -1
- package/src/primitives/navigation-menu/navigation-menu.css +4 -4
- package/src/primitives/navigation-menu/navigation-menu.html +1 -1
- package/src/primitives/otp/otp.css +6 -2
- package/src/primitives/password-group/password-group.css +5 -1
- package/src/primitives/popover/popover.css +8 -4
- package/src/primitives/progress/progress.css +6 -2
- package/src/primitives/radio/radio.css +6 -2
- package/src/primitives/reveal/reveal.css +17 -11
- package/src/primitives/select/select.css +15 -7
- package/src/primitives/slider/slider.css +7 -7
- package/src/primitives/switch/switch.css +6 -2
- package/src/primitives/tabs/tabs.css +10 -6
- package/src/primitives/tabs/tabs.html +6 -6
- package/src/primitives/textarea/textarea.css +6 -2
- package/src/primitives/toaster/toaster.css +2 -2
- package/src/primitives/toggle/toggle.css +9 -5
- package/src/primitives/toggle-group/toggle-group.css +13 -6
- package/src/primitives/toolbar/toolbar.html +1 -1
- package/src/primitives/tooltip/tooltip.css +6 -2
- package/src/primitives/utilities/aspect-ratio.html +3 -3
- package/src/primitives/utilities/basis.html +5 -5
- package/src/primitives/utilities/col-span.html +5 -5
- package/src/primitives/utilities/compose.html +2 -2
- package/src/primitives/utilities/flex-align.html +3 -3
- package/src/primitives/utilities/flex-direction.html +6 -6
- package/src/primitives/utilities/flex-grow.html +3 -3
- package/src/primitives/utilities/gap.html +9 -9
- package/src/primitives/utilities/grid-cols.html +6 -6
- package/src/primitives/utilities/grid-responsive.html +8 -8
- package/src/primitives/utilities/margin-auto.html +3 -3
- package/src/primitives/utilities/object-fit.html +3 -3
- package/src/primitives/utilities/order.html +3 -3
- package/src/primitives/utilities/overflow.html +2 -2
- package/src/primitives/utilities/padding-compose.html +6 -6
- package/src/primitives/utilities/padding.html +8 -8
- package/src/primitives/utilities/pile.html +1 -1
- package/src/primitives/utilities/position.html +2 -2
- package/src/primitives/utilities/responsive-flex.html +3 -3
- package/src/primitives/utilities/responsive-grid.html +8 -8
- package/src/primitives/utilities/size.html +5 -5
- package/src/primitives/utilities/width.html +5 -5
package/src/base/reveal.ts
CHANGED
|
@@ -15,8 +15,8 @@ interface RevealConfig {
|
|
|
15
15
|
wait: number;
|
|
16
16
|
/** Default translation distance for slide animations. */
|
|
17
17
|
distance: string;
|
|
18
|
-
/** Default delay between staggered elements
|
|
19
|
-
step: number;
|
|
18
|
+
/** Default delay between staggered elements (ms number or CSS time string). */
|
|
19
|
+
step: number | string;
|
|
20
20
|
/** Scale factor for grow animations (< 1). */
|
|
21
21
|
grow: number;
|
|
22
22
|
/** Scale factor for shrink animations (> 1). */
|
|
@@ -43,6 +43,12 @@ interface RevealOptions {
|
|
|
43
43
|
* <div>Item 1</div>
|
|
44
44
|
* <div>Item 2</div>
|
|
45
45
|
* </div>
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* <!-- Stagger step from CSS: the group or any ancestor (theme, section) -->
|
|
49
|
+
* <section style="--ui-reveal-global-stagger-step: 60ms">
|
|
50
|
+
* <ul data-reveal-each="slide-up">…</ul>
|
|
51
|
+
* </section>
|
|
46
52
|
*/
|
|
47
53
|
|
|
48
54
|
/**
|
|
@@ -90,7 +96,7 @@ function parseCssTimeMs(value: string): number {
|
|
|
90
96
|
* ease: "ease-in-out",
|
|
91
97
|
* threshold: 0.3,
|
|
92
98
|
* margin: "100px",
|
|
93
|
-
* step: 40,
|
|
99
|
+
* step: 40, // or "40ms"; sets --ui-reveal-global-stagger-step
|
|
94
100
|
* },
|
|
95
101
|
* });
|
|
96
102
|
*/
|
|
@@ -114,11 +120,11 @@ class Reveal {
|
|
|
114
120
|
return {
|
|
115
121
|
margin: "0px",
|
|
116
122
|
threshold: 0.2,
|
|
117
|
-
duration: getRootCssVar("--ui-reveal-global-duration") || "
|
|
123
|
+
duration: getRootCssVar("--ui-reveal-global-duration") || "1000ms",
|
|
118
124
|
ease: getRootCssVar("--ui-reveal-global-timing-function") || "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
119
125
|
wait: parseCssTimeMs(getRootCssVar("--ui-reveal-global-wait")),
|
|
120
|
-
distance: getRootCssVar("--ui-reveal-global-distance") || "
|
|
121
|
-
step:
|
|
126
|
+
distance: getRootCssVar("--ui-reveal-global-distance") || "2rem",
|
|
127
|
+
step: getRootCssVar("--ui-reveal-global-stagger-step") || "120ms",
|
|
122
128
|
grow: parseFloat(getRootCssVar("--ui-reveal-global-grow")) || 0.97,
|
|
123
129
|
shrink: parseFloat(getRootCssVar("--ui-reveal-global-shrink")) || 1.03,
|
|
124
130
|
};
|
|
@@ -215,10 +221,13 @@ class Reveal {
|
|
|
215
221
|
* @description Configures stagger animation properties and observes child elements.
|
|
216
222
|
*
|
|
217
223
|
* The stagger delay (`base + step × position`) is computed natively where
|
|
218
|
-
* possible:
|
|
219
|
-
*
|
|
220
|
-
* reveal
|
|
221
|
-
*
|
|
224
|
+
* possible: each child derives its own `--ui-reveal-wait` via `sibling-index()`
|
|
225
|
+
* in reveal.css (reversed groups count from the end via `sibling-count()`),
|
|
226
|
+
* reading `--ui-reveal-stagger-base`/`--ui-reveal-stagger-step` from the
|
|
227
|
+
* cascade. Those are written inline only for `data-reveal-wait`/`data-reveal-step`,
|
|
228
|
+
* so CSS can set the step on the group or any ancestor (directly, or by
|
|
229
|
+
* overriding `--ui-reveal-global-stagger-step`). Where unsupported (Firefox),
|
|
230
|
+
* the same values are resolved from computed style and the math lands as a
|
|
222
231
|
* per-child inline `--ui-reveal-wait`.
|
|
223
232
|
*
|
|
224
233
|
* @param groupElement - The parent stagger container.
|
|
@@ -228,13 +237,14 @@ class Reveal {
|
|
|
228
237
|
const groupOptions = this.#getElementObserverOptions(groupElement);
|
|
229
238
|
const groupObserver = this.#getObserver(groupOptions);
|
|
230
239
|
|
|
240
|
+
const stepAttr = dataset.revealStep ? Math.max(0, parseCssTimeMs(dataset.revealStep)) : null;
|
|
241
|
+
const waitAttr = dataset.revealWait ? Math.max(0, parseCssTimeMs(dataset.revealWait)) : null;
|
|
242
|
+
|
|
231
243
|
const groupConfig = {
|
|
232
|
-
step: Math.max(0, parseInt(dataset.revealStep || this.config.step.toString(), 10) || 0),
|
|
233
244
|
duration: dataset.revealDuration
|
|
234
245
|
? Math.max(0, parseInt(dataset.revealDuration, 10) || 0)
|
|
235
246
|
: this.config.duration,
|
|
236
247
|
ease: dataset.revealEase || this.config.ease,
|
|
237
|
-
baseWait: Math.max(0, parseInt(dataset.revealWait || this.config.wait.toString(), 10) || 0),
|
|
238
248
|
distance: dataset.revealDistance || this.config.distance,
|
|
239
249
|
order: dataset.revealOrder,
|
|
240
250
|
};
|
|
@@ -242,11 +252,24 @@ class Reveal {
|
|
|
242
252
|
const childrenArray = Array.from(groupElement.children);
|
|
243
253
|
const sequence = groupConfig.order === "reversed" ? childrenArray.reverse() : childrenArray;
|
|
244
254
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
255
|
+
// Attributes win; otherwise the cascade (inline style, CSS, globals) decides.
|
|
256
|
+
this.#setRevealProperties(groupElement, {
|
|
257
|
+
"--ui-reveal-stagger-base": waitAttr !== null ? `${waitAttr}ms` : null,
|
|
258
|
+
"--ui-reveal-stagger-step": stepAttr !== null ? `${stepAttr}ms` : null,
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
// Fallback only: resolve the same cascade reveal.css uses natively.
|
|
262
|
+
let baseWait = 0;
|
|
263
|
+
let step = 0;
|
|
264
|
+
if (!supportsSiblingIndex) {
|
|
265
|
+
const computed = getComputedStyle(groupElement);
|
|
266
|
+
const cssTime = (local: string, global: string) =>
|
|
267
|
+
Math.max(
|
|
268
|
+
0,
|
|
269
|
+
parseCssTimeMs(computed.getPropertyValue(local) || computed.getPropertyValue(global)),
|
|
270
|
+
);
|
|
271
|
+
baseWait = cssTime("--ui-reveal-stagger-base", "--ui-reveal-global-wait");
|
|
272
|
+
step = cssTime("--ui-reveal-stagger-step", "--ui-reveal-global-stagger-step");
|
|
250
273
|
}
|
|
251
274
|
|
|
252
275
|
sequence.forEach((child, i) => {
|
|
@@ -256,9 +279,7 @@ class Reveal {
|
|
|
256
279
|
"--ui-reveal-duration": this.#formatTime(groupConfig.duration),
|
|
257
280
|
"--ui-reveal-ease": groupConfig.ease,
|
|
258
281
|
// Fallback only: natively each child computes this in reveal.css.
|
|
259
|
-
"--ui-reveal-wait": supportsSiblingIndex
|
|
260
|
-
? null
|
|
261
|
-
: `${groupConfig.baseWait + groupConfig.step * i}ms`,
|
|
282
|
+
"--ui-reveal-wait": supportsSiblingIndex ? null : `${baseWait + step * i}ms`,
|
|
262
283
|
"--ui-reveal-distance": groupConfig.distance,
|
|
263
284
|
"--ui-reveal-scale": dataset.revealScale || null,
|
|
264
285
|
});
|
|
@@ -310,6 +331,7 @@ class Reveal {
|
|
|
310
331
|
rootStyle.setProperty("--ui-reveal-global-distance", this.config.distance);
|
|
311
332
|
rootStyle.setProperty("--ui-reveal-global-grow", this.config.grow.toString());
|
|
312
333
|
rootStyle.setProperty("--ui-reveal-global-shrink", this.config.shrink.toString());
|
|
334
|
+
rootStyle.setProperty("--ui-reveal-global-stagger-step", this.#formatTime(this.config.step));
|
|
313
335
|
|
|
314
336
|
document.querySelectorAll("[data-reveal]").forEach((element) => {
|
|
315
337
|
if (element instanceof HTMLElement) this.#configureSingleElement(element);
|
package/src/base/utilities.d.ts
CHANGED
|
@@ -97,6 +97,11 @@ export interface Utility {
|
|
|
97
97
|
* inherit, for a switch that draws them on the element's children (`--divide`).
|
|
98
98
|
*/
|
|
99
99
|
inherits?: true;
|
|
100
|
+
/**
|
|
101
|
+
* What a dual utility's number multiplies (default `var(--spacing)`):
|
|
102
|
+
* `--radius: 2` is two steps of `--spacing` times `--radius-multiplier`.
|
|
103
|
+
*/
|
|
104
|
+
scale?: string;
|
|
100
105
|
/**
|
|
101
106
|
* No-base allowlist: the CSS initial value as a literal. A utility with
|
|
102
107
|
* `noBase` applies a tier without a base value wherever no kit rule sets its
|
|
@@ -118,19 +123,19 @@ export interface Utility {
|
|
|
118
123
|
*/
|
|
119
124
|
pseudo?: true;
|
|
120
125
|
/**
|
|
121
|
-
* Keyword shorthands: `--
|
|
126
|
+
* Keyword shorthands: `--font-weight: strong` reads as `var(--font-weight-strong)`.
|
|
122
127
|
* Each is an exact-value rule at the base and at every tier of the family, so
|
|
123
|
-
* it works in `--
|
|
128
|
+
* it works in `--font-weight--md: strong` too; any other value passes through as
|
|
124
129
|
* usual. A keyword that is a prefix of another must come first.
|
|
125
130
|
*/
|
|
126
131
|
aliases?: Readonly<Record<string, string>>;
|
|
127
132
|
}
|
|
128
133
|
/**
|
|
129
|
-
* The utilities that compose into one `box-shadow` (
|
|
130
|
-
* composite's chains all end in a literal, so a tier alone
|
|
131
|
-
* a no-base utility.
|
|
134
|
+
* The utilities that compose into one `box-shadow` (the rings, shadow, and
|
|
135
|
+
* elevation): the composite's chains all end in a literal, so a tier alone
|
|
136
|
+
* works on them, like a no-base utility.
|
|
132
137
|
*/
|
|
133
|
-
export declare const BOX_SHADOW_COMPOSITE: readonly ["shadow", "ring", "ring-color", "ring-offset", "ring-offset-color"];
|
|
138
|
+
export declare const BOX_SHADOW_COMPOSITE: readonly ["shadow", "ring", "ring-color", "ring-offset", "ring-offset-color", "elevation"];
|
|
134
139
|
/**
|
|
135
140
|
* The shorthands whose base a longhand's tier overrides, nearest first: `--p: 4;
|
|
136
141
|
* --px--md: 1` pads 4 below md and 1 inline from md. A shorthand's base is a
|
|
@@ -139,8 +144,6 @@ export declare const BOX_SHADOW_COMPOSITE: readonly ["shadow", "ring", "ring-col
|
|
|
139
144
|
export declare const SHORTHAND_OF: Readonly<Record<string, readonly string[]>>;
|
|
140
145
|
/** Gradient types: `--bg-<type>` emits `<type>-gradient(<prelude>, <--bg-stops>)`. */
|
|
141
146
|
export declare const GRADIENT_TYPES: readonly ["linear", "radial", "conic"];
|
|
142
|
-
/** The size scale shared by the token keywords (`--shadow: md`). */
|
|
143
|
-
export declare const SIZE_KEYWORDS: readonly ["2xs", "xs", "sm", "md", "lg", "xl", "2xl"];
|
|
144
147
|
/** Standard weight names and the number to write instead (`normal` and `bold` are CSS). */
|
|
145
148
|
export declare const FONT_WEIGHT_NAMES: Readonly<Record<string, number>>;
|
|
146
149
|
/**
|
|
@@ -176,6 +179,13 @@ export declare const BORDER_SIDES: readonly [{
|
|
|
176
179
|
/** The four sizing keywords. Margin takes only `auto`. */
|
|
177
180
|
export declare const SIZING_KEYWORDS: readonly ["auto", "fit-content", "min-content", "max-content"];
|
|
178
181
|
export declare const MARGIN_KEYWORDS: readonly ["auto"];
|
|
182
|
+
/**
|
|
183
|
+
* Keywords the side insets (`--top --right --bottom --left`) take besides a
|
|
184
|
+
* length: `auto` releases a side at a breakpoint (`--bottom: 0; --bottom--lg:
|
|
185
|
+
* auto` sticks to the bottom below lg only). Each keyword costs ~16 [style*=]
|
|
186
|
+
* substrings (SPEC claim 16), so the axis and `--inset` shorthands go without.
|
|
187
|
+
*/
|
|
188
|
+
export declare const INSET_KEYWORDS: readonly ["auto"];
|
|
179
189
|
/**
|
|
180
190
|
* Track-list keywords `--grid-cols` / `--grid-rows` take besides a count. `none`
|
|
181
191
|
* is not one: `--template-cols: none` says the same, and every keyword
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["utilities.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,qDAAqD;AACrD,eAAO,MAAM,WAAW,YAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AACpE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD;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AAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,YAAI,MAAM,CAAU,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,YAAI,SAAS,CAAU,CAAC;AAE3D,qFAAqF;AACrF,eAAO,MAAM,SAAS,EAAE,SAAS,OAAO,EAorBvC,CAAC;AAEF,oDAAoD;AACpD,eAAO,MAAM,WAAW,EAAE,SAAS,OAAO,EAEzC,CAAC;AAEF,eAAO,MAAM,YAAY,YAAI,QAAQ,EAAE,OAAO,CAAU,CAAC;AACzD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,6DAA6D;AAC7D,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAM3D;AAED,qDAAqD;AACrD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAID,sGAAsG;AACtG,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAyBzD"}
|
package/src/base/utilities.js
CHANGED
|
@@ -104,9 +104,9 @@ export const FAMILY_TIERS = {
|
|
|
104
104
|
box: "none",
|
|
105
105
|
};
|
|
106
106
|
/**
|
|
107
|
-
* The utilities that compose into one `box-shadow` (
|
|
108
|
-
* composite's chains all end in a literal, so a tier alone
|
|
109
|
-
* a no-base utility.
|
|
107
|
+
* The utilities that compose into one `box-shadow` (the rings, shadow, and
|
|
108
|
+
* elevation): the composite's chains all end in a literal, so a tier alone
|
|
109
|
+
* works on them, like a no-base utility.
|
|
110
110
|
*/
|
|
111
111
|
export const BOX_SHADOW_COMPOSITE = [
|
|
112
112
|
"shadow",
|
|
@@ -114,6 +114,7 @@ export const BOX_SHADOW_COMPOSITE = [
|
|
|
114
114
|
"ring-color",
|
|
115
115
|
"ring-offset",
|
|
116
116
|
"ring-offset-color",
|
|
117
|
+
"elevation",
|
|
117
118
|
];
|
|
118
119
|
/**
|
|
119
120
|
* The shorthands whose base a longhand's tier overrides, nearest first: `--p: 4;
|
|
@@ -131,13 +132,13 @@ export const SHORTHAND_OF = {
|
|
|
131
132
|
"gap-y": ["gap"],
|
|
132
133
|
basis: ["flex"],
|
|
133
134
|
shrink: ["flex"],
|
|
135
|
+
"radius-t": ["radius"],
|
|
136
|
+
"radius-b": ["radius"],
|
|
137
|
+
"radius-l": ["radius"],
|
|
138
|
+
"radius-r": ["radius"],
|
|
134
139
|
};
|
|
135
140
|
/** Gradient types: `--bg-<type>` emits `<type>-gradient(<prelude>, <--bg-stops>)`. */
|
|
136
141
|
export const GRADIENT_TYPES = ["linear", "radial", "conic"];
|
|
137
|
-
/** The size scale shared by the token keywords (`--shadow: md`). */
|
|
138
|
-
export const SIZE_KEYWORDS = ["2xs", "xs", "sm", "md", "lg", "xl", "2xl"];
|
|
139
|
-
/** `--shadow: md` → `var(--shadow-md)`. */
|
|
140
|
-
const SHADOWS = Object.fromEntries(SIZE_KEYWORDS.map((size) => [size, `var(--shadow-${size})`]));
|
|
141
142
|
/**
|
|
142
143
|
* `--font-weight: strong` → `var(--font-weight-strong)`: the role weights, so a
|
|
143
144
|
* theme's weights reach utilities. Standard names (`medium`) are not keywords:
|
|
@@ -206,6 +207,13 @@ export const BORDER_SIDES = [
|
|
|
206
207
|
/** The four sizing keywords. Margin takes only `auto`. */
|
|
207
208
|
export const SIZING_KEYWORDS = ["auto", "fit-content", "min-content", "max-content"];
|
|
208
209
|
export const MARGIN_KEYWORDS = ["auto"];
|
|
210
|
+
/**
|
|
211
|
+
* Keywords the side insets (`--top --right --bottom --left`) take besides a
|
|
212
|
+
* length: `auto` releases a side at a breakpoint (`--bottom: 0; --bottom--lg:
|
|
213
|
+
* auto` sticks to the bottom below lg only). Each keyword costs ~16 [style*=]
|
|
214
|
+
* substrings (SPEC claim 16), so the axis and `--inset` shorthands go without.
|
|
215
|
+
*/
|
|
216
|
+
export const INSET_KEYWORDS = ["auto"];
|
|
209
217
|
/**
|
|
210
218
|
* Track-list keywords `--grid-cols` / `--grid-rows` take besides a count. `none`
|
|
211
219
|
* is not one: `--template-cols: none` says the same, and every keyword
|
|
@@ -426,17 +434,43 @@ export const UTILITIES = [
|
|
|
426
434
|
{ name: "gap", properties: ["gap"], mode: "dual", family: "spacing", noBase: "0" },
|
|
427
435
|
{ name: "gap-x", properties: ["column-gap"], mode: "dual", family: "spacing", noBase: "0" },
|
|
428
436
|
{ name: "gap-y", properties: ["row-gap"], mode: "dual", family: "spacing", noBase: "0" },
|
|
429
|
-
{
|
|
437
|
+
{
|
|
438
|
+
name: "inset",
|
|
439
|
+
pseudo: true,
|
|
440
|
+
properties: ["inset"],
|
|
441
|
+
mode: "dual",
|
|
442
|
+
family: "spacing",
|
|
443
|
+
},
|
|
430
444
|
// axis insets: left + right and top + bottom (logical, like the sides)
|
|
431
|
-
{
|
|
432
|
-
|
|
433
|
-
|
|
445
|
+
{
|
|
446
|
+
name: "inset-x",
|
|
447
|
+
pseudo: true,
|
|
448
|
+
properties: ["inset-inline"],
|
|
449
|
+
mode: "dual",
|
|
450
|
+
family: "spacing",
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
name: "inset-y",
|
|
454
|
+
pseudo: true,
|
|
455
|
+
properties: ["inset-block"],
|
|
456
|
+
mode: "dual",
|
|
457
|
+
family: "spacing",
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
name: "top",
|
|
461
|
+
pseudo: true,
|
|
462
|
+
properties: ["inset-block-start"],
|
|
463
|
+
mode: "dual",
|
|
464
|
+
family: "spacing",
|
|
465
|
+
keywords: INSET_KEYWORDS,
|
|
466
|
+
},
|
|
434
467
|
{
|
|
435
468
|
name: "bottom",
|
|
436
469
|
pseudo: true,
|
|
437
470
|
properties: ["inset-block-end"],
|
|
438
471
|
mode: "dual",
|
|
439
472
|
family: "spacing",
|
|
473
|
+
keywords: INSET_KEYWORDS,
|
|
440
474
|
},
|
|
441
475
|
{
|
|
442
476
|
name: "left",
|
|
@@ -444,6 +478,7 @@ export const UTILITIES = [
|
|
|
444
478
|
properties: ["inset-inline-start"],
|
|
445
479
|
mode: "dual",
|
|
446
480
|
family: "spacing",
|
|
481
|
+
keywords: INSET_KEYWORDS,
|
|
447
482
|
},
|
|
448
483
|
{
|
|
449
484
|
name: "right",
|
|
@@ -451,6 +486,7 @@ export const UTILITIES = [
|
|
|
451
486
|
properties: ["inset-inline-end"],
|
|
452
487
|
mode: "dual",
|
|
453
488
|
family: "spacing",
|
|
489
|
+
keywords: INSET_KEYWORDS,
|
|
454
490
|
},
|
|
455
491
|
// margin: dual mode plus `auto`
|
|
456
492
|
{ name: "m", properties: ["margin"], mode: "dual", family: "margin", keywords: MARGIN_KEYWORDS },
|
|
@@ -669,19 +705,54 @@ export const UTILITIES = [
|
|
|
669
705
|
family: "effects",
|
|
670
706
|
noBase: "1",
|
|
671
707
|
},
|
|
708
|
+
{
|
|
709
|
+
name: "filter",
|
|
710
|
+
pseudo: true,
|
|
711
|
+
properties: ["filter"],
|
|
712
|
+
mode: "raw",
|
|
713
|
+
family: "effects",
|
|
714
|
+
noBase: "none",
|
|
715
|
+
},
|
|
716
|
+
// a height: a four-layer box-shadow with a negative spread, drawn with the elevation
|
|
717
|
+
// formula (generate-utilities.ts) in --shadow-angle's light and --shadow-tint; shares
|
|
718
|
+
// one box-shadow with --ring* and --shadow (an explicit --shadow wins)
|
|
719
|
+
{
|
|
720
|
+
name: "elevation",
|
|
721
|
+
properties: [],
|
|
722
|
+
mode: "raw",
|
|
723
|
+
family: "effects",
|
|
724
|
+
tiers: "both",
|
|
725
|
+
noBase: "0",
|
|
726
|
+
emit: "none",
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
name: "backdrop-filter",
|
|
730
|
+
pseudo: true,
|
|
731
|
+
properties: ["backdrop-filter"],
|
|
732
|
+
mode: "raw",
|
|
733
|
+
family: "effects",
|
|
734
|
+
noBase: "none",
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
name: "mix-blend",
|
|
738
|
+
pseudo: true,
|
|
739
|
+
properties: ["mix-blend-mode"],
|
|
740
|
+
mode: "keyword",
|
|
741
|
+
family: "effects",
|
|
742
|
+
noBase: "normal",
|
|
743
|
+
},
|
|
672
744
|
{
|
|
673
745
|
name: "shadow",
|
|
674
746
|
properties: [],
|
|
675
747
|
mode: "raw",
|
|
676
748
|
family: "effects",
|
|
677
749
|
emit: "none",
|
|
678
|
-
aliases: SHADOWS,
|
|
679
750
|
},
|
|
680
|
-
// the shadow color for an element and its subtree:
|
|
681
|
-
// --shadow-* tokens wherever this is set, so
|
|
682
|
-
{ name: "shadow-
|
|
751
|
+
// the shadow color for an element and its subtree: _shadows.css re-declares the
|
|
752
|
+
// --shadow-* tokens wherever this is set, so var() and primitive shadows follow
|
|
753
|
+
{ name: "shadow-tint", properties: [], mode: "raw", family: "box", emit: "none" },
|
|
683
754
|
// the shadow's cast direction: the --shadow-* tokens rotate their offsets by it
|
|
684
|
-
// (0deg casts down, clockwise), re-declared where it is set (
|
|
755
|
+
// (0deg casts down, clockwise), re-declared where it is set (_shadows.css)
|
|
685
756
|
{
|
|
686
757
|
name: "shadow-angle",
|
|
687
758
|
properties: [],
|
|
@@ -771,13 +842,36 @@ export const UTILITIES = [
|
|
|
771
842
|
tiers: "both",
|
|
772
843
|
},
|
|
773
844
|
// box: no tiers
|
|
845
|
+
// a number is that many --spacing steps times --radius-multiplier, like the
|
|
846
|
+
// --radius-* tokens (`--radius: 2.5` is --radius-md); `full` is the pill token
|
|
774
847
|
{
|
|
775
|
-
name: "
|
|
848
|
+
name: "radius",
|
|
776
849
|
properties: ["border-radius"],
|
|
777
|
-
mode: "
|
|
850
|
+
mode: "dual",
|
|
778
851
|
family: "box",
|
|
852
|
+
tiers: "both",
|
|
853
|
+
noBase: "0",
|
|
779
854
|
pseudo: true,
|
|
855
|
+
scale: "var(--spacing) * var(--radius-multiplier)",
|
|
856
|
+
aliases: { full: "var(--radius-full)" },
|
|
780
857
|
},
|
|
858
|
+
// two logical corners each (Tailwind's rounded-t/-b/-l/-r), after --radius so they
|
|
859
|
+
// win over it; l and r follow the writing direction
|
|
860
|
+
...[
|
|
861
|
+
["radius-t", ["border-start-start-radius", "border-start-end-radius"]],
|
|
862
|
+
["radius-b", ["border-end-start-radius", "border-end-end-radius"]],
|
|
863
|
+
["radius-l", ["border-start-start-radius", "border-end-start-radius"]],
|
|
864
|
+
["radius-r", ["border-start-end-radius", "border-end-end-radius"]],
|
|
865
|
+
].map(([name, properties]) => ({
|
|
866
|
+
name,
|
|
867
|
+
properties,
|
|
868
|
+
mode: "dual",
|
|
869
|
+
family: "box",
|
|
870
|
+
tiers: "breakpoints",
|
|
871
|
+
noBase: "0",
|
|
872
|
+
scale: "var(--spacing) * var(--radius-multiplier)",
|
|
873
|
+
aliases: { full: "var(--radius-full)" },
|
|
874
|
+
})),
|
|
781
875
|
{ name: "overflow", properties: ["overflow"], mode: "keyword", family: "box" },
|
|
782
876
|
{
|
|
783
877
|
name: "overflow-x",
|
package/src/base/utilities.ts
CHANGED
|
@@ -169,6 +169,11 @@ export interface Utility {
|
|
|
169
169
|
* inherit, for a switch that draws them on the element's children (`--divide`).
|
|
170
170
|
*/
|
|
171
171
|
inherits?: true;
|
|
172
|
+
/**
|
|
173
|
+
* What a dual utility's number multiplies (default `var(--spacing)`):
|
|
174
|
+
* `--radius: 2` is two steps of `--spacing` times `--radius-multiplier`.
|
|
175
|
+
*/
|
|
176
|
+
scale?: string;
|
|
172
177
|
/**
|
|
173
178
|
* No-base allowlist: the CSS initial value as a literal. A utility with
|
|
174
179
|
* `noBase` applies a tier without a base value wherever no kit rule sets its
|
|
@@ -190,18 +195,18 @@ export interface Utility {
|
|
|
190
195
|
*/
|
|
191
196
|
pseudo?: true;
|
|
192
197
|
/**
|
|
193
|
-
* Keyword shorthands: `--
|
|
198
|
+
* Keyword shorthands: `--font-weight: strong` reads as `var(--font-weight-strong)`.
|
|
194
199
|
* Each is an exact-value rule at the base and at every tier of the family, so
|
|
195
|
-
* it works in `--
|
|
200
|
+
* it works in `--font-weight--md: strong` too; any other value passes through as
|
|
196
201
|
* usual. A keyword that is a prefix of another must come first.
|
|
197
202
|
*/
|
|
198
203
|
aliases?: Readonly<Record<string, string>>;
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
/**
|
|
202
|
-
* The utilities that compose into one `box-shadow` (
|
|
203
|
-
* composite's chains all end in a literal, so a tier alone
|
|
204
|
-
* a no-base utility.
|
|
207
|
+
* The utilities that compose into one `box-shadow` (the rings, shadow, and
|
|
208
|
+
* elevation): the composite's chains all end in a literal, so a tier alone
|
|
209
|
+
* works on them, like a no-base utility.
|
|
205
210
|
*/
|
|
206
211
|
export const BOX_SHADOW_COMPOSITE = [
|
|
207
212
|
"shadow",
|
|
@@ -209,6 +214,7 @@ export const BOX_SHADOW_COMPOSITE = [
|
|
|
209
214
|
"ring-color",
|
|
210
215
|
"ring-offset",
|
|
211
216
|
"ring-offset-color",
|
|
217
|
+
"elevation",
|
|
212
218
|
] as const;
|
|
213
219
|
|
|
214
220
|
/**
|
|
@@ -227,17 +233,15 @@ export const SHORTHAND_OF: Readonly<Record<string, readonly string[]>> = {
|
|
|
227
233
|
"gap-y": ["gap"],
|
|
228
234
|
basis: ["flex"],
|
|
229
235
|
shrink: ["flex"],
|
|
236
|
+
"radius-t": ["radius"],
|
|
237
|
+
"radius-b": ["radius"],
|
|
238
|
+
"radius-l": ["radius"],
|
|
239
|
+
"radius-r": ["radius"],
|
|
230
240
|
};
|
|
231
241
|
|
|
232
242
|
/** Gradient types: `--bg-<type>` emits `<type>-gradient(<prelude>, <--bg-stops>)`. */
|
|
233
243
|
export const GRADIENT_TYPES = ["linear", "radial", "conic"] as const;
|
|
234
244
|
|
|
235
|
-
/** The size scale shared by the token keywords (`--shadow: md`). */
|
|
236
|
-
export const SIZE_KEYWORDS = ["2xs", "xs", "sm", "md", "lg", "xl", "2xl"] as const;
|
|
237
|
-
|
|
238
|
-
/** `--shadow: md` → `var(--shadow-md)`. */
|
|
239
|
-
const SHADOWS = Object.fromEntries(SIZE_KEYWORDS.map((size) => [size, `var(--shadow-${size})`]));
|
|
240
|
-
|
|
241
245
|
/**
|
|
242
246
|
* `--font-weight: strong` → `var(--font-weight-strong)`: the role weights, so a
|
|
243
247
|
* theme's weights reach utilities. Standard names (`medium`) are not keywords:
|
|
@@ -312,6 +316,14 @@ export const BORDER_SIDES = [
|
|
|
312
316
|
export const SIZING_KEYWORDS = ["auto", "fit-content", "min-content", "max-content"] as const;
|
|
313
317
|
export const MARGIN_KEYWORDS = ["auto"] as const;
|
|
314
318
|
|
|
319
|
+
/**
|
|
320
|
+
* Keywords the side insets (`--top --right --bottom --left`) take besides a
|
|
321
|
+
* length: `auto` releases a side at a breakpoint (`--bottom: 0; --bottom--lg:
|
|
322
|
+
* auto` sticks to the bottom below lg only). Each keyword costs ~16 [style*=]
|
|
323
|
+
* substrings (SPEC claim 16), so the axis and `--inset` shorthands go without.
|
|
324
|
+
*/
|
|
325
|
+
export const INSET_KEYWORDS = ["auto"] as const;
|
|
326
|
+
|
|
315
327
|
/**
|
|
316
328
|
* Track-list keywords `--grid-cols` / `--grid-rows` take besides a count. `none`
|
|
317
329
|
* is not one: `--template-cols: none` says the same, and every keyword
|
|
@@ -537,17 +549,43 @@ export const UTILITIES: readonly Utility[] = [
|
|
|
537
549
|
{ name: "gap", properties: ["gap"], mode: "dual", family: "spacing", noBase: "0" },
|
|
538
550
|
{ name: "gap-x", properties: ["column-gap"], mode: "dual", family: "spacing", noBase: "0" },
|
|
539
551
|
{ name: "gap-y", properties: ["row-gap"], mode: "dual", family: "spacing", noBase: "0" },
|
|
540
|
-
{
|
|
552
|
+
{
|
|
553
|
+
name: "inset",
|
|
554
|
+
pseudo: true,
|
|
555
|
+
properties: ["inset"],
|
|
556
|
+
mode: "dual",
|
|
557
|
+
family: "spacing",
|
|
558
|
+
},
|
|
541
559
|
// axis insets: left + right and top + bottom (logical, like the sides)
|
|
542
|
-
{
|
|
543
|
-
|
|
544
|
-
|
|
560
|
+
{
|
|
561
|
+
name: "inset-x",
|
|
562
|
+
pseudo: true,
|
|
563
|
+
properties: ["inset-inline"],
|
|
564
|
+
mode: "dual",
|
|
565
|
+
family: "spacing",
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: "inset-y",
|
|
569
|
+
pseudo: true,
|
|
570
|
+
properties: ["inset-block"],
|
|
571
|
+
mode: "dual",
|
|
572
|
+
family: "spacing",
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
name: "top",
|
|
576
|
+
pseudo: true,
|
|
577
|
+
properties: ["inset-block-start"],
|
|
578
|
+
mode: "dual",
|
|
579
|
+
family: "spacing",
|
|
580
|
+
keywords: INSET_KEYWORDS,
|
|
581
|
+
},
|
|
545
582
|
{
|
|
546
583
|
name: "bottom",
|
|
547
584
|
pseudo: true,
|
|
548
585
|
properties: ["inset-block-end"],
|
|
549
586
|
mode: "dual",
|
|
550
587
|
family: "spacing",
|
|
588
|
+
keywords: INSET_KEYWORDS,
|
|
551
589
|
},
|
|
552
590
|
{
|
|
553
591
|
name: "left",
|
|
@@ -555,6 +593,7 @@ export const UTILITIES: readonly Utility[] = [
|
|
|
555
593
|
properties: ["inset-inline-start"],
|
|
556
594
|
mode: "dual",
|
|
557
595
|
family: "spacing",
|
|
596
|
+
keywords: INSET_KEYWORDS,
|
|
558
597
|
},
|
|
559
598
|
{
|
|
560
599
|
name: "right",
|
|
@@ -562,6 +601,7 @@ export const UTILITIES: readonly Utility[] = [
|
|
|
562
601
|
properties: ["inset-inline-end"],
|
|
563
602
|
mode: "dual",
|
|
564
603
|
family: "spacing",
|
|
604
|
+
keywords: INSET_KEYWORDS,
|
|
565
605
|
},
|
|
566
606
|
// margin: dual mode plus `auto`
|
|
567
607
|
{ name: "m", properties: ["margin"], mode: "dual", family: "margin", keywords: MARGIN_KEYWORDS },
|
|
@@ -784,19 +824,54 @@ export const UTILITIES: readonly Utility[] = [
|
|
|
784
824
|
family: "effects",
|
|
785
825
|
noBase: "1",
|
|
786
826
|
},
|
|
827
|
+
{
|
|
828
|
+
name: "filter",
|
|
829
|
+
pseudo: true,
|
|
830
|
+
properties: ["filter"],
|
|
831
|
+
mode: "raw",
|
|
832
|
+
family: "effects",
|
|
833
|
+
noBase: "none",
|
|
834
|
+
},
|
|
835
|
+
// a height: a four-layer box-shadow with a negative spread, drawn with the elevation
|
|
836
|
+
// formula (generate-utilities.ts) in --shadow-angle's light and --shadow-tint; shares
|
|
837
|
+
// one box-shadow with --ring* and --shadow (an explicit --shadow wins)
|
|
838
|
+
{
|
|
839
|
+
name: "elevation",
|
|
840
|
+
properties: [],
|
|
841
|
+
mode: "raw",
|
|
842
|
+
family: "effects",
|
|
843
|
+
tiers: "both",
|
|
844
|
+
noBase: "0",
|
|
845
|
+
emit: "none",
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
name: "backdrop-filter",
|
|
849
|
+
pseudo: true,
|
|
850
|
+
properties: ["backdrop-filter"],
|
|
851
|
+
mode: "raw",
|
|
852
|
+
family: "effects",
|
|
853
|
+
noBase: "none",
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
name: "mix-blend",
|
|
857
|
+
pseudo: true,
|
|
858
|
+
properties: ["mix-blend-mode"],
|
|
859
|
+
mode: "keyword",
|
|
860
|
+
family: "effects",
|
|
861
|
+
noBase: "normal",
|
|
862
|
+
},
|
|
787
863
|
{
|
|
788
864
|
name: "shadow",
|
|
789
865
|
properties: [],
|
|
790
866
|
mode: "raw",
|
|
791
867
|
family: "effects",
|
|
792
868
|
emit: "none",
|
|
793
|
-
aliases: SHADOWS,
|
|
794
869
|
},
|
|
795
|
-
// the shadow color for an element and its subtree:
|
|
796
|
-
// --shadow-* tokens wherever this is set, so
|
|
797
|
-
{ name: "shadow-
|
|
870
|
+
// the shadow color for an element and its subtree: _shadows.css re-declares the
|
|
871
|
+
// --shadow-* tokens wherever this is set, so var() and primitive shadows follow
|
|
872
|
+
{ name: "shadow-tint", properties: [], mode: "raw", family: "box", emit: "none" },
|
|
798
873
|
// the shadow's cast direction: the --shadow-* tokens rotate their offsets by it
|
|
799
|
-
// (0deg casts down, clockwise), re-declared where it is set (
|
|
874
|
+
// (0deg casts down, clockwise), re-declared where it is set (_shadows.css)
|
|
800
875
|
{
|
|
801
876
|
name: "shadow-angle",
|
|
802
877
|
properties: [],
|
|
@@ -886,13 +961,40 @@ export const UTILITIES: readonly Utility[] = [
|
|
|
886
961
|
tiers: "both",
|
|
887
962
|
},
|
|
888
963
|
// box: no tiers
|
|
964
|
+
// a number is that many --spacing steps times --radius-multiplier, like the
|
|
965
|
+
// --radius-* tokens (`--radius: 2.5` is --radius-md); `full` is the pill token
|
|
889
966
|
{
|
|
890
|
-
name: "
|
|
967
|
+
name: "radius",
|
|
891
968
|
properties: ["border-radius"],
|
|
892
|
-
mode: "
|
|
969
|
+
mode: "dual",
|
|
893
970
|
family: "box",
|
|
971
|
+
tiers: "both",
|
|
972
|
+
noBase: "0",
|
|
894
973
|
pseudo: true,
|
|
974
|
+
scale: "var(--spacing) * var(--radius-multiplier)",
|
|
975
|
+
aliases: { full: "var(--radius-full)" },
|
|
895
976
|
},
|
|
977
|
+
// two logical corners each (Tailwind's rounded-t/-b/-l/-r), after --radius so they
|
|
978
|
+
// win over it; l and r follow the writing direction
|
|
979
|
+
...(
|
|
980
|
+
[
|
|
981
|
+
["radius-t", ["border-start-start-radius", "border-start-end-radius"]],
|
|
982
|
+
["radius-b", ["border-end-start-radius", "border-end-end-radius"]],
|
|
983
|
+
["radius-l", ["border-start-start-radius", "border-end-start-radius"]],
|
|
984
|
+
["radius-r", ["border-start-end-radius", "border-end-end-radius"]],
|
|
985
|
+
] as const
|
|
986
|
+
).map(
|
|
987
|
+
([name, properties]): Utility => ({
|
|
988
|
+
name,
|
|
989
|
+
properties,
|
|
990
|
+
mode: "dual",
|
|
991
|
+
family: "box",
|
|
992
|
+
tiers: "breakpoints",
|
|
993
|
+
noBase: "0",
|
|
994
|
+
scale: "var(--spacing) * var(--radius-multiplier)",
|
|
995
|
+
aliases: { full: "var(--radius-full)" },
|
|
996
|
+
}),
|
|
997
|
+
),
|
|
896
998
|
{ name: "overflow", properties: ["overflow"], mode: "keyword", family: "box" },
|
|
897
999
|
{
|
|
898
1000
|
name: "overflow-x",
|