@bravostudioai/react 0.1.17 → 0.1.22
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/dist/cli/commands/generate.js +144 -129
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/components/DynamicComponent.js.map +1 -1
- package/dist/components/EncoreApp.js +41 -38
- package/dist/components/EncoreApp.js.map +1 -1
- package/dist/components/EncoreErrorBoundary.js.map +1 -1
- package/dist/components/EncoreLoadingFallback.js.map +1 -1
- package/dist/components.js +343 -336
- package/dist/components.js.map +1 -1
- package/dist/contexts/EncoreActionContext.js +3 -3
- package/dist/contexts/EncoreActionContext.js.map +1 -1
- package/dist/contexts/EncoreAppContext.js +2 -2
- package/dist/contexts/EncoreAppContext.js.map +1 -1
- package/dist/contexts/EncoreBindingContext.js +2 -2
- package/dist/contexts/EncoreBindingContext.js.map +1 -1
- package/dist/contexts/EncoreComponentIdContext.js +3 -5
- package/dist/contexts/EncoreComponentIdContext.js.map +1 -1
- package/dist/contexts/EncoreRepeatingContainerContext.js +2 -2
- package/dist/contexts/EncoreRepeatingContainerContext.js.map +1 -1
- package/dist/contexts/EncoreRouterContext.js +2 -2
- package/dist/contexts/EncoreRouterContext.js.map +1 -1
- package/dist/hooks/usePusherUpdates.js.map +1 -1
- package/dist/index.js +33 -30
- package/dist/index.js.map +1 -1
- package/dist/lib/fetcher.js +22 -17
- package/dist/lib/fetcher.js.map +1 -1
- package/dist/packages/encore-lib/package.json.js +8 -0
- package/dist/packages/encore-lib/package.json.js.map +1 -0
- package/dist/src/cli/commands/generate.d.ts.map +1 -1
- package/dist/src/components/DynamicComponent.d.ts.map +1 -1
- package/dist/src/components/EncoreApp.d.ts.map +1 -1
- package/dist/src/components/EncoreErrorBoundary.d.ts.map +1 -1
- package/dist/src/components/EncoreLoadingFallback.d.ts.map +1 -1
- package/dist/src/components.d.ts.map +1 -1
- package/dist/src/contexts/EncoreActionContext.d.ts +1 -2
- package/dist/src/contexts/EncoreActionContext.d.ts.map +1 -1
- package/dist/src/contexts/EncoreAppContext.d.ts +1 -2
- package/dist/src/contexts/EncoreAppContext.d.ts.map +1 -1
- package/dist/src/contexts/EncoreBindingContext.d.ts +1 -2
- package/dist/src/contexts/EncoreBindingContext.d.ts.map +1 -1
- package/dist/src/contexts/EncoreComponentIdContext.d.ts +1 -2
- package/dist/src/contexts/EncoreComponentIdContext.d.ts.map +1 -1
- package/dist/src/contexts/EncoreRepeatingContainerContext.d.ts +1 -2
- package/dist/src/contexts/EncoreRepeatingContainerContext.d.ts.map +1 -1
- package/dist/src/contexts/EncoreRouterContext.d.ts +1 -2
- package/dist/src/contexts/EncoreRouterContext.d.ts.map +1 -1
- package/dist/src/hooks/useAuthRedirect.d.ts.map +1 -1
- package/dist/src/hooks/usePusherUpdates.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/lib/fetcher.d.ts.map +1 -1
- package/dist/src/stores/useEncoreState.d.ts.map +1 -1
- package/dist/stores/useEncoreState.js.map +1 -1
- package/package.json +1 -1
- package/src/components/DynamicComponent.tsx +1 -0
- package/src/components/EncoreApp.tsx +3 -1
- package/src/components/EncoreErrorBoundary.tsx +36 -35
- package/src/components/EncoreLoadingFallback.tsx +19 -18
- package/src/components.tsx +35 -34
- package/src/contexts/EncoreActionContext.ts +4 -2
- package/src/contexts/EncoreAppContext.ts +4 -2
- package/src/contexts/EncoreBindingContext.ts +4 -2
- package/src/contexts/EncoreComponentIdContext.ts +4 -4
- package/src/contexts/EncoreRepeatingContainerContext.ts +4 -3
- package/src/contexts/EncoreRouterContext.ts +4 -2
- package/src/hooks/useAuthRedirect.ts +2 -0
- package/src/hooks/usePusherUpdates.ts +2 -0
- package/src/index.ts +6 -0
- package/src/stores/useEncoreState.ts +2 -0
package/dist/components.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as p, jsxs as it, Fragment as ut } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import x, { useContext as N, useMemo as Ht, useState as Vt, useCallback as Nt } from "react";
|
|
3
3
|
import tt from "./contexts/EncoreBindingContext.js";
|
|
4
4
|
import k from "./stores/useEncoreState.js";
|
|
5
5
|
import lt from "./contexts/EncoreComponentIdContext.js";
|
|
6
6
|
import Ot from "axios";
|
|
7
|
-
import
|
|
7
|
+
import ft from "./contexts/EncoreActionContext.js";
|
|
8
8
|
import Mt from "./contexts/EncoreRepeatingContainerContext.js";
|
|
9
|
-
const ct =
|
|
9
|
+
const ct = x.createContext({}), V = x.createContext(
|
|
10
10
|
{}
|
|
11
11
|
), st = (t) => t.replace(/#(\w{2})(\w{6})/, "#$2$1"), Gt = (t) => t.slice(1, 3) === "00", jt = (t) => {
|
|
12
12
|
if (!Array.isArray(t)) return null;
|
|
@@ -15,8 +15,8 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
15
15
|
const e = r.split(":");
|
|
16
16
|
return e.length >= 3 ? { type: e[1], groupName: e[2] } : null;
|
|
17
17
|
}, rt = () => {
|
|
18
|
-
const [t, r] = Vt({ width: 0, height: 0 }), e =
|
|
19
|
-
return
|
|
18
|
+
const [t, r] = Vt({ width: 0, height: 0 }), e = x.useRef(null);
|
|
19
|
+
return x.useEffect(() => {
|
|
20
20
|
if (!e.current) return;
|
|
21
21
|
const o = e.current, i = () => {
|
|
22
22
|
const { width: n, height: m } = o.getBoundingClientRect();
|
|
@@ -27,8 +27,8 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
27
27
|
});
|
|
28
28
|
const l = new ResizeObserver((n) => {
|
|
29
29
|
for (const m of n) {
|
|
30
|
-
const
|
|
31
|
-
r({ width:
|
|
30
|
+
const a = m.contentRect;
|
|
31
|
+
r({ width: a.width, height: a.height });
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
return l.observe(o), () => l.disconnect();
|
|
@@ -38,56 +38,52 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
38
38
|
width: window.innerWidth,
|
|
39
39
|
height: window.innerHeight
|
|
40
40
|
}, l = Nt(
|
|
41
|
-
(
|
|
41
|
+
(s) => (o.dimensions?.width ?? 0) * 0.01 * s,
|
|
42
42
|
[o.dimensions?.width]
|
|
43
43
|
), n = {};
|
|
44
44
|
r = { debug: !1, ...r };
|
|
45
|
-
const m = k((
|
|
46
|
-
if (k((
|
|
47
|
-
const
|
|
48
|
-
if (t.layout?.layoutSizingHorizontal || t.layout?.layoutSizingVertical || (t.width &&
|
|
49
|
-
const
|
|
45
|
+
const m = k((s) => s.fontsById || {});
|
|
46
|
+
if (k((s) => s.fontsByIdFull || {}), !t || !t) return;
|
|
47
|
+
const a = o.dimensions?.width ?? i.width, y = o.dimensions?.height ?? i.height;
|
|
48
|
+
if (t.layout?.layoutSizingHorizontal || t.layout?.layoutSizingVertical || (t.width && a > 0 && (n.width = t.width * a * 0.01), t.aspectRatio && t.width ? a > 0 && (n.height = t.width * a * 0.01 / t.aspectRatio) : t.height && y > 0 && (n.height = t.height * y * 0.01)), !(o?.isFlex ?? !1) && t.positioning) {
|
|
49
|
+
const s = t.layout?.layoutSizingHorizontal === "FIXED" || t.layout?.layoutSizingVertical === "FIXED", u = s && t.positioning.top < 0 ? 0 : t.positioning.top, R = s && t.positioning.left < 0 ? 0 : t.positioning.left;
|
|
50
50
|
let w = !1;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
S && typeof S == "number" && S > 0 && f / S >= 0.95 && R >= 15 && R <= 35 && (w = !0);
|
|
54
|
-
}
|
|
55
|
-
n.top = `${u}%`;
|
|
56
|
-
const x = !!t.inset;
|
|
51
|
+
t.horizontalPosition === "center" && (w = !0), n.top = `${u}%`;
|
|
52
|
+
const S = !!t.inset;
|
|
57
53
|
if (w) {
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
|
|
54
|
+
if (S) {
|
|
55
|
+
const W = String(t.inset).split(/\s+/);
|
|
56
|
+
W.length === 3 ? n.inset = `${W[0]} 50% ${W[2]} auto` : W.length === 4 && (n.inset = `${W[0]} 50% ${W[2]} auto`), delete n.left, delete n.right;
|
|
61
57
|
} else
|
|
62
58
|
n.left = "50%", n.right = "auto";
|
|
63
59
|
n.transform = "translateX(-50%)";
|
|
64
60
|
} else
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
S ? n.inset = t.inset : n.left = `${R}%`;
|
|
62
|
+
s ? (n.right = "auto", n.bottom = "auto") : (t.positioning.bottom !== void 0 && (n.bottom = `${t.positioning.bottom}%`), t.positioning.right !== void 0 && (n.right = `${t.positioning.right}%`)), n.position = "absolute";
|
|
67
63
|
}
|
|
68
64
|
if (t.layout?.padding) {
|
|
69
|
-
const
|
|
70
|
-
u.top !== void 0 && (n.paddingTop = u.top *
|
|
65
|
+
const s = e.scaleFactor ?? 1, u = t.layout.padding;
|
|
66
|
+
u.top !== void 0 && (n.paddingTop = u.top * s), u.right !== void 0 && (n.paddingRight = u.right * s), u.bottom !== void 0 && (n.paddingBottom = u.bottom * s), u.left !== void 0 && (n.paddingLeft = u.left * s);
|
|
71
67
|
}
|
|
72
68
|
if (t.layout?.mode) {
|
|
73
69
|
n.display = "flex";
|
|
74
|
-
const
|
|
70
|
+
const s = (W) => W ? {
|
|
75
71
|
MIN: "flex-start",
|
|
76
72
|
MAX: "flex-end",
|
|
77
73
|
CENTER: "center",
|
|
78
74
|
SPACE_BETWEEN: "space-between",
|
|
79
75
|
SPACE_AROUND: "space-around",
|
|
80
76
|
SPACE_EVENLY: "space-evenly"
|
|
81
|
-
}[
|
|
82
|
-
t.layout.mode == "HORIZONTAL" ? (n.flexDirection = "row", t.layout.flexWrap && (n.flexWrap = t.layout.flexWrap), n.justifyContent =
|
|
77
|
+
}[W] || W.toLowerCase().replace(/_/g, "-") : void 0;
|
|
78
|
+
t.layout.mode == "HORIZONTAL" ? (n.flexDirection = "row", t.layout.flexWrap && (n.flexWrap = t.layout.flexWrap), n.justifyContent = s(
|
|
83
79
|
t.layout.primaryAxisAlignItems
|
|
84
|
-
), n.alignItems = t.layout.counterAxisAlignItems) : (n.flexDirection = "column", n.justifyContent =
|
|
80
|
+
), n.alignItems = t.layout.counterAxisAlignItems) : (n.flexDirection = "column", n.justifyContent = s(
|
|
85
81
|
t.layout.primaryAxisAlignItems
|
|
86
|
-
), n.alignItems = t.layout.counterAxisAlignItems), n.flexGrow = t.layout.grow, t.layout.wrap === "
|
|
87
|
-
const u = t.layout.itemSpacing, R = e.scaleFactor ?? 1,
|
|
88
|
-
n.gap =
|
|
82
|
+
), n.alignItems = t.layout.counterAxisAlignItems), n.flexGrow = t.layout.grow, t.layout.wrap === "WRAP" || t.layout.flexWrap === "wrap" ? n.flexWrap = "wrap" : t.layout.flexWrap ? n.flexWrap = t.layout.flexWrap : n.flexWrap = "nowrap";
|
|
83
|
+
const u = t.layout.itemSpacing, R = e.scaleFactor ?? 1, S = t.layout.primaryAxisAlignItems === "SPACE_BETWEEN" ? 0 : (u !== void 0 ? u : 0) * R;
|
|
84
|
+
n.gap = S === 0 ? "0px" : `${S}px`, n.rowGap = S === 0 ? "0px" : `${S}px`, n.columnGap = S === 0 ? "0px" : `${S}px`, (n.flexWrap === "wrap" || n.flexWrap === "wrap-reverse") && (n.alignContent = "flex-start"), r.debug || t.layout?.mode === "HORIZONTAL" && u === 0 ? console.log("[useEncoreStyle] Setting gap properties:", {
|
|
89
85
|
itemSpacing: u,
|
|
90
|
-
spacing:
|
|
86
|
+
spacing: S,
|
|
91
87
|
gap: n.gap,
|
|
92
88
|
rowGap: n.rowGap,
|
|
93
89
|
columnGap: n.columnGap,
|
|
@@ -101,12 +97,12 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
101
97
|
);
|
|
102
98
|
}
|
|
103
99
|
if (t.layout?.layoutSizingHorizontal === "FILL" && (n.width = "100%"), t.layout?.layoutSizingHorizontal === "FIXED") {
|
|
104
|
-
const
|
|
105
|
-
n.width = t.layout.size.x *
|
|
100
|
+
const s = e.scaleFactor ?? 1;
|
|
101
|
+
n.width = t.layout.size.x * s;
|
|
106
102
|
}
|
|
107
103
|
if (t.layout?.layoutSizingHorizontal, t.layout?.layoutSizingVertical === "FIXED") {
|
|
108
|
-
const
|
|
109
|
-
n.height = t.layout.size.y *
|
|
104
|
+
const s = e.scaleFactor ?? 1;
|
|
105
|
+
n.height = t.layout.size.y * s;
|
|
110
106
|
}
|
|
111
107
|
if (t.layout?.layoutSizingVertical === "FILL")
|
|
112
108
|
if (!(o?.isFlex ?? !1) && t.positioning && t.positioning?.top !== void 0) {
|
|
@@ -115,22 +111,22 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
115
111
|
} else
|
|
116
112
|
n.height = "100%";
|
|
117
113
|
if (t.layout?.layoutSizingVertical, t.backgroundColor && !Gt(t.backgroundColor) && (n.backgroundColor = st(t.backgroundColor)), t.color && (n.color = st(t.color)), t.lineHeightPx && (n.lineHeight = (t.lineHeightPx * (e.scaleFactor ?? 1)).toString() + "px"), t.fontSize && (n.fontSize = t.fontSize * (e.scaleFactor ?? 1)), t.fontWeight && (n.fontWeight = `${t.fontWeight}`), t.opacity && (n.opacity = t.opacity * 0.01), t.fontId) {
|
|
118
|
-
const
|
|
119
|
-
n.fontFamily = `"${
|
|
114
|
+
const s = m[t.fontId] || "sans-serif";
|
|
115
|
+
n.fontFamily = `"${s}"`, console.log("[AG_DEBUG] [useEncoreStyle] Font Resolution:", {
|
|
120
116
|
fontId: t.fontId,
|
|
121
|
-
resolvedFamily:
|
|
117
|
+
resolvedFamily: s,
|
|
122
118
|
fontWeight: t.fontWeight,
|
|
123
119
|
finalStyle: n.fontFamily
|
|
124
120
|
});
|
|
125
121
|
}
|
|
126
122
|
if (t.borderRadius && (n.borderRadius = l(t.borderRadius)), t.cornerRadii) {
|
|
127
|
-
const
|
|
128
|
-
n.borderTopLeftRadius =
|
|
123
|
+
const s = t.cornerRadii.map(l);
|
|
124
|
+
n.borderTopLeftRadius = s[0], n.borderTopRightRadius = s[1], n.borderBottomRightRadius = s[2], n.borderBottomLeftRadius = s[3], delete n.borderRadius;
|
|
129
125
|
}
|
|
130
126
|
return t.borderWidth && (t.borderWidth > 5 ? n.borderWidth = t.borderWidth * 0.5 : n.borderWidth = t.borderWidth * 1.5), t.borderColor && (n.borderColor = st(t.borderColor)), (t.borderWidth || t.borderColor) && (n.borderStyle = "solid"), t.rotation && (n.transform = `rotate(${t.rotation}deg)`), t.textCase === "upper" && (n.textTransform = "uppercase"), t.textCase === "lower" && (n.textTransform = "lowercase"), t.letterSpacing && (n.letterSpacing = t.letterSpacing), t.textAlign && (n.textAlign = t.textAlign), r.debug && (n.borderWidth = 1, n.borderColor = "#FF0000FF", n.borderStyle = "solid"), n;
|
|
131
127
|
}, et = ({ id: t, nodeData: r }) => {
|
|
132
128
|
const e = N(tt), o = e?.nodeData?.[t], { patch: i, list: l } = o ?? { list: null, patch: null }, m = Array.isArray(r?.tags) && (r.tags.includes("encore:data:array") || r.tags.includes("bravo:data:array")) && e?.arrayDataById && e.arrayDataById[t] && Array.isArray(e.arrayDataById[t]) ? e.arrayDataById[t] : null;
|
|
133
|
-
let
|
|
129
|
+
let a = i ? {
|
|
134
130
|
...r,
|
|
135
131
|
...i || {},
|
|
136
132
|
...i && i.data ? { data: { ...r?.data || {}, ...i.data } } : {},
|
|
@@ -138,55 +134,55 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
138
134
|
actions: i.actions && Array.isArray(i.actions) && i.actions.length > 0 ? i.actions : r.actions || i.actions || []
|
|
139
135
|
} : r;
|
|
140
136
|
const y = e?.textOverridesById && e.textOverridesById[t] !== void 0 ? e.textOverridesById[t] : void 0;
|
|
141
|
-
y !== void 0 && Array.isArray(r?.tags) && r.tags.includes("PROP:TEXT_VAR") && (
|
|
142
|
-
...
|
|
143
|
-
data: { ...
|
|
137
|
+
y !== void 0 && Array.isArray(r?.tags) && r.tags.includes("PROP:TEXT_VAR") && (a = {
|
|
138
|
+
...a,
|
|
139
|
+
data: { ...a?.data || {}, text: String(y) }
|
|
144
140
|
});
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
...
|
|
141
|
+
const v = Array.isArray(r?.tags) && (r.tags.includes("encore:data") || r.tags.includes("bravo:data")), f = e?.rootData;
|
|
142
|
+
f && f[t] && typeof f[t] == "object" && (a = {
|
|
143
|
+
...a,
|
|
148
144
|
data: {
|
|
149
|
-
...
|
|
150
|
-
...
|
|
145
|
+
...a.data || {},
|
|
146
|
+
...f[t]
|
|
151
147
|
}
|
|
152
148
|
});
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
149
|
+
const s = e?.nodeData && typeof e.nodeData == "object";
|
|
150
|
+
if (v || s) {
|
|
155
151
|
const u = e?.nodeData;
|
|
156
152
|
if (u && typeof u == "object") {
|
|
157
153
|
if (u[t] !== void 0) {
|
|
158
154
|
const w = u[t];
|
|
159
|
-
w && typeof w == "object" &&
|
|
160
|
-
...
|
|
155
|
+
w && typeof w == "object" && a.data && (a = {
|
|
156
|
+
...a,
|
|
161
157
|
data: {
|
|
162
|
-
...
|
|
158
|
+
...a.data,
|
|
163
159
|
...w
|
|
164
160
|
}
|
|
165
161
|
});
|
|
166
|
-
} else if (
|
|
167
|
-
...
|
|
162
|
+
} else if (v && u.description && a.data && (a = {
|
|
163
|
+
...a,
|
|
168
164
|
data: {
|
|
169
|
-
...
|
|
165
|
+
...a.data,
|
|
170
166
|
text: u.description
|
|
171
167
|
}
|
|
172
|
-
}), u.image &&
|
|
168
|
+
}), u.image && a.data) {
|
|
173
169
|
const w = u.image.startsWith("//") ? `https:${u.image}` : u.image;
|
|
174
|
-
|
|
175
|
-
...
|
|
170
|
+
a = {
|
|
171
|
+
...a,
|
|
176
172
|
data: {
|
|
177
|
-
...
|
|
173
|
+
...a.data,
|
|
178
174
|
imageUrl: w
|
|
179
175
|
}
|
|
180
176
|
};
|
|
181
177
|
}
|
|
182
|
-
|
|
178
|
+
a.encoreData = u;
|
|
183
179
|
}
|
|
184
180
|
}
|
|
185
181
|
return {
|
|
186
182
|
patch: i,
|
|
187
183
|
list: l || m,
|
|
188
184
|
// Use arrayData if list is not provided
|
|
189
|
-
patchedNodeData:
|
|
185
|
+
patchedNodeData: a,
|
|
190
186
|
arrayData: m
|
|
191
187
|
// Also return separately for components that need it
|
|
192
188
|
};
|
|
@@ -198,37 +194,37 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
198
194
|
_parentInputGroupInfo: i,
|
|
199
195
|
_parentName: l
|
|
200
196
|
}) => {
|
|
201
|
-
const n = k((
|
|
202
|
-
k((
|
|
203
|
-
const { onAction:
|
|
197
|
+
const n = k((h) => h.baseURL), m = k((h) => h.appId);
|
|
198
|
+
k((h) => h.pageId);
|
|
199
|
+
const { onAction: a } = x.useContext(ft), { statefulSetId: y } = x.useContext(
|
|
204
200
|
lt
|
|
205
|
-
),
|
|
206
|
-
(
|
|
201
|
+
), v = o || y, { patchedNodeData: f } = et({ id: t, nodeData: r }), s = k(
|
|
202
|
+
(h) => h.setStatefulSetVariant
|
|
207
203
|
), u = k(
|
|
208
|
-
(
|
|
209
|
-
), R = k((
|
|
204
|
+
(h) => h.setInputGroupValue
|
|
205
|
+
), R = k((h) => h.setAccessToken), { app: w } = k((h) => h.app);
|
|
210
206
|
w.data?.app?.startPageId, w.data?.app?.PageId;
|
|
211
|
-
const
|
|
207
|
+
const S = L(
|
|
212
208
|
{
|
|
213
209
|
positioning: r.style?.positioning
|
|
214
210
|
},
|
|
215
211
|
{ debug: !1 }
|
|
216
212
|
);
|
|
217
|
-
|
|
218
|
-
const
|
|
219
|
-
let
|
|
220
|
-
const
|
|
221
|
-
|
|
213
|
+
S.zIndex = 99999, S.backgroundColor = "transparent", S.position = "absolute", S.top = "0", S.left = "0", S.right = "0", S.bottom = "0", S.width = "100%", S.height = "100%", S.pointerEvents = "auto", S.isolation = "isolate";
|
|
214
|
+
const W = async (h) => {
|
|
215
|
+
let A = !1;
|
|
216
|
+
const G = () => {
|
|
217
|
+
A = !1;
|
|
222
218
|
};
|
|
223
|
-
if (typeof
|
|
219
|
+
if (typeof a == "function")
|
|
224
220
|
try {
|
|
225
|
-
await
|
|
221
|
+
await a({ bravo: { cancel: G, action: h, componentId: t } }), A = !0;
|
|
226
222
|
} catch {
|
|
227
223
|
}
|
|
228
224
|
else
|
|
229
|
-
|
|
230
|
-
if (
|
|
231
|
-
switch (
|
|
225
|
+
A = !0;
|
|
226
|
+
if (A)
|
|
227
|
+
switch (h.action) {
|
|
232
228
|
case "login":
|
|
233
229
|
// TODO firebase
|
|
234
230
|
// TODO oauth
|
|
@@ -238,7 +234,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
238
234
|
case "submit":
|
|
239
235
|
break;
|
|
240
236
|
case "email":
|
|
241
|
-
window.location.href = `mailto:${
|
|
237
|
+
window.location.href = `mailto:${h.params.email}`;
|
|
242
238
|
break;
|
|
243
239
|
case "goback":
|
|
244
240
|
break;
|
|
@@ -252,27 +248,27 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
252
248
|
case "none":
|
|
253
249
|
break;
|
|
254
250
|
case "openurl":
|
|
255
|
-
window.open(
|
|
251
|
+
window.open(h.params.url, "_blank");
|
|
256
252
|
break;
|
|
257
253
|
case "phone":
|
|
258
|
-
window.location.href = `tel:${
|
|
254
|
+
window.location.href = `tel:${h.params.phone}`;
|
|
259
255
|
break;
|
|
260
256
|
case "remote":
|
|
261
|
-
const
|
|
262
|
-
K.data?.action && await
|
|
257
|
+
const O = btoa(JSON.stringify(h.params?.data || {})), j = `${n}/devices/apps/${m}/node/${t}/trigger/${h.event}?params=${O}`, K = await Ot.post(j);
|
|
258
|
+
K.data?.action && await W(K.data);
|
|
263
259
|
break;
|
|
264
260
|
case "set-access-token":
|
|
265
|
-
R(
|
|
261
|
+
R(h.params);
|
|
266
262
|
break;
|
|
267
263
|
case "set-state":
|
|
268
264
|
if (i && l)
|
|
269
265
|
if (console.log("🔵 Input group change:", {
|
|
270
266
|
groupName: i.groupName,
|
|
271
267
|
elementName: l,
|
|
272
|
-
hasOnAction: typeof
|
|
273
|
-
}), u(i.groupName, l), typeof
|
|
268
|
+
hasOnAction: typeof a == "function"
|
|
269
|
+
}), u(i.groupName, l), typeof a == "function")
|
|
274
270
|
try {
|
|
275
|
-
await
|
|
271
|
+
await a({
|
|
276
272
|
bravo: {
|
|
277
273
|
cancel: () => {
|
|
278
274
|
},
|
|
@@ -294,23 +290,23 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
294
290
|
else
|
|
295
291
|
console.warn("⚠️ No onAction callback provided");
|
|
296
292
|
else {
|
|
297
|
-
let E =
|
|
293
|
+
let E = v || h.params?.stateSetId || f.data?.stateSetId;
|
|
298
294
|
if (!E) {
|
|
299
295
|
console.error("❌ No stateSetId found in action or nodeData!", {
|
|
300
|
-
actionParams:
|
|
301
|
-
nodeDataStateSetId:
|
|
302
|
-
parentStatefulSetId:
|
|
296
|
+
actionParams: h.params,
|
|
297
|
+
nodeDataStateSetId: f.data?.stateSetId,
|
|
298
|
+
parentStatefulSetId: v
|
|
303
299
|
});
|
|
304
300
|
break;
|
|
305
301
|
}
|
|
306
|
-
|
|
302
|
+
s(E, h.params.state);
|
|
307
303
|
}
|
|
308
304
|
break;
|
|
309
305
|
case "showalert":
|
|
310
|
-
alert(
|
|
306
|
+
alert(h.params.message);
|
|
311
307
|
break;
|
|
312
308
|
default:
|
|
313
|
-
console.log(
|
|
309
|
+
console.log(h), alert(h.action);
|
|
314
310
|
}
|
|
315
311
|
};
|
|
316
312
|
if (r.href)
|
|
@@ -319,13 +315,13 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
319
315
|
"button",
|
|
320
316
|
{
|
|
321
317
|
type: "button",
|
|
322
|
-
onClick: () =>
|
|
318
|
+
onClick: () => W({
|
|
323
319
|
action: "goto",
|
|
324
320
|
params: { href: r.href },
|
|
325
321
|
event: "tap"
|
|
326
322
|
}),
|
|
327
323
|
style: {
|
|
328
|
-
...
|
|
324
|
+
...S,
|
|
329
325
|
cursor: "pointer",
|
|
330
326
|
background: "transparent",
|
|
331
327
|
border: "none",
|
|
@@ -336,17 +332,17 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
336
332
|
),
|
|
337
333
|
e
|
|
338
334
|
] });
|
|
339
|
-
let
|
|
340
|
-
if (
|
|
341
|
-
...
|
|
335
|
+
let $ = f.actions && f.actions.length > 0 ? f.actions : r.actions || [];
|
|
336
|
+
if (v && $.length > 0 && ($ = $.map((h) => h.action === "set-state" ? (h.params?.stateSetId, {
|
|
337
|
+
...h,
|
|
342
338
|
params: {
|
|
343
|
-
...
|
|
344
|
-
stateSetId:
|
|
339
|
+
...h.params,
|
|
340
|
+
stateSetId: v
|
|
345
341
|
// Always use parent's id
|
|
346
342
|
}
|
|
347
|
-
}) :
|
|
343
|
+
}) : h)), $.length === 0 && (f.data?.stateSetId || v))
|
|
348
344
|
if (i && l)
|
|
349
|
-
|
|
345
|
+
$ = [
|
|
350
346
|
{
|
|
351
347
|
action: "set-state",
|
|
352
348
|
params: {
|
|
@@ -357,13 +353,13 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
357
353
|
}
|
|
358
354
|
];
|
|
359
355
|
else {
|
|
360
|
-
const
|
|
361
|
-
|
|
356
|
+
const h = v || f.data.stateSetId;
|
|
357
|
+
h ? $ = [
|
|
362
358
|
{
|
|
363
359
|
action: "set-state",
|
|
364
360
|
params: {
|
|
365
|
-
state: k.getState().statefulSetVariants[
|
|
366
|
-
stateSetId:
|
|
361
|
+
state: k.getState().statefulSetVariants[h] === "active" ? "default" : "active",
|
|
362
|
+
stateSetId: h
|
|
367
363
|
// Use parent's id or button's stateSetId
|
|
368
364
|
},
|
|
369
365
|
event: "tap"
|
|
@@ -373,25 +369,25 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
373
369
|
{ id: t, name: r.name }
|
|
374
370
|
);
|
|
375
371
|
}
|
|
376
|
-
if (
|
|
377
|
-
const
|
|
378
|
-
return
|
|
372
|
+
if ($ && $.length > 0) {
|
|
373
|
+
const h = $[0];
|
|
374
|
+
return h.event !== "tap" ? e : /* @__PURE__ */ it(ut, { children: [
|
|
379
375
|
e,
|
|
380
376
|
/* @__PURE__ */ p(
|
|
381
377
|
"div",
|
|
382
378
|
{
|
|
383
|
-
onClick: (
|
|
384
|
-
|
|
379
|
+
onClick: (A) => {
|
|
380
|
+
A.stopPropagation(), W(h);
|
|
385
381
|
},
|
|
386
|
-
onMouseDown: (
|
|
387
|
-
onMouseUp: (
|
|
388
|
-
style: { ...
|
|
382
|
+
onMouseDown: (A) => A.stopPropagation(),
|
|
383
|
+
onMouseUp: (A) => A.stopPropagation(),
|
|
384
|
+
style: { ...S, cursor: "pointer", pointerEvents: "auto" }
|
|
389
385
|
}
|
|
390
386
|
)
|
|
391
387
|
] });
|
|
392
388
|
}
|
|
393
389
|
return e;
|
|
394
|
-
},
|
|
390
|
+
}, ht = ({ id: t, name: r, nodeData: e }) => {
|
|
395
391
|
const o = L(e.style, {
|
|
396
392
|
debug: !1
|
|
397
393
|
});
|
|
@@ -412,11 +408,11 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
412
408
|
if (!o.backgroundColor && !o.borderColor)
|
|
413
409
|
return null;
|
|
414
410
|
if (o.borderColor && !o.backgroundColor && (o.backgroundColor = "transparent"), o.borderColor && o.borderWidth) {
|
|
415
|
-
const
|
|
416
|
-
(!o.width || typeof o.width == "number" && o.width === 0) && (o.width =
|
|
411
|
+
const v = Math.max(o.borderWidth || 0, 1);
|
|
412
|
+
(!o.width || typeof o.width == "number" && o.width === 0) && (o.width = v), (!o.height || typeof o.height == "number" && o.height === 0) && (o.height = v), o.boxSizing = "border-box";
|
|
417
413
|
}
|
|
418
|
-
const i = Array.isArray(e.tags) && e.tags.includes("bravo:layer"), l = N(V)?.isFlex ?? !1, n = e.style?.positioning, m = n && typeof n.top == "number" && typeof n.left == "number" && typeof n.right == "number" && typeof n.bottom == "number" && n.top === 0 && n.left === 0 && n.right === 0 && n.bottom === 0,
|
|
419
|
-
return
|
|
414
|
+
const i = Array.isArray(e.tags) && e.tags.includes("bravo:layer"), l = N(V)?.isFlex ?? !1, n = e.style?.positioning, m = n && typeof n.top == "number" && typeof n.left == "number" && typeof n.right == "number" && typeof n.bottom == "number" && n.top === 0 && n.left === 0 && n.right === 0 && n.bottom === 0, a = i && (l || m), y = r && r.toLowerCase().startsWith("clip");
|
|
415
|
+
return a && (o.position = "absolute", o.top = 0, o.left = 0, o.right = 0, o.bottom = 0, o.zIndex = -1, o.width && typeof o.width == "string" && o.width.includes("%") && delete o.width, o.height && typeof o.height == "string" && o.height.includes("%") && delete o.height), y && (o.backgroundColor = "transparent"), /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p("div", { "data-name": r, "data-type": "ColorComponent", style: o }) });
|
|
420
416
|
}, mt = ({
|
|
421
417
|
id: t,
|
|
422
418
|
name: r,
|
|
@@ -428,8 +424,8 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
428
424
|
if (!n?.color) return null;
|
|
429
425
|
const m = st(n.color);
|
|
430
426
|
if (typeof n.position == "number") {
|
|
431
|
-
const
|
|
432
|
-
return `${m} ${
|
|
427
|
+
const a = n.position * 100;
|
|
428
|
+
return `${m} ${a}%`;
|
|
433
429
|
}
|
|
434
430
|
return m;
|
|
435
431
|
}).filter(Boolean).join(", ") : "";
|
|
@@ -445,22 +441,22 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
445
441
|
debug: !1
|
|
446
442
|
}), l = N(V), n = k((u) => u.assetsById), m = e.style?.scaleMode || "fill";
|
|
447
443
|
m === "fill" ? i.objectFit = "cover" : m === "fit" && (i.objectFit = "contain"), i.objectPosition = "center";
|
|
448
|
-
let
|
|
449
|
-
!
|
|
450
|
-
const y = e.style?.positioning,
|
|
451
|
-
if (y &&
|
|
444
|
+
let a = e.data?.imageUrl;
|
|
445
|
+
!a && e.encoreData?.image && (a = e.encoreData.image.startsWith("//") ? `https:${e.encoreData.image}` : e.encoreData.image), a || (a = n[e.assetId]?.url);
|
|
446
|
+
const y = e.style?.positioning, v = e.style?.aspectRatio, f = l.dimensions?.width || 0, s = l.dimensions?.height || 0;
|
|
447
|
+
if (y && v && f > 0) {
|
|
452
448
|
const u = typeof y.left == "number" && typeof y.right == "number", R = typeof y.top == "number" && typeof y.bottom == "number";
|
|
453
449
|
if (u) {
|
|
454
450
|
const w = 100 - y.left - y.right;
|
|
455
451
|
if (w > 0) {
|
|
456
|
-
const
|
|
457
|
-
i.width =
|
|
452
|
+
const S = w * f / 100;
|
|
453
|
+
i.width = S, i.height = S / v, i.left = `${Math.max(0, y.left)}%`, i.top = `${Math.max(0, y.top)}%`, delete i.right, delete i.bottom;
|
|
458
454
|
}
|
|
459
|
-
} else if (R &&
|
|
455
|
+
} else if (R && s > 0) {
|
|
460
456
|
const w = 100 - y.top - y.bottom;
|
|
461
457
|
if (w > 0) {
|
|
462
|
-
const
|
|
463
|
-
i.height =
|
|
458
|
+
const S = w * s / 100;
|
|
459
|
+
i.height = S, i.width = S * v, i.left = `${Math.max(0, y.left)}%`, i.top = `${Math.max(0, y.top)}%`, delete i.right, delete i.bottom;
|
|
464
460
|
}
|
|
465
461
|
}
|
|
466
462
|
}
|
|
@@ -471,7 +467,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
471
467
|
"data-name": r,
|
|
472
468
|
"data-type": "ImageComponent",
|
|
473
469
|
style: i,
|
|
474
|
-
src:
|
|
470
|
+
src: a || n[e.assetId]?.url,
|
|
475
471
|
alt: r
|
|
476
472
|
}
|
|
477
473
|
) });
|
|
@@ -559,9 +555,9 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
559
555
|
name: r,
|
|
560
556
|
nodeData: e
|
|
561
557
|
}) => {
|
|
562
|
-
const o = k((
|
|
558
|
+
const o = k((f) => f.setFormInputValue), { onAction: i } = x.useContext(ft), { patchedNodeData: l } = et({ id: t, nodeData: e }), n = L(l.style, { debug: !1 });
|
|
563
559
|
n.width = "100%", n.flex = "1", n.minWidth = "0", n.boxSizing = "border-box", n.borderColor = n.borderColor ?? "transparent";
|
|
564
|
-
const m = l.data?.value,
|
|
560
|
+
const m = l.data?.value, a = l.data?.options, y = x.useMemo(() => !a || !Array.isArray(a) ? [] : a.map((f) => typeof f == "string" ? { value: f, label: f } : f), [a]);
|
|
565
561
|
return /* @__PURE__ */ it(
|
|
566
562
|
"select",
|
|
567
563
|
{
|
|
@@ -570,9 +566,9 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
570
566
|
"data-type": "SelectInputComponent",
|
|
571
567
|
value: m ?? "",
|
|
572
568
|
style: n,
|
|
573
|
-
onChange: async (
|
|
574
|
-
const
|
|
575
|
-
if (o(t,
|
|
569
|
+
onChange: async (f) => {
|
|
570
|
+
const s = f.target.value;
|
|
571
|
+
if (o(t, s), console.log(`Select changed: ${s}`), typeof i == "function")
|
|
576
572
|
try {
|
|
577
573
|
await i({
|
|
578
574
|
bravo: {
|
|
@@ -581,7 +577,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
581
577
|
action: {
|
|
582
578
|
action: "select-change",
|
|
583
579
|
nodeId: t,
|
|
584
|
-
params: { value:
|
|
580
|
+
params: { value: s }
|
|
585
581
|
},
|
|
586
582
|
componentId: t
|
|
587
583
|
}
|
|
@@ -591,7 +587,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
591
587
|
},
|
|
592
588
|
children: [
|
|
593
589
|
y.length === 0 && /* @__PURE__ */ p("option", { value: "", disabled: !0, children: "Select an option..." }),
|
|
594
|
-
y.map((
|
|
590
|
+
y.map((f) => /* @__PURE__ */ p("option", { value: f.value, children: f.label }, f.value))
|
|
595
591
|
]
|
|
596
592
|
}
|
|
597
593
|
);
|
|
@@ -631,8 +627,19 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
631
627
|
}, At = ({ id: t, name: r, nodeData: e }) => {
|
|
632
628
|
const o = L(e.style, {
|
|
633
629
|
debug: !1
|
|
634
|
-
}), i = k((
|
|
635
|
-
|
|
630
|
+
}), i = k((n) => n.assetsById), l = e.style?.positioning;
|
|
631
|
+
if (l) {
|
|
632
|
+
const n = typeof l.left == "number" && typeof l.right == "number", m = typeof l.top == "number" && typeof l.bottom == "number";
|
|
633
|
+
if (n) {
|
|
634
|
+
const a = 100 - l.left - l.right;
|
|
635
|
+
o.width = `${a}%`, o.left = `${l.left}%`, delete o.right;
|
|
636
|
+
}
|
|
637
|
+
if (m) {
|
|
638
|
+
const a = 100 - l.top - l.bottom;
|
|
639
|
+
o.height = `${a}%`, o.top = `${l.top}%`, delete o.bottom;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return o.objectFit || (o.objectFit = "fill"), /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p(
|
|
636
643
|
"img",
|
|
637
644
|
{
|
|
638
645
|
"data-id": t,
|
|
@@ -662,10 +669,10 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
662
669
|
center: "center",
|
|
663
670
|
"from-bottom": "flex-end"
|
|
664
671
|
}[l.verticalPosition]);
|
|
665
|
-
const
|
|
672
|
+
const a = i && (i.includes(`
|
|
666
673
|
`) || i.includes("\r"));
|
|
667
674
|
let y;
|
|
668
|
-
return
|
|
675
|
+
return a && m.flexDirection === "column" ? y = i.split(/\r?\n/).filter((f) => f.length > 0).map((f, s) => /* @__PURE__ */ p("div", { style: { lineHeight: "inherit" }, children: f }, s)) : y = i, /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: /* @__PURE__ */ p(
|
|
669
676
|
"div",
|
|
670
677
|
{
|
|
671
678
|
"data-id": t,
|
|
@@ -683,29 +690,29 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
683
690
|
}) => {
|
|
684
691
|
const i = N(tt), { patchedNodeData: l } = et({ id: t, nodeData: e });
|
|
685
692
|
e = l;
|
|
686
|
-
const n = jt(e.tags), m = n ? k((w) => w.inputGroups[n.groupName]) : null,
|
|
693
|
+
const n = jt(e.tags), m = n ? k((w) => w.inputGroups[n.groupName]) : null, a = k((w) => w.statefulSetVariants[t]), y = L(e.style, {
|
|
687
694
|
debug: !1
|
|
688
695
|
});
|
|
689
|
-
let
|
|
690
|
-
n && m !== null ?
|
|
691
|
-
const
|
|
696
|
+
let v;
|
|
697
|
+
n && m !== null ? v = m === r ? "active" : "default" : v = a || e.data.initialState || "default";
|
|
698
|
+
const f = x.Children.toArray(o).find((w) => x.isValidElement(w) ? w.props?.nodeData?.data?.state === v : !1), s = x.isValidElement(f) ? x.cloneElement(f, {
|
|
692
699
|
_parentStatefulSetId: t,
|
|
693
700
|
_parentInputGroupInfo: n,
|
|
694
701
|
_parentName: r
|
|
695
702
|
// Pass the name so we can identify which element is active
|
|
696
|
-
}) :
|
|
703
|
+
}) : f, u = /* @__PURE__ */ p(
|
|
697
704
|
"div",
|
|
698
705
|
{
|
|
699
706
|
"data-id": t,
|
|
700
707
|
"data-name": r,
|
|
701
708
|
"data-type": "StatefulSetComponent",
|
|
702
709
|
style: y,
|
|
703
|
-
children:
|
|
710
|
+
children: s
|
|
704
711
|
}
|
|
705
712
|
);
|
|
706
713
|
if (e.type === "component:input-stateful-set")
|
|
707
714
|
return u;
|
|
708
|
-
const R =
|
|
715
|
+
const R = x.useContext(lt);
|
|
709
716
|
return /* @__PURE__ */ p(
|
|
710
717
|
tt.Provider,
|
|
711
718
|
{
|
|
@@ -730,7 +737,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
730
737
|
}) => {
|
|
731
738
|
const m = L(e.style, {
|
|
732
739
|
debug: !1
|
|
733
|
-
}),
|
|
740
|
+
}), a = {
|
|
734
741
|
...m,
|
|
735
742
|
position: m.position || "relative"
|
|
736
743
|
};
|
|
@@ -740,7 +747,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
740
747
|
"data-id": t,
|
|
741
748
|
"data-name": r,
|
|
742
749
|
"data-type": "StatefulCompoundComponent",
|
|
743
|
-
style:
|
|
750
|
+
style: a,
|
|
744
751
|
children: /* @__PURE__ */ p(
|
|
745
752
|
Y,
|
|
746
753
|
{
|
|
@@ -788,40 +795,40 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
788
795
|
`[DEBUG] ContainerComponent ${t} (Hero) FULL nodeData:`,
|
|
789
796
|
JSON.stringify(e, null, 2)
|
|
790
797
|
);
|
|
791
|
-
const n = N(tt), { patchedNodeData: m, list:
|
|
798
|
+
const n = N(tt), { patchedNodeData: m, list: a, arrayData: y } = et({
|
|
792
799
|
id: t,
|
|
793
800
|
nodeData: e
|
|
794
801
|
});
|
|
795
802
|
e = m;
|
|
796
|
-
const { dimensions:
|
|
803
|
+
const { dimensions: v, ref: f } = rt(), s = L(e.style, {
|
|
797
804
|
debug: !1
|
|
798
|
-
}), u = !!e.style.layout?.mode, R = e.style.layout?.mode === "HORIZONTAL" ? "row" : "column", w =
|
|
799
|
-
if (!w && !
|
|
800
|
-
const
|
|
805
|
+
}), u = !!e.style.layout?.mode, R = e.style.layout?.mode === "HORIZONTAL" ? "row" : "column", w = s.width !== void 0, S = s.height !== void 0, W = N(V), $ = W?.isFlex ?? !1, h = W?.flexDirection, A = $ && h === "row", G = !$ && e.style.positioning, O = e.style.layout?.layoutSizingHorizontal === "FIXED" || e.style.layout?.layoutSizingVertical === "FIXED", j = e.style.layout?.layoutSizingHorizontal === "HUG" || e.style.layout?.layoutSizingVertical === "HUG";
|
|
806
|
+
if (!w && !A && !(G && (O || j)) && (s.width = "100%"), !S) {
|
|
807
|
+
const B = !$ && e.style.positioning, Z = e.style.layout?.layoutSizingVertical === "FILL";
|
|
801
808
|
if (!(e.style.layout?.layoutSizingVertical === "HUG")) {
|
|
802
|
-
if (!u) if (
|
|
803
|
-
const
|
|
804
|
-
|
|
809
|
+
if (!u) if (B && Z && e.style.positioning?.top !== void 0) {
|
|
810
|
+
const Q = 100 - e.style.positioning.top;
|
|
811
|
+
s.height = `${Q}%`;
|
|
805
812
|
} else
|
|
806
|
-
|
|
813
|
+
s.height = "100%";
|
|
807
814
|
}
|
|
808
815
|
}
|
|
809
|
-
const K = e.style.layout?.layoutSizingHorizontal || e.style.layout?.layoutSizingVertical, H = e.style.positioning && !u && (K || !0) ? { ...
|
|
810
|
-
width:
|
|
811
|
-
height:
|
|
816
|
+
const K = e.style.layout?.layoutSizingHorizontal || e.style.layout?.layoutSizingVertical, H = e.style.positioning && !u && (K || !0) ? { ...s, position: "absolute" } : s.position === "absolute" ? s : { ...s, position: s.position || "relative" }, U = (B) => typeof B == "number" ? B : typeof B == "string" && B.endsWith("px") && parseFloat(B) || 0, M = U(s.paddingLeft), g = U(s.paddingRight), q = U(s.paddingTop), X = U(s.paddingBottom), P = O && typeof s.width == "number" && typeof s.height == "number" ? {
|
|
817
|
+
width: s.width - M - g,
|
|
818
|
+
height: s.height - q - X
|
|
812
819
|
} : {
|
|
813
|
-
width:
|
|
814
|
-
height:
|
|
820
|
+
width: v.width - M - g,
|
|
821
|
+
height: v.height - q - X
|
|
815
822
|
};
|
|
816
|
-
if (i != null &&
|
|
817
|
-
const
|
|
818
|
-
if (
|
|
819
|
-
const Z = typeof
|
|
820
|
-
nodeData:
|
|
823
|
+
if (i != null && a) {
|
|
824
|
+
const B = a[i];
|
|
825
|
+
if (B !== void 0) {
|
|
826
|
+
const Z = typeof B == "object" && B !== null ? {
|
|
827
|
+
nodeData: B,
|
|
821
828
|
arrayDataById: n?.arrayDataById,
|
|
822
829
|
textOverridesById: n?.textOverridesById,
|
|
823
830
|
rootData: n?.rootData
|
|
824
|
-
} : { nodeData:
|
|
831
|
+
} : { nodeData: B };
|
|
825
832
|
return /* @__PURE__ */ p(tt.Provider, { value: Z, children: /* @__PURE__ */ p(
|
|
826
833
|
V.Provider,
|
|
827
834
|
{
|
|
@@ -840,10 +847,10 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
840
847
|
) });
|
|
841
848
|
}
|
|
842
849
|
}
|
|
843
|
-
if (
|
|
844
|
-
const
|
|
845
|
-
return Ht(() =>
|
|
846
|
-
const
|
|
850
|
+
if (a) {
|
|
851
|
+
const B = y || a;
|
|
852
|
+
return Ht(() => B.map((J, nt) => {
|
|
853
|
+
const Q = typeof J == "object" && J !== null ? {
|
|
847
854
|
nodeData: J,
|
|
848
855
|
arrayDataById: n?.arrayDataById,
|
|
849
856
|
textOverridesById: n?.textOverridesById,
|
|
@@ -852,7 +859,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
852
859
|
return /* @__PURE__ */ p(
|
|
853
860
|
tt.Provider,
|
|
854
861
|
{
|
|
855
|
-
value:
|
|
862
|
+
value: Q,
|
|
856
863
|
children: /* @__PURE__ */ p(
|
|
857
864
|
V.Provider,
|
|
858
865
|
{
|
|
@@ -872,16 +879,16 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
872
879
|
},
|
|
873
880
|
`${t}:${nt}`
|
|
874
881
|
);
|
|
875
|
-
}), [
|
|
882
|
+
}), [B, t]);
|
|
876
883
|
}
|
|
877
884
|
let F = e.actions || [];
|
|
878
885
|
!Array.isArray(F) && typeof F == "object" && F !== null && (F = Object.entries(F).map(
|
|
879
|
-
([
|
|
880
|
-
event:
|
|
886
|
+
([B, Z]) => ({
|
|
887
|
+
event: B,
|
|
881
888
|
...typeof Z == "object" && Z !== null ? Z : {}
|
|
882
889
|
})
|
|
883
890
|
));
|
|
884
|
-
const
|
|
891
|
+
const z = Array.isArray(F) && F.length > 0;
|
|
885
892
|
return /* @__PURE__ */ p(
|
|
886
893
|
V.Provider,
|
|
887
894
|
{
|
|
@@ -892,21 +899,21 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
892
899
|
"data-id": t,
|
|
893
900
|
"data-name": r,
|
|
894
901
|
"data-type": "ContainerComponent",
|
|
895
|
-
ref:
|
|
902
|
+
ref: f,
|
|
896
903
|
style: H,
|
|
897
|
-
children:
|
|
904
|
+
children: z ? /* @__PURE__ */ p(Y, { id: t, nodeData: e, children: o }) : o
|
|
898
905
|
}
|
|
899
906
|
)
|
|
900
907
|
}
|
|
901
908
|
);
|
|
902
|
-
}, Pt = pt,
|
|
909
|
+
}, Pt = pt, Bt = ({ id: t, name: r, nodeData: e, children: o }) => {
|
|
903
910
|
const { dimensions: i, ref: l } = rt(), n = L(e.style, {
|
|
904
911
|
debug: !1
|
|
905
|
-
}), m = !!e.style.layout?.mode,
|
|
912
|
+
}), m = !!e.style.layout?.mode, a = e.style.layout?.mode === "HORIZONTAL" ? "row" : "column", y = n.position ? n : { ...n, position: "relative" };
|
|
906
913
|
return /* @__PURE__ */ p(
|
|
907
914
|
V.Provider,
|
|
908
915
|
{
|
|
909
|
-
value: { dimensions: i, isFlex: m, flexDirection:
|
|
916
|
+
value: { dimensions: i, isFlex: m, flexDirection: a },
|
|
910
917
|
children: /* @__PURE__ */ p(
|
|
911
918
|
"div",
|
|
912
919
|
{
|
|
@@ -932,7 +939,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
932
939
|
children: o
|
|
933
940
|
}
|
|
934
941
|
);
|
|
935
|
-
},
|
|
942
|
+
}, Lt = ({ id: t, name: r, nodeData: e, children: o }) => /* @__PURE__ */ p(
|
|
936
943
|
"div",
|
|
937
944
|
{
|
|
938
945
|
"data-id": t,
|
|
@@ -941,7 +948,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
941
948
|
style: L(e.style),
|
|
942
949
|
children: o
|
|
943
950
|
}
|
|
944
|
-
),
|
|
951
|
+
), Wt = ({ id: t, name: r, nodeData: e, children: o }) => {
|
|
945
952
|
const i = L(e.style, {
|
|
946
953
|
debug: !1
|
|
947
954
|
});
|
|
@@ -960,191 +967,191 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
960
967
|
`[DEBUG] SliderComponent ${t} FULL nodeData:`,
|
|
961
968
|
JSON.stringify(e, null, 2)
|
|
962
969
|
);
|
|
963
|
-
const { dimensions: i, ref: l } = rt(), n =
|
|
970
|
+
const { dimensions: i, ref: l } = rt(), n = x.useRef(null), m = x.useRef(null), a = x.useRef(!1), y = x.useRef(null), v = N(ct), f = N(Mt), { onAction: s } = N(ft), [u, R] = x.useState({
|
|
964
971
|
currentIndex: void 0,
|
|
965
972
|
onIndexChange: void 0
|
|
966
|
-
}), [w,
|
|
967
|
-
e =
|
|
968
|
-
const
|
|
973
|
+
}), [w, S] = x.useState(0), W = x.useRef(null), { patchedNodeData: $ } = et({ id: t, nodeData: e });
|
|
974
|
+
e = $;
|
|
975
|
+
const h = e.data?.params || {}, A = h.infinite === !0, G = h.automatic === !0;
|
|
969
976
|
let j = Array.isArray(e.tags) && e.tags.some((c) => c.includes("container:slider:vertical")) || e.name && e.name.includes("container:slider:vertical");
|
|
970
|
-
if (!j &&
|
|
977
|
+
if (!j && h.animation === "default") {
|
|
971
978
|
const c = e.style?.width, d = e.style?.height;
|
|
972
979
|
typeof c == "number" && typeof d == "number" && d > c && (j = !0);
|
|
973
980
|
}
|
|
974
|
-
const K = j ? "vertical" :
|
|
981
|
+
const K = j ? "vertical" : h.animation === "default" ? "horizontal" : h.animation || "horizontal", E = L(e.style, {
|
|
975
982
|
debug: !1
|
|
976
983
|
}), H = E.width !== void 0, U = E.height !== void 0;
|
|
977
984
|
H || (E.width = "100%"), U || (E.height = "100%"), E.position || (E.position = "relative");
|
|
978
|
-
const
|
|
985
|
+
const M = N(tt), g = x.useMemo(() => {
|
|
979
986
|
const c = [];
|
|
980
|
-
return
|
|
987
|
+
return x.Children.forEach(o, (d) => {
|
|
981
988
|
if (d == null) return;
|
|
982
|
-
const
|
|
983
|
-
if (Array.isArray(C?.tags) && (C.tags.includes("encore:data:array") || C.tags.includes("bravo:data:array")) &&
|
|
984
|
-
const T =
|
|
985
|
-
T && T.length > 0 ? T.forEach((
|
|
989
|
+
const I = d?.props || {}, C = I.nodeData || {};
|
|
990
|
+
if (Array.isArray(C?.tags) && (C.tags.includes("encore:data:array") || C.tags.includes("bravo:data:array")) && I.id && M) {
|
|
991
|
+
const T = M?.arrayDataById && M.arrayDataById[I.id] && Array.isArray(M.arrayDataById[I.id]) ? M.arrayDataById[I.id] : null;
|
|
992
|
+
T && T.length > 0 ? T.forEach((D, ot) => {
|
|
986
993
|
c.push(
|
|
987
|
-
|
|
988
|
-
key: `${
|
|
994
|
+
x.cloneElement(d, {
|
|
995
|
+
key: `${I.id}:${ot}`,
|
|
989
996
|
// ContainerComponent will use this to know which item to render
|
|
990
997
|
_arrayItemIndex: ot,
|
|
991
|
-
_arrayItemData:
|
|
998
|
+
_arrayItemData: D
|
|
992
999
|
})
|
|
993
1000
|
);
|
|
994
1001
|
}) : c.push(d);
|
|
995
1002
|
} else
|
|
996
1003
|
c.push(d);
|
|
997
1004
|
}), c;
|
|
998
|
-
}, [o, t,
|
|
999
|
-
if (!
|
|
1005
|
+
}, [o, t, M]), q = x.useMemo(() => {
|
|
1006
|
+
if (!A || g.length === 0)
|
|
1000
1007
|
return g;
|
|
1001
1008
|
const c = g[0], d = g[g.length - 1];
|
|
1002
1009
|
return [
|
|
1003
|
-
|
|
1010
|
+
x.cloneElement(d, {
|
|
1004
1011
|
key: `clone-last-${d.key || d.props.id}`
|
|
1005
1012
|
}),
|
|
1006
1013
|
...g,
|
|
1007
|
-
|
|
1014
|
+
x.cloneElement(c, {
|
|
1008
1015
|
key: `clone-first-${c.key || c.props.id}`
|
|
1009
1016
|
})
|
|
1010
1017
|
];
|
|
1011
|
-
}, [g,
|
|
1018
|
+
}, [g, A]), X = x.useMemo(() => {
|
|
1012
1019
|
if (g.length === 0) return { width: 0, height: 0 };
|
|
1013
|
-
const d = g[0]?.props?.nodeData?.style,
|
|
1020
|
+
const d = g[0]?.props?.nodeData?.style, I = v.scaleFactor || 1;
|
|
1014
1021
|
let C = 0, b = 0;
|
|
1015
|
-
return d?.layout?.layoutSizingHorizontal === "FIXED" && d?.layout?.size?.x ? C = d.layout.size.x *
|
|
1016
|
-
}, [g, i.width, i.height,
|
|
1022
|
+
return d?.layout?.layoutSizingHorizontal === "FIXED" && d?.layout?.size?.x ? C = d.layout.size.x * I : C = i.width || 0, d?.layout?.layoutSizingVertical === "FIXED" && d?.layout?.size?.y ? b = d.layout.size.y * I : b = i.height || 0, { width: C, height: b };
|
|
1023
|
+
}, [g, i.width, i.height, v.scaleFactor]), P = X.width, F = X.height, z = K === "vertical", _ = x.useCallback(() => {
|
|
1017
1024
|
if (!n.current || g.length === 0)
|
|
1018
1025
|
return 0;
|
|
1019
1026
|
const c = n.current;
|
|
1020
|
-
if (
|
|
1027
|
+
if (z) {
|
|
1021
1028
|
if (F === 0) return 0;
|
|
1022
1029
|
const d = c.scrollTop;
|
|
1023
|
-
if (
|
|
1030
|
+
if (A) {
|
|
1024
1031
|
const C = d - F;
|
|
1025
1032
|
let b = Math.round(C / F);
|
|
1026
1033
|
return b < 0 && (b = 0), b >= g.length && (b = g.length - 1), b;
|
|
1027
1034
|
} else {
|
|
1028
|
-
const
|
|
1029
|
-
return
|
|
1035
|
+
const I = Math.round(d / F);
|
|
1036
|
+
return I < 0 ? 0 : I >= g.length ? g.length - 1 : I;
|
|
1030
1037
|
}
|
|
1031
1038
|
} else {
|
|
1032
1039
|
if (P === 0) return 0;
|
|
1033
1040
|
const d = c.scrollLeft;
|
|
1034
|
-
if (
|
|
1041
|
+
if (A) {
|
|
1035
1042
|
const C = d - P;
|
|
1036
1043
|
let b = Math.round(C / P);
|
|
1037
1044
|
return b < 0 && (b = 0), b >= g.length && (b = g.length - 1), b;
|
|
1038
1045
|
} else {
|
|
1039
|
-
const
|
|
1040
|
-
return
|
|
1046
|
+
const I = Math.round(d / P);
|
|
1047
|
+
return I < 0 ? 0 : I >= g.length ? g.length - 1 : I;
|
|
1041
1048
|
}
|
|
1042
1049
|
}
|
|
1043
|
-
}, [
|
|
1050
|
+
}, [A, g.length, P, F, z]), B = x.useCallback(
|
|
1044
1051
|
(c, d = !0) => {
|
|
1045
1052
|
if (!n.current || g.length === 0) return;
|
|
1046
|
-
const
|
|
1047
|
-
if (
|
|
1053
|
+
const I = n.current;
|
|
1054
|
+
if (z) {
|
|
1048
1055
|
let C;
|
|
1049
|
-
|
|
1056
|
+
A ? C = F + c * F : C = c * F, I.scrollTo({
|
|
1050
1057
|
top: C,
|
|
1051
1058
|
behavior: d ? "smooth" : "auto"
|
|
1052
1059
|
});
|
|
1053
1060
|
} else {
|
|
1054
1061
|
let C;
|
|
1055
|
-
|
|
1062
|
+
A ? C = P + c * P : C = c * P, I.scrollTo({
|
|
1056
1063
|
left: C,
|
|
1057
1064
|
behavior: d ? "smooth" : "auto"
|
|
1058
1065
|
});
|
|
1059
1066
|
}
|
|
1060
1067
|
},
|
|
1061
|
-
[P, F,
|
|
1062
|
-
), Z =
|
|
1063
|
-
if (!
|
|
1068
|
+
[P, F, A, g.length, z]
|
|
1069
|
+
), Z = x.useCallback(() => {
|
|
1070
|
+
if (!A || !n.current || g.length === 0) return;
|
|
1064
1071
|
const c = n.current, d = 1;
|
|
1065
|
-
if (
|
|
1072
|
+
if (z) {
|
|
1066
1073
|
if (F === 0) return;
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1074
|
+
const I = c.scrollTop, C = F, b = C, T = b + g.length * C;
|
|
1075
|
+
I >= T - d ? c.scrollTop = b : I <= d && (c.scrollTop = T - C);
|
|
1069
1076
|
} else {
|
|
1070
1077
|
if (P === 0) return;
|
|
1071
|
-
const
|
|
1072
|
-
|
|
1078
|
+
const I = c.scrollLeft, C = P, b = C, T = b + g.length * C;
|
|
1079
|
+
I >= T - d ? c.scrollLeft = b : I <= d && (c.scrollLeft = T - C);
|
|
1073
1080
|
}
|
|
1074
|
-
}, [
|
|
1075
|
-
|
|
1076
|
-
if (!
|
|
1081
|
+
}, [A, g.length, P, F, z]);
|
|
1082
|
+
x.useEffect(() => {
|
|
1083
|
+
if (!G || g.length <= 1 || P === 0) return;
|
|
1077
1084
|
const c = () => {
|
|
1078
|
-
if (
|
|
1085
|
+
if (a.current || !n.current) return;
|
|
1079
1086
|
const d = n.current;
|
|
1080
|
-
if (
|
|
1087
|
+
if (z) {
|
|
1081
1088
|
if (F === 0) return;
|
|
1082
|
-
const
|
|
1089
|
+
const I = d.scrollTop, C = F;
|
|
1083
1090
|
let b;
|
|
1084
|
-
if (
|
|
1085
|
-
const ot =
|
|
1091
|
+
if (A) {
|
|
1092
|
+
const ot = I - C;
|
|
1086
1093
|
b = Math.round(ot / C), b < 0 && (b = 0), b >= g.length && (b = g.length - 1);
|
|
1087
1094
|
} else
|
|
1088
|
-
b = Math.round(
|
|
1095
|
+
b = Math.round(I / C);
|
|
1089
1096
|
let T = b + 1;
|
|
1090
|
-
if (
|
|
1097
|
+
if (A) {
|
|
1091
1098
|
T >= g.length && (T = 0);
|
|
1092
|
-
const
|
|
1099
|
+
const D = C;
|
|
1093
1100
|
d.scrollTo({
|
|
1094
|
-
top:
|
|
1101
|
+
top: D + T * C,
|
|
1095
1102
|
behavior: "smooth"
|
|
1096
1103
|
});
|
|
1097
1104
|
} else
|
|
1098
|
-
T >= g.length && (T = 0),
|
|
1105
|
+
T >= g.length && (T = 0), B(T);
|
|
1099
1106
|
} else {
|
|
1100
1107
|
if (P === 0) return;
|
|
1101
|
-
const
|
|
1108
|
+
const I = d.scrollLeft, C = P;
|
|
1102
1109
|
let b;
|
|
1103
|
-
if (
|
|
1104
|
-
const ot =
|
|
1110
|
+
if (A) {
|
|
1111
|
+
const ot = I - C;
|
|
1105
1112
|
b = Math.round(ot / C), b < 0 && (b = 0), b >= g.length && (b = g.length - 1);
|
|
1106
1113
|
} else
|
|
1107
|
-
b = Math.round(
|
|
1114
|
+
b = Math.round(I / C);
|
|
1108
1115
|
let T = b + 1;
|
|
1109
|
-
if (
|
|
1116
|
+
if (A) {
|
|
1110
1117
|
T >= g.length && (T = 0);
|
|
1111
|
-
const
|
|
1118
|
+
const D = C;
|
|
1112
1119
|
d.scrollTo({
|
|
1113
|
-
left:
|
|
1120
|
+
left: D + T * C,
|
|
1114
1121
|
behavior: "smooth"
|
|
1115
1122
|
});
|
|
1116
1123
|
} else
|
|
1117
|
-
T >= g.length && (T = 0),
|
|
1124
|
+
T >= g.length && (T = 0), B(T);
|
|
1118
1125
|
}
|
|
1119
1126
|
};
|
|
1120
1127
|
return m.current = setInterval(c, 4e3), () => {
|
|
1121
1128
|
m.current && (clearInterval(m.current), m.current = null);
|
|
1122
1129
|
};
|
|
1123
1130
|
}, [
|
|
1124
|
-
|
|
1131
|
+
G,
|
|
1125
1132
|
g.length,
|
|
1126
|
-
|
|
1133
|
+
A,
|
|
1127
1134
|
P,
|
|
1128
1135
|
F,
|
|
1129
|
-
|
|
1130
|
-
|
|
1136
|
+
z,
|
|
1137
|
+
B
|
|
1131
1138
|
]);
|
|
1132
|
-
const J =
|
|
1133
|
-
|
|
1134
|
-
|
|
1139
|
+
const J = x.useCallback(() => {
|
|
1140
|
+
a.current = !0, y.current && clearTimeout(y.current), y.current = setTimeout(() => {
|
|
1141
|
+
a.current = !1;
|
|
1135
1142
|
}, 3e3);
|
|
1136
|
-
}, []), nt =
|
|
1137
|
-
|
|
1143
|
+
}, []), nt = x.useRef(u);
|
|
1144
|
+
x.useEffect(() => {
|
|
1138
1145
|
nt.current = u;
|
|
1139
1146
|
}, [u]);
|
|
1140
|
-
const
|
|
1147
|
+
const Q = x.useCallback(
|
|
1141
1148
|
(c) => {
|
|
1142
|
-
if (
|
|
1143
|
-
|
|
1149
|
+
if (W.current === c) return;
|
|
1150
|
+
W.current = c;
|
|
1144
1151
|
const d = nt.current;
|
|
1145
|
-
if (d.currentIndex === void 0 &&
|
|
1152
|
+
if (d.currentIndex === void 0 && S(c), d.onIndexChange && d.onIndexChange(c), typeof s == "function")
|
|
1146
1153
|
try {
|
|
1147
|
-
|
|
1154
|
+
s({
|
|
1148
1155
|
bravo: {
|
|
1149
1156
|
cancel: () => {
|
|
1150
1157
|
},
|
|
@@ -1158,46 +1165,46 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1158
1165
|
} catch {
|
|
1159
1166
|
}
|
|
1160
1167
|
},
|
|
1161
|
-
[
|
|
1168
|
+
[s, t]
|
|
1162
1169
|
// Depend on onAction to ensure we call the latest version
|
|
1163
1170
|
);
|
|
1164
|
-
|
|
1171
|
+
x.useEffect(() => {
|
|
1165
1172
|
const c = n.current;
|
|
1166
1173
|
if (!c) return;
|
|
1167
1174
|
let d = null;
|
|
1168
|
-
const
|
|
1169
|
-
J(),
|
|
1175
|
+
const I = () => {
|
|
1176
|
+
J(), A ? (d !== null && cancelAnimationFrame(d), d = requestAnimationFrame(() => {
|
|
1170
1177
|
Z();
|
|
1171
1178
|
const T = _();
|
|
1172
|
-
|
|
1179
|
+
Q(T);
|
|
1173
1180
|
})) : (d !== null && cancelAnimationFrame(d), d = requestAnimationFrame(() => {
|
|
1174
1181
|
const T = _();
|
|
1175
|
-
|
|
1182
|
+
Q(T);
|
|
1176
1183
|
}));
|
|
1177
1184
|
}, C = () => J(), b = () => J();
|
|
1178
|
-
return c.addEventListener("scroll",
|
|
1185
|
+
return c.addEventListener("scroll", I, { passive: !0 }), c.addEventListener("touchstart", C, {
|
|
1179
1186
|
passive: !0
|
|
1180
1187
|
}), c.addEventListener("mousedown", b), () => {
|
|
1181
|
-
c.removeEventListener("scroll",
|
|
1188
|
+
c.removeEventListener("scroll", I), c.removeEventListener("touchstart", C), c.removeEventListener("mousedown", b), y.current && clearTimeout(y.current), d !== null && cancelAnimationFrame(d);
|
|
1182
1189
|
};
|
|
1183
1190
|
}, [
|
|
1184
|
-
|
|
1191
|
+
A,
|
|
1185
1192
|
J,
|
|
1186
1193
|
Z,
|
|
1187
1194
|
_,
|
|
1188
|
-
|
|
1189
|
-
]),
|
|
1190
|
-
if (
|
|
1191
|
-
const c =
|
|
1195
|
+
Q
|
|
1196
|
+
]), x.useEffect(() => {
|
|
1197
|
+
if (f) {
|
|
1198
|
+
const c = f.getControlProps(t);
|
|
1192
1199
|
c && c !== u && R(c);
|
|
1193
1200
|
}
|
|
1194
|
-
}, [t,
|
|
1201
|
+
}, [t, f, u]), x.useEffect(() => {
|
|
1195
1202
|
if (u.currentIndex !== void 0 && n.current && g.length > 0 && P > 0) {
|
|
1196
1203
|
const c = Math.max(
|
|
1197
1204
|
0,
|
|
1198
1205
|
Math.min(u.currentIndex, g.length - 1)
|
|
1199
1206
|
), d = _();
|
|
1200
|
-
c !== d &&
|
|
1207
|
+
c !== d && B(c, !0);
|
|
1201
1208
|
}
|
|
1202
1209
|
}, [
|
|
1203
1210
|
u.currentIndex,
|
|
@@ -1205,41 +1212,41 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1205
1212
|
g.length,
|
|
1206
1213
|
P,
|
|
1207
1214
|
F,
|
|
1208
|
-
|
|
1209
|
-
|
|
1215
|
+
z,
|
|
1216
|
+
B,
|
|
1210
1217
|
_
|
|
1211
|
-
]),
|
|
1212
|
-
if (
|
|
1213
|
-
const c =
|
|
1218
|
+
]), x.useEffect(() => {
|
|
1219
|
+
if (A && n.current && g.length > 0 && g.length > 0 && (z ? F > 0 : P > 0)) {
|
|
1220
|
+
const c = z ? F : P;
|
|
1214
1221
|
setTimeout(() => {
|
|
1215
|
-
n.current && (
|
|
1222
|
+
n.current && (z ? n.current.scrollTop = c : n.current.scrollLeft = c);
|
|
1216
1223
|
}, 0);
|
|
1217
1224
|
}
|
|
1218
|
-
}, [
|
|
1219
|
-
if (!
|
|
1220
|
-
const { registerContainer: c, unregisterContainer: d } =
|
|
1225
|
+
}, [A, g.length, P, F, z]), x.useEffect(() => {
|
|
1226
|
+
if (!f) return;
|
|
1227
|
+
const { registerContainer: c, unregisterContainer: d } = f;
|
|
1221
1228
|
return () => {
|
|
1222
1229
|
};
|
|
1223
1230
|
}, [
|
|
1224
1231
|
t,
|
|
1225
|
-
|
|
1226
|
-
|
|
1232
|
+
f?.registerContainer,
|
|
1233
|
+
f?.unregisterContainer,
|
|
1227
1234
|
// controlProps, // REMOVED to break infinite loop
|
|
1228
|
-
|
|
1235
|
+
B,
|
|
1229
1236
|
_
|
|
1230
1237
|
]);
|
|
1231
|
-
const
|
|
1238
|
+
const $t = {
|
|
1232
1239
|
display: "flex",
|
|
1233
|
-
flexDirection:
|
|
1234
|
-
overflowX:
|
|
1235
|
-
overflowY:
|
|
1236
|
-
scrollSnapType:
|
|
1240
|
+
flexDirection: z ? "column" : "row",
|
|
1241
|
+
overflowX: z ? "hidden" : "auto",
|
|
1242
|
+
overflowY: z ? "auto" : "hidden",
|
|
1243
|
+
scrollSnapType: z ? "y mandatory" : "x mandatory",
|
|
1237
1244
|
scrollBehavior: "smooth",
|
|
1238
1245
|
width: "100%",
|
|
1239
1246
|
height: "100%",
|
|
1240
1247
|
WebkitOverflowScrolling: "touch"
|
|
1241
1248
|
// Smooth scrolling on iOS
|
|
1242
|
-
},
|
|
1249
|
+
}, zt = {
|
|
1243
1250
|
flexShrink: 0,
|
|
1244
1251
|
scrollSnapAlign: "start",
|
|
1245
1252
|
width: X.width > 0 ? X.width : void 0,
|
|
@@ -1254,7 +1261,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1254
1261
|
"data-type": "SliderComponent",
|
|
1255
1262
|
ref: l,
|
|
1256
1263
|
style: E,
|
|
1257
|
-
children: /* @__PURE__ */ p("div", { ref: n, style:
|
|
1264
|
+
children: /* @__PURE__ */ p("div", { ref: n, style: $t, children: q.map((c, d) => /* @__PURE__ */ p(
|
|
1258
1265
|
V.Provider,
|
|
1259
1266
|
{
|
|
1260
1267
|
value: {
|
|
@@ -1264,32 +1271,32 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1264
1271
|
},
|
|
1265
1272
|
isFlex: !1
|
|
1266
1273
|
},
|
|
1267
|
-
children: /* @__PURE__ */ p("div", { style:
|
|
1274
|
+
children: /* @__PURE__ */ p("div", { style: zt, children: c })
|
|
1268
1275
|
},
|
|
1269
1276
|
c.key || `slide-${d}`
|
|
1270
1277
|
)) })
|
|
1271
1278
|
}
|
|
1272
1279
|
);
|
|
1273
|
-
},
|
|
1280
|
+
}, kt = (t, r) => {
|
|
1274
1281
|
const e = Array.isArray(t) ? t : [t];
|
|
1275
1282
|
for (const o of e)
|
|
1276
1283
|
if (!(!o || !o.props)) {
|
|
1277
1284
|
if (o.props.id === r)
|
|
1278
1285
|
return o;
|
|
1279
1286
|
if (o.props.children) {
|
|
1280
|
-
const i =
|
|
1287
|
+
const i = kt(o.props.children, r);
|
|
1281
1288
|
if (i) return i;
|
|
1282
1289
|
}
|
|
1283
1290
|
}
|
|
1284
1291
|
return null;
|
|
1285
1292
|
}, Rt = ({ id: t, name: r, nodeData: e, children: o }) => {
|
|
1286
|
-
const { dimensions: i, ref: l } = rt(), { componentId: n } = N(lt), m = N(V),
|
|
1287
|
-
let w,
|
|
1288
|
-
i.width > 0 && i.height > 0 ? (w = i.width,
|
|
1289
|
-
const
|
|
1293
|
+
const { dimensions: i, ref: l } = rt(), { componentId: n } = N(lt), m = N(V), a = e.style.originalSize?.[0] || 1, y = e.style.originalSize?.[1] || 1, v = m?.dimensions?.width, f = m?.dimensions?.height, s = window.innerWidth, u = window.innerHeight, R = v && v > 0 && v < s * 0.8;
|
|
1294
|
+
let w, S;
|
|
1295
|
+
i.width > 0 && i.height > 0 ? (w = i.width, S = i.height) : R && v && f || v && f && v > 0 && f > 0 ? (w = v, S = f) : (w = s, S = u);
|
|
1296
|
+
const $ = { scaleFactor: Math.min(w / a, S / y) || 1 };
|
|
1290
1297
|
if (n) {
|
|
1291
|
-
const E =
|
|
1292
|
-
return E ? /* @__PURE__ */ p(ct.Provider, { value:
|
|
1298
|
+
const E = kt(o, n);
|
|
1299
|
+
return E ? /* @__PURE__ */ p(ct.Provider, { value: $, children: /* @__PURE__ */ p(
|
|
1293
1300
|
V.Provider,
|
|
1294
1301
|
{
|
|
1295
1302
|
value: {
|
|
@@ -1302,18 +1309,18 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1302
1309
|
}
|
|
1303
1310
|
) }) : (console.warn(`Child with id "${n}" not found`), null);
|
|
1304
1311
|
}
|
|
1305
|
-
const
|
|
1312
|
+
const h = Array.isArray(o) ? o : [o], { scrollableChildren: A, nonScrollableChildren: G } = h.reduce(
|
|
1306
1313
|
(E, H) => {
|
|
1307
|
-
const
|
|
1308
|
-
return E[
|
|
1314
|
+
const M = H.props.nodeData.type === "container:top-bar" ? "nonScrollableChildren" : "scrollableChildren";
|
|
1315
|
+
return E[M].push(H), E;
|
|
1309
1316
|
},
|
|
1310
1317
|
{
|
|
1311
1318
|
scrollableChildren: [],
|
|
1312
1319
|
nonScrollableChildren: []
|
|
1313
1320
|
}
|
|
1314
1321
|
);
|
|
1315
|
-
let
|
|
1316
|
-
if (!
|
|
1322
|
+
let O = e.style?.layout?.mode;
|
|
1323
|
+
if (!O && t === "01KASW494V02Y8P5JVWV5XK62X" && (console.log("🔧 PATCHING missing layout for page", t), O = "HORIZONTAL"), !O && o) {
|
|
1317
1324
|
const E = Array.isArray(o) ? o : [o];
|
|
1318
1325
|
let H = 0, U = 0;
|
|
1319
1326
|
E.forEach((g) => {
|
|
@@ -1321,12 +1328,12 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1321
1328
|
q && (H += q, q < 99 && U++);
|
|
1322
1329
|
}), U > 0 && H >= 99 && (console.log(
|
|
1323
1330
|
`[PATCH] Detected HORIZONTAL WRAP layout for page ${t} (Partial width children: ${U}, Total width: ${H})`
|
|
1324
|
-
),
|
|
1331
|
+
), O = "HORIZONTAL", e.style || (e.style = {}), e.style.layout || (e.style.layout = {}), e.style.layout.mode = "HORIZONTAL", e.style.layout.flexWrap = "wrap", e.style.layout.primaryAxisAlignItems = "flex-start", e.style.layout.counterAxisAlignItems = "flex-start");
|
|
1325
1332
|
}
|
|
1326
|
-
const j =
|
|
1333
|
+
const j = O === "HORIZONTAL" ? "row" : "column", K = G.some(
|
|
1327
1334
|
(E) => E?.props?.nodeData?.type !== "container:background"
|
|
1328
1335
|
);
|
|
1329
|
-
return /* @__PURE__ */ p(ct.Provider, { value:
|
|
1336
|
+
return /* @__PURE__ */ p(ct.Provider, { value: $, children: /* @__PURE__ */ it(
|
|
1330
1337
|
"div",
|
|
1331
1338
|
{
|
|
1332
1339
|
style: {
|
|
@@ -1345,7 +1352,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1345
1352
|
},
|
|
1346
1353
|
ref: l,
|
|
1347
1354
|
children: [
|
|
1348
|
-
|
|
1355
|
+
G.filter(
|
|
1349
1356
|
(E) => E?.props?.nodeData?.type === "container:background"
|
|
1350
1357
|
).map((E, H) => /* @__PURE__ */ p(
|
|
1351
1358
|
V.Provider,
|
|
@@ -1360,7 +1367,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1360
1367
|
},
|
|
1361
1368
|
`bg-${H}`
|
|
1362
1369
|
)),
|
|
1363
|
-
K &&
|
|
1370
|
+
K && G.filter(
|
|
1364
1371
|
(E) => E?.props?.nodeData?.type !== "container:background"
|
|
1365
1372
|
).map((E, H) => /* @__PURE__ */ p(
|
|
1366
1373
|
V.Provider,
|
|
@@ -1397,14 +1404,14 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1397
1404
|
debug: !1
|
|
1398
1405
|
})
|
|
1399
1406
|
},
|
|
1400
|
-
children:
|
|
1407
|
+
children: A
|
|
1401
1408
|
}
|
|
1402
1409
|
) })
|
|
1403
1410
|
]
|
|
1404
1411
|
}
|
|
1405
1412
|
) });
|
|
1406
|
-
},
|
|
1407
|
-
WebViewComponent:
|
|
1413
|
+
}, Dt = {
|
|
1414
|
+
WebViewComponent: ht,
|
|
1408
1415
|
ColorComponent: gt,
|
|
1409
1416
|
GradientComponent: mt,
|
|
1410
1417
|
ImageComponent: yt,
|
|
@@ -1422,18 +1429,18 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1422
1429
|
BackgroundContainerComponent: Tt,
|
|
1423
1430
|
ContainerComponent: pt,
|
|
1424
1431
|
CompoundComponent: Pt,
|
|
1425
|
-
TopBarContainerComponent:
|
|
1432
|
+
TopBarContainerComponent: Bt,
|
|
1426
1433
|
DefaultLayerComponent: Ut,
|
|
1427
|
-
TabsMenuComponent:
|
|
1428
|
-
MenuSideComponent:
|
|
1434
|
+
TabsMenuComponent: Lt,
|
|
1435
|
+
MenuSideComponent: Wt,
|
|
1429
1436
|
SliderComponent: at,
|
|
1430
1437
|
PageComponent: Rt,
|
|
1431
1438
|
// Type string mappings for dynamically loaded components
|
|
1432
|
-
"menu:side":
|
|
1439
|
+
"menu:side": Wt,
|
|
1433
1440
|
"page:default": Rt,
|
|
1434
1441
|
"container:background": Tt,
|
|
1435
1442
|
"container:default": pt,
|
|
1436
|
-
"container:top-bar":
|
|
1443
|
+
"container:top-bar": Bt,
|
|
1437
1444
|
"container:slider": at,
|
|
1438
1445
|
"component:text": Et,
|
|
1439
1446
|
"component:color": gt,
|
|
@@ -1445,7 +1452,7 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1445
1452
|
"component:stateful-set": dt,
|
|
1446
1453
|
"component:stateful-compound": Ft,
|
|
1447
1454
|
"component:slider": at,
|
|
1448
|
-
"component:webview":
|
|
1455
|
+
"component:webview": ht,
|
|
1449
1456
|
"component:lottie": wt,
|
|
1450
1457
|
"component:email-input": bt,
|
|
1451
1458
|
"component:text-input": It,
|
|
@@ -1453,10 +1460,10 @@ const ct = v.createContext({}), V = v.createContext(
|
|
|
1453
1460
|
"component:select-input": vt,
|
|
1454
1461
|
"component:image-input": St,
|
|
1455
1462
|
"component:hidden-input": Ct,
|
|
1456
|
-
"component:tabs-menu":
|
|
1463
|
+
"component:tabs-menu": Lt,
|
|
1457
1464
|
ContainerSliderComponent: at
|
|
1458
1465
|
};
|
|
1459
1466
|
export {
|
|
1460
|
-
|
|
1467
|
+
Dt as default
|
|
1461
1468
|
};
|
|
1462
1469
|
//# sourceMappingURL=components.js.map
|