@logomarks/lookbook 0.0.0-stage → 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 +46 -0
- package/LICENSE +21 -0
- package/README.md +56 -2
- package/package.json +85 -4
- package/src/index.d.ts +16 -0
- package/src/index.js +16 -0
- package/src/live.d.ts +105 -0
- package/src/live.js +146 -0
- package/src/looks/bloom.d.ts +40 -0
- package/src/looks/bloom.js +134 -0
- package/src/looks/club.d.ts +39 -0
- package/src/looks/club.js +140 -0
- package/src/looks/index.d.ts +186 -0
- package/src/looks/index.js +1070 -0
- package/src/looks/kit.d.ts +72 -0
- package/src/looks/kit.js +54 -0
- package/src/looks/modern.d.ts +90 -0
- package/src/looks/modern.js +457 -0
- package/src/looks/street.d.ts +100 -0
- package/src/looks/street.js +425 -0
- package/src/looks/studio.d.ts +52 -0
- package/src/looks/studio.js +269 -0
- package/src/marks.d.ts +57 -0
- package/src/marks.js +101 -0
- package/src/promo.d.ts +37 -0
- package/src/promo.js +48 -0
- package/src/styles/wall-looks.css +4900 -0
- package/src/styles/wall.css +1957 -0
- package/src/wall.d.ts +135 -0
- package/src/wall.js +441 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @logomarks/lookbook/looks/kit
|
|
3
|
+
*
|
|
4
|
+
* What the Lookbook's drawn looks share (./index.js and the sets beside it): the context a look is
|
|
5
|
+
* given, what it returns, and the small builders for its markup (the mark's one copy and its `<use>`, the optical-size
|
|
6
|
+
* group, corner words, the name, the artwork's `<svg>` and its viewBoxes).
|
|
7
|
+
*/
|
|
8
|
+
import type { LookKind } from './index.js';
|
|
9
|
+
/** What a look is given by `card()`: the mark, the card's seeded random, its picks so far, the accent and the shared
|
|
10
|
+
* palettes. */
|
|
11
|
+
export type LookCtx = {
|
|
12
|
+
kind: LookKind;
|
|
13
|
+
slug: string;
|
|
14
|
+
paths: string;
|
|
15
|
+
/** The card's seeded random (0–1). */
|
|
16
|
+
r: () => number;
|
|
17
|
+
/** Unique to the card (and kind): every id in it starts with this. */
|
|
18
|
+
uid: string;
|
|
19
|
+
/** The made-up brand's name, category line, tagline and web address ending, all from one sector (the wall's brand
|
|
20
|
+
* picker). */
|
|
21
|
+
name: string;
|
|
22
|
+
line: string;
|
|
23
|
+
tagline: string;
|
|
24
|
+
tld: string;
|
|
25
|
+
/** The name's typeface, as a `style` value. */
|
|
26
|
+
type: string;
|
|
27
|
+
/** The accent (acid lime unless the wall was given another). */
|
|
28
|
+
accent: string;
|
|
29
|
+
/** The strong inks (the mono cards'). */
|
|
30
|
+
inks: readonly string[];
|
|
31
|
+
/** Ground and ink pairs (the colour cards'). */
|
|
32
|
+
palettes: readonly (readonly [string, string])[];
|
|
33
|
+
/** A photo the cards just before haven't shown (of those whose file names match `only`, when given). */
|
|
34
|
+
photo: (only?: RegExp) => string;
|
|
35
|
+
/** A background from the glass set (abstracts and flowers) the cards just before haven't shown, by file name as `photo`. */
|
|
36
|
+
glass: (only?: RegExp) => string;
|
|
37
|
+
};
|
|
38
|
+
/** A look's card: its inner HTML, what goes on its `style`, and its attributes. */
|
|
39
|
+
export type LookOut = {
|
|
40
|
+
inner: string;
|
|
41
|
+
style: string;
|
|
42
|
+
attrs: string;
|
|
43
|
+
};
|
|
44
|
+
/** A number to one decimal place, as SVG wants it. */
|
|
45
|
+
export declare const f1: (n: number) => string;
|
|
46
|
+
/** A number as two digits ("07"). */
|
|
47
|
+
export declare const pad2: (n: number) => string;
|
|
48
|
+
/** The mark's paths with `pathLength="1"`, for strokes that draw themselves. */
|
|
49
|
+
export declare const withLength: (paths: string) => string;
|
|
50
|
+
/** The mark, once, for `<use>`. */
|
|
51
|
+
export declare const def: (c: LookCtx) => string;
|
|
52
|
+
/** A `<use>` of the mark's one copy, with a class (and any more attributes). */
|
|
53
|
+
export declare const use: (c: LookCtx, cls: string, extra?: string) => string;
|
|
54
|
+
/** The mark (and what's drawn round it) at its optical size: scaled by the card's `--mk-scale` about the canvas's centre
|
|
55
|
+
* (wall.css; each look caps it for the room round its words). */
|
|
56
|
+
export declare const mk: (body: string) => string;
|
|
57
|
+
/** A corner's small meta text: tl, tr, bl, br. */
|
|
58
|
+
export declare const meta: (pos: string, text: string) => string;
|
|
59
|
+
/** The card's name as its `<b class="wc-name">`, in the card's face unless `face` is false. */
|
|
60
|
+
export declare const nameB: (c: LookCtx, cls?: string, face?: boolean) => string;
|
|
61
|
+
/** An `<svg>` for a look's artwork. */
|
|
62
|
+
export declare const art: (viewBox: string, body: string, cls?: string, extra?: string) => string;
|
|
63
|
+
/** A viewBox round the 512 canvas with `m` units of margin. */
|
|
64
|
+
export declare const around: (m: number) => string;
|
|
65
|
+
/** A viewBox of this card shape round the 512 canvas, the mark `fill` of the shorter side. */
|
|
66
|
+
export declare const framed: (ratio: number, fill: number) => string;
|
|
67
|
+
/** A picker from the card's seeded random: one item of a list. */
|
|
68
|
+
export declare const pickOf: (c: LookCtx) => <T>(xs: readonly T[]) => T;
|
|
69
|
+
/** The mark as a CSS background image (a data: SVG in one colour, stretched to the card): the reeded glass's source. At
|
|
70
|
+
* its optical size, capped here (a background can't read `--mk-scale`): no taller than the 448 fit, so it stays clear of
|
|
71
|
+
* the name under it. */
|
|
72
|
+
export declare function markUrl(paths: string, fill: string): string;
|
package/src/looks/kit.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @logomarks/lookbook/looks/kit
|
|
3
|
+
*
|
|
4
|
+
* What the Lookbook's drawn looks share (./index.js and the sets beside it): the context a look is
|
|
5
|
+
* given, what it returns, and the small builders for its markup (the mark's one copy and its `<use>`, the optical-size
|
|
6
|
+
* group, corner words, the name, the artwork's `<svg>` and its viewBoxes).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { escapeHtml } from '@arraypress/text';
|
|
10
|
+
|
|
11
|
+
import { markBox, opticalScale, inkShare } from '../marks.js';
|
|
12
|
+
|
|
13
|
+
/** A number to one decimal place, as SVG wants it. */
|
|
14
|
+
export const f1 = (n) => String(Math.round(n * 10) / 10);
|
|
15
|
+
/** A number as two digits ("07"). */
|
|
16
|
+
export const pad2 = (n) => String(n).padStart(2, '0');
|
|
17
|
+
/** The mark's paths with `pathLength="1"`, for strokes that draw themselves. */
|
|
18
|
+
export const withLength = (paths) => paths.replace(/<path\b/g, '<path pathLength="1"');
|
|
19
|
+
/** The mark, once, for `<use>`. */
|
|
20
|
+
export const def = (c) => `<g id="${c.uid}-m" data-m>${c.paths}</g>`;
|
|
21
|
+
/** A `<use>` of the mark's one copy, with a class (and any more attributes). */
|
|
22
|
+
export const use = (c, cls, extra = '') => `<use href="#${c.uid}-m" class="${cls}"${extra} />`;
|
|
23
|
+
/** The mark (and what's drawn round it) at its optical size: scaled by the card's `--mk-scale` about the canvas's centre
|
|
24
|
+
* (wall.css; each look caps it for the room round its words). */
|
|
25
|
+
export const mk = (body) => `<g class="wx-mk">${body}</g>`;
|
|
26
|
+
/** A corner's small meta text: tl, tr, bl, br. */
|
|
27
|
+
export const meta = (pos, text) => `<span class="wx-meta is-${pos}">${text}</span>`;
|
|
28
|
+
/** The card's name as its `<b class="wc-name">`, in the card's face unless `face` is false. */
|
|
29
|
+
export const nameB = (c, cls = '', face = true) =>
|
|
30
|
+
`<b class="wc-name${cls ? ` ${cls}` : ''}"${face ? ` style="${c.type}"` : ''}>${escapeHtml(c.name)}</b>`;
|
|
31
|
+
/** An `<svg>` for a look's artwork. */
|
|
32
|
+
export const art = (viewBox, body, cls = '', extra = '') =>
|
|
33
|
+
`<svg class="wx-art${cls ? ` ${cls}` : ''}" viewBox="${viewBox}"${extra} aria-hidden="true">${body}</svg>`;
|
|
34
|
+
/** A viewBox round the 512 canvas with `m` units of margin. */
|
|
35
|
+
export const around = (m) => `${-m} ${-m} ${512 + 2 * m} ${512 + 2 * m}`;
|
|
36
|
+
/** A viewBox of this card shape round the 512 canvas, the mark `fill` of the shorter side. */
|
|
37
|
+
export const framed = (ratio, fill) => {
|
|
38
|
+
const short = 512 / fill,
|
|
39
|
+
w = ratio >= 1 ? short * ratio : short,
|
|
40
|
+
h = ratio >= 1 ? short : short / ratio;
|
|
41
|
+
return `${f1(256 - w / 2)} ${f1(256 - h / 2)} ${f1(w)} ${f1(h)}`;
|
|
42
|
+
};
|
|
43
|
+
/** A picker from the card's seeded random: one item of a list. */
|
|
44
|
+
export const pickOf = (c) => (xs) => xs[Math.floor(c.r() * xs.length)];
|
|
45
|
+
|
|
46
|
+
/** The mark as a CSS background image (a data: SVG in one colour, stretched to the card): the reeded glass's source. At
|
|
47
|
+
* its optical size, capped here (a background can't read `--mk-scale`): no taller than the 448 fit, so it stays clear of
|
|
48
|
+
* the name under it. */
|
|
49
|
+
export function markUrl(paths, fill) {
|
|
50
|
+
const box = markBox(paths);
|
|
51
|
+
const k = Math.min(opticalScale(box, inkShare(paths)), 448 / box.h, 600 / box.w);
|
|
52
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 500" preserveAspectRatio="none"><g fill="${fill}" transform="translate(200 250) scale(${(0.4844 * k).toFixed(4)}) translate(-256 -256)">${paths}</g></svg>`;
|
|
53
|
+
return `url('data:image/svg+xml,${encodeURIComponent(svg)}')`;
|
|
54
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @logomarks/lookbook/looks/modern
|
|
3
|
+
*
|
|
4
|
+
* The Lookbook's 2027 set of drawn looks (the owner: "ultra modern 2027 / edgy… cool asf"), and his grid fill: diffusion,
|
|
5
|
+
* chrome, puff, datamosh, holo, eink, cloud and gridfill. Same rules as ./index.js (pure HTML strings from the
|
|
6
|
+
* card's seeded random, per-card values as custom properties in `style`, ids under the card's uid, motion in CSS only and
|
|
7
|
+
* only while `is-live`, the still styles the final frame); each look's styles are a block in wall-looks.css.
|
|
8
|
+
*
|
|
9
|
+
* - No WebGL: every look moves by CSS, so the Lookbook's video export steps it frame by frame and it loops without a
|
|
10
|
+
* seam (a WebGL runtime keeps its own clock, which the export can't hold). The costly ones (chrome's liquid filter,
|
|
11
|
+
* the point cloud's thousand dots, puff's lit layers) are marked `data-anim="heavy"`, and the Lookbook runs only two
|
|
12
|
+
* of those at a time (one on a small or low-power screen); the rest show their still until one leaves the screen.
|
|
13
|
+
* - Where a look's picture is expensive (noise, lighting, blur), it's drawn once into its own `<svg>` and only shown,
|
|
14
|
+
* hidden or moved as a whole (opacity and transform, which the compositor does without repainting it).
|
|
15
|
+
*/
|
|
16
|
+
import { type LookCtx, type LookOut } from './kit.js';
|
|
17
|
+
/** diffusion: like an image model at work, the mark emerges from coloured noise in visible denoising steps (a blurred,
|
|
18
|
+
* warped blob, then sharper, then crisp), holds, and dissolves back into noise. Each step is its own `<svg>` with its
|
|
19
|
+
* filter drawn once; the steps are only faded in over each other. */
|
|
20
|
+
declare function diffusion(c: LookCtx): LookOut;
|
|
21
|
+
/** chrome: the mark as liquid chrome reflecting a studio (no highlight spots: the shine is the studio, bent round its
|
|
22
|
+
* rounded edges). Live, a ripple runs down it in strips (fused into one liquid by a goo threshold), it sags and wobbles,
|
|
23
|
+
* then snaps back into shape. */
|
|
24
|
+
declare function chrome(c: LookCtx): LookOut;
|
|
25
|
+
/** puff: the mark as soft inflated vinyl on a pastel ground: it blows up from flat with a real bulge (lit height from a
|
|
26
|
+
* blurred outline), wobbles and settles, holds, and lets its air out. Each stage is its own lit `<svg>`, drawn once; the
|
|
27
|
+
* inflation is them fading over each other, the wobble a transform on their wrapper. */
|
|
28
|
+
declare function puff(c: LookCtx): LookOut;
|
|
29
|
+
/** datamosh: the mark as a video frame that breaks: macroblocks show it from the wrong place and drag (their motion
|
|
30
|
+
* vectors applied again and again), some smear into streaks, bands of the frame slip sideways, the colour channels part;
|
|
31
|
+
* then a clean keyframe snaps it whole, and a small aftershock. All stepped, as a codec would. */
|
|
32
|
+
declare function datamosh(c: LookCtx): LookOut;
|
|
33
|
+
/** holo: a premium trading card: the mark in holographic foil (a thin-film rainbow under fine diffraction lines) on a
|
|
34
|
+
* dark card with a thin frame, a serial number and a turning seal. Live, the foil sweeps; on the wall it also follows
|
|
35
|
+
* the pointer (`holoPointer` in ../live.js sets --hx and --hy on the card). */
|
|
36
|
+
declare function holo(c: LookCtx): LookOut;
|
|
37
|
+
/** eink: the mark on an e-paper screen, paper grey, a faint ghost of the last page under it. Live, it refreshes: black,
|
|
38
|
+
* the mark inverted, white, black again, then the mark paints in band by band, grey before black, the ghost stronger
|
|
39
|
+
* for a moment; a status line with a battery says "Refreshing…" meanwhile. */
|
|
40
|
+
declare function eink(c: LookCtx): LookOut;
|
|
41
|
+
/** The cloud's dots: the mark's cells, `n` across, one or two dots each, jittered, dealt into `groups` (each a path of
|
|
42
|
+
* round dots in relative moves, small in the page), and a sprinkling of stray dots round it. */
|
|
43
|
+
export declare function cloudArt(
|
|
44
|
+
paths: string,
|
|
45
|
+
seed: number,
|
|
46
|
+
n?: number,
|
|
47
|
+
groups?: number,
|
|
48
|
+
): {
|
|
49
|
+
svg: string;
|
|
50
|
+
count: number;
|
|
51
|
+
};
|
|
52
|
+
/** cloud: the mark as a point cloud: about a thousand dots swarm in from scattered, spinning clouds and lock into it,
|
|
53
|
+
* breathe, then scatter again. */
|
|
54
|
+
declare function cloud(c: LookCtx): LookOut;
|
|
55
|
+
/** The grid fill's grid: 16 squares across the 512 canvas with 32 units round it, the home page's hairlines, and the
|
|
56
|
+
* mark's cells (core's coverage and cells at the grid's own resolution, so each sits exactly in a square), each with
|
|
57
|
+
* the moment it fills: a scattered order or a diagonal sweep. */
|
|
58
|
+
export declare function gridArt(
|
|
59
|
+
paths: string,
|
|
60
|
+
seed: number,
|
|
61
|
+
): {
|
|
62
|
+
svg: string;
|
|
63
|
+
n: number;
|
|
64
|
+
};
|
|
65
|
+
/** gridfill: the home page's grid (its hairlines and border colour, on the site's ground), its squares filling in with
|
|
66
|
+
* solid ink one by one, scattered or in a diagonal sweep, until the mark stands in blocks; a hold, then they clear in the
|
|
67
|
+
* same order. The name under it in the site's face. Monochrome and Swiss, where the pixel mosaic is neon. */
|
|
68
|
+
declare function gridfill(c: LookCtx): LookOut;
|
|
69
|
+
/** The set's looks, by kind. */
|
|
70
|
+
export declare const MODERN: {
|
|
71
|
+
readonly diffusion: typeof diffusion;
|
|
72
|
+
readonly chrome: typeof chrome;
|
|
73
|
+
readonly puff: typeof puff;
|
|
74
|
+
readonly datamosh: typeof datamosh;
|
|
75
|
+
readonly holo: typeof holo;
|
|
76
|
+
readonly eink: typeof eink;
|
|
77
|
+
readonly cloud: typeof cloud;
|
|
78
|
+
readonly gridfill: typeof gridfill;
|
|
79
|
+
};
|
|
80
|
+
/** A modern look's kind. */
|
|
81
|
+
export type ModernKind = keyof typeof MODERN;
|
|
82
|
+
/**
|
|
83
|
+
* Redraws what a modern look built from the mark itself (the expanded view's "try another mark"); the `<use>` copies
|
|
84
|
+
* follow the mark's one copy on their own.
|
|
85
|
+
*
|
|
86
|
+
* @param el The card.
|
|
87
|
+
* @param paths The new mark's paths' markup.
|
|
88
|
+
*/
|
|
89
|
+
export declare function retargetModern(el: HTMLElement, paths: string): void;
|
|
90
|
+
export {};
|