@massimo-cassandro/minimo 1.12.0 → 1.12.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/charts/src/node-helpers/create-svg-canvas-node.mjs +37 -0
- package/dev-tools/create-favicons/src/init-start-text.txt +20 -0
- package/dev-tools/webpack-setup/webpack-modules/mini-svg-data-uri-loader.cjs +25 -0
- package/package.json +5 -7
- package/snippets/build-chrome-custom-device-list.mjs +101 -0
- package/snippets/config-templates/_env.local +13 -0
- package/snippets/config-templates/_github/dependabot.yml +10 -0
- package/snippets/config-templates/_hintrc.cjs +35 -0
- package/snippets/config-templates/_htaccess +69 -0
- package/snippets/config-templates/_npmignore +8 -0
- package/snippets/config-templates/_npmrc +1 -0
- package/snippets/config-templates/_stylelintignore +5 -0
- package/snippets/config-templates/babel.config--react.json +20 -0
- package/snippets/config-templates/babel.config--solidJS.json +8 -0
- package/snippets/config-templates/react/offcanvas/offcanvas.jsx +89 -0
- package/snippets/config-templates/react/offcanvas/offcanvas.module.scss +109 -0
- package/snippets/config-templates/robots.txt +5 -0
- 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
|
+
}
|
|
@@ -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
|
+
*/
|
|
@@ -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.
|
|
3
|
+
"version": "1.12.1",
|
|
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
|
|
60
|
-
"
|
|
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": {
|
|
@@ -82,4 +80,4 @@
|
|
|
82
80
|
"sharp": "^0.35.3",
|
|
83
81
|
"sharp-ico": "^0.1.5"
|
|
84
82
|
}
|
|
85
|
-
}
|
|
83
|
+
}
|
|
@@ -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 @@
|
|
|
1
|
+
package-lock=false
|
|
@@ -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,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
|
+
// ];
|