@altertable/data-app-react 0.73.0 → 0.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $t as DateFormattingContext, B as createDataHooks, Ct as DetailRoutes, D as Stack, Dt as ownedSource, E as TextContent, Et as DataSectionBoundary, Gt as shortcuts, H as useDeclaredResult, Ht as TooltipProvider, I as IconButton, Jt as AppIcon, Kt as InspectionContext, L as useDataAppAnnotations, Ot as resolveActions, Qt as classNames, R as AnnotationTooltip, St as DetailContent, T as DataAppFrame, Tt as useDetailNavigation, V as PrimaryViewContext, Vt as Tooltip, Wt as Kbd, Xt as Button, Yt as EmptyState, Z as Select, _ as comparisonChange, _t as exportDatasets, a as TextWidget$1, at as SearchSuggestionsContext, bt as DateTimeTooltip, ct as choiceVariable, d as MetricWidget$1, dt as searchVariable, en as useDateFormatting, f as VisualizationWidget$1, g as metricComparison, gt as datasetTable, h as ContentSkeleton, ht as RegisteredBinding, i as chartColor, jt as mountDataApp, kt as breakdownState, lt as dateRangeVariable, m as getAnnotationProps, mt as MetricRecords, n as createDataContext, nn as injectDataAppStyles, o as TableWidget$1, pt as sectionContent, qt as useInspectionDefaults, rn as injectStyles, rt as Skeleton, t as SectionHeading, tn as useDataApp, ut as multiChoiceVariable, v as ExplorationActionControl, vt as registeredEvidence, w as DataValue$1, wt as DetailView, yt as DateDisplay, zt as Sheet } from "./chunks/SectionHeading-CVenpddF.js";
1
+ import { At as resolveActions, C as ContentSkeleton, Ct as DetailContent, D as TextContent, Dt as DataSectionBoundary, E as DataAppFrame, Et as useDetailNavigation, H as PrimaryViewContext, Jt as InspectionContext, Kt as Kbd, L as IconButton, Nt as mountDataApp, O as Stack, Q as Select, Qt as Button, R as useDataAppAnnotations, S as withWidgetBoundary, T as DataValue$1, Tt as DetailView, U as useDeclaredResult, Ut as Tooltip, V as createDataHooks, Vt as Sheet, Wt as TooltipProvider, Xt as AppIcon, Yt as useInspectionDefaults, Zt as EmptyState, _t as datasetTable, a as TextWidget$1, an as injectStyles, bt as DateDisplay, d as MetricWidget$1, dt as multiChoiceVariable, en as classNames, f as VisualizationWidget$1, ft as searchVariable, gt as RegisteredBinding, h as ExplorationActionControl, ht as MetricRecords, i as chartColor, in as injectDataAppStyles, it as Skeleton, jt as breakdownState, kt as ownedSource, lt as choiceVariable, m as comparisonChange, mt as sectionContent, n as createDataContext, nn as useDateFormatting, o as TableWidget$1, ot as SearchSuggestionsContext, p as metricComparison, qt as shortcuts, rn as useDataApp, t as SectionHeading, tn as DateFormattingContext, ut as dateRangeVariable, vt as exportDatasets, w as getAnnotationProps, wt as DetailRoutes, xt as DateTimeTooltip, yt as registeredEvidence, z as AnnotationTooltip } from "./chunks/SectionHeading-DYRGGLUr.js";
2
2
  import { KEY_SEPARATOR, invariant } from "@altertable/data-app/internal";
3
3
  import { useContext, useEffect, useEffectEvent, useImperativeHandle, useReducer, useRef, useState } from "react";
4
4
  import { autoUpdate, flip, offset, shift, useFloating, useMergeRefs } from "@floating-ui/react";
@@ -78,7 +78,7 @@ function GridItem({ children, span = 1, className, ...props }) {
78
78
  }
79
79
  //#endregion
80
80
  //#region src/widgets.tsx
81
- function MetricWidget({ metric, source, records, actions, action, ...presentation }) {
81
+ function MetricWidgetContent({ metric, source, records, actions, action, ...presentation }) {
82
82
  const navigation = useDetailNavigation();
83
83
  const itemActions = resolveActions(actions, metric, RegisteredBinding.owner(metric), source, (target, input, trigger) => navigation.open(target, input, trigger));
84
84
  const [widgetElement, setWidgetElement] = useState(null);
@@ -97,7 +97,7 @@ function MetricWidget({ metric, source, records, actions, action, ...presentatio
97
97
  } }) : void 0
98
98
  });
99
99
  }
100
- function TableWidget({ dataset, source, title, actions, ...presentation }) {
100
+ function TableWidgetContent({ dataset, source, title, actions, ...presentation }) {
101
101
  const data = datasetTable(dataset, source);
102
102
  const navigation = useDetailNavigation();
103
103
  const itemActions = resolveActions(actions, dataset, RegisteredBinding.owner(dataset), source, (target, input, trigger) => navigation.open(target, input, trigger));
@@ -116,7 +116,7 @@ function TableWidget({ dataset, source, title, actions, ...presentation }) {
116
116
  }] : data.columns
117
117
  });
118
118
  }
