@massimo-cassandro/minimo 1.41.4 → 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 (131) 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/{css/index.css → index.css} +2 -2
  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/stylelint-config/README.md +7 -7
  39. package/dev-tools/svg-icons-tools/README.md +32 -32
  40. package/dev-tools/svg-icons-tools/src/config-manager.mjs +1 -1
  41. package/dev-tools/svg-icons-tools/src/default-config.mjs +118 -118
  42. package/dev-tools/svg-icons-tools/src/jsx-icon-file-builder.mjs +24 -24
  43. package/dev-tools/svg-icons-tools/src/parse-svg-filename.mjs +3 -3
  44. package/dev-tools/svg-icons-tools/src/parse-svg-files.mjs +1 -1
  45. package/dev-tools/svg-icons-tools/src/parse-svg-markup.mjs +4 -4
  46. package/dev-tools/svg-icons-tools/src/svg-to-jsx.mjs +2 -2
  47. package/dev-tools/svg-icons-tools/src/svg-to-optimized.mjs +2 -2
  48. package/dev-tools/svg-icons-tools/src/svg-to-symbols.mjs +2 -2
  49. package/dev-tools/upd@m/README.md +1 -1
  50. package/dev-tools/upd@m/index.mjs +1 -1
  51. package/dev-tools/update-version/README.md +9 -9
  52. package/package.json +1 -1
  53. package/snippets/unsplash-browser-app/README.md +1 -1
  54. package/snippets/unsplash-browser-app/unsplash-utilities.js +9 -9
  55. package/src/components/autocomplete/README.md +3 -3
  56. package/src/components/autocomplete/autocomplete-engine.js +75 -63
  57. package/src/components/autocomplete/check-autocomplete.js +3 -3
  58. package/src/components/dismiss-alerts.js +3 -3
  59. package/src/components/form-reset-submit.js +6 -6
  60. package/src/components/inner-nav/inner-nav.js +2 -2
  61. package/src/components/modal-alert/modal-alert.js +67 -65
  62. package/src/components/modal-alert/modal-alert.minimo.tokens.mjs +1 -1
  63. package/src/components/modal-popup/modal-popup.js +56 -56
  64. package/src/components/overlay/overlay.js +3 -3
  65. package/src/components/sf-macro/readme.md +1 -1
  66. package/src/components/sf-macro/sf-macro.js +27 -23
  67. package/src/components/slide-up-down-toggle/slide-up-down-toggle.js +83 -79
  68. package/src/components/slide-up-down-toggle/slide-up-down-toggle.module.css +44 -44
  69. package/src/components/snackbar/snackbar.js +19 -19
  70. package/src/components/spinner/spinner.js +3 -3
  71. package/src/components/unsplash-page/README.md +8 -8
  72. package/src/components/unsplash-page/fetch-unsplash-data.js +3 -3
  73. package/src/components/unsplash-page/unsplash-page.js +33 -33
  74. package/src/components/unsplash-page/unsplash-page.module.css +1 -1
  75. package/src/css/alerts.css +2 -2
  76. package/src/css/forms/forms.css +4 -4
  77. package/src/css/forms/validation.css +1 -1
  78. package/src/css/margin-padding-media.css +4 -4
  79. package/src/css/margin-padding.css +4 -4
  80. package/src/css/reset.css +11 -11
  81. package/src/icons/read-me.md +1 -1
  82. package/src/minimo.css +3 -3
  83. package/src/utilities/better-text-with-places.js +22 -22
  84. package/src/utilities/better-text.js +42 -35
  85. package/src/utilities/classnames.js +8 -8
  86. package/src/utilities/cookies.js +6 -6
  87. package/src/utilities/create-id.js +3 -3
  88. package/src/utilities/disable-btns-on-submit.js +2 -2
  89. package/src/utilities/dom-builder/dom-builder.js +89 -86
  90. package/src/utilities/dom-builder/domBuilderBasicSetup.js +9 -9
  91. package/src/utilities/dom-builder/parseDomString.js +23 -23
  92. package/src/utilities/dom-builder-helpers/README.md +2 -2
  93. package/src/utilities/dom-builder-helpers/form-tags.js +100 -100
  94. package/src/utilities/dom-builder-helpers/picture-tag.js +39 -39
  95. package/src/utilities/enable-submit-btns.js +1 -1
  96. package/src/utilities/escape-html.js +2 -2
  97. package/src/utilities/generate-pwd.js +4 -4
  98. package/src/utilities/linked-dates.js +13 -13
  99. package/src/utilities/parse-file-size.js +6 -6
  100. package/src/utilities/random-id.js +3 -3
  101. package/src/utilities/relative-date.js +40 -40
  102. package/src/utilities/sentence-case.js +1 -1
  103. package/src/utilities/strip-tags.js +1 -1
  104. package/src/utilities/title-case.js +1 -1
  105. package/src/utilities/truncate-string.js +5 -5
  106. package/src/utilities/validation-error-class.js +12 -12
  107. package/src/web-components/json-table/json-table-component.js +123 -121
  108. package/src/web-components/json-table/json-table-component.module.css +6 -6
  109. package/src/web-components/json-table/json-table.minimo.tokens.mjs +6 -6
  110. package/src/web-components/json-table/readme.md +72 -108
  111. package/src/web-components/json-table/src/cell-content.js +25 -25
  112. package/src/web-components/json-table/src/content-utils.js +21 -21
  113. package/src/web-components/json-table/src/data-types.js +32 -32
  114. package/src/web-components/json-table/src/defaults.js +230 -191
  115. package/src/web-components/json-table/src/get-data.js +55 -38
  116. package/src/web-components/json-table/src/icons.js +17 -17
  117. package/src/web-components/json-table/src/info-section.js +18 -18
  118. package/src/web-components/json-table/src/main-builder.js +45 -45
  119. package/src/web-components/json-table/src/pagination.js +32 -32
  120. package/src/web-components/json-table/src/parse-cols.js +18 -18
  121. package/src/web-components/json-table/src/parse-rows.js +17 -17
  122. package/src/web-components/json-table/src/resolve-params.js +53 -41
  123. package/src/web-components/json-table/src/search.js +13 -13
  124. package/src/web-components/json-table/src/sorting.js +20 -20
  125. package/src/web-components/json-table/src/table-body.js +13 -13
  126. package/src/web-components/json-table/src/table-builder.js +34 -34
  127. package/src/web-components/json-table/src/table-tfoot.js +8 -8
  128. package/src/web-components/json-table/src/table-thead.js +21 -21
  129. package/src/web-components/json-table/src/update-info.js +11 -11
  130. package/types/classes.d.ts +2 -2
  131. package/types/global.d.ts +18 -12
