@mechane-ai/elements 0.49.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) 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 +37 -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/collections.js +1 -1
  21. package/dist/{dumbbell-plot-CMv9llfd.js → dumbbell-plot-BC8d_IJy.js} +45 -45
  22. package/dist/{embedding-map-DC-lgzCq.js → embedding-map-Bj8krO-d.js} +528 -528
  23. package/dist/figure-frame-koVKcXph.js +323 -0
  24. package/dist/{image-grid-DHqtj_zs.js → image-grid-CLhol2jy.js} +47 -47
  25. package/dist/kits/evaluation.js +50 -48
  26. package/dist/kits/interpretability.js +7 -7
  27. package/dist/kits/operations.js +4 -4
  28. package/dist/kits/research.js +346 -264
  29. package/dist/kits/training.js +3 -3
  30. package/dist/layout.js +1 -1075
  31. package/dist/lesson/spec.js +11 -11
  32. package/dist/lesson.js +4 -4
  33. package/dist/mdx.js +4 -4
  34. package/dist/packages/charts/src/chart-inspection.d.ts +4 -1
  35. package/dist/packages/charts/src/figure/caption-scope.d.ts +12 -0
  36. package/dist/packages/charts/src/figure/figure-frame.d.ts +2 -1
  37. package/dist/packages/charts/src/index.d.ts +2 -0
  38. package/dist/packages/collections/src/data-table-trigger.d.ts +2 -0
  39. package/dist/packages/kits/src/evaluation/leaderboard.d.ts +2 -0
  40. package/dist/packages/kits/src/research/collection-page.d.ts +46 -0
  41. package/dist/packages/kits/src/research/index.d.ts +2 -0
  42. package/dist/packages/kits/src/research/milestone-path.d.ts +1 -2
  43. package/dist/packages/kits/src/research/work-heartbeat.d.ts +4 -3
  44. package/dist/packages/layout/src/detail-page.d.ts +3 -1
  45. package/dist/packages/teaching/src/article/article-context.d.ts +2 -0
  46. package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +13 -0
  47. package/dist/packages/teaching/src/article/article.d.ts +6 -1
  48. package/dist/packages/teaching/src/article/figure.d.ts +20 -3
  49. package/dist/packages/teaching/src/article/index.d.ts +1 -1
  50. package/dist/packages/teaching/src/article/view-essay.d.ts +2 -1
  51. package/dist/packages/teaching/src/lesson/define-lesson.d.ts +4 -0
  52. package/dist/packages/teaching/src/lesson/index.d.ts +2 -2
  53. package/dist/packages/teaching/src/lesson/lesson-player.d.ts +19 -3
  54. package/dist/packages/teaching/src/lesson/lesson-store.d.ts +2 -0
  55. package/dist/packages/teaching/src/lesson/playback.d.ts +9 -6
  56. package/dist/packages/teaching/src/lesson/use-lesson.d.ts +7 -2
  57. package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +4 -1
  58. package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +5 -6
  59. package/dist/packages/teaching/src/scene/scene-geometry.d.ts +1 -1
  60. package/dist/packages/teaching/src/scene/scene-node.d.ts +4 -1
  61. package/dist/packages/teaching/src/scene/scene-validate.d.ts +6 -0
  62. package/dist/packages/teaching/src/scene/scene-wire.d.ts +6 -1
  63. package/dist/packages/teaching/src/scene/scene.d.ts +1 -1
  64. package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +5 -1
  65. package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +1 -1
  66. package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +1 -1
  67. package/dist/packages/teaching/src/time/tween.d.ts +2 -0
  68. package/dist/{param-BE3VMSkH.js → param-BdqTpZER.js} +166 -99
  69. package/dist/{plot-layout-Bqe4-0qZ.js → plot-layout-B2xRt-_k.js} +144 -130
  70. package/dist/{plot-surface-DON6WUmk.js → plot-surface-0cKFwtws.js} +1 -1
  71. package/dist/{reference-lines-hjuD1rRZ.js → reference-lines-nSxcZVF5.js} +1 -1
  72. package/dist/{scene-BP0Ue0R5.js → scene-4ePpWdmE.js} +1227 -1125
  73. package/dist/scene.js +1 -1
  74. package/dist/{slope-chart-C8eeSgL4.js → slope-chart-DWZIYDty.js} +179 -179
  75. package/dist/{src-B2rgpWap.js → src-DNclWY4V.js} +1 -1
  76. package/dist/src-DhWMspwr.js +1085 -0
  77. package/dist/styles2.css +77 -14
  78. package/dist/{time-series-BL933QyA.js → time-series-CsngFxr1.js} +952 -948
  79. package/dist/{token-heatmap-BB65awva.js → token-heatmap-BQLIxPky.js} +84 -84
  80. package/dist/{token-predictions-Pa8eUGan.js → token-predictions-C3B5L-eO.js} +126 -126
  81. package/dist/{transport-DzyxVXbL.js → transport-4V9rfYHN.js} +278 -233
  82. package/dist/{tree-diagram-DJhKBiia.js → tree-diagram-Dau9jeXS.js} +115 -115
  83. package/dist/{treemap-CxxgABUg.js → treemap-DWrMQndu.js} +27 -27
  84. package/dist/use-tween-BsaEO862.js +10 -0
  85. package/dist/{violin-plot-CoAEF_7Z.js → violin-plot-D05ODcyc.js} +123 -123
  86. package/dist/{waterfall-DdoEXEkT.js → waterfall-BkLLv2Lm.js} +39 -39
  87. package/package.json +1 -1
  88. package/recipes/counting-cards.tsx +3 -3
  89. package/skills/review-elements/SKILL.md +14 -0
  90. package/skills/review-explainer/SKILL.md +2 -1
  91. package/skills/upgrade-elements/references/releases.md +61 -0
  92. package/skills/use-elements/SKILL.md +21 -17
  93. package/skills/use-elements/references/editorial-restraint.md +40 -0
  94. package/skills/use-elements/references/styling.md +23 -0
  95. package/skills/use-elements/references/teaching.md +13 -0
  96. package/skills/use-elements/references/workspace.md +14 -8
  97. package/skills/write-explainer/references/article.md +50 -2
  98. package/skills/write-explainer/references/lesson.md +18 -9
  99. package/skills/write-explainer/references/scene-parts.md +17 -12
  100. package/skills/write-explainer/references/scene.md +25 -3
  101. package/dist/figure-frame-BjFzbl3m.js +0 -270
  102. package/dist/use-tween-5HZ55_9d.js +0 -72