119
- function VisualizationWidget({ dataset, source, title, actions, breakdown, children, views, viewLabel, initialView, ...presentation }) {
119
+ function VisualizationWidgetContent({ dataset, source, title, actions, breakdown, children, views, viewLabel, initialView, ...presentation }) {
120
120
  const data = datasetTable(dataset, source);
121
121
  const navigation = useDetailNavigation();
122
122
  const itemActions = resolveActions(actions, dataset, RegisteredBinding.owner(dataset), source, (target, input, trigger) => navigation.open(target, input, trigger));
@@ -176,7 +176,7 @@ function VisualizationWidget({ dataset, source, title, actions, breakdown, child
176
176
  initialView
177
177
  });
178
178
  }
179
- function TextWidget(props) {
179
+ function TextWidgetContent(props) {
180
180
  if (props.metric) {
181
181
  const { metric, source, title, children, ...presentation } = props;
182
182
  return /* @__PURE__ */ jsx(TextWidget$1, {
@@ -223,6 +223,10 @@ function DataValue(props) {
223
223
  children: children ?? ((value) => value)
224
224
  });
225
225
  }
226
+ const MetricWidget = withWidgetBoundary(MetricWidgetContent);
227
+ const TableWidget = withWidgetBoundary(TableWidgetContent);
228
+ const VisualizationWidget = withWidgetBoundary(VisualizationWidgetContent);
229
+ const TextWidget = withWidgetBoundary(TextWidgetContent);
226
230
  //#endregion
227
231
  //#region src/ui/Breakdown.tsx
228
232
  /** Mutually exclusive parts of one observed whole. Every share uses the supplied total. */
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["DisplayMetric","DisplayTable","DisplayVisual","DisplayText","DisplayValue"],"sources":["../src/ui/DataApp.tsx","../src/ui/Grid.tsx","../src/ui/GridItem.tsx","../src/widgets.tsx","../src/ui/Breakdown.tsx","../src/ui/Ranking.tsx","../src/ui/Comparison.tsx","../src/ui/DataSection.tsx","../src/ui/UpdatedAt.tsx","../src/ui/PeriodSummary.tsx","../src/ui/data-identifiers.tsx","../src/annotations/AnnotationTarget.tsx","../src/annotations/AnnotationBar.tsx","../src/annotations/styles.ts"],"sourcesContent":["import { KEY_SEPARATOR } from '@altertable/data-app/internal';\nimport type { DisplayedSnapshot } from '@altertable/data-app/internal';\n\nimport { useDataApp } from '../app-context.ts';\nimport {\n registeredEvidence,\n exportDatasets,\n type ExportDataset,\n type RegisteredBinding,\n} from '../bindings.ts';\nimport { DateFormattingContext } from '../date-formatting.ts';\nimport { DetailRoutes, type DetailContent } from '../details.tsx';\nimport { SearchSuggestionsContext } from '../search-suggestions.ts';\nimport { ownedSource } from '../source-owner.ts';\nimport {\n PrimaryViewContext,\n type DeclaredView,\n useDeclaredResult,\n} from '../view-runtime.tsx';\nimport {\n DataAppFrame,\n type DataAppBaseProps,\n type DataAppControlProps,\n} from './DataAppFrame.tsx';\nimport type { StoryFinding } from './story.ts';\n\nexport type DataAppProps<Data, Input = unknown> = Omit<\n DataAppBaseProps,\n 'dataContext'\n> &\n DataAppControlProps & {\n view: DeclaredView<Data, Input> & {\n scope(snapshot: DisplayedSnapshot<Data, Input>): string;\n };\n /** Show supplied datasets’ record suggestions on the first declared search. Defaults to true. */\n showSearchSuggestions?: boolean;\n story: (snapshot: DisplayedSnapshot<Data, Input>) => readonly (Omit<\n StoryFinding,\n 'evidence'\n > & {\n evidence: RegisteredBinding;\n })[];\n datasets: readonly [\n ExportDataset<Data, Input>,\n ...ExportDataset<Data, Input>[],\n ];\n /** Detail destinations available to dataset actions and metric record inspection. */\n details?: readonly DetailContent<any, any>[];\n };\n\n/** Executes the primary view and owns its controls, inspection, exports, and stories. */\nexport function DataApp<Data, Input>(props: DataAppProps<Data, Input>) {\n const {\n view,\n datasets,\n story,\n showSearchSuggestions = true,\n details = [],\n children,\n ...frame\n } = props;\n const app = useDataApp();\n const result = useDeclaredResult(view);\n const source = ownedSource(\n view,\n result.snapshot ?? { loading: true as const }\n );\n const suggestionGroups =\n showSearchSuggestions && frame.showSearch !== false && result.searchControls\n ? datasets.flatMap((dataset, index) => {\n const reading = dataset.readSearchSuggestions(source);\n if (!reading) return [];\n return [\n reading.loading\n ? []\n : reading.value.map(item => ({\n ...item,\n id: [index, item.id].join(KEY_SEPARATOR),\n })),\n ];\n })\n : [];\n return (\n <DateFormattingContext value={{ timeZone: result.timeZone }}>\n <SearchSuggestionsContext\n value={\n suggestionGroups.length\n ? {\n groups: suggestionGroups,\n busy: result.refreshing,\n }\n : null\n }\n >\n <PrimaryViewContext value={{ declaration: view, result }}>\n <DetailRoutes details={details}>\n <DataAppFrame\n {...frame}\n request={result}\n dataContext={result.dataContext}\n story={snapshot =>\n story(ownedSource(view, snapshot)).map(finding => ({\n ...finding,\n evidence: registeredEvidence(finding.evidence, view),\n }))\n }\n csvExport={(snapshot: DisplayedSnapshot<Data, Input>) =>\n exportDatasets(\n datasets,\n ownedSource(view, snapshot),\n view.scope(snapshot),\n app.title\n )\n }\n >\n {children}\n </DataAppFrame>\n </DetailRoutes>\n </PrimaryViewContext>\n </SearchSuggestionsContext>\n </DateFormattingContext>\n );\n}\n","import { type ComponentPropsWithRef, type ReactNode } from 'react';\n\nimport { classNames } from './classNames.ts';\n\nexport type GridProps = {\n children: ReactNode;\n /** Maximum columns; cards wrap sooner when the container cannot fit their minimum width. */\n columns?: 1 | 2 | 3 | 4;\n minItemWidth?: 'compact' | 'regular' | 'wide';\n gap?: 'sm' | 'md' | 'lg';\n /** `stretch` gives widgets in each row the same height. */\n align?: 'stretch' | 'start';\n} & Omit<ComponentPropsWithRef<'div'>, 'children'>;\n\n/** Responsive layout for peer cards and panels. Cards keep their content height by default. */\nexport function Grid({\n children,\n columns = 1,\n minItemWidth = 'regular',\n gap = 'lg',\n align = 'start',\n className,\n ...props\n}: GridProps) {\n return (\n <div\n {...props}\n className={classNames('altertable-grid', className)}\n data-columns={columns}\n data-min-item-width={minItemWidth}\n data-gap={gap}\n data-align={align}\n >\n {children}\n </div>\n );\n}\n","import { type ComponentPropsWithRef, type ReactNode } from 'react';\n\nimport { classNames } from './classNames.ts';\n\nexport type GridItemProps = {\n children: ReactNode;\n /** Maximum tracks occupied; collapses to one when the grid container is narrow. */\n span?: 1 | 2;\n} & Omit<ComponentPropsWithRef<'div'>, 'children'>;\n\nexport function GridItem({\n children,\n span = 1,\n className,\n ...props\n}: GridItemProps) {\n return (\n <div\n {...props}\n className={classNames('altertable-grid-item', className)}\n data-span={span}\n >\n {children}\n </div>\n );\n}\n","import { formatMetric } from '@altertable/data-app/format';\nimport type { MetricValues } from '@altertable/data-app/internal';\nimport type { DataReading } from '@altertable/data-app/internal';\nimport { useEffect, useRef, useState, type ComponentRef } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { resolveActions, type ExplorationActions } from './actions.ts';\nimport { RegisteredBinding } from './bindings.ts';\nimport {\n datasetTable,\n type Dataset,\n type Metric,\n type ViewSource,\n} from './bindings.ts';\nimport { MetricRecords } from './bindings.ts';\nimport { useDetailNavigation } from './details.tsx';\nimport { breakdownState, type BreakdownTarget } from './exploration.ts';\nimport {\n DataValue as DisplayValue,\n type DataValueProps as DisplayValueProps,\n} from './ui/DataValue.tsx';\nimport {\n ExplorationActionControl,\n type ItemActions,\n} from './ui/ExplorationActionControl.tsx';\nimport type { MetricDefinition } from './ui/metric.ts';\nimport {\n MetricWidget as DisplayMetric,\n type MetricWidgetProps as DisplayMetricProps,\n} from './ui/MetricWidget.tsx';\nimport { Select } from './ui/Select.tsx';\nimport { Skeleton } from './ui/Skeleton.tsx';\nimport {\n TableWidget as DisplayTable,\n type TableWidgetProps as DisplayTableProps,\n type TableDisplayMode,\n} from './ui/TableWidget.tsx';\nimport {\n TextWidget as DisplayText,\n type TextWidgetProps as DisplayTextProps,\n} from './ui/TextWidget.tsx';\nimport {\n VisualizationWidget as DisplayVisual,\n type VisualizationWidgetProps as DisplayVisualProps,\n type VisualizationWidgetView as DisplayVisualizationView,\n} from './ui/VisualizationWidget.tsx';\n\nexport type MetricWidgetProps<Data = unknown, Input = unknown> = Omit<\n Extract<DisplayMetricProps, { metric: MetricDefinition }>,\n 'metric' | 'reading' | 'records'\n> & {\n metric: Metric<Data, Input>;\n source: ViewSource<NoInfer<Data>, NoInfer<Input>>;\n records?: MetricRecords<Data, Input, any, any>;\n actions?: ExplorationActions<void, NoInfer<Input>>;\n};\nexport function MetricWidget<Data, Input>({\n metric,\n source,\n records,\n actions,\n action,\n ...presentation\n}: MetricWidgetProps<Data, Input>) {\n const navigation = useDetailNavigation();\n const itemActions = resolveActions(\n actions,\n metric,\n RegisteredBinding.owner(metric),\n source,\n (target, input, trigger) => navigation.open(target, input, trigger)\n );\n const [widgetElement, setWidgetElement] =\n useState<ComponentRef<'div'> | null>(null);\n const availableActions = itemActions(undefined);\n return (\n <DisplayMetric\n {...presentation}\n ref={setWidgetElement}\n metric={metric.definition}\n reading={metric.read(source)}\n action={\n action || availableActions.length ? (\n <>\n {action}\n <ExplorationActionControl\n actions={availableActions}\n ariaLabel={metric.definition.label}\n />\n </>\n ) : undefined\n }\n records={\n records\n ? MetricRecords.render(records, metric, source, {\n open(target, input) {\n navigation.open(\n target,\n input,\n widgetElement?.querySelector('header button')\n );\n },\n })\n : undefined\n }\n />\n );\n}\n\ntype BoundTableProps<Row> = Extract<\n DisplayTableProps<Row>,\n { reading: DataReading<readonly Row[]> }\n>;\ntype TablePresentation<Row> = Pick<\n BoundTableProps<Row>,\n 'title' | 'columns' | 'rowKey' | 'reading' | 'evidence' | 'emptyFallback'\n>;\nexport type TableWidgetProps<Row, Data = unknown, Input = unknown> = Omit<\n BoundTableProps<Row>,\n keyof TablePresentation<Row> | 'limit' | 'pagination'\n> &\n TableDisplayMode & {\n dataset: Dataset<Data, Input, Row>;\n source: ViewSource<NoInfer<Data>, NoInfer<Input>>;\n title?: ReactNode;\n actions?: ExplorationActions<NoInfer<Row>, NoInfer<Input>>;\n };\nexport function TableWidget<Row, Data, Input>({\n dataset,\n source,\n title,\n actions,\n ...presentation\n}: TableWidgetProps<Row, Data, Input>) {\n const data = datasetTable(dataset, source);\n const navigation = useDetailNavigation();\n const itemActions = resolveActions(\n actions,\n dataset,\n RegisteredBinding.owner(dataset),\n source,\n (target, input, trigger) => navigation.open(target, input, trigger)\n );\n const hasRowActions =\n actions &&\n (data.reading.loading ||\n data.reading.value.some(row => itemActions(row).length > 0));\n return (\n <DisplayTable\n {...presentation}\n {...data}\n title={title ?? data.title}\n columns={\n hasRowActions\n ? [\n ...data.columns,\n {\n id: '$exploration-actions',\n header: 'Actions',\n cell: row => (\n <ExplorationActionControl\n actions={itemActions(row)}\n ariaLabel={`${data.title}: ${data.rowKey(row)}`}\n />\n ),\n },\n ]\n : data.columns\n }\n />\n );\n}\ntype BoundVisual<Row> = Extract<\n DisplayVisualProps<readonly Row[]>,\n { reading: DataReading<readonly Row[]> }\n>;\nexport type VisualizationWidgetView<Row> = Omit<\n DisplayVisualizationView<readonly Row[]>,\n 'render'\n> & {\n render: (rows: readonly Row[], actions: ItemActions<Row>) => ReactNode;\n};\ntype VisualContent<Row> =\n | {\n children: (rows: readonly Row[], actions: ItemActions<Row>) => ReactNode;\n views?: never;\n viewLabel?: never;\n initialView?: never;\n }\n | {\n children?: never;\n views: readonly VisualizationWidgetView<Row>[];\n viewLabel: string;\n initialView?: string;\n };\nexport type VisualizationWidgetProps<\n Row,\n Data = unknown,\n Input = unknown,\n> = Omit<\n BoundVisual<Row>,\n | 'reading'\n | 'isEmpty'\n | 'emptyFallback'\n | 'evidence'\n | 'title'\n | 'children'\n | 'views'\n | 'viewLabel'\n | 'initialView'\n> &\n VisualContent<Row> & {\n dataset: Dataset<Data, Input, Row>;\n source: ViewSource<NoInfer<Data>, NoInfer<Input>>;\n title?: ReactNode;\n actions?: ExplorationActions<NoInfer<Row>, NoInfer<Input>>;\n breakdown?: BreakdownTarget<any>;\n };\nexport function VisualizationWidget<Row, Data, Input>({\n dataset,\n source,\n title,\n actions,\n breakdown,\n children,\n views,\n viewLabel,\n initialView,\n ...presentation\n}: VisualizationWidgetProps<Row, Data, Input>) {\n const data = datasetTable(dataset, source);\n const navigation = useDetailNavigation();\n const itemActions = resolveActions(\n actions,\n dataset,\n RegisteredBinding.owner(dataset),\n source,\n (target, input, trigger) => navigation.open(target, input, trigger)\n );\n const state =\n breakdown && breakdownState(breakdown, RegisteredBinding.owner(dataset));\n const controlRef = useRef<ComponentRef<'div'>>(null);\n const recoverFocus = useRef(false);\n useEffect(() => {\n if (recoverFocus.current) {\n recoverFocus.current = false;\n controlRef.current?.querySelector('button')?.focus();\n }\n }, [state?.value]);\n function resolvedActions(row: Row) {\n return itemActions(row).map(action => ({\n ...action,\n onSelect(trigger?: HTMLElement | SVGElement) {\n recoverFocus.current = true;\n action.onSelect(trigger);\n },\n }));\n }\n const action = state ? (\n <div ref={controlRef}>\n <Select\n label={state.variable.label ?? 'Break down by'}\n labelPlacement=\"inline\"\n icon=\"breakdown\"\n size=\"compact\"\n align=\"end\"\n options={state.options.map(level => ({\n id: level.id,\n label: level.label,\n }))}\n value={state.value}\n onChange={id => state.set(id)}\n />\n </div>\n ) : (\n presentation.action\n );\n const common = {\n ...presentation,\n action,\n title: title ?? data.title,\n reading: data.reading,\n evidence: data.evidence,\n emptyFallback: data.emptyFallback,\n isEmpty: (rows: readonly Row[]) => rows.length === 0,\n };\n return children ? (\n <DisplayVisual<readonly Row[]> {...common}>\n {rows => children(rows, resolvedActions)}\n </DisplayVisual>\n ) : (\n <DisplayVisual<readonly Row[]>\n {...common}\n views={views!.map(view => ({\n ...view,\n render: rows => view.render(rows, resolvedActions),\n }))}\n viewLabel={viewLabel!}\n initialView={initialView}\n />\n );\n}\n\ntype NarrativeBinding<Data, Input, Row> =\n | {\n metric: Metric<Data, Input>;\n dataset?: never;\n source: ViewSource<NoInfer<Data>, NoInfer<Input>>;\n children?: (values: MetricValues) => ReactNode;\n }\n | {\n metric?: never;\n dataset: Dataset<Data, Input, Row>;\n source: ViewSource<NoInfer<Data>, NoInfer<Input>>;\n children: (rows: readonly Row[]) => ReactNode;\n };\nexport type TextWidgetProps<\n Data = unknown,\n Input = unknown,\n Row = never,\n> = Omit<\n Extract<DisplayTextProps<unknown>, { reading: DataReading<unknown> }>,\n 'reading' | 'evidence' | 'children' | 'title' | 'emptyFallback'\n> &\n NarrativeBinding<Data, Input, Row> & { title?: ReactNode };\nexport function TextWidget<Data, Input, Row>(\n props: TextWidgetProps<Data, Input, Row>\n) {\n if (props.metric) {\n const { metric, source, title, children, ...presentation } = props;\n return (\n <DisplayText\n {...presentation}\n title={title ?? metric.definition.label}\n evidence={metric.definition.evidence}\n reading={metric.read(source)}\n >\n {children ??\n (values => formatMetric(values.current, metric.definition.format))}\n </DisplayText>\n );\n }\n const { dataset, source, title, children, ...presentation } = props;\n return (\n <DisplayText\n {...presentation}\n title={title ?? dataset.name}\n evidence={dataset.evidence}\n reading={dataset.read(source)}\n >\n {children}\n </DisplayText>\n );\n}\n\ntype InlinePresentation = Omit<\n DisplayValueProps<unknown>,\n 'reading' | 'children' | 'loadingFallback'\n> & { loadingFallback?: ReactNode };\nexport type DataValueProps<\n Data = unknown,\n Input = unknown,\n Row = never,\n> = InlinePresentation &\n (\n | (NarrativeBinding<Data, Input, Row> & { scope?: never })\n | {\n metric?: never;\n dataset?: never;\n source?: never;\n scope: DataReading<string>;\n children?: (scope: string) => ReactNode;\n }\n );\nexport function DataValue<Data, Input, Row>(\n props: DataValueProps<Data, Input, Row>\n) {\n if (props.metric) {\n const {\n metric,\n source,\n children,\n loadingFallback = <Skeleton inline />,\n ...presentation\n } = props;\n return (\n <DisplayValue\n {...presentation}\n reading={metric.read(source)}\n loadingFallback={loadingFallback}\n >\n {children ??\n (values => formatMetric(values.current, metric.definition.format))}\n </DisplayValue>\n );\n }\n if (props.dataset) {\n const {\n dataset,\n source,\n children,\n loadingFallback = <Skeleton inline />,\n ...presentation\n } = props;\n return (\n <DisplayValue\n {...presentation}\n reading={dataset.read(source)}\n loadingFallback={loadingFallback}\n >\n {children}\n </DisplayValue>\n );\n }\n const {\n scope,\n children,\n loadingFallback = <Skeleton inline />,\n ...presentation\n } = props;\n return (\n <DisplayValue\n {...presentation}\n reading={scope}\n loadingFallback={loadingFallback}\n >\n {children ?? (value => value)}\n </DisplayValue>\n );\n}\n","import { formatCount, formatPercent } from '@altertable/data-app/format';\nimport { invariant } from '@altertable/data-app/internal';\nimport {\n type ComponentPropsWithRef,\n type CSSProperties,\n type ReactNode,\n} from 'react';\n\nimport { chartColor } from './chartColor.ts';\nimport { classNames } from './classNames.ts';\n\nexport type BreakdownItem = { id: string; label: ReactNode; value: number };\nexport type BreakdownProps = {\n total: number;\n items: readonly BreakdownItem[];\n formatValue?: (value: number) => ReactNode;\n} & Omit<ComponentPropsWithRef<'div'>, 'children'>;\n\n/** Mutually exclusive parts of one observed whole. Every share uses the supplied total. */\nexport function Breakdown({\n total,\n items,\n formatValue = formatCount,\n className,\n ...props\n}: BreakdownProps) {\n invariant(\n Number.isFinite(total) &&\n total >= 0 &&\n items.every(item => Number.isFinite(item.value) && item.value >= 0) &&\n items.reduce((sum, item) => sum + item.value, 0) <= total,\n 'Breakdown items must be nonnegative parts of the observed total.'\n );\n const dominant = total > 0 && items.some(item => item.value / total >= 0.85);\n\n return (\n <div\n {...props}\n className={classNames('altertable-breakdown', className)}\n data-dominant={dominant || undefined}\n >\n <div className=\"altertable-breakdown-summary\">\n <span>Share of total</span>\n <strong>{formatValue(total)} total</strong>\n </div>\n <div className=\"altertable-breakdown-bar\" aria-hidden=\"true\">\n {items.map(item => (\n <span\n key={item.id}\n style={{\n width: `${total ? (item.value / total) * 100 : 0}%`,\n backgroundColor: chartColor(item.id),\n }}\n />\n ))}\n </div>\n <dl className=\"altertable-breakdown-list\">\n {items.map(item => {\n const share = total ? item.value / total : 0;\n const color = {\n '--altertable-breakdown-color': chartColor(item.id),\n } as CSSProperties;\n\n return (\n <div\n className=\"altertable-breakdown-row\"\n data-empty={item.value === 0 || undefined}\n key={item.id}\n style={color}\n >\n <dt>\n <span\n className=\"altertable-breakdown-swatch\"\n aria-hidden=\"true\"\n />\n {item.label}\n </dt>\n <dd className=\"altertable-breakdown-value\">\n {formatValue(item.value)}\n </dd>\n <dd className=\"altertable-breakdown-share\">\n {formatPercent(share)}\n </dd>\n </div>\n );\n })}\n </dl>\n </div>\n );\n}\n","import { formatCount } from '@altertable/data-app/format';\nimport { invariant } from '@altertable/data-app/internal';\nimport { type ComponentPropsWithRef, type ReactNode } from 'react';\n\nimport { classNames } from './classNames.ts';\n\nexport type RankingItem = {\n id: string;\n label: ReactNode;\n value: number;\n detail?: ReactNode;\n};\nexport type RankingProps = {\n items: readonly RankingItem[];\n formatValue?: (value: number) => ReactNode;\n} & Omit<ComponentPropsWithRef<'ol'>, 'children'>;\n\n/** Ordered values scaled to the largest visible item, not shares of a whole. */\nexport function Ranking({\n items,\n formatValue = formatCount,\n className,\n ...props\n}: RankingProps) {\n invariant(\n items.every(item => Number.isFinite(item.value) && item.value >= 0),\n 'Ranking values must be finite and nonnegative.'\n );\n const max = Math.max(0, ...items.map(item => item.value));\n\n return (\n <ol {...props} className={classNames('altertable-ranking', className)}>\n {items.map(item => (\n <li key={item.id}>\n <div className=\"altertable-ranking-reading\">\n <span>{item.label}</span>\n <strong>{formatValue(item.value)}</strong>\n </div>\n <div className=\"altertable-ranking-track\" aria-hidden=\"true\">\n <span style={{ width: `${max ? (item.value / max) * 100 : 0}%` }} />\n </div>\n {item.detail != null && (\n <div className=\"altertable-ranking-detail\">{item.detail}</div>\n )}\n </li>\n ))}\n </ol>\n );\n}\n","import { type MetricReading } from '@altertable/data-app/internal';\n\nimport { useDateFormatting } from '../date-formatting.ts';\nimport { ContentSkeleton } from './ContentSkeleton.tsx';\nimport { AppIcon } from './icons.ts';\nimport {\n comparisonChange,\n type MetricComparison,\n} from './metric-comparison.ts';\nimport { type MetricDefinition, metricComparison } from './metric.ts';\n\ntype UnboundComparisonProps = MetricComparison & {\n label: string;\n emphasis?: 'standard' | 'story';\n};\n\nexport type ComparisonProps =\n | UnboundComparisonProps\n | {\n metric: MetricDefinition;\n reading: MetricReading;\n emphasis?: 'standard' | 'story';\n };\n\nexport function Comparison(props: ComparisonProps) {\n const dateFormatting = useDateFormatting();\n if ('metric' in props) {\n if (props.reading.loading) return <ContentSkeleton variant=\"panel\" />;\n const comparison = metricComparison(\n props.metric,\n props.reading,\n dateFormatting\n );\n if (!comparison) return null;\n\n return (\n <ComparisonContent\n {...comparison}\n label={props.metric.label}\n emphasis={props.emphasis}\n />\n );\n }\n\n return <ComparisonContent {...props} />;\n}\n\nfunction ComparisonContent({\n label,\n current,\n previous,\n favorableDirection,\n emphasis = 'standard',\n}: UnboundComparisonProps) {\n const max = Math.max(current.value, previous?.value ?? 0, 1);\n const { percent, tone, icon } = comparisonChange({\n current,\n previous,\n favorableDirection,\n });\n\n return (\n <figure\n className=\"altertable-comparison-visual\"\n data-emphasis={emphasis}\n aria-label={`${label} comparison`}\n >\n <figcaption>{label}</figcaption>\n <div className=\"altertable-comparison-row\" data-period=\"current\">\n <div>\n <span>{current.periodLabel ?? 'Current period'}</span>\n <strong>{current.formattedValue}</strong>\n </div>\n <span className=\"altertable-comparison-track\">\n <span style={{ width: `${(current.value / max) * 100}%` }} />\n </span>\n </div>\n {previous && (\n <div className=\"altertable-comparison-row\" data-period=\"previous\">\n <div>\n <span>{previous.periodLabel ?? 'Previous period'}</span>\n <strong>{previous.formattedValue}</strong>\n </div>\n <span className=\"altertable-comparison-track\">\n <span\n style={{ width: `${((previous.value ?? 0) / max) * 100}%` }}\n />\n </span>\n </div>\n )}\n <p className=\"altertable-comparison-change\" data-tone={tone}>\n {percent === null ? (\n 'No comparable previous value'\n ) : (\n <>\n <AppIcon name={icon} size={17} />\n {Math.abs(percent).toFixed(1)}% vs{' '}\n {previous?.periodLabel?.toLowerCase() ?? 'previous period'}\n </>\n )}\n </p>\n </figure>\n );\n}\n","import { useContext, type ComponentPropsWithRef, type ReactNode } from 'react';\n\nimport { sectionContent, type ViewContent } from '../content.ts';\nimport { DateFormattingContext } from '../date-formatting.ts';\nimport {\n PrimaryViewContext,\n type ViewResult,\n useDeclaredResult,\n} from '../view-runtime.tsx';\nimport { DataSectionBoundary } from './DataSectionBoundary.tsx';\nimport {\n InspectionContext,\n useInspectionDefaults,\n} from './InspectionContext.tsx';\nimport { type EmptyContent } from './presentation.ts';\n\nexport type DataSectionProps<Data, Input = unknown> = {\n content: ViewContent<Data, Input>;\n emptyFallback?: EmptyContent;\n error?: { title: ReactNode; description?: ReactNode; onRetry?: () => void };\n label?: string;\n} & Omit<ComponentPropsWithRef<'div'>, 'children' | 'content'>;\n\nexport function DataSection<Data, Input>({\n content,\n ...presentation\n}: DataSectionProps<Data, Input>) {\n const primary = useContext(PrimaryViewContext);\n const { view, ...section } = sectionContent(content);\n if (primary?.declaration === view) {\n // Identity proves the shared result belongs to this content's declaration.\n const result = primary.result as ViewResult<Data, Input>;\n return (\n <DataSectionBoundary\n {...section}\n {...presentation}\n result={result}\n notice=\"none\"\n />\n );\n }\n return <IndependentSection view={view} {...section} {...presentation} />;\n}\n\nfunction IndependentSection<Data, Input>({\n view,\n ...props\n}: Omit<DataSectionProps<Data, Input>, 'content'> &\n ReturnType<typeof sectionContent<Data, Input>>) {\n const result = useDeclaredResult(view);\n const defaults = useInspectionDefaults();\n const section = (\n <DataSectionBoundary {...props} result={result} notice=\"inline\" />\n );\n return (\n <DateFormattingContext value={{ timeZone: result.timeZone }}>\n <InspectionContext\n value={{\n ...defaults,\n dataContext: result.dataContext,\n queries: result.queries,\n }}\n >\n {section}\n </InspectionContext>\n </DateFormattingContext>\n );\n}\n","import { parseDateTime } from '@altertable/data-app/format';\nimport { useEffect, useState, type ReactNode } from 'react';\n\nimport { useDateFormatting } from '../date-formatting.ts';\nimport {\n DateTimeTooltip,\n type DateTimeTooltipProps,\n} from './DateTimeTooltip.tsx';\n\nexport type UpdatedAtProps = {\n timestamp: number;\n locale?: string;\n label?: string;\n children?: ReactNode;\n} & Omit<DateTimeTooltipProps, 'date' | 'children'>;\n\nexport function UpdatedAt({\n timestamp,\n locale,\n label = 'Updated',\n children,\n triggerProps,\n ...props\n}: UpdatedAtProps) {\n const defaults = useDateFormatting({ locale, timeZone: props.timeZone });\n const [now, setNow] = useState(Date.now);\n\n useEffect(() => {\n const interval = window.setInterval(() => setNow(Date.now()), 30_000);\n\n return () => window.clearInterval(interval);\n }, []);\n\n const elapsedMinutes = Math.floor(Math.max(0, now - timestamp) / 60_000);\n const relative = new Intl.RelativeTimeFormat(defaults.locale, {\n numeric: 'auto',\n });\n let age = 'just now';\n if (elapsedMinutes >= 1_440)\n age = relative.format(-Math.floor(elapsedMinutes / 1_440), 'day');\n else if (elapsedMinutes >= 60)\n age = relative.format(-Math.floor(elapsedMinutes / 60), 'hour');\n else if (elapsedMinutes >= 1)\n age = relative.format(-elapsedMinutes, 'minute');\n\n const date = parseDateTime(timestamp);\n if (!date) return <span>{children ?? `${label} —`}</span>;\n\n return (\n <DateTimeTooltip\n {...props}\n {...defaults}\n date={date}\n triggerProps={{\n ...triggerProps,\n className: ['altertable-updated-at', triggerProps?.className]\n .filter(Boolean)\n .join(' '),\n }}\n >\n {children ?? (\n <time dateTime={date.toISOString()}>\n {label} {age}\n </time>\n )}\n </DateTimeTooltip>\n );\n}\n","import { type ReportingPeriod } from '@altertable/data-app/contract';\nimport {\n formatDateRange,\n formatDateTime,\n parseDateTime,\n type DateTimeFormatOptions,\n} from '@altertable/data-app/format';\n\nimport { useDateFormatting } from '../date-formatting.ts';\nimport { classNames } from './classNames.ts';\nimport { AppIcon } from './icons.ts';\nexport { type ReportingPeriod } from '@altertable/data-app/contract';\n\nexport type PeriodComparison =\n | { kind: 'previous' }\n | { kind: 'period'; period: ReportingPeriod };\n\nexport type PeriodSummaryProps = {\n period: ReportingPeriod;\n comparison?: PeriodComparison;\n className?: string;\n};\n\nfunction duration(\n period: Extract<ReportingPeriod, { kind: 'rolling' }>\n): string {\n return `${period.amount} ${period.unit}${period.amount === 1 ? '' : 's'}`;\n}\n\nfunction label(\n period: ReportingPeriod,\n options: DateTimeFormatOptions = {}\n): string {\n if (period.kind === 'rolling') return `Last ${duration(period)}`;\n\n return formatDateRange(period, options);\n}\n\nfunction comparisonLabel(\n period: ReportingPeriod,\n comparison: PeriodComparison,\n options: DateTimeFormatOptions\n): string {\n if (comparison.kind === 'period') {\n if (comparison.period.kind === 'calendar')\n return label(comparison.period, options);\n\n return `${duration(comparison.period)} ending ${formatDateTime(comparison.period.end, options)}`;\n }\n\n return period.kind === 'rolling'\n ? `Previous ${duration(period)}`\n : 'Previous period';\n}\n\nfunction reportingPeriodText(\n period: ReportingPeriod,\n options: DateTimeFormatOptions = {}\n): string {\n if (period.kind === 'calendar')\n return `${label(period, options)} in ${period.timeZone}`;\n const end = parseDateTime(period.end);\n if (!end) return label(period, options);\n const start = new Date(\n end.getTime() -\n period.amount * (period.unit === 'hour' ? 3_600_000 : 86_400_000)\n );\n\n return `${label(period, options)}, ${formatDateTime(start, options)} to ${formatDateTime(end, options)} in ${options.timeZone ?? 'UTC'}`;\n}\n\n/** Read-only period context for the variable bar, including exact bounds for assistive technology. */\nexport function PeriodSummary({\n period,\n comparison,\n className,\n}: PeriodSummaryProps) {\n const options = useDateFormatting();\n const comparisonText = comparison\n ? comparisonLabel(period, comparison, options)\n : null;\n const comparisonDetail =\n comparison?.kind === 'period'\n ? reportingPeriodText(comparison.period, options)\n : comparisonText;\n\n return (\n <p className={classNames('altertable-period-summary', className)}>\n <span className=\"altertable-sr-only\">\n {`Reporting period: ${reportingPeriodText(period, options)}${comparisonDetail ? `, compared with ${comparisonDetail}` : ''}`}\n </span>\n <span aria-hidden=\"true\" className=\"altertable-period-summary-visible\">\n <AppIcon\n name={period.kind === 'rolling' ? 'clock' : 'calendar'}\n size={16}\n />\n <span className=\"altertable-period-summary-current\">\n {label(period, options)}\n </span>\n {comparisonText && (\n <>\n <span className=\"altertable-period-summary-vs\" aria-hidden=\"true\">\n vs\n </span>\n <span>{comparisonText}</span>\n </>\n )}\n </span>\n </p>\n );\n}\n","import { invariant } from '@altertable/data-app/internal';\n\nexport type TableIdentifier = { catalog: string; schema: string; name: string };\nexport type ColumnIdentifier<TableId extends string = string> = {\n table: TableId;\n name: string;\n};\n\nexport type DataIdentifierDefinition =\n | ({ kind: 'table' } & TableIdentifier)\n | {\n kind: 'column';\n tableId: `tables.${string}`;\n table: TableIdentifier;\n name: string;\n };\n\ntype IdentifierId<\n Tables extends Record<string, TableIdentifier>,\n Columns extends Record<\n string,\n ColumnIdentifier<Extract<keyof Tables, string>>\n >,\n> =\n | `tables.${Extract<keyof Tables, string>}`\n | {\n [\n Id in Extract<keyof Columns, string>\n ]: `columns.${Columns[Id]['table']}.${Id}`;\n }[Extract<keyof Columns, string>];\n\nfunction qualifiedName(definition: DataIdentifierDefinition): string {\n const table = definition.kind === 'table' ? definition : definition.table;\n const path = [table.catalog, table.schema, table.name].join('.');\n\n return definition.kind === 'column' ? `${path}.${definition.name}` : path;\n}\n\nfunction assertAlias(id: string) {\n invariant(!!id && !id.includes('.'), `Invalid data identifier alias ${id}.`);\n}\n\n/** Register exact source names once; returned JSX IDs are checked against this registry. */\nexport function defineDataIdentifiers<\n const Tables extends Record<string, TableIdentifier>,\n const Columns extends Record<\n string,\n ColumnIdentifier<Extract<keyof Tables, string>>\n >,\n>({ tables, columns }: { tables: Tables; columns: Columns }) {\n type Id = IdentifierId<Tables, Columns>;\n const definitions: Record<string, DataIdentifierDefinition> =\n Object.create(null);\n\n for (const [id, table] of Object.entries(tables)) {\n assertAlias(id);\n definitions[`tables.${id}`] = { kind: 'table', ...table };\n }\n for (const [id, column] of Object.entries(columns)) {\n assertAlias(id);\n const table = tables[column.table];\n invariant(table, `Unknown table ${column.table} for column ${id}.`);\n definitions[`columns.${column.table}.${id}`] = {\n kind: 'column',\n tableId: `tables.${column.table}`,\n table,\n name: column.name,\n };\n }\n\n function DataIdentifier({\n id,\n display,\n }: {\n id: Id;\n display?: 'short' | 'qualified';\n }) {\n const definition = definitions[id];\n invariant(definition, `Unknown data identifier ${id}.`);\n const qualified = qualifiedName(definition);\n const shown =\n display ?? (definition.kind === 'table' ? 'qualified' : 'short');\n const table = definition.kind === 'table' ? definition : definition.table;\n const prefix =\n definition.kind === 'table'\n ? [table.catalog, table.schema]\n : [table.catalog, table.schema, table.name];\n\n return (\n <code\n className=\"altertable-data-identifier\"\n data-kind={definition.kind}\n title={qualified}\n data-identifier-id={id}\n >\n {shown === 'qualified' && (\n <span className=\"altertable-data-identifier-path\">\n {prefix.map((segment, index) => (\n <span key={index}>\n {segment}.<wbr />\n </span>\n ))}\n </span>\n )}\n <span className=\"altertable-data-identifier-name\">\n {definition.name}\n </span>\n </code>\n );\n }\n\n return {\n definitions: definitions as Readonly<Record<Id, DataIdentifierDefinition>>,\n DataIdentifier,\n };\n}\n","import { type ComponentPropsWithRef } from 'react';\n\nimport { type WidgetEvidence } from '../ui/WidgetEvidence.ts';\nimport { getAnnotationProps } from './getAnnotationProps.ts';\n\nexport type AnnotationTargetProps = ComponentPropsWithRef<'div'> & {\n annotationId: string;\n label: string;\n evidence?: WidgetEvidence;\n};\n\n/** A stable feedback target for app-owned content outside the built-in widgets. */\nexport function AnnotationTarget({\n annotationId,\n label,\n evidence,\n ...props\n}: AnnotationTargetProps) {\n return (\n <div\n {...props}\n {...getAnnotationProps({\n id: annotationId,\n label,\n evidence,\n kind: 'element',\n })}\n />\n );\n}\n","import { type Theme } from '@altertable/data-app/appearance';\nimport {\n parseDataAppAnnotationDraft,\n type DataAppAnnotationDraft,\n} from '@altertable/data-app/contract';\nimport {\n autoUpdate,\n flip,\n offset,\n shift,\n useFloating,\n useMergeRefs,\n} from '@floating-ui/react';\nimport {\n GripVertical,\n Eye,\n EyeOff,\n Trash2,\n X,\n Minus,\n LoaderCircle,\n} from 'lucide-react';\nimport {\n useEffect,\n useEffectEvent,\n useRef,\n useReducer,\n useImperativeHandle,\n type Ref,\n type ComponentRef,\n type CSSProperties,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { Button } from '../ui/Button.tsx';\nimport { Kbd } from '../ui/Kbd.tsx';\nimport { Sheet } from '../ui/Sheet.tsx';\nimport { shortcuts } from '../ui/shortcuts.ts';\nimport { TooltipProvider } from '../ui/Tooltip.tsx';\nimport { AnnotationTooltip } from './AnnotationTooltip.tsx';\n\nexport type AnnotationBarHandle = {\n /** Submit through the same guards, pending state, and retry feedback as the Send button. */\n send: () => Promise<void>;\n};\n\nexport type AnnotationBarProps = {\n ref?: Ref<AnnotationBarHandle>;\n annotations: readonly DataAppAnnotationDraft[];\n active?: boolean;\n theme?: Theme;\n disabled?: boolean;\n deletedAnnotationId?: string;\n onUndoDelete?: (id: string) => void;\n onDismissUndo?: () => void;\n hasUnsavedChanges?: boolean;\n pinsVisible: boolean;\n onPinsVisibleChange: (visible: boolean) => void;\n onSelect: (id: string) => void;\n onDelete: (id: string) => void;\n onClear: () => void;\n /** Let host apps use their existing confirmation dialog. */\n requestDiscard?: (discard: () => void) => void;\n /** Resolve only after the outer application's agent API accepts this snapshot. */\n onSend: (annotations: readonly DataAppAnnotationDraft[]) => Promise<void>;\n onClose: () => void;\n};\n\ntype AnnotationBarState = {\n position?: { left: number; top: number };\n reviewOpen: boolean;\n pending: boolean;\n error: string;\n discardOpen: boolean;\n previewId?: string;\n observedActive: boolean;\n};\ntype AnnotationBarAction =\n | {\n type: 'positionMoved';\n position: NonNullable<AnnotationBarState['position']>;\n }\n | { type: 'reviewToggled' }\n | { type: 'reviewClosed' }\n | { type: 'previewOpened'; id: string }\n | { type: 'previewClosed' }\n | { type: 'discardDialogChanged'; open: boolean }\n | { type: 'annotationsDiscarded' }\n | { type: 'submissionStarted' }\n | { type: 'submissionAccepted' }\n | { type: 'submissionFailed' }\n | { type: 'submissionFinished' }\n | { type: 'annotationModeObserved'; active: boolean };\n\nfunction annotationBarReducer(\n state: AnnotationBarState,\n action: AnnotationBarAction\n): AnnotationBarState {\n switch (action.type) {\n case 'positionMoved':\n return { ...state, position: action.position };\n case 'reviewToggled':\n return { ...state, reviewOpen: !state.reviewOpen };\n case 'reviewClosed':\n return { ...state, reviewOpen: false };\n case 'previewOpened':\n return { ...state, previewId: action.id };\n case 'previewClosed':\n return { ...state, previewId: undefined };\n case 'discardDialogChanged':\n return { ...state, discardOpen: action.open };\n case 'annotationsDiscarded':\n return { ...state, discardOpen: false, reviewOpen: false };\n case 'submissionStarted':\n return { ...state, pending: true, error: '' };\n case 'submissionAccepted':\n return { ...state, reviewOpen: false };\n case 'submissionFailed':\n return { ...state, error: 'Could not send annotations. Try again.' };\n case 'submissionFinished':\n return { ...state, pending: false };\n case 'annotationModeObserved':\n return {\n ...state,\n observedActive: action.active,\n ...(!action.active ? { reviewOpen: false, previewId: undefined } : {}),\n };\n }\n}\n\n/** Host-owned batch controls. Collection changes and agent submission stay with the outer app. */\nexport function AnnotationBar({\n ref,\n annotations,\n active = true,\n theme = 'light',\n disabled = false,\n deletedAnnotationId,\n onUndoDelete,\n onDismissUndo,\n hasUnsavedChanges = false,\n pinsVisible,\n onPinsVisibleChange,\n onSelect,\n onDelete,\n onClear,\n requestDiscard,\n onSend,\n onClose,\n}: AnnotationBarProps) {\n const reviewElement = useRef<ComponentRef<'dialog'>>(null);\n const reviewTrigger = useRef<ComponentRef<'button'>>(null);\n const cancelDiscard = useRef<ComponentRef<'button'>>(null);\n const barRef = useRef<ComponentRef<'div'>>(null);\n const drag = useRef<\n { x: number; y: number; left: number; top: number } | undefined\n >(undefined);\n const submitting = useRef(false);\n const [state, dispatch] = useReducer(annotationBarReducer, {\n reviewOpen: false,\n pending: false,\n error: '',\n discardOpen: false,\n observedActive: active,\n });\n const { position, reviewOpen, pending, error, discardOpen, previewId } =\n state;\n const preview = annotations.find(annotation => annotation.id === previewId);\n const locked = disabled || pending;\n const canSend =\n active && !locked && !hasUnsavedChanges && annotations.length > 0;\n const { refs, floatingStyles } = useFloating({\n placement: 'top',\n strategy: 'fixed',\n middleware: [offset(10), flip(), shift({ padding: 12 })],\n whileElementsMounted: autoUpdate,\n });\n\n const barElementRef = useMergeRefs([refs.setReference, barRef]);\n const reviewRef = useMergeRefs([refs.setFloating, reviewElement]);\n\n function move(left: number, top: number) {\n const rect = barRef.current?.getBoundingClientRect();\n if (!rect) return;\n dispatch({\n type: 'positionMoved',\n position: {\n left: Math.max(12, Math.min(left, window.innerWidth - rect.width - 12)),\n top: Math.max(12, Math.min(top, window.innerHeight - rect.height - 12)),\n },\n });\n }\n const keepInViewport = useEffectEvent(() => {\n if (position) move(position.left, position.top);\n });\n useEffect(() => {\n window.addEventListener('resize', keepInViewport);\n return () => window.removeEventListener('resize', keepInViewport);\n }, []);\n useEffect(() => {\n if (reviewOpen)\n reviewElement.current\n ?.querySelector<ComponentRef<'button'>>('button')\n ?.focus();\n }, [reviewOpen]);\n if (state.observedActive !== active)\n dispatch({ type: 'annotationModeObserved', active });\n function closeReview() {\n dispatch({ type: 'reviewClosed' });\n reviewTrigger.current?.focus();\n }\n async function send() {\n if (submitting.current || !canSend) return;\n submitting.current = true;\n dispatch({ type: 'submissionStarted' });\n try {\n const snapshot = annotations.map(parseDataAppAnnotationDraft);\n await onSend(snapshot);\n dispatch({ type: 'submissionAccepted' });\n } catch {\n dispatch({ type: 'submissionFailed' });\n } finally {\n submitting.current = false;\n dispatch({ type: 'submissionFinished' });\n }\n }\n useImperativeHandle(ref, () => ({ send }));\n useEffect(() => {\n if (discardOpen) cancelDiscard.current?.focus();\n }, [discardOpen]);\n function discardAnnotations() {\n dispatch({ type: 'annotationsDiscarded' });\n onClear();\n onClose();\n }\n const undo =\n deletedAnnotationId && onUndoDelete ? (\n <div\n className=\"altertable-annotation-undo\"\n data-theme={theme}\n data-inline={\n (active && reviewOpen && annotations.length > 0) || undefined\n }\n data-bar-visible={(active && annotations.length > 0) || undefined}\n >\n <output>Annotation deleted</output>\n <Button\n variant=\"ghost\"\n onClick={() => onUndoDelete(deletedAnnotationId)}\n >\n Undo\n </Button>\n {onDismissUndo && (\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label=\"Dismiss deleted annotation\"\n onClick={onDismissUndo}\n >\n <X size={14} aria-hidden />\n </Button>\n )}\n </div>\n ) : null;\n if (annotations.length === 0 && !deletedAnnotationId) return null;\n const style: CSSProperties = position\n ? {\n left: position.left,\n top: position.top,\n bottom: 'auto',\n transform: 'none',\n }\n : {};\n\n return (\n <TooltipProvider>\n {active && annotations.length > 0 && (\n <div\n ref={barElementRef}\n className=\"altertable-annotation-bar\"\n data-theme={theme}\n style={style}\n tabIndex={-1}\n role=\"toolbar\"\n aria-label=\"Annotations\"\n onKeyDown={event => {\n if (event.key !== 'Escape' || locked || hasUnsavedChanges) return;\n event.preventDefault();\n if (reviewOpen) closeReview();\n else onClose();\n }}\n >\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label=\"Move annotation bar\"\n data-atbl-internal-drag-handle\n disabled={locked}\n onPointerDown={event => {\n const rect = barRef.current?.getBoundingClientRect();\n if (!rect) return;\n drag.current = {\n x: event.clientX,\n y: event.clientY,\n left: rect.left,\n top: rect.top,\n };\n event.currentTarget.setPointerCapture(event.pointerId);\n }}\n onPointerMove={event => {\n const origin = drag.current;\n if (origin)\n move(\n origin.left + event.clientX - origin.x,\n origin.top + event.clientY - origin.y\n );\n }}\n onPointerUp={() => {\n drag.current = undefined;\n }}\n onPointerCancel={() => {\n drag.current = undefined;\n }}\n onKeyDown={event => {\n const delta = {\n ArrowLeft: [-10, 0],\n ArrowRight: [10, 0],\n ArrowUp: [0, -10],\n ArrowDown: [0, 10],\n }[event.key];\n const rect = barRef.current?.getBoundingClientRect();\n if (!delta || !rect) return;\n event.preventDefault();\n move(rect.left + delta[0]!, rect.top + delta[1]!);\n }}\n >\n <GripVertical size={16} aria-hidden />\n </Button>\n <Button\n ref={reviewTrigger}\n className=\"altertable-annotation-bar-count\"\n variant=\"ghost\"\n size=\"compact\"\n aria-label=\"Review annotations\"\n aria-expanded={reviewOpen && annotations.length > 0}\n aria-haspopup=\"dialog\"\n disabled={locked || !annotations.length}\n onClick={() => dispatch({ type: 'reviewToggled' })}\n >\n Annotating · {annotations.length}\n </Button>\n <AnnotationTooltip\n content={\n pinsVisible ? 'Hide annotation pins' : 'Show annotation pins'\n }\n theme={theme}\n >\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label={\n pinsVisible ? 'Hide annotation pins' : 'Show annotation pins'\n }\n aria-pressed={!pinsVisible}\n disabled={locked}\n onClick={() => onPinsVisibleChange(!pinsVisible)}\n >\n {pinsVisible ? (\n <EyeOff size={16} aria-hidden />\n ) : (\n <Eye size={16} aria-hidden />\n )}\n </Button>\n </AnnotationTooltip>\n <AnnotationTooltip content=\"Discard all annotations\" theme={theme}>\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label=\"Discard all annotations\"\n disabled={locked}\n onClick={() =>\n requestDiscard\n ? requestDiscard(discardAnnotations)\n : dispatch({ type: 'discardDialogChanged', open: true })\n }\n >\n <Trash2 size={16} aria-hidden />\n </Button>\n </AnnotationTooltip>\n <AnnotationTooltip\n content={\n hasUnsavedChanges ? (\n 'Save the open annotation before sending'\n ) : (\n <>\n Send annotations <Kbd shortcut={shortcuts.sendAnnotations} />\n </>\n )\n }\n theme={theme}\n >\n <Button\n className=\"altertable-annotation-bar-send\"\n data-pending={pending || undefined}\n aria-busy={pending}\n size=\"compact\"\n aria-label=\"Send annotations\"\n disabled={!canSend}\n onClick={() => void send()}\n >\n <span className=\"altertable-annotation-bar-send-label\">Send</span>\n {pending && (\n <LoaderCircle\n className=\"altertable-annotation-bar-spinner\"\n size={16}\n aria-hidden\n />\n )}\n </Button>\n </AnnotationTooltip>\n <AnnotationTooltip\n content={\n <>\n {hasUnsavedChanges\n ? 'Save or discard the open annotation first'\n : 'Exit annotation mode'}{' '}\n <Kbd>Esc</Kbd>\n </>\n }\n theme={theme}\n >\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label=\"Exit annotation mode\"\n disabled={locked || hasUnsavedChanges}\n onClick={onClose}\n >\n <X size={16} aria-hidden />\n </Button>\n </AnnotationTooltip>\n {error && (\n <output className=\"altertable-annotation-bar-error\" role=\"alert\">\n {error}\n </output>\n )}\n </div>\n )}\n {(!active || !reviewOpen || annotations.length === 0) &&\n undo &&\n createPortal(undo, document.body)}\n {active &&\n reviewOpen &&\n annotations.length > 0 &&\n createPortal(\n <dialog\n open\n ref={reviewRef}\n className=\"altertable-annotation-bar-panel\"\n data-theme={theme}\n style={floatingStyles}\n aria-label=\"Review annotations\"\n onKeyDown={event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n closeReview();\n }\n }}\n >\n <header>\n <strong>Annotations</strong>\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label=\"Minimize annotation review\"\n onClick={closeReview}\n >\n <Minus size={16} aria-hidden />\n </Button>\n </header>\n <div aria-label=\"Annotation drafts\">\n {annotations.map((annotation, index) => (\n <div\n key={annotation.id}\n className=\"altertable-annotation-bar-row\"\n >\n {annotation.context.screenshot && (\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"action\"\n type=\"button\"\n className=\"altertable-annotation-thumbnail\"\n aria-label={`View screenshot of ${annotation.target.label}`}\n onClick={() =>\n dispatch({ type: 'previewOpened', id: annotation.id })\n }\n >\n <img src={annotation.context.screenshot.dataUrl} alt=\"\" />\n </button>\n )}\n <Button\n variant=\"ghost\"\n className=\"altertable-annotation-bar-open\"\n aria-label={`Open annotation ${index + 1}`}\n disabled={locked}\n onClick={() => {\n onPinsVisibleChange(true);\n onSelect(annotation.id);\n dispatch({ type: 'reviewClosed' });\n }}\n >\n <strong>{annotation.target.label}</strong>\n <span>{annotation.comment}</span>\n </Button>\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label={`Delete annotation ${index + 1}`}\n disabled={locked}\n onClick={() => onDelete(annotation.id)}\n >\n <Trash2 size={16} aria-hidden />\n </Button>\n </div>\n ))}\n </div>\n {undo}\n </dialog>,\n document.body\n )}\n <Sheet\n open={Boolean(preview)}\n onOpenChange={open => {\n if (!open) dispatch({ type: 'previewClosed' });\n }}\n placement=\"center\"\n className=\"altertable-annotation-image-dialog\"\n title={preview?.target.label ?? 'Screenshot'}\n description={preview?.comment}\n returnFocus={reviewTrigger}\n >\n {preview?.context.screenshot && (\n <img\n className=\"altertable-annotation-preview\"\n src={preview.context.screenshot.dataUrl}\n alt={`Captured area for ${preview.target.label}`}\n />\n )}\n </Sheet>\n {!requestDiscard && (\n <Sheet\n open={discardOpen}\n onOpenChange={open =>\n dispatch({ type: 'discardDialogChanged', open })\n }\n placement=\"center\"\n title=\"Discard all pending annotations?\"\n returnFocus={barRef}\n footer={\n <>\n <Button\n ref={cancelDiscard}\n variant=\"ghost\"\n onClick={() =>\n dispatch({ type: 'discardDialogChanged', open: false })\n }\n >\n Cancel\n </Button>\n <Button\n className=\"altertable-annotation-discard-confirm\"\n disabled={locked}\n onClick={discardAnnotations}\n >\n Discard\n </Button>\n </>\n }\n >\n <p className=\"altertable-annotation-discard-description\">\n These annotations will be removed and won’t be sent to the agent.\n </p>\n </Sheet>\n )}\n </TooltipProvider>\n );\n}\n","import { injectStyles } from '../injectStyles.ts';\nimport { type DataAppStylesOptions } from '../styles.ts';\n\ndeclare const ANNOTATION_STYLES: string;\n\n/** Install only the outer-frame annotation controls; leave host page typography and layout intact. */\nexport function injectDataAppAnnotationStyles(\n options: DataAppStylesOptions = {}\n): HTMLStyleElement {\n return injectStyles({\n name: 'injectDataAppAnnotationStyles',\n attribute: 'data-altertable-annotation-styles',\n css: ANNOTATION_STYLES,\n options,\n });\n}\n"],"mappings":";;;;;;;;;;;AAmDA,SAAgB,QAAqB,OAAkC;CACrE,MAAM,EACJ,MACA,UACA,OACA,wBAAwB,MACxB,UAAU,CAAC,GACX,UACA,GAAG,UACD;CACJ,MAAM,MAAM,WAAW;CACvB,MAAM,SAAS,kBAAkB,IAAI;CACrC,MAAM,SAAS,YACb,MACA,OAAO,YAAY,EAAE,SAAS,KAAc,CAC9C;CACA,MAAM,mBACJ,yBAAyB,MAAM,eAAe,SAAS,OAAO,iBAC1D,SAAS,S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UAAA;GAEtD,CAAA;EACE,CAAA;CAEM,EAAA,CAAA;AAErB;;;;ACpkBA,SAAgB,8BACd,UAAgC,CAAC,GACf;CAClB,OAAO,aAAa;EAClB,MAAM;EACN,WAAW;EACX,KAAA;EACA;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.js","names":["DisplayMetric","DisplayTable","DisplayVisual","DisplayText","DisplayValue"],"sources":["../src/ui/DataApp.tsx","../src/ui/Grid.tsx","../src/ui/GridItem.tsx","../src/widgets.tsx","../src/ui/Breakdown.tsx","../src/ui/Ranking.tsx","../src/ui/Comparison.tsx","../src/ui/DataSection.tsx","../src/ui/UpdatedAt.tsx","../src/ui/PeriodSummary.tsx","../src/ui/data-identifiers.tsx","../src/annotations/AnnotationTarget.tsx","../src/annotations/AnnotationBar.tsx","../src/annotations/styles.ts"],"sourcesContent":["import { KEY_SEPARATOR } from '@altertable/data-app/internal';\nimport type { DisplayedSnapshot } from '@altertable/data-app/internal';\n\nimport { useDataApp } from '../app-context.ts';\nimport {\n registeredEvidence,\n exportDatasets,\n type ExportDataset,\n type RegisteredBinding,\n} from '../bindings.ts';\nimport { DateFormattingContext } from '../date-formatting.ts';\nimport { DetailRoutes, type DetailContent } from '../details.tsx';\nimport { SearchSuggestionsContext } from '../search-suggestions.ts';\nimport { ownedSource } from '../source-owner.ts';\nimport {\n PrimaryViewContext,\n type DeclaredView,\n useDeclaredResult,\n} from '../view-runtime.tsx';\nimport {\n DataAppFrame,\n type DataAppBaseProps,\n type DataAppControlProps,\n} from './DataAppFrame.tsx';\nimport type { StoryFinding } from './story.ts';\n\nexport type DataAppProps<Data, Input = unknown> = Omit<\n DataAppBaseProps,\n 'dataContext'\n> &\n DataAppControlProps & {\n view: DeclaredView<Data, Input> & {\n scope(snapshot: DisplayedSnapshot<Data, Input>): string;\n };\n /** Show supplied datasets’ record suggestions on the first declared search. Defaults to true. */\n showSearchSuggestions?: boolean;\n story: (snapshot: DisplayedSnapshot<Data, Input>) => readonly (Omit<\n StoryFinding,\n 'evidence'\n > & {\n evidence: RegisteredBinding;\n })[];\n datasets: readonly [\n ExportDataset<Data, Input>,\n ...ExportDataset<Data, Input>[],\n ];\n /** Detail destinations available to dataset actions and metric record inspection. */\n details?: readonly DetailContent<any, any>[];\n };\n\n/** Executes the primary view and owns its controls, inspection, exports, and stories. */\nexport function DataApp<Data, Input>(props: DataAppProps<Data, Input>) {\n const {\n view,\n datasets,\n story,\n showSearchSuggestions = true,\n details = [],\n children,\n ...frame\n } = props;\n const app = useDataApp();\n const result = useDeclaredResult(view);\n const source = ownedSource(\n view,\n result.snapshot ?? { loading: true as const }\n );\n const suggestionGroups =\n showSearchSuggestions && frame.showSearch !== false && result.searchControls\n ? datasets.flatMap((dataset, index) => {\n const reading = dataset.readSearchSuggestions(source);\n if (!reading) return [];\n return [\n reading.loading\n ? []\n : reading.value.map(item => ({\n ...item,\n id: [index, item.id].join(KEY_SEPARATOR),\n })),\n ];\n })\n : [];\n return (\n <DateFormattingContext value={{ timeZone: result.timeZone }}>\n <SearchSuggestionsContext\n value={\n suggestionGroups.length\n ? {\n groups: suggestionGroups,\n busy: result.refreshing,\n }\n : null\n }\n >\n <PrimaryViewContext value={{ declaration: view, result }}>\n <DetailRoutes details={details}>\n <DataAppFrame\n {...frame}\n request={result}\n dataContext={result.dataContext}\n story={snapshot =>\n story(ownedSource(view, snapshot)).map(finding => ({\n ...finding,\n evidence: registeredEvidence(finding.evidence, view),\n }))\n }\n csvExport={(snapshot: DisplayedSnapshot<Data, Input>) =>\n exportDatasets(\n datasets,\n ownedSource(view, snapshot),\n view.scope(snapshot),\n app.title\n )\n }\n >\n {children}\n </DataAppFrame>\n </DetailRoutes>\n </PrimaryViewContext>\n </SearchSuggestionsContext>\n </DateFormattingContext>\n );\n}\n","import { type ComponentPropsWithRef, type ReactNode } from 'react';\n\nimport { classNames } from './classNames.ts';\n\nexport type GridProps = {\n children: ReactNode;\n /** Maximum columns; cards wrap sooner when the container cannot fit their minimum width. */\n columns?: 1 | 2 | 3 | 4;\n minItemWidth?: 'compact' | 'regular' | 'wide';\n gap?: 'sm' | 'md' | 'lg';\n /** `stretch` gives widgets in each row the same height. */\n align?: 'stretch' | 'start';\n} & Omit<ComponentPropsWithRef<'div'>, 'children'>;\n\n/** Responsive layout for peer cards and panels. Cards keep their content height by default. */\nexport function Grid({\n children,\n columns = 1,\n minItemWidth = 'regular',\n gap = 'lg',\n align = 'start',\n className,\n ...props\n}: GridProps) {\n return (\n <div\n {...props}\n className={classNames('altertable-grid', className)}\n data-columns={columns}\n data-min-item-width={minItemWidth}\n data-gap={gap}\n data-align={align}\n >\n {children}\n </div>\n );\n}\n","import { type ComponentPropsWithRef, type ReactNode } from 'react';\n\nimport { classNames } from './classNames.ts';\n\nexport type GridItemProps = {\n children: ReactNode;\n /** Maximum tracks occupied; collapses to one when the grid container is narrow. */\n span?: 1 | 2;\n} & Omit<ComponentPropsWithRef<'div'>, 'children'>;\n\nexport function GridItem({\n children,\n span = 1,\n className,\n ...props\n}: GridItemProps) {\n return (\n <div\n {...props}\n className={classNames('altertable-grid-item', className)}\n data-span={span}\n >\n {children}\n </div>\n );\n}\n","import { formatMetric } from '@altertable/data-app/format';\nimport type { MetricValues } from '@altertable/data-app/internal';\nimport type { DataReading } from '@altertable/data-app/internal';\nimport { useEffect, useRef, useState, type ComponentRef } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { resolveActions, type ExplorationActions } from './actions.ts';\nimport { RegisteredBinding } from './bindings.ts';\nimport {\n datasetTable,\n type Dataset,\n type Metric,\n type ViewSource,\n} from './bindings.ts';\nimport { MetricRecords } from './bindings.ts';\nimport { useDetailNavigation } from './details.tsx';\nimport { breakdownState, type BreakdownTarget } from './exploration.ts';\nimport {\n DataValue as DisplayValue,\n type DataValueProps as DisplayValueProps,\n} from './ui/DataValue.tsx';\nimport { withWidgetBoundary } from './ui/DataWidget.tsx';\nimport {\n ExplorationActionControl,\n type ItemActions,\n} from './ui/ExplorationActionControl.tsx';\nimport type { MetricDefinition } from './ui/metric.ts';\nimport {\n MetricWidget as DisplayMetric,\n type MetricWidgetProps as DisplayMetricProps,\n} from './ui/MetricWidget.tsx';\nimport { Select } from './ui/Select.tsx';\nimport { Skeleton } from './ui/Skeleton.tsx';\nimport {\n TableWidget as DisplayTable,\n type TableWidgetProps as DisplayTableProps,\n type TableDisplayMode,\n} from './ui/TableWidget.tsx';\nimport {\n TextWidget as DisplayText,\n type TextWidgetProps as DisplayTextProps,\n} from './ui/TextWidget.tsx';\nimport {\n VisualizationWidget as DisplayVisual,\n type VisualizationWidgetProps as DisplayVisualProps,\n type VisualizationWidgetView as DisplayVisualizationView,\n} from './ui/VisualizationWidget.tsx';\n\nexport type MetricWidgetProps<Data = unknown, Input = unknown> = Omit<\n Extract<DisplayMetricProps, { metric: MetricDefinition }>,\n 'metric' | 'reading' | 'records'\n> & {\n metric: Metric<Data, Input>;\n source: ViewSource<NoInfer<Data>, NoInfer<Input>>;\n records?: MetricRecords<Data, Input, any, any>;\n actions?: ExplorationActions<void, NoInfer<Input>>;\n};\nfunction MetricWidgetContent<Data, Input>({\n metric,\n source,\n records,\n actions,\n action,\n ...presentation\n}: MetricWidgetProps<Data, Input>) {\n const navigation = useDetailNavigation();\n const itemActions = resolveActions(\n actions,\n metric,\n RegisteredBinding.owner(metric),\n source,\n (target, input, trigger) => navigation.open(target, input, trigger)\n );\n const [widgetElement, setWidgetElement] =\n useState<ComponentRef<'div'> | null>(null);\n const availableActions = itemActions(undefined);\n return (\n <DisplayMetric\n {...presentation}\n ref={setWidgetElement}\n metric={metric.definition}\n reading={metric.read(source)}\n action={\n action || availableActions.length ? (\n <>\n {action}\n <ExplorationActionControl\n actions={availableActions}\n ariaLabel={metric.definition.label}\n />\n </>\n ) : undefined\n }\n records={\n records\n ? MetricRecords.render(records, metric, source, {\n open(target, input) {\n navigation.open(\n target,\n input,\n widgetElement?.querySelector('header button')\n );\n },\n })\n : undefined\n }\n />\n );\n}\n\ntype BoundTableProps<Row> = Extract<\n DisplayTableProps<Row>,\n { reading: DataReading<readonly Row[]> }\n>;\ntype TablePresentation<Row> = Pick<\n BoundTableProps<Row>,\n 'title' | 'columns' | 'rowKey' | 'reading' | 'evidence' | 'emptyFallback'\n>;\nexport type TableWidgetProps<Row, Data = unknown, Input = unknown> = Omit<\n BoundTableProps<Row>,\n keyof TablePresentation<Row> | 'limit' | 'pagination'\n> &\n TableDisplayMode & {\n dataset: Dataset<Data, Input, Row>;\n source: ViewSource<NoInfer<Data>, NoInfer<Input>>;\n title?: ReactNode;\n actions?: ExplorationActions<NoInfer<Row>, NoInfer<Input>>;\n };\nfunction TableWidgetContent<Row, Data, Input>({\n dataset,\n source,\n title,\n actions,\n ...presentation\n}: TableWidgetProps<Row, Data, Input>) {\n const data = datasetTable(dataset, source);\n const navigation = useDetailNavigation();\n const itemActions = resolveActions(\n actions,\n dataset,\n RegisteredBinding.owner(dataset),\n source,\n (target, input, trigger) => navigation.open(target, input, trigger)\n );\n const hasRowActions =\n actions &&\n (data.reading.loading ||\n data.reading.value.some(row => itemActions(row).length > 0));\n return (\n <DisplayTable\n {...presentation}\n {...data}\n title={title ?? data.title}\n columns={\n hasRowActions\n ? [\n ...data.columns,\n {\n id: '$exploration-actions',\n header: 'Actions',\n cell: row => (\n <ExplorationActionControl\n actions={itemActions(row)}\n ariaLabel={`${data.title}: ${data.rowKey(row)}`}\n />\n ),\n },\n ]\n : data.columns\n }\n />\n );\n}\ntype BoundVisual<Row> = Extract<\n DisplayVisualProps<readonly Row[]>,\n { reading: DataReading<readonly Row[]> }\n>;\nexport type VisualizationWidgetView<Row> = Omit<\n DisplayVisualizationView<readonly Row[]>,\n 'render'\n> & {\n render: (rows: readonly Row[], actions: ItemActions<Row>) => ReactNode;\n};\ntype VisualContent<Row> =\n | {\n children: (rows: readonly Row[], actions: ItemActions<Row>) => ReactNode;\n views?: never;\n viewLabel?: never;\n initialView?: never;\n }\n | {\n children?: never;\n views: readonly VisualizationWidgetView<Row>[];\n viewLabel: string;\n initialView?: string;\n };\nexport type VisualizationWidgetProps<\n Row,\n Data = unknown,\n Input = unknown,\n> = Omit<\n BoundVisual<Row>,\n | 'reading'\n | 'isEmpty'\n | 'emptyFallback'\n | 'evidence'\n | 'title'\n | 'children'\n | 'views'\n | 'viewLabel'\n | 'initialView'\n> &\n VisualContent<Row> & {\n dataset: Dataset<Data, Input, Row>;\n source: ViewSource<NoInfer<Data>, NoInfer<Input>>;\n title?: ReactNode;\n actions?: ExplorationActions<NoInfer<Row>, NoInfer<Input>>;\n breakdown?: BreakdownTarget<any>;\n };\nfunction VisualizationWidgetContent<Row, Data, Input>({\n dataset,\n source,\n title,\n actions,\n breakdown,\n children,\n views,\n viewLabel,\n initialView,\n ...presentation\n}: VisualizationWidgetProps<Row, Data, Input>) {\n const data = datasetTable(dataset, source);\n const navigation = useDetailNavigation();\n const itemActions = resolveActions(\n actions,\n dataset,\n RegisteredBinding.owner(dataset),\n source,\n (target, input, trigger) => navigation.open(target, input, trigger)\n );\n const state =\n breakdown && breakdownState(breakdown, RegisteredBinding.owner(dataset));\n const controlRef = useRef<ComponentRef<'div'>>(null);\n const recoverFocus = useRef(false);\n useEffect(() => {\n if (recoverFocus.current) {\n recoverFocus.current = false;\n controlRef.current?.querySelector('button')?.focus();\n }\n }, [state?.value]);\n function resolvedActions(row: Row) {\n return itemActions(row).map(action => ({\n ...action,\n onSelect(trigger?: HTMLElement | SVGElement) {\n recoverFocus.current = true;\n action.onSelect(trigger);\n },\n }));\n }\n const action = state ? (\n <div ref={controlRef}>\n <Select\n label={state.variable.label ?? 'Break down by'}\n labelPlacement=\"inline\"\n icon=\"breakdown\"\n size=\"compact\"\n align=\"end\"\n options={state.options.map(level => ({\n id: level.id,\n label: level.label,\n }))}\n value={state.value}\n onChange={id => state.set(id)}\n />\n </div>\n ) : (\n presentation.action\n );\n const common = {\n ...presentation,\n action,\n title: title ?? data.title,\n reading: data.reading,\n evidence: data.evidence,\n emptyFallback: data.emptyFallback,\n isEmpty: (rows: readonly Row[]) => rows.length === 0,\n };\n return children ? (\n <DisplayVisual<readonly Row[]> {...common}>\n {rows => children(rows, resolvedActions)}\n </DisplayVisual>\n ) : (\n <DisplayVisual<readonly Row[]>\n {...common}\n views={views!.map(view => ({\n ...view,\n render: rows => view.render(rows, resolvedActions),\n }))}\n viewLabel={viewLabel!}\n initialView={initialView}\n />\n );\n}\n\ntype NarrativeBinding<Data, Input, Row> =\n | {\n metric: Metric<Data, Input>;\n dataset?: never;\n source: ViewSource<NoInfer<Data>, NoInfer<Input>>;\n children?: (values: MetricValues) => ReactNode;\n }\n | {\n metric?: never;\n dataset: Dataset<Data, Input, Row>;\n source: ViewSource<NoInfer<Data>, NoInfer<Input>>;\n children: (rows: readonly Row[]) => ReactNode;\n };\nexport type TextWidgetProps<\n Data = unknown,\n Input = unknown,\n Row = never,\n> = Omit<\n Extract<DisplayTextProps<unknown>, { reading: DataReading<unknown> }>,\n 'reading' | 'evidence' | 'children' | 'title' | 'emptyFallback'\n> &\n NarrativeBinding<Data, Input, Row> & { title?: ReactNode };\nfunction TextWidgetContent<Data, Input, Row>(\n props: TextWidgetProps<Data, Input, Row>\n) {\n if (props.metric) {\n const { metric, source, title, children, ...presentation } = props;\n return (\n <DisplayText\n {...presentation}\n title={title ?? metric.definition.label}\n evidence={metric.definition.evidence}\n reading={metric.read(source)}\n >\n {children ??\n (values => formatMetric(values.current, metric.definition.format))}\n </DisplayText>\n );\n }\n const { dataset, source, title, children, ...presentation } = props;\n return (\n <DisplayText\n {...presentation}\n title={title ?? dataset.name}\n evidence={dataset.evidence}\n reading={dataset.read(source)}\n >\n {children}\n </DisplayText>\n );\n}\n\ntype InlinePresentation = Omit<\n DisplayValueProps<unknown>,\n 'reading' | 'children' | 'loadingFallback'\n> & { loadingFallback?: ReactNode };\nexport type DataValueProps<\n Data = unknown,\n Input = unknown,\n Row = never,\n> = InlinePresentation &\n (\n | (NarrativeBinding<Data, Input, Row> & { scope?: never })\n | {\n metric?: never;\n dataset?: never;\n source?: never;\n scope: DataReading<string>;\n children?: (scope: string) => ReactNode;\n }\n );\nexport function DataValue<Data, Input, Row>(\n props: DataValueProps<Data, Input, Row>\n) {\n if (props.metric) {\n const {\n metric,\n source,\n children,\n loadingFallback = <Skeleton inline />,\n ...presentation\n } = props;\n return (\n <DisplayValue\n {...presentation}\n reading={metric.read(source)}\n loadingFallback={loadingFallback}\n >\n {children ??\n (values => formatMetric(values.current, metric.definition.format))}\n </DisplayValue>\n );\n }\n if (props.dataset) {\n const {\n dataset,\n source,\n children,\n loadingFallback = <Skeleton inline />,\n ...presentation\n } = props;\n return (\n <DisplayValue\n {...presentation}\n reading={dataset.read(source)}\n loadingFallback={loadingFallback}\n >\n {children}\n </DisplayValue>\n );\n }\n const {\n scope,\n children,\n loadingFallback = <Skeleton inline />,\n ...presentation\n } = props;\n return (\n <DisplayValue\n {...presentation}\n reading={scope}\n loadingFallback={loadingFallback}\n >\n {children ?? (value => value)}\n </DisplayValue>\n );\n}\n\nexport const MetricWidget = withWidgetBoundary(MetricWidgetContent);\n\nexport const TableWidget = withWidgetBoundary(TableWidgetContent);\n\nexport const VisualizationWidget = withWidgetBoundary(\n VisualizationWidgetContent\n);\n\nexport const TextWidget = withWidgetBoundary(TextWidgetContent);\n","import { formatCount, formatPercent } from '@altertable/data-app/format';\nimport { invariant } from '@altertable/data-app/internal';\nimport {\n type ComponentPropsWithRef,\n type CSSProperties,\n type ReactNode,\n} from 'react';\n\nimport { chartColor } from './chartColor.ts';\nimport { classNames } from './classNames.ts';\n\nexport type BreakdownItem = { id: string; label: ReactNode; value: number };\nexport type BreakdownProps = {\n total: number;\n items: readonly BreakdownItem[];\n formatValue?: (value: number) => ReactNode;\n} & Omit<ComponentPropsWithRef<'div'>, 'children'>;\n\n/** Mutually exclusive parts of one observed whole. Every share uses the supplied total. */\nexport function Breakdown({\n total,\n items,\n formatValue = formatCount,\n className,\n ...props\n}: BreakdownProps) {\n invariant(\n Number.isFinite(total) &&\n total >= 0 &&\n items.every(item => Number.isFinite(item.value) && item.value >= 0) &&\n items.reduce((sum, item) => sum + item.value, 0) <= total,\n 'Breakdown items must be nonnegative parts of the observed total.'\n );\n const dominant = total > 0 && items.some(item => item.value / total >= 0.85);\n\n return (\n <div\n {...props}\n className={classNames('altertable-breakdown', className)}\n data-dominant={dominant || undefined}\n >\n <div className=\"altertable-breakdown-summary\">\n <span>Share of total</span>\n <strong>{formatValue(total)} total</strong>\n </div>\n <div className=\"altertable-breakdown-bar\" aria-hidden=\"true\">\n {items.map(item => (\n <span\n key={item.id}\n style={{\n width: `${total ? (item.value / total) * 100 : 0}%`,\n backgroundColor: chartColor(item.id),\n }}\n />\n ))}\n </div>\n <dl className=\"altertable-breakdown-list\">\n {items.map(item => {\n const share = total ? item.value / total : 0;\n const color = {\n '--altertable-breakdown-color': chartColor(item.id),\n } as CSSProperties;\n\n return (\n <div\n className=\"altertable-breakdown-row\"\n data-empty={item.value === 0 || undefined}\n key={item.id}\n style={color}\n >\n <dt>\n <span\n className=\"altertable-breakdown-swatch\"\n aria-hidden=\"true\"\n />\n {item.label}\n </dt>\n <dd className=\"altertable-breakdown-value\">\n {formatValue(item.value)}\n </dd>\n <dd className=\"altertable-breakdown-share\">\n {formatPercent(share)}\n </dd>\n </div>\n );\n })}\n </dl>\n </div>\n );\n}\n","import { formatCount } from '@altertable/data-app/format';\nimport { invariant } from '@altertable/data-app/internal';\nimport { type ComponentPropsWithRef, type ReactNode } from 'react';\n\nimport { classNames } from './classNames.ts';\n\nexport type RankingItem = {\n id: string;\n label: ReactNode;\n value: number;\n detail?: ReactNode;\n};\nexport type RankingProps = {\n items: readonly RankingItem[];\n formatValue?: (value: number) => ReactNode;\n} & Omit<ComponentPropsWithRef<'ol'>, 'children'>;\n\n/** Ordered values scaled to the largest visible item, not shares of a whole. */\nexport function Ranking({\n items,\n formatValue = formatCount,\n className,\n ...props\n}: RankingProps) {\n invariant(\n items.every(item => Number.isFinite(item.value) && item.value >= 0),\n 'Ranking values must be finite and nonnegative.'\n );\n const max = Math.max(0, ...items.map(item => item.value));\n\n return (\n <ol {...props} className={classNames('altertable-ranking', className)}>\n {items.map(item => (\n <li key={item.id}>\n <div className=\"altertable-ranking-reading\">\n <span>{item.label}</span>\n <strong>{formatValue(item.value)}</strong>\n </div>\n <div className=\"altertable-ranking-track\" aria-hidden=\"true\">\n <span style={{ width: `${max ? (item.value / max) * 100 : 0}%` }} />\n </div>\n {item.detail != null && (\n <div className=\"altertable-ranking-detail\">{item.detail}</div>\n )}\n </li>\n ))}\n </ol>\n );\n}\n","import { type MetricReading } from '@altertable/data-app/internal';\n\nimport { useDateFormatting } from '../date-formatting.ts';\nimport { ContentSkeleton } from './ContentSkeleton.tsx';\nimport { AppIcon } from './icons.ts';\nimport {\n comparisonChange,\n type MetricComparison,\n} from './metric-comparison.ts';\nimport { type MetricDefinition, metricComparison } from './metric.ts';\n\ntype UnboundComparisonProps = MetricComparison & {\n label: string;\n emphasis?: 'standard' | 'story';\n};\n\nexport type ComparisonProps =\n | UnboundComparisonProps\n | {\n metric: MetricDefinition;\n reading: MetricReading;\n emphasis?: 'standard' | 'story';\n };\n\nexport function Comparison(props: ComparisonProps) {\n const dateFormatting = useDateFormatting();\n if ('metric' in props) {\n if (props.reading.loading) return <ContentSkeleton variant=\"panel\" />;\n const comparison = metricComparison(\n props.metric,\n props.reading,\n dateFormatting\n );\n if (!comparison) return null;\n\n return (\n <ComparisonContent\n {...comparison}\n label={props.metric.label}\n emphasis={props.emphasis}\n />\n );\n }\n\n return <ComparisonContent {...props} />;\n}\n\nfunction ComparisonContent({\n label,\n current,\n previous,\n favorableDirection,\n emphasis = 'standard',\n}: UnboundComparisonProps) {\n const max = Math.max(current.value, previous?.value ?? 0, 1);\n const { percent, tone, icon } = comparisonChange({\n current,\n previous,\n favorableDirection,\n });\n\n return (\n <figure\n className=\"altertable-comparison-visual\"\n data-emphasis={emphasis}\n aria-label={`${label} comparison`}\n >\n <figcaption>{label}</figcaption>\n <div className=\"altertable-comparison-row\" data-period=\"current\">\n <div>\n <span>{current.periodLabel ?? 'Current period'}</span>\n <strong>{current.formattedValue}</strong>\n </div>\n <span className=\"altertable-comparison-track\">\n <span style={{ width: `${(current.value / max) * 100}%` }} />\n </span>\n </div>\n {previous && (\n <div className=\"altertable-comparison-row\" data-period=\"previous\">\n <div>\n <span>{previous.periodLabel ?? 'Previous period'}</span>\n <strong>{previous.formattedValue}</strong>\n </div>\n <span className=\"altertable-comparison-track\">\n <span\n style={{ width: `${((previous.value ?? 0) / max) * 100}%` }}\n />\n </span>\n </div>\n )}\n <p className=\"altertable-comparison-change\" data-tone={tone}>\n {percent === null ? (\n 'No comparable previous value'\n ) : (\n <>\n <AppIcon name={icon} size={17} />\n {Math.abs(percent).toFixed(1)}% vs{' '}\n {previous?.periodLabel?.toLowerCase() ?? 'previous period'}\n </>\n )}\n </p>\n </figure>\n );\n}\n","import { useContext, type ComponentPropsWithRef, type ReactNode } from 'react';\n\nimport { sectionContent, type ViewContent } from '../content.ts';\nimport { DateFormattingContext } from '../date-formatting.ts';\nimport {\n PrimaryViewContext,\n type ViewResult,\n useDeclaredResult,\n} from '../view-runtime.tsx';\nimport { DataSectionBoundary } from './DataSectionBoundary.tsx';\nimport {\n InspectionContext,\n useInspectionDefaults,\n} from './InspectionContext.tsx';\nimport { type EmptyContent } from './presentation.ts';\n\nexport type DataSectionProps<Data, Input = unknown> = {\n content: ViewContent<Data, Input>;\n emptyFallback?: EmptyContent;\n error?: { title: ReactNode; description?: ReactNode; onRetry?: () => void };\n label?: string;\n} & Omit<ComponentPropsWithRef<'div'>, 'children' | 'content'>;\n\nexport function DataSection<Data, Input>({\n content,\n ...presentation\n}: DataSectionProps<Data, Input>) {\n const primary = useContext(PrimaryViewContext);\n const { view, ...section } = sectionContent(content);\n if (primary?.declaration === view) {\n // Identity proves the shared result belongs to this content's declaration.\n const result = primary.result as ViewResult<Data, Input>;\n return (\n <DataSectionBoundary\n {...section}\n {...presentation}\n result={result}\n notice=\"none\"\n />\n );\n }\n return <IndependentSection view={view} {...section} {...presentation} />;\n}\n\nfunction IndependentSection<Data, Input>({\n view,\n ...props\n}: Omit<DataSectionProps<Data, Input>, 'content'> &\n ReturnType<typeof sectionContent<Data, Input>>) {\n const result = useDeclaredResult(view);\n const defaults = useInspectionDefaults();\n const section = (\n <DataSectionBoundary {...props} result={result} notice=\"inline\" />\n );\n return (\n <DateFormattingContext value={{ timeZone: result.timeZone }}>\n <InspectionContext\n value={{\n ...defaults,\n dataContext: result.dataContext,\n queries: result.queries,\n }}\n >\n {section}\n </InspectionContext>\n </DateFormattingContext>\n );\n}\n","import { parseDateTime } from '@altertable/data-app/format';\nimport { useEffect, useState, type ReactNode } from 'react';\n\nimport { useDateFormatting } from '../date-formatting.ts';\nimport {\n DateTimeTooltip,\n type DateTimeTooltipProps,\n} from './DateTimeTooltip.tsx';\n\nexport type UpdatedAtProps = {\n timestamp: number;\n locale?: string;\n label?: string;\n children?: ReactNode;\n} & Omit<DateTimeTooltipProps, 'date' | 'children'>;\n\nexport function UpdatedAt({\n timestamp,\n locale,\n label = 'Updated',\n children,\n triggerProps,\n ...props\n}: UpdatedAtProps) {\n const defaults = useDateFormatting({ locale, timeZone: props.timeZone });\n const [now, setNow] = useState(Date.now);\n\n useEffect(() => {\n const interval = window.setInterval(() => setNow(Date.now()), 30_000);\n\n return () => window.clearInterval(interval);\n }, []);\n\n const elapsedMinutes = Math.floor(Math.max(0, now - timestamp) / 60_000);\n const relative = new Intl.RelativeTimeFormat(defaults.locale, {\n numeric: 'auto',\n });\n let age = 'just now';\n if (elapsedMinutes >= 1_440)\n age = relative.format(-Math.floor(elapsedMinutes / 1_440), 'day');\n else if (elapsedMinutes >= 60)\n age = relative.format(-Math.floor(elapsedMinutes / 60), 'hour');\n else if (elapsedMinutes >= 1)\n age = relative.format(-elapsedMinutes, 'minute');\n\n const date = parseDateTime(timestamp);\n if (!date) return <span>{children ?? `${label} —`}</span>;\n\n return (\n <DateTimeTooltip\n {...props}\n {...defaults}\n date={date}\n triggerProps={{\n ...triggerProps,\n className: ['altertable-updated-at', triggerProps?.className]\n .filter(Boolean)\n .join(' '),\n }}\n >\n {children ?? (\n <time dateTime={date.toISOString()}>\n {label} {age}\n </time>\n )}\n </DateTimeTooltip>\n );\n}\n","import { type ReportingPeriod } from '@altertable/data-app/contract';\nimport {\n formatDateRange,\n formatDateTime,\n parseDateTime,\n type DateTimeFormatOptions,\n} from '@altertable/data-app/format';\n\nimport { useDateFormatting } from '../date-formatting.ts';\nimport { classNames } from './classNames.ts';\nimport { AppIcon } from './icons.ts';\nexport { type ReportingPeriod } from '@altertable/data-app/contract';\n\nexport type PeriodComparison =\n | { kind: 'previous' }\n | { kind: 'period'; period: ReportingPeriod };\n\nexport type PeriodSummaryProps = {\n period: ReportingPeriod;\n comparison?: PeriodComparison;\n className?: string;\n};\n\nfunction duration(\n period: Extract<ReportingPeriod, { kind: 'rolling' }>\n): string {\n return `${period.amount} ${period.unit}${period.amount === 1 ? '' : 's'}`;\n}\n\nfunction label(\n period: ReportingPeriod,\n options: DateTimeFormatOptions = {}\n): string {\n if (period.kind === 'rolling') return `Last ${duration(period)}`;\n\n return formatDateRange(period, options);\n}\n\nfunction comparisonLabel(\n period: ReportingPeriod,\n comparison: PeriodComparison,\n options: DateTimeFormatOptions\n): string {\n if (comparison.kind === 'period') {\n if (comparison.period.kind === 'calendar')\n return label(comparison.period, options);\n\n return `${duration(comparison.period)} ending ${formatDateTime(comparison.period.end, options)}`;\n }\n\n return period.kind === 'rolling'\n ? `Previous ${duration(period)}`\n : 'Previous period';\n}\n\nfunction reportingPeriodText(\n period: ReportingPeriod,\n options: DateTimeFormatOptions = {}\n): string {\n if (period.kind === 'calendar')\n return `${label(period, options)} in ${period.timeZone}`;\n const end = parseDateTime(period.end);\n if (!end) return label(period, options);\n const start = new Date(\n end.getTime() -\n period.amount * (period.unit === 'hour' ? 3_600_000 : 86_400_000)\n );\n\n return `${label(period, options)}, ${formatDateTime(start, options)} to ${formatDateTime(end, options)} in ${options.timeZone ?? 'UTC'}`;\n}\n\n/** Read-only period context for the variable bar, including exact bounds for assistive technology. */\nexport function PeriodSummary({\n period,\n comparison,\n className,\n}: PeriodSummaryProps) {\n const options = useDateFormatting();\n const comparisonText = comparison\n ? comparisonLabel(period, comparison, options)\n : null;\n const comparisonDetail =\n comparison?.kind === 'period'\n ? reportingPeriodText(comparison.period, options)\n : comparisonText;\n\n return (\n <p className={classNames('altertable-period-summary', className)}>\n <span className=\"altertable-sr-only\">\n {`Reporting period: ${reportingPeriodText(period, options)}${comparisonDetail ? `, compared with ${comparisonDetail}` : ''}`}\n </span>\n <span aria-hidden=\"true\" className=\"altertable-period-summary-visible\">\n <AppIcon\n name={period.kind === 'rolling' ? 'clock' : 'calendar'}\n size={16}\n />\n <span className=\"altertable-period-summary-current\">\n {label(period, options)}\n </span>\n {comparisonText && (\n <>\n <span className=\"altertable-period-summary-vs\" aria-hidden=\"true\">\n vs\n </span>\n <span>{comparisonText}</span>\n </>\n )}\n </span>\n </p>\n );\n}\n","import { invariant } from '@altertable/data-app/internal';\n\nexport type TableIdentifier = { catalog: string; schema: string; name: string };\nexport type ColumnIdentifier<TableId extends string = string> = {\n table: TableId;\n name: string;\n};\n\nexport type DataIdentifierDefinition =\n | ({ kind: 'table' } & TableIdentifier)\n | {\n kind: 'column';\n tableId: `tables.${string}`;\n table: TableIdentifier;\n name: string;\n };\n\ntype IdentifierId<\n Tables extends Record<string, TableIdentifier>,\n Columns extends Record<\n string,\n ColumnIdentifier<Extract<keyof Tables, string>>\n >,\n> =\n | `tables.${Extract<keyof Tables, string>}`\n | {\n [\n Id in Extract<keyof Columns, string>\n ]: `columns.${Columns[Id]['table']}.${Id}`;\n }[Extract<keyof Columns, string>];\n\nfunction qualifiedName(definition: DataIdentifierDefinition): string {\n const table = definition.kind === 'table' ? definition : definition.table;\n const path = [table.catalog, table.schema, table.name].join('.');\n\n return definition.kind === 'column' ? `${path}.${definition.name}` : path;\n}\n\nfunction assertAlias(id: string) {\n invariant(!!id && !id.includes('.'), `Invalid data identifier alias ${id}.`);\n}\n\n/** Register exact source names once; returned JSX IDs are checked against this registry. */\nexport function defineDataIdentifiers<\n const Tables extends Record<string, TableIdentifier>,\n const Columns extends Record<\n string,\n ColumnIdentifier<Extract<keyof Tables, string>>\n >,\n>({ tables, columns }: { tables: Tables; columns: Columns }) {\n type Id = IdentifierId<Tables, Columns>;\n const definitions: Record<string, DataIdentifierDefinition> =\n Object.create(null);\n\n for (const [id, table] of Object.entries(tables)) {\n assertAlias(id);\n definitions[`tables.${id}`] = { kind: 'table', ...table };\n }\n for (const [id, column] of Object.entries(columns)) {\n assertAlias(id);\n const table = tables[column.table];\n invariant(table, `Unknown table ${column.table} for column ${id}.`);\n definitions[`columns.${column.table}.${id}`] = {\n kind: 'column',\n tableId: `tables.${column.table}`,\n table,\n name: column.name,\n };\n }\n\n function DataIdentifier({\n id,\n display,\n }: {\n id: Id;\n display?: 'short' | 'qualified';\n }) {\n const definition = definitions[id];\n invariant(definition, `Unknown data identifier ${id}.`);\n const qualified = qualifiedName(definition);\n const shown =\n display ?? (definition.kind === 'table' ? 'qualified' : 'short');\n const table = definition.kind === 'table' ? definition : definition.table;\n const prefix =\n definition.kind === 'table'\n ? [table.catalog, table.schema]\n : [table.catalog, table.schema, table.name];\n\n return (\n <code\n className=\"altertable-data-identifier\"\n data-kind={definition.kind}\n title={qualified}\n data-identifier-id={id}\n >\n {shown === 'qualified' && (\n <span className=\"altertable-data-identifier-path\">\n {prefix.map((segment, index) => (\n <span key={index}>\n {segment}.<wbr />\n </span>\n ))}\n </span>\n )}\n <span className=\"altertable-data-identifier-name\">\n {definition.name}\n </span>\n </code>\n );\n }\n\n return {\n definitions: definitions as Readonly<Record<Id, DataIdentifierDefinition>>,\n DataIdentifier,\n };\n}\n","import { type ComponentPropsWithRef } from 'react';\n\nimport { type WidgetEvidence } from '../ui/WidgetEvidence.ts';\nimport { getAnnotationProps } from './getAnnotationProps.ts';\n\nexport type AnnotationTargetProps = ComponentPropsWithRef<'div'> & {\n annotationId: string;\n label: string;\n evidence?: WidgetEvidence;\n};\n\n/** A stable feedback target for app-owned content outside the built-in widgets. */\nexport function AnnotationTarget({\n annotationId,\n label,\n evidence,\n ...props\n}: AnnotationTargetProps) {\n return (\n <div\n {...props}\n {...getAnnotationProps({\n id: annotationId,\n label,\n evidence,\n kind: 'element',\n })}\n />\n );\n}\n","import { type Theme } from '@altertable/data-app/appearance';\nimport {\n parseDataAppAnnotationDraft,\n type DataAppAnnotationDraft,\n} from '@altertable/data-app/contract';\nimport {\n autoUpdate,\n flip,\n offset,\n shift,\n useFloating,\n useMergeRefs,\n} from '@floating-ui/react';\nimport {\n GripVertical,\n Eye,\n EyeOff,\n Trash2,\n X,\n Minus,\n LoaderCircle,\n} from 'lucide-react';\nimport {\n useEffect,\n useEffectEvent,\n useRef,\n useReducer,\n useImperativeHandle,\n type Ref,\n type ComponentRef,\n type CSSProperties,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { Button } from '../ui/Button.tsx';\nimport { Kbd } from '../ui/Kbd.tsx';\nimport { Sheet } from '../ui/Sheet.tsx';\nimport { shortcuts } from '../ui/shortcuts.ts';\nimport { TooltipProvider } from '../ui/Tooltip.tsx';\nimport { AnnotationTooltip } from './AnnotationTooltip.tsx';\n\nexport type AnnotationBarHandle = {\n /** Submit through the same guards, pending state, and retry feedback as the Send button. */\n send: () => Promise<void>;\n};\n\nexport type AnnotationBarProps = {\n ref?: Ref<AnnotationBarHandle>;\n annotations: readonly DataAppAnnotationDraft[];\n active?: boolean;\n theme?: Theme;\n disabled?: boolean;\n deletedAnnotationId?: string;\n onUndoDelete?: (id: string) => void;\n onDismissUndo?: () => void;\n hasUnsavedChanges?: boolean;\n pinsVisible: boolean;\n onPinsVisibleChange: (visible: boolean) => void;\n onSelect: (id: string) => void;\n onDelete: (id: string) => void;\n onClear: () => void;\n /** Let host apps use their existing confirmation dialog. */\n requestDiscard?: (discard: () => void) => void;\n /** Resolve only after the outer application's agent API accepts this snapshot. */\n onSend: (annotations: readonly DataAppAnnotationDraft[]) => Promise<void>;\n onClose: () => void;\n};\n\ntype AnnotationBarState = {\n position?: { left: number; top: number };\n reviewOpen: boolean;\n pending: boolean;\n error: string;\n discardOpen: boolean;\n previewId?: string;\n observedActive: boolean;\n};\ntype AnnotationBarAction =\n | {\n type: 'positionMoved';\n position: NonNullable<AnnotationBarState['position']>;\n }\n | { type: 'reviewToggled' }\n | { type: 'reviewClosed' }\n | { type: 'previewOpened'; id: string }\n | { type: 'previewClosed' }\n | { type: 'discardDialogChanged'; open: boolean }\n | { type: 'annotationsDiscarded' }\n | { type: 'submissionStarted' }\n | { type: 'submissionAccepted' }\n | { type: 'submissionFailed' }\n | { type: 'submissionFinished' }\n | { type: 'annotationModeObserved'; active: boolean };\n\nfunction annotationBarReducer(\n state: AnnotationBarState,\n action: AnnotationBarAction\n): AnnotationBarState {\n switch (action.type) {\n case 'positionMoved':\n return { ...state, position: action.position };\n case 'reviewToggled':\n return { ...state, reviewOpen: !state.reviewOpen };\n case 'reviewClosed':\n return { ...state, reviewOpen: false };\n case 'previewOpened':\n return { ...state, previewId: action.id };\n case 'previewClosed':\n return { ...state, previewId: undefined };\n case 'discardDialogChanged':\n return { ...state, discardOpen: action.open };\n case 'annotationsDiscarded':\n return { ...state, discardOpen: false, reviewOpen: false };\n case 'submissionStarted':\n return { ...state, pending: true, error: '' };\n case 'submissionAccepted':\n return { ...state, reviewOpen: false };\n case 'submissionFailed':\n return { ...state, error: 'Could not send annotations. Try again.' };\n case 'submissionFinished':\n return { ...state, pending: false };\n case 'annotationModeObserved':\n return {\n ...state,\n observedActive: action.active,\n ...(!action.active ? { reviewOpen: false, previewId: undefined } : {}),\n };\n }\n}\n\n/** Host-owned batch controls. Collection changes and agent submission stay with the outer app. */\nexport function AnnotationBar({\n ref,\n annotations,\n active = true,\n theme = 'light',\n disabled = false,\n deletedAnnotationId,\n onUndoDelete,\n onDismissUndo,\n hasUnsavedChanges = false,\n pinsVisible,\n onPinsVisibleChange,\n onSelect,\n onDelete,\n onClear,\n requestDiscard,\n onSend,\n onClose,\n}: AnnotationBarProps) {\n const reviewElement = useRef<ComponentRef<'dialog'>>(null);\n const reviewTrigger = useRef<ComponentRef<'button'>>(null);\n const cancelDiscard = useRef<ComponentRef<'button'>>(null);\n const barRef = useRef<ComponentRef<'div'>>(null);\n const drag = useRef<\n { x: number; y: number; left: number; top: number } | undefined\n >(undefined);\n const submitting = useRef(false);\n const [state, dispatch] = useReducer(annotationBarReducer, {\n reviewOpen: false,\n pending: false,\n error: '',\n discardOpen: false,\n observedActive: active,\n });\n const { position, reviewOpen, pending, error, discardOpen, previewId } =\n state;\n const preview = annotations.find(annotation => annotation.id === previewId);\n const locked = disabled || pending;\n const canSend =\n active && !locked && !hasUnsavedChanges && annotations.length > 0;\n const { refs, floatingStyles } = useFloating({\n placement: 'top',\n strategy: 'fixed',\n middleware: [offset(10), flip(), shift({ padding: 12 })],\n whileElementsMounted: autoUpdate,\n });\n\n const barElementRef = useMergeRefs([refs.setReference, barRef]);\n const reviewRef = useMergeRefs([refs.setFloating, reviewElement]);\n\n function move(left: number, top: number) {\n const rect = barRef.current?.getBoundingClientRect();\n if (!rect) return;\n dispatch({\n type: 'positionMoved',\n position: {\n left: Math.max(12, Math.min(left, window.innerWidth - rect.width - 12)),\n top: Math.max(12, Math.min(top, window.innerHeight - rect.height - 12)),\n },\n });\n }\n const keepInViewport = useEffectEvent(() => {\n if (position) move(position.left, position.top);\n });\n useEffect(() => {\n window.addEventListener('resize', keepInViewport);\n return () => window.removeEventListener('resize', keepInViewport);\n }, []);\n useEffect(() => {\n if (reviewOpen)\n reviewElement.current\n ?.querySelector<ComponentRef<'button'>>('button')\n ?.focus();\n }, [reviewOpen]);\n if (state.observedActive !== active)\n dispatch({ type: 'annotationModeObserved', active });\n function closeReview() {\n dispatch({ type: 'reviewClosed' });\n reviewTrigger.current?.focus();\n }\n async function send() {\n if (submitting.current || !canSend) return;\n submitting.current = true;\n dispatch({ type: 'submissionStarted' });\n try {\n const snapshot = annotations.map(parseDataAppAnnotationDraft);\n await onSend(snapshot);\n dispatch({ type: 'submissionAccepted' });\n } catch {\n dispatch({ type: 'submissionFailed' });\n } finally {\n submitting.current = false;\n dispatch({ type: 'submissionFinished' });\n }\n }\n useImperativeHandle(ref, () => ({ send }));\n useEffect(() => {\n if (discardOpen) cancelDiscard.current?.focus();\n }, [discardOpen]);\n function discardAnnotations() {\n dispatch({ type: 'annotationsDiscarded' });\n onClear();\n onClose();\n }\n const undo =\n deletedAnnotationId && onUndoDelete ? (\n <div\n className=\"altertable-annotation-undo\"\n data-theme={theme}\n data-inline={\n (active && reviewOpen && annotations.length > 0) || undefined\n }\n data-bar-visible={(active && annotations.length > 0) || undefined}\n >\n <output>Annotation deleted</output>\n <Button\n variant=\"ghost\"\n onClick={() => onUndoDelete(deletedAnnotationId)}\n >\n Undo\n </Button>\n {onDismissUndo && (\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label=\"Dismiss deleted annotation\"\n onClick={onDismissUndo}\n >\n <X size={14} aria-hidden />\n </Button>\n )}\n </div>\n ) : null;\n if (annotations.length === 0 && !deletedAnnotationId) return null;\n const style: CSSProperties = position\n ? {\n left: position.left,\n top: position.top,\n bottom: 'auto',\n transform: 'none',\n }\n : {};\n\n return (\n <TooltipProvider>\n {active && annotations.length > 0 && (\n <div\n ref={barElementRef}\n className=\"altertable-annotation-bar\"\n data-theme={theme}\n style={style}\n tabIndex={-1}\n role=\"toolbar\"\n aria-label=\"Annotations\"\n onKeyDown={event => {\n if (event.key !== 'Escape' || locked || hasUnsavedChanges) return;\n event.preventDefault();\n if (reviewOpen) closeReview();\n else onClose();\n }}\n >\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label=\"Move annotation bar\"\n data-atbl-internal-drag-handle\n disabled={locked}\n onPointerDown={event => {\n const rect = barRef.current?.getBoundingClientRect();\n if (!rect) return;\n drag.current = {\n x: event.clientX,\n y: event.clientY,\n left: rect.left,\n top: rect.top,\n };\n event.currentTarget.setPointerCapture(event.pointerId);\n }}\n onPointerMove={event => {\n const origin = drag.current;\n if (origin)\n move(\n origin.left + event.clientX - origin.x,\n origin.top + event.clientY - origin.y\n );\n }}\n onPointerUp={() => {\n drag.current = undefined;\n }}\n onPointerCancel={() => {\n drag.current = undefined;\n }}\n onKeyDown={event => {\n const delta = {\n ArrowLeft: [-10, 0],\n ArrowRight: [10, 0],\n ArrowUp: [0, -10],\n ArrowDown: [0, 10],\n }[event.key];\n const rect = barRef.current?.getBoundingClientRect();\n if (!delta || !rect) return;\n event.preventDefault();\n move(rect.left + delta[0]!, rect.top + delta[1]!);\n }}\n >\n <GripVertical size={16} aria-hidden />\n </Button>\n <Button\n ref={reviewTrigger}\n className=\"altertable-annotation-bar-count\"\n variant=\"ghost\"\n size=\"compact\"\n aria-label=\"Review annotations\"\n aria-expanded={reviewOpen && annotations.length > 0}\n aria-haspopup=\"dialog\"\n disabled={locked || !annotations.length}\n onClick={() => dispatch({ type: 'reviewToggled' })}\n >\n Annotating · {annotations.length}\n </Button>\n <AnnotationTooltip\n content={\n pinsVisible ? 'Hide annotation pins' : 'Show annotation pins'\n }\n theme={theme}\n >\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label={\n pinsVisible ? 'Hide annotation pins' : 'Show annotation pins'\n }\n aria-pressed={!pinsVisible}\n disabled={locked}\n onClick={() => onPinsVisibleChange(!pinsVisible)}\n >\n {pinsVisible ? (\n <EyeOff size={16} aria-hidden />\n ) : (\n <Eye size={16} aria-hidden />\n )}\n </Button>\n </AnnotationTooltip>\n <AnnotationTooltip content=\"Discard all annotations\" theme={theme}>\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label=\"Discard all annotations\"\n disabled={locked}\n onClick={() =>\n requestDiscard\n ? requestDiscard(discardAnnotations)\n : dispatch({ type: 'discardDialogChanged', open: true })\n }\n >\n <Trash2 size={16} aria-hidden />\n </Button>\n </AnnotationTooltip>\n <AnnotationTooltip\n content={\n hasUnsavedChanges ? (\n 'Save the open annotation before sending'\n ) : (\n <>\n Send annotations <Kbd shortcut={shortcuts.sendAnnotations} />\n </>\n )\n }\n theme={theme}\n >\n <Button\n className=\"altertable-annotation-bar-send\"\n data-pending={pending || undefined}\n aria-busy={pending}\n size=\"compact\"\n aria-label=\"Send annotations\"\n disabled={!canSend}\n onClick={() => void send()}\n >\n <span className=\"altertable-annotation-bar-send-label\">Send</span>\n {pending && (\n <LoaderCircle\n className=\"altertable-annotation-bar-spinner\"\n size={16}\n aria-hidden\n />\n )}\n </Button>\n </AnnotationTooltip>\n <AnnotationTooltip\n content={\n <>\n {hasUnsavedChanges\n ? 'Save or discard the open annotation first'\n : 'Exit annotation mode'}{' '}\n <Kbd>Esc</Kbd>\n </>\n }\n theme={theme}\n >\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label=\"Exit annotation mode\"\n disabled={locked || hasUnsavedChanges}\n onClick={onClose}\n >\n <X size={16} aria-hidden />\n </Button>\n </AnnotationTooltip>\n {error && (\n <output className=\"altertable-annotation-bar-error\" role=\"alert\">\n {error}\n </output>\n )}\n </div>\n )}\n {(!active || !reviewOpen || annotations.length === 0) &&\n undo &&\n createPortal(undo, document.body)}\n {active &&\n reviewOpen &&\n annotations.length > 0 &&\n createPortal(\n <dialog\n open\n ref={reviewRef}\n className=\"altertable-annotation-bar-panel\"\n data-theme={theme}\n style={floatingStyles}\n aria-label=\"Review annotations\"\n onKeyDown={event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n closeReview();\n }\n }}\n >\n <header>\n <strong>Annotations</strong>\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label=\"Minimize annotation review\"\n onClick={closeReview}\n >\n <Minus size={16} aria-hidden />\n </Button>\n </header>\n <div aria-label=\"Annotation drafts\">\n {annotations.map((annotation, index) => (\n <div\n key={annotation.id}\n className=\"altertable-annotation-bar-row\"\n >\n {annotation.context.screenshot && (\n <button\n data-atbl-focus=\"ring\"\n data-atbl-control=\"action\"\n type=\"button\"\n className=\"altertable-annotation-thumbnail\"\n aria-label={`View screenshot of ${annotation.target.label}`}\n onClick={() =>\n dispatch({ type: 'previewOpened', id: annotation.id })\n }\n >\n <img src={annotation.context.screenshot.dataUrl} alt=\"\" />\n </button>\n )}\n <Button\n variant=\"ghost\"\n className=\"altertable-annotation-bar-open\"\n aria-label={`Open annotation ${index + 1}`}\n disabled={locked}\n onClick={() => {\n onPinsVisibleChange(true);\n onSelect(annotation.id);\n dispatch({ type: 'reviewClosed' });\n }}\n >\n <strong>{annotation.target.label}</strong>\n <span>{annotation.comment}</span>\n </Button>\n <Button\n variant=\"ghost\"\n size=\"icon-compact\"\n aria-label={`Delete annotation ${index + 1}`}\n disabled={locked}\n onClick={() => onDelete(annotation.id)}\n >\n <Trash2 size={16} aria-hidden />\n </Button>\n </div>\n ))}\n </div>\n {undo}\n </dialog>,\n document.body\n )}\n <Sheet\n open={Boolean(preview)}\n onOpenChange={open => {\n if (!open) dispatch({ type: 'previewClosed' });\n }}\n placement=\"center\"\n className=\"altertable-annotation-image-dialog\"\n title={preview?.target.label ?? 'Screenshot'}\n description={preview?.comment}\n returnFocus={reviewTrigger}\n >\n {preview?.context.screenshot && (\n <img\n className=\"altertable-annotation-preview\"\n src={preview.context.screenshot.dataUrl}\n alt={`Captured area for ${preview.target.label}`}\n />\n )}\n </Sheet>\n {!requestDiscard && (\n <Sheet\n open={discardOpen}\n onOpenChange={open =>\n dispatch({ type: 'discardDialogChanged', open })\n }\n placement=\"center\"\n title=\"Discard all pending annotations?\"\n returnFocus={barRef}\n footer={\n <>\n <Button\n ref={cancelDiscard}\n variant=\"ghost\"\n onClick={() =>\n dispatch({ type: 'discardDialogChanged', open: false })\n }\n >\n Cancel\n </Button>\n <Button\n className=\"altertable-annotation-discard-confirm\"\n disabled={locked}\n onClick={discardAnnotations}\n >\n Discard\n </Button>\n </>\n }\n >\n <p className=\"altertable-annotation-discard-description\">\n These annotations will be removed and won’t be sent to the agent.\n </p>\n </Sheet>\n )}\n </TooltipProvider>\n );\n}\n","import { injectStyles } from '../injectStyles.ts';\nimport { type DataAppStylesOptions } from '../styles.ts';\n\ndeclare const ANNOTATION_STYLES: string;\n\n/** Install only the outer-frame annotation controls; leave host page typography and layout intact. */\nexport function injectDataAppAnnotationStyles(\n options: DataAppStylesOptions = {}\n): HTMLStyleElement {\n return injectStyles({\n name: 'injectDataAppAnnotationStyles',\n attribute: 'data-altertable-annotation-styles',\n css: ANNOTATION_STYLES,\n options,\n });\n}\n"],"mappings":";;;;;;;;;;;AAmDA,SAAgB,QAAqB,OAAkC;CACrE,MAAM,EACJ,MACA,UACA,OACA,wBAAwB,MACxB,UAAU,CAAC,GACX,UACA,GAAG,UACD;CACJ,MAAM,MAAM,WAAW;CACvB,MAAM,SAAS,kBAAkB,IAAI;CACrC,MAAM,SAAS,YACb,MACA,OAAO,YAAY,EAAE,SAAS,KAAc,CAC9C;CACA,MAAM,mBACJ,yBAAyB,MAAM,eAAe,SAAS,OAAO,iBAC1D,SAAS,SAAS,SAAS,UAAU;EACnC,MAAM,UAAU,QAAQ,sBAAsB,MAAM;EACpD,IAAI,CAAC,SAAS,OAAO,CAAC;EACtB,OAAO,CACL,QAAQ,UACJ,CAAC,IACD,QAAQ,MAAM,KAAI,UAAS;GACzB,GAAG;GACH,IAAI,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,KAAK,aAAa;EACzC,EAAE,CACR;CACF,CAAC,IACD,CAAC;CACP,OACE,oBAAC,uBAAD;EAAuB,OAAO,EAAE,UAAU,OAAO,SAAS;EACxD,UAAA,oBAAC,0BAAD;GACE,OACE,iBAAiB,SACb;IACE,QAAQ;IACR,MAAM,OAAO;GACf,IACA;GAGN,UAAA,oBAAC,oBAAD;IAAoB,OAAO;KAAE,aAAa;KAAM;IAAO;IACrD,UAAA,oBAAC,cAAD;KAAuB;KACrB,UAAA,oBAAC,cAAD;MACE,GAAI;MACJ,S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;IACJ;GACK;EACR,CAAA,GAAA,SAAS,IACX;EACF,oBAAC,OAAD;GACE,MAAM,QAAQ,OAAO;GACrB,eAAc,SAAQ;IACpB,IAAI,CAAC,MAAM,SAAS,EAAE,MAAM,gBAAgB,CAAC;GAC/C;GACA,WAAU;GACV,WAAU;GACV,OAAO,SAAS,OAAO,SAAS;GAChC,aAAa,SAAS;GACtB,aAAa;GAEZ,UAAA,SAAS,QAAQ,cAChB,oBAAC,OAAD;IACE,WAAU;IACV,KAAK,QAAQ,QAAQ,WAAW;IAChC,KAAK,qBAAqB,QAAQ,OAAO;GAC1C,CAAA;EAEE,CAAA;EACN,CAAC,kBACA,oBAAC,OAAD;GACE,MAAM;GACN,eAAc,SACZ,SAAS;IAAE,MAAM;IAAwB;GAAK,CAAC;GAEjD,WAAU;GACV,OAAM;GACN,aAAa;GACb,QACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,QAAD;IACE,KAAK;IACL,SAAQ;IACR,eACE,SAAS;KAAE,MAAM;KAAwB,MAAM;IAAM,CAAC;IAEzD,UAAA;GAEO,CAAA,GACR,oBAAC,QAAD;IACE,WAAU;IACV,UAAU;IACV,SAAS;IACV,UAAA;GAEO,CAAA,CACR,EAAA,CAAA;GAGJ,UAAA,oBAAC,KAAD;IAAG,WAAU;IAA4C,UAAA;GAEtD,CAAA;EACE,CAAA;CAEM,EAAA,CAAA;AAErB;;;;ACpkBA,SAAgB,8BACd,UAAgC,CAAC,GACf;CAClB,OAAO,aAAa;EAClB,MAAM;EACN,WAAW;EACX,KAAA;EACA;CACF,CAAC;AACH"}
@@ -678,7 +678,8 @@ type DataWidgetProps<Data = unknown> = DataWidgetBaseProps & ((BoundWidgetReadin
678
678
  emptyFallback?: EmptyContent;
679
679
  children: ReactNode;
680
680
  });
681
- declare function DataWidget<Data>(props: DataWidgetProps<Data>): import("react").JSX.Element;
681
+ declare function DataWidgetInner<Data>(props: DataWidgetProps<Data>): import("react").JSX.Element;
682
+ declare const DataWidget: typeof DataWidgetInner;
682
683
  //#endregion
683
684
  //#region src/ui/TextWidget.d.ts
684
685
  type TextWidgetBaseProps = Omit<Extract<DataWidgetProps, {
@@ -472,7 +472,7 @@ type MetricWidgetProps<Data = unknown, Input = unknown> = Omit<Extract<MetricWid
472
472
  records?: MetricRecords<Data, Input, any, any>;
473
473
  actions?: ExplorationActions<void, NoInfer<Input>>;
474
474
  };
475
- export declare function MetricWidget<Data, Input>({ metric, source, records, actions, action, ...presentation }: MetricWidgetProps<Data, Input>): import("react").JSX.Element;
475
+ declare function MetricWidgetContent<Data, Input>({ metric, source, records, actions, action, ...presentation }: MetricWidgetProps<Data, Input>): import("react").JSX.Element;
476
476
  type BoundTableProps<Row> = Extract<TableWidgetProps$1<Row>, {
477
477
  reading: DataReading<readonly Row[]>;
478
478
  }>;
@@ -483,7 +483,7 @@ type TableWidgetProps<Row, Data = unknown, Input = unknown> = Omit<BoundTablePro
483
483
  title?: ReactNode;
484
484
  actions?: ExplorationActions<NoInfer<Row>, NoInfer<Input>>;
485
485
  };
486
- export declare function TableWidget<Row, Data, Input>({ dataset, source, title, actions, ...presentation }: TableWidgetProps<Row, Data, Input>): import("react").JSX.Element;
486
+ declare function TableWidgetContent<Row, Data, Input>({ dataset, source, title, actions, ...presentation }: TableWidgetProps<Row, Data, Input>): import("react").JSX.Element;
487
487
  type BoundVisual<Row> = Extract<VisualizationWidgetProps$1<readonly Row[]>, {
488
488
  reading: DataReading<readonly Row[]>;
489
489
  }>;
@@ -508,7 +508,7 @@ type VisualizationWidgetProps<Row, Data = unknown, Input = unknown> = Omit<Bound
508
508
  actions?: ExplorationActions<NoInfer<Row>, NoInfer<Input>>;
509
509
  breakdown?: BreakdownTarget<any>;
510
510
  };
511
- export declare function VisualizationWidget<Row, Data, Input>({ dataset, source, title, actions, breakdown, children, views, viewLabel, initialView, ...presentation }: VisualizationWidgetProps<Row, Data, Input>): import("react").JSX.Element;
511
+ declare function VisualizationWidgetContent<Row, Data, Input>({ dataset, source, title, actions, breakdown, children, views, viewLabel, initialView, ...presentation }: VisualizationWidgetProps<Row, Data, Input>): import("react").JSX.Element;
512
512
  type NarrativeBinding<Data, Input, Row> = {
513
513
  metric: Metric<Data, Input>;
514
514
  dataset?: never;
@@ -525,7 +525,7 @@ type TextWidgetProps<Data = unknown, Input = unknown, Row = never> = Omit<Extrac
525
525
  }>, 'reading' | 'evidence' | 'children' | 'title' | 'emptyFallback'> & NarrativeBinding<Data, Input, Row> & {
526
526
  title?: ReactNode;
527
527
  };
528
- export declare function TextWidget<Data, Input, Row>(props: TextWidgetProps<Data, Input, Row>): import("react").JSX.Element;
528
+ declare function TextWidgetContent<Data, Input, Row>(props: TextWidgetProps<Data, Input, Row>): import("react").JSX.Element;
529
529
  type InlinePresentation = Omit<DataValueProps$1<unknown>, 'reading' | 'children' | 'loadingFallback'> & {
530
530
  loadingFallback?: ReactNode;
531
531
  };
@@ -539,6 +539,10 @@ type DataValueProps<Data = unknown, Input = unknown, Row = never> = InlinePresen
539
539
  children?: (scope: string) => ReactNode;
540
540
  });
