@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,63 +1,126 @@
1
- import { l as e, o as t } from "./src-BD6xlvDt.js";
1
+ import { d as e, m as t } from "./src-Dxs3Buo_.js";
2
2
  import { r as n } from "./figure-format-B8kRZMlo.js";
3
+ import { n as r, t as i } from "./clock-DSm5lkNE.js";
3
4
  import "@stylexjs/stylex";
4
- import { createParts as r } from "@ui-sdk/react/primitive";
5
- import { createContext as i, use as a, useEffect as o, useRef as s } from "react";
6
- import { announce as c, bindDrag as l, createChange as u, definePrimitive as d, dragThreshold as f, isRTL as p } from "@ui-sdk/core";
7
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
8
- import { Check as ee, ChevronDown as te } from "lucide-react";
9
- import { SelectTrigger as g, SelectValue as ne } from "@ui-sdk/react/select";
10
- import { clamp as re, fractionOf as _, scrubTo as v, stepBy as y, stepFromKey as b, stepValue as x, valueAt as S } from "@ui-sdk/core/number";
5
+ import { createParts as a } from "@ui-sdk/react/primitive";
6
+ import { createContext as o, use as s, useEffect as c, useRef as l } from "react";
7
+ import { announce as u, bindDrag as d, createChange as f, definePrimitive as p, dragThreshold as m, isRTL as h } from "@ui-sdk/core";
8
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
9
+ import { Check as v, ChevronDown as y } from "lucide-react";
10
+ import { SelectTrigger as ee, SelectValue as te } from "@ui-sdk/react/select";
11
+ import { clamp as b, fractionOf as x, scrubTo as S, stepBy as ne, stepFromKey as re, stepValue as C, valueAt as w } from "@ui-sdk/core/number";
12
+ // packages/teaching/src/time/tween.ts
13
+ var T = {
14
+ instant: 0,
15
+ fast: 140,
16
+ regular: 320,
17
+ slow: 640
18
+ }, ie = 4;
19
+ function E() {}
20
+ function D(e) {
21
+ return 1 - (1 - e) ** ie;
22
+ }
23
+ function O(e, t) {
24
+ let n = new Map(Object.entries(t)), r = Object.entries(e);
25
+ return r.length === n.size && r.every(([e, t]) => n.get(e) === t);
26
+ }
27
+ function k(e, t, n) {
28
+ let r = new Map(Object.entries(e));
29
+ return {
30
+ ...t,
31
+ ...Object.fromEntries(Object.entries(t).map(([e, t]) => {
32
+ let i = r.get(e) ?? t;
33
+ return [e, i + (t - i) * n];
34
+ }))
35
+ };
36
+ }
37
+ function ae(e) {
38
+ let t = /* @__PURE__ */ new Set(), n = {
39
+ shown: e,
40
+ from: e,
41
+ target: e,
42
+ started: -1,
43
+ duration: 0,
44
+ stop: E
45
+ };
46
+ function a(e) {
47
+ n.shown = e;
48
+ for (let e of t) e();
49
+ }
50
+ function o() {
51
+ n.stop(), n.stop = E;
52
+ }
53
+ function s(e) {
54
+ o(), n.target = e, O(n.shown, e) || a(e);
55
+ }
56
+ function c(e) {
57
+ n.started < 0 && (n.started = e);
58
+ let t = Math.min(1, (e - n.started) / n.duration);
59
+ t >= 1 ? (o(), a(n.target)) : a(k(n.from, n.target, D(t)));
60
+ }
61
+ function l(e, t = "regular") {
62
+ O(n.target, e) || (T[t] === 0 || i() ? s(e) : (o(), n.from = n.shown, n.target = e, n.started = -1, n.duration = T[t], n.stop = r(c)));
63
+ }
64
+ return {
65
+ get: () => n.shown,
66
+ to: l,
67
+ jump: s,
68
+ subscribe: (e) => (t.add(e), () => {
69
+ t.delete(e);
70
+ }),
71
+ destroy: o
72
+ };
73
+ }
11
74
  // packages/teaching/src/lesson/lesson-locale.ts
