tempo-sdk 0.0.28 → 0.0.30
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/canvas/editor.d.ts +29 -1
- package/dist/canvas/editor.js +50 -5
- package/dist/canvas/editor.js.map +1 -1
- package/dist/canvas/index.d.ts +3 -66
- package/dist/canvas/index.js +56 -940
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +2679 -1956
- package/dist/canvas/interact-projection.js.map +1 -1
- package/dist/canvas/parser.d.ts +6 -0
- package/dist/canvas/parser.js +1 -1
- package/dist/canvas/svelte.d.ts +18 -0
- package/dist/canvas/svelte.js +68 -0
- package/dist/canvas/svelte.js.map +1 -0
- package/dist/chunk-DXKG4IGS.js +919 -0
- package/dist/chunk-DXKG4IGS.js.map +1 -0
- package/dist/chunk-F3KJDCMU.js +19 -0
- package/dist/chunk-F3KJDCMU.js.map +1 -0
- package/dist/{chunk-XEXMGSTU.js → chunk-KVQPEU4H.js} +16 -2
- package/dist/{chunk-XEXMGSTU.js.map → chunk-KVQPEU4H.js.map} +1 -1
- package/dist/{chunk-2MAQPUCU.js → chunk-QP2NTODB.js} +19 -12
- package/dist/chunk-QP2NTODB.js.map +1 -0
- package/dist/index.js +18 -16
- package/dist/index.js.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs.cjs +15 -1
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/storyboard-xVaRTJAu.d.ts +69 -0
- package/dist/svelte.d.ts +21 -0
- package/dist/svelte.js +1898 -0
- package/dist/svelte.js.map +1 -0
- package/package.json +15 -1
- package/dist/chunk-2MAQPUCU.js.map +0 -1
|
@@ -0,0 +1,919 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PROJECTION_PENDING_ATTRIBUTE
|
|
3
|
+
} from "./chunk-ZT2REPH4.js";
|
|
4
|
+
|
|
5
|
+
// canvas/canvas.tsx
|
|
6
|
+
import {
|
|
7
|
+
Children,
|
|
8
|
+
cloneElement,
|
|
9
|
+
createContext,
|
|
10
|
+
isValidElement,
|
|
11
|
+
useContext,
|
|
12
|
+
useMemo
|
|
13
|
+
} from "react";
|
|
14
|
+
|
|
15
|
+
// canvas/ids.ts
|
|
16
|
+
function normalizeId(value, label) {
|
|
17
|
+
const normalized = value?.trim();
|
|
18
|
+
if (!normalized) {
|
|
19
|
+
throw new Error(`${label} is required.`);
|
|
20
|
+
}
|
|
21
|
+
return normalized;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// canvas/canvas.tsx
|
|
25
|
+
import { jsx } from "react/jsx-runtime";
|
|
26
|
+
var CanvasIdentityContext = createContext(null);
|
|
27
|
+
function getCanvasStoryboardRenderId(canvasPath, storyboardId) {
|
|
28
|
+
return `canvas:${encodeURIComponent(
|
|
29
|
+
normalizeId(canvasPath, "Canvas path")
|
|
30
|
+
)}#storyboard:${encodeURIComponent(
|
|
31
|
+
normalizeId(storyboardId, "Storyboard id")
|
|
32
|
+
)}`;
|
|
33
|
+
}
|
|
34
|
+
function useCanvasIdentity() {
|
|
35
|
+
return useContext(CanvasIdentityContext);
|
|
36
|
+
}
|
|
37
|
+
function useCanvasStoryboardRenderId(storyboardId) {
|
|
38
|
+
const canvas = useCanvasIdentity();
|
|
39
|
+
const normalizedId = normalizeId(storyboardId, "Storyboard id");
|
|
40
|
+
return canvas ? getCanvasStoryboardRenderId(canvas.path, normalizedId) : normalizedId;
|
|
41
|
+
}
|
|
42
|
+
function Canvas({
|
|
43
|
+
children,
|
|
44
|
+
name,
|
|
45
|
+
path,
|
|
46
|
+
backgroundColor,
|
|
47
|
+
defaultViewport,
|
|
48
|
+
...sourceAnnotations
|
|
49
|
+
}) {
|
|
50
|
+
const contextIdentity = useCanvasIdentity();
|
|
51
|
+
const canvasName = normalizeId(name, "Canvas name");
|
|
52
|
+
const canvasPath = path === void 0 ? contextIdentity?.path : normalizeId(path, "Canvas path");
|
|
53
|
+
if (!canvasPath) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
'<Canvas> must be rendered inside <CanvasContext path="..."> or receive a path prop.'
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
const identity = useMemo(() => ({ path: canvasPath }), [canvasPath]);
|
|
59
|
+
const keyedChildren = useMemo(
|
|
60
|
+
() => Children.map(children, (child) => {
|
|
61
|
+
if (!isValidElement(child)) return child;
|
|
62
|
+
if (child.key != null) return child;
|
|
63
|
+
const id = child.props.id;
|
|
64
|
+
if (typeof id !== "string" || id.length === 0) return child;
|
|
65
|
+
return cloneElement(child, { key: `storyboard:${id}` });
|
|
66
|
+
}),
|
|
67
|
+
[children]
|
|
68
|
+
);
|
|
69
|
+
return /* @__PURE__ */ jsx(CanvasIdentityContext.Provider, { value: identity, children: /* @__PURE__ */ jsx(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
...sourceAnnotations,
|
|
73
|
+
"data-tempo-canvas": canvasName,
|
|
74
|
+
"data-tempo-canvas-path": canvasPath,
|
|
75
|
+
"data-tempo-canvas-background": backgroundColor,
|
|
76
|
+
"data-tempo-canvas-viewport": defaultViewport ? JSON.stringify(defaultViewport) : void 0,
|
|
77
|
+
children: keyedChildren
|
|
78
|
+
}
|
|
79
|
+
) });
|
|
80
|
+
}
|
|
81
|
+
function CanvasContext({
|
|
82
|
+
children,
|
|
83
|
+
path
|
|
84
|
+
}) {
|
|
85
|
+
const canvasPath = normalizeId(path, "Canvas path");
|
|
86
|
+
const identity = useMemo(() => ({ path: canvasPath }), [canvasPath]);
|
|
87
|
+
return /* @__PURE__ */ jsx(CanvasIdentityContext.Provider, { value: identity, children });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// canvas/runtime-context.ts
|
|
91
|
+
import { createContext as createContext2, useCallback, useContext as useContext2 } from "react";
|
|
92
|
+
var CanvasHostContext = createContext2(null);
|
|
93
|
+
function useRequiredCanvasHost() {
|
|
94
|
+
const host = useContext2(CanvasHostContext);
|
|
95
|
+
if (!host) {
|
|
96
|
+
throw new Error(
|
|
97
|
+
"Tempo canvas components must be rendered inside <CanvasHost>."
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
return host;
|
|
101
|
+
}
|
|
102
|
+
function useActiveState(storyboardId) {
|
|
103
|
+
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
104
|
+
const host = useRequiredCanvasHost();
|
|
105
|
+
return host.getStoryboardStatus(renderId) !== "unmounted";
|
|
106
|
+
}
|
|
107
|
+
function useStoryboardStatus(storyboardId) {
|
|
108
|
+
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
109
|
+
const host = useRequiredCanvasHost();
|
|
110
|
+
return host.getStoryboardStatus(renderId);
|
|
111
|
+
}
|
|
112
|
+
function useStoryboardRendered(storyboardId) {
|
|
113
|
+
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
114
|
+
const host = useRequiredCanvasHost();
|
|
115
|
+
return useCallback(() => {
|
|
116
|
+
host.markStoryboardRendered(renderId);
|
|
117
|
+
}, [host, renderId]);
|
|
118
|
+
}
|
|
119
|
+
function useStoryboardUnmounted(storyboardId) {
|
|
120
|
+
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
121
|
+
const { markStoryboardUnmounted } = useRequiredCanvasHost();
|
|
122
|
+
return useCallback(() => {
|
|
123
|
+
markStoryboardUnmounted(renderId);
|
|
124
|
+
}, [markStoryboardUnmounted, renderId]);
|
|
125
|
+
}
|
|
126
|
+
function useStoryboardErrorReporter(storyboardId) {
|
|
127
|
+
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
128
|
+
const host = useRequiredCanvasHost();
|
|
129
|
+
const reportError = useCallback(
|
|
130
|
+
(error) => {
|
|
131
|
+
host.reportStoryboardError(renderId, error);
|
|
132
|
+
},
|
|
133
|
+
[host, renderId]
|
|
134
|
+
);
|
|
135
|
+
const clearError = useCallback(() => {
|
|
136
|
+
host.clearStoryboardError(renderId);
|
|
137
|
+
}, [host, renderId]);
|
|
138
|
+
return { reportError, clearError };
|
|
139
|
+
}
|
|
140
|
+
function useStoryboardSize(storyboardId) {
|
|
141
|
+
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
142
|
+
const host = useRequiredCanvasHost();
|
|
143
|
+
return host.getStoryboardSize(renderId);
|
|
144
|
+
}
|
|
145
|
+
function useStoryboardPlacement(storyboardId) {
|
|
146
|
+
const renderId = useCanvasStoryboardRenderId(storyboardId);
|
|
147
|
+
const host = useRequiredCanvasHost();
|
|
148
|
+
return host.getStoryboardPlacement(renderId);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// canvas/storyboard.tsx
|
|
152
|
+
import {
|
|
153
|
+
Children as Children2,
|
|
154
|
+
Component,
|
|
155
|
+
cloneElement as cloneElement2,
|
|
156
|
+
isValidElement as isValidElement2,
|
|
157
|
+
Suspense,
|
|
158
|
+
useCallback as useCallback3,
|
|
159
|
+
useEffect as useEffect2,
|
|
160
|
+
useLayoutEffect,
|
|
161
|
+
useMemo as useMemo2,
|
|
162
|
+
useRef as useRef2,
|
|
163
|
+
useState
|
|
164
|
+
} from "react";
|
|
165
|
+
|
|
166
|
+
// canvas/admission-budget.ts
|
|
167
|
+
import * as React from "react";
|
|
168
|
+
var admissionRenderStepBudget = 1e5;
|
|
169
|
+
var AdmissionBudgetError = class extends Error {
|
|
170
|
+
constructor() {
|
|
171
|
+
super(
|
|
172
|
+
"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."
|
|
173
|
+
);
|
|
174
|
+
this.name = "AdmissionBudgetError";
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
function findDispatcherSlot() {
|
|
178
|
+
const react = React;
|
|
179
|
+
const modern = react.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
180
|
+
if (modern && "H" in modern) return { holder: modern, key: "H" };
|
|
181
|
+
const legacy = react.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentDispatcher;
|
|
182
|
+
if (legacy && "current" in legacy) return { holder: legacy, key: "current" };
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
var stepsRemaining = admissionRenderStepBudget;
|
|
186
|
+
var rearmScheduled = false;
|
|
187
|
+
var counterState = "uninstalled";
|
|
188
|
+
function scheduleRearm() {
|
|
189
|
+
if (rearmScheduled) return;
|
|
190
|
+
rearmScheduled = true;
|
|
191
|
+
queueMicrotask(() => {
|
|
192
|
+
rearmScheduled = false;
|
|
193
|
+
stepsRemaining = admissionRenderStepBudget;
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function installCounter() {
|
|
197
|
+
if (counterState !== "uninstalled") return counterState === "installed";
|
|
198
|
+
const slot = findDispatcherSlot();
|
|
199
|
+
if (!slot) {
|
|
200
|
+
counterState = "unavailable";
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
const { holder, key } = slot;
|
|
204
|
+
let dispatcher = holder[key];
|
|
205
|
+
Object.defineProperty(holder, key, {
|
|
206
|
+
configurable: true,
|
|
207
|
+
get: () => dispatcher,
|
|
208
|
+
set: (value) => {
|
|
209
|
+
dispatcher = value;
|
|
210
|
+
scheduleRearm();
|
|
211
|
+
stepsRemaining -= 1;
|
|
212
|
+
if (stepsRemaining > 0) return;
|
|
213
|
+
stepsRemaining = admissionRenderStepBudget;
|
|
214
|
+
throw new AdmissionBudgetError();
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
counterState = "installed";
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
function beginAdmissionWindow() {
|
|
221
|
+
if (!installCounter()) return;
|
|
222
|
+
stepsRemaining = admissionRenderStepBudget;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// canvas/canvas-pending-marker.tsx
|
|
226
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
227
|
+
function CanvasPendingMarker() {
|
|
228
|
+
return /* @__PURE__ */ jsx2(
|
|
229
|
+
"div",
|
|
230
|
+
{
|
|
231
|
+
...{ [PROJECTION_PENDING_ATTRIBUTE]: "" },
|
|
232
|
+
style: { display: "none" },
|
|
233
|
+
"aria-hidden": "true"
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// canvas/portal-tracking.ts
|
|
239
|
+
var PORTAL_MANAGED_PROPERTIES = [
|
|
240
|
+
{ key: "visibility", cssName: "visibility", hiddenValue: "hidden" },
|
|
241
|
+
{ key: "pointerEvents", cssName: "pointer-events", hiddenValue: "none" },
|
|
242
|
+
{
|
|
243
|
+
key: "contentVisibility",
|
|
244
|
+
cssName: "content-visibility",
|
|
245
|
+
hiddenValue: "hidden"
|
|
246
|
+
},
|
|
247
|
+
{ key: "transition", cssName: "transition", hiddenValue: "none" },
|
|
248
|
+
{ key: "animation", cssName: "animation", hiddenValue: "none" }
|
|
249
|
+
];
|
|
250
|
+
var portalElementsByRenderId = /* @__PURE__ */ new Map();
|
|
251
|
+
var portalOwnerRenderIdsByElement = /* @__PURE__ */ new Map();
|
|
252
|
+
var portalInlineStyleByElement = /* @__PURE__ */ new Map();
|
|
253
|
+
var renderStatusById = /* @__PURE__ */ new Map();
|
|
254
|
+
var projectionPortalIdAttribute = "data-projection-portal-id";
|
|
255
|
+
var nextSdkPortalId = 1;
|
|
256
|
+
function escapeAttributeValue(value) {
|
|
257
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
258
|
+
}
|
|
259
|
+
function ensureProjectionPortalId(portalRoot) {
|
|
260
|
+
const existingId = portalRoot.getAttribute(projectionPortalIdAttribute);
|
|
261
|
+
if (existingId) return existingId;
|
|
262
|
+
const id = `tempo-sdk-portal-${nextSdkPortalId++}`;
|
|
263
|
+
portalRoot.setAttribute(projectionPortalIdAttribute, id);
|
|
264
|
+
return id;
|
|
265
|
+
}
|
|
266
|
+
function buildProjectionPortalSelector(portalRoot) {
|
|
267
|
+
return `[${projectionPortalIdAttribute}="${escapeAttributeValue(
|
|
268
|
+
ensureProjectionPortalId(portalRoot)
|
|
269
|
+
)}"]`;
|
|
270
|
+
}
|
|
271
|
+
function findFiberKey(element) {
|
|
272
|
+
return Object.keys(element).find(
|
|
273
|
+
(key) => key.startsWith("__reactFiber$") || key.startsWith("__reactInternalInstance$")
|
|
274
|
+
) ?? null;
|
|
275
|
+
}
|
|
276
|
+
function findContainerKey(element) {
|
|
277
|
+
return Object.keys(element).find((key) => key.startsWith("__reactContainer$")) ?? null;
|
|
278
|
+
}
|
|
279
|
+
function getFiberFromElement(element) {
|
|
280
|
+
const fiberKey = findFiberKey(element);
|
|
281
|
+
if (fiberKey) {
|
|
282
|
+
return element[fiberKey] ?? null;
|
|
283
|
+
}
|
|
284
|
+
const containerKey = findContainerKey(element);
|
|
285
|
+
if (containerKey) {
|
|
286
|
+
return element[containerKey] ?? null;
|
|
287
|
+
}
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
var PortalTracker = class {
|
|
291
|
+
constructor() {
|
|
292
|
+
this.watchers = /* @__PURE__ */ new Set();
|
|
293
|
+
this.ownerWatchersByPortalRoot = /* @__PURE__ */ new Map();
|
|
294
|
+
this.observer = null;
|
|
295
|
+
this.handleMutations = (mutations) => {
|
|
296
|
+
for (const mutation of mutations) {
|
|
297
|
+
for (const node of mutation.addedNodes) {
|
|
298
|
+
if (node instanceof Element) {
|
|
299
|
+
queueMicrotask(() => this.checkElement(node));
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
for (const node of mutation.removedNodes) {
|
|
303
|
+
if (!(node instanceof Element)) continue;
|
|
304
|
+
const owners = this.ownerWatchersByPortalRoot.get(node);
|
|
305
|
+
if (!owners) continue;
|
|
306
|
+
for (const owner of owners) {
|
|
307
|
+
owner.onPortalRemoved(node);
|
|
308
|
+
}
|
|
309
|
+
this.ownerWatchersByPortalRoot.delete(node);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
register(watcher) {
|
|
315
|
+
this.watchers.add(watcher);
|
|
316
|
+
if (this.watchers.size === 1) {
|
|
317
|
+
this.startObserving();
|
|
318
|
+
}
|
|
319
|
+
if (typeof document !== "undefined" && document.body) {
|
|
320
|
+
this.checkExistingElements();
|
|
321
|
+
queueMicrotask(() => this.checkExistingElements());
|
|
322
|
+
}
|
|
323
|
+
return () => this.unregister(watcher);
|
|
324
|
+
}
|
|
325
|
+
checkExistingElements() {
|
|
326
|
+
if (typeof document === "undefined" || !document.body) return;
|
|
327
|
+
for (const child of Array.from(document.body.children)) {
|
|
328
|
+
this.checkElement(child);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
unregister(watcher) {
|
|
332
|
+
this.watchers.delete(watcher);
|
|
333
|
+
for (const [portalRoot, owners] of this.ownerWatchersByPortalRoot) {
|
|
334
|
+
owners.delete(watcher);
|
|
335
|
+
if (owners.size === 0) {
|
|
336
|
+
this.ownerWatchersByPortalRoot.delete(portalRoot);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
if (this.watchers.size === 0) {
|
|
340
|
+
this.stopObserving();
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
startObserving() {
|
|
344
|
+
if (this.observer || typeof document === "undefined" || !document.body || typeof MutationObserver === "undefined") {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
this.observer = new MutationObserver(this.handleMutations);
|
|
348
|
+
this.observer.observe(document.body, { childList: true });
|
|
349
|
+
}
|
|
350
|
+
stopObserving() {
|
|
351
|
+
this.observer?.disconnect();
|
|
352
|
+
this.observer = null;
|
|
353
|
+
}
|
|
354
|
+
checkElement(element) {
|
|
355
|
+
const ancestorDomNodes = this.getDomAncestorsViaFiber(element);
|
|
356
|
+
if (ancestorDomNodes.length === 0) return;
|
|
357
|
+
let owners = this.ownerWatchersByPortalRoot.get(element);
|
|
358
|
+
for (const watcher of this.watchers) {
|
|
359
|
+
const belongsToWatcher = ancestorDomNodes.some(
|
|
360
|
+
(node) => watcher.element.contains(node) || watcher.element === node
|
|
361
|
+
);
|
|
362
|
+
if (!belongsToWatcher) continue;
|
|
363
|
+
if (!owners) {
|
|
364
|
+
owners = /* @__PURE__ */ new Set();
|
|
365
|
+
this.ownerWatchersByPortalRoot.set(element, owners);
|
|
366
|
+
}
|
|
367
|
+
if (owners.has(watcher)) continue;
|
|
368
|
+
owners.add(watcher);
|
|
369
|
+
watcher.onPortalFound(element);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
getDomAncestorsViaFiber(element) {
|
|
373
|
+
const fiber = getFiberFromElement(element);
|
|
374
|
+
if (!fiber) return [];
|
|
375
|
+
const domNodes = [];
|
|
376
|
+
let current = fiber.return;
|
|
377
|
+
while (current) {
|
|
378
|
+
if (current.stateNode instanceof Element) {
|
|
379
|
+
domNodes.push(current.stateNode);
|
|
380
|
+
}
|
|
381
|
+
current = current.return;
|
|
382
|
+
}
|
|
383
|
+
return domNodes;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
var portalTracker = null;
|
|
387
|
+
function getPortalTracker() {
|
|
388
|
+
if (!portalTracker) {
|
|
389
|
+
portalTracker = new PortalTracker();
|
|
390
|
+
}
|
|
391
|
+
return portalTracker;
|
|
392
|
+
}
|
|
393
|
+
function getStylablePortalElement(portalRoot) {
|
|
394
|
+
if (portalRoot instanceof HTMLElement || portalRoot instanceof SVGElement) {
|
|
395
|
+
return portalRoot;
|
|
396
|
+
}
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
function ensurePortalInlineStyle(portalRoot) {
|
|
400
|
+
const existing = portalInlineStyleByElement.get(portalRoot);
|
|
401
|
+
if (existing) return existing;
|
|
402
|
+
const stylableElement = getStylablePortalElement(portalRoot);
|
|
403
|
+
const baseline = {
|
|
404
|
+
visibility: readInlineStyleValue(stylableElement, "visibility"),
|
|
405
|
+
pointerEvents: readInlineStyleValue(stylableElement, "pointer-events"),
|
|
406
|
+
contentVisibility: readInlineStyleValue(
|
|
407
|
+
stylableElement,
|
|
408
|
+
"content-visibility"
|
|
409
|
+
),
|
|
410
|
+
transition: readInlineStyleValue(stylableElement, "transition"),
|
|
411
|
+
animation: readInlineStyleValue(stylableElement, "animation")
|
|
412
|
+
};
|
|
413
|
+
portalInlineStyleByElement.set(portalRoot, baseline);
|
|
414
|
+
return baseline;
|
|
415
|
+
}
|
|
416
|
+
function readInlineStyleValue(element, propertyName) {
|
|
417
|
+
return {
|
|
418
|
+
value: element?.style.getPropertyValue(propertyName) ?? "",
|
|
419
|
+
priority: element?.style.getPropertyPriority(propertyName) ?? ""
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function restoreInlineStyleValue(style, propertyName, baseline) {
|
|
423
|
+
if (baseline.value) {
|
|
424
|
+
style.setProperty(propertyName, baseline.value, baseline.priority);
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
style.removeProperty(propertyName);
|
|
428
|
+
}
|
|
429
|
+
function restorePortalInlineStyle(portalRoot) {
|
|
430
|
+
const stylableElement = getStylablePortalElement(portalRoot);
|
|
431
|
+
const baseline = portalInlineStyleByElement.get(portalRoot);
|
|
432
|
+
if (!stylableElement || !baseline) return;
|
|
433
|
+
for (const property of PORTAL_MANAGED_PROPERTIES) {
|
|
434
|
+
restoreInlineStyleValue(
|
|
435
|
+
stylableElement.style,
|
|
436
|
+
property.cssName,
|
|
437
|
+
baseline[property.key]
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
function syncPortalVisibility(portalRoot) {
|
|
442
|
+
const owners = portalOwnerRenderIdsByElement.get(portalRoot);
|
|
443
|
+
if (!owners || owners.size === 0) {
|
|
444
|
+
restorePortalInlineStyle(portalRoot);
|
|
445
|
+
portalInlineStyleByElement.delete(portalRoot);
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
const stylableElement = getStylablePortalElement(portalRoot);
|
|
449
|
+
if (!stylableElement) return;
|
|
450
|
+
const shouldBeVisible = [...owners].some(
|
|
451
|
+
(renderId) => renderStatusById.get(renderId) === "active"
|
|
452
|
+
);
|
|
453
|
+
if (shouldBeVisible) {
|
|
454
|
+
restorePortalInlineStyle(portalRoot);
|
|
455
|
+
portalInlineStyleByElement.delete(portalRoot);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
ensurePortalInlineStyle(portalRoot);
|
|
459
|
+
for (const property of PORTAL_MANAGED_PROPERTIES) {
|
|
460
|
+
stylableElement.style.setProperty(
|
|
461
|
+
property.cssName,
|
|
462
|
+
property.hiddenValue,
|
|
463
|
+
"important"
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
function trackPortal(renderId, portalRoot) {
|
|
468
|
+
ensureProjectionPortalId(portalRoot);
|
|
469
|
+
const portals = portalElementsByRenderId.get(renderId) ?? /* @__PURE__ */ new Set();
|
|
470
|
+
portals.add(portalRoot);
|
|
471
|
+
portalElementsByRenderId.set(renderId, portals);
|
|
472
|
+
const owners = portalOwnerRenderIdsByElement.get(portalRoot) ?? /* @__PURE__ */ new Set();
|
|
473
|
+
owners.add(renderId);
|
|
474
|
+
portalOwnerRenderIdsByElement.set(portalRoot, owners);
|
|
475
|
+
syncPortalVisibility(portalRoot);
|
|
476
|
+
}
|
|
477
|
+
function untrackPortal(renderId, portalRoot) {
|
|
478
|
+
const portals = portalElementsByRenderId.get(renderId);
|
|
479
|
+
if (!portals) return;
|
|
480
|
+
portals.delete(portalRoot);
|
|
481
|
+
if (portals.size === 0) {
|
|
482
|
+
portalElementsByRenderId.delete(renderId);
|
|
483
|
+
}
|
|
484
|
+
const owners = portalOwnerRenderIdsByElement.get(portalRoot);
|
|
485
|
+
if (owners) {
|
|
486
|
+
owners.delete(renderId);
|
|
487
|
+
if (owners.size === 0) {
|
|
488
|
+
portalOwnerRenderIdsByElement.delete(portalRoot);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
syncPortalVisibility(portalRoot);
|
|
492
|
+
}
|
|
493
|
+
function releaseStoryboardPortals(renderId) {
|
|
494
|
+
const portals = portalElementsByRenderId.get(renderId);
|
|
495
|
+
if (!portals) {
|
|
496
|
+
renderStatusById.delete(renderId);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
for (const portalRoot of [...portals]) {
|
|
500
|
+
untrackPortal(renderId, portalRoot);
|
|
501
|
+
}
|
|
502
|
+
renderStatusById.delete(renderId);
|
|
503
|
+
}
|
|
504
|
+
function getStoryboardPortalSelectors(renderId) {
|
|
505
|
+
const portals = portalElementsByRenderId.get(renderId);
|
|
506
|
+
if (!portals) return [];
|
|
507
|
+
return [...portals].filter((portalRoot) => portalRoot.isConnected).map(buildProjectionPortalSelector);
|
|
508
|
+
}
|
|
509
|
+
function syncStoryboardPortals(renderId, status) {
|
|
510
|
+
renderStatusById.set(renderId, status);
|
|
511
|
+
const portals = portalElementsByRenderId.get(renderId);
|
|
512
|
+
if (!portals) return;
|
|
513
|
+
for (const portalRoot of portals) {
|
|
514
|
+
syncPortalVisibility(portalRoot);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
function trackStoryboardPortals(renderId, element, status) {
|
|
518
|
+
syncStoryboardPortals(renderId, status);
|
|
519
|
+
const unregister = getPortalTracker().register({
|
|
520
|
+
element,
|
|
521
|
+
onPortalFound(portalRoot) {
|
|
522
|
+
trackPortal(renderId, portalRoot);
|
|
523
|
+
},
|
|
524
|
+
onPortalRemoved(portalRoot) {
|
|
525
|
+
untrackPortal(renderId, portalRoot);
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
return () => {
|
|
529
|
+
unregister();
|
|
530
|
+
releaseStoryboardPortals(renderId);
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// canvas/render-error-recovery.ts
|
|
535
|
+
import { useCallback as useCallback2, useEffect, useRef } from "react";
|
|
536
|
+
var renderErrorRetryBaseDelayMs = 1e3;
|
|
537
|
+
var renderErrorRetryMaxDelayMs = 8e3;
|
|
538
|
+
var BEAT_BUS_KEY = "__tempoRenderErrorRecoveryBeatBus";
|
|
539
|
+
function createBeatBus() {
|
|
540
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
541
|
+
return {
|
|
542
|
+
emit() {
|
|
543
|
+
for (const listener of [...listeners]) listener();
|
|
544
|
+
},
|
|
545
|
+
subscribe(listener) {
|
|
546
|
+
listeners.add(listener);
|
|
547
|
+
return () => listeners.delete(listener);
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
function getRenderErrorRecoveryBeatBus() {
|
|
552
|
+
const globals = globalThis;
|
|
553
|
+
return globals[BEAT_BUS_KEY] ?? (globals[BEAT_BUS_KEY] = createBeatBus());
|
|
554
|
+
}
|
|
555
|
+
function useRenderErrorRecovery(retryNow) {
|
|
556
|
+
const retryNowRef = useRef(retryNow);
|
|
557
|
+
retryNowRef.current = retryNow;
|
|
558
|
+
const timerRef = useRef(null);
|
|
559
|
+
const nextDelayRef = useRef(renderErrorRetryBaseDelayMs);
|
|
560
|
+
const erroredRef = useRef(false);
|
|
561
|
+
const clearTimer = useCallback2(() => {
|
|
562
|
+
if (timerRef.current === null) return;
|
|
563
|
+
clearTimeout(timerRef.current);
|
|
564
|
+
timerRef.current = null;
|
|
565
|
+
}, []);
|
|
566
|
+
const noteRenderError = useCallback2(() => {
|
|
567
|
+
erroredRef.current = true;
|
|
568
|
+
if (timerRef.current !== null) return;
|
|
569
|
+
const delay = nextDelayRef.current;
|
|
570
|
+
nextDelayRef.current = Math.min(delay * 2, renderErrorRetryMaxDelayMs);
|
|
571
|
+
timerRef.current = setTimeout(() => {
|
|
572
|
+
timerRef.current = null;
|
|
573
|
+
retryNowRef.current();
|
|
574
|
+
}, delay);
|
|
575
|
+
}, []);
|
|
576
|
+
const noteRecovered = useCallback2(() => {
|
|
577
|
+
erroredRef.current = false;
|
|
578
|
+
nextDelayRef.current = renderErrorRetryBaseDelayMs;
|
|
579
|
+
clearTimer();
|
|
580
|
+
}, [clearTimer]);
|
|
581
|
+
useEffect(() => {
|
|
582
|
+
const onBeat = () => {
|
|
583
|
+
nextDelayRef.current = renderErrorRetryBaseDelayMs;
|
|
584
|
+
if (!erroredRef.current) return;
|
|
585
|
+
clearTimer();
|
|
586
|
+
retryNowRef.current();
|
|
587
|
+
};
|
|
588
|
+
const unsubscribe = getRenderErrorRecoveryBeatBus().subscribe(onBeat);
|
|
589
|
+
return () => {
|
|
590
|
+
unsubscribe();
|
|
591
|
+
clearTimer();
|
|
592
|
+
};
|
|
593
|
+
}, [clearTimer]);
|
|
594
|
+
return { noteRenderError, noteRecovered };
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// canvas/storyboard.tsx
|
|
598
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
599
|
+
function Storyboard({
|
|
600
|
+
id,
|
|
601
|
+
name,
|
|
602
|
+
component,
|
|
603
|
+
layout,
|
|
604
|
+
props
|
|
605
|
+
}) {
|
|
606
|
+
const Component2 = component;
|
|
607
|
+
return /* @__PURE__ */ jsx3(StoryboardSlot, { id, name, layout, kind: "component", children: /* @__PURE__ */ jsx3(Component2, { ...props ?? {} }) });
|
|
608
|
+
}
|
|
609
|
+
function LegacyStoryboardV1({
|
|
610
|
+
id,
|
|
611
|
+
storyboard
|
|
612
|
+
}) {
|
|
613
|
+
return /* @__PURE__ */ jsx3(
|
|
614
|
+
StoryboardSlot,
|
|
615
|
+
{
|
|
616
|
+
id,
|
|
617
|
+
name: storyboard.name,
|
|
618
|
+
layout: storyboard.layout,
|
|
619
|
+
kind: "component",
|
|
620
|
+
children: /* @__PURE__ */ jsx3(LegacyStoryboardV1Render, { render: storyboard.render })
|
|
621
|
+
}
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
function LegacyStoryboardV1Render({
|
|
625
|
+
render
|
|
626
|
+
}) {
|
|
627
|
+
return /* @__PURE__ */ jsx3(Fragment, { children: render() });
|
|
628
|
+
}
|
|
629
|
+
function RouteStoryboard({
|
|
630
|
+
id,
|
|
631
|
+
name,
|
|
632
|
+
route,
|
|
633
|
+
layout
|
|
634
|
+
}) {
|
|
635
|
+
return /* @__PURE__ */ jsx3(
|
|
636
|
+
StoryboardSlot,
|
|
637
|
+
{
|
|
638
|
+
id,
|
|
639
|
+
name,
|
|
640
|
+
layout,
|
|
641
|
+
kind: "route",
|
|
642
|
+
route
|
|
643
|
+
}
|
|
644
|
+
);
|
|
645
|
+
}
|
|
646
|
+
function HtmlStoryboard({
|
|
647
|
+
id,
|
|
648
|
+
name,
|
|
649
|
+
filepath,
|
|
650
|
+
src,
|
|
651
|
+
layout
|
|
652
|
+
}) {
|
|
653
|
+
return /* @__PURE__ */ jsx3(
|
|
654
|
+
StoryboardSlot,
|
|
655
|
+
{
|
|
656
|
+
id,
|
|
657
|
+
name,
|
|
658
|
+
layout,
|
|
659
|
+
kind: "html",
|
|
660
|
+
filepath,
|
|
661
|
+
src
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
function StoryboardSlot({
|
|
666
|
+
children,
|
|
667
|
+
id,
|
|
668
|
+
kind,
|
|
669
|
+
layout,
|
|
670
|
+
name,
|
|
671
|
+
route,
|
|
672
|
+
filepath,
|
|
673
|
+
src
|
|
674
|
+
}) {
|
|
675
|
+
const renderId = useCanvasStoryboardRenderId(id);
|
|
676
|
+
const canvas = useCanvasIdentity();
|
|
677
|
+
const status = useStoryboardStatus(id);
|
|
678
|
+
const renderSize = useStoryboardSize(id);
|
|
679
|
+
const placement = useStoryboardPlacement(id);
|
|
680
|
+
const markRendered = useStoryboardRendered(id);
|
|
681
|
+
const markUnmounted = useStoryboardUnmounted(id);
|
|
682
|
+
const { reportError, clearError } = useStoryboardErrorReporter(id);
|
|
683
|
+
const renderWidth = renderSize?.width;
|
|
684
|
+
const renderHeight = renderSize?.height;
|
|
685
|
+
const renderRevision = renderSize?.revision ?? 0;
|
|
686
|
+
const intrinsicSize = renderSize?.intrinsicSize ?? (kind === "component" && layout.intrinsicSizing === "root-element");
|
|
687
|
+
const resetKey = `${renderId}:${renderRevision}`;
|
|
688
|
+
const contentRef = useRef2(null);
|
|
689
|
+
const [admittedRenderId, setAdmittedRenderId] = useState(
|
|
690
|
+
typeof document === "undefined" ? renderId : null
|
|
691
|
+
);
|
|
692
|
+
const admitted = admittedRenderId === renderId;
|
|
693
|
+
const errorBoundaryRef = useRef2(null);
|
|
694
|
+
const lastReportedCommitRef = useRef2(null);
|
|
695
|
+
const previousChildrenRef = useRef2(children);
|
|
696
|
+
const [recoveryRevision, setRecoveryRevision] = useState(0);
|
|
697
|
+
const commitKey = `${resetKey}:${recoveryRevision}`;
|
|
698
|
+
const retryRenderNow = useCallback3(() => {
|
|
699
|
+
if (!errorBoundaryRef.current?.retry()) return false;
|
|
700
|
+
setRecoveryRevision((revision) => revision + 1);
|
|
701
|
+
return true;
|
|
702
|
+
}, []);
|
|
703
|
+
const { noteRenderError, noteRecovered } = useRenderErrorRecovery(retryRenderNow);
|
|
704
|
+
const handleRenderError = useCallback3(
|
|
705
|
+
(error) => {
|
|
706
|
+
noteRenderError();
|
|
707
|
+
reportError(error);
|
|
708
|
+
},
|
|
709
|
+
[noteRenderError, reportError]
|
|
710
|
+
);
|
|
711
|
+
const pendingRenderedReportRef = useRef2(
|
|
712
|
+
null
|
|
713
|
+
);
|
|
714
|
+
const handleRendered = useCallback3(
|
|
715
|
+
(reportedCommitKey) => {
|
|
716
|
+
if (pendingRenderedReportRef.current !== null) {
|
|
717
|
+
clearTimeout(pendingRenderedReportRef.current);
|
|
718
|
+
}
|
|
719
|
+
pendingRenderedReportRef.current = setTimeout(() => {
|
|
720
|
+
pendingRenderedReportRef.current = null;
|
|
721
|
+
if (errorBoundaryRef.current?.hasError()) return;
|
|
722
|
+
noteRecovered();
|
|
723
|
+
if (lastReportedCommitRef.current === reportedCommitKey) return;
|
|
724
|
+
lastReportedCommitRef.current = reportedCommitKey;
|
|
725
|
+
clearError();
|
|
726
|
+
markRendered();
|
|
727
|
+
}, 0);
|
|
728
|
+
},
|
|
729
|
+
[clearError, markRendered, noteRecovered]
|
|
730
|
+
);
|
|
731
|
+
useEffect2(
|
|
732
|
+
() => () => {
|
|
733
|
+
if (pendingRenderedReportRef.current !== null) {
|
|
734
|
+
clearTimeout(pendingRenderedReportRef.current);
|
|
735
|
+
pendingRenderedReportRef.current = null;
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
[]
|
|
739
|
+
);
|
|
740
|
+
const renderChildren = useMemo2(() => {
|
|
741
|
+
if (isValidElement2(children)) return cloneElement2(children);
|
|
742
|
+
return Children2.map(
|
|
743
|
+
children,
|
|
744
|
+
(child) => isValidElement2(child) ? cloneElement2(child) : child
|
|
745
|
+
);
|
|
746
|
+
}, [children]);
|
|
747
|
+
useEffect2(() => markUnmounted, [markUnmounted]);
|
|
748
|
+
useEffect2(() => {
|
|
749
|
+
setAdmittedRenderId(renderId);
|
|
750
|
+
}, [renderId]);
|
|
751
|
+
useEffect2(() => {
|
|
752
|
+
const childrenChanged = previousChildrenRef.current !== children;
|
|
753
|
+
previousChildrenRef.current = children;
|
|
754
|
+
if (childrenChanged) retryRenderNow();
|
|
755
|
+
}, [children, retryRenderNow]);
|
|
756
|
+
useEffect2(() => {
|
|
757
|
+
if (!contentRef.current || status === "unmounted") return;
|
|
758
|
+
return trackStoryboardPortals(renderId, contentRef.current, status);
|
|
759
|
+
}, [renderId, status]);
|
|
760
|
+
useEffect2(() => {
|
|
761
|
+
if (status === "unmounted") return;
|
|
762
|
+
syncStoryboardPortals(renderId, status);
|
|
763
|
+
}, [renderId, status]);
|
|
764
|
+
if (status === "unmounted") return null;
|
|
765
|
+
return /* @__PURE__ */ jsx3(
|
|
766
|
+
"div",
|
|
767
|
+
{
|
|
768
|
+
"data-render-id": renderId,
|
|
769
|
+
"data-render-status": status,
|
|
770
|
+
"data-tempo-storyboard-render-id": renderId,
|
|
771
|
+
"data-tempo-storyboard-id": id,
|
|
772
|
+
"data-tempo-canvas-path": canvas?.path,
|
|
773
|
+
"data-tempo-storyboard-name": name,
|
|
774
|
+
"data-tempo-storyboard-kind": kind,
|
|
775
|
+
"data-tempo-storyboard-route": route,
|
|
776
|
+
"data-tempo-storyboard-filepath": filepath,
|
|
777
|
+
"data-tempo-storyboard-src": src,
|
|
778
|
+
style: {
|
|
779
|
+
position: "absolute",
|
|
780
|
+
left: placement?.left ?? layout.x,
|
|
781
|
+
top: placement?.top ?? layout.y,
|
|
782
|
+
width: intrinsicSize ? "max-content" : renderWidth ?? layout.width,
|
|
783
|
+
height: intrinsicSize ? "max-content" : renderHeight ?? layout.height,
|
|
784
|
+
minWidth: intrinsicSize ? renderWidth : void 0,
|
|
785
|
+
minHeight: intrinsicSize ? renderHeight : void 0,
|
|
786
|
+
zIndex: layout.zIndex,
|
|
787
|
+
visibility: status === "active" ? "visible" : "hidden",
|
|
788
|
+
pointerEvents: status === "active" ? "auto" : "none"
|
|
789
|
+
},
|
|
790
|
+
children: /* @__PURE__ */ jsx3(
|
|
791
|
+
"div",
|
|
792
|
+
{
|
|
793
|
+
"data-render-content": renderId,
|
|
794
|
+
"data-render-admitted": admitted ? "true" : void 0,
|
|
795
|
+
"data-tempo-render-mode": kind === "html" ? "static-dom" : void 0,
|
|
796
|
+
"data-tempo-hide-fiber": "true",
|
|
797
|
+
ref: contentRef,
|
|
798
|
+
style: { width: "100%", height: "100%" },
|
|
799
|
+
children: /* @__PURE__ */ jsx3(
|
|
800
|
+
StoryboardErrorBoundary,
|
|
801
|
+
{
|
|
802
|
+
ref: errorBoundaryRef,
|
|
803
|
+
onError: handleRenderError,
|
|
804
|
+
resetKey,
|
|
805
|
+
children: admitted ? /* @__PURE__ */ jsxs(Suspense, { fallback: /* @__PURE__ */ jsx3(CanvasPendingMarker, {}), children: [
|
|
806
|
+
/* @__PURE__ */ jsx3(StoryboardAdmission, { children: renderChildren }),
|
|
807
|
+
/* @__PURE__ */ jsx3(
|
|
808
|
+
StoryboardCommitSignal,
|
|
809
|
+
{
|
|
810
|
+
commitKey,
|
|
811
|
+
onCommit: handleRendered
|
|
812
|
+
},
|
|
813
|
+
commitKey
|
|
814
|
+
)
|
|
815
|
+
] }) : null
|
|
816
|
+
}
|
|
817
|
+
)
|
|
818
|
+
}
|
|
819
|
+
)
|
|
820
|
+
}
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
function StoryboardAdmission({ children }) {
|
|
824
|
+
beginAdmissionWindow();
|
|
825
|
+
return children;
|
|
826
|
+
}
|
|
827
|
+
function StoryboardCommitSignal({
|
|
828
|
+
commitKey,
|
|
829
|
+
onCommit
|
|
830
|
+
}) {
|
|
831
|
+
const onCommitRef = useRef2(onCommit);
|
|
832
|
+
onCommitRef.current = onCommit;
|
|
833
|
+
useLayoutEffect(() => onCommitRef.current(commitKey), [commitKey]);
|
|
834
|
+
return null;
|
|
835
|
+
}
|
|
836
|
+
var maxReportedComponentStackFrames = 40;
|
|
837
|
+
function boundComponentStack(componentStack) {
|
|
838
|
+
if (!componentStack) return void 0;
|
|
839
|
+
const frames = componentStack.split("\n");
|
|
840
|
+
if (frames.length <= maxReportedComponentStackFrames) return componentStack;
|
|
841
|
+
const dropped = frames.length - maxReportedComponentStackFrames;
|
|
842
|
+
return [
|
|
843
|
+
...frames.slice(0, maxReportedComponentStackFrames),
|
|
844
|
+
` ... ${dropped} more frames`
|
|
845
|
+
].join("\n");
|
|
846
|
+
}
|
|
847
|
+
var StoryboardErrorBoundary = class extends Component {
|
|
848
|
+
constructor() {
|
|
849
|
+
super(...arguments);
|
|
850
|
+
this.state = {
|
|
851
|
+
error: null,
|
|
852
|
+
componentStack: void 0,
|
|
853
|
+
resetKey: this.props.resetKey
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
static getDerivedStateFromError(error) {
|
|
857
|
+
return { error };
|
|
858
|
+
}
|
|
859
|
+
static getDerivedStateFromProps(props, state) {
|
|
860
|
+
if (props.resetKey !== state.resetKey) {
|
|
861
|
+
return {
|
|
862
|
+
error: null,
|
|
863
|
+
componentStack: void 0,
|
|
864
|
+
resetKey: props.resetKey
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
return null;
|
|
868
|
+
}
|
|
869
|
+
componentDidCatch(error, info) {
|
|
870
|
+
const componentStack = boundComponentStack(info.componentStack);
|
|
871
|
+
this.setState({ componentStack });
|
|
872
|
+
this.props.onError({
|
|
873
|
+
message: error.message,
|
|
874
|
+
stack: error.stack,
|
|
875
|
+
componentStack
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
hasError() {
|
|
879
|
+
return this.state.error !== null;
|
|
880
|
+
}
|
|
881
|
+
retry() {
|
|
882
|
+
if (!this.state.error) return false;
|
|
883
|
+
this.setState(
|
|
884
|
+
(state) => state.error ? { error: null, componentStack: void 0, resetKey: state.resetKey } : null
|
|
885
|
+
);
|
|
886
|
+
return true;
|
|
887
|
+
}
|
|
888
|
+
render() {
|
|
889
|
+
if (this.state.error) {
|
|
890
|
+
return /* @__PURE__ */ jsx3(
|
|
891
|
+
"div",
|
|
892
|
+
{
|
|
893
|
+
"data-render-error": "true",
|
|
894
|
+
"data-render-error-message": this.state.error.message,
|
|
895
|
+
style: { width: "100%", height: "100%" }
|
|
896
|
+
}
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
return this.props.children;
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
|
|
903
|
+
export {
|
|
904
|
+
normalizeId,
|
|
905
|
+
getCanvasStoryboardRenderId,
|
|
906
|
+
Canvas,
|
|
907
|
+
CanvasContext,
|
|
908
|
+
CanvasPendingMarker,
|
|
909
|
+
CanvasHostContext,
|
|
910
|
+
useRequiredCanvasHost,
|
|
911
|
+
useActiveState,
|
|
912
|
+
getStoryboardPortalSelectors,
|
|
913
|
+
Storyboard,
|
|
914
|
+
LegacyStoryboardV1,
|
|
915
|
+
RouteStoryboard,
|
|
916
|
+
HtmlStoryboard,
|
|
917
|
+
StoryboardSlot
|
|
918
|
+
};
|
|
919
|
+
//# sourceMappingURL=chunk-DXKG4IGS.js.map
|