541
541
  export declare function DataValue<Data, Input, Row>(props: DataValueProps<Data, Input, Row>): import("react").JSX.Element;
542
+ export declare const MetricWidget: typeof MetricWidgetContent;
543
+ export declare const TableWidget: typeof TableWidgetContent;
544
+ export declare const VisualizationWidget: typeof VisualizationWidgetContent;
545
+ export declare const TextWidget: typeof TextWidgetContent;
542
546
  //#endregion
543
547
  //#region src/ui/chartColor.d.ts
544
548
  export declare function chartColor(id: string): string;
@@ -1,8 +1,9 @@
1
- import { $ as TableWidgetColumn, Bt as DataContext, C as MetricWidgetProps, Dt as ExplorationActionControl, Et as ExplorationAction, Ft as AboutSubject, Gt as StoryFinding, Ht as GlossaryEntry, It as AboutTab, J as DataAppStyleToken, K as DataAppStyle, Kt as PresentStory, Lt as Sheet, Mt as AboutData, Nt as AboutDataProps, O as StaticDataAppProps, Ot as ExplorationActionControlProps, Pt as AboutEmpty, Q as TableWidget, Rt as SheetProps, S as MetricWidget, St as SearchFieldProps, T as DataValueProps, Tt as CsvTable, U as useAppVariables, W as DataAppProvider, Wt as BoundStory, X as injectDataAppStyles, _t as DataTableTimestampProps, a as SectionHeadingProps, at as SearchMatchValue, b as DataWidget, bt as SearchTypeaheadProps, c as TooltipProvider, ct as searchItems, d as AppIconName, dt as DataTableEmptyRow, et as TableWidgetProps, f as AppIconProps, ft as DataTableEmptyRowProps, g as VisualizationWidgetProps, gt as DataTableTimestamp, h as VisualizationWidget, ht as DataTableShare, i as SectionHeading, it as SearchItemsOptions, kt as ItemActions, l as TooltipProviderProps, lt as WidgetStatus, m as HelpPopoverProps, mt as DataTableSearch, n as DateDisplay, nn as PressButton, nt as SearchAttribute, o as Tooltip, ot as SearchRange, p as HelpPopover, pt as DataTableProps, q as DataAppStyleHooks, qt as PresentStoryProps, r as DateDisplayProps, rt as SearchHit, s as TooltipProps, st as matchSearchText, t as useDateFormatting, u as AppIcon, ut as DataTable, v as TextWidget, vt as SearchSuggestion, w as DataValue, wt as CsvExport, x as DataWidgetProps, xt as SearchField, y as TextWidgetProps, yt as SearchTypeahead } from "../chunks/date-formatting.js";
1
+ import { $ as TableWidgetColumn, Bt as DataContext, C as MetricWidgetProps, Dt as ExplorationActionControl, Et as ExplorationAction, Ft as AboutSubject, Gt as StoryFinding, Ht as GlossaryEntry, It as AboutTab, J as DataAppStyleToken, K as DataAppStyle, Kt as PresentStory, Lt as Sheet, Mt as AboutData, Nt as AboutDataProps, O as StaticDataAppProps, Ot as ExplorationActionControlProps, Pt as AboutEmpty, Q as TableWidget$1, Rt as SheetProps, S as MetricWidget$1, St as SearchFieldProps, T as DataValueProps, Tt as CsvTable, U as useAppVariables, W as DataAppProvider, Wt as BoundStory, X as injectDataAppStyles, _t as DataTableTimestampProps, a as SectionHeadingProps, at as SearchMatchValue, b as DataWidget, bt as SearchTypeaheadProps, c as TooltipProvider, ct as searchItems, d as AppIconName, dt as DataTableEmptyRow, et as TableWidgetProps, f as AppIconProps, ft as DataTableEmptyRowProps, g as VisualizationWidgetProps, gt as DataTableTimestamp, h as VisualizationWidget$1, ht as DataTableShare, i as SectionHeading, it as SearchItemsOptions, kt as ItemActions, l as TooltipProviderProps, lt as WidgetStatus, m as HelpPopoverProps, mt as DataTableSearch, n as DateDisplay, nn as PressButton, nt as SearchAttribute, o as Tooltip, ot as SearchRange, p as HelpPopover, pt as DataTableProps, q as DataAppStyleHooks, qt as PresentStoryProps, r as DateDisplayProps, rt as SearchHit, s as TooltipProps, st as matchSearchText, t as useDateFormatting, u as AppIcon, ut as DataTable, v as TextWidget$1, vt as SearchSuggestion, w as DataValue, wt as CsvExport, x as DataWidgetProps, xt as SearchField, y as TextWidgetProps, yt as SearchTypeahead } from "../chunks/date-formatting.js";
2
2
  import { ChoiceOption, ChoiceOption as ChoiceOption$1, DataReading, DatePresetId, DatePresetId as DatePresetId$1, DateRange, DateRange as DateRange$1, DimensionSelectionVariable, DimensionValue, MetricReading } from "@altertable/data-app/internal";
