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