juxscript 1.1.16 → 1.1.17
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/lib/components/base/BaseComponent.d.ts +5 -21
- package/lib/components/base/BaseComponent.d.ts.map +1 -1
- package/lib/components/base/BaseComponent.js +38 -0
- package/lib/components/base/BaseComponent.ts +40 -21
- package/lib/components/hero.d.ts +2 -2
- package/lib/components/hero.d.ts.map +1 -1
- package/lib/components/hero.js +9 -9
- package/lib/components/hero.ts +10 -10
- package/package.json +1 -1
|
@@ -42,28 +42,12 @@ export declare abstract class BaseComponent<TState extends BaseState = BaseState
|
|
|
42
42
|
protected abstract getCallbackEvents(): readonly string[];
|
|
43
43
|
abstract render(targetId?: string): this;
|
|
44
44
|
/**
|
|
45
|
-
* REACTIVE UPDATE HOOK (
|
|
46
|
-
* Called automatically when this.state[prop] changes via
|
|
47
|
-
*
|
|
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
|
-
* }
|
|
45
|
+
* REACTIVE UPDATE HOOK (PUBLIC, CONCRETE)
|
|
46
|
+
* Called automatically when this.state[prop] changes via Proxy.
|
|
47
|
+
* Default implementation handles base properties.
|
|
48
|
+
* Children can override to add component-specific logic.
|
|
65
49
|
*/
|
|
66
|
-
|
|
50
|
+
update(prop: string, value: any): void;
|
|
67
51
|
/**
|
|
68
52
|
* Set component style
|
|
69
53
|
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AAO,IAAI,IAAI;IAQf;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAS7B;;OAEG;IACH,KAAK,IAAI,IAAI;IAQb;;OAEG;IACH,IAAI,IAAI,IAAI;IAYZ;;OAEG;IACH,MAAM,IAAI,IAAI;IAYd,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI;IAW5C;;;;;;OAMG;IACH,IAAI,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;;;;;;OAMG;IACH,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,CAE5B;CACJ"}
|
|
@@ -40,6 +40,44 @@ export class BaseComponent {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* REACTIVE UPDATE HOOK (PUBLIC, CONCRETE)
|
|
45
|
+
* Called automatically when this.state[prop] changes via Proxy.
|
|
46
|
+
* Default implementation handles base properties.
|
|
47
|
+
* Children can override to add component-specific logic.
|
|
48
|
+
*/
|
|
49
|
+
update(prop, value) {
|
|
50
|
+
if (!this.container)
|
|
51
|
+
return;
|
|
52
|
+
const el = this.container.querySelector(`#${this._id}`);
|
|
53
|
+
if (!el)
|
|
54
|
+
return;
|
|
55
|
+
// Handle base properties
|
|
56
|
+
switch (prop) {
|
|
57
|
+
case 'visible':
|
|
58
|
+
el.style.display = value ? '' : 'none';
|
|
59
|
+
break;
|
|
60
|
+
case 'class':
|
|
61
|
+
const baseClasses = el.className.split(' ').filter(c => c.startsWith('jux-'));
|
|
62
|
+
const userClasses = value.split(' ').filter((c) => c);
|
|
63
|
+
el.className = [...baseClasses, ...userClasses].join(' ');
|
|
64
|
+
break;
|
|
65
|
+
case 'style':
|
|
66
|
+
el.setAttribute('style', value);
|
|
67
|
+
break;
|
|
68
|
+
case 'disabled':
|
|
69
|
+
el.setAttribute('aria-disabled', String(value));
|
|
70
|
+
const inputs = el.querySelectorAll('input, button, select, textarea');
|
|
71
|
+
inputs.forEach(input => {
|
|
72
|
+
input.disabled = value;
|
|
73
|
+
});
|
|
74
|
+
break;
|
|
75
|
+
case 'loading':
|
|
76
|
+
el.classList.toggle('jux-loading', value);
|
|
77
|
+
el.setAttribute('aria-busy', String(value));
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
43
81
|
/* ═════════════════════════════════════════════════════════════════
|
|
44
82
|
* COMMON FLUENT API (Inherited by all components)
|
|
45
83
|
* ═════════════════════════════════════════════════════════════════ */
|
|
@@ -78,28 +78,47 @@ export abstract class BaseComponent<TState extends BaseState = BaseState> {
|
|
|
78
78
|
abstract render(targetId?: string): this;
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* REACTIVE UPDATE HOOK (
|
|
82
|
-
* Called automatically when this.state[prop] changes via
|
|
83
|
-
*
|
|
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
|
-
* }
|
|
81
|
+
* REACTIVE UPDATE HOOK (PUBLIC, CONCRETE)
|
|
82
|
+
* Called automatically when this.state[prop] changes via Proxy.
|
|
83
|
+
* Default implementation handles base properties.
|
|
84
|
+
* Children can override to add component-specific logic.
|
|
101
85
|
*/
|
|
102
|
-
|
|
86
|
+
update(prop: string, value: any): void {
|
|
87
|
+
if (!this.container) return;
|
|
88
|
+
|
|
89
|
+
const el = this.container.querySelector(`#${this._id}`) as HTMLElement;
|
|
90
|
+
if (!el) return;
|
|
91
|
+
|
|
92
|
+
// Handle base properties
|
|
93
|
+
switch (prop) {
|
|
94
|
+
case 'visible':
|
|
95
|
+
el.style.display = value ? '' : 'none';
|
|
96
|
+
break;
|
|
97
|
+
|
|
98
|
+
case 'class':
|
|
99
|
+
const baseClasses = el.className.split(' ').filter(c => c.startsWith('jux-'));
|
|
100
|
+
const userClasses = value.split(' ').filter((c: string) => c);
|
|
101
|
+
el.className = [...baseClasses, ...userClasses].join(' ');
|
|
102
|
+
break;
|
|
103
|
+
|
|
104
|
+
case 'style':
|
|
105
|
+
el.setAttribute('style', value);
|
|
106
|
+
break;
|
|
107
|
+
|
|
108
|
+
case 'disabled':
|
|
109
|
+
el.setAttribute('aria-disabled', String(value));
|
|
110
|
+
const inputs = el.querySelectorAll('input, button, select, textarea');
|
|
111
|
+
inputs.forEach(input => {
|
|
112
|
+
(input as HTMLInputElement).disabled = value;
|
|
113
|
+
});
|
|
114
|
+
break;
|
|
115
|
+
|
|
116
|
+
case 'loading':
|
|
117
|
+
el.classList.toggle('jux-loading', value);
|
|
118
|
+
el.setAttribute('aria-busy', String(value));
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
103
122
|
|
|
104
123
|
/* ═════════════════════════════════════════════════════════════════
|
|
105
124
|
* COMMON FLUENT API (Inherited by all components)
|
package/lib/components/hero.d.ts
CHANGED
|
@@ -36,8 +36,8 @@ export declare class Hero extends BaseComponent<HeroState> {
|
|
|
36
36
|
protected getTriggerEvents(): readonly string[];
|
|
37
37
|
protected getCallbackEvents(): readonly string[];
|
|
38
38
|
/**
|
|
39
|
-
* Called automatically
|
|
40
|
-
*
|
|
39
|
+
* Called automatically when state changes.
|
|
40
|
+
* Extends BaseComponent's update() to handle Hero-specific properties.
|
|
41
41
|
*/
|
|
42
42
|
update(prop: string, value: any): void;
|
|
43
43
|
title(value: string): this;
|
|
@@ -1 +1 @@
|
|
|
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,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,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G,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;CAsEhC;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAEhE"}
|
package/lib/components/hero.js
CHANGED
|
@@ -27,14 +27,14 @@ export class Hero extends BaseComponent {
|
|
|
27
27
|
getCallbackEvents() {
|
|
28
28
|
return CALLBACK_EVENTS;
|
|
29
29
|
}
|
|
30
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
31
|
-
* REACTIVE DOM UPDATES
|
|
32
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
33
30
|
/**
|
|
34
|
-
* Called automatically
|
|
35
|
-
*
|
|
31
|
+
* Called automatically when state changes.
|
|
32
|
+
* Extends BaseComponent's update() to handle Hero-specific properties.
|
|
36
33
|
*/
|
|
37
34
|
update(prop, value) {
|
|
35
|
+
// First, call parent to handle base properties (visible, class, style, etc.)
|
|
36
|
+
super.update(prop, value);
|
|
37
|
+
// Then handle Hero-specific properties
|
|
38
38
|
const hero = document.getElementById(this._id);
|
|
39
39
|
if (!hero)
|
|
40
40
|
return;
|
|
@@ -50,17 +50,17 @@ export class Hero extends BaseComponent {
|
|
|
50
50
|
subtitleEl.textContent = value;
|
|
51
51
|
break;
|
|
52
52
|
case 'content':
|
|
53
|
-
const contentEl = hero.querySelector('.jux-hero-body');
|
|
53
|
+
const contentEl = hero.querySelector('.jux-hero-body');
|
|
54
54
|
if (contentEl)
|
|
55
55
|
contentEl.innerHTML = value;
|
|
56
56
|
break;
|
|
57
57
|
case 'cta':
|
|
58
|
-
const ctaEl = hero.querySelector('.jux-hero-cta');
|
|
58
|
+
const ctaEl = hero.querySelector('.jux-hero-cta');
|
|
59
59
|
if (ctaEl)
|
|
60
60
|
ctaEl.textContent = value;
|
|
61
61
|
break;
|
|
62
62
|
case 'ctaLink':
|
|
63
|
-
const ctaLinkEl = hero.querySelector('.jux-hero-cta');
|
|
63
|
+
const ctaLinkEl = hero.querySelector('.jux-hero-cta');
|
|
64
64
|
if (ctaLinkEl)
|
|
65
65
|
ctaLinkEl.href = value;
|
|
66
66
|
break;
|
|
@@ -70,7 +70,7 @@ export class Hero extends BaseComponent {
|
|
|
70
70
|
hero.style.backgroundRepeat = value.repeat;
|
|
71
71
|
break;
|
|
72
72
|
case 'centered':
|
|
73
|
-
hero.classList.toggle('jux-hero-centered', value);
|
|
73
|
+
hero.classList.toggle('jux-hero-centered', value);
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
76
|
}
|
package/lib/components/hero.ts
CHANGED
|
@@ -59,15 +59,15 @@ export class Hero extends BaseComponent<HeroState> {
|
|
|
59
59
|
return CALLBACK_EVENTS;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
63
|
-
* REACTIVE DOM UPDATES
|
|
64
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
65
|
-
|
|
66
62
|
/**
|
|
67
|
-
* Called automatically
|
|
68
|
-
*
|
|
63
|
+
* Called automatically when state changes.
|
|
64
|
+
* Extends BaseComponent's update() to handle Hero-specific properties.
|
|
69
65
|
*/
|
|
70
66
|
update(prop: string, value: any): void {
|
|
67
|
+
// First, call parent to handle base properties (visible, class, style, etc.)
|
|
68
|
+
super.update(prop, value);
|
|
69
|
+
|
|
70
|
+
// Then handle Hero-specific properties
|
|
71
71
|
const hero = document.getElementById(this._id);
|
|
72
72
|
if (!hero) return;
|
|
73
73
|
|
|
@@ -83,17 +83,17 @@ export class Hero extends BaseComponent<HeroState> {
|
|
|
83
83
|
break;
|
|
84
84
|
|
|
85
85
|
case 'content':
|
|
86
|
-
const contentEl = hero.querySelector('.jux-hero-body');
|
|
86
|
+
const contentEl = hero.querySelector('.jux-hero-body');
|
|
87
87
|
if (contentEl) contentEl.innerHTML = value;
|
|
88
88
|
break;
|
|
89
89
|
|
|
90
90
|
case 'cta':
|
|
91
|
-
const ctaEl = hero.querySelector('.jux-hero-cta') as HTMLElement;
|
|
91
|
+
const ctaEl = hero.querySelector('.jux-hero-cta') as HTMLElement;
|
|
92
92
|
if (ctaEl) ctaEl.textContent = value;
|
|
93
93
|
break;
|
|
94
94
|
|
|
95
95
|
case 'ctaLink':
|
|
96
|
-
const ctaLinkEl = hero.querySelector('.jux-hero-cta') as HTMLAnchorElement;
|
|
96
|
+
const ctaLinkEl = hero.querySelector('.jux-hero-cta') as HTMLAnchorElement;
|
|
97
97
|
if (ctaLinkEl) ctaLinkEl.href = value;
|
|
98
98
|
break;
|
|
99
99
|
|
|
@@ -104,7 +104,7 @@ export class Hero extends BaseComponent<HeroState> {
|
|
|
104
104
|
break;
|
|
105
105
|
|
|
106
106
|
case 'centered':
|
|
107
|
-
hero.classList.toggle('jux-hero-centered', value);
|
|
107
|
+
hero.classList.toggle('jux-hero-centered', value);
|
|
108
108
|
break;
|
|
109
109
|
}
|
|
110
110
|
}
|