@logomarks/lookbook 0.1.3 → 0.3.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/CHANGELOG.md CHANGED
@@ -5,6 +5,47 @@ All notable changes to `@logomarks/lookbook` are documented here.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.0] — 2026-11-20
9
+
10
+ ### Added
11
+
12
+ - **Six more field cards**, each a live background from @arraypress/effects-astro 0.11 behind the lockup, its middle kept
13
+ quiet, six colourways each from the house palette, off unless a wall gives it a weight (`lookbook({ weights })`):
14
+ `lightleak` (a soft drifting colour field), `dither` (dithered dots, ripples from a corner), `cascade` (a hex or dot
15
+ spectrogram), `flowfield` (fine trails on a flow, Canvas 2D), `voronoi` (thin nested cell lines) and `kinetic` (a wire
16
+ grid that raindrops ripple). After Processing sketches shared with the owner.
17
+ - **`FIELDS`, `isField`** (`./fields.js`): the field cards in one table, each its effect, label and deal (settings,
18
+ ground, ink, still). `KIND_LABEL`, `RATIO` and `WEIGHTS` are built from it; `wall.js` has one branch for them all.
19
+
20
+ ### Changed
21
+
22
+ - ASCII noise moved into the field table (its cards are the same apart from the order of their settings). Field cards
23
+ carry `wc-field` (the shared CSS: ground, ink, the canvas fading in over the still); `.wc-asciinoise` rules are now
24
+ `.wc-field`'s.
25
+ - `/live` loads each field's effect when a card first needs it, in its own chunk.
26
+
27
+ ### Dependencies
28
+
29
+ - `@arraypress/effects-astro` ^0.11.0.
30
+
31
+ ## [0.2.0] — 2026-11-20
32
+
33
+ ### Added
34
+
35
+ - **ASCII noise** (`asciinoise`): a card on a field of drifting type, soft-edged blobs of characters panning and
36
+ morphing (@arraypress/effects-astro 0.10's `asciiNoise`, started on screen like a shader card, ten at a time), the
37
+ lockup in the wall's monospaced face in a quiet middle. Six colourways (graphite, acid, phosphor, cobalt, paper,
38
+ signal), six ramps, two cell sizes; its first frame is laid as SVG text, the cells the shader starts on, so the card
39
+ shows the field before it starts, without WebGL and under reduced motion. After a Processing sketch shared with the
40
+ owner (`ascii_noise_bg`).
41
+ - **`lookbook({ weights })`**: how often looks are dealt, over `WEIGHTS`. ASCII noise is at 0 unless a wall gives it a
42
+ weight, so a wall without one deals exactly the cards it did (the equivalence fixture is untouched).
43
+ - **`KIND_LABEL`**: names for the looks whose id doesn't read as one (`asciinoise` → "ASCII noise").
44
+
45
+ ### Dependencies
46
+
47
+ - `@arraypress/effects-astro` ^0.10.0 (for `runtime/ascii-noise`).
48
+
8
49
  ## [0.1.3] — 2026-11-18
9
50
 
10
51
  ### Added
package/README.md CHANGED
@@ -37,10 +37,10 @@ holoPointer();
37
37
 
38
38
  ## What's in it
39
39
 
40
- - `@logomarks/lookbook`: `lookbook({ brand, faces, accent?, href?, skip? })` gives `card`, `feed` and `backgrounds`; `shuffled`; the promo cards `headlineCard`, `sponsorCard`, `openSlotCard`; `WEIGHTS`, `EVERY`, `ACCENT` (`#C8FF00`) and the look tables.
40
+ - `@logomarks/lookbook`: `lookbook({ brand, faces, accent?, palettes?, weights?, href?, skip? })` gives `card`, `feed` and `backgrounds` (`weights: { asciinoise: 1 }` deals a field card, which is otherwise off: `FIELDS` lists them, live effects-astro backgrounds such as ASCII noise, light leak, dither, cascade grid, flow field, Voronoi mesh and kinetic grid); `shuffled`; the promo cards `headlineCard`, `sponsorCard`, `openSlotCard`; `WEIGHTS`, `KIND_LABEL`, `EVERY`, `ACCENT` (`#C8FF00`) and the look tables.
41
41
  - `@logomarks/lookbook/looks`: the drawn looks, `LOOK_KINDS`, `LOOK_LABEL`, `LOOK_LOOP` (each moving look's loop, for a video), `LOOK_RATIO`, `LOOK_WEIGHTS`, `retarget` (another mark on a card) and `refit`.
42
42
  - `@logomarks/lookbook/marks`: a mark's box, ink share, optical size (`opticalVars`), cells and heat field; the box, ink, size and cells are `@logomarks/core`'s, re-exported.
43
- - `@logomarks/lookbook/live`: `liveCards`, `shaders`, `smoke` with its presets `SMOKE`, and `holoPointer`.
43
+ - `@logomarks/lookbook/live`: `liveCards`, `shaders` (Paper's shaders and the field cards' effects, each loaded when first needed), `smoke` with its presets `SMOKE`, and `holoPointer`.
44
44
  - `wall.css` and `wall-looks.css`: the cards and the drawn looks. They read the page's theme tokens (`--text`, `--muted`, `--border`, `--surface`, `--display`, `--mono`) and the accent `--hi`.
45
45
 
46
46
  The pictures go by their file names: `club-N` the club hall, `club-dancer-N` and `club-crowd-N` its people, portraits (`modern`, `y2k` …) and the rest in `photos`; flowers (`bloom-N`, `dahlia-N`, `iris-N`, `lily-N`, `marigold-N`, `palm-N`) and abstracts in `glass`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logomarks/lookbook",
3
- "version": "0.1.3",
3
+ "version": "0.3.0",
4
4
  "description": "A logomark dressed as a made-up brand, in sixty-odd looks: on a photo, glass, a colour, paper or a live gradient, or the mark itself redrawn (traced, constructed, reeded, pixelated, neon, split-flap, contoured, thermal, liquid chrome, holo foil, ASCII, embroidered, frosted, editorial and more). Pure functions returning HTML, the same on the server and in the browser, with their CSS (motion in CSS only, a still final frame, a Plain mode), an optical size for wide, slim or light marks, and a browser runner that starts only what's near the screen.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -75,7 +75,7 @@
75
75
  "registry": "https://registry.npmjs.org/"
76
76
  },
