juxscript 1.1.14 → 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.
- package/index.d.ts +0 -2
- package/index.d.ts.map +1 -1
- package/index.js +0 -2
- package/lib/components/alert.d.ts.map +1 -1
- package/lib/components/alert.js +14 -1
- package/lib/components/alert.ts +13 -1
- package/lib/components/badge.d.ts +2 -4
- package/lib/components/badge.d.ts.map +1 -1
- package/lib/components/badge.js +18 -1
- package/lib/components/badge.ts +17 -5
- package/lib/components/base/BaseComponent.d.ts +13 -1
- package/lib/components/base/BaseComponent.d.ts.map +1 -1
- package/lib/components/base/BaseComponent.js +20 -40
- package/lib/components/base/BaseComponent.ts +38 -41
- package/lib/components/hero.d.ts +2 -4
- package/lib/components/hero.d.ts.map +1 -1
- package/lib/components/hero.js +1 -1
- package/lib/components/hero.ts +3 -5
- package/lib/components/sidebar.d.ts +25 -15
- package/lib/components/sidebar.d.ts.map +1 -1
- package/lib/components/sidebar.js +186 -91
- package/lib/components/sidebar.ts +231 -108
- package/package.json +1 -1
- package/lib/components/guard.d.ts +0 -42
- package/lib/components/guard.d.ts.map +0 -1
- package/lib/components/guard.js +0 -59
- package/lib/components/guard.ts +0 -96
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;
|
|
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,K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,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,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,
|
|
@@ -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,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,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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"}
|
package/lib/components/alert.js
CHANGED
|
@@ -53,7 +53,20 @@ export class Alert extends BaseComponent {
|
|
|
53
53
|
* Reactive update hook
|
|
54
54
|
*/
|
|
55
55
|
update(prop, value) {
|
|
56
|
-
|
|
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
|
+
}
|
|
57
70
|
}
|
|
58
71
|
/* ═════════════════════════════════════════════════════════════════
|
|
59
72
|
* RENDER
|
package/lib/components/alert.ts
CHANGED
|
@@ -84,7 +84,19 @@ export class Alert extends BaseComponent<AlertState> {
|
|
|
84
84
|
* Reactive update hook
|
|
85
85
|
*/
|
|
86
86
|
update(prop: string, value: any): void {
|
|
87
|
-
|
|
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
|
+
}
|
|
88
100
|
}
|
|
89
101
|
|
|
90
102
|
/* ═════════════════════════════════════════════════════════════════
|
|
@@ -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,12 +6,10 @@ 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);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
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"}
|
package/lib/components/badge.js
CHANGED
|
@@ -19,7 +19,24 @@ export class Badge extends BaseComponent {
|
|
|
19
19
|
return CALLBACK_EVENTS;
|
|
20
20
|
}
|
|
21
21
|
update(prop, value) {
|
|
22
|
-
|
|
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
|
+
}
|
|
23
40
|
}
|
|
24
41
|
/* ═════════════════════════════════════════════════════════════════
|
|
25
42
|
* FLUENT API
|
package/lib/components/badge.ts
CHANGED
|
@@ -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> {
|
|
@@ -40,7 +38,21 @@ export class Badge extends BaseComponent<BadgeState> {
|
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
update(prop: string, value: any): void {
|
|
43
|
-
|
|
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
|
+
}
|
|
44
56
|
}
|
|
45
57
|
|
|
46
58
|
/* ═════════════════════════════════════════════════════════════════
|
|
@@ -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
|
|
23
|
+
export declare abstract class BaseComponent<TState extends BaseState = BaseState> {
|
|
12
24
|
state: TState;
|
|
13
25
|
container: HTMLElement | null;
|
|
14
26
|
_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseComponent.d.ts","sourceRoot":"","sources":["BaseComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGlD
|
|
1
|
+
{"version":3,"file":"BaseComponent.d.ts","sourceRoot":"","sources":["BaseComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGlD;;;GAGG;AACH,MAA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,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,IAAI;IAkBzG,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIjD,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIlD,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAcnE,SAAS,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW;IAwBzD,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,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(
|
|
32
|
+
this.state = new Proxy(stateWithDefaults, {
|
|
23
33
|
set: (target, prop, value) => {
|
|
24
34
|
const key = prop;
|
|
25
35
|
if (target[key] !== value) {
|
|
@@ -37,14 +47,14 @@ export class BaseComponent {
|
|
|
37
47
|
* Set component style
|
|
38
48
|
*/
|
|
39
49
|
style(value) {
|
|
40
|
-
this.state.style = value;
|
|
50
|
+
this.state.style = value; // ✅ Triggers update()
|
|
41
51
|
return this;
|
|
42
52
|
}
|
|
43
53
|
/**
|
|
44
54
|
* Set component class
|
|
45
55
|
*/
|
|
46
56
|
class(value) {
|
|
47
|
-
this.state.class = value;
|
|
57
|
+
this.state.class = value; // ✅ Triggers update()
|
|
48
58
|
return this;
|
|
49
59
|
}
|
|
50
60
|
/* ═════════════════════════════════════════════════════════════════
|
|
@@ -55,13 +65,9 @@ export class BaseComponent {
|
|
|
55
65
|
*/
|
|
56
66
|
addClass(value) {
|
|
57
67
|
const current = this.state.class || '';
|
|
58
|
-
const classes = current.split(' ').filter((c) => c);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.state.class = classes.join(' ');
|
|
62
|
-
if (this.container)
|
|
63
|
-
this.container.classList.add(value);
|
|
64
|
-
}
|
|
68
|
+
const classes = current.split(' ').filter((c) => c && c !== value);
|
|
69
|
+
classes.push(value);
|
|
70
|
+
this.state.class = classes.join(' '); // ✅ Triggers update()
|
|
65
71
|
return this;
|
|
66
72
|
}
|
|
67
73
|
/**
|
|
@@ -70,9 +76,7 @@ export class BaseComponent {
|
|
|
70
76
|
removeClass(value) {
|
|
71
77
|
const current = this.state.class || '';
|
|
72
78
|
const classes = current.split(' ').filter((c) => c && c !== value);
|
|
73
|
-
this.state.class = classes.join(' ');
|
|
74
|
-
if (this.container)
|
|
75
|
-
this.container.classList.remove(value);
|
|
79
|
+
this.state.class = classes.join(' '); // ✅ Triggers update()
|
|
76
80
|
return this;
|
|
77
81
|
}
|
|
78
82
|
/**
|
|
@@ -90,14 +94,7 @@ export class BaseComponent {
|
|
|
90
94
|
* Set component visibility
|
|
91
95
|
*/
|
|
92
96
|
visible(value) {
|
|
93
|
-
this.state.visible = value;
|
|
94
|
-
if (this.container) {
|
|
95
|
-
// Find the actual component wrapper, not the parent container
|
|
96
|
-
const wrapper = this.container.querySelector(`#${this._id}`);
|
|
97
|
-
if (wrapper) {
|
|
98
|
-
wrapper.style.display = value ? '' : 'none';
|
|
99
|
-
}
|
|
100
|
-
}
|
|
97
|
+
this.state.visible = value; // ✅ Triggers update()
|
|
101
98
|
return this;
|
|
102
99
|
}
|
|
103
100
|
/**
|
|
@@ -158,14 +155,7 @@ export class BaseComponent {
|
|
|
158
155
|
* Set disabled state for interactive elements
|
|
159
156
|
*/
|
|
160
157
|
disabled(value) {
|
|
161
|
-
this.state.disabled = value;
|
|
162
|
-
if (this.container) {
|
|
163
|
-
const inputs = this.container.querySelectorAll('input, button, select, textarea');
|
|
164
|
-
inputs.forEach(el => {
|
|
165
|
-
el.disabled = value;
|
|
166
|
-
});
|
|
167
|
-
this.container.setAttribute('aria-disabled', String(value));
|
|
168
|
-
}
|
|
158
|
+
this.state.disabled = value; // ✅ Triggers update()
|
|
169
159
|
return this;
|
|
170
160
|
}
|
|
171
161
|
/**
|
|
@@ -187,17 +177,7 @@ export class BaseComponent {
|
|
|
187
177
|
* Set loading state
|
|
188
178
|
*/
|
|
189
179
|
loading(value) {
|
|
190
|
-
this.state.loading = value;
|
|
191
|
-
if (this.container) {
|
|
192
|
-
if (value) {
|
|
193
|
-
this.container.classList.add('jux-loading');
|
|
194
|
-
this.container.setAttribute('aria-busy', 'true');
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
this.container.classList.remove('jux-loading');
|
|
198
|
-
this.container.removeAttribute('aria-busy');
|
|
199
|
-
}
|
|
200
|
-
}
|
|
180
|
+
this.state.loading = value; // ✅ Triggers update()
|
|
201
181
|
return this;
|
|
202
182
|
}
|
|
203
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
|
|
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(
|
|
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) {
|
|
@@ -85,7 +109,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
|
|
|
85
109
|
* Set component style
|
|
86
110
|
*/
|
|
87
111
|
style(value: string): this {
|
|
88
|
-
|
|
112
|
+
this.state.style = value; // ✅ Triggers update()
|
|
89
113
|
return this;
|
|
90
114
|
}
|
|
91
115
|
|
|
@@ -93,7 +117,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
|
|
|
93
117
|
* Set component class
|
|
94
118
|
*/
|
|
95
119
|
class(value: string): this {
|
|
96
|
-
|
|
120
|
+
this.state.class = value; // ✅ Triggers update()
|
|
97
121
|
return this;
|
|
98
122
|
}
|
|
99
123
|
|
|
@@ -105,13 +129,10 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
|
|
|
105
129
|
* Add a CSS class to the component
|
|
106
130
|
*/
|
|
107
131
|
addClass(value: string): this {
|
|
108
|
-
const current =
|
|
109
|
-
const classes = current.split(' ').filter((c: string) => c);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
(this.state as any).class = classes.join(' ');
|
|
113
|
-
if (this.container) this.container.classList.add(value);
|
|
114
|
-
}
|
|
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()
|
|
115
136
|
return this;
|
|
116
137
|
}
|
|
117
138
|
|
|
@@ -119,10 +140,9 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
|
|
|
119
140
|
* Remove a CSS class from the component
|
|
120
141
|
*/
|
|
121
142
|
removeClass(value: string): this {
|
|
122
|
-
const current =
|
|
143
|
+
const current = this.state.class || '';
|
|
123
144
|
const classes = current.split(' ').filter((c: string) => c && c !== value);
|
|
124
|
-
|
|
125
|
-
if (this.container) this.container.classList.remove(value);
|
|
145
|
+
this.state.class = classes.join(' '); // ✅ Triggers update()
|
|
126
146
|
return this;
|
|
127
147
|
}
|
|
128
148
|
|
|
@@ -130,7 +150,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
|
|
|
130
150
|
* Toggle a CSS class on the component
|
|
131
151
|
*/
|
|
132
152
|
toggleClass(value: string): this {
|
|
133
|
-
const current =
|
|
153
|
+
const current = this.state.class || '';
|
|
134
154
|
const hasClass = current.split(' ').includes(value);
|
|
135
155
|
return hasClass ? this.removeClass(value) : this.addClass(value);
|
|
136
156
|
}
|
|
@@ -143,14 +163,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
|
|
|
143
163
|
* Set component visibility
|
|
144
164
|
*/
|
|
145
165
|
visible(value: boolean): this {
|
|
146
|
-
|
|
147
|
-
if (this.container) {
|
|
148
|
-
// Find the actual component wrapper, not the parent container
|
|
149
|
-
const wrapper = this.container.querySelector(`#${this._id}`) as HTMLElement;
|
|
150
|
-
if (wrapper) {
|
|
151
|
-
wrapper.style.display = value ? '' : 'none';
|
|
152
|
-
}
|
|
153
|
-
}
|
|
166
|
+
this.state.visible = value; // ✅ Triggers update()
|
|
154
167
|
return this;
|
|
155
168
|
}
|
|
156
169
|
|
|
@@ -218,14 +231,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
|
|
|
218
231
|
* Set disabled state for interactive elements
|
|
219
232
|
*/
|
|
220
233
|
disabled(value: boolean): this {
|
|
221
|
-
|
|
222
|
-
if (this.container) {
|
|
223
|
-
const inputs = this.container.querySelectorAll('input, button, select, textarea');
|
|
224
|
-
inputs.forEach(el => {
|
|
225
|
-
(el as HTMLInputElement).disabled = value;
|
|
226
|
-
});
|
|
227
|
-
this.container.setAttribute('aria-disabled', String(value));
|
|
228
|
-
}
|
|
234
|
+
this.state.disabled = value; // ✅ Triggers update()
|
|
229
235
|
return this;
|
|
230
236
|
}
|
|
231
237
|
|
|
@@ -251,16 +257,7 @@ export abstract class BaseComponent<TState extends Record<string, any>> {
|
|
|
251
257
|
* Set loading state
|
|
252
258
|
*/
|
|
253
259
|
loading(value: boolean): this {
|
|
254
|
-
|
|
255
|
-
if (this.container) {
|
|
256
|
-
if (value) {
|
|
257
|
-
this.container.classList.add('jux-loading');
|
|
258
|
-
this.container.setAttribute('aria-busy', 'true');
|
|
259
|
-
} else {
|
|
260
|
-
this.container.classList.remove('jux-loading');
|
|
261
|
-
this.container.removeAttribute('aria-busy');
|
|
262
|
-
}
|
|
263
|
-
}
|
|
260
|
+
this.state.loading = value; // ✅ Triggers update()
|
|
264
261
|
return this;
|
|
265
262
|
}
|
|
266
263
|
|
package/lib/components/hero.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseComponent } from './base/BaseComponent.js';
|
|
1
|
+
import { BaseComponent, BaseState } from './base/BaseComponent.js';
|
|
2
2
|
export interface HeroOptions {
|
|
3
3
|
title?: string;
|
|
4
4
|
subtitle?: string;
|
|
@@ -16,7 +16,7 @@ export interface HeroOptions {
|
|
|
16
16
|
style?: string;
|
|
17
17
|
class?: string;
|
|
18
18
|
}
|
|
19
|
-
type HeroState = {
|
|
19
|
+
type HeroState = BaseState & {
|
|
20
20
|
title: string;
|
|
21
21
|
subtitle: string;
|
|
22
22
|
content: string;
|
|
@@ -30,8 +30,6 @@ type HeroState = {
|
|
|
30
30
|
backgroundOverlay: boolean;
|
|
31
31
|
variant: string;
|
|
32
32
|
centered: boolean;
|
|
33
|
-
style: string;
|
|
34
|
-
class: string;
|
|
35
33
|
};
|
|
36
34
|
export declare class Hero extends BaseComponent<HeroState> {
|
|
37
35
|
constructor(id: string, options?: HeroOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["hero.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["hero.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMnE,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAA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AAM,GAAG,IAAI;IAK7B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKxB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAatF,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAKvC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAS9B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;CAuEhC;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAEhE"}
|
package/lib/components/hero.js
CHANGED
|
@@ -37,7 +37,7 @@ export class Hero extends BaseComponent {
|
|
|
37
37
|
update(prop, value) {
|
|
38
38
|
const hero = document.getElementById(this._id);
|
|
39
39
|
if (!hero)
|
|
40
|
-
return;
|
|
40
|
+
return;
|
|
41
41
|
switch (prop) {
|
|
42
42
|
case 'title':
|
|
43
43
|
const titleEl = document.getElementById(`${this._id}-title`);
|
package/lib/components/hero.ts
CHANGED
|
@@ -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 - Hero is display-only, but CTA button can trigger actions
|
|
4
4
|
const TRIGGER_EVENTS = [] as const;
|
|
@@ -18,7 +18,7 @@ export interface HeroOptions {
|
|
|
18
18
|
class?: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
type HeroState = {
|
|
21
|
+
type HeroState = BaseState & {
|
|
22
22
|
title: string;
|
|
23
23
|
subtitle: string;
|
|
24
24
|
content: string;
|
|
@@ -28,8 +28,6 @@ type HeroState = {
|
|
|
28
28
|
backgroundOverlay: boolean;
|
|
29
29
|
variant: string;
|
|
30
30
|
centered: boolean;
|
|
31
|
-
style: string;
|
|
32
|
-
class: string;
|
|
33
31
|
};
|
|
34
32
|
|
|
35
33
|
export class Hero extends BaseComponent<HeroState> {
|
|
@@ -71,7 +69,7 @@ export class Hero extends BaseComponent<HeroState> {
|
|
|
71
69
|
*/
|
|
72
70
|
update(prop: string, value: any): void {
|
|
73
71
|
const hero = document.getElementById(this._id);
|
|
74
|
-
if (!hero) return;
|
|
72
|
+
if (!hero) return;
|
|
75
73
|
|
|
76
74
|
switch (prop) {
|
|
77
75
|
case 'title':
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { BaseComponent } from './base/BaseComponent.js';
|
|
2
|
-
|
|
1
|
+
import { BaseComponent, BaseState } from './base/BaseComponent.js';
|
|
2
|
+
export interface SidebarItem {
|
|
3
|
+
label: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
click?: () => void;
|
|
6
|
+
icon?: string;
|
|
7
|
+
items?: SidebarItem[];
|
|
8
|
+
active?: boolean;
|
|
9
|
+
itemClass?: string;
|
|
10
|
+
}
|
|
3
11
|
export interface SidebarOptions {
|
|
4
12
|
position?: 'left' | 'right';
|
|
5
13
|
width?: string;
|
|
@@ -7,42 +15,44 @@ export interface SidebarOptions {
|
|
|
7
15
|
showToggle?: boolean;
|
|
8
16
|
expandOnHover?: boolean;
|
|
9
17
|
collapsed?: boolean;
|
|
10
|
-
|
|
18
|
+
items?: SidebarItem[];
|
|
19
|
+
header?: string;
|
|
20
|
+
footer?: string;
|
|
11
21
|
style?: string;
|
|
12
22
|
class?: string;
|
|
13
23
|
}
|
|
14
|
-
type SidebarState = {
|
|
24
|
+
type SidebarState = BaseState & {
|
|
15
25
|
position: 'left' | 'right';
|
|
16
26
|
width: string;
|
|
17
27
|
collapsible: boolean;
|
|
18
28
|
showToggle: boolean;
|
|
19
29
|
expandOnHover: boolean;
|
|
20
30
|
collapsed: boolean;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
items: SidebarItem[];
|
|
32
|
+
header: string;
|
|
33
|
+
footer: string;
|
|
24
34
|
};
|
|
25
35
|
export declare class Sidebar extends BaseComponent<SidebarState> {
|
|
26
36
|
private _sidebar;
|
|
27
|
-
private _menu;
|
|
28
37
|
constructor(id: string, options?: SidebarOptions);
|
|
29
38
|
protected getTriggerEvents(): readonly string[];
|
|
30
39
|
protected getCallbackEvents(): readonly string[];
|
|
40
|
+
private _setActiveStates;
|
|
41
|
+
private _renderItem;
|
|
42
|
+
update(prop: string, value: any): void;
|
|
31
43
|
width(value: string): this;
|
|
32
44
|
position(value: 'left' | 'right'): this;
|
|
33
45
|
collapsible(value: boolean): this;
|
|
34
46
|
showToggle(value: boolean): this;
|
|
35
47
|
expandOnHover(value: boolean): this;
|
|
36
48
|
collapsed(value: boolean): this;
|
|
37
|
-
|
|
49
|
+
items(value: SidebarItem[]): this;
|
|
50
|
+
addItem(item: SidebarItem): this;
|
|
51
|
+
header(value: string): this;
|
|
52
|
+
footer(value: string): this;
|
|
38
53
|
toggle(): void;
|
|
39
|
-
|
|
40
|
-
* Refresh menu active states (called automatically on URL changes)
|
|
41
|
-
*/
|
|
42
|
-
refreshMenu(): this;
|
|
43
|
-
private _updateCollapsedState;
|
|
54
|
+
refreshActiveStates(): this;
|
|
44
55
|
render(targetId?: string): this;
|
|
45
|
-
update(prop: string, value: any): void;
|
|
46
56
|
}
|
|
47
57
|
export declare function sidebar(id: string, options?: SidebarOptions): Sidebar;
|
|
48
58
|
export {};
|