juxscript 1.1.240 → 1.1.244
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/include.ts +229 -229
- package/lib/components/tag.ts +68 -0
- package/lib/styles/shadcn.css +17 -5
- 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/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
|
@@ -6,248 +6,248 @@
|
|
|
6
6
|
type ResourceType = 'css' | 'js' | 'module';
|
|
7
7
|
|
|
8
8
|
interface IncludeOptions {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
type?: ResourceType;
|
|
10
|
+
target?: string; // CSS selector for target container (default: 'head')
|
|
11
|
+
async?: boolean;
|
|
12
|
+
defer?: boolean;
|
|
13
|
+
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
14
|
+
integrity?: string;
|
|
15
|
+
pageScoped?: boolean; // If true, tracks for cleanup
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// Global registry for page-scoped resources
|
|
19
19
|
const scopedResources: Map<string, Set<HTMLElement>> = new Map();
|
|
20
20
|
|
|
21
21
|
export class Include {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
private url: string;
|
|
23
|
+
private options: IncludeOptions;
|
|
24
|
+
private element: HTMLElement | null = null;
|
|
25
|
+
private pageId: string | null = null;
|
|
26
|
+
|
|
27
|
+
constructor(url: string, options: IncludeOptions = {}) {
|
|
28
|
+
this.url = url;
|
|
29
|
+
this.options = options;
|
|
30
|
+
|
|
31
|
+
// Auto-detect type from extension if not provided
|
|
32
|
+
if (!options.type) {
|
|
33
|
+
if (url.endsWith('.css')) {
|
|
34
|
+
this.options.type = 'css';
|
|
35
|
+
} else if (url.endsWith('.mjs') || url.endsWith('.module.js')) {
|
|
36
|
+
this.options.type = 'module';
|
|
37
|
+
} else {
|
|
38
|
+
this.options.type = 'js';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* -------------------------
|
|
44
|
+
* Fluent API
|
|
45
|
+
* ------------------------- */
|
|
46
|
+
|
|
47
|
+
css(): this {
|
|
34
48
|
this.options.type = 'css';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
js(): this {
|
|
38
53
|
this.options.type = 'js';
|
|
39
|
-
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module(): this {
|
|
58
|
+
this.options.type = 'module';
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async(): this {
|
|
63
|
+
this.options.async = true;
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
defer(): this {
|
|
68
|
+
this.options.defer = true;
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Inject into specific container instead of <head>
|
|
74
|
+
* Useful for page-specific styles
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* jux.include('/css/page1.css').into('#page1-container');
|
|
78
|
+
*/
|
|
79
|
+
into(selector: string): this {
|
|
80
|
+
this.options.target = selector;
|
|
81
|
+
return this;
|
|
40
82
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
js(): this {
|
|
53
|
-
this.options.type = 'js';
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
module(): this {
|
|
58
|
-
this.options.type = 'module';
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async(): this {
|
|
63
|
-
this.options.async = true;
|
|
64
|
-
return this;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
defer(): this {
|
|
68
|
-
this.options.defer = true;
|
|
69
|
-
return this;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Inject into specific container instead of <head>
|
|
74
|
-
* Useful for page-specific styles
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* jux.include('/css/page1.css').into('#page1-container');
|
|
78
|
-
*/
|
|
79
|
-
into(selector: string): this {
|
|
80
|
-
this.options.target = selector;
|
|
81
|
-
return this;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Mark as page-scoped for automatic cleanup
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* jux.include('/css/dashboard.css').forPage('dashboard');
|
|
89
|
-
* // Later: Include.cleanupPage('dashboard');
|
|
90
|
-
*/
|
|
91
|
-
forPage(pageId: string): this {
|
|
92
|
-
this.pageId = pageId;
|
|
93
|
-
this.options.pageScoped = true;
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* -------------------------
|
|
98
|
-
* Render
|
|
99
|
-
* ------------------------- */
|
|
100
|
-
|
|
101
|
-
render(): this {
|
|
102
|
-
if (typeof document === 'undefined') return this;
|
|
103
|
-
|
|
104
|
-
try {
|
|
105
|
-
// Check if already loaded
|
|
106
|
-
if (this.isAlreadyLoaded()) {
|
|
107
|
-
console.log(`⚠️ Resource already loaded: ${this.url}`);
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Mark as page-scoped for automatic cleanup
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* jux.include('/css/dashboard.css').forPage('dashboard');
|
|
89
|
+
* // Later: Include.cleanupPage('dashboard');
|
|
90
|
+
*/
|
|
91
|
+
forPage(pageId: string): this {
|
|
92
|
+
this.pageId = pageId;
|
|
93
|
+
this.options.pageScoped = true;
|
|
108
94
|
return this;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* -------------------------
|
|
98
|
+
* Render
|
|
99
|
+
* ------------------------- */
|
|
100
|
+
|
|
101
|
+
render(): this {
|
|
102
|
+
if (typeof document === 'undefined') return this;
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
// Check if already loaded
|
|
106
|
+
if (this.isAlreadyLoaded()) {
|
|
107
|
+
console.log(`⚠️ Resource already loaded: ${this.url}`);
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Create element based on type
|
|
112
|
+
let element: HTMLElement;
|
|
113
|
+
|
|
114
|
+
switch (this.options.type) {
|
|
115
|
+
case 'css':
|
|
116
|
+
element = this.createStylesheet();
|
|
117
|
+
break;
|
|
118
|
+
case 'js':
|
|
119
|
+
case 'module':
|
|
120
|
+
element = this.createScript();
|
|
121
|
+
break;
|
|
122
|
+
default:
|
|
123
|
+
throw new Error(`Unknown resource type: ${this.options.type}`);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Get target container
|
|
127
|
+
const container = this.getContainer();
|
|
128
|
+
container.appendChild(element);
|
|
129
|
+
|
|
130
|
+
this.element = element;
|
|
131
|
+
|
|
132
|
+
// Register for page cleanup if needed
|
|
133
|
+
if (this.options.pageScoped && this.pageId) {
|
|
134
|
+
if (!scopedResources.has(this.pageId)) {
|
|
135
|
+
scopedResources.set(this.pageId, new Set());
|
|
136
|
+
}
|
|
137
|
+
scopedResources.get(this.pageId)!.add(element);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
console.log(`✓ Loaded ${this.options.type}: ${this.url}`);
|
|
141
|
+
} catch (error: any) {
|
|
142
|
+
console.error(`✗ Failed to load ${this.options.type}: ${this.url}`, error);
|
|
143
|
+
throw error;
|
|
136
144
|
}
|
|
137
|
-
scopedResources.get(this.pageId)!.add(element);
|
|
138
|
-
}
|
|
139
145
|
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* -------------------------
|
|
150
|
+
* Element Creation
|
|
151
|
+
* ------------------------- */
|
|
152
|
+
|
|
153
|
+
private createStylesheet(): HTMLLinkElement {
|
|
154
|
+
const link = document.createElement('link');
|
|
155
|
+
link.rel = 'stylesheet';
|
|
156
|
+
link.href = this.url;
|
|
157
|
+
link.dataset.juxInclude = this.url;
|
|
158
|
+
|
|
159
|
+
if (this.options.crossOrigin) link.crossOrigin = this.options.crossOrigin;
|
|
160
|
+
if (this.options.integrity) link.integrity = this.options.integrity;
|
|
161
|
+
|
|
162
|
+
link.onload = () => console.log(`✓ Stylesheet loaded: ${this.url}`);
|
|
163
|
+
link.onerror = () => {
|
|
164
|
+
throw new Error(`Failed to load stylesheet: ${this.url}`);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
return link;
|
|
144
168
|
}
|
|
145
169
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
link.onerror = () => {
|
|
164
|
-
throw new Error(`Failed to load stylesheet: ${this.url}`);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
return link;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
private createScript(): HTMLScriptElement {
|
|
171
|
-
const script = document.createElement('script');
|
|
172
|
-
script.src = this.url;
|
|
173
|
-
script.dataset.juxInclude = this.url;
|
|
174
|
-
|
|
175
|
-
if (this.options.type === 'module') script.type = 'module';
|
|
176
|
-
if (this.options.async) script.async = true;
|
|
177
|
-
if (this.options.defer) script.defer = true;
|
|
178
|
-
if (this.options.crossOrigin) script.crossOrigin = this.options.crossOrigin;
|
|
179
|
-
if (this.options.integrity) script.integrity = this.options.integrity;
|
|
180
|
-
|
|
181
|
-
script.onload = () => console.log(`✓ Script loaded: ${this.url}`);
|
|
182
|
-
script.onerror = () => {
|
|
183
|
-
throw new Error(`Failed to load script: ${this.url}`);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
return script;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/* -------------------------
|
|
190
|
-
* Helpers
|
|
191
|
-
* ------------------------- */
|
|
192
|
-
|
|
193
|
-
private getContainer(): HTMLElement {
|
|
194
|
-
if (this.options.target) {
|
|
195
|
-
const container = document.querySelector(this.options.target);
|
|
196
|
-
if (!container) {
|
|
197
|
-
throw new Error(`Target container not found: ${this.options.target}`);
|
|
198
|
-
}
|
|
199
|
-
return container as HTMLElement;
|
|
170
|
+
private createScript(): HTMLScriptElement {
|
|
171
|
+
const script = document.createElement('script');
|
|
172
|
+
script.src = this.url;
|
|
173
|
+
script.dataset.juxInclude = this.url;
|
|
174
|
+
|
|
175
|
+
if (this.options.type === 'module') script.type = 'module';
|
|
176
|
+
if (this.options.async) script.async = true;
|
|
177
|
+
if (this.options.defer) script.defer = true;
|
|
178
|
+
if (this.options.crossOrigin) script.crossOrigin = this.options.crossOrigin;
|
|
179
|
+
if (this.options.integrity) script.integrity = this.options.integrity;
|
|
180
|
+
|
|
181
|
+
script.onload = () => console.log(`✓ Script loaded: ${this.url}`);
|
|
182
|
+
script.onerror = () => {
|
|
183
|
+
throw new Error(`Failed to load script: ${this.url}`);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
return script;
|
|
200
187
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
188
|
+
|
|
189
|
+
/* -------------------------
|
|
190
|
+
* Helpers
|
|
191
|
+
* ------------------------- */
|
|
192
|
+
|
|
193
|
+
private getContainer(): HTMLElement {
|
|
194
|
+
if (this.options.target) {
|
|
195
|
+
const container = document.querySelector(this.options.target);
|
|
196
|
+
if (!container) {
|
|
197
|
+
throw new Error(`Target container not found: ${this.options.target}`);
|
|
198
|
+
}
|
|
199
|
+
return container as HTMLElement;
|
|
200
|
+
}
|
|
201
|
+
return document.head;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
private isAlreadyLoaded(): boolean {
|
|
205
|
+
const selector = `[data-jux-include="${this.url}"]`;
|
|
206
|
+
return document.querySelector(selector) !== null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
remove(): this {
|
|
210
|
+
if (this.element?.parentNode) {
|
|
211
|
+
this.element.parentNode.removeChild(this.element);
|
|
212
|
+
this.element = null;
|
|
213
|
+
}
|
|
214
|
+
return this;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* -------------------------
|
|
218
|
+
* Static Page Cleanup
|
|
219
|
+
* ------------------------- */
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Remove all resources for a specific page
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* Include.cleanupPage('dashboard');
|
|
226
|
+
*/
|
|
227
|
+
static cleanupPage(pageId: string): void {
|
|
228
|
+
const resources = scopedResources.get(pageId);
|
|
229
|
+
if (!resources) return;
|
|
230
|
+
|
|
231
|
+
resources.forEach(element => {
|
|
232
|
+
element.parentNode?.removeChild(element);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
scopedResources.delete(pageId);
|
|
236
|
+
console.log(`✓ Cleaned up page resources: ${pageId}`);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Remove all page-scoped resources
|
|
241
|
+
*/
|
|
242
|
+
static cleanupAll(): void {
|
|
243
|
+
scopedResources.forEach((resources, pageId) => {
|
|
244
|
+
resources.forEach(element => {
|
|
245
|
+
element.parentNode?.removeChild(element);
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
scopedResources.clear();
|
|
249
|
+
console.log('✓ Cleaned up all page-scoped resources');
|
|
213
250
|
}
|
|
214
|
-
return this;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/* -------------------------
|
|
218
|
-
* Static Page Cleanup
|
|
219
|
-
* ------------------------- */
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Remove all resources for a specific page
|
|
223
|
-
*
|
|
224
|
-
* @example
|
|
225
|
-
* Include.cleanupPage('dashboard');
|
|
226
|
-
*/
|
|
227
|
-
static cleanupPage(pageId: string): void {
|
|
228
|
-
const resources = scopedResources.get(pageId);
|
|
229
|
-
if (!resources) return;
|
|
230
|
-
|
|
231
|
-
resources.forEach(element => {
|
|
232
|
-
element.parentNode?.removeChild(element);
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
scopedResources.delete(pageId);
|
|
236
|
-
console.log(`✓ Cleaned up page resources: ${pageId}`);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Remove all page-scoped resources
|
|
241
|
-
*/
|
|
242
|
-
static cleanupAll(): void {
|
|
243
|
-
scopedResources.forEach((resources, pageId) => {
|
|
244
|
-
resources.forEach(element => {
|
|
245
|
-
element.parentNode?.removeChild(element);
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
scopedResources.clear();
|
|
249
|
-
console.log('✓ Cleaned up all page-scoped resources');
|
|
250
|
-
}
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
/**
|
|
@@ -275,7 +275,7 @@ export class Include {
|
|
|
275
275
|
* jux.include('/js/app.mjs').module();
|
|
276
276
|
*/
|
|
277
277
|
export function include(url: string, options?: IncludeOptions): Include {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
const inc = new Include(url, options);
|
|
279
|
+
inc.render();
|
|
280
|
+
return inc;
|
|
281
281
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import generateId from '../utils/idgen';
|
|
2
|
+
|
|
3
|
+
interface TagProps {
|
|
4
|
+
id: string;
|
|
5
|
+
tagName: string;
|
|
6
|
+
content?: string;
|
|
7
|
+
options?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
class Tag extends HTMLElement {
|
|
10
|
+
content: string;
|
|
11
|
+
options: Record<string, string>;
|
|
12
|
+
constructor(data: Partial<TagProps>) {
|
|
13
|
+
super();
|
|
14
|
+
this.id = generateId();
|
|
15
|
+
this.content = data.content || '';
|
|
16
|
+
this.options = data.options || {};
|
|
17
|
+
}
|
|
18
|
+
modify() {
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
render() {
|
|
23
|
+
const el = document.createElement(this.tagName);
|
|
24
|
+
el.textContent = this.content;
|
|
25
|
+
for (const [key, value] of Object.entries(this.options)) {
|
|
26
|
+
el.setAttribute(key, value);
|
|
27
|
+
}
|
|
28
|
+
return el;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function tag(data: Partial<TagProps>): Tag {
|
|
33
|
+
const t = new Tag(data);
|
|
34
|
+
return t;
|
|
35
|
+
}
|
|
36
|
+
export function div(data: Partial<TagProps>): Tag {
|
|
37
|
+
return tag({ ...data, tagName: 'div' });
|
|
38
|
+
}
|
|
39
|
+
export function span(data: Partial<TagProps>): Tag {
|
|
40
|
+
return tag({ ...data, tagName: 'span' });
|
|
41
|
+
}
|
|
42
|
+
export function p(data: Partial<TagProps>): Tag {
|
|
43
|
+
return tag({ ...data, tagName: 'p' });
|
|
44
|
+
}
|
|
45
|
+
export function code(data: Partial<TagProps>): Tag {
|
|
46
|
+
return tag({ ...data, tagName: 'code' });
|
|
47
|
+
}
|
|
48
|
+
export function pre(data: Partial<TagProps>): Tag {
|
|
49
|
+
return tag({ ...data, tagName: 'pre' });
|
|
50
|
+
}
|
|
51
|
+
export function h1(data: Partial<TagProps>): Tag {
|
|
52
|
+
return tag({ ...data, tagName: 'h1' });
|
|
53
|
+
}
|
|
54
|
+
export function h2(data: Partial<TagProps>): Tag {
|
|
55
|
+
return tag({ ...data, tagName: 'h2' });
|
|
56
|
+
}
|
|
57
|
+
export function h3(data: Partial<TagProps>): Tag {
|
|
58
|
+
return tag({ ...data, tagName: 'h3' });
|
|
59
|
+
}
|
|
60
|
+
export function h4(data: Partial<TagProps>): Tag {
|
|
61
|
+
return tag({ ...data, tagName: 'h4' });
|
|
62
|
+
}
|
|
63
|
+
export function h5(data: Partial<TagProps>): Tag {
|
|
64
|
+
return tag({ ...data, tagName: 'h5' });
|
|
65
|
+
}
|
|
66
|
+
export function h6(data: Partial<TagProps>): Tag {
|
|
67
|
+
return tag({ ...data, tagName: 'h6' });
|
|
68
|
+
}
|
package/lib/styles/shadcn.css
CHANGED
|
@@ -758,7 +758,21 @@ code {
|
|
|
758
758
|
|
|
759
759
|
.jux-hstack {
|
|
760
760
|
flex-direction: row;
|
|
761
|
-
flex-wrap:
|
|
761
|
+
flex-wrap: nowrap; /* ✅ Don't wrap — stay horizontal */
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/* ✅ HStack children share space equally */
|
|
765
|
+
.jux-hstack > * {
|
|
766
|
+
flex: 1;
|
|
767
|
+
min-width: 0;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/* ✅ Opt out for intrinsic-size elements */
|
|
771
|
+
.jux-hstack > button,
|
|
772
|
+
.jux-hstack > .jux-button,
|
|
773
|
+
.jux-hstack > .jux-icon,
|
|
774
|
+
.jux-hstack > .jux-fileupload {
|
|
775
|
+
flex: none;
|
|
762
776
|
}
|
|
763
777
|
|
|
764
778
|
/* ═════════════════════════════════════════════════════════════════
|
|
@@ -805,13 +819,11 @@ code {
|
|
|
805
819
|
|
|
806
820
|
@media (max-width: 768px) {
|
|
807
821
|
.jux-hstack {
|
|
808
|
-
flex-
|
|
809
|
-
/* Gap remains consistent via CSS variables */
|
|
822
|
+
flex-wrap: wrap; /* ✅ Only wrap on mobile */
|
|
810
823
|
}
|
|
811
824
|
|
|
812
|
-
/* Optional: Force HStack to stay horizontal on mobile */
|
|
813
825
|
.jux-hstack.stay-horizontal {
|
|
814
|
-
flex-
|
|
826
|
+
flex-wrap: nowrap;
|
|
815
827
|
}
|
|
816
828
|
}
|
|
817
829
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "juxscript",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.244",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A JavaScript UX authorship platform",
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"types": "index.d.ts",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
8
|
"access": "public",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -12,9 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"default": "./index.js"
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
18
17
|
},
|
|
19
18
|
"./package.json": "./package.json"
|
|
20
19
|
},
|