rei-kit 1.0.2 → 2.0.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.
@@ -0,0 +1,32 @@
1
+ /* rei-kit material: brutal.
2
+ *
3
+ * Hard edges, hard shadows, no rounding and no apology. The shadow is drawn in
4
+ * the ink colour rather than cast by a light, which is what makes it read as
5
+ * printed rather than lit — and it inverts with the theme for free, because in
6
+ * dark mode the ink is the light colour.
7
+ *
8
+ * Pressing a control moves it *into* its own shadow and drops the shadow, so
9
+ * a press looks like a press rather than a shrink. */
10
+ [data-material='brutal'] {
11
+ --surface-border-width: 2px;
12
+ --control-border-width: 2px;
13
+ --surface-border-color: var(--color-ink);
14
+
15
+ --radius-cell: 0px;
16
+ --radius-card: 0px;
17
+ --radius-shell: 0px;
18
+
19
+ --shadow-card: 4px 4px 0 var(--color-ink);
20
+ --shadow-raised: 6px 6px 0 var(--color-ink);
21
+ --shadow-overlay: 10px 10px 0 var(--color-ink);
22
+ --shadow-control: 3px 3px 0 var(--color-ink);
23
+ --shadow-control-pressed: 0 0 0 var(--color-ink);
24
+
25
+ --press-scale: 1;
26
+ --press-offset: 3px;
27
+
28
+ /* Snappy rather than smooth: a brutalist interface does not glide. */
29
+ --ease-standard: cubic-bezier(0.7, 0, 0.3, 1);
30
+ --duration-fast: 90ms;
31
+ --duration-base: 120ms;
32
+ }
@@ -0,0 +1,104 @@
1
+ /* rei-kit material: glass.
2
+ *
3
+ * Surfaces you can see through, over a page that has colour to see. Covers
4
+ * what gets called glassmorphism, and the frosted, lit-edge look that spatial
5
+ * interfaces and Apple's liquid glass made familiar. It does not refract: real
6
+ * refraction needs a shader, and a kit that promised it in CSS would be
7
+ * promising something it cannot keep on every component at once.
8
+ *
9
+ * Put the page on the `canvas` utility, or there is nothing behind the glass
10
+ * to blur — a frosted panel over flat white is a grey panel.
11
+ *
12
+ * One cost worth knowing: a surface with a backdrop filter becomes the
13
+ * containing block for its `position: fixed` descendants. The kit's own
14
+ * overlays teleport out of the tree, so they are unaffected; an app that
15
+ * positions something fixed *inside* a glass card will see it pinned to the
16
+ * card instead of the viewport. */
17
+ [data-material='glass'] {
18
+ --surface-opacity: 56%;
19
+ --control-opacity: 42%;
20
+ --surface-backdrop: blur(20px) saturate(1.6);
21
+ --surface-border-color: color-mix(in oklab, #ffffff 60%, transparent);
22
+
23
+ --radius-cell: 10px;
24
+ --radius-card: 22px;
25
+ --radius-shell: 36px;
26
+
27
+ /* The lit edge along the top is what separates glass from a translucent
28
+ rectangle: light catching the rim. */
29
+ --shadow-card:
30
+ inset 0 1px 0 rgb(255 255 255 / 0.6),
31
+ 0 8px 24px -12px color-mix(in oklab, var(--shadow-color) 22%, transparent);
32
+ --shadow-raised:
33
+ inset 0 1px 0 rgb(255 255 255 / 0.65),
34
+ 0 18px 40px -16px color-mix(in oklab, var(--shadow-color) 30%, transparent);
35
+ --shadow-overlay:
36
+ inset 0 1px 0 rgb(255 255 255 / 0.7),
37
+ 0 32px 64px -20px color-mix(in oklab, var(--shadow-color) 42%, transparent);
38
+ --shadow-control:
39
+ inset 0 1px 0 rgb(255 255 255 / 0.55),
40
+ 0 2px 8px -3px color-mix(in oklab, var(--shadow-color) 14%, transparent);
41
+
42
+ /* What there is to see through. Built from the palette's own roles, so a
43
+ glass app in a violet palette glows violet without a separate file. */
44
+ --canvas-backdrop:
45
+ radial-gradient(
46
+ 60% 50% at 12% 8%,
47
+ color-mix(in oklab, var(--color-primary) 40%, transparent),
48
+ transparent 72%
49
+ ),
50
+ radial-gradient(
51
+ 50% 45% at 88% 18%,
52
+ color-mix(in oklab, var(--color-accent) 34%, transparent),
53
+ transparent 70%
54
+ ),
55
+ radial-gradient(
56
+ 55% 50% at 72% 92%,
57
+ color-mix(in oklab, var(--color-positive) 28%, transparent),
58
+ transparent 70%
59
+ ),
60
+ radial-gradient(
61
+ 45% 40% at 8% 88%,
62
+ color-mix(in oklab, var(--color-warning) 22%, transparent),
63
+ transparent 70%
64
+ );
65
+
66
+ --ease-standard: cubic-bezier(0.2, 0.9, 0.2, 1);
67
+ }
68
+
69
+ .dark[data-material='glass'],
70
+ .dark [data-material='glass'] {
71
+ --surface-opacity: 40%;
72
+ --control-opacity: 28%;
73
+ --surface-border-color: color-mix(in oklab, #ffffff 14%, transparent);
74
+
75
+ --shadow-card:
76
+ inset 0 1px 0 rgb(255 255 255 / 0.08),
77
+ 0 8px 24px -12px color-mix(in oklab, var(--shadow-color) 60%, transparent);
78
+ --shadow-raised:
79
+ inset 0 1px 0 rgb(255 255 255 / 0.1),
80
+ 0 18px 40px -16px color-mix(in oklab, var(--shadow-color) 70%, transparent);
81
+ --shadow-overlay:
82
+ inset 0 1px 0 rgb(255 255 255 / 0.12),
83
+ 0 32px 64px -20px color-mix(in oklab, var(--shadow-color) 80%, transparent);
84
+ --shadow-control: inset 0 1px 0 rgb(255 255 255 / 0.07);
85
+ }
86
+
87
+ /* No backdrop filter to be had: an almost-solid surface reads correctly, a
88
+ translucent one without the blur reads as a rendering fault. */
89
+ @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
90
+ [data-material='glass'] {
91
+ --surface-opacity: 94%;
92
+ --control-opacity: 94%;
93
+ }
94
+ }
95
+
96
+ /* A reader who asked for less transparency gets none, and the page stays
97
+ legible — the backdrop colours remain, the see-through goes. */
98
+ @media (prefers-reduced-transparency: reduce) {
99
+ [data-material='glass'] {
100
+ --surface-opacity: 100%;
101
+ --control-opacity: 100%;
102
+ --surface-backdrop: none;
103
+ }
104
+ }
@@ -0,0 +1,39 @@
1
+ /* rei-kit material: quiet.
2
+ *
3
+ * The kit's default, which needs no file to be active: with no attribute at
4
+ * all, this is what the tokens already are. It exists for one case — putting
5
+ * a quiet region *inside* a page that is set to another material, which a
6
+ * nested attribute cannot do unless something re-declares the defaults.
7
+ *
8
+ * Every value here is copied from tokens.css, and a test asserts they match,
9
+ * so a change to the default cannot leave this file describing the old one. */
10
+ [data-material='quiet'] {
11
+ --radius-cell: 3px;
12
+ --radius-card: 16px;
13
+ --radius-shell: 30px;
14
+ --shadow-card:
15
+ 0 1px 2px color-mix(in oklab, var(--shadow-color) 4%, transparent),
16
+ 0 2px 8px -2px color-mix(in oklab, var(--shadow-color) 6%, transparent);
17
+ --shadow-raised:
18
+ 0 1px 2px color-mix(in oklab, var(--shadow-color) 6%, transparent),
19
+ 0 12px 28px -10px color-mix(in oklab, var(--shadow-color) 18%, transparent);
20
+ --shadow-overlay:
21
+ 0 4px 12px -4px color-mix(in oklab, var(--shadow-color) 10%, transparent),
22
+ 0 24px 48px -16px color-mix(in oklab, var(--shadow-color) 28%, transparent);
23
+ --shadow-control: 0 1px 2px color-mix(in oklab, var(--shadow-color) 5%, transparent);
24
+ --shadow-control-pressed: none;
25
+ --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
26
+ --surface-opacity: 100%;
27
+ --surface-backdrop: none;
28
+ --surface-border-width: 1px;
29
+ --surface-border-color: var(--color-hair);
30
+ --control-opacity: 100%;
31
+ --control-border-width: 1px;
32
+ --canvas-backdrop: none;
33
+ --press-scale: 0.97;
34
+ --press-offset: 0px;
35
+ --duration-fast: 150ms;
36
+ --duration-base: 200ms;
37
+ --duration-slow: 340ms;
38
+ --duration-slower: 420ms;
39
+ }
@@ -0,0 +1,57 @@
1
+ /* rei-kit material: soft.
2
+ *
3
+ * Rounded, raised and a little squashy — the family that neumorphism and
4
+ * claymorphism belong to. Surfaces are lit from above: a highlight along the
5
+ * top edge, a gentle shade along the bottom, and a soft shadow under the whole
6
+ * thing, so each card sits on the page like something you could pick up.
7
+ *
8
+ * Accessible where the look usually is not. Pure neumorphism draws surfaces in
9
+ * the page colour and relies on shadow alone to find their edges, which fails
10
+ * every contrast rule there is. Here a surface keeps its own colour and a
11
+ * faint edge, so the depth is decoration and never the only boundary.
12
+ *
13
+ * Pressing sinks a control into the surface instead of shrinking it. */
14
+ [data-material='soft'] {
15
+ --surface-border-color: color-mix(in oklab, var(--color-hair) 55%, transparent);
16
+
17
+ --radius-cell: 14px;
18
+ --radius-card: 26px;
19
+ --radius-shell: 42px;
20
+
21
+ --shadow-card:
22
+ inset 0 2px 1px rgb(255 255 255 / 0.75),
23
+ inset 0 -3px 8px color-mix(in oklab, var(--shadow-color) 5%, transparent),
24
+ 0 10px 24px -10px color-mix(in oklab, var(--shadow-color) 20%, transparent);
25
+ --shadow-raised:
26
+ inset 0 2px 1px rgb(255 255 255 / 0.8),
27
+ inset 0 -4px 10px color-mix(in oklab, var(--shadow-color) 6%, transparent),
28
+ 0 18px 36px -14px color-mix(in oklab, var(--shadow-color) 28%, transparent);
29
+ --shadow-overlay:
30
+ inset 0 2px 1px rgb(255 255 255 / 0.8),
31
+ 0 30px 60px -20px color-mix(in oklab, var(--shadow-color) 38%, transparent);
32
+ --shadow-control:
33
+ inset 0 1px 1px rgb(255 255 255 / 0.6),
34
+ inset 0 -2px 4px color-mix(in oklab, var(--shadow-color) 8%, transparent),
35
+ 0 4px 10px -4px color-mix(in oklab, var(--shadow-color) 18%, transparent);
36
+ --shadow-control-pressed: inset 0 3px 6px
37
+ color-mix(in oklab, var(--shadow-color) 20%, transparent);
38
+
39
+ --press-scale: 0.98;
40
+
41
+ /* A small overshoot: things arrive with a little give, which is the whole
42
+ personality of this material. */
43
+ --ease-standard: cubic-bezier(0.34, 1.56, 0.64, 1);
44
+ }
45
+
46
+ .dark[data-material='soft'],
47
+ .dark [data-material='soft'] {
48
+ --shadow-card:
49
+ inset 0 1px 1px rgb(255 255 255 / 0.07), inset 0 -3px 8px rgb(0 0 0 / 0.25),
50
+ 0 10px 24px -10px rgb(0 0 0 / 0.6);
51
+ --shadow-raised:
52
+ inset 0 1px 1px rgb(255 255 255 / 0.08), inset 0 -4px 10px rgb(0 0 0 / 0.3),
53
+ 0 18px 36px -14px rgb(0 0 0 / 0.7);
54
+ --shadow-overlay: inset 0 1px 1px rgb(255 255 255 / 0.08), 0 30px 60px -20px rgb(0 0 0 / 0.8);
55
+ --shadow-control: inset 0 1px 1px rgb(255 255 255 / 0.06), inset 0 -2px 4px rgb(0 0 0 / 0.3);
56
+ --shadow-control-pressed: inset 0 3px 6px rgb(0 0 0 / 0.45);
57
+ }
@@ -0,0 +1,15 @@
1
+ /* rei-kit materials, all of them.
2
+ *
3
+ * Import this after `tokens.css` and choose one with an attribute:
4
+ *
5
+ * <html data-material="glass">
6
+ *
7
+ * or at runtime with `applyMaterial('glass')` / `useMaterial()`. No attribute
8
+ * is the quiet material the kit ships by default.
9
+ *
10
+ * An app that only ever wants one can import that file alone —
11
+ * `rei-kit/materials/glass.css` — and set the attribute once. */
12
+ @import './materials/quiet.css';
13
+ @import './materials/glass.css';
14
+ @import './materials/brutal.css';
15
+ @import './materials/soft.css';