77
77
  "dependencies": {
78
- "@arraypress/effects-astro": "^0.8.0 || ^0.9.0",
78
+ "@arraypress/effects-astro": "^0.11.0",
79
79
  "@arraypress/og-image": "^1.5.1",
80
80
  "@arraypress/text": "^2.2.0",
81
81
  "@logomarks/core": "^0.2.1"
@@ -83,5 +83,8 @@
83
83
  "devDependencies": {
84
84
  "@types/node": "^26.6.6",
85
85
  "typescript": "^6.0.3"
86
+ },
87
+ "overrides": {
88
+ "fflate": "0.7.5"
86
89
  }
87
90
  }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @module @logomarks/lookbook/fields
3
+ *
4
+ * The field cards: a live background drawn by one of @arraypress/effects-astro's fields, started on screen like a shader
5
+ * card, the lockup over a quiet middle.
6
+ */
7
+ import type { Face } from './wall.js';
8
+
9
+ /** The field cards' kinds. */
10
+ export type FieldKind = 'asciinoise' | 'lightleak' | 'cascade' | 'flowfield' | 'voronoi' | 'dither' | 'kinetic';
11
+
12
+ /** What a field card is dealt from: the card's seeded pick and random, the accent, and the wall's monospaced face. */
13
+ export type FieldDeal = {
14
+ pick: <T>(xs: readonly T[]) => T;
15
+ r: () => number;
16
+ accent: string;
17
+ mono: Face | undefined;
18
+ };
19
+
20
+ /** A dealt field card: the effect's settings, the card's ground and ink, its still (a CSS background, or markup laid
21
+ * under the canvas), and whether its name is set in the monospaced face. */
22
+ export type FieldCard = {
23
+ cfg: Record<string, unknown>;
24
+ ground: string;
25
+ ink: string;
26
+ still?: string;
27
+ under?: string;
28
+ mono?: boolean;
29
+ };
30
+
31
+ /** A field: the effects-astro effect that draws it (its runtime file's name), its label, and its deal. */
32
+ export type Field = { effect: string; label: string; deal: (d: FieldDeal) => FieldCard };
33
+
34
+ /** The glyphs' face when the wall has no monospaced one. */
35
+ export declare const MONO_FALLBACK: string;
36
+ /** The field cards by kind. */
37
+ export declare const FIELDS: Record<FieldKind, Field>;
38
+ /** Whether a kind is a field card. */
39
+ export declare const isField: (k: string) => k is FieldKind;
package/src/fields.js ADDED
@@ -0,0 +1,306 @@
1
+ /**
2
+ * @module @logomarks/lookbook/fields
3
+ *
4
+ * The field cards: a live background drawn by one of @arraypress/effects-astro's fields (ASCII noise, …), started on
5
+ * screen like a shader card (`./live.js`), the lockup over a quiet middle. Most came from Processing sketches a friend of
6
+ * the owner shared (2026-11-20), modernised in effects-astro.
7
+ *
8
+ * Each field says which effect draws it, its label, and how a card deals it: the effect's settings, the card's ground
9
+ * and ink, what shows before the effect starts (a CSS `still`, or markup laid `under` the canvas), and whether the name
10
+ * is set in the wall's monospaced face. A field's canvas paints its ground too, so it fades in over the still.
11
+ *
12
+ * Pure: everything comes from the card's seeded random, so the page and its script deal identical cards.
13
+ */
14
+
15
+ import { escapeHtml } from '@arraypress/text';
16
+ import { asciiCells, rampOf } from '@arraypress/effects-astro/runtime/ascii-noise';
17
+ import { mixOklab, parseColor, toHex } from '@arraypress/effects-astro/runtime/color';
18
+ import { lightLeakStill } from '@arraypress/effects-astro/runtime/light-leak';
19
+ import { ditherStill } from '@arraypress/effects-astro/runtime/dither-field';
20
+ import { gridStill } from '@arraypress/effects-astro/runtime/kinetic-grid';
21
+
22
+ /** The glyphs' face when the wall has no monospaced one. */
23
+ export const MONO_FALLBACK = 'ui-monospace, SFMono-Regular, Menlo, monospace';
24
+
25
+ /** An offset into a field's noise, so two cards on the same settings differ. */
26
+ const offsetOf = (r) => [Math.round(r() * 4000) / 100, Math.round(r() * 4000) / 100];
27
+ /** A number between two, at two decimals, from the card's random. */
28
+ const between = (r, lo, hi) => Math.round((lo + r() * (hi - lo)) * 100) / 100;
29
+ /** A field card's shape, width over height (every field card is 4:5). */
30
+ const CARD = 4 / 5;
31
+
32
+ /* ---------- ASCII noise (effects-astro's asciiNoise) ---------- */
33
+
34
+ /** ASCII noise cards' colours: ground, the quiet cells, the loud cells, and the lockup. */
35
+ const noiseInksOf = (accent) => [
36
+ ['#0B0B0B', '#3A3A3A', '#FFFFFF', '#FFFFFF'], // graphite
37
+ ['#0B0B0B', '#2C3A0A', accent, accent], // acid
38
+ ['#0B0B0B', '#0D3B2A', '#39FF88', '#39FF88'], // phosphor
39
+ ['#0038FF', '#2F5CFF', '#FFFFFF', '#FFFFFF'], // cobalt
40
+ ['#F4F3EF', '#D2D0C8', '#0B0B0B', '#0B0B0B'], // paper
41
+ ['#FF3D00', '#FF7A4D', '#0B0B0B', '#0B0B0B'], // signal
42
+ ];
43
+ /** The ramps an ASCII noise card takes (effects-astro's NOISE_RAMPS, each quietest first, all in a monospaced face; the
44
+ * shade blocks after a space, so the quiet middle is empty, not a texture). */
45
+ const NOISE_RAMPS = ['ascii', ' ░▒▓█', 'digits', 'rise', 'dense', 'quads'];
46
+ /** A noise card's cell, width over height (a monospaced face's advance). */
47
+ const NOISE_ASPECT = 0.6;
48
+
49
+ /**
50
+ * An ASCII noise card's first frame as SVG text: the characters its shader starts on (effects-astro's `asciiCells`), a
51
+ * row a line pinned to the cell pitch (`textLength`). In one tone, between the quiet and loud colours (a colour a run
52
+ * made each card ~19 KB; this is ~3 KB): the shader's canvas fades in over it and the tones settle in.
53
+ *
54
+ * @param cfg The card's noise settings.
55
+ */
56
+ function noiseStill(cfg) {
57
+ const ramp = rampOf(cfg.glyphs),
58
+ cols = cfg.cols,
59
+ h = 1 / NOISE_ASPECT;
60
+ // a 4:5 card: cols × 1.25 widths tall, in rows of 1 / aspect
61
+ const rows = Math.round((cols * 1.25) / h);
62
+ const [lo, hi] = cfg.colors.map(parseColor);
63
+ const tone = toHex(mixOklab(lo, hi, 0.7));
64
+ const text = asciiCells(cfg, cols, rows).map(
65
+ (row, j) =>
66
+ // spaces as no-break spaces: SVG text collapses runs of spaces (whatever `white-space` says), and `textLength`
67
+ // would spread what's left across the row
68
+ `<text y="${((j + 0.5) * h).toFixed(2)}" textLength="${cols}" lengthAdjust="spacing">${escapeHtml(row.map((i) => ramp[i]).join('')).replaceAll(' ', ' ')}</text>`,
69
+ );
70
+ return `<svg class="wc-noise" viewBox="0 0 ${cols} ${(rows * h).toFixed(2)}" xml:space="preserve" font-size="${(h * 0.92).toFixed(3)}" fill="${tone}" style="font-family:${escapeHtml(cfg.font)}" aria-hidden="true">${text.join('')}</svg>`;
71
+ }
72
+
73
+ /** asciinoise: drifting monospaced type, its first frame laid as text under the canvas. */
74
+ function asciinoise({ pick, r, accent, mono }) {
75
+ const [ground, lo, hi, ink] = pick(noiseInksOf(accent));
76
+ const cfg = {
77
+ glyphs: pick(NOISE_RAMPS),
78
+ cols: pick([40, 48]),
79
+ scale: pick([1.8, 2.45, 3.1]),
80
+ contrast: pick([4, 6]),
81
+ brightness: pick([-0.15, -0.1, -0.05]),
82
+ offset: offsetOf(r),
83
+ colors: [lo, hi],
84
+ background: ground,
85
+ font: mono?.[0] ?? MONO_FALLBACK,
86
+ quiet: { radius: 0.56, depth: 1 },
87
+ };
88
+ return { cfg, ground, ink, under: noiseStill(cfg), mono: true };
89
+ }
90
+
91
+ /* ---------- Light leak (effects-astro's lightLeak, after the lava-lamp sketch) ---------- */
92
+
93
+ /** Light leak cards' colours, darkest first (the ground is the darkest), the lockup's ink, and the tone the quiet middle
94
+ * flattens to (0 the darkest, 1 the brightest). */
95
+ const leakInksOf = (accent) => [
96
+ { colors: ['#160402', '#7A1800', '#FF3D00', '#FFB08A'], ink: '#FFFFFF', tone: 0.08 }, // signal
97
+ { colors: ['#03061A', '#0A1F8F', '#0038FF', '#8FB4FF'], ink: '#FFFFFF', tone: 0.08 }, // cobalt
98
+ { colors: ['#0B0B0B', '#1F2A06', '#6B8F00', accent], ink: '#FFFFFF', tone: 0.08 }, // acid
99
+ { colors: ['#03110F', '#0A4F47', '#0E8C7E', '#39FF88'], ink: '#FFFFFF', tone: 0.08 }, // teal
100
+ { colors: ['#0E0520', '#4A1F9E', '#7B3FF2', '#FF3EA5'], ink: '#FFFFFF', tone: 0.08 }, // violet
101
+ { colors: ['#FF5C64', '#FFB3A8', '#F4F3EF', '#FFFFFF'], ink: '#0B0B0B', tone: 1 }, // paper
102
+ ];
103
+
104
+ /** lightleak: a soft, slow colour field (light leak, lava lamp), its middle flattened to one tone for the lockup. */
105
+ function lightleak({ pick, r, accent }) {
106
+ const { colors, ink, tone } = pick(leakInksOf(accent));
107
+ const cfg = {
108
+ colors,
109
+ scale: between(r, 1.2, 1.9),
110
+ warp: between(r, 0.2, 0.45),
111
+ octaves: r() < 0.25 ? 3 : 2,
112
+ contrast: between(r, 1.4, 1.9),
113
+ speed: between(r, 0.8, 1.4),
114
+ offset: offsetOf(r),
115
+ quiet: { radius: 0.42, depth: 0.65 },
116
+ quietTone: tone,
117
+ };
118
+ return { cfg, ground: colors[0], ink, still: lightLeakStill(cfg, CARD) };
119
+ }
120
+
121
+ /* ---------- Cascade grid (effects-astro's cascadeGrid, after the hex spectrogram and circle grid sketches) ---------- */
122
+
123
+ /** Cascade grid cards' colours: ground, idle cells, reactive cells, the lockup's ink. */
124
+ const cascadeInksOf = (accent) => [
125
+ ['#0B0B0B', '#3A3A36', accent, '#F4F3EF'], // acid
126
+ ['#F4F3EF', '#B9BCCB', '#0038FF', '#0B0B0B'], // cobalt on paper
127
+ ['#1A0700', '#5A2A18', '#FF3D00', '#F4F3EF'], // signal
128
+ ['#04140B', '#1D4A30', '#39FF88', '#F4F3EF'], // phosphor
129
+ ['#0B0B0B', '#3A3A3A', '#F4F3EF', '#F4F3EF'], // mono
130
+ ['#F4F3EF', '#D6C9C2', '#FF5C64', '#0B0B0B'], // coral on paper
131
+ ];
132
+
133
+ /** cascade: a grid of hexagons or dots run like a scrolling spectrogram, waves cascading across it. */
134
+ function cascade({ pick, r, accent }) {
135
+ const [ground, idle, reactive, ink] = pick(cascadeInksOf(accent));
136
+ const cell = r() < 0.5 ? 'hex' : 'dot';
137
+ const cfg = {
138
+ cell,
139
+ cols: cell === 'hex' ? pick([24, 28, 32]) : pick([28, 32, 36]),
140
+ colors: [idle, reactive],
141
+ background: ground,
142
+ ...(cell === 'hex' ? { fill: pick(['core', 'core', 'solid', 'outline']) } : {}),
143
+ direction: r() < 0.75 ? 'right' : 'up',
144
+ lag: between(r, 0.05, 0.1),
145
+ tilt: between(r, 0.25, 0.45),
146
+ offset: Math.round(r() * 10000) / 100,
147
+ quiet: { radius: 0.36, depth: 0.95 },
148
+ };
149
+ // the ground alone until it starts: the idle lattice in CSS can't know the card's width to line up with it
150
+ return { cfg, ground, ink };
151
+ }
152
+
153
+ /* ---------- Flow field (effects-astro's flowField, after the Perlin flow-field sketch) ---------- */
154
+
155
+ /** Flow field cards' colours: ground, the trails' colours (blended in Oklab), the lockup's ink. */
156
+ const flowInksOf = (accent) => [
157
+ ['#0B0B0B', ['#F4F3EF'], '#F4F3EF'], // mono
158
+ ['#0B0B0B', [accent, '#39FF88'], accent], // acid
159
+ ['#F4F3EF', ['#0B0B0B', '#0038FF'], '#0B0B0B'], // paper
160
+ ['#0038FF', ['#F4F3EF', accent], '#F4F3EF'], // cobalt
161
+ ['#140604', ['#FF3D00', '#FF5C64', '#F4F3EF'], '#F4F3EF'], // signal
162
+ ['#12081F', ['#7B3FF2', '#FF3EA5'], '#F4F3EF'], // violet
163
+ ];
164
+
165
+ /** flowfield: fine trails riding a slowly evolving noise flow, gathering into streams (Canvas 2D: no WebGL context). */
166
+ function flowfield({ pick, r, accent }) {
167
+ const [ground, colors, ink] = pick(flowInksOf(accent));
168
+ const paper = ground === '#F4F3EF';
169
+ const cfg = {
170
+ colors,
171
+ background: ground,
172
+ colorBy: pick(['life', 'life', 'life', 'speed', 'random']),
173
+ density: Math.round(between(r, 20, 28)),
174
+ length: between(r, 0.4, 0.7),
175
+ weight: paper ? between(r, 0.8, 1) : between(r, 0.6, 0.9),
176
+ opacity: between(r, 0.7, 0.85),
177
+ pace: Math.round(between(r, 80, 130)),
178
+ scale: between(r, 1.6, 2.6),
179
+ evolve: between(r, 0.1, 0.2),
180
+ vary: between(r, 0.3, 0.45),
181
+ seed: 1 + Math.floor(r() * 100000),
182
+ quiet: { radius: 0.5, depth: 0.95 },
183
+ };
184
+ const still = `radial-gradient(120% 80% at 30% 25%, color-mix(in oklab, ${colors[0]} 10%, transparent), transparent 65%), ${ground}`;
185
+ return { cfg, ground, ink, still };
186
+ }
187
+
188
+ /* ---------- Voronoi mesh (effects-astro's voronoiMesh, after the Voronoi sketch) ---------- */
189
+
190
+ /** Voronoi mesh cards' colours: ground, [macro line, inner line], the lockup's ink, and the lines' opacity where the
191
+ * default doesn't hold (lime over black reads olive at the default 0.4). */
192
+ const meshInksOf = (accent) => [
193
+ ['#350F0E', ['#C1C2BC', '#A67676'], '#F4F3EF'], // silt (the sketch's own)
194
+ ['#0B0B0B', [accent, accent], '#F4F3EF', [0.6, 0.24]], // acid
195
+ ['#0038FF', ['#F4F3EF', '#8FA8FF'], '#F4F3EF'], // cobalt
196
+ ['#F4F3EF', ['#0B0B0B', '#FF3D00'], '#0B0B0B'], // paper
197
+ ['#06302B', ['#39FF88', '#1FB39F'], '#F4F3EF'], // phosphor
198
+ ['#1E0B45', ['#FF3EA5', '#9B6BFF'], '#F4F3EF'], // violet
199
+ ];
200
+
201
+ /** voronoi: two tiers of thin cell outlines, the macro seeds orbiting, the inner cells pulsing out from theirs. */
202
+ function voronoi({ pick, r, accent }) {
203
+ const [ground, colors, ink, opacity] = pick(meshInksOf(accent));
204
+ const cfg = {
205
+ colors,
206
+ background: ground,
207
+ ...(opacity ? { opacity } : {}),
208
+ cells: pick([4, 5, 6]),
209
+ inner: pick([4, 5, 6]),
210
+ width: between(r, 1, 1.25),
211
+ speed: between(r, 0.8, 1.4),
212
+ offset: [Math.round(r() * 10000) / 100, Math.round(r() * 10000) / 100],
213
+ quiet: { radius: 0.55, depth: 0.85 },
214
+ };
215
+ // the ground alone until it starts (its SVG still is ~23 KB a card, and a data: URL the CSP would have to allow)
216
+ return { cfg, ground, ink };
217
+ }
218
+
219
+ /* ---------- Dither field (effects-astro's ditherField, after the ripple dither sketch) ---------- */
220
+
221
+ /** Dither field cards' colours: ground, [dim edge, bright core], the lockup's ink. */
222
+ const ditherInksOf = (accent) => [
223
+ ['#0B0B0B', ['#3A4A0C', accent], '#F4F3EF'], // acid
224
+ ['#0B0B0B', ['#5A1A08', '#FF3D00'], '#F4F3EF'], // signal
225
+ ['#060A1F', ['#1C2F7A', '#5D8BFF'], '#F4F3EF'], // cobalt
226
+ ['#03140B', ['#0E5A35', '#39FF88'], '#F4F3EF'], // phosphor
227
+ ['#1A0B14', ['#7B3FF2', '#FF5C64'], '#F4F3EF'], // coral
228
+ ['#F4F3EF', ['#9AA6C6', '#0038FF'], '#0B0B0B'], // paper
229
+ ];
230
+ /** The corners a dither card's ripples run out from (0–1 from the top left). */
231
+ const DITHER_ORIGINS = [
232
+ [0.04, 0.3],
233
+ [0.96, 0.85],
234
+ [0.04, 0.96],
235
+ [0.96, 0.08],
236
+ ];
237
+
238
+ /** dither: a noise field in square dots, Bayer-dithered edges into a banded core, ripples running from a corner. */
239
+ function dither({ pick, r, accent }) {
240
+ const [ground, colors, ink] = pick(ditherInksOf(accent));
241
+ const cfg = {
242
+ colors,
243
+ background: ground,
244
+ dot: 3,
245
+ scale: between(r, 0.9, 1.5),
246
+ brightness: between(r, -0.25, -0.12),
247
+ evolve: between(r, 0.25, 0.45),
248
+ steps: pick([16, 20, 24]),
249
+ rings: pick([2, 3, 4]),
250
+ rippleSpeed: between(r, 0.06, 0.1),
251
+ ripple: between(r, 0.8, 1.2),
252
+ origin: pick(DITHER_ORIGINS),
253
+ offset: [Math.round(r() * 5000) / 100, Math.round(r() * 5000) / 100],
254
+ quiet: { radius: 0.42, depth: 1 },
255
+ };
256
+ return { cfg, ground, ink, still: ditherStill(cfg) };
257
+ }
258
+
259
+ /* ---------- Kinetic grid (effects-astro's kineticGrid, after the rain grid sketch) ---------- */
260
+
261
+ /** Kinetic grid cards' colours: ground, [wire, pulse], the lockup's ink, and the wires' rest brightness. */
262
+ const gridInksOf = (accent) => [
263
+ ['#0B0B0B', ['#3197FF', '#FFFFFF'], '#FFFFFF', 0.35], // blueprint (the sketch's own)
264
+ ['#0B0B0B', [accent, '#FFFFFF'], accent, 0.35], // acid
265
+ ['#06140D', ['#39FF88', '#E9FFF2'], '#39FF88', 0.28], // phosphor
266
+ ['#0038FF', ['#8FA8FF', '#FFFFFF'], '#FFFFFF', 0.35], // cobalt
267
+ ['#0B0B0B', ['#FF3D00', '#FFD2C2'], '#FFFFFF', 0.35], // signal
268
+ ['#F4F3EF', ['#0B0B0B', '#FF3D00'], '#0B0B0B', 0.35], // paper
269
+ ];
270
+
271
+ /** kinetic: a fine wireframe grid that ripples where drops land, pulses running along its wires. */
272
+ function kinetic({ pick, r, accent }) {
273
+ const [ground, colors, ink, rest] = pick(gridInksOf(accent));
274
+ const cfg = {
275
+ colors,
276
+ background: ground,
277
+ // fewer, bigger cells and longer waves than the effect's defaults, so the rings read on a card
278
+ cols: pick([28, 32]),
279
+ width: 1,
280
+ rest,
281
+ drops: pick([4, 5]),
282
+ strength: pick([1, 1.2]),
283
+ size: pick([1, 1.2]),
284
+ pulses: pick([2, 3]),
285
+ offset: Math.round(r() * 10000) / 100,
286
+ quiet: { radius: 0.5, depth: 0.8 },
287
+ };
288
+ return { cfg, ground, ink, still: gridStill(cfg, 1 / CARD) };
289
+ }
290
+
291
+ /* ---------- the table ---------- */
292
+
293
+ /** The field cards by kind: the effect that draws each (effects-astro's runtime, by its file name), its label, and its
294
+ * deal. */
295
+ export const FIELDS = {
296
+ asciinoise: { effect: 'ascii-noise', label: 'ASCII noise', deal: asciinoise },
297
+ lightleak: { effect: 'light-leak', label: 'Light leak', deal: lightleak },
298
+ cascade: { effect: 'cascade-grid', label: 'Cascade grid', deal: cascade },
299
+ flowfield: { effect: 'flow-field', label: 'Flow field', deal: flowfield },
300
+ voronoi: { effect: 'voronoi-mesh', label: 'Voronoi mesh', deal: voronoi },
301
+ dither: { effect: 'dither-field', label: 'Dither field', deal: dither },
302
+ kinetic: { effect: 'kinetic-grid', label: 'Kinetic grid', deal: kinetic },
303
+ };
304
+
305
+ /** Whether a kind is a field card. */
306
+ export const isField = (k) => Object.hasOwn(FIELDS, k);
package/src/index.d.ts CHANGED
@@ -7,7 +7,9 @@
7
7
  * `@logomarks/lookbook/live`; the styles are `@logomarks/lookbook/wall.css` and `@logomarks/lookbook/wall-looks.css`.
