juxscript 1.1.108 → 1.1.109
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/base/BaseComponent.d.ts.map +1 -1
- package/lib/components/base/BaseComponent.js +4 -0
- package/lib/components/base/BaseComponent.ts +6 -0
- package/lib/components/base/LayoutExtensions.d.ts +91 -0
- package/lib/components/base/LayoutExtensions.d.ts.map +1 -0
- package/lib/components/base/LayoutExtensions.js +131 -0
- package/lib/components/base/LayoutExtensions.ts +253 -0
- package/lib/components/stack/BaseStack.d.ts +18 -59
- package/lib/components/stack/BaseStack.d.ts.map +1 -1
- package/lib/components/stack/BaseStack.js +78 -161
- package/lib/components/stack/BaseStack.ts +89 -195
- package/lib/styles/{stack.css → animations.css} +47 -263
- package/lib/styles/modifiers.css +103 -0
- package/lib/styles/stacks.css +82 -0
- package/package.json +1 -1
|
@@ -1,78 +1,37 @@
|
|
|
1
1
|
import { BaseComponent, BaseState } from '../base/BaseComponent.js';
|
|
2
|
+
import { LayoutExtensions } from '../base/LayoutExtensions.js';
|
|
2
3
|
export interface StackOptions {
|
|
3
|
-
spacing?: 'none' | 'tight' | '
|
|
4
|
+
spacing?: 'none' | 'tight' | 'normal' | 'loose';
|
|
4
5
|
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
5
6
|
justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
6
7
|
divider?: boolean;
|
|
7
8
|
responsive?: boolean;
|
|
8
|
-
class?: string;
|
|
9
|
-
style?: string;
|
|
10
9
|
}
|
|
11
|
-
export interface
|
|
12
|
-
(index: number): string;
|
|
13
|
-
}
|
|
14
|
-
interface StackState extends BaseState {
|
|
10
|
+
export interface StackState extends BaseState {
|
|
15
11
|
spacing: string;
|
|
16
|
-
align
|
|
17
|
-
justify
|
|
12
|
+
align: string;
|
|
13
|
+
justify: string;
|
|
18
14
|
divider: boolean;
|
|
19
15
|
responsive: boolean;
|
|
20
|
-
children: Array<any>;
|
|
21
|
-
childStyles?: ChildStyleFunction | string[];
|
|
22
16
|
}
|
|
23
|
-
/**
|
|
24
|
-
* BaseStack - Foundation for all stack layout components
|
|
25
|
-
*/
|
|
26
17
|
export declare abstract class BaseStack extends BaseComponent<StackState> {
|
|
18
|
+
protected children: Record<string, any> | any[];
|
|
27
19
|
protected abstract baseClassName: string;
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
protected _container: HTMLElement | null;
|
|
21
|
+
protected _childStyleFunction: ((index: number) => string) | null;
|
|
30
22
|
constructor(id: string, children: Record<string, any> | any[], options?: StackOptions);
|
|
31
23
|
protected getTriggerEvents(): readonly string[];
|
|
32
24
|
protected getCallbackEvents(): readonly string[];
|
|
33
|
-
spacing(value: 'none' | 'tight' | '
|
|
25
|
+
spacing(value: 'none' | 'tight' | 'normal' | 'loose'): this;
|
|
34
26
|
align(value: 'start' | 'center' | 'end' | 'stretch'): this;
|
|
35
27
|
justify(value: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'): this;
|
|
36
|
-
divider(value
|
|
37
|
-
responsive(value
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
borderRadius(value: string): this;
|
|
44
|
-
width(value: string): this;
|
|
45
|
-
height(value: string): this;
|
|
46
|
-
minWidth(value: string): this;
|
|
47
|
-
maxWidth(value: string): this;
|
|
48
|
-
minHeight(value: string): this;
|
|
49
|
-
maxHeight(value: string): this;
|
|
50
|
-
background(value: string): this;
|
|
51
|
-
backgroundColor(value: string): this;
|
|
52
|
-
boxShadow(value: string): this;
|
|
53
|
-
opacity(value: string | number): this;
|
|
54
|
-
position(value: string): this;
|
|
55
|
-
top(value: string): this;
|
|
56
|
-
right(value: string): this;
|
|
57
|
-
bottom(value: string): this;
|
|
58
|
-
left(value: string): this;
|
|
59
|
-
zIndex(value: string | number): this;
|
|
60
|
-
overflow(value: string): this;
|
|
61
|
-
overflowX(value: string): this;
|
|
62
|
-
overflowY(value: string): this;
|
|
63
|
-
display(value: string): this;
|
|
64
|
-
cursor(value: string): this;
|
|
65
|
-
transform(value: string): this;
|
|
66
|
-
transformOrigin(value: string): this;
|
|
67
|
-
transition(value: string): this;
|
|
68
|
-
animation(value: string): this;
|
|
69
|
-
childStyle(stylesOrFunction: string[] | ChildStyleFunction): this;
|
|
70
|
-
cascade(baseOffset?: number, axis?: 'x' | 'y' | 'both' | 'horizontal' | 'vertical' | 'xy'): this;
|
|
71
|
-
fan(angle?: number, origin?: string): this;
|
|
72
|
-
scaleProgressive(startScale?: number, step?: number, origin?: string): this;
|
|
73
|
-
fade(startOpacity?: number, step?: number): this;
|
|
74
|
-
blur(startBlur?: number, step?: number): this;
|
|
75
|
-
stagger(baseDelay?: number): this;
|
|
28
|
+
divider(value: boolean): this;
|
|
29
|
+
responsive(value: boolean): this;
|
|
30
|
+
childStyle(fn: (index: number) => string): this;
|
|
31
|
+
protected getChildStyle(index: number): string;
|
|
32
|
+
fade(topOpacity?: number, step?: number): this;
|
|
33
|
+
cascade(offset?: number, direction?: 'horizontal' | 'vertical' | 'both'): this;
|
|
34
|
+
scaleProgressive(topScale?: number, step?: number): this;
|
|
76
35
|
fadeIn(): this;
|
|
77
36
|
slideIn(direction?: 'up' | 'down' | 'left' | 'right'): this;
|
|
78
37
|
scaleIn(): this;
|
|
@@ -113,9 +72,9 @@ export declare abstract class BaseStack extends BaseComponent<StackState> {
|
|
|
113
72
|
animateStagger(animation?: 'fade' | 'slide' | 'scale' | 'bounce', direction?: 'up' | 'down' | 'left' | 'right'): this;
|
|
114
73
|
protected buildClasses(): string;
|
|
115
74
|
protected renderChild(child: any, index: number): HTMLElement;
|
|
116
|
-
private getChildStyle;
|
|
117
75
|
render(targetId?: string | HTMLElement | BaseComponent<any>): this;
|
|
118
76
|
update(prop: string, value: any): void;
|
|
119
77
|
}
|
|
120
|
-
export {
|
|
78
|
+
export interface BaseStack extends LayoutExtensions {
|
|
79
|
+
}
|
|
121
80
|
//# sourceMappingURL=BaseStack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseStack.d.ts","sourceRoot":"","sources":["BaseStack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseStack.d.ts","sourceRoot":"","sources":["BaseStack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAyB,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAMtF,MAAM,WAAW,YAAY;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAChD,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACvB;AAED,8BAAsB,SAAU,SAAQ,aAAa,CAAC,UAAU,CAAC;IAKrC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE;IAJvE,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IACzC,SAAS,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI,CAAQ;IAChD,SAAS,CAAC,mBAAmB,EAAE,CAA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C,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW;IAkD7D,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;IA6BlE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;CAGzC;AAGD,MAAM,WAAW,SAAU,SAAQ,gBAAgB;CAAI"}
|
|
@@ -2,31 +2,25 @@ import { BaseComponent } from '../base/BaseComponent.js';
|
|
|
2
2
|
// Event definitions
|
|
3
3
|
const TRIGGER_EVENTS = [];
|
|
4
4
|
const CALLBACK_EVENTS = [];
|
|
5
|
-
/**
|
|
6
|
-
* BaseStack - Foundation for all stack layout components
|
|
7
|
-
*/
|
|
8
5
|
export class BaseStack extends BaseComponent {
|
|
9
6
|
constructor(id, children, options = {}) {
|
|
10
|
-
const childArray = Array.isArray(children)
|
|
11
|
-
? children
|
|
12
|
-
: Object.values(children);
|
|
13
7
|
super(id, {
|
|
14
8
|
visible: true,
|
|
15
9
|
disabled: false,
|
|
16
10
|
loading: false,
|
|
17
|
-
class:
|
|
18
|
-
style:
|
|
11
|
+
class: '',
|
|
12
|
+
style: '',
|
|
19
13
|
attributes: {},
|
|
20
|
-
spacing: options.spacing
|
|
21
|
-
align: options.align,
|
|
22
|
-
justify: options.justify,
|
|
23
|
-
divider: options.divider
|
|
24
|
-
responsive: options.responsive
|
|
25
|
-
children: childArray,
|
|
26
|
-
childStyles: undefined
|
|
14
|
+
spacing: options.spacing || 'normal',
|
|
15
|
+
align: options.align || 'start',
|
|
16
|
+
justify: options.justify || 'start',
|
|
17
|
+
divider: options.divider || false,
|
|
18
|
+
responsive: options.responsive || false
|
|
27
19
|
});
|
|
28
|
-
this.
|
|
29
|
-
this._container = null;
|
|
20
|
+
this.children = children;
|
|
21
|
+
this._container = null;
|
|
22
|
+
this._childStyleFunction = null;
|
|
23
|
+
// ✅ Layout extensions are automatically applied in BaseComponent constructor
|
|
30
24
|
}
|
|
31
25
|
getTriggerEvents() {
|
|
32
26
|
return TRIGGER_EVENTS;
|
|
@@ -39,130 +33,78 @@ export class BaseStack extends BaseComponent {
|
|
|
39
33
|
* ═════════════════════════════════════════════════════════════════ */
|
|
40
34
|
spacing(value) {
|
|
41
35
|
this.state.spacing = value;
|
|
36
|
+
if (this._container) {
|
|
37
|
+
this._container.className = this.buildClasses();
|
|
38
|
+
}
|
|
42
39
|
return this;
|
|
43
40
|
}
|
|
44
41
|
align(value) {
|
|
45
42
|
this.state.align = value;
|
|
43
|
+
if (this._container) {
|
|
44
|
+
this._container.className = this.buildClasses();
|
|
45
|
+
}
|
|
46
46
|
return this;
|
|
47
47
|
}
|
|
48
48
|
justify(value) {
|
|
49
49
|
this.state.justify = value;
|
|
50
|
+
if (this._container) {
|
|
51
|
+
this._container.className = this.buildClasses();
|
|
52
|
+
}
|
|
50
53
|
return this;
|
|
51
54
|
}
|
|
52
|
-
divider(value
|
|
55
|
+
divider(value) {
|
|
53
56
|
this.state.divider = value;
|
|
57
|
+
if (this._container) {
|
|
58
|
+
this._container.className = this.buildClasses();
|
|
59
|
+
}
|
|
54
60
|
return this;
|
|
55
61
|
}
|
|
56
|
-
responsive(value
|
|
62
|
+
responsive(value) {
|
|
57
63
|
this.state.responsive = value;
|
|
64
|
+
if (this._container) {
|
|
65
|
+
this._container.className = this.buildClasses();
|
|
66
|
+
}
|
|
58
67
|
return this;
|
|
59
68
|
}
|
|
60
69
|
/* ═════════════════════════════════════════════════════════════════
|
|
61
|
-
*
|
|
70
|
+
* CHILD STYLING
|
|
62
71
|
* ═════════════════════════════════════════════════════════════════ */
|
|
63
|
-
|
|
64
|
-
this.
|
|
65
|
-
this._updateStyleAttribute();
|
|
72
|
+
childStyle(fn) {
|
|
73
|
+
this._childStyleFunction = fn;
|
|
66
74
|
return this;
|
|
67
75
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
.join('; ');
|
|
72
|
-
this.state.style = styleString;
|
|
73
|
-
}
|
|
74
|
-
padding(value) { return this._addStyle('padding', value); }
|
|
75
|
-
margin(value) { return this._addStyle('margin', value); }
|
|
76
|
-
border(value) { return this._addStyle('border', value); }
|
|
77
|
-
borderRadius(value) { return this._addStyle('border-radius', value); }
|
|
78
|
-
width(value) { return this._addStyle('width', value); }
|
|
79
|
-
height(value) { return this._addStyle('height', value); }
|
|
80
|
-
minWidth(value) { return this._addStyle('min-width', value); }
|
|
81
|
-
maxWidth(value) { return this._addStyle('max-width', value); }
|
|
82
|
-
minHeight(value) { return this._addStyle('min-height', value); }
|
|
83
|
-
maxHeight(value) { return this._addStyle('max-height', value); }
|
|
84
|
-
background(value) { return this._addStyle('background', value); }
|
|
85
|
-
backgroundColor(value) { return this._addStyle('background-color', value); }
|
|
86
|
-
boxShadow(value) { return this._addStyle('box-shadow', value); }
|
|
87
|
-
opacity(value) { return this._addStyle('opacity', String(value)); }
|
|
88
|
-
position(value) { return this._addStyle('position', value); }
|
|
89
|
-
top(value) { return this._addStyle('top', value); }
|
|
90
|
-
right(value) { return this._addStyle('right', value); }
|
|
91
|
-
bottom(value) { return this._addStyle('bottom', value); }
|
|
92
|
-
left(value) { return this._addStyle('left', value); }
|
|
93
|
-
zIndex(value) { return this._addStyle('z-index', String(value)); }
|
|
94
|
-
overflow(value) { return this._addStyle('overflow', value); }
|
|
95
|
-
overflowX(value) { return this._addStyle('overflow-x', value); }
|
|
96
|
-
overflowY(value) { return this._addStyle('overflow-y', value); }
|
|
97
|
-
display(value) { return this._addStyle('display', value); }
|
|
98
|
-
cursor(value) { return this._addStyle('cursor', value); }
|
|
99
|
-
transform(value) { return this._addStyle('transform', value); }
|
|
100
|
-
transformOrigin(value) { return this._addStyle('transform-origin', value); }
|
|
101
|
-
transition(value) { return this._addStyle('transition', value); }
|
|
102
|
-
animation(value) { return this._addStyle('animation', value); }
|
|
76
|
+
getChildStyle(index) {
|
|
77
|
+
return this._childStyleFunction ? this._childStyleFunction(index) : '';
|
|
78
|
+
}
|
|
103
79
|
/* ═════════════════════════════════════════════════════════════════
|
|
104
|
-
*
|
|
80
|
+
* Z-STACK SPECIFIC EFFECTS
|
|
105
81
|
* ═════════════════════════════════════════════════════════════════ */
|
|
106
|
-
|
|
107
|
-
this.
|
|
82
|
+
fade(topOpacity = 1, step = 0.2) {
|
|
83
|
+
this._childStyleFunction = (index) => `opacity: ${Math.max(0, topOpacity - index * step)};`;
|
|
108
84
|
return this;
|
|
109
85
|
}
|
|
110
|
-
cascade(
|
|
111
|
-
this.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return `margin-left: ${offset}px;`;
|
|
86
|
+
cascade(offset = 20, direction = 'both') {
|
|
87
|
+
this._childStyleFunction = (index) => {
|
|
88
|
+
if (direction === 'horizontal') {
|
|
89
|
+
return `margin-left: ${index * offset}px;`;
|
|
115
90
|
}
|
|
116
|
-
else if (
|
|
117
|
-
return `margin-top: ${offset}px;`;
|
|
91
|
+
else if (direction === 'vertical') {
|
|
92
|
+
return `margin-top: ${index * offset}px;`;
|
|
118
93
|
}
|
|
119
94
|
else {
|
|
120
|
-
return `margin-left: ${offset}px; margin-top: ${offset}px;`;
|
|
95
|
+
return `margin-left: ${index * offset}px; margin-top: ${index * offset}px;`;
|
|
121
96
|
}
|
|
122
97
|
};
|
|
123
98
|
return this;
|
|
124
99
|
}
|
|
125
|
-
|
|
126
|
-
this.
|
|
127
|
-
const rotation = angle * index;
|
|
128
|
-
return `transform: rotate(${rotation}deg); transform-origin: ${origin};`;
|
|
129
|
-
};
|
|
130
|
-
return this;
|
|
131
|
-
}
|
|
132
|
-
scaleProgressive(startScale = 1, step = 0.05, origin = 'center') {
|
|
133
|
-
this.state.childStyles = (index) => {
|
|
134
|
-
const scale = startScale - (step * index);
|
|
135
|
-
return `transform: scale(${scale}); transform-origin: ${origin};`;
|
|
136
|
-
};
|
|
137
|
-
return this;
|
|
138
|
-
}
|
|
139
|
-
fade(startOpacity = 1, step = 0.15) {
|
|
140
|
-
this.state.childStyles = (index) => {
|
|
141
|
-
const opacity = Math.max(0.1, startOpacity - (step * index));
|
|
142
|
-
return `opacity: ${opacity};`;
|
|
143
|
-
};
|
|
144
|
-
return this;
|
|
145
|
-
}
|
|
146
|
-
blur(startBlur = 0, step = 2) {
|
|
147
|
-
this.state.childStyles = (index) => {
|
|
148
|
-
const blur = startBlur + (step * index);
|
|
149
|
-
return `filter: blur(${blur}px);`;
|
|
150
|
-
};
|
|
151
|
-
return this;
|
|
152
|
-
}
|
|
153
|
-
stagger(baseDelay = 100) {
|
|
154
|
-
this.state.childStyles = (index) => {
|
|
155
|
-
const delay = baseDelay * index;
|
|
156
|
-
return `animation-delay: ${delay}ms;`;
|
|
157
|
-
};
|
|
100
|
+
scaleProgressive(topScale = 1, step = 0.1) {
|
|
101
|
+
this._childStyleFunction = (index) => `transform: scale(${Math.max(0.1, topScale - index * step)});`;
|
|
158
102
|
return this;
|
|
159
103
|
}
|
|
160
104
|
/* ═════════════════════════════════════════════════════════════════
|
|
161
105
|
* ANIMATION API (Fluent)
|
|
162
106
|
* ═════════════════════════════════════════════════════════════════ */
|
|
163
|
-
/*
|
|
164
|
-
* Stack-Level Animations (Animate the container)
|
|
165
|
-
* ───────────────────────────────────────────────────────────────── */
|
|
107
|
+
/* Stack-Level Animations */
|
|
166
108
|
fadeIn() {
|
|
167
109
|
return this.addClass('jux-stack-fade-in');
|
|
168
110
|
}
|
|
@@ -193,9 +135,7 @@ export class BaseStack extends BaseComponent {
|
|
|
193
135
|
glow() {
|
|
194
136
|
return this.addClass('jux-stack-glow');
|
|
195
137
|
}
|
|
196
|
-
/*
|
|
197
|
-
* Item-Level Animations (Animate the children)
|
|
198
|
-
* ───────────────────────────────────────────────────────────────── */
|
|
138
|
+
/* Item-Level Animations */
|
|
199
139
|
fadeInItems() {
|
|
200
140
|
return this.addClass('jux-stack-fade-in-items');
|
|
201
141
|
}
|
|
@@ -226,9 +166,7 @@ export class BaseStack extends BaseComponent {
|
|
|
226
166
|
glowItems() {
|
|
227
167
|
return this.addClass('jux-stack-glow-items');
|
|
228
168
|
}
|
|
229
|
-
/*
|
|
230
|
-
* Speed Modifiers (Control animation duration)
|
|
231
|
-
* ───────────────────────────────────────────────────────────────── */
|
|
169
|
+
/* Speed Modifiers */
|
|
232
170
|
instant() {
|
|
233
171
|
return this.addClass('jux-stack-instant');
|
|
234
172
|
}
|
|
@@ -244,9 +182,7 @@ export class BaseStack extends BaseComponent {
|
|
|
244
182
|
slower() {
|
|
245
183
|
return this.addClass('jux-stack-slower');
|
|
246
184
|
}
|
|
247
|
-
/*
|
|
248
|
-
* Timing Functions (Control animation easing)
|
|
249
|
-
* ───────────────────────────────────────────────────────────────── */
|
|
185
|
+
/* Timing Functions */
|
|
250
186
|
linear() {
|
|
251
187
|
return this.addClass('jux-stack-linear');
|
|
252
188
|
}
|
|
@@ -268,15 +204,11 @@ export class BaseStack extends BaseComponent {
|
|
|
268
204
|
elasticTiming() {
|
|
269
205
|
return this.addClass('jux-stack-elastic-timing');
|
|
270
206
|
}
|
|
271
|
-
/*
|
|
272
|
-
* Delay Control
|
|
273
|
-
* ───────────────────────────────────────────────────────────────── */
|
|
207
|
+
/* Delay Control */
|
|
274
208
|
delay(ms) {
|
|
275
209
|
return this.addClass(`jux-stack-delay-${ms}`);
|
|
276
210
|
}
|
|
277
|
-
/*
|
|
278
|
-
* Stagger & Interactive
|
|
279
|
-
* ───────────────────────────────────────────────────────────────── */
|
|
211
|
+
/* Stagger & Interactive */
|
|
280
212
|
staggered() {
|
|
281
213
|
return this.addClass('jux-stack-stagger');
|
|
282
214
|
}
|
|
@@ -289,9 +221,7 @@ export class BaseStack extends BaseComponent {
|
|
|
289
221
|
smoothItems() {
|
|
290
222
|
return this.addClass('jux-stack-smooth-items');
|
|
291
223
|
}
|
|
292
|
-
/*
|
|
293
|
-
* Convenience Combos
|
|
294
|
-
* ───────────────────────────────────────────────────────────────── */
|
|
224
|
+
/* Convenience Combos */
|
|
295
225
|
animateStagger(animation = 'fade', direction) {
|
|
296
226
|
if (animation === 'slide' && direction) {
|
|
297
227
|
this.slideIn(direction);
|
|
@@ -308,18 +238,18 @@ export class BaseStack extends BaseComponent {
|
|
|
308
238
|
return this.staggered();
|
|
309
239
|
}
|
|
310
240
|
/* ═════════════════════════════════════════════════════════════════
|
|
311
|
-
* RENDER
|
|
241
|
+
* RENDER
|
|
312
242
|
* ═════════════════════════════════════════════════════════════════ */
|
|
313
243
|
buildClasses() {
|
|
314
|
-
const { spacing, align, justify, divider, responsive } = this.state;
|
|
244
|
+
const { spacing, align, justify, divider, responsive, class: userClass } = this.state;
|
|
315
245
|
const classes = [this.baseClassName];
|
|
316
|
-
if (spacing !== '
|
|
246
|
+
if (spacing !== 'normal') {
|
|
317
247
|
classes.push(`${this.baseClassName}-${spacing}`);
|
|
318
248
|
}
|
|
319
|
-
if (align) {
|
|
249
|
+
if (align !== 'start') {
|
|
320
250
|
classes.push(`jux-stack-${align}`);
|
|
321
251
|
}
|
|
322
|
-
if (justify) {
|
|
252
|
+
if (justify !== 'start') {
|
|
323
253
|
classes.push(`jux-stack-justify-${justify}`);
|
|
324
254
|
}
|
|
325
255
|
if (divider) {
|
|
@@ -328,8 +258,8 @@ export class BaseStack extends BaseComponent {
|
|
|
328
258
|
if (responsive) {
|
|
329
259
|
classes.push(`${this.baseClassName}-responsive`);
|
|
330
260
|
}
|
|
331
|
-
if (
|
|
332
|
-
classes.push(
|
|
261
|
+
if (userClass) {
|
|
262
|
+
classes.push(userClass);
|
|
333
263
|
}
|
|
334
264
|
return classes.join(' ');
|
|
335
265
|
}
|
|
@@ -339,12 +269,12 @@ export class BaseStack extends BaseComponent {
|
|
|
339
269
|
if (child && typeof child === 'object' && '_container' in child && child._container instanceof HTMLElement) {
|
|
340
270
|
childElement = child._container;
|
|
341
271
|
}
|
|
342
|
-
// ✅ Priority 2: Check if it's a JUX Component (has render method
|
|
272
|
+
// ✅ Priority 2: Check if it's a JUX Component (has render method)
|
|
343
273
|
else if (child && typeof child === 'object' && typeof child.render === 'function') {
|
|
344
274
|
// Create temporary container to render into
|
|
345
275
|
const tempContainer = document.createElement('div');
|
|
346
|
-
tempContainer.style.display = 'contents';
|
|
347
|
-
// Render the component
|
|
276
|
+
tempContainer.style.display = 'contents';
|
|
277
|
+
// Render the component
|
|
348
278
|
child.render(tempContainer);
|
|
349
279
|
// Extract the rendered element
|
|
350
280
|
if (child.container && child.container.firstElementChild) {
|
|
@@ -357,7 +287,7 @@ export class BaseStack extends BaseComponent {
|
|
|
357
287
|
childElement = tempContainer;
|
|
358
288
|
}
|
|
359
289
|
}
|
|
360
|
-
// ✅ Priority 3:
|
|
290
|
+
// ✅ Priority 3: Already a DOM element
|
|
361
291
|
else if (child instanceof HTMLElement) {
|
|
362
292
|
childElement = child;
|
|
363
293
|
}
|
|
@@ -379,41 +309,28 @@ export class BaseStack extends BaseComponent {
|
|
|
379
309
|
}
|
|
380
310
|
return childElement;
|
|
381
311
|
}
|
|
382
|
-
getChildStyle(index) {
|
|
383
|
-
const { childStyles } = this.state;
|
|
384
|
-
if (!childStyles)
|
|
385
|
-
return '';
|
|
386
|
-
if (typeof childStyles === 'function') {
|
|
387
|
-
return childStyles(index);
|
|
388
|
-
}
|
|
389
|
-
if (Array.isArray(childStyles)) {
|
|
390
|
-
return childStyles[index] || '';
|
|
391
|
-
}
|
|
392
|
-
return '';
|
|
393
|
-
}
|
|
394
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
395
|
-
* RENDER
|
|
396
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
397
312
|
render(targetId) {
|
|
398
313
|
const container = this._setupContainer(targetId);
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
|
|
314
|
+
const stackDiv = document.createElement('div');
|
|
315
|
+
stackDiv.id = this._id;
|
|
316
|
+
stackDiv.className = this.buildClasses();
|
|
402
317
|
if (this.state.style) {
|
|
403
|
-
|
|
318
|
+
stackDiv.setAttribute('style', this.state.style);
|
|
404
319
|
}
|
|
405
|
-
//
|
|
406
|
-
this.
|
|
320
|
+
// Handle both array and object children
|
|
321
|
+
const childArray = Array.isArray(this.children)
|
|
322
|
+
? this.children
|
|
323
|
+
: Object.values(this.children);
|
|
324
|
+
childArray.forEach((child, index) => {
|
|
407
325
|
const childEl = this.renderChild(child, index);
|
|
408
|
-
|
|
326
|
+
stackDiv.appendChild(childEl);
|
|
409
327
|
});
|
|
410
|
-
this._wireStandardEvents(
|
|
411
|
-
|
|
412
|
-
this._container =
|
|
413
|
-
container.appendChild(wrapper);
|
|
328
|
+
this._wireStandardEvents(stackDiv);
|
|
329
|
+
container.appendChild(stackDiv);
|
|
330
|
+
this._container = stackDiv;
|
|
414
331
|
return this;
|
|
415
332
|
}
|
|
416
333
|
update(prop, value) {
|
|
417
|
-
//
|
|
334
|
+
// Stacks don't need reactive updates
|
|
418
335
|
}
|
|
419
336
|
}
|