@mechane-ai/elements 0.67.0 → 0.69.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 (90) hide show
  1. package/dist/ai.js +226 -225
  2. package/dist/{article-anMy8fA5.js → article-CTSxWe4y.js} +104 -89
  3. package/dist/article.js +1 -1
  4. package/dist/catalog.json +131 -1
  5. package/dist/{categorical-values-Bh7ZkEQn.js → categorical-values-DwomVcSd.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/content.js +1 -1
  25. package/dist/{dumbbell-plot-BQDGe0sQ.js → dumbbell-plot-S4RyfxmW.js} +5 -5
  26. package/dist/{embedding-map-DmmknG7A.js → embedding-map-Bm7aTA6z.js} +5 -5
  27. package/dist/figure-format-BVb7yFCA.js +46 -0
  28. package/dist/{figure-frame-DlyNTDzh.js → figure-frame-BHCNceS4.js} +1 -1
  29. package/dist/{image-grid-CxEAQvTf.js → image-grid-TTrLxvaI.js} +3 -3
  30. package/dist/kits/evaluation.js +5 -5
  31. package/dist/kits/interpretability.js +8 -8
  32. package/dist/kits/operations.js +4 -4
  33. package/dist/kits/research.js +1087 -230
  34. package/dist/kits/training.js +4 -4
  35. package/dist/lesson.js +3 -3
  36. package/dist/locate-Dcq5ZZSk.js +14 -0
  37. package/dist/markdown-JeuBeMDZ.js +293 -0
  38. package/dist/mdx.js +4 -4
  39. package/dist/packages/charts/src/plot/index.d.ts +3 -0
  40. package/dist/packages/charts/src/plot/locate.d.ts +3 -1
  41. package/dist/packages/charts/src/plot/plot-layout.d.ts +2 -2
  42. package/dist/packages/charts/src/plot/spatial-layer.d.ts +36 -0
  43. package/dist/packages/charts/src/plot/step-history.d.ts +13 -0
  44. package/dist/packages/charts/src/plot/ticks.d.ts +2 -2
  45. package/dist/packages/content/src/timeline-scrubber.d.ts +3 -1
  46. package/dist/packages/foundations/src/visible-motion.d.ts +1 -1
  47. package/dist/packages/kits/src/research/index.d.ts +14 -0
  48. package/dist/packages/kits/src/research/motion-clip.d.ts +3 -0
  49. package/dist/packages/kits/src/research/motion-error.d.ts +8 -0
  50. package/dist/packages/kits/src/research/motion-figure.d.ts +12 -0
  51. package/dist/packages/kits/src/research/motion-frame.d.ts +22 -0
  52. package/dist/packages/kits/src/research/motion-inspection.d.ts +14 -0
  53. package/dist/packages/kits/src/research/motion-location.d.ts +9 -0
  54. package/dist/packages/kits/src/research/motion-scene.d.ts +29 -0
  55. package/dist/packages/kits/src/research/motion-types.d.ts +54 -0
  56. package/dist/packages/kits/src/research/motion-view.d.ts +9 -0
  57. package/dist/packages/kits/src/research/native-motion-figure.d.ts +17 -0
  58. package/dist/packages/kits/src/research/native-motion.d.ts +18 -0
  59. package/dist/packages/teaching/src/article/uncover.d.ts +2 -0
  60. package/dist/{param-CKr8EYxF.js → param-Dk92C-K1.js} +1 -1
  61. package/dist/plot-BIYlgY2B.js +223 -0
  62. package/dist/{plot-layout-CVzSbcU7.js → plot-layout-CNNFMC8H.js} +152 -102
  63. package/dist/{plot-surface-CBhI1alw.js → plot-surface-BSjoNIva.js} +1 -1
  64. package/dist/{reference-lines-C970JwWZ.js → reference-lines-Bet_hRyA.js} +1 -1
  65. package/dist/{scene-C3dCxckI.js → scene-C88Xkz4l.js} +7 -7
  66. package/dist/scene.js +1 -1
  67. package/dist/{slope-chart-DekEJxsy.js → slope-chart-B6Mtcta2.js} +6 -6
  68. package/dist/{src-BsqbWDxS.js → src-DCozYUGI.js} +146 -131
  69. package/dist/styles2.css +16 -4
  70. package/dist/{time-series-BSNnijxf.js → time-series-DJk-2Mt0.js} +7 -7
  71. package/dist/{timeline-CnxfYSIg.js → timeline-BHpj7i7K.js} +4 -4
  72. package/dist/{token-heatmap-CJaXo56P.js → token-heatmap-DEqEaoGE.js} +273 -288
  73. package/dist/{token-predictions-Bi7aKPnh.js → token-predictions-Bjdh0K-A.js} +5 -5
  74. package/dist/{transport-CXj0DV6o.js → transport-DQ1yzsQl.js} +2 -2
  75. package/dist/{tree-diagram-BxOZsjr1.js → tree-diagram-BxSDOBFj.js} +4 -4
  76. package/dist/{treemap-B2yOAetT.js → treemap-DzHAp4ia.js} +5 -5
  77. package/dist/{use-tween-C1TWJwce.js → use-tween-DbXVZBR8.js} +1 -1
  78. package/dist/{violin-plot-W2L_2JRo.js → violin-plot-B4Cf38Y9.js} +5 -5
  79. package/dist/visible-motion-D6NwjGNz.js +24 -0
  80. package/dist/{waterfall-Bt73N2Ng.js → waterfall-C9_pHZzv.js} +4 -4
  81. package/package.json +1 -1
  82. package/recipes/recorded-motion.tsx +14 -0
  83. package/skills/review-elements/SKILL.md +6 -0
  84. package/skills/review-explainer/SKILL.md +4 -0
  85. package/skills/use-elements/SKILL.md +2 -0
  86. package/skills/use-elements/references/kits.md +33 -0
  87. package/skills/write-explainer/SKILL.md +5 -0
  88. package/dist/figure-format-B8kRZMlo.js +0 -36
  89. package/dist/locate-Bcg3QcP4.js +0 -11
  90. package/dist/markdown-Diffqqm7.js +0 -313
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { MotionFigureProps } from './motion-figure.tsx';
3
+ import type { NativeMotionMapping } from './native-motion.ts';
4
+ export type NativeMotionSource = {
5
+ readonly src: string;
6
+ readonly mapping: NativeMotionMapping;
7
+ };
8
+ type LazySource = {
9
+ readonly load: () => Promise<NativeMotionSource>;
10
+ };
11
+ export type NativeMotionFigureProps = MotionFigureProps & {
12
+ readonly native?: NativeMotionSource | LazySource;
13
+ readonly isNative?: boolean;
14
+ readonly onNativeChange?: (isNative: boolean) => void;
15
+ };
16
+ export declare function NativeMotionFigure({ native, isNative: controlled, onNativeChange, isPlaying: controlledPlaying, onPlayingChange, speed: controlledSpeed, onSpeedChange, ...props }: NativeMotionFigureProps): ReactNode;
17
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { MotionClip } from './motion-types.ts';
2
+ export type NativeMotionMapping = {
3
+ readonly version: 1;
4
+ readonly arm: number;
5
+ readonly firstTick: number;
6
+ readonly lastTick: number;
7
+ readonly secondsPerTick: number;
8
+ readonly startSeconds: HTMLMediaElement['currentTime'];
9
+ readonly clipSha256: string;
10
+ readonly movieSha256: string;
11
+ readonly fps: number;
12
+ readonly ticks: ReadonlyArray<number>;
13
+ };
14
+ export declare function parseNativeMotionMapping(input: unknown, clip: MotionClip): NativeMotionMapping;
15
+ export declare function motionSha256(blob: Blob): Promise<string>;
16
+ export declare function verifyNativeMotion(clipBytes: Blob, movie: Blob, mapping: NativeMotionMapping): Promise<void>;
17
+ /** Seek to the last frame at or before the playhead, including repeated capture ticks. */
18
+ export declare function nativeMotionTime(mapping: NativeMotionMapping, tick: number): number;
@@ -0,0 +1,2 @@
1
+ /** Moves a covered target below a pinned figure or contents bar. */
2
+ export declare function uncover(pinned: HTMLElement, target: Element): void;
@@ -1,5 +1,5 @@
1
1
  import { d as e, m as t } from "./src-DceyVyL0.js";
2
- import { r as n } from "./figure-format-B8kRZMlo.js";
2
+ import { r as n } from "./figure-format-BVb7yFCA.js";
3
3
  import { n as r, t as i } from "./clock-DSm5lkNE.js";
4
4
  import "@stylexjs/stylex";
5
5
  import { createParts as a } from "@ui-sdk/react/primitive";
@@ -0,0 +1,223 @@
1
+ import { E as e, O as t, h as n, j as r, s as i } from "./plot-layout-CNNFMC8H.js";
2
+ import { n as a } from "./plot-width-D3hTycYX.js";
3
+ import { t as o } from "./locate-Dcq5ZZSk.js";
4
+ import { r as s } from "./path-BglsXpnO.js";
5
+ import { c, d as l, f as u, l as d, n as f, p } from "./plot-marks-DgCtcd3L.js";
6
+ import { t as m } from "./plot-surface-BSjoNIva.js";
7
+ import { n as h, r as g } from "./scale-C2xgZyZN.js";
8
+ import * as _ from "@stylexjs/stylex";
9
+ import { memo as v } from "react";
10
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
11
+ // packages/charts/src/plot/spatial-layer.tsx
12
+ function x({ label: h, bounds: g, regions: v, points: x, tone: S, shape: C, selected: w, origin: T, locale: E, isDense: D, isCompact: O = !1, showTrails: k = !0, destination: A, onSelectedChange: j }) {
13
+ let [M, N, P, F] = g, I = O ? 246 : 480, L = Math.min(440, Math.max(140, Math.round((I - 72) * (F - N) / (P - M) + 44))), R = new Intl.NumberFormat(E, { maximumSignificantDigits: 6 }), z = Math.min((I - 72) / (P - M), (L - 44) / (F - N));
14
+ function B(e) {
15
+ return I / 2 + (e - (M + P) / 2) * z;
16
+ }
17
+ function V(e) {
18
+ return L / 2 + (e - (N + F) / 2) * z;
19
+ }
20
+ let H = i({
21
+ width: I,
22
+ height: L,
23
+ margins: {
24
+ left: B(M),
25
+ right: I - B(P),
26
+ top: V(N),
27
+ bottom: L - V(F)
28
+ }
29
+ }), U = x.find((e) => e.id === w);
30
+ function W(e) {
31
+ return /* @__PURE__ */ b("svg", {
32
+ role: "img",
33
+ "aria-label": h,
34
+ width: I,
35
+ height: L,
36
+ viewBox: `0 0 ${I} ${L}`,
37
+ className: "x1lliihq xh8yej3 xt7dq6l xpvm0e4 xb3r6kr",
38
+ children: [
39
+ n([M, P], O ? 3 : 5).map((e) => /* @__PURE__ */ b("g", { children: [/* @__PURE__ */ y("line", {
40
+ x1: B(e),
41
+ x2: B(e),
42
+ y1: V(N),
43
+ y2: V(F),
44
+ ..._.props(a.grid)
45
+ }), /* @__PURE__ */ y(c, {
46
+ x: B(e),
47
+ y: V(F) + 16,
48
+ anchor: "middle",
49
+ children: R.format(e)
50
+ })] }, e)),
51
+ n([N, F], Math.max(2, Math.floor(L / 60))).map((e) => /* @__PURE__ */ b("g", { children: [/* @__PURE__ */ y(c, {
52
+ x: B(M) - 6,
53
+ y: V(e) + 4,
54
+ anchor: "end",
55
+ children: R.format(e)
56
+ }), /* @__PURE__ */ y("line", {
57
+ x1: B(M),
58
+ x2: B(P),
59
+ y1: V(e),
60
+ y2: V(e),
61
+ ..._.props(a.grid)
62
+ })] }, e)),
63
+ /* @__PURE__ */ b(m, {
64
+ box: H,
65
+ children: [
66
+ v.map((e) => {
67
+ let [t, n, r, i] = e.bounds, a = `M${B(t)},${V(n)}H${B(r)}V${V(i)}H${B(t)}Z`;
68
+ return /* @__PURE__ */ b("g", { children: [
69
+ /* @__PURE__ */ y(f, {
70
+ d: a,
71
+ tone: S
72
+ }),
73
+ /* @__PURE__ */ y(d, {
74
+ d: a,
75
+ tone: S,
76
+ stroke: "dashed"
77
+ }),
78
+ /* @__PURE__ */ y(c, {
79
+ x: B(t),
80
+ y: V(n) - 6,
81
+ children: e.label
82
+ })
83
+ ] }, JSON.stringify(e));
84
+ }),
85
+ T !== void 0 && /* @__PURE__ */ b("g", { children: [/* @__PURE__ */ y(p, {
86
+ shape: C,
87
+ x: B(T.x),
88
+ y: V(T.y),
89
+ tone: S,
90
+ radius: 7,
91
+ isHollow: !0
92
+ }), /* @__PURE__ */ y(c, {
93
+ x: B(T.x),
94
+ y: V(T.y) - 13,
95
+ anchor: "middle",
96
+ children: T.label
97
+ })] }),
98
+ A !== void 0 && U !== void 0 && /* @__PURE__ */ b("g", { children: [/* @__PURE__ */ y(u, {
99
+ x1: B(U.x),
100
+ y1: V(U.y),
101
+ x2: B(A[0]),
102
+ y2: V(A[1]),
103
+ stroke: "dashed",
104
+ tone: S
105
+ }), /* @__PURE__ */ y(l, {
106
+ x: B(A[0]),
107
+ y: V(A[1])
108
+ })] }),
109
+ k && x.map((e) => e.trail.length < 2 ? null : /* @__PURE__ */ y(d, {
110
+ d: s(e.trail.map(([e, t]) => ({
111
+ x: B(e),
112
+ y: V(t)
113
+ }))),
114
+ tone: S,
115
+ emphasis: e.id === w ? "normal" : "receded"
116
+ }, e.id)),
117
+ x.map((t) => /* @__PURE__ */ y(p, {
118
+ mark: t.id,
119
+ x: B(t.x),
120
+ y: V(t.y),
121
+ tone: S,
122
+ shape: C,
123
+ radius: D ? 2.5 : 5,
124
+ isSelected: t.id === w,
125
+ isInspected: t.id === e,
126
+ emphasis: w != null && w !== t.id ? "receded" : "normal"
127
+ }, t.id))
128
+ ]
129
+ })
130
+ ]
131
+ });
132
+ }
133
+ if (j === void 0) return W(null);
134
+ let G = x.filter((e) => e.x >= M && e.x <= P && e.y >= N && e.y <= F), K = G.map((e) => ({
135
+ id: e.id,
136
+ x: B(e.x),
137
+ y: V(e.y)
138
+ })), q = G.map((e) => ({
139
+ id: e.id,
140
+ label: e.label ?? e.id
141
+ }));
142
+ return /* @__PURE__ */ y(e, {
143
+ items: q,
144
+ selected: w,
145
+ onSelect: j,
146
+ arrows: "both",
147
+ locate: o({
148
+ marks: K,
149
+ width: I,
150
+ height: L,
151
+ maxDistance: 16
152
+ }),
153
+ render: (e, { inspected: n }) => /* @__PURE__ */ y("figure", {
154
+ ...e,
155
+ className: "x1ghz6dp xeuugli",
156
+ children: /* @__PURE__ */ y(t, {
157
+ role: "group",
158
+ "aria-label": r({
159
+ title: h,
160
+ marks: "actors",
161
+ isSelectable: !0
162
+ }),
163
+ children: W(n)
164
+ })
165
+ })
166
+ });
167
+ }
168
+ // packages/charts/src/plot/step-history.tsx
169
+ var S = 640, C = 56, w = 3, T = 4;
170
+ function E(e, t, n) {
171
+ if (e.length <= S * T) return e;
172
+ let r = /* @__PURE__ */ new Map();
173
+ for (let i of e) {
174
+ let e = Math.floor((i[0] - t) * S / (n - t)), a = r.get(e);
175
+ a === void 0 ? r.set(e, {
176
+ first: i,
177
+ low: i,
178
+ high: i,
179
+ last: i
180
+ }) : (i[1] < a.low[1] && (a.low = i), i[1] > a.high[1] && (a.high = i), a.last = i);
181
+ }
182
+ return [...r.values()].flatMap(({ first: e, low: t, high: n, last: r }) => [.../* @__PURE__ */ new Set([
183
+ e,
184
+ t,
185
+ n,
186
+ r
187
+ ])].toSorted((e, t) => e[0] - t[0]));
188
+ }
189
+ var D = v(({ series: e, first: t, last: n }) => {
190
+ if (t === n) return null;
191
+ let r = e.map((e) => ({
192
+ ...e,
193
+ values: E(e.values, t, n)
194
+ })), i = r.flatMap((e) => e.values.map(([, e]) => e)), a = h(i);
195
+ if (a === void 0) return null;
196
+ let [o, c] = a, l = g({
197
+ domain: [t, n],
198
+ range: [0, S]
199
+ }), u = g({
200
+ domain: o === c ? [o - 1, c + 1] : [o, c],
201
+ range: [53, w]
202
+ });
203
+ return /* @__PURE__ */ y("svg", {
204
+ "aria-hidden": !0,
205
+ viewBox: `0 0 ${S} ${C}`,
206
+ preserveAspectRatio: "none",
207
+ className: "xh8yej3 x5yr21d x1lliihq",
208
+ children: r.map((e) => {
209
+ let t = e.values.map(([e, t]) => ({
210
+ x: l.position(e),
211
+ y: u.position(t)
212
+ })), n = t.at(-1);
213
+ return n === void 0 ? null : /* @__PURE__ */ y(d, {
214
+ tone: e.tone,
215
+ d: s([...t, {
216
+ x: S,
217
+ y: n.y
218
+ }], "step")
219
+ }, e.id);
220
+ })
221
+ });
222
+ });
223
+ export { x as n, D as t };