@massimo-cassandro/minimo 1.18.1 → 1.18.3

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 (63) hide show
  1. package/README.md +2 -1
  2. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/index.js +92 -0
  3. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/hbars.js +356 -0
  4. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/pie.js +245 -0
  5. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/radial-bars.js +177 -0
  6. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/rating-display.js +835 -0
  7. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/costruzione-assi.js +212 -0
  8. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/costruzione-linee.js +101 -0
  9. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/defaults.js +185 -0
  10. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/display-current.js +27 -0
  11. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/grid-areas.js +129 -0
  12. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/parse-opts.js +64 -0
  13. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/paths-setup.js +73 -0
  14. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile.js +126 -0
  15. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/signal-bars.js +290 -0
  16. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/week-utils.js +122 -0
  17. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/hbars-test.js +52 -0
  18. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/mcn-test.js +74 -0
  19. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/pie-test.js +16 -0
  20. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/radial-bars-test.js +48 -0
  21. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/settimanale-mensile-dati-settimanale.js +426 -0
  22. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/settimanale-mensile-test.js +260 -0
  23. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/signal-bars-test.js +64 -0
  24. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/node-test.mjs +86 -0
  25. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/hBars-node-test.mjs +40 -0
  26. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/lines-node-test.mjs +73 -0
  27. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/mcn-node-test.mjs +64 -0
  28. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/pie-node-test.mjs +12 -0
  29. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/radialsBar-node-test.mjs +44 -0
  30. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/settimanale-mensile-node-test.mjs +258 -0
  31. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/signalBars-node-test.mjs +36 -0
  32. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/test-readme.md +24 -0
  33. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/textToPath-test.mjs +14 -0
  34. package/charts/TODO charts/???/InfoBox.js +456 -0
  35. package/charts/TODO charts/???/README-upg OLD/342/206/222NEW.md" +53 -0
  36. package/charts/TODO charts/???/README.md +1 -0
  37. package/charts/TODO charts/???/TODO.md +39 -0
  38. package/charts/TODO charts/???/base-cfg.js +66 -0
  39. package/charts/TODO charts/???/rating-displayOLD.js +837 -0
  40. package/charts/TODO charts/docs/TODO.md +1 -0
  41. package/charts/TODO charts/docs/costruzione display rating.md +145 -0
  42. package/charts/TODO charts/test/node-test.mjs +92 -0
  43. package/charts/TODO charts/test/test-readme.md +23 -0
  44. package/charts/TODO charts/test/test-src/rating-display-extra-test.js +132 -0
  45. package/charts/TODO charts/test/test-src/rating-display-test.js +155 -0
  46. package/charts/TODO charts/test/textToPath-test.mjs +14 -0
  47. package/charts/TODO.md +1 -1
  48. package/design-tokens/tokens/{design-tokens/_src → src/components/modal-popup}/modal-popup.minimo.tokens.jsonc +48 -2
  49. package/design-tokens/utilities/build-tokens-src/config.mjs +5 -2
  50. package/design-tokens/utilities/build-tokens-src/formats/penpot.mjs +1 -1
  51. package/design-tokens/utilities/build-tokens-src/platforms.mjs +4 -1
  52. package/design-tokens/utilities/build-tokens.mjs +5 -3
  53. package/design-tokens/utilities/check-unresolved-custom-props.mjs +5 -2
  54. package/dev-tools/starter-kit/webpack.config.mjs +6 -6
  55. package/package.json +17 -10
  56. package/snippets/flash-messages.html.twig +34 -0
  57. package/src/components/modal-alert/modal-alert.js +3 -1
  58. package/src/components/modal-popup/modal-popup.js +68 -4
  59. package/{design-tokens/_src → src/components/modal-popup}/modal-popup.minimo.tokens.mjs +51 -2
  60. package/src/components/modal-popup/modal-popup.module.css +24 -32
  61. package/src/components/unsplash-page/unsplash-page.js +3 -6
  62. package/src/components/unsplash-page/unsplash-page.module.css +11 -6
  63. package/src/custom-properties.css +21 -12
