@mechane-ai/elements 0.67.0 → 0.68.0

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.
Files changed (77) hide show
  1. package/dist/ai.js +225 -224
  2. package/dist/{article-anMy8fA5.js → article-Ni152e-v.js} +104 -89
  3. package/dist/article.js +1 -1
  4. package/dist/catalog.json +71 -1
  5. package/dist/{categorical-values-Bh7ZkEQn.js → categorical-values-6Iz03F1i.js} +1 -1
  6. package/dist/{cells-X8SVrZBc.js → cells-BRI8LpMU.js} +1 -1
  7. package/dist/charts/cartesian.js +1 -1
  8. package/dist/charts/cells.js +1 -1
  9. package/dist/charts/comparison.js +1 -1
  10. package/dist/charts/distribution.js +1 -1
  11. package/dist/charts/figure.js +12 -12
  12. package/dist/charts/graph.js +1 -1
  13. package/dist/charts/hierarchy.js +1 -1
  14. package/dist/charts/image.js +1 -1
  15. package/dist/charts/matrix.js +2 -2
  16. package/dist/charts/plot.js +16 -15
  17. package/dist/charts/relationship.js +1 -1
  18. package/dist/charts/text.js +1 -1
  19. package/dist/charts/timeline.js +2 -2
  20. package/dist/charts/trend.js +1 -1
  21. package/dist/charts.js +3 -3
  22. package/dist/{color-legend-CIo7DhXB.js → color-legend-4As8881l.js} +1 -1
  23. package/dist/content/markdown.js +1 -1
  24. package/dist/{dumbbell-plot-BQDGe0sQ.js → dumbbell-plot-jaQvOctJ.js} +4 -4
  25. package/dist/{embedding-map-DmmknG7A.js → embedding-map-DnZL1kvY.js} +5 -5
  26. package/dist/figure-format-BVb7yFCA.js +46 -0
  27. package/dist/{figure-frame-DlyNTDzh.js → figure-frame-96zFqsWz.js} +1 -1
  28. package/dist/{image-grid-CxEAQvTf.js → image-grid-B6fdmE9c.js} +3 -3
  29. package/dist/kits/evaluation.js +5 -5
  30. package/dist/kits/interpretability.js +8 -8
  31. package/dist/kits/operations.js +4 -4
  32. package/dist/kits/research.js +641 -229
  33. package/dist/kits/training.js +4 -4
  34. package/dist/lesson.js +3 -3
  35. package/dist/markdown-JeuBeMDZ.js +293 -0
  36. package/dist/mdx.js +4 -4
  37. package/dist/packages/charts/src/plot/index.d.ts +2 -0
  38. package/dist/packages/charts/src/plot/plot-layout.d.ts +2 -2
  39. package/dist/packages/charts/src/plot/spatial-layer.d.ts +32 -0
  40. package/dist/packages/charts/src/plot/ticks.d.ts +2 -2
  41. package/dist/packages/foundations/src/visible-motion.d.ts +1 -1
  42. package/dist/packages/kits/src/research/index.d.ts +7 -0
  43. package/dist/packages/kits/src/research/motion-clip.d.ts +41 -0
  44. package/dist/packages/kits/src/research/motion-error.d.ts +8 -0
  45. package/dist/packages/kits/src/research/motion-figure.d.ts +9 -0
  46. package/dist/packages/kits/src/research/motion-frame.d.ts +22 -0
  47. package/dist/packages/kits/src/research/motion-scene.d.ts +22 -0
  48. package/dist/packages/teaching/src/article/uncover.d.ts +2 -0
  49. package/dist/{param-CKr8EYxF.js → param-Dk92C-K1.js} +1 -1
  50. package/dist/plot-CpTwLIYN.js +101 -0
  51. package/dist/{plot-layout-CVzSbcU7.js → plot-layout-1MG72ZWn.js} +151 -101
  52. package/dist/{plot-surface-CBhI1alw.js → plot-surface-8-FZI94y.js} +1 -1
  53. package/dist/{reference-lines-C970JwWZ.js → reference-lines-C18o1yEY.js} +1 -1
  54. package/dist/{scene-C3dCxckI.js → scene-B8dppj5V.js} +7 -7
  55. package/dist/scene.js +1 -1
  56. package/dist/{slope-chart-DekEJxsy.js → slope-chart-CELflRJd.js} +5 -5
  57. package/dist/styles2.css +12 -0
  58. package/dist/{time-series-BSNnijxf.js → time-series-DtAtGoT_.js} +6 -6
  59. package/dist/{timeline-CnxfYSIg.js → timeline-CzianQir.js} +4 -4
  60. package/dist/{token-heatmap-CJaXo56P.js → token-heatmap-m6oaMwkK.js} +273 -288
  61. package/dist/{token-predictions-Bi7aKPnh.js → token-predictions-CpGVjOIs.js} +4 -4
  62. package/dist/{transport-CXj0DV6o.js → transport-DQ1yzsQl.js} +2 -2
  63. package/dist/{tree-diagram-BxOZsjr1.js → tree-diagram-D9ekymCQ.js} +4 -4
  64. package/dist/{treemap-B2yOAetT.js → treemap-DT8q65LQ.js} +5 -5
  65. package/dist/{use-tween-C1TWJwce.js → use-tween-DbXVZBR8.js} +1 -1
  66. package/dist/{violin-plot-W2L_2JRo.js → violin-plot-83HSjnQM.js} +4 -4
  67. package/dist/visible-motion-D6NwjGNz.js +24 -0
  68. package/dist/{waterfall-Bt73N2Ng.js → waterfall-DmApvdrY.js} +4 -4
  69. package/package.json +1 -1
  70. package/recipes/recorded-motion.tsx +14 -0
  71. package/skills/review-elements/SKILL.md +4 -0
  72. package/skills/review-explainer/SKILL.md +4 -0
  73. package/skills/use-elements/SKILL.md +2 -0
  74. package/skills/use-elements/references/kits.md +23 -0
  75. package/skills/write-explainer/SKILL.md +5 -0
  76. package/dist/figure-format-B8kRZMlo.js +0 -36
  77. package/dist/markdown-Diffqqm7.js +0 -313
