@altertable/data-app 0.61.0 → 0.63.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/AGENTS.md +4 -32
- package/CONTRIBUTING.md +63 -72
- package/README.md +14 -38
- package/dist/chunks/{contract-d9skd1n7.js → contract-8wdybxj7.js} +163 -16
- package/dist/chunks/contract-8wdybxj7.js.map +13 -0
- package/dist/chunks/{contract-ryyf6dme.js → contract-cxr9t12b.js} +2 -5
- package/dist/chunks/contract-cxr9t12b.js.map +10 -0
- package/dist/chunks/{contract-14vxdcrs.js → contract-farfe948.js} +17 -21
- package/dist/chunks/contract-farfe948.js.map +10 -0
- package/dist/chunks/contract-mev09s5v.js.map +2 -2
- package/dist/chunks/{contract-ehk50k7e.js → contract-tf8c3qpv.js} +34 -4
- package/dist/chunks/contract-tf8c3qpv.js.map +11 -0
- package/dist/chunks/{contract-zr4s2g7m.js → contract-tkc552ze.js} +75 -36
- package/dist/chunks/contract-tkc552ze.js.map +12 -0
- package/dist/chunks/{contract-nt819swq.js → contract-wd8qe3mt.js} +6 -1
- package/dist/chunks/{contract-nt819swq.js.map → contract-wd8qe3mt.js.map} +3 -3
- package/dist/chunks/contract-wz59z8pq.js.map +1 -1
- package/dist/chunks/{contract-7gpsee0v.js → contract-zr3jd7mr.js} +51 -22
- package/dist/chunks/contract-zr3jd7mr.js.map +12 -0
- package/dist/client/index.js +7 -6
- package/dist/client/index.js.map +1 -1
- package/dist/core/appearance.js +1 -1
- package/dist/core/contract.js +6 -4
- package/dist/core/contract.js.map +1 -1
- package/dist/embed/index.js +41 -9
- package/dist/embed/index.js.map +5 -4
- package/dist/local.js +172 -84
- package/dist/local.js.map +7 -8
- package/dist/react/embed/index.js +83 -99
- package/dist/react/embed/index.js.map +4 -5
- package/dist/react/index.js +5701 -324
- package/dist/react/index.js.map +74 -65
- package/dist/server.js +153 -81
- package/dist/server.js.map +6 -7
- package/dist/types/client/data-client.d.ts +33 -0
- package/dist/types/client/iframe.d.ts +14 -0
- package/dist/types/client/index.d.ts +4 -34
- package/dist/types/client/location.d.ts +4 -6
- package/dist/types/client/navigation.d.ts +2 -1
- package/dist/types/core/appearance.d.ts +7 -6
- package/dist/types/core/bridge.d.ts +2 -8
- package/dist/types/core/config.d.ts +1 -1
- package/dist/types/core/contract.d.ts +9 -56
- package/dist/types/core/format.d.ts +0 -1
- package/dist/types/core/messages.d.ts +11 -30
- package/dist/types/core/navigation.d.ts +11 -0
- package/dist/types/core/operation-types.d.ts +76 -0
- package/dist/types/core/operation.d.ts +21 -0
- package/dist/types/core/presentation.d.ts +7 -0
- package/dist/types/core/variables.d.ts +2 -2
- package/dist/types/embed/bridge.d.ts +12 -0
- package/dist/types/embed/host.d.ts +14 -5
- package/dist/types/embed/index.d.ts +6 -4
- package/dist/types/embed/source.d.ts +15 -0
- package/dist/types/embed/sql.d.ts +4 -0
- package/dist/types/react/content.d.ts +3 -3
- package/dist/types/react/embed/bridge.d.ts +19 -10
- package/dist/types/react/embed/index.d.ts +0 -2
- package/dist/types/react/hooks.d.ts +65 -64
- package/dist/types/react/index.d.ts +135 -2
- package/dist/types/react/injectStyles.d.ts +7 -0
- package/dist/types/react/shellStyles.d.ts +3 -0
- package/dist/types/react/styles.d.ts +8 -0
- package/dist/types/react/ui/AboutData.d.ts +0 -1
- package/dist/types/react/ui/AppFooter.d.ts +0 -1
- package/dist/types/react/ui/AppHeader.d.ts +0 -1
- package/dist/types/react/ui/AppLayout.d.ts +0 -1
- package/dist/types/react/ui/AppScope.d.ts +0 -1
- package/dist/types/react/ui/AppToolbar.d.ts +0 -1
- package/dist/types/react/ui/Breakdown.d.ts +0 -1
- package/dist/types/react/ui/Button.d.ts +0 -1
- package/dist/types/react/ui/Checkbox.d.ts +0 -1
- package/dist/types/react/ui/Combobox.d.ts +0 -1
- package/dist/types/react/ui/ComparisonVisual.d.ts +0 -1
- package/dist/types/react/ui/ContentSkeleton.d.ts +2 -5
- package/dist/types/react/ui/DataApp.d.ts +2 -2
- package/dist/types/react/ui/DataAppSkeleton.d.ts +7 -0
- package/dist/types/react/ui/DataBoundary.d.ts +0 -1
- package/dist/types/react/ui/DataSection.d.ts +2 -4
- package/dist/types/react/ui/DataTable.d.ts +2 -3
- package/dist/types/react/ui/DataViewToast.d.ts +0 -1
- package/dist/types/react/ui/DataWidget.d.ts +4 -14
- package/dist/types/react/ui/DateRangePicker.d.ts +0 -1
- package/dist/types/react/ui/DateTimeTooltip.d.ts +0 -1
- package/dist/types/react/ui/EmptyState.d.ts +2 -5
- package/dist/types/react/ui/GettingStarted.d.ts +0 -1
- package/dist/types/react/ui/GlossaryDefinition.d.ts +0 -1
- package/dist/types/react/ui/GlossaryExplanation.d.ts +0 -1
- package/dist/types/react/ui/GradientScroll.d.ts +0 -1
- package/dist/types/react/ui/Grid.d.ts +0 -1
- package/dist/types/react/ui/HelpPopover.d.ts +0 -2
- package/dist/types/react/ui/Kbd.d.ts +0 -1
- package/dist/types/react/ui/LiveControl.d.ts +0 -1
- package/dist/types/react/ui/MetricWidget.d.ts +0 -2
- package/dist/types/react/ui/PeriodSummary.d.ts +0 -1
- package/dist/types/react/ui/PresentStory.d.ts +0 -1
- package/dist/types/react/ui/QueryList.d.ts +0 -1
- package/dist/types/react/ui/Ranking.d.ts +0 -1
- package/dist/types/react/ui/RefreshControl.d.ts +0 -1
- package/dist/types/react/ui/RefreshRegion.d.ts +0 -1
- package/dist/types/react/ui/RequestHint.d.ts +0 -1
- package/dist/types/react/ui/SearchField.d.ts +0 -1
- package/dist/types/react/ui/SearchInput.d.ts +1 -2
- package/dist/types/react/ui/SearchMatch.d.ts +0 -1
- package/dist/types/react/ui/SelectableBarChart.d.ts +0 -1
- package/dist/types/react/ui/SelectionMark.d.ts +0 -1
- package/dist/types/react/ui/Sheet.d.ts +0 -1
- package/dist/types/react/ui/Skeleton.d.ts +0 -1
- package/dist/types/react/ui/Stack.d.ts +0 -1
- package/dist/types/react/ui/StatusPanel.d.ts +0 -1
- package/dist/types/react/ui/TableWidget.d.ts +2 -3
- package/dist/types/react/ui/Tabs.d.ts +0 -1
- package/dist/types/react/ui/TextContent.d.ts +4 -0
- package/dist/types/react/ui/TextWidget.d.ts +19 -0
- package/dist/types/react/ui/ThemeSelector.d.ts +0 -1
- package/dist/types/react/ui/Tooltip.d.ts +0 -1
- package/dist/types/react/ui/UpdatedAt.d.ts +0 -1
- package/dist/types/react/ui/VariableBar.d.ts +0 -1
- package/dist/types/react/ui/VisualizationWidget.d.ts +5 -13
- package/dist/types/react/ui/WidgetDisclosure.d.ts +0 -1
- package/dist/types/react/ui/WidgetViewTabs.d.ts +2 -3
- package/dist/types/react/ui/data-identifiers.d.ts +0 -1
- package/dist/types/react/ui/presentation.d.ts +19 -0
- package/dist/types/react/ui/useAppAppearance.d.ts +3 -0
- package/dist/types/react/ui/useDataAppPresentation.d.ts +3 -0
- package/dist/types/react/view-controls.d.ts +2 -2
- package/dist/types/react/view.d.ts +2 -2
- package/dist/{bootstrap.js → worker.js} +144 -12
- package/docs/app-authoring.md +60 -24
- package/docs/client.md +48 -19
- package/docs/contract.md +10 -10
- package/docs/embed.md +94 -26
- package/docs/hosted-apps.md +39 -0
- package/docs/local-data-apps.md +14 -0
- package/docs/react-embed.md +75 -24
- package/docs/react.md +118 -93
- package/docs/server-bun.md +4 -1
- package/docs/server.md +2 -2
- package/docs/worker.md +55 -0
- package/examples/starter-data-app/index.tsx +159 -0
- package/package.json +18 -12
- package/dist/chunks/contract-14vxdcrs.js.map +0 -10
- package/dist/chunks/contract-7gpsee0v.js.map +0 -11
- package/dist/chunks/contract-d9skd1n7.js.map +0 -12
- package/dist/chunks/contract-ehk50k7e.js.map +0 -10
- package/dist/chunks/contract-ryyf6dme.js.map +0 -10
- package/dist/chunks/contract-zr4s2g7m.js.map +0 -12
- package/dist/react/index.css +0 -4478
- package/dist/react.css.d.ts +0 -1
- package/dist/types/embed/shell.d.ts +0 -21
- package/dist/types/embed/standalone.d.ts +0 -1
- package/dist/types/react/embed/shell.d.ts +0 -10
- package/dist/types/react/ui/index.d.ts +0 -129
- package/docs/appearance.md +0 -30
- package/docs/bootstrap.md +0 -76
- package/docs/config.md +0 -21
- package/docs/format.md +0 -29
- package/docs/react-styles.md +0 -17
- package/docs/starter-agent-instructions.md +0 -53
package/dist/react.css.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { MessageDispatcher } from '../core/messages.js';
|
|
2
|
-
import { type DataAppStatus, type DataAppDiagnostic } from './host.js';
|
|
3
|
-
export type DataAppSource = {
|
|
4
|
-
type: 'url';
|
|
5
|
-
url: string;
|
|
6
|
-
} | {
|
|
7
|
-
type: 'bundle';
|
|
8
|
-
bootstrapUrl: string;
|
|
9
|
-
javascript: string;
|
|
10
|
-
revision: string;
|
|
11
|
-
};
|
|
12
|
-
export type DataAppShellOptions = {
|
|
13
|
-
iframe: HTMLIFrameElement;
|
|
14
|
-
source: DataAppSource;
|
|
15
|
-
onMessage: MessageDispatcher;
|
|
16
|
-
onStatusChange?: (status: DataAppStatus) => void;
|
|
17
|
-
onDiagnostic?: (event: DataAppDiagnostic) => void;
|
|
18
|
-
startupTimeoutMs?: number;
|
|
19
|
-
};
|
|
20
|
-
/** Owns loading and sandbox policy. Dispose before replacing the source or retrying. */
|
|
21
|
-
export declare function attachDataAppShell({ iframe, source, onMessage, onStatusChange, onDiagnostic, startupTimeoutMs, }: DataAppShellOptions): () => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
import { type DataAppSource, type DataAppShellOptions } from '../../embed/shell.js';
|
|
3
|
-
export type DataAppShellProps = Pick<DataAppShellOptions, 'onMessage' | 'onStatusChange' | 'onDiagnostic' | 'startupTimeoutMs'> & {
|
|
4
|
-
source: DataAppSource;
|
|
5
|
-
title: string;
|
|
6
|
-
loading?: ReactNode;
|
|
7
|
-
renderError?: (retry: () => void) => ReactNode;
|
|
8
|
-
};
|
|
9
|
-
/** Source changes and retries replace the entire frame; handler changes retain its session. */
|
|
10
|
-
export declare function DataAppShell({ source, title, onMessage, onStatusChange, onDiagnostic, startupTimeoutMs, loading, renderError, }: DataAppShellProps): import("react").JSX.Element;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export { DataApp } from './DataApp.js';
|
|
3
|
-
export type { DataAppProps, DataAppRequest } from './DataApp.js';
|
|
4
|
-
export { GettingStarted } from './GettingStarted.js';
|
|
5
|
-
export { AppLayout } from './AppLayout.js';
|
|
6
|
-
export type { AppLayoutProps } from './AppLayout.js';
|
|
7
|
-
export { AppHeader } from './AppHeader.js';
|
|
8
|
-
export type { AppHeaderProps } from './AppHeader.js';
|
|
9
|
-
export { AppScope } from './AppScope.js';
|
|
10
|
-
export type { AppScopeProps } from './AppScope.js';
|
|
11
|
-
export { AppToolbar } from './AppToolbar.js';
|
|
12
|
-
export type { AppToolbarProps } from './AppToolbar.js';
|
|
13
|
-
export { VariableBar } from './VariableBar.js';
|
|
14
|
-
export type { VariableBarProps } from './VariableBar.js';
|
|
15
|
-
export { AppFooter } from './AppFooter.js';
|
|
16
|
-
export type { AppFooterProps } from './AppFooter.js';
|
|
17
|
-
export { ThemeSelector, ThemeToggle } from './ThemeSelector.js';
|
|
18
|
-
export type { ThemeSelectorProps } from './ThemeSelector.js';
|
|
19
|
-
export { Stack } from './Stack.js';
|
|
20
|
-
export type { StackProps } from './Stack.js';
|
|
21
|
-
export { Grid } from './Grid.js';
|
|
22
|
-
export type { GridProps } from './Grid.js';
|
|
23
|
-
export { GridItem } from './GridItem.js';
|
|
24
|
-
export type { GridItemProps } from './GridItem.js';
|
|
25
|
-
export type { WidgetEvidence } from './WidgetEvidence.js';
|
|
26
|
-
export { DataWidget } from './DataWidget.js';
|
|
27
|
-
export type { WidgetStatus } from './RequestHint.js';
|
|
28
|
-
export type { DataWidgetProps } from './DataWidget.js';
|
|
29
|
-
export { VisualizationWidget } from './VisualizationWidget.js';
|
|
30
|
-
export type { VisualizationWidgetProps, VisualizationWidgetView, } from './VisualizationWidget.js';
|
|
31
|
-
export { TableWidget } from './TableWidget.js';
|
|
32
|
-
export type { TableWidgetColumn, TableWidgetProps, TableWidgetSearch, } from './TableWidget.js';
|
|
33
|
-
export { chartColor } from './chartColor.js';
|
|
34
|
-
export { Breakdown } from './Breakdown.js';
|
|
35
|
-
export type { BreakdownItem, BreakdownProps } from './Breakdown.js';
|
|
36
|
-
export { Ranking } from './Ranking.js';
|
|
37
|
-
export type { RankingItem, RankingProps } from './Ranking.js';
|
|
38
|
-
export { WidgetDisclosure } from './WidgetDisclosure.js';
|
|
39
|
-
export type { WidgetDisclosureProps } from './WidgetDisclosure.js';
|
|
40
|
-
export { WidgetViewTabs } from './WidgetViewTabs.js';
|
|
41
|
-
export type { WidgetView, WidgetViewTabsProps, } from './WidgetViewTabs.js';
|
|
42
|
-
export { ComparisonVisual } from './ComparisonVisual.js';
|
|
43
|
-
export type { ComparisonVisualProps } from './ComparisonVisual.js';
|
|
44
|
-
export { calendarMetricComparison } from './comparison.js';
|
|
45
|
-
export type { MetricComparison } from './comparison.js';
|
|
46
|
-
export { DataTable, DataTableEmptyRow, DataTableTimestamp, DataTableShare, } from './DataTable.js';
|
|
47
|
-
export type { DataTableProps, DataTableSearch, DataTableEmptyRowProps, DataTableTimestampProps, } from './DataTable.js';
|
|
48
|
-
export { MetricWidget } from './MetricWidget.js';
|
|
49
|
-
export type { MetricWidgetProps } from './MetricWidget.js';
|
|
50
|
-
export { SelectableBarChart } from './SelectableBarChart.js';
|
|
51
|
-
export type { SelectableBarChartProps, SelectableBarItem, } from './SelectableBarChart.js';
|
|
52
|
-
export { DimensionPicker } from './DimensionPicker.js';
|
|
53
|
-
export { dimensionFilter, parseDimensionSelection, parseFacetOptions, dimensionPredicate, } from '../../core/dimension.js';
|
|
54
|
-
export type { DimensionSelection, DimensionMember, DimensionOption, DimensionVariable, DimensionFilterOptions, } from '../../core/dimension.js';
|
|
55
|
-
export { EmptyState } from './EmptyState.js';
|
|
56
|
-
export type { EmptyStateProps } from './EmptyState.js';
|
|
57
|
-
export { Skeleton } from './Skeleton.js';
|
|
58
|
-
export type { SkeletonProps } from './Skeleton.js';
|
|
59
|
-
export { DataBoundary } from './DataBoundary.js';
|
|
60
|
-
export { resolveDataView } from '../../core/data-view.js';
|
|
61
|
-
export { displayedSnapshot } from '../../core/data-view.js';
|
|
62
|
-
export type { DataView, DataSnapshot, DisplayedSnapshot, } from '../../core/data-view.js';
|
|
63
|
-
export type { DataBoundaryProps } from './DataBoundary.js';
|
|
64
|
-
export { RefreshRegion } from './RefreshRegion.js';
|
|
65
|
-
export type { RefreshRegionProps } from './RefreshRegion.js';
|
|
66
|
-
export { DataSection } from './DataSection.js';
|
|
67
|
-
export type { DataSectionProps, SectionResult, } from './DataSection.js';
|
|
68
|
-
export { StatusPanel } from './StatusPanel.js';
|
|
69
|
-
export type { StatusPanelProps } from './StatusPanel.js';
|
|
70
|
-
export { ContentSkeleton } from './ContentSkeleton.js';
|
|
71
|
-
export type { ContentSkeletonProps } from './ContentSkeleton.js';
|
|
72
|
-
export { DataViewToast } from './DataViewToast.js';
|
|
73
|
-
export type { DataViewToastProps } from './DataViewToast.js';
|
|
74
|
-
export { UpdatedAt } from './UpdatedAt.js';
|
|
75
|
-
export type { UpdatedAtProps } from './UpdatedAt.js';
|
|
76
|
-
export { DateTimeTooltip } from './DateTimeTooltip.js';
|
|
77
|
-
export type { DateTimeTooltipProps } from './DateTimeTooltip.js';
|
|
78
|
-
export { LiveControl } from './LiveControl.js';
|
|
79
|
-
export type { LiveControlProps, LiveIntervalSeconds, } from './LiveControl.js';
|
|
80
|
-
export { DateRangePicker } from './DateRangePicker.js';
|
|
81
|
-
export type { DatePresetId, DateRange, DateRangePickerProps, } from './DateRangePicker.js';
|
|
82
|
-
export { defineAppVariables, textVariable, selectVariable, dateRangeVariable, dateRangeControl, useAppVariables, } from './variables.js';
|
|
83
|
-
export type { AppVariable, AppVariableValues, DateRangeSelection, DateRangeVariable, DateRangeVariableOptions, } from './variables.js';
|
|
84
|
-
export { PeriodSummary } from './PeriodSummary.js';
|
|
85
|
-
export type { ReportingPeriod, PeriodComparison, PeriodSummaryProps, } from './PeriodSummary.js';
|
|
86
|
-
export { SearchField } from './SearchField.js';
|
|
87
|
-
export type { SearchFieldProps } from './SearchField.js';
|
|
88
|
-
export { searchItems } from './searchItems.js';
|
|
89
|
-
export type { SearchAttribute, SearchHit, SearchItemsOptions, SearchMatchValue, SearchRange, } from './searchItems.js';
|
|
90
|
-
export { SearchMatch } from './SearchMatch.js';
|
|
91
|
-
export type { SearchMatchProps } from './SearchMatch.js';
|
|
92
|
-
export { Combobox } from './Combobox.js';
|
|
93
|
-
export type { ComboboxOption, ComboboxProps } from './Combobox.js';
|
|
94
|
-
export { GradientScroll } from './GradientScroll.js';
|
|
95
|
-
export type { GradientScrollProps } from './GradientScroll.js';
|
|
96
|
-
export { searchParams, slug, subscribeSearch, writeSearch, } from './search.js';
|
|
97
|
-
export { Tabs, TabList, Tab, TabPanels, TabPanel, useViewTab, } from './Tabs.js';
|
|
98
|
-
export { createDataContext, defineDataContext, evidenceFor, } from './data-context.js';
|
|
99
|
-
export type { DataContext, GlossaryEntry } from './data-context.js';
|
|
100
|
-
export { defineDataIdentifiers } from './data-identifiers.js';
|
|
101
|
-
export type { DataIdentifierDefinition, TableIdentifier, ColumnIdentifier, } from './data-identifiers.js';
|
|
102
|
-
export type { DisclosedQuery } from '../../core/contract.js';
|
|
103
|
-
export { GlossaryExplanation } from './GlossaryExplanation.js';
|
|
104
|
-
export type { GlossaryExplanationProps } from './GlossaryExplanation.js';
|
|
105
|
-
export { GlossaryDefinition } from './GlossaryDefinition.js';
|
|
106
|
-
export type { GlossaryDefinitionProps } from './GlossaryDefinition.js';
|
|
107
|
-
export { AboutData } from './AboutData.js';
|
|
108
|
-
export type { AboutDataProps, AboutEmpty, AboutSubject, AboutTab, } from './AboutData.js';
|
|
109
|
-
export { PresentStory } from './PresentStory.js';
|
|
110
|
-
export type { PresentStoryProps } from './PresentStory.js';
|
|
111
|
-
export type { StoryFinding, BoundStory } from './story.js';
|
|
112
|
-
export { Checkbox } from './Checkbox.js';
|
|
113
|
-
export type { CheckboxProps } from './Checkbox.js';
|
|
114
|
-
export { AppIcon } from './icons.js';
|
|
115
|
-
export type { AppIconName, AppIconProps } from './icons.js';
|
|
116
|
-
export { IconButton } from './IconButton.js';
|
|
117
|
-
export type { IconButtonProps } from './IconButton.js';
|
|
118
|
-
export { Kbd } from './Kbd.js';
|
|
119
|
-
export type { KbdProps } from './Kbd.js';
|
|
120
|
-
export { Sheet } from './Sheet.js';
|
|
121
|
-
export type { SheetDialogProps, SheetProps } from './Sheet.js';
|
|
122
|
-
export { Tooltip, TooltipProvider } from './Tooltip.js';
|
|
123
|
-
export type { TooltipProps, TooltipProviderProps, } from './Tooltip.js';
|
|
124
|
-
export { Button } from './Button.js';
|
|
125
|
-
export type { ButtonProps } from './Button.js';
|
|
126
|
-
export { HelpPopover } from './HelpPopover.js';
|
|
127
|
-
export type { HelpPopoverPanelProps, HelpPopoverProps, HelpPopoverTriggerProps, } from './HelpPopover.js';
|
|
128
|
-
export type { MetricDefinition } from './metric.js';
|
|
129
|
-
export type { DataReading, MetricReading, MetricValues, } from '../../core/reading.js';
|
package/docs/appearance.md
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Appearance
|
|
2
|
-
|
|
3
|
-
Import `parseAppearance`, `applyAppearance`, and `createThemeController` from
|
|
4
|
-
`@altertable/data-app/appearance`. Parsing is safe on the server; applying tokens
|
|
5
|
-
and controlling theme require a browser document.
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
import { parseAppearance } from '@altertable/data-app/appearance';
|
|
9
|
-
|
|
10
|
-
const appearance = parseAppearance({
|
|
11
|
-
mode: 'system',
|
|
12
|
-
accentColor: '#405d47',
|
|
13
|
-
density: 'comfortable',
|
|
14
|
-
});
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
`parseAppearance` fills omitted settings with defaults and rejects unknown keys
|
|
18
|
-
or invalid values. Settings include light/dark/system mode, neutral/slate/warm
|
|
19
|
-
base colors, accent colors, a chart palette, density, corner radius, elevation,
|
|
20
|
-
and body/heading typography. Colors are six-digit hexadecimal values.
|
|
21
|
-
|
|
22
|
-
`applyAppearance(appearance)` installs semantic CSS tokens on the document root
|
|
23
|
-
and returns a cleanup function for system-theme listening.
|
|
24
|
-
`createThemeController(appearance)` applies the initial theme and provides
|
|
25
|
-
`getMode`, `setMode`, and `subscribe`. Viewer mode persists in local storage
|
|
26
|
-
independently of app-authored brand settings. Storage failures do not prevent
|
|
27
|
-
the selection from applying to the current page.
|
|
28
|
-
|
|
29
|
-
The React `DataApp` shell manages appearance for normal app usage. See
|
|
30
|
-
[configuration](config.md), [React](react.md), and [styles](react-styles.md).
|
package/docs/bootstrap.md
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# Standalone bootstrap
|
|
2
|
-
|
|
3
|
-
`@altertable/data-app/bootstrap` resolves to a self-contained classic browser
|
|
4
|
-
script. It has no imports, React dependencies, or app navigation behavior. The
|
|
5
|
-
package builds it once; a backend can embed the published file without running a
|
|
6
|
-
bundler.
|
|
7
|
-
|
|
8
|
-
This entry is a script asset, not a module API. Resolve and read it on the server;
|
|
9
|
-
do not import it for execution in Node.js or Bun. For a bootstrap you bundle
|
|
10
|
-
yourself, use `startDataAppBootstrap` from [embedding](embed.md).
|
|
11
|
-
|
|
12
|
-
## Generate the backend HTML
|
|
13
|
-
|
|
14
|
-
Install an exact package version in the backend runtime's `package.json`, commit
|
|
15
|
-
the lockfile, and run this generation step before building or deploying the worker:
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
// scripts/build-runtime.mjs
|
|
19
|
-
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
20
|
-
|
|
21
|
-
const parentOrigin = 'https://app.altertable.ai';
|
|
22
|
-
const path = import.meta.resolve('@altertable/data-app/bootstrap');
|
|
23
|
-
const javascript = await readFile(new URL(path), 'utf8');
|
|
24
|
-
const inline = javascript.replace(/<\/script/gi, '<\\/script');
|
|
25
|
-
const originAttribute = parentOrigin
|
|
26
|
-
.replaceAll('&', '&')
|
|
27
|
-
.replaceAll('"', '"')
|
|
28
|
-
.replaceAll('<', '<')
|
|
29
|
-
.replaceAll('>', '>');
|
|
30
|
-
|
|
31
|
-
const html = `<!doctype html>
|
|
32
|
-
<html>
|
|
33
|
-
<head>
|
|
34
|
-
<meta charset="utf-8">
|
|
35
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
36
|
-
</head>
|
|
37
|
-
<body>
|
|
38
|
-
<div id="root"></div>
|
|
39
|
-
<script data-parent-origin="${originAttribute}">${inline}</script>
|
|
40
|
-
</body>
|
|
41
|
-
</html>`;
|
|
42
|
-
|
|
43
|
-
await mkdir('generated', { recursive: true });
|
|
44
|
-
await writeFile(
|
|
45
|
-
'generated/runtime-html.js',
|
|
46
|
-
`export const RUNTIME_HTML = ${JSON.stringify(html)};\n`
|
|
47
|
-
);
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
```fish
|
|
51
|
-
node scripts/build-runtime.mjs
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
The worker imports `RUNTIME_HTML` and serves it as `text/html; charset=utf-8`.
|
|
55
|
-
The resulting HTML needs no package imports or network fetches at runtime.
|
|
56
|
-
|
|
57
|
-
## Configuration and security
|
|
58
|
-
|
|
59
|
-
Use a regular inline `<script>` with `data-parent-origin` on that same element,
|
|
60
|
-
after the app's mount element. The script reads `document.currentScript` and
|
|
61
|
-
starts immediately. Do not use `type="module"`.
|
|
62
|
-
|
|
63
|
-
The hosting service must supply an exact trusted origin, such as
|
|
64
|
-
`https://app.altertable.ai`, through deployment configuration. Missing or invalid
|
|
65
|
-
origins fail before installing a transport. Do not derive this value from an
|
|
66
|
-
unverified query parameter, referrer, or incoming message.
|
|
67
|
-
|
|
68
|
-
Serve the HTML with the [bootstrap CSP](embed.md#trusted-bootstrap), including a
|
|
69
|
-
`frame-ancestors` header restricted to the trusted host. The script installs the
|
|
70
|
-
authenticated transport, retains opaque host state, evaluates the app bundle
|
|
71
|
-
sent by the host, and reports readiness or failure. The app attaches its own
|
|
72
|
-
navigation adapter. Backend authorization still applies to every data request.
|
|
73
|
-
|
|
74
|
-
Upgrade the host package and bootstrap artifact together when changing the bridge
|
|
75
|
-
protocol. See [client navigation](client.md#app-navigation) and
|
|
76
|
-
[embedding](embed.md) for the communication boundaries.
|
package/docs/config.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# App configuration
|
|
2
|
-
|
|
3
|
-
Import `DataAppConfig` and `dataAppTitle` from `@altertable/data-app/config`.
|
|
4
|
-
Configuration is shared by the app shell and browser mounting code.
|
|
5
|
-
|
|
6
|
-
```ts
|
|
7
|
-
import type { DataAppConfig } from '@altertable/data-app/config';
|
|
8
|
-
|
|
9
|
-
export const config = {
|
|
10
|
-
title: 'Activity',
|
|
11
|
-
scope: { organization: 'example', environment: 'production' },
|
|
12
|
-
appearance: {},
|
|
13
|
-
} satisfies DataAppConfig;
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
`title` names the exploration. `scope` identifies its organization and
|
|
17
|
-
environment for display; it does not grant access to data.
|
|
18
|
-
`appearance` is validated by the [appearance APIs](appearance.md).
|
|
19
|
-
|
|
20
|
-
`dataAppTitle(config)` produces a document title containing the app title and
|
|
21
|
-
scope. [React mounting](react.md) applies it automatically.
|
package/docs/format.md
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Formatting
|
|
2
|
-
|
|
3
|
-
Import number and date helpers from `@altertable/data-app/format`. They use
|
|
4
|
-
JavaScript `Intl` APIs and can run in the browser or on the server.
|
|
5
|
-
|
|
6
|
-
```ts
|
|
7
|
-
import {
|
|
8
|
-
formatCount,
|
|
9
|
-
formatDateRange,
|
|
10
|
-
formatNumber,
|
|
11
|
-
formatPercent,
|
|
12
|
-
} from '@altertable/data-app/format';
|
|
13
|
-
|
|
14
|
-
formatCount(1200); // "1,200"
|
|
15
|
-
formatPercent(0.116); // "11.6%"
|
|
16
|
-
formatNumber(null); // "—"
|
|
17
|
-
formatDateRange({ start: '2026-01-01', end: '2026-01-03' });
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Percent values are ratios: `0.116` means 11.6%. Counts must be non-negative
|
|
21
|
-
integers. Missing or non-finite numbers render as `—`, customizable with
|
|
22
|
-
`missing`. Number formatting defaults to `en-US`; pass `locale` to override it.
|
|
23
|
-
|
|
24
|
-
`formatMetric` accepts a `MetricFormat` with `kind: 'count'`, `'ratio'`, or
|
|
25
|
-
`'currency'`; currency formats also require a currency code. `formatDateRange`
|
|
26
|
-
formats ISO calendar dates in UTC and retains the year in its labels.
|
|
27
|
-
`pluralize(count, singular, plural?)` selects a label for the count.
|
|
28
|
-
|
|
29
|
-
See [React metric definitions](react.md#bound-views-and-widgets).
|
package/docs/react-styles.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# React styles
|
|
2
|
-
|
|
3
|
-
Import the stylesheet once from the browser entry:
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
import '@altertable/data-app/react/styles.css';
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
This entry is a CSS asset, with a declaration for TypeScript side-effect imports.
|
|
10
|
-
The app's bundler must process CSS imports. The React JavaScript entry does not
|
|
11
|
-
load it automatically, so server rendering can import components without
|
|
12
|
-
importing CSS into Node.
|
|
13
|
-
|
|
14
|
-
Stylesheets live beside their components in `src/react/ui` and are combined into
|
|
15
|
-
the published stylesheet during the build. Brand settings install semantic CSS
|
|
16
|
-
variables through [appearance](appearance.md); the [React app shell](react.md)
|
|
17
|
-
manages these for normal app usage.
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# Starter agent instructions
|
|
2
|
-
|
|
3
|
-
The package ships `AGENTS.md`, public documentation in `docs/`, and declarations
|
|
4
|
-
referenced by its export map. Its agent guide describes package usage and includes
|
|
5
|
-
a separate section for contributors working in the package source repository.
|
|
6
|
-
|
|
7
|
-
A starter application's `AGENTS.md` owns its file paths, commands, and analysis
|
|
8
|
-
context. Keep it in the consuming app and explicitly direct agents to the
|
|
9
|
-
installed package guide. Dependency instructions are not guaranteed to be loaded
|
|
10
|
-
automatically: for example, [Codex discovers project instructions along the path
|
|
11
|
-
from the project root to its working directory](https://learn.chatgpt.com/docs/agent-configuration/agents-md),
|
|
12
|
-
not by scanning every dependency.
|
|
13
|
-
|
|
14
|
-
These installed docs replace references to the old vendored `.altertable/runtime`
|
|
15
|
-
layout for apps using this package.
|
|
16
|
-
|
|
17
|
-
Adapt this template to the starter's actual files and scripts:
|
|
18
|
-
|
|
19
|
-
```markdown
|
|
20
|
-
# Build this data app
|
|
21
|
-
|
|
22
|
-
Inspect source data, time coverage, and existing definitions before choosing an
|
|
23
|
-
exploration. Build conclusions from observed results; do not present association
|
|
24
|
-
as cause. Keep copy concise and relevant to the reader.
|
|
25
|
-
|
|
26
|
-
Read `node_modules/@altertable/data-app/AGENTS.md` first, then
|
|
27
|
-
`node_modules/@altertable/data-app/docs/app-authoring.md`.
|
|
28
|
-
|
|
29
|
-
| Task | App-owned files | Package documentation |
|
|
30
|
-
| ---------------------------------------- | ------------------------------------------- | -------------------------------------- |
|
|
31
|
-
| Define queries and inputs | `src/operations.ts`, shared input contracts | `docs/contract.md`, `docs/server.md` |
|
|
32
|
-
| Build views, filters, and request states | `src/App.tsx` | `docs/react.md` |
|
|
33
|
-
| Explain terms and query evidence | `src/data-context.ts` or `.tsx` | `docs/react.md#bind-evidence` |
|
|
34
|
-
| Change identity and brand | App configuration | `docs/config.md`, `docs/appearance.md` |
|
|
35
|
-
| Configure local serving or hosting | `src/server.ts` | `docs/server-bun.md`, `docs/server.md` |
|
|
36
|
-
|
|
37
|
-
Package documentation paths above are relative to
|
|
38
|
-
`node_modules/@altertable/data-app/`.
|
|
39
|
-
|
|
40
|
-
Edit app-owned source and import public package entries. Keep SQL and credentials
|
|
41
|
-
on the server, and import operation types with `import type` in browser code.
|
|
42
|
-
Do not edit installed package files. The connectivity screen is scaffolding,
|
|
43
|
-
not an example analysis.
|
|
44
|
-
|
|
45
|
-
Run the app's typecheck, lint, and build scripts. Inspect its findings and
|
|
46
|
-
interactions at phone and desktop widths, including loading, empty, error, and
|
|
47
|
-
stale states. Verify that the exploration answers the user's question.
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
A runnable port of the CLI starter lives in
|
|
51
|
-
[`examples/starter`](https://github.com/altertable-ai/data-app/tree/main/examples/starter). It consumes the built public
|
|
52
|
-
package and keeps its own app instructions. Updating CLI scaffolding to consume
|
|
53
|
-
the published package remains a separate migration.
|