@datatechsolutions/tympan-tokens 0.4.2 → 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.
- package/THIRD_PARTY_NOTICES.md +5 -5
- package/dist/fonts.css +80 -80
- package/dist/index.d.ts +229 -55
- package/dist/index.js +359 -16
- package/dist/index.js.map +1 -1
- package/dist/print-themes/print-aquarela.css +7 -7
- package/dist/print-themes/print-art-nouveau.css +2 -2
- package/dist/print-themes/print-atlas-oficial.css +7 -7
- package/dist/print-themes/print-azulejo-modernista.css +2 -2
- package/dist/print-themes/print-bauhaus.css +2 -2
- package/dist/print-themes/print-blocos-coloridos.css +5 -5
- package/dist/print-themes/print-brutalista.css +8 -8
- package/dist/print-themes/print-caderno.css +14 -14
- package/dist/print-themes/print-cartao-postal.css +5 -5
- package/dist/print-themes/print-cientifico.css +3 -3
- package/dist/print-themes/print-concretismo.css +8 -8
- package/dist/print-themes/print-construtivismo.css +6 -6
- package/dist/print-themes/print-cordel.css +6 -6
- package/dist/print-themes/print-dados-br.css +12 -12
- package/dist/print-themes/print-dashboard.css +18 -18
- package/dist/print-themes/print-diagrama-modernista.css +3 -3
- package/dist/print-themes/print-divulgacao.css +3 -3
- package/dist/print-themes/print-fluxo-historico.css +3 -3
- package/dist/print-themes/print-grade-holandesa.css +2 -2
- package/dist/print-themes/print-graficos-1900.css +6 -6
- package/dist/print-themes/print-infografico-ilustrado.css +6 -6
- package/dist/print-themes/print-isotype.css +2 -2
- package/dist/print-themes/print-jornal-1959.css +5 -5
- package/dist/print-themes/print-jornal.css +6 -6
- package/dist/print-themes/print-mapa-de-metro.css +1 -1
- package/dist/print-themes/print-memphis.css +5 -5
- package/dist/print-themes/print-minimo-de-tinta.css +4 -4
- package/dist/print-themes/print-papel-recortado.css +2 -2
- package/dist/print-themes/print-papel-salmao.css +6 -6
- package/dist/print-themes/print-pictogramas.css +2 -2
- package/dist/print-themes/print-pop-art.css +2 -2
- package/dist/print-themes/print-prancheta-clara.css +5 -5
- package/dist/print-themes/print-prancheta.css +5 -5
- package/dist/print-themes/print-proporcao-modular.css +2 -2
- package/dist/print-themes/print-riso.css +4 -4
- package/dist/print-themes/print-semanario.css +13 -13
- package/dist/print-themes/print-sinalizacao.css +8 -8
- package/dist/print-themes/print-suico.css +4 -4
- package/dist/print-themes/print-tropicalia.css +3 -3
- package/dist/print-themes.css +133 -133
- package/fonts/ibmplexsans/ibmplexsans-italic-cyrillic-400_500_600.woff2 +0 -0
- package/fonts/ibmplexsans/ibmplexsans-italic-cyrillic-ext-400_500_600.woff2 +0 -0
- package/fonts/ibmplexsans/ibmplexsans-italic-greek-400_500_600.woff2 +0 -0
- package/fonts/ibmplexsans/ibmplexsans-italic-latin-400_500_600.woff2 +0 -0
- package/fonts/ibmplexsans/ibmplexsans-italic-latin-ext-400_500_600.woff2 +0 -0
- package/fonts/ibmplexsans/ibmplexsans-italic-vietnamese-400_500_600.woff2 +0 -0
- package/fonts/manifest.json +998 -820
- package/fonts/nunitosans/nunitosans-normal-cyrillic-400_600_700_800.woff2 +0 -0
- package/fonts/nunitosans/nunitosans-normal-cyrillic-ext-400_600_700_800.woff2 +0 -0
- package/fonts/nunitosans/nunitosans-normal-latin-400_600_700_800.woff2 +0 -0
- package/fonts/nunitosans/nunitosans-normal-latin-ext-400_600_700_800.woff2 +0 -0
- package/fonts/nunitosans/nunitosans-normal-vietnamese-400_600_700_800.woff2 +0 -0
- package/fonts/sourceserif4/sourceserif4-italic-cyrillic-400_600.woff2 +0 -0
- package/fonts/sourceserif4/sourceserif4-italic-cyrillic-ext-400_600.woff2 +0 -0
- package/fonts/sourceserif4/sourceserif4-italic-greek-400_600.woff2 +0 -0
- package/fonts/sourceserif4/sourceserif4-italic-latin-400_600.woff2 +0 -0
- package/fonts/sourceserif4/sourceserif4-italic-latin-ext-400_600.woff2 +0 -0
- package/fonts/sourceserif4/sourceserif4-italic-vietnamese-400_600.woff2 +0 -0
- package/package.json +1 -1
- package/src/fonts.ts +2 -2
- package/src/index.ts +1 -0
- package/src/print-book-themes.ts +239 -0
- package/src/print-presets.ts +220 -10
- /package/fonts/ibmplexsans/{ibmplexsans-italic-cyrillic.woff2 → ibmplexsans-italic-cyrillic-400.woff2} +0 -0
- /package/fonts/ibmplexsans/{ibmplexsans-italic-cyrillic-ext.woff2 → ibmplexsans-italic-cyrillic-ext-400.woff2} +0 -0
- /package/fonts/ibmplexsans/{ibmplexsans-italic-greek.woff2 → ibmplexsans-italic-greek-400.woff2} +0 -0
- /package/fonts/ibmplexsans/{ibmplexsans-italic-latin.woff2 → ibmplexsans-italic-latin-400.woff2} +0 -0
- /package/fonts/ibmplexsans/{ibmplexsans-italic-latin-ext.woff2 → ibmplexsans-italic-latin-ext-400.woff2} +0 -0
- /package/fonts/ibmplexsans/{ibmplexsans-italic-vietnamese.woff2 → ibmplexsans-italic-vietnamese-400.woff2} +0 -0
- /package/fonts/sourceserif4/{sourceserif4-italic-cyrillic.woff2 → sourceserif4-italic-cyrillic-400.woff2} +0 -0
- /package/fonts/sourceserif4/{sourceserif4-italic-cyrillic-ext.woff2 → sourceserif4-italic-cyrillic-ext-400.woff2} +0 -0
- /package/fonts/sourceserif4/{sourceserif4-italic-greek.woff2 → sourceserif4-italic-greek-400.woff2} +0 -0
- /package/fonts/sourceserif4/{sourceserif4-italic-latin.woff2 → sourceserif4-italic-latin-400.woff2} +0 -0
- /package/fonts/sourceserif4/{sourceserif4-italic-latin-ext.woff2 → sourceserif4-italic-latin-ext-400.woff2} +0 -0
- /package/fonts/sourceserif4/{sourceserif4-italic-vietnamese.woff2 → sourceserif4-italic-vietnamese-400.woff2} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -374,7 +374,9 @@ export type RenderizadorGrafico = 'limpo' | 'mao' | 'isotype' | 'gravura' | 'pra
|
|
|
374
374
|
export type MarcaProva = 'pilula' | 'carimbo' | 'circulo' | 'sublinhado' | 'barra' | 'etiqueta' | 'formas' | 'ponto';
|
|
375
375
|
export type EstadoProva = 'sustentada' | 'refutada' | 'nao-da-para-afirmar' | 'pendente' | 'sem-dado' | 'nao-testada';
|
|
376
376
|
export declare const ESTADOS_PROVA: readonly EstadoProva[];
|
|
377
|
-
/** The word printed for each proof state (
|
|
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. */
|
|
378
380
|
export declare const ROTULOS_PROVA: Record<EstadoProva, string>;
|
|
379
381
|
export interface PrintFontes {
|
|
380
382
|
titulo: string;
|
|
@@ -397,6 +399,16 @@ export interface PrintCores {
|
|
|
397
399
|
prova: Record<EstadoProva, string>;
|
|
398
400
|
/** Colours of page ornaments only (frames, tiles, waves); never data. Up to four. */
|
|
399
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[];
|
|
400
412
|
}
|
|
401
413
|
/** Partial colours: any role, and any subset of the proof states. */
|
|
402
414
|
export type PrintCoresParciais = Partial<Omit<PrintCores, 'prova'>> & {
|
|
@@ -480,6 +492,16 @@ export interface PrintEstrutura {
|
|
|
480
492
|
*/
|
|
481
493
|
realce?: 'serie' | 'linha';
|
|
482
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;
|
|
483
505
|
cabecaMultiplo?: 'titulo' | 'faixa' | 'faixa-escura' | 'faixa-cor' | 'caixa-cor';
|
|
484
506
|
}
|
|
485
507
|
/**
|
|
@@ -503,7 +525,7 @@ export type Emblema = 'pictogramas' | 'formas' | 'circulo-bicolor' | 'figura-mod
|
|
|
503
525
|
export type FormaGrafico = 'barras' | 'colunas' | 'eixo-central' | 'ziguezague' | 'fluxo' | 'predios' | 'cartoes' | 'halteres';
|
|
504
526
|
/** Page ornaments (optional, CONTRATO §1). */
|
|
505
527
|
export type Moldura = 'nenhuma' | 'dupla' | 'regua' | 'azulejo' | 'ondas' | 'ramos' | 'recortes' | 'reticula' | 'memphis' | 'diagonais' | 'formas' | 'quartos';
|
|
506
|
-
export interface PrintStyle {
|
|
528
|
+
export interface PrintStyle extends PrintTemaExtras {
|
|
507
529
|
/** Stable id, e.g. 'jornal'. */
|
|
508
530
|
name: string;
|
|
509
531
|
/** Human label, e.g. "Editorial de jornal". */
|
|
@@ -541,9 +563,89 @@ export interface PrintStyle {
|
|
|
541
563
|
* has approved variations (ink, duotone, per style), see LogoDatatech.
|
|
542
564
|
*/
|
|
543
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>;
|
|
544
646
|
}
|
|
545
647
|
/** Any token of a style may be overridden by the editor (partial, nested). */
|
|
546
|
-
export interface PrintStyleOverrides {
|
|
648
|
+
export interface PrintStyleOverrides extends PrintTemaExtras {
|
|
547
649
|
label?: string;
|
|
548
650
|
fontes?: Partial<PrintFontes>;
|
|
549
651
|
googleFonts?: string[];
|
|
@@ -557,6 +659,7 @@ export interface PrintStyleOverrides {
|
|
|
557
659
|
pb?: PrintCoresParciais;
|
|
558
660
|
estrutura?: Partial<PrintEstrutura>;
|
|
559
661
|
logo?: 'cor' | 'mono';
|
|
662
|
+
texto?: PrintTexto;
|
|
560
663
|
}
|
|
561
664
|
/** The 39 book styles, by name. */
|
|
562
665
|
export declare const printPresets: {
|
|
@@ -633,6 +736,20 @@ export interface PrintCssOptions {
|
|
|
633
736
|
* current style (`resolvePrintStyle('economist').name === 'semanario'`).
|
|
634
737
|
*/
|
|
635
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[];
|
|
636
753
|
/** Custom properties of a resolved style, in a stable order. */
|
|
637
754
|
export declare function printStyleVariables(style: PrintStyle): Array<[string, string]>;
|
|
638
755
|
/**
|
|
@@ -646,58 +763,6 @@ export declare function googleFontsUrl(style: Pick<PrintStyle, 'googleFonts'>):
|
|
|
646
763
|
/** True when the paper is dark (the brand seal and logo then use the light mono version). */
|
|
647
764
|
export declare function papelEscuro(style: Pick<PrintStyle, 'cor'>): boolean;
|
|
648
765
|
//#endregion
|
|
649
|
-
//#region src/print-themes.d.ts
|
|
650
|
-
/** Per-style adjustments where the derivation misjudges; merged over the derived config. */
|
|
651
|
-
export interface PrintThemeOverride {
|
|
652
|
-
/** Brand colour to use instead of the derived one. */
|
|
653
|
-
brand?: string;
|
|
654
|
-
glass?: boolean;
|
|
655
|
-
cta?: ThemeConfig['cta'];
|
|
656
|
-
elevation?: ThemeConfig['elevation'];
|
|
657
|
-
/** Radius in px. */
|
|
658
|
-
radius?: number;
|
|
659
|
-
/** Extra pins per mode (applied before the contrast check, dropped if they fail like any pin). */
|
|
660
|
-
pins?: ThemeConfig['pins'];
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Where the derivation reads a style differently from its tradition. Kept
|
|
664
|
-
* short on purpose: every entry is a judgement the data cannot express.
|
|
665
|
-
*/
|
|
666
|
-
export declare const PRINT_THEME_OVERRIDES: Partial<Record<PrintPresetName, PrintThemeOverride>>;
|
|
667
|
-
/** The colour moved along OKLCH lightness (hue and chroma kept) until it reaches `min` against `over`. */
|
|
668
|
-
export declare function legibleOn(colour: string, over: string, min?: number): string;
|
|
669
|
-
/**
|
|
670
|
-
* The accent that represents a style, before any legibility adjustment: the
|
|
671
|
-
* first chromatic accent that nearly reads on the paper (3:1), else the most
|
|
672
|
-
* legible chromatic accent, else the first chromatic ornament, else the ink
|
|
673
|
-
* (or, on dark paper, the paper itself).
|
|
674
|
-
*/
|
|
675
|
-
export declare function printStyleAccent(style: PrintStyle): string;
|
|
676
|
-
/**
|
|
677
|
-
* The UI theme of a book style, in light and dark. The name is
|
|
678
|
-
* `print-<style name>`; the label is the style's own.
|
|
679
|
-
*/
|
|
680
|
-
export declare function printStyleToTheme(style: PrintStyle, override?: PrintThemeOverride): ThemeConfig;
|
|
681
|
-
/**
|
|
682
|
-
* Exact print colours the derivation had to give up for contrast, per mode
|
|
683
|
-
* (role -> the print colour that was dropped and regenerated).
|
|
684
|
-
*/
|
|
685
|
-
export declare function printThemeDroppedPins(style: PrintStyle, override?: PrintThemeOverride): Record<Mode, Partial<Record<RoleName, string>>>;
|
|
686
|
-
/** Every book style as a UI theme, in the order of `printPresets`. */
|
|
687
|
-
export declare const printThemePresets: readonly ThemeConfig[];
|
|
688
|
-
/**
|
|
689
|
-
* Legacy: Google Fonts stylesheet URL of the families of each print theme, by
|
|
690
|
-
* theme name. The print theme sheets now declare the bundled fonts
|
|
691
|
-
* (`printThemeFontSpecs`), so ThemeProvider needs no `fonts` map; this stays
|
|
692
|
-
* for hosts that prefer Google's CDN.
|
|
693
|
-
*/
|
|
694
|
-
export declare const printThemeFontUrls: Readonly<Record<string, string>>;
|
|
695
|
-
/**
|
|
696
|
-
* Google Fonts specs of each print theme, by theme name: the families its
|
|
697
|
-
* stacks name, bundled under fonts/ and declared in the theme's sheet.
|
|
698
|
-
*/
|
|
699
|
-
export declare const printThemeFontSpecs: Readonly<Record<string, readonly string[]>>;
|
|
700
|
-
//#endregion
|
|
701
766
|
//#region src/fonts.d.ts
|
|
702
767
|
/** Base stacks of every preset: Source Serif 4, IBM Plex Sans, IBM Plex Mono. */
|
|
703
768
|
export declare const BASE_FONT_SPECS: readonly string[];
|
|
@@ -750,6 +815,115 @@ export interface FontManifest {
|
|
|
750
815
|
*/
|
|
751
816
|
export declare function fontFaceCss(manifest: FontManifest, specs: readonly string[], base: string): string;
|
|
752
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
|
|
753
927
|
//#region src/index.d.ts
|
|
754
928
|
export declare const allThemes: readonly ThemeConfig[];
|
|
755
929
|
//#endregion
|