Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/export-feature-row-classification.md
Original file line number Diff line number Diff line change
@@ -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`.
8 changes: 8 additions & 0 deletions packages/vis/src/SpatialCanvas/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
5 changes: 5 additions & 0 deletions packages/vis/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export type {
ElementsByType,
FeatureColorResolver,
FeatureColorResolverContext,
FeatureRowState,
FeatureRowStateInput,
FeatureRowTone,
HoverTooltipMode,
ImageLayerContextValue,
ImageLoaderData,
Expand Down Expand Up @@ -75,6 +78,8 @@ export type {
export {
composeSpatialDeckLayers,
createSpatialCanvasStore,
describeFeatureRowState,
featureRowOpacity,
ImageLayerContextProvider,
layerConfig,
mergeLayerChannelState,
Expand Down
Loading