@mechane-ai/elements 0.49.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 (87) hide show
  1. package/README.md +40 -2
  2. package/dist/{article-yyNPg6VU.js → article-CRlhq9oA.js} +531 -463
  3. package/dist/article.js +1 -1
  4. package/dist/catalog.json +29 -1
  5. package/dist/{categorical-values-DCznViFp.js → categorical-values-BYP_R5gS.js} +13 -13
  6. package/dist/charts/cartesian.js +1 -1
  7. package/dist/charts/comparison.js +1 -1
  8. package/dist/charts/distribution.js +1 -1
  9. package/dist/charts/figure.js +12 -12
  10. package/dist/charts/graph.js +1 -1
  11. package/dist/charts/hierarchy.js +1 -1
  12. package/dist/charts/image.js +1 -1
  13. package/dist/charts/matrix.js +1 -1
  14. package/dist/charts/plot.js +4 -4
  15. package/dist/charts/relationship.js +1 -1
  16. package/dist/charts/text.js +1 -1
  17. package/dist/charts/timeline.js +1 -1
  18. package/dist/charts/trend.js +1 -1
  19. package/dist/charts.js +7 -7
  20. package/dist/{dumbbell-plot-CMv9llfd.js → dumbbell-plot-B-Tn7ewW.js} +45 -45
  21. package/dist/{embedding-map-DC-lgzCq.js → embedding-map-Bljn-A5q.js} +528 -528
  22. package/dist/figure-frame-CEijciL7.js +289 -0
  23. package/dist/{image-grid-DHqtj_zs.js → image-grid-mrG5u9oE.js} +47 -47
  24. package/dist/kits/evaluation.js +3 -3
  25. package/dist/kits/interpretability.js +6 -6
  26. package/dist/kits/operations.js +3 -3
  27. package/dist/kits/research.js +2 -2
  28. package/dist/kits/training.js +2 -2
  29. package/dist/lesson/spec.js +11 -11
  30. package/dist/lesson.js +4 -4
  31. package/dist/mdx.js +4 -4
  32. package/dist/packages/charts/src/figure/caption-scope.d.ts +12 -0
  33. package/dist/packages/charts/src/figure/figure-frame.d.ts +2 -1
  34. package/dist/packages/charts/src/index.d.ts +2 -0
  35. package/dist/packages/teaching/src/article/article-context.d.ts +2 -0
  36. package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +13 -0
  37. package/dist/packages/teaching/src/article/article.d.ts +6 -1
  38. package/dist/packages/teaching/src/article/figure.d.ts +20 -3
  39. package/dist/packages/teaching/src/article/index.d.ts +1 -1
  40. package/dist/packages/teaching/src/article/view-essay.d.ts +2 -1
  41. package/dist/packages/teaching/src/lesson/define-lesson.d.ts +4 -0
  42. package/dist/packages/teaching/src/lesson/index.d.ts +2 -2
  43. package/dist/packages/teaching/src/lesson/lesson-player.d.ts +19 -3
  44. package/dist/packages/teaching/src/lesson/lesson-store.d.ts +2 -0
  45. package/dist/packages/teaching/src/lesson/playback.d.ts +9 -6
  46. package/dist/packages/teaching/src/lesson/use-lesson.d.ts +7 -2
  47. package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +4 -1
  48. package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +5 -6
  49. package/dist/packages/teaching/src/scene/scene-geometry.d.ts +1 -1
  50. package/dist/packages/teaching/src/scene/scene-node.d.ts +4 -1
  51. package/dist/packages/teaching/src/scene/scene-validate.d.ts +6 -0
  52. package/dist/packages/teaching/src/scene/scene-wire.d.ts +6 -1
  53. package/dist/packages/teaching/src/scene/scene.d.ts +1 -1
  54. package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +5 -1
  55. package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +1 -1
  56. package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +1 -1
  57. package/dist/packages/teaching/src/time/tween.d.ts +2 -0
  58. package/dist/{param-BE3VMSkH.js → param-BdqTpZER.js} +166 -99
  59. package/dist/{plot-layout-Bqe4-0qZ.js → plot-layout-B2xRt-_k.js} +144 -130
  60. package/dist/{plot-surface-DON6WUmk.js → plot-surface-0cKFwtws.js} +1 -1
  61. package/dist/{reference-lines-hjuD1rRZ.js → reference-lines-nSxcZVF5.js} +1 -1
  62. package/dist/{scene-BP0Ue0R5.js → scene-BwJKueD6.js} +1227 -1125
  63. package/dist/scene.js +1 -1
  64. package/dist/{slope-chart-C8eeSgL4.js → slope-chart-CGTYbFxi.js} +179 -179
  65. package/dist/styles2.css +69 -14
  66. package/dist/{time-series-BL933QyA.js → time-series-Dh8y5ba0.js} +952 -948
  67. package/dist/{token-heatmap-BB65awva.js → token-heatmap-BTrZ3-N4.js} +84 -84
  68. package/dist/{token-predictions-Pa8eUGan.js → token-predictions-CUe4junQ.js} +126 -126
  69. package/dist/{transport-DzyxVXbL.js → transport-4V9rfYHN.js} +278 -233
  70. package/dist/{tree-diagram-DJhKBiia.js → tree-diagram-Dpqmo-fh.js} +115 -115
  71. package/dist/{treemap-CxxgABUg.js → treemap-BUSaVD3m.js} +27 -27
  72. package/dist/use-tween-BsaEO862.js +10 -0
  73. package/dist/{violin-plot-CoAEF_7Z.js → violin-plot-BxaLwdRi.js} +123 -123
  74. package/dist/{waterfall-DdoEXEkT.js → waterfall-CcDMdKec.js} +39 -39
  75. package/package.json +1 -1
  76. package/recipes/counting-cards.tsx +3 -3
  77. package/skills/review-explainer/SKILL.md +2 -1
  78. package/skills/upgrade-elements/references/releases.md +61 -0
  79. package/skills/use-elements/SKILL.md +3 -1
  80. package/skills/use-elements/references/styling.md +23 -0
  81. package/skills/use-elements/references/teaching.md +13 -0
  82. package/skills/write-explainer/references/article.md +50 -2
  83. package/skills/write-explainer/references/lesson.md +18 -9
  84. package/skills/write-explainer/references/scene-parts.md +17 -12
  85. package/skills/write-explainer/references/scene.md +25 -3
  86. package/dist/figure-frame-BjFzbl3m.js +0 -270
  87. package/dist/use-tween-5HZ55_9d.js +0 -72
@@ -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-9EJskqB_.js";
4
- import { d as r, m as i, u as a } from "./src-npqwq3Sa.js";
5
- import { C as o, b as s, c } from "./plot-layout-Bqe4-0qZ.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 };