@datatechsolutions/tympan 0.3.1 → 0.4.1

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/README.md CHANGED
@@ -39,15 +39,40 @@ the tokens without components can import `@datatechsolutions/tympan-tokens/token
39
39
  **Print styles as themes (opt-in).** Every book style of
40
40
  `@datatechsolutions/tympan-print` is also a UI theme named `print-<style>`
41
41
  (palette, typography, radius and surface treatment of the style, light and
42
- dark, WCAG AA). They are not in `styles.css`; load them after it and pass the
43
- font map so the style's families load with the theme:
42
+ dark, WCAG AA). They are not in `styles.css`; load them after it. Each
43
+ sheet carries the `@font-face` rules of its style's families, served from the
44
+ tokens package, so no font map is needed:
44
45
 
45
46
  ```tsx
46
47
  import '@datatechsolutions/tympan/styles.css'
47
48
  import '@datatechsolutions/tympan-tokens/print-themes.css' // or print-themes/print-<style>.css for one
48
- import { printThemeFontUrls } from '@datatechsolutions/tympan-tokens'
49
49
 
50
- <ThemeProvider theme="print-minimo-de-tinta" fonts={printThemeFontUrls}>…</ThemeProvider>
50
+ <ThemeProvider theme="print-minimo-de-tinta">…</ThemeProvider>
51
+ ```
52
+
53
+ **Fonts come in the package.** Every family a Tympan theme names (Source
54
+ Serif 4, IBM Plex Sans and Mono, the Noto families of each script and the
55
+ families of the print themes) is bundled as woff2 in
56
+ `@datatechsolutions/tympan-tokens/fonts/` (SIL OFL 1.1). `styles.css` starts
57
+ with `@import '@datatechsolutions/tympan-tokens/fonts.css'`, which your
58
+ bundler (Vite, webpack, Parcel …) resolves and whose font URLs it rebases and
59
+ emits as assets. A face is downloaded only when text uses it and falls in its
60
+ `unicode-range`, so a Latin-only page fetches a few Latin slices and nothing
61
+ goes to Google Fonts or any other third party at runtime (CSP needs only
62
+ `font-src 'self'`). Serving `styles.css` without a bundler, copy
63
+ `node_modules/@datatechsolutions/tympan-tokens/{dist,fonts}` side by side and
64
+ point the import at that `dist/fonts.css`, or drop the line to fall back to
65
+ system faces.
66
+
67
+ **CJK fonts are optional.** The Japanese, Chinese and Korean Noto families
68
+ (about 41 MB) are not in `tympan-tokens`; without them CJK text uses the
69
+ system faces (macOS and Windows have them). To bundle them, install
70
+ `@datatechsolutions/tympan-fonts-cjk` and import its sheet once, next to
71
+ `styles.css`:
72
+
73
+ ```tsx
74
+ import '@datatechsolutions/tympan/styles.css'
75
+ import '@datatechsolutions/tympan-fonts-cjk/fonts.css'
51
76
  ```
52
77
 
53
78
  Print styles renamed to neutral ids keep their old theme names as deprecated
@@ -142,12 +167,13 @@ export function App() {
142
167
  `dark`) and `data-ty-density` (`compact`, `default`, `comfortable`) on
143
168
  `<html>` (or on a wrapper with `target="scope"`). Persistence belongs to the
144
169
  host: pass controlled values and callbacks, or `storageKey` for localStorage.
145
- `fonts` (theme name to stylesheet URL, e.g. `printThemeFontUrls`) adds the
146
- font link of the current theme.
170
+ The fonts of every built-in and print theme are bundled (above); the
171
+ optional `fonts` prop (theme name to stylesheet URL) adds a `<link>` for
172
+ extra fonts of the host's own themes and loads nothing by default.
147
173
  - **No flash of the wrong theme (SPA)**: put the output of
148
174
  `themeInitScript('ty-theme')` in an inline `<script>` in `<head>`, before the
149
175
  stylesheet; it sets the three attributes from storage before first paint
150
- (`themeInitScript(key, defaults, { fonts })` also adds the theme's font link).
176
+ (`themeInitScript(key, defaults, { fonts })` also adds a host font link, if you pass one).
151
177
  The gallery's `vite.config.ts` shows it with a `transformIndexHtml` hook.
152
178
  - **`ThemeScope`**: applies a theme/mode/density to a subtree (previews).
153
179
  - **`variants()`**: variants declared as data; returns `data-*` attributes the
@@ -8,6 +8,13 @@ and `@datatechsolutions/tympan-tokens` are licensed under FSL-1.1-ALv2
8
8
  below, except the flag artwork of flag-icons, which is bundled (see
9
9
  "Bundled artwork"). Versions are those resolved on 2026-09-26.
10
10
 
11
+ ## Bundled fonts
12
+
13
+ `dist/styles.css` imports `@datatechsolutions/tympan-tokens/fonts.css`; the
14
+ font files themselves (97 families, SIL OFL 1.1, from Google Fonts) ship in
15
+ `@datatechsolutions/tympan-tokens/fonts/`, listed with their versions and
16
+ licences in that package's `THIRD_PARTY_NOTICES.md` and `fonts/manifest.json`.
17
+
11
18
  ## Runtime dependencies
12
19
 
13
20
  | Package | Version | Licence | Use |
@@ -2227,6 +2227,26 @@ const coreEs = {
2227
2227
  placeholder: "Seleccione…",
2228
2228
  done: "Listo"
2229
2229
  },
2230
+ calendar: {
2231
+ previousMonth: (target) => `Mes anterior, ${target}`,
2232
+ nextMonth: (target) => `Mes siguiente, ${target}`,
2233
+ monthPicker: "Mes",
2234
+ yearPicker: "Año"
2235
+ },
2236
+ dateRangeField: {
2237
+ start: "Fecha inicial",
2238
+ end: "Fecha final",
2239
+ presets: "Períodos rápidos",
2240
+ apply: "Aplicar",
2241
+ cancel: "Cancelar",
2242
+ endBeforeStart: "La fecha final es anterior a la fecha inicial.",
2243
+ tooManyDays: (max) => `El período es más largo que ${es.n(max)} ${es.word(max, {
2244
+ one: "día",
2245
+ other: "días"
2246
+ })}.`,
2247
+ unavailableDay: "El período incluye un día que no se puede elegir.",
2248
+ outOfBounds: "El período incluye un día fuera de las fechas permitidas."
2249
+ },
2230
2250
  notice: { toneWord: {
2231
2251
  danger: "Error:",
2232
2252
  warning: "Atención:",
@@ -2380,6 +2400,26 @@ const defaultMessages = {
2380
2400
  placeholder: "Select…",
2381
2401
  done: "Done"
2382
2402
  },
2403
+ calendar: {
2404
+ previousMonth: (target) => `Previous month, ${target}`,
2405
+ nextMonth: (target) => `Next month, ${target}`,
2406
+ monthPicker: "Month",
2407
+ yearPicker: "Year"
2408
+ },
2409
+ dateRangeField: {
2410
+ start: "Start date",
2411
+ end: "End date",
2412
+ presets: "Presets",
2413
+ apply: "Apply",
2414
+ cancel: "Cancel",
2415
+ endBeforeStart: "The end date is before the start date.",
2416
+ tooManyDays: (max) => `The range is longer than ${en.n(max)} ${en.word(max, {
2417
+ one: "day",
2418
+ other: "days"
2419
+ })}.`,
2420
+ unavailableDay: "The range includes a day that cannot be chosen.",
2421
+ outOfBounds: "The range includes a day outside the allowed dates."
2422
+ },
2383
2423
  notice: { toneWord: {
2384
2424
  danger: "Error:",
2385
2425
  warning: "Warning:",
@@ -2530,6 +2570,26 @@ const messagesPtBR = {
2530
2570
  placeholder: "Selecione…",
2531
2571
  done: "Concluir"
2532
2572
  },
2573
+ calendar: {
2574
+ previousMonth: (target) => `Mês anterior, ${target}`,
2575
+ nextMonth: (target) => `Próximo mês, ${target}`,
2576
+ monthPicker: "Mês",
2577
+ yearPicker: "Ano"
2578
+ },
2579
+ dateRangeField: {
2580
+ start: "Data inicial",
2581
+ end: "Data final",
2582
+ presets: "Períodos rápidos",
2583
+ apply: "Aplicar",
2584
+ cancel: "Cancelar",
2585
+ endBeforeStart: "A data final é anterior à data inicial.",
2586
+ tooManyDays: (max) => `O período é maior que ${pt.n(max)} ${pt.word(max, {
2587
+ one: "dia",
2588
+ other: "dias"
2589
+ })}.`,
2590
+ unavailableDay: "O período inclui um dia que não pode ser escolhido.",
2591
+ outOfBounds: "O período inclui um dia fora das datas permitidas."
2592
+ },
2533
2593
  notice: { toneWord: {
2534
2594
  danger: "Erro:",
2535
2595
  warning: "Atenção:",
@@ -2812,4 +2872,4 @@ function Avatar({ src, fallbackText, name, decorative = false, actorKind = "pers
2812
2872
  //#endregion
2813
2873
  export { catalogueForLocale as a, messagesEs as c, compileIcuMessages as d, pseudoLocalize as f, substitute as h, useMessages as i, messagesPtBR as l, formatMessage as m, devWarning as n, defaultMessages as o, pseudoString as p, TympanProvider as r, mergeMessages as s, Avatar as t, shippedCatalogues as u };
2814
2874
 
2815
- //# sourceMappingURL=Avatar-P14MVkK1.js.map
2875
+ //# sourceMappingURL=Avatar-CU7B1WsX.js.map