@massimo-cassandro/minimo 1.19.9 → 1.19.10

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.
@@ -30,7 +30,7 @@ const config = {
30
30
  // Output filename for the generated CSS file
31
31
  destFile: 'custom-properties.css',
32
32
 
33
- // Source token files — accepts paths, globs, or a mix of both.
33
+ // Source token files — accept paths, globs, or a mix of both.
34
34
  // Supported formats: .json, .jsonc, .mjs (must export a DTCG-compliant default object)
35
35
  //
36
36
  // WARNING: do not use path.join() to build glob patterns — it may corrupt
@@ -55,6 +55,7 @@ const config = {
55
55
  // generated) are kept too. Useful to preserve manual overrides/additions
56
56
  // made directly in the compiled CSS across rebuilds. Ignored on the first
57
57
  // build, when destFile does not exist yet. Default: false.
58
+ // Comments at the end of custom properties are preserved, while full-line ones will be lost.
58
59
  mergeCustomProps: false,
59
60
 
60
61
  // Properties whose names begin with one of the following strings are grouped
@@ -70,6 +71,13 @@ const config = {
70
71
  // in Penpot or Figma projects or as an alternative to the .mjs source files
71
72
  // ---------------------------------------------------------------------------
72
73
 
74
+ // How to handle math expressions in dimension token $values (e.g. "{size.base} * .25"):
75
+ // 'keep' write the expression unchanged
76
+ // 'calc' — wrap in CSS calc(): "calc({size.base} * .25)"
77
+ // 'resolve' — (default) evaluate numerically, inheriting the unit from the first referenced token
78
+ // e.g. {size.base} = 16px, "{size.base} * .25" -> "4px"
79
+ penpotExpressions: 'resolve',
80
+
73
81
  // Output format for Penpot token files: 'jsonc' or 'json'
74
82
  // 'jsonc' -> adds a generated-file disclaimer header, uses .jsonc extension
75
83
  // 'json' -> plain JSON, no disclaimer
@@ -77,23 +85,16 @@ const config = {
77
85
 
78
86
  // Output directory for the Penpot design token files.
79
87
  // Set to null (or omit) to disable json output entirely.
80
- penpotBuildPath: null || './path/to/generated/design-tokens-dir',
88
+ penpotBuildPath: null, // or './path/to/generated/design-tokens-dir',
81
89
 
82
90
  // Base name (without extension) for the aggregated Penpot output file.
83
91
  // The extension is added automatically based on penpotFormat.
84
92
  // Set to null (or omit) to generate one file per .mjs source file instead.
85
- penpotDestFile: null || 'tokens',
86
-
87
- // How to handle math expressions in dimension token $values (e.g. "{size.base} * .25"):
88
- // 'keep' write the expression unchanged
89
- // 'calc' — wrap in CSS calc(): "calc({size.base} * .25)"
90
- // 'resolve' — (default) evaluate numerically, inheriting the unit from the first referenced token
91
- // e.g. {size.base} = 16px, "{size.base} * .25" -> "4px"
92
- penpotExpressions: 'resolve',
93
+ penpotDestFile: null, // or 'tokens' (or else),
93
94
 
94
95
 
95
96
  // ---------------------------------------------------------------------------
96
- // CHECK-UNRESOLVED-CUSTOM-PROPS.MJS SETTINGS
97
+ // CHECK-UNRESOLVED-CUSTOM-PROPS SETTINGS
97
98
  // ---------------------------------------------------------------------------
98
99
 
99
100
  // If true, also reports custom properties that are defined (in destFile or
@@ -283,7 +283,7 @@ StyleDictionary.registerFormat({
283
283
  }
284
284
  appendBlock(colorProps);
285
285
  if (colorProps.length && restProps.length) {
286
- outLines.push('', '');
286
+ outLines.push('', ' /* ---------------------- */', '');
287
287
  prevPrefix = null;
288
288
  }
289
289
  appendBlock(restProps);
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // utilities
2
2
  export { betterText } from './src/utilities/better-text.js';
3
- export { buildPictureTag } from './src/utilities/build-picture-tag.js';
3
+ export { buildPictureTag } from './src/utilities/dom-builder-helpers/picture-tag.js';
4
+ export { buildInputTag, buildCheckboxTag, buildTextareaTag } from './src/utilities/dom-builder-helpers/form-tags.js';
4
5
  export { classnames, classnamesNull } from './src/utilities/classnames.js';
5
6
  export { createId } from './src/utilities/create-id.js';
6
7
  export { disableBtnsOnSubmit } from './src/utilities/disable-btns-on-submit.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.19.9",
3
+ "version": "1.19.10",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -120,6 +120,8 @@ input[type='checkbox'] {
120
120
  /* da bs5 */
121
121
  /* versione con label a destra */
122
122
  /* TODO rivedere. sostituire float con flex? */
123
+ /* TODO eliminare necessità di stare dentro un `.form-group` */
124
+ /* TODO aggiungere esempi di uso */
123
125
  .form-check {
124
126
  display: block;
125
127
  padding-left: 1.5em;
package/src/css/text.css CHANGED
@@ -3,42 +3,6 @@ p {
3
3
  margin: 0 0 var(--size-sm);
4
4
  }
5
5
 
6
- a:link, .btn-link {
7
- /* TODO rivedere, forse più complicato del necessario */
8
- &:not(.btn) {
9
- font-weight: var(--font-weight-semibold);
10
- color: var(--link-color);
11
- text-decoration: none;
12
- }
13
- }
14
-
15
- a {
16
- &:visited {
17
- color: var(--link-visited-color);
18
- }
19
- }
20
-
21
- a, .btn-link {
22
- &:focus {
23
- outline: none;
24
- }
25
-
26
- &:focus-visible {
27
- outline: 1px solid color-mix(in srgb, var(--link-color) 60%, transparent);
28
- outline-offset: 2px;
29
- }
30
- &:hover {
31
- text-decoration: underline;
32
- text-underline-offset: 2px;
33
- }
34
- &:active {
35
- color: var(--body-background-color);
36
- outline: 2px solid var(--link-color);
37
- background-color: var(--link-color);
38
- offset: 0;
39
- }
40
- }
41
-
42
6
  strong, b {
43
7
  font-weight: 700;
44
8
  }
@@ -12,6 +12,7 @@
12
12
  --neutral-100: #666;
13
13
  --neutral-100-fg: #fff;
14
14
 
15
+ /* ---------------------- */
15
16
 
16
17
  --alert-border-radius: var(--radius-sm);
17
18
  --alert-box-shadow: 0 0 .5rem 0 oklch(0% 0 0 / .5);
package/src/minimo.css CHANGED
@@ -37,7 +37,7 @@
37
37
  @import '@minimo/css/dimensions.css';
38
38
  @import '@minimo/css/display.css';
39
39
  @import '@minimo/css/margin-padding.css';
40
- /* @import '@minimo/css/margin-padding-media.css'; responsive verion */
40
+ /* @import '@minimo/css/margin-padding-media.css'; responsive version */
41
41
  /* alternative boostrap naming
42
42
  @import '@minimo/css/margin-padding-bootstrap.css';
43
43
  @import '@minimo/css/margin-padding-bootsrap-media.css';
@@ -0,0 +1,2 @@
1
+ collection of helpers to build basic tags.
2
+ All functions return a domBuilder array/object
@@ -0,0 +1,134 @@
1
+ import { classnames } from '../classnames.js';
2
+ import { randomId } from '../random-id.js';
3
+
4
+ /**
5
+ * Input tag builder
6
+ *
7
+ * @param {Object} args
8
+ * @param {string} args.label - input label.
9
+ * @param {string | null} args.name - input `name` attribute.
10
+ * @param {string | number | null} args.defaultValue - input `value` attribute.
11
+ * @param {string | null} [args.type='text'] - input `type` attribute.
12
+ * @param {string | null} [args.wrapperClass=null] - optional class to be added to the `.form-group` wrapper.
13
+ * @param {boolean} [args.condition=true] - When false, the function returns `null` without building anything.
14
+ * @returns {DomBuilderItem|null} The `input` domBuilder item, or `null` when `condition` is false.
15
+ */
16
+ export function buildInputTag({
17
+ label,
18
+ name,
19
+ defaultValue,
20
+ type = 'text',
21
+ wrapperClass = null,
22
+ condition = true
23
+ }){
24
+
25
+ if(!condition) {
26
+ return null;
27
+ }
28
+
29
+ const id = randomId();
30
+
31
+ return {
32
+ className: classnames('form-group', wrapperClass),
33
+ children: [
34
+ `label.form-label[for:${id}] ${label}`,
35
+ `input#${id}.form-control[type: ${type}, name: ${name}, value: ${defaultValue}]`
36
+ ]
37
+ };
38
+ }
39
+
40
+
41
+ /**
42
+ * Checkbox tag builder
43
+ *
44
+ * @param {Object} args
45
+ * @param {string} args.label - checkbox label.
46
+ * @param {string | null} args.name - checkbox `name` attribute.
47
+ * @param {string | number | null} args.value - checkbox `value` attribute.
48
+ * @param {boolean} [args.checked=false] - checkbox `checked` attribute.
49
+ * @param {string | null} [args.wrapperClass=null] - optional class to be added to the `.form-group` wrapper (used only when `addFormGroup` is true).
50
+ * @param {boolean} [args.addFormGroup=true] - When true, wraps the checkbox in a `.form-group` element.
51
+ * @param {boolean} [args.condition=true] - When false, the function returns `null` without building anything.
52
+ * @returns {DomBuilderItem|null} The `.form-check` (or `.form-group`-wrapped) domBuilder item, or `null` when `condition` is false.
53
+ */
54
+ export function buildCheckboxTag({
55
+ label,
56
+ name,
57
+ value,
58
+ checked = false,
59
+ wrapperClass = null,
60
+ addFormGroup = true,
61
+ condition = true
62
+ }) {
63
+
64
+ if(!condition) {
65
+ return null;
66
+ }
67
+
68
+ const id = randomId();
69
+
70
+ const tag = {
71
+ className: classnames('form-check', !addFormGroup && wrapperClass),
72
+ children: [
73
+ `label.form-label[for:${id}] ${label}`,
74
+ {
75
+ tag: 'input',
76
+ className: 'form-control',
77
+ id: id,
78
+ attrs: {
79
+ type: 'checkbox',
80
+ value: value,
81
+ name: name,
82
+ checked: checked
83
+ }
84
+ }
85
+ ]
86
+ };
87
+
88
+ if(addFormGroup) {
89
+ return {
90
+ className: classnames('form-group', wrapperClass),
91
+ children: [ tag ]
92
+ };
93
+
94
+ } else {
95
+ return tag;
96
+
97
+ }
98
+
99
+ }
100
+
101
+
102
+ /**
103
+ * Textarea tag builder
104
+ *
105
+ * @param {Object} args
106
+ * @param {string} args.label - textarea label.
107
+ * @param {string | null} args.name - textarea `name` attribute.
108
+ * @param {string | number | null} args.defaultValue - textarea content.
109
+ * @param {string | null} [args.wrapperClass=null] - optional class to be added to the `.form-group` wrapper.
110
+ * @param {boolean} [args.condition=true] - When false, the function returns `null` without building anything.
111
+ * @returns {DomBuilderItem|null} The `textarea` domBuilder item, or `null` when `condition` is false.
112
+ */
113
+ export function buildTextareaTag({
114
+ label,
115
+ name,
116
+ defaultValue,
117
+ wrapperClass = null,
118
+ condition = true
119
+ }) {
120
+
121
+ if(!condition) {
122
+ return null;
123
+ }
124
+
125
+ const id = randomId();
126
+
127
+ return {
128
+ className: classnames('form-group', wrapperClass),
129
+ children: [
130
+ `label.form-label[for:${id}] ${label}`,
131
+ `textarea#${id}.form-control[name: ${name}] ${defaultValue}`
132
+ ]
133
+ };
134
+ }
@@ -1,7 +1,5 @@
1
1
  /*! minimo - buildPictureTag */
2
- import { classnames } from './classnames.js';
3
-
4
- /** @typedef {import('./dom-builder/dom-builder.js').DomBuilderItem} DomBuilderItem */
2
+ import { classnames } from '../classnames.js';
5
3
 
6
4
  /**
7
5
  * @typedef {Object} PictureSizeEntry