@datatechsolutions/tympan-tokens 0.4.1 → 0.5.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.
Files changed (91) hide show
  1. package/THIRD_PARTY_NOTICES.md +5 -5
  2. package/dist/contrast-report.md +95 -95
  3. package/dist/dtcg/astrlabe.dark-high.tokens.json +99 -43
  4. package/dist/dtcg/astrlabe.dark.tokens.json +137 -81
  5. package/dist/dtcg/astrlabe.light-high.tokens.json +146 -33
  6. package/dist/dtcg/astrlabe.light.tokens.json +211 -98
  7. package/dist/fonts.css +80 -80
  8. package/dist/index.d.ts +257 -58
  9. package/dist/index.js +568 -36
  10. package/dist/index.js.map +1 -1
  11. package/dist/print-themes/print-aquarela.css +7 -7
  12. package/dist/print-themes/print-art-nouveau.css +2 -2
  13. package/dist/print-themes/print-atlas-oficial.css +7 -7
  14. package/dist/print-themes/print-azulejo-modernista.css +2 -2
  15. package/dist/print-themes/print-bauhaus.css +2 -2
  16. package/dist/print-themes/print-blocos-coloridos.css +5 -5
  17. package/dist/print-themes/print-brutalista.css +8 -8
  18. package/dist/print-themes/print-caderno.css +14 -14
  19. package/dist/print-themes/print-cartao-postal.css +5 -5
  20. package/dist/print-themes/print-cientifico.css +3 -3
  21. package/dist/print-themes/print-concretismo.css +8 -8
  22. package/dist/print-themes/print-construtivismo.css +6 -6
  23. package/dist/print-themes/print-cordel.css +6 -6
  24. package/dist/print-themes/print-dados-br.css +12 -12
  25. package/dist/print-themes/print-dashboard.css +18 -18
  26. package/dist/print-themes/print-diagrama-modernista.css +3 -3
  27. package/dist/print-themes/print-divulgacao.css +3 -3
  28. package/dist/print-themes/print-fluxo-historico.css +3 -3
  29. package/dist/print-themes/print-grade-holandesa.css +2 -2
  30. package/dist/print-themes/print-graficos-1900.css +6 -6
  31. package/dist/print-themes/print-infografico-ilustrado.css +6 -6
  32. package/dist/print-themes/print-isotype.css +2 -2
  33. package/dist/print-themes/print-jornal-1959.css +5 -5
  34. package/dist/print-themes/print-jornal.css +6 -6
  35. package/dist/print-themes/print-mapa-de-metro.css +1 -1
  36. package/dist/print-themes/print-memphis.css +5 -5
  37. package/dist/print-themes/print-minimo-de-tinta.css +4 -4
  38. package/dist/print-themes/print-papel-recortado.css +2 -2
  39. package/dist/print-themes/print-papel-salmao.css +6 -6
  40. package/dist/print-themes/print-pictogramas.css +2 -2
  41. package/dist/print-themes/print-pop-art.css +2 -2
  42. package/dist/print-themes/print-prancheta-clara.css +5 -5
  43. package/dist/print-themes/print-prancheta.css +5 -5
  44. package/dist/print-themes/print-proporcao-modular.css +2 -2
  45. package/dist/print-themes/print-riso.css +4 -4
  46. package/dist/print-themes/print-semanario.css +13 -13
  47. package/dist/print-themes/print-sinalizacao.css +8 -8
  48. package/dist/print-themes/print-suico.css +4 -4
  49. package/dist/print-themes/print-tropicalia.css +3 -3
  50. package/dist/print-themes.css +133 -133
  51. package/dist/tokens.css +247 -124
  52. package/dist/tokens.json +124 -66
  53. package/dist/values.js +124 -66
  54. package/fonts/ibmplexsans/ibmplexsans-italic-cyrillic-400_500_600.woff2 +0 -0
  55. package/fonts/ibmplexsans/ibmplexsans-italic-cyrillic-ext-400_500_600.woff2 +0 -0
  56. package/fonts/ibmplexsans/ibmplexsans-italic-greek-400_500_600.woff2 +0 -0
  57. package/fonts/ibmplexsans/ibmplexsans-italic-latin-400_500_600.woff2 +0 -0
  58. package/fonts/ibmplexsans/ibmplexsans-italic-latin-ext-400_500_600.woff2 +0 -0
  59. package/fonts/ibmplexsans/ibmplexsans-italic-vietnamese-400_500_600.woff2 +0 -0
  60. package/fonts/manifest.json +998 -820
  61. package/fonts/nunitosans/nunitosans-normal-cyrillic-400_600_700_800.woff2 +0 -0
  62. package/fonts/nunitosans/nunitosans-normal-cyrillic-ext-400_600_700_800.woff2 +0 -0
  63. package/fonts/nunitosans/nunitosans-normal-latin-400_600_700_800.woff2 +0 -0
  64. package/fonts/nunitosans/nunitosans-normal-latin-ext-400_600_700_800.woff2 +0 -0
  65. package/fonts/nunitosans/nunitosans-normal-vietnamese-400_600_700_800.woff2 +0 -0
  66. package/fonts/sourceserif4/sourceserif4-italic-cyrillic-400_600.woff2 +0 -0
  67. package/fonts/sourceserif4/sourceserif4-italic-cyrillic-ext-400_600.woff2 +0 -0
  68. package/fonts/sourceserif4/sourceserif4-italic-greek-400_600.woff2 +0 -0
  69. package/fonts/sourceserif4/sourceserif4-italic-latin-400_600.woff2 +0 -0
  70. package/fonts/sourceserif4/sourceserif4-italic-latin-ext-400_600.woff2 +0 -0
  71. package/fonts/sourceserif4/sourceserif4-italic-vietnamese-400_600.woff2 +0 -0
  72. package/package.json +1 -1
  73. package/src/fonts.ts +2 -2
  74. package/src/index.ts +1 -0
  75. package/src/presets.ts +115 -16
  76. package/src/print-book-themes.ts +239 -0
  77. package/src/print-presets.ts +220 -10
  78. package/src/stylesheet.ts +5 -0
  79. package/src/theme.ts +35 -5
  80. /package/fonts/ibmplexsans/{ibmplexsans-italic-cyrillic.woff2 → ibmplexsans-italic-cyrillic-400.woff2} +0 -0
  81. /package/fonts/ibmplexsans/{ibmplexsans-italic-cyrillic-ext.woff2 → ibmplexsans-italic-cyrillic-ext-400.woff2} +0 -0
  82. /package/fonts/ibmplexsans/{ibmplexsans-italic-greek.woff2 → ibmplexsans-italic-greek-400.woff2} +0 -0
  83. /package/fonts/ibmplexsans/{ibmplexsans-italic-latin.woff2 → ibmplexsans-italic-latin-400.woff2} +0 -0
  84. /package/fonts/ibmplexsans/{ibmplexsans-italic-latin-ext.woff2 → ibmplexsans-italic-latin-ext-400.woff2} +0 -0
  85. /package/fonts/ibmplexsans/{ibmplexsans-italic-vietnamese.woff2 → ibmplexsans-italic-vietnamese-400.woff2} +0 -0
  86. /package/fonts/sourceserif4/{sourceserif4-italic-cyrillic.woff2 → sourceserif4-italic-cyrillic-400.woff2} +0 -0
  87. /package/fonts/sourceserif4/{sourceserif4-italic-cyrillic-ext.woff2 → sourceserif4-italic-cyrillic-ext-400.woff2} +0 -0
  88. /package/fonts/sourceserif4/{sourceserif4-italic-greek.woff2 → sourceserif4-italic-greek-400.woff2} +0 -0
  89. /package/fonts/sourceserif4/{sourceserif4-italic-latin.woff2 → sourceserif4-italic-latin-400.woff2} +0 -0
  90. /package/fonts/sourceserif4/{sourceserif4-italic-latin-ext.woff2 → sourceserif4-italic-latin-ext-400.woff2} +0 -0
  91. /package/fonts/sourceserif4/{sourceserif4-italic-vietnamese.woff2 → sourceserif4-italic-vietnamese-400.woff2} +0 -0
