tempo-sdk 0.0.37 → 0.0.38
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 +1 -1
- package/dist/canvas/interact-projection.js +1 -1
- package/dist/{chunk-3CR4SX5W.js → chunk-FAO5QIJG.js} +93 -24
- package/dist/chunk-FAO5QIJG.js.map +1 -0
- package/dist/{chunk-WM3TPGAY.js → chunk-NWJ7UFYC.js} +2 -2
- package/dist/{chunk-WM3TPGAY.js.map → chunk-NWJ7UFYC.js.map} +1 -1
- 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/package.json +1 -1
- package/dist/chunk-3CR4SX5W.js.map +0 -1
package/dist/canvas/index.js
CHANGED
|
@@ -945,7 +945,9 @@ function buildProjectionCapturePerf(input) {
|
|
|
945
945
|
observedFileEntries: input.observedFileEntries ?? Object.keys(input.html?.declared.observedVersions ?? {}).length,
|
|
946
946
|
batchesEmitted: 1,
|
|
947
947
|
rootsPerBatch: input.rootsPerBatch,
|
|
948
|
-
fullSnapshotReason: input.fullSnapshotReason
|
|
948
|
+
fullSnapshotReason: input.fullSnapshotReason,
|
|
949
|
+
...input.triggerReasons === void 0 ? {} : { triggerReasons: input.triggerReasons },
|
|
950
|
+
...input.sourceViewportSamples === void 0 ? {} : { sourceViewportSamples: input.sourceViewportSamples }
|
|
949
951
|
};
|
|
950
952
|
}
|
|
951
953
|
|
|
@@ -3931,6 +3933,7 @@ function createProjectionOutbox(options) {
|
|
|
3931
3933
|
const full = /* @__PURE__ */ new Set();
|
|
3932
3934
|
let dirtyHead = false;
|
|
3933
3935
|
const dirtyHeadRoots = /* @__PURE__ */ new Set();
|
|
3936
|
+
const triggerReasons = /* @__PURE__ */ new Set();
|
|
3934
3937
|
let sessionId;
|
|
3935
3938
|
let sequence = 0;
|
|
3936
3939
|
let stopped = false;
|
|
@@ -3945,7 +3948,7 @@ function createProjectionOutbox(options) {
|
|
|
3945
3948
|
const assertActive = () => {
|
|
3946
3949
|
if (stopped) throw new Error("Projection producer has been stopped");
|
|
3947
3950
|
};
|
|
3948
|
-
const restore = (failedSession, rootIds, includeHeadForAllRoots, headRootIds) => {
|
|
3951
|
+
const restore = (failedSession, rootIds, includeHeadForAllRoots, headRootIds, failedTriggers) => {
|
|
3949
3952
|
if (stopped || sessionId !== failedSession) return;
|
|
3950
3953
|
for (const rootId of rootIds) {
|
|
3951
3954
|
if (!roots.has(rootId)) continue;
|
|
@@ -3958,6 +3961,8 @@ function createProjectionOutbox(options) {
|
|
|
3958
3961
|
if (roots.has(rootId)) dirtyHeadRoots.add(rootId);
|
|
3959
3962
|
}
|
|
3960
3963
|
}
|
|
3964
|
+
for (const trigger of failedTriggers) triggerReasons.add(trigger);
|
|
3965
|
+
triggerReasons.add("retry-after-error");
|
|
3961
3966
|
fixedWindow.schedule();
|
|
3962
3967
|
};
|
|
3963
3968
|
const flushOnce = (timing) => {
|
|
@@ -3968,16 +3973,19 @@ function createProjectionOutbox(options) {
|
|
|
3968
3973
|
const includeHeadForAllRoots = dirtyHead;
|
|
3969
3974
|
const headRootIds = includeHeadForAllRoots ? [] : [...dirtyHeadRoots];
|
|
3970
3975
|
const includeHead = includeHeadForAllRoots || headRootIds.length > 0;
|
|
3976
|
+
const currentTriggers = [...triggerReasons];
|
|
3971
3977
|
const context = {
|
|
3972
3978
|
...timing,
|
|
3973
3979
|
candidateRootCount: rootIds.length,
|
|
3974
3980
|
initialForSession: sequence === 0,
|
|
3975
|
-
fullRequested: false
|
|
3981
|
+
fullRequested: false,
|
|
3982
|
+
triggerReasons: currentTriggers
|
|
3976
3983
|
};
|
|
3977
3984
|
dirty.clear();
|
|
3978
3985
|
full.clear();
|
|
3979
3986
|
dirtyHead = false;
|
|
3980
3987
|
dirtyHeadRoots.clear();
|
|
3988
|
+
triggerReasons.clear();
|
|
3981
3989
|
try {
|
|
3982
3990
|
const changes = [];
|
|
3983
3991
|
for (const rootId of rootIds) {
|
|
@@ -4012,7 +4020,8 @@ function createProjectionOutbox(options) {
|
|
|
4012
4020
|
activeSession,
|
|
4013
4021
|
rootIds,
|
|
4014
4022
|
includeHeadForAllRoots,
|
|
4015
|
-
headRootIds
|
|
4023
|
+
headRootIds,
|
|
4024
|
+
currentTriggers
|
|
4016
4025
|
);
|
|
4017
4026
|
}
|
|
4018
4027
|
};
|
|
@@ -4032,7 +4041,9 @@ function createProjectionOutbox(options) {
|
|
|
4032
4041
|
dirty.clear();
|
|
4033
4042
|
full.clear();
|
|
4034
4043
|
dirtyHeadRoots.clear();
|
|
4044
|
+
triggerReasons.clear();
|
|
4035
4045
|
dirtyHead = true;
|
|
4046
|
+
triggerReasons.add("session-bind");
|
|
4036
4047
|
sessionId = nextSessionId;
|
|
4037
4048
|
sequence = 0;
|
|
4038
4049
|
for (const rootId of roots.keys()) {
|
|
@@ -4049,6 +4060,7 @@ function createProjectionOutbox(options) {
|
|
|
4049
4060
|
if (!sessionId) return;
|
|
4050
4061
|
dirty.add(rootId);
|
|
4051
4062
|
full.add(rootId);
|
|
4063
|
+
triggerReasons.add("root-added");
|
|
4052
4064
|
if (!dirtyHead) dirtyHeadRoots.add(rootId);
|
|
4053
4065
|
if (sequence === 0) fixedWindow.schedule();
|
|
4054
4066
|
else fixedWindow.flushNow();
|
|
@@ -4058,7 +4070,10 @@ function createProjectionOutbox(options) {
|
|
|
4058
4070
|
dirty.delete(rootId);
|
|
4059
4071
|
full.delete(rootId);
|
|
4060
4072
|
dirtyHeadRoots.delete(rootId);
|
|
4061
|
-
if (!hasWork())
|
|
4073
|
+
if (!hasWork()) {
|
|
4074
|
+
fixedWindow.cancel();
|
|
4075
|
+
triggerReasons.clear();
|
|
4076
|
+
}
|
|
4062
4077
|
},
|
|
4063
4078
|
record(activity) {
|
|
4064
4079
|
if (stopped || !sessionId) return;
|
|
@@ -4066,6 +4081,7 @@ function createProjectionOutbox(options) {
|
|
|
4066
4081
|
for (const rootId of activity.rootIds ?? []) {
|
|
4067
4082
|
if (roots.has(rootId)) dirty.add(rootId);
|
|
4068
4083
|
}
|
|
4084
|
+
triggerReasons.add(activity.trigger ?? "dom-mutation");
|
|
4069
4085
|
fixedWindow.schedule();
|
|
4070
4086
|
},
|
|
4071
4087
|
requestFull(rootId, options2) {
|
|
@@ -4073,6 +4089,7 @@ function createProjectionOutbox(options) {
|
|
|
4073
4089
|
if (!sessionId || !roots.has(rootId)) return;
|
|
4074
4090
|
dirty.add(rootId);
|
|
4075
4091
|
full.add(rootId);
|
|
4092
|
+
triggerReasons.add(options2?.trigger ?? "receiver-baseline");
|
|
4076
4093
|
if (options2?.includeHead && !dirtyHead) dirtyHeadRoots.add(rootId);
|
|
4077
4094
|
fixedWindow.flushNow();
|
|
4078
4095
|
},
|
|
@@ -4085,6 +4102,7 @@ function createProjectionOutbox(options) {
|
|
|
4085
4102
|
full.clear();
|
|
4086
4103
|
dirtyHeadRoots.clear();
|
|
4087
4104
|
dirtyHead = false;
|
|
4105
|
+
triggerReasons.clear();
|
|
4088
4106
|
sessionId = void 0;
|
|
4089
4107
|
}
|
|
4090
4108
|
};
|
|
@@ -4271,8 +4289,14 @@ var PortalTrackerImpl = class {
|
|
|
4271
4289
|
|
|
4272
4290
|
// ../../modules/iframe-projection/combined/projection-root-accumulator.ts
|
|
4273
4291
|
function createProjectionRootAccumulator(options) {
|
|
4274
|
-
const dom = watchDom(
|
|
4275
|
-
|
|
4292
|
+
const dom = watchDom(
|
|
4293
|
+
options.root,
|
|
4294
|
+
() => options.onChange("dom-mutation")
|
|
4295
|
+
);
|
|
4296
|
+
const state = watchState(
|
|
4297
|
+
options.root,
|
|
4298
|
+
() => options.onChange("state-event")
|
|
4299
|
+
);
|
|
4276
4300
|
const portals = /* @__PURE__ */ new Map();
|
|
4277
4301
|
const dirtyPortals = /* @__PURE__ */ new Set();
|
|
4278
4302
|
const removedPortals = /* @__PURE__ */ new Map();
|
|
@@ -4298,7 +4322,7 @@ function createProjectionRootAccumulator(options) {
|
|
|
4298
4322
|
const restyled = records.some((record) => record.type === "attributes");
|
|
4299
4323
|
if (!reparented && !restyled) return;
|
|
4300
4324
|
if (portals.size === 0) return;
|
|
4301
|
-
options.onChange();
|
|
4325
|
+
options.onChange("portal-coordinate-change");
|
|
4302
4326
|
});
|
|
4303
4327
|
function observeAncestors(chain) {
|
|
4304
4328
|
frameWatcher.disconnect();
|
|
@@ -4321,11 +4345,11 @@ function createProjectionRootAccumulator(options) {
|
|
|
4321
4345
|
if (stopped || portals.has(portal)) return;
|
|
4322
4346
|
const handle = watchPortal(portal, () => {
|
|
4323
4347
|
dirtyPortals.add(portal);
|
|
4324
|
-
options.onChange();
|
|
4348
|
+
options.onChange("portal-mutation");
|
|
4325
4349
|
});
|
|
4326
4350
|
portals.set(portal, handle);
|
|
4327
4351
|
dirtyPortals.add(portal);
|
|
4328
|
-
options.onChange();
|
|
4352
|
+
options.onChange("portal-mutation");
|
|
4329
4353
|
},
|
|
4330
4354
|
onPortalRemoved(portal) {
|
|
4331
4355
|
const handle = portals.get(portal);
|
|
@@ -4338,7 +4362,7 @@ function createProjectionRootAccumulator(options) {
|
|
|
4338
4362
|
portals.delete(portal);
|
|
4339
4363
|
sentPortalCoordinates.delete(portal);
|
|
4340
4364
|
handle.stop();
|
|
4341
|
-
options.onChange();
|
|
4365
|
+
options.onChange("portal-mutation");
|
|
4342
4366
|
}
|
|
4343
4367
|
});
|
|
4344
4368
|
return {
|
|
@@ -4485,8 +4509,31 @@ function createCombinedDocumentProducer(options) {
|
|
|
4485
4509
|
let rootLifecycleObserver = null;
|
|
4486
4510
|
let headPerfContext = null;
|
|
4487
4511
|
let headSnapshotMs = 0;
|
|
4512
|
+
const sourceWindow = options.document.defaultView;
|
|
4513
|
+
const pendingSourceViewportSamples = [];
|
|
4514
|
+
function recordSourceViewport() {
|
|
4515
|
+
if (!sourceWindow) return;
|
|
4516
|
+
const sample = {
|
|
4517
|
+
at: Date.now(),
|
|
4518
|
+
width: sourceWindow.innerWidth,
|
|
4519
|
+
height: sourceWindow.innerHeight,
|
|
4520
|
+
devicePixelRatio: sourceWindow.devicePixelRatio
|
|
4521
|
+
};
|
|
4522
|
+
const previous = pendingSourceViewportSamples.at(-1);
|
|
4523
|
+
if (previous?.width === sample.width && previous.height === sample.height && previous.devicePixelRatio === sample.devicePixelRatio) {
|
|
4524
|
+
return;
|
|
4525
|
+
}
|
|
4526
|
+
if (pendingSourceViewportSamples.length < 16) {
|
|
4527
|
+
pendingSourceViewportSamples.push(sample);
|
|
4528
|
+
} else {
|
|
4529
|
+
pendingSourceViewportSamples[15] = sample;
|
|
4530
|
+
}
|
|
4531
|
+
}
|
|
4532
|
+
recordSourceViewport();
|
|
4488
4533
|
const core = createProjectionOutbox({
|
|
4489
4534
|
emit(batch) {
|
|
4535
|
+
recordSourceViewport();
|
|
4536
|
+
const sourceViewportSamples = pendingSourceViewportSamples.splice(0);
|
|
4490
4537
|
const rootPerf = batch.roots.flatMap((change) => {
|
|
4491
4538
|
const payload = change.kind === "full" ? change.snapshot : change.kind === "patch" ? change.patch : change.problem;
|
|
4492
4539
|
return typeof payload === "object" && payload !== null ? [captureStats.get(payload)?.perf].filter(
|
|
@@ -4498,7 +4545,8 @@ function createCombinedDocumentProducer(options) {
|
|
|
4498
4545
|
batch.head,
|
|
4499
4546
|
headPerfContext,
|
|
4500
4547
|
headSnapshotMs,
|
|
4501
|
-
batch.roots.length
|
|
4548
|
+
batch.roots.length,
|
|
4549
|
+
sourceViewportSamples
|
|
4502
4550
|
);
|
|
4503
4551
|
headPerfContext = null;
|
|
4504
4552
|
headSnapshotMs = 0;
|
|
@@ -4730,6 +4778,7 @@ function createCombinedDocumentProducer(options) {
|
|
|
4730
4778
|
function recordReactCommit(commit) {
|
|
4731
4779
|
if (stopped) return;
|
|
4732
4780
|
const affectedRootIds = [];
|
|
4781
|
+
let retainedDomRecords = false;
|
|
4733
4782
|
for (const [rootId, runtime] of roots) {
|
|
4734
4783
|
if (runtime.dormant) continue;
|
|
4735
4784
|
const current = runtime.layerAdapter.resolveCommittedRoot(
|
|
@@ -4748,19 +4797,24 @@ function createCombinedDocumentProducer(options) {
|
|
|
4748
4797
|
runtime.committedFiber,
|
|
4749
4798
|
current
|
|
4750
4799
|
);
|
|
4751
|
-
runtime.accumulator?.takePendingDomRecords();
|
|
4800
|
+
retainedDomRecords = (runtime.accumulator?.takePendingDomRecords() ?? 0) > 0 || retainedDomRecords;
|
|
4752
4801
|
}
|
|
4753
4802
|
runtime.committedFiber = current;
|
|
4754
4803
|
affectedRootIds.push(rootId);
|
|
4755
4804
|
}
|
|
4756
|
-
if (affectedRootIds.length > 0)
|
|
4805
|
+
if (affectedRootIds.length > 0) {
|
|
4806
|
+
core.record({ rootIds: affectedRootIds, trigger: "react-commit" });
|
|
4807
|
+
if (retainedDomRecords) {
|
|
4808
|
+
core.record({ rootIds: affectedRootIds, trigger: "dom-mutation" });
|
|
4809
|
+
}
|
|
4810
|
+
}
|
|
4757
4811
|
}
|
|
4758
4812
|
function startRootObserver(rootId, runtime) {
|
|
4759
4813
|
const unregisterRootObserver = registerCaptureRootObserver();
|
|
4760
4814
|
try {
|
|
4761
4815
|
const accumulator = createProjectionRootAccumulator({
|
|
4762
4816
|
root: runtime.options.element,
|
|
4763
|
-
onChange() {
|
|
4817
|
+
onChange(trigger) {
|
|
4764
4818
|
if (!runtime.options.element.isConnected) {
|
|
4765
4819
|
makeRootDormant(runtime);
|
|
4766
4820
|
return;
|
|
@@ -4771,16 +4825,16 @@ function createCombinedDocumentProducer(options) {
|
|
|
4771
4825
|
if (renderError) {
|
|
4772
4826
|
if (runtime.renderError === null) {
|
|
4773
4827
|
runtime.renderError = renderError;
|
|
4774
|
-
core.requestFull(rootId);
|
|
4828
|
+
core.requestFull(rootId, { trigger: "render-problem" });
|
|
4775
4829
|
}
|
|
4776
4830
|
return;
|
|
4777
4831
|
}
|
|
4778
4832
|
if (runtime.renderError !== null) {
|
|
4779
4833
|
runtime.renderError = null;
|
|
4780
|
-
core.requestFull(rootId);
|
|
4834
|
+
core.requestFull(rootId, { trigger: "render-recovery" });
|
|
4781
4835
|
return;
|
|
4782
4836
|
}
|
|
4783
|
-
core.record({ rootIds: [rootId] });
|
|
4837
|
+
core.record({ rootIds: [rootId], trigger });
|
|
4784
4838
|
}
|
|
4785
4839
|
});
|
|
4786
4840
|
runtime.accumulator = accumulator;
|
|
@@ -4846,7 +4900,7 @@ function createCombinedDocumentProducer(options) {
|
|
|
4846
4900
|
roots.set(rootId, previous);
|
|
4847
4901
|
throw error;
|
|
4848
4902
|
}
|
|
4849
|
-
core.requestFull(rootId);
|
|
4903
|
+
core.requestFull(rootId, { trigger: "selector-rebind" });
|
|
4850
4904
|
return runtime;
|
|
4851
4905
|
}
|
|
4852
4906
|
function reconcileSelectorRoots() {
|
|
@@ -4907,6 +4961,7 @@ function createCombinedDocumentProducer(options) {
|
|
|
4907
4961
|
};
|
|
4908
4962
|
let stopHeadChanges = () => {
|
|
4909
4963
|
};
|
|
4964
|
+
sourceWindow?.addEventListener("resize", recordSourceViewport);
|
|
4910
4965
|
try {
|
|
4911
4966
|
stopReactCommits = reactHook.onCommit(recordReactCommit);
|
|
4912
4967
|
const headSubscription = getHeadTracker().subscribe(
|
|
@@ -4917,12 +4972,17 @@ function createCombinedDocumentProducer(options) {
|
|
|
4917
4972
|
for (const [rootId, runtime] of roots) {
|
|
4918
4973
|
if (runtime.accumulator?.hasPortals()) rootIds.push(rootId);
|
|
4919
4974
|
}
|
|
4920
|
-
core.record({
|
|
4975
|
+
core.record({
|
|
4976
|
+
head: true,
|
|
4977
|
+
rootIds,
|
|
4978
|
+
trigger: "head-mutation"
|
|
4979
|
+
});
|
|
4921
4980
|
}
|
|
4922
4981
|
);
|
|
4923
4982
|
stopHeadChanges = () => headSubscription.unsubscribe();
|
|
4924
4983
|
} catch (error) {
|
|
4925
4984
|
runCleanup(stopReactCommits);
|
|
4985
|
+
sourceWindow?.removeEventListener("resize", recordSourceViewport);
|
|
4926
4986
|
core.stop();
|
|
4927
4987
|
throw error;
|
|
4928
4988
|
}
|
|
@@ -4979,7 +5039,10 @@ function createCombinedDocumentProducer(options) {
|
|
|
4979
5039
|
}));
|
|
4980
5040
|
syncRootLifecycleObserver();
|
|
4981
5041
|
},
|
|
4982
|
-
requestFull: (rootId, requestOptions) => core.requestFull(rootId,
|
|
5042
|
+
requestFull: (rootId, requestOptions) => core.requestFull(rootId, {
|
|
5043
|
+
...requestOptions,
|
|
5044
|
+
trigger: "receiver-baseline"
|
|
5045
|
+
}),
|
|
4983
5046
|
captureSemanticSubtree(rootId, targetFiberId) {
|
|
4984
5047
|
if (stopped) throw new Error("Projection producer has been stopped");
|
|
4985
5048
|
const runtime = roots.get(rootId);
|
|
@@ -5021,6 +5084,7 @@ function createCombinedDocumentProducer(options) {
|
|
|
5021
5084
|
rootLifecycleObserver = null;
|
|
5022
5085
|
runCleanup(stopReactCommits);
|
|
5023
5086
|
runCleanup(stopHeadChanges);
|
|
5087
|
+
sourceWindow?.removeEventListener("resize", recordSourceViewport);
|
|
5024
5088
|
unregisterDocumentProducer();
|
|
5025
5089
|
roots.clear();
|
|
5026
5090
|
}
|
|
@@ -5267,6 +5331,7 @@ function makePerf(input) {
|
|
|
5267
5331
|
semanticDiscoveryNodesVisited: input.semanticDiscoveryNodesVisited ?? 0,
|
|
5268
5332
|
rootsPerBatch: input.flushContext.candidateRootCount,
|
|
5269
5333
|
fullSnapshotReason: input.fullReason,
|
|
5334
|
+
triggerReasons: input.flushContext.triggerReasons,
|
|
5270
5335
|
htmlChars: input.htmlChars,
|
|
5271
5336
|
domNodesSerialized: input.domNodes,
|
|
5272
5337
|
semanticNodesSerialized: input.semanticNodes,
|
|
@@ -5276,7 +5341,7 @@ function makePerf(input) {
|
|
|
5276
5341
|
observedFileEntries: input.observedFiles
|
|
5277
5342
|
});
|
|
5278
5343
|
}
|
|
5279
|
-
function aggregateBatchPerf(roots, head, context, capturedHeadMs, rootsPerBatch) {
|
|
5344
|
+
function aggregateBatchPerf(roots, head, context, capturedHeadMs, rootsPerBatch, sourceViewportSamples) {
|
|
5280
5345
|
if (roots.length === 0) {
|
|
5281
5346
|
if (!context) return void 0;
|
|
5282
5347
|
return buildProjectionCapturePerf({
|
|
@@ -5297,6 +5362,8 @@ function aggregateBatchPerf(roots, head, context, capturedHeadMs, rootsPerBatch)
|
|
|
5297
5362
|
candidateTargetsAfterCoalescing: 0,
|
|
5298
5363
|
rootsPerBatch: 0,
|
|
5299
5364
|
fullSnapshotReason: null,
|
|
5365
|
+
triggerReasons: context.triggerReasons,
|
|
5366
|
+
sourceViewportSamples,
|
|
5300
5367
|
domNodesSerialized: 0,
|
|
5301
5368
|
semanticNodesSerialized: 0,
|
|
5302
5369
|
annotationTargetsSerialized: 0,
|
|
@@ -5366,7 +5433,9 @@ function aggregateBatchPerf(roots, head, context, capturedHeadMs, rootsPerBatch)
|
|
|
5366
5433
|
observedFileEntries: sum((perf) => perf.observedFileEntries),
|
|
5367
5434
|
batchesEmitted: 1,
|
|
5368
5435
|
rootsPerBatch,
|
|
5369
|
-
fullSnapshotReason: reasons.size === 1 ? first.fullSnapshotReason : "mixed-full"
|
|
5436
|
+
fullSnapshotReason: reasons.size === 1 ? first.fullSnapshotReason : "mixed-full",
|
|
5437
|
+
triggerReasons: context?.triggerReasons ?? first.triggerReasons,
|
|
5438
|
+
sourceViewportSamples
|
|
5370
5439
|
};
|
|
5371
5440
|
}
|
|
5372
5441
|
|
|
@@ -6539,4 +6608,4 @@ function installTempoInteractProjectionSource() {
|
|
|
6539
6608
|
export {
|
|
6540
6609
|
installTempoInteractProjectionSource
|
|
6541
6610
|
};
|
|
6542
|
-
//# sourceMappingURL=chunk-
|
|
6611
|
+
//# sourceMappingURL=chunk-FAO5QIJG.js.map
|