juxscript 1.1.4 → 1.1.6

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 (205) hide show
  1. package/index.d.ts +10 -10
  2. package/index.d.ts.map +1 -0
  3. package/lib/components/alert.d.ts +32 -0
  4. package/lib/components/alert.d.ts.map +1 -0
  5. package/lib/components/alert.js +153 -0
  6. package/lib/components/alert.ts +200 -0
  7. package/lib/components/app.d.ts +89 -0
  8. package/lib/components/app.d.ts.map +1 -0
  9. package/lib/components/app.js +175 -0
  10. package/lib/components/app.ts +247 -0
  11. package/lib/components/badge.d.ts +27 -0
  12. package/lib/components/badge.d.ts.map +1 -0
  13. package/lib/components/badge.js +70 -0
  14. package/lib/components/badge.ts +101 -0
  15. package/lib/components/base/BaseComponent.d.ts +142 -0
  16. package/lib/components/base/BaseComponent.d.ts.map +1 -0
  17. package/lib/components/base/BaseComponent.js +363 -0
  18. package/lib/components/base/BaseComponent.ts +421 -0
  19. package/lib/components/base/FormInput.d.ts +73 -0
  20. package/lib/components/base/FormInput.d.ts.map +1 -0
  21. package/lib/components/base/FormInput.js +163 -0
  22. package/lib/components/base/FormInput.ts +227 -0
  23. package/lib/components/button.d.ts +48 -0
  24. package/lib/components/button.d.ts.map +1 -0
  25. package/lib/components/button.js +121 -0
  26. package/lib/components/button.ts +178 -0
  27. package/lib/components/card.d.ts +34 -0
  28. package/lib/components/card.d.ts.map +1 -0
  29. package/lib/components/card.js +127 -0
  30. package/lib/components/card.ts +173 -0
  31. package/lib/components/chart.d.ts +45 -0
  32. package/lib/components/chart.d.ts.map +1 -0
  33. package/lib/components/chart.js +186 -0
  34. package/lib/components/chart.ts +231 -0
  35. package/lib/components/checkbox.d.ts +31 -0
  36. package/lib/components/checkbox.d.ts.map +1 -0
  37. package/lib/components/checkbox.js +185 -0
  38. package/lib/components/checkbox.ts +242 -0
  39. package/lib/components/code.d.ts +24 -0
  40. package/lib/components/code.d.ts.map +1 -0
  41. package/lib/components/code.js +88 -0
  42. package/lib/components/code.ts +123 -0
  43. package/lib/components/container.d.ts +42 -0
  44. package/lib/components/container.d.ts.map +1 -0
  45. package/lib/components/container.js +93 -0
  46. package/lib/components/container.ts +140 -0
  47. package/lib/components/data.d.ts +36 -0
  48. package/lib/components/data.d.ts.map +1 -0
  49. package/lib/components/data.js +110 -0
  50. package/lib/components/data.ts +135 -0
  51. package/lib/components/datepicker.d.ts +38 -0
  52. package/lib/components/datepicker.d.ts.map +1 -0
  53. package/lib/components/datepicker.js +177 -0
  54. package/lib/components/datepicker.ts +234 -0
  55. package/lib/components/dialog.d.ts +38 -0
  56. package/lib/components/dialog.d.ts.map +1 -0
  57. package/lib/components/dialog.js +126 -0
  58. package/lib/components/dialog.ts +172 -0
  59. package/lib/components/divider.d.ts +30 -0
  60. package/lib/components/divider.d.ts.map +1 -0
  61. package/lib/components/divider.js +69 -0
  62. package/lib/components/divider.ts +100 -0
  63. package/lib/components/dropdown.d.ts +39 -0
  64. package/lib/components/dropdown.d.ts.map +1 -0
  65. package/lib/components/dropdown.js +133 -0
  66. package/lib/components/dropdown.ts +186 -0
  67. package/lib/components/element.d.ts +50 -0
  68. package/lib/components/element.d.ts.map +1 -0
  69. package/lib/components/element.js +206 -0
  70. package/lib/components/element.ts +267 -0
  71. package/lib/components/fileupload.d.ts +40 -0
  72. package/lib/components/fileupload.d.ts.map +1 -0
  73. package/lib/components/fileupload.js +241 -0
  74. package/lib/components/fileupload.ts +309 -0
  75. package/lib/components/grid.d.ts +87 -0
  76. package/lib/components/grid.d.ts.map +1 -0
  77. package/lib/components/grid.js +205 -0
  78. package/lib/components/grid.ts +291 -0
  79. package/lib/components/guard.d.ts +41 -0
  80. package/lib/components/guard.d.ts.map +1 -0
  81. package/lib/components/guard.js +56 -0
  82. package/lib/components/guard.ts +92 -0
  83. package/lib/components/heading.d.ts +24 -0
  84. package/lib/components/heading.d.ts.map +1 -0
  85. package/lib/components/heading.js +67 -0
  86. package/lib/components/heading.ts +96 -0
  87. package/lib/components/helpers.d.ts +9 -0
  88. package/lib/components/helpers.d.ts.map +1 -0
  89. package/lib/components/helpers.js +30 -0
  90. package/lib/components/helpers.ts +41 -0
  91. package/lib/components/hero.d.ts +45 -0
  92. package/lib/components/hero.d.ts.map +1 -0
  93. package/lib/components/hero.js +165 -0
  94. package/lib/components/hero.ts +224 -0
  95. package/lib/components/icon.d.ts +35 -0
  96. package/lib/components/icon.d.ts.map +1 -0
  97. package/lib/components/icon.js +132 -0
  98. package/lib/components/icon.ts +178 -0
  99. package/lib/components/icons.d.ts +25 -0
  100. package/lib/components/icons.d.ts.map +1 -0
  101. package/lib/components/icons.js +440 -0
  102. package/lib/components/icons.ts +464 -0
  103. package/lib/components/include.d.ts +120 -0
  104. package/lib/components/include.d.ts.map +1 -0
  105. package/lib/components/include.js +350 -0
  106. package/lib/components/include.ts +410 -0
  107. package/lib/components/input.d.ts +83 -0
  108. package/lib/components/input.d.ts.map +1 -0
  109. package/lib/components/input.js +348 -0
  110. package/lib/components/input.ts +457 -0
  111. package/lib/components/list.d.ts +82 -0
  112. package/lib/components/list.d.ts.map +1 -0
  113. package/lib/components/list.js +311 -0
  114. package/lib/components/list.ts +419 -0
  115. package/lib/components/loading.d.ts +24 -0
  116. package/lib/components/loading.d.ts.map +1 -0
  117. package/lib/components/loading.js +73 -0
  118. package/lib/components/loading.ts +100 -0
  119. package/lib/components/menu.d.ts +37 -0
  120. package/lib/components/menu.d.ts.map +1 -0
  121. package/lib/components/menu.js +202 -0
  122. package/lib/components/menu.ts +275 -0
  123. package/lib/components/modal.d.ts +51 -0
  124. package/lib/components/modal.d.ts.map +1 -0
  125. package/lib/components/modal.js +227 -0
  126. package/lib/components/modal.ts +284 -0
  127. package/lib/components/nav.d.ts +45 -0
  128. package/lib/components/nav.d.ts.map +1 -0
  129. package/lib/components/nav.js +190 -0
  130. package/lib/components/nav.ts +257 -0
  131. package/lib/components/paragraph.d.ts +21 -0
  132. package/lib/components/paragraph.d.ts.map +1 -0
  133. package/lib/components/paragraph.js +70 -0
  134. package/lib/components/paragraph.ts +97 -0
  135. package/lib/components/progress.d.ts +39 -0
  136. package/lib/components/progress.d.ts.map +1 -0
  137. package/lib/components/progress.js +113 -0
  138. package/lib/components/progress.ts +159 -0
  139. package/lib/components/radio.d.ts +41 -0
  140. package/lib/components/radio.d.ts.map +1 -0
  141. package/lib/components/radio.js +203 -0
  142. package/lib/components/radio.ts +278 -0
  143. package/lib/components/req.d.ts +155 -0
  144. package/lib/components/req.d.ts.map +1 -0
  145. package/lib/components/req.js +253 -0
  146. package/lib/components/req.ts +303 -0
  147. package/lib/components/script.d.ts +14 -0
  148. package/lib/components/script.d.ts.map +1 -0
  149. package/lib/components/script.js +33 -0
  150. package/lib/components/script.ts +41 -0
  151. package/lib/components/select.d.ts +40 -0
  152. package/lib/components/select.d.ts.map +1 -0
  153. package/lib/components/select.js +183 -0
  154. package/lib/components/select.ts +252 -0
  155. package/lib/components/sidebar.d.ts +48 -0
  156. package/lib/components/sidebar.d.ts.map +1 -0
  157. package/lib/components/sidebar.js +207 -0
  158. package/lib/components/sidebar.ts +275 -0
  159. package/lib/components/style.d.ts +14 -0
  160. package/lib/components/style.d.ts.map +1 -0
  161. package/lib/components/style.js +33 -0
  162. package/lib/components/style.ts +41 -0
  163. package/lib/components/switch.d.ts +32 -0
  164. package/lib/components/switch.d.ts.map +1 -0
  165. package/lib/components/switch.js +186 -0
  166. package/lib/components/switch.ts +246 -0
  167. package/lib/components/table.d.ts +137 -0
  168. package/lib/components/table.d.ts.map +1 -0
  169. package/lib/components/table.js +1045 -0
  170. package/lib/components/table.ts +1249 -0
  171. package/lib/components/tabs.d.ts +36 -0
  172. package/lib/components/tabs.d.ts.map +1 -0
  173. package/lib/components/tabs.js +198 -0
  174. package/lib/components/tabs.ts +250 -0
  175. package/lib/components/theme-toggle.d.ts +44 -0
  176. package/lib/components/theme-toggle.d.ts.map +1 -0
  177. package/lib/components/theme-toggle.js +215 -0
  178. package/lib/components/theme-toggle.ts +293 -0
  179. package/lib/components/tooltip.d.ts +30 -0
  180. package/lib/components/tooltip.d.ts.map +1 -0
  181. package/lib/components/tooltip.js +109 -0
  182. package/lib/components/tooltip.ts +144 -0
  183. package/lib/components/view.d.ts +48 -0
  184. package/lib/components/view.d.ts.map +1 -0
  185. package/lib/components/view.js +149 -0
  186. package/lib/components/view.ts +190 -0
  187. package/lib/components/write.d.ts +107 -0
  188. package/lib/components/write.d.ts.map +1 -0
  189. package/lib/components/write.js +222 -0
  190. package/lib/components/write.ts +272 -0
  191. package/lib/layouts/default.css +260 -0
  192. package/lib/layouts/figma.css +334 -0
  193. package/lib/reactivity/state.d.ts +36 -0
  194. package/lib/reactivity/state.d.ts.map +1 -0
  195. package/lib/reactivity/state.js +67 -0
  196. package/lib/reactivity/state.ts +78 -0
  197. package/lib/utils/fetch.d.ts +176 -0
  198. package/lib/utils/fetch.d.ts.map +1 -0
  199. package/lib/utils/fetch.js +427 -0
  200. package/lib/utils/fetch.ts +553 -0
  201. package/machinery/compiler3.js +78 -0
  202. package/machinery/doc-generator.js +136 -0
  203. package/machinery/imports.js +155 -0
  204. package/machinery/ts-shim.js +46 -0
  205. package/package.json +9 -15
