semiotic 3.8.7 → 3.8.8
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 +2 -2
- package/README.md +56 -46
- package/ai/dist/mcp-server.js +28 -2
- package/ai/schema.json +124 -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-3GCILWPB.module.min.js +2 -0
- package/dist/chunk-chunk-46KRGJQP.module.min.js +1 -0
- package/dist/{chunk-chunk-5SD6BHVW.module.min.js → chunk-chunk-4MLLQUGW.module.min.js} +1 -1
- package/dist/chunk-chunk-57RBPDBQ.module.min.js +2 -0
- package/dist/chunk-chunk-5VVNW5AZ.module.min.js +1 -0
- package/dist/chunk-chunk-66PCWJUG.module.min.js +1 -0
- package/dist/chunk-chunk-7LE56WAE.module.min.js +2 -0
- package/dist/chunk-chunk-7T25U75Z.module.min.js +2 -0
- package/dist/chunk-chunk-AF53TBSN.module.min.js +2 -0
- package/dist/chunk-chunk-BTZYH2IE.module.min.js +1 -0
- package/dist/chunk-chunk-BWV55BZK.module.min.js +2 -0
- package/dist/{chunk-chunk-FRO4TRXK.module.min.js → chunk-chunk-BZNOAHJV.module.min.js} +1 -1
- package/dist/chunk-chunk-CD6PVVS3.module.min.js +2 -0
- package/dist/chunk-chunk-DTSNLGRK.module.min.js +2 -0
- package/dist/{chunk-chunk-BNGBEY7N.module.min.js → chunk-chunk-FC3NZWYR.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-FRGBMTZR.module.min.js +1 -0
- package/dist/chunk-chunk-G75OPF5N.module.min.js +2 -0
- package/dist/{chunk-chunk-NH4MEAKP.module.min.js → chunk-chunk-H5IFO6CU.module.min.js} +1 -1
- package/dist/chunk-chunk-HADHLMY5.module.min.js +1 -0
- package/dist/chunk-chunk-HBFA4NN6.module.min.js +1 -0
- package/dist/chunk-chunk-HCNDE26Q.module.min.js +2 -0
- package/dist/chunk-chunk-JJ4BSUYL.module.min.js +2 -0
- package/dist/chunk-chunk-JRHXQGEV.module.min.js +2 -0
- package/dist/chunk-chunk-L6FFYGYS.module.min.js +1 -0
- package/dist/{chunk-chunk-Z2AJERX5.module.min.js → chunk-chunk-LJDH3WV3.module.min.js} +1 -1
- package/dist/chunk-chunk-LSJUXBMF.module.min.js +1 -0
- package/dist/chunk-chunk-N3Q33XCB.module.min.js +2 -0
- package/dist/chunk-chunk-NWIGA3UK.module.min.js +1 -0
- package/dist/chunk-chunk-OG3TTJGJ.module.min.js +2 -0
- 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-QQJNG23C.module.min.js +2 -0
- package/dist/{chunk-chunk-LG7YKJAK.module.min.js → chunk-chunk-RGJ6TKAH.module.min.js} +1 -1
- package/dist/{chunk-chunk-JWXLNZSM.module.min.js → chunk-chunk-SFLUSZ73.module.min.js} +1 -1
- package/dist/chunk-chunk-TCMHJWFJ.module.min.js +1 -0
- package/dist/{chunk-chunk-LVHDZAT3.module.min.js → chunk-chunk-UEZ6SHW5.module.min.js} +1 -1
- package/dist/chunk-chunk-VUWYT7DY.module.min.js +2 -0
- package/dist/{chunk-chunk-OI7R7EJB.module.min.js → chunk-chunk-W5HWGQMD.module.min.js} +1 -1
- package/dist/chunk-chunk-WFHZHWT7.module.min.js +1 -0
- package/dist/chunk-chunk-WGROBM3I.module.min.js +2 -0
- package/dist/{chunk-chunk-GU2EJIDJ.module.min.js → chunk-chunk-WSDJFBKX.module.min.js} +1 -1
- package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +2 -0
- 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/shared/chartFamilySets.d.ts +1 -0
- package/dist/components/charts/shared/formatUtils.d.ts +12 -1
- 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/styleRules.d.ts +5 -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.d.ts +2 -0
- package/dist/components/server/staticSVGChrome.d.ts +2 -1
- package/dist/components/store/createStore.d.ts +2 -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/frameKeyboardNavigation.d.ts +3 -2
- 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/networkTypes.d.ts +2 -0
- package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +2 -1
- package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
- 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 +2 -0
- package/dist/components/stream/useCanvasFrameHost.d.ts +6 -0
- package/dist/components/stream/useSemanticFrameInteractions.d.ts +12 -3
- package/dist/components/stream/xyFrameAxisTypes.d.ts +4 -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.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 +2 -0
- 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-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,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic one-dimensional layout primitives shared by ordered bands,
|
|
3
|
+
* lanes, and layered graphs. The helpers are deliberately geometry-agnostic:
|
|
4
|
+
* callers provide relations, silhouettes, and cost functions while the kit
|
|
5
|
+
* owns the guarded search and separation invariants.
|
|
6
|
+
*/
|
|
7
|
+
export interface MinGapPlacementOptions {
|
|
8
|
+
/** Preferred coordinate for each item, in order. */
|
|
9
|
+
desired: readonly number[];
|
|
10
|
+
/** Minimum distance between item i and i + 1. */
|
|
11
|
+
minGaps: readonly number[];
|
|
12
|
+
/** Optional least-squares weight per desired coordinate. */
|
|
13
|
+
weights?: readonly number[];
|
|
14
|
+
/** Optional lower bound for the first coordinate. */
|
|
15
|
+
min?: number;
|
|
16
|
+
/** Optional upper bound for the last coordinate. */
|
|
17
|
+
max?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Least-squares placement with fixed order and per-pair minimum gaps.
|
|
21
|
+
*
|
|
22
|
+
* The gap constraints are removed with cumulative offsets, then weighted
|
|
23
|
+
* isotonic regression (pool-adjacent-violators) solves the remaining
|
|
24
|
+
* non-decreasing placement. Bounds apply to the whole ordered sequence.
|
|
25
|
+
*/
|
|
26
|
+
export declare function placeWithMinGap(options: MinGapPlacementOptions): number[];
|
|
27
|
+
export interface SilhouetteSample {
|
|
28
|
+
/** Position along the independent axis (time, layer, or another index). */
|
|
29
|
+
at: number;
|
|
30
|
+
/** Extent before the band's centerline (top for a vertical lane). */
|
|
31
|
+
before: number;
|
|
32
|
+
/** Extent after the band's centerline (bottom for a vertical lane). */
|
|
33
|
+
after: number;
|
|
34
|
+
}
|
|
35
|
+
export interface PackedBands {
|
|
36
|
+
/** Minimum silhouette clearance between each adjacent pair. */
|
|
37
|
+
adjacentClearance: number[];
|
|
38
|
+
/** Center coordinates starting at zero, including `gap`. */
|
|
39
|
+
positions: number[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Pack ordered bands using their sampled silhouettes. Adjacent clearance is
|
|
43
|
+
* the worst simultaneous `lower.after + upper.before` extent, so peaks that
|
|
44
|
+
* occur at different positions can nest without overlap.
|
|
45
|
+
*/
|
|
46
|
+
export declare function packBandsBySilhouette(bands: readonly (readonly SilhouetteSample[])[], gap?: number): PackedBands;
|
|
47
|
+
export interface WeightedOrderRelation<T> {
|
|
48
|
+
source: T;
|
|
49
|
+
target: T;
|
|
50
|
+
weight?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface GuardedOrderOptions<T> {
|
|
53
|
+
passes?: number;
|
|
54
|
+
/** Stable, locale-independent tie-break supplied by the caller. */
|
|
55
|
+
compare?: (a: T, b: T) => number;
|
|
56
|
+
/** Hard cap on evaluated candidates; deterministic unlike a wall-clock cap. */
|
|
57
|
+
maxEvaluations?: number;
|
|
58
|
+
}
|
|
59
|
+
/** Guarded weighted-barycenter sweeps that retain the best observed order. */
|
|
60
|
+
export declare function orderByBarycenter<T>(input: readonly T[], relations: readonly WeightedOrderRelation<T>[], cost: (order: readonly T[]) => number, options?: GuardedOrderOptions<T>): T[];
|
|
61
|
+
/** Guarded adjacent-transpose refinement under a caller-provided cost. */
|
|
62
|
+
export declare function refineByAdjacentSwaps<T>(input: readonly T[], cost: (order: readonly T[]) => number, options?: GuardedOrderOptions<T>): T[];
|
|
63
|
+
/** Exhaustive Heap-permutation ordering for small item sets. */
|
|
64
|
+
export declare function orderExactSmall<T>(input: readonly T[], cost: (order: readonly T[]) => number, options?: Pick<GuardedOrderOptions<T>, "maxEvaluations"> & {
|
|
65
|
+
maxItems?: number;
|
|
66
|
+
}): T[];
|
|
67
|
+
/** Count endpoint-order inversions, optionally filtering candidate pairs. */
|
|
68
|
+
export declare function countPairwiseCrossings<T>(items: readonly T[], endpoints: (item: T) => readonly [number, number], comparePair?: (a: T, b: T) => boolean): number;
|
|
@@ -38,8 +38,8 @@ export type { CirclePackProps } from "./charts/network/CirclePack";
|
|
|
38
38
|
export type { OrbitDiagramProps } from "./charts/network/OrbitDiagram";
|
|
39
39
|
export type { NetworkCustomChartProps } from "./charts/custom/NetworkCustomChart";
|
|
40
40
|
export type { NetworkCustomLayout, NetworkLayoutContext, NetworkLayoutResult, NetworkHtmlMark, } from "./stream/networkCustomLayout";
|
|
41
|
-
export { validateProcessSankey, formatProcessSankeyIssue, } from "./charts/network/processSankey/algorithm";
|
|
42
|
-
export type { ProcessSankeyNode as ProcessSankeyValidatorNode, ProcessSankeyEdge as ProcessSankeyValidatorEdge, ProcessSankeyIssue, } from "./charts/network/processSankey/algorithm";
|
|
41
|
+
export { validateProcessSankey, formatProcessSankeyIssue, diagnoseProcessSankeyLayout, diagnoseProcessSankeyProps, explainProcessSankeyLayout, inventoryAtTime, toProcessSankeyTime, } from "./charts/network/processSankey/algorithm";
|
|
42
|
+
export type { ProcessSankeyNode as ProcessSankeyValidatorNode, ProcessSankeyEdge as ProcessSankeyValidatorEdge, ProcessSankeyIssue, InventoryEdge, InventoryAtTimeOptions, ProcessSankeyTimeLike, } from "./charts/network/processSankey/algorithm";
|
|
43
43
|
export { resolveStyleRules, matchesThreshold, ruleMatches, makeRuleValueResolver, makeNodeRuleContext, composeStyleRules } from "./charts/shared/styleRules";
|
|
44
44
|
export type { StyleRule, StyleRuleStyle, StyleRuleThreshold, StyleRuleContext, StyleRulePredicate } from "./charts/shared/styleRules";
|
|
45
45
|
export { isHatchFill, hatchPatternDef, resolveSvgFill, hatchFillId } from "./charts/shared/hatchFill";
|
|
@@ -59,6 +59,8 @@ export type { GeoAreaHitTargetProps, HitTargetPointProps, HitTargetRectProps, Ne
|
|
|
59
59
|
export { runs, runLengthEncode } from "./recipes/runs";
|
|
60
60
|
export type { Run, RunOptions } from "./recipes/runs";
|
|
61
61
|
export { wrapValue, shortestArcDelta, cyclicRangeContains, selectCyclicRange } from "./recipes/cyclical";
|
|
62
|
+
export { placeWithMinGap, packBandsBySilhouette, orderByBarycenter, refineByAdjacentSwaps, orderExactSmall, countPairwiseCrossings, } from "./recipes/layout1d";
|
|
63
|
+
export type { MinGapPlacementOptions, SilhouetteSample, PackedBands, WeightedOrderRelation, GuardedOrderOptions, } from "./recipes/layout1d";
|
|
62
64
|
export { packIntervals, activeCountOverDomain } from "./recipes/intervals";
|
|
63
65
|
export type { PackedInterval, PackIntervalsResult, PackIntervalsOptions, ActiveCount, ActiveCountOptions, } from "./recipes/intervals";
|
|
64
66
|
export { layoutSequence, layoutChipStrip, estimateLabelWidth, packSpanLevels, scaleArcBand, spanArcPath, spanArcPeakY, partitionSharedEdges, } from "./recipes/sequenceLayout";
|
|
@@ -47,6 +47,8 @@ export { useSelection, useSelectionActions, useLinkedHover, useBrushSelection, u
|
|
|
47
47
|
export { useCustomLayoutSelection } from "./stream/customLayoutSelection";
|
|
48
48
|
export { useForceLayout } from "./charts/network/useForceLayout";
|
|
49
49
|
export type { ForceLayoutStatus, UseForceLayoutResult } from "./charts/network/useForceLayout";
|
|
50
|
+
export { inventoryAtTime, toProcessSankeyTime, validateProcessSankey, formatProcessSankeyIssue, diagnoseProcessSankeyLayout, diagnoseProcessSankeyProps, explainProcessSankeyLayout, } from "./charts/network/processSankey/algorithm";
|
|
51
|
+
export type { InventoryEdge, InventoryAtTimeOptions, ProcessSankeyTimeLike, ProcessSankeyIssue, } from "./charts/network/processSankey/algorithm";
|
|
50
52
|
export type { CustomLayoutSelection } from "./stream/customLayoutSelection";
|
|
51
53
|
export type { CustomLayoutFailureDiagnostic, CustomLayoutFailureRecovery, CustomLayoutFamily } from "./stream/customLayoutFailure";
|
|
52
54
|
export type { UseSelectionOptions, UseSelectionResult, UseSelectionActionsResult, UseLinkedHoverOptions, UseLinkedHoverResult, UseBrushSelectionOptions, UseBrushSelectionResult } from "./LinkedCharts";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
2
|
import type { LegendLayout } from "../types/legendTypes";
|
|
3
3
|
import type { StreamXYFrameProps, StreamScales, StreamLayout } from "../stream/types";
|
|
4
|
+
import type { XYFrameAxisConfig } from "../stream/xyFrameAxisTypes";
|
|
4
5
|
import type { StreamNetworkFrameProps, RealtimeEdge } from "../stream/networkTypes";
|
|
5
6
|
import type { StreamOrdinalFrameProps } from "../stream/ordinalTypes";
|
|
6
7
|
import type { StreamGeoFrameProps } from "../stream/geoTypes";
|
|
@@ -148,7 +149,7 @@ export declare function renderFrameLegend(options: {
|
|
|
148
149
|
}): React.ReactNode;
|
|
149
150
|
export declare function defaultTickFormat(v: number): string;
|
|
150
151
|
/** Render grid lines for XY charts */
|
|
151
|
-
export declare function renderGridSVG(scales: StreamScales, layout: StreamLayout, theme: SemioticTheme, idPrefix?: string, axisExtent?: AxisExtentMode): React.ReactNode;
|
|
152
|
+
export declare function renderGridSVG(scales: StreamScales, layout: StreamLayout, theme: SemioticTheme, idPrefix?: string, axisExtent?: AxisExtentMode, axes?: XYFrameAxisConfig[]): React.ReactNode;
|
|
152
153
|
/** Render grid lines for ordinal charts */
|
|
153
154
|
export declare function renderOrdinalGridSVG(store: OrdinalPipelineStore, layout: {
|
|
154
155
|
width: number;
|
|
@@ -4,3 +4,5 @@ export interface StoreProviderProps<T> {
|
|
|
4
4
|
initialState?: Partial<T>;
|
|
5
5
|
}
|
|
6
6
|
export declare function createStore<T>(fn: (set: (updater: (current: T) => Partial<T>) => void) => T): [React.FC<StoreProviderProps<T>>, <R>(selector: (state: T) => R, equalityFn?: (a: R, b: R) => boolean) => R];
|
|
7
|
+
/** True if `value` has at least one of its own enumerable keys. */
|
|
8
|
+
export declare function hasOwnEnumerableKey(value: object): boolean;
|
|
@@ -166,6 +166,9 @@ export declare class OrdinalPipelineStore implements UpdateResultStore {
|
|
|
166
166
|
* for the full rationale — Stream Frames call this when they detect
|
|
167
167
|
* SSR hydration so the canvas takeover doesn't re-animate from blank
|
|
168
168
|
* after the server already painted the chart.
|
|
169
|
+
*
|
|
170
|
+
* Snaps point/rect/wedge geometry + opacity targets so a mid-intro
|
|
171
|
+
* cancel cannot leave marks at partial lerp opacity.
|
|
169
172
|
*/
|
|
170
173
|
cancelIntroAnimation(): void;
|
|
171
174
|
/**
|
|
@@ -216,6 +216,11 @@ export declare class PipelineStore implements UpdateResultStore {
|
|
|
216
216
|
* sets it to 0. Without the clear, line / area charts would paint
|
|
217
217
|
* blank on the first canvas frame after hydration.
|
|
218
218
|
*
|
|
219
|
+
* Fill-based marks (point/glyph/rect/heatcell/candlestick) also snap
|
|
220
|
+
* geometry + opacity targets so a mid-intro cancel cannot leave
|
|
221
|
+
* `style.opacity` stuck at a partial lerp value (visible as faded
|
|
222
|
+
* circles after tab-away / SSR swap).
|
|
223
|
+
*
|
|
219
224
|
* Idempotent — a second call is a no-op since the maps are already
|
|
220
225
|
* empty and the per-node flags are already undefined.
|
|
221
226
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
1
2
|
/**
|
|
2
3
|
* Compare two accessor specs for equivalence, using **identity** semantics.
|
|
3
4
|
* - String accessors: compared by value (`"value" === "value"`).
|
|
@@ -29,3 +30,23 @@ export type CoercibleNumber = number | Date | string;
|
|
|
29
30
|
export declare function resolveAccessor<T extends Record<string, unknown>>(accessor: string | ((d: T) => CoercibleNumber) | undefined, fallback: string): (d: T) => number;
|
|
30
31
|
export declare function resolveRawAccessor<T extends Record<string, unknown>, TResult>(accessor: string | ((d: T) => TResult) | undefined, fallback: string): (d: T) => TResult;
|
|
31
32
|
export declare function resolveStringAccessor<T extends Record<string, unknown>>(accessor: string | ((d: T) => string) | undefined, fallback?: string): ((d: T) => string) | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve a `nodeLabel` accessor (string key or function) into a label
|
|
35
|
+
* function, or `null` when unset — the network layout plugins' shared
|
|
36
|
+
* convention for "no label configured" (as opposed to `resolveStringAccessor`'s
|
|
37
|
+
* `undefined`). A string accessor falls back to `d.id` when the field is
|
|
38
|
+
* missing/empty. Shared by the chord/force/sankey layout plugins; hierarchy
|
|
39
|
+
* layouts use their own `resolveLabelFn` in `layouts/hierarchyUtils.ts`
|
|
40
|
+
* instead, since a hierarchy scene node nests the original datum under
|
|
41
|
+
* `.data` and must unwrap it before calling a user accessor.
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolveLabelFn(nodeLabel: string | ((d: Datum) => string) | undefined): ((d: Datum) => string) | null;
|
|
44
|
+
/**
|
|
45
|
+
* Resolve a d3-force-style edge endpoint (`source`/`target`) to its node id.
|
|
46
|
+
* Before a force/sankey/chord simulation resolves string ids into node
|
|
47
|
+
* object references, an edge endpoint is `string | { id: string }`; this
|
|
48
|
+
* reads the id either way. Shared by the chord/force/sankey layout plugins.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveNodeRefId(ref: string | {
|
|
51
|
+
id: string;
|
|
52
|
+
}): string;
|
|
@@ -18,8 +18,9 @@ interface KeyboardInteractionParams<Store, Node = unknown> {
|
|
|
18
18
|
hoverRef: RefValue<HoverData | null>;
|
|
19
19
|
hoveredNodeRef?: RefValue<Node | null>;
|
|
20
20
|
setHoverPoint: SetHoverPoint;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/** Optional — absent when neither a user callback nor onObservation is wired. */
|
|
22
|
+
customHoverBehavior?: SemanticHoverBehavior<HoverData>;
|
|
23
|
+
customClickBehavior?: SemanticClickBehavior<HoverData>;
|
|
23
24
|
scheduleRender: () => void;
|
|
24
25
|
}
|
|
25
26
|
export declare function useXYKeyboardNavigation(params: KeyboardInteractionParams<PipelineStore, SceneNode>): {
|
|
@@ -34,20 +34,15 @@ export declare function createFrameForceWorkerRequest(nodes: RealtimeNode[], edg
|
|
|
34
34
|
y: number;
|
|
35
35
|
}> | null): FrameForceWorkerRequest;
|
|
36
36
|
/**
|
|
37
|
-
* Long-lived force-layout worker session.
|
|
38
|
-
*
|
|
39
|
-
* paid once per page, not once per graph re-layout.
|
|
37
|
+
* Long-lived force-layout worker session. Built on {@link ModuleWorkerSession}
|
|
38
|
+
* so request-id / abort / terminate plumbing is shared with ProcessSankey.
|
|
40
39
|
*/
|
|
41
40
|
export declare class ForceLayoutWorkerSession {
|
|
42
|
-
private
|
|
43
|
-
private pending;
|
|
44
|
-
private worker;
|
|
45
|
-
private dead;
|
|
41
|
+
private readonly session;
|
|
46
42
|
constructor(worker?: Worker);
|
|
47
43
|
get isDead(): boolean;
|
|
48
44
|
request(request: ForceWorkerRequest, signal?: AbortSignal): Promise<ForceWorkerResponse>;
|
|
49
45
|
terminate(): void;
|
|
50
|
-
private rejectAll;
|
|
51
46
|
}
|
|
52
47
|
/** Test helper: drop the shared session so the next call creates a fresh Worker. */
|
|
53
48
|
export declare function _resetSharedForceLayoutSessionForTest(): void;
|
|
@@ -7,6 +7,6 @@ import { orbitLayoutPlugin } from "./orbitLayoutPlugin";
|
|
|
7
7
|
/**
|
|
8
8
|
* Registry mapping network chart types to their layout plugins.
|
|
9
9
|
*/
|
|
10
|
-
export declare const networkLayoutRegistry: Record<
|
|
10
|
+
export declare const networkLayoutRegistry: Record<NetworkChartType, NetworkLayoutPlugin>;
|
|
11
11
|
export declare function getLayoutPlugin(chartType: NetworkChartType): NetworkLayoutPlugin | undefined;
|
|
12
12
|
export { sankeyLayoutPlugin, forceLayoutPlugin, chordLayoutPlugin, hierarchyLayoutPlugin, orbitLayoutPlugin };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared long-lived module-worker session for layout offload (force, ProcessSankey).
|
|
3
|
+
*
|
|
4
|
+
* One Worker is reused across requests so module parse + startup is paid once
|
|
5
|
+
* per page. Callers supply wire parse / createWorker; this owns request ids,
|
|
6
|
+
* abort wiring, and terminate/reject-all lifecycle.
|
|
7
|
+
*/
|
|
8
|
+
export interface ModuleWorkerErrorPayload {
|
|
9
|
+
message: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
stack?: string;
|
|
12
|
+
}
|
|
13
|
+
export type ParsedModuleWorkerMessage<TResponse> = {
|
|
14
|
+
requestId?: number;
|
|
15
|
+
ok: true;
|
|
16
|
+
payload: TResponse;
|
|
17
|
+
} | {
|
|
18
|
+
requestId?: number;
|
|
19
|
+
ok: false;
|
|
20
|
+
error: Error;
|
|
21
|
+
};
|
|
22
|
+
export interface ModuleWorkerSessionOptions<TRequest, TResponse> {
|
|
23
|
+
/** Human-readable worker name (AbortError / terminate messages). */
|
|
24
|
+
name: string;
|
|
25
|
+
createWorker: () => Worker;
|
|
26
|
+
/**
|
|
27
|
+
* Map an `onmessage` payload into a success/error result.
|
|
28
|
+
* `requestId` may be omitted for one-shot workers (oldest pending wins).
|
|
29
|
+
*/
|
|
30
|
+
parseMessage: (data: unknown) => ParsedModuleWorkerMessage<TResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Wrap a domain request for `postMessage`. Default: `{ requestId, request }`.
|
|
33
|
+
*/
|
|
34
|
+
encodeRequest?: (requestId: number, request: TRequest) => unknown;
|
|
35
|
+
}
|
|
36
|
+
declare function errorFromPayload(payload: ModuleWorkerErrorPayload): Error;
|
|
37
|
+
/**
|
|
38
|
+
* Build a standard `{ requestId?, ok, error|payload }` parser for wire
|
|
39
|
+
* responses that carry an optional `error` object and free-form success fields.
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseModuleWorkerErrorField(data: unknown): {
|
|
42
|
+
requestId?: number;
|
|
43
|
+
error?: ModuleWorkerErrorPayload;
|
|
44
|
+
};
|
|
45
|
+
export { errorFromPayload as moduleWorkerErrorFromPayload };
|
|
46
|
+
export declare class ModuleWorkerSession<TRequest, TResponse> {
|
|
47
|
+
private nextRequestId;
|
|
48
|
+
private pending;
|
|
49
|
+
private worker;
|
|
50
|
+
private dead;
|
|
51
|
+
private readonly options;
|
|
52
|
+
constructor(options: ModuleWorkerSessionOptions<TRequest, TResponse>);
|
|
53
|
+
get isDead(): boolean;
|
|
54
|
+
request(request: TRequest, signal?: AbortSignal): Promise<TResponse>;
|
|
55
|
+
terminate(): void;
|
|
56
|
+
private rejectAll;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Lazy singleton holder for a session class that exposes `isDead` + `terminate`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function createSharedWorkerSessionHolder<TSession extends {
|
|
62
|
+
isDead: boolean;
|
|
63
|
+
terminate(): void;
|
|
64
|
+
}>(create: () => TSession): {
|
|
65
|
+
get: () => TSession;
|
|
66
|
+
resetForTest: () => void;
|
|
67
|
+
};
|
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
* chartType → pure scene builder dispatch for OrdinalPipelineStore.
|
|
3
3
|
*/
|
|
4
4
|
import type { SceneBuilderFn } from "./types";
|
|
5
|
-
|
|
5
|
+
import type { OrdinalChartType } from "../ordinalTypes";
|
|
6
|
+
export declare const ORDINAL_SCENE_BUILDERS: Partial<Record<OrdinalChartType, SceneBuilderFn>>;
|
|
@@ -153,6 +153,15 @@ export interface PhysicsKernelSnapshot {
|
|
|
153
153
|
springs: PhysicsKernelSnapshotSpring[];
|
|
154
154
|
activeSensors: string[];
|
|
155
155
|
}
|
|
156
|
+
/** Read a dot-separated property path off an arbitrary value. Shared across physics controllers. */
|
|
157
|
+
export declare function valueAtPath(source: unknown, path: string): unknown;
|
|
158
|
+
/**
|
|
159
|
+
* Test whether a body matches a `PhysicsColliderBodyFilter` — a predicate
|
|
160
|
+
* function or a declarative equals/notEquals/oneOf/notOneOf spec. Shared by
|
|
161
|
+
* collider/sensor permeability here and by the capacity-queue and
|
|
162
|
+
* service-operations controllers' own `bodyFilter` options.
|
|
163
|
+
*/
|
|
164
|
+
export declare function matchesPhysicsBodyFilter(body: PhysicsBodyState, filter: PhysicsColliderBodyFilter | undefined): boolean;
|
|
156
165
|
export declare class PhysicsKernelWorld {
|
|
157
166
|
readonly capabilities: {
|
|
158
167
|
determinism: "strict";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OrdinalSceneNode } from "./ordinalTypes";
|
|
2
|
+
import type { SceneNode } from "./types";
|
|
3
|
+
/** Restore XY marks to their authored target state after an intro is cancelled. */
|
|
4
|
+
export declare function snapXYIntroTargets(scene: SceneNode[]): void;
|
|
5
|
+
/** Restore ordinal marks to their authored target state after an intro is cancelled. */
|
|
6
|
+
export declare function snapOrdinalIntroTargets(scene: OrdinalSceneNode[]): void;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Dependencies: pipelineTransitionUtils (lerp, easing, ActiveTransition)
|
|
11
11
|
* Consumed by: PipelineStore.computeScene (after decay/pulse)
|
|
12
12
|
*/
|
|
13
|
-
import type { SceneNode, TransitionConfig } from "./types";
|
|
13
|
+
import type { SceneNode, TransitionConfig, Style } from "./types";
|
|
14
14
|
import type { GlyphDef } from "./glyphDef";
|
|
15
15
|
import type { ActiveTransition } from "./pipelineTransitionUtils";
|
|
16
16
|
import type { Datum } from "../charts/shared/datumTypes";
|
|
@@ -51,6 +51,20 @@ export interface TransitionContext {
|
|
|
51
51
|
* `_transitionKey` keeps exits stable across overlapping transitions.
|
|
52
52
|
*/
|
|
53
53
|
export declare function getNodeIdentity(ctx: TransitionContext, node: SceneNode, index: number): string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Effective paint alpha for fill-based marks.
|
|
56
|
+
*
|
|
57
|
+
* Matches the canvas renderer convention (`style.opacity ?? style.fillOpacity ?? 1`)
|
|
58
|
+
* used by points, glyphs, rects, heatcells, and candlesticks. Intro/update
|
|
59
|
+
* transitions must target this same value — otherwise a mark authored with
|
|
60
|
+
* only `fillOpacity: 0.7` animates toward 1, bakes `style.opacity = 1` on
|
|
61
|
+
* completion, and then "fades" back to 0.7 on the next dirty rebuild
|
|
62
|
+
* (e.g. tab-away → tab-back via FrameRuntime visibility resume).
|
|
63
|
+
*
|
|
64
|
+
* Line/area marks keep stroke alpha on `style.opacity` alone; their under-
|
|
65
|
+
* path fill uses `fillOpacity` independently and is not covered here.
|
|
66
|
+
*/
|
|
67
|
+
export declare function resolveMarkOpacity(style?: Style | null): number;
|
|
54
68
|
/**
|
|
55
69
|
* Snapshot current scene node positions before rebuild.
|
|
56
70
|
*/
|
|
@@ -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
|
/**
|
|
@@ -35,6 +35,12 @@ export interface UseCanvasFrameHostInput<TStore extends object> {
|
|
|
35
35
|
* mount-time invalidation while retaining dependency-change invalidation.
|
|
36
36
|
*/
|
|
37
37
|
skipInitialCanvasPaintInvalidation?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Optional repaint-only invalidator for families that synchronously rebuild
|
|
40
|
+
* retained scene geometry elsewhere. When omitted, dependency changes use
|
|
41
|
+
* the conservative `dirtyRef` full-rebuild path.
|
|
42
|
+
*/
|
|
43
|
+
canvasPaintInvalidator?: () => void;
|
|
38
44
|
/**
|
|
39
45
|
* Values that require a data-canvas repaint. Keep this list family-owned:
|
|
40
46
|
* it expresses paint semantics without teaching the host chart props or
|
|
@@ -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 {};
|
|
@@ -32,6 +32,10 @@ export interface XYFrameAxisConfig {
|
|
|
32
32
|
* custom strokeDasharray string. Applied to grid lines extending
|
|
33
33
|
* from ticks across the chart area. */
|
|
34
34
|
gridStyle?: "dashed" | "dotted" | string;
|
|
35
|
+
/** Set false to suppress grid lines emitted from this axis while retaining
|
|
36
|
+
* its ticks and baseline. For example, set the bottom axis to `false` for
|
|
37
|
+
* horizontal-only (y-axis) grid lines. */
|
|
38
|
+
grid?: boolean;
|
|
35
39
|
/** Always include the domain max as a tick, even if d3 omits it. */
|
|
36
40
|
includeMax?: boolean;
|
|
37
41
|
/** 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}})}};
|