juxscript 1.1.13 → 1.1.15

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 (124) hide show
  1. package/index.d.ts +0 -2
  2. package/index.d.ts.map +1 -1
  3. package/index.js +0 -2
  4. package/lib/components/alert.d.ts +4 -0
  5. package/lib/components/alert.d.ts.map +1 -1
  6. package/lib/components/alert.js +19 -0
  7. package/lib/components/alert.ts +19 -0
  8. package/lib/components/badge.d.ts +3 -4
  9. package/lib/components/badge.d.ts.map +1 -1
  10. package/lib/components/badge.js +20 -0
  11. package/lib/components/badge.ts +20 -4
  12. package/lib/components/base/BaseComponent.d.ts +35 -6
  13. package/lib/components/base/BaseComponent.d.ts.map +1 -1
  14. package/lib/components/base/BaseComponent.js +20 -49
  15. package/lib/components/base/BaseComponent.ts +59 -48
  16. package/lib/components/base/FormInput.d.ts +4 -0
  17. package/lib/components/base/FormInput.d.ts.map +1 -1
  18. package/lib/components/base/FormInput.js +6 -0
  19. package/lib/components/base/FormInput.ts +7 -0
  20. package/lib/components/button.d.ts +1 -0
  21. package/lib/components/button.d.ts.map +1 -1
  22. package/lib/components/button.js +3 -0
  23. package/lib/components/button.ts +4 -0
  24. package/lib/components/card.d.ts +1 -0
  25. package/lib/components/card.d.ts.map +1 -1
  26. package/lib/components/card.js +3 -0
  27. package/lib/components/card.ts +4 -0
  28. package/lib/components/chart.d.ts +1 -0
  29. package/lib/components/chart.d.ts.map +1 -1
  30. package/lib/components/chart.js +3 -0
  31. package/lib/components/chart.ts +4 -0
  32. package/lib/components/code.d.ts +1 -0
  33. package/lib/components/code.d.ts.map +1 -1
  34. package/lib/components/code.js +3 -0
  35. package/lib/components/code.ts +4 -0
  36. package/lib/components/container.d.ts +1 -0
  37. package/lib/components/container.d.ts.map +1 -1
  38. package/lib/components/container.js +3 -0
  39. package/lib/components/container.ts +4 -0
  40. package/lib/components/dialog.d.ts +1 -0
  41. package/lib/components/dialog.d.ts.map +1 -1
  42. package/lib/components/dialog.js +3 -0
  43. package/lib/components/dialog.ts +4 -0
  44. package/lib/components/divider.d.ts +1 -0
  45. package/lib/components/divider.d.ts.map +1 -1
  46. package/lib/components/divider.js +3 -0
  47. package/lib/components/divider.ts +4 -0
  48. package/lib/components/dropdown.d.ts +1 -0
  49. package/lib/components/dropdown.d.ts.map +1 -1
  50. package/lib/components/dropdown.js +3 -0
  51. package/lib/components/dropdown.ts +4 -0
  52. package/lib/components/element.d.ts +1 -0
  53. package/lib/components/element.d.ts.map +1 -1
  54. package/lib/components/element.js +3 -0
  55. package/lib/components/element.ts +4 -0
  56. package/lib/components/grid.d.ts +1 -0
  57. package/lib/components/grid.d.ts.map +1 -1
  58. package/lib/components/grid.js +3 -0
  59. package/lib/components/grid.ts +4 -0
  60. package/lib/components/heading.d.ts +1 -0
  61. package/lib/components/heading.d.ts.map +1 -1
  62. package/lib/components/heading.js +3 -0
  63. package/lib/components/heading.ts +4 -0
  64. package/lib/components/hero.d.ts +3 -5
  65. package/lib/components/hero.d.ts.map +1 -1
  66. package/lib/components/hero.js +1 -1
  67. package/lib/components/hero.ts +4 -6
  68. package/lib/components/icon.d.ts +1 -0
  69. package/lib/components/icon.d.ts.map +1 -1
  70. package/lib/components/icon.js +3 -0
  71. package/lib/components/icon.ts +4 -0
  72. package/lib/components/list.d.ts +1 -0
  73. package/lib/components/list.d.ts.map +1 -1
  74. package/lib/components/list.js +3 -0
  75. package/lib/components/list.ts +4 -0
  76. package/lib/components/loading.d.ts +1 -0
  77. package/lib/components/loading.d.ts.map +1 -1
  78. package/lib/components/loading.js +3 -0
  79. package/lib/components/loading.ts +4 -0
  80. package/lib/components/menu.d.ts +1 -0
  81. package/lib/components/menu.d.ts.map +1 -1
  82. package/lib/components/menu.js +3 -0
  83. package/lib/components/menu.ts +4 -0
  84. package/lib/components/modal.d.ts +1 -0
  85. package/lib/components/modal.d.ts.map +1 -1
  86. package/lib/components/modal.js +3 -0
  87. package/lib/components/modal.ts +4 -0
  88. package/lib/components/nav.d.ts +1 -0
  89. package/lib/components/nav.d.ts.map +1 -1
  90. package/lib/components/nav.js +3 -0
  91. package/lib/components/nav.ts +4 -0
  92. package/lib/components/paragraph.d.ts +1 -0
  93. package/lib/components/paragraph.d.ts.map +1 -1
  94. package/lib/components/paragraph.js +3 -0
  95. package/lib/components/paragraph.ts +4 -0
  96. package/lib/components/progress.d.ts +1 -0
  97. package/lib/components/progress.d.ts.map +1 -1
  98. package/lib/components/progress.js +3 -0
  99. package/lib/components/progress.ts +4 -0
  100. package/lib/components/sidebar.d.ts +25 -14
  101. package/lib/components/sidebar.d.ts.map +1 -1
  102. package/lib/components/sidebar.js +186 -88
  103. package/lib/components/sidebar.ts +231 -104
  104. package/lib/components/table.d.ts +1 -0
  105. package/lib/components/table.d.ts.map +1 -1
  106. package/lib/components/table.js +3 -0
  107. package/lib/components/table.ts +4 -0
  108. package/lib/components/tabs.d.ts +1 -0
  109. package/lib/components/tabs.d.ts.map +1 -1
  110. package/lib/components/tabs.js +3 -0
  111. package/lib/components/tabs.ts +4 -0
  112. package/lib/components/theme-toggle.d.ts +1 -0
  113. package/lib/components/theme-toggle.d.ts.map +1 -1
  114. package/lib/components/theme-toggle.js +3 -0
  115. package/lib/components/theme-toggle.ts +4 -0
  116. package/lib/components/tooltip.d.ts +1 -0
  117. package/lib/components/tooltip.d.ts.map +1 -1
  118. package/lib/components/tooltip.js +3 -0
  119. package/lib/components/tooltip.ts +4 -0
  120. package/package.json +1 -1
  121. package/lib/components/guard.d.ts +0 -41
  122. package/lib/components/guard.d.ts.map +0 -1
  123. package/lib/components/guard.js +0 -56
  124. package/lib/components/guard.ts +0 -92
