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,24 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+ export interface CodeOptions {
3
+ code?: string;
4
+ language?: string;
5
+ style?: string;
6
+ class?: string;
7
+ }
8
+ type CodeState = {
9
+ code: string;
10
+ language: string;
11
+ style: string;
12
+ class: string;
13
+ };
14
+ export declare class Code extends BaseComponent<CodeState> {
15
+ constructor(id: string, options?: CodeOptions);
16
+ protected getTriggerEvents(): readonly string[];
17
+ protected getCallbackEvents(): readonly string[];
18
+ code(value: string): this;
19
+ language(value: string): this;
20
+ render(targetId?: string): this;
21
+ }
22
+ export declare function code(id: string, options?: CodeOptions): Code;
23
+ export {};
24
+ //# sourceMappingURL=code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code.d.ts","sourceRoot":"","sources":["code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,IAAK,SAAQ,aAAa,CAAC,SAAS,CAAC;gBACpC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB;IASjD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAUhD,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKzB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAS7B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;CA4DhC;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAEhE"}
@@ -0,0 +1,88 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+ // Event definitions
3
+ const TRIGGER_EVENTS = [];
4
+ const CALLBACK_EVENTS = [];
5
+ export class Code extends BaseComponent {
6
+ constructor(id, options = {}) {
7
+ super(id, {
8
+ code: options.code ?? '',
9
+ language: options.language ?? 'javascript',
10
+ style: options.style ?? '',
11
+ class: options.class ?? ''
12
+ });
13
+ }
14
+ getTriggerEvents() {
15
+ return TRIGGER_EVENTS;
16
+ }
17
+ getCallbackEvents() {
18
+ return CALLBACK_EVENTS;
19
+ }
20
+ /* ═════════════════════════════════════════════════════════════════
21
+ * FLUENT API
22
+ * ═════════════════════════════════════════════════════════════════ */
23
+ // ✅ Inherited from BaseComponent
24
+ code(value) {
25
+ this.state.code = value;
26
+ return this;
27
+ }
28
+ language(value) {
29
+ this.state.language = value;
30
+ return this;
31
+ }
32
+ /* ═════════════════════════════════════════════════════════════════
33
+ * RENDER
34
+ * ═════════════════════════════════════════════════════════════════ */
35
+ render(targetId) {
36
+ const container = this._setupContainer(targetId);
37
+ const { code, language, style, class: className } = this.state;
38
+ const wrapper = document.createElement('div');
39
+ wrapper.className = 'jux-code';
40
+ wrapper.id = this._id;
41
+ if (className)
42
+ wrapper.className += ` ${className}`;
43
+ if (style)
44
+ wrapper.setAttribute('style', style);
45
+ const pre = document.createElement('pre');
46
+ const codeEl = document.createElement('code');
47
+ codeEl.className = `language-${language}`;
48
+ codeEl.textContent = code;
49
+ pre.appendChild(codeEl);
50
+ wrapper.appendChild(pre);
51
+ this._wireStandardEvents(wrapper);
52
+ // Wire sync bindings
53
+ this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
54
+ if (property === 'code') {
55
+ const transform = toComponent || ((v) => String(v));
56
+ stateObj.subscribe((val) => {
57
+ const transformed = transform(val);
58
+ codeEl.textContent = transformed;
59
+ this.state.code = transformed;
60
+ if (window.Prism) {
61
+ window.Prism.highlightElement(codeEl);
62
+ }
63
+ });
64
+ }
65
+ else if (property === 'language') {
66
+ const transform = toComponent || ((v) => String(v));
67
+ stateObj.subscribe((val) => {
68
+ const transformed = transform(val);
69
+ codeEl.className = `language-${transformed}`;
70
+ this.state.language = transformed;
71
+ if (window.Prism) {
72
+ window.Prism.highlightElement(codeEl);
73
+ }
74
+ });
75
+ }
76
+ });
77
+ container.appendChild(wrapper);
78
+ requestAnimationFrame(() => {
79
+ if (window.Prism) {
80
+ window.Prism.highlightElement(codeEl);
81
+ }
82
+ });
83
+ return this;
84
+ }
85
+ }
86
+ export function code(id, options = {}) {
87
+ return new Code(id, options);
88
+ }
@@ -0,0 +1,123 @@
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 CodeOptions {
8
+ code?: string;
9
+ language?: string;
10
+ style?: string;
11
+ class?: string;
12
+ }
13
+
14
+ type CodeState = {
15
+ code: string;
16
+ language: string;
17
+ style: string;
18
+ class: string;
19
+ };
20
+
21
+ export class Code extends BaseComponent<CodeState> {
22
+ constructor(id: string, options: CodeOptions = {}) {
23
+ super(id, {
24
+ code: options.code ?? '',
25
+ language: options.language ?? 'javascript',
26
+ style: options.style ?? '',
27
+ class: options.class ?? ''
28
+ });
29
+ }
30
+
31
+ protected getTriggerEvents(): readonly string[] {
32
+ return TRIGGER_EVENTS;
33
+ }
34
+
35
+ protected getCallbackEvents(): readonly string[] {
36
+ return CALLBACK_EVENTS;
37
+ }
38
+
39
+ /* ═════════════════════════════════════════════════════════════════
40
+ * FLUENT API
41
+ * ═════════════════════════════════════════════════════════════════ */
42
+
43
+ // ✅ Inherited from BaseComponent
44
+
45
+ code(value: string): this {
46
+ this.state.code = value;
47
+ return this;
48
+ }
49
+
50
+ language(value: string): this {
51
+ this.state.language = value;
52
+ return this;
53
+ }
54
+
55
+ /* ═════════════════════════════════════════════════════════════════
56
+ * RENDER
57
+ * ═════════════════════════════════════════════════════════════════ */
58
+
59
+ render(targetId?: string): this {
60
+ const container = this._setupContainer(targetId);
61
+
62
+ const { code, language, style, class: className } = this.state;
63
+
64
+ const wrapper = document.createElement('div');
65
+ wrapper.className = 'jux-code';
66
+ wrapper.id = this._id;
67
+ if (className) wrapper.className += ` ${className}`;
68
+ if (style) wrapper.setAttribute('style', style);
69
+
70
+ const pre = document.createElement('pre');
71
+ const codeEl = document.createElement('code');
72
+ codeEl.className = `language-${language}`;
73
+ codeEl.textContent = code;
74
+ pre.appendChild(codeEl);
75
+ wrapper.appendChild(pre);
76
+
77
+ this._wireStandardEvents(wrapper);
78
+
79
+ // Wire sync bindings
80
+ this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
81
+ if (property === 'code') {
82
+ const transform = toComponent || ((v: any) => String(v));
83
+
84
+ stateObj.subscribe((val: any) => {
85
+ const transformed = transform(val);
86
+ codeEl.textContent = transformed;
87
+ this.state.code = transformed;
88
+
89
+ if ((window as any).Prism) {
90
+ (window as any).Prism.highlightElement(codeEl);
91
+ }
92
+ });
93
+ }
94
+ else if (property === 'language') {
95
+ const transform = toComponent || ((v: any) => String(v));
96
+
97
+ stateObj.subscribe((val: any) => {
98
+ const transformed = transform(val);
99
+ codeEl.className = `language-${transformed}`;
100
+ this.state.language = transformed;
101
+
102
+ if ((window as any).Prism) {
103
+ (window as any).Prism.highlightElement(codeEl);
104
+ }
105
+ });
106
+ }
107
+ });
108
+
109
+ container.appendChild(wrapper);
110
+
111
+ requestAnimationFrame(() => {
112
+ if ((window as any).Prism) {
113
+ (window as any).Prism.highlightElement(codeEl);
114
+ }
115
+ });
116
+
117
+ return this;
118
+ }
119
+ }
120
+
121
+ export function code(id: string, options: CodeOptions = {}): Code {
122
+ return new Code(id, options);
123
+ }
@@ -0,0 +1,42 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+ /**
3
+ * Container options
4
+ */
5
+ export interface ContainerOptions {
6
+ class?: string;
7
+ style?: string;
8
+ direction?: 'row' | 'column';
9
+ gap?: string | number;
10
+ align?: 'start' | 'center' | 'end' | 'stretch';
11
+ justify?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
12
+ }
13
+ /**
14
+ * Container state
15
+ */
16
+ type ContainerState = {
17
+ class: string;
18
+ style: string;
19
+ direction?: 'row' | 'column';
20
+ gap?: string | number;
21
+ align?: string;
22
+ justify?: string;
23
+ };
24
+ /**
25
+ * Container component - a simple div container for grouping elements
26
+ */
27
+ export declare class Container extends BaseComponent<ContainerState> {
28
+ constructor(id: string, options?: ContainerOptions);
29
+ protected getTriggerEvents(): readonly string[];
30
+ protected getCallbackEvents(): readonly string[];
31
+ direction(value: 'row' | 'column'): this;
32
+ gap(value: string | number): this;
33
+ align(value: 'start' | 'center' | 'end' | 'stretch'): this;
34
+ justify(value: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly'): this;
35
+ render(targetId?: string): this;
36
+ }
37
+ /**
38
+ * Factory helper
39
+ */
40
+ export declare function container(id: string, options?: ContainerOptions): Container;
41
+ export {};
42
+ //# sourceMappingURL=container.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,eAAe,GAAG,cAAc,GAAG,cAAc,CAAC;CAC1F;AAED;;GAEG;AACH,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAU,SAAQ,aAAa,CAAC,cAAc,CAAC;gBAC9C,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAWtD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAgBhD,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,GAAG,IAAI;IAKxC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKjC,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,IAAI;IAK1D,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,eAAe,GAAG,cAAc,GAAG,cAAc,GAAG,IAAI;IASpG,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;CA2ChC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAE/E"}
@@ -0,0 +1,93 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+ // Event definitions - Container is a layout wrapper that can be clicked
3
+ const TRIGGER_EVENTS = [];
4
+ const CALLBACK_EVENTS = ['click'];
5
+ /**
6
+ * Container component - a simple div container for grouping elements
7
+ */
8
+ export class Container extends BaseComponent {
9
+ constructor(id, options = {}) {
10
+ super(id, {
11
+ class: options.class ?? '',
12
+ style: options.style ?? '',
13
+ direction: options.direction,
14
+ gap: options.gap,
15
+ align: options.align,
16
+ justify: options.justify
17
+ });
18
+ }
19
+ getTriggerEvents() {
20
+ return TRIGGER_EVENTS;
21
+ }
22
+ getCallbackEvents() {
23
+ return CALLBACK_EVENTS;
24
+ }
25
+ /* -------------------------
26
+ * Fluent API
27
+ * ------------------------- */
28
+ // ✅ Inherited from BaseComponent:
29
+ // - style(), class()
30
+ // - bind(), sync(), renderTo()
31
+ // - addClass(), removeClass(), toggleClass()
32
+ // - visible(), show(), hide()
33
+ // - attr(), attrs(), removeAttr()
34
+ // - disabled(), enable(), disable()
35
+ direction(value) {
36
+ this.state.direction = value;
37
+ return this;
38
+ }
39
+ gap(value) {
40
+ this.state.gap = value;
41
+ return this;
42
+ }
43
+ align(value) {
44
+ this.state.align = value;
45
+ return this;
46
+ }
47
+ justify(value) {
48
+ this.state.justify = value;
49
+ return this;
50
+ }
51
+ /* -------------------------
52
+ * Render
53
+ * ------------------------- */
54
+ render(targetId) {
55
+ const container = this._setupContainer(targetId);
56
+ const { class: className, style, direction, gap, align, justify } = this.state;
57
+ const div = document.createElement('div');
58
+ div.id = this._id;
59
+ // Always include jux-container class, append custom classes
60
+ div.className = className ? `jux-container ${className}` : 'jux-container';
61
+ // Only apply flex styles if any flex properties are set
62
+ const usesFlexbox = direction || gap !== undefined || align || justify;
63
+ let computedStyle = style;
64
+ if (usesFlexbox) {
65
+ const flexStyles = ['display: flex', 'width: auto'];
66
+ if (direction)
67
+ flexStyles.push(`flex-direction: ${direction}`);
68
+ if (gap !== undefined) {
69
+ const gapValue = typeof gap === 'number' ? `${gap}px` : gap;
70
+ flexStyles.push(`gap: ${gapValue}`);
71
+ }
72
+ // Only set align-items if explicitly specified
73
+ if (align)
74
+ flexStyles.push(`align-items: ${align}`);
75
+ // Only set justify-content if explicitly specified
76
+ if (justify)
77
+ flexStyles.push(`justify-content: ${justify}`);
78
+ computedStyle = `${flexStyles.join('; ')}; ${style}`.trim();
79
+ }
80
+ if (computedStyle) {
81
+ div.setAttribute('style', computedStyle);
82
+ }
83
+ this._wireStandardEvents(div);
84
+ container.appendChild(div);
85
+ return this;
86
+ }
87
+ }
88
+ /**
89
+ * Factory helper
90
+ */
91
+ export function container(id, options = {}) {
92
+ return new Container(id, options);
93
+ }
@@ -0,0 +1,140 @@
1
+ import { BaseComponent } from './base/BaseComponent.js';
2
+
3
+ // Event definitions - Container is a layout wrapper that can be clicked
4
+ const TRIGGER_EVENTS = [] as const;
5
+ const CALLBACK_EVENTS = ['click'] as const;
6
+
7
+ /**
8
+ * Container options
9
+ */
10
+ export interface ContainerOptions {
11
+ class?: string;
12
+ style?: string;
13
+ direction?: 'row' | 'column';
14
+ gap?: string | number;
15
+ align?: 'start' | 'center' | 'end' | 'stretch';
16
+ justify?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
17
+ }
18
+
19
+ /**
20
+ * Container state
21
+ */
22
+ type ContainerState = {
23
+ class: string;
24
+ style: string;
25
+ direction?: 'row' | 'column';
26
+ gap?: string | number;
27
+ align?: string;
28
+ justify?: string;
29
+ };
30
+
31
+ /**
32
+ * Container component - a simple div container for grouping elements
33
+ */
34
+ export class Container extends BaseComponent<ContainerState> {
35
+ constructor(id: string, options: ContainerOptions = {}) {
36
+ super(id, {
37
+ class: options.class ?? '',
38
+ style: options.style ?? '',
39
+ direction: options.direction,
40
+ gap: options.gap,
41
+ align: options.align,
42
+ justify: options.justify
43
+ });
44
+ }
45
+
46
+ protected getTriggerEvents(): readonly string[] {
47
+ return TRIGGER_EVENTS;
48
+ }
49
+
50
+ protected getCallbackEvents(): readonly string[] {
51
+ return CALLBACK_EVENTS;
52
+ }
53
+
54
+ /* -------------------------
55
+ * Fluent API
56
+ * ------------------------- */
57
+
58
+ // ✅ Inherited from BaseComponent:
59
+ // - style(), class()
60
+ // - bind(), sync(), renderTo()
61
+ // - addClass(), removeClass(), toggleClass()
62
+ // - visible(), show(), hide()
63
+ // - attr(), attrs(), removeAttr()
64
+ // - disabled(), enable(), disable()
65
+
66
+ direction(value: 'row' | 'column'): this {
67
+ this.state.direction = value;
68
+ return this;
69
+ }
70
+
71
+ gap(value: string | number): this {
72
+ this.state.gap = value;
73
+ return this;
74
+ }
75
+
76
+ align(value: 'start' | 'center' | 'end' | 'stretch'): this {
77
+ this.state.align = value;
78
+ return this;
79
+ }
80
+
81
+ justify(value: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly'): this {
82
+ this.state.justify = value;
83
+ return this;
84
+ }
85
+
86
+ /* -------------------------
87
+ * Render
88
+ * ------------------------- */
89
+
90
+ render(targetId?: string): this {
91
+ const container = this._setupContainer(targetId);
92
+
93
+ const { class: className, style, direction, gap, align, justify } = this.state;
94
+
95
+ const div = document.createElement('div');
96
+ div.id = this._id;
97
+
98
+ // Always include jux-container class, append custom classes
99
+ div.className = className ? `jux-container ${className}` : 'jux-container';
100
+
101
+ // Only apply flex styles if any flex properties are set
102
+ const usesFlexbox = direction || gap !== undefined || align || justify;
103
+
104
+ let computedStyle = style;
105
+
106
+ if (usesFlexbox) {
107
+ const flexStyles: string[] = ['display: flex', 'width: auto'];
108
+
109
+ if (direction) flexStyles.push(`flex-direction: ${direction}`);
110
+
111
+ if (gap !== undefined) {
112
+ const gapValue = typeof gap === 'number' ? `${gap}px` : gap;
113
+ flexStyles.push(`gap: ${gapValue}`);
114
+ }
115
+ // Only set align-items if explicitly specified
116
+ if (align) flexStyles.push(`align-items: ${align}`);
117
+ // Only set justify-content if explicitly specified
118
+ if (justify) flexStyles.push(`justify-content: ${justify}`);
119
+
120
+ computedStyle = `${flexStyles.join('; ')}; ${style}`.trim();
121
+ }
122
+
123
+ if (computedStyle) {
124
+ div.setAttribute('style', computedStyle);
125
+ }
126
+
127
+ this._wireStandardEvents(div);
128
+
129
+ container.appendChild(div);
130
+
131
+ return this;
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Factory helper
137
+ */
138
+ export function container(id: string, options: ContainerOptions = {}): Container {
139
+ return new Container(id, options);
140
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Data component - SQL query execution
3
+ * Note: No id needed - this is a data-only component
4
+ *
5
+ * Usage:
6
+ * const posts = jux.data('SELECT * FROM posts WHERE id = ?', [1]);
7
+ * await posts.execute();
8
+ * console.log(posts.data);
9
+ */
10
+ export interface DataOptions {
11
+ sql: string;
12
+ params?: any[];
13
+ apiUrl?: string;
14
+ }
15
+ export declare class Data {
16
+ private _data;
17
+ private _executed;
18
+ private _loading;
19
+ private _sql;
20
+ private _params;
21
+ private _apiUrl;
22
+ constructor(sql: string, params?: any[], apiUrl?: string);
23
+ get data(): any[];
24
+ get executed(): boolean;
25
+ get loading(): boolean;
26
+ get sql(): string;
27
+ set sql(value: string);
28
+ execute(): Promise<void>;
29
+ reset(): void;
30
+ static fetch<T = any>(url: string, options?: RequestInit): Promise<T>;
31
+ static post<T = any>(url: string, body: any, options?: RequestInit): Promise<T>;
32
+ static put<T = any>(url: string, body: any, options?: RequestInit): Promise<T>;
33
+ static delete<T = any>(url: string, options?: RequestInit): Promise<T>;
34
+ }
35
+ export declare function data<T = any>(url: string, options?: RequestInit): Promise<T>;
36
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,IAAI;IACf,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,OAAO,CAAS;gBAEZ,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,GAAG,EAAO,EAAE,MAAM,GAAE,MAAqB;IAU1E,IAAI,IAAI,IAAI,GAAG,EAAE,CAEhB;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,EAEpB;IAMK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgC9B,KAAK,IAAI,IAAI;WAOA,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;WAS9D,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;WAQxE,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;WAQvE,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;CAO7E;AAGD,wBAAgB,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAE5E"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Data component - SQL query execution
3
+ * Note: No id needed - this is a data-only component
4
+ *
5
+ * Usage:
6
+ * const posts = jux.data('SELECT * FROM posts WHERE id = ?', [1]);
7
+ * await posts.execute();
8
+ * console.log(posts.data);
9
+ */
10
+ export class Data {
11
+ constructor(sql, params = [], apiUrl = '/api/query') {
12
+ this._data = [];
13
+ this._executed = false;
14
+ this._loading = false;
15
+ this._sql = sql;
16
+ this._params = params;
17
+ this._apiUrl = apiUrl;
18
+ }
19
+ /* -------------------------
20
+ * Getters
21
+ * ------------------------- */
22
+ get data() {
23
+ return this._data;
24
+ }
25
+ get executed() {
26
+ return this._executed;
27
+ }
28
+ get loading() {
29
+ return this._loading;
30
+ }
31
+ get sql() {
32
+ return this._sql;
33
+ }
34
+ set sql(value) {
35
+ this._sql = value;
36
+ }
37
+ /* -------------------------
38
+ * Methods
39
+ * ------------------------- */
40
+ async execute() {
41
+ if (this._executed)
42
+ return;
43
+ this._loading = true;
44
+ try {
45
+ const response = await fetch(this._apiUrl, {
46
+ method: 'POST',
47
+ headers: {
48
+ 'Content-Type': 'application/json'
49
+ },
50
+ body: JSON.stringify({
51
+ sql: this._sql,
52
+ params: this._params
53
+ })
54
+ });
55
+ if (!response.ok) {
56
+ throw new Error(`API error: ${response.statusText}`);
57
+ }
58
+ const result = await response.json();
59
+ this._data = result.data || [];
60
+ this._executed = true;
61
+ }
62
+ catch (error) {
63
+ console.error('Data execution error:', error);
64
+ this._data = [];
65
+ throw error;
66
+ }
67
+ finally {
68
+ this._loading = false;
69
+ }
70
+ }
71
+ reset() {
72
+ this._executed = false;
73
+ this._data = [];
74
+ this._loading = false;
75
+ }
76
+ // Remove id requirement, make it optional for caching
77
+ static async fetch(url, options) {
78
+ const response = await fetch(url, options);
79
+ if (!response.ok) {
80
+ throw new Error(`API error: ${response.statusText}`);
81
+ }
82
+ return response.json();
83
+ }
84
+ // ✅ Static methods - no ID needed
85
+ static async post(url, body, options) {
86
+ const response = await fetch(url, options);
87
+ if (!response.ok) {
88
+ throw new Error(`API error: ${response.statusText}`);
89
+ }
90
+ return response.json();
91
+ }
92
+ static async put(url, body, options) {
93
+ const response = await fetch(url, options);
94
+ if (!response.ok) {
95
+ throw new Error(`API error: ${response.statusText}`);
96
+ }
97
+ return response.json();
98
+ }
99
+ static async delete(url, options) {
100
+ const response = await fetch(url, options);
101
+ if (!response.ok) {
102
+ throw new Error(`API error: ${response.statusText}`);
103
+ }
104
+ return response.json();
105
+ }
106
+ }
107
+ // ✅ No ID needed - pure data fetching
108
+ export function data(url, options) {
109
+ return Data.fetch(url, options);
110
+ }