boss-css 0.0.1 → 0.0.2
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 +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +43 -0
- package/dist/_virtual/rolldown_runtime.mjs +20 -0
- package/dist/api/browser.cjs +54 -0
- package/dist/api/browser.mjs +48 -0
- package/dist/api/config.cjs +94 -0
- package/dist/api/config.mjs +91 -0
- package/dist/api/css.cjs +304 -0
- package/dist/api/css.mjs +303 -0
- package/dist/api/dictionary.cjs +218 -0
- package/dist/api/dictionary.mjs +215 -0
- package/dist/api/file/dts.cjs +21 -0
- package/dist/api/file/dts.mjs +21 -0
- package/dist/api/file/file.cjs +123 -0
- package/dist/api/file/file.mjs +120 -0
- package/dist/api/file/js.cjs +118 -0
- package/dist/api/file/js.mjs +116 -0
- package/dist/api/names.cjs +52 -0
- package/dist/api/names.mjs +46 -0
- package/dist/api/noopCss.cjs +37 -0
- package/dist/api/noopCss.mjs +36 -0
- package/dist/api/propTree.cjs +54 -0
- package/dist/api/propTree.mjs +48 -0
- package/dist/api/server.cjs +112 -0
- package/dist/api/server.mjs +106 -0
- package/dist/cli/build.cjs +1 -0
- package/dist/cli/build.mjs +3 -0
- package/dist/cli/index.cjs +30 -0
- package/dist/cli/index.mjs +29 -0
- package/dist/cli/tasks/build.cjs +24 -0
- package/dist/cli/tasks/build.mjs +23 -0
- package/dist/cli/tasks/choose.cjs +47 -0
- package/dist/cli/tasks/choose.mjs +46 -0
- package/dist/cli/tasks/compile.cjs +68 -0
- package/dist/cli/tasks/compile.mjs +67 -0
- package/dist/cli/tasks/dev.cjs +51 -0
- package/dist/cli/tasks/dev.mjs +48 -0
- package/dist/cli/tasks/init.cjs +1835 -0
- package/dist/cli/tasks/init.mjs +1831 -0
- package/dist/cli/tasks/watch.cjs +38 -0
- package/dist/cli/tasks/watch.mjs +37 -0
- package/dist/cli/templates/init.cjs +82 -0
- package/dist/cli/templates/init.mjs +78 -0
- package/dist/cli/types.cjs +13 -0
- package/dist/cli/types.mjs +13 -0
- package/dist/cli/utils.cjs +43 -0
- package/dist/cli/utils.mjs +41 -0
- package/dist/compile/classname-strategy.cjs +79 -0
- package/dist/compile/classname-strategy.mjs +77 -0
- package/dist/compile/classname.cjs +366 -0
- package/dist/compile/classname.mjs +360 -0
- package/dist/compile/index.cjs +238 -0
- package/dist/compile/index.mjs +235 -0
- package/dist/compile/jsx.cjs +803 -0
- package/dist/compile/jsx.mjs +800 -0
- package/dist/compile/prepared.cjs +88 -0
- package/dist/compile/prepared.mjs +87 -0
- package/dist/compile/runtime.cjs +33 -0
- package/dist/compile/runtime.mjs +32 -0
- package/dist/compile/transform.cjs +371 -0
- package/dist/compile/transform.mjs +369 -0
- package/dist/cx/index.cjs +93 -0
- package/dist/cx/index.mjs +85 -0
- package/dist/detect-fw/index.cjs +384 -0
- package/dist/detect-fw/index.mjs +379 -0
- package/dist/dev/client.cjs +39 -0
- package/dist/dev/client.mjs +38 -0
- package/dist/dev/plugin/browser.cjs +11 -0
- package/dist/dev/plugin/browser.mjs +9 -0
- package/dist/dev/plugin/server.cjs +86 -0
- package/dist/dev/plugin/server.mjs +78 -0
- package/dist/dev/port.cjs +46 -0
- package/dist/dev/port.mjs +43 -0
- package/dist/dev/runtime.cjs +28 -0
- package/dist/dev/runtime.mjs +29 -0
- package/dist/dev/server.cjs +808 -0
- package/dist/dev/server.mjs +805 -0
- package/dist/dev/shared.cjs +6 -0
- package/dist/dev/shared.mjs +5 -0
- package/dist/eslint-plugin/index.cjs +66 -0
- package/dist/eslint-plugin/index.mjs +66 -0
- package/dist/eslint-plugin/rules/classnames-only.cjs +68 -0
- package/dist/eslint-plugin/rules/classnames-only.mjs +68 -0
- package/dist/eslint-plugin/rules/format-classnames.cjs +137 -0
- package/dist/eslint-plugin/rules/format-classnames.mjs +136 -0
- package/dist/eslint-plugin/rules/no-unknown-classes.cjs +119 -0
- package/dist/eslint-plugin/rules/no-unknown-classes.mjs +119 -0
- package/dist/eslint-plugin/rules/prefer-classnames.cjs +69 -0
- package/dist/eslint-plugin/rules/prefer-classnames.mjs +69 -0
- package/dist/eslint-plugin/rules/prefer-token-values.cjs +197 -0
- package/dist/eslint-plugin/rules/prefer-token-values.mjs +197 -0
- package/dist/eslint-plugin/rules/props-only.cjs +115 -0
- package/dist/eslint-plugin/rules/props-only.mjs +115 -0
- package/dist/eslint-plugin/rules/redundant-cx.cjs +66 -0
- package/dist/eslint-plugin/rules/redundant-cx.mjs +66 -0
- package/dist/eslint-plugin/rules/require-prop-functions.cjs +130 -0
- package/dist/eslint-plugin/rules/require-prop-functions.mjs +130 -0
- package/dist/eslint-plugin/utils/api.cjs +30 -0
- package/dist/eslint-plugin/utils/api.mjs +29 -0
- package/dist/eslint-plugin/utils/ast.cjs +119 -0
- package/dist/eslint-plugin/utils/ast.mjs +112 -0
- package/dist/eslint-plugin/utils/boss-classes.cjs +185 -0
- package/dist/eslint-plugin/utils/boss-classes.mjs +175 -0
- package/dist/eslint-plugin/utils/defaults.cjs +99 -0
- package/dist/eslint-plugin/utils/defaults.mjs +93 -0
- package/dist/eslint-plugin/utils/format.cjs +20 -0
- package/dist/eslint-plugin/utils/format.mjs +19 -0
- package/dist/eslint-plugin/utils/order.cjs +76 -0
- package/dist/eslint-plugin/utils/order.mjs +76 -0
- package/dist/eslint-plugin/utils/property-order.cjs +449 -0
- package/dist/eslint-plugin/utils/property-order.mjs +448 -0
- package/dist/eslint-plugin/utils/static.cjs +36 -0
- package/dist/eslint-plugin/utils/static.mjs +35 -0
- package/dist/fontsource/directory.cjs +39588 -0
- package/dist/fontsource/directory.mjs +39587 -0
- package/dist/fontsource/server.cjs +291 -0
- package/dist/fontsource/server.mjs +282 -0
- package/dist/index.cjs +10 -0
- package/dist/index.mjs +6 -0
- package/dist/log/browser.cjs +28 -0
- package/dist/log/browser.mjs +28 -0
- package/dist/log/server.cjs +32 -0
- package/dist/log/server.mjs +30 -0
- package/dist/merge/index.cjs +590 -0
- package/dist/merge/index.mjs +586 -0
- package/dist/native/browser.cjs +78 -0
- package/dist/native/browser.mjs +77 -0
- package/dist/native/server.cjs +180 -0
- package/dist/native/server.mjs +176 -0
- package/dist/native/styleTypes.cjs +168 -0
- package/dist/native/styleTypes.mjs +164 -0
- package/dist/parser/classname/server.cjs +239 -0
- package/dist/parser/classname/server.mjs +232 -0
- package/dist/parser/jsx/browser.cjs +66 -0
- package/dist/parser/jsx/browser.mjs +63 -0
- package/dist/parser/jsx/extractCode.cjs +99 -0
- package/dist/parser/jsx/extractCode.mjs +98 -0
- package/dist/parser/jsx/extractPrepared.cjs +123 -0
- package/dist/parser/jsx/extractPrepared.mjs +122 -0
- package/dist/parser/jsx/extractProps.cjs +234 -0
- package/dist/parser/jsx/extractProps.mjs +232 -0
- package/dist/parser/jsx/isDOMProp.cjs +17 -0
- package/dist/parser/jsx/isDOMProp.mjs +15 -0
- package/dist/parser/jsx/native.cjs +110 -0
- package/dist/parser/jsx/native.mjs +108 -0
- package/dist/parser/jsx/runtime.cjs +4 -0
- package/dist/parser/jsx/runtime.mjs +3 -0
- package/dist/parser/jsx/server.cjs +278 -0
- package/dist/parser/jsx/server.mjs +268 -0
- package/dist/postcss/index.cjs +16 -0
- package/dist/postcss/index.mjs +16 -0
- package/dist/prop/at/runtime-only.cjs +90 -0
- package/dist/prop/at/runtime-only.mjs +88 -0
- package/dist/prop/at/server.cjs +282 -0
- package/dist/prop/at/server.mjs +268 -0
- package/dist/prop/at/shared.cjs +153 -0
- package/dist/prop/at/shared.mjs +144 -0
- package/dist/prop/bosswind/browser.cjs +18 -0
- package/dist/prop/bosswind/browser.mjs +16 -0
- package/dist/prop/bosswind/runtime-only.cjs +18 -0
- package/dist/prop/bosswind/runtime-only.mjs +16 -0
- package/dist/prop/bosswind/server.cjs +81 -0
- package/dist/prop/bosswind/server.mjs +72 -0
- package/dist/prop/bosswind/shared.cjs +861 -0
- package/dist/prop/bosswind/shared.mjs +855 -0
- package/dist/prop/bosswind/tailwind-theme.cjs +703 -0
- package/dist/prop/bosswind/tailwind-theme.mjs +702 -0
- package/dist/prop/child/runtime-only.cjs +18 -0
- package/dist/prop/child/runtime-only.mjs +15 -0
- package/dist/prop/child/server.cjs +81 -0
- package/dist/prop/child/server.mjs +72 -0
- package/dist/prop/css/getDtsTemplate.cjs +65 -0
- package/dist/prop/css/getDtsTemplate.mjs +63 -0
- package/dist/prop/css/runtime-only.cjs +14 -0
- package/dist/prop/css/runtime-only.mjs +13 -0
- package/dist/prop/css/server.cjs +99 -0
- package/dist/prop/css/server.mjs +90 -0
- package/dist/prop/pseudo/runtime-only.cjs +23 -0
- package/dist/prop/pseudo/runtime-only.mjs +21 -0
- package/dist/prop/pseudo/server.cjs +91 -0
- package/dist/prop/pseudo/server.mjs +82 -0
- package/dist/prop/pseudo/shared.cjs +61 -0
- package/dist/prop/pseudo/shared.mjs +60 -0
- package/dist/reset/server.cjs +34 -0
- package/dist/reset/server.mjs +26 -0
- package/dist/runtime/index.cjs +119 -0
- package/dist/runtime/index.mjs +118 -0
- package/dist/runtime/preact.cjs +4 -0
- package/dist/runtime/preact.mjs +3 -0
- package/dist/runtime/qwik.cjs +21 -0
- package/dist/runtime/qwik.mjs +18 -0
- package/dist/runtime/react.cjs +4 -0
- package/dist/runtime/react.mjs +3 -0
- package/dist/runtime/solid.cjs +15 -0
- package/dist/runtime/solid.mjs +14 -0
- package/dist/runtime/stencil.cjs +25 -0
- package/dist/runtime/stencil.mjs +21 -0
- package/dist/runtime/style.cjs +14 -0
- package/dist/runtime/style.mjs +13 -0
- package/dist/shared/boundaries.cjs +288 -0
- package/dist/shared/boundaries.mjs +285 -0
- package/dist/shared/customCss.cjs +212 -0
- package/dist/shared/customCss.mjs +211 -0
- package/dist/shared/debug.cjs +76 -0
- package/dist/shared/debug.mjs +74 -0
- package/dist/shared/file.cjs +21 -0
- package/dist/shared/file.mjs +19 -0
- package/dist/shared/framework.cjs +10 -0
- package/dist/shared/framework.mjs +9 -0
- package/dist/shared/json.cjs +58 -0
- package/dist/shared/json.mjs +57 -0
- package/dist/shared/types.cjs +11 -0
- package/dist/shared/types.mjs +10 -0
- package/dist/strategy/classic/runtime-only.cjs +190 -0
- package/dist/strategy/classic/runtime-only.mjs +186 -0
- package/dist/strategy/classname-first/runtime-only.cjs +138 -0
- package/dist/strategy/classname-first/runtime-only.mjs +134 -0
- package/dist/strategy/classname-first/server.cjs +139 -0
- package/dist/strategy/classname-first/server.mjs +133 -0
- package/dist/strategy/classname-only/server.cjs +43 -0
- package/dist/strategy/classname-only/server.mjs +35 -0
- package/dist/strategy/inline-first/browser.cjs +61 -0
- package/dist/strategy/inline-first/browser.mjs +58 -0
- package/dist/strategy/inline-first/runtime-only.cjs +159 -0
- package/dist/strategy/inline-first/runtime-only.mjs +155 -0
- package/dist/strategy/inline-first/server.cjs +92 -0
- package/dist/strategy/inline-first/server.mjs +83 -0
- package/dist/strategy/runtime/runtime-only.cjs +24 -0
- package/dist/strategy/runtime/runtime-only.mjs +22 -0
- package/dist/strategy/runtime/server.cjs +72 -0
- package/dist/strategy/runtime/server.mjs +63 -0
- package/dist/strategy/runtime-only/css.cjs +183 -0
- package/dist/strategy/runtime-only/css.mjs +181 -0
- package/dist/tasks/build.cjs +88 -0
- package/dist/tasks/build.mjs +84 -0
- package/dist/tasks/compile.cjs +12 -0
- package/dist/tasks/compile.mjs +12 -0
- package/dist/tasks/postcss.cjs +116 -0
- package/dist/tasks/postcss.mjs +113 -0
- package/dist/tasks/session.cjs +46 -0
- package/dist/tasks/session.mjs +42 -0
- package/dist/tasks/watch.cjs +102 -0
- package/dist/tasks/watch.mjs +99 -0
- package/dist/transform/cache.cjs +24 -0
- package/dist/transform/cache.mjs +21 -0
- package/dist/transform/processFile.cjs +26 -0
- package/dist/transform/processFile.mjs +24 -0
- package/dist/use/token/browser.cjs +65 -0
- package/dist/use/token/browser.mjs +61 -0
- package/dist/use/token/runtime-only.cjs +245 -0
- package/dist/use/token/runtime-only.mjs +239 -0
- package/dist/use/token/server.cjs +325 -0
- package/dist/use/token/server.mjs +313 -0
- package/dist/use/token/vars.cjs +47 -0
- package/dist/use/token/vars.mjs +46 -0
- package/package.json +300 -4
- package/src/api/config.d.ts +1 -0
- package/src/fontsource/types.d.ts +50 -0
- package/src/packages/document-create-element/createElement.browser.js +3 -0
- package/src/packages/document-create-element/createElement.js +7 -0
- package/src/packages/document-create-element/package.json +17 -0
- package/src/packages/is-css-prop/browser.js +13 -0
- package/src/packages/is-css-prop/index.js +13 -0
- package/src/packages/is-css-prop/package-lock.json +52 -0
- package/src/packages/is-css-prop/package.json +17 -0
- package/src/prop/css/csstype.json +4387 -0
- package/src/prop/css/package.json +3 -0
- package/src/reset/reset.css +259 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
Modern CSS Reset (2026-ish)
|
|
3
|
+
---------------------------------
|
|
4
|
+
Goals:
|
|
5
|
+
- Start from a predictable baseline across evergreen browsers (Chrome/Edge, Firefox, Safari).
|
|
6
|
+
- Keep specificity LOW so your app styles win easily (via :where()).
|
|
7
|
+
- Make the reset easy to override and easy to delete pieces from.
|
|
8
|
+
- Prefer modern standards + progressive enhancement over legacy browser hacks.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/* -----------------------------------------------------------------------------
|
|
12
|
+
RESET LAYER
|
|
13
|
+
-----------------------------------------------------------------------------
|
|
14
|
+
Everything in here should be “baseline” behavior, not brand design.
|
|
15
|
+
*/
|
|
16
|
+
@layer reset {
|
|
17
|
+
/* 1) Box sizing
|
|
18
|
+
----------------------------------------------------------------------------
|
|
19
|
+
Border-box makes sizing math intuitive: padding + border stay *inside* width/height.
|
|
20
|
+
Apply to pseudo-elements too so decorative ::before/::after behaves predictably.
|
|
21
|
+
*/
|
|
22
|
+
:where(*, *::before, *::after) {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* 2) Prevent font size inflation on mobile
|
|
27
|
+
----------------------------------------------------------------------------
|
|
28
|
+
Some mobile browsers (notably iOS Safari) can auto-inflate text sizes (e.g. on rotation),
|
|
29
|
+
which can unexpectedly change layout and typography.
|
|
30
|
+
Using 100% is a safe way to effectively disable inflation while keeping behavior consistent.
|
|
31
|
+
*/
|
|
32
|
+
:where(html) {
|
|
33
|
+
-webkit-text-size-adjust: 100%;
|
|
34
|
+
-moz-text-size-adjust: 100%;
|
|
35
|
+
text-size-adjust: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* 3) More readable tab size (opinionated, but very common)
|
|
39
|
+
----------------------------------------------------------------------------
|
|
40
|
+
Browsers often default tab-size to 8, which can make code blocks harder to read.
|
|
41
|
+
This does *not* affect spaces, only tab characters.
|
|
42
|
+
*/
|
|
43
|
+
:where(html) {
|
|
44
|
+
-moz-tab-size: 4;
|
|
45
|
+
tab-size: 4;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* 4) Remove default margins
|
|
49
|
+
----------------------------------------------------------------------------
|
|
50
|
+
Default margins are “document styling” decisions made by the browser.
|
|
51
|
+
Most apps/components want explicit control over spacing.
|
|
52
|
+
Exception: <dialog> uses margin:auto for centering, so we keep that default.
|
|
53
|
+
*/
|
|
54
|
+
:where(*:not(dialog)) {
|
|
55
|
+
margin: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* 5) Core body defaults (accessible baseline)
|
|
59
|
+
----------------------------------------------------------------------------
|
|
60
|
+
- min-height: 100vh is handy for full-height layouts/backgrounds.
|
|
61
|
+
- line-height: 1 avoids general spacing issues and give the control to user to adjust where necessary.
|
|
62
|
+
*/
|
|
63
|
+
:where(body) {
|
|
64
|
+
min-height: 100vh;
|
|
65
|
+
line-height: 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* 6) Media elements: make them easier to work with
|
|
69
|
+
----------------------------------------------------------------------------
|
|
70
|
+
- display:block removes the “inline element baseline gap” you see with images/videos.
|
|
71
|
+
- max-inline-size:100% makes media responsive by default.
|
|
72
|
+
- block-size:auto preserves aspect ratio when width changes.
|
|
73
|
+
Using logical properties keeps things friendly for different writing modes.
|
|
74
|
+
*/
|
|
75
|
+
:where(img, picture, video, canvas, svg) {
|
|
76
|
+
display: block;
|
|
77
|
+
max-inline-size: 100%;
|
|
78
|
+
block-size: auto;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* 7) Form controls: inherit typography
|
|
82
|
+
----------------------------------------------------------------------------
|
|
83
|
+
Browsers often give inputs/buttons their own font styling.
|
|
84
|
+
Inheriting makes UI consistent without repeating font rules everywhere.
|
|
85
|
+
`font: inherit` includes font-family, font-size, font-weight, line-height, etc.
|
|
86
|
+
*/
|
|
87
|
+
:where(input, button, textarea, select) {
|
|
88
|
+
font: inherit;
|
|
89
|
+
color: inherit; /* Keeps form text aligned with surrounding text color */
|
|
90
|
+
letter-spacing: inherit; /* Not included in `font`, but often desirable to inherit */
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* 8) Tables: predictable borders/spacing
|
|
94
|
+
----------------------------------------------------------------------------
|
|
95
|
+
`border-collapse: collapse` is the most common baseline for table layouts.
|
|
96
|
+
If you prefer separated borders, remove this rule.
|
|
97
|
+
*/
|
|
98
|
+
:where(table) {
|
|
99
|
+
border-collapse: collapse;
|
|
100
|
+
border-spacing: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* 9) Avoid text overflow (long words / URLs)
|
|
104
|
+
----------------------------------------------------------------------------
|
|
105
|
+
Without this, a single long token can blow up layouts by forcing horizontal scrolling.
|
|
106
|
+
`overflow-wrap: break-word` allows the browser to hard-wrap when needed.
|
|
107
|
+
*/
|
|
108
|
+
:where(p, h1, h2, h3, h4, h5, h6) {
|
|
109
|
+
overflow-wrap: break-word;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* 10) Modern text wrapping (progressive enhancement)
|
|
113
|
+
----------------------------------------------------------------------------
|
|
114
|
+
`text-wrap` can improve rag/line breaks:
|
|
115
|
+
- pretty: nicer paragraph wrapping (more expensive)
|
|
116
|
+
- balance: balances headings across lines
|
|
117
|
+
Browsers that don’t support it will just ignore it.
|
|
118
|
+
*/
|
|
119
|
+
@supports (text-wrap: balance) {
|
|
120
|
+
:where(p) {
|
|
121
|
+
text-wrap: pretty;
|
|
122
|
+
}
|
|
123
|
+
:where(h1, h2, h3, h4, h5, h6) {
|
|
124
|
+
text-wrap: balance;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* 11) Root stacking context
|
|
129
|
+
----------------------------------------------------------------------------
|
|
130
|
+
Creating an isolated stacking context helps avoid “z-index wars”
|
|
131
|
+
when using portal/root elements (React, Next.js, etc.).
|
|
132
|
+
*/
|
|
133
|
+
:where(#root, #__next) {
|
|
134
|
+
isolation: isolate;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* 12) Lists: remove bullets only when explicitly intended
|
|
138
|
+
----------------------------------------------------------------------------
|
|
139
|
+
Removing list-style globally is a footgun because content lists should keep markers.
|
|
140
|
+
Using role="list" is an explicit signal: “this list is for layout/nav, not content”.
|
|
141
|
+
Also: this avoids some assistive-tech quirks that can happen when list styles are removed.
|
|
142
|
+
*/
|
|
143
|
+
:where(ul[role='list'], ol[role='list']) {
|
|
144
|
+
list-style: none;
|
|
145
|
+
padding: 0; /* Otherwise you get indented-but-bulletless lists */
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* 13) Textareas: avoid tiny default height
|
|
149
|
+
----------------------------------------------------------------------------
|
|
150
|
+
If a <textarea> has no rows attribute, it can be comically small.
|
|
151
|
+
This gives a reasonable default while still allowing authors to override.
|
|
152
|
+
*/
|
|
153
|
+
:where(textarea:not([rows])) {
|
|
154
|
+
min-block-size: 10em;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* 14) Anchor targets: don’t slam to the very top
|
|
158
|
+
----------------------------------------------------------------------------
|
|
159
|
+
When jumping to #hash anchors, adding scroll-margin gives breathing room.
|
|
160
|
+
Especially useful if you have a sticky header (adjust value accordingly).
|
|
161
|
+
*/
|
|
162
|
+
:where(:target) {
|
|
163
|
+
scroll-margin-block: 5ex;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* 15) Reduced motion “safety net”
|
|
167
|
+
----------------------------------------------------------------------------
|
|
168
|
+
If the user requests reduced motion:
|
|
169
|
+
- turn off smooth scrolling
|
|
170
|
+
- effectively disable animations/transitions
|
|
171
|
+
The !important is intentional: this should override later component styles.
|
|
172
|
+
*/
|
|
173
|
+
@media (prefers-reduced-motion: reduce) {
|
|
174
|
+
:where(html:focus-within) {
|
|
175
|
+
scroll-behavior: auto;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
:where(*, *::before, *::after) {
|
|
179
|
+
animation-duration: 0.01ms !important;
|
|
180
|
+
animation-iteration-count: 1 !important;
|
|
181
|
+
transition-duration: 0.01ms !important;
|
|
182
|
+
scroll-behavior: auto !important;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* 16) Enable keyword size transitions (VERY modern, progressive enhancement)
|
|
187
|
+
----------------------------------------------------------------------------
|
|
188
|
+
This opt-in lets CSS transitions animate between:
|
|
189
|
+
height/width: 0 <-> auto/fit-content/etc.
|
|
190
|
+
Historically you needed JS measurement for this.
|
|
191
|
+
It’s opt-in for backwards compatibility: enabling it can cause previously “impossible”
|
|
192
|
+
size transitions to start animating (sometimes unexpectedly).
|
|
193
|
+
Limiting it to users who allow motion is a good default.
|
|
194
|
+
*/
|
|
195
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
196
|
+
@supports (interpolate-size: allow-keywords) {
|
|
197
|
+
:where(html) {
|
|
198
|
+
interpolate-size: allow-keywords;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* Links: nicer underlines for unclassed links
|
|
204
|
+
text-decoration-skip-ink avoids underlines crossing descenders.
|
|
205
|
+
*/
|
|
206
|
+
:where(a:not([class])) {
|
|
207
|
+
text-decoration-skip-ink: auto;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* Smooth scrolling (only when focused via keyboard, and overridden by reduced motion)
|
|
211
|
+
Some teams like this. Others prefer to avoid it globally.
|
|
212
|
+
*/
|
|
213
|
+
:where(html:focus-within) {
|
|
214
|
+
scroll-behavior: smooth;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* Reserve scrollbar space to prevent layout shifts
|
|
218
|
+
When content starts overflowing, scrollbars can appear and shift layout.
|
|
219
|
+
scrollbar-gutter: stable reserves space to prevent that (supported in modern browsers).
|
|
220
|
+
*/
|
|
221
|
+
@supports (scrollbar-gutter: stable) {
|
|
222
|
+
:where(html) {
|
|
223
|
+
scrollbar-gutter: stable;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* Dark mode defaults via UA styling
|
|
228
|
+
color-scheme tells the browser you support light/dark, affecting:
|
|
229
|
+
- form controls
|
|
230
|
+
- scrollbars
|
|
231
|
+
- canvas default colors
|
|
232
|
+
For best results, also add in HTML:
|
|
233
|
+
<meta name="color-scheme" content="light dark">
|
|
234
|
+
*/
|
|
235
|
+
:where(html) {
|
|
236
|
+
color-scheme: light dark;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* iOS tap highlight
|
|
240
|
+
Removes the gray flash on tapped elements in iOS Safari.
|
|
241
|
+
*/
|
|
242
|
+
:where(html) {
|
|
243
|
+
-webkit-tap-highlight-color: transparent;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* Force the hidden attribute to always hide
|
|
247
|
+
Useful if a component library accidentally applies display styles to [hidden].
|
|
248
|
+
*/
|
|
249
|
+
:where([hidden]) {
|
|
250
|
+
display: none !important;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* Font smoothing (macOS only, controversial)
|
|
254
|
+
Some prefer antialiased rendering; others dislike the reduced contrast.
|
|
255
|
+
*/
|
|
256
|
+
:where(body) {
|
|
257
|
+
-webkit-font-smoothing: antialiased;
|
|
258
|
+
}
|
|
259
|
+
}
|