@jsswift/ui 1.0.44 → 1.0.46

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.
@@ -1,341 +1,246 @@
1
- UI.List = (...args) => {
2
- const { props, children } = JSswift.uiNormalizeArgs(args);
3
- const slots = props.slots || {};
4
- const ordered = !!uiUnwrap(props.number ?? props.ordered);
5
- const marker = uiUnwrap(props.marker);
6
- const itemSource = uiUnwrap(props.items);
7
- const items = Array.isArray(itemSource) ? itemSource : (itemSource == null ? [] : [itemSource]);
8
-
9
- const buildItemProps = (entryProps = {}) => {
10
- const baseProps = props.itemProps || {};
11
- const merged = { ...baseProps, ...entryProps };
12
- if (props.divider != null && merged.divider == null) merged.divider = props.divider;
13
- merged.class = uiClass([baseProps.class, props.itemClass, entryProps.class]);
14
- merged.style = {
15
- ...(baseProps.style || {}),
16
- ...(props.itemStyle || {}),
17
- ...(entryProps.style || {})
18
- };
19
- return merged;
20
- };
21
-
22
- const normalizeResolvedNode = (value) => {
23
- if (value == null || value === false) return [];
24
- if (isListItemNode(value)) return [value];
25
- if (isUIPlainObject(value)) {
26
- const itemChildren = value.children != null
27
- ? asNodeArray(value.children)
28
- : (value.content != null
29
- ? asNodeArray(value.content)
30
- : asNodeArray(value.node));
31
- return [UI.Item(buildItemProps(value), ...itemChildren)];
32
- }
33
- if (Array.isArray(value)) {
34
- return [UI.Item(buildItemProps(), ...value)];
35
- }
36
- if (value?.nodeType) {
37
- return [UI.Item(buildItemProps(), value)];
38
- }
39
- return [UI.Item(buildItemProps(), value)];
40
- };
41
-
42
- const normalizeItemNode = (value, index, total, useItemSlot = true) => {
43
- if (value == null || value === false) return [];
44
- if (useItemSlot) {
45
- const ctx = {
46
- item: value,
47
- index,
48
- count: total,
49
- first: index === 0,
50
- last: index === total - 1
51
- };
52
- const slotted = renderSlotToArray(slots, "item", ctx, null);
53
- if (slotted.length) {
54
- return slotted.flatMap((node) => normalizeResolvedNode(node));
55
- }
56
- }
57
- return normalizeResolvedNode(value);
58
- };
59
-
60
- const content = [];
61
- items.forEach((item, index) => {
62
- content.push(...normalizeItemNode(item, index, items.length));
63
- });
64
-
65
- const defaultNodes = renderSlotToArray(slots, "default", { items, count: items.length }, children);
66
- defaultNodes.forEach((node, index) => {
67
- content.push(...normalizeItemNode(node, items.length + index, items.length + defaultNodes.length, false));
68
- });
69
-
70
- if (!content.length) {
71
- const emptyNodes = renderSlotToArray(slots, "empty", { items, count: 0 }, props.empty);
72
- if (emptyNodes.length) {
73
- if (emptyNodes.length === 1 && isListItemNode(emptyNodes[0])) {
74
- content.push(emptyNodes[0]);
75
- } else {
76
- content.push(UI.Item({ class: "cms-item-empty", flat: true }, ...emptyNodes));
77
- }
78
- }
79
- }
80
-
81
- const cls = uiClass([
82
- "cms-list",
83
- uiWhen(props.dense, "dense"),
84
- uiWhen(props.divider, "divider"),
85
- uiWhen(marker === false || marker === "none", "cms-list-no-marker"),
86
- props.class
87
- ]);
88
- const p = JSswift.omit(props, [
89
- "dense", "divider", "slots", "number", "ordered", "items", "itemClass", "itemStyle", "itemProps",
90
- "empty", "marker", "gap"
91
- ]);
92
- p.class = cls;
93
- p.style = {
94
- ...(props.style || {})
95
- };
96
- const gap = uiStyleValue(props.gap, toCssSize);
97
- if (gap != null) p.style["--cms-list-gap"] = gap;
98
- if (marker != null && marker !== false && marker !== true && marker !== "none") {
99
- p.style.listStyleType = String(marker);
100
- }
101
-
102
- const list = _[ordered ? "ol" : "ul"](p, ...content);
103
- return list;
104
- };
105
- if (JSswift.isDev?.()) {
106
- UI.meta = UI.meta || {};
107
- UI.meta.List = {
108
- signature: "UI.List(...children) | UI.List(props, ...children)",
109
- props: {
110
- items: "Array<Node|Object|string>",
111
- ordered: "boolean",
112
- number: "boolean",
113
- marker: "boolean|string",
114
- dense: "boolean",
115
- divider: "boolean",
116
- gap: "string|number",
117
- empty: "String|Node|Function|Array",
118
- itemClass: "string",
119
- itemStyle: "object",
120
- itemProps: "object",
121
- slots: "{ default?, item?, empty? }",
122
- class: "string",
123
- style: "object"
124
- },
125
- slots: {
126
- default: "List content fallback",
127
- item: "Render custom di ogni item ({ item, index, count, first, last })",
128
- empty: "Empty state content"
129
- },
130
- returns: "HTMLUListElement|HTMLOListElement",
131
- description: "Lista dichiarativa con supporto items, slot item, ordered/marker ed empty state."
132
- };
133
- }
134
- // Esempio: JSswift.ui.List({}, JSswift.ui.Item({}, "Item"))
135
-
136
- UI.Item = (...args) => {
137
- const { props, children } = JSswift.uiNormalizeArgs(args);
138
- if (props.state != null && props.color == null) props.color = props.state;
139
- applyCommonProps(props);
140
- const slots = props.slots || {};
141
- const interactive = uiComputed([props.clickable, props.to], () => !!(uiUnwrap(props.clickable) || uiUnwrap(props.to)));
142
- const active = uiComputed([props.active, props.selected], () => !!(uiUnwrap(props.active) || uiUnwrap(props.selected)));
143
- const hasSurface = !!(
144
- props.color != null || props.outline || props.border || props.glossy || props.glow || props.glass ||
145
- props.shadow || props.gradient || props.textGradient || props.lightShadow || props.radius ||
146
- props.rounded || props.flat
147
- );
148
-
149
- const resolveIcon = (value, size, as) => {
150
- const raw = uiUnwrap(value);
151
- if (raw == null || raw === false || raw === "") return null;
152
- if (typeof raw === "string") return UI.Icon({ name: raw, size: size || "sm" });
153
- return JSswift.ui.slot(raw, { as });
154
- };
155
-
156
- const iconNodes = renderSlotToArray(slots, "icon", {}, resolveIcon(props.icon, props.iconSize || props.size, "icon"));
157
- const titleNodes = renderSlotToArray(slots, "title", {}, props.title ?? props.label);
158
- const subtitleNodes = renderSlotToArray(slots, "subtitle", {}, props.subtitle ?? props.caption ?? props.description);
159
- const metaNodes = renderSlotToArray(slots, "meta", {}, props.meta ?? props.eyebrow);
160
- const bodyNodes = renderSlotToArray(slots, "body", {}, props.body ?? props.content);
161
- const defaultNodes = renderSlotToArray(slots, "default", {}, children);
162
- const actionsNodes = renderSlotToArray(slots, "actions", {}, props.actions ?? props.footer);
163
- const asideFallback = props.aside ?? props.trailing ?? resolveIcon(props.iconRight, props.iconSize || props.size, "iconRight");
164
- const asideNodes = renderSlotToArray(slots, "aside", {}, asideFallback);
165
-
166
- const mergedBodyNodes = [...bodyNodes, ...defaultNodes];
167
- const isInline = !(
168
- hasSurface || props.clickable || props.to || iconNodes.length || titleNodes.length ||
169
- subtitleNodes.length || metaNodes.length || actionsNodes.length || asideNodes.length ||
170
- bodyNodes.length
171
- );
172
-
173
- const cls = uiClass([
174
- "cms-item",
175
- uiWhen(props.divider, "divider"),
176
- uiWhen(hasSurface, "cms-clear-set"),
177
- uiWhen(hasSurface, "cms-singularity"),
178
- uiWhen(hasSurface, "cms-item-surface"),
179
- uiWhen(isInline, "cms-item-inline"),
180
- uiWhen(interactive, "cms-item-clickable"),
181
- uiWhen(active, "is-active"),
182
- uiWhen(props.disabled, "is-disabled"),
183
- props.class
184
- ]);
185
- const p = JSswift.omit(props, [
186
- "divider", "slots", "label", "title", "subtitle", "caption", "description", "meta", "eyebrow",
187
- "body", "content", "children", "node", "icon", "iconRight", "iconSize", "aside", "trailing",
188
- "actions", "footer", "clickable", "to", "active", "selected", "disabled", "state",
189
- "color", "size", "outline", "flat", "border", "glossy", "glow", "glass", "gradient",
190
- "textGradient", "lightShadow", "shadow", "rounded", "radius", "textColor", "dense"
191
- ]);
192
- p.class = cls;
193
- p.style = {
194
- ...(props.style || {})
195
- };
196
-
197
- const userOnClick = props.onClick;
198
- const userOnKeydown = props.onKeydown;
199
- const onClick = (e) => {
200
- userOnClick?.(e);
201
- if (e.defaultPrevented || uiUnwrap(props.disabled)) return;
202
- const to = uiUnwrap(props.to);
203
- if (to && JSswift.router?.navigate) {
204
- e.preventDefault();
205
- JSswift.router.navigate(to);
206
- }
207
- };
208
- const onKeydown = (e) => {
209
- userOnKeydown?.(e);
210
- if (e.defaultPrevented || uiUnwrap(props.disabled)) return;
211
- if (e.key === "Enter" || e.key === " ") {
212
- e.preventDefault();
213
- onClick(e);
214
- }
215
- };
216
- if (uiUnwrap(props.disabled)) {
217
- p["aria-disabled"] = "true";
218
- }
219
- if (uiUnwrap(props.clickable) || uiUnwrap(props.to)) {
220
- p.onClick = onClick;
221
- p.onKeydown = onKeydown;
222
- if (p.tabIndex == null) p.tabIndex = uiUnwrap(props.disabled) ? -1 : 0;
223
- if (p.role == null) p.role = "button";
224
- }
225
-
226
- const titleSection = titleNodes.length ? _.div({ class: "cms-item-title" }, ...titleNodes) : null;
227
- const subtitleSection = subtitleNodes.length ? _.div({ class: "cms-item-subtitle" }, ...subtitleNodes) : null;
228
- const metaSection = metaNodes.length ? _.div({ class: "cms-item-meta" }, ...metaNodes) : null;
229
- const bodySection = mergedBodyNodes.length
230
- ? _.div({ class: uiClass(["cms-item-body", uiWhen(!(titleNodes.length || subtitleNodes.length || metaNodes.length), "is-standalone")]) }, ...mergedBodyNodes)
231
- : null;
232
- const actionsSection = actionsNodes.length ? _.div({ class: "cms-item-actions" }, ...actionsNodes) : null;
233
-
234
- const item = _.li(
235
- p,
236
- _.div(
237
- { class: "cms-item-row" },
238
- iconNodes.length ? _.div({ class: "cms-item-icon" }, ...iconNodes) : null,
239
- _.div(
240
- { class: "cms-item-main" },
241
- metaSection,
242
- titleSection,
243
- subtitleSection,
244
- bodySection,
245
- actionsSection
246
- ),
247
- asideNodes.length ? _.div({ class: "cms-item-aside" }, ...asideNodes) : null
248
- )
249
- );
250
- setPropertyProps(item, props);
251
- return item;
252
- };
253
- if (JSswift.isDev?.()) {
254
- UI.meta = UI.meta || {};
255
- UI.meta.Item = {
256
- signature: "UI.Item(...children) | UI.Item(props, ...children)",
257
- props: {
258
- label: "String|Node|Function|Array",
259
- title: "String|Node|Function|Array",
260
- subtitle: "String|Node|Function|Array",
261
- meta: "String|Node|Function|Array",
262
- body: "String|Node|Function|Array",
263
- icon: "String|Node|Function|Array",
264
- iconRight: "String|Node|Function|Array",
265
- aside: "Node|Function|Array",
266
- actions: "Node|Function|Array",
267
- clickable: "boolean",
268
- to: "string",
269
- active: "boolean",
270
- selected: "boolean",
271
- disabled: "boolean",
272
- color: "string",
273
- state: "Alias of color",
274
- size: "string|number",
275
- outline: "boolean",
276
- shadow: "boolean|string",
277
- lightShadow: "boolean",
278
- border: "boolean",
279
- glossy: "boolean",
280
- glow: "boolean",
281
- glass: "boolean",
282
- gradient: "boolean|number",
283
- textGradient: "boolean",
284
- radius: "string|number",
285
- divider: "boolean",
286
- slots: "{ icon?, title?, subtitle?, meta?, body?, aside?, actions?, default? }",
287
- class: "string",
288
- style: "object"
289
- },
290
- slots: {
291
- icon: "Leading visual/icon",
292
- title: "Main title content",
293
- subtitle: "Secondary text",
294
- meta: "Top meta content",
295
- body: "Body content",
296
- aside: "Trailing content",
297
- actions: "Actions row",
298
- default: "Fallback body content"
299
- },
300
- returns: "HTMLLIElement",
301
- description: "Structured item for simple lists, feeds, task lists, and clickable rows."
302
- };
303
- }
304
- // Esempio: JSswift.ui.Item({}, "Elemento")
305
-
306
- UI.Separator = (...args) => {
307
- const { props } = JSswift.uiNormalizeArgs(args);
308
- const cls = uiClass(["cms-separator", uiWhen(props.vertical, "vertical"), props.class]);
309
- const p = JSswift.omit(props, ["vertical", "size", "slots"]);
310
- p.class = cls;
311
- const style = { borderColor: "var(--cms-border)", ...(props.style || {}) };
312
- const sizeValue = uiUnwrap(props.size);
313
- const vertical = uiUnwrap(props.vertical);
314
- if (sizeValue != null) {
315
- const size = toCssSize(sizeValue);
316
- if (vertical) style.width = size;
317
- else style.height = size;
318
- }
319
- p.style = style;
320
- return _.hr(p);
321
- };
322
- if (JSswift.isDev?.()) {
323
- UI.meta = UI.meta || {};
324
- UI.meta.Separator = {
325
- signature: "UI.Separator() | UI.Separator(props)",
326
- props: {
327
- vertical: "boolean",
328
- size: "string|number",
329
- slots: "{ default? }",
330
- class: "string",
331
- style: "object"
332
- },
333
- slots: {
334
- default: "Unused (separator has no content)"
335
- },
336
- returns: "HTMLHRElement",
337
- description: "Separatore orizzontale o verticale."
338
- };
339
- }
340
- // Esempio: JSswift.ui.Separator()
341
-
1
+ UI.List = (...args) => {
2
+ const { props, children } = JSswift.uiNormalizeArgs(args);
3
+ const slots = props.slots || {};
4
+ const ordered = !!uiUnwrap(props.number ?? props.ordered);
5
+ const marker = uiUnwrap(props.marker);
6
+ const itemSource = uiUnwrap(props.items);
7
+ const items = Array.isArray(itemSource) ? itemSource : (itemSource == null ? [] : [itemSource]);
8
+
9
+ const buildItemProps = (entryProps = {}) => {
10
+ const baseProps = props.itemProps || {};
11
+ const merged = { ...baseProps, ...entryProps };
12
+ if (props.divider != null && merged.divider == null) merged.divider = props.divider;
13
+ merged.class = uiClass([baseProps.class, props.itemClass, entryProps.class]);
14
+ merged.style = {
15
+ ...(baseProps.style || {}),
16
+ ...(props.itemStyle || {}),
17
+ ...(entryProps.style || {})
18
+ };
19
+ return merged;
20
+ };
21
+
22
+ const normalizeResolvedNode = (value) => {
23
+ if (value == null || value === false) return [];
24
+ if (isListItemNode(value)) return [value];
25
+ if (isUIPlainObject(value)) {
26
+ const itemChildren = value.children != null
27
+ ? asNodeArray(value.children)
28
+ : (value.content != null
29
+ ? asNodeArray(value.content)
30
+ : asNodeArray(value.node));
31
+ return [UI.Item(buildItemProps(value), ...itemChildren)];
32
+ }
33
+ if (Array.isArray(value)) {
34
+ return [UI.Item(buildItemProps(), ...value)];
35
+ }
36
+ if (value?.nodeType) {
37
+ return [UI.Item(buildItemProps(), value)];
38
+ }
39
+ return [UI.Item(buildItemProps(), value)];
40
+ };
41
+
42
+ const normalizeItemNode = (value, index, total, useItemSlot = true) => {
43
+ if (value == null || value === false) return [];
44
+ if (useItemSlot) {
45
+ const ctx = {
46
+ item: value,
47
+ index,
48
+ count: total,
49
+ first: index === 0,
50
+ last: index === total - 1
51
+ };
52
+ const slotted = renderSlotToArray(slots, "item", ctx, null);
53
+ if (slotted.length) {
54
+ return slotted.flatMap((node) => normalizeResolvedNode(node));
55
+ }
56
+ }
57
+ return normalizeResolvedNode(value);
58
+ };
59
+
60
+ const content = [];
61
+ items.forEach((item, index) => {
62
+ content.push(...normalizeItemNode(item, index, items.length));
63
+ });
64
+
65
+ const defaultNodes = renderSlotToArray(slots, "default", { items, count: items.length }, children);
66
+ defaultNodes.forEach((node, index) => {
67
+ content.push(...normalizeItemNode(node, items.length + index, items.length + defaultNodes.length, false));
68
+ });
69
+
70
+ if (!content.length) {
71
+ const emptyNodes = renderSlotToArray(slots, "empty", { items, count: 0 }, props.empty);
72
+ if (emptyNodes.length) {
73
+ if (emptyNodes.length === 1 && isListItemNode(emptyNodes[0])) {
74
+ content.push(emptyNodes[0]);
75
+ } else {
76
+ content.push(UI.Item({ class: "cms-item-empty", flat: true }, ...emptyNodes));
77
+ }
78
+ }
79
+ }
80
+
81
+ const cls = uiClass([
82
+ "cms-list",
83
+ uiWhen(props.dense, "dense"),
84
+ uiWhen(props.divider, "divider"),
85
+ uiWhen(marker === false || marker === "none", "cms-list-no-marker"),
86
+ props.class
87
+ ]);
88
+ const p = JSswift.omit(props, [
89
+ "dense", "divider", "slots", "number", "ordered", "items", "itemClass", "itemStyle", "itemProps",
90
+ "empty", "marker", "gap"
91
+ ]);
92
+ p.class = cls;
93
+ p.style = {
94
+ ...(props.style || {})
95
+ };
96
+ const gap = uiStyleValue(props.gap, toCssSize);
97
+ if (gap != null) p.style["--cms-list-gap"] = gap;
98
+ if (marker != null && marker !== false && marker !== true && marker !== "none") {
99
+ p.style.listStyleType = String(marker);
100
+ }
101
+
102
+ const list = _[ordered ? "ol" : "ul"](p, ...content);
103
+ return list;
104
+ };
105
+
106
+ // Esempio: JSswift.ui.List({}, JSswift.ui.Item({}, "Item"))
107
+
108
+ UI.Item = (...args) => {
109
+ const { props, children } = JSswift.uiNormalizeArgs(args);
110
+ if (props.state != null && props.color == null) props.color = props.state;
111
+ applyCommonProps(props);
112
+ const slots = props.slots || {};
113
+ const interactive = uiComputed([props.clickable, props.to], () => !!(uiUnwrap(props.clickable) || uiUnwrap(props.to)));
114
+ const active = uiComputed([props.active, props.selected], () => !!(uiUnwrap(props.active) || uiUnwrap(props.selected)));
115
+ const hasSurface = !!(
116
+ props.color != null || props.outline || props.border || props.glossy || props.glow || props.glass ||
117
+ props.shadow || props.gradient || props.textGradient || props.lightShadow || props.radius ||
118
+ props.rounded || props.flat
119
+ );
120
+
121
+ const resolveIcon = (value, size, as) => {
122
+ const raw = uiUnwrap(value);
123
+ if (raw == null || raw === false || raw === "") return null;
124
+ if (typeof raw === "string") return UI.Icon({ name: raw, size: size || "sm" });
125
+ return JSswift.ui.slot(raw, { as });
126
+ };
127
+
128
+ const iconNodes = renderSlotToArray(slots, "icon", {}, resolveIcon(props.icon, props.iconSize || props.size, "icon"));
129
+ const titleNodes = renderSlotToArray(slots, "title", {}, props.title ?? props.label);
130
+ const subtitleNodes = renderSlotToArray(slots, "subtitle", {}, props.subtitle ?? props.caption ?? props.description);
131
+ const metaNodes = renderSlotToArray(slots, "meta", {}, props.meta ?? props.eyebrow);
132
+ const bodyNodes = renderSlotToArray(slots, "body", {}, props.body ?? props.content);
133
+ const defaultNodes = renderSlotToArray(slots, "default", {}, children);
134
+ const actionsNodes = renderSlotToArray(slots, "actions", {}, props.actions ?? props.footer);
135
+ const asideFallback = props.aside ?? props.trailing ?? resolveIcon(props.iconRight, props.iconSize || props.size, "iconRight");
136
+ const asideNodes = renderSlotToArray(slots, "aside", {}, asideFallback);
137
+
138
+ const mergedBodyNodes = [...bodyNodes, ...defaultNodes];
139
+ const isInline = !(
140
+ hasSurface || props.clickable || props.to || iconNodes.length || titleNodes.length ||
141
+ subtitleNodes.length || metaNodes.length || actionsNodes.length || asideNodes.length ||
142
+ bodyNodes.length
143
+ );
144
+
145
+ const cls = uiClass([
146
+ "cms-item",
147
+ uiWhen(props.divider, "divider"),
148
+ uiWhen(hasSurface, "cms-clear-set"),
149
+ uiWhen(hasSurface, "cms-singularity"),
150
+ uiWhen(hasSurface, "cms-item-surface"),
151
+ uiWhen(isInline, "cms-item-inline"),
152
+ uiWhen(interactive, "cms-item-clickable"),
153
+ uiWhen(active, "is-active"),
154
+ uiWhen(props.disabled, "is-disabled"),
155
+ props.class
156
+ ]);
157
+ const p = JSswift.omit(props, [
158
+ "divider", "slots", "label", "title", "subtitle", "caption", "description", "meta", "eyebrow",
159
+ "body", "content", "children", "node", "icon", "iconRight", "iconSize", "aside", "trailing",
160
+ "actions", "footer", "clickable", "to", "active", "selected", "disabled", "state",
161
+ "color", "size", "outline", "flat", "border", "glossy", "glow", "glass", "gradient",
162
+ "textGradient", "lightShadow", "shadow", "rounded", "radius", "textColor", "dense"
163
+ ]);
164
+ p.class = cls;
165
+ p.style = {
166
+ ...(props.style || {})
167
+ };
168
+
169
+ const userOnClick = props.onClick;
170
+ const userOnKeydown = props.onKeydown;
171
+ const onClick = (e) => {
172
+ userOnClick?.(e);
173
+ if (e.defaultPrevented || uiUnwrap(props.disabled)) return;
174
+ const to = uiUnwrap(props.to);
175
+ if (to && JSswift.router?.navigate) {
176
+ e.preventDefault();
177
+ JSswift.router.navigate(to);
178
+ }
179
+ };
180
+ const onKeydown = (e) => {
181
+ userOnKeydown?.(e);
182
+ if (e.defaultPrevented || uiUnwrap(props.disabled)) return;
183
+ if (e.key === "Enter" || e.key === " ") {
184
+ e.preventDefault();
185
+ onClick(e);
186
+ }
187
+ };
188
+ if (uiUnwrap(props.disabled)) {
189
+ p["aria-disabled"] = "true";
190
+ }
191
+ if (uiUnwrap(props.clickable) || uiUnwrap(props.to)) {
192
+ p.onClick = onClick;
193
+ p.onKeydown = onKeydown;
194
+ if (p.tabIndex == null) p.tabIndex = uiUnwrap(props.disabled) ? -1 : 0;
195
+ if (p.role == null) p.role = "button";
196
+ }
197
+
198
+ const titleSection = titleNodes.length ? _.div({ class: "cms-item-title" }, ...titleNodes) : null;
199
+ const subtitleSection = subtitleNodes.length ? _.div({ class: "cms-item-subtitle" }, ...subtitleNodes) : null;
200
+ const metaSection = metaNodes.length ? _.div({ class: "cms-item-meta" }, ...metaNodes) : null;
201
+ const bodySection = mergedBodyNodes.length
202
+ ? _.div({ class: uiClass(["cms-item-body", uiWhen(!(titleNodes.length || subtitleNodes.length || metaNodes.length), "is-standalone")]) }, ...mergedBodyNodes)
203
+ : null;
204
+ const actionsSection = actionsNodes.length ? _.div({ class: "cms-item-actions" }, ...actionsNodes) : null;
205
+
206
+ const item = _.li(
207
+ p,
208
+ _.div(
209
+ { class: "cms-item-row" },
210
+ iconNodes.length ? _.div({ class: "cms-item-icon" }, ...iconNodes) : null,
211
+ _.div(
212
+ { class: "cms-item-main" },
213
+ metaSection,
214
+ titleSection,
215
+ subtitleSection,
216
+ bodySection,
217
+ actionsSection
218
+ ),
219
+ asideNodes.length ? _.div({ class: "cms-item-aside" }, ...asideNodes) : null
220
+ )
221
+ );
222
+ setPropertyProps(item, props);
223
+ return item;
224
+ };
225
+
226
+ // Esempio: JSswift.ui.Item({}, "Elemento")
227
+
228
+ UI.Separator = (...args) => {
229
+ const { props } = JSswift.uiNormalizeArgs(args);
230
+ const cls = uiClass(["cms-separator", uiWhen(props.vertical, "vertical"), props.class]);
231
+ const p = JSswift.omit(props, ["vertical", "size", "slots"]);
232
+ p.class = cls;
233
+ const style = { borderColor: "var(--cms-border)", ...(props.style || {}) };
234
+ const sizeValue = uiUnwrap(props.size);
235
+ const vertical = uiUnwrap(props.vertical);
236
+ if (sizeValue != null) {
237
+ const size = toCssSize(sizeValue);
238
+ if (vertical) style.width = size;
239
+ else style.height = size;
240
+ }
241
+ p.style = style;
242
+ return _.hr(p);
243
+ };
244
+
245
+ // Esempio: JSswift.ui.Separator()
246
+