semiotic 3.8.7 → 3.8.9
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 +6 -5
- package/README.md +58 -48
- package/ai/dist/mcp-server.js +28 -2
- package/ai/schema.json +386 -4
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +1 -1
- package/dist/{chunk-chartContainerDataAudit-JDSVSKGM.module.min.js → chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js} +1 -1
- package/dist/chunk-chunk-2B3AIKUZ.module.min.js +2 -0
- package/dist/chunk-chunk-2NVFEB7P.module.min.js +2 -0
- package/dist/chunk-chunk-2X3FJCME.module.min.js +1 -0
- package/dist/{chunk-chunk-LVHDZAT3.module.min.js → chunk-chunk-2ZHHWZQM.module.min.js} +1 -1
- package/dist/chunk-chunk-5VVNW5AZ.module.min.js +1 -0
- package/dist/chunk-chunk-5ZON5NMV.module.min.js +2 -0
- package/dist/chunk-chunk-66PCWJUG.module.min.js +1 -0
- package/dist/chunk-chunk-6S3YGYW7.module.min.js +1 -0
- package/dist/chunk-chunk-7C5EDZ3Z.module.min.js +2 -0
- package/dist/chunk-chunk-A3I4HBD5.module.min.js +1 -0
- package/dist/{chunk-chunk-5SD6BHVW.module.min.js → chunk-chunk-AFQHURLO.module.min.js} +1 -1
- package/dist/chunk-chunk-DDB4TLQG.module.min.js +2 -0
- package/dist/{chunk-chunk-OI7R7EJB.module.min.js → chunk-chunk-DTH3SUOU.module.min.js} +1 -1
- package/dist/chunk-chunk-DTSNLGRK.module.min.js +2 -0
- package/dist/{chunk-chunk-NH4MEAKP.module.min.js → chunk-chunk-DVCWU7MT.module.min.js} +1 -1
- package/dist/chunk-chunk-FEPXDKJP.module.min.js +1 -0
- package/dist/chunk-chunk-FJ76HWQZ.module.min.js +1 -0
- package/dist/chunk-chunk-FSIHAW6L.module.min.js +2 -0
- package/dist/chunk-chunk-G2RGVEYY.module.min.js +2 -0
- package/dist/chunk-chunk-G75OPF5N.module.min.js +2 -0
- package/dist/chunk-chunk-HADHLMY5.module.min.js +1 -0
- package/dist/chunk-chunk-HAJVODLO.module.min.js +2 -0
- package/dist/chunk-chunk-HBFA4NN6.module.min.js +1 -0
- package/dist/{chunk-chunk-FRO4TRXK.module.min.js → chunk-chunk-HIV7AW2V.module.min.js} +1 -1
- package/dist/{chunk-chunk-Z2AJERX5.module.min.js → chunk-chunk-JZAMMSQQ.module.min.js} +1 -1
- package/dist/chunk-chunk-LSJUXBMF.module.min.js +1 -0
- package/dist/chunk-chunk-MXMRXSCI.module.min.js +2 -0
- package/dist/chunk-chunk-MXVBXFKW.module.min.js +2 -0
- package/dist/chunk-chunk-NWIGA3UK.module.min.js +1 -0
- package/dist/chunk-chunk-OFAP623Y.module.min.js +2 -0
- package/dist/{chunk-chunk-JWXLNZSM.module.min.js → chunk-chunk-OHLRAEQZ.module.min.js} +1 -1
- package/dist/{chunk-chunk-XEVJDUTH.module.min.js → chunk-chunk-OZK46A5U.module.min.js} +1 -1
- package/dist/chunk-chunk-PMR47KRY.module.min.js +2 -0
- package/dist/chunk-chunk-PRNXOCYZ.module.min.js +2 -0
- package/dist/chunk-chunk-RLKZVJMQ.module.min.js +2 -0
- package/dist/chunk-chunk-SK2TQMG4.module.min.js +2 -0
- package/dist/chunk-chunk-SKLYXNYW.module.min.js +2 -0
- package/dist/chunk-chunk-TCMHJWFJ.module.min.js +1 -0
- package/dist/chunk-chunk-U4NZCU5T.module.min.js +2 -0
- package/dist/chunk-chunk-VKL6DI43.module.min.js +2 -0
- package/dist/chunk-chunk-W62673ZE.module.min.js +1 -0
- package/dist/chunk-chunk-WFHZHWT7.module.min.js +1 -0
- package/dist/{chunk-chunk-GU2EJIDJ.module.min.js → chunk-chunk-XCC25CZZ.module.min.js} +1 -1
- package/dist/chunk-chunk-XECNOUZY.module.min.js +2 -0
- package/dist/{chunk-chunk-BNGBEY7N.module.min.js → chunk-chunk-XYZDTYAF.module.min.js} +1 -1
- package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +54 -1
- package/dist/components/charts/index.d.ts +2 -2
- package/dist/components/charts/network/ProcessSankey.d.ts +105 -74
- package/dist/components/charts/network/processSankey/accessors.d.ts +7 -0
- package/dist/components/charts/network/processSankey/algorithm.d.ts +14 -193
- package/dist/components/charts/network/processSankey/axisChrome.d.ts +31 -0
- package/dist/components/charts/network/processSankey/bandPaths.d.ts +45 -0
- package/dist/components/charts/network/processSankey/buildScenes.d.ts +41 -3
- package/dist/components/charts/network/processSankey/fixtures.d.ts +17 -0
- package/dist/components/charts/network/processSankey/frameMargins.d.ts +11 -0
- package/dist/components/charts/network/processSankey/groupBonding.d.ts +13 -0
- package/dist/components/charts/network/processSankey/inventoryAtTime.d.ts +41 -0
- package/dist/components/charts/network/processSankey/labelPlacement.d.ts +34 -0
- package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +47 -0
- package/dist/components/charts/network/processSankey/layoutOrchestrator.d.ts +44 -0
- package/dist/components/charts/network/processSankey/layoutQualityProduct.d.ts +27 -0
- package/dist/components/charts/network/processSankey/massSimulation.d.ts +16 -0
- package/dist/components/charts/network/processSankey/ordering.d.ts +55 -0
- package/dist/components/charts/network/processSankey/orderingBond.d.ts +33 -0
- package/dist/components/charts/network/processSankey/orientation.d.ts +5 -0
- package/dist/components/charts/network/processSankey/packing.d.ts +8 -0
- package/dist/components/charts/network/processSankey/packingCache.d.ts +23 -0
- package/dist/components/charts/network/processSankey/processSankeyLayoutAsync.d.ts +27 -0
- package/dist/components/charts/network/processSankey/processSankeyLayoutWorkerClient.d.ts +72 -0
- package/dist/components/charts/network/processSankey/processSankeyTooltip.d.ts +26 -0
- package/dist/components/charts/network/processSankey/processSankeyTypes.d.ts +163 -0
- package/dist/components/charts/network/processSankey/ribbonInputs.d.ts +26 -2
- package/dist/components/charts/network/processSankey/ribbonRunway.d.ts +45 -0
- package/dist/components/charts/network/processSankey/streamingLayout.d.ts +23 -0
- package/dist/components/charts/network/processSankey/time.d.ts +11 -0
- package/dist/components/charts/network/processSankey/useProcessSankeyPush.d.ts +29 -0
- package/dist/components/charts/network/processSankey/useProcessSankeyScenes.d.ts +26 -0
- package/dist/components/charts/network/processSankey/validation.d.ts +33 -0
- package/dist/components/charts/physics/chainReactionTypes.d.ts +1 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +1 -1
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +2 -0
- package/dist/components/charts/shared/chartFamilySets.d.ts +1 -0
- package/dist/components/charts/shared/formatUtils.d.ts +45 -3
- package/dist/components/charts/shared/hatchFill.d.ts +2 -0
- package/dist/components/charts/shared/hooks.d.ts +1 -1
- package/dist/components/charts/shared/leastSquaresRegression.d.ts +31 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -0
- package/dist/components/charts/shared/styleRules.d.ts +5 -1
- package/dist/components/charts/shared/types.d.ts +8 -1
- package/dist/components/charts/shared/useChartLegend.d.ts +6 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/withChartWrapper.d.ts +0 -6
- package/dist/components/data/numericFieldProfiler.d.ts +2 -0
- package/dist/components/recipes/layout1d.d.ts +68 -0
- package/dist/components/semiotic-network.d.ts +2 -2
- package/dist/components/semiotic-recipes-core.d.ts +2 -0
- package/dist/components/semiotic-utils-core.d.ts +1 -0
- package/dist/components/semiotic.d.ts +6 -3
- package/dist/components/server/staticSVGChrome.d.ts +2 -1
- package/dist/components/store/createStore.d.ts +2 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +1 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +3 -0
- package/dist/components/stream/PipelineStore.d.ts +5 -0
- package/dist/components/stream/accessorUtils.d.ts +21 -0
- package/dist/components/stream/canvasSetup.d.ts +15 -4
- package/dist/components/stream/frameKeyboardNavigation.d.ts +3 -2
- package/dist/components/stream/geoTypes.d.ts +2 -0
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +3 -8
- package/dist/components/stream/layouts/index.d.ts +1 -1
- package/dist/components/stream/moduleWorkerSession.d.ts +67 -0
- package/dist/components/stream/networkFramePaint.d.ts +8 -0
- package/dist/components/stream/networkTypes.d.ts +4 -0
- package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +2 -1
- package/dist/components/stream/ordinalTypes.d.ts +2 -0
- package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -0
- package/dist/components/stream/pipelineConfig.d.ts +2 -0
- package/dist/components/stream/pipelineDomainResolution.d.ts +1 -1
- package/dist/components/stream/pipelineIntroCancellation.d.ts +6 -0
- package/dist/components/stream/pipelineTransitions.d.ts +15 -1
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +16 -4
- package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +4 -0
- package/dist/components/stream/symbolPath.d.ts +8 -0
- package/dist/components/stream/types.d.ts +10 -1
- package/dist/components/stream/useCanvasFrameHost.d.ts +15 -0
- package/dist/components/stream/useSemanticFrameInteractions.d.ts +12 -3
- package/dist/components/stream/xyFrameAxisTypes.d.ts +9 -0
- package/dist/forceLayoutWorker.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/processSankeyLayoutWorker.js +1 -0
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-experimental-vacp.min.js +1 -1
- package/dist/semiotic-experimental-vacp.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-network.d.ts +2 -2
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +2 -0
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-themes-core.module.min.js +1 -1
- package/dist/semiotic-themes-react.module.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils-core.d.ts +1 -0
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils-react.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic.d.ts +6 -3
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +4 -3
- package/dist/chunk-chunk-2YAZHXL4.module.min.js +0 -2
- package/dist/chunk-chunk-3NGIKFD6.module.min.js +0 -1
- package/dist/chunk-chunk-7TTBHSAG.module.min.js +0 -2
- package/dist/chunk-chunk-7ZDJSYKI.module.min.js +0 -2
- package/dist/chunk-chunk-BGHPD3RA.module.min.js +0 -1
- package/dist/chunk-chunk-BMRZ2SPU.module.min.js +0 -2
- package/dist/chunk-chunk-C7APLVQD.module.min.js +0 -2
- package/dist/chunk-chunk-DGWFBOGB.module.min.js +0 -1
- package/dist/chunk-chunk-DIVE2DRA.module.min.js +0 -2
- package/dist/chunk-chunk-DSNGDNJY.module.min.js +0 -1
- package/dist/chunk-chunk-FBUNUIPV.module.min.js +0 -2
- package/dist/chunk-chunk-G7QVPZUD.module.min.js +0 -2
- package/dist/chunk-chunk-GBPYV4FP.module.min.js +0 -2
- package/dist/chunk-chunk-KXAFCCDB.module.min.js +0 -2
- package/dist/chunk-chunk-LG7YKJAK.module.min.js +0 -2
- package/dist/chunk-chunk-LWITSR2O.module.min.js +0 -2
- package/dist/chunk-chunk-MX35T6RX.module.min.js +0 -2
- package/dist/chunk-chunk-NJETWX42.module.min.js +0 -2
- package/dist/chunk-chunk-NW25WGLS.module.min.js +0 -2
- package/dist/chunk-chunk-ONMLEXHR.module.min.js +0 -2
- package/dist/chunk-chunk-OY66GCE6.module.min.js +0 -1
- package/dist/chunk-chunk-PRDGLMJT.module.min.js +0 -2
- package/dist/chunk-chunk-PZFT457G.module.min.js +0 -1
- package/dist/chunk-chunk-Q3WW6JGR.module.min.js +0 -1
- package/dist/chunk-chunk-Q6XKQTOQ.module.min.js +0 -1
- package/dist/chunk-chunk-RJRM2E6P.module.min.js +0 -1
- package/dist/chunk-chunk-RPL7WYXI.module.min.js +0 -1
- package/dist/chunk-chunk-V3OAKG32.module.min.js +0 -1
- package/dist/chunk-chunk-WCX6U47H.module.min.js +0 -2
- package/dist/chunk-chunk-WLOIUMWG.module.min.js +0 -2
- package/dist/chunk-chunk-XEGXX4F7.module.min.js +0 -1
- package/dist/chunk-chunk-XFRBLXYM.module.min.js +0 -1
- package/dist/chunk-chunk-ZXYDYAB7.module.min.js +0 -2
- package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +0 -2
- package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Shared canvas primitives for fills, strokes, curves, and gradients. */
|
|
2
|
-
import type { CurveType } from "../types";
|
|
2
|
+
import type { CurveType, Style } from "../types";
|
|
3
3
|
import type { GradientConfig } from "../../charts/shared/gradient";
|
|
4
4
|
import { type HatchFill } from "../../charts/shared/hatchFill";
|
|
5
5
|
import type { CurveFactory } from "d3-shape";
|
|
@@ -35,12 +35,24 @@ export declare function resolveCanvasFill(ctx: CanvasRenderingContext2D, fill: s
|
|
|
35
35
|
export declare function coerceCanvasFill(ctx: CanvasRenderingContext2D, fill: string | HatchFill | CanvasPattern | null | undefined): string | CanvasPattern | undefined;
|
|
36
36
|
/**
|
|
37
37
|
* Build a linear gradient from a normalized gradient config. Stops without a
|
|
38
|
-
* color inherit the resolved mark color.
|
|
38
|
+
* color inherit the resolved mark color. Used for both fill gradients (bar,
|
|
39
|
+
* area fill) and stroke gradients (line, area stroke) — a canvas gradient
|
|
40
|
+
* object is equally valid as `fillStyle` or `strokeStyle`.
|
|
39
41
|
*
|
|
40
42
|
* The renderer is responsible for choosing the gradient axis (a bar
|
|
41
43
|
* runs tip→base along its value axis; an area runs minTop→maxBottom
|
|
42
44
|
* vertically).
|
|
43
45
|
*/
|
|
44
46
|
export declare function buildLinearFillGradient(ctx: CanvasRenderingContext2D, fillGradient: GradientConfig, baseFill: string, x0: number, y0: number, x1: number, y1: number): CanvasGradient | null;
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Resolve and apply a network node's fill, then invoke `paint` (the
|
|
49
|
+
* renderer's own `fill()`/`fillRect()` call — the path or rect traced
|
|
50
|
+
* differs per shape, so painting stays with the caller).
|
|
51
|
+
*/
|
|
52
|
+
export declare function paintNetworkFill(ctx: CanvasRenderingContext2D, style: Style, fallback: string, paint: () => void): void;
|
|
53
|
+
/**
|
|
54
|
+
* Resolve and apply a network node's stroke, then invoke `paint`. `"none"`
|
|
55
|
+
* is truthy as a string, so this guards it explicitly — canvas otherwise
|
|
56
|
+
* rejects `strokeStyle = "none"`, keeps the default black, and still strokes.
|
|
57
|
+
*/
|
|
58
|
+
export declare function paintNetworkStroke(ctx: CanvasRenderingContext2D, style: Style, paint: () => void): void;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import type { NetworkSceneNode } from "../networkTypes";
|
|
1
2
|
import type { StreamRendererFn } from "./types";
|
|
3
|
+
/** XY / ordinal painter (x/y-positioned symbol nodes). */
|
|
2
4
|
export declare const symbolCanvasRenderer: StreamRendererFn;
|
|
5
|
+
/** Network painter (cx/cy-positioned symbol nodes). */
|
|
6
|
+
export declare function networkSymbolRenderer(ctx: CanvasRenderingContext2D, nodes: NetworkSceneNode[]): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
1
2
|
/** Named glyph shapes a `symbol` scene node can request. */
|
|
2
3
|
export type NetworkSymbolName = "circle" | "square" | "triangle" | "diamond" | "star" | "cross" | "wye" | "chevron";
|
|
3
4
|
/** Pipeline-neutral alias — the symbol mark is shared by network, XY, and
|
|
@@ -22,3 +23,10 @@ export declare function symbolRadius(size: number): number;
|
|
|
22
23
|
* measured from their path vertices; `circle` is the area formula.
|
|
23
24
|
*/
|
|
24
25
|
export declare function symbolExtent(symbolType: NetworkSymbolName | string | undefined, size: number, customPath?: string): number;
|
|
26
|
+
/**
|
|
27
|
+
* Build a per-scene category→shape resolver for the `symbolBy` channel.
|
|
28
|
+
* Explicit `symbolMap` wins; unmapped categories auto-assign from
|
|
29
|
+
* `SYMBOL_SEQUENCE` in first-seen (deterministic) order. Shared by the XY
|
|
30
|
+
* and ordinal point scene builders so Scatterplot/SwarmPlot glyphs agree.
|
|
31
|
+
*/
|
|
32
|
+
export declare function makeSymbolResolver(getSymbol: (d: Datum) => unknown, symbolMap: Record<string, SymbolName> | undefined): (d: Datum) => SymbolName;
|
|
@@ -96,6 +96,8 @@ export type RuntimeMode = "bounded" | "streaming";
|
|
|
96
96
|
export interface Style {
|
|
97
97
|
stroke?: string;
|
|
98
98
|
strokeWidth?: number;
|
|
99
|
+
/** Opacity applied to the stroke independently of fill/mark opacity. */
|
|
100
|
+
strokeOpacity?: number;
|
|
99
101
|
strokeDasharray?: string;
|
|
100
102
|
strokeLinecap?: "butt" | "round" | "square";
|
|
101
103
|
/**
|
|
@@ -696,6 +698,12 @@ export interface StreamXYFrameProps<T = Datum> extends StreamSemanticInteraction
|
|
|
696
698
|
};
|
|
697
699
|
className?: string;
|
|
698
700
|
background?: string;
|
|
701
|
+
/**
|
|
702
|
+
* Maximum canvas backing-store pixel ratio. Defaults to 3 on desktop and 2
|
|
703
|
+
* on coarse-pointer/small-screen devices. Increase this when mark crispness
|
|
704
|
+
* at high browser zoom is more important than canvas memory/paint cost.
|
|
705
|
+
*/
|
|
706
|
+
maxDevicePixelRatio?: number;
|
|
699
707
|
/** Optional scene paint backend. Exact scene geometry remains interactive. */
|
|
700
708
|
renderMode?: SceneRenderMode<SceneNode>;
|
|
701
709
|
lineStyle?: LineStyle | ((d: T, group?: string) => Style);
|
|
@@ -726,7 +734,8 @@ export interface StreamXYFrameProps<T = Datum> extends StreamSemanticInteraction
|
|
|
726
734
|
* tick generator — round tick labels at the cost of ticks not
|
|
727
735
|
* reaching the exact data min/max. `"exact"` pins the first
|
|
728
736
|
* and last tick to the data domain and spaces intermediate
|
|
729
|
-
* ticks equidistantly. Applies to both x and y axes
|
|
737
|
+
* ticks equidistantly. Applies to both x and y axes unless an entry in
|
|
738
|
+
* `axes` supplies its own `extent` override. */
|
|
730
739
|
axisExtent?: import("../charts/shared/axisExtent").AxisExtentMode;
|
|
731
740
|
tickFormatTime?: (value: number) => string;
|
|
732
741
|
tickFormatValue?: (value: number) => string;
|
|
@@ -27,6 +27,8 @@ export interface UseCanvasFrameHostInput<TStore extends object> {
|
|
|
27
27
|
manageFrameRuntime?: boolean;
|
|
28
28
|
hydrated: boolean;
|
|
29
29
|
wasHydratingFromSSR: boolean;
|
|
30
|
+
/** Consumer override for the canvas backing-store DPR ceiling. */
|
|
31
|
+
maxDevicePixelRatio?: number;
|
|
30
32
|
/** Family-specific teardown such as clearing a streaming data adapter. */
|
|
31
33
|
cleanup?: () => void;
|
|
32
34
|
/**
|
|
@@ -35,6 +37,12 @@ export interface UseCanvasFrameHostInput<TStore extends object> {
|
|
|
35
37
|
* mount-time invalidation while retaining dependency-change invalidation.
|
|
36
38
|
*/
|
|
37
39
|
skipInitialCanvasPaintInvalidation?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Optional repaint-only invalidator for families that synchronously rebuild
|
|
42
|
+
* retained scene geometry elsewhere. When omitted, dependency changes use
|
|
43
|
+
* the conservative `dirtyRef` full-rebuild path.
|
|
44
|
+
*/
|
|
45
|
+
canvasPaintInvalidator?: () => void;
|
|
38
46
|
/**
|
|
39
47
|
* Values that require a data-canvas repaint. Keep this list family-owned:
|
|
40
48
|
* it expresses paint semantics without teaching the host chart props or
|
|
@@ -47,6 +55,13 @@ export interface CanvasFrameHostResult {
|
|
|
47
55
|
canvasRef: RefObject<HTMLCanvasElement | null>;
|
|
48
56
|
/** Optional family use for hover/crosshair/highlight canvas content. */
|
|
49
57
|
interactionCanvasRef: RefObject<HTMLCanvasElement | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Set when only the canvas backing store must re-rasterize retained
|
|
60
|
+
* geometry (browser zoom / display DPR / maxDevicePixelRatio). Families
|
|
61
|
+
* should OR this into the paint gate but **not** into scene rebuild so a
|
|
62
|
+
* zoom does not re-run layout or scale construction.
|
|
63
|
+
*/
|
|
64
|
+
resolutionDirtyRef: MutableRefObject<boolean>;
|
|
50
65
|
}
|
|
51
66
|
type FrameCanvasHost = Pick<UseFrameResult, "renderFnRef" | "scheduleRender" | "cancelRender" | "frameRuntime">;
|
|
52
67
|
type FrameCanvasHostInput<TStore extends object> = Omit<UseCanvasFrameHostInput<TStore>, "renderFnRef" | "scheduleRender" | "cancelRender" | "frameRuntime">;
|
|
@@ -13,10 +13,19 @@ interface SemanticFrameInteractionOptions<Hover extends HoverLike> {
|
|
|
13
13
|
chartId?: string;
|
|
14
14
|
chartType: string;
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Add semantic observations around the legacy Stream Frame callbacks.
|
|
18
|
+
*
|
|
19
|
+
* Returns `undefined` for hover/click when neither a user callback nor
|
|
20
|
+
* `onObservation` is present. Frames historically treated any truthy
|
|
21
|
+
* `customHoverBehavior` as “selection may have changed” and marked the
|
|
22
|
+
* scene dirty — which re-ran `computeScene` (and intro/data transitions)
|
|
23
|
+
* on every pointermove. Observation emission alone does not change the
|
|
24
|
+
* retained scene, so an always-present wrapper is the wrong signal.
|
|
25
|
+
*/
|
|
17
26
|
export declare function useSemanticFrameInteractions<Hover extends HoverLike>({ customHoverBehavior: customHoverBehaviorProp, customClickBehavior: customClickBehaviorProp, onObservation, chartId, chartType }: SemanticFrameInteractionOptions<Hover>): {
|
|
18
|
-
customHoverBehavior: (hover: Hover | null, context?: SemanticInteractionContext) => void;
|
|
19
|
-
customClickBehavior: (hover: Hover | null, context?: SemanticInteractionContext) => void;
|
|
27
|
+
customHoverBehavior: ((hover: Hover | null, context?: SemanticInteractionContext) => void) | undefined;
|
|
28
|
+
customClickBehavior: ((hover: Hover | null, context?: SemanticInteractionContext) => void) | undefined;
|
|
20
29
|
hasClickBehavior: boolean;
|
|
21
30
|
};
|
|
22
31
|
export {};
|
|
@@ -18,6 +18,11 @@ export interface XYFrameAxisConfig {
|
|
|
18
18
|
orient: "left" | "right" | "top" | "bottom";
|
|
19
19
|
label?: string;
|
|
20
20
|
ticks?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Override the chart-level `axisExtent` mode for this axis. Horizontal
|
|
23
|
+
* (`top`/`bottom`) and vertical (`left`/`right`) axes resolve independently.
|
|
24
|
+
*/
|
|
25
|
+
extent?: import("../charts/shared/axisExtent").AxisExtentMode;
|
|
21
26
|
/** Per-axis tick label formatter. ReactNode return is supported and
|
|
22
27
|
* renders inside a `<foreignObject>`. */
|
|
23
28
|
tickFormat?: AxisTickFormatter;
|
|
@@ -32,6 +37,10 @@ export interface XYFrameAxisConfig {
|
|
|
32
37
|
* custom strokeDasharray string. Applied to grid lines extending
|
|
33
38
|
* from ticks across the chart area. */
|
|
34
39
|
gridStyle?: "dashed" | "dotted" | string;
|
|
40
|
+
/** Set false to suppress grid lines emitted from this axis while retaining
|
|
41
|
+
* its ticks and baseline. For example, set the bottom axis to `false` for
|
|
42
|
+
* horizontal-only (y-axis) grid lines. */
|
|
43
|
+
grid?: boolean;
|
|
35
44
|
/** Always include the domain max as a tick, even if d3 omits it. */
|
|
36
45
|
includeMax?: boolean;
|
|
37
46
|
/** Auto-rotate labels 45° when horizontal spacing is too tight. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{forceCenter as e,forceCollide as t,forceLink as o,forceManyBody as n,forceSimulation as r,forceX as a,forceY as f}from"d3-force";function c(c,s,i={}){const d=i.seed??1,u=i.iterations??260,l=i.repulsion??5200,g=i.linkDistance??165,h=i.linkStrength??.045,y=i.centerStrength??.018,b=i.damping??.84,m=i.nodeRadius??12,p=i.nodePadding??3,M=i.inset??.06,x=function(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(d),S=new Map;for(const e of c)S.set(e.id,0);for(const e of s)S.set(e.source,(S.get(e.source)??0)+1),S.set(e.target,(S.get(e.target)??0)+1);const k=500,w=c.map(e=>({id:e.id,data:e,x:200+600*x(),y:200+600*x()})),v=new Set(c.map(e=>e.id)),q=s.filter(e=>v.has(e.source)&&v.has(e.target)).map(e=>({source:e.source,target:e.target}));if(u>0){const c=r(w).randomSource(x).alphaDecay(1-Math.pow(.001,1/u)).velocityDecay(Math.max(0,Math.min(1,1-b))).force("charge",n().strength(e=>{const t=S.get(e.id)??0;return 2.5*-Math.sqrt(l)*Math.sqrt(t+1)})).force("collide",t(e=>(e=>"function"==typeof m?m(e.data):m)(e)+p).strength(.9).iterations(2)).force("center",e(k,k).strength(.8)).force("x",a(k).strength(y)).force("y",f(k).strength(y));q.length>0&&c.force("link",o(q).id(e=>e.id).distance(g).strength(e=>{const t="string"==typeof e.source?e.source:e.source.id,o="string"==typeof e.target?e.target:e.target.id,n=Math.max(1,Math.min(S.get(t)??1,S.get(o)??1));return h/.045/n})),c.stop();for(let e=0;e<u;e+=1)c.tick()}let z=1/0,I=1/0,R=-1/0,$=-1/0;for(const e of w){const t=e.x??k,o=e.y??k;t<z&&(z=t),o<I&&(I=o),t>R&&(R=t),o>$&&($=o)}const E=R-z,_=$-I,C={};for(const e of w)C[e.id]={x:0===E?.5:M+((e.x??k)-z)/E*(1-2*M),y:0===_?.5:M+((e.y??k)-I)/_*(1-2*M)};return C}import{forceSimulation as s,forceCenter as i,forceX as d,forceY as u,forceLink as l,forceManyBody as g,forceCollide as h}from"d3-force";import{scaleLinear as y}from"d3-scale";function b(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function m(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function p(e){const t=e.map(b),o=t.length-1;return e=>{if(e<=0){const[e,o,n]=t[0];return m(e,o,n)}if(e>=1){const[e,n,r]=t[o];return m(e,n,r)}const n=e*o,r=Math.floor(n),a=n-r,[f,c,s]=t[r],[i,d,u]=t[r+1];return m(Math.round(f+(i-f)*a),Math.round(c+(d-c)*a),Math.round(s+(u-s)*a))}}var M=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];p(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),p(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),p(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),p(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),p(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),p(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),p(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),p(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),p(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),p(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),p(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),p(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),p(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),p(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),p(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),p(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),p(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var x=new Set,S=new WeakMap;function k(e,t){if(!e||!e.data||"object"!=typeof e.data)return e;let o=S.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,S.set(e,o);const n=new Proxy(e,{get(e,o,n){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;x.has(e)||(x.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,n)}});return o.set(t,n),n}var w={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const r=o.forceStrength??.1,a=n[0]/2,f=n[1]/2,c=Math.max(.1,Math.min(1,Math.min(n[0],n[1])/200)),y=Math.min(.5,.06+1.8*(1-c)),b=o.__previousPositions;let m=0;const p=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=b?.get(t.id);e?m++:o?(t.x=o.x,t.y=o.y,m++):p.push(t)}const M=e.length>0?p.length/e.length:1,x=m>0&&M<=.3;if(x){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of p){const n=v(e.id,t,o);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const r=q(e.id),a=r%360*(Math.PI/180),f=(10+r%20)*c;e.x=t/n.length+f*Math.cos(a),e.y=o/n.length+f*Math.sin(a)}else{const t=q(e.id),o=t%360*(Math.PI/180),n=(15+t%30)*c;e.x=a+n*Math.cos(o),e.y=f+n*Math.sin(o)}}}else{const t=Math.PI*(3-Math.sqrt(5));for(let o=0;o<e.length;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5)*c,r=o*t;n.x=a+e*Math.cos(r),n.y=f+e*Math.sin(r)}}}const S=e.length,k=o.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(S-30)))),w=o.__skipForceSimulation||0===o.iterations?0:x?40:k,I=z(o.nodeSize,o.nodeSizeRange,e),R=e=>I(e);if(w>0){const b=new Map,m=new Map;for(const t of e)b.set(t.id,0),m.set(t.id,t);for(const e of t){const t="string"==typeof e.source?e.source:e.source.id,o="string"==typeof e.target?e.target:e.target.id;b.set(t,(b.get(t)??0)+1),b.set(o,(b.get(o)??0)+1)}const p=l().strength(e=>{const t=e.weight,o="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,a=Math.max(1,Math.min(b.get(o)??1,b.get(n)??1)),f=t&&t>0?Math.sqrt(t):1;return Math.min(2.5,f*r/(.1*a))}).distance(e=>{const t="string"==typeof e.source?m.get(e.source):e.source,o="string"==typeof e.target?m.get(e.target):e.target,n=(t?R(t):0)+(o?R(o):0)+Math.max(6,12*c);return Math.max(16,40*c,n)}).id(e=>e.id),M=s();if(void 0===o.random&&void 0===o.seed||M.randomSource(o.random??function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(o.seed)),M.force("charge",g().strength(e=>{const t=b.get(e.id)??0;return-15*c*R(e)*Math.sqrt(t+1)})).force("collide",h(e=>R(e)+3*c).strength(.9).iterations(2)).force("center",i(a,f).strength(.8)).force("x",d(a).strength(y)).force("y",u(f).strength(y)).force("bounds",function(e,t,o=2,n=.6){let r=[];const a=a=>{const f=n*Math.max(a,.2);for(const n of r){const r=n.x??e[0]/2,a=n.y??e[1]/2,c=n.vx??0,s=n.vy??0,i=t(n)+o,d=Math.min(e[0]/2,i),u=Math.max(e[0]/2,e[0]-i),l=Math.min(e[1]/2,i),g=Math.max(e[1]/2,e[1]-i),h=r+c,y=a+s;h<d?n.vx=c+(d-h)*f:h>u&&(n.vx=c+(u-h)*f),y<l?n.vy=s+(l-y)*f:y>g&&(n.vy=s+(g-y)*f)}};return a.initialize=e=>{r=e},a}(n,R)),M.nodes(e),t.length>0){const e=t.map(e=>({...e,source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));p.links(e),M.force("link",p)}x?M.alpha(.3):M.alpha()<.1&&M.alpha(1),M.stop();for(let e=0;e<w;++e)M.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=R(t),o=w>0?2:0,r=Math.min(n[0]/2,e+o),a=Math.min(n[1]/2,e+o);t.x=Math.max(r,Math.min(n[0]-r,t.x)),t.y=Math.max(a,Math.min(n[1]-a,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const $=new Map;for(const t of e)$.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=$.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=$.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,n){const r=o.nodeStyle,a=o.edgeStyle,f=z(o.nodeSize,o.nodeSizeRange,e),c=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:M,s=new Map;e.forEach((e,t)=>{s.set(e.id,c[t%c.length])});const i=[],d=[],u=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=f(k(t,"nodeSize")),n=r?r(k(t,"nodeStyle")):{},a={fill:n.fill||s.get(t.id)||o.themeSemantic?.primary||"#007bff",stroke:n.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??2,opacity:n.opacity};i.push({type:"circle",cx:t.x,cy:t.y,r:e,style:a,datum:t,id:t.id,label:t.id})}const l=new Map;for(const t of e)l.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:l.get(e.source),n="object"==typeof e.target?e.target:l.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const r=a?a(k(e,"edgeStyle")):{},f={stroke:r.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:r.strokeWidth??1,opacity:r.opacity??.6};d.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:f,datum:e})}if(!1!==o.showLabels){const t=(g=o.nodeLabel)?"function"==typeof g?g:e=>e[g]||e.id:null;for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const n=f(k(o,"nodeSize"));u.push({x:o.x,y:o.y-n-4,text:String(e),anchor:"middle",baseline:"auto",fontSize:11})}}var g;return{sceneNodes:i,sceneEdges:d,labels:u}}};function v(e,t,o){const n=[];for(const r of t){const t="string"==typeof r.source?r.source:r.source.id,a="string"==typeof r.target?r.target:r.target.id;let f=null;if(t===e?f=a:a===e&&(f=t),f){const e=o.get(f);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function q(e){let t=0;for(let o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function z(e,t,o){if(o.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const n=t||[5,20],r=[];for(const t of o){const o=t.data?.[e];"number"==typeof o&&r.push(o)}if(0===r.length)return()=>n[0];const[a,f]=function(e){let t=1/0,o=-1/0;for(const n of e)n<t&&(t=n),n>o&&(o=n);return[t,o]}(r);if(a===f)return()=>(n[0]+n[1])/2;const c=y().domain([a,f]).range(n).clamp(!0);return t=>{const o=t.data?.[e];return null==o||"number"!=typeof o?n[0]:c(o)}}self.onmessage=e=>{const t=e.data,o=t?.requestId,n=t?.request??t;try{if("normalized"===n.kind){const e=n.nodeRadii,t=e?{...n.options,nodeRadius:t=>e[t.id]??12}:n.options;return void self.postMessage({requestId:o,positions:c(n.nodes,n.edges,t)})}const e=n.nodes,t=n.edges;w.computeLayout(e,t,n.config,n.size),self.postMessage({requestId:o,positions:Object.fromEntries(e.map(e=>[e.id,{x:e.x,y:e.y}]))})}catch(e){self.postMessage({requestId:o,error:{message:e instanceof Error?e.message:String(e),name:e instanceof Error?e.name:"Error",stack:e instanceof Error?e.stack:void 0}})}};
|
|
1
|
+
import{forceCenter as e,forceCollide as t,forceLink as n,forceManyBody as o,forceSimulation as a,forceX as r,forceY as f}from"d3-force";function c(c,s,i={}){const d=i.seed??1,l=i.iterations??260,u=i.repulsion??5200,h=i.linkDistance??165,g=i.linkStrength??.045,b=i.centerStrength??.018,m=i.damping??.84,y=i.nodeRadius??12,p=i.nodePadding??3,M=i.inset??.06,x=function(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(d),S=new Map;for(const e of c)S.set(e.id,0);for(const e of s)S.set(e.source,(S.get(e.source)??0)+1),S.set(e.target,(S.get(e.target)??0)+1);const k=500,w=c.map(e=>({id:e.id,data:e,x:200+600*x(),y:200+600*x()})),v=new Set(c.map(e=>e.id)),q=s.filter(e=>v.has(e.source)&&v.has(e.target)).map(e=>({source:e.source,target:e.target}));if(l>0){const c=a(w).randomSource(x).alphaDecay(1-Math.pow(.001,1/l)).velocityDecay(Math.max(0,Math.min(1,1-m))).force("charge",o().strength(e=>{const t=S.get(e.id)??0;return 2.5*-Math.sqrt(u)*Math.sqrt(t+1)})).force("collide",t(e=>(e=>"function"==typeof y?y(e.data):y)(e)+p).strength(.9).iterations(2)).force("center",e(k,k).strength(.8)).force("x",r(k).strength(b)).force("y",f(k).strength(b));q.length>0&&c.force("link",n(q).id(e=>e.id).distance(h).strength(e=>{const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(S.get(t)??1,S.get(n)??1));return g/.045/o})),c.stop();for(let e=0;e<l;e+=1)c.tick()}let z=1/0,I=1/0,R=-1/0,$=-1/0;for(const e of w){const t=e.x??k,n=e.y??k;t<z&&(z=t),n<I&&(I=n),t>R&&(R=t),n>$&&($=n)}const E=R-z,_=$-I,C={};for(const e of w)C[e.id]={x:0===E?.5:M+((e.x??k)-z)/E*(1-2*M),y:0===_?.5:M+((e.y??k)-I)/_*(1-2*M)};return C}import{forceSimulation as s,forceCenter as i,forceX as d,forceY as l,forceLink as u,forceManyBody as h,forceCollide as g}from"d3-force";import{scaleLinear as b}from"d3-scale";function m(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function y(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function p(e){const t=e.map(m),n=t.length-1;return e=>{if(e<=0){const[e,n,o]=t[0];return y(e,n,o)}if(e>=1){const[e,o,a]=t[n];return y(e,o,a)}const o=e*n,a=Math.floor(o),r=o-a,[f,c,s]=t[a],[i,d,l]=t[a+1];return y(Math.round(f+(i-f)*r),Math.round(c+(d-c)*r),Math.round(s+(l-s)*r))}}var M=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];p(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),p(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),p(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),p(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),p(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),p(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),p(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),p(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),p(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),p(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),p(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),p(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),p(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),p(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),p(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),p(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),p(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),p(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var x=new Set,S=new WeakMap;function k(e,t){if(!e||!e.data||"object"!=typeof e.data)return e;let n=S.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,S.set(e,n);const o=new Proxy(e,{get(e,n,o){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;x.has(e)||(x.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,o)}});return n.set(t,o),o}function w(e){return"string"==typeof e?e:e.id}var v={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const a=n.forceStrength??.1,r=o[0]/2,f=o[1]/2,c=Math.max(.1,Math.min(1,Math.min(o[0],o[1])/200)),b=Math.min(.5,.06+1.8*(1-c)),m=n.__previousPositions;let y=0;const p=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=m?.get(t.id);e?y++:n?(t.x=n.x,t.y=n.y,y++):p.push(t)}const M=e.length>0?p.length/e.length:1,x=y>0&&M<=.3;if(x){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of p){const o=q(e.id,t,n);if(o.length>0){let t=0,n=0;for(const e of o)t+=e.x,n+=e.y;const a=z(e.id),r=a%360*(Math.PI/180),f=(10+a%20)*c;e.x=t/o.length+f*Math.cos(r),e.y=n/o.length+f*Math.sin(r)}else{const t=z(e.id),n=t%360*(Math.PI/180),o=(15+t%30)*c;e.x=r+o*Math.cos(n),e.y=f+o*Math.sin(n)}}}else{const t=Math.PI*(3-Math.sqrt(5));for(let n=0;n<e.length;n++){const o=e[n];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(n+.5)*c,a=n*t;o.x=r+e*Math.cos(a),o.y=f+e*Math.sin(a)}}}const S=e.length,k=n.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(S-30)))),v=n.__skipForceSimulation||0===n.iterations?0:x?40:k,R=I(n.nodeSize,n.nodeSizeRange,e),$=e=>R(e);if(v>0){const m=new Map,y=new Map;for(const t of e)m.set(t.id,0),y.set(t.id,t);for(const e of t){const t=w(e.source),n=w(e.target);m.set(t,(m.get(t)??0)+1),m.set(n,(m.get(n)??0)+1)}const p=u().strength(e=>{const t=e.weight,n=w(e.source),o=w(e.target),r=Math.max(1,Math.min(m.get(n)??1,m.get(o)??1)),f=t&&t>0?Math.sqrt(t):1;return Math.min(2.5,f*a/(.1*r))}).distance(e=>{const t="string"==typeof e.source?y.get(e.source):e.source,n="string"==typeof e.target?y.get(e.target):e.target,o=(t?$(t):0)+(n?$(n):0)+Math.max(6,12*c);return Math.max(16,40*c,o)}).id(e=>e.id),M=s();if(void 0===n.random&&void 0===n.seed||M.randomSource(n.random??function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n.seed)),M.force("charge",h().strength(e=>{const t=m.get(e.id)??0;return-15*c*$(e)*Math.sqrt(t+1)})).force("collide",g(e=>$(e)+3*c).strength(.9).iterations(2)).force("center",i(r,f).strength(.8)).force("x",d(r).strength(b)).force("y",l(f).strength(b)).force("bounds",function(e,t,n=2,o=.6){let a=[];const r=r=>{const f=o*Math.max(r,.2);for(const o of a){const a=o.x??e[0]/2,r=o.y??e[1]/2,c=o.vx??0,s=o.vy??0,i=t(o)+n,d=Math.min(e[0]/2,i),l=Math.max(e[0]/2,e[0]-i),u=Math.min(e[1]/2,i),h=Math.max(e[1]/2,e[1]-i),g=a+c,b=r+s;g<d?o.vx=c+(d-g)*f:g>l&&(o.vx=c+(l-g)*f),b<u?o.vy=s+(u-b)*f:b>h&&(o.vy=s+(h-b)*f)}};return r.initialize=e=>{a=e},r}(o,$)),M.nodes(e),t.length>0){const e=t.map(e=>({...e,source:w(e.source),target:w(e.target)}));p.links(e),M.force("link",p)}x?M.alpha(.3):M.alpha()<.1&&M.alpha(1),M.stop();for(let e=0;e<v;++e)M.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=$(t),n=v>0?2:0,a=Math.min(o[0]/2,e+n),r=Math.min(o[1]/2,e+n);t.x=Math.max(a,Math.min(o[0]-a,t.x)),t.y=Math.max(r,Math.min(o[1]-r,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const E=new Map;for(const t of e)E.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=E.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=E.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){const a=n.nodeStyle,r=n.edgeStyle,f=I(n.nodeSize,n.nodeSizeRange,e),c=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:M,s=new Map;e.forEach((e,t)=>{s.set(e.id,c[t%c.length])});const i=[],d=[],l=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=f(k(t,"nodeSize")),o=a?a(k(t,"nodeStyle")):{},r={fill:o.fill||s.get(t.id)||n.themeSemantic?.primary||"#007bff",stroke:o.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:o.strokeWidth??2,opacity:o.opacity};i.push({type:"circle",cx:t.x,cy:t.y,r:e,style:r,datum:t,id:t.id,label:t.id})}const u=new Map;for(const t of e)u.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:u.get(e.source),o="object"==typeof e.target?e.target:u.get(e.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const a=r?r(k(e,"edgeStyle")):{},f={stroke:a.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:a.strokeWidth??1,opacity:a.opacity??.6};d.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:f,datum:e})}if(!1!==n.showLabels){const t=(h=n.nodeLabel)?"function"==typeof h?h:e=>e[h]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=f(k(n,"nodeSize"));l.push({x:n.x,y:n.y-o-4,text:String(e),anchor:"middle",baseline:"auto",fontSize:11})}}var h;return{sceneNodes:i,sceneEdges:d,labels:l}}};function q(e,t,n){const o=[];for(const a of t){const t=w(a.source),r=w(a.target);let f=null;if(t===e?f=r:r===e&&(f=t),f){const e=n.get(f);!e||0===e.x&&0===e.y||o.push({x:e.x,y:e.y})}}return o}function z(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function I(e,t,n){if(n.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const o=t||[5,20],a=[];for(const t of n){const n=t.data?.[e];"number"==typeof n&&a.push(n)}if(0===a.length)return()=>o[0];const[r,f]=function(e){let t=1/0,n=-1/0;for(const o of e)o<t&&(t=o),o>n&&(n=o);return[t,n]}(a);if(r===f)return()=>(o[0]+o[1])/2;const c=b().domain([r,f]).range(o).clamp(!0);return t=>{const n=t.data?.[e];return null==n||"number"!=typeof n?o[0]:c(n)}}self.onmessage=e=>{const t=e.data,n=t?.requestId,o=t?.request??t;try{if("normalized"===o.kind){const e=o.nodeRadii,t=e?{...o.options,nodeRadius:t=>e[t.id]??12}:o.options;return void self.postMessage({requestId:n,positions:c(o.nodes,o.edges,t)})}const e=o.nodes,t=o.edges;v.computeLayout(e,t,o.config,o.size),self.postMessage({requestId:n,positions:Object.fromEntries(e.map(e=>[e.id,{x:e.x,y:e.y}]))})}catch(e){self.postMessage({requestId:n,error:{message:e instanceof Error?e.message:String(e),name:e instanceof Error?e.name:"Error",stack:e instanceof Error?e.stack:void 0}})}};
|