package/dist/index.d.ts CHANGED
@@ -109,6 +109,29 @@ export interface ThemeConfig {
109
109
  elevation?: Elevation;
110
110
  /** Arbitrary string variables (e.g. for textures) */
111
111
  strings?: Record<string, string>;
112
+ /**
113
+ * String variables per mode (`--ty-<name>`), for values that differ
114
+ * between light and dark: a glass edge, a fill gradient, a brand mark
115
+ * gradient. Like pins, they are exact design values: the generated
116
+ * high-contrast variant leaves them out, so components fall back.
117
+ */
118
+ modeStrings?: Partial<Record<Mode, Record<string, string>>>;
119
+ /** Backdrop saturation of glass surfaces per mode (1.15 when omitted). */
120
+ glassSaturate?: Partial<Record<Mode, number>>;
121
+ /** Exact shadow layers per mode, replacing the generated ones by name. */
122
+ shadowPins?: Partial<Record<Mode, Partial<Record<ShadowName, ShadowPin[]>>>>;
123
+ /** Card and sheet radii in px, when they do not follow the control radius. */
124
+ radii?: Partial<Record<'card' | 'sheet', number>>;
125
+ }
126
+ export type ShadowName = 'sheet' | 'raised' | 'floating' | 'modal' | 'sheet-inset';
127
+ /** One shadow layer of `shadowPins`, its colour as a CSS colour string. */
128
+ export interface ShadowPin {
129
+ x: number;
130
+ y: number;
131
+ blur: number;
132
+ spread: number;
133
+ color: string;
134
+ inset?: boolean;
112
135
  }
