@massimo-cassandro/minimo 1.16.1 → 1.17.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 (41) hide show
  1. package/README.md +9 -0
  2. package/design-tokens/_src/components/modal-alert.minimo.tokens.mjs +164 -0
  3. package/design-tokens/_src/components/slide-up-down-toggle.minimo.tokens.mjs +9 -0
  4. package/design-tokens/_src/headings.minimo.tokens.mjs +8 -0
  5. package/design-tokens/_src/typography.minimo.tokens.mjs +1 -1
  6. package/design-tokens/tokens/components/modal-alert.minimo.tokens.jsonc +166 -0
  7. package/design-tokens/tokens/components/slide-up-down-toggle.minimo.tokens.jsonc +14 -0
  8. package/design-tokens/tokens/headings.minimo.tokens.jsonc +8 -0
  9. package/design-tokens/utilities/build-tokens-src/formats/css.mjs +1 -1
  10. package/design-tokens/utilities/build-tokens-src/formats/penpot.mjs +1 -1
  11. package/design-tokens/utilities/check-unresolved-custom-props.mjs +11 -12
  12. package/design-tokens/utilities/tokens-config-sample.mjs +1 -1
  13. package/dev-tools/README.md +1 -1
  14. package/dev-tools/starter-kit/webpack.config.mjs +0 -22
  15. package/package.json +2 -1
  16. package/src/components/modal-alert/modal-alert.js +295 -165
  17. package/src/components/modal-alert/modal-alert.module.css +145 -0
  18. package/src/components/modal-alert/svg/confirm.svg +4 -1
  19. package/src/components/modal-alert/svg/danger.svg +4 -0
  20. package/src/components/modal-alert/svg/error.svg +4 -1
  21. package/src/components/modal-alert/svg/info.svg +4 -1
  22. package/src/components/modal-alert/svg/success.svg +4 -1
  23. package/src/components/modal-alert/svg/warning.svg +4 -1
  24. package/src/components/slide-up-down-toggle/slide-up-down-toggle.module.css +2 -2
  25. package/src/css/dimensions.css +3 -0
  26. package/src/css/margin-padding-bootstrap-media.css +1844 -0
  27. package/src/css/margin-padding-bootstrap.css +464 -0
  28. package/src/css/margin-padding-media.css +1843 -0
  29. package/src/css/margin-padding.css +405 -45
  30. package/src/custom-media.css +12 -0
  31. package/src/custom-properties.css +24 -0
  32. package/src/minimo.css +5 -0
  33. package/src/components/modal-alert/TODO modal-alert-demo/demo.css +0 -63
  34. package/src/components/modal-alert/TODO modal-alert-demo/demo.js +0 -155
  35. package/src/components/modal-alert/TODO.md +0 -3
  36. package/src/components/modal-alert/customization-templates/custom-modal-alert.css +0 -46
  37. package/src/components/modal-alert/customization-templates/custom-modal-alert.js +0 -89
  38. package/src/components/modal-alert/defaults.js +0 -58
  39. package/src/components/modal-alert/marks.js +0 -9
  40. package/src/components/modal-alert/modal-alert.css +0 -159
  41. package/src/components/modal-alert/svg/svg-to-js.mjs +0 -26
package/README.md CHANGED
@@ -20,6 +20,15 @@ For a complete install of all required webpack modules, use the install script a
20
20
  ```bash
21
21
  zsh ./node_modules/@massimo-cassandro/minimo/dev-tools/starter-kit/starter-install.sh
22
22
  ```
23
+
24
+ To bootstrap a project **before** installing the whole package, download only the `starter-kit` folder from the npm tarball and run the script from there:
25
+
26
+ ```bash
27
+ curl -sL "$(npm view @massimo-cassandro/minimo dist.tarball)" | tar xz package/dev-tools/starter-kit
28
+ zsh package/dev-tools/starter-kit/starter-install.sh
29
+ rm -rf package
30
+ ```
31
+
23
32
  ---