3
3
  import { ComponentProps, ComponentPropsWithRef, ReactNode, RefAttributes } from "react";
4
4
  import { DateRangePicker as DateRangePicker$1, MenuItemProps, MenuProps, MenuSection, MenuTrigger, MenuTriggerProps, NumberField as NumberField$1, Popover, Radio as Radio$1, RadioGroup as RadioGroup$1, Separator } from "react-aria-components";
5
5
  import { Tab as Tab$1, TabListProps, TabPanel as TabPanel$1, TabPanels, Tabs as Tabs$1 } from "react-aria-components/Tabs";
6
+ import { MetricFormat } from "@altertable/data-app/format";
6
7
  import { CalendarDate } from "@internationalized/date";
7
8
  import { DimensionOption, DimensionSelection, DisclosedQuery, NumberFilter, NumberSelection } from "@altertable/data-app/contract";
8
9
  import { AreaProps, BarProps, Brush, CartesianGrid, ComposedChart as ComposedChart$1, DefaultTooltipContent, DotProps, ErrorBar, Label as Label$1, LabelList, Legend, LineProps, ReferenceArea, ReferenceDot, ReferenceLine, Scatter, Tooltip as Tooltip$1, XAxis, YAxis, ZAxis } from "recharts";
@@ -80,6 +81,14 @@ type SearchMatchProps = {
80
81
  } & Omit<ComponentPropsWithRef<'span'>, 'children'>;