8
8
  */
9
9
  /** The wall: `lookbook()` (its cards and feed), `shuffled`, the accent, the looks' weights and how often a promo card comes. */
10
- export { ACCENT, EVERY, WEIGHTS, lookbook, shuffled } from './wall.js';
10
+ export { ACCENT, EVERY, KIND_LABEL, WEIGHTS, lookbook, shuffled } from './wall.js';
11
+ export { FIELDS, isField } from './fields.js';
12
+ export type { FieldKind, Field } from './fields.js';
11
13
  export type { Brand, BrandPicker, Card, Face, Kind, Lookbook, LookbookOptions, Recent, WallAssets, WallMark } from './wall.js';
12
14
  /** The cards between the marks. */
13
15
  export { headlineCard, sponsorCard, openSlotCard } from './promo.js';
package/src/index.js CHANGED
@@ -8,7 +8,9 @@
8
8
  */
9
9
 
10
10
  /** The wall: `lookbook()` (its cards and feed), `shuffled`, the accent, the looks' weights and how often a promo card comes. */
11
- export { ACCENT, EVERY, WEIGHTS, lookbook, shuffled } from './wall.js';
11
+ export { ACCENT, EVERY, KIND_LABEL, WEIGHTS, lookbook, shuffled } from './wall.js';
12
+ /** The field cards: live effects-astro fields behind a lockup (each off unless a wall gives it a weight). */
13
+ export { FIELDS, isField } from './fields.js';
12
14
 
