@mechane-ai/elements 0.47.0 → 0.49.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.
- package/README.md +288 -5
- package/bin/mechane-elements-catalog.mjs +104 -12
- package/dist/ai.js +5 -5
- package/dist/article-yyNPg6VU.js +1904 -0
- package/dist/article.js +1 -0
- package/dist/catalog.json +1691 -163
- package/dist/{categorical-values-DdfGIowV.js → categorical-values-DCznViFp.js} +1 -1
- package/dist/{cells--Bd1fQFR.js → cells-CNZE4us2.js} +2 -2
- package/dist/charts/cartesian.js +1 -1
- package/dist/charts/cells.js +1 -1
- package/dist/charts/comparison.js +1 -1
- package/dist/charts/distribution.js +1 -1
- package/dist/charts/figure.js +12 -12
- package/dist/charts/graph.js +1 -1
- package/dist/charts/hierarchy.js +1 -1
- package/dist/charts/image.js +1 -1
- package/dist/charts/matrix.js +3 -2
- package/dist/charts/plot.js +6 -6
- package/dist/charts/relationship.js +1 -1
- package/dist/charts/text.js +1 -1
- package/dist/charts/timeline.js +1 -1
- package/dist/charts/trend.js +1 -1
- package/dist/charts.js +2 -2
- package/dist/clock-DSm5lkNE.js +16 -0
- package/dist/{code-block-DioAM2bZ.js → code-block-BZsY2sh3.js} +1 -1
- package/dist/collections.js +1 -1
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +3 -3
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +2 -2
- package/dist/content/tree.js +1 -1
- package/dist/{content-link-NWuHp5rC.js → content-link-PnpcnTCx.js} +1 -1
- package/dist/content.js +1 -1
- package/dist/{dates-Cww8UR_n.js → dates-ckJdYF7t.js} +1 -1
- package/dist/describe-lesson-BmREzDpt.js +175 -0
- package/dist/{dumbbell-plot-B2ZTgQaI.js → dumbbell-plot-CMv9llfd.js} +9 -7
- package/dist/{embedding-map-CGM_k6lC.js → embedding-map-DC-lgzCq.js} +8 -8
- package/dist/feedback.js +1 -1
- package/dist/{figure-frame-wRkIEAwe.js → figure-frame-BjFzbl3m.js} +3 -3
- package/dist/forms/dates.js +1 -1
- package/dist/forms.js +3 -3
- package/dist/{image-grid-CVA4SOy_.js → image-grid-DHqtj_zs.js} +4 -4
- package/dist/index.js +1 -1
- package/dist/kits/evaluation.js +5 -5
- package/dist/kits/interpretability.js +320 -302
- package/dist/kits/operations.js +6 -6
- package/dist/kits/research.js +558 -0
- package/dist/kits/training.js +6 -6
- package/dist/layout.js +205 -110
- package/dist/lesson/agent.js +811 -0
- package/dist/lesson/spec.js +661 -0
- package/dist/lesson.js +5 -0
- package/dist/mdx.js +227 -0
- package/dist/navigation.js +2 -2
- package/dist/packages/charts/src/cartesian/index.d.ts +1 -1
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +18 -0
- package/dist/packages/charts/src/chart-theme.d.ts +1 -1
- package/dist/packages/charts/src/matrix/index.d.ts +1 -0
- package/dist/packages/charts/src/plot/plot-marks.d.ts +7 -3
- package/dist/packages/charts/src/plot/plot-surface.d.ts +3 -1
- package/dist/packages/collections/src/index.d.ts +1 -1
- package/dist/packages/collections/src/metrics.d.ts +9 -1
- package/dist/packages/content/src/index.d.ts +2 -0
- package/dist/packages/content/src/text-match.d.ts +22 -0
- package/dist/packages/core/src/index.d.ts +1 -0
- package/dist/packages/core/src/surfaces.d.ts +12 -2
- package/dist/packages/forms/src/index.d.ts +2 -0
- package/dist/packages/forms/src/token-input.d.ts +24 -0
- package/dist/packages/kits/src/interpretability/index.d.ts +1 -1
- package/dist/packages/kits/src/interpretability/logit-lens.d.ts +10 -1
- package/dist/packages/kits/src/research/finding-card.d.ts +43 -0
- package/dist/packages/kits/src/research/index.d.ts +8 -0
- package/dist/packages/kits/src/research/milestone-path.d.ts +36 -0
- package/dist/packages/kits/src/research/specimen-diff.d.ts +41 -0
- package/dist/packages/kits/src/research/work-heartbeat.d.ts +34 -0
- package/dist/packages/layout/src/figure-grid.d.ts +8 -0
- package/dist/packages/layout/src/index.d.ts +4 -1
- package/dist/packages/layout/src/sidebar.d.ts +7 -0
- package/dist/packages/layout/src/workbench.d.ts +4 -1
- package/dist/packages/teaching/src/agent/index.d.ts +11 -0
- package/dist/packages/teaching/src/agent/learner-trace.d.ts +84 -0
- package/dist/packages/teaching/src/agent/lesson-bridge.d.ts +59 -0
- package/dist/packages/teaching/src/agent/lesson-tour.d.ts +63 -0
- package/dist/packages/teaching/src/agent/tutor-tools.d.ts +86 -0
- package/dist/packages/teaching/src/article/article-checks.d.ts +9 -0
- package/dist/packages/teaching/src/article/article-context.d.ts +49 -0
- package/dist/packages/teaching/src/article/article-error.d.ts +12 -0
- package/dist/packages/teaching/src/article/article-labels.d.ts +54 -0
- package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +14 -0
- package/dist/packages/teaching/src/article/article-outline.d.ts +9 -0
- package/dist/packages/teaching/src/article/article.d.ts +42 -0
- package/dist/packages/teaching/src/article/beat-steps.d.ts +18 -0
- package/dist/packages/teaching/src/article/beat.d.ts +16 -0
- package/dist/packages/teaching/src/article/challenge.d.ts +29 -0
- package/dist/packages/teaching/src/article/exercise-styles.d.ts +76 -0
- package/dist/packages/teaching/src/article/figure.d.ts +51 -0
- package/dist/packages/teaching/src/article/index.d.ts +31 -0
- package/dist/packages/teaching/src/article/lesson-values.d.ts +5 -0
- package/dist/packages/teaching/src/article/notes.d.ts +36 -0
- package/dist/packages/teaching/src/article/outline-types.d.ts +73 -0
- package/dist/packages/teaching/src/article/predict.d.ts +58 -0
- package/dist/packages/teaching/src/article/progress-store.d.ts +64 -0
- package/dist/packages/teaching/src/article/scrolly.d.ts +26 -0
- package/dist/packages/{kits/src/explainers → teaching/src/article}/term.d.ts +8 -2
- package/dist/packages/teaching/src/article/tex.d.ts +12 -0
- package/dist/packages/teaching/src/article/view-essay.d.ts +13 -0
- package/dist/packages/teaching/src/article/view-present.d.ts +8 -0
- package/dist/packages/teaching/src/article/view-sheet.d.ts +7 -0
- package/dist/packages/teaching/src/article/view-static.d.ts +7 -0
- package/dist/packages/teaching/src/article/walk.d.ts +34 -0
- package/dist/packages/teaching/src/lesson/define-lesson.d.ts +136 -0
- package/dist/packages/teaching/src/lesson/index.d.ts +24 -0
- package/dist/packages/teaching/src/lesson/inline-choice.d.ts +12 -0
- package/dist/packages/teaching/src/lesson/lesson-context.d.ts +18 -0
- package/dist/packages/teaching/src/lesson/lesson-error.d.ts +12 -0
- package/dist/packages/teaching/src/lesson/lesson-locale.d.ts +4 -0
- package/dist/packages/teaching/src/lesson/lesson-persistence.d.ts +17 -0
- package/dist/packages/teaching/src/lesson/lesson-player.d.ts +51 -0
- package/dist/packages/teaching/src/lesson/lesson-store.d.ts +84 -0
- package/dist/packages/teaching/src/lesson/lesson.d.ts +39 -0
- package/dist/packages/teaching/src/lesson/param-controls.d.ts +14 -0
- package/dist/packages/teaching/src/lesson/param.d.ts +34 -0
- package/dist/packages/teaching/src/lesson/playback.d.ts +42 -0
- package/dist/packages/teaching/src/lesson/transport.d.ts +19 -0
- package/dist/packages/teaching/src/lesson/use-lesson.d.ts +36 -0
- package/dist/packages/teaching/src/mdx/essay-components.d.ts +79 -0
- package/dist/packages/teaching/src/mdx/essay-markdown.d.ts +41 -0
- package/dist/packages/teaching/src/mdx/essay.d.ts +32 -0
- package/dist/packages/teaching/src/mdx/index.d.ts +9 -0
- package/dist/packages/teaching/src/mdx/requested-view.d.ts +6 -0
- package/dist/packages/teaching/src/scene/flow/flow-layout.d.ts +38 -0
- package/dist/packages/teaching/src/scene/flow/flow-pulse.d.ts +16 -0
- package/dist/packages/teaching/src/scene/flow/scene-flow.d.ts +81 -0
- package/dist/packages/teaching/src/scene/index.d.ts +77 -0
- package/dist/packages/teaching/src/scene/morph/morph-scope.d.ts +28 -0
- package/dist/packages/teaching/src/scene/plane/plane-hit.d.ts +22 -0
- package/dist/packages/teaching/src/scene/plane/plane-label.d.ts +23 -0
- package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +42 -0
- package/dist/packages/teaching/src/scene/plane/plane-math.d.ts +45 -0
- package/dist/packages/teaching/src/scene/plane/scene-axes.d.ts +30 -0
- package/dist/packages/teaching/src/scene/plane/scene-curve.d.ts +42 -0
- package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +59 -0
- package/dist/packages/teaching/src/scene/plane/scene-projection.d.ts +27 -0
- package/dist/packages/teaching/src/scene/plane/scene-region.d.ts +38 -0
- package/dist/packages/teaching/src/scene/plane/scene-rule.d.ts +35 -0
- package/dist/packages/teaching/src/scene/plane/scene-vector.d.ts +39 -0
- package/dist/packages/teaching/src/scene/scene-bracket.d.ts +24 -0
- package/dist/packages/teaching/src/scene/scene-callout.d.ts +26 -0
- package/dist/packages/teaching/src/scene/scene-context.d.ts +179 -0
- package/dist/packages/teaching/src/scene/scene-custom.d.ts +31 -0
- package/dist/packages/teaching/src/scene/scene-geometry.d.ts +181 -0
- package/dist/packages/teaching/src/scene/scene-group.d.ts +28 -0
- package/dist/packages/teaching/src/scene/scene-highlight.d.ts +19 -0
- package/dist/packages/teaching/src/scene/scene-layer.d.ts +16 -0
- package/dist/packages/teaching/src/scene/scene-node.d.ts +67 -0
- package/dist/packages/teaching/src/scene/scene-obstacles.d.ts +27 -0
- package/dist/packages/teaching/src/scene/scene-registry.d.ts +79 -0
- package/dist/packages/teaching/src/scene/scene-stagger.d.ts +43 -0
- package/dist/packages/teaching/src/scene/scene-style.d.ts +14 -0
- package/dist/packages/teaching/src/scene/scene-validate.d.ts +65 -0
- package/dist/packages/teaching/src/scene/scene-wire.d.ts +45 -0
- package/dist/packages/teaching/src/scene/scene.d.ts +36 -0
- package/dist/packages/teaching/src/scene/shapes/cell-color.d.ts +11 -0
- package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +69 -0
- package/dist/packages/teaching/src/scene/shapes/scene-card.d.ts +114 -0
- package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +84 -0
- package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +37 -0
- package/dist/packages/teaching/src/scene/shapes/scene-stack.d.ts +46 -0
- package/dist/packages/teaching/src/scene/shapes/scene-token.d.ts +63 -0
- package/dist/packages/teaching/src/scene/shapes/scene-tokens.d.ts +40 -0
- package/dist/packages/teaching/src/scene/shapes/stack-book.d.ts +35 -0
- package/dist/packages/teaching/src/scene/shapes/stack-layout.d.ts +63 -0
- package/dist/packages/teaching/src/scene/shapes/token-layout.d.ts +39 -0
- package/dist/packages/teaching/src/spec/advice.d.ts +23 -0
- package/dist/packages/teaching/src/spec/chart-names.d.ts +2 -0
- package/dist/packages/teaching/src/spec/describe-lesson.d.ts +85 -0
- package/dist/packages/teaching/src/spec/explainer-guide.d.ts +21 -0
- package/dist/packages/teaching/src/spec/findings.d.ts +39 -0
- package/dist/packages/teaching/src/spec/index.d.ts +14 -0
- package/dist/packages/teaching/src/spec/lesson-plan.d.ts +43 -0
- package/dist/packages/teaching/src/spec/validate-plan.d.ts +11 -0
- package/dist/packages/teaching/src/time/clock.d.ts +7 -0
- package/dist/packages/teaching/src/time/tween.d.ts +19 -0
- package/dist/packages/teaching/src/time/use-tween.d.ts +6 -0
- package/dist/param-BE3VMSkH.js +450 -0
- package/dist/{pierre-diff-DlvjyuJn.js → pierre-diff-aGyQK5xK.js} +1 -1
- package/dist/{plot-axes-DJkLW4wk.js → plot-axes-D5S9BnBa.js} +1 -1
- package/dist/{plot-layout-BEuoOHbs.js → plot-layout-Bqe4-0qZ.js} +4 -3
- package/dist/{plot-marks-A64v7aTw.js → plot-marks-FVsbFkUs.js} +18 -15
- package/dist/{plot-surface-CJTIqtck.js → plot-surface-DON6WUmk.js} +11 -11
- package/dist/{plot-width-DcqtSgzb.js → plot-width-D3hTycYX.js} +1 -1
- package/dist/{reference-lines-CWA8VeUR.js → reference-lines-hjuD1rRZ.js} +2 -2
- package/dist/scene-BP0Ue0R5.js +4938 -0
- package/dist/scene.js +1 -0
- package/dist/{slope-chart-DT22h_ym.js → slope-chart-C8eeSgL4.js} +7 -7
- package/dist/{src-CpdJlDhO.js → src-9EJskqB_.js} +73 -31
- package/dist/{src-D5NXRJZe.js → src-B2rgpWap.js} +48 -14
- package/dist/{src-BPTDJqt0.js → src-Ci8DeY8J.js} +1 -1
- package/dist/{src-CGc_hjxJ.js → src-DFW49IAs.js} +143 -111
- package/dist/{src-1EHkSFS-.js → src-Dxs3Buo_.js} +205 -139
- package/dist/{src-CExIrXPC.js → src-npqwq3Sa.js} +1 -1
- package/dist/styles2.css +542 -21
- package/dist/{time-series-IB3CB93O.js → time-series-BL933QyA.js} +787 -715
- package/dist/{token-heatmap-C00DnoNO.js → token-heatmap-BB65awva.js} +4 -4
- package/dist/{token-predictions-Cxx29iDr.js → token-predictions-Pa8eUGan.js} +6 -6
- package/dist/transport-DzyxVXbL.js +715 -0
- package/dist/{tree-diagram-DsckNKaW.js → tree-diagram-DJhKBiia.js} +6 -6
- package/dist/{treemap-9_DpLCW9.js → treemap-CxxgABUg.js} +5 -5
- package/dist/use-tween-5HZ55_9d.js +72 -0
- package/dist/{violin-plot-BhPHKXsN.js → violin-plot-CoAEF_7Z.js} +7 -6
- package/dist/{waterfall-CGksuTy5.js → waterfall-DdoEXEkT.js} +7 -7
- package/package.json +30 -5
- package/recipes/counting-cards.tsx +656 -0
- package/recipes/explorable-essay.tsx +172 -0
- package/skills/extend-elements/SKILL.md +21 -0
- package/skills/plan-lesson/SKILL.md +86 -0
- package/skills/plan-lesson/references/plan-format.md +114 -0
- package/skills/plan-lesson/references/worked-plan.md +171 -0
- package/skills/review-elements/SKILL.md +4 -2
- package/skills/review-explainer/SKILL.md +97 -0
- package/skills/upgrade-elements/references/releases.md +65 -0
- package/skills/use-elements/SKILL.md +18 -16
- package/skills/use-elements/references/kits.md +9 -26
- package/skills/use-elements/references/teaching.md +36 -0
- package/skills/write-explainer/SKILL.md +112 -0
- package/skills/write-explainer/references/article.md +164 -0
- package/skills/write-explainer/references/lesson.md +148 -0
- package/skills/write-explainer/references/mdx.md +78 -0
- package/skills/write-explainer/references/scene-parts.md +273 -0
- package/skills/write-explainer/references/scene.md +168 -0
- package/skills/write-explainer/references/tutor.md +104 -0
- package/skills/write-explainer/references/worked-essay.md +459 -0
- package/templates/essay/AGENTS.md +14 -0
- package/templates/essay/README.md +59 -0
- package/templates/essay/index.html +17 -0
- package/templates/essay/package.template.json +21 -0
- package/templates/essay/plan.json +96 -0
- package/templates/essay/src/essay.mdx +97 -0
- package/templates/essay/src/figures.tsx +92 -0
- package/templates/essay/src/lesson.ts +83 -0
- package/templates/essay/src/main.tsx +53 -0
- package/templates/essay/src/mdx.d.ts +7 -0
- package/templates/essay/tsconfig.template.json +15 -0
- package/templates/essay/vite.config.template.txt +8 -0
- package/dist/kits/explainers.js +0 -452
- package/dist/packages/kits/src/explainers/figures.d.ts +0 -31
- package/dist/packages/kits/src/explainers/index.d.ts +0 -8
- package/dist/packages/kits/src/explainers/story-steps.d.ts +0 -46
- /package/dist/packages/{kits/src/explainers → teaching/src/article}/linked-target.d.ts +0 -0
- /package/dist/packages/{kits/src/explainers → teaching/src/lesson}/bound-value.d.ts +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LessonFinding } from './findings.ts';
|
|
2
|
+
/** What checking a lesson plan found. The plan is valid when no finding is an error; advice never blocks it. */
|
|
3
|
+
export type LessonPlanResult = {
|
|
4
|
+
readonly isValid: boolean;
|
|
5
|
+
readonly findings: ReadonlyArray<LessonFinding>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Checks a lesson plan an agent drafted, before any component is written. Errors are shapes and names `defineLesson`
|
|
9
|
+
* would refuse; advice is teaching practice. Every finding has a path and a sentence that says what to do.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateLessonPlan(input: unknown): LessonPlanResult;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calls `listener` once per animation frame while subscribed. One loop serves every subscriber, so everything that
|
|
3
|
+
* moves on a page moves in step.
|
|
4
|
+
*/
|
|
5
|
+
export declare const onFrame: (listener: (now: number) => void) => () => void;
|
|
6
|
+
/** Whether the reader asked for reduced motion. False where there is no window. */
|
|
7
|
+
export declare function isMotionReduced(): boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** How long a move takes. `instant` jumps, and so does every pace when the reader asked for reduced motion. */
|
|
2
|
+
export type Pace = 'instant' | 'fast' | 'regular' | 'slow';
|
|
3
|
+
/** A set of named numbers that eases toward a target on the shared clock. */
|
|
4
|
+
export type Tween<Key extends string> = {
|
|
5
|
+
/** The values on screen now. The same object is returned until a frame changes them. */
|
|
6
|
+
readonly get: () => Readonly<Record<Key, number>>;
|
|
7
|
+
/** Moves to `target` from the values on screen, so a new target in the middle of a move is smooth. */
|
|
8
|
+
readonly to: (target: Readonly<Record<Key, number>>, pace?: Pace) => void;
|
|
9
|
+
/** Jumps to `target` without animating. */
|
|
10
|
+
readonly jump: (target: Readonly<Record<Key, number>>) => void;
|
|
11
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
12
|
+
/** Stops any move in flight. The tween still answers `get` and can be moved again. */
|
|
13
|
+
readonly destroy: () => void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Makes a tween that starts at `initial`. Give it a new target with `to` and read `get` on each change: authors
|
|
17
|
+
* describe where things are, and the tween supplies the motion between.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createTween<Key extends string>(initial: Readonly<Record<Key, number>>): Tween<Key>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Pace } from './tween.ts';
|
|
2
|
+
/**
|
|
3
|
+
* An animated copy of `target`. The first render shows `target`, and each later change eases to the new values on the
|
|
4
|
+
* shared clock, starting from whatever is on screen.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useTween<Key extends string>(target: Readonly<Record<Key, number>>, pace?: Pace): Readonly<Record<Key, number>>;
|
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { d as e, m as t } from "./src-Dxs3Buo_.js";
|
|
2
|
+
import { r as n } from "./figure-format-B8kRZMlo.js";
|
|
3
|
+
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";
|
|
11
|
+
// packages/teaching/src/lesson/lesson-locale.ts
|
|
12
|
+
var C = i(null);
|
|
13
|
+
function ie() {
|
|
14
|
+
return a(C);
|
|
15
|
+
}
|
|
16
|
+
// packages/teaching/src/lesson/lesson-error.tsx
|
|
17
|
+
function w(e, t) {
|
|
18
|
+
throw Error(`Lesson "${e}": ${t}`);
|
|
19
|
+
}
|
|
20
|
+
function T(e) {
|
|
21
|
+
throw Error(`${e} must be rendered inside a <Lesson>. Wrap it in <Lesson lesson={…} locale="…">.`);
|
|
22
|
+
}
|
|
23
|
+
function E({ children: e }) {
|
|
24
|
+
return /* @__PURE__ */ m("span", {
|
|
25
|
+
role: "note",
|
|
26
|
+
className: "xr5kp14 x1b5ytql",
|
|
27
|
+
children: e
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// packages/teaching/src/lesson/define-lesson.ts
|
|
31
|
+
function D({ name: e, param: t, value: n }) {
|
|
32
|
+
switch (t.kind) {
|
|
33
|
+
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
|
+
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
|
+
case "toggle": return typeof n == "boolean" ? void 0 : `${e} takes true or false, not ${String(n)}.`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function O(e, t) {
|
|
39
|
+
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
|
+
}
|
|
41
|
+
function k(e, t) {
|
|
42
|
+
if (t.kind === "number") {
|
|
43
|
+
let n = O(e, t);
|
|
44
|
+
if (n !== void 0) return n;
|
|
45
|
+
}
|
|
46
|
+
if (t.kind === "choice") {
|
|
47
|
+
let n = t.options.map((e) => e.id);
|
|
48
|
+
if (new Set(n).size !== n.length || n.length === 0) return `${e} needs at least one option, each with its own id.`;
|
|
49
|
+
}
|
|
50
|
+
let n = D({
|
|
51
|
+
name: e,
|
|
52
|
+
param: t,
|
|
53
|
+
value: t.value
|
|
54
|
+
});
|
|
55
|
+
return n === void 0 ? void 0 : `the default of ${n}`;
|
|
56
|
+
}
|
|
57
|
+
function A(e) {
|
|
58
|
+
return e.find((t, n) => e.indexOf(t) !== n);
|
|
59
|
+
}
|
|
60
|
+
function j(e) {
|
|
61
|
+
let t = /* @__PURE__ */ new Set();
|
|
62
|
+
return {
|
|
63
|
+
view: new Proxy(e, { get(e, n, r) {
|
|
64
|
+
return typeof n == "string" && t.add(n), Reflect.get(e, n, r);
|
|
65
|
+
} }),
|
|
66
|
+
names: t
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function M(e, t) {
|
|
70
|
+
let n = new Map(Object.entries(t));
|
|
71
|
+
return (e.states ?? []).flatMap((t) => Object.entries(t.values).flatMap(([r, i]) => {
|
|
72
|
+
let a = n.get(r), o = `state "${t.id}" of beat "${e.id}"`;
|
|
73
|
+
if (a === void 0) return [`${o} sets "${r}", which is not a param.`];
|
|
74
|
+
let s = D({
|
|
75
|
+
name: r,
|
|
76
|
+
param: a,
|
|
77
|
+
value: i
|
|
78
|
+
});
|
|
79
|
+
return s === void 0 ? [] : [`${o}: ${s}`];
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
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));
|
|
84
|
+
return [
|
|
85
|
+
...r ? [] : [`beat "${e.id}" needs a whole number of steps, not ${n}.`],
|
|
86
|
+
...i === void 0 ? [] : [`beat "${e.id}" has two states with the id "${i}".`],
|
|
87
|
+
...M(e, t)
|
|
88
|
+
];
|
|
89
|
+
}
|
|
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));
|
|
92
|
+
return [
|
|
93
|
+
...Object.entries(e).flatMap(([e, t]) => k(e, t) ?? []),
|
|
94
|
+
...i === void 0 ? [] : [`"${i}" is declared as both a param and a derived value.`],
|
|
95
|
+
...a === void 0 ? [] : [`two beats share the id "${a}".`],
|
|
96
|
+
...n.flatMap((t) => N(t, e))
|
|
97
|
+
];
|
|
98
|
+
}
|
|
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({
|
|
101
|
+
params: r,
|
|
102
|
+
derivedNames: s,
|
|
103
|
+
beats: a
|
|
104
|
+
});
|
|
105
|
+
c !== void 0 && w(t, c);
|
|
106
|
+
let l = Object.fromEntries(Object.entries(r).map(([e, t]) => [e, t.value])), u = Object.fromEntries(s.map((e) => [e, NaN]));
|
|
107
|
+
function d(e) {
|
|
108
|
+
let n = {
|
|
109
|
+
known: {
|
|
110
|
+
...e,
|
|
111
|
+
...u
|
|
112
|
+
},
|
|
113
|
+
results: u
|
|
114
|
+
}, 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 = {
|
|
117
|
+
...n.known,
|
|
118
|
+
[e]: s
|
|
119
|
+
}, n.results = {
|
|
120
|
+
...n.results,
|
|
121
|
+
[e]: s
|
|
122
|
+
}, [e, [...o]];
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
results: n.results,
|
|
126
|
+
reads: a
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
let f = d(l), p = a.flatMap((e) => (e.states ?? []).map((e) => d({
|
|
130
|
+
...l,
|
|
131
|
+
...e.values
|
|
132
|
+
}).reads)), m = Object.fromEntries(s.map((e) => [e, [...new Set([f.reads, ...p].flatMap((t) => t.filter(([t]) => t === e).flatMap(([, e]) => e)))]]));
|
|
133
|
+
return {
|
|
134
|
+
id: t,
|
|
135
|
+
title: n,
|
|
136
|
+
params: r,
|
|
137
|
+
derived: Object.fromEntries(i.map(([e, t]) => [e, {
|
|
138
|
+
label: t.label,
|
|
139
|
+
format: t.format
|
|
140
|
+
}])),
|
|
141
|
+
beats: a,
|
|
142
|
+
defaults: l,
|
|
143
|
+
initial: {
|
|
144
|
+
...l,
|
|
145
|
+
...f.results
|
|
146
|
+
},
|
|
147
|
+
compute: (e) => d(e).results,
|
|
148
|
+
reads: m
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function I(e) {
|
|
152
|
+
return {
|
|
153
|
+
nodes: [...Object.entries(e.params).map(([e, t]) => ({
|
|
154
|
+
name: e,
|
|
155
|
+
kind: "param",
|
|
156
|
+
label: t.label
|
|
157
|
+
})), ...Object.entries(e.derived).map(([e, t]) => ({
|
|
158
|
+
name: e,
|
|
159
|
+
kind: "derived",
|
|
160
|
+
label: t.label
|
|
161
|
+
}))],
|
|
162
|
+
edges: Object.entries(e.reads).flatMap(([e, t]) => t.map((t) => ({
|
|
163
|
+
from: t,
|
|
164
|
+
to: e
|
|
165
|
+
})))
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
// packages/teaching/src/lesson/lesson-context.ts
|
|
169
|
+
var L = i(null);
|
|
170
|
+
function R(e) {
|
|
171
|
+
return a(L) ?? T(e);
|
|
172
|
+
}
|
|
173
|
+
function z(e, t) {
|
|
174
|
+
let n = { scope: e };
|
|
175
|
+
for (; n.scope !== null && n.scope.lesson !== t;) n.scope = n.scope.outer;
|
|
176
|
+
return n.scope;
|
|
177
|
+
}
|
|
178
|
+
// packages/teaching/src/lesson/bound-value.tsx
|
|
179
|
+
var B = 240, V = {
|
|
180
|
+
step: .01,
|
|
181
|
+
large: .1,
|
|
182
|
+
small: .001
|
|
183
|
+
}, H = [
|
|
184
|
+
"ArrowLeft",
|
|
185
|
+
"ArrowRight",
|
|
186
|
+
"ArrowUp",
|
|
187
|
+
"ArrowDown",
|
|
188
|
+
"PageUp",
|
|
189
|
+
"PageDown",
|
|
190
|
+
"Home",
|
|
191
|
+
"End"
|
|
192
|
+
];
|
|
193
|
+
function U({ min: e, max: t, step: n }) {
|
|
194
|
+
return {
|
|
195
|
+
min: e,
|
|
196
|
+
max: t,
|
|
197
|
+
step: n
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function W(e, t) {
|
|
201
|
+
let n = U(t);
|
|
202
|
+
return v(S(re(e, 0, 1), n, t.scale ?? "linear"), n).value;
|
|
203
|
+
}
|
|
204
|
+
function G(e, t, n) {
|
|
205
|
+
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;
|
|
208
|
+
}
|
|
209
|
+
var K = d({
|
|
210
|
+
name: "bound-value",
|
|
211
|
+
options: {
|
|
212
|
+
value: "number",
|
|
213
|
+
defaultValue: "number",
|
|
214
|
+
onValueChange: "callback",
|
|
215
|
+
min: "number",
|
|
216
|
+
max: "number",
|
|
217
|
+
step: "number",
|
|
218
|
+
scale: "string",
|
|
219
|
+
describe: "value"
|
|
220
|
+
},
|
|
221
|
+
controlled: ["value"],
|
|
222
|
+
state: (e) => ({
|
|
223
|
+
value: e.value ?? e.defaultValue ?? e.min,
|
|
224
|
+
isDragging: !1
|
|
225
|
+
}),
|
|
226
|
+
sync: (e) => e.value === void 0 ? {} : { value: e.value },
|
|
227
|
+
api: (e) => {
|
|
228
|
+
let { store: t } = e, n = u(e), r = null;
|
|
229
|
+
e.onDestroy(() => r?.());
|
|
230
|
+
function i(e, r, i) {
|
|
231
|
+
return e !== t.get().value && n("value", e, i === void 0 ? { reason: r } : {
|
|
232
|
+
reason: r,
|
|
233
|
+
event: i
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
describe: (t) => e.options().describe(t),
|
|
238
|
+
setValue(t) {
|
|
239
|
+
let { min: n, max: r } = e.options(), a = Number(t);
|
|
240
|
+
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");
|
|
242
|
+
},
|
|
243
|
+
keydown(n, r) {
|
|
244
|
+
let a = b(n, { dir: p(r) ? "rtl" : "ltr" });
|
|
245
|
+
if (a === null || n.defaultPrevented) return;
|
|
246
|
+
n.preventDefault();
|
|
247
|
+
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);
|
|
249
|
+
},
|
|
250
|
+
pointerdown(n, a) {
|
|
251
|
+
if (n.button !== 0) return;
|
|
252
|
+
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,
|
|
256
|
+
cancelOnEscape: !0,
|
|
257
|
+
onStart: () => {
|
|
258
|
+
t.set({ isDragging: !0 });
|
|
259
|
+
},
|
|
260
|
+
onMove: ({ movementX: t, event: n }) => {
|
|
261
|
+
u += t * s, i(W(c + u / B, e.options()), "drag", n);
|
|
262
|
+
},
|
|
263
|
+
onEnd: (e, n) => {
|
|
264
|
+
t.set({ isDragging: !1 }), n && i(o, "drag", e);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
},
|
|
270
|
+
slots: (e) => ({ root: e({
|
|
271
|
+
role: "slider",
|
|
272
|
+
focus: "tab-stop",
|
|
273
|
+
keys: [...H],
|
|
274
|
+
state: (e, { api: t }) => ({
|
|
275
|
+
text: t.describe(e.value),
|
|
276
|
+
isDragging: e.isDragging
|
|
277
|
+
}),
|
|
278
|
+
attrs: (e, { api: t }) => ({
|
|
279
|
+
tabindex: "0",
|
|
280
|
+
"aria-valuenow": String(e.value),
|
|
281
|
+
"aria-valuetext": t.describe(e.value),
|
|
282
|
+
"data-dragging": e.isDragging ? "" : void 0
|
|
283
|
+
}),
|
|
284
|
+
on: {
|
|
285
|
+
keydown: (e, { api: t, el: n }) => {
|
|
286
|
+
n !== void 0 && t.keydown(e, n);
|
|
287
|
+
},
|
|
288
|
+
pointerdown: (e, { api: t, el: n }) => {
|
|
289
|
+
n !== void 0 && t.pointerdown(e, n);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}) }),
|
|
293
|
+
agent: { actions: ["setValue"] }
|
|
294
|
+
}), q = r(K, { root: "span" }).Root;
|
|
295
|
+
function J({ min: e, max: t, step: n, scale: r, value: i }) {
|
|
296
|
+
if (!Number.isFinite(e) || !Number.isFinite(t) || e >= t) return "BoundValue needs finite bounds with min below max.";
|
|
297
|
+
if (!Number.isFinite(n) || n < 0) return "BoundValue needs a step of zero or more.";
|
|
298
|
+
if (r === "log" && e <= 0) return "A log BoundValue needs a min above zero.";
|
|
299
|
+
if (i !== void 0 && !(Number.isFinite(i) && i >= e && i <= t)) return `BoundValue ${i} lies outside ${e} to ${t}.`;
|
|
300
|
+
}
|
|
301
|
+
function Y({ label: e, locale: t, format: r, ...i }) {
|
|
302
|
+
let a = J(i);
|
|
303
|
+
return a === void 0 ? /* @__PURE__ */ m(q, {
|
|
304
|
+
...i,
|
|
305
|
+
describe: (e) => n({
|
|
306
|
+
value: e,
|
|
307
|
+
locale: t,
|
|
308
|
+
format: r
|
|
309
|
+
}),
|
|
310
|
+
"aria-label": e,
|
|
311
|
+
"aria-valuemin": i.min,
|
|
312
|
+
"aria-valuemax": i.max,
|
|
313
|
+
"aria-orientation": "horizontal",
|
|
314
|
+
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", {
|
|
316
|
+
...e,
|
|
317
|
+
children: t
|
|
318
|
+
})
|
|
319
|
+
}) : /* @__PURE__ */ m("span", {
|
|
320
|
+
className: "xr5kp14 x1b5ytql",
|
|
321
|
+
children: a
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
// packages/teaching/src/lesson/inline-choice.tsx
|
|
325
|
+
var ae = 14;
|
|
326
|
+
function oe({ param: e, value: n, isDisabled: r, onChange: i }) {
|
|
327
|
+
let a = e.options.map((e) => ({
|
|
328
|
+
value: e.id,
|
|
329
|
+
label: e.label
|
|
330
|
+
}));
|
|
331
|
+
return /* @__PURE__ */ h(t.Root, {
|
|
332
|
+
value: n,
|
|
333
|
+
items: a,
|
|
334
|
+
disabled: r,
|
|
335
|
+
onValueChange: (e, t) => {
|
|
336
|
+
e !== null && i(e, t);
|
|
337
|
+
},
|
|
338
|
+
children: [/* @__PURE__ */ h(g, {
|
|
339
|
+
"aria-label": e.label,
|
|
340
|
+
disabled: r,
|
|
341
|
+
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,
|
|
344
|
+
"aria-hidden": !0,
|
|
345
|
+
className: "xamitd3 x153jb6y"
|
|
346
|
+
})]
|
|
347
|
+
}), /* @__PURE__ */ m(t.Popup, {
|
|
348
|
+
align: "start",
|
|
349
|
+
children: /* @__PURE__ */ m(t.List, { children: a.map((e) => /* @__PURE__ */ h(t.Item, {
|
|
350
|
+
value: e.value,
|
|
351
|
+
children: [/* @__PURE__ */ m(t.ItemText, { children: e.label }), /* @__PURE__ */ m(t.ItemIndicator, { children: /* @__PURE__ */ m(ee, {
|
|
352
|
+
size: 16,
|
|
353
|
+
"aria-hidden": !0
|
|
354
|
+
}) })]
|
|
355
|
+
}, e.value)) })
|
|
356
|
+
})]
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
// packages/teaching/src/lesson/param.tsx
|
|
360
|
+
var se = 700, X = {
|
|
361
|
+
on: "on",
|
|
362
|
+
off: "off"
|
|
363
|
+
};
|
|
364
|
+
function Z(e, t) {
|
|
365
|
+
let n = new Map(Object.entries(e.lesson.params)).get(t);
|
|
366
|
+
return n === void 0 ? { error: `Lesson "${e.lesson.id}" has no param "${t}". Its params: ${Object.keys(e.lesson.params).join(", ")}.` } : { param: n };
|
|
367
|
+
}
|
|
368
|
+
function Q({ param: e, value: t, locale: r, labels: i }) {
|
|
369
|
+
switch (e.kind) {
|
|
370
|
+
case "number": return n({
|
|
371
|
+
value: typeof t == "number" ? t : null,
|
|
372
|
+
locale: r,
|
|
373
|
+
format: e.format
|
|
374
|
+
});
|
|
375
|
+
case "choice": return e.options.find((e) => e.id === t)?.label ?? String(t);
|
|
376
|
+
case "toggle": return t === !0 ? i.on : i.off;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function ce({ name: t }) {
|
|
380
|
+
let n = R("Param"), r = Z(n, t);
|
|
381
|
+
if ("error" in r) return /* @__PURE__ */ m(E, { children: r.error });
|
|
382
|
+
let { param: i } = r, a = n.state.values[t], { isReadOnly: o } = n.state;
|
|
383
|
+
switch (i.kind) {
|
|
384
|
+
case "number": return o ? /* @__PURE__ */ m("span", {
|
|
385
|
+
className: "xss6m8b xk4h15q xuxw1ft xbixft",
|
|
386
|
+
children: Q({
|
|
387
|
+
param: i,
|
|
388
|
+
value: a,
|
|
389
|
+
locale: n.locale,
|
|
390
|
+
labels: X
|
|
391
|
+
})
|
|
392
|
+
}) : /* @__PURE__ */ m(Y, {
|
|
393
|
+
value: typeof a == "number" ? a : i.value,
|
|
394
|
+
onValueChange: (e, r) => n.api.apply(t, e, r),
|
|
395
|
+
min: i.min,
|
|
396
|
+
max: i.max,
|
|
397
|
+
step: i.step,
|
|
398
|
+
scale: i.scale,
|
|
399
|
+
locale: n.locale,
|
|
400
|
+
format: i.format,
|
|
401
|
+
label: i.label
|
|
402
|
+
});
|
|
403
|
+
case "choice": return /* @__PURE__ */ m(oe, {
|
|
404
|
+
param: i,
|
|
405
|
+
value: typeof a == "string" ? a : i.value,
|
|
406
|
+
isDisabled: o,
|
|
407
|
+
onChange: (e, r) => n.api.apply(t, e, r)
|
|
408
|
+
});
|
|
409
|
+
case "toggle": return /* @__PURE__ */ m("span", {
|
|
410
|
+
className: "x3nfvp2 xxymvpz",
|
|
411
|
+
children: /* @__PURE__ */ m(e.Root, {
|
|
412
|
+
checked: a === !0,
|
|
413
|
+
onCheckedChange: (e, r) => n.api.apply(t, e, r),
|
|
414
|
+
disabled: o,
|
|
415
|
+
"aria-label": i.label,
|
|
416
|
+
children: /* @__PURE__ */ m(e.Thumb, {})
|
|
417
|
+
})
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
function le(e, t) {
|
|
422
|
+
let n = s(e);
|
|
423
|
+
o(() => {
|
|
424
|
+
if (t || n.current === e) return;
|
|
425
|
+
let r = globalThis.setTimeout(() => {
|
|
426
|
+
n.current = e, c(e);
|
|
427
|
+
}, se);
|
|
428
|
+
return () => globalThis.clearTimeout(r);
|
|
429
|
+
}, [e, t]);
|
|
430
|
+
}
|
|
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({
|
|
433
|
+
param: a.param,
|
|
434
|
+
value: o,
|
|
435
|
+
locale: r.locale,
|
|
436
|
+
labels: {
|
|
437
|
+
...X,
|
|
438
|
+
...t
|
|
439
|
+
}
|
|
440
|
+
}) : void 0 : n({
|
|
441
|
+
value: typeof o == "number" ? o : null,
|
|
442
|
+
locale: r.locale,
|
|
443
|
+
format: i.format
|
|
444
|
+
}), 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", {
|
|
446
|
+
className: "xss6m8b xk4h15q xuxw1ft",
|
|
447
|
+
children: s
|
|
448
|
+
});
|
|
449
|
+
}
|
|
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 };
|
|
@@ -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-
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import { u as e } from "./src-
|
|
2
|
-
import { d as t, m as n } from "./src-
|
|
1
|
+
import { u as e } from "./src-9EJskqB_.js";
|
|
2
|
+
import { d as t, m as n } from "./src-npqwq3Sa.js";
|
|
3
3
|
import { n as r, t as i } from "./chart-tones-ei3BC2AL.js";
|
|
4
4
|
import { a, i as o, n as s, r as c } from "./figure-format-B8kRZMlo.js";
|
|
5
5
|
import { r as l, t as u } from "./scale-C2xgZyZN.js";
|
|
@@ -260,7 +260,8 @@ var j = y({
|
|
|
260
260
|
}),
|
|
261
261
|
attrs: (e, { key: t }) => ({
|
|
262
262
|
"data-inspected": e.inspected === t ? "" : void 0,
|
|
263
|
-
"data-selected": e.selected === t ? "" : void 0
|
|
263
|
+
"data-selected": e.selected === t ? "" : void 0,
|
|
264
|
+
"data-chart-mark": t
|
|
264
265
|
}),
|
|
265
266
|
selects: w({
|
|
266
267
|
items: () => [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as e, t } from "./chart-tones-ei3BC2AL.js";
|
|
2
2
|
import { r as n } from "./tokens.stylex-dF5CACEJ.js";
|
|
3
|
-
import { n as r } from "./plot-width-
|
|
3
|
+
import { n as r } from "./plot-width-D3hTycYX.js";
|
|
4
4
|
import * as i from "@stylexjs/stylex";
|
|
5
5
|
import { jsx as a } from "react/jsx-runtime";
|
|
6
6
|
// packages/charts/src/plot/plot-marks.tsx
|
|
@@ -80,14 +80,14 @@ var o = 4, s = 1.25, c = {
|
|
|
80
80
|
$$css: !0
|
|
81
81
|
},
|
|
82
82
|
receded: {
|
|
83
|
-
kSiTet: "
|
|
83
|
+
kSiTet: "xyd83as",
|
|
84
84
|
$$css: !0
|
|
85
85
|
}
|
|
86
86
|
}, d = {
|
|
87
87
|
normal: { $$css: !0 },
|
|
88
88
|
context: { $$css: !0 },
|
|
89
89
|
receded: {
|
|
90
|
-
kSiTet: "
|
|
90
|
+
kSiTet: "xyd83as",
|
|
91
91
|
$$css: !0
|
|
92
92
|
}
|
|
93
93
|
}, f = `color-mix(in srgb, ${n.faint} 70%, ${n.muted})`;
|
|
@@ -115,26 +115,28 @@ function g({ d: e, tone: t, emphasis: n = "normal" }) {
|
|
|
115
115
|
...i.props(c.band, r.emphasis, d[n])
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
function _({ x: t, y: n, tone: s, radius: l = o, isHollow: u = !1, emphasis: f = "normal", isInspected: m = !1, isSelected: h = !1 }) {
|
|
119
|
-
let
|
|
118
|
+
function _({ x: t, y: n, tone: s, radius: l = o, isHollow: u = !1, emphasis: f = "normal", isInspected: m = !1, isSelected: h = !1, mark: g }) {
|
|
119
|
+
let _ = p(s, f);
|
|
120
120
|
return /* @__PURE__ */ a("circle", {
|
|
121
|
+
"data-chart-mark": g,
|
|
121
122
|
cx: t,
|
|
122
123
|
cy: n,
|
|
123
124
|
r: l,
|
|
124
|
-
fill:
|
|
125
|
-
stroke: u ?
|
|
125
|
+
fill: _,
|
|
126
|
+
stroke: u ? _ : e[s],
|
|
126
127
|
...i.props(r.outlined, r.emphasis, u && c.hollow, d[f], m && r.inspected, h && r.selected)
|
|
127
128
|
});
|
|
128
129
|
}
|
|
129
|
-
function v({ x: t, y: n, width: o, height: s, tone: l, isHollow: u = !1, emphasis: f = "normal", isInspected: m = !1, isSelected: h = !1 }) {
|
|
130
|
-
let
|
|
130
|
+
function v({ x: t, y: n, width: o, height: s, tone: l, isHollow: u = !1, emphasis: f = "normal", isInspected: m = !1, isSelected: h = !1, mark: g }) {
|
|
131
|
+
let _ = p(l, f);
|
|
131
132
|
return /* @__PURE__ */ a("rect", {
|
|
133
|
+
"data-chart-mark": g,
|
|
132
134
|
x: t,
|
|
133
135
|
y: n,
|
|
134
136
|
width: Math.max(0, o),
|
|
135
137
|
height: Math.max(0, s),
|
|
136
|
-
fill:
|
|
137
|
-
stroke: u ?
|
|
138
|
+
fill: _,
|
|
139
|
+
stroke: u ? _ : e[l],
|
|
138
140
|
...i.props(r.outlined, r.emphasis, u && c.hollow, u && c.hollowBar, d[f], m && r.inspected, h && r.selected)
|
|
139
141
|
});
|
|
140
142
|
}
|
|
@@ -147,17 +149,18 @@ function b({ shape: e, x: t, y: n, radius: r }) {
|
|
|
147
149
|
case "diamond": return `M${t},${n - i}L${t + i},${n}L${t},${n + i}L${t - i},${n}Z`;
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
|
-
function x({ shape: t, x: n, y: s, tone: l, radius: u = o, isHollow: f = !1, emphasis: m = "normal", isInspected: h = !1, isSelected: g = !1 }) {
|
|
151
|
-
let
|
|
152
|
+
function x({ shape: t, x: n, y: s, tone: l, radius: u = o, isHollow: f = !1, emphasis: m = "normal", isInspected: h = !1, isSelected: g = !1, mark: _ }) {
|
|
153
|
+
let v = p(l, m);
|
|
152
154
|
return /* @__PURE__ */ a("path", {
|
|
155
|
+
"data-chart-mark": _,
|
|
153
156
|
d: b({
|
|
154
157
|
shape: t,
|
|
155
158
|
x: n,
|
|
156
159
|
y: s,
|
|
157
160
|
radius: u
|
|
158
161
|
}),
|
|
159
|
-
fill:
|
|
160
|
-
stroke: f ?
|
|
162
|
+
fill: v,
|
|
163
|
+
stroke: f ? v : e[l],
|
|
161
164
|
...i.props(r.outlined, r.emphasis, f && c.hollow, d[m], g ? r.selected : h && r.inspected)
|
|
162
165
|
});
|
|
163
166
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as e, t } from "./plot-width-
|
|
2
|
-
import { E as n, c as r } from "./plot-layout-
|
|
1
|
+
import { n as e, t } from "./plot-width-D3hTycYX.js";
|
|
2
|
+
import { E as n, c as r } from "./plot-layout-Bqe4-0qZ.js";
|
|
3
3
|
import * as i from "@stylexjs/stylex";
|
|
4
4
|
import { useId as a } from "react";
|
|
5
5
|
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
@@ -33,19 +33,19 @@ function u({ plotRef: t, box: r, label: a, readoutId: o, children: l, overlay: u
|
|
|
33
33
|
})]
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
function d({ box: e,
|
|
37
|
-
let
|
|
36
|
+
function d({ box: e, pad: t = 0, children: n }) {
|
|
37
|
+
let r = a();
|
|
38
38
|
return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("defs", { children: /* @__PURE__ */ s("clipPath", {
|
|
39
|
-
id:
|
|
39
|
+
id: r,
|
|
40
40
|
children: /* @__PURE__ */ s("rect", {
|
|
41
|
-
x: e.left,
|
|
42
|
-
y: e.top,
|
|
43
|
-
width: e.innerWidth,
|
|
44
|
-
height: e.innerHeight
|
|
41
|
+
x: e.left - t,
|
|
42
|
+
y: e.top - t,
|
|
43
|
+
width: e.innerWidth + t * 2,
|
|
44
|
+
height: e.innerHeight + t * 2
|
|
45
45
|
})
|
|
46
46
|
}) }), /* @__PURE__ */ s("g", {
|
|
47
|
-
clipPath: `url(#${
|
|
48
|
-
children:
|
|
47
|
+
clipPath: `url(#${r})`,
|
|
48
|
+
children: n
|
|
49
49
|
})] });
|
|
50
50
|
}
|
|
51
51
|
export { u as n, l as r, d as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as e } from "./plot-layout-
|
|
1
|
+
import { A as e } from "./plot-layout-Bqe4-0qZ.js";
|
|
2
2
|
import { t } from "./label-spacing-BncjePGb.js";
|
|
3
3
|
import { n, t as r } from "./label-place-Z0fryBZb.js";
|
|
4
|
-
import { c as i, f as a } from "./plot-marks-
|
|
4
|
+
import { c as i, f as a } from "./plot-marks-FVsbFkUs.js";
|
|
5
5
|
import { a as o } from "./scale-C2xgZyZN.js";
|
|
6
6
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
7
|
// packages/charts/src/cartesian/reference-lines.tsx
|