@massimo-cassandro/minimo 1.41.3 → 1.41.5

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 (133) hide show
  1. package/README.md +12 -12
  2. package/charts/src/node-helpers/create-svg-canvas-node.mjs +2 -2
  3. package/charts/src/node-helpers/svg-text-to-path.js +9 -9
  4. package/charts/src/rating-display/index.js +1 -1
  5. package/charts/src/rating-display/ratindDisplayAnimation.js +3 -3
  6. package/design-tokens/README.md +2 -2
  7. package/design-tokens/_src/_readme.md +26 -26
  8. package/dev-tools/README.md +16 -16
  9. package/dev-tools/create-favicons/README.md +31 -31
  10. package/dev-tools/create-favicons/src/create-ico.mjs +2 -2
  11. package/dev-tools/create-favicons/src/default-params.mjs +1 -1
  12. package/dev-tools/create-favicons/src/init.mjs +1 -1
  13. package/dev-tools/design-tokens-builder/README.md +102 -102
  14. package/dev-tools/design-tokens-builder/build-tokens-src/build-source-modes.mjs +85 -73
  15. package/dev-tools/design-tokens-builder/build-tokens-src/config.mjs +109 -85
  16. package/dev-tools/design-tokens-builder/build-tokens-src/formats/css.mjs +113 -90
  17. package/dev-tools/design-tokens-builder/build-tokens-src/formats/json.mjs +107 -95
  18. package/dev-tools/design-tokens-builder/build-tokens-src/legacy-tokens-parser.mjs +71 -64
  19. package/dev-tools/design-tokens-builder/build-tokens-src/light-dark.mjs +75 -65
  20. package/dev-tools/design-tokens-builder/build-tokens-src/merge-css.mjs +113 -102
  21. package/dev-tools/design-tokens-builder/build-tokens-src/platforms.mjs +36 -30
  22. package/dev-tools/design-tokens-builder/build-tokens-src/resolve-source-paths.mjs +15 -13
  23. package/dev-tools/design-tokens-builder/build-tokens-src/source-prefixes.mjs +44 -42
  24. package/dev-tools/design-tokens-builder/build-tokens-src/source-transforms.mjs +89 -83
  25. package/dev-tools/design-tokens-builder/build-tokens-src/token-rename-parser.mjs +99 -86
  26. package/dev-tools/design-tokens-builder/build-tokens-src/transforms.mjs +64 -48
  27. package/dev-tools/design-tokens-builder/build-tokens.mjs +80 -68
  28. package/dev-tools/design-tokens-builder/check-unresolved-custom-props.mjs +103 -77
  29. package/dev-tools/design-tokens-builder/tokens-config-sample.mjs +275 -238
  30. package/dev-tools/find-orphan-css-classes/find-orphan-css-classes.mjs +2 -2
  31. package/dev-tools/starter-kit/source_files/app/CLAUDE.md +4 -2
  32. package/dev-tools/starter-kit/source_files/app/index.css +10 -0
  33. package/dev-tools/starter-kit/source_files/app/index.js +1 -1
  34. package/dev-tools/starter-kit/source_files/root/_sf/controller/ImgViewerController.php +3 -3
  35. package/dev-tools/starter-kit/source_files/root/_sf/controller/ViewerController.php +2 -2
  36. package/dev-tools/starter-kit/source_files/root/stylelint.config.mjs +1 -1
  37. package/dev-tools/starter-kit/source_files/root/webpack-config-modules/css-rules.mjs +1 -1
  38. package/dev-tools/starter-kit/starter-install.sh +2 -2
  39. package/dev-tools/stylelint-config/README.md +7 -7
  40. package/dev-tools/svg-icons-tools/README.md +32 -32
  41. package/dev-tools/svg-icons-tools/src/config-manager.mjs +1 -1
  42. package/dev-tools/svg-icons-tools/src/default-config.mjs +118 -118
  43. package/dev-tools/svg-icons-tools/src/jsx-icon-file-builder.mjs +24 -24
  44. package/dev-tools/svg-icons-tools/src/parse-svg-filename.mjs +3 -3
  45. package/dev-tools/svg-icons-tools/src/parse-svg-files.mjs +1 -1
  46. package/dev-tools/svg-icons-tools/src/parse-svg-markup.mjs +4 -4
  47. package/dev-tools/svg-icons-tools/src/svg-to-jsx.mjs +2 -2
  48. package/dev-tools/svg-icons-tools/src/svg-to-optimized.mjs +2 -2
  49. package/dev-tools/svg-icons-tools/src/svg-to-symbols.mjs +2 -2
  50. package/dev-tools/upd@m/README.md +1 -1
  51. package/dev-tools/upd@m/index.mjs +1 -1
  52. package/dev-tools/update-version/README.md +9 -9
  53. package/index.js +1 -0
  54. package/package.json +3 -1
  55. package/snippets/unsplash-browser-app/README.md +1 -1
  56. package/snippets/unsplash-browser-app/unsplash-utilities.js +9 -9
  57. package/src/components/autocomplete/README.md +3 -3
  58. package/src/components/autocomplete/autocomplete-engine.js +75 -63
  59. package/src/components/autocomplete/check-autocomplete.js +3 -3
  60. package/src/components/dismiss-alerts.js +3 -3
  61. package/src/components/form-reset-submit.js +6 -6
  62. package/src/components/inner-nav/inner-nav.js +2 -2
  63. package/src/components/modal-alert/modal-alert.js +67 -65
  64. package/src/components/modal-alert/modal-alert.minimo.tokens.mjs +1 -1
  65. package/src/components/modal-popup/modal-popup.js +56 -56
  66. package/src/components/overlay/overlay.js +3 -3
  67. package/src/components/sf-macro/readme.md +1 -1
  68. package/src/components/sf-macro/sf-macro.js +27 -23
  69. package/src/components/slide-up-down-toggle/slide-up-down-toggle.js +83 -79
  70. package/src/components/slide-up-down-toggle/slide-up-down-toggle.module.css +44 -44
  71. package/src/components/snackbar/snackbar.js +19 -19
  72. package/src/components/spinner/spinner.js +3 -3
  73. package/src/components/unsplash-page/README.md +8 -8
  74. package/src/components/unsplash-page/fetch-unsplash-data.js +3 -3
  75. package/src/components/unsplash-page/unsplash-page.js +33 -33
  76. package/src/components/unsplash-page/unsplash-page.module.css +1 -1
  77. package/src/css/alerts.css +2 -2
  78. package/src/css/forms/forms.css +4 -4
  79. package/src/css/forms/validation.css +1 -1
  80. package/src/css/margin-padding-media.css +4 -4
  81. package/src/css/margin-padding.css +4 -4
  82. package/src/css/reset.css +11 -11
  83. package/src/icons/read-me.md +1 -1
  84. package/src/minimo.css +3 -9
  85. package/src/utilities/better-text-with-places.js +105 -105
  86. package/src/utilities/better-text.js +42 -35
  87. package/src/utilities/classnames.js +8 -8
  88. package/src/utilities/cookies.js +6 -6
  89. package/src/utilities/create-id.js +3 -3
  90. package/src/utilities/disable-btns-on-submit.js +2 -2
  91. package/src/utilities/dom-builder/dom-builder.js +89 -86
  92. package/src/utilities/dom-builder/domBuilderBasicSetup.js +9 -9
  93. package/src/utilities/dom-builder/parseDomString.js +23 -23
  94. package/src/utilities/dom-builder-helpers/README.md +2 -2
  95. package/src/utilities/dom-builder-helpers/form-tags.js +100 -100
  96. package/src/utilities/dom-builder-helpers/picture-tag.js +39 -39
  97. package/src/utilities/enable-submit-btns.js +1 -1
  98. package/src/utilities/escape-html.js +2 -2
  99. package/src/utilities/generate-pwd.js +4 -4
  100. package/src/utilities/linked-dates.js +13 -13
  101. package/src/utilities/parse-file-size.js +6 -6
  102. package/src/utilities/random-id.js +3 -3
  103. package/src/utilities/relative-date.js +40 -40
  104. package/src/utilities/sentence-case.js +1 -1
  105. package/src/utilities/strip-tags.js +1 -1
  106. package/src/utilities/title-case.js +1 -1
  107. package/src/utilities/truncate-string.js +5 -5
  108. package/src/utilities/validation-error-class.js +12 -12
  109. package/src/web-components/json-table/json-table-component.js +123 -121
  110. package/src/web-components/json-table/json-table-component.module.css +6 -6
  111. package/src/web-components/json-table/json-table.minimo.tokens.mjs +6 -6
  112. package/src/web-components/json-table/readme.md +76 -110
  113. package/src/web-components/json-table/src/cell-content.js +25 -25
  114. package/src/web-components/json-table/src/content-utils.js +21 -21
  115. package/src/web-components/json-table/src/data-types.js +32 -32
  116. package/src/web-components/json-table/src/defaults.js +230 -191
  117. package/src/web-components/json-table/src/get-data.js +55 -38
  118. package/src/web-components/json-table/src/icons.js +17 -17
  119. package/src/web-components/json-table/src/info-section.js +18 -18
  120. package/src/web-components/json-table/src/main-builder.js +45 -45
  121. package/src/web-components/json-table/src/pagination.js +32 -32
  122. package/src/web-components/json-table/src/parse-cols.js +18 -18
  123. package/src/web-components/json-table/src/parse-rows.js +17 -17
  124. package/src/web-components/json-table/src/resolve-params.js +53 -41
  125. package/src/web-components/json-table/src/search.js +13 -13
  126. package/src/web-components/json-table/src/sorting.js +20 -20
  127. package/src/web-components/json-table/src/table-body.js +13 -13
  128. package/src/web-components/json-table/src/table-builder.js +34 -34
  129. package/src/web-components/json-table/src/table-tfoot.js +8 -8
  130. package/src/web-components/json-table/src/table-thead.js +21 -21
  131. package/src/web-components/json-table/src/update-info.js +11 -11
  132. package/types/classes.d.ts +2 -2
  133. package/types/global.d.ts +18 -12