13
15
  /** The cards between the marks. */
14
16
  export { headlineCard, sponsorCard, openSlotCard } from './promo.js';
package/src/live.js CHANGED
@@ -9,6 +9,41 @@
9
9
 
10
10
  import { ink } from '@arraypress/effects-astro/runtime/ink';
11
11
  import { paperShader } from '@arraypress/effects-astro/runtime/paper';
12
+
13
+ /**
14
+ * The field cards' effects (./fields.js), each loaded when a card first needs it, in its own chunk. The paths are
15
+ * literals, so a bundler splits them (it leaves a path built from a name in a package as it is).
16
+ */
17
+ const FIELD_EFFECTS = {
18
+ 'ascii-noise': () => import('@arraypress/effects-astro/runtime/ascii-noise').then((m) => m.asciiNoise),
19
+ 'light-leak': () => import('@arraypress/effects-astro/runtime/light-leak').then((m) => m.lightLeak),
20
+ 'cascade-grid': () => import('@arraypress/effects-astro/runtime/cascade-grid').then((m) => m.cascadeGrid),
21
+ 'flow-field': () => import('@arraypress/effects-astro/runtime/flow-field').then((m) => m.flowField),
22
+ 'voronoi-mesh': () => import('@arraypress/effects-astro/runtime/voronoi-mesh').then((m) => m.voronoiMesh),
23
+ 'dither-field': () => import('@arraypress/effects-astro/runtime/dither-field').then((m) => m.ditherField),
24
+ 'kinetic-grid': () => import('@arraypress/effects-astro/runtime/kinetic-grid').then((m) => m.kineticGrid),
25
+ };
26
+
27
+ /**
28
+ * Starts a field card's effect once its module has loaded.
29
+ *
30
+ * @param card The card.
31
+ * @param config Its `data-shader` config (`effect` names the field).
32
+ * @returns Stops it, or stops it from starting.
33
+ */
34
+ function field(card, config) {
35
+ let stop = () => {};
36
+ let gone = false;
37
+ FIELD_EFFECTS[config.effect]?.()
38
+ .then((start) => {
39
+ if (!gone) stop = start(card, config);
40
+ })
41
+ .catch(() => {}); // it can't run here: the card keeps its still
42
+ return () => {
43
+ gone = true;
44
+ stop();
45
+ };
46
+ }
12
47
  import { whenNear } from '@arraypress/effects-astro/runtime/near';
