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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProcessSankeyNode, ProcessSankeyNodeData, ProcessSankeySlot } from "./algorithm";
|
|
2
|
+
import type { SlotByNode } from "./layoutGeometry";
|
|
3
|
+
/**
|
|
4
|
+
* Translate same-group bands as a time-aware streamgraph stack.
|
|
5
|
+
*
|
|
6
|
+
* Slot ordering still supplies a stable within-group order and reserves the
|
|
7
|
+
* group's collision-free outer envelope. At every group sample time, active
|
|
8
|
+
* slots are restacked without holes around that envelope's center. Nodes that
|
|
9
|
+
* reuse one slot at an exact handoff share its position instead of being
|
|
10
|
+
* double-counted. The same mass-space delta is copied to every attachment at
|
|
11
|
+
* that time, retaining the node/ribbon partition invariant.
|
|
12
|
+
*/
|
|
13
|
+
export declare function bondProcessSankeyNodeData(nodes: readonly ProcessSankeyNode[], nodeData: Record<string, ProcessSankeyNodeData>, slots: readonly ProcessSankeySlot[], slotByNode: Readonly<SlotByNode>, centerlines: Readonly<Record<string, number>>, valueScale: number, groupPadding?: number): Record<string, ProcessSankeyNodeData>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure inventory ledger for ProcessSankey-style stock-and-flow graphs.
|
|
3
|
+
*
|
|
4
|
+
* Persistent institutions (and other nodes whose stock is only implied by
|
|
5
|
+
* edge events) compute "how much sits in this node at time t" by folding
|
|
6
|
+
* arrivals and departures. Predecessor/source nodes that begin with authored
|
|
7
|
+
* stock rather than an inbound transaction are handled by lifting the running
|
|
8
|
+
* balance so it never goes negative — the same convention the United States
|
|
9
|
+
* history-river example used inline before extraction.
|
|
10
|
+
*/
|
|
11
|
+
export interface InventoryEdge {
|
|
12
|
+
source: string;
|
|
13
|
+
target: string;
|
|
14
|
+
value: number;
|
|
15
|
+
/** Time mass leaves the source (ribbon depart / transfer start). */
|
|
16
|
+
startTime: number;
|
|
17
|
+
/** Time mass arrives at the target (ribbon arrive / transfer end). */
|
|
18
|
+
endTime: number;
|
|
19
|
+
/**
|
|
20
|
+
* Optional lifecycle exit from the target band (e.g. colonial administration
|
|
21
|
+
* ending). When set, counts as a departure from `target` at this time.
|
|
22
|
+
*/
|
|
23
|
+
systemOutTime?: number | null;
|
|
24
|
+
}
|
|
25
|
+
export interface InventoryAtTimeOptions {
|
|
26
|
+
/**
|
|
27
|
+
* When true (default), infer an opening stock so the running balance never
|
|
28
|
+
* dips below zero. When false, report the raw cumulative sum of events at
|
|
29
|
+
* `time` (may be negative for incomplete ledgers).
|
|
30
|
+
*/
|
|
31
|
+
inferOpeningStock?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Inventory of `nodeId` at `time` from an edge ledger.
|
|
35
|
+
*
|
|
36
|
+
* Events:
|
|
37
|
+
* - inbound: `target === nodeId` at `endTime` (+value)
|
|
38
|
+
* - outbound: `source === nodeId` at `startTime` (−value)
|
|
39
|
+
* - lifecycle exit: `target === nodeId` with `systemOutTime` (−value)
|
|
40
|
+
*/
|
|
41
|
+
export declare function inventoryAtTime(nodeId: string, time: number, edges: readonly InventoryEdge[], options?: InventoryAtTimeOptions): number;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ProcessSankeyBandSpec } from "./streamingLayout";
|
|
2
|
+
import type { SlotByNode } from "./layoutGeometry";
|
|
3
|
+
/**
|
|
4
|
+
* Reused rows can contain consecutive node bands whose starts are only a few
|
|
5
|
+
* pixels apart. Their end-anchored labels otherwise paint over one another.
|
|
6
|
+
* Stagger only horizontally-overlapping clusters within the same packed row.
|
|
7
|
+
*/
|
|
8
|
+
export declare function staggerProcessSankeyLabels(bands: readonly ProcessSankeyBandSpec[], slotByNode: SlotByNode, plotH: number): ProcessSankeyBandSpec[];
|
|
9
|
+
/**
|
|
10
|
+
* A vertical river can have many nodes opening on the same historical stage.
|
|
11
|
+
* Place those labels in compact rows within the preceding inter-stage gap.
|
|
12
|
+
* This is intentionally a label-only pass: it never changes band ordering or
|
|
13
|
+
* geometry, and labels at distinct stages cannot push one another downstream.
|
|
14
|
+
*/
|
|
15
|
+
export declare function staggerVerticalProcessSankeyLabels(bands: readonly ProcessSankeyBandSpec[], plotW: number, plotH: number): ProcessSankeyBandSpec[];
|
|
16
|
+
export interface ProcessSankeyLabelDensityOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Explicit author priority per band id (higher keeps first under `"auto"`).
|
|
19
|
+
* When omitted, density falls back to label-width + geometric stand-in.
|
|
20
|
+
*/
|
|
21
|
+
priorityById?: ReadonlyMap<string, number>;
|
|
22
|
+
/**
|
|
23
|
+
* Optional hard cap on visible labels (after the area-based budget). Useful
|
|
24
|
+
* for compact vertical rivers that should never exceed N stage labels.
|
|
25
|
+
*/
|
|
26
|
+
maxLabels?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Density-aware label filter for `showLabels="auto"`. Keeps higher-priority
|
|
30
|
+
* bands until the plot's label budget is exhausted. Shed labels retain their
|
|
31
|
+
* text as `labelFullText` with `labelDeferred: true` so selection/hover can
|
|
32
|
+
* re-surface them without a layout recompute. Deterministic CSR/SSR.
|
|
33
|
+
*/
|
|
34
|
+
export declare function applyProcessSankeyLabelDensity(bands: readonly ProcessSankeyBandSpec[], plotW: number, plotH: number, mode: boolean | "auto", options?: ProcessSankeyLabelDensityOptions): ProcessSankeyBandSpec[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ProcessSankeyEdge, ProcessSankeyLaneLifetime, ProcessSankeyLayoutQuality, ProcessSankeyNode, ProcessSankeyNodeData, ProcessSankeyRibbonLane, ProcessSankeySlot } from "./algorithm";
|
|
2
|
+
export type { ProcessSankeyRibbonLane };
|
|
3
|
+
export type SlotByNode = Record<string, number>;
|
|
4
|
+
export interface SlotGeometryOptions {
|
|
5
|
+
plotH: number;
|
|
6
|
+
padding: number;
|
|
7
|
+
valueScale: number;
|
|
8
|
+
/** Scale used only to seed/retain legacy stack center spacing. This may be
|
|
9
|
+
* larger than `valueScale` when a band-inflation cap creates slack. */
|
|
10
|
+
stackValueScale?: number;
|
|
11
|
+
lanePlacement?: "stack" | "hug";
|
|
12
|
+
/** Pixels between adjacent slots carrying the same non-empty group. */
|
|
13
|
+
groupPadding?: number;
|
|
14
|
+
/** Precomputed adjacent clearances for hot ordering loops. */
|
|
15
|
+
adjacentClearance?: readonly number[];
|
|
16
|
+
}
|
|
17
|
+
export interface SlotGeometry {
|
|
18
|
+
adjacentClearance: number[];
|
|
19
|
+
centerlines: Record<string, number>;
|
|
20
|
+
slotCenter: number[];
|
|
21
|
+
stackCenter: number[];
|
|
22
|
+
verticalUtilization: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function compareProcessSankeyIds(a: string, b: string): number;
|
|
25
|
+
export declare function slotStableId(slot: ProcessSankeySlot): string;
|
|
26
|
+
export declare function processSankeyGapPaddings(slots: readonly ProcessSankeySlot[], padding: number, groupPadding?: number): number[];
|
|
27
|
+
/** Pair clearance helper used to cache all slot-pair geometries once before
|
|
28
|
+
* an ordering search instead of rebuilding silhouettes per candidate. */
|
|
29
|
+
export declare function computeSlotPairClearance(upper: ProcessSankeySlot, lower: ProcessSankeySlot, nodeData: Record<string, ProcessSankeyNodeData>): number;
|
|
30
|
+
export declare function computeSlotGeometry(nodes: readonly ProcessSankeyNode[], edges: readonly ProcessSankeyEdge[], nodeData: Record<string, ProcessSankeyNodeData>, slots: readonly ProcessSankeySlot[], slotByNode: SlotByNode, options: SlotGeometryOptions): SlotGeometry;
|
|
31
|
+
export declare function totalPixelEdgeLength(centerlines: Record<string, number>, edges: readonly ProcessSankeyEdge[]): number;
|
|
32
|
+
export interface TransitOcclusionOptions {
|
|
33
|
+
valueScale: number;
|
|
34
|
+
ribbonLane?: ProcessSankeyRibbonLane;
|
|
35
|
+
domain?: [number, number];
|
|
36
|
+
/** `score` uses a bounded sample set during ordering; `quality` adds every
|
|
37
|
+
* lane event breakpoint and interval midpoint for the reported metric. */
|
|
38
|
+
mode?: "score" | "quality";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Value-weighted ribbon coverage of intermediate lane bands over each edge's
|
|
42
|
+
* authored event window. Ribbon y values come from the same cubic used by the
|
|
43
|
+
* renderer; x is inverted by bisection. Optional render-only feeder runway is
|
|
44
|
+
* intentionally absent because it does not alter the edge's event interval.
|
|
45
|
+
*/
|
|
46
|
+
export declare function measureTransitOcclusion(edges: readonly ProcessSankeyEdge[], nodeData: Record<string, ProcessSankeyNodeData>, slots: readonly ProcessSankeySlot[], slotByNode: SlotByNode, centerlines: Record<string, number>, laneLifetime: Record<string, ProcessSankeyLaneLifetime>, options: TransitOcclusionOptions): number;
|
|
47
|
+
export declare function computeLayoutQuality(crossings: number, weightedLength: number, edges: readonly ProcessSankeyEdge[], nodeData: Record<string, ProcessSankeyNodeData>, slots: readonly ProcessSankeySlot[], slotByNode: SlotByNode, centerlines: Record<string, number>, laneLifetime: Record<string, ProcessSankeyLaneLifetime>, valueScale: number, verticalUtilization: number, ribbonLane?: ProcessSankeyRibbonLane, domain?: [number, number]): ProcessSankeyLayoutQuality;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type ProcessSankeyRibbonLane, type SlotByNode } from "./layoutGeometry";
|
|
2
|
+
import { type ProcessSankeyOrderingResult } from "./ordering";
|
|
3
|
+
import type { ProcessSankeyEdge, ProcessSankeyEdgeIndex, ProcessSankeyLaneLifetime, ProcessSankeyLayout, ProcessSankeyNode, ProcessSankeyNodeData, ProcessSankeyOptions, ProcessSankeySlot } from "./processSankeyTypes";
|
|
4
|
+
interface LaneLayoutOptions {
|
|
5
|
+
plotH: number;
|
|
6
|
+
padding: number;
|
|
7
|
+
valueScale: number;
|
|
8
|
+
stackValueScale?: number;
|
|
9
|
+
packing?: "off" | "reuse";
|
|
10
|
+
laneOrder?: "insertion" | "crossing-min" | "inside-out" | "crossing-min+inside-out";
|
|
11
|
+
lifetimeMode?: "full" | "half";
|
|
12
|
+
lanePlacement?: "stack" | "hug";
|
|
13
|
+
groupPadding?: number;
|
|
14
|
+
ribbonLane?: ProcessSankeyRibbonLane;
|
|
15
|
+
domain?: [number, number];
|
|
16
|
+
/** Run search only on the first dry pass. Later passes freeze packing + order. */
|
|
17
|
+
runOrdering?: boolean;
|
|
18
|
+
fixedSlotOrder?: readonly string[];
|
|
19
|
+
/**
|
|
20
|
+
* Frozen packing assignment from an earlier pass. When set, packing search is
|
|
21
|
+
* skipped and peaks/ends are rehydrated onto the same occupant membership.
|
|
22
|
+
*/
|
|
23
|
+
frozenSlots?: readonly ProcessSankeySlot[];
|
|
24
|
+
}
|
|
25
|
+
interface LaneLayoutResult {
|
|
26
|
+
effectiveSlotsHeight: number;
|
|
27
|
+
centerlines: Record<string, number>;
|
|
28
|
+
laneLifetime: Record<string, ProcessSankeyLaneLifetime>;
|
|
29
|
+
slots: ProcessSankeySlot[];
|
|
30
|
+
slotByNode: SlotByNode;
|
|
31
|
+
slotCenter: number[];
|
|
32
|
+
stackCenter: number[];
|
|
33
|
+
verticalUtilization: number;
|
|
34
|
+
selectedSlotOrder: string[];
|
|
35
|
+
initialSlotOrder: string[];
|
|
36
|
+
ordering: ProcessSankeyOrderingResult | null;
|
|
37
|
+
crossingsBefore: number | null;
|
|
38
|
+
crossingsAfter: number | null;
|
|
39
|
+
lengthBefore: number | null;
|
|
40
|
+
lengthAfter: number | null;
|
|
41
|
+
}
|
|
42
|
+
export declare function computeLaneLayout(nodes: ProcessSankeyNode[], edges: ProcessSankeyEdge[], nodeData: Record<string, ProcessSankeyNodeData>, edgeIndex: ProcessSankeyEdgeIndex, opts: LaneLayoutOptions): LaneLayoutResult;
|
|
43
|
+
export declare function computeProcessSankeyLayout(nodes: ProcessSankeyNode[], edges: ProcessSankeyEdge[], opts: ProcessSankeyOptions): ProcessSankeyLayout;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product surface for ProcessSankey layout quality (M10).
|
|
3
|
+
*
|
|
4
|
+
* Pure helpers that turn a finished layout (or raw props) into diagnoses /
|
|
5
|
+
* interrogation-friendly text — shared by diagnoseConfig, MCP, and docs.
|
|
6
|
+
*/
|
|
7
|
+
import type { Diagnosis } from "../../shared/diagnoseTypes";
|
|
8
|
+
import type { ProcessSankeyLayout, ProcessSankeyLayoutQuality } from "./processSankeyTypes";
|
|
9
|
+
/** Soft thresholds for flagship-scale rivers; not hard layout failures. */
|
|
10
|
+
export declare const PROCESS_SANKEY_QUALITY_THRESHOLDS: {
|
|
11
|
+
/** Weighted ribbons crossing dense intermediate mass (layout proxy). */
|
|
12
|
+
readonly highTransitOcclusion: 8;
|
|
13
|
+
/** Fraction of plot height occupied by peaks + gaps. */
|
|
14
|
+
readonly highLaneUtilization: 0.92;
|
|
15
|
+
/** Crossings remaining after ordering (topology-hard cases still warn). */
|
|
16
|
+
readonly residualCrossings: 3;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Diagnose an already-computed layout. Call with `ref.getCustomLayout()?.layout`
|
|
20
|
+
* or the result of `computeProcessSankeyLayout`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function diagnoseProcessSankeyLayout(layout: Pick<ProcessSankeyLayout, "layoutQuality" | "layoutQualityBefore" | "compressedPadding" | "crossingsAfter"> | null | undefined): Diagnosis[];
|
|
23
|
+
/** One-paragraph layout summary for interrogation / agent grounding. */
|
|
24
|
+
export declare function explainProcessSankeyLayout(layout: Pick<ProcessSankeyLayout, "layoutQuality" | "layoutQualityBefore" | "compressedPadding" | "slots" | "crossingsAfter"> | null | undefined): string | null;
|
|
25
|
+
/** Prop-only checks when a layout has not been run yet. */
|
|
26
|
+
export declare function diagnoseProcessSankeyProps(props: Record<string, unknown>): Diagnosis[];
|
|
27
|
+
export type { ProcessSankeyLayoutQuality };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type SlotByNode } from "./layoutGeometry";
|
|
2
|
+
import type { ProcessSankeyEdge, ProcessSankeyEdgeIndex, ProcessSankeyNode, ProcessSankeyNodeData, ProcessSankeyNodeSizing, ProcessSankeySideRecord } from "./processSankeyTypes";
|
|
3
|
+
export declare function buildEdgeIndex(nodes: ProcessSankeyNode[], edges: ProcessSankeyEdge[]): ProcessSankeyEdgeIndex;
|
|
4
|
+
export declare function assignSides(nodes: ProcessSankeyNode[], edges: ProcessSankeyEdge[], edgeIndex: ProcessSankeyEdgeIndex,
|
|
5
|
+
/** Matches the public HOC default (`"temporal"`). */
|
|
6
|
+
pairing?: "value" | "temporal"): Map<string, ProcessSankeySideRecord>;
|
|
7
|
+
export interface ProcessSankeyEndpointPositions {
|
|
8
|
+
source: number;
|
|
9
|
+
target: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function computeNode(node: ProcessSankeyNode, edgeIndex: ProcessSankeyEdgeIndex, sides: Map<string, ProcessSankeySideRecord>, endpointPositions?: ReadonlyMap<string, ProcessSankeyEndpointPositions>, nodeSizing?: ProcessSankeyNodeSizing): ProcessSankeyNodeData;
|
|
12
|
+
export declare function collectEndpointPositions(edges: readonly ProcessSankeyEdge[], nodeData: Readonly<Record<string, ProcessSankeyNodeData>>, centerlines: Readonly<Record<string, number>>, valueScale: number): Map<string, ProcessSankeyEndpointPositions>;
|
|
13
|
+
export declare function hasResolvableAttachmentTies(edgeIndex: ProcessSankeyEdgeIndex, sides: ReadonlyMap<string, ProcessSankeySideRecord>): boolean;
|
|
14
|
+
export declare function assignSameSlotHandoffSides(edges: readonly ProcessSankeyEdge[], sides: Map<string, ProcessSankeySideRecord>, slotByNode: Readonly<SlotByNode>): void;
|
|
15
|
+
/** Per-node side rebalance to keep multi-edge bundles within available per-side mass. */
|
|
16
|
+
export declare function rebalanceOutgoingSides(nodes: readonly ProcessSankeyNode[], edgeIndex: ProcessSankeyEdgeIndex, sides: Map<string, ProcessSankeySideRecord>, sameSlotEdgeIds: ReadonlySet<string>): void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ProcessSankeyEdge, ProcessSankeyLaneLifetime, ProcessSankeyNode, ProcessSankeyNodeData, ProcessSankeySlot } from "./algorithm";
|
|
2
|
+
import { type ProcessSankeyRibbonLane, type SlotByNode } from "./layoutGeometry";
|
|
3
|
+
import { bondProcessSankeySlotGroups } from "./orderingBond";
|
|
4
|
+
export { bondProcessSankeySlotGroups };
|
|
5
|
+
export interface ProcessSankeyOrderMetrics {
|
|
6
|
+
crossings: number;
|
|
7
|
+
weightedLength: number;
|
|
8
|
+
pixelLength: number;
|
|
9
|
+
transitOcclusion: number;
|
|
10
|
+
cost: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ProcessSankeyOrderingResult {
|
|
13
|
+
before: ProcessSankeyOrderMetrics;
|
|
14
|
+
after: ProcessSankeyOrderMetrics;
|
|
15
|
+
/** Stable slot ids before optimization, used by quality baselines. */
|
|
16
|
+
initialOrder: string[];
|
|
17
|
+
/** Candidate counts make the performance budget testable without timers. */
|
|
18
|
+
evaluations: {
|
|
19
|
+
fullCrossing: number;
|
|
20
|
+
localCrossing: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface ProcessSankeyOrderingOptions {
|
|
24
|
+
plotH: number;
|
|
25
|
+
padding: number;
|
|
26
|
+
valueScale: number;
|
|
27
|
+
groupPadding?: number;
|
|
28
|
+
laneOrder?: "insertion" | "crossing-min" | "inside-out" | "crossing-min+inside-out";
|
|
29
|
+
ribbonLane?: ProcessSankeyRibbonLane;
|
|
30
|
+
domain?: [number, number];
|
|
31
|
+
/**
|
|
32
|
+
* Placement used when scoring pixel/transit cost. Must match the final
|
|
33
|
+
* layout's `lanePlacement` so a hug + maxValueScale pass can refine order
|
|
34
|
+
* against rendered geometry (M3), not only the dry stack scale=1 proxy.
|
|
35
|
+
*/
|
|
36
|
+
lanePlacement?: "stack" | "hug";
|
|
37
|
+
/**
|
|
38
|
+
* `"full"` runs barycenter + exact search + geometry refine.
|
|
39
|
+
* `"geometry-refine"` only runs the bounded exact-transit adjacent-swap
|
|
40
|
+
* (and unit-aware transpose when multi-slot bonds exist) — used after the
|
|
41
|
+
* final valueScale / hug geometry is known.
|
|
42
|
+
*/
|
|
43
|
+
mode?: "full" | "geometry-refine";
|
|
44
|
+
}
|
|
45
|
+
export declare function countCrossings(slotByNode: SlotByNode, edges: readonly ProcessSankeyEdge[]): number;
|
|
46
|
+
export declare function totalEdgeLength(slotByNode: SlotByNode, edges: readonly ProcessSankeyEdge[]): number;
|
|
47
|
+
/**
|
|
48
|
+
* Optimize one already-packed ProcessSankey slot list. Crossing changes for
|
|
49
|
+
* adjacent swaps are evaluated only for edge pairs incident to the two moved
|
|
50
|
+
* slots; pixel length and transit are O(E·slots), avoiding the old O(E²)
|
|
51
|
+
* rescore at every transpose candidate.
|
|
52
|
+
*/
|
|
53
|
+
export declare function orderProcessSankeySlots(nodes: readonly ProcessSankeyNode[], edges: readonly ProcessSankeyEdge[], nodeData: Record<string, ProcessSankeyNodeData>, _laneLifetime: Record<string, ProcessSankeyLaneLifetime>, slots: ProcessSankeySlot[], slotByNode: SlotByNode, options: ProcessSankeyOrderingOptions): ProcessSankeyOrderingResult;
|
|
54
|
+
/** Reapply a previously selected slot permutation without rerunning search. */
|
|
55
|
+
export declare function applyFixedSlotOrder(slots: ProcessSankeySlot[], slotByNode: SlotByNode, orderedStableIds: readonly string[]): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { WeightedOrderRelation } from "../../../recipes/layout1d";
|
|
2
|
+
import type { ProcessSankeySlot } from "./algorithm";
|
|
3
|
+
import { type SlotByNode } from "./layoutGeometry";
|
|
4
|
+
export interface BondedSlotUnit {
|
|
5
|
+
anchor: number;
|
|
6
|
+
stableId: string;
|
|
7
|
+
slots: ProcessSankeySlot[];
|
|
8
|
+
}
|
|
9
|
+
export declare function mapForOrder(order: readonly ProcessSankeySlot[]): SlotByNode;
|
|
10
|
+
export declare function applyOrder(slots: ProcessSankeySlot[], slotByNode: SlotByNode, order: readonly ProcessSankeySlot[]): void;
|
|
11
|
+
/** Build indivisible ordering units. Ungrouped slots remain independent;
|
|
12
|
+
* every non-empty group becomes one unit whose anchor is the mean position of
|
|
13
|
+
* its members. Sorting by that anchor is a deterministic minimum-disruption
|
|
14
|
+
* projection from any unconstrained ordering into a contiguous group order. */
|
|
15
|
+
export declare function bondedSlotUnits(order: readonly ProcessSankeySlot[]): BondedSlotUnit[];
|
|
16
|
+
export declare function bondedSlotOrder(order: readonly ProcessSankeySlot[]): ProcessSankeySlot[];
|
|
17
|
+
export declare function hasMultiSlotBond(order: readonly ProcessSankeySlot[]): boolean;
|
|
18
|
+
export declare function flattenBondedUnits(units: readonly BondedSlotUnit[]): ProcessSankeySlot[];
|
|
19
|
+
/**
|
|
20
|
+
* Collapse slot-level weighted relations onto bonded units. Multi-slot groups
|
|
21
|
+
* become single supernodes so barycenter / swap search places the whole block
|
|
22
|
+
* next to its dominant partners instead of letting unconstrained slot moves
|
|
23
|
+
* interleave foreign rows through the block and only re-glue afterwards.
|
|
24
|
+
*/
|
|
25
|
+
export declare function unitRelationsFromSlots(units: readonly BondedSlotUnit[], slotRelations: readonly WeightedOrderRelation<ProcessSankeySlot>[]): WeightedOrderRelation<BondedSlotUnit>[];
|
|
26
|
+
/**
|
|
27
|
+
* Reorder slots inside each multi-slot unit toward their external partners.
|
|
28
|
+
* Keeps the unit contiguous while aligning members that hand off to a neighbor
|
|
29
|
+
* toward that neighbor's side of the block (classic compound-node median).
|
|
30
|
+
*/
|
|
31
|
+
export declare function orderWithinBondedUnits(units: readonly BondedSlotUnit[], slotRelations: readonly WeightedOrderRelation<ProcessSankeySlot>[], compareSlots: (a: ProcessSankeySlot, b: ProcessSankeySlot) => number): BondedSlotUnit[];
|
|
32
|
+
/** Apply the node-group contiguity constraint regardless of laneOrder mode. */
|
|
33
|
+
export declare function bondProcessSankeySlotGroups(slots: ProcessSankeySlot[], slotByNode: SlotByNode): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProcessSankeyBandSpec, ProcessSankeyRibbonSpec } from "./streamingLayout";
|
|
2
|
+
export type ProcessSankeyOrientation = "horizontal" | "vertical";
|
|
3
|
+
export declare function transposeProcessSankeyPath(pathD: string): string;
|
|
4
|
+
export declare function orientProcessSankeyBand(band: ProcessSankeyBandSpec, orientation: ProcessSankeyOrientation): ProcessSankeyBandSpec;
|
|
5
|
+
export declare function orientProcessSankeyRibbon(ribbon: ProcessSankeyRibbonSpec, orientation: ProcessSankeyOrientation): ProcessSankeyRibbonSpec;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProcessSankeyEdge, ProcessSankeyLaneLifetime, ProcessSankeyNode, ProcessSankeyNodeData, ProcessSankeySlot } from "./algorithm";
|
|
2
|
+
import { type SlotByNode } from "./layoutGeometry";
|
|
3
|
+
import { clearProcessSankeyPackingCache, processSankeyPackingSignature, rehydrateProcessSankeySlots } from "./packingCache";
|
|
4
|
+
export { clearProcessSankeyPackingCache, processSankeyPackingSignature, rehydrateProcessSankeySlots, };
|
|
5
|
+
export declare function packProcessSankeySlots(nodes: readonly ProcessSankeyNode[], edges: readonly ProcessSankeyEdge[], nodeData: Readonly<Record<string, ProcessSankeyNodeData>>, laneLifetime: Readonly<Record<string, ProcessSankeyLaneLifetime>>): {
|
|
6
|
+
slots: ProcessSankeySlot[];
|
|
7
|
+
slotByNode: SlotByNode;
|
|
8
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ProcessSankeyEdge, ProcessSankeyLaneLifetime, ProcessSankeyNode, ProcessSankeyNodeData, ProcessSankeySlot } from "./algorithm";
|
|
2
|
+
import type { SlotByNode } from "./layoutGeometry";
|
|
3
|
+
/**
|
|
4
|
+
* Reapply a frozen packing assignment under updated mass/lifetime data.
|
|
5
|
+
* Occupant membership and row identity stay fixed; peaks and end times refresh.
|
|
6
|
+
* Used by multi-pass layout so expensive packing search runs once per topology.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rehydrateProcessSankeySlots(frozenSlots: readonly ProcessSankeySlot[], nodeData: Readonly<Record<string, ProcessSankeyNodeData>>, laneLifetime: Readonly<Record<string, ProcessSankeyLaneLifetime>>): {
|
|
9
|
+
slots: ProcessSankeySlot[];
|
|
10
|
+
slotByNode: SlotByNode;
|
|
11
|
+
};
|
|
12
|
+
/** Topology + mass signature for packing cache (plot size independent). */
|
|
13
|
+
export declare function processSankeyPackingSignature(nodes: readonly ProcessSankeyNode[], edges: readonly ProcessSankeyEdge[], nodeData: Readonly<Record<string, ProcessSankeyNodeData>>, laneLifetime: Readonly<Record<string, ProcessSankeyLaneLifetime>>): string;
|
|
14
|
+
export declare function lookupPackingCache(key: string): {
|
|
15
|
+
slots: ProcessSankeySlot[];
|
|
16
|
+
slotByNode: SlotByNode;
|
|
17
|
+
} | undefined;
|
|
18
|
+
export declare function storePackingCache(key: string, result: {
|
|
19
|
+
slots: ProcessSankeySlot[];
|
|
20
|
+
slotByNode: SlotByNode;
|
|
21
|
+
}): void;
|
|
22
|
+
/** Test helper: clear the packing topology cache. */
|
|
23
|
+
export declare function clearProcessSankeyPackingCache(): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type BuildScenesInput, type BuildScenesResult } from "./buildScenes";
|
|
2
|
+
import { type ProcessSankeyLayoutExecution, type ProcessSankeyWorkerRequest } from "./processSankeyLayoutWorkerClient";
|
|
3
|
+
import type { Datum } from "../../shared/datumTypes";
|
|
4
|
+
export interface ProcessSankeyLayoutAsyncOptions {
|
|
5
|
+
execution?: ProcessSankeyLayoutExecution;
|
|
6
|
+
workerThreshold?: number;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
/** Precomputed per-node colors (required for worker path). */
|
|
9
|
+
colorById: Record<string, string>;
|
|
10
|
+
fallbackPalette?: string[];
|
|
11
|
+
rawNodeById?: ReadonlyMap<string, Datum>;
|
|
12
|
+
rawEdgeById?: ReadonlyMap<string, Datum>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Clone author datums for the worker boundary. Prefer structuredClone; fall
|
|
16
|
+
* back to JSON so plain records still cross when structuredClone is missing
|
|
17
|
+
* or rejects (e.g. non-cloneable fields).
|
|
18
|
+
*/
|
|
19
|
+
export declare function cloneProcessSankeyWireDatum(value: unknown): Datum | undefined;
|
|
20
|
+
/** Exported for tests — keep worker input observationally equal to sync. */
|
|
21
|
+
export declare function toProcessSankeyWorkerRequest(input: BuildScenesInput, colorById: Record<string, string>, fallbackPalette: string[]): ProcessSankeyWorkerRequest;
|
|
22
|
+
/**
|
|
23
|
+
* Async ProcessSankey scene builder. Large layouts run in a long-lived module
|
|
24
|
+
* worker; small graphs, SSR, non-serializable styleRules/label accessors, or
|
|
25
|
+
* missing Worker fall back to the same synchronous {@link buildProcessSankeyScenes}.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildProcessSankeyScenesAsync(input: BuildScenesInput, options: ProcessSankeyLayoutAsyncOptions): Promise<BuildScenesResult>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { BuildScenesInput, BuildScenesResult } from "./buildScenes";
|
|
2
|
+
import type { ProcessSankeyLayout } from "./algorithm";
|
|
3
|
+
import type { ProcessSankeyLayoutConfig } from "./streamingLayout";
|
|
4
|
+
import type { Datum } from "../../shared/datumTypes";
|
|
5
|
+
export type ProcessSankeyLayoutExecution = "auto" | "worker" | "sync";
|
|
6
|
+
/**
|
|
7
|
+
* Serializable worker request — no functions or React nodes.
|
|
8
|
+
* Author `__raw` datums are included when structured-cloneable so
|
|
9
|
+
* declarative styleRules / label priority resolve identically to sync.
|
|
10
|
+
*/
|
|
11
|
+
export interface ProcessSankeyWorkerRequest {
|
|
12
|
+
input: Omit<BuildScenesInput, "colorOf" | "styleRules" | "labelPriorityAccessor" | "colorBy" | "valueAccessor" | "edgeOpacity"> & {
|
|
13
|
+
/** Numeric form only; opacity resolver functions stay on the main thread. */
|
|
14
|
+
edgeOpacity: number;
|
|
15
|
+
/** Declarative styleRules only. Function when/style force main-thread. */
|
|
16
|
+
styleRules?: BuildScenesInput["styleRules"];
|
|
17
|
+
/** String field form only; functions force main-thread. */
|
|
18
|
+
labelPriorityAccessor?: string;
|
|
19
|
+
colorBy?: string;
|
|
20
|
+
valueAccessor?: string;
|
|
21
|
+
};
|
|
22
|
+
colorById: Record<string, string>;
|
|
23
|
+
fallbackPalette: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface ProcessSankeyWorkerResponse {
|
|
26
|
+
layout: ProcessSankeyLayout | null;
|
|
27
|
+
layoutConfig: ProcessSankeyLayoutConfig;
|
|
28
|
+
issues: BuildScenesResult["issues"];
|
|
29
|
+
warnings: BuildScenesResult["warnings"];
|
|
30
|
+
domain: [number, number];
|
|
31
|
+
timelineExtent: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Default cost threshold for `execution: "auto"`.
|
|
35
|
+
* Dense rivers (≈100 nodes × packing×ordering) sit well above this;
|
|
36
|
+
* small docs demos stay on the main thread.
|
|
37
|
+
*/
|
|
38
|
+
export declare const DEFAULT_PROCESS_SANKEY_WORKER_THRESHOLD = 50000;
|
|
39
|
+
export declare function estimateProcessSankeyLayoutCost(nodeCount: number, edgeCount: number, packing?: "off" | "reuse", laneOrder?: string): number;
|
|
40
|
+
export declare function shouldUseProcessSankeyWorker(execution: ProcessSankeyLayoutExecution, nodeCount: number, edgeCount: number, packing?: "off" | "reuse", laneOrder?: string, threshold?: number): boolean;
|
|
41
|
+
export declare function canUseProcessSankeyWorker(): boolean;
|
|
42
|
+
export declare function createProcessSankeyLayoutWorker(): Worker;
|
|
43
|
+
/**
|
|
44
|
+
* Long-lived ProcessSankey layout worker session. Built on
|
|
45
|
+
* {@link ModuleWorkerSession} (shared with force layout).
|
|
46
|
+
*/
|
|
47
|
+
export declare class ProcessSankeyLayoutWorkerSession {
|
|
48
|
+
private readonly session;
|
|
49
|
+
constructor(worker?: Worker);
|
|
50
|
+
get isDead(): boolean;
|
|
51
|
+
request(request: ProcessSankeyWorkerRequest, signal?: AbortSignal): Promise<ProcessSankeyWorkerResponse>;
|
|
52
|
+
terminate(): void;
|
|
53
|
+
}
|
|
54
|
+
/** Test helper: drop the shared session so the next call creates a fresh Worker. */
|
|
55
|
+
export declare function _resetSharedProcessSankeyLayoutSessionForTest(): void;
|
|
56
|
+
export declare function runProcessSankeyLayoutWorker(request: ProcessSankeyWorkerRequest, signal?: AbortSignal): Promise<ProcessSankeyWorkerResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Re-attach host-side raw datums after a worker layout (workers strip them).
|
|
59
|
+
* Rebuilds the time scale on the main thread.
|
|
60
|
+
*/
|
|
61
|
+
export declare function reattachProcessSankeySceneDatums(response: ProcessSankeyWorkerResponse, rawNodeById: ReadonlyMap<string, Datum>, rawEdgeById: ReadonlyMap<string, Datum>): BuildScenesResult;
|
|
62
|
+
/**
|
|
63
|
+
* True when styleRules contain non-serializable predicate/style functions.
|
|
64
|
+
* Those force the main-thread path. Declarative thresholds are worker-safe
|
|
65
|
+
* when author `__raw` datums are cloned onto the wire request.
|
|
66
|
+
*/
|
|
67
|
+
export declare function processSankeyStyleRulesNeedMainThread(styleRules: BuildScenesInput["styleRules"] | undefined): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* True when any ProcessSankey input cannot cross the worker boundary without
|
|
70
|
+
* changing layout/style/validation semantics. Forces the main-thread path.
|
|
71
|
+
*/
|
|
72
|
+
export declare function processSankeyNeedsMainThread(input: Partial<Pick<BuildScenesInput, "styleRules" | "labelPriorityAccessor" | "colorBy" | "valueAccessor" | "edgeOpacity">>): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Datum } from "../../shared/datumTypes";
|
|
3
|
+
import type { ChartAccessor } from "../../shared/types";
|
|
4
|
+
import type { HoverData } from "../../../realtime/types";
|
|
5
|
+
import type { ProcessSankeyLayout } from "./processSankeyTypes";
|
|
6
|
+
import { type TooltipProp } from "../../../Tooltip/Tooltip";
|
|
7
|
+
import { type ProcessSankeyTimeLike } from "./time";
|
|
8
|
+
type TimeLike = ProcessSankeyTimeLike;
|
|
9
|
+
export interface UseProcessSankeyTooltipOptions<_TNode extends Datum, TEdge extends Datum> {
|
|
10
|
+
tooltip: TooltipProp | undefined;
|
|
11
|
+
enableHover: boolean;
|
|
12
|
+
layout: ProcessSankeyLayout | null;
|
|
13
|
+
timeFormat?: (d: number | Date) => string | React.ReactNode;
|
|
14
|
+
valueFormat?: (d: number) => string | React.ReactNode;
|
|
15
|
+
sourceAccessor: ChartAccessor<TEdge, string>;
|
|
16
|
+
targetAccessor: ChartAccessor<TEdge, string>;
|
|
17
|
+
valueAccessor: ChartAccessor<TEdge, number>;
|
|
18
|
+
startTimeAccessor: ChartAccessor<TEdge, TimeLike>;
|
|
19
|
+
endTimeAccessor: ChartAccessor<TEdge, TimeLike>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Default band/ribbon tooltip content for ProcessSankey. Custom `tooltip`
|
|
23
|
+
* fully overrides; false disables.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useProcessSankeyTooltipContent<_TNode extends Datum = Datum, TEdge extends Datum = Datum>(options: UseProcessSankeyTooltipOptions<_TNode, TEdge>): (d: HoverData) => React.ReactNode;
|
|
26
|
+
export {};
|