81
82
  export declare function SearchMatch({ match, className, ...props }: SearchMatchProps): import("react").JSX.Element;
82
83
  //#endregion
84
+ //#region src/ui/ShimmerText.d.ts
85
+ type ShimmerTextProps = Omit<ComponentPropsWithRef<'span'>, 'children'> & {
86
+ children: string;
87
+ };
88
+ /** Animated text for custom activity labels. Wrap in `<output>` to announce updates.
89
+ * Respects reduced motion. */
90
+ export declare function ShimmerText({ children, className, ...props }: ShimmerTextProps): import("react").JSX.Element;
91
+ //#endregion
83
92
  //#region src/ui/ChoicePicker.d.ts
84
93
  type SharedProps = {
85
94
  label: string;
@@ -424,6 +433,9 @@ type ComposedChartProps<Row = unknown> = Omit<ComponentProps<typeof ComposedChar
424
433
  data: readonly Row[];
425
434
  /** Describes the measures and scope for assistive technology. */
426
435
  ariaLabel: string;
436
+ /** Shared measure semantics: compact numeric axes and precise tooltips.
437
+ * For mixed units, use explicit axis tickFormatter and series/tooltip formatters. */
438
+ valueFormat?: MetricFormat;
427
439
  };
428
440
  /** Compose Cartesian series inside VisualizationWidget. Defaults to responsive
429
441
  * full width and 300px height. Children retain native Recharts props and behavior,
@@ -432,7 +444,7 @@ type ComposedChartProps<Row = unknown> = Omit<ComponentProps<typeof ComposedChar
432
444
  * for stacks. Preserve missing measures as null and choose connectNulls deliberately.
433
445
  * Use public chart tokens for series colors. Dataset bindings own
434
446
  * loading, empty results, evidence, and CSV; this primitive owns only the plot. */
