semiotic 3.4.2 → 3.5.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.
- package/CLAUDE.md +114 -9
- package/README.md +45 -4
- package/ai/behaviorContracts.cjs +311 -0
- package/ai/chartSuggestions.cjs +291 -0
- package/ai/cli.js +255 -30
- package/ai/componentMetadata.cjs +107 -0
- package/ai/dist/mcp-server.js +907 -227
- package/ai/schema.json +3954 -2537
- package/ai/system-prompt.md +23 -4
- package/dist/components/LinkedCharts.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +64 -0
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +71 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +59 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +93 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +51 -4
- package/dist/components/charts/geo/FlowMap.d.ts +55 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +53 -0
- package/dist/components/charts/index.d.ts +6 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +34 -2
- package/dist/components/charts/network/CirclePack.d.ts +36 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +130 -2
- package/dist/components/charts/network/OrbitDiagram.d.ts +37 -0
- package/dist/components/charts/network/SankeyDiagram.d.ts +51 -2
- package/dist/components/charts/network/TreeDiagram.d.ts +37 -2
- package/dist/components/charts/network/Treemap.d.ts +36 -2
- package/dist/components/charts/ordinal/BarChart.d.ts +113 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +33 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +36 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +33 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +40 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +45 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +40 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +97 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +44 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +90 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +29 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +40 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +38 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +62 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +34 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +22 -4
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -2
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +24 -3
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +12 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +14 -0
- package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +67 -0
- package/dist/components/charts/realtime/resolveWindowSize.d.ts +26 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +91 -0
- package/dist/components/charts/shared/colorPalettes.d.ts +62 -0
- package/dist/components/charts/shared/colorUtils.d.ts +9 -10
- package/dist/components/charts/shared/numberFormat.d.ts +58 -0
- package/dist/components/charts/shared/sparseArray.d.ts +27 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +113 -0
- package/dist/components/charts/shared/timeFormat.d.ts +60 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +8 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +84 -0
- package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +28 -0
- package/dist/components/charts/shared/useOrdinalStreaming.d.ts +6 -19
- package/dist/components/charts/shared/useStreamingLegend.d.ts +27 -11
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/validationMap.d.ts +2 -1
- package/dist/components/charts/shared/withChartWrapper.d.ts +13 -4
- package/dist/components/charts/xy/AreaChart.d.ts +44 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +4 -0
- package/dist/components/charts/xy/CandlestickChart.d.ts +37 -6
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +28 -0
- package/dist/components/charts/xy/Heatmap.d.ts +4 -0
- package/dist/components/charts/xy/LineChart.d.ts +12 -0
- package/dist/components/charts/xy/MinimapChart.d.ts +58 -0
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +27 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +21 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +38 -2
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +16 -0
- package/dist/components/charts/xy/StackedAreaChart.d.ts +61 -1
- package/dist/components/realtime/types.d.ts +2 -4
- package/dist/components/recipes/bullet.d.ts +86 -0
- package/dist/components/recipes/calendar.d.ts +43 -0
- package/dist/components/recipes/dagre.d.ts +56 -0
- package/dist/components/recipes/flextree.d.ts +55 -0
- package/dist/components/recipes/marimekko.d.ts +55 -0
- package/dist/components/recipes/parallelCoordinates.d.ts +97 -0
- package/dist/components/recipes/recipeUtils.d.ts +27 -0
- package/dist/components/recipes/waffle.d.ts +46 -0
- package/dist/components/semiotic-ai.d.ts +4 -0
- package/dist/components/semiotic-network.d.ts +3 -0
- package/dist/components/semiotic-ordinal.d.ts +3 -0
- package/dist/components/semiotic-recipes.d.ts +24 -0
- package/dist/components/semiotic-xy.d.ts +3 -0
- package/dist/components/semiotic.d.ts +2 -2
- package/dist/components/server/renderToStaticSVG.d.ts +8 -2
- package/dist/components/server/serverChartConfigs.d.ts +47 -1
- package/dist/components/server/staticAnnotations.d.ts +6 -0
- package/dist/components/store/ObservationStore.d.ts +1 -3
- package/dist/components/store/SelectionStore.d.ts +1 -3
- package/dist/components/store/ThemeStore.d.ts +4 -4
- package/dist/components/store/TooltipStore.d.ts +1 -3
- package/dist/components/store/createStore.d.ts +4 -2
- package/dist/components/stream/CanvasHitTester.d.ts +10 -8
- package/dist/components/stream/DataSourceAdapter.d.ts +9 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +9 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +14 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +25 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +12 -0
- package/dist/components/stream/PipelineStore.d.ts +51 -0
- package/dist/components/stream/SVGOverlay.d.ts +12 -0
- package/dist/components/stream/SceneGraph.d.ts +15 -1
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/categoryDomain.d.ts +4 -0
- package/dist/components/stream/composeOverlays.d.ts +15 -0
- package/dist/components/stream/customLayout.d.ts +76 -0
- package/dist/components/stream/customLayoutPalette.d.ts +29 -0
- package/dist/components/stream/geoTypes.d.ts +13 -0
- package/dist/components/stream/hoverUtils.d.ts +4 -10
- package/dist/components/stream/networkCustomLayout.d.ts +67 -0
- package/dist/components/stream/networkTypes.d.ts +45 -0
- package/dist/components/stream/ordinalCustomLayout.d.ts +84 -0
- package/dist/components/stream/ordinalTypes.d.ts +35 -1
- package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +9 -1
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +92 -0
- package/dist/components/stream/sampleCurvePath.d.ts +9 -0
- package/dist/components/stream/types.d.ts +44 -1
- package/dist/components/stream/useHydration.d.ts +89 -0
- package/dist/components/stream/useStableShallow.d.ts +1 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +4 -0
- package/dist/geo.min.js +2 -1
- package/dist/geo.module.min.js +2 -1
- package/dist/network.min.js +2 -1
- package/dist/network.module.min.js +2 -1
- package/dist/ordinal.min.js +2 -1
- package/dist/ordinal.module.min.js +2 -1
- package/dist/realtime.min.js +2 -1
- package/dist/realtime.module.min.js +2 -1
- package/dist/semiotic-ai.d.ts +69 -65
- package/dist/semiotic-ai.min.js +2 -1
- package/dist/semiotic-ai.module.min.js +2 -1
- package/dist/semiotic-data.d.ts +4 -4
- package/dist/semiotic-geo.d.ts +15 -15
- package/dist/semiotic-network.d.ts +19 -16
- package/dist/semiotic-ordinal.d.ts +31 -28
- package/dist/semiotic-realtime.d.ts +17 -17
- package/dist/semiotic-recipes.d.ts +24 -0
- package/dist/semiotic-recipes.min.js +1 -0
- package/dist/semiotic-recipes.module.min.js +1 -0
- package/dist/semiotic-server.d.ts +6 -6
- package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +1 -0
- package/dist/semiotic-themes.d.ts +3 -3
- package/dist/semiotic-themes.min.js +2 -1
- package/dist/semiotic-themes.module.min.js +2 -1
- package/dist/semiotic-utils.d.ts +23 -23
- package/dist/semiotic-utils.min.js +2 -1
- package/dist/semiotic-utils.module.min.js +2 -1
- package/dist/semiotic-xy.d.ts +27 -24
- package/dist/semiotic.d.ts +63 -63
- package/dist/semiotic.min.js +2 -1
- package/dist/semiotic.module.min.js +2 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/test-utils/canvasMock.d.ts +34 -5
- package/dist/xy.min.js +2 -1
- package/dist/xy.module.min.js +2 -1
- package/package.json +38 -17
- package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +0 -1
|
@@ -74,7 +74,7 @@ export interface MarginalGraphicsConfig {
|
|
|
74
74
|
left?: MarginalConfig | MarginalType;
|
|
75
75
|
right?: MarginalConfig | MarginalType;
|
|
76
76
|
}
|
|
77
|
-
export type StreamChartType = "line" | "area" | "stackedarea" | "mixed" | "scatter" | "bubble" | "heatmap" | "bar" | "swarm" | "waterfall" | "candlestick";
|
|
77
|
+
export type StreamChartType = "line" | "area" | "stackedarea" | "mixed" | "scatter" | "bubble" | "heatmap" | "bar" | "swarm" | "waterfall" | "candlestick" | "custom";
|
|
78
78
|
export type RuntimeMode = "bounded" | "streaming";
|
|
79
79
|
export interface Style {
|
|
80
80
|
stroke?: string;
|
|
@@ -137,6 +137,14 @@ export interface AreaSceneNode {
|
|
|
137
137
|
style: Style;
|
|
138
138
|
datum: SeriesDatum;
|
|
139
139
|
group?: string;
|
|
140
|
+
/** Clip the area to this rect (in plot-relative pixels). Used by horizon
|
|
141
|
+
* charts to band a single series into N slices. */
|
|
142
|
+
clipRect?: {
|
|
143
|
+
x: number;
|
|
144
|
+
y: number;
|
|
145
|
+
width: number;
|
|
146
|
+
height: number;
|
|
147
|
+
};
|
|
140
148
|
/** Gradient fill: opacity-based (topOpacity/bottomOpacity) or multi-color (colorStops) */
|
|
141
149
|
fillGradient?: {
|
|
142
150
|
topOpacity: number;
|
|
@@ -364,6 +372,27 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
364
372
|
lineDataAccessor?: string;
|
|
365
373
|
curve?: CurveType;
|
|
366
374
|
normalize?: boolean;
|
|
375
|
+
/**
|
|
376
|
+
* Stacked area baseline. Only consulted by stackedarea chartType.
|
|
377
|
+
* - "zero" (default): standard stack from y=0
|
|
378
|
+
* - "wiggle": Byron–Wattenberg streamgraph offset (minimizes wiggle)
|
|
379
|
+
* - "silhouette": center the stack symmetrically around y=0
|
|
380
|
+
*
|
|
381
|
+
* Mutually exclusive with `normalize`: when `normalize` is `true`, the
|
|
382
|
+
* stack is forced to a `"zero"` baseline (any other value is ignored)
|
|
383
|
+
* because normalization assumes a fixed `[0, 1]` y-domain.
|
|
384
|
+
*/
|
|
385
|
+
baseline?: "zero" | "wiggle" | "silhouette";
|
|
386
|
+
/**
|
|
387
|
+
* Stack order — controls which series sits at the top, middle, or bottom.
|
|
388
|
+
* - "key" (default): alphabetical by group key
|
|
389
|
+
* - "insideOut": largest-total series in the middle, smaller alternating
|
|
390
|
+
* above/below. Combined with `baseline: "wiggle"` or `"silhouette"`,
|
|
391
|
+
* produces the canonical streamgraph look where a "central anchor"
|
|
392
|
+
* layer sits across y=0 and other layers stack outward.
|
|
393
|
+
* - "asc" / "desc": by total ascending / descending
|
|
394
|
+
*/
|
|
395
|
+
stackOrder?: "key" | "insideOut" | "asc" | "desc";
|
|
367
396
|
/**
|
|
368
397
|
* Accessor returning a symmetric uncertainty offset per datum.
|
|
369
398
|
* When set, an uncertainty band is drawn ± this offset from the line.
|
|
@@ -506,6 +535,10 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
506
535
|
legendHighlightedCategory?: string | null;
|
|
507
536
|
legendIsolatedCategories?: Set<string>;
|
|
508
537
|
legendPosition?: "right" | "left" | "top" | "bottom";
|
|
538
|
+
/** Accessor used to report the current legend category domain in push mode. */
|
|
539
|
+
legendCategoryAccessor?: string | ((d: T) => string);
|
|
540
|
+
/** Fires when the current legend category domain changes after scene rebuilds. */
|
|
541
|
+
onCategoriesChange?: (categories: string[]) => void;
|
|
509
542
|
/** SVG elements rendered behind the canvas (in pixel space) */
|
|
510
543
|
backgroundGraphics?: ReactNode;
|
|
511
544
|
/** SVG elements rendered on top of everything (in SVG overlay) */
|
|
@@ -550,6 +583,16 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
550
583
|
linkedCrosshairName?: string;
|
|
551
584
|
/** Source chart ID — crosshair is suppressed on the source chart to avoid double rendering */
|
|
552
585
|
linkedCrosshairSourceId?: string;
|
|
586
|
+
/** Replaces chart-type scene dispatch with a user-supplied layout function.
|
|
587
|
+
* Receives a LayoutContext (scales, dimensions, theme, resolveColor) and
|
|
588
|
+
* returns SceneNode[] + optional overlays. See `semiotic/recipes` for
|
|
589
|
+
* reference layouts (waffle, calendar, horizon). */
|
|
590
|
+
customLayout?: import("./customLayout").CustomLayout;
|
|
591
|
+
/** User-supplied config blob threaded through to LayoutContext.config.
|
|
592
|
+
* Typed as `object` so caller-defined interfaces (without an index
|
|
593
|
+
* signature) flow through without casts; layouts narrow via their
|
|
594
|
+
* own `CustomLayout<TConfig>` parameterization. */
|
|
595
|
+
layoutConfig?: object;
|
|
553
596
|
}
|
|
554
597
|
export interface StreamXYFrameHandle<T = Datum> {
|
|
555
598
|
push(datum: T): void;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { MutableRefObject, RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Returns `false` on the server (no effect fires there) and during the
|
|
4
|
+
* first client render after hydration; `true` from the first
|
|
5
|
+
* post-commit re-render onward.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useHydration(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Returns `true` when this component instance was mounted via SSR
|
|
10
|
+
* hydration (i.e. there was server-rendered HTML to hydrate from), and
|
|
11
|
+
* `false` when it was mounted via pure client-side rendering (no SSR).
|
|
12
|
+
*
|
|
13
|
+
* The trick: `useSyncExternalStore`'s `getServerSnapshot` callback is
|
|
14
|
+
* called *only* during hydration of server-rendered content — never
|
|
15
|
+
* during a fresh CSR mount. Returning different values from the two
|
|
16
|
+
* snapshots lets us read the hydration mode on the very first render,
|
|
17
|
+
* then we capture it into a ref so it survives later renders.
|
|
18
|
+
*
|
|
19
|
+
* Stream Frames use this to decide whether to skip the intro animation
|
|
20
|
+
* on the canvas's first paint: when SSR has already shown the chart in
|
|
21
|
+
* its final state, re-animating from blank when the canvas takes over
|
|
22
|
+
* looks like a regression. CSR mounts keep their intro animation
|
|
23
|
+
* because the SVG branch's output never actually paints (it's
|
|
24
|
+
* overwritten by the canvas branch within the same paint frame, before
|
|
25
|
+
* the browser commits a frame).
|
|
26
|
+
*/
|
|
27
|
+
export declare function useWasHydratingFromSSR(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Shared post-hydration lifecycle for every Stream Frame.
|
|
30
|
+
*
|
|
31
|
+
* Three things happen on every commit-after-hydration:
|
|
32
|
+
*
|
|
33
|
+
* 1. If we just rehydrated from SSR, cancel the intro animation that
|
|
34
|
+
* the SVG-branch's `computeScene` installed (the server already
|
|
35
|
+
* painted the chart in its final state — re-animating from blank
|
|
36
|
+
* on the canvas takeover is a visual regression).
|
|
37
|
+
* 2. Mark the scene dirty so the canvas-paint pipeline rebuilds.
|
|
38
|
+
* 3. **Paint the canvas synchronously** via `renderFnRef.current()`.
|
|
39
|
+
*
|
|
40
|
+
* Step 3 is the timing-critical bit. The hook fires inside an
|
|
41
|
+
* isomorphic layout effect — `useLayoutEffect` on the client (runs
|
|
42
|
+
* synchronously after commit but before the browser paints),
|
|
43
|
+
* `useEffect` on the server (no-op, since SSR doesn't paint). If we
|
|
44
|
+
* deferred the paint to a `requestAnimationFrame` (the standard
|
|
45
|
+
* `scheduleRender()` route), the rAF callback wouldn't fire until
|
|
46
|
+
* the *next* frame — meaning the browser would paint *frame N* with
|
|
47
|
+
* the canvas in DOM but blank, then *frame N+1* with the canvas
|
|
48
|
+
* actually drawn. Synchronous paint inside the layout effect makes
|
|
49
|
+
* frame N's paint already include the canvas content; no flash.
|
|
50
|
+
*
|
|
51
|
+
* Each frame supplies its own `cleanup` for unmount work that's
|
|
52
|
+
* frame-specific (XY/Ordinal clear the streaming adapter; Geo clears
|
|
53
|
+
* its tile cache; Network has no extra cleanup).
|
|
54
|
+
*/
|
|
55
|
+
export interface HydrationLifecycleOptions {
|
|
56
|
+
hydrated: boolean;
|
|
57
|
+
wasHydratingFromSSR: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Ref to the frame's pipeline store. The store optionally implements
|
|
60
|
+
* `cancelIntroAnimation()`; the hook calls it when the SVG → canvas
|
|
61
|
+
* swap fires after SSR rehydration. (Currently every shipped store
|
|
62
|
+
* implements the method, but the optional shape lets a custom store
|
|
63
|
+
* opt out.)
|
|
64
|
+
*/
|
|
65
|
+
storeRef: RefObject<{
|
|
66
|
+
cancelIntroAnimation?: () => void;
|
|
67
|
+
} | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Mutable dirty flag the renderer reads on its next paint. The hook
|
|
70
|
+
* sets it to true on every commit so the post-hydration paint
|
|
71
|
+
* rebuilds the scene from scratch.
|
|
72
|
+
*/
|
|
73
|
+
dirtyRef: MutableRefObject<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* Ref to the frame's render closure (assigned by `useFrame` /
|
|
76
|
+
* the frame body). The hook calls this synchronously to paint
|
|
77
|
+
* within the same frame as the SVG → canvas swap commit, avoiding
|
|
78
|
+
* the one-frame blank-canvas flicker that an rAF-deferred paint
|
|
79
|
+
* would produce.
|
|
80
|
+
*/
|
|
81
|
+
renderFnRef: MutableRefObject<() => void>;
|
|
82
|
+
/**
|
|
83
|
+
* Optional unmount cleanup. Frame-specific work the hook can't
|
|
84
|
+
* generalize — e.g. clearing the streaming `DataSourceAdapter`
|
|
85
|
+
* (XY/Ordinal) or the geo tile cache.
|
|
86
|
+
*/
|
|
87
|
+
cleanup?: () => void;
|
|
88
|
+
}
|
|
89
|
+
export declare function useHydrationLifecycle(opts: HydrationLifecycleOptions): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useStableShallow<T>(value: T): T;
|
|
@@ -46,6 +46,10 @@ export interface XYSceneConfig {
|
|
|
46
46
|
curve?: CurveType;
|
|
47
47
|
colorScheme?: string | string[];
|
|
48
48
|
normalize?: boolean;
|
|
49
|
+
/** Stacked area baseline. "zero" (default), "wiggle" (streamgraph), "silhouette" (centered). */
|
|
50
|
+
baseline?: "zero" | "wiggle" | "silhouette";
|
|
51
|
+
/** Stack order — see PipelineConfig.stackOrder. */
|
|
52
|
+
stackOrder?: "key" | "insideOut" | "asc" | "desc";
|
|
49
53
|
gradientFill?: boolean | {
|
|
50
54
|
topOpacity?: number;
|
|
51
55
|
bottomOpacity?: number;
|