semiotic 3.8.0 → 3.8.2
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 +14 -9
- package/README.md +56 -55
- package/ai/behaviorContracts.cjs +9 -0
- package/ai/dist/mcp-server.js +240 -30
- package/ai/schema.json +616 -42
- package/ai/surface-manifest.json +3 -2
- package/ai/system-prompt.md +7 -3
- package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +20 -0
- package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +2 -0
- package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +1 -0
- package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +2 -0
- package/dist/chunk-chunk-255KDHW5.module.min.js +1 -0
- package/dist/chunk-chunk-27HVVXS6.module.min.js +1 -0
- package/dist/chunk-chunk-2CXCXRB4.module.min.js +1 -0
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +2 -0
- package/dist/chunk-chunk-2UN3ANRN.module.min.js +2 -0
- package/dist/chunk-chunk-2VUEY5TH.module.min.js +1 -0
- package/dist/chunk-chunk-2WVCH4PL.module.min.js +1 -0
- package/dist/chunk-chunk-5UKL5W76.module.min.js +2 -0
- package/dist/chunk-chunk-5WEFWNUW.module.min.js +2 -0
- package/dist/chunk-chunk-6F6GEAQU.module.min.js +1 -0
- package/dist/chunk-chunk-7LHMKRKE.module.min.js +2 -0
- package/dist/chunk-chunk-BHYTYMY2.module.min.js +2 -0
- package/dist/chunk-chunk-C6EJ4IOD.module.min.js +2 -0
- package/dist/chunk-chunk-CA3YDW6F.module.min.js +1 -0
- package/dist/chunk-chunk-CP3EN6KZ.module.min.js +1 -0
- package/dist/chunk-chunk-CYIML3AV.module.min.js +2 -0
- package/dist/chunk-chunk-DNY43POY.module.min.js +1 -0
- package/dist/chunk-chunk-DSNGDNJY.module.min.js +1 -0
- package/dist/chunk-chunk-E7MIQX7D.module.min.js +2 -0
- package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
- package/dist/chunk-chunk-ES4DCG3L.module.min.js +1 -0
- package/dist/chunk-chunk-FAKO3RGQ.module.min.js +2 -0
- package/dist/chunk-chunk-FYY2ACNJ.module.min.js +2 -0
- package/dist/chunk-chunk-G7WFWHAD.module.min.js +2 -0
- package/dist/chunk-chunk-GMQ5AYTD.module.min.js +1 -0
- package/dist/chunk-chunk-H4PPRW6N.module.min.js +1 -0
- package/dist/chunk-chunk-IFYPMWKY.module.min.js +1 -0
- package/dist/chunk-chunk-J3ELI22J.module.min.js +1 -0
- package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
- package/dist/chunk-chunk-J3XWETBJ.module.min.js +2 -0
- package/dist/chunk-chunk-JCG72SGW.module.min.js +2 -0
- package/dist/{semiotic-ai-chunk-OG7BQUUW.module.min.js → chunk-chunk-JJ2OOIET.module.min.js} +0 -1
- package/dist/chunk-chunk-KTWEBFMX.module.min.js +2 -0
- package/dist/chunk-chunk-L6D3I3V7.module.min.js +2 -0
- package/dist/chunk-chunk-M337NY6L.module.min.js +1 -0
- package/dist/chunk-chunk-NO4MCQVD.module.min.js +1 -0
- package/dist/chunk-chunk-ODUZEEBH.module.min.js +2 -0
- package/dist/chunk-chunk-P6UBCMSQ.module.min.js +2 -0
- package/dist/chunk-chunk-Q2YADC2V.module.min.js +2 -0
- package/dist/chunk-chunk-QRIBHZYW.module.min.js +1 -0
- package/dist/chunk-chunk-QSQVBIJA.module.min.js +1 -0
- package/dist/chunk-chunk-RCF52Z42.module.min.js +2 -0
- package/dist/chunk-chunk-RH5TSQPH.module.min.js +1 -0
- package/dist/chunk-chunk-ROP4HI7H.module.min.js +2 -0
- package/dist/chunk-chunk-RZH7VZYS.module.min.js +2 -0
- package/dist/chunk-chunk-SIRIJ3DY.module.min.js +1 -0
- package/dist/chunk-chunk-STZFFTAN.module.min.js +2 -0
- package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
- package/dist/chunk-chunk-T27ZEV6A.module.min.js +1 -0
- package/dist/chunk-chunk-U3AGQ5EF.module.min.js +2 -0
- package/dist/chunk-chunk-U66USBWU.module.min.js +1 -0
- package/dist/chunk-chunk-VVCA3DB7.module.min.js +1 -0
- package/dist/chunk-chunk-W3DB2MN4.module.min.js +2 -0
- package/dist/chunk-chunk-WCX6U47H.module.min.js +2 -0
- package/dist/chunk-chunk-WDIN4LRC.module.min.js +1 -0
- package/dist/chunk-chunk-XEVJDUTH.module.min.js +1 -0
- package/dist/chunk-chunk-XOYX77KF.module.min.js +2 -0
- package/dist/chunk-chunk-YCQYG6J5.module.min.js +2 -0
- package/dist/chunk-chunk-YHNZCPOZ.module.min.js +2 -0
- package/dist/chunk-chunk-YWZB3KPI.module.min.js +2 -0
- package/dist/chunk-chunk-Z5KXAVQD.module.min.js +2 -0
- package/dist/chunk-chunk-ZCNBUZPL.module.min.js +2 -0
- package/dist/chunk-chunk-ZLKRTF5N.module.min.js +2 -0
- package/dist/chunk-chunk-ZTNVDWAK.module.min.js +2 -0
- package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +2 -0
- package/dist/components/AccessibleNavTree.d.ts +7 -1
- package/dist/components/ai/chartClinicMetadata.generated.d.ts +15 -0
- package/dist/components/ai/useNavigationSync.d.ts +17 -2
- package/dist/components/chartContainerMobile.d.ts +9 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +19 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +14 -2
- package/dist/components/charts/geo/FlowMap.d.ts +10 -6
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +14 -2
- package/dist/components/charts/index.d.ts +6 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +9 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +11 -0
- package/dist/components/charts/network/SankeyDiagram.d.ts +9 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +21 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +11 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +11 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +7 -0
- package/dist/components/charts/physics/EventDropChart.d.ts +7 -0
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +8 -0
- package/dist/components/charts/physics/PhysicalFlowChart.d.ts +7 -0
- package/dist/components/charts/physics/PhysicsCustomChart.d.ts +4 -25
- package/dist/components/charts/physics/PhysicsPileChart.d.ts +7 -0
- package/dist/components/charts/physics/physicsChartShared.d.ts +17 -1
- package/dist/components/charts/physics/physicsCustomLayout.d.ts +32 -0
- package/dist/components/charts/shared/AnnotationLabel.d.ts +88 -0
- package/dist/components/charts/shared/annotationActivation.d.ts +35 -0
- package/dist/components/charts/shared/annotationLabelLayout.d.ts +5 -0
- package/dist/components/charts/shared/annotationRules.d.ts +2 -1
- package/dist/components/charts/shared/auditAccessibilityText.d.ts +13 -0
- package/dist/components/charts/shared/chartSelectionUtils.d.ts +4 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +3 -3
- package/dist/components/charts/shared/datumTypes.d.ts +2 -0
- package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +2 -0
- package/dist/components/charts/shared/formatUtils.d.ts +3 -3
- package/dist/components/charts/shared/hatchFill.d.ts +87 -0
- package/dist/components/charts/shared/hooks.d.ts +7 -6
- package/dist/components/charts/shared/knownChartComponents.d.ts +9 -0
- package/dist/components/charts/shared/leastSquaresRegression.d.ts +16 -0
- package/dist/components/charts/shared/mergeShapeStyle.d.ts +3 -2
- package/dist/components/charts/shared/semanticInteractions.d.ts +42 -0
- package/dist/components/charts/shared/sparseArray.d.ts +1 -1
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +6 -4
- package/dist/components/charts/shared/styleRules.d.ts +205 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +22 -9
- package/dist/components/charts/shared/types.d.ts +9 -6
- package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +16 -2
- package/dist/components/charts/shared/useChartSetup.d.ts +2 -2
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
- package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -2
- package/dist/components/charts/shared/useLikertAggregation.d.ts +4 -4
- package/dist/components/charts/shared/useOrdinalBrush.d.ts +2 -1
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +24 -1
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/shared/useXYLineStyle.d.ts +10 -0
- package/dist/components/charts/shared/useXYPointStyle.d.ts +19 -1
- package/dist/components/charts/shared/validateChartData.d.ts +7 -5
- package/dist/components/charts/shared/validationMap.d.ts +11 -2
- package/dist/components/charts/shared/validationMap.generated.d.ts +6 -0
- package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
- package/dist/components/charts/value/targetPresentation.d.ts +22 -0
- package/dist/components/charts/value/types.d.ts +5 -6
- package/dist/components/charts/xy/AreaChart.d.ts +8 -0
- package/dist/components/charts/xy/BubbleChart.d.ts +9 -0
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +1 -52
- package/dist/components/charts/xy/Heatmap.d.ts +2 -2
- package/dist/components/charts/xy/LineChart.d.ts +11 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +7 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +10 -0
- package/dist/components/charts/xy/StackedAreaChart.d.ts +7 -0
- package/dist/components/charts/xy/differenceSegments.d.ts +49 -0
- package/dist/components/charts/xy/scatterplotMatrixInteractionTypes.d.ts +12 -0
- package/dist/components/controls/SentenceFilter.d.ts +97 -0
- package/dist/components/data/fromVegaLite.d.ts +19 -9
- package/dist/components/rough/createRoughRenderMode.d.ts +46 -0
- package/dist/components/semiotic-ai.d.ts +3 -1
- package/dist/components/semiotic-controls.d.ts +2 -0
- package/dist/components/semiotic-geo.d.ts +4 -0
- package/dist/components/semiotic-network.d.ts +4 -0
- package/dist/components/semiotic-ordinal.d.ts +6 -0
- package/dist/components/semiotic-physics.d.ts +4 -0
- package/dist/components/semiotic-rough.d.ts +4 -0
- package/dist/components/semiotic-utils-core.d.ts +4 -0
- package/dist/components/semiotic-xy.d.ts +4 -0
- package/dist/components/semiotic.d.ts +9 -1
- package/dist/components/server/optionalImageTypes.d.ts +37 -0
- package/dist/components/server/serverChartConfigShared.d.ts +9 -5
- package/dist/components/server/serverChartConfigs.d.ts +4 -4
- package/dist/components/server/staticAnnotations.d.ts +6 -3
- package/dist/components/server/staticLegend.d.ts +1 -1
- package/dist/components/server/staticNetwork.d.ts +4 -4
- package/dist/components/server/staticSVGChrome.d.ts +5 -4
- package/dist/components/store/ObservationStore.d.ts +21 -1
- package/dist/components/stream/AccessibleDataTable.d.ts +4 -10
- package/dist/components/stream/AriaLiveTooltip.d.ts +9 -0
- package/dist/components/stream/CanvasHitTester.d.ts +4 -4
- package/dist/components/stream/DataSourceAdapter.d.ts +1 -1
- package/dist/components/stream/FrameRuntime.d.ts +57 -0
- package/dist/components/stream/GeoParticlePool.d.ts +1 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +43 -12
- package/dist/components/stream/GeoSVGOverlay.d.ts +64 -0
- package/dist/components/stream/NetworkCanvasHitTester.d.ts +2 -1
- package/dist/components/stream/NetworkPipelineStore.d.ts +24 -21
- package/dist/components/stream/NetworkSSRFrame.d.ts +17 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +6 -0
- package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -2
- package/dist/components/stream/OrdinalBrushOverlayLazy.d.ts +9 -0
- package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -2
- package/dist/components/stream/OrdinalPipelineStore.d.ts +13 -13
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +9 -1
- package/dist/components/stream/OrdinalStyleResolver.d.ts +12 -0
- package/dist/components/stream/ParticlePool.d.ts +1 -1
- package/dist/components/stream/PipelineStore.d.ts +12 -16
- package/dist/components/stream/SVGOverlay.d.ts +6 -0
- package/dist/components/stream/SceneGraph.d.ts +3 -3
- package/dist/components/stream/XYBrushOverlayLazy.d.ts +17 -0
- package/dist/components/stream/accessorUtils.d.ts +2 -2
- package/dist/components/stream/annotationAccessorResolver.d.ts +2 -2
- package/dist/components/stream/frameGraphics.d.ts +4 -0
- package/dist/components/stream/frameKeyboardNavigation.d.ts +45 -0
- package/dist/components/stream/geoPipelineHelpers.d.ts +3 -3
- package/dist/components/stream/geoPipelineUpdateResults.d.ts +34 -0
- package/dist/components/stream/geoSceneBuilder.d.ts +16 -0
- package/dist/components/stream/geoTypes.d.ts +48 -15
- package/dist/components/stream/hitTestUtils.d.ts +2 -2
- package/dist/components/stream/hoverUtils.d.ts +4 -2
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +1 -0
- package/dist/components/stream/layouts/hierarchyUtils.d.ts +2 -2
- package/dist/components/stream/networkCustomLayoutRunner.d.ts +23 -0
- package/dist/components/stream/networkCustomRestyle.d.ts +15 -0
- package/dist/components/stream/networkFrameAnimation.d.ts +7 -0
- package/dist/components/stream/networkFrameHandleTypes.d.ts +39 -0
- package/dist/components/stream/networkFrameObservations.d.ts +15 -0
- package/dist/components/stream/networkFramePaint.d.ts +11 -2
- package/dist/components/stream/networkInteractionTypes.d.ts +26 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +2 -2
- package/dist/components/stream/networkPipelineUpdateResults.d.ts +38 -0
- package/dist/components/stream/networkTypes.d.ts +37 -56
- package/dist/components/stream/ordinalCanvasRenderers.d.ts +2 -2
- package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +20 -1
- package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -2
- package/dist/components/stream/ordinalTypes.d.ts +30 -3
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +2 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +6 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +21 -6
- package/dist/components/stream/physics/physicsFrameObservations.d.ts +19 -0
- package/dist/components/stream/physics/physicsFrameSetup.d.ts +4 -0
- package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +19 -1
- package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +3 -1
- package/dist/components/stream/pipelineConfig.d.ts +4 -2
- package/dist/components/stream/pipelineDecay.d.ts +2 -2
- package/dist/components/stream/pipelinePulse.d.ts +2 -2
- package/dist/components/stream/pipelineStoreUpdateResults.d.ts +23 -2
- package/dist/components/stream/pipelineTransitions.d.ts +1 -1
- package/dist/components/stream/pipelineUpdateContract.d.ts +7 -0
- package/dist/components/stream/pipelineUpdateStore.d.ts +21 -0
- package/dist/components/stream/renderBackend.d.ts +27 -0
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +15 -1
- package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +3 -2
- package/dist/components/stream/renderers/networkParticleRenderer.d.ts +1 -1
- package/dist/components/stream/sceneRenderBackendTypes.d.ts +28 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +31 -4
- package/dist/components/stream/streamSemanticTypes.d.ts +16 -0
- package/dist/components/stream/streamThemeTypes.d.ts +14 -0
- package/dist/components/stream/svgOverlayUtils.d.ts +10 -0
- package/dist/components/stream/test-utils/frameScheduler.d.ts +12 -0
- package/dist/components/stream/test-utils/revisionConsumption.d.ts +13 -0
- package/dist/components/stream/titleLayout.d.ts +31 -0
- package/dist/components/stream/types.d.ts +30 -65
- package/dist/components/stream/useCanvasFrameHost.d.ts +71 -0
- package/dist/components/stream/useFrame.d.ts +23 -0
- package/dist/components/stream/useLegendCategoryEmission.d.ts +3 -3
- package/dist/components/stream/useSemanticFrameInteractions.d.ts +22 -0
- package/dist/components/stream/useUpdateResultSnapshot.d.ts +7 -0
- package/dist/components/stream/xyFrameAxisTypes.d.ts +50 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -5
- package/dist/controls.min.js +1 -1
- package/dist/controls.module.min.js +1 -1
- package/dist/forceLayoutWorker.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +1 -1
- package/dist/physics-matter.module.min.js +1 -1
- package/dist/physics-rapier.min.js +1 -1
- package/dist/physics-rapier.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -0
- package/dist/rough.module.min.js +1 -0
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +3 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-controls.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +4 -0
- package/dist/semiotic-network.d.ts +4 -0
- package/dist/semiotic-ordinal.d.ts +6 -0
- package/dist/semiotic-physics.d.ts +4 -0
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-realtime-react.min.js +1 -1
- package/dist/semiotic-realtime-react.module.min.js +1 -1
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes-react.min.js +1 -1
- package/dist/semiotic-recipes-react.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-rough.d.ts +4 -0
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-themes-core.min.js +1 -1
- package/dist/semiotic-themes-core.module.min.js +1 -1
- package/dist/semiotic-themes-react.min.js +1 -1
- package/dist/semiotic-themes-react.module.min.js +1 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils-core.d.ts +4 -0
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils-react.min.js +1 -1
- package/dist/semiotic-utils-react.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +4 -0
- package/dist/semiotic.d.ts +9 -1
- 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/test-utils/capturedFrameProps.d.ts +67 -0
- package/dist/test-utils/frameMock.d.ts +12 -9
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +29 -10
- package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +0 -2
- package/dist/semiotic-chunk-3FSVZ46U.module.min.js +0 -2
- package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +0 -2
- package/dist/xy-chunk-IWD6IB6V.module.min.js +0 -2
- package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +0 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared title clearance for StreamFrame plot areas.
|
|
3
|
+
*
|
|
4
|
+
* Stream titles live in the outer SVG chrome while marks are translated into
|
|
5
|
+
* the plot margin. Reserving this strip before layout keeps titles from
|
|
6
|
+
* touching or overlapping the first row of marks when consumers supply a
|
|
7
|
+
* compact top margin.
|
|
8
|
+
*/
|
|
9
|
+
export interface TitleMargin {
|
|
10
|
+
top: number;
|
|
11
|
+
right: number;
|
|
12
|
+
bottom: number;
|
|
13
|
+
left: number;
|
|
14
|
+
}
|
|
15
|
+
/** Enough room for the standard 14px title plus a visible gap to the plot. */
|
|
16
|
+
export declare const MIN_TITLE_TOP_MARGIN = 36;
|
|
17
|
+
/** One horizontal legend row plus its inset when no title is present. */
|
|
18
|
+
export declare const MIN_TOP_LEGEND_MARGIN = 34;
|
|
19
|
+
/** The standard title strip plus one horizontal legend row and plot gap. */
|
|
20
|
+
export declare const MIN_TITLE_TOP_LEGEND_MARGIN = 58;
|
|
21
|
+
/** Baseline that leaves a calm outer-edge inset for the standard title face. */
|
|
22
|
+
export declare const TITLE_BASELINE = 22;
|
|
23
|
+
/** Static SVG and GIF output only render text titles in their SVG chrome. */
|
|
24
|
+
export declare function hasTextTitle(title: unknown): title is string;
|
|
25
|
+
/**
|
|
26
|
+
* Reserve the shared top chrome before any frame calculates plot geometry.
|
|
27
|
+
* A raw StreamFrame can supply both a compact margin and a top legend, so the
|
|
28
|
+
* legend's first row needs its own minimum rather than relying on HOC margins.
|
|
29
|
+
*/
|
|
30
|
+
export declare function reserveFrameChromeMargin<T extends TitleMargin>(margin: T, hasTitle: boolean, hasTopLegend?: boolean): T;
|
|
31
|
+
export declare function reserveTitleMargin<T extends TitleMargin>(margin: T, title: unknown): T;
|
|
@@ -4,27 +4,19 @@ import type { AnimateProp } from "./pipelineTransitionUtils";
|
|
|
4
4
|
import type { LegendGroup, GradientLegendConfig, LegendLayout } from "../types/legendTypes";
|
|
5
5
|
import type { ArrowOfTime, WindowMode, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, HoverAnnotationConfig, HoverData, AnnotationContext, AnnotationAnchorMode } from "../realtime/types";
|
|
6
6
|
import type { Datum } from "../charts/shared/datumTypes";
|
|
7
|
+
import type { HatchFill } from "../charts/shared/hatchFill";
|
|
7
8
|
import type { CoercibleNumber } from "./accessorUtils";
|
|
8
9
|
import type { AutoPlaceAnnotations } from "../recipes/annotationLayout";
|
|
9
10
|
import type { SymbolName } from "./symbolPath";
|
|
10
11
|
import type { GlyphDef } from "./glyphDef";
|
|
12
|
+
import type { SceneRenderMode } from "./sceneRenderBackendTypes";
|
|
13
|
+
import type { StreamSemanticInteractionProps } from "./streamSemanticTypes";
|
|
14
|
+
import type { XYFrameAxisConfig } from "./xyFrameAxisTypes";
|
|
15
|
+
export type { SceneRenderBackend, SceneRenderMode } from "./sceneRenderBackendTypes";
|
|
16
|
+
export type { ThemeSemanticColors } from "./streamThemeTypes";
|
|
17
|
+
export type { AxisTickFormat, AxisTickFormatter, XYFrameAxisConfig } from "./xyFrameAxisTypes";
|
|
11
18
|
export type SceneDatum = Datum | null;
|
|
12
19
|
export type SeriesDatum = Datum[] | null;
|
|
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);
|
|
14
|
-
export interface ThemeSemanticColors {
|
|
15
|
-
primary?: string;
|
|
16
|
-
secondary?: string;
|
|
17
|
-
success?: string;
|
|
18
|
-
danger?: string;
|
|
19
|
-
warning?: string;
|
|
20
|
-
error?: string;
|
|
21
|
-
info?: string;
|
|
22
|
-
text?: string;
|
|
23
|
-
textSecondary?: string;
|
|
24
|
-
border?: string;
|
|
25
|
-
grid?: string;
|
|
26
|
-
surface?: string;
|
|
27
|
-
}
|
|
28
20
|
export interface DecayConfig {
|
|
29
21
|
type: "linear" | "exponential" | "step";
|
|
30
22
|
/** Exponential: half-life in buffer positions (default: bufferSize/2) */
|
|
@@ -105,8 +97,14 @@ export interface Style {
|
|
|
105
97
|
strokeWidth?: number;
|
|
106
98
|
strokeDasharray?: string;
|
|
107
99
|
strokeLinecap?: "butt" | "round" | "square";
|
|
108
|
-
/**
|
|
109
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Fill for the mark. One of:
|
|
102
|
+
* - a color string (or CSS var)
|
|
103
|
+
* - a {@link HatchFill} descriptor (declarative hatch — resolves to a
|
|
104
|
+
* CanvasPattern on canvas and an SVG `<pattern>` on the SSR/overlay path)
|
|
105
|
+
* - a `CanvasPattern` (e.g. a hand-built `createHatchPattern` — canvas only)
|
|
106
|
+
*/
|
|
107
|
+
fill?: string | HatchFill | CanvasPattern;
|
|
110
108
|
fillOpacity?: number;
|
|
111
109
|
opacity?: number;
|
|
112
110
|
/** For icon/isotype bars: an image to stamp instead of filling */
|
|
@@ -578,52 +576,7 @@ export interface BandConfig<T = Datum> {
|
|
|
578
576
|
*/
|
|
579
577
|
interactive?: boolean;
|
|
580
578
|
}
|
|
581
|
-
|
|
582
|
-
* Per-axis configuration object for an XY frame's `axes: []` array.
|
|
583
|
-
* Distinct from `AxisConfig` exported from the HOC layer (which is the
|
|
584
|
-
* chart-level `xLabel` / `yLabel` / `xFormat` / `yFormat` bundle) —
|
|
585
|
-
* this type describes one axis at a time and is what
|
|
586
|
-
* `frameProps.axes[i]` consumes.
|
|
587
|
-
*
|
|
588
|
-
* Re-exported under the legacy name `AxisConfig` from `SVGOverlay.tsx`
|
|
589
|
-
* for backwards-compatibility with internal callers; new code should
|
|
590
|
-
* import this name directly.
|
|
591
|
-
*/
|
|
592
|
-
export interface XYFrameAxisConfig {
|
|
593
|
-
orient: "left" | "right" | "top" | "bottom";
|
|
594
|
-
label?: string;
|
|
595
|
-
ticks?: number;
|
|
596
|
-
/** Per-axis tick label formatter. ReactNode return is supported and
|
|
597
|
-
* renders inside a `<foreignObject>`. */
|
|
598
|
-
tickFormat?: (d: any, index?: number, allTicks?: number[]) => string | ReactNode;
|
|
599
|
-
baseline?: boolean | "under";
|
|
600
|
-
jaggedBase?: boolean;
|
|
601
|
-
/** Explicit tick values. When provided, bypasses both d3's "nice"
|
|
602
|
-
* generator and `axisExtent: "exact"` — the caller has hand-picked
|
|
603
|
-
* the positions. Pixel-distance filtering downstream still drops
|
|
604
|
-
* overlapping labels. Mirrors the ordinal frame's `rTickValues`. */
|
|
605
|
-
tickValues?: Array<number | Date>;
|
|
606
|
-
/** Grid line stroke style: `"dashed"` (6,4), `"dotted"` (2,4), or a
|
|
607
|
-
* custom strokeDasharray string. Applied to grid lines extending
|
|
608
|
-
* from ticks across the chart area. */
|
|
609
|
-
gridStyle?: "dashed" | "dotted" | string;
|
|
610
|
-
/** Always include the domain max as a tick, even if d3 omits it. */
|
|
611
|
-
includeMax?: boolean;
|
|
612
|
-
/** Auto-rotate labels 45° when horizontal spacing is too tight. */
|
|
613
|
-
autoRotate?: boolean;
|
|
614
|
-
/** Highlight ticks at time boundaries (new month, year, etc.) with
|
|
615
|
-
* semibold text. `true` auto-detects Date boundaries. A function
|
|
616
|
-
* receives (value, index) and returns true for landmark ticks. */
|
|
617
|
-
landmarkTicks?: boolean | ((value: any, index: number) => boolean);
|
|
618
|
-
/** Tick label anchoring strategy:
|
|
619
|
-
* - `"middle"` (default): all tick labels centered on the tick mark
|
|
620
|
-
* - `"edges"`: first tick label anchors to start, last to end,
|
|
621
|
-
* middles stay centered. Pairs naturally with `axisExtent: "exact"`
|
|
622
|
-
* — pins the domain to the data min/max AND keeps the extreme
|
|
623
|
-
* labels from overflowing the plot. */
|
|
624
|
-
tickAnchor?: "middle" | "edges";
|
|
625
|
-
}
|
|
626
|
-
export interface StreamXYFrameProps<T = Datum> {
|
|
579
|
+
export interface StreamXYFrameProps<T = Datum> extends StreamSemanticInteractionProps<HoverData> {
|
|
627
580
|
chartType: StreamChartType;
|
|
628
581
|
runtimeMode?: RuntimeMode;
|
|
629
582
|
data?: T[];
|
|
@@ -757,6 +710,8 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
757
710
|
};
|
|
758
711
|
className?: string;
|
|
759
712
|
background?: string;
|
|
713
|
+
/** Optional scene paint backend. Exact scene geometry remains interactive. */
|
|
714
|
+
renderMode?: SceneRenderMode<SceneNode>;
|
|
760
715
|
lineStyle?: LineStyle | ((d: T, group?: string) => Style);
|
|
761
716
|
pointStyle?: (d: T) => Style & {
|
|
762
717
|
r?: number;
|
|
@@ -791,8 +746,6 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
791
746
|
tickFormatValue?: (value: number) => string;
|
|
792
747
|
hoverAnnotation?: boolean | HoverAnnotationConfig;
|
|
793
748
|
tooltipContent?: (d: HoverData) => ReactNode;
|
|
794
|
-
customHoverBehavior?: (d: HoverData | null) => void;
|
|
795
|
-
customClickBehavior?: (d: HoverData | null) => void;
|
|
796
749
|
enableHover?: boolean;
|
|
797
750
|
/** Max pixel distance for hover/click hit testing. Default 30. */
|
|
798
751
|
hoverRadius?: number;
|
|
@@ -861,6 +814,18 @@ export interface StreamXYFrameProps<T = Datum> {
|
|
|
861
814
|
animate?: AnimateProp;
|
|
862
815
|
/** Frame-level data liveness indicator */
|
|
863
816
|
staleness?: StalenessConfig;
|
|
817
|
+
/** Optional rAF seam for deterministic host scheduling. */
|
|
818
|
+
frameScheduler?: import("./useFrame").FrameScheduler;
|
|
819
|
+
/** Monotonic wall-clock seam for deterministic replay, tests, or evidence capture. */
|
|
820
|
+
clock?: import("./FrameRuntime").FrameClock;
|
|
821
|
+
/** Injectable random source for frame-local stochastic work. */
|
|
822
|
+
random?: import("./FrameRuntime").FrameRandom;
|
|
823
|
+
/** Serializable deterministic random seed. Ignored when `random` is supplied. */
|
|
824
|
+
seed?: number;
|
|
825
|
+
/** Freeze logical animation time and cancel queued work while paused. */
|
|
826
|
+
paused?: boolean;
|
|
827
|
+
/** Freeze logical animation time while the page is hidden. Defaults to true for XY frames. */
|
|
828
|
+
suspendWhenHidden?: boolean;
|
|
864
829
|
/** Marginal distribution plots in axis margins (histogram, violin, ridgeline, boxplot) */
|
|
865
830
|
marginalGraphics?: MarginalGraphicsConfig;
|
|
866
831
|
/** Aggregation mode for streaming heatmap (count, sum, mean) */
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { DependencyList, MutableRefObject, ReactNode, RefObject } from "react";
|
|
3
|
+
import type { FrameMargin, UseFrameResult } from "./useFrame";
|
|
4
|
+
export interface CanvasFrameHostRuntime {
|
|
5
|
+
readonly isActive: boolean;
|
|
6
|
+
subscribe(listener: () => void): () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface CanvasFrameHostStore {
|
|
9
|
+
cancelIntroAnimation?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface UseCanvasFrameHostInput<TStore extends object> {
|
|
12
|
+
/** The family-owned store only needs the shared hydration escape hatch. */
|
|
13
|
+
storeRef: RefObject<TStore | null>;
|
|
14
|
+
/** The family-owned retained-scene repaint flag. */
|
|
15
|
+
dirtyRef: MutableRefObject<boolean>;
|
|
16
|
+
/** Stable render closure and scheduler callbacks supplied by `useFrame`. */
|
|
17
|
+
renderFnRef: MutableRefObject<() => void>;
|
|
18
|
+
scheduleRender: () => void;
|
|
19
|
+
cancelRender: () => void;
|
|
20
|
+
/** Logical pause/visibility runtime supplied by `useFrame`. */
|
|
21
|
+
frameRuntime: CanvasFrameHostRuntime;
|
|
22
|
+
/**
|
|
23
|
+
* Opt out only when a family-specific lifecycle adapter must synchronize
|
|
24
|
+
* pause/visibility with an external runtime such as a worker. The default
|
|
25
|
+
* host policy owns ordinary canvas-frame runtime transitions.
|
|
26
|
+
*/
|
|
27
|
+
manageFrameRuntime?: boolean;
|
|
28
|
+
hydrated: boolean;
|
|
29
|
+
wasHydratingFromSSR: boolean;
|
|
30
|
+
/** Family-specific teardown such as clearing a streaming data adapter. */
|
|
31
|
+
cleanup?: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Some adapters synchronously paint their initial retained scene through a
|
|
34
|
+
* family-specific execution policy. They can skip the otherwise useful
|
|
35
|
+
* mount-time invalidation while retaining dependency-change invalidation.
|
|
36
|
+
*/
|
|
37
|
+
skipInitialCanvasPaintInvalidation?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Values that require a data-canvas repaint. Keep this list family-owned:
|
|
40
|
+
* it expresses paint semantics without teaching the host chart props or
|
|
41
|
+
* layout rules. Its length must remain stable for one host instance.
|
|
42
|
+
*/
|
|
43
|
+
canvasPaintDependencies: DependencyList;
|
|
44
|
+
}
|
|
45
|
+
export interface CanvasFrameHostResult {
|
|
46
|
+
/** Base retained-scene data layer. */
|
|
47
|
+
canvasRef: RefObject<HTMLCanvasElement | null>;
|
|
48
|
+
/** Optional family use for hover/crosshair/highlight canvas content. */
|
|
49
|
+
interactionCanvasRef: RefObject<HTMLCanvasElement | null>;
|
|
50
|
+
}
|
|
51
|
+
type FrameCanvasHost = Pick<UseFrameResult, "renderFnRef" | "scheduleRender" | "cancelRender" | "frameRuntime">;
|
|
52
|
+
type FrameCanvasHostInput<TStore extends object> = Omit<UseCanvasFrameHostInput<TStore>, "renderFnRef" | "scheduleRender" | "cancelRender" | "frameRuntime">;
|
|
53
|
+
/**
|
|
54
|
+
* Installs common canvas-host lifecycle without absorbing family render work.
|
|
55
|
+
*/
|
|
56
|
+
export declare function useCanvasFrameHost<TStore extends object>(input: UseCanvasFrameHostInput<TStore>): CanvasFrameHostResult;
|
|
57
|
+
/** Bind a family-owned store to the common scheduling runtime from useFrame. */
|
|
58
|
+
export declare function useFrameCanvasHost<TStore extends object>(frame: FrameCanvasHost, input: FrameCanvasHostInput<TStore>): CanvasFrameHostResult;
|
|
59
|
+
export interface CanvasFrameBackgroundProps {
|
|
60
|
+
children: ReactNode;
|
|
61
|
+
size: readonly [number, number];
|
|
62
|
+
margin: FrameMargin;
|
|
63
|
+
/** Preserve a family's existing SVG overflow behavior when it needs it. */
|
|
64
|
+
overflowVisible?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The shared SVG background layer. Its coordinate translation is common;
|
|
68
|
+
* resolving graphics and choosing their contents remain family-specific.
|
|
69
|
+
*/
|
|
70
|
+
export declare function CanvasFrameBackground({ children, size, margin, overflowVisible, }: CanvasFrameBackgroundProps): React.ReactNode;
|
|
71
|
+
export {};
|
|
@@ -6,6 +6,7 @@ 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
|
+
import { FrameRuntime, type FrameClock, type FrameRandom } from "./FrameRuntime";
|
|
9
10
|
/**
|
|
10
11
|
* The small scheduling surface `useFrame` needs. Keeping this separate from
|
|
11
12
|
* the browser global gives hook tests a deterministic, handle-agnostic seam
|
|
@@ -49,6 +50,16 @@ export interface UseFrameInput {
|
|
|
49
50
|
userMargin: Partial<FrameMargin> | undefined;
|
|
50
51
|
/** Frame's family-default margin. Shallow-merged with `userMargin`. */
|
|
51
52
|
marginDefault: FrameMargin;
|
|
53
|
+
/**
|
|
54
|
+
* Visual title rendered by the frame's SVG chrome. A title reserves a small
|
|
55
|
+
* top strip before plot geometry is calculated so compact caller margins do
|
|
56
|
+
* not place marks directly beneath the title.
|
|
57
|
+
*/
|
|
58
|
+
title?: ReactNode;
|
|
59
|
+
/** Optional legend; a top-positioned legend reserves its first row. */
|
|
60
|
+
legend?: unknown;
|
|
61
|
+
/** Legend placement used for shared top-chrome clearance. */
|
|
62
|
+
legendPosition?: "right" | "left" | "top" | "bottom";
|
|
52
63
|
/** Frame's `foregroundGraphics` prop. */
|
|
53
64
|
foregroundGraphics?: FrameGraphicsProp;
|
|
54
65
|
/** Frame's `backgroundGraphics` prop. */
|
|
@@ -63,6 +74,16 @@ export interface UseFrameInput {
|
|
|
63
74
|
* use the browser's `requestAnimationFrame` / `cancelAnimationFrame`.
|
|
64
75
|
*/
|
|
65
76
|
frameScheduler?: FrameScheduler;
|
|
77
|
+
/** Monotonic wall-clock seam used by the frame runtime. */
|
|
78
|
+
clock?: FrameClock;
|
|
79
|
+
/** Injectable random seam. A serializable `seed` takes effect when omitted. */
|
|
80
|
+
random?: FrameRandom;
|
|
81
|
+
/** Serializable deterministic random seed for frame-local stochastic work. */
|
|
82
|
+
seed?: number;
|
|
83
|
+
/** Freeze logical frame time while paused. Opt-in so existing frame families retain their policy. */
|
|
84
|
+
paused?: boolean;
|
|
85
|
+
/** Freeze logical frame time while the document is hidden. Opt-in per frame family. */
|
|
86
|
+
suspendWhenHidden?: boolean;
|
|
66
87
|
/**
|
|
67
88
|
* Frame's `dirtyRef` (the flag that forces a full canvas redraw on the
|
|
68
89
|
* next paint). When provided, useFrame installs a theme-change effect
|
|
@@ -109,6 +130,8 @@ export interface UseFrameResult {
|
|
|
109
130
|
introEnabled: boolean;
|
|
110
131
|
/** Stable id for the AccessibleDataTable region (hash-suffixed). */
|
|
111
132
|
tableId: string;
|
|
133
|
+
/** Shared logical clock, pause/visibility policy, and RNG seam for this host. */
|
|
134
|
+
frameRuntime: FrameRuntime;
|
|
112
135
|
/** Token of the pending rAF, or `null` if none. `0` is a valid token. */
|
|
113
136
|
rafRef: React.MutableRefObject<number | null>;
|
|
114
137
|
/** Frame assigns its render closure here. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
3
3
|
import { type CategoryDomainAccessor } from "./categoryDomain";
|
|
4
4
|
/** Keep legend-category callbacks stable while reading the latest frame props. */
|
|
5
|
-
export declare function useLegendCategoryEmission(storeRef: RefObject<
|
|
5
|
+
export declare function useLegendCategoryEmission<TStore extends object, TDatum extends Datum = Datum>(storeRef: RefObject<TStore | null>, accessor: CategoryDomainAccessor<TDatum> | undefined, onChange: ((categories: string[]) => void) | undefined, readData: (store: TStore) => TDatum[]): () => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import { type SemanticClickBehavior, type SemanticHoverBehavior, type SemanticInteractionContext } from "../charts/shared/semanticInteractions";
|
|
3
|
+
import type { OnObservationCallback } from "../store/ObservationStore";
|
|
4
|
+
interface HoverLike {
|
|
5
|
+
data?: Datum | null;
|
|
6
|
+
x?: number;
|
|
7
|
+
y?: number;
|
|
8
|
+
}
|
|
9
|
+
interface SemanticFrameInteractionOptions<Hover extends HoverLike> {
|
|
10
|
+
customHoverBehavior?: SemanticHoverBehavior<Hover>;
|
|
11
|
+
customClickBehavior?: SemanticClickBehavior<Hover>;
|
|
12
|
+
onObservation?: OnObservationCallback;
|
|
13
|
+
chartId?: string;
|
|
14
|
+
chartType: string;
|
|
15
|
+
}
|
|
16
|
+
/** Add semantic observations around the legacy Stream Frame callbacks. */
|
|
17
|
+
export declare function useSemanticFrameInteractions<Hover extends HoverLike>({ customHoverBehavior: customHoverBehaviorProp, customClickBehavior: customClickBehaviorProp, onObservation, chartId, chartType }: SemanticFrameInteractionOptions<Hover>): {
|
|
18
|
+
customHoverBehavior: (hover: Hover | null, context?: SemanticInteractionContext) => void;
|
|
19
|
+
customClickBehavior: (hover: Hover | null, context?: SemanticInteractionContext) => void;
|
|
20
|
+
hasClickBehavior: boolean;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UpdateResult, UpdateResultStore } from "./pipelineUpdateContract";
|
|
2
|
+
/**
|
|
3
|
+
* Read an additive pipeline update snapshot through React's external-store
|
|
4
|
+
* contract. Store mutation and frame scheduling remain imperative; consumers
|
|
5
|
+
* can use this only for React-owned inspection or diagnostics.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useUpdateResultSnapshot(store: UpdateResultStore): UpdateResult;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type AxisTickFormat = ((d: number, index?: number, allTicks?: number[]) => string) | ((d: string, index?: number, allTicks?: number[]) => string) | ((d: Date, index?: number, allTicks?: number[]) => string);
|
|
3
|
+
export type AxisTickFormatter = {
|
|
4
|
+
bivarianceHack(d: string | number | Date, index?: number, allTicks?: number[]): string | ReactNode;
|
|
5
|
+
}["bivarianceHack"];
|
|
6
|
+
/**
|
|
7
|
+
* Per-axis configuration object for an XY frame's `axes: []` array.
|
|
8
|
+
* Distinct from `AxisConfig` exported from the HOC layer (which is the
|
|
9
|
+
* chart-level `xLabel` / `yLabel` / `xFormat` / `yFormat` bundle) —
|
|
10
|
+
* this type describes one axis at a time and is what
|
|
11
|
+
* `frameProps.axes[i]` consumes.
|
|
12
|
+
*
|
|
13
|
+
* Re-exported under the legacy name `AxisConfig` from `SVGOverlay.tsx`
|
|
14
|
+
* for backwards-compatibility with internal callers; new code should
|
|
15
|
+
* import this name directly.
|
|
16
|
+
*/
|
|
17
|
+
export interface XYFrameAxisConfig {
|
|
18
|
+
orient: "left" | "right" | "top" | "bottom";
|
|
19
|
+
label?: string;
|
|
20
|
+
ticks?: number;
|
|
21
|
+
/** Per-axis tick label formatter. ReactNode return is supported and
|
|
22
|
+
* renders inside a `<foreignObject>`. */
|
|
23
|
+
tickFormat?: AxisTickFormatter;
|
|
24
|
+
baseline?: boolean | "under";
|
|
25
|
+
jaggedBase?: boolean;
|
|
26
|
+
/** Explicit tick values. When provided, bypasses both d3's "nice"
|
|
27
|
+
* generator and `axisExtent: "exact"` — the caller has hand-picked
|
|
28
|
+
* the positions. Pixel-distance filtering downstream still drops
|
|
29
|
+
* overlapping labels. Mirrors the ordinal frame's `rTickValues`. */
|
|
30
|
+
tickValues?: Array<number | Date>;
|
|
31
|
+
/** Grid line stroke style: `"dashed"` (6,4), `"dotted"` (2,4), or a
|
|
32
|
+
* custom strokeDasharray string. Applied to grid lines extending
|
|
33
|
+
* from ticks across the chart area. */
|
|
34
|
+
gridStyle?: "dashed" | "dotted" | string;
|
|
35
|
+
/** Always include the domain max as a tick, even if d3 omits it. */
|
|
36
|
+
includeMax?: boolean;
|
|
37
|
+
/** Auto-rotate labels 45° when horizontal spacing is too tight. */
|
|
38
|
+
autoRotate?: boolean;
|
|
39
|
+
/** Highlight ticks at time boundaries (new month, year, etc.) with
|
|
40
|
+
* semibold text. `true` auto-detects Date boundaries. A function
|
|
41
|
+
* receives (value, index) and returns true for landmark ticks. */
|
|
42
|
+
landmarkTicks?: boolean | ((value: string | number | Date, index: number) => boolean);
|
|
43
|
+
/** Tick label anchoring strategy:
|
|
44
|
+
* - `"middle"` (default): all tick labels centered on the tick mark
|
|
45
|
+
* - `"edges"`: first tick label anchors to start, last to end,
|
|
46
|
+
* middles stay centered. Pairs naturally with `axisExtent: "exact"`
|
|
47
|
+
* — pins the domain to the data min/max AND keeps the extreme
|
|
48
|
+
* labels from overflowing the plot. */
|
|
49
|
+
tickAnchor?: "middle" | "edges";
|
|
50
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Datum } from "../../charts/shared/datumTypes";
|
|
2
|
+
import type { CoercibleNumber } from "../accessorUtils";
|
|
2
3
|
import type { AreaGradientConfig } from "./areaGradient";
|
|
3
4
|
/**
|
|
4
5
|
* XYSceneContext — shared context passed to all XY scene builder functions.
|
|
@@ -73,9 +74,9 @@ export interface XYSceneConfig {
|
|
|
73
74
|
sizeRange?: [number, number];
|
|
74
75
|
/** Explicit `{category → shape}` map for symbolBy; unmapped auto-assign. */
|
|
75
76
|
symbolMap?: Record<string, SymbolName>;
|
|
76
|
-
xAccessor?: string | ((d: Datum) =>
|
|
77
|
-
yAccessor?: string | ((d: Datum) =>
|
|
78
|
-
valueAccessor?: string | ((d: Datum) =>
|
|
77
|
+
xAccessor?: string | ((d: Datum) => CoercibleNumber);
|
|
78
|
+
yAccessor?: string | ((d: Datum) => CoercibleNumber);
|
|
79
|
+
valueAccessor?: string | ((d: Datum) => CoercibleNumber);
|
|
79
80
|
heatmapAggregation?: "count" | "sum" | "mean";
|
|
80
81
|
heatmapXBins?: number;
|
|
81
82
|
heatmapYBins?: number;
|
|
@@ -117,7 +118,7 @@ export interface XYSceneConfig {
|
|
|
117
118
|
};
|
|
118
119
|
/** True when candlestick is in range/dumbbell mode (no open/close accessors provided) */
|
|
119
120
|
candlestickRangeMode?: boolean;
|
|
120
|
-
boundsStyle?: Style | ((d:
|
|
121
|
-
lineStyle?: Style | ((d:
|
|
121
|
+
boundsStyle?: Style | ((d: Datum, group: string) => Style);
|
|
122
|
+
lineStyle?: Style | ((d: Datum, group: string) => Style);
|
|
122
123
|
areaStyle?: (d: Datum) => Style;
|
|
123
124
|
}
|
package/dist/controls.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
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})]})}
|
|
2
|
+
var e,t=Object.create,n=Object.defineProperty,r=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||n(e,s,{get:()=>t[s],enumerable:!(l=r(t,s))||l.enumerable});return e},s=(e,r,a)=>(a=null!=e?t(o(e)):{},l(!r&&e&&e.__esModule?a:n(a,"default",{value:e,enumerable:!0}),e)),u={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(u,{CircularBrush:()=>Q,DirectManipulationControl:()=>b,MobileStandardControls:()=>pe,SentenceFilter:()=>K,VISUALIZATION_CONTROL_TYPES:()=>p,auditVisualizationControls:()=>_,clampMobileRange:()=>ne,createControlObservationAdapter:()=>f,useMobileRangeControls:()=>ae,zoomMobileRange:()=>re}),module.exports=(e=u,l(n({},"__esModule",{value:!0}),e));var c=s(require("react")),d=require("react"),p=["value","threshold","partition-boundary","time-window","range-boundary"];function f({controlType:e,controlId:t,chartId:n,chartType:r="VisualizationControl",onObservation:a}){return(o,i,l)=>{a?.({type:o,controlType:e,value:i,chartType:r,timestamp:Date.now(),...t?{controlId:t}:{},...n?{chartId:n}:{},...l?{source:l}:{}})}}var m=require("react/jsx-runtime");function h(e,t,n,r){return Math.min(n,Math.max(t,Number((t+Math.round((Math.min(n,Math.max(t,e))-t)/r)*r).toFixed(12))))}function b({value:e,onChange:t,pointerToValue:n,min:r,max:a,step:o=1,largeStep:i=5*o,x:l,y:s,controlType:u="value",controlId:p,label:b,valueText:y,radius:g=12,fill:x="var(--semiotic-bg, #ffffff)",stroke:v="var(--semiotic-primary, #4e79a7)",strokeWidth:w=4,labelText:j,labelDx:k=16,labelDy:C=-16,labelClassName:$,className:M,disabled:S=!1,onChangeStart:A,onChangeEnd:I,onObservation:T,chartId:D,chartType:z}){const L=(0,d.useRef)(null),N=(0,d.useRef)(e);N.current=e;const E=c.useMemo(()=>f({controlType:u,controlId:p,chartId:D,chartType:z,onObservation:T}),[D,z,p,u,T]),R=e=>{if(S)return;const i=n(e);if(null==i||!Number.isFinite(i))return;const l=h(i,r,a,o);N.current=l,t(l),E("control-change",l,"pointer")},V=e=>{e.stopPropagation(),L.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),L.current=null,I?.(N.current),E("control-end",N.current,"pointer"))},P=["semiotic-direct-manipulation-control",M].filter(Boolean).join(" ");return(0,m.jsxs)("g",{className:P,role:"slider",tabIndex:S?-1:0,"aria-disabled":S||void 0,"aria-label":b,"aria-valuemin":r,"aria-valuemax":a,"aria-valuenow":e,"aria-valuetext":y??`${b}: ${e}`,"aria-roledescription":"visualization control","data-viz-control":u,"data-viz-control-id":p,"data-viz-control-state":"controlled",pointerEvents:"all",onPointerDown:e=>{S||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),L.current=e.pointerId,A?.(N.current),E("control-start",N.current,"pointer"),R(e))},onPointerMove:e=>{e.stopPropagation(),L.current===e.pointerId&&R(e)},onPointerUp:V,onPointerCancel:V,onLostPointerCapture:V,onKeyDown:e=>{if(S)return;const n=e.shiftKey?i:o,l=N.current;let s=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(s=l-n),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(s=l+n),"Home"===e.key&&(s=r),"End"===e.key&&(s=a),null===s)return;e.preventDefault();const u=h(s,r,a,o);N.current=u,t(u),E("control-change",u,"keyboard")},style:{cursor:S?"default":"grab",touchAction:"none"},children:[(0,m.jsx)("circle",{className:"semiotic-direct-manipulation-control__hit",cx:l,cy:s,r:g+10,fill:"transparent"}),(0,m.jsx)("circle",{className:"semiotic-direct-manipulation-control__handle",cx:l,cy:s,r:g,fill:x,stroke:v,strokeWidth:w}),j?(0,m.jsx)("text",{className:$,x:l+k,y:s+C,fill:v,children:j}):null]})}var y=s(require("react")),g=require("react/jsx-runtime"),x="undefined"==typeof window?y.useEffect:y.useLayoutEffect,v={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},w={position:"absolute",zIndex:30,top:"calc(100% + 0.5rem)",left:0,boxSizing:"border-box",display:"flex",flexDirection:"column",gap:8,width:"var(--sentence-filter-popover-width, 18rem)",maxWidth:"min(22rem, calc(100vw - 2rem))",maxHeight:"min(24rem, calc(100vh - 2rem))",overflow:"auto",padding:12,color:"var(--sentence-filter-text-color, var(--semiotic-fg, #1f2933))",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #cbd5e1)",borderRadius:6,boxShadow:"0 10px 28px rgba(15, 23, 42, 0.18)",fontFamily:"inherit",fontSize:"1rem",fontWeight:400,lineHeight:1.4,textAlign:"left",whiteSpace:"normal"},j={offsetX:0,placement:"below",maxHeight:null,maxWidth:null},k={boxSizing:"border-box",width:"100%",minHeight:38,padding:"6px 8px",color:"inherit",backgroundColor:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #94a3b8)",borderRadius:4,font:"inherit"},C={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,width:"100%",minHeight:38,padding:"7px 8px",color:"inherit",backgroundColor:"transparent",border:0,borderRadius:4,font:"inherit",textAlign:"left",cursor:"pointer"};function $(e){return null==e||"boolean"==typeof e?"":"string"==typeof e||"number"==typeof e?e+"":Array.isArray(e)?e.map($).join(""):y.isValidElement(e)?$(e.props.children):""}function M(e,t){return Object.is(e,t)}function S(e,t){return e.find(e=>M(e.value,t))}function A(e){return null==e||""===e||Array.isArray(e)&&0===e.length}function I(e,t){if(A(t))return e.emptyLabel??"Any";if("select"===e.type)return S(e.options,t)?.label??t+"";if("multiselect"===e.type){const n=t.map(t=>S(e.options,t)?.label??t+""),r="or"===e.conjunction?" or ":" and ";return n.map((e,t)=>(0,g.jsxs)(y.Fragment,{children:[t>0?r:null,e]},t))}return"toggle"===e.type?t?e.trueLabel??"on":e.falseLabel??"off":"range"===e.type?`${t[0]} to ${t[1]}`:t+""}function T(e,t,n){return A(t)?$(e.emptyLabel??"Any"):e.getAccessibleValue?e.getAccessibleValue(t,n):$(I(e,t))||t+""}function D(e){return 0===e.detail?"keyboard":"pointer"}function z(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(e=>[$(e.label),...e.keywords??[]].some(e=>e.toLocaleLowerCase().includes(n))):e}function L(e,t,n){if(0===e.length)return-1;for(let r=1;e.length>=r;r+=1){const a=(t+n*r+e.length)%e.length;if(!e[a].disabled)return a}return-1}function N(e,t=0){const[n,r]=y.useState(()=>e[t]&&!e[t].disabled?t:L(e,-1,1)),a=y.useRef(null),o=y.useRef({value:"",at:0});y.useEffect(()=>{(0>n||!e[n]||e[n].disabled)&&r(L(e,-1,1))},[n,e]);const i=y.useCallback(e=>{0>e||(r(e),a.current?.querySelector(`[data-sentence-filter-option-index="${e}"]`)?.focus())},[]),l=y.useCallback(t=>{let r=-1;if("ArrowDown"===t.key)r=L(e,n,1);else if("ArrowUp"===t.key)r=L(e,n,-1);else if("Home"===t.key)r=L(e,-1,1);else if("End"===t.key)r=L(e,0,-1);else if(1===t.key.length&&!t.altKey&&!t.ctrlKey&&!t.metaKey){const a=Date.now(),i=o.current,l=`${a-i.at>600?"":i.value}${t.key}`.toLocaleLowerCase();o.current={value:l,at:a};for(let t=1;e.length>=t;t+=1){const a=(Math.max(n,-1)+t)%e.length,o=e[a],i=[$(o.label),...o.keywords??[]];if(!o.disabled&&i.some(e=>e.toLocaleLowerCase().startsWith(l))){r=a;break}}}0>r||(t.preventDefault(),i(r))},[n,i,e]);return{activeIndex:n,focusIndex:i,listRef:a,onKeyDown:l}}function E({option:e}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{children:e.label}),null!=e.count?(0,g.jsx)("span",{"aria-label":e.count+" results",children:e.count}):null,e.description?(0,g.jsx)("span",{style:{display:"block",fontSize:"0.82em",opacity:.78},children:e.description}):null]})}function R({value:e,definition:t,setValue:n,close:r}){const a=t,[o,i]=y.useState(""),l=y.useMemo(()=>z(a.options,o),[o,a.options]),s=Math.max(0,l.findIndex(t=>M(t.value,e))),u=N(l,s);return(0,g.jsxs)(g.Fragment,{children:[a.searchable?(0,g.jsx)("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+a.label,value:o,onChange:e=>i(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),u.focusIndex(L(l,-1,1)))},style:k}):null,(0,g.jsxs)("span",{ref:u.listRef,role:"listbox","aria-label":a.label,style:{display:"flex",flexDirection:"column",gap:2},children:[l.map((t,o)=>(0,g.jsx)("button",{"data-sentence-filter-option-index":o,"data-sentence-filter-autofocus":a.searchable||o!==u.activeIndex?void 0:"",type:"button",role:"option","aria-selected":M(t.value,e),tabIndex:o===u.activeIndex?0:-1,disabled:t.disabled,onKeyDown:u.onKeyDown,onClick:e=>{n(t.value,D(e)),r()},style:{...C,backgroundColor:M(t.value,e)?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",opacity:t.disabled?.5:1},children:(0,g.jsx)(E,{option:t})},`${t.value+""}-${o}`)),0===l.length?(0,g.jsx)("span",{role:"status",children:"No options found."}):null]})]})}function V({value:e,definition:t,setValue:n}){const r=t,[a,o]=y.useState(""),i=y.useMemo(()=>z(r.options,a),[r.options,a]),l=Array.isArray(e)?e:[],s=N(i);return(0,g.jsxs)(g.Fragment,{children:[r.searchable?(0,g.jsx)("input",{"data-sentence-filter-autofocus":!0,type:"search","aria-label":"Search "+r.label,value:a,onChange:e=>o(e.currentTarget.value),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),s.focusIndex(L(i,-1,1)))},style:k}):null,(0,g.jsxs)("span",{ref:s.listRef,role:"group","aria-label":r.label,style:{display:"flex",flexDirection:"column",gap:2},children:[i.map((e,t)=>{const a=l.some(t=>M(t,e.value));return(0,g.jsxs)("label",{style:{...C,justifyContent:"flex-start",opacity:e.disabled?.5:1},children:[(0,g.jsx)("input",{"data-sentence-filter-option-index":t,"data-sentence-filter-autofocus":r.searchable||t!==s.activeIndex?void 0:"",type:"checkbox",checked:a,disabled:e.disabled,tabIndex:t===s.activeIndex?0:-1,onKeyDown:s.onKeyDown,onChange:t=>{const r=t.currentTarget.checked?[...l,e.value]:l.filter(t=>!M(t,e.value));n(r,"input")}}),(0,g.jsx)("span",{style:{flex:1},children:(0,g.jsx)(E,{option:e})})]},`${e.value+""}-${t}`)}),0===i.length?(0,g.jsx)("span",{role:"status",children:"No options found."}):null]})]})}function P({value:e,definition:t,setValue:n}){const r=t,a=r.inputMode??"input",o={min:r.min,max:r.max,step:r.step??1,value:"number"==typeof e?e:r.min??0,onChange:e=>{const t=e.currentTarget.valueAsNumber;Number.isFinite(t)&&n(t,"input")}};return(0,g.jsxs)(g.Fragment,{children:["slider"!==a?(0,g.jsx)("input",{...o,"data-sentence-filter-autofocus":!0,type:"number","aria-label":r.label,style:k}):null,"input"!==a?(0,g.jsx)("input",{...o,"data-sentence-filter-autofocus":"slider"===a?"":void 0,type:"range","aria-label":r.label,style:{width:"100%"}}):null]})}function F({value:e,definition:t,setValue:n}){const r=t,a=Array.isArray(e)&&e.length>=2?[Number(e[0]),Number(e[1])]:[r.min,r.max],o=(e,t)=>{if(!Number.isFinite(t))return;const o=Math.min(r.max,Math.max(r.min,t));n(0===e?[Math.min(o,a[1]),a[1]]:[a[0],Math.max(o,a[0])],"input")},i={min:r.min,max:r.max,step:r.step??1};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("span",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[(0,g.jsxs)("label",{children:[(0,g.jsx)("span",{children:"Minimum"}),(0,g.jsx)("input",{...i,"data-sentence-filter-autofocus":!0,type:"number",value:a[0],onChange:e=>o(0,e.currentTarget.valueAsNumber),style:k})]}),(0,g.jsxs)("label",{children:[(0,g.jsx)("span",{children:"Maximum"}),(0,g.jsx)("input",{...i,type:"number",value:a[1],onChange:e=>o(1,e.currentTarget.valueAsNumber),style:k})]})]}),(0,g.jsxs)("label",{children:[(0,g.jsxs)("span",{style:v,children:["Minimum ",r.label]}),(0,g.jsx)("input",{...i,type:"range",value:a[0],onChange:e=>o(0,e.currentTarget.valueAsNumber),style:{width:"100%"}})]}),(0,g.jsxs)("label",{children:[(0,g.jsxs)("span",{style:v,children:["Maximum ",r.label]}),(0,g.jsx)("input",{...i,type:"range",value:a[1],onChange:e=>o(1,e.currentTarget.valueAsNumber),style:{width:"100%"}})]})]})}function O({value:e,definition:t,setValue:n,close:r}){const a=t,o=[{value:!0,label:a.trueLabel??"On"},{value:!1,label:a.falseLabel??"Off"}],i=N(o.map(e=>({...e})),!1===e?1:0);return(0,g.jsx)("span",{ref:i.listRef,role:"listbox","aria-label":a.label,style:{display:"flex",gap:4},children:o.map((t,a)=>(0,g.jsx)("button",{"data-sentence-filter-option-index":a,"data-sentence-filter-autofocus":a===i.activeIndex?"":void 0,type:"button",role:"option","aria-selected":e===t.value,tabIndex:a===i.activeIndex?0:-1,onKeyDown:i.onKeyDown,onClick:e=>{n(t.value,D(e)),r()},style:{...C,justifyContent:"center",backgroundColor:e===t.value?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent"},children:t.label},t.value+""))})}function W({value:e,definition:t,setValue:n,close:r}){const a=t,o="string"==typeof e?e:"",[i,l]=y.useState(""),s=y.useMemo(()=>z(a.suggestions??[],i),[i,a.suggestions]),u=N(s);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("input",{"data-sentence-filter-autofocus":!0,type:"text","aria-label":a.label,placeholder:a.placeholder,value:o,onChange:e=>{l(e.currentTarget.value),n(e.currentTarget.value,"input")},onKeyDown:e=>{"ArrowDown"===e.key&&s.length>0&&(e.preventDefault(),u.focusIndex(L(s,-1,1)))},style:k}),s.length>0?(0,g.jsx)("span",{ref:u.listRef,role:"listbox","aria-label":a.label+" suggestions",style:{display:"flex",flexDirection:"column",gap:2},children:s.map((e,t)=>(0,g.jsx)("button",{"data-sentence-filter-option-index":t,type:"button",role:"option","aria-selected":e.value===o,disabled:e.disabled,tabIndex:t===u.activeIndex?0:-1,onKeyDown:u.onKeyDown,onClick:t=>{n(e.value,D(t)),r()},style:{...C,opacity:e.disabled?.5:1},children:(0,g.jsx)(E,{option:e})},`${e.value}-${t}`))}):null]})}function H(e){switch(e.definition.type){case"select":return(0,g.jsx)(R,{...e});case"multiselect":return(0,g.jsx)(V,{...e});case"number":return(0,g.jsx)(P,{...e});case"range":return(0,g.jsx)(F,{...e});case"toggle":return(0,g.jsx)(O,{...e});case"text":return(0,g.jsx)(W,{...e})}}function K({sentence:e,filters:t,defaultFilters:n,definitions:r,onChange:a,as:o="div",className:i,style:l,size:s="inherit",align:u="start",wrap:c=!0,disabled:d=!1,readOnly:p=!1,ariaLabel:f,id:m,renderControl:h,onOpenChange:b}){const[k,$]=y.useState(()=>({...n??{}})),M=t??k,S=y.useRef(M);S.current=M;const D=void 0!==t,z=y.useMemo(()=>function(e){const t=[];let n="";const r=()=>{if(!n)return;const e=t[t.length-1];"text"===e?.type?e.value+=n:t.push({type:"text",value:n}),n=""};for(let a=0;e.length>a;)if(e.startsWith("{{",a))n+="{",a+=2;else if(e.startsWith("}}",a))n+="}",a+=2;else{if("{"===e[a]){const n=e.indexOf("}",a+1);if(-1!==n){const o=e.slice(a+1,n);if(o.length>0&&!o.includes("{")){r(),t.push({type:"filter",key:o}),a=n+1;continue}}}n+=e[a],a+=1}return r(),t}(e),[e]),[L,N]=y.useState(null),[E,R]=y.useState(j),V=y.useRef(L);V.current=L;const P=y.useRef(null),F=y.useRef(null),O=y.useRef(new Set),[W,K]=y.useState(""),[Z,_]=y.useState(null),[q,B]=y.useState(null),U=y.useId().replace(/:/g,""),X=m??"sentence-filter-"+U;y.useEffect(()=>{if("undefined"==typeof process||"production"!==process.env?.NODE_ENV)for(const e of z){if("filter"!==e.type)continue;let t=null;r[e.key]?e.key in M||(t=`SentenceFilter: placeholder "{${e.key}}" has no matching filter value.`):t=`SentenceFilter: placeholder "{${e.key}}" has no matching definition.`,t&&!O.current.has(t)&&(O.current.add(t),console.warn(t))}},[r,M,z]);const G=y.useCallback(()=>{V.current&&(V.current=null,N(null),R(j),b?.(null),F.current?.focus())},[b]);y.useEffect(()=>{if(!L)return;const e=e=>{P.current?.contains(e.target)||G()},t=e=>{"Escape"===e.key&&(e.preventDefault(),G())};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("click",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("click",e),document.removeEventListener("keydown",t)}},[G,L]),x(()=>{if(!L||"undefined"==typeof window)return;const e=P.current?.querySelector(`[data-sentence-filter-popover="${L.occurrence}"]`);if(!e)return;const t=()=>{const t=16,n=e.getBoundingClientRect();if(0>=n.width)return;const r=F.current?.getBoundingClientRect(),a=window.visualViewport,o=a?.offsetLeft??0,i=a?.offsetTop??0,l=a?.width??window.innerWidth,s=o+l,u=i+(a?.height??window.innerHeight),c=window.getComputedStyle(e),d=Number.parseFloat(c.getPropertyValue("--sentence-filter-popover-viewport-inset-top")),p=Number.parseFloat(c.getPropertyValue("--sentence-filter-popover-viewport-inset-bottom"));let f=i+(Number.isFinite(d)?Math.max(0,d):0),m=u-(Number.isFinite(p)?Math.max(0,p):0),h=F.current?.parentElement??null;for(;h;){const e=window.getComputedStyle(h);if("sticky"===e.position){const t=h.getBoundingClientRect(),n=Number.parseFloat(e.top),r=Number.parseFloat(e.bottom);Number.isFinite(n)&&1>=Math.abs(t.top-(i+n))&&(f=Math.max(f,t.bottom)),Number.isFinite(r)&&1>=Math.abs(t.bottom-(u-r))&&(m=Math.min(m,t.top))}h=h.parentElement}const b=n.left-E.offsetX,y=n.right-E.offsetX;let g=0;y>s-t&&(g-=y-(s-t)),o+t>b+g&&(g+=o+t-(b+g));const x=r?m-r.bottom-8-t:m-f-32,v=r?r.top-f-8-t:0,w=Math.min(Math.max(n.height,e.scrollHeight),160)>x&&v>x?"above":"below",j=Math.max(0,Math.min(384,Math.floor("above"===w?v:x))),k=Math.max(0,Math.floor(l-32));R(e=>e.offsetX===g&&e.placement===w&&e.maxHeight===j&&e.maxWidth===k?e:{offsetX:g,placement:w,maxHeight:j,maxWidth:k})};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),window.visualViewport?.addEventListener("resize",t),window.visualViewport?.addEventListener("scroll",t),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),window.visualViewport?.removeEventListener("resize",t),window.visualViewport?.removeEventListener("scroll",t)}},[L,E]),y.useEffect(()=>{if(!L)return;const e=P.current?.querySelector(`[data-sentence-filter-popover="${L.occurrence}"]`),t=e?.querySelector("[data-sentence-filter-autofocus]")??e;t?.focus()},[L]),y.useEffect(()=>{L&&(d||p||r[L.key]?.disabled)&&G()},[G,r,d,L,p]);const Y=y.useCallback((e,t,n)=>{const o=S.current,i=o[e]??null,l={...o,[e]:t};D||(S.current=l,$(l));const s={key:e,previousValue:i,value:t,source:n};a?.(l,s);const u=r[e];if(u){const e=T(u,i,o),n=T(u,t,l);K(`${u.label} changed from ${e} to ${n}.`)}},[D,r,a]),J=y.useMemo(()=>z.map(e=>{if("text"===e.type)return e.value;const t=r[e.key];return t?T(t,M[e.key],M):`{${e.key}}`}).join(""),[r,M,z]),Q={position:"relative",margin:0,color:"var(--sentence-filter-text-color, inherit)",fontFamily:"inherit",fontSize:"small"===s?"0.875rem":"medium"===s?"1rem":"large"===s?"1.5rem":"inherit",lineHeight:"inherit",textAlign:"start"===u?"start":"end"===u?"end":"center",whiteSpace:c?"normal":"nowrap",...l},ee=["semiotic-sentence-filter",i].filter(Boolean).join(" ");let te=0;return(0,g.jsxs)(o,{ref:e=>{P.current=e},id:X,className:ee,style:Q,role:"div"===o||"span"===o?"group":void 0,"aria-label":f??J,"data-semiotic-control":"sentence-filter","data-sentence-filter-state":D?"controlled":"uncontrolled",children:[z.map((e,t)=>{if("text"===e.type)return(0,g.jsx)("span",{"aria-hidden":"true",children:e.value},t);const n=r[e.key];if(!n)return(0,g.jsx)("span",{"aria-hidden":"true",children:`{${e.key}}`},t);const a=te;te+=1;const o=M[e.key]??null,i=function(e,t,n){return A(t)?e.emptyLabel??"Any":e.formatValue?e.formatValue(t,n):I(e,t)}(n,o,M),l=T(n,o,M),s=L?.key===e.key&&L.occurrence===a,u=d||p||!!n.disabled,c=e.key.replace(/[^a-zA-Z0-9_-]/g,"-"),f=`${X}-${c}-${a}-popover`;return(0,g.jsxs)("span",{className:"semiotic-sentence-filter__value",style:{position:"relative",display:"inline"},children:[(0,g.jsx)("button",{type:"button","aria-haspopup":"dialog","aria-expanded":s,"aria-controls":f,"aria-label":`${n.label}: ${l}. Activate to change.`,disabled:u,"data-sentence-filter-key":e.key,"data-sentence-filter-type":n.type,"data-sentence-filter-open":s||void 0,onMouseEnter:()=>_(a),onMouseLeave:()=>_(e=>e===a?null:e),onFocus:()=>B(a),onBlur:()=>B(e=>e===a?null:e),onClick:t=>{if(u)return;if(s)return void G();F.current=t.currentTarget;const r={key:e.key,occurrence:a};V.current=r,R(j),N(r),K(n.label+" control opened."),b?.(e.key)},style:{appearance:"none",display:"inline",minWidth:24,padding:"0.35em 0.12em",margin:"-0.35em 0",color:n.accent??"var(--sentence-filter-accent, var(--semiotic-primary, #4e79a7))",backgroundColor:Z===a||s?"var(--sentence-filter-hover-background, rgba(78, 121, 167, 0.12))":"transparent",border:0,borderBottom:"var(--sentence-filter-underline-thickness, 0.09em) solid currentColor",borderRadius:2,outline:q===a?"2px solid var(--sentence-filter-focus-color, currentColor)":"2px solid transparent",outlineOffset:2,font:"inherit",fontWeight:600,lineHeight:"inherit",textAlign:"inherit",cursor:u?"default":"pointer",opacity:u?.6:1},children:i}),s?(0,g.jsxs)("span",{id:f,role:"dialog","aria-label":n.label,"aria-describedby":n.description?f+"-description":void 0,tabIndex:-1,"data-sentence-filter-popover":a,"data-sentence-filter-key":e.key,style:{...w,top:"below"===E.placement?"calc(100% + 0.5rem)":"auto",bottom:"above"===E.placement?"calc(100% + 0.5rem)":"auto",left:E.offsetX,maxHeight:E.maxHeight??w.maxHeight,maxWidth:E.maxWidth??w.maxWidth},children:[(0,g.jsx)("span",{style:{fontWeight:650},children:n.label}),n.description?(0,g.jsx)("span",{id:f+"-description",style:{fontSize:"0.88em",opacity:.78},children:n.description}):null,h?h({key:e.key,value:o,filters:M,definition:n,setValue:(t,n="programmatic")=>Y(e.key,t,n),close:G}):(0,g.jsx)(H,{value:o,definition:n,setValue:(t,n)=>Y(e.key,t,n),close:G}),n.allowClear&&!A(o)?(0,g.jsxs)("button",{type:"button",onClick:()=>{Y(e.key,"multiselect"===n.type?[]:null,"clear"),G()},style:{...C,justifyContent:"center",border:"1px solid var(--semiotic-border, #cbd5e1)"},children:["Clear ",n.label]}):null]}):null]},`${e.key}-${a}`)}),(0,g.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true","data-sentence-filter-live-region":!0,style:v,children:W})]})}function Z(e,t,n,r,a){return{id:e,...t?{controlId:t}:{},status:n,message:r,...a?{remediation:a}:{}}}function _({controls:e=[],minimumTargetSize:t=24}){const n=[],r=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;n.push(Z(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.")),n.push(Z(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.")),n.push(Z(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].")),n.push(Z(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.")),n.push(Z(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.")),n.push(Z(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&&n.push(Z(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&&n.push(Z(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&&!r.has(e)||n.push(Z(o+".identity",e,"fail",e?"Control id is duplicated.":"Control id is missing.","Use a unique stable control id.")),e&&r.add(e)}return{ok:n.every(e=>"fail"!==e.status),findings:n}}var q=require("react"),B=2*Math.PI;function U(e,t,n){const r=n?.center?.x??0,a=n?.center?.y??0;return{x:r+Math.sin(e)*t,y:a-Math.cos(e)*t}}function X(e,t,n,r,a){const o=a?.center,i=(e,t)=>{const{x:n,y:r}=U(e,t,{center:o});return`${G(n)},${G(r)}`},l=Math.max(0,n),s=Math.max(l,r),u=Math.abs(t-e),c=e>t?0:1;if(u>=B-1e-6){const e=o?.x??0,t=o?.y??0,n=`${G(e)},${G(t-s)}`,r=`${G(e)},${G(t+s)}`;let a=`M${n} A${G(s)},${G(s)} 0 1 1 ${r} A${G(s)},${G(s)} 0 1 1 ${n} Z`;if(l>0){const n=`${G(e)},${G(t-l)}`,r=`${G(e)},${G(t+l)}`;a+=` M${n} A${G(l)},${G(l)} 0 1 0 ${r} A${G(l)},${G(l)} 0 1 0 ${n} Z`}return a}const d=u>Math.PI?1:0,p=i(e,s),f=i(t,s);if(0>=l){const e=o?.x??0,t=o?.y??0;return`M${G(e)},${G(t)} L${p} A${G(s)},${G(s)} 0 ${d} ${c} ${f} Z`}const m=i(t,l),h=i(e,l);return`M${p} A${G(s)},${G(s)} 0 ${d} ${c} ${f} L${m} A${G(l)},${G(l)} 0 ${d} ${1===c?0:1} ${h} Z`}function G(e){return Math.round(1e3*e)/1e3}function Y(e,t,n=0){return t>0?((e-n)%t+t)%t+n:e}var J=require("react/jsx-runtime");function Q({value:e,onChange:t,period:n=365,radius:r=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:f,style:m}){const h=o??2*r+40,b=i??2*r+40,y=h/2,g=b/2,x=function(e){const[t,n]=e,r=n-t||1,a=B;return e=>0+(e-t)/r*(a-0)}([0,n]),v=(0,q.useRef)(null),w=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,r=t.getBoundingClientRect(),a=t.viewBox?.baseVal;return Math.round((Math.atan2((a?.width||h)/(r.width||1)*(e.clientX-r.left)-y-0,-((a?.height||b)/(r.height||1)*(e.clientY-r.top)-g-0))+B)%B/B*n)%n},j=(e,t)=>{e.preventDefault(),e.stopPropagation();const n=e.currentTarget.ownerSVGElement;n?.setPointerCapture?.(e.pointerId),v.current={mode:t,lastValue:w(e)}},k=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),v.current=null},C=(e,r)=>{t("range"===e?e=>({start:Y(e.start+r,n),end:Y(e.end+r,n)}):t=>({...t,[e]:Y(t[e]+r,n)}))},$=e=>t=>{const n=t.shiftKey?s:l;"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),C(e,n)):"ArrowLeft"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),C(e,-n))},M=e.start>e.end?[[e.start,n],[0,e.end]]:[[e.start,e.end]],S=e=>c?c(e):e+"";return(0,J.jsx)("svg",{viewBox:`0 0 ${h} ${b}`,width:h,height:b,className:f,onPointerMove:e=>{const r=v.current;if(!r)return;const a=w(e);if("range"===r.mode){const e=function(e,t,n){if(0>=n)return t-e;let r=(t-e)%n;return r>n/2?r-=n:-n/2>r&&(r+=n),r}(r.lastValue,a,n);if(0===e)return;return r.lastValue=a,void t(t=>({start:Y(t.start+e,n),end:Y(t.end+e,n)}))}t(e=>({...e,[r.mode]:a}))},onPointerUp:k,onPointerCancel:k,onLostPointerCapture:k,style:{touchAction:"none",...m},"aria-label":u+" brush",children:(0,J.jsxs)("g",{transform:`translate(${y},${g})`,children:[(0,J.jsx)("g",{role:"slider",tabIndex:0,"aria-label":u+" (move both ends)","aria-valuemin":0,"aria-valuemax":n-1,"aria-valuenow":e.start,"aria-valuetext":`${S(e.start)} to ${S(e.end)}`,onPointerDown:e=>j(e,"range"),onKeyDown:$("range"),style:{cursor:"grab"},children:M.map(([e,t],n)=>(0,J.jsx)("path",{d:X(x(e),x(t),a,r),fill:d,fillOpacity:.35,stroke:p,strokeWidth:1},n))}),["start","end"].map(t=>{const o=e[t],i=(e=>U(x(e),a))(o),l=(e=>U(x(e),r+8))(o);return(0,J.jsxs)("g",{role:"slider",tabIndex:0,"aria-label":`${u} ${t}`,"aria-valuemin":0,"aria-valuemax":n-1,"aria-valuenow":o,"aria-valuetext":S(o),onPointerDown:e=>j(e,t),onKeyDown:$(t),style:{cursor:"grab"},children:[(0,J.jsx)("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:"transparent",strokeWidth:20}),(0,J.jsx)("line",{x1:i.x,y1:i.y,x2:l.x,y2:l.y,stroke:p,strokeWidth:1.5}),(0,J.jsx)("circle",{cx:l.x,cy:l.y,r:4.5,fill:p,stroke:d,strokeWidth:1})]},t)})]})})}var ee=s(require("react")),te=require("react/jsx-runtime");function ne(e,t,n=0){const r=Math.min(t[0],t[1]),a=Math.max(t[0],t[1]),o=Math.max(r,Math.min(a,e[0])),i=Math.max(r,Math.min(a,e[1])),l=o>i?[i,o]:[o,i];if(l[1]-l[0]>=n)return l;const s=(l[0]+l[1])/2,u=n/2;return[Math.max(r,Math.min(a-n,s-u)),Math.min(a,Math.max(r+n,s+u))]}function re(e,t,n,r=1,a=r){const o="in"===n?r:-r;return ne([e[0]+o,e[1]-o],t,a)}function ae(e){const{domain:t,initialValue:n=t,step:r=1,minSpan:a=r,label:o,formatValue:i,onChange:l}=e,[s,u]=ee.useState(()=>ne(n,t,a)),c=ne(s,t,a),d=ee.useCallback(e=>{const n=ne(e,t,a);u(n),l?.(n)},[t,a,l]),p=ee.useMemo(()=>({label:o,domain:t,value:c,step:r,formatValue:i,onChange:d,onClear:()=>d(t)}),[t,i,o,d,r,c]),f=ee.useMemo(()=>({onZoomIn:()=>d(re(c,t,"in",r,a)),onZoomOut:()=>d(re(c,t,"out",r,a)),onReset:()=>d(t)}),[t,a,d,r,c]);return{value:c,setValue:d,xExtent:c,brush:p,zoom:f}}var oe={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)))"},ie={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function le(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 se(e){return"function"==typeof e}function ue({brush:e,targetSize:t}){const n=e?.value,r=e?.domain,a=!!n&&!!r,o=!0===e?.disabled,i=e?.formatValue??(e=>e),l=!!e?.onChange&&a&&!o,s=r?.[0]??0,u=r?.[1]??1,c=n?.[0]??s,d=n?.[1]??u,p=e?.step??((u-s)/100||1);return(0,te.jsxs)("section",{style:oe,"aria-label":"Brush controls",children:[(0,te.jsx)("div",{style:ie,children:e?.label??"Filter range"}),a?(0,te.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,te.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,te.jsxs)("span",{children:["Start: ",i(c)]}),(0,te.jsx)("input",{type:"range",min:s,max:u,step:p,value:c,disabled:!l,style:{minHeight:t},onChange:t=>{const n=Number(t.currentTarget.value);e?.onChange?.([Math.min(n,d),d])}})]}),(0,te.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,te.jsxs)("span",{children:["End: ",i(d)]}),(0,te.jsx)("input",{type:"range",min:s,max:u,step:p,value:d,disabled:!l,style:{minHeight:t},onChange:t=>{const n=Number(t.currentTarget.value);e?.onChange?.([c,Math.max(n,c)])}})]})]}):(0,te.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,te.jsx)("button",{type:"button",disabled:o||!se(e?.onClear),onClick:e?.onClear,style:le(t),children:"Clear range"})]})}function ce({zoom:e,targetSize:t}){const n=!0===e?.disabled;return(0,te.jsxs)("section",{style:oe,"aria-label":"Zoom controls",children:[(0,te.jsx)("div",{style:ie,children:e?.label??"Zoom"}),(0,te.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,te.jsx)("button",{type:"button","aria-label":"Zoom out",disabled:n||!se(e?.onZoomOut),onClick:e?.onZoomOut,style:le(t),children:"-"}),(0,te.jsx)("button",{type:"button","aria-label":"Reset zoom",disabled:n||!se(e?.onReset),onClick:e?.onReset,style:le(t),children:"Reset"}),(0,te.jsx)("button",{type:"button","aria-label":"Zoom in",disabled:n||!se(e?.onZoomIn),onClick:e?.onZoomIn,style:le(t),children:"+"})]})]})}function de({legend:e,targetSize:t}){const n=!0===e?.disabled,r=e?.items??[];return(0,te.jsxs)("section",{style:oe,"aria-label":"Legend controls",children:[(0,te.jsx)("div",{style:ie,children:e?.label??"Series"}),r.length>0&&(0,te.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:r.map(r=>{const a=!1!==r.active;return(0,te.jsxs)("button",{type:"button",disabled:n||r.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(r.id,!a),style:le(t,a),"aria-pressed":a,children:[r.color&&(0,te.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:r.color}}),r.label??r.id]},r.id)})}),(0,te.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,te.jsx)("button",{type:"button",disabled:n||!se(e?.onShowAll),onClick:e?.onShowAll,style:le(t),children:"Show all"}),(0,te.jsx)("button",{type:"button",disabled:n||!se(e?.onHideAll),onClick:e?.onHideAll,style:le(t),children:"Hide all"})]})]})}function pe({controls:e,targetSize:t=44,compact:n=!1,className:r,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 n=[];return t.brush&&n.push("brush"),t.zoom&&n.push("zoom"),t.legend&&n.push("legend"),n}(e,{brush:i,zoom:l,legend:s});return 0===u.length?null:(0,te.jsxs)("div",{className:r,role:"group","aria-label":o,style:{display:"grid",gridTemplateColumns:n?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...a},children:[u.includes("brush")&&(0,te.jsx)(ue,{brush:i,targetSize:t}),u.includes("zoom")&&(0,te.jsx)(ce,{zoom:l,targetSize:t}),u.includes("legend")&&(0,te.jsx)(de,{legend:s,targetSize:t})]})}
|