@massimo-cassandro/minimo 1.20.11 → 1.20.12

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.
@@ -27,7 +27,7 @@
27
27
  "launchChrome": "open -n -a 'Google Chrome' --args --profile-directory='Profile 3'",
28
28
  "python server": "python3 -m http.server 8000 # --directory __dirname__ # 8000 = default port",
29
29
  "php server": "php -S localhost:8000 # -t root_dir/",
30
- "symfony server": "symfony serve -d --port=8100 --listen-ip=0.0.0.0 # symfony server:stop # http://192.168.1.135:8100",
30
+ "symfony server": "symfony serve --port=8100 --listen-ip=0.0.0.0 # symfony server:stop # http://192.168.1.135:8100 # -d (deamon): rimane aperto anche dopo la chiusra del terminale",
31
31
  "node server": "node serve # richiede ‘npm i serve’",
32
32
  "build tokens": "npx buildTokens --config ./path/to/tokens-config.mjs",
33
33
  "check unresolved props": "npx checkUnresolvedProps --config ./path/to/tokens-config.mjs"
@@ -174,6 +174,11 @@ function css_loaders({
174
174
  sassOptions: {
175
175
  quietDeps: true,
176
176
  silenceDeprecations: [ 'legacy-js-api', 'mixed-decls', 'color-functions', 'global-builtin', 'import' ],
177
+ // charset:false evita che sass anteponga @charset/BOM all'output di ogni
178
+ // singolo modulo quando la sorgente contiene caratteri non-ASCII (anche solo
179
+ // in un commento): con più moduli concatenati da MiniCssExtractPlugin, quel
180
+ // BOM finirebbe a metà del bundle finale invece che in testa al file.
181
+ charset: false,
177
182
  }
178
183
  }
179
184
  } ]
@@ -445,7 +445,7 @@ const config = {
445
445
  ]
446
446
  ),
447
447
 
448
-
448
+ // TODO author dinamico https://docs.npmjs.com/cli/v11/configuring-npm/package-json#people-fields-author-contributors
449
449
  // =>> plugins: BannerPlugin
