@splendidlabz/styles 4.15.0 → 4.17.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/README.md CHANGED
@@ -11,12 +11,16 @@ npm install @splendidlabz/styles
11
11
  ## The quickest way — everything
12
12
 
13
13
  ```css
14
+ @layer reset, theme, base, components, utilities;
15
+
14
16
  @import 'tailwindcss';
15
17
  @import '@splendidlabz/styles';
16
18
  ```
17
19
 
18
20
  That's the whole system: reset, theme, styled HTML, utilities, and the CSS components (`prose`, `card`, `table`, and friends). Tailwind tree-shakes whatever you don't use, so most projects want this and nothing else.
19
21
 
22
+ The `@layer` line puts Splendid's reset below everything else. Leave it out and the reset beats your utilities: `p-4` gets no padding.
23
+
20
24
  ## Keep your own reset — just the classes
21
25
 
22
26
  Already have your own reset and base styles? Take Splendid's utilities and components without letting it touch your HTML:
@@ -39,6 +43,8 @@ If you're pulling in components from `@splendidlabz/astro` or `@splendidlabz/sve
39
43
  @source "../node_modules/@splendidlabz/astro";
40
44
  @source "../node_modules/@splendidlabz/svelte";
41
45
 
46
+ @layer reset, theme, base, components, utilities;
47
+
42
48
  @import 'tailwindcss';
43
49
 
44
50
  /* 2. A base + the framework component styles. */