435
- declare function ComposedChartRoot<Row>({ data, ariaLabel, width, height, responsive, className, ...props }: ComposedChartProps<Row>): import("react").JSX.Element;
447
+ declare function ComposedChartRoot<Row>({ data, ariaLabel, valueFormat, width, height, responsive, className, ...props }: ComposedChartProps<Row>): import("react").JSX.Element;
436
448
  /** Shared themed series and controls; other children retain native Recharts defaults. */
437
449
  export declare const ComposedChart: typeof ComposedChartRoot & {
438
450
  Dot: typeof ChartDot;
@@ -568,5 +580,12 @@ export declare function JourneyChart({ paths, unit, ariaLabel, className, format
568
580
  /** Stable React ID for SVG definitions and their URL references; safe with identifier prefixes. */
569
581
  export declare function useSvgId(): string;
570
582
  //#endregion
571
- export { AboutData, type AboutDataProps, type AboutEmpty, type AboutSubject, type AboutTab, AppIcon, type AppIconName, type AppIconProps, type AreaChartItem, type AreaChartProps, type BarChartItem, type BarChartProps, type BoundStory, type ChartLegendItemProps, type ChartLegendLabelProps, type ChartLegendMarkerKind, type ChartLegendMarkerProps, type ChartLegendProps, type CheckboxGroupProps, type CheckboxProps, type ChoiceOption, type ChoicePickerProps, type ComposedChartLegendProps, type ComposedChartProps, type CsvExport, type CsvTable, type DataAppProps, DataAppProvider, type DataAppStyle, type DataAppStyleHooks, type DataAppStyleToken, type DataReading, DataTable, DataTableEmptyRow, type DataTableEmptyRowProps, type DataTableProps, type DataTableSearch, DataTableShare, DataTableTimestamp, type DataTableTimestampProps, DataValue, type DataValueProps, DataWidget, type DataWidgetProps, DateDisplay, type DateDisplayProps, type DatePresetId, type DateRange, type DateRangePickerProps, type ExplorationAction, ExplorationActionControl, type ExplorationActionControlProps, type FilterActionsProps, type FilterBarProps, type FunnelChartProps, type FunnelChartSeries, type FunnelChartStep, type GlossaryDefinitionProps, type GlossaryExplanationProps, type GradientScrollProps, HelpPopover, type HelpPopoverProps, type ItemActions, type JourneyChartPath, type JourneyChartProps, type LineChartItem, type LineChartProps, type LiveControlProps, type LiveIntervalSeconds, PressButton as MenuButton, type MenuItemProps, type MenuPopoverProps, type MenuProps, MenuSection, MenuTrigger, type MenuTriggerProps, type MetricReading, MetricWidget, type MetricWidgetProps, type NumberFieldProps, type NumberFilterPickerProps, type NumberRange, type NumberRangeFieldProps, type PieChartItem, type PieChartProps, PresentStory, type PresentStoryProps, type RadioGroupProps, type RadioProps, type RetentionChartPoint, type RetentionChartProps, type RetentionChartSeries, type ScatterChartItem, type ScatterChartProps, type SearchAttribute, SearchField, type SearchFieldProps, type SearchHit, type SearchItemsOptions, type SearchMatchProps, type SearchMatchValue, type SearchRange, type SearchSuggestion, SearchTypeahead, type SearchTypeaheadProps, SectionHeading, type SectionHeadingProps, type SegmentedControlProps, type SelectProps, Sheet, type SheetProps, type StoryFinding, TabPanels, TableWidget, type TableWidgetColumn, type TableWidgetProps, TextWidget, type TextWidgetProps, Tooltip, type TooltipProps, TooltipProvider, type TooltipProviderProps, type VariableBarProps, VisualizationWidget, type VisualizationWidgetProps, type WidgetStatus, injectDataAppStyles, matchSearchText, searchItems, useAppVariables, useDateFormatting };
583
+ //#region src/ui/index.d.ts
584
+ export declare const TextWidget: typeof TextWidget$1;
585
+ /** Compose an unframed visual with the shared heading and inspection. */
586
+ export declare const VisualizationWidget: typeof VisualizationWidget$1;
587
+ export declare const TableWidget: typeof TableWidget$1;
588
+ export declare const MetricWidget: typeof MetricWidget$1;
589
+ //#endregion
590
+ export { AboutData, type AboutDataProps, type AboutEmpty, type AboutSubject, type AboutTab, AppIcon, type AppIconName, type AppIconProps, type AreaChartItem, type AreaChartProps, type BarChartItem, type BarChartProps, type BoundStory, type ChartLegendItemProps, type ChartLegendLabelProps, type ChartLegendMarkerKind, type ChartLegendMarkerProps, type ChartLegendProps, type CheckboxGroupProps, type CheckboxProps, type ChoiceOption, type ChoicePickerProps, type ComposedChartLegendProps, type ComposedChartProps, type CsvExport, type CsvTable, type DataAppProps, DataAppProvider, type DataAppStyle, type DataAppStyleHooks, type DataAppStyleToken, type DataReading, DataTable, DataTableEmptyRow, type DataTableEmptyRowProps, type DataTableProps, type DataTableSearch, DataTableShare, DataTableTimestamp, type DataTableTimestampProps, DataValue, type DataValueProps, DataWidget, type DataWidgetProps, DateDisplay, type DateDisplayProps, type DatePresetId, type DateRange, type DateRangePickerProps, type ExplorationAction, ExplorationActionControl, type ExplorationActionControlProps, type FilterActionsProps, type FilterBarProps, type FunnelChartProps, type FunnelChartSeries, type FunnelChartStep, type GlossaryDefinitionProps, type GlossaryExplanationProps, type GradientScrollProps, HelpPopover, type HelpPopoverProps, type ItemActions, type JourneyChartPath, type JourneyChartProps, type LineChartItem, type LineChartProps, type LiveControlProps, type LiveIntervalSeconds, PressButton as MenuButton, type MenuItemProps, type MenuPopoverProps, type MenuProps, MenuSection, MenuTrigger, type MenuTriggerProps, type MetricReading, type MetricWidgetProps, type NumberFieldProps, type NumberFilterPickerProps, type NumberRange, type NumberRangeFieldProps, type PieChartItem, type PieChartProps, PresentStory, type PresentStoryProps, type RadioGroupProps, type RadioProps, type RetentionChartPoint, type RetentionChartProps, type RetentionChartSeries, type ScatterChartItem, type ScatterChartProps, type SearchAttribute, SearchField, type SearchFieldProps, type SearchHit, type SearchItemsOptions, type SearchMatchProps, type SearchMatchValue, type SearchRange, type SearchSuggestion, SearchTypeahead, type SearchTypeaheadProps, SectionHeading, type SectionHeadingProps, type SegmentedControlProps, type SelectProps, Sheet, type SheetProps, type ShimmerTextProps, type StoryFinding, TabPanels, type TableWidgetColumn, type TableWidgetProps, type TextWidgetProps, Tooltip, type TooltipProps, TooltipProvider, type TooltipProviderProps, type VariableBarProps, type VisualizationWidgetProps, type WidgetStatus, injectDataAppStyles, matchSearchText, searchItems, useAppVariables, useDateFormatting };
572
591
  //# sourceMappingURL=index.d.ts.map