12
- var C = i(null);
13
- function ie() {
14
- return a(C);
75
+ var A = o(null);
76
+ function oe() {
77
+ return s(A);
15
78
  }
16
79
  // packages/teaching/src/lesson/lesson-error.tsx
17
- function w(e, t) {
80
+ function j(e, t) {
18
81
  throw Error(`Lesson "${e}": ${t}`);
19
82
  }
20
- function T(e) {
83
+ function M(e) {
21
84
  throw Error(`${e} must be rendered inside a <Lesson>. Wrap it in <Lesson lesson={…} locale="…">.`);
22
85
  }
23
- function E({ children: e }) {
24
- return /* @__PURE__ */ m("span", {
86
+ function N({ children: e }) {
87
+ return /* @__PURE__ */ g("span", {
25
88
  role: "note",
26
89
  className: "xr5kp14 x1b5ytql",
27
90
  children: e
28
91
  });
29
92
  }
30
93
  // packages/teaching/src/lesson/define-lesson.ts
31
- function D({ name: e, param: t, value: n }) {
94
+ function P({ name: e, param: t, value: n }) {
32
95
  switch (t.kind) {
33
96
  case "number": return typeof n == "number" && Number.isFinite(n) && n >= t.min && n <= t.max ? void 0 : `${e} takes a number from ${t.min} to ${t.max}, not ${String(n)}.`;
34
97
  case "choice": return t.options.some((e) => e.id === n) ? void 0 : `${e} takes one of ${t.options.map((e) => e.id).join(", ")}, not ${String(n)}.`;
35
98
  case "toggle": return typeof n == "boolean" ? void 0 : `${e} takes true or false, not ${String(n)}.`;
36
99
  }
37
100
  }
38
- function O(e, t) {
101
+ function F(e, t) {
39
102
  return Number.isFinite(t.min) && Number.isFinite(t.max) && t.min < t.max ? t.step > 0 ? t.scale === "log" && t.min <= 0 ? `${e} is on a log scale, so its min must be above zero.` : void 0 : `${e} needs a step above zero.` : `${e} needs finite bounds with min below max.`;
40
103
  }
41
- function k(e, t) {
104
+ function I(e, t) {
42
105
  if (t.kind === "number") {
43
- let n = O(e, t);
106
+ let n = F(e, t);
44
107
  if (n !== void 0) return n;
45
108
  }
46
109
  if (t.kind === "choice") {
47
110
  let n = t.options.map((e) => e.id);
48
111
  if (new Set(n).size !== n.length || n.length === 0) return `${e} needs at least one option, each with its own id.`;
49
112
  }
50
- let n = D({
113
+ let n = P({
51
114
  name: e,
52
115
  param: t,
53
116
  value: t.value
54
117
  });
55
118
  return n === void 0 ? void 0 : `the default of ${n}`;
56
119
  }
57
- function A(e) {
120
+ function L(e) {
58
121
  return e.find((t, n) => e.indexOf(t) !== n);
59
122
  }
60
- function j(e) {
123
+ function R(e) {
61
124
  let t = /* @__PURE__ */ new Set();
62
125
  return {
63
126
  view: new Proxy(e, { get(e, n, r) {
@@ -66,12 +129,12 @@ function j(e) {
66
129
  names: t
67
130
  };
68
131
  }
69
- function M(e, t) {
132
+ function z(e, t) {
70
133
  let n = new Map(Object.entries(t));
71
134
  return (e.states ?? []).flatMap((t) => Object.entries(t.values).flatMap(([r, i]) => {
72
135
  let a = n.get(r), o = `state "${t.id}" of beat "${e.id}"`;
73
136
  if (a === void 0) return [`${o} sets "${r}", which is not a param.`];
74
- let s = D({
137
+ let s = P({
75
138
  name: r,
76
139
  param: a,
77
140
  value: i
@@ -79,30 +142,34 @@ function M(e, t) {
79
142
  return s === void 0 ? [] : [`${o}: ${s}`];
80
143
  }));
81
144
  }
82
- function N(e, t) {
83
- let n = e.steps ?? 0, r = Number.isInteger(n) && n >= 0, i = A((e.states ?? []).map((e) => e.id));
145
+ function B(e, t) {
146
+ let n = e.steps ?? 0, r = Number.isInteger(n) && n >= 0, i = L((e.states ?? []).map((e) => e.id)), a = (e.params ?? []).find((e) => !Object.hasOwn(t, e));
84
147
  return [
85
148
  ...r ? [] : [`beat "${e.id}" needs a whole number of steps, not ${n}.`],
86
149
  ...i === void 0 ? [] : [`beat "${e.id}" has two states with the id "${i}".`],
87
- ...M(e, t)
150
+ ...a === void 0 ? [] : [`beat "${e.id}" owns "${a}", which is not a param.`],
151
+ ...z(e, t)
88
152
  ];
89
153
  }
90
- function P({ params: e, derivedNames: t, beats: n }) {
91
- let r = new Set(Object.keys(e)), i = t.find((e) => r.has(e)), a = A(n.map((e) => e.id));
154
+ function V(e) {
155
+ return e.params ?? [...new Set((e.states ?? []).flatMap((e) => Object.keys(e.values)))];
156
+ }
157
+ function H({ params: e, derivedNames: t, beats: n }) {
158
+ let r = new Set(Object.keys(e)), i = t.find((e) => r.has(e)), a = L(n.map((e) => e.id));
92
159
  return [
93
- ...Object.entries(e).flatMap(([e, t]) => k(e, t) ?? []),
160
+ ...Object.entries(e).flatMap(([e, t]) => I(e, t) ?? []),
94
161
  ...i === void 0 ? [] : [`"${i}" is declared as both a param and a derived value.`],
95
162
  ...a === void 0 ? [] : [`two beats share the id "${a}".`],
96
- ...n.flatMap((t) => N(t, e))
163
+ ...n.flatMap((t) => B(t, e))
97
164
  ];
98
165
  }
99
- function F(e) {
100
- let { id: t, title: n, params: r } = e, i = Object.entries(e.derived ?? {}), a = e.beats ?? [], o = Object.keys(r), s = i.map(([e]) => e), [c] = P({
166
+ function U(e) {
167
+ let { id: t, title: n, params: r } = e, i = Object.entries(e.derived ?? {}), a = e.beats ?? [], o = Object.keys(r), s = i.map(([e]) => e), [c] = H({
101
168
  params: r,
102
169
  derivedNames: s,
103
170
  beats: a
104
171
  });
105
- c !== void 0 && w(t, c);
172
+ c !== void 0 && j(t, c);
106
173
  let l = Object.fromEntries(Object.entries(r).map(([e, t]) => [e, t.value])), u = Object.fromEntries(s.map((e) => [e, NaN]));
107
174
  function d(e) {
108
175
  let n = {
@@ -112,8 +179,8 @@ function F(e) {
112
179
  },
113
180
  results: u
114
181
  }, r = new Set(o), a = i.map(([e, i]) => {
115
- let { view: a, names: o } = j(n.known), s = i.from(a), c = [...o].find((e) => !r.has(e));
116
- return c !== void 0 && w(t, `derived "${e}" reads "${c}", which is not a param or a derived value declared before it.`), typeof s != "number" && w(t, `derived "${e}" must return a number.`), r.add(e), n.known = {
182
+ let { view: a, names: o } = R(n.known), s = i.from(a), c = [...o].find((e) => !r.has(e));
183
+ return c !== void 0 && j(t, `derived "${e}" reads "${c}", which is not a param or a derived value declared before it.`), typeof s != "number" && j(t, `derived "${e}" must return a number.`), r.add(e), n.known = {
117
184
  ...n.known,
118
185
  [e]: s
119
186
  }, n.results = {
@@ -148,7 +215,7 @@ function F(e) {
148
215
  reads: m
149
216
  };
150
217
  }
151
- function I(e) {
218
+ function W(e) {
152
219
  return {
153
220
  nodes: [...Object.entries(e.params).map(([e, t]) => ({
154
221
  name: e,
@@ -166,21 +233,21 @@ function I(e) {
166
233
  };
167
234
  }
168
235
  // packages/teaching/src/lesson/lesson-context.ts
169
- var L = i(null);
170
- function R(e) {
171
- return a(L) ?? T(e);
236
+ var G = o(null);
237
+ function K(e) {
238
+ return s(G) ?? M(e);
172
239
  }
173
- function z(e, t) {
240
+ function q(e, t) {
174
241
  let n = { scope: e };
175
242
  for (; n.scope !== null && n.scope.lesson !== t;) n.scope = n.scope.outer;
176
243
  return n.scope;
177
244
  }
178
245
  // packages/teaching/src/lesson/bound-value.tsx
179
- var B = 240, V = {
246
+ var se = 240, ce = {
180
247
  step: .01,
181
248
  large: .1,
182
249
  small: .001
183
- }, H = [
250
+ }, le = [
184
251
  "ArrowLeft",
185
252
  "ArrowRight",
186
253
  "ArrowUp",
@@ -190,23 +257,23 @@ var B = 240, V = {
190
257
  "Home",
191
258
  "End"
192
259
  ];
193
- function U({ min: e, max: t, step: n }) {
260
+ function J({ min: e, max: t, step: n }) {
194
261
  return {
195
262
  min: e,
196
263
  max: t,
197
264
  step: n
198
265
  };
199
266
  }
200
- function W(e, t) {
201
- let n = U(t);
202
- return v(S(re(e, 0, 1), n, t.scale ?? "linear"), n).value;
267
+ function Y(e, t) {
268
+ let n = J(t);
269
+ return S(w(b(e, 0, 1), n, t.scale ?? "linear"), n).value;
203
270
  }
204
- function G(e, t, n) {
271
+ function ue(e, t, n) {
205
272
  if (t.bound !== void 0) return t.bound === "min" ? n.min : n.max;
206
- let r = U(n), i = W(_(e, r, "log") + t.direction * V[t.size], n);
207
- return i === e ? x(e, t.direction, r) : i;
273
+ let r = J(n), i = Y(x(e, r, "log") + t.direction * ce[t.size], n);
274
+ return i === e ? C(e, t.direction, r) : i;
208
275
  }
209
- var K = d({
276
+ var de = p({
210
277
  name: "bound-value",
211
278
  options: {
212
279
  value: "number",
@@ -225,7 +292,7 @@ var K = d({
225
292
  }),
226
293
  sync: (e) => e.value === void 0 ? {} : { value: e.value },
227
294
  api: (e) => {
228
- let { store: t } = e, n = u(e), r = null;
295
+ let { store: t } = e, n = f(e), r = null;
229
296
  e.onDestroy(() => r?.());
230
297
  function i(e, r, i) {
231
298
  return e !== t.get().value && n("value", e, i === void 0 ? { reason: r } : {
@@ -238,27 +305,27 @@ var K = d({
238
305
  setValue(t) {
239
306
  let { min: n, max: r } = e.options(), a = Number(t);
240
307
  if (!Number.isFinite(a) || a < n || a > r) throw Error(`Give a number between ${n} and ${r}.`);
241
- return i(v(a, U(e.options())).value, "imperative");
308
+ return i(S(a, J(e.options())).value, "imperative");
242
309
  },
243
310
  keydown(n, r) {
244
- let a = b(n, { dir: p(r) ? "rtl" : "ltr" });
311
+ let a = re(n, { dir: h(r) ? "rtl" : "ltr" });
245
312
  if (a === null || n.defaultPrevented) return;
246
313
  n.preventDefault();
247
314
  let o = e.options(), { value: s } = t.get();
248
- i(o.scale === "log" ? G(s, a, o) : y(s, a, U(o)), "step-key", n);
315
+ i(o.scale === "log" ? ue(s, a, o) : ne(s, a, J(o)), "step-key", n);
249
316
  },
250
317
  pointerdown(n, a) {
251
318
  if (n.button !== 0) return;
252
319
  r?.();
253
- let o = t.get().value, s = p(a) ? -1 : 1, c = _(o, U(e.options()), e.options().scale ?? "linear"), u = 0;
254
- r = l(a, n, {
255
- threshold: f,
320
+ let o = t.get().value, s = h(a) ? -1 : 1, c = x(o, J(e.options()), e.options().scale ?? "linear"), l = 0;
321
+ r = d(a, n, {
322
+ threshold: m,
256
323
  cancelOnEscape: !0,
257
324
  onStart: () => {
258
325
  t.set({ isDragging: !0 });
259
326
  },
260
327
  onMove: ({ movementX: t, event: n }) => {
261
- u += t * s, i(W(c + u / B, e.options()), "drag", n);
328
+ l += t * s, i(Y(c + l / se, e.options()), "drag", n);
262
329
  },
263
330
  onEnd: (e, n) => {
264
331
  t.set({ isDragging: !1 }), n && i(o, "drag", e);
@@ -270,7 +337,7 @@ var K = d({
270
337
  slots: (e) => ({ root: e({
271
338
  role: "slider",
272
339
  focus: "tab-stop",
273
- keys: [...H],
340
+ keys: [...le],
274
341
  state: (e, { api: t }) => ({
275
342
  text: t.describe(e.value),
276
343
  isDragging: e.isDragging
@@ -291,16 +358,16 @@ var K = d({
291
358
  }
292
359
  }) }),
293
360
  agent: { actions: ["setValue"] }
294
- }), q = r(K, { root: "span" }).Root;
295
- function J({ min: e, max: t, step: n, scale: r, value: i }) {
361
+ }), fe = a(de, { root: "span" }).Root;
362
+ function pe({ min: e, max: t, step: n, scale: r, value: i }) {
296
363
  if (!Number.isFinite(e) || !Number.isFinite(t) || e >= t) return "BoundValue needs finite bounds with min below max.";
297
364
  if (!Number.isFinite(n) || n < 0) return "BoundValue needs a step of zero or more.";
298
365
  if (r === "log" && e <= 0) return "A log BoundValue needs a min above zero.";
299
366
  if (i !== void 0 && !(Number.isFinite(i) && i >= e && i <= t)) return `BoundValue ${i} lies outside ${e} to ${t}.`;
300
367
  }
301
- function Y({ label: e, locale: t, format: r, ...i }) {
302
- let a = J(i);
303
- return a === void 0 ? /* @__PURE__ */ m(q, {
368
+ function X({ label: e, locale: t, format: r, ...i }) {
369
+ let a = pe(i);
370
+ return a === void 0 ? /* @__PURE__ */ g(fe, {
304
371
  ...i,
305
372
  describe: (e) => n({
306
373
  value: e,
@@ -312,60 +379,60 @@ function Y({ label: e, locale: t, format: r, ...i }) {
312
379
  "aria-valuemax": i.max,
313
380
  "aria-orientation": "horizontal",
314
381
  className: "xt0psk2 x1ok0vyi xbixft xss6m8b xk4h15q xuxw1ft x7eptgl x87ps6o xx69xxh xujl8zx xi2nhp4 xewurvo x11xz5oc x1jdncgf xif5pkx x81ozek xxxv2na x13qnu6 x9v5kkp x19rmrnh x7s97pk",
315
- render: (e, { text: t }) => /* @__PURE__ */ m("span", {
382
+ render: (e, { text: t }) => /* @__PURE__ */ g("span", {
316
383
  ...e,
317
384
  children: t
318
385
  })
319
- }) : /* @__PURE__ */ m("span", {
386
+ }) : /* @__PURE__ */ g("span", {
320
387
  className: "xr5kp14 x1b5ytql",
321
388
  children: a
322
389
  });
323
390
  }
324
391
  // packages/teaching/src/lesson/inline-choice.tsx
325
- var ae = 14;
326
- function oe({ param: t, value: n, isDisabled: r, onChange: i }) {
327
- let a = t.options.map((e) => ({
392
+ var me = 14;
393
+ function he({ param: e, value: n, isDisabled: r, onChange: i }) {
394
+ let a = e.options.map((e) => ({
328
395
  value: e.id,
329
396
  label: e.label
330
397
  }));
331
- return /* @__PURE__ */ h(e.Root, {
398
+ return /* @__PURE__ */ _(t.Root, {
332
399
  value: n,
333
400
  items: a,
334
401
  disabled: r,
335
402
  onValueChange: (e, t) => {
336
403
  e !== null && i(e, t);
337
404
  },
338
- children: [/* @__PURE__ */ h(g, {
339
- "aria-label": t.label,
405
+ children: [/* @__PURE__ */ _(ee, {
406
+ "aria-label": e.label,
340
407
  disabled: r,
341
408
  className: "x3nfvp2 x1pha0wt xfko13i x1717udv x1ghz6dp xc342km x1ok0vyi xjbqb8w xbixft xjb2p0i x1qlqyl8 x15bjb6t xk4h15q xuxw1ft x1ypdohk xujl8zx xi2nhp4 xewurvo x11xz5oc x1jdncgf xif5pkx x1m8qfh3 x47ym49 x13qnu6 x9v5kkp x19rmrnh x7s97pk",
342
- children: [/* @__PURE__ */ m(ne, {}), !r && /* @__PURE__ */ m(te, {
343
- size: ae,
409
+ children: [/* @__PURE__ */ g(te, {}), !r && /* @__PURE__ */ g(y, {
410
+ size: me,
344
411
  "aria-hidden": !0,
345
412
  className: "xamitd3 x153jb6y"
346
413
  })]
347
- }), /* @__PURE__ */ m(e.Popup, {
414
+ }), /* @__PURE__ */ g(t.Popup, {
348
415
  align: "start",
349
- children: /* @__PURE__ */ m(e.List, { children: a.map((t) => /* @__PURE__ */ h(e.Item, {
350
- value: t.value,
351
- children: [/* @__PURE__ */ m(e.ItemText, { children: t.label }), /* @__PURE__ */ m(e.ItemIndicator, { children: /* @__PURE__ */ m(ee, {
416
+ children: /* @__PURE__ */ g(t.List, { children: a.map((e) => /* @__PURE__ */ _(t.Item, {
417
+ value: e.value,
418
+ children: [/* @__PURE__ */ g(t.ItemText, { children: e.label }), /* @__PURE__ */ g(t.ItemIndicator, { children: /* @__PURE__ */ g(v, {
352
419
  size: 16,
353
420
  "aria-hidden": !0
354
421
  }) })]
355
- }, t.value)) })
422
+ }, e.value)) })
356
423
  })]
357
424
  });
358
425
  }
359
426
  // packages/teaching/src/lesson/param.tsx
360
- var se = 700, X = {
427
+ var ge = 700, Z = {
361
428
  on: "on",
362
429
  off: "off"
363
430
  };
364
- function Z(e, t) {
431
+ function Q(e, t) {
365
432
  let n = new Map(Object.entries(e.lesson.params)).get(t);
366
433
  return n === void 0 ? { error: `Lesson "${e.lesson.id}" has no param "${t}". Its params: ${Object.keys(e.lesson.params).join(", ")}.` } : { param: n };
367
434
  }
368
- function Q({ param: e, value: t, locale: r, labels: i }) {
435
+ function $({ param: e, value: t, locale: r, labels: i }) {
369
436
  switch (e.kind) {
370
437
  case "number": return n({
371
438
  value: typeof t == "number" ? t : null,
@@ -376,22 +443,22 @@ function Q({ param: e, value: t, locale: r, labels: i }) {
376
443
  case "toggle": return t === !0 ? i.on : i.off;
377
444
  }
378
445
  }
379
- function ce({ name: e }) {
380
- let n = R("Param"), r = Z(n, e);
381
- if ("error" in r) return /* @__PURE__ */ m(E, { children: r.error });
382
- let { param: i } = r, a = n.state.values[e], { isReadOnly: o } = n.state;
446
+ function _e({ name: t }) {
447
+ let n = K("Param"), r = Q(n, t);
448
+ if ("error" in r) return /* @__PURE__ */ g(N, { children: r.error });
449
+ let { param: i } = r, a = n.state.values[t], { isReadOnly: o } = n.state;
383
450
  switch (i.kind) {
384
- case "number": return o ? /* @__PURE__ */ m("span", {
451
+ case "number": return o ? /* @__PURE__ */ g("span", {
385
452
  className: "xss6m8b xk4h15q xuxw1ft xbixft",
386
- children: Q({
453
+ children: $({
387
454
  param: i,
388
455
  value: a,
389
456
  locale: n.locale,
390
- labels: X
457
+ labels: Z
391
458
  })
392
- }) : /* @__PURE__ */ m(Y, {
459
+ }) : /* @__PURE__ */ g(X, {
393
460
  value: typeof a == "number" ? a : i.value,
394
- onValueChange: (t, r) => n.api.apply(e, t, r),
461
+ onValueChange: (e, r) => n.api.apply(t, e, r),
395
462
  min: i.min,
396
463
  max: i.max,
397
464
  step: i.step,
@@ -400,41 +467,41 @@ function ce({ name: e }) {
400
467
  format: i.format,
401
468
  label: i.label
402
469
  });
403
- case "choice": return /* @__PURE__ */ m(oe, {
470
+ case "choice": return /* @__PURE__ */ g(he, {
404
471
  param: i,
405
472
  value: typeof a == "string" ? a : i.value,
406
473
  isDisabled: o,
407
- onChange: (t, r) => n.api.apply(e, t, r)
474
+ onChange: (e, r) => n.api.apply(t, e, r)
408
475
  });
409
- case "toggle": return /* @__PURE__ */ m("span", {
476
+ case "toggle": return /* @__PURE__ */ g("span", {
410
477
  className: "x3nfvp2 xxymvpz",
411
- children: /* @__PURE__ */ m(t.Root, {
478
+ children: /* @__PURE__ */ g(e.Root, {
412
479
  checked: a === !0,
413
- onCheckedChange: (t, r) => n.api.apply(e, t, r),
480
+ onCheckedChange: (e, r) => n.api.apply(t, e, r),
414
481
  disabled: o,
415
482
  "aria-label": i.label,
416
- children: /* @__PURE__ */ m(t.Thumb, {})
483
+ children: /* @__PURE__ */ g(e.Thumb, {})
417
484
  })
418
485
  });
419
486
  }
420
487
  }
421
- function le(e, t) {
422
- let n = s(e);
423
- o(() => {
488
+ function ve(e, t) {
489
+ let n = l(e);
490
+ c(() => {
424
491
  if (t || n.current === e) return;
425
492
  let r = globalThis.setTimeout(() => {
426
- n.current = e, c(e);
427
- }, se);
493
+ n.current = e, u(e);
494
+ }, ge);
428
495
  return () => globalThis.clearTimeout(r);
429
496
  }, [e, t]);
430
497
  }
431
- function $({ name: e, labels: t }) {
432
- let r = R("Value"), i = new Map(Object.entries(r.lesson.derived)).get(e), a = i === void 0 ? Z(r, e) : void 0, o = r.values[e], s = i === void 0 ? a !== void 0 && "param" in a ? Q({
498
+ function ye({ name: e, labels: t }) {
499
+ let r = K("Value"), i = new Map(Object.entries(r.lesson.derived)).get(e), a = i === void 0 ? Q(r, e) : void 0, o = r.values[e], s = i === void 0 ? a !== void 0 && "param" in a ? $({
433
500
  param: a.param,
434
501
  value: o,
435
502
  locale: r.locale,
436
503
  labels: {
437
- ...X,
504
+ ...Z,
438
505
  ...t
439
506
  }
440
507
  }) : void 0 : n({
@@ -442,9 +509,9 @@ function $({ name: e, labels: t }) {
442
509
  locale: r.locale,
443
510
  format: i.format
444
511
  }), c = i?.label ?? (a !== void 0 && "param" in a ? a.param.label : e);
445
- return le(s === void 0 ? "" : `${c}: ${s}`, r.state.playing !== null), s === void 0 ? /* @__PURE__ */ m(E, { children: `Lesson "${r.lesson.id}" has no param or derived value "${e}".` }) : /* @__PURE__ */ m("span", {
512
+ return ve(s === void 0 ? "" : `${c}: ${s}`, r.state.playing !== null), s === void 0 ? /* @__PURE__ */ g(N, { children: `Lesson "${r.lesson.id}" has no param or derived value "${e}".` }) : /* @__PURE__ */ g("span", {
446
513
  className: "xss6m8b xk4h15q xuxw1ft",
447
514
  children: s
448
515
  });
449
516
  }
450
- export { L as a, F as c, E as d, w as f, ie as h, Y as i, I as l, C as m, $ as n, z as o, T as p, Z as r, R as s, ce as t, D as u };
517
+ export { ae as _, G as a, V as c, P as d, N as f, oe as g, A as h, X as i, U as l, M as m, ye as n, q as o, j as p, Q as r, K as s, _e as t, W as u, D as v };
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./use-scroll-tab-index-Dxpdh4W7.js";
2
- import { n as t, r as n } from "./code-block-DioAM2bZ.js";
2
+ import { n as t, r as n } from "./code-block-BZsY2sh3.js";
3
3
  import { t as r } from "./viewer-styles-DsFYri4K.js";
4
4
  import * as i from "@stylexjs/stylex";
5
5
  import { useCallback as a, useState as o } from "react";
@@ -1,4 +1,4 @@
1
- import { n as e } from "./plot-width-DcqtSgzb.js";
1
+ import { n as e } from "./plot-width-D3hTycYX.js";
2
2
  import * as t from "@stylexjs/stylex";
3
3
  import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
4
4
  // packages/charts/src/plot/plot-axes.tsx