@mechane-ai/elements 0.48.0 → 0.49.1

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 (140) hide show
  1. package/README.md +40 -2
  2. package/dist/ai.js +5 -5
  3. package/dist/{article-BXZr10QQ.js → article-CRlhq9oA.js} +532 -464
  4. package/dist/article.js +1 -1
  5. package/dist/catalog.json +243 -1
  6. package/dist/{categorical-values-BpVq8cFj.js → categorical-values-BYP_R5gS.js} +13 -13
  7. package/dist/{cells-xVmnQ9oQ.js → cells-CNZE4us2.js} +2 -2
  8. package/dist/charts/cartesian.js +1 -1
  9. package/dist/charts/cells.js +1 -1
  10. package/dist/charts/comparison.js +1 -1
  11. package/dist/charts/distribution.js +1 -1
  12. package/dist/charts/figure.js +12 -12
  13. package/dist/charts/graph.js +1 -1
  14. package/dist/charts/hierarchy.js +1 -1
  15. package/dist/charts/image.js +1 -1
  16. package/dist/charts/matrix.js +1 -1
  17. package/dist/charts/plot.js +7 -7
  18. package/dist/charts/relationship.js +1 -1
  19. package/dist/charts/text.js +1 -1
  20. package/dist/charts/timeline.js +1 -1
  21. package/dist/charts/trend.js +1 -1
  22. package/dist/charts.js +7 -7
  23. package/dist/{code-block-DioAM2bZ.js → code-block-BZsY2sh3.js} +1 -1
  24. package/dist/collections.js +1 -1
  25. package/dist/content/code.js +1 -1
  26. package/dist/content/diff.js +3 -3
  27. package/dist/content/link.js +1 -1
  28. package/dist/content/markdown.js +2 -2
  29. package/dist/content/tree.js +1 -1
  30. package/dist/{content-link-NWuHp5rC.js → content-link-PnpcnTCx.js} +1 -1
  31. package/dist/content.js +1 -1
  32. package/dist/{dates-Cww8UR_n.js → dates-ckJdYF7t.js} +1 -1
  33. package/dist/{dumbbell-plot-DQdTxDeO.js → dumbbell-plot-B-Tn7ewW.js} +49 -48
  34. package/dist/{embedding-map-CF-J-8JW.js → embedding-map-Bljn-A5q.js} +533 -533
  35. package/dist/feedback.js +1 -1
  36. package/dist/figure-frame-CEijciL7.js +289 -0
  37. package/dist/forms/dates.js +1 -1
  38. package/dist/forms.js +3 -3
  39. package/dist/{image-grid-Dl2sjIMB.js → image-grid-mrG5u9oE.js} +49 -49
  40. package/dist/index.js +1 -1
  41. package/dist/kits/evaluation.js +5 -5
  42. package/dist/kits/interpretability.js +320 -302
  43. package/dist/kits/operations.js +6 -6
  44. package/dist/kits/research.js +558 -0
  45. package/dist/kits/training.js +6 -6
  46. package/dist/layout.js +205 -110
  47. package/dist/lesson/spec.js +11 -11
  48. package/dist/lesson.js +4 -4
  49. package/dist/mdx.js +6 -6
  50. package/dist/navigation.js +2 -2
  51. package/dist/packages/charts/src/cartesian/index.d.ts +1 -1
  52. package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +18 -0
  53. package/dist/packages/charts/src/chart-theme.d.ts +1 -1
  54. package/dist/packages/charts/src/figure/caption-scope.d.ts +12 -0
  55. package/dist/packages/charts/src/figure/figure-frame.d.ts +2 -1
  56. package/dist/packages/charts/src/index.d.ts +2 -0
  57. package/dist/packages/charts/src/plot/plot-surface.d.ts +3 -1
  58. package/dist/packages/collections/src/index.d.ts +1 -1
  59. package/dist/packages/collections/src/metrics.d.ts +9 -1
  60. package/dist/packages/content/src/index.d.ts +2 -0
  61. package/dist/packages/content/src/text-match.d.ts +22 -0
  62. package/dist/packages/core/src/index.d.ts +1 -0
  63. package/dist/packages/core/src/surfaces.d.ts +12 -2
  64. package/dist/packages/forms/src/index.d.ts +2 -0
  65. package/dist/packages/forms/src/token-input.d.ts +24 -0
  66. package/dist/packages/kits/src/interpretability/index.d.ts +1 -1
  67. package/dist/packages/kits/src/interpretability/logit-lens.d.ts +10 -1
  68. package/dist/packages/kits/src/research/finding-card.d.ts +43 -0
  69. package/dist/packages/kits/src/research/index.d.ts +8 -0
  70. package/dist/packages/kits/src/research/milestone-path.d.ts +36 -0
  71. package/dist/packages/kits/src/research/specimen-diff.d.ts +41 -0
  72. package/dist/packages/kits/src/research/work-heartbeat.d.ts +34 -0
  73. package/dist/packages/layout/src/figure-grid.d.ts +8 -0
  74. package/dist/packages/layout/src/index.d.ts +4 -1
  75. package/dist/packages/layout/src/sidebar.d.ts +7 -0
  76. package/dist/packages/layout/src/workbench.d.ts +4 -1
  77. package/dist/packages/teaching/src/article/article-context.d.ts +2 -0
  78. package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +13 -0
  79. package/dist/packages/teaching/src/article/article.d.ts +6 -1
  80. package/dist/packages/teaching/src/article/figure.d.ts +20 -3
  81. package/dist/packages/teaching/src/article/index.d.ts +1 -1
  82. package/dist/packages/teaching/src/article/view-essay.d.ts +2 -1
  83. package/dist/packages/teaching/src/lesson/define-lesson.d.ts +4 -0
  84. package/dist/packages/teaching/src/lesson/index.d.ts +2 -2
  85. package/dist/packages/teaching/src/lesson/lesson-player.d.ts +19 -3
  86. package/dist/packages/teaching/src/lesson/lesson-store.d.ts +2 -0
  87. package/dist/packages/teaching/src/lesson/playback.d.ts +9 -6
  88. package/dist/packages/teaching/src/lesson/use-lesson.d.ts +7 -2
  89. package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +4 -1
  90. package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +5 -6
  91. package/dist/packages/teaching/src/scene/scene-geometry.d.ts +1 -1
  92. package/dist/packages/teaching/src/scene/scene-node.d.ts +4 -1
  93. package/dist/packages/teaching/src/scene/scene-validate.d.ts +6 -0
  94. package/dist/packages/teaching/src/scene/scene-wire.d.ts +6 -1
  95. package/dist/packages/teaching/src/scene/scene.d.ts +1 -1
  96. package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +5 -1
  97. package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +1 -1
  98. package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +1 -1
  99. package/dist/packages/teaching/src/time/tween.d.ts +2 -0
  100. package/dist/{param-CqKUTHaO.js → param-BdqTpZER.js} +175 -108
  101. package/dist/{pierre-diff-DlvjyuJn.js → pierre-diff-aGyQK5xK.js} +1 -1
  102. package/dist/{plot-axes-DJkLW4wk.js → plot-axes-D5S9BnBa.js} +1 -1
  103. package/dist/{plot-layout-CZVSJ-le.js → plot-layout-B2xRt-_k.js} +146 -132
  104. package/dist/{plot-marks-uozcbOIX.js → plot-marks-FVsbFkUs.js} +3 -3
  105. package/dist/{plot-surface-CbVBvgqZ.js → plot-surface-0cKFwtws.js} +11 -11
  106. package/dist/{plot-width-DcqtSgzb.js → plot-width-D3hTycYX.js} +1 -1
  107. package/dist/{reference-lines-BDcttOp0.js → reference-lines-nSxcZVF5.js} +2 -2
  108. package/dist/{scene-0z2gbaDE.js → scene-BwJKueD6.js} +1228 -1126
  109. package/dist/scene.js +1 -1
  110. package/dist/{slope-chart-BKVEAVCs.js → slope-chart-CGTYbFxi.js} +182 -182
  111. package/dist/{src-CpdJlDhO.js → src-9EJskqB_.js} +73 -31
  112. package/dist/{src-Dcfq8vE4.js → src-B2rgpWap.js} +48 -14
  113. package/dist/{src-BPTDJqt0.js → src-Ci8DeY8J.js} +1 -1
  114. package/dist/{src-CGc_hjxJ.js → src-DFW49IAs.js} +143 -111
  115. package/dist/{src-BD6xlvDt.js → src-Dxs3Buo_.js} +203 -137
  116. package/dist/{src-CExIrXPC.js → src-npqwq3Sa.js} +1 -1
  117. package/dist/styles2.css +136 -17
  118. package/dist/{time-series-BgzGNOk0.js → time-series-Dh8y5ba0.js} +1018 -944
  119. package/dist/{token-heatmap-BrW1OsKD.js → token-heatmap-BTrZ3-N4.js} +86 -86
  120. package/dist/{token-predictions-yerq_Oet.js → token-predictions-CUe4junQ.js} +129 -129
  121. package/dist/{transport-BJweqDPj.js → transport-4V9rfYHN.js} +291 -246
  122. package/dist/{tree-diagram-D09BRqE-.js → tree-diagram-Dpqmo-fh.js} +118 -118
  123. package/dist/{treemap-CW4WsJNL.js → treemap-BUSaVD3m.js} +28 -28
  124. package/dist/use-tween-BsaEO862.js +10 -0
  125. package/dist/{violin-plot-DrtPZ1-T.js → violin-plot-BxaLwdRi.js} +126 -126
  126. package/dist/{waterfall-DYLSnGjm.js → waterfall-CcDMdKec.js} +43 -43
  127. package/package.json +5 -1
  128. package/recipes/counting-cards.tsx +3 -3
  129. package/skills/review-explainer/SKILL.md +2 -1
  130. package/skills/upgrade-elements/references/releases.md +61 -0
  131. package/skills/use-elements/SKILL.md +3 -1
  132. package/skills/use-elements/references/kits.md +7 -6
  133. package/skills/use-elements/references/styling.md +23 -0
  134. package/skills/use-elements/references/teaching.md +13 -0
  135. package/skills/write-explainer/references/article.md +50 -2
  136. package/skills/write-explainer/references/lesson.md +18 -9
  137. package/skills/write-explainer/references/scene-parts.md +17 -12
  138. package/skills/write-explainer/references/scene.md +25 -3
  139. package/dist/figure-frame-BJ3REgTA.js +0 -270
  140. package/dist/use-tween-5HZ55_9d.js +0 -72