113
136
  export declare const RAMP_STEPS: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
114
137
  export type RampStep = (typeof RAMP_STEPS)[number];
@@ -156,7 +179,7 @@ export interface ResolvedTheme {
156
179
  angle: number;
157
180
  stops: Rgba[];
158
181
  };
159
- shadows: Record<'sheet' | 'raised' | 'floating' | 'modal' | 'sheet-inset', ShadowLayer[]>;
182
+ shadows: Record<ShadowName, ShadowLayer[]>;
160
183
  /** Pixel dimensions (radius, glass blur, focus width). */
161
184
  dimensions: Record<string, number>;
162
185
  /** Font stacks keyed by token name (`serif`, `sans`, `mono`); empty when the theme keeps the base stacks. */
@@ -201,8 +224,10 @@ export declare const fakhirPreset: ThemeConfig;
201
224
  /**
202
225
  * The Astrlabe workflow engine's look (`data-ty-theme="astrlabe"`): slate
203
226
  * neutrals, an indigo brand (indigo 500 as the accent family, one step darker
204
- * where text needs 4.5:1 on light grounds), translucent glass surfaces and the
205
- * rounder corners of that app (12 px controls, about 20 px cards). The call to
227
+ * where text needs 4.5:1 on light grounds), liquid-glass surfaces (gradient
228
+ * fills, specular edges, a strong saturation boost at night), the rounder
229
+ * corners of that app (12 px controls, 20 px cards, 24 px sheets), its
230
+ * compact type scale and the sky, indigo and violet mark. The call to
206
231
  * action is the indigo to purple gradient its primary buttons fill with, and
207
232
  * text (headings included) uses the platform's own system fonts. The state
208
233
  * contract holds on every ground: running is a cyan clearly off the indigo
@@ -349,7 +374,9 @@ export type RenderizadorGrafico = 'limpo' | 'mao' | 'isotype' | 'gravura' | 'pra
349
374
  export type MarcaProva = 'pilula' | 'carimbo' | 'circulo' | 'sublinhado' | 'barra' | 'etiqueta' | 'formas' | 'ponto';
350
375
  export type EstadoProva = 'sustentada' | 'refutada' | 'nao-da-para-afirmar' | 'pendente' | 'sem-dado' | 'nao-testada';
351
376
  export declare const ESTADOS_PROVA: readonly EstadoProva[];
352
- /** The word printed for each proof state (always visible, whatever the mark's shape). */
377
+ /** The word printed for each proof state in English (tympan-print picks by the book's `lang`). */
378
+ export declare const ROTULOS_PROVA_EN: Record<EstadoProva, string>;
379
+ /** The word printed for each proof state (always visible, whatever the mark's shape); pt-BR. */
353
380
  export declare const ROTULOS_PROVA: Record<EstadoProva, string>;