@@ -2,30 +2,30 @@
2
2
 
3
3
  <!-- TODO rivedere e semplificare -->
4
4
 
5
- A set of Node.js scripts for managing CSS design tokens in a project. Built on top of [Style Dictionary v5](https://styledictionary.com/).
5
+ Un insieme di script Node.js per gestire i design token CSS di un progetto. Costruito su [Style Dictionary v5](https://styledictionary.com/).
6
6
 
7
- ### Purpose
7
+ ### Scopo
8
8
 
9
- The purpose of this builder is to merge minimo's own design tokens with the tokens used in a project — typically coming from Figma or Penpot — and produce the custom properties used during development.
9
+ Lo scopo di questo builder è unire i design token di minimo con quelli usati in un progetto — tipicamente provenienti da Figma o Penpot — e produrre le custom properties usate durante lo sviluppo.
10
10
 
11
- The goal is to keep the project's token naming as close as possible to minimo's own, so that minimo's components can be customized without any further intervention.
11
+ L'obiettivo è mantenere la nomenclatura dei token del progetto il più possibile vicina a quella di minimo, in modo che i componenti di minimo possano essere personalizzati senza ulteriori interventi.
12
12
 
13
- The best strategy is to name variables in Figma/Penpot after minimo's own names from the start, so that overriding a value stays a transparent, automatic process.
13
+ La strategia migliore è dare alle variabili in Figma/Penpot, fin dall'inizio, gli stessi nomi usati da minimo, così che sovrascrivere un valore resti un processo trasparente e automatico.
14
14
 
15
- In a preexisting project, though, some names may not match (e.g. the project's base color is named `primary`, while minimo's equivalent is `primary.100`). Rather than fixing the generated custom properties by hand after every build, a source entry can carry a `transform` option (see [Source token renaming](#source-token-renaming-transform) below) that remaps token names to minimo's own naming before they are even handed to Style Dictionary.
15
+ In un progetto preesistente, però, alcuni nomi potrebbero non corrispondere (ad es. il colore base del progetto si chiama `primary`, mentre l'equivalente di minimo è `primary.100`). Invece di correggere a mano le custom properties generate dopo ogni build, una voce di `source` può avere un'opzione `transform` (vedi [Rinomina dei token sorgente](#rinomina-dei-token-sorgente-transform) più sotto) che rimappa i nomi dei token su quelli di minimo prima ancora che vengano passati a Style Dictionary.
16
16
 
17
- ### Scripts
17
+ ### Script
18
18
 
19
- | Script | Purpose |
19
+ | Script | Scopo |
20
20
  |---|---|
21
- | `build-tokens.mjs` | Generates a CSS custom properties file from design token source files |
22
- | `check-unresolved-custom-props.mjs` | Scans CSS files and reports any `var(--...)` references not found in the generated token file |
21
+ | `build-tokens.mjs` | Genera un file di custom properties CSS a partire dai file sorgente dei design token |
22
+ | `check-unresolved-custom-props.mjs` | Analizza i file CSS e segnala i riferimenti `var(--...)` non presenti nel file dei token generato |
23
23
 
24
- Both scripts share the same config file, passed via `--config`.
24
+ Entrambi gli script condividono lo stesso file di configurazione, passato con `--config`.
25
25
 
26
- ### Setup
26
+ ### Configurazione iniziale
27
27
 
28
- The scripts are intended to be used as npm scripts. Add them to your `package.json`:
28
+ Gli script sono pensati per essere usati come npm script. Aggiungerli al proprio `package.json`:
29
29
 
30
30
  ```json
31
31
  {
@@ -36,9 +36,9 @@ The scripts are intended to be used as npm scripts. Add them to your `package.js
36
36
  }
37
37
  ```
38
38
 
39
- ### Dependencies
39
+ ### Dipendenze
40
40
 
41
- The following packages must be present in your project:
41
+ I seguenti pacchetti devono essere presenti nel progetto:
42
42
 
43
43
  ```json
44
44
  {
@@ -47,43 +47,43 @@ The following packages must be present in your project:
47
47
  }
48
48
  ```
49
49
 
50
- ### Configuration file
50
+ ### File di configurazione
51
51
 
52
- Both scripts read a shared config file passed with `--config`. Use `tokens-config-sample.mjs` as a starting point.
52
+ Entrambi gli script leggono un file di configurazione condiviso passato con `--config`. Usare `tokens-config-sample.mjs` come punto di partenza.
53
53
 
54
- Read comments inside the sample file for more info.
54
+ Per maggiori informazioni leggere i commenti all'interno del file di esempio.
55
55
 
56
56
 
57
57
  ### `build-tokens.mjs`
58
58
 
59
- Reads design token source files and generates:
60
- - A **CSS file** containing all tokens as custom properties inside `:root { ... }`
61
- - Optionally, one or more **W3C DTCG JSON/JSONC** files, independent of any specific consuming tool (usable in Penpot, Figma via plugin, Token Studio, ...).
59
+ Legge i file sorgente dei design token e genera:
60
+ - Un **file CSS** che contiene tutti i token come custom properties dentro `:root { ... }`
61
+ - Opzionalmente, uno o più file **W3C DTCG JSON/JSONC**, indipendenti da qualsiasi strumento specifico (utilizzabili in Penpot, Figma tramite plugin, Token Studio, ...).
62
62
 
63
- #### Usage
63
+ #### Utilizzo
64
64
 
65
65
  ```sh
66
66
  npx buildTokens --config ./path/to/tokens-config.mjs
67
67
  ```
68
68
 
69
- #### Source files
69
+ #### File sorgente
70
70
 
71
- The `source` array accepts any combination of:
72
- - Concrete file paths: `'./tokens/colors.jsonc'`
73
- - Glob patterns: `'./tokens/**/*.{json,jsonc,mjs}'`
74
- - `{ src, prefix, transform }` objects, to add a prefix to the custom properties of those files (see [Source prefixes](#source-prefixes)) and/or to rename token nodes within those files (see [Source token renaming](#source-token-renaming-transform))
71
+ L'array `source` accetta qualsiasi combinazione di:
72
+ - Percorsi di file: `'./tokens/colors.jsonc'`
73
+ - Pattern glob: `'./tokens/**/*.{json,jsonc,mjs}'`
74
+ - Oggetti `{ src, prefix, transform }`, per aggiungere un prefisso alle custom properties di quei file (vedi [Prefissi dei sorgenti](#prefissi-dei-sorgenti)) e/o per rinominare i nodi dei token al loro interno (vedi [Rinomina dei token sorgente](#rinomina-dei-token-sorgente-transform))
75
75
 
76
- **Supported formats:**
77
- - `.json` / `.jsonc` — parsed directly as token data
78
- - `.mjs` / `.js` — imported as ES modules; must export a W3C DTCG-compliant object as `default`
76
+ **Formati supportati:**
77
+ - `.json` / `.jsonc` — letti direttamente come dati dei token
78
+ - `.mjs` / `.js` — importati come moduli ES; devono esportare come `default` un oggetto conforme a W3C DTCG
79
79
 
80
- **Legacy token syntax (auto-detected, `.json` only):** `.json` source files written in the older, non-DTCG Style Dictionary syntax (`value`/`type` instead of `$value`/`$type`, references as `{group.token.value}` instead of `{group.token}` — e.g. a file exported from [Open Props](https://open-props.style/)) are converted to DTCG v5 syntax automatically at parse time, node by node. Files already using `$value`/`$type` are left untouched, so no config flag or file list is needed — mixing legacy and DTCG sources in the same `source` array just works. `.jsonc` is not covered (reserved for hand-authored DTCG sources, parsed by Style Dictionary's own loader) and these `.json` files are parsed with plain `JSON.parse` (no comments, no trailing commas). See `build-tokens-src/legacy-tokens-parser.mjs`.
80
+ **Sintassi legacy dei token (rilevata automaticamente, solo `.json`):** i file sorgente `.json` scritti con la vecchia sintassi di Style Dictionary, non DTCG (`value`/`type` invece di `$value`/`$type`, riferimenti come `{group.token.value}` invece di `{group.token}` — ad es. un file esportato da [Open Props](https://open-props.style/)) vengono convertiti automaticamente alla sintassi DTCG v5 in fase di parsing, nodo per nodo. I file che usano già `$value`/`$type` non vengono toccati, quindi non servono flag di configurazione né elenchi di file: mescolare sorgenti legacy e DTCG nello stesso array `source` funziona senza altro. `.jsonc` non è coperto (riservato ai sorgenti DTCG scritti a mano, letti dal loader di Style Dictionary) e questi file `.json` vengono letti con un semplice `JSON.parse` (niente commenti, niente trailing comma). Vedi `build-tokens-src/legacy-tokens-parser.mjs`.
81
81
 
82
- A legacy node that is at the same time a token (own `value`/`type`) *and* a group with nested children (e.g. Open Props' `other.ease.out`, which has its own value plus `out.1` ... `out.5`) can't be represented in DTCG v5, where a node with `$value` is always a leaf. Its own value is moved to a child token named `default` (`other.ease.out.default`, i.e. `--other-ease-out-default`), or `base` if a `default` child already exists; if both exist the build fails with an explicit error. References to such a node from the same file are rewritten accordingly; from other files they must use the child name explicitly.
82
+ Un nodo legacy che è al tempo stesso un token (con `value`/`type` propri) *e* un gruppo con figli annidati (ad es. `other.ease.out` di Open Props, che ha un valore proprio più `out.1` ... `out.5`) non può essere rappresentato in DTCG v5, dove un nodo con `$value` è sempre una foglia. Il suo valore viene spostato in un token figlio chiamato `default` (`other.ease.out.default`, cioè `--other-ease-out-default`), oppure `base` se esiste già un figlio `default`; se esistono entrambi la build fallisce con un errore esplicito. I riferimenti a un nodo di questo tipo dallo stesso file vengono riscritti di conseguenza; da altri file devono usare esplicitamente il nome del figlio.
83
83
 
84
- #### Source prefixes
84
+ #### Prefissi dei sorgenti
85
85
 
86
- An entry of `source` (or of a `sourceModes` mode) can be an object `{ src, prefix }` instead of a string: every custom property generated from the files matched by `src` (a path, a glob or an array of them) is rendered with the given prefix. Useful to avoid name collisions with third-party token sets, or to make their origin explicit:
86
+ Una voce di `source` (o di una modalità di `sourceModes`) può essere un oggetto `{ src, prefix }` al posto di una stringa: ogni custom property generata dai file individuati da `src` (un percorso, un glob o un array di questi) viene resa con il prefisso indicato. Utile per evitare collisioni di nomi con set di token di terze parti o per rendere esplicita la loro origine:
87
87
 
88
88
  ```js
89
89
  source: [
@@ -92,21 +92,21 @@ source: [
92
92
  ],
93
93
  ```
94
94
 
95
- With this config Open Props' `gray.0` becomes `--op-gray-0`. `prefix` accepts `'op'`, `'op-'` or `'--op-'` (all equivalent).
95
+ Con questa configurazione `gray.0` di Open Props diventa `--op-gray-0`. `prefix` accetta `'op'`, `'op-'` o `'--op-'` (equivalenti).
96
96
 
97
- - Only the custom property **name** changes, not the token path: `{references}` keep working, and a token of another source referencing `{gray.0}` is rendered as `var(--op-gray-0)`.
98
- - The JSON output (`jsonBuildPath`) is **not** prefixed: it keeps the original token tree.
99
- - `customPropsGroups` match the prefixed name, so a group can use `prefixes: ['op']`.
100
- - Giving two different prefixes to the same file fails the build with an error.
101
- - `check-unresolved-custom-props.mjs` understands the same syntax. Note that `extraCustomPropsFiles` entries are plain CSS files and are never prefixed.
97
+ - Cambia solo il **nome** della custom property, non il percorso del token: i `{riferimenti}` continuano a funzionare e un token di un'altra sorgente che referenzia `{gray.0}` viene reso come `var(--op-gray-0)`.
98
+ - L'output JSON (`jsonBuildPath`) **non** viene prefissato: mantiene l'albero dei token originale.
99
+ - `customPropsGroups` confronta il nome prefissato, quindi un gruppo può usare `prefixes: ['op']`.
100
+ - Assegnare due prefissi diversi allo stesso file fa fallire la build con un errore.
101
+ - `check-unresolved-custom-props.mjs` comprende la stessa sintassi. Le voci di `extraCustomPropsFiles` sono semplici file CSS e non vengono mai prefissate.
102
102
 
103
- See `build-tokens-src/source-prefixes.mjs`.
103
+ Vedi `build-tokens-src/source-prefixes.mjs`.
104
104
 
105
- #### Source token renaming (`transform`)
105
+ #### Rinomina dei token sorgente (`transform`)
106
106
 
107
- An entry of `source` (or of a `sourceModes` mode) can also carry a `transform` object: a token found at a given dot-path in those files is moved to another dot-path, **before** Style Dictionary resolves `{references}` or builds the CSS/JSON output — unlike `prefix` above, which is a purely cosmetic CSS name change applied after the fact.
107
+ Una voce di `source` (o di una modalità di `sourceModes`) può avere anche un oggetto `transform`: un token trovato a un dato dot-path in quei file viene spostato in un altro dot-path, **prima** che Style Dictionary risolva i `{riferimenti}` o costruisca l'output CSS/JSON — a differenza di `prefix` visto sopra, che è una modifica puramente estetica del nome CSS applicata a posteriori.
108
108
 
109
- Typical use case: a preexisting project (e.g. driven by Figma/Penpot) names its own base color `primary`, while minimo's own tokens reference `{primary.100}`. Instead of renaming the generated custom property by hand after every build, or hunting down every minimo reference to change it, `transform` fixes the token's own path once, in config:
109
+ Caso d'uso tipico: un progetto preesistente (ad es. guidato da Figma/Penpot) chiama `primary` il proprio colore base, mentre i token di minimo referenziano `{primary.100}`. Invece di rinominare a mano la custom property generata dopo ogni build, o di cercare ogni riferimento di minimo per modificarlo, `transform` corregge una volta sola il percorso del token, nella configurazione:
110
110
 
111
111
  ```js
112
112
  source: [
@@ -115,22 +115,22 @@ source: [
115
115
  ],
116
116
  ```
117
117
 
118
- With this config, whatever is defined at dot-path `primary` in the matched files is moved to `primary.100` — so it becomes `--primary-100` in the generated CSS, and every existing minimo reference to `{primary.100}` resolves correctly.
118
+ Con questa configurazione, qualunque cosa sia definita al dot-path `primary` nei file individuati viene spostata in `primary.100` — quindi diventa `--primary-100` nel CSS generato, e ogni riferimento esistente di minimo a `{primary.100}` viene risolto correttamente.
119
119
 
120
- - **Notation:** both sides of the map use Style Dictionary's own dot-path notation (`'primary.100'`), not the hyphen-joined custom-property notation (`'primary-100'`). Token name segments in this project can themselves contain hyphens (e.g. `btn-close`), so a hyphen can't reliably tell a path separator from a literal part of a segment name — a dot can, since it's already reserved by Style Dictionary as the `{reference}` path separator.
121
- - **References are rewritten automatically:** once every source file is merged, any `{reference}` to the token's *old* path — in the same file or a completely different one — is rewritten tree-wide to the *new* path (e.g. every `{primary}` in the build becomes `{primary.100}`). This is safe because Style Dictionary resolves `{references}` against the single merged token tree by absolute path: if `primary` existed exactly once, every `{primary}` anywhere unambiguously pointed at that one node.
122
- - **Exception:** if the *same* source key (e.g. `primary`) is given a *different* destination in two different files' `transform` maps, each rename still works on its own, but the bare reference `{primary}` becomes ambiguous — which destination should it point to? In that case the automatic rewrite is skipped for that key (a warning is logged), and every `{primary}` reference must be fixed by hand to point at the correct one of the two new paths.
123
- - A source key not found in the file only logs a warning; it does not fail the build.
124
- - Applies to **both** the CSS and the JSON output (see [JSON output](#json-output) below), since both are rebuilt from the token's path, by then already renamed — no separate handling is needed.
125
- - Two entries giving different destinations for the same source key in the same file fail the build with an error.
126
- - `check-unresolved-custom-props.mjs` understands the same syntax.
120
+ - **Notazione:** entrambi i lati della mappa usano la notazione dot-path di Style Dictionary (`'primary.100'`), non la notazione delle custom properties con trattini (`'primary-100'`). In questo progetto i segmenti dei nomi dei token possono a loro volta contenere trattini (ad es. `btn-close`), quindi un trattino non permette di distinguere in modo affidabile un separatore di percorso da una parte letterale del nome di un segmento — un punto invece sì, perché è già riservato da Style Dictionary come separatore di percorso dei `{riferimenti}`.
121
+ - **I riferimenti vengono riscritti automaticamente:** una volta uniti tutti i file sorgente, ogni `{riferimento}` al *vecchio* percorso del token — nello stesso file o in uno completamente diverso — viene riscritto in tutto l'albero col *nuovo* percorso (ad es. ogni `{primary}` della build diventa `{primary.100}`). È sicuro perché Style Dictionary risolve i `{riferimenti}` sull'unico albero di token unito, tramite percorso assoluto: se `primary` esisteva una sola volta, ogni `{primary}` ovunque puntava senza ambiguità a quell'unico nodo.
122
+ - **Eccezione:** se la *stessa* chiave sorgente (ad es. `primary`) ha una destinazione *diversa* nelle mappe `transform` di due file diversi, ogni rinomina funziona comunque da sola, ma il riferimento semplice `{primary}` diventa ambiguo: a quale destinazione dovrebbe puntare? In quel caso la riscrittura automatica viene saltata per quella chiave (viene registrato un warning) e ogni riferimento `{primary}` va corretto a mano per puntare al giusto fra i due nuovi percorsi.
123
+ - Una chiave sorgente non trovata nel file registra solo un warning; non fa fallire la build.
124
+ - Si applica **sia** all'output CSS sia a quello JSON (vedi [Output JSON](#output-json) più sotto), perché entrambi vengono ricostruiti dal percorso del token, ormai già rinominato — non serve una gestione separata.
125
+ - Due voci che danno destinazioni diverse alla stessa chiave sorgente nello stesso file fanno fallire la build con un errore.
126
+ - `check-unresolved-custom-props.mjs` comprende la stessa sintassi.
127
127
 
128
- See `build-tokens-src/source-transforms.mjs` and `build-tokens-src/token-rename-parser.mjs`.
128
+ Vedi `build-tokens-src/source-transforms.mjs` e `build-tokens-src/token-rename-parser.mjs`.
129
129
 
130
130
 
131
- #### Token file format (JS example)
131
+ #### Formato dei file token (esempio JS)
132
132
 
133
- When using `.mjs` source files, export a default object following the [W3C Design Token Community Group format](https://design-tokens.github.io/community-group/format/):
133
+ Quando si usano file sorgente `.mjs`, esportare come default un oggetto che segue il [formato del W3C Design Token Community Group](https://design-tokens.github.io/community-group/format/):
134
134
 
135
135
  ```js
136
136
  // colors.tokens.mjs
@@ -155,85 +155,85 @@ export default {
155
155
  };
156
156
  ```
157
157
 
158
- The main advantage of `.mjs` over `.json` is the ability to use JavaScript variables, comments, and computed values within the token definition.
158
+ Il principale vantaggio di `.mjs` rispetto a `.json` è la possibilità di usare variabili JavaScript, commenti e valori calcolati nella definizione dei token.
159
159
 
160
- Values can be expressions like `"{size.base} * .25"`, see `tokens-config-sample.mjs` for more info.
160
+ I valori possono essere espressioni come `"{size.base} * .25"`, vedi `tokens-config-sample.mjs` per maggiori informazioni.
161
161
 
162
- #### Custom transforms
162
+ #### Transform personalizzate
163
163
 
164
- The following transforms are registered on top of Style Dictionary's built-ins:
164
+ Le seguenti transform vengono registrate in aggiunta a quelle predefinite di Style Dictionary:
165
165
 
166
- | Name | Type | Description |
166
+ | Nome | Tipo | Descrizione |
167
167
  |---|---|---|
168
- | `shadow/css` | value | Converts shadow objects (single or array) to a `box-shadow` CSS string. px values are converted to rem. |
169
- | `size/pxToRem-smart` | value | Converts `dimension` token values from px to rem. Skips values already in rem. |
170
- | `color/css-modern` | value | Color passthrough with transitive alias support. |
171
- | `gradient/css` | value | Converts gradient objects to CSS `linear-gradient`, `radial-gradient` or `conic-gradient`. |
172
- | `composite/css` | value | Converts `border`, `outline`, `transition` and `animation` objects to their CSS shorthand. |
173
- | `typography/css` | value | Typography passthrough — the format handles exploding the value into individual properties. |
168
+ | `shadow/css` | value | Converte gli oggetti shadow (singoli o array) in una stringa CSS `box-shadow`. I valori in px vengono convertiti in rem. |
169
+ | `size/pxToRem-smart` | value | Converte i valori dei token `dimension` da px a rem. Salta i valori già in rem. |
170
+ | `color/css-modern` | value | Passthrough dei colori con supporto agli alias transitivi. |
171
+ | `gradient/css` | value | Converte gli oggetti gradient in `linear-gradient`, `radial-gradient` o `conic-gradient` CSS. |
172
+ | `composite/css` | value | Converte gli oggetti `border`, `outline`, `transition` e `animation` nella relativa shorthand CSS. |
173
+ | `typography/css` | value | Passthrough della tipografia — è il format a occuparsi di scomporre il valore nelle singole proprietà. |
174
174
 
175
- #### CSS output
175
+ #### Output CSS
176
176
 
177
- All tokens are output as CSS custom properties inside `:root`, sorted alphabetically.
177
+ Tutti i token vengono generati come custom properties CSS dentro `:root`, in ordine alfabetico.
178
178
 
179
- Typography tokens are expanded into multiple properties:
180
- - `--token-name-font` — a `font` shorthand (when both `fontSize` and `fontFamily` are present)
181
- - `--token-name-letter-spacing`, `--token-name-text-transform`, `--token-name-text-decoration` — individual properties
179
+ I token di tipografia vengono espansi in più proprietà:
180
+ - `--token-name-font` — una shorthand `font` (quando sono presenti sia `fontSize` sia `fontFamily`)
181
+ - `--token-name-letter-spacing`, `--token-name-text-transform`, `--token-name-text-decoration` — proprietà singole
182
182
 
183
- The generated file is linted and auto-fixed with stylelint using the config specified in `stylelintConfigPath`.
183
+ Il file generato viene controllato e corretto automaticamente con stylelint usando la configurazione indicata in `stylelintConfigPath`.
184
184
 
185
- #### JSON output
185
+ #### Output JSON
186
186
 
187
- When `jsonBuildPath` is set, the script also generates W3C DTCG token files, independent of any specific consuming tool (e.g. importable into Penpot via the [Design Tokens plugin](https://penpot.app/penpot-files/design-tokens), into Figma via a compatible plugin, or into Token Studio).
187
+ Quando `jsonBuildPath` è impostato, lo script genera anche file di token W3C DTCG, indipendenti da qualsiasi strumento specifico (ad es. importabili in Penpot tramite il [plugin Design Tokens](https://penpot.app/penpot-files/design-tokens), in Figma tramite un plugin compatibile o in Token Studio).
188
188
 
189
- **Single file** (`jsonDestFile` is a string):
189
+ **File singolo** (`jsonDestFile` è una stringa):
190
190
  ```
191
- jsonBuildPath/tokens.jsonc ← all tokens in one file
191
+ jsonBuildPath/tokens.jsonc ← tutti i token in un unico file
192
192
  ```
193
193
 
194
- **One file per source** (`jsonDestFile` is `null` or omitted):
194
+ **Un file per ogni sorgente** (`jsonDestFile` è `null` o omesso):
195
195
  ```
196
196
  jsonBuildPath/colors.tokens.jsonc
197
197
  jsonBuildPath/spacing.tokens.jsonc
198
198
  jsonBuildPath/typography.tokens.jsonc
199
199
  ```
200
- All files are written flat in `jsonBuildPath`, regardless of the subdirectory structure of the source files — no subdirectories are created. If two source files with different paths would produce the same output filename, the build fails with an error listing the colliding files instead of silently overwriting one with the other.
200
+ Tutti i file vengono scritti nella stessa cartella `jsonBuildPath`, indipendentemente dalla struttura di sottocartelle dei file sorgente — non vengono create sottocartelle. Se due file sorgente con percorsi diversi producessero lo stesso nome di file di output, la build fallisce con un errore che elenca i file in conflitto, invece di sovrascriverne uno silenziosamente con l'altro.
201
201
 
202
- The `jsonFormat` option controls the output:
202
+ L'opzione `jsonFormat` controlla l'output:
203
203
 
204
- | Value | Extension | Disclaimer header |
204
+ | Valore | Estensione | Intestazione di avviso |
205
205
  |---|---|---|
206
- | `'jsonc'` | `.jsonc` | Yes |
206
+ | `'jsonc'` | `.jsonc` | Sì |
207
207
  | `'json'` | `.json` | No |
208
208
 
209
- Alias references (`{color.brand.primary}`) are preserved in the output so consuming tools maintain token links between primitive and semantic tokens.
209
+ I riferimenti agli alias (`{color.brand.primary}`) vengono conservati nell'output, in modo che gli strumenti che li usano mantengano i collegamenti tra token primitivi e semantici.
210
210
 
211
- > JSON token files intentionally use a minimal set of transforms (no px→rem conversion, no shorthand expansion) because consuming tools generally expect original values and structured objects, not resolved CSS strings.
211
+ > I file JSON dei token usano volutamente un insieme minimo di transform (nessuna conversione px→rem, nessuna espansione delle shorthand) perché gli strumenti che li usano si aspettano in genere i valori originali e oggetti strutturati, non stringhe CSS già risolte.
212
212
 
213
- #### sourceModes (light/dark split)
213
+ #### sourceModes (suddivisione light/dark)
214
214
 
215
- `sourceModes` is an alternative to `source`, for projects that need a light/dark (or other) custom properties split. See the comments in `tokens-config-sample.mjs` for the full option reference (`sourceModes`, `sourceModesBase`).
215
+ `sourceModes` è un'alternativa a `source`, per i progetti che richiedono una suddivisione light/dark (o altra) delle custom properties. Vedi i commenti in `tokens-config-sample.mjs` per il riferimento completo delle opzioni (`sourceModes`, `sourceModesBase`).
216
216
 
217
- When set, each mode has its own `source` array, and the generated CSS composes all modes into a single `destFile`:
218
- - the base mode's props go in a top-level `:root { ... }` block, with `color-scheme: <all modes>;` prepended
219
- - every other mode's props go in `@media (prefers-color-scheme: <mode>) { :root { ... } }`, with `color-scheme: <mode>;` prepended
217
+ Quando è impostato, ogni modalità ha il proprio array `source` e il CSS generato compone tutte le modalità in un unico `destFile`:
218
+ - le proprietà della modalità base vanno in un blocco `:root { ... }` di primo livello, con `color-scheme: <tutte le modalità>;` anteposto
219
+ - le proprietà di ogni altra modalità vanno in `@media (prefers-color-scheme: <modalità>) { :root { ... } }`, con `color-scheme: <modalità>;` anteposto
220
220
 
221
- Tokens of a non-base mode can reference tokens defined in the base mode (e.g. a dark token using `{color.1}` defined in light, output as `var(--color-1)`). References to a non-base mode's tokens (from the base mode or from another non-base mode) fail with a "reference not defined" error, since the target would be undefined outside its own `@media` block.
221
+ I token di una modalità non base possono referenziare token definiti nella modalità base (ad es. un token dark che usa `{color.1}` definito in light, reso come `var(--color-1)`). I riferimenti ai token di una modalità non base (dalla modalità base o da un'altra modalità non base) falliscono con un errore "reference not defined", perché il target risulterebbe non definito fuori dal proprio blocco `@media`.
222
222
 
223
- `customPropsGroups`, `mergeCustomProps`, `addLayer`, `pxToRem` etc. all apply the same way as with a single `source` (`mergeCustomProps` set to an array of strings/RegExps matches the token files of every mode). The JSON output (when `jsonBuildPath` is set) is produced once per mode, with the mode name appended to each filename (e.g. `tokens-light.jsonc` / `tokens-dark.jsonc`).
223
+ `customPropsGroups`, `mergeCustomProps`, `addLayer`, `pxToRem` ecc. si applicano allo stesso modo che con un singolo `source` (`mergeCustomProps` impostato a un array di stringhe/RegExp confronta i file token di ogni modalità). L'output JSON (quando `jsonBuildPath` è impostato) viene prodotto una volta per modalità, con il nome della modalità aggiunto a ogni nome di file (ad es. `tokens-light.jsonc` / `tokens-dark.jsonc`).
224
224
 
225
225
  ---
226
226
 
227
227
  ### `check-unresolved-custom-props.mjs`
228
228
 
229
- Scans all `.css` files in `dirToCheck` (recursively) and reports:
229
+ Analizza (ricorsivamente) tutti i file `.css` in `dirToCheck` e segnala:
230
230
 
231
- - **unresolved properties** — `var(--...)` references that are not defined in the generated token CSS file or in any `extraCustomPropsFiles`
232
- - **unused properties** — custom properties defined in the generated token CSS file (or an `extraCustomPropsFiles` entry) but never referenced via `var()` in any scanned CSS file. Only reported if `checkUnused: true` is set in the config, since it re-runs the Style Dictionary transform pipeline over the token sources to resolve, when possible, the `.mjs` source file for each unused property. When `ignoreUnusedInNodeModules` is true (default), properties sourced from a token file under `node_modules` (e.g. a third-party token package) are never reported as unused.
231
+ - **proprietà non risolte** — riferimenti `var(--...)` non definiti nel file CSS dei token generato né in alcun `extraCustomPropsFiles`
232
+ - **proprietà non usate** — custom properties definite nel file CSS dei token generato (o in una voce di `extraCustomPropsFiles`) ma mai referenziate tramite `var()` in alcun file CSS analizzato. Vengono segnalate solo se nella configurazione è impostato `checkUnused: true`, perché viene rieseguita la pipeline di trasformazione di Style Dictionary sui sorgenti dei token per risalire, quando possibile, al file sorgente `.mjs` di ogni proprietà non usata. Quando `ignoreUnusedInNodeModules` è true (default), le proprietà provenienti da un file token sotto `node_modules` (ad es. un pacchetto di token di terze parti) non vengono mai segnalate come non usate.
233
233
 
234
- Results are written to `unresolved-unused-props.md` in the same directory as the config file.
234
+ I risultati vengono scritti in `unresolved-unused-props.md`, nella stessa directory del file di configurazione.
235
235
 
236
- #### Usage
236
+ #### Utilizzo
237
237
 
238
238
  ```sh
239
239
  npx checkUnresolvedProps --config ./path/to/tokens-config.mjs
@@ -241,29 +241,29 @@ npx checkUnresolvedProps --config ./path/to/tokens-config.mjs
241
241
 
242
242
  #### Output
243
243
 
244
- The script creates a `unresolved-unused-props.md` file next to the config file (only if there is at least one unresolved or unused property). Each unresolved entry links to the file and line number where the property is used; each unused entry links to its `.mjs` token source file when it can be resolved, otherwise just the property name is reported:
244
+ Lo script crea un file `unresolved-unused-props.md` accanto al file di configurazione (solo se c'è almeno una proprietà non risolta o non usata). Ogni voce non risolta rimanda al file e al numero di riga in cui la proprietà è usata; ogni voce non usata rimanda al relativo file sorgente `.mjs` dei token quando è possibile risalirvi, altrimenti viene riportato solo il nome della proprietà:
245
245
 
246
246
  ```markdown
247
- ## Unresolved custom properties
247
+ ## Custom properties non risolte
248
248
 
249
249
  * [components.css](../src/components.css#L42) -> `--color-action-hover`
250
250
  * [layout.css](../src/layout.css#L17) -> `--spacing-missing`
251
251
 
252
- ## Unused custom properties
252
+ ## Custom properties non usate
253
253
 
254
254
  * [colors.minimo.tokens.mjs](../_src/colors.minimo.tokens.mjs) -> `--color-legacy-accent`
255
255
  * `--manually-added-prop`
256
256
  ```
257
257
 
258
- In VS Code, Option/Alt-clicking on the URL opens the file at the required line.
258
+ In VS Code, Option/Alt-clic sull'URL apre il file alla riga richiesta.
259
259
 
260
260
 
261
- #### Excluding properties
261
+ #### Esclusione di proprietà
262
262
 
263
- Use `excludePattern` to suppress false positives — for example, internal/private custom properties that are defined dynamically or inline:
263
+ Usare `excludePattern` per eliminare i falsi positivi — ad esempio le custom properties interne/private definite dinamicamente o inline:
264
264
 
265
265
  ```js
266
- // skips all custom props starting with `--_` or `--js-`
266
+ // salta tutte le custom props che iniziano con `--_` o `--js-`
267
267
  excludePattern: [
268
268
  /^--_/,
269
269
  /^--js-/,