bookcover-core 0.5.0 → 0.7.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/builtin_bg_regions.d.ts +15 -0
- package/dist/builtin_bg_regions.d.ts.map +1 -0
- package/dist/builtin_bg_regions.js +73 -0
- package/dist/builtin_bg_regions.js.map +1 -0
- 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 +2 -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 +99 -8
- package/dist/form_schema.js.map +1 -1
- package/dist/form_state.d.ts +3 -2
- package/dist/form_state.d.ts.map +1 -1
- package/dist/form_state.js +2 -1
- package/dist/form_state.js.map +1 -1
- package/dist/generated/builtin_bg_regions.d.ts +15 -0
- package/dist/generated/builtin_bg_regions.d.ts.map +1 -0
- package/dist/generated/builtin_bg_regions.js +73 -0
- package/dist/generated/builtin_bg_regions.js.map +1 -0
- 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/image_regions.d.ts +29 -0
- package/dist/image_regions.d.ts.map +1 -0
- package/dist/image_regions.js +135 -0
- package/dist/image_regions.js.map +1 -0
- package/dist/index.d.ts +16 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -16
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +3 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +2 -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
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// Derives ImageRegions (dominant colors per cover region) from a decoded image's raw RGBA
|
|
2
|
+
// pixel data. Decoding the source image into that pixel buffer stays platform-specific (canvas
|
|
3
|
+
// getImageData in a browser, an image library elsewhere) and is the caller's job — this module
|
|
4
|
+
// is pure and does no I/O.
|
|
5
|
+
import { BUILTIN_BG_REGIONS } from './generated/builtin_bg_regions.js';
|
|
6
|
+
// Pixels this transparent or more are excluded from a region's averages
|
|
7
|
+
const ALPHA_THRESHOLD = 128;
|
|
8
|
+
// Fraction of a panel's height sampled for its top/bottom text regions — title text tends to
|
|
9
|
+
// sit within the top third, author/blurb-adjacent text within the bottom quarter, so these
|
|
10
|
+
// intentionally don't split the panel 50/50
|
|
11
|
+
const TOP_FRACTION = 1 / 3;
|
|
12
|
+
const BOTTOM_FRACTION = 1 / 4;
|
|
13
|
+
// Convert one pixel's 0-255 RGB to {h: 0-360, s: 0-1, l: 0-1}
|
|
14
|
+
function rgb_to_hsl(r, g, b) {
|
|
15
|
+
r /= 255;
|
|
16
|
+
g /= 255;
|
|
17
|
+
b /= 255;
|
|
18
|
+
const max = Math.max(r, g, b);
|
|
19
|
+
const min = Math.min(r, g, b);
|
|
20
|
+
const l = (max + min) / 2;
|
|
21
|
+
if (max === min)
|
|
22
|
+
return { h: 0, s: 0, l };
|
|
23
|
+
const d = max - min;
|
|
24
|
+
const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
25
|
+
let h;
|
|
26
|
+
if (max === r)
|
|
27
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
28
|
+
else if (max === g)
|
|
29
|
+
h = (b - r) / d + 2;
|
|
30
|
+
else
|
|
31
|
+
h = (r - g) / d + 4;
|
|
32
|
+
return { h: h * 60, s, l };
|
|
33
|
+
}
|
|
34
|
+
/** Average a rectangle of pixel data into a RegionStats — saturation-weighted circular mean
|
|
35
|
+
* for hue (biases toward colorful pixels over a muddy gray average), plain mean for
|
|
36
|
+
* saturation/lightness, plus the lightness standard deviation (lightness_spread) — a region
|
|
37
|
+
* containing both light and dark areas (e.g. text crossing a horizon) isn't well represented
|
|
38
|
+
* by its average alone, so callers use this to demand more contrast in those regions.
|
|
39
|
+
* Coordinates are clamped to the image bounds. */
|
|
40
|
+
export function analyze_rect(data, img_w, img_h, rect) {
|
|
41
|
+
const x0 = Math.max(0, Math.round(rect.x));
|
|
42
|
+
const y0 = Math.max(0, Math.round(rect.y));
|
|
43
|
+
const x1 = Math.min(img_w, Math.round(rect.x + rect.w));
|
|
44
|
+
const y1 = Math.min(img_h, Math.round(rect.y + rect.h));
|
|
45
|
+
let sum_x = 0;
|
|
46
|
+
let sum_y = 0;
|
|
47
|
+
let sum_s = 0;
|
|
48
|
+
let sum_l = 0;
|
|
49
|
+
let sum_l2 = 0;
|
|
50
|
+
let count = 0;
|
|
51
|
+
for (let y = y0; y < y1; y++) {
|
|
52
|
+
for (let x = x0; x < x1; x++) {
|
|
53
|
+
const i = (y * img_w + x) * 4;
|
|
54
|
+
if (data[i + 3] < ALPHA_THRESHOLD)
|
|
55
|
+
continue;
|
|
56
|
+
const { h, s, l } = rgb_to_hsl(data[i], data[i + 1], data[i + 2]);
|
|
57
|
+
const rad = h * Math.PI / 180;
|
|
58
|
+
sum_x += Math.cos(rad) * s;
|
|
59
|
+
sum_y += Math.sin(rad) * s;
|
|
60
|
+
sum_s += s;
|
|
61
|
+
sum_l += l;
|
|
62
|
+
sum_l2 += l * l;
|
|
63
|
+
count++;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (count === 0)
|
|
67
|
+
return { hue: 0, saturation: 0, lightness: 0.5, lightness_spread: 0 };
|
|
68
|
+
const hue = (Math.atan2(sum_y, sum_x) * 180 / Math.PI + 360) % 360;
|
|
69
|
+
const mean_l = sum_l / count;
|
|
70
|
+
const variance = Math.max(0, sum_l2 / count - mean_l * mean_l);
|
|
71
|
+
return {
|
|
72
|
+
hue: (sum_x === 0 && sum_y === 0) ? 0 : hue,
|
|
73
|
+
saturation: sum_s / count,
|
|
74
|
+
lightness: mean_l,
|
|
75
|
+
lightness_spread: Math.sqrt(variance),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// Scale a mm-based panel Region onto the analyzed pixel buffer, assuming the raw image maps
|
|
79
|
+
// proportionally onto the full-wrap canvas (cover_total_width x cover_total_height)
|
|
80
|
+
function region_to_px(region, total_w_mm, total_h_mm, img_w, img_h) {
|
|
81
|
+
const scale_x = img_w / total_w_mm;
|
|
82
|
+
const scale_y = img_h / total_h_mm;
|
|
83
|
+
return {
|
|
84
|
+
x: region.x.toNumber() * scale_x,
|
|
85
|
+
y: region.y.toNumber() * scale_y,
|
|
86
|
+
w: region.w.toNumber() * scale_x,
|
|
87
|
+
h: region.h.toNumber() * scale_y,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// Sample a mm-based panel Region (already scaled to px) into its top/bottom text regions — the
|
|
91
|
+
// top TOP_FRACTION and bottom BOTTOM_FRACTION of its height, not a 50/50 split
|
|
92
|
+
function split_top_bottom(data, img_w, img_h, rect) {
|
|
93
|
+
return {
|
|
94
|
+
top: analyze_rect(data, img_w, img_h, { x: rect.x, y: rect.y, w: rect.w, h: rect.h * TOP_FRACTION }),
|
|
95
|
+
bottom: analyze_rect(data, img_w, img_h, { x: rect.x, y: rect.y + rect.h * (1 - BOTTOM_FRACTION), w: rect.w, h: rect.h * BOTTOM_FRACTION }),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Sample a background image's dominant colors from its decoded RGBA pixel data, under both
|
|
100
|
+
* interpretations at once. `dims`, when provided, locates the front/back panels and spine strip
|
|
101
|
+
* within the image under a full-wrap interpretation (used when bg_image_coverage is 'full');
|
|
102
|
+
* pass null to skip that (front_top_full/front_bottom_full/back/spine all come back null).
|
|
103
|
+
*/
|
|
104
|
+
export function analyze_pixel_regions(data, width, height, dims) {
|
|
105
|
+
// Whole-image interpretation — correct whenever the image is confined to the front panel
|
|
106
|
+
const front_top = analyze_rect(data, width, height, { x: 0, y: 0, w: width, h: height * TOP_FRACTION });
|
|
107
|
+
const front_bottom = analyze_rect(data, width, height, { x: 0, y: height * (1 - BOTTOM_FRACTION), w: width, h: height * BOTTOM_FRACTION });
|
|
108
|
+
// Full-wrap interpretation — only the front panel's own portion of the image, not the
|
|
109
|
+
// back/spine content alongside it
|
|
110
|
+
let front_top_full = null;
|
|
111
|
+
let front_bottom_full = null;
|
|
112
|
+
let back = null;
|
|
113
|
+
let spine = null;
|
|
114
|
+
if (dims) {
|
|
115
|
+
const total_w = dims.cover_total_width.toNumber();
|
|
116
|
+
const total_h = dims.cover_total_height.toNumber();
|
|
117
|
+
const to_px = (region) => region_to_px(region, total_w, total_h, width, height);
|
|
118
|
+
const front_split = split_top_bottom(data, width, height, to_px(dims.cover_region_front));
|
|
119
|
+
front_top_full = front_split.top;
|
|
120
|
+
front_bottom_full = front_split.bottom;
|
|
121
|
+
back = analyze_rect(data, width, height, to_px(dims.cover_region_back));
|
|
122
|
+
spine = analyze_rect(data, width, height, to_px(dims.cover_region_spine));
|
|
123
|
+
}
|
|
124
|
+
return { front_top, front_bottom, front_top_full, front_bottom_full, back, spine };
|
|
125
|
+
}
|
|
126
|
+
/** Look up precomputed ImageRegions for a builtin background image (assets/backgrounds/<filename>)
|
|
127
|
+
* — see builtin_bg_regions.ts for how/why these are baked in. `byte_length` is checked against
|
|
128
|
+
* the source file's known size so a same-named non-builtin upload doesn't collide with an
|
|
129
|
+
* entry. Returns null for anything not in the table, in which case callers should fall back to
|
|
130
|
+
* analyze_pixel_regions() against the actual decoded image. */
|
|
131
|
+
export function get_builtin_bg_regions(filename, byte_length) {
|
|
132
|
+
const entry = BUILTIN_BG_REGIONS[filename];
|
|
133
|
+
return (entry && entry.size === byte_length) ? entry.regions : null;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=image_regions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image_regions.js","sourceRoot":"","sources":["../src/image_regions.ts"],"names":[],"mappings":"AACA,0FAA0F;AAC1F,+FAA+F;AAC/F,+FAA+F;AAC/F,2BAA2B;AAM3B,OAAO,EAAC,kBAAkB,EAAC,MAAM,mCAAmC,CAAA;AAEpE,wEAAwE;AACxE,MAAM,eAAe,GAAG,GAAG,CAAA;AAC3B,6FAA6F;AAC7F,2FAA2F;AAC3F,4CAA4C;AAC5C,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,CAAA;AAC1B,MAAM,eAAe,GAAG,CAAC,GAAG,CAAC,CAAA;AAE7B,8DAA8D;AAC9D,SAAS,UAAU,CAAC,CAAQ,EAAE,CAAQ,EAAE,CAAQ;IAC5C,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AAC,CAAC,CAAA;QACvE,KAAK,GAAG,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAA;IAC7E,CAAC;IAED,OAAO,EAAC,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,IAAI,EAAE,KAAK,EAAC,CAAA;AACpF,CAAC;AAED;;;;gEAIgE;AAChE,MAAM,UAAU,sBAAsB,CAAC,QAAe,EAAE,WAAkB;IACtE,MAAM,KAAK,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;IAC1C,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA;AACvE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,13 +8,21 @@ import type { FrameImageFn } from './frame.js';
|
|
|
8
8
|
export type { CoverSchema, TitlePosition, FontConfig } from './schema.js';
|
|
9
9
|
export { default_spine_title } from './utils.js';
|
|
10
10
|
export { collect_fonts, collect_all_fonts, collect_fallback_fonts, all_fonts_bundled, resolve_cjk_variant, resolve_field_cjk_variant } from './fonts.js';
|
|
11
|
-
export { asset_path, FRAMES_DIR, BACKGROUNDS_DIR
|
|
11
|
+
export { asset_path, FRAMES_DIR, BACKGROUNDS_DIR } from './assets.js';
|
|
12
|
+
export { DEFAULT_TEMPLATES } from './generated/templates_data.js';
|
|
12
13
|
export { list_patterns, find_pattern } from './patterns.js';
|
|
13
14
|
export type { PatternDef } from './patterns.js';
|
|
15
|
+
export { list_vector_backgrounds, find_vector_background } from './vector_backgrounds.js';
|
|
16
|
+
export type { VectorBackgroundDef } from './vector_backgrounds.js';
|
|
17
|
+
export { generate_palette } from './design.js';
|
|
18
|
+
export type { PaletteScheme } from './design.js';
|
|
19
|
+
export { tinted_contrast_text, pick_vivid_tint, synthesize_fill, blend_regions, region_hex } from './design.js';
|
|
20
|
+
export type { RegionStats } from './design.js';
|
|
14
21
|
export { make_blank_form_values } from './form_state.js';
|
|
15
22
|
export type { FormState, EmbedFormState } from './form_state.js';
|
|
16
|
-
export { build_schema, curly_quotes, parse_font_family } from './form_schema.js';
|
|
17
|
-
export type { CustomFontStyle } from './form_schema.js';
|
|
23
|
+
export { build_schema, curly_quotes, parse_font_family, VECTOR_BG_AUTO_COLOR } from './form_schema.js';
|
|
24
|
+
export type { CustomFontStyle, ImageRegions } from './form_schema.js';
|
|
25
|
+
export { analyze_pixel_regions, get_builtin_bg_regions } from './image_regions.js';
|
|
18
26
|
export { derive_colors, hex_override_to_hsl, hex_to_hsl, is_dark_color } from './colors.js';
|
|
19
27
|
export type { DerivedColors } from './colors.js';
|
|
20
28
|
export type { FontSizes } from './font_sizes.js';
|
|
@@ -40,9 +48,12 @@ export { frame_image, frame_asset_path } from './frame.js';
|
|
|
40
48
|
*
|
|
41
49
|
* Returns the virtual filesystem (filename → bytes) and the resolved cover
|
|
42
50
|
* dimensions so callers can use them for splitting without a second lookup.
|
|
51
|
+
*
|
|
52
|
+
* templates defaults to the cover.typ/_helpers.typ baked into this package version
|
|
53
|
+
* (see generated/templates_data.ts) — pass an override only to test unreleased template changes.
|
|
43
54
|
*/
|
|
44
|
-
export declare function build(
|
|
55
|
+
export declare function build(schema: CoverSchema, image?: {
|
|
45
56
|
data: Uint8Array;
|
|
46
57
|
ext: string;
|
|
47
|
-
}, frame_fn?: FrameImageFn, frame_data?: Blob): Promise<BuildResult>;
|
|
58
|
+
}, frame_fn?: FrameImageFn, frame_data?: Blob, templates?: Templates): Promise<BuildResult>;
|
|
48
59
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAA;AAExC,O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B,CAAA;CAC3B;AAGD,OAAO,EAAC,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,UAAU,EAAC,CAAA;AACvE,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAC,MAAM,aAAa,CAAA;AACvE,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAClD,YAAY,EAAC,mBAAmB,EAAC,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAC,sBAAsB,EAAE,4BAA4B,EACxD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,YAAY,CAAA;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,YAAY,CAAA;AAqCxD;;;;;;;;;GASG;AACH,wBAAsB,KAAK,CACvB,MAAM,EAAC,WAAW,EAClB,KAAK,CAAC,EAAC;IAAC,IAAI,EAAC,UAAU,CAAC;IAAC,GAAG,EAAC,MAAM,CAAA;CAAC,EACpC,QAAQ,CAAC,EAAC,YAAY,EACtB,UAAU,CAAC,EAAC,IAAI,EAChB,SAAS,GAAC,SAA6B,GACzC,OAAO,CAAC,WAAW,CAAC,CAyIrB"}
|
package/dist/index.js
CHANGED
|
@@ -3,19 +3,26 @@ 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';
|
|
25
|
+
export { analyze_pixel_regions, get_builtin_bg_regions } from './image_regions.js';
|
|
19
26
|
export { derive_colors, hex_override_to_hsl, hex_to_hsl, is_dark_color } from './colors.js';
|
|
20
27
|
// Re-export lower-level functions needed by generator-node and generator-web
|
|
21
28
|
export { cover_schema, calculate_font_sizes, resolve_colors, darken_hsl };
|
|
@@ -59,8 +66,11 @@ function wrap_blurb_cjk(markup, han_variant, style, chain) {
|
|
|
59
66
|
*
|
|
60
67
|
* Returns the virtual filesystem (filename → bytes) and the resolved cover
|
|
61
68
|
* dimensions so callers can use them for splitting without a second lookup.
|
|
69
|
+
*
|
|
70
|
+
* templates defaults to the cover.typ/_helpers.typ baked into this package version
|
|
71
|
+
* (see generated/templates_data.ts) — pass an override only to test unreleased template changes.
|
|
62
72
|
*/
|
|
63
|
-
export async function build(
|
|
73
|
+
export async function build(schema, image, frame_fn, frame_data, templates = DEFAULT_TEMPLATES) {
|
|
64
74
|
// Resolve spine text — undefined means derive from titles/author; '' means explicitly empty
|
|
65
75
|
const schema_resolved = {
|
|
66
76
|
...schema,
|
|
@@ -105,27 +115,23 @@ export async function build(templates, schema, image, frame_fn, frame_data) {
|
|
|
105
115
|
let icon_ghost;
|
|
106
116
|
let icon_ghost2;
|
|
107
117
|
let icon_spine;
|
|
108
|
-
let icon_bg;
|
|
109
118
|
if (schema_resolved.icon_id) {
|
|
110
119
|
// 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.
|
|
120
|
+
// Ghost copies: faded toward background from main color; spine: derived from spine bg
|
|
121
|
+
const color_main = schema_resolved.icon_color ?? darken_hsl(colors.front_background, 0.4);
|
|
122
|
+
const color_ghost = mix_hsl(color_main, colors.front_background, 0.75);
|
|
123
|
+
const color_ghost2 = mix_hsl(color_main, colors.front_background, 0.85);
|
|
115
124
|
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([
|
|
125
|
+
const [svg_main, svg_ghost, svg_ghost2, svg_spine] = await Promise.all([
|
|
118
126
|
resolve_icon(schema_resolved.icon_id, color_main),
|
|
119
127
|
resolve_icon(schema_resolved.icon_id, color_ghost),
|
|
120
128
|
resolve_icon(schema_resolved.icon_id, color_ghost2),
|
|
121
129
|
resolve_icon(schema_resolved.icon_id, color_spine),
|
|
122
|
-
resolve_icon(schema_resolved.icon_id, color_bg),
|
|
123
130
|
]);
|
|
124
131
|
icon_main = { data: encoder.encode(svg_main), ext: '.svg' };
|
|
125
132
|
icon_ghost = { data: encoder.encode(svg_ghost), ext: '.svg' };
|
|
126
133
|
icon_ghost2 = { data: encoder.encode(svg_ghost2), ext: '.svg' };
|
|
127
134
|
icon_spine = { data: encoder.encode(svg_spine), ext: '.svg' };
|
|
128
|
-
icon_bg = { data: encoder.encode(svg_bg), ext: '.svg' };
|
|
129
135
|
}
|
|
130
136
|
// Resolve and recolor pattern SVG when a pattern is specified
|
|
131
137
|
// schema.pattern can be a known pattern ID or a raw SVG string
|
|
@@ -145,8 +151,19 @@ export async function build(templates, schema, image, frame_fn, frame_data) {
|
|
|
145
151
|
const aspect_ratio = (svg_w > 0 && svg_h > 0) ? svg_w / svg_h : 1;
|
|
146
152
|
pattern_file = { data: encoder.encode(svg), ext: '.svg', aspect_ratio };
|
|
147
153
|
}
|
|
148
|
-
//
|
|
149
|
-
|
|
154
|
+
// Resolve a built-in vector background into SVG bytes when no photo was supplied — the
|
|
155
|
+
// palette is derived from the resolved front background color so it always tracks bg_color
|
|
156
|
+
let vector_image;
|
|
157
|
+
if (!image && schema_resolved.bg_vector_id) {
|
|
158
|
+
const design = find_vector_background(schema_resolved.bg_vector_id);
|
|
159
|
+
if (design) {
|
|
160
|
+
const palette = generate_palette(colors.front_background, design.color_count, design.scheme);
|
|
161
|
+
vector_image = { data: encoder.encode(design.render(palette)), ext: '.svg', is_vector: true };
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// Pre-process image with frame effect when bg_image_coverage is 'painted' and a frame_fn was
|
|
165
|
+
// injected — never applies to a generated vector background (canvas framing needs a photo)
|
|
166
|
+
let processed_image = image ?? vector_image;
|
|
150
167
|
if (image && schema_resolved.bg_image_coverage === 'painted' && frame_fn) {
|
|
151
168
|
const margin_mm = 15;
|
|
152
169
|
const painted_w = dims.cover_face_width.toNumber() - 2 * margin_mm;
|
|
@@ -164,7 +181,7 @@ export async function build(templates, schema, image, frame_fn, frame_data) {
|
|
|
164
181
|
...schema_resolved,
|
|
165
182
|
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
183
|
};
|
|
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,
|
|
184
|
+
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
185
|
return { files, dims };
|
|
169
186
|
}
|
|
170
187
|
//# 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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AAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EACrD,qBAAqB,CACxB;KACJ,CAAA;IAED,MAAM,KAAK,GAAG,iBAAiB,CAC3B,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EACrC,oBAAoB,EACpB,sBAAsB,EAAE,sBAAsB,EAAE,sBAAsB,EACtE,wBAAwB,EAAE,sBAAsB,EAAE,qBAAqB,EACvE,2BAA2B,EAAE,4BAA4B,EACzD,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,CAC5F,CAAA;IACD,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,CAAA;AACxB,CAAC"}
|
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;
|
|
@@ -97,6 +97,7 @@ export interface CoverSchema {
|
|
|
97
97
|
pattern?: string;
|
|
98
98
|
pattern_tile_mm?: number;
|
|
99
99
|
pattern_color?: string;
|
|
100
|
+
bg_vector_id?: string;
|
|
100
101
|
spine_color?: string | null;
|
|
101
102
|
isbn: string;
|
|
102
103
|
cjk_variant?: CjkVariant | 'auto';
|
|
@@ -269,7 +270,6 @@ export declare const cover_schema: z.ZodObject<{
|
|
|
269
270
|
bg_color_gradient: z.ZodOptional<z.ZodBoolean>;
|
|
270
271
|
icon_id: z.ZodOptional<z.ZodString>;
|
|
271
272
|
icon_mode: z.ZodOptional<z.ZodEnum<{
|
|
272
|
-
background: "background";
|
|
273
273
|
center: "center";
|
|
274
274
|
echo: "echo";
|
|
275
275
|
offset: "offset";
|
|
@@ -280,6 +280,7 @@ export declare const cover_schema: z.ZodObject<{
|
|
|
280
280
|
pattern: z.ZodOptional<z.ZodString>;
|
|
281
281
|
pattern_tile_mm: z.ZodOptional<z.ZodNumber>;
|
|
282
282
|
pattern_color: z.ZodOptional<z.ZodString>;
|
|
283
|
+
bg_vector_id: z.ZodOptional<z.ZodString>;
|
|
283
284
|
spine_color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
284
285
|
isbn: z.ZodDefault<z.ZodString>;
|
|
285
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;IAGb,KAAK,CAAC,EAAC,OAAO,GAAG,MAAM,CAAA;CAC1B;AAED,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsHvB,CAAA"}
|
package/dist/schema.js
CHANGED
|
@@ -96,13 +96,14 @@ export const cover_schema = z.object({
|
|
|
96
96
|
bg_color: hsl_color.optional(),
|
|
97
97
|
bg_color_gradient: z.boolean().optional(),
|
|
98
98
|
icon_id: z.string().optional(),
|
|
99
|
-
icon_mode: z.enum(['center', 'offset', 'echo'
|
|
99
|
+
icon_mode: z.enum(['center', 'offset', 'echo']).optional(),
|
|
100
100
|
icon_size: z.number().optional(),
|
|
101
101
|
icon_color: z.string().optional(),
|
|
102
102
|
icon_spine: z.boolean().optional(),
|
|
103
103
|
pattern: z.string().optional(),
|
|
104
104
|
pattern_tile_mm: z.number().positive().optional(),
|
|
105
105
|
pattern_color: z.string().optional(),
|
|
106
|
+
bg_vector_id: z.string().optional(),
|
|
106
107
|
spine_color: hsl_color.nullable().optional(),
|
|
107
108
|
// Other
|
|
108
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":"AACA,gFAAgF;AAEhF,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,gFAAgF;AAEhF,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AA0JrB,uBAAuB;AAEvB,wEAAwE;AACxE,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAC9B,+DAA+D,EAC/D,iDAAiD,CACpD,CAAA;AAED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EAAE;IACjC,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAElC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACjD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAEpC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAEnC,WAAW,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAE5C,QAAQ;IACR,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5B,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE;CACzE,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates_data.d.ts","sourceRoot":"","sources":["../src/templates_data.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAA;AAE/C,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,EAAC,SAG9B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,cAAc,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1F,CAAC;IACD,OAAO,GAAG,CAAA;AACd,CAAC;AAED,6FAA6F;AAC7F,SAAS,eAAe,CAAC,EAAS;IAC9B,OAAO,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAA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