bookcover-core 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/dist/assets.d.ts +0 -5
- package/dist/assets.d.ts.map +1 -1
- package/dist/assets.js +1 -7
- package/dist/assets.js.map +1 -1
- package/dist/build_files.d.ts +2 -1
- package/dist/build_files.d.ts.map +1 -1
- package/dist/build_files.js +2 -4
- package/dist/build_files.js.map +1 -1
- package/dist/colors.d.ts +8 -1
- package/dist/colors.d.ts.map +1 -1
- package/dist/colors.js +22 -8
- package/dist/colors.js.map +1 -1
- package/dist/data_file.d.ts +1 -1
- package/dist/data_file.d.ts.map +1 -1
- package/dist/data_file.js +7 -1
- package/dist/data_file.js.map +1 -1
- package/dist/design.d.ts +60 -0
- package/dist/design.d.ts.map +1 -1
- package/dist/design.js +291 -0
- package/dist/design.js.map +1 -1
- package/dist/form_schema.d.ts +20 -1
- package/dist/form_schema.d.ts.map +1 -1
- package/dist/form_schema.js +100 -8
- package/dist/form_schema.js.map +1 -1
- package/dist/form_state.d.ts +4 -2
- package/dist/form_state.d.ts.map +1 -1
- package/dist/form_state.js +3 -1
- package/dist/form_state.js.map +1 -1
- package/dist/generated/templates_data.d.ts +4 -0
- package/dist/generated/templates_data.d.ts.map +1 -0
- package/dist/generated/templates_data.js +8 -0
- package/dist/generated/templates_data.js.map +1 -0
- package/dist/generated/vector_bg_images_data.d.ts +4 -0
- package/dist/generated/vector_bg_images_data.d.ts.map +1 -0
- package/dist/generated/vector_bg_images_data.js +33 -0
- package/dist/generated/vector_bg_images_data.js.map +1 -0
- package/dist/generated/vector_patterns_data.d.ts +4 -0
- package/dist/generated/vector_patterns_data.d.ts.map +1 -0
- package/dist/generated/vector_patterns_data.js +33 -0
- package/dist/generated/vector_patterns_data.js.map +1 -0
- package/dist/index.d.ts +15 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -16
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +5 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +3 -1
- package/dist/schema.js.map +1 -1
- package/dist/templates_data.d.ts +4 -0
- package/dist/templates_data.d.ts.map +1 -0
- package/dist/templates_data.js +8 -0
- package/dist/templates_data.js.map +1 -0
- package/dist/vector_backgrounds.d.ts +11 -0
- package/dist/vector_backgrounds.d.ts.map +1 -0
- package/dist/vector_backgrounds.js +54 -0
- package/dist/vector_backgrounds.js.map +1 -0
- package/dist/vector_patterns_data.d.ts +4 -0
- package/dist/vector_patterns_data.d.ts.map +1 -0
- package/dist/vector_patterns_data.js +66 -0
- package/dist/vector_patterns_data.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,19 +3,25 @@ import { cover_schema } from './schema.js';
|
|
|
3
3
|
import { resolve_dimensions } from './dimensions.js';
|
|
4
4
|
import { default_spine_title } from './utils.js';
|
|
5
5
|
import { calculate_font_sizes } from './font_sizes.js';
|
|
6
|
-
import { resolve_colors, resolve_font_configs, darken_hsl, mix_hsl } from './design.js';
|
|
6
|
+
import { resolve_colors, resolve_font_configs, darken_hsl, mix_hsl, generate_palette } from './design.js';
|
|
7
7
|
import { build_cover_files } from './build_files.js';
|
|
8
|
+
import { DEFAULT_TEMPLATES } from './generated/templates_data.js';
|
|
8
9
|
import { resolve_icon } from './icon_cache.js';
|
|
9
10
|
import { find_pattern } from './patterns.js';
|
|
11
|
+
import { find_vector_background } from './vector_backgrounds.js';
|
|
10
12
|
import { resolve_fallback_chain, cjk_segments, cjk_family, font_style } from 'typst-fonts';
|
|
11
13
|
import { resolve_field_cjk_variant, collect_fallback_fonts } from './fonts.js';
|
|
12
14
|
import { escape_typst_str } from 'typst-utils';
|
|
13
15
|
export { default_spine_title } from './utils.js';
|
|
14
16
|
export { collect_fonts, collect_all_fonts, collect_fallback_fonts, all_fonts_bundled, resolve_cjk_variant, resolve_field_cjk_variant } from './fonts.js';
|
|
15
|
-
export { asset_path, FRAMES_DIR, BACKGROUNDS_DIR
|
|
17
|
+
export { asset_path, FRAMES_DIR, BACKGROUNDS_DIR } from './assets.js';
|
|
18
|
+
export { DEFAULT_TEMPLATES } from './generated/templates_data.js';
|
|
16
19
|
export { list_patterns, find_pattern } from './patterns.js';
|
|
20
|
+
export { list_vector_backgrounds, find_vector_background } from './vector_backgrounds.js';
|
|
21
|
+
export { generate_palette } from './design.js';
|
|
22
|
+
export { tinted_contrast_text, pick_vivid_tint, synthesize_fill, blend_regions, region_hex } from './design.js';
|
|
17
23
|
export { make_blank_form_values } from './form_state.js';
|
|
18
|
-
export { build_schema, curly_quotes, parse_font_family } from './form_schema.js';
|
|
24
|
+
export { build_schema, curly_quotes, parse_font_family, VECTOR_BG_AUTO_COLOR } from './form_schema.js';
|
|
19
25
|
export { derive_colors, hex_override_to_hsl, hex_to_hsl, is_dark_color } from './colors.js';
|
|
20
26
|
// Re-export lower-level functions needed by generator-node and generator-web
|
|
21
27
|
export { cover_schema, calculate_font_sizes, resolve_colors, darken_hsl };
|
|
@@ -59,8 +65,11 @@ function wrap_blurb_cjk(markup, han_variant, style, chain) {
|
|
|
59
65
|
*
|
|
60
66
|
* Returns the virtual filesystem (filename → bytes) and the resolved cover
|
|
61
67
|
* dimensions so callers can use them for splitting without a second lookup.
|
|
68
|
+
*
|
|
69
|
+
* templates defaults to the cover.typ/_helpers.typ baked into this package version
|
|
70
|
+
* (see generated/templates_data.ts) — pass an override only to test unreleased template changes.
|
|
62
71
|
*/
|
|
63
|
-
export async function build(
|
|
72
|
+
export async function build(schema, image, frame_fn, frame_data, templates = DEFAULT_TEMPLATES) {
|
|
64
73
|
// Resolve spine text — undefined means derive from titles/author; '' means explicitly empty
|
|
65
74
|
const schema_resolved = {
|
|
66
75
|
...schema,
|
|
@@ -105,27 +114,23 @@ export async function build(templates, schema, image, frame_fn, frame_data) {
|
|
|
105
114
|
let icon_ghost;
|
|
106
115
|
let icon_ghost2;
|
|
107
116
|
let icon_spine;
|
|
108
|
-
let icon_bg;
|
|
109
117
|
if (schema_resolved.icon_id) {
|
|
110
118
|
// Main icon: use explicit icon_color if set, otherwise 50% darker than front
|
|
111
|
-
// Ghost copies: faded toward background from main color; spine
|
|
112
|
-
const color_main = schema_resolved.icon_color ?? darken_hsl(colors.front_background, 0.
|
|
113
|
-
const color_ghost = mix_hsl(color_main, colors.front_background, 0.
|
|
114
|
-
const color_ghost2 = mix_hsl(color_main, colors.front_background, 0.
|
|
119
|
+
// Ghost copies: faded toward background from main color; spine: derived from spine bg
|
|
120
|
+
const color_main = schema_resolved.icon_color ?? darken_hsl(colors.front_background, 0.4);
|
|
121
|
+
const color_ghost = mix_hsl(color_main, colors.front_background, 0.75);
|
|
122
|
+
const color_ghost2 = mix_hsl(color_main, colors.front_background, 0.85);
|
|
115
123
|
const color_spine = darken_hsl(colors.spine_background ?? colors.front_background, 0.5);
|
|
116
|
-
const
|
|
117
|
-
const [svg_main, svg_ghost, svg_ghost2, svg_spine, svg_bg] = await Promise.all([
|
|
124
|
+
const [svg_main, svg_ghost, svg_ghost2, svg_spine] = await Promise.all([
|
|
118
125
|
resolve_icon(schema_resolved.icon_id, color_main),
|
|
119
126
|
resolve_icon(schema_resolved.icon_id, color_ghost),
|
|
120
127
|
resolve_icon(schema_resolved.icon_id, color_ghost2),
|
|
121
128
|
resolve_icon(schema_resolved.icon_id, color_spine),
|
|
122
|
-
resolve_icon(schema_resolved.icon_id, color_bg),
|
|
123
129
|
]);
|
|
124
130
|
icon_main = { data: encoder.encode(svg_main), ext: '.svg' };
|
|
125
131
|
icon_ghost = { data: encoder.encode(svg_ghost), ext: '.svg' };
|
|
126
132
|
icon_ghost2 = { data: encoder.encode(svg_ghost2), ext: '.svg' };
|
|
127
133
|
icon_spine = { data: encoder.encode(svg_spine), ext: '.svg' };
|
|
128
|
-
icon_bg = { data: encoder.encode(svg_bg), ext: '.svg' };
|
|
129
134
|
}
|
|
130
135
|
// Resolve and recolor pattern SVG when a pattern is specified
|
|
131
136
|
// schema.pattern can be a known pattern ID or a raw SVG string
|
|
@@ -145,8 +150,19 @@ export async function build(templates, schema, image, frame_fn, frame_data) {
|
|
|
145
150
|
const aspect_ratio = (svg_w > 0 && svg_h > 0) ? svg_w / svg_h : 1;
|
|
146
151
|
pattern_file = { data: encoder.encode(svg), ext: '.svg', aspect_ratio };
|
|
147
152
|
}
|
|
148
|
-
//
|
|
149
|
-
|
|
153
|
+
// Resolve a built-in vector background into SVG bytes when no photo was supplied — the
|
|
154
|
+
// palette is derived from the resolved front background color so it always tracks bg_color
|
|
155
|
+
let vector_image;
|
|
156
|
+
if (!image && schema_resolved.bg_vector_id) {
|
|
157
|
+
const design = find_vector_background(schema_resolved.bg_vector_id);
|
|
158
|
+
if (design) {
|
|
159
|
+
const palette = generate_palette(colors.front_background, design.color_count, design.scheme);
|
|
160
|
+
vector_image = { data: encoder.encode(design.render(palette)), ext: '.svg', is_vector: true };
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// Pre-process image with frame effect when bg_image_coverage is 'painted' and a frame_fn was
|
|
164
|
+
// injected — never applies to a generated vector background (canvas framing needs a photo)
|
|
165
|
+
let processed_image = image ?? vector_image;
|
|
150
166
|
if (image && schema_resolved.bg_image_coverage === 'painted' && frame_fn) {
|
|
151
167
|
const margin_mm = 15;
|
|
152
168
|
const painted_w = dims.cover_face_width.toNumber() - 2 * margin_mm;
|
|
@@ -164,7 +180,7 @@ export async function build(templates, schema, image, frame_fn, frame_data) {
|
|
|
164
180
|
...schema_resolved,
|
|
165
181
|
blurb: wrap_blurb_cjk(schema_resolved.blurb ?? '', resolve_field_cjk_variant(schema_resolved, schema_resolved.blurb ?? ''), font_style(configs.blurb.family, configs.blurb.style), font_blurb_family_arr),
|
|
166
182
|
};
|
|
167
|
-
const files = build_cover_files(templates, schema_files, dims, colors, font_body_family_arr, font_title1_family_arr, font_title2_family_arr, font_title3_family_arr, font_subtitle_family_arr, font_author_family_arr, font_blurb_family_arr, font_spine_title_family_arr, font_spine_author_family_arr, font_sizes, processed_image, icon_main, icon_ghost, icon_ghost2, icon_spine,
|
|
183
|
+
const files = build_cover_files(templates, schema_files, dims, colors, font_body_family_arr, font_title1_family_arr, font_title2_family_arr, font_title3_family_arr, font_subtitle_family_arr, font_author_family_arr, font_blurb_family_arr, font_spine_title_family_arr, font_spine_author_family_arr, font_sizes, processed_image, icon_main, icon_ghost, icon_ghost2, icon_spine, pattern_file);
|
|
168
184
|
return { files, dims };
|
|
169
185
|
}
|
|
170
186
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,2CAA2C;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAA;AACxC,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAGlD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAC,cAAc,EAAE,oBAAoB,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,2CAA2C;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAA;AACxC,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAGlD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAC,cAAc,EAAE,oBAAoB,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAA;AACvG,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAA;AA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AC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface FontConfig {
|
|
|
5
5
|
family: string;
|
|
6
6
|
style?: 'serif' | 'sans';
|
|
7
7
|
}
|
|
8
|
-
export type IconMode = 'center' | 'offset' | 'echo'
|
|
8
|
+
export type IconMode = 'center' | 'offset' | 'echo';
|
|
9
9
|
export interface CoverSchema {
|
|
10
10
|
title1: string;
|
|
11
11
|
title1_font?: FontConfig;
|
|
@@ -85,6 +85,7 @@ export interface CoverSchema {
|
|
|
85
85
|
custom_spine?: number;
|
|
86
86
|
margin_back?: number;
|
|
87
87
|
margin_front?: number;
|
|
88
|
+
home_print_margin?: boolean;
|
|
88
89
|
bg_image_coverage?: 'full' | 'front' | 'painted' | 'feature' | 'front_partial';
|
|
89
90
|
bg_color?: string;
|
|
90
91
|
bg_color_gradient?: boolean;
|
|
@@ -96,6 +97,7 @@ export interface CoverSchema {
|
|
|
96
97
|
pattern?: string;
|
|
97
98
|
pattern_tile_mm?: number;
|
|
98
99
|
pattern_color?: string;
|
|
100
|
+
bg_vector_id?: string;
|
|
99
101
|
spine_color?: string | null;
|
|
100
102
|
isbn: string;
|
|
101
103
|
cjk_variant?: CjkVariant | 'auto';
|
|
@@ -256,6 +258,7 @@ export declare const cover_schema: z.ZodObject<{
|
|
|
256
258
|
custom_spine: z.ZodOptional<z.ZodNumber>;
|
|
257
259
|
margin_back: z.ZodOptional<z.ZodNumber>;
|
|
258
260
|
margin_front: z.ZodOptional<z.ZodNumber>;
|
|
261
|
+
home_print_margin: z.ZodOptional<z.ZodBoolean>;
|
|
259
262
|
bg_image_coverage: z.ZodOptional<z.ZodEnum<{
|
|
260
263
|
feature: "feature";
|
|
261
264
|
front: "front";
|
|
@@ -267,7 +270,6 @@ export declare const cover_schema: z.ZodObject<{
|
|
|
267
270
|
bg_color_gradient: z.ZodOptional<z.ZodBoolean>;
|
|
268
271
|
icon_id: z.ZodOptional<z.ZodString>;
|
|
269
272
|
icon_mode: z.ZodOptional<z.ZodEnum<{
|
|
270
|
-
background: "background";
|
|
271
273
|
center: "center";
|
|
272
274
|
echo: "echo";
|
|
273
275
|
offset: "offset";
|
|
@@ -278,6 +280,7 @@ export declare const cover_schema: z.ZodObject<{
|
|
|
278
280
|
pattern: z.ZodOptional<z.ZodString>;
|
|
279
281
|
pattern_tile_mm: z.ZodOptional<z.ZodNumber>;
|
|
280
282
|
pattern_color: z.ZodOptional<z.ZodString>;
|
|
283
|
+
bg_vector_id: z.ZodOptional<z.ZodString>;
|
|
281
284
|
spine_color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
282
285
|
isbn: z.ZodDefault<z.ZodString>;
|
|
283
286
|
cjk_variant: z.ZodOptional<z.ZodEnum<{
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AACrB,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AAI3C,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEvD,MAAM,WAAW,UAAU;IAEvB,MAAM,EAAC,MAAM,CAAA;IAGb,KAAK,CAAC,EAAC,OAAO,GAAG,MAAM,CAAA;CAC1B;AAED,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AACrB,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AAI3C,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEvD,MAAM,WAAW,UAAU;IAEvB,MAAM,EAAC,MAAM,CAAA;IA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AAM,CAAA;IAWX,WAAW,CAAC,EAAC,UAAU,GAAG,MAAM,CAAA;CACnC;AAgBD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsHvB,CAAA"}
|
package/dist/schema.js
CHANGED
|
@@ -90,18 +90,20 @@ export const cover_schema = z.object({
|
|
|
90
90
|
custom_spine: z.number().nonnegative().optional(),
|
|
91
91
|
margin_back: z.number().nonnegative().max(50).optional(),
|
|
92
92
|
margin_front: z.number().nonnegative().max(50).optional(),
|
|
93
|
+
home_print_margin: z.boolean().optional(),
|
|
93
94
|
// Background
|
|
94
95
|
bg_image_coverage: z.enum(['full', 'front', 'painted', 'feature', 'front_partial']).optional(),
|
|
95
96
|
bg_color: hsl_color.optional(),
|
|
96
97
|
bg_color_gradient: z.boolean().optional(),
|
|
97
98
|
icon_id: z.string().optional(),
|
|
98
|
-
icon_mode: z.enum(['center', 'offset', 'echo'
|
|
99
|
+
icon_mode: z.enum(['center', 'offset', 'echo']).optional(),
|
|
99
100
|
icon_size: z.number().optional(),
|
|
100
101
|
icon_color: z.string().optional(),
|
|
101
102
|
icon_spine: z.boolean().optional(),
|
|
102
103
|
pattern: z.string().optional(),
|
|
103
104
|
pattern_tile_mm: z.number().positive().optional(),
|
|
104
105
|
pattern_color: z.string().optional(),
|
|
106
|
+
bg_vector_id: z.string().optional(),
|
|
105
107
|
spine_color: hsl_color.nullable().optional(),
|
|
106
108
|
// Other
|
|
107
109
|
isbn: z.string().default(''),
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"A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@@
|
|
|
1
|
+
// GENERATED by .bin/gen_typst_templates from generator/typst/*.typ — do not edit
|
|
2
|
+
// Edit the source .typ files instead, then rerun the generator build
|
|
3
|
+
/** The cover.typ / _helpers.typ templates baked in at this package version */
|
|
4
|
+
export const DEFAULT_TEMPLATES = {
|
|
5
|
+
cover: "\n// Book cover template — receives all variables from _data.typ\n#import \"_data.typ\": *\n\n// -- Page setup --\n#set page(\n width: total_width,\n height: total_height,\n margin: 0mm,\n)\n\n#set text(font: font_body_family)\n#set quote(block: true)\n#show quote: set pad(x: 3em)\n\n// ============================================================\n// Helper functions\n// ============================================================\n\n#import \"_helpers.typ\": *\n\n\n// ============================================================\n// Layer 1 — Background fills\n// ============================================================\n\n#place(\n top + left,\n rect(\n width: total_width,\n height: total_height,\n fill: if has_front_gradient {\n gradient.linear(\n (color_front_gradient_start, 0%),\n (color_front_bg, 30%),\n (color_front_bg, 45%),\n (color_front_gradient_end, 100%),\n angle: -40deg,\n )\n } else {\n color_front_bg\n },\n ),\n)\n\n\n#if has_pattern {\n let tiled = pattern(\n size: (pattern_tile_w, pattern_tile_h),\n image(\"pattern.svg\", width: pattern_tile_w, height: pattern_tile_h),\n )\n place(\n top + left,\n rect(width: total_width, height: total_height, fill: tiled),\n )\n}\n\n\n// ============================================================\n// Layer 2 — Background image\n// ============================================================\n\n#if has_image {\n if image_coverage == \"full\" {\n // Full spread: image covers entire canvas (back + spine + front)\n place(\n top + left,\n dx: 0mm,\n dy: 0mm,\n image(\n image_filename,\n width: total_width,\n height: total_height,\n fit: if image_is_vector { \"stretch\" } else { \"cover\" },\n ),\n )\n } else if image_coverage == \"painted\" {\n // Painted: image inset on front cover — 15mm margin horizontally and from bottom, 50% trim height\n let painted_w = face_width - 30mm\n let painted_h = face_height * 0.5 // sync: index.ts painted_h = face_height * 0.5\n place(\n top + left,\n dx: front_x + 15mm,\n dy: bleed + face_height * (1/3),\n image(\n image_filename,\n width: painted_w,\n height: painted_h,\n fit: \"stretch\", // Should be exact but just in case, ensures full frame visible\n ),\n )\n } else if image_coverage == \"feature\" {\n // Feature: same size and position as painted but with rounded corners via box clip\n let painted_w = face_width - 30mm\n let painted_h = face_height * 0.5\n place(\n top + left,\n dx: front_x + 15mm,\n dy: bleed + face_height * (1/3),\n box(\n width: painted_w,\n height: painted_h,\n radius: 6mm,\n clip: true,\n image(\n image_filename,\n width: painted_w,\n height: painted_h,\n fit: \"cover\",\n ),\n ),\n )\n } else if image_coverage == \"front_partial\" {\n // Lower 2/3: image covers the full front face width, bottom 2/3 of height, flush to the bottom trim edge\n let w = face_width\n let h = face_height * (2 / 3)\n place(\n top + left,\n dx: front_x,\n dy: bleed + face_height - h,\n image(\n image_filename,\n width: w,\n height: h,\n fit: \"cover\",\n ),\n )\n } else {\n // Front only: image covers the front panel including all bleed margins\n place(\n top + left,\n dx: front_x,\n dy: 0mm,\n image(\n image_filename,\n width: face_width + bleed,\n height: total_height,\n fit: if image_is_vector { \"stretch\" } else { \"cover\" },\n ),\n )\n }\n}\n\n\n// ============================================================\n// Layer 2b — Icon on front cover\n// ============================================================\n\n#if has_icon {\n let icon_size = calc.min(face_height * 0.4, face_width * 0.8)\n if icon_mode != \"center\" {\n icon_size = calc.min(face_height * 0.5, face_width * 0.8)\n }\n // Apply user-controlled size multiplier (1.0 = default)\n icon_size = icon_size * icon_size_mod\n let offset_icon_dx = front_x + (face_width - icon_size) + (icon_size * 0.15)\n let offset_icon_dy = bleed * -1 + (icon_size * 0.15)\n\n // Place ghost icons first (if any) so below main one\n if icon_mode == \"echo\" {\n place(\n bottom + left,\n dx: offset_icon_dx + icon_size * 0.1,\n dy: offset_icon_dy - icon_size * 0.15,\n image(\"icon_ghost.svg\", width: icon_size, height: icon_size),\n )\n place(\n bottom + left,\n dx: offset_icon_dx - icon_size * 0.1,\n dy: offset_icon_dy + icon_size * 0.1,\n image(\"icon_ghost2.svg\", width: icon_size, height: icon_size),\n )\n }\n\n if icon_mode == \"background\" {\n // Background — icon fills the full face width, centered vertically on the front panel\n place(\n top + left,\n dx: front_x,\n dy: bleed + (face_height - face_width) / 2,\n image(\"icon_bg.svg\", width: icon_size, height: icon_size),\n )\n } else if icon_mode == \"center\" {\n // Center — large icon centered horizontally, positioned in the lower/mid section\n place(\n bottom + left,\n dx: front_x + (face_width - icon_size) / 2,\n dy: (face_height * 0.2 + bleed) * -1,\n image(\"icon_main.svg\", width: icon_size, height: icon_size),\n )\n } else {\n // Offset/echo: large icon offset towards bottom-right, slightly overflowing the trim edge\n place(\n bottom + left,\n dx: offset_icon_dx,\n dy: offset_icon_dy,\n image(\"icon_main.svg\", width: icon_size, height: icon_size),\n )\n }\n}\n\n\n// ============================================================\n// Layer 2c — Spine background\n// ============================================================\n\n// Spine background (only when spread has a spine) — drawn after pattern so it covers it\n#if has_spine and color_spine_bg != none {\n place(\n top + left,\n dx: spine_x,\n dy: 0mm,\n rect(width: spine_width, height: total_height, fill: color_spine_bg),\n )\n}\n\n\n// ============================================================\n// Layer 3 — Back panel content\n// ============================================================\n\n// back_margin, back_content_w imported from _data.typ\n\n// Blurb container box with background color and 1cm padding around the text\n// Content is scaled down if it would overflow the available back-panel height\n#if has_blurb {\n let blurb_content = {\n set par(justify: true) if blurb_justify\n set par(leading: 1em * blurb_spacing)\n // Compact heading styles for a small blurb box — size and leading are hardcoded\n // independent of blurb_spacing, since headings rarely wrap and need tight leading\n show heading.where(level: 1): it => {\n set block(above: 2em, below: 1em)\n set text(size: 1.3em)\n set par(leading: 0.5em)\n it\n }\n show heading.where(level: 2): it => {\n set block(above: 2em, below: 1em)\n set text(size: 1.15em)\n set par(leading: 0.5em)\n it\n }\n align(blurb_alignment, text(\n font: font_blurb_family,\n size: fs_back_blurb * blurb_size,\n fill: color_blurb,\n blurb,\n ))\n }\n let blurb_max_h = back_content_h - blurb_padding * 2\n place(\n top + left,\n dx: back_x + (face_width - blurb_width) / 2,\n dy: bleed + back_margin,\n rect(\n width: blurb_width,\n fill: color_blurb_bg,\n stroke: none,\n radius: 1.5mm,\n inset: blurb_padding,\n context {\n let avail_w = blurb_width - blurb_padding * 2\n let natural = measure(blurb_content, width: avail_w)\n if natural.height > blurb_max_h {\n let ratio = blurb_max_h / natural.height\n scale(x: ratio * 100%, y: ratio * 100%, reflow: true, blurb_content)\n } else {\n blurb_content\n }\n },\n ),\n )\n}\n\n// ISBN barcode — position and size from printing-services cover_region_barcode\n#if has_barcode {\n place(\n bottom + left,\n dx: barcode_x,\n dy: barcode_y * -1,\n image(\"barcode.svg\", width: barcode_w, height: barcode_h),\n )\n}\n\n// ============================================================\n// Layer 4 — Spine content\n// ============================================================\n\n#if has_spine and has_spine_text and fs_spine_title > 0mm {\n // Title rotated along spine (bottom-to-top reading direction).\n // place() anchors the unrotated bounding box top-left, so we subtract\n // half the unrotated dimensions to keep the visual center on the spine.\n place(\n top + left,\n dx: spine_x + spine_width * 0.5 - face_height * 0.4,\n dy: bleed + face_height * 0.5 - spine_width * 0.5,\n rotate(\n 90deg,\n origin: center,\n box(\n width: face_height * 0.8,\n height: spine_width,\n align(\n center + horizon,\n // Shrink title + author together as one unit if they overflow the spine length\n shrink-to-width(\n stack(\n dir: ltr,\n spacing: spine_width * 0.3,\n text(\n font: font_spine_title_family,\n size: fs_spine_title * spine_title_size_mod,\n fill: color_spine_title,\n weight: spine_title_weight,\n style: if spine_title_italic { \"italic\" } else { \"normal\" },\n spine_title,\n ),\n if has_author and fs_spine_author > 0mm {\n text(\n font: font_spine_author_family,\n size: fs_spine_author * spine_author_size_mod,\n fill: color_spine_author,\n weight: spine_author_weight,\n style: if spine_author_italic { \"italic\" } else { \"normal\" },\n spine_author,\n )\n },\n ),\n ),\n ),\n ),\n ),\n )\n}\n\n// Small icon at the bottom of the spine (when spine is wide enough for text)\n#if has_spine_icon {\n let spine_icon_size = spine_width * 0.7\n let spine_icon_side_margin = (spine_width - spine_icon_size) / 2\n // Bottom margin is twice the side margin\n let spine_icon_bottom_margin = spine_icon_side_margin * 2\n place(\n top + left,\n dx: spine_x + spine_icon_side_margin,\n dy: bleed + face_height - spine_icon_size - spine_icon_bottom_margin,\n image(\"icon_spine.svg\", width: spine_icon_size, height: spine_icon_size),\n )\n}\n\n// ============================================================\n// Layer 5 — Front panel content\n// ============================================================\n\n// front_margin, front_content_w imported from _data.typ\n\n// Base font size — proportional to trim height, multiplied by per-title size modifier\n#let fs_title_base = face_height * 0.05\n#let fs_subtitle = face_height * 0.025 * subtitle_size\n#let fs_author = face_height * 0.035 * author_size\n\n// Render a single title line with its per-title styling, shrunk to fit if too wide\n#let render_title(txt, font_family, size_mod, weight, is_italic, color) = {\n if txt != \"\" {\n box(\n width: front_content_w,\n shrink-to-width(\n align(title_alignment, text(\n font: font_family,\n size: fs_title_base * size_mod,\n fill: color,\n weight: weight,\n style: if is_italic { \"italic\" } else { \"normal\" },\n txt,\n )),\n ),\n )\n }\n}\n\n// Render each title line, then filter out empty ones so they don't create stack spacing gaps\n#let title_lines_rendered = stack(\n dir: ttb,\n spacing: face_height * title_spacing / 100,\n ..(\n render_title(title1, font_title1_family, title1_size, title1_weight, title1_italic, color_front_title1),\n render_title(title2, font_title2_family, title2_size, title2_weight, title2_italic, color_front_title2),\n render_title(title3, font_title3_family, title3_size, title3_weight, title3_italic, color_front_title3),\n ).filter(x => x != none),\n)\n\n// All subtitle lines in one container — shrink-to-width scales them all together uniformly\n// text() wraps shrink-to-width so inner content inherits the scaled size (no explicit size inside)\n#let subtitle_lines_rendered = text(\n font: font_subtitle_family,\n size: fs_subtitle,\n weight: subtitle_weight,\n style: if subtitle_italic { \"italic\" } else { \"normal\" },\n fill: color_front_subtitle,\n box(\n width: front_content_w,\n shrink-to-width(\n stack(\n dir: ttb,\n spacing: face_height * subtitle_spacing / 100,\n ..subtitle_lines.map(line => align(subtitle_alignment, line)),\n )\n ),\n ),\n)\n\n// Author styled text — single line, shrunk to fit width\n#let author_rendered = box(\n width: front_content_w,\n shrink-to-width(\n align(author_alignment, text(\n font: font_author_family,\n size: fs_author,\n fill: color_front_author,\n weight: author_weight,\n style: if author_italic { \"italic\" } else { \"normal\" },\n author,\n )),\n ),\n)\n\n// Title group: stacked title lines\n#let title_group = stack(\n dir: ttb,\n spacing: face_height * title_spacing / 100,\n title_lines_rendered,\n)\n\n// Check which elements belong to each position box\n#let top_has_title = title_position == \"top\"\n#let top_has_subtitle = has_subtitle and subtitle_position == \"top\"\n#let top_has_author = has_author and author_position == \"top\"\n#let top_has_any = top_has_title or top_has_subtitle or top_has_author\n\n#let mid_has_title = title_position == \"middle\"\n#let mid_has_subtitle = has_subtitle and subtitle_position == \"middle\"\n#let mid_has_author = has_author and author_position == \"middle\"\n#let mid_has_any = mid_has_title or mid_has_subtitle or mid_has_author\n\n#let bot_has_title = title_position == \"bottom\"\n#let bot_has_subtitle = has_subtitle and subtitle_position == \"bottom\"\n#let bot_has_author = has_author and author_position == \"bottom\"\n#let bot_has_any = bot_has_title or bot_has_subtitle or bot_has_author\n\n// Build a content group for a position box (order within box: title | subtitle | author)\n// Each element gets its own vertical margins inside the box\n#let make_pos_box(has_t, has_s, has_a) = box(\n width: front_content_w,\n stack(\n dir: ttb,\n if has_t { v(face_height * title_margin_top / 100) },\n if has_t { title_group },\n if has_t { v(face_height * title_margin_bottom / 100) },\n if has_s { v(face_height * subtitle_margin_top / 100) },\n if has_s { subtitle_lines_rendered },\n if has_s { v(face_height * subtitle_margin_bottom / 100) },\n if has_a { v(face_height * author_margin_top / 100) },\n if has_a { author_rendered },\n if has_a { v(face_height * author_margin_bottom / 100) },\n ),\n)\n\n// Place each non-empty position box on the front panel (within panel margin on all sides)\n#if top_has_any {\n place(\n top + left,\n dx: front_x + front_margin,\n dy: bleed + front_margin,\n make_pos_box(top_has_title, top_has_subtitle, top_has_author),\n )\n}\n#if mid_has_any {\n place(\n horizon + left,\n dx: front_x + front_margin,\n make_pos_box(mid_has_title, mid_has_subtitle, mid_has_author),\n )\n}\n#if bot_has_any {\n place(\n bottom + left,\n dx: front_x + front_margin,\n dy: (bleed + front_margin) * -1,\n make_pos_box(bot_has_title, bot_has_subtitle, bot_has_author),\n )\n}\n\n\n// ============================================================\n// Layer 6 — Home-print margin (white rounded borders for home inkjet printers)\n// ============================================================\n\n#if home_print {\n // Render the back and front as two separate rounded cards, each with a white\n // border, so a home printer that can't reach the paper edge still prints\n // cleanly. One white matte covers the spread with two rounded windows punched\n // out — one per trim face, each inset by `home_margin` on all sides with\n // `home_corner`-rounded corners. Windows track the trim faces (not a spine-\n // centre split), so the bleed and spine become white gutter and every side —\n // including the inner/gutter edge — gets a real margin. A single matte (vs.\n // two abutting ones) avoids a hairline seam down the gutter.\n let m = home_margin\n let win_w = face_width - 2 * m\n let win_h = face_height - 2 * m\n let win_y = bleed + m\n let back_win = (bleed + m, win_y, win_w, win_h)\n let front_win = (total_width - bleed - face_width + m, win_y, win_w, win_h)\n home-print-matte(total_width, total_height, (back_win, front_win), home_corner)\n}\n",
|
|
6
|
+
helpers: "\n// Shared helper functions for the cover template\n\n// Scale content so it fits within the container width using geometric scaling.\n// Uses scale() rather than text(size: ...) so inner explicit font sizes are also scaled.\n#let fit-to-width(max-text-size: auto, min-text-size: 2mm, it) = context {\n let effective-max = if max-text-size == auto { text.size * 3 } else { max-text-size }\n let effective-min = if min-text-size == auto { text.size * 0.33 } else { min-text-size }\n // Express size limits as dimensionless ratios relative to current text size\n let max-ratio = effective-max / text.size\n let min-ratio = effective-min / text.size\n let contentsize = measure(it)\n layout(size => {\n if contentsize.width > 0mm {\n let ratio = calc.min(size.width / contentsize.width, size.height / contentsize.height)\n let clamped = calc.max(calc.min(ratio, max-ratio), min-ratio)\n if clamped != 1.0 {\n scale(x: clamped * 100%, y: clamped * 100%, reflow: true, it)\n } else {\n it\n }\n }\n })\n}\n\n// Variant that only shrinks (never grows beyond current text size)\n#let shrink-to-width(min-text-size: auto, it) = context {\n fit-to-width(max-text-size: text.size, min-text-size: min-text-size, it)\n}\n\n// Curve segments tracing one rounded rectangle (absolute coords), for compositing\n// into a larger path. Corners use a cubic-bezier handle (0.5523r) to approximate arcs.\n#let rounded-subpath(x, y, w, h, r) = {\n let k = 0.5523 * r\n (\n curve.move((x + r, y), relative: false),\n curve.line((x + w - r, y), relative: false),\n curve.cubic((x + w - r + k, y), (x + w, y + r - k), (x + w, y + r), relative: false),\n curve.line((x + w, y + h - r), relative: false),\n curve.cubic((x + w, y + h - r + k), (x + w - r + k, y + h), (x + w - r, y + h), relative: false),\n curve.line((x + r, y + h), relative: false),\n curve.cubic((x + r - k, y + h), (x, y + h - r + k), (x, y + h - r), relative: false),\n curve.line((x, y + r), relative: false),\n curve.cubic((x, y + r - k), (x + r - k, y), (x + r, y), relative: false),\n curve.close(),\n )\n}\n\n// White \"matte\" covering the whole canvas (cw × ch) with rounded-rect windows\n// punched out via even-odd fill, so the artwork shows through each window as a\n// rounded card surrounded by a white border. Used for home-print margins on\n// edge-to-edge-incapable printers. `windows` is an array of (x, y, w, h) tuples.\n#let home-print-matte(cw, ch, windows, r) = {\n let segs = (\n curve.move((0mm, 0mm), relative: false),\n curve.line((cw, 0mm), relative: false),\n curve.line((cw, ch), relative: false),\n curve.line((0mm, ch), relative: false),\n curve.close(),\n )\n for win in windows {\n segs = segs + rounded-subpath(win.at(0), win.at(1), win.at(2), win.at(3), r)\n }\n place(top + left, curve(fill: white, fill-rule: \"even-odd\", ..segs))\n}\n",
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=templates_data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates_data.js","sourceRoot":"","sources":["../src/templates_data.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,qEAAqE;AAIrE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,iBAAiB,GAAa;IACvC,KAAK,EAAE,m5kBAAm5kB;IAC15kB,OAAO,EAAE,ygGAAygG;CACrhG,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PaletteScheme } from './design.js';
|
|
2
|
+
export interface VectorBackgroundDef {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
color_count: number;
|
|
6
|
+
scheme: PaletteScheme;
|
|
7
|
+
render(colors: string[]): string;
|
|
8
|
+
}
|
|
9
|
+
export declare function list_vector_backgrounds(): VectorBackgroundDef[];
|
|
10
|
+
export declare function find_vector_background(id: string): VectorBackgroundDef | undefined;
|
|
11
|
+
//# sourceMappingURL=vector_backgrounds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector_backgrounds.d.ts","sourceRoot":"","sources":["../src/vector_backgrounds.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AAG9C,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAC,MAAM,CAAA;IACT,IAAI,EAAC,MAAM,CAAA;IACX,WAAW,EAAC,MAAM,CAAA;IAClB,MAAM,EAAC,aAAa,CAAA;IAEpB,MAAM,CAAC,MAAM,EAAC,MAAM,EAAE,GAAE,MAAM,CAAA;CACjC;AA4CD,wBAAgB,uBAAuB,IAAG,mBAAmB,EAAE,CAE9D;AAED,wBAAgB,sBAAsB,CAAC,EAAE,EAAC,MAAM,GAAE,mBAAmB,GAAG,SAAS,CAEhF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Built-in procedural vector backgrounds — full-cover SVG designs recolored at generate time
|
|
2
|
+
// from a palette derived from the user's chosen background color (see design.ts's
|
|
3
|
+
// generate_palette, scheme 'accent_tones'). Source SVGs live in generator/vector_bg_images/ (open
|
|
4
|
+
// any one directly in an SVG editor — Inkscape, Illustrator, Figma — and edit freely; they use
|
|
5
|
+
// #6e79ac/#be89b3/#76538e as placeholder colors for c1/c2/c3, swapped for the real palette by
|
|
6
|
+
// recolor_svg() below) and are bundled into generated/vector_bg_images_data.ts by
|
|
7
|
+
// .bin/gen_vector_bg_images at build time, so no filesystem/network access is needed at generate
|
|
8
|
+
// time. Authored against a 1275x900 full-wrap viewBox (back cover 0-600, spine 600-675, front
|
|
9
|
+
// cover 675-1275); Typst stretches the result to the real trim size, so the exact ratio only
|
|
10
|
+
// needs to be roughly right.
|
|
11
|
+
import { VECTOR_BG_IMAGE_SVGS } from './generated/vector_bg_images_data.js';
|
|
12
|
+
// Placeholder colors used in the source SVGs (generator/vector_bg_images/*.svg) for c1/c2/c3
|
|
13
|
+
const PLACEHOLDER_COLORS = ['#6e79ac', '#be89b3', '#76538e'];
|
|
14
|
+
/** Swap each placeholder color for its resolved palette color. A plain case-insensitive text
|
|
15
|
+
* substitution rather than DOM parsing, so it still works if an SVG editor moves a color into
|
|
16
|
+
* a <style> block or CSS class instead of leaving it as an inline fill/stroke attribute. */
|
|
17
|
+
function recolor_svg(svg, colors) {
|
|
18
|
+
let out = svg;
|
|
19
|
+
for (let i = 0; i < PLACEHOLDER_COLORS.length && i < colors.length; i++) {
|
|
20
|
+
// Negative lookahead guards against an editor re-exporting with an 8-digit alpha hex
|
|
21
|
+
// (e.g. #ff0000aa), which would otherwise partial-match on the 6-digit placeholder
|
|
22
|
+
out = out.replace(new RegExp(`${PLACEHOLDER_COLORS[i]}(?![0-9a-f])`, 'gi'), colors[i]);
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
/** Build a render() for a VectorBackgroundDef that recolors the given design's source SVG */
|
|
27
|
+
function render_bg_image(id) {
|
|
28
|
+
return colors => recolor_svg(VECTOR_BG_IMAGE_SVGS[id], colors);
|
|
29
|
+
}
|
|
30
|
+
// All current designs share these — per-entry overrides can be reintroduced if a future
|
|
31
|
+
// design needs a different color count or hue scheme
|
|
32
|
+
const DEFAULT_COLOR_COUNT = 3;
|
|
33
|
+
const DEFAULT_SCHEME = 'accent_tones';
|
|
34
|
+
/** Turn a design id ('big-leaf-cluster') into a display name ('Big Leaf Cluster') */
|
|
35
|
+
function humanize(id) {
|
|
36
|
+
return id.split('-').map(word => word[0].toUpperCase() + word.slice(1)).join(' ');
|
|
37
|
+
}
|
|
38
|
+
// Derived from the bundled SVGs (generator/vector_bg_images/*.svg via
|
|
39
|
+
// generated/vector_bg_images_data.ts) — adding a design is just dropping a new source SVG in,
|
|
40
|
+
// no list entry needed here
|
|
41
|
+
const VECTOR_BACKGROUNDS = Object.keys(VECTOR_BG_IMAGE_SVGS).sort().map(id => ({
|
|
42
|
+
id,
|
|
43
|
+
name: humanize(id),
|
|
44
|
+
color_count: DEFAULT_COLOR_COUNT,
|
|
45
|
+
scheme: DEFAULT_SCHEME,
|
|
46
|
+
render: render_bg_image(id),
|
|
47
|
+
}));
|
|
48
|
+
export function list_vector_backgrounds() {
|
|
49
|
+
return VECTOR_BACKGROUNDS.map(v => ({ ...v }));
|
|
50
|
+
}
|
|
51
|
+
export function find_vector_background(id) {
|
|
52
|
+
return VECTOR_BACKGROUNDS.find(v => v.id === id);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=vector_backgrounds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector_backgrounds.js","sourceRoot":"","sources":["../src/vector_backgrounds.ts"],"names":[],"mappings":"AACA,6FAA6F;AAC7F,kFAAkF;AAClF,kGAAkG;AAClG,+FAA+F;AAC/F,8FAA8F;AAC9F,kFAAkF;AAClF,iGAAiG;AACjG,8FAA8F;AAC9F,6FAA6F;AAC7F,6BAA6B;AAG7B,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAA;AAWzE,6FAA6F;AAC7F,MAAM,kBAAkB,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;AAE5D;;6FAE6F;AAC7F,SAAS,WAAW,CAAC,GAAU,EAAE,MAAe;IAC5C,IAAI,GAAG,GAAG,GAAG,CAAA;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,kBAAkB,CAAC,MAAM,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtE,qFAAqF;QACrF,mFAAmF;QACnF,GAAG,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,MAAM,UAAU,sBAAsB,CAAC,EAAS;IAC5C,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Raw SVG text for each vector background pattern, keyed by id, with placeholder colors
|
|
2
|
+
* (#6e79ac/#be89b3/#76538e) swapped for a real palette by recolor_svg() in vector_backgrounds.ts */
|
|
3
|
+
export declare const VECTOR_PATTERN_SVGS: Record<string, string>;
|
|
4
|
+
//# sourceMappingURL=vector_patterns_data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector_patterns_data.d.ts","sourceRoot":"","sources":["../src/vector_patterns_data.ts"],"names":[],"mappings":"AAGA;qGACqG;AACrG,eAAO,MAAM,mBAAmB,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CA4DrD,CAAA"}
|