@dloizides/poster-render 0.4.0 → 0.6.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 +19 -0
- package/README.md +15 -0
- package/dist/index.d.mts +111 -28
- package/dist/index.d.ts +111 -28
- package/dist/index.js +623 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +618 -102
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
- FLIER-2 "Flier Studio follow-ups" D30 (sample parity, gap table `apps/flier-studio/docs/design/FLIER-2-sample-parity/gap.md`), all optional:
|
|
6
|
+
- `tuning.headerTop` (title top, px at a 1080 short edge), `tuning.titleScriptGap` / `tuning.scriptTitleGap` (separate gaps between the header lines), `tuning.titleScale` / `tuning.titleBottomScale`.
|
|
7
|
+
- `rows.icons` (`RowIcon` person / people / ticket per schedule and price row, optional `size`): a filled disc with a white line icon; a short list repeats its last icon.
|
|
8
|
+
- `rows.dividers` (`thickness`, `color`, `gap`, `toPicture`, `reach`): a rule above the venue and below every row but the last; `toPicture` runs each rule to the picture edge, drawn under the picture.
|
|
9
|
+
- `picture.overlap` (`scale` 1-1.5, `dx`, `dy`): the picture grows and shifts over the rows, stays on the canvas, and text is drawn over it.
|
|
10
|
+
- `BackgroundStyle.Brush`: deterministic dry-brush strokes beside the picture in `palette.brush`.
|
|
11
|
+
- `PaletteId.KizombaSample` (measured: page #fefefe, title #6d645d, ink #45372f, accent #ad8164, script #e5bb97, icon #cca383, rule #d5bca8, brush) and `FontSetId.KizombaSample` (Anton / Sacramento / Barlow Semi Condensed). Optional palette fields `script`, `icon`, `rule`, `brush`.
|
|
12
|
+
- `RenderReport.ruleBoxes`. Docs without the new fields render pixel-identical to 0.5.0 (45 sha256 snapshots unchanged).
|
|
13
|
+
|
|
14
|
+
## 0.5.0
|
|
15
|
+
|
|
16
|
+
- FLIER-2 "Flier Studio follow-ups" AC-38/39/40 (D25, D26, D29): optional `FlierDoc.lineStyles`, a per-line override keyed by line path (`title`, `venue.1`, `schedule.0.time`, `items.2.date`, see `LINE_KEY_PATTERN`) with `font`, `sizeScale`, `color`, `weight`, `italic`, `letterSpacing` (em) and `align` (`LineAlign`).
|
|
17
|
+
- Optional `FlierDoc.lineTies` plus helpers `sameWidth(doc, a, b)` (drawn widths equal within 1px, grown to the wider, inside the margins) and `sameSize(doc, a, b)` (one font size). Ties are resolved at layout time, so a theme or font switch keeps them.
|
|
18
|
+
- `validateFlierDoc` checks both (own keys only, so `__proto__` is rejected); the validator now supports `pattern`, `propertyNames`, schema-valued `additionalProperties` and `boolean`.
|
|
19
|
+
- `PosterContext.letterSpacing` is optional; it is only set when a line has letter spacing.
|
|
20
|
+
- Docs without `lineStyles`/`lineTies` render pixel-identical to 0.4.0 (sha256 of every layout x format pinned in a snapshot).
|
|
21
|
+
|
|
3
22
|
## 0.4.0
|
|
4
23
|
|
|
5
24
|
- FLIER-2 "Flier Studio follow-ups" D6 polish: optional `FlierDoc.tuning` with `headerGap` (closes the empty band between a stacked header and the body) and `itemDateScale` (list date script size). Docs without `tuning` render pixel-identical to 0.3.0.
|
package/README.md
CHANGED
|
@@ -48,6 +48,21 @@ The font sets name CSS families (`FONT_SETS`). The host loads them before `rende
|
|
|
48
48
|
|
|
49
49
|
Every text run is at least 30px at a 1080 short edge (40px on desktop 2560x1440). When a layout cannot fit its text at the floor, the picture gives space to the text.
|
|
50
50
|
|
|
51
|
+
## Per-line style and ties
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { LineAlign, sameSize, sameWidth } from '@dloizides/poster-render';
|
|
55
|
+
|
|
56
|
+
let doc = { ...base, lineStyles: { footer: { font: 'Georgia', sizeScale: 1.2, color: '#1f2a44', weight: 600, italic: true, letterSpacing: 0.05, align: LineAlign.Center } } };
|
|
57
|
+
doc = sameWidth(doc, 'title', 'titleBottom');
|
|
58
|
+
doc = sameSize(doc, 'venue.1', 'footer');
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- Keys: `title`, `titleBottom`, `script`, `footer`, `includes.heading`, `includes.items.N`, `venue.N`, `schedule.N.label|time`, `prices.N.amount|label`, `items.N.date|price|schedule.M` (`LINE_KEY_PATTERN`).
|
|
62
|
+
- When rows are set on one line (compact), the merged row takes the style of `schedule.N.label` / `prices.N.amount`.
|
|
63
|
+
- A width tie grows the narrower line to the wider one, capped at the column; a size tie takes the larger size where both still fit. Ties act inside one text zone (header, body or a flank).
|
|
64
|
+
- A doc without `lineStyles` and `lineTies` renders exactly as before.
|
|
65
|
+
|
|
51
66
|
## Schema version policy
|
|
52
67
|
|
|
53
68
|
`FlierDoc.version` is `1`. A field added as optional keeps version 1; a removed, renamed or retyped field raises the version and `validateFlierDoc` rejects the other version with `version: must be 1 (got N)`. A package major release goes with a new doc version.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
declare enum BackgroundStyle {
|
|
2
2
|
Solid = "solid",
|
|
3
3
|
Tint = "tint",
|
|
4
|
-
Horizon = "horizon"
|
|
4
|
+
Horizon = "horizon",
|
|
5
|
+
Brush = "brush"
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
declare enum FontSetId {
|
|
8
9
|
Classic = "classic",
|
|
9
10
|
Modern = "modern",
|
|
10
11
|
Elegant = "elegant",
|
|
11
|
-
Coastal = "coastal"
|
|
12
|
+
Coastal = "coastal",
|
|
13
|
+
KizombaSample = "kizomba-sample"
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
declare enum FormatId {
|
|
@@ -36,7 +38,8 @@ declare enum PaletteId {
|
|
|
36
38
|
Night = "night",
|
|
37
39
|
Sea = "sea",
|
|
38
40
|
Rose = "rose",
|
|
39
|
-
GoldenHorizon = "golden-horizon"
|
|
41
|
+
GoldenHorizon = "golden-horizon",
|
|
42
|
+
KizombaSample = "kizomba-sample"
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
declare enum PictureAnchor {
|
|
@@ -45,11 +48,47 @@ declare enum PictureAnchor {
|
|
|
45
48
|
Bottom = "bottom"
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
declare enum LineAlign {
|
|
52
|
+
Left = "left",
|
|
53
|
+
Center = "center",
|
|
54
|
+
Right = "right"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare enum LineTieKind {
|
|
58
|
+
Width = "width",
|
|
59
|
+
Size = "size"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare enum RowIcon {
|
|
63
|
+
Person = "person",
|
|
64
|
+
People = "people",
|
|
65
|
+
Ticket = "ticket"
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface JsonSchema {
|
|
69
|
+
$schema?: string;
|
|
70
|
+
$id?: string;
|
|
71
|
+
title?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
type?: 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean';
|
|
74
|
+
properties?: Record<string, JsonSchema>;
|
|
75
|
+
required?: string[];
|
|
76
|
+
additionalProperties?: boolean | JsonSchema;
|
|
77
|
+
propertyNames?: JsonSchema;
|
|
78
|
+
enum?: readonly (string | number)[];
|
|
79
|
+
const?: string | number;
|
|
80
|
+
minLength?: number;
|
|
81
|
+
maxLength?: number;
|
|
82
|
+
pattern?: string;
|
|
83
|
+
minimum?: number;
|
|
84
|
+
maximum?: number;
|
|
85
|
+
items?: JsonSchema;
|
|
86
|
+
minItems?: number;
|
|
87
|
+
maxItems?: number;
|
|
51
88
|
}
|
|
52
|
-
|
|
89
|
+
|
|
90
|
+
/** Every text line a style or tie can name: block fields by path, list items by index. */
|
|
91
|
+
declare const LINE_KEY_PATTERN = "^(title|titleBottom|script|footer|includes[.]heading|includes[.]items[.][0-5]|venue[.][0-2]|schedule[.][0-5][.](label|time)|prices[.][0-3][.](amount|label)|items[.][0-7][.](date|price|schedule[.][0-5]))$";
|
|
53
92
|
|
|
54
93
|
interface ScheduleRow {
|
|
55
94
|
label: string;
|
|
@@ -82,6 +121,28 @@ interface PictureSlot {
|
|
|
82
121
|
imageId: string;
|
|
83
122
|
anchor: PictureAnchor;
|
|
84
123
|
scale: number;
|
|
124
|
+
overlap?: PictureOverlap;
|
|
125
|
+
}
|
|
126
|
+
/** Grows the picture by scale around its anchor and shifts it by dx, dy (canvas fractions); text is drawn over it. */
|
|
127
|
+
interface PictureOverlap {
|
|
128
|
+
scale: number;
|
|
129
|
+
dx: number;
|
|
130
|
+
dy: number;
|
|
131
|
+
}
|
|
132
|
+
/** Row icon discs and divider rules; a short icon list repeats its last icon; px at a 1080 short edge. */
|
|
133
|
+
interface RowTheme {
|
|
134
|
+
icons?: {
|
|
135
|
+
schedule?: RowIcon[];
|
|
136
|
+
prices?: RowIcon[];
|
|
137
|
+
size?: number;
|
|
138
|
+
};
|
|
139
|
+
dividers?: {
|
|
140
|
+
thickness: number;
|
|
141
|
+
color?: string;
|
|
142
|
+
gap?: number;
|
|
143
|
+
toPicture?: boolean;
|
|
144
|
+
reach?: number;
|
|
145
|
+
};
|
|
85
146
|
}
|
|
86
147
|
interface LogoSlot {
|
|
87
148
|
imageId: string;
|
|
@@ -98,11 +159,36 @@ interface FlierDoc {
|
|
|
98
159
|
blocks: FlierBlocks;
|
|
99
160
|
items?: ListItem[];
|
|
100
161
|
tuning?: PosterTuning;
|
|
162
|
+
lineStyles?: Record<LineKey, LineStyle | undefined>;
|
|
163
|
+
lineTies?: LineTie[];
|
|
164
|
+
rows?: RowTheme;
|
|
165
|
+
}
|
|
166
|
+
/** A text line path such as "title", "venue.1", "schedule.0.time" or "items.2.date" (see LINE_KEY_PATTERN). */
|
|
167
|
+
type LineKey = string;
|
|
168
|
+
/** Optional per-line overrides of the theme; an absent field keeps the theme value. letterSpacing is in em. */
|
|
169
|
+
interface LineStyle {
|
|
170
|
+
font?: string;
|
|
171
|
+
sizeScale?: number;
|
|
172
|
+
color?: string;
|
|
173
|
+
weight?: number;
|
|
174
|
+
italic?: boolean;
|
|
175
|
+
letterSpacing?: number;
|
|
176
|
+
align?: LineAlign;
|
|
177
|
+
}
|
|
178
|
+
/** Two lines drawn at one width (width) or one font size (size). */
|
|
179
|
+
interface LineTie {
|
|
180
|
+
kind: LineTieKind;
|
|
181
|
+
lines: [LineKey, LineKey];
|
|
101
182
|
}
|
|
102
183
|
/** Optional per-theme spacing and size overrides; an absent field keeps the layout default. */
|
|
103
184
|
interface PosterTuning {
|
|
104
185
|
headerGap?: number;
|
|
105
186
|
itemDateScale?: number;
|
|
187
|
+
headerTop?: number;
|
|
188
|
+
titleScriptGap?: number;
|
|
189
|
+
scriptTitleGap?: number;
|
|
190
|
+
titleScale?: number;
|
|
191
|
+
titleBottomScale?: number;
|
|
106
192
|
}
|
|
107
193
|
interface Rect {
|
|
108
194
|
x: number;
|
|
@@ -127,6 +213,7 @@ interface PosterContext {
|
|
|
127
213
|
textAlign: string;
|
|
128
214
|
textBaseline: string;
|
|
129
215
|
globalAlpha: number;
|
|
216
|
+
letterSpacing?: string;
|
|
130
217
|
save(): void;
|
|
131
218
|
restore(): void;
|
|
132
219
|
fillRect(x: number, y: number, w: number, h: number): void;
|
|
@@ -154,6 +241,7 @@ interface RenderReport {
|
|
|
154
241
|
textBoxes: Rect[];
|
|
155
242
|
cardBoxes: Rect[];
|
|
156
243
|
iconBoxes: Rect[];
|
|
244
|
+
ruleBoxes: Rect[];
|
|
157
245
|
logo: Rect | null;
|
|
158
246
|
backdrop: Rect | null;
|
|
159
247
|
}
|
|
@@ -167,6 +255,10 @@ interface Palette {
|
|
|
167
255
|
card: string;
|
|
168
256
|
arch: string;
|
|
169
257
|
sky?: readonly SkyStop[];
|
|
258
|
+
script?: string;
|
|
259
|
+
icon?: string;
|
|
260
|
+
rule?: string;
|
|
261
|
+
brush?: readonly string[];
|
|
170
262
|
}
|
|
171
263
|
/** One gradient stop of a horizon sky: offset 0 (top) to 1 (bottom) and its colour. */
|
|
172
264
|
type SkyStop = readonly [number, string];
|
|
@@ -176,30 +268,21 @@ interface FontSet {
|
|
|
176
268
|
body: string;
|
|
177
269
|
}
|
|
178
270
|
|
|
271
|
+
/** Returns a copy of the doc whose lines a and b draw at one width (within 1px), grown to the wider inside the margins. */
|
|
272
|
+
declare const sameWidth: (doc: FlierDoc, a: LineKey, b: LineKey) => FlierDoc;
|
|
273
|
+
/** Returns a copy of the doc whose lines a and b take one font size, the larger one where it fits. */
|
|
274
|
+
declare const sameSize: (doc: FlierDoc, a: LineKey, b: LineKey) => FlierDoc;
|
|
275
|
+
|
|
276
|
+
interface FormatSize {
|
|
277
|
+
width: number;
|
|
278
|
+
height: number;
|
|
279
|
+
}
|
|
280
|
+
declare const FORMAT_SIZES: Readonly<Record<FormatId, FormatSize>>;
|
|
281
|
+
|
|
179
282
|
declare const PALETTES: Readonly<Record<PaletteId, Palette>>;
|
|
180
283
|
|
|
181
284
|
declare const FONT_SETS: Readonly<Record<FontSetId, FontSet>>;
|
|
182
285
|
|
|
183
|
-
interface JsonSchema {
|
|
184
|
-
$schema?: string;
|
|
185
|
-
$id?: string;
|
|
186
|
-
title?: string;
|
|
187
|
-
description?: string;
|
|
188
|
-
type?: 'object' | 'array' | 'string' | 'number' | 'integer';
|
|
189
|
-
properties?: Record<string, JsonSchema>;
|
|
190
|
-
required?: string[];
|
|
191
|
-
additionalProperties?: boolean;
|
|
192
|
-
enum?: readonly (string | number)[];
|
|
193
|
-
const?: string | number;
|
|
194
|
-
minLength?: number;
|
|
195
|
-
maxLength?: number;
|
|
196
|
-
minimum?: number;
|
|
197
|
-
maximum?: number;
|
|
198
|
-
items?: JsonSchema;
|
|
199
|
-
minItems?: number;
|
|
200
|
-
maxItems?: number;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
286
|
declare const flierDocSchema: JsonSchema;
|
|
204
287
|
|
|
205
288
|
type FlierDocResult = {
|
|
@@ -239,4 +322,4 @@ declare function defaultLayoutFor(format: FormatId): LayoutId;
|
|
|
239
322
|
declare const kizombaWorkshop: FlierDoc;
|
|
240
323
|
declare const kizombaWorkshopDocs: FlierDoc[];
|
|
241
324
|
|
|
242
|
-
export { BackgroundStyle, type DataUrlCanvas, FONT_SETS, FORMAT_SIZES, type FlierBlocks, type FlierDoc, FlierDocError, type FlierDocResult, type FontSet, FontSetId, FormatId, type FormatSize, type IncludesBlock, type JsonSchema, LAYOUT_CATALOGUE, type LayoutCatalogueEntry, LayoutId, type ListItem, type LogoSlot, PALETTES, type Palette, PaletteId, PictureAnchor, type PictureSlot, type PosterAssets, type PosterCanvas, type PosterContext, type PosterGradient, type PosterImage, type PosterTuning, type PriceRow, type Rect, type RenderReport, type ScheduleRow, type SkyStop, type TextMetricsLike, defaultLayoutFor, exportPng, flierDocSchema, kizombaWorkshop, kizombaWorkshopDocs, render, validateFlierDoc };
|
|
325
|
+
export { BackgroundStyle, type DataUrlCanvas, FONT_SETS, FORMAT_SIZES, type FlierBlocks, type FlierDoc, FlierDocError, type FlierDocResult, type FontSet, FontSetId, FormatId, type FormatSize, type IncludesBlock, type JsonSchema, LAYOUT_CATALOGUE, LINE_KEY_PATTERN, type LayoutCatalogueEntry, LayoutId, LineAlign, type LineKey, type LineStyle, type LineTie, LineTieKind, type ListItem, type LogoSlot, PALETTES, type Palette, PaletteId, PictureAnchor, type PictureOverlap, type PictureSlot, type PosterAssets, type PosterCanvas, type PosterContext, type PosterGradient, type PosterImage, type PosterTuning, type PriceRow, type Rect, type RenderReport, RowIcon, type RowTheme, type ScheduleRow, type SkyStop, type TextMetricsLike, defaultLayoutFor, exportPng, flierDocSchema, kizombaWorkshop, kizombaWorkshopDocs, render, sameSize, sameWidth, validateFlierDoc };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
declare enum BackgroundStyle {
|
|
2
2
|
Solid = "solid",
|
|
3
3
|
Tint = "tint",
|
|
4
|
-
Horizon = "horizon"
|
|
4
|
+
Horizon = "horizon",
|
|
5
|
+
Brush = "brush"
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
declare enum FontSetId {
|
|
8
9
|
Classic = "classic",
|
|
9
10
|
Modern = "modern",
|
|
10
11
|
Elegant = "elegant",
|
|
11
|
-
Coastal = "coastal"
|
|
12
|
+
Coastal = "coastal",
|
|
13
|
+
KizombaSample = "kizomba-sample"
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
declare enum FormatId {
|
|
@@ -36,7 +38,8 @@ declare enum PaletteId {
|
|
|
36
38
|
Night = "night",
|
|
37
39
|
Sea = "sea",
|
|
38
40
|
Rose = "rose",
|
|
39
|
-
GoldenHorizon = "golden-horizon"
|
|
41
|
+
GoldenHorizon = "golden-horizon",
|
|
42
|
+
KizombaSample = "kizomba-sample"
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
declare enum PictureAnchor {
|
|
@@ -45,11 +48,47 @@ declare enum PictureAnchor {
|
|
|
45
48
|
Bottom = "bottom"
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
declare enum LineAlign {
|
|
52
|
+
Left = "left",
|
|
53
|
+
Center = "center",
|
|
54
|
+
Right = "right"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare enum LineTieKind {
|
|
58
|
+
Width = "width",
|
|
59
|
+
Size = "size"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare enum RowIcon {
|
|
63
|
+
Person = "person",
|
|
64
|
+
People = "people",
|
|
65
|
+
Ticket = "ticket"
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface JsonSchema {
|
|
69
|
+
$schema?: string;
|
|
70
|
+
$id?: string;
|
|
71
|
+
title?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
type?: 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean';
|
|
74
|
+
properties?: Record<string, JsonSchema>;
|
|
75
|
+
required?: string[];
|
|
76
|
+
additionalProperties?: boolean | JsonSchema;
|
|
77
|
+
propertyNames?: JsonSchema;
|
|
78
|
+
enum?: readonly (string | number)[];
|
|
79
|
+
const?: string | number;
|
|
80
|
+
minLength?: number;
|
|
81
|
+
maxLength?: number;
|
|
82
|
+
pattern?: string;
|
|
83
|
+
minimum?: number;
|
|
84
|
+
maximum?: number;
|
|
85
|
+
items?: JsonSchema;
|
|
86
|
+
minItems?: number;
|
|
87
|
+
maxItems?: number;
|
|
51
88
|
}
|
|
52
|
-
|
|
89
|
+
|
|
90
|
+
/** Every text line a style or tie can name: block fields by path, list items by index. */
|
|
91
|
+
declare const LINE_KEY_PATTERN = "^(title|titleBottom|script|footer|includes[.]heading|includes[.]items[.][0-5]|venue[.][0-2]|schedule[.][0-5][.](label|time)|prices[.][0-3][.](amount|label)|items[.][0-7][.](date|price|schedule[.][0-5]))$";
|
|
53
92
|
|
|
54
93
|
interface ScheduleRow {
|
|
55
94
|
label: string;
|
|
@@ -82,6 +121,28 @@ interface PictureSlot {
|
|
|
82
121
|
imageId: string;
|
|
83
122
|
anchor: PictureAnchor;
|
|
84
123
|
scale: number;
|
|
124
|
+
overlap?: PictureOverlap;
|
|
125
|
+
}
|
|
126
|
+
/** Grows the picture by scale around its anchor and shifts it by dx, dy (canvas fractions); text is drawn over it. */
|
|
127
|
+
interface PictureOverlap {
|
|
128
|
+
scale: number;
|
|
129
|
+
dx: number;
|
|
130
|
+
dy: number;
|
|
131
|
+
}
|
|
132
|
+
/** Row icon discs and divider rules; a short icon list repeats its last icon; px at a 1080 short edge. */
|
|
133
|
+
interface RowTheme {
|
|
134
|
+
icons?: {
|
|
135
|
+
schedule?: RowIcon[];
|
|
136
|
+
prices?: RowIcon[];
|
|
137
|
+
size?: number;
|
|
138
|
+
};
|
|
139
|
+
dividers?: {
|
|
140
|
+
thickness: number;
|
|
141
|
+
color?: string;
|
|
142
|
+
gap?: number;
|
|
143
|
+
toPicture?: boolean;
|
|
144
|
+
reach?: number;
|
|
145
|
+
};
|
|
85
146
|
}
|
|
86
147
|
interface LogoSlot {
|
|
87
148
|
imageId: string;
|
|
@@ -98,11 +159,36 @@ interface FlierDoc {
|
|
|
98
159
|
blocks: FlierBlocks;
|
|
99
160
|
items?: ListItem[];
|
|
100
161
|
tuning?: PosterTuning;
|
|
162
|
+
lineStyles?: Record<LineKey, LineStyle | undefined>;
|
|
163
|
+
lineTies?: LineTie[];
|
|
164
|
+
rows?: RowTheme;
|
|
165
|
+
}
|
|
166
|
+
/** A text line path such as "title", "venue.1", "schedule.0.time" or "items.2.date" (see LINE_KEY_PATTERN). */
|
|
167
|
+
type LineKey = string;
|
|
168
|
+
/** Optional per-line overrides of the theme; an absent field keeps the theme value. letterSpacing is in em. */
|
|
169
|
+
interface LineStyle {
|
|
170
|
+
font?: string;
|
|
171
|
+
sizeScale?: number;
|
|
172
|
+
color?: string;
|
|
173
|
+
weight?: number;
|
|
174
|
+
italic?: boolean;
|
|
175
|
+
letterSpacing?: number;
|
|
176
|
+
align?: LineAlign;
|
|
177
|
+
}
|
|
178
|
+
/** Two lines drawn at one width (width) or one font size (size). */
|
|
179
|
+
interface LineTie {
|
|
180
|
+
kind: LineTieKind;
|
|
181
|
+
lines: [LineKey, LineKey];
|
|
101
182
|
}
|
|
102
183
|
/** Optional per-theme spacing and size overrides; an absent field keeps the layout default. */
|
|
103
184
|
interface PosterTuning {
|
|
104
185
|
headerGap?: number;
|
|
105
186
|
itemDateScale?: number;
|
|
187
|
+
headerTop?: number;
|
|
188
|
+
titleScriptGap?: number;
|
|
189
|
+
scriptTitleGap?: number;
|
|
190
|
+
titleScale?: number;
|
|
191
|
+
titleBottomScale?: number;
|
|
106
192
|
}
|
|
107
193
|
interface Rect {
|
|
108
194
|
x: number;
|
|
@@ -127,6 +213,7 @@ interface PosterContext {
|
|
|
127
213
|
textAlign: string;
|
|
128
214
|
textBaseline: string;
|
|
129
215
|
globalAlpha: number;
|
|
216
|
+
letterSpacing?: string;
|
|
130
217
|
save(): void;
|
|
131
218
|
restore(): void;
|
|
132
219
|
fillRect(x: number, y: number, w: number, h: number): void;
|
|
@@ -154,6 +241,7 @@ interface RenderReport {
|
|
|
154
241
|
textBoxes: Rect[];
|
|
155
242
|
cardBoxes: Rect[];
|
|
156
243
|
iconBoxes: Rect[];
|
|
244
|
+
ruleBoxes: Rect[];
|
|
157
245
|
logo: Rect | null;
|
|
158
246
|
backdrop: Rect | null;
|
|
159
247
|
}
|
|
@@ -167,6 +255,10 @@ interface Palette {
|
|
|
167
255
|
card: string;
|
|
168
256
|
arch: string;
|
|
169
257
|
sky?: readonly SkyStop[];
|
|
258
|
+
script?: string;
|
|
259
|
+
icon?: string;
|
|
260
|
+
rule?: string;
|
|
261
|
+
brush?: readonly string[];
|
|
170
262
|
}
|
|
171
263
|
/** One gradient stop of a horizon sky: offset 0 (top) to 1 (bottom) and its colour. */
|
|
172
264
|
type SkyStop = readonly [number, string];
|
|
@@ -176,30 +268,21 @@ interface FontSet {
|
|
|
176
268
|
body: string;
|
|
177
269
|
}
|
|
178
270
|
|
|
271
|
+
/** Returns a copy of the doc whose lines a and b draw at one width (within 1px), grown to the wider inside the margins. */
|
|
272
|
+
declare const sameWidth: (doc: FlierDoc, a: LineKey, b: LineKey) => FlierDoc;
|
|
273
|
+
/** Returns a copy of the doc whose lines a and b take one font size, the larger one where it fits. */
|
|
274
|
+
declare const sameSize: (doc: FlierDoc, a: LineKey, b: LineKey) => FlierDoc;
|
|
275
|
+
|
|
276
|
+
interface FormatSize {
|
|
277
|
+
width: number;
|
|
278
|
+
height: number;
|
|
279
|
+
}
|
|
280
|
+
declare const FORMAT_SIZES: Readonly<Record<FormatId, FormatSize>>;
|
|
281
|
+
|
|
179
282
|
declare const PALETTES: Readonly<Record<PaletteId, Palette>>;
|
|
180
283
|
|
|
181
284
|
declare const FONT_SETS: Readonly<Record<FontSetId, FontSet>>;
|
|
182
285
|
|
|
183
|
-
interface JsonSchema {
|
|
184
|
-
$schema?: string;
|
|
185
|
-
$id?: string;
|
|
186
|
-
title?: string;
|
|
187
|
-
description?: string;
|
|
188
|
-
type?: 'object' | 'array' | 'string' | 'number' | 'integer';
|
|
189
|
-
properties?: Record<string, JsonSchema>;
|
|
190
|
-
required?: string[];
|
|
191
|
-
additionalProperties?: boolean;
|
|
192
|
-
enum?: readonly (string | number)[];
|
|
193
|
-
const?: string | number;
|
|
194
|
-
minLength?: number;
|
|
195
|
-
maxLength?: number;
|
|
196
|
-
minimum?: number;
|
|
197
|
-
maximum?: number;
|
|
198
|
-
items?: JsonSchema;
|
|
199
|
-
minItems?: number;
|
|
200
|
-
maxItems?: number;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
286
|
declare const flierDocSchema: JsonSchema;
|
|
204
287
|
|
|
205
288
|
type FlierDocResult = {
|
|
@@ -239,4 +322,4 @@ declare function defaultLayoutFor(format: FormatId): LayoutId;
|
|
|
239
322
|
declare const kizombaWorkshop: FlierDoc;
|
|
240
323
|
declare const kizombaWorkshopDocs: FlierDoc[];
|
|
241
324
|
|
|
242
|
-
export { BackgroundStyle, type DataUrlCanvas, FONT_SETS, FORMAT_SIZES, type FlierBlocks, type FlierDoc, FlierDocError, type FlierDocResult, type FontSet, FontSetId, FormatId, type FormatSize, type IncludesBlock, type JsonSchema, LAYOUT_CATALOGUE, type LayoutCatalogueEntry, LayoutId, type ListItem, type LogoSlot, PALETTES, type Palette, PaletteId, PictureAnchor, type PictureSlot, type PosterAssets, type PosterCanvas, type PosterContext, type PosterGradient, type PosterImage, type PosterTuning, type PriceRow, type Rect, type RenderReport, type ScheduleRow, type SkyStop, type TextMetricsLike, defaultLayoutFor, exportPng, flierDocSchema, kizombaWorkshop, kizombaWorkshopDocs, render, validateFlierDoc };
|
|
325
|
+
export { BackgroundStyle, type DataUrlCanvas, FONT_SETS, FORMAT_SIZES, type FlierBlocks, type FlierDoc, FlierDocError, type FlierDocResult, type FontSet, FontSetId, FormatId, type FormatSize, type IncludesBlock, type JsonSchema, LAYOUT_CATALOGUE, LINE_KEY_PATTERN, type LayoutCatalogueEntry, LayoutId, LineAlign, type LineKey, type LineStyle, type LineTie, LineTieKind, type ListItem, type LogoSlot, PALETTES, type Palette, PaletteId, PictureAnchor, type PictureOverlap, type PictureSlot, type PosterAssets, type PosterCanvas, type PosterContext, type PosterGradient, type PosterImage, type PosterTuning, type PriceRow, type Rect, type RenderReport, RowIcon, type RowTheme, type ScheduleRow, type SkyStop, type TextMetricsLike, defaultLayoutFor, exportPng, flierDocSchema, kizombaWorkshop, kizombaWorkshopDocs, render, sameSize, sameWidth, validateFlierDoc };
|