@massimo-cassandro/minimo 1.3.1 → 1.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.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # minimo
1
+ # Minimo
2
2
 
3
3
  My light framework + utilities
4
4
 
@@ -10,21 +10,6 @@ npm i @massimo-cassandro/minimo
10
10
 
11
11
  > Note: **minimo** is designed to be used with WebPack using the configuration you can find in the [webpack-setup folder](./webpack-setup/) of this repository. If changes are made (for example, to how SVG files are imported), things may not work as expected
12
12
 
13
+ ---
13
14
 
14
- ## Utilities
15
-
16
- ### Dom builder
17
-
18
- Builds dom elements from array of objects.
19
-
20
- Only available as module script.
21
-
22
- ```
23
- import { domBuilder } from '@massimo.cassandro/dom-builder';
24
-
25
- domBuilder({ /* options */}); // see source code for details
26
- ```
27
-
28
- ### Classnames
29
-
30
- TODO
15
+ [Docs](docs) | [Demo](demo-build)
package/charts/README.md CHANGED
@@ -26,7 +26,7 @@ Test ed esempi nella directory `test`.
26
26
  ## Uso (JS)
27
27
 
28
28
  ```javascript
29
- import { MinimoCharts, barsChart } from '@MinimoCharts/index.js';
29
+ import { MinimoCharts, barsChart } from '@minimoCharts/index.js';
30
30
 
31
31
  const chartInstance = new MinimoCharts();
32
32
 
package/charts/index.js CHANGED
@@ -3,19 +3,20 @@ import { MinimoCharts } from './src/helpers/core.js';
3
3
 
4
4
  import { bars } from './src/bars.js';
5
5
  import { goal } from './src/goal.js';
6
- import { ratingDisplay } from './src/rating-display/index.js';
6
+ import { lines } from './src/lines.js';
7
+ // import { ratingDisplay } from './src/rating-display/index.js';
7
8
  // import { pie } from './src/charts/pie.js';
8
9
  // import { hbars } from './src/charts/hbars.js';
9
10
  // import { signalBars } from './src/charts/signal-bars.js';
10
11
  // import { radialBars } from './src/charts/radial-bars.js';
11
12
  // import { settimanaleMensile } from './src/charts/settimanale-mensile.js';
12
13
  // import { mcn } from './src/charts/mcn.js';
13
- // import { lines } from './src/charts/lines.js';
14
14
 
15
15
 
16
16
  // wrapper
17
17
  export const barsChart = (chartInstance, params) => bars.call(chartInstance, params);
18
18
  export const goalChart = (chartInstance, params) => goal.call(chartInstance, params);
19
- export const ratingDisplayChart = (chartInstance, params) => ratingDisplay.call(chartInstance, params);
19
+ export const linesChart = (chartInstance, params) => lines.call(chartInstance, params);
20
+ // export const ratingDisplayChart = (chartInstance, params) => ratingDisplay.call(chartInstance, params);
20
21
 
21
22
  export { MinimoCharts };
@@ -1,4 +1,3 @@
1
- import { textToSvgPath } from './svg-text-to-path.js';
2
1
  import { SVG, Text } from '@svgdotjs/svg.js';
3
2
 
4
3
  export async function createTextEl (chartInstance, {
@@ -6,41 +5,36 @@ export async function createTextEl (chartInstance, {
6
5
  textFill = '#000',
7
6
  fontAttr = {},
8
7
  fontFilePath = null,
9
- parentElement = null, // se null viene restituito l'elemento generato (text o path)
10
- textToPath = false, // bypassa l'impostazione globale, per usi particolari
8
+ parentElement = null,
11
9
  }) {
12
10
 
13
11
  let textEl;
14
12
 
15
-
16
13
  if(text == null) {
17
14
  throw '`createTextEl`: missing `text`';
18
15
  }
19
16
 
20
- // Utilizza i defaults dell'istanza (grazie al bind nel costruttore)
21
- // Se fontAttr è nullo, usa un oggetto vuoto per evitare errori di spread
22
17
  fontAttr = { ...chartInstance.defaults.font, ...(fontAttr ?? {}), fill: textFill };
23
18
 
24
- if(chartInstance.textToPath || textToPath) {
19
+ if(chartInstance.textToPath) {
25
20
 
26
21
  if(!fontFilePath) {
27
- throw `‘createTextEl’: missing ‘fontFilePath’ for text ‘${text}’`;
22
+ throw `'createTextEl': missing 'fontFilePath' for text '${text}'`;
28
23
  }
29
24
 
30
- // Qui recuperiamo sia il tracciato che la stringa SVG (come nel tuo originale)
25
+ const { textToSvgPath } = await import('../node-helpers/svg-text-to-path.js');
26
+
31
27
  const { pathData, pathElementString } = await textToSvgPath(fontFilePath, text, fontAttr.size ?? 16);
32
28
 
33
29
  if(parentElement) {
34
30
  textEl = parentElement.path(pathData);
35
31
  } else {
36
- // Nota: utilizzando path con pathData direttamente su SVG() a volte dà errore in svg.js 3.x
37
32
  textEl = SVG(pathElementString);
38
33
  }
39
34
 
40
35
  textEl.attr({ fill: textFill });
41
36
 
42
37
  } else {
43
- // Modalità testo standard (non tracciato)
44
38
  if(parentElement) {
45
39
  textEl = parentElement.plain(text);
46
40
  } else {
@@ -0,0 +1,2 @@
1
+ documentare modalità d'uso
2
+ richide l'instalalzione di opentype
@@ -1,7 +1,5 @@
1
1
  // https://stackblitz.com/edit/vitejs-vite-acphht?file=main.js
2
2
 
3
- import opentype from 'opentype.js';
4
-
5
3
  /*
6
4
  // Example usage:
7
5
  const fontUrl = './Rubik Moonrocks.ttf';
@@ -20,6 +18,7 @@ textToSvgPath(fontUrl, text, fontSize)
20
18
 
21
19
  export async function textToSvgPath(fontUrl, text, fontSize) {
22
20
  try {
21
+ const opentype = (await import(/* webpackIgnore: true */ 'opentype.js')).default;
23
22
  const font = await opentype.load(fontUrl);
24
23
 
25
24
  // Define the x and y coordinates where the text should start
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/massimo-cassandro/minimo#readme",
@@ -19,8 +19,6 @@
19
19
  "UPD-version": "npx update-version # --config=./dev-utilities.config.mjs",
20
20
  "upd@m": "npx upd@m",
21
21
  "npm-publish": "npm publish",
22
- "webpack DEMO dev": "NODE_ENV=development webpack serve --config ./demo-src/webpack.config.mjs",
23
- "webpack DEMO prod": "NODE_ENV=production webpack --config ./demo-src/webpack.config.mjs",
24
22
  "build-tokens": "node ./design-tokens-utilities/build-tokens.mjs --config ./tokens-config.mjs",
25
23
  "check unresolved props": "node ./design-tokens-utilities/check-unresolved-custom-props.mjs --config ./tokens-config.mjs"
26
24
  },
@@ -41,40 +39,17 @@
41
39
  "design-tokens-utilities/**/*.{mjs,md}",
42
40
  "charts/**/*.{js,md}"
43
41
  ],
42
+ "peerDependencies": {
43
+ "@svgdotjs/svg.js": "^3.2.5"
44
+ },
45
+ "peerDependenciesMeta": {
46
+ "@svgdotjs/svg.js": {
47
+ "optional": true
48
+ }
49
+ },
44
50
  "devDependencies": {
45
- "@babel/core": "^7.29.0",
46
- "@babel/preset-env": "^7.29.5",
47
- "@csstools/postcss-global-data": "^4.0.0",
48
51
  "@massimo-cassandro/dev-updater": "^3.0.4",
49
52
  "@massimo-cassandro/eslint-config": "^3.0.7",
50
- "@massimo-cassandro/stylelint-config": "^2.3.7",
51
- "autoprefixer": "^10.5.0",
52
- "babel-loader": "^10.1.1",
53
- "css-loader": "^7.1.4",
54
- "css-minimizer-webpack-plugin": "^8.0.0",
55
- "cssnano": "^8.0.1",
56
- "ejs-loader": "^0.5.0",
57
- "html-loader": "^5.1.0",
58
- "html-webpack-plugin": "^5.6.7",
59
- "mini-css-extract-plugin": "^2.10.2",
60
- "mini-svg-data-uri": "^1.4.4",
61
- "postcss": "^8.5.15",
62
- "postcss-custom-media": "^12.0.1",
63
- "postcss-loader": "^8.2.1",
64
- "postcss-preset-env": "^11.3.0",
65
- "process": "^0.11.10",
66
- "style-dictionary": "^5.4.1",
67
- "style-loader": "^4.0.0",
68
- "svg-url-loader": "^8.0.0",
69
- "svgo": "^4.0.1",
70
- "svgo-add-viewbox": "^3.1.0",
71
- "svgo-loader": "^5.0.0",
72
- "terser-webpack-plugin": "^5.6.0",
73
- "webpack": "^5.107.1",
74
- "webpack-cli": "^7.0.2",
75
- "webpack-dev-server": "^5.2.4"
76
- },
77
- "dependencies": {
78
- "@svgdotjs/svg.js": "^3.2.5"
53
+ "@massimo-cassandro/stylelint-config": "^2.3.7"
79
54
  }
80
55
  }