@massimo-cassandro/minimo 1.33.6 → 1.34.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 (19) hide show
  1. package/design-tokens/README.md +2 -197
  2. package/dev-tools/README.md +1 -0
  3. package/dev-tools/design-tokens-builder/README.md +208 -0
  4. package/dev-tools/design-tokens-builder/build-tokens-src/build-source-modes.mjs +152 -0
  5. package/{design-tokens/utilities → dev-tools/design-tokens-builder}/build-tokens-src/config.mjs +35 -1
  6. package/{design-tokens/utilities → dev-tools/design-tokens-builder}/build-tokens-src/formats/css.mjs +16 -4
  7. package/{design-tokens/utilities → dev-tools/design-tokens-builder}/build-tokens-src/formats/json.mjs +9 -4
  8. package/dev-tools/design-tokens-builder/build-tokens-src/merge-css.mjs +192 -0
  9. package/{design-tokens/utilities → dev-tools/design-tokens-builder}/build-tokens-src/platforms.mjs +3 -1
  10. package/{design-tokens/utilities → dev-tools/design-tokens-builder}/build-tokens.mjs +99 -45
  11. package/{design-tokens/utilities → dev-tools/design-tokens-builder}/check-unresolved-custom-props.mjs +66 -13
  12. package/{design-tokens → dev-tools/design-tokens-builder}/tokens-config-sample.mjs +39 -1
  13. package/dev-tools/starter-kit/source_files/root/package-tpl.json +2 -2
  14. package/dev-tools/starter-kit/starter-install.sh +2 -2
  15. package/package.json +6 -8
  16. package/src/web-components/s-datatable-component/src/parse-cols.js +1 -1
  17. package/design-tokens/utilities/build-tokens-src/merge-css.mjs +0 -60
  18. /package/{design-tokens/utilities → dev-tools/design-tokens-builder}/build-tokens-src/resolve-source-paths.mjs +0 -0
  19. /package/{design-tokens/utilities → dev-tools/design-tokens-builder}/build-tokens-src/transforms.mjs +0 -0
@@ -75,7 +75,7 @@ optionalPackages=(
75
75
  "@svgdotjs/svg.js | | richiesto da charts/"
76
76
  "blurhash | | richiesto da unsplash-page (create-blurhash-canvas)"
77
77
  "simple-datatables | | richiesto da s-datatable-component"
78
- "style-dictionary | dev | richiesto da design-tokens/utilities (build-tokens)"
78
+ "style-dictionary | dev | richiesto da dev-tools/design-tokens-builder (build-tokens)"
79
79
  "@cybozu/eslint-config | dev | utilizzato da eslint per il check dei file css"
80
80
  "postcss-cli postcss-import postcss-nested cssnano | dev | per css email"
81
81
  )
@@ -421,7 +421,7 @@ force_cat "${MINIMO_PKG_DIR}/src/custom-media.css" "${FRONTEND_INSTALL_PATH}/css
421
421
  force_cat "${MINIMO_PKG_DIR}/src/minimo.css" "${FRONTEND_INSTALL_PATH}/css/index.css"
422
422
 
423
423
  # config di build-tokens: collocato accanto al css generato (custom-properties.css).
424
- force_cat "${MINIMO_PKG_DIR}/design-tokens/tokens-config-sample.mjs" "${FRONTEND_INSTALL_PATH}/css/tokens-config.mjs"
424
+ force_cat "${MINIMO_PKG_DIR}/dev-tools/design-tokens-builder/tokens-config-sample.mjs" "${FRONTEND_INSTALL_PATH}/css/tokens-config.mjs"
425
425
 
426
426
 
427
427
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.33.6",
3
+ "version": "1.34.0",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -20,8 +20,8 @@
20
20
  "access": "public"
21
21
  },
22
22
  "bin": {
23
- "buildTokens": "design-tokens/utilities/build-tokens.mjs",
24
- "checkUnresolvedProps": "design-tokens/utilities/check-unresolved-custom-props.mjs",
23
+ "buildTokens": "dev-tools/design-tokens-builder/build-tokens.mjs",
24
+ "checkUnresolvedProps": "dev-tools/design-tokens-builder/check-unresolved-custom-props.mjs",
25
25
  "update-version": "dev-tools/update-version/index.mjs",
26
26
  "upd@m": "dev-tools/upd@m/index.mjs",
27
27
  "svgIconsTools": "dev-tools/svg-icons-tools/index.mjs",
@@ -36,16 +36,16 @@
36
36
  "UPD-version": "npx update-version # --config=./dev-utilities.config.mjs",
37
37
  "npm-publish": "npm publish",
38
38
  "upd@m": "npx upd@m",
39
- "build-tokens": "node ./design-tokens/utilities/build-tokens.mjs --config ./design-tokens/tokens-config.mjs",
39
+ "build-tokens": "node ./dev-tools/design-tokens-builder/build-tokens.mjs --config ./design-tokens/tokens-config.mjs",
40
40
  "build-margin-padding-css": "node ./scripts/build-margin-padding-css.mjs",
41
41
  "generate:types": "node ./scripts/generate-class-types.mjs",
42
42
  "prepublishOnly": "npm run generate:types",
43
- "check unresolved props": "node ./design-tokens/utilities/check-unresolved-custom-props.mjs --config ./design-tokens/tokens-config.mjs",
43
+ "check unresolved props": "node ./dev-tools/design-tokens-builder/check-unresolved-custom-props.mjs --config ./design-tokens/tokens-config.mjs",
44
44
  "test": "node --test \"test/**/*.test.mjs\"",
45
45
  "test sideEffects tree-shaking": "node ./test/sideEffects-tree-shaking/run-test.mjs",
46
46
  "checkJS": "npx tsc --noEmit -p jsconfig.json",
47
47
  "checkJS ./src": "npx tsc --noEmit --allowJs --checkJs --target ES2023 --module ESNext --allowSyntheticDefaultImports --moduleResolution bundler declarations.d.ts types/global.d.ts src/**/*.js",
48
- "check outdated": "echo '*** ROOT ***' && npm outdated --omit=peer && echo '*** DEMO ***' && npm --prefix ./demo outdated && echo '*** END ***'",
48
+ "npm outdated": "echo '*** ROOT ***' && npm outdated --omit=peer && echo '*** DEMO ***' && npm --prefix ./demo outdated && echo '*** END ***'",
49
49
  "npm upd": "echo '*** ROOT ***' && npm update && echo '*** DEMO ***' && npm --prefix ./demo update && echo '*** END ***'"
50
50
  },
