@logomarks/lookbook 0.1.0 → 0.1.2

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,23 @@ 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.1.2] — 2026-11-15
9
+
10
+ ### Changed
11
+
12
+ - Works with `@arraypress/effects-astro` 0.9 as well as 0.8 (`^0.8.0 || ^0.9.0`), so a site on the new effects keeps one copy
13
+ of it. Nothing this package uses changed.
14
+
15
+ ## [0.1.1] — 2026-11-15
16
+
17
+ ### Changed
18
+
19
+ - **The mark measures are core's.** `markBox`, `inkShare`, `opticalScale` and `OPTICAL` come from `@logomarks/core/analyse`, `cellsAcross` and `markCells` from `@logomarks/core/edit` (core 0.2.1 took them from here, unchanged), and `/marks` re-exports them, so nothing that imports them changes. `opticalVars`, `opticalStyle` and `heatField` stay here. The equivalence tests pass unchanged.
20
+
21
+ ### Dependencies
22
+
23
+ - `@logomarks/core` ^0.2.1.
24
+
8
25
  ## [0.1.0] — 2026-11-15
9
26
 
10
27
  The first cut, moved from the Logomarks site's Lookbook. Its cards are the site's, byte for byte, apart from the
package/README.md CHANGED
@@ -39,7 +39,7 @@ holoPointer();
39
39
 
