@massimo-cassandro/minimo 1.17.1 → 1.18.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/design-tokens/tokens/src/components/unsplash-page/unsplash-page.minimo.tokens.jsonc +3 -3
- package/dev-tools/starter-kit/templates/__project__.code-workspace +2 -2
- package/dev-tools/starter-kit/webpack-modules/css-rules.mjs +1 -0
- package/dev-tools/starter-kit/webpack-modules/postcss.config.mjs +7 -0
- package/dev-tools/starter-kit/webpack-modules/purgecss-setup.mjs +95 -0
- package/dev-tools/starter-kit/webpack.config.mjs +102 -74
- package/index.js +1 -2
- package/package.json +9 -1
- package/snippets/error-pages/bundles/TwigBundle/Exception/error.html.twig +6 -6
- package/snippets/error-pages/error-pages.js +2 -2
- package/src/components/dismiss-alerts.js +1 -0
- package/src/components/form-reset-submit.js +1 -0
- package/src/components/inner-nav/inner-nav.css +2 -0
- package/src/components/inner-nav/inner-nav.js +1 -0
- package/src/components/modal-alert/modal-alert.js +12 -7
- package/src/components/modal-alert/modal-alert.module.css +11 -8
- package/src/components/modal-popup/modal-popup.js +1 -0
- package/src/components/modal-popup/modal-popup.module.css +1 -0
- package/src/components/overlay/overlay.css +2 -0
- package/src/components/overlay/overlay.js +1 -0
- package/src/components/sf-macro/sf-macro.js +1 -0
- package/src/components/slide-up-down-toggle/slide-up-down-toggle.js +1 -0
- package/src/components/slide-up-down-toggle/slide-up-down-toggle.module.css +1 -0
- package/src/components/snackbar/snackbar.js +1 -0
- package/src/components/snackbar/snackbar.module.css +2 -0
- package/src/components/unsplash-page/README.md +23 -0
- package/src/components/unsplash-page/unsplash-page.js +249 -119
- package/src/components/unsplash-page/unsplash-page.minimo.tokens.mjs +3 -3
- package/src/components/unsplash-page/unsplash-page.module.css +79 -77
- package/src/custom-properties.css +23 -23
- package/src/utilities/better-text.js +1 -0
- package/src/utilities/build-picture-tag.js +1 -0
- package/src/utilities/classnames.js +1 -0
- package/src/utilities/cookies.js +1 -0
- package/src/utilities/create-id.js +1 -0
- package/src/utilities/disable-btns-on-submit.js +1 -0
- package/src/utilities/dom-builder/dom-builder.js +2 -1
- package/src/utilities/enable-submit-btns.js +1 -0
- package/src/utilities/escape-html.js +1 -0
- package/src/utilities/generate-pwd.js +1 -0
- package/src/utilities/linked-dates.js +1 -0
- package/src/utilities/parse-file-size.js +1 -0
- package/src/utilities/random-id.js +1 -0
- package/src/utilities/relative-date.js +1 -0
- package/src/utilities/sentence-case.js +1 -0
- package/src/utilities/strip-tags.js +1 -0
- package/src/utilities/title-case.js +1 -0
- package/src/utilities/truncate-string.js +1 -0
- package/src/utilities/validation-error-class.js +1 -0
- package/src/components/unsplash-page/TODO unsplash-page-demo/README.md +0 -194
- package/src/components/unsplash-page/TODO unsplash-page-demo/changelog.md +0 -5
- package/src/components/unsplash-page/TODO unsplash-page-demo/unsplash-page/demo.js +0 -15
- package/src/components/unsplash-page/TODO unsplash-page-demo/unsplash-page/rollup.config.mjs +0 -26
- package/src/components/unsplash-page/TODO unsplash-page-demo/unsplash-page/unsplash-page-demo.min.js +0 -3
- package/src/components/unsplash-page/TODO.md +0 -3
- package/src/components/unsplash-page/img-breakpoints.js +0 -66
- package/src/components/unsplash-page/unsplash-page-body-reset.css +0 -14
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// Re-generate with: node build-tokens.mjs --config <path/to/config>
|
|
6
6
|
// -----------------------------------------------------------------------
|
|
7
7
|
{
|
|
8
|
-
"
|
|
8
|
+
"uspg": {
|
|
9
9
|
"bg": {
|
|
10
10
|
"color": {
|
|
11
11
|
"$type": "color",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"h1": {
|
|
60
60
|
"color": {
|
|
61
61
|
"$type": "color",
|
|
62
|
-
"$value": "{
|
|
62
|
+
"$value": "{uspg.text.color}"
|
|
63
63
|
},
|
|
64
64
|
"font": {
|
|
65
65
|
"size": {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"box": {
|
|
85
85
|
"bg": {
|
|
86
86
|
"$type": "color",
|
|
87
|
-
"$value": "{
|
|
87
|
+
"$value": "{uspg.link.color}"
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"fill": {
|
|
@@ -4,6 +4,7 @@ import { fileURLToPath } from 'url';
|
|
|
4
4
|
import globalData from '@csstools/postcss-global-data';
|
|
5
5
|
import customMedia from 'postcss-custom-media';
|
|
6
6
|
import autoprefixer from 'autoprefixer';
|
|
7
|
+
// import jitProps from 'postcss-jit-props';
|
|
7
8
|
|
|
8
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
10
|
const __dirname = path.dirname(__filename);
|
|
@@ -32,6 +33,12 @@ export default (loaderContext) => {
|
|
|
32
33
|
]
|
|
33
34
|
}),
|
|
34
35
|
|
|
36
|
+
// jitProps({
|
|
37
|
+
// files: [
|
|
38
|
+
// path.resolve(__dirname, '../src/css/custom-properties.css'),
|
|
39
|
+
// ]
|
|
40
|
+
// }),
|
|
41
|
+
|
|
35
42
|
// per IOS < 17 (test)
|
|
36
43
|
// https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting
|
|
37
44
|
// https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-light-dark-function#readme
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// webpack-modules/purgecss-setup.mjs
|
|
2
|
+
import { PurgeCSSPlugin } from 'purgecss-webpack-plugin';
|
|
3
|
+
import { globSync } from 'glob';
|
|
4
|
+
import { purgecssVariablesSafelist } from './purgecss-variables-safelist.mjs';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
Istanzia i plugin PurgeCSS del progetto: un passaggio stretto sui css
|
|
8
|
+
`.critical` (inlinati nei template, devono restare autosufficienti) e un
|
|
9
|
+
passaggio generale su tutti gli altri asset (il purge è idempotente: il
|
|
10
|
+
secondo passaggio sui critical non rimuove altro).
|
|
11
|
+
|
|
12
|
+
NB: il plugin elabora ogni asset css SINGOLARMENTE, quindi con `variables: true`
|
|
13
|
+
una custom property viene mantenuta solo se definita e usata nello stesso asset.
|
|
14
|
+
Per questo, lato progetto:
|
|
15
|
+
- ogni entry css importa direttamente custom-properties.css (che sostituisce
|
|
16
|
+
jit-props: le props non usate vengono rimosse qui)
|
|
17
|
+
- il chunk `shared` deve contenere solo js (il css estratto resta nel chunk
|
|
18
|
+
dell'entry che lo importa)
|
|
19
|
+
- le props dichiarate in un asset ma consumate altrove (override di tema,
|
|
20
|
+
shadow DOM dei web components) vanno indicate tramite `variablesSafelist`
|
|
21
|
+
(vedi purgecss-variables-safelist.mjs)
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {object} params
|
|
26
|
+
* @param {string[]} params.contentGlobs file da scansionare per le classi/id usati
|
|
27
|
+
* (twig, php, js...); i file di stile vengono comunque scartati dal plugin
|
|
28
|
+
* @param {object} params.safelist { standard, deep, greedy } — selettori sempre
|
|
29
|
+
* mantenuti, indipendentemente dal contenuto scansionato
|
|
30
|
+
* @param {object} params.variablesSafelist opzioni per purgecssVariablesSafelist
|
|
31
|
+
* ({ declarationGlobs, shadowGlobs, seeds })
|
|
32
|
+
* @param {boolean} [params.variables=true] rimuove le custom properties non usate
|
|
33
|
+
* @param {boolean} [params.keyframes=true] rimuove i @keyframes non referenziati
|
|
34
|
+
* @param {boolean} [params.debug=false] logga i selettori rimossi a fine build
|
|
35
|
+
* @returns {object[]} plugin webpack da inserire in `plugins`
|
|
36
|
+
* (critical + generale, più il logger di debug se `debug: true`)
|
|
37
|
+
*/
|
|
38
|
+
export function createPurgeCSSPlugins({
|
|
39
|
+
contentGlobs,
|
|
40
|
+
safelist,
|
|
41
|
+
variablesSafelist,
|
|
42
|
+
variables = true,
|
|
43
|
+
keyframes = true,
|
|
44
|
+
debug = false
|
|
45
|
+
}) {
|
|
46
|
+
const commonOptions = {
|
|
47
|
+
paths: () => globSync(contentGlobs, { nodir: true }),
|
|
48
|
+
|
|
49
|
+
// extractor di default (/[A-Za-z0-9_-]+/g): adeguato alle classi/tag/id del progetto,
|
|
50
|
+
// non servono extractors custom
|
|
51
|
+
|
|
52
|
+
variables,
|
|
53
|
+
keyframes,
|
|
54
|
+
// fontFace resta false (default): i font sono referenziati solo tramite
|
|
55
|
+
// var(--font-family) e purgecss non risolve le custom properties nei valori
|
|
56
|
+
|
|
57
|
+
rejected: debug // popola purgedStats per il log di debug
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const pluginCritical = new PurgeCSSPlugin({
|
|
61
|
+
...commonOptions,
|
|
62
|
+
only: ['.critical'],
|
|
63
|
+
safelist
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const pluginMain = new PurgeCSSPlugin({
|
|
67
|
+
...commonOptions,
|
|
68
|
+
safelist: {
|
|
69
|
+
...safelist,
|
|
70
|
+
// elenco generato: usi di var() nei blocchi `purgecss ignore` e nei css
|
|
71
|
+
// shadow-DOM/`?raw`, override cross-asset (seeds), con chiusura transitiva
|
|
72
|
+
// delle dipendenze (vedi purgecss-variables-safelist.mjs)
|
|
73
|
+
variables: purgecssVariablesSafelist(variablesSafelist)
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return [
|
|
78
|
+
pluginCritical,
|
|
79
|
+
pluginMain,
|
|
80
|
+
|
|
81
|
+
// log dei selettori rimossi (richiede `debug: true`, che imposta anche `rejected: true`)
|
|
82
|
+
...(debug ? [{
|
|
83
|
+
apply: (compiler) => {
|
|
84
|
+
compiler.hooks.afterEmit.tap('PurgeCSSLog', () => {
|
|
85
|
+
/* eslint-disable no-console */
|
|
86
|
+
console.log('\n--- [PurgeCSS] Selettori rimossi (critical) ---');
|
|
87
|
+
console.dir(pluginCritical.purgedStats, { depth: null, maxArrayLength: null });
|
|
88
|
+
console.log('\n--- [PurgeCSS] Selettori rimossi ---');
|
|
89
|
+
console.dir(pluginMain.purgedStats, { depth: null, maxArrayLength: null });
|
|
90
|
+
/* eslint-enable no-console */
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}] : [])
|
|
94
|
+
];
|
|
95
|
+
}
|
|
@@ -18,11 +18,8 @@ import RemoveEmptyScriptsPlugin from 'webpack-remove-empty-scripts';
|
|
|
18
18
|
// import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
|
|
19
19
|
// import HtmlWebpackInjectAttributesPlugin from 'html-webpack-inject-attributes-plugin';
|
|
20
20
|
|
|
21
|
-
import { PurgeCSSPlugin } from 'purgecss-webpack-plugin';
|
|
22
|
-
import { globSync } from 'glob';
|
|
23
|
-
|
|
24
21
|
import { cssRules } from './webpack-modules/css-rules.mjs';
|
|
25
|
-
import {
|
|
22
|
+
import { createPurgeCSSPlugins } from './webpack-modules/purgecss-setup.mjs';
|
|
26
23
|
import { getJsConfigAliases } from './webpack-modules/get-jsConfig-aliases.mjs';
|
|
27
24
|
import { svgRules } from './webpack-modules/svg-rules.mjs';
|
|
28
25
|
|
|
@@ -41,21 +38,42 @@ const isDevelopment = process.env.NODE_ENV === 'development'
|
|
|
41
38
|
,favicons_path = 'frontend/favicons/output'
|
|
42
39
|
,favicons_path_regexp = new RegExp(favicons_path) // source pattern per le favicons (regexp o null)
|
|
43
40
|
,jsConfigAliases = getJsConfigAliases(path.resolve(__dirname, './jsconfig.json'))
|
|
44
|
-
,packageJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, './package.json'), 'utf-8'))
|
|
45
|
-
,
|
|
41
|
+
,packageJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, './package.json'), 'utf-8')),usePurgeCss = true // false per disattivare PurgeCSS (debug rapido di problemi legati al purge)
|
|
42
|
+
,usePurgeCss = true // false per disattivare PurgeCSS (debug rapido di problemi legati al purge)
|
|
43
|
+
,purgeCSSOptions = {
|
|
44
|
+
variables: false, // rimuove le custom properties non usate (sostituisce jit-props)
|
|
45
|
+
keyframes: true, // rimuove i @keyframes non referenziati
|
|
46
|
+
debug: false // true per loggare i selettori rimossi da PurgeCSS a fine build
|
|
47
|
+
}
|
|
46
48
|
// ,manifest_shared_seed = {}
|
|
47
49
|
;
|
|
48
50
|
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
|
57
|
+
//
|
|
58
|
+
// TODO: se in futuro la duplicazione di css tra le pagine dovesse crescere
|
|
59
|
+
// (componenti importati dal js di più entry), valutare un cacheGroup `styles`
|
|
60
|
+
// 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)
|
|
63
|
+
const shared_chunk_paths = (module) => {
|
|
64
|
+
if (usePurgeCss && module.type === 'css/mini-extract') return false;
|
|
65
|
+
|
|
66
|
+
// path delle directory da utilizzare nel chunk `shared`
|
|
67
|
+
const sep = '[\\\\/]'; // stringa che produce [\\/] nel pattern
|
|
68
|
+
const pathsRegexp = new RegExp([
|
|
53
69
|
'node_modules',
|
|
54
70
|
'frontend/src/js',
|
|
55
71
|
'frontend/src/web-components',
|
|
56
72
|
'frontend/src/components',
|
|
57
|
-
].map(p => `${sep}${p.replace(/\//g, sep)}${sep}`).join('|')
|
|
58
|
-
|
|
73
|
+
].map(p => `${sep}${p.replace(/\//g, sep)}${sep}`).join('|'));
|
|
74
|
+
|
|
75
|
+
return pathsRegexp.test(module.nameForCondition?.() ?? '');
|
|
76
|
+
};
|
|
59
77
|
|
|
60
78
|
|
|
61
79
|
// hash: https://medium.com/@web_developer/hash-vs-chunkhash-vs-contenthash-e94d38a32208
|
|
@@ -262,6 +280,11 @@ const config = {
|
|
|
262
280
|
// =>> optimization
|
|
263
281
|
optimization: {
|
|
264
282
|
minimize: !isDevelopment,
|
|
283
|
+
// di default true solo se minimize:true (quindi false in dev): esplicito qui perché
|
|
284
|
+
// PurgeCSSPlugin modifica gli asset css dopo il calcolo dell'hash "veloce" — senza
|
|
285
|
+
// questo, in dev il contenthash non riflette le modifiche di PurgeCSS e il browser
|
|
286
|
+
// può servire dalla cache una versione stale pur avendo rigenerato la build
|
|
287
|
+
// realContentHash: true,
|
|
265
288
|
minimizer: [
|
|
266
289
|
new CssMinimizerPlugin(),
|
|
267
290
|
new TerserPlugin({
|
|
@@ -292,38 +315,9 @@ const config = {
|
|
|
292
315
|
},
|
|
293
316
|
|
|
294
317
|
shared: {
|
|
295
|
-
//
|
|
296
|
-
//
|
|
297
|
-
|
|
298
|
-
// per singolo asset) e per i critical css inlinati nei template
|
|
299
|
-
//
|
|
300
|
-
// TODO: se in futuro la duplicazione di css tra le pagine dovesse crescere
|
|
301
|
-
// (componenti importati dal js di più entry), valutare un cacheGroup `styles`
|
|
302
|
-
// dedicato ai css condivisi: andranno escluse le entry `.critical` (devono
|
|
303
|
-
// restare autosufficienti) e gestite in safelist.variables le custom properties
|
|
304
|
-
// definite/consumate tra asset diversi (vedi purgecss-variables-safelist.mjs)
|
|
305
|
-
test: (module) => module.type !== 'css/mini-extract'
|
|
306
|
-
&& shared_chunk_paths.test(module.nameForCondition?.() ?? ''),
|
|
307
|
-
// test: /[\\/]node_modules[\\/]/,
|
|
308
|
-
|
|
309
|
-
// alternativa: non include nel chunk shared i path che contengono la stringa `blurhash`
|
|
310
|
-
// test: /[\\/]node_modules[\\/](?!.*blurhash)/i,
|
|
311
|
-
|
|
312
|
-
// alternativa: verifica se l'import ha una query specifica (?exclude-shared-chunk)
|
|
313
|
-
// test(module) {
|
|
314
|
-
// const resource = module.nameForCondition && module.nameForCondition();
|
|
315
|
-
// if (!resource) return false;
|
|
316
|
-
|
|
317
|
-
// // Verifica se è in node_modules
|
|
318
|
-
// const isNodeModule = /[\\/]node_modules[\\/]/.test(resource);
|
|
319
|
-
|
|
320
|
-
// // module.resource è il percorso completo + query string
|
|
321
|
-
// const hasExcludeQuery = module.resource && module.resource.includes('exclude-shared-chunk');
|
|
322
|
-
|
|
323
|
-
// // Include nel chunk shared solo se è un node_module E NON ha la query
|
|
324
|
-
// return isNodeModule && !hasExcludeQuery;
|
|
325
|
-
// },
|
|
326
|
-
// test: /[\\/]node_modules[\\/](?!.*blurhash)(?!.*@massimo-cassandro\/unsplash-page)/i,
|
|
318
|
+
// vedi shared_chunk_paths sopra per la logica completa del test
|
|
319
|
+
// (path match + esclusione css quando PurgeCSS è attivo)
|
|
320
|
+
test: shared_chunk_paths,
|
|
327
321
|
name: 'shared',
|
|
328
322
|
chunks: 'all'
|
|
329
323
|
}
|
|
@@ -481,39 +475,73 @@ const config = {
|
|
|
481
475
|
exclude: /\.critical/ // chunk name
|
|
482
476
|
}),
|
|
483
477
|
|
|
484
|
-
// =>> plugins: PurgeCSSPlugin (per ultimo, attivo in dev
|
|
485
|
-
// di purge devono emergere subito durante lo sviluppo, non solo in build)
|
|
478
|
+
// =>> plugins: PurgeCSSPlugin (per ultimo, attivo anche in dev)
|
|
486
479
|
// https://github.com/FullHuman/purgecss/tree/main/packages/purgecss-webpack-plugin
|
|
487
480
|
// https://purgecss.com/configuration.html
|
|
488
|
-
//
|
|
489
|
-
//
|
|
490
|
-
//
|
|
491
|
-
//
|
|
492
|
-
//
|
|
493
|
-
//
|
|
494
|
-
//
|
|
495
|
-
//
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
console.dir(purgeCSSPluginCritical.purgedStats, { depth: null, maxArrayLength: null });
|
|
510
|
-
console.log('\n--- [PurgeCSS] Selettori rimossi ---');
|
|
511
|
-
console.dir(purgeCSSPlugin.purgedStats, { depth: null, maxArrayLength: null });
|
|
512
|
-
/* eslint-enable no-console */
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
}] : [])
|
|
481
|
+
// istanze e opzioni in webpack-modules/purgecss-setup.mjs (qui solo flag/dati progetto)
|
|
482
|
+
// `usePurgeCss: false` disattiva il purge per intero (utile per isolare rapidamente
|
|
483
|
+
// eventuali problemi legati ad esso); `purgeCSSOptions` (variables/keyframes/debug,
|
|
484
|
+
// vedi sopra) si applica solo quando è attivo
|
|
485
|
+
// NB: il purge è attivo anche in dev, per far emergere subito eventuali
|
|
486
|
+
// rimozioni errate. In watch mode i template twig NON sono osservati da
|
|
487
|
+
// webpack: dopo aver aggiunto una classe solo in un twig occorre rilanciare
|
|
488
|
+
// la build (o toccare un file js/css) per aggiornare il purge
|
|
489
|
+
...(usePurgeCss
|
|
490
|
+
? createPurgeCSSPlugins({
|
|
491
|
+
|
|
492
|
+
// SOLO file che generano markup o classi (twig, php, js);
|
|
493
|
+
// i file di stile vengono comunque scartati dal plugin
|
|
494
|
+
contentGlobs: [
|
|
495
|
+
path.resolve(__dirname, '../templates/**/*.twig'),
|
|
496
|
+
path.resolve(__dirname, '../src/**/*.php'),
|
|
497
|
+
path.resolve(__dirname, './src/**/*.{js,mjs,jsx}'),
|
|
498
|
+
path.resolve(__dirname, './error-pages/**/*.js'),
|
|
499
|
+
// il js di minimo genera markup con classi proprie (snackbar, unsplash-page, ecc.)
|
|
500
|
+
path.resolve(__dirname, '../node_modules/@massimo-cassandro/minimo/src/**/*.{js,mjs}'),
|
|
501
|
+
],
|
|
516
502
|
|
|
503
|
+
safelist: {
|
|
504
|
+
standard: [
|
|
505
|
+
// flash messages: class="alert alert-{{ label }}" (templates/incl/flash-messages.html.twig)
|
|
506
|
+
/^alert-(success|notice|error|warning)$/
|
|
507
|
+
],
|
|
508
|
+
deep: [
|
|
509
|
+
// css modules: prefisso `m_` della build di produzione (vedi css-rules.mjs),
|
|
510
|
+
// le classi hashate non possono comparire nei file scansionati
|
|
511
|
+
/^m_/
|
|
512
|
+
],
|
|
513
|
+
greedy: [
|
|
514
|
+
// purgecss non riconosce il nesting selector nativo: senza questo pattern
|
|
515
|
+
// i selettori annidati composti solo da `&` + pseudo classi (&:hover,
|
|
516
|
+
// &:focus-visible, `&` semplice, ecc.) verrebbero SEMPRE rimossi
|
|
517
|
+
/^&$/
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
|
|
521
|
+
// elenco generato: usi di var() nei blocchi `purgecss ignore` e nei css
|
|
522
|
+
// shadow-DOM/`?raw`, override cross-asset (seeds), con chiusura transitiva
|
|
523
|
+
// delle dipendenze (vedi webpack-modules/purgecss-variables-safelist.mjs)
|
|
524
|
+
variablesSafelist: {
|
|
525
|
+
declarationGlobs: [
|
|
526
|
+
path.resolve(__dirname, './src/**/*.css'),
|
|
527
|
+
path.resolve(__dirname, './error-pages/**/*.css'),
|
|
528
|
+
path.resolve(__dirname, '../node_modules/@massimo-cassandro/minimo/src/**/*.css'),
|
|
529
|
+
],
|
|
530
|
+
shadowGlobs: [
|
|
531
|
+
path.resolve(__dirname, './src/web-components/**/*.css'),
|
|
532
|
+
path.resolve(__dirname, '../node_modules/@massimo-cassandro/minimo/src/web-components/**/*.css'),
|
|
533
|
+
],
|
|
534
|
+
seeds: [
|
|
535
|
+
// override di .login-group (login.css) consumati dai buttons minimo (css globale)
|
|
536
|
+
/^--btn-secondary-/
|
|
537
|
+
]
|
|
538
|
+
},
|
|
539
|
+
|
|
540
|
+
// fontFace resta false (default): i font sono referenziati solo tramite
|
|
541
|
+
// var(--font-family) e purgecss non risolve le custom properties nei valori
|
|
542
|
+
...purgeCSSOptions
|
|
543
|
+
})
|
|
544
|
+
: [])
|
|
517
545
|
], // end plugins
|
|
518
546
|
|
|
519
547
|
module: {
|
package/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
// utilities
|
|
3
2
|
export { betterText } from './src/utilities/better-text.js';
|
|
4
3
|
export { buildPictureTag } from './src/utilities/build-picture-tag.js';
|
|
@@ -30,4 +29,4 @@ export { overlay, removeOverlay } from './src/components/overlay/overlay.js';
|
|
|
30
29
|
export { sf_macro } from './src/components/sf-macro/sf-macro.js';
|
|
31
30
|
export { slideToggle, slideUp, slideDown } from './src/components/slide-up-down-toggle/slide-up-down-toggle.js';
|
|
32
31
|
export { snackbar } from './src/components/snackbar/snackbar.js';
|
|
33
|
-
export {
|
|
32
|
+
export { unsplashPage } from './src/components/unsplash-page/unsplash-page.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@massimo-cassandro/minimo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.1",
|
|
4
4
|
"description": "Light css framework & utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"build-margin-padding-css": "node ./scripts/build-margin-padding-css.mjs",
|
|
40
40
|
"check unresolved props": "node ./design-tokens/utilities/check-unresolved-custom-props.mjs --config ./design-tokens/tokens-config.mjs",
|
|
41
41
|
"test": "node --test \"test/**/*.test.mjs\"",
|
|
42
|
+
"test sideEffects tree-shaking": "node ./test/sideEffects-tree-shaking/run-test.mjs",
|
|
42
43
|
"checkJS": "npx tsc --noEmit -p jsconfig.json",
|
|
43
44
|
"checkJS ./src": "npx tsc --noEmit --allowJs --checkJs --target ES2023 --module ESNext --allowSyntheticDefaultImports --moduleResolution bundler declarations.d.ts src/**/*.js"
|
|
44
45
|
},
|
|
@@ -61,10 +62,17 @@
|
|
|
61
62
|
"dev-tools/**/*",
|
|
62
63
|
"snippets/**/*"
|
|
63
64
|
],
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@svgdotjs/svg.js": "^3.2.7",
|
|
67
|
+
"blurhash": "^2.0.5"
|
|
68
|
+
},
|
|
64
69
|
"peerDependenciesMeta": {
|
|
65
70
|
"@svgdotjs/svg.js": {
|
|
66
71
|
"optional": true
|
|
67
72
|
},
|
|
73
|
+
"blurhash": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
68
76
|
"style-dictionary": {
|
|
69
77
|
"optional": true
|
|
70
78
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{#-
|
|
2
2
|
https://symfony.com/doc/current/controller/error_pages.html#testing-error-pages-during-development
|
|
3
3
|
|
|
4
|
-
test errori: https://
|
|
4
|
+
test errori: https://project.local:8890/_error/<error code>
|
|
5
5
|
-#}
|
|
6
6
|
<!DOCTYPE html>
|
|
7
7
|
<html lang="it" data-err-code="{{ status_code }}" data-err-text="{{ status_text}}">
|
|
@@ -12,22 +12,22 @@ test errori: https://governance.local:8890/_error/<error code>
|
|
|
12
12
|
<title>Errore {{ status_code }}</title>
|
|
13
13
|
<meta name="robots" content="noindex, nofollow, noarchive">
|
|
14
14
|
{%- include 'incl/favicons.incl.html.twig'-%}
|
|
15
|
-
<link rel="preload" href="{{ asset('
|
|
16
|
-
<link rel="stylesheet" href="{{ asset('
|
|
15
|
+
<link rel="preload" href="{{ asset('project.css') }}" as="style">
|
|
16
|
+
<link rel="stylesheet" href="{{ asset('project.css') }}" media="all">
|
|
17
17
|
<link rel="preload" href="{{ asset('error-pages.css') }}" as="style">
|
|
18
18
|
<link rel="stylesheet" href="{{ asset('error-pages.css') }}" media="all">
|
|
19
19
|
<link rel="preload" href="{{ asset('error-pages.js') }}" as="script">
|
|
20
20
|
|
|
21
21
|
<link rel="preload" href="{{ asset('vendors.js') }}" as="script">
|
|
22
22
|
<link rel="preload" href="{{ asset('runtime.js') }}" as="script">
|
|
23
|
-
<link rel="preload" href="{{ asset('
|
|
24
|
-
<link rel="stylesheet" href="{{ asset('
|
|
23
|
+
<link rel="preload" href="{{ asset('shared.css') }}" as="style">
|
|
24
|
+
<link rel="stylesheet" href="{{ asset('shared.css') }}" type="text/css" media="all">
|
|
25
25
|
</head>
|
|
26
26
|
<body>
|
|
27
27
|
<div id="root"></div>
|
|
28
28
|
|
|
29
29
|
<script src="{{ asset('runtime.js') }}"></script>
|
|
30
|
-
<script src="{{ asset('
|
|
30
|
+
<script src="{{ asset('shared.js') }}"></script>
|
|
31
31
|
<script src="{{ asset('error-pages.js') }}"></script>
|
|
32
32
|
</body>
|
|
33
33
|
</html>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { unsplashPage } from '@massimo-cassandro/minimo/index.js';
|
|
4
4
|
|
|
5
5
|
const errCode = document.documentElement.dataset.errCode || '500',
|
|
6
6
|
errText = document.documentElement.dataset.errText,
|
|
@@ -23,7 +23,7 @@ const errCode = document.documentElement.dataset.errCode || '500',
|
|
|
23
23
|
|
|
24
24
|
document.title = `Errore ${errCode}`;
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
unsplashPage({
|
|
27
27
|
targetElement : document.getElementById('root'),
|
|
28
28
|
className : 'error-page',
|
|
29
29
|
unsplashDataUrl : url,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/*! minimo - Modal Alert */
|
|
1
2
|
import * as styles from './modal-alert.module.css';
|
|
2
3
|
import { domBuilder } from '../../utilities/dom-builder/dom-builder.js';
|
|
3
4
|
import { classnames } from '../../utilities/classnames.js';
|
|
@@ -53,7 +54,7 @@ const defaults = {
|
|
|
53
54
|
type: 'success',
|
|
54
55
|
title: 'Operazione completata',
|
|
55
56
|
okBtnText: 'OK',
|
|
56
|
-
okBtnClass: 'btn',
|
|
57
|
+
okBtnClass: 'btn btn-success',
|
|
57
58
|
timer: 4000, // ms
|
|
58
59
|
icon: successIcon
|
|
59
60
|
},
|
|
@@ -61,14 +62,14 @@ const defaults = {
|
|
|
61
62
|
type: 'error',
|
|
62
63
|
title: 'Si è verificato un errore',
|
|
63
64
|
okBtnText: 'OK',
|
|
64
|
-
okBtnClass: 'btn',
|
|
65
|
+
okBtnClass: 'btn btn-danger',
|
|
65
66
|
icon: errorIcon
|
|
66
67
|
},
|
|
67
68
|
warning: {
|
|
68
69
|
type: 'warning',
|
|
69
70
|
title: 'Attenzione!',
|
|
70
71
|
okBtnText: 'OK',
|
|
71
|
-
okBtnClass: 'btn',
|
|
72
|
+
okBtnClass: 'btn btn-warning',
|
|
72
73
|
icon: warningIcon,
|
|
73
74
|
altIcon: dangerIcon,
|
|
74
75
|
useAltIcon: false // when true, uses altIcon (danger) instead of the default warning icon
|
|
@@ -77,7 +78,7 @@ const defaults = {
|
|
|
77
78
|
type: 'info',
|
|
78
79
|
title: null,
|
|
79
80
|
okBtnText: 'OK',
|
|
80
|
-
okBtnClass: 'btn',
|
|
81
|
+
okBtnClass: 'btn btn-info',
|
|
81
82
|
icon: infoIcon
|
|
82
83
|
},
|
|
83
84
|
confirm: {
|
|
@@ -86,8 +87,8 @@ const defaults = {
|
|
|
86
87
|
okBtnText: 'OK',
|
|
87
88
|
cancelBtnText: 'Annulla',
|
|
88
89
|
cancelBtnFocus: true, // false to give focus to the ok button
|
|
89
|
-
okBtnClass: 'btn btn-
|
|
90
|
-
cancelBtnClass: 'btn',
|
|
90
|
+
okBtnClass: 'btn btn-primary',
|
|
91
|
+
cancelBtnClass: 'btn btn-primary btn-hollow',
|
|
91
92
|
icon: confirmIcon,
|
|
92
93
|
altIcon: warningIcon,
|
|
93
94
|
useAltIcon: false // when true, uses altIcon (warning) instead of the default confirm icon
|
|
@@ -189,6 +190,8 @@ export function modalAlert(params = {}) {
|
|
|
189
190
|
? 'cancel'
|
|
190
191
|
: 'ok';
|
|
191
192
|
|
|
193
|
+
console.log(params);
|
|
194
|
+
|
|
192
195
|
const dialog = /** @type {HTMLDialogElement} */ (domBuilder([
|
|
193
196
|
{
|
|
194
197
|
tag: 'dialog',
|
|
@@ -227,7 +230,8 @@ export function modalAlert(params = {}) {
|
|
|
227
230
|
children: [
|
|
228
231
|
{
|
|
229
232
|
tag: 'button',
|
|
230
|
-
className: params.okBtnClass? params.okBtnClass : 'btn btn-
|
|
233
|
+
className: params.okBtnClass? params.okBtnClass : 'btn btn-primary',
|
|
234
|
+
content: params.okBtnText,
|
|
231
235
|
attrs: {
|
|
232
236
|
type: 'button',
|
|
233
237
|
autofocus: focusTarget === 'ok'
|
|
@@ -238,6 +242,7 @@ export function modalAlert(params = {}) {
|
|
|
238
242
|
condition: params.type === 'confirm',
|
|
239
243
|
tag: 'button',
|
|
240
244
|
className: params.cancelBtnClass? params.cancelBtnClass : 'btn btn-secondary btn-hollow',
|
|
245
|
+
content: params.cancelBtnText,
|
|
241
246
|
attrs: {
|
|
242
247
|
type: 'button',
|
|
243
248
|
autofocus: focusTarget === 'cancel'
|