juxscript 1.0.32 → 1.0.34

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.
@@ -19,7 +19,7 @@ export interface ListItem {
19
19
  }
20
20
 
21
21
  export interface ListOptions {
22
- items?: ListItem[];
22
+ items?: (ListItem | string)[]; // ✅ Allow string or ListItem
23
23
  header?: string;
24
24
  gap?: string;
25
25
  direction?: 'vertical' | 'horizontal';
@@ -62,8 +62,13 @@ export class List extends BaseComponent<ListState> {
62
62
  private _listElement: HTMLElement | null = null;
63
63
 
64
64
  constructor(id: string, options: ListOptions = {}) {
65
+ // ✅ Normalize items - convert strings to ListItem objects
66
+ const normalizedItems = (options.items ?? []).map(item =>
67
+ typeof item === 'string' ? { title: item } : item
68
+ );
69
+
65
70
  super(id, {
66
- items: options.items ?? [],
71
+ items: normalizedItems,
67
72
  header: options.header ?? '',
68
73
  gap: options.gap ?? '0.5rem',
69
74
  direction: options.direction ?? 'vertical',
@@ -98,14 +103,19 @@ export class List extends BaseComponent<ListState> {
98
103
 
99
104
  // ✅ Inherited from BaseComponent
100
105
 
101
- items(value: ListItem[]): this {
102
- this.state.items = value;
106
+ items(value: (ListItem | string)[]): this {
107
+ // ✅ Normalize items when setting via fluent API
108
+ this.state.items = value.map(item =>
109
+ typeof item === 'string' ? { title: item } : item
110
+ );
103
111
  this._updateList();
104
112
  return this;
105
113
  }
106
114
 
107
- addItem(value: ListItem): this {
108
- this.state.items = [...this.state.items, value];
115
+ addItem(value: ListItem | string): this {
116
+ // Normalize single item
117
+ const normalizedItem = typeof value === 'string' ? { title: value } : value;
118
+ this.state.items = [...this.state.items, normalizedItem];
109
119
  this._updateList();
110
120
  return this;
111
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "lib/jux.js",
@@ -1,7 +1,8 @@
1
1
  import { jux } from 'juxscript';
2
2
 
3
3
  // Import the layout styles
4
- jux.include('layout.css');
4
+ jux.include('../presets/default/layout.css');
5
+
5
6
 
6
7
  // ═══════════════════════════════════════════════════════════════════
7
8
  // GRID LAYOUT - INITIALIZATION FUNCTION