450
450
  new webpack.BannerPlugin({
451
451
  banner: () => {
@@ -459,11 +459,8 @@ const config = {
459
459
  ,vers = packageJson.version.split('.').slice(0,-1).join('.')
460
460
  ;
461
461
 
462
- return (
463
- '/*!\n' +
464
- ` * ${packageJson.name} v.${vers} - Massimo Cassandro ${year}\n` +
465
- ' */\n'
466
- );
462
+ return `/*! ${packageJson.name} v.${vers} - Massimo Cassandro ${year} */`;
463
+
467
464
  },
468
465
  raw: true,
469
466
  // niente banner nei critical css: vengono inlinati nei template html
package/index.js CHANGED
@@ -20,7 +20,7 @@ export { ValidationError } from './src/utilities/validation-error-class.js';
20
20
 
21
21
  // domBuilder helpers
22
22
  export { buildPictureTag } from './src/utilities/dom-builder-helpers/picture-tag.js';
23
- export { buildInputTag, buildCheckboxTag, buildTextareaTag } from './src/utilities/dom-builder-helpers/form-tags.js';
23
+ export { buildInput, buildCheckbox, buildTextarea, fakeField } from './src/utilities/dom-builder-helpers/form-tags.js';
24
24
 
25
25
  // components
26
26
  export { dismissAlerts } from './src/components/dismiss-alerts.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.20.11",
3
+ "version": "1.20.12",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -17,7 +17,7 @@ sf_macro({
17
17
  ## Twig macro
18
18
 
19
19
  ```twig
20
- <fieldset class="sf-macro-wrapper">
20
+ <fieldset class="fset sf-macro-wrapper">
21
21
  <legend>XXXXX</legend>
22
22
 
23
23
  {%- macro makeRow(row) -%}
@@ -1,5 +1,5 @@
1
- /*! minimo - Symfony Macro */
2
- // import './sf-macro.css'; // import in the consuming project
1
+ /*! minimo - Symfony Macro Manager */
2
+ import './sf-macro.css';
3
3
 
4
4
  /**
5
5
  * Initialises Symfony macro collection fields (repeatable fieldsets).
@@ -48,18 +48,20 @@ function buildFormGroup({
48
48
  * @param {string | number | null} args.value - input `value` attribute.
49
49
  * @param {string | null} [args.type='text'] - input `type` attribute.
50
50
  * @param {string | null} [args.wrapperClass=null] - optional class to be added to the `.form-group` wrapper.
51
+ * @param {string | null} [args.className=null] - optional class to be added to the `input`.
51
52
  * @param {boolean} [args.condition=true] - When false, the function returns `null` without building anything.
52
53
  * @param {string | HTMLElement | null} args.help - Optional help text.
53
54
  * @param {(function(HTMLElement): void) | null} args.callback - Optional callback function.
54
- * @param {object | null} [args.attrs={}] - Optional attributes object.
55
+ * @param {Record<string, any> | null} [args.attrs={}] - Optional attributes object.
55
56
  * @returns {DomBuilderItem|null} The `input` domBuilder item, or `null` when `condition` is false.
56
57
  */
57
- export function buildInputTag({
58
+ export function buildInput({
58
59
  label,
59
60
  name,
60
61
  value = null,
61
62
  type = 'text',
62
63
  wrapperClass = null,
64
+ className = null,
63
65
  condition = true,
64
66
  help = null,
65
67
  attrs = {},
@@ -76,7 +78,7 @@ export function buildInputTag({
76
78
  `label.form-label[for:${id}] ${label}`,
77
79
  {
78
80
  tag: 'input',
79
- className: 'form-control',
81
+ className: classnames('form-control', className, attrs?.class),
80
82
  id: id,
81
83
  attrs: {
82
84
  ...(attrs??{}),
@@ -104,10 +106,10 @@ export function buildInputTag({
104
106
  * @param {boolean} [args.condition=true] - When false, the function returns `null` without building anything.
105
107
  * @param {string | HTMLElement | null} args.help - Optional help text.
106
108
  * @param {(function(HTMLElement): void) | null} args.callback - Optional callback function.
107
- * @param {object | null} [args.attrs={}] - Optional attributes object.
109
+ * @param {Record<string, any> | null} [args.attrs={}] - Optional attributes object.
108
110
  * @returns {DomBuilderItem|null} The `.form-check` (or `.form-group`-wrapped) domBuilder item, or `null` when `condition` is false.
109
111
  */
110
- export function buildCheckboxTag({
112
+ export function buildCheckbox({
111
113
  label,
112
114
  name,
113
115
  value = 1,
@@ -176,17 +178,19 @@ export function buildCheckboxTag({
176
178
  * @param {string | null} args.name - textarea `name` attribute.
177
179
  * @param {string | number | null} args.value - textarea content.
178
180
  * @param {string | null} [args.wrapperClass=null] - optional class to be added to the `.form-group` wrapper.
181
+ * @param {string | null} [args.className=null] - optional class to be added to the textarea element.
179
182
  * @param {boolean} [args.condition=true] - When false, the function returns `null` without building anything.
180
183
  * @param {string | HTMLElement | null} args.help - Optional help text.
181
184
  * @param {(function(HTMLElement): void) | null} args.callback - Optional callback function.
182
- * @param {object | null} [args.attrs={}] - Optional attributes object.
185
+ * @param {Record<string, any> | null} [args.attrs={}] - Optional attributes object.
183
186
  * @returns {DomBuilderItem|null} The `textarea` domBuilder item, or `null` when `condition` is false.
184
187
  */
185
- export function buildTextareaTag({
188
+ export function buildTextarea({
186
189
  label,
187
190
  name,
188
191
  value = null,
189
192
  wrapperClass = null,
193
+ className = null,
190
194
  condition = true,
191
195
  help = null,
192
196
  callback = null,
@@ -203,7 +207,7 @@ export function buildTextareaTag({
203
207
  `label.form-label[for:${id}] ${label}`,
204
208
  {
205
209
  tag: 'textarea',
206
- className: 'form-control',
210
+ className: classnames('form-control', className, attrs?.class),
207
211
  id: id,
208
212
  attrs: {
209
213
  ...(attrs??{}),
@@ -215,3 +219,48 @@ export function buildTextareaTag({
215
219
  ]
216
220
  });
217
221
  }
222
+
223
+ /**
224
+ * Fake field (plain text showed as an input field)
225
+ *
226
+ * @param {Object} args
227
+ * @param {string} args.label - label.
228
+ * @param {string | number | null} args.value - text content.
229
+ * @param {string | null} [args.wrapperClass=null] - optional class to be added to the `.form-group` wrapper.
230
+ * @param {string | null} [args.className=null] - optional class to be added to the fake field.
231
+ * @param {boolean} [args.condition=true] - When false, the function returns `null` without building anything.
232
+ * @param {string | HTMLElement | null} args.help - Optional help text.
233
+ * @param {(function(HTMLElement): void) | null} args.callback - Optional callback function.
234
+ * @param {Record<string, any> | null} [args.attrs={}] - Optional attributes object.
235
+ * @returns {DomBuilderItem|null} The fake field domBuilder item, or `null` when `condition` is false.
236
+ */
237
+ export function fakeField({
238
+ label,
239
+ value = null,
240
+ wrapperClass = null,
241
+ className = null,
242
+ condition = true,
243
+ help = null,
244
+ callback = null,
245
+ attrs = {}
246
+ }) {
247
+
248
+
249
+ return buildFormGroup({
250
+ condition,
251
+ wrapperClass,
252
+ help,
253
+ children: [
254
+ `span.form-label ${label}`,
255
+ {
256
+ className: classnames('form-control-static', className, attrs?.class),
257
+ attrs: {
258
+ ...(attrs??{}),
259
+ name: name,
260
+ },
261
+ content: value,
262
+ callback: callback
263
+ }
264
+ ]
265
+ });
266
+ }