juxscript 1.1.362 → 1.1.363
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/package.json +1 -1
- package/dist/lib/components/blocks/menu.d.ts +0 -40
- package/dist/lib/components/blocks/menu.d.ts.map +0 -1
- package/dist/lib/components/blocks/menu.js +0 -136
- package/dist/lib/components/button.d.ts +0 -33
- package/dist/lib/components/button.d.ts.map +0 -1
- package/dist/lib/components/button.js +0 -107
- package/dist/lib/components/checkbox.d.ts +0 -62
- package/dist/lib/components/checkbox.d.ts.map +0 -1
- package/dist/lib/components/checkbox.js +0 -178
- package/dist/lib/components/container.d.ts +0 -58
- package/dist/lib/components/container.d.ts.map +0 -1
- package/dist/lib/components/container.js +0 -151
- package/dist/lib/components/data.d.ts +0 -58
- package/dist/lib/components/data.d.ts.map +0 -1
- package/dist/lib/components/data.js +0 -130
- package/dist/lib/components/grid.d.ts +0 -58
- package/dist/lib/components/grid.d.ts.map +0 -1
- package/dist/lib/components/grid.js +0 -127
- package/dist/lib/components/include.d.ts +0 -86
- package/dist/lib/components/include.d.ts.map +0 -1
- package/dist/lib/components/include.js +0 -238
- package/dist/lib/components/input.d.ts +0 -58
- package/dist/lib/components/input.d.ts.map +0 -1
- package/dist/lib/components/input.js +0 -161
- package/dist/lib/components/link.d.ts +0 -35
- package/dist/lib/components/link.d.ts.map +0 -1
- package/dist/lib/components/link.js +0 -135
- package/dist/lib/components/list.d.ts +0 -48
- package/dist/lib/components/list.d.ts.map +0 -1
- package/dist/lib/components/list.js +0 -178
- package/dist/lib/components/nav.d.ts +0 -46
- package/dist/lib/components/nav.d.ts.map +0 -1
- package/dist/lib/components/nav.js +0 -189
- package/dist/lib/components/radio.d.ts +0 -40
- package/dist/lib/components/radio.d.ts.map +0 -1
- package/dist/lib/components/radio.js +0 -112
- package/dist/lib/components/select.d.ts +0 -41
- package/dist/lib/components/select.d.ts.map +0 -1
- package/dist/lib/components/select.js +0 -111
- package/dist/lib/components/sidebar.d.ts +0 -40
- package/dist/lib/components/sidebar.d.ts.map +0 -1
- package/dist/lib/components/sidebar.js +0 -141
- package/dist/lib/components/store.d.ts +0 -78
- package/dist/lib/components/store.d.ts.map +0 -1
- package/dist/lib/components/store.js +0 -248
- package/dist/lib/components/style.d.ts +0 -27
- package/dist/lib/components/style.d.ts.map +0 -1
- package/dist/lib/components/style.js +0 -52
- package/dist/lib/components/table.d.ts +0 -56
- package/dist/lib/components/table.d.ts.map +0 -1
- package/dist/lib/components/table.js +0 -199
- package/dist/lib/components/tabs.d.ts +0 -52
- package/dist/lib/components/tabs.d.ts.map +0 -1
- package/dist/lib/components/tabs.js +0 -206
- package/dist/lib/components/tag.d.ts +0 -41
- package/dist/lib/components/tag.d.ts.map +0 -1
- package/dist/lib/components/tag.js +0 -103
- package/dist/lib/devtools/devtools.d.ts +0 -3
- package/dist/lib/devtools/devtools.d.ts.map +0 -1
- package/dist/lib/devtools/devtools.js +0 -181
- package/dist/lib/index.d.ts +0 -68
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.js +0 -63
- package/dist/lib/state/pageState.d.ts +0 -19
- package/dist/lib/state/pageState.d.ts.map +0 -1
- package/dist/lib/state/pageState.js +0 -360
- package/dist/lib/utils/codeHighlight.d.ts +0 -7
- package/dist/lib/utils/codeHighlight.d.ts.map +0 -1
- package/dist/lib/utils/codeHighlight.js +0 -105
- package/dist/lib/utils/codeparser.d.ts +0 -29
- package/dist/lib/utils/codeparser.d.ts.map +0 -1
- package/dist/lib/utils/codeparser.js +0 -384
- package/dist/lib/utils/fetch.d.ts +0 -176
- package/dist/lib/utils/fetch.d.ts.map +0 -1
- package/dist/lib/utils/fetch.js +0 -427
- package/dist/lib/utils/formatId.d.ts +0 -16
- package/dist/lib/utils/formatId.d.ts.map +0 -1
- package/dist/lib/utils/formatId.js +0 -27
- package/dist/lib/utils/idgen.d.ts +0 -2
- package/dist/lib/utils/idgen.d.ts.map +0 -1
- package/dist/lib/utils/idgen.js +0 -4
- package/dist/lib/utils/niceName.d.ts +0 -14
- package/dist/lib/utils/niceName.d.ts.map +0 -1
- package/dist/lib/utils/niceName.js +0 -22
package/package.json
CHANGED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
interface MenuItem {
|
|
2
|
-
id: string;
|
|
3
|
-
label: string;
|
|
4
|
-
path: string;
|
|
5
|
-
icon?: string;
|
|
6
|
-
}
|
|
7
|
-
interface MenuOptions {
|
|
8
|
-
title?: string;
|
|
9
|
-
logo?: string;
|
|
10
|
-
footer?: string;
|
|
11
|
-
width?: string;
|
|
12
|
-
target?: string;
|
|
13
|
-
density?: 'dense' | 'normal' | 'inflated';
|
|
14
|
-
}
|
|
15
|
-
interface MenuApi {
|
|
16
|
-
id: string;
|
|
17
|
-
title: (val: string) => MenuApi;
|
|
18
|
-
logo: (val: string) => MenuApi;
|
|
19
|
-
footer: (val: string) => MenuApi;
|
|
20
|
-
width: (val: string) => MenuApi;
|
|
21
|
-
target: (val: string) => MenuApi;
|
|
22
|
-
density: (val: 'dense' | 'normal' | 'inflated') => MenuApi;
|
|
23
|
-
section: (label: string, items: (string | MenuItem)[]) => MenuApi;
|
|
24
|
-
items: (items: (string | MenuItem)[]) => MenuApi;
|
|
25
|
-
render: () => MenuApi;
|
|
26
|
-
addSection: (label: string, items: (string | MenuItem)[]) => MenuApi;
|
|
27
|
-
setTitle: (val: string) => MenuApi;
|
|
28
|
-
setFooter: (val: string) => MenuApi;
|
|
29
|
-
show: () => MenuApi;
|
|
30
|
-
hide: () => MenuApi;
|
|
31
|
-
toggle: () => MenuApi;
|
|
32
|
-
getElement: () => HTMLElement | null;
|
|
33
|
-
}
|
|
34
|
-
type SectionInput = string | {
|
|
35
|
-
label?: string;
|
|
36
|
-
items?: (string | MenuItem)[];
|
|
37
|
-
};
|
|
38
|
-
export declare function menu(id: string, sections?: SectionInput[], options?: MenuOptions): MenuApi;
|
|
39
|
-
export {};
|
|
40
|
-
//# sourceMappingURL=menu.d.ts.map
|
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MAAM,EAAE,KAAK,EAAE,CAAC,MAAM,GAAG,QAAQ,CAAC,EAAE,KAAK,OAAO,CAAC;IACrE,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACnC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,IAAI,EAAE,MAAM,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;CACxC;AAED,KAAK,YAAY,GAAG,MAAM,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,QAAQ,CAAC,EAAE,CAAA;CAAE,CAAC;AAE/E,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CA4I1F"}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { jux, pageState } from 'juxscript';
|
|
2
|
-
export function menu(id, sections, options) {
|
|
3
|
-
const opts = options || {};
|
|
4
|
-
let _title = opts.title || 'App';
|
|
5
|
-
let _logo = opts.logo || _title.charAt(0).toUpperCase();
|
|
6
|
-
let _footer = opts.footer || '';
|
|
7
|
-
let _width = opts.width || '260px';
|
|
8
|
-
let _target = opts.target;
|
|
9
|
-
let _density = opts.density || 'normal';
|
|
10
|
-
let _sectionCount = 0;
|
|
11
|
-
let _rendered = false;
|
|
12
|
-
let _footerRendered = false;
|
|
13
|
-
const DENSITY = {
|
|
14
|
-
dense: { headerPad: '10px', itemPad: '4px 10px', labelPad: '6px 10px 2px', footerPad: '8px 12px', gap: '0px', fontSize: '12px', iconSize: '13px' },
|
|
15
|
-
normal: { headerPad: '16px', itemPad: '8px 12px', labelPad: '8px 12px 4px', footerPad: '12px 16px', gap: '1px', fontSize: '13px', iconSize: '15px' },
|
|
16
|
-
inflated: { headerPad: '20px', itemPad: '12px 16px', labelPad: '12px 16px 6px', footerPad: '16px 20px', gap: '4px', fontSize: '14px', iconSize: '17px' }
|
|
17
|
-
};
|
|
18
|
-
function normalizeItem(item) {
|
|
19
|
-
if (typeof item === 'string') {
|
|
20
|
-
const path = item.startsWith('/') ? item : '/' + item;
|
|
21
|
-
const seg = path.split('/').filter(Boolean).pop() || 'Home';
|
|
22
|
-
return { id: id + '-' + seg.toLowerCase().replace(/[^a-z0-9]/g, '-'), label: seg.charAt(0).toUpperCase() + seg.slice(1), path: path };
|
|
23
|
-
}
|
|
24
|
-
return item;
|
|
25
|
-
}
|
|
26
|
-
function normalizeSections(input) {
|
|
27
|
-
if (!input || !Array.isArray(input) || input.length === 0)
|
|
28
|
-
return [];
|
|
29
|
-
const isFlat = input.every((i) => typeof i === 'string' || (typeof i === 'object' && !('items' in i)));
|
|
30
|
-
if (isFlat)
|
|
31
|
-
return [{ items: input.map(normalizeItem) }];
|
|
32
|
-
return input.map((s) => {
|
|
33
|
-
if (typeof s === 'string')
|
|
34
|
-
return { items: [normalizeItem(s)] };
|
|
35
|
-
return { label: s.label, items: (s.items || []).map(normalizeItem) };
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function ensureShell() {
|
|
39
|
-
if (_rendered)
|
|
40
|
-
return;
|
|
41
|
-
_rendered = true;
|
|
42
|
-
injectStyles();
|
|
43
|
-
jux.div(id, { class: 'jux-sidebar jux-sidebar--' + _density, style: 'width:' + _width, target: _target });
|
|
44
|
-
jux.div(id + '-header', { class: 'jux-sidebar-header', target: id });
|
|
45
|
-
jux.div(id + '-logo', { class: 'jux-sidebar-logo', content: _logo, target: id + '-header' });
|
|
46
|
-
jux.span(id + '-title', { content: _title, target: id + '-header' });
|
|
47
|
-
}
|
|
48
|
-
function renderSection(section) {
|
|
49
|
-
ensureShell();
|
|
50
|
-
const i = _sectionCount++;
|
|
51
|
-
if (i > 0)
|
|
52
|
-
jux.div(id + '-divider-' + i, { class: 'jux-sidebar-divider', target: id });
|
|
53
|
-
if (section.label)
|
|
54
|
-
jux.div(id + '-label-' + i, { class: 'jux-sidebar-label', content: section.label, target: id });
|
|
55
|
-
jux.nav(id + '-nav-' + i, { target: id, items: section.items });
|
|
56
|
-
}
|
|
57
|
-
function renderFooter() {
|
|
58
|
-
if (_footerRendered || !_footer)
|
|
59
|
-
return;
|
|
60
|
-
_footerRendered = true;
|
|
61
|
-
jux.div(id + '-footer', { class: 'jux-sidebar-footer', content: _footer, target: id });
|
|
62
|
-
}
|
|
63
|
-
function injectStyles() {
|
|
64
|
-
jux.style('menu-styles', '\
|
|
65
|
-
body { margin: 0; }\
|
|
66
|
-
.jux-sidebar { display:flex; flex-direction:column; min-height:100vh; background:hsl(var(--card)); color:hsl(var(--card-foreground)); border-right:1px solid hsl(var(--border)); font-family:var(--font-sans,system-ui,sans-serif); }\
|
|
67
|
-
.jux-sidebar-header { display:flex; align-items:center; gap:8px; font-size:14px; font-weight:600; border-bottom:1px solid hsl(var(--border)); }\
|
|
68
|
-
.jux-sidebar-logo { width:20px; height:20px; border-radius:6px; background:hsl(var(--primary)); display:flex; align-items:center; justify-content:center; color:hsl(var(--primary-foreground)); font-size:11px; font-weight:700; }\
|
|
69
|
-
.jux-sidebar-label { font-size:11px; font-weight:500; color:hsl(var(--muted-foreground)); text-transform:uppercase; letter-spacing:0.05em; }\
|
|
70
|
-
.jux-sidebar-footer { margin-top:auto; border-top:1px solid hsl(var(--border)); font-size:11px; color:hsl(var(--muted-foreground)); }\
|
|
71
|
-
.jux-sidebar-divider { height:1px; background:hsl(var(--border)); margin:4px 8px; }\
|
|
72
|
-
.jux-nav-item { display:flex; align-items:center; border-radius:var(--radius,6px); font-weight:500; color:hsl(var(--foreground)); cursor:pointer; transition:background 0.15s; user-select:none; text-decoration:none; }\
|
|
73
|
-
.jux-nav-item:hover { background:hsl(var(--accent)); color:hsl(var(--accent-foreground)); }\
|
|
74
|
-
.jux-nav-item--active { background:hsl(var(--accent)); color:hsl(var(--accent-foreground)); font-weight:600; }\
|
|
75
|
-
.jux-nav-item-icon { text-align:center; flex-shrink:0; }\
|
|
76
|
-
\
|
|
77
|
-
.jux-sidebar--dense .jux-sidebar-header { padding:' + DENSITY.dense.headerPad + '; }\
|
|
78
|
-
.jux-sidebar--dense .jux-sidebar-label { padding:' + DENSITY.dense.labelPad + '; }\
|
|
79
|
-
.jux-sidebar--dense .jux-sidebar-footer { padding:' + DENSITY.dense.footerPad + '; }\
|
|
80
|
-
.jux-sidebar--dense .jux-nav-item { padding:' + DENSITY.dense.itemPad + '; margin:' + DENSITY.dense.gap + ' 0; font-size:' + DENSITY.dense.fontSize + '; gap:8px; }\
|
|
81
|
-
.jux-sidebar--dense .jux-nav-item-icon { width:16px; font-size:' + DENSITY.dense.iconSize + '; }\
|
|
82
|
-
\
|
|
83
|
-
.jux-sidebar--normal .jux-sidebar-header { padding:' + DENSITY.normal.headerPad + '; }\
|
|
84
|
-
.jux-sidebar--normal .jux-sidebar-label { padding:' + DENSITY.normal.labelPad + '; }\
|
|
85
|
-
.jux-sidebar--normal .jux-sidebar-footer { padding:' + DENSITY.normal.footerPad + '; }\
|
|
86
|
-
.jux-sidebar--normal .jux-nav-item { padding:' + DENSITY.normal.itemPad + '; margin:' + DENSITY.normal.gap + ' 0; font-size:' + DENSITY.normal.fontSize + '; gap:10px; }\
|
|
87
|
-
.jux-sidebar--normal .jux-nav-item-icon { width:18px; font-size:' + DENSITY.normal.iconSize + '; }\
|
|
88
|
-
\
|
|
89
|
-
.jux-sidebar--inflated .jux-sidebar-header { padding:' + DENSITY.inflated.headerPad + '; }\
|
|
90
|
-
.jux-sidebar--inflated .jux-sidebar-label { padding:' + DENSITY.inflated.labelPad + '; }\
|
|
91
|
-
.jux-sidebar--inflated .jux-sidebar-footer { padding:' + DENSITY.inflated.footerPad + '; }\
|
|
92
|
-
.jux-sidebar--inflated .jux-nav-item { padding:' + DENSITY.inflated.itemPad + '; margin:' + DENSITY.inflated.gap + ' 0; font-size:' + DENSITY.inflated.fontSize + '; gap:12px; }\
|
|
93
|
-
.jux-sidebar--inflated .jux-nav-item-icon { width:20px; font-size:' + DENSITY.inflated.iconSize + '; }\
|
|
94
|
-
');
|
|
95
|
-
}
|
|
96
|
-
const api = {
|
|
97
|
-
id: id,
|
|
98
|
-
title: function (val) { _title = val; return api; },
|
|
99
|
-
logo: function (val) { _logo = val; return api; },
|
|
100
|
-
footer: function (val) {
|
|
101
|
-
_footer = val;
|
|
102
|
-
if (_rendered)
|
|
103
|
-
renderFooter();
|
|
104
|
-
return api;
|
|
105
|
-
},
|
|
106
|
-
width: function (val) { _width = val; return api; },
|
|
107
|
-
target: function (val) { _target = val; return api; },
|
|
108
|
-
density: function (val) { _density = val; return api; },
|
|
109
|
-
section: function (label, items) {
|
|
110
|
-
renderSection({ label: label, items: (items || []).map(normalizeItem) });
|
|
111
|
-
return api;
|
|
112
|
-
},
|
|
113
|
-
items: function (items) {
|
|
114
|
-
renderSection({ items: (items || []).map(normalizeItem) });
|
|
115
|
-
return api;
|
|
116
|
-
},
|
|
117
|
-
render: function () {
|
|
118
|
-
ensureShell();
|
|
119
|
-
renderFooter();
|
|
120
|
-
return api;
|
|
121
|
-
},
|
|
122
|
-
addSection: function (label, items) { return api.section(label, items); },
|
|
123
|
-
setTitle: function (val) { pageState[id + '-title'].content = val; return api; },
|
|
124
|
-
setFooter: function (val) { pageState[id + '-footer'].content = val; return api; },
|
|
125
|
-
show: function () { pageState[id].visible = true; return api; },
|
|
126
|
-
hide: function () { pageState[id].visible = false; return api; },
|
|
127
|
-
toggle: function () { pageState[id].visible = !pageState[id].visible; return api; },
|
|
128
|
-
getElement: function () { return document.getElementById(id); }
|
|
129
|
-
};
|
|
130
|
-
if (sections && Array.isArray(sections) && sections.length > 0) {
|
|
131
|
-
const normalized = normalizeSections(sections);
|
|
132
|
-
normalized.forEach(renderSection);
|
|
133
|
-
renderFooter();
|
|
134
|
-
}
|
|
135
|
-
return api;
|
|
136
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
interface ButtonOptions {
|
|
2
|
-
content?: string;
|
|
3
|
-
variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
|
|
4
|
-
size?: 'default' | 'sm' | 'lg' | 'icon';
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
type?: 'button' | 'submit' | 'reset';
|
|
7
|
-
class?: string;
|
|
8
|
-
style?: string;
|
|
9
|
-
target?: string;
|
|
10
|
-
icon?: string;
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}
|
|
13
|
-
declare class Button {
|
|
14
|
-
id: string;
|
|
15
|
-
opts: ButtonOptions;
|
|
16
|
-
private _element;
|
|
17
|
-
private _onChange;
|
|
18
|
-
constructor(id: string, options?: ButtonOptions);
|
|
19
|
-
getValue(): string;
|
|
20
|
-
getContent(): string;
|
|
21
|
-
setValue(val: string): this;
|
|
22
|
-
setContent(val: string): this;
|
|
23
|
-
setDisabled(val: boolean): this;
|
|
24
|
-
setClass(val: string): this;
|
|
25
|
-
setStyle(val: string): this;
|
|
26
|
-
getElement(): HTMLButtonElement;
|
|
27
|
-
onChange(fn: (value: string) => void): this;
|
|
28
|
-
}
|
|
29
|
-
export declare function button(id: string, options?: ButtonOptions): Button;
|
|
30
|
-
export declare function btn(id: string, options?: ButtonOptions): Button;
|
|
31
|
-
export { Button, ButtonOptions };
|
|
32
|
-
export default button;
|
|
33
|
-
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../lib/components/button.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;IACjF,IAAI,CAAC,EAAE,SA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
import generateId from '../utils/idgen.js';
|
|
2
|
-
import niceName from '../utils/niceName.js';
|
|
3
|
-
import { pageState } from '../state/pageState.js';
|
|
4
|
-
class Button {
|
|
5
|
-
constructor(id, options = {}) {
|
|
6
|
-
this._onChange = null;
|
|
7
|
-
this.id = id || generateId();
|
|
8
|
-
this.opts = {
|
|
9
|
-
variant: 'default',
|
|
10
|
-
size: 'default',
|
|
11
|
-
type: 'button',
|
|
12
|
-
disabled: false,
|
|
13
|
-
...options
|
|
14
|
-
};
|
|
15
|
-
// Auto-generate content from ID if not provided
|
|
16
|
-
if (!this.opts.content && this.id) {
|
|
17
|
-
this.opts.content = niceName(this.id);
|
|
18
|
-
}
|
|
19
|
-
this._element = document.createElement('button');
|
|
20
|
-
this._element.id = this.id;
|
|
21
|
-
this._element.type = this.opts.type;
|
|
22
|
-
if (this.opts.disabled)
|
|
23
|
-
this._element.disabled = true;
|
|
24
|
-
// Build class list
|
|
25
|
-
const classes = ['jux-button'];
|
|
26
|
-
if (this.opts.variant)
|
|
27
|
-
classes.push(`jux-button--${this.opts.variant}`);
|
|
28
|
-
if (this.opts.size && this.opts.size !== 'default')
|
|
29
|
-
classes.push(`jux-button--${this.opts.size}`);
|
|
30
|
-
if (this.opts.class)
|
|
31
|
-
classes.push(this.opts.class);
|
|
32
|
-
this._element.className = classes.join(' ');
|
|
33
|
-
if (this.opts.style)
|
|
34
|
-
this._element.setAttribute('style', this.opts.style);
|
|
35
|
-
// Content
|
|
36
|
-
if (this.opts.icon) {
|
|
37
|
-
const iconSpan = document.createElement('span');
|
|
38
|
-
iconSpan.className = 'jux-button-icon';
|
|
39
|
-
iconSpan.textContent = this.opts.icon;
|
|
40
|
-
this._element.appendChild(iconSpan);
|
|
41
|
-
}
|
|
42
|
-
if (this.opts.content) {
|
|
43
|
-
const textSpan = document.createElement('span');
|
|
44
|
-
textSpan.className = 'jux-button-text';
|
|
45
|
-
textSpan.textContent = this.opts.content;
|
|
46
|
-
this._element.appendChild(textSpan);
|
|
47
|
-
}
|
|
48
|
-
// Extra attributes
|
|
49
|
-
for (const [key, value] of Object.entries(this.opts)) {
|
|
50
|
-
if (['content', 'class', 'style', 'target', 'variant', 'size', 'type', 'disabled', 'icon'].includes(key))
|
|
51
|
-
continue;
|
|
52
|
-
this._element.setAttribute(`data-${key}`, String(value));
|
|
53
|
-
}
|
|
54
|
-
const resolvedTarget = this.opts.target;
|
|
55
|
-
const container = resolvedTarget
|
|
56
|
-
? document.getElementById(resolvedTarget) || document.querySelector(resolvedTarget)
|
|
57
|
-
: document.getElementById('app');
|
|
58
|
-
container?.appendChild(this._element);
|
|
59
|
-
}
|
|
60
|
-
// ═══════════════════════════════════════════════════════════
|
|
61
|
-
// PAGESTATE INTEGRATION
|
|
62
|
-
// ═══════════════════════════════════════════════════════════
|
|
63
|
-
getValue() { return this.opts.content ?? ''; }
|
|
64
|
-
getContent() { return this.opts.content ?? ''; }
|
|
65
|
-
setValue(val) {
|
|
66
|
-
this.opts.content = val;
|
|
67
|
-
const textEl = this._element.querySelector('.jux-button-text');
|
|
68
|
-
if (textEl) {
|
|
69
|
-
textEl.textContent = val;
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this._element.textContent = val;
|
|
73
|
-
}
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
|
-
setContent(val) { return this.setValue(val); }
|
|
77
|
-
setDisabled(val) {
|
|
78
|
-
this.opts.disabled = val;
|
|
79
|
-
this._element.disabled = val;
|
|
80
|
-
return this;
|
|
81
|
-
}
|
|
82
|
-
setClass(val) {
|
|
83
|
-
this._element.className = val;
|
|
84
|
-
return this;
|
|
85
|
-
}
|
|
86
|
-
setStyle(val) {
|
|
87
|
-
this._element.setAttribute('style', val);
|
|
88
|
-
return this;
|
|
89
|
-
}
|
|
90
|
-
getElement() { return this._element; }
|
|
91
|
-
onChange(fn) {
|
|
92
|
-
this._onChange = fn;
|
|
93
|
-
return this;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export function button(id, options = {}) {
|
|
97
|
-
const b = new Button(id, options);
|
|
98
|
-
pageState.__register(b);
|
|
99
|
-
return b;
|
|
100
|
-
}
|
|
101
|
-
export function btn(id, options = {}) {
|
|
102
|
-
const b = new Button(id, options);
|
|
103
|
-
pageState.__register(b);
|
|
104
|
-
return b;
|
|
105
|
-
}
|
|
106
|
-
export { Button };
|
|
107
|
-
export default button;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
interface CheckboxOption {
|
|
2
|
-
label: string;
|
|
3
|
-
value: string;
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
checked?: boolean;
|
|
6
|
-
}
|
|
7
|
-
interface CheckboxOptions {
|
|
8
|
-
label?: string;
|
|
9
|
-
checked?: boolean;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
class?: string;
|
|
12
|
-
style?: string;
|
|
13
|
-
}
|
|
14
|
-
interface CheckboxGroupOptions {
|
|
15
|
-
label?: string;
|
|
16
|
-
options?: CheckboxOption[];
|
|
17
|
-
values?: string[];
|
|
18
|
-
direction?: 'vertical' | 'horizontal';
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
class?: string;
|
|
21
|
-
style?: string;
|
|
22
|
-
}
|
|
23
|
-
declare class Checkbox {
|
|
24
|
-
id: string;
|
|
25
|
-
opts: CheckboxOptions;
|
|
26
|
-
private _element;
|
|
27
|
-
private _wrapper;
|
|
28
|
-
private _onChange;
|
|
29
|
-
constructor(id: string, options?: CheckboxOptions);
|
|
30
|
-
label(value: string): this;
|
|
31
|
-
checked(value?: boolean): this;
|
|
32
|
-
disabled(value?: boolean): this;
|
|
33
|
-
style(value: string): this;
|
|
34
|
-
class(value: string): this;
|
|
35
|
-
onChange(fn: (checked: boolean, event: Event) => void): this;
|
|
36
|
-
getValue(): boolean;
|
|
37
|
-
render(target?: string | HTMLElement): this;
|
|
38
|
-
}
|
|
39
|
-
declare class CheckboxGroup {
|
|
40
|
-
id: string;
|
|
41
|
-
opts: CheckboxGroupOptions;
|
|
42
|
-
private _wrapper;
|
|
43
|
-
private _inputs;
|
|
44
|
-
private _onChange;
|
|
45
|
-
constructor(id: string, options?: CheckboxGroupOptions);
|
|
46
|
-
label(value: string): this;
|
|
47
|
-
direction(value: 'vertical' | 'horizontal'): this;
|
|
48
|
-
disabled(value?: boolean): this;
|
|
49
|
-
style(value: string): this;
|
|
50
|
-
class(value: string): this;
|
|
51
|
-
options(opts: CheckboxOption[]): this;
|
|
52
|
-
values(vals: string[]): this;
|
|
53
|
-
onChange(fn: (values: string[], event: Event) => void): this;
|
|
54
|
-
getValues(): string[];
|
|
55
|
-
private _rebuild;
|
|
56
|
-
private _buildOptions;
|
|
57
|
-
render(target?: string | HTMLElement): this;
|
|
58
|
-
}
|
|
59
|
-
export declare function checkbox(id: string, options?: CheckboxOptions): Checkbox;
|
|
60
|
-
export declare function checkboxGroup(id: string, options?: CheckboxGroupOptions): CheckboxGroup;
|
|
61
|
-
export { Checkbox, CheckboxGroup, CheckboxOption, CheckboxOptions, CheckboxGroupOptions };
|
|
62
|
-
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../lib/components/checkbox.ts"],"names":[],"mappings":"AAGA,UAAU,cAAc;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,eAAe;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,oBAAoB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,cAAc,EAAE,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D,QAAQ,CAAC,KAAK,GAAE,OAAc,GAAG,IAAI;IACrC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAC1B,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAE1B,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,IAAI;IAMrC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAQ5B,QAAQ,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI;IAK5D,SAAS,IAAI,MAAM,EAAE;IAIrB,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,aAAa;IA2BrB,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;CA4B9C;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,QAAQ,CAK5E;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAK3F;AAED,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import generateId from '../utils/idgen.js';
|
|
2
|
-
import { pageState } from '../state/pageState.js';
|
|
3
|
-
// ═══════════════════════════════════════════════════════════
|
|
4
|
-
// Standalone Checkbox (boolean toggle)
|
|
5
|
-
// ═══════════════════════════════════════════════════════════
|
|
6
|
-
class Checkbox {
|
|
7
|
-
constructor(id, options = {}) {
|
|
8
|
-
this._element = null;
|
|
9
|
-
this._wrapper = null;
|
|
10
|
-
this._onChange = null;
|
|
11
|
-
this.id = id || generateId();
|
|
12
|
-
this.opts = options;
|
|
13
|
-
}
|
|
14
|
-
label(value) { this.opts.label = value; return this; }
|
|
15
|
-
checked(value = true) { this.opts.checked = value; if (this._element)
|
|
16
|
-
this._element.checked = value; return this; }
|
|
17
|
-
disabled(value = true) { this.opts.disabled = value; if (this._element)
|
|
18
|
-
this._element.disabled = value; return this; }
|
|
19
|
-
style(value) { this.opts.style = value; return this; }
|
|
20
|
-
class(value) { this.opts.class = value; return this; }
|
|
21
|
-
onChange(fn) {
|
|
22
|
-
this._onChange = fn;
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
getValue() {
|
|
26
|
-
return this._element?.checked ?? this.opts.checked ?? false;
|
|
27
|
-
}
|
|
28
|
-
render(target) {
|
|
29
|
-
const wrapper = document.createElement('label');
|
|
30
|
-
wrapper.className = 'jux-checkbox';
|
|
31
|
-
wrapper.id = `${this.id}-wrapper`;
|
|
32
|
-
if (this.opts.class)
|
|
33
|
-
wrapper.className += ` ${this.opts.class}`;
|
|
34
|
-
if (this.opts.style)
|
|
35
|
-
wrapper.setAttribute('style', this.opts.style);
|
|
36
|
-
const inp = document.createElement('input');
|
|
37
|
-
inp.type = 'checkbox';
|
|
38
|
-
inp.id = this.id;
|
|
39
|
-
inp.className = 'jux-checkbox-input';
|
|
40
|
-
if (this.opts.checked)
|
|
41
|
-
inp.checked = true;
|
|
42
|
-
if (this.opts.disabled)
|
|
43
|
-
inp.disabled = true;
|
|
44
|
-
inp.addEventListener('change', (e) => {
|
|
45
|
-
if (this._onChange)
|
|
46
|
-
this._onChange(inp.checked, e);
|
|
47
|
-
});
|
|
48
|
-
wrapper.appendChild(inp);
|
|
49
|
-
if (this.opts.label) {
|
|
50
|
-
const text = document.createElement('span');
|
|
51
|
-
text.className = 'jux-checkbox-label';
|
|
52
|
-
text.textContent = this.opts.label;
|
|
53
|
-
wrapper.appendChild(text);
|
|
54
|
-
}
|
|
55
|
-
this._element = inp;
|
|
56
|
-
this._wrapper = wrapper;
|
|
57
|
-
const container = target
|
|
58
|
-
? (typeof target === 'string' ? document.getElementById(target) || document.querySelector(target) : target)
|
|
59
|
-
: document.getElementById('app');
|
|
60
|
-
container?.appendChild(wrapper);
|
|
61
|
-
return this;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
// ═══════════════════════════════════════════════════════════
|
|
65
|
-
// CheckboxGroup (multi-select from options)
|
|
66
|
-
// ═══════════════════════════════════════════════════════════
|
|
67
|
-
class CheckboxGroup {
|
|
68
|
-
constructor(id, options = {}) {
|
|
69
|
-
this._wrapper = null;
|
|
70
|
-
this._inputs = [];
|
|
71
|
-
this._onChange = null;
|
|
72
|
-
this.id = id || generateId();
|
|
73
|
-
this.opts = {
|
|
74
|
-
options: [],
|
|
75
|
-
values: [],
|
|
76
|
-
direction: 'vertical',
|
|
77
|
-
...options
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
label(value) { this.opts.label = value; return this; }
|
|
81
|
-
direction(value) { this.opts.direction = value; return this; }
|
|
82
|
-
disabled(value = true) { this.opts.disabled = value; return this; }
|
|
83
|
-
style(value) { this.opts.style = value; return this; }
|
|
84
|
-
class(value) { this.opts.class = value; return this; }
|
|
85
|
-
options(opts) {
|
|
86
|
-
this.opts.options = opts;
|
|
87
|
-
if (this._wrapper)
|
|
88
|
-
this._rebuild();
|
|
89
|
-
return this;
|
|
90
|
-
}
|
|
91
|
-
values(vals) {
|
|
92
|
-
this.opts.values = vals;
|
|
93
|
-
this._inputs.forEach(inp => {
|
|
94
|
-
inp.checked = vals.includes(inp.value);
|
|
95
|
-
});
|
|
96
|
-
return this;
|
|
97
|
-
}
|
|
98
|
-
onChange(fn) {
|
|
99
|
-
this._onChange = fn;
|
|
100
|
-
return this;
|
|
101
|
-
}
|
|
102
|
-
getValues() {
|
|
103
|
-
return this._inputs.filter(i => i.checked).map(i => i.value);
|
|
104
|
-
}
|
|
105
|
-
_rebuild() {
|
|
106
|
-
if (!this._wrapper)
|
|
107
|
-
return;
|
|
108
|
-
const group = this._wrapper.querySelector('.jux-checkbox-options');
|
|
109
|
-
if (!group)
|
|
110
|
-
return;
|
|
111
|
-
group.innerHTML = '';
|
|
112
|
-
this._inputs = [];
|
|
113
|
-
this._buildOptions(group);
|
|
114
|
-
}
|
|
115
|
-
_buildOptions(container) {
|
|
116
|
-
for (const opt of this.opts.options || []) {
|
|
117
|
-
const item = document.createElement('label');
|
|
118
|
-
item.className = 'jux-checkbox-item';
|
|
119
|
-
const inp = document.createElement('input');
|
|
120
|
-
inp.type = 'checkbox';
|
|
121
|
-
inp.value = opt.value;
|
|
122
|
-
inp.className = 'jux-checkbox-input';
|
|
123
|
-
if (opt.checked || this.opts.values?.includes(opt.value))
|
|
124
|
-
inp.checked = true;
|
|
125
|
-
if (opt.disabled || this.opts.disabled)
|
|
126
|
-
inp.disabled = true;
|
|
127
|
-
inp.addEventListener('change', (e) => {
|
|
128
|
-
if (this._onChange)
|
|
129
|
-
this._onChange(this.getValues(), e);
|
|
130
|
-
});
|
|
131
|
-
const text = document.createElement('span');
|
|
132
|
-
text.className = 'jux-checkbox-label';
|
|
133
|
-
text.textContent = opt.label;
|
|
134
|
-
item.appendChild(inp);
|
|
135
|
-
item.appendChild(text);
|
|
136
|
-
container.appendChild(item);
|
|
137
|
-
this._inputs.push(inp);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
render(target) {
|
|
141
|
-
const wrapper = document.createElement('fieldset');
|
|
142
|
-
wrapper.className = 'jux-checkbox-group';
|
|
143
|
-
wrapper.id = this.id;
|
|
144
|
-
if (this.opts.class)
|
|
145
|
-
wrapper.className += ` ${this.opts.class}`;
|
|
146
|
-
if (this.opts.style)
|
|
147
|
-
wrapper.setAttribute('style', this.opts.style);
|
|
148
|
-
if (this.opts.label) {
|
|
149
|
-
const legend = document.createElement('legend');
|
|
150
|
-
legend.textContent = this.opts.label;
|
|
151
|
-
legend.className = 'jux-checkbox-group-label';
|
|
152
|
-
wrapper.appendChild(legend);
|
|
153
|
-
}
|
|
154
|
-
const optionsDiv = document.createElement('div');
|
|
155
|
-
optionsDiv.className = `jux-checkbox-options jux-checkbox-${this.opts.direction}`;
|
|
156
|
-
this._buildOptions(optionsDiv);
|
|
157
|
-
wrapper.appendChild(optionsDiv);
|
|
158
|
-
this._wrapper = wrapper;
|
|
159
|
-
const container = target
|
|
160
|
-
? (typeof target === 'string' ? document.getElementById(target) || document.querySelector(target) : target)
|
|
161
|
-
: document.getElementById('app');
|
|
162
|
-
container?.appendChild(wrapper);
|
|
163
|
-
return this;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
export function checkbox(id, options = {}) {
|
|
167
|
-
const c = new Checkbox(id, options);
|
|
168
|
-
c.render();
|
|
169
|
-
pageState.__register(c);
|
|
170
|
-
return c;
|
|
171
|
-
}
|
|
172
|
-
export function checkboxGroup(id, options = {}) {
|
|
173
|
-
const g = new CheckboxGroup(id, options);
|
|
174
|
-
g.render();
|
|
175
|
-
pageState.__register(g);
|
|
176
|
-
return g;
|
|
177
|
-
}
|
|
178
|
-
export { Checkbox, CheckboxGroup };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
interface ContainerOptions {
|
|
2
|
-
layout?: 'flex' | 'grid' | 'block';
|
|
3
|
-
direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
4
|
-
wrap?: boolean;
|
|
5
|
-
gap?: string;
|
|
6
|
-
padding?: string;
|
|
7
|
-
align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
8
|
-
justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
9
|
-
columns?: number | string;
|
|
10
|
-
width?: string;
|
|
11
|
-
height?: string;
|
|
12
|
-
maxWidth?: string;
|
|
13
|
-
minHeight?: string;
|
|
14
|
-
class?: string;
|
|
15
|
-
style?: string;
|
|
16
|
-
target?: string;
|
|
17
|
-
tag?: string;
|
|
18
|
-
content?: string;
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
}
|
|
21
|
-
declare class Container {
|
|
22
|
-
id: string;
|
|
23
|
-
opts: ContainerOptions;
|
|
24
|
-
private _element;
|
|
25
|
-
constructor(id: string, options?: ContainerOptions);
|
|
26
|
-
private _buildStyles;
|
|
27
|
-
getValue(): string;
|
|
28
|
-
getContent(): string;
|
|
29
|
-
setValue(val: string): this;
|
|
30
|
-
setContent(val: string): this;
|
|
31
|
-
setClass(val: string): this;
|
|
32
|
-
setStyle(val: string): this;
|
|
33
|
-
setInnerHTML(val: string): this;
|
|
34
|
-
getElement(): HTMLElement;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Create a layout container.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* // Flex column (default)
|
|
41
|
-
* jux.container('main', { gap: '16px', padding: '24px' });
|
|
42
|
-
*
|
|
43
|
-
* // Flex row
|
|
44
|
-
* jux.container('toolbar', { direction: 'row', gap: '8px', align: 'center' });
|
|
45
|
-
*
|
|
46
|
-
* // Grid
|
|
47
|
-
* jux.container('grid', { layout: 'grid', columns: 3, gap: '16px' });
|
|
48
|
-
*
|
|
49
|
-
* // Centered page wrapper
|
|
50
|
-
* jux.container('page', { maxWidth: '960px', padding: '24px 16px', align: 'center' });
|
|
51
|
-
*
|
|
52
|
-
* // Nested
|
|
53
|
-
* jux.container('card', { gap: '8px', padding: '16px', target: 'grid' });
|
|
54
|
-
*/
|
|
55
|
-
export declare function container(id: string, options?: ContainerOptions): Container;
|
|
56
|
-
export { Container, ContainerOptions };
|
|
57
|
-
export default container;
|
|
58
|
-
//# sourceMappingURL=container.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../lib/components/container.ts"],"names":[],"mappings":"AAGA,UAAU,gBAAgB;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACnC,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,aAAa,GAAG,gBAAgB,CAAC;IAChE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,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