@massimo-cassandro/minimo 1.18.4 → 1.19.1

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 (171) hide show
  1. package/README.md +5 -1
  2. package/design-tokens/{utilities/readme.md → README.md} +26 -16
  3. package/design-tokens/tokens/src/components/unsplash-page/unsplash-page.minimo.tokens.jsonc +69 -31
  4. package/design-tokens/{utilities/tokens-config-sample.mjs → tokens-config-sample.mjs} +18 -10
  5. package/design-tokens/utilities/build-tokens-src/config.mjs +5 -0
  6. package/design-tokens/utilities/build-tokens-src/formats/css.mjs +18 -2
  7. package/design-tokens/utilities/build-tokens-src/merge-css.mjs +60 -0
  8. package/design-tokens/utilities/build-tokens.mjs +12 -0
  9. package/dev-tools/README.md +8 -0
  10. package/dev-tools/starter-kit/starter-install.sh +46 -26
  11. package/package.json +6 -2
  12. package/snippets/error-pages/error-pages.js +3 -2
  13. package/src/components/unsplash-page/unsplash-page.minimo.tokens.mjs +78 -39
  14. package/src/components/unsplash-page/unsplash-page.module.css +25 -6
  15. package/src/custom-properties.css +8 -1
  16. package/src/minimo.css +1 -1
  17. package/src/web-components/s-datatable-component/s-datatable-component.js +4 -1
  18. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/index.js +0 -92
  19. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/hbars.js +0 -356
  20. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/pie.js +0 -245
  21. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/radial-bars.js +0 -177
  22. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/rating-display.js +0 -835
  23. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/costruzione-assi.js +0 -212
  24. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/costruzione-linee.js +0 -101
  25. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/defaults.js +0 -185
  26. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/display-current.js +0 -27
  27. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/grid-areas.js +0 -129
  28. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/parse-opts.js +0 -64
  29. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/paths-setup.js +0 -73
  30. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile.js +0 -126
  31. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/signal-bars.js +0 -290
  32. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/week-utils.js +0 -122
  33. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/hbars-test.js +0 -52
  34. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/mcn-test.js +0 -74
  35. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/pie-test.js +0 -16
  36. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/radial-bars-test.js +0 -48
  37. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/settimanale-mensile-dati-settimanale.js +0 -426
  38. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/settimanale-mensile-test.js +0 -260
  39. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/signal-bars-test.js +0 -64
  40. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/node-test.mjs +0 -86
  41. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/hBars-node-test.mjs +0 -40
  42. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/lines-node-test.mjs +0 -73
  43. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/mcn-node-test.mjs +0 -64
  44. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/pie-node-test.mjs +0 -12
  45. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/radialsBar-node-test.mjs +0 -44
  46. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/settimanale-mensile-node-test.mjs +0 -258
  47. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/signalBars-node-test.mjs +0 -36
  48. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/test-readme.md +0 -24
  49. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/textToPath-test.mjs +0 -14
  50. package/charts/TODO charts/???/InfoBox.js +0 -456
  51. package/charts/TODO charts/???/README-upg OLD/342/206/222NEW.md" +0 -53
  52. package/charts/TODO charts/???/README.md +0 -1
  53. package/charts/TODO charts/???/TODO.md +0 -39
  54. package/charts/TODO charts/???/base-cfg.js +0 -66
  55. package/charts/TODO charts/???/rating-displayOLD.js +0 -837
  56. package/charts/TODO charts/docs/TODO.md +0 -1
  57. package/charts/TODO charts/docs/costruzione display rating.md +0 -145
  58. package/charts/TODO charts/test/node-test.mjs +0 -92
  59. package/charts/TODO charts/test/test-readme.md +0 -23
  60. package/charts/TODO charts/test/test-src/rating-display-extra-test.js +0 -132
  61. package/charts/TODO charts/test/test-src/rating-display-test.js +0 -155
  62. package/charts/TODO charts/test/textToPath-test.mjs +0 -14
  63. package/charts/TODO.md +0 -7
  64. package/charts/src/node-helpers/TODO.md +0 -2
  65. package/dev-tools/starter-kit/TODO.md +0 -135
  66. package/src/components/TODO form-multiselect/form-multiselect.css +0 -40
  67. package/src/components/TODO form-multiselect/form-multiselect.js +0 -83
  68. package/src/components/TODO vanilla-cookie-consent/cookie-consent.css +0 -20
  69. package/src/components/TODO vanilla-cookie-consent/cookie-consent.js +0 -76
  70. package/src/components/TODO vanilla-cookie-consent/render-cookie-list.js +0 -32
  71. package/src/components/TODO vanilla-cookie-consent/src/cookie-list.js +0 -85
  72. package/src/components/TODO vanilla-cookie-consent/src/it-translation.js +0 -38
  73. package/src/components/TODO vanilla-cookie-consent/src/run-analytics.js +0 -54
  74. package/src/components/TODO vanilla-cookie-consent/src/run-recaptcha.js +0 -71
  75. package/src/components/autocomplete/TODO.md +0 -4
  76. package/src/web-components/TODO json-table/README.md +0 -67
  77. package/src/web-components/TODO json-table/TODO.md +0 -12
  78. package/src/web-components/TODO json-table/_work/OLD/docs/custom-props-list.md +0 -69
  79. package/src/web-components/TODO json-table/_work/OLD/script/create-css-custom-props-doc.mjs +0 -113
  80. package/src/web-components/TODO json-table/_work/OLD/script/src/custom-props-end.md +0 -4
  81. package/src/web-components/TODO json-table/_work/OLD/script/src/custom-props-start.md +0 -30
  82. package/src/web-components/TODO json-table/_work/OLD/src/css/icons.module.css +0 -22
  83. package/src/web-components/TODO json-table/_work/OLD/src/css/info.module.css +0 -42
  84. package/src/web-components/TODO json-table/_work/OLD/src/css/main-wrapper.module.css +0 -4
  85. package/src/web-components/TODO json-table/_work/OLD/src/css/table.module.css +0 -154
  86. package/src/web-components/TODO json-table/_work/OLD/src/css/utility.module.css +0 -9
  87. package/src/web-components/TODO json-table/_work/OLD/src/icons/false.svg +0 -1
  88. package/src/web-components/TODO json-table/_work/OLD/src/icons/search-arrows.svg +0 -1
  89. package/src/web-components/TODO json-table/_work/OLD/src/icons/true.svg +0 -1
  90. package/src/web-components/TODO json-table/_work/OLD/src/index.js +0 -56
  91. package/src/web-components/TODO json-table/_work/OLD/src/js/default-columns-data-types.js +0 -172
  92. package/src/web-components/TODO json-table/_work/OLD/src/js/defaults.js +0 -156
  93. package/src/web-components/TODO json-table/_work/OLD/src/js/info-section.js +0 -31
  94. package/src/web-components/TODO json-table/_work/OLD/src/js/listeners.js +0 -17
  95. package/src/web-components/TODO json-table/_work/OLD/src/js/main-builder.js +0 -26
  96. package/src/web-components/TODO json-table/_work/OLD/src/js/parse-params.js +0 -121
  97. package/src/web-components/TODO json-table/_work/OLD/src/js/set-column-classname.js +0 -22
  98. package/src/web-components/TODO json-table/_work/OLD/src/js/table-builder.js +0 -64
  99. package/src/web-components/TODO json-table/_work/OLD/src/js/table-foot.js +0 -8
  100. package/src/web-components/TODO json-table/_work/OLD/src/js/table-head.js +0 -47
  101. package/src/web-components/TODO json-table/_work/OLD/src/js/table-row.js +0 -83
  102. package/src/web-components/TODO json-table/_work/OLD/src/js/utilities.js +0 -5
  103. package/src/web-components/TODO json-table/_work/__json-table-react/index.js +0 -4
  104. package/src/web-components/TODO json-table/_work/__json-table-react/src/build-page-array.js +0 -73
  105. package/src/web-components/TODO json-table/_work/__json-table-react/src/columns-data-types.js +0 -73
  106. package/src/web-components/TODO json-table/_work/__json-table-react/src/defaults.js +0 -50
  107. package/src/web-components/TODO json-table/_work/__json-table-react/src/download-excel.js +0 -156
  108. package/src/web-components/TODO json-table/_work/__json-table-react/src/set-className.js +0 -19
  109. package/src/web-components/TODO json-table/_work/__json-table-react/src/set-download-filename.js +0 -17
  110. package/src/web-components/TODO json-table/_work/__json-table-react/src/table-to-csv.js +0 -48
  111. package/src/web-components/TODO json-table/_work/archived/table-to-csv.js +0 -48
  112. package/src/web-components/TODO json-table/_work/arrow.svg +0 -3
  113. package/src/web-components/TODO json-table/_work/da decidere/get-cell-data.js +0 -18
  114. package/src/web-components/TODO json-table/_work/download-button.js +0 -29
  115. package/src/web-components/TODO json-table/_work/download-excel.js +0 -155
  116. package/src/web-components/TODO json-table/_work/pagination-array-builder.js +0 -73
  117. package/src/web-components/TODO json-table/_work/pagination.js +0 -37
  118. package/src/web-components/TODO json-table/_work/set-download-filename.js +0 -19
  119. package/src/web-components/TODO json-table/_work/table-info.js +0 -24
  120. package/src/web-components/TODO json-table/demo/README.md +0 -66
  121. package/src/web-components/TODO json-table/demo/assets/link-simple.svg +0 -1
  122. package/src/web-components/TODO json-table/demo/demo-data/json-static-table-demo-data.js +0 -512
  123. package/src/web-components/TODO json-table/demo/demo.css +0 -32
  124. package/src/web-components/TODO json-table/demo/demo.js +0 -24
  125. package/src/web-components/TODO json-table/demo/js/demo-ajax-table.js +0 -165
  126. package/src/web-components/TODO json-table/demo/js/demo-static-table.js +0 -180
  127. package/src/web-components/TODO json-table/demo/webpack-modules/css-rules.mjs +0 -122
  128. package/src/web-components/TODO json-table/demo/webpack-modules/get-jsConfig-aliases.mjs +0 -33
  129. package/src/web-components/TODO json-table/demo/webpack-modules/svg-rules.mjs +0 -108
  130. package/src/web-components/TODO json-table/demo/webpack-modules/svgo.config.mjs +0 -26
  131. package/src/web-components/TODO json-table/demo/webpack.config.mjs +0 -333
  132. package/src/web-components/TODO json-table/docs/custom-props-list.md +0 -74
  133. package/src/web-components/TODO json-table/docs-builder/create-css-custom-props-doc.mjs +0 -157
  134. package/src/web-components/TODO json-table/docs-builder/src/custom-props-end.md +0 -6
  135. package/src/web-components/TODO json-table/docs-builder/src/custom-props-start.md +0 -29
  136. package/src/web-components/TODO json-table/src/TODO.md +0 -1
  137. package/src/web-components/TODO json-table/src/__json-table-react/build-page-array.js +0 -73
  138. package/src/web-components/TODO json-table/src/__json-table-react/columns-data-types.js +0 -73
  139. package/src/web-components/TODO json-table/src/__json-table-react/defaults.js +0 -50
  140. package/src/web-components/TODO json-table/src/__json-table-react/download-excel.js +0 -156
  141. package/src/web-components/TODO json-table/src/__json-table-react/set-className.js +0 -19
  142. package/src/web-components/TODO json-table/src/__json-table-react/set-download-filename.js +0 -17
  143. package/src/web-components/TODO json-table/src/__json-table-react/table-to-csv.js +0 -48
  144. package/src/web-components/TODO json-table/src/css/custom-media.css +0 -16
  145. package/src/web-components/TODO json-table/src/css/icons.module.css +0 -22
  146. package/src/web-components/TODO json-table/src/css/info-section.module.css +0 -78
  147. package/src/web-components/TODO json-table/src/css/main-builder.module.css +0 -6
  148. package/src/web-components/TODO json-table/src/css/table.module.css +0 -172
  149. package/src/web-components/TODO json-table/src/css/utility.module.css +0 -9
  150. package/src/web-components/TODO json-table/src/icons/arrow-down-bold.svg +0 -1
  151. package/src/web-components/TODO json-table/src/icons/false.svg +0 -1
  152. package/src/web-components/TODO json-table/src/icons/true.svg +0 -1
  153. package/src/web-components/TODO json-table/src/index.js +0 -125
  154. package/src/web-components/TODO json-table/src/js/default-columns-data-types.js +0 -172
  155. package/src/web-components/TODO json-table/src/js/defaults.js +0 -510
  156. package/src/web-components/TODO json-table/src/js/get-ajax-data.js +0 -72
  157. package/src/web-components/TODO json-table/src/js/info-section.js +0 -39
  158. package/src/web-components/TODO json-table/src/js/init-ajax-table.js +0 -30
  159. package/src/web-components/TODO json-table/src/js/init-static-table.js +0 -18
  160. package/src/web-components/TODO json-table/src/js/main-builder.js +0 -87
  161. package/src/web-components/TODO json-table/src/js/parse-data-row.js +0 -123
  162. package/src/web-components/TODO json-table/src/js/parse-params.js +0 -118
  163. package/src/web-components/TODO json-table/src/js/set-search-listener.js +0 -62
  164. package/src/web-components/TODO json-table/src/js/set-sort-listeners.js +0 -115
  165. package/src/web-components/TODO json-table/src/js/static-data-sorting.js +0 -23
  166. package/src/web-components/TODO json-table/src/js/table-builder.js +0 -45
  167. package/src/web-components/TODO json-table/src/js/table-row.js +0 -43
  168. package/src/web-components/TODO json-table/src/js/table-tfoot.js +0 -9
  169. package/src/web-components/TODO json-table/src/js/table-thead.js +0 -91
  170. package/src/web-components/TODO json-table/src/js/update-info.js +0 -42
  171. package/src/web-components/TODO json-table/src/js/utilities.js +0 -5