24
33
 
25
34
  ## Dev Tools
@@ -0,0 +1,164 @@
1
+ export default {
2
+ 'malert': {
3
+ background: {
4
+ color: {
5
+ $type: 'color',
6
+ $value: '#fff'
7
+ }
8
+ },
9
+ border: {
10
+ radius: {
11
+ $type: 'dimension',
12
+ $value: '{radius.xs}'
13
+ },
14
+ },
15
+ 'box-shadow-color': {
16
+ $type: 'color',
17
+ $value: '#000'
18
+ },
19
+ // https://www.joshwcomeau.com/shadow-palette/
20
+ 'box-shadow': {
21
+ $type: 'shadow',
22
+ $value: [
23
+ {
24
+ offsetX: '0',
25
+ offsetY: '.4px',
26
+ blur: '4px',
27
+ spread: '0',
28
+ color: 'color-mix(in srgb, {malert.box-shadow-color} 15%, transparent)'
29
+ },
30
+ {
31
+ offsetX: '-.3px',
32
+ offsetY: '3px',
33
+ blur: '3.3px',
34
+ spread: '-.5px',
35
+ color: 'color-mix(in srgb, {malert.box-shadow-color} 15%, transparent)'
36
+ },
37
+ {
38
+ offsetX: '-.5px',
39
+ offsetY: '6.1px',
40
+ blur: '6.6px',
41
+ spread: '-.9px',
42
+ color: 'color-mix(in srgb, {malert.box-shadow-color} 14%, transparent)'
43
+ },
44
+ {
45
+ offsetX: '-.9px',
46
+ offsetY: '11.2px',
47
+ blur: '12.1px',
48
+ spread: '-1.4px',
49
+ color: 'color-mix(in srgb, {malert.box-shadow-color} 14%, transparent)'
50
+ },
51
+ {
52
+ offsetX: '-1.6px',
53
+ offsetY: '19.5px',
54
+ blur: '21.1px',
55
+ spread: '-1.9px',
56
+ color: 'color-mix(in srgb, {malert.box-shadow-color} 13%, transparent)'
57
+ },
58
+ {
59
+ offsetX: '-2.7px',
60
+ offsetY: '32.7px',
61
+ blur: '35.4px',
62
+ spread: '-2.3px',
63
+ color: 'color-mix(in srgb, {malert.box-shadow-color} 13%, transparent)'
64
+ },
65
+ {
66
+ offsetX: '-4.3px',
67
+ offsetY: '52px',
68
+ blur: '56.4px',
69
+ spread: '-2.8px',
70
+ color: 'color-mix(in srgb, {malert.box-shadow-color} 12%, transparent)'
71
+ }
72
+ ]
73
+ },
74
+ backdrop: {
75
+ $type: 'color',
76
+ $value: 'rgb(0 0 0 / .7)'
77
+ },
78
+
79
+ success: {
80
+ bg: {
81
+ $type: 'color',
82
+ $value: '{status.success.background.color}'
83
+ },
84
+ fg: {
85
+ $type: 'color',
86
+ $value: '{status.success.fg}'
87
+ }
88
+ },
89
+ info: {
90
+ bg: {
91
+ $type: 'color',
92
+ $value: '{status.info.background.color}'
93
+ },
94
+ fg: {
95
+ $type: 'color',
96
+ $value: '{status.info.fg}'
97
+ }
98
+ },
99
+ warning: {
100
+ bg: {
101
+ $type: 'color',
102
+ $value: '{status.warning.background.color}'
103
+ },
104
+ fg: {
105
+ $type: 'color',
106
+ $value: '{status.warning.fg}'
107
+ }
108
+ },
109
+ error: {
110
+ bg: {
111
+ $type: 'color',
112
+ $value: '{status.danger.background.color}'
113
+ },
114
+ fg: {
115
+ $type: 'color',
116
+ $value: '{status.danger.fg}'
117
+ }
118
+ },
119
+ confirm: {
120
+ bg: {
121
+ $type: 'color',
122
+ $value: 'hsl(277deg 72% 45%)'
123
+ },
124
+ fg: {
125
+ $type: 'color',
126
+ $value: '#fff'
127
+ }
128
+ },
129
+
130
+ heading: {
131
+ font: {
132
+ family: {
133
+ $type: 'fontFamily',
134
+ $value: '{headings.font.family}'
135
+ },
136
+ size: {
137
+ $type: 'dimension',
138
+ $value: '{headings.h2.font.size}'
139
+ },
140
+ weight: {
141
+ $type: 'dimension',
142
+ $value: '{headings.font.weight}'
143
+ },
144
+ },
145
+ 'line-height': {
146
+ $type: 'dimension',
147
+ $value: '{headings.line-height}'
148
+ }
149
+ },
150
+ text: {
151
+ font: {
152
+ family: {
153
+ $type: 'fontFamily',
154
+ $value: '{font.family}'
155
+ },
156
+ size: {
157
+ $type: 'dimension',
158
+ $value: '{font.size.base}'
159
+ },
160
+ }
161
+ }
162
+ }
163
+ };
164
+
@@ -0,0 +1,9 @@
1
+ export default {
2
+ 'slide': {
3
+ 'duration': {
4
+ $type: 'duration',
5
+ $value: '500ms'
6
+ },
7
+ }
8
+ };
9
+
@@ -11,11 +11,19 @@ export default {
11
11
  $value: '{text.color}'
12
12
  },
