tempo-sdk 0.0.99 → 0.0.101
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/README.md +3 -403
- package/dist/assets/editor.d.ts +43 -65
- package/dist/assets/editor.js +1 -573
- package/dist/assets/index.d.ts +11 -61
- package/dist/assets/index.js +1 -338
- package/dist/assets/parser.d.ts +68 -78
- package/dist/assets/parser.js +1 -33
- package/dist/astro/asset-preview-client.d.ts +3 -2
- package/dist/astro/asset-preview-client.js +1 -93
- package/dist/astro/controls.d.ts +1 -3
- package/dist/astro/controls.js +1 -7
- package/dist/astro/document-client.d.ts +5 -6
- package/dist/astro/document-client.js +1 -78
- package/dist/astro/runtime.d.ts +23 -11
- package/dist/astro/runtime.js +1 -86
- package/dist/astro.d.ts +19 -13
- package/dist/astro.js +1 -818
- package/dist/canvas/astro-contract.d.ts +0 -3
- package/dist/canvas/astro-contract.js +1 -9
- package/dist/canvas/astro.d.ts +3 -4
- package/dist/canvas/astro.js +1 -42
- package/dist/canvas/editor.d.ts +187 -183
- package/dist/canvas/editor.js +1 -1094
- package/dist/canvas/flutter-preview.d.ts +0 -1
- package/dist/canvas/flutter-preview.js +1 -9
- package/dist/canvas/index.d.ts +46 -100
- package/dist/canvas/index.js +1 -3926
- package/dist/canvas/interact-projection.d.ts +7 -5
- package/dist/canvas/interact-projection.js +1 -12
- package/dist/canvas/parser.d.ts +10 -303
- package/dist/canvas/parser.js +1 -30
- package/dist/canvas/svelte.d.ts +6 -7
- package/dist/canvas/svelte.js +1 -91
- package/dist/canvas/vue.d.ts +9 -49
- package/dist/canvas/vue.js +1 -264
- package/dist/chunk-FH6TMWFA.js +1 -0
- package/dist/chunk-GQIOB5SV.js +1 -0
- package/dist/chunk-HBQ7FFH7.js +1 -0
- package/dist/chunk-JRJOWLCN.js +1 -0
- package/dist/chunk-M3GN2KUH.js +1 -0
- package/dist/chunk-MPIHFFML.js +1 -0
- package/dist/chunk-N2V6XXRK.js +1 -0
- package/dist/chunk-QNVQ7U2W.js +1 -0
- package/dist/chunk-T5TY3U2H.js +1 -0
- package/dist/chunk-TK37FQAR.js +1 -0
- package/dist/chunk-XO2BSHWM.js +1 -0
- package/dist/chunk-XUSV3KOD.js +1 -0
- package/dist/chunk-YRBEBVG4.js +1 -0
- package/dist/{controls-uCaQ3CNX.d.ts → controls-DKslABtM.d.ts} +0 -3
- package/dist/expo/plugin.cjs +1 -1928
- package/dist/expo/plugin.js +1 -8
- package/dist/expo-babel-plugin.cjs +1 -1928
- package/dist/expo-babel-plugin.d.cts +46 -40
- package/dist/expo-babel-plugin.d.ts +46 -40
- package/dist/expo-babel-plugin.js +1 -8
- package/dist/flutter-preview-path.d.ts +23 -7
- package/dist/flutter-preview-path.js +1 -16
- package/dist/index.d.ts +33 -45
- package/dist/index.js +1 -20
- package/dist/nextjs/plugin.cjs +1 -413
- package/dist/nextjs/plugin.js +1 -7
- package/dist/nextjs-loader.cjs +1 -2277
- package/dist/nextjs.cjs +1 -484
- package/dist/nextjs.d.cts +2 -58
- package/dist/nextjs.d.ts +2 -58
- package/dist/nextjs.js +1 -17
- package/dist/nuxt/runtime/identity.d.ts +2 -4
- package/dist/nuxt/runtime/identity.js +1 -18
- package/dist/nuxt.d.ts +31 -92
- package/dist/nuxt.js +1 -5854
- package/dist/{page-DwLnOM5d.d.ts → page-Bc8PekIX.d.ts} +1 -5
- package/dist/parser.d-MO5ciJ5n.d.ts +236 -0
- package/dist/{storyboard-CMJVBSXn.d.ts → storyboard.contract.d-UQ4MUYN5.d.ts} +3 -25
- package/dist/svelte.d.ts +8 -18
- package/dist/svelte.js +1 -917
- package/dist/types-CfUgM2w4.d.ts +57 -0
- package/dist/v1-client-compat-n0E0XxuX.d.ts +5 -0
- package/dist/vue.d.ts +17 -58
- package/dist/vue.js +1 -1501
- package/package.json +12 -62
- package/dist/assets/editor.js.map +0 -1
- package/dist/assets/index.js.map +0 -1
- package/dist/assets/parser.js.map +0 -1
- package/dist/astro/asset-preview-client.js.map +0 -1
- package/dist/astro/controls.js.map +0 -1
- package/dist/astro/document-client.js.map +0 -1
- package/dist/astro/runtime.js.map +0 -1
- package/dist/astro.js.map +0 -1
- package/dist/canvas/astro-contract.js.map +0 -1
- package/dist/canvas/astro.js.map +0 -1
- package/dist/canvas/editor.js.map +0 -1
- package/dist/canvas/flutter-preview.js.map +0 -1
- package/dist/canvas/index.js.map +0 -1
- package/dist/canvas/interact-projection.js.map +0 -1
- package/dist/canvas/parser.js.map +0 -1
- package/dist/canvas/svelte.js.map +0 -1
- package/dist/canvas/vue.js.map +0 -1
- package/dist/chunk-27WT3XUG.js +0 -455
- package/dist/chunk-27WT3XUG.js.map +0 -1
- package/dist/chunk-5HIIF354.js +0 -67
- package/dist/chunk-5HIIF354.js.map +0 -1
- package/dist/chunk-65B52AR7.js +0 -11
- package/dist/chunk-65B52AR7.js.map +0 -1
- package/dist/chunk-6HYKKP5N.js +0 -2658
- package/dist/chunk-6HYKKP5N.js.map +0 -1
- package/dist/chunk-6SOP4XU6.js +0 -1891
- package/dist/chunk-6SOP4XU6.js.map +0 -1
- package/dist/chunk-AFXE462X.js +0 -1253
- package/dist/chunk-AFXE462X.js.map +0 -1
- package/dist/chunk-BQPKOVI5.js +0 -115
- package/dist/chunk-BQPKOVI5.js.map +0 -1
- package/dist/chunk-CYDF4LYJ.js +0 -342
- package/dist/chunk-CYDF4LYJ.js.map +0 -1
- package/dist/chunk-CYQE3TLC.js +0 -37
- package/dist/chunk-CYQE3TLC.js.map +0 -1
- package/dist/chunk-DI2ZFAWL.js +0 -14
- package/dist/chunk-DI2ZFAWL.js.map +0 -1
- package/dist/chunk-EGRHWZRV.js +0 -1
- package/dist/chunk-EGRHWZRV.js.map +0 -1
- package/dist/chunk-FGWGY3G3.js +0 -157
- package/dist/chunk-FGWGY3G3.js.map +0 -1
- package/dist/chunk-HOBTDB6G.js +0 -112
- package/dist/chunk-HOBTDB6G.js.map +0 -1
- package/dist/chunk-I7VF4ZOV.js +0 -630
- package/dist/chunk-I7VF4ZOV.js.map +0 -1
- package/dist/chunk-JVVHU3A7.js +0 -1077
- package/dist/chunk-JVVHU3A7.js.map +0 -1
- package/dist/chunk-MIXQVPDH.js +0 -8606
- package/dist/chunk-MIXQVPDH.js.map +0 -1
- package/dist/chunk-MU7S7NU7.js +0 -183
- package/dist/chunk-MU7S7NU7.js.map +0 -1
- package/dist/chunk-OX2YKYSL.js +0 -13
- package/dist/chunk-OX2YKYSL.js.map +0 -1
- package/dist/chunk-PYAJHLXO.js +0 -903
- package/dist/chunk-PYAJHLXO.js.map +0 -1
- package/dist/chunk-SGN7BDRE.js +0 -16
- package/dist/chunk-SGN7BDRE.js.map +0 -1
- package/dist/chunk-SGTGDLOX.js +0 -285
- package/dist/chunk-SGTGDLOX.js.map +0 -1
- package/dist/chunk-T364NBR3.js +0 -1440
- package/dist/chunk-T364NBR3.js.map +0 -1
- package/dist/chunk-U66QI3EN.js +0 -1524
- package/dist/chunk-U66QI3EN.js.map +0 -1
- package/dist/chunk-WTXOWQ7N.js +0 -47
- package/dist/chunk-WTXOWQ7N.js.map +0 -1
- package/dist/chunk-X5DJKVBT.js +0 -1308
- package/dist/chunk-X5DJKVBT.js.map +0 -1
- package/dist/chunk-ZT7HJ6YU.js +0 -38
- package/dist/chunk-ZT7HJ6YU.js.map +0 -1
- package/dist/chunk-ZW26VZHX.js +0 -3169
- package/dist/chunk-ZW26VZHX.js.map +0 -1
- package/dist/controls-reader-5MFHYBZZ.js +0 -192
- package/dist/controls-reader-5MFHYBZZ.js.map +0 -1
- package/dist/expo/plugin.cjs.map +0 -1
- package/dist/expo/plugin.js.map +0 -1
- package/dist/expo-babel-plugin.cjs.map +0 -1
- package/dist/expo-babel-plugin.js.map +0 -1
- package/dist/flutter-preview-path.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/nextjs/plugin.cjs.map +0 -1
- package/dist/nextjs/plugin.js.map +0 -1
- package/dist/nextjs-loader.cjs.map +0 -1
- package/dist/nextjs.cjs.map +0 -1
- package/dist/nextjs.js.map +0 -1
- package/dist/nuxt/runtime/identity.js.map +0 -1
- package/dist/nuxt.js.map +0 -1
- package/dist/svelte.js.map +0 -1
- package/dist/types-C8OIU-kc.d.ts +0 -106
- package/dist/v1-client-compat-qxaXEDm_.d.ts +0 -23
- package/dist/vue.js.map +0 -1
package/dist/chunk-X5DJKVBT.js
DELETED
|
@@ -1,1308 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PROJECTION_PENDING_ATTRIBUTE,
|
|
3
|
-
PROJECTION_ROOT_ATTRIBUTE,
|
|
4
|
-
PROJECTION_SCOPE_ROLE,
|
|
5
|
-
PROJECTION_UNAVAILABLE_ATTRIBUTE,
|
|
6
|
-
canvasClientProtocol,
|
|
7
|
-
isPreV3CanvasClient,
|
|
8
|
-
v2StoryboardSlotPosition
|
|
9
|
-
} from "./chunk-ZW26VZHX.js";
|
|
10
|
-
|
|
11
|
-
// canvas/ids.ts
|
|
12
|
-
function normalizeId(value, label) {
|
|
13
|
-
const normalized = value?.trim();
|
|
14
|
-
if (!normalized) {
|
|
15
|
-
throw new Error(`${label} is required.`);
|
|
16
|
-
}
|
|
17
|
-
return normalized;
|
|
18
|
-
}
|
|
19
|
-
function getStoryboardKey(id) {
|
|
20
|
-
return `storyboard:${id}`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// canvas/canvas.tsx
|
|
24
|
-
import {
|
|
25
|
-
Children,
|
|
26
|
-
cloneElement,
|
|
27
|
-
createContext,
|
|
28
|
-
isValidElement,
|
|
29
|
-
useContext,
|
|
30
|
-
useMemo
|
|
31
|
-
} from "react";
|
|
32
|
-
import { jsx } from "react/jsx-runtime";
|
|
33
|
-
var CanvasIdentityContext = createContext(null);
|
|
34
|
-
function getCanvasStoryboardRenderId(canvasPath, storyboardId) {
|
|
35
|
-
return `canvas:${encodeURIComponent(
|
|
36
|
-
normalizeId(canvasPath, "Canvas path")
|
|
37
|
-
)}#storyboard:${encodeURIComponent(
|
|
38
|
-
normalizeId(storyboardId, "Storyboard id")
|
|
39
|
-
)}`;
|
|
40
|
-
}
|
|
41
|
-
function useCanvasIdentity() {
|
|
42
|
-
return useContext(CanvasIdentityContext);
|
|
43
|
-
}
|
|
44
|
-
function useCanvasStoryboardRenderId(storyboardId) {
|
|
45
|
-
const canvas = useCanvasIdentity();
|
|
46
|
-
const normalizedId = normalizeId(storyboardId, "Storyboard id");
|
|
47
|
-
return canvas ? getCanvasStoryboardRenderId(canvas.path, normalizedId) : normalizedId;
|
|
48
|
-
}
|
|
49
|
-
function Canvas({
|
|
50
|
-
children,
|
|
51
|
-
name,
|
|
52
|
-
path,
|
|
53
|
-
backgroundColor,
|
|
54
|
-
defaultViewport,
|
|
55
|
-
...sourceAnnotations
|
|
56
|
-
}) {
|
|
57
|
-
const contextIdentity = useCanvasIdentity();
|
|
58
|
-
const canvasName = name?.trim() || void 0;
|
|
59
|
-
const canvasPath = path === void 0 ? contextIdentity?.path : normalizeId(path, "Canvas path");
|
|
60
|
-
if (!canvasPath) {
|
|
61
|
-
throw new Error(
|
|
62
|
-
'<Canvas> must be rendered inside <CanvasContext path="..."> or receive a path prop.'
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
const identity = useMemo(() => ({ path: canvasPath }), [canvasPath]);
|
|
66
|
-
const declaration = {
|
|
67
|
-
path: canvasPath,
|
|
68
|
-
...canvasName ? { name: canvasName } : {},
|
|
69
|
-
backgroundColor,
|
|
70
|
-
defaultViewport
|
|
71
|
-
};
|
|
72
|
-
const keyedChildren = useMemo(() => {
|
|
73
|
-
const automatic = /* @__PURE__ */ new Set();
|
|
74
|
-
const flattened = Children.map(children, (child) => {
|
|
75
|
-
if (isValidElement(child) && child.key == null) {
|
|
76
|
-
const id = child.props.id;
|
|
77
|
-
if (typeof id === "string" && id.length) automatic.add(id);
|
|
78
|
-
}
|
|
79
|
-
return child;
|
|
80
|
-
});
|
|
81
|
-
return flattened?.map((child) => {
|
|
82
|
-
if (!isValidElement(child)) return child;
|
|
83
|
-
const id = child.props.id;
|
|
84
|
-
return typeof id === "string" && automatic.has(id) ? cloneElement(child, { key: getStoryboardKey(id) }) : child;
|
|
85
|
-
});
|
|
86
|
-
}, [children]);
|
|
87
|
-
return /* @__PURE__ */ jsx(CanvasIdentityContext.Provider, { value: identity, children: /* @__PURE__ */ jsx(
|
|
88
|
-
"div",
|
|
89
|
-
{
|
|
90
|
-
...sourceAnnotations,
|
|
91
|
-
"data-tempo-canvas": canvasName,
|
|
92
|
-
"data-tempo-canvas-path": canvasPath,
|
|
93
|
-
"data-tempo-canvas-declaration": JSON.stringify(declaration),
|
|
94
|
-
children: keyedChildren
|
|
95
|
-
}
|
|
96
|
-
) });
|
|
97
|
-
}
|
|
98
|
-
function CanvasContext({
|
|
99
|
-
children,
|
|
100
|
-
path
|
|
101
|
-
}) {
|
|
102
|
-
const canvasPath = normalizeId(path, "Canvas path");
|
|
103
|
-
const identity = useMemo(() => ({ path: canvasPath }), [canvasPath]);
|
|
104
|
-
return /* @__PURE__ */ jsx(CanvasIdentityContext.Provider, { value: identity, children });
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// canvas/runtime-context.ts
|
|
108
|
-
import { createContext as createContext2, useCallback, useContext as useContext2 } from "react";
|
|
109
|
-
var CanvasHostContext = createContext2(null);
|
|
110
|
-
function useRequiredCanvasHost() {
|
|
111
|
-
const host = useContext2(CanvasHostContext);
|
|
112
|
-
if (!host) {
|
|
113
|
-
throw new Error(
|
|
114
|
-
"Tempo canvas components must be rendered inside <CanvasHost>."
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
return host;
|
|
118
|
-
}
|
|
119
|
-
function useActiveState(storyboardId) {
|
|
120
|
-
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
121
|
-
const host = useRequiredCanvasHost();
|
|
122
|
-
return host.getStoryboardStatus(renderId) !== "unmounted";
|
|
123
|
-
}
|
|
124
|
-
function useStoryboardStatus(storyboardId) {
|
|
125
|
-
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
126
|
-
const host = useRequiredCanvasHost();
|
|
127
|
-
return host.getStoryboardStatus(renderId);
|
|
128
|
-
}
|
|
129
|
-
function useStoryboardRendered(storyboardId) {
|
|
130
|
-
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
131
|
-
const host = useRequiredCanvasHost();
|
|
132
|
-
return useCallback(() => {
|
|
133
|
-
host.markStoryboardRendered(renderId);
|
|
134
|
-
}, [host, renderId]);
|
|
135
|
-
}
|
|
136
|
-
function useStoryboardUnmounted(storyboardId) {
|
|
137
|
-
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
138
|
-
const { markStoryboardUnmounted } = useRequiredCanvasHost();
|
|
139
|
-
return useCallback(() => {
|
|
140
|
-
markStoryboardUnmounted(renderId);
|
|
141
|
-
}, [markStoryboardUnmounted, renderId]);
|
|
142
|
-
}
|
|
143
|
-
function useStoryboardErrorReporter(storyboardId) {
|
|
144
|
-
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
145
|
-
const host = useRequiredCanvasHost();
|
|
146
|
-
const reportError = useCallback(
|
|
147
|
-
(error) => {
|
|
148
|
-
host.reportStoryboardError(renderId, error);
|
|
149
|
-
},
|
|
150
|
-
[host, renderId]
|
|
151
|
-
);
|
|
152
|
-
const clearError = useCallback(() => {
|
|
153
|
-
host.clearStoryboardError(renderId);
|
|
154
|
-
}, [host, renderId]);
|
|
155
|
-
return { reportError, clearError };
|
|
156
|
-
}
|
|
157
|
-
function useStoryboardSize(storyboardId) {
|
|
158
|
-
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
159
|
-
const host = useRequiredCanvasHost();
|
|
160
|
-
return host.getStoryboardSize(renderId);
|
|
161
|
-
}
|
|
162
|
-
function useStoryboardPlacement(storyboardId) {
|
|
163
|
-
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
164
|
-
const host = useRequiredCanvasHost();
|
|
165
|
-
return host.getStoryboardPlacement(renderId);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// canvas/storyboard.tsx
|
|
169
|
-
import {
|
|
170
|
-
Children as Children2,
|
|
171
|
-
Component,
|
|
172
|
-
cloneElement as cloneElement2,
|
|
173
|
-
isValidElement as isValidElement2,
|
|
174
|
-
Suspense,
|
|
175
|
-
useCallback as useCallback3,
|
|
176
|
-
useEffect as useEffect2,
|
|
177
|
-
useLayoutEffect,
|
|
178
|
-
useMemo as useMemo2,
|
|
179
|
-
useRef as useRef2,
|
|
180
|
-
useState
|
|
181
|
-
} from "react";
|
|
182
|
-
|
|
183
|
-
// canvas/admission-budget.ts
|
|
184
|
-
import * as React from "react";
|
|
185
|
-
var admissionRenderStepBudget = 1e5;
|
|
186
|
-
var AdmissionBudgetError = class extends Error {
|
|
187
|
-
constructor() {
|
|
188
|
-
super(
|
|
189
|
-
"This storyboard renders itself recursively: it kept creating components without ever finishing a render. Check for a component that returns itself, or two components that render each other."
|
|
190
|
-
);
|
|
191
|
-
this.name = "AdmissionBudgetError";
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
function findDispatcherSlot() {
|
|
195
|
-
const react = React;
|
|
196
|
-
const modern = react.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
197
|
-
if (modern && "H" in modern) return { holder: modern, key: "H" };
|
|
198
|
-
const legacy = react.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentDispatcher;
|
|
199
|
-
if (legacy && "current" in legacy) return { holder: legacy, key: "current" };
|
|
200
|
-
return null;
|
|
201
|
-
}
|
|
202
|
-
var stepsRemaining = admissionRenderStepBudget;
|
|
203
|
-
var rearmScheduled = false;
|
|
204
|
-
var counterState = "uninstalled";
|
|
205
|
-
function scheduleRearm() {
|
|
206
|
-
if (rearmScheduled) return;
|
|
207
|
-
rearmScheduled = true;
|
|
208
|
-
queueMicrotask(() => {
|
|
209
|
-
rearmScheduled = false;
|
|
210
|
-
stepsRemaining = admissionRenderStepBudget;
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
function installCounter() {
|
|
214
|
-
if (counterState !== "uninstalled") return counterState === "installed";
|
|
215
|
-
const slot = findDispatcherSlot();
|
|
216
|
-
if (!slot) {
|
|
217
|
-
counterState = "unavailable";
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
const { holder, key } = slot;
|
|
221
|
-
let dispatcher = holder[key];
|
|
222
|
-
Object.defineProperty(holder, key, {
|
|
223
|
-
configurable: true,
|
|
224
|
-
get: () => dispatcher,
|
|
225
|
-
set: (value) => {
|
|
226
|
-
dispatcher = value;
|
|
227
|
-
scheduleRearm();
|
|
228
|
-
stepsRemaining -= 1;
|
|
229
|
-
if (stepsRemaining > 0) return;
|
|
230
|
-
stepsRemaining = admissionRenderStepBudget;
|
|
231
|
-
throw new AdmissionBudgetError();
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
counterState = "installed";
|
|
235
|
-
return true;
|
|
236
|
-
}
|
|
237
|
-
function beginAdmissionWindow() {
|
|
238
|
-
if (!installCounter()) return;
|
|
239
|
-
stepsRemaining = admissionRenderStepBudget;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// canvas/canvas-pending-marker.tsx
|
|
243
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
244
|
-
function CanvasPendingMarker() {
|
|
245
|
-
return /* @__PURE__ */ jsx2(
|
|
246
|
-
"div",
|
|
247
|
-
{
|
|
248
|
-
...{ [PROJECTION_PENDING_ATTRIBUTE]: "" },
|
|
249
|
-
"data-tempo-hide-fiber": "true",
|
|
250
|
-
style: { display: "none" },
|
|
251
|
-
"aria-hidden": "true"
|
|
252
|
-
}
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
Object.assign(CanvasPendingMarker, { [PROJECTION_SCOPE_ROLE]: "transparent" });
|
|
256
|
-
function CanvasUnavailableMarker() {
|
|
257
|
-
return /* @__PURE__ */ jsx2(
|
|
258
|
-
"div",
|
|
259
|
-
{
|
|
260
|
-
...{ [PROJECTION_UNAVAILABLE_ATTRIBUTE]: "" },
|
|
261
|
-
"data-tempo-hide-fiber": "true",
|
|
262
|
-
style: { display: "none" },
|
|
263
|
-
"aria-hidden": "true"
|
|
264
|
-
}
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
Object.assign(CanvasUnavailableMarker, {
|
|
268
|
-
[PROJECTION_SCOPE_ROLE]: "transparent"
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
// canvas/portal-tracking.ts
|
|
272
|
-
var PORTAL_MANAGED_PROPERTIES = [
|
|
273
|
-
{ key: "visibility", cssName: "visibility", hiddenValue: "hidden" },
|
|
274
|
-
{ key: "pointerEvents", cssName: "pointer-events", hiddenValue: "none" },
|
|
275
|
-
{
|
|
276
|
-
key: "contentVisibility",
|
|
277
|
-
cssName: "content-visibility",
|
|
278
|
-
hiddenValue: "hidden"
|
|
279
|
-
},
|
|
280
|
-
{ key: "transition", cssName: "transition", hiddenValue: "none" },
|
|
281
|
-
{ key: "animation", cssName: "animation", hiddenValue: "none" }
|
|
282
|
-
];
|
|
283
|
-
var portalElementsByRenderId = /* @__PURE__ */ new Map();
|
|
284
|
-
var portalOwnerRenderIdsByElement = /* @__PURE__ */ new Map();
|
|
285
|
-
var portalInlineStyleByElement = /* @__PURE__ */ new Map();
|
|
286
|
-
var renderStatusById = /* @__PURE__ */ new Map();
|
|
287
|
-
var projectionPortalIdAttribute = "data-projection-portal-id";
|
|
288
|
-
var nextSdkPortalId = 1;
|
|
289
|
-
function escapeAttributeValue(value) {
|
|
290
|
-
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
291
|
-
}
|
|
292
|
-
function ensureProjectionPortalId(portalRoot) {
|
|
293
|
-
const existingId = portalRoot.getAttribute(projectionPortalIdAttribute);
|
|
294
|
-
if (existingId) return existingId;
|
|
295
|
-
const id = `tempo-sdk-portal-${nextSdkPortalId++}`;
|
|
296
|
-
portalRoot.setAttribute(projectionPortalIdAttribute, id);
|
|
297
|
-
return id;
|
|
298
|
-
}
|
|
299
|
-
function buildProjectionPortalSelector(portalRoot) {
|
|
300
|
-
return `[${projectionPortalIdAttribute}="${escapeAttributeValue(
|
|
301
|
-
ensureProjectionPortalId(portalRoot)
|
|
302
|
-
)}"]`;
|
|
303
|
-
}
|
|
304
|
-
function findFiberKey(element) {
|
|
305
|
-
return Object.keys(element).find(
|
|
306
|
-
(key) => key.startsWith("__reactFiber$") || key.startsWith("__reactInternalInstance$")
|
|
307
|
-
) ?? null;
|
|
308
|
-
}
|
|
309
|
-
function findContainerKey(element) {
|
|
310
|
-
return Object.keys(element).find((key) => key.startsWith("__reactContainer$")) ?? null;
|
|
311
|
-
}
|
|
312
|
-
function getFiberFromElement(element) {
|
|
313
|
-
const fiberKey = findFiberKey(element);
|
|
314
|
-
if (fiberKey) {
|
|
315
|
-
return element[fiberKey] ?? null;
|
|
316
|
-
}
|
|
317
|
-
const containerKey = findContainerKey(element);
|
|
318
|
-
if (containerKey) {
|
|
319
|
-
return element[containerKey] ?? null;
|
|
320
|
-
}
|
|
321
|
-
return null;
|
|
322
|
-
}
|
|
323
|
-
var PortalTracker = class {
|
|
324
|
-
constructor() {
|
|
325
|
-
this.watchers = /* @__PURE__ */ new Set();
|
|
326
|
-
this.ownerWatchersByPortalRoot = /* @__PURE__ */ new Map();
|
|
327
|
-
this.observer = null;
|
|
328
|
-
this.handleMutations = (mutations) => {
|
|
329
|
-
for (const mutation of mutations) {
|
|
330
|
-
for (const node of mutation.addedNodes) {
|
|
331
|
-
if (node instanceof Element) {
|
|
332
|
-
queueMicrotask(() => this.checkElement(node));
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
for (const node of mutation.removedNodes) {
|
|
336
|
-
if (!(node instanceof Element)) continue;
|
|
337
|
-
const owners = this.ownerWatchersByPortalRoot.get(node);
|
|
338
|
-
if (!owners) continue;
|
|
339
|
-
for (const owner of owners) {
|
|
340
|
-
owner.onPortalRemoved(node);
|
|
341
|
-
}
|
|
342
|
-
this.ownerWatchersByPortalRoot.delete(node);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
register(watcher) {
|
|
348
|
-
this.watchers.add(watcher);
|
|
349
|
-
if (this.watchers.size === 1) {
|
|
350
|
-
this.startObserving();
|
|
351
|
-
}
|
|
352
|
-
if (typeof document !== "undefined" && document.body) {
|
|
353
|
-
this.checkExistingElements();
|
|
354
|
-
queueMicrotask(() => this.checkExistingElements());
|
|
355
|
-
}
|
|
356
|
-
return () => this.unregister(watcher);
|
|
357
|
-
}
|
|
358
|
-
checkExistingElements() {
|
|
359
|
-
if (typeof document === "undefined" || !document.body) return;
|
|
360
|
-
for (const child of Array.from(document.body.children)) {
|
|
361
|
-
this.checkElement(child);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
unregister(watcher) {
|
|
365
|
-
this.watchers.delete(watcher);
|
|
366
|
-
for (const [portalRoot, owners] of this.ownerWatchersByPortalRoot) {
|
|
367
|
-
owners.delete(watcher);
|
|
368
|
-
if (owners.size === 0) {
|
|
369
|
-
this.ownerWatchersByPortalRoot.delete(portalRoot);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
if (this.watchers.size === 0) {
|
|
373
|
-
this.stopObserving();
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
startObserving() {
|
|
377
|
-
if (this.observer || typeof document === "undefined" || !document.body || typeof MutationObserver === "undefined") {
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
this.observer = new MutationObserver(this.handleMutations);
|
|
381
|
-
this.observer.observe(document.body, { childList: true });
|
|
382
|
-
}
|
|
383
|
-
stopObserving() {
|
|
384
|
-
this.observer?.disconnect();
|
|
385
|
-
this.observer = null;
|
|
386
|
-
}
|
|
387
|
-
checkElement(element) {
|
|
388
|
-
const ancestorDomNodes = this.getDomAncestorsViaFiber(element);
|
|
389
|
-
if (ancestorDomNodes.length === 0) return;
|
|
390
|
-
let owners = this.ownerWatchersByPortalRoot.get(element);
|
|
391
|
-
for (const watcher of this.watchers) {
|
|
392
|
-
const belongsToWatcher = ancestorDomNodes.some(
|
|
393
|
-
(node) => watcher.element.contains(node) || watcher.element === node
|
|
394
|
-
);
|
|
395
|
-
if (!belongsToWatcher) continue;
|
|
396
|
-
if (!owners) {
|
|
397
|
-
owners = /* @__PURE__ */ new Set();
|
|
398
|
-
this.ownerWatchersByPortalRoot.set(element, owners);
|
|
399
|
-
}
|
|
400
|
-
if (owners.has(watcher)) continue;
|
|
401
|
-
owners.add(watcher);
|
|
402
|
-
watcher.onPortalFound(element);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
getDomAncestorsViaFiber(element) {
|
|
406
|
-
const fiber = getFiberFromElement(element);
|
|
407
|
-
if (!fiber) return [];
|
|
408
|
-
const domNodes = [];
|
|
409
|
-
let current = fiber.return;
|
|
410
|
-
while (current) {
|
|
411
|
-
if (current.stateNode instanceof Element) {
|
|
412
|
-
domNodes.push(current.stateNode);
|
|
413
|
-
}
|
|
414
|
-
current = current.return;
|
|
415
|
-
}
|
|
416
|
-
return domNodes;
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
var portalTracker = null;
|
|
420
|
-
function getPortalTracker() {
|
|
421
|
-
if (!portalTracker) {
|
|
422
|
-
portalTracker = new PortalTracker();
|
|
423
|
-
}
|
|
424
|
-
return portalTracker;
|
|
425
|
-
}
|
|
426
|
-
function getStylablePortalElement(portalRoot) {
|
|
427
|
-
if (portalRoot instanceof HTMLElement || portalRoot instanceof SVGElement) {
|
|
428
|
-
return portalRoot;
|
|
429
|
-
}
|
|
430
|
-
return null;
|
|
431
|
-
}
|
|
432
|
-
function ensurePortalInlineStyle(portalRoot) {
|
|
433
|
-
const existing = portalInlineStyleByElement.get(portalRoot);
|
|
434
|
-
if (existing) return existing;
|
|
435
|
-
const stylableElement = getStylablePortalElement(portalRoot);
|
|
436
|
-
const baseline = {
|
|
437
|
-
visibility: readInlineStyleValue(stylableElement, "visibility"),
|
|
438
|
-
pointerEvents: readInlineStyleValue(stylableElement, "pointer-events"),
|
|
439
|
-
contentVisibility: readInlineStyleValue(
|
|
440
|
-
stylableElement,
|
|
441
|
-
"content-visibility"
|
|
442
|
-
),
|
|
443
|
-
transition: readInlineStyleValue(stylableElement, "transition"),
|
|
444
|
-
animation: readInlineStyleValue(stylableElement, "animation")
|
|
445
|
-
};
|
|
446
|
-
portalInlineStyleByElement.set(portalRoot, baseline);
|
|
447
|
-
return baseline;
|
|
448
|
-
}
|
|
449
|
-
function readInlineStyleValue(element, propertyName) {
|
|
450
|
-
return {
|
|
451
|
-
value: element?.style.getPropertyValue(propertyName) ?? "",
|
|
452
|
-
priority: element?.style.getPropertyPriority(propertyName) ?? ""
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
function restoreInlineStyleValue(style, propertyName, baseline) {
|
|
456
|
-
if (baseline.value) {
|
|
457
|
-
style.setProperty(propertyName, baseline.value, baseline.priority);
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
style.removeProperty(propertyName);
|
|
461
|
-
}
|
|
462
|
-
function restorePortalInlineStyle(portalRoot) {
|
|
463
|
-
const stylableElement = getStylablePortalElement(portalRoot);
|
|
464
|
-
const baseline = portalInlineStyleByElement.get(portalRoot);
|
|
465
|
-
if (!stylableElement || !baseline) return;
|
|
466
|
-
for (const property of PORTAL_MANAGED_PROPERTIES) {
|
|
467
|
-
restoreInlineStyleValue(
|
|
468
|
-
stylableElement.style,
|
|
469
|
-
property.cssName,
|
|
470
|
-
baseline[property.key]
|
|
471
|
-
);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
function syncPortalVisibility(portalRoot) {
|
|
475
|
-
const owners = portalOwnerRenderIdsByElement.get(portalRoot);
|
|
476
|
-
if (!owners || owners.size === 0) {
|
|
477
|
-
restorePortalInlineStyle(portalRoot);
|
|
478
|
-
portalInlineStyleByElement.delete(portalRoot);
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
const stylableElement = getStylablePortalElement(portalRoot);
|
|
482
|
-
if (!stylableElement) return;
|
|
483
|
-
const shouldBeVisible = [...owners].some(
|
|
484
|
-
(renderId) => renderStatusById.get(renderId) === "active"
|
|
485
|
-
);
|
|
486
|
-
if (shouldBeVisible) {
|
|
487
|
-
restorePortalInlineStyle(portalRoot);
|
|
488
|
-
portalInlineStyleByElement.delete(portalRoot);
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
|
-
ensurePortalInlineStyle(portalRoot);
|
|
492
|
-
for (const property of PORTAL_MANAGED_PROPERTIES) {
|
|
493
|
-
stylableElement.style.setProperty(
|
|
494
|
-
property.cssName,
|
|
495
|
-
property.hiddenValue,
|
|
496
|
-
"important"
|
|
497
|
-
);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
function trackPortal(renderId, portalRoot) {
|
|
501
|
-
ensureProjectionPortalId(portalRoot);
|
|
502
|
-
const portals = portalElementsByRenderId.get(renderId) ?? /* @__PURE__ */ new Set();
|
|
503
|
-
portals.add(portalRoot);
|
|
504
|
-
portalElementsByRenderId.set(renderId, portals);
|
|
505
|
-
const owners = portalOwnerRenderIdsByElement.get(portalRoot) ?? /* @__PURE__ */ new Set();
|
|
506
|
-
owners.add(renderId);
|
|
507
|
-
portalOwnerRenderIdsByElement.set(portalRoot, owners);
|
|
508
|
-
syncPortalVisibility(portalRoot);
|
|
509
|
-
}
|
|
510
|
-
function untrackPortal(renderId, portalRoot) {
|
|
511
|
-
const portals = portalElementsByRenderId.get(renderId);
|
|
512
|
-
if (!portals) return;
|
|
513
|
-
portals.delete(portalRoot);
|
|
514
|
-
if (portals.size === 0) {
|
|
515
|
-
portalElementsByRenderId.delete(renderId);
|
|
516
|
-
}
|
|
517
|
-
const owners = portalOwnerRenderIdsByElement.get(portalRoot);
|
|
518
|
-
if (owners) {
|
|
519
|
-
owners.delete(renderId);
|
|
520
|
-
if (owners.size === 0) {
|
|
521
|
-
portalOwnerRenderIdsByElement.delete(portalRoot);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
syncPortalVisibility(portalRoot);
|
|
525
|
-
}
|
|
526
|
-
function releaseStoryboardPortals(renderId) {
|
|
527
|
-
const portals = portalElementsByRenderId.get(renderId);
|
|
528
|
-
if (!portals) {
|
|
529
|
-
renderStatusById.delete(renderId);
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
for (const portalRoot of [...portals]) {
|
|
533
|
-
untrackPortal(renderId, portalRoot);
|
|
534
|
-
}
|
|
535
|
-
renderStatusById.delete(renderId);
|
|
536
|
-
}
|
|
537
|
-
function getStoryboardPortalSelectors(renderId) {
|
|
538
|
-
const portals = portalElementsByRenderId.get(renderId);
|
|
539
|
-
if (!portals) return [];
|
|
540
|
-
return [...portals].filter((portalRoot) => portalRoot.isConnected).map(buildProjectionPortalSelector);
|
|
541
|
-
}
|
|
542
|
-
function syncStoryboardPortals(renderId, status) {
|
|
543
|
-
renderStatusById.set(renderId, status);
|
|
544
|
-
const portals = portalElementsByRenderId.get(renderId);
|
|
545
|
-
if (!portals) return;
|
|
546
|
-
for (const portalRoot of portals) {
|
|
547
|
-
syncPortalVisibility(portalRoot);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
function trackStoryboardPortals(renderId, element, status) {
|
|
551
|
-
syncStoryboardPortals(renderId, status);
|
|
552
|
-
const unregister = getPortalTracker().register({
|
|
553
|
-
element,
|
|
554
|
-
onPortalFound(portalRoot) {
|
|
555
|
-
trackPortal(renderId, portalRoot);
|
|
556
|
-
},
|
|
557
|
-
onPortalRemoved(portalRoot) {
|
|
558
|
-
untrackPortal(renderId, portalRoot);
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
return () => {
|
|
562
|
-
unregister();
|
|
563
|
-
releaseStoryboardPortals(renderId);
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
// canvas/render-error-recovery.ts
|
|
568
|
-
import { useCallback as useCallback2, useEffect, useRef } from "react";
|
|
569
|
-
var renderErrorRetryBaseDelayMs = 1e3;
|
|
570
|
-
var renderErrorRetryMaxDelayMs = 8e3;
|
|
571
|
-
var BEAT_BUS_KEY = "__tempoRenderErrorRecoveryBeatBus";
|
|
572
|
-
function createBeatBus() {
|
|
573
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
574
|
-
return {
|
|
575
|
-
emit() {
|
|
576
|
-
for (const listener of [...listeners]) listener();
|
|
577
|
-
},
|
|
578
|
-
subscribe(listener) {
|
|
579
|
-
listeners.add(listener);
|
|
580
|
-
return () => listeners.delete(listener);
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
function getRenderErrorRecoveryBeatBus() {
|
|
585
|
-
const globals = globalThis;
|
|
586
|
-
return globals[BEAT_BUS_KEY] ?? (globals[BEAT_BUS_KEY] = createBeatBus());
|
|
587
|
-
}
|
|
588
|
-
function emitRenderErrorRecoveryBeat() {
|
|
589
|
-
getRenderErrorRecoveryBeatBus().emit();
|
|
590
|
-
}
|
|
591
|
-
function useRenderErrorRecovery(retryNow) {
|
|
592
|
-
const retryNowRef = useRef(retryNow);
|
|
593
|
-
retryNowRef.current = retryNow;
|
|
594
|
-
const timerRef = useRef(null);
|
|
595
|
-
const nextDelayRef = useRef(renderErrorRetryBaseDelayMs);
|
|
596
|
-
const erroredRef = useRef(false);
|
|
597
|
-
const clearTimer = useCallback2(() => {
|
|
598
|
-
if (timerRef.current === null) return;
|
|
599
|
-
clearTimeout(timerRef.current);
|
|
600
|
-
timerRef.current = null;
|
|
601
|
-
}, []);
|
|
602
|
-
const noteRenderError = useCallback2(() => {
|
|
603
|
-
erroredRef.current = true;
|
|
604
|
-
if (timerRef.current !== null) return;
|
|
605
|
-
const delay = nextDelayRef.current;
|
|
606
|
-
nextDelayRef.current = Math.min(delay * 2, renderErrorRetryMaxDelayMs);
|
|
607
|
-
timerRef.current = setTimeout(() => {
|
|
608
|
-
timerRef.current = null;
|
|
609
|
-
retryNowRef.current();
|
|
610
|
-
}, delay);
|
|
611
|
-
}, []);
|
|
612
|
-
const noteRecovered = useCallback2(() => {
|
|
613
|
-
erroredRef.current = false;
|
|
614
|
-
nextDelayRef.current = renderErrorRetryBaseDelayMs;
|
|
615
|
-
clearTimer();
|
|
616
|
-
}, [clearTimer]);
|
|
617
|
-
useEffect(() => {
|
|
618
|
-
const onBeat = () => {
|
|
619
|
-
nextDelayRef.current = renderErrorRetryBaseDelayMs;
|
|
620
|
-
if (!erroredRef.current) return;
|
|
621
|
-
clearTimer();
|
|
622
|
-
retryNowRef.current();
|
|
623
|
-
};
|
|
624
|
-
const unsubscribe = getRenderErrorRecoveryBeatBus().subscribe(onBeat);
|
|
625
|
-
return () => {
|
|
626
|
-
unsubscribe();
|
|
627
|
-
clearTimer();
|
|
628
|
-
};
|
|
629
|
-
}, [clearTimer]);
|
|
630
|
-
return { noteRenderError, noteRecovered };
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
// canvas/responsive-slot-size.ts
|
|
634
|
-
function observeResponsiveSlotSize(content) {
|
|
635
|
-
const slot = content.parentElement;
|
|
636
|
-
const view = content.ownerDocument.defaultView;
|
|
637
|
-
if (!slot || !view) return () => {
|
|
638
|
-
};
|
|
639
|
-
const previousWidth = slot.style.minWidth;
|
|
640
|
-
const previousHeight = slot.style.minHeight;
|
|
641
|
-
const previousContentHeight = content.style.minHeight;
|
|
642
|
-
content.style.minHeight = "inherit";
|
|
643
|
-
const roots = /* @__PURE__ */ new Set();
|
|
644
|
-
let disposed = false;
|
|
645
|
-
let scheduledFrame = null;
|
|
646
|
-
const measure = () => {
|
|
647
|
-
if (disposed) return;
|
|
648
|
-
for (const root of roots) {
|
|
649
|
-
if (root.parentElement !== content) {
|
|
650
|
-
resize.unobserve(root);
|
|
651
|
-
roots.delete(root);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
for (const root of content.children) {
|
|
655
|
-
if (!roots.has(root)) {
|
|
656
|
-
roots.add(root);
|
|
657
|
-
resize.observe(root, { box: "border-box" });
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
slot.style.minWidth = previousWidth;
|
|
661
|
-
slot.style.minHeight = previousHeight;
|
|
662
|
-
const natural = slot.getBoundingClientRect();
|
|
663
|
-
let width = natural.width;
|
|
664
|
-
let height = natural.height;
|
|
665
|
-
for (const root of roots) {
|
|
666
|
-
if (view.getComputedStyle(root).position !== "absolute") continue;
|
|
667
|
-
const rect = root.getBoundingClientRect();
|
|
668
|
-
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
669
|
-
width = Math.max(width, rect.right - natural.left);
|
|
670
|
-
height = Math.max(height, rect.bottom - natural.top);
|
|
671
|
-
}
|
|
672
|
-
if (width > natural.width) slot.style.minWidth = `${Math.ceil(width)}px`;
|
|
673
|
-
if (height > natural.height)
|
|
674
|
-
slot.style.minHeight = `${Math.ceil(height)}px`;
|
|
675
|
-
};
|
|
676
|
-
const scheduleMeasure = () => {
|
|
677
|
-
if (disposed || scheduledFrame !== null) return;
|
|
678
|
-
scheduledFrame = view.requestAnimationFrame(() => {
|
|
679
|
-
scheduledFrame = null;
|
|
680
|
-
measure();
|
|
681
|
-
});
|
|
682
|
-
};
|
|
683
|
-
const resize = new view.ResizeObserver(scheduleMeasure);
|
|
684
|
-
const mutations = new view.MutationObserver((records) => {
|
|
685
|
-
if (records.some(
|
|
686
|
-
(record) => record.type === "childList" ? record.target === content : record.target.parentElement === content
|
|
687
|
-
))
|
|
688
|
-
scheduleMeasure();
|
|
689
|
-
});
|
|
690
|
-
resize.observe(slot, { box: "border-box" });
|
|
691
|
-
mutations.observe(content, {
|
|
692
|
-
childList: true,
|
|
693
|
-
subtree: true,
|
|
694
|
-
attributes: true
|
|
695
|
-
});
|
|
696
|
-
measure();
|
|
697
|
-
return () => {
|
|
698
|
-
disposed = true;
|
|
699
|
-
if (scheduledFrame !== null) view.cancelAnimationFrame(scheduledFrame);
|
|
700
|
-
resize.disconnect();
|
|
701
|
-
mutations.disconnect();
|
|
702
|
-
content.style.minHeight = previousContentHeight;
|
|
703
|
-
slot.style.minWidth = previousWidth;
|
|
704
|
-
slot.style.minHeight = previousHeight;
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
// canvas/storyboard-visibility.ts
|
|
709
|
-
var FRAME = "[data-tempo-storyboard-render-id]";
|
|
710
|
-
var installed = false;
|
|
711
|
-
function installStoryboardVisibilityObserver() {
|
|
712
|
-
if (installed || typeof window === "undefined" || !window.IntersectionObserver)
|
|
713
|
-
return;
|
|
714
|
-
installed = true;
|
|
715
|
-
const NativeObserver = window.IntersectionObserver;
|
|
716
|
-
window.IntersectionObserver = class extends NativeObserver {
|
|
717
|
-
constructor(callback, options) {
|
|
718
|
-
if (typeof callback !== "function")
|
|
719
|
-
throw new TypeError("Expected an IntersectionObserver callback");
|
|
720
|
-
const init = { ...options };
|
|
721
|
-
let owner;
|
|
722
|
-
super((entries) => callback.call(owner, entries, owner), init);
|
|
723
|
-
this.scopes = /* @__PURE__ */ new Map();
|
|
724
|
-
this.targetScopes = /* @__PURE__ */ new Map();
|
|
725
|
-
owner = this;
|
|
726
|
-
this.callback = callback;
|
|
727
|
-
this.init = init;
|
|
728
|
-
}
|
|
729
|
-
observe(target) {
|
|
730
|
-
let root = this.root === null ? target.closest(FRAME) : null;
|
|
731
|
-
for (let node = target; root && node !== root; node = node.parentElement) {
|
|
732
|
-
if (!node) break;
|
|
733
|
-
if (getComputedStyle(node).position === "fixed") {
|
|
734
|
-
root = node === target ? null : node;
|
|
735
|
-
break;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
if (!root) {
|
|
739
|
-
this.unobserve(target);
|
|
740
|
-
super.observe(target);
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
if (this.targetScopes.get(target) === root) return;
|
|
744
|
-
this.unobserve(target);
|
|
745
|
-
let scope = this.scopes.get(root);
|
|
746
|
-
if (!scope) {
|
|
747
|
-
scope = {
|
|
748
|
-
observer: new NativeObserver(
|
|
749
|
-
(entries) => this.callback.call(this, entries, this),
|
|
750
|
-
{
|
|
751
|
-
...this.init,
|
|
752
|
-
root,
|
|
753
|
-
rootMargin: this.rootMargin,
|
|
754
|
-
threshold: [...this.thresholds]
|
|
755
|
-
}
|
|
756
|
-
),
|
|
757
|
-
targets: /* @__PURE__ */ new Set()
|
|
758
|
-
};
|
|
759
|
-
this.scopes.set(root, scope);
|
|
760
|
-
}
|
|
761
|
-
scope.observer.observe(target);
|
|
762
|
-
scope.targets.add(target);
|
|
763
|
-
this.targetScopes.set(target, root);
|
|
764
|
-
}
|
|
765
|
-
unobserve(target) {
|
|
766
|
-
const root = this.targetScopes.get(target);
|
|
767
|
-
if (root) {
|
|
768
|
-
const scope = this.scopes.get(root);
|
|
769
|
-
scope.observer.unobserve(target);
|
|
770
|
-
scope.targets.delete(target);
|
|
771
|
-
this.targetScopes.delete(target);
|
|
772
|
-
if (!scope.targets.size) {
|
|
773
|
-
scope.observer.disconnect();
|
|
774
|
-
this.scopes.delete(root);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
super.unobserve(target);
|
|
778
|
-
}
|
|
779
|
-
disconnect() {
|
|
780
|
-
for (const scope of this.scopes.values()) scope.observer.disconnect();
|
|
781
|
-
this.scopes.clear();
|
|
782
|
-
this.targetScopes.clear();
|
|
783
|
-
super.disconnect();
|
|
784
|
-
}
|
|
785
|
-
takeRecords() {
|
|
786
|
-
return [
|
|
787
|
-
...super.takeRecords(),
|
|
788
|
-
...[...this.scopes.values()].flatMap(
|
|
789
|
-
({ observer }) => observer.takeRecords()
|
|
790
|
-
)
|
|
791
|
-
].sort((a, b) => a.time - b.time);
|
|
792
|
-
}
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
// canvas/v1-client-compat.ts
|
|
797
|
-
function isV1CanvasClient() {
|
|
798
|
-
return canvasClientProtocol() < 2;
|
|
799
|
-
}
|
|
800
|
-
function v1RenderRequestSize(payload) {
|
|
801
|
-
return { intrinsicSize: payload.intrinsicSize === true ? true : void 0 };
|
|
802
|
-
}
|
|
803
|
-
function readDirectUrlFlag(value) {
|
|
804
|
-
if (value === null) return false;
|
|
805
|
-
const normalized = value.trim().toLowerCase();
|
|
806
|
-
return normalized !== "0" && normalized !== "false";
|
|
807
|
-
}
|
|
808
|
-
function v1DirectUrlSize(params, readDimension) {
|
|
809
|
-
const width = params.get("width")?.trim();
|
|
810
|
-
const height = params.get("height")?.trim();
|
|
811
|
-
const intrinsicSize = readDirectUrlFlag(params.get("intrinsicSize"));
|
|
812
|
-
if (!width && !height) {
|
|
813
|
-
return intrinsicSize ? { intrinsicSize: true, revision: 1 } : void 0;
|
|
814
|
-
}
|
|
815
|
-
if (!width || !height) {
|
|
816
|
-
throw new Error("Direct URL width and height must be provided together");
|
|
817
|
-
}
|
|
818
|
-
return {
|
|
819
|
-
width: readDimension(width),
|
|
820
|
-
height: readDimension(height),
|
|
821
|
-
...intrinsicSize ? { intrinsicSize: true } : {},
|
|
822
|
-
revision: 1
|
|
823
|
-
};
|
|
824
|
-
}
|
|
825
|
-
function v1SourceAnnotations(props) {
|
|
826
|
-
return Object.fromEntries(
|
|
827
|
-
Object.entries(props).filter(([key]) => key.startsWith("data-tempo-"))
|
|
828
|
-
);
|
|
829
|
-
}
|
|
830
|
-
function v1StoryboardSlotStyle(slot) {
|
|
831
|
-
const { kind, layout, renderSize, placement, status } = slot;
|
|
832
|
-
const renderWidth = renderSize?.width;
|
|
833
|
-
const renderHeight = renderSize?.height;
|
|
834
|
-
const intrinsicSize = renderSize?.intrinsicSize ?? (kind === "component" && layout.intrinsicSizing === "root-element");
|
|
835
|
-
return {
|
|
836
|
-
position: "absolute",
|
|
837
|
-
left: placement?.left ?? layout.x,
|
|
838
|
-
top: placement?.top ?? layout.y,
|
|
839
|
-
width: intrinsicSize ? "max-content" : renderWidth ?? layout.width,
|
|
840
|
-
height: intrinsicSize ? "max-content" : renderHeight ?? layout.height,
|
|
841
|
-
minWidth: intrinsicSize ? renderWidth : void 0,
|
|
842
|
-
minHeight: intrinsicSize ? renderHeight : void 0,
|
|
843
|
-
zIndex: layout.zIndex,
|
|
844
|
-
visibility: status === "active" ? "visible" : "hidden",
|
|
845
|
-
pointerEvents: status === "active" ? "auto" : "none"
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
// canvas/storyboard.tsx
|
|
850
|
-
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
851
|
-
function Storyboard({
|
|
852
|
-
id,
|
|
853
|
-
name,
|
|
854
|
-
component,
|
|
855
|
-
layout,
|
|
856
|
-
props,
|
|
857
|
-
vrt,
|
|
858
|
-
...annotations
|
|
859
|
-
}) {
|
|
860
|
-
const Component2 = component;
|
|
861
|
-
const content = isV1CanvasClient() ? /* @__PURE__ */ jsx3(
|
|
862
|
-
Component2,
|
|
863
|
-
{
|
|
864
|
-
...props ?? {},
|
|
865
|
-
...v1SourceAnnotations(annotations)
|
|
866
|
-
}
|
|
867
|
-
) : /* @__PURE__ */ jsx3(Component2, { ...props ?? {} });
|
|
868
|
-
return /* @__PURE__ */ jsx3(
|
|
869
|
-
StoryboardSlot,
|
|
870
|
-
{
|
|
871
|
-
"data-tempo-hide-fiber": "true",
|
|
872
|
-
id,
|
|
873
|
-
name,
|
|
874
|
-
layout,
|
|
875
|
-
kind: "component",
|
|
876
|
-
vrt: !!vrt,
|
|
877
|
-
children: /* @__PURE__ */ jsx3(ProjectionContent, { children: content })
|
|
878
|
-
}
|
|
879
|
-
);
|
|
880
|
-
}
|
|
881
|
-
function LegacyStoryboardV1({
|
|
882
|
-
id,
|
|
883
|
-
storyboard
|
|
884
|
-
}) {
|
|
885
|
-
return /* @__PURE__ */ jsx3(
|
|
886
|
-
StoryboardSlot,
|
|
887
|
-
{
|
|
888
|
-
"data-tempo-hide-fiber": "true",
|
|
889
|
-
id,
|
|
890
|
-
name: storyboard.name,
|
|
891
|
-
layout: storyboard.layout,
|
|
892
|
-
kind: "component",
|
|
893
|
-
children: /* @__PURE__ */ jsx3(LegacyStoryboardV1Render, { render: storyboard.render })
|
|
894
|
-
}
|
|
895
|
-
);
|
|
896
|
-
}
|
|
897
|
-
function LegacyStoryboardV1Render({
|
|
898
|
-
render
|
|
899
|
-
}) {
|
|
900
|
-
return /* @__PURE__ */ jsx3(Fragment, { children: render() });
|
|
901
|
-
}
|
|
902
|
-
function RouteStoryboard({
|
|
903
|
-
id,
|
|
904
|
-
name,
|
|
905
|
-
route,
|
|
906
|
-
layout,
|
|
907
|
-
...annotations
|
|
908
|
-
}) {
|
|
909
|
-
return /* @__PURE__ */ jsx3(
|
|
910
|
-
StoryboardSlot,
|
|
911
|
-
{
|
|
912
|
-
"data-tempo-hide-fiber": "true",
|
|
913
|
-
id,
|
|
914
|
-
name,
|
|
915
|
-
layout,
|
|
916
|
-
kind: "route",
|
|
917
|
-
route
|
|
918
|
-
}
|
|
919
|
-
);
|
|
920
|
-
}
|
|
921
|
-
function HtmlStoryboard({
|
|
922
|
-
id,
|
|
923
|
-
name,
|
|
924
|
-
filepath,
|
|
925
|
-
src,
|
|
926
|
-
layout,
|
|
927
|
-
vrt,
|
|
928
|
-
...annotations
|
|
929
|
-
}) {
|
|
930
|
-
return /* @__PURE__ */ jsx3(
|
|
931
|
-
StoryboardSlot,
|
|
932
|
-
{
|
|
933
|
-
"data-tempo-hide-fiber": "true",
|
|
934
|
-
id,
|
|
935
|
-
name,
|
|
936
|
-
layout,
|
|
937
|
-
kind: "html",
|
|
938
|
-
filepath,
|
|
939
|
-
src,
|
|
940
|
-
vrt: !!vrt
|
|
941
|
-
}
|
|
942
|
-
);
|
|
943
|
-
}
|
|
944
|
-
function StoryboardSlot({
|
|
945
|
-
children,
|
|
946
|
-
id,
|
|
947
|
-
kind,
|
|
948
|
-
layout,
|
|
949
|
-
name,
|
|
950
|
-
route,
|
|
951
|
-
filepath,
|
|
952
|
-
src,
|
|
953
|
-
vrt,
|
|
954
|
-
uiFramework,
|
|
955
|
-
preview,
|
|
956
|
-
previewKey,
|
|
957
|
-
keepLayoutWhenParked
|
|
958
|
-
}) {
|
|
959
|
-
const renderId = useCanvasStoryboardRenderId(id);
|
|
960
|
-
const canvas = useCanvasIdentity();
|
|
961
|
-
const status = useStoryboardStatus(id);
|
|
962
|
-
const renderSize = useStoryboardSize(id);
|
|
963
|
-
const placement = useStoryboardPlacement(id);
|
|
964
|
-
const markRendered = useStoryboardRendered(id);
|
|
965
|
-
const markUnmounted = useStoryboardUnmounted(id);
|
|
966
|
-
const { reportError, clearError } = useStoryboardErrorReporter(id);
|
|
967
|
-
const legacyResponsive = layout.intrinsicSizing === "root-element";
|
|
968
|
-
const declaredWidth = legacyResponsive ? void 0 : layout.width;
|
|
969
|
-
const declaredHeight = legacyResponsive ? void 0 : layout.height;
|
|
970
|
-
const renderWidth = renderSize === void 0 ? declaredWidth : renderSize.width;
|
|
971
|
-
const renderHeight = renderSize === void 0 ? declaredHeight : renderSize.height;
|
|
972
|
-
const fixed = renderWidth !== void 0 && renderHeight !== void 0;
|
|
973
|
-
const renderRevision = renderSize?.revision ?? 0;
|
|
974
|
-
const resetKey = `${renderId}:${renderRevision}`;
|
|
975
|
-
const contentRef = useRef2(null);
|
|
976
|
-
const [admittedRenderId, setAdmittedRenderId] = useState(
|
|
977
|
-
typeof document === "undefined" ? renderId : null
|
|
978
|
-
);
|
|
979
|
-
const admitted = admittedRenderId === renderId;
|
|
980
|
-
useLayoutEffect(() => {
|
|
981
|
-
if (!isV1CanvasClient()) installStoryboardVisibilityObserver();
|
|
982
|
-
}, []);
|
|
983
|
-
const errorBoundaryRef = useRef2(null);
|
|
984
|
-
const lastReportedCommitRef = useRef2(null);
|
|
985
|
-
const previousChildrenRef = useRef2(children);
|
|
986
|
-
const [recoveryRevision, setRecoveryRevision] = useState(0);
|
|
987
|
-
const commitKey = `${resetKey}:${recoveryRevision}`;
|
|
988
|
-
const retryRenderNow = useCallback3(() => {
|
|
989
|
-
if (!errorBoundaryRef.current?.retry()) return false;
|
|
990
|
-
setRecoveryRevision((revision) => revision + 1);
|
|
991
|
-
return true;
|
|
992
|
-
}, []);
|
|
993
|
-
const { noteRenderError, noteRecovered } = useRenderErrorRecovery(retryRenderNow);
|
|
994
|
-
const handleRenderError = useCallback3(
|
|
995
|
-
(error) => {
|
|
996
|
-
noteRenderError();
|
|
997
|
-
reportError(error);
|
|
998
|
-
},
|
|
999
|
-
[noteRenderError, reportError]
|
|
1000
|
-
);
|
|
1001
|
-
const pendingRenderedReportRef = useRef2(
|
|
1002
|
-
null
|
|
1003
|
-
);
|
|
1004
|
-
const handleRendered = useCallback3(
|
|
1005
|
-
(reportedCommitKey, active) => {
|
|
1006
|
-
if (pendingRenderedReportRef.current !== null) {
|
|
1007
|
-
clearTimeout(pendingRenderedReportRef.current);
|
|
1008
|
-
}
|
|
1009
|
-
pendingRenderedReportRef.current = setTimeout(() => {
|
|
1010
|
-
pendingRenderedReportRef.current = null;
|
|
1011
|
-
if (errorBoundaryRef.current?.hasError()) return;
|
|
1012
|
-
noteRecovered();
|
|
1013
|
-
clearError();
|
|
1014
|
-
if (!active) return;
|
|
1015
|
-
if (lastReportedCommitRef.current === reportedCommitKey) return;
|
|
1016
|
-
lastReportedCommitRef.current = reportedCommitKey;
|
|
1017
|
-
markRendered();
|
|
1018
|
-
}, 0);
|
|
1019
|
-
},
|
|
1020
|
-
[clearError, markRendered, noteRecovered]
|
|
1021
|
-
);
|
|
1022
|
-
useEffect2(
|
|
1023
|
-
() => () => {
|
|
1024
|
-
if (pendingRenderedReportRef.current !== null) {
|
|
1025
|
-
clearTimeout(pendingRenderedReportRef.current);
|
|
1026
|
-
pendingRenderedReportRef.current = null;
|
|
1027
|
-
}
|
|
1028
|
-
},
|
|
1029
|
-
[]
|
|
1030
|
-
);
|
|
1031
|
-
useLayoutEffect(() => {
|
|
1032
|
-
if (status === "active") return;
|
|
1033
|
-
lastReportedCommitRef.current = null;
|
|
1034
|
-
if (pendingRenderedReportRef.current !== null) {
|
|
1035
|
-
clearTimeout(pendingRenderedReportRef.current);
|
|
1036
|
-
pendingRenderedReportRef.current = null;
|
|
1037
|
-
}
|
|
1038
|
-
}, [status]);
|
|
1039
|
-
const renderChildren = useMemo2(() => {
|
|
1040
|
-
if (isValidElement2(children)) return cloneElement2(children);
|
|
1041
|
-
return Children2.map(
|
|
1042
|
-
children,
|
|
1043
|
-
(child) => isValidElement2(child) ? cloneElement2(child) : child
|
|
1044
|
-
);
|
|
1045
|
-
}, [children]);
|
|
1046
|
-
useLayoutEffect(() => {
|
|
1047
|
-
if (isV1CanvasClient() || fixed || status !== "active" || !contentRef.current)
|
|
1048
|
-
return;
|
|
1049
|
-
return observeResponsiveSlotSize(contentRef.current);
|
|
1050
|
-
}, [fixed, renderId, status]);
|
|
1051
|
-
useEffect2(() => markUnmounted, [markUnmounted]);
|
|
1052
|
-
useEffect2(() => {
|
|
1053
|
-
setAdmittedRenderId(renderId);
|
|
1054
|
-
}, [renderId]);
|
|
1055
|
-
useEffect2(() => {
|
|
1056
|
-
const childrenChanged = previousChildrenRef.current !== children;
|
|
1057
|
-
previousChildrenRef.current = children;
|
|
1058
|
-
if (childrenChanged) retryRenderNow();
|
|
1059
|
-
}, [children, retryRenderNow]);
|
|
1060
|
-
useEffect2(() => {
|
|
1061
|
-
if (!contentRef.current || status === "unmounted") return;
|
|
1062
|
-
return trackStoryboardPortals(renderId, contentRef.current, status);
|
|
1063
|
-
}, [renderId, status]);
|
|
1064
|
-
useEffect2(() => {
|
|
1065
|
-
if (status === "unmounted") return;
|
|
1066
|
-
syncStoryboardPortals(renderId, status);
|
|
1067
|
-
}, [renderId, status]);
|
|
1068
|
-
const declaration = JSON.stringify({
|
|
1069
|
-
id: id.trim(),
|
|
1070
|
-
name,
|
|
1071
|
-
kind,
|
|
1072
|
-
layout: {
|
|
1073
|
-
x: layout.x,
|
|
1074
|
-
y: layout.y,
|
|
1075
|
-
width: declaredWidth,
|
|
1076
|
-
height: declaredHeight,
|
|
1077
|
-
zIndex: layout.zIndex
|
|
1078
|
-
},
|
|
1079
|
-
route,
|
|
1080
|
-
filepath,
|
|
1081
|
-
src,
|
|
1082
|
-
vrt,
|
|
1083
|
-
uiFramework,
|
|
1084
|
-
preview,
|
|
1085
|
-
previewKey
|
|
1086
|
-
});
|
|
1087
|
-
if (status === "unmounted")
|
|
1088
|
-
return /* @__PURE__ */ jsx3(
|
|
1089
|
-
"div",
|
|
1090
|
-
{
|
|
1091
|
-
"data-tempo-storyboard-declaration": declaration,
|
|
1092
|
-
"data-tempo-storyboard-id": id,
|
|
1093
|
-
hidden: true
|
|
1094
|
-
}
|
|
1095
|
-
);
|
|
1096
|
-
return /* @__PURE__ */ jsx3(
|
|
1097
|
-
"div",
|
|
1098
|
-
{
|
|
1099
|
-
"data-render-id": renderId,
|
|
1100
|
-
"data-render-status": status,
|
|
1101
|
-
"data-tempo-storyboard-render-id": renderId,
|
|
1102
|
-
"data-tempo-storyboard-declaration": declaration,
|
|
1103
|
-
"data-tempo-storyboard-id": id,
|
|
1104
|
-
"data-tempo-canvas-path": canvas?.path,
|
|
1105
|
-
"data-tempo-storyboard-name": name,
|
|
1106
|
-
"data-tempo-storyboard-kind": kind,
|
|
1107
|
-
"data-tempo-storyboard-route": route,
|
|
1108
|
-
"data-tempo-storyboard-filepath": filepath,
|
|
1109
|
-
"data-tempo-storyboard-src": src,
|
|
1110
|
-
style: isV1CanvasClient() ? v1StoryboardSlotStyle({
|
|
1111
|
-
kind,
|
|
1112
|
-
layout,
|
|
1113
|
-
renderSize,
|
|
1114
|
-
placement,
|
|
1115
|
-
status
|
|
1116
|
-
}) : {
|
|
1117
|
-
position: "absolute",
|
|
1118
|
-
// Canvas placement belongs to the renderer. Source components
|
|
1119
|
-
// share an origin so their DOM never encodes canvas coordinates.
|
|
1120
|
-
// A protocol-2 client measures the slot where 0.0.94 put it.
|
|
1121
|
-
...isPreV3CanvasClient() ? v2StoryboardSlotPosition({ layout, placement, fixed }) : { left: 0, top: 0 },
|
|
1122
|
-
...fixed ? { width: renderWidth, height: renderHeight } : {},
|
|
1123
|
-
zIndex: layout.zIndex,
|
|
1124
|
-
// A hidden shell is already out of hit testing. It must not also
|
|
1125
|
-
// say pointer-events none: the producer records every element's
|
|
1126
|
-
// computed pointer-events as an app fact, and a full taken while
|
|
1127
|
-
// a restored shell is still cached would mark all of its content
|
|
1128
|
-
// click-through.
|
|
1129
|
-
visibility: status === "active" ? "visible" : "hidden",
|
|
1130
|
-
// Keep React/DOM state, but remove parked pages from layout:
|
|
1131
|
-
// with `display: none` an application's geometry reads cannot
|
|
1132
|
-
// force layout of a parked page (content-visibility still lets
|
|
1133
|
-
// them, on every animation frame). A board an engine renders
|
|
1134
|
-
// from its box (`keepLayoutWhenParked`, a Flutter view) must
|
|
1135
|
-
// keep that box: at 0x0 the engine stops painting and lays its
|
|
1136
|
-
// widgets out again, which changes the board's content and
|
|
1137
|
-
// loses its frames. It stays hidden by `visibility` above.
|
|
1138
|
-
display: status === "cached" && !keepLayoutWhenParked ? "none" : void 0
|
|
1139
|
-
},
|
|
1140
|
-
children: /* @__PURE__ */ jsx3(
|
|
1141
|
-
"div",
|
|
1142
|
-
{
|
|
1143
|
-
"data-render-content": renderId,
|
|
1144
|
-
"data-render-admitted": admitted && (isV1CanvasClient() || status === "active") ? "true" : void 0,
|
|
1145
|
-
"data-tempo-render-mode": kind === "html" ? "static-dom" : void 0,
|
|
1146
|
-
"data-tempo-hide-fiber": "true",
|
|
1147
|
-
...{ [PROJECTION_ROOT_ATTRIBUTE]: "true" },
|
|
1148
|
-
ref: contentRef,
|
|
1149
|
-
style: { width: "100%", height: "100%" },
|
|
1150
|
-
children: /* @__PURE__ */ jsx3(
|
|
1151
|
-
StoryboardErrorBoundary,
|
|
1152
|
-
{
|
|
1153
|
-
ref: errorBoundaryRef,
|
|
1154
|
-
onError: handleRenderError,
|
|
1155
|
-
resetKey,
|
|
1156
|
-
children: admitted ? /* @__PURE__ */ jsxs(Suspense, { fallback: /* @__PURE__ */ jsx3(CanvasPendingMarker, {}), children: [
|
|
1157
|
-
/* @__PURE__ */ jsx3(StoryboardAdmission, { renderId, children: renderChildren }),
|
|
1158
|
-
/* @__PURE__ */ jsx3(
|
|
1159
|
-
StoryboardCommitSignal,
|
|
1160
|
-
{
|
|
1161
|
-
commitKey,
|
|
1162
|
-
active: status === "active",
|
|
1163
|
-
onCommit: handleRendered
|
|
1164
|
-
},
|
|
1165
|
-
commitKey
|
|
1166
|
-
)
|
|
1167
|
-
] }) : (
|
|
1168
|
-
// An established watch can rebind to this shell after a remount,
|
|
1169
|
-
// before the passive admission effect runs. Mark that loading
|
|
1170
|
-
// phase so it holds the preview instead of publishing an empty
|
|
1171
|
-
// baseline. Admitted components may still intentionally return null.
|
|
1172
|
-
/* @__PURE__ */ jsx3(CanvasPendingMarker, {})
|
|
1173
|
-
)
|
|
1174
|
-
}
|
|
1175
|
-
)
|
|
1176
|
-
}
|
|
1177
|
-
)
|
|
1178
|
-
}
|
|
1179
|
-
);
|
|
1180
|
-
}
|
|
1181
|
-
function StoryboardAdmission({
|
|
1182
|
-
children,
|
|
1183
|
-
renderId
|
|
1184
|
-
}) {
|
|
1185
|
-
const host = useRequiredCanvasHost();
|
|
1186
|
-
useState(() => host.prepareStoryboardCapture?.(renderId));
|
|
1187
|
-
beginAdmissionWindow();
|
|
1188
|
-
return children;
|
|
1189
|
-
}
|
|
1190
|
-
function StoryboardCommitSignal({
|
|
1191
|
-
commitKey,
|
|
1192
|
-
active,
|
|
1193
|
-
onCommit
|
|
1194
|
-
}) {
|
|
1195
|
-
const onCommitRef = useRef2(onCommit);
|
|
1196
|
-
onCommitRef.current = onCommit;
|
|
1197
|
-
useLayoutEffect(() => {
|
|
1198
|
-
onCommitRef.current(commitKey, active);
|
|
1199
|
-
}, [commitKey, active]);
|
|
1200
|
-
return null;
|
|
1201
|
-
}
|
|
1202
|
-
var maxReportedComponentStackFrames = 40;
|
|
1203
|
-
function boundComponentStack(componentStack) {
|
|
1204
|
-
if (!componentStack) return void 0;
|
|
1205
|
-
const frames = componentStack.split("\n");
|
|
1206
|
-
if (frames.length <= maxReportedComponentStackFrames) return componentStack;
|
|
1207
|
-
const dropped = frames.length - maxReportedComponentStackFrames;
|
|
1208
|
-
return [
|
|
1209
|
-
...frames.slice(0, maxReportedComponentStackFrames),
|
|
1210
|
-
` ... ${dropped} more frames`
|
|
1211
|
-
].join("\n");
|
|
1212
|
-
}
|
|
1213
|
-
var StoryboardErrorBoundary = class extends Component {
|
|
1214
|
-
constructor() {
|
|
1215
|
-
super(...arguments);
|
|
1216
|
-
this.state = {
|
|
1217
|
-
error: null,
|
|
1218
|
-
componentStack: void 0,
|
|
1219
|
-
resetKey: this.props.resetKey
|
|
1220
|
-
};
|
|
1221
|
-
}
|
|
1222
|
-
static getDerivedStateFromError(error) {
|
|
1223
|
-
return { error };
|
|
1224
|
-
}
|
|
1225
|
-
static getDerivedStateFromProps(props, state) {
|
|
1226
|
-
if (props.resetKey !== state.resetKey) {
|
|
1227
|
-
return {
|
|
1228
|
-
error: null,
|
|
1229
|
-
componentStack: void 0,
|
|
1230
|
-
resetKey: props.resetKey
|
|
1231
|
-
};
|
|
1232
|
-
}
|
|
1233
|
-
return null;
|
|
1234
|
-
}
|
|
1235
|
-
componentDidCatch(error, info) {
|
|
1236
|
-
const componentStack = boundComponentStack(info.componentStack);
|
|
1237
|
-
this.setState({ componentStack });
|
|
1238
|
-
this.props.onError({
|
|
1239
|
-
message: error.message,
|
|
1240
|
-
stack: error.stack,
|
|
1241
|
-
componentStack
|
|
1242
|
-
});
|
|
1243
|
-
}
|
|
1244
|
-
hasError() {
|
|
1245
|
-
return this.state.error !== null;
|
|
1246
|
-
}
|
|
1247
|
-
retry() {
|
|
1248
|
-
if (!this.state.error) return false;
|
|
1249
|
-
this.setState(
|
|
1250
|
-
(state) => state.error ? { error: null, componentStack: void 0, resetKey: state.resetKey } : null
|
|
1251
|
-
);
|
|
1252
|
-
return true;
|
|
1253
|
-
}
|
|
1254
|
-
render() {
|
|
1255
|
-
if (this.state.error) {
|
|
1256
|
-
return /* @__PURE__ */ jsx3(
|
|
1257
|
-
"div",
|
|
1258
|
-
{
|
|
1259
|
-
"data-render-error": "true",
|
|
1260
|
-
"data-render-error-message": this.state.error.message,
|
|
1261
|
-
style: { width: "100%", height: "100%" }
|
|
1262
|
-
}
|
|
1263
|
-
);
|
|
1264
|
-
}
|
|
1265
|
-
return this.props.children;
|
|
1266
|
-
}
|
|
1267
|
-
};
|
|
1268
|
-
var ProjectionContent = Object.assign(
|
|
1269
|
-
function ProjectionContent2({ children }) {
|
|
1270
|
-
return children;
|
|
1271
|
-
},
|
|
1272
|
-
{ [PROJECTION_SCOPE_ROLE]: "output" }
|
|
1273
|
-
);
|
|
1274
|
-
Object.assign(StoryboardAdmission, { [PROJECTION_SCOPE_ROLE]: "transparent" });
|
|
1275
|
-
Object.assign(StoryboardCommitSignal, {
|
|
1276
|
-
[PROJECTION_SCOPE_ROLE]: "transparent"
|
|
1277
|
-
});
|
|
1278
|
-
Object.assign(StoryboardErrorBoundary, {
|
|
1279
|
-
[PROJECTION_SCOPE_ROLE]: "transparent"
|
|
1280
|
-
});
|
|
1281
|
-
|
|
1282
|
-
export {
|
|
1283
|
-
normalizeId,
|
|
1284
|
-
getStoryboardKey,
|
|
1285
|
-
getCanvasStoryboardRenderId,
|
|
1286
|
-
useCanvasStoryboardRenderId,
|
|
1287
|
-
Canvas,
|
|
1288
|
-
CanvasContext,
|
|
1289
|
-
CanvasPendingMarker,
|
|
1290
|
-
CanvasUnavailableMarker,
|
|
1291
|
-
emitRenderErrorRecoveryBeat,
|
|
1292
|
-
useRenderErrorRecovery,
|
|
1293
|
-
CanvasHostContext,
|
|
1294
|
-
useRequiredCanvasHost,
|
|
1295
|
-
useActiveState,
|
|
1296
|
-
useStoryboardSize,
|
|
1297
|
-
getStoryboardPortalSelectors,
|
|
1298
|
-
isV1CanvasClient,
|
|
1299
|
-
v1RenderRequestSize,
|
|
1300
|
-
v1DirectUrlSize,
|
|
1301
|
-
AdmissionBudgetError,
|
|
1302
|
-
Storyboard,
|
|
1303
|
-
LegacyStoryboardV1,
|
|
1304
|
-
RouteStoryboard,
|
|
1305
|
-
HtmlStoryboard,
|
|
1306
|
-
StoryboardSlot
|
|
1307
|
-
};
|
|
1308
|
-
//# sourceMappingURL=chunk-X5DJKVBT.js.map
|