@@ -0,0 +1,126 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+ // Event definitions
3
+ const TRIGGER_EVENTS = [];
4
+ const CALLBACK_EVENTS = ['confirm', 'cancel'];
5
+ export class Dialog extends BaseComponent {
6
+ constructor(id, options = {}) {
7
+ super(id, {
8
+ title: options.title ?? 'Confirm',
9
+ message: options.message ?? 'Are you sure?',
10
+ confirmText: options.confirmText ?? 'Confirm',
11
+ cancelText: options.cancelText ?? 'Cancel',
12
+ variant: options.variant ?? 'default',
13
+ open: false,
14
+ style: options.style ?? '',
15
+ class: options.class ?? ''
16
+ });
17
+ this._dialog = null;
18
+ this._overlay = null;
19
+ }
20
+ getTriggerEvents() {
21
+ return TRIGGER_EVENTS;
22
+ }
23
+ getCallbackEvents() {
24
+ return CALLBACK_EVENTS;
25
+ }
26
+ /* ═════════════════════════════════════════════════════════════════
27
+ * FLUENT API
28
+ * ═════════════════════════════════════════════════════════════════ */
29
+ title(value) {
30
+ this.state.title = value;
31
+ return this;
32
+ }
33
+ message(value) {
34
+ this.state.message = value;
35
+ return this;
36
+ }
37
+ confirmText(value) {
38
+ this.state.confirmText = value;
39
+ return this;
40
+ }
41
+ cancelText(value) {
42
+ this.state.cancelText = value;
43
+ return this;
44
+ }
45
+ variant(value) {
46
+ this.state.variant = value;
47
+ return this;
48
+ }
49
+ open() {
50
+ this.state.open = true;
51
+ if (this._overlay) {
52
+ this._overlay.style.display = 'flex';
53
+ }
54
+ return this;
55
+ }
56
+ close() {
57
+ this.state.open = false;
58
+ if (this._overlay) {
59
+ this._overlay.style.display = 'none';
60
+ }
61
+ return this;
62
+ }
63
+ /* ═════════════════════════════════════════════════════════════════
64
+ * RENDER
65
+ * ═════════════════════════════════════════════════════════════════ */
66
+ render(targetId) {
67
+ const { title, message, confirmText, cancelText, variant, style, class: className } = this.state;
68
+ // Overlay
69
+ const overlay = document.createElement('div');
70
+ overlay.className = 'jux-dialog-overlay';
71
+ overlay.style.display = 'none';
72
+ this._overlay = overlay;
73
+ // Dialog
74
+ const dialog = document.createElement('div');
75
+ dialog.className = `jux-dialog jux-dialog-${variant}`;
76
+ dialog.id = this._id;
77
+ if (className)
78
+ dialog.className += ` ${className}`;
79
+ if (style)
80
+ dialog.setAttribute('style', style);
81
+ this._dialog = dialog;
82
+ // Title
83
+ const titleEl = document.createElement('div');
84
+ titleEl.className = 'jux-dialog-title';
85
+ titleEl.textContent = title;
86
+ dialog.appendChild(titleEl);
87
+ // Message
88
+ const messageEl = document.createElement('div');
89
+ messageEl.className = 'jux-dialog-message';
90
+ messageEl.textContent = message;
91
+ dialog.appendChild(messageEl);
92
+ // Actions
93
+ const actions = document.createElement('div');
94
+ actions.className = 'jux-dialog-actions';
95
+ const cancelBtn = document.createElement('button');
96
+ cancelBtn.className = 'jux-dialog-button jux-dialog-button-cancel';
97
+ cancelBtn.textContent = cancelText;
98
+ cancelBtn.addEventListener('click', () => {
99
+ this._triggerCallback('cancel');
100
+ this.close();
101
+ });
102
+ const confirmBtn = document.createElement('button');
103
+ confirmBtn.className = `jux-dialog-button jux-dialog-button-confirm jux-dialog-button-${variant}`;
104
+ confirmBtn.textContent = confirmText;
105
+ confirmBtn.addEventListener('click', () => {
106
+ this._triggerCallback('confirm');
107
+ this.close();
108
+ });
109
+ actions.appendChild(cancelBtn);
110
+ actions.appendChild(confirmBtn);
111
+ dialog.appendChild(actions);
112
+ // Close on overlay click
113
+ overlay.addEventListener('click', (e) => {
114
+ if (e.target === overlay) {
115
+ this._triggerCallback('cancel');
116
+ this.close();
117
+ }
118
+ });
119
+ overlay.appendChild(dialog);
120
+ document.body.appendChild(overlay);
121
+ return this;
122
+ }
123
+ }
124
+ export function dialog(id, options = {}) {
125
+ return new Dialog(id, options);
126
+ }
@@ -0,0 +1,172 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+
3
+ // Event definitions
4
+ const TRIGGER_EVENTS = [] as const;
5
+ const CALLBACK_EVENTS = ['confirm', 'cancel'] as const;
6
+
7
+ export interface DialogOptions {
8
+ title?: string;
9
+ message?: string;
10
+ confirmText?: string;
11
+ cancelText?: string;
12
+ variant?: 'default' | 'danger' | 'warning';
13
+ style?: string;
14
+ class?: string;
15
+ }
16
+
17
+ type DialogState = {
18
+ title: string;
19
+ message: string;
20
+ confirmText: string;
21
+ cancelText: string;
22
+ variant: string;
23
+ open: boolean;
24
+ style: string;
25
+ class: string;
26
+ };
27
+
28
+ export class Dialog extends BaseComponent<DialogState> {
29
+ private _dialog: HTMLElement | null = null;
30
+ private _overlay: HTMLElement | null = null;
31
+
32
+ constructor(id: string, options: DialogOptions = {}) {
33
+ super(id, {
34
+ title: options.title ?? 'Confirm',
35
+ message: options.message ?? 'Are you sure?',
36
+ confirmText: options.confirmText ?? 'Confirm',
37
+ cancelText: options.cancelText ?? 'Cancel',
38
+ variant: options.variant ?? 'default',
39
+ open: false,
40
+ style: options.style ?? '',
41
+ class: options.class ?? ''
42
+ });
43
+ }
44
+
45
+ protected getTriggerEvents(): readonly string[] {
46
+ return TRIGGER_EVENTS;
47
+ }
48
+
49
+ protected getCallbackEvents(): readonly string[] {
50
+ return CALLBACK_EVENTS;
51
+ }
52
+
53
+ /* ═════════════════════════════════════════════════════════════════
54
+ * FLUENT API
55
+ * ═════════════════════════════════════════════════════════════════ */
56
+
57
+ title(value: string): this {
58
+ this.state.title = value;
59
+ return this;
60
+ }
61
+
62
+ message(value: string): this {
63
+ this.state.message = value;
64
+ return this;
65
+ }
66
+
67
+ confirmText(value: string): this {
68
+ this.state.confirmText = value;
69
+ return this;
70
+ }
71
+
72
+ cancelText(value: string): this {
73
+ this.state.cancelText = value;
74
+ return this;
75
+ }
76
+
77
+ variant(value: 'default' | 'danger' | 'warning'): this {
78
+ this.state.variant = value;
79
+ return this;
80
+ }
81
+
82
+ open(): this {
83
+ this.state.open = true;
84
+ if (this._overlay) {
85
+ this._overlay.style.display = 'flex';
86
+ }
87
+ return this;
88
+ }
89
+
90
+ close(): this {
91
+ this.state.open = false;
92
+ if (this._overlay) {
93
+ this._overlay.style.display = 'none';
94
+ }
95
+ return this;
96
+ }
97
+
98
+ /* ═════════════════════════════════════════════════════════════════
99
+ * RENDER
100
+ * ═════════════════════════════════════════════════════════════════ */
101
+
102
+ render(targetId?: string): this {
103
+ const { title, message, confirmText, cancelText, variant, style, class: className } = this.state;
104
+
105
+ // Overlay
106
+ const overlay = document.createElement('div');
107
+ overlay.className = 'jux-dialog-overlay';
108
+ overlay.style.display = 'none';
109
+ this._overlay = overlay;
110
+
111
+ // Dialog
112
+ const dialog = document.createElement('div');
113
+ dialog.className = `jux-dialog jux-dialog-${variant}`;
114
+ dialog.id = this._id;
115
+ if (className) dialog.className += ` ${className}`;
116
+ if (style) dialog.setAttribute('style', style);
117
+ this._dialog = dialog;
118
+
119
+ // Title
120
+ const titleEl = document.createElement('div');
121
+ titleEl.className = 'jux-dialog-title';
122
+ titleEl.textContent = title;
123
+ dialog.appendChild(titleEl);
124
+
125
+ // Message
126
+ const messageEl = document.createElement('div');
127
+ messageEl.className = 'jux-dialog-message';
128
+ messageEl.textContent = message;
129
+ dialog.appendChild(messageEl);
130
+
131
+ // Actions
132
+ const actions = document.createElement('div');
133
+ actions.className = 'jux-dialog-actions';
134
+
135
+ const cancelBtn = document.createElement('button');
136
+ cancelBtn.className = 'jux-dialog-button jux-dialog-button-cancel';
137
+ cancelBtn.textContent = cancelText;
138
+ cancelBtn.addEventListener('click', () => {
139
+ this._triggerCallback('cancel');
140
+ this.close();
141
+ });
142
+
143
+ const confirmBtn = document.createElement('button');
144
+ confirmBtn.className = `jux-dialog-button jux-dialog-button-confirm jux-dialog-button-${variant}`;
145
+ confirmBtn.textContent = confirmText;
146
+ confirmBtn.addEventListener('click', () => {
147
+ this._triggerCallback('confirm');
148
+ this.close();
149
+ });
150
+
151
+ actions.appendChild(cancelBtn);
152
+ actions.appendChild(confirmBtn);
153
+ dialog.appendChild(actions);
154
+
155
+ // Close on overlay click
156
+ overlay.addEventListener('click', (e) => {
157
+ if (e.target === overlay) {
158
+ this._triggerCallback('cancel');
159
+ this.close();
160
+ }
161
+ });
162
+
163
+ overlay.appendChild(dialog);
164
+ document.body.appendChild(overlay);
165
+
166
+ return this;
167
+ }
168
+ }
169
+
170
+ export function dialog(id: string, options: DialogOptions = {}): Dialog {
171
+ return new Dialog(id, options);
172
+ }
@@ -0,0 +1,30 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+ export interface DividerOptions {
3
+ text?: string;
4
+ variant?: 'default' | 'dashed' | 'dotted';
5
+ margin?: string;
6
+ style?: string;
7
+ class?: string;
8
+ }
9
+ type DividerState = {
10
+ text: string;
11
+ variant: string;
12
+ margin: string;
13
+ style: string;
14
+ class: string;
15
+ orientation: string;
16
+ };
17
+ export declare class Divider extends BaseComponent<DividerState> {
18
+ constructor(id?: string, options?: DividerOptions);
19
+ protected getTriggerEvents(): readonly string[];
20
+ protected getCallbackEvents(): readonly string[];
21
+ text(value: string): this;
22
+ orientation(value: 'horizontal' | 'vertical'): this;
23
+ style(value: string): this;
24
+ class(value: string): this;
25
+ render(targetId?: string): this;
26
+ renderTo(juxComponent: any): this;
27
+ }
28
+ export declare function divider(options?: DividerOptions): Divider;
29
+ export {};
30
+ //# sourceMappingURL=divider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divider.d.ts","sourceRoot":"","sources":["divider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD,MAAM,WAAW,cAAc;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,YAAY,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,qBAAa,OAAQ,SAAQ,aAAa,CAAC,YAAY,CAAC;gBACxC,EAAE,GAAE,MAA2E,EAAE,OAAO,GAAE,cAAmB;IAWzH,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAIhD,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKzB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,IAAI;IAKnD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK1B,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK1B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAyB/B,QAAQ,CAAC,YAAY,EAAE,GAAG,GAAG,IAAI;CAMpC;AAGD,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAE7D"}
@@ -0,0 +1,69 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+ // Event definitions
3
+ const TRIGGER_EVENTS = [];
4
+ const CALLBACK_EVENTS = [];
5
+ export class Divider extends BaseComponent {
6
+ constructor(id = `divider-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, options = {}) {
7
+ super(id, {
8
+ text: options.text ?? '',
9
+ variant: options.variant ?? 'default',
10
+ margin: options.margin ?? '1rem 0',
11
+ style: options.style ?? '',
12
+ class: options.class ?? '',
13
+ orientation: 'horizontal'
14
+ });
15
+ }
16
+ getTriggerEvents() {
17
+ return TRIGGER_EVENTS;
18
+ }
19
+ getCallbackEvents() {
20
+ return CALLBACK_EVENTS;
21
+ }
22
+ text(value) {
23
+ this.state.text = value;
24
+ return this;
25
+ }
26
+ orientation(value) {
27
+ this.state.orientation = value;
28
+ return this;
29
+ }
30
+ style(value) {
31
+ this.state.style = value;
32
+ return this;
33
+ }
34
+ class(value) {
35
+ this.state.class = value;
36
+ return this;
37
+ }
38
+ render(targetId) {
39
+ const container = this._setupContainer(targetId);
40
+ const { text, variant, margin, style, class: className } = this.state;
41
+ const divider = document.createElement('div');
42
+ divider.className = `jux-divider jux-divider-${variant}`;
43
+ divider.id = this._id;
44
+ divider.style.margin = margin;
45
+ if (className)
46
+ divider.className += ` ${className}`;
47
+ if (style)
48
+ divider.setAttribute('style', `${divider.getAttribute('style')}; ${style}`);
49
+ if (text) {
50
+ const textEl = document.createElement('span');
51
+ textEl.className = 'jux-divider-text';
52
+ textEl.textContent = text;
53
+ divider.appendChild(textEl);
54
+ }
55
+ this._wireStandardEvents(divider);
56
+ container.appendChild(divider);
57
+ return this;
58
+ }
59
+ renderTo(juxComponent) {
60
+ if (!juxComponent?._id) {
61
+ throw new Error('Divider.renderTo: Invalid component');
62
+ }
63
+ return this.render(`#${juxComponent._id}`);
64
+ }
65
+ }
66
+ // ✅ ID is now optional - auto-generated if not provided
67
+ export function divider(options = {}) {
68
+ return new Divider(undefined, options);
69
+ }
@@ -0,0 +1,100 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+
3
+ // Event definitions
4
+ const TRIGGER_EVENTS = [] as const;
5
+ const CALLBACK_EVENTS = [] as const;
6
+
7
+ export interface DividerOptions {
8
+ text?: string;
9
+ variant?: 'default' | 'dashed' | 'dotted';
10
+ margin?: string;
11
+ style?: string;
12
+ class?: string;
13
+ }
14
+
15
+ type DividerState = {
16
+ text: string;
17
+ variant: string;
18
+ margin: string;
19
+ style: string;
20
+ class: string;
21
+ orientation: string;
22
+ };
23
+
24
+ export class Divider extends BaseComponent<DividerState> {
25
+ constructor(id: string = `divider-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, options: DividerOptions = {}) {
26
+ super(id, {
27
+ text: options.text ?? '',
28
+ variant: options.variant ?? 'default',
29
+ margin: options.margin ?? '1rem 0',
30
+ style: options.style ?? '',
31
+ class: options.class ?? '',
32
+ orientation: 'horizontal'
33
+ });
34
+ }
35
+
36
+ protected getTriggerEvents(): readonly string[] {
37
+ return TRIGGER_EVENTS;
38
+ }
39
+
40
+ protected getCallbackEvents(): readonly string[] {
41
+ return CALLBACK_EVENTS;
42
+ }
43
+
44
+ text(value: string): this {
45
+ this.state.text = value;
46
+ return this;
47
+ }
48
+
49
+ orientation(value: 'horizontal' | 'vertical'): this {
50
+ this.state.orientation = value;
51
+ return this;
52
+ }
53
+
54
+ style(value: string): this {
55
+ this.state.style = value;
56
+ return this;
57
+ }
58
+
59
+ class(value: string): this {
60
+ this.state.class = value;
61
+ return this;
62
+ }
63
+
64
+ render(targetId?: string): this {
65
+ const container = this._setupContainer(targetId);
66
+
67
+ const { text, variant, margin, style, class: className } = this.state;
68
+
69
+ const divider = document.createElement('div');
70
+ divider.className = `jux-divider jux-divider-${variant}`;
71
+ divider.id = this._id;
72
+ divider.style.margin = margin;
73
+ if (className) divider.className += ` ${className}`;
74
+ if (style) divider.setAttribute('style', `${divider.getAttribute('style')}; ${style}`);
75
+
76
+ if (text) {
77
+ const textEl = document.createElement('span');
78
+ textEl.className = 'jux-divider-text';
79
+ textEl.textContent = text;
80
+ divider.appendChild(textEl);
81
+ }
82
+
83
+ this._wireStandardEvents(divider);
84
+ container.appendChild(divider);
85
+
86
+ return this;
87
+ }
88
+
89
+ renderTo(juxComponent: any): this {
90
+ if (!juxComponent?._id) {
91
+ throw new Error('Divider.renderTo: Invalid component');
92
+ }
93
+ return this.render(`#${juxComponent._id}`);
94
+ }
95
+ }
96
+
97
+ // ✅ ID is now optional - auto-generated if not provided
98
+ export function divider(options: DividerOptions = {}): Divider {
99
+ return new Divider(undefined, options);
100
+ }
@@ -0,0 +1,39 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+ export interface DropdownItem {
3
+ label?: string;
4
+ icon?: string;
5
+ divider?: boolean;
6
+ click?: () => void;
7
+ }
8
+ export interface DropdownOptions {
9
+ triggerLabel?: string;
10
+ items?: DropdownItem[];
11
+ position?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
12
+ style?: string;
13
+ class?: string;
14
+ }
15
+ type DropdownState = {
16
+ triggerLabel: string;
17
+ items: DropdownItem[];
18
+ position: string;
19
+ open: boolean;
20
+ style: string;
21
+ class: string;
22
+ };
23
+ export declare class Dropdown extends BaseComponent<DropdownState> {
24
+ private _dropdown;
25
+ private _menu;
26
+ constructor(id: string, options?: DropdownOptions);
27
+ protected getTriggerEvents(): readonly string[];
28
+ protected getCallbackEvents(): readonly string[];
29
+ triggerLabel(value: string): this;
30
+ items(value: DropdownItem[]): this;
31
+ position(value: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'): this;
32
+ open(): this;
33
+ close(): this;
34
+ toggle(): this;
35
+ render(targetId?: string): this;
36
+ }
37
+ export declare function dropdown(id: string, options?: DropdownOptions): Dropdown;
38
+ export {};
39
+ //# sourceMappingURL=dropdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["dropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD,MAAM,WAAW,YAAY;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,aAAa,GAAG,cAAc,GAAG,UAAU,GAAG,WAAW,CAAC;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,aAAa,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,QAAS,SAAQ,aAAa,CAAC,aAAa,CAAC;IACtD,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,KAAK,CAA4B;gBAE7B,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;IAWrD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAQhD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKjC,KAAK,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,IAAI;IAKlC,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,GAAG,UAAU,GAAG,WAAW,GAAG,IAAI;IAKhF,IAAI,IAAI,IAAI;IAQZ,KAAK,IAAI,IAAI;IAQb,MAAM,IAAI,IAAI;IAQd,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;CAqFlC;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,QAAQ,CAE5E"}
@@ -0,0 +1,133 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+ // Event definitions
3
+ const TRIGGER_EVENTS = [];
4
+ const CALLBACK_EVENTS = ['select'];
5
+ export class Dropdown extends BaseComponent {
6
+ constructor(id, options = {}) {
7
+ super(id, {
8
+ triggerLabel: options.triggerLabel ?? 'Menu',
9
+ items: options.items ?? [],
10
+ position: options.position ?? 'bottom-left',
11
+ open: false,
12
+ style: options.style ?? '',
13
+ class: options.class ?? ''
14
+ });
15
+ this._dropdown = null;
16
+ this._menu = null;
17
+ }
18
+ getTriggerEvents() {
19
+ return TRIGGER_EVENTS;
20
+ }
21
+ getCallbackEvents() {
22
+ return CALLBACK_EVENTS;
23
+ }
24
+ /* ═════════════════════════════════════════════════════════════════
25
+ * FLUENT API
26
+ * ═════════════════════════════════════════════════════════════════ */
27
+ triggerLabel(value) {
28
+ this.state.triggerLabel = value;
29
+ return this;
30
+ }
31
+ items(value) {
32
+ this.state.items = value;
33
+ return this;
34
+ }
35
+ position(value) {
36
+ this.state.position = value;
37
+ return this;
38
+ }
39
+ open() {
40
+ this.state.open = true;
41
+ if (this._menu) {
42
+ this._menu.style.display = 'block';
43
+ }
44
+ return this;
45
+ }
46
+ close() {
47
+ this.state.open = false;
48
+ if (this._menu) {
49
+ this._menu.style.display = 'none';
50
+ }
51
+ return this;
52
+ }
53
+ toggle() {
54
+ return this.state.open ? this.close() : this.open();
55
+ }
56
+ /* ═════════════════════════════════════════════════════════════════
57
+ * RENDER
58
+ * ═════════════════════════════════════════════════════════════════ */
59
+ render(targetId) {
60
+ const container = this._setupContainer(targetId);
61
+ const { triggerLabel, items, position, style, class: className } = this.state;
62
+ const wrapper = document.createElement('div');
63
+ wrapper.className = 'jux-dropdown';
64
+ wrapper.id = this._id;
65
+ if (className)
66
+ wrapper.className += ` ${className}`;
67
+ if (style)
68
+ wrapper.setAttribute('style', style);
69
+ // Trigger button
70
+ const triggerBtn = document.createElement('button');
71
+ triggerBtn.className = 'jux-dropdown-trigger';
72
+ triggerBtn.textContent = triggerLabel;
73
+ triggerBtn.type = 'button';
74
+ // Dropdown menu
75
+ const menu = document.createElement('div');
76
+ menu.className = `jux-dropdown-menu jux-dropdown-${position}`;
77
+ menu.style.display = 'none';
78
+ this._menu = menu;
79
+ items.forEach(item => {
80
+ if (item.divider) {
81
+ const divider = document.createElement('div');
82
+ divider.className = 'jux-dropdown-divider';
83
+ menu.appendChild(divider);
84
+ }
85
+ else {
86
+ const menuItem = document.createElement('button');
87
+ menuItem.className = 'jux-dropdown-item';
88
+ menuItem.type = 'button';
89
+ if (item.icon) {
90
+ const icon = document.createElement('span');
91
+ icon.className = 'jux-dropdown-icon';
92
+ icon.textContent = item.icon;
93
+ menuItem.appendChild(icon);
94
+ }
95
+ if (item.label) {
96
+ const label = document.createElement('span');
97
+ label.textContent = item.label;
98
+ menuItem.appendChild(label);
99
+ }
100
+ menuItem.addEventListener('click', () => {
101
+ // 🎯 Fire the select callback event
102
+ this._triggerCallback('select', item);
103
+ // Then fire item-specific click handler
104
+ if (item.click) {
105
+ item.click();
106
+ }
107
+ this.close();
108
+ });
109
+ menu.appendChild(menuItem);
110
+ }
111
+ });
112
+ // Toggle on trigger click
113
+ triggerBtn.addEventListener('click', (e) => {
114
+ e.stopPropagation();
115
+ this.toggle();
116
+ });
117
+ // Close on outside click
118
+ document.addEventListener('click', (e) => {
119
+ if (this._dropdown && !this._dropdown.contains(e.target)) {
120
+ this.close();
121
+ }
122
+ });
123
+ wrapper.appendChild(triggerBtn);
124
+ wrapper.appendChild(menu);
125
+ this._wireStandardEvents(wrapper);
126
+ container.appendChild(wrapper);
127
+ this._dropdown = wrapper;
128
+ return this;
129
+ }
130
+ }
131
+ export function dropdown(id, options = {}) {
132
+ return new Dropdown(id, options);
133
+ }