13
48
  import { budget } from '@arraypress/effects-astro/runtime/budget';
14
49
 
@@ -40,9 +75,10 @@ export function smoke(el, options = {}) {
40
75
  }
41
76
 
42
77
  /**
43
- * A starter for the shader and gradient cards: each card's live background (its `data-shader` config, Paper's shaders
44
- * in effects-astro), at most `cap` at once (a browser drops the oldest WebGL context past about sixteen, and a dropped
45
- * card's canvas goes blank). Without WebGL, or with a bad config, the card keeps its still CSS background.
78
+ * A starter for the shader, gradient and ASCII noise cards: each card's live background (its `data-shader` config, Paper's
79
+ * shaders or the ASCII noise field in effects-astro), at most `cap` at once (a browser drops the oldest WebGL context
80
+ * past about sixteen, and a dropped card's canvas goes blank). Without WebGL, or with a bad config, the card keeps its
81
+ * still background.
46
82
  *
47
83
  * @param cap The most running at once (10).
48
84
  * @returns Starts a card; what it returns stops it (or gives up its place in the queue).
@@ -52,13 +88,42 @@ export function shaders(cap = 10) {
52
88
  return (card) => {
53
89
  try {
54
90
  const config = JSON.parse(card.dataset.shader ?? '{}');
55
- return take(card, () => paperShader(card, config));
91
+ // a field card's effect is effects-astro's own; the rest are Paper's shaders
92
+ const start = () => (config.effect ? field(card, config) : paperShader(card, config));
93
+ return take(card, () => {
94
+ const stop = start();
95
+ return () => {
96
+ stop();
97
+ release(card);
98
+ };
99
+ });
56
100
  } catch {
57
101
  return () => {}; // no WebGL: the card keeps its still look
58
102
  }
59
103
  };
60
104
  }
61
105
 
106
+ /**
107
+ * Gives a stopped card's WebGL context back and lays a fresh canvas for its next turn. An effect that stops while its
108
+ * card is still on the page keeps its context (to start again quickly), but a long wall stops hundreds: past about
109
+ * sixteen the browser drops the oldest, and a card whose context was dropped can't draw again. So only the cards
110
+ * running (the budget) hold one.
111
+ *
112
+ * @param card The card.
113
+ */
114
+ function release(card) {
115
+ const old = card.querySelector('canvas.wc-fx');
116
+ if (!old) return;
117
+ // any getContext call gives a canvas without one a new context (and a new WebGL one, at the limit, drops a running
118
+ // card's), so ask for the cheapest first: if it is given, there was none to give back; if not, the canvas has one, and
119
+ // a WebGL one is lost (a Canvas 2D field's has nothing to give back)
120
+ if (!old.getContext('bitmaprenderer')) {
121
+ const gl = old.getContext('webgl2') ?? old.getContext('webgl');
122
+ gl?.getExtension('WEBGL_lose_context')?.loseContext();
123
+ }
124
+ old.replaceWith(old.cloneNode(false));
125
+ }
126
+
62
127
  const LIVE = '[data-shader], [data-smoke], [data-anim]';