package/catalog.md ADDED
@@ -0,0 +1,220 @@
1
+ # @splendidlabz/styles catalog
2
+
3
+ This file lists every utility group `@splendidlabz/styles` ships for Tailwind CSS v4, the entry point that provides it, and when to reach for each utility. Find your job here and read the utility's docs or source before you use it. For components such as forms, modals, tabs, images and SEO, read `node_modules/@splendidlabz/svelte/catalog.md` and `node_modules/@splendidlabz/astro/catalog.md`. Write your own CSS only when none of them fits.
4
+
5
+ ## Where to read a utility
6
+
7
+ - **Docs:** the layouts have pages at `https://splendidlabz.com/docs/layouts/<section>/<page>/`. Each layout heading below names its section, and each line names its page when it has one. Read [CSS variables](https://splendidlabz.com/docs/layouts/guides/css-variables/) and [Responsive layouts](https://splendidlabz.com/docs/layouts/guides/responsive-layouts/) before your first layout.
8
+ - **Source:** `node_modules/@splendidlabz/styles/src/`, for any utility without a docs page. The first line under each `##` heading names its folder there. Each layout subheading names its docs section, then its folder in `src/layouts/`.
9
+
10
+ ## Entry points
11
+
12
+ Set up your main stylesheet in this order, as the block below shows:
13
+
14
+ 1. When you import the full bundle or `base`, declare the layer order before any import, so Splendid's reset has the lowest priority.
15
+ 2. When you import the full bundle or `base`, import Tailwind's theme and utilities into their layers instead of `@import 'tailwindcss'`, because Splendid's reset replaces Tailwind's preflight. On `utilities`, keep your own reset and use `@import 'tailwindcss'` as usual.
16
+ 3. Import either the full bundle (`@splendidlabz/styles`) alone, or a foundation followed by any component entry point.
17
+ - A foundation is `base` or `utilities`.
18
+ - A component entry point is `components/css`, `components/astro`, `components/svelte` or `components`.
19
+ 4. When the project uses `@splendidlabz/astro` or `@splendidlabz/svelte`, add an `@source` line for each, with a path relative to the stylesheet. Tailwind skips `node_modules`, so without the line it doesn't build the classes those components use.
20
+
21
+ ```css
22
+ @layer reset, theme, base, components, utilities;
23
+
24
+ @import 'tailwindcss/theme.css' layer(theme);
25
+ @import 'tailwindcss/utilities.css' layer(utilities);
26
+
27
+ @import '@splendidlabz/styles/base';
28
+ @import '@splendidlabz/styles/components';
29
+
30
+ @source '../../node_modules/@splendidlabz/astro';
31
+ @source '../../node_modules/@splendidlabz/svelte';
32
+ ```
33
+
34
+ - `@splendidlabz/styles`: the full bundle of reset, theme variables, bare-HTML styles, tools, layouts, effects and the CSS components.
35
+ - `@splendidlabz/styles/base`: the full bundle without the CSS components. Use it under `components/astro` or `components/svelte`.
36
+ - `@splendidlabz/styles/utilities`: tools, layouts, effects and `button`, with no reset and no bare-HTML styles. Use it in a project that keeps its own base styles.
37
+ - `@splendidlabz/styles/components/css`: the CSS components alone.
38
+ - `@splendidlabz/styles/components/astro`, `/components/svelte`: the CSS components plus the styles of `@splendidlabz/astro` or `@splendidlabz/svelte` components. `/components` carries both.
39
+ - `@splendidlabz/styles/layouts`, `/effects`: one group with the tools it needs, for a project that wants only that group.
40
+ - `@splendidlabz/styles/theming`: the theme variables and the tools.
41
+ - `@splendidlabz/styles/tools`, `/pigment`, `/variables`: the tools, pigment alone, or the theme variables alone.
42
+ - `@splendidlabz/styles/scripts`: the browser scripts listed at the end of this file.
43
+
44
+ Import `base` or `utilities`, never both. Import no component entry point after the full bundle, since it already carries the CSS components. Tailwind doesn't dedupe a repeated `@import`, so either mistake ships the shared utilities twice.
45
+
46
+ ## Layouts
47
+
48
+ In `layouts`, `base`, `utilities` and the full bundle. Source: `src/layouts/`.
49
+
50
+ ### Rules
51
+
52
+ - Keep layout in the markup. Write your own CSS class only for a layout the whole site reuses.
53
+ - Set a utility's variables on its element with Tailwind arbitrary properties, such as `[--cols:3]`.
54
+ - Space children with a `gap-*` class on their parent. Give the children no outer margins.
55
+ - On `grid-flex`, set `--gap` instead of a `gap-*` class.
56
+ - On a parent whose nested layouts should share its gap, set `--gap` too.
57
+
58
+ ### Page shell (`shell-layouts`, `shell/`)
59
+
60
+ - `shell-simple`: a vertical page whose content grows to fill the screen, so the footer sits at the bottom. Page: `shell-simple`.
61
+ - `shell-grid`, `shell-body`: a header, left sidebar, main area and right sidebar. The main area fills the space, and the sidebar widths are adjustable. Page: `shell-grid`.
62
+
63
+ ### Page regions (`macro-layouts`, `macro/`)
64
+
65
+ - `wrap`: horizontal padding that keeps content off the screen's edges. Page: `wrap`.
66
+ - `section`: vertical padding around a page section, set by `--spacing-section`. No page.
67
+ - `section-mini`: a `section` with half the padding. No page.
68
+ - `section-cont`: a `section` that drops its top padding when it follows a `section` or another `section-cont`. No page.
69
+ - `grid-with-breakout`: a three-column grid whose items can break out of the main column. Page: `grid-with-breakout`.
70
+
71
+ ### Grids (`macro-layouts`, `macro/`)
72
+
73
+ - `grid-simple`: `--cols` equal columns. Page: `grid-simple`.
74
+ - `grid-fr-auto`: columns that fill the space, then one column sized to its content. Page: `grid-fr-auto`.
75
+ - `grid-auto-fr`: one column sized to its content, then columns that fill the space. Page: `grid-auto-fr`.
76
+ - `grid-repeat-auto`: `--cols` columns, each sized to its content.
77
+ - `grid-gallery`, `grid-gallery-fill`, `grid-gallery-fit`: as many columns of `--item-width` as fit, by `auto-fill` (the first two) or `auto-fit`. Page: `grid-gallery`.
78
+ - `grid-flex`: `--cols` columns built with Flexbox. An item spans columns with `--span`, and the items in a short last row grow to fill it. Page: `grid-flex`.
79
+ - `grid-flex-gallery`: Flexbox items of at least `--item-width` that share each row.
80
+ - `grid-alternate`: two-column rows that swap sides in turn, starting from `data-start="left"` or `"right"`.
81
+ - `dense`, `dense-row`, `dense-column`: fill earlier gaps in a grid.
82
+ - `masonry`, `masonry-gallery`: a masonry grid by `--cols`, or by `--item-width`. Page: `masonry`.
83
+ - `subgrid`, `subgrid-columns`, `subgrid-rows`: children that line up with their parent's grid tracks. Page: `subgrid`.
84
+
85
+ ### Inside a component (`micro-layouts`, `micro/`)
86
+
87
+ - `vertical`: children in a column. Page: `vertical`.
88
+ - `horizontal`: children in a row. Page: `horizontal`.
89
+ - `flow`: children in a row that wraps onto the next line. Page: `flow`.
90
+ - `stack`: children layered on top of each other. Page: `stack`.
91
+ - `stack-interactive`: a `stack` whose `.underlay` and `.overlay` children show on hover and focus. No page.
92
+ - `divider-x`, `divider-y`: a line that fills the space beside its content. `divider-horizontal` and `divider-vertical` are aliases. Page: `dividers`.
93
+ - `divider-between-x`, `divider-between-y`: lines between children. `divider-between-horizontal` and `divider-between-vertical` are aliases. Page: `dividers`.
94
+ - `breakout-*`, `breakout-x-*`, `breakout-y-*`, `breakout-t-*`, `breakout-b-*`, `breakout-l-*`, `breakout-r-*`: negative margins that pull an item out of its container's padding. Page: `breakout`.
95
+ - `im-*`, `im-x-*`, `im-y-*`: margin on every direct child. No page.
96
+ - `ip-*`, `ip-x-*`, `ip-y-*`: padding on every direct child. No page.
97
+ - `scrollable`, `scrollable-x`, `scrollable-y`: an overflowing area with scroll snap. `scrollable-horizontal` and `scrollable-vertical` are aliases; `scrollable-nosnap` and `snap-type-*` change the snap. Page: `scrollable`.
98
+ - `new-stacking-context`: a new stacking context. Page: `new-stacking-context`.
99
+
100
+ For a container-query context, use Tailwind's `@container`.
101
+
102
+ ### Positioning (`positioning`, `position/`)
103
+
104
+ - `pos-*`: an element at a side, a corner, the centre or the whole area of a `stack` or `relative` parent: `top`, `topleft`, `topright`, `topfull`, `bottom`, `bottomleft`, `bottomright`, `bottomfull`, `left`, `leftfull`, `right`, `rightfull`, `center`, `overlay`. `stack-pos-*` and `relative-pos-*` force one parent type. Page: `position`.
105
+ - `edge-*`: an element that straddles a side or a corner of a `stack` or `relative` parent, with `-start` and `-end` variants for corners. `stack-edge-*` and `relative-edge-*` force one parent type, and `edge-adjust-*` sets the overlap alone. Page: `edge`.
106
+ - `fixed-*`: an element fixed to a side, a corner, the centre or the whole viewport. Page: `fixed`.
107
+ - `nudge`, `nudge-*`, `nudge-x-*`, `nudge-y-*`: move a `pos-*`, `edge-*` or `fixed-*` element in from its parent's edge. Page: `nudge`.
108
+ - `inner-radius`: the parent's `--radius` minus `--nudge`, for a nudged element.
109
+ - `sticky`, and the `sticking:` variant: `position: sticky`, and styles for while the element sticks. The `sticky` script sets the `.sticking` class. Page: `sticky`.
110
+
111
+ In the layout groups, the `*-scaffold` utilities and `micro` are the shared base of the utilities above. Apply them only when you build a new layout utility.
112
+
113
+ ## Effects: shadows, gradients, highlights, borders, frosted glass, scrollbars and animations
114
+
115
+ In `effects`, `base`, `utilities` and the full bundle. Source: `src/effects/`.
116
+
117
+ - `shadow`, `inset`, `sx-*`, `sy-*`, `sb-*`, `ss-*`, `sc-*`, `sa-*`, and the `-sx-*`, `-sy-*`, `-ss-*`, `sxm-*`, `sym-*`, `sbm-*`, `ssm-*` variants: a box shadow built from x, y, blur, spread, colour and alpha.
118
+ - `text-shadow` with `ts*-*`, and `drop-shadow` with `ds*-*`: the same for text shadows and drop shadows.
119
+ - `shadow-before`, `shadow-after`, `shadow-pseudo`: a shadow on a pseudo-element that fades in by opacity.
120
+ - `elevation`, `elevation-1` to `elevation-7`, `ds-elevation-1` to `ds-elevation-7`: layered shadows for height, as box shadows or drop shadows.
121
+ - `gradient`, `linear-gradient`, `radial-gradient`, `conic-gradient`, the `repeating-*` versions, `gradient-angle-*` and `gradient-circle` or `gradient-ellipse`: gradient backgrounds that work with Tailwind's `from-*`, `via-*` and `to-*`.
122
+ - `text-gradient`, `gradient-text`: gradient-filled text.
123
+ - `fancybox`, `fancybox-bleed-border`, `fancybox-arrow`: a gradient border around a solid fill.
124
+ - `bezel`, `bezel-frost`, `bezel-arrow-*`, `inner-linear`, `inner-radial`, `inner-conic`, `outer-linear`, `outer-radial`, `outer-conic`: a bezel of inner and outer gradients.
125
+ - `spotlight`: a glow on a `bezel` that follows the pointer, driven by the `spotlight` script.
126
+ - `highlight`, `highlight-*`, `highlight-start-*`, `highlight-end-*`, `highlight-marker`, `highlight-marker-alt`, `highlight-tab`, `highlight-stamp`, `highlight-before`: a marker-pen highlight behind inline text.
127
+ - `frosted-glass`, `frosted-glass-advanced`: a blurred backdrop.
128
+ - `inner-border`: a border drawn inside the element.
129
+ - `scrollbar-thin`, `scrollbar-none`, `scrollbar-auto`, `scrollbar-thumb-*`, `scrollbar-track-*`, `scrollbars-on`: scrollbar size and colours.
130
+ - `text-stroke`: an outline around text. `text-outline` is deprecated.
131
+ - `animation`, `animation-fly`, `animation-fly-in-*`, `animation-fly-out-*`: keyframe animations in or out from a side.
132
+ - `fade`, `fly`, `fly-from-*`: an entry transition when the element appears, through `@starting-style`.
133
+
134
+ ## Tools: state variants, pigment colours, transitions, outlines, radius and scaffolds
135
+
136
+ In every foundation, `theming`, `layouts`, `effects` and `tools`. Source: `src/tools/`.
137
+
138
+ - `interact:` and `interact-within:` variants: styles for hover, focus-visible, active, selected, checked, current, pressed and expanded states, on the element or anything inside it.
139
+ - `pigment`, `pigment-without-border`, `pigment-svg`, `pigment-with-svg`, `pigment-outline`, `pigment-ghost` (also in `/pigment`): colours that change by state, from `--bg-color`, `--text-color`, `--border-color` and their `-hover-`, `-focus-`, `-active-` and `-selected-` versions. `--bg-alpha`, `--text-alpha` and `--border-alpha` (0 to 1) fade that colour in every state, including the borders `card-divided`, `divider-between-*` and `Tabs` draw. `--bg-alpha` fades a colour only. A gradient background disappears when it's set.
140
+ - `transition-scaffold`, `transition-scaffold-extended`, `transition-svg`: transitions on the common properties, timed by `--transition-duration`, `--transition-delay` and `--transition-easing`.
141
+ - `outline-scaffold`, `focus-within`, `preserve-outlines`: focus outlines from the `--outline-*` variables.
142
+ - `border-scaffold`, `padding-scaffold`, `margin-scaffold`: border, padding and margin from their variables.
143
+ - `rounded-*`, `rounded-t-*` and the other sides and corners: a radius on the spacing scale. `rounded-x`, `rounded-y`, `rounded-x-*` and `rounded-y-*` round only the first and last children.
144
+ - `radius-*`: set `--radius`, which cards, buttons and `inner-radius` read.
145
+ - `object-background`: an image or video that fills and covers its positioned parent.
146
+ - `--zalpha(color, alpha)`: a CSS function that returns a colour at an alpha.
147
+
148
+ ## CSS components: buttons, cards, prose, headings, lists, tables, form fields, shapes and typography
149
+
150
+ In every component entry point and the full bundle. `button` is also in `base` and `utilities`. Source: `src/components/css/`.
151
+
152
+ - `button`, `button-icon`, `button-round`: a button, an icon-only button, and a round one.
153
+ - `card`, `box`, `card-divided`, `card-divided-horizontal`, `card-divided-vertical`, `card-split`: a bordered padded card, and one with lines between its parts.
154
+ - `prose`, `prose-tight`, `prose-loose`: long-form text, spaced with a gap.
155
+ - `prose-div`: `prose` without flexbox.
156
+ - `hero-heading`, `hero-heading-start`, `hero-heading-center`, `hero-heading-end`: a large heading group, aligned.
157
+ - `indentlist`, `indentlist-guides`, `indentlist-singleguide`: nested lists indented by depth, with guide lines.
158
+ - `table-scaffold`, `table-auto`, `table-fixed`, `table-center`, `table-cell-defaults`, `table-header-row`, `table-header-column`, `table-radius`: a styled table.
159
+ - `input-container`, `input-group`: a text field, and fields or buttons joined in a row.
160
+ - `select`, `checkbox-and-radio`: a styled native select, and styled checkboxes and radios.
161
+ - `.combobox-options`: the option list of the Svelte `Select` and `Autocomplete`.
162
+ - `square`, `circle`, `roundrect`, `pill`: an element in that shape.
163
+ - `simple-svg`, `spl-fill-*`, `spl-stroke-*`: an SVG coloured by `--fill-color` and `--stroke-color`.
164
+ - `strikethrough`, `strike-*`, `strike-angle-*`: a line through text, at an angle.
165
+ - `writing-normal`, `writing-downwards`, `writing-downwards-lr`, `writing-downwards-rl`, `writing-rotate-left`, `writing-rotate-right`: vertical or rotated text. `writing-rotateleft` and `writing-rotateright` are aliases.
166
+ - `font-weight-[<n>]`: any weight, through a typed `--font-weight` that animates. For a weight on the theme scale, use Tailwind's `font-<n>`, such as `font-450`.
167
+ - `text-edge`: set `text-box-edge` to the cap height and the baseline, for use with `text-box-trim`.
168
+ - `font-position`: balance a font's vertical padding with `--font-position-adjust`.
169
+ - `base-anchor`, `text-relative`, `base-font-size`: sizes relative to `--base-size`, so a component scales with its own font size.
170
+
171
+ ## Framework component styles
172
+
173
+ The components apply these classes themselves. Add only the variants marked opt-in, through the component's `class` prop.
174
+
175
+ - `components/svelte` (source `src/components/svelte/`) styles `@splendidlabz/svelte` components:
176
+ - `accordion`, `breadcrumbs`, `crumb`, `browserframe`, `callout`, `contentlist`, `drawer-content`, `.modal-content`, `[popover]`, `resizer`, `status` and `tablist`.
177
+ - Opt-in: `tablist-underline`, `tablist-card-divided`, `tablist-top`, `tablist-left`, `tablist-right` and `browserframe-colored`.
178
+ - `components/astro` (source `src/components/astro/`) styles the Astro `FancyList` (`fancylist`) and `Textwall` (`textwall`).
179
+
180
+ ## Bare HTML
181
+
182
+ In `base` and the full bundle. Source: `src/generic/`, `src/reset.css`.
183
+
184
+ - Element styles:
185
+ - A reset, and `html` and `body` that fill the viewport.
186
+ - System fonts.
187
+ - Links styled with `pigment`, and buttons with `button`.
188
+ - Textareas that resize vertically.
189
+ - Smooth scrolling, and cross-page view transitions when the user allows motion.
190
+ - `.sr-only`: content for screen readers only.
191
+ - `.field`, `.form-field-helper`, `.disabled`, `.readonly`: a form field, its helper text, and its inactive states.
192
+
193
+ ## Theme variables: type scale, font weights, breakpoints, radius, spacing and defaults
194
+
195
+ In `variables`, `theming`, `base` and the full bundle. Set them in your own `@theme` or on an element. Source: `src/variables/`.
196
+
197
+ - `--text-1` to `--text-22`: the type scale, from 10px to 120px, used as `text-1` to `text-22`. `--text-<n>e` is the same step in `em`, and `--text-<n>m` is it as a multiplier.
198
+ - `--font-weight-100` to `--font-weight-900`, in steps of 25: the weights for variable fonts, used as `font-100` to `font-900`.
199
+ - `bp1` to `bp25`, in 50px steps from 100px to 2500px: breakpoints for media queries (`bp8:`) and container queries (`@bp8:`).
200
+ - `--radius`: the default radius.
201
+ - `--radius-<n>`: a radius scale that `rounded-<n>` reads.
202
+ - `rounded-2` steps on `--spacing`.
203
+ - `rounded-1.5r` steps on `--radius`.
204
+ - `--gap`, `--padding`, `--leading`: default gap, padding and line height.
205
+ - `--border-width`, `--border-style`, `--border-color`, `--outline-width`, `--outline-style`, `--outline-focus-color`, `--outline-offset`.
206
+ - `--transition-duration`, `--transition-delay`, `--transition-easing`.
207
+ - `--spacing-section`: the padding of `section`, which `section-mini` halves.
208
+ - `--input-font`, `--textarea-height`, `--header-row-border-top`, `--header-row-border-bottom`, `--alt-row-color`, `--base-size`.
209
+
210
+ ## Scripts
211
+
212
+ Import from `@splendidlabz/styles/scripts`, or one script from `@splendidlabz/styles/scripts/<name>`. Run them in the browser.
213
+
214
+ - `masonry(selector)`: lay out every `masonry` grid inside the selector.
215
+ - `scrollableHorizontal(selector)`: turn vertical wheel scrolling into horizontal scrolling on `.scrollable-prefer-horizontal`.
216
+ - `sticky(selector)`: set `.sticking` on `sticky` elements while they stick.
217
+ - `start()`, `stop()` (from `scripts/spotlight`): track the pointer for `spotlight`.
218
+ - `all(options)` (from `scripts/all`): run all four scripts. It takes an options object.
219
+ - Set `masonry`, `sticky`, `scrollable` or `spotlight` to `false` to skip that script.
220
+ - Set `element` to a selector or an element to limit the first three scripts to it. Without it, they search the whole page.
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@splendidlabz/styles",
3
- "version": "4.15.0",
3
+ "version": "4.17.0",
4
4
  "description": "",
5
5
  "license": "Elastic-2.0",
6
6
  "type": "module",
7
7
  "homepage": "https://splendidlabz.com/docs/styles",
8
8
  "author": "Zell Liew <zellwk@gmail.com>",
9
9
  "files": [
10
+ "catalog.md",
10
11
  "src",
11
12
  "dist",
12
13
  "scripts"
@@ -36,7 +37,7 @@
36
37
  "@splendidlabz/utils": "*"
37
38
  },
38
39
  "devDependencies": {
39
- "@splendidlabz/stylelint-config": "3.2.0",
40
+ "@splendidlabz/stylelint-config": "3.2.1",
40
41
  "@tailwindcss/cli": "^4.2.2",
41
42
  "lightningcss-cli": "^1.32.0",
42
43
  "tailwindcss": "^4.2.2",
@@ -1,4 +1,3 @@
1
- /* eslint-env browser */
2
1
  /*
3
2
  * Spotlight tracker — vanilla cursor-position writer for `.spotlight` cards.
4
3
  *
@@ -3,37 +3,32 @@
3
3
  }
4
4
 
5
5
  @utility card {
6
- & {
7
- @apply border-scaffold;
8
- @apply padding-scaffold;
9
- }
6
+ @apply border-scaffold;
7
+ @apply padding-scaffold;
10
8
  }
11
9
 
12
10
  @utility card-divided {
13
- & {
14
- @apply border-scaffold;
15
- position: relative;
11
+ @apply border-scaffold;
12
+ position: relative;
13
+
14
+ &:is(&) {
15
+ gap: 0;
16
+ padding: 0;
17
+ }
18
+
19
+ > *:not(&),
20
+ > :where(astro-slot, astro-island, astro-content) > *:not(&) {
21
+ @apply padding-scaffold;
22
+ --fallback-padding: 1rem;
16
23
 
17
- &:is(&) {
18
- gap: 0;
19
- padding: 0;
24
+ /* Raise for nicer focus ring */
25
+ &:focus-visible {
26
+ z-index: 2;
20
27
  }
21
28
 
22
- > *:not(&),
23
- > :where(astro-slot, astro-island, astro-content) > *:not(&) {
24
- @apply padding-scaffold;
25
- --fallback-padding: 1rlh;
26
-
27
- /* Raise for nicer focus ring */
28
- &:focus-visible {
29
- z-index: 2;
30
- }
31
-
32
- &:not(:focus-visible) {
33
- --z-index: 1;
34
- animation: z-index-hack var(--transition-duration)
35
- var(--transition-delay);
36
- }
29
+ &:not(:focus-visible) {
30
+ --z-index: 1;
31
+ animation: z-index-hack var(--transition-duration) var(--transition-delay);
37
32
  }
38
33
  }
39
34
  }
@@ -56,7 +51,7 @@
56
51
 
57
52
  > :where(:not(:first-child)) {
58
53
  border-left-width: var(--border-width);
59
- border-color: var(--_bc, var(--border-color));
54
+ border-color: var(--_bca, var(--_bc, var(--border-color)));
60
55
  }
61
56
 
62
57
  > :where(:first-child) {
@@ -119,7 +119,7 @@
119
119
  }
120
120
  }