40
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.
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
- - `@logomarks/lookbook/marks`: a mark's box, ink share, optical size (`opticalVars`), cells and heat field.
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
43
  - `@logomarks/lookbook/live`: `liveCards`, `shaders`, `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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logomarks/lookbook",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
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,10 +75,10 @@
75
75
  "registry": "https://registry.npmjs.org/"
76
76
  },
77
77
  "dependencies": {
78
- "@arraypress/effects-astro": "^0.8.0",
78
+ "@arraypress/effects-astro": "^0.8.0 || ^0.9.0",
79
79
  "@arraypress/og-image": "^1.5.1",
80
80
  "@arraypress/text": "^2.2.0",
81
- "@logomarks/core": "^0.2.0"
81
+ "@logomarks/core": "^0.2.1"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@types/node": "^26.6.6",
package/src/marks.d.ts CHANGED
@@ -2,84 +2,34 @@
2
2
  * @module @logomarks/lookbook/marks
3
3
  *
4
4
  * What the Lookbook's looks need to know about a mark's shape: its real box, its optical size (how much bigger a wide,
5
- * slim or light mark is drawn), and the mark as square cells (the pixel and LED looks). Thin wiring over
6
- * `@logomarks/core` (its SVG reader, ring sampler and pixelate grid); browser-safe,
7
- * so the wall's script can make the same cards as the page.
5
+ * slim or light mark is drawn), and the mark as square cells (the pixel and LED looks). Browser-safe, so the wall's
6
+ * script can make the same cards as the page.
8
7
  *
9
- * Bound for `@logomarks/core` (2026-11-15; the library imports them from there once core has them): `markBox`,
10
- * `inkShare`, `opticalScale` and `OPTICAL` to `/analyse` (measures of a mark, like its widths and shape tags), and
11
- * `cellsAcross` and `markCells` to `/edit` beside `pixelGrid` (a grid by cell count, where `pixelGrid` takes an amount
12
- * and stops at 14 across; and shapes → rings → coverage → cells in one call). `opticalVars`, `opticalStyle` and
13
- * `heatField` stay here: the first two are the cards' CSS, the third is the thermal look's own filter.
8
+ * The measures are `@logomarks/core`'s (since 0.2.1), re-exported here: `markBox`, `inkShare`, `opticalScale` and
9
+ * `OPTICAL` from `/analyse`, `cellsAcross` and `markCells` from `/edit`. What stays here is the Lookbook's own:
10
+ * `opticalVars` and `opticalStyle` (the cards' CSS) and `heatField` (the thermal look's filter).
14
11
  */
15
12
  import { type PixelGrid } from '@logomarks/core/edit';
16
- /** A box on the 512 canvas. */
17
- export type Box = {
18
- x: number;
19
- y: number;
20
- w: number;
21
- h: number;
22
- };
23
- /** A mark as square cells: the grid, which cells are filled (row by row), and the filled cells as one path. */
24
- export type MarkCells = {
25
- grid: PixelGrid;
26
- on: Uint8Array;
27
- d: string;
28
- };
29
- /** The real box round a mark's outlines (its paths' markup), on the 512 canvas; the 448 fit's box when it can't be read. */
30
- export declare function markBox(paths: string): Box;
31
- /** The optical size's limits: the most a mark grows, and how much its box and its ink count. */
32
- export declare const OPTICAL: {
33
- /** The most a mark grows (× its 448 fit). */
34
- readonly max: 1.3;
35
- /** The box's term: (448² / its area) to this power, so a square is 1, 448 × 200 about 1.22. */
36
- readonly power: 0.25;
37
- /** The ink's term: up to this much more for a light mark … */
38
- readonly light: 0.1;
39
- /** … in full at or below this share of its box inked, none at or above `solid`. */
40
- readonly thin: 0.2;
41
- readonly solid: 0.45;
42
- };
43
- /**
44
- * How much of a mark's own box is ink, 0–1 (core's scanline coverage on a grid 16 cells across its longest side).
45
- *
46
- * @param paths The mark's paths' markup.
47
- */
48
- export declare function inkShare(paths: string): number;
49
- /**
50
- * The mark's optical size: how much bigger to draw it so it holds as much of the eye as a square, solid mark at the 448
51
- * fit. Every mark is fitted to 448 on its longest side, so a wide, short one (448 × 200) or a slim one (266 × 448)
52
- * carries far less area, and a light, line-drawn one less weight. 1 for a square solid; 448 × 200 about 1.22; never
53
- * below 1, never above `OPTICAL.max`. Each look caps it again for the room round its words (wall.css, `--mk-scale`).
54
- *
55
- * @param box The mark's box (`markBox`).
56
- * @param ink The share of its box inked (`inkShare`); 1 leaves the ink out of it.
57
- */
58
- export declare function opticalScale(box: Pick<Box, 'w' | 'h'>, ink?: number): number;
13
+ import { type Bounds } from '@logomarks/core/svg';
14
+ export { markBox, inkShare, opticalScale, OPTICAL } from '@logomarks/core/analyse';
15
+ export { cellsAcross, markCells, type MarkCells } from '@logomarks/core/edit';
16
+ /** A box on the 512 canvas (core's `Bounds`). */
17
+ export type Box = Bounds;
59
18
  /**
60
19
  * A card's optical size as CSS custom properties for its `style`: `--mk-k` (the scale), `--mk-w` and `--mk-h` (the box,
61
20
  * on the 512 canvas), from which wall.css works out `--mk-scale` within each look's room.
62
21
  *
63
22
  * @param paths The mark's paths' markup.
23
+ * @returns The three properties, as strings.
64
24
  */
65
25
  export declare function opticalVars(paths: string): Record<'--mk-k' | '--mk-w' | '--mk-h', string>;
66
- /** `opticalVars` as a `style` fragment (`;--mk-k:…`). */
67
- export declare const opticalStyle: (paths: string) => string;
68
26
  /**
69
- * A pixel grid of `n` cells across a box's longest side, centred on it (core's `pixelGrid`, sized by count).
70
- *
71
- * @param n Cells across the longest side.
72
- * @param box The mark's box.
73
- */
74
- export declare function cellsAcross(n: number, box: Box): PixelGrid;
75
- /**
76
- * The mark as square cells, `n` across its longest side, measured by core's scanline coverage (half a cell covered, or
77
- * a fifth where a cell would otherwise break a thin line).
27
+ * `opticalVars` as a `style` fragment (`;--mk-k:…`).
78
28
  *
79
29
  * @param paths The mark's paths' markup.
80
- * @param n Cells across.
30
+ * @returns The fragment, to append to a card's `style`.
81
31
  */
82
- export declare function markCells(paths: string, n: number): MarkCells;
32
+ export declare const opticalStyle: (paths: string) => string;
83
33
  /** A mark's heat: what the thermal look's infrared filter shows (./looks/index.js), worked out on a grid so the seeker
84
34
  * knows where the mark is hottest. */
85
35
  export type HeatField = {
@@ -102,5 +52,6 @@ export type HeatField = {
102
52
  * like the look's SVG filter, on an 8-unit grid; and the hottest point.
103
53
  *
104
54
  * @param paths The mark's paths' markup.
55
+ * @returns The grid, the heat and ink per cell, and the hottest cell.
105
56
  */
106
57
  export declare function heatField(paths: string): HeatField;
package/src/marks.js CHANGED
@@ -2,80 +2,27 @@
2
2
  * @module @logomarks/lookbook/marks
3
3
  *
4
4
  * What the Lookbook's looks need to know about a mark's shape: its real box, its optical size (how much bigger a wide,
5
- * slim or light mark is drawn), and the mark as square cells (the pixel and LED looks). Thin wiring over
6
- * `@logomarks/core` (its SVG reader, ring sampler and pixelate grid); browser-safe,
7
- * so the wall's script can make the same cards as the page.
5
+ * slim or light mark is drawn), and the mark as square cells (the pixel and LED looks). Browser-safe, so the wall's
6
+ * script can make the same cards as the page.
8
7
  *
9
- * Bound for `@logomarks/core` (2026-11-15; the library imports them from there once core has them): `markBox`,
10
- * `inkShare`, `opticalScale` and `OPTICAL` to `/analyse` (measures of a mark, like its widths and shape tags), and
11
- * `cellsAcross` and `markCells` to `/edit` beside `pixelGrid` (a grid by cell count, where `pixelGrid` takes an amount
12
- * and stops at 14 across; and shapes → rings → coverage → cells in one call). `opticalVars`, `opticalStyle` and
13
- * `heatField` stay here: the first two are the cards' CSS, the third is the thermal look's own filter.
8
+ * The measures are `@logomarks/core`'s (since 0.2.1), re-exported here: `markBox`, `inkShare`, `opticalScale` and
9
+ * `OPTICAL` from `/analyse`, `cellsAcross` and `markCells` from `/edit`. What stays here is the Lookbook's own:
10
+ * `opticalVars` and `opticalStyle` (the cards' CSS) and `heatField` (the thermal look's filter).
14
11
  */
15
12
 
16
- import { shapes, rings, bounds } from '@logomarks/core/svg';
17
- import { pixelCoverage, pixelCells, pixelPath } from '@logomarks/core/edit';
13
+ import { shapes, rings } from '@logomarks/core/svg';
14
+ import { pixelCoverage } from '@logomarks/core/edit';
15
+ import { markBox, inkShare, opticalScale } from '@logomarks/core/analyse';
18
16
 
19
- /** The real box round a mark's outlines (its paths' markup), on the 512 canvas; the 448 fit's box when it can't be read. */
20
- export function markBox(paths) {
21
- const list = shapes(paths);
22
- if (!list.length) return { x: 32, y: 32, w: 448, h: 448 };
23
- const b = bounds(list);
24
- return Number.isFinite(b.w) && b.w > 0 ? b : { x: 32, y: 32, w: 448, h: 448 };
25
- }
26
-
27
- /** The optical size's limits: the most a mark grows, and how much its box and its ink count. */
28
- export const OPTICAL = {
29
- /** The most a mark grows (× its 448 fit). */
30
- max: 1.3,
31
- /** The box's term: (448² / its area) to this power, so a square is 1, 448 × 200 about 1.22. */
32
- power: 0.25,
33
- /** The ink's term: up to this much more for a light mark … */
34
- light: 0.1,
35
- /** … in full at or below this share of its box inked, none at or above `solid`. */
36
- thin: 0.2,
37
- solid: 0.45,
38
- };
39
-
40
- /**
41
- * How much of a mark's own box is ink, 0–1 (core's scanline coverage on a grid 16 cells across its longest side).
42
- *
43
- * @param paths The mark's paths' markup.
44
- */
45
- export function inkShare(paths) {
46
- const list = shapes(paths);
47
- if (!list.length) return 1;
48
- const grid = cellsAcross(16, markBox(paths));
49
- const cov = pixelCoverage(
50
- list.map((s) => ({ rings: rings(s.segs, 3), evenodd: s.evenodd })),
51
- grid,
52
- );
53
- let sum = 0;
54
- for (const v of cov) sum += v;
55
- return cov.length ? sum / cov.length : 1;
56
- }
57
-
58
- /**
59
- * The mark's optical size: how much bigger to draw it so it holds as much of the eye as a square, solid mark at the 448
60
- * fit. Every mark is fitted to 448 on its longest side, so a wide, short one (448 × 200) or a slim one (266 × 448)
61
- * carries far less area, and a light, line-drawn one less weight. 1 for a square solid; 448 × 200 about 1.22; never
62
- * below 1, never above `OPTICAL.max`. Each look caps it again for the room round its words (wall.css, `--mk-scale`).
63
- *
64
- * @param box The mark's box (`markBox`).
65
- * @param ink The share of its box inked (`inkShare`); 1 leaves the ink out of it.
66
- */
67
- export function opticalScale(box, ink = 1) {
68
- const { max, power, light, thin, solid } = OPTICAL;
69
- const area = (448 * 448) / Math.max(1, box.w * box.h);
70
- const weight = 1 + light * Math.min(1, Math.max(0, (solid - ink) / (solid - thin)));
71
- return Math.min(max, Math.max(1, area ** power * weight));
72
- }
17
+ export { markBox, inkShare, opticalScale, OPTICAL } from '@logomarks/core/analyse';
18
+ export { cellsAcross, markCells } from '@logomarks/core/edit';
73
19
 
74
20
  /**
75
21
  * A card's optical size as CSS custom properties for its `style`: `--mk-k` (the scale), `--mk-w` and `--mk-h` (the box,
76
22
  * on the 512 canvas), from which wall.css works out `--mk-scale` within each look's room.
77
23
  *
78
24
  * @param paths The mark's paths' markup.
25
+ * @returns The three properties, as strings.
79
26
  */
80
27
  export function opticalVars(paths) {
81
28
  const box = markBox(paths);
@@ -86,41 +33,16 @@ export function opticalVars(paths) {
86
33
  };
87
34
  }
88
35
 
89
- /** `opticalVars` as a `style` fragment (`;--mk-k:…`). */
90
- export const opticalStyle = (paths) =>
91
- Object.entries(opticalVars(paths))
92
- .map(([k, v]) => `;${k}:${v}`)
93
- .join('');
94
-
95
36
  /**
96
- * A pixel grid of `n` cells across a box's longest side, centred on it (core's `pixelGrid`, sized by count).
97
- *
98
- * @param n Cells across the longest side.
99
- * @param box The mark's box.
100
- */
101
- export function cellsAcross(n, box) {
102
- const cell = Math.max(box.w, box.h) / n;
103
- const cols = Math.max(1, Math.round(box.w / cell)),
104
- rows = Math.max(1, Math.round(box.h / cell));
105
- return { cols, rows, cell, x0: box.x + box.w / 2 - (cols * cell) / 2, y0: box.y + box.h / 2 - (rows * cell) / 2 };
106
- }
107
-
108
- /**
109
- * The mark as square cells, `n` across its longest side, measured by core's scanline coverage (half a cell covered, or
110
- * a fifth where a cell would otherwise break a thin line).
37
+ * `opticalVars` as a `style` fragment (`;--mk-k:…`).
111
38
  *
112
39
  * @param paths The mark's paths' markup.
113
- * @param n Cells across.
40
+ * @returns The fragment, to append to a card's `style`.
114
41
  */
115
- export function markCells(paths, n) {
116
- const list = shapes(paths);
117
- const grid = cellsAcross(n, markBox(paths));
118
- const cov = pixelCoverage(
119
- list.map((s) => ({ rings: rings(s.segs), evenodd: s.evenodd })),
120
- grid,
121
- );
122
- return { grid, on: pixelCells(cov, grid), d: pixelPath(cov, grid) ?? '' };
123
- }
42
+ export const opticalStyle = (paths) =>
43
+ Object.entries(opticalVars(paths))
44
+ .map(([k, v]) => `;${k}:${v}`)
45
+ .join('');
124
46
 
125
47
  /** A separable Gaussian blur of a grid, `sigma` in cells. */
126
48
  function blur(src, cols, rows, sigma) {
@@ -155,6 +77,7 @@ function blur(src, cols, rows, sigma) {
155
77
  * like the look's SVG filter, on an 8-unit grid; and the hottest point.
156
78
  *
157
79
  * @param paths The mark's paths' markup.
80
+ * @returns The grid, the heat and ink per cell, and the hottest cell.
158
81
  */
159
82
  export function heatField(paths) {
160
83
  const list = shapes(paths);