@fragmentsx/render-react 0.0.5 → 1.1.0
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/index.cjs.js +2058 -778
- package/dist/index.es.js +2058 -778
- package/dist/render-react.css +7 -0
- package/package.json +12 -9
- package/dist/components/Fragment/index.d.ts +0 -8
- package/dist/components/Fragment/index.d.ts.map +0 -1
- package/dist/components/Frame/index.d.ts +0 -9
- package/dist/components/Frame/index.d.ts.map +0 -1
- package/dist/components/GlobalManager/index.d.ts +0 -5
- package/dist/components/GlobalManager/index.d.ts.map +0 -1
- package/dist/components/Instance/index.d.ts +0 -10
- package/dist/components/Instance/index.d.ts.map +0 -1
- package/dist/components/Text/index.d.ts +0 -8
- package/dist/components/Text/index.d.ts.map +0 -1
- package/dist/helpers/collectStyles.d.ts +0 -3
- package/dist/helpers/collectStyles.d.ts.map +0 -1
- package/dist/helpers/hydration.d.ts +0 -3
- package/dist/helpers/hydration.d.ts.map +0 -1
- package/dist/helpers/isBrowser.d.ts +0 -2
- package/dist/helpers/isBrowser.d.ts.map +0 -1
- package/dist/helpers/loadFragmentManager.d.ts +0 -3
- package/dist/helpers/loadFragmentManager.d.ts.map +0 -1
- package/dist/hocs/reactCSRAdapter.d.ts +0 -2
- package/dist/hocs/reactCSRAdapter.d.ts.map +0 -1
- package/dist/hocs/reactSSRAdapter.d.ts +0 -3
- package/dist/hocs/reactSSRAdapter.d.ts.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/reactAdapter.d.ts +0 -2
- package/dist/reactAdapter.d.ts.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import require$$0, { createContext, useContext, useRef, useCallback,
|
|
3
|
-
import { isLinkKey } from "@graph-state/core";
|
|
2
|
+
import require$$0, { createContext, useState, useEffect, useContext, useRef, useCallback, useMemo, Suspense } from "react";
|
|
4
3
|
import { definition } from "@fragmentsx/definition";
|
|
4
|
+
import { isPartialKey, keyOfEntity, entityOfKey, isLinkKey } from "@graph-state/core";
|
|
5
5
|
const collectStyles = (globalManager) => {
|
|
6
6
|
if (!globalManager) return null;
|
|
7
7
|
const allFragments = globalManager.$fragments.getManagers();
|
|
8
8
|
const extractors = Object.entries(allFragments).filter(([, value]) => !!(value == null ? void 0 : value.resolve)).map(([fragmentId, manager]) => {
|
|
9
|
-
var _a;
|
|
10
|
-
|
|
11
|
-
return a;
|
|
9
|
+
var _a, _b, _c;
|
|
10
|
+
return (_c = (_b = (_a = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a.extract) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.at(0);
|
|
12
11
|
});
|
|
13
12
|
return extractors.map((extractor) => /* @__PURE__ */ jsx(
|
|
14
13
|
"style",
|
|
@@ -18,7 +17,253 @@ const collectStyles = (globalManager) => {
|
|
|
18
17
|
}
|
|
19
18
|
));
|
|
20
19
|
};
|
|
21
|
-
|
|
20
|
+
var n, l, t, i, r, o, e, f, c, s, a, p = {}, v = [], y$1 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, d = Array.isArray;
|
|
21
|
+
function w(n2, l2) {
|
|
22
|
+
for (var t2 in l2) n2[t2] = l2[t2];
|
|
23
|
+
return n2;
|
|
24
|
+
}
|
|
25
|
+
function g(n2) {
|
|
26
|
+
n2 && n2.parentNode && n2.parentNode.removeChild(n2);
|
|
27
|
+
}
|
|
28
|
+
function _(l2, t2, u) {
|
|
29
|
+
var i2, r2, o2, e2 = {};
|
|
30
|
+
for (o2 in t2) "key" == o2 ? i2 = t2[o2] : "ref" == o2 ? r2 = t2[o2] : e2[o2] = t2[o2];
|
|
31
|
+
if (arguments.length > 2 && (e2.children = arguments.length > 3 ? n.call(arguments, 2) : u), "function" == typeof l2 && null != l2.defaultProps) for (o2 in l2.defaultProps) void 0 === e2[o2] && (e2[o2] = l2.defaultProps[o2]);
|
|
32
|
+
return m(l2, e2, i2, r2, null);
|
|
33
|
+
}
|
|
34
|
+
function m(n2, u, i2, r2, o2) {
|
|
35
|
+
var e2 = { type: n2, props: u, key: i2, ref: r2, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: null == o2 ? ++t : o2, __i: -1, __u: 0 };
|
|
36
|
+
return null == o2 && null != l.vnode && l.vnode(e2), e2;
|
|
37
|
+
}
|
|
38
|
+
function k(n2) {
|
|
39
|
+
return n2.children;
|
|
40
|
+
}
|
|
41
|
+
function x$1(n2, l2) {
|
|
42
|
+
this.props = n2, this.context = l2;
|
|
43
|
+
}
|
|
44
|
+
function S$1(n2, l2) {
|
|
45
|
+
if (null == l2) return n2.__ ? S$1(n2.__, n2.__i + 1) : null;
|
|
46
|
+
for (var t2; l2 < n2.__k.length; l2++) if (null != (t2 = n2.__k[l2]) && null != t2.__e) return t2.__e;
|
|
47
|
+
return "function" == typeof n2.type ? S$1(n2) : null;
|
|
48
|
+
}
|
|
49
|
+
function C(n2) {
|
|
50
|
+
var l2, t2;
|
|
51
|
+
if (null != (n2 = n2.__) && null != n2.__c) {
|
|
52
|
+
for (n2.__e = n2.__c.base = null, l2 = 0; l2 < n2.__k.length; l2++) if (null != (t2 = n2.__k[l2]) && null != t2.__e) {
|
|
53
|
+
n2.__e = n2.__c.base = t2.__e;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
return C(n2);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function M(n2) {
|
|
60
|
+
(!n2.__d && (n2.__d = true) && i.push(n2) && !$.__r++ || r !== l.debounceRendering) && ((r = l.debounceRendering) || o)($);
|
|
61
|
+
}
|
|
62
|
+
function $() {
|
|
63
|
+
for (var n2, t2, u, r2, o2, f2, c2, s2 = 1; i.length; ) i.length > s2 && i.sort(e), n2 = i.shift(), s2 = i.length, n2.__d && (u = void 0, o2 = (r2 = (t2 = n2).__v).__e, f2 = [], c2 = [], t2.__P && ((u = w({}, r2)).__v = r2.__v + 1, l.vnode && l.vnode(u), O(t2.__P, u, r2, t2.__n, t2.__P.namespaceURI, 32 & r2.__u ? [o2] : null, f2, null == o2 ? S$1(r2) : o2, !!(32 & r2.__u), c2), u.__v = r2.__v, u.__.__k[u.__i] = u, z(f2, u, c2), u.__e != o2 && C(u)));
|
|
64
|
+
$.__r = 0;
|
|
65
|
+
}
|
|
66
|
+
function I(n2, l2, t2, u, i2, r2, o2, e2, f2, c2, s2) {
|
|
67
|
+
var a2, h, y2, d2, w2, g2, _2 = u && u.__k || v, m2 = l2.length;
|
|
68
|
+
for (f2 = P(t2, l2, _2, f2, m2), a2 = 0; a2 < m2; a2++) null != (y2 = t2.__k[a2]) && (h = -1 === y2.__i ? p : _2[y2.__i] || p, y2.__i = a2, g2 = O(n2, y2, h, i2, r2, o2, e2, f2, c2, s2), d2 = y2.__e, y2.ref && h.ref != y2.ref && (h.ref && q(h.ref, null, y2), s2.push(y2.ref, y2.__c || d2, y2)), null == w2 && null != d2 && (w2 = d2), 4 & y2.__u || h.__k === y2.__k ? f2 = A(y2, f2, n2) : "function" == typeof y2.type && void 0 !== g2 ? f2 = g2 : d2 && (f2 = d2.nextSibling), y2.__u &= -7);
|
|
69
|
+
return t2.__e = w2, f2;
|
|
70
|
+
}
|
|
71
|
+
function P(n2, l2, t2, u, i2) {
|
|
72
|
+
var r2, o2, e2, f2, c2, s2 = t2.length, a2 = s2, h = 0;
|
|
73
|
+
for (n2.__k = new Array(i2), r2 = 0; r2 < i2; r2++) null != (o2 = l2[r2]) && "boolean" != typeof o2 && "function" != typeof o2 ? (f2 = r2 + h, (o2 = n2.__k[r2] = "string" == typeof o2 || "number" == typeof o2 || "bigint" == typeof o2 || o2.constructor == String ? m(null, o2, null, null, null) : d(o2) ? m(k, { children: o2 }, null, null, null) : void 0 === o2.constructor && o2.__b > 0 ? m(o2.type, o2.props, o2.key, o2.ref ? o2.ref : null, o2.__v) : o2).__ = n2, o2.__b = n2.__b + 1, e2 = null, -1 !== (c2 = o2.__i = L(o2, t2, f2, a2)) && (a2--, (e2 = t2[c2]) && (e2.__u |= 2)), null == e2 || null === e2.__v ? (-1 == c2 && (i2 > s2 ? h-- : i2 < s2 && h++), "function" != typeof o2.type && (o2.__u |= 4)) : c2 != f2 && (c2 == f2 - 1 ? h-- : c2 == f2 + 1 ? h++ : (c2 > f2 ? h-- : h++, o2.__u |= 4))) : n2.__k[r2] = null;
|
|
74
|
+
if (a2) for (r2 = 0; r2 < s2; r2++) null != (e2 = t2[r2]) && 0 == (2 & e2.__u) && (e2.__e == u && (u = S$1(e2)), B(e2, e2));
|
|
75
|
+
return u;
|
|
76
|
+
}
|
|
77
|
+
function A(n2, l2, t2) {
|
|
78
|
+
var u, i2;
|
|
79
|
+
if ("function" == typeof n2.type) {
|
|
80
|
+
for (u = n2.__k, i2 = 0; u && i2 < u.length; i2++) u[i2] && (u[i2].__ = n2, l2 = A(u[i2], l2, t2));
|
|
81
|
+
return l2;
|
|
82
|
+
}
|
|
83
|
+
n2.__e != l2 && (l2 && n2.type && !t2.contains(l2) && (l2 = S$1(n2)), t2.insertBefore(n2.__e, l2 || null), l2 = n2.__e);
|
|
84
|
+
do {
|
|
85
|
+
l2 = l2 && l2.nextSibling;
|
|
86
|
+
} while (null != l2 && 8 == l2.nodeType);
|
|
87
|
+
return l2;
|
|
88
|
+
}
|
|
89
|
+
function L(n2, l2, t2, u) {
|
|
90
|
+
var i2, r2, o2 = n2.key, e2 = n2.type, f2 = l2[t2];
|
|
91
|
+
if (null === f2 && null == n2.key || f2 && o2 == f2.key && e2 === f2.type && 0 == (2 & f2.__u)) return t2;
|
|
92
|
+
if (u > (null != f2 && 0 == (2 & f2.__u) ? 1 : 0)) for (i2 = t2 - 1, r2 = t2 + 1; i2 >= 0 || r2 < l2.length; ) {
|
|
93
|
+
if (i2 >= 0) {
|
|
94
|
+
if ((f2 = l2[i2]) && 0 == (2 & f2.__u) && o2 == f2.key && e2 === f2.type) return i2;
|
|
95
|
+
i2--;
|
|
96
|
+
}
|
|
97
|
+
if (r2 < l2.length) {
|
|
98
|
+
if ((f2 = l2[r2]) && 0 == (2 & f2.__u) && o2 == f2.key && e2 === f2.type) return r2;
|
|
99
|
+
r2++;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return -1;
|
|
103
|
+
}
|
|
104
|
+
function T(n2, l2, t2) {
|
|
105
|
+
"-" == l2[0] ? n2.setProperty(l2, null == t2 ? "" : t2) : n2[l2] = null == t2 ? "" : "number" != typeof t2 || y$1.test(l2) ? t2 : t2 + "px";
|
|
106
|
+
}
|
|
107
|
+
function j(n2, l2, t2, u, i2) {
|
|
108
|
+
var r2;
|
|
109
|
+
n: if ("style" == l2) if ("string" == typeof t2) n2.style.cssText = t2;
|
|
110
|
+
else {
|
|
111
|
+
if ("string" == typeof u && (n2.style.cssText = u = ""), u) for (l2 in u) t2 && l2 in t2 || T(n2.style, l2, "");
|
|
112
|
+
if (t2) for (l2 in t2) u && t2[l2] === u[l2] || T(n2.style, l2, t2[l2]);
|
|
113
|
+
}
|
|
114
|
+
else if ("o" == l2[0] && "n" == l2[1]) r2 = l2 != (l2 = l2.replace(f, "$1")), l2 = l2.toLowerCase() in n2 || "onFocusOut" == l2 || "onFocusIn" == l2 ? l2.toLowerCase().slice(2) : l2.slice(2), n2.l || (n2.l = {}), n2.l[l2 + r2] = t2, t2 ? u ? t2.t = u.t : (t2.t = c, n2.addEventListener(l2, r2 ? a : s, r2)) : n2.removeEventListener(l2, r2 ? a : s, r2);
|
|
115
|
+
else {
|
|
116
|
+
if ("http://www.w3.org/2000/svg" == i2) l2 = l2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
117
|
+
else if ("width" != l2 && "height" != l2 && "href" != l2 && "list" != l2 && "form" != l2 && "tabIndex" != l2 && "download" != l2 && "rowSpan" != l2 && "colSpan" != l2 && "role" != l2 && "popover" != l2 && l2 in n2) try {
|
|
118
|
+
n2[l2] = null == t2 ? "" : t2;
|
|
119
|
+
break n;
|
|
120
|
+
} catch (n3) {
|
|
121
|
+
}
|
|
122
|
+
"function" == typeof t2 || (null == t2 || false === t2 && "-" != l2[4] ? n2.removeAttribute(l2) : n2.setAttribute(l2, "popover" == l2 && 1 == t2 ? "" : t2));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function F(n2) {
|
|
126
|
+
return function(t2) {
|
|
127
|
+
if (this.l) {
|
|
128
|
+
var u = this.l[t2.type + n2];
|
|
129
|
+
if (null == t2.u) t2.u = c++;
|
|
130
|
+
else if (t2.u < u.t) return;
|
|
131
|
+
return u(l.event ? l.event(t2) : t2);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function O(n2, t2, u, i2, r2, o2, e2, f2, c2, s2) {
|
|
136
|
+
var a2, h, p2, v2, y2, _2, m2, b, S2, C2, M2, $2, P2, A2, H, L2, T2, j2 = t2.type;
|
|
137
|
+
if (void 0 !== t2.constructor) return null;
|
|
138
|
+
128 & u.__u && (c2 = !!(32 & u.__u), o2 = [f2 = t2.__e = u.__e]), (a2 = l.__b) && a2(t2);
|
|
139
|
+
n: if ("function" == typeof j2) try {
|
|
140
|
+
if (b = t2.props, S2 = "prototype" in j2 && j2.prototype.render, C2 = (a2 = j2.contextType) && i2[a2.__c], M2 = a2 ? C2 ? C2.props.value : a2.__ : i2, u.__c ? m2 = (h = t2.__c = u.__c).__ = h.__E : (S2 ? t2.__c = h = new j2(b, M2) : (t2.__c = h = new x$1(b, M2), h.constructor = j2, h.render = D), C2 && C2.sub(h), h.props = b, h.state || (h.state = {}), h.context = M2, h.__n = i2, p2 = h.__d = true, h.__h = [], h._sb = []), S2 && null == h.__s && (h.__s = h.state), S2 && null != j2.getDerivedStateFromProps && (h.__s == h.state && (h.__s = w({}, h.__s)), w(h.__s, j2.getDerivedStateFromProps(b, h.__s))), v2 = h.props, y2 = h.state, h.__v = t2, p2) S2 && null == j2.getDerivedStateFromProps && null != h.componentWillMount && h.componentWillMount(), S2 && null != h.componentDidMount && h.__h.push(h.componentDidMount);
|
|
141
|
+
else {
|
|
142
|
+
if (S2 && null == j2.getDerivedStateFromProps && b !== v2 && null != h.componentWillReceiveProps && h.componentWillReceiveProps(b, M2), !h.__e && (null != h.shouldComponentUpdate && false === h.shouldComponentUpdate(b, h.__s, M2) || t2.__v == u.__v)) {
|
|
143
|
+
for (t2.__v != u.__v && (h.props = b, h.state = h.__s, h.__d = false), t2.__e = u.__e, t2.__k = u.__k, t2.__k.some(function(n3) {
|
|
144
|
+
n3 && (n3.__ = t2);
|
|
145
|
+
}), $2 = 0; $2 < h._sb.length; $2++) h.__h.push(h._sb[$2]);
|
|
146
|
+
h._sb = [], h.__h.length && e2.push(h);
|
|
147
|
+
break n;
|
|
148
|
+
}
|
|
149
|
+
null != h.componentWillUpdate && h.componentWillUpdate(b, h.__s, M2), S2 && null != h.componentDidUpdate && h.__h.push(function() {
|
|
150
|
+
h.componentDidUpdate(v2, y2, _2);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (h.context = M2, h.props = b, h.__P = n2, h.__e = false, P2 = l.__r, A2 = 0, S2) {
|
|
154
|
+
for (h.state = h.__s, h.__d = false, P2 && P2(t2), a2 = h.render(h.props, h.state, h.context), H = 0; H < h._sb.length; H++) h.__h.push(h._sb[H]);
|
|
155
|
+
h._sb = [];
|
|
156
|
+
} else do {
|
|
157
|
+
h.__d = false, P2 && P2(t2), a2 = h.render(h.props, h.state, h.context), h.state = h.__s;
|
|
158
|
+
} while (h.__d && ++A2 < 25);
|
|
159
|
+
h.state = h.__s, null != h.getChildContext && (i2 = w(w({}, i2), h.getChildContext())), S2 && !p2 && null != h.getSnapshotBeforeUpdate && (_2 = h.getSnapshotBeforeUpdate(v2, y2)), L2 = a2, null != a2 && a2.type === k && null == a2.key && (L2 = N(a2.props.children)), f2 = I(n2, d(L2) ? L2 : [L2], t2, u, i2, r2, o2, e2, f2, c2, s2), h.base = t2.__e, t2.__u &= -161, h.__h.length && e2.push(h), m2 && (h.__E = h.__ = null);
|
|
160
|
+
} catch (n3) {
|
|
161
|
+
if (t2.__v = null, c2 || null != o2) if (n3.then) {
|
|
162
|
+
for (t2.__u |= c2 ? 160 : 128; f2 && 8 == f2.nodeType && f2.nextSibling; ) f2 = f2.nextSibling;
|
|
163
|
+
o2[o2.indexOf(f2)] = null, t2.__e = f2;
|
|
164
|
+
} else for (T2 = o2.length; T2--; ) g(o2[T2]);
|
|
165
|
+
else t2.__e = u.__e, t2.__k = u.__k;
|
|
166
|
+
l.__e(n3, t2, u);
|
|
167
|
+
}
|
|
168
|
+
else null == o2 && t2.__v == u.__v ? (t2.__k = u.__k, t2.__e = u.__e) : f2 = t2.__e = V(u.__e, t2, u, i2, r2, o2, e2, c2, s2);
|
|
169
|
+
return (a2 = l.diffed) && a2(t2), 128 & t2.__u ? void 0 : f2;
|
|
170
|
+
}
|
|
171
|
+
function z(n2, t2, u) {
|
|
172
|
+
for (var i2 = 0; i2 < u.length; i2++) q(u[i2], u[++i2], u[++i2]);
|
|
173
|
+
l.__c && l.__c(t2, n2), n2.some(function(t3) {
|
|
174
|
+
try {
|
|
175
|
+
n2 = t3.__h, t3.__h = [], n2.some(function(n3) {
|
|
176
|
+
n3.call(t3);
|
|
177
|
+
});
|
|
178
|
+
} catch (n3) {
|
|
179
|
+
l.__e(n3, t3.__v);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function N(n2) {
|
|
184
|
+
return "object" != typeof n2 || null == n2 ? n2 : d(n2) ? n2.map(N) : w({}, n2);
|
|
185
|
+
}
|
|
186
|
+
function V(t2, u, i2, r2, o2, e2, f2, c2, s2) {
|
|
187
|
+
var a2, h, v2, y2, w2, _2, m2, b = i2.props, k2 = u.props, x2 = u.type;
|
|
188
|
+
if ("svg" == x2 ? o2 = "http://www.w3.org/2000/svg" : "math" == x2 ? o2 = "http://www.w3.org/1998/Math/MathML" : o2 || (o2 = "http://www.w3.org/1999/xhtml"), null != e2) {
|
|
189
|
+
for (a2 = 0; a2 < e2.length; a2++) if ((w2 = e2[a2]) && "setAttribute" in w2 == !!x2 && (x2 ? w2.localName == x2 : 3 == w2.nodeType)) {
|
|
190
|
+
t2 = w2, e2[a2] = null;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (null == t2) {
|
|
195
|
+
if (null == x2) return document.createTextNode(k2);
|
|
196
|
+
t2 = document.createElementNS(o2, x2, k2.is && k2), c2 && (l.__m && l.__m(u, e2), c2 = false), e2 = null;
|
|
197
|
+
}
|
|
198
|
+
if (null === x2) b === k2 || c2 && t2.data === k2 || (t2.data = k2);
|
|
199
|
+
else {
|
|
200
|
+
if (e2 = e2 && n.call(t2.childNodes), b = i2.props || p, !c2 && null != e2) for (b = {}, a2 = 0; a2 < t2.attributes.length; a2++) b[(w2 = t2.attributes[a2]).name] = w2.value;
|
|
201
|
+
for (a2 in b) if (w2 = b[a2], "children" == a2) ;
|
|
202
|
+
else if ("dangerouslySetInnerHTML" == a2) v2 = w2;
|
|
203
|
+
else if (!(a2 in k2)) {
|
|
204
|
+
if ("value" == a2 && "defaultValue" in k2 || "checked" == a2 && "defaultChecked" in k2) continue;
|
|
205
|
+
j(t2, a2, null, w2, o2);
|
|
206
|
+
}
|
|
207
|
+
for (a2 in k2) w2 = k2[a2], "children" == a2 ? y2 = w2 : "dangerouslySetInnerHTML" == a2 ? h = w2 : "value" == a2 ? _2 = w2 : "checked" == a2 ? m2 = w2 : c2 && "function" != typeof w2 || b[a2] === w2 || j(t2, a2, w2, b[a2], o2);
|
|
208
|
+
if (h) c2 || v2 && (h.__html === v2.__html || h.__html === t2.innerHTML) || (t2.innerHTML = h.__html), u.__k = [];
|
|
209
|
+
else if (v2 && (t2.innerHTML = ""), I("template" === u.type ? t2.content : t2, d(y2) ? y2 : [y2], u, i2, r2, "foreignObject" == x2 ? "http://www.w3.org/1999/xhtml" : o2, e2, f2, e2 ? e2[0] : i2.__k && S$1(i2, 0), c2, s2), null != e2) for (a2 = e2.length; a2--; ) g(e2[a2]);
|
|
210
|
+
c2 || (a2 = "value", "progress" == x2 && null == _2 ? t2.removeAttribute("value") : void 0 !== _2 && (_2 !== t2[a2] || "progress" == x2 && !_2 || "option" == x2 && _2 !== b[a2]) && j(t2, a2, _2, b[a2], o2), a2 = "checked", void 0 !== m2 && m2 !== t2[a2] && j(t2, a2, m2, b[a2], o2));
|
|
211
|
+
}
|
|
212
|
+
return t2;
|
|
213
|
+
}
|
|
214
|
+
function q(n2, t2, u) {
|
|
215
|
+
try {
|
|
216
|
+
if ("function" == typeof n2) {
|
|
217
|
+
var i2 = "function" == typeof n2.__u;
|
|
218
|
+
i2 && n2.__u(), i2 && null == t2 || (n2.__u = n2(t2));
|
|
219
|
+
} else n2.current = t2;
|
|
220
|
+
} catch (n3) {
|
|
221
|
+
l.__e(n3, u);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function B(n2, t2, u) {
|
|
225
|
+
var i2, r2;
|
|
226
|
+
if (l.unmount && l.unmount(n2), (i2 = n2.ref) && (i2.current && i2.current !== n2.__e || q(i2, null, t2)), null != (i2 = n2.__c)) {
|
|
227
|
+
if (i2.componentWillUnmount) try {
|
|
228
|
+
i2.componentWillUnmount();
|
|
229
|
+
} catch (n3) {
|
|
230
|
+
l.__e(n3, t2);
|
|
231
|
+
}
|
|
232
|
+
i2.base = i2.__P = null;
|
|
233
|
+
}
|
|
234
|
+
if (i2 = n2.__k) for (r2 = 0; r2 < i2.length; r2++) i2[r2] && B(i2[r2], t2, u || "function" != typeof n2.type);
|
|
235
|
+
u || g(n2.__e), n2.__c = n2.__ = n2.__e = void 0;
|
|
236
|
+
}
|
|
237
|
+
function D(n2, l2, t2) {
|
|
238
|
+
return this.constructor(n2, t2);
|
|
239
|
+
}
|
|
240
|
+
function E(t2, u, i2) {
|
|
241
|
+
var r2, o2, e2, f2;
|
|
242
|
+
u == document && (u = document.documentElement), l.__ && l.__(t2, u), o2 = (r2 = "function" == typeof i2) ? null : i2 && i2.__k || u.__k, e2 = [], f2 = [], O(u, t2 = (!r2 && i2 || u).__k = _(k, null, [t2]), o2 || p, p, u.namespaceURI, !r2 && i2 ? [i2] : o2 ? null : u.firstChild ? n.call(u.childNodes) : null, e2, !r2 && i2 ? i2 : o2 ? o2.__e : u.firstChild, r2, f2), z(e2, t2, f2);
|
|
243
|
+
}
|
|
244
|
+
function G(n2, l2) {
|
|
245
|
+
E(n2, l2, G);
|
|
246
|
+
}
|
|
247
|
+
function J(l2, t2, u) {
|
|
248
|
+
var i2, r2, o2, e2, f2 = w({}, l2.props);
|
|
249
|
+
for (o2 in l2.type && l2.type.defaultProps && (e2 = l2.type.defaultProps), t2) "key" == o2 ? i2 = t2[o2] : "ref" == o2 ? r2 = t2[o2] : f2[o2] = void 0 === t2[o2] && void 0 !== e2 ? e2[o2] : t2[o2];
|
|
250
|
+
return arguments.length > 2 && (f2.children = arguments.length > 3 ? n.call(arguments, 2) : u), m(l2.type, f2, i2 || l2.key, r2 || l2.ref, null);
|
|
251
|
+
}
|
|
252
|
+
n = v.slice, l = { __e: function(n2, l2, t2, u) {
|
|
253
|
+
for (var i2, r2, o2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try {
|
|
254
|
+
if ((r2 = i2.constructor) && null != r2.getDerivedStateFromError && (i2.setState(r2.getDerivedStateFromError(n2)), o2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, u || {}), o2 = i2.__d), o2) return i2.__E = i2;
|
|
255
|
+
} catch (l3) {
|
|
256
|
+
n2 = l3;
|
|
257
|
+
}
|
|
258
|
+
throw n2;
|
|
259
|
+
} }, t = 0, x$1.prototype.setState = function(n2, l2) {
|
|
260
|
+
var t2;
|
|
261
|
+
t2 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = w({}, this.state), "function" == typeof n2 && (n2 = n2(w({}, t2), this.props)), n2 && w(t2, n2), null != n2 && this.__v && (l2 && this._sb.push(l2), M(this));
|
|
262
|
+
}, x$1.prototype.forceUpdate = function(n2) {
|
|
263
|
+
this.__v && (this.__e = true, n2 && this.__h.push(n2), M(this));
|
|
264
|
+
}, x$1.prototype.render = k, i = [], o = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e = function(n2, l2) {
|
|
265
|
+
return n2.__v.__b - l2.__v.__b;
|
|
266
|
+
}, $.__r = 0, f = /(PointerCapture)$|Capture$/i, c = 0, s = F(false), a = F(true);
|
|
22
267
|
(function() {
|
|
23
268
|
try {
|
|
24
269
|
if (typeof document != "undefined") {
|
|
@@ -26,8 +271,8 @@ const collectStyles = (globalManager) => {
|
|
|
26
271
|
elementStyle.appendChild(document.createTextNode("._fragment_1c708_1 {\n width: 100%;\n height: 100%;\n}\n\n._fragmentDocument_1c708_6 {\n display: contents;\n}\n._text_1liuf_1 {\n white-space: pre;\n :where(p) {\n margin: 0;\n }\n}"));
|
|
27
272
|
document.head.appendChild(elementStyle);
|
|
28
273
|
}
|
|
29
|
-
} catch (
|
|
30
|
-
console.error("vite-plugin-css-injected-by-js",
|
|
274
|
+
} catch (e2) {
|
|
275
|
+
console.error("vite-plugin-css-injected-by-js", e2);
|
|
31
276
|
}
|
|
32
277
|
})();
|
|
33
278
|
const createConstants = (...constants) => {
|
|
@@ -40,6 +285,7 @@ const nodes = createConstants(
|
|
|
40
285
|
"Fragment",
|
|
41
286
|
"FragmentInstance",
|
|
42
287
|
"Instance",
|
|
288
|
+
"Collection",
|
|
43
289
|
"Breakpoint",
|
|
44
290
|
"Frame",
|
|
45
291
|
"Image",
|
|
@@ -52,14 +298,9 @@ const nodes = createConstants(
|
|
|
52
298
|
);
|
|
53
299
|
const fragmentGrowingMode = createConstants("auto", "fill");
|
|
54
300
|
const borderType = createConstants("None", "Solid", "Dashed", "Dotted");
|
|
55
|
-
const linkTarget = createConstants("_blank");
|
|
301
|
+
const linkTarget = createConstants("_blank", "none");
|
|
56
302
|
const paintMode = createConstants("None", "Solid", "Image");
|
|
57
|
-
const imagePaintScaleModes = createConstants(
|
|
58
|
-
"Fill",
|
|
59
|
-
"Fit",
|
|
60
|
-
"Crop",
|
|
61
|
-
"Tile"
|
|
62
|
-
);
|
|
303
|
+
const imagePaintScaleModes = createConstants("Auto", "Contain", "Cover");
|
|
63
304
|
const constrain = createConstants(
|
|
64
305
|
"Min",
|
|
65
306
|
"Center",
|
|
@@ -101,6 +342,7 @@ const effectName = createConstants(
|
|
|
101
342
|
const variableType = createConstants(
|
|
102
343
|
"Event",
|
|
103
344
|
"String",
|
|
345
|
+
"Link",
|
|
104
346
|
"Boolean",
|
|
105
347
|
"Array",
|
|
106
348
|
"Color",
|
|
@@ -108,6 +350,7 @@ const variableType = createConstants(
|
|
|
108
350
|
"Date",
|
|
109
351
|
"Enum",
|
|
110
352
|
"Number",
|
|
353
|
+
"Image",
|
|
111
354
|
"Object"
|
|
112
355
|
);
|
|
113
356
|
const whiteSpace = createConstants(
|
|
@@ -144,8 +387,14 @@ const variableTransforms = createConstants(
|
|
|
144
387
|
);
|
|
145
388
|
const renderTarget = createConstants("canvas", "document");
|
|
146
389
|
const renderMode = createConstants("viewport", "parent", "fixed");
|
|
147
|
-
const interactions = createConstants("click", "mouseover");
|
|
148
|
-
const eventMode = createConstants("goal", "callback");
|
|
390
|
+
const interactions = createConstants("click", "mouseover", "appear");
|
|
391
|
+
const eventMode = createConstants("goal", "callback", "tracker");
|
|
392
|
+
const scopeTypes = createConstants(
|
|
393
|
+
"InstanceScope",
|
|
394
|
+
"FragmentScope",
|
|
395
|
+
"CollectionScope",
|
|
396
|
+
"CollectionItemScope"
|
|
397
|
+
);
|
|
149
398
|
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
150
399
|
__proto__: null,
|
|
151
400
|
borderType,
|
|
@@ -168,6 +417,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
168
417
|
positionType,
|
|
169
418
|
renderMode,
|
|
170
419
|
renderTarget,
|
|
420
|
+
scopeTypes,
|
|
171
421
|
sizing,
|
|
172
422
|
textDecorations,
|
|
173
423
|
textTransform,
|
|
@@ -953,13 +1203,13 @@ const linkValidator = /* @__PURE__ */ check(
|
|
|
953
1203
|
return !!value && ((_b = (_a = value == null ? void 0 : value.split) == null ? void 0 : _a.call(value, ":")) == null ? void 0 : _b.length) === 2;
|
|
954
1204
|
}
|
|
955
1205
|
);
|
|
956
|
-
const isLink = (value) => {
|
|
1206
|
+
const isLink$1 = (value) => {
|
|
957
1207
|
var _a;
|
|
958
1208
|
return (_a = /* @__PURE__ */ safeParse(linkValidator, value)) == null ? void 0 : _a.success;
|
|
959
1209
|
};
|
|
960
|
-
const isVariableLink = (value) => {
|
|
1210
|
+
const isVariableLink$1 = (value) => {
|
|
961
1211
|
var _a, _b;
|
|
962
|
-
return isLink(value) && ((_b = (_a = value == null ? void 0 : value.split) == null ? void 0 : _a.call(value, ":")) == null ? void 0 : _b.at(0)) === nodes.Variable;
|
|
1212
|
+
return isLink$1(value) && ((_b = (_a = value == null ? void 0 : value.split) == null ? void 0 : _a.call(value, ":")) == null ? void 0 : _b.at(0)) === nodes.Variable;
|
|
963
1213
|
};
|
|
964
1214
|
const getMetadata = (schema) => {
|
|
965
1215
|
var _a;
|
|
@@ -967,9 +1217,17 @@ const getMetadata = (schema) => {
|
|
|
967
1217
|
return ((_a = pipelines == null ? void 0 : pipelines.find((pipe2) => /* @__PURE__ */ isOfKind("metadata", pipe2))) == null ? void 0 : _a.metadata) ?? null;
|
|
968
1218
|
};
|
|
969
1219
|
const layerField = (schema, meta) => {
|
|
970
|
-
const
|
|
1220
|
+
const overridable = (meta == null ? void 0 : meta.overridable) ?? true;
|
|
1221
|
+
const variable = (meta == null ? void 0 : meta.variable) ?? false;
|
|
1222
|
+
const schemaParts = [schema];
|
|
1223
|
+
if (variable) {
|
|
1224
|
+
schemaParts.push(/* @__PURE__ */ pipe(/* @__PURE__ */ string(), linkValidator));
|
|
1225
|
+
}
|
|
1226
|
+
if (overridable) {
|
|
1227
|
+
schemaParts.push(/* @__PURE__ */ any());
|
|
1228
|
+
}
|
|
971
1229
|
return /* @__PURE__ */ pipe(
|
|
972
|
-
/* @__PURE__ */ optional(
|
|
1230
|
+
/* @__PURE__ */ optional(/* @__PURE__ */ union(schemaParts)),
|
|
973
1231
|
/* @__PURE__ */ transform((meta == null ? void 0 : meta.transform) ?? ((v2) => v2)),
|
|
974
1232
|
/* @__PURE__ */ metadata(meta ?? {})
|
|
975
1233
|
);
|
|
@@ -992,8 +1250,28 @@ const PositionSchema = /* @__PURE__ */ object({
|
|
|
992
1250
|
position: layerField(/* @__PURE__ */ enum_(Object.keys(positionType)), {
|
|
993
1251
|
fallback: positionType.absolute
|
|
994
1252
|
}),
|
|
995
|
-
top: layerField(/* @__PURE__ */ number(), {
|
|
996
|
-
|
|
1253
|
+
top: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
1254
|
+
fallback: null,
|
|
1255
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1256
|
+
}),
|
|
1257
|
+
left: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
1258
|
+
fallback: null,
|
|
1259
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1260
|
+
}),
|
|
1261
|
+
right: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
1262
|
+
fallback: null,
|
|
1263
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1264
|
+
}),
|
|
1265
|
+
bottom: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
1266
|
+
fallback: null,
|
|
1267
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1268
|
+
}),
|
|
1269
|
+
centerAnchorX: layerField(/* @__PURE__ */ number(), {
|
|
1270
|
+
fallback: 0.5
|
|
1271
|
+
}),
|
|
1272
|
+
centerAnchorY: layerField(/* @__PURE__ */ number(), {
|
|
1273
|
+
fallback: 0.5
|
|
1274
|
+
})
|
|
997
1275
|
});
|
|
998
1276
|
const SceneSchema = /* @__PURE__ */ object({
|
|
999
1277
|
opacity: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0), /* @__PURE__ */ maxValue(1)), {
|
|
@@ -1001,6 +1279,7 @@ const SceneSchema = /* @__PURE__ */ object({
|
|
|
1001
1279
|
variable: true
|
|
1002
1280
|
}),
|
|
1003
1281
|
visible: layerField(/* @__PURE__ */ boolean(), { fallback: true, variable: true }),
|
|
1282
|
+
rotate: layerField(/* @__PURE__ */ number(), { fallback: null }),
|
|
1004
1283
|
zIndex: layerField(/* @__PURE__ */ number(), { fallback: -1 })
|
|
1005
1284
|
});
|
|
1006
1285
|
const FillSchema = /* @__PURE__ */ object({
|
|
@@ -1010,14 +1289,22 @@ const FillSchema = /* @__PURE__ */ object({
|
|
|
1010
1289
|
solidFill: layerField(/* @__PURE__ */ string(), { fallback: "#fff" }),
|
|
1011
1290
|
imageFill: layerField(/* @__PURE__ */ string()),
|
|
1012
1291
|
imageSize: layerField(/* @__PURE__ */ picklist(Object.keys(imagePaintScaleModes)), {
|
|
1013
|
-
fallback: imagePaintScaleModes.
|
|
1292
|
+
fallback: imagePaintScaleModes.Auto
|
|
1014
1293
|
})
|
|
1015
1294
|
});
|
|
1016
1295
|
const BorderSchema = /* @__PURE__ */ object({
|
|
1017
1296
|
borderType: layerField(/* @__PURE__ */ picklist(Object.keys(borderType)), {
|
|
1018
1297
|
fallback: borderType.None
|
|
1019
1298
|
}),
|
|
1020
|
-
borderWidth: layerField(/* @__PURE__ */
|
|
1299
|
+
borderWidth: layerField(/* @__PURE__ */ string(), {
|
|
1300
|
+
fallback: "1px",
|
|
1301
|
+
transform: (value) => {
|
|
1302
|
+
if (typeof value === "number") {
|
|
1303
|
+
return `${value}px`;
|
|
1304
|
+
}
|
|
1305
|
+
return value;
|
|
1306
|
+
}
|
|
1307
|
+
}),
|
|
1021
1308
|
borderColor: layerField(/* @__PURE__ */ string(), { fallback: "#fff" })
|
|
1022
1309
|
});
|
|
1023
1310
|
const SizeSchema = /* @__PURE__ */ object({
|
|
@@ -1100,6 +1387,15 @@ const InteractionsSchema = /* @__PURE__ */ object({
|
|
|
1100
1387
|
const CssOverrideSchema = /* @__PURE__ */ object({
|
|
1101
1388
|
cssOverride: layerField(/* @__PURE__ */ string(), { fallback: "" })
|
|
1102
1389
|
});
|
|
1390
|
+
const LinkSchema = /* @__PURE__ */ object({
|
|
1391
|
+
href: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1392
|
+
hrefNewTab: layerField(/* @__PURE__ */ boolean(), {
|
|
1393
|
+
fallback: true
|
|
1394
|
+
})
|
|
1395
|
+
// hrefTarget: layerField(v.picklist(Object.keys(linkTarget)), {
|
|
1396
|
+
// fallback: linkTarget._blank,
|
|
1397
|
+
// }),
|
|
1398
|
+
});
|
|
1103
1399
|
const FrameSchema = /* @__PURE__ */ pipe(
|
|
1104
1400
|
/* @__PURE__ */ object({
|
|
1105
1401
|
name: layerField(/* @__PURE__ */ string(), { fallback: "Frame", overridable: false }),
|
|
@@ -1120,6 +1416,7 @@ const FrameSchema = /* @__PURE__ */ pipe(
|
|
|
1120
1416
|
...LayerSchema.entries,
|
|
1121
1417
|
...InteractionsSchema.entries,
|
|
1122
1418
|
...CssOverrideSchema.entries,
|
|
1419
|
+
...LinkSchema.entries,
|
|
1123
1420
|
overflow: OverflowSchema,
|
|
1124
1421
|
borderRadius: BorderRadiusSchema
|
|
1125
1422
|
})
|
|
@@ -1132,33 +1429,22 @@ const TextSchema = /* @__PURE__ */ object({
|
|
|
1132
1429
|
whiteSpace: layerField(/* @__PURE__ */ enum_(Object.keys(whiteSpace)), {
|
|
1133
1430
|
fallback: whiteSpace.pre
|
|
1134
1431
|
}),
|
|
1135
|
-
|
|
1432
|
+
textAlign: layerField(/* @__PURE__ */ string(), { fallback: "left" }),
|
|
1136
1433
|
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1137
|
-
attributes: layerField(
|
|
1138
|
-
/* @__PURE__ */ object({
|
|
1139
|
-
fontSize: layerField(/* @__PURE__ */ string(), { fallback: "14px" }),
|
|
1140
|
-
color: layerField(/* @__PURE__ */ string(), { fallback: "#000" }),
|
|
1141
|
-
lineHeight: layerField(/* @__PURE__ */ string(), { fallback: "14px" }),
|
|
1142
|
-
fontWeight: layerField(/* @__PURE__ */ string(), { fallback: "normal" }),
|
|
1143
|
-
letterSpacing: layerField(/* @__PURE__ */ string(), { fallback: "0px" }),
|
|
1144
|
-
textTransform: layerField(/* @__PURE__ */ string(), { fallback: "none" }),
|
|
1145
|
-
textDecoration: layerField(/* @__PURE__ */ string(), { fallback: "none" }),
|
|
1146
|
-
whiteSpace: layerField(/* @__PURE__ */ string(), { fallback: "pre" }),
|
|
1147
|
-
textAlign: layerField(/* @__PURE__ */ string(), { fallback: "left" })
|
|
1148
|
-
}),
|
|
1149
|
-
{ fallback: {} }
|
|
1150
|
-
),
|
|
1151
1434
|
...GraphFieldSchema.entries,
|
|
1152
1435
|
...OverridesSchema.entries,
|
|
1436
|
+
...CssOverrideSchema.entries,
|
|
1153
1437
|
...PositionSchema.entries,
|
|
1154
1438
|
...SceneSchema.entries,
|
|
1155
|
-
...SizeSchema.entries
|
|
1439
|
+
...SizeSchema.entries,
|
|
1440
|
+
...InteractionsSchema.entries,
|
|
1441
|
+
...LinkSchema.entries
|
|
1156
1442
|
});
|
|
1157
1443
|
const FragmentSchema = /* @__PURE__ */ object({
|
|
1158
1444
|
name: layerField(/* @__PURE__ */ string(), { fallback: "Fragment", overridable: false }),
|
|
1159
1445
|
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1160
1446
|
horizontalGrow: layerField(/* @__PURE__ */ enum_(Object.keys(fragmentGrowingMode)), {
|
|
1161
|
-
fallback: fragmentGrowingMode.
|
|
1447
|
+
fallback: fragmentGrowingMode.fill,
|
|
1162
1448
|
overridable: false
|
|
1163
1449
|
}),
|
|
1164
1450
|
verticalGrow: layerField(/* @__PURE__ */ enum_(Object.keys(fragmentGrowingMode)), {
|
|
@@ -1198,13 +1484,17 @@ const InstanceSchema = /* @__PURE__ */ object({
|
|
|
1198
1484
|
...OverridesSchema.entries,
|
|
1199
1485
|
...PositionSchema.entries,
|
|
1200
1486
|
...SizeSchema.entries,
|
|
1201
|
-
...SceneSchema.entries
|
|
1487
|
+
...SceneSchema.entries,
|
|
1488
|
+
...InteractionsSchema.entries,
|
|
1489
|
+
...LinkSchema.entries
|
|
1202
1490
|
});
|
|
1203
1491
|
const NumberVariableSchema = /* @__PURE__ */ object({
|
|
1492
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1204
1493
|
name: layerField(/* @__PURE__ */ string(), {
|
|
1205
1494
|
fallback: "Number",
|
|
1206
1495
|
overridable: false
|
|
1207
1496
|
}),
|
|
1497
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1208
1498
|
type: layerField(/* @__PURE__ */ literal(variableType.Number), {
|
|
1209
1499
|
fallback: variableType.Number
|
|
1210
1500
|
}),
|
|
@@ -1217,10 +1507,12 @@ const NumberVariableSchema = /* @__PURE__ */ object({
|
|
|
1217
1507
|
...GraphFieldSchema.entries
|
|
1218
1508
|
});
|
|
1219
1509
|
const BooleanVariableSchema = /* @__PURE__ */ object({
|
|
1510
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1220
1511
|
name: layerField(/* @__PURE__ */ string(), {
|
|
1221
1512
|
fallback: "Boolean",
|
|
1222
1513
|
overridable: false
|
|
1223
1514
|
}),
|
|
1515
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1224
1516
|
type: layerField(/* @__PURE__ */ literal(variableType.Boolean), {
|
|
1225
1517
|
fallback: variableType.Boolean
|
|
1226
1518
|
}),
|
|
@@ -1229,10 +1521,12 @@ const BooleanVariableSchema = /* @__PURE__ */ object({
|
|
|
1229
1521
|
...GraphFieldSchema.entries
|
|
1230
1522
|
});
|
|
1231
1523
|
const ColorVariableSchema = /* @__PURE__ */ object({
|
|
1524
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1232
1525
|
name: layerField(/* @__PURE__ */ string(), {
|
|
1233
1526
|
fallback: "String",
|
|
1234
1527
|
overridable: false
|
|
1235
1528
|
}),
|
|
1529
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1236
1530
|
type: layerField(/* @__PURE__ */ literal(variableType.Color), {
|
|
1237
1531
|
fallback: variableType.Color
|
|
1238
1532
|
}),
|
|
@@ -1242,6 +1536,7 @@ const ColorVariableSchema = /* @__PURE__ */ object({
|
|
|
1242
1536
|
...GraphFieldSchema.entries
|
|
1243
1537
|
});
|
|
1244
1538
|
const StringVariableSchema = /* @__PURE__ */ object({
|
|
1539
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1245
1540
|
name: layerField(/* @__PURE__ */ string(), {
|
|
1246
1541
|
fallback: "String",
|
|
1247
1542
|
overridable: false
|
|
@@ -1249,6 +1544,7 @@ const StringVariableSchema = /* @__PURE__ */ object({
|
|
|
1249
1544
|
type: layerField(/* @__PURE__ */ literal(variableType.String), {
|
|
1250
1545
|
fallback: variableType.String
|
|
1251
1546
|
}),
|
|
1547
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1252
1548
|
defaultValue: layerField(/* @__PURE__ */ string(), { fallback: "" }),
|
|
1253
1549
|
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1254
1550
|
placeholder: layerField(/* @__PURE__ */ string(), { fallback: "" }),
|
|
@@ -1256,10 +1552,12 @@ const StringVariableSchema = /* @__PURE__ */ object({
|
|
|
1256
1552
|
...GraphFieldSchema.entries
|
|
1257
1553
|
});
|
|
1258
1554
|
const EventVariableSchema = /* @__PURE__ */ object({
|
|
1555
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1259
1556
|
name: layerField(/* @__PURE__ */ string(), {
|
|
1260
1557
|
fallback: "Event",
|
|
1261
1558
|
overridable: false
|
|
1262
1559
|
}),
|
|
1560
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1263
1561
|
type: layerField(/* @__PURE__ */ literal(variableType.Event), {
|
|
1264
1562
|
fallback: variableType.Event
|
|
1265
1563
|
}),
|
|
@@ -1270,28 +1568,141 @@ const EventVariableSchema = /* @__PURE__ */ object({
|
|
|
1270
1568
|
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1271
1569
|
...GraphFieldSchema.entries
|
|
1272
1570
|
});
|
|
1571
|
+
const LinkVariableSchema = /* @__PURE__ */ object({
|
|
1572
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1573
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1574
|
+
fallback: "Link",
|
|
1575
|
+
overridable: false
|
|
1576
|
+
}),
|
|
1577
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1578
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Link), {
|
|
1579
|
+
fallback: variableType.Link
|
|
1580
|
+
}),
|
|
1581
|
+
defaultValue: layerField(/* @__PURE__ */ string(), { fallback: "" }),
|
|
1582
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1583
|
+
...GraphFieldSchema.entries
|
|
1584
|
+
});
|
|
1585
|
+
const EnumVariableSchema = /* @__PURE__ */ object({
|
|
1586
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1587
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1588
|
+
fallback: "Option",
|
|
1589
|
+
overridable: false
|
|
1590
|
+
}),
|
|
1591
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1592
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Enum), {
|
|
1593
|
+
fallback: variableType.Enum
|
|
1594
|
+
}),
|
|
1595
|
+
defaultValue: layerField(/* @__PURE__ */ string(), { fallback: "" }),
|
|
1596
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1597
|
+
cases: layerField(
|
|
1598
|
+
/* @__PURE__ */ array(
|
|
1599
|
+
/* @__PURE__ */ object({
|
|
1600
|
+
id: /* @__PURE__ */ string(),
|
|
1601
|
+
name: /* @__PURE__ */ string()
|
|
1602
|
+
})
|
|
1603
|
+
),
|
|
1604
|
+
{ fallback: [] }
|
|
1605
|
+
),
|
|
1606
|
+
...GraphFieldSchema.entries
|
|
1607
|
+
});
|
|
1608
|
+
const ObjectVariableSchema = /* @__PURE__ */ object({
|
|
1609
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1610
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1611
|
+
fallback: "Object",
|
|
1612
|
+
overridable: false
|
|
1613
|
+
}),
|
|
1614
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Object), {
|
|
1615
|
+
fallback: variableType.Object
|
|
1616
|
+
}),
|
|
1617
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1618
|
+
defaultValue: layerField(/* @__PURE__ */ object({}), { fallback: {} }),
|
|
1619
|
+
fields: layerField(/* @__PURE__ */ record(/* @__PURE__ */ string(), linkValidator), { fallback: {} }),
|
|
1620
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1621
|
+
...GraphFieldSchema.entries
|
|
1622
|
+
});
|
|
1623
|
+
const ImageVariableSchema = /* @__PURE__ */ object({
|
|
1624
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1625
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1626
|
+
fallback: "Image",
|
|
1627
|
+
overridable: false
|
|
1628
|
+
}),
|
|
1629
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Image), {
|
|
1630
|
+
fallback: variableType.Image
|
|
1631
|
+
}),
|
|
1632
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1633
|
+
defaultValue: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1634
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1635
|
+
imageSize: layerField(/* @__PURE__ */ picklist(Object.keys(imagePaintScaleModes)), {
|
|
1636
|
+
fallback: imagePaintScaleModes.Auto
|
|
1637
|
+
}),
|
|
1638
|
+
...GraphFieldSchema.entries
|
|
1639
|
+
});
|
|
1640
|
+
const CollectionSchema = /* @__PURE__ */ pipe(
|
|
1641
|
+
/* @__PURE__ */ object({
|
|
1642
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1643
|
+
fallback: "Collection",
|
|
1644
|
+
overridable: false
|
|
1645
|
+
}),
|
|
1646
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1647
|
+
source: layerField(linkValidator, {}),
|
|
1648
|
+
...ChildrenSchema.entries,
|
|
1649
|
+
...GraphFieldSchema.entries,
|
|
1650
|
+
...OverridesSchema.entries,
|
|
1651
|
+
...PositionSchema.entries,
|
|
1652
|
+
...SceneSchema.entries,
|
|
1653
|
+
...FillSchema.entries,
|
|
1654
|
+
...BorderSchema.entries,
|
|
1655
|
+
...SizeSchema.entries,
|
|
1656
|
+
...LayerSchema.entries,
|
|
1657
|
+
...InteractionsSchema.entries,
|
|
1658
|
+
...CssOverrideSchema.entries,
|
|
1659
|
+
...LinkSchema.entries
|
|
1660
|
+
})
|
|
1661
|
+
);
|
|
1662
|
+
const ArrayVariableSchema = /* @__PURE__ */ object({
|
|
1663
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1664
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1665
|
+
fallback: "Collection",
|
|
1666
|
+
overridable: false
|
|
1667
|
+
}),
|
|
1668
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Array), {
|
|
1669
|
+
fallback: variableType.Array
|
|
1670
|
+
}),
|
|
1671
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1672
|
+
defaultValue: layerField(/* @__PURE__ */ array(/* @__PURE__ */ any()), { fallback: [] }),
|
|
1673
|
+
definition: layerField(linkValidator, { fallback: null }),
|
|
1674
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1675
|
+
...GraphFieldSchema.entries
|
|
1676
|
+
});
|
|
1273
1677
|
const getLayerSchema = (layer) => {
|
|
1274
1678
|
if (!(layer == null ? void 0 : layer._type)) return null;
|
|
1275
1679
|
if ((layer == null ? void 0 : layer._type) === nodes.Frame) return FrameSchema;
|
|
1276
1680
|
if ((layer == null ? void 0 : layer._type) === nodes.Text) return TextSchema;
|
|
1277
1681
|
if ((layer == null ? void 0 : layer._type) === nodes.Fragment) return FragmentSchema;
|
|
1278
1682
|
if ((layer == null ? void 0 : layer._type) === nodes.Instance) return InstanceSchema;
|
|
1683
|
+
if ((layer == null ? void 0 : layer._type) === nodes.Collection) return CollectionSchema;
|
|
1279
1684
|
if (layer._type === nodes.Variable) {
|
|
1280
1685
|
const types = {
|
|
1281
1686
|
[variableType.Number]: NumberVariableSchema,
|
|
1282
1687
|
[variableType.Boolean]: BooleanVariableSchema,
|
|
1283
1688
|
[variableType.String]: StringVariableSchema,
|
|
1284
1689
|
[variableType.Color]: ColorVariableSchema,
|
|
1285
|
-
[variableType.Event]: EventVariableSchema
|
|
1690
|
+
[variableType.Event]: EventVariableSchema,
|
|
1691
|
+
[variableType.Link]: LinkVariableSchema,
|
|
1692
|
+
[variableType.Enum]: EnumVariableSchema,
|
|
1693
|
+
[variableType.Object]: ObjectVariableSchema,
|
|
1694
|
+
[variableType.Image]: ImageVariableSchema,
|
|
1695
|
+
[variableType.Array]: ArrayVariableSchema
|
|
1286
1696
|
};
|
|
1287
1697
|
if (layer.type in types) {
|
|
1288
1698
|
return types[layer.type];
|
|
1289
1699
|
}
|
|
1290
1700
|
}
|
|
1291
1701
|
};
|
|
1702
|
+
const isObject$1 = (x2) => !!x2 && typeof x2 === "object" && !Array.isArray(x2);
|
|
1292
1703
|
const normalizeLayer = (schema, rawLayer, options2) => {
|
|
1293
1704
|
try {
|
|
1294
|
-
if (!rawLayer) return null;
|
|
1705
|
+
if (!rawLayer || !schema.entries) return null;
|
|
1295
1706
|
const withFallback = (options2 == null ? void 0 : options2.withFallback) ?? true;
|
|
1296
1707
|
const overrideTarget = options2 == null ? void 0 : options2.overrideTarget;
|
|
1297
1708
|
const parsedLayer = parse(schema, rawLayer);
|
|
@@ -1300,35 +1711,62 @@ const normalizeLayer = (schema, rawLayer, options2) => {
|
|
|
1300
1711
|
const schemaMeta = getMetadata(schemaEntity);
|
|
1301
1712
|
const fallback = withFallback ? schemaMeta == null ? void 0 : schemaMeta.fallback : null;
|
|
1302
1713
|
const overrideValue = (schemaMeta == null ? void 0 : schemaMeta.overridable) !== false && overrideTarget ? overrideTarget == null ? void 0 : overrideTarget[key] : null;
|
|
1303
|
-
|
|
1714
|
+
let layerValue = parsedLayer[key];
|
|
1715
|
+
if (isObject$1(layerValue) && isObject$1(overrideValue)) {
|
|
1716
|
+
layerValue = { ...overrideValue, ...layerValue };
|
|
1717
|
+
}
|
|
1718
|
+
if (schemaEntity && "wrapped" in schemaEntity && "entries" in schemaEntity.wrapped && isObject$1(schemaEntity.wrapped.entries)) {
|
|
1719
|
+
layerValue = normalizeLayer(
|
|
1720
|
+
schemaEntity.wrapped,
|
|
1721
|
+
layerValue,
|
|
1722
|
+
options2
|
|
1723
|
+
);
|
|
1724
|
+
}
|
|
1725
|
+
const resultValue = layerValue ?? overrideValue ?? fallback;
|
|
1304
1726
|
return [key, resultValue];
|
|
1305
1727
|
})
|
|
1306
1728
|
);
|
|
1307
|
-
} catch (
|
|
1308
|
-
console.error(
|
|
1729
|
+
} catch (e2) {
|
|
1730
|
+
console.error(e2);
|
|
1309
1731
|
return null;
|
|
1310
1732
|
}
|
|
1311
1733
|
};
|
|
1312
|
-
const getNormalizeLayer$1 = (layer, overrider) => {
|
|
1734
|
+
const getNormalizeLayer$1 = (layer, overrider, withFallback) => {
|
|
1313
1735
|
if (!layer) return null;
|
|
1314
1736
|
const schema = getLayerSchema(layer);
|
|
1315
1737
|
if (!schema) return null;
|
|
1316
1738
|
return normalizeLayer(schema, layer, {
|
|
1317
|
-
overrideTarget: overrider
|
|
1739
|
+
overrideTarget: overrider,
|
|
1740
|
+
withFallback
|
|
1318
1741
|
});
|
|
1319
1742
|
};
|
|
1743
|
+
function findSchemaByPath(schema, path) {
|
|
1744
|
+
if (!path) return void 0;
|
|
1745
|
+
const parts = path.split(".");
|
|
1746
|
+
let current = schema;
|
|
1747
|
+
for (const part of parts) {
|
|
1748
|
+
if (!current || typeof current !== "object") return void 0;
|
|
1749
|
+
if ("entries" in current) {
|
|
1750
|
+
if (!(part in current.entries)) return void 0;
|
|
1751
|
+
current = current.entries[part];
|
|
1752
|
+
} else if ("wrapped" in current && "entries" in current.wrapped) {
|
|
1753
|
+
current = current.wrapped.entries[part];
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
return current;
|
|
1757
|
+
}
|
|
1320
1758
|
const parseLayerField = (layer, field, value) => {
|
|
1321
|
-
var _a, _b;
|
|
1322
1759
|
const schema = getLayerSchema(layer);
|
|
1323
|
-
|
|
1324
|
-
|
|
1760
|
+
const fieldSchema = findSchemaByPath(schema, field);
|
|
1761
|
+
if (fieldSchema) {
|
|
1762
|
+
return /* @__PURE__ */ safeParse(fieldSchema, value);
|
|
1325
1763
|
}
|
|
1326
1764
|
return { success: false, output: value };
|
|
1327
1765
|
};
|
|
1328
1766
|
const RenderTargetContext = createContext(
|
|
1329
1767
|
index.renderTarget.document
|
|
1330
1768
|
);
|
|
1331
|
-
RenderTargetContext.Provider;
|
|
1769
|
+
const RenderTargetProvider = RenderTargetContext.Provider;
|
|
1332
1770
|
const useRenderTarget = () => {
|
|
1333
1771
|
const renderTarget2 = useContext(RenderTargetContext);
|
|
1334
1772
|
return {
|
|
@@ -1337,70 +1775,73 @@ const useRenderTarget = () => {
|
|
|
1337
1775
|
isDocument: renderTarget2 === index.renderTarget.document
|
|
1338
1776
|
};
|
|
1339
1777
|
};
|
|
1340
|
-
const FragmentContext = createContext({
|
|
1341
|
-
manager: null
|
|
1342
|
-
});
|
|
1343
1778
|
var withSelector = { exports: {} };
|
|
1344
|
-
var
|
|
1779
|
+
var withSelector_production = {};
|
|
1345
1780
|
var shim = { exports: {} };
|
|
1346
|
-
var
|
|
1781
|
+
var useSyncExternalStoreShim_production = {};
|
|
1347
1782
|
/**
|
|
1348
1783
|
* @license React
|
|
1349
|
-
* use-sync-external-store-shim.production.
|
|
1784
|
+
* use-sync-external-store-shim.production.js
|
|
1350
1785
|
*
|
|
1351
|
-
* Copyright (c)
|
|
1786
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1352
1787
|
*
|
|
1353
1788
|
* This source code is licensed under the MIT license found in the
|
|
1354
1789
|
* LICENSE file in the root directory of this source tree.
|
|
1355
1790
|
*/
|
|
1356
|
-
var
|
|
1357
|
-
function
|
|
1358
|
-
if (
|
|
1359
|
-
|
|
1360
|
-
var
|
|
1361
|
-
function
|
|
1362
|
-
return
|
|
1363
|
-
}
|
|
1364
|
-
var
|
|
1365
|
-
function
|
|
1366
|
-
var
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1791
|
+
var hasRequiredUseSyncExternalStoreShim_production;
|
|
1792
|
+
function requireUseSyncExternalStoreShim_production() {
|
|
1793
|
+
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
1794
|
+
hasRequiredUseSyncExternalStoreShim_production = 1;
|
|
1795
|
+
var React = require$$0;
|
|
1796
|
+
function is(x2, y2) {
|
|
1797
|
+
return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
|
|
1798
|
+
}
|
|
1799
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue;
|
|
1800
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
1801
|
+
var value = getSnapshot(), _useState = useState2({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
1802
|
+
useLayoutEffect(
|
|
1803
|
+
function() {
|
|
1804
|
+
inst.value = value;
|
|
1805
|
+
inst.getSnapshot = getSnapshot;
|
|
1806
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1807
|
+
},
|
|
1808
|
+
[subscribe, value, getSnapshot]
|
|
1809
|
+
);
|
|
1810
|
+
useEffect2(
|
|
1811
|
+
function() {
|
|
1812
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1813
|
+
return subscribe(function() {
|
|
1814
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1815
|
+
});
|
|
1816
|
+
},
|
|
1817
|
+
[subscribe]
|
|
1818
|
+
);
|
|
1819
|
+
useDebugValue(value);
|
|
1820
|
+
return value;
|
|
1380
1821
|
}
|
|
1381
|
-
function
|
|
1382
|
-
var
|
|
1383
|
-
|
|
1822
|
+
function checkIfSnapshotChanged(inst) {
|
|
1823
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
1824
|
+
inst = inst.value;
|
|
1384
1825
|
try {
|
|
1385
|
-
var
|
|
1386
|
-
return !
|
|
1387
|
-
} catch (
|
|
1826
|
+
var nextValue = latestGetSnapshot();
|
|
1827
|
+
return !objectIs(inst, nextValue);
|
|
1828
|
+
} catch (error) {
|
|
1388
1829
|
return true;
|
|
1389
1830
|
}
|
|
1390
1831
|
}
|
|
1391
|
-
function
|
|
1392
|
-
return
|
|
1832
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
1833
|
+
return getSnapshot();
|
|
1393
1834
|
}
|
|
1394
|
-
var
|
|
1395
|
-
|
|
1396
|
-
return
|
|
1835
|
+
var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
1836
|
+
useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim2;
|
|
1837
|
+
return useSyncExternalStoreShim_production;
|
|
1397
1838
|
}
|
|
1398
1839
|
var useSyncExternalStoreShim_development = {};
|
|
1399
1840
|
/**
|
|
1400
1841
|
* @license React
|
|
1401
1842
|
* use-sync-external-store-shim.development.js
|
|
1402
1843
|
*
|
|
1403
|
-
* Copyright (c)
|
|
1844
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1404
1845
|
*
|
|
1405
1846
|
* This source code is licensed under the MIT license found in the
|
|
1406
1847
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -1409,120 +1850,63 @@ var hasRequiredUseSyncExternalStoreShim_development;
|
|
|
1409
1850
|
function requireUseSyncExternalStoreShim_development() {
|
|
1410
1851
|
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
1411
1852
|
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
function printWarning(level, format, args) {
|
|
1430
|
-
{
|
|
1431
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1432
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
1433
|
-
if (stack !== "") {
|
|
1434
|
-
format += "%s";
|
|
1435
|
-
args = args.concat([stack]);
|
|
1436
|
-
}
|
|
1437
|
-
var argsWithFormat = args.map(function(item) {
|
|
1438
|
-
return String(item);
|
|
1439
|
-
});
|
|
1440
|
-
argsWithFormat.unshift("Warning: " + format);
|
|
1441
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
function is(x, y2) {
|
|
1445
|
-
return x === y2 && (x !== 0 || 1 / x === 1 / y2) || x !== x && y2 !== y2;
|
|
1853
|
+
"production" !== process.env.NODE_ENV && function() {
|
|
1854
|
+
function is(x2, y2) {
|
|
1855
|
+
return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
|
|
1856
|
+
}
|
|
1857
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
1858
|
+
didWarnOld18Alpha || void 0 === React.startTransition || (didWarnOld18Alpha = true, console.error(
|
|
1859
|
+
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
1860
|
+
));
|
|
1861
|
+
var value = getSnapshot();
|
|
1862
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
1863
|
+
var cachedValue = getSnapshot();
|
|
1864
|
+
objectIs(value, cachedValue) || (console.error(
|
|
1865
|
+
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
1866
|
+
), didWarnUncachedGetSnapshot = true);
|
|
1446
1867
|
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
var
|
|
1451
|
-
|
|
1452
|
-
{
|
|
1453
|
-
if (!didWarnOld18Alpha) {
|
|
1454
|
-
if (React.startTransition !== void 0) {
|
|
1455
|
-
didWarnOld18Alpha = true;
|
|
1456
|
-
error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.");
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
var value = getSnapshot();
|
|
1461
|
-
{
|
|
1462
|
-
if (!didWarnUncachedGetSnapshot) {
|
|
1463
|
-
var cachedValue = getSnapshot();
|
|
1464
|
-
if (!objectIs(value, cachedValue)) {
|
|
1465
|
-
error("The result of getSnapshot should be cached to avoid an infinite loop");
|
|
1466
|
-
didWarnUncachedGetSnapshot = true;
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
var _useState = useState2({
|
|
1471
|
-
inst: {
|
|
1472
|
-
value,
|
|
1473
|
-
getSnapshot
|
|
1474
|
-
}
|
|
1475
|
-
}), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
1476
|
-
useLayoutEffect(function() {
|
|
1868
|
+
cachedValue = useState2({
|
|
1869
|
+
inst: { value, getSnapshot }
|
|
1870
|
+
});
|
|
1871
|
+
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
1872
|
+
useLayoutEffect(
|
|
1873
|
+
function() {
|
|
1477
1874
|
inst.value = value;
|
|
1478
1875
|
inst.getSnapshot = getSnapshot;
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
forceUpdate({
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
function checkIfSnapshotChanged(inst) {
|
|
1504
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
1505
|
-
var prevValue = inst.value;
|
|
1506
|
-
try {
|
|
1507
|
-
var nextValue = latestGetSnapshot();
|
|
1508
|
-
return !objectIs(prevValue, nextValue);
|
|
1509
|
-
} catch (error2) {
|
|
1510
|
-
return true;
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
|
1514
|
-
return getSnapshot();
|
|
1515
|
-
}
|
|
1516
|
-
var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
1517
|
-
var isServerEnvironment = !canUseDOM;
|
|
1518
|
-
var shim2 = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
1519
|
-
var useSyncExternalStore$2 = React.useSyncExternalStore !== void 0 ? React.useSyncExternalStore : shim2;
|
|
1520
|
-
useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
|
|
1521
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
1522
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
1876
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1877
|
+
},
|
|
1878
|
+
[subscribe, value, getSnapshot]
|
|
1879
|
+
);
|
|
1880
|
+
useEffect2(
|
|
1881
|
+
function() {
|
|
1882
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1883
|
+
return subscribe(function() {
|
|
1884
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1885
|
+
});
|
|
1886
|
+
},
|
|
1887
|
+
[subscribe]
|
|
1888
|
+
);
|
|
1889
|
+
useDebugValue(value);
|
|
1890
|
+
return value;
|
|
1891
|
+
}
|
|
1892
|
+
function checkIfSnapshotChanged(inst) {
|
|
1893
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
1894
|
+
inst = inst.value;
|
|
1895
|
+
try {
|
|
1896
|
+
var nextValue = latestGetSnapshot();
|
|
1897
|
+
return !objectIs(inst, nextValue);
|
|
1898
|
+
} catch (error) {
|
|
1899
|
+
return true;
|
|
1523
1900
|
}
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1901
|
+
}
|
|
1902
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
1903
|
+
return getSnapshot();
|
|
1904
|
+
}
|
|
1905
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
1906
|
+
var React = require$$0, objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
1907
|
+
useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim2;
|
|
1908
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1909
|
+
}();
|
|
1526
1910
|
return useSyncExternalStoreShim_development;
|
|
1527
1911
|
}
|
|
1528
1912
|
var hasRequiredShim;
|
|
@@ -1530,7 +1914,7 @@ function requireShim() {
|
|
|
1530
1914
|
if (hasRequiredShim) return shim.exports;
|
|
1531
1915
|
hasRequiredShim = 1;
|
|
1532
1916
|
if (process.env.NODE_ENV === "production") {
|
|
1533
|
-
shim.exports =
|
|
1917
|
+
shim.exports = requireUseSyncExternalStoreShim_production();
|
|
1534
1918
|
} else {
|
|
1535
1919
|
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
1536
1920
|
}
|
|
@@ -1538,70 +1922,81 @@ function requireShim() {
|
|
|
1538
1922
|
}
|
|
1539
1923
|
/**
|
|
1540
1924
|
* @license React
|
|
1541
|
-
* use-sync-external-store-shim/with-selector.production.
|
|
1925
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
1542
1926
|
*
|
|
1543
|
-
* Copyright (c)
|
|
1927
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1544
1928
|
*
|
|
1545
1929
|
* This source code is licensed under the MIT license found in the
|
|
1546
1930
|
* LICENSE file in the root directory of this source tree.
|
|
1547
1931
|
*/
|
|
1548
|
-
var
|
|
1549
|
-
function
|
|
1550
|
-
if (
|
|
1551
|
-
|
|
1552
|
-
var
|
|
1553
|
-
function
|
|
1554
|
-
return
|
|
1555
|
-
}
|
|
1556
|
-
var
|
|
1557
|
-
|
|
1558
|
-
var
|
|
1559
|
-
if (null ===
|
|
1560
|
-
var
|
|
1561
|
-
|
|
1562
|
-
} else
|
|
1563
|
-
|
|
1564
|
-
function
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1932
|
+
var hasRequiredWithSelector_production;
|
|
1933
|
+
function requireWithSelector_production() {
|
|
1934
|
+
if (hasRequiredWithSelector_production) return withSelector_production;
|
|
1935
|
+
hasRequiredWithSelector_production = 1;
|
|
1936
|
+
var React = require$$0, shim2 = requireShim();
|
|
1937
|
+
function is(x2, y2) {
|
|
1938
|
+
return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
|
|
1939
|
+
}
|
|
1940
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim2.useSyncExternalStore, useRef2 = React.useRef, useEffect2 = React.useEffect, useMemo2 = React.useMemo, useDebugValue = React.useDebugValue;
|
|
1941
|
+
withSelector_production.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
1942
|
+
var instRef = useRef2(null);
|
|
1943
|
+
if (null === instRef.current) {
|
|
1944
|
+
var inst = { hasValue: false, value: null };
|
|
1945
|
+
instRef.current = inst;
|
|
1946
|
+
} else inst = instRef.current;
|
|
1947
|
+
instRef = useMemo2(
|
|
1948
|
+
function() {
|
|
1949
|
+
function memoizedSelector(nextSnapshot) {
|
|
1950
|
+
if (!hasMemo) {
|
|
1951
|
+
hasMemo = true;
|
|
1952
|
+
memoizedSnapshot = nextSnapshot;
|
|
1953
|
+
nextSnapshot = selector(nextSnapshot);
|
|
1954
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
1955
|
+
var currentSelection = inst.value;
|
|
1956
|
+
if (isEqual(currentSelection, nextSnapshot))
|
|
1957
|
+
return memoizedSelection = currentSelection;
|
|
1958
|
+
}
|
|
1959
|
+
return memoizedSelection = nextSnapshot;
|
|
1572
1960
|
}
|
|
1573
|
-
|
|
1961
|
+
currentSelection = memoizedSelection;
|
|
1962
|
+
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
|
|
1963
|
+
var nextSelection = selector(nextSnapshot);
|
|
1964
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
|
|
1965
|
+
return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
1966
|
+
memoizedSnapshot = nextSnapshot;
|
|
1967
|
+
return memoizedSelection = nextSelection;
|
|
1574
1968
|
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1969
|
+
var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
1970
|
+
return [
|
|
1971
|
+
function() {
|
|
1972
|
+
return memoizedSelector(getSnapshot());
|
|
1973
|
+
},
|
|
1974
|
+
null === maybeGetServerSnapshot ? void 0 : function() {
|
|
1975
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
1976
|
+
}
|
|
1977
|
+
];
|
|
1978
|
+
},
|
|
1979
|
+
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
1980
|
+
);
|
|
1981
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
1982
|
+
useEffect2(
|
|
1983
|
+
function() {
|
|
1984
|
+
inst.hasValue = true;
|
|
1985
|
+
inst.value = value;
|
|
1986
|
+
},
|
|
1987
|
+
[value]
|
|
1988
|
+
);
|
|
1989
|
+
useDebugValue(value);
|
|
1990
|
+
return value;
|
|
1596
1991
|
};
|
|
1597
|
-
return
|
|
1992
|
+
return withSelector_production;
|
|
1598
1993
|
}
|
|
1599
1994
|
var withSelector_development = {};
|
|
1600
1995
|
/**
|
|
1601
1996
|
* @license React
|
|
1602
1997
|
* use-sync-external-store-shim/with-selector.development.js
|
|
1603
1998
|
*
|
|
1604
|
-
* Copyright (c)
|
|
1999
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1605
2000
|
*
|
|
1606
2001
|
* This source code is licensed under the MIT license found in the
|
|
1607
2002
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -1610,88 +2005,66 @@ var hasRequiredWithSelector_development;
|
|
|
1610
2005
|
function requireWithSelector_development() {
|
|
1611
2006
|
if (hasRequiredWithSelector_development) return withSelector_development;
|
|
1612
2007
|
hasRequiredWithSelector_development = 1;
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
var inst;
|
|
1629
|
-
if (instRef.current === null) {
|
|
1630
|
-
inst = {
|
|
1631
|
-
hasValue: false,
|
|
1632
|
-
value: null
|
|
1633
|
-
};
|
|
1634
|
-
instRef.current = inst;
|
|
1635
|
-
} else {
|
|
1636
|
-
inst = instRef.current;
|
|
1637
|
-
}
|
|
1638
|
-
var _useMemo = useMemo2(function() {
|
|
1639
|
-
var hasMemo = false;
|
|
1640
|
-
var memoizedSnapshot;
|
|
1641
|
-
var memoizedSelection;
|
|
1642
|
-
var memoizedSelector = function(nextSnapshot) {
|
|
2008
|
+
"production" !== process.env.NODE_ENV && function() {
|
|
2009
|
+
function is(x2, y2) {
|
|
2010
|
+
return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
|
|
2011
|
+
}
|
|
2012
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
2013
|
+
var React = require$$0, shim2 = requireShim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim2.useSyncExternalStore, useRef2 = React.useRef, useEffect2 = React.useEffect, useMemo2 = React.useMemo, useDebugValue = React.useDebugValue;
|
|
2014
|
+
withSelector_development.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
2015
|
+
var instRef = useRef2(null);
|
|
2016
|
+
if (null === instRef.current) {
|
|
2017
|
+
var inst = { hasValue: false, value: null };
|
|
2018
|
+
instRef.current = inst;
|
|
2019
|
+
} else inst = instRef.current;
|
|
2020
|
+
instRef = useMemo2(
|
|
2021
|
+
function() {
|
|
2022
|
+
function memoizedSelector(nextSnapshot) {
|
|
1643
2023
|
if (!hasMemo) {
|
|
1644
2024
|
hasMemo = true;
|
|
1645
2025
|
memoizedSnapshot = nextSnapshot;
|
|
1646
|
-
|
|
1647
|
-
if (
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
memoizedSelection = currentSelection;
|
|
1652
|
-
return currentSelection;
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
2026
|
+
nextSnapshot = selector(nextSnapshot);
|
|
2027
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
2028
|
+
var currentSelection = inst.value;
|
|
2029
|
+
if (isEqual(currentSelection, nextSnapshot))
|
|
2030
|
+
return memoizedSelection = currentSelection;
|
|
1655
2031
|
}
|
|
1656
|
-
memoizedSelection =
|
|
1657
|
-
return _nextSelection;
|
|
1658
|
-
}
|
|
1659
|
-
var prevSnapshot = memoizedSnapshot;
|
|
1660
|
-
var prevSelection = memoizedSelection;
|
|
1661
|
-
if (objectIs(prevSnapshot, nextSnapshot)) {
|
|
1662
|
-
return prevSelection;
|
|
2032
|
+
return memoizedSelection = nextSnapshot;
|
|
1663
2033
|
}
|
|
2034
|
+
currentSelection = memoizedSelection;
|
|
2035
|
+
if (objectIs(memoizedSnapshot, nextSnapshot))
|
|
2036
|
+
return currentSelection;
|
|
1664
2037
|
var nextSelection = selector(nextSnapshot);
|
|
1665
|
-
if (
|
|
1666
|
-
return
|
|
1667
|
-
}
|
|
2038
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
|
|
2039
|
+
return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
1668
2040
|
memoizedSnapshot = nextSnapshot;
|
|
1669
|
-
memoizedSelection = nextSelection;
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
},
|
|
1681
|
-
|
|
1682
|
-
|
|
2041
|
+
return memoizedSelection = nextSelection;
|
|
2042
|
+
}
|
|
2043
|
+
var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
2044
|
+
return [
|
|
2045
|
+
function() {
|
|
2046
|
+
return memoizedSelector(getSnapshot());
|
|
2047
|
+
},
|
|
2048
|
+
null === maybeGetServerSnapshot ? void 0 : function() {
|
|
2049
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
2050
|
+
}
|
|
2051
|
+
];
|
|
2052
|
+
},
|
|
2053
|
+
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
2054
|
+
);
|
|
2055
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
2056
|
+
useEffect2(
|
|
2057
|
+
function() {
|
|
1683
2058
|
inst.hasValue = true;
|
|
1684
2059
|
inst.value = value;
|
|
1685
|
-
},
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
})();
|
|
1694
|
-
}
|
|
2060
|
+
},
|
|
2061
|
+
[value]
|
|
2062
|
+
);
|
|
2063
|
+
useDebugValue(value);
|
|
2064
|
+
return value;
|
|
2065
|
+
};
|
|
2066
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
2067
|
+
}();
|
|
1695
2068
|
return withSelector_development;
|
|
1696
2069
|
}
|
|
1697
2070
|
var hasRequiredWithSelector;
|
|
@@ -1699,48 +2072,87 @@ function requireWithSelector() {
|
|
|
1699
2072
|
if (hasRequiredWithSelector) return withSelector.exports;
|
|
1700
2073
|
hasRequiredWithSelector = 1;
|
|
1701
2074
|
if (process.env.NODE_ENV === "production") {
|
|
1702
|
-
withSelector.exports =
|
|
2075
|
+
withSelector.exports = requireWithSelector_production();
|
|
1703
2076
|
} else {
|
|
1704
2077
|
withSelector.exports = requireWithSelector_development();
|
|
1705
2078
|
}
|
|
1706
2079
|
return withSelector.exports;
|
|
1707
2080
|
}
|
|
1708
2081
|
var withSelectorExports = requireWithSelector();
|
|
1709
|
-
var
|
|
2082
|
+
var x = (t2) => t2, y = (t2, e2, n2) => {
|
|
1710
2083
|
var _a, _b;
|
|
1711
|
-
let
|
|
2084
|
+
let r2 = useRef((_a = t2 == null ? void 0 : t2.resolve) == null ? void 0 : _a.call(t2, e2, n2)), s2 = ((_b = t2 == null ? void 0 : t2.keyOfEntity) == null ? void 0 : _b.call(t2, e2)) ?? e2, o2 = useCallback((p2) => {
|
|
1712
2085
|
var _a2, _b2;
|
|
1713
|
-
return
|
|
2086
|
+
return s2 ? (r2.current = (_a2 = t2 == null ? void 0 : t2.resolve) == null ? void 0 : _a2.call(t2, s2, n2), p2(), (_b2 = t2 == null ? void 0 : t2.subscribe) == null ? void 0 : _b2.call(t2, s2, () => {
|
|
1714
2087
|
var _a3;
|
|
1715
|
-
return
|
|
1716
|
-
},
|
|
2088
|
+
return r2.current = (_a3 = t2 == null ? void 0 : t2.resolve) == null ? void 0 : _a3.call(t2, s2, n2), p2();
|
|
2089
|
+
}, n2)) : () => {
|
|
1717
2090
|
};
|
|
1718
|
-
}, [
|
|
1719
|
-
let
|
|
1720
|
-
|
|
1721
|
-
}, [
|
|
1722
|
-
return [withSelectorExports.useSyncExternalStoreWithSelector(
|
|
2091
|
+
}, [t2, s2]), a2 = useCallback((p2, c2) => {
|
|
2092
|
+
let u2 = typeof e2 == "string" ? e2 : keyOfEntity(e2);
|
|
2093
|
+
e2 && u2 && t2.mutate(u2, p2, c2);
|
|
2094
|
+
}, [t2, e2]), i2 = () => (n2 == null ? void 0 : n2.pause) ? null : r2.current;
|
|
2095
|
+
return [withSelectorExports.useSyncExternalStoreWithSelector(o2, i2, i2, x), a2];
|
|
1723
2096
|
};
|
|
2097
|
+
var R = (t2) => t2, S = (t2, e2, n2) => {
|
|
2098
|
+
let r2 = useCallback((c2) => c2.map((u2) => t2.resolve(u2, n2)).filter(Boolean), [t2, n2]), s2 = useMemo(() => e2.map((c2) => t2.keyOfEntity(c2) || c2).join(), [e2]), o2 = useRef(r2(e2));
|
|
2099
|
+
useRef([]);
|
|
2100
|
+
let i2 = useCallback((c2) => {
|
|
2101
|
+
if (e2) {
|
|
2102
|
+
let u2 = () => {
|
|
2103
|
+
o2.current = r2(e2), c2();
|
|
2104
|
+
}, l2 = new AbortController();
|
|
2105
|
+
return e2.forEach((f2) => {
|
|
2106
|
+
f2 && t2.subscribe(f2, u2, { signal: l2.signal, ...n2 });
|
|
2107
|
+
}), u2(), () => l2.abort("unsubscribe");
|
|
2108
|
+
}
|
|
2109
|
+
return () => {
|
|
2110
|
+
};
|
|
2111
|
+
}, [t2, s2]), p2 = () => o2.current;
|
|
2112
|
+
return withSelectorExports.useSyncExternalStoreWithSelector(i2, p2, p2, R);
|
|
2113
|
+
};
|
|
2114
|
+
const GlobalManager = createContext(null);
|
|
1724
2115
|
var __defProp = Object.defineProperty;
|
|
1725
2116
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1726
2117
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1727
2118
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1728
2119
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1729
|
-
var __spreadValues = (
|
|
1730
|
-
for (var prop in
|
|
1731
|
-
if (__hasOwnProp.call(
|
|
1732
|
-
__defNormalProp(
|
|
2120
|
+
var __spreadValues = (a2, b) => {
|
|
2121
|
+
for (var prop in b || (b = {}))
|
|
2122
|
+
if (__hasOwnProp.call(b, prop))
|
|
2123
|
+
__defNormalProp(a2, prop, b[prop]);
|
|
1733
2124
|
if (__getOwnPropSymbols)
|
|
1734
|
-
for (var prop of __getOwnPropSymbols(
|
|
1735
|
-
if (__propIsEnum.call(
|
|
1736
|
-
__defNormalProp(
|
|
2125
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
2126
|
+
if (__propIsEnum.call(b, prop))
|
|
2127
|
+
__defNormalProp(a2, prop, b[prop]);
|
|
1737
2128
|
}
|
|
1738
|
-
return
|
|
2129
|
+
return a2;
|
|
1739
2130
|
};
|
|
1740
2131
|
var toPx = (val) => typeof val === "string" || typeof val === "number" ? `${val}px` : "0px";
|
|
2132
|
+
var isObject = (input) => {
|
|
2133
|
+
return typeof input === "object" && input !== null && !Array.isArray(input);
|
|
2134
|
+
};
|
|
1741
2135
|
var isEmptyValue = (value) => !value && (value === null || value === void 0);
|
|
1742
2136
|
var isValue = (value) => !isEmptyValue(value);
|
|
1743
|
-
var
|
|
2137
|
+
var get = (obj, path, defValue) => {
|
|
2138
|
+
if (!path)
|
|
2139
|
+
return void 0;
|
|
2140
|
+
const pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g);
|
|
2141
|
+
const result = pathArray.reduce((prevObj, key) => prevObj && prevObj[key], obj);
|
|
2142
|
+
return result === void 0 ? defValue : result;
|
|
2143
|
+
};
|
|
2144
|
+
var set = (obj, path, value) => {
|
|
2145
|
+
const pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g);
|
|
2146
|
+
return pathArray.reduce((acc, key, i2) => {
|
|
2147
|
+
if (acc[key] === void 0)
|
|
2148
|
+
acc[key] = {};
|
|
2149
|
+
if (i2 === pathArray.length - 1)
|
|
2150
|
+
acc[key] = value;
|
|
2151
|
+
return acc[key];
|
|
2152
|
+
}, obj);
|
|
2153
|
+
};
|
|
2154
|
+
var isPrimitive = (value) => typeof value !== "object" && typeof value !== "function" || value === null;
|
|
2155
|
+
var toKebabCase = (value) => value.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($2, ofs) => (ofs ? "-" : "") + $2.toLowerCase());
|
|
1744
2156
|
var noop = () => void 0;
|
|
1745
2157
|
var pick = (obj, ...props) => {
|
|
1746
2158
|
return props.reduce((result, prop) => {
|
|
@@ -1755,22 +2167,109 @@ function omit(obj, ...props) {
|
|
|
1755
2167
|
});
|
|
1756
2168
|
return result;
|
|
1757
2169
|
}
|
|
2170
|
+
var cleanGraph = (input) => isObject(input) ? omit(input, "_type", "_id") : input;
|
|
1758
2171
|
var isBrowser_default = typeof window !== "undefined";
|
|
2172
|
+
var generateId = () => Math.random().toString(16).slice(2);
|
|
2173
|
+
var flattenObject = (obj) => {
|
|
2174
|
+
const result = {};
|
|
2175
|
+
function flatten(current) {
|
|
2176
|
+
for (let key in current) {
|
|
2177
|
+
if (current.hasOwnProperty(key)) {
|
|
2178
|
+
const value = current[key];
|
|
2179
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2180
|
+
flatten(value);
|
|
2181
|
+
} else {
|
|
2182
|
+
result[key] = value;
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
flatten(obj);
|
|
2188
|
+
return result;
|
|
2189
|
+
};
|
|
2190
|
+
function isFiniteNumber(value) {
|
|
2191
|
+
return typeof value === "number" && isFinite(value);
|
|
2192
|
+
}
|
|
2193
|
+
var setKey$1 = (v2) => `$${v2}`;
|
|
1759
2194
|
function hashGenerator(layerKey) {
|
|
1760
2195
|
let hash = 0;
|
|
1761
|
-
for (let
|
|
1762
|
-
hash = (hash << 5) - hash + layerKey.charCodeAt(
|
|
2196
|
+
for (let i2 = 0; i2 < layerKey.length; i2++) {
|
|
2197
|
+
hash = (hash << 5) - hash + layerKey.charCodeAt(i2);
|
|
1763
2198
|
hash |= 0;
|
|
1764
2199
|
}
|
|
1765
2200
|
const raw = Math.abs(hash).toString(36);
|
|
1766
2201
|
return /^[0-9]/.test(raw) ? `h${raw}` : raw;
|
|
1767
2202
|
}
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1770
|
-
const
|
|
2203
|
+
const useGlobalManager = (globalManager) => {
|
|
2204
|
+
var _a, _b;
|
|
2205
|
+
const currentGlobalManager = useContext(GlobalManager);
|
|
2206
|
+
const resultManager = globalManager ?? currentGlobalManager;
|
|
2207
|
+
const [fragmentsGraph] = y(
|
|
2208
|
+
resultManager,
|
|
2209
|
+
(_a = resultManager == null ? void 0 : resultManager.$fragments) == null ? void 0 : _a.key
|
|
2210
|
+
);
|
|
2211
|
+
const queryFragmentManager = (id) => {
|
|
2212
|
+
var _a2, _b2;
|
|
2213
|
+
return (_b2 = (_a2 = resultManager == null ? void 0 : resultManager.$load) == null ? void 0 : _a2.loadFragment) == null ? void 0 : _b2.call(_a2, id);
|
|
2214
|
+
};
|
|
2215
|
+
const queryArea = (id) => {
|
|
2216
|
+
var _a2, _b2;
|
|
2217
|
+
return (_b2 = (_a2 = resultManager == null ? void 0 : resultManager.$load) == null ? void 0 : _a2.loadArea) == null ? void 0 : _b2.call(_a2, id);
|
|
2218
|
+
};
|
|
2219
|
+
const setRenderTarget = (value) => {
|
|
2220
|
+
resultManager == null ? void 0 : resultManager.setRenderTarget(value);
|
|
2221
|
+
};
|
|
2222
|
+
return {
|
|
2223
|
+
fragmentsGraph,
|
|
2224
|
+
manager: resultManager,
|
|
2225
|
+
queryFragmentManager,
|
|
2226
|
+
queryArea,
|
|
2227
|
+
getFragmentManager: ((_b = resultManager == null ? void 0 : resultManager.$fragments) == null ? void 0 : _b.getManager) ?? noop,
|
|
2228
|
+
setRenderTarget
|
|
2229
|
+
};
|
|
2230
|
+
};
|
|
2231
|
+
const useFragmentManager = (fragmentId, inputGlobalManager, aa) => {
|
|
2232
|
+
var _a;
|
|
2233
|
+
const {
|
|
2234
|
+
fragmentsGraph,
|
|
2235
|
+
manager: gg,
|
|
2236
|
+
getFragmentManager,
|
|
2237
|
+
queryFragmentManager
|
|
2238
|
+
} = useGlobalManager(inputGlobalManager);
|
|
2239
|
+
const [loading, setLoading] = useState(false);
|
|
2240
|
+
const manager = getFragmentManager(fragmentId);
|
|
2241
|
+
useEffect(() => {
|
|
2242
|
+
(async () => {
|
|
2243
|
+
if (fragmentsGraph && !getFragmentManager(fragmentId) && !!fragmentId) {
|
|
2244
|
+
setLoading(true);
|
|
2245
|
+
await queryFragmentManager(fragmentId);
|
|
2246
|
+
setLoading(false);
|
|
2247
|
+
}
|
|
2248
|
+
})();
|
|
2249
|
+
}, [fragmentId, fragmentsGraph]);
|
|
2250
|
+
return {
|
|
2251
|
+
loading,
|
|
2252
|
+
manager,
|
|
2253
|
+
fragmentLayerKey: (_a = manager == null ? void 0 : manager.$fragment) == null ? void 0 : _a.root,
|
|
2254
|
+
queryFragmentManager
|
|
2255
|
+
// loadFragmentManager,
|
|
2256
|
+
};
|
|
2257
|
+
};
|
|
2258
|
+
const FragmentContext = createContext({
|
|
2259
|
+
manager: null
|
|
2260
|
+
});
|
|
2261
|
+
const setKey = (v2) => `$${v2}`;
|
|
2262
|
+
const getKey = (v2) => isKey(v2) ? v2.slice(1) : null;
|
|
2263
|
+
const isKey = (v2) => typeof v2 === "string" && v2.startsWith("$");
|
|
2264
|
+
const getParent = (manager, layerKey) => {
|
|
1771
2265
|
const layer = manager.resolve(layerKey);
|
|
1772
2266
|
return manager.resolve(getKey(layer == null ? void 0 : layer.parent) ?? null);
|
|
1773
2267
|
};
|
|
2268
|
+
const isRootLayer = (manager, layerKey) => {
|
|
2269
|
+
var _a, _b;
|
|
2270
|
+
const resolvedNode = (_a = manager == null ? void 0 : manager.resolve) == null ? void 0 : _a.call(manager, layerKey);
|
|
2271
|
+
return ((_b = getParent(manager, layerKey)) == null ? void 0 : _b._type) === index.nodes.Fragment && !(resolvedNode == null ? void 0 : resolvedNode.isBreakpoint);
|
|
2272
|
+
};
|
|
1774
2273
|
const isTopLevel = (manager, layerKey) => {
|
|
1775
2274
|
var _a;
|
|
1776
2275
|
return ((_a = getParent(manager, layerKey)) == null ? void 0 : _a._type) === index.nodes.Fragment;
|
|
@@ -1789,6 +2288,89 @@ const isPartOfPrimary = (manager, layerKey) => {
|
|
|
1789
2288
|
const layer = manager.resolve(layerKey);
|
|
1790
2289
|
return (layer == null ? void 0 : layer.isPrimary) ?? !!((_a = allParents == null ? void 0 : allParents.find) == null ? void 0 : _a.call(allParents, (parent) => !!(parent == null ? void 0 : parent.isPrimary)));
|
|
1791
2290
|
};
|
|
2291
|
+
const createLayer = (externalLayerData, overrideId = false) => {
|
|
2292
|
+
if (!externalLayerData || !isObject(externalLayerData)) return null;
|
|
2293
|
+
const cleanLayer = Object.entries(externalLayerData).reduce(
|
|
2294
|
+
(acc, [key, value]) => {
|
|
2295
|
+
if (isObject(value) && "_type" in value && "_id" in value && isPartialKey(`${value._type}:${value._id}`)) {
|
|
2296
|
+
delete value._id;
|
|
2297
|
+
delete value._type;
|
|
2298
|
+
}
|
|
2299
|
+
acc[key] = value;
|
|
2300
|
+
return acc;
|
|
2301
|
+
},
|
|
2302
|
+
{}
|
|
2303
|
+
);
|
|
2304
|
+
return overrideId ? {
|
|
2305
|
+
...cleanLayer,
|
|
2306
|
+
_id: generateId()
|
|
2307
|
+
} : {
|
|
2308
|
+
_id: generateId(),
|
|
2309
|
+
...cleanLayer
|
|
2310
|
+
};
|
|
2311
|
+
};
|
|
2312
|
+
const cloneLayer = (manager, layer, externalProps = {}, _parent) => {
|
|
2313
|
+
const layerGraph = manager.resolve(layer);
|
|
2314
|
+
const layerKey = manager.keyOfEntity(layer);
|
|
2315
|
+
const layerParent = _parent ?? manager.keyOfEntity(getParent(manager, layerKey));
|
|
2316
|
+
if (layerGraph) {
|
|
2317
|
+
const clonedLayer = createLayer(
|
|
2318
|
+
{
|
|
2319
|
+
_type: layerGraph._type,
|
|
2320
|
+
overrideFrom: setKey(layerKey),
|
|
2321
|
+
parent: setKey(layerParent),
|
|
2322
|
+
...(layerGraph == null ? void 0 : layerGraph._type) === index.nodes.Instance ? pick(layerGraph, "fragment") : {},
|
|
2323
|
+
...externalProps
|
|
2324
|
+
},
|
|
2325
|
+
true
|
|
2326
|
+
);
|
|
2327
|
+
const clonedChildren = ((layerGraph == null ? void 0 : layerGraph.children) ?? []).map(
|
|
2328
|
+
(child) => cloneLayer(manager, child, {}, manager.keyOfEntity(clonedLayer))
|
|
2329
|
+
);
|
|
2330
|
+
const clonedKey = manager.mutate({
|
|
2331
|
+
...clonedLayer,
|
|
2332
|
+
children: clonedChildren
|
|
2333
|
+
});
|
|
2334
|
+
manager.mutate(layerKey, {
|
|
2335
|
+
overrides: [clonedKey]
|
|
2336
|
+
});
|
|
2337
|
+
return clonedKey;
|
|
2338
|
+
}
|
|
2339
|
+
return null;
|
|
2340
|
+
};
|
|
2341
|
+
function makeSnapshot(globalManager, targetFragmentId) {
|
|
2342
|
+
var _a, _b;
|
|
2343
|
+
if (!globalManager || !targetFragmentId) return null;
|
|
2344
|
+
const targetFragment = (_b = (_a = globalManager == null ? void 0 : globalManager.$fragments) == null ? void 0 : _a.getManager) == null ? void 0 : _b.call(_a, targetFragmentId);
|
|
2345
|
+
if (!targetFragment) return null;
|
|
2346
|
+
const fragmentDocument = targetFragment.resolve(
|
|
2347
|
+
targetFragment.$fragment.root,
|
|
2348
|
+
{ deep: true }
|
|
2349
|
+
);
|
|
2350
|
+
const linkedFragments = Array.from(
|
|
2351
|
+
new Set(
|
|
2352
|
+
targetFragment.inspectFields(index.nodes.Instance).map((link) => {
|
|
2353
|
+
var _a2;
|
|
2354
|
+
return (_a2 = targetFragment.resolve(link)) == null ? void 0 : _a2.fragment;
|
|
2355
|
+
}).values()
|
|
2356
|
+
)
|
|
2357
|
+
);
|
|
2358
|
+
const linkedGoals = Array.from(
|
|
2359
|
+
new Set(
|
|
2360
|
+
targetFragment.inspectFields(index.nodes.Variable).map(targetFragment == null ? void 0 : targetFragment.resolve).filter((graph) => {
|
|
2361
|
+
return (graph == null ? void 0 : graph.type) === index.variableType.Event && (graph == null ? void 0 : graph.mode) === index.eventMode.goal;
|
|
2362
|
+
}).map((graph) => {
|
|
2363
|
+
var _a2;
|
|
2364
|
+
return (_a2 = graph == null ? void 0 : graph.defaultValue) == null ? void 0 : _a2.goalId;
|
|
2365
|
+
}).filter(Boolean).values()
|
|
2366
|
+
)
|
|
2367
|
+
);
|
|
2368
|
+
return {
|
|
2369
|
+
document: fragmentDocument,
|
|
2370
|
+
linkedFragments,
|
|
2371
|
+
linkedGoals
|
|
2372
|
+
};
|
|
2373
|
+
}
|
|
1792
2374
|
const getOverrider = (manager, layerEntity) => {
|
|
1793
2375
|
const layer = manager.resolve(layerEntity);
|
|
1794
2376
|
return manager.resolve(getKey(layer == null ? void 0 : layer.overrideFrom) ?? layerEntity);
|
|
@@ -1802,63 +2384,328 @@ const isInheritField = (manager, layerEntity, field) => {
|
|
|
1802
2384
|
}
|
|
1803
2385
|
return false;
|
|
1804
2386
|
};
|
|
1805
|
-
const
|
|
2387
|
+
const declareFragmentProperty = (manager, property, fragmentLink = manager.$fragment.root) => {
|
|
2388
|
+
const propertyLayer = createLayer(property);
|
|
2389
|
+
if (propertyLayer && "type" in propertyLayer) {
|
|
2390
|
+
manager.mutate(manager.keyOfEntity(fragmentLink), {
|
|
2391
|
+
properties: [propertyLayer]
|
|
2392
|
+
});
|
|
2393
|
+
return manager.keyOfEntity(propertyLayer);
|
|
2394
|
+
}
|
|
2395
|
+
return null;
|
|
2396
|
+
};
|
|
2397
|
+
const appendChildren = (manager, target, ...children) => {
|
|
2398
|
+
const targetEntity = manager.entityOfKey(target);
|
|
2399
|
+
const parseChildren = children.map(
|
|
2400
|
+
(child) => createLayer({
|
|
2401
|
+
...manager.entityOfKey(child) ?? child,
|
|
2402
|
+
parent: setKey(manager.keyOfEntity(target))
|
|
2403
|
+
})
|
|
2404
|
+
).filter(Boolean);
|
|
2405
|
+
if (targetEntity._type !== index.nodes.Frame) {
|
|
2406
|
+
manager.mutate(manager.keyOfEntity(target), {
|
|
2407
|
+
children: parseChildren
|
|
2408
|
+
});
|
|
2409
|
+
return;
|
|
2410
|
+
}
|
|
2411
|
+
const primaryTarget = getOverrider(manager, target);
|
|
2412
|
+
const isPrimaryTarget = isPartOfPrimary(manager, target);
|
|
2413
|
+
((primaryTarget == null ? void 0 : primaryTarget.overrides) ?? []).forEach((override) => {
|
|
2414
|
+
const overridesChildren = parseChildren.map((child) => {
|
|
2415
|
+
const nextChild = createLayer(
|
|
2416
|
+
{
|
|
2417
|
+
...pick(child, "parent", "_type"),
|
|
2418
|
+
overrideFrom: setKey(manager.keyOfEntity(child))
|
|
2419
|
+
},
|
|
2420
|
+
true
|
|
2421
|
+
);
|
|
2422
|
+
if (!isPrimaryTarget) {
|
|
2423
|
+
nextChild.visible = true;
|
|
2424
|
+
}
|
|
2425
|
+
return nextChild;
|
|
2426
|
+
}).filter(Boolean);
|
|
2427
|
+
overridesChildren.forEach((child, index2) => {
|
|
2428
|
+
const primaryChild = parseChildren.at(index2);
|
|
2429
|
+
if ("overrides" in primaryChild) {
|
|
2430
|
+
primaryChild.overrides.push(manager.keyOfEntity(child));
|
|
2431
|
+
} else {
|
|
2432
|
+
primaryChild.overrides = [manager.keyOfEntity(child)];
|
|
2433
|
+
}
|
|
2434
|
+
});
|
|
2435
|
+
manager.mutate(manager.keyOfEntity(override), {
|
|
2436
|
+
children: overridesChildren
|
|
2437
|
+
});
|
|
2438
|
+
});
|
|
2439
|
+
manager.mutate(manager.keyOfEntity(primaryTarget), {
|
|
2440
|
+
children: parseChildren.map((child) => ({
|
|
2441
|
+
...child,
|
|
2442
|
+
visible: isPrimaryTarget
|
|
2443
|
+
}))
|
|
2444
|
+
});
|
|
2445
|
+
return parseChildren.map(manager.keyOfEntity);
|
|
2446
|
+
};
|
|
2447
|
+
const insertChildren = (manager, target, index2, ...layerKeys) => {
|
|
2448
|
+
appendChildren(manager, target, ...layerKeys);
|
|
2449
|
+
const targetLayer = manager.resolve(target);
|
|
2450
|
+
const overrideLayers = ((targetLayer == null ? void 0 : targetLayer.overrides) ?? []).map(manager.resolve);
|
|
2451
|
+
[targetLayer, ...overrideLayers].forEach((layer) => {
|
|
2452
|
+
const children = (layer == null ? void 0 : layer.children) ?? [];
|
|
2453
|
+
const appendedLayers = children.slice(layerKeys.length * -1);
|
|
2454
|
+
const nextChildren = children.slice(0, layerKeys.length * -1);
|
|
2455
|
+
nextChildren.splice(index2, 0, ...appendedLayers);
|
|
2456
|
+
manager.mutate(
|
|
2457
|
+
manager.keyOfEntity(layer),
|
|
2458
|
+
(prev) => ({
|
|
2459
|
+
...prev,
|
|
2460
|
+
children: nextChildren
|
|
2461
|
+
}),
|
|
2462
|
+
{ replace: true }
|
|
2463
|
+
);
|
|
2464
|
+
});
|
|
2465
|
+
};
|
|
2466
|
+
const removeChildren = (manager, ...layerKeys) => {
|
|
2467
|
+
layerKeys.map(manager.resolve).forEach((layer) => {
|
|
2468
|
+
const isPrimary = isPartOfPrimary(manager, layer);
|
|
2469
|
+
if (isPrimary || (layer == null ? void 0 : layer.isBreakpoint)) {
|
|
2470
|
+
((layer == null ? void 0 : layer.overrides) ?? []).concat((layer == null ? void 0 : layer.children) ?? []).forEach(manager.invalidate);
|
|
2471
|
+
manager.invalidate(layer);
|
|
2472
|
+
} else {
|
|
2473
|
+
manager.mutate(manager.keyOfEntity(layer), {
|
|
2474
|
+
visible: false
|
|
2475
|
+
});
|
|
2476
|
+
}
|
|
2477
|
+
});
|
|
2478
|
+
};
|
|
2479
|
+
const moveChildren = (manager, targetKey, toKey, index2) => {
|
|
2480
|
+
const targetClone = duplicateLayer(manager, targetKey, true);
|
|
2481
|
+
insertChildren(manager, toKey, index2, targetClone);
|
|
2482
|
+
removeChildren(manager, targetKey);
|
|
2483
|
+
};
|
|
2484
|
+
const duplicateLayer = (manager, layer, _deep, _newParent) => {
|
|
2485
|
+
var _a;
|
|
2486
|
+
const layerGraph = manager.resolve(layer);
|
|
2487
|
+
if (layerGraph) {
|
|
2488
|
+
const nextId = generateId();
|
|
2489
|
+
const nextLayerKey = keyOfEntity({
|
|
2490
|
+
_type: layerGraph._type,
|
|
2491
|
+
_id: nextId
|
|
2492
|
+
});
|
|
2493
|
+
const clonedChildren = ((layerGraph == null ? void 0 : layerGraph.children) ?? []).map(
|
|
2494
|
+
(child) => duplicateLayer(manager, child, true, nextLayerKey)
|
|
2495
|
+
);
|
|
2496
|
+
const duplicatedLayer = createLayer(
|
|
2497
|
+
{
|
|
2498
|
+
_type: layerGraph._type,
|
|
2499
|
+
...layerGraph,
|
|
2500
|
+
_id: nextId,
|
|
2501
|
+
parent: _deep ? setKey$1(_newParent) : layerGraph == null ? void 0 : layerGraph.parent,
|
|
2502
|
+
children: clonedChildren
|
|
2503
|
+
},
|
|
2504
|
+
false
|
|
2505
|
+
);
|
|
2506
|
+
const duplicatedKey = manager.mutate(duplicatedLayer);
|
|
2507
|
+
if (!_deep) {
|
|
2508
|
+
const parent = getParent(manager, layer);
|
|
2509
|
+
if (parent) {
|
|
2510
|
+
const layerIndex = (_a = parent == null ? void 0 : parent.children) == null ? void 0 : _a.findIndex(
|
|
2511
|
+
(child) => child === manager.keyOfEntity(layer)
|
|
2512
|
+
);
|
|
2513
|
+
insertChildren(manager, parent, layerIndex + 1, duplicatedKey);
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
return duplicatedKey;
|
|
2517
|
+
}
|
|
2518
|
+
return null;
|
|
2519
|
+
};
|
|
2520
|
+
const isVariableLink = (value) => {
|
|
2521
|
+
var _a;
|
|
2522
|
+
return isLink(value) && ((_a = value == null ? void 0 : value.split(":")) == null ? void 0 : _a.at(0)) === index.nodes.Variable;
|
|
2523
|
+
};
|
|
2524
|
+
const isLink = (value) => {
|
|
2525
|
+
var _a, _b;
|
|
2526
|
+
return value && ((_b = (_a = value == null ? void 0 : value.split) == null ? void 0 : _a.call(value, ":")) == null ? void 0 : _b.length) === 2;
|
|
2527
|
+
};
|
|
2528
|
+
const getCssVariables = (props) => {
|
|
2529
|
+
return Object.entries(cleanGraph(flattenObject(props))).reduce(
|
|
2530
|
+
(acc, [key, value]) => {
|
|
2531
|
+
var _a;
|
|
2532
|
+
if (isVariableLink(value)) {
|
|
2533
|
+
const nestedVariableId = (_a = entityOfKey(value)) == null ? void 0 : _a._id;
|
|
2534
|
+
value = `var(--${nestedVariableId})`;
|
|
2535
|
+
}
|
|
2536
|
+
acc[`--${key}`] = value;
|
|
2537
|
+
return acc;
|
|
2538
|
+
},
|
|
2539
|
+
{}
|
|
2540
|
+
);
|
|
2541
|
+
};
|
|
2542
|
+
const layerFieldSetter = (manager, layerKey, fieldKey, currentValue) => (value, options2) => {
|
|
2543
|
+
var _a;
|
|
2544
|
+
const { success, output } = parseLayerField(
|
|
2545
|
+
manager.resolve(layerKey),
|
|
2546
|
+
fieldKey,
|
|
2547
|
+
value
|
|
2548
|
+
);
|
|
2549
|
+
if (success) {
|
|
2550
|
+
if (isVariableLink$1(value)) {
|
|
2551
|
+
manager.mutate((_a = manager == null ? void 0 : manager.$fragment) == null ? void 0 : _a.temp, {
|
|
2552
|
+
[layerKey]: {
|
|
2553
|
+
[fieldKey]: currentValue
|
|
2554
|
+
}
|
|
2555
|
+
});
|
|
2556
|
+
}
|
|
2557
|
+
manager.mutate(
|
|
2558
|
+
layerKey,
|
|
2559
|
+
(prev) => {
|
|
2560
|
+
set(prev, fieldKey, output);
|
|
2561
|
+
return prev;
|
|
2562
|
+
},
|
|
2563
|
+
options2
|
|
2564
|
+
);
|
|
2565
|
+
}
|
|
2566
|
+
};
|
|
2567
|
+
const getLayer = (manager, layer, options2) => {
|
|
1806
2568
|
if (!manager || !layer) return null;
|
|
1807
2569
|
const layerKey = manager.keyOfEntity(layer);
|
|
1808
2570
|
const layerData = manager.resolve(layerKey);
|
|
1809
2571
|
const overrider = getOverrider(manager, layerKey);
|
|
1810
|
-
return getNormalizeLayer$1(layerData, overrider);
|
|
2572
|
+
return getNormalizeLayer$1(layerData, overrider, options2 == null ? void 0 : options2.withFallback);
|
|
1811
2573
|
};
|
|
1812
|
-
const getNormalizeLayer = (layerKey, manager) => {
|
|
2574
|
+
const getNormalizeLayer = (layerKey, manager, options2) => {
|
|
1813
2575
|
const layer = manager == null ? void 0 : manager.resolve(layerKey);
|
|
1814
|
-
const parsedLayer = getLayer(manager, layerKey);
|
|
2576
|
+
const parsedLayer = getLayer(manager, layerKey, options2);
|
|
1815
2577
|
return {
|
|
1816
2578
|
rawLayer: layer,
|
|
1817
2579
|
layer: parsedLayer
|
|
1818
2580
|
};
|
|
1819
2581
|
};
|
|
1820
|
-
const useNormalizeLayer = (layerKey, manager) => {
|
|
2582
|
+
const useNormalizeLayer = (layerKey, manager, options2) => {
|
|
1821
2583
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
1822
2584
|
const resultManager = manager ?? fragmentManager;
|
|
1823
|
-
return getNormalizeLayer(layerKey, resultManager);
|
|
2585
|
+
return getNormalizeLayer(layerKey, resultManager, options2);
|
|
2586
|
+
};
|
|
2587
|
+
const ScopeContext = createContext([]);
|
|
2588
|
+
const extractVariableValue = (input, variableId) => {
|
|
2589
|
+
if (isObject(input)) {
|
|
2590
|
+
if (variableId in input) {
|
|
2591
|
+
return input[variableId];
|
|
2592
|
+
}
|
|
2593
|
+
for (let key in input) {
|
|
2594
|
+
if (input.hasOwnProperty(key)) {
|
|
2595
|
+
const result = extractVariableValue(input[key], variableId);
|
|
2596
|
+
if (result !== void 0) {
|
|
2597
|
+
return result;
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
return void 0;
|
|
1824
2603
|
};
|
|
2604
|
+
function deepMerge(a2, b) {
|
|
2605
|
+
if (!isObject(a2) || !isObject(b)) return a2;
|
|
2606
|
+
const result = { ...b };
|
|
2607
|
+
for (const [key, value] of Object.entries(a2)) {
|
|
2608
|
+
if (key in result && typeof result[key] === "object" && typeof value === "object") {
|
|
2609
|
+
result[key] = deepMerge(value, result[key]);
|
|
2610
|
+
} else {
|
|
2611
|
+
result[key] = value;
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
return result;
|
|
2615
|
+
}
|
|
1825
2616
|
const useReadVariable = (variableKey) => {
|
|
1826
|
-
const
|
|
1827
|
-
const
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
2617
|
+
const scopes = useContext(ScopeContext);
|
|
2618
|
+
const extractVariableDefaultValue = (manager, variableEntity) => {
|
|
2619
|
+
const variableLayer = manager.resolve(variableEntity);
|
|
2620
|
+
if ((variableLayer == null ? void 0 : variableLayer.type) !== index.variableType.Object)
|
|
2621
|
+
return variableLayer == null ? void 0 : variableLayer.defaultValue;
|
|
2622
|
+
return Object.values((variableLayer == null ? void 0 : variableLayer.fields) ?? {}).reduce(
|
|
2623
|
+
(acc, fieldLink) => {
|
|
2624
|
+
var _a;
|
|
2625
|
+
if (!!fieldLink && isVariableLink$1(fieldLink)) {
|
|
2626
|
+
const _id = (_a = entityOfKey(fieldLink)) == null ? void 0 : _a._id;
|
|
2627
|
+
if (_id) {
|
|
2628
|
+
acc[_id] = extractVariableDefaultValue(manager, fieldLink);
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
return acc;
|
|
2632
|
+
},
|
|
2633
|
+
{}
|
|
2634
|
+
);
|
|
2635
|
+
};
|
|
2636
|
+
const resolveVariableLayer = (manager, variableLink, customProps) => {
|
|
2637
|
+
var _a;
|
|
2638
|
+
const variableLayer = manager == null ? void 0 : manager.resolve(variableLink);
|
|
2639
|
+
if (!variableLayer) return null;
|
|
2640
|
+
if ((variableLayer == null ? void 0 : variableLayer.type) === index.variableType.Array) {
|
|
2641
|
+
const definitionLayer = manager.resolve(variableLayer == null ? void 0 : variableLayer.definition);
|
|
2642
|
+
if (!((_a = variableLayer == null ? void 0 : variableLayer.defaultValue) == null ? void 0 : _a.length) || (definitionLayer == null ? void 0 : definitionLayer.type) !== index.variableType.Object)
|
|
2643
|
+
return variableLayer;
|
|
2644
|
+
const definitionDefaultValue = extractVariableDefaultValue(
|
|
2645
|
+
manager,
|
|
2646
|
+
definitionLayer
|
|
2647
|
+
);
|
|
2648
|
+
const customValue = customProps == null ? void 0 : customProps[variableLayer == null ? void 0 : variableLayer._id];
|
|
2649
|
+
return {
|
|
2650
|
+
...variableLayer,
|
|
2651
|
+
defaultValue: (variableLayer == null ? void 0 : variableLayer.defaultValue).map((item, index2) => {
|
|
2652
|
+
const customItemValue = Array.isArray(customValue) ? customValue.at(index2) : null;
|
|
2653
|
+
return deepMerge(
|
|
2654
|
+
customItemValue ? { ...item, ...customItemValue } : item,
|
|
2655
|
+
definitionDefaultValue
|
|
2656
|
+
);
|
|
2657
|
+
})
|
|
2658
|
+
};
|
|
1836
2659
|
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
(variableLayer == null ? void 0 : variableLayer.required) ?? false;
|
|
1840
|
-
(variableLayer == null ? void 0 : variableLayer.defaultValue) ?? null;
|
|
2660
|
+
return variableLayer;
|
|
2661
|
+
};
|
|
1841
2662
|
const readVariable = (variableKey2) => {
|
|
1842
|
-
|
|
1843
|
-
|
|
2663
|
+
var _a, _b, _c;
|
|
2664
|
+
const variableId = (_a = entityOfKey(variableKey2)) == null ? void 0 : _a._id;
|
|
2665
|
+
if (!isVariableLink$1(variableKey2)) {
|
|
1844
2666
|
return {
|
|
1845
2667
|
value: null,
|
|
1846
2668
|
layer: null
|
|
1847
2669
|
};
|
|
1848
2670
|
}
|
|
1849
|
-
const
|
|
1850
|
-
(
|
|
1851
|
-
|
|
1852
|
-
|
|
2671
|
+
const instanceScope = scopes.findLast(
|
|
2672
|
+
(scope) => {
|
|
2673
|
+
var _a2;
|
|
2674
|
+
return (scope == null ? void 0 : scope.type) === index.scopeTypes.InstanceScope && !!((_a2 = scope.documentManager) == null ? void 0 : _a2.resolve(variableKey2));
|
|
2675
|
+
}
|
|
2676
|
+
);
|
|
2677
|
+
const variableLayer = resolveVariableLayer(
|
|
2678
|
+
instanceScope == null ? void 0 : instanceScope.documentManager,
|
|
2679
|
+
variableKey2
|
|
2680
|
+
);
|
|
2681
|
+
let instanceProp = (_b = instanceScope == null ? void 0 : instanceScope.props) == null ? void 0 : _b[variableId];
|
|
2682
|
+
if (Array.isArray(instanceProp)) {
|
|
2683
|
+
instanceProp = instanceProp.map(
|
|
2684
|
+
(rawProp, index2) => {
|
|
2685
|
+
var _a2;
|
|
2686
|
+
return deepMerge(rawProp, (_a2 = variableLayer == null ? void 0 : variableLayer.defaultValue) == null ? void 0 : _a2.at(index2));
|
|
2687
|
+
}
|
|
2688
|
+
);
|
|
2689
|
+
}
|
|
2690
|
+
const lastCollectionItem = scopes.findLast(
|
|
2691
|
+
(scope) => (scope == null ? void 0 : scope.type) === index.scopeTypes.CollectionItemScope
|
|
1853
2692
|
);
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
2693
|
+
resolveVariableLayer(
|
|
2694
|
+
lastCollectionItem == null ? void 0 : lastCollectionItem.manager,
|
|
2695
|
+
lastCollectionItem == null ? void 0 : lastCollectionItem.sourceDefinition,
|
|
2696
|
+
lastCollectionItem == null ? void 0 : lastCollectionItem.value
|
|
2697
|
+
);
|
|
2698
|
+
const collectionItemProp = isPrimitive(lastCollectionItem == null ? void 0 : lastCollectionItem.value) && ((_c = entityOfKey(lastCollectionItem == null ? void 0 : lastCollectionItem.sourceDefinition)) == null ? void 0 : _c._id) === variableId ? lastCollectionItem == null ? void 0 : lastCollectionItem.value : extractVariableValue(lastCollectionItem == null ? void 0 : lastCollectionItem.value, variableId);
|
|
2699
|
+
const currentValue = variableKey2 === instanceProp ? null : collectionItemProp ?? instanceProp ?? null;
|
|
2700
|
+
const required = (variableLayer == null ? void 0 : variableLayer.required) ?? false;
|
|
2701
|
+
const defaultValue = (variableLayer == null ? void 0 : variableLayer.defaultValue) ?? null;
|
|
2702
|
+
const resultValue = required ? currentValue : currentValue ?? collectionItemProp ?? defaultValue;
|
|
2703
|
+
if (isVariableLink$1(resultValue)) {
|
|
2704
|
+
return readVariable(resultValue);
|
|
2705
|
+
}
|
|
1859
2706
|
return {
|
|
1860
|
-
value:
|
|
1861
|
-
layer:
|
|
2707
|
+
value: resultValue,
|
|
2708
|
+
layer: variableLayer
|
|
1862
2709
|
};
|
|
1863
2710
|
};
|
|
1864
2711
|
const { layer, value } = readVariable(variableKey);
|
|
@@ -1870,7 +2717,7 @@ const useReadVariable = (variableKey) => {
|
|
|
1870
2717
|
};
|
|
1871
2718
|
const useLayerCssVariable = (inputValue) => {
|
|
1872
2719
|
const { manager } = useContext(FragmentContext);
|
|
1873
|
-
const isVariable = isVariableLink(inputValue);
|
|
2720
|
+
const isVariable = isVariableLink$1(inputValue);
|
|
1874
2721
|
const [variableValue] = y(isVariable ? manager : null, inputValue, {
|
|
1875
2722
|
selector: (graph) => pick(graph, "defaultValue", "_id")
|
|
1876
2723
|
});
|
|
@@ -1878,25 +2725,30 @@ const useLayerCssVariable = (inputValue) => {
|
|
|
1878
2725
|
value: isVariable ? `var(--${variableValue == null ? void 0 : variableValue._id}, ${variableValue == null ? void 0 : variableValue.defaultValue})` : null
|
|
1879
2726
|
};
|
|
1880
2727
|
};
|
|
1881
|
-
const useLayerValue = (layerKey, fieldKey,
|
|
1882
|
-
const
|
|
1883
|
-
const
|
|
2728
|
+
const useLayerValue = (layerKey, fieldKey, options2) => {
|
|
2729
|
+
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
2730
|
+
const resultManager = (options2 == null ? void 0 : options2.manager) ?? fragmentManager;
|
|
2731
|
+
if (!resultManager) {
|
|
2732
|
+
return [null, noop, {}];
|
|
2733
|
+
}
|
|
2734
|
+
const key = keyOfEntity(layerKey);
|
|
1884
2735
|
const [, updateLayerData] = y(resultManager, key, {
|
|
1885
|
-
selector: (data) => data ? pick(data, fieldKey) : data
|
|
2736
|
+
// selector: (data) => (data ? pick(data, fieldKey) : data),
|
|
1886
2737
|
});
|
|
1887
|
-
const { layer, rawLayer } = useNormalizeLayer(key, resultManager);
|
|
1888
|
-
const rawValue = rawLayer
|
|
1889
|
-
const layerValue = layer
|
|
2738
|
+
const { layer, rawLayer } = useNormalizeLayer(key, resultManager, options2);
|
|
2739
|
+
const rawValue = get(rawLayer, fieldKey);
|
|
2740
|
+
const layerValue = get(layer, fieldKey);
|
|
1890
2741
|
const { value: variableValue } = useReadVariable(layerValue);
|
|
1891
2742
|
const currentValue = variableValue ?? layerValue;
|
|
1892
2743
|
const isInherit = isInheritField(resultManager, key, fieldKey);
|
|
1893
2744
|
const isOverride = !isInherit && !isPartOfPrimary(resultManager, key);
|
|
2745
|
+
const setter = layerFieldSetter(resultManager, key, fieldKey, currentValue);
|
|
1894
2746
|
const resetOverride = useCallback(() => {
|
|
1895
2747
|
resultManager.mutate(
|
|
1896
|
-
|
|
2748
|
+
key,
|
|
1897
2749
|
(prev) => {
|
|
1898
|
-
const
|
|
1899
|
-
return
|
|
2750
|
+
const r2 = omit(prev, fieldKey);
|
|
2751
|
+
return r2;
|
|
1900
2752
|
},
|
|
1901
2753
|
{ replace: true }
|
|
1902
2754
|
);
|
|
@@ -1904,37 +2756,26 @@ const useLayerValue = (layerKey, fieldKey, manager) => {
|
|
|
1904
2756
|
const restore = useCallback(
|
|
1905
2757
|
(fallbackValue) => {
|
|
1906
2758
|
var _a, _b, _c;
|
|
1907
|
-
const tempValue = (_c = (_b = resultManager.resolve((_a = resultManager == null ? void 0 : resultManager.$fragment) == null ? void 0 : _a.temp)) == null ? void 0 : _b[
|
|
1908
|
-
updateLayerData({ [fieldKey]: tempValue
|
|
2759
|
+
const tempValue = ((_c = (_b = resultManager.resolve((_a = resultManager == null ? void 0 : resultManager.$fragment) == null ? void 0 : _a.temp)) == null ? void 0 : _b[key]) == null ? void 0 : _c[fieldKey]) ?? fallbackValue;
|
|
2760
|
+
updateLayerData({ [fieldKey]: tempValue });
|
|
2761
|
+
return tempValue;
|
|
1909
2762
|
},
|
|
1910
2763
|
[updateLayerData, resultManager]
|
|
1911
2764
|
);
|
|
1912
2765
|
const updateValue = useCallback(
|
|
1913
|
-
(value,
|
|
1914
|
-
|
|
1915
|
-
const { success, output } = parseLayerField(layer, fieldKey, value);
|
|
1916
|
-
if (success) {
|
|
1917
|
-
if (isVariableLink(value)) {
|
|
1918
|
-
resultManager.mutate((_a = resultManager == null ? void 0 : resultManager.$fragment) == null ? void 0 : _a.temp, {
|
|
1919
|
-
[layerKey]: {
|
|
1920
|
-
[fieldKey]: currentValue
|
|
1921
|
-
}
|
|
1922
|
-
});
|
|
1923
|
-
resultManager.resolve((_b = resultManager == null ? void 0 : resultManager.$fragment) == null ? void 0 : _b.temp);
|
|
1924
|
-
}
|
|
1925
|
-
updateLayerData({ [fieldKey]: output }, options2);
|
|
1926
|
-
}
|
|
2766
|
+
(value, options22) => {
|
|
2767
|
+
setter(value, options22);
|
|
1927
2768
|
},
|
|
1928
|
-
[
|
|
2769
|
+
[setter]
|
|
1929
2770
|
);
|
|
1930
|
-
const { value: cssValue } = useLayerCssVariable(rawValue);
|
|
2771
|
+
const { value: cssValue } = useLayerCssVariable(rawValue ?? layerValue);
|
|
1931
2772
|
return [
|
|
1932
2773
|
currentValue,
|
|
1933
2774
|
updateValue,
|
|
1934
2775
|
{
|
|
1935
2776
|
isOverride,
|
|
1936
2777
|
resetOverride,
|
|
1937
|
-
isVariable: isVariableLink(rawValue ?? layerValue),
|
|
2778
|
+
isVariable: isVariableLink$1(rawValue ?? layerValue),
|
|
1938
2779
|
cssVariableValue: cssValue ?? currentValue,
|
|
1939
2780
|
rawValue,
|
|
1940
2781
|
restore,
|
|
@@ -1942,14 +2783,48 @@ const useLayerValue = (layerKey, fieldKey, manager) => {
|
|
|
1942
2783
|
}
|
|
1943
2784
|
];
|
|
1944
2785
|
};
|
|
2786
|
+
const processOptionalSize = (value, type) => {
|
|
2787
|
+
if (value === -1) return "";
|
|
2788
|
+
if (type === index.sizing.Fixed) return toPx(value);
|
|
2789
|
+
if (type === index.sizing.Relative) return `${value}%`;
|
|
2790
|
+
return "";
|
|
2791
|
+
};
|
|
2792
|
+
const useOptionalSize = (type, layerKey) => {
|
|
2793
|
+
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
2794
|
+
const [value] = useLayerValue(layerKey, type, fragmentManager);
|
|
2795
|
+
const [valueType] = useLayerValue(layerKey, `${type}Type`, fragmentManager);
|
|
2796
|
+
return useMemo(
|
|
2797
|
+
() => processOptionalSize(value, valueType),
|
|
2798
|
+
[valueType, value]
|
|
2799
|
+
);
|
|
2800
|
+
};
|
|
2801
|
+
const useLayerSize = (layerKey) => {
|
|
2802
|
+
const { manager } = useContext(FragmentContext);
|
|
2803
|
+
const minWidth = useOptionalSize("minWidth", layerKey);
|
|
2804
|
+
const minHeight = useOptionalSize("minHeight", layerKey);
|
|
2805
|
+
const maxWidth = useOptionalSize("maxWidth", layerKey);
|
|
2806
|
+
const maxHeight = useOptionalSize("maxHeight", layerKey);
|
|
2807
|
+
return {
|
|
2808
|
+
// width: widthCalc(widthValue),
|
|
2809
|
+
// height: heightCalc(heightValue),
|
|
2810
|
+
minWidth,
|
|
2811
|
+
minHeight,
|
|
2812
|
+
maxWidth,
|
|
2813
|
+
maxHeight
|
|
2814
|
+
};
|
|
2815
|
+
};
|
|
1945
2816
|
const autoSizes = [index.sizing.Hug];
|
|
1946
2817
|
const useLayerSizeValue = (layerKey, sizeType) => {
|
|
1947
2818
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
1948
2819
|
const { layerKey: instanceLayerKey } = useContext(InstanceContext);
|
|
1949
|
-
const { isDocument } = useRenderTarget();
|
|
2820
|
+
const { isDocument, renderTarget: renderTarget2 } = useRenderTarget();
|
|
1950
2821
|
const isTop = isTopLevel(fragmentManager, layerKey);
|
|
1951
2822
|
const isPartOfInstance = !!instanceLayerKey;
|
|
1952
2823
|
const layerParent = getParent(fragmentManager, layerKey);
|
|
2824
|
+
const { layer: normalizeParentLayer } = useNormalizeLayer(
|
|
2825
|
+
layerParent,
|
|
2826
|
+
fragmentManager
|
|
2827
|
+
);
|
|
1953
2828
|
const layerNode = fragmentManager.resolve(layerKey);
|
|
1954
2829
|
const [instanceType] = useLayerValue(
|
|
1955
2830
|
instanceLayerKey,
|
|
@@ -1964,7 +2839,7 @@ const useLayerSizeValue = (layerKey, sizeType) => {
|
|
|
1964
2839
|
const growType = sizeType === "width" ? "horizontalGrow" : "verticalGrow";
|
|
1965
2840
|
return useCallback(
|
|
1966
2841
|
(value) => {
|
|
1967
|
-
if (isTop && isDocument && (
|
|
2842
|
+
if (isTop && isDocument && (normalizeParentLayer == null ? void 0 : normalizeParentLayer[growType]) === index.fragmentGrowingMode.fill) {
|
|
1968
2843
|
return "100%";
|
|
1969
2844
|
}
|
|
1970
2845
|
if (isTop && isPartOfInstance && !autoSizes.includes(instanceType)) {
|
|
@@ -1993,57 +2868,53 @@ const useLayerSizeValue = (layerKey, sizeType) => {
|
|
|
1993
2868
|
]
|
|
1994
2869
|
);
|
|
1995
2870
|
};
|
|
1996
|
-
const processOptionalSize = (value, type) => {
|
|
1997
|
-
if (value === -1) return "";
|
|
1998
|
-
if (type === index.sizing.Fixed) return toPx(value);
|
|
1999
|
-
if (type === index.sizing.Relative) return `${value}%`;
|
|
2000
|
-
return "";
|
|
2001
|
-
};
|
|
2002
|
-
const useOptionalSize = (type, layerKey) => {
|
|
2003
|
-
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
2004
|
-
const [value] = useLayerValue(layerKey, type, fragmentManager);
|
|
2005
|
-
const [valueType] = useLayerValue(layerKey, `${type}Type`, fragmentManager);
|
|
2006
|
-
return useMemo(
|
|
2007
|
-
() => processOptionalSize(value, valueType),
|
|
2008
|
-
[valueType, value]
|
|
2009
|
-
);
|
|
2010
|
-
};
|
|
2011
|
-
const useLayerSize = (layerKey) => {
|
|
2012
|
-
const { manager } = useContext(FragmentContext);
|
|
2013
|
-
const [widthValue] = useLayerValue(layerKey, "width", manager);
|
|
2014
|
-
const [heightValue] = useLayerValue(layerKey, "height", manager);
|
|
2015
|
-
const widthCalc = useLayerSizeValue(layerKey, "width");
|
|
2016
|
-
const heightCalc = useLayerSizeValue(layerKey, "height");
|
|
2017
|
-
const minWidth = useOptionalSize("minWidth", layerKey);
|
|
2018
|
-
const minHeight = useOptionalSize("minHeight", layerKey);
|
|
2019
|
-
const maxWidth = useOptionalSize("maxWidth", layerKey);
|
|
2020
|
-
const maxHeight = useOptionalSize("maxHeight", layerKey);
|
|
2021
|
-
return {
|
|
2022
|
-
width: widthCalc(widthValue),
|
|
2023
|
-
height: heightCalc(heightValue),
|
|
2024
|
-
minWidth,
|
|
2025
|
-
minHeight,
|
|
2026
|
-
maxWidth,
|
|
2027
|
-
maxHeight
|
|
2028
|
-
};
|
|
2029
|
-
};
|
|
2030
2871
|
const useLayerPosition = (layerKey) => {
|
|
2031
2872
|
const { layerKey: instanceLayerKey } = useContext(InstanceContext);
|
|
2032
2873
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
2033
2874
|
const { isDocument } = useRenderTarget();
|
|
2034
2875
|
const isTop = isTopLevel(fragmentManager, layerKey);
|
|
2876
|
+
const [width] = useLayerValue(layerKey, "width");
|
|
2877
|
+
const [height] = useLayerValue(layerKey, "height");
|
|
2878
|
+
const widthCalc = useLayerSizeValue(layerKey, "width")(width);
|
|
2879
|
+
const heightCalc = useLayerSizeValue(layerKey, "height")(height);
|
|
2880
|
+
const [position] = useLayerValue(layerKey, "position");
|
|
2881
|
+
const [centerAnchorX] = useLayerValue(layerKey, "centerAnchorX");
|
|
2882
|
+
const [centerAnchorY] = useLayerValue(layerKey, "centerAnchorY");
|
|
2883
|
+
const [top] = useLayerValue(layerKey, "top");
|
|
2884
|
+
const [left] = useLayerValue(layerKey, "left");
|
|
2885
|
+
const [right] = useLayerValue(layerKey, "right");
|
|
2886
|
+
const [bottom] = useLayerValue(layerKey, "bottom");
|
|
2035
2887
|
const skipPosition = isTop && isDocument || !!instanceLayerKey && isTop;
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2888
|
+
if (isTop && !skipPosition) {
|
|
2889
|
+
return {
|
|
2890
|
+
position: index.positionType.absolute,
|
|
2891
|
+
top: toPx(top),
|
|
2892
|
+
left: toPx(left),
|
|
2893
|
+
width,
|
|
2894
|
+
height
|
|
2895
|
+
};
|
|
2896
|
+
}
|
|
2897
|
+
if (position === index.positionType.relative || skipPosition) {
|
|
2898
|
+
return {
|
|
2899
|
+
position: index.positionType.relative,
|
|
2900
|
+
width: widthCalc,
|
|
2901
|
+
height: heightCalc
|
|
2902
|
+
};
|
|
2903
|
+
}
|
|
2904
|
+
const hasConstrainX = isFiniteNumber(left) && isFiniteNumber(right);
|
|
2905
|
+
const hasConstrainY = isFiniteNumber(top) && isFiniteNumber(bottom);
|
|
2906
|
+
const hasAnyConstrainX = isFiniteNumber(left) || isFiniteNumber(right);
|
|
2907
|
+
const hasAnyConstrainY = isFiniteNumber(top) || isFiniteNumber(bottom);
|
|
2908
|
+
return {
|
|
2909
|
+
position,
|
|
2910
|
+
left: isFiniteNumber(left) ? toPx(left) : !isFiniteNumber(right) ? `${centerAnchorX * 100}%` : null,
|
|
2911
|
+
top: isFiniteNumber(top) ? toPx(top) : !isFiniteNumber(bottom) ? `${centerAnchorY * 100}%` : null,
|
|
2912
|
+
right: isFiniteNumber(right) ? toPx(right) : null,
|
|
2913
|
+
bottom: isFiniteNumber(bottom) ? toPx(bottom) : null,
|
|
2914
|
+
width: hasConstrainX ? null : widthCalc,
|
|
2915
|
+
height: hasConstrainY ? null : heightCalc,
|
|
2916
|
+
transform: !hasAnyConstrainX || !hasAnyConstrainY ? `translate3d(${!hasAnyConstrainX ? "-50%" : 0}, ${!hasAnyConstrainY ? "-50%" : 0}, 0px)` : null
|
|
2917
|
+
};
|
|
2047
2918
|
};
|
|
2048
2919
|
const useLayerBackground = (layerKey) => {
|
|
2049
2920
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
@@ -2053,7 +2924,7 @@ const useLayerBackground = (layerKey) => {
|
|
|
2053
2924
|
"solidFill",
|
|
2054
2925
|
fragmentManager
|
|
2055
2926
|
);
|
|
2056
|
-
const [, , { cssVariableValue: cssImageFill }] = useLayerValue(
|
|
2927
|
+
const [imageFill, , { cssVariableValue: cssImageFill }] = useLayerValue(
|
|
2057
2928
|
layerKey,
|
|
2058
2929
|
"imageFill",
|
|
2059
2930
|
fragmentManager
|
|
@@ -2070,13 +2941,10 @@ const useLayerBackground = (layerKey) => {
|
|
|
2070
2941
|
};
|
|
2071
2942
|
}
|
|
2072
2943
|
if (fillType === index.paintMode.Image && cssImageFill) {
|
|
2073
|
-
const sizeMap = {
|
|
2074
|
-
[index.imagePaintScaleModes.Fill]: "cover",
|
|
2075
|
-
[index.imagePaintScaleModes.Fit]: "contain"
|
|
2076
|
-
};
|
|
2077
2944
|
return {
|
|
2078
|
-
background: `url(${
|
|
2079
|
-
backgroundSize:
|
|
2945
|
+
background: `url(${imageFill})`,
|
|
2946
|
+
backgroundSize: cssImageSize == null ? void 0 : cssImageSize.toLowerCase(),
|
|
2947
|
+
backgroundRepeat: "no-repeat"
|
|
2080
2948
|
};
|
|
2081
2949
|
}
|
|
2082
2950
|
return {
|
|
@@ -2103,9 +2971,31 @@ const useCalcLayerBorder = (layerKey) => {
|
|
|
2103
2971
|
fragmentManager
|
|
2104
2972
|
);
|
|
2105
2973
|
return (width, color) => {
|
|
2106
|
-
let value =
|
|
2974
|
+
let value = {
|
|
2975
|
+
borderTop: ``,
|
|
2976
|
+
borderRight: ``,
|
|
2977
|
+
borderBottom: ``,
|
|
2978
|
+
borderLeft: ``
|
|
2979
|
+
};
|
|
2107
2980
|
if (typeof borderTypeValue === "string" && borderTypeValue !== index.borderType.None) {
|
|
2108
|
-
|
|
2981
|
+
const staticPart = `${borderTypeValue.toLowerCase()} ${color}`;
|
|
2982
|
+
const widthSides = width == null ? void 0 : width.split(" ");
|
|
2983
|
+
if (widthSides.length === 1) {
|
|
2984
|
+
const widthValue = widthSides == null ? void 0 : widthSides.at(0);
|
|
2985
|
+
value = {
|
|
2986
|
+
borderTop: `${widthValue} ${staticPart}`,
|
|
2987
|
+
borderRight: `${widthValue} ${staticPart}`,
|
|
2988
|
+
borderBottom: `${widthValue} ${staticPart}`,
|
|
2989
|
+
borderLeft: `${widthValue} ${staticPart}`
|
|
2990
|
+
};
|
|
2991
|
+
} else {
|
|
2992
|
+
value = {
|
|
2993
|
+
borderTop: `${widthSides == null ? void 0 : widthSides.at(0)} ${staticPart}`,
|
|
2994
|
+
borderRight: `${widthSides == null ? void 0 : widthSides.at(1)} ${staticPart}`,
|
|
2995
|
+
borderBottom: `${widthSides == null ? void 0 : widthSides.at(2)} ${staticPart}`,
|
|
2996
|
+
borderLeft: `${widthSides == null ? void 0 : widthSides.at(3)} ${staticPart}`
|
|
2997
|
+
};
|
|
2998
|
+
}
|
|
2109
2999
|
}
|
|
2110
3000
|
return value;
|
|
2111
3001
|
};
|
|
@@ -2116,7 +3006,7 @@ const useLayerBorder = (layerKey) => {
|
|
|
2116
3006
|
const [borderColor] = useLayerValue(layerKey, "borderColor", fragmentManager);
|
|
2117
3007
|
const calcBorder = useCalcLayerBorder(layerKey);
|
|
2118
3008
|
return useMemo(
|
|
2119
|
-
() =>
|
|
3009
|
+
() => calcBorder(borderWidth, borderColor),
|
|
2120
3010
|
[borderWidth, borderColor]
|
|
2121
3011
|
);
|
|
2122
3012
|
};
|
|
@@ -2162,8 +3052,17 @@ const useLayerLayout = (layerKey) => {
|
|
|
2162
3052
|
]
|
|
2163
3053
|
);
|
|
2164
3054
|
};
|
|
3055
|
+
const useLayerTextStyles = (layerKey) => {
|
|
3056
|
+
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
3057
|
+
const [attributes] = useLayerValue(layerKey, "attributes", fragmentManager);
|
|
3058
|
+
const [color] = useLayerValue(layerKey, "attributes.color", fragmentManager);
|
|
3059
|
+
const cleanAttributes = omit(attributes, "_id", "_type");
|
|
3060
|
+
return {
|
|
3061
|
+
...cleanAttributes,
|
|
3062
|
+
color
|
|
3063
|
+
};
|
|
3064
|
+
};
|
|
2165
3065
|
const useLayerStyles = (layerKey) => {
|
|
2166
|
-
var _a;
|
|
2167
3066
|
try {
|
|
2168
3067
|
if (!layerKey) {
|
|
2169
3068
|
throw new Error("Empty layer key");
|
|
@@ -2171,140 +3070,151 @@ const useLayerStyles = (layerKey) => {
|
|
|
2171
3070
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
2172
3071
|
const [opacity] = useLayerValue(layerKey, "opacity", fragmentManager);
|
|
2173
3072
|
const layerSize = useLayerSize(layerKey);
|
|
2174
|
-
const
|
|
3073
|
+
const position = useLayerPosition(layerKey);
|
|
2175
3074
|
const display = useLayerDisplay(layerKey);
|
|
2176
3075
|
const background = useLayerBackground(layerKey);
|
|
2177
|
-
const
|
|
3076
|
+
const border = useLayerBorder(layerKey);
|
|
2178
3077
|
const layout = useLayerLayout(layerKey);
|
|
2179
3078
|
const [zIndex] = useLayerValue(layerKey, "zIndex", fragmentManager);
|
|
3079
|
+
const [rotate] = useLayerValue(layerKey, "rotate", fragmentManager);
|
|
2180
3080
|
const [borderRadius] = useLayerValue(
|
|
2181
3081
|
layerKey,
|
|
2182
3082
|
"borderRadius",
|
|
2183
3083
|
fragmentManager
|
|
2184
3084
|
);
|
|
2185
3085
|
const [whiteSpace2] = useLayerValue(layerKey, "whiteSpace", fragmentManager);
|
|
2186
|
-
|
|
2187
|
-
const { _type } = fragmentManager.entityOfKey(layerKey) ?? {};
|
|
2188
|
-
if (_type === index.nodes.Instance) {
|
|
2189
|
-
const instanceProps = omit(
|
|
2190
|
-
(_a = fragmentManager == null ? void 0 : fragmentManager.resolve(layerKey)) == null ? void 0 : _a.props,
|
|
2191
|
-
"_id",
|
|
2192
|
-
"_type"
|
|
2193
|
-
);
|
|
2194
|
-
props = Object.entries(instanceProps).reduce((acc, [key, value]) => {
|
|
2195
|
-
acc[`--${key}`] = value;
|
|
2196
|
-
return acc;
|
|
2197
|
-
}, {});
|
|
2198
|
-
}
|
|
3086
|
+
const textStyles = useLayerTextStyles(layerKey);
|
|
2199
3087
|
return {
|
|
2200
|
-
...props ?? {},
|
|
2201
|
-
|
|
2202
|
-
border,
|
|
3088
|
+
// ...(props ?? {}),
|
|
3089
|
+
...border,
|
|
2203
3090
|
...background,
|
|
2204
|
-
position,
|
|
2205
|
-
top,
|
|
2206
|
-
left,
|
|
3091
|
+
...position,
|
|
2207
3092
|
opacity,
|
|
3093
|
+
rotate: isValue(rotate) ? `${rotate}deg` : null,
|
|
2208
3094
|
"border-radius": borderRadius,
|
|
2209
3095
|
"white-space": whiteSpace2,
|
|
2210
3096
|
"z-index": zIndex !== -1 ? zIndex : null,
|
|
2211
3097
|
...layout,
|
|
2212
3098
|
...layerSize,
|
|
3099
|
+
...textStyles,
|
|
3100
|
+
display,
|
|
2213
3101
|
"user-select": "none"
|
|
3102
|
+
// ...cssOverride,
|
|
2214
3103
|
};
|
|
2215
|
-
} catch (
|
|
2216
|
-
console.debug(e);
|
|
3104
|
+
} catch (e2) {
|
|
2217
3105
|
return {};
|
|
2218
3106
|
}
|
|
2219
3107
|
};
|
|
2220
|
-
const GlobalManager$1 = createContext(null);
|
|
2221
|
-
const useGlobalManager = (globalManager) => {
|
|
2222
|
-
var _a, _b;
|
|
2223
|
-
const currentGlobalManager = useContext(GlobalManager$1);
|
|
2224
|
-
const resultManager = globalManager ?? currentGlobalManager;
|
|
2225
|
-
const [fragmentsGraph] = y(
|
|
2226
|
-
resultManager,
|
|
2227
|
-
(_a = resultManager == null ? void 0 : resultManager.$fragments) == null ? void 0 : _a.key
|
|
2228
|
-
);
|
|
2229
|
-
const queryFragmentManager = async (id) => {
|
|
2230
|
-
var _a2;
|
|
2231
|
-
const queryResult = await ((_a2 = resultManager == null ? void 0 : resultManager.$fetch) == null ? void 0 : _a2.queryFragment(id));
|
|
2232
|
-
const { document: document2, linkedFragments } = queryResult ?? {};
|
|
2233
|
-
if (linkedFragments) {
|
|
2234
|
-
linkedFragments.forEach(({ id: id2, document: document22 }) => {
|
|
2235
|
-
resultManager.$fragments.createFragmentManager(id2, document22);
|
|
2236
|
-
});
|
|
2237
|
-
}
|
|
2238
|
-
return resultManager.$fragments.createFragmentManager(id, document2);
|
|
2239
|
-
};
|
|
2240
|
-
const setRenderTarget = (value) => {
|
|
2241
|
-
resultManager == null ? void 0 : resultManager.setRenderTarget(value);
|
|
2242
|
-
};
|
|
2243
|
-
return {
|
|
2244
|
-
fragmentsGraph,
|
|
2245
|
-
manager: resultManager,
|
|
2246
|
-
queryFragmentManager,
|
|
2247
|
-
getFragmentManager: ((_b = resultManager == null ? void 0 : resultManager.$fragments) == null ? void 0 : _b.getManager) ?? noop,
|
|
2248
|
-
setRenderTarget
|
|
2249
|
-
};
|
|
2250
|
-
};
|
|
2251
|
-
const useFragmentManager = (fragmentId, inputGlobalManager) => {
|
|
2252
|
-
const {
|
|
2253
|
-
fragmentsGraph,
|
|
2254
|
-
manager: globalManager,
|
|
2255
|
-
getFragmentManager,
|
|
2256
|
-
queryFragmentManager
|
|
2257
|
-
} = useGlobalManager(inputGlobalManager);
|
|
2258
|
-
const [loading, setLoading] = useState(false);
|
|
2259
|
-
useEffect(() => {
|
|
2260
|
-
(async () => {
|
|
2261
|
-
if (fragmentsGraph && !getFragmentManager(fragmentId)) {
|
|
2262
|
-
setLoading(true);
|
|
2263
|
-
await queryFragmentManager(fragmentId);
|
|
2264
|
-
setLoading(false);
|
|
2265
|
-
}
|
|
2266
|
-
})();
|
|
2267
|
-
}, [fragmentId, fragmentsGraph]);
|
|
2268
|
-
return {
|
|
2269
|
-
loading,
|
|
2270
|
-
manager: getFragmentManager(fragmentId),
|
|
2271
|
-
queryFragmentManager
|
|
2272
|
-
// loadFragmentManager,
|
|
2273
|
-
};
|
|
2274
|
-
};
|
|
2275
3108
|
const useFragmentProperties = (fragmentId) => {
|
|
2276
3109
|
var _a;
|
|
2277
3110
|
const { manager } = useFragmentManager(fragmentId);
|
|
2278
3111
|
const [instanceFragment] = y(manager, (_a = manager == null ? void 0 : manager.$fragment) == null ? void 0 : _a.root);
|
|
2279
3112
|
return {
|
|
2280
|
-
properties: (instanceFragment == null ? void 0 : instanceFragment.properties) ?? [],
|
|
3113
|
+
properties: ((instanceFragment == null ? void 0 : instanceFragment.properties) ?? []).map((manager == null ? void 0 : manager.resolve) ?? noop).filter((prop) => !(prop == null ? void 0 : prop.parent)).map(keyOfEntity),
|
|
2281
3114
|
manager
|
|
2282
3115
|
};
|
|
2283
3116
|
};
|
|
2284
|
-
const useHash = (layerKey) => {
|
|
2285
|
-
const { manager } = useContext(FragmentContext);
|
|
3117
|
+
const useHash = (layerKey, manager) => {
|
|
2286
3118
|
if (!layerKey || !manager) return null;
|
|
2287
3119
|
const layer = manager.resolve(layerKey);
|
|
2288
3120
|
const overrideFrom = getKey(layer == null ? void 0 : layer.overrideFrom);
|
|
2289
3121
|
return hashGenerator(overrideFrom ?? layerKey);
|
|
2290
3122
|
};
|
|
3123
|
+
const useInstanceProps = (instanceProps) => {
|
|
3124
|
+
const isTopInstance = !(instanceProps == null ? void 0 : instanceProps.layerKey);
|
|
3125
|
+
const { manager: loadedManager } = useFragmentManager(
|
|
3126
|
+
isTopInstance ? instanceProps == null ? void 0 : instanceProps.fragmentId : null
|
|
3127
|
+
);
|
|
3128
|
+
const { manager: fragmentContextManager } = useContext(FragmentContext);
|
|
3129
|
+
const { properties: definitions, manager: innerFragmentManager } = useFragmentProperties(instanceProps == null ? void 0 : instanceProps.fragmentId);
|
|
3130
|
+
const definitionsData = S(innerFragmentManager, definitions);
|
|
3131
|
+
const fragmentManager = isTopInstance ? loadedManager : fragmentContextManager;
|
|
3132
|
+
const [instanceLayer] = y(fragmentManager, instanceProps.layerKey);
|
|
3133
|
+
const instanceLayerProps = (instanceLayer == null ? void 0 : instanceLayer.props) ?? {};
|
|
3134
|
+
const mergedProps = useMemo(() => {
|
|
3135
|
+
let base = instanceLayerProps;
|
|
3136
|
+
if (isTopInstance && isObject(base) && isObject(instanceProps == null ? void 0 : instanceProps.props)) {
|
|
3137
|
+
base = {
|
|
3138
|
+
...base,
|
|
3139
|
+
...instanceProps == null ? void 0 : instanceProps.props
|
|
3140
|
+
};
|
|
3141
|
+
}
|
|
3142
|
+
if (isTopInstance && fragmentManager) {
|
|
3143
|
+
definitionsData.forEach((definition2) => {
|
|
3144
|
+
var _a;
|
|
3145
|
+
const defId = definition2._id;
|
|
3146
|
+
base[defId] = ((_a = instanceProps == null ? void 0 : instanceProps.props) == null ? void 0 : _a[defId]) ?? (definition2 == null ? void 0 : definition2.defaultValue);
|
|
3147
|
+
});
|
|
3148
|
+
}
|
|
3149
|
+
return omit(base, "_type", "_id");
|
|
3150
|
+
}, [isTopInstance, fragmentManager, instanceLayerProps, definitionsData]);
|
|
3151
|
+
return {
|
|
3152
|
+
props: mergedProps,
|
|
3153
|
+
cssProps: getCssVariables(mergedProps)
|
|
3154
|
+
};
|
|
3155
|
+
};
|
|
3156
|
+
const useLayerInteractions = (layerKey, options2) => {
|
|
3157
|
+
const pause = (options2 == null ? void 0 : options2.pauseInteractions) ?? false;
|
|
3158
|
+
const { manager: globalManager } = useGlobalManager();
|
|
3159
|
+
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
3160
|
+
const [interactions2] = useLayerValue(
|
|
3161
|
+
layerKey,
|
|
3162
|
+
"interactions",
|
|
3163
|
+
fragmentManager
|
|
3164
|
+
);
|
|
3165
|
+
const { readVariable } = useReadVariable();
|
|
3166
|
+
const fireEvent = useCallback(
|
|
3167
|
+
(eventLink) => {
|
|
3168
|
+
var _a, _b, _c, _d;
|
|
3169
|
+
const event = fragmentManager.resolve(eventLink);
|
|
3170
|
+
const { value: eventValue } = readVariable(eventLink);
|
|
3171
|
+
if ((event == null ? void 0 : event.mode) === index.eventMode.goal && (eventValue == null ? void 0 : eventValue.code)) {
|
|
3172
|
+
(_b = (_a = globalManager == null ? void 0 : globalManager.$metrics) == null ? void 0 : _a.reachGoal) == null ? void 0 : _b.call(_a, eventValue == null ? void 0 : eventValue.code);
|
|
3173
|
+
}
|
|
3174
|
+
if ((event == null ? void 0 : event.mode) === index.eventMode.tracker && eventValue) {
|
|
3175
|
+
(_d = (_c = globalManager == null ? void 0 : globalManager.$metrics) == null ? void 0 : _c.trackAdPixel) == null ? void 0 : _d.call(_c, eventValue);
|
|
3176
|
+
}
|
|
3177
|
+
if ((event == null ? void 0 : event.mode) === index.eventMode.callback && typeof eventValue === "function") {
|
|
3178
|
+
eventValue();
|
|
3179
|
+
}
|
|
3180
|
+
},
|
|
3181
|
+
[globalManager, fragmentManager]
|
|
3182
|
+
);
|
|
3183
|
+
useEffect(() => {
|
|
3184
|
+
if (!pause && Array.isArray(interactions2)) {
|
|
3185
|
+
interactions2 == null ? void 0 : interactions2.filter((el) => (el == null ? void 0 : el.on) === index.interactions.appear).map((el) => el.event).forEach(fireEvent);
|
|
3186
|
+
}
|
|
3187
|
+
}, [pause]);
|
|
3188
|
+
return useMemo(() => {
|
|
3189
|
+
if (!pause && !interactions2 || !Array.isArray(interactions2)) return {};
|
|
3190
|
+
if (pause) return {};
|
|
3191
|
+
const clickEvents = interactions2 == null ? void 0 : interactions2.filter((el) => (el == null ? void 0 : el.on) === index.interactions.click).map((el) => el.event);
|
|
3192
|
+
return {
|
|
3193
|
+
onClick: () => {
|
|
3194
|
+
clickEvents.map(fireEvent);
|
|
3195
|
+
}
|
|
3196
|
+
};
|
|
3197
|
+
}, [interactions2, fireEvent, pause]);
|
|
3198
|
+
};
|
|
2291
3199
|
const useInstance = (instanceProps) => {
|
|
2292
3200
|
const { manager: parentManager } = useContext(FragmentContext);
|
|
2293
3201
|
const [instanceLayer] = y(parentManager, instanceProps.layerKey);
|
|
2294
|
-
const instanceLayerProps = (instanceLayer == null ? void 0 : instanceLayer.props) ?? {};
|
|
2295
3202
|
const styles2 = useLayerStyles(instanceProps.layerKey);
|
|
3203
|
+
const events = useLayerInteractions(instanceProps.layerKey, instanceProps);
|
|
2296
3204
|
const { manager: resultGlobalManager } = useGlobalManager(
|
|
2297
3205
|
instanceProps == null ? void 0 : instanceProps.globalManager
|
|
2298
3206
|
);
|
|
2299
|
-
const resultProps = { ...instanceLayerProps, ...instanceProps.props ?? {} };
|
|
2300
3207
|
const resultFragmentId = (instanceProps == null ? void 0 : instanceProps.fragmentId) ?? (instanceLayer == null ? void 0 : instanceLayer.fragment);
|
|
2301
3208
|
const { properties: definitions, manager: innerFragmentManager } = useFragmentProperties(resultFragmentId);
|
|
2302
|
-
const
|
|
3209
|
+
const { props, cssProps } = useInstanceProps(instanceProps);
|
|
3210
|
+
const hash = useHash(instanceProps.layerKey, innerFragmentManager);
|
|
2303
3211
|
return {
|
|
2304
3212
|
hash,
|
|
2305
3213
|
styles: styles2,
|
|
3214
|
+
events,
|
|
2306
3215
|
definitions,
|
|
2307
|
-
props
|
|
3216
|
+
props,
|
|
3217
|
+
cssProps,
|
|
2308
3218
|
parentManager,
|
|
2309
3219
|
innerManager: innerFragmentManager,
|
|
2310
3220
|
fragmentId: resultFragmentId,
|
|
@@ -2327,10 +3237,9 @@ const useLayerChildren = (layerKey, customManager) => {
|
|
|
2327
3237
|
};
|
|
2328
3238
|
const useFragmentChildren = (fragmentId) => {
|
|
2329
3239
|
const { layerKey: instanceLayerKey } = useContext(InstanceContext);
|
|
2330
|
-
const { manager } = useFragmentManager(fragmentId);
|
|
2331
|
-
const
|
|
2332
|
-
const
|
|
2333
|
-
const { isDocument } = useRenderTarget();
|
|
3240
|
+
const { manager, fragmentLayerKey } = useFragmentManager(fragmentId);
|
|
3241
|
+
const children = useLayerChildren(fragmentLayerKey, manager);
|
|
3242
|
+
const { isDocument, renderTarget: renderTarget2 } = useRenderTarget();
|
|
2334
3243
|
const [resizeChildren, setResizeChildren] = useState(null);
|
|
2335
3244
|
useRef();
|
|
2336
3245
|
const setRef = useCallback(
|
|
@@ -2352,147 +3261,133 @@ const useFragmentChildren = (fragmentId) => {
|
|
|
2352
3261
|
setRef
|
|
2353
3262
|
};
|
|
2354
3263
|
};
|
|
2355
|
-
const
|
|
2356
|
-
|
|
2357
|
-
if (isLink2) {
|
|
2358
|
-
const [type, id] = fragmentKey.split(":");
|
|
2359
|
-
return `stylesheet-${id}`;
|
|
2360
|
-
}
|
|
2361
|
-
return `stylesheet-unknown`;
|
|
2362
|
-
};
|
|
2363
|
-
function useInjectedStyle() {
|
|
2364
|
-
const { manager } = useContext(FragmentContext);
|
|
2365
|
-
const injectStyle = () => {
|
|
2366
|
-
var _a, _b;
|
|
2367
|
-
const styles2 = (_b = (_a = manager == null ? void 0 : manager.$styleSheet.extract()) == null ? void 0 : _a.at(0)) == null ? void 0 : _b.styles;
|
|
2368
|
-
if (isBrowser_default && styles2) {
|
|
2369
|
-
const stylesheetKey = getStylesheetKey(manager == null ? void 0 : manager.key);
|
|
2370
|
-
if (document.getElementById(stylesheetKey)) {
|
|
2371
|
-
const el = document.getElementById(stylesheetKey);
|
|
2372
|
-
if (el) el.remove();
|
|
2373
|
-
}
|
|
2374
|
-
const style = document.createElement("style");
|
|
2375
|
-
style.id = stylesheetKey;
|
|
2376
|
-
style.textContent = styles2.join("");
|
|
2377
|
-
document.head.appendChild(style);
|
|
2378
|
-
}
|
|
2379
|
-
};
|
|
2380
|
-
return {
|
|
2381
|
-
injectStyle
|
|
2382
|
-
};
|
|
2383
|
-
}
|
|
2384
|
-
const useStyleSheet = () => {
|
|
2385
|
-
const { manager } = useContext(FragmentContext);
|
|
2386
|
-
const { injectStyle } = useInjectedStyle();
|
|
3264
|
+
const useStyleSheet = (manager) => {
|
|
3265
|
+
var _a, _b;
|
|
2387
3266
|
const addLayerStyle = useCallback(
|
|
2388
3267
|
(layerKey, styles2, layer) => {
|
|
2389
|
-
var
|
|
2390
|
-
if ("addStyle" in (manager == null ? void 0 : manager.$styleSheet)) {
|
|
2391
|
-
(
|
|
2392
|
-
if (isBrowser_default) {
|
|
2393
|
-
injectStyle();
|
|
2394
|
-
}
|
|
3268
|
+
var _a2, _b2;
|
|
3269
|
+
if (!!(manager == null ? void 0 : manager.$styleSheet) && manager && "addStyle" in (manager == null ? void 0 : manager.$styleSheet)) {
|
|
3270
|
+
(_b2 = (_a2 = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a2.addStyle) == null ? void 0 : _b2.call(_a2, layerKey, styles2, layer);
|
|
2395
3271
|
}
|
|
2396
3272
|
},
|
|
2397
3273
|
[manager]
|
|
2398
3274
|
);
|
|
2399
3275
|
return {
|
|
2400
|
-
addLayerStyle
|
|
3276
|
+
addLayerStyle,
|
|
3277
|
+
mount: ((_a = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a.mount) ?? noop,
|
|
3278
|
+
unmount: ((_b = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _b.unmount) ?? noop
|
|
2401
3279
|
};
|
|
2402
3280
|
};
|
|
2403
3281
|
const useFragment = (fragmentId, globalManager) => {
|
|
2404
|
-
|
|
2405
|
-
const
|
|
3282
|
+
var _a, _b;
|
|
3283
|
+
const instanceContext = useContext(InstanceContext);
|
|
3284
|
+
const fragmentContext = useFragmentManager(fragmentId);
|
|
2406
3285
|
const { isDocument } = useRenderTarget();
|
|
2407
|
-
const { setRef, children, isResize } = useFragmentChildren(fragmentId);
|
|
2408
|
-
const hash = useHash(
|
|
2409
|
-
|
|
2410
|
-
|
|
3286
|
+
const { setRef, children, isResize, primary } = useFragmentChildren(fragmentId);
|
|
3287
|
+
const hash = useHash(
|
|
3288
|
+
fragmentContext.fragmentLayerKey,
|
|
3289
|
+
fragmentContext.manager
|
|
3290
|
+
);
|
|
3291
|
+
const { properties: definitions } = useFragmentProperties(fragmentId);
|
|
3292
|
+
const scopes = useContext(ScopeContext);
|
|
3293
|
+
!(scopes == null ? void 0 : scopes.length);
|
|
3294
|
+
const { addLayerStyle, mount, unmount } = useStyleSheet(
|
|
3295
|
+
fragmentContext.manager
|
|
3296
|
+
);
|
|
3297
|
+
if (fragmentContext.manager) {
|
|
2411
3298
|
addLayerStyle(
|
|
2412
|
-
|
|
3299
|
+
fragmentContext.fragmentLayerKey,
|
|
2413
3300
|
{
|
|
2414
3301
|
width: "100%",
|
|
2415
3302
|
height: "100%",
|
|
2416
3303
|
"container-type": (children == null ? void 0 : children.length) === 1 ? "normal" : "inline-size"
|
|
2417
3304
|
},
|
|
2418
|
-
manager == null ? void 0 :
|
|
2419
|
-
manager == null ? void 0 :
|
|
3305
|
+
(_a = fragmentContext.manager) == null ? void 0 : _a.resolve(fragmentContext.fragmentLayerKey),
|
|
3306
|
+
(_b = fragmentContext.manager) == null ? void 0 : _b.key
|
|
2420
3307
|
);
|
|
3308
|
+
mount();
|
|
2421
3309
|
}
|
|
3310
|
+
useEffect(() => {
|
|
3311
|
+
return () => {
|
|
3312
|
+
unmount();
|
|
3313
|
+
};
|
|
3314
|
+
}, []);
|
|
2422
3315
|
return {
|
|
2423
3316
|
hash,
|
|
2424
3317
|
isDocument,
|
|
2425
|
-
|
|
3318
|
+
fragmentContext,
|
|
3319
|
+
layerKey: fragmentContext.fragmentLayerKey,
|
|
3320
|
+
isTopFragment: !instanceContext.layerKey,
|
|
2426
3321
|
setRef,
|
|
2427
3322
|
children,
|
|
2428
|
-
isResize
|
|
3323
|
+
isResize,
|
|
3324
|
+
definitions
|
|
2429
3325
|
};
|
|
2430
3326
|
};
|
|
2431
|
-
const
|
|
2432
|
-
const { manager: globalManager } = useGlobalManager();
|
|
3327
|
+
const useLayerLink = (layerKey) => {
|
|
2433
3328
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
2434
|
-
const [
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
)
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
const clickEvents = interactions2 == null ? void 0 : interactions2.filter((el) => (el == null ? void 0 : el.on) === index.interactions.click).map((el) => el.event);
|
|
2454
|
-
return {
|
|
2455
|
-
onClick: () => {
|
|
2456
|
-
clickEvents.map(fireEvent);
|
|
2457
|
-
}
|
|
2458
|
-
};
|
|
2459
|
-
}, [interactions2, fireEvent]);
|
|
3329
|
+
const [href] = useLayerValue(layerKey, "href", fragmentManager);
|
|
3330
|
+
const [hrefNewTab] = useLayerValue(layerKey, "hrefNewTab", fragmentManager);
|
|
3331
|
+
const isLink2 = isValue(href) && typeof href === "string" && !!(href == null ? void 0 : href.length);
|
|
3332
|
+
const linkTarget2 = hrefNewTab ? "_blank" : "";
|
|
3333
|
+
const linkProps = useMemo(() => {
|
|
3334
|
+
if (isLink2) {
|
|
3335
|
+
return {
|
|
3336
|
+
target: linkTarget2,
|
|
3337
|
+
href
|
|
3338
|
+
};
|
|
3339
|
+
}
|
|
3340
|
+
return {};
|
|
3341
|
+
}, [linkTarget2, href, isLink2]);
|
|
3342
|
+
return {
|
|
3343
|
+
isLink: isLink2,
|
|
3344
|
+
linkHref: href,
|
|
3345
|
+
linkTarget: hrefNewTab ? "_blank" : "",
|
|
3346
|
+
linkProps
|
|
3347
|
+
};
|
|
2460
3348
|
};
|
|
2461
|
-
const useFrame = (layerKey) => {
|
|
3349
|
+
const useFrame = (layerKey, options2) => {
|
|
3350
|
+
const collectStyle = (options2 == null ? void 0 : options2.collectStyle) ?? true;
|
|
2462
3351
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
2463
3352
|
const layer = fragmentManager.entityOfKey(layerKey);
|
|
2464
3353
|
const styles2 = useLayerStyles(layerKey);
|
|
2465
3354
|
const children = useLayerChildren(layerKey);
|
|
2466
|
-
const hash = useHash(layerKey);
|
|
2467
|
-
const { addLayerStyle } = useStyleSheet();
|
|
2468
|
-
const events = useLayerInteractions(layerKey);
|
|
2469
|
-
|
|
3355
|
+
const hash = useHash(layerKey, fragmentManager);
|
|
3356
|
+
const { addLayerStyle } = useStyleSheet(fragmentManager);
|
|
3357
|
+
const events = useLayerInteractions(layerKey, options2);
|
|
3358
|
+
const link = useLayerLink(layerKey);
|
|
3359
|
+
if (collectStyle) {
|
|
3360
|
+
addLayerStyle(layerKey, styles2, fragmentManager.resolve(layerKey));
|
|
3361
|
+
}
|
|
2470
3362
|
return {
|
|
3363
|
+
Tag: (link == null ? void 0 : link.isLink) ? (options2 == null ? void 0 : options2.FrameTag) ?? "a" : (options2 == null ? void 0 : options2.FrameTag) ?? "div",
|
|
2471
3364
|
type: layer == null ? void 0 : layer._type,
|
|
2472
3365
|
hash,
|
|
2473
3366
|
styles: {},
|
|
2474
3367
|
//isBrowser ? pick(styles, "background") : {},
|
|
2475
3368
|
children,
|
|
2476
|
-
events
|
|
3369
|
+
events,
|
|
3370
|
+
linkProps: link.linkProps
|
|
2477
3371
|
};
|
|
2478
3372
|
};
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
"
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
3373
|
+
function extractVariablesFromHtml(html) {
|
|
3374
|
+
if (!html) return [];
|
|
3375
|
+
const regex = /<span(?=\s)(?=(?:[^>]*?\s)?class="[^"]*variable[^"]*")(?=(?:[^>]*?\s)?data-type="mention")(?=(?:[^>]*?\s)?data-id="([^"]+)")[^>]*>.*?<\/span>/gi;
|
|
3376
|
+
const mentions = [];
|
|
3377
|
+
let match;
|
|
3378
|
+
while ((match = regex.exec(html)) !== null) {
|
|
3379
|
+
mentions.push({
|
|
3380
|
+
fullMatch: match[0],
|
|
3381
|
+
dataId: match[1],
|
|
3382
|
+
variableKey: keyOfEntity({
|
|
3383
|
+
_type: index.nodes.Variable,
|
|
3384
|
+
_id: match[1]
|
|
3385
|
+
}),
|
|
3386
|
+
position: match.index
|
|
3387
|
+
});
|
|
3388
|
+
}
|
|
3389
|
+
return mentions;
|
|
3390
|
+
}
|
|
2496
3391
|
const useTextContent = (layerKey, manager) => {
|
|
2497
3392
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
2498
3393
|
const [content, , contentInfo] = useLayerValue(
|
|
@@ -2500,22 +3395,33 @@ const useTextContent = (layerKey, manager) => {
|
|
|
2500
3395
|
"content",
|
|
2501
3396
|
fragmentManager
|
|
2502
3397
|
);
|
|
2503
|
-
const
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
3398
|
+
const variables = extractVariablesFromHtml(content);
|
|
3399
|
+
const { readVariable } = useReadVariable();
|
|
3400
|
+
S(
|
|
3401
|
+
fragmentManager,
|
|
3402
|
+
variables.map((variable) => variable.variableKey)
|
|
3403
|
+
);
|
|
3404
|
+
let nextContent = content;
|
|
3405
|
+
variables.forEach((variable) => {
|
|
3406
|
+
nextContent = nextContent.replace(
|
|
3407
|
+
variable.fullMatch,
|
|
3408
|
+
readVariable(variable.variableKey).value
|
|
3409
|
+
);
|
|
3410
|
+
});
|
|
3411
|
+
return nextContent;
|
|
2510
3412
|
};
|
|
2511
|
-
const useTextAttributes = (layerKey) => {
|
|
3413
|
+
const useTextAttributes = (layerKey, options2) => {
|
|
3414
|
+
const collectStyle = (options2 == null ? void 0 : options2.collectStyle) ?? true;
|
|
2512
3415
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
2513
3416
|
const styles2 = useLayerStyles(layerKey);
|
|
2514
3417
|
const content = useTextContent(layerKey);
|
|
2515
|
-
const hash = useHash(layerKey);
|
|
2516
|
-
const { addLayerStyle } = useStyleSheet();
|
|
2517
|
-
|
|
3418
|
+
const hash = useHash(layerKey, fragmentManager);
|
|
3419
|
+
const { addLayerStyle } = useStyleSheet(fragmentManager);
|
|
3420
|
+
if (collectStyle) {
|
|
3421
|
+
addLayerStyle(layerKey, styles2, fragmentManager.resolve(layerKey));
|
|
3422
|
+
}
|
|
2518
3423
|
return {
|
|
3424
|
+
styles: styles2,
|
|
2519
3425
|
hash,
|
|
2520
3426
|
content
|
|
2521
3427
|
};
|
|
@@ -2530,150 +3436,524 @@ function useMounted() {
|
|
|
2530
3436
|
}, []);
|
|
2531
3437
|
return isMounted;
|
|
2532
3438
|
}
|
|
3439
|
+
const allowAttributes = [
|
|
3440
|
+
"fontSize",
|
|
3441
|
+
"fontWeight",
|
|
3442
|
+
"color",
|
|
3443
|
+
"lineHeight",
|
|
3444
|
+
"letterSpacing",
|
|
3445
|
+
"textTransform",
|
|
3446
|
+
"textDecoration",
|
|
3447
|
+
"textAlign"
|
|
3448
|
+
];
|
|
3449
|
+
const wrapTextInParagraphWithAttributes = (text2, attributes) => {
|
|
3450
|
+
if (text2.startsWith("<p")) return text2;
|
|
3451
|
+
const style = Object.entries(attributes).filter(
|
|
3452
|
+
([key, value]) => isValue(value) && allowAttributes.includes(key) && typeof value === "string" && !!value.length
|
|
3453
|
+
).map(([key, value]) => `${toKebabCase(key)}: ${value}`).join("; ");
|
|
3454
|
+
return `<p style="${style}">${text2}</p>`;
|
|
3455
|
+
};
|
|
3456
|
+
const findBreakpoint = (breakpoints = [], width) => {
|
|
3457
|
+
if (!(breakpoints == null ? void 0 : breakpoints.length)) return null;
|
|
3458
|
+
const sortBreakpoints = breakpoints.toSorted((a2, b) => (a2 == null ? void 0 : a2.width) - (b == null ? void 0 : b.width));
|
|
3459
|
+
return sortBreakpoints.reduce(
|
|
3460
|
+
(prev, curr) => width >= curr.width ? curr : prev
|
|
3461
|
+
);
|
|
3462
|
+
};
|
|
3463
|
+
const copyLayer = (manager, layer) => {
|
|
3464
|
+
const layerGraph = manager.resolve(layer);
|
|
3465
|
+
if (layerGraph) {
|
|
3466
|
+
const layer2 = createLayer(
|
|
3467
|
+
{
|
|
3468
|
+
_type: layerGraph._type,
|
|
3469
|
+
...layerGraph
|
|
3470
|
+
},
|
|
3471
|
+
true
|
|
3472
|
+
);
|
|
3473
|
+
if ((layerGraph == null ? void 0 : layerGraph.children) && layer2) {
|
|
3474
|
+
layer2.children = ((layerGraph == null ? void 0 : layerGraph.children) ?? []).map(
|
|
3475
|
+
(child) => copyLayer(manager, child)
|
|
3476
|
+
);
|
|
3477
|
+
}
|
|
3478
|
+
return layer2;
|
|
3479
|
+
}
|
|
3480
|
+
return null;
|
|
3481
|
+
};
|
|
3482
|
+
const getStylesheetKey = (fragmentKey) => {
|
|
3483
|
+
const isLink2 = isLinkKey(fragmentKey);
|
|
3484
|
+
if (isLink2) {
|
|
3485
|
+
const [type, id] = fragmentKey.split(":");
|
|
3486
|
+
return `stylesheet-${id}`;
|
|
3487
|
+
}
|
|
3488
|
+
return `stylesheet-${fragmentKey ?? "unknown"}`;
|
|
3489
|
+
};
|
|
3490
|
+
function useInjectedStyle() {
|
|
3491
|
+
const { manager } = useContext(FragmentContext);
|
|
3492
|
+
const injectStyle = () => {
|
|
3493
|
+
var _a, _b;
|
|
3494
|
+
const styles2 = (_b = (_a = manager == null ? void 0 : manager.$styleSheet.extract()) == null ? void 0 : _a.at(0)) == null ? void 0 : _b.styles;
|
|
3495
|
+
if (isBrowser_default && styles2) {
|
|
3496
|
+
const stylesheetKey = getStylesheetKey(manager == null ? void 0 : manager.key);
|
|
3497
|
+
if (document.getElementById(stylesheetKey)) {
|
|
3498
|
+
const el = document.getElementById(stylesheetKey);
|
|
3499
|
+
if (el) el.remove();
|
|
3500
|
+
}
|
|
3501
|
+
const style = document.createElement("style");
|
|
3502
|
+
style.id = stylesheetKey;
|
|
3503
|
+
style.textContent = styles2.join("");
|
|
3504
|
+
document.head.appendChild(style);
|
|
3505
|
+
}
|
|
3506
|
+
};
|
|
3507
|
+
return {
|
|
3508
|
+
injectStyle
|
|
3509
|
+
};
|
|
3510
|
+
}
|
|
3511
|
+
const useLayerScopes = (fragmentManager, layerKey) => {
|
|
3512
|
+
var _a, _b;
|
|
3513
|
+
const layerParents = getAllParents(fragmentManager, layerKey);
|
|
3514
|
+
const resultScopes = [(_b = (_a = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a.scopes) == null ? void 0 : _b.get(void 0)];
|
|
3515
|
+
layerParents.forEach((parent) => {
|
|
3516
|
+
var _a2, _b2, _c, _d;
|
|
3517
|
+
const parentLink = keyOfEntity(parent);
|
|
3518
|
+
if ((_b2 = (_a2 = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a2.scopes) == null ? void 0 : _b2.has(parentLink)) {
|
|
3519
|
+
resultScopes.push((_d = (_c = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _c.scopes) == null ? void 0 : _d.get(parentLink));
|
|
3520
|
+
}
|
|
3521
|
+
});
|
|
3522
|
+
return resultScopes;
|
|
3523
|
+
};
|
|
3524
|
+
function cssToJsStyle(cssKey) {
|
|
3525
|
+
return cssKey.replace(/-([a-z])/g, (_2, letter) => letter.toUpperCase());
|
|
3526
|
+
}
|
|
3527
|
+
function cssStringToJsObject(cssString) {
|
|
3528
|
+
const jsStyles = {};
|
|
3529
|
+
const declarations = cssString.split(";");
|
|
3530
|
+
declarations.forEach((decl) => {
|
|
3531
|
+
if (!decl.trim()) return;
|
|
3532
|
+
const [property, value] = decl.split(":").map((s2) => s2.trim());
|
|
3533
|
+
if (!property || !value) return;
|
|
3534
|
+
const jsProperty = cssToJsStyle(property);
|
|
3535
|
+
jsStyles[jsProperty] = value;
|
|
3536
|
+
});
|
|
3537
|
+
return jsStyles;
|
|
3538
|
+
}
|
|
3539
|
+
const useLayerCssOverride = (layerKey) => {
|
|
3540
|
+
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
3541
|
+
const [cssOverride] = useLayerValue(layerKey, "cssOverride", fragmentManager);
|
|
3542
|
+
return isValue(cssOverride) ? cssStringToJsObject(cssOverride) : {};
|
|
3543
|
+
};
|
|
2533
3544
|
const StyleSheetContext = createContext(null);
|
|
2534
|
-
StyleSheetContext.Provider;
|
|
2535
|
-
const
|
|
2536
|
-
const {
|
|
2537
|
-
|
|
3545
|
+
const StyleSheetProvider = StyleSheetContext.Provider;
|
|
3546
|
+
const useArea = (options2) => {
|
|
3547
|
+
const { manager: resultGlobalManager, queryArea } = useGlobalManager(
|
|
3548
|
+
options2 == null ? void 0 : options2.globalManager
|
|
3549
|
+
);
|
|
3550
|
+
const [areaData, setAreaData] = useState(queryArea(options2.areaCode));
|
|
3551
|
+
useEffect(() => {
|
|
3552
|
+
(async () => {
|
|
3553
|
+
const response = await queryArea(options2.areaCode);
|
|
3554
|
+
if (response) {
|
|
3555
|
+
setAreaData(response);
|
|
3556
|
+
}
|
|
3557
|
+
})();
|
|
3558
|
+
}, []);
|
|
3559
|
+
return {
|
|
3560
|
+
...areaData,
|
|
3561
|
+
globalManager: resultGlobalManager
|
|
3562
|
+
};
|
|
3563
|
+
};
|
|
3564
|
+
const useCollection = (layerKey, options2) => {
|
|
3565
|
+
var _a;
|
|
3566
|
+
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
3567
|
+
const frame = useFrame(layerKey, options2);
|
|
3568
|
+
const children = useLayerChildren(layerKey, fragmentManager);
|
|
3569
|
+
const [collectionLayer] = y(fragmentManager, layerKey, {
|
|
3570
|
+
selector: (graph) => pick(graph, "source")
|
|
3571
|
+
});
|
|
3572
|
+
const source = collectionLayer == null ? void 0 : collectionLayer.source;
|
|
3573
|
+
const sourceDefinition = (_a = fragmentManager == null ? void 0 : fragmentManager.resolve(source)) == null ? void 0 : _a.definition;
|
|
3574
|
+
const [sourceValue] = useLayerValue(layerKey, "source", fragmentManager);
|
|
3575
|
+
return {
|
|
3576
|
+
source,
|
|
3577
|
+
sourceDefinition,
|
|
3578
|
+
sourceValue: sourceValue ?? [],
|
|
3579
|
+
fragmentManager,
|
|
3580
|
+
children,
|
|
3581
|
+
...frame
|
|
3582
|
+
};
|
|
3583
|
+
};
|
|
3584
|
+
const text = "_text_1tdzv_1";
|
|
3585
|
+
const styles = {
|
|
3586
|
+
text
|
|
3587
|
+
};
|
|
3588
|
+
const Text = ({
|
|
3589
|
+
layerKey,
|
|
3590
|
+
Tag = "div",
|
|
3591
|
+
collectStyle,
|
|
3592
|
+
...restProps
|
|
3593
|
+
}) => {
|
|
3594
|
+
const { hash, content } = useTextAttributes(layerKey, { collectStyle });
|
|
3595
|
+
return /* @__PURE__ */ jsx(Tag, { className: hash, "data-key": layerKey, ...restProps, children: /* @__PURE__ */ jsx(
|
|
3596
|
+
"div",
|
|
3597
|
+
{
|
|
3598
|
+
className: styles.text,
|
|
3599
|
+
dangerouslySetInnerHTML: { __html: content }
|
|
3600
|
+
}
|
|
3601
|
+
) });
|
|
3602
|
+
};
|
|
3603
|
+
const Scope = ({
|
|
3604
|
+
value,
|
|
3605
|
+
children,
|
|
3606
|
+
fragmentManager,
|
|
3607
|
+
layerKey
|
|
3608
|
+
}) => {
|
|
3609
|
+
var _a, _b;
|
|
3610
|
+
const currentScope = useContext(ScopeContext) ?? [];
|
|
3611
|
+
const nextScope = [...currentScope, value];
|
|
3612
|
+
(_b = (_a = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a.registerScope) == null ? void 0 : _b.call(_a, layerKey, value);
|
|
3613
|
+
return /* @__PURE__ */ jsx(ScopeContext.Provider, { value: nextScope, children });
|
|
3614
|
+
};
|
|
3615
|
+
const Collection = ({
|
|
3616
|
+
layerKey,
|
|
3617
|
+
styles: inputStyles,
|
|
3618
|
+
...restProps
|
|
3619
|
+
}) => {
|
|
3620
|
+
var _a;
|
|
3621
|
+
const {
|
|
3622
|
+
fragmentManager,
|
|
3623
|
+
styles: styles2,
|
|
3624
|
+
sourceDefinition,
|
|
3625
|
+
hash,
|
|
3626
|
+
source,
|
|
3627
|
+
children,
|
|
3628
|
+
sourceValue
|
|
3629
|
+
} = useCollection(layerKey, restProps);
|
|
3630
|
+
const FrameTag = (restProps == null ? void 0 : restProps.FrameTag) ?? "div";
|
|
3631
|
+
const FrameElement = (restProps == null ? void 0 : restProps.FrameElement) ?? Frame;
|
|
3632
|
+
const resultStyles = inputStyles ?? styles2;
|
|
3633
|
+
return /* @__PURE__ */ jsx(
|
|
3634
|
+
Scope,
|
|
3635
|
+
{
|
|
3636
|
+
fragmentManager,
|
|
3637
|
+
layerKey,
|
|
3638
|
+
value: {
|
|
3639
|
+
type: definition.scopeTypes.CollectionScope,
|
|
3640
|
+
source,
|
|
3641
|
+
manager: fragmentManager
|
|
3642
|
+
},
|
|
3643
|
+
children: /* @__PURE__ */ jsx(
|
|
3644
|
+
FrameTag,
|
|
3645
|
+
{
|
|
3646
|
+
className: hash,
|
|
3647
|
+
"data-key": layerKey,
|
|
3648
|
+
style: resultStyles,
|
|
3649
|
+
...restProps,
|
|
3650
|
+
children: (_a = sourceValue == null ? void 0 : sourceValue.map) == null ? void 0 : _a.call(sourceValue, (collectionItem, index2) => /* @__PURE__ */ jsx(
|
|
3651
|
+
Scope,
|
|
3652
|
+
{
|
|
3653
|
+
fragmentManager,
|
|
3654
|
+
layerKey: `${layerKey}.${index2}`,
|
|
3655
|
+
value: {
|
|
3656
|
+
type: definition.scopeTypes.CollectionItemScope,
|
|
3657
|
+
source,
|
|
3658
|
+
sourceDefinition,
|
|
3659
|
+
value: collectionItem,
|
|
3660
|
+
manager: fragmentManager
|
|
3661
|
+
},
|
|
3662
|
+
children: children == null ? void 0 : children.map((child) => /* @__PURE__ */ jsx(
|
|
3663
|
+
"div",
|
|
3664
|
+
{
|
|
3665
|
+
style: {
|
|
3666
|
+
display: "contents",
|
|
3667
|
+
...getCssVariables(collectionItem ?? {})
|
|
3668
|
+
},
|
|
3669
|
+
children: /* @__PURE__ */ jsx(FrameElement, { ...restProps, layerKey: child })
|
|
3670
|
+
},
|
|
3671
|
+
child
|
|
3672
|
+
))
|
|
3673
|
+
}
|
|
3674
|
+
))
|
|
3675
|
+
}
|
|
3676
|
+
)
|
|
3677
|
+
}
|
|
3678
|
+
);
|
|
2538
3679
|
};
|
|
2539
|
-
const Frame = ({
|
|
2540
|
-
|
|
3680
|
+
const Frame = ({
|
|
3681
|
+
layerKey,
|
|
3682
|
+
styles: inputStyles,
|
|
3683
|
+
hidden,
|
|
3684
|
+
interactive,
|
|
3685
|
+
...restProps
|
|
3686
|
+
}) => {
|
|
3687
|
+
const { styles: styles2, hash, children, type, events, linkProps, Tag } = useFrame(
|
|
3688
|
+
layerKey,
|
|
3689
|
+
{
|
|
3690
|
+
...restProps,
|
|
3691
|
+
pauseInteractions: !interactive
|
|
3692
|
+
}
|
|
3693
|
+
);
|
|
3694
|
+
const resultStyles = inputStyles ?? styles2;
|
|
2541
3695
|
const isMounted = useMounted();
|
|
2542
3696
|
if (isMounted && hidden) {
|
|
2543
|
-
return
|
|
3697
|
+
return /* @__PURE__ */ jsx("div", {});
|
|
3698
|
+
}
|
|
3699
|
+
if (type === definition.nodes.Collection) {
|
|
3700
|
+
const Tag2 = (restProps == null ? void 0 : restProps.CollectionElement) ?? Collection;
|
|
3701
|
+
return /* @__PURE__ */ jsx(Tag2, { layerKey, ...restProps });
|
|
2544
3702
|
}
|
|
2545
3703
|
if (type === definition.nodes.Text) {
|
|
2546
|
-
|
|
3704
|
+
const Tag2 = (restProps == null ? void 0 : restProps.TextElement) ?? Text;
|
|
3705
|
+
return /* @__PURE__ */ jsx(Tag2, { layerKey, ...restProps });
|
|
2547
3706
|
}
|
|
2548
3707
|
if (type === definition.nodes.Instance) {
|
|
2549
|
-
|
|
3708
|
+
const Tag2 = (restProps == null ? void 0 : restProps.InstanceElement) ?? Instance;
|
|
3709
|
+
return /* @__PURE__ */ jsx(Tag2, { layerKey, ...restProps });
|
|
2550
3710
|
}
|
|
3711
|
+
const FrameElement = (restProps == null ? void 0 : restProps.FrameElement) ?? Frame;
|
|
2551
3712
|
return /* @__PURE__ */ jsx(
|
|
2552
|
-
|
|
3713
|
+
Tag,
|
|
2553
3714
|
{
|
|
2554
3715
|
className: hash,
|
|
2555
3716
|
"data-key": layerKey,
|
|
2556
|
-
style: {
|
|
3717
|
+
style: {
|
|
3718
|
+
...resultStyles,
|
|
3719
|
+
display: hidden ? "none" : resultStyles.display
|
|
3720
|
+
},
|
|
2557
3721
|
...events,
|
|
2558
|
-
|
|
3722
|
+
...linkProps,
|
|
3723
|
+
...restProps,
|
|
3724
|
+
children: children.map((childLink) => /* @__PURE__ */ jsx(FrameElement, { layerKey: childLink, ...restProps }, childLink))
|
|
2559
3725
|
}
|
|
2560
3726
|
);
|
|
2561
3727
|
};
|
|
2562
|
-
const FragmentInternal = ({
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
3728
|
+
const FragmentInternal = ({
|
|
3729
|
+
fragmentId,
|
|
3730
|
+
globalManager,
|
|
3731
|
+
interactive,
|
|
3732
|
+
collectStyle,
|
|
3733
|
+
FrameElement = Frame
|
|
3734
|
+
}) => {
|
|
3735
|
+
const {
|
|
3736
|
+
children,
|
|
3737
|
+
fragmentContext,
|
|
3738
|
+
hash,
|
|
3739
|
+
isResize,
|
|
3740
|
+
isTopFragment,
|
|
3741
|
+
definitions,
|
|
3742
|
+
layerKey
|
|
3743
|
+
} = useFragment(fragmentId);
|
|
3744
|
+
if (!fragmentContext.manager) return null;
|
|
3745
|
+
return (
|
|
3746
|
+
// <Scope
|
|
3747
|
+
// fragmentManager={fragmentContext.manager}
|
|
3748
|
+
// layerKey={layerKey}
|
|
3749
|
+
// value={{
|
|
3750
|
+
// type: definition.scopeTypes.FragmentScope,
|
|
3751
|
+
// manager: fragmentContext.manager,
|
|
3752
|
+
// definitions,
|
|
3753
|
+
// }}
|
|
3754
|
+
// >
|
|
3755
|
+
/* @__PURE__ */ jsx("div", { "data-key": layerKey, className: hash, children: children.map((childLink) => {
|
|
3756
|
+
var _a;
|
|
3757
|
+
const childLayer = (_a = fragmentContext.manager) == null ? void 0 : _a.resolve(childLink);
|
|
3758
|
+
const isPrimary = (childLayer == null ? void 0 : childLayer.isPrimary) ?? false;
|
|
3759
|
+
return /* @__PURE__ */ jsx(
|
|
3760
|
+
FrameElement,
|
|
3761
|
+
{
|
|
3762
|
+
layerKey: childLink,
|
|
3763
|
+
interactive,
|
|
3764
|
+
collectStyle,
|
|
3765
|
+
hidden: !isResize && !isPrimary && !isTopFragment,
|
|
3766
|
+
style: { display: isPrimary ? null : "none" }
|
|
3767
|
+
},
|
|
3768
|
+
childLink
|
|
3769
|
+
);
|
|
3770
|
+
}) })
|
|
2585
3771
|
);
|
|
2586
3772
|
};
|
|
2587
3773
|
const Fragment = (props) => {
|
|
2588
|
-
const
|
|
3774
|
+
const currentGlobalManager = useContext(GlobalManager);
|
|
3775
|
+
const { manager: resultGlobalManager } = useGlobalManager(
|
|
3776
|
+
props.globalManager
|
|
3777
|
+
);
|
|
2589
3778
|
const { manager } = useFragmentManager(props.fragmentId, resultGlobalManager);
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
const loadFragmentManager = async (globalManager, fragmentId) => {
|
|
2594
|
-
var _a;
|
|
2595
|
-
const { document: document2, linkedFragments } = await ((_a = globalManager == null ? void 0 : globalManager.queryFragment) == null ? void 0 : _a.call(
|
|
2596
|
-
globalManager,
|
|
2597
|
-
fragmentId
|
|
2598
|
-
));
|
|
2599
|
-
if (fragmentId && document2) {
|
|
2600
|
-
if (linkedFragments) {
|
|
2601
|
-
linkedFragments.forEach(({ id, document: document22 }) => {
|
|
2602
|
-
globalManager == null ? void 0 : globalManager.createFragmentManager(id, document22);
|
|
2603
|
-
});
|
|
2604
|
-
}
|
|
2605
|
-
return globalManager == null ? void 0 : globalManager.createFragmentManager(fragmentId, document2);
|
|
3779
|
+
const Base = /* @__PURE__ */ jsx(FragmentContext.Provider, { value: { manager }, children: /* @__PURE__ */ jsx(FragmentInternal, { ...props }) });
|
|
3780
|
+
if (!currentGlobalManager) {
|
|
3781
|
+
return /* @__PURE__ */ jsx(GlobalManager.Provider, { value: resultGlobalManager, children: Base });
|
|
2606
3782
|
}
|
|
2607
|
-
return
|
|
3783
|
+
return Base;
|
|
2608
3784
|
};
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
result = e;
|
|
2621
|
-
}
|
|
2622
|
-
);
|
|
2623
|
-
const resource = {
|
|
2624
|
-
read() {
|
|
2625
|
-
if (status === "pending") throw suspender;
|
|
2626
|
-
if (status === "error") throw result;
|
|
2627
|
-
return result;
|
|
2628
|
-
}
|
|
2629
|
-
};
|
|
2630
|
-
resourceCache.set(key, resource);
|
|
2631
|
-
return resource;
|
|
2632
|
-
}
|
|
2633
|
-
const InstanceInitial = (instanceProps) => {
|
|
3785
|
+
const InstanceInitial = ({
|
|
3786
|
+
Tag: inputTag,
|
|
3787
|
+
style = {},
|
|
3788
|
+
interactive = true,
|
|
3789
|
+
FrameElement,
|
|
3790
|
+
...instanceProps
|
|
3791
|
+
}) => {
|
|
3792
|
+
var _a, _b, _c;
|
|
3793
|
+
const ssr = ((_a = instanceProps == null ? void 0 : instanceProps.options) == null ? void 0 : _a.ssr) ?? true;
|
|
3794
|
+
const link = useLayerLink(instanceProps.layerKey);
|
|
3795
|
+
const Tag = (link == null ? void 0 : link.isLink) ? inputTag ?? "a" : inputTag ?? "div";
|
|
2634
3796
|
const {
|
|
2635
3797
|
fragmentId,
|
|
3798
|
+
cssProps,
|
|
2636
3799
|
parentManager,
|
|
3800
|
+
events,
|
|
2637
3801
|
props,
|
|
2638
3802
|
hash,
|
|
2639
3803
|
innerManager,
|
|
2640
3804
|
definitions,
|
|
2641
3805
|
globalManager
|
|
2642
|
-
} = useInstance(
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
globalManager.resourceCache,
|
|
2649
|
-
fragmentId,
|
|
2650
|
-
() => loadFragmentManager(globalManager, fragmentId)
|
|
2651
|
-
);
|
|
2652
|
-
resource.read();
|
|
3806
|
+
} = useInstance({
|
|
3807
|
+
...instanceProps,
|
|
3808
|
+
pauseInteractions: !interactive
|
|
3809
|
+
});
|
|
3810
|
+
if (ssr) {
|
|
3811
|
+
(_c = (_b = globalManager == null ? void 0 : globalManager.$load) == null ? void 0 : _b.loadFragment) == null ? void 0 : _c.call(_b, fragmentId, { suspense: true });
|
|
2653
3812
|
}
|
|
2654
3813
|
return /* @__PURE__ */ jsx(
|
|
2655
|
-
|
|
3814
|
+
Scope,
|
|
2656
3815
|
{
|
|
3816
|
+
fragmentManager: innerManager,
|
|
3817
|
+
layerKey: instanceProps.layerKey,
|
|
2657
3818
|
value: {
|
|
2658
|
-
|
|
3819
|
+
type: definition.scopeTypes.InstanceScope,
|
|
3820
|
+
props,
|
|
2659
3821
|
definitions,
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
3822
|
+
fragmentId,
|
|
3823
|
+
documentManager: innerManager,
|
|
3824
|
+
layerKey: instanceProps.layerKey
|
|
2663
3825
|
},
|
|
2664
|
-
children:
|
|
3826
|
+
children: /* @__PURE__ */ jsx(
|
|
3827
|
+
InstanceContext.Provider,
|
|
3828
|
+
{
|
|
3829
|
+
value: {
|
|
3830
|
+
layerKey: instanceProps.layerKey,
|
|
3831
|
+
definitions,
|
|
3832
|
+
innerManager,
|
|
3833
|
+
parentManager,
|
|
3834
|
+
props
|
|
3835
|
+
},
|
|
3836
|
+
children: parentManager ? /* @__PURE__ */ jsx(
|
|
3837
|
+
Tag,
|
|
3838
|
+
{
|
|
3839
|
+
className: hash,
|
|
3840
|
+
"data-key": instanceProps.layerKey,
|
|
3841
|
+
style: { ...style, ...cssProps },
|
|
3842
|
+
...link.linkProps,
|
|
3843
|
+
...events,
|
|
3844
|
+
children: /* @__PURE__ */ jsx(
|
|
3845
|
+
Fragment,
|
|
3846
|
+
{
|
|
3847
|
+
fragmentId,
|
|
3848
|
+
globalManager,
|
|
3849
|
+
FrameElement,
|
|
3850
|
+
interactive
|
|
3851
|
+
}
|
|
3852
|
+
)
|
|
3853
|
+
}
|
|
3854
|
+
) : /* @__PURE__ */ jsx(Tag, { style: { ...style, ...cssProps }, ...link.linkProps, children: /* @__PURE__ */ jsx(
|
|
3855
|
+
Fragment,
|
|
3856
|
+
{
|
|
3857
|
+
fragmentId,
|
|
3858
|
+
globalManager,
|
|
3859
|
+
FrameElement,
|
|
3860
|
+
interactive
|
|
3861
|
+
}
|
|
3862
|
+
) })
|
|
3863
|
+
}
|
|
3864
|
+
)
|
|
2665
3865
|
}
|
|
2666
3866
|
);
|
|
2667
3867
|
};
|
|
2668
3868
|
const Instance = (props) => {
|
|
2669
|
-
return "globalManager" in props ? /* @__PURE__ */ jsx(GlobalManager
|
|
3869
|
+
return "globalManager" in props ? /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("h1", { children: "Test" }), children: /* @__PURE__ */ jsx(GlobalManager, { value: props.globalManager, children: /* @__PURE__ */ jsx(InstanceInitial, { ...props }) }) }) : /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("h1", { children: "Test" }), children: /* @__PURE__ */ jsx(InstanceInitial, { ...props }) });
|
|
3870
|
+
};
|
|
3871
|
+
const isBrowser = typeof window !== "undefined";
|
|
3872
|
+
const AreaInitial = (areaProps) => {
|
|
3873
|
+
var _a, _b, _c;
|
|
3874
|
+
const { manager: globalManager } = useGlobalManager(areaProps == null ? void 0 : areaProps.globalManager);
|
|
3875
|
+
const ssr = ((_a = areaProps == null ? void 0 : areaProps.options) == null ? void 0 : _a.ssr) ?? true;
|
|
3876
|
+
if (isBrowser || ssr) {
|
|
3877
|
+
(_c = (_b = globalManager == null ? void 0 : globalManager.$load) == null ? void 0 : _b.loadArea) == null ? void 0 : _c.call(_b, areaProps.areaCode, {
|
|
3878
|
+
suspense: true
|
|
3879
|
+
});
|
|
3880
|
+
}
|
|
3881
|
+
const areaData = useArea(areaProps);
|
|
3882
|
+
if (!areaData) return null;
|
|
3883
|
+
return /* @__PURE__ */ jsx(Instance, { fragmentId: areaData.fragmentId, props: areaData == null ? void 0 : areaData.props });
|
|
2670
3884
|
};
|
|
2671
|
-
const
|
|
2672
|
-
return /* @__PURE__ */ jsx(GlobalManager
|
|
3885
|
+
const Area = (props) => {
|
|
3886
|
+
return "globalManager" in props ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(GlobalManager, { value: props.globalManager, children: /* @__PURE__ */ jsx(AreaInitial, { ...props }) }) }) : /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(AreaInitial, { ...props }) });
|
|
2673
3887
|
};
|
|
2674
3888
|
export {
|
|
3889
|
+
Area,
|
|
3890
|
+
Collection,
|
|
3891
|
+
Fragment,
|
|
3892
|
+
FragmentContext,
|
|
3893
|
+
Frame,
|
|
2675
3894
|
GlobalManager,
|
|
2676
3895
|
Instance,
|
|
3896
|
+
InstanceContext,
|
|
3897
|
+
RenderTargetContext,
|
|
3898
|
+
RenderTargetProvider,
|
|
3899
|
+
Scope,
|
|
3900
|
+
ScopeContext,
|
|
3901
|
+
StyleSheetContext,
|
|
3902
|
+
StyleSheetProvider,
|
|
3903
|
+
Text,
|
|
3904
|
+
appendChildren,
|
|
3905
|
+
J as cloneElement,
|
|
3906
|
+
cloneLayer,
|
|
2677
3907
|
collectStyles,
|
|
2678
|
-
|
|
3908
|
+
copyLayer,
|
|
3909
|
+
_ as createElement,
|
|
3910
|
+
createLayer,
|
|
3911
|
+
declareFragmentProperty,
|
|
3912
|
+
duplicateLayer,
|
|
3913
|
+
findBreakpoint,
|
|
3914
|
+
getAllParents,
|
|
3915
|
+
getCssVariables,
|
|
3916
|
+
getNormalizeLayer,
|
|
3917
|
+
getOverrider,
|
|
3918
|
+
getParent,
|
|
3919
|
+
_ as h,
|
|
3920
|
+
G as hydrate,
|
|
3921
|
+
insertChildren,
|
|
3922
|
+
isInheritField,
|
|
3923
|
+
isPartOfPrimary,
|
|
3924
|
+
isRootLayer,
|
|
3925
|
+
isTopLevel,
|
|
3926
|
+
layerFieldSetter,
|
|
3927
|
+
makeSnapshot,
|
|
3928
|
+
moveChildren,
|
|
3929
|
+
processOptionalSize,
|
|
3930
|
+
removeChildren,
|
|
3931
|
+
E as render,
|
|
3932
|
+
useArea,
|
|
3933
|
+
useCalcLayerBorder,
|
|
3934
|
+
useCollection,
|
|
3935
|
+
useFragment,
|
|
3936
|
+
useFragmentChildren,
|
|
3937
|
+
useFragmentManager,
|
|
3938
|
+
useFragmentProperties,
|
|
3939
|
+
useFrame,
|
|
3940
|
+
useGlobalManager,
|
|
3941
|
+
useInjectedStyle,
|
|
3942
|
+
useInstance,
|
|
3943
|
+
useLayerChildren,
|
|
3944
|
+
useLayerCssOverride,
|
|
3945
|
+
useLayerDisplay,
|
|
3946
|
+
useLayerLayout,
|
|
3947
|
+
useLayerLink,
|
|
3948
|
+
useLayerScopes,
|
|
3949
|
+
useLayerSizeValue,
|
|
3950
|
+
useLayerTextStyles,
|
|
3951
|
+
useLayerValue,
|
|
3952
|
+
useMounted,
|
|
3953
|
+
useNormalizeLayer,
|
|
3954
|
+
useReadVariable,
|
|
3955
|
+
useRenderTarget,
|
|
3956
|
+
useTextAttributes,
|
|
3957
|
+
useTextContent,
|
|
3958
|
+
wrapTextInParagraphWithAttributes
|
|
2679
3959
|
};
|