tempo-sdk 0.0.40 → 0.0.42
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/index.js +29 -14
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +1 -1
- package/dist/canvas/svelte.js +1 -1
- package/dist/{chunk-IGFW4HE7.js → chunk-5V3XLGJU.js} +2 -2
- package/dist/{chunk-IGFW4HE7.js.map → chunk-5V3XLGJU.js.map} +1 -1
- package/dist/{chunk-DXKG4IGS.js → chunk-L7OESAOE.js} +9 -1
- package/dist/chunk-L7OESAOE.js.map +1 -0
- package/dist/{chunk-ED5VHXXD.js → chunk-U52RN7MP.js} +18 -11
- package/dist/chunk-U52RN7MP.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs.cjs +1 -1
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/svelte.js +6 -1
- package/dist/svelte.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-DXKG4IGS.js.map +0 -1
- package/dist/chunk-ED5VHXXD.js.map +0 -1
package/dist/canvas/index.js
CHANGED
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
normalizeId,
|
|
14
14
|
useActiveState,
|
|
15
15
|
useRequiredCanvasHost
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-L7OESAOE.js";
|
|
17
17
|
import {
|
|
18
18
|
installTempoInteractProjectionSource
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-U52RN7MP.js";
|
|
20
20
|
import {
|
|
21
21
|
TEMPO_INTERACT_FRAME_NAME,
|
|
22
22
|
isTempoInteractFrameName
|
|
@@ -1484,7 +1484,7 @@ function setRuntimeWatchPaused(watch, paused, resumeOptions) {
|
|
|
1484
1484
|
}
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
|
-
function useCanvasHostPostMessage(registeredCanvasPaths = []) {
|
|
1487
|
+
function useCanvasHostPostMessage(registeredCanvasPaths = [], urlPinnedRenderId = null) {
|
|
1488
1488
|
const [renderEntriesById, setRenderEntriesById] = useState2(
|
|
1489
1489
|
() => /* @__PURE__ */ new Map()
|
|
1490
1490
|
);
|
|
@@ -1498,6 +1498,8 @@ function useCanvasHostPostMessage(registeredCanvasPaths = []) {
|
|
|
1498
1498
|
const watchRequestsRef = useRef2(watchRequestsById);
|
|
1499
1499
|
const registeredCanvasPathsRef = useRef2([]);
|
|
1500
1500
|
registeredCanvasPathsRef.current = registeredCanvasPaths;
|
|
1501
|
+
const urlPinnedRenderIdRef = useRef2(null);
|
|
1502
|
+
urlPinnedRenderIdRef.current = urlPinnedRenderId;
|
|
1501
1503
|
const maxCachedRef = useRef2(DEFAULT_MAX_CACHED_RENDERS);
|
|
1502
1504
|
const legacyHealthRef = useRef2(createLegacyHostHealth());
|
|
1503
1505
|
const renderedRenderIdsRef = useRef2(/* @__PURE__ */ new Set());
|
|
@@ -1559,7 +1561,8 @@ function useCanvasHostPostMessage(registeredCanvasPaths = []) {
|
|
|
1559
1561
|
const waitForRender = useCallback2(
|
|
1560
1562
|
(request) => {
|
|
1561
1563
|
const current = renderEntriesRef.current.get(request.renderId);
|
|
1562
|
-
const
|
|
1564
|
+
const rendered = renderedRenderIdsRef.current.has(request.renderId);
|
|
1565
|
+
const alreadyRendered = rendered && (urlPinnedRenderIdRef.current === request.renderId || current?.status === "active" && renderRequestMatchesEntry(current, request));
|
|
1563
1566
|
setEntries((entries) => acquireRender(entries, request));
|
|
1564
1567
|
if (alreadyRendered) {
|
|
1565
1568
|
return Promise.resolve();
|
|
@@ -2220,16 +2223,25 @@ function readDirectUrlDimension(value) {
|
|
|
2220
2223
|
}
|
|
2221
2224
|
return unit && unit !== "px" ? `${numberValue}${unit}` : numberValue;
|
|
2222
2225
|
}
|
|
2226
|
+
function readDirectUrlFlag(value) {
|
|
2227
|
+
if (value === null) return false;
|
|
2228
|
+
const normalized = value.trim().toLowerCase();
|
|
2229
|
+
return normalized !== "0" && normalized !== "false";
|
|
2230
|
+
}
|
|
2223
2231
|
function readDirectUrlSize(params) {
|
|
2224
2232
|
const width = params.get("width")?.trim();
|
|
2225
2233
|
const height = params.get("height")?.trim();
|
|
2226
|
-
|
|
2234
|
+
const intrinsicSize = readDirectUrlFlag(params.get("intrinsicSize"));
|
|
2235
|
+
if (!width && !height) {
|
|
2236
|
+
return intrinsicSize ? { intrinsicSize: true, revision: 1 } : void 0;
|
|
2237
|
+
}
|
|
2227
2238
|
if (!width || !height) {
|
|
2228
2239
|
throw new Error("Direct URL width and height must be provided together");
|
|
2229
2240
|
}
|
|
2230
2241
|
return {
|
|
2231
2242
|
width: readDirectUrlDimension(width),
|
|
2232
2243
|
height: readDirectUrlDimension(height),
|
|
2244
|
+
...intrinsicSize ? { intrinsicSize: true } : {},
|
|
2233
2245
|
revision: 1
|
|
2234
2246
|
};
|
|
2235
2247
|
}
|
|
@@ -2271,6 +2283,14 @@ function CanvasHost({
|
|
|
2271
2283
|
].filter(Boolean),
|
|
2272
2284
|
[canvasModules]
|
|
2273
2285
|
);
|
|
2286
|
+
const directUrlSearch = useSyncExternalStore(
|
|
2287
|
+
subscribeDirectUrlSearch,
|
|
2288
|
+
readDirectUrlSearch,
|
|
2289
|
+
() => ""
|
|
2290
|
+
);
|
|
2291
|
+
const directUrlRender = useMemo3(() => {
|
|
2292
|
+
return readDirectUrlRender();
|
|
2293
|
+
}, [directUrlSearch]);
|
|
2274
2294
|
const {
|
|
2275
2295
|
renderStatusById,
|
|
2276
2296
|
renderSizeById,
|
|
@@ -2281,19 +2301,14 @@ function CanvasHost({
|
|
|
2281
2301
|
reportCanvasImportError,
|
|
2282
2302
|
clearCanvasImportError,
|
|
2283
2303
|
registerCanvasProblemScope
|
|
2284
|
-
} = useCanvasHostPostMessage(
|
|
2304
|
+
} = useCanvasHostPostMessage(
|
|
2305
|
+
registeredCanvasPaths,
|
|
2306
|
+
directUrlRender?.renderId ?? null
|
|
2307
|
+
);
|
|
2285
2308
|
useEffect3(() => {
|
|
2286
2309
|
if (typeof document === "undefined") return;
|
|
2287
2310
|
return protectCanvasHostDocumentTitle(document);
|
|
2288
2311
|
}, []);
|
|
2289
|
-
const directUrlSearch = useSyncExternalStore(
|
|
2290
|
-
subscribeDirectUrlSearch,
|
|
2291
|
-
readDirectUrlSearch,
|
|
2292
|
-
() => ""
|
|
2293
|
-
);
|
|
2294
|
-
const directUrlRender = useMemo3(() => {
|
|
2295
|
-
return readDirectUrlRender();
|
|
2296
|
-
}, [directUrlSearch]);
|
|
2297
2312
|
const propActiveIds = useMemo3(
|
|
2298
2313
|
() => new Set(activeStoryboardIds ?? []),
|
|
2299
2314
|
[activeStoryboardIds]
|