semiotic 3.3.1 → 3.4.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 (70) hide show
  1. package/CLAUDE.md +10 -4
  2. package/README.md +1 -1
  3. package/ai/dist/mcp-server.js +104 -9
  4. package/ai/schema.json +1 -1
  5. package/dist/components/LinkedCharts.d.ts +8 -0
  6. package/dist/components/charts/index.d.ts +1 -1
  7. package/dist/components/charts/ordinal/BarChart.d.ts +7 -1
  8. package/dist/components/charts/ordinal/DotPlot.d.ts +9 -1
  9. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +2 -2
  10. package/dist/components/charts/ordinal/LikertChart.d.ts +5 -2
  11. package/dist/components/charts/ordinal/StackedBarChart.d.ts +2 -2
  12. package/dist/components/charts/shared/hooks.d.ts +15 -2
  13. package/dist/components/charts/shared/selectionUtils.d.ts +9 -7
  14. package/dist/components/charts/shared/tooltipUtils.d.ts +13 -1
  15. package/dist/components/charts/shared/types.d.ts +5 -6
  16. package/dist/components/charts/shared/useChartSetup.d.ts +8 -0
  17. package/dist/components/charts/shared/useResolvedSelection.d.ts +2 -0
  18. package/dist/components/realtime/types.d.ts +12 -0
  19. package/dist/components/semiotic-geo.d.ts +4 -0
  20. package/dist/components/semiotic-network.d.ts +7 -0
  21. package/dist/components/semiotic-ordinal.d.ts +8 -0
  22. package/dist/components/semiotic-xy.d.ts +9 -0
  23. package/dist/components/server/renderToStaticSVG.d.ts +1 -1
  24. package/dist/components/store/ThemeStore.d.ts +2 -0
  25. package/dist/components/stream/CanvasHitTester.d.ts +8 -3
  26. package/dist/components/stream/DataSourceAdapter.d.ts +17 -0
  27. package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
  28. package/dist/components/stream/GeoPipelineStore.d.ts +19 -1
  29. package/dist/components/stream/NetworkPipelineStore.d.ts +5 -0
  30. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +3 -1
  31. package/dist/components/stream/OrdinalPipelineStore.d.ts +38 -1
  32. package/dist/components/stream/ParticlePool.d.ts +4 -0
  33. package/dist/components/stream/PipelineStore.d.ts +17 -2
  34. package/dist/components/stream/StreamXYFrame.d.ts +17 -0
  35. package/dist/components/stream/geoTypes.d.ts +7 -0
  36. package/dist/components/stream/hoverUtils.d.ts +12 -0
  37. package/dist/components/stream/networkTypes.d.ts +19 -1
  38. package/dist/components/stream/ordinalTypes.d.ts +53 -12
  39. package/dist/components/stream/pipelineTransitionUtils.d.ts +21 -0
  40. package/dist/components/stream/quadtreeHitTest.d.ts +22 -0
  41. package/dist/components/stream/renderers/resolveCSSColor.d.ts +23 -6
  42. package/dist/components/stream/types.d.ts +18 -0
  43. package/dist/components/stream/useFrame.d.ts +122 -0
  44. package/dist/geo.min.js +1 -1
  45. package/dist/geo.module.min.js +1 -1
  46. package/dist/network.min.js +1 -1
  47. package/dist/network.module.min.js +1 -1
  48. package/dist/ordinal.min.js +1 -1
  49. package/dist/ordinal.module.min.js +1 -1
  50. package/dist/realtime.min.js +1 -1
  51. package/dist/realtime.module.min.js +1 -1
  52. package/dist/semiotic-ai.min.js +1 -1
  53. package/dist/semiotic-ai.module.min.js +1 -1
  54. package/dist/semiotic-geo.d.ts +4 -0
  55. package/dist/semiotic-network.d.ts +7 -0
  56. package/dist/semiotic-ordinal.d.ts +8 -0
  57. package/dist/semiotic-themes.min.js +1 -1
  58. package/dist/semiotic-themes.module.min.js +1 -1
  59. package/dist/semiotic-utils.min.js +1 -1
  60. package/dist/semiotic-utils.module.min.js +1 -1
  61. package/dist/semiotic-xy.d.ts +9 -0
  62. package/dist/semiotic.min.js +1 -1
  63. package/dist/semiotic.module.min.js +1 -1
  64. package/dist/server.min.js +1 -1
  65. package/dist/server.module.min.js +1 -1
  66. package/dist/test-utils/canvasMock.d.ts +26 -0
  67. package/dist/test-utils/ordinalFixtures.d.ts +48 -0
  68. package/dist/xy.min.js +1 -1
  69. package/dist/xy.module.min.js +1 -1
  70. package/package.json +15 -14
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { ScaleLinear } from "d3-scale";
3
+ import type { AnimateProp } from "./pipelineTransitionUtils";
3
4
  import type { ArrowOfTime, WindowMode, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, HoverAnnotationConfig, HoverData, AnnotationContext, AnnotationAnchorMode } from "../realtime/types";
