juxscript 1.1.341 → 1.1.343

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/components/sidebar.d.ts.map +1 -0
  2. package/dist/components/{blocks/sidebar.js → sidebar.js} +4 -4
  3. package/dist/components/sidebar.js.map +1 -0
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -1
  9. package/dist/components/blocks/menu.d.ts +0 -62
  10. package/dist/components/blocks/menu.d.ts.map +0 -1
  11. package/dist/components/blocks/menu.js +0 -149
  12. package/dist/components/blocks/menu.js.map +0 -1
  13. package/dist/components/blocks/sidebar.d.ts.map +0 -1
  14. package/dist/components/blocks/sidebar.js.map +0 -1
  15. package/dist/lib/components/blocks/menu.d.ts +0 -40
  16. package/dist/lib/components/blocks/menu.d.ts.map +0 -1
  17. package/dist/lib/components/blocks/menu.js +0 -136
  18. package/dist/lib/components/button.d.ts +0 -33
  19. package/dist/lib/components/button.d.ts.map +0 -1
  20. package/dist/lib/components/button.js +0 -107
  21. package/dist/lib/components/checkbox.d.ts +0 -62
  22. package/dist/lib/components/checkbox.d.ts.map +0 -1
  23. package/dist/lib/components/checkbox.js +0 -178
  24. package/dist/lib/components/container.d.ts +0 -58
  25. package/dist/lib/components/container.d.ts.map +0 -1
  26. package/dist/lib/components/container.js +0 -151
  27. package/dist/lib/components/data.d.ts +0 -58
  28. package/dist/lib/components/data.d.ts.map +0 -1
  29. package/dist/lib/components/data.js +0 -130
  30. package/dist/lib/components/grid.d.ts +0 -58
  31. package/dist/lib/components/grid.d.ts.map +0 -1
  32. package/dist/lib/components/grid.js +0 -127
  33. package/dist/lib/components/include.d.ts +0 -86
  34. package/dist/lib/components/include.d.ts.map +0 -1
  35. package/dist/lib/components/include.js +0 -238
  36. package/dist/lib/components/input.d.ts +0 -58
  37. package/dist/lib/components/input.d.ts.map +0 -1
  38. package/dist/lib/components/input.js +0 -161
  39. package/dist/lib/components/link.d.ts +0 -35
  40. package/dist/lib/components/link.d.ts.map +0 -1
  41. package/dist/lib/components/link.js +0 -135
  42. package/dist/lib/components/list.d.ts +0 -48
  43. package/dist/lib/components/list.d.ts.map +0 -1
  44. package/dist/lib/components/list.js +0 -178
  45. package/dist/lib/components/nav.d.ts +0 -46
  46. package/dist/lib/components/nav.d.ts.map +0 -1
  47. package/dist/lib/components/nav.js +0 -189
  48. package/dist/lib/components/radio.d.ts +0 -40
  49. package/dist/lib/components/radio.d.ts.map +0 -1
  50. package/dist/lib/components/radio.js +0 -112
  51. package/dist/lib/components/select.d.ts +0 -41
  52. package/dist/lib/components/select.d.ts.map +0 -1
  53. package/dist/lib/components/select.js +0 -111
  54. package/dist/lib/components/store.d.ts +0 -78
  55. package/dist/lib/components/store.d.ts.map +0 -1
  56. package/dist/lib/components/store.js +0 -248
  57. package/dist/lib/components/style.d.ts +0 -27
  58. package/dist/lib/components/style.d.ts.map +0 -1
  59. package/dist/lib/components/style.js +0 -52
  60. package/dist/lib/components/table.d.ts +0 -56
  61. package/dist/lib/components/table.d.ts.map +0 -1
  62. package/dist/lib/components/table.js +0 -199
  63. package/dist/lib/components/tabs.d.ts +0 -52
  64. package/dist/lib/components/tabs.d.ts.map +0 -1
  65. package/dist/lib/components/tabs.js +0 -206
  66. package/dist/lib/components/tag.d.ts +0 -41
  67. package/dist/lib/components/tag.d.ts.map +0 -1
  68. package/dist/lib/components/tag.js +0 -103
  69. package/dist/lib/devtools/devtools.d.ts +0 -3
  70. package/dist/lib/devtools/devtools.d.ts.map +0 -1
  71. package/dist/lib/devtools/devtools.js +0 -181
  72. package/dist/lib/index.d.ts +0 -70
  73. package/dist/lib/index.d.ts.map +0 -1
  74. package/dist/lib/index.js +0 -65
  75. package/dist/lib/state/pageState.d.ts +0 -19
  76. package/dist/lib/state/pageState.d.ts.map +0 -1
  77. package/dist/lib/state/pageState.js +0 -360
  78. package/dist/lib/utils/codeHighlight.d.ts +0 -7
  79. package/dist/lib/utils/codeHighlight.d.ts.map +0 -1
  80. package/dist/lib/utils/codeHighlight.js +0 -105
  81. package/dist/lib/utils/codeparser.d.ts +0 -29
  82. package/dist/lib/utils/codeparser.d.ts.map +0 -1
  83. package/dist/lib/utils/codeparser.js +0 -384
  84. package/dist/lib/utils/fetch.d.ts +0 -176
  85. package/dist/lib/utils/fetch.d.ts.map +0 -1
  86. package/dist/lib/utils/fetch.js +0 -427
  87. package/dist/lib/utils/formatId.d.ts +0 -16
  88. package/dist/lib/utils/formatId.d.ts.map +0 -1
  89. package/dist/lib/utils/formatId.js +0 -27
  90. package/dist/lib/utils/idgen.d.ts +0 -2
  91. package/dist/lib/utils/idgen.d.ts.map +0 -1
  92. package/dist/lib/utils/idgen.js +0 -4
  93. package/dist/lib/utils/niceName.d.ts +0 -14
  94. package/dist/lib/utils/niceName.d.ts.map +0 -1
  95. package/dist/lib/utils/niceName.js +0 -22
  96. /package/dist/components/{blocks/sidebar.d.ts → sidebar.d.ts} +0 -0
