@altertable/data-app 0.70.0 → 0.71.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 +7 -1
- package/CONTRIBUTING.md +59 -26
- package/README.md +22 -26
- package/REFERENCE.md +1900 -0
- package/dist/chunks/index-5a27erdg.js +54 -0
- package/dist/chunks/index-5a27erdg.js.map +10 -0
- package/dist/chunks/{index-58kks6a8.js → index-9yxr7nmm.js} +330 -21
- package/dist/chunks/index-9yxr7nmm.js.map +17 -0
- package/dist/chunks/{index-wjt6cavj.js → index-j5q5n3ra.js} +5 -5
- package/dist/chunks/index-j5q5n3ra.js.map +10 -0
- package/dist/chunks/{index-22d576sn.js → index-q75zm3a7.js} +3 -3
- package/dist/chunks/{index-22d576sn.js.map → index-q75zm3a7.js.map} +3 -3
- package/dist/chunks/{index-9zqbrv2z.js → index-vhaec7m5.js} +4 -6
- package/dist/chunks/index-vhaec7m5.js.map +10 -0
- package/dist/chunks/{index-q1w84fv9.js → index-zp78caex.js} +345 -84
- package/dist/chunks/index-zp78caex.js.map +19 -0
- package/dist/client/index.js +284 -16
- package/dist/client/index.js.map +7 -3
- package/dist/core/appearance.js +181 -11
- package/dist/core/appearance.js.map +4 -3
- package/dist/core/config.js +3 -3
- package/dist/core/contract.js +10 -12
- package/dist/core/contract.js.map +1 -1
- package/dist/core/format.js +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/internal.js +418 -0
- package/dist/internal.js.map +15 -0
- package/dist/server/index.js +102 -0
- package/dist/server/index.js.map +10 -0
- package/dist/types/client/annotations.d.ts +1 -1
- package/dist/types/client/iframe.d.ts +6 -6
- package/dist/types/client/index.d.ts +3 -4
- package/dist/types/client/location.d.ts +2 -2
- package/dist/types/client/logger.d.ts +1 -1
- package/dist/types/client/navigation.d.ts +1 -1
- package/dist/types/client/transport.d.ts +1 -1
- package/dist/types/core/bridge.d.ts +1 -1
- package/dist/types/core/filters.d.ts +1 -1
- package/dist/types/core/format.d.ts +1 -2
- package/dist/types/core/messages.d.ts +3 -3
- package/dist/types/core/operation-types.d.ts +1 -1
- package/dist/types/core/presentation.d.ts +1 -1
- package/dist/types/core/reading.d.ts +1 -1
- package/dist/types/internal.d.ts +22 -0
- package/dist/types/server/index.d.ts +1 -2
- package/docs/app-authoring.md +2 -1
- package/docs/contract.md +1 -1
- package/docs/data-context.md +3 -3
- package/docs/embed.md +4 -4
- package/docs/formatting-and-appearance.md +1 -1
- package/docs/hosted-apps.md +4 -0
- package/docs/react-embed.md +7 -6
- package/docs/react.md +5 -5
- package/docs/server-bun.md +5 -5
- package/docs/stories-and-export.md +3 -3
- package/docs/styling.md +2 -2
- package/docs/ui.md +6 -6
- package/docs/views.md +1 -1
- package/docs/widgets.md +4 -4
- package/docs/worker.md +4 -4
- package/examples/starter-data-app/index.tsx +1 -1
- package/examples/starter-local-data-app/AGENTS.md +1 -1
- package/examples/starter-local-data-app/README.md +12 -10
- package/examples/starter-local-data-app/package.json +3 -1
- package/examples/starter-local-data-app/src/App.tsx +1 -1
- package/examples/starter-local-data-app/src/data-context.ts +1 -1
- package/examples/starter-local-data-app/src/main.tsx +1 -1
- package/examples/starter-local-data-app/src/server.ts +1 -1
- package/package.json +16 -92
- package/THIRD_PARTY_NOTICES +0 -18
- package/dist/chunks/index-2ajhmsc4.js +0 -355
- package/dist/chunks/index-2ajhmsc4.js.map +0 -13
- package/dist/chunks/index-58kks6a8.js.map +0 -13
- package/dist/chunks/index-7q99hf1z.js +0 -87
- package/dist/chunks/index-7q99hf1z.js.map +0 -10
- package/dist/chunks/index-9zqbrv2z.js.map +0 -10
- package/dist/chunks/index-cv36cyna.js +0 -180
- package/dist/chunks/index-cv36cyna.js.map +0 -10
- package/dist/chunks/index-q1w84fv9.js.map +0 -15
- package/dist/chunks/index-rew95tbg.js +0 -272
- package/dist/chunks/index-rew95tbg.js.map +0 -13
- package/dist/chunks/index-vtpygsbq.js +0 -17270
- package/dist/chunks/index-vtpygsbq.js.map +0 -126
- package/dist/chunks/index-wjt6cavj.js.map +0 -10
- package/dist/chunks/index-wss3gd3h.js +0 -319
- package/dist/chunks/index-wss3gd3h.js.map +0 -13
- package/dist/chunks/index-xzb7sx6g.js +0 -221
- package/dist/chunks/index-xzb7sx6g.js.map +0 -12
- package/dist/embed/index.js +0 -138
- package/dist/embed/index.js.map +0 -12
- package/dist/local.js +0 -465
- package/dist/local.js.map +0 -16
- package/dist/preview.js +0 -1456
- package/dist/preview.js.map +0 -17
- package/dist/react/embed/index.js +0 -117
- package/dist/react/embed/index.js.map +0 -10
- package/dist/react/index.js +0 -2890
- package/dist/react/index.js.map +0 -23
- package/dist/react/ui/index.js +0 -3514
- package/dist/react/ui/index.js.map +0 -36
- package/dist/server.js +0 -334
- package/dist/server.js.map +0 -15
- package/dist/types/core/time-interval.d.ts +0 -96
- package/dist/types/embed/bootstrap.d.ts +0 -5
- package/dist/types/embed/bridge.d.ts +0 -12
- package/dist/types/embed/host.d.ts +0 -36
- package/dist/types/embed/index.d.ts +0 -14
- package/dist/types/embed/navigation.d.ts +0 -6
- package/dist/types/embed/runtime-html.d.ts +0 -2
- package/dist/types/embed/source.d.ts +0 -16
- package/dist/types/embed/sql.d.ts +0 -4
- package/dist/types/react/actions.d.ts +0 -53
- package/dist/types/react/annotations/AnnotationBar.d.ts +0 -30
- package/dist/types/react/annotations/AnnotationControls.d.ts +0 -10
- package/dist/types/react/annotations/AnnotationEditor.d.ts +0 -16
- package/dist/types/react/annotations/AnnotationMarkers.d.ts +0 -19
- package/dist/types/react/annotations/AnnotationSelectionLayer.d.ts +0 -12
- package/dist/types/react/annotations/AnnotationTarget.d.ts +0 -9
- package/dist/types/react/annotations/AnnotationTooltip.d.ts +0 -9
- package/dist/types/react/annotations/AnnotationTrigger.d.ts +0 -10
- package/dist/types/react/annotations/annotation-editor-state.d.ts +0 -58
- package/dist/types/react/annotations/annotation-screenshot.d.ts +0 -4
- package/dist/types/react/annotations/annotation-targets.d.ts +0 -34
- package/dist/types/react/annotations/getAnnotationProps.d.ts +0 -17
- package/dist/types/react/annotations/styles.d.ts +0 -3
- package/dist/types/react/annotations/useAnnotationGeometry.d.ts +0 -22
- package/dist/types/react/annotations/useDataAppAnnotations.d.ts +0 -22
- package/dist/types/react/app-context.d.ts +0 -3
- package/dist/types/react/bindings.d.ts +0 -169
- package/dist/types/react/content.d.ts +0 -36
- package/dist/types/react/date-formatting.d.ts +0 -12
- package/dist/types/react/details.d.ts +0 -46
- package/dist/types/react/embed/bridge.d.ts +0 -21
- package/dist/types/react/embed/index.d.ts +0 -7
- package/dist/types/react/exploration.d.ts +0 -44
- package/dist/types/react/hooks.d.ts +0 -113
- package/dist/types/react/index.d.ts +0 -78
- package/dist/types/react/injectStyles.d.ts +0 -7
- package/dist/types/react/mount.d.ts +0 -13
- package/dist/types/react/search-suggestions.d.ts +0 -8
- package/dist/types/react/source-owner.d.ts +0 -2
- package/dist/types/react/style-contract.d.ts +0 -88
- package/dist/types/react/style-validation.d.ts +0 -2
- package/dist/types/react/styles.d.ts +0 -8
- package/dist/types/react/ui/AboutData.d.ts +0 -73
- package/dist/types/react/ui/AltertableLogo.d.ts +0 -3
- package/dist/types/react/ui/AppFooter.d.ts +0 -6
- package/dist/types/react/ui/AppHeader.d.ts +0 -10
- package/dist/types/react/ui/AppLayout.d.ts +0 -10
- package/dist/types/react/ui/AppScope.d.ts +0 -7
- package/dist/types/react/ui/AppToolbar.d.ts +0 -30
- package/dist/types/react/ui/AreaChart.d.ts +0 -7
- package/dist/types/react/ui/BarChart.d.ts +0 -6
- package/dist/types/react/ui/Breakdown.d.ts +0 -13
- package/dist/types/react/ui/Button.d.ts +0 -12
- package/dist/types/react/ui/ChartLegend.d.ts +0 -32
- package/dist/types/react/ui/Checkbox.d.ts +0 -21
- package/dist/types/react/ui/CheckboxGroup.d.ts +0 -7
- package/dist/types/react/ui/ChoicePicker.d.ts +0 -39
- package/dist/types/react/ui/Comparison.d.ts +0 -14
- package/dist/types/react/ui/ComposedChart.d.ts +0 -41
- package/dist/types/react/ui/ComposedChartLegend.d.ts +0 -9
- package/dist/types/react/ui/ContentSkeleton.d.ts +0 -7
- package/dist/types/react/ui/DataApp.d.ts +0 -24
- package/dist/types/react/ui/DataAppFrame.d.ts +0 -52
- package/dist/types/react/ui/DataBoundary.d.ts +0 -14
- package/dist/types/react/ui/DataSection.d.ts +0 -14
- package/dist/types/react/ui/DataSectionBoundary.d.ts +0 -30
- package/dist/types/react/ui/DataTable.d.ts +0 -29
- package/dist/types/react/ui/DataValue.d.ts +0 -9
- package/dist/types/react/ui/DataViewToast.d.ts +0 -11
- package/dist/types/react/ui/DataWidget.d.ts +0 -37
- package/dist/types/react/ui/DateDisplay.d.ts +0 -9
- package/dist/types/react/ui/DateRangePicker.d.ts +0 -30
- package/dist/types/react/ui/DateTimeTooltip.d.ts +0 -10
- package/dist/types/react/ui/DimensionPicker.d.ts +0 -13
- package/dist/types/react/ui/EmptyState.d.ts +0 -6
- package/dist/types/react/ui/ExplorationActionControl.d.ts +0 -60
- package/dist/types/react/ui/ExportControl.d.ts +0 -4
- package/dist/types/react/ui/FilterActions.d.ts +0 -10
- package/dist/types/react/ui/FilterBar.d.ts +0 -3
- package/dist/types/react/ui/FunnelChart.d.ts +0 -20
- package/dist/types/react/ui/GettingStarted.d.ts +0 -6
- package/dist/types/react/ui/GlossaryDefinition.d.ts +0 -7
- package/dist/types/react/ui/GlossaryExplanation.d.ts +0 -16
- package/dist/types/react/ui/GradientScroll.d.ts +0 -23
- package/dist/types/react/ui/Grid.d.ts +0 -12
- package/dist/types/react/ui/GridItem.d.ts +0 -7
- package/dist/types/react/ui/HelpPopover.d.ts +0 -21
- package/dist/types/react/ui/IconButton.d.ts +0 -19
- package/dist/types/react/ui/InspectionContext.d.ts +0 -12
- package/dist/types/react/ui/InspectionProvider.d.ts +0 -29
- package/dist/types/react/ui/JourneyChart.d.ts +0 -10
- package/dist/types/react/ui/Kbd.d.ts +0 -7
- package/dist/types/react/ui/LineChart.d.ts +0 -7
- package/dist/types/react/ui/LiveControl.d.ts +0 -10
- package/dist/types/react/ui/Menu.d.ts +0 -13
- package/dist/types/react/ui/MetricWidget.d.ts +0 -51
- package/dist/types/react/ui/NumberField.d.ts +0 -27
- package/dist/types/react/ui/NumberFilterPicker.d.ts +0 -11
- package/dist/types/react/ui/PeriodSummary.d.ts +0 -17
- package/dist/types/react/ui/PickerField.d.ts +0 -23
- package/dist/types/react/ui/PieChart.d.ts +0 -11
- package/dist/types/react/ui/PopoverSurface.d.ts +0 -5
- package/dist/types/react/ui/PresentStory.d.ts +0 -30
- package/dist/types/react/ui/QueryList.d.ts +0 -14
- package/dist/types/react/ui/RadioGroup.d.ts +0 -18
- package/dist/types/react/ui/Ranking.d.ts +0 -13
- package/dist/types/react/ui/RefreshControl.d.ts +0 -9
- package/dist/types/react/ui/RequestHint.d.ts +0 -20
- package/dist/types/react/ui/RetentionChart.d.ts +0 -27
- package/dist/types/react/ui/ScatterChart.d.ts +0 -17
- package/dist/types/react/ui/SearchField.d.ts +0 -23
- package/dist/types/react/ui/SearchInput.d.ts +0 -10
- package/dist/types/react/ui/SearchMatch.d.ts +0 -6
- package/dist/types/react/ui/SearchTypeahead.d.ts +0 -15
- package/dist/types/react/ui/SectionHeading.d.ts +0 -8
- package/dist/types/react/ui/Select.d.ts +0 -22
- package/dist/types/react/ui/SelectionMark.d.ts +0 -5
- package/dist/types/react/ui/Sheet.d.ts +0 -21
- package/dist/types/react/ui/Skeleton.d.ts +0 -8
- package/dist/types/react/ui/Stack.d.ts +0 -7
- package/dist/types/react/ui/StaticDataApp.d.ts +0 -4
- package/dist/types/react/ui/StatusPanel.d.ts +0 -10
- package/dist/types/react/ui/TableWidget.d.ts +0 -67
- package/dist/types/react/ui/Tabs.d.ts +0 -10
- package/dist/types/react/ui/TextContent.d.ts +0 -4
- package/dist/types/react/ui/TextWidget.d.ts +0 -20
- package/dist/types/react/ui/ThemeSelector.d.ts +0 -12
- package/dist/types/react/ui/Toast.d.ts +0 -8
- package/dist/types/react/ui/Tooltip.d.ts +0 -23
- package/dist/types/react/ui/TooltipSurface.d.ts +0 -3
- package/dist/types/react/ui/TrendChart.d.ts +0 -5
- package/dist/types/react/ui/UpdatedAt.d.ts +0 -9
- package/dist/types/react/ui/VariableBar.d.ts +0 -6
- package/dist/types/react/ui/VisualizationWidget.d.ts +0 -43
- package/dist/types/react/ui/WidgetDisclosure.d.ts +0 -6
- package/dist/types/react/ui/WidgetEvidence.d.ts +0 -12
- package/dist/types/react/ui/WidgetViewTabs.d.ts +0 -16
- package/dist/types/react/ui/chart-data.d.ts +0 -36
- package/dist/types/react/ui/chart-date-axis.d.ts +0 -15
- package/dist/types/react/ui/chart-interaction.d.ts +0 -27
- package/dist/types/react/ui/chart-primitives.d.ts +0 -22
- package/dist/types/react/ui/chart-time.d.ts +0 -19
- package/dist/types/react/ui/chartColor.d.ts +0 -2
- package/dist/types/react/ui/classNames.d.ts +0 -1
- package/dist/types/react/ui/csv-export.d.ts +0 -19
- package/dist/types/react/ui/data-context.d.ts +0 -76
- package/dist/types/react/ui/data-identifiers.d.ts +0 -32
- package/dist/types/react/ui/icons.d.ts +0 -49
- package/dist/types/react/ui/index.d.ts +0 -111
- package/dist/types/react/ui/journey-flow.d.ts +0 -49
- package/dist/types/react/ui/keyboard.d.ts +0 -6
- package/dist/types/react/ui/metric-comparison.d.ts +0 -30
- package/dist/types/react/ui/metric.d.ts +0 -11
- package/dist/types/react/ui/presentation.d.ts +0 -25
- package/dist/types/react/ui/search.d.ts +0 -6
- package/dist/types/react/ui/searchItems.d.ts +0 -36
- package/dist/types/react/ui/shortcuts.d.ts +0 -45
- package/dist/types/react/ui/story.d.ts +0 -20
- package/dist/types/react/ui/use-chart-scroll-to-end.d.ts +0 -2
- package/dist/types/react/ui/useAppAppearance.d.ts +0 -3
- package/dist/types/react/ui/useDataAppPresentation.d.ts +0 -3
- package/dist/types/react/ui/useSvgId.d.ts +0 -2
- package/dist/types/react/ui/variables.d.ts +0 -38
- package/dist/types/react/ui/widget-views.d.ts +0 -3
- package/dist/types/react/view-control-bar.d.ts +0 -18
- package/dist/types/react/view-controls.d.ts +0 -20
- package/dist/types/react/view-runtime.d.ts +0 -34
- package/dist/types/react/view.d.ts +0 -87
- package/dist/types/react/widgets.d.ts +0 -90
- package/dist/types/server/local.d.ts +0 -19
- package/dist/types/server/preview/host.d.ts +0 -1
- package/dist/types/server/preview/index.d.ts +0 -16
- package/dist/types/server/reload-channel.d.ts +0 -6
- package/dist/worker.js +0 -106
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"check": "bun run lint && bun run format:check && bun run build"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@altertable/data-app": "
|
|
19
|
+
"@altertable/data-app": "0.71.0",
|
|
20
|
+
"@altertable/data-app-bun": "0.71.0",
|
|
21
|
+
"@altertable/data-app-react": "0.71.0",
|
|
20
22
|
"react": "19.3.0",
|
|
21
23
|
"react-dom": "19.3.0"
|
|
22
24
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GettingStarted } from "@altertable/data-app
|
|
1
|
+
import { GettingStarted } from "@altertable/data-app-react/ui";
|
|
2
2
|
import { dataContext } from "#app/data-context.ts";
|
|
3
3
|
|
|
4
4
|
/** Connectivity-only screen. Investigate the requested question, then replace this with a view
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altertable/data-app",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.71.0",
|
|
4
|
+
"description": "Portable definitions, contracts, formatting, browser clients, and request handlers for Altertable data apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"altertable",
|
|
7
7
|
"analytics",
|
|
@@ -20,20 +20,18 @@
|
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "git+https://github.com/altertable-ai/data-app.git"
|
|
23
|
+
"url": "git+https://github.com/altertable-ai/data-app.git",
|
|
24
|
+
"directory": "packages/data-app"
|
|
24
25
|
},
|
|
25
|
-
"workspaces": [
|
|
26
|
-
"examples/starter-local-data-app"
|
|
27
|
-
],
|
|
28
26
|
"files": [
|
|
29
27
|
"dist",
|
|
30
|
-
"docs",
|
|
31
|
-
"examples/starter-data-app",
|
|
32
|
-
"examples/starter-local-data-app",
|
|
33
28
|
"README.md",
|
|
34
|
-
"
|
|
29
|
+
"LICENSE",
|
|
30
|
+
"docs",
|
|
31
|
+
"examples",
|
|
35
32
|
"AGENTS.md",
|
|
36
|
-
"
|
|
33
|
+
"CONTRIBUTING.md",
|
|
34
|
+
"REFERENCE.md"
|
|
37
35
|
],
|
|
38
36
|
"type": "module",
|
|
39
37
|
"sideEffects": false,
|
|
@@ -64,34 +62,11 @@
|
|
|
64
62
|
},
|
|
65
63
|
"./server": {
|
|
66
64
|
"types": "./dist/types/server/index.d.ts",
|
|
67
|
-
"import": "./dist/server.js"
|
|
68
|
-
},
|
|
69
|
-
"./server/bun": {
|
|
70
|
-
"types": "./dist/types/server/local.d.ts",
|
|
71
|
-
"import": "./dist/local.js"
|
|
72
|
-
},
|
|
73
|
-
"./server/bun/preview": {
|
|
74
|
-
"types": "./dist/types/server/preview/index.d.ts",
|
|
75
|
-
"import": "./dist/preview.js"
|
|
65
|
+
"import": "./dist/server/index.js"
|
|
76
66
|
},
|
|
77
|
-
"./
|
|
78
|
-
"types": "./dist/types/
|
|
79
|
-
"import": "./dist/
|
|
80
|
-
},
|
|
81
|
-
"./embed": {
|
|
82
|
-
"types": "./dist/types/embed/index.d.ts",
|
|
83
|
-
"import": "./dist/embed/index.js"
|
|
84
|
-
},
|
|
85
|
-
"./worker": {
|
|
86
|
-
"default": "./dist/worker.js"
|
|
87
|
-
},
|
|
88
|
-
"./react/embed": {
|
|
89
|
-
"types": "./dist/types/react/embed/index.d.ts",
|
|
90
|
-
"import": "./dist/react/embed/index.js"
|
|
91
|
-
},
|
|
92
|
-
"./react/ui": {
|
|
93
|
-
"types": "./dist/types/react/ui/index.d.ts",
|
|
94
|
-
"import": "./dist/react/ui/index.js"
|
|
67
|
+
"./internal": {
|
|
68
|
+
"types": "./dist/types/internal.d.ts",
|
|
69
|
+
"import": "./dist/internal.js"
|
|
95
70
|
}
|
|
96
71
|
},
|
|
97
72
|
"publishConfig": {
|
|
@@ -99,60 +74,9 @@
|
|
|
99
74
|
"registry": "https://registry.npmjs.org"
|
|
100
75
|
},
|
|
101
76
|
"scripts": {
|
|
102
|
-
"build": "bun
|
|
103
|
-
"dev": "bun run scripts/dev.ts",
|
|
104
|
-
"dev:file": "bun run scripts/dev-file.ts",
|
|
105
|
-
"dev:dir": "bun run scripts/dev-dir.ts",
|
|
106
|
-
"typecheck": "bun install --frozen-lockfile && tsc --noEmit",
|
|
107
|
-
"lint": "oxlint --type-aware src tests scripts dev examples/starter-data-app vitest.config.ts",
|
|
108
|
-
"format": "oxfmt .",
|
|
109
|
-
"format:check": "oxfmt --check .",
|
|
110
|
-
"test": "vitest run",
|
|
111
|
-
"check": "bun run build && bun run typecheck && bun run lint && bun run check:styles && bun run lint:md && bun run check:links && bun run format:check && bun run test && bun run check:package && bun run check:starter",
|
|
112
|
-
"check:package": "bun run scripts/check-package.ts",
|
|
113
|
-
"check:workflows": "bash scripts/check-workflows.sh",
|
|
114
|
-
"lint:fix": "oxlint --type-aware --fix src tests scripts dev vitest.config.ts",
|
|
115
|
-
"check:starter": "bun run scripts/check-starter.ts",
|
|
116
|
-
"lint:md": "markdownlint-cli2",
|
|
117
|
-
"check:links": "remark . --ext md --rc-path .remarkrc.json --frail --no-stdout",
|
|
118
|
-
"check:links:external": "remark . --ext md --rc-path .remarkrc-external.json --frail --no-stdout",
|
|
119
|
-
"check:styles": "bun run scripts/check-app-styles.ts"
|
|
77
|
+
"build": "bun ../../scripts/build.ts data-app"
|
|
120
78
|
},
|
|
121
79
|
"dependencies": {
|
|
122
|
-
"@
|
|
123
|
-
|
|
124
|
-
"@internationalized/date": "3.12.4",
|
|
125
|
-
"@tanstack/react-query": "5.104.0",
|
|
126
|
-
"fflate": "0.8.3",
|
|
127
|
-
"fuzzysort": "4.0.2",
|
|
128
|
-
"html-to-image": "1.11.13",
|
|
129
|
-
"lucide-react": "1.48.0",
|
|
130
|
-
"react-aria-components": "1.21.1",
|
|
131
|
-
"recharts": "3.10.1"
|
|
132
|
-
},
|
|
133
|
-
"devDependencies": {
|
|
134
|
-
"@types/bun": "1.4.2",
|
|
135
|
-
"@types/react": "19.3.0",
|
|
136
|
-
"@types/react-dom": "19.3.0",
|
|
137
|
-
"get-tsconfig": "4.14.3",
|
|
138
|
-
"markdownlint-cli2": "0.23.3",
|
|
139
|
-
"oxfmt": "0.70.0",
|
|
140
|
-
"oxlint": "1.85.0",
|
|
141
|
-
"oxlint-tsgolint": "7.0.2003",
|
|
142
|
-
"playwright": "1.63.0",
|
|
143
|
-
"react": "19.3.0",
|
|
144
|
-
"react-dom": "19.3.0",
|
|
145
|
-
"remark-cli": "12.0.1",
|
|
146
|
-
"remark-gfm": "4.0.1",
|
|
147
|
-
"remark-lint-no-dead-urls": "2.0.1",
|
|
148
|
-
"remark-validate-links": "13.1.0",
|
|
149
|
-
"testcontainers": "12.2.0",
|
|
150
|
-
"typescript": "7.0.2",
|
|
151
|
-
"vitest": "4.1.11"
|
|
152
|
-
},
|
|
153
|
-
"peerDependencies": {
|
|
154
|
-
"react": ">=19.2.0",
|
|
155
|
-
"react-dom": ">=19.2.0"
|
|
156
|
-
},
|
|
157
|
-
"packageManager": "bun@1.4.2"
|
|
80
|
+
"@internationalized/date": "3.12.4"
|
|
81
|
+
}
|
|
158
82
|
}
|
package/THIRD_PARTY_NOTICES
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
d3-time 3.1.0 and d3-array 3.2.4
|
|
2
|
-
https://github.com/d3/d3-time
|
|
3
|
-
https://github.com/d3/d3-array
|
|
4
|
-
|
|
5
|
-
Copyright 2010-2022 Mike Bostock (d3-time)
|
|
6
|
-
Copyright 2010-2023 Mike Bostock (d3-array tick-step helpers)
|
|
7
|
-
|
|
8
|
-
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
9
|
-
with or without fee is hereby granted, provided that the above copyright notice
|
|
10
|
-
and this permission notice appear in all copies.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
14
|
-
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
16
|
-
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
17
|
-
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
18
|
-
THIS SOFTWARE.
|
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
randomUuid,
|
|
3
|
-
PARENT_PARAM,
|
|
4
|
-
MAX_PENDING,
|
|
5
|
-
REQUEST_TIMEOUT_MS,
|
|
6
|
-
validId,
|
|
7
|
-
createBridgeEndpoint
|
|
8
|
-
} from "./index-wss3gd3h.js";
|
|
9
|
-
import {
|
|
10
|
-
MessageRoutingError2
|
|
11
|
-
} from "./index-rew95tbg.js";
|
|
12
|
-
|
|
13
|
-
// src/embed/host.ts
|
|
14
|
-
function attachDataAppConnection({
|
|
15
|
-
iframe,
|
|
16
|
-
connection,
|
|
17
|
-
javascript,
|
|
18
|
-
presentation,
|
|
19
|
-
logger,
|
|
20
|
-
onStatusChange,
|
|
21
|
-
onDiagnostic,
|
|
22
|
-
onMessage,
|
|
23
|
-
window: host = window
|
|
24
|
-
}) {
|
|
25
|
-
const frameOrigin = connection.type === "origin" ? connection.origin : "null";
|
|
26
|
-
if (connection.type === "origin" && new URL(frameOrigin).origin !== frameOrigin)
|
|
27
|
-
throw new Error("Expected an exact frame origin.");
|
|
28
|
-
if (connection.type === "opaque" && !validId(connection.token))
|
|
29
|
-
throw new Error("Invalid sandbox token.");
|
|
30
|
-
let token = connection.type === "opaque" ? connection.token : undefined;
|
|
31
|
-
const targetOrigin = connection.type === "opaque" ? "*" : frameOrigin;
|
|
32
|
-
let currentPresentation;
|
|
33
|
-
let presentationIdentity;
|
|
34
|
-
let annotationDismissal;
|
|
35
|
-
let disposed = false;
|
|
36
|
-
let documentId;
|
|
37
|
-
let sessionId;
|
|
38
|
-
const pending = new Map;
|
|
39
|
-
const requestStartedAt = new Map;
|
|
40
|
-
function reportDiagnostic(event) {
|
|
41
|
-
if (!onDiagnostic)
|
|
42
|
-
return;
|
|
43
|
-
if (event.direction === "drop" || !event.id)
|
|
44
|
-
return onDiagnostic(event);
|
|
45
|
-
switch (event.type) {
|
|
46
|
-
case "bridge:request":
|
|
47
|
-
if (!requestStartedAt.has(event.id) && requestStartedAt.size < MAX_PENDING * 2)
|
|
48
|
-
requestStartedAt.set(event.id, host.performance.now());
|
|
49
|
-
break;
|
|
50
|
-
case "bridge:cancel":
|
|
51
|
-
requestStartedAt.delete(event.id);
|
|
52
|
-
break;
|
|
53
|
-
case "bridge:result":
|
|
54
|
-
case "bridge:error": {
|
|
55
|
-
const startedAt = requestStartedAt.get(event.id);
|
|
56
|
-
requestStartedAt.delete(event.id);
|
|
57
|
-
if (startedAt !== undefined)
|
|
58
|
-
return onDiagnostic({
|
|
59
|
-
...event,
|
|
60
|
-
durationMs: Math.round(host.performance.now() - startedAt)
|
|
61
|
-
});
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
onDiagnostic(event);
|
|
66
|
-
}
|
|
67
|
-
function hostState() {
|
|
68
|
-
const presentation = currentPresentation?.annotations && annotationDismissal ? {
|
|
69
|
-
...currentPresentation,
|
|
70
|
-
annotations: {
|
|
71
|
-
...currentPresentation.annotations,
|
|
72
|
-
dismissal: annotationDismissal
|
|
73
|
-
}
|
|
74
|
-
} : currentPresentation;
|
|
75
|
-
return {
|
|
76
|
-
search: host.location.search,
|
|
77
|
-
hash: host.location.hash,
|
|
78
|
-
...presentation ? { presentation } : {},
|
|
79
|
-
logging: logger !== undefined
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function setLogger(value) {
|
|
83
|
-
if (disposed || value === logger)
|
|
84
|
-
return;
|
|
85
|
-
const wasEnabled = logger !== undefined;
|
|
86
|
-
logger = value;
|
|
87
|
-
if (wasEnabled !== (logger !== undefined))
|
|
88
|
-
publishState();
|
|
89
|
-
}
|
|
90
|
-
function setPresentation(value) {
|
|
91
|
-
if (disposed)
|
|
92
|
-
return;
|
|
93
|
-
const identity = JSON.stringify(value);
|
|
94
|
-
if (identity === presentationIdentity)
|
|
95
|
-
return;
|
|
96
|
-
presentationIdentity = identity;
|
|
97
|
-
currentPresentation = identity === undefined ? undefined : JSON.parse(identity);
|
|
98
|
-
publishState();
|
|
99
|
-
}
|
|
100
|
-
function cancelAll() {
|
|
101
|
-
for (const controller of pending.values())
|
|
102
|
-
controller.abort();
|
|
103
|
-
pending.clear();
|
|
104
|
-
requestStartedAt.clear();
|
|
105
|
-
}
|
|
106
|
-
const endpoint = createBridgeEndpoint({
|
|
107
|
-
role: "host",
|
|
108
|
-
origin: frameOrigin,
|
|
109
|
-
source: () => iframe.contentWindow,
|
|
110
|
-
opaque: connection.type === "opaque",
|
|
111
|
-
context: () => ({ documentId, sessionId, token }),
|
|
112
|
-
post: (message) => iframe.contentWindow?.postMessage(message, targetOrigin),
|
|
113
|
-
diagnostic: reportDiagnostic,
|
|
114
|
-
invalidRequest: (id) => {
|
|
115
|
-
if (pending.has(id))
|
|
116
|
-
return;
|
|
117
|
-
if (pending.size >= MAX_PENDING)
|
|
118
|
-
error(id, "bridge_busy", "Too many pending data requests.");
|
|
119
|
-
else
|
|
120
|
-
error(id, "invalid_message", "Invalid message route.");
|
|
121
|
-
},
|
|
122
|
-
handlers: {
|
|
123
|
-
ready(message) {
|
|
124
|
-
if (message.documentId !== documentId) {
|
|
125
|
-
cancelAll();
|
|
126
|
-
documentId = message.documentId;
|
|
127
|
-
sessionId = randomUuid();
|
|
128
|
-
}
|
|
129
|
-
onStatusChange?.("connected");
|
|
130
|
-
if (disposed)
|
|
131
|
-
return;
|
|
132
|
-
send("initialize", { state: hostState() });
|
|
133
|
-
if (disposed)
|
|
134
|
-
return;
|
|
135
|
-
if (javascript !== undefined)
|
|
136
|
-
send("scriptLoad", { javascript });
|
|
137
|
-
},
|
|
138
|
-
runtimeLog({ payload }) {
|
|
139
|
-
try {
|
|
140
|
-
logger?.[payload.method](...payload.args);
|
|
141
|
-
} catch {}
|
|
142
|
-
},
|
|
143
|
-
runtimeReady() {
|
|
144
|
-
onStatusChange?.("ready");
|
|
145
|
-
},
|
|
146
|
-
runtimeError() {
|
|
147
|
-
onStatusChange?.("failed");
|
|
148
|
-
},
|
|
149
|
-
request(message) {
|
|
150
|
-
request(message);
|
|
151
|
-
},
|
|
152
|
-
cancel(message) {
|
|
153
|
-
pending.get(message.id)?.abort();
|
|
154
|
-
pending.delete(message.id);
|
|
155
|
-
},
|
|
156
|
-
disconnect() {
|
|
157
|
-
cancelAll();
|
|
158
|
-
documentId = undefined;
|
|
159
|
-
sessionId = undefined;
|
|
160
|
-
onStatusChange?.("disconnected");
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
const send = endpoint.send;
|
|
165
|
-
const receive = endpoint.receive;
|
|
166
|
-
function error(id, code, message, requestId) {
|
|
167
|
-
send("error", { id, code, message, requestId });
|
|
168
|
-
}
|
|
169
|
-
async function request(message) {
|
|
170
|
-
const id = message.id;
|
|
171
|
-
if (pending.has(id))
|
|
172
|
-
return;
|
|
173
|
-
if (pending.size >= MAX_PENDING)
|
|
174
|
-
return error(id, "bridge_busy", "Too many pending data requests.");
|
|
175
|
-
try {
|
|
176
|
-
const body = JSON.stringify(message.payload);
|
|
177
|
-
const limit = message.route === "annotation:draft" ? 384000 : 16384;
|
|
178
|
-
if (message.payload !== undefined && (typeof body !== "string" || body.length > limit))
|
|
179
|
-
throw new Error("Invalid payload");
|
|
180
|
-
} catch {
|
|
181
|
-
return error(id, "invalid_payload", "The message payload is invalid or too large.");
|
|
182
|
-
}
|
|
183
|
-
const controller = new AbortController;
|
|
184
|
-
pending.set(id, controller);
|
|
185
|
-
const timer = setTimeout(() => {
|
|
186
|
-
if (pending.get(id) !== controller)
|
|
187
|
-
return;
|
|
188
|
-
pending.delete(id);
|
|
189
|
-
controller.abort();
|
|
190
|
-
error(id, "timeout", "The data request timed out.");
|
|
191
|
-
}, REQUEST_TIMEOUT_MS);
|
|
192
|
-
controller.signal.addEventListener("abort", () => clearTimeout(timer), {
|
|
193
|
-
once: true
|
|
194
|
-
});
|
|
195
|
-
try {
|
|
196
|
-
const response = await onMessage({ route: message.route, payload: message.payload }, { signal: controller.signal });
|
|
197
|
-
if (pending.get(id) === controller)
|
|
198
|
-
send("result", { id, response });
|
|
199
|
-
} catch (failure) {
|
|
200
|
-
if (pending.get(id) === controller) {
|
|
201
|
-
if (failure instanceof MessageRoutingError2)
|
|
202
|
-
error(id, failure.code, failure.message, failure.requestId);
|
|
203
|
-
else
|
|
204
|
-
error(id, "request_failed", "The message request failed. Retry the request.");
|
|
205
|
-
}
|
|
206
|
-
} finally {
|
|
207
|
-
clearTimeout(timer);
|
|
208
|
-
if (pending.get(id) === controller)
|
|
209
|
-
pending.delete(id);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
function publishState() {
|
|
213
|
-
if (disposed || !sessionId)
|
|
214
|
-
return;
|
|
215
|
-
send("stateUpdate", { state: hostState() });
|
|
216
|
-
}
|
|
217
|
-
function publishAnnotationDismissal(event) {
|
|
218
|
-
if (!currentPresentation?.annotations?.enabled || event.composedPath().includes(iframe))
|
|
219
|
-
return;
|
|
220
|
-
annotationDismissal = {
|
|
221
|
-
id: randomUuid(),
|
|
222
|
-
occurredAt: host.performance.timeOrigin + host.performance.now()
|
|
223
|
-
};
|
|
224
|
-
publishState();
|
|
225
|
-
}
|
|
226
|
-
function load() {
|
|
227
|
-
if (connection.type === "opaque")
|
|
228
|
-
token = randomUuid();
|
|
229
|
-
cancelAll();
|
|
230
|
-
documentId = undefined;
|
|
231
|
-
sessionId = undefined;
|
|
232
|
-
onStatusChange?.("connecting");
|
|
233
|
-
send("connect", {});
|
|
234
|
-
}
|
|
235
|
-
function dispose() {
|
|
236
|
-
disposed = true;
|
|
237
|
-
endpoint.dispose();
|
|
238
|
-
cancelAll();
|
|
239
|
-
iframe.removeEventListener("load", load);
|
|
240
|
-
host.removeEventListener("message", receive);
|
|
241
|
-
host.removeEventListener("popstate", publishState);
|
|
242
|
-
host.removeEventListener("pagehide", cancelAll);
|
|
243
|
-
host.removeEventListener("click", publishAnnotationDismissal, true);
|
|
244
|
-
}
|
|
245
|
-
setPresentation(presentation);
|
|
246
|
-
iframe.addEventListener("load", load);
|
|
247
|
-
host.addEventListener("message", receive);
|
|
248
|
-
host.addEventListener("popstate", publishState);
|
|
249
|
-
host.addEventListener("pagehide", cancelAll);
|
|
250
|
-
host.addEventListener("click", publishAnnotationDismissal, true);
|
|
251
|
-
onStatusChange?.("connecting");
|
|
252
|
-
send("connect", {});
|
|
253
|
-
return { dispose, setPresentation, setLogger };
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// src/embed/runtime-html.ts
|
|
257
|
-
var PAGE_CSP = "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; connect-src 'none'; form-action 'none'; base-uri 'none'";
|
|
258
|
-
var inlineBootstrap = '(()=>{function q(){if(typeof crypto.randomUUID==="function")return crypto.randomUUID();let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,(r)=>r.toString(16).padStart(2,"0"));return[t.slice(0,4),t.slice(4,6),t.slice(6,8),t.slice(8,10),t.slice(10)].map((r)=>r.join("")).join("-")}function Y(e){if(!e||typeof e!=="object")return!1;let t=e;return(t.method==="log"||t.method==="info"||t.method==="warn"||t.method==="error")&&Array.isArray(t.args)&&t.args.length<=128}var C="altertable:data-app";var Z=128,ee=60000;function T(e){return typeof e==="string"&&/^[a-zA-Z0-9_-]{1,128}$/.test(e)}function w({wire:e,from:t,session:r,parse:n}){return{wire:e,from:t,session:r,parse:n}}function F(e){if(!T(e.id))throw Error("Invalid request ID.");return e.id}function S(e,t){let r=e[t];if(typeof r!=="string")throw Error(`Invalid ${t}.`);return r}function O(){return{}}var h={channel:C,version:1,events:{connect:w({wire:"bridge:connect",from:"host",session:"none",parse:O}),ready:w({wire:"bridge:ready",from:"app",session:"none",parse:O}),initialize:w({wire:"bridge:initialize",from:"host",session:"establish",parse:(e)=>({state:e.state})}),request:w({wire:"bridge:request",from:"app",session:"current",parse:(e)=>{let t=S(e,"route");if(!t||t.length>256)throw Error("Invalid message route.");return{id:F(e),route:t,payload:e.payload}}}),result:w({wire:"bridge:result",from:"host",session:"current",parse:(e)=>{if(!Object.hasOwn(e,"response"))throw Error("Missing response.");return{id:F(e),response:e.response}}}),error:w({wire:"bridge:error",from:"host",session:"current",parse:(e)=>{if(e.requestId!==void 0&&typeof e.requestId!=="string")throw Error("Invalid requestId.");return{id:F(e),code:S(e,"code"),message:S(e,"message"),...e.requestId===void 0?{}:{requestId:e.requestId}}}}),cancel:w({wire:"bridge:cancel",from:"app",session:"current",parse:(e)=>({id:F(e)})}),disconnect:w({wire:"bridge:disconnect",from:"app",session:"current",parse:O}),scriptLoad:w({wire:"script:load",from:"host",session:"current",parse:(e)=>({javascript:S(e,"javascript")})}),stateUpdate:w({wire:"state:update",from:"host",session:"current",parse:(e)=>({state:e.state})}),runtimeLog:w({wire:"runtime:log",from:"app",session:"current",parse:(e)=>{if(!Y(e.payload))throw Error("Invalid log entry.");return{payload:e.payload}}}),runtimeReady:w({wire:"runtime:ready",from:"app",session:"current",parse:O}),runtimeError:w({wire:"runtime:error",from:"app",session:"current",parse:O})}};function V(e){let t={type:e.type};if("id"in e)t.id=e.id;if(e.type==="bridge:request"){t.route=e.route;let r=e.payload;if(e.route==="data:query"&&r&&typeof r==="object"&&"operation"in r&&typeof r.operation==="string")t.operation=r.operation.slice(0,256)}if(e.type==="bridge:error")t.error={code:e.code,message:e.message,...e.requestId===void 0?{}:{requestId:e.requestId}};return t}var U=new Map;for(let e of Object.keys(h.events)){let t=h.events[e].wire;if(U.has(t))throw Error(`Duplicate bridge event: ${t}`);U.set(t,e)}function W(e){return U.get(e)}function z(e){if(!e||typeof e!=="object")return;let t=e;if(t.channel!==C||t.version!==h.version||typeof t.type!=="string"||typeof t.documentId!=="string"||!t.documentId||t.documentId.length>128||t.sessionId!==void 0&&!T(t.sessionId)||t.token!==void 0&&typeof t.token!=="string")return;return t}function K(e,t){try{return{channel:C,version:h.version,documentId:e.documentId,...e.sessionId===void 0?{}:{sessionId:e.sessionId},...e.token===void 0?{}:{token:e.token},type:t.wire,...t.parse(e)}}catch{return}}function te(e){let t=z(e);if(!t)return;let r=W(t.type);if(!r)return;let n=h.events[r];if(n.session!=="none"&&t.sessionId===void 0)return;return K(t,n)}function re({role:e,origin:t,source:r,opaque:n,context:o,post:i,diagnostic:l,invalidRequest:u,handlers:y}){let c=!1;function a(g,p){l?.({direction:"drop",reason:g,...typeof p==="string"?{type:p.slice(0,64)}:{}})}function b(g,p){if(c)throw Error("The bridge endpoint has closed.");let d=h.events[g],f=o(),E=te({...p,channel:h.channel,version:h.version,type:d.wire,documentId:g==="connect"?"host":f.documentId,sessionId:f.sessionId,token:n?f.token:void 0});if(!E||n&&!T(f.token))throw Error("The bridge is not ready to send this event.");if(l?.({direction:"send",...V(E)}),c)return;i(E)}function Q(g){let p=r();if(c||!p||g.origin!==t||g.source!==p)return;let d=z(g.data);if(!d){let k=g.data;if(k&&typeof k==="object"&&"channel"in k&&k.channel===h.channel)a("invalid_envelope","type"in k?k.type:void 0);return}let f=o(),E=e==="app"&&d.type===h.events.connect.wire;if(n&&(E?!T(d.token):!f.token||d.token!==f.token))return a("token_mismatch",d.type);let P=W(d.type);if(!P)return a("unexpected_type",d.type);let N=h.events[P];if(N.from===e)return a("unexpected_type",d.type);if(N.session==="establish"){if(d.documentId!==f.documentId||d.sessionId===void 0)return a("session_mismatch",d.type)}else if(N.session==="current"){if(!f.sessionId||d.sessionId!==f.sessionId||d.documentId!==f.documentId)return a("session_mismatch",d.type)}let B=K(d,N);if(!B){if(a("invalid_payload",d.type),e==="host"&&P==="request"&&T(d.id))u?.(d.id);return}if(l?.({direction:"receive",...V(B)}),c)return;let D=y[P];D(B)}return{send:b,receive:Q,dispose(){c=!0}}}function we(e){return e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&Number.isFinite(e)}function H(e){return!!e&&typeof e==="object"&&!Array.isArray(e)&&Object.values(e).every(we)}var ne=Symbol.for("@altertable/data-app/MessageRoutingError");class R extends Error{code;requestId;[ne]=!0;static[Symbol.hasInstance](e){return e instanceof Error&&e[ne]===!0}constructor(e,t,r,n){super(t,n);this.code=e;this.requestId=r;this.name="MessageRoutingError"}}function he(e){return e}function oe(e){return{operations:e,input(t){if(!t||typeof t!=="object")throw Error("Invalid query.");let r=t;if(typeof r.operation!=="string"||!r.operation||r.operation.length>256||r.operation.includes("/"))throw Error("Invalid operation.");let n=e&&Object.hasOwn(e,r.operation)?e[r.operation]:void 0;if(e&&!n)throw Error("Unknown operation.");return{operation:r.operation,input:n?n.input(r.input):r.input}},output(t){if(!t||typeof t!=="object")throw Error("Invalid data response.");let r=t;if(!Number.isInteger(r.status)||r.status<100||r.status>599||!r.body||typeof r.body!=="object"||Array.isArray(r.body))throw Error("Invalid data response.");let n=r.body;if(r.status<200||r.status>=300){let o=n.error;throw new R(typeof o?.code==="string"?o.code:"request_failed",typeof o?.message==="string"?o.message:"Could not load data.",typeof o?.requestId==="string"?o.requestId:void 0)}if(!("data"in n)||typeof n.requestId!=="string"||typeof n.queriedAt!=="string"||!Array.isArray(n.queryIds)||!n.queryIds.every((o)=>typeof o==="string"))throw Error("Invalid data envelope.");if(n.queries!==void 0&&(!Array.isArray(n.queries)||!n.queries.every((o)=>o&&typeof o==="object"&&typeof o.name==="string"&&typeof o.statement==="string"&&(o.params===void 0||H(o.params))&&(o.queryId===void 0||typeof o.queryId==="string"))))throw Error("Invalid query evidence.");return{status:r.status,body:n}}}}var se=he({input(e){if(!e||typeof e!=="object")throw Error("Invalid SQL query.");let t=e;if(typeof t.statement!=="string"||!t.statement.trim()||typeof t.limit!=="number"||!Number.isSafeInteger(t.limit)||t.limit<1||t.params!==void 0&&!H(t.params))throw Error("Invalid SQL query.");return{statement:t.statement,limit:t.limit,...t.params===void 0?{}:{params:t.params}}},output(e,t){if(!e||typeof e!=="object")throw Error("Invalid query result.");let r=e;if(!Array.isArray(r.columns)||!r.columns.every((n)=>n&&typeof n.name==="string"&&(n.type===void 0||typeof n.type==="string"))||!Array.isArray(r.rows)||r.rows.length>t.limit||!r.rows.every((n)=>Array.isArray(n)&&n.length===r.columns.length)||r.queryId!==void 0&&typeof r.queryId!=="string")throw Error("Invalid query result.");return{columns:r.columns,rows:r.rows,...r.queryId===void 0?{}:{queryId:r.queryId}}}});function ae(e,t){return{async request(r,n,{signal:o}={}){if(o?.throwIfAborted(),!Object.hasOwn(e,r))throw new R("unknown_route","Unknown message route.");let i=e[r],l;try{l=i.input(n)}catch{throw new R("invalid_payload","Invalid message payload.")}let u=await t({route:r,payload:l},o);o?.throwIfAborted();try{return i.output(u,l)}catch(y){if(y instanceof R)throw y;throw new R("invalid_response","Invalid message response.")}}}}var ie=Symbol.for("@altertable/data-app/DataAppError");class x extends Error{code;requestId;[ie]=!0;static[Symbol.hasInstance](e){return e instanceof Error&&e[ie]===!0}constructor(e,t,r){super(e);this.code=t;this.requestId=r;this.name="DataAppError"}}function de(e,t){function r(o){if(o.length===1&&typeof o[0]==="function"){let i=o[0]();return Array.isArray(i)?i:[i]}return o.map((i)=>typeof i==="function"?i():i)}function n(o,i){if(!e())return;try{t({method:o,args:r(i)})}catch{}}return{log:(...o)=>n("log",o),info:(...o)=>n("info",o),warn:(...o)=>n("warn",o),error:(...o)=>n("error",o)}}var be={send:"Sending message to parent",receive:"Received message from parent",drop:"Ignored message from parent"};function ue(e,{direction:t,...r}){if(r.type==="runtime:log")return;e.log(be[t],r)}function pe(e){if(e instanceof Error)return{name:e.name,message:e.message,...e.stack?{stack:e.stack}:{}};return{message:String(e)}}function ce(e){if(e instanceof R)throw new x(e.message,e.code,e.requestId);throw e}function le({parentOrigin:e,window:t=window,timeoutMs:r=ee,mode:n="url",loadScript:o}){if(new URL(e).origin!==e)throw Error("Expected an exact parent origin.");let i=q(),l,u,y=!1,c=new Map,a,b=new Set,Q=de(()=>!y&&!!u&&!!a&&typeof a==="object"&&("logging"in a)&&a.logging===!0,(s)=>p("runtimeLog",{payload:s})),g=re({role:"app",origin:e,source:()=>t.parent,opaque:n==="bundle",context:()=>({documentId:i,sessionId:u,token:l}),post(s){t.parent.postMessage(s,e)},diagnostic:(s)=>ue(Q,s),handlers:{connect(s){if(n==="bundle")l=s.token;p("ready",{})},initialize(s){if(u&&u!==s.sessionId){if(c.size)Q.warn("Preview reconnected; rejecting pending requests",{count:c.size});for(let I of c.values())I.reject(new x("The preview reconnected. Retry the request.","bridge_reset"))}let m=!u;if(u=s.sessionId,f(s.state),m)for(let I of c.values())I.start();if(y)return;if(n==="url")p("runtimeReady",{})},stateUpdate(s){f(s.state)},scriptLoad(s){if(n==="bundle")o?.(s.javascript)},result(s){c.get(s.id)?.resolve(s.response)},error(s){c.get(s.id)?.reject(new R(s.code,s.message,s.requestId))}}}),{send:p,receive:d}=g;function f(s){a=s;for(let m of b)m(s)}t.addEventListener("message",d);function E(s,m){return new Promise((I,v)=>{if(y)return v(new x("The preview has closed.","bridge_closed"));if(m?.aborted)return v(m.reason);if(c.size>=Z)return v(new x("Too many pending data requests.","bridge_busy"));let j=q(),M=!1;function A(){clearTimeout(me),m?.removeEventListener("abort",J),c.delete(j)}function J(){if(M)p("cancel",{id:j});A(),v(m?.reason)}let me=setTimeout(()=>{if(Q.warn("Message request timed out",{id:j,route:s.route,timeoutMs:r,sent:M}),M)p("cancel",{id:j});A(),v(new x(u?"The data request timed out.":"The preview shell is unavailable. Reload the preview.",u?"timeout":"bridge_unavailable"))},r),X={start(){if(M)return;try{p("request",{id:j,route:s.route,payload:s.payload}),M=!0}catch{A(),v(new x("The message payload could not be sent.","invalid_payload"))}},resolve(L){A(),I(L)},reject(L){A(),v(L)}};if(c.set(j,X),m?.addEventListener("abort",J,{once:!0}),u)X.start();else if(n==="url"||l)p("ready",{})})}let P=ae({"data:query":oe(),"data:sql":se},E);function N(s,m,I){return P.request("data:query",{operation:s,input:m},{signal:I}).catch(ce)}function B(){if(u)p("disconnect",{});u=void 0;for(let s of c.values())s.reject(new x("The preview has closed.","bridge_closed"))}function D(s){if(s.persisted&&(n==="url"||l))p("ready",{})}function k(){if(y)return;B(),y=!0,g.dispose(),t.removeEventListener("message",d),t.removeEventListener("pagehide",B),t.removeEventListener("pageshow",D),b.clear()}if(t.addEventListener("pagehide",B),t.addEventListener("pageshow",D),n==="url")p("ready",{});return{logger:Q,request:E,transport:N,lakehouse:{queryAll(s,{limit:m,signal:I,params:v}){return P.request("data:sql",{statement:s,limit:m,...v===void 0?{}:{params:v}},{signal:I}).catch(ce)}},dispose:k,mode:n,snapshot(){return a},subscribe(s){return b.add(s),()=>{b.delete(s)}},ready(){if(!y&&u)p("runtimeReady",{})},fail(s){if(y||!u)return;if(s!==void 0)Q.error(()=>["Data app failed",pe(s)]);p("runtimeError",{})}}}var G=Symbol.for("altertable.localFrameBridge"),_=Symbol.for("altertable.installedTransport");function ye(e,t=window){let r=t;if(r[_])throw Error("A data app transport is already installed.");return r[G]=e,r[_]=e,()=>{if(r[G]===e)delete r[G];if(r[_]===e)delete r[_];e.dispose()}}function fe({parentOrigin:e,window:t=window}){let r,n,o=`altertable-data-app-${q()}.js`,i=le({parentOrigin:e,window:t,mode:"bundle",loadScript(a){if(r!==void 0){if(a!==r)i.fail(Error("This frame already evaluated a different app script."));else if(n)i.fail(n.cause);else i.ready();return}r=a;try{let b=t.document.createElement("script");if(b.textContent=`${a}\n//# sourceURL=${o}`,t.document.body.append(b),!n)i.ready()}catch(b){l(b)}}});function l(a){n={cause:a},i.fail(a)}function u(a){if(a.filename===o)l(a.error??a.message)}function y(a){if(a.reason instanceof Error&&a.reason.stack?.includes(o))l(a.reason)}t.addEventListener("error",u),t.addEventListener("unhandledrejection",y);let c=ye(i,t);return()=>{t.removeEventListener("error",u),t.removeEventListener("unhandledrejection",y),c()}}var ge=document.currentScript?.dataset.parentOrigin;if(!ge)throw Error("Missing trusted parent origin.");fe({parentOrigin:ge});})();\n'.replace(/<\/script/gi, (match) => `<\\${match.slice(1)}`);
|
|
259
|
-
function runtimeHtml(parentOrigin) {
|
|
260
|
-
const attribute = parentOrigin.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">").replaceAll("'", "'");
|
|
261
|
-
return `<!doctype html>
|
|
262
|
-
<html>
|
|
263
|
-
<head>
|
|
264
|
-
<meta charset="utf-8">
|
|
265
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
266
|
-
<meta http-equiv="Content-Security-Policy" content="${PAGE_CSP}">
|
|
267
|
-
</head>
|
|
268
|
-
<body>
|
|
269
|
-
<div id="root"></div>
|
|
270
|
-
<script data-parent-origin="${attribute}">${inlineBootstrap}</script>
|
|
271
|
-
</body>
|
|
272
|
-
</html>
|
|
273
|
-
`;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// src/embed/source.ts
|
|
277
|
-
function attachDataAppSource({
|
|
278
|
-
iframe,
|
|
279
|
-
source,
|
|
280
|
-
presentation,
|
|
281
|
-
logger,
|
|
282
|
-
onMessage,
|
|
283
|
-
onStatusChange,
|
|
284
|
-
onDiagnostic,
|
|
285
|
-
startupTimeoutMs = 30000
|
|
286
|
-
}) {
|
|
287
|
-
const host = iframe.ownerDocument.defaultView;
|
|
288
|
-
if (!host)
|
|
289
|
-
throw new Error("The iframe requires a host window.");
|
|
290
|
-
const url = new URL(source.type === "url" ? source.url : source.bootstrapUrl ?? `data:text/html;charset=utf-8,${encodeURIComponent(runtimeHtml(host.location.origin))}`, host.location.href);
|
|
291
|
-
if (!(source.type === "bundle" && source.bootstrapUrl === undefined) && !/^https?:$/.test(url.protocol))
|
|
292
|
-
throw new Error("Data apps require an HTTP(S) URL.");
|
|
293
|
-
const opaque = source.type === "bundle";
|
|
294
|
-
if (!opaque && url.origin === host.location.origin)
|
|
295
|
-
throw new Error("URL data apps require a separate origin from the host.");
|
|
296
|
-
iframe.setAttribute("sandbox", opaque ? "allow-scripts" : "allow-scripts allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox");
|
|
297
|
-
iframe.referrerPolicy = "no-referrer";
|
|
298
|
-
if (!opaque)
|
|
299
|
-
url.searchParams.set(PARENT_PARAM, host.location.origin);
|
|
300
|
-
let timer;
|
|
301
|
-
let failed = false;
|
|
302
|
-
function status(value) {
|
|
303
|
-
if (value === "connecting")
|
|
304
|
-
failed = false;
|
|
305
|
-
if (failed && value !== "connecting")
|
|
306
|
-
return;
|
|
307
|
-
clearTimeout(timer);
|
|
308
|
-
if (value === "connecting" || value === "connected")
|
|
309
|
-
timer = setTimeout(() => {
|
|
310
|
-
failed = true;
|
|
311
|
-
bridge.dispose();
|
|
312
|
-
onStatusChange?.("failed");
|
|
313
|
-
}, startupTimeoutMs);
|
|
314
|
-
if (value === "failed") {
|
|
315
|
-
failed = true;
|
|
316
|
-
bridge.dispose();
|
|
317
|
-
}
|
|
318
|
-
onStatusChange?.(value);
|
|
319
|
-
}
|
|
320
|
-
const bridge = attachDataAppConnection({
|
|
321
|
-
iframe,
|
|
322
|
-
connection: opaque ? { type: "opaque", token: randomUuid() } : { type: "origin", origin: url.origin },
|
|
323
|
-
javascript: opaque ? source.javascript : undefined,
|
|
324
|
-
presentation,
|
|
325
|
-
logger,
|
|
326
|
-
onMessage,
|
|
327
|
-
onStatusChange: status,
|
|
328
|
-
onDiagnostic,
|
|
329
|
-
window: host
|
|
330
|
-
});
|
|
331
|
-
function error() {
|
|
332
|
-
return status("failed");
|
|
333
|
-
}
|
|
334
|
-
iframe.addEventListener("error", error);
|
|
335
|
-
iframe.src = url.href;
|
|
336
|
-
function dispose() {
|
|
337
|
-
clearTimeout(timer);
|
|
338
|
-
iframe.removeEventListener("error", error);
|
|
339
|
-
bridge.dispose();
|
|
340
|
-
}
|
|
341
|
-
return {
|
|
342
|
-
dispose,
|
|
343
|
-
setPresentation: bridge.setPresentation,
|
|
344
|
-
setLogger: bridge.setLogger
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// src/embed/bridge.ts
|
|
349
|
-
function attachDataAppBridge2(options) {
|
|
350
|
-
return options.source ? attachDataAppSource(options) : attachDataAppConnection(options);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
export { attachDataAppBridge2 };
|
|
354
|
-
|
|
355
|
-
//# debugId=E69862182E77A65D64756E2164756E21
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/embed/host.ts", "../src/embed/runtime-html.ts", "../src/embed/source.ts", "../src/embed/bridge.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { randomUuid } from '@/src/core/uuid';\nimport { createBridgeEndpoint } from '@/src/core/bridge-endpoint';\nimport type { DataAppAnnotationPresentation } from '@/src/core/annotations';\nimport type { DataAppPresentation } from '@/src/core/presentation';\nimport type { DataAppLogger } from '@/src/core/logger';\nimport {\n MAX_PENDING,\n REQUEST_TIMEOUT_MS,\n validId,\n type BridgeDiagnostic,\n type BridgeEventMessage,\n} from '@/src/core/bridge';\n\nimport {\n MessageRoutingError,\n type MessageDispatcher,\n} from '@/src/core/messages';\n\nexport type DataAppConnection =\n | { type: 'origin'; origin: string }\n | { type: 'opaque'; token: string };\nexport type DataAppStatus =\n | 'connecting'\n | 'connected'\n | 'ready'\n | 'failed'\n | 'disconnected';\n/** Delivery metadata only; never tokens or payloads. `durationMs` measures host handling of a request, reported on its result or error. */\nexport type DataAppDiagnostic = BridgeDiagnostic & { durationMs?: number };\n\nexport type DataAppHost = {\n dispose: () => void;\n setPresentation: (presentation?: DataAppPresentation) => void;\n setLogger: (logger?: DataAppLogger) => void;\n};\n\nexport type DataAppHostOptions = {\n iframe: HTMLIFrameElement;\n presentation?: DataAppPresentation;\n logger?: DataAppLogger;\n onStatusChange?: (status: DataAppStatus) => void;\n onDiagnostic?: (event: DataAppDiagnostic) => void;\n onMessage: MessageDispatcher;\n};\n\nexport type DataAppConnectionOptions = DataAppHostOptions & {\n connection: DataAppConnection;\n javascript?: string;\n window?: Window;\n};\n\n/** The bridge owns delivery and cancellation; the routed handler owns validation, authorization and execution. */\nexport function attachDataAppConnection({\n iframe,\n connection,\n javascript,\n presentation,\n logger,\n onStatusChange,\n onDiagnostic,\n onMessage,\n window: host = window,\n}: DataAppConnectionOptions): DataAppHost {\n const frameOrigin = connection.type === 'origin' ? connection.origin : 'null';\n if (\n connection.type === 'origin' &&\n new URL(frameOrigin).origin !== frameOrigin\n )\n throw new Error('Expected an exact frame origin.');\n if (connection.type === 'opaque' && !validId(connection.token))\n throw new Error('Invalid sandbox token.');\n let token = connection.type === 'opaque' ? connection.token : undefined;\n const targetOrigin = connection.type === 'opaque' ? '*' : frameOrigin;\n let currentPresentation: DataAppPresentation | undefined;\n let presentationIdentity: string | undefined;\n let annotationDismissal: DataAppAnnotationPresentation['dismissal'];\n let disposed = false;\n let documentId: string | undefined;\n let sessionId: string | undefined;\n const pending = new Map<string, AbortController>();\n const requestStartedAt = new Map<string, number>();\n\n function reportDiagnostic(event: BridgeDiagnostic) {\n if (!onDiagnostic) return;\n if (event.direction === 'drop' || !event.id) return onDiagnostic(event);\n switch (event.type) {\n case 'bridge:request':\n if (\n !requestStartedAt.has(event.id) &&\n requestStartedAt.size < MAX_PENDING * 2\n )\n requestStartedAt.set(event.id, host.performance.now());\n break;\n case 'bridge:cancel':\n requestStartedAt.delete(event.id);\n break;\n case 'bridge:result':\n case 'bridge:error': {\n const startedAt = requestStartedAt.get(event.id);\n requestStartedAt.delete(event.id);\n if (startedAt !== undefined)\n return onDiagnostic({\n ...event,\n durationMs: Math.round(host.performance.now() - startedAt),\n });\n break;\n }\n }\n onDiagnostic(event);\n }\n\n function hostState() {\n const presentation =\n currentPresentation?.annotations && annotationDismissal\n ? {\n ...currentPresentation,\n annotations: {\n ...currentPresentation.annotations,\n dismissal: annotationDismissal,\n },\n }\n : currentPresentation;\n return {\n search: host.location.search,\n hash: host.location.hash,\n ...(presentation ? { presentation } : {}),\n logging: logger !== undefined,\n };\n }\n\n function setLogger(value: DataAppLogger | undefined) {\n if (disposed || value === logger) return;\n const wasEnabled = logger !== undefined;\n logger = value;\n if (wasEnabled !== (logger !== undefined)) publishState();\n }\n\n function setPresentation(value: DataAppPresentation | undefined) {\n if (disposed) return;\n const identity = JSON.stringify(value);\n if (identity === presentationIdentity) return;\n presentationIdentity = identity;\n currentPresentation =\n identity === undefined\n ? undefined\n : (JSON.parse(identity) as DataAppPresentation);\n publishState();\n }\n\n function cancelAll() {\n for (const controller of pending.values()) controller.abort();\n pending.clear();\n requestStartedAt.clear();\n }\n\n const endpoint = createBridgeEndpoint({\n role: 'host',\n origin: frameOrigin,\n source: () => iframe.contentWindow,\n opaque: connection.type === 'opaque',\n context: () => ({ documentId, sessionId, token }),\n post: message => iframe.contentWindow?.postMessage(message, targetOrigin),\n diagnostic: reportDiagnostic,\n invalidRequest: id => {\n if (pending.has(id)) return;\n if (pending.size >= MAX_PENDING)\n error(id, 'bridge_busy', 'Too many pending data requests.');\n else error(id, 'invalid_message', 'Invalid message route.');\n },\n handlers: {\n ready(message) {\n if (message.documentId !== documentId) {\n cancelAll();\n documentId = message.documentId;\n sessionId = randomUuid();\n }\n onStatusChange?.('connected');\n if (disposed) return;\n send('initialize', { state: hostState() });\n if (disposed) return;\n if (javascript !== undefined) send('scriptLoad', { javascript });\n },\n runtimeLog({ payload }) {\n try {\n logger?.[payload.method](...payload.args);\n } catch {\n // A host logger failure must not break bridge delivery.\n }\n },\n runtimeReady() {\n onStatusChange?.('ready');\n },\n runtimeError() {\n onStatusChange?.('failed');\n },\n request(message) {\n void request(message);\n },\n cancel(message) {\n pending.get(message.id)?.abort();\n pending.delete(message.id);\n },\n disconnect() {\n cancelAll();\n documentId = undefined;\n sessionId = undefined;\n onStatusChange?.('disconnected');\n },\n },\n });\n const send = endpoint.send;\n const receive = endpoint.receive;\n\n function error(\n id: string,\n code: string,\n message: string,\n requestId?: string\n ) {\n send('error', { id, code, message, requestId });\n }\n\n async function request(message: BridgeEventMessage<'request'>) {\n const id = message.id;\n if (pending.has(id)) return;\n if (pending.size >= MAX_PENDING)\n return error(id, 'bridge_busy', 'Too many pending data requests.');\n try {\n const body = JSON.stringify(message.payload);\n // PNG annotation captures have a separate validated 256 KiB image budget.\n const limit = message.route === 'annotation:draft' ? 384_000 : 16_384;\n if (\n message.payload !== undefined &&\n (typeof body !== 'string' || body.length > limit)\n )\n throw new Error('Invalid payload');\n } catch {\n return error(\n id,\n 'invalid_payload',\n 'The message payload is invalid or too large.'\n );\n }\n const controller = new AbortController();\n pending.set(id, controller);\n const timer = setTimeout(() => {\n if (pending.get(id) !== controller) return;\n pending.delete(id);\n controller.abort();\n error(id, 'timeout', 'The data request timed out.');\n }, REQUEST_TIMEOUT_MS);\n controller.signal.addEventListener('abort', () => clearTimeout(timer), {\n once: true,\n });\n try {\n const response = await onMessage(\n { route: message.route, payload: message.payload },\n { signal: controller.signal }\n );\n if (pending.get(id) === controller) send('result', { id, response });\n } catch (failure) {\n if (pending.get(id) === controller) {\n if (failure instanceof MessageRoutingError)\n error(id, failure.code, failure.message, failure.requestId);\n else\n error(\n id,\n 'request_failed',\n 'The message request failed. Retry the request.'\n );\n }\n } finally {\n clearTimeout(timer);\n if (pending.get(id) === controller) pending.delete(id);\n }\n }\n\n function publishState() {\n if (disposed || !sessionId) return;\n send('stateUpdate', { state: hostState() });\n }\n\n function publishAnnotationDismissal(event: MouseEvent) {\n if (\n !currentPresentation?.annotations?.enabled ||\n event.composedPath().includes(iframe)\n )\n return;\n annotationDismissal = {\n id: randomUuid(),\n occurredAt: host.performance.timeOrigin + host.performance.now(),\n };\n publishState();\n }\n\n function load() {\n if (connection.type === 'opaque') token = randomUuid();\n cancelAll();\n documentId = undefined;\n sessionId = undefined;\n onStatusChange?.('connecting');\n send('connect', {});\n }\n\n function dispose() {\n disposed = true;\n endpoint.dispose();\n cancelAll();\n iframe.removeEventListener('load', load);\n host.removeEventListener('message', receive);\n host.removeEventListener('popstate', publishState);\n host.removeEventListener('pagehide', cancelAll);\n host.removeEventListener('click', publishAnnotationDismissal, true);\n }\n\n setPresentation(presentation);\n iframe.addEventListener('load', load);\n host.addEventListener('message', receive);\n host.addEventListener('popstate', publishState);\n host.addEventListener('pagehide', cancelAll);\n host.addEventListener('click', publishAnnotationDismissal, true);\n // Reconnect an already-loaded iframe when its host bridge mounts again.\n onStatusChange?.('connecting');\n send('connect', {});\n\n return { dispose, setPresentation, setLogger };\n}\n",
|
|
6
|
-
"// The package build embeds the compiled classic script, never a runtime import.\ndeclare const DATA_APP_BOOTSTRAP: string;\n\nexport const PAGE_CSP =\n \"default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; connect-src 'none'; form-action 'none'; base-uri 'none'\";\nconst inlineBootstrap = DATA_APP_BOOTSTRAP.replace(\n /<\\/script/gi,\n match => `<\\\\${match.slice(1)}`\n);\n\nexport function runtimeHtml(parentOrigin: string) {\n const attribute = parentOrigin\n .replaceAll('&', '&')\n .replaceAll('\"', '"')\n .replaceAll('<', '<')\n .replaceAll('>', '>')\n .replaceAll(\"'\", ''');\n\n return `<!doctype html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n <meta http-equiv=\"Content-Security-Policy\" content=\"${PAGE_CSP}\">\n </head>\n <body>\n <div id=\"root\"></div>\n <script data-parent-origin=\"${attribute}\">${inlineBootstrap}</script>\n </body>\n</html>\n`;\n}\n",
|
|
7
|
-
"import { randomUuid } from '@/src/core/uuid';\nimport { runtimeHtml } from '@/src/embed/runtime-html';\nimport { PARENT_PARAM } from '@/src/core/bridge';\nimport {\n attachDataAppConnection,\n type DataAppStatus,\n type DataAppHost,\n type DataAppHostOptions,\n} from '@/src/embed/host';\n\nexport type DataAppSource =\n | { type: 'url'; url: string }\n | {\n type: 'bundle';\n /** Omit to use the packaged, network-isolated data document. */\n bootstrapUrl?: string;\n javascript: string;\n };\nexport type DataAppSourceOptions = DataAppHostOptions & {\n source: DataAppSource;\n startupTimeoutMs?: number;\n};\n\n/** Owns loading and sandbox policy. Dispose before replacing the source or retrying. */\nexport function attachDataAppSource({\n iframe,\n source,\n presentation,\n logger,\n onMessage,\n onStatusChange,\n onDiagnostic,\n startupTimeoutMs = 30_000,\n}: DataAppSourceOptions): DataAppHost {\n const host = iframe.ownerDocument.defaultView;\n if (!host) throw new Error('The iframe requires a host window.');\n const url = new URL(\n source.type === 'url'\n ? source.url\n : (source.bootstrapUrl ??\n `data:text/html;charset=utf-8,${encodeURIComponent(runtimeHtml(host.location.origin))}`),\n host.location.href\n );\n if (\n !(source.type === 'bundle' && source.bootstrapUrl === undefined) &&\n !/^https?:$/.test(url.protocol)\n )\n throw new Error('Data apps require an HTTP(S) URL.');\n const opaque = source.type === 'bundle';\n if (!opaque && url.origin === host.location.origin)\n throw new Error('URL data apps require a separate origin from the host.');\n iframe.setAttribute(\n 'sandbox',\n opaque\n ? 'allow-scripts'\n : 'allow-scripts allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox'\n );\n iframe.referrerPolicy = 'no-referrer';\n if (!opaque) url.searchParams.set(PARENT_PARAM, host.location.origin);\n let timer: ReturnType<typeof setTimeout> | undefined;\n let failed = false;\n\n function status(value: DataAppStatus) {\n if (value === 'connecting') failed = false;\n if (failed && value !== 'connecting') return;\n clearTimeout(timer);\n if (value === 'connecting' || value === 'connected')\n timer = setTimeout(() => {\n failed = true;\n bridge.dispose();\n onStatusChange?.('failed');\n }, startupTimeoutMs);\n if (value === 'failed') {\n failed = true;\n bridge.dispose();\n }\n onStatusChange?.(value);\n }\n\n const bridge = attachDataAppConnection({\n iframe,\n connection: opaque\n ? { type: 'opaque', token: randomUuid() }\n : { type: 'origin', origin: url.origin },\n javascript: opaque ? source.javascript : undefined,\n presentation,\n logger,\n onMessage,\n onStatusChange: status,\n onDiagnostic,\n window: host,\n });\n\n function error() {\n return status('failed');\n }\n\n iframe.addEventListener('error', error);\n iframe.src = url.href;\n\n function dispose() {\n clearTimeout(timer);\n iframe.removeEventListener('error', error);\n bridge.dispose();\n }\n\n return {\n dispose,\n setPresentation: bridge.setPresentation,\n setLogger: bridge.setLogger,\n };\n}\n",
|
|
8
|
-
"import {\n attachDataAppConnection,\n type DataAppConnectionOptions,\n} from '@/src/embed/host';\nimport {\n attachDataAppSource,\n type DataAppSourceOptions,\n} from '@/src/embed/source';\n\nexport type DataAppBridgeOptions =\n | (DataAppSourceOptions & {\n connection?: never;\n window?: never;\n javascript?: never;\n })\n | (DataAppConnectionOptions & { source?: never; startupTimeoutMs?: never });\n\n/** Source mode configures and loads the iframe; connection mode attaches to a host-owned document. */\nexport function attachDataAppBridge(options: DataAppBridgeOptions) {\n return options.source\n ? attachDataAppSource(options)\n : attachDataAppConnection(options);\n}\n"
|
|
9
|
-
],
|
|
10
|
-
"mappings": ";;;;;;;;;;;;;AAoDO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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