package/index.d.ts CHANGED
@@ -15,7 +15,6 @@ import { dropdown } from './lib/components/dropdown.js';
15
15
  import { element } from './lib/components/element.js';
16
16
  import { fileupload } from './lib/components/fileupload.js';
17
17
  import { grid } from './lib/components/grid.js';
18
- import { guard } from './lib/components/guard.js';
19
18
  import { heading } from './lib/components/heading.js';
20
19
  import { getOrCreateContainer } from './lib/components/helpers.js';
21
20
  import { hero } from './lib/components/hero.js';
@@ -60,7 +59,6 @@ export declare const jux: {
60
59
  element: typeof element;
61
60
  fileupload: typeof fileupload;
62
61
  grid: typeof grid;
63
- guard: typeof guard;
64
62
  heading: typeof heading;
65
63
  hero: typeof hero;
66
64
  icon: typeof icon;
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD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B,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEpE,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDf,CAAC"}
package/index.js CHANGED
@@ -15,7 +15,6 @@ import { dropdown } from './lib/components/dropdown.js';
15
15
  import { element } from './lib/components/element.js';
16
16
  import { fileupload } from './lib/components/fileupload.js';
17
17
  import { grid } from './lib/components/grid.js';
18
- import { guard } from './lib/components/guard.js';
19
18
  import { heading } from './lib/components/heading.js';
20
19
  import { getOrCreateContainer } from './lib/components/helpers.js';
21
20
  import { hero } from './lib/components/hero.js';
@@ -62,7 +61,6 @@ export const jux = {
62
61
  element,
63
62
  fileupload,
64
63
  grid,
65
- guard,
66
64
  heading,
67
65
  hero,
68
66
  icon,
@@ -25,6 +25,10 @@ export declare class Alert extends BaseComponent<AlertState> {
25
25
  type(value: 'info' | 'success' | 'warning' | 'error'): this;
26
26
  dismissible(value: boolean): this;
27
27
  icon(value: string): this;
28
+ /**
29
+ * Reactive update hook
30
+ */
31
+ update(prop: string, value: any): void;
28
32
  render(targetId?: string): this;
29
33
  }
30
34
  export declare function alert(id: string, options?: AlertOptions): Alert;
@@ -1 +1 @@
1
- {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAOxD,MAAM,WAAW,YAAY;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,WAAW,CA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AG,OAAO,CAAC;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,UAAU,GAAG;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAAU,CAAC;IAChD,OAAO,CAAC,MAAM,CAA4B;gBAE9B,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB;IAYlD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAiBhD,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI;IAK3D,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAKjC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKzB;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAoBtC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;CA6GlC;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,KAAK,CAEnE"}
@@ -49,6 +49,25 @@ export class Alert extends BaseComponent {
49
49
  this.state.icon = value;
50
50
  return this;
51
51
  }
52
+ /**
53
+ * Reactive update hook
54
+ */
55
+ update(prop, value) {
56
+ const el = document.getElementById(this._id);
57
+ if (!el)
58
+ return;
59
+ if (prop === 'content') {
60
+ const contentEl = el.querySelector('.jux-alert-content');
61
+ if (contentEl)
62
+ contentEl.textContent = value;
63
+ }
64
+ else if (prop === 'type') {
65
+ // Update alert type class
66
+ el.className = `jux-alert jux-alert-${value}`;
67
+ if (this.state.class)
68
+ el.className += ` ${this.state.class}`;
69
+ }
70
+ }
52
71
  /* ═════════════════════════════════════════════════════════════════
53
72
  * RENDER
54
73
  * ═════════════════════════════════════════════════════════════════ */
@@ -80,6 +80,25 @@ export class Alert extends BaseComponent<AlertState> {
80
80
  return this;
81
81
  }
82
82
 
83
+ /**
84
+ * Reactive update hook
85
+ */
86
+ update(prop: string, value: any): void {
87
+
88
+
89
+ const el = document.getElementById(this._id);
90
+ if (!el) return;
91
+
92
+ if (prop === 'content') {
93
+ const contentEl = el.querySelector('.jux-alert-content');
94
+ if (contentEl) contentEl.textContent = value;
95
+ } else if (prop === 'type') {
96
+ // Update alert type class
97
+ el.className = `jux-alert jux-alert-${value}`;
98
+ if (this.state.class) el.className += ` ${this.state.class}`;
99
+ }
100
+ }
101
+
83
102
  /* ═════════════════════════════════════════════════════════════════
84
103
  * RENDER
85
104
  * ═════════════════════════════════════════════════════════════════ */
@@ -1,4 +1,4 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
1
+ import { BaseComponent, BaseState } from './base/BaseComponent.js';
2
2
  export interface BadgeOptions {
3
3
  label?: string;
4
4
  variant?: 'default' | 'success' | 'warning' | 'error' | 'info';
@@ -6,17 +6,16 @@ export interface BadgeOptions {
6
6
  style?: string;
7
7
  class?: string;
8
8
  }
9
- type BadgeState = {
9
+ type BadgeState = BaseState & {
10
10
  label: string;
11
11
  variant: string;
12
12
  pill: boolean;
13
- style: string;
14
- class: string;
15
13
  };
16
14
  export declare class Badge extends BaseComponent<BadgeState> {
17
15
  constructor(id: string, options?: BadgeOptions);
18
16
  protected getTriggerEvents(): readonly string[];
19
17
  protected getCallbackEvents(): readonly string[];
18
+ update(prop: string, value: any): void;
20
19
  label(value: string): this;
21
20
  variant(value: 'default' | 'success' | 'warning' | 'error' | 'info'): this;
22
21
  pill(value: boolean): this;
@@ -1 +1 @@
1
- {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD,MAAM,WAAW,YAAY;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAC/D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,UAAU,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAAU,CAAC;gBACpC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB;IAUlD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAUhD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK1B,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI;IAK1E,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAS1B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;CA8BlC;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,KAAK,CAEnE"}
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMnE,MAAM,WAAW,YAAY;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAC/D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,UAAU,GAAG,SAAS,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAAU,CAAC;gBACpC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB;IAUlD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAIhD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAwBtC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK1B,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI;IAK1E,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAS1B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;CA8BlC;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,KAAK,CAEnE"}
@@ -18,6 +18,26 @@ export class Badge extends BaseComponent {
18
18
  getCallbackEvents() {
19
19
  return CALLBACK_EVENTS;
20
20
  }
21
+ update(prop, value) {
22
+ const el = document.getElementById(this._id);
23
+ if (!el)
24
+ return;
25
+ // ✅ Component-specific updates
26
+ if (prop === 'label') {
27
+ el.textContent = value;
28
+ }
29
+ else if (prop === 'variant') {
30
+ const baseClass = 'jux-badge';
31
+ el.className = `${baseClass} ${baseClass}-${value}`;
32
+ if (this.state.pill)
33
+ el.classList.add('jux-badge-pill');
34
+ if (this.state.class)
35
+ el.className += ` ${this.state.class}`;
36
+ }
37
+ else if (prop === 'pill') {
38
+ el.classList.toggle('jux-badge-pill', value);
39
+ }
40
+ }
21
41
  /* ═════════════════════════════════════════════════════════════════
22
42
  * FLUENT API
23
43
  * ═════════════════════════════════════════════════════════════════ */
@@ -1,4 +1,4 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
1
+ import { BaseComponent, BaseState } from './base/BaseComponent.js';
2
2
 
3
3
  // Event definitions
4
4
  const TRIGGER_EVENTS = [] as const;
@@ -12,12 +12,10 @@ export interface BadgeOptions {
12
12
  class?: string;
13
13
  }
14
14
 
15
- type BadgeState = {
15
+ type BadgeState = BaseState & {
16
16
  label: string;
17
17
  variant: string;
18
18
  pill: boolean;
19
- style: string;
20
- class: string;
21
19
  };
22
20
 
23
21
  export class Badge extends BaseComponent<BadgeState> {
@@ -39,6 +37,24 @@ export class Badge extends BaseComponent<BadgeState> {
39
37
  return CALLBACK_EVENTS;
40
38
  }
41
39
 
40
+ update(prop: string, value: any): void {
41
+
42
+ const el = document.getElementById(this._id);
43
+ if (!el) return;
44
+
45
+ // ✅ Component-specific updates
46
+ if (prop === 'label') {
47
+ el.textContent = value;
48
+ } else if (prop === 'variant') {
49
+ const baseClass = 'jux-badge';
50
+ el.className = `${baseClass} ${baseClass}-${value}`;
51
+ if (this.state.pill) el.classList.add('jux-badge-pill');
52
+ if (this.state.class) el.className += ` ${this.state.class}`;
53
+ } else if (prop === 'pill') {
54
+ el.classList.toggle('jux-badge-pill', value);
55
+ }
56
+ }
57
+
42
58
  /* ═════════════════════════════════════════════════════════════════
43
59
  * FLUENT API
44
60
  * ═════════════════════════════════════════════════════════════════ */
@@ -1,4 +1,16 @@
1
1
  import { State } from '../../reactivity/state.js';
2
+ /**
3
+ * Base state interface that ALL component states must extend
4
+ * Contains properties managed by BaseComponent
5
+ */
6
+ export interface BaseState {
7
+ visible?: boolean;
8
+ disabled?: boolean;
9
+ loading?: boolean;
10
+ class?: string;
11
+ style?: string;
12
+ attributes?: Record<string, string>;
13
+ }
2
14
  /**
3
15
  * Abstract base class for all JUX components
4
16
  * Provides common storage, event routing, and lifecycle methods
@@ -8,7 +20,7 @@ import { State } from '../../reactivity/state.js';
8
20
  * - CALLBACK_EVENTS constant (readonly string[])
9
21
  * - render() implementation
10
22
  */
11
- export declare abstract class BaseComponent<TState extends Record<string, any>> {
23
+ export declare abstract class BaseComponent<TState extends BaseState = BaseState> {
12
24
  state: TState;
13
25
  container: HTMLElement | null;
14
26
  _id: string;
@@ -30,11 +42,28 @@ export declare abstract class BaseComponent<TState extends Record<string, any>>
30
42
  protected abstract getCallbackEvents(): readonly string[];
31
43
  abstract render(targetId?: string): this;
32
44
  /**
33
- * REACTIVE UPDATE HOOK
34
- * Called automatically when this.state[prop] changes.
35
- * Override this in components to update the DOM without full re-render.
36
- */
37
- protected update(prop: string, value: any): void;
45
+ * REACTIVE UPDATE HOOK (REQUIRED - PUBLIC)
46
+ * Called automatically when this.state[prop] changes via the Proxy.
47
+ * Every component MUST implement this to handle state changes.
48
+ *
49
+ * This is PUBLIC because:
50
+ * - Components may need to call it manually
51
+ * - Allows external updates without full re-render
52
+ * - Part of the component's public API
53
+ *
54
+ * @param prop - The state property that changed
55
+ * @param value - The new value
56
+ *
57
+ * @example
58
+ * update(prop: string, value: any): void {
59
+ * const el = document.getElementById(this._id);
60
+ * if (!el) return;
61
+ *
62
+ * if (prop === 'label') el.textContent = value;
63
+ * if (prop === 'visible') el.style.display = value ? '' : 'none';
64
+ * }
65
+ */
66
+ abstract update(prop: string, value: any): void;
38
67
  /**
39
68
  * Set component style
40
69
  */
@@ -1 +1 @@
1
- {"version":3,"file":"BaseComponent.d.ts","sourceRoot":"","sources":["BaseComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGlD;;;;;;;;GAQG;AACH,8BAAsB,aAAa,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAElE,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,WAAW,GAAG,IAAI,CAAQ;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IAGX,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAM;IACtE,SAAS,CAAC,aAAa,EAAE,KAAK,CAAC;QAC3B,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QACrB,OAAO,CAAC,EAAE,QAAQ,CAAC;QACnB,WAAW,CAAC,EAAE,QAAQ,CAAA;KACzB,CAAC,CAAM;IACR,SAAS,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAa;IAC9D,SAAS,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAa;gBAEnD,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAqB5C,SAAS,CAAC,QAAQ,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IACxD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IACzD,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAExC;;;;OAIG;IACH,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAA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E,WAAW,GAAG,IAAI;IAMzD;;;OAGG;IACH,SAAS,CAAC,aAAa,IAAI,IAAI;IA0B/B,QAAQ,CAAC,YAAY,EAAE,GAAG,GAAG,IAAI;IAWjC;;OAEG;IACH,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,CAE5B;CACJ"}
@@ -18,8 +18,18 @@ export class BaseComponent {
18
18
  this._callbackHandlers = new Map();
19
19
  this._id = id;
20
20
  this.id = id;
21
+ // ✨ Ensure base properties exist with defaults
22
+ const stateWithDefaults = {
23
+ visible: true,
24
+ disabled: false,
25
+ loading: false,
26
+ class: '',
27
+ style: '',
28
+ attributes: {},
29
+ ...initialState
30
+ };
21
31
  // ✨ REACTIVE PROXY: Intercept state changes to trigger view updates automatically
22
- this.state = new Proxy(initialState, {
32
+ this.state = new Proxy(stateWithDefaults, {
23
33
  set: (target, prop, value) => {
24
34
  const key = prop;
25
35
  if (target[key] !== value) {
@@ -30,15 +40,6 @@ export class BaseComponent {
30
40
  }
31
41
  });
32
42
  }
33
- /**
34
- * REACTIVE UPDATE HOOK
35
- * Called automatically when this.state[prop] changes.
36
- * Override this in components to update the DOM without full re-render.
37
- */
38
- update(prop, value) {
39
- // Default no-op. Children implement granular DOM updates here.
40
- // Example: if (prop === 'title') document.getElementById(...).textContent = value;
41
- }
42
43
  /* ═════════════════════════════════════════════════════════════════
43
44
  * COMMON FLUENT API (Inherited by all components)
44
45
  * ═════════════════════════════════════════════════════════════════ */
@@ -46,14 +47,14 @@ export class BaseComponent {
46
47
  * Set component style
47
48
  */
48
49
  style(value) {
49
- this.state.style = value;
50
+ this.state.style = value; // ✅ Triggers update()
50
51
  return this;
51
52
  }
52
53
  /**
53
54
  * Set component class
54
55
  */
55
56
  class(value) {
56
- this.state.class = value;
57
+ this.state.class = value; // ✅ Triggers update()
57
58
  return this;
58
59
  }
59
60
  /* ═════════════════════════════════════════════════════════════════
@@ -64,13 +65,9 @@ export class BaseComponent {
64
65
  */
65
66
  addClass(value) {
66
67
  const current = this.state.class || '';
67
- const classes = current.split(' ').filter((c) => c);
68
- if (!classes.includes(value)) {
69
- classes.push(value);
70
- this.state.class = classes.join(' ');
71
- if (this.container)
72
- this.container.classList.add(value);
73
- }
68
+ const classes = current.split(' ').filter((c) => c && c !== value);
69
+ classes.push(value);
70
+ this.state.class = classes.join(' '); // ✅ Triggers update()
74
71
  return this;
75
72
  }
76
73
  /**
@@ -79,9 +76,7 @@ export class BaseComponent {
79
76
  removeClass(value) {
80
77
  const current = this.state.class || '';
81
78
  const classes = current.split(' ').filter((c) => c && c !== value);
82
- this.state.class = classes.join(' ');
83
- if (this.container)
84
- this.container.classList.remove(value);
79
+ this.state.class = classes.join(' '); // ✅ Triggers update()
85
80
  return this;
86
81
  }
87
82
  /**
@@ -99,14 +94,7 @@ export class BaseComponent {
99
94
  * Set component visibility
100
95
  */
101
96
  visible(value) {
102
- this.state.visible = value;
103
- if (this.container) {
104
- // Find the actual component wrapper, not the parent container
105
- const wrapper = this.container.querySelector(`#${this._id}`);
106
- if (wrapper) {
107
- wrapper.style.display = value ? '' : 'none';
108
- }
109
- }
97
+ this.state.visible = value; // ✅ Triggers update()
110
98
  return this;
111
99
  }
112
100
  /**
@@ -167,14 +155,7 @@ export class BaseComponent {
167
155
  * Set disabled state for interactive elements
168
156
  */
169
157
  disabled(value) {
170
- this.state.disabled = value;
171
- if (this.container) {
172
- const inputs = this.container.querySelectorAll('input, button, select, textarea');
173
- inputs.forEach(el => {
174
- el.disabled = value;
175
- });
176
- this.container.setAttribute('aria-disabled', String(value));
177
- }
158
+ this.state.disabled = value; // ✅ Triggers update()
178
159
  return this;
179
160
  }
180
161
  /**
@@ -196,17 +177,7 @@ export class BaseComponent {
196
177
  * Set loading state
197
178
  */
198
179
  loading(value) {
199
- this.state.loading = value;
200
- if (this.container) {
201
- if (value) {
202
- this.container.classList.add('jux-loading');
203
- this.container.setAttribute('aria-busy', 'true');
204
- }
205
- else {
206
- this.container.classList.remove('jux-loading');
207
- this.container.removeAttribute('aria-busy');
208
- }
209
- }
180
+ this.state.loading = value; // ✅ Triggers update()
210
181
  return this;
211
182
  }
212
183
  /* ═════════════════════════════════════════════════════════════════
@@ -1,6 +1,19 @@
1
1
  import { State } from '../../reactivity/state.js';
2
2
  import { getOrCreateContainer } from '../helpers.js';
3
3
 
4
+ /**
5
+ * Base state interface that ALL component states must extend
6
+ * Contains properties managed by BaseComponent
7
+ */
8
+ export interface BaseState {
9
+ visible?: boolean;
10
+ disabled?: boolean;
11
+ loading?: boolean;
12
+ class?: string;
13
+ style?: string;
14
+ attributes?: Record<string, string>;
15
+ }
16
+
4
17
  /**
5
18
  * Abstract base class for all JUX components
6
19
  * Provides common storage, event routing, and lifecycle methods
@@ -10,7 +23,7 @@ import { getOrCreateContainer } from '../helpers.js';
10
23
  * - CALLBACK_EVENTS constant (readonly string[])
11
24
  * - render() implementation
12
25
  */
13
- export abstract class BaseComponent<TState extends Record<string, any>> {
26
+ export abstract class BaseComponent<TState extends BaseState = BaseState> {
14
27
  // Common properties (all components have these)
15
28
  state: TState;
16
29
  container: HTMLElement | null = null;
@@ -32,8 +45,19 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
32
45
  this._id = id;
33
46
  this.id = id;
34
47
 
48
+ // ✨ Ensure base properties exist with defaults
49
+ const stateWithDefaults: TState = {
50
+ visible: true,
51
+ disabled: false,
52
+ loading: false,
53
+ class: '',
54
+ style: '',
55
+ attributes: {},
56
+ ...initialState
57
+ };
58
+
35
59
  // ✨ REACTIVE PROXY: Intercept state changes to trigger view updates automatically
36
- this.state = new Proxy(initialState, {
60
+ this.state = new Proxy(stateWithDefaults, {
37
61
  set: (target, prop, value) => {
38
62
  const key = prop as keyof TState;
39
63
  if (target[key] !== value) {
@@ -54,14 +78,28 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
54
78
  abstract render(targetId?: string): this;
55
79
 
56
80
  /**
57
- * REACTIVE UPDATE HOOK
58
- * Called automatically when this.state[prop] changes.
59
- * Override this in components to update the DOM without full re-render.
81
+ * REACTIVE UPDATE HOOK (REQUIRED - PUBLIC)
82
+ * Called automatically when this.state[prop] changes via the Proxy.
83
+ * Every component MUST implement this to handle state changes.
84
+ *
85
+ * This is PUBLIC because:
86
+ * - Components may need to call it manually
87
+ * - Allows external updates without full re-render
88
+ * - Part of the component's public API
89
+ *
90
+ * @param prop - The state property that changed
91
+ * @param value - The new value
92
+ *
93
+ * @example
94
+ * update(prop: string, value: any): void {
95
+ * const el = document.getElementById(this._id);
96
+ * if (!el) return;
97
+ *
98
+ * if (prop === 'label') el.textContent = value;
99
+ * if (prop === 'visible') el.style.display = value ? '' : 'none';
100
+ * }
60
101
  */
61
- protected update(prop: string, value: any): void {
62
- // Default no-op. Children implement granular DOM updates here.
63
- // Example: if (prop === 'title') document.getElementById(...).textContent = value;
64
- }
102
+ abstract update(prop: string, value: any): void;
65
103
 
66
104
  /* ═════════════════════════════════════════════════════════════════
67
105
  * COMMON FLUENT API (Inherited by all components)
@@ -71,7 +109,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
71
109
  * Set component style
72
110
  */
73
111
  style(value: string): this {
74
- (this.state as any).style = value;
112
+ this.state.style = value; // ✅ Triggers update()
75
113
  return this;
76
114
  }
77
115
 
@@ -79,7 +117,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
79
117
  * Set component class
80
118
  */
81
119
  class(value: string): this {
82
- (this.state as any).class = value;
120
+ this.state.class = value; // ✅ Triggers update()
83
121
  return this;
84
122
  }
85
123
 
@@ -91,13 +129,10 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
91
129
  * Add a CSS class to the component
92
130
  */
93
131
  addClass(value: string): this {
94
- const current = (this.state as any).class || '';
95
- const classes = current.split(' ').filter((c: string) => c);
96
- if (!classes.includes(value)) {
97
- classes.push(value);
98
- (this.state as any).class = classes.join(' ');
99
- if (this.container) this.container.classList.add(value);
100
- }
132
+ const current = this.state.class || '';
133
+ const classes = current.split(' ').filter((c: string) => c && c !== value);
134
+ classes.push(value);
135
+ this.state.class = classes.join(' '); // ✅ Triggers update()
101
136
  return this;
102
137
  }
103
138
 
@@ -105,10 +140,9 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
105
140
  * Remove a CSS class from the component
106
141
  */
107
142
  removeClass(value: string): this {
108
- const current = (this.state as any).class || '';
143
+ const current = this.state.class || '';
109
144
  const classes = current.split(' ').filter((c: string) => c && c !== value);
110
- (this.state as any).class = classes.join(' ');
111
- if (this.container) this.container.classList.remove(value);
145
+ this.state.class = classes.join(' '); // ✅ Triggers update()
112
146
  return this;
113
147
  }
114
148
 
@@ -116,7 +150,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
116
150
  * Toggle a CSS class on the component
117
151
  */
118
152
  toggleClass(value: string): this {
119
- const current = (this.state as any).class || '';
153
+ const current = this.state.class || '';
120
154
  const hasClass = current.split(' ').includes(value);
121
155
  return hasClass ? this.removeClass(value) : this.addClass(value);
122
156
  }
@@ -129,14 +163,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
129
163
  * Set component visibility
130
164
  */
131
165
  visible(value: boolean): this {
132
- (this.state as any).visible = value;
133
- if (this.container) {
134
- // Find the actual component wrapper, not the parent container
135
- const wrapper = this.container.querySelector(`#${this._id}`) as HTMLElement;
136
- if (wrapper) {
137
- wrapper.style.display = value ? '' : 'none';
138
- }
139
- }
166
+ this.state.visible = value; // ✅ Triggers update()
140
167
  return this;
141
168
  }
142
169
 
@@ -204,14 +231,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
204
231
  * Set disabled state for interactive elements
205
232
  */
206
233
  disabled(value: boolean): this {
207
- (this.state as any).disabled = value;
208
- if (this.container) {
209
- const inputs = this.container.querySelectorAll('input, button, select, textarea');
210
- inputs.forEach(el => {
211
- (el as HTMLInputElement).disabled = value;
212
- });
213
- this.container.setAttribute('aria-disabled', String(value));
214
- }
234
+ this.state.disabled = value; // ✅ Triggers update()
215
235
  return this;
216
236
  }
217
237
 
@@ -237,16 +257,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
237
257
  * Set loading state
238
258
  */
239
259
  loading(value: boolean): this {
240
- (this.state as any).loading = value;
241
- if (this.container) {
242
- if (value) {
243
- this.container.classList.add('jux-loading');
244
- this.container.setAttribute('aria-busy', 'true');
245
- } else {
246
- this.container.classList.remove('jux-loading');
247
- this.container.removeAttribute('aria-busy');
248
- }
249
- }
260
+ this.state.loading = value; // ✅ Triggers update()
250
261
  return this;
251
262
  }
252
263
 
@@ -65,6 +65,10 @@ export declare abstract class FormInput<TState extends FormInputState> extends B
65
65
  * Build error element
66
66
  */
67
67
  protected _renderError(): HTMLElement;
68
+ /**
69
+ * Default update implementation for form inputs
70
+ */
71
+ update(prop: string, value: any): void;
68
72
  /**
69
73
  * Wire up two-way sync for value property
70
74
  */
@@ -1 +1 @@
1
- {"version":3,"file":"FormInput.d.ts","sourceRoot":"","sources":["FormInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,8BAAsB,SAAS,CAAC,MAAM,SAAS,cAAc,CAAE,SAAQ,aAAa,CAAC,MAAM,CAAC;IACxF,SAAS,CAAC,aAAa,EAAE,WAAW,GAAG,IAAI,CAAQ;IACnD,SAAS,CAAC,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAQ;IACxD,SAAS,CAAC,aAAa,EAAE,WAAW,GAAG,IAAI,CAAQ;IACnD,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,KAA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;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAa3C;;OAEG;IACH,SAAS,CAAC,WAAW,IAAI,IAAI;IAiB7B;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,gBAAgB;IAmB1C;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,WAAW;IAUrC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAItC;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,YAAY,EAAE,WAAW,EAAE,SAAS,GAAE,MAAgB,GAAG,IAAI;CA8CxF"}
@@ -117,6 +117,12 @@ export class FormInput extends BaseComponent {
117
117
  this._errorElement = errorEl;
118
118
  return errorEl;
119
119
  }
120
+ /**
121
+ * Default update implementation for form inputs
122
+ */
123
+ update(prop, value) {
124
+ // No reactive updates needed - form inputs handle their own state
125
+ }
120
126
  /**
121
127
  * Wire up two-way sync for value property
122
128
  */