@@ -0,0 +1,177 @@
1
+ // radial bars
2
+
3
+
4
+ export async function radialBars({
5
+ container = null, // container (selettore o elemento)
6
+ svgClassName = null,
7
+ gap = 5, // px
8
+ strokeWidth = 20, // px
9
+ clockwise = true,
10
+ start = 'bottom', // bottom | top
11
+ circleRadius = null, // se null è calcolato dalla larghezza del container
12
+
13
+ barClassName = null, // classe per le barre (solo web)
14
+ barStrokeLinecap = 'round', // bars stroke-linecap (round, butt, square)
15
+ barColors = null, // array di colori per le barre, se non presente vengono utilizzati i colori di default
16
+
17
+ labelsClassName = null, // classe per tutte le etichette
18
+ labelsFillColor = null, // fill per tutte le etichette, se null viene usato il colore impostato in `data`
19
+ labelsFontFilePath = null, // percorso font per textToPath
20
+ labelsFont = null, // obj || null, -> oggetto analogo a this.defaults.font
21
+
22
+ data = [],
23
+
24
+ debug = false, // draws a circle under each bar
25
+ } = {}) {
26
+
27
+ const bars_data_defaults = {
28
+ label : '_label_',
29
+ labelFillColor : '#000', // se null viene utilizzato il valore globale `labelFillColor` o, se `null` quello della barra
30
+ barFillColor : null, // fill specifico per la barra
31
+ barStrokeColor : null, // stroke specifico per la barra, bypassa il valore di barColors
32
+ value : 0,
33
+
34
+ barClassName : null, // optional extra class for bar
35
+ labelClassName : null // optional extra class for label
36
+ };
37
+
38
+ data = (data?? []).map(item => { return {...bars_data_defaults, ...item}; });
39
+
40
+ barColors??= this.defaults.colors;
41
+ labelsFont = {...this.defaults.font, ...(labelsFont??{}) };
42
+
43
+ try {
44
+
45
+ if(['top', 'bottom'].indexOf(start) === -1) {
46
+ throw 'The `start` option must be `top` or `bottom`';
47
+ }
48
+
49
+ let [, width, height] = this.utils.parseContainer(container);
50
+
51
+ if(circleRadius) {
52
+ width = height = circleRadius * 2;
53
+
54
+ } else if (width) {
55
+ circleRadius??= width / 2;
56
+
57
+ } else {
58
+ throw 'Devi specificare almeno uno tra `container` e `circleRadius`';
59
+ }
60
+
61
+ const viewBox = [
62
+ -strokeWidth / 2,
63
+ -strokeWidth / 2,
64
+ circleRadius * 2 + strokeWidth,
65
+ circleRadius * 2 + strokeWidth
66
+ ].join(' ');
67
+
68
+
69
+ const svgCanvas = this.createSvgCanvas(container)
70
+ .size(width, height)
71
+ .viewbox(viewBox)
72
+ .attr({
73
+ class: this.utils.classnamesNull('radial-bars-chart', svgClassName)
74
+ });
75
+
76
+ if(!this.textToPath) {
77
+ svgCanvas.css('--stroke-width', strokeWidth + 'px');
78
+ }
79
+
80
+
81
+ const start_angle = start === 'bottom'? 270 : 90,
82
+ max_value = Math.max(...data.map(i => i.value)),
83
+ center = {
84
+ x: circleRadius,
85
+ y: circleRadius
86
+ };
87
+
88
+ for await (const [idx, item] of data.entries()) {
89
+
90
+ const barGroup = svgCanvas.group()
91
+ .attr({'data-debug-info': debug? `radial-bars: gruppo ${idx}` : null})
92
+
93
+ ,radius = circleRadius - (idx * (strokeWidth + gap))
94
+ ,thisBarColor = barColors[idx]?? '#ccc'
95
+ ;
96
+
97
+ // guide
98
+ if(debug) {
99
+ barGroup.circle()
100
+ .attr({
101
+ 'data-debug-info': debug? `radial-bars: guida ${idx}` : null,
102
+ cx: center.x,
103
+ cy: center.y,
104
+ r : radius,
105
+ // 'stroke-width': strokeWidth,
106
+ // stroke: 'hsla(208, 18%, 80%, 0.302)',
107
+ 'stroke-width': '.5px',
108
+ stroke: '#f104ed',
109
+ fill: 'none'
110
+ });
111
+
112
+ } // end if(debug)
113
+
114
+ // bar
115
+ barGroup.path(this.utils.calcAttrD({
116
+ start_angle : start_angle,
117
+ percentage : item.value / max_value,
118
+ max_arc : 270,
119
+ center : center,
120
+ radius : radius,
121
+ clockwise : clockwise
122
+ }))
123
+ .attr({
124
+ 'data-debug-info' : debug? `radial-bars: barra ${idx}` : null,
125
+ 'stroke-width' : strokeWidth,
126
+ fill : item.barFillColor?? 'none',
127
+ 'stroke-linecap' : barStrokeLinecap,
128
+ stroke : item.barStrokeColor?? thisBarColor,
129
+ class: this.utils.classnamesNull(barClassName,item.barClassName)
130
+ })
131
+ ;
132
+
133
+ // label
134
+ let text_align = 'start',
135
+ text_margin = 20;
136
+
137
+ if((start === 'top' && clockwise) || (start === 'bottom' && !clockwise)) {
138
+ text_align = 'end';
139
+ text_margin = -20;
140
+ }
141
+
142
+ const [label_bbox, labelEl] = await this.createTextEl ({
143
+ text: item.label,
144
+ textFill: item.labelFillColor?? labelsFillColor,
145
+ fontAttr: labelsFont,
146
+ fontFilePath: labelsFontFilePath,
147
+ parentElement: barGroup
148
+ });
149
+
150
+ labelEl
151
+ .move(
152
+ circleRadius + text_margin,
153
+ start === 'top'
154
+ ? idx * (strokeWidth + gap)
155
+ : (circleRadius * 2 - idx * (strokeWidth + gap)) - label_bbox.height / 2
156
+ )
157
+ .attr({
158
+ 'text-anchor': !this.textToPath? text_align : null,
159
+ // 'dominant-baseline': !this.textToPath? 'middle': null,
160
+
161
+ class: this.utils.classnamesNull(labelsClassName, item.labelClassName)
162
+ });
163
+
164
+ if(start === 'top') {
165
+ labelEl.dy(-label_bbox.height / 2);
166
+ }
167
+
168
+ } // end for await data
169
+
170
+ if(!container) {
171
+ return svgCanvas.svg();
172
+ }
173
+
174
+ } catch(e) {
175
+ console.error( 'AdaCharts → radialBars', e ); // eslint-disable-line
176
+ }
177
+ }