tempo-sdk 0.0.22 → 0.0.24

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.
@@ -2012,6 +2012,22 @@ function projectionKindForTag(tag) {
2012
2012
  if (COMPONENT_TAGS.has(tag)) return "component";
2013
2013
  return null;
2014
2014
  }
2015
+ function ascendToAnnotatedComponentRoot(fiber) {
2016
+ let topmost = fiber;
2017
+ for (let parent = fiber.return; parent; parent = parent.return) {
2018
+ if (parent.tag === FiberTag.HostRoot || parent.tag === FiberTag.HostPortal) {
2019
+ break;
2020
+ }
2021
+ const kind = projectionKindForTag(parent.tag);
2022
+ if (kind === "host") break;
2023
+ if (isTempoHiddenFiber(parent)) break;
2024
+ if (kind === "component") {
2025
+ if (projectionFiberSourceKey(parent) === null) break;
2026
+ topmost = parent;
2027
+ }
2028
+ }
2029
+ return topmost;
2030
+ }
2015
2031
  function isTempoHiddenFiber(fiber) {
2016
2032
  const props = getProps(fiber);
2017
2033
  const direct = props?.["data-tempo-hide-fiber"];
@@ -2027,7 +2043,7 @@ function captureProjectionLayerProps(fiber, element, sourceAnnotations = "fiber"
2027
2043
  if (authority === "source" && element && sourceAnnotations === "live-host") {
2028
2044
  return element.getAttribute(flatKey);
2029
2045
  }
2030
- return dataSet && Object.prototype.hasOwnProperty.call(dataSet, dataSetKey) ? dataSet[dataSetKey] : raw?.[flatKey];
2046
+ return dataSet && Object.hasOwn(dataSet, dataSetKey) ? dataSet[dataSetKey] : raw?.[flatKey];
2031
2047
  };
2032
2048
  const props = {};
2033
2049
  const putString = (flatKey, dataSetKey) => {
@@ -2526,7 +2542,9 @@ function captureProjectionFullSnapshot(options) {
2526
2542
  const fiberTarget = options.fiberTarget ?? options.root.firstElementChild;
2527
2543
  const serializer = options.layerSerializer ?? createProjectionLayerSerializer();
2528
2544
  const rawFiber = fiberTarget ? getFiberFromElement(fiberTarget) : null;
2529
- const layers = rawFiber ? serializer.serialize(resolveCommittedFiber(rawFiber)) : {
2545
+ const layers = rawFiber ? serializer.serialize(
2546
+ ascendToAnnotatedComponentRoot(resolveCommittedFiber(rawFiber))
2547
+ ) : {
2530
2548
  snapshot: {
2531
2549
  semantic: { kind: "dom-only" },
2532
2550
  observedFiles: {}
@@ -4031,8 +4049,9 @@ function resolveWatchedCommittedFiber(fiberRoot, options) {
4031
4049
  }
4032
4050
  const rawFiber = getFiberFromElement(target);
4033
4051
  if (!rawFiber) return null;
4034
- const committed = resolveCommittedFiberOrNull(rawFiber);
4035
- if (!committed) return null;
4052
+ const rawCommitted = resolveCommittedFiberOrNull(rawFiber);
4053
+ if (!rawCommitted) return null;
4054
+ const committed = ascendToAnnotatedComponentRoot(rawCommitted);
4036
4055
  if (!fiberRoot) return committed;
4037
4056
  let root = committed;
4038
4057
  while (root.return) root = root.return;