354
381
  export interface PrintFontes {
355
382
  titulo: string;
@@ -372,6 +399,16 @@ export interface PrintCores {
372
399
  prova: Record<EstadoProva, string>;
373
400
  /** Colours of page ornaments only (frames, tiles, waves); never data. Up to four. */
374
401
  ornamento?: string[];
402
+ /** Colours by category key (official party colours…): used by categorical maps, parliament and bars. */
403
+ categorias?: Record<string, string>;
404
+ /** Colours of data themes (blocks of a panel page: economia, saude…); --ty-print-tema-<id>. */
405
+ temas?: Record<string, string>;
406
+ /** The series of interest in maps and charts (default: `destaque`), when the accent of the page differs from the data ink. */
407
+ interesse?: string;
408
+ /** Data palette, diverging: the low and the high side (default destaque2 × destaque). */
409
+ divergente?: [string, string];
410
+ /** Data palette, qualitative (party, category: no implied order), up to eight (default: a colour-blind-safe set). */
411
+ categorica?: string[];
375
412
  }
376
413
  /** Partial colours: any role, and any subset of the proof states. */
377
414
  export type PrintCoresParciais = Partial<Omit<PrintCores, 'prova'>> & {
@@ -455,6 +492,16 @@ export interface PrintEstrutura {
455
492
  */
456
493
  realce?: 'serie' | 'linha';
457
494
  /** Head of each small multiple: plain title (default), a band in the highlighter colour with an arrow (Schiphol), a dark band (Vignelli), a band in the ornament colour (Aicher), each multiple on its own tinted card (Le Corbusier, Bayer). */
495
+ /**
496
+ * Long runs (one page per unit, thousands of pages): no page ornaments, no tinted panel fills, the 'bolso'
497
+ * panel as a rule instead of a filled box. The style's type, colours and frames stay.
498
+ */
499
+ economiaTinta?: boolean;
500
+ /**
501
+ * Pages without a molde fill the type area: panels widen to close their row of the six columns and rows of
502
+ * panels share the free height (dashboard). A page can turn it on or off with `preencher`.
503
+ */
504
+ preencher?: boolean;
458
505
  cabecaMultiplo?: 'titulo' | 'faixa' | 'faixa-escura' | 'faixa-cor' | 'caixa-cor';
459
506
  }
460
507
  /**
@@ -478,7 +525,7 @@ export type Emblema = 'pictogramas' | 'formas' | 'circulo-bicolor' | 'figura-mod
478
525
  export type FormaGrafico = 'barras' | 'colunas' | 'eixo-central' | 'ziguezague' | 'fluxo' | 'predios' | 'cartoes' | 'halteres';
479
526
  /** Page ornaments (optional, CONTRATO §1). */
480
527
  export type Moldura = 'nenhuma' | 'dupla' | 'regua' | 'azulejo' | 'ondas' | 'ramos' | 'recortes' | 'reticula' | 'memphis' | 'diagonais' | 'formas' | 'quartos';
481
- export interface PrintStyle {
528
+ export interface PrintStyle extends PrintTemaExtras {
482
529
  /** Stable id, e.g. 'jornal'. */
483
530
  name: string;
484
531
  /** Human label, e.g. "Editorial de jornal". */
@@ -516,9 +563,89 @@ export interface PrintStyle {
516
563
  * has approved variations (ink, duotone, per style), see LogoDatatech.
517
564
  */
518
565
  logo?: 'cor' | 'mono';
566
+ /** Typesetting options a book may need against the style's idiom (see PrintTexto). */
567
+ texto?: PrintTexto;
568
+ }
569
+ /**
570
+ * Typesetting switches for books whose content fights the style: a style in lower case (bauhaus,
571
+ * diagrama-modernista) would print "boa vista" for a proper name; a style with old-style figures would
572
+ * misalign table columns.
573
+ */
574
+ export interface PrintTexto {
575
+ /**
576
+ * 'estilo' (default): page titles and eyebrows follow the style's casing. 'preservar': the level-1 title,
577
+ * eyebrows and table cells keep the casing written in the content (proper names, codes), while panel labels
578
+ * and running heads keep the style's.
579
+ */
580
+ nomesProprios?: 'estilo' | 'preservar';
581
+ /** Figures in table cells: 'tabular' (default, lining and equal width, columns align) or 'proporcional'. */
582
+ numerosTabela?: 'tabular' | 'proporcional';
583
+ /** Font weight per role (titles, key numbers, labels, body, notes, mono), e.g. { titulo: 600, numero: 600 }. */
584
+ pesos?: Partial<Record<keyof PrintFontes, number>>;
585
+ /** Figures per role: 'tabular' (equal width, lining) or 'proporcional'. Tables follow `numerosTabela`. */
586
+ algarismos?: Partial<Record<'numero' | 'rotulo' | 'corpo', 'tabular' | 'proporcional'>>;
587
+ }
588
+ /** A mark the theme prints (publisher logo, collection seal): an image URL (data: URIs work offline) and its text alternative. */
589
+ export interface PrintMarca {
590
+ src: string;
591
+ alt: string;
592
+ /** Width in mm where the mark is placed (default 18 for the logo, 12 for the seal). */
593
+ largura?: number;
594
+ /** Image used in black and white print (default: the same `src`, greyed by CSS). */
595
+ srcPb?: string;
596
+ }
597
+ /** Page format and print finishing. */
598
+ export interface PrintPagina {
599
+ /** Trim width in mm (default 170). */
600
+ largura?: number;
601
+ /** Trim height in mm (default 240). */
602
+ altura?: number;
603
+ /** Bleed in mm added around every page when the book prints for the press (default 3). */
604
+ sangria?: number;
605
+ /** Crop marks in the slug, outside the bleed (default false). */
606
+ marcasCorte?: boolean;
607
+ }
608
+ /** Running head and folio. */
609
+ export interface PrintFolio {
610
+ /** Where the folio sits: outer corner (default) or centred. */
611
+ folio?: 'externo' | 'centro';
612
+ /** Where the running head sits: outer corner (default), centred, or not printed. */
613
+ cabeco?: 'externo' | 'centro' | 'nenhum';
614
+ /** Text before the folio number, e.g. "p. ". */
615
+ prefixoFolio?: string;
616
+ }
617
+ /** A local font file (offline, deterministic builds and EPUB): one @font-face. */
618
+ export interface PrintFonteLocal {
619
+ /** Family name as used in the theme's font stacks. */
620
+ familia: string;
621
+ /** URL or path of the .woff2 (relative to the HTML, absolute, or a data: URI). */
622
+ src: string;
623
+ peso?: number | string;
624
+ estilo?: 'normal' | 'italic';
625
+ }
626
+ /** What a theme adds to a preset beyond the style tokens. */
627
+ export interface PrintTemaExtras {
628
+ marcas?: {
629
+ editora?: PrintMarca;
630
+ selo?: PrintMarca;
631
+ };
632
+ pagina?: PrintPagina;
633
+ folio?: PrintFolio;
634
+ /** Local font files; with them PrintBook can run without network (`fontes="locais"`). */
635
+ fontesLocais?: PrintFonteLocal[];
636
+ /**
637
+ * Trace of a number (Rastro): sign it with the theme's seal (`marcas.selo`) or the lakebrasil mark, and add
638
+ * the lake version seal when the version carries a date. Default: neutral (neither).
639
+ */
640
+ rastro?: {
641
+ assinatura?: 'selo' | 'lakebrasil' | 'nenhuma';
642
+ seloLake?: boolean;
643
+ };
644
+ /** Texts the print components write by themselves, by key (see tympan-print i18n: TEXTOS_PT / TEXTOS_EN). */
645
+ textos?: Record<string, string>;
519
646
  }
520
647
  /** Any token of a style may be overridden by the editor (partial, nested). */
521
- export interface PrintStyleOverrides {
648
+ export interface PrintStyleOverrides extends PrintTemaExtras {
522
649
  label?: string;
523
650
  fontes?: Partial<PrintFontes>;
524
651
  googleFonts?: string[];
@@ -532,6 +659,7 @@ export interface PrintStyleOverrides {
532
659
  pb?: PrintCoresParciais;
533
660
  estrutura?: Partial<PrintEstrutura>;
534
661
  logo?: 'cor' | 'mono';
662
+ texto?: PrintTexto;
535
663
  }
536
664
  /** The 39 book styles, by name. */
537
665
  export declare const printPresets: {
@@ -608,6 +736,20 @@ export interface PrintCssOptions {
608
736
  * current style (`resolvePrintStyle('economist').name === 'semanario'`).
609
737
  */
610
738
  export declare function resolvePrintStyle(style: PrintStyle | PrintStyleId, options?: Omit<PrintCssOptions, 'seletor'>): PrintStyle;
739
+ /**
740
+ * `cor` moved along OKLCH lightness (hue and chroma kept) until it reaches `min`:1 against `papel`: the
741
+ * context grey of a theme stays visible on cream paper (areas ≥ 1.5:1, strokes ≥ 3:1).
742
+ */
743
+ export declare function contrasteMinimo(cor: string, papel: string, min: number): string;
744
+ /**
745
+ * Unlayered rules (they win over `@layer tympan-print`) for a theme's per-role font weights and figures,
746
+ * scoped to `seletor`; '' when the theme sets neither.
747
+ */
748
+ export declare function printTextoRolesCss(style: Pick<PrintStyle, 'texto'>, seletor: string): string;
749
+ /** Qualitative palette (Okabe & Ito 2008, colour-blind safe) used when a style defines none. */
750
+ export declare const CATEGORICA_PADRAO: readonly ['#0072b2', '#e69f00', '#009e73', '#cc79a7', '#56b4e9', '#d55e00', '#f0e442', '#555555'];
751
+ /** The eight qualitative data colours of a style: its own `categorica`, completed by CATEGORICA_PADRAO. */
752
+ export declare function categoricaDoEstilo(style: Pick<PrintStyle, 'cor'>): string[];
611
753
  /** Custom properties of a resolved style, in a stable order. */
612
754
  export declare function printStyleVariables(style: PrintStyle): Array<[string, string]>;
613
755
  /**
@@ -621,58 +763,6 @@ export declare function googleFontsUrl(style: Pick<PrintStyle, 'googleFonts'>):
621
763
  /** True when the paper is dark (the brand seal and logo then use the light mono version). */
622
764
  export declare function papelEscuro(style: Pick<PrintStyle, 'cor'>): boolean;
623
765
  //#endregion
624
- //#region src/print-themes.d.ts
625
- /** Per-style adjustments where the derivation misjudges; merged over the derived config. */
626
- export interface PrintThemeOverride {
627
- /** Brand colour to use instead of the derived one. */
628
- brand?: string;
629
- glass?: boolean;
630
- cta?: ThemeConfig['cta'];
631
- elevation?: ThemeConfig['elevation'];
632
- /** Radius in px. */
633
- radius?: number;
634
- /** Extra pins per mode (applied before the contrast check, dropped if they fail like any pin). */
635
- pins?: ThemeConfig['pins'];
636
- }
637
- /**
638
- * Where the derivation reads a style differently from its tradition. Kept
639
- * short on purpose: every entry is a judgement the data cannot express.
640
- */
641
- export declare const PRINT_THEME_OVERRIDES: Partial<Record<PrintPresetName, PrintThemeOverride>>;
642
- /** The colour moved along OKLCH lightness (hue and chroma kept) until it reaches `min` against `over`. */
643
- export declare function legibleOn(colour: string, over: string, min?: number): string;
644
- /**
645
- * The accent that represents a style, before any legibility adjustment: the
646
- * first chromatic accent that nearly reads on the paper (3:1), else the most
647
- * legible chromatic accent, else the first chromatic ornament, else the ink
648
- * (or, on dark paper, the paper itself).
649
- */
650
- export declare function printStyleAccent(style: PrintStyle): string;
651
- /**
652
- * The UI theme of a book style, in light and dark. The name is
653
- * `print-<style name>`; the label is the style's own.
654
- */
655
- export declare function printStyleToTheme(style: PrintStyle, override?: PrintThemeOverride): ThemeConfig;
656
- /**
657
- * Exact print colours the derivation had to give up for contrast, per mode
658
- * (role -> the print colour that was dropped and regenerated).
659
- */
660
- export declare function printThemeDroppedPins(style: PrintStyle, override?: PrintThemeOverride): Record<Mode, Partial<Record<RoleName, string>>>;
661
- /** Every book style as a UI theme, in the order of `printPresets`. */
662
- export declare const printThemePresets: readonly ThemeConfig[];
663
- /**
664
- * Legacy: Google Fonts stylesheet URL of the families of each print theme, by
665
- * theme name. The print theme sheets now declare the bundled fonts
666
- * (`printThemeFontSpecs`), so ThemeProvider needs no `fonts` map; this stays
667
- * for hosts that prefer Google's CDN.
668
- */
669
- export declare const printThemeFontUrls: Readonly<Record<string, string>>;
670
- /**
671
- * Google Fonts specs of each print theme, by theme name: the families its
672
- * stacks name, bundled under fonts/ and declared in the theme's sheet.
673
- */
674
- export declare const printThemeFontSpecs: Readonly<Record<string, readonly string[]>>;
675
- //#endregion
676
766
  //#region src/fonts.d.ts
677
767
  /** Base stacks of every preset: Source Serif 4, IBM Plex Sans, IBM Plex Mono. */
678
768
  export declare const BASE_FONT_SPECS: readonly string[];
@@ -725,6 +815,115 @@ export interface FontManifest {
725
815
  */
726
816
  export declare function fontFaceCss(manifest: FontManifest, specs: readonly string[], base: string): string;
727
817
  //#endregion
818
+ //#region src/print-book-themes.d.ts
819
+ /** A book theme: an id, a base and overrides. */
820
+ export interface PrintBookTheme extends PrintStyleOverrides {
821
+ /** Registry id, e.g. 'lakebrasil-editorial'. Use it as PrintBook's `estilo`. */
822
+ id: string;
823
+ /** A preset name (or deprecated alias) or the id of another registered theme. */
824
+ base: string;
825
+ /** What the theme interprets (shown in galleries). */
826
+ referencia?: string;
827
+ }
828
+ /** The JSON form of a theme: the same fields, colours as hex strings or DTCG colour objects. */
829
+ export type PrintBookThemeJson = Omit<PrintBookTheme, 'cor' | 'pb'> & {
830
+ cor?: Record<string, unknown>;
831
+ pb?: Record<string, unknown>;
832
+ };
833
+ /** A style with overrides and theme extras applied (same as mergePrintStyle, kept for readability). */
834
+ export declare const mergePrintTheme: typeof mergePrintStyle;
835
+ /** Resolves a theme id or a preset id to a complete PrintStyle (`name` = the theme id). */
836
+ export declare function printThemeById(id: string, visitados?: string[]): PrintStyle;
837
+ /** True when `id` names a registered theme or a preset. */
838
+ export declare function isPrintThemeId(id: string): boolean;
839
+ /** Validates and normalises a theme read from JSON (colours may be hex or DTCG colour objects). */
840
+ export declare function printThemeFromJson(json: PrintBookThemeJson | string): PrintBookTheme;
841
+ type No = Record<string, unknown>;
842
+ /**
843
+ * A theme from a DTCG (2025.10) tree. The tree mirrors PrintStyleOverrides: each group is a field
844
+ * (`label`, `fontes.<role>`, `googleFonts`, `cor.<role>`, `cor.prova.<state>`, `cor.categorica.<n>`,
845
+ * `cor.divergente.<n>`, `traco.largura`, `pb.*`, `estrutura.*`, `texto.*`, `marcas.*`, `pagina.*`, `folio.*`,
846
+ * `fontesLocais`…) and each `{ "$type", "$value" }` leaf becomes its value (colours as hex or DTCG colour
847
+ * objects, `fontFamily` arrays become CSS stacks, dimensions become mm). The theme's id and base come from
848
+ * the root `$extensions["dev.tympan.print"]` (or `["br.com.datatechsolutions.tympan"]`) as `name`/`id` and
849
+ * `extends`/`base`.
850
+ */
851
+ export declare function printThemeFromDtcg(tree: No | string): PrintBookTheme;
852
+ /** Registers (or replaces) a theme; accepts the theme object, its JSON or a DTCG tree. Returns the theme. */
853
+ export declare function registerPrintTheme(tema: PrintBookTheme | PrintBookThemeJson | No | string): PrintBookTheme;
854
+ /** Removes a registered theme (tests, hot reload). */
855
+ export declare function unregisterPrintTheme(id: string): boolean;
856
+ /** Ids of the registered themes, in registration order. */
857
+ export declare function registeredPrintThemes(): string[];
858
+ /** `@font-face` rules for a style's local font files ('' when it has none). */
859
+ export declare function fontesLocaisCss(style: Pick<PrintStyle, 'fontesLocais'>): string;
860
+ /** Trim and bleed of a style (defaults 170 × 240 mm, 3 mm bleed). */
861
+ export declare function paginaDoEstilo(style: Pick<PrintStyle, 'pagina'>): Required<PrintPagina>;
862
+ /** A neutral example theme (registered nowhere by default): a small press over `semanario`, in two inks. */
863
+ export declare const TEMA_EXEMPLO_EDITORA: PrintBookTheme;
864
+ /** Families named in a style's font stacks (quotes removed), in role order, without generic and system faces. */
865
+ export declare function familiasDoEstilo(style: Pick<PrintStyle, 'fontes'>): string[];
866
+ /** Families the style names (first of each stack) that have neither a bundled file nor a theme `fontesLocais`. */
867
+ export declare function familiasSemArquivo(style: Pick<PrintStyle, 'fontes' | 'fontesLocais'>, manifest: FontManifest): string[];
868
+ /**
869
+ * @font-face rules for a style from the fonts bundled in this package (`fonts/manifest.json`): every face of
870
+ * every family its font stacks name (so a mono or label family outside `googleFonts` is not forgotten), with
871
+ * URLs `<base><file>`, then the theme's own `fontesLocais`, which win for their family.
872
+ */
873
+ export declare function fontesEmpacotadasCss(style: Pick<PrintStyle, 'fontes' | 'googleFonts' | 'fontesLocais'>, manifest: FontManifest, base: string): string;
874
+ //#endregion
875
+ //#region src/print-themes.d.ts
876
+ /** Per-style adjustments where the derivation misjudges; merged over the derived config. */
877
+ export interface PrintThemeOverride {
878
+ /** Brand colour to use instead of the derived one. */
879
+ brand?: string;
880
+ glass?: boolean;
881
+ cta?: ThemeConfig['cta'];
882
+ elevation?: ThemeConfig['elevation'];
883
+ /** Radius in px. */
884
+ radius?: number;
885
+ /** Extra pins per mode (applied before the contrast check, dropped if they fail like any pin). */
886
+ pins?: ThemeConfig['pins'];
887
+ }
888
+ /**
889
+ * Where the derivation reads a style differently from its tradition. Kept
890
+ * short on purpose: every entry is a judgement the data cannot express.
891
+ */
892
+ export declare const PRINT_THEME_OVERRIDES: Partial<Record<PrintPresetName, PrintThemeOverride>>;
893
+ /** The colour moved along OKLCH lightness (hue and chroma kept) until it reaches `min` against `over`. */
894
+ export declare function legibleOn(colour: string, over: string, min?: number): string;
895
+ /**
896
+ * The accent that represents a style, before any legibility adjustment: the
897
+ * first chromatic accent that nearly reads on the paper (3:1), else the most
898
+ * legible chromatic accent, else the first chromatic ornament, else the ink
899
+ * (or, on dark paper, the paper itself).
900
+ */
901
+ export declare function printStyleAccent(style: PrintStyle): string;
902
+ /**
903
+ * The UI theme of a book style, in light and dark. The name is
904
+ * `print-<style name>`; the label is the style's own.
905
+ */
906
+ export declare function printStyleToTheme(style: PrintStyle, override?: PrintThemeOverride): ThemeConfig;
907
+ /**
908
+ * Exact print colours the derivation had to give up for contrast, per mode
909
+ * (role -> the print colour that was dropped and regenerated).
910
+ */
911
+ export declare function printThemeDroppedPins(style: PrintStyle, override?: PrintThemeOverride): Record<Mode, Partial<Record<RoleName, string>>>;
912
+ /** Every book style as a UI theme, in the order of `printPresets`. */
913
+ export declare const printThemePresets: readonly ThemeConfig[];
914
+ /**
915
+ * Legacy: Google Fonts stylesheet URL of the families of each print theme, by
916
+ * theme name. The print theme sheets now declare the bundled fonts
917
+ * (`printThemeFontSpecs`), so ThemeProvider needs no `fonts` map; this stays
918
+ * for hosts that prefer Google's CDN.
919
+ */
920
+ export declare const printThemeFontUrls: Readonly<Record<string, string>>;
921
+ /**
922
+ * Google Fonts specs of each print theme, by theme name: the families its
923
+ * stacks name, bundled under fonts/ and declared in the theme's sheet.
924
+ */
925
+ export declare const printThemeFontSpecs: Readonly<Record<string, readonly string[]>>;
926
+ //#endregion
728
927
  //#region src/index.d.ts
729
928
  export declare const allThemes: readonly ThemeConfig[];
730
929
  //#endregion