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
package/lib/components/alert.ts
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { BaseComponent } from './base/BaseComponent.js';
|
|
2
|
-
import { renderIcon } from './icons.js';
|
|
3
|
-
|
|
4
|
-
// Event definitions
|
|
5
|
-
const TRIGGER_EVENTS = [] as const;
|
|
6
|
-
const CALLBACK_EVENTS = ['dismiss'] as const;
|
|
7
|
-
|
|
8
|
-
export interface AlertOptions {
|
|
9
|
-
content?: string;
|
|
10
|
-
type?: 'info' | 'success' | 'warning' | 'error';
|
|
11
|
-
dismissible?: boolean;
|
|
12
|
-
icon?: string;
|
|
13
|
-
style?: string;
|
|
14
|
-
class?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
type AlertState = {
|
|
18
|
-
content: string;
|
|
19
|
-
type: string;
|
|
20
|
-
dismissible: boolean;
|
|
21
|
-
icon: string;
|
|
22
|
-
visible: boolean;
|
|
23
|
-
style: string;
|
|
24
|
-
class: string;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export class Alert extends BaseComponent<AlertState> {
|
|
28
|
-
private _alert: HTMLElement | null = null;
|
|
29
|
-
|
|
30
|
-
constructor(id: string, options: AlertOptions = {}) {
|
|
31
|
-
super(id, {
|
|
32
|
-
content: options.content ?? '',
|
|
33
|
-
type: options.type ?? 'info',
|
|
34
|
-
dismissible: options.dismissible ?? true,
|
|
35
|
-
icon: options.icon ?? '',
|
|
36
|
-
visible: true,
|
|
37
|
-
style: options.style ?? '',
|
|
38
|
-
class: options.class ?? ''
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
protected getTriggerEvents(): readonly string[] {
|
|
43
|
-
return TRIGGER_EVENTS;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
protected getCallbackEvents(): readonly string[] {
|
|
47
|
-
return CALLBACK_EVENTS;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
51
|
-
* FLUENT API
|
|
52
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
53
|
-
|
|
54
|
-
// ✅ Inherited from BaseComponent:
|
|
55
|
-
// - style(), class()
|
|
56
|
-
// - bind(), sync(), renderTo()
|
|
57
|
-
// - addClass(), removeClass(), toggleClass()
|
|
58
|
-
// - visible(), show(), hide(), toggleVisibility()
|
|
59
|
-
// - attr(), attrs(), removeAttr()
|
|
60
|
-
// - disabled(), enable(), disable()
|
|
61
|
-
// - loading(), focus(), blur(), remove()
|
|
62
|
-
|
|
63
|
-
content(value: string): this {
|
|
64
|
-
this.state.content = value;
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
type(value: 'info' | 'success' | 'warning' | 'error'): this {
|
|
69
|
-
this.state.type = value;
|
|
70
|
-
return this;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
dismissible(value: boolean): this {
|
|
74
|
-
this.state.dismissible = value;
|
|
75
|
-
return this;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
icon(value: string): this {
|
|
79
|
-
this.state.icon = value;
|
|
80
|
-
return this;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Reactive update hook
|
|
85
|
-
*/
|
|
86
|
-
update(prop: string, value: any): void {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const el = document.getElementById(this._id);
|
|
90
|
-
if (!el) return;
|
|
91
|
-
|
|
92
|
-
if (prop === 'content') {
|
|
93
|
-
const contentEl = el.querySelector('.jux-alert-content');
|
|
94
|
-
if (contentEl) contentEl.textContent = value;
|
|
95
|
-
} else if (prop === 'type') {
|
|
96
|
-
// Update alert type class
|
|
97
|
-
el.className = `jux-alert jux-alert-${value}`;
|
|
98
|
-
if (this.state.class) el.className += ` ${this.state.class}`;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
103
|
-
* RENDER
|
|
104
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
105
|
-
|
|
106
|
-
render(targetId?: string | HTMLElement | BaseComponent<any>): this {
|
|
107
|
-
const container = this._setupContainer(targetId);
|
|
108
|
-
|
|
109
|
-
const { content, type, dismissible, icon, style, class: className } = this.state;
|
|
110
|
-
const hasVisibleSync = this._syncBindings.some(b => b.property === 'visible');
|
|
111
|
-
|
|
112
|
-
// Build alert element
|
|
113
|
-
const alert = document.createElement('div');
|
|
114
|
-
alert.className = `jux-alert jux-alert-${type}`;
|
|
115
|
-
alert.id = this._id;
|
|
116
|
-
if (className) alert.className += ` ${className}`;
|
|
117
|
-
if (style) alert.setAttribute('style', style);
|
|
118
|
-
|
|
119
|
-
if (icon) {
|
|
120
|
-
const iconEl = document.createElement('span');
|
|
121
|
-
iconEl.className = 'jux-alert-icon';
|
|
122
|
-
iconEl.appendChild(renderIcon(icon));
|
|
123
|
-
alert.appendChild(iconEl);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const contentEl = document.createElement('div');
|
|
127
|
-
contentEl.className = 'jux-alert-content';
|
|
128
|
-
contentEl.textContent = content;
|
|
129
|
-
alert.appendChild(contentEl);
|
|
130
|
-
|
|
131
|
-
if (dismissible) {
|
|
132
|
-
const closeBtn = document.createElement('button');
|
|
133
|
-
closeBtn.className = 'jux-alert-close';
|
|
134
|
-
closeBtn.innerHTML = '×';
|
|
135
|
-
alert.appendChild(closeBtn);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Default dismiss behavior (only if NOT using sync)
|
|
139
|
-
if (!hasVisibleSync && dismissible) {
|
|
140
|
-
const closeBtn = alert.querySelector('.jux-alert-close');
|
|
141
|
-
closeBtn?.addEventListener('click', () => {
|
|
142
|
-
// 🎯 Fire the dismiss callback event
|
|
143
|
-
this._triggerCallback('dismiss');
|
|
144
|
-
alert.remove();
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Wire events using inherited method
|
|
149
|
-
this._wireStandardEvents(alert);
|
|
150
|
-
|
|
151
|
-
// Wire sync bindings
|
|
152
|
-
this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
|
|
153
|
-
if (property === 'content') {
|
|
154
|
-
const transform = toComponent || ((v: any) => String(v));
|
|
155
|
-
|
|
156
|
-
stateObj.subscribe((val: any) => {
|
|
157
|
-
const transformed = transform(val);
|
|
158
|
-
contentEl.textContent = transformed;
|
|
159
|
-
this.state.content = transformed;
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
else if (property === 'type') {
|
|
163
|
-
const transform = toComponent || ((v: any) => String(v));
|
|
164
|
-
|
|
165
|
-
stateObj.subscribe((val: any) => {
|
|
166
|
-
const transformed = transform(val);
|
|
167
|
-
alert.className = `jux-alert jux-alert-${transformed}`;
|
|
168
|
-
if (className) alert.className += ` ${className}`;
|
|
169
|
-
this.state.type = transformed;
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
else if (property === 'visible') {
|
|
173
|
-
const transformToState = toState || ((v: any) => Boolean(v));
|
|
174
|
-
const transform = toComponent || ((v: any) => Boolean(v));
|
|
175
|
-
|
|
176
|
-
let isUpdating = false;
|
|
177
|
-
|
|
178
|
-
// State → Component
|
|
179
|
-
stateObj.subscribe((val: any) => {
|
|
180
|
-
if (isUpdating) return;
|
|
181
|
-
const transformed = transform(val);
|
|
182
|
-
alert.style.display = transformed ? 'flex' : 'none';
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// Component → State (close button)
|
|
186
|
-
if (dismissible) {
|
|
187
|
-
const closeBtn = alert.querySelector('.jux-alert-close');
|
|
188
|
-
closeBtn?.addEventListener('click', () => {
|
|
189
|
-
if (isUpdating) return;
|
|
190
|
-
isUpdating = true;
|
|
191
|
-
|
|
192
|
-
alert.style.display = 'none';
|
|
193
|
-
stateObj.set(transformToState(false));
|
|
194
|
-
|
|
195
|
-
// 🎯 Fire the dismiss callback event
|
|
196
|
-
this._triggerCallback('dismiss');
|
|
197
|
-
|
|
198
|
-
setTimeout(() => { isUpdating = false; }, 0);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
container.appendChild(alert);
|
|
205
|
-
this._alert = alert;
|
|
206
|
-
|
|
207
|
-
requestAnimationFrame(() => {
|
|
208
|
-
if ((window as any).lucide) {
|
|
209
|
-
(window as any).lucide.createIcons();
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
return this;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export function alert(id: string, options: AlertOptions = {}): Alert {
|
|
218
|
-
return new Alert(id, options);
|
|
219
|
-
}
|
package/lib/components/app.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* App component options
|
|
3
|
-
*/
|
|
4
|
-
export interface AppOptions {
|
|
5
|
-
title?: string;
|
|
6
|
-
theme?: 'light' | 'dark' | 'auto';
|
|
7
|
-
favicon?: string;
|
|
8
|
-
meta?: Record<string, string>;
|
|
9
|
-
stylesheets?: string[];
|
|
10
|
-
scripts?: string[];
|
|
11
|
-
layout?: {
|
|
12
|
-
header?: boolean | string;
|
|
13
|
-
subheader?: boolean | string;
|
|
14
|
-
sidebar?: boolean | string;
|
|
15
|
-
main?: boolean | string;
|
|
16
|
-
aside?: boolean | string;
|
|
17
|
-
footer?: boolean | string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* App component state
|
|
22
|
-
*/
|
|
23
|
-
type AppState = {
|
|
24
|
-
title: string;
|
|
25
|
-
theme: string;
|
|
26
|
-
favicon: string;
|
|
27
|
-
meta: Map<string, string>;
|
|
28
|
-
stylesheets: string[];
|
|
29
|
-
scripts: string[];
|
|
30
|
-
layout: {
|
|
31
|
-
header: boolean | string;
|
|
32
|
-
subheader: boolean | string;
|
|
33
|
-
sidebar: boolean | string;
|
|
34
|
-
main: boolean | string;
|
|
35
|
-
aside: boolean | string;
|
|
36
|
-
footer: boolean | string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* App - Configure application-level settings
|
|
41
|
-
* Manages document metadata, theme, and global configuration
|
|
42
|
-
*
|
|
43
|
-
* Usage:
|
|
44
|
-
* jux.app('myApp').setup({
|
|
45
|
-
* title: 'My App',
|
|
46
|
-
* theme: 'dark',
|
|
47
|
-
* favicon: '/favicon.ico',
|
|
48
|
-
* stylesheets: [
|
|
49
|
-
* '/lib/layouts/notion.css',
|
|
50
|
-
* '/lib/presets/light.css'
|
|
51
|
-
* ],
|
|
52
|
-
* layout: {
|
|
53
|
-
* header: true,
|
|
54
|
-
* sidebar: true,
|
|
55
|
-
* main: true,
|
|
56
|
-
* footer: true
|
|
57
|
-
* }
|
|
58
|
-
* });
|
|
59
|
-
*
|
|
60
|
-
* // Or fluent
|
|
61
|
-
* jux.app('myApp')
|
|
62
|
-
* .title('My App')
|
|
63
|
-
* .theme('dark')
|
|
64
|
-
* .addStylesheet('/presets/main.css')
|
|
65
|
-
* .render();
|
|
66
|
-
*/
|
|
67
|
-
export declare class App {
|
|
68
|
-
state: AppState;
|
|
69
|
-
_componentId: string;
|
|
70
|
-
id: string;
|
|
71
|
-
constructor(id: string, options?: AppOptions);
|
|
72
|
-
title(value: string): this;
|
|
73
|
-
theme(value: 'light' | 'dark' | 'auto'): this;
|
|
74
|
-
favicon(value: string): this;
|
|
75
|
-
meta(name: string, content: string): this;
|
|
76
|
-
addStylesheet(url: string): this;
|
|
77
|
-
addScript(url: string): this;
|
|
78
|
-
/**
|
|
79
|
-
* Setup app with comprehensive configuration
|
|
80
|
-
*/
|
|
81
|
-
setup(options: AppOptions): this;
|
|
82
|
-
render(): this;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Factory helper
|
|
86
|
-
*/
|
|
87
|
-
export declare function app(id: string, options?: AppOptions): App;
|
|
88
|
-
export {};
|
|
89
|
-
//# sourceMappingURL=app.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["app.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE;QACP,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QAC1B,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QAC7B,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QAC3B,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QACxB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QACzB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;KAC3B,CAAC;CACH;AAED;;GAEG;AACH,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE;QACN,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;QACzB,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC;QAC5B,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;QAC1B,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;QACvB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;QACxB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,GAAG;IACd,KAAK,EAAE,QAAQ,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;gBAEC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU;IA4B5C,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK1B,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI;IAK7C,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAKzC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAOhC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAO5B;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IA8BhC,MAAM,IAAI,IAAI;CAqEf;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,GAAG,CAEzD"}
|
package/lib/components/app.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* App - Configure application-level settings
|
|
3
|
-
* Manages document metadata, theme, and global configuration
|
|
4
|
-
*
|
|
5
|
-
* Usage:
|
|
6
|
-
* jux.app('myApp').setup({
|
|
7
|
-
* title: 'My App',
|
|
8
|
-
* theme: 'dark',
|
|
9
|
-
* favicon: '/favicon.ico',
|
|
10
|
-
* stylesheets: [
|
|
11
|
-
* '/lib/layouts/notion.css',
|
|
12
|
-
* '/lib/presets/light.css'
|
|
13
|
-
* ],
|
|
14
|
-
* layout: {
|
|
15
|
-
* header: true,
|
|
16
|
-
* sidebar: true,
|
|
17
|
-
* main: true,
|
|
18
|
-
* footer: true
|
|
19
|
-
* }
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* // Or fluent
|
|
23
|
-
* jux.app('myApp')
|
|
24
|
-
* .title('My App')
|
|
25
|
-
* .theme('dark')
|
|
26
|
-
* .addStylesheet('/presets/main.css')
|
|
27
|
-
* .render();
|
|
28
|
-
*/
|
|
29
|
-
export class App {
|
|
30
|
-
constructor(id, options) {
|
|
31
|
-
this._componentId = id;
|
|
32
|
-
this.id = id;
|
|
33
|
-
const opts = options || {};
|
|
34
|
-
this.state = {
|
|
35
|
-
title: opts.title ?? '',
|
|
36
|
-
theme: opts.theme ?? 'auto',
|
|
37
|
-
favicon: opts.favicon ?? '',
|
|
38
|
-
meta: new Map(Object.entries(opts.meta || {})),
|
|
39
|
-
stylesheets: opts.stylesheets || [],
|
|
40
|
-
scripts: opts.scripts || [],
|
|
41
|
-
layout: {
|
|
42
|
-
header: opts.layout?.header ?? false,
|
|
43
|
-
subheader: opts.layout?.subheader ?? false,
|
|
44
|
-
sidebar: opts.layout?.sidebar ?? false,
|
|
45
|
-
main: opts.layout?.main ?? true,
|
|
46
|
-
aside: opts.layout?.aside ?? false,
|
|
47
|
-
footer: opts.layout?.footer ?? false
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
/* -------------------------
|
|
52
|
-
* Fluent API
|
|
53
|
-
* ------------------------- */
|
|
54
|
-
title(value) {
|
|
55
|
-
this.state.title = value;
|
|
56
|
-
return this;
|
|
57
|
-
}
|
|
58
|
-
theme(value) {
|
|
59
|
-
this.state.theme = value;
|
|
60
|
-
return this;
|
|
61
|
-
}
|
|
62
|
-
favicon(value) {
|
|
63
|
-
this.state.favicon = value;
|
|
64
|
-
return this;
|
|
65
|
-
}
|
|
66
|
-
meta(name, content) {
|
|
67
|
-
this.state.meta.set(name, content);
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
addStylesheet(url) {
|
|
71
|
-
if (!this.state.stylesheets.includes(url)) {
|
|
72
|
-
this.state.stylesheets.push(url);
|
|
73
|
-
}
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
|
-
addScript(url) {
|
|
77
|
-
if (!this.state.scripts.includes(url)) {
|
|
78
|
-
this.state.scripts.push(url);
|
|
79
|
-
}
|
|
80
|
-
return this;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Setup app with comprehensive configuration
|
|
84
|
-
*/
|
|
85
|
-
setup(options) {
|
|
86
|
-
if (options.title)
|
|
87
|
-
this.state.title = options.title;
|
|
88
|
-
if (options.theme)
|
|
89
|
-
this.state.theme = options.theme;
|
|
90
|
-
if (options.favicon)
|
|
91
|
-
this.state.favicon = options.favicon;
|
|
92
|
-
if (options.meta) {
|
|
93
|
-
Object.entries(options.meta).forEach(([name, content]) => {
|
|
94
|
-
this.state.meta.set(name, content);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
if (options.stylesheets) {
|
|
98
|
-
options.stylesheets.forEach(url => this.addStylesheet(url));
|
|
99
|
-
}
|
|
100
|
-
if (options.scripts) {
|
|
101
|
-
options.scripts.forEach(url => this.addScript(url));
|
|
102
|
-
}
|
|
103
|
-
if (options.layout) {
|
|
104
|
-
this.state.layout = { ...this.state.layout, ...options.layout };
|
|
105
|
-
}
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
108
|
-
/* -------------------------
|
|
109
|
-
* Render
|
|
110
|
-
* ------------------------- */
|
|
111
|
-
render() {
|
|
112
|
-
if (typeof document === 'undefined')
|
|
113
|
-
return this;
|
|
114
|
-
try {
|
|
115
|
-
const { title, theme, favicon, meta, stylesheets, scripts } = this.state;
|
|
116
|
-
// Apply title
|
|
117
|
-
if (title) {
|
|
118
|
-
document.title = title;
|
|
119
|
-
}
|
|
120
|
-
// Apply theme
|
|
121
|
-
if (theme) {
|
|
122
|
-
document.body.setAttribute('data-theme', theme);
|
|
123
|
-
document.body.classList.remove('theme-light', 'theme-dark', 'theme-auto');
|
|
124
|
-
document.body.classList.add(`theme-${theme}`);
|
|
125
|
-
}
|
|
126
|
-
// Apply favicon
|
|
127
|
-
if (favicon) {
|
|
128
|
-
let link = document.querySelector('link[rel="icon"]');
|
|
129
|
-
if (!link) {
|
|
130
|
-
link = document.createElement('link');
|
|
131
|
-
link.rel = 'icon';
|
|
132
|
-
document.head.appendChild(link);
|
|
133
|
-
}
|
|
134
|
-
link.href = favicon;
|
|
135
|
-
}
|
|
136
|
-
// Apply meta tags
|
|
137
|
-
meta.forEach((content, name) => {
|
|
138
|
-
let metaEl = document.querySelector(`meta[name="${name}"]`);
|
|
139
|
-
if (!metaEl) {
|
|
140
|
-
metaEl = document.createElement('meta');
|
|
141
|
-
metaEl.name = name;
|
|
142
|
-
document.head.appendChild(metaEl);
|
|
143
|
-
}
|
|
144
|
-
metaEl.content = content;
|
|
145
|
-
});
|
|
146
|
-
// Load stylesheets
|
|
147
|
-
stylesheets.forEach(url => {
|
|
148
|
-
if (!document.querySelector(`link[href="${url}"]`)) {
|
|
149
|
-
const link = document.createElement('link');
|
|
150
|
-
link.rel = 'stylesheet';
|
|
151
|
-
link.href = url;
|
|
152
|
-
document.head.appendChild(link);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
// Load scripts
|
|
156
|
-
scripts.forEach(url => {
|
|
157
|
-
if (!document.querySelector(`script[src="${url}"]`)) {
|
|
158
|
-
const script = document.createElement('script');
|
|
159
|
-
script.src = url;
|
|
160
|
-
document.head.appendChild(script);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
throw new Error(`App render failed: ${error.message}`);
|
|
166
|
-
}
|
|
167
|
-
return this;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Factory helper
|
|
172
|
-
*/
|
|
173
|
-
export function app(id, options) {
|
|
174
|
-
return new App(id, options);
|
|
175
|
-
}
|