63
128
 
64
129
  /**
@@ -754,6 +754,29 @@
754
754
  text-shadow: 0 2px 24px rgb(0 0 0 / 0.2);
755
755
  }
756
756
 
757
+ /* field cards (../fields.js): a live field from the effects library on a flat ground, the lockup in the quiet middle.
758
+ What shows first is the field's still (a CSS background, or ASCII noise's first frame as text, .wc-noise); the field's
759
+ canvas paints the ground too, so it fades in over the still like a shader card's */
760
+ .wc-field {
761
+ background: var(--bg);
762
+ color: var(--fg);
763
+ }
764
+
765
+ .wc-noise {
766
+ position: absolute;
767
+ inset: 0;
768
+ z-index: -1;
769
+ width: 100%;
770
+ height: 100%;
771
+ dominant-baseline: central;
772
+ font-kerning: none;
773
+ font-variant-ligatures: none;
774
+ }
775
+
776
+ .wc-field .wc-lockup {
777
+ color: var(--fg);
778
+ }
779
+
757
780
  /* smoke in the sponsor cards (the page's script): behind the words */
758
781
  .wc-smoke {
759
782
  position: absolute;
@@ -1100,19 +1123,22 @@
1100
1123
  /* gradient and shader cards: the live picture fades in over the still one (same colours; under the grain on a gradient
1101
1124
  card), so a card never pops from one to the other as it comes near the screen */
1102
1125
  .wc-gradient .wc-fx,
1103
- .wc-shader .wc-fx {
1126
+ .wc-shader .wc-fx,
1127
+ .wc-field .wc-fx {
1104
1128
  opacity: 0;
1105
1129
  transition: opacity 1.4s ease;
1106
1130
  }
1107
1131
 
1108
1132
  .wc-gradient[data-effect-live] .wc-fx,
1109
- .wc-shader[data-effect-live] .wc-fx {
1133
+ .wc-shader[data-effect-live] .wc-fx,
1134
+ .wc-field[data-effect-live] .wc-fx {
1110
1135
  opacity: 1;
1111
1136
  }
1112
1137
 
1113
1138
  @media (prefers-reduced-motion: reduce) {
1114
1139
  .wc-gradient .wc-fx,
1115
- .wc-shader .wc-fx {
1140
+ .wc-shader .wc-fx,
1141
+ .wc-field .wc-fx {
1116
1142
  transition: none;
1117
1143
  }
1118
1144
  }
package/src/wall.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  * (`lookbook()`); the styles are `@logomarks/lookbook/wall.css` and `@logomarks/lookbook/wall-looks.css`.
8
8
  */
9
9
  import { type LookKind } from './looks/index.js';
10
+ import { type FieldKind } from './fields.js';
10
11
  /** The one accent: acid lime. Every lime the looks print is this, unless `lookbook({ accent })` says otherwise. */
11
12
  export declare const ACCENT = '#C8FF00';
12
13
  /** A mark as the wall needs it: its outline (its paths' markup on the 512 canvas), what the brand picker reads (subject,
@@ -46,6 +47,7 @@ export type Kind =
46
47
  | 'paper'
47
48
  | 'gradient'
48
49
  | 'shader'
50
+ | FieldKind
49
51
  | LookKind;
50
52
  /** A card's made-up brand: its name, its line ("Coffee Co."), a tagline and a web address ending, from one sector. */
51
53
  export type Brand = {
@@ -90,6 +92,12 @@ export type LookbookOptions = {
90
92
  * none, so a wall without them deals the same cards as before.
91
93
  */
92
94
  palettes?: readonly (readonly [string, string])[];
95
+ /**
96
+ * How often looks are dealt, over `WEIGHTS` (relative; 0 deals a look never). The field cards (`FIELDS`: ASCII noise,
97
+ * light leak, dither, cascade, flow field, Voronoi, kinetic grid) are 0 unless given one, so a wall without them deals
98
+ * the same cards as before; `{ asciinoise: 1 }` deals one as often as the paper card.
99
+ */
100
+ weights?: Partial<Record<Kind, number>>;
93
101
  /** Where a card links: `#slug` by default. */
94
102
  href?: (mark: WallMark) => string;
95
103
  /** Pictures in `assets.photos` that are never a card's ground (a site's other photos kept in the same folder). */
@@ -123,12 +131,16 @@ export type Lookbook = {
123
131
  /** How often each look is dealt (relative). The older looks keep the shares they had as a list (photo and gradient 3 in
124
132
  * 23, tone, shader, mono and duo 2 …); the drawn looks' weights are `LOOK_WEIGHTS`, about 8 in 31 together. */
125
133
  export declare const WEIGHTS: Record<Kind, number>;
134
+ /** Names for the looks here whose id doesn't read as one (the others are their id, capitalised; the drawn looks' are
135
+ * `LOOK_LABEL`). */
136
+ export declare const KIND_LABEL: Partial<Record<Kind, string>>;
126
137
  /** A promo card every this many marks (`feed`). */
127
138
  export declare const EVERY = 30;
128
139
  /**
129
140
  * A wall: `card`, `feed` and `backgrounds`, with the brand picker, the typefaces and the accent given here.
130
141
  *
131
- * @param options The brand picker, the faces, and optionally the accent, the links and the photos to skip.
142
+ * @param options The brand picker, the faces, and optionally the accent, more palettes, the looks' weights, the links and
143
+ * the photos to skip.
132
144
  */
133
145
  export declare function lookbook(options: LookbookOptions): Lookbook;
134
146
  /**
package/src/wall.js CHANGED
@@ -15,6 +15,7 @@ import { look, isLook, ACID, LOOK_RATIO, LOOK_WEIGHTS } from './looks/index.js';
15
15
  import { opticalStyle } from './marks.js';
16
16
  import { BLOOM_KINDS, bloomFits } from './looks/bloom.js';
17
17
  import { CLUB_KINDS, CLUB_PHOTOS, clubFits } from './looks/club.js';
18
+ import { FIELDS, isField, MONO_FALLBACK } from './fields.js';
18
19
 
19
20
  /** The one accent: acid lime. Every lime the looks print is this, unless `lookbook({ accent })` says otherwise. */
20
21
  export const ACCENT = '#C8FF00';
@@ -98,6 +99,7 @@ const RATIO = {
98
99
  paper: '4 / 5',
99
100
  gradient: '4 / 5',
100
101
  shader: '4 / 5',
102
+ ...Object.fromEntries(Object.keys(FIELDS).map((k) => [k, '4 / 5'])),
101
103
  ...LOOK_RATIO,
102
104
  };
103
105
  /** How often each look is dealt (relative). The older looks keep the shares they had as a list (photo and gradient 3 in
@@ -118,10 +120,15 @@ export const WEIGHTS = {
118
120
  crt: 1,
119
121
  pattern: 1,
120
122
  crop: 1,
123
+ // the field cards are dealt only where a wall gives them a weight (`lookbook({ weights })`), so the walls made before
124
+ // they came deal as they did
125
+ ...Object.fromEntries(Object.keys(FIELDS).map((k) => [k, 0])),
121
126
  ...LOOK_WEIGHTS,
122
127
  };
123
- const DEAL = Object.entries(WEIGHTS);
124
- const TOTAL = DEAL.reduce((s, [, w]) => s + w, 0);
128
+
129
+ /** Names for the looks here whose id doesn't read as one (the others are their id, capitalised; the drawn looks'
130
+ * are `LOOK_LABEL`). */
131
+ export const KIND_LABEL = Object.fromEntries(Object.entries(FIELDS).map(([k, f]) => [k, f.label]));
125
132
 
126
133
  /** The live backgrounds a shader card can have: Paper's shaders (vendored in the effects library), the calm looks
127
134
  * picked from its presets (2026-11-12: the rainbow colour panels, the white-hot smoke ring, the grey ink and Paper's
@@ -191,6 +198,12 @@ export function lookbook(options) {
191
198
  const PALETTES = [...palettesOf(accent), ...(options.palettes ?? [])],
192
199
  INKS = inksOf(accent),
193
200
  TONES = tonesOf(accent);
201
+ // the looks this wall deals, by weight: `WEIGHTS`, and `options.weights` over them (a look at 0 isn't dealt)
202
+ const DEAL = Object.entries({ ...WEIGHTS, ...options.weights }).filter(([, w]) => w > 0);
203
+ const TOTAL = DEAL.reduce((s, [, w]) => s + w, 0);
204
+ /** The face a field card's name takes when it asks for a monospaced one (ASCII noise): the first given, else the card's
205
+ * own. */
206
+ const MONO = FACES.find(([family]) => /mono/i.test(family));
194
207
 
195
208
  /** One card's HTML, its height over its width, its brand, and what it used. `deal` changes with Shuffle (new names
196
209
  * and looks for the same marks); `recent` is what the cards just before it used, so neighbours don't repeat a look, a
@@ -367,6 +380,17 @@ export function lookbook(options) {
367
380
  attrs = ` data-shader="${escapeHtml(JSON.stringify(cfg))}"`;
368
381
  style += `;--fg:${look.ink ?? '#fff'};background:${typeof look.still === 'string' ? look.still : look.still(a, b, c, base)}`;
369
382
  inner = `<canvas class="wc-fx" aria-hidden="true"></canvas>${r() < 0.5 ? `<span class="wc-lockup is-stack">${svg()}<b class="wc-name" style="${type}">${escapeHtml(name)}</b><i>${escapeHtml(line)}</i></span>` : `<span class="wc-lockup">${svg()}<b class="wc-name" style="${type}">${escapeHtml(name)}</b></span>`}`;
383
+ } else if (isField(kind)) {
384
+ // a field card (./fields.js): an effects-astro field drawn live, started on screen like a shader card, the lockup
385
+ // over its quiet middle; what shows before it starts is the field's still (a CSS background, or markup under
386
+ // the canvas)
387
+ const field = FIELDS[kind];
388
+ const f = field.deal({ pick, r, accent, mono: MONO });
389
+ attrs = ` data-shader="${escapeHtml(JSON.stringify({ effect: field.effect, ...f.cfg }))}"`;
390
+ style += `;--bg:${f.ground};--fg:${f.ink}${f.still ? `;background:${f.still}` : ''}`;
391
+ const face = f.mono ? (MONO?.[0] ?? MONO_FALLBACK) : null;
392
+ const nameType = f.mono && MONO ? `font-family:${MONO[0]};font-weight:${MONO[1]};letter-spacing:${MONO[2]};text-transform:${MONO[3]}` : type;
393
+ inner = `${f.under ?? ''}<canvas class="wc-fx" aria-hidden="true"></canvas><span class="wc-lockup is-stack">${svg()}<b class="wc-name" style="${nameType}">${escapeHtml(name)}</b><i${face ? ` style="font-family:${face}"` : ''}>${escapeHtml(line)}</i></span>`;
370
394
  } else if (kind === 'tone') {
371
395
  const [bg, tint] = pick(TONES);
372
396
  style += `;--bg:${bg};--accent:${tint}`;
@@ -382,7 +406,7 @@ export function lookbook(options) {
382
406
  const plain = `<span class="wc-plain">${mark}<b class="wc-name">${escapeHtml(name)}</b></span>`;
383
407
  const [w, h] = RATIO[kind].split('/').map(Number);
384
408
  return {
385
- html: `<a class="wc wc-${kind}${isLook(kind) ? ' wx' : ''}" href="${href(m)}" style="${style}"${attrs}>${inner}${plain}<span class="wc-tag">${escapeHtml(m.name)} <em>→</em></span></a>`,
409
+ html: `<a class="wc wc-${kind}${isLook(kind) ? ' wx' : isField(kind) ? ' wc-field' : ''}" href="${href(m)}" style="${style}"${attrs}>${inner}${plain}<span class="wc-tag">${escapeHtml(m.name)} <em>→</em></span></a>`,
386
410
  h: h / w,
387
411
  brand,
388
412
  used: { kinds: [kind], names: [name], lines: [line], photos: photo ? [photo] : [] },