@@ -1,16 +1,18 @@
1
- // build-tokens-src/formats/css.mjs
2
- // Registers the 'css/variables-sorted' format.
3
- // Generates a :root { ... } block with custom properties sorted alphabetically.
4
- // Typography tokens are exploded into multiple CSS properties:
5
- // - a `font` shorthand (when both fontSize and fontFamily are present)
6
- // - individual properties for letterSpacing, textTransform, textDecoration
1
+ /*
2
+ build-tokens-src/formats/css.mjs
3
+ Registra il format 'css/variables-sorted'.
4
+ Genera un blocco :root { ... } con le custom properties ordinate alfabeticamente.
5
+ I token tipografici vengono scomposti in più proprietà CSS:
6
+ - una shorthand `font` (quando sono presenti sia fontSize sia fontFamily)
7
+ - proprietà singole per letterSpacing, textTransform, textDecoration
8
+ */
7
9
 
8
10
  import StyleDictionary from 'style-dictionary';
9
11
  import { mergeCustomProps, parseCustomProps } from '../merge-css.mjs';
10
12
 
11
13
  const BASE_FONT_SIZE = 16;
12
14
 
13
- // Converts a px value to rem. Returns the original string for non-px values.
15
+ // Converte un valore px in rem. Restituisce la stringa originale per i valori non px.
14
16
  const toRem = (val) => {
15
17
  if (val === undefined || val === null) return '0';
16
18
  const str = String(val).trim();
@@ -20,14 +22,14 @@ const toRem = (val) => {
20
22
  return str;
21
23
  };
22
24
 
23
- // Replaces {a.b.c} references with var(--token-name) using the tokenByPath map.
25
+ // Sostituisce i riferimenti {a.b.c} con var(--token-name) usando la mappa tokenByPath.
24
26
  const makeResolveRefs = (tokenByPath) => (str) =>
25
27
  String(str).replace(/\{([^}]+)\}/g, (_, p) => {
26
28
  const ref = tokenByPath[p];
27
29
  return ref ? `var(--${ref.name})` : `{${p}}`;
28
30
  });
