@aitrien/motifspec 1.16.0 → 1.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/dist/plate.js CHANGED
@@ -1,8 +1,9 @@
1
1
  // Specimen plate and backdrop: a contour survey of simplex-noise terrain.
2
2
  // The build runs contours() once (t = 0) to write the static SVG, so the plate and the backdrop are complete
3
3
  // without JavaScript.
4
- // In the browser, mount() redraws the same contours as the terrain drifts through time. Same code, same seed,
5
- // so the first animated frame matches the static one exactly.
4
+ // In the browser, mount() redraws the same contours: a plate as its terrain drifts through time, a backdrop as it
5
+ // settles on arrival and as the pointer warms it. Same code, same seed, so the first animated frame matches the static
6
+ // one exactly.
6
7
  (function (g) {
7
8
  'use strict';
8
9
 
@@ -60,7 +61,8 @@
60
61
  octaves: 2,
61
62
  massif: 1.1, // how strongly the terrain rises toward the centre
62
63
  levels: 14, // contour lines
63
- index: 5 // every nth line is an index contour
64
+ index: 5, // every nth line is an index contour
65
+ bump: 0.045 // radius of a hill the pointer warms, in survey widths
64
66
  };
65
67
 
66
68
  function survey(opts) {
@@ -72,12 +74,16 @@
72
74
  for (k = 1; k <= o.levels; k++) levels.push(lo + k * step);
73
75
  var h = new Float32Array((N + 1) * (N + 1));
74
76
 
75
- function height(t) {
77
+ // bumps: soft hills added to the terrain, [{ x, y, a }] in survey widths (0 to 1), each a Gaussian of radius o.bump.
78
+ function height(t, bumps) {
79
+ var nb = bumps ? bumps.length : 0, r2 = o.bump * o.bump;
76
80
  for (var j = 0; j <= N; j++) for (var i = 0; i <= N; i++) {
77
81
  var x = i / N, y = j / N, f = o.scale, a = 1, v = 0, norm = 0;
78
82
  for (var oc = 0; oc < o.octaves; oc++) { v += a * noise(x * f, y * f, t + oc * 13.7); norm += a; a *= 0.35; f *= 2.3; }
79
83
  var dx = x - 0.5, dy = y - 0.5, r = Math.min(1, Math.sqrt(dx * dx + dy * dy) / 0.62);
80
- h[j * (N + 1) + i] = v / norm + o.massif * (1 - r * r);
84
+ var add = 0;
85
+ for (var b = 0; b < nb; b++) { var bx = x - bumps[b].x, by = y - bumps[b].y; add += bumps[b].a * Math.exp(-(bx * bx + by * by) / r2); }
86
+ h[j * (N + 1) + i] = v / norm + o.massif * (1 - r * r) + add;
81
87
  }
82
88
  }
83
89
 
@@ -201,56 +207,47 @@
201
207
  return {
202
208
  options: o,
203
209
  levels: levels,
204
- // Path data for every level at time t (in noise units).
205
- contours: function (t) {
206
- height(t || 0);
210
+ // Path data for every level at time t (in noise units), with any bumps added.
211
+ contours: function (t, bumps) {
212
+ height(t || 0, bumps);
207
213
  return levels.map(function (lv, i) { return { level: i + 1, index: (i + 1) % o.index === 0, d: path(trace(lv)) }; });
208
214
  }
209
215
  };
210
216
  }
211
217
 
212
218
  // ------------------------------------------------------------ static markup (used by the build)
213
- // kind 'backdrop' draws the same survey full-bleed behind a page (docs/components/backdrop.md): sliced to cover
214
- // the viewport instead of fitted into the plate's square.
219
+ // kind 'head' or 'foot' draws the same survey full-bleed behind a page (docs/components/backdrop.md): sliced to cover
220
+ // its layer instead of fitted into the plate's square, on a finer grid so a warmed hill is round.
221
+ var BACKDROP = { head: { seed: 3, cells: 48 }, foot: { seed: 7, cells: 48 } };
215
222
  function markup(opts, kind) {
216
- var bg = kind === 'backdrop';
223
+ var bg = kind === 'head' || kind === 'foot';
224
+ if (bg) { opts = opts || {}; for (var key in BACKDROP[kind]) if (opts[key] == null) opts[key] = BACKDROP[kind][key]; }
217
225
  var s = survey(opts), S = s.options.size, q = S / 4;
218
226
  var grid = [q, 2 * q, 3 * q].map(function (v) { return 'M' + v + ' 0V' + S + 'M0 ' + v + 'H' + S; }).join('');
219
227
  var paths = s.contours(0).map(function (c, i) {
220
228
  return '<path class="cx-plate__line' + (c.index ? ' cx-plate__line--index' : '') + '" style="--i: ' + i + '" pathLength="1" d="' + c.d + '"></path>';
221
229
  }).join('');
222
- return '<div class="' + (bg ? 'cx-backdrop' : 'cx-plate') + '" aria-hidden="true" data-plate-seed="' + s.options.seed + '">' +
230
+ return '<div class="' + (bg ? 'cx-backdrop cx-backdrop--' + kind : 'cx-plate') + '" aria-hidden="true" data-plate-seed="' + s.options.seed + '"' + (bg ? ' data-plate-cells="' + s.options.cells + '"' : '') + '>' +
223
231
  '<svg class="cx-plate__map" viewBox="0 0 ' + S + ' ' + S + '"' + (bg ? ' preserveAspectRatio="xMidYMid slice"' : '') + ' focusable="false">' +
224
232
  '<path class="cx-plate__grid" d="' + grid + '"></path>' + paths + '</svg></div>';
225
233
  }
226
- function backdrop(opts) { return markup(opts, 'backdrop'); }
234
+ function backdrop(kind, opts) { return markup(opts, kind || 'head'); }
227
235
 
228
236
  // ------------------------------------------------------------ animation (browser only)
229
- function mount(root) {
237
+ function ms(win, root, name) { // durations come from the tokens, through custom properties on the element
238
+ var v = win.getComputedStyle(root).getPropertyValue(name).trim();
239
+ return v.endsWith('ms') ? parseFloat(v) : parseFloat(v) * 1000;
240
+ }
241
+
242
+ // A specimen plate: its lines draw in, then the terrain drifts until it is paused, hidden or off screen.
243
+ function mountPlate(root) {
230
244
  var doc = root.ownerDocument, win = doc.defaultView;
231
- // A plate's pause control sits in its frame; the backdrop's sits in the site header.
232
- var toggle = root.classList.contains('cx-backdrop')
233
- ? doc.querySelector('.cx-backdrop__pause')
234
- : (root.closest('.cx-plate-frame') || root.parentElement).querySelector('.cx-plate__pause');
245
+ var toggle = (root.closest('.cx-plate-frame') || root.parentElement).querySelector('.cx-plate__pause');
235
246
  var input = toggle && toggle.querySelector('input');
236
- // The backdrop's pause is a reader preference, like the theme: it is stored under cx-backdrop ("paused", or no key
237
- // for running) and restored on every page. A plate's pause belongs to that plate and isn't kept.
238
- if (input && root.classList.contains('cx-backdrop')) {
239
- try { if (win.localStorage.getItem('cx-backdrop') === 'paused') input.checked = true; } catch (e) { /* storage blocked */ }
240
- input.addEventListener('change', function () {
241
- try { if (input.checked) win.localStorage.setItem('cx-backdrop', 'paused'); else win.localStorage.removeItem('cx-backdrop'); }
242
- catch (e) { /* storage blocked: the pause still applies to this page */ }
243
- });
244
- }
245
247
  var paths = root.querySelectorAll('.cx-plate__line');
246
248
  var reduce = win.matchMedia('(prefers-reduced-motion: reduce)');
247
- function ms(name) { // durations come from the tokens, through custom properties on the plate
248
- var v = win.getComputedStyle(root).getPropertyValue(name).trim();
249
- return v.endsWith('ms') ? parseFloat(v) : parseFloat(v) * 1000;
250
- }
251
- var drift = ms('--cx-plate-drift'), delay = ms('--cx-plate-draw');
249
+ var drift = ms(win, root, '--cx-plate-drift'), delay = ms(win, root, '--cx-plate-draw');
252
250
  var s = survey({ seed: Number(root.getAttribute('data-plate-seed')) || DEFAULTS.seed });
253
- var backdrop = root.classList.contains('cx-backdrop');
254
251
  // The drift never starts at full speed: from rest its speed eases up over one draw duration, on load and again
255
252
  // after a pause, a hidden tab or scrolling back into view. Pausing still stops it at once.
256
253
  var elapsed = 0, last = null, raf = 0, frames = 0, visible = true, ready = false, warm = 0;
@@ -277,11 +274,71 @@
277
274
  if (reduce.addEventListener) reduce.addEventListener('change', update);
278
275
  doc.addEventListener('visibilitychange', update);
279
276
  if ('IntersectionObserver' in win) new win.IntersectionObserver(function (e) { visible = e[0].isIntersecting; update(); }).observe(root);
280
- // A plate draws its lines in first; the backdrop has no draw-in, so it starts as soon as the script runs.
281
- if (backdrop) ready = true; else win.setTimeout(function () { ready = true; update(); }, delay);
277
+ win.setTimeout(function () { ready = true; update(); }, delay);
282
278
  update();
283
279
  }
284
280
 
281
+ // A backdrop never drifts. The head settles into place over one settle duration on arrival (fast, then easing to a
282
+ // stop) and stays still. While a layer is on screen, the pointer warms the ground under it into a hill of rings,
283
+ // which rises over two-thirds of a settle, stays while the pointer rests there, and flattens over two settles once it
284
+ // moves on. Nothing runs on its own for
285
+ // more than five seconds, so there is no pause control; under prefers-reduced-motion none of it happens.
286
+ var SETTLE_FROM = -0.14, HEAT_MAX = 0.95, HEAT_STEP = 0.08, HEAT_KEEP = 40, MOVE_PX = 14;
287
+ function mountBackdrop(root) {
288
+ var doc = root.ownerDocument, win = doc.defaultView;
289
+ if (win.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
290
+ var svg = root.querySelector('.cx-plate__map'), paths = root.querySelectorAll('.cx-plate__line');
291
+ var s = survey({ seed: Number(root.getAttribute('data-plate-seed')) || DEFAULTS.seed, cells: Number(root.getAttribute('data-plate-cells')) || DEFAULTS.cells });
292
+ var settle = ms(win, root, '--cx-plate-settle'), rise = settle * 2 / 3, cool = settle * 2;
293
+ var head = root.classList.contains('cx-backdrop--head');
294
+ var heat = [], under = null, t0 = null, settling = head, raf = 0, last = null, visible = true, lastXY = null;
295
+
296
+ // The survey square covers the layer (slice), so a screen point maps to survey widths through its larger side.
297
+ function toSurvey(px, py) {
298
+ var r = svg.getBoundingClientRect(), side = Math.max(r.width, r.height);
299
+ return [(px - r.left - (r.width - side) / 2) / side, (py - r.top - (r.height - side) / 2) / side];
300
+ }
301
+ function tick(now) {
302
+ raf = 0;
303
+ var dt = last === null ? 0 : Math.min(now - last, settle / 16); last = now;
304
+ var t = 0, moving = false;
305
+ if (settling) {
306
+ if (t0 === null) t0 = now;
307
+ var p = Math.min(1, (now - t0) / settle);
308
+ t = SETTLE_FROM * Math.pow(1 - p, 3); // eases out: quick on arrival, still at the end
309
+ if (p < 1) moving = true; else settling = false;
310
+ }
311
+ heat.forEach(function (h) {
312
+ if (h === under) { if (h.a < HEAT_MAX) { h.a = Math.min(HEAT_MAX, h.a + dt / rise * HEAT_MAX); moving = true; } }
313
+ else { h.a -= dt / cool * HEAT_MAX; moving = true; }
314
+ });
315
+ heat = heat.filter(function (h) { return h.a > 0; });
316
+ s.contours(t, heat).forEach(function (c, i) { paths[i].setAttribute('d', c.d); });
317
+ if (moving) raf = win.requestAnimationFrame(tick); else last = null;
318
+ }
319
+ function wake() { if (!raf) raf = win.requestAnimationFrame(tick); }
320
+ function warmAt(px, py) {
321
+ var r = root.getBoundingClientRect();
322
+ if (!visible || px < r.left || px > r.right || py < r.top || py > r.bottom) { under = null; return; }
323
+ var q = toSurvey(px, py), near = null, best = s.options.bump * 0.8;
324
+ heat.forEach(function (h) { var d = Math.hypot(h.x - q[0], h.y - q[1]); if (d < best) { best = d; near = h; } });
325
+ if (!near) { near = { x: q[0], y: q[1], a: 0 }; heat.push(near); if (heat.length > HEAT_KEEP) heat.shift(); }
326
+ near.a = Math.min(HEAT_MAX, near.a + HEAT_STEP);
327
+ under = near;
328
+ wake();
329
+ }
330
+ win.addEventListener('pointermove', function (e) {
331
+ if (lastXY && Math.hypot(e.clientX - lastXY[0], e.clientY - lastXY[1]) < MOVE_PX) return;
332
+ lastXY = [e.clientX, e.clientY]; warmAt(e.clientX, e.clientY);
333
+ }, { passive: true });
334
+ win.addEventListener('pointerdown', function (e) { warmAt(e.clientX, e.clientY); }, { passive: true });
335
+ doc.documentElement.addEventListener('pointerleave', function () { under = null; wake(); });
336
+ if ('IntersectionObserver' in win) new win.IntersectionObserver(function (e) { visible = e[0].isIntersecting; }).observe(root);
337
+ if (settling) wake();
338
+ }
339
+
340
+ function mount(root) { if (root.classList.contains('cx-backdrop')) mountBackdrop(root); else mountPlate(root); }
341
+
285
342
  g.cxPlate = { survey: survey, markup: markup, backdrop: backdrop, mount: mount, defaults: DEFAULTS };
286
343
 
287
344
  // In a browser, start every plate and backdrop on the page. Without this script the static contours stay as they are.
package/dist/tokens.css CHANGED
@@ -1,4 +1,4 @@
1
- /* MotifSpec 1.16.0 — generated from tokens/*.json. Do not edit.
1
+ /* MotifSpec 1.17.0 — generated from tokens/*.json. Do not edit.
2
2
  Themes: semantic colours use light-dark(); color-scheme follows the system unless
3
3
  <html data-theme="light|dark"> pins it. --cx-primitive-* are for this file only. */
4
4
  :root {
@@ -11,7 +11,7 @@
11
11
  /* border.width */
12
12
  --cx-border-width-hairline: var(--cx-primitive-border-width-1);
13
13
  --cx-border-width-emphasis: var(--cx-primitive-border-width-2);
14
- --cx-border-width-contour: var(--cx-primitive-border-width-3);
14
+ --cx-border-width-contour: var(--cx-primitive-border-width-3); /* Deprecated: Unused since the backdrop's contours became hairlines, as on the specimen plate, in 1.17.0; removed in 2.0.0. */
15
15
 
16
16
  /* border.focus */
17
17
  --cx-border-focus-width: var(--cx-primitive-border-width-2);
@@ -90,6 +90,8 @@
90
90
  --cx-primitive-color-amount-2: 14%;
91
91
  --cx-primitive-color-amount-3: 40%;
92
92
  --cx-primitive-color-amount-4: 140%;
93
+ --cx-primitive-color-amount-5: 18%;
94
+ --cx-primitive-color-amount-6: 22%;
93
95
 
94
96
  /* color.surface */
95
97
  --cx-color-surface-base: light-dark(var(--cx-primitive-color-ash-50), var(--cx-primitive-color-ash-900));
@@ -169,9 +171,10 @@
169
171
  --cx-color-data-5: light-dark(var(--cx-primitive-color-ash-600), var(--cx-primitive-color-ash-400));
170
172
 
171
173
  /* color.backdrop */
172
- --cx-color-backdrop-tint: var(--cx-primitive-color-amount-3);
174
+ --cx-color-backdrop-tint: var(--cx-primitive-color-amount-5);
173
175
  --cx-color-backdrop-grain: var(--cx-primitive-color-amount-2);
174
176
  --cx-color-backdrop-saturation: var(--cx-primitive-color-amount-4);
177
+ --cx-color-backdrop-calm: var(--cx-primitive-color-amount-6);
175
178
 
176
179
  /* color.wash */
177
180
  --cx-color-wash-hover: var(--cx-primitive-color-amount-1);
@@ -202,6 +205,7 @@
202
205
  --cx-motion-duration-slow: var(--cx-primitive-motion-duration-3);
203
206
  --cx-motion-duration-plate: var(--cx-primitive-motion-duration-4);
204
207
  --cx-motion-duration-drift: var(--cx-primitive-motion-duration-6);
208
+ --cx-motion-duration-settle: var(--cx-primitive-motion-duration-5);
205
209
  --cx-motion-duration-pulse: var(--cx-primitive-motion-duration-5); /* Deprecated: Unused since the contour plate; removed in 2.0.0. */
206
210
 
207
211
  /* motion.easing */
@@ -312,9 +316,9 @@
312
316
  --cx-size-breakpoint-lg: var(--cx-primitive-size-breakpoint-lg);
313
317
 
314
318
  /* size.backdrop */
315
- --cx-size-backdrop-blur: var(--cx-primitive-size-effect-1);
319
+ --cx-size-backdrop-blur: var(--cx-primitive-size-effect-1); /* Deprecated: Unused since the backdrop's contours became sharp hairlines in 1.17.0; removed in 2.0.0. */
316
320
  --cx-size-backdrop-fade: var(--cx-primitive-size-effect-2);
317
- --cx-size-backdrop-height: var(--cx-primitive-size-viewport-1);
321
+ --cx-size-backdrop-height: var(--cx-primitive-size-viewport-1); /* Deprecated: Unused since the backdrop layers scroll with the page at size.backdrop.fade tall in 1.17.0; removed in 2.0.0. */
318
322
 
319
323
  /* primitive.space.0 */
320
324
  --cx-primitive-space-0: 0;
package/dist/tokens.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Generated by npm run build. Do not edit.
2
- export const version = "1.16.0";
2
+ export const version = "1.17.0";
3
3
  export const changelog = "https://github.com/Aitrien/motifspec/blob/main/CHANGELOG.md";
4
4
  export const showcase = "https://motifspec.com";
5
5
  export const tokens = [
@@ -49,7 +49,8 @@ export const tokens = [
49
49
  "type": "dimension",
50
50
  "references": "primitive.border.width.3",
51
51
  "value": "3px",
52
- "description": "Stroke of the backdrop's contour lines; index contours are twice this. Thicker than a hairline so the lines survive the frost blur. Not for the specimen plate, which keeps hairlines."
52
+ "description": "Stroke of the backdrop's contour lines; index contours are twice this. Thicker than a hairline so the lines survive the frost blur. Not for the specimen plate, which keeps hairlines.",
53
+ "deprecated": "Unused since the backdrop's contours became hairlines, as on the specimen plate, in 1.17.0; removed in 2.0.0."
53
54
  },
54
55
  {
55
56
  "name": "border.focus.width",
@@ -503,6 +504,20 @@ export const tokens = [
503
504
  "type": "number",
504
505
  "value": "140%"
505
506
  },
507
+ {
508
+ "name": "primitive.color.amount.5",
509
+ "css": "--cx-primitive-color-amount-5",
510
+ "tier": "primitive",
511
+ "type": "number",
512
+ "value": "18%"
513
+ },
514
+ {
515
+ "name": "primitive.color.amount.6",
516
+ "css": "--cx-primitive-color-amount-6",
517
+ "tier": "primitive",
518
+ "type": "number",
519
+ "value": "22%"
520
+ },
506
521
  {
507
522
  "name": "color.surface.base",
508
523
  "css": "--cx-color-surface-base",
@@ -1599,9 +1614,9 @@ export const tokens = [
1599
1614
  "css": "--cx-color-backdrop-tint",
1600
1615
  "tier": "semantic",
1601
1616
  "type": "number",
1602
- "references": "primitive.color.amount.3",
1603
- "value": "40%",
1604
- "description": "Share of color.surface.base laid over the blurred backdrop contours, in percent: enough to soften the lines into relief behind the header, the opening of a page and the footer."
1617
+ "references": "primitive.color.amount.5",
1618
+ "value": "18%",
1619
+ "description": "Share of color.surface.base laid over the backdrop contours, in percent: a light frost that softens the sharp hairlines without hiding them, behind the home page's statement and the footer."
1605
1620
  },
1606
1621
  {
1607
1622
  "name": "color.backdrop.grain",
@@ -1619,7 +1634,16 @@ export const tokens = [
1619
1634
  "type": "number",
1620
1635
  "references": "primitive.color.amount.4",
1621
1636
  "value": "140%",
1622
- "description": "Saturation applied with the frost blur, in percent, so blurred contour colour stays green instead of greying out."
1637
+ "description": "Saturation applied to the backdrop contours under the frost, in percent, so their colour stays green instead of greying out."
1638
+ },
1639
+ {
1640
+ "name": "color.backdrop.calm",
1641
+ "css": "--cx-color-backdrop-calm",
1642
+ "tier": "semantic",
1643
+ "type": "number",
1644
+ "references": "primitive.color.amount.6",
1645
+ "value": "22%",
1646
+ "description": "Strength the backdrop contours keep where text sits on the frost, in percent: on the left, where the statement and the footer start, and along the header. They come up to full strength towards the open side. A mask amount only."
1623
1647
  },
1624
1648
  {
1625
1649
  "name": "color.wash.hover",
@@ -1773,7 +1797,16 @@ export const tokens = [
1773
1797
  "type": "duration",
1774
1798
  "references": "primitive.motion.duration.6",
1775
1799
  "value": "60000ms",
1776
- "description": "Time the contour terrain (the backdrop, or the specimen plate) takes to drift one noise unit, so its lines reshape slowly and continuously. The only looping motion in the system: one contour field per page, with a visible pause control, stopped under prefers-reduced-motion."
1800
+ "description": "Time the specimen plate's terrain takes to drift one noise unit, so its lines reshape slowly and continuously. The only looping motion in the system: one plate per page, with a visible pause control, stopped under prefers-reduced-motion. The backdrop doesn't drift."
1801
+ },
1802
+ {
1803
+ "name": "motion.duration.settle",
1804
+ "css": "--cx-motion-duration-settle",
1805
+ "tier": "semantic",
1806
+ "type": "duration",
1807
+ "references": "primitive.motion.duration.5",
1808
+ "value": "3200ms",
1809
+ "description": "The backdrop's response time. The home page's contours settle into place over it on arrival and then stay still, and a hill the pointer warms takes about two-thirds of it to rise and twice it to flatten. Under five seconds, so nothing runs long enough to need a pause control; none of it happens under prefers-reduced-motion."
1777
1810
  },
1778
1811
  {
1779
1812
  "name": "motion.duration.pulse",
@@ -2250,7 +2283,8 @@ export const tokens = [
2250
2283
  "type": "dimension",
2251
2284
  "references": "primitive.size.effect.1",
2252
2285
  "value": "0.5rem",
2253
- "description": "Blur radius of the frost over the backdrop contours. Wide enough that the lines read as soft relief, never as text-like strokes behind the header and footer."
2286
+ "description": "Blur radius of the frost over the backdrop contours. Wide enough that the lines read as soft relief, never as text-like strokes behind the header and footer.",
2287
+ "deprecated": "Unused since the backdrop's contours became sharp hairlines in 1.17.0; removed in 2.0.0."
2254
2288
  },
2255
2289
  {
2256
2290
  "name": "size.backdrop.fade",
@@ -2259,7 +2293,7 @@ export const tokens = [
2259
2293
  "type": "dimension",
2260
2294
  "references": "primitive.size.effect.2",
2261
2295
  "value": "30rem",
2262
- "description": "Length of the fade at the top and bottom of a backdrop page, over which the page surface gives way to the frost. The header and the opening statement sit inside it; reading text below it is on the plain surface."
2296
+ "description": "Length of the fade at the top and bottom of a backdrop page, over which the page surface gives way to the frost, and the height of each backdrop layer. The header and the home page's statement sit inside the top fade, the footer inside the bottom one; reading text between them is on the plain surface."
2263
2297
  },
2264
2298
  {
2265
2299
  "name": "size.backdrop.height",
@@ -2268,7 +2302,8 @@ export const tokens = [
2268
2302
  "type": "number",
2269
2303
  "references": "primitive.size.viewport.1",
2270
2304
  "value": "100lvh",
2271
- "description": "Height of the backdrop layer before its blur overhang: the large viewport, so the contours keep their size and position as a phone's address bar slides away. Never a dynamic or small viewport unit, which resize the layer as you scroll and make the contours jump."
2305
+ "description": "Height of the backdrop layer before its blur overhang: the large viewport, so the contours keep their size and position as a phone's address bar slides away. Never a dynamic or small viewport unit, which resize the layer as you scroll and make the contours jump.",
2306
+ "deprecated": "Unused since the backdrop layers scroll with the page at size.backdrop.fade tall in 1.17.0; removed in 2.0.0."
2272
2307
  },
2273
2308
  {
2274
2309
  "name": "primitive.space.0",
package/dist/tokens.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.16.0",
2
+ "version": "1.17.0",
3
3
  "changelog": "https://github.com/Aitrien/motifspec/blob/main/CHANGELOG.md",
4
4
  "showcase": "https://motifspec.com",
5
5
  "tokens": [
@@ -49,7 +49,8 @@
49
49
  "type": "dimension",
50
50
  "references": "primitive.border.width.3",
51
51
  "value": "3px",
52
- "description": "Stroke of the backdrop's contour lines; index contours are twice this. Thicker than a hairline so the lines survive the frost blur. Not for the specimen plate, which keeps hairlines."
52
+ "description": "Stroke of the backdrop's contour lines; index contours are twice this. Thicker than a hairline so the lines survive the frost blur. Not for the specimen plate, which keeps hairlines.",
53
+ "deprecated": "Unused since the backdrop's contours became hairlines, as on the specimen plate, in 1.17.0; removed in 2.0.0."
53
54
  },
54
55
  {
55
56
  "name": "border.focus.width",
@@ -503,6 +504,20 @@
503
504
  "type": "number",
504
505
  "value": "140%"
505
506
  },
507
+ {
508
+ "name": "primitive.color.amount.5",
509
+ "css": "--cx-primitive-color-amount-5",
510
+ "tier": "primitive",
511
+ "type": "number",
512
+ "value": "18%"
513
+ },
514
+ {
515
+ "name": "primitive.color.amount.6",
516
+ "css": "--cx-primitive-color-amount-6",
517
+ "tier": "primitive",
518
+ "type": "number",
519
+ "value": "22%"
520
+ },
506
521
  {
507
522
  "name": "color.surface.base",
508
523
  "css": "--cx-color-surface-base",
@@ -1599,9 +1614,9 @@
1599
1614
  "css": "--cx-color-backdrop-tint",
1600
1615
  "tier": "semantic",
1601
1616
  "type": "number",
1602
- "references": "primitive.color.amount.3",
1603
- "value": "40%",
1604
- "description": "Share of color.surface.base laid over the blurred backdrop contours, in percent: enough to soften the lines into relief behind the header, the opening of a page and the footer."
1617
+ "references": "primitive.color.amount.5",
1618
+ "value": "18%",
1619
+ "description": "Share of color.surface.base laid over the backdrop contours, in percent: a light frost that softens the sharp hairlines without hiding them, behind the home page's statement and the footer."
1605
1620
  },
1606
1621
  {
1607
1622
  "name": "color.backdrop.grain",
@@ -1619,7 +1634,16 @@
1619
1634
  "type": "number",
1620
1635
  "references": "primitive.color.amount.4",
1621
1636
  "value": "140%",
1622
- "description": "Saturation applied with the frost blur, in percent, so blurred contour colour stays green instead of greying out."
1637
+ "description": "Saturation applied to the backdrop contours under the frost, in percent, so their colour stays green instead of greying out."
1638
+ },
1639
+ {
1640
+ "name": "color.backdrop.calm",
1641
+ "css": "--cx-color-backdrop-calm",
1642
+ "tier": "semantic",
1643
+ "type": "number",
1644
+ "references": "primitive.color.amount.6",
1645
+ "value": "22%",
1646
+ "description": "Strength the backdrop contours keep where text sits on the frost, in percent: on the left, where the statement and the footer start, and along the header. They come up to full strength towards the open side. A mask amount only."
1623
1647
  },
1624
1648
  {
1625
1649
  "name": "color.wash.hover",
@@ -1773,7 +1797,16 @@
1773
1797
  "type": "duration",
1774
1798
  "references": "primitive.motion.duration.6",
1775
1799
  "value": "60000ms",
1776
- "description": "Time the contour terrain (the backdrop, or the specimen plate) takes to drift one noise unit, so its lines reshape slowly and continuously. The only looping motion in the system: one contour field per page, with a visible pause control, stopped under prefers-reduced-motion."
1800
+ "description": "Time the specimen plate's terrain takes to drift one noise unit, so its lines reshape slowly and continuously. The only looping motion in the system: one plate per page, with a visible pause control, stopped under prefers-reduced-motion. The backdrop doesn't drift."
1801
+ },
1802
+ {
1803
+ "name": "motion.duration.settle",
1804
+ "css": "--cx-motion-duration-settle",
1805
+ "tier": "semantic",
1806
+ "type": "duration",
1807
+ "references": "primitive.motion.duration.5",
1808
+ "value": "3200ms",
1809
+ "description": "The backdrop's response time. The home page's contours settle into place over it on arrival and then stay still, and a hill the pointer warms takes about two-thirds of it to rise and twice it to flatten. Under five seconds, so nothing runs long enough to need a pause control; none of it happens under prefers-reduced-motion."
1777
1810
  },
1778
1811
  {
1779
1812
  "name": "motion.duration.pulse",
@@ -2250,7 +2283,8 @@
2250
2283
  "type": "dimension",
2251
2284
  "references": "primitive.size.effect.1",
2252
2285
  "value": "0.5rem",
2253
- "description": "Blur radius of the frost over the backdrop contours. Wide enough that the lines read as soft relief, never as text-like strokes behind the header and footer."
2286
+ "description": "Blur radius of the frost over the backdrop contours. Wide enough that the lines read as soft relief, never as text-like strokes behind the header and footer.",
2287
+ "deprecated": "Unused since the backdrop's contours became sharp hairlines in 1.17.0; removed in 2.0.0."
2254
2288
  },
2255
2289
  {
2256
2290
  "name": "size.backdrop.fade",
@@ -2259,7 +2293,7 @@
2259
2293
  "type": "dimension",
2260
2294
  "references": "primitive.size.effect.2",
2261
2295
  "value": "30rem",
2262
- "description": "Length of the fade at the top and bottom of a backdrop page, over which the page surface gives way to the frost. The header and the opening statement sit inside it; reading text below it is on the plain surface."
2296
+ "description": "Length of the fade at the top and bottom of a backdrop page, over which the page surface gives way to the frost, and the height of each backdrop layer. The header and the home page's statement sit inside the top fade, the footer inside the bottom one; reading text between them is on the plain surface."
2263
2297
  },
2264
2298
  {
2265
2299
  "name": "size.backdrop.height",
@@ -2268,7 +2302,8 @@
2268
2302
  "type": "number",
2269
2303
  "references": "primitive.size.viewport.1",
2270
2304
  "value": "100lvh",
2271
- "description": "Height of the backdrop layer before its blur overhang: the large viewport, so the contours keep their size and position as a phone's address bar slides away. Never a dynamic or small viewport unit, which resize the layer as you scroll and make the contours jump."
2305
+ "description": "Height of the backdrop layer before its blur overhang: the large viewport, so the contours keep their size and position as a phone's address bar slides away. Never a dynamic or small viewport unit, which resize the layer as you scroll and make the contours jump.",
2306
+ "deprecated": "Unused since the backdrop layers scroll with the page at size.backdrop.fade tall in 1.17.0; removed in 2.0.0."
2272
2307
  },
2273
2308
  {
2274
2309
  "name": "primitive.space.0",
@@ -2,82 +2,77 @@
2
2
  name: backdrop
3
3
  status: stable
4
4
  tokens:
5
- - border.focus.offset
6
- - border.focus.width
7
- - border.width.contour
5
+ - border.width.emphasis
6
+ - border.width.hairline
7
+ - color.backdrop.calm
8
8
  - color.backdrop.grain
9
9
  - color.backdrop.saturation
10
10
  - color.backdrop.tint
11
- - color.focus.ring
12
11
  - color.surface.base
13
12
  - color.text.primary
14
- - color.text.secondary
15
- - motion.duration.drift
16
- - motion.duration.fast
17
- - motion.duration.plate
13
+ - motion.duration.settle
18
14
  - motion.duration.slow
19
15
  - motion.easing.standard
20
- - radius.pill
21
- - size.backdrop.blur
22
16
  - size.backdrop.fade
23
- - size.backdrop.height
24
- - size.target.touch
25
17
  ---
26
18
 
27
19
  # Backdrop
28
20
 
29
- The contour survey drawn full-bleed behind every page, under a grainy frost. The page's own surface fades out over its first and last `size.backdrop.fade`, so the frost shows behind the header and footer and reading happens on the plain surface.
21
+ Contour surveys drawn full-bleed behind the top of the home page and the bottom of every page, under a light, grainy frost. The page's own surface fades out over its first and last `size.backdrop.fade`, so the contours show behind the header, the home page's statement and the footer, and reading happens on the plain surface. They don't drift. The home page's contours settle into place once on arrival, and the pointer warms the ground under it into a hill of rings, like an attention heatmap drawn as a survey.
30
22
 
31
23
  ## When to use
32
24
 
33
- - On every page of a site built from the system, in all six templates (`templates.md`), 404 included.
34
- - Once per page: one `cx-backdrop`, the first child of `<body class="cx-backdrop-page">`.
35
- - With the backdrop pause control in the header (`site-header.md`), because the terrain drifts.
25
+ - The foot on every page of a site built from the system, in all six templates (`templates.md`), 404 included.
26
+ - The head on the home page only, behind the statement: it is where a visitor starts. Every other page opens on the plain surface.
27
+ - Once each per page, both inside `<body class="cx-backdrop-page">`: the head as its first child, the foot after the footer.
36
28
 
37
29
  ## When not to use
38
30
 
39
- - On the same page as the specimen plate: one contour field per page. The showcase, which documents both, is the only exception.
40
- - Inside a component or as a section background. The frost is one layer for the whole page.
31
+ - On the same page as the specimen plate: one kind of contour field per page. The showcase, which documents both, is the only exception.
32
+ - Inside a component or as a section background. The frost belongs to the page's top and bottom.
41
33
  - Behind layouts that need the plain surface from the very top, such as a full-screen app or a print stylesheet.
42
34
 
43
35
  ## Markup
44
36
 
45
- The build writes the backdrop to `dist/backdrop.html` (the contours at time zero, sliced to cover the viewport). In Hugo, inline it first in `<body>` and load `dist/plate.js`, which drifts it:
37
+ The build writes the head to `dist/backdrop.html` and the foot to `dist/backdrop-foot.html`: the contours at time zero, on a different stretch of terrain each, sliced to cover the layer. In Hugo, `motifspec/body-start.html` inlines the head on the home page, and `motifspec/body-end.html` inlines the foot and loads `dist/plate.js`:
46
38
 
47
39
  ```html preview
48
40
  <body class="cx-backdrop-page">
49
41
  {{ (resources.Get "motifspec/backdrop.html").Content | safeHTML }}
50
- <!-- <div class="cx-backdrop" aria-hidden="true" data-plate-seed="3"><svg class="cx-plate__map" preserveAspectRatio="xMidYMid slice" …>…</svg></div> -->
42
+ <!-- home page only: <div class="cx-backdrop cx-backdrop--head" aria-hidden="true" data-plate-seed="3" data-plate-cells="48"><svg class="cx-plate__map" preserveAspectRatio="xMidYMid slice" …>…</svg></div> -->
51
43
  <a class="cx-skip-link" href="#main">Skip to content</a>
52
- <header class="cx-header"><!-- site-header.md, with the backdrop pause control --></header>
44
+ <header class="cx-header"><!-- site-header.md --></header>
53
45
  <main id="main"><!-- the template --></main>
54
46
  <footer class="cx-footer"><!-- site-footer.md --></footer>
47
+ {{ (resources.Get "motifspec/backdrop-foot.html").Content | safeHTML }}
48
+ <!-- every page: <div class="cx-backdrop cx-backdrop--foot" aria-hidden="true" data-plate-seed="7" data-plate-cells="48">…</div> -->
55
49
  <script src="{{ (resources.Get "motifspec/plate.js" | minify | fingerprint).RelPermalink }}" defer></script>
56
50
  </body>
57
51
  ```
58
52
 
59
- From the bottom up: the canvas (`color.surface.base`), the contours (the specimen plate's `color.ornament.rest` lines and `color.ornament.strong` index contours, at `border.width.contour` and twice that, blurred by `size.backdrop.blur` and `color.backdrop.saturation`), the frost (`color.backdrop.tint` of the surface), the grain (monochrome noise at `color.backdrop.grain`), then the page, whose surface is solid between the two fades.
53
+ From the bottom up: the canvas (`color.surface.base`), the contours (the specimen plate's `color.ornament.rest` lines and `color.ornament.strong` index contours, at `border.width.hairline` and `border.width.emphasis`, with `color.backdrop.saturation`), the frost (`color.backdrop.tint` of the surface), the grain (monochrome noise at `color.backdrop.grain`), then the page, whose surface is solid between the two fades. Each layer is `size.backdrop.fade` tall and scrolls with the page: the head from the top of the page, the foot up from the bottom.
54
+
55
+ Where text sits on the frost, the contours keep only `color.backdrop.calm` of their strength: on the left, where the statement and the footer start, and along the header. They come up to full strength towards the open side. The calm side is a mask, so the lines run behind the text rather than around it.
60
56
 
61
57
  ## Do
62
58
 
63
- - Load `dist/plate.js` on every page that has the backdrop. It starts the drift as soon as it runs, easing up from rest over `motion.duration.plate` rather than jumping to full speed (and again whenever the drift resumes), and reveals the header's pause control; without it the contours stay still and the control stays hidden.
59
+ - Load `dist/plate.js` on every page. On the home page it eases the head into place over `motion.duration.settle`, quickly at first and then to a stop. On both layers, while they are on screen, the pointer warms the ground under it: a hill rises over two-thirds of a settle, stays while the pointer rests there, and flattens over two once it moves on. A tap does the same on a touch screen. Without the script the contours stay still.
64
60
  - Let the header and footer sit on the frost. `cx-backdrop-page` removes their surfaces. Once the page scrolls, `dist/codex.js` makes the header sticky and fades its surface back in, so it never sits see-through on the text below; back at the top it returns to the frost (`site-header.md`). Without the script it scrolls away with the page.
65
- - Keep the layer's height at `size.backdrop.height`, the large viewport (`lvh`). On a phone the address bar slides away as you scroll; a layer pinned to the bottom of the screen, or sized in `dvh` or `svh`, resizes with it, re-fits the contours and makes them jump.
66
61
  - Tune the look through the backdrop tokens only.
67
- - Keep the opening statement inside the top fade, so it is the one piece of content that sits on the frost.
62
+ - Keep the home page's statement inside the top fade, so it is the one piece of content that sits on the frost.
68
63
 
69
64
  ## Don't
70
65
 
71
66
  - Don't give sections, panels or cards a frosted background of their own.
72
- - Don't position `<body>` or give it a `z-index`. The backdrop paints at `z-index: -1` in the root stacking context, under the page's own surface.
73
- - Don't raise `color.backdrop.grain` until the noise competes with text.
74
- - Don't switch the blur to `backdrop-filter`. Chromium blurs only what is on screen, so lines crossing the viewport edge stay sharp there; the CSS `filter` on the contours, over a layer that reaches past the edge, does not. Don't give the grain a `mix-blend-mode` either: in Chromium it brought sharp lines back.
67
+ - Don't give `<body>` a `z-index`. `cx-backdrop-page` positions it so the layers can sit at its top and bottom; a `z-index` would lift its surface's stacking context over them, or put them on top of it.
68
+ - Don't put the head on pages other than the home page, or more than one head or foot on a page.
69
+ - Don't make the backdrop drift, or animate it on a timer. Its only motion is the settle on arrival and the response to the pointer.
70
+ - Don't raise `color.backdrop.grain` until the noise competes with text, and don't give the grain a `mix-blend-mode`.
75
71
  - Don't put text, links or controls in the backdrop.
76
72
 
77
73
  ## Accessibility
78
74
 
79
75
  - The backdrop is `aria-hidden` and carries no information.
80
- - WCAG 2.2.2 (Pause, Stop, Hide): the drift runs longer than five seconds, so the header's pause control (a native checkbox named "Pause background animation"; checked means paused) stops it. It ships `hidden`; the script reveals it when the drift starts. The choice persists across pages, like the theme: it is stored as `paused` under the `cx-backdrop` key and restored before the drift starts, so a paused backdrop never moves on the next page. If storage is blocked, the pause still applies to the current page. The drift also stops off screen and in hidden tabs.
81
- - Under `prefers-reduced-motion: reduce` the contours never move and the pause control stays hidden.
82
- - Reading text below the top fade sits on `color.surface.base`, so the declared pairs apply. Text over the frost (the header, the footer, the opening of a page, and all of a short page) is measured against `color.surface.base` too: by design, contrast is not checked against the blurred contour lines beneath it.
83
- - The blur is a CSS `filter`, supported everywhere the rest of the system is, so contrast never depends on `backdrop-filter` support.
76
+ - WCAG 2.2.2 (Pause, Stop, Hide) doesn't apply: the settle is over in under five seconds, and every other change follows the reader's own pointer. So there is no pause control.
77
+ - Under `prefers-reduced-motion: reduce` the contours never move: no settle and no warming.
78
+ - Reading text between the fades sits on `color.surface.base`, so the declared pairs apply. Text over the frost (the header, the footer, the home page's statement, and all of a short page) is measured against `color.surface.base` too: by design, contrast is not checked against the contour lines beneath it, which are faint there by the calm side.
@@ -70,7 +70,7 @@ Buttons start actions or journeys; standalone links and back links move between
70
70
 
71
71
  - Use `<a>` when it goes somewhere and `<button>` when it does something.
72
72
  - Write labels as verb plus object, in sentence case.
73
- - Keep `cx-button` pill-shaped (`radius.pill`). Pills are reserved for buttons, nav items and icon-only controls (the copy button, the theme toggle, the backdrop pause, heading anchors), so a pill always means "you can press this".
73
+ - Keep `cx-button` pill-shaped (`radius.pill`). Pills are reserved for buttons, nav items and icon-only controls (the copy button, the theme toggle, the plate's pause, heading anchors), so a pill always means "you can press this".
74
74
  - Use the `arrow-forward` and `arrow-back` icons (see `icon.md`) with `cx-button__arrow`; they nudge by `motion.distance.nudge` on hover, in their own direction.
75
75
 
76
76
  ## Don't