juxscript 1.1.81 → 1.1.85
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/dom-structure-map.json +1 -1
- package/lib/components/button.d.ts +22 -6
- package/lib/components/button.d.ts.map +1 -1
- package/lib/components/button.js +57 -26
- package/lib/components/button.ts +56 -27
- package/lib/components/paragraph.d.ts +8 -0
- package/lib/components/paragraph.d.ts.map +1 -1
- package/lib/components/paragraph.js +33 -2
- package/lib/components/paragraph.ts +37 -2
- package/package.json +1 -1
package/dom-structure-map.json
CHANGED
|
@@ -14,6 +14,7 @@ export interface ButtonOptions {
|
|
|
14
14
|
}
|
|
15
15
|
type ButtonState = {
|
|
16
16
|
label: string;
|
|
17
|
+
content: string;
|
|
17
18
|
icon: string;
|
|
18
19
|
variant: string;
|
|
19
20
|
size: string;
|
|
@@ -30,13 +31,28 @@ export declare class Button extends BaseComponent<ButtonState> {
|
|
|
30
31
|
constructor(id: string, options?: ButtonOptions);
|
|
31
32
|
protected getTriggerEvents(): readonly string[];
|
|
32
33
|
protected getCallbackEvents(): readonly string[];
|
|
34
|
+
/**
|
|
35
|
+
* Set button label (plain text, auto-escaped)
|
|
36
|
+
* Clears any HTML content
|
|
37
|
+
*/
|
|
33
38
|
label(value: string): this;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Alias for label() - more semantic for buttons
|
|
41
|
+
*/
|
|
42
|
+
text(value: string): this;
|
|
43
|
+
/**
|
|
44
|
+
* Set button content as HTML (overrides label)
|
|
45
|
+
*/
|
|
46
|
+
content(value: string): this;
|
|
47
|
+
/**
|
|
48
|
+
* Alias for content() - more semantic
|
|
49
|
+
*/
|
|
50
|
+
html(value: string): this;
|
|
51
|
+
/**
|
|
52
|
+
* Update button text/HTML based on priority
|
|
53
|
+
* Priority: content (HTML) > label (text) > loading state
|
|
54
|
+
*/
|
|
55
|
+
private _updateButtonText;
|
|
40
56
|
update(prop: string, value: any): void;
|
|
41
57
|
/**
|
|
42
58
|
* Override visible() to update the actual button element
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQxD,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAChG,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,MAAO,SAAQ,aAAa,CAAC,WAAW,CAAC;IACpD,OAAO,CAAC,cAAc,CAAkC;gBAE5C,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQxD,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAChG,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,MAAO,SAAQ,aAAa,CAAC,WAAW,CAAC;IACpD,OAAO,CAAC,cAAc,CAAkC;gBAE5C,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAmB/C,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAQhD;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAO1B;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzB;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM5B;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAgBzB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAQtC;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAW7B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CA4DnE;AAED,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAElE"}
|
package/lib/components/button.js
CHANGED
|
@@ -8,7 +8,8 @@ export class Button extends BaseComponent {
|
|
|
8
8
|
constructor(id, options) {
|
|
9
9
|
const opts = options || {};
|
|
10
10
|
super(id, {
|
|
11
|
-
label: opts.label ?? formatIdAsLabel(id), // ✅
|
|
11
|
+
label: opts.label ?? formatIdAsLabel(id), // ✅ Auto-generate label
|
|
12
|
+
content: '', // ✅ Empty by default
|
|
12
13
|
icon: opts.icon ?? '',
|
|
13
14
|
variant: opts.variant ?? 'primary',
|
|
14
15
|
size: opts.size ?? 'medium',
|
|
@@ -20,7 +21,7 @@ export class Button extends BaseComponent {
|
|
|
20
21
|
style: opts.style ?? '',
|
|
21
22
|
class: opts.class ?? ''
|
|
22
23
|
});
|
|
23
|
-
this._buttonElement = null;
|
|
24
|
+
this._buttonElement = null;
|
|
24
25
|
}
|
|
25
26
|
getTriggerEvents() {
|
|
26
27
|
return TRIGGER_EVENTS;
|
|
@@ -29,36 +30,56 @@ export class Button extends BaseComponent {
|
|
|
29
30
|
return CALLBACK_EVENTS;
|
|
30
31
|
}
|
|
31
32
|
/* ═════════════════════════════════════════════════════════════════
|
|
32
|
-
* FLUENT API
|
|
33
|
+
* FLUENT API - Priority: content > label > auto-generated
|
|
33
34
|
* ═════════════════════════════════════════════════════════════════ */
|
|
34
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Set button label (plain text, auto-escaped)
|
|
37
|
+
* Clears any HTML content
|
|
38
|
+
*/
|
|
35
39
|
label(value) {
|
|
36
40
|
this.state.label = value;
|
|
41
|
+
this.state.content = ''; // ✅ Clear HTML content when label is set
|
|
42
|
+
this._updateButtonText();
|
|
37
43
|
return this;
|
|
38
44
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.state.variant = value;
|
|
45
|
-
return this;
|
|
46
|
-
}
|
|
47
|
-
size(value) {
|
|
48
|
-
this.state.size = value;
|
|
49
|
-
return this;
|
|
45
|
+
/**
|
|
46
|
+
* Alias for label() - more semantic for buttons
|
|
47
|
+
*/
|
|
48
|
+
text(value) {
|
|
49
|
+
return this.label(value);
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Set button content as HTML (overrides label)
|
|
53
|
+
*/
|
|
54
|
+
content(value) {
|
|
55
|
+
this.state.content = value;
|
|
56
|
+
this._updateButtonText();
|
|
53
57
|
return this;
|
|
54
58
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Alias for content() - more semantic
|
|
61
|
+
*/
|
|
62
|
+
html(value) {
|
|
63
|
+
return this.content(value);
|
|
58
64
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Update button text/HTML based on priority
|
|
67
|
+
* Priority: content (HTML) > label (text) > loading state
|
|
68
|
+
*/
|
|
69
|
+
_updateButtonText() {
|
|
70
|
+
if (!this._buttonElement)
|
|
71
|
+
return;
|
|
72
|
+
const textEl = this._buttonElement.querySelector('span:not(.jux-button-icon)');
|
|
73
|
+
if (!textEl)
|
|
74
|
+
return;
|
|
75
|
+
// Priority 1: HTML content (if set)
|
|
76
|
+
if (this.state.content) {
|
|
77
|
+
textEl.innerHTML = this.state.content;
|
|
78
|
+
}
|
|
79
|
+
// Priority 2: Label text
|
|
80
|
+
else if (this.state.label) {
|
|
81
|
+
textEl.textContent = this.state.loading ? 'Loading...' : this.state.label;
|
|
82
|
+
}
|
|
62
83
|
}
|
|
63
84
|
update(prop, value) {
|
|
64
85
|
// No reactive updates needed
|
|
@@ -79,9 +100,9 @@ export class Button extends BaseComponent {
|
|
|
79
100
|
}
|
|
80
101
|
render(targetId) {
|
|
81
102
|
const container = this._setupContainer(targetId);
|
|
82
|
-
const { label, variant, size, disabled, icon, iconPosition, loading, style, class: className } = this.state;
|
|
103
|
+
const { label, content, variant, size, disabled, icon, iconPosition, loading, style, class: className } = this.state;
|
|
83
104
|
const button = document.createElement('button');
|
|
84
|
-
this._buttonElement = button;
|
|
105
|
+
this._buttonElement = button;
|
|
85
106
|
button.className = `jux-button jux-button-${variant} jux-button-${size}`;
|
|
86
107
|
button.id = this._id;
|
|
87
108
|
button.disabled = disabled || loading;
|
|
@@ -96,7 +117,17 @@ export class Button extends BaseComponent {
|
|
|
96
117
|
button.appendChild(iconEl);
|
|
97
118
|
}
|
|
98
119
|
const textEl = document.createElement('span');
|
|
99
|
-
|
|
120
|
+
// ✅ Priority: content (HTML) > label (text) > loading state
|
|
121
|
+
if (content) {
|
|
122
|
+
textEl.innerHTML = content;
|
|
123
|
+
}
|
|
124
|
+
else if (label) {
|
|
125
|
+
textEl.textContent = loading ? 'Loading...' : label;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// Fallback to auto-generated label from ID
|
|
129
|
+
textEl.textContent = loading ? 'Loading...' : formatIdAsLabel(this._id);
|
|
130
|
+
}
|
|
100
131
|
button.appendChild(textEl);
|
|
101
132
|
if (icon && iconPosition === 'right') {
|
|
102
133
|
const iconEl = document.createElement('span');
|
package/lib/components/button.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface ButtonOptions {
|
|
|
22
22
|
|
|
23
23
|
type ButtonState = {
|
|
24
24
|
label: string;
|
|
25
|
+
content: string; // ✅ Raw HTML content (overrides label if set)
|
|
25
26
|
icon: string;
|
|
26
27
|
variant: string;
|
|
27
28
|
size: string;
|
|
@@ -35,13 +36,14 @@ type ButtonState = {
|
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
export class Button extends BaseComponent<ButtonState> {
|
|
38
|
-
private _buttonElement: HTMLButtonElement | null = null;
|
|
39
|
+
private _buttonElement: HTMLButtonElement | null = null;
|
|
39
40
|
|
|
40
41
|
constructor(id: string, options?: ButtonOptions) {
|
|
41
42
|
const opts = options || {};
|
|
42
43
|
|
|
43
44
|
super(id, {
|
|
44
|
-
label: opts.label ?? formatIdAsLabel(id),
|
|
45
|
+
label: opts.label ?? formatIdAsLabel(id), // ✅ Auto-generate label
|
|
46
|
+
content: '', // ✅ Empty by default
|
|
45
47
|
icon: opts.icon ?? '',
|
|
46
48
|
variant: opts.variant ?? 'primary',
|
|
47
49
|
size: opts.size ?? 'medium',
|
|
@@ -64,44 +66,61 @@ export class Button extends BaseComponent<ButtonState> {
|
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
/* ═════════════════════════════════════════════════════════════════
|
|
67
|
-
* FLUENT API
|
|
69
|
+
* FLUENT API - Priority: content > label > auto-generated
|
|
68
70
|
* ═════════════════════════════════════════════════════════════════ */
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Set button label (plain text, auto-escaped)
|
|
74
|
+
* Clears any HTML content
|
|
75
|
+
*/
|
|
72
76
|
label(value: string): this {
|
|
73
77
|
this.state.label = value;
|
|
78
|
+
this.state.content = ''; // ✅ Clear HTML content when label is set
|
|
79
|
+
this._updateButtonText();
|
|
74
80
|
return this;
|
|
75
81
|
}
|
|
76
82
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Alias for label() - more semantic for buttons
|
|
85
|
+
*/
|
|
86
|
+
text(value: string): this {
|
|
87
|
+
return this.label(value);
|
|
80
88
|
}
|
|
81
89
|
|
|
82
|
-
|
|
83
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Set button content as HTML (overrides label)
|
|
92
|
+
*/
|
|
93
|
+
content(value: string): this {
|
|
94
|
+
this.state.content = value;
|
|
95
|
+
this._updateButtonText();
|
|
84
96
|
return this;
|
|
85
97
|
}
|
|
86
98
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Alias for content() - more semantic
|
|
101
|
+
*/
|
|
102
|
+
html(value: string): this {
|
|
103
|
+
return this.content(value);
|
|
90
104
|
}
|
|
91
105
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Update button text/HTML based on priority
|
|
108
|
+
* Priority: content (HTML) > label (text) > loading state
|
|
109
|
+
*/
|
|
110
|
+
private _updateButtonText(): void {
|
|
111
|
+
if (!this._buttonElement) return;
|
|
96
112
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return this;
|
|
100
|
-
}
|
|
113
|
+
const textEl = this._buttonElement.querySelector('span:not(.jux-button-icon)') as HTMLElement;
|
|
114
|
+
if (!textEl) return;
|
|
101
115
|
|
|
102
|
-
|
|
103
|
-
this.state.
|
|
104
|
-
|
|
116
|
+
// Priority 1: HTML content (if set)
|
|
117
|
+
if (this.state.content) {
|
|
118
|
+
textEl.innerHTML = this.state.content;
|
|
119
|
+
}
|
|
120
|
+
// Priority 2: Label text
|
|
121
|
+
else if (this.state.label) {
|
|
122
|
+
textEl.textContent = this.state.loading ? 'Loading...' : this.state.label;
|
|
123
|
+
}
|
|
105
124
|
}
|
|
106
125
|
|
|
107
126
|
update(prop: string, value: any): void {
|
|
@@ -128,10 +147,10 @@ export class Button extends BaseComponent<ButtonState> {
|
|
|
128
147
|
|
|
129
148
|
render(targetId?: string | HTMLElement | BaseComponent<any>): this {
|
|
130
149
|
const container = this._setupContainer(targetId);
|
|
131
|
-
const { label, variant, size, disabled, icon, iconPosition, loading, style, class: className } = this.state;
|
|
150
|
+
const { label, content, variant, size, disabled, icon, iconPosition, loading, style, class: className } = this.state;
|
|
132
151
|
|
|
133
152
|
const button = document.createElement('button');
|
|
134
|
-
this._buttonElement = button;
|
|
153
|
+
this._buttonElement = button;
|
|
135
154
|
button.className = `jux-button jux-button-${variant} jux-button-${size}`;
|
|
136
155
|
button.id = this._id;
|
|
137
156
|
button.disabled = disabled || loading;
|
|
@@ -147,7 +166,17 @@ export class Button extends BaseComponent<ButtonState> {
|
|
|
147
166
|
}
|
|
148
167
|
|
|
149
168
|
const textEl = document.createElement('span');
|
|
150
|
-
|
|
169
|
+
|
|
170
|
+
// ✅ Priority: content (HTML) > label (text) > loading state
|
|
171
|
+
if (content) {
|
|
172
|
+
textEl.innerHTML = content;
|
|
173
|
+
} else if (label) {
|
|
174
|
+
textEl.textContent = loading ? 'Loading...' : label;
|
|
175
|
+
} else {
|
|
176
|
+
// Fallback to auto-generated label from ID
|
|
177
|
+
textEl.textContent = loading ? 'Loading...' : formatIdAsLabel(this._id);
|
|
178
|
+
}
|
|
179
|
+
|
|
151
180
|
button.appendChild(textEl);
|
|
152
181
|
|
|
153
182
|
if (icon && iconPosition === 'right') {
|
|
@@ -13,8 +13,16 @@ export declare class Paragraph extends BaseComponent<ParagraphState> {
|
|
|
13
13
|
constructor(id: string, options?: ParagraphOptions);
|
|
14
14
|
protected getTriggerEvents(): readonly string[];
|
|
15
15
|
protected getCallbackEvents(): readonly string[];
|
|
16
|
+
/**
|
|
17
|
+
* ✅ Reactive update implementation for Paragraph
|
|
18
|
+
* Called automatically when this.state[prop] changes via Proxy
|
|
19
|
+
*/
|
|
16
20
|
update(prop: string, value: any): void;
|
|
17
21
|
content(value: string): this;
|
|
22
|
+
/**
|
|
23
|
+
* Alias for content() - more intuitive naming
|
|
24
|
+
*/
|
|
25
|
+
text(value: string): this;
|
|
18
26
|
render(targetId?: string | HTMLElement | BaseComponent<any>): this;
|
|
19
27
|
}
|
|
20
28
|
export declare function paragraph(id: string, options?: ParagraphOptions): Paragraph;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["paragraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD,MAAM,WAAW,gBAAgB;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,cAAc,GAAG;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,SAAU,SAAQ,aAAa,CAAC,cAAc,CAAC;gBAC5C,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAQtD,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;
|
|
1
|
+
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["paragraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD,MAAM,WAAW,gBAAgB;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,cAAc,GAAG;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,SAAU,SAAQ,aAAa,CAAC,cAAc,CAAC;gBAC5C,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAQtD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAIhD;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAqCtC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQzB,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CAuCrE;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAE/E"}
|
|
@@ -16,8 +16,33 @@ export class Paragraph extends BaseComponent {
|
|
|
16
16
|
getCallbackEvents() {
|
|
17
17
|
return CALLBACK_EVENTS;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* ✅ Reactive update implementation for Paragraph
|
|
21
|
+
* Called automatically when this.state[prop] changes via Proxy
|
|
22
|
+
*/
|
|
19
23
|
update(prop, value) {
|
|
20
|
-
|
|
24
|
+
const el = document.getElementById(this._id);
|
|
25
|
+
if (!el)
|
|
26
|
+
return;
|
|
27
|
+
// Handle paragraph-specific properties
|
|
28
|
+
switch (prop) {
|
|
29
|
+
case 'content':
|
|
30
|
+
el.textContent = value;
|
|
31
|
+
break;
|
|
32
|
+
case 'class':
|
|
33
|
+
// Preserve base jux-paragraph class, add custom classes
|
|
34
|
+
const baseClass = 'jux-paragraph';
|
|
35
|
+
const userClasses = value.split(' ').filter((c) => c);
|
|
36
|
+
el.className = [baseClass, ...userClasses].join(' ');
|
|
37
|
+
break;
|
|
38
|
+
case 'style':
|
|
39
|
+
el.setAttribute('style', value);
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
// Call parent for base properties (visible, disabled, loading, etc.)
|
|
43
|
+
super.update(prop, value);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
21
46
|
}
|
|
22
47
|
/* ═════════════════════════════════════════════════════════════════
|
|
23
48
|
* FLUENT API
|
|
@@ -27,9 +52,15 @@ export class Paragraph extends BaseComponent {
|
|
|
27
52
|
// - bind(), sync(), renderTo()
|
|
28
53
|
// - All other base methods
|
|
29
54
|
content(value) {
|
|
30
|
-
this.state.content = value;
|
|
55
|
+
this.state.content = value; // ✅ Triggers update()
|
|
31
56
|
return this;
|
|
32
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Alias for content() - more intuitive naming
|
|
60
|
+
*/
|
|
61
|
+
text(value) {
|
|
62
|
+
return this.content(value);
|
|
63
|
+
}
|
|
33
64
|
/* ═════════════════════════════════════════════════════════════════
|
|
34
65
|
* RENDER
|
|
35
66
|
* ═════════════════════════════════════════════════════════════════ */
|
|
@@ -33,8 +33,36 @@ export class Paragraph extends BaseComponent<ParagraphState> {
|
|
|
33
33
|
return CALLBACK_EVENTS;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* ✅ Reactive update implementation for Paragraph
|
|
38
|
+
* Called automatically when this.state[prop] changes via Proxy
|
|
39
|
+
*/
|
|
36
40
|
update(prop: string, value: any): void {
|
|
37
|
-
|
|
41
|
+
const el = document.getElementById(this._id);
|
|
42
|
+
if (!el) return;
|
|
43
|
+
|
|
44
|
+
// Handle paragraph-specific properties
|
|
45
|
+
switch (prop) {
|
|
46
|
+
case 'content':
|
|
47
|
+
el.textContent = value;
|
|
48
|
+
break;
|
|
49
|
+
|
|
50
|
+
case 'class':
|
|
51
|
+
// Preserve base jux-paragraph class, add custom classes
|
|
52
|
+
const baseClass = 'jux-paragraph';
|
|
53
|
+
const userClasses = value.split(' ').filter((c: string) => c);
|
|
54
|
+
el.className = [baseClass, ...userClasses].join(' ');
|
|
55
|
+
break;
|
|
56
|
+
|
|
57
|
+
case 'style':
|
|
58
|
+
el.setAttribute('style', value);
|
|
59
|
+
break;
|
|
60
|
+
|
|
61
|
+
default:
|
|
62
|
+
// Call parent for base properties (visible, disabled, loading, etc.)
|
|
63
|
+
super.update(prop, value);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
38
66
|
}
|
|
39
67
|
|
|
40
68
|
/* ═════════════════════════════════════════════════════════════════
|
|
@@ -47,10 +75,17 @@ export class Paragraph extends BaseComponent<ParagraphState> {
|
|
|
47
75
|
// - All other base methods
|
|
48
76
|
|
|
49
77
|
content(value: string): this {
|
|
50
|
-
this.state.content = value;
|
|
78
|
+
this.state.content = value; // ✅ Triggers update()
|
|
51
79
|
return this;
|
|
52
80
|
}
|
|
53
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Alias for content() - more intuitive naming
|
|
84
|
+
*/
|
|
85
|
+
text(value: string): this {
|
|
86
|
+
return this.content(value);
|
|
87
|
+
}
|
|
88
|
+
|
|
54
89
|
/* ═════════════════════════════════════════════════════════════════
|
|
55
90
|
* RENDER
|
|
56
91
|
* ═════════════════════════════════════════════════════════════════ */
|