juxscript 1.1.3 → 1.1.4

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.
Files changed (63) hide show
  1. package/machinery/build3.js +7 -91
  2. package/machinery/compiler3.js +3 -209
  3. package/package.json +19 -5
  4. package/lib/components/alert.ts +0 -200
  5. package/lib/components/app.ts +0 -247
  6. package/lib/components/badge.ts +0 -101
  7. package/lib/components/base/BaseComponent.ts +0 -421
  8. package/lib/components/base/FormInput.ts +0 -227
  9. package/lib/components/button.ts +0 -178
  10. package/lib/components/card.ts +0 -173
  11. package/lib/components/chart.ts +0 -231
  12. package/lib/components/checkbox.ts +0 -242
  13. package/lib/components/code.ts +0 -123
  14. package/lib/components/container.ts +0 -140
  15. package/lib/components/data.ts +0 -135
  16. package/lib/components/datepicker.ts +0 -234
  17. package/lib/components/dialog.ts +0 -172
  18. package/lib/components/divider.ts +0 -100
  19. package/lib/components/dropdown.ts +0 -186
  20. package/lib/components/element.ts +0 -267
  21. package/lib/components/fileupload.ts +0 -309
  22. package/lib/components/grid.ts +0 -291
  23. package/lib/components/guard.ts +0 -92
  24. package/lib/components/heading.ts +0 -96
  25. package/lib/components/helpers.ts +0 -41
  26. package/lib/components/hero.ts +0 -224
  27. package/lib/components/icon.ts +0 -178
  28. package/lib/components/icons.ts +0 -464
  29. package/lib/components/include.ts +0 -410
  30. package/lib/components/input.ts +0 -457
  31. package/lib/components/list.ts +0 -419
  32. package/lib/components/loading.ts +0 -100
  33. package/lib/components/menu.ts +0 -275
  34. package/lib/components/modal.ts +0 -284
  35. package/lib/components/nav.ts +0 -257
  36. package/lib/components/paragraph.ts +0 -97
  37. package/lib/components/progress.ts +0 -159
  38. package/lib/components/radio.ts +0 -278
  39. package/lib/components/req.ts +0 -303
  40. package/lib/components/script.ts +0 -41
  41. package/lib/components/select.ts +0 -252
  42. package/lib/components/sidebar.ts +0 -275
  43. package/lib/components/style.ts +0 -41
  44. package/lib/components/switch.ts +0 -246
  45. package/lib/components/table.ts +0 -1249
  46. package/lib/components/tabs.ts +0 -250
  47. package/lib/components/theme-toggle.ts +0 -293
  48. package/lib/components/tooltip.ts +0 -144
  49. package/lib/components/view.ts +0 -190
  50. package/lib/components/write.ts +0 -272
  51. package/lib/layouts/default.css +0 -260
  52. package/lib/layouts/figma.css +0 -334
  53. package/lib/reactivity/state.ts +0 -78
  54. package/lib/utils/fetch.ts +0 -553
  55. package/machinery/ast.js +0 -347
  56. package/machinery/build.js +0 -466
  57. package/machinery/bundleAssets.js +0 -0
  58. package/machinery/bundleJux.js +0 -0
  59. package/machinery/bundleVendors.js +0 -0
  60. package/machinery/doc-generator.js +0 -136
  61. package/machinery/imports.js +0 -155
  62. package/machinery/ts-shim.js +0 -46
  63. package/machinery/validators/file-validator.js +0 -123
