@massimo-cassandro/minimo 1.20.5 → 1.20.7

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.
@@ -48,20 +48,28 @@ const isDevelopment = process.env.NODE_ENV === 'development'
48
48
  // ,manifest_shared_seed = {}
49
49
  ;
50
50
 
51
- // test del cacheGroup `shared` (splitChunks): con PurgeCSS attivo i css restano
52
- // FUORI dal chunk condiviso e nel chunk della entry che li importa, così ogni
53
- // asset css resta autosufficiente (`variables: true` funziona per singolo asset,
54
- // e i critical css inlinati nei template devono restare autosufficienti). Con
55
- // PurgeCSS disattivo questo vincolo non serve più: i css seguono lo stesso path
56
- // matching dei moduli js
51
+ // test del cacheGroup `shared` (splitChunks): i css restano SEMPRE FUORI dal
52
+ // chunk condiviso e nel chunk della entry che li importa, così ogni asset css
53
+ // resta autosufficiente (`variables: true` funziona per singolo asset, e i
54
+ // critical css inlinati nei template devono restare autosufficienti). I
55
+ // template (twig/altro) linkano solo il css della propria entry (e gli
56
+ // eventuali `.critical.css`), MAI uno shared.css: se i css finissero nel
57
+ // chunk condiviso, quella parte di stili sparirebbe silenziosamente dalla
58
+ // pagina.
59
+ //
60
+ // NB: non è la soluzione migliore, perché rinuncia alla deduplicazione dei
61
+ // css tra entry — ma è la più pratica al momento vista la duplicazione ancora
62
+ // limitata tra le pagine. Da rivedere in futuro se la duplicazione dovesse
63
+ // crescere.
57
64
  //
58
65
  // TODO: se in futuro la duplicazione di css tra le pagine dovesse crescere
59
66
  // (componenti importati dal js di più entry), valutare un cacheGroup `styles`
60
67
  // dedicato ai css condivisi: andranno escluse le entry `.critical` (devono
