juxscript 1.1.239 → 1.1.243
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/index.js +7 -137
- package/lib/components/dataframe.ts +0 -569
- package/lib/components/tag.ts +68 -0
- package/lib/styles/shadcn.css +20 -7
- package/lib/utils/idgen.ts +6 -0
- package/package.json +5 -6
- package/index.d.ts +0 -239
- package/index.d.ts.map +0 -1
- package/lib/components/alert.d.ts +0 -36
- package/lib/components/alert.d.ts.map +0 -1
- package/lib/components/alert.js +0 -172
- package/lib/components/alert.ts +0 -219
- package/lib/components/app.d.ts +0 -89
- package/lib/components/app.d.ts.map +0 -1
- package/lib/components/app.js +0 -175
- package/lib/components/app.ts +0 -247
- package/lib/components/badge.d.ts +0 -26
- package/lib/components/badge.d.ts.map +0 -1
- package/lib/components/badge.js +0 -91
- package/lib/components/badge.ts +0 -118
- package/lib/components/base/Animations.d.ts +0 -36
- package/lib/components/base/Animations.d.ts.map +0 -1
- package/lib/components/base/Animations.js +0 -70
- package/lib/components/base/Animations.ts +0 -112
- package/lib/components/base/BaseComponent.d.ts +0 -294
- package/lib/components/base/BaseComponent.d.ts.map +0 -1
- package/lib/components/base/BaseComponent.js +0 -735
- package/lib/components/base/BaseComponent.ts +0 -884
- package/lib/components/base/FormInput.d.ts +0 -77
- package/lib/components/base/FormInput.d.ts.map +0 -1
- package/lib/components/base/FormInput.js +0 -171
- package/lib/components/base/FormInput.ts +0 -237
- package/lib/components/blueprint.d.ts +0 -40
- package/lib/components/blueprint.d.ts.map +0 -1
- package/lib/components/blueprint.js +0 -327
- package/lib/components/button.d.ts +0 -70
- package/lib/components/button.d.ts.map +0 -1
- package/lib/components/button.js +0 -177
- package/lib/components/button.ts +0 -237
- package/lib/components/card.d.ts +0 -35
- package/lib/components/card.d.ts.map +0 -1
- package/lib/components/card.js +0 -130
- package/lib/components/card.ts +0 -177
- package/lib/components/chart.d.ts +0 -49
- package/lib/components/chart.d.ts.map +0 -1
- package/lib/components/chart.js +0 -205
- package/lib/components/chart.ts +0 -254
- package/lib/components/checkbox.d.ts +0 -33
- package/lib/components/checkbox.d.ts.map +0 -1
- package/lib/components/checkbox.js +0 -202
- package/lib/components/checkbox.ts +0 -260
- package/lib/components/code.d.ts +0 -52
- package/lib/components/code.d.ts.map +0 -1
- package/lib/components/code.js +0 -201
- package/lib/components/code.ts +0 -260
- package/lib/components/container.d.ts +0 -60
- package/lib/components/container.d.ts.map +0 -1
- package/lib/components/container.js +0 -195
- package/lib/components/container.ts +0 -259
- package/lib/components/data.d.ts +0 -36
- package/lib/components/data.d.ts.map +0 -1
- package/lib/components/data.js +0 -110
- package/lib/components/data.ts +0 -135
- package/lib/components/dataframe/DataFrameSource.d.ts +0 -118
- package/lib/components/dataframe/DataFrameSource.d.ts.map +0 -1
- package/lib/components/dataframe/DataFrameSource.js +0 -421
- package/lib/components/dataframe/DataFrameSource.ts +0 -532
- package/lib/components/dataframe/ImportSettingsModal.d.ts +0 -60
- package/lib/components/dataframe/ImportSettingsModal.d.ts.map +0 -1
- package/lib/components/dataframe/ImportSettingsModal.js +0 -442
- package/lib/components/dataframe/ImportSettingsModal.ts +0 -531
- package/lib/components/dataframe.d.ts +0 -110
- package/lib/components/dataframe.d.ts.map +0 -1
- package/lib/components/dataframe.js +0 -470
- package/lib/components/datepicker.d.ts +0 -40
- package/lib/components/datepicker.d.ts.map +0 -1
- package/lib/components/datepicker.js +0 -193
- package/lib/components/datepicker.ts +0 -251
- package/lib/components/dialog.d.ts +0 -39
- package/lib/components/dialog.d.ts.map +0 -1
- package/lib/components/dialog.js +0 -131
- package/lib/components/dialog.ts +0 -178
- package/lib/components/divider.d.ts +0 -31
- package/lib/components/divider.d.ts.map +0 -1
- package/lib/components/divider.js +0 -72
- package/lib/components/divider.ts +0 -104
- package/lib/components/dropdown-menu.d.ts +0 -42
- package/lib/components/dropdown-menu.d.ts.map +0 -1
- package/lib/components/dropdown-menu.js +0 -177
- package/lib/components/dropdown-menu.ts +0 -214
- package/lib/components/dropdown.d.ts +0 -41
- package/lib/components/dropdown.d.ts.map +0 -1
- package/lib/components/dropdown.js +0 -136
- package/lib/components/dropdown.ts +0 -188
- package/lib/components/element.d.ts +0 -51
- package/lib/components/element.d.ts.map +0 -1
- package/lib/components/element.js +0 -209
- package/lib/components/element.ts +0 -271
- package/lib/components/event-chain.d.ts +0 -9
- package/lib/components/event-chain.d.ts.map +0 -1
- package/lib/components/event-chain.js +0 -33
- package/lib/components/fileupload.d.ts +0 -98
- package/lib/components/fileupload.d.ts.map +0 -1
- package/lib/components/fileupload.js +0 -351
- package/lib/components/fileupload.ts +0 -449
- package/lib/components/grid.d.ts +0 -88
- package/lib/components/grid.d.ts.map +0 -1
- package/lib/components/grid.js +0 -208
- package/lib/components/grid.ts +0 -295
- package/lib/components/heading.d.ts +0 -25
- package/lib/components/heading.d.ts.map +0 -1
- package/lib/components/heading.js +0 -83
- package/lib/components/heading.ts +0 -113
- package/lib/components/helpers.d.ts +0 -9
- package/lib/components/helpers.d.ts.map +0 -1
- package/lib/components/helpers.js +0 -30
- package/lib/components/helpers.ts +0 -41
- package/lib/components/hero.d.ts +0 -60
- package/lib/components/hero.d.ts.map +0 -1
- package/lib/components/hero.js +0 -239
- package/lib/components/hero.ts +0 -302
- package/lib/components/history/StateHistory.d.ts +0 -91
- package/lib/components/history/StateHistory.d.ts.map +0 -1
- package/lib/components/history/StateHistory.js +0 -154
- package/lib/components/history/StateHistory.ts +0 -200
- package/lib/components/icon.d.ts +0 -36
- package/lib/components/icon.d.ts.map +0 -1
- package/lib/components/icon.js +0 -135
- package/lib/components/icon.ts +0 -182
- package/lib/components/icons.d.ts +0 -25
- package/lib/components/icons.d.ts.map +0 -1
- package/lib/components/icons.js +0 -440
- package/lib/components/icons.ts +0 -464
- package/lib/components/image.d.ts +0 -42
- package/lib/components/image.d.ts.map +0 -1
- package/lib/components/image.js +0 -204
- package/lib/components/image.ts +0 -260
- package/lib/components/include.d.ts +0 -86
- package/lib/components/include.d.ts.map +0 -1
- package/lib/components/include.js +0 -238
- package/lib/components/include.ts +0 -281
- package/lib/components/input.d.ts +0 -85
- package/lib/components/input.d.ts.map +0 -1
- package/lib/components/input.js +0 -362
- package/lib/components/input.ts +0 -473
- package/lib/components/layer.d.ts +0 -72
- package/lib/components/layer.d.ts.map +0 -1
- package/lib/components/layer.js +0 -219
- package/lib/components/layer.ts +0 -304
- package/lib/components/link.d.ts +0 -41
- package/lib/components/link.d.ts.map +0 -1
- package/lib/components/link.js +0 -216
- package/lib/components/link.ts +0 -268
- package/lib/components/list.d.ts +0 -83
- package/lib/components/list.d.ts.map +0 -1
- package/lib/components/list.js +0 -314
- package/lib/components/list.ts +0 -423
- package/lib/components/loading.d.ts +0 -25
- package/lib/components/loading.d.ts.map +0 -1
- package/lib/components/loading.js +0 -76
- package/lib/components/loading.ts +0 -104
- package/lib/components/menu.d.ts +0 -38
- package/lib/components/menu.d.ts.map +0 -1
- package/lib/components/menu.js +0 -205
- package/lib/components/menu.ts +0 -279
- package/lib/components/modal.d.ts +0 -97
- package/lib/components/modal.d.ts.map +0 -1
- package/lib/components/modal.js +0 -463
- package/lib/components/modal.ts +0 -576
- package/lib/components/nav.d.ts +0 -46
- package/lib/components/nav.d.ts.map +0 -1
- package/lib/components/nav.js +0 -193
- package/lib/components/nav.ts +0 -261
- package/lib/components/paragraph.d.ts +0 -30
- package/lib/components/paragraph.d.ts.map +0 -1
- package/lib/components/paragraph.js +0 -93
- package/lib/components/paragraph.ts +0 -123
- package/lib/components/pen.d.ts +0 -125
- package/lib/components/pen.d.ts.map +0 -1
- package/lib/components/pen.js +0 -443
- package/lib/components/pen.ts +0 -567
- package/lib/components/progress.d.ts +0 -40
- package/lib/components/progress.d.ts.map +0 -1
- package/lib/components/progress.js +0 -116
- package/lib/components/progress.ts +0 -163
- package/lib/components/radio.d.ts +0 -43
- package/lib/components/radio.d.ts.map +0 -1
- package/lib/components/radio.js +0 -226
- package/lib/components/radio.ts +0 -303
- package/lib/components/registry.d.ts +0 -34
- package/lib/components/registry.d.ts.map +0 -1
- package/lib/components/registry.js +0 -163
- package/lib/components/registry.ts +0 -193
- package/lib/components/req.d.ts +0 -155
- package/lib/components/req.d.ts.map +0 -1
- package/lib/components/req.js +0 -253
- package/lib/components/req.ts +0 -303
- package/lib/components/script.d.ts +0 -14
- package/lib/components/script.d.ts.map +0 -1
- package/lib/components/script.js +0 -33
- package/lib/components/script.ts +0 -41
- package/lib/components/select.d.ts +0 -42
- package/lib/components/select.d.ts.map +0 -1
- package/lib/components/select.js +0 -209
- package/lib/components/select.ts +0 -281
- package/lib/components/sidebar.d.ts +0 -59
- package/lib/components/sidebar.d.ts.map +0 -1
- package/lib/components/sidebar.js +0 -298
- package/lib/components/sidebar.ts +0 -395
- package/lib/components/stack/BaseStack.d.ts +0 -65
- package/lib/components/stack/BaseStack.d.ts.map +0 -1
- package/lib/components/stack/BaseStack.js +0 -274
- package/lib/components/stack/BaseStack.ts +0 -328
- package/lib/components/stack/HStack.d.ts +0 -18
- package/lib/components/stack/HStack.d.ts.map +0 -1
- package/lib/components/stack/HStack.js +0 -22
- package/lib/components/stack/HStack.ts +0 -25
- package/lib/components/stack/VStack.d.ts +0 -19
- package/lib/components/stack/VStack.d.ts.map +0 -1
- package/lib/components/stack/VStack.js +0 -23
- package/lib/components/stack/VStack.ts +0 -26
- package/lib/components/stack/ZStack.d.ts +0 -18
- package/lib/components/stack/ZStack.d.ts.map +0 -1
- package/lib/components/stack/ZStack.js +0 -22
- package/lib/components/stack/ZStack.ts +0 -25
- package/lib/components/style.d.ts +0 -14
- package/lib/components/style.d.ts.map +0 -1
- package/lib/components/style.js +0 -33
- package/lib/components/style.ts +0 -41
- package/lib/components/switch.d.ts +0 -34
- package/lib/components/switch.d.ts.map +0 -1
- package/lib/components/switch.js +0 -209
- package/lib/components/switch.ts +0 -272
- package/lib/components/table.d.ts +0 -137
- package/lib/components/table.d.ts.map +0 -1
- package/lib/components/table.js +0 -1019
- package/lib/components/table.ts +0 -1225
- package/lib/components/tabs.d.ts +0 -53
- package/lib/components/tabs.d.ts.map +0 -1
- package/lib/components/tabs.js +0 -275
- package/lib/components/tabs.ts +0 -349
- package/lib/components/theme-toggle.d.ts +0 -45
- package/lib/components/theme-toggle.d.ts.map +0 -1
- package/lib/components/theme-toggle.js +0 -218
- package/lib/components/theme-toggle.ts +0 -297
- package/lib/components/tooltip.d.ts +0 -31
- package/lib/components/tooltip.d.ts.map +0 -1
- package/lib/components/tooltip.js +0 -112
- package/lib/components/tooltip.ts +0 -148
- package/lib/components/watcher.d.ts +0 -195
- package/lib/components/watcher.d.ts.map +0 -1
- package/lib/components/watcher.js +0 -241
- package/lib/components/watcher.ts +0 -261
- package/lib/components/write.d.ts +0 -107
- package/lib/components/write.d.ts.map +0 -1
- package/lib/components/write.js +0 -222
- package/lib/components/write.ts +0 -272
- package/lib/data/DataPipeline.d.ts +0 -113
- package/lib/data/DataPipeline.d.ts.map +0 -1
- package/lib/data/DataPipeline.js +0 -359
- package/lib/data/DataPipeline.ts +0 -452
- package/lib/facades/dataframe.jux +0 -0
- package/lib/globals.d.ts +0 -21
- package/lib/reactivity/state.d.ts +0 -36
- package/lib/reactivity/state.d.ts.map +0 -1
- package/lib/reactivity/state.js +0 -67
- package/lib/reactivity/state.ts +0 -78
- package/lib/storage/DataFrame.d.ts +0 -284
- package/lib/storage/DataFrame.d.ts.map +0 -1
- package/lib/storage/DataFrame.js +0 -1022
- package/lib/storage/DataFrame.ts +0 -1195
- package/lib/storage/DataFrameSource.d.ts +0 -158
- package/lib/storage/DataFrameSource.d.ts.map +0 -1
- package/lib/storage/DataFrameSource.js +0 -409
- package/lib/storage/DataFrameSource.ts +0 -556
- package/lib/storage/FileStorage.d.ts +0 -53
- package/lib/storage/FileStorage.d.ts.map +0 -1
- package/lib/storage/FileStorage.js +0 -80
- package/lib/storage/FileStorage.ts +0 -95
- package/lib/storage/IndexedDBDriver.d.ts +0 -75
- package/lib/storage/IndexedDBDriver.d.ts.map +0 -1
- package/lib/storage/IndexedDBDriver.js +0 -177
- package/lib/storage/IndexedDBDriver.ts +0 -226
- package/lib/storage/TabularDriver.d.ts +0 -118
- package/lib/storage/TabularDriver.d.ts.map +0 -1
- package/lib/storage/TabularDriver.js +0 -731
- package/lib/storage/TabularDriver.ts +0 -874
- package/lib/utils/codeparser.d.ts +0 -29
- package/lib/utils/codeparser.d.ts.map +0 -1
- package/lib/utils/codeparser.js +0 -409
- package/lib/utils/fetch.d.ts +0 -176
- package/lib/utils/fetch.d.ts.map +0 -1
- package/lib/utils/fetch.js +0 -427
- package/lib/utils/formatId.d.ts +0 -16
- package/lib/utils/formatId.d.ts.map +0 -1
- package/lib/utils/formatId.js +0 -27
- package/lib/utils/path-resolver.js +0 -23
|
@@ -1,113 +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; // Headings are display-only, no events
|
|
6
|
-
|
|
7
|
-
export interface HeadingOptions {
|
|
8
|
-
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
9
|
-
content?: string;
|
|
10
|
-
class?: string;
|
|
11
|
-
style?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type HeadingState = {
|
|
15
|
-
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
16
|
-
content: string;
|
|
17
|
-
class: string;
|
|
18
|
-
style: string;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export class Heading extends BaseComponent<HeadingState> {
|
|
22
|
-
constructor(id: string, options: HeadingOptions = {}) {
|
|
23
|
-
super(id, {
|
|
24
|
-
level: options.level ?? 1,
|
|
25
|
-
content: options.content ?? '',
|
|
26
|
-
class: options.class ?? '',
|
|
27
|
-
style: options.style ?? ''
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
protected getTriggerEvents(): readonly string[] {
|
|
32
|
-
return TRIGGER_EVENTS;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
protected getCallbackEvents(): readonly string[] {
|
|
36
|
-
return CALLBACK_EVENTS;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
update(prop: string, value: any): void {
|
|
40
|
-
const el = document.getElementById(this._id);
|
|
41
|
-
if (!el) return;
|
|
42
|
-
|
|
43
|
-
switch (prop) {
|
|
44
|
-
case 'content':
|
|
45
|
-
el.textContent = value;
|
|
46
|
-
break;
|
|
47
|
-
case 'level':
|
|
48
|
-
// Would need to recreate element - skip for now
|
|
49
|
-
break;
|
|
50
|
-
default:
|
|
51
|
-
super.update(prop, value);
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
57
|
-
* FLUENT API
|
|
58
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
59
|
-
|
|
60
|
-
// ✅ Inherited from BaseComponent:
|
|
61
|
-
// - style(), class()
|
|
62
|
-
// - bind(), sync(), renderTo()
|
|
63
|
-
// - All other base methods
|
|
64
|
-
|
|
65
|
-
level(value: 1 | 2 | 3 | 4 | 5 | 6): this {
|
|
66
|
-
this.state.level = value;
|
|
67
|
-
return this;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
content(value: string): this {
|
|
71
|
-
this.state.content = value;
|
|
72
|
-
return this;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
76
|
-
* RENDER
|
|
77
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
78
|
-
|
|
79
|
-
render(targetId?: string | HTMLElement | BaseComponent<any>): this {
|
|
80
|
-
const container = this._setupContainer(targetId);
|
|
81
|
-
|
|
82
|
-
const { content, level, style, class: className } = this.state;
|
|
83
|
-
|
|
84
|
-
const heading = document.createElement(`h${level}`) as HTMLHeadingElement;
|
|
85
|
-
heading.className = `jux-heading jux-heading-${level}`;
|
|
86
|
-
heading.id = this._id;
|
|
87
|
-
heading.textContent = content;
|
|
88
|
-
if (className) heading.className += ` ${className}`;
|
|
89
|
-
if (style) heading.setAttribute('style', style);
|
|
90
|
-
|
|
91
|
-
this._wireStandardEvents(heading);
|
|
92
|
-
|
|
93
|
-
// Wire sync bindings
|
|
94
|
-
this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
|
|
95
|
-
if (property === 'content') {
|
|
96
|
-
const transform = toComponent || ((v: any) => String(v));
|
|
97
|
-
|
|
98
|
-
stateObj.subscribe((val: any) => {
|
|
99
|
-
const transformed = transform(val);
|
|
100
|
-
heading.textContent = transformed;
|
|
101
|
-
this.state.content = transformed;
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
container.appendChild(heading);
|
|
107
|
-
return this;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function heading(id: string, options: HeadingOptions = {}): Heading {
|
|
112
|
-
return new Heading(id, options);
|
|
113
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Component helper utilities
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Get or create a container element for a component
|
|
6
|
-
* Auto-creates if it doesn't exist and appends to appropriate parent
|
|
7
|
-
*/
|
|
8
|
-
export declare function getOrCreateContainer(id: string): HTMLElement;
|
|
9
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAgC5D"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Component helper utilities
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Get or create a container element for a component
|
|
6
|
-
* Auto-creates if it doesn't exist and appends to appropriate parent
|
|
7
|
-
*/
|
|
8
|
-
export function getOrCreateContainer(id) {
|
|
9
|
-
if (typeof document === 'undefined') {
|
|
10
|
-
throw new Error('Document is not available');
|
|
11
|
-
}
|
|
12
|
-
let container = document.getElementById(id);
|
|
13
|
-
// Container already exists, return it
|
|
14
|
-
if (container) {
|
|
15
|
-
return container;
|
|
16
|
-
}
|
|
17
|
-
// Auto-create container if it doesn't exist
|
|
18
|
-
container = document.createElement('div');
|
|
19
|
-
container.id = id;
|
|
20
|
-
// Find appropriate parent - [data-jux-page] takes precedence, then #app, then body
|
|
21
|
-
const dataJuxPage = document.querySelector('[data-jux-page]');
|
|
22
|
-
const app = document.getElementById('app');
|
|
23
|
-
const parent = (dataJuxPage || app || document.body);
|
|
24
|
-
// Log warning if falling back to body
|
|
25
|
-
if (!dataJuxPage && !app) {
|
|
26
|
-
console.warn(`[Jux] Preferred container targets "[data-jux-page]" or "#app" not found. Creating container "#${id}" in fallback parent: body`);
|
|
27
|
-
}
|
|
28
|
-
parent.appendChild(container);
|
|
29
|
-
return container;
|
|
30
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Component helper utilities
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get or create a container element for a component
|
|
7
|
-
* Auto-creates if it doesn't exist and appends to appropriate parent
|
|
8
|
-
*/
|
|
9
|
-
export function getOrCreateContainer(id: string): HTMLElement {
|
|
10
|
-
if (typeof document === 'undefined') {
|
|
11
|
-
throw new Error('Document is not available');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
let container = document.getElementById(id);
|
|
15
|
-
|
|
16
|
-
// Container already exists, return it
|
|
17
|
-
if (container) {
|
|
18
|
-
return container;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Auto-create container if it doesn't exist
|
|
22
|
-
container = document.createElement('div');
|
|
23
|
-
container.id = id;
|
|
24
|
-
|
|
25
|
-
// Find appropriate parent - [data-jux-page] takes precedence, then #app, then body
|
|
26
|
-
const dataJuxPage = document.querySelector('[data-jux-page]') as HTMLElement;
|
|
27
|
-
const app = document.getElementById('app');
|
|
28
|
-
|
|
29
|
-
const parent: HTMLElement = (dataJuxPage || app || document.body) as HTMLElement;
|
|
30
|
-
|
|
31
|
-
// Log warning if falling back to body
|
|
32
|
-
if (!dataJuxPage && !app) {
|
|
33
|
-
console.warn(
|
|
34
|
-
`[Jux] Preferred container targets "[data-jux-page]" or "#app" not found. Creating container "#${id}" in fallback parent: body`,
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
parent.appendChild(container);
|
|
39
|
-
|
|
40
|
-
return container;
|
|
41
|
-
}
|
package/lib/components/hero.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { BaseComponent, BaseState } from './base/BaseComponent.js';
|
|
2
|
-
export interface HeroOptions {
|
|
3
|
-
title?: string;
|
|
4
|
-
subtitle?: string;
|
|
5
|
-
content?: string;
|
|
6
|
-
cta?: string;
|
|
7
|
-
ctaLink?: string;
|
|
8
|
-
backgroundImage?: string | {
|
|
9
|
-
url: string;
|
|
10
|
-
size?: string;
|
|
11
|
-
repeat?: string;
|
|
12
|
-
};
|
|
13
|
-
backgroundOverlay?: boolean;
|
|
14
|
-
variant?: 'default' | 'centered' | 'split';
|
|
15
|
-
centered?: boolean;
|
|
16
|
-
style?: string;
|
|
17
|
-
class?: string;
|
|
18
|
-
}
|
|
19
|
-
type HeroState = BaseState & {
|
|
20
|
-
title: string;
|
|
21
|
-
subtitle: string;
|
|
22
|
-
content: string;
|
|
23
|
-
cta: string;
|
|
24
|
-
ctaLink: string;
|
|
25
|
-
backgroundImage: {
|
|
26
|
-
url: string;
|
|
27
|
-
size: string;
|
|
28
|
-
repeat: string;
|
|
29
|
-
};
|
|
30
|
-
backgroundOverlay: boolean;
|
|
31
|
-
variant: string;
|
|
32
|
-
centered: boolean;
|
|
33
|
-
};
|
|
34
|
-
export declare class Hero extends BaseComponent<HeroState> {
|
|
35
|
-
constructor(id: string, options?: HeroOptions);
|
|
36
|
-
protected getTriggerEvents(): readonly string[];
|
|
37
|
-
protected getCallbackEvents(): readonly string[];
|
|
38
|
-
/**
|
|
39
|
-
* Called automatically by BaseComponent when state changes.
|
|
40
|
-
* Centralizes DOM manipulation so setters don't have to drill/repeat logic.
|
|
41
|
-
*/
|
|
42
|
-
update(prop: string, value: any): void;
|
|
43
|
-
title(value: string): this;
|
|
44
|
-
subtitle(value: string): this;
|
|
45
|
-
content(value: string): this;
|
|
46
|
-
cta(value: string): this;
|
|
47
|
-
ctaLink(value: string): this;
|
|
48
|
-
backgroundImage(value: string | {
|
|
49
|
-
url: string;
|
|
50
|
-
size?: string;
|
|
51
|
-
repeat?: string;
|
|
52
|
-
}): this;
|
|
53
|
-
backgroundOverlay(value: boolean): this;
|
|
54
|
-
variant(value: string): this;
|
|
55
|
-
centered(value: boolean): this;
|
|
56
|
-
render(targetId?: string | HTMLElement | BaseComponent<any>): this;
|
|
57
|
-
}
|
|
58
|
-
export declare function hero(id: string, options?: HeroOptions): Hero;
|
|
59
|
-
export {};
|
|
60
|
-
//# sourceMappingURL=hero.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["hero.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMnE,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,SAAS,GAAG,SAAS,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,iBAAiB,EAAE,OAAO,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,qBAAa,IAAK,SAAQ,aAAa,CAAC,SAAS,CAAC;gBACpC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB;IAoBjD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAQhD;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAoGtC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK1B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKxB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAatF,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAKvC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAS9B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CAsEnE;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAEhE"}
|
package/lib/components/hero.js
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { BaseComponent } from './base/BaseComponent.js';
|
|
2
|
-
// Event definitions - Hero is display-only, but CTA button can trigger actions
|
|
3
|
-
const TRIGGER_EVENTS = [];
|
|
4
|
-
const CALLBACK_EVENTS = ['ctaClick'];
|
|
5
|
-
export class Hero extends BaseComponent {
|
|
6
|
-
constructor(id, options = {}) {
|
|
7
|
-
const bgImage = typeof options.backgroundImage === 'string'
|
|
8
|
-
? { url: options.backgroundImage, size: 'cover', repeat: 'no-repeat' }
|
|
9
|
-
: options.backgroundImage || { url: '', size: 'cover', repeat: 'no-repeat' };
|
|
10
|
-
super(id, {
|
|
11
|
-
title: options.title ?? '',
|
|
12
|
-
subtitle: options.subtitle ?? '',
|
|
13
|
-
content: options.content ?? '',
|
|
14
|
-
cta: options.cta ?? '',
|
|
15
|
-
ctaLink: options.ctaLink ?? '#',
|
|
16
|
-
backgroundImage: { url: bgImage.url, size: bgImage.size || 'cover', repeat: bgImage.repeat || 'no-repeat' },
|
|
17
|
-
backgroundOverlay: options.backgroundOverlay ?? false,
|
|
18
|
-
variant: options.variant ?? 'default',
|
|
19
|
-
centered: options.centered ?? false,
|
|
20
|
-
style: options.style ?? '',
|
|
21
|
-
class: options.class ?? ''
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
getTriggerEvents() {
|
|
25
|
-
return TRIGGER_EVENTS;
|
|
26
|
-
}
|
|
27
|
-
getCallbackEvents() {
|
|
28
|
-
return CALLBACK_EVENTS;
|
|
29
|
-
}
|
|
30
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
31
|
-
* REACTIVE DOM UPDATES
|
|
32
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
33
|
-
/**
|
|
34
|
-
* Called automatically by BaseComponent when state changes.
|
|
35
|
-
* Centralizes DOM manipulation so setters don't have to drill/repeat logic.
|
|
36
|
-
*/
|
|
37
|
-
update(prop, value) {
|
|
38
|
-
super.update(prop, value); // Handle base properties
|
|
39
|
-
const hero = document.getElementById(this._id);
|
|
40
|
-
if (!hero)
|
|
41
|
-
return;
|
|
42
|
-
const contentContainer = hero.querySelector('.jux-hero-content');
|
|
43
|
-
if (!contentContainer)
|
|
44
|
-
return;
|
|
45
|
-
switch (prop) {
|
|
46
|
-
case 'title':
|
|
47
|
-
let titleEl = document.getElementById(`${this._id}-title`);
|
|
48
|
-
if (!titleEl) {
|
|
49
|
-
// ✅ Create title element if it doesn't exist
|
|
50
|
-
titleEl = document.createElement('h1');
|
|
51
|
-
titleEl.className = 'jux-hero-title';
|
|
52
|
-
titleEl.id = `${this._id}-title`;
|
|
53
|
-
contentContainer.insertBefore(titleEl, contentContainer.firstChild);
|
|
54
|
-
}
|
|
55
|
-
titleEl.textContent = value;
|
|
56
|
-
break;
|
|
57
|
-
case 'subtitle':
|
|
58
|
-
let subtitleEl = document.getElementById(`${this._id}-subtitle`);
|
|
59
|
-
if (!subtitleEl) {
|
|
60
|
-
// ✅ Create subtitle element if it doesn't exist
|
|
61
|
-
subtitleEl = document.createElement('p');
|
|
62
|
-
subtitleEl.className = 'jux-hero-subtitle';
|
|
63
|
-
subtitleEl.id = `${this._id}-subtitle`;
|
|
64
|
-
// Insert after title if exists, otherwise at start
|
|
65
|
-
const titleEl = document.getElementById(`${this._id}-title`);
|
|
66
|
-
if (titleEl) {
|
|
67
|
-
titleEl.after(subtitleEl);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
contentContainer.insertBefore(subtitleEl, contentContainer.firstChild);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
subtitleEl.textContent = value;
|
|
74
|
-
break;
|
|
75
|
-
case 'content':
|
|
76
|
-
let contentEl = hero.querySelector('.jux-hero-body');
|
|
77
|
-
if (!contentEl) {
|
|
78
|
-
// ✅ Create content element if it doesn't exist
|
|
79
|
-
contentEl = document.createElement('div');
|
|
80
|
-
contentEl.className = 'jux-hero-body';
|
|
81
|
-
// Insert after subtitle if exists, otherwise after title, otherwise at start
|
|
82
|
-
const subtitleEl = document.getElementById(`${this._id}-subtitle`);
|
|
83
|
-
const titleEl = document.getElementById(`${this._id}-title`);
|
|
84
|
-
if (subtitleEl) {
|
|
85
|
-
subtitleEl.after(contentEl);
|
|
86
|
-
}
|
|
87
|
-
else if (titleEl) {
|
|
88
|
-
titleEl.after(contentEl);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
contentContainer.insertBefore(contentEl, contentContainer.firstChild);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
contentEl.innerHTML = value;
|
|
95
|
-
break;
|
|
96
|
-
case 'cta':
|
|
97
|
-
let ctaEl = hero.querySelector('.jux-hero-cta');
|
|
98
|
-
if (!ctaEl) {
|
|
99
|
-
// ✅ Create CTA element if it doesn't exist
|
|
100
|
-
ctaEl = document.createElement('a');
|
|
101
|
-
ctaEl.className = 'jux-hero-cta';
|
|
102
|
-
ctaEl.href = this.state.ctaLink;
|
|
103
|
-
ctaEl.addEventListener('click', (e) => {
|
|
104
|
-
this._triggerCallback('ctaClick', e);
|
|
105
|
-
});
|
|
106
|
-
contentContainer.appendChild(ctaEl);
|
|
107
|
-
}
|
|
108
|
-
ctaEl.textContent = value;
|
|
109
|
-
break;
|
|
110
|
-
case 'ctaLink':
|
|
111
|
-
const ctaLinkEl = hero.querySelector('.jux-hero-cta');
|
|
112
|
-
if (ctaLinkEl)
|
|
113
|
-
ctaLinkEl.href = value;
|
|
114
|
-
break;
|
|
115
|
-
case 'backgroundImage':
|
|
116
|
-
hero.style.backgroundImage = `url(${value.url})`;
|
|
117
|
-
hero.style.backgroundSize = value.size;
|
|
118
|
-
hero.style.backgroundRepeat = value.repeat;
|
|
119
|
-
break;
|
|
120
|
-
case 'centered':
|
|
121
|
-
hero.classList.toggle('jux-hero-centered', value);
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
126
|
-
* FLUENT API (Simplified - just updates state)
|
|
127
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
128
|
-
title(value) {
|
|
129
|
-
this.state.title = value; // Triggers update('title', value) via Proxy
|
|
130
|
-
return this;
|
|
131
|
-
}
|
|
132
|
-
subtitle(value) {
|
|
133
|
-
this.state.subtitle = value;
|
|
134
|
-
return this;
|
|
135
|
-
}
|
|
136
|
-
content(value) {
|
|
137
|
-
this.state.content = value;
|
|
138
|
-
return this;
|
|
139
|
-
}
|
|
140
|
-
cta(value) {
|
|
141
|
-
this.state.cta = value;
|
|
142
|
-
return this;
|
|
143
|
-
}
|
|
144
|
-
ctaLink(value) {
|
|
145
|
-
this.state.ctaLink = value;
|
|
146
|
-
return this;
|
|
147
|
-
}
|
|
148
|
-
backgroundImage(value) {
|
|
149
|
-
if (typeof value === 'string') {
|
|
150
|
-
this.state.backgroundImage = { url: value, size: 'cover', repeat: 'no-repeat' };
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
this.state.backgroundImage = {
|
|
154
|
-
url: value.url,
|
|
155
|
-
size: value.size || 'cover',
|
|
156
|
-
repeat: value.repeat || 'no-repeat'
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
return this;
|
|
160
|
-
}
|
|
161
|
-
backgroundOverlay(value) {
|
|
162
|
-
this.state.backgroundOverlay = value;
|
|
163
|
-
return this;
|
|
164
|
-
}
|
|
165
|
-
variant(value) {
|
|
166
|
-
this.state.variant = value;
|
|
167
|
-
return this;
|
|
168
|
-
}
|
|
169
|
-
centered(value) {
|
|
170
|
-
this.state.centered = value;
|
|
171
|
-
return this;
|
|
172
|
-
}
|
|
173
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
174
|
-
* RENDER
|
|
175
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
176
|
-
render(targetId) {
|
|
177
|
-
const container = this._setupContainer(targetId);
|
|
178
|
-
const { title, subtitle, content, backgroundImage, backgroundOverlay, centered, style, class: className } = this.state;
|
|
179
|
-
const hero = document.createElement('section');
|
|
180
|
-
hero.className = 'jux-hero';
|
|
181
|
-
hero.id = this._id;
|
|
182
|
-
if (centered)
|
|
183
|
-
hero.classList.add('jux-hero-centered');
|
|
184
|
-
if (className)
|
|
185
|
-
hero.className += ` ${className}`;
|
|
186
|
-
if (style)
|
|
187
|
-
hero.setAttribute('style', style);
|
|
188
|
-
if (backgroundImage.url) {
|
|
189
|
-
hero.style.backgroundImage = `url(${backgroundImage.url})`;
|
|
190
|
-
hero.style.backgroundSize = backgroundImage.size;
|
|
191
|
-
hero.style.backgroundRepeat = backgroundImage.repeat;
|
|
192
|
-
if (backgroundOverlay) {
|
|
193
|
-
const overlay = document.createElement('div');
|
|
194
|
-
overlay.className = 'jux-hero-overlay';
|
|
195
|
-
hero.appendChild(overlay);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
const contentContainer = document.createElement('div');
|
|
199
|
-
contentContainer.className = 'jux-hero-content';
|
|
200
|
-
if (title) {
|
|
201
|
-
const titleEl = document.createElement('h1');
|
|
202
|
-
titleEl.className = 'jux-hero-title';
|
|
203
|
-
titleEl.id = `${this._id}-title`;
|
|
204
|
-
titleEl.textContent = title;
|
|
205
|
-
contentContainer.appendChild(titleEl);
|
|
206
|
-
}
|
|
207
|
-
if (subtitle) {
|
|
208
|
-
const subtitleEl = document.createElement('p');
|
|
209
|
-
subtitleEl.className = 'jux-hero-subtitle';
|
|
210
|
-
subtitleEl.id = `${this._id}-subtitle`;
|
|
211
|
-
subtitleEl.textContent = subtitle;
|
|
212
|
-
contentContainer.appendChild(subtitleEl);
|
|
213
|
-
}
|
|
214
|
-
if (content) {
|
|
215
|
-
const contentEl = document.createElement('div');
|
|
216
|
-
contentEl.className = 'jux-hero-body';
|
|
217
|
-
contentEl.innerHTML = content;
|
|
218
|
-
contentContainer.appendChild(contentEl);
|
|
219
|
-
}
|
|
220
|
-
if (this.state.cta) {
|
|
221
|
-
const ctaButton = document.createElement('a');
|
|
222
|
-
ctaButton.className = 'jux-hero-cta';
|
|
223
|
-
ctaButton.href = this.state.ctaLink;
|
|
224
|
-
ctaButton.textContent = this.state.cta;
|
|
225
|
-
ctaButton.addEventListener('click', (e) => {
|
|
226
|
-
this._triggerCallback('ctaClick', e);
|
|
227
|
-
});
|
|
228
|
-
contentContainer.appendChild(ctaButton);
|
|
229
|
-
}
|
|
230
|
-
hero.appendChild(contentContainer);
|
|
231
|
-
this._wireStandardEvents(hero);
|
|
232
|
-
this._wireAllSyncs();
|
|
233
|
-
container.appendChild(hero);
|
|
234
|
-
return this;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
export function hero(id, options = {}) {
|
|
238
|
-
return new Hero(id, options);
|
|
239
|
-
}
|