@@ -1,257 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- import { renderIcon } from './icons.js';
3
- import { req } from './req.js';
4
-
5
- // Event definitions
6
- const TRIGGER_EVENTS = [] as const;
7
- const CALLBACK_EVENTS = [] as const;
8
-
9
- export interface NavItem {
10
- label: string;
11
- href: string;
12
- active?: boolean;
13
- itemClass?: string;
14
- }
15
-
16
- export interface NavBrand {
17
- text?: string;
18
- href?: string;
19
- icon?: string;
20
- }
21
-
22
- export interface NavOptions {
23
- items?: NavItem[];
24
- brand?: NavBrand;
25
- variant?: 'default' | 'pills' | 'tabs';
26
- sticky?: boolean;
27
- style?: string;
28
- class?: string;
29
- }
30
-
31
- type NavState = {
32
- items: NavItem[];
33
- brand?: NavBrand;
34
- variant: string;
35
- sticky: boolean;
36
- style: string;
37
- class: string;
38
- };
39
-
40
- export class Nav extends BaseComponent<NavState> {
41
- private _nav: HTMLElement | null = null;
42
-
43
- constructor(id: string, options: NavOptions = {}) {
44
- super(id, {
45
- items: options.items ?? [],
46
- brand: options.brand,
47
- variant: options.variant ?? 'default',
48
- sticky: options.sticky ?? false,
49
- style: options.style ?? '',
50
- class: options.class ?? ''
51
- });
52
-
53
- this._setActiveStates();
54
- }
55
-
56
- protected getTriggerEvents(): readonly string[] {
57
- return TRIGGER_EVENTS;
58
- }
59
-
60
- protected getCallbackEvents(): readonly string[] {
61
- return CALLBACK_EVENTS;
62
- }
63
-
64
- private _setActiveStates(): void {
65
- this.state.items = this.state.items.map(item => ({
66
- ...item,
67
- active: req.isActiveNavItem(item.href)
68
- }));
69
- }
70
-
71
- /* ═════════════════════════════════════════════════════════════════
72
- * FLUENT API
73
- * ═════════════════════════════════════════════════════════════════ */
74
-
75
- // ✅ Inherited from BaseComponent
76
-
77
- items(value: NavItem[]): this {
78
- this.state.items = value;
79
- this._setActiveStates();
80
- return this;
81
- }
82
-
83
- addItem(item: NavItem): this {
84
- this.state.items = [...this.state.items, item];
85
- this._setActiveStates();
86
- return this;
87
- }
88
-
89
- itemClass(className: string): this {
90
- this.state.items = this.state.items.map(item => ({
91
- ...item,
92
- itemClass: className
93
- }));
94
- return this;
95
- }
96
-
97
- brand(value: NavBrand): this {
98
- this.state.brand = value;
99
- return this;
100
- }
101
-
102
- variant(value: string): this {
103
- this.state.variant = value;
104
- return this;
105
- }
106
-
107
- sticky(value: boolean): this {
108
- this.state.sticky = value;
109
- return this;
110
- }
111
-
112
- /* ═════════════════════════════════════════════════════════════════
113
- * RENDER
114
- * ═════════════════════════════════════════════════════════════════ */
115
-
116
- render(targetId?: string): this {
117
- const container = this._setupContainer(targetId);
118
-
119
- const { brand, items, variant, sticky, style, class: className } = this.state;
120
-
121
- const nav = document.createElement('nav');
122
- nav.className = `jux-nav jux-nav-${variant}`;
123
- nav.id = this._id;
124
- if (sticky) nav.classList.add('jux-nav-sticky');
125
- if (className) nav.className += ` ${className}`;
126
- if (style) nav.setAttribute('style', style);
127
-
128
- // Brand/Logo
129
- if (brand) {
130
- const brandEl = document.createElement('div');
131
- brandEl.className = 'jux-nav-brand';
132
-
133
- if (brand.href) {
134
- const link = document.createElement('a');
135
- link.href = brand.href;
136
- if (brand.icon) {
137
- const icon = document.createElement('span');
138
- icon.appendChild(renderIcon(brand.icon));
139
- link.appendChild(icon);
140
- }
141
- if (brand.text) {
142
- const text = document.createElement('span');
143
- text.textContent = brand.text;
144
- link.appendChild(text);
145
- }
146
- brandEl.appendChild(link);
147
- } else {
148
- if (brand.icon) {
149
- const icon = document.createElement('span');
150
- icon.appendChild(renderIcon(brand.icon));
151
- brandEl.appendChild(icon);
152
- }
153
- if (brand.text) {
154
- const text = document.createElement('span');
155
- text.textContent = brand.text;
156
- brandEl.appendChild(text);
157
- }
158
- }
159
-
160
- nav.appendChild(brandEl);
161
- }
162
-
163
- // Nav items container
164
- const itemsContainer = document.createElement('div');
165
- itemsContainer.className = 'jux-nav-items';
166
-
167
- items.forEach(item => {
168
- const itemWrapper = document.createElement('div');
169
- itemWrapper.className = 'jux-nav-item-wrapper';
170
-
171
- if (item.itemClass) {
172
- itemWrapper.className += ` ${item.itemClass}`;
173
- }
174
-
175
- const navLink = document.createElement('a');
176
- navLink.className = 'jux-nav-link';
177
- navLink.href = item.href;
178
- navLink.textContent = item.label;
179
- if (item.active) {
180
- itemWrapper.classList.add('jux-nav-item-active');
181
- navLink.classList.add('jux-nav-link-active');
182
- }
183
-
184
- itemWrapper.appendChild(navLink);
185
- itemsContainer.appendChild(itemWrapper);
186
- });
187
-
188
- nav.appendChild(itemsContainer);
189
-
190
- this._wireStandardEvents(nav);
191
-
192
- // Wire sync bindings
193
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
194
- if (property === 'items') {
195
- const transform = toComponent || ((v: any) => v);
196
-
197
- stateObj.subscribe((val: any) => {
198
- const transformed = transform(val);
199
- this.state.items = transformed;
200
- this._setActiveStates();
201
-
202
- itemsContainer.innerHTML = '';
203
- this.state.items.forEach((item: any) => {
204
- const itemWrapper = document.createElement('div');
205
- itemWrapper.className = 'jux-nav-item-wrapper';
206
-
207
- if (item.itemClass) {
208
- itemWrapper.className += ` ${item.itemClass}`;
209
- }
210
-
211
- const navLink = document.createElement('a');
212
- navLink.className = 'jux-nav-link';
213
- navLink.href = item.href;
214
- navLink.textContent = item.label;
215
- if (item.active) {
216
- itemWrapper.classList.add('jux-nav-item-active');
217
- navLink.classList.add('jux-nav-link-active');
218
- }
219
-
220
- itemWrapper.appendChild(navLink);
221
- itemsContainer.appendChild(itemWrapper);
222
- });
223
- });
224
- }
225
- else if (property === 'brand') {
226
- const transform = toComponent || ((v: any) => v);
227
-
228
- stateObj.subscribe((val: any) => {
229
- const transformed = transform(val);
230
- const brandEl = nav.querySelector('.jux-nav-brand');
231
- if (brandEl && transformed.text) {
232
- const textEl = brandEl.querySelector('span:last-child');
233
- if (textEl) {
234
- textEl.textContent = transformed.text;
235
- }
236
- }
237
- this.state.brand = transformed;
238
- });
239
- }
240
- });
241
-
242
- container.appendChild(nav);
243
- this._nav = nav;
244
-
245
- requestAnimationFrame(() => {
246
- if ((window as any).lucide) {
247
- (window as any).lucide.createIcons();
248
- }
249
- });
250
-
251
- return this;
252
- }
253
- }
254
-
255
- export function nav(id: string, options: NavOptions = {}): Nav {
256
- return new Nav(id, options);
257
- }
@@ -1,97 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
-
3
- // Event definitions
4
- const TRIGGER_EVENTS = [] as const;
5
- const CALLBACK_EVENTS = [] as const;
6
-
7
- export interface ParagraphOptions {
8
- content?: string;
9
- class?: string;
10
- style?: string;
11
- }
12
-
13
- type ParagraphState = {
14
- content: string;
15
- class: string;
16
- style: string;
17
- };
18
-
19
- export class Paragraph extends BaseComponent<ParagraphState> {
20
- constructor(id: string, options: ParagraphOptions = {}) {
21
- super(id, {
22
- content: options.content ?? '',
23
- class: options.class ?? '',
24
- style: options.style ?? ''
25
- });
26
- }
27
-
28
- protected getTriggerEvents(): readonly string[] {
29
- return TRIGGER_EVENTS;
30
- }
31
-
32
- protected getCallbackEvents(): readonly string[] {
33
- return CALLBACK_EVENTS;
34
- }
35
-
36
- /* ═════════════════════════════════════════════════════════════════
37
- * FLUENT API
38
- * ═════════════════════════════════════════════════════════════════ */
39
-
40
- // ✅ Inherited from BaseComponent:
41
- // - style(), class()
42
- // - bind(), sync(), renderTo()
43
- // - All other base methods
44
-
45
- content(value: string): this {
46
- this.state.content = value;
47
- return this;
48
- }
49
-
50
- /* ═════════════════════════════════════════════════════════════════
51
- * RENDER
52
- * ═════════════════════════════════════════════════════════════════ */
53
-
54
- render(targetId?: string): this {
55
- const container = this._setupContainer(targetId);
56
-
57
- const { content, style, class: className } = this.state;
58
-
59
- const paragraph = document.createElement('p');
60
- paragraph.className = 'jux-paragraph';
61
- paragraph.id = this._id;
62
- paragraph.textContent = content;
63
- if (className) paragraph.className += ` ${className}`;
64
- if (style) paragraph.setAttribute('style', style);
65
-
66
- this._wireStandardEvents(paragraph);
67
-
68
- // Wire sync bindings
69
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
70
- if (property === 'content') {
71
- const transform = toComponent || ((v: any) => String(v));
72
-
73
- stateObj.subscribe((val: any) => {
74
- const transformed = transform(val);
75
- paragraph.textContent = transformed;
76
- this.state.content = transformed;
77
- });
78
- }
79
- else if (property === 'class') {
80
- const transform = toComponent || ((v: any) => String(v));
81
-
82
- stateObj.subscribe((val: any) => {
83
- const transformed = transform(val);
84
- paragraph.className = `jux-paragraph ${transformed}`;
85
- this.state.class = transformed;
86
- });
87
- }
88
- });
89
-
90
- container.appendChild(paragraph);
91
- return this;
92
- }
93
- }
94
-
95
- export function paragraph(id: string, options: ParagraphOptions = {}): Paragraph {
96
- return new Paragraph(id, options);
97
- }
@@ -1,159 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
-
3
- // Event definitions
4
- const TRIGGER_EVENTS = [] as const;
5
- const CALLBACK_EVENTS = [] as const;
6
-
7
- export interface ProgressOptions {
8
- value?: number;
9
- max?: number;
10
- variant?: 'default' | 'success' | 'warning' | 'error';
11
- showPercentage?: boolean;
12
- label?: string;
13
- size?: 'sm' | 'md' | 'lg';
14
- style?: string;
15
- class?: string;
16
- }
17
-
18
- type ProgressState = {
19
- value: number;
20
- max: number;
21
- variant: string;
22
- showPercentage: boolean;
23
- label: string;
24
- size: string;
25
- style: string;
26
- class: string;
27
- };
28
-
29
- export class Progress extends BaseComponent<ProgressState> {
30
- private _bar: HTMLElement | null = null;
31
- private _label: HTMLElement | null = null;
32
-
33
- constructor(id: string, options: ProgressOptions = {}) {
34
- super(id, {
35
- value: options.value ?? 0,
36
- max: options.max ?? 100,
37
- variant: options.variant ?? 'default',
38
- showPercentage: options.showPercentage ?? false,
39
- label: options.label ?? '',
40
- size: options.size ?? 'md',
41
- style: options.style ?? '',
42
- class: options.class ?? ''
43
- });
44
- }
45
-
46
- protected getTriggerEvents(): readonly string[] {
47
- return TRIGGER_EVENTS;
48
- }
49
-
50
- protected getCallbackEvents(): readonly string[] {
51
- return CALLBACK_EVENTS;
52
- }
53
-
54
- /* ═════════════════════════════════════════════════════════════════
55
- * FLUENT API
56
- * ═════════════════════════════════════════════════════════════════ */
57
-
58
- value(val: number): this {
59
- this.state.value = Math.max(0, Math.min(val, this.state.max));
60
- this._updateProgress();
61
- return this;
62
- }
63
-
64
- max(val: number): this {
65
- this.state.max = val;
66
- this._updateProgress();
67
- return this;
68
- }
69
-
70
- variant(value: 'default' | 'success' | 'warning' | 'error'): this {
71
- this.state.variant = value;
72
- return this;
73
- }
74
-
75
- showPercentage(value: boolean): this {
76
- this.state.showPercentage = value;
77
- return this;
78
- }
79
-
80
- label(value: string): this {
81
- this.state.label = value;
82
- if (this._label) {
83
- this._label.textContent = value;
84
- }
85
- return this;
86
- }
87
-
88
- size(value: 'sm' | 'md' | 'lg'): this {
89
- this.state.size = value;
90
- return this;
91
- }
92
-
93
- private _updateProgress(): void {
94
- if (this._bar) {
95
- const percentage = (this.state.value / this.state.max) * 100;
96
- this._bar.style.width = `${percentage}%`;
97
- if (this._label) {
98
- // Use custom label if set, otherwise show percentage
99
- this._label.textContent = this.state.label || `${Math.round(percentage)}%`;
100
- }
101
- }
102
- }
103
-
104
- /* ═════════════════════════════════════════════════════════════════
105
- * RENDER
106
- * ═════════════════════════════════════════════════════════════════ */
107
-
108
- render(targetId?: string): this {
109
- const container = this._setupContainer(targetId);
110
-
111
- const { value, max, variant, showPercentage, label, size, style, class: className } = this.state;
112
-
113
- const wrapper = document.createElement('div');
114
- wrapper.className = `jux-progress jux-progress-${size}`;
115
- wrapper.id = this._id;
116
- if (className) wrapper.className += ` ${className}`;
117
- if (style) wrapper.setAttribute('style', style);
118
-
119
- const track = document.createElement('div');
120
- track.className = 'jux-progress-track';
121
-
122
- const bar = document.createElement('div');
123
- bar.className = `jux-progress-bar jux-progress-bar-${variant}`;
124
- const percentage = (value / max) * 100;
125
- bar.style.width = `${percentage}%`;
126
- this._bar = bar;
127
-
128
- if (showPercentage || label) {
129
- const labelEl = document.createElement('span');
130
- labelEl.className = 'jux-progress-label';
131
- labelEl.textContent = label || `${Math.round(percentage)}%`;
132
- bar.appendChild(labelEl);
133
- this._label = labelEl;
134
- }
135
-
136
- track.appendChild(bar);
137
- wrapper.appendChild(track);
138
-
139
- this._wireStandardEvents(wrapper);
140
-
141
- // Wire sync for value
142
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
143
- if (property === 'value') {
144
- const transform = toComponent || ((v: any) => Number(v));
145
- stateObj.subscribe((val: any) => {
146
- this.value(transform(val));
147
- });
148
- }
149
- });
150
-
151
- container.appendChild(wrapper);
152
-
153
- return this;
154
- }
155
- }
156
-
157
- export function progress(id: string, options: ProgressOptions = {}): Progress {
158
- return new Progress(id, options);
159
- }