61
- // restare autosufficienti) e gestite in safelist.variables le custom properties
62
- // definite/consumate tra asset diversi (vedi purgecss-variables-safelist.mjs)
68
+ // restare autosufficienti), gestite in safelist.variables le custom properties
69
+ // definite/consumate tra asset diversi (vedi purgecss-variables-safelist.mjs),
70
+ // e i template dovranno linkare esplicitamente lo shared.css generato
63
71
  const shared_chunk_paths = (module) => {
64
- if (usePurgeCss && module.type === 'css/mini-extract') return false;
72
+ if (module.type === 'css/mini-extract') return false;
65
73
 
66
74
  // path delle directory da utilizzare nel chunk `shared`
67
75
  const sep = '[\\\\/]'; // stringa che produce [\\/] nel pattern
@@ -302,7 +310,7 @@ const config = {
302
310
 
303
311
  shared: {
304
312
  // vedi shared_chunk_paths sopra per la logica completa del test
305
- // (path match + esclusione css quando PurgeCSS è attivo)
313
+ // (path match + esclusione sempre dei css)
306
314
  test: shared_chunk_paths,
307
315
  name: 'shared',
308
316
  chunks: 'all'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.20.5",
3
+ "version": "1.20.7",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -72,7 +72,8 @@
72
72
  ],
73
73
  "peerDependencies": {
74
74
  "@svgdotjs/svg.js": "^3.2.7",
75
- "blurhash": "^2.0.5"
75
+ "blurhash": "^2.0.5",
76
+ "style-dictionary": "^5.0.0"
76
77
  },
77
78
  "peerDependenciesMeta": {
78
79
  "@svgdotjs/svg.js": {
@@ -11,6 +11,7 @@ import { parseDomString } from './parseDomString.js';
11
11
  * @property {string | string[]} [tagName='div'] - Alias for `tag`.
12
12
  * @property {string | string[]} [className] - CSS class(es): a single string or an array (falsy values filtered out).
13
13
  * @property {string | string[]} [class] - Alias for `className`.
14
+ * @property {string | string[]} [classname] - Alias for `className`.
14
15
  * @property {string | null} [id] - Unique element ID.
15
16
  * @property {[string, *] | [string, *][] | Object<string, *>} [attrs] - Attributes: a `[name, value]` pair, array of pairs, or `{name: value}` object.
16
17
  * @property {string | number | Function | Element | DomBuilderItem[] | null} [content] - Element content.
@@ -67,13 +68,25 @@ import { parseDomString } from './parseDomString.js';
67
68
  * object-level properties take precedence.
68
69
  *
69
70
  * @function domBuilder
70
- * @param {Array<DomBuilderItem|string>} [structureArray=[]] - Configuration array. Accepts strings (shorthand per `parseDomString`) and/or configuration objects.
71
+ * @param {Array<DomBuilderItem|string>} [structureArray=[]] - Configuration array. Accepts strings (shorthand per `parseDomString`) and/or configuration objects, each supporting:
72
+ * - `tag` / `tagName` {string | string[]} - HTML tag name, or array of nested tags (each is parent of the next). Default `'div'`.
73
+ * - `className` / `class` / `classname` {string | string[]} - CSS class(es): a single string or an array (falsy values filtered out).
74
+ * - `id` {string | null} - Unique element ID.
75
+ * - `attrs` {[string, *] | [string, *][] | Object<string, *>} - Attributes: a `[name, value]` pair, array of pairs, or `{name: value}` object.
76
+ * - `content` {string | number | Function | Element | DomBuilderItem[] | null} - Element content. A string/number is set as `textContent` unless it contains `<`, in which case it's sanitized and inserted as markup (`Element.setHTML`, falling back to `innerHTML`).
77
+ * - `condition` {boolean} - When false, the element is skipped. Default `true`.
78
+ * - `callback` {(function(HTMLElement): void) | null} - Invoked after the element is created.
79
+ * - `children` {Array<DomBuilderItem|string>} - Configuration array for child elements (same format, nested).
80
+ *
81
+ * IDs and classes can be specified either as top-level object keys or inside `attrs`; top-level properties take precedence.
71
82
  * @param {HTMLElement} [parent] - Parent element the structure is attached to (see `options.insertMode`).
72
83
  * @param {Object} [options={}] - Configuration options.
73
84
  * @param {boolean} [options.emptyParent=false] - When true, the parent element is emptied before building.
74
85
  * @param {'append'|'before'|'after'} [options.insertMode='append'] - How each root element of `structureArray` is attached to `parent`: `append` inserts it as a child (default), `before`/`after` insert it as a previous/next sibling of `parent`, preserving `structureArray` order. Only applies to the elements produced by this call — nested `domBuilder` calls (`content`, `children`) always append.
75
86
  * @returns {HTMLElement|null} The first created element, or null if nothing was created.
76
87
  */
88
+
89
+
77
90
  export function domBuilder(structureArray = [], parent, options = {}) {
78
91
 
79
92
  options = {
@@ -42,10 +42,13 @@ const boolAttrs = new Set([
42
42
  */
43
43
  export function domBuilderBasicSetup (element, domBuilderItem) {
44
44
 
45
- // class aliases: accept both `class` and `className`; `className` takes precedence
45
+ // class aliases: accept `class` and `classname`; `className` takes precedence over both
46
46
  if (domBuilderItem.class && !domBuilderItem.className) {
47
47
  domBuilderItem.className = domBuilderItem.class;
48
48
  }
49
+ if (domBuilderItem.classname && !domBuilderItem.className) {
50
+ domBuilderItem.className = domBuilderItem.classname;
51
+ }
49
52
 
50
53
  // normalize attrs: a single flat array is treated as a single [name, value] pair
51
54
  if (domBuilderItem.attrs && Array.isArray(domBuilderItem.attrs) && !Array.isArray(domBuilderItem.attrs[0])) {
@@ -208,8 +208,8 @@ export function buildTextareaTag({
208
208
  attrs: {
209
209
  ...(attrs??{}),
210
210
  name: name,
211
- value: value
212
211
  },
212
+ content: value,
213
213
  callback: callback
214
214
  }
215
215
  ]