shelving 1.305.0 → 1.306.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/package.json +1 -1
- package/ui/style/TINT_CLASS.md +17 -0
- package/ui/style/Tint.d.ts +2 -1
- package/ui/style/Tint.js +3 -2
- package/ui/style/Tint.tsx +3 -2
package/package.json
CHANGED
package/ui/style/TINT_CLASS.md
CHANGED
|
@@ -48,4 +48,21 @@ A theme is a CSS file of custom-property overrides at `:root`, imported after th
|
|
|
48
48
|
2. **Retint a region.** Apply `color=` / `status=` to a container — `<Card color="purple">`, or a `<Panel color="purple">` wrapping a whole section — and everything inside re-tints, with text, border, surface, and hover shades all derived for free. Components don't expose a per-component `--x-tint` hook; the variant moves the anchor, not a bespoke variable.
|
|
49
49
|
3. **Override one property.** Per-property hooks are the scalpel: `--button-radius: 999px`, `--card-radius: 0`, `--tag-case: none`.
|
|
50
50
|
|
|
51
|
+
**Overrides that use ladder steps go on `:root, .tint`.** A `var()` inside a custom property resolves where the property is declared. So an override at `:root` alone locks in the `:root` ladder, and stays grey inside a `<Card color="red">`:
|
|
52
|
+
|
|
53
|
+
```css
|
|
54
|
+
/* Wrong: `--tint-95` resolves once, at `:root`. */
|
|
55
|
+
:root {
|
|
56
|
+
--table-border: 2px solid var(--tint-95);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Right: the value resolves again in every scope that rebuilds the ladder. */
|
|
60
|
+
:root,
|
|
61
|
+
.tint {
|
|
62
|
+
--table-border: 2px solid var(--tint-95);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`TINT_CLASS` adds a plain global `tint` class (as well as its hashed module class) for this purpose, so `tint` is a reserved class name. Do not use `* { … }` for this: it declares the variable on every element, which adds style-recalc cost on large pages.
|
|
67
|
+
|
|
51
68
|
**Don't override individual ladder steps (`--tint-90`, etc.) at `:root`.** The ladder is *recomputed* from the anchor inside every `TINT_CLASS` scope — which includes every component that accepts `color=` or `status=` — so a step override at `:root` only reaches untinted regions and produces inconsistent surfaces. Move the anchor (option 1 or 2) instead, and the steps follow.
|
package/ui/style/Tint.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export type TintVariant = "00" | "05" | "10" | "15" | "20" | "25" | "30" | "35"
|
|
|
10
10
|
* CSS class that (re)calculates the full ladder of tint shades from the current global tint colour.
|
|
11
11
|
*
|
|
12
12
|
* - Applied by colour/status helpers so an element can compose shades like `--tint-20` and `--tint-95` of the selected hue.
|
|
13
|
+
* - Also adds the plain global `tint` class, so theme files can target the recompute scope with `:root, .tint { … }`.
|
|
13
14
|
*
|
|
14
15
|
* @see https://shelving.cc/ui/TINT_CLASS
|
|
15
16
|
*/
|
|
16
|
-
export declare const TINT_CLASS: string
|
|
17
|
+
export declare const TINT_CLASS: string;
|
package/ui/style/Tint.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { getModuleClass } from "../util/css.js";
|
|
1
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
2
2
|
import THEME_CSS from "./Tint.module.css";
|
|
3
3
|
/**
|
|
4
4
|
* CSS class that (re)calculates the full ladder of tint shades from the current global tint colour.
|
|
5
5
|
*
|
|
6
6
|
* - Applied by colour/status helpers so an element can compose shades like `--tint-20` and `--tint-95` of the selected hue.
|
|
7
|
+
* - Also adds the plain global `tint` class, so theme files can target the recompute scope with `:root, .tint { … }`.
|
|
7
8
|
*
|
|
8
9
|
* @see https://shelving.cc/ui/TINT_CLASS
|
|
9
10
|
*/
|
|
10
|
-
export const TINT_CLASS = getModuleClass(THEME_CSS, "tint");
|
|
11
|
+
export const TINT_CLASS = getClass("tint", getModuleClass(THEME_CSS, "tint"));
|
package/ui/style/Tint.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getModuleClass } from "../util/css.js";
|
|
1
|
+
import { getClass, getModuleClass } from "../util/css.js";
|
|
2
2
|
import THEME_CSS from "./Tint.module.css";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -36,7 +36,8 @@ export type TintVariant =
|
|
|
36
36
|
* CSS class that (re)calculates the full ladder of tint shades from the current global tint colour.
|
|
37
37
|
*
|
|
38
38
|
* - Applied by colour/status helpers so an element can compose shades like `--tint-20` and `--tint-95` of the selected hue.
|
|
39
|
+
* - Also adds the plain global `tint` class, so theme files can target the recompute scope with `:root, .tint { … }`.
|
|
39
40
|
*
|
|
40
41
|
* @see https://shelving.cc/ui/TINT_CLASS
|
|
41
42
|
*/
|
|
42
|
-
export const TINT_CLASS = getModuleClass(THEME_CSS, "tint");
|
|
43
|
+
export const TINT_CLASS = getClass("tint", getModuleClass(THEME_CSS, "tint"));
|