13
13
  font: {
14
+ family: {
15
+ $type: 'fontFamily',
16
+ $value: '{font.family}'
17
+ },
14
18
  weight: {
15
19
  $type: 'string',
16
20
  $value: '{font.weight.semibold}'
17
21
  }
18
22
  },
23
+ 'line-height': {
24
+ $type: 'dimension',
25
+ $value: '{line-height.xs}'
26
+ },
19
27
  h1: {
20
28
  font: {
21
29
  weight: {
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  font: {
3
3
  family: {
4
+ $type: 'fontFamily',
4
5
  $value: 'sans-serif',
5
- $type: 'fontFamily'
6
6
  },
7
7
  'family-mono': {
8
8
  $value: '\'Monaspace Neon Var\', \'Monaspace Neon\', \'Aptos Mono\', \'Roboto Mono\', \'SFMono-Regular\', \'Menlo\', \'Monaco\', \'Consolas\', \'Liberation Mono\', \'Andale Mono\', \'Courier New\', monospace',
@@ -0,0 +1,166 @@
1
+ // -----------------------------------------------------------------------
2
+ // Generated file — do not edit manually.
3
+ // This file is produced by the design-token build pipeline.
4
+ // Source of truth: the token files in the project source directory.
5
+ // Re-generate with: node build-tokens.mjs --config <path/to/config>
6
+ // -----------------------------------------------------------------------
7
+ {
8
+ "malert": {
9
+ "background": {
10
+ "color": {
11
+ "$type": "color",
12
+ "$value": "#fff"
13
+ }
14
+ },
15
+ "border": {
16
+ "radius": {
17
+ "$type": "dimension",
18
+ "$value": "{radius.xs}"
19
+ }
20
+ },
21
+ "box-shadow-color": {
22
+ "$type": "color",
23
+ "$value": "#000"
24
+ },
25
+ "box-shadow": {
26
+ "$type": "shadow",
27
+ "$value": [
28
+ {
29
+ "offsetX": "0",
30
+ "offsetY": ".4px",
31
+ "blur": "4px",
32
+ "spread": "0",
33
+ "color": "color-mix(in srgb, #000 15%, transparent)"
34
+ },
35
+ {
36
+ "offsetX": "-.3px",
37
+ "offsetY": "3px",
38
+ "blur": "3.3px",
39
+ "spread": "-.5px",
40
+ "color": "color-mix(in srgb, #000 15%, transparent)"
41
+ },
42
+ {
43
+ "offsetX": "-.5px",
44
+ "offsetY": "6.1px",
45
+ "blur": "6.6px",
46
+ "spread": "-.9px",
47
+ "color": "color-mix(in srgb, #000 14%, transparent)"
48
+ },
49
+ {
50
+ "offsetX": "-.9px",
51
+ "offsetY": "11.2px",
52
+ "blur": "12.1px",
53
+ "spread": "-1.4px",
54
+ "color": "color-mix(in srgb, #000 14%, transparent)"
55
+ },
56
+ {
57
+ "offsetX": "-1.6px",
58
+ "offsetY": "19.5px",
59
+ "blur": "21.1px",
60
+ "spread": "-1.9px",
61
+ "color": "color-mix(in srgb, #000 13%, transparent)"
62
+ },
63
+ {
64
+ "offsetX": "-2.7px",
65
+ "offsetY": "32.7px",
66
+ "blur": "35.4px",
67
+ "spread": "-2.3px",
68
+ "color": "color-mix(in srgb, #000 13%, transparent)"
69
+ },
70
+ {
71
+ "offsetX": "-4.3px",
72
+ "offsetY": "52px",
73
+ "blur": "56.4px",
74
+ "spread": "-2.8px",
75
+ "color": "color-mix(in srgb, #000 12%, transparent)"
76
+ }
77
+ ]
78
+ },
79
+ "backdrop": {
80
+ "$type": "color",
81
+ "$value": "rgb(0 0 0 / .7)"
82
+ },
83
+ "success": {
84
+ "bg": {
85
+ "$type": "color",
86
+ "$value": "{status.success.background.color}"
87
+ },
88
+ "fg": {
89
+ "$type": "color",
90
+ "$value": "{status.success.fg}"
91
+ }
92
+ },
93
+ "info": {
94
+ "bg": {
95
+ "$type": "color",
96
+ "$value": "{status.info.background.color}"
97
+ },
98
+ "fg": {
99
+ "$type": "color",
100
+ "$value": "{status.info.fg}"
101
+ }
102
+ },
103
+ "warning": {
104
+ "bg": {
105
+ "$type": "color",
106
+ "$value": "{status.warning.background.color}"
107
+ },
108
+ "fg": {
109
+ "$type": "color",
110
+ "$value": "{status.warning.fg}"
111
+ }
112
+ },
113
+ "error": {
114
+ "bg": {
115
+ "$type": "color",
116
+ "$value": "{status.danger.background.color}"
117
+ },
118
+ "fg": {
119
+ "$type": "color",
120
+ "$value": "{status.danger.fg}"
121
+ }
122
+ },
123
+ "confirm": {
124
+ "bg": {
125
+ "$type": "color",
126
+ "$value": "hsl(277deg 72% 45%)"
127
+ },
128
+ "fg": {
129
+ "$type": "color",
130
+ "$value": "#fff"
131
+ }
132
+ },
133
+ "heading": {
134
+ "font": {
135
+ "family": {
136
+ "$type": "fontFamily",
137
+ "$value": "{headings.font.family}"
138
+ },
139
+ "size": {
140
+ "$type": "dimension",
141
+ "$value": "{headings.h2.font.size}"
142
+ },
143
+ "weight": {
144
+ "$type": "dimension",
145
+ "$value": "{headings.font.weight}"
146
+ }
147
+ },
148
+ "line-height": {
149
+ "$type": "dimension",
150
+ "$value": "{headings.line-height}"
151
+ }
152
+ },
153
+ "text": {
154
+ "font": {
155
+ "family": {
156
+ "$type": "fontFamily",
157
+ "$value": "{font.family}"
158
+ },
159
+ "size": {
160
+ "$type": "dimension",
161
+ "$value": "{font.size.base}"
162
+ }
163
+ }
164
+ }
165
+ }
166
+ }
@@ -0,0 +1,14 @@
1
+ // -----------------------------------------------------------------------
2
+ // Generated file — do not edit manually.
3
+ // This file is produced by the design-token build pipeline.
4
+ // Source of truth: the token files in the project source directory.
5
+ // Re-generate with: node build-tokens.mjs --config <path/to/config>
6
+ // -----------------------------------------------------------------------
7
+ {
8
+ "slide": {
9
+ "duration": {
10
+ "$type": "duration",
11
+ "$value": "500ms"
12
+ }
13
+ }
14
+ }
@@ -17,11 +17,19 @@
17
17
  "$value": "{text.color}"
18
18
  },
19
19
  "font": {
20
+ "family": {
21
+ "$type": "fontFamily",
22
+ "$value": "{font.family}"
23
+ },
20
24
  "weight": {
21
25
  "$type": "string",
22
26
  "$value": "{font.weight.semibold}"
23
27
  }
24
28
  },
29
+ "line-height": {
30
+ "$type": "dimension",
31
+ "$value": "{line-height.xs}"
32
+ },
25
33
  "h1": {
26
34
  "font": {
27
35
  "weight": {
@@ -150,7 +150,7 @@ StyleDictionary.registerFormat({
150
150
  const sequenceList = [
151
151
  'xxs', 'xs', 'sm', 'base', 'md', 'lg', 'xl', 'xxl', 'xxxl', '2xl', '3xl',
152
152
  'xlight', 'light', 'regular', 'medium', 'semibold', 'bold', 'xbold'
153
- ]
153
+ ];
154
154
 
155
155
  const sortFunction = (a, b) => {
156
156
  const idxA = sequenceList.indexOf(a.name);
@@ -110,7 +110,6 @@ const resolveExpression = (orig, tokenMap) => {
110
110
  if (!/^[\d\s+\-*/.()]+$/.test(expr)) return null;
111
111
 
112
112
  try {
113
- // eslint-disable-next-line no-new-func
114
113
  const result = Function(`"use strict"; return (${expr})`)();
115
114
  if (typeof result !== 'number' || !isFinite(result)) return null;
116
115
  // Round to a reasonable precision to avoid floating-point noise
@@ -161,6 +160,7 @@ StyleDictionary.registerFormat({
161
160
  value = resolved;
162
161
  } else {
163
162
  // Resolution failed — keep the original and emit a warning
163
+ // eslint-disable-next-line no-console
164
164
  console.warn(`[build-tokens] penpot: could not resolve expression "${orig}" for token "${token.path.join('.')}". Keeping original.`);
165
165
  value = orig;
166
166
  }
@@ -16,7 +16,7 @@ import * as fs from 'node:fs';
16
16
  import { /* fileURLToPath, */pathToFileURL } from 'url';
17
17
  // import { dirname } from 'path';
18
18
  import { glob } from 'node:fs/promises';
19
- import { styleText, parseArgs } from 'node:util';
19
+ import { styleText } from 'node:util';
20
20
 
21
21
  // const __filename = fileURLToPath(import.meta.url);
22
22
  // const __dirname = dirname(__filename);
@@ -24,22 +24,17 @@ import { styleText, parseArgs } from 'node:util';
24
24
  // ---------------------------------------------------------------------------
25
25
  // 1. Parse flags
26
26
  // ---------------------------------------------------------------------------
27
- const options = {
28
- config: {
29
- type: 'string',
30
- short: 'c',
31
- },
32
- };
27
+ const args = process.argv.slice(2);
28
+ const configFlagIndex = args.findIndex(arg => arg === '--config' || arg === '-c');
29
+ const configArgPath = configFlagIndex !== -1 ? args[configFlagIndex + 1] : undefined;
33
30
 
34
- const { values } = parseArgs({ options });
35
-
36
- if (!values.config) {
31
+ if (!configArgPath) {
37
32
  console.error(styleText(['red'], 'Error: you must provide the config path with --config or -c'));
38
33
  console.log('Example: node check-unresolved-custom-props.mjs --config ./config.mjs');
39
34
  process.exit(1);
40
35
  }
41
36
 
42
- const absoluteConfigPath = path.resolve(process.cwd(), values.config);
37
+ const absoluteConfigPath = path.resolve(process.cwd(), configArgPath);
43
38
  const configDir = path.dirname(absoluteConfigPath);
44
39
 
45
40
  // ---------------------------------------------------------------------------
@@ -60,9 +55,13 @@ async function run() {
60
55
  const exclude = config.exclude_pattern ?? [];
61
56
 
62
57
  // Collect all .css files in the scan directory, excluding the token file itself
58
+ // and any file under a directory whose name starts with "TODO" (work-in-progress folders)
63
59
  const files = [];
64
60
  for await (const entry of glob(path.join(checkdir, '/**/*.css'))) {
65
- if (!entry.endsWith(custom_prop_filename)) {
61
+ const relDirSegments = path.relative(checkdir, path.dirname(entry)).split(path.sep);
62
+ const isInTodoDir = relDirSegments.some(segment => /^todo/i.test(segment));
63
+
64
+ if (!entry.endsWith(custom_prop_filename) && !isInTodoDir) {
66
65
  files.push(entry);
67
66
  }
68
67
  }
@@ -5,7 +5,7 @@
5
5
  // All paths are relative to this config file (not to the CWD).
6
6
 
7
7
  // import { homedir } from 'os';
8
- import path from 'path';
8
+ // import path from 'path';
9
9
 
10
10
  // Path to the design token source files.
11
11
  // You can use an absolute path, a relative path, or build it programmatically.
@@ -26,7 +26,7 @@ Since the installation is fully overwrite-safe, the script can also be **re-run
26
26
 
27
27
  ### Without installing minimo
28
28
 
29
- To bootstrap a project **before** (or without) installing the whole package, download only the `starter-kit` folder from the npm tarball and run the script from there:
29
+ To bootstrap a project **before** installing the whole package, download only the `starter-kit` folder from the npm tarball and run the script from there:
30
30
 
31
31
  ```bash
32
32
  curl -sL "$(npm view @massimo-cassandro/minimo dist.tarball)" | tar xz package/dev-tools/starter-kit
@@ -327,28 +327,6 @@ const config = {
327
327
  name: 'shared',
328
328
  chunks: 'all'
329
329
  }
330
-
331
-
332
- // separazione @massimo-cassandro da node_modules:
333
- // mc: {
334
- // test: /[\\/]node_modules\/@massimo-cassandro[\\/]/,
335
- // name: 'mc',
336
- // chunks: 'all'
337
- // },
338
- // shared: {
339
- // // test: /[\\/]node_modules[\\/]/,
340
- // test(module) {
341
- // // `module.resource` contains the absolute path of the file on disk.
342
- // // Note the usage of `path.sep` instead of / or \, for cross-platform compatibility.
343
- // return (
344
- // module.resource &&
345
- // module.resource.includes(`${path.sep}node_modules${path.sep}`) &&
346
- // !module.resource.includes(`${path.sep}@massimo-cassandro${path.sep}`)
347
- // );
348
- // },
349
- // name: 'shareds',
350
- // chunks: 'all'
351
- // },
352
330
  }
353
331
  },
354
332
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.16.1",
3
+ "version": "1.17.0",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -36,6 +36,7 @@
36
36
  "npm-publish": "npm publish",
37
37
  "upd@m": "npx upd@m",
38
38
  "build-tokens": "node ./design-tokens/utilities/build-tokens.mjs --config ./design-tokens/tokens-config.mjs",
39
+ "build-margin-padding-css": "node ./scripts/build-margin-padding-css.mjs",
39
40
  "check unresolved props": "node ./design-tokens/utilities/check-unresolved-custom-props.mjs --config ./design-tokens/tokens-config.mjs",
40
41
  "test": "node --test \"test/**/*.test.mjs\"",
41
42
  "checkJS": "npx tsc --noEmit -p jsconfig.json",