@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
@@ -12,12 +12,13 @@ For a scene whose box is a coordinate plane. All positions and values are in dat
12
12
  label. Leave the axes out of a diagram whose positions mean nothing.
13
13
  - `SceneCurve`: `of` (a function of x) or `points` (`[x, y]` pairs, x increasing), `resolution`, `fillTo`, `isDashed`
14
14
  for a modelled curve, `thickness`. A new `of` eases from the old shape.
15
- - `ScenePoint`: `at`, `text`, and `sets` to make it draggable and movable by the arrow keys. `sets` names the number
16
- params its position writes, as `{ x: 'bias' }`; a move sets them in one change, on each param's step grid and inside
17
- its range. `along` (`'x'`, `'y'` or a function of x) limits the move, and a point bound on one axis moves along it.
18
- `snap` sets the step of an axis no param owns. The point stays at `at`, read from the lesson. Reach for
19
- `onMove(position, details)` only when a move is not a plain param write, and set a lesson param there, never component
20
- state.
15
+ - `ScenePoint`: `at`, `text`, and `sets` to make it a slider: the reader drags it, or reaches it with Tab and moves it
16
+ with the arrow keys, Home and End, and it speaks each bound value in its param's format. On a point that sets `x` and
17
+ `y`, Left and Right move x and Up and Down move y. `sets` names the number params its position writes, as
18
+ `{ x: 'bias' }`; a move sets them in one change, on each param's step grid and inside its range. `along` (`'x'`, `'y'`
19
+ or a function of x) limits the move, and a point bound on one axis moves along it. `snap` sets the step of an axis no
20
+ param owns. The point stays at `at`, read from the lesson. Reach for `onMove(position, details)` only when a move is
21
+ not a plain param write, and set a lesson param there, never component state.
21
22
  - `SceneVector`: `to`, `from` (defaults to the origin), `text`, `isDashed` for a step not yet taken.
