@altertable/data-app 0.72.0 → 0.73.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 +5 -61
- package/CONTRIBUTING.md +93 -180
- package/README.md +3 -4
- package/REFERENCE.md +30 -345
- package/dist/chunks/contract-BeLPJwlO.js +558 -0
- package/dist/chunks/contract-BeLPJwlO.js.map +1 -0
- package/dist/chunks/contract-Di8SP74I.js +462 -0
- package/dist/chunks/contract-Di8SP74I.js.map +1 -0
- package/dist/chunks/format-BdFlv_xa.js +148 -0
- package/dist/chunks/format-BdFlv_xa.js.map +1 -0
- package/dist/chunks/iframe-C3uCZEXh.js +809 -0
- package/dist/chunks/iframe-C3uCZEXh.js.map +1 -0
- package/dist/chunks/operation-CBxhjNhK.js +131 -0
- package/dist/chunks/operation-CBxhjNhK.js.map +1 -0
- package/dist/chunks/request-body-H1qPmmTN.js +50 -0
- package/dist/chunks/request-body-H1qPmmTN.js.map +1 -0
- package/dist/client/index.js +253 -285
- package/dist/client/index.js.map +1 -13
- package/dist/core/appearance.js +171 -162
- package/dist/core/appearance.js.map +1 -10
- package/dist/core/config.js +49 -11
- package/dist/core/config.js.map +1 -9
- package/dist/core/contract.js +3 -73
- package/dist/core/format.js +1 -26
- package/dist/index.js +1 -12
- package/dist/internal.js +352 -397
- package/dist/internal.js.map +1 -15
- package/dist/server/index.js +85 -97
- package/dist/server/index.js.map +1 -10
- package/dist/types/chunks/appearance.d.ts +45 -0
- package/dist/types/chunks/contract.d.ts +720 -0
- package/dist/types/chunks/index.d.ts +189 -0
- package/dist/types/client/index.d.ts +3 -13
- package/dist/types/core/appearance.d.ts +2 -42
- package/dist/types/core/config.d.ts +36 -39
- package/dist/types/core/contract.d.ts +2 -114
- package/dist/types/core/format.d.ts +44 -17
- package/dist/types/index.d.ts +3 -3
- package/dist/types/internal.d.ts +312 -22
- package/dist/types/server/index.d.ts +15 -4
- package/docs/app-authoring.md +72 -128
- package/docs/client.md +29 -63
- package/docs/composition.md +44 -75
- package/docs/contract.md +60 -100
- package/docs/data-context.md +35 -61
- package/docs/embed.md +83 -55
- package/docs/formatting-and-appearance.md +17 -38
- package/docs/hosted-apps.md +7 -14
- package/docs/layout.md +30 -47
- package/docs/local-data-apps.md +7 -7
- package/docs/react-embed.md +20 -26
- package/docs/react.md +10 -27
- package/docs/server-bun.md +2 -27
- package/docs/server.md +6 -12
- package/docs/stories-and-export.md +38 -40
- package/docs/styling.md +14 -22
- package/docs/ui-quality.md +5 -5
- package/docs/ui.md +68 -70
- package/docs/variables.md +142 -254
- package/docs/views.md +85 -116
- package/docs/widgets.md +100 -153
- package/docs/worker.md +15 -27
- package/package.json +3 -2
- package/dist/chunks/index-5a27erdg.js +0 -54
- package/dist/chunks/index-5a27erdg.js.map +0 -10
- package/dist/chunks/index-9yxr7nmm.js +0 -742
- package/dist/chunks/index-9yxr7nmm.js.map +0 -17
- package/dist/chunks/index-j5q5n3ra.js +0 -151
- package/dist/chunks/index-j5q5n3ra.js.map +0 -10
- package/dist/chunks/index-q75zm3a7.js +0 -153
- package/dist/chunks/index-q75zm3a7.js.map +0 -11
- package/dist/chunks/index-vhaec7m5.js +0 -30
- package/dist/chunks/index-vhaec7m5.js.map +0 -10
- package/dist/chunks/index-zp78caex.js +0 -1047
- package/dist/chunks/index-zp78caex.js.map +0 -19
- package/dist/core/contract.js.map +0 -9
- package/dist/core/format.js.map +0 -9
- package/dist/index.js.map +0 -9
- package/dist/types/client/annotations.d.ts +0 -27
- package/dist/types/client/data-client.d.ts +0 -43
- package/dist/types/client/download.d.ts +0 -5
- package/dist/types/client/iframe.d.ts +0 -59
- package/dist/types/client/location.d.ts +0 -13
- package/dist/types/client/logger.d.ts +0 -14
- package/dist/types/client/messages.d.ts +0 -7
- package/dist/types/client/navigation.d.ts +0 -15
- package/dist/types/client/transport.d.ts +0 -15
- package/dist/types/core/annotations.d.ts +0 -99
- package/dist/types/core/bridge-endpoint.d.ts +0 -21
- package/dist/types/core/bridge.d.ts +0 -172
- package/dist/types/core/data-view.d.ts +0 -46
- package/dist/types/core/date-format.d.ts +0 -24
- package/dist/types/core/date-range.d.ts +0 -20
- package/dist/types/core/dimension-source.d.ts +0 -64
- package/dist/types/core/dimension.d.ts +0 -71
- package/dist/types/core/facets.d.ts +0 -13
- package/dist/types/core/filters.d.ts +0 -45
- package/dist/types/core/invariant.d.ts +0 -2
- package/dist/types/core/keys.d.ts +0 -2
- package/dist/types/core/logger.d.ts +0 -12
- package/dist/types/core/messages.d.ts +0 -62
- package/dist/types/core/navigation.d.ts +0 -11
- package/dist/types/core/operation-types.d.ts +0 -80
- package/dist/types/core/operation.d.ts +0 -20
- package/dist/types/core/presentation.d.ts +0 -9
- package/dist/types/core/queries.d.ts +0 -84
- package/dist/types/core/reading.d.ts +0 -17
- package/dist/types/core/uuid.d.ts +0 -2
- package/dist/types/core/variables.d.ts +0 -133
- package/dist/types/server/handler.d.ts +0 -13
- package/dist/types/server/request-body.d.ts +0 -4
package/dist/client/index.js
CHANGED
|
@@ -1,301 +1,269 @@
|
|
|
1
|
-
import"../chunks/
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
navigationUpdateRoute2,
|
|
8
|
-
annotationDraftRoute2,
|
|
9
|
-
annotationEditorStateRoute2,
|
|
10
|
-
annotationSendRoute2,
|
|
11
|
-
annotationUpdateRoute2,
|
|
12
|
-
annotationModeRoute2
|
|
13
|
-
} from "../chunks/index-zp78caex.js";
|
|
14
|
-
import {
|
|
15
|
-
randomUuid2,
|
|
16
|
-
DataAppError2,
|
|
17
|
-
createHttpTransport2,
|
|
18
|
-
PARENT_PARAM2,
|
|
19
|
-
createMessageClient2,
|
|
20
|
-
createIframeTransport2,
|
|
21
|
-
localFrameBridge2,
|
|
22
|
-
installDataAppTransport2,
|
|
23
|
-
getDataAppTransport2
|
|
24
|
-
} from "../chunks/index-9yxr7nmm.js";
|
|
25
|
-
import {
|
|
26
|
-
executeDataOperation,
|
|
27
|
-
toDataOperationFailure2
|
|
28
|
-
} from "../chunks/index-j5q5n3ra.js";
|
|
29
|
-
|
|
30
|
-
// packages/data-app/src/client/data-client.ts
|
|
1
|
+
import { h as withDimensionSelectors } from "../chunks/contract-BeLPJwlO.js";
|
|
2
|
+
import { a as annotationSendRoute, f as defineDataQueryRoute, g as validLocation, i as annotationModeRoute, l as MessageRoutingError, m as navigationUpdateRoute, n as annotationDraftRoute, o as annotationUpdateRoute, r as annotationEditorStateRoute } from "../chunks/contract-Di8SP74I.js";
|
|
3
|
+
import { n as toDataOperationFailure, t as executeDataOperation } from "../chunks/operation-CBxhjNhK.js";
|
|
4
|
+
import { a as DataAppError, d as PARENT_PARAM, i as localFrameBridge, m as randomUuid, n as getDataAppTransport, o as createHttpTransport, r as installDataAppTransport, s as createMessageClient, t as createIframeTransport } from "../chunks/iframe-C3uCZEXh.js";
|
|
5
|
+
//#region src/client/data-client.ts
|
|
6
|
+
/** The factory is the only place that grants a client its invariant contract witness. */
|
|
31
7
|
function typedClient(implementation) {
|
|
32
|
-
|
|
8
|
+
return implementation;
|
|
33
9
|
}
|
|
34
|
-
|
|
10
|
+
const dataQueryRoute = defineDataQueryRoute();
|
|
35
11
|
function createDataClient(options = {}) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
12
|
+
if (options.operations) return createOperationClient({
|
|
13
|
+
operations: withDimensionSelectors(options.operations),
|
|
14
|
+
lakehouse: options.lakehouse
|
|
15
|
+
});
|
|
16
|
+
const http = createHttpTransport(options);
|
|
17
|
+
const useHttp = options.endpoint !== void 0 || options.fetch !== void 0;
|
|
18
|
+
return typedClient({ async query(name, input, { signal } = {}) {
|
|
19
|
+
const response = await (options.transport ?? (useHttp ? http : localFrameBridge()?.transport ?? http))(name, input, signal);
|
|
20
|
+
const ok = response.status >= 200 && response.status < 300;
|
|
21
|
+
let body;
|
|
22
|
+
try {
|
|
23
|
+
body = dataQueryRoute.output(response, {
|
|
24
|
+
operation: name,
|
|
25
|
+
input
|
|
26
|
+
}).body;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
if (signal?.aborted) throw error;
|
|
29
|
+
if (error instanceof MessageRoutingError) throw new DataAppError(error.message, error.code, error.requestId);
|
|
30
|
+
throw new DataAppError(ok ? "The data response was invalid." : "Could not load data.", ok ? "invalid_response" : "request_failed");
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
...body,
|
|
34
|
+
input
|
|
35
|
+
};
|
|
36
|
+
} });
|
|
61
37
|
}
|
|
62
38
|
function createOperationClient(options) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
});
|
|
39
|
+
const operations = Object.freeze({ ...options.operations });
|
|
40
|
+
return typedClient({ async query(name, input, { signal } = {}) {
|
|
41
|
+
signal?.throwIfAborted();
|
|
42
|
+
const requestId = randomUuid();
|
|
43
|
+
if (!Object.hasOwn(operations, name)) throw new DataAppError("Unknown data operation.", "not_found", requestId);
|
|
44
|
+
const lakehouse = options.lakehouse ?? (typeof window === "undefined" ? void 0 : getDataAppTransport()?.lakehouse);
|
|
45
|
+
if (!lakehouse) throw new DataAppError("An authorized SQL bridge must be installed first.", "bridge_unavailable", requestId);
|
|
46
|
+
try {
|
|
47
|
+
const { body } = await executeDataOperation(operations[name], input, {
|
|
48
|
+
lakehouse,
|
|
49
|
+
signal: signal ?? new AbortController().signal,
|
|
50
|
+
requestId,
|
|
51
|
+
operationName: name
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
...body,
|
|
55
|
+
input
|
|
56
|
+
};
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (signal?.aborted) throw signal.reason;
|
|
59
|
+
if (error instanceof DataAppError) throw error;
|
|
60
|
+
const failure = toDataOperationFailure(error);
|
|
61
|
+
throw new DataAppError(failure.message, failure.code, requestId);
|
|
62
|
+
}
|
|
63
|
+
} });
|
|
91
64
|
}
|
|
92
|
-
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/client/location.ts
|
|
67
|
+
/** Opaque sandboxes keep app state in memory; URL frames retain their real URL for HMR. */
|
|
93
68
|
function createAppLocation(frame, virtual, publish) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
return { location, apply, dispose };
|
|
69
|
+
let state = {
|
|
70
|
+
search: "",
|
|
71
|
+
hash: ""
|
|
72
|
+
};
|
|
73
|
+
let disposed = false;
|
|
74
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
75
|
+
function notify() {
|
|
76
|
+
for (const listener of listeners) listener();
|
|
77
|
+
}
|
|
78
|
+
function snapshot() {
|
|
79
|
+
if (virtual) return state;
|
|
80
|
+
const url = new URL(frame.location.href);
|
|
81
|
+
url.searchParams.delete(PARENT_PARAM);
|
|
82
|
+
if (state.search !== url.search || state.hash !== url.hash) state = {
|
|
83
|
+
search: url.search,
|
|
84
|
+
hash: url.hash
|
|
85
|
+
};
|
|
86
|
+
return state;
|
|
87
|
+
}
|
|
88
|
+
function apply(next) {
|
|
89
|
+
const previous = snapshot();
|
|
90
|
+
if (previous.search === next.search && previous.hash === next.hash) return;
|
|
91
|
+
if (virtual) state = next;
|
|
92
|
+
else {
|
|
93
|
+
const url = new URL(frame.location.href);
|
|
94
|
+
const parent = url.searchParams.get(PARENT_PARAM);
|
|
95
|
+
url.search = next.search;
|
|
96
|
+
if (parent) url.searchParams.set(PARENT_PARAM, parent);
|
|
97
|
+
url.hash = next.hash;
|
|
98
|
+
frame.history.replaceState(null, "", url);
|
|
99
|
+
frame.dispatchEvent(new Event("popstate"));
|
|
100
|
+
}
|
|
101
|
+
if (virtual) notify();
|
|
102
|
+
}
|
|
103
|
+
const location = {
|
|
104
|
+
snapshot,
|
|
105
|
+
subscribe(listener) {
|
|
106
|
+
listeners.add(listener);
|
|
107
|
+
if (!virtual) frame.addEventListener("popstate", listener);
|
|
108
|
+
return () => {
|
|
109
|
+
listeners.delete(listener);
|
|
110
|
+
frame.removeEventListener("popstate", listener);
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
update(next, mode = "replace") {
|
|
114
|
+
if (disposed) return;
|
|
115
|
+
if (!validLocation(next)) throw new Error("Invalid app location.");
|
|
116
|
+
const before = snapshot();
|
|
117
|
+
if (before.search === next.search && before.hash === next.hash) return;
|
|
118
|
+
apply(next);
|
|
119
|
+
publish(next, mode);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
function dispose() {
|
|
123
|
+
disposed = true;
|
|
124
|
+
for (const listener of listeners) frame.removeEventListener("popstate", listener);
|
|
125
|
+
listeners.clear();
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
location,
|
|
129
|
+
apply,
|
|
130
|
+
dispose
|
|
131
|
+
};
|
|
159
132
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}) {
|
|
166
|
-
return attachNavigation(frame, bridge.mode === "bundle", bridge).navigation;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/client/navigation.ts
|
|
135
|
+
/** Attach app URL behavior to an already authenticated bridge. */
|
|
136
|
+
function createDataAppNavigation({ bridge, window: frame = window }) {
|
|
137
|
+
return attachNavigation(frame, bridge.mode === "bundle", bridge).navigation;
|
|
167
138
|
}
|
|
168
139
|
function attachNavigation(frame, virtual, connection) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
isDisposed() {
|
|
225
|
-
return disposed;
|
|
226
|
-
}
|
|
227
|
-
};
|
|
140
|
+
let disposed = false;
|
|
141
|
+
let unsubscribe;
|
|
142
|
+
let send;
|
|
143
|
+
let pendingUpdate;
|
|
144
|
+
const { location, apply, dispose } = createAppLocation(frame, virtual, publish);
|
|
145
|
+
function publish(location, mode) {
|
|
146
|
+
const update = {
|
|
147
|
+
...location,
|
|
148
|
+
mode,
|
|
149
|
+
title: frame.document.title
|
|
150
|
+
};
|
|
151
|
+
if (send) send(update);
|
|
152
|
+
else pendingUpdate = update;
|
|
153
|
+
}
|
|
154
|
+
function attach(bridge) {
|
|
155
|
+
if (disposed) return;
|
|
156
|
+
unsubscribe?.();
|
|
157
|
+
const messages = createMessageClient({ "navigation:update": navigationUpdateRoute }, bridge.request);
|
|
158
|
+
function sendUpdate(update) {
|
|
159
|
+
messages.request("navigation:update", update).catch(() => {});
|
|
160
|
+
}
|
|
161
|
+
function receiveState(state) {
|
|
162
|
+
if (!validLocation(state)) return;
|
|
163
|
+
pendingUpdate = void 0;
|
|
164
|
+
apply(state);
|
|
165
|
+
}
|
|
166
|
+
send = sendUpdate;
|
|
167
|
+
unsubscribe = bridge.subscribe(receiveState);
|
|
168
|
+
receiveState(bridge.snapshot());
|
|
169
|
+
if (pendingUpdate) {
|
|
170
|
+
sendUpdate(pendingUpdate);
|
|
171
|
+
pendingUpdate = void 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if ("then" in connection) connection.then(attach).catch(() => {});
|
|
175
|
+
else attach(connection);
|
|
176
|
+
return {
|
|
177
|
+
navigation: {
|
|
178
|
+
...location,
|
|
179
|
+
publish(mode = "replace") {
|
|
180
|
+
if (!disposed) publish(location.snapshot(), mode);
|
|
181
|
+
},
|
|
182
|
+
dispose() {
|
|
183
|
+
disposed = true;
|
|
184
|
+
unsubscribe?.();
|
|
185
|
+
dispose();
|
|
186
|
+
send = void 0;
|
|
187
|
+
pendingUpdate = void 0;
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
attach,
|
|
191
|
+
isDisposed() {
|
|
192
|
+
return disposed;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
228
195
|
}
|
|
229
|
-
|
|
196
|
+
const navigationKey = Symbol.for("altertable.appNavigation");
|
|
197
|
+
/** URL controls attach navigation on demand; bootstrap and data-only clients do not. */
|
|
230
198
|
function getDataAppNavigation(frame = window) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
199
|
+
const target = frame;
|
|
200
|
+
const bridge = getDataAppTransport(frame);
|
|
201
|
+
const cached = target[navigationKey]?.isDisposed() ? void 0 : target[navigationKey];
|
|
202
|
+
if (cached) {
|
|
203
|
+
if (bridge && cached.bridge !== bridge) {
|
|
204
|
+
cached.attach(bridge);
|
|
205
|
+
cached.bridge = bridge;
|
|
206
|
+
}
|
|
207
|
+
return cached.navigation;
|
|
208
|
+
}
|
|
209
|
+
if (bridge) {
|
|
210
|
+
const adapter = attachNavigation(frame, bridge.mode === "bundle", bridge);
|
|
211
|
+
target[navigationKey] = {
|
|
212
|
+
bridge,
|
|
213
|
+
...adapter
|
|
214
|
+
};
|
|
215
|
+
return adapter.navigation;
|
|
216
|
+
}
|
|
217
|
+
const preview = localFrameBridge(frame);
|
|
218
|
+
if (!preview?.connect) return void 0;
|
|
219
|
+
const connection = preview.connect();
|
|
220
|
+
const adapter = attachNavigation(frame, false, connection);
|
|
221
|
+
const entry = {
|
|
222
|
+
...adapter,
|
|
223
|
+
bridge: void 0
|
|
224
|
+
};
|
|
225
|
+
target[navigationKey] = entry;
|
|
226
|
+
connection.then((bridge) => {
|
|
227
|
+
entry.bridge = bridge;
|
|
228
|
+
}).catch(() => {});
|
|
229
|
+
return adapter.navigation;
|
|
260
230
|
}
|
|
261
|
-
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/client/annotations.ts
|
|
233
|
+
/** Deliver annotations to the authenticated host. Acknowledgement means retained, not sent to an agent. */
|
|
262
234
|
function createAnnotationClient(transport) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
235
|
+
const client = createMessageClient({
|
|
236
|
+
"annotation:draft": annotationDraftRoute,
|
|
237
|
+
"annotation:update": annotationUpdateRoute,
|
|
238
|
+
"annotation:mode": annotationModeRoute,
|
|
239
|
+
"annotation:editor": annotationEditorStateRoute,
|
|
240
|
+
"annotation:send": annotationSendRoute
|
|
241
|
+
}, transport);
|
|
242
|
+
return {
|
|
243
|
+
/** Ask the host to submit its saved annotations using its existing send guards. */
|
|
244
|
+
requestSendAnnotations(options) {
|
|
245
|
+
return client.request("annotation:send", null, options);
|
|
246
|
+
},
|
|
247
|
+
/** Report the iframe editor's status so the host can guard batch submission. */
|
|
248
|
+
reportAnnotationEditorState(state, options) {
|
|
249
|
+
return client.request("annotation:editor", state, options);
|
|
250
|
+
},
|
|
251
|
+
addAnnotation(draft, options) {
|
|
252
|
+
return client.request("annotation:draft", draft, options);
|
|
253
|
+
},
|
|
254
|
+
updateAnnotation(id, comment, options) {
|
|
255
|
+
return client.request("annotation:update", {
|
|
256
|
+
id,
|
|
257
|
+
comment
|
|
258
|
+
}, options);
|
|
259
|
+
},
|
|
260
|
+
/** Ask the host to change its controlled annotation mode. */
|
|
261
|
+
requestAnnotationModeChange(request, options) {
|
|
262
|
+
return client.request("annotation:mode", request, options);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
287
265
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
createAnnotationClient,
|
|
291
|
-
createDataAppNavigation,
|
|
292
|
-
createDataClient,
|
|
293
|
-
createHttpTransport2 as createHttpTransport,
|
|
294
|
-
createIframeTransport2 as createIframeTransport,
|
|
295
|
-
createMessageClient2 as createMessageClient,
|
|
296
|
-
getDataAppNavigation,
|
|
297
|
-
getDataAppTransport2 as getDataAppTransport,
|
|
298
|
-
installDataAppTransport2 as installDataAppTransport
|
|
299
|
-
};
|
|
266
|
+
//#endregion
|
|
267
|
+
export { DataAppError, createAnnotationClient, createDataAppNavigation, createDataClient, createHttpTransport, createIframeTransport, createMessageClient, getDataAppNavigation, getDataAppTransport, installDataAppTransport };
|
|
300
268
|
|
|
301
|
-
//#
|
|
269
|
+
//# sourceMappingURL=index.js.map
|