semiotic 3.7.5 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +54 -12
- package/README.md +121 -27
- package/agent-skill/semiotic-charts/SKILL.md +146 -0
- package/ai/cli.js +133 -45
- package/ai/componentMetadata.cjs +6 -1
- package/ai/dist/mcp-server.js +1651 -154
- package/ai/examples.md +174 -0
- package/ai/schema.json +2733 -536
- package/ai/surface-manifest.json +200 -0
- package/ai/system-prompt.md +18 -3
- package/dist/components/CategoryColors.d.ts +1 -1
- package/dist/components/ChartContainer.d.ts +91 -0
- package/dist/components/ChartGrid.d.ts +11 -1
- package/dist/components/CircularBrush.d.ts +61 -0
- package/dist/components/ContextLayout.d.ts +5 -1
- package/dist/components/DirectManipulationControl.d.ts +63 -0
- package/dist/components/LinkedCharts.d.ts +3 -1
- package/dist/components/MobileAnnotationCalloutList.d.ts +13 -0
- package/dist/components/MobileChartContainer.d.ts +51 -0
- package/dist/components/MobileStandardControls.d.ts +68 -0
- package/dist/components/SmallMultipleChart.d.ts +84 -0
- package/dist/components/Tooltip/FlippingTooltip.d.ts +21 -0
- package/dist/components/ai/ChartRecipe.d.ts +16 -0
- package/dist/components/ai/IntentMark.d.ts +15 -0
- package/dist/components/ai/chartCapabilities.d.ts +8 -1
- package/dist/components/ai/chartCapabilityTypes.d.ts +26 -1
- package/dist/components/ai/chartClinic.d.ts +91 -0
- package/dist/components/ai/chartRecipeRegistry.d.ts +14 -0
- package/dist/components/ai/chartRecipes.d.ts +278 -0
- package/dist/components/ai/dataPitfallsBridge.d.ts +102 -0
- package/dist/components/ai/describeChart.d.ts +7 -0
- package/dist/components/ai/describeRecipeChart.d.ts +16 -0
- package/dist/components/ai/generativeChart.d.ts +28 -3
- package/dist/components/ai/intentManifest.d.ts +62 -0
- package/dist/components/ai/navigationTree.d.ts +3 -0
- package/dist/components/ai/observedSceneAudit.d.ts +72 -0
- package/dist/components/ai/readerGrounding.d.ts +83 -0
- package/dist/components/ai/recipeCapability.d.ts +8 -0
- package/dist/components/ai/recipeNavigation.d.ts +13 -0
- package/dist/components/ai/recipeSemantics.d.ts +11 -0
- package/dist/components/ai/repairChartConfig.d.ts +9 -0
- package/dist/components/ai/suggestCharts.d.ts +11 -1
- package/dist/components/charts/custom/GeoCustomChart.d.ts +48 -0
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +8 -2
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +8 -2
- package/dist/components/charts/custom/XYCustomChart.d.ts +11 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
- package/dist/components/charts/geo/FlowMap.d.ts +1 -1
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +1 -1
- package/dist/components/charts/geo/index.d.ts +2 -0
- package/dist/components/charts/index.d.ts +29 -1
- package/dist/components/charts/network/ChordDiagram.d.ts +1 -1
- package/dist/components/charts/network/CirclePack.d.ts +1 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +15 -5
- package/dist/components/charts/network/OrbitDiagram.d.ts +1 -1
- package/dist/components/charts/network/ProcessSankey.d.ts +1 -1
- package/dist/components/charts/network/SankeyDiagram.d.ts +1 -1
- package/dist/components/charts/network/TreeDiagram.d.ts +1 -1
- package/dist/components/charts/network/Treemap.d.ts +1 -1
- package/dist/components/charts/network/useForceLayout.d.ts +17 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
- package/dist/components/charts/ordinal/DotPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/FunnelChart.d.ts +1 -1
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/Histogram.d.ts +1 -1
- package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -1
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +1 -1
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -1
- package/dist/components/charts/physics/ChainReactionChart.d.ts +9 -0
- package/dist/components/charts/physics/CollisionSwarmChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +47 -0
- package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/EventDropChart.d.ts +53 -0
- package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +66 -0
- package/dist/components/charts/physics/GauntletChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GauntletChart.d.ts +73 -0
- package/dist/components/charts/physics/PhysicalFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicalFlowChart.d.ts +63 -0
- package/dist/components/charts/physics/PhysicsCustomChart.d.ts +120 -0
- package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicsPileChart.d.ts +53 -0
- package/dist/components/charts/physics/ProcessFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +96 -0
- package/dist/components/charts/physics/chainReactionOverlay.d.ts +22 -0
- package/dist/components/charts/physics/chainReactionRuntime.d.ts +37 -0
- package/dist/components/charts/physics/chainReactionTypes.d.ts +97 -0
- package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +27 -0
- package/dist/components/charts/physics/dependencyMachine.d.ts +188 -0
- package/dist/components/charts/physics/eventDropPhysics.d.ts +64 -0
- package/dist/components/charts/physics/galtonBoardPhysics.d.ts +28 -0
- package/dist/components/charts/physics/gauntletChartProps.d.ts +67 -0
- package/dist/components/charts/physics/gauntletChrome.d.ts +33 -0
- package/dist/components/charts/physics/gauntletController.d.ts +73 -0
- package/dist/components/charts/physics/gauntletEffects.d.ts +36 -0
- package/dist/components/charts/physics/gauntletPhysics.d.ts +71 -0
- package/dist/components/charts/physics/gauntletRuntime.d.ts +42 -0
- package/dist/components/charts/physics/gauntletTypes.d.ts +213 -0
- package/dist/components/charts/physics/physicalFlowPhysics.d.ts +57 -0
- package/dist/components/charts/physics/physicsChartShared.d.ts +41 -0
- package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
- package/dist/components/charts/physics/physicsEncoding.d.ts +142 -0
- package/dist/components/charts/physics/physicsHocHandle.d.ts +53 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +128 -0
- package/dist/components/charts/physics/physicsPilePhysics.d.ts +41 -0
- package/dist/components/charts/physics/physicsProcessPrimitives.d.ts +38 -0
- package/dist/components/charts/physics/processFlowPhysics.d.ts +97 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +16 -2
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -1
- package/dist/components/charts/shared/auditMobileVisualization.d.ts +91 -0
- package/dist/components/charts/shared/chartDefinitionPilot.d.ts +145 -0
- package/dist/components/charts/shared/chartFamilySets.d.ts +20 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +165 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +8 -127
- package/dist/components/charts/shared/chartSpecsGeo.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsNetwork.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsOrdinal.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsPhysics.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsRealtime.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsValue.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsXY.d.ts +2 -0
- package/dist/components/charts/shared/colorContrast.d.ts +3 -0
- package/dist/components/charts/shared/colorUtils.d.ts +16 -1
- package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +4 -0
- package/dist/components/charts/shared/diagnoseConfig.d.ts +9 -14
- package/dist/components/charts/shared/diagnoseMisleadingChecks.d.ts +9 -0
- package/dist/components/charts/shared/diagnosePhysicsChecks.d.ts +3 -0
- package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
- package/dist/components/charts/shared/hooks.d.ts +28 -5
- package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
- package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +12 -2
- package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
- package/dist/components/charts/shared/types.d.ts +49 -1
- package/dist/components/charts/shared/useChartSetup.d.ts +9 -2
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +14 -5
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
- package/dist/components/charts/shared/validationMap.d.ts +0 -11
- package/dist/components/charts/xy/AreaChart.d.ts +1 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
- package/dist/components/charts/xy/LineChart.d.ts +1 -1
- package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +2 -2
- package/dist/components/charts/xy/QuadrantChart.d.ts +1 -1
- package/dist/components/charts/xy/Scatterplot.d.ts +1 -1
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
- package/dist/components/charts/xy/StackedAreaChart.d.ts +9 -4
- package/dist/components/controls/controlAudit.d.ts +24 -0
- package/dist/components/controls/controlContract.d.ts +57 -0
- package/dist/components/data/fromFlintChart.d.ts +74 -0
- package/dist/components/data/fromVegaLite.d.ts +27 -0
- package/dist/components/data/portability/index.d.ts +6 -3
- package/dist/components/data/portability/result.d.ts +52 -0
- package/dist/components/data/portability/spec.d.ts +31 -0
- package/dist/components/data/portability/vegaLite.d.ts +24 -6
- package/dist/components/export/chartConfig.d.ts +11 -0
- package/dist/components/realtime/types.d.ts +11 -0
- package/dist/components/recipes/annotationLayout.d.ts +29 -0
- package/dist/components/recipes/axisFixedForce.d.ts +119 -0
- package/dist/components/recipes/{gofishBoba.d.ts → boba.d.ts} +2 -2
- package/dist/components/recipes/cyclical.d.ts +39 -0
- package/dist/components/recipes/edgeRouter.d.ts +103 -0
- package/dist/components/recipes/forceLayout.d.ts +48 -0
- package/dist/components/recipes/forceLayoutAsync.d.ts +17 -0
- package/dist/components/recipes/gofishBobaHandwritten.d.ts +3 -0
- package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +37 -0
- package/dist/components/recipes/gofishIR.d.ts +178 -132
- package/dist/components/recipes/gofishIRExamples.d.ts +30 -81
- package/dist/components/recipes/intervalLanes.d.ts +87 -0
- package/dist/components/recipes/intervals.d.ts +80 -0
- package/dist/components/recipes/isometricLandmarks.d.ts +88 -0
- package/dist/components/recipes/isotypeGlyphs.d.ts +17 -0
- package/dist/components/recipes/mobileAnnotationStrategy.d.ts +48 -0
- package/dist/components/recipes/mobileChartFamilyRecipes.d.ts +59 -0
- package/dist/components/recipes/networkAnalysis.d.ts +102 -0
- package/dist/components/recipes/networkLayouts.d.ts +83 -0
- package/dist/components/recipes/physics.d.ts +122 -0
- package/dist/components/recipes/physicsReference.d.ts +102 -0
- package/dist/components/recipes/processAggregates.d.ts +32 -0
- package/dist/components/recipes/processChrome.d.ts +67 -0
- package/dist/components/recipes/processJourney.d.ts +54 -0
- package/dist/components/recipes/processPhysics.d.ts +300 -0
- package/dist/components/recipes/processVolumeGeometry.d.ts +28 -0
- package/dist/components/recipes/radialCoords.d.ts +69 -0
- package/dist/components/recipes/random.d.ts +2 -0
- package/dist/components/recipes/recipeChrome.d.ts +91 -0
- package/dist/components/recipes/recipeGlyph.d.ts +42 -0
- package/dist/components/recipes/recipeLegend.d.ts +53 -1
- package/dist/components/recipes/recipeUtils.d.ts +52 -0
- package/dist/components/recipes/runs.d.ts +59 -0
- package/dist/components/recipes/tokenEncoding.d.ts +157 -0
- package/dist/components/recipes/tokenLayer.d.ts +79 -0
- package/dist/components/recipes/unitize.d.ts +108 -0
- package/dist/components/recipes/vector.d.ts +28 -0
- package/dist/components/recipes/waffle.d.ts +43 -0
- package/dist/components/semiotic-ai-core.d.ts +47 -0
- package/dist/components/semiotic-ai.d.ts +50 -8
- package/dist/components/semiotic-controls.d.ts +18 -0
- package/dist/components/semiotic-experimental.d.ts +38 -9
- package/dist/components/semiotic-geo.d.ts +11 -0
- package/dist/components/semiotic-network.d.ts +11 -0
- package/dist/components/semiotic-ordinal.d.ts +8 -0
- package/dist/components/semiotic-physics-matter.d.ts +10 -0
- package/dist/components/semiotic-physics-rapier.d.ts +9 -0
- package/dist/components/semiotic-physics.d.ts +56 -0
- package/dist/components/semiotic-realtime-core.d.ts +34 -0
- package/dist/components/semiotic-realtime-react.d.ts +10 -0
- package/dist/components/semiotic-realtime.d.ts +4 -30
- package/dist/components/semiotic-recipes-core.d.ts +92 -0
- package/dist/components/semiotic-recipes-react.d.ts +7 -0
- package/dist/components/semiotic-recipes.d.ts +4 -43
- package/dist/components/semiotic-server-edge.d.ts +8 -0
- package/dist/components/semiotic-server-node.d.ts +5 -0
- package/dist/components/semiotic-server.d.ts +2 -2
- package/dist/components/semiotic-themes-core.d.ts +53 -0
- package/dist/components/semiotic-themes-react.d.ts +4 -0
- package/dist/components/semiotic-themes.d.ts +6 -76
- package/dist/components/semiotic-utils-core.d.ts +46 -0
- package/dist/components/semiotic-utils-react.d.ts +5 -0
- package/dist/components/semiotic-utils.d.ts +3 -39
- package/dist/components/semiotic-xy.d.ts +8 -0
- package/dist/components/semiotic.d.ts +35 -7
- package/dist/components/server/animatedGif.d.ts +36 -0
- package/dist/components/server/renderEvidence.d.ts +1 -1
- package/dist/components/server/renderToStaticSVG.d.ts +3 -35
- package/dist/components/server/serverChartConfigShared.d.ts +17 -0
- package/dist/components/server/serverChartConfigs.d.ts +19 -9
- package/dist/components/server/serverChartConfigsCustom.d.ts +5 -0
- package/dist/components/server/serverChartConfigsGeo.d.ts +9 -0
- package/dist/components/server/serverChartConfigsNetwork.d.ts +8 -0
- package/dist/components/server/serverChartConfigsOrdinal.d.ts +16 -0
- package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +11 -0
- package/dist/components/server/staticGeo.d.ts +4 -0
- package/dist/components/server/staticLegend.d.ts +1 -1
- package/dist/components/server/staticNetwork.d.ts +8 -0
- package/dist/components/server/staticOrdinal.d.ts +11 -0
- package/dist/components/server/staticPhysics.d.ts +3 -0
- package/dist/components/server/staticSVGChrome.d.ts +110 -0
- package/dist/components/server/staticXY.d.ts +4 -0
- package/dist/components/store/ObservationStore.d.ts +3 -2
- package/dist/components/store/themeSerialization.d.ts +32 -0
- package/dist/components/store/useChartInterrogation.d.ts +9 -0
- package/dist/components/stream/AccessibleDataTable.d.ts +3 -13
- package/dist/components/stream/FocusRing.d.ts +4 -2
- package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +28 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +31 -26
- package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -1
- package/dist/components/stream/OrdinalPipelineStore.d.ts +46 -2
- package/dist/components/stream/PipelineStore.d.ts +81 -170
- package/dist/components/stream/SceneGraph.d.ts +9 -1
- package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
- package/dist/components/stream/StreamNetworkFrame.d.ts +1 -1
- package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
- package/dist/components/stream/StreamXYFrame.d.ts +2 -18
- package/dist/components/stream/accessibleDataRows.d.ts +33 -0
- package/dist/components/stream/accessorUtils.d.ts +23 -10
- package/dist/components/stream/brushAccessibility.d.ts +25 -0
- package/dist/components/stream/canvasBackground.d.ts +24 -0
- package/dist/components/stream/canvasSetup.d.ts +4 -1
- package/dist/components/stream/customLayoutFailure.d.ts +33 -0
- package/dist/components/stream/customLayoutPalette.d.ts +19 -9
- package/dist/components/stream/frameThemeColors.d.ts +24 -0
- package/dist/components/stream/geoAnnotationAnchors.d.ts +14 -0
- package/dist/components/stream/geoCartogram.d.ts +17 -0
- package/dist/components/stream/geoCustomLayout.d.ts +59 -0
- package/dist/components/stream/geoDefaultTooltip.d.ts +11 -0
- package/dist/components/stream/geoFrameHelpers.d.ts +34 -0
- package/dist/components/stream/geoPipelineHelpers.d.ts +46 -0
- package/dist/components/stream/geoTypes.d.ts +56 -7
- package/dist/components/stream/glyphDef.d.ts +98 -0
- package/dist/components/stream/hitTarget.d.ts +170 -0
- package/dist/components/stream/hoverUtils.d.ts +3 -0
- package/dist/components/stream/keyboardNav.d.ts +4 -1
- package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +9 -1
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +57 -0
- package/dist/components/stream/networkBezier.d.ts +10 -0
- package/dist/components/stream/networkColorAccessors.d.ts +49 -0
- package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
- package/dist/components/stream/networkFramePaint.d.ts +43 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
- package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
- package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
- package/dist/components/stream/networkTypes.d.ts +76 -5
- package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/ordinalDataIndex.d.ts +5 -0
- package/dist/components/stream/ordinalDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/ordinalDomain.d.ts +38 -0
- package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +12 -0
- package/dist/components/stream/ordinalPulse.d.ts +10 -0
- package/dist/components/stream/ordinalPulseResources.d.ts +3 -0
- package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +5 -0
- package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
- package/dist/components/stream/ordinalTypes.d.ts +40 -8
- package/dist/components/stream/paintNeeds.d.ts +31 -0
- package/dist/components/stream/physics/CapacityQueueController.d.ts +5 -0
- package/dist/components/stream/physics/CapacityQueueTypes.d.ts +134 -0
- package/dist/components/stream/physics/MatterPhysicsEngineAdapter.d.ts +42 -0
- package/dist/components/stream/physics/PhysicsAccessibility.d.ts +48 -0
- package/dist/components/stream/physics/PhysicsAnnotations.d.ts +58 -0
- package/dist/components/stream/physics/PhysicsBodyBudget.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +10 -0
- package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsControllers.d.ts +75 -0
- package/dist/components/stream/physics/PhysicsEngineAdapter.d.ts +59 -0
- package/dist/components/stream/physics/PhysicsEngineConformance.d.ts +23 -0
- package/dist/components/stream/physics/PhysicsEvidence.d.ts +25 -0
- package/dist/components/stream/physics/PhysicsKernel.d.ts +207 -0
- package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +12 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +84 -0
- package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +72 -0
- package/dist/components/stream/physics/PhysicsSediment.d.ts +69 -0
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +18 -0
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +21 -0
- package/dist/components/stream/physics/PhysicsWorkerClient.d.ts +24 -0
- package/dist/components/stream/physics/PhysicsWorkerProtocol.d.ts +101 -0
- package/dist/components/stream/physics/PhysicsWorkerRuntime.d.ts +5 -0
- package/dist/components/stream/physics/RapierPhysicsEngineAdapter.d.ts +18 -0
- package/dist/components/stream/physics/ServiceOperationsControllers.d.ts +27 -0
- package/dist/components/stream/physics/ServiceOperationsTypes.d.ts +89 -0
- package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +6 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +302 -0
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
- package/dist/components/stream/physics/physicsPipelineControls.d.ts +4 -0
- package/dist/components/stream/physics/physicsPipelineHelpers.d.ts +41 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +14 -0
- package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +9 -0
- package/dist/components/stream/physics/physicsRegionRuntime.d.ts +54 -0
- package/dist/components/stream/physics/physicsSemanticUI.d.ts +20 -0
- package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +16 -0
- package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
- package/dist/components/stream/pipelineConfig.d.ts +177 -0
- package/dist/components/stream/pipelineDecay.d.ts +20 -2
- package/dist/components/stream/pipelineDomainResolution.d.ts +62 -0
- package/dist/components/stream/pipelineIdentityOps.d.ts +26 -0
- package/dist/components/stream/pipelinePulse.d.ts +16 -2
- package/dist/components/stream/pipelineRibbons.d.ts +41 -0
- package/dist/components/stream/pipelineSpatialIndex.d.ts +12 -0
- package/dist/components/stream/pipelineStoreUpdateResults.d.ts +12 -0
- package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
- package/dist/components/stream/pipelineTransitions.d.ts +2 -0
- package/dist/components/stream/pipelineUpdateContract.d.ts +62 -0
- package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
- package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +18 -0
- package/dist/components/stream/streamStoreSync.d.ts +37 -0
- package/dist/components/stream/types.d.ts +135 -7
- package/dist/components/stream/useFrame.d.ts +21 -2
- package/dist/components/stream/useHydration.d.ts +6 -0
- package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
- package/dist/components/stream/workerModuleUrl.d.ts +10 -0
- package/dist/components/stream/xyAnnotationAnchors.d.ts +13 -0
- package/dist/components/stream/xyCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/xyCrosshair.d.ts +11 -0
- package/dist/components/stream/xyDateTicks.d.ts +9 -0
- package/dist/components/stream/xyDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +4 -4
- package/dist/controls.min.js +2 -0
- package/dist/controls.module.min.js +2 -0
- package/dist/forceLayoutWorker.js +1 -0
- 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-matter.min.js +1 -0
- package/dist/physics-matter.module.min.js +1 -0
- package/dist/physics-rapier.min.js +1 -0
- package/dist/physics-rapier.module.min.js +1 -0
- package/dist/physics.min.js +2 -0
- package/dist/physics.module.min.js +2 -0
- package/dist/physicsWorker.js +1 -0
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-chunk-OG7BQUUW.module.min.js +2 -0
- package/dist/semiotic-ai-core.d.ts +47 -0
- package/dist/semiotic-ai-core.min.js +1 -0
- package/dist/semiotic-ai-core.module.min.js +1 -0
- package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +2 -0
- package/dist/semiotic-ai.d.ts +50 -8
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-chunk-3FSVZ46U.module.min.js +2 -0
- package/dist/semiotic-controls.d.ts +18 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +38 -9
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +11 -0
- package/dist/semiotic-network.d.ts +11 -0
- package/dist/semiotic-ordinal.d.ts +8 -0
- package/dist/semiotic-physics-matter.d.ts +10 -0
- package/dist/semiotic-physics-rapier.d.ts +9 -0
- package/dist/semiotic-physics.d.ts +56 -0
- package/dist/semiotic-realtime-core.d.ts +34 -0
- package/dist/semiotic-realtime-core.min.js +1 -0
- package/dist/semiotic-realtime-core.module.min.js +1 -0
- package/dist/semiotic-realtime-react.d.ts +10 -0
- package/dist/semiotic-realtime-react.min.js +2 -0
- package/dist/semiotic-realtime-react.module.min.js +2 -0
- package/dist/semiotic-realtime.d.ts +4 -30
- package/dist/semiotic-recipes-core.d.ts +92 -0
- package/dist/semiotic-recipes-core.min.js +1 -0
- package/dist/semiotic-recipes-core.module.min.js +1 -0
- package/dist/semiotic-recipes-react.d.ts +7 -0
- package/dist/semiotic-recipes-react.min.js +2 -0
- package/dist/semiotic-recipes-react.module.min.js +2 -0
- package/dist/semiotic-recipes.d.ts +4 -43
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.d.ts +8 -0
- package/dist/semiotic-server-edge.min.js +1 -0
- package/dist/semiotic-server-edge.module.min.js +1 -0
- package/dist/semiotic-server-node.d.ts +5 -0
- package/dist/semiotic-server-node.min.js +1 -0
- package/dist/semiotic-server-node.module.min.js +1 -0
- package/dist/semiotic-server.d.ts +2 -2
- package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +2 -0
- package/dist/semiotic-themes-core.d.ts +53 -0
- package/dist/semiotic-themes-core.min.js +1 -0
- package/dist/semiotic-themes-core.module.min.js +1 -0
- package/dist/semiotic-themes-react.d.ts +4 -0
- package/dist/semiotic-themes-react.min.js +2 -0
- package/dist/semiotic-themes-react.module.min.js +2 -0
- package/dist/semiotic-themes.d.ts +6 -76
- package/dist/semiotic-themes.min.js +1 -2
- package/dist/semiotic-themes.module.min.js +1 -2
- package/dist/semiotic-utils-core.d.ts +46 -0
- package/dist/semiotic-utils-core.min.js +1 -0
- package/dist/semiotic-utils-core.module.min.js +1 -0
- package/dist/semiotic-utils-react.d.ts +5 -0
- package/dist/semiotic-utils-react.min.js +2 -0
- package/dist/semiotic-utils-react.module.min.js +2 -0
- package/dist/semiotic-utils.d.ts +3 -39
- package/dist/semiotic-utils.min.js +1 -2
- package/dist/semiotic-utils.module.min.js +1 -2
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +8 -0
- package/dist/semiotic.d.ts +35 -7
- 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-chunk-IWD6IB6V.module.min.js +2 -0
- package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +2 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +239 -87
- package/spec/README.md +152 -0
- package/spec/bindings/README.md +35 -0
- package/spec/bindings/vega-lite.mjs +112 -0
- package/spec/v0.1/annotation-provenance.schema.json +127 -0
- package/spec/v0.1/audience-profile.schema.json +67 -0
- package/spec/v0.1/chart-capability.schema.json +186 -0
- package/dist/components/recipes/gofish.d.ts +0 -207
- package/dist/components/recipes/gofishInterpreter.d.ts +0 -52
- package/dist/components/recipes/gofishLambdas.d.ts +0 -145
- package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +0 -2
- package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +0 -1
- package/dist/semiotic-semiotic-BmrYbi99.js +0 -2
- package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +0 -1
- package/dist/xy-semiotic-xy-Dufu3D0-.js +0 -2
- package/dist/xy-statisticalOverlays-3Ni9bRph.js +0 -1
|
@@ -7,6 +7,7 @@ import type { Datum } from "../charts/shared/datumTypes";
|
|
|
7
7
|
import type { CoercibleNumber } from "./accessorUtils";
|
|
8
8
|
import type { AutoPlaceAnnotations } from "../recipes/annotationLayout";
|
|
9
9
|
import type { SymbolName } from "./symbolPath";
|
|
10
|
+
import type { GlyphDef } from "./glyphDef";
|
|
10
11
|
export type SceneDatum = Datum | null;
|
|
11
12
|
export type SeriesDatum = Datum[] | null;
|
|
12
13
|
export type AxisTickFormat = ((d: number, index?: number, allTicks?: number[]) => string) | ((d: string, index?: number, allTicks?: number[]) => string) | ((d: Date, index?: number, allTicks?: number[]) => string);
|
|
@@ -117,7 +118,19 @@ export interface Style {
|
|
|
117
118
|
/** Internal geo line flag: fade line ends at projection clipping edges. */
|
|
118
119
|
_edgeFade?: boolean;
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Optional semantic payload carried beside render geometry. `accessibleDatum`
|
|
123
|
+
* preserves the full row; `tableFields` lets a recipe expose a curated,
|
|
124
|
+
* user-facing table projection without reducing the scene datum itself.
|
|
125
|
+
*/
|
|
126
|
+
export interface SceneAccessibilityMetadata {
|
|
127
|
+
accessibleDatum?: SceneDatum | Datum[];
|
|
128
|
+
accessibility?: {
|
|
129
|
+
label?: string;
|
|
130
|
+
tableFields?: SceneDatum | Datum[];
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
export type SceneNode = LineSceneNode | AreaSceneNode | PointSceneNode | SymbolSceneNode | GlyphSceneNode | RectSceneNode | HeatcellSceneNode | CandlestickSceneNode;
|
|
121
134
|
export interface LineColorThreshold {
|
|
122
135
|
value: number;
|
|
123
136
|
color: string;
|
|
@@ -132,6 +145,8 @@ export interface LineSceneNode {
|
|
|
132
145
|
colorThresholds?: LineColorThreshold[];
|
|
133
146
|
style: Style;
|
|
134
147
|
datum: SeriesDatum;
|
|
148
|
+
accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
|
|
149
|
+
accessibility?: SceneAccessibilityMetadata["accessibility"];
|
|
135
150
|
group?: string;
|
|
136
151
|
/** Horizontal gradient for the line stroke */
|
|
137
152
|
strokeGradient?: {
|
|
@@ -163,6 +178,8 @@ export interface AreaSceneNode {
|
|
|
163
178
|
bottomPath: [number, number][];
|
|
164
179
|
style: Style;
|
|
165
180
|
datum: SeriesDatum;
|
|
181
|
+
accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
|
|
182
|
+
accessibility?: SceneAccessibilityMetadata["accessibility"];
|
|
166
183
|
group?: string;
|
|
167
184
|
/** Clip the area to this rect (in plot-relative pixels). Used by horizon
|
|
168
185
|
* charts to band a single series into N slices. */
|
|
@@ -223,6 +240,8 @@ export interface PointSceneNode {
|
|
|
223
240
|
r: number;
|
|
224
241
|
style: Style;
|
|
225
242
|
datum: SceneDatum;
|
|
243
|
+
accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
|
|
244
|
+
accessibility?: SceneAccessibilityMetadata["accessibility"];
|
|
226
245
|
/** Optional unique identifier for point-anchored annotations */
|
|
227
246
|
pointId?: string;
|
|
228
247
|
/** Pulse glow intensity 0–1 (set by PipelineStore when pulse is active) */
|
|
@@ -262,6 +281,64 @@ export interface SymbolSceneNode {
|
|
|
262
281
|
rotation?: number;
|
|
263
282
|
style: Style;
|
|
264
283
|
datum: SceneDatum;
|
|
284
|
+
accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
|
|
285
|
+
accessibility?: SceneAccessibilityMetadata["accessibility"];
|
|
286
|
+
/** Optional unique identifier for point-anchored annotations. */
|
|
287
|
+
pointId?: string;
|
|
288
|
+
/** Pulse glow intensity 0–1 (set by PipelineStore when pulse is active). */
|
|
289
|
+
_pulseIntensity?: number;
|
|
290
|
+
/** Pulse glow color. */
|
|
291
|
+
_pulseColor?: string;
|
|
292
|
+
/** Pulse glow radius in px. */
|
|
293
|
+
_pulseGlowRadius?: number;
|
|
294
|
+
/** Animation target fields (set during transitions). */
|
|
295
|
+
_targetX?: number;
|
|
296
|
+
_targetY?: number;
|
|
297
|
+
_targetR?: number;
|
|
298
|
+
_targetOpacity?: number;
|
|
299
|
+
/** Per-datum decay opacity (set by PipelineStore.applyDecay). */
|
|
300
|
+
_decayOpacity?: number;
|
|
301
|
+
/** Stable identity key for transition tracking. */
|
|
302
|
+
_transitionKey?: string;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Glyph node — the composite-pictogram channel. Where `symbol` stamps one
|
|
306
|
+
* `d3-shape` path, `glyph` stamps a small multi-part vector pictogram (a
|
|
307
|
+
* `GlyphDef`: an ISOTYPE server sign, a factory, a worker) with per-node
|
|
308
|
+
* `color`/`accent` paints resolved against the definition's role tokens, and
|
|
309
|
+
* an optional partial fill (`fraction`/`fractionStart`) for unit-chart final
|
|
310
|
+
* signs — pair with the `unitize` recipe. Painted on canvas and in SVG/SSR
|
|
311
|
+
* via the shared `glyphDef` helpers, hit-tested and keyboard-navigated by its
|
|
312
|
+
* drawn bounds, and transition-tracked like a point. Uses `x`/`y` in XY,
|
|
313
|
+
* ordinal, and geo scenes (the network variant uses `cx`/`cy`).
|
|
314
|
+
*/
|
|
315
|
+
export interface GlyphSceneNode {
|
|
316
|
+
type: "glyph";
|
|
317
|
+
x: number;
|
|
318
|
+
y: number;
|
|
319
|
+
/** Rendered height in px — width follows the definition's viewBox aspect. */
|
|
320
|
+
size: number;
|
|
321
|
+
/** The multi-part pictogram definition to stamp. */
|
|
322
|
+
glyph: GlyphDef;
|
|
323
|
+
/** Primary paint for parts declaring `"color"`. Falls back to `style.fill`. */
|
|
324
|
+
color?: string;
|
|
325
|
+
/** Accent paint for parts declaring `"accent"`. */
|
|
326
|
+
accent?: string;
|
|
327
|
+
/** Partial fill 0–1 — how much of the sign is painted. @default 1 */
|
|
328
|
+
fraction?: number;
|
|
329
|
+
/** Where the partial fill begins, 0–1 (range boundary signs). @default 0 */
|
|
330
|
+
fractionStart?: number;
|
|
331
|
+
/** Partial-fill axis: horizontal fills left→right, vertical bottom→up. @default "horizontal" */
|
|
332
|
+
fractionDirection?: "horizontal" | "vertical";
|
|
333
|
+
/** Ghost paint drawn at full extent beneath a partial fill so the whole
|
|
334
|
+
* sign stays countable (the ISOTYPE partial-symbol convention). */
|
|
335
|
+
ghostColor?: string;
|
|
336
|
+
/** Rotation in radians about (x, y). */
|
|
337
|
+
rotation?: number;
|
|
338
|
+
style: Style;
|
|
339
|
+
datum: SceneDatum;
|
|
340
|
+
accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
|
|
341
|
+
accessibility?: SceneAccessibilityMetadata["accessibility"];
|
|
265
342
|
/** Optional unique identifier for point-anchored annotations. */
|
|
266
343
|
pointId?: string;
|
|
267
344
|
/** Pulse glow intensity 0–1 (set by PipelineStore when pulse is active). */
|
|
@@ -320,6 +397,8 @@ export interface RectSceneNode {
|
|
|
320
397
|
};
|
|
321
398
|
style: Style;
|
|
322
399
|
datum: SceneDatum;
|
|
400
|
+
accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
|
|
401
|
+
accessibility?: SceneAccessibilityMetadata["accessibility"];
|
|
323
402
|
group?: string;
|
|
324
403
|
_pulseIntensity?: number;
|
|
325
404
|
_pulseColor?: string;
|
|
@@ -342,6 +421,8 @@ export interface HeatcellSceneNode {
|
|
|
342
421
|
h: number;
|
|
343
422
|
fill: string;
|
|
344
423
|
datum: SceneDatum;
|
|
424
|
+
accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
|
|
425
|
+
accessibility?: SceneAccessibilityMetadata["accessibility"];
|
|
345
426
|
/** Optional style object (used for decay/transition opacity on heatmap cells) */
|
|
346
427
|
style?: Style;
|
|
347
428
|
/** Numeric cell value (for canvas text rendering when showValues is enabled) */
|
|
@@ -379,6 +460,8 @@ export interface CandlestickSceneNode {
|
|
|
379
460
|
/** Range/dumbbell mode — no body, endpoint dots instead */
|
|
380
461
|
isRange?: boolean;
|
|
381
462
|
datum: SceneDatum;
|
|
463
|
+
accessibleDatum?: SceneAccessibilityMetadata["accessibleDatum"];
|
|
464
|
+
accessibility?: SceneAccessibilityMetadata["accessibility"];
|
|
382
465
|
/** Optional style object (used during transition opacity animations) */
|
|
383
466
|
style?: Style;
|
|
384
467
|
_pulseIntensity?: number;
|
|
@@ -431,6 +514,30 @@ export interface StreamScales {
|
|
|
431
514
|
x: ScaleLinear<number, number>;
|
|
432
515
|
y: ScaleLinear<number, number>;
|
|
433
516
|
}
|
|
517
|
+
/**
|
|
518
|
+
* Context handed to a `foregroundGraphics` / `backgroundGraphics` callback. The
|
|
519
|
+
* function form receives the frame's **resolved scales** alongside `size` +
|
|
520
|
+
* `margin`, so bespoke SVG overlays anchor to the same scales the chart drew
|
|
521
|
+
* (instead of re-deriving them from extents by hand and risking drift). `scales`
|
|
522
|
+
* is `null` before the first layout pass — fall back to your own mapping then.
|
|
523
|
+
* This is the HOC analogue of what custom layouts get via `ctx.scales`.
|
|
524
|
+
*
|
|
525
|
+
* Generic over the scale shape: XY frames pass {@link StreamScales} (`{x, y}`),
|
|
526
|
+
* the ordinal frame passes its `{o, r, projection}` scales.
|
|
527
|
+
*/
|
|
528
|
+
export interface FrameGraphicsContext<S = StreamScales> {
|
|
529
|
+
size: number[];
|
|
530
|
+
margin: {
|
|
531
|
+
top: number;
|
|
532
|
+
right: number;
|
|
533
|
+
bottom: number;
|
|
534
|
+
left: number;
|
|
535
|
+
};
|
|
536
|
+
scales: S | null;
|
|
537
|
+
}
|
|
538
|
+
/** A foreground/background graphics value: static SVG, or a function of the
|
|
539
|
+
* frame's geometry + resolved scales. */
|
|
540
|
+
export type FrameGraphicsProp<S = StreamScales> = ReactNode | ((ctx: FrameGraphicsContext<S>) => ReactNode);
|
|
434
541
|
export interface StreamLayout {
|
|
435
542
|
width: number;
|
|
436
543
|
height: number;
|
|
@@ -526,6 +633,12 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
526
633
|
chunkSize?: number;
|
|
527
634
|
xAccessor?: string | ((d: T) => CoercibleNumber);
|
|
528
635
|
yAccessor?: string | ((d: T) => CoercibleNumber);
|
|
636
|
+
/**
|
|
637
|
+
* Force domain/scene re-derivation when a stable function accessor's
|
|
638
|
+
* external semantics changed without receiving a new function identity.
|
|
639
|
+
* Prefer changing the accessor reference where possible.
|
|
640
|
+
*/
|
|
641
|
+
accessorRevision?: number;
|
|
529
642
|
colorAccessor?: string | ((d: T) => string);
|
|
530
643
|
sizeAccessor?: string | ((d: T) => CoercibleNumber);
|
|
531
644
|
/** Categorical accessor → glyph shape (scatter/bubble). */
|
|
@@ -541,22 +654,25 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
541
654
|
* - "zero" (default): standard stack from y=0
|
|
542
655
|
* - "wiggle": Byron–Wattenberg streamgraph offset (minimizes wiggle)
|
|
543
656
|
* - "silhouette": center the stack symmetrically around y=0
|
|
657
|
+
* - "diverging": positives stack above 0, negatives below 0 (signed values)
|
|
544
658
|
*
|
|
545
659
|
* Mutually exclusive with `normalize`: when `normalize` is `true`, the
|
|
546
660
|
* stack is forced to a `"zero"` baseline (any other value is ignored)
|
|
547
661
|
* because normalization assumes a fixed `[0, 1]` y-domain.
|
|
548
662
|
*/
|
|
549
|
-
baseline?: "zero" | "wiggle" | "silhouette";
|
|
663
|
+
baseline?: "zero" | "wiggle" | "silhouette" | "diverging";
|
|
550
664
|
/**
|
|
551
665
|
* Stack order — controls which series sits at the top, middle, or bottom.
|
|
552
666
|
* - "key" (default): alphabetical by group key
|
|
667
|
+
* - "input": first-seen group order within the current data
|
|
668
|
+
* buffer/window; streaming eviction can change this order
|
|
553
669
|
* - "insideOut": largest-total series in the middle, smaller alternating
|
|
554
670
|
* above/below. Combined with `baseline: "wiggle"` or `"silhouette"`,
|
|
555
671
|
* produces the canonical streamgraph look where a "central anchor"
|
|
556
672
|
* layer sits across y=0 and other layers stack outward.
|
|
557
673
|
* - "asc" / "desc": by total ascending / descending
|
|
558
674
|
*/
|
|
559
|
-
stackOrder?: "key" | "insideOut" | "asc" | "desc";
|
|
675
|
+
stackOrder?: "key" | "input" | "insideOut" | "asc" | "desc";
|
|
560
676
|
/**
|
|
561
677
|
* Accessor returning a symmetric uncertainty offset per datum.
|
|
562
678
|
* When set, an uncertainty band is drawn ± this offset from the line.
|
|
@@ -621,7 +737,7 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
621
737
|
windowSize?: number;
|
|
622
738
|
timeAccessor?: string | ((d: T) => number);
|
|
623
739
|
xScaleType?: "linear" | "log" | "time";
|
|
624
|
-
yScaleType?: "linear" | "log";
|
|
740
|
+
yScaleType?: "linear" | "log" | "symlog";
|
|
625
741
|
xExtent?: [number | undefined, number | undefined] | [number];
|
|
626
742
|
yExtent?: [number | undefined, number | undefined] | [number];
|
|
627
743
|
extentPadding?: number;
|
|
@@ -650,7 +766,7 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
650
766
|
waterfallStyle?: WaterfallStyle;
|
|
651
767
|
swarmStyle?: SwarmStyle;
|
|
652
768
|
barColors?: Record<string, string>;
|
|
653
|
-
colorScheme?: string | string[]
|
|
769
|
+
colorScheme?: string | string[] | Record<string, string>;
|
|
654
770
|
showAxes?: boolean;
|
|
655
771
|
/**
|
|
656
772
|
* Per-axis config array. See `XYFrameAxisConfig` for the full set of
|
|
@@ -724,9 +840,9 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
724
840
|
/** Fires when the current legend category domain changes after scene rebuilds. */
|
|
725
841
|
onCategoriesChange?: (categories: string[]) => void;
|
|
726
842
|
/** SVG elements rendered behind the canvas (in pixel space) */
|
|
727
|
-
backgroundGraphics?:
|
|
843
|
+
backgroundGraphics?: FrameGraphicsProp;
|
|
728
844
|
/** SVG elements rendered on top of everything (in SVG overlay) */
|
|
729
|
-
foregroundGraphics?:
|
|
845
|
+
foregroundGraphics?: FrameGraphicsProp;
|
|
730
846
|
/** Canvas renderers executed before the chart-type renderers (e.g. connecting lines under points) */
|
|
731
847
|
canvasPreRenderers?: CanvasRendererFn[];
|
|
732
848
|
/** SVG pre-renderers for SSR — SVG equivalent of canvasPreRenderers, rendered under data marks */
|
|
@@ -772,6 +888,9 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
772
888
|
* returns SceneNode[] + optional overlays. See `semiotic/recipes` for
|
|
773
889
|
* reference layouts (waffle, calendar, horizon). */
|
|
774
890
|
customLayout?: import("./customLayout").CustomLayout;
|
|
891
|
+
/** Called when `customLayout` throws. See `getLayoutFailure()` for the
|
|
892
|
+
* latest structured failure diagnostic. */
|
|
893
|
+
onLayoutError?: (diagnostic: import("./customLayoutFailure").CustomLayoutFailureDiagnostic) => void;
|
|
775
894
|
/** User-supplied config blob threaded through to LayoutContext.config.
|
|
776
895
|
* Typed as `object` so caller-defined interfaces (without an index
|
|
777
896
|
* signature) flow through without casts; layouts narrow via their
|
|
@@ -796,6 +915,15 @@ export interface StreamXYFrameHandle<T = Datum> {
|
|
|
796
915
|
x: [number, number];
|
|
797
916
|
y: [number, number];
|
|
798
917
|
} | null;
|
|
918
|
+
/** The most recent custom layout result (nodes/overlays as returned by the
|
|
919
|
+
* `customLayout` function) — host readback so pages that need the computed
|
|
920
|
+
* placement don't re-run the layout. Null before the first layout or when
|
|
921
|
+
* no custom layout is configured. A failed retry retains the prior good
|
|
922
|
+
* result; inspect `getLayoutFailure()` to distinguish that recovery. */
|
|
923
|
+
getCustomLayout(): import("./customLayout").LayoutResult | null;
|
|
924
|
+
/** The latest custom-layout failure, if any. Cleared by the next successful
|
|
925
|
+
* layout, by removing the custom layout, or by `clear()`. */
|
|
926
|
+
getLayoutFailure(): import("./customLayoutFailure").CustomLayoutFailureDiagnostic | null;
|
|
799
927
|
}
|
|
800
928
|
export type CanvasRendererFn = (ctx: CanvasRenderingContext2D, nodes: SceneNode[], scales: StreamScales, layout: StreamLayout) => void;
|
|
801
929
|
/** SVG equivalent of CanvasRendererFn — returns React elements for SSR/SVG rendering */
|
|
@@ -6,6 +6,15 @@ import { resolveAnimateConfig } from "./pipelineTransitionUtils";
|
|
|
6
6
|
import type { AnimateProp } from "./pipelineTransitionUtils";
|
|
7
7
|
import type { TransitionConfig } from "./types";
|
|
8
8
|
import type { HoverPointerCoords } from "./hoverUtils";
|
|
9
|
+
/**
|
|
10
|
+
* The small scheduling surface `useFrame` needs. Keeping this separate from
|
|
11
|
+
* the browser global gives hook tests a deterministic, handle-agnostic seam
|
|
12
|
+
* without coupling the frame lifecycle to a broader scheduler abstraction.
|
|
13
|
+
*/
|
|
14
|
+
export interface FrameScheduler {
|
|
15
|
+
requestAnimationFrame(callback: FrameRequestCallback): number;
|
|
16
|
+
cancelAnimationFrame(handle: number): void;
|
|
17
|
+
}
|
|
9
18
|
/**
|
|
10
19
|
* Frame-supplied margin defaults. Each Stream Frame has its own — XY's
|
|
11
20
|
* differs from Ordinal's, Network has both a default and a CENTERED variant
|
|
@@ -48,6 +57,12 @@ export interface UseFrameInput {
|
|
|
48
57
|
animate?: AnimateProp;
|
|
49
58
|
/** Frame's `transition` prop (legacy / explicit form). */
|
|
50
59
|
transitionProp?: TransitionConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Optional rAF seam for deterministic frame tests or an embedding runtime.
|
|
62
|
+
* It owns both render scheduling and pointer-move coalescing. Omit it to
|
|
63
|
+
* use the browser's `requestAnimationFrame` / `cancelAnimationFrame`.
|
|
64
|
+
*/
|
|
65
|
+
frameScheduler?: FrameScheduler;
|
|
51
66
|
/**
|
|
52
67
|
* Frame's `dirtyRef` (the flag that forces a full canvas redraw on the
|
|
53
68
|
* next paint). When provided, useFrame installs a theme-change effect
|
|
@@ -94,12 +109,15 @@ export interface UseFrameResult {
|
|
|
94
109
|
introEnabled: boolean;
|
|
95
110
|
/** Stable id for the AccessibleDataTable region (hash-suffixed). */
|
|
96
111
|
tableId: string;
|
|
97
|
-
/** Token of the pending rAF, or
|
|
98
|
-
rafRef: React.MutableRefObject<number>;
|
|
112
|
+
/** Token of the pending rAF, or `null` if none. `0` is a valid token. */
|
|
113
|
+
rafRef: React.MutableRefObject<number | null>;
|
|
99
114
|
/** Frame assigns its render closure here. */
|
|
100
115
|
renderFnRef: React.MutableRefObject<() => void>;
|
|
101
116
|
/** Queue a render on the next animation frame. Coalesces. */
|
|
102
117
|
scheduleRender: () => void;
|
|
118
|
+
/** Cancel a queued render, if any. Direct/hydration paints use this before
|
|
119
|
+
* taking over so a stale rAF cannot race a synchronous frame. */
|
|
120
|
+
cancelRender: () => void;
|
|
103
121
|
/** Frame assigns its hover handler closure here. */
|
|
104
122
|
hoverHandlerRef: React.MutableRefObject<(coords: HoverPointerCoords) => void>;
|
|
105
123
|
/** Frame assigns its pointer-leave closure here. */
|
|
@@ -109,6 +127,7 @@ export interface UseFrameResult {
|
|
|
109
127
|
onPointerMove: (e: {
|
|
110
128
|
clientX: number;
|
|
111
129
|
clientY: number;
|
|
130
|
+
pointerType?: string;
|
|
112
131
|
}) => void;
|
|
113
132
|
/** Stable callback to attach to canvas's onPointerLeave (or onMouseLeave).
|
|
114
133
|
* Cancels any pending hover rAF and invokes hoverLeaveRef. */
|
|
@@ -79,6 +79,12 @@ export interface HydrationLifecycleOptions {
|
|
|
79
79
|
* would produce.
|
|
80
80
|
*/
|
|
81
81
|
renderFnRef: MutableRefObject<() => void>;
|
|
82
|
+
/**
|
|
83
|
+
* Optional shared-scheduler cancellation. A hydration paint is synchronous,
|
|
84
|
+
* so it must take ownership from any queued render before invoking the
|
|
85
|
+
* frame closure.
|
|
86
|
+
*/
|
|
87
|
+
cancelRender?: () => void;
|
|
82
88
|
/**
|
|
83
89
|
* Optional unmount cleanup. Frame-specific work the hook can't
|
|
84
90
|
* generalize — e.g. clearing the streaming `DataSourceAdapter`
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type MutableRefObject, type RefObject } from "react";
|
|
2
|
+
import type { PipelineStore } from "./PipelineStore";
|
|
3
|
+
import { type CategoryDomainAccessor } from "./categoryDomain";
|
|
4
|
+
/** Keep legend-category callbacks stable while reading the latest frame props. */
|
|
5
|
+
export declare function useLegendCategoryEmission(storeRef: RefObject<PipelineStore | null>, accessorRef: MutableRefObject<CategoryDomainAccessor | undefined>, onChangeRef: MutableRefObject<((categories: string[]) => void) | undefined>, previousRef: MutableRefObject<string[]>): () => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a packaged module-worker asset from either published module format.
|
|
3
|
+
*
|
|
4
|
+
* tsup's CommonJS transform replaces `import.meta` with an object whose `url`
|
|
5
|
+
* field is absent. The fallback deliberately uses the real CommonJS module
|
|
6
|
+
* filename so `new Worker()` still points at the sibling asset shipped in the
|
|
7
|
+
* tarball. ESM callers retain their literal `new URL(..., import.meta.url)`
|
|
8
|
+
* expression so browser bundlers can discover and emit the worker asset.
|
|
9
|
+
*/
|
|
10
|
+
export declare function commonJsWorkerModuleUrl(assetName: string): URL;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Harvest annotation anchors from an XY scene graph.
|
|
3
|
+
* Every mark with a `pointId` becomes a `{ pointId, x, y, r }` record so
|
|
4
|
+
* `{ pointId }` annotations resolve regardless of mark type.
|
|
5
|
+
*/
|
|
6
|
+
import type { SceneNode } from "./types";
|
|
7
|
+
export type AnnotationAnchor = {
|
|
8
|
+
pointId?: string;
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
r: number;
|
|
12
|
+
};
|
|
13
|
+
export declare function collectAnnotationAnchors(scene: SceneNode[] | undefined): AnnotationAnchor[] | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart-type → canvas renderer dispatch for StreamXYFrame.
|
|
3
|
+
* Order matters: earlier renderers paint underneath later ones.
|
|
4
|
+
*/
|
|
5
|
+
import type { StreamChartType } from "./types";
|
|
6
|
+
import type { StreamRendererFn } from "./renderers/types";
|
|
7
|
+
export declare const XY_CANVAS_RENDERERS: Record<StreamChartType, StreamRendererFn[]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canvas crosshair + line-highlight paint helpers for StreamXYFrame.
|
|
3
|
+
* Pure drawing — no React / store dependency.
|
|
4
|
+
*/
|
|
5
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
6
|
+
import type { HoverData, HoverAnnotationConfig, SceneNode } from "./types";
|
|
7
|
+
import type { FrameThemeColors } from "./frameThemeColors";
|
|
8
|
+
export declare function drawCrosshair(ctx: CanvasRenderingContext2D, hover: HoverData, width: number, height: number, config: HoverAnnotationConfig, hoveredNode: SceneNode | null, theme: FrameThemeColors): void;
|
|
9
|
+
export declare function drawLineHighlight(ctx: CanvasRenderingContext2D, scene: SceneNode[], hoveredNode: SceneNode | null, highlightConfig: {
|
|
10
|
+
style?: Datum | ((d: Datum) => Datum);
|
|
11
|
+
}, theme: FrameThemeColors): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto date tick formatting for StreamXYFrame time scales.
|
|
3
|
+
* UTC getters keep SSR and client labels identical across timezones.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Build a tick formatter for a numeric time domain (ms since epoch).
|
|
7
|
+
* Span-based resolution: hours → day-month → month-year → year.
|
|
8
|
+
*/
|
|
9
|
+
export declare function makeDateTickFormatter(domain: [number, number]): (v: number) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default XY hover tooltip for StreamXYFrame.
|
|
3
|
+
* Uses shared `defaultTooltipStyle` so theme CSS vars apply consistently.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import type { HoverData } from "./types";
|
|
7
|
+
declare function DefaultTooltip({ hover }: {
|
|
8
|
+
hover: HoverData;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export { DefaultTooltip };
|
|
@@ -52,12 +52,12 @@ export interface XYSceneContext {
|
|
|
52
52
|
export interface XYSceneConfig {
|
|
53
53
|
chartType?: string;
|
|
54
54
|
curve?: CurveType;
|
|
55
|
-
colorScheme?: string | string[]
|
|
55
|
+
colorScheme?: string | string[] | Record<string, string>;
|
|
56
56
|
normalize?: boolean;
|
|
57
|
-
/** Stacked area baseline. "zero" (default), "wiggle" (streamgraph), "silhouette" (centered). */
|
|
58
|
-
baseline?: "zero" | "wiggle" | "silhouette";
|
|
57
|
+
/** Stacked area baseline. "zero" (default), "wiggle" (streamgraph), "silhouette" (centered), "diverging" (signed y above/below 0). */
|
|
58
|
+
baseline?: "zero" | "wiggle" | "silhouette" | "diverging";
|
|
59
59
|
/** Stack order — see PipelineConfig.stackOrder. */
|
|
60
|
-
stackOrder?: "key" | "insideOut" | "asc" | "desc";
|
|
60
|
+
stackOrder?: "key" | "input" | "insideOut" | "asc" | "desc";
|
|
61
61
|
gradientFill?: AreaGradientConfig;
|
|
62
62
|
areaGroups?: Set<string>;
|
|
63
63
|
lineGradient?: {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var e,t=Object.create,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,l=(e,t,o,l)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of a(t))i.call(e,s)||s===o||r(e,s,{get:()=>t[s],enumerable:!(l=n(t,s))||l.enumerable});return e},s=(e,n,a)=>(a=null!=e?t(o(e)):{},l(!n&&e&&e.__esModule?a:r(a,"default",{value:e,enumerable:!0}),e)),u={};((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})(u,{CircularBrush:()=>M,DirectManipulationControl:()=>b,MobileStandardControls:()=>L,VISUALIZATION_CONTROL_TYPES:()=>p,auditVisualizationControls:()=>y,clampMobileRange:()=>S,createControlObservationAdapter:()=>m,useMobileRangeControls:()=>P,zoomMobileRange:()=>I}),module.exports=(e=u,l(r({},"__esModule",{value:!0}),e));var c=s(require("react")),d=require("react"),p=["value","threshold","partition-boundary","time-window","range-boundary"];function m({controlType:e,controlId:t,chartId:r,chartType:n="VisualizationControl",onObservation:a}){return(o,i,l)=>{a?.({type:o,controlType:e,value:i,chartType:n,timestamp:Date.now(),...t?{controlId:t}:{},...r?{chartId:r}:{},...l?{source:l}:{}})}}var h=require("react/jsx-runtime");function g(e,t,r,n){return Math.min(r,Math.max(t,Number((t+Math.round((Math.min(r,Math.max(t,e))-t)/n)*n).toFixed(12))))}function b({value:e,onChange:t,pointerToValue:r,min:n,max:a,step:o=1,largeStep:i=5*o,x:l,y:s,controlType:u="value",controlId:p,label:b,valueText:f,radius:y=12,fill:x="var(--semiotic-bg, #ffffff)",stroke:v="var(--semiotic-primary, #4e79a7)",strokeWidth:C=4,labelText:$,labelDx:j=16,labelDy:w=-16,labelClassName:k,className:M,disabled:T=!1,onChangeStart:z,onChangeEnd:S,onObservation:I,chartId:P,chartType:A}){const O=(0,d.useRef)(null),N=(0,d.useRef)(e);N.current=e;const D=c.useMemo(()=>m({controlType:u,controlId:p,chartId:P,chartType:A,onObservation:I}),[P,A,p,u,I]),R=e=>{if(T)return;const i=r(e);if(null==i||!Number.isFinite(i))return;const l=g(i,n,a,o);N.current=l,t(l),D("control-change",l,"pointer")},V=e=>{e.stopPropagation(),O.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),O.current=null,S?.(N.current),D("control-end",N.current,"pointer"))},Z=["semiotic-direct-manipulation-control",M].filter(Boolean).join(" ");return(0,h.jsxs)("g",{className:Z,role:"slider",tabIndex:T?-1:0,"aria-disabled":T||void 0,"aria-label":b,"aria-valuemin":n,"aria-valuemax":a,"aria-valuenow":e,"aria-valuetext":f??`${b}: ${e}`,"aria-roledescription":"visualization control","data-viz-control":u,"data-viz-control-id":p,"data-viz-control-state":"controlled",pointerEvents:"all",onPointerDown:e=>{T||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),O.current=e.pointerId,z?.(N.current),D("control-start",N.current,"pointer"),R(e))},onPointerMove:e=>{e.stopPropagation(),O.current===e.pointerId&&R(e)},onPointerUp:V,onPointerCancel:V,onLostPointerCapture:V,onKeyDown:e=>{if(T)return;const r=e.shiftKey?i:o,l=N.current;let s=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(s=l-r),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(s=l+r),"Home"===e.key&&(s=n),"End"===e.key&&(s=a),null===s)return;e.preventDefault();const u=g(s,n,a,o);N.current=u,t(u),D("control-change",u,"keyboard")},style:{cursor:T?"default":"grab",touchAction:"none"},children:[(0,h.jsx)("circle",{className:"semiotic-direct-manipulation-control__hit",cx:l,cy:s,r:y+10,fill:"transparent"}),(0,h.jsx)("circle",{className:"semiotic-direct-manipulation-control__handle",cx:l,cy:s,r:y,fill:x,stroke:v,strokeWidth:C}),$?(0,h.jsx)("text",{className:k,x:l+j,y:s+w,fill:v,children:$}):null]})}function f(e,t,r,n,a){return{id:e,...t?{controlId:t}:{},status:r,message:n,...a?{remediation:a}:{}}}function y({controls:e=[],minimumTargetSize:t=24}){const r=[],n=new Set;for(const a of e){const e=a?.id,o="controls."+(e||"unknown"),i=a?.domain,l=Array.isArray(i)&&2===i.length&&Number.isFinite(i[0])&&Number.isFinite(i[1])&&i[1]>i[0],s=p.includes(a?.type),u="string"==typeof a?.target&&a.target.trim().length>0,c=["slider","buttons","native-range"].includes(a?.keyboard??""),d=a?.minimumTargetSize;r.push(f(o+".semantic-type",e,s?"pass":"fail",s?`Control uses the semantic type "${a.type}".`:"Control has no recognized semantic type.","Use one of VISUALIZATION_CONTROL_TYPES.")),r.push(f(o+".state-binding",e,u?"pass":"fail",u?`Control is bound to "${a.target}".`:"Control has no declarative state binding.","Declare the controlled state key with target.")),r.push(f(o+".domain",e,l?"pass":"fail",l?"Control has a finite ordered value domain.":"Control has no finite ordered value domain.","Declare domain as [minimum, maximum].")),r.push(f(o+".keyboard",e,c?"pass":"fail",c?`Control declares a ${a.keyboard} keyboard path.`:"Control does not declare a keyboard path.","Declare slider, buttons, or native-range keyboard interaction.")),r.push(f(o+".value-text",e,"string"==typeof a?.valueText&&a.valueText.trim().length>0?"pass":"fail","string"==typeof a?.valueText&&a.valueText.trim().length>0?"Control declares human-readable value text.":"Control does not declare human-readable value text.","Provide valueText, typically with a {value} placeholder.")),r.push(f(o+".target-size",e,"number"!=typeof d||t>d?"fail":"pass","number"!=typeof d||t>d?`Control target is below the ${t}px minimum or undeclared.`:`Control declares a ${d}px target.`,`Declare minimumTargetSize of at least ${t}.`)),null!=a?.step&&r.push(f(o+".step",e,Number.isFinite(a.step)&&a.step>0?"pass":"fail",Number.isFinite(a.step)&&a.step>0?"Control has a positive quantization step.":"Control step must be a positive finite number.","Use a positive finite step.")),a?.observations?.length&&r.push(f(o+".observations",e,a.observations.includes("control-change")?"pass":"warn",a.observations.includes("control-change")?"Control declares control-change observation coverage.":"Control declares observations but omits control-change.","Include control-change so observable state changes are represented.")),e&&!n.has(e)||r.push(f(o+".identity",e,"fail",e?"Control id is duplicated.":"Control id is missing.","Use a unique stable control id.")),e&&n.add(e)}return{ok:r.every(e=>"fail"!==e.status),findings:r}}var x=require("react"),v=2*Math.PI;function C(e,t,r){const n=r?.center?.x??0,a=r?.center?.y??0;return{x:n+Math.sin(e)*t,y:a-Math.cos(e)*t}}function $(e,t,r,n,a){const o=a?.center,i=(e,t)=>{const{x:r,y:n}=C(e,t,{center:o});return`${j(r)},${j(n)}`},l=Math.max(0,r),s=Math.max(l,n),u=Math.abs(t-e),c=e>t?0:1;if(u>=v-1e-6){const e=o?.x??0,t=o?.y??0,r=`${j(e)},${j(t-s)}`,n=`${j(e)},${j(t+s)}`;let a=`M${r} A${j(s)},${j(s)} 0 1 1 ${n} A${j(s)},${j(s)} 0 1 1 ${r} Z`;if(l>0){const r=`${j(e)},${j(t-l)}`,n=`${j(e)},${j(t+l)}`;a+=` M${r} A${j(l)},${j(l)} 0 1 0 ${n} A${j(l)},${j(l)} 0 1 0 ${r} Z`}return a}const d=u>Math.PI?1:0,p=i(e,s),m=i(t,s);if(0>=l){const e=o?.x??0,t=o?.y??0;return`M${j(e)},${j(t)} L${p} A${j(s)},${j(s)} 0 ${d} ${c} ${m} Z`}const h=i(t,l),g=i(e,l);return`M${p} A${j(s)},${j(s)} 0 ${d} ${c} ${m} L${h} A${j(l)},${j(l)} 0 ${d} ${1===c?0:1} ${g} Z`}function j(e){return Math.round(1e3*e)/1e3}function w(e,t,r=0){return t>0?((e-r)%t+t)%t+r:e}var k=require("react/jsx-runtime");function M({value:e,onChange:t,period:r=365,radius:n=180,innerRadius:a=14,width:o,height:i,step:l=1,largeStep:s=7,label:u="Range",formatValue:c,arcFill:d="var(--semiotic-primary, #4e79a7)",stroke:p="var(--semiotic-bg, #ffffff)",className:m,style:h}){const g=o??2*n+40,b=i??2*n+40,f=g/2,y=b/2,j=function(e){const[t,r]=e,n=r-t||1,a=v;return e=>0+(e-t)/n*(a-0)}([0,r]),M=(0,x.useRef)(null),T=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,n=t.getBoundingClientRect(),a=t.viewBox?.baseVal;return Math.round((Math.atan2((a?.width||g)/(n.width||1)*(e.clientX-n.left)-f-0,-((a?.height||b)/(n.height||1)*(e.clientY-n.top)-y-0))+v)%v/v*r)%r},z=(e,t)=>{e.preventDefault(),e.stopPropagation();const r=e.currentTarget.ownerSVGElement;r?.setPointerCapture?.(e.pointerId),M.current={mode:t,lastValue:T(e)}},S=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),M.current=null},I=(e,n)=>{t("range"===e?e=>({start:w(e.start+n,r),end:w(e.end+n,r)}):t=>({...t,[e]:w(t[e]+n,r)}))},P=e=>t=>{const r=t.shiftKey?s:l;"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),I(e,r)):"ArrowLeft"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),I(e,-r))},A=e.start>e.end?[[e.start,r],[0,e.end]]:[[e.start,e.end]],O=e=>c?c(e):e+"";return(0,k.jsx)("svg",{viewBox:`0 0 ${g} ${b}`,width:g,height:b,className:m,onPointerMove:e=>{const n=M.current;if(!n)return;const a=T(e);if("range"===n.mode){const e=function(e,t,r){if(0>=r)return t-e;let n=(t-e)%r;return n>r/2?n-=r:-r/2>n&&(n+=r),n}(n.lastValue,a,r);if(0===e)return;return n.lastValue=a,void t(t=>({start:w(t.start+e,r),end:w(t.end+e,r)}))}t(e=>({...e,[n.mode]:a}))},onPointerUp:S,onPointerCancel:S,onLostPointerCapture:S,style:{touchAction:"none",...h},"aria-label":u+" brush",children:(0,k.jsxs)("g",{transform:`translate(${f},${y})`,children:[(0,k.jsx)("g",{role:"slider",tabIndex:0,"aria-label":u+" (move both ends)","aria-valuemin":0,"aria-valuemax":r-1,"aria-valuenow":e.start,"aria-valuetext":`${O(e.start)} to ${O(e.end)}`,onPointerDown:e=>z(e,"range"),onKeyDown:P("range"),style:{cursor:"grab"},children:A.map(([e,t],r)=>(0,k.jsx)("path",{d:$(j(e),j(t),a,n),fill:d,fillOpacity:.35,stroke:p,strokeWidth:1},r))}),["start","end"].map(t=>{const o=e[t],i=(e=>C(j(e),a))(o),l=(e=>C(j(e),n+8))(o);return(0,k.jsxs)("g",{role:"slider",tabIndex:0,"aria-label":`${u} ${t}`,"aria-valuemin":0,"aria-valuemax":r-1,"aria-valuenow":o,"aria-valuetext":O(o),onPointerDown:e=>z(e,t),onKeyDown:P(t),style:{cursor:"grab"},children:[(0,k.jsx)("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:"transparent",strokeWidth:20}),(0,k.jsx)("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:p,strokeWidth:1.5}),(0,k.jsx)("circle",{cx:l.x,cy:l.y,r:4.5,fill:p,stroke:d,strokeWidth:1})]},t)})]})})}var T=s(require("react")),z=require("react/jsx-runtime");function S(e,t,r=0){const n=Math.min(t[0],t[1]),a=Math.max(t[0],t[1]),o=Math.max(n,Math.min(a,e[0])),i=Math.max(n,Math.min(a,e[1])),l=o>i?[i,o]:[o,i];if(l[1]-l[0]>=r)return l;const s=(l[0]+l[1])/2,u=r/2;return[Math.max(n,Math.min(a-r,s-u)),Math.min(a,Math.max(n+r,s+u))]}function I(e,t,r,n=1,a=n){const o="in"===r?n:-n;return S([e[0]+o,e[1]-o],t,a)}function P(e){const{domain:t,initialValue:r=t,step:n=1,minSpan:a=n,label:o,formatValue:i,onChange:l}=e,[s,u]=T.useState(()=>S(r,t,a)),c=S(s,t,a),d=T.useCallback(e=>{const r=S(e,t,a);u(r),l?.(r)},[t,a,l]),p=T.useMemo(()=>({label:o,domain:t,value:c,step:n,formatValue:i,onChange:d,onClear:()=>d(t)}),[t,i,o,d,n,c]),m=T.useMemo(()=>({onZoomIn:()=>d(I(c,t,"in",n,a)),onZoomOut:()=>d(I(c,t,"out",n,a)),onReset:()=>d(t)}),[t,a,d,n,c]);return{value:c,setValue:d,xExtent:c,brush:p,zoom:m}}var A={display:"grid",gap:8,padding:"10px 12px",border:"1px solid var(--semiotic-border, #d8dee4)",borderRadius:12,background:"var(--semiotic-surface, var(--semiotic-bg, rgba(255,255,255,0.92)))"},O={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function N(e,t){return{minWidth:e,minHeight:e,padding:"0 12px",borderRadius:999,border:"1px solid var(--semiotic-border, #d8dee4)",background:t?"var(--semiotic-primary, #0969da)":"var(--semiotic-bg, #fff)",color:t?"var(--semiotic-on-primary, #fff)":"var(--semiotic-text, #24292f)",fontSize:13,fontWeight:650,touchAction:"manipulation"}}function D(e){return"function"==typeof e}function R({brush:e,targetSize:t}){const r=e?.value,n=e?.domain,a=!!r&&!!n,o=!0===e?.disabled,i=e?.formatValue??(e=>e),l=!!e?.onChange&&a&&!o,s=n?.[0]??0,u=n?.[1]??1,c=r?.[0]??s,d=r?.[1]??u,p=e?.step??((u-s)/100||1);return(0,z.jsxs)("section",{style:A,"aria-label":"Brush controls",children:[(0,z.jsx)("div",{style:O,children:e?.label??"Filter range"}),a?(0,z.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,z.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,z.jsxs)("span",{children:["Start: ",i(c)]}),(0,z.jsx)("input",{type:"range",min:s,max:u,step:p,value:c,disabled:!l,style:{minHeight:t},onChange:t=>{const r=Number(t.currentTarget.value);e?.onChange?.([Math.min(r,d),d])}})]}),(0,z.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,z.jsxs)("span",{children:["End: ",i(d)]}),(0,z.jsx)("input",{type:"range",min:s,max:u,step:p,value:d,disabled:!l,style:{minHeight:t},onChange:t=>{const r=Number(t.currentTarget.value);e?.onChange?.([c,Math.max(r,c)])}})]})]}):(0,z.jsx)("div",{style:{fontSize:12,color:"var(--semiotic-text-secondary, #57606a)"},children:"Provide a brush domain and value to expose range inputs beside the drag gesture."}),(0,z.jsx)("button",{type:"button",disabled:o||!D(e?.onClear),onClick:e?.onClear,style:N(t),children:"Clear range"})]})}function V({zoom:e,targetSize:t}){const r=!0===e?.disabled;return(0,z.jsxs)("section",{style:A,"aria-label":"Zoom controls",children:[(0,z.jsx)("div",{style:O,children:e?.label??"Zoom"}),(0,z.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,z.jsx)("button",{type:"button","aria-label":"Zoom out",disabled:r||!D(e?.onZoomOut),onClick:e?.onZoomOut,style:N(t),children:"-"}),(0,z.jsx)("button",{type:"button","aria-label":"Reset zoom",disabled:r||!D(e?.onReset),onClick:e?.onReset,style:N(t),children:"Reset"}),(0,z.jsx)("button",{type:"button","aria-label":"Zoom in",disabled:r||!D(e?.onZoomIn),onClick:e?.onZoomIn,style:N(t),children:"+"})]})]})}function Z({legend:e,targetSize:t}){const r=!0===e?.disabled,n=e?.items??[];return(0,z.jsxs)("section",{style:A,"aria-label":"Legend controls",children:[(0,z.jsx)("div",{style:O,children:e?.label??"Series"}),n.length>0&&(0,z.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:n.map(n=>{const a=!1!==n.active;return(0,z.jsxs)("button",{type:"button",disabled:r||n.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(n.id,!a),style:N(t,a),"aria-pressed":a,children:[n.color&&(0,z.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:n.color}}),n.label??n.id]},n.id)})}),(0,z.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,z.jsx)("button",{type:"button",disabled:r||!D(e?.onShowAll),onClick:e?.onShowAll,style:N(t),children:"Show all"}),(0,z.jsx)("button",{type:"button",disabled:r||!D(e?.onHideAll),onClick:e?.onHideAll,style:N(t),children:"Hide all"})]})]})}function L({controls:e,targetSize:t=44,compact:r=!1,className:n,style:a,ariaLabel:o="Mobile chart controls",brush:i,zoom:l,legend:s}){const u=function(e,t){if(!1===e)return[];if(!0===e||"all"===e)return["brush","zoom","legend"];if(Array.isArray(e))return e;if(e)return[e];const r=[];return t.brush&&r.push("brush"),t.zoom&&r.push("zoom"),t.legend&&r.push("legend"),r}(e,{brush:i,zoom:l,legend:s});return 0===u.length?null:(0,z.jsxs)("div",{className:n,role:"group","aria-label":o,style:{display:"grid",gridTemplateColumns:r?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...a},children:[u.includes("brush")&&(0,z.jsx)(R,{brush:i,targetSize:t}),u.includes("zoom")&&(0,z.jsx)(V,{zoom:l,targetSize:t}),u.includes("legend")&&(0,z.jsx)(Z,{legend:s,targetSize:t})]})}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import*as e from"react";import{useRef as t}from"react";var r=["value","threshold","partition-boundary","time-window","range-boundary"];function n({controlType:e,controlId:t,chartId:r,chartType:n="VisualizationControl",onObservation:a}){return(o,i,l)=>{a?.({type:o,controlType:e,value:i,chartType:n,timestamp:Date.now(),...t?{controlId:t}:{},...r?{chartId:r}:{},...l?{source:l}:{}})}}import{jsx as a,jsxs as o}from"react/jsx-runtime";function i(e,t,r,n){return Math.min(r,Math.max(t,Number((t+Math.round((Math.min(r,Math.max(t,e))-t)/n)*n).toFixed(12))))}function l({value:r,onChange:l,pointerToValue:s,min:c,max:u,step:d=1,largeStep:p=5*d,x:m,y:h,controlType:g="value",controlId:b,label:f,valueText:y,radius:v=12,fill:x="var(--semiotic-bg, #ffffff)",stroke:$="var(--semiotic-primary, #4e79a7)",strokeWidth:C=4,labelText:k,labelDx:w=16,labelDy:M=-16,labelClassName:T,className:z,disabled:S=!1,onChangeStart:I,onChangeEnd:A,onObservation:P,chartId:D,chartType:N}){const R=t(null),V=t(r);V.current=r;const Z=e.useMemo(()=>n({controlType:g,controlId:b,chartId:D,chartType:N,onObservation:P}),[D,N,b,g,P]),W=e=>{if(S)return;const t=s(e);if(null==t||!Number.isFinite(t))return;const r=i(t,c,u,d);V.current=r,l(r),Z("control-change",r,"pointer")},L=e=>{e.stopPropagation(),R.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),R.current=null,A?.(V.current),Z("control-end",V.current,"pointer"))},O=["semiotic-direct-manipulation-control",z].filter(Boolean).join(" ");return o("g",{className:O,role:"slider",tabIndex:S?-1:0,"aria-disabled":S||void 0,"aria-label":f,"aria-valuemin":c,"aria-valuemax":u,"aria-valuenow":r,"aria-valuetext":y??`${f}: ${r}`,"aria-roledescription":"visualization control","data-viz-control":g,"data-viz-control-id":b,"data-viz-control-state":"controlled",pointerEvents:"all",onPointerDown:e=>{S||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),R.current=e.pointerId,I?.(V.current),Z("control-start",V.current,"pointer"),W(e))},onPointerMove:e=>{e.stopPropagation(),R.current===e.pointerId&&W(e)},onPointerUp:L,onPointerCancel:L,onLostPointerCapture:L,onKeyDown:e=>{if(S)return;const t=e.shiftKey?p:d,r=V.current;let n=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(n=r-t),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(n=r+t),"Home"===e.key&&(n=c),"End"===e.key&&(n=u),null===n)return;e.preventDefault();const a=i(n,c,u,d);V.current=a,l(a),Z("control-change",a,"keyboard")},style:{cursor:S?"default":"grab",touchAction:"none"},children:[a("circle",{className:"semiotic-direct-manipulation-control__hit",cx:m,cy:h,r:v+10,fill:"transparent"}),a("circle",{className:"semiotic-direct-manipulation-control__handle",cx:m,cy:h,r:v,fill:x,stroke:$,strokeWidth:C}),k?a("text",{className:T,x:m+w,y:h+M,fill:$,children:k}):null]})}function s(e,t,r,n,a){return{id:e,...t?{controlId:t}:{},status:r,message:n,...a?{remediation:a}:{}}}function c({controls:e=[],minimumTargetSize:t=24}){const n=[],a=new Set;for(const o of e){const e=o?.id,i="controls."+(e||"unknown"),l=o?.domain,c=Array.isArray(l)&&2===l.length&&Number.isFinite(l[0])&&Number.isFinite(l[1])&&l[1]>l[0],u=r.includes(o?.type),d="string"==typeof o?.target&&o.target.trim().length>0,p=["slider","buttons","native-range"].includes(o?.keyboard??""),m=o?.minimumTargetSize;n.push(s(i+".semantic-type",e,u?"pass":"fail",u?`Control uses the semantic type "${o.type}".`:"Control has no recognized semantic type.","Use one of VISUALIZATION_CONTROL_TYPES.")),n.push(s(i+".state-binding",e,d?"pass":"fail",d?`Control is bound to "${o.target}".`:"Control has no declarative state binding.","Declare the controlled state key with target.")),n.push(s(i+".domain",e,c?"pass":"fail",c?"Control has a finite ordered value domain.":"Control has no finite ordered value domain.","Declare domain as [minimum, maximum].")),n.push(s(i+".keyboard",e,p?"pass":"fail",p?`Control declares a ${o.keyboard} keyboard path.`:"Control does not declare a keyboard path.","Declare slider, buttons, or native-range keyboard interaction.")),n.push(s(i+".value-text",e,"string"==typeof o?.valueText&&o.valueText.trim().length>0?"pass":"fail","string"==typeof o?.valueText&&o.valueText.trim().length>0?"Control declares human-readable value text.":"Control does not declare human-readable value text.","Provide valueText, typically with a {value} placeholder.")),n.push(s(i+".target-size",e,"number"!=typeof m||t>m?"fail":"pass","number"!=typeof m||t>m?`Control target is below the ${t}px minimum or undeclared.`:`Control declares a ${m}px target.`,`Declare minimumTargetSize of at least ${t}.`)),null!=o?.step&&n.push(s(i+".step",e,Number.isFinite(o.step)&&o.step>0?"pass":"fail",Number.isFinite(o.step)&&o.step>0?"Control has a positive quantization step.":"Control step must be a positive finite number.","Use a positive finite step.")),o?.observations?.length&&n.push(s(i+".observations",e,o.observations.includes("control-change")?"pass":"warn",o.observations.includes("control-change")?"Control declares control-change observation coverage.":"Control declares observations but omits control-change.","Include control-change so observable state changes are represented.")),e&&!a.has(e)||n.push(s(i+".identity",e,"fail",e?"Control id is duplicated.":"Control id is missing.","Use a unique stable control id.")),e&&a.add(e)}return{ok:n.every(e=>"fail"!==e.status),findings:n}}import{useRef as u}from"react";var d=2*Math.PI;function p(e,t,r){const n=r?.center?.x??0,a=r?.center?.y??0;return{x:n+Math.sin(e)*t,y:a-Math.cos(e)*t}}function m(e,t,r,n,a){const o=a?.center,i=(e,t)=>{const{x:r,y:n}=p(e,t,{center:o});return`${h(r)},${h(n)}`},l=Math.max(0,r),s=Math.max(l,n),c=Math.abs(t-e),u=e>t?0:1;if(c>=d-1e-6){const e=o?.x??0,t=o?.y??0,r=`${h(e)},${h(t-s)}`,n=`${h(e)},${h(t+s)}`;let a=`M${r} A${h(s)},${h(s)} 0 1 1 ${n} A${h(s)},${h(s)} 0 1 1 ${r} Z`;if(l>0){const r=`${h(e)},${h(t-l)}`,n=`${h(e)},${h(t+l)}`;a+=` M${r} A${h(l)},${h(l)} 0 1 0 ${n} A${h(l)},${h(l)} 0 1 0 ${r} Z`}return a}const m=c>Math.PI?1:0,g=i(e,s),b=i(t,s);if(0>=l){const e=o?.x??0,t=o?.y??0;return`M${h(e)},${h(t)} L${g} A${h(s)},${h(s)} 0 ${m} ${u} ${b} Z`}const f=i(t,l),y=i(e,l);return`M${g} A${h(s)},${h(s)} 0 ${m} ${u} ${b} L${f} A${h(l)},${h(l)} 0 ${m} ${1===u?0:1} ${y} Z`}function h(e){return Math.round(1e3*e)/1e3}function g(e,t,r=0){return t>0?((e-r)%t+t)%t+r:e}import{jsx as b,jsxs as f}from"react/jsx-runtime";function y({value:e,onChange:t,period:r=365,radius:n=180,innerRadius:a=14,width:o,height:i,step:l=1,largeStep:s=7,label:c="Range",formatValue:h,arcFill:y="var(--semiotic-primary, #4e79a7)",stroke:v="var(--semiotic-bg, #ffffff)",className:x,style:$}){const C=o??2*n+40,k=i??2*n+40,w=C/2,M=k/2,T=function(e){const[t,r]=e,n=r-t||1,a=d;return e=>0+(e-t)/n*(a-0)}([0,r]),z=u(null),S=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,n=t.getBoundingClientRect(),a=t.viewBox?.baseVal;return Math.round((Math.atan2((a?.width||C)/(n.width||1)*(e.clientX-n.left)-w-0,-((a?.height||k)/(n.height||1)*(e.clientY-n.top)-M-0))+d)%d/d*r)%r},I=(e,t)=>{e.preventDefault(),e.stopPropagation();const r=e.currentTarget.ownerSVGElement;r?.setPointerCapture?.(e.pointerId),z.current={mode:t,lastValue:S(e)}},A=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),z.current=null},P=(e,n)=>{t("range"===e?e=>({start:g(e.start+n,r),end:g(e.end+n,r)}):t=>({...t,[e]:g(t[e]+n,r)}))},D=e=>t=>{const r=t.shiftKey?s:l;"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),P(e,r)):"ArrowLeft"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),P(e,-r))},N=e.start>e.end?[[e.start,r],[0,e.end]]:[[e.start,e.end]],R=e=>h?h(e):e+"";return b("svg",{viewBox:`0 0 ${C} ${k}`,width:C,height:k,className:x,onPointerMove:e=>{const n=z.current;if(!n)return;const a=S(e);if("range"===n.mode){const e=function(e,t,r){if(0>=r)return t-e;let n=(t-e)%r;return n>r/2?n-=r:-r/2>n&&(n+=r),n}(n.lastValue,a,r);if(0===e)return;return n.lastValue=a,void t(t=>({start:g(t.start+e,r),end:g(t.end+e,r)}))}t(e=>({...e,[n.mode]:a}))},onPointerUp:A,onPointerCancel:A,onLostPointerCapture:A,style:{touchAction:"none",...$},"aria-label":c+" brush",children:f("g",{transform:`translate(${w},${M})`,children:[b("g",{role:"slider",tabIndex:0,"aria-label":c+" (move both ends)","aria-valuemin":0,"aria-valuemax":r-1,"aria-valuenow":e.start,"aria-valuetext":`${R(e.start)} to ${R(e.end)}`,onPointerDown:e=>I(e,"range"),onKeyDown:D("range"),style:{cursor:"grab"},children:N.map(([e,t],r)=>b("path",{d:m(T(e),T(t),a,n),fill:y,fillOpacity:.35,stroke:v,strokeWidth:1},r))}),["start","end"].map(t=>{const o=e[t],i=(e=>p(T(e),a))(o),l=(e=>p(T(e),n+8))(o);return f("g",{role:"slider",tabIndex:0,"aria-label":`${c} ${t}`,"aria-valuemin":0,"aria-valuemax":r-1,"aria-valuenow":o,"aria-valuetext":R(o),onPointerDown:e=>I(e,t),onKeyDown:D(t),style:{cursor:"grab"},children:[b("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:"transparent",strokeWidth:20}),b("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:v,strokeWidth:1.5}),b("circle",{cx:l.x,cy:l.y,r:4.5,fill:v,stroke:y,strokeWidth:1})]},t)})]})})}import*as v from"react";import{jsx as x,jsxs as $}from"react/jsx-runtime";function C(e,t,r=0){const n=Math.min(t[0],t[1]),a=Math.max(t[0],t[1]),o=Math.max(n,Math.min(a,e[0])),i=Math.max(n,Math.min(a,e[1])),l=o>i?[i,o]:[o,i];if(l[1]-l[0]>=r)return l;const s=(l[0]+l[1])/2,c=r/2;return[Math.max(n,Math.min(a-r,s-c)),Math.min(a,Math.max(n+r,s+c))]}function k(e,t,r,n=1,a=n){const o="in"===r?n:-n;return C([e[0]+o,e[1]-o],t,a)}function w(e){const{domain:t,initialValue:r=t,step:n=1,minSpan:a=n,label:o,formatValue:i,onChange:l}=e,[s,c]=v.useState(()=>C(r,t,a)),u=C(s,t,a),d=v.useCallback(e=>{const r=C(e,t,a);c(r),l?.(r)},[t,a,l]),p=v.useMemo(()=>({label:o,domain:t,value:u,step:n,formatValue:i,onChange:d,onClear:()=>d(t)}),[t,i,o,d,n,u]),m=v.useMemo(()=>({onZoomIn:()=>d(k(u,t,"in",n,a)),onZoomOut:()=>d(k(u,t,"out",n,a)),onReset:()=>d(t)}),[t,a,d,n,u]);return{value:u,setValue:d,xExtent:u,brush:p,zoom:m}}var M={display:"grid",gap:8,padding:"10px 12px",border:"1px solid var(--semiotic-border, #d8dee4)",borderRadius:12,background:"var(--semiotic-surface, var(--semiotic-bg, rgba(255,255,255,0.92)))"},T={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function z(e,t){return{minWidth:e,minHeight:e,padding:"0 12px",borderRadius:999,border:"1px solid var(--semiotic-border, #d8dee4)",background:t?"var(--semiotic-primary, #0969da)":"var(--semiotic-bg, #fff)",color:t?"var(--semiotic-on-primary, #fff)":"var(--semiotic-text, #24292f)",fontSize:13,fontWeight:650,touchAction:"manipulation"}}function S(e){return"function"==typeof e}function I({brush:e,targetSize:t}){const r=e?.value,n=e?.domain,a=!!r&&!!n,o=!0===e?.disabled,i=e?.formatValue??(e=>e),l=!!e?.onChange&&a&&!o,s=n?.[0]??0,c=n?.[1]??1,u=r?.[0]??s,d=r?.[1]??c,p=e?.step??((c-s)/100||1);return $("section",{style:M,"aria-label":"Brush controls",children:[x("div",{style:T,children:e?.label??"Filter range"}),a?$("div",{style:{display:"grid",gap:8},children:[$("label",{style:{display:"grid",gap:4,fontSize:12},children:[$("span",{children:["Start: ",i(u)]}),x("input",{type:"range",min:s,max:c,step:p,value:u,disabled:!l,style:{minHeight:t},onChange:t=>{const r=Number(t.currentTarget.value);e?.onChange?.([Math.min(r,d),d])}})]}),$("label",{style:{display:"grid",gap:4,fontSize:12},children:[$("span",{children:["End: ",i(d)]}),x("input",{type:"range",min:s,max:c,step:p,value:d,disabled:!l,style:{minHeight:t},onChange:t=>{const r=Number(t.currentTarget.value);e?.onChange?.([u,Math.max(r,u)])}})]})]}):x("div",{style:{fontSize:12,color:"var(--semiotic-text-secondary, #57606a)"},children:"Provide a brush domain and value to expose range inputs beside the drag gesture."}),x("button",{type:"button",disabled:o||!S(e?.onClear),onClick:e?.onClear,style:z(t),children:"Clear range"})]})}function A({zoom:e,targetSize:t}){const r=!0===e?.disabled;return $("section",{style:M,"aria-label":"Zoom controls",children:[x("div",{style:T,children:e?.label??"Zoom"}),$("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[x("button",{type:"button","aria-label":"Zoom out",disabled:r||!S(e?.onZoomOut),onClick:e?.onZoomOut,style:z(t),children:"-"}),x("button",{type:"button","aria-label":"Reset zoom",disabled:r||!S(e?.onReset),onClick:e?.onReset,style:z(t),children:"Reset"}),x("button",{type:"button","aria-label":"Zoom in",disabled:r||!S(e?.onZoomIn),onClick:e?.onZoomIn,style:z(t),children:"+"})]})]})}function P({legend:e,targetSize:t}){const r=!0===e?.disabled,n=e?.items??[];return $("section",{style:M,"aria-label":"Legend controls",children:[x("div",{style:T,children:e?.label??"Series"}),n.length>0&&x("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:n.map(n=>{const a=!1!==n.active;return $("button",{type:"button",disabled:r||n.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(n.id,!a),style:z(t,a),"aria-pressed":a,children:[n.color&&x("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:n.color}}),n.label??n.id]},n.id)})}),$("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[x("button",{type:"button",disabled:r||!S(e?.onShowAll),onClick:e?.onShowAll,style:z(t),children:"Show all"}),x("button",{type:"button",disabled:r||!S(e?.onHideAll),onClick:e?.onHideAll,style:z(t),children:"Hide all"})]})]})}function D({controls:e,targetSize:t=44,compact:r=!1,className:n,style:a,ariaLabel:o="Mobile chart controls",brush:i,zoom:l,legend:s}){const c=function(e,t){if(!1===e)return[];if(!0===e||"all"===e)return["brush","zoom","legend"];if(Array.isArray(e))return e;if(e)return[e];const r=[];return t.brush&&r.push("brush"),t.zoom&&r.push("zoom"),t.legend&&r.push("legend"),r}(e,{brush:i,zoom:l,legend:s});return 0===c.length?null:$("div",{className:n,role:"group","aria-label":o,style:{display:"grid",gridTemplateColumns:r?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...a},children:[c.includes("brush")&&x(I,{brush:i,targetSize:t}),c.includes("zoom")&&x(A,{zoom:l,targetSize:t}),c.includes("legend")&&x(P,{legend:s,targetSize:t})]})}export{y as CircularBrush,l as DirectManipulationControl,D as MobileStandardControls,r as VISUALIZATION_CONTROL_TYPES,c as auditVisualizationControls,C as clampMobileRange,n as createControlObservationAdapter,w as useMobileRangeControls,k as zoomMobileRange};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{forceCenter as e,forceCollide as t,forceLink as o,forceManyBody as n,forceSimulation as r,forceX as f,forceY as a}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,b=i.centerStrength??.018,y=i.damping??.84,p=i.nodeRadius??12,m=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()})),q=new Set(c.map(e=>e.id)),I=s.filter(e=>q.has(e.source)&&q.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-y))).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 p?p(e.data):p)(e)+m).strength(.9).iterations(2)).force("center",e(k,k).strength(.8)).force("x",f(k).strength(b)).force("y",a(k).strength(b));I.length>0&&c.force("link",o(I).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 R=1/0,v=1/0,z=-1/0,$=-1/0;for(const e of w){const t=e.x??k,o=e.y??k;t<R&&(R=t),o<v&&(v=o),t>z&&(z=t),o>$&&($=o)}const E=z-R,_=$-v,C={};for(const e of w)C[e.id]={x:0===E?.5:M+((e.x??k)-R)/E*(1-2*M),y:0===_?.5:M+((e.y??k)-v)/_*(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 b}from"d3-scale";function y(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function p(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function m(e){const t=e.map(y),o=t.length-1;return e=>{if(e<=0){const[e,o,n]=t[0];return p(e,o,n)}if(e>=1){const[e,n,r]=t[o];return p(e,n,r)}const n=e*o,r=Math.floor(n),f=n-r,[a,c,s]=t[r],[i,d,u]=t[r+1];return p(Math.round(a+(i-a)*f),Math.round(c+(d-c)*f),Math.round(s+(u-s)*f))}}var M=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];m(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),m(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),m(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),m(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),m(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),m(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),m(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),m(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),m(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),m(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),m(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),m(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),m(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),m(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),m(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),m(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),m(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),m(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),m(["#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,f=n[0]/2,a=n[1]/2,c=o.__previousPositions;let b=0;const y=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=c?.get(t.id);e?b++:o?(t.x=o.x,t.y=o.y,b++):y.push(t)}const p=e.length>0?y.length/e.length:1,m=b>0&&p<=.3;if(m){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of y){const n=q(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=I(e.id),f=r%360*(Math.PI/180),a=10+r%20;e.x=t/n.length+a*Math.cos(f),e.y=o/n.length+a*Math.sin(f)}else{const t=I(e.id),o=t%360*(Math.PI/180),n=15+t%30;e.x=f+n*Math.cos(o),e.y=a+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),r=o*t;n.x=f+e*Math.cos(r),n.y=a+e*Math.sin(r)}}}const M=e.length,x=o.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(M-30)))),S=o.__skipForceSimulation||0===o.iterations?0:m?40:x,k=R(o.nodeSize,o.nodeSizeRange,e),w=e=>k(e);if(S>0){const o=new Map,n=new Map;for(const t of e)o.set(t.id,0),n.set(t.id,t);for(const e of t){const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id;o.set(t,(o.get(t)??0)+1),o.set(n,(o.get(n)??0)+1)}const c=l().strength(e=>{const t=e.weight,n="string"==typeof e.source?e.source:e.source.id,f="string"==typeof e.target?e.target:e.target.id,a=Math.max(1,Math.min(o.get(n)??1,o.get(f)??1)),c=t&&t>0?Math.sqrt(t):1;return Math.min(2.5,c*r/(.1*a))}).distance(e=>{const t="string"==typeof e.source?n.get(e.source):e.source,o="string"==typeof e.target?n.get(e.target):e.target,r=(t?w(t):0)+(o?w(o):0)+12;return Math.max(40,r)}).id(e=>e.id),b=s().force("charge",g().strength(e=>{const t=o.get(e.id)??0;return-15*w(e)*Math.sqrt(t+1)})).force("collide",h(e=>w(e)+3).strength(.9).iterations(2)).force("center",i(f,a).strength(.8)).force("x",d(f).strength(.06)).force("y",u(a).strength(.06));if(b.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}));c.links(e),b.force("link",c)}m?b.alpha(.3):b.alpha()<.1&&b.alpha(1),b.stop();for(let e=0;e<S;++e)b.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=w(t);t.x=Math.max(e,Math.min(n[0]-e,t.x)),t.y=Math.max(e,Math.min(n[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=v.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=v.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,n){const r=o.nodeStyle,f=o.edgeStyle,a=R(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=a(k(t,"nodeSize")),n=r?r(k(t,"nodeStyle")):{},f={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:f,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=f?f(k(e,"edgeStyle")):{},a={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:a,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=a(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 q(e,t,o){const n=[];for(const r of t){const t="string"==typeof r.source?r.source:r.source.id,f="string"==typeof r.target?r.target:r.target.id;let a=null;if(t===e?a=f:f===e&&(a=t),a){const e=o.get(a);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function I(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 R(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[f,a]=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(f===a)return()=>(n[0]+n[1])/2;const c=b().domain([f,a]).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}})}};
|