4
5
  export interface DecayConfig {
5
6
  type: "linear" | "exponential" | "step";
@@ -107,6 +108,8 @@ export interface LineSceneNode {
107
108
  _prevPath?: [number, number][];
108
109
  /** Target path coordinates for interpolation during transitions */
109
110
  _targetPath?: [number, number][];
111
+ /** Intro clip fraction (0→1): reveals line from left to right via canvas clip */
112
+ _introClipFraction?: number;
110
113
  }
111
114
  export interface AreaSceneNode {
112
115
  type: "area";
@@ -156,6 +159,8 @@ export interface AreaSceneNode {
156
159
  _prevBottomPath?: [number, number][];
157
160
  /** Target bottom path coordinates for interpolation during transitions */
158
161
  _targetBottomPath?: [number, number][];
162
+ /** Intro clip fraction (0→1): reveals area from left to right via canvas clip */
163
+ _introClipFraction?: number;
159
164
  }
160
165
  export interface PointSceneNode {
161
166
  type: "point";
@@ -278,6 +283,15 @@ export interface Changeset<T = Record<string, any>> {
278
283
  bounded: boolean;
279
284
  /** Hint: total dataset size when progressively chunking bounded data */
280
285
  totalSize?: number;
286
+ /** When true on a bounded changeset, the store replaces the buffer
287
+ * contents but does NOT clear its category insertion-order memory
288
+ * and marks itself as having received streaming-sourced data. Used
289
+ * by aggregator HOCs (LikertChart, future density/bin charts) that
290
+ * re-derive their full dataset from streaming input on every push —
291
+ * the user perceives it as a stream even though the transport is
292
+ * a wholesale replacement. Without this, re-aggregation would wipe
293
+ * the category order and categories would shuffle on every tick. */
294
+ preserveCategoryOrder?: boolean;
281
295
  }
282
296
  /**
283
297
  * Note: when xScaleType="time", the x scale is a d3.scaleTime at runtime
@@ -467,6 +481,10 @@ export interface StreamXYFrameProps<T = Record<string, any>> {
467
481
  pulse?: PulseConfig;
468
482
  /** Smooth position transitions on data change */
469
483
  transition?: TransitionConfig;
484
+ /** Declarative animation: `true` for defaults (300ms ease-out), or config object.
485
+ * When enabled, charts animate on first render (intro) and on data change.
486
+ * Set `{ intro: false }` to disable the intro animation. */
487
+ animate?: AnimateProp;
470
488
  /** Frame-level data liveness indicator */
471
489
  staleness?: StalenessConfig;
472
490
  /** Marginal distribution plots in axis margins (histogram, violin, ridgeline, boxplot) */
@@ -0,0 +1,122 @@
1
+ import * as React from "react";
2
+ import type { ReactNode } from "react";
3
+ import type { SemioticTheme } from "../store/ThemeStore";
4
+ import { useResponsiveSize } from "./useResponsiveSize";
5
+ import { resolveAnimateConfig } from "./pipelineTransitionUtils";
6
+ import type { AnimateProp } from "./pipelineTransitionUtils";
7
+ import type { TransitionConfig } from "./types";
8
+ import type { HoverPointerCoords } from "./hoverUtils";
9
+ /**
10
+ * Frame-supplied margin defaults. Each Stream Frame has its own — XY's
11
+ * differs from Ordinal's, Network has both a default and a CENTERED variant
12
+ * for radial chart types. The hook accepts the resolved default and
13
+ * shallow-merges user margin on top.
14
+ */
15
+ export interface FrameMargin {
16
+ top: number;
17
+ right: number;
18
+ bottom: number;
19
+ left: number;
20
+ }
21
+ /**
22
+ * Foreground/background graphics can be a ReactNode (rendered as-is) or a
23
+ * function that receives the current `{ size, margin }` and returns one.
24
+ * The function form lets users place chrome relative to the chart area.
25
+ */
26
+ export type FrameGraphicsProp = ReactNode | ((ctx: {
27
+ size: number[];
28
+ margin: FrameMargin;
29
+ }) => ReactNode);
30
+ export interface UseFrameInput {
31
+ /** Resolved size `[width, height]`. Each frame defaults its `size` prop
32
+ * before calling, so this is never undefined. */
33
+ sizeProp: [number, number];
34
+ /** Frame's `responsiveWidth` prop. */
35
+ responsiveWidth: boolean | undefined;
36
+ /** Frame's `responsiveHeight` prop. */
37
+ responsiveHeight: boolean | undefined;
38
+ /** Frame's user-supplied margin (always partial — each side optional).
39
+ * Matches the `margin?:` prop type on every Stream Frame. */
40
+ userMargin: Partial<FrameMargin> | undefined;
41
+ /** Frame's family-default margin. Shallow-merged with `userMargin`. */
42
+ marginDefault: FrameMargin;
43
+ /** Frame's `foregroundGraphics` prop. */
44
+ foregroundGraphics?: FrameGraphicsProp;
45
+ /** Frame's `backgroundGraphics` prop. */
46
+ backgroundGraphics?: FrameGraphicsProp;
47
+ /** Frame's `animate` prop. */
48
+ animate?: AnimateProp;
49
+ /** Frame's `transition` prop (legacy / explicit form). */
50
+ transitionProp?: TransitionConfig;
51
+ /**
52
+ * Frame's `dirtyRef` (the flag that forces a full canvas redraw on the
53
+ * next paint). When provided, useFrame installs a theme-change effect
54
+ * that bumps it to `true`, clears the CSS-var cache, and queues a
55
+ * render — the pattern that all four frames duplicated.
56
+ *
57
+ * Optional because this is a Tier B add-on; before the migration the
58
+ * frames installed this themselves. The hook keeps the input optional
59
+ * so a frame can opt in independently, but in practice all four pass
60
+ * it.
61
+ *
62
+ * `dirtyRef` is owned by the frame (not the hook) because its initial
63
+ * value differs — only `StreamXYFrame` inits to `false`; Ordinal,
64
+ * Network, and Geo all init to `true` (load-bearing for first-paint
65
+ * timing on those three).
66
+ */
67
+ themeDirtyRef?: React.MutableRefObject<boolean>;
68
+ }
69
+ export interface UseFrameResult {
70
+ /** Reduced-motion preference at last render (for re-render gating). */
71
+ reducedMotion: boolean;
72
+ /** Reduced-motion ref-mirror so render closures see the latest value
73
+ * without depending on it. */
74
+ reducedMotionRef: React.MutableRefObject<boolean>;
75
+ /** Ref to attach to the responsive container. */
76
+ responsiveRef: ReturnType<typeof useResponsiveSize>[0];
77
+ /** Resolved size `[width, height]` accounting for `responsiveWidth/Height`. */
78
+ size: [number, number];
79
+ /** Effective margin (`marginDefault` ⊕ `userMargin`). */
80
+ margin: FrameMargin;
81
+ /** `size[0] - margin.left - margin.right`. */
82
+ adjustedWidth: number;
83
+ /** `size[1] - margin.top - margin.bottom`. */
84
+ adjustedHeight: number;
85
+ /** Resolved foreground (function-or-node, evaluated). */
86
+ resolvedForeground: ReactNode;
87
+ /** Resolved background (function-or-node, evaluated). */
88
+ resolvedBackground: ReactNode;
89
+ /** Current theme from the ThemeStore — re-renders on theme change. */
90
+ currentTheme: SemioticTheme;
91
+ /** Resolved transition config from `animate`/`transition` props. */
92
+ transition: ReturnType<typeof resolveAnimateConfig>["transition"];
93
+ /** Whether the intro animation should run on first render. */
94
+ introEnabled: boolean;
95
+ /** Stable id for the AccessibleDataTable region (hash-suffixed). */
96
+ tableId: string;
97
+ /** Token of the pending rAF, or 0 if none. */
98
+ rafRef: React.MutableRefObject<number>;
99
+ /** Frame assigns its render closure here. */
100
+ renderFnRef: React.MutableRefObject<() => void>;
101
+ /** Queue a render on the next animation frame. Coalesces. */
102
+ scheduleRender: () => void;
103
+ /** Frame assigns its hover handler closure here. */
104
+ hoverHandlerRef: React.MutableRefObject<(coords: HoverPointerCoords) => void>;
105
+ /** Frame assigns its pointer-leave closure here. */
106
+ hoverLeaveRef: React.MutableRefObject<() => void>;
107
+ /** Stable callback to attach to canvas's onPointerMove (or onMouseMove).
108
+ * Captures the coords and queues a single rAF to drain into hoverHandlerRef. */
109
+ onPointerMove: (e: {
110
+ clientX: number;
111
+ clientY: number;
112
+ }) => void;
113
+ /** Stable callback to attach to canvas's onPointerLeave (or onMouseLeave).
114
+ * Cancels any pending hover rAF and invokes hoverLeaveRef. */
115
+ onPointerLeave: () => void;
116
+ }
117
+ /**
118
+ * Bundles the universally-shared setup boilerplate that opens every
119
+ * Stream Frame. See `FRAME_COMPOSITION_LOG.md` for which concerns are
120
+ * inside this hook vs. left frame-specific.
121
+ */
122
+ export declare function useFrame(input: UseFrameInput): UseFrameResult;