@massimo-cassandro/minimo 1.12.0 → 1.13.0

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 (29) hide show
  1. package/charts/src/node-helpers/create-svg-canvas-node.mjs +37 -0
  2. package/dev-tools/create-favicons/README.md +2 -2
  3. package/dev-tools/create-favicons/src/create-favicons.mjs +15 -7
  4. package/dev-tools/create-favicons/src/create-png.mjs +1 -1
  5. package/dev-tools/create-favicons/src/create-snippet.mjs +4 -4
  6. package/dev-tools/create-favicons/src/create-svg.mjs +3 -7
  7. package/dev-tools/create-favicons/src/create-webmanifest.mjs +3 -9
  8. package/dev-tools/create-favicons/src/default-params.mjs +4 -2
  9. package/dev-tools/create-favicons/src/init-start-text.txt +20 -0
  10. package/dev-tools/create-favicons/src/parse-params.mjs +26 -0
  11. package/dev-tools/create-favicons/src/print-result.mjs +1 -1
  12. package/dev-tools/webpack-setup/templates/jsconfig.json +10 -11
  13. package/dev-tools/webpack-setup/templates/package-tpl.json +1 -1
  14. package/dev-tools/webpack-setup/webpack-modules/mini-svg-data-uri-loader.cjs +25 -0
  15. package/package.json +6 -7
  16. package/snippets/build-chrome-custom-device-list.mjs +101 -0
  17. package/snippets/config-templates/_env.local +13 -0
  18. package/snippets/config-templates/_github/dependabot.yml +10 -0
  19. package/snippets/config-templates/_hintrc.cjs +35 -0
  20. package/snippets/config-templates/_htaccess +69 -0
  21. package/snippets/config-templates/_npmignore +8 -0
  22. package/snippets/config-templates/_npmrc +1 -0
  23. package/snippets/config-templates/_stylelintignore +5 -0
  24. package/snippets/config-templates/babel.config--react.json +20 -0
  25. package/snippets/config-templates/babel.config--solidJS.json +8 -0
  26. package/snippets/config-templates/react/offcanvas/offcanvas.jsx +89 -0
  27. package/snippets/config-templates/react/offcanvas/offcanvas.module.scss +109 -0
  28. package/snippets/config-templates/robots.txt +5 -0
  29. package/snippets/config-templates/rollup.config.mjs +115 -0