@@ -1,58 +0,0 @@
1
- type InputType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' | 'date' | 'time' | 'datetime-local' | 'color' | 'range' | 'file' | 'hidden';
2
- interface InputOptions {
3
- type?: InputType;
4
- label?: string;
5
- placeholder?: string;
6
- value?: string;
7
- name?: string;
8
- required?: boolean;
9
- disabled?: boolean;
10
- readonly?: boolean;
11
- min?: string | number;
12
- max?: string | number;
13
- step?: string | number;
14
- pattern?: string;
15
- autocomplete?: string;
16
- class?: string;
17
- style?: string;
18
- }
19
- declare class Input {
20
- id: string;
21
- options: InputOptions;
22
- private _element;
23
- private _wrapper;
24
- private _onChange;
25
- constructor(id: string, options?: InputOptions);
26
- type(value: InputType): this;
27
- label(value: string): this;
28
- placeholder(value: string): this;
29
- value(value: string): this;
30
- name(value: string): this;
31
- required(value?: boolean): this;
32
- disabled(value?: boolean): this;
33
- readonly(value?: boolean): this;
34
- style(value: string): this;
35
- class(value: string): this;
36
- onChange(fn: (value: string, event: Event) => void): this;
37
- getValue(): string;
38
- getFiles(): FileList | null;
39
- setValue(val: string): this;
40
- setContent(val: string): this;
41
- render(target?: string | HTMLElement): this;
42
- }
43
- export declare function input(id: string, options?: InputOptions): Input;
44
- export declare function email(id: string, options?: InputOptions): Input;
45
- export declare function password(id: string, options?: InputOptions): Input;
46
- export declare function number(id: string, options?: InputOptions): Input;
47
- export declare function tel(id: string, options?: InputOptions): Input;
48
- export declare function url(id: string, options?: InputOptions): Input;
49
- export declare function search(id: string, options?: InputOptions): Input;
50
- export declare function date(id: string, options?: InputOptions): Input;
51
- export declare function time(id: string, options?: InputOptions): Input;
52
- export declare function datetime(id: string, options?: InputOptions): Input;
53
- export declare function color(id: string, options?: InputOptions): Input;
54
- export declare function range(id: string, options?: InputOptions): Input;
55
- export declare function file(id: string, options?: InputOptions): Input;
56
- export declare function hidden(id: string, options?: InputOptions): Input;
57
- export { Input, InputOptions };
58
- //# sourceMappingURL=input.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../lib/components/input.ts"],"names":[],"mappings":"AAIA,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,gBAAgB,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAElK,UAAU,YAAY;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,O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AAE,YAAiB,GAAG,KAAK,CAElE;AAED,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,KAAK,CAEpE;AAED,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC"}
@@ -1,161 +0,0 @@
1
- import generateId from '../utils/idgen.js';
2
- import niceName from '../utils/niceName.js';
3
- import { pageState } from '../state/pageState.js';
4
- class Input {
5
- constructor(id, options = {}) {
6
- this._element = null;
7
- this._wrapper = null;
8
- this._onChange = null;
9
- this.id = id || generateId();
10
- this.options = {
11
- type: 'text',
12
- ...options
13
- };
14
- // Auto-generate label from ID if not provided
15
- if (!this.options.label && this.id) {
16
- this.options.label = niceName(this.id);
17
- }
18
- }
19
- // Fluent API
20
- type(value) { this.options.type = value; return this; }
21
- label(value) { this.options.label = value; return this; }
22
- placeholder(value) { this.options.placeholder = value; return this; }
23
- value(value) { this.options.value = value; if (this._element)
24
- this._element.value = value; return this; }
25
- name(value) { this.options.name = value; return this; }
26
- required(value = true) { this.options.required = value; return this; }
27
- disabled(value = true) { this.options.disabled = value; if (this._element)
28
- this._element.disabled = value; return this; }
29
- readonly(value = true) { this.options.readonly = value; return this; }
30
- style(value) { this.options.style = value; return this; }
31
- class(value) { this.options.class = value; return this; }
32
- onChange(fn) {
33
- this._onChange = fn;
34
- return this;
35
- }
36
- getValue() {
37
- return this._element?.value ?? this.options.value ?? '';
38
- }
39
- getFiles() {
40
- return this._element?.files ?? null;
41
- }
42
- setValue(val) {
43
- if (this._element)
44
- this._element.value = val;
45
- this.options.value = val;
46
- return this;
47
- }
48
- setContent(val) {
49
- return this.setValue(val);
50
- }
51
- render(target) {
52
- const wrapper = document.createElement('div');
53
- wrapper.className = 'jux-input';
54
- wrapper.id = `${this.id}-wrapper`;
55
- if (this.options.class)
56
- wrapper.className += ` ${this.options.class}`;
57
- if (this.options.style)
58
- wrapper.setAttribute('style', this.options.style);
59
- if (this.options.label) {
60
- const labelEl = document.createElement('label');
61
- labelEl.htmlFor = this.id;
62
- labelEl.textContent = this.options.label;
63
- labelEl.className = 'jux-input-label';
64
- wrapper.appendChild(labelEl);
65
- }
66
- const input = document.createElement('input');
67
- input.id = this.id;
68
- input.type = this.options.type || 'text';
69
- input.className = 'jux-input-element';
70
- if (this.options.placeholder)
71
- input.placeholder = this.options.placeholder;
72
- if (this.options.value)
73
- input.value = this.options.value;
74
- if (this.options.name)
75
- input.name = this.options.name;
76
- if (this.options.required)
77
- input.required = true;
78
- if (this.options.disabled)
79
- input.disabled = true;
80
- if (this.options.readonly)
81
- input.readOnly = true;
82
- if (this.options.min != null)
83
- input.min = String(this.options.min);
84
- if (this.options.max != null)
85
- input.max = String(this.options.max);
86
- if (this.options.step != null)
87
- input.step = String(this.options.step);
88
- if (this.options.pattern)
89
- input.pattern = this.options.pattern;
90
- if (this.options.autocomplete)
91
- input.autocomplete = this.options.autocomplete;
92
- input.addEventListener('input', (e) => {
93
- if (this._onChange)
94
- this._onChange(input.value, e);
95
- });
96
- // For file inputs, also listen to 'change'
97
- if (this.options.type === 'file') {
98
- input.addEventListener('change', (e) => {
99
- if (this._onChange)
100
- this._onChange(input.value, e);
101
- });
102
- }
103
- wrapper.appendChild(input);
104
- this._element = input;
105
- this._wrapper = wrapper;
106
- const container = target
107
- ? (typeof target === 'string' ? document.getElementById(target) || document.querySelector(target) : target)
108
- : document.getElementById('app');
109
- container?.appendChild(wrapper);
110
- return this;
111
- }
112
- }
113
- export function input(id, options = {}) {
114
- const inp = new Input(id, options);
115
- inp.render();
116
- pageState.__register(inp);
117
- return inp;
118
- }
119
- // ═══════════════════════════════════════════════════════════════
120
- // TYPE-SPECIFIC FACTORY METHODS
121
- // ═══════════════════════════════════════════════════════════════
122
- export function email(id, options = {}) {
123
- return input(id, { placeholder: 'name@example.com', autocomplete: 'email', ...options, type: 'email' });
124
- }
125
- export function password(id, options = {}) {
126
- return input(id, { placeholder: '••••••••', autocomplete: 'current-password', ...options, type: 'password' });
127
- }
128
- export function number(id, options = {}) {
129
- return input(id, { placeholder: '0', ...options, type: 'number' });
130
- }
131
- export function tel(id, options = {}) {
132
- return input(id, { placeholder: '+1 (555) 000-0000', autocomplete: 'tel', ...options, type: 'tel' });
133
- }
134
- export function url(id, options = {}) {
135
- return input(id, { placeholder: 'https://', autocomplete: 'url', ...options, type: 'url' });
136
- }
137
- export function search(id, options = {}) {
138
- return input(id, { placeholder: 'Search...', ...options, type: 'search' });
139
- }
140
- export function date(id, options = {}) {
141
- return input(id, { ...options, type: 'date' });
142
- }
143
- export function time(id, options = {}) {
144
- return input(id, { ...options, type: 'time' });
145
- }
146
- export function datetime(id, options = {}) {
147
- return input(id, { ...options, type: 'datetime-local' });
148
- }
149
- export function color(id, options = {}) {
150
- return input(id, { ...options, type: 'color' });
151
- }
152
- export function range(id, options = {}) {
153
- return input(id, { min: '0', max: '100', ...options, type: 'range' });
154
- }
155
- export function file(id, options = {}) {
156
- return input(id, { ...options, type: 'file' });
157
- }
158
- export function hidden(id, options = {}) {
159
- return input(id, { ...options, type: 'hidden' });
160
- }
161
- export { Input };
@@ -1,35 +0,0 @@
1
- interface LinkOptions {
2
- content?: string;
3
- href?: string;
4
- spa?: boolean;
5
- external?: boolean;
6
- disabled?: boolean;
7
- class?: string;
8
- style?: string;
9
- target?: string;
10
- linkTarget?: '_blank' | '_self' | '_parent' | '_top';
11
- icon?: string;
12
- [key: string]: any;
13
- }
14
- declare class Link {
15
- id: string;
16
- opts: LinkOptions;
17
- private _element;
18
- private _onChange;
19
- constructor(id: string, options?: LinkOptions);
20
- getValue(): string;
21
- getContent(): string;
22
- setValue(val: string): this;
23
- setContent(val: string): this;
24
- setHref(val: string): this;
25
- setDisabled(val: boolean): this;
26
- setClass(val: string): this;
27
- setStyle(val: string): this;
28
- getElement(): HTMLAnchorElement;
29
- onChange(fn: (value: string) => void): this;
30
- }
31
- export declare function link(id: string, options?: LinkOptions): Link;
32
- export declare function a(id: string, options?: LinkOptions): Link;
33
- export { Link, LinkOptions };
34
- export default link;
35
- //# sourceMappingURL=link.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../lib/components/link.ts"],"names":[],"mappings":"AAIA,UAAU,WAAW;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,cAAM,IAAI;IACN,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,SAAS,CAA0C;gBAE/C,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB;IA4EjD,QAAQ,IAAI,MAAM;IAClB,UAAU,IAAI,MAAM;IAEpB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM3B,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAW7B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAE1B,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAU/B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK3B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK3B,UAAU,IAAI,iBAAiB;IAE/B,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;CAI9C;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAIhE;AAED,wBAAgB,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAI7D;AAED,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AAC7B,eAAe,IAAI,CAAC"}
@@ -1,135 +0,0 @@
1
- import generateId from '../utils/idgen.js';
2
- import niceName from '../utils/niceName.js';
3
- import { pageState } from '../state/pageState.js';
4
- class Link {
5
- constructor(id, options = {}) {
6
- this._onChange = null;
7
- this.id = id || generateId();
8
- this.opts = {
9
- spa: true,
10
- external: false,
11
- disabled: false,
12
- ...options
13
- };
14
- // Auto-generate content from ID if not provided
15
- if (!this.opts.content && this.id) {
16
- this.opts.content = niceName(this.id);
17
- }
18
- this._element = document.createElement('a');
19
- this._element.id = this.id;
20
- this._element.className = this.opts.class || 'jux-link';
21
- if (this.opts.style)
22
- this._element.setAttribute('style', this.opts.style);
23
- if (this.opts.href)
24
- this._element.href = this.opts.href;
25
- if (this.opts.disabled)
26
- this._element.setAttribute('data-disabled', 'true');
27
- // External link handling
28
- if (this.opts.external || this.opts.linkTarget === '_blank') {
29
- this._element.target = this.opts.linkTarget || '_blank';
30
- this._element.rel = 'noopener noreferrer';
31
- }
32
- // Content
33
- if (this.opts.icon) {
34
- const iconSpan = document.createElement('span');
35
- iconSpan.className = 'jux-link-icon';
36
- iconSpan.textContent = this.opts.icon;
37
- this._element.appendChild(iconSpan);
38
- }
39
- if (this.opts.content) {
40
- const textSpan = document.createElement('span');
41
- textSpan.className = 'jux-link-text';
42
- textSpan.textContent = this.opts.content;
43
- this._element.appendChild(textSpan);
44
- }
45
- // Extra attributes
46
- for (const [key, value] of Object.entries(this.opts)) {
47
- if (['content', 'class', 'style', 'target', 'href', 'spa', 'external', 'disabled', 'icon', 'linkTarget'].includes(key))
48
- continue;
49
- this._element.setAttribute(`data-${key}`, String(value));
50
- }
51
- // SPA navigation
52
- if (this.opts.spa && !this.opts.external) {
53
- this._element.addEventListener('click', (e) => {
54
- if (this.opts.disabled) {
55
- e.preventDefault();
56
- return;
57
- }
58
- const href = this._element.href;
59
- if (href && !href.startsWith('http') && !href.startsWith('//')) {
60
- e.preventDefault();
61
- const path = new URL(href, window.location.origin).pathname;
62
- if (typeof window.navigateTo === 'function') {
63
- window.navigateTo(path);
64
- }
65
- else {
66
- window.history.pushState({}, '', path);
67
- window.dispatchEvent(new PopStateEvent('popstate'));
68
- }
69
- }
70
- });
71
- }
72
- const resolvedTarget = this.opts.target;
73
- const container = resolvedTarget
74
- ? document.getElementById(resolvedTarget) || document.querySelector(resolvedTarget)
75
- : document.getElementById('app');
76
- container?.appendChild(this._element);
77
- }
78
- // ═══════════════════════════════════════════════════════════
79
- // PAGESTATE INTEGRATION
80
- // ═══════════════════════════════════════════════════════════
81
- getValue() { return this.opts.href ?? ''; }
82
- getContent() { return this.opts.content ?? ''; }
83
- setValue(val) {
84
- this.opts.href = val;
85
- this._element.href = val;
86
- return this;
87
- }
88
- setContent(val) {
89
- this.opts.content = val;
90
- const textEl = this._element.querySelector('.jux-link-text');
91
- if (textEl) {
92
- textEl.textContent = val;
93
- }
94
- else {
95
- this._element.textContent = val;
96
- }
97
- return this;
98
- }
99
- setHref(val) { return this.setValue(val); }
100
- setDisabled(val) {
101
- this.opts.disabled = val;
102
- if (val) {
103
- this._element.setAttribute('data-disabled', 'true');
104
- }
105
- else {
106
- this._element.removeAttribute('data-disabled');
107
- }
108
- return this;
109
- }
110
- setClass(val) {
111
- this._element.className = val;
112
- return this;
113
- }
114
- setStyle(val) {
115
- this._element.setAttribute('style', val);
116
- return this;
117
- }
118
- getElement() { return this._element; }
119
- onChange(fn) {
120
- this._onChange = fn;
121
- return this;
122
- }
123
- }
124
- export function link(id, options = {}) {
125
- const l = new Link(id, options);
126
- pageState.__register(l);
127
- return l;
128
- }
129
- export function a(id, options = {}) {
130
- const l = new Link(id, options);
131
- pageState.__register(l);
132
- return l;
133
- }
134
- export { Link };
135
- export default link;
@@ -1,48 +0,0 @@
1
- interface ListItem {
2
- id?: string;
3
- content: string;
4
- icon?: string;
5
- class?: string;
6
- disabled?: boolean;
7
- [key: string]: any;
8
- }
9
- interface ListOptions {
10
- items?: ListItem[];
11
- ordered?: boolean;
12
- selectable?: boolean;
13
- class?: string;
14
- style?: string;
15
- target?: string;
16
- itemClass?: string;
17
- activeClass?: string;
18
- }
19
- declare class List {
20
- id: string;
21
- opts: ListOptions;
22
- private _element;
23
- private _items;
24
- private _value;
25
- private _selectedIndex;
26
- private _onChange;
27
- constructor(id: string, options?: ListOptions);
28
- addItem(item: ListItem): this;
29
- addItems(items: ListItem[]): this;
30
- removeItem(key: string | number): this;
31
- updateItem(key: string | number, updates: Partial<ListItem>): this;
32
- clearItems(): this;
33
- getItems(): ListItem[];
34
- getCount(): number;
35
- getValue(): string | null;
36
- setValue(val: string | null): this;
37
- getContent(): string;
38
- getElement(): HTMLElement;
39
- onChange(fn: (value: string | null) => void): this;
40
- private _renderItem;
41
- private _renderAll;
42
- private _updateActiveState;
43
- private _dispatchChange;
44
- }
45
- export declare function list(id: string, options?: ListOptions): List;
46
- export { List, ListItem, ListOptions };
47
- export default list;
48
- //# sourceMappingURL=list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../lib/components/list.ts"],"names":[],"mappings":"AAIA,UAAU,QAAQ;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,UAAU,WAAW;IACjB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,OAAO,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;CAI1B;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAIhE;AAED,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AACvC,eAAe,IAAI,CAAC"}
@@ -1,178 +0,0 @@
1
- import generateId from '../utils/idgen.js';
2
- import niceName from '../utils/niceName.js';
3
- import { pageState } from '../state/pageState.js';
4
- class List {
5
- constructor(id, options = {}) {
6
- this._items = [];
7
- this._value = null;
8
- this._selectedIndex = -1;
9
- this._onChange = null;
10
- this.id = id || generateId();
11
- this.opts = {
12
- ordered: false,
13
- selectable: false,
14
- itemClass: 'jux-list-item',
15
- activeClass: 'jux-list-item--active',
16
- ...options
17
- };
18
- const tagName = this.opts.ordered ? 'ol' : 'ul';
19
- this._element = document.createElement(tagName);
20
- this._element.id = this.id;
21
- this._element.setAttribute('role', 'list');
22
- if (this.opts.class)
23
- this._element.className = this.opts.class;
24
- if (this.opts.style)
25
- this._element.setAttribute('style', this.opts.style);
26
- const resolvedTarget = this.opts.target;
27
- const container = resolvedTarget
28
- ? document.getElementById(resolvedTarget) || document.querySelector(resolvedTarget)
29
- : document.getElementById('app');
30
- container?.appendChild(this._element);
31
- if (this.opts.items) {
32
- this.addItems(this.opts.items);
33
- }
34
- }
35
- // ═══════════════════════════════════════════════════════════
36
- // STANDARD COLLECTION API
37
- // ═══════════════════════════════════════════════════════════
38
- addItem(item) {
39
- const listItem = {
40
- ...item,
41
- id: item.id || `${this.id}-item-${this._items.length}`,
42
- content: item.content || niceName(item.id || `item-${this._items.length}`)
43
- };
44
- this._items.push(listItem);
45
- this._renderItem(listItem);
46
- this._dispatchChange();
47
- return this;
48
- }
49
- addItems(items) {
50
- for (const item of items) {
51
- const listItem = {
52
- ...item,
53
- id: item.id || `${this.id}-item-${this._items.length}`,
54
- content: item.content || niceName(item.id || `item-${this._items.length}`)
55
- };
56
- this._items.push(listItem);
57
- this._renderItem(listItem);
58
- }
59
- this._dispatchChange();
60
- return this;
61
- }
62
- removeItem(key) {
63
- const idx = typeof key === 'number' ? key : this._items.findIndex(i => i.id === key);
64
- if (idx > -1) {
65
- this._items.splice(idx, 1);
66
- this._renderAll();
67
- this._dispatchChange();
68
- }
69
- return this;
70
- }
71
- updateItem(key, updates) {
72
- const idx = typeof key === 'number' ? key : this._items.findIndex(i => i.id === key);
73
- if (idx > -1) {
74
- this._items[idx] = { ...this._items[idx], ...updates };
75
- this._renderAll();
76
- this._dispatchChange();
77
- }
78
- return this;
79
- }
80
- clearItems() {
81
- this._items = [];
82
- this._value = null;
83
- this._selectedIndex = -1;
84
- this._element.innerHTML = '';
85
- this._dispatchChange();
86
- return this;
87
- }
88
- getItems() { return [...this._items]; }
89
- getCount() { return this._items.length; }
90
- // ═══════════════════════════════════════════════════════════
91
- // PAGESTATE INTEGRATION
92
- // ═══════════════════════════════════════════════════════════
93
- getValue() { return this._value; }
94
- setValue(val) {
95
- this._value = val;
96
- this._selectedIndex = this._items.findIndex(i => i.id === val);
97
- this._updateActiveState();
98
- this._dispatchChange();
99
- return this;
100
- }
101
- getContent() {
102
- return this._items.map(i => i.content).join(', ');
103
- }
104
- getElement() { return this._element; }
105
- onChange(fn) {
106
- this._onChange = fn;
107
- return this;
108
- }
109
- // ═══════════════════════════════════════════════════════════
110
- // INTERNAL
111
- // ═══════════════════════════════════════════════════════════
112
- _renderItem(item) {
113
- const li = document.createElement('li');
114
- li.id = item.id;
115
- li.className = item.class || this.opts.itemClass || 'jux-list-item';
116
- li.setAttribute('role', 'listitem');
117
- if (item.icon) {
118
- const iconSpan = document.createElement('span');
119
- iconSpan.className = 'jux-list-item-icon';
120
- iconSpan.textContent = item.icon;
121
- li.appendChild(iconSpan);
122
- const textSpan = document.createElement('span');
123
- textSpan.className = 'jux-list-item-text';
124
- textSpan.textContent = item.content;
125
- li.appendChild(textSpan);
126
- }
127
- else {
128
- li.textContent = item.content;
129
- }
130
- if (item.disabled)
131
- li.setAttribute('data-disabled', 'true');
132
- if (this.opts.selectable) {
133
- li.style.cursor = 'pointer';
134
- li.addEventListener('click', () => {
135
- if (item.disabled)
136
- return;
137
- this._value = item.id;
138
- this._selectedIndex = this._items.indexOf(item);
139
- this._updateActiveState();
140
- if (this._onChange)
141
- this._onChange(this._value);
142
- this._element.dispatchEvent(new Event('change', { bubbles: false }));
143
- });
144
- }
145
- this._element.appendChild(li);
146
- }
147
- _renderAll() {
148
- this._element.innerHTML = '';
149
- for (const item of this._items) {
150
- this._renderItem(item);
151
- }
152
- this._updateActiveState();
153
- }
154
- _updateActiveState() {
155
- const children = this._element.querySelectorAll('[role="listitem"]');
156
- children.forEach((el, idx) => {
157
- if (idx === this._selectedIndex) {
158
- el.classList.add(this.opts.activeClass);
159
- el.setAttribute('data-active', 'true');
160
- }
161
- else {
162
- el.classList.remove(this.opts.activeClass);
163
- el.removeAttribute('data-active');
164
- }
165
- });
166
- }
167
- _dispatchChange() {
168
- this._element.setAttribute('data-count', String(this._items.length));
169
- this._element.dispatchEvent(new Event('change', { bubbles: false }));
170
- }
171
- }
172
- export function list(id, options = {}) {
173
- const l = new List(id, options);
174
- pageState.__register(l);
175
- return l;
176
- }
177
- export { List };
178
- export default list;
@@ -1,46 +0,0 @@
1
- interface NavItem {
2
- id?: string;
3
- label: string;
4
- path?: string;
5
- icon?: string;
6
- disabled?: boolean;
7
- [key: string]: any;
8
- }
9
- interface NavOptions {
10
- label?: string;
11
- items?: NavItem[];
12
- orientation?: 'vertical' | 'horizontal';
13
- class?: string;
14
- style?: string;
15
- target?: string;
16
- activeClass?: string;
17
- itemClass?: string;
18
- }
19
- declare class Nav {
20
- id: string;
21
- opts: NavOptions;
22
- private _element;
23
- private _items;
24
- private _value;
25
- private _onChange;
26
- constructor(id: string, options?: NavOptions);
27
- addItem(item: NavItem): this;
28
- addItems(items: NavItem[]): this;
29
- removeItem(key: string | number): this;
30
- updateItem(key: string | number, updates: Partial<NavItem>): this;
31
- clearItems(): this;
32
- getItems(): NavItem[];
33
- getCount(): number;
34
- getValue(): string | null;
35
- setValue(val: string | null): this;
36
- getElement(): HTMLElement;
37
- onChange(fn: (value: string | null) => void): this;
38
- private _renderItem;
39
- private _renderAll;
40
- private _updateActiveState;
41
- private _dispatchChange;
42
- }
43
- export declare function nav(id: string, options?: NavOptions): Nav;
44
- export { Nav, NavItem, NavOptions };
45
- export default nav;
46
- //# sourceMappingURL=nav.d.ts.map