juxscript 1.1.107 → 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 +31 -62
- package/lib/components/stack/BaseStack.d.ts.map +1 -1
- package/lib/components/stack/BaseStack.js +117 -147
- package/lib/components/stack/BaseStack.ts +140 -177
- package/lib/styles/{stack.css → animations.css} +74 -235
- 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;
|
|
@@ -93,19 +52,29 @@ export declare abstract class BaseStack extends BaseComponent<StackState> {
|
|
|
93
52
|
elasticInItems(): this;
|
|
94
53
|
blurInItems(): this;
|
|
95
54
|
glowItems(): this;
|
|
55
|
+
instant(): this;
|
|
56
|
+
fast(): this;
|
|
57
|
+
normal(): this;
|
|
58
|
+
slow(): this;
|
|
59
|
+
slower(): this;
|
|
60
|
+
linear(): this;
|
|
61
|
+
ease(): this;
|
|
62
|
+
easeIn(): this;
|
|
63
|
+
easeOut(): this;
|
|
64
|
+
easeInOut(): this;
|
|
65
|
+
bounceTiming(): this;
|
|
66
|
+
elasticTiming(): this;
|
|
67
|
+
delay(ms: 100 | 200 | 300 | 500 | 1000): this;
|
|
96
68
|
staggered(): this;
|
|
97
69
|
interactive(): this;
|
|
98
70
|
smooth(): this;
|
|
99
71
|
smoothItems(): this;
|
|
100
|
-
/**
|
|
101
|
-
* Combine animation with stagger
|
|
102
|
-
*/
|
|
103
72
|
animateStagger(animation?: 'fade' | 'slide' | 'scale' | 'bounce', direction?: 'up' | 'down' | 'left' | 'right'): this;
|
|
104
73
|
protected buildClasses(): string;
|
|
105
74
|
protected renderChild(child: any, index: number): HTMLElement;
|
|
106
|
-
private getChildStyle;
|
|
107
75
|
render(targetId?: string | HTMLElement | BaseComponent<any>): this;
|
|
108
76
|
update(prop: string, value: any): void;
|
|
109
77
|
}
|
|
110
|
-
export {
|
|
78
|
+
export interface BaseStack extends LayoutExtensions {
|
|
79
|
+
}
|
|
111
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,OA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AM,IAAI,IAAI;IAId,OAAO,IAAI,IAAI;IAIf,SAAS,IAAI,IAAI;IAIjB,YAAY,IAAI,IAAI;IAIpB,aAAa,IAAI,IAAI;IAKrB,KAAK,CAAC,EAAE,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI;IAK7C,SAAS,IAAI,IAAI;IAIjB,WAAW,IAAI,IAAI;IAInB,MAAM,IAAI,IAAI;IAId,WAAW,IAAI,IAAI;IAKnB,cAAc,CAAC,SAAS,GAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,QAAiB,EAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI;IAiB7H,SAAS,CAAC,YAAY,IAAI,MAAM;IAgChC,SAAS,CAAC,WAAW,CAAC,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,128 +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
|
-
/* Stack-Level Animations
|
|
107
|
+
/* Stack-Level Animations */
|
|
164
108
|
fadeIn() {
|
|
165
109
|
return this.addClass('jux-stack-fade-in');
|
|
166
110
|
}
|
|
@@ -191,7 +135,7 @@ export class BaseStack extends BaseComponent {
|
|
|
191
135
|
glow() {
|
|
192
136
|
return this.addClass('jux-stack-glow');
|
|
193
137
|
}
|
|
194
|
-
/* Item-Level Animations
|
|
138
|
+
/* Item-Level Animations */
|
|
195
139
|
fadeInItems() {
|
|
196
140
|
return this.addClass('jux-stack-fade-in-items');
|
|
197
141
|
}
|
|
@@ -222,11 +166,52 @@ export class BaseStack extends BaseComponent {
|
|
|
222
166
|
glowItems() {
|
|
223
167
|
return this.addClass('jux-stack-glow-items');
|
|
224
168
|
}
|
|
225
|
-
/*
|
|
169
|
+
/* Speed Modifiers */
|
|
170
|
+
instant() {
|
|
171
|
+
return this.addClass('jux-stack-instant');
|
|
172
|
+
}
|
|
173
|
+
fast() {
|
|
174
|
+
return this.addClass('jux-stack-fast');
|
|
175
|
+
}
|
|
176
|
+
normal() {
|
|
177
|
+
return this.addClass('jux-stack-normal');
|
|
178
|
+
}
|
|
179
|
+
slow() {
|
|
180
|
+
return this.addClass('jux-stack-slow');
|
|
181
|
+
}
|
|
182
|
+
slower() {
|
|
183
|
+
return this.addClass('jux-stack-slower');
|
|
184
|
+
}
|
|
185
|
+
/* Timing Functions */
|
|
186
|
+
linear() {
|
|
187
|
+
return this.addClass('jux-stack-linear');
|
|
188
|
+
}
|
|
189
|
+
ease() {
|
|
190
|
+
return this.addClass('jux-stack-ease');
|
|
191
|
+
}
|
|
192
|
+
easeIn() {
|
|
193
|
+
return this.addClass('jux-stack-ease-in');
|
|
194
|
+
}
|
|
195
|
+
easeOut() {
|
|
196
|
+
return this.addClass('jux-stack-ease-out');
|
|
197
|
+
}
|
|
198
|
+
easeInOut() {
|
|
199
|
+
return this.addClass('jux-stack-ease-in-out');
|
|
200
|
+
}
|
|
201
|
+
bounceTiming() {
|
|
202
|
+
return this.addClass('jux-stack-bounce-timing');
|
|
203
|
+
}
|
|
204
|
+
elasticTiming() {
|
|
205
|
+
return this.addClass('jux-stack-elastic-timing');
|
|
206
|
+
}
|
|
207
|
+
/* Delay Control */
|
|
208
|
+
delay(ms) {
|
|
209
|
+
return this.addClass(`jux-stack-delay-${ms}`);
|
|
210
|
+
}
|
|
211
|
+
/* Stagger & Interactive */
|
|
226
212
|
staggered() {
|
|
227
213
|
return this.addClass('jux-stack-stagger');
|
|
228
214
|
}
|
|
229
|
-
/* Interactive & Utility */
|
|
230
215
|
interactive() {
|
|
231
216
|
return this.addClass('jux-stack-interactive');
|
|
232
217
|
}
|
|
@@ -236,9 +221,7 @@ export class BaseStack extends BaseComponent {
|
|
|
236
221
|
smoothItems() {
|
|
237
222
|
return this.addClass('jux-stack-smooth-items');
|
|
238
223
|
}
|
|
239
|
-
|
|
240
|
-
* Combine animation with stagger
|
|
241
|
-
*/
|
|
224
|
+
/* Convenience Combos */
|
|
242
225
|
animateStagger(animation = 'fade', direction) {
|
|
243
226
|
if (animation === 'slide' && direction) {
|
|
244
227
|
this.slideIn(direction);
|
|
@@ -255,18 +238,18 @@ export class BaseStack extends BaseComponent {
|
|
|
255
238
|
return this.staggered();
|
|
256
239
|
}
|
|
257
240
|
/* ═════════════════════════════════════════════════════════════════
|
|
258
|
-
* RENDER
|
|
241
|
+
* RENDER
|
|
259
242
|
* ═════════════════════════════════════════════════════════════════ */
|
|
260
243
|
buildClasses() {
|
|
261
|
-
const { spacing, align, justify, divider, responsive } = this.state;
|
|
244
|
+
const { spacing, align, justify, divider, responsive, class: userClass } = this.state;
|
|
262
245
|
const classes = [this.baseClassName];
|
|
263
|
-
if (spacing !== '
|
|
246
|
+
if (spacing !== 'normal') {
|
|
264
247
|
classes.push(`${this.baseClassName}-${spacing}`);
|
|
265
248
|
}
|
|
266
|
-
if (align) {
|
|
249
|
+
if (align !== 'start') {
|
|
267
250
|
classes.push(`jux-stack-${align}`);
|
|
268
251
|
}
|
|
269
|
-
if (justify) {
|
|
252
|
+
if (justify !== 'start') {
|
|
270
253
|
classes.push(`jux-stack-justify-${justify}`);
|
|
271
254
|
}
|
|
272
255
|
if (divider) {
|
|
@@ -275,8 +258,8 @@ export class BaseStack extends BaseComponent {
|
|
|
275
258
|
if (responsive) {
|
|
276
259
|
classes.push(`${this.baseClassName}-responsive`);
|
|
277
260
|
}
|
|
278
|
-
if (
|
|
279
|
-
classes.push(
|
|
261
|
+
if (userClass) {
|
|
262
|
+
classes.push(userClass);
|
|
280
263
|
}
|
|
281
264
|
return classes.join(' ');
|
|
282
265
|
}
|
|
@@ -286,12 +269,12 @@ export class BaseStack extends BaseComponent {
|
|
|
286
269
|
if (child && typeof child === 'object' && '_container' in child && child._container instanceof HTMLElement) {
|
|
287
270
|
childElement = child._container;
|
|
288
271
|
}
|
|
289
|
-
// ✅ 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)
|
|
290
273
|
else if (child && typeof child === 'object' && typeof child.render === 'function') {
|
|
291
274
|
// Create temporary container to render into
|
|
292
275
|
const tempContainer = document.createElement('div');
|
|
293
|
-
tempContainer.style.display = 'contents';
|
|
294
|
-
// Render the component
|
|
276
|
+
tempContainer.style.display = 'contents';
|
|
277
|
+
// Render the component
|
|
295
278
|
child.render(tempContainer);
|
|
296
279
|
// Extract the rendered element
|
|
297
280
|
if (child.container && child.container.firstElementChild) {
|
|
@@ -304,7 +287,7 @@ export class BaseStack extends BaseComponent {
|
|
|
304
287
|
childElement = tempContainer;
|
|
305
288
|
}
|
|
306
289
|
}
|
|
307
|
-
// ✅ Priority 3:
|
|
290
|
+
// ✅ Priority 3: Already a DOM element
|
|
308
291
|
else if (child instanceof HTMLElement) {
|
|
309
292
|
childElement = child;
|
|
310
293
|
}
|
|
@@ -326,41 +309,28 @@ export class BaseStack extends BaseComponent {
|
|
|
326
309
|
}
|
|
327
310
|
return childElement;
|
|
328
311
|
}
|
|
329
|
-
getChildStyle(index) {
|
|
330
|
-
const { childStyles } = this.state;
|
|
331
|
-
if (!childStyles)
|
|
332
|
-
return '';
|
|
333
|
-
if (typeof childStyles === 'function') {
|
|
334
|
-
return childStyles(index);
|
|
335
|
-
}
|
|
336
|
-
if (Array.isArray(childStyles)) {
|
|
337
|
-
return childStyles[index] || '';
|
|
338
|
-
}
|
|
339
|
-
return '';
|
|
340
|
-
}
|
|
341
|
-
/* ═════════════════════════════════════════════════════════════════
|
|
342
|
-
* RENDER
|
|
343
|
-
* ═════════════════════════════════════════════════════════════════ */
|
|
344
312
|
render(targetId) {
|
|
345
313
|
const container = this._setupContainer(targetId);
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
|
|
314
|
+
const stackDiv = document.createElement('div');
|
|
315
|
+
stackDiv.id = this._id;
|
|
316
|
+
stackDiv.className = this.buildClasses();
|
|
349
317
|
if (this.state.style) {
|
|
350
|
-
|
|
318
|
+
stackDiv.setAttribute('style', this.state.style);
|
|
351
319
|
}
|
|
352
|
-
//
|
|
353
|
-
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) => {
|
|
354
325
|
const childEl = this.renderChild(child, index);
|
|
355
|
-
|
|
326
|
+
stackDiv.appendChild(childEl);
|
|
356
327
|
});
|
|
357
|
-
this._wireStandardEvents(
|
|
358
|
-
|
|
359
|
-
this._container =
|
|
360
|
-
container.appendChild(wrapper);
|
|
328
|
+
this._wireStandardEvents(stackDiv);
|
|
329
|
+
container.appendChild(stackDiv);
|
|
330
|
+
this._container = stackDiv;
|
|
361
331
|
return this;
|
|
362
332
|
}
|
|
363
333
|
update(prop, value) {
|
|
364
|
-
//
|
|
334
|
+
// Stacks don't need reactive updates
|
|
365
335
|
}
|
|
366
336
|
}
|