juxscript 1.1.2 → 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 (67) hide show
  1. package/machinery/build3.js +7 -91
  2. package/machinery/compiler3.js +3 -209
  3. package/machinery/config.js +93 -6
  4. package/machinery/serve.js +255 -0
  5. package/machinery/watcher.js +49 -161
  6. package/package.json +19 -5
  7. package/lib/components/alert.ts +0 -200
  8. package/lib/components/app.ts +0 -247
  9. package/lib/components/badge.ts +0 -101
  10. package/lib/components/base/BaseComponent.ts +0 -421
  11. package/lib/components/base/FormInput.ts +0 -227
  12. package/lib/components/button.ts +0 -178
  13. package/lib/components/card.ts +0 -173
  14. package/lib/components/chart.ts +0 -231
  15. package/lib/components/checkbox.ts +0 -242
  16. package/lib/components/code.ts +0 -123
  17. package/lib/components/container.ts +0 -140
  18. package/lib/components/data.ts +0 -135
  19. package/lib/components/datepicker.ts +0 -234
  20. package/lib/components/dialog.ts +0 -172
  21. package/lib/components/divider.ts +0 -100
  22. package/lib/components/dropdown.ts +0 -186
  23. package/lib/components/element.ts +0 -267
  24. package/lib/components/fileupload.ts +0 -309
  25. package/lib/components/grid.ts +0 -291
  26. package/lib/components/guard.ts +0 -92
  27. package/lib/components/heading.ts +0 -96
  28. package/lib/components/helpers.ts +0 -41
  29. package/lib/components/hero.ts +0 -224
  30. package/lib/components/icon.ts +0 -178
  31. package/lib/components/icons.ts +0 -464
  32. package/lib/components/include.ts +0 -410
  33. package/lib/components/input.ts +0 -457
  34. package/lib/components/list.ts +0 -419
  35. package/lib/components/loading.ts +0 -100
  36. package/lib/components/menu.ts +0 -275
  37. package/lib/components/modal.ts +0 -284
  38. package/lib/components/nav.ts +0 -257
  39. package/lib/components/paragraph.ts +0 -97
  40. package/lib/components/progress.ts +0 -159
  41. package/lib/components/radio.ts +0 -278
  42. package/lib/components/req.ts +0 -303
  43. package/lib/components/script.ts +0 -41
  44. package/lib/components/select.ts +0 -252
  45. package/lib/components/sidebar.ts +0 -275
  46. package/lib/components/style.ts +0 -41
  47. package/lib/components/switch.ts +0 -246
  48. package/lib/components/table.ts +0 -1249
  49. package/lib/components/tabs.ts +0 -250
  50. package/lib/components/theme-toggle.ts +0 -293
  51. package/lib/components/tooltip.ts +0 -144
  52. package/lib/components/view.ts +0 -190
  53. package/lib/components/write.ts +0 -272
  54. package/lib/layouts/default.css +0 -260
  55. package/lib/layouts/figma.css +0 -334
  56. package/lib/reactivity/state.ts +0 -78
  57. package/lib/utils/fetch.ts +0 -553
  58. package/machinery/ast.js +0 -347
  59. package/machinery/build.js +0 -466
  60. package/machinery/bundleAssets.js +0 -0
  61. package/machinery/bundleJux.js +0 -0
  62. package/machinery/bundleVendors.js +0 -0
  63. package/machinery/doc-generator.js +0 -136
  64. package/machinery/imports.js +0 -155
  65. package/machinery/server.js +0 -166
  66. package/machinery/ts-shim.js +0 -46
  67. package/machinery/validators/file-validator.js +0 -123
