bookcover-web 0.22.3 → 0.23.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.
@@ -64,6 +64,23 @@ export interface InitMessage {
64
64
  hide_size_section?: boolean;
65
65
  bg_suggestions?: BgSuggestion[];
66
66
  locale?: string;
67
+ /** Typst markup to put in place of marker text in the cover's blurb, keyed by marker (plain
68
+ * text exactly as the user sees it in the editor, e.g. 'AUTO-COPYRIGHT'), so the widget
69
+ * shows what will actually print. Applied only when the widget renders (its previews and
70
+ * its own PDF exports): the form is never changed, so the editor still shows the marker
71
+ * and data/finished messages send it back untouched. The host applies the same map when
72
+ * it renders final output, by passing it to build_schema() as `typst_substitutions`.
73
+ *
74
+ * Values are trusted Typst from the host, inserted verbatim. They follow the rules on
75
+ * BuildSchemaOptions.typst_substitutions in bookcover-core: wrap multi-line markup in one
76
+ * `#[…];` block or put the marker alone in its own paragraph; set your own text direction;
77
+ * keep text as escaped content rather than string literals; use no images or named fonts.
78
+ * A marker the user styles only part of (bolding half of it, say) isn't replaced.
79
+ *
80
+ * If a preview fails to compile with the substitutions, the widget reports it as an
81
+ * 'error' message and shows the preview without them, raw marker and all; a PDF export
82
+ * fails instead. Absent or empty changes nothing. */
83
+ typst_substitutions?: Record<string, string>;
67
84
  }
68
85
  /** Host -> widget. InitMessage is the first and must arrive before any other; later messages are
69
86
  * only accepted from the same origin that sent it.
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export type { IconCategory } from 'bookcover-core';
9
9
  export { tinted_contrast_text, pick_vivid_tint, synthesize_fill, blend_regions, region_hex, all_image_regions, analyze_pixel_regions, get_builtin_bg, get_builtin_bg_regions, BG_PREVIEW_DIR, VECTOR_BG_AUTO_COLOR, resolve_colors, darken_hsl } from 'bookcover-core';
10
10
  export type { RegionStats, ImageRegions, ResolvedColors, BuiltinBg } from 'bookcover-core';
11
11
  export { make_blank_form_values, build_schema, curly_quotes, parse_font_family, find_pattern, derive_colors, hex_override_to_hsl, hex_to_hsl, is_dark_color, warn_unknown } from 'bookcover-core';
12
- export type { FormState, EmbedFormState, CustomFontStyle, DerivedColors } from 'bookcover-core';
12
+ export type { FormState, EmbedFormState, CustomFontStyle, BuildSchemaOptions, DerivedColors } from 'bookcover-core';
13
13
  export { resolve_dimensions } from 'bookcover-core';
14
14
  export type { GetDimensionsResult, DimensionInputs } from 'bookcover-core';
15
15
  export type { InitMessage, HostMessage, WidgetMessage, BgSuggestion } from './embed_types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bookcover-web",
3
- "version": "0.22.3",
3
+ "version": "0.23.0",
4
4
  "license": "MIT-0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,7 +40,7 @@
40
40
  "@myriaddreamin/typst-ts-renderer": "0.7.0",
41
41
  "@myriaddreamin/typst-ts-web-compiler": "0.7.0",
42
42
  "@myriaddreamin/typst.ts": "0.7.0",
43
- "bookcover-core": "^0.22.3",
43
+ "bookcover-core": "^0.23.0",
44
44
  "typst-fonts": "^0.1.4"
45
45
  },
46
46
  "sideEffects": false