@massimo-cassandro/minimo 1.19.9 → 1.19.11
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/design-tokens/tokens-config-sample.mjs +12 -11
- package/design-tokens/utilities/build-tokens-src/formats/css.mjs +1 -1
- package/index.js +2 -1
- package/package.json +1 -1
- package/src/css/forms/forms.css +3 -1
- package/src/css/layout-base.css +1 -1
- package/src/css/text.css +0 -36
- package/src/custom-properties.css +1 -0
- package/src/minimo.css +1 -1
- package/src/utilities/dom-builder-helpers/README.md +2 -0
- package/src/utilities/dom-builder-helpers/form-tags.js +142 -0
- package/src/utilities/{build-picture-tag.js → dom-builder-helpers/picture-tag.js} +1 -3
|
@@ -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 —
|
|
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
|
|
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
|
|
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
|
|
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/
|
|
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
package/src/css/forms/forms.css
CHANGED
|
@@ -112,7 +112,7 @@ select.form-control {
|
|
|
112
112
|
|
|
113
113
|
input[type='checkbox'] {
|
|
114
114
|
color: var(--form-control-text-color);
|
|
115
|
-
accent-color: var(--accent
|
|
115
|
+
accent-color: var(--accent);
|
|
116
116
|
transform-origin: center;
|
|
117
117
|
scale: 1.3;
|
|
118
118
|
}
|
|
@@ -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/layout-base.css
CHANGED
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
|
}
|
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
|
|
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,142 @@
|
|
|
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=1] - 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 = 1,
|
|
58
|
+
checked = false,
|
|
59
|
+
wrapperClass = null,
|
|
60
|
+
addFormGroup = true,
|
|
61
|
+
condition = true
|
|
62
|
+
}) {
|
|
63
|
+
|
|
64
|
+
if(!condition) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
<div class="form-group">
|
|
70
|
+
<div class="form-check">
|
|
71
|
+
<input type="checkbox" id="..." name="..." class="form-check-input" value="1">
|
|
72
|
+
<label for="..." class="form-label">...</label>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
*/
|
|
76
|
+
const id = randomId();
|
|
77
|
+
|
|
78
|
+
const tag = {
|
|
79
|
+
className: classnames('form-check', !addFormGroup && wrapperClass),
|
|
80
|
+
children: [
|
|
81
|
+
{
|
|
82
|
+
tag: 'input',
|
|
83
|
+
className: 'form-check-input',
|
|
84
|
+
id: id,
|
|
85
|
+
attrs: {
|
|
86
|
+
type: 'checkbox',
|
|
87
|
+
value: value,
|
|
88
|
+
name: name,
|
|
89
|
+
checked: checked
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
`label.form-label[for:${id}] ${label}`,
|
|
93
|
+
]
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
if(addFormGroup) {
|
|
97
|
+
return {
|
|
98
|
+
className: classnames('form-group', wrapperClass),
|
|
99
|
+
children: [ tag ]
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
} else {
|
|
103
|
+
return tag;
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Textarea tag builder
|
|
112
|
+
*
|
|
113
|
+
* @param {Object} args
|
|
114
|
+
* @param {string} args.label - textarea label.
|
|
115
|
+
* @param {string | null} args.name - textarea `name` attribute.
|
|
116
|
+
* @param {string | number | null} args.defaultValue - textarea content.
|
|
117
|
+
* @param {string | null} [args.wrapperClass=null] - optional class to be added to the `.form-group` wrapper.
|
|
118
|
+
* @param {boolean} [args.condition=true] - When false, the function returns `null` without building anything.
|
|
119
|
+
* @returns {DomBuilderItem|null} The `textarea` domBuilder item, or `null` when `condition` is false.
|
|
120
|
+
*/
|
|
121
|
+
export function buildTextareaTag({
|
|
122
|
+
label,
|
|
123
|
+
name,
|
|
124
|
+
defaultValue,
|
|
125
|
+
wrapperClass = null,
|
|
126
|
+
condition = true
|
|
127
|
+
}) {
|
|
128
|
+
|
|
129
|
+
if(!condition) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const id = randomId();
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
className: classnames('form-group', wrapperClass),
|
|
137
|
+
children: [
|
|
138
|
+
`label.form-label[for:${id}] ${label}`,
|
|
139
|
+
`textarea#${id}.form-control[name: ${name}] ${defaultValue}`
|
|
140
|
+
]
|
|
141
|
+
};
|
|
142
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/*! minimo - buildPictureTag */
|
|
2
|
-
import { classnames } from '
|
|
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
|