@@ -1,224 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
-
3
- // Event definitions - Hero is display-only, but CTA button can trigger actions
4
- const TRIGGER_EVENTS = [] as const;
5
- const CALLBACK_EVENTS = ['ctaClick'] as const; // ✅ When CTA button is clicked
6
-
7
- export interface HeroOptions {
8
- title?: string;
9
- subtitle?: string;
10
- content?: string; // ✅ ADD: Generates jux-hero-body div
11
- cta?: string; // ✅ KEEP: Generates jux-hero-cta anchor
12
- ctaLink?: string;
13
- backgroundImage?: string;
14
- backgroundOverlay?: boolean; // ✅ ADD: Generates jux-hero-overlay div
15
- variant?: 'default' | 'centered' | 'split';
16
- centered?: boolean; // ✅ ADD: Affects container class
17
- style?: string;
18
- class?: string;
19
- }
20
-
21
- type HeroState = {
22
- title: string;
23
- subtitle: string;
24
- content: string; // ✅ ADD: For jux-hero-body
25
- cta: string;
26
- ctaLink: string;
27
- backgroundImage: string;
28
- backgroundOverlay: boolean; // ✅ ADD: For overlay div
29
- variant: string;
30
- centered: boolean; // ✅ ADD: For layout variant
31
- style: string;
32
- class: string;
33
- };
34
-
35
- export class Hero extends BaseComponent<HeroState> {
36
- constructor(id: string, options: HeroOptions = {}) {
37
- super(id, {
38
- title: options.title ?? '',
39
- subtitle: options.subtitle ?? '',
40
- content: options.content ?? '', // ✅ ADD
41
- cta: options.cta ?? '',
42
- ctaLink: options.ctaLink ?? '#',
43
- backgroundImage: options.backgroundImage ?? '',
44
- backgroundOverlay: options.backgroundOverlay ?? false, // ✅ ADD
45
- variant: options.variant ?? 'default',
46
- centered: options.centered ?? false, // ✅ ADD
47
- style: options.style ?? '',
48
- class: options.class ?? ''
49
- });
50
- }
51
-
52
- protected getTriggerEvents(): readonly string[] {
53
- return TRIGGER_EVENTS;
54
- }
55
-
56
- protected getCallbackEvents(): readonly string[] {
57
- return CALLBACK_EVENTS;
58
- }
59
-
60
- /* ═════════════════════════════════════════════════════════════════
61
- * FLUENT API
62
- * ═════════════════════════════════════════════════════════════════ */
63
-
64
- title(value: string): this {
65
- this.state.title = value;
66
- return this;
67
- }
68
-
69
- subtitle(value: string): this {
70
- this.state.subtitle = value;
71
- return this;
72
- }
73
-
74
- content(value: string): this { // ✅ ADD: Fluent method for content
75
- this.state.content = value;
76
- return this;
77
- }
78
-
79
- cta(value: string): this {
80
- this.state.cta = value;
81
- return this;
82
- }
83
-
84
- ctaLink(value: string): this {
85
- this.state.ctaLink = value;
86
- return this;
87
- }
88
-
89
- backgroundImage(value: string): this {
90
- this.state.backgroundImage = value;
91
- return this;
92
- }
93
-
94
- backgroundOverlay(value: boolean): this { // ✅ ADD: Fluent method for overlay
95
- this.state.backgroundOverlay = value;
96
- return this;
97
- }
98
-
99
- variant(value: string): this {
100
- this.state.variant = value;
101
- return this;
102
- }
103
-
104
- centered(value: boolean): this { // ✅ ADD: Fluent method for centered
105
- this.state.centered = value;
106
- return this;
107
- }
108
-
109
- /* ═════════════════════════════════════════════════════════════════
110
- * RENDER
111
- * ═════════════════════════════════════════════════════════════════ */
112
-
113
- render(targetId?: string): this {
114
- const container = this._setupContainer(targetId);
115
-
116
- const { title, subtitle, content, backgroundImage, backgroundOverlay, centered, style, class: className } = this.state;
117
-
118
- const hero = document.createElement('section');
119
- hero.className = 'jux-hero';
120
- hero.id = this._id;
121
- if (centered) hero.classList.add('jux-hero-centered');
122
- if (className) hero.className += ` ${className}`;
123
- if (style) hero.setAttribute('style', style);
124
-
125
- if (backgroundImage) {
126
- hero.style.backgroundImage = `url(${backgroundImage})`;
127
- if (backgroundOverlay) {
128
- const overlay = document.createElement('div');
129
- overlay.className = 'jux-hero-overlay';
130
- hero.appendChild(overlay);
131
- }
132
- }
133
-
134
- const contentContainer = document.createElement('div');
135
- contentContainer.className = 'jux-hero-content';
136
-
137
- if (title) {
138
- const titleEl = document.createElement('h1');
139
- titleEl.className = 'jux-hero-title';
140
- titleEl.id = `${this._id}-title`;
141
- titleEl.textContent = title;
142
- contentContainer.appendChild(titleEl);
143
- }
144
-
145
- if (subtitle) {
146
- const subtitleEl = document.createElement('p');
147
- subtitleEl.className = 'jux-hero-subtitle';
148
- subtitleEl.id = `${this._id}-subtitle`;
149
- subtitleEl.textContent = subtitle;
150
- contentContainer.appendChild(subtitleEl);
151
- }
152
-
153
- if (content) {
154
- const contentEl = document.createElement('div');
155
- contentEl.className = 'jux-hero-body';
156
- contentEl.innerHTML = content;
157
- contentContainer.appendChild(contentEl);
158
- }
159
-
160
- if (this.state.cta) {
161
- const ctaButton = document.createElement('a');
162
- ctaButton.className = 'jux-hero-cta';
163
- ctaButton.href = this.state.ctaLink;
164
- ctaButton.textContent = this.state.cta;
165
-
166
- // ✅ Fire callback when CTA is clicked
167
- ctaButton.addEventListener('click', (e) => {
168
- this._triggerCallback('ctaClick', e);
169
- });
170
-
171
- contentContainer.appendChild(ctaButton);
172
- }
173
-
174
- hero.appendChild(contentContainer);
175
-
176
- this._wireStandardEvents(hero);
177
-
178
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
179
- if (property === 'title') {
180
- const transform = toComponent || ((v: any) => String(v));
181
-
182
- stateObj.subscribe((val: any) => {
183
- const transformed = transform(val);
184
- const titleEl = document.getElementById(`${this._id}-title`);
185
- if (titleEl) {
186
- titleEl.textContent = transformed;
187
- }
188
- this.state.title = transformed;
189
- });
190
- }
191
- else if (property === 'subtitle') {
192
- const transform = toComponent || ((v: any) => String(v));
193
-
194
- stateObj.subscribe((val: any) => {
195
- const transformed = transform(val);
196
- const subtitleEl = document.getElementById(`${this._id}-subtitle`);
197
- if (subtitleEl) {
198
- subtitleEl.textContent = transformed;
199
- }
200
- this.state.subtitle = transformed;
201
- });
202
- }
203
- else if (property === 'content') {
204
- const transform = toComponent || ((v: any) => String(v));
205
-
206
- stateObj.subscribe((val: any) => {
207
- const transformed = transform(val);
208
- const contentEl = hero.querySelector('.jux-hero-body');
209
- if (contentEl) {
210
- contentEl.innerHTML = transformed;
211
- }
212
- this.state.content = transformed;
213
- });
214
- }
215
- });
216
-
217
- container.appendChild(hero);
218
- return this;
219
- }
220
- }
221
-
222
- export function hero(id: string, options: HeroOptions = {}): Hero {
223
- return new Hero(id, options);
224
- }
@@ -1,178 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- import { renderIcon, renderEmoji } from './icons.js';
3
-
4
- // Event definitions
5
- const TRIGGER_EVENTS = [] as const;
6
- const CALLBACK_EVENTS = [] as const;
7
-
8
- export interface IconOptions {
9
- value?: string;
10
- size?: string;
11
- color?: string;
12
- useEmoji?: boolean;
13
- iconCollection?: string;
14
- style?: string;
15
- class?: string;
16
- }
17
-
18
- type IconState = {
19
- value: string;
20
- size: string;
21
- color: string;
22
- useEmoji: boolean;
23
- iconCollection: string;
24
- style: string;
25
- class: string;
26
- };
27
-
28
- export class Icon extends BaseComponent<IconState> {
29
- constructor(id: string, options: IconOptions = {}) {
30
- super(id, {
31
- value: options.value ?? '',
32
- size: options.size ?? '24px',
33
- color: options.color ?? '',
34
- useEmoji: options.useEmoji ?? false,
35
- iconCollection: options.iconCollection ?? '',
36
- style: options.style ?? '',
37
- class: options.class ?? ''
38
- });
39
- }
40
-
41
- protected getTriggerEvents(): readonly string[] {
42
- return TRIGGER_EVENTS;
43
- }
44
-
45
- protected getCallbackEvents(): readonly string[] {
46
- return CALLBACK_EVENTS;
47
- }
48
-
49
- /* ═════════════════════════════════════════════════════════════════
50
- * FLUENT API
51
- * ═════════════════════════════════════════════════════════════════ */
52
-
53
- // ✅ Inherited from BaseComponent
54
-
55
- value(value: string): this {
56
- this.state.value = value;
57
- return this;
58
- }
59
-
60
- size(value: string): this {
61
- this.state.size = value;
62
- return this;
63
- }
64
-
65
- color(value: string): this {
66
- this.state.color = value;
67
- return this;
68
- }
69
-
70
- useEmoji(value: boolean): this {
71
- this.state.useEmoji = value;
72
- return this;
73
- }
74
-
75
- iconCollection(value: string): this {
76
- this.state.iconCollection = value;
77
- return this;
78
- }
79
-
80
- style(value: string): this {
81
- this.state.style = value;
82
- return this;
83
- }
84
-
85
- class(value: string): this {
86
- this.state.class = value;
87
- return this;
88
- }
89
-
90
- /* ═════════════════════════════════════════════════════════════════
91
- * RENDER
92
- * ═════════════════════════════════════════════════════════════════ */
93
-
94
- render(targetId?: string): this {
95
- const container = this._setupContainer(targetId);
96
-
97
- const { value, size, color, useEmoji, iconCollection, style, class: className } = this.state;
98
-
99
- const wrapper = document.createElement('span');
100
- wrapper.className = 'jux-icon';
101
- wrapper.id = this._id;
102
- if (className) wrapper.className += ` ${className}`;
103
- if (style) wrapper.setAttribute('style', style);
104
-
105
- const iconElement = useEmoji ? renderEmoji(value) : renderIcon(value, iconCollection);
106
- iconElement.style.width = size;
107
- iconElement.style.height = size;
108
- if (color) iconElement.style.color = color;
109
-
110
- wrapper.appendChild(iconElement);
111
-
112
- this._wireStandardEvents(wrapper);
113
-
114
- // Wire sync bindings
115
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
116
- if (property === 'value') {
117
- const transform = toComponent || ((v: any) => String(v));
118
-
119
- stateObj.subscribe((val: any) => {
120
- const transformed = transform(val);
121
- this.state.value = transformed;
122
-
123
- wrapper.innerHTML = '';
124
- const newIcon = this.state.useEmoji ? renderEmoji(transformed) : renderIcon(transformed, this.state.iconCollection);
125
- newIcon.style.width = this.state.size;
126
- newIcon.style.height = this.state.size;
127
- if (this.state.color) newIcon.style.color = this.state.color;
128
- wrapper.appendChild(newIcon);
129
-
130
- requestAnimationFrame(() => {
131
- if ((window as any).Iconify) {
132
- (window as any).Iconify.scan();
133
- }
134
- });
135
- });
136
- }
137
- else if (property === 'size') {
138
- const transform = toComponent || ((v: any) => String(v));
139
-
140
- stateObj.subscribe((val: any) => {
141
- const transformed = transform(val);
142
- const icon = wrapper.querySelector('img, svg, span');
143
- if (icon instanceof HTMLElement) {
144
- icon.style.width = transformed;
145
- icon.style.height = transformed;
146
- }
147
- this.state.size = transformed;
148
- });
149
- }
150
- else if (property === 'color') {
151
- const transform = toComponent || ((v: any) => String(v));
152
-
153
- stateObj.subscribe((val: any) => {
154
- const transformed = transform(val);
155
- const icon = wrapper.querySelector('img, svg, span');
156
- if (icon instanceof HTMLElement) {
157
- icon.style.color = transformed;
158
- }
159
- this.state.color = transformed;
160
- });
161
- }
162
- });
163
-
164
- container.appendChild(wrapper);
165
-
166
- requestAnimationFrame(() => {
167
- if ((window as any).lucide) {
168
- (window as any).lucide.createIcons();
169
- }
170
- });
171
-
172
- return this;
173
- }
174
- }
175
-
176
- export function icon(id: string, options: IconOptions): Icon {
177
- return new Icon(id, options);
178
- }