29
31
 
30
- // ── Complex-type builders ────────────────────────────────────────────────────
32
+ // ── Builder dei tipi complessi ───────────────────────────────────────────────
31
33
 
32
34
  const buildShadow = (original, resolveRefs) => {
33
35
  const shadows = Array.isArray(original) ? original : [original];
@@ -85,9 +87,11 @@ const buildAnimation = (original, resolveRefs) => [
85
87
  resolveRefs(String(original.name ?? 'none')),
86
88
  ].join(' ');
87
89
 
88
- // Builds CSS custom properties for a typography token.
89
- // Produces a `font` shorthand when both fontSize and fontFamily are present,
90
- // plus separate properties for letterSpacing, textTransform and textDecoration.
90
+ /*
91
+ Costruisce le custom properties CSS per un token tipografico.
92
+ Produce una shorthand `font` quando sono presenti sia fontSize sia fontFamily,
93
+ più proprietà separate per letterSpacing, textTransform e textDecoration.
94
+ */
91
95
  const buildTypography = (tokenName, original, resolveRefs) => {
92
96
  const {
93
97
  fontStyle, fontVariant, fontWeight, fontStretch,
@@ -117,7 +121,7 @@ const buildTypography = (tokenName, original, resolveRefs) => {
117
121
  letterSpacing: ['letter-spacing', letterSpacing],
118
122
  textTransform: ['text-transform', textTransform],
119
123
  textDecoration: ['text-decoration', textDecoration],
120
- // Fallback: expose size/family individually if the shorthand could not be built
124
+ // Fallback: espone size/family singolarmente se non è stato possibile costruire la shorthand
121
125
  ...(!fontSize ? { fontSize: ['font-size', original.fontSize] } : {}),
122
126
  ...(!fontFamily ? { fontFamily: ['font-family', original.fontFamily] } : {}),
123
127
  };
@@ -131,48 +135,52 @@ const buildTypography = (tokenName, original, resolveRefs) => {
131
135
  return lines.join('\n');
132
136
  };
133
137
 
134
- // Builds a trailing ` /* ... */` comment from a token's $description, to be
135
- // appended at the end of its generated custom prop declaration (same line).
136
- // Newlines are collapsed (declarations are parsed one line at a time, see
137
- // parseCustomProps in ../merge-css.mjs) and `*/` is escaped so the comment
138
- // can't be closed early by its own content.
138
+ /*
139
+ Costruisce un commento CSS finale (stile slash-asterisco) dal $description di un token, da
140
+ accodare alla fine della sua dichiarazione di custom prop generata (sulla stessa riga).
141
+ I a capo vengono compattati (le dichiarazioni sono lette una riga alla volta, vedi
142
+ parseCustomProps in ../merge-css.mjs) e la sequenza di chiusura del commento viene sottoposta a escape perché il commento
143
+ non possa essere chiuso prematuramente dal proprio contenuto.
144
+ */
139
145
  const buildDescriptionComment = (description) => {
140
146
  if (!description) return '';
141
147
  const flat = String(description).replace(/\s*\n\s*/g, ' ').trim().replace(/\*\//g, '* /');
142
148
  return flat ? ` /* ${flat} */` : '';
143
149
  };
144
150
 
145
- // Builds a customPropsGroups title comment, e.g.:
151
+ // Costruisce il commento di titolo di un customPropsGroups, ad es.:
146
152
  // /* ****** LAYOUT ****** */
147
- // Dashes fill out a fixed total width so titles line up regardless of name length.
153
+ // Gli asterischi riempiono una larghezza totale fissa così che i titoli siano allineati a prescindere dalla lunghezza del nome.
148
154
  const DECORATOR_LENGHT = 6;
149
155
  const buildGroupTitle = (name) => {
150
156
  return ` /** ${'*'.repeat(DECORATOR_LENGHT)} ${name} ${'*'.repeat(DECORATOR_LENGHT)} **/`;
151
157
  };
152
158
 
153
- // ── Format registration ──────────────────────────────────────────────────────
159
+ // ── Registrazione del format ─────────────────────────────────────────────────
154
160
 
155
- // Exported counter — read by build-tokens.mjs for the final log line
161
+ // Contatore esportato — letto da build-tokens.mjs per la riga finale del log
156
162
  export let customPropsCount = 0;
157
163
 
158
- // Exported live binding holding the name → declaration-tail map last computed
159
- // by computeFinalProps() (see below), i.e. the structured result of the most
160
- // recent 'css/variables-sorted' format call. Read by
161
- // build-tokens-src/build-source-modes.mjs right after each per-mode
162
- // sd.formatPlatform('css') call (synchronous, same pattern as
163
- // customPropsCount) — needed by build-tokens-src/light-dark.mjs to reconcile
164
- // shared light/dark properties into light-dark() calls, working on the
165
- // structured props instead of the rendered CSS text.
164
+ /*
165
+ Live binding esportato che contiene la mappa nome → coda della dichiarazione calcolata per ultima
166
+ da computeFinalProps() (vedi sotto), cioè il risultato strutturato della
167
+ chiamata più recente al format 'css/variables-sorted'. Letto da
168
+ build-tokens-src/build-source-modes.mjs subito dopo ogni chiamata per modalità a
169
+ sd.formatPlatform('css') (sincrono, stesso schema di
170
+ customPropsCount) — serve a build-tokens-src/light-dark.mjs per riconciliare
171
+ le proprietà light/dark condivise in chiamate light-dark(), lavorando sulle
172
+ props strutturate invece che sul testo CSS già reso.
173
+ */
166
174
  export let lastFinalProps = {};
167
175
 
168
176
  /**
169
- * Computes the final `name -> declaration-tail` map for a token dictionary:
170
- * resolves each token's CSS value (including the complex-type builders above),
171
- * then merges in any pre-existing custom properties via mergeCustomProps()
172
- * (see ../merge-css.mjs and the `mergeCustomProps` config option).
173
- * @param {object} dictionary Style Dictionary's resolved token dictionary (format() `dictionary` arg)
174
- * @param {object} options format() `options` arg — only `outputReferences` and `mode` are read here
175
- * @returns {Record<string,string>} name → declaration tail (value + terminating `;` + optional trailing comment)
177
+ * Calcola la mappa finale `nome -> coda della dichiarazione` per un dizionario di token:
178
+ * risolve il valore CSS di ogni token (inclusi i builder dei tipi complessi qui sopra),
179
+ * poi vi unisce le eventuali custom properties preesistenti tramite mergeCustomProps()
180
+ * (vedi ../merge-css.mjs e l'opzione di config `mergeCustomProps`).
181
+ * @param {object} dictionary dizionario dei token risolto di Style Dictionary (argomento `dictionary` di format())
182
+ * @param {object} options argomento `options` di format() — qui vengono lette solo `outputReferences` e `mode`
183
+ * @returns {Record<string,string>} nome → coda della dichiarazione (valore + `;` finale + eventuale commento finale)
176
184
  */
177
185
  export const computeFinalProps = (dictionary, options) => {
178
186
  const tokenByPath = {};
@@ -204,13 +212,14 @@ export const computeFinalProps = (dictionary, options) => {
204
212
  return a.name.localeCompare(b.name, 'en', { numeric: true, sensitivity: 'base' });
205
213
  };
206
214
 
207
- // Tokens loaded via `include` (sourceModes: base-mode tokens made
208
- // available to other modes) stay in tokenByPath, so references to them
209
- // resolve to var(--name), but are not declared in this mode's block.
210
- // property name → token source file, used by mergeCustomProps when the
211
- // merge is limited to some source files (a token may generate several
212
- // properties, e.g. typography)
213
- /** @type {Record<string,string>} */
215
+ /*
216
+ I token caricati tramite `include` (sourceModes: token della modalità base resi
217
+ disponibili alle altre modalità) restano in tokenByPath, quindi i riferimenti a essi
218
+ si risolvono in var(--name), ma non vengono dichiarati nel blocco di questa modalità.
219
+ nome della proprietà → file sorgente del token, usato da mergeCustomProps quando il
220
+ merge è limitato ad alcuni file sorgente (un token può generare più
221
+ proprietà, ad es. la tipografia)
222
+ */
214
223
  const sourceFileMap = {};
215
224
  const trackSource = (token, tokenLines) => {
216
225
  for (const name of Object.keys(parseCustomProps(tokenLines.join('\n')))) {
@@ -260,13 +269,17 @@ export const computeFinalProps = (dictionary, options) => {
260
269
  ? resolveRefs(orig) : buildAnimation(orig, resolveRefs);
261
270
 
262
271
  } else if (options.outputReferences && typeof orig === 'string' && orig.includes('{')) {
263
- // Covers both plain aliases and CSS functions containing {references}
264
- // e.g. color-mix(in srgb, {btn.secondary.background.color} 60%, #000)
265
- // {references} are replaced with var(--name); arithmetic gets calc().
272
+ /*
273
+ Copre sia i semplici alias sia le funzioni CSS che contengono {riferimenti}
274
+ ad es. color-mix(in srgb, {btn.secondary.background.color} 60%, #000)
275
+ I {riferimenti} vengono sostituiti con var(--name); le operazioni aritmetiche ottengono calc().
276
+ */
266
277
  const resolved = resolveRefs(orig);
267
- // Strip var(...) and CSS function calls (word chars + hyphens followed by '(')
268
- // before checking for arithmetic operators, so that hyphens in names like
269
- // "color-mix" or "linear-gradient" don't trigger a spurious calc() wrap.
278
+ /*
279
+ Rimuove var(...) e le chiamate a funzioni CSS (caratteri di parola + trattini seguiti da '(')
280
+ prima di cercare gli operatori aritmetici, così che i trattini in nomi come
281
+ "color-mix" o "linear-gradient" non attivino un calc() spurio.
282
+ */
270
283
  const stripped = resolved
271
284
  .replace(/var\([^)]+\)/g, '0')
272
285
  .replace(/[\w-]+\(/g, '(');
@@ -277,10 +290,12 @@ export const computeFinalProps = (dictionary, options) => {
277
290
  value = String(token.$value ?? token.value);
278
291
  }
279
292
 
280
- // Multi-line values (e.g. Open Props' linear() easings) are collapsed
281
- // to a single line: declarations are parsed one line at a time (see
282
- // parseCustomProps in ../merge-css.mjs), so a multi-line value would
283
- // be truncated to its first line.
293
+ /*
294
+ I valori su più righe (ad es. gli easing linear() di Open Props) vengono compattati
295
+ su una sola riga: le dichiarazioni sono lette una riga alla volta (vedi
296
+ parseCustomProps in ../merge-css.mjs), quindi un valore su più righe
297
+ verrebbe troncato alla prima riga.
298
+ */
284
299
  value = String(value)
285
300
  .replace(/\s*\n\s*/g, ' ')
286
301
  .replace(/\(\s+/g, '(')
@@ -289,42 +304,44 @@ export const computeFinalProps = (dictionary, options) => {
289
304
  return trackSource(token, [` --${token.name}: ${value};${commentSuffix}`]);
290
305
  });
291
306
 
292
- // Build a name → declaration-tail map from the declarations generated
293
- // above, then merge with any pre-existing custom properties loaded via
294
- // loadExistingCustomProps() / loadExistingCustomPropsScoped() (see
295
- // ../merge-css.mjs). Pre-existing values (including trailing comments)
296
- // take priority when both exist; pre-existing-only properties are kept.
297
- // options.mode (sourceModes build only, see ../build-source-modes.mjs)
298
- // scopes the merge to that mode, so same-named props with different
299
- // values across modes are never mixed up.
307
+ /*
308
+ Costruisce una mappa nome → coda della dichiarazione dalle dichiarazioni generate
309
+ qui sopra, poi la unisce alle eventuali custom properties preesistenti caricate tramite
310
+ loadExistingCustomProps() / loadExistingCustomPropsScoped() (vedi
311
+ ../merge-css.mjs). I valori preesistenti (inclusi i commenti finali)
312
+ hanno priorità quando esistono entrambi; le proprietà presenti solo nel preesistente vengono mantenute.
313
+ options.mode (solo build sourceModes, vedi ../build-source-modes.mjs)
314
+ limita il merge a quella modalità, così che proprietà con lo stesso nome ma valori
315
+ diversi tra le modalità non vengano mai confuse.
316
+ */
300
317
  const generatedProps = parseCustomProps(lines.join('\n'));
301
318
  return mergeCustomProps(generatedProps, options.mode ?? null, sourceFileMap);
302
319
  };
303
320
 
304
321
  /**
305
- * Builds the final CSS block text (`<selector> { ... }`) from an already
306
- * computed name → declaration-tail map (see computeFinalProps() above):
307
- * sorts properties alphabetically, pulls out customPropsGroups, prepends an
308
- * optional `color-scheme` declaration, and optionally wraps the result in
322
+ * Costruisce il testo finale del blocco CSS (`<selector> { ... }`) a partire da una mappa
323
+ * nome → coda della dichiarazione già calcolata (vedi computeFinalProps() qui sopra):
324
+ * ordina le proprietà alfabeticamente, estrae i customPropsGroups, antepone una
325
+ * dichiarazione `color-scheme` opzionale e, se richiesto, racchiude il risultato in
309
326
  * `@layer <addLayer> { ... }`.
310
327
  *
311
- * Extracted as its own function (rather than inline in the format() call
312
- * below) so build-tokens-src/light-dark.mjs can re-run it on an adjusted
313
- * props map — e.g. after moving properties shared by `light` and `dark` into
314
- * a single `light-dark()` declaration — and get back a properly sorted and
315
- * grouped block, instead of appending raw text after the fact.
328
+ * Estratta come funzione a sé (invece che inline nella chiamata a format()
329
+ * più sotto) così che build-tokens-src/light-dark.mjs possa rieseguirla su una mappa
330
+ * di props modificata — ad es. dopo aver spostato le proprietà condivise da `light` e `dark` in
331
+ * un'unica dichiarazione `light-dark()` — e ottenere un blocco correttamente ordinato e
332
+ * raggruppato, invece di accodare testo grezzo a posteriori.
316
333
  * @param {object} opts
317
- * @param {Record<string,string>} opts.finalProps name → declaration tail, as returned by computeFinalProps()
318
- * @param {string} [opts.selector] CSS selector wrapping the block (default: (default: ':root'))
319
- * @param {string} [opts.colorScheme] optional value for a `color-scheme: <value>;` declaration prepended to the block
320
- * @param {{name:string,prefixes:string[]}[]} [opts.customPropsGroups] named groups of name prefixes, moved to the top of the block in list order (default: [])
321
- * @param {string|null} [opts.addLayer] wraps the block in `@layer <addLayer> { ... }` (default: null — no layer)
334
+ * @param {Record<string,string>} opts.finalProps nome → coda della dichiarazione, come restituito da computeFinalProps()
335
+ * @param {string} [opts.selector] selettore CSS che racchiude il blocco (default: ':root')
336
+ * @param {string} [opts.colorScheme] valore opzionale per una dichiarazione `color-scheme: <valore>;` anteposta al blocco
337
+ * @param {{name:string,prefixes:string[]}[]} [opts.customPropsGroups] gruppi nominati di prefissi di nome, spostati in cima al blocco nell'ordine dell'elenco (default: [])
338
+ * @param {string|null} [opts.addLayer] racchiude il blocco in `@layer <addLayer> { ... }` (default: null — nessun layer)
322
339
  * @returns {string}
323
340
  * @example
324
341
  * buildCssBlock({
325
342
  * finalProps: { 'accent-color': '#123;' },
326
343
  * selector: ':root', // default: ':root'
327
- * colorScheme: 'light dark', // default: undefined — no color-scheme line
344
+ * colorScheme: 'light dark', // default: undefined — nessuna riga color-scheme
328
345
  * customPropsGroups: [], // default: []
329
346
  * addLayer: null, // default: null
330
347
  * });
@@ -336,17 +353,21 @@ export const buildCssBlock = ({
336
353
  customPropsGroups = [],
337
354
  addLayer = null,
338
355
  }) => {
339
- // Final output is always sorted alphabetically ascending by property
340
- // name, regardless of merge — this also keeps pre-existing-only
341
- // properties from merge-css.mjs in order instead of trailing at the end.
356
+ /*
357
+ L'output finale è sempre ordinato alfabeticamente in modo crescente per nome della
358
+ proprietà, a prescindere dal merge — questo mantiene in ordine anche le proprietà
359
+ presenti solo nel preesistente (da merge-css.mjs) invece di accodarle alla fine.
360
+ */
342
361
  const sortedProps = Object.entries(finalProps)
343
362
  .sort(([a], [b]) => a.localeCompare(b, 'en', { numeric: true, sensitivity: 'base' }));
344
363
 
345
- // customPropsGroups: properties whose first hyphen-separated name segment
346
- // matches one of a group's prefixes are pulled out, labelled with that
347
- // group's name and placed, in group-list order, at the beginning of the
348
- // output file. A property matches the first group (in list order) whose
349
- // prefixes include it.
364
+ /*
365
+ customPropsGroups: le proprietà il cui primo segmento del nome (separato da trattini)
366
+ corrisponde a uno dei prefissi di un gruppo vengono estratte, etichettate con il
367
+ nome di quel gruppo e collocate, nell'ordine dell'elenco dei gruppi, all'inizio del
368
+ file di output. Una proprietà corrisponde al primo gruppo (in ordine di elenco) i cui
369
+ prefissi la includono.
370
+ */
350
371
  const groupedProps = customPropsGroups.map(() => []);
351
372
  const restProps = [];
352
373
  for (const entry of sortedProps) {
@@ -368,9 +389,11 @@ export const buildCssBlock = ({
368
389
  });
369
390
  });
370
391
 
371
- // A blank line is inserted between blocks of properties sharing the same
372
- // first hyphen-separated segment (e.g. all `btn-*` together), to visually
373
- // group related custom properties in the generated file.
392
+ /*
393
+ Viene inserita una riga vuota tra i blocchi di proprietà che condividono lo stesso
394
+ primo segmento separato da trattini (ad es. tutte le `btn-*` insieme), per raggruppare
395
+ visivamente le custom properties correlate nel file generato.
396
+ */
374
397
  const outLines = [];
375
398
 
376
399
  if (colorScheme) {
@@ -407,8 +430,8 @@ export const buildCssBlock = ({
407
430
 
408
431
  const block = `${selector} {\n${outLines.join('\n')}\n}\n`;
409
432
 
410
- // addLayer: wraps the whole block inside `@layer <name> { ... }`.
411
- // Indentation is left to stylelint's fix step (run right after the build).
433
+ // addLayer: racchiude l'intero blocco in `@layer <name> { ... }`.
434
+ // L'indentazione è lasciata al passaggio di fix di stylelint (eseguito subito dopo la build).
412
435
  return addLayer
413
436
  ? `@layer ${addLayer} {\n\n${block}}\n`
414
437
  : block;