@@ -37,49 +37,112 @@ export default {
37
37
  }
38
38
  }, // end base setup
39
39
 
40
- // credit box
41
- credits: {
40
+ // title
41
+ h1: {
42
+ color: {
43
+ $type: 'color',
44
+ $value: '{uspg.text.color}'
45
+ },
42
46
  font: {
43
47
  size: {
44
48
  $type: 'dimension',
45
- $value: '{font.size.xs}'
49
+ $value: '{font.size.xl}'
46
50
  },
47
51
  weight: {
48
52
  $type: 'fontWeight',
49
- $value: '{font.weight.regular}'
53
+ $value: '{font.weight.bold}'
50
54
  },
55
+ 'variation-settings': {
56
+ $type: 'string',
57
+ $value: 'unset'
58
+ }
51
59
  },
52
60
  'line-height': {
53
61
  $type: 'number',
54
62
  $value: '{line-height.xs}'
55
63
  },
56
- }, // end credits
64
+ }, // end h1
57
65
 
58
- // title
59
- h1: {
66
+
67
+ // links
68
+ link: {
60
69
  color: {
61
70
  $type: 'color',
62
- $value: '{uspg.text.color}'
71
+ $value: '#fc0'
72
+ },
73
+ decoration: {
74
+ $type: 'string',
75
+ $value: 'none'
76
+ },
77
+ visited: {
78
+ color: {
79
+ $type: 'color',
80
+ $value: '#C711FF'
81
+ }
82
+ },
83
+ hover: {
84
+ color: {
85
+ $type: 'color',
86
+ $value: '{uspg.bg.color}'
87
+ },
88
+ background: {
89
+ color: {
90
+ $type: 'color',
91
+ $value: 'transparent'
92
+ }
93
+ },
94
+ decoration: {
95
+ $type: 'string',
96
+ $value: 'underline'
97
+ },
63
98
  },
99
+ active: {
100
+ color: {
101
+ $type: 'color',
102
+ $value: '#F49C29'
103
+ }
104
+ },
105
+ focus: {
106
+ outline: {
107
+ width: {
108
+ $value: '2px',
109
+ $type: 'dimension'
110
+ },
111
+ style: {
112
+ $value: 'solid',
113
+ $type: 'string'
114
+ },
115
+ color: {
116
+ $value: '{uspg.link.color}',
117
+ $type: 'color'
118
+ },
119
+ offset: {
120
+ $value: '2px',
121
+ $type: 'dimension'
122
+ },
123
+ }
124
+ }
125
+
126
+ },
127
+
128
+ // credit box
129
+ credits: {
64
130
  font: {
65
131
  size: {
66
132
  $type: 'dimension',
67
- $value: '{font.size.xl}'
133
+ $value: '{font.size.xs}'
68
134
  },
69
135
  weight: {
70
136
  $type: 'fontWeight',
71
- $value: '{font.weight.bold}'
137
+ $value: '{font.weight.regular}'
72
138
  },
73
- 'variation-settings': {
74
- $type: 'string',
75
- $value: 'unset'
76
- }
77
139
  },
78
140
  'line-height': {
79
141
  $type: 'number',
80
142
  $value: '{line-height.xs}'
81
143
  },
82
- }, // end h1
144
+ }, // end credits
145
+
83
146
 
