@n1kname/components 0.33.0 → 0.34.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n1kname/components",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -36,7 +36,7 @@
36
36
  "@n1kname/charts": "0.12.0"
37
37
  },
38
38
  "peerDependencies": {
39
- "@n1kname/tokens": "^0.6.0",
39
+ "@n1kname/tokens": "^0.7.0",
40
40
  "astro": "^7.4.4"
41
41
  },
42
42
  "publishConfig": {
@@ -3,14 +3,18 @@
3
3
  * Highlights the words a heading or lede is about, with a band that sweeps in once. Give each
4
4
  * mark its place with `n` when there are several, so they sweep one after the other. The look and
5
5
  * the timing live in highlight.css, shared with PageHeader.
6
+ *
7
+ * band the highlighter, a band behind the lower half of the words (default)
8
+ * glow a soft blue light behind them that fades in once and holds; for a big headline
6
9
  */
7
10
  import './highlight.css';
8
11
 
9
12
  interface Props {
10
13
  /** This mark's place among the marks on the page, from 0. */
11
14
  n?: number;
15
+ variant?: 'band' | 'glow';
12
16
  }
13
- const { n = 0 } = Astro.props;
17
+ const { n = 0, variant = 'band' } = Astro.props;
14
18
  ---
15
19
 
16
- <mark class="highlight" style={`--n: ${n}`}><slot /></mark>
20
+ <mark class:list={['highlight', { glow: variant === 'glow' }]} style={`--n: ${n}`}><slot /></mark>
package/src/highlight.css CHANGED
@@ -3,6 +3,9 @@
3
3
  * by line, and is mixed into the page colour rather than see-through, so it holds up in dark. It
4
4
  * sweeps in once, a moment after the words land; several marks go one after the other, by --n.
5
5
  *
6
+ * `mark.highlight.glow` is the quiet look: a soft blue light behind the words that fades in once
7
+ * and then holds still. It reaches past the line, so it never stops in a hard edge.
8
+ *
6
9
  * Used by Highlight and PageHeader. A page that writes its words once its data arrives can wrap
7
10
  * them in <mark class="highlight"> itself, and the sweep plays as they land.
8
11
  *
@@ -35,6 +38,51 @@
35
38
  }
36
39
  }
37
40
 
41
+ /* The glow: a soft ellipse of blue behind the words. The atmosphere blue of the case heroes on a
42
+ * light page; on a dark one, the chart blue, since the dark atmosphere blue is too deep to glow. Vertical padding
43
+ * on an inline box moves no text but widens what its background can paint, so the light runs
44
+ * past the line instead of stopping at the glyphs' box. Its strength is a registered property,
45
+ * so it can fade: a gradient can't. */
46
+ @property --highlight-glow {
47
+ syntax: '<percentage>';
48
+ inherits: false;
49
+ initial-value: 0%;
50
+ }
51
+
52
+ :where(mark.highlight.glow) {
53
+ --highlight-glow: 60%;
54
+ --highlight-glow-color: var(--c-atmosphere-b);
55
+ padding: 0.35em 0.3em;
56
+ margin-inline: -0.3em;
57
+ background: radial-gradient(closest-side, color-mix(in oklab, var(--highlight-glow-color) var(--highlight-glow), transparent), transparent)
58
+ no-repeat 50% 55% / 100% 100%;
59
+ }
60
+
61
+ :root[data-theme='dark'] :where(mark.highlight.glow) {
62
+ --highlight-glow: 24%;
63
+ --highlight-glow-color: var(--c-chart-2);
64
+ }
65
+
66
+ @media (prefers-color-scheme: dark) {
67
+ :root:not([data-theme='light']) :where(mark.highlight.glow) {
68
+ --highlight-glow: 24%;
69
+ --highlight-glow-color: var(--c-chart-2);
70
+ }
71
+ }
72
+
73
+ @media (prefers-reduced-motion: no-preference) {
74
+ :where(mark.highlight.glow) {
75
+ animation-name: highlight-glow;
76
+ animation-duration: calc(var(--motion-draw, 1000ms) * 1.6);
77
+ }
78
+ }
79
+
80
+ @keyframes highlight-glow {
81
+ from {
82
+ --highlight-glow: 0%;
83
+ }
84
+ }
85
+
38
86
  @media (forced-colors: active) {
39
87
  :where(mark.highlight, .page-header .text mark) {
40
88
  background: none;