diff --git a/.changeset/export-feature-row-classification.md b/.changeset/export-feature-row-classification.md new file mode 100644 index 00000000..844f6e5e --- /dev/null +++ b/.changeset/export-feature-row-classification.md @@ -0,0 +1,18 @@ +--- +'@spatialdata/vis': minor +--- + +Export the feature-row classification alongside the points feature state. + +`usePointsFeatureState` returns raw engine signals — `residentCodes`, +`loadedMatchingCodes`, `matchingLoadState`, `supportsOnDemandLoad` — and +`describeFeatureRowState` is what turns them into a row's rendered state: whether +it is dimmed, a short label, and a sentence explaining why. Only the former was +reachable from the package entry, so an embedder building its own feature list had +the data but not the reading of it, and had to re-derive a precedence order +(resident/rendered beat selection and scan state) that is easy to get subtly wrong +— the failure mode being a panel that greys a feature the canvas is drawing. + +Adds `describeFeatureRowState` and `featureRowOpacity`, plus the types +`FeatureRowState`, `FeatureRowStateInput` and `FeatureRowTone`. No behaviour +change; these already backed the built-in `PointsFeatureFilterPanel`. diff --git a/packages/vis/src/SpatialCanvas/public.ts b/packages/vis/src/SpatialCanvas/public.ts index b4f874a3..763c3ac4 100644 --- a/packages/vis/src/SpatialCanvas/public.ts +++ b/packages/vis/src/SpatialCanvas/public.ts @@ -15,6 +15,14 @@ export type { FeatureColorResolver, FeatureColorResolverContext, } from './featureColorResolver'; +export type { FeatureRowState, FeatureRowStateInput, FeatureRowTone } from './featureRowState'; +// Feature-row classification. Exported because it is the other half of +// `usePointsFeatureState`: the hook hands back raw engine signals (resident, +// rendered, scanning…) and this turns them into the dimming + the sentence that +// explains it. An embedder building its own feature list would otherwise have to +// re-derive that precedence, and any drift shows up as a panel telling the user +// something different from what the canvas is doing. +export { describeFeatureRowState, featureRowOpacity } from './featureRowState'; export { useSpatialViewState, useViewStateUrl } from './hooks'; export type { ImageLayerContextValue } from './ImageLayerContext'; export { ImageLayerContextProvider, useImageLayerContext } from './ImageLayerContext'; diff --git a/packages/vis/src/index.ts b/packages/vis/src/index.ts index 4bc0e6b4..abb75edd 100644 --- a/packages/vis/src/index.ts +++ b/packages/vis/src/index.ts @@ -33,6 +33,9 @@ export type { ElementsByType, FeatureColorResolver, FeatureColorResolverContext, + FeatureRowState, + FeatureRowStateInput, + FeatureRowTone, HoverTooltipMode, ImageLayerContextValue, ImageLoaderData, @@ -75,6 +78,8 @@ export type { export { composeSpatialDeckLayers, createSpatialCanvasStore, + describeFeatureRowState, + featureRowOpacity, ImageLayerContextProvider, layerConfig, mergeLayerChannelState,