@@ -1,12 +1,12 @@
1
1
  import { t as e } from "./chart-tones-ei3BC2AL.js";
2
- import { A as t, O as n, S as r, k as i, s as a, w as o } from "./plot-layout-CZVSJ-le.js";
3
- import { i as s, n as c, t as l } from "./categorical-values-BpVq8cFj.js";
2
+ import { A as t, E as n, M as r, S as i, j as a, s as o } from "./plot-layout-B2xRt-_k.js";
3
+ import { i as s, n as c, t as l } from "./categorical-values-BYP_R5gS.js";
4
4
  import { i as u } from "./chart-link-AE_xuxiP.js";
5
5
  import { a as d } from "./tone-scope-DKiSw-JR.js";
6
6
  import { r as f } from "./figure-format-B8kRZMlo.js";
7
- import { i as p, l as m, n as h, r as g, t as _ } from "./figure-frame-BJ3REgTA.js";
8
- import { n as v } from "./plot-width-DcqtSgzb.js";
9
- import { n as y, r as b } from "./plot-surface-CbVBvgqZ.js";
7
+ import { i as p, l as m, n as h, r as g, t as _ } from "./figure-frame-CEijciL7.js";
8
+ import { n as v } from "./plot-width-D3hTycYX.js";
9
+ import { n as y, r as b } from "./plot-surface-0cKFwtws.js";
10
10
  import * as x from "@stylexjs/stylex";