@@ -1,12 +1,12 @@
1
1
  import { n as e, t } from "./chart-link-AE_xuxiP.js";
2
2
  import { i as n, t as r } from "./tone-scope-DKiSw-JR.js";
3
- import { a as i, c as a, i as o, l as s, n as c, o as l, t as u } from "./transport-CXj0DV6o.js";
4
- import { d, f, n as p, t as m } from "./param-CKr8EYxF.js";
3
+ import { a as i, c as a, i as o, l as s, n as c, o as l, t as u } from "./transport-DQ1yzsQl.js";
4
+ import { d, f, n as p, t as m } from "./param-Dk92C-K1.js";
5
5
  import { i as h, r as g } from "./tokens.stylex-dF5CACEJ.js";
6
6
  import { E as _, m as v } from "./src-Bkov5TTa.js";
7
- import { C as y } from "./plot-layout-CVzSbcU7.js";
7
+ import { C as y } from "./plot-layout-1MG72ZWn.js";
8
8
  import { t as b } from "./accessibility-P89UG9-r.js";
9
- import { r as x } from "./figure-format-B8kRZMlo.js";
9
+ import { r as x } from "./figure-format-BVb7yFCA.js";
10
10
  import { t as S } from "./forms-iAOjGRTO.js";
11
11
  import { l as C, x as w } from "./src-DceyVyL0.js";
12
12
  import { t as T } from "./chart-tones-ei3BC2AL.js";
