@massimo-cassandro/minimo 0.3.5 → 0.4.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 (105) hide show
  1. package/README.md +1 -1
  2. package/design-tokens/alerts.minimo.tokens.jsonc +28 -0
  3. package/design-tokens/badge.minimo.tokens.jsonc +42 -0
  4. package/design-tokens/basic.minimo.tokens.jsonc +58 -0
  5. package/design-tokens/btn-close.minimo.tokens.jsonc +96 -0
  6. package/design-tokens/btn-primary.minimo.tokens.jsonc +96 -0
  7. package/design-tokens/btn.minimo.tokens.jsonc +196 -0
  8. package/design-tokens/color-accent.minimo.tokens.jsonc +18 -0
  9. package/design-tokens/color-neutral.minimo.tokens.jsonc +18 -0
  10. package/design-tokens/color-primary.minimo.tokens.jsonc +18 -0
  11. package/design-tokens/color-secondary.minimo.tokens.jsonc +18 -0
  12. package/design-tokens/components/recaptcha.minimo.tokens.jsonc +28 -0
  13. package/design-tokens/components/sf-macro.minimo.tokens.jsonc +66 -0
  14. package/design-tokens/components/spinner.minimo.tokens.jsonc +24 -0
  15. package/design-tokens/components/toast.minimo.tokens.jsonc +32 -0
  16. package/design-tokens/flex-grid.minimo.tokens.jsonc +24 -0
  17. package/design-tokens/form.minimo.tokens.jsonc +304 -0
  18. package/design-tokens/headings.minimo.tokens.jsonc +62 -0
  19. package/design-tokens/link.minimo.tokens.jsonc +44 -0
  20. package/design-tokens/radius.minimo.tokens.jsonc +42 -0
  21. package/design-tokens/recaptcha.minimo.tokens.jsonc +28 -0
  22. package/design-tokens/sf-macro.minimo.tokens.jsonc +66 -0
  23. package/design-tokens/simple-datatable.minimo.tokens.jsonc +51 -0
  24. package/design-tokens/size.minimo.tokens.jsonc +46 -0
  25. package/design-tokens/spinner.minimo.tokens.jsonc +24 -0
  26. package/design-tokens/status.minimo.tokens.jsonc +98 -0
  27. package/design-tokens/table.minimo.tokens.jsonc +64 -0
  28. package/design-tokens/toast.minimo.tokens.jsonc +32 -0
  29. package/design-tokens/typography.minimo.tokens.jsonc +102 -0
  30. package/design-tokens/utility.minimo.tokens.jsonc +14 -0
  31. package/design-tokens/web-components/simple-datatable.minimo.tokens.jsonc +51 -0
  32. package/design-tokens/z-index.minimo.tokens.jsonc +14 -0
  33. package/design-tokens-src/_readme.md +27 -0
  34. package/design-tokens-src/alerts.minimo.tokens.mjs +25 -0
  35. package/design-tokens-src/components/sf-macro.minimo.tokens.jsonc +66 -0
  36. package/{src/design-tokens → design-tokens-src}/form.minimo.tokens.jsonc +9 -8
  37. package/design-tokens-src/size.minimo.tokens.jsonc +105 -0
  38. package/design-tokens-utilities/build-tokens-src/config.mjs +108 -0
  39. package/design-tokens-utilities/build-tokens-src/formats/css.mjs +201 -0
  40. package/design-tokens-utilities/build-tokens-src/formats/penpot.mjs +262 -0
  41. package/design-tokens-utilities/build-tokens-src/platforms.mjs +80 -0
  42. package/design-tokens-utilities/build-tokens-src/transforms.mjs +200 -0
  43. package/design-tokens-utilities/build-tokens.mjs +114 -0
  44. package/design-tokens-utilities/check-unresolved-custom-props.mjs +137 -0
  45. package/design-tokens-utilities/readme.md +185 -0
  46. package/design-tokens-utilities/tokens-config-sample.mjs +98 -0
  47. package/package.json +10 -6
  48. package/src/components/auto-datatable/auto-datatable.css +4 -4
  49. package/src/components/modal-alert/modal-alert.css +5 -5
  50. package/src/components/{overlay.js → overlay/overlay.js} +1 -1
  51. package/src/{css/dialog-content.css → components/popup-page/popup-page.css} +1 -1
  52. package/src/components/{dialog-content.js → popup-page/popup-page.js} +6 -4
  53. package/src/components/sf-macro/sf-macro.css +7 -14
  54. package/src/css/alerts.css +3 -3
  55. package/src/css/buttons/status-buttons.css +4 -4
  56. package/src/css/forms/fieldset.css +2 -2
  57. package/src/custom-properties-default.css +24 -12
  58. package/src/icons/x.svg +1 -0
  59. package/src/web-components/simple-datatable/simple-datatable.js +2 -2
  60. package/src/web-components/simple-datatable/simple-datatable.module.css +3 -3
  61. package/src/web-components/simple-datatable/src/parse-cols.js +2 -2
  62. package/src/design-tokens/TODO.md +0 -2
  63. package/src/design-tokens/alerts.minimo.tokens.jsonc +0 -25
  64. package/src/design-tokens/size.minimo.tokens.jsonc +0 -101
  65. package/src/design-tokens-utilities/build-tokens.mjs +0 -503
  66. package/src/design-tokens-utilities/check-unresolved-custom-props.mjs +0 -131
  67. package/src/design-tokens-utilities/config-templates/tokens-config.mjs +0 -34
  68. package/src/design-tokens-utilities/readme.md +0 -12
  69. /package/{src/design-tokens → design-tokens-src}/badge.minimo.tokens.jsonc +0 -0
  70. /package/{src/design-tokens → design-tokens-src}/basic.minimo.tokens.jsonc +0 -0
  71. /package/{src/design-tokens → design-tokens-src}/btn-close.minimo.tokens.jsonc +0 -0
  72. /package/{src/design-tokens → design-tokens-src}/btn-primary.minimo.tokens.jsonc +0 -0
  73. /package/{src/design-tokens → design-tokens-src}/btn-secondary.minimo.tokens.jsonc +0 -0
  74. /package/{src/design-tokens → design-tokens-src}/btn.minimo.tokens.jsonc +0 -0
  75. /package/{src/design-tokens → design-tokens-src}/color-accent.minimo.tokens.jsonc +0 -0
  76. /package/{src/design-tokens → design-tokens-src}/color-neutral.minimo.tokens.jsonc +0 -0
  77. /package/{src/design-tokens → design-tokens-src}/color-primary.minimo.tokens.jsonc +0 -0
  78. /package/{src/design-tokens → design-tokens-src}/color-secondary.minimo.tokens.jsonc +0 -0
  79. /package/{src/components/recaptcha → design-tokens-src/components}/recaptcha.minimo.tokens.jsonc +0 -0
  80. /package/{src/components/spinner → design-tokens-src/components}/spinner.minimo.tokens.jsonc +0 -0
  81. /package/{src/components/toast → design-tokens-src/components}/toast.minimo.tokens.jsonc +0 -0
  82. /package/{src/design-tokens → design-tokens-src}/flex-grid.minimo.tokens.jsonc +0 -0
  83. /package/{src/design-tokens → design-tokens-src}/gradients-shadowes.minimo.tokens.jsonc +0 -0
  84. /package/{src/design-tokens → design-tokens-src}/headings.minimo.tokens.jsonc +0 -0
  85. /package/{src/design-tokens → design-tokens-src}/link.minimo.tokens.jsonc +0 -0
  86. /package/{src/design-tokens → design-tokens-src}/radius.minimo.tokens.jsonc +0 -0
  87. /package/{src/design-tokens → design-tokens-src}/status.minimo.tokens.jsonc +0 -0
  88. /package/{src/design-tokens → design-tokens-src}/table.minimo.tokens.jsonc +0 -0
  89. /package/{src/design-tokens → design-tokens-src}/typography.minimo.tokens.jsonc +0 -0
  90. /package/{src/design-tokens → design-tokens-src}/utility.minimo.tokens.jsonc +0 -0
  91. /package/{src/web-components/simple-datatable → design-tokens-src/web-components}/simple-datatable.minimo.tokens.jsonc +0 -0
  92. /package/{src/design-tokens → design-tokens-src}/z-index.minimo.tokens.jsonc +0 -0
  93. /package/src/{css → components/overlay}/overlay.css +0 -0
  94. /package/src/{web-components/simple-datatable/icons → icons}/arrow-down.svg +0 -0
  95. /package/src/{web-components/simple-datatable/icons → icons}/arrow-up.svg +0 -0
  96. /package/src/{web-components/simple-datatable/icons → icons}/arrows-down-up.svg +0 -0
  97. /package/src/{web-components/simple-datatable/icons → icons}/caret-left.svg +0 -0
  98. /package/src/{web-components/simple-datatable/icons → icons}/caret-right.svg +0 -0
  99. /package/src/{web-components/simple-datatable/icons → icons}/check-bold.svg +0 -0
  100. /package/src/{components/modal-alert/svg → icons}/check-circle-duotone.svg +0 -0
  101. /package/src/{components/modal-alert/svg → icons}/info-duotone.svg +0 -0
  102. /package/src/{components/modal-alert/svg → icons}/question-duotone.svg +0 -0
  103. /package/src/{components/modal-alert/svg → icons}/warning-duotone.svg +0 -0
  104. /package/src/{web-components/simple-datatable/icons → icons}/x-bold.svg +0 -0
  105. /package/src/{components/modal-alert/svg → icons}/x-circle-duotone.svg +0 -0