84
147
  // icons
85
148
  icon: {
@@ -105,30 +168,6 @@ export default {
105
168
  }
106
169
  }, // end icons
107
170
 
108
- // links
109
- link: {
110
- color: {
111
- $type: 'color',
112
- $value: '#fc0'
113
- },
114
- decoration: {
115
- $type: 'string',
116
- $value: 'none'
117
- },
118
- hover: {
119
- color: {
120
- $type: 'color',
121
- $value: '#fc0'
122
- },
123
- decoration: {
124
- $type: 'string',
125
- $value: 'underline'
126
- },
127
-
128
- }
129
-
130
- }, // end link
131
-
132
171
  // loader
133
172
  loader: {
134
173
  color: {
@@ -68,16 +68,33 @@ html, body {
68
68
 
69
69
  background-color: #333;
70
70
 
71
- a:is(:link, :visited) {
72
- color: var(--uspg-link-color, #fc0);
73
- text-decoration: var(--uspg-link-decoration, none);
74
-
71
+ a {
72
+ &:is(:link, :visited) {
73
+ text-decoration: var(--uspg-link-decoration);
74
+ }
75
+ &:link {
76
+ color: var(--uspg-link-color);
77
+ }
78
+ &:visited {
79
+ color: var(--uspg-link-visited-color);
80
+ }
81
+ &:focus {
82
+ outline: none;
83
+ }
84
+ &:focus-visible {
85
+ outline: var(--uspg-link-focus-outline-width) var(--uspg-link-focus-outline-style) var(--uspg-link-focus-outline-color);
86
+ outline-offset: var(--uspg-link-focus-outline-offset);
87
+ }
75
88
  @media (hover: hover) {
76
89
  &:hover {
77
- color: var(--uspg-link-hover-color, #fc0);
78
- text-decoration: var(--uspg-link-hover-decoration, underline);
90
+ color: var(--uspg-link-hover-color);
91
+ text-decoration: var(--uspg-link-hover-decoration);
92
+ background-color: var(--uspg-link-hover-background-color);
79
93
  }
80
94
  }
95
+ &:active {
96
+ color: var(--uspg-link-active-color);
97
+ }
81
98
  }
82
99
  }
83
100
 
@@ -122,6 +139,8 @@ html, body {
122
139
  justify-content: center;
123
140
  width: 100%;
124
141
  overflow: hidden;
142
+
143
+
125
144
  }
126
145
 
127
146
  .message, .credits {
@@ -358,10 +358,17 @@
358
358
  --uspg-icon-fill-color: #333;
359
359
  --uspg-icon-hover-box-bg: #fff;
360
360
  --uspg-line-height: var(--line-height-sm);
361
+ --uspg-link-active-color: #f49c29;
361
362
  --uspg-link-color: #fc0;
362
363
  --uspg-link-decoration: none;
363
- --uspg-link-hover-color: #fc0;
364
+ --uspg-link-focus-outline-color: var(--uspg-link-color);
365
+ --uspg-link-focus-outline-offset: .125rem;
366
+ --uspg-link-focus-outline-style: solid;
367
+ --uspg-link-focus-outline-width: .125rem;
368
+ --uspg-link-hover-background-color: transparent;
369
+ --uspg-link-hover-color: var(--uspg-bg-color);
364
370
  --uspg-link-hover-decoration: underline;
371
+ --uspg-link-visited-color: #c711ff;
365
372
  --uspg-loader-color: hsl(0deg 0% 100% / .6);
366
373
  --uspg-text-color: #fff;
367
374
  --z-index-overlay: 99;
package/src/minimo.css CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /* @import '@src/fonts.css'; */
3
3
  /* @import '@src/css/custom-media.css'; */ /* managed by postcss */
4
- @import '@src/custom-properties.css';
4
+ /* @import '@src/custom-properties.css'; */ /* managed by postcss-jit-props */
5
5
 
6
6
  @import '@minimo/css/reset.css';
7
7
  @import '@minimo/css/layout-base.css';
@@ -1,4 +1,7 @@
1
1
  // @ts-nocheck
2
+
3
+ /* global process */
4
+
2
5
  import { DataTable } from 'simple-datatables';
3
6
 
4
7
  import { parseCols } from './src/parse-cols.js';
@@ -219,7 +222,7 @@ class SimpleDatatableAdapter extends HTMLElement {
219
222
  super();
220
223
  // this.attachShadow({ mode: 'open' }); // commentare per light dom
221
224
 
222
- if (!_deprecationWarned) {
225
+ if (!_deprecationWarned && process.env.NODE_ENV === 'development') {
223
226
  _deprecationWarned = true;
224
227
  // eslint-disable-next-line no-console
225
228
  console.warn('[s-datatable] componente deprecato');
@@ -1,92 +0,0 @@
1
- // NB: i grafici non utilizzati in questa verione della brochure sono disabilitati
2
-
3
- import { pie } from './src/charts/pie.js';
4
- // import { hbars } from './src/charts/hbars.js';
5
- import { signalBars } from './src/charts/signal-bars.js';
6
- import { ratingDisplay } from './src/charts/rating-display.js';
7
- // import { radialBars } from './src/charts/radial-bars.js';
8
- import { settimanaleMensile } from './src/charts/settimanale-mensile.js';
9
- import { mcn } from './src/charts/mcn.js';
10
- import { lines } from './src/charts/lines.js';
11
- import { bars } from './src/charts/bars.js';
12
-
13
- import { utils } from './src/chart-utils.js';
14
- import { default_colors } from './src/default-chart-colors.js';
15
- import { createSvgCanvas } from './src/create-svg-canvas.js';
16
- import { createTextEl } from './src/create-text-element.js';
17
-
18
- import { legenda } from './src/components/legenda.js';
19
- import { cartesianAxis } from './src/components/cartesian-axis.js';
20
-
21
- class AdaCharts {
22
-
23
- constructor(customParams = {}) {
24
-
25
- this.defaults??= {};
26
-
27
- this.defaults.colors = customParams.defaults?.colors?? Object.values(default_colors);
28
-
29
- this.defaults.font = {
30
-
31
- // pattern per defaults.font
32
- // i valori commentati sono quelli di default
33
- // se non vanno modificati, non serve impostarli
34
- ...{
35
- // family: 'sans-serif',
36
- // size: 14,
37
- // stretch: 'normal',
38
- // style: 'normal',
39
- // variant: 'normal',
40
- // weight: 400
41
- },
42
- ...(customParams.defaults?.font?? {})
43
- };
44
-
45
-
46
- /** se true converte i font in tracciati */
47
- // NB: non usare per versioni browser (usa node)
48
- this.textToPath = customParams.textToPath?? false;
49
-
50
- this.debug = customParams.debug?? false;
51
-
52
- // istanza svgjs per web
53
- this.createSvgCanvas = customParams.createSvgCanvas?? createSvgCanvas;
54
-
55
- // parametri generati condivisi
56
- this.sharedParams = {};
57
- }
58
-
59
- setSharedParams(key, value = null) {
60
- this.sharedParams[key] = value;
61
- }
62
-
63
- getSharedParams(key) {
64
- return this.sharedParams[key];
65
- }
66
-
67
- }
68
-
69
- AdaCharts.prototype.utils = utils;
70
- AdaCharts.prototype.createTextEl = createTextEl;
71
- AdaCharts.prototype.legenda = legenda;
72
- AdaCharts.prototype.cartesianAxis = cartesianAxis;
73
-
74
-
75
- AdaCharts.prototype.pie = pie;
76
- // AdaCharts.prototype.hbars = hbars;
77
- AdaCharts.prototype.signalBars = signalBars;
78
- AdaCharts.prototype.ratingDisplay = ratingDisplay;
79
- // AdaCharts.prototype.radialBars = radialBars;
80
- AdaCharts.prototype.settimanaleMensile = settimanaleMensile;
81
- AdaCharts.prototype.mcn = mcn;
82
- AdaCharts.prototype.lines = lines;
83
- AdaCharts.prototype.bars = bars;
84
-
85
-
86
- export { AdaCharts };
87
-
88
-
89
- // esportazione singoli metodi
90
- // https://cube.dev/blog/how-to-build-tree-shakeable-javascript-libraries
91
- // https://www.freecodecamp.org/news/what-is-a-pure-function-in-javascript-acb887375dfe/
92
- // export const barsChart = /* #__PURE__ */ AdaCharts.bars;
@@ -1,356 +0,0 @@
1
- // horizontal bars
2
-
3
- export async function hbars({
4
-
5
- /** colori specifici */
6
- colors = null,
7
-
8
- /** container (selettore o elemento DOM), se null viene restituito il codice SVG */
9
- container = null,
10
-
11
- /**
12
- larghezza e altezza del grafico (px),
13
- Se il container è presente e i parametro `width` e `height` sono `null`,
14
- vengono utilizzate le dimensioni del container.
15
- Se uno dei due valori non è impostato o ricavabile, viene generato un errore.
16
- NB: il padding del container viene considerato nelle dimensioni del grafico,
17
- è preferibile non impostarlo.
18
- Il valore 'auto' di height fa sì che l'altezza dell'svg sia calcolata sulla base
19
- del numero di barre e dei valori `barsGap` e `barsHeight`
20
- */
21
- width = null, // null || <value>
22
- height = 300, // <value> || null || 'auto'
23
-
24
- /** valori numerici da associare alle barre del grafico */
25
- values = [],
26
-
27
- /** etichette delle varie barre, l'indice di ogni elemento corrisponde a quello di `values` a cui si riferisce */
28
- labels = [],
29
-
30
-
31
- /** Indica se mostrare o no i valori delle barre (mostrati dopo la barra) */
32
- showValues = true,
33
-
34
- /**
35
- Modalità di rappresentazione del valore mostrato.
36
- Se 'percent', il valore mostrato è la percentuale rispetto al totale dei valori
37
- */
38
- showValuesAs = 'number', // number, numbers, percent, euro
39
-
40
- /** In caso di visualizzazione dei valori (showValues === true), numero di decimali da mostrare */
41
- showValuesFractionDigits = 2,
42
-
43
- /** In caso di visualizzazione dei valori (showValues === true), formattazione locale da utilizzare */
44
- showValuesLocale = 'it-IT',
45
-
46
- /**
47
- Impostazioni font per le etichette e i valori
48
- Impostare solo se non si vogliono usare i colori di default
49
- se impostato è un oggetto analogo a quello definito in index.js
50
- Possono essere impostati solo i valori che si vogliono modificare
51
- */
52
- labelsFont = null,
53
- valuesFont = null,
54
-
55
- /** path del file font per la conversione in tracciati */
56
- labelsFontFilePath = null,
57
- valuesFontFilePath = null,
58
-
59
- /** text fill color */
60
- labelsFill = '#000',
61
- valuesFill = '#000',
62
-
63
- /** direzione della barra */
64
- barsDirection = 'right', // right || left
65
-
66
- /** larghezza minima labels */
67
- minLabelslWidth = 0,
68
-
69
- /** spazio tra un'etichetta di testo e il grafico */
70
- textBarsGap = 8,
71
-
72
- /** spazio tra una barra e la successiva */
73
- barsGap = 10,
74
-
75
- /** altezza barre */
76
- barsHeight = 40,
77
-
78
- /** corner radius */
79
- barsCornerRadius = 5,
80
-
81
- /** spessore e colore traccia (0 per non visualizzare) */
82
- barsStrokeWidth = 0,
83
- barsStrokeColor = '#000',
84
-
85
- /** se false le classi vengono ignorate */
86
- useClasses = false,
87
-
88
- /** array di eventuali classi da associare ai corrispondenti valori in base al loro indice */
89
- valClasses = null,
90
-
91
- // TODO animazione
92
- /** se true, attiva l'animazione */ // NB non attivo
93
- // animazione = false, // non implementato
94
-
95
- /** frame per secondo dell'animazione */ // NB non attivo
96
- // fps = 60
97
- }) {
98
-
99
- try {
100
-
101
- if(values.filter(v => isNaN(v)).length) {
102
- throw 'There are non-numeric values';
103
- }
104
-
105
- if(!values.length) {
106
- throw 'At least one value is needed';
107
- }
108
-
109
- if(isNaN(barsStrokeWidth)) {
110
- throw '`barsStrokeWidth` must be a number';
111
- } else {
112
- barsStrokeWidth = +barsStrokeWidth;
113
- }
114
-
115
- const toRight = barsDirection === 'right';
116
-
117
- [, width, height] = this.utils.parseContainer(container, width, height);
118
-
119
-
120
- if(barsGap == null) {
121
- throw '`barsGap` must be set';
122
- }
123
-
124
- if(height === 'auto') {
125
- height = (values.length * barsHeight) +
126
- ((values.length - 1) * barsGap) +
127
- // la traccia insiste per metà sulla parte interna della barra, quindi va calcolata una sola volta
128
- (values.length * barsStrokeWidth);
129
-
130
- if(!barsHeight) {
131
- throw 'With `height = \'auto\'`, `barsHeight` must be set';
132
- }
133
-
134
- } else { // determinazione altezza barre
135
- barsHeight = (
136
- height -
137
- ((values.length - 1) * barsGap)
138
- ) / values.length - barsStrokeWidth;
139
- }
140
-
141
-
142
- if(!width || !height) {
143
- throw `Missing width and/or height: width: ${width}, height: ${height}`;
144
- }
145
-
146
- // colori forniti o di default
147
- colors??= this.defaults.colors;
148
-
149
- // fonts
150
- labelsFont = {...this.defaults.font, ...(labelsFont??{}) };
151
- valuesFont = {...this.defaults.font, ...(valuesFont??{}) };
152
-
153
- // somma di tutti i valori per calcolo persentuale
154
- const totValues = values.reduce((tot, current) => tot + current, 0);
155
-
156
- // definizione etichette valori
157
- let valueLabels = [];
158
- if(showValues) {
159
- valueLabels = values.map(v => {
160
-
161
- if(showValuesAs === 'percent') {
162
- v = v / totValues;
163
- }
164
-
165
- let labelStyle;
166
- switch (showValuesAs) {
167
- case 'number':
168
- case 'numbers':
169
- labelStyle = {
170
- style: 'decimal'
171
- };
172
- break;
173
-
174
- case 'percent':
175
- labelStyle = {
176
- style: 'percent'
177
- };
178
- break;
179
-
180
- case 'euro':
181
- labelStyle = {
182
- currency: 'EUR',
183
- style: 'currency'
184
- };
185
- break;
186
-
187
- // no default
188
- }
189
-
190
- return v.toLocaleString(showValuesLocale, {
191
- minimumFractionDigits: showValuesFractionDigits,
192
- maximumFractionDigits: showValuesFractionDigits,
193
- ...labelStyle
194
- });
195
- });
196
- }
197
-
198
- const svgCanvas = this.createSvgCanvas(container); //.size(width, height);
199
- svgCanvas.viewbox(0, 0, width, height);
200
-
201
- // =>> etichette (labels) & etichette valori (valueLabels)
202
- // calcolo dimensioni del testo per ricavare lo spazio utile per le barre
203
- // e posizionamento delle etichette
204
-
205
- // valori per il calcolo dellìingombro massimo
206
- let max_labels_width = 0, max_value_labels_width = 0;
207
-
208
- // posizionamento iniziale, dopo il rendering verrà ridefinito in base all'altezza del testo
209
- let labelY = (barsHeight + barsStrokeWidth) / 2;
210
- // valore provvisorio, verrà reimpostato a fine ciclo (deve tenere conto di tutte le etichette)
211
- const labelX = toRight? 0 : width;
212
-
213
- const labels_elements = [], value_labels_elements = []; // per allineamenti successivi
214
-
215
-
216
-
217
- for await (const [idx,] of values.entries()) {
218
-
219
- // svgCanvas.line(0, labelY, width, labelY).stroke({ width: 1, color: '#f06'}); // linea di riferimento per allineamento
220
-
221
- const thisLabel = labels[idx],
222
- thisValueLabel = valueLabels[idx];
223
-
224
- if(thisLabel) {
225
-
226
-
227
- let [bbox, labelEl] = await this.createTextEl({
228
- text: thisLabel,
229
- textFill: labelsFill,
230
- fontAttr: {
231
- ...labelsFont,
232
- // 'text-anchor': toRight? 'end' : null
233
- },
234
- fontFilePath: labelsFontFilePath,
235
- parentElement: svgCanvas
236
- });
237
-
238
- labelEl.move(labelX, labelY - (bbox.height/2));
239
-
240
- max_labels_width = Math.max(max_labels_width, bbox.width, minLabelslWidth);
241
-
242
- labels_elements.push({label: labelEl, w: bbox.width}); // per il riposizionamento X successivo
243
- }
244
-
245
- // etichette valori
246
- if(thisValueLabel && showValues) {
247
-
248
- let [bbox, labelEl] = await this.createTextEl({
249
- text: thisValueLabel,
250
- textFill: valuesFill,
251
- fontAttr: {
252
- ...valuesFont,
253
- // 'text-anchor': toRight? null : 'end'
254
- },
255
- fontFilePath: valuesFontFilePath,
256
- parentElement: svgCanvas
257
- });
258
-
259
- labelEl.move(labelX, labelY - (bbox.height/2));
260
-
261
- max_value_labels_width = Math.max(max_value_labels_width, bbox.width);
262
- value_labels_elements.push({label: labelEl, w: bbox.width});
263
- }
264
-
265
-
266
- labelY += barsHeight + barsStrokeWidth + barsGap;
267
- } // end for values
268
-
269
- // linea di riferimento per allineamento:
270
- // svgCanvas.line(max_labels_width, 0, max_labels_width, height).stroke({ width: 2, color: '#4faa0d'});
271
-
272
- // =>> riposizionamento `labels_elements`
273
- // da sx a dx: allineate a destra sull'asse Y dell'etichetta più lunga
274
- // da dx a sx: allineate a sinistra sull'asse Y della larghezza dell'svg - lunghezza etichetta più lunga
275
- // NB da effettuare prima dell'aggiunta di `textBarsGap`
276
- // if(this.textToPath) {
277
-
278
- // NB VERSIONE che in modalità testo usa il metodo ax, non applicabile con i tracciati
279
- // eliminato per avere un'unica versione
280
- // labels_elements.forEach(l => {
281
- // l.label.x(toRight? max_labels_width - l.w : width - max_labels_width);
282
- // });
283
-
284
- // } else {
285
- // labels_elements.forEach(l => {
286
- // l.ax(toRight? max_labels_width : width - max_labels_width);
287
- // });
288
- // }
289
- labels_elements.forEach(l => {
290
- l.label.x(toRight? max_labels_width - l.w : width - max_labels_width);
291
- });
292
-
293
-
294
-
295
- // =>> aggiunta `textBarsGap` a `max_labels_width` e `max_value_labels_width`
296
- if(max_labels_width) {
297
- max_labels_width += textBarsGap;
298
- }
299
- if(max_value_labels_width) {
300
- max_value_labels_width += textBarsGap;
301
- }
302
-
303
- // =>> costruzione barre e posizionamento etichette valori
304
-
305
- // dimensioni barre
306
- const maxBarsWidth = width - max_labels_width - max_value_labels_width,
307
- maxBarsValue = values.reduce((max, current) => max > current? max : current, 0);
308
-
309
- let barY = barsStrokeWidth / 2;
310
- values.forEach((v, idx) => {
311
-
312
- const barWidth = (v / maxBarsValue * maxBarsWidth) - barsStrokeWidth,
313
-
314
- barX = toRight? max_labels_width : width - barWidth - max_labels_width,
315
- bar = svgCanvas.rect({
316
- x: barX,
317
- y: barY,
318
- width: barWidth,
319
- height: barsHeight,
320
- fill: colors[idx]?? '#ccc',
321
- })
322
- .radius(barsCornerRadius);
323
-
324
- if( barsStrokeWidth > 0 && barsStrokeColor) {
325
- bar.stroke({ color: barsStrokeColor, width: barsStrokeWidth });
326
- }
327
-
328
- if(useClasses && valClasses[idx]) {
329
- bar.addClass(valClasses[idx]);
330
- }
331
-
332
- // =>> riposizionamento value_labels_elements (vedi precedente =>> riposizionamento `labels_elements`)
333
- const thisValueLabel = value_labels_elements[idx];
334
- if(thisValueLabel != null && showValues) {
335
- thisValueLabel.label.x(
336
- toRight
337
- ? max_labels_width + barWidth + textBarsGap
338
- : barX - textBarsGap - thisValueLabel.w
339
- )
340
- .front();
341
- }
342
-
343
-
344
- barY += barsHeight + barsGap + barsStrokeWidth;
345
- });
346
-
347
- if(!container) {
348
- return svgCanvas.svg();
349
- }
350
-
351
-
352
- } catch(e) {
353
- console.error( 'AdaCharts → hbars', e ); // eslint-disable-line
354
- }
355
-
356
- }