22
23
  - `SceneProjection`: `of` (a point's id) or `at`, dashed lines to both axes with the values written there.
23
24
  - `SceneRegion`: one of `between` (two x values), `above`, `below` (a y value) or `points` (a polygon). Keep it pale.
@@ -63,14 +64,17 @@ export function ConfidenceScene(): ReactNode {
63
64
  - `SceneCard`: `rank` (`'A'`, `'2'` to `'10'`, `'J'`, `'Q'`, `'K'`) with `suit` (`'heart'`, `'diamond'`, `'spade'`,
64
65
  `'club'`) for a playing card, or `text` for a generic card. `isFaceUp` turns it over (default true), `lift` raises it,
65
66
  `tilt` leans it, `size` is `'small'`, `'medium'` or `'large'`, and `children` go on the face, even a chart. Its tone
66
- defaults to its suit's (`suitTones`), and its back stays neutral so it hides the suit. A face-down playing card reads
67
- "A card, face down" unless you give it a `label`. Place it with `at`, or list it in one `SceneStack`.
67
+ defaults to its suit's (`suitTones`), and its back stays neutral so it hides the suit. A face-down card renders only
68
+ its back and reads "A card, face down", so leave out `label` and keep its `id` free of its rank and suit. To turn it
69
+ when pressed, give the `Scene` `selected={null}` and `onSelectedChange` (see the scene reference). Place it with `at`,
70
+ or list it in one `SceneStack`.
68
71
  - `SceneStack`: `id`, `at`, `cards` (ids, bottom of a pile first), `layout` (`'pile'`, `'fan'`, `'row'`, `'column'`),
69
72
  `gap`, `size`, `stagger`. Move a card between stacks by moving its id from one list to the other. `stagger`
70
73
  (`'short'`, `'regular'`, `'long'`) deals in turn: cards that arrive or move in the same update start that step apart,
71
74
  in stack order, and a lone card starts at once. Use it, not a card's `delay`, to deal. A card in two stacks, or a card
72
75
  with no place, shows an error.
73
- - `SceneSlot`: an empty bay a card is dealt to, with `text`, `size` and `isActive` for the one that matters now.
76
+ - `SceneSlot`: an empty bay a card is dealt to, with `text`, `size` and `isActive` for the one that matters now. A
77
+ slot's `isActive` only draws its outline and tint; nothing else recedes.
74
78
 
75
79
  A deal is two lists of ids. Changing the hand moves the cards, flips them and deals them in turn, with no motion code:
76
80
 
@@ -111,9 +115,10 @@ export function HandScene(): ReactNode {
111
115
 
112
116
  `SceneCells` draws a small vector or matrix: `values` (a flat list is one row; a list of lists is a matrix) or `cells`
113
117
  (`{ id?, text?, value?, label? }` rows), `direction`, `format`, `palette` (`'sequential'` or `'diverging'`) with
114
- `domain`, `rowLabels`, `columnLabels`, `highlight` (`{ row?, column? }`) and `size`. A cell's id is
115
- `${id}.${row}.${column}`, so a wire or callout can name one. Changed values ease. For a large grid with axes, use the
116
- `Matrix` chart.
118
+ `domain`, `rowLabels`, `columnLabels` (they wrap, and a long word overhangs rather than being cut), `highlight`
119
+ (`{ row?, column? }`) and `size`. A cell also takes `tone`, such as its suit's hue, and `isMuted` to gray one already
120
+ dealt. A cell's id is `${id}.${row}.${column}`, so a wire or callout can name one. Changed values ease. For a large grid
121
+ with axes, use the `Matrix` chart.
117
122
 
118
123
  ```tsx
119
124
  /** The weights and the bias as cells, shaded around zero. */
@@ -112,8 +112,8 @@ export function NeuronScene(): ReactNode {
112
112
  | `focus` | The camera: an id or ids to zoom to, or `null` for the whole box. |
113
113
  | `pace` | `'instant'`, `'fast'`, `'regular'` or `'slow'`. Reduced motion always jumps. |
114
114
  | `weightMax` | The wire weight drawn thickest. Every weight must lie within plus or minus it. Defaults to 1. |
115
- | `selected`, `onSelectedChange` | Selection, as on a chart. |
116
- | `minWidth`, `labels` | Rarely needed. Below its width the scene scrolls inside its own frame. |
115
+ | `selected`, `onSelectedChange` | Selection, as on a chart, and presses: see Pressable objects below. |
116
+ | `minWidth`, `labels` | Leave `minWidth` out: the derived width is the narrowest at which the drawing is legible. |
117
117
 
118
118
  An object placed outside the box, a weight beyond `weightMax`, or a wire to an id that does not exist shows an error in
119
119
  the figure instead of a guess.
@@ -131,7 +131,9 @@ readout and assistive technology, and makes the object an item the arrow keys re
131
131
  keeps its state as the node moves.
132
132
  - `SceneWire`: `from`, `to`, `id` (defaults to `from>to`), `weight` (thickness by size, hue by sign), `text`, `textSide`
133
133
  (`'auto'` above a level wire and right of an upright one, or a side), `shape` (`'straight'`, `'curve'`, `'elbow'`),
134
- `isDashed` for a modelled connection, `hasArrow` (default true).
134
+ `isDashed` for a modelled connection, `hasArrow` (default true), and `bend`: pixels a straight wire's middle bows off
135
+ its line, positive above an across wire. A wire does not avoid other objects, so bend one that would cross a node
136
+ between its ends, or put one end on another row.
135
137
  - `SceneGroup`: `id`, `around` (ids), `label`, `text`, `padding`. An outline that follows its members.
136
138
  - `SceneBracket`: `of` (ids), `side` (`'top'`, `'right'`, `'bottom'`, `'left'`), `label`, `text`.
137
139
  - `SceneCallout`: `to` (an id), `side` (`'auto'` or a side), `width`, and one sentence of prose as children.
@@ -142,6 +144,26 @@ update start one `step` apart (`'short'`, `'regular'` or `'long'`, default `'reg
142
144
  that changes alone starts at once. Cards take it from their `SceneStack`. `delay` is a fixed wait on every change, in
143
145
  milliseconds or as `{ index, step }`; it also delays a lone move, so prefer `stagger` for a deal or a cascade.
144
146
 
147
+ ## Pressable objects
148
+
149
+ A card that turns or a node that acts when pressed needs no handler of its own. Give the `Scene` `onSelectedChange`: a
150
+ press on a labelled object, or Enter or Space on the keyboard cursor, calls it with that object's id. `selected={null}`
151
+ keeps the press an action rather than a lasting selection, and a pointer press then dims nothing. Say what the press
152
+ does in `labels.press`, which ends the plot's accessible name (default "Press Enter or Space to activate a part.").
153
+
154
+ ```tsx
155
+ <Scene
156
+ title="The first card"
157
+ x={[0, 2]}
158
+ y={[0, 1]}
159
+ selected={null}
160
+ onSelectedChange={() => set('isRevealed', !isRevealed)}
161
+ labels={{ press: 'Press Enter or Space to turn the card over.' }}
162
+ >
163
+ <SceneCard id="first" at={[1, 0.5]} rank="Q" suit="heart" isFaceUp={isRevealed} />
164
+ </Scene>
165
+ ```
166
+
145
167
  ## Identity
146
168
 
147
169
  An id names a thing, not a place. Keep it while the thing moves, turns or changes value, and change it only when the
@@ -1,270 +0,0 @@
1
- import { r as e } from "./tokens.stylex-dF5CACEJ.js";
2
- import { t } from "./accessibility-P89UG9-r.js";
3
- import { t as n } from "./src-CpdJlDhO.js";
4
- import { d as r, m as i, u as a } from "./src-CExIrXPC.js";
5
- import { C as o, b as s, c } from "./plot-layout-CZVSJ-le.js";
6
- import * as l from "@stylexjs/stylex";
7
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
8
- import { formatNumber as f } from "@ui-sdk/core/number";
9
- // packages/charts/src/chart-data.tsx
10
- function p({ label: e, columns: n, rows: r }) {
11
- return /* @__PURE__ */ u("div", {
12
- ...l.props(t.hidden),
13
- children: /* @__PURE__ */ d("table", { children: [
14
- /* @__PURE__ */ u("caption", { children: e }),
15
- /* @__PURE__ */ u("thead", { children: /* @__PURE__ */ u("tr", { children: n.map((e) => /* @__PURE__ */ u("th", {
16
- scope: "col",
17
- children: e.label
18
- }, e.id)) }) }),
19
- /* @__PURE__ */ u("tbody", { children: r.map((e) => /* @__PURE__ */ u("tr", { children: n.map((t, n) => n === 0 ? /* @__PURE__ */ u("th", {
20
- scope: "row",
21
- children: e.values[n]
22
- }, t.id) : /* @__PURE__ */ u("td", { children: e.values[n] }, t.id)) }, e.id)) })
23
- ] })
24
- });
25
- }
26
- // packages/charts/src/chart-inspection.tsx
27
- var m = {
28
- kzqmXN: "x1xc55vz",
29
- kZKoxP: "xdk7pt",
30
- kmuXW: "x2lah0s",
31
- $$css: !0
32
- }, h = {
33
- swatch: (e) => [
34
- m,
35
- {
36
- kWkggS: e == null ? e : "xl8spv7",
37
- $$css: !0
38
- },
39
- { "--x-backgroundColor": e ?? void 0 }
40
- ],
41
- inspector: {
42
- k1xSpc: "xrvj5dj x1boff50",
43
- kOIVth: "xunmzkg",
44
- kVAEAm: "x10l6tqk",
45
- k87sOh: "x1ridm32",
46
- kB7OPa: "x9f619",
47
- kfzvcC: "x47corl",
48
- kmVPX3: "x69ldcm",
49
- kMzoRj: "xmkeg23",
50
- ksu8eU: "x1y0btm7",
51
- kVAM5u: "x1ey3b81",
52
- kaIpWk: "x1ok0vyi",
53
- kGVxlE: "x1ghndwu",
54
- kWkggS: "xpvm0e4",
55
- kMwMTN: "xbixft",
56
- kGuDYH: "xy8obcc",
57
- kLWn49: "xas2l8k",
58
- kcqcaj: "xss6m8b",
59
- kHjlTd: "xj0a0fe",
60
- $$css: !0
61
- },
62
- summaryInspector: {
63
- k1xSpc: "xrvj5dj x1xnx9c1",
64
- $$css: !0
65
- },
66
- position: (e, t) => [{
67
- kbCHJM: e == null ? e : "xgq9j65",
68
- kzqmXN: t == null ? t : "x5lhr3w",
69
- $$css: !0
70
- }, {
71
- "--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
72
- "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
73
- }]
74
- }, g = 4;
75
- function _() {
76
- return /* @__PURE__ */ u("ul", {
77
- "aria-hidden": !0,
78
- inert: !0,
79
- className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k",
80
- children: Array.from({ length: g }, (t, n) => /* @__PURE__ */ d("li", {
81
- className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe x1f394nn x43dure",
82
- children: [/* @__PURE__ */ u("span", { ...l.props(h.swatch(e.line)) }), /* @__PURE__ */ d("span", {
83
- className: "x1cqoux5 xeuugli",
84
- children: [
85
- /* @__PURE__ */ u(r, {}),
86
- /* @__PURE__ */ u("span", {
87
- className: "x1s85apg xannxpe",
88
- children: /* @__PURE__ */ u(r, {})
89
- }),
90
- /* @__PURE__ */ u("span", {
91
- className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b",
92
- children: /* @__PURE__ */ u(r, {})
93
- })
94
- ]
95
- })]
96
- }, n))
97
- });
98
- }
99
- function v({ title: e, detail: t }) {
100
- return t === void 0 ? e : /* @__PURE__ */ d("span", {
101
- "aria-label": e,
102
- className: "x1lliihq xb3r6kr xlyipyv xuxw1ft",
103
- children: [/* @__PURE__ */ u("span", {
104
- className: "xt0psk2 x1boff50",
105
- children: e
106
- }), /* @__PURE__ */ u("span", {
107
- className: "x1s85apg xfodcyb",
108
- children: t
109
- })]
110
- });
111
- }
112
- function y({ label: e, summary: t, rows: n, notes: r = [] }) {
113
- if (e !== void 0) return [
114
- e,
115
- t,
116
- ...n.map((e) => `${e.label}: ${e.value}`),
117
- ...r
118
- ].filter((e) => e !== void 0).join(" · ");
119
- }
120
- function b({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a, x: s, width: c, offset: f = 16, notes: p = [], hasSeriesSummary: m = !1, hasLegend: g = !0 }) {
121
- let _ = g && !m, v = Math.min(260, c), b = s > c / 2 ? s - v - f : s + f, x = Math.max(0, Math.min(c - v, b));
122
- return /* @__PURE__ */ d("div", {
123
- className: "xeuugli",
124
- children: [
125
- _ && /* @__PURE__ */ d("div", {
126
- className: "xrvj5dj xeuugli",
127
- children: [i !== void 0 && /* @__PURE__ */ u("ul", {
128
- "aria-hidden": !0,
129
- inert: !0,
130
- className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc xlshs6z x47corl",
131
- children: i.map((e) => /* @__PURE__ */ d("li", {
132
- className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
133
- children: [/* @__PURE__ */ u(o, {
134
- tone: e.tone,
135
- shape: e.shape
136
- }), /* @__PURE__ */ d("span", {
137
- className: "xeuugli",
138
- children: [e.label, /* @__PURE__ */ u("span", { className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b" })]
139
- })]
140
- }, e.id))
141
- }), /* @__PURE__ */ u("ul", {
142
- "aria-label": "Legend",
143
- className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc",
144
- children: r.map((e) => /* @__PURE__ */ d("li", {
145
- className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
146
- children: [/* @__PURE__ */ u(o, {
147
- tone: e.tone,
148
- shape: e.shape
149
- }), /* @__PURE__ */ d("span", {
150
- className: "xeuugli",
151
- children: [e.label, /* @__PURE__ */ u("span", {
152
- className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b",
153
- children: t === void 0 ? "" : a.find((t) => t.id === e.id)?.value ?? "—"
154
- })]
155
- })]
156
- }, e.id))
157
- })]
158
- }),
159
- /* @__PURE__ */ u("span", {
160
- id: e,
161
- className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xb3r6kr x1hyvwdk xuxw1ft",
162
- children: y({
163
- label: t,
164
- summary: n,
165
- rows: a,
166
- notes: p
167
- })
168
- }),
169
- t !== void 0 && /* @__PURE__ */ u("div", {
170
- "aria-hidden": !0,
171
- className: "x1n2onr6 xqtp20y x1vjfegm",
172
- children: /* @__PURE__ */ d("div", {
173
- ...l.props(h.inspector, !_ && h.summaryInspector, h.position(x, v)),
174
- children: [
175
- /* @__PURE__ */ d("div", {
176
- className: "x78zum5 x1qughib x1hnptsi xk4h15q",
177
- children: [/* @__PURE__ */ u("span", { children: t }), n !== void 0 && /* @__PURE__ */ u("span", { children: n })]
178
- }),
179
- /* @__PURE__ */ u("dl", {
180
- className: "xrvj5dj xunmzkg x1ghz6dp",
181
- children: a.map((e) => /* @__PURE__ */ d("div", {
182
- className: "x78zum5 x1qughib x1pha0wt x1hnptsi",
183
- children: [/* @__PURE__ */ d("dt", {
184
- className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
185
- children: [/* @__PURE__ */ u(o, {
186
- tone: e.tone,
187
- shape: e.shape
188
- }), e.label]
189
- }), /* @__PURE__ */ u("dd", {
190
- className: "x1ghz6dp xuxw1ft",
191
- children: e.value
192
- })]
193
- }, e.id))
194
- }),
195
- p.map((e) => /* @__PURE__ */ u("span", { children: e }, e))
196
- ]
197
- })
198
- })
199
- ]
200
- });
201
- }
202
- // packages/charts/src/figure/figure-frame.tsx
203
- var x = {
204
- notation: "compact",
205
- compactDisplay: "long"
206
- }, S = 1e5;
207
- function C(e, t) {
208
- return f(e, t, e < S ? {} : x);
209
- }
210
- function w(e, t) {
211
- return `${C(e.shown, t)} of ${C(e.total, t)} ${e.unit} shown`;
212
- }
213
- function T({ title: e, description: t, report: r, actions: i, locale: a, source: o, coverage: c, transforms: l = [], status: f = "ready", figure: p = {}, series: m, titleDetail: h, footer: g, seriesLegend: _, scaleLegend: y, children: b }) {
214
- let x = c !== void 0 && c.shown < c.total ? w(c, a) : void 0, S = [o, ...l].filter((e) => e !== void 0), C = g !== void 0 || S.length > 0, T = /* @__PURE__ */ u(v, {
215
- title: e,
216
- detail: h
217
- });
218
- return /* @__PURE__ */ u(s, {
219
- figure: {
220
- ...p,
221
- "aria-busy": f !== "ready" || void 0
222
- },
223
- title: x === void 0 ? T : /* @__PURE__ */ d("span", {
224
- className: "x3nfvp2 x1a02dak x1pha0wt xa2sdi0 x1gkm1c7",
225
- children: [T, /* @__PURE__ */ u(n, { children: x })]
226
- }),
227
- description: t,
228
- report: r,
229
- actions: i,
230
- series: m,
231
- seriesLegend: _,
232
- scaleLegend: y,
233
- footer: C ? /* @__PURE__ */ d("div", {
234
- className: "xrvj5dj xunmzkg xeuugli",
235
- children: [g, S.length > 0 && /* @__PURE__ */ u("p", {
236
- className: "x1ghz6dp xeuugli xj0a0fe",
237
- children: S.join(" · ")
238
- })]
239
- }) : void 0,
240
- children: b
241
- });
242
- }
243
- function E({ children: e }) {
244
- return /* @__PURE__ */ u("p", {
245
- className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
246
- children: e
247
- });
248
- }
249
- function D({ message: e, ...t }) {
250
- return /* @__PURE__ */ u(T, {
251
- ...t,
252
- status: "ready",
253
- children: /* @__PURE__ */ u(i, {
254
- hasError: !0,
255
- children: e
256
- })
257
- });
258
- }
259
- function O({ height: e = "regular", ...t }) {
260
- return /* @__PURE__ */ u("div", {
261
- "aria-hidden": !0,
262
- inert: !0,
263
- children: /* @__PURE__ */ u(T, {
264
- ...t,
265
- status: "loading",
266
- children: /* @__PURE__ */ u(a, { height: c[e] })
267
- })
268
- });
269
- }
270
- export { w as a, y as c, O as i, p as l, T as n, b as o, D as r, _ as s, E as t };
@@ -1,72 +0,0 @@
1
- import { n as e, t } from "./clock-DSm5lkNE.js";
2
- import { useEffect as n, useState as r, useSyncExternalStore as i } from "react";
3
- // packages/teaching/src/time/tween.ts
4
- var a = {
5
- instant: 0,
6
- fast: 140,
7
- regular: 320,
8
- slow: 640
9
- }, o = 4;
10
- function s() {}
11
- function c(e) {
12
- return 1 - (1 - e) ** o;
13
- }
14
- function l(e, t) {
15
- let n = new Map(Object.entries(t)), r = Object.entries(e);
16
- return r.length === n.size && r.every(([e, t]) => n.get(e) === t);
17
- }
18
- function u(e, t, n) {
19
- let r = new Map(Object.entries(e));
20
- return {
21
- ...t,
22
- ...Object.fromEntries(Object.entries(t).map(([e, t]) => {
23
- let i = r.get(e) ?? t;
24
- return [e, i + (t - i) * n];
25
- }))
26
- };
27
- }
28
- function d(n) {
29
- let r = /* @__PURE__ */ new Set(), i = {
30
- shown: n,
31
- from: n,
32
- target: n,
33
- started: -1,
34
- duration: 0,
35
- stop: s
36
- };
37
- function o(e) {
38
- i.shown = e;
39
- for (let e of r) e();
40
- }
41
- function d() {
42
- i.stop(), i.stop = s;
43
- }
44
- function f(e) {
45
- d(), i.target = e, l(i.shown, e) || o(e);
46
- }
47
- function p(e) {
48
- i.started < 0 && (i.started = e);
49
- let t = Math.min(1, (e - i.started) / i.duration);
50
- t >= 1 ? (d(), o(i.target)) : o(u(i.from, i.target, c(t)));
51
- }
52
- function m(n, r = "regular") {
53
- l(i.target, n) || (a[r] === 0 || t() ? f(n) : (d(), i.from = i.shown, i.target = n, i.started = -1, i.duration = a[r], i.stop = e(p)));
54
- }
55
- return {
56
- get: () => i.shown,
57
- to: m,
58
- jump: f,
59
- subscribe: (e) => (r.add(e), () => {
60
- r.delete(e);
61
- }),
62
- destroy: d
63
- };
64
- }
65
- // packages/teaching/src/time/use-tween.ts
66
- function f(e, t = "regular") {
67
- let [a] = r(() => d(e));
68
- return n(() => {
69
- a.to(e, t);
70
- }), n(() => a.destroy, [a]), i(a.subscribe, a.get, a.get);
71
- }
72
- export { d as n, f as t };