@@ -1,131 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /* eslint-disable no-console */
4
-
5
- // rivela eventuale custom props css nei file della dir data non presenti nel file css di definizione
6
- // uso: node check-unresolved-custom-props.mjs --config ./path/to-config.mjs
7
-
8
- import path from 'path';
9
- import fs from 'node:fs';
10
- import { fileURLToPath, pathToFileURL } from 'url';
11
- import { dirname } from 'path';
12
- import { glob } from 'node:fs/promises';
13
- import { styleText, parseArgs } from 'node:util';
14
-
15
- const __filename = fileURLToPath(import.meta.url);
16
- const __dirname = dirname(__filename);
17
-
18
- // 1. Configurazione e parsing dei flag
19
- const options = {
20
- config: {
21
- type: 'string',
22
- short: 'c',
23
- },
24
- // Qui in futuro potrai aggiungere altri flag, es:
25
- // verbose: { type: 'boolean', short: 'v' }
26
- };
27
-
28
- const { values } = parseArgs({ options });
29
-
30
- if (!values.config) {
31
- console.error(styleText(['red'], 'Errore: Devi fornire il percorso del config con il flag --config o -c'));
32
- console.log('Esempio: node check-unresolved-custom-props.mjs --config ./config.mjs');
33
- process.exit(1);
34
- }
35
-
36
- const absoluteConfigPath = path.resolve(process.cwd(), values.config);
37
- const configDir = path.dirname(absoluteConfigPath);
38
-
39
- async function run() {
40
- try {
41
-
42
- const { default: config } = await import(pathToFileURL(absoluteConfigPath).href);
43
- console.log(config);
44
- const custom_prop_file_path = path.resolve(configDir, path.join(config.buildPath, config.destFile));
45
- const custom_prop_filename = path.basename(custom_prop_file_path);
46
- const checkdir = path.resolve(configDir, config.dir_to_check);
47
- const exclude = config.exclude_pattern;
48
-
49
- const files = [];
50
- for await (const entry of glob(path.join(checkdir, '/**/*.css'))) {
51
- if (!entry.endsWith(custom_prop_filename)) {
52
- files.push(entry);
53
- }
54
- }
55
-
56
- if (!fs.existsSync(custom_prop_file_path)) {
57
- throw new Error(`File delle proprietà non trovato: ${custom_prop_file_path}`);
58
- }
59
-
60
- // lista custom props definiti
61
- const cssContent = fs.readFileSync(custom_prop_file_path, 'utf-8');
62
- const regex = /--([a-z0-9-]+)(?=\s*:)/g;
63
- const propertyNamesList = [...cssContent.matchAll(regex)].map(match => `--${match[1]}`);
64
- // extra_custom_props_files
65
-
66
- (config.extra_custom_props_files??[]).forEach(extraCustomePropsFile => {
67
-
68
- const extraCustomPropsContent = fs.readFileSync(
69
- path.resolve(configDir, extraCustomePropsFile),
70
- 'utf-8');
71
-
72
- const extraMatches = [...extraCustomPropsContent.matchAll(regex)].map(match => `--${match[1]}`);
73
- propertyNamesList.push(...extraMatches);
74
- });
75
-
76
-
77
-
78
- // rilevamento custom props nei vari file css
79
- const regex2 = /var\(\s*(--[a-z0-9-]+)\s*(,.*?)?\)/g;
80
- const unresolved_props = [];
81
- const check = []; // per controllo aggiuntivo esecuzione
82
-
83
- files.forEach(file => {
84
- const fileContent = fs.readFileSync(file, 'utf-8');
85
- // const filename = path.relative(checkdir, file);
86
- const filename = path.relative(configDir, file);
87
- const matches = [...fileContent.matchAll(regex2)];
88
-
89
- matches.forEach(match => {
90
- const cprop = match[1];
91
- const isExcluded = exclude.some(exRegex => exRegex.test(cprop));
92
- const isDefined = propertyNamesList.includes(cprop);
93
-
94
- const lineNumber = fileContent.substring(0, match.index).split('\n').length;
95
- if (!isExcluded && !isDefined) {
96
- // unresolved_props.push(`${filename}:${lineNumber} -> var(${cprop})`);
97
- unresolved_props.push({file: filename, line: lineNumber, prop: cprop});
98
- }
99
-
100
- check.push(`${filename}:${lineNumber} - ${cprop} - unresolved: ${(!isExcluded && !isDefined) ? 'Y' : 'N'}`);
101
- });
102
- });
103
-
104
- unresolved_props.sort((a,b) => a.file.localeCompare(b.file));
105
-
106
-
107
- const result_file = path.resolve(configDir, 'unresolved-props.md');
108
-
109
- console.log(styleText(['green'],
110
- `${unresolved_props.length} custom properties non impostate ` +
111
- `-> ${path.relative(process.cwd(), result_file)}`)
112
- );
113
-
114
- // Output
115
- fs.writeFileSync(result_file, unresolved_props
116
- .map(item => `* [${path.basename(item.file)} :: ${item.line}](${item.file}#L${item.line}) -> var(${item.prop})`)
117
- .join('\n'), 'utf-8');
118
-
119
- // fs.writeFileSync(path.resolve(configDir, 'full-result.txt'), check.join('\n'), 'utf-8');
120
-
121
-
122
- console.log(styleText(['green'], '**** FINE ****'));
123
-
124
- } catch (err) {
125
- console.log(styleText(['redBright'], err.stack));
126
- // console.error(styleText(['red'], `Errore: ${err.message}`));
127
- process.exit(1);
128
- }
129
- }
130
-
131
- run();
@@ -1,34 +0,0 @@
1
-
2
- import { homedir } from 'os';
3
- import path from 'path';
4
-
5
- // TODO spostare percorsi minimo su node modules
6
- const minimo_path = path.resolve(homedir(), 'Sites/minimo/src');
7
-
8
- // path relativi a questo file
9
-
10
- const config = {
11
- // build tokens
12
- stylelintConfigPath: '../../stylelint.config.mjs',
13
- buildPath: '../src/css', // dir in cui salvare il file generato da style dictionary
14
- destFile: 'custom-properties.css', // nome del file generato da style dictionary
15
- // tokens files
16
- source: [
17
- // '../../node_modules/open-props/open-props.style-dictionary-tokens.json',
18
- path.join(minimo_path, 'design-tokens/*.jsonc'),
19
- path.join(minimo_path, 'components/**/*.tokens.jsonc'),
20
- path.join(minimo_path, 'web-components/**/*.tokens.jsonc'),
21
- './figma-tokens-OK/*.jsonc',
22
- ],
23
-
24
- // eventuali file aggiuntivi con custim props utilizzate nel progetto
25
- extra_custom_props_files: [
26
- // '../../node_modules/open-props/open-props.min.css'
27
- ],
28
- dir_to_check: '../../src', // percorso della dir che include i css da analizzare
29
- exclude_pattern: [ // patterns per l'esclusione dal controllo di alcune custom props
30
- /^--_/,
31
- ]
32
- };
33
-
34
- export default config;
@@ -1,12 +0,0 @@
1
- ```json
2
- {
3
- "build tokens": "npx buildTokens --config ./path/to/tokens-config.mjs",
4
- "check unresolved props": "npx checkUnresolvedProps --config ./path/to/tokens-config.mjs"
5
- }
6
- ```
7
-
8
- ## TODO
9
-
10
- * <https://github.com/georgeadamson/postcss-merge-selectors>
11
- * <https://medium.com/@ashusingh584/chokidar-11290855e2cb>
12
- * <https://github.com/xtivia/style-dictionary-watcher>
File without changes