@hyperframes/inspector 0.8.156 → 0.8.157

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.
@@ -10,16 +10,32 @@
10
10
  }
11
11
  return unknown();
12
12
  }
13
- function animationValues(vars, properties) {
14
- const startAt = vars.startAt && typeof vars.startAt === "object" ? vars.startAt : {};
13
+ var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
14
+ function declaredEase(ease) {
15
+ return typeof ease === "function" ? { kind: "expression", value: "custom function" } : declared(ease);
16
+ }
17
+ function animationValues(vars, properties, keyframesEase) {
18
+ const startAt = record(vars.startAt);
19
+ const endpoints = (property, end, start) => ({
20
+ property,
21
+ from: declared(vars.runBackwards ? end : start),
22
+ to: vars.runBackwards ? unknown() : declared(end)
23
+ });
24
+ const segment = declaredEase(vars.ease);
25
+ const whole = keyframesEase === void 0 ? void 0 : declaredEase(keyframesEase);
15
26
  return {
16
27
  basis: "authored-tween",
17
- properties: properties.map((property) => ({
18
- property,
19
- from: declared(vars.runBackwards ? vars[property] : startAt[property]),
20
- to: vars.runBackwards ? unknown() : declared(vars[property])
21
- })),
22
- ease: declared(vars.ease)
28
+ properties: properties.flatMap((property) => {
29
+ const nested = record(vars[property]);
30
+ const keys = property === "attr" || property === "css" ? Object.keys(nested) : [];
31
+ if (!keys.length) return [endpoints(property, vars[property], startAt[property])];
32
+ const nestedStart = record(startAt[property]);
33
+ return keys.map((key) => endpoints(`${property}.${key}`, nested[key], nestedStart[key]));
34
+ }),
35
+ ease: whole ? {
36
+ kind: "expression",
37
+ value: `${whole.value ?? "?"} across keyframes, ${segment.value ?? "?"} per segment`
38
+ } : segment
23
39
  };
24
40
  }
25
41
 
@@ -1610,7 +1626,8 @@
1610
1626
  const seen = /* @__PURE__ */ new Set();
1611
1627
  const resolver = createRuntimeStartTimeResolver({
1612
1628
  timelineRegistry: registry,
1613
- documentRef: scope.ownerDocument
1629
+ documentRef: scope.ownerDocument,
1630
+ includeAuthoredTimingAttrs: true
1614
1631
  });
1615
1632
  const rootElement = findRootCompositionElement(scope.ownerDocument);
1616
1633
  const clocks = /* @__PURE__ */ new Map();
@@ -1665,7 +1682,11 @@
1665
1682
  const properties = Object.keys(piece.vars ?? {}).filter(
1666
1683
  (k) => !reserved2.has(k) && !k.startsWith("on")
1667
1684
  );
1668
- const values = animationValues(piece.vars ?? {}, properties);
1685
+ const values = animationValues(
1686
+ piece.vars ?? {},
1687
+ properties,
1688
+ internal && a.vars?.keyframes ? a.vars.ease : void 0
1689
+ );
1669
1690
  const localIntervals = internal ? globalIntervals(
1670
1691
  a,
1671
1692
  clock,
@@ -1782,15 +1803,22 @@
1782
1803
  }
1783
1804
  return value2;
1784
1805
  };
1806
+ const ancestorId = (el) => {
1807
+ for (let parent = el.parentElement; parent; parent = parent.parentElement) {
1808
+ if (parent.id) return parent.id;
1809
+ }
1810
+ return "";
1811
+ };
1785
1812
  const describe = (el) => ({
1786
1813
  ref: ref(el),
1787
1814
  tag: el.tagName.toLowerCase(),
1788
1815
  id: el.id,
1789
1816
  hfId: el.getAttribute("data-hf-id"),
1790
1817
  classes: [...el.classList],
1791
- composition: el.closest("[data-composition-id]")?.getAttribute("data-composition-id") ?? null
1818
+ composition: el.closest("[data-composition-id]")?.getAttribute("data-composition-id") ?? null,
1819
+ withinId: ancestorId(el)
1792
1820
  });
1793
- function record(value2, stack) {
1821
+ function record2(value2, stack) {
1794
1822
  if (animation(value2) && !records.has(value2) && count < limit) {
1795
1823
  records.set(value2, stack);
1796
1824
  count++;
@@ -1816,8 +1844,8 @@
1816
1844
  if (name === "add" && animation(args[0])) attachments.set(args[0], stack);
1817
1845
  else if (before) {
1818
1846
  for (const child of self?.getChildren?.(false, true, true) ?? [])
1819
- if (!before.has(child)) record(child, stack);
1820
- } else record(result, stack);
1847
+ if (!before.has(child)) record2(child, stack);
1848
+ } else record2(result, stack);
1821
1849
  }
1822
1850
  return result;
1823
1851
  };