121
121
 
122
- @layer utility {
122
+ @layer components {
123
123
  .checkbox,
124
124
  .radio {
125
125
  @apply checkbox-and-radio;
@@ -1,7 +1,8 @@
1
1
  @utility prose {
2
2
  display: flex;
3
3
  flex-flow: column;
4
- gap: 1lh;
4
+ gap: 1em;
5
+
5
6
  /* Inherits into descendants — Safari (only implementer) hangs decorative
6
7
  * punctuation glyphs (e.g. a ::before quote mark) fully outside their box.
7
8
  * Opt those out with hanging-punctuation: none. */
@@ -79,7 +80,11 @@
79
80
  }
80
81
  }
81
82
 
83
+ @utility prose-loose {
84
+ @apply prose;
85
+ gap: 1lh;
86
+ }
87
+
82
88
  @utility prose-tight {
83
89
  @apply prose;
84
- gap: 1em;
85
90
  }
@@ -47,8 +47,8 @@
47
47
  /* Not named `table-cell` — Tailwind emits its own `table-cell` utility alongside a same-named `@utility` instead of replacing it, so every `@apply` would also set `display: table-cell`. */
48
48
  @utility table-cell-defaults {
49
49
  & {
50
- padding-block: var(--cell-padding-y, 0.5rlh);
51
- padding-inline-end: var(--cell-padding-x, 0.5rlh);
50
+ padding-block: var(--cell-padding-y, 0.5rem);
51
+ padding-inline-end: var(--cell-padding-x, 0.5rem);
52
52
  text-align: left;
53
53
 
54
54
  /* &:last-child {
@@ -5,7 +5,7 @@
5
5
 
6
6
  @utility tab {
7
7
  align-items: start;
8
- padding: 0.25rlh 0.5rlh;
8
+ padding: 0.25rem 0.5rem;
9
9
  text-align: left;
10
10
 
11
11
  &[aria-selected] {
@@ -20,7 +20,7 @@
20
20
 
21
21
  @utility tabpanel {
22
22
  :where(&) {
23
- padding: 1rlh;
23
+ padding: 1rem;
24
24
  }
25
25
  }
26
26
 
@@ -85,23 +85,23 @@
85
85
  @container style(--placement: top) {
86
86
  :where(.tab) {
87
87
  border-bottom-width: var(--border-width);
88
- border-right-width: 0;
89
88
  border-left-width: 0;
89
+ border-right-width: 0;
90
90
  }
91
91
  }
92
92
 
93
93
  @container style(--placement: left) {
94
94
  :where(.tab) {
95
- border-right-width: var(--border-width);
96
95
  border-bottom-width: 0;
97
96
  border-left-width: 0;
97
+ border-right-width: var(--border-width);
98
98
  }
99
99
  }
100
100
 
101
101
  @container style(--placement: right) {
102
102
  :where(.tab) {
103
- border-left-width: var(--border-width);
104
103
  border-bottom-width: 0;
104
+ border-left-width: var(--border-width);
105
105
  border-right-width: 0;
106
106
  }
107
107
  }
@@ -147,11 +147,11 @@
147
147
  @container style(--placement: top) {
148
148
  :where(.tab) {
149
149
  top: var(--border-width);
150
- right: 0;
151
150
  left: 0;
151
+ right: 0;
152
152
  border-bottom-width: 0;
153
- border-right-width: var(--border-width);
154
153
  border-left-width: var(--border-width);
154
+ border-right-width: var(--border-width);
155
155
  border-start-start-radius: var(--radius);
156
156
  border-start-end-radius: var(--radius);
157
157
  border-end-start-radius: 0;
@@ -161,31 +161,31 @@
161
161
 
162
162
  @container style(--placement: left) {
163
163
  :where(.tab) {
164
- right: var(--border-width);
165
164
  top: 0;
166
165
  left: 0;
167
- border-right-width: 0;
166
+ right: var(--border-width);
168
167
  border-bottom-width: var(--border-width);
169
168
  border-left-width: var(--border-width);
169
+ border-right-width: 0;
170
170
  border-start-start-radius: var(--radius);
171
- border-end-start-radius: var(--radius);
172
171
  border-start-end-radius: 0;
172
+ border-end-start-radius: var(--radius);
173
173
  border-end-end-radius: 0;
174
174
  }
175
175
  }
176
176
 
177
177
  @container style(--placement: right) {
178
178
  :where(.tab) {
179
- left: var(--border-width);
180
179
  top: 0;
180
+ left: var(--border-width);
181
181
  right: 0;
182
- border-left-width: 0;
183
182
  border-bottom-width: var(--border-width);
183
+ border-left-width: 0;
184
184
  border-right-width: var(--border-width);
185
- border-start-end-radius: var(--radius);
186
- border-end-end-radius: var(--radius);
187
185
  border-start-start-radius: 0;
186
+ border-start-end-radius: var(--radius);
188
187
  border-end-start-radius: 0;
188
+ border-end-end-radius: var(--radius);
189
189
  }
190
190
  }
191
191
  }
@@ -209,7 +209,7 @@
209
209
 
210
210
  &:where(:not(:first-child)) {
211
211
  border-left-width: var(--border-width);
212
- border-color: var(--_bc, var(--border-color));
212
+ border-color: var(--_bca, var(--_bc, var(--border-color)));
213
213
  }
214
214
 
215
215
  &:where(:first-child) {
@@ -232,7 +232,7 @@
232
232
 
233
233
  &:where(:not(:first-child)) {
234
234
  border-top-width: var(--border-width);
235
- border-color: var(--_bc, var(--border-color));
235
+ border-color: var(--_bca, var(--_bc, var(--border-color)));
236
236
  }
237
237
 
238
238
  &:where(:first-child) {
@@ -261,7 +261,7 @@
261
261
 
262
262
  &:where(:not(:first-child)) {
263
263
  border-left-width: var(--border-width);
264
- border-color: var(--_bc, var(--border-color));
264
+ border-color: var(--_bca, var(--_bc, var(--border-color)));
265
265
  }
266
266
 
267
267
  &:where(:first-child) {
@@ -283,7 +283,7 @@
283
283
 
284
284
  &:where(:not(:first-child)) {
285
285
  border-top-width: var(--border-width);
286
- border-color: var(--_bc, var(--border-color));
286
+ border-color: var(--_bca, var(--_bc, var(--border-color)));
287
287
  }
288
288
 
289
289
  &:where(:first-child) {
@@ -2,17 +2,17 @@
2
2
  --_cols: var(--cols);
3
3
  display: flex;
4
4
  flex-flow: row wrap;
5
- gap: var(--gap, 1rlh);
5
+ gap: var(--gap, 1rem);
6
6
  width: 100%;
7
7
 
8
8
  > *,
9
9
  > *:where(astro-island, astro-slot) > *,
10
10
  > :where(.contents) > * {
11
- --one-column: var(--gap, 1rlh) * (var(--_cols, 1) - 1);
11
+ --one-column: var(--gap, 1rem) * (var(--_cols, 1) - 1);
12
12
  flex: var(--grow, var(--span, 1)) var(--span, 1)
13
13
  calc(
14
14
  (100% - var(--one-column)) / var(--_cols, 1) * var(--span, 1) +
15
- (var(--span, 1) - 1) * var(--gap, 1rlh)
15
+ (var(--span, 1) - 1) * var(--gap, 1rem)
16
16
  );
17
17
  min-width: min(100%, var(--item-width, 3rem));
18
18
  max-width: 100%;
@@ -23,7 +23,7 @@
23
23
  & {
24
24
  display: flex;
25
25
  flex-flow: row wrap;
26
- gap: var(--gap, 1rlh);
26
+ gap: var(--gap, 1rem);
27
27
  width: 100%;
28
28
 
29
29
  > * {
@@ -1,5 +1,5 @@
1
1
  @theme inline {
2
- --spacing-section: 2rlh;
2
+ --spacing-section: 2rem;
3
3
  --spacing-section-mini: calc(var(--spacing-section) * 0.5);
4
4
  --spacing-section-cont: 0;
5
5
  }
@@ -1,47 +1,41 @@
1
1
  @utility divider-scaffold {
2
- & {
3
- align-self: stretch;
4
- display: flex;
5
- align-items: center;
6
- padding: 0 !important;
7
- border-radius: 0 !important;
2
+ align-self: stretch;
3
+ display: flex;
4
+ align-items: center;
5
+ padding: 0 !important;
6
+ border-radius: 0 !important;
8
7
 
9
- &:where(:not(:empty)) {
10
- gap: var(--gap, 1rlh);
11
- }
8
+ &:where(:not(:empty)) {
9
+ gap: var(--gap, 1rem);
10
+ }
12
11
 
13
- &::before,
14
- &::after {
15
- content: '';
16
- background-color: var(--border-color, currentColor);
17
- }
12
+ &::before,
13
+ &::after {
14
+ content: '';
15
+ background-color: var(--border-color, currentColor);
18
16
  }
19
17
  }
20
18
 
21
19
  @utility divider-x {
22
- & {
23
- @apply divider-scaffold;
24
- flex-grow: 1;
20
+ @apply divider-scaffold;
21
+ flex-grow: 1;
25
22
 
26
- &::before,
27
- &::after {
28
- flex-grow: 1;
29
- height: var(--border-width, 1px);
30
- }
23
+ &::before,
24
+ &::after {
25
+ flex-grow: 1;
26
+ height: var(--border-width, 1px);
31
27
  }
32
28
  }
33
29
 
34
30
  @utility divider-y {
35
- & {
36
- @apply divider-scaffold;
37
- flex-grow: 0;
38
- flex-direction: column;
31
+ @apply divider-scaffold;
32
+ flex-grow: 0;
33
+ flex-direction: column;
39
34
 
40
- &::before,
41
- &::after {
42
- flex-grow: 1;
43
- width: var(--border-width, 1px);
44
- }
35
+ &::before,
36
+ &::after {
37
+ flex-grow: 1;
38
+ width: var(--border-width, 1px);
45
39
  }
46
40
  }
47
41
 
@@ -59,27 +53,23 @@
59
53
  * Divider between *
60
54
  *********************/
61
55
  @utility divider-between-x {
62
- & {
63
- flex-direction: column;
64
- row-gap: 0;
56
+ flex-direction: column;
57
+ row-gap: 0;
65
58
 
66
- > * + *,
67
- > * + *:where(astro-island, astro-slot):not(:first-of-type) > * {
68
- border-top-width: var(--border-width, 1px);
69
- border-color: var(--_bc, var(--border-color));
70
- }
59
+ > * + *,
60
+ > * + *:where(astro-island, astro-slot):not(:first-of-type) > * {
61
+ border-top-width: var(--border-width, 1px);
62
+ border-color: var(--_bca, var(--_bc, var(--border-color)));
71
63
  }
72
64
  }
73
65
 
74
66
  @utility divider-between-y {
75
- & {
76
- column-gap: 0;
67
+ column-gap: 0;
77
68
 
78
- > * + *,
79
- > * + *:where(astro-island, astro-slot) > * {
80
- border-left-width: var(--border-width, 1px);
81
- border-color: var(--_bc, var(--border-color));
82
- }
69
+ > * + *,
70
+ > * + *:where(astro-island, astro-slot) > * {
71
+ border-left-width: var(--border-width, 1px);
72
+ border-color: var(--_bca, var(--_bc, var(--border-color)));
83
73
  }
84
74
  }
85
75
 
@@ -2,13 +2,13 @@
2
2
  --snap-align: start;
3
3
  --snap-type: proximity;
4
4
 
5
- /* --scroll-margin: 1rlh; */
5
+ /* --scroll-margin: 1rem; */
6
6
  }
7
7
 
8
8
  @utility scrollable {
9
9
  & {
10
10
  display: flex;
11
- gap: var(--gap, 1rlh);
11
+ gap: var(--gap, 1rem);
12
12
 
13
13
  > :where(*) {
14
14
  flex-grow: 0;
package/src/reset.css CHANGED
@@ -31,7 +31,7 @@ pre {
31
31
  * Avoid text overflows *
32
32
  *********************/
33
33
  :target {
34
- scroll-margin: 2rlh;
34
+ scroll-margin: 2rem;
35
35
  }
36
36
 
37
37
  /* Chilled out text underlines */
@@ -34,14 +34,31 @@ Usage with the Fill System
34
34
  --_bgc: var(--bg-color);
35
35
  --_tc: var(--text-color, currentcolor);
36
36
  --_bc: var(--border-color, currentcolor);
37
- border-color: var(--_bc, currentcolor);
38
- color: var(--_tc);
39
- background: var(--_bgc);
37
+
38
+ /* Fades each colour by its alpha. Stays invalid while the alpha is unset, so the property falls back to the plain colour. */
39
+ --_bga: color-mix(
40
+ in oklab,
41
+ var(--_bgc) calc(var(--bg-alpha) * 100%),
42
+ transparent
43
+ );
44
+ --_tca: color-mix(
45
+ in oklab,
46
+ var(--_tc) calc(var(--text-alpha) * 100%),
47
+ transparent
48
+ );
49
+ --_bca: color-mix(
50
+ in oklab,
51
+ var(--_bc) calc(var(--border-alpha) * 100%),
52
+ transparent
53
+ );
54
+ border-color: var(--_bca, var(--_bc, currentcolor));
55
+ color: var(--_tca, var(--_tc));
56
+ background: var(--_bga, var(--_bgc));
40
57
  }
41
58
 
42
59
  @utility pigment-svg-scaffold {
43
60
  --_fc: var(--fill-color);
44
- --_sc: var(--stroke-color, var(--text-color, currentcolor));
61
+ --_sc: var(--stroke-color, var(--_tca, var(--text-color, currentcolor)));
45
62
 
46
63
  :where(svg path) {
47
64
  @apply transition-scaffold;
@@ -61,7 +78,10 @@ Usage with the Fill System
61
78
  @utility pigment-hover-svg-scaffold {
62
79
  &:hover {
63
80
  --_fc: var(--fill-hover-color, var(--fill-color));
64
- --_sc: var(--stroke-hover-color, var(--_tc));
81
+ --_sc: var(
82
+ --stroke-hover-color,
83
+ var(--stroke-color, var(--_tca, var(--_tc)))
84
+ );
65
85
  }
66
86
  }
67
87
 
@@ -79,7 +99,10 @@ Usage with the Fill System
79
99
  @utility pigment-focus-svg-scaffold {
80
100
  &:focus {
81
101
  --_fc: var(--fill-focus-color, var(--fill-color));
82
- --_sc: var(--stroke-focus-color, var(--_tc));
102
+ --_sc: var(
103
+ --stroke-focus-color,
104
+ var(--stroke-color, var(--_tca, var(--_tc)))
105
+ );
83
106
  }
84
107
  }
85
108
 
@@ -94,7 +117,10 @@ Usage with the Fill System
94
117
  @utility pigment-active-svg-scaffold {
95
118
  &:active {
96
119
  --_fc: var(--fill-active-color, var(--fill-color, revert-layer));
97
- --_sc: var(--stroke-active-color, var(--_tc));
120
+ --_sc: var(
121
+ --stroke-active-color,
122
+ var(--stroke-color, var(--_tca, var(--_tc)))
123
+ );
98
124
  }
99
125
  }
100
126
 
@@ -119,7 +145,10 @@ Usage with the Fill System
119
145
  &[aria-pressed='true'],
120
146
  &[aria-expanded='true'] {
121
147
  --_fc: var(--fill-selected-color, var(--fill-color, revert-layer));
122
- --_sc: var(--stroke-selected-color, var(--_tc));
148
+ --_sc: var(
149
+ --stroke-selected-color,
150
+ var(--stroke-color, var(--_tca, var(--_tc)))
151
+ );
123
152
  }
124
153
  }
125
154
 
@@ -13,7 +13,7 @@
13
13
 
14
14
  @utility border-scaffold {
15
15
  border: var(--border-width) var(--border-style)
16
- var(--_bc, var(--border-color));
16
+ var(--_bca, var(--_bc, var(--border-color)));
17
17
  border-radius: var(--radius);
18
18
  }
19
19
 
@@ -126,5 +126,6 @@
126
126
  *********************/
127
127
  @utility radius-* {
128
128
  --radius: --value([length]);
129
+ /* stylelint-disable-next-line declaration-block-no-duplicate-custom-properties -- Tailwind keeps only the declaration whose --value() matches */
129
130
  --radius: --spacing(--value(number));
130
131
  }
@@ -1,10 +1,10 @@
1
1
  @theme {
2
2
  /* Typography */
3
3
  --leading: 1.5;
4
- --gap: 1rlh;
4
+ --gap: 1rem;
5
5
 
6
6
  /* Padding */
7
- --padding: 1rlh;
7
+ --padding: 1rem;
8
8
 
9
9
  /* Borders */
10
10
  --border-width: 1px;