@@ -0,0 +1,37 @@
1
+ /*
2
+ per utilizzo con applicazioni node, di default non utilizzato.
3
+ Dove necessario rimpiazza la funzione `createSvgCanvas` di default
4
+ Vedi ./demo/node-demo/index.mjs
5
+
6
+ {
7
+ utils: { createSvgCanvas: createSvgCanvasNode}
8
+ // ...
9
+ }
10
+
11
+ */
12
+
13
+ import { createSVGWindow } from 'svgdom';
14
+ import { SVG, registerWindow } from '@svgdotjs/svg.js';
15
+
16
+ // "@svgdotjs/svg.js": "^3.2.4",
17
+ // "svgdom": "^0.1.21"
18
+
19
+
20
+ // https://svgjs.dev/docs/3.2/getting-started/
21
+ // https://github.com/svgdotjs/svgdom#readme
22
+
23
+
24
+ export function createSvgCanvasNode() {
25
+
26
+ // returns a window with a document and an svg root node
27
+ const window = createSVGWindow();
28
+ const document = window.document;
29
+
30
+ // register window and document
31
+ registerWindow(window, document);
32
+
33
+ // create svgCanvas
34
+ const svgCanvas = SVG(document.documentElement);
35
+
36
+ return svgCanvas;
37
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Create favicon files as described in [How to Favicon in 2024](https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs).
4
4
 
5
- The files to be processed must be in SVG format, while the generated files are in SVG (favicon), PNG (apple-touch-icon and other Android files), and ICO (another favicon for compatibility with older browsers). The `manifest.webmanifest` files are also generated, along with an optional HTML snippet with `link` tags for inserting the generated elements.
5
+ The source file can be SVG or a raster format (PNG, JPEG, WEBP, GIF, TIFF, AVIF). The generated files are PNG (apple-touch-icon and other Android files) and ICO (another favicon for compatibility with older browsers); an SVG favicon is also generated, but only when the source file itself is SVG (a vector favicon can't be derived from a raster source). The `manifest.webmanifest` files are also generated, along with an optional HTML snippet with `link` tags for inserting the generated elements (the snippet omits the SVG `link` tag when no SVG favicon was generated).
6
6
 
7
7
  Images are generated with [Sharp](https://sharp.pixelplumbing.com/), [SVGO](https://github.com/svg/svgo), and [sharp-ico](https://github.com/ssnangua/sharp-ico).
8
8
 
@@ -34,7 +34,7 @@ If it's missing, it searches for the `favicon-src.svg` file to use as the source
34
34
 
35
35
  Among others, you can specify the `small_src_img` parameter if you need to specify an image optimized for small dimensions (32px).
36
36
 
37
- The best format for source files is SVG, or alternatively PNG.
37
+ The best format for source files is SVG, or alternatively PNG/JPEG/WEBP/GIF/TIFF/AVIF.
38
38
 
39
39
  If both files are missing, an error is returned.
40
40
 
@@ -18,13 +18,21 @@ export async function createFavicons(params) {
18
18
 
19
19
  log('green', 'Creating favicons...');
20
20
 
21
- await Promise.all([
22
- await createSvg(params),
23
- await createPng(params),
24
- await createIco(params),
25
- await createWebmanifest(params), // after create png
26
- await createSnippet(params),
27
- ])
21
+ // createWebmanifest legge i png generati da createPng per calcolarne l'hash:
22
+ // deve quindi essere eseguito solo a scrittura completata
23
+ await createPng(params);
24
+
25
+ const tasks = [
26
+ createIco(params),
27
+ createWebmanifest(params),
28
+ createSnippet(params),
29
+ ];
30
+
31
+ if (params.generate_svg_favicon) {
32
+ tasks.push(createSvg(params));
33
+ }
34
+
35
+ await Promise.all(tasks)
28
36
  .then(result => {
29
37
  printResult(params);
30
38
 
@@ -9,7 +9,7 @@ export async function createPng(params) {
9
9
  ['icon-192.png', 192],
10
10
  ['icon-512.png', 512]
11
11
  ].map(file => {
12
- sharp(params.src_img)
12
+ return sharp(params.src_img)
13
13
  .resize({ width: file[1], fit: 'inside' })
14
14
  .png(params.png_parameters)
15
15
  .toFile(`${params.output_dir}/${file[0]}`)
@@ -10,7 +10,7 @@ export async function createSnippet(params) {
10
10
  if (params.snippet_language === 'ejs') {
11
11
 
12
12
  snippet_content = '<link rel="icon" href="<%= require(\'./favicon.ico\') %>" sizes="32x32"/>\n' +
13
- '<link rel="icon" href="<%= require(\'./favicon.svg\') %>" type="image/svg+xml"/>\n' +
13
+ (params.generate_svg_favicon? '<link rel="icon" href="<%= require(\'./favicon.svg\') %>" type="image/svg+xml"/>\n' : '') +
14
14
  '<link rel="apple-touch-icon" href="<%= require(\'./apple-touch-icon.png\') %>"/>\n' +
15
15
  '<link rel="manifest" href="./manifest.webmanifest"/>';
16
16
 
@@ -24,7 +24,7 @@ export async function createSnippet(params) {
24
24
 
25
25
 
26
26
  snippet_content = `<link rel="icon" href="${create_href('favicon.ico')}" sizes="32x32"/>\n` +
27
- `<link rel="icon" href="${create_href('favicon.svg')}" type="image/svg+xml"/>\n` +
27
+ (params.generate_svg_favicon? `<link rel="icon" href="${create_href('favicon.svg')}" type="image/svg+xml"/>\n` : '') +
28
28
  `<link rel="apple-touch-icon" href="${create_href('apple-touch-icon.png')}"/>\n` +
29
29
  `<link rel="manifest" href="${create_href('manifest.webmanifest')}"/>`;
30
30
 
@@ -42,7 +42,7 @@ export async function createSnippet(params) {
42
42
  const targetFileContent = fs.readFileSync(params.snippet_target_file, 'utf8'),
43
43
  regexp = /<!-- ?favicon-snippet-start ?-->(.*?)<!-- ?favicon-snippet-end ?-->/mis;
44
44
 
45
- fs.promises.writeFile(params.snippet_target_file,
45
+ await fs.promises.writeFile(params.snippet_target_file,
46
46
  targetFileContent.replace(regexp,
47
47
  `<!-- favicon-snippet-start -->\n${snippet_content}\n<!-- favicon-snippet-end -->`
48
48
  )
@@ -54,7 +54,7 @@ export async function createSnippet(params) {
54
54
 
55
55
  } else {
56
56
 
57
- fs.promises.writeFile(
57
+ await fs.promises.writeFile(
58
58
  `${params.snippet_path}/${params.snippet_name}`,
59
59
  snippet_content
60
60
  );
@@ -4,12 +4,8 @@ import * as fs from 'fs/promises';
4
4
  export async function createSvg(params) {
5
5
 
6
6
  // TODO add extra config ???
7
- await fs.readFile(params.small_src_img?? params.src_img, { encoding: 'utf8' })
8
- .then(svgString => {
7
+ const svgString = await fs.readFile(params.small_src_img?? params.src_img, { encoding: 'utf8' }),
8
+ svg_result = optimize(svgString, { multipass: true});
9
9
 
10
- const svg_result = optimize(svgString, { multipass: true});
11
-
12
- fs.writeFile(`${params.output_dir}/favicon.svg`, svg_result.data);
13
-
14
- });
10
+ await fs.writeFile(`${params.output_dir}/favicon.svg`, svg_result.data);
15
11
  }
@@ -1,7 +1,7 @@
1
1
  // web manifest
2
2
 
3
- // import * as fs from 'fs/promises';
4
3
  import * as fs from 'fs';
4
+ import * as fsPromises from 'fs/promises';
5
5
  import { createHash } from 'node:crypto'
6
6
 
7
7
 
@@ -50,15 +50,9 @@ export async function createWebmanifest(params) {
50
50
  ...(params.webmanifest_extra?? {})
51
51
  };
52
52
 
53
- // await fs.writeFile(`${params.output_dir}/manifest.webmanifest`, JSON.stringify(manifest, null, ' '));
54
-
55
- await fs.writeFile(
53
+ await fsPromises.writeFile(
56
54
  `${params.output_dir}/${params.manifest_file_name}`,
57
- JSON.stringify(manifest, null, ' '),
58
- (err) => {
59
- if (err) {throw err}
60
- // console.log('The file has been saved!');
61
- }
55
+ JSON.stringify(manifest, null, ' ')
62
56
  );
63
57
 
64
58
  }
@@ -5,10 +5,12 @@ export const default_params = {
5
5
 
6
6
  // tutti i percorsi sono relativi alla dir di lavoro
7
7
 
8
- // immagine sorgente SVG o PNG 512x512
8
+ // immagine sorgente, min. 512x512
9
+ // formati accettati: svg, png, jpg/jpeg, webp, gif, tiff/tif, avif
10
+ // il file favicon.svg viene generato solo se la sorgente utilizzata è in formato svg
9
11
  src_img: 'favicon-src.svg',
10
12
 
11
- // sorgente opzionale per immagini piccole (32px)
13
+ // sorgente opzionale per immagini piccole (32px), stessi formati di src_img
12
14
  small_src_img: null,
13
15
 
14
16
  // directory output (percorso relativo alla dir di lavoro)
@@ -0,0 +1,20 @@
1
+ /*
2
+ File di configurazione per `create-favicons`.
3
+
4
+ I valori indicati sono quelli di default.
5
+ Per avviare la generazione delle favicon digitare
6
+
7
+ npx create-favicons
8
+
9
+ dalla directory che contiene questo file.
10
+
11
+ (o `npx create-favicons --dir=./path/to/config/dir` dalla root del progetto)
12
+
13
+ TUTTI I PERCORSI DALLA DIRECTORY CHE CONTIENE IL FILE DI CONFIGURAZIONE
14
+
15
+ Creazione favicons (senza installare il package nel progetto):
16
+ npx --package=@massimo-cassandro/create-favicons create-favicons (dalla dir corrente)
17
+
18
+ Altre info: https://github.com/massimo-cassandro/create-favicons
19
+
20
+ */
@@ -2,6 +2,15 @@ import { default_params } from './default-params.mjs';
2
2
  import * as path from 'path';
3
3
  import * as fs from 'fs';
4
4
 
5
+ // formati accettati per le immagini sorgente (src_img / small_src_img)
6
+ // vettoriale: svg
7
+ // raster (letti tramite Sharp): png, jpg/jpeg, webp, gif, tiff/tif, avif
8
+ const supported_img_ext = ['svg', 'png', 'jpg', 'jpeg', 'webp', 'gif', 'tiff', 'tif', 'avif'];
9
+
10
+ function getImgExt(img_path) {
11
+ return path.extname(img_path).toLowerCase().replace(/^\./, '');
12
+ }
13
+
5
14
  export function parseParams(config_params = null, work_dir = process.cwd()) {
6
15
 
7
16
  try {
@@ -31,6 +40,22 @@ export function parseParams(config_params = null, work_dir = process.cwd()) {
31
40
  params[item] = params[item]? path.resolve(params.work_dir, params[item]) : null
32
41
  );
33
42
 
43
+ // validazione formato immagini sorgente
44
+ [params.src_img, params.small_src_img].filter(Boolean).forEach(img_path => {
45
+ const ext = getImgExt(img_path);
46
+ if (!supported_img_ext.includes(ext)) {
47
+ throw new Error(
48
+ `Formato immagine non supportato: '${img_path}'. ` +
49
+ `Formati accettati: ${supported_img_ext.join(', ')}`
50
+ );
51
+ }
52
+ });
53
+
54
+ // il file favicon.svg viene generato solo se l'immagine sorgente utilizzata
55
+ // per le versioni piccole (small_src_img, o src_img in sua assenza) è già SVG:
56
+ // da un raster non è possibile ricavare una favicon vettoriale
57
+ params.generate_svg_favicon = getImgExt(params.small_src_img?? params.src_img) === 'svg';
58
+
34
59
  // creazione dir output se non esiste
35
60
  if (!fs.existsSync(params.output_dir)){
36
61
  fs.mkdirSync(params.output_dir);
@@ -56,6 +81,7 @@ export function parseParams(config_params = null, work_dir = process.cwd()) {
56
81
 
57
82
  } catch(e) {
58
83
  console.error( e ); // eslint-disable-line
84
+ process.exit(1);
59
85
  }
60
86
 
61
87
  }
@@ -21,7 +21,7 @@ export function printResult(params) {
21
21
  [
22
22
  'apple-touch-icon.png',
23
23
  'favicon.ico',
24
- 'favicon.svg',
24
+ ...(params.generate_svg_favicon? ['favicon.svg'] : []),
25
25
  'icon-192.png',
26
26
  'icon-512.png',
27
27
  params.manifest_file_name
@@ -1,22 +1,21 @@
1
1
  {
2
2
  "__help": "https://code.visualstudio.com/docs/languages/jsconfig",
3
3
  "compilerOptions": {
4
- "checkJs": true,
5
- "target": "ES2023",
6
- "module": "ESNext",
4
+ "ignoreDeprecations": "6.0",
7
5
  "baseUrl": ".",
8
6
  "allowSyntheticDefaultImports": false,
7
+
8
+ "target": "es2023",
9
+ "module": "ES6",
9
10
  "paths": {
10
- "@frontend/*": ["./frontend/*"],
11
- "@src/*": ["frontend/src/*"],
11
+ "@css/*": ["./frontend/src/css/*"],
12
+ "@src/*": ["./frontend/src/*"],
13
+ "@icons/*": ["./frontend/icons/*"],
12
14
  "@imgs/*": ["./frontend/imgs/*"],
13
- "@icone/*": ["./frontend/icone/*"],
14
- "@backoffice/*": ["./frontend/backoffice/*"],
15
- "@minimo/*": ["./node_modules/@massimo-cassandro/minimo/src/*"]
15
+ "@frontend/*": ["./frontend/*"],
16
+ "@minimo/*": ["./node_modules/@massimo-cassandro/minimo/src/*"],
17
+ "@minimoCharts/*": ["./node_modules/@massimo-cassandro/minimo/charts/*"]
16
18
  }
17
-
18
-
19
-
20
19
  },
21
20
  "exclude": ["node_modules", "dist", "docs", "build", "public"]
22
21
  }
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "scripts": {
20
20
  "progetto JS webpack DEV": "npm 'launchChrome' && NODE_ENV=development webpack serve --config ./webpack.config.mjs #--open-app-name 'Google Chrome'",
21
- "progettop sf webpack DEV": "rm -rf ./public/_dev && NODE_ENV=development webpack --config ./frontend/webpack.config.mjs",
21
+ "progetto sf webpack DEV": "rm -rf ./public/_dev && NODE_ENV=development webpack --config ./frontend/webpack.config.mjs",
22
22
  "webpack PROD": "NODE_ENV=production webpack --config ./webpack.config.mjs --stats minimal",
23
23
  "create-favicons INIT": "npx create-favicons init",
24
24
  "create-favicons": "npx create-favicons --dir=./src/favicons",
@@ -0,0 +1,25 @@
1
+ // ./loaders/mini-svg-data-uri-loader.cjs
2
+ // Questo file USA la libreria 'mini-svg-data-uri', ma è un wrapper specifico per Webpack.
3
+
4
+ /* eslint-env node */
5
+ // Nota: require perché i Webpack Loaders sono tradizionalmente CommonJS,
6
+ // e Node.js li gestisce correttamente con l'estensione .cjs.
7
+ const svgToMiniDataURI = require('mini-svg-data-uri');
8
+
9
+ /**
10
+ * Webpack Loader che prende una stringa SVG e la converte in un
11
+ * Data URI compatto usando la libreria mini-svg-data-uri.
12
+ * @param {string} source - Contenuto SVG (già ottimizzato da svgo-loader)
13
+ * @returns {string} Il Data URI SVG compatto (formato stringa)
14
+ */
15
+ module.exports = function (source) {
16
+
17
+ // rimuove height e width nel svgo non fosse attivato
18
+ source = source.replace(/ width="\d+"/, '').replace(/ height="\d+"/, '');
19
+
20
+ // Richiama la funzione per ottenere l'URI compatto
21
+ const dataUri = svgToMiniDataURI(source);
22
+
23
+ // Ritorna la stringa Data URI
24
+ return dataUri;
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -55,11 +55,9 @@
55
55
  "design-tokens/tokens/**/*.{tokens.json,tokens.jsonc}",
56
56
  "design-tokens/_src/**/*.{tokens.json,tokens.jsonc,mjs,js,md}",
57
57
  "design-tokens/utilities/**/*.{mjs,md}",
58
- "charts/**/*.{js,md}",
59
- "dev-tools/**/*.{js,mjs,md,html}",
60
- "dev-tools/webpack-setup/**/*.{js,mjs,md,sh,json,ejs}",
61
- "dev-tools/webpack-setup/**/_*",
62
- "snippets/**/*.{php,js,md,twig}"
58
+ "charts/**/*.{js,mjs,md}",
59
+ "dev-tools/**/*",
60
+ "snippets/**/*"
63
61
  ],
64
62
  "peerDependenciesMeta": {
65
63
  "@svgdotjs/svg.js": {
@@ -80,6 +78,7 @@
80
78
  "@inquirer/select": "^5.2.1",
81
79
  "clipboardy": "^5.3.1",
82
80
  "sharp": "^0.35.3",
83
- "sharp-ico": "^0.1.5"
81
+ "sharp-ico": "^0.1.5",
82
+ "svgo": "^4.0.2"
84
83
  }
85
84
  }
@@ -0,0 +1,101 @@
1
+ /* eslint-disable no-console */
2
+ /* eslint-env node */
3
+
4
+ import fs from 'fs';
5
+
6
+ const device_std_height = 700,
7
+
8
+ breakpoints = [
9
+ {title: 'moto g5', w: 360, h: 512},
10
+
11
+ {title: 'bs5 xs max', w: 575, h: device_std_height},
12
+ {title: 'bs5 sm min', w: 576, h: device_std_height},
13
+ {title: 'bs5 sm max', w: 767, h: device_std_height},
14
+ {title: 'bs5 md min', w: 768, h: device_std_height},
15
+ {title: 'bs5 md max', w: 991, h: device_std_height},
16
+ {title: 'bs5 lg min', w: 992, h: device_std_height},
17
+ {title: 'bs5 lg max', w: 1199, h: device_std_height},
18
+ {title: 'bs5 xl min', w: 1200, h: device_std_height},
19
+ {title: 'bs5 xl max', w: 1399, h: device_std_height},
20
+ {title: 'bs5 xxl min', w: 1400, h: device_std_height},
21
+
22
+
23
+ {title: 'schermo staff BV (1280x960)', w: 1280, h: 960},
24
+ {title: '1366x768', w: 1366, h: 768},
25
+ {title: '1280x720 (HD)', w: 1280, h: 720},
26
+ {title: '1920x1080 (full HD)', w: 1920, h: 1980},
27
+
28
+ ];
29
+
30
+ let device_list = breakpoints.map((item, idx) => {
31
+
32
+ return {
33
+ 'title': ('00' + String(idx+1)).slice(-2) + '. ' + item.title,
34
+ 'type': 'unknown',
35
+ 'user-agent': '',
36
+ 'capabilities': [
37
+ 'mobile'
38
+ ],
39
+ 'screen': {
40
+ 'device-pixel-ratio': 0,
41
+ 'vertical': {
42
+ 'width': item.w,
43
+ 'height': item.h
44
+ },
45
+ 'horizontal': {
46
+ 'width': item.h,
47
+ 'height': item.w
48
+ }
49
+ },
50
+ 'modes': [
51
+ {
52
+ 'title': '',
53
+ 'orientation': 'vertical',
54
+ 'insets': {
55
+ 'left': 0,
56
+ 'top': 0,
57
+ 'right': 0,
58
+ 'bottom': 0
59
+ }
60
+ },
61
+ {
62
+ 'title': '',
63
+ 'orientation': 'horizontal',
64
+ 'insets': {
65
+ 'left': 0,
66
+ 'top': 0,
67
+ 'right': 0,
68
+ 'bottom': 0
69
+ }
70
+ }
71
+ ],
72
+ 'show-by-default': true,
73
+ 'dual-screen': false,
74
+ 'show': 'Default',
75
+ 'user-agent-metadata': {
76
+ 'brands': [
77
+ {
78
+ 'brand': '',
79
+ 'version': ''
80
+ }
81
+ ],
82
+ 'fullVersion': '',
83
+ 'platform': '',
84
+ 'platformVersion': '',
85
+ 'architecture': '',
86
+ 'model': '',
87
+ 'mobile': true
88
+ }
89
+ };
90
+ });
91
+
92
+
93
+ const dest = 'ChromeCustomDeviceList.txt',
94
+ str = '"custom-emulated-device-list":"'+ JSON.stringify(device_list).replace(/"/g, '\\"') + '",';
95
+
96
+ fs.writeFileSync(dest, str);
97
+
98
+ console.log (
99
+ 'copiare all\'interno del file `~/Library/Application Support/Google/Chrome/Default/Preferences` (NB: è un file JSON)\n'+
100
+ 'vedi: https://stackoverflow.com/a/70905335/743443\n'
101
+ );
@@ -0,0 +1,13 @@
1
+ DATABASE_URL=mysql://root:mysql8root@127.0.0.1:3306/xxxx?serverVersion=8.0
2
+
3
+ APP_ENV=dev
4
+ APP_DEBUG=1
5
+
6
+ ### mailHog
7
+ MAILER_DSN=smtp://localhost:1025
8
+
9
+ ### supporto webpack
10
+ # cartella, dentro public, in cui webpack salva js, css immagini ecc
11
+ ASSETS_DIR=_dev
12
+
13
+
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "npm" # Indica che stiamo usando NPM
4
+ directory: "/" # Dove si trova il package.json
5
+ schedule:
6
+ interval: "monthly" # Può essere: daily, weekly, monthly
7
+ open-pull-requests-limit: 15 # Massimo 10 PR aperte contemporaneamente
8
+ labels:
9
+ - "dependencies"
10
+ - "javascript"
@@ -0,0 +1,35 @@
1
+ module.exports = {
2
+ "connector": {
3
+ "name": "local",
4
+ "options": {
5
+ "pattern": ["./build/**/*.html"] // Analizza i file HTML generati nella directory di build
6
+ }
7
+ },
8
+ "extends": [
9
+ "development", // Configurazione base per lo sviluppo
10
+ "accessibility", // Regole per l'accessibilità
11
+ "performance", // Regole per le prestazioni
12
+ "security", // Regole per la sicurezza
13
+ "html-checker" // Controllo della validità HTML
14
+ ],
15
+ "hints": {
16
+ "axe": "error", // Controlla l'accessibilità con axe-core
17
+ "content-type": "error", // Verifica i tipi di contenuto corretti
18
+ "disown-opener": "warning", // Consiglia di usare `rel="noopener"`
19
+ "http-cache": ["warning", { "maxAge": 31536000 }], // Suggerisce una cache HTTP ottimale
20
+ "image-optimization-cloudinary": "off", // Disattiva l'ottimizzazione delle immagini
21
+ "meta-viewport": "error", // Verifica la presenza del meta tag viewport
22
+ "no-vulnerable-javascript-libraries": "error", // Controlla librerie JS vulnerabili
23
+ "performance-budget": [
24
+ "warning",
25
+ {
26
+ "resourceTypes": {
27
+ "script": 250, // Limite di 250 KB per gli script
28
+ "image": 500 // Limite di 500 KB per le immagini
29
+ }
30
+ }
31
+ ],
32
+ "strict-transport-security": "error", // Suggerisce l'uso di HSTS
33
+ "validate-set-cookie-header": "error" // Controlla l'uso corretto dell'header Set-Cookie
34
+ }
35
+ };
@@ -0,0 +1,69 @@
1
+
2
+ # no cache
3
+ # <IfModule mod_headers.c>
4
+ # Header set Cache-Control "no-cache, no-store, must-revalidate"
5
+ # Header set Pragma "no-cache"
6
+ # Header set Expires 0
7
+ # </IfModule>
8
+
9
+ # blocco iframe
10
+ # "deny" = tutti siti
11
+ # "sameorigin" tutti tranne quelli che vengono dalla stessa origine
12
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
13
+ Header set X-Frame-Options "sameorigin"
14
+
15
+
16
+ <IfModule mod_expires.c>
17
+ ExpiresActive On
18
+ AddType application/vnd.ms-fontobject .eot
19
+ AddType application/x-font-ttf .ttf
20
+ AddType application/x-font-opentype .otf
21
+ AddType application/x-font-woff .woff
22
+ AddType application/x-font-woff2 .woff2
23
+ AddType application/font-sfnt otf ttf
24
+ AddType application/font-woff woff
25
+ AddType application/font-woff2 woff2
26
+ AddType image/svg+xml .svg
27
+
28
+ ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
29
+ ExpiresByType application/x-font-ttf "access plus 1 year"
30
+ ExpiresByType application/x-font-opentype "access plus 1 year"
31
+ ExpiresByType application/x-font-woff "access plus 1 year"
32
+ ExpiresByType application/x-font-woff2 "access plus 1 year"
33
+ ExpiresByType application/font-sfnt "access plus 1 year"
34
+ ExpiresByType application/font-woff "access plus 1 year"
35
+ ExpiresByType application/font-woff2 "access plus 1 year"
36
+
37
+ ExpiresByType text/html "access plus 1 hour"
38
+ ExpiresByType text/css "access plus 1 year"
39
+ ExpiresByType text/x-javascript "access plus 1 year"
40
+ ExpiresByType application/javascript "access plus 1 year"
41
+ ExpiresByType application/x-javascript "access plus 1 year"
42
+
43
+ ExpiresByType image/svg+xml "access plus 1 year"
44
+ ExpiresByType image/gif "access plus 1 year"
45
+ ExpiresByType image/png "access plus 1 year"
46
+ ExpiresByType image/jpeg "access plus 1 year"
47
+ ExpiresByType image/pjpeg "access plus 1 year"
48
+ ExpiresByType image/webp "access plus 1 year"
49
+ ExpiresByType image/avif "access plus 1 year"
50
+
51
+ ExpiresByType application/pdf "access plus 1 year"
52
+
53
+ ExpiresByType video/mp4 "access plus 1 year"
54
+ ExpiresByType video/webm "access plus 1 year"
55
+ ExpiresByType video/x-m4v "access plus 1 year"
56
+ ExpiresByType video/quicktime "access plus 1 year"
57
+ ExpiresByType audio/mpeg "access plus 1 year"
58
+ ExpiresByType audio/x-wav "access plus 1 year"
59
+
60
+ ExpiresByType image/x-icon "access plus 1 year"
61
+ ExpiresDefault "access plus 1 year"
62
+ </IfModule>
63
+
64
+ <IfModule !mod_expires.c>
65
+ <IfModule mod_headers.c>
66
+ # 1 year
67
+ Header set Cache-Control 'public, max-age 31536000'
68
+ </IfModule>
69
+ </IfModule>
@@ -0,0 +1,8 @@
1
+ *~
2
+ .codekit-cache/
3
+ config.codekit3
4
+ *.code-workspace
5
+ .DS_Store*
6
+ ehthumbs.db
7
+ Icon?
8
+ Thumbs.db
@@ -0,0 +1 @@
1
+ package-lock=false
@@ -0,0 +1,5 @@
1
+
2
+ /**/*.css
3
+ /**/node_modules/**/*.css
4
+ /**/node_modules/**/*.scss
5
+ /**/node_modules/**/*.less
@@ -0,0 +1,20 @@
1
+ {
2
+ "presets": [
3
+ "@babel/preset-env",
4
+ [
5
+ "@babel/preset-react",
6
+ {
7
+ "runtime": "automatic"
8
+ }
9
+ ]
10
+ ],
11
+ "plugins": [],
12
+ "env": {
13
+ "production": {
14
+ "plugins": [
15
+ "transform-react-remove-prop-types"
16
+ ]
17
+ }
18
+ }
19
+ }
20
+
@@ -0,0 +1,8 @@
1
+ {
2
+ "presets": [
3
+ "@babel/preset-env", "babel-preset-solid"
4
+ ],
5
+ "plugins": [
6
+ "@babel/plugin-syntax-jsx"
7
+ ]
8
+ }
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Offcanvas
3
+ *
4
+ *
5
+ */
6
+
7
+
8
+ import { useEffect } from 'react';
9
+ import PropTypes from 'prop-types';
10
+ import classnames from 'classnames';
11
+ import styles from './offcanvas.module.scss';
12
+
13
+ // https://react-icons.github.io/react-icons/icons/pi/
14
+ import { PiXCircleBold } from 'react-icons/pi';
15
+
16
+
17
+ function Offcanvas(props) {
18
+ const [isHiding, setIsHiding] = React.useState(false),
19
+ [isShowing, setIsShowing] = React.useState(props.show),
20
+ [content, setContent] = React.useState();
21
+
22
+ React.useEffect(() => {
23
+
24
+ // disable body scroll
25
+ document.body.classList.toggle('no-scroll', props.show);
26
+
27
+ if(props.show) {
28
+ setIsShowing(true);
29
+ }
30
+ }, [props.show]);
31
+
32
+ useEffect(() => {
33
+ setContent(
34
+ <div
35
+ role="dialog"
36
+ aria-modal="true"
37
+ className={classnames(
38
+ styles.offcanvas,
39
+ props.className,
40
+ {
41
+ [styles.fullscreen]: props.fullscreen,
42
+ [styles.show]: props.show,
43
+ [styles.hiding]: isHiding,
44
+ [styles.showing]: isShowing
45
+ }
46
+ )}
47
+ tabIndex="-1"
48
+ onTransitionEnd={() => {setIsHiding(false); setIsShowing(false);}}
49
+ >
50
+ <div className={styles.offcanvasInner}>
51
+ <div className={styles.offcanvasHeader}>
52
+ <button
53
+ type="button"
54
+ className={styles.offcanvasClose}
55
+ aria-label="Close"
56
+ onClick={() => {
57
+ setIsHiding(true);
58
+ props.offcanvasShowHandler(props.handlerHideValue);
59
+ }}
60
+ ><PiXCircleBold /></button>
61
+ </div>
62
+ <div className={styles.offcanvasBody}>
63
+ {props.children}
64
+ </div>
65
+ </div>
66
+ </div>
67
+ );
68
+ }, [isHiding, isShowing, props]);
69
+
70
+ return (content);
71
+ }
72
+
73
+ // https://www.npmjs.com/package/prop-types
74
+
75
+ Offcanvas.propTypes = {
76
+ className: PropTypes.string,
77
+ offcanvasShowHandler: PropTypes.func,
78
+ show: PropTypes.bool,
79
+ fullscreen: PropTypes.bool,
80
+ handlerHideValue: PropTypes.any
81
+
82
+ };
83
+ Offcanvas.defaultProps = {
84
+ show: false,
85
+ fullscreen: false,
86
+ handlerHideValue: false
87
+ };
88
+
89
+ export default Offcanvas;
@@ -0,0 +1,109 @@
1
+ // da bs
2
+
3
+ // @use '../scss/cfg/cfg-settings' as settings;
4
+ // @use '../scss/cfg/grid-breakpoints' as breakpoints;
5
+ // @use 'sass:map
6
+
7
+ @use '../scss/mixins/media-mixins' as mediaMixins;
8
+ @use '../scss/mixins/buttons-mixins' as buttonsMixins;
9
+ // @use '../scss/cfg/status-mixins' as statusMixins;
10
+ // @use '../scss/cfg/text-mixins' as textMixins;
11
+
12
+ .offcanvas {
13
+ --offcanvas-padding-x: 1.4rem;
14
+ --offcanvas-padding-y: 2rem;
15
+
16
+ position: fixed;
17
+ inset: 0;
18
+ z-index: 1045;
19
+ display: block;
20
+ visibility: hidden;
21
+ background-color: var(--overlay-color);
22
+ backdrop-filter: blur(1px);
23
+
24
+ &.show, &.hiding, &.showing {
25
+ visibility: visible;
26
+ }
27
+
28
+ }
29
+
30
+ .offcanvasInner {
31
+ position: fixed;
32
+ top: 0;
33
+ right: 0;
34
+ bottom: 0;
35
+ display: flex;
36
+ flex-direction: column;
37
+ width: 18rem;
38
+ min-width: 280px;
39
+ max-width: 100dvw;
40
+ // height: 100%;
41
+ color: var(--text-color);
42
+ background-color: var(--body-bg-color);
43
+ background-clip: padding-box;
44
+ border-left: var(--text-color);
45
+ outline: 0;
46
+ box-shadow: var(--shadow-3);
47
+ // opacity: 0;
48
+ // transition: transform, opacity .3s ease-in-out;
49
+ transition: transform .3s ease-in-out;
50
+ transform: translateX(100%);
51
+
52
+ .show & {
53
+ box-shadow: -.5rem 0 .5rem var(--text-color);
54
+ // opacity: 1;
55
+ transform: none;
56
+ }
57
+
58
+ .fullscreen & {
59
+ inset: 0;
60
+ width: auto;
61
+ border-left: none;
62
+ }
63
+ .fullscreen.show & {
64
+ box-shadow: none;
65
+ }
66
+
67
+ // @include mediaMixins.media-desktop-up() {}
68
+ @media screen and (min-width: __desktop_breakpoint__) {
69
+ .fullscreen & {
70
+ inset: 1.5rem;
71
+ }
72
+ .fullscreen.show & {
73
+ inset: 1.5rem;
74
+ box-shadow:
75
+ 10px 10px 1rem var(--overlay),
76
+ -10px 10px 1rem var(--overlay),
77
+ 10px -10px 1rem var(--overlay),
78
+ -10px -10px 1rem var(--overlay);
79
+
80
+ }
81
+
82
+ }
83
+
84
+ }
85
+
86
+ .offcanvasHeader {
87
+ display: flex;
88
+ align-items: center;
89
+ justify-content: space-between;
90
+ padding: var(--offcanvas-padding-y) var(--offcanvas-padding-x) calc(var(--offcanvas-padding-y) / 2);
91
+ }
92
+
93
+ .offcanvasClose {
94
+ @include buttonsMixins.reset-button();
95
+ font-size: 2rem;
96
+ color: var(--bz-primary);
97
+ }
98
+
99
+ .offcanvasBody {
100
+ flex-grow: 1;
101
+ padding: 0 var(--offcanvas-padding-x) var(--offcanvas-padding-y);
102
+ overflow-y: auto;
103
+ }
104
+
105
+ @media (prefers-reduced-motion: reduce) {
106
+ .offcanvas {
107
+ transition: none;
108
+ }
109
+ }
@@ -0,0 +1,5 @@
1
+ User-agent: *
2
+ Allow: /
3
+ # Disallow: /
4
+
5
+ Sitemap: https://www.example.com/sitemap.xml
@@ -0,0 +1,115 @@
1
+ import terser from '@rollup/plugin-terser';
2
+ import fs from 'fs';
3
+ import node_resolve from '@rollup/plugin-node-resolve';
4
+ import commonjs from '@rollup/plugin-commonjs';
5
+
6
+ // https://github.com/hyhappy/rollup-plugin-string-html
7
+ // import htmlString from 'rollup-plugin-string-html';
8
+
9
+ // https://github.com/exuanbo/rollup-plugin-minify-html-template-literals
10
+ // https://github.com/asyncLiz/minify-html-literals
11
+ // https://github.com/kangax/html-minifier#options-quick-reference
12
+ // import minifyHTML from 'rollup-plugin-minify-html-template-literals';
13
+
14
+ import p from '../package.json'; // assert { type: 'json' };
15
+
16
+ const terserOptions = {
17
+ compress: {
18
+ passes: 2
19
+ }
20
+ },
21
+ anno = new Date().getFullYear(),
22
+ dirs = [
23
+ {source_dir: './front-end/js', output_dir: './AppBundle/Resources/public/js'}
24
+ ];
25
+
26
+ let config = [];
27
+
28
+ // lettura subdir apps e aggiunta a `dirs`
29
+ fs.readdirSync('./front-end/apps').forEach(item => {
30
+ let stats = fs.statSync(`./front-end/apps/${item}`); // stats.isFile() / stats.isDirectory()
31
+ if(stats.isDirectory()) {
32
+ dirs.push({
33
+ source_dir: `./front-end/apps/${item}`,
34
+ output_dir: `./AppBundle/Resources/public/apps/${item}`
35
+ });
36
+ }
37
+ });
38
+
39
+ dirs.forEach(dir => {
40
+
41
+ fs.readdirSync(dir.source_dir)
42
+ .filter(f => /\.js$/.test(f))
43
+ .filter(f => /^[^_]/.test(f)) // ignore files starting with _
44
+ .forEach(file => {
45
+
46
+ let format = 'iife',
47
+ name = null;
48
+
49
+ if(/(-umd\.js)$/.test(file)) {
50
+ format = 'umd';
51
+ name = file.replace('-umd.js', '').replace(/-/g, '_');
52
+ }
53
+
54
+ config.push(
55
+ {
56
+ // preserveEntrySignatures: false,
57
+ input: `${dir.source_dir}/${file}`,
58
+ plugins: [
59
+ // deve essere il primo
60
+ // minifyHTML({
61
+ // options: {
62
+ // minifyOptions: {
63
+ // html5: true,
64
+ // collapseWhitespace: true,
65
+ // collapseInlineTagWhitespace: true,
66
+ // conservativeCollapse: true,
67
+ // decodeEntities: true
68
+ // },
69
+ // shouldMinify: () => true
70
+ // },
71
+ // }),
72
+ node_resolve(),
73
+ commonjs(),
74
+ terser(terserOptions),
75
+ ],
76
+ output: [{
77
+ file: `${dir.output_dir}/${file.replace('.js', '-min.js')}`,
78
+ format: format,
79
+ sourcemap: true,
80
+ name: name,
81
+ banner: `/*! xxxx v.${p.version} - Massimo Cassandro ${anno} */`,
82
+ // footer: `//! Released on ${new Date().toLocaleString('it-IT', { year: 'numeric', month: 'short', day: '2-digit', hour12: false, hour:'2-digit', minute:'2-digit' })}`
83
+ }]
84
+ }
85
+ );
86
+
87
+ });
88
+ });
89
+
90
+ export default config;
91
+
92
+
93
+ // versione statica
94
+
95
+ // export default [
96
+ // {
97
+ // input: 'input.js',
98
+ // plugins: [
99
+ // node_resolve(),
100
+ // // commonjs(),
101
+ // terser({ compress: { passes: 2 } }),
102
+ // ],
103
+ // output: [
104
+ // {
105
+ // file: 'output.min.js',
106
+ // format: 'iife',
107
+ // sourcemap: true,
108
+
109
+ // banner: `/*! xxxx v.${p.version} - Massimo Cassandro ${anno} */`,
110
+ // // footer: `//! Released on ${new Date().toLocaleString('it-IT', { year: 'numeric', month: 'short', day: '2-digit', hour12: false, hour:'2-digit', minute:'2-digit' })}`
111
+ // }
112
+ // ]
113
+ // },
114
+ // ...
115
+ // ];