11
11
  import { useId as S } from "react";
12
12
  import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
@@ -127,19 +127,19 @@ function H(e, t, n) {
127
127
  }
128
128
  function ee(e) {
129
129
  if (e.length > R.nodes) return `This chart draws at most ${R.nodes} nodes. Supply a coarser hierarchy.`;
130
- if (!t(e)) return "Hierarchy nodes must have unique identifiers.";
130
+ if (!r(e)) return "Hierarchy nodes must have unique identifiers.";
131
131
  if (e.filter((e) => e.parentId === null).length !== 1) return "A hierarchy needs exactly one root node with a null parent.";
132
- let n = e.map((t) => H(e, t, /* @__PURE__ */ new Set([t.id])));
133
- if (n.includes(void 0)) return "Every node must name a supplied parent, and the parents must not form a cycle.";
134
- if (n.some((e) => e !== void 0 && e > R.depth)) return `This chart draws at most ${R.depth} levels below the root.`;
132
+ let t = e.map((t) => H(e, t, /* @__PURE__ */ new Set([t.id])));
133
+ if (t.includes(void 0)) return "Every node must name a supplied parent, and the parents must not form a cycle.";
134
+ if (t.some((e) => e !== void 0 && e > R.depth)) return `This chart draws at most ${R.depth} levels below the root.`;
135
135
  if (e.some((e) => e.value !== null && (!Number.isFinite(e.value) || e.value < 0))) return "Node values must be finite and nonnegative, or explicitly missing.";
136
- let r = e.find((t) => {
136
+ let n = e.find((t) => {
137
137
  let n = e.filter((e) => e.parentId === t.id), r = n.reduce((e, t) => e + (t.value ?? 0), 0);
138
138
  return t.value !== null && r > t.value * (1 + 2 ** -52 * n.length);
139
139
  });
140
- return r === void 0 ? void 0 : `${r.label} is less than the sum of its children. Supply each node's own total.`;
140
+ return n === void 0 ? void 0 : `${n.label} is less than the sum of its children. Supply each node's own total.`;
141
141
  }
142
- function U({ nodes: e, valueFormat: t, selected: s, onSelectedChange: c, height: l = "regular", ...v }) {
142
+ function U({ nodes: e, valueFormat: r, selected: s, onSelectedChange: c, height: l = "regular", ...v }) {
143
143
  let { emptyLabel: x = "No hierarchy was supplied.", ...E } = v, { locale: D, title: O } = E, k = b(l), A = S(), j = d(), M = u();
144
144
  if (E.status === "loading") return /* @__PURE__ */ w(p, {
145
145
  ...E,
@@ -168,7 +168,7 @@ function U({ nodes: e, valueFormat: t, selected: s, onSelectedChange: c, height:
168
168
  id: e.id,
169
169
  parentId: e.parentId,
170
170
  value: e.value
171
- }] : []), K = a({
171
+ }] : []), K = o({
172
172
  width: k.width,
173
173
  height: k.height,
174
174
  margins: {
@@ -186,7 +186,7 @@ function U({ nodes: e, valueFormat: t, selected: s, onSelectedChange: c, height:
186
186
  return f({
187
187
  value: e,
188
188
  locale: D,
189
- format: t
189
+ format: r
190
190
  });
191
191
  }
192
192
  function Y(e) {
@@ -214,25 +214,25 @@ function U({ nodes: e, valueFormat: t, selected: s, onSelectedChange: c, height:
214
214
  right: e.x1,
215
215
  bottom: e.y1
216
216
  }])), $ = e.length - G.length;
217
- return /* @__PURE__ */ w(o, {
217
+ return /* @__PURE__ */ w(n, {
218
218
  ...M,
219
219
  items: Z,
220
220
  place: (e) => Q.get(e),
221
221
  locate: (e) => L(q, e.x / e.width * K.width, e.y / e.height * K.height)?.id,
222
222
  selected: s ?? null,
223
223
  onSelect: c,
224
- render: (t, { inspected: a, cursor: o }) => /* @__PURE__ */ w(h, {
224
+ render: (n, { inspected: r, cursor: o }) => /* @__PURE__ */ w(h, {
225
225
  ...E,
226
- figure: t,
227
- footer: /* @__PURE__ */ w(r, {
226
+ figure: n,
227
+ footer: /* @__PURE__ */ w(i, {
228
228
  id: A,
229
- children: n(Z, a)
229
+ children: t(Z, r)
230
230
  }),
231
231
  children: e.length === 0 ? /* @__PURE__ */ w(_, { children: x }) : /* @__PURE__ */ T(C, { children: [
232
232
  /* @__PURE__ */ w(y, {
233
233
  plotRef: k.ref,
234
234
  box: K,
235
- label: i({
235
+ label: a({
236
236
  title: O,
237
237
  marks: "nodes",
238
238
  isSelectable: c !== void 0
@@ -244,7 +244,7 @@ function U({ nodes: e, valueFormat: t, selected: s, onSelectedChange: c, height:
244
244
  label: t.label,
245
245
  valueLabel: J(t.value),
246
246
  labelWidth: B,
247
- isInspected: a === t.id,
247
+ isInspected: r === t.id,
248
248
  isSelected: s === t.id,
249
249
  isCursor: o === t.id
250
250
  }, t.id))
@@ -391,11 +391,11 @@ function Q({ items: e, width: t, height: n, gap: r = 0 }) {
391
391
  }
392
392
  // packages/charts/src/hierarchy/treemap.tsx
393
393
  var $ = 2, te = 96;
394
- function ne({ items: e, valueFormat: t, selected: n, onSelectedChange: r, height: i = "compact", ...a }) {
395
- let { emptyLabel: u = "No positive values to size the areas", ...m } = a, { locale: y, title: S } = m, { ref: C, width: E, height: D } = b(i), O = d();
394
+ function ne({ items: e, valueFormat: t, selected: r, onSelectedChange: i, height: a = "compact", ...o }) {
395
+ let { emptyLabel: u = "No positive values to size the areas", ...m } = o, { locale: y, title: S } = m, { ref: C, width: E, height: D } = b(a), O = d();
396
396
  if (m.status === "loading") return /* @__PURE__ */ w(p, {
397
397
  ...m,
398
- height: i
398
+ height: a
399
399
  });
400
400
  let k = s(e);
401
401
  if (k !== void 0) return /* @__PURE__ */ w(g, {
@@ -424,11 +424,11 @@ function ne({ items: e, valueFormat: t, selected: n, onSelectedChange: r, height
424
424
  height: D,
425
425
  gap: $
426
426
  });
427
- return /* @__PURE__ */ w(o, {
427
+ return /* @__PURE__ */ w(n, {
428
428
  items: c(A),
429
429
  arrows: "both",
430
- selected: n ?? null,
431
- onSelect: r,
430
+ selected: r ?? null,
431
+ onSelect: i,
432
432
  render: (t, n) => /* @__PURE__ */ T(h, {
433
433
  ...m,
434
434
  figure: t,
@@ -459,7 +459,7 @@ function ne({ items: e, valueFormat: t, selected: n, onSelectedChange: r, height
459
459
  /* @__PURE__ */ w(l, {
460
460
  title: S,
461
461
  items: A,
462
- view: r === void 0 ? void 0 : n
462
+ view: i === void 0 ? void 0 : n
463
463
  }),
464
464
  e.some((e) => e.value === null) && /* @__PURE__ */ w("p", {
465
465
  className: "x153jb6y x1ghz6dp xy8obcc",
@@ -0,0 +1,10 @@
1
+ import { _ as e } from "./param-BdqTpZER.js";
2
+ import { useEffect as t, useState as n, useSyncExternalStore as r } from "react";
3
+ // packages/teaching/src/time/use-tween.ts
4
+ function i(i, a = "regular") {
5
+ let [o] = n(() => e(i));
6
+ return t(() => {
7
+ o.to(i, a);
8
+ }), t(() => o.destroy, [o]), r(o.subscribe, o.get, o.get);
9
+ }
10
+ export { i as t };