@altertable/data-app 0.65.0 → 0.67.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 +38 -1
- package/CONTRIBUTING.md +54 -14
- package/README.md +1 -1
- package/dist/chunks/index-23dktynd.js +80 -0
- package/dist/chunks/index-23dktynd.js.map +10 -0
- package/dist/chunks/index-8qfxv0h5.js +14160 -0
- package/dist/chunks/index-8qfxv0h5.js.map +108 -0
- package/dist/chunks/index-ag0cgnvq.js +639 -0
- package/dist/chunks/index-ag0cgnvq.js.map +13 -0
- package/dist/chunks/index-dq7b35fn.js +307 -0
- package/dist/chunks/index-dq7b35fn.js.map +13 -0
- package/dist/chunks/{contract-a061yj6r.js → index-ev2b5aaf.js} +41 -72
- package/dist/chunks/index-ev2b5aaf.js.map +12 -0
- package/dist/chunks/{contract-awa2d5b1.js → index-f5cnbrjz.js} +19 -2
- package/dist/chunks/{contract-awa2d5b1.js.map → index-f5cnbrjz.js.map} +4 -3
- package/dist/chunks/{contract-sm7j7k95.js → index-ktmvs916.js} +9 -150
- package/dist/chunks/index-ktmvs916.js.map +13 -0
- package/dist/chunks/{contract-txjy0en2.js → index-m6n8ctfc.js} +64 -72
- package/dist/chunks/index-m6n8ctfc.js.map +10 -0
- package/dist/chunks/index-mt93ff2b.js +28 -0
- package/dist/chunks/index-mt93ff2b.js.map +10 -0
- package/dist/chunks/{contract-tf8c3qpv.js → index-qd5xgx6y.js} +46 -5
- package/dist/chunks/index-qd5xgx6y.js.map +13 -0
- package/dist/chunks/index-x69p7cv7.js +149 -0
- package/dist/chunks/index-x69p7cv7.js.map +10 -0
- package/dist/client/index.js +12 -7
- package/dist/client/index.js.map +1 -1
- package/dist/core/appearance.js +1 -1
- package/dist/core/config.js +7 -3
- package/dist/core/config.js.map +1 -1
- package/dist/core/contract.js +24 -6
- package/dist/core/contract.js.map +1 -1
- package/dist/core/format.js +1 -1
- package/dist/embed/index.js +16 -12
- package/dist/embed/index.js.map +4 -4
- package/dist/index.js +12 -0
- package/dist/index.js.map +9 -0
- package/dist/local.js +20 -30
- package/dist/local.js.map +7 -8
- package/dist/react/embed/index.js +1 -1
- package/dist/react/embed/index.js.map +2 -2
- package/dist/react/index.js +2567 -11542
- package/dist/react/index.js.map +16 -91
- package/dist/react/ui/index.js +2272 -0
- package/dist/react/ui/index.js.map +28 -0
- package/dist/server.js +13 -26
- package/dist/server.js.map +6 -7
- package/dist/types/client/annotations.d.ts +27 -0
- package/dist/types/client/data-client.d.ts +1 -2
- package/dist/types/client/iframe.d.ts +4 -2
- package/dist/types/client/index.d.ts +1 -0
- package/dist/types/core/annotations.d.ts +94 -0
- package/dist/types/core/appearance.d.ts +2 -2
- package/dist/types/core/config.d.ts +48 -4
- package/dist/types/core/contract.d.ts +21 -11
- package/dist/types/core/dimension.d.ts +6 -4
- package/dist/types/core/filters.d.ts +44 -0
- package/dist/types/core/messages.d.ts +2 -0
- package/dist/types/core/operation-types.d.ts +5 -2
- package/dist/types/core/operation.d.ts +3 -4
- package/dist/types/core/presentation.d.ts +2 -0
- package/dist/types/core/queries.d.ts +16 -0
- package/dist/types/core/uuid.d.ts +2 -0
- package/dist/types/core/variables.d.ts +34 -18
- package/dist/types/embed/runtime-html.d.ts +2 -0
- package/dist/types/embed/source.d.ts +2 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/react/annotations/AnnotationBar.d.ts +30 -0
- package/dist/types/react/annotations/AnnotationControls.d.ts +10 -0
- package/dist/types/react/annotations/AnnotationEditor.d.ts +16 -0
- package/dist/types/react/annotations/AnnotationMarkers.d.ts +19 -0
- package/dist/types/react/annotations/AnnotationSelectionLayer.d.ts +12 -0
- package/dist/types/react/annotations/AnnotationTarget.d.ts +9 -0
- package/dist/types/react/annotations/AnnotationTooltip.d.ts +9 -0
- package/dist/types/react/annotations/AnnotationTrigger.d.ts +10 -0
- package/dist/types/react/annotations/annotation-editor-state.d.ts +56 -0
- package/dist/types/react/annotations/annotation-screenshot.d.ts +4 -0
- package/dist/types/react/annotations/annotation-targets.d.ts +33 -0
- package/dist/types/react/annotations/getAnnotationProps.d.ts +15 -0
- package/dist/types/react/annotations/styles.d.ts +3 -0
- package/dist/types/react/annotations/useAnnotationGeometry.d.ts +22 -0
- package/dist/types/react/annotations/useDataAppAnnotations.d.ts +22 -0
- package/dist/types/react/app-context.d.ts +3 -0
- package/dist/types/react/bindings.d.ts +110 -0
- package/dist/types/react/content.d.ts +24 -11
- package/dist/types/react/hooks.d.ts +29 -787
- package/dist/types/react/index.d.ts +31 -106
- package/dist/types/react/mount.d.ts +6 -4
- package/dist/types/react/source-owner.d.ts +2 -0
- package/dist/types/react/style-contract.d.ts +80 -0
- package/dist/types/react/style-validation.d.ts +2 -0
- package/dist/types/react/ui/AboutData.d.ts +9 -1
- package/dist/types/react/ui/AppHeader.d.ts +1 -2
- package/dist/types/react/ui/AppLayout.d.ts +3 -9
- package/dist/types/react/ui/AppToolbar.d.ts +5 -8
- package/dist/types/react/ui/AreaChart.d.ts +7 -0
- package/dist/types/react/ui/BarChart.d.ts +6 -0
- package/dist/types/react/ui/Button.d.ts +3 -3
- package/dist/types/react/ui/ChartLegend.d.ts +31 -0
- package/dist/types/react/ui/Checkbox.d.ts +15 -4
- package/dist/types/react/ui/CheckboxGroup.d.ts +7 -0
- package/dist/types/react/ui/{Combobox.d.ts → ChoicePicker.d.ts} +10 -15
- package/dist/types/react/ui/{ComparisonVisual.d.ts → Comparison.d.ts} +3 -3
- package/dist/types/react/ui/ComposedChart.d.ts +41 -0
- package/dist/types/react/ui/ComposedChartLegend.d.ts +8 -0
- package/dist/types/react/ui/ContentSkeleton.d.ts +2 -0
- package/dist/types/react/ui/DataApp.d.ts +17 -58
- package/dist/types/react/ui/DataAppFrame.d.ts +41 -0
- package/dist/types/react/ui/DataBoundary.d.ts +4 -5
- package/dist/types/react/ui/DataSection.d.ts +6 -18
- package/dist/types/react/ui/DataSectionBoundary.d.ts +30 -0
- package/dist/types/react/ui/DataValue.d.ts +9 -0
- package/dist/types/react/ui/DataWidget.d.ts +2 -1
- package/dist/types/react/ui/DateTimeTooltip.d.ts +1 -1
- package/dist/types/react/ui/DimensionPicker.d.ts +1 -1
- package/dist/types/react/ui/ExportControl.d.ts +1 -1
- package/dist/types/react/ui/FilterActions.d.ts +10 -0
- package/dist/types/react/ui/FilterBar.d.ts +3 -0
- package/dist/types/react/ui/GettingStarted.d.ts +2 -4
- package/dist/types/react/ui/HelpPopover.d.ts +3 -4
- package/dist/types/react/ui/InspectionContext.d.ts +2 -0
- package/dist/types/react/ui/InspectionProvider.d.ts +29 -0
- package/dist/types/react/ui/LineChart.d.ts +7 -0
- package/dist/types/react/ui/Menu.d.ts +12 -0
- package/dist/types/react/ui/MetricWidget.d.ts +4 -3
- package/dist/types/react/ui/NumberField.d.ts +27 -0
- package/dist/types/react/ui/NumberFilterPicker.d.ts +9 -0
- package/dist/types/react/ui/PieChart.d.ts +11 -0
- package/dist/types/react/ui/PresentStory.d.ts +2 -5
- package/dist/types/react/ui/RadioGroup.d.ts +18 -0
- package/dist/types/react/ui/RefreshControl.d.ts +1 -2
- package/dist/types/react/ui/ScatterChart.d.ts +17 -0
- package/dist/types/react/ui/SearchField.d.ts +1 -2
- package/dist/types/react/ui/SearchInput.d.ts +3 -1
- package/dist/types/react/ui/Select.d.ts +14 -0
- package/dist/types/react/ui/SelectionMark.d.ts +2 -1
- package/dist/types/react/ui/Sheet.d.ts +2 -1
- package/dist/types/react/ui/Skeleton.d.ts +5 -2
- package/dist/types/react/ui/StaticDataApp.d.ts +4 -0
- package/dist/types/react/ui/TableWidget.d.ts +19 -16
- package/dist/types/react/ui/Tabs.d.ts +6 -2
- package/dist/types/react/ui/TextWidget.d.ts +2 -1
- package/dist/types/react/ui/Tooltip.d.ts +4 -3
- package/dist/types/react/ui/TooltipSurface.d.ts +3 -0
- package/dist/types/react/ui/TrendChart.d.ts +5 -0
- package/dist/types/react/ui/UpdatedAt.d.ts +1 -1
- package/dist/types/react/ui/VisualizationWidget.d.ts +12 -13
- package/dist/types/react/ui/WidgetViewTabs.d.ts +1 -1
- package/dist/types/react/ui/chart-data.d.ts +25 -0
- package/dist/types/react/ui/chart-primitives.d.ts +20 -0
- package/dist/types/react/ui/data-context.d.ts +18 -7
- package/dist/types/react/ui/icons.d.ts +2 -0
- package/dist/types/react/ui/index.d.ts +98 -0
- package/dist/types/react/ui/keyboard.d.ts +6 -0
- package/dist/types/react/ui/metric.d.ts +1 -1
- package/dist/types/react/ui/presentation.d.ts +5 -1
- package/dist/types/react/ui/shortcuts.d.ts +14 -1
- package/dist/types/react/ui/useAppAppearance.d.ts +1 -1
- package/dist/types/react/ui/variables.d.ts +4 -2
- package/dist/types/react/view-controls.d.ts +3 -1
- package/dist/types/react/view-runtime.d.ts +29 -0
- package/dist/types/react/view.d.ts +21 -4
- package/dist/types/react/widgets.d.ts +79 -0
- package/dist/types/server/handler.d.ts +4 -4
- package/dist/worker.js +20 -737
- package/docs/app-authoring.md +72 -50
- package/docs/client.md +8 -8
- package/docs/contract.md +42 -20
- package/docs/data-context.md +91 -0
- package/docs/embed.md +10 -2
- package/docs/formatting-and-appearance.md +68 -0
- package/docs/hosted-apps.md +9 -15
- package/docs/layout.md +5 -3
- package/docs/react-embed.md +5 -4
- package/docs/react.md +22 -317
- package/docs/server-bun.md +1 -1
- package/docs/server.md +4 -4
- package/docs/stories-and-export.md +52 -0
- package/docs/styling.md +62 -0
- package/docs/ui-quality.md +20 -0
- package/docs/ui.md +196 -0
- package/docs/variables.md +171 -0
- package/docs/views.md +123 -0
- package/docs/widgets.md +145 -0
- package/examples/starter-data-app/index.tsx +115 -86
- package/package.json +25 -12
- package/dist/chunks/contract-a061yj6r.js.map +0 -12
- package/dist/chunks/contract-g6hky7x6.js +0 -282
- package/dist/chunks/contract-g6hky7x6.js.map +0 -12
- package/dist/chunks/contract-sm7j7k95.js.map +0 -14
- package/dist/chunks/contract-tf8c3qpv.js.map +0 -11
- package/dist/chunks/contract-txjy0en2.js.map +0 -10
- package/dist/chunks/contract-wz59z8pq.js +0 -8
- package/dist/chunks/contract-wz59z8pq.js.map +0 -10
- package/dist/chunks/contract-yxbjea23.js +0 -328
- package/dist/chunks/contract-yxbjea23.js.map +0 -12
- package/dist/types/react/ui/RefreshRegion.d.ts +0 -9
- package/dist/types/react/ui/SelectableBarChart.d.ts +0 -15
- package/docs/releasing.md +0 -79
- /package/dist/chunks/{contract-mev09s5v.js → index-mev09s5v.js} +0 -0
- /package/dist/chunks/{contract-mev09s5v.js.map → index-mev09s5v.js.map} +0 -0
- /package/dist/types/react/ui/{comparison.d.ts → metric-comparison.d.ts} +0 -0
|
@@ -12,10 +12,11 @@ export declare function createIframeTransport({ parentOrigin, window: frame, tim
|
|
|
12
12
|
request: (message: RoutedMessage, signal?: AbortSignal) => Promise<unknown>;
|
|
13
13
|
transport: (operation: string, input: unknown, signal?: AbortSignal) => Promise<TransportResponse>;
|
|
14
14
|
lakehouse: {
|
|
15
|
-
queryAll(statement: string, { limit, signal }: {
|
|
15
|
+
queryAll(statement: string, { limit, signal, params }: {
|
|
16
16
|
limit: number;
|
|
17
17
|
signal: AbortSignal;
|
|
18
18
|
name?: string;
|
|
19
|
+
params?: import("../core/contract.js").QueryParameters;
|
|
19
20
|
}): Promise<import("../core/contract.js").QueryResult>;
|
|
20
21
|
};
|
|
21
22
|
dispose: () => void;
|
|
@@ -39,10 +40,11 @@ export declare function getDataAppTransport(frame?: Window): {
|
|
|
39
40
|
request: (message: RoutedMessage, signal?: AbortSignal) => Promise<unknown>;
|
|
40
41
|
transport: (operation: string, input: unknown, signal?: AbortSignal) => Promise<TransportResponse>;
|
|
41
42
|
lakehouse: {
|
|
42
|
-
queryAll(statement: string, { limit, signal }: {
|
|
43
|
+
queryAll(statement: string, { limit, signal, params }: {
|
|
43
44
|
limit: number;
|
|
44
45
|
signal: AbortSignal;
|
|
45
46
|
name?: string;
|
|
47
|
+
params?: import("../core/contract.js").QueryParameters;
|
|
46
48
|
}): Promise<import("../core/contract.js").QueryResult>;
|
|
47
49
|
};
|
|
48
50
|
dispose: () => void;
|
|
@@ -11,3 +11,4 @@ export { createHttpTransport, DataAppError, type DataTransport, } from './transp
|
|
|
11
11
|
export { createIframeTransport, installDataAppTransport, getDataAppTransport, type IframeTransport, } from './iframe.js';
|
|
12
12
|
export { createMessageClient } from './messages.js';
|
|
13
13
|
export type { DataAppLogger } from '../core/logger.js';
|
|
14
|
+
export { createAnnotationClient } from './annotations.js';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export type DataAppAnnotationDraft = {
|
|
2
|
+
id: string;
|
|
3
|
+
target: {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
kind: 'widget' | 'element' | 'app';
|
|
7
|
+
text: string;
|
|
8
|
+
queryNames: string[];
|
|
9
|
+
glossaryIds: string[];
|
|
10
|
+
};
|
|
11
|
+
context: {
|
|
12
|
+
search: string;
|
|
13
|
+
hash: string;
|
|
14
|
+
displayedInput?: unknown;
|
|
15
|
+
/** Normalized position within the selected target, stable across scrolling/resizing. */
|
|
16
|
+
anchor?: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
cursor?: {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
};
|
|
24
|
+
/** Normalized custom selection rectangle within the iframe document. */
|
|
25
|
+
region?: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
31
|
+
screenshot?: {
|
|
32
|
+
mimeType: 'image/png';
|
|
33
|
+
dataUrl: string;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
};
|
|
37
|
+
view?: string;
|
|
38
|
+
viewport: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
};
|
|
42
|
+
rect: {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
width: number;
|
|
46
|
+
height: number;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
comment: string;
|
|
50
|
+
};
|
|
51
|
+
export type DataAppAnnotationPresentation = {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
/** When provided, the host owns the mode and renders the annotation trigger. */
|
|
54
|
+
active?: boolean;
|
|
55
|
+
pinsVisible?: boolean;
|
|
56
|
+
showHint?: boolean;
|
|
57
|
+
readOnly?: boolean;
|
|
58
|
+
targets?: {
|
|
59
|
+
id: string;
|
|
60
|
+
targetId: string;
|
|
61
|
+
number: number;
|
|
62
|
+
comment?: string;
|
|
63
|
+
anchor?: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
};
|
|
67
|
+
region?: {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
};
|
|
73
|
+
}[];
|
|
74
|
+
selectedAnnotationId?: string;
|
|
75
|
+
selectedTargetId?: string;
|
|
76
|
+
selectionId?: string;
|
|
77
|
+
};
|
|
78
|
+
/** Reconstruct at the boundary; discard extra fields and bound the entire JSON payload. */
|
|
79
|
+
export declare function parseDataAppAnnotationDraft(value: unknown): DataAppAnnotationDraft;
|
|
80
|
+
export declare const annotationDraftRoute: import("./messages.js").MessageRoute<DataAppAnnotationDraft, null>;
|
|
81
|
+
export declare const annotationEditorStateRoute: import("./messages.js").MessageRoute<{
|
|
82
|
+
hasUnsavedChanges: boolean;
|
|
83
|
+
}, null>;
|
|
84
|
+
/** Request host-owned batch submission without transferring ownership of drafts. */
|
|
85
|
+
export declare const annotationSendRoute: import("./messages.js").MessageRoute<null, null>;
|
|
86
|
+
export declare const annotationUpdateRoute: import("./messages.js").MessageRoute<{
|
|
87
|
+
id: string;
|
|
88
|
+
comment: string;
|
|
89
|
+
}, null>;
|
|
90
|
+
/** A controlled shell acknowledges local exits (for example Escape). */
|
|
91
|
+
export declare const annotationModeRoute: import("./messages.js").MessageRoute<{
|
|
92
|
+
active: boolean;
|
|
93
|
+
}, null>;
|
|
94
|
+
export declare function isAnnotationPresentation(value: unknown): value is DataAppAnnotationPresentation;
|
|
@@ -32,8 +32,8 @@ export declare function parseAppearance(value: unknown): AppearanceSettings;
|
|
|
32
32
|
/** Resolve typed app settings without repeating authoring checks at runtime. */
|
|
33
33
|
export declare function normalizeAppearance(value?: AppearanceOptions): AppearanceSettings;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* Select document-owned appearance presets and brand inputs. Public CSS tokens remain
|
|
36
|
+
* overridable in stylesheets. Cleanup restores the previous document appearance.
|
|
37
37
|
*/
|
|
38
38
|
export declare function applyAppearance(value?: AppearanceOptions): () => void;
|
|
39
39
|
/** Persist a viewer theme preference. Applying appearance belongs to the UI owner. */
|
|
@@ -1,15 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* App
|
|
3
|
-
* @module @altertable/data-app
|
|
2
|
+
* App configuration shared by browser and server.
|
|
3
|
+
* @module @altertable/data-app
|
|
4
4
|
*/
|
|
5
|
+
import { defineOperation } from './contract.js';
|
|
5
6
|
import type { AppearanceOptions } from './appearance.js';
|
|
6
|
-
|
|
7
|
+
import { type QueryDefinitions } from './queries.js';
|
|
8
|
+
export type { QueryDefinitions, QueryParameterValue } from './queries.js';
|
|
9
|
+
export type DataAppConfig<Queries extends QueryDefinitions = QueryDefinitions> = {
|
|
7
10
|
title: string;
|
|
8
11
|
/** Display labels; scope does not grant data access. */
|
|
9
12
|
scope: {
|
|
10
13
|
organization: string;
|
|
11
14
|
environment: string;
|
|
12
15
|
};
|
|
13
|
-
|
|
16
|
+
/** Explain what the app helps readers explore. */
|
|
17
|
+
description: string;
|
|
18
|
+
/** Omit to use the standard appearance. */
|
|
19
|
+
appearance?: AppearanceOptions;
|
|
20
|
+
/** Named SQL statements and parameter defaults used by app operations. */
|
|
21
|
+
queries: Queries;
|
|
14
22
|
};
|
|
23
|
+
type ImmutableQueries<Queries extends QueryDefinitions> = {
|
|
24
|
+
readonly [Name in keyof Queries]: {
|
|
25
|
+
readonly statement: Queries[Name]['statement'];
|
|
26
|
+
readonly params: {
|
|
27
|
+
readonly [Param in keyof Queries[Name]['params']]: Readonly<Queries[Name]['params'][Param]>;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/** An app declaration with operations bound to its query registry. */
|
|
32
|
+
export type DataAppDefinition<Queries extends QueryDefinitions = QueryDefinitions> = Readonly<Omit<DataAppConfig<Queries>, 'queries'>> & {
|
|
33
|
+
readonly queries: ImmutableQueries<Queries>;
|
|
34
|
+
defineOperation<Input, Output>(operation: Omit<Parameters<typeof defineOperation<Input, Output, Queries>>[0], 'queries'>): ReturnType<typeof defineOperation<Input, Output, Queries>>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Define the app's query source of truth while preserving exact query and parameter names.
|
|
38
|
+
* Use `app.defineOperation()` to bind operations to these queries. Pass the app once
|
|
39
|
+
* to `mountDataApp({ app, component })` or `<DataAppProvider app={app}>`.
|
|
40
|
+
* The app owns an immutable snapshot of its registry; later input mutations do not change it.
|
|
41
|
+
* This declaration does not execute queries or mount UI. Static apps use `queries: {}`.
|
|
42
|
+
*
|
|
43
|
+
* Declare exactly one module-level const initialized with `defineDataApp({ ... })` in the app's
|
|
44
|
+
* declaration source. For the future backend extractor, the argument is read before bundling
|
|
45
|
+
* by resolving the named `defineDataApp` import from `@altertable/data-app`, including aliases.
|
|
46
|
+
* Variable name is arbitrary;
|
|
47
|
+
* export only for imports by other modules. The argument must be a direct object literal
|
|
48
|
+
* containing schema-valid objects, arrays, strings (including templates without interpolation),
|
|
49
|
+
* finite signed numbers, booleans, and null. No spreads, computed keys, references, calls,
|
|
50
|
+
* or callbacks inside it. Extraction must validate data without evaluating app code.
|
|
51
|
+
* TypeScript checks the shape, not AST syntax. Keep executable composition outside the call.
|
|
52
|
+
*
|
|
53
|
+
* SQL passes unchanged to the backend, which interprets placeholders such as `$orgId`.
|
|
54
|
+
* Declare every parameter with `{ defaultValue: value }` or `{}` for a required value.
|
|
55
|
+
* Values are finite numbers, strings, booleans, or null, never SQL fragments or identifiers.
|
|
56
|
+
* Caller values override defaults; trusted server `queryParams` cannot be overridden.
|
|
57
|
+
*/
|
|
58
|
+
export declare function defineDataApp<const Queries extends QueryDefinitions>(config: DataAppConfig<Queries>): DataAppDefinition<Queries>;
|
|
15
59
|
export declare function dataAppTitle(config: Pick<DataAppConfig, 'title' | 'scope'>): string;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type QueryDefinitions, type QueryParameterValue } from './queries.js';
|
|
2
|
+
export type { QueryDefinitions, QueryParameters, QueryParameterValue, } from './queries.js';
|
|
1
3
|
import type { DateRange as DateRangeInput } from './date-range.js';
|
|
2
4
|
import type { QueryResult, DataOperation, OperationContext } from './operation-types.js';
|
|
3
5
|
export type { QueryResult, DisclosedQuery, Lakehouse, OperationContext, DataOperation, DataOperations, } from './operation-types.js';
|
|
@@ -69,24 +71,32 @@ export declare class DataSourceError extends Error {
|
|
|
69
71
|
static [Symbol.hasInstance](value: unknown): boolean;
|
|
70
72
|
constructor(reason: 'unauthorized' | 'forbidden' | 'rate_limited' | 'query_rejected' | 'unavailable', status?: number | undefined);
|
|
71
73
|
}
|
|
72
|
-
|
|
74
|
+
type RegisteredQueryParameters<Queries extends QueryDefinitions, Name extends keyof Queries> = keyof Queries[Name]['params'] extends never ? Record<string, never> : Partial<Record<keyof Queries[Name]['params'], QueryParameterValue>>;
|
|
75
|
+
export type RegisteredQuery<Queries extends QueryDefinitions> = <Name extends keyof Queries & string, const Params extends object = {}>(name: Name, params?: Params & NoInfer<RegisteredQueryParameters<Queries, Name>> & NoInfer<Record<Exclude<keyof Params, keyof Queries[Name]['params']>, never>> & NoInfer<Params extends (...args: never[]) => unknown ? never : object>, options?: {
|
|
73
76
|
limit?: number;
|
|
74
77
|
}) => Promise<QueryResult>;
|
|
75
|
-
export declare function defineOperation<Input, Output, const
|
|
76
|
-
|
|
77
|
-
run: (context: OperationContext & {
|
|
78
|
-
query:
|
|
78
|
+
export declare function defineOperation<Input, Output, const Queries extends QueryDefinitions>(operation: Omit<DataOperation<Input, Output>, 'run' | 'queryNames'> & {
|
|
79
|
+
queries: Queries;
|
|
80
|
+
run: (context: Pick<OperationContext, 'signal'> & {
|
|
81
|
+
query: RegisteredQuery<NoInfer<Queries>>;
|
|
79
82
|
}, input: Input) => Promise<Output>;
|
|
80
|
-
}): DataOperation<Input, Output> & {
|
|
81
|
-
queryNames
|
|
83
|
+
}): Omit<DataOperation<Input, Output>, 'queryNames'> & {
|
|
84
|
+
queryNames: {
|
|
85
|
+
readonly [Name in keyof Queries & string]: Name;
|
|
86
|
+
};
|
|
82
87
|
};
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
/** A connectivity probe uses the app's registered connection query. */
|
|
89
|
+
export declare function connectionCheck<const Queries extends QueryDefinitions & {
|
|
90
|
+
connection: QueryDefinitions[string];
|
|
91
|
+
}>(queries: Queries): Omit<DataOperation<Record<string, never>, true>, "queryNames"> & {
|
|
92
|
+
queryNames: { readonly [Name in keyof Queries & string]: Name; };
|
|
85
93
|
};
|
|
86
|
-
/** Success requires a bounded SQL query; it does not establish access to a particular dataset. */
|
|
87
|
-
export declare function connectionCheck(): DataOperation<Record<string, never>, true>;
|
|
88
94
|
export { dimensionFilter, parseDimensionSelection, parseFacetOptions, dimensionPredicate, } from './dimension.js';
|
|
89
95
|
export type { DimensionSelection, DimensionMember, DimensionOption, DimensionVariable, DimensionFilterOptions, } from './dimension.js';
|
|
90
96
|
export { createMessageRouter, defineMessageRoute, defineDataQueryRoute, MessageRoutingError, dataAppRoutes, navigationUpdateRoute, sqlQueryRoute, } from './messages.js';
|
|
91
97
|
export type { MessageContext, RoutedMessage, MessageDispatcher, MessageTransport, MessageRoute, MessageRoutes, MessageInput, MessageHandlers, MessageOutput, OperationContracts, DataQueryInput, DataQueryBody, DataQueryRoute, NavigationUpdate, SqlQueryInput, } from './messages.js';
|
|
92
98
|
export type { TransportResponse } from './bridge.js';
|
|
99
|
+
export { annotationDraftRoute, annotationModeRoute, annotationEditorStateRoute, annotationSendRoute, annotationUpdateRoute, parseDataAppAnnotationDraft, } from './annotations.js';
|
|
100
|
+
export type { DataAppAnnotationDraft, DataAppAnnotationPresentation, } from './annotations.js';
|
|
101
|
+
export { numberFilter, booleanFilter, parseNumberSelection, parseBooleanSelection, } from './filters.js';
|
|
102
|
+
export type { NumberSelection, NumberOperator, NumberFilter, BooleanSelection, BooleanFilter, } from './filters.js';
|
|
@@ -9,7 +9,7 @@ export type DimensionMember<T extends DimensionValue = DimensionValue> = {
|
|
|
9
9
|
export type DimensionSelection<T extends DimensionValue = DimensionValue> = {
|
|
10
10
|
kind: 'all';
|
|
11
11
|
} | {
|
|
12
|
-
kind: 'include';
|
|
12
|
+
kind: 'include' | 'exclude';
|
|
13
13
|
members: readonly DimensionMember<T>[];
|
|
14
14
|
};
|
|
15
15
|
export type DimensionOption<T extends DimensionValue = DimensionValue> = {
|
|
@@ -17,11 +17,12 @@ export type DimensionOption<T extends DimensionValue = DimensionValue> = {
|
|
|
17
17
|
label: string;
|
|
18
18
|
count?: number;
|
|
19
19
|
};
|
|
20
|
-
export type DimensionVariable<T extends DimensionValue = DimensionValue> =
|
|
20
|
+
export type DimensionVariable<T extends DimensionValue = DimensionValue> = AppVariable<DimensionSelection<T>, 'dimension'> & {
|
|
21
21
|
label: string;
|
|
22
|
-
|
|
22
|
+
selectionMode: 'single' | 'multiple';
|
|
23
23
|
valueType: 'string' | 'number';
|
|
24
24
|
allowMissing: boolean;
|
|
25
|
+
allowExclusion: boolean;
|
|
25
26
|
maxSelected: number;
|
|
26
27
|
options: readonly DimensionOption<T>[];
|
|
27
28
|
facet?: {
|
|
@@ -35,8 +36,9 @@ export type DimensionFilterOptions<T extends DimensionValue> = {
|
|
|
35
36
|
key: string;
|
|
36
37
|
label: string;
|
|
37
38
|
valueType: T extends number ? 'number' : 'string';
|
|
38
|
-
|
|
39
|
+
selectionMode: 'single' | 'multiple';
|
|
39
40
|
allowMissing?: boolean;
|
|
41
|
+
allowExclusion?: boolean;
|
|
40
42
|
maxSelected?: number;
|
|
41
43
|
history?: HistoryMode;
|
|
42
44
|
} & ({
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AppVariable, HistoryMode } from './variables.js';
|
|
2
|
+
export type NumberOperator = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
3
|
+
export type NumberSelection = {
|
|
4
|
+
kind: 'all';
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'comparison';
|
|
7
|
+
operator: NumberOperator;
|
|
8
|
+
value: number;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'range';
|
|
11
|
+
min?: number;
|
|
12
|
+
max?: number;
|
|
13
|
+
};
|
|
14
|
+
export type BooleanSelection = {
|
|
15
|
+
kind: 'all';
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'is';
|
|
18
|
+
value: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type NumberFilter = AppVariable<NumberSelection, 'numberFilter'> & {
|
|
21
|
+
label: string;
|
|
22
|
+
min?: number;
|
|
23
|
+
max?: number;
|
|
24
|
+
};
|
|
25
|
+
export type BooleanFilter = AppVariable<BooleanSelection, 'booleanFilter'> & {
|
|
26
|
+
label: string;
|
|
27
|
+
};
|
|
28
|
+
type FilterOptions<Value> = {
|
|
29
|
+
key: string;
|
|
30
|
+
label: string;
|
|
31
|
+
defaultValue?: Value;
|
|
32
|
+
history?: HistoryMode;
|
|
33
|
+
};
|
|
34
|
+
export declare const numberOperatorLabels: Record<NumberOperator, string>;
|
|
35
|
+
/** Exact numeric predicates; range bounds are inclusive and may be open-ended. */
|
|
36
|
+
export declare function numberFilter({ key, label, min, max, defaultValue, history, }: FilterOptions<NumberSelection> & {
|
|
37
|
+
min?: number;
|
|
38
|
+
max?: number;
|
|
39
|
+
}): NumberFilter;
|
|
40
|
+
/** Boolean predicate with a distinct unrestricted state. */
|
|
41
|
+
export declare function booleanFilter({ key, label, defaultValue, history, }: FilterOptions<BooleanSelection>): BooleanFilter;
|
|
42
|
+
export declare function parseNumberSelection(value: unknown, filter: NumberFilter): NumberSelection;
|
|
43
|
+
export declare function parseBooleanSelection(value: unknown, filter: BooleanFilter): BooleanSelection;
|
|
44
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type QueryParameters } from './queries.js';
|
|
1
2
|
import type { TransportResponse, QueryResult, OperationContracts, DataQueryInput, DataQueryBody, OutputOf } from './operation-types.js';
|
|
2
3
|
export type { OperationContracts, DataQueryInput, DataQueryBody, } from './operation-types.js';
|
|
3
4
|
import { type NavigationUpdate } from './navigation.js';
|
|
@@ -49,6 +50,7 @@ export declare const navigationUpdateRoute: MessageRoute<NavigationUpdate, null>
|
|
|
49
50
|
export type SqlQueryInput = {
|
|
50
51
|
statement: string;
|
|
51
52
|
limit: number;
|
|
53
|
+
params?: QueryParameters;
|
|
52
54
|
};
|
|
53
55
|
/** SQL delivery for browser-owned operations. Hosts must enforce backend access and resource limits. */
|
|
54
56
|
export declare const sqlQueryRoute: MessageRoute<SqlQueryInput, QueryResult>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Shared operation, query, and response contracts; independent of delivery adapters. */
|
|
2
|
+
import type { QueryParameters } from './queries.js';
|
|
2
3
|
export type OperationContracts = Record<string, {
|
|
3
4
|
input: (value: unknown) => unknown;
|
|
4
5
|
output: (value: unknown) => unknown;
|
|
@@ -17,10 +18,11 @@ export type QueryResult = {
|
|
|
17
18
|
rows: unknown[][];
|
|
18
19
|
queryId?: string;
|
|
19
20
|
};
|
|
20
|
-
/** One
|
|
21
|
+
/** One registered statement an operation ran, with its parameter values. */
|
|
21
22
|
export type DisclosedQuery = {
|
|
22
23
|
name: string;
|
|
23
24
|
statement: string;
|
|
25
|
+
params?: QueryParameters;
|
|
24
26
|
queryId?: string;
|
|
25
27
|
};
|
|
26
28
|
/** Query interface supplied by a server adapter or an authorized iframe bridge. */
|
|
@@ -29,11 +31,13 @@ export type Lakehouse = {
|
|
|
29
31
|
limit: number;
|
|
30
32
|
signal: AbortSignal;
|
|
31
33
|
name?: string;
|
|
34
|
+
params?: QueryParameters;
|
|
32
35
|
}): Promise<QueryResult>;
|
|
33
36
|
};
|
|
34
37
|
export type OperationContext = {
|
|
35
38
|
lakehouse: Lakehouse;
|
|
36
39
|
signal: AbortSignal;
|
|
40
|
+
queryParams?: QueryParameters;
|
|
37
41
|
};
|
|
38
42
|
/**
|
|
39
43
|
* Parsers run in the operation executor's runtime: server for HTTP apps, browser for bundle apps.
|
|
@@ -49,7 +53,6 @@ export type DataOperation<Input, Output> = {
|
|
|
49
53
|
maxQueryRows: number;
|
|
50
54
|
maxDurationMs: number;
|
|
51
55
|
maxResponseBytes?: number;
|
|
52
|
-
exposeSql?: boolean;
|
|
53
56
|
};
|
|
54
57
|
};
|
|
55
58
|
/** Heterogeneous registry: inputs vary per operation, so checks retain unknown values. */
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import type { DataOperations, Lakehouse, DataQueryBody } from './operation-types.js';
|
|
1
|
+
import type { DataOperations, Lakehouse, OperationContext, DataQueryBody } from './operation-types.js';
|
|
2
2
|
type Operation = DataOperations[string];
|
|
3
3
|
type OperationExecutionOptions = {
|
|
4
4
|
operationName: string;
|
|
5
5
|
lakehouse: Lakehouse;
|
|
6
6
|
signal: AbortSignal;
|
|
7
|
-
/** Include query evidence in the response; this does not keep browser-owned SQL private. */
|
|
8
|
-
includeSql: boolean;
|
|
9
7
|
requestId: string;
|
|
8
|
+
queryParams?: OperationContext['queryParams'];
|
|
10
9
|
};
|
|
11
10
|
/** Shared operation execution. Adapters own authorization, delivery, and public errors. */
|
|
12
|
-
export declare function executeDataOperation(operation: Operation, value: unknown, { operationName, lakehouse, signal: requestSignal,
|
|
11
|
+
export declare function executeDataOperation(operation: Operation, value: unknown, { operationName, lakehouse, signal: requestSignal, requestId, queryParams, }: OperationExecutionOptions): Promise<{
|
|
13
12
|
body: DataQueryBody<unknown>;
|
|
14
13
|
serializedBody: string;
|
|
15
14
|
}>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { type DataAppAnnotationPresentation } from './annotations.js';
|
|
1
2
|
import type { Theme } from './appearance.js';
|
|
2
3
|
/** Presentation owned by the parent shell, delivered only over a trusted bridge. */
|
|
3
4
|
export type DataAppPresentation = {
|
|
4
5
|
surface: 'embedded' | 'standalone';
|
|
5
6
|
theme: Theme;
|
|
7
|
+
annotations?: DataAppAnnotationPresentation;
|
|
6
8
|
};
|
|
7
9
|
export declare function isDataAppPresentation(value: unknown): value is DataAppPresentation;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type QueryParameterValue = string | number | boolean | null;
|
|
2
|
+
type QueryDefinition = {
|
|
3
|
+
statement: string;
|
|
4
|
+
params: Readonly<Record<string, {
|
|
5
|
+
defaultValue?: QueryParameterValue;
|
|
6
|
+
}>>;
|
|
7
|
+
};
|
|
8
|
+
export type QueryDefinitions = Readonly<Record<string, QueryDefinition>>;
|
|
9
|
+
/** Parameters are scalar SQL values, never identifiers or SQL fragments. */
|
|
10
|
+
export type QueryParameters = Readonly<Record<string, QueryParameterValue>>;
|
|
11
|
+
export declare function isQueryParameters(value: unknown): value is QueryParameters;
|
|
12
|
+
/** Retain authored statements and defaults, rejecting empty SQL and invalid scalar defaults. */
|
|
13
|
+
export declare function snapshotQueries(definitions: QueryDefinitions): QueryDefinitions;
|
|
14
|
+
/** Context owns protected values; callers supply filters; defaults fill remaining declarations. */
|
|
15
|
+
export declare function resolveQueryParameters(declarations: QueryDefinition['params'], values: Partial<QueryParameters>, context: QueryParameters): QueryParameters;
|
|
16
|
+
export {};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { type DatePresetId, type DateRange } from './date-range.js';
|
|
2
2
|
import type { DateRangeContract, DateRangeRequest } from './contract.js';
|
|
3
3
|
import type { DimensionSelection, DimensionVariable } from './dimension.js';
|
|
4
|
+
import type { NumberFilter, BooleanFilter } from './filters.js';
|
|
4
5
|
import type { HistoryMode } from './navigation.js';
|
|
5
6
|
export type { HistoryMode } from './navigation.js';
|
|
6
7
|
/** An app-owned value with one URL representation. Controls never parse or write routes. */
|
|
7
|
-
export type AppVariable<Value, Kind extends string =
|
|
8
|
+
export type AppVariable<Value, Kind extends string = string> = {
|
|
8
9
|
kind: Kind;
|
|
9
10
|
label?: string;
|
|
10
|
-
options?: readonly {
|
|
11
|
-
id: string;
|
|
12
|
-
label: string;
|
|
13
|
-
}[];
|
|
14
11
|
urlKeys: readonly string[];
|
|
15
12
|
defaultValue: Value;
|
|
13
|
+
/** Unrestricted value, when this variable represents a filter. */
|
|
14
|
+
clearValue?: Value;
|
|
15
|
+
describe?: (value: Value) => string;
|
|
16
16
|
history: HistoryMode;
|
|
17
17
|
read: (params: URLSearchParams) => Value;
|
|
18
18
|
write: (value: Value) => Record<string, string | null>;
|
|
19
19
|
valid: (value: Value) => boolean;
|
|
20
20
|
same: (left: Value, right: Value) => boolean;
|
|
21
21
|
};
|
|
22
|
-
export type VariableCollection = Record<string,
|
|
22
|
+
export type VariableCollection = Record<string, SearchVariable | ChoiceVariable | MultiChoiceVariable | DateRangeVariable | DimensionVariable<any> | NumberFilter | BooleanFilter>;
|
|
23
23
|
export type AppVariableValues<Variables> = {
|
|
24
24
|
[Key in keyof Variables]: Variables[Key] extends DimensionVariable<infer Value> ? DimensionSelection<Value> : Variables[Key] extends AppVariable<infer Value, string> ? Value : never;
|
|
25
25
|
};
|
|
@@ -31,13 +31,32 @@ type ScalarVariableOptions = {
|
|
|
31
31
|
defaultValue?: string;
|
|
32
32
|
history?: HistoryMode;
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
export type SearchVariable = AppVariable<string, 'search'>;
|
|
35
|
+
export type ChoiceOption = {
|
|
36
|
+
id: string;
|
|
37
|
+
label: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
};
|
|
40
|
+
export type ChoiceVariable = AppVariable<string, 'choice'> & {
|
|
41
|
+
options: readonly ChoiceOption[];
|
|
42
|
+
};
|
|
43
|
+
export type MultiChoiceVariable = AppVariable<readonly string[], 'multiChoice'> & {
|
|
44
|
+
options: readonly ChoiceOption[];
|
|
45
|
+
maxSelected: number;
|
|
46
|
+
};
|
|
47
|
+
/** Search query state; typing replaces history by default. */
|
|
48
|
+
export declare function searchVariable({ key, label, defaultValue, history, }: ScalarVariableOptions): SearchVariable;
|
|
49
|
+
/** Validate labeled choices before controls or URL state consume them. */
|
|
50
|
+
export declare function validateChoiceOptions(options: readonly ChoiceOption[]): void;
|
|
51
|
+
export declare function choiceVariable({ key, label, defaultValue, options, history, }: ScalarVariableOptions & {
|
|
38
52
|
defaultValue: string;
|
|
39
|
-
|
|
40
|
-
}):
|
|
53
|
+
options: readonly ChoiceOption[];
|
|
54
|
+
}): ChoiceVariable;
|
|
55
|
+
export declare function multiChoiceVariable({ key, label, defaultValue, options, maxSelected, history, }: Omit<ScalarVariableOptions, 'defaultValue'> & {
|
|
56
|
+
defaultValue?: readonly string[];
|
|
57
|
+
options: readonly ChoiceOption[];
|
|
58
|
+
maxSelected?: number;
|
|
59
|
+
}): MultiChoiceVariable;
|
|
41
60
|
export type DateRangeSelection = {
|
|
42
61
|
kind: 'preset';
|
|
43
62
|
id: DatePresetId;
|
|
@@ -50,10 +69,8 @@ export type DateRangeSelection = {
|
|
|
50
69
|
};
|
|
51
70
|
export type DateRangeVariableOptions = {
|
|
52
71
|
label?: string;
|
|
53
|
-
/** URL key for a relative preset; explicit dates use
|
|
72
|
+
/** URL key for a relative preset; explicit dates use start/end for period, otherwise key-prefixed fields. */
|
|
54
73
|
key: string;
|
|
55
|
-
startKey?: string;
|
|
56
|
-
endKey?: string;
|
|
57
74
|
defaultValue: DateRangeSelection & {
|
|
58
75
|
comparison?: never;
|
|
59
76
|
};
|
|
@@ -61,9 +78,8 @@ export type DateRangeVariableOptions = {
|
|
|
61
78
|
history?: HistoryMode;
|
|
62
79
|
/** Opt into a URL-backed comparison with the preceding equal-length range. */
|
|
63
80
|
comparison?: boolean;
|
|
64
|
-
comparisonKey?: string;
|
|
65
81
|
};
|
|
66
|
-
export type DateRangeVariable = AppVariable<DateRangeSelection> & {
|
|
82
|
+
export type DateRangeVariable = AppVariable<DateRangeSelection, 'dateRange'> & {
|
|
67
83
|
kind: 'dateRange';
|
|
68
84
|
supportsComparison: boolean;
|
|
69
85
|
input: (selection: DateRangeSelection) => DateRangeRequest;
|
|
@@ -79,4 +95,4 @@ export type DateRangeVariable = AppVariable<DateRangeSelection> & {
|
|
|
79
95
|
comparisonRange: (selection: DateRangeSelection) => DateRange | null;
|
|
80
96
|
};
|
|
81
97
|
/** A date variable keeps relative presets relative and validates exact dates against source coverage. */
|
|
82
|
-
export declare function dateRangeVariable({ key, label,
|
|
98
|
+
export declare function dateRangeVariable({ key, label, defaultValue, contract, history, comparison, }: DateRangeVariableOptions): DateRangeVariable;
|
|
@@ -4,7 +4,8 @@ export type DataAppSource = {
|
|
|
4
4
|
url: string;
|
|
5
5
|
} | {
|
|
6
6
|
type: 'bundle';
|
|
7
|
-
|
|
7
|
+
/** Omit to use the packaged, network-isolated data document. */
|
|
8
|
+
bootstrapUrl?: string;
|
|
8
9
|
javascript: string;
|
|
9
10
|
};
|
|
10
11
|
export type DataAppSourceOptions = DataAppHostOptions & {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Ref } from 'react';
|
|
2
|
+
import type { Theme } from '../../core/appearance.js';
|
|
3
|
+
import { type DataAppAnnotationDraft } from '../../core/annotations.js';
|
|
4
|
+
export type AnnotationBarHandle = {
|
|
5
|
+
/** Submit through the same guards, pending state, and retry feedback as the Send button. */
|
|
6
|
+
send: () => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export type AnnotationBarProps = {
|
|
9
|
+
ref?: Ref<AnnotationBarHandle>;
|
|
10
|
+
annotations: readonly DataAppAnnotationDraft[];
|
|
11
|
+
active?: boolean;
|
|
12
|
+
theme?: Theme;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
deletedAnnotationId?: string;
|
|
15
|
+
onUndoDelete?: (id: string) => void;
|
|
16
|
+
onDismissUndo?: () => void;
|
|
17
|
+
hasUnsavedChanges?: boolean;
|
|
18
|
+
pinsVisible: boolean;
|
|
19
|
+
onPinsVisibleChange: (visible: boolean) => void;
|
|
20
|
+
onSelect: (id: string) => void;
|
|
21
|
+
onDelete: (id: string) => void;
|
|
22
|
+
onClear: () => void;
|
|
23
|
+
/** Let host apps use their existing confirmation dialog. */
|
|
24
|
+
requestDiscard?: (discard: () => void) => void;
|
|
25
|
+
/** Resolve only after the outer application's agent API accepts this snapshot. */
|
|
26
|
+
onSend: (annotations: readonly DataAppAnnotationDraft[]) => Promise<void>;
|
|
27
|
+
onClose: () => void;
|
|
28
|
+
};
|
|
29
|
+
/** Host-owned batch controls. Collection changes and agent submission stay with the outer app. */
|
|
30
|
+
export declare function AnnotationBar({ ref, annotations, active, theme, disabled, deletedAnnotationId, onUndoDelete, onDismissUndo, hasUnsavedChanges, pinsVisible, onPinsVisibleChange, onSelect, onDelete, onClear, requestDiscard, onSend, onClose, }: AnnotationBarProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ComponentRef, type RefObject } from 'react';
|
|
2
|
+
import type { DataAppAnnotationPresentation } from '../../core/annotations.js';
|
|
3
|
+
type AnnotationControlsProps = {
|
|
4
|
+
rootRef: RefObject<ComponentRef<'div'> | null>;
|
|
5
|
+
presentation: DataAppAnnotationPresentation;
|
|
6
|
+
displayedInput?: unknown;
|
|
7
|
+
view?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function AnnotationControls({ rootRef, presentation, displayedInput, view, }: AnnotationControlsProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentRef, CSSProperties, Ref } from 'react';
|
|
2
|
+
import type { AnnotationEditorState } from './annotation-editor-state.js';
|
|
3
|
+
type AnnotationEditorProps = {
|
|
4
|
+
editor: AnnotationEditorState;
|
|
5
|
+
editorRef: Ref<ComponentRef<'section'>>;
|
|
6
|
+
textareaRef: Ref<ComponentRef<'textarea'>>;
|
|
7
|
+
style: CSSProperties;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
onCommentChange: (comment: string) => void;
|
|
10
|
+
onSubmit: () => void;
|
|
11
|
+
onSend: () => void;
|
|
12
|
+
onRetryScreenshot: () => void;
|
|
13
|
+
onShakeEnd: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare function AnnotationEditor({ editor, editorRef, textareaRef, style, disabled, onCommentChange, onSubmit, onSend, onRetryScreenshot, onShakeEnd, }: AnnotationEditorProps): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AnnotationPoint, AnnotationRect } from './annotation-targets.js';
|
|
2
|
+
export type AnnotationPin = {
|
|
3
|
+
id: string;
|
|
4
|
+
number: number;
|
|
5
|
+
anchor: AnnotationPoint;
|
|
6
|
+
rect: AnnotationRect;
|
|
7
|
+
};
|
|
8
|
+
type AnnotationMarkersProps = {
|
|
9
|
+
outline?: AnnotationRect;
|
|
10
|
+
rounded: boolean;
|
|
11
|
+
pins: AnnotationPin[];
|
|
12
|
+
pinsVisible: boolean;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
showHint: boolean;
|
|
15
|
+
hasDuplicateIds: boolean;
|
|
16
|
+
onOpenAnnotation: (id: string) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare function AnnotationMarkers({ outline, rounded, pins, pinsVisible, disabled, showHint, hasDuplicateIds, onOpenAnnotation, }: AnnotationMarkersProps): import("react").JSX.Element;
|
|
19
|
+
export {};
|