@massimo-cassandro/minimo 1.24.7 → 1.24.9
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/package.json
CHANGED
package/src/minimo.css
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
@import '@minimo/css/grid.css';
|
|
38
38
|
@import '@minimo/css/details.css';
|
|
39
39
|
|
|
40
|
-
@import '@minimo/css/
|
|
40
|
+
@import '@minimo/css/sizes.css';
|
|
41
41
|
@import '@minimo/css/display.css';
|
|
42
42
|
@import '@minimo/css/margin-padding.css';
|
|
43
43
|
/* @import '@minimo/css/margin-padding-media.css'; responsive version */
|
|
@@ -100,6 +100,7 @@ import { parseDomString } from './parseDomString.js';
|
|
|
100
100
|
* @param {Object} [options={}] - Configuration options.
|
|
101
101
|
* @param {boolean} [options.emptyParent=false] - When true, the parent element is emptied before building.
|
|
102
102
|
* @param {'append'|'before'|'after'} [options.insertMode='append'] - How each root element of `structureArray` is attached to `parent`: `append` inserts it as a child (default), `before`/`after` insert it as a previous/next sibling of `parent`, preserving `structureArray` order. Only applies to the elements produced by this call — nested `domBuilder` calls (`content`, `children`) always append.
|
|
103
|
+
* @param {boolean} [options.debug=false] - When true, logs `structureArray` to the console after each string item has been parsed via `parseDomString` (i.e. the elaborated array actually used to build the DOM).
|
|
103
104
|
* @returns {HTMLElement|null} The first created element, or null if nothing was created.
|
|
104
105
|
*/
|
|
105
106
|
|
|
@@ -109,6 +110,7 @@ export function domBuilder(structureArray = [], parent, options = {}) {
|
|
|
109
110
|
options = {
|
|
110
111
|
emptyParent: false,
|
|
111
112
|
insertMode: 'append',
|
|
113
|
+
debug: false,
|
|
112
114
|
...options
|
|
113
115
|
};
|
|
114
116
|
|
|
@@ -136,6 +138,9 @@ export function domBuilder(structureArray = [], parent, options = {}) {
|
|
|
136
138
|
/** @type {HTMLElement | DocumentFragment | null} */
|
|
137
139
|
let grand_parent = null;
|
|
138
140
|
|
|
141
|
+
/** @type {Array<DomBuilderItem|null>} */
|
|
142
|
+
const elaboratedStructureArray = [];
|
|
143
|
+
|
|
139
144
|
structureArray.forEach(inputItem => {
|
|
140
145
|
|
|
141
146
|
/** @type {DomBuilderItem | null} */
|
|
@@ -146,7 +151,7 @@ export function domBuilder(structureArray = [], parent, options = {}) {
|
|
|
146
151
|
item = /** @type {DomBuilderItem} */ (inputItem);
|
|
147
152
|
}
|
|
148
153
|
|
|
149
|
-
|
|
154
|
+
elaboratedStructureArray.push(item);
|
|
150
155
|
|
|
151
156
|
if (item != null && (item.condition ?? true)) {
|
|
152
157
|
|
|
@@ -300,6 +305,11 @@ export function domBuilder(structureArray = [], parent, options = {}) {
|
|
|
300
305
|
|
|
301
306
|
});
|
|
302
307
|
|
|
308
|
+
if (options.debug) {
|
|
309
|
+
// eslint-disable-next-line no-console
|
|
310
|
+
console.log('[domBuilder] structureArray:', elaboratedStructureArray);
|
|
311
|
+
}
|
|
312
|
+
|
|
303
313
|
if (useFragment && parent && target) {
|
|
304
314
|
parent.appendChild(target);
|
|
305
315
|
}
|