@altertable/data-app-react 0.77.0 → 0.78.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/README.md +3 -4
- package/dist/chunks/{SectionHeading-Bz5RIXit.js → SectionHeading-BKvi7HVv.js} +250 -103
- package/dist/chunks/SectionHeading-BKvi7HVv.js.map +1 -0
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/dist/types/chunks/DateTimeRangePicker.d.ts +19 -4
- package/dist/types/index.d.ts +2 -2
- package/dist/types/ui/index.d.ts +20 -9
- package/dist/ui/index.js +449 -152
- package/dist/ui/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunks/SectionHeading-Bz5RIXit.js.map +0 -1
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/useHasNearedViewport.ts","../src/ui/DataSection.tsx","../src/ui/UpdatedAt.tsx","../src/ui/PeriodSummary.tsx","../src/ui/data-identifiers.tsx","../src/annotations/AnnotationTarget.tsx","../src/ui/ExternalLink.tsx","../src/annotations/AnnotationBar.tsx","../src/annotations/styles.ts"],"sourcesContent":["import {\n KEY_SEPARATOR,\n invariant,\n type DataReading,\n type DisplayedSnapshot,\n} from '@altertable/data-app/internal';\nimport { type ReactNode } from 'react';\n\nimport { useDataApp } from '../app-context.ts';\nimport {\n registeredEvidence,\n exportDatasets,\n RegisteredBinding,\n type ExportDataset,\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 AppViewResultsContext,\n assertAppFilters,\n getViewDefinition,\n type ClientFilters,\n type DeclaredView,\n type FilterControls,\n type ViewResult,\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\n/** A declared data or time view that `<DataApp>` can run and describe. */\nexport type DataAppView<Data, Input> = DeclaredView<Data, Input> & {\n scope(snapshot: DisplayedSnapshot<Data, Input>): string;\n};\ntype AnyView = DataAppView<any, any>;\n/** Read a view's data and input through its `scope()` signature. */\ntype SnapshotOf<View> = View extends {\n scope(snapshot: infer Snapshot): string;\n}\n ? Snapshot\n : never;\ntype ExportOf<View> = View extends {\n scope(snapshot: DisplayedSnapshot<infer Data, infer Input>): string;\n}\n ? ExportDataset<Data, Input>\n : never;\ntype StoryFindings = readonly (Omit<StoryFinding, 'evidence'> & {\n evidence: RegisteredBinding;\n})[];\n\nexport type DataAppProps<\n Data,\n Input = unknown,\n SummaryViews extends readonly AnyView[] = [],\n> = Omit<DataAppBaseProps, 'dataContext'> &\n DataAppControlProps & {\n /** The headline view. `<DataApp>` renders the controls for every filter its\n * client's operations read and owns their URL state. */\n view: DataAppView<Data, Input>;\n /** Other views that the story and CSV export read, sharing `view`’s data context.\n * They load with `view` instead of waiting for their sections to near the viewport. */\n summaryViews?: SummaryViews;\n /** Show supplied datasets’ record suggestions on the first declared search. Defaults to true. */\n showSearchSuggestions?: boolean;\n /** Omit to leave presentation out of the toolbar. Receives `view`’s displayed\n * snapshot, then one per summary view in `summaryViews` order. */\n story?: (\n snapshot: DisplayedSnapshot<Data, Input>,\n ...summaries: {\n [Index in keyof SummaryViews]: SnapshotOf<SummaryViews[Index]>;\n }\n ) => StoryFindings;\n /** Omit to leave CSV export out of the toolbar. Datasets may belong to `view` or a summary view. */\n datasets?: readonly [\n ExportDataset<Data, Input> | ExportOf<SummaryViews[number]>,\n ...(ExportDataset<Data, Input> | ExportOf<SummaryViews[number]>)[],\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 its summary views, and owns controls, inspection, exports, and stories. */\nexport function DataApp<\n Data,\n Input,\n const SummaryViews extends readonly AnyView[] = [],\n>(props: DataAppProps<Data, Input, SummaryViews>) {\n const { summaryViews = [], ...appProps } = props;\n const { clientFilters } = getViewDefinition(props.view) as {\n clientFilters: ClientFilters;\n };\n return (\n <AppFilterControls clientFilters={clientFilters}>\n {controls => (\n <SummaryResults views={summaryViews} results={[]}>\n {summaries => (\n <PrimaryDataApp\n {...appProps}\n clientFilters={clientFilters}\n controls={controls}\n summaries={summaries}\n />\n )}\n </SummaryResults>\n )}\n </AppFilterControls>\n );\n}\n\n/** Render the client's filter controls once for the whole app. */\nfunction AppFilterControls({\n clientFilters,\n children,\n}: {\n clientFilters: ClientFilters;\n children: (controls: FilterControls) => ReactNode;\n}) {\n return children(clientFilters.useControls());\n}\n\ntype SummaryResult = { view: AnyView; result: ViewResult<unknown, unknown> };\ntype SummaryResultsProps = {\n views: readonly AnyView[];\n results: readonly SummaryResult[];\n children: (results: readonly SummaryResult[]) => ReactNode;\n};\n\n/** Subscribe to each summary view in order, one hook call per component. */\nfunction SummaryResults(props: SummaryResultsProps) {\n const view = props.views[props.results.length];\n if (!view) return props.children(props.results);\n return <SummaryViewResult {...props} view={view} />;\n}\n\nfunction SummaryViewResult({\n view,\n ...props\n}: SummaryResultsProps & { view: AnyView }) {\n const result = useDeclaredResult(view);\n return (\n <SummaryResults {...props} results={[...props.results, { view, result }]} />\n );\n}\n\nfunction PrimaryDataApp<\n Data,\n Input,\n const SummaryViews extends readonly AnyView[],\n>(\n props: Omit<DataAppProps<Data, Input, SummaryViews>, 'summaryViews'> & {\n clientFilters: ClientFilters;\n controls: FilterControls;\n summaries: readonly SummaryResult[];\n }\n) {\n const {\n view,\n clientFilters,\n controls,\n summaries,\n datasets,\n story,\n showSearchSuggestions = true,\n details = [],\n children,\n ...frame\n } = props;\n const app = useDataApp();\n const primary = useDeclaredResult(view);\n // Views in one app have different data shapes; each binding checks its own owner.\n const results = new Map<object, ViewResult<any, any>>([\n [view, primary],\n ...summaries.map(({ view, result }) => [view, result] as const),\n ]);\n const owners = [...results.keys()];\n assertAppFilters(view, clientFilters);\n for (const summary of summaries) {\n invariant(\n summary.result.dataContext === primary.dataContext,\n 'Summary views must share the app view’s data context.'\n );\n assertAppFilters(summary.view, clientFilters);\n }\n const datasetOwners = (datasets ?? []).map(dataset => {\n const owner = RegisteredBinding.owner(dataset);\n invariant(\n owner && results.has(owner),\n 'A toolbar dataset must belong to the app view or one of its summary views.'\n );\n return owner;\n });\n /** Read the owners' displayed snapshots, marked for their bindings, once each has loaded. */\n function readDisplayed<Value>(\n sourceOwners: readonly object[],\n read: (sources: DisplayedSnapshot<any, any>[]) => Value\n ): DataReading<Value> {\n const snapshots = sourceOwners.map(owner => results.get(owner)?.snapshot);\n if (!snapshots.every(isDefined)) return { loading: true };\n return {\n loading: false,\n value: read(\n snapshots.map((snapshot, index) =>\n ownedSource(sourceOwners[index]!, snapshot)\n )\n ),\n };\n }\n /** The owner's displayed snapshot, or its loading state, marked for its bindings. */\n function sourceOf(owner: object) {\n return ownedSource(\n owner,\n results.get(owner)?.snapshot ?? { loading: true as const }\n );\n }\n // Inspection, refresh, and cancel cover every view that the story and export read.\n const allResults = [...results.values()];\n const result = {\n ...primary,\n ...controls,\n queries: allResults.flatMap(({ queries }) => queries ?? []),\n refreshing: allResults.some(({ refreshing }) => refreshing),\n refetch() {\n for (const { refetch } of allResults) refetch();\n },\n cancel() {\n for (const { cancel } of allResults) cancel();\n },\n };\n const storyReading =\n story &&\n readDisplayed(owners, ([snapshot, ...summarySnapshots]) =>\n story(snapshot!, ...(summarySnapshots as never)).map(finding => ({\n ...finding,\n evidence: registeredEvidence(finding.evidence, owners),\n }))\n );\n const csvExport =\n datasets &&\n readDisplayed([view, ...datasetOwners], ([snapshot, ...snapshots]) =>\n exportDatasets({\n tables: datasets.map((dataset, index) => ({\n dataset,\n snapshot: snapshots[index]!,\n })),\n scope: view.scope(snapshot!),\n appTitle: app.title,\n })\n );\n const suggestionGroups =\n showSearchSuggestions && frame.showSearch !== false && result.searchControls\n ? (datasets ?? []).flatMap((dataset, index) => {\n const reading = dataset.readSearchSuggestions(\n sourceOf(datasetOwners[index]!)\n );\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 <AppViewResultsContext\n value={{\n primaryView: view,\n clientFilters,\n results: new Map(results).set(view, result),\n }}\n >\n <DetailRoutes details={details}>\n <DataAppFrame\n {...frame}\n request={result}\n dataContext={result.dataContext}\n story={storyReading}\n csvExport={csvExport}\n >\n {children}\n </DataAppFrame>\n </DetailRoutes>\n </AppViewResultsContext>\n </SearchSuggestionsContext>\n </DateFormattingContext>\n );\n}\n\nfunction isDefined<Value>(value: Value | undefined): value is Value {\n return value !== undefined;\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.filter.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 { useCallback, useState } from 'react';\n\n/** Start requests slightly before a section scrolls into view so it is ready on arrival. */\nconst PREFETCH_MARGIN = '200px 0px';\n\n/** Track whether an element has come within the prefetch margin of the viewport.\n * The answer latches to true: a section that has loaded keeps following its filters. */\nexport function useHasNearedViewport(): [\n ref: (element: Element | null) => (() => void) | undefined,\n hasNeared: boolean,\n] {\n const [hasNeared, setHasNeared] = useState(\n () => typeof IntersectionObserver === 'undefined'\n );\n const ref = useCallback(\n (element: Element | null) => {\n if (!element || hasNeared) return;\n const observer = new IntersectionObserver(\n entries => {\n if (entries.some(entry => entry.isIntersecting)) setHasNeared(true);\n },\n { rootMargin: PREFETCH_MARGIN }\n );\n observer.observe(element);\n return () => observer.disconnect();\n },\n [hasNeared]\n );\n return [ref, hasNeared];\n}\n","import {\n useCallback,\n useContext,\n type ComponentPropsWithRef,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { sectionContent, type ViewContent } from '../content.ts';\nimport { DateFormattingContext } from '../date-formatting.ts';\nimport {\n AppViewResultsContext,\n assertAppFilters,\n type DeclaredView,\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';\nimport { useHasNearedViewport } from './useHasNearedViewport.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\ntype SectionProps<Data, Input> = Omit<\n DataSectionProps<Data, Input>,\n 'content'\n> &\n Omit<ReturnType<typeof sectionContent<Data, Input>>, 'view'>;\n\n/** Sections of views that `<DataApp>` runs share its results; every other section\n * requests its own view once it nears the viewport. */\nexport function DataSection<Data, Input>({\n content,\n ...presentation\n}: DataSectionProps<Data, Input>) {\n const app = useContext(AppViewResultsContext);\n const { view, ...section } = sectionContent(content);\n // Identity proves the shared result belongs to this content's declaration.\n const appResult = app?.results.get(view) as\n | ViewResult<Data, Input>\n | undefined;\n if (!appResult) {\n if (app) assertAppFilters(view, app.clientFilters);\n return <LazySection view={view} {...section} {...presentation} />;\n }\n // The app reports the primary view's request state for the whole page.\n if (view === app?.primaryView)\n return (\n <DataSectionBoundary\n {...section}\n {...presentation}\n result={appResult}\n notice=\"none\"\n />\n );\n return (\n <StandaloneSection {...section} {...presentation} result={appResult} />\n );\n}\n\n/** Requests its view only once the section nears the viewport,\n * so each widget's query runs when a reader can see it. */\nfunction LazySection<Data, Input>({\n view,\n ref,\n ...props\n}: SectionProps<Data, Input> & { view: DeclaredView<Data, Input> }) {\n const [observeViewport, hasNearedViewport] = useHasNearedViewport();\n const result = useDeclaredResult(view, { enabled: hasNearedViewport });\n const sectionRef = useCallback(\n (element: HTMLDivElement | null) => {\n assignRef(ref, element);\n const stopObserving = observeViewport(element);\n return () => {\n stopObserving?.();\n assignRef(ref, null);\n };\n },\n [ref, observeViewport]\n );\n return <StandaloneSection {...props} ref={sectionRef} result={result} />;\n}\n\n/** Reports its own request state inline and inspects its own queries. */\nfunction StandaloneSection<Data, Input>({\n result,\n ...props\n}: SectionProps<Data, Input> & { result: ViewResult<Data, Input> }) {\n const defaults = useInspectionDefaults();\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 <DataSectionBoundary {...props} result={result} notice=\"inline\" />\n </InspectionContext>\n </DateFormattingContext>\n );\n}\n\nfunction assignRef<Value>(ref: Ref<Value> | undefined, value: Value) {\n if (typeof ref === 'function') ref(value);\n else if (ref) ref.current = value;\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';\nimport { fixedUnitMilliseconds } from '@altertable/data-app/internal';\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 *\n (period.unit === 'hour'\n ? fixedUnitMilliseconds.HOUR\n : fixedUnitMilliseconds.DAY)\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 control 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 {\n getDataAppTransport,\n navigateNewTab,\n navigateNewWindowOrTab,\n} from '@altertable/data-app/client';\nimport { parseExternalUrl } from '@altertable/data-app/contract';\nimport {\n useEffect,\n useRef,\n useState,\n type ReactNode,\n type MouseEvent,\n} from 'react';\n\nexport type ExternalLinkProps = {\n href: string;\n children: ReactNode;\n className?: string;\n title?: string;\n};\n\n/** Open HTTPS links through the host when embedded, or a native new tab when standalone. */\nexport function ExternalLink({\n href,\n children,\n className,\n title,\n}: ExternalLinkProps) {\n const [error, setError] = useState(false);\n const [pending, setPending] = useState(false);\n const request = useRef<AbortController | undefined>(undefined);\n useEffect(() => () => request.current?.abort(), []);\n let url: string | undefined;\n try {\n url = parseExternalUrl(href);\n } catch {\n /* Invalid destinations are not clickable. */\n }\n function open(event: MouseEvent<HTMLAnchorElement>) {\n const transport = getDataAppTransport();\n if (!url || pending) {\n event.preventDefault();\n return;\n }\n if (!transport) return;\n event.preventDefault();\n if (request.current) return;\n const controller = new AbortController();\n request.current = controller;\n setPending(true);\n setError(false);\n const options = { signal: controller.signal };\n const navigation =\n event.shiftKey || event.metaKey || event.ctrlKey\n ? navigateNewWindowOrTab(url, event, options)\n : navigateNewTab(url, options);\n void navigation\n .catch(() => {\n if (!controller.signal.aborted) setError(true);\n })\n .finally(() => {\n if (request.current !== controller) return;\n request.current = undefined;\n setPending(false);\n });\n }\n return (\n <>\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={className}\n title={title}\n aria-disabled={!url || pending}\n aria-busy={pending || undefined}\n onClick={open}\n onAuxClick={event => {\n if (event.button === 1) open(event);\n }}\n >\n {children}\n </a>\n {(!url || error) && (\n <span role=\"alert\">\n {!url\n ? 'Invalid external link.'\n : 'Could not open this link. The host may not support external links.'}\n </span>\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: '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ACR,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"}
|
|
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/useHasNearedViewport.ts","../src/ui/DataSection.tsx","../src/ui/UpdatedAt.tsx","../src/ui/PeriodSummary.tsx","../src/ui/data-identifiers.tsx","../src/annotations/AnnotationTarget.tsx","../src/ui/ExternalLink.tsx","../src/annotations/AnnotationBar.tsx","../src/annotations/styles.ts"],"sourcesContent":["import {\n KEY_SEPARATOR,\n invariant,\n type DataReading,\n type DisplayedSnapshot,\n} from '@altertable/data-app/internal';\nimport { type ReactNode } from 'react';\n\nimport { useDataApp } from '../app-context.ts';\nimport {\n registeredEvidence,\n exportDatasets,\n RegisteredBinding,\n type ExportDataset,\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 AppViewResultsContext,\n assertAppFilters,\n getViewDefinition,\n type ClientFilters,\n type DeclaredView,\n type FilterControls,\n type ViewResult,\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\n/** A declared data or time view that `<DataApp>` can run and describe. */\nexport type DataAppView<Data, Input> = DeclaredView<Data, Input> & {\n scope(snapshot: DisplayedSnapshot<Data, Input>): string;\n};\ntype AnyView = DataAppView<any, any>;\n/** Read a view's data and input through its `scope()` signature. */\ntype SnapshotOf<View> = View extends {\n scope(snapshot: infer Snapshot): string;\n}\n ? Snapshot\n : never;\ntype ExportOf<View> = View extends {\n scope(snapshot: DisplayedSnapshot<infer Data, infer Input>): string;\n}\n ? ExportDataset<Data, Input>\n : never;\ntype StoryFindings = readonly (Omit<StoryFinding, 'evidence'> & {\n evidence: RegisteredBinding;\n})[];\n\nexport type DataAppProps<\n Data,\n Input = unknown,\n SummaryViews extends readonly AnyView[] = [],\n> = Omit<DataAppBaseProps, 'dataContext'> &\n DataAppControlProps & {\n /** The headline view. `<DataApp>` renders the controls for every filter its\n * client's operations read and owns their URL state. */\n view: DataAppView<Data, Input>;\n /** Other views that the story and CSV export read, sharing `view`’s data context.\n * They load with `view` instead of waiting for their sections to near the viewport. */\n summaryViews?: SummaryViews;\n /** Show supplied datasets’ record suggestions on the first declared search. Defaults to true. */\n showSearchSuggestions?: boolean;\n /** Omit to leave presentation out of the toolbar. Receives `view`’s displayed\n * snapshot, then one per summary view in `summaryViews` order. */\n story?: (\n snapshot: DisplayedSnapshot<Data, Input>,\n ...summaries: {\n [Index in keyof SummaryViews]: SnapshotOf<SummaryViews[Index]>;\n }\n ) => StoryFindings;\n /** Omit to leave CSV export out of the toolbar. Datasets may belong to `view` or a summary view. */\n datasets?: readonly [\n ExportDataset<Data, Input> | ExportOf<SummaryViews[number]>,\n ...(ExportDataset<Data, Input> | ExportOf<SummaryViews[number]>)[],\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 its summary views, and owns controls, inspection, exports, and stories. */\nexport function DataApp<\n Data,\n Input,\n const SummaryViews extends readonly AnyView[] = [],\n>(props: DataAppProps<Data, Input, SummaryViews>) {\n const { summaryViews = [], ...appProps } = props;\n const { clientFilters } = getViewDefinition(props.view) as {\n clientFilters: ClientFilters;\n };\n return (\n <AppFilterControls clientFilters={clientFilters}>\n {controls => (\n <SummaryResults views={summaryViews} results={[]}>\n {summaries => (\n <PrimaryDataApp\n {...appProps}\n clientFilters={clientFilters}\n controls={controls}\n summaries={summaries}\n />\n )}\n </SummaryResults>\n )}\n </AppFilterControls>\n );\n}\n\n/** Render the client's filter controls once for the whole app. */\nfunction AppFilterControls({\n clientFilters,\n children,\n}: {\n clientFilters: ClientFilters;\n children: (controls: FilterControls) => ReactNode;\n}) {\n return children(clientFilters.useControls());\n}\n\ntype SummaryResult = { view: AnyView; result: ViewResult<unknown, unknown> };\ntype SummaryResultsProps = {\n views: readonly AnyView[];\n results: readonly SummaryResult[];\n children: (results: readonly SummaryResult[]) => ReactNode;\n};\n\n/** Subscribe to each summary view in order, one hook call per component. */\nfunction SummaryResults(props: SummaryResultsProps) {\n const view = props.views[props.results.length];\n if (!view) return props.children(props.results);\n return <SummaryViewResult {...props} view={view} />;\n}\n\nfunction SummaryViewResult({\n view,\n ...props\n}: SummaryResultsProps & { view: AnyView }) {\n const result = useDeclaredResult(view);\n return (\n <SummaryResults {...props} results={[...props.results, { view, result }]} />\n );\n}\n\nfunction PrimaryDataApp<\n Data,\n Input,\n const SummaryViews extends readonly AnyView[],\n>(\n props: Omit<DataAppProps<Data, Input, SummaryViews>, 'summaryViews'> & {\n clientFilters: ClientFilters;\n controls: FilterControls;\n summaries: readonly SummaryResult[];\n }\n) {\n const {\n view,\n clientFilters,\n controls,\n summaries,\n datasets,\n story,\n showSearchSuggestions = true,\n details = [],\n children,\n ...frame\n } = props;\n const app = useDataApp();\n const primary = useDeclaredResult(view);\n // Views in one app have different data shapes; each binding checks its own owner.\n const results = new Map<object, ViewResult<any, any>>([\n [view, primary],\n ...summaries.map(({ view, result }) => [view, result] as const),\n ]);\n const owners = [...results.keys()];\n assertAppFilters(view, clientFilters);\n for (const summary of summaries) {\n invariant(\n summary.result.dataContext === primary.dataContext,\n 'Summary views must share the app view’s data context.'\n );\n assertAppFilters(summary.view, clientFilters);\n }\n const datasetOwners = (datasets ?? []).map(dataset => {\n const owner = RegisteredBinding.owner(dataset);\n invariant(\n owner && results.has(owner),\n 'A toolbar dataset must belong to the app view or one of its summary views.'\n );\n return owner;\n });\n /** Read the owners' displayed snapshots, marked for their bindings, once each has loaded. */\n function readDisplayed<Value>(\n sourceOwners: readonly object[],\n read: (sources: DisplayedSnapshot<any, any>[]) => Value\n ): DataReading<Value> {\n const snapshots = sourceOwners.map(owner => results.get(owner)?.snapshot);\n if (!snapshots.every(isDefined)) return { loading: true };\n return {\n loading: false,\n value: read(\n snapshots.map((snapshot, index) =>\n ownedSource(sourceOwners[index]!, snapshot)\n )\n ),\n };\n }\n /** The owner's displayed snapshot, or its loading state, marked for its bindings. */\n function sourceOf(owner: object) {\n return ownedSource(\n owner,\n results.get(owner)?.snapshot ?? { loading: true as const }\n );\n }\n // Inspection, refresh, and cancel cover every view that the story and export read.\n const allResults = [...results.values()];\n const result = {\n ...primary,\n ...controls,\n queries: allResults.flatMap(({ queries }) => queries ?? []),\n refreshing: allResults.some(({ refreshing }) => refreshing),\n refetch() {\n for (const { refetch } of allResults) refetch();\n },\n cancel() {\n for (const { cancel } of allResults) cancel();\n },\n };\n const storyReading =\n story &&\n readDisplayed(owners, ([snapshot, ...summarySnapshots]) =>\n story(snapshot!, ...(summarySnapshots as never)).map(finding => ({\n ...finding,\n evidence: registeredEvidence(finding.evidence, owners),\n }))\n );\n const csvExport =\n datasets &&\n readDisplayed([view, ...datasetOwners], ([snapshot, ...snapshots]) =>\n exportDatasets({\n tables: datasets.map((dataset, index) => ({\n dataset,\n snapshot: snapshots[index]!,\n })),\n scope: view.scope(snapshot!),\n appTitle: app.title,\n })\n );\n const suggestionGroups =\n showSearchSuggestions && frame.showSearch !== false && result.searchControls\n ? (datasets ?? []).flatMap((dataset, index) => {\n const reading = dataset.readSearchSuggestions(\n sourceOf(datasetOwners[index]!)\n );\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 <AppViewResultsContext\n value={{\n primaryView: view,\n clientFilters,\n results: new Map(results).set(view, result),\n }}\n >\n <DetailRoutes details={details}>\n <DataAppFrame\n {...frame}\n request={result}\n dataContext={result.dataContext}\n story={storyReading}\n csvExport={csvExport}\n >\n {children}\n </DataAppFrame>\n </DetailRoutes>\n </AppViewResultsContext>\n </SearchSuggestionsContext>\n </DateFormattingContext>\n );\n}\n\nfunction isDefined<Value>(value: Value | undefined): value is Value {\n return value !== undefined;\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.filter.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 =\n Math.max(Math.abs(current.value), Math.abs(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: trackWidth(current.value, max) }} />\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 style={{ width: trackWidth(previous.value ?? 0, max) }} />\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 ?? 'previous period'}\n </>\n )}\n </p>\n </figure>\n );\n}\n\nfunction trackWidth(value: number, max: number) {\n return `${Math.max(0, value / max) * 100}%`;\n}\n","import { useCallback, useState } from 'react';\n\n/** Start requests slightly before a section scrolls into view so it is ready on arrival. */\nconst PREFETCH_MARGIN = '200px 0px';\n\n/** Track whether an element has come within the prefetch margin of the viewport.\n * The answer latches to true: a section that has loaded keeps following its filters. */\nexport function useHasNearedViewport(): [\n ref: (element: Element | null) => (() => void) | undefined,\n hasNeared: boolean,\n] {\n const [hasNeared, setHasNeared] = useState(\n () => typeof IntersectionObserver === 'undefined'\n );\n const ref = useCallback(\n (element: Element | null) => {\n if (!element || hasNeared) return;\n const observer = new IntersectionObserver(\n entries => {\n if (entries.some(entry => entry.isIntersecting)) setHasNeared(true);\n },\n { rootMargin: PREFETCH_MARGIN }\n );\n observer.observe(element);\n return () => observer.disconnect();\n },\n [hasNeared]\n );\n return [ref, hasNeared];\n}\n","import {\n useCallback,\n useContext,\n type ComponentPropsWithRef,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport { sectionContent, type ViewContent } from '../content.ts';\nimport { DateFormattingContext } from '../date-formatting.ts';\nimport {\n AppViewResultsContext,\n assertAppFilters,\n type DeclaredView,\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';\nimport { useHasNearedViewport } from './useHasNearedViewport.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\ntype SectionProps<Data, Input> = Omit<\n DataSectionProps<Data, Input>,\n 'content'\n> &\n Omit<ReturnType<typeof sectionContent<Data, Input>>, 'view'>;\n\n/** Sections of views that `<DataApp>` runs share its results; every other section\n * requests its own view once it nears the viewport. */\nexport function DataSection<Data, Input>({\n content,\n ...presentation\n}: DataSectionProps<Data, Input>) {\n const app = useContext(AppViewResultsContext);\n const { view, ...section } = sectionContent(content);\n // Identity proves the shared result belongs to this content's declaration.\n const appResult = app?.results.get(view) as\n | ViewResult<Data, Input>\n | undefined;\n if (!appResult) {\n if (app) assertAppFilters(view, app.clientFilters);\n return <LazySection view={view} {...section} {...presentation} />;\n }\n // The app reports the primary view's request state for the whole page.\n if (view === app?.primaryView)\n return (\n <DataSectionBoundary\n {...section}\n {...presentation}\n result={appResult}\n notice=\"none\"\n />\n );\n return (\n <StandaloneSection {...section} {...presentation} result={appResult} />\n );\n}\n\n/** Requests its view only once the section nears the viewport,\n * so each widget's query runs when a reader can see it. */\nfunction LazySection<Data, Input>({\n view,\n ref,\n ...props\n}: SectionProps<Data, Input> & { view: DeclaredView<Data, Input> }) {\n const [observeViewport, hasNearedViewport] = useHasNearedViewport();\n const result = useDeclaredResult(view, { enabled: hasNearedViewport });\n const sectionRef = useCallback(\n (element: HTMLDivElement | null) => {\n assignRef(ref, element);\n const stopObserving = observeViewport(element);\n return () => {\n stopObserving?.();\n assignRef(ref, null);\n };\n },\n [ref, observeViewport]\n );\n return <StandaloneSection {...props} ref={sectionRef} result={result} />;\n}\n\n/** Reports its own request state inline and inspects its own queries. */\nfunction StandaloneSection<Data, Input>({\n result,\n ...props\n}: SectionProps<Data, Input> & { result: ViewResult<Data, Input> }) {\n const defaults = useInspectionDefaults();\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 <DataSectionBoundary {...props} result={result} notice=\"inline\" />\n </InspectionContext>\n </DateFormattingContext>\n );\n}\n\nfunction assignRef<Value>(ref: Ref<Value> | undefined, value: Value) {\n if (typeof ref === 'function') ref(value);\n else if (ref) ref.current = value;\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';\nimport { fixedUnitMilliseconds } from '@altertable/data-app/internal';\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 *\n (period.unit === 'hour'\n ? fixedUnitMilliseconds.HOUR\n : fixedUnitMilliseconds.DAY)\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 control 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 {\n getDataAppTransport,\n navigateNewTab,\n navigateNewWindowOrTab,\n} from '@altertable/data-app/client';\nimport { parseExternalUrl } from '@altertable/data-app/contract';\nimport {\n useEffect,\n useRef,\n useState,\n type ReactNode,\n type MouseEvent,\n} from 'react';\n\nexport type ExternalLinkProps = {\n href: string;\n children: ReactNode;\n className?: string;\n title?: string;\n};\n\n/** Open HTTPS links through the host when embedded, or a native new tab when standalone. */\nexport function ExternalLink({\n href,\n children,\n className,\n title,\n}: ExternalLinkProps) {\n const [error, setError] = useState(false);\n const [pending, setPending] = useState(false);\n const request = useRef<AbortController | undefined>(undefined);\n useEffect(() => () => request.current?.abort(), []);\n let url: string | undefined;\n try {\n url = parseExternalUrl(href);\n } catch {\n /* Invalid destinations are not clickable. */\n }\n function open(event: MouseEvent<HTMLAnchorElement>) {\n const transport = getDataAppTransport();\n if (!url || pending) {\n event.preventDefault();\n return;\n }\n if (!transport) return;\n event.preventDefault();\n if (request.current) return;\n const controller = new AbortController();\n request.current = controller;\n setPending(true);\n setError(false);\n const options = { signal: controller.signal };\n const navigation =\n event.shiftKey || event.metaKey || event.ctrlKey\n ? navigateNewWindowOrTab(url, event, options)\n : navigateNewTab(url, options);\n void navigation\n .catch(() => {\n if (!controller.signal.aborted) setError(true);\n })\n .finally(() => {\n if (request.current !== controller) return;\n request.current = undefined;\n setPending(false);\n });\n }\n return (\n <>\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={className}\n title={title}\n aria-disabled={!url || pending}\n aria-busy={pending || undefined}\n onClick={open}\n onAuxClick={event => {\n if (event.button === 1) open(event);\n }}\n >\n {children}\n </a>\n {(!url || error) && (\n <span role=\"alert\">\n {!url\n ? 'Invalid external link.'\n : 'Could not open this link. The host may not support external links.'}\n </span>\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":";;;;;;;;;;;;AAwFA,SAAgB,QAId,OAAgD;CAChD,MAAM,EAAE,eAAe,CAAC,GAAG,GAAG,aAA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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"}
|
|
@@ -175,12 +175,14 @@ type PresentStoryProps = {
|
|
|
175
175
|
theme?: ThemeController;
|
|
176
176
|
headerActions?: ReactNode;
|
|
177
177
|
footer?: ReactNode;
|
|
178
|
+
/** False renders only the presentation, which `?present=1&step=` opens. */
|
|
179
|
+
trigger?: boolean;
|
|
178
180
|
} & Omit<ComponentPropsWithRef<'button'>, 'title'>;
|
|
179
181
|
/**
|
|
180
182
|
* Uses an already loaded snapshot. Navigation is stored in `?present=1&step=`, and step
|
|
181
183
|
* inspection uses `?about=`. The presentation owns its modal structure.
|
|
182
184
|
*/
|
|
183
|
-
declare function PresentStory({ title, findings, empty, scope, dataContext, theme, headerActions, footer, children, className, onClick, disabled, ref, ...props }: PresentStoryProps): import("react").JSX.Element;
|
|
185
|
+
declare function PresentStory({ title, findings, empty, scope, dataContext, theme, headerActions, footer, trigger: showTrigger, children, className, onClick, disabled, ref, ...props }: PresentStoryProps): import("react").JSX.Element;
|
|
184
186
|
//#endregion
|
|
185
187
|
//#region src/ui/story.d.ts
|
|
186
188
|
/** One consequential, inspectable finding from the displayed result. */
|
|
@@ -542,7 +544,7 @@ type DataAppStyle = CSSProperties & Partial<Record<DataAppStyleToken, string | n
|
|
|
542
544
|
type DataAppStyleHooks = { [Name in keyof typeof dataAppStyleHooks]?: (typeof dataAppStyleHooks)[Name][number]; };
|
|
543
545
|
//#endregion
|
|
544
546
|
//#region src/mount.d.ts
|
|
545
|
-
/** Mount once per document;
|
|
547
|
+
/** Mount once per browser document; server imports do not mount. */
|
|
546
548
|
declare function mountDataApp<const Queries extends QueryDefinitions>({ app, component: Component, root }: {
|
|
547
549
|
app: DataAppDefinition<Queries>;
|
|
548
550
|
component: ComponentType;
|
|
@@ -577,9 +579,12 @@ type DataAppBaseProps = {
|
|
|
577
579
|
dataContext: DataContext;
|
|
578
580
|
/** Override the declared subtitle; null hides it. */
|
|
579
581
|
description?: ReactNode;
|
|
580
|
-
/** Show page actions. Defaults to true; does not hide filters or data states.
|
|
582
|
+
/** Show page actions. Defaults to true; does not hide filters or data states.
|
|
583
|
+
* Embedded surfaces have no toolbar: the host runs page actions through its bridge. */
|
|
581
584
|
showToolbar?: boolean;
|
|
585
|
+
/** Standalone toolbar controls; embedded surfaces omit them. */
|
|
582
586
|
toolbarActions?: ReactNode;
|
|
587
|
+
/** Standalone footer controls; embedded surfaces omit them. */
|
|
583
588
|
footerActions?: ReactNode;
|
|
584
589
|
/** Optional source, coverage, or methodology note below the app content.
|
|
585
590
|
* Compose prose and inline components; typography and spacing are provided.
|
|
@@ -597,6 +602,15 @@ type StaticDataAppProps = DataAppBaseProps & {
|
|
|
597
602
|
queries?: DisclosedQuery[];
|
|
598
603
|
};
|
|
599
604
|
//#endregion
|
|
605
|
+
//#region src/ui/Notice.d.ts
|
|
606
|
+
type NoticeProps = {
|
|
607
|
+
title: ReactNode;
|
|
608
|
+
description?: ReactNode;
|
|
609
|
+
action?: ReactNode;
|
|
610
|
+
} & Omit<ComponentPropsWithRef<'aside'>, 'title' | 'children'>;
|
|
611
|
+
/** Quiet contextual feedback with an optional action. Content wraps before its action on narrow containers. */
|
|
612
|
+
declare function Notice({ title, description, action, className, ...props }: NoticeProps): import("react").JSX.Element;
|
|
613
|
+
//#endregion
|
|
600
614
|
//#region src/ui/DataValue.d.ts
|
|
601
615
|
type DataValueProps<Value> = {
|
|
602
616
|
reading: DataReading<Value>;
|
|
@@ -809,6 +823,7 @@ type AppIconProps = Omit<LucideProps, 'size'> & {
|
|
|
809
823
|
name: AppIconName;
|
|
810
824
|
size?: number | string;
|
|
811
825
|
};
|
|
826
|
+
/** Defaults to the shared control icon size so icons follow density tokens. */
|
|
812
827
|
declare function AppIcon({ name, size, strokeWidth, style, ...props }: AppIconProps): import("react").FunctionComponentElement<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
813
828
|
//#endregion
|
|
814
829
|
//#region src/ui/Tooltip.d.ts
|
|
@@ -913,5 +928,5 @@ type DateTimeRangePickerProps = {
|
|
|
913
928
|
*/
|
|
914
929
|
declare function DateTimeRangePicker({ value, onChange, liveOption, comparison, isDefault, onReset, calendarFooter, className, placeholder, label, labelPlacement, maxRangeDays, policy, presets: configuredPresets, disabled }: DateTimeRangePickerProps): import("react").JSX.Element;
|
|
915
930
|
//#endregion
|
|
916
|
-
export {
|
|
931
|
+
export { TableWidgetSearch as $, TableIdentifier as $t, NoticeProps as A, DataContext as At, dateTimeRangePresets as B, AboutData as Bt, DataWidget as C, CsvTable as Ct, DataValue as D, ItemActions as Dt, MetricWidgetProps as E, ExplorationActionControlProps as Et, DateTimeRangeFilter as F, StoryFinding as Ft, DataAppStyleHooks as G, Sheet as Gt, DataAppProvider as H, AboutEmpty as Ht, DateTimeRangeFilterOptions as I, PresentStory as It, injectDataAppStyles as J, ButtonProps as Jt, DataAppStyleToken as K, SheetProps as Kt, DateTimeRangePreset$1 as L, PresentStoryProps as Lt, DataAppControlProps as M, GlossaryEntry as Mt, StaticDataAppProps as N, createDataContext as Nt, DataValueProps as O, EmptyContent as Ot, DateTimeRangeComparison as P, BoundStory as Pt, TableWidgetProps as Q, DataIdentifierDefinition as Qt, DateTimeRangeSelection as R, MetricDefinition as Rt, TextWidgetProps as S, CsvExport as St, MetricWidget as T, ExplorationActionControl as Tt, mountDataApp as U, AboutSubject as Ut, useAppFilters as V, AboutDataProps as Vt, DataAppStyle as W, AboutTab as Wt, TableWidget as X, MetricComparison as Xt, TableDisplayMode as Y, PressButton as Yt, TableWidgetColumn as Z, ColumnIdentifier as Zt, HelpPopoverProps as _, SearchTypeahead as _t, DateDisplay as a, matchSearchText as at, VisualizationWidgetView as b, SearchFieldProps as bt, SectionHeadingProps as c, DataTable as ct, TooltipProvider as d, DataTableProps as dt, defineDataIdentifiers as en, SearchAttribute as et, TooltipProviderProps as f, DataTableSearch as ft, HelpPopover as g, SearchSuggestion as gt, AppIconProps as h, DataTableTimestampProps as ht, useDateFormatting as i, SearchRange as it, DataAppBaseProps as j, EvidenceDeclaration as jt, Notice as k, AuthoringDataContext as kt, Tooltip as l, DataTableEmptyRow as lt, AppIconName as m, DataTableTimestamp as mt, DateTimeRangePickerProps as n, SearchItemsOptions as nt, DateDisplayProps as o, searchItems as ot, AppIcon as p, DataTableShare as pt, DataAppStylesOptions as q, Button$1 as qt, ControlLabelPlacement as r, SearchMatchValue as rt, SectionHeading as s, WidgetStatus as st, DateTimeRangePicker as t, SearchHit as tt, TooltipProps as u, DataTableEmptyRowProps as ut, VisualizationWidget as v, SearchTypeaheadProps as vt, DataWidgetProps as w, ExplorationAction as wt, TextWidget as x, CsvCell as xt, VisualizationWidgetProps as y, SearchField as yt, dateTimeRangeFilter as z, WidgetEvidence as zt };
|
|
917
932
|
//# sourceMappingURL=DateTimeRangePicker.d.ts.map
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as TableWidgetSearch, $t as TableIdentifier, A as NoticeProps, At as DataContext, Ct as CsvTable, Dt as ItemActions, E as MetricWidgetProps$1, F as DateTimeRangeFilter, Ft as StoryFinding, G as DataAppStyleHooks, J as injectDataAppStyles, Jt as ButtonProps, K as DataAppStyleToken, M as DataAppControlProps, Mt as GlossaryEntry, Nt as createDataContext, O as DataValueProps$1, Ot as EmptyContent, Q as TableWidgetProps$1, Qt as DataIdentifierDefinition, Rt as MetricDefinition, S as TextWidgetProps$1, U as mountDataApp, W as DataAppStyle, Xt as MetricComparison, Y as TableDisplayMode, Z as TableWidgetColumn, Zt as ColumnIdentifier, _ as HelpPopoverProps, a as DateDisplay, b as VisualizationWidgetView$1, c as SectionHeadingProps, d as TooltipProvider, en as defineDataIdentifiers, f as TooltipProviderProps, gt as SearchSuggestion, i as useDateFormatting, j as DataAppBaseProps, jt as EvidenceDeclaration, k as Notice, kt as AuthoringDataContext, l as Tooltip, m as AppIconName, n as DateTimeRangePickerProps, o as DateDisplayProps, q as DataAppStylesOptions, qt as Button, s as SectionHeading, t as DateTimeRangePicker, u as TooltipProps, xt as CsvCell, y as VisualizationWidgetProps$1, zt as WidgetEvidence } from "./chunks/DateTimeRangePicker.js";
|
|
2
2
|
import { DataClient, InputOf, OutputOf } from "@altertable/data-app/client";
|
|
3
3
|
import { ChoiceFilter, DataReading, DataView, DisplayedSnapshot, FilterCollection, FilterInput, FilterValues, IsUnion, MetricReading, MetricValues, MetricValues as MetricValues$1 } from "@altertable/data-app/internal";
|
|
4
4
|
import { ComponentPropsWithRef, ReactNode, Ref, RefObject } from "react";
|
|
@@ -744,5 +744,5 @@ export declare function AnnotationBar({ ref, annotations, active, theme, disable
|
|
|
744
744
|
/** Install only the outer-frame annotation controls; leave host page typography and layout intact. */
|
|
745
745
|
export declare function injectDataAppAnnotationStyles(options?: DataAppStylesOptions): HTMLStyleElement;
|
|
746
746
|
//#endregion
|
|
747
|
-
export { type ActionBuilder, type AnnotationBarHandle, type AnnotationBarProps, type AnnotationTargetProps, type BreakdownItem, type BreakdownProps, Button, type ButtonProps, type ColumnIdentifier, type ComparisonProps, type CsvCell, type DataAppProps, type DataAppStyle, type DataAppStyleHooks, type DataAppStyleToken, type DataAppStylesOptions, type DataAppView, type DataContext, type DataIdentifierDefinition, type DataSectionProps, type DataValueProps, type Dataset, type DatasetColumn, type DatasetDeclaration as DatasetDefinition, type DatasetSuggestionOptions, DateDisplay, type DateDisplayProps, DateTimeRangePicker, type DateTimeRangePickerProps, type DateTimeTooltipProps, type DetailAction, type DetailViewDefinition, type EmptyStateProps, type ExternalLinkProps, type GlossaryEntry, type GridItemProps, type GridProps, type IconButtonProps, type MetricDefinition, type MetricRecords, type MetricValues, type MetricWidgetProps, type PeriodComparison, type PeriodSummaryProps, type RankingItem, type RankingProps, type ReportingPeriod, SectionHeading, type SectionHeadingProps, type SkeletonProps, type StackProps, type TableIdentifier, type TableWidgetProps, type TableWidgetSearch, type TextContentProps, type TextWidgetProps, Tooltip, type TooltipProps, TooltipProvider, type TooltipProviderProps, type UpdatedAtProps, type ViewSource, type VisualizationWidgetProps, type VisualizationWidgetView, type WidgetEvidence, createDataContext, defineDataIdentifiers, injectDataAppStyles, mountDataApp, useDateFormatting };
|
|
747
|
+
export { type ActionBuilder, type AnnotationBarHandle, type AnnotationBarProps, type AnnotationTargetProps, type BreakdownItem, type BreakdownProps, Button, type ButtonProps, type ColumnIdentifier, type ComparisonProps, type CsvCell, type DataAppProps, type DataAppStyle, type DataAppStyleHooks, type DataAppStyleToken, type DataAppStylesOptions, type DataAppView, type DataContext, type DataIdentifierDefinition, type DataSectionProps, type DataValueProps, type Dataset, type DatasetColumn, type DatasetDeclaration as DatasetDefinition, type DatasetSuggestionOptions, DateDisplay, type DateDisplayProps, DateTimeRangePicker, type DateTimeRangePickerProps, type DateTimeTooltipProps, type DetailAction, type DetailViewDefinition, type EmptyStateProps, type ExternalLinkProps, type GlossaryEntry, type GridItemProps, type GridProps, type IconButtonProps, type MetricDefinition, type MetricRecords, type MetricValues, type MetricWidgetProps, Notice, type NoticeProps, type PeriodComparison, type PeriodSummaryProps, type RankingItem, type RankingProps, type ReportingPeriod, SectionHeading, type SectionHeadingProps, type SkeletonProps, type StackProps, type TableIdentifier, type TableWidgetProps, type TableWidgetSearch, type TextContentProps, type TextWidgetProps, Tooltip, type TooltipProps, TooltipProvider, type TooltipProviderProps, type UpdatedAtProps, type ViewSource, type VisualizationWidgetProps, type VisualizationWidgetView, type WidgetEvidence, createDataContext, defineDataIdentifiers, injectDataAppStyles, mountDataApp, useDateFormatting };
|
|
748
748
|
//# sourceMappingURL=index.d.ts.map
|