@@ -708,6 +708,24 @@ function Be(e, t) {
708
708
  function Ve(e, t) {
709
709
  return e.beats.flatMap((e) => e.states ?? []).find((e) => e.id === t)?.values;
710
710
  }
711
+ // packages/teaching/src/article/uncover.ts
712
+ var He = 8, Ue = /* @__PURE__ */ new Set(["auto", "scroll"]);
713
+ function We(e) {
714
+ let t = e.parentElement;
715
+ for (; t !== null;) {
716
+ if (Ue.has(getComputedStyle(t).overflowY) && t.scrollHeight > t.clientHeight) return t;
717
+ t = t.parentElement;
718
+ }
719
+ return document.scrollingElement;
720
+ }
721
+ function Ge(e, t) {
722
+ if (e.contains(t) || !e.checkVisibility()) return;
723
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = r.left < n.right && r.right > n.left, a = r.top < n.bottom && r.bottom > n.top;
724
+ i && a && We(t)?.scrollBy({
725
+ top: r.top - n.bottom - He,
726
+ behavior: "instant"
727
+ });
728
+ }
711
729
  // packages/teaching/src/article/walk.ts
712
730
  function* Y({ node: e, place: t, placeOf: n }) {
713
731
  if (Array.isArray(e)) for (let r of e) yield* Y({
@@ -736,11 +754,11 @@ function X(e, t) {
736
754
  return typeof n == "string" ? n : void 0;
737
755
  }
738
756
  // packages/teaching/src/article/scrolly.tsx
739
- var He = /* @__PURE__ */ new Set(["static", "sheet"]);
740
- function Ue({ children: e }) {
757
+ var Ke = /* @__PURE__ */ new Set(["static", "sheet"]);
758
+ function qe({ children: e }) {
741
759
  return e;
742
760
  }
743
- function We(e, t) {
761
+ function Je(e, t) {
744
762
  let n = [...Y({
745
763
  node: e,
746
764
  place: {
@@ -748,7 +766,7 @@ function We(e, t) {
748
766
  figure: null
749
767
  },
750
768
  placeOf: ({ place: e }) => e
751
- })].flatMap(({ element: e }) => e.type === Ue && O(e) ? [e.props] : []), r = n.find((e) => e.state !== void 0 && Ve(t, e.state) === void 0);
769
+ })].flatMap(({ element: e }) => e.type === qe && O(e) ? [e.props] : []), r = n.find((e) => e.state !== void 0 && Ve(t, e.state) === void 0);
752
770
  if (r !== void 0) return { error: `ScrollyStep "${r.id}" shows state "${r.state ?? ""}", which no beat declares.` };
753
771
  let i = n.map((e) => ({
754
772
  id: e.id,
@@ -757,26 +775,34 @@ function We(e, t) {
757
775
  })), a = i.map((e) => Be(t, e.values)).find((e) => e !== void 0);
758
776
  return a === void 0 ? { steps: i } : { error: a };
759
777
  }
760
- function Ge({ figure: e, children: t }) {
761
- let n = R(), { setMany: r } = a(), [i, o] = N(null), c = M(null), l = n === null ? { error: V("Scrolly") } : We(t, n.lesson), u = "steps" in l ? l.steps : [], d = "error" in l ? l.error : void 0, f = n?.view === "article", p = ue(), m = M({
762
- steps: u,
778
+ function Ye({ figure: e, children: t }) {
779
+ let n = R(), { setMany: r } = a(), [i, o] = N(null), c = M(null), l = M(null), u = n === null ? { error: V("Scrolly") } : Je(t, n.lesson), d = "steps" in u ? u.steps : [], f = "error" in u ? u.error : void 0, p = n?.view === "article", m = ue(), h = M({
780
+ steps: d,
763
781
  setMany: r,
764
782
  applied: ""
765
- }), h = u.map((e) => e.id).join("\n");
783
+ }), g = d.map((e) => e.id).join("\n");
766
784
  if (A(() => {
767
- m.current.steps = u, m.current.setMany = r;
785
+ h.current.steps = d, h.current.setMany = r;
768
786
  }), A(() => {
769
- let e = c.current;
770
- if (e === null || !f) return;
771
- let t = new IntersectionObserver((e) => {
772
- let t = e.find((e) => e.isIntersecting)?.target, n = t instanceof HTMLElement ? t.dataset.step : void 0, r = m.current.steps.find((e) => e.id === n);
773
- r !== void 0 && r.id !== m.current.applied && (m.current.applied = r.id, o(r.id), m.current.setMany(r.values, { reason: "scroll" }));
774
- }, { rootMargin: "-50% 0px -50% 0px" });
775
- for (let n of e.querySelectorAll("[data-step]")) t.observe(n);
776
- return () => t.disconnect();
777
- }, [f, h]), n === null || d !== void 0) return /* @__PURE__ */ I(z, { children: d ?? V("Scrolly") });
787
+ if (l.current === null || c.current === null || !p) return;
788
+ let e = l.current, t = c.current;
789
+ function n() {
790
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = ((r.left < n.right && r.right > n.left ? Math.max(0, r.bottom) : 0) + window.innerHeight) / 2;
791
+ if (n.top > i || n.bottom < i) return;
792
+ let a = Array.from(e.children).find((e) => e.getBoundingClientRect().bottom >= i), s = a instanceof HTMLElement ? a.dataset.step : void 0, c = h.current.steps.find((e) => e.id === s);
793
+ c !== void 0 && c.id !== h.current.applied && (h.current.applied = c.id, o(c.id), h.current.setMany(c.values, { reason: "scroll" }));
794
+ }
795
+ function r() {
796
+ let n = document.activeElement;
797
+ n !== null && e.contains(n) && Ge(t, n);
798
+ }
799
+ let i = new ResizeObserver(n);
800
+ return e.addEventListener("focusin", r), i.observe(e), i.observe(t), window.addEventListener("scroll", n, !0), window.addEventListener("resize", n), n(), () => {
801
+ i.disconnect(), e.removeEventListener("focusin", r), window.removeEventListener("scroll", n, !0), window.removeEventListener("resize", n);
802
+ };
803
+ }, [p, g]), n === null || f !== void 0) return /* @__PURE__ */ I(z, { children: f ?? V("Scrolly") });
778
804
  if (n.view === "present") {
779
- let t = n.outline.beats.find((e) => e.id === p?.id)?.scrollySteps.findIndex((e) => e.id === u[0]?.id) ?? 0, r = Math.min((p?.scrolly ?? 0) - t, u.length - 1), i = r < 0 ? void 0 : u[r]?.id;
805
+ let t = n.outline.beats.find((e) => e.id === m?.id)?.scrollySteps.findIndex((e) => e.id === d[0]?.id) ?? 0, r = Math.min((m?.scrolly ?? 0) - t, d.length - 1), i = r < 0 ? void 0 : d[r]?.id;
780
806
  return /* @__PURE__ */ I("div", {
781
807
  className: "x12h1iku x812sq7 x18xfj1p xtru72a x14z9mp x1kn4fvo",
782
808
  children: /* @__PURE__ */ L("div", {
@@ -789,7 +815,7 @@ function Ge({ figure: e, children: t }) {
789
815
  })
790
816
  }), /* @__PURE__ */ I("ol", {
791
817
  className: "xrvj5dj x1hnptsi x7sv70a xru1beq xgkxs2y xeuugli x1ghz6dp x1717udv xe8uvvx",
792
- children: u.map((e) => /* @__PURE__ */ I("li", {
818
+ children: d.map((e) => /* @__PURE__ */ I("li", {
793
819
  "data-step": e.id,
794
820
  "data-active": i === e.id ? "" : void 0,
795
821
  "aria-current": i === e.id ? "step" : void 0,
@@ -803,9 +829,9 @@ function Ge({ figure: e, children: t }) {
803
829
  })
804
830
  });
805
831
  }
806
- return He.has(n.view) ? /* @__PURE__ */ I("div", {
832
+ return Ke.has(n.view) ? /* @__PURE__ */ I("div", {
807
833
  className: "x12h1iku x812sq7 x18xfj1p xtru72a x14z9mp x1kn4fvo xrvj5dj xaml1ju",
808
- children: u.map((t, r) => /* @__PURE__ */ L("div", {
834
+ children: d.map((t, r) => /* @__PURE__ */ L("div", {
809
835
  className: "xrvj5dj xaml1ju",
810
836
  children: [/* @__PURE__ */ I("div", {
811
837
  className: "x1b5qhtu",
@@ -829,15 +855,16 @@ function Ge({ figure: e, children: t }) {
829
855
  children: /* @__PURE__ */ L("div", {
830
856
  className: "xrvj5dj x1mkdm3x xrz0ok8 x1i3977y x7a106z",
831
857
  children: [/* @__PURE__ */ I("div", {
832
- className: "x7wzq59 x8yoas0 x1vjfegm x1ms6mhf xru1beq xgkxs2y x1b6q7f1 xn9t2bk xpvm0e4",
858
+ ref: c,
859
+ className: "x7wzq59 x8yoas0 x1jkf3pl x1xm96vb x1odjw0f x9f619 x1vjfegm x1ms6mhf xru1beq xgkxs2y x1b6q7f1 xn9t2bk xpvm0e4",
833
860
  children: /* @__PURE__ */ I(K, {
834
861
  value: !0,
835
862
  children: e
836
863
  })
837
864
  }), /* @__PURE__ */ I("div", {
838
- ref: c,
865
+ ref: l,
839
866
  className: "x7sv70a xru1beq xgkxs2y xrvj5dj xxhr3t xeuugli",
840
- children: u.map((e, t) => /* @__PURE__ */ I("div", {
867
+ children: d.map((e, t) => /* @__PURE__ */ I("div", {
841
868
  "data-step": e.id,
842
869
  "data-active": i === e.id ? "" : void 0,
843
870
  ...{
@@ -856,7 +883,7 @@ function Ge({ figure: e, children: t }) {
856
883
  });
857
884
  }
858
885
  // packages/teaching/src/article/article-outline.ts
859
- var Z = "(scrolly figure)", Ke = /* @__PURE__ */ new Map([
886
+ var Z = "(scrolly figure)", Xe = /* @__PURE__ */ new Map([
860
887
  [m, "name"],
861
888
  [p, "name"],
862
889
  [i, "name"],
@@ -865,33 +892,33 @@ var Z = "(scrolly figure)", Ke = /* @__PURE__ */ new Map([
865
892
  [c, "name"],
866
893
  [u, "for"]
867
894
  ]);
868
- function qe({ element: e, place: t, prop: n }) {
895
+ function Ze({ element: e, place: t, prop: n }) {
869
896
  return e.type === we ? {
870
897
  beat: X(e, "id") ?? null,
871
898
  figure: null
872
899
  } : e.type === q ? {
873
900
  ...t,
874
901
  figure: X(e, "id") ?? null
875
- } : e.type === Ge && n === "figure" ? {
902
+ } : e.type === Ye && n === "figure" ? {
876
903
  ...t,
877
904
  figure: Z
878
905
  } : t;
879
906
  }
880
- function Je(e) {
881
- let t = Ke.get(e.type);
907
+ function Qe(e) {
908
+ let t = Xe.get(e.type);
882
909
  return t === void 0 ? void 0 : X(e, t);
883
910
  }
884
- function Ye(e) {
911
+ function $e(e) {
885
912
  return e.flatMap(({ element: e, place: t }) => e.type === q && O(e) ? [{
886
913
  id: e.props.id,
887
914
  beat: t.beat,
888
915
  hasDescription: e.props.description !== void 0,
889
916
  size: t.figure === Z ? "text" : e.props.size ?? "wide",
890
917
  node: e
891
- }] : e.type !== Ge || !O(e) || [...Y({
918
+ }] : e.type !== Ye || !O(e) || [...Y({
892
919
  node: e.props.figure,
893
920
  place: t,
894
- placeOf: qe
921
+ placeOf: Ze
895
922
  })].some((e) => e.element.type === q) ? [] : [{
896
923
  id: Z,
897
924
  beat: t.beat,
@@ -900,29 +927,29 @@ function Ye(e) {
900
927
  node: e.props.figure
901
928
  }]);
902
929
  }
903
- function Xe(e, t) {
930
+ function et(e, t) {
904
931
  return e.flatMap(({ element: e, place: n }) => {
905
932
  if (n.beat !== t) return [];
906
- let r = e.type === q && O(e) ? e.props.reads ?? [] : [], i = n.figure === null ? void 0 : Je(e);
933
+ let r = e.type === q && O(e) ? e.props.reads ?? [] : [], i = n.figure === null ? void 0 : Qe(e);
907
934
  return i === void 0 ? r : [...r, i];
908
935
  });
909
936
  }
910
- function Ze(e) {
937
+ function tt(e) {
911
938
  let t = [...Y({
912
939
  node: e,
913
940
  place: {
914
941
  beat: null,
915
942
  figure: null
916
943
  },
917
- placeOf: qe
918
- })], n = Ye(t), r = t.flatMap(({ element: e }) => e.type === we ? X(e, "id") ?? [] : []), i = t.flatMap(({ element: e }) => e.type === Se && O(e) ? e.props.items : []);
944
+ placeOf: Ze
945
+ })], n = $e(t), r = t.flatMap(({ element: e }) => e.type === we ? X(e, "id") ?? [] : []), i = t.flatMap(({ element: e }) => e.type === Se && O(e) ? e.props.items : []);
919
946
  return {
920
947
  beats: r.map((e) => ({
921
948
  id: e,
922
949
  figures: n.filter((t) => t.beat === e),
923
- figureNames: [...new Set(Xe(t, e))],
950
+ figureNames: [...new Set(et(t, e))],
924
951
  proseParams: [...new Set(t.flatMap(({ element: t, place: n }) => n.beat === e && n.figure === null && t.type === m ? X(t, "name") ?? [] : []))],
925
- scrollySteps: t.flatMap(({ element: t, place: n }) => n.beat === e && t.type === Ue && O(t) ? [{
952
+ scrollySteps: t.flatMap(({ element: t, place: n }) => n.beat === e && t.type === qe && O(t) ? [{
926
953
  id: t.props.id,
927
954
  values: t.props.values,
928
955
  state: t.props.state
@@ -957,29 +984,29 @@ function Ze(e) {
957
984
  })
958
985
  };
959
986
  }
960
- function Qe(e) {
987
+ function nt(e) {
961
988
  return Object.fromEntries(e.predictions.flatMap((e) => e.answerFrom === void 0 ? [] : [[e.id, e.answerFrom]]));
962
989
  }
963
990
  // packages/teaching/src/article/progress-store.ts
964
- var $e = {
991
+ var rt = {
965
992
  predictions: {},
966
993
  reached: [],
967
994
  hints: {},
968
995
  visited: []
969
- }, et = "n:", tt = "s:", nt = "p.", rt = "h.";
970
- function it(e) {
971
- return typeof e == "number" ? `${et}${e}` : `${tt}${e}`;
996
+ }, it = "n:", at = "s:", ot = "p.", st = "h.";
997
+ function ct(e) {
998
+ return typeof e == "number" ? `${it}${e}` : `${at}${e}`;
972
999
  }
973
- function at(e) {
974
- if (e?.startsWith(tt) === !0) return e.slice(2);
975
- let t = e?.startsWith(et) === !0 ? Number(e.slice(2)) : NaN;
1000
+ function lt(e) {
1001
+ if (e?.startsWith(at) === !0) return e.slice(2);
1002
+ let t = e?.startsWith(it) === !0 ? Number(e.slice(2)) : NaN;
976
1003
  return Number.isFinite(t) ? t : void 0;
977
1004
  }
978
- function ot(e) {
1005
+ function ut(e) {
979
1006
  return new URLSearchParams([
980
1007
  ...Object.entries(e.predictions).flatMap(([e, t]) => [
981
- [`p.${e}.v`, it(t.value)],
982
- [`p.${e}.a`, it(t.answer)],
1008
+ [`p.${e}.v`, ct(t.value)],
1009
+ [`p.${e}.a`, ct(t.answer)],
983
1010
  [`p.${e}.c`, String(t.isCorrect)]
984
1011
  ]),
985
1012
  ...e.reached.map((e) => ["r", e]),
@@ -987,9 +1014,9 @@ function ot(e) {
987
1014
  ...e.visited.map((e) => ["v", e])
988
1015
  ]).toString();
989
1016
  }
990
- function st(e) {
991
- let t = new URLSearchParams(e), n = [...t.keys()], r = [...new Set(n.filter((e) => e.startsWith(nt)).map((e) => e.slice(2, e.lastIndexOf("."))))].flatMap((e) => {
992
- let n = at(t.get(`p.${e}.v`)), r = at(t.get(`p.${e}.a`));
1017
+ function dt(e) {
1018
+ let t = new URLSearchParams(e), n = [...t.keys()], r = [...new Set(n.filter((e) => e.startsWith(ot)).map((e) => e.slice(2, e.lastIndexOf("."))))].flatMap((e) => {
1019
+ let n = lt(t.get(`p.${e}.v`)), r = lt(t.get(`p.${e}.a`));
993
1020
  return n === void 0 || r === void 0 ? [] : [[e, {
994
1021
  value: n,
995
1022
  answer: r,
@@ -997,7 +1024,7 @@ function st(e) {
997
1024
  }]];
998
1025
  }), i = n.flatMap((e) => {
999
1026
  let n = Number(t.get(e));
1000
- return e.startsWith(rt) && Number.isInteger(n) && n > 0 ? [[e.slice(2), n]] : [];
1027
+ return e.startsWith(st) && Number.isInteger(n) && n > 0 ? [[e.slice(2), n]] : [];
1001
1028
  });
1002
1029
  return {
1003
1030
  predictions: Object.fromEntries(r),
@@ -1006,7 +1033,7 @@ function st(e) {
1006
1033
  visited: [...new Set(t.getAll("v"))]
1007
1034
  };
1008
1035
  }
1009
- function ct(e, t) {
1036
+ function ft(e, t) {
1010
1037
  return {
1011
1038
  predictions: {
1012
1039
  ...t.predictions,
@@ -1020,14 +1047,14 @@ function ct(e, t) {
1020
1047
  visited: [.../* @__PURE__ */ new Set([...t.visited, ...e.visited])]
1021
1048
  };
1022
1049
  }
1023
- function lt(e) {
1050
+ function pt(e) {
1024
1051
  return {
1025
1052
  reason: e.reason,
1026
1053
  ...e.event !== void 0 && { event: e.event },
1027
1054
  ...e.source !== void 0 && { source: e.source }
1028
1055
  };
1029
1056
  }
1030
- var ut = oe({
1057
+ var mt = oe({
1031
1058
  name: "lesson-progress",
1032
1059
  options: {
1033
1060
  progress: "value",
@@ -1036,7 +1063,7 @@ var ut = oe({
1036
1063
  storageKey: "string"
1037
1064
  },
1038
1065
  controlled: ["progress"],
1039
- state: (e) => ({ progress: e.progress ?? e.defaultProgress ?? $e }),
1066
+ state: (e) => ({ progress: e.progress ?? e.defaultProgress ?? rt }),
1040
1067
  sync: (e) => e.progress === void 0 ? {} : { progress: e.progress },
1041
1068
  api: (e) => {
1042
1069
  let t = ie(e);
@@ -1044,7 +1071,7 @@ var ut = oe({
1044
1071
  return e.store.get().progress;
1045
1072
  }
1046
1073
  function r(e, n) {
1047
- return t("progress", e, lt(n));
1074
+ return t("progress", e, pt(n));
1048
1075
  }
1049
1076
  return {
1050
1077
  commit(e, t, i) {
@@ -1082,14 +1109,14 @@ var ut = oe({
1082
1109
  }, t);
1083
1110
  },
1084
1111
  reset(e) {
1085
- return r($e, e ?? { reason: "reset" });
1112
+ return r(rt, e ?? { reason: "reset" });
1086
1113
  },
1087
1114
  connect() {
1088
1115
  let { storageKey: t } = e.options();
1089
1116
  if (t === void 0) return () => void 0;
1090
- let i = ae(t), a = st(i.get() ?? "");
1091
- return ot(a) !== "" && r(ct(n(), a), { reason: "restore" }), e.store.subscribe(() => {
1092
- i.set(ot(n()));
1117
+ let i = ae(t), a = dt(i.get() ?? "");
1118
+ return ut(a) !== "" && r(ft(n(), a), { reason: "restore" }), e.store.subscribe(() => {
1119
+ i.set(ut(n()));
1093
1120
  });
1094
1121
  }
1095
1122
  };
@@ -1097,8 +1124,8 @@ var ut = oe({
1097
1124
  slots: (e) => ({ root: e({ bind: (e, t) => t.api.connect() }) }),
1098
1125
  agent: { actions: [] }
1099
1126
  });
1100
- function dt(e, t) {
1101
- let { onProgressChange: n } = e, r = te(ut, {
1127
+ function ht(e, t) {
1128
+ let { onProgressChange: n } = e, r = te(mt, {
1102
1129
  ...e,
1103
1130
  onProgressChange: (e, t) => {
1104
1131
  t.source === "agent" ? t.cancel() : n?.(e, t);
@@ -1107,22 +1134,10 @@ function dt(e, t) {
1107
1134
  return re(r.instance.subscribe, r.instance.get, r.instance.get), ee(r, "root", {}, t(r.state.progress, r.api), "article");
1108
1135
  }
1109
1136
  // packages/teaching/src/article/view-essay.tsx
1110
- var ft = "-33% 0px -62% 0px", pt = 8, mt = /* @__PURE__ */ new Set(["auto", "scroll"]);
1111
- function ht(e) {
1112
- let t = e.parentElement;
1113
- return t === null ? document.scrollingElement : mt.has(getComputedStyle(t).overflowY) && t.scrollHeight > t.clientHeight ? t : ht(t);
1114
- }
1115
- function gt(e, t) {
1116
- if (e.contains(t) || !e.checkVisibility()) return;
1117
- let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
1118
- r.top < n.bottom && r.bottom > n.top && ht(t)?.scrollBy({
1119
- top: r.top - n.bottom - pt,
1120
- behavior: "instant"
1121
- });
1122
- }
1137
+ var gt = "-33% 0px -62% 0px";
1123
1138
  function _t(e, t) {
1124
1139
  let n = location.hash === "" ? null : document.querySelector(`#${CSS.escape(decodeURIComponent(location.hash.slice(1)))}`);
1125
- n !== null && e.contains(n) && gt(t, n);
1140
+ n !== null && e.contains(n) && Ge(t, n);
1126
1141
  }
1127
1142
  function vt({ beats: e, current: t, isCompact: n, onPick: r }) {
1128
1143
  return /* @__PURE__ */ I("ol", {
@@ -1164,7 +1179,7 @@ function yt({ article: e, header: t, children: n }) {
1164
1179
  let n = new Set(e.lesson.beats.map((e) => e.id)), r = new IntersectionObserver((e) => {
1165
1180
  let t = e.find((e) => e.isIntersecting)?.target, r = t instanceof HTMLElement ? t.dataset.beat : void 0;
1166
1181
  r !== void 0 && n.has(r) && (c.current.scrolled = r, r !== c.current.beat && c.current.goTo(r, 0, { reason: "scroll" }));
1167
- }, { rootMargin: ft });
1182
+ }, { rootMargin: gt });
1168
1183
  for (let e of t.querySelectorAll("[data-beat]")) r.observe(e);
1169
1184
  return () => r.disconnect();
1170
1185
  }, [e.lesson]), A(() => {
@@ -1172,7 +1187,7 @@ function yt({ article: e, header: t, children: n }) {
1172
1187
  if (e === null || t === null) return;
1173
1188
  let n = new AbortController();
1174
1189
  return e.addEventListener("focusin", (e) => {
1175
- e.target instanceof Element && gt(t, e.target);
1190
+ e.target instanceof Element && Ge(t, e.target);
1176
1191
  }, { signal: n.signal }), globalThis.addEventListener("hashchange", () => _t(e, t), { signal: n.signal }), _t(e, t), () => n.abort();
1177
1192
  }, [e.hasContents]), e.hasContents ? /* @__PURE__ */ L("div", {
1178
1193
  ref: o,
@@ -1709,7 +1724,7 @@ function Kt(e, t) {
1709
1724
  }).format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`));
1710
1725
  }
1711
1726
  function qt({ lesson: e, locale: n, title: i, authors: a = [], date: o, summary: c, tones: l = {}, view: u = "article", math: d, storageKey: f, progress: p, defaultProgress: m, onProgressChange: h, labels: g, hasContents: _ = !0, lessonProps: v, children: y }) {
1712
- let b = j(), [x] = N(Ht), S = Ze(y), C = u === "present", [w] = N(() => de(e.initial)), T = {
1727
+ let b = j(), [x] = N(Ht), S = tt(y), C = u === "present", [w] = N(() => de(e.initial)), T = {
1713
1728
  ...fe,
1714
1729
  ...g
1715
1730
  }, E = [a.length > 0 ? `${T.by} ${a.join(", ")}` : "", o === void 0 ? "" : Kt(o, n)].filter((e) => e !== "").join(" · "), ee = /* @__PURE__ */ L("header", {
@@ -1730,7 +1745,7 @@ function qt({ lesson: e, locale: n, title: i, authors: a = [], date: o, summary:
1730
1745
  })
1731
1746
  ]
1732
1747
  }), te = Vt[u];
1733
- return dt({
1748
+ return ht({
1734
1749
  progress: p,
1735
1750
  defaultProgress: m,
1736
1751
  onProgressChange: h,
@@ -1969,4 +1984,4 @@ function rn({ inspects: e, label: t, children: n, labels: r }) {
1969
1984
  }), n]
1970
1985
  });
1971
1986
  }
1972
- export { fe as S, we as _, jt as a, ye as b, Ze as c, ze as d, q as f, Ee as g, Ne as h, qt as i, Ge as l, Pe as m, nn as n, $e as o, Me as p, Jt as r, Qe as s, rn as t, Ue as u, ge as v, Se as x, xe as y };
1987
+ export { fe as S, we as _, jt as a, ye as b, tt as c, ze as d, q as f, Ee as g, Ne as h, qt as i, Ye as l, Pe as m, nn as n, rt as o, Me as p, Jt as r, nt as s, rn as t, qe as u, ge as v, Se as x, xe as y };
package/dist/article.js CHANGED
@@ -1 +1 @@
1
- export { i as Article, v as Aside, _ as Beat, g as Challenge, y as Cite, t as DiagramPart, f as Figure, p as FigureReference, b as Footnote, d as Predict, x as References, m as Reveal, l as Scrolly, u as ScrollyStep, r as TeX, n as Term, s as answerSources, a as articleChecks, c as articleOutline, S as defaultArticleLabels, o as emptyProgress, h as useRevealed } from "./article-anMy8fA5.js";
1
+ export { i as Article, v as Aside, _ as Beat, g as Challenge, y as Cite, t as DiagramPart, f as Figure, p as FigureReference, b as Footnote, d as Predict, x as References, m as Reveal, l as Scrolly, u as ScrollyStep, r as TeX, n as Term, s as answerSources, a as articleChecks, c as articleOutline, S as defaultArticleLabels, o as emptyProgress, h as useRevealed } from "./article-Ni152e-v.js";
package/dist/catalog.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@mechane-ai/elements",
3
- "version": "0.67.0",
3
+ "version": "0.68.0",
4
4
  "recipes": [
5
5
  {
6
6
  "slug": "allocation-report",
@@ -77,6 +77,16 @@
77
77
  "import { spacing } from '@mechane-ai/elements/tokens';"
78
78
  ]
79
79
  },
80
+ {
81
+ "slug": "recorded-motion",
82
+ "title": "Recorded Motion",
83
+ "description": "Scrub a recorded simulation or jump to a named observation. Decode bounded JSON once per clip, handle invalid input at the read boundary, and key this recipe by immutable clip ID. A linked essay or application can lift the integer tick into its own state.",
84
+ "path": "recipes/recorded-motion.tsx",
85
+ "story": "recipes-recorded-motion--example",
86
+ "imports": [
87
+ "import { MotionFigure, parseMotionClip } from '@mechane-ai/elements/kits/research';"
88
+ ]
89
+ },
80
90
  {
81
91
  "slug": "searchable-collection",
82
92
  "title": "Searchable Collection",
@@ -4039,6 +4049,14 @@
4039
4049
  "timeTicks": {
4040
4050
  "kind": "value",
4041
4051
  "declaration": "dist/packages/charts/src/plot/ticks.d.ts"
4052
+ },
4053
+ "SpatialLayer": {
4054
+ "kind": "value",
4055
+ "declaration": "dist/packages/charts/src/plot/spatial-layer.d.ts"
4056
+ },
4057
+ "SpatialLayerProps": {
4058
+ "kind": "type",
4059
+ "declaration": "dist/packages/charts/src/plot/spatial-layer.d.ts"
4042
4060
  }
4043
4061
  },
4044
4062
  "@mechane-ai/elements/charts/figure": {
@@ -5979,6 +5997,58 @@
5979
5997
  "WorkHeartbeat": {
5980
5998
  "kind": "value",
5981
5999
  "declaration": "dist/packages/kits/src/research/work-heartbeat.d.ts"
6000
+ },
6001
+ "MotionClip": {
6002
+ "kind": "type",
6003
+ "declaration": "dist/packages/kits/src/research/motion-clip.d.ts"
6004
+ },
6005
+ "MotionArm": {
6006
+ "kind": "type",
6007
+ "declaration": "dist/packages/kits/src/research/motion-clip.d.ts"
6008
+ },
6009
+ "MotionMoment": {
6010
+ "kind": "type",
6011
+ "declaration": "dist/packages/kits/src/research/motion-clip.d.ts"
6012
+ },
6013
+ "MotionPoint": {
6014
+ "kind": "type",
6015
+ "declaration": "dist/packages/kits/src/research/motion-clip.d.ts"
6016
+ },
6017
+ "MotionBounds": {
6018
+ "kind": "type",
6019
+ "declaration": "dist/packages/kits/src/research/motion-clip.d.ts"
6020
+ },
6021
+ "MotionTrack": {
6022
+ "kind": "type",
6023
+ "declaration": "dist/packages/kits/src/research/motion-clip.d.ts"
6024
+ },
6025
+ "parseMotionClip": {
6026
+ "kind": "value",
6027
+ "declaration": "dist/packages/kits/src/research/motion-clip.d.ts"
6028
+ },
6029
+ "motionSceneAt": {
6030
+ "kind": "value",
6031
+ "declaration": "dist/packages/kits/src/research/motion-frame.d.ts"
6032
+ },
6033
+ "MotionLabels": {
6034
+ "kind": "type",
6035
+ "declaration": "dist/packages/kits/src/research/motion-scene.d.ts"
6036
+ },
6037
+ "MotionSceneProps": {
6038
+ "kind": "type",
6039
+ "declaration": "dist/packages/kits/src/research/motion-scene.d.ts"
6040
+ },
6041
+ "MotionScene": {
6042
+ "kind": "value",
6043
+ "declaration": "dist/packages/kits/src/research/motion-scene.d.ts"
6044
+ },
6045
+ "MotionFigureProps": {
6046
+ "kind": "type",
6047
+ "declaration": "dist/packages/kits/src/research/motion-figure.d.ts"
6048
+ },
6049
+ "MotionFigure": {
6050
+ "kind": "value",
6051
+ "declaration": "dist/packages/kits/src/research/motion-figure.d.ts"
5982
6052
  }
5983
6053
  },
5984
6054
  "@mechane-ai/elements/theme": {
@@ -1,5 +1,5 @@
1
1
  import { n as e, t } from "./chart-tones-ei3BC2AL.js";
2
- import { A as n, D as r, M as i, O as a, j as o } from "./plot-layout-CVzSbcU7.js";
2
+ import { A as n, D as r, M as i, O as a, j as o } from "./plot-layout-1MG72ZWn.js";
3
3
  import { t as s } from "./accessibility-P89UG9-r.js";
4
4
  import * as c from "@stylexjs/stylex";
5
5
  import { useId as l } from "react";
@@ -1,4 +1,4 @@
1
- import { r as e } from "./figure-format-B8kRZMlo.js";
1
+ import { r as e } from "./figure-format-BVb7yFCA.js";
2
2
  import { a as t, f as n, l as r, r as i, s as a } from "./plot-marks-DgCtcd3L.js";
3
3
  import { i as o, r as s } from "./scale-C2xgZyZN.js";
4
4
  import { a as c } from "./tone-scope-DKiSw-JR.js";
@@ -1 +1 @@
1
- export { t as AreaChart, p as BarChart, m as BarChartPlaceholder, f as BreakdownBar, d as BridgeChart, n as LineChart, l as ScatterPlot, r as SmallMultiples, i as SmallMultiplesPlaceholder, s as Sparkline, a as TimeSeriesChartPlaceholder, u as scatterLimits, o as timeSeriesBandLimits, c as timeSeriesLimits } from "../time-series-BSNnijxf.js";
1
+ export { t as AreaChart, p as BarChart, m as BarChartPlaceholder, f as BreakdownBar, d as BridgeChart, n as LineChart, l as ScatterPlot, r as SmallMultiples, i as SmallMultiplesPlaceholder, s as Sparkline, a as TimeSeriesChartPlaceholder, u as scatterLimits, o as timeSeriesBandLimits, c as timeSeriesLimits } from "../time-series-DtAtGoT_.js";
@@ -1 +1 @@
1
- export { o as BarCell, a as ChangeCell, i as HeatCell, r as IntervalCell, t as SparkCell, n as sparkCellLimits } from "../cells-X8SVrZBc.js";
1
+ export { o as BarCell, a as ChangeCell, i as HeatCell, r as IntervalCell, t as SparkCell, n as sparkCellLimits } from "../cells-BRI8LpMU.js";
@@ -1 +1 @@
1
- export { a as BulletBar, r as DotPlot, t as DumbbellPlot, o as bulletLimits, i as dotPlotLimits, n as dumbbellLimits } from "../dumbbell-plot-BQDGe0sQ.js";
1
+ export { a as BulletBar, r as DotPlot, t as DumbbellPlot, o as bulletLimits, i as dotPlotLimits, n as dumbbellLimits } from "../dumbbell-plot-jaQvOctJ.js";
@@ -1 +1 @@
1
- export { s as BoxPlot, f as ECDF, d as Histogram, u as IntervalPlot, l as RankedBars, a as Ridgeline, r as StripPlot, t as ViolinPlot, c as boxLimits, p as distributionLimits, o as ridgelineLimits, i as stripLimits, n as violinLimits } from "../violin-plot-W2L_2JRo.js";
1
+ export { s as BoxPlot, f as ECDF, d as Histogram, u as IntervalPlot, l as RankedBars, a as Ridgeline, r as StripPlot, t as ViolinPlot, c as boxLimits, p as distributionLimits, o as ridgelineLimits, i as stripLimits, n as violinLimits } from "../violin-plot-83HSjnQM.js";
@@ -1,16 +1,16 @@
1
- import { d as e, f as t, l as n, n as r, p as i, r as a, s as o, t as s } from "../time-series-BSNnijxf.js";
2
- import { a as c, r as l, t as u } from "../dumbbell-plot-BQDGe0sQ.js";
3
- import { a as d, d as f, f as p, l as ee, r as te, s as ne, t as re, u as ie } from "../violin-plot-W2L_2JRo.js";
4
- import { a as ae, r as oe, s as se, t as ce } from "../tree-diagram-BxOZsjr1.js";
5
- import { n as le, t as ue } from "../treemap-B2yOAetT.js";
6
- import { a as de, r as fe, t as pe } from "../image-grid-CxEAQvTf.js";
7
- import { c as me, i as he, o as m, r as ge, t as _e, u as ve } from "../token-heatmap-CJaXo56P.js";
8
- import { a as ye, l as be, r as xe, s as Se, t as Ce } from "../embedding-map-DmmknG7A.js";
9
- import { a as we, c as Te, r as h, t as Ee } from "../token-predictions-Bi7aKPnh.js";
10
- import { n as De, t as Oe } from "../waterfall-Bt73N2Ng.js";
11
- import { a as ke, l as Ae, r as je, s as Me, t as Ne } from "../slope-chart-DekEJxsy.js";
1
+ import { d as e, f as t, l as n, n as r, p as i, r as a, s as o, t as s } from "../time-series-DtAtGoT_.js";
2
+ import { a as c, r as l, t as u } from "../dumbbell-plot-jaQvOctJ.js";
3
+ import { a as d, d as f, f as p, l as ee, r as te, s as ne, t as re, u as ie } from "../violin-plot-83HSjnQM.js";
4
+ import { a as ae, r as oe, s as se, t as ce } from "../tree-diagram-D9ekymCQ.js";
5
+ import { n as le, t as ue } from "../treemap-DT8q65LQ.js";
6
+ import { a as de, r as fe, t as pe } from "../image-grid-B6fdmE9c.js";
7
+ import { c as me, i as he, o as m, r as ge, t as _e, u as ve } from "../token-heatmap-m6oaMwkK.js";
8
+ import { a as ye, l as be, r as xe, s as Se, t as Ce } from "../embedding-map-DnZL1kvY.js";
9
+ import { a as we, c as Te, r as h, t as Ee } from "../token-predictions-CpGVjOIs.js";
10
+ import { n as De, t as Oe } from "../waterfall-DmApvdrY.js";
11
+ import { a as ke, l as Ae, r as je, s as Me, t as Ne } from "../slope-chart-CELflRJd.js";
12
12
  import { m as g } from "../values-963L6n1m.js";
13
- import { a as _, r as v } from "../figure-frame-DlyNTDzh.js";
13
+ import { a as _, r as v } from "../figure-frame-96zFqsWz.js";
14
14
  import { createElement as y } from "react";
15
15
  import { jsx as b } from "react/jsx-runtime";
16
16
  import { formatNumber as Pe } from "@ui-sdk/core/number";
@@ -1 +1 @@
1
- export { r as AttributionGraph, s as FlowDiagram, a as RelationGraph, t as TreeDiagram, i as attributionLimits, c as flowLimits, o as relationGraphLimits, n as treeLimits } from "../tree-diagram-BxOZsjr1.js";
1
+ export { r as AttributionGraph, s as FlowDiagram, a as RelationGraph, t as TreeDiagram, i as attributionLimits, c as flowLimits, o as relationGraphLimits, n as treeLimits } from "../tree-diagram-D9ekymCQ.js";
@@ -1 +1 @@
1
- export { n as Icicle, t as Treemap, r as icicleLimits } from "../treemap-B2yOAetT.js";
1
+ export { n as Icicle, t as Treemap, r as icicleLimits } from "../treemap-DT8q65LQ.js";
@@ -1 +1 @@
1
- export { a as AttributionOverlay, r as ImageAtlas, t as ImageGrid, o as attributionOverlayLimits, i as imageAtlasLimits, n as imageGridLimits } from "../image-grid-CxEAQvTf.js";
1
+ export { a as AttributionOverlay, r as ImageAtlas, t as ImageGrid, o as attributionOverlayLimits, i as imageAtlasLimits, n as imageGridLimits } from "../image-grid-B6fdmE9c.js";
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "../token-heatmap-CJaXo56P.js";
2
- import { t as p } from "../color-legend-CIo7DhXB.js";
1
+ import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "../token-heatmap-m6oaMwkK.js";
2
+ import { t as p } from "../color-legend-4As8881l.js";
3
3
  import { t as m } from "../heatmap-scale-Zte6Ya-g.js";
4
4
  export { f as AttentionMatrix, t as CalendarHeatmap, p as ColorLegend, s as ConfusionMatrix, i as CorrelationMatrix, l as Matrix, d as TokenHeatmap, n as attentionMatrixLimits, a as calendarHeatmapLimits, u as confusionMatrixLimits, e as correlationMatrixLimits, m as heatmapColor, c as matrixCellId, r as matrixLimits, o as tokenHeatmapLimits };