51
51
  "license": "MIT",
@@ -63,10 +63,8 @@
63
63
  "src/**/*.{js,mjs,css,svg,md}",
64
64
  "types/**/*.d.ts",
65
65
  "design-tokens/README.md",
66
- "design-tokens/tokens-config-sample.mjs",
67
66
  "design-tokens/tokens/**/*.{tokens.json,tokens.jsonc}",
68
67
  "design-tokens/_src/**/*.{tokens.json,tokens.jsonc,mjs,js,md}",
69
- "design-tokens/utilities/**/*.{mjs,md}",
70
68
  "charts/**/*.{js,mjs,md}",
71
69
  "dev-tools/**/*",
72
70
  "snippets/**/*",
@@ -157,7 +157,7 @@ export function parseCols(col_obj){
157
157
  style: col_obj._renderMode === 'euro_currency'
158
158
  ? 'currency'
159
159
  : (col_obj._renderMode === 'perc_decimal' || col_obj._renderMode === 'perc')
160
- ? 'perc'
160
+ ? 'percent'
161
161
  : 'decimal',
162
162
  currency: col_obj._renderMode === 'euro_currency' ? 'EUR' : undefined
163
163
  });
@@ -1,60 +0,0 @@
1
- // build-tokens-src/merge-css.mjs
2
- // Supports the `mergeCustomProps` config option: pre-existing custom
3
- // properties in the CSS destination file take priority over the ones
4
- // generated by the current build (manual overrides/additions survive rebuilds).
5
- //
6
- // Usage:
7
- // 1. Call loadExistingCustomProps(absDestPath) BEFORE Style Dictionary runs,
8
- // since it reads the file that is about to be overwritten.
9
- // 2. The css/variables-sorted format (see formats/css.mjs) calls
10
- // mergeCustomProps(generatedMap) while building the output, right before
11
- // serialising the final CSS text.
12
-
13
- import { existsSync, readFileSync } from 'node:fs';
14
-
15
- const CUSTOM_PROP_RE = /^\s*--([\w-]+):\s*(.+)$/gm;
16
-
17
- /**
18
- * Parses `--name: <tail>` declarations out of a CSS text block. <tail> is
19
- * captured verbatim (value, terminating `;`, and anything else on the same
20
- * line, e.g. a trailing comment) so it round-trips unchanged through a merge.
21
- * Only single-line declarations are supported.
22
- * @param {string} cssText
23
- * @returns {Record<string,string>} name → declaration-tail map, in first-seen order
24
- */
25
- export const parseCustomProps = (cssText) => {
26
- /** @type {Record<string,string>} */
27
- const map = {};
28
- for (const match of cssText.matchAll(CUSTOM_PROP_RE)) {
29
- map[match[1]] = match[2].trim();
30
- }
31
- return map;
32
- };
33
-
34
- // null = merge disabled, or destination file not found yet (first build)
35
- /** @type {Record<string,string>|null} */
36
- let existingCustomProps = null;
37
-
38
- /**
39
- * Reads the CSS destination file (if it exists) and stores a name → value
40
- * map of its current custom properties for later merging.
41
- * @param {string} absDestPath absolute path of the CSS file to read
42
- * @returns {Record<string,string>|null}
43
- */
44
- export const loadExistingCustomProps = (absDestPath) => {
45
- existingCustomProps = existsSync(absDestPath)
46
- ? parseCustomProps(readFileSync(absDestPath, 'utf8'))
47
- : null;
48
- return existingCustomProps;
49
- };
50
-
51
- /**
52
- * Merges freshly generated custom properties with the ones previously loaded
53
- * via loadExistingCustomProps(). Pre-existing values take priority; custom
54
- * properties found only in the pre-existing file (no longer generated) are
55
- * kept as well.
56
- * @param {Record<string,string>} generated name → value map produced by this build
57
- * @returns {Record<string,string>}
58
- */
59
- export const mergeCustomProps = (generated) =>
60
- existingCustomProps ? { ...generated, ...existingCustomProps } : generated;