package/README.md CHANGED
@@ -309,6 +309,17 @@ The default theme is light, with system fonts and a compact spacing scale. Impor
309
309
  `@mechane-ai/elements/theme` and spread `themeProps.light` or `themeProps.dark` onto the document root. Portaled content
310
310
  then inherits the same theme. The application owns the preference; no theme provider is required.
311
311
 
312
+ `themeProps.dark` is a `className` and a `style`. A later spread with its own `className`, such as
313
+ `{...themeProps.dark} {...stylex.props(styles.root)}`, replaces the theme's class without an error, and the page is half
314
+ dark. Give the theme an element of its own, or join the class names:
315
+
316
+ ```tsx
317
+ const theme = themeProps[isDark ? 'dark' : 'light'];
318
+ const own = stylex.props(styles.root);
319
+
320
+ <div className={`${theme.className ?? ''} ${own.className ?? ''}`} style={{ ...theme.style, ...own.style }} />;
321
+ ```
322
+
312
323
  For custom StyleX styles and themes, import variables from `@mechane-ai/elements/tokens.stylex` and compile-time
313
324
  constants from `@mechane-ai/elements/constants.stylex`. The archive preserves both defining paths. Variables retain the
314
325
  same names as the packaged CSS; constants need their source compiled with the consuming styles. The ordinary `/tokens`
@@ -647,7 +658,8 @@ the lesson. The idea:
647
658
  its ends, and an object with the same `id` is the same thing in every state. Every move runs on one shared clock
648
659
  (`createTween` and `useTween`), and a reader who asked for reduced motion gets the end state at once.
649
660
  - **One kernel.** A `Scene` draws with the plot kernel, so a diagram has the chart's tones, readout and keyboard cursor.
650
- Every labelled object is an item the arrow keys reach.
661
+ Every labelled object is an item the arrow keys reach, and with the scene's `onSelectedChange` a press or Enter acts
662
+ on it, such as turning a card.
651
663
  - **Four views of one essay.** An `Article` renders the same children as a scrolling essay, a presentation, a static
652
664
  page or a beat sheet. The views differ in arrangement only.
653
665
  - **Only the reader's acts count.** Predictions, challenges and hints change the reader's progress only when the reader
@@ -731,7 +743,10 @@ export function BatchPage() {
731
743
 
732
744
  A state is the whole picture. `showState` (and `show` from `useLesson`) sets every param the state does not name back to
733
745
  the lesson's opening value, so a state looks the same live, on the beat sheet and in a tour. `setMany` changes some
734
- params and keeps the rest.
746
+ params and keeps the rest. `show` and `reset` act on the whole lesson: a figure's Reset button that calls `reset` clears
747
+ what the reader did in every other beat. Call `resetBeat(beat)` instead. It returns only the params that beat owns to
748
+ their opening values, in one change with the reason `reset`. A beat owns the params its `params` lists, or else those
749
+ its states set.
735
750
 
736
751
  `useLesson(lesson)` types the values from the definition, so `values.noise` is a number and `set('batch', 'high')` does
737
752
  not compile. `shouldSyncUrl` keeps the values in the address bar, and `storageKey` keeps them across visits. A `Scene`
@@ -781,12 +796,35 @@ export function BatchEssay() {
781
796
  }
782
797
  ```
783
798
 
799
+ A figure with controls takes them as `header` or `footer`. The figure then sits in one hairline frame, with a strip
800
+ above or below the visual, ruled off from it. `isFramed` frames a figure with no controls, so every figure in an essay
801
+ can share the frame; a figure with a strip is always framed. A chart or scene inside an article `Figure` keeps its title
802
+ as its accessible name, but prints neither the title nor the description: the figure's number and caption say what it
803
+ is. Write the caption for the reader and the chart's title as its name.
804
+
784
805
  Give `Article` a `view` of `'article'` (the default scrolling essay with a contents list), `'present'` (one beat at a
785
806
  time; Right or Space goes on, and a beat opens at its first declared state), `'static'` (every beat open at its first
786
807
  state, each figure followed by its description, no script needed) or `'sheet'` (every beat in each declared state, each
787
808
  figure scaled to fit, its tutor notes, and a list of checks). The sheet names a beat with no figure, a figure with no
788
809
  description, a player with no `Transport` and a sentence control that changes no figure.
789
810
 
811
+ An application whose own navigation lists the beats, such as a rail in an `AppShell`, holds the beat and passes it
812
+ through `lessonProps`, and sets `hasContents={false}` so the article shows no second list:
813
+
814
+ ```tsx
815
+ <Article
816
+ lesson={lesson}
817
+ locale="en-US"
818
+ title="Why a bigger batch is quieter"
819
+ hasContents={false}
820
+ lessonProps={{ beat, onBeatChange: (next) => next !== null && setBeat(next) }}
821
+ >
822
+ {essay}
823
+ </Article>
824
+ ```
825
+
826
+ Scrolling the essay then moves the rail, and a press in the rail scrolls the essay to that beat.
827
+
790
828
  `recipes/counting-cards.tsx` (story `Recipes/Counting Cards`) is a full example on every layer, and
791
829
  `recipes/explorable-essay.tsx` is a short one.
792
830