mindoodb-app-sdk 0.0.42 → 0.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -229,6 +229,32 @@ Important constraints:
229
229
  - Call `session.menus.hide()` if your app needs to explicitly dismiss a pending host menu.
230
230
  - Host-rendered menus are intended for `runtime === "iframe"`. Window-mode apps can usually show local menus instead.
231
231
 
232
+ ### Host-owned drag
233
+
234
+ When two apps run as visible workspace chicklets, native HTML5 drag dies at the iframe boundary. The SDK therefore hands the gesture to Haven: the source starts it, Haven draws a PNG ghost above every frame, and the target hit-tests the drop.
235
+
236
+ ```ts
237
+ await session.drag.setProfile({
238
+ accepts: ["text/plain", "text/markdown", "application/json", "application/x-mindoo-document"],
239
+ onOver: (event) => {
240
+ const zone = document.elementFromPoint(event.x, event.y)?.closest("[data-drop-zone]");
241
+ return { accept: Boolean(zone), effect: zone ? "copy" : "forbidden" };
242
+ },
243
+ onDrop: (event) => {
244
+ console.log(event.items["text/markdown"]);
245
+ },
246
+ });
247
+
248
+ const unbind = session.drag.bindSource(cardEl, {
249
+ offers: () => [
250
+ { type: "text/plain", data: "Hello" },
251
+ { type: "text/markdown", data: "**Hello**" },
252
+ ],
253
+ });
254
+ ```
255
+
256
+ `bindSource` starts after an 8px mouse/pen move, or a 400ms long-press on touch (so lists can still scroll). You can also call `session.drag.start` yourself with a PNG `ArrayBuffer` preview. v1 is **copy-only** and **iframe-only**. Well-known types: `text/plain`, `text/markdown`, `application/json`, `application/x-mindoo-document`.
257
+
232
258
  ### Databases and capabilities
233
259
 
234
260
  Each database mapped to your app carries a set of **capabilities** that Haven controls. Your app should check capabilities before attempting operations and adapt its UI accordingly.
@@ -1488,7 +1514,7 @@ export default defineConfig({
1488
1514
  });
1489
1515
  ```
1490
1516
 
1491
- After `vite build`, `dist/` additionally contains `haven-bundle.json` (app id, version, a SHA-256 for every file, and one for the bundle as a whole) and `haven-bundle.zip` (all of it in one archive). The app's own service worker files are left out — Haven serves the bundle and a second service worker would only fight it for the scope. The user pastes the URL of `haven-bundle.json` into Haven's application settings; Haven downloads the archive, rejects it unless every hash matches the manifest, and installs it.
1517
+ After `vite build`, `dist/` additionally contains `haven-bundle.json` (app id, version, a SHA-256 for every file, and one for the bundle as a whole) and `haven-bundle.zip` (all of it in one archive). The app's own service worker files are left out — Haven serves the bundle and a second service worker would only fight it for the scope. The user pastes the app origin into Haven's application settings (the same URL as for external hosting); Haven fetches `/haven-bundle.json` from there, downloads the archive, rejects it unless every hash matches the manifest, and installs it.
1492
1518
 
1493
1519
  Haven then owns updates. It re-reads the manifest before launches and on a slow background timer, and installs a new version when the `contentHash` changes — which means an app in hosted mode should **not** run its own update logic:
1494
1520
 
@@ -1573,6 +1599,10 @@ Connect options: `launchId?`, `targetOrigin?`, `connectTimeoutMs?`.
1573
1599
  | `closeSealedChannel(channelId)` | `Promise<void>` |
1574
1600
  | `menus.show(input)` | `Promise<MindooDBAppShowMenuResult>` |
1575
1601
  | `menus.hide()` | `Promise<void>` |
1602
+ | `drag.setProfile(profile)` | `Promise<void>` |
1603
+ | `drag.start(input)` | `Promise<MindooDBAppDragStartResult>` |
1604
+ | `drag.cancel()` | `Promise<void>` |
1605
+ | `drag.bindSource(el, options)` | `() => void` (unbind) |
1576
1606
  | `storage` | `MindooDBAppStorageApi` |
1577
1607
  | `onThemeChange(listener)` | `() => void` (unsubscribe) |
1578
1608
  | `onViewportChange(listener)` | `() => void` (unsubscribe) |
@@ -1,3 +1,430 @@
1
+ // src/drag.ts
2
+ var MINDOODB_APP_MAX_DRAG_TYPES = 8;
3
+ var MINDOODB_APP_MAX_DRAG_PAYLOAD_BYTES = 32 * 1024;
4
+ var MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES = 256 * 1024;
5
+ var MINDOODB_APP_MAX_DRAG_PREVIEW_EDGE = 512;
6
+ var DEFAULT_DRAG_LONG_PRESS_MS = 400;
7
+ var DEFAULT_DRAG_POINTER_THRESHOLD_PX = 8;
8
+ var MINIMAL_DRAG_PREVIEW_PNG = Uint8Array.from(
9
+ atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="),
10
+ (character) => character.charCodeAt(0)
11
+ );
12
+ var DRAG_TYPE_PATTERN = /^[a-z0-9][a-z0-9!#$&^_.+-]{0,126}\/[a-z0-9][a-z0-9!#$&^_.+-]{0,126}$/i;
13
+ var MindooDBAppDragInputError = class extends Error {
14
+ name = "invalid-drag-input";
15
+ constructor(message) {
16
+ super(message);
17
+ }
18
+ };
19
+ function isMindooDBAppDragType(type) {
20
+ return DRAG_TYPE_PATTERN.test(type);
21
+ }
22
+ function utf8ByteLength(value) {
23
+ return new TextEncoder().encode(value).length;
24
+ }
25
+ function requireFiniteNumber(value, fieldPath) {
26
+ if (typeof value !== "number" || !Number.isFinite(value)) {
27
+ throw new MindooDBAppDragInputError(`Expected ${fieldPath} to be a finite number.`);
28
+ }
29
+ return value;
30
+ }
31
+ function toPreviewArrayBuffer(value) {
32
+ if (value instanceof ArrayBuffer) {
33
+ return value.slice(0);
34
+ }
35
+ if (ArrayBuffer.isView(value)) {
36
+ return value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength);
37
+ }
38
+ return null;
39
+ }
40
+ function normalizeDragType(value, fieldPath) {
41
+ if (typeof value !== "string" || !isMindooDBAppDragType(value)) {
42
+ throw new MindooDBAppDragInputError(`Expected ${fieldPath} to be a MIME-like type string.`);
43
+ }
44
+ return value;
45
+ }
46
+ function normalizeOffers(value) {
47
+ if (!Array.isArray(value) || value.length === 0) {
48
+ throw new MindooDBAppDragInputError("A drag must offer at least one type.");
49
+ }
50
+ if (value.length > MINDOODB_APP_MAX_DRAG_TYPES) {
51
+ throw new MindooDBAppDragInputError(
52
+ `A drag supports at most ${MINDOODB_APP_MAX_DRAG_TYPES} types.`
53
+ );
54
+ }
55
+ const seen = /* @__PURE__ */ new Set();
56
+ return value.map((entry, index) => {
57
+ if (!entry || typeof entry !== "object") {
58
+ throw new MindooDBAppDragInputError(`Expected offers[${index}] to be an object.`);
59
+ }
60
+ const candidate = entry;
61
+ const type = normalizeDragType(candidate.type, `offers[${index}].type`);
62
+ if (seen.has(type)) {
63
+ throw new MindooDBAppDragInputError(`Duplicate drag type "${type}".`);
64
+ }
65
+ seen.add(type);
66
+ if (typeof candidate.data !== "string") {
67
+ throw new MindooDBAppDragInputError(`Expected offers[${index}].data to be a string.`);
68
+ }
69
+ if (utf8ByteLength(candidate.data) > MINDOODB_APP_MAX_DRAG_PAYLOAD_BYTES) {
70
+ throw new MindooDBAppDragInputError(
71
+ `offers[${index}].data exceeds ${MINDOODB_APP_MAX_DRAG_PAYLOAD_BYTES} bytes.`
72
+ );
73
+ }
74
+ return { type, data: candidate.data };
75
+ });
76
+ }
77
+ function normalizeDragAccepts(value) {
78
+ if (!Array.isArray(value) || value.length === 0) {
79
+ throw new MindooDBAppDragInputError("A drag profile must accept at least one type.");
80
+ }
81
+ if (value.length > MINDOODB_APP_MAX_DRAG_TYPES) {
82
+ throw new MindooDBAppDragInputError(
83
+ `A drag profile supports at most ${MINDOODB_APP_MAX_DRAG_TYPES} types.`
84
+ );
85
+ }
86
+ const seen = /* @__PURE__ */ new Set();
87
+ const accepts = [];
88
+ value.forEach((entry, index) => {
89
+ const type = normalizeDragType(entry, `accepts[${index}]`);
90
+ if (seen.has(type)) {
91
+ return;
92
+ }
93
+ seen.add(type);
94
+ accepts.push(type);
95
+ });
96
+ return accepts;
97
+ }
98
+ function normalizePreview(value) {
99
+ if (!value || typeof value !== "object") {
100
+ throw new MindooDBAppDragInputError("A drag preview is required.");
101
+ }
102
+ const candidate = value;
103
+ const pngBuffer = toPreviewArrayBuffer(candidate.png);
104
+ if (!pngBuffer) {
105
+ throw new MindooDBAppDragInputError("preview.png must be an ArrayBuffer.");
106
+ }
107
+ if (pngBuffer.byteLength === 0 || pngBuffer.byteLength > MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES) {
108
+ throw new MindooDBAppDragInputError(
109
+ `preview.png must be between 1 and ${MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES} bytes.`
110
+ );
111
+ }
112
+ const width = requireFiniteNumber(candidate.width, "preview.width");
113
+ const height = requireFiniteNumber(candidate.height, "preview.height");
114
+ if (width <= 0 || height <= 0 || width > MINDOODB_APP_MAX_DRAG_PREVIEW_EDGE * 4 || height > MINDOODB_APP_MAX_DRAG_PREVIEW_EDGE * 4) {
115
+ throw new MindooDBAppDragInputError("preview width/height are out of range.");
116
+ }
117
+ return {
118
+ png: pngBuffer,
119
+ width,
120
+ height,
121
+ hotspotX: requireFiniteNumber(candidate.hotspotX, "preview.hotspotX"),
122
+ hotspotY: requireFiniteNumber(candidate.hotspotY, "preview.hotspotY")
123
+ };
124
+ }
125
+ function normalizeDragStartInput(value) {
126
+ if (!value || typeof value !== "object") {
127
+ throw new MindooDBAppDragInputError("drag.start requires a payload object.");
128
+ }
129
+ const candidate = value;
130
+ if (!candidate.pointer || typeof candidate.pointer !== "object") {
131
+ throw new MindooDBAppDragInputError("pointer is required.");
132
+ }
133
+ const pointer = candidate.pointer;
134
+ let allowedEffects;
135
+ if (candidate.allowedEffects !== void 0) {
136
+ if (!Array.isArray(candidate.allowedEffects) || candidate.allowedEffects.length === 0 || candidate.allowedEffects.some((effect) => effect !== "copy")) {
137
+ throw new MindooDBAppDragInputError('allowedEffects may only include "copy".');
138
+ }
139
+ allowedEffects = ["copy"];
140
+ }
141
+ return {
142
+ offers: normalizeOffers(candidate.offers),
143
+ preview: normalizePreview(candidate.preview),
144
+ pointer: {
145
+ x: requireFiniteNumber(pointer.x, "pointer.x"),
146
+ y: requireFiniteNumber(pointer.y, "pointer.y")
147
+ },
148
+ allowedEffects
149
+ };
150
+ }
151
+ function canvasToPng(canvas) {
152
+ if (typeof canvas.toBlob === "function") {
153
+ return new Promise((resolve, reject) => {
154
+ canvas.toBlob((blob) => {
155
+ if (!blob) {
156
+ reject(new Error("Could not encode the drag preview as PNG."));
157
+ return;
158
+ }
159
+ void blob.arrayBuffer().then(resolve, reject);
160
+ }, "image/png");
161
+ });
162
+ }
163
+ if (typeof canvas.toDataURL !== "function") {
164
+ return Promise.resolve(MINIMAL_DRAG_PREVIEW_PNG.buffer.slice(0));
165
+ }
166
+ const dataUrl = canvas.toDataURL("image/png");
167
+ const encoded = dataUrl.split(",")[1];
168
+ if (!encoded) {
169
+ return Promise.resolve(MINIMAL_DRAG_PREVIEW_PNG.buffer.slice(0));
170
+ }
171
+ const binary = atob(encoded);
172
+ const bytes = new Uint8Array(binary.length);
173
+ for (let index = 0; index < binary.length; index += 1) {
174
+ bytes[index] = binary.charCodeAt(index);
175
+ }
176
+ return Promise.resolve(bytes.buffer);
177
+ }
178
+ function drawFallbackCard(element, width, height) {
179
+ if (typeof document === "undefined") {
180
+ return null;
181
+ }
182
+ const canvas = document.createElement("canvas");
183
+ canvas.width = width;
184
+ canvas.height = height;
185
+ const context = canvas.getContext("2d");
186
+ if (!context) {
187
+ return null;
188
+ }
189
+ context.fillStyle = "#1c2333";
190
+ context.fillRect(0, 0, width, height);
191
+ context.strokeStyle = "#6ea8fe";
192
+ context.strokeRect(0.5, 0.5, width - 1, height - 1);
193
+ context.fillStyle = "#f4f7fb";
194
+ context.font = "12px sans-serif";
195
+ const label = (element.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 48);
196
+ context.fillText(label || "Drag", 8, Math.min(20, height - 6));
197
+ return canvas;
198
+ }
199
+ function scaledPreviewSize(width, height) {
200
+ const safeWidth = Math.max(1, Math.round(width));
201
+ const safeHeight = Math.max(1, Math.round(height));
202
+ const scale = Math.min(1, MINDOODB_APP_MAX_DRAG_PREVIEW_EDGE / Math.max(safeWidth, safeHeight));
203
+ return {
204
+ width: Math.max(1, Math.round(safeWidth * scale)),
205
+ height: Math.max(1, Math.round(safeHeight * scale))
206
+ };
207
+ }
208
+ async function snapshotElementToPng(element) {
209
+ const bounds = element.getBoundingClientRect();
210
+ const size = scaledPreviewSize(bounds.width || 160, bounds.height || 72);
211
+ const canvas = drawFallbackCard(element, size.width, size.height);
212
+ const png = canvas ? await canvasToPng(canvas) : MINIMAL_DRAG_PREVIEW_PNG.buffer.slice(0);
213
+ if (png.byteLength > MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES) {
214
+ throw new MindooDBAppDragInputError(
215
+ `Drag preview exceeds ${MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES} bytes.`
216
+ );
217
+ }
218
+ return {
219
+ png,
220
+ width: size.width,
221
+ height: size.height,
222
+ hotspotX: size.width / 2,
223
+ hotspotY: size.height / 2
224
+ };
225
+ }
226
+ function pointerDistance(origin, event) {
227
+ const dx = event.clientX - origin.x;
228
+ const dy = event.clientY - origin.y;
229
+ return Math.hypot(dx, dy);
230
+ }
231
+ function readOffers(options) {
232
+ return typeof options.offers === "function" ? options.offers() : options.offers;
233
+ }
234
+ function readPreviewElement(source, options) {
235
+ if (!options.preview) {
236
+ return source;
237
+ }
238
+ return typeof options.preview === "function" ? options.preview() : options.preview;
239
+ }
240
+ function bindDragSource(element, options, start) {
241
+ const longPressMs = options.longPressMs ?? DEFAULT_DRAG_LONG_PRESS_MS;
242
+ const thresholdPx = options.pointerThresholdPx ?? DEFAULT_DRAG_POINTER_THRESHOLD_PX;
243
+ let active = null;
244
+ const reset = () => {
245
+ if (active?.timer != null) {
246
+ clearTimeout(active.timer);
247
+ }
248
+ active = null;
249
+ };
250
+ const beginHostDrag = async (event) => {
251
+ if (!active || active.started) {
252
+ return;
253
+ }
254
+ active.started = true;
255
+ if (active.timer != null) {
256
+ clearTimeout(active.timer);
257
+ active.timer = null;
258
+ }
259
+ const offers = readOffers(options);
260
+ if (offers.length === 0) {
261
+ reset();
262
+ return;
263
+ }
264
+ event.preventDefault();
265
+ const preview = await active.preview;
266
+ const hotX = event.clientX - element.getBoundingClientRect().left;
267
+ const hotY = event.clientY - element.getBoundingClientRect().top;
268
+ await start({
269
+ offers,
270
+ preview: {
271
+ ...preview,
272
+ hotspotX: hotX,
273
+ hotspotY: hotY
274
+ },
275
+ pointer: { x: event.clientX, y: event.clientY },
276
+ allowedEffects: ["copy"]
277
+ });
278
+ };
279
+ const onPointerDown = (event) => {
280
+ if (event.button !== 0) {
281
+ return;
282
+ }
283
+ reset();
284
+ const previewElement = readPreviewElement(element, options);
285
+ active = {
286
+ pointerId: event.pointerId,
287
+ origin: { x: event.clientX, y: event.clientY },
288
+ pointerType: event.pointerType,
289
+ preview: snapshotElementToPng(previewElement).catch(() => ({
290
+ png: MINIMAL_DRAG_PREVIEW_PNG.buffer.slice(0),
291
+ width: Math.max(1, Math.round(previewElement.getBoundingClientRect().width) || 160),
292
+ height: Math.max(1, Math.round(previewElement.getBoundingClientRect().height) || 72),
293
+ hotspotX: 0,
294
+ hotspotY: 0
295
+ })),
296
+ timer: null,
297
+ started: false
298
+ };
299
+ if (event.pointerType === "touch") {
300
+ active.timer = setTimeout(() => {
301
+ if (!active || active.started) {
302
+ return;
303
+ }
304
+ void beginHostDrag(event);
305
+ }, longPressMs);
306
+ }
307
+ };
308
+ const onPointerMove = (event) => {
309
+ if (!active || event.pointerId !== active.pointerId || active.started) {
310
+ return;
311
+ }
312
+ const distance = pointerDistance(active.origin, event);
313
+ if (active.pointerType === "touch") {
314
+ if (distance > thresholdPx) {
315
+ reset();
316
+ }
317
+ return;
318
+ }
319
+ if (distance >= thresholdPx) {
320
+ void beginHostDrag(event);
321
+ }
322
+ };
323
+ const onPointerUp = (event) => {
324
+ if (!active || event.pointerId !== active.pointerId) {
325
+ return;
326
+ }
327
+ reset();
328
+ };
329
+ element.addEventListener("pointerdown", onPointerDown);
330
+ window.addEventListener("pointermove", onPointerMove);
331
+ window.addEventListener("pointerup", onPointerUp);
332
+ window.addEventListener("pointercancel", onPointerUp);
333
+ return () => {
334
+ reset();
335
+ element.removeEventListener("pointerdown", onPointerDown);
336
+ window.removeEventListener("pointermove", onPointerMove);
337
+ window.removeEventListener("pointerup", onPointerUp);
338
+ window.removeEventListener("pointercancel", onPointerUp);
339
+ };
340
+ }
341
+
342
+ // src/hostShortcuts.ts
343
+ var DEFAULT_HAVEN_HOST_SHORTCUTS = [
344
+ { action: "open-workspace", code: "Enter", shiftKey: true, metaOrCtrl: true },
345
+ { action: "toggle-app-drawer", code: "Space", shiftKey: true, metaOrCtrl: true }
346
+ ];
347
+ var HOST_SHORTCUT_ACTIONS = /* @__PURE__ */ new Set([
348
+ "open-workspace",
349
+ "toggle-app-drawer"
350
+ ]);
351
+ function normalizeShortcutCode(code) {
352
+ return code === "NumpadEnter" ? "Enter" : code;
353
+ }
354
+ function matchHostShortcut(event, shortcuts = DEFAULT_HAVEN_HOST_SHORTCUTS) {
355
+ if (event.repeat || event.altKey) {
356
+ return null;
357
+ }
358
+ const primary = event.metaKey || event.ctrlKey;
359
+ const code = normalizeShortcutCode(event.code);
360
+ for (const binding of shortcuts) {
361
+ if (code !== binding.code) {
362
+ continue;
363
+ }
364
+ if (Boolean(event.shiftKey) !== Boolean(binding.shiftKey)) {
365
+ continue;
366
+ }
367
+ if (Boolean(binding.metaOrCtrl) !== primary) {
368
+ continue;
369
+ }
370
+ return binding.action;
371
+ }
372
+ return null;
373
+ }
374
+ function isHostShortcutAction(value) {
375
+ return typeof value === "string" && HOST_SHORTCUT_ACTIONS.has(value);
376
+ }
377
+ function sanitizeHostShortcutBindings(value) {
378
+ if (!Array.isArray(value)) {
379
+ return null;
380
+ }
381
+ const bindings = [];
382
+ for (const entry of value) {
383
+ if (!entry || typeof entry !== "object") {
384
+ return null;
385
+ }
386
+ const candidate = entry;
387
+ if (!isHostShortcutAction(candidate.action) || typeof candidate.code !== "string" || !candidate.code) {
388
+ return null;
389
+ }
390
+ bindings.push({
391
+ action: candidate.action,
392
+ code: candidate.code,
393
+ shiftKey: Boolean(candidate.shiftKey),
394
+ metaOrCtrl: Boolean(candidate.metaOrCtrl)
395
+ });
396
+ }
397
+ return bindings;
398
+ }
399
+ function applyHostedDocumentOverscrollContain(doc = globalThis.document) {
400
+ if (!doc?.documentElement) {
401
+ return;
402
+ }
403
+ doc.documentElement.style.overscrollBehavior = "contain";
404
+ if (doc.body) {
405
+ doc.body.style.overscrollBehavior = "contain";
406
+ }
407
+ }
408
+ function installHostShortcutCapture(options) {
409
+ const target = options.target ?? (typeof document === "undefined" ? void 0 : document);
410
+ if (!target) {
411
+ return () => void 0;
412
+ }
413
+ const onKeyDown = (event) => {
414
+ const action = matchHostShortcut(event, options.getShortcuts());
415
+ if (!action) {
416
+ return;
417
+ }
418
+ event.preventDefault();
419
+ event.stopPropagation();
420
+ options.onInvoke(action);
421
+ };
422
+ target.addEventListener("keydown", onKeyDown, true);
423
+ return () => {
424
+ target.removeEventListener("keydown", onKeyDown, true);
425
+ };
426
+ }
427
+
1
428
  // src/client/createMindooDBAppBridge.ts
2
429
  import { parseMindooDBFormulaBooleanExpression } from "mindoodb-view-language";
3
430
 
@@ -201,6 +628,15 @@ function isUiPreferencesChangedMessage(message) {
201
628
  function isLocaleChangedMessage(message) {
202
629
  return message.kind === "locale-changed";
203
630
  }
631
+ function isDragOverMessage(message) {
632
+ return message.kind === "drag-over";
633
+ }
634
+ function isDragLeaveMessage(message) {
635
+ return message.kind === "drag-leave";
636
+ }
637
+ function isDragDropMessage(message) {
638
+ return message.kind === "drag-drop";
639
+ }
204
640
  function toStreamError(message) {
205
641
  const error = new Error(message.error.message);
206
642
  error.name = message.error.code || "MindooDBAppBridgeStreamError";
@@ -755,11 +1191,11 @@ var MindooDBAppDatabaseImpl = class {
755
1191
  }
756
1192
  const ids = [];
757
1193
  for (const input of inputs) {
758
- const document = await this.rpc.call("documents.create", {
1194
+ const document2 = await this.rpc.call("documents.create", {
759
1195
  databaseId: this.databaseId,
760
1196
  input
761
1197
  });
762
- ids.push(document.id);
1198
+ ids.push(document2.id);
763
1199
  }
764
1200
  return { ids };
765
1201
  }
@@ -1077,8 +1513,72 @@ var MindooDBAppDatabaseImpl = class {
1077
1513
  });
1078
1514
  }
1079
1515
  };
1516
+ var MindooDBAppDragApiImpl = class {
1517
+ constructor(rpc) {
1518
+ this.rpc = rpc;
1519
+ this.rpc.addMessageListener((message) => {
1520
+ if (isDragOverMessage(message)) {
1521
+ const result = this.profile?.onOver?.({
1522
+ x: message.x,
1523
+ y: message.y,
1524
+ types: message.types
1525
+ });
1526
+ const accept = result?.accept ?? true;
1527
+ void this.rpc.call("drag.reportHover", {
1528
+ accept,
1529
+ effect: accept ? result?.effect ?? "copy" : "forbidden"
1530
+ }).catch((error) => {
1531
+ console.warn("[mindoodb-app-sdk] Could not report a drag hover.", error);
1532
+ });
1533
+ return;
1534
+ }
1535
+ if (isDragLeaveMessage(message)) {
1536
+ this.profile?.onLeave?.();
1537
+ return;
1538
+ }
1539
+ if (isDragDropMessage(message)) {
1540
+ this.profile?.onDrop?.({
1541
+ x: message.x,
1542
+ y: message.y,
1543
+ items: message.items
1544
+ });
1545
+ }
1546
+ });
1547
+ }
1548
+ rpc;
1549
+ profile = null;
1550
+ unbindSources = /* @__PURE__ */ new Set();
1551
+ async setProfile(profile) {
1552
+ this.profile = profile;
1553
+ await this.rpc.call("drag.setProfile", {
1554
+ accepts: normalizeDragAccepts(profile.accepts)
1555
+ });
1556
+ }
1557
+ async start(input) {
1558
+ return await this.rpc.call(
1559
+ "drag.start",
1560
+ normalizeDragStartInput(input)
1561
+ );
1562
+ }
1563
+ async cancel() {
1564
+ await this.rpc.call("drag.cancel", {});
1565
+ }
1566
+ bindSource(element, options) {
1567
+ const unbind = bindDragSource(element, options, (input) => this.start(input));
1568
+ this.unbindSources.add(unbind);
1569
+ return () => {
1570
+ unbind();
1571
+ this.unbindSources.delete(unbind);
1572
+ };
1573
+ }
1574
+ dispose() {
1575
+ this.unbindSources.forEach((unbind) => unbind());
1576
+ this.unbindSources.clear();
1577
+ this.profile = null;
1578
+ }
1579
+ };
1080
1580
  var MindooDBAppSessionImpl = class {
1081
- constructor(rpc, onDisconnect) {
1581
+ constructor(rpc, onDisconnect, hostShortcutsEnabled = true) {
1082
1582
  this.rpc = rpc;
1083
1583
  this.onDisconnect = onDisconnect;
1084
1584
  this.menus = {
@@ -1087,6 +1587,7 @@ var MindooDBAppSessionImpl = class {
1087
1587
  await this.rpc.call("menus.hide", {});
1088
1588
  }
1089
1589
  };
1590
+ this.drag = new MindooDBAppDragApiImpl(this.rpc);
1090
1591
  this.storage = {
1091
1592
  snapshot: async (options) => await this.rpc.call("appStorage.snapshot", {
1092
1593
  prefixes: options?.prefixes
@@ -1107,13 +1608,39 @@ var MindooDBAppSessionImpl = class {
1107
1608
  if (message.kind === "before-close") {
1108
1609
  void this.handleBeforeClose(message.closeId);
1109
1610
  }
1611
+ if (message.kind === "shortcuts-changed") {
1612
+ const next = sanitizeHostShortcutBindings(message.shortcuts);
1613
+ if (next) {
1614
+ this.hostShortcuts = next;
1615
+ }
1616
+ }
1110
1617
  });
1618
+ this.stopHostShortcuts = hostShortcutsEnabled ? installHostShortcutCapture({
1619
+ getShortcuts: () => this.hostShortcuts,
1620
+ onInvoke: (action) => {
1621
+ if (!isHostShortcutAction(action)) {
1622
+ return;
1623
+ }
1624
+ try {
1625
+ this.rpc.postMessage({
1626
+ protocol: PROTOCOL2,
1627
+ kind: "shortcut-invoked",
1628
+ action
1629
+ });
1630
+ } catch (error) {
1631
+ console.warn("[mindoodb-app-sdk] Could not report a host shortcut.", error);
1632
+ }
1633
+ }
1634
+ }) : () => void 0;
1111
1635
  }
1112
1636
  rpc;
1113
1637
  onDisconnect;
1114
1638
  menus;
1639
+ drag;
1115
1640
  storage;
1116
1641
  beforeCloseListeners = /* @__PURE__ */ new Set();
1642
+ hostShortcuts = DEFAULT_HAVEN_HOST_SHORTCUTS;
1643
+ stopHostShortcuts;
1117
1644
  /**
1118
1645
  * Lets every listener finish, then tells the host it may proceed.
1119
1646
  *
@@ -1251,6 +1778,8 @@ var MindooDBAppSessionImpl = class {
1251
1778
  }
1252
1779
  /** Disconnects from the host and always disposes the underlying port client. */
1253
1780
  async disconnect() {
1781
+ this.stopHostShortcuts();
1782
+ this.drag.dispose();
1254
1783
  try {
1255
1784
  await this.rpc.call("session.disconnect", {});
1256
1785
  } finally {
@@ -1277,12 +1806,17 @@ function createMindooDBAppBridge() {
1277
1806
  }
1278
1807
  const pending = (async () => {
1279
1808
  const port = await waitForConnectedPort(options, launchId);
1809
+ applyHostedDocumentOverscrollContain();
1280
1810
  const rpc = new PortRpcClient(port);
1281
- return new MindooDBAppSessionImpl(rpc, () => {
1282
- if (sessionsByLaunchId.get(launchId) === pending) {
1283
- sessionsByLaunchId.delete(launchId);
1284
- }
1285
- });
1811
+ return new MindooDBAppSessionImpl(
1812
+ rpc,
1813
+ () => {
1814
+ if (sessionsByLaunchId.get(launchId) === pending) {
1815
+ sessionsByLaunchId.delete(launchId);
1816
+ }
1817
+ },
1818
+ options?.hostShortcuts !== false
1819
+ );
1286
1820
  })();
1287
1821
  sessionsByLaunchId.set(launchId, pending);
1288
1822
  try {
@@ -1298,6 +1832,25 @@ function createMindooDBAppBridge() {
1298
1832
  }
1299
1833
 
1300
1834
  export {
1835
+ MINDOODB_APP_MAX_DRAG_TYPES,
1836
+ MINDOODB_APP_MAX_DRAG_PAYLOAD_BYTES,
1837
+ MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES,
1838
+ MINDOODB_APP_MAX_DRAG_PREVIEW_EDGE,
1839
+ DEFAULT_DRAG_LONG_PRESS_MS,
1840
+ DEFAULT_DRAG_POINTER_THRESHOLD_PX,
1841
+ MINIMAL_DRAG_PREVIEW_PNG,
1842
+ MindooDBAppDragInputError,
1843
+ isMindooDBAppDragType,
1844
+ normalizeDragAccepts,
1845
+ normalizeDragStartInput,
1846
+ snapshotElementToPng,
1847
+ bindDragSource,
1848
+ DEFAULT_HAVEN_HOST_SHORTCUTS,
1849
+ matchHostShortcut,
1850
+ isHostShortcutAction,
1851
+ sanitizeHostShortcutBindings,
1852
+ applyHostedDocumentOverscrollContain,
1853
+ installHostShortcutCapture,
1301
1854
  releaseMindooDBAppBridgeSessions,
1302
1855
  createMindooDBAppBridge
1303
1856
  };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppBridge, b as MindooDBAppHostingMode, c as MindooDBAppDatabase, d as MindooDBAppDocument, e as MindooDBAppRichTextSpan, f as MindooDBAppRichTextSnapshot } from './types-DxnCg5IW.js';
2
- export { g as MINDOODB_APP_SEAL_SIGNING_DOMAIN, h as MindooDBAppAccessDecision, i as MindooDBAppAccessTier, j as MindooDBAppAttachmentApi, k as MindooDBAppAttachmentChunk, l as MindooDBAppAttachmentInfo, m as MindooDBAppAttachmentPreviewOptions, n as MindooDBAppAttachmentPreviewSession, o as MindooDBAppAutomergeChangesPatch, p as MindooDBAppAutomergeChangesSince, q as MindooDBAppAutomergeGetOptions, r as MindooDBAppAutomergePatchResult, s as MindooDBAppAutomergeSnapshot, t as MindooDBAppBridgeBeforeCloseAck, u as MindooDBAppBridgeBeforeCloseMessage, v as MindooDBAppBridgeConnectMessage, w as MindooDBAppBridgeConnectOptions, x as MindooDBAppBridgeConnectedMessage, y as MindooDBAppBridgeErrorPayload, z as MindooDBAppBridgeHandshakeErrorMessage, A as MindooDBAppBridgeLocaleChangedMessage, B as MindooDBAppBridgePortMessage, C as MindooDBAppBridgeQueryResultMessage, D as MindooDBAppBridgeRpcError, E as MindooDBAppBridgeRpcMessage, F as MindooDBAppBridgeRpcRequest, G as MindooDBAppBridgeRpcSuccess, H as MindooDBAppBridgeStreamAbortRequest, I as MindooDBAppBridgeStreamAck, J as MindooDBAppBridgeStreamCloseRequest, K as MindooDBAppBridgeStreamError, L as MindooDBAppBridgeStreamMessage, N as MindooDBAppBridgeStreamOpenResult, O as MindooDBAppBridgeStreamReadRequest, P as MindooDBAppBridgeStreamWriteRequest, Q as MindooDBAppBridgeThemeChangedMessage, R as MindooDBAppBridgeUiPreferencesChangedMessage, S as MindooDBAppBridgeViewChangedMessage, T as MindooDBAppBridgeViewportChangedMessage, U as MindooDBAppCapability, V as MindooDBAppConfiguredViewCategorizationStyle, W as MindooDBAppConfiguredViewColumn, X as MindooDBAppConfiguredViewColumnRole, Y as MindooDBAppConfiguredViewExpressionMode, Z as MindooDBAppConfiguredViewFieldExpression, _ as MindooDBAppConfiguredViewFilterDefinition, $ as MindooDBAppConfiguredViewFilterMode, a0 as MindooDBAppConfiguredViewFilterRule, a1 as MindooDBAppConfiguredViewFormulaExpression, a2 as MindooDBAppConfiguredViewFormulaFilterDefinition, a3 as MindooDBAppConfiguredViewPreviewMode, a4 as MindooDBAppConfiguredViewRuleFilterDefinition, a5 as MindooDBAppConfiguredViewRuleMatchMode, a6 as MindooDBAppConfiguredViewRuleOperator, a7 as MindooDBAppConfiguredViewValueExpression, a8 as MindooDBAppCreateDocumentInput, a9 as MindooDBAppCreateKeyInfo, aa as MindooDBAppCreateViewInput, ab as MindooDBAppCreateViewNavigatorInput, ac as MindooDBAppDatabaseInfo, ad as MindooDBAppDirectoryApi, ae as MindooDBAppDirectoryEntry, af as MindooDBAppDocumentApi, ag as MindooDBAppDocumentHeadCursorResult, ah as MindooDBAppDocumentHistoryEntry, ai as MindooDBAppDocumentListQuery, aj as MindooDBAppDocumentListResult, ak as MindooDBAppDocumentQuery, al as MindooDBAppDocumentRevisionId, am as MindooDBAppDocumentScanPreset, an as MindooDBAppDocumentSummary, ao as MindooDBAppEntryAttachmentRef, ap as MindooDBAppEntryProvenance, aq as MindooDBAppExtractDocumentTextInput, ar as MindooDBAppExtractDocumentTextResult, as as MindooDBAppExtractTextFormat, at as MindooDBAppExtractionSetup, au as MindooDBAppFulltextSetup, av as MindooDBAppHistoricalDocument, aw as MindooDBAppHistoryQuery, ax as MindooDBAppHostTheme, ay as MindooDBAppIdentityApi, az as MindooDBAppInaccessibleDocument, aA as MindooDBAppInaccessibleDocumentListQuery, aB as MindooDBAppInaccessibleDocumentListResult, aC as MindooDBAppJsonListDeletePatch, aD as MindooDBAppJsonListInsertPatch, aE as MindooDBAppJsonPatch, aF as MindooDBAppJsonSetPatch, aG as MindooDBAppJsonTextMarkPatch, aH as MindooDBAppJsonTextSplicePatch, aI as MindooDBAppJsonTextUnmarkPatch, aJ as MindooDBAppJsonUnsetPatch, aK as MindooDBAppLaunchContext, aL as MindooDBAppLiveQuerySubscription, aM as MindooDBAppMenuAnchor, aN as MindooDBAppMenuApi, aO as MindooDBAppMenuCommandItem, aP as MindooDBAppMenuDismissReason, aQ as MindooDBAppMenuDismissedResult, aR as MindooDBAppMenuItem, aS as MindooDBAppMenuKind, aT as MindooDBAppMenuPlacement, aU as MindooDBAppMenuPointAnchor, aV as MindooDBAppMenuRect, aW as MindooDBAppMenuRectAnchor, aX as MindooDBAppMenuSelectionResult, aY as MindooDBAppMenuSeparatorItem, aZ as MindooDBAppQueryCoverage, a_ as MindooDBAppQueryResult, a$ as MindooDBAppQueryRow, b0 as MindooDBAppQuerySortKey, b1 as MindooDBAppQueryTextClause, b2 as MindooDBAppReadableAttachmentStream, b3 as MindooDBAppRecipientOptions, b4 as MindooDBAppResolvedViewDefinition, b5 as MindooDBAppResolvedViewSource, b6 as MindooDBAppRevisionPhase, b7 as MindooDBAppRevisionVerification, b8 as MindooDBAppRichTextBlockSpan, b9 as MindooDBAppRichTextGetOptions, ba as MindooDBAppRichTextImmutableString, bb as MindooDBAppRichTextMarkRange, bc as MindooDBAppRichTextMaterializeValue, bd as MindooDBAppRichTextPatch, be as MindooDBAppRichTextScalar, bf as MindooDBAppRichTextSpliceStep, bg as MindooDBAppRichTextStep, bh as MindooDBAppRichTextStepPatch, bi as MindooDBAppRichTextTextSpan, bj as MindooDBAppRuntime, bk as MindooDBAppScanAttachmentOptions, bl as MindooDBAppScanAttachmentResult, bm as MindooDBAppScopedDocId, bn as MindooDBAppScopedDocumentSummary, bo as MindooDBAppSealIntent, bp as MindooDBAppSealedChannelOpenInput, bq as MindooDBAppSealedChannelOpenResult, br as MindooDBAppSealedChannelRequestInput, bs as MindooDBAppSession, bt as MindooDBAppShowMenuInput, bu as MindooDBAppShowMenuResult, bv as MindooDBAppSignPreview, bw as MindooDBAppSignPreviewScope, bx as MindooDBAppSignStatementInput, by as MindooDBAppSignStatementResult, bz as MindooDBAppStorageApi, bA as MindooDBAppTextEdit, bB as MindooDBAppTextPatch, bC as MindooDBAppThemeMode, bD as MindooDBAppTimestampApi, bE as MindooDBAppTimestampInput, bF as MindooDBAppTimestampProvider, bG as MindooDBAppTimestampResult, bH as MindooDBAppUiPreferences, bI as MindooDBAppUpdateDocumentInput, bJ as MindooDBAppViewCursorDocumentListResult, bK as MindooDBAppViewCursorResult, bL as MindooDBAppViewEntry, bM as MindooDBAppViewEntryKind, bN as MindooDBAppViewNavigator, bO as MindooDBAppViewNavigatorExpansionState, bP as MindooDBAppViewNavigatorOpenOptions, bQ as MindooDBAppViewNavigatorPageOptions, bR as MindooDBAppViewNavigatorPageResult, bS as MindooDBAppViewNavigatorRangeQuery, bT as MindooDBAppViewNavigatorSelectionState, bU as MindooDBAppViewUpdateStats, bV as MindooDBAppViewport, bW as MindooDBAppWritableAttachmentStream } from './types-DxnCg5IW.js';
1
+ import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppDragBindSourceOptions, b as MindooDBAppDragStartInput, c as MindooDBAppDragStartResult, d as MindooDBAppDragPreview, e as MindooDBAppBridge, f as MindooDBAppHostShortcutBinding, g as MindooDBAppHostShortcutAction, h as MindooDBAppHostingMode, i as MindooDBAppDatabase, j as MindooDBAppDocument, k as MindooDBAppRichTextSpan, l as MindooDBAppRichTextSnapshot } from './types-M3RwHErO.js';
2
+ export { m as MINDOODB_APP_SEAL_SIGNING_DOMAIN, n as MINDOODB_APP_WELL_KNOWN_DRAG_TYPES, o as MindooDBAppAccessDecision, p as MindooDBAppAccessTier, q as MindooDBAppAttachmentApi, r as MindooDBAppAttachmentChunk, s as MindooDBAppAttachmentInfo, t as MindooDBAppAttachmentPreviewOptions, u as MindooDBAppAttachmentPreviewSession, v as MindooDBAppAutomergeChangesPatch, w as MindooDBAppAutomergeChangesSince, x as MindooDBAppAutomergeGetOptions, y as MindooDBAppAutomergePatchResult, z as MindooDBAppAutomergeSnapshot, A as MindooDBAppBridgeBeforeCloseAck, B as MindooDBAppBridgeBeforeCloseMessage, C as MindooDBAppBridgeConnectMessage, D as MindooDBAppBridgeConnectOptions, E as MindooDBAppBridgeConnectedMessage, F as MindooDBAppBridgeDragDropMessage, G as MindooDBAppBridgeDragLeaveMessage, H as MindooDBAppBridgeDragOverMessage, I as MindooDBAppBridgeErrorPayload, J as MindooDBAppBridgeHandshakeErrorMessage, K as MindooDBAppBridgeLocaleChangedMessage, L as MindooDBAppBridgePortMessage, N as MindooDBAppBridgeQueryResultMessage, O as MindooDBAppBridgeRpcError, P as MindooDBAppBridgeRpcMessage, Q as MindooDBAppBridgeRpcRequest, R as MindooDBAppBridgeRpcSuccess, S as MindooDBAppBridgeShortcutInvokedMessage, T as MindooDBAppBridgeShortcutsChangedMessage, U as MindooDBAppBridgeStreamAbortRequest, V as MindooDBAppBridgeStreamAck, W as MindooDBAppBridgeStreamCloseRequest, X as MindooDBAppBridgeStreamError, Y as MindooDBAppBridgeStreamMessage, Z as MindooDBAppBridgeStreamOpenResult, _ as MindooDBAppBridgeStreamReadRequest, $ as MindooDBAppBridgeStreamWriteRequest, a0 as MindooDBAppBridgeThemeChangedMessage, a1 as MindooDBAppBridgeUiPreferencesChangedMessage, a2 as MindooDBAppBridgeViewChangedMessage, a3 as MindooDBAppBridgeViewportChangedMessage, a4 as MindooDBAppCapability, a5 as MindooDBAppConfiguredViewCategorizationStyle, a6 as MindooDBAppConfiguredViewColumn, a7 as MindooDBAppConfiguredViewColumnRole, a8 as MindooDBAppConfiguredViewExpressionMode, a9 as MindooDBAppConfiguredViewFieldExpression, aa as MindooDBAppConfiguredViewFilterDefinition, ab as MindooDBAppConfiguredViewFilterMode, ac as MindooDBAppConfiguredViewFilterRule, ad as MindooDBAppConfiguredViewFormulaExpression, ae as MindooDBAppConfiguredViewFormulaFilterDefinition, af as MindooDBAppConfiguredViewPreviewMode, ag as MindooDBAppConfiguredViewRuleFilterDefinition, ah as MindooDBAppConfiguredViewRuleMatchMode, ai as MindooDBAppConfiguredViewRuleOperator, aj as MindooDBAppConfiguredViewValueExpression, ak as MindooDBAppCreateDocumentInput, al as MindooDBAppCreateKeyInfo, am as MindooDBAppCreateViewInput, an as MindooDBAppCreateViewNavigatorInput, ao as MindooDBAppDatabaseInfo, ap as MindooDBAppDirectoryApi, aq as MindooDBAppDirectoryEntry, ar as MindooDBAppDocumentApi, as as MindooDBAppDocumentHeadCursorResult, at as MindooDBAppDocumentHistoryEntry, au as MindooDBAppDocumentListQuery, av as MindooDBAppDocumentListResult, aw as MindooDBAppDocumentQuery, ax as MindooDBAppDocumentRevisionId, ay as MindooDBAppDocumentScanPreset, az as MindooDBAppDocumentSummary, aA as MindooDBAppDragApi, aB as MindooDBAppDragCancelReason, aC as MindooDBAppDragDropEvent, aD as MindooDBAppDragEffect, aE as MindooDBAppDragHoverResult, aF as MindooDBAppDragOffer, aG as MindooDBAppDragOverEvent, aH as MindooDBAppDragPointer, aI as MindooDBAppDragProfile, aJ as MindooDBAppEntryAttachmentRef, aK as MindooDBAppEntryProvenance, aL as MindooDBAppExtractDocumentTextInput, aM as MindooDBAppExtractDocumentTextResult, aN as MindooDBAppExtractTextFormat, aO as MindooDBAppExtractionSetup, aP as MindooDBAppFulltextSetup, aQ as MindooDBAppHistoricalDocument, aR as MindooDBAppHistoryQuery, aS as MindooDBAppHostTheme, aT as MindooDBAppIdentityApi, aU as MindooDBAppInaccessibleDocument, aV as MindooDBAppInaccessibleDocumentListQuery, aW as MindooDBAppInaccessibleDocumentListResult, aX as MindooDBAppJsonListDeletePatch, aY as MindooDBAppJsonListInsertPatch, aZ as MindooDBAppJsonPatch, a_ as MindooDBAppJsonSetPatch, a$ as MindooDBAppJsonTextMarkPatch, b0 as MindooDBAppJsonTextSplicePatch, b1 as MindooDBAppJsonTextUnmarkPatch, b2 as MindooDBAppJsonUnsetPatch, b3 as MindooDBAppLaunchContext, b4 as MindooDBAppLiveQuerySubscription, b5 as MindooDBAppMenuAnchor, b6 as MindooDBAppMenuApi, b7 as MindooDBAppMenuCommandItem, b8 as MindooDBAppMenuDismissReason, b9 as MindooDBAppMenuDismissedResult, ba as MindooDBAppMenuItem, bb as MindooDBAppMenuKind, bc as MindooDBAppMenuPlacement, bd as MindooDBAppMenuPointAnchor, be as MindooDBAppMenuRect, bf as MindooDBAppMenuRectAnchor, bg as MindooDBAppMenuSelectionResult, bh as MindooDBAppMenuSeparatorItem, bi as MindooDBAppQueryCoverage, bj as MindooDBAppQueryResult, bk as MindooDBAppQueryRow, bl as MindooDBAppQuerySortKey, bm as MindooDBAppQueryTextClause, bn as MindooDBAppReadableAttachmentStream, bo as MindooDBAppRecipientOptions, bp as MindooDBAppResolvedViewDefinition, bq as MindooDBAppResolvedViewSource, br as MindooDBAppRevisionPhase, bs as MindooDBAppRevisionVerification, bt as MindooDBAppRichTextBlockSpan, bu as MindooDBAppRichTextGetOptions, bv as MindooDBAppRichTextImmutableString, bw as MindooDBAppRichTextMarkRange, bx as MindooDBAppRichTextMaterializeValue, by as MindooDBAppRichTextPatch, bz as MindooDBAppRichTextScalar, bA as MindooDBAppRichTextSpliceStep, bB as MindooDBAppRichTextStep, bC as MindooDBAppRichTextStepPatch, bD as MindooDBAppRichTextTextSpan, bE as MindooDBAppRuntime, bF as MindooDBAppScanAttachmentOptions, bG as MindooDBAppScanAttachmentResult, bH as MindooDBAppScopedDocId, bI as MindooDBAppScopedDocumentSummary, bJ as MindooDBAppSealIntent, bK as MindooDBAppSealedChannelOpenInput, bL as MindooDBAppSealedChannelOpenResult, bM as MindooDBAppSealedChannelRequestInput, bN as MindooDBAppSession, bO as MindooDBAppShowMenuInput, bP as MindooDBAppShowMenuResult, bQ as MindooDBAppSignPreview, bR as MindooDBAppSignPreviewScope, bS as MindooDBAppSignStatementInput, bT as MindooDBAppSignStatementResult, bU as MindooDBAppStorageApi, bV as MindooDBAppTextEdit, bW as MindooDBAppTextPatch, bX as MindooDBAppThemeMode, bY as MindooDBAppTimestampApi, bZ as MindooDBAppTimestampInput, b_ as MindooDBAppTimestampProvider, b$ as MindooDBAppTimestampResult, c0 as MindooDBAppUiPreferences, c1 as MindooDBAppUpdateDocumentInput, c2 as MindooDBAppViewCursorDocumentListResult, c3 as MindooDBAppViewCursorResult, c4 as MindooDBAppViewEntry, c5 as MindooDBAppViewEntryKind, c6 as MindooDBAppViewNavigator, c7 as MindooDBAppViewNavigatorExpansionState, c8 as MindooDBAppViewNavigatorOpenOptions, c9 as MindooDBAppViewNavigatorPageOptions, ca as MindooDBAppViewNavigatorPageResult, cb as MindooDBAppViewNavigatorRangeQuery, cc as MindooDBAppViewNavigatorSelectionState, cd as MindooDBAppViewUpdateStats, ce as MindooDBAppViewport, cf as MindooDBAppWellKnownDragType, cg as MindooDBAppWritableAttachmentStream } from './types-M3RwHErO.js';
3
3
  export { M as MINDOODB_APP_BUNDLE_ARCHIVE_FILE_NAME, a as MINDOODB_APP_BUNDLE_MANIFEST_FILE_NAME, b as MINDOODB_APP_BUNDLE_MANIFEST_FORMAT, c as MINDOODB_APP_BUNDLE_MANIFEST_VERSION, d as MindooDBAppBundleArchive, e as MindooDBAppBundleFileEntry, f as MindooDBAppBundleHash, g as MindooDBAppBundleManifest, h as MindooDBAppBundleManifestValidation, i as buildMindooDBAppBundleContentHashInput, j as isMindooDBAppBundleHash, n as normalizeMindooDBAppBundlePath, v as validateMindooDBAppBundleManifest } from './appBundleManifest-B0xfpaXG.js';
4
4
  import { MindooDBAppBooleanExpression } from 'mindoodb-view-language';
5
5
  export { MindooDBAppBooleanExpression, MindooDBAppExpression, MindooDBAppFilterDefinition, MindooDBAppViewCategoryChildrenPageRequest, MindooDBAppViewColumn, MindooDBAppViewColumnRole, MindooDBAppViewDefinition, MindooDBAppViewExpansionState, MindooDBAppViewExpressionBase, MindooDBAppViewExpressionDatePart, MindooDBAppViewExpressionOperation, MindooDBAppViewFieldExpression, MindooDBAppViewIfExpression, MindooDBAppViewLetExpression, MindooDBAppViewLiteralExpression, MindooDBAppViewLookupByPath, MindooDBAppViewOperationExpression, MindooDBAppViewOriginExpression, MindooDBAppViewPageRequest, MindooDBAppViewPageResult, MindooDBAppViewRow, MindooDBAppViewSortDirection, MindooDBAppViewTotalMode, MindooDBAppViewValueExpressionRef, MindooDBAppViewVariableExpression, createViewLanguage } from 'mindoodb-view-language';
@@ -31,6 +31,57 @@ declare function abbreviateCanonicalName(value: string): string;
31
31
  */
32
32
  declare function expandAbbreviatedName(value: string): string;
33
33
 
34
+ /**
35
+ * Client helpers for host-owned cross-iframe drag.
36
+ *
37
+ * Validation lives here so the SDK rejects bad `start` / `setProfile`
38
+ * payloads before they cross the bridge. Haven re-validates the same
39
+ * limits on untyped JSON. `bindDragSource` and `snapshotElementToPng`
40
+ * stay in the app document: Haven only ever receives PNG bytes and
41
+ * string snapshots.
42
+ *
43
+ * @module drag
44
+ */
45
+
46
+ /** Maximum number of types in one profile or start payload. */
47
+ declare const MINDOODB_APP_MAX_DRAG_TYPES = 8;
48
+ /** Maximum UTF-8 size of one offer string. */
49
+ declare const MINDOODB_APP_MAX_DRAG_PAYLOAD_BYTES: number;
50
+ /** Maximum encoded PNG size for the host ghost. */
51
+ declare const MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES: number;
52
+ /** Longest CSS-pixel edge Haven will display for a ghost. */
53
+ declare const MINDOODB_APP_MAX_DRAG_PREVIEW_EDGE = 512;
54
+ /** Touch hold before the host takes over. */
55
+ declare const DEFAULT_DRAG_LONG_PRESS_MS = 400;
56
+ /** Mouse/pen start distance, and touch scroll-cancel slop. */
57
+ declare const DEFAULT_DRAG_POINTER_THRESHOLD_PX = 8;
58
+ /**
59
+ * 1×1 PNG used when the browser cannot snapshot a node. Haven still
60
+ * sizes the ghost from `preview.width` / `preview.height`.
61
+ */
62
+ declare const MINIMAL_DRAG_PREVIEW_PNG: Uint8Array<ArrayBuffer>;
63
+ /** Structured validation failure. `name` is the bridge error code. */
64
+ declare class MindooDBAppDragInputError extends Error {
65
+ name: string;
66
+ constructor(message: string);
67
+ }
68
+ /** True when `type` is a MIME-like token Haven will accept. */
69
+ declare function isMindooDBAppDragType(type: string): boolean;
70
+ /** Project and validate the `accepts` list sent with `drag.setProfile`. */
71
+ declare function normalizeDragAccepts(value: unknown): string[];
72
+ /** Project and validate a `drag.start` payload. */
73
+ declare function normalizeDragStartInput(value: unknown): MindooDBAppDragStartInput;
74
+ /**
75
+ * Snapshot an element in the app document. Failures fall back to a labeled
76
+ * card or a 1×1 PNG — Haven must never receive HTML.
77
+ */
78
+ declare function snapshotElementToPng(element: HTMLElement): Promise<MindooDBAppDragPreview>;
79
+ /**
80
+ * Start a host drag from a pointer gesture. Mouse/pen use a move threshold;
81
+ * touch waits for a long-press so lists can still scroll.
82
+ */
83
+ declare function bindDragSource(element: HTMLElement, options: MindooDBAppDragBindSourceOptions, start: (input: MindooDBAppDragStartInput) => Promise<MindooDBAppDragStartResult>): () => void;
84
+
34
85
  /**
35
86
  * Drops memoised sessions so the next `connect()` performs a fresh handshake.
36
87
  *
@@ -54,6 +105,38 @@ declare function releaseMindooDBAppBridgeSessions(launchId?: string): void;
54
105
  */
55
106
  declare function createMindooDBAppBridge(): MindooDBAppBridge;
56
107
 
108
+ /**
109
+ * Haven's default host chords. Both sides of the bridge use this table so a
110
+ * key that Haven handles on its own pages is the same key an iframe reports.
111
+ *
112
+ * `code` is the physical {@link KeyboardEvent.code}: layout-independent, so
113
+ * AltGr on a German keyboard cannot turn these into `@` or a nbsp.
114
+ */
115
+ declare const DEFAULT_HAVEN_HOST_SHORTCUTS: readonly MindooDBAppHostShortcutBinding[];
116
+ /**
117
+ * Returns the host action for this key event, or `null` when it is not one
118
+ * of the registered chords. `Alt` is rejected so AltGr (`Ctrl+Alt` on
119
+ * European Windows layouts) never fires a shortcut while typing.
120
+ */
121
+ declare function matchHostShortcut(event: Pick<KeyboardEvent, "code" | "shiftKey" | "metaKey" | "ctrlKey" | "altKey" | "repeat">, shortcuts?: readonly MindooDBAppHostShortcutBinding[]): MindooDBAppHostShortcutAction | null;
122
+ declare function isHostShortcutAction(value: unknown): value is MindooDBAppHostShortcutAction;
123
+ /** Accepts a host-pushed table; anything malformed is ignored. */
124
+ declare function sanitizeHostShortcutBindings(value: unknown): MindooDBAppHostShortcutBinding[] | null;
125
+ /**
126
+ * Stops wheel chaining out of a hosted app document into Haven's workspace
127
+ * scroller once the app page (or its `body`) has reached its end.
128
+ */
129
+ declare function applyHostedDocumentOverscrollContain(doc?: Document | undefined): void;
130
+ /**
131
+ * Capture-phase listener that reports a matched host chord. Returns a disposer.
132
+ * No-ops when `document` is missing (Node tests that stub only `window`).
133
+ */
134
+ declare function installHostShortcutCapture(options: {
135
+ getShortcuts: () => readonly MindooDBAppHostShortcutBinding[];
136
+ onInvoke: (action: MindooDBAppHostShortcutAction) => void;
137
+ target?: Document;
138
+ }): () => void;
139
+
57
140
  /**
58
141
  * Query parameter the host appends to the app URL so the app can tell how it is being
59
142
  * delivered before any asynchronous work has happened.
@@ -274,4 +357,4 @@ declare function createMindooDBTextBuffer(options: CreateMindooDBTextBufferOptio
274
357
  */
275
358
  declare function queryDocuments(db: Pick<MindooDB, "query">, filter: MindooDBAppBooleanExpression | string, sortBy?: MindooQuerySortKey[], options?: MindooQueryOptions): Promise<MindooQueryResult>;
276
359
 
277
- export { type CreateMindooDBRichTextHandleOptions, type CreateMindooDBTextBufferOptions, type HavenStorageShimHandle, type InstallHavenStorageShimOptions, MINDOODB_APP_HOSTING_QUERY_PARAM, MindooDBAppAttachmentPreviewMode, MindooDBAppBridge, MindooDBAppDatabase, MindooDBAppDocument, MindooDBAppHostingMode, MindooDBAppRichTextSnapshot, MindooDBAppRichTextSpan, MindooDBRichTextHandle, type MindooDBRichTextHandleChangeListener, type MindooDBRichTextHandleFlushResult, MindooDBTextBuffer, type MindooDBTextBufferFlushResult, abbreviateCanonicalName, canPreviewAttachment, createMindooDBAppBridge, createMindooDBRichTextHandle, createMindooDBTextBuffer, expandAbbreviatedName, installHavenStorageShim, isHostedBundleRuntime, queryDocuments, readMindooDBAppHostingMode, releaseMindooDBAppBridgeSessions };
360
+ export { type CreateMindooDBRichTextHandleOptions, type CreateMindooDBTextBufferOptions, DEFAULT_DRAG_LONG_PRESS_MS, DEFAULT_DRAG_POINTER_THRESHOLD_PX, DEFAULT_HAVEN_HOST_SHORTCUTS, type HavenStorageShimHandle, type InstallHavenStorageShimOptions, MINDOODB_APP_HOSTING_QUERY_PARAM, MINDOODB_APP_MAX_DRAG_PAYLOAD_BYTES, MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES, MINDOODB_APP_MAX_DRAG_PREVIEW_EDGE, MINDOODB_APP_MAX_DRAG_TYPES, MINIMAL_DRAG_PREVIEW_PNG, MindooDBAppAttachmentPreviewMode, MindooDBAppBridge, MindooDBAppDatabase, MindooDBAppDocument, MindooDBAppDragBindSourceOptions, MindooDBAppDragInputError, MindooDBAppDragPreview, MindooDBAppDragStartInput, MindooDBAppDragStartResult, MindooDBAppHostShortcutAction, MindooDBAppHostShortcutBinding, MindooDBAppHostingMode, MindooDBAppRichTextSnapshot, MindooDBAppRichTextSpan, MindooDBRichTextHandle, type MindooDBRichTextHandleChangeListener, type MindooDBRichTextHandleFlushResult, MindooDBTextBuffer, type MindooDBTextBufferFlushResult, abbreviateCanonicalName, applyHostedDocumentOverscrollContain, bindDragSource, canPreviewAttachment, createMindooDBAppBridge, createMindooDBRichTextHandle, createMindooDBTextBuffer, expandAbbreviatedName, installHavenStorageShim, installHostShortcutCapture, isHostShortcutAction, isHostedBundleRuntime, isMindooDBAppDragType, matchHostShortcut, normalizeDragAccepts, normalizeDragStartInput, queryDocuments, readMindooDBAppHostingMode, releaseMindooDBAppBridgeSessions, sanitizeHostShortcutBindings, snapshotElementToPng };
package/dist/index.js CHANGED
@@ -1,7 +1,26 @@
1
1
  import {
2
+ DEFAULT_DRAG_LONG_PRESS_MS,
3
+ DEFAULT_DRAG_POINTER_THRESHOLD_PX,
4
+ DEFAULT_HAVEN_HOST_SHORTCUTS,
5
+ MINDOODB_APP_MAX_DRAG_PAYLOAD_BYTES,
6
+ MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES,
7
+ MINDOODB_APP_MAX_DRAG_PREVIEW_EDGE,
8
+ MINDOODB_APP_MAX_DRAG_TYPES,
9
+ MINIMAL_DRAG_PREVIEW_PNG,
10
+ MindooDBAppDragInputError,
11
+ applyHostedDocumentOverscrollContain,
12
+ bindDragSource,
2
13
  createMindooDBAppBridge,
3
- releaseMindooDBAppBridgeSessions
4
- } from "./chunk-6433L6TE.js";
14
+ installHostShortcutCapture,
15
+ isHostShortcutAction,
16
+ isMindooDBAppDragType,
17
+ matchHostShortcut,
18
+ normalizeDragAccepts,
19
+ normalizeDragStartInput,
20
+ releaseMindooDBAppBridgeSessions,
21
+ sanitizeHostShortcutBindings,
22
+ snapshotElementToPng
23
+ } from "./chunk-ZO7UE6B2.js";
5
24
  import {
6
25
  MINDOODB_APP_BUNDLE_ARCHIVE_FILE_NAME,
7
26
  MINDOODB_APP_BUNDLE_MANIFEST_FILE_NAME,
@@ -14,6 +33,12 @@ import {
14
33
  } from "./chunk-LT4FK6LU.js";
15
34
 
16
35
  // src/types.ts
36
+ var MINDOODB_APP_WELL_KNOWN_DRAG_TYPES = [
37
+ "text/plain",
38
+ "text/markdown",
39
+ "application/json",
40
+ "application/x-mindoo-document"
41
+ ];
17
42
  var MINDOODB_APP_SEAL_SIGNING_DOMAIN = "mindoodb-seal/v1";
18
43
 
19
44
  // src/attachmentPreview.ts
@@ -747,15 +772,27 @@ async function queryDocuments(db, filter, sortBy, options) {
747
772
  return db.query({ filter: expression, sortBy }, options);
748
773
  }
749
774
  export {
775
+ DEFAULT_DRAG_LONG_PRESS_MS,
776
+ DEFAULT_DRAG_POINTER_THRESHOLD_PX,
777
+ DEFAULT_HAVEN_HOST_SHORTCUTS,
750
778
  MINDOODB_APP_BUNDLE_ARCHIVE_FILE_NAME,
751
779
  MINDOODB_APP_BUNDLE_MANIFEST_FILE_NAME,
752
780
  MINDOODB_APP_BUNDLE_MANIFEST_FORMAT,
753
781
  MINDOODB_APP_BUNDLE_MANIFEST_VERSION,
754
782
  MINDOODB_APP_HOSTING_QUERY_PARAM,
783
+ MINDOODB_APP_MAX_DRAG_PAYLOAD_BYTES,
784
+ MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES,
785
+ MINDOODB_APP_MAX_DRAG_PREVIEW_EDGE,
786
+ MINDOODB_APP_MAX_DRAG_TYPES,
755
787
  MINDOODB_APP_SEAL_SIGNING_DOMAIN,
788
+ MINDOODB_APP_WELL_KNOWN_DRAG_TYPES,
789
+ MINIMAL_DRAG_PREVIEW_PNG,
790
+ MindooDBAppDragInputError,
756
791
  MindooDBRichTextHandle,
757
792
  MindooDBTextBuffer,
758
793
  abbreviateCanonicalName,
794
+ applyHostedDocumentOverscrollContain,
795
+ bindDragSource,
759
796
  buildMindooDBAppBundleContentHashInput,
760
797
  canPreviewAttachment,
761
798
  createMindooDBAppBridge,
@@ -764,11 +801,19 @@ export {
764
801
  createViewLanguage,
765
802
  expandAbbreviatedName,
766
803
  installHavenStorageShim,
804
+ installHostShortcutCapture,
805
+ isHostShortcutAction,
767
806
  isHostedBundleRuntime,
768
807
  isMindooDBAppBundleHash,
808
+ isMindooDBAppDragType,
809
+ matchHostShortcut,
810
+ normalizeDragAccepts,
811
+ normalizeDragStartInput,
769
812
  normalizeMindooDBAppBundlePath,
770
813
  queryDocuments,
771
814
  readMindooDBAppHostingMode,
772
815
  releaseMindooDBAppBridgeSessions,
816
+ sanitizeHostShortcutBindings,
817
+ snapshotElementToPng,
773
818
  validateMindooDBAppBundleManifest
774
819
  };
@@ -1,4 +1,4 @@
1
- import { ab as MindooDBAppCreateViewNavigatorInput, bN as MindooDBAppViewNavigator, aK as MindooDBAppLaunchContext, ac as MindooDBAppDatabaseInfo, af as MindooDBAppDocumentApi, bP as MindooDBAppViewNavigatorOpenOptions, j as MindooDBAppAttachmentApi, ay as MindooDBAppIdentityApi, bD as MindooDBAppTimestampApi, ad as MindooDBAppDirectoryApi, d as MindooDBAppDocument, au as MindooDBAppFulltextSetup, at as MindooDBAppExtractionSetup, a as MindooDBAppBridge, bs as MindooDBAppSession, F as MindooDBAppBridgeRpcRequest, ax as MindooDBAppHostTheme, bV as MindooDBAppViewport, bH as MindooDBAppUiPreferences, a_ as MindooDBAppQueryResult, bU as MindooDBAppViewUpdateStats, B as MindooDBAppBridgePortMessage } from '../types-DxnCg5IW.js';
1
+ import { an as MindooDBAppCreateViewNavigatorInput, c6 as MindooDBAppViewNavigator, b3 as MindooDBAppLaunchContext, ao as MindooDBAppDatabaseInfo, ar as MindooDBAppDocumentApi, c8 as MindooDBAppViewNavigatorOpenOptions, q as MindooDBAppAttachmentApi, aT as MindooDBAppIdentityApi, bY as MindooDBAppTimestampApi, ap as MindooDBAppDirectoryApi, j as MindooDBAppDocument, aP as MindooDBAppFulltextSetup, aO as MindooDBAppExtractionSetup, e as MindooDBAppBridge, bN as MindooDBAppSession, Q as MindooDBAppBridgeRpcRequest, aS as MindooDBAppHostTheme, ce as MindooDBAppViewport, c0 as MindooDBAppUiPreferences, bj as MindooDBAppQueryResult, cd as MindooDBAppViewUpdateStats, L as MindooDBAppBridgePortMessage, c as MindooDBAppDragStartResult, aI as MindooDBAppDragProfile } from '../types-M3RwHErO.js';
2
2
  import * as mindoodb from 'mindoodb';
3
3
  import 'mindoodb-view-language';
4
4
 
@@ -115,6 +115,8 @@ interface MockMindooDBAppSessionController {
115
115
  emitLocaleChange(locale: string): void;
116
116
  /** Runs the app's `onBeforeClose` listeners, as the host does before a teardown. */
117
117
  emitBeforeClose(): Promise<void>;
118
+ resolveDrag(result: MindooDBAppDragStartResult): void;
119
+ getDragProfile(): MindooDBAppDragProfile | null;
118
120
  }
119
121
 
120
122
  declare function createMockMindooDBAppSession(options?: CreateMockMindooDBAppSessionOptions): MockMindooDBAppSessionController;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  releaseMindooDBAppBridgeSessions
3
- } from "../chunk-6433L6TE.js";
3
+ } from "../chunk-ZO7UE6B2.js";
4
4
 
5
5
  // src/testing/index.ts
6
6
  import * as Automerge from "@automerge/automerge";
@@ -1857,6 +1857,8 @@ function createMockSessionState(options = {}) {
1857
1857
  const databaseViewApis = /* @__PURE__ */ new Map();
1858
1858
  const sessionViews = /* @__PURE__ */ new Map();
1859
1859
  let activeMenuResolve = null;
1860
+ let activeDragResolve = null;
1861
+ let dragProfile = null;
1860
1862
  let databaseInfos = [];
1861
1863
  const openSealedChannels = /* @__PURE__ */ new Map();
1862
1864
  const appStorage = new Map(Object.entries(options.storage ?? {}));
@@ -1871,6 +1873,32 @@ function createMockSessionState(options = {}) {
1871
1873
  );
1872
1874
  }
1873
1875
  };
1876
+ const drag = {
1877
+ async setProfile(profile) {
1878
+ dragProfile = profile;
1879
+ },
1880
+ async start(_input) {
1881
+ if (activeDragResolve) {
1882
+ activeDragResolve({
1883
+ action: "cancelled",
1884
+ reason: "replaced"
1885
+ });
1886
+ }
1887
+ return await new Promise((resolve) => {
1888
+ activeDragResolve = resolve;
1889
+ });
1890
+ },
1891
+ async cancel() {
1892
+ activeDragResolve?.({
1893
+ action: "cancelled",
1894
+ reason: "source_cancelled"
1895
+ });
1896
+ activeDragResolve = null;
1897
+ },
1898
+ bindSource() {
1899
+ return () => void 0;
1900
+ }
1901
+ };
1874
1902
  const menus = {
1875
1903
  async show(_input) {
1876
1904
  if (activeMenuResolve) {
@@ -2023,6 +2051,7 @@ function createMockSessionState(options = {}) {
2023
2051
  return view;
2024
2052
  },
2025
2053
  menus,
2054
+ drag,
2026
2055
  storage: {
2027
2056
  async snapshot(snapshotOptions) {
2028
2057
  const prefixes = snapshotOptions?.prefixes;
@@ -2146,6 +2175,13 @@ function createMockSessionState(options = {}) {
2146
2175
  },
2147
2176
  async emitBeforeClose() {
2148
2177
  await Promise.all([...beforeCloseListeners].map(async (listener) => listener()));
2178
+ },
2179
+ resolveDrag(result) {
2180
+ activeDragResolve?.(result);
2181
+ activeDragResolve = null;
2182
+ },
2183
+ getDragProfile() {
2184
+ return dragProfile;
2149
2185
  }
2150
2186
  };
2151
2187
  }
@@ -2163,7 +2199,9 @@ function createMockMindooDBAppSession(options = {}) {
2163
2199
  emitViewportChange: state.emitViewportChange,
2164
2200
  emitUiPreferencesChange: state.emitUiPreferencesChange,
2165
2201
  emitLocaleChange: state.emitLocaleChange,
2166
- emitBeforeClose: state.emitBeforeClose
2202
+ emitBeforeClose: state.emitBeforeClose,
2203
+ resolveDrag: state.resolveDrag,
2204
+ getDragProfile: state.getDragProfile
2167
2205
  };
2168
2206
  }
2169
2207
  function createMockMindooDBAppBridge(options = {}) {
@@ -779,6 +779,12 @@ interface MindooDBAppBridgeConnectOptions {
779
779
  targetOrigin?: string;
780
780
  /** How long to wait for the host to answer the handshake before rejecting (default 10000 ms). */
781
781
  connectTimeoutMs?: number;
782
+ /**
783
+ * When `false`, the SDK does not listen for Haven's host keyboard shortcuts
784
+ * (workspace / app drawer). Default is on: the same chords Haven handles
785
+ * on its own pages are reported from inside the iframe.
786
+ */
787
+ hostShortcuts?: boolean;
782
788
  }
783
789
  /** Initial postMessage handshake sent from the app to the Haven. */
784
790
  interface MindooDBAppBridgeConnectMessage {
@@ -949,8 +955,31 @@ interface MindooDBAppBridgeBeforeCloseAck {
949
955
  kind: "before-close-ack";
950
956
  closeId: string;
951
957
  }
958
+ /** A Haven-owned keyboard chord the iframe should recognise. */
959
+ type MindooDBAppHostShortcutAction = "open-workspace" | "toggle-app-drawer";
960
+ /** One host shortcut, matched against {@link KeyboardEvent.code} plus modifiers. */
961
+ interface MindooDBAppHostShortcutBinding {
962
+ action: MindooDBAppHostShortcutAction;
963
+ /** Physical key, e.g. `"Space"` or `"Enter"`. */
964
+ code: string;
965
+ shiftKey: boolean;
966
+ /** Meta (macOS) or Control (Windows/Linux); Alt is never part of the chord. */
967
+ metaOrCtrl: boolean;
968
+ }
969
+ /** Host-pushed table of chords. The iframe replaces its local copy. */
970
+ interface MindooDBAppBridgeShortcutsChangedMessage {
971
+ protocol: "mindoodb-app-bridge";
972
+ kind: "shortcuts-changed";
973
+ shortcuts: MindooDBAppHostShortcutBinding[];
974
+ }
975
+ /** App → host: a host shortcut was pressed inside the iframe. */
976
+ interface MindooDBAppBridgeShortcutInvokedMessage {
977
+ protocol: "mindoodb-app-bridge";
978
+ kind: "shortcut-invoked";
979
+ action: MindooDBAppHostShortcutAction;
980
+ }
952
981
  /** Any message that can travel across the dedicated bridge MessagePort. */
953
- type MindooDBAppBridgePortMessage = MindooDBAppBridgeRpcMessage | MindooDBAppBridgeStreamMessage | MindooDBAppBridgeThemeChangedMessage | MindooDBAppBridgeViewportChangedMessage | MindooDBAppBridgeUiPreferencesChangedMessage | MindooDBAppBridgeLocaleChangedMessage | MindooDBAppBridgeQueryResultMessage | MindooDBAppBridgeViewChangedMessage | MindooDBAppBridgeBeforeCloseMessage | MindooDBAppBridgeBeforeCloseAck;
982
+ type MindooDBAppBridgePortMessage = MindooDBAppBridgeRpcMessage | MindooDBAppBridgeStreamMessage | MindooDBAppBridgeThemeChangedMessage | MindooDBAppBridgeViewportChangedMessage | MindooDBAppBridgeUiPreferencesChangedMessage | MindooDBAppBridgeLocaleChangedMessage | MindooDBAppBridgeQueryResultMessage | MindooDBAppBridgeViewChangedMessage | MindooDBAppBridgeBeforeCloseMessage | MindooDBAppBridgeBeforeCloseAck | MindooDBAppBridgeShortcutsChangedMessage | MindooDBAppBridgeShortcutInvokedMessage | MindooDBAppBridgeDragOverMessage | MindooDBAppBridgeDragLeaveMessage | MindooDBAppBridgeDragDropMessage;
954
983
  /** Placement hint for a host-rendered overlay menu. */
955
984
  type MindooDBAppMenuPlacement = "auto" | "bottom-start" | "bottom-end" | "top-start" | "top-end" | "right-start" | "left-start";
956
985
  /** Semantic hint allowing Haven to tune menu behavior or styling. */
@@ -1024,6 +1053,125 @@ type MindooDBAppShowMenuResult = MindooDBAppMenuSelectionResult | MindooDBAppMen
1024
1053
  * data-only (no HTML/CSS/script crosses the bridge). Intended for
1025
1054
  * `runtime === "iframe"`; window-mode apps can usually render local menus.
1026
1055
  */
1056
+ /** Well-known copy payloads for host-owned cross-iframe drag. */
1057
+ declare const MINDOODB_APP_WELL_KNOWN_DRAG_TYPES: readonly ["text/plain", "text/markdown", "application/json", "application/x-mindoo-document"];
1058
+ /** One of the documented interchange types apps should prefer. */
1059
+ type MindooDBAppWellKnownDragType = (typeof MINDOODB_APP_WELL_KNOWN_DRAG_TYPES)[number];
1060
+ /** Copy is the only effect in v1. `forbidden` is a hover result, not an offer. */
1061
+ type MindooDBAppDragEffect = "copy" | "forbidden";
1062
+ /** One typed string snapshot offered at `drag.start`. */
1063
+ interface MindooDBAppDragOffer {
1064
+ type: string;
1065
+ data: string;
1066
+ }
1067
+ /** PNG ghost sent to Haven. Haven never receives HTML. */
1068
+ interface MindooDBAppDragPreview {
1069
+ png: ArrayBuffer;
1070
+ width: number;
1071
+ height: number;
1072
+ hotspotX: number;
1073
+ hotspotY: number;
1074
+ }
1075
+ /** Iframe-viewport pointer at the moment the host should take over. */
1076
+ interface MindooDBAppDragPointer {
1077
+ x: number;
1078
+ y: number;
1079
+ }
1080
+ /** Input for a host-owned drag gesture. Iframe-only, copy-only. */
1081
+ interface MindooDBAppDragStartInput {
1082
+ offers: MindooDBAppDragOffer[];
1083
+ preview: MindooDBAppDragPreview;
1084
+ pointer: MindooDBAppDragPointer;
1085
+ allowedEffects?: Array<"copy">;
1086
+ }
1087
+ /** Why a host drag ended without a copy. */
1088
+ type MindooDBAppDragCancelReason = "escape" | "pointercancel" | "gap" | "replaced" | "hide" | "source_cancelled";
1089
+ /** Result of `session.drag.start`. */
1090
+ type MindooDBAppDragStartResult = {
1091
+ action: "copied";
1092
+ } | {
1093
+ action: "cancelled";
1094
+ reason: MindooDBAppDragCancelReason;
1095
+ };
1096
+ /** Coordinates and offered types pushed to a potential drop target. */
1097
+ interface MindooDBAppDragOverEvent {
1098
+ x: number;
1099
+ y: number;
1100
+ types: string[];
1101
+ }
1102
+ /** Target answer after hit-testing a `drag-over`. */
1103
+ interface MindooDBAppDragHoverResult {
1104
+ accept: boolean;
1105
+ effect?: MindooDBAppDragEffect;
1106
+ }
1107
+ /** Copy payloads delivered to the target on drop. */
1108
+ interface MindooDBAppDragDropEvent {
1109
+ x: number;
1110
+ y: number;
1111
+ items: Record<string, string>;
1112
+ }
1113
+ /**
1114
+ * What this launch can receive, plus in-app callbacks. `accepts` is sent to
1115
+ * Haven; the callbacks stay in the SDK and run from host push events.
1116
+ */
1117
+ interface MindooDBAppDragProfile {
1118
+ accepts: string[];
1119
+ onOver?: (event: MindooDBAppDragOverEvent) => MindooDBAppDragHoverResult | void;
1120
+ onLeave?: () => void;
1121
+ onDrop?: (event: MindooDBAppDragDropEvent) => void;
1122
+ }
1123
+ /** Options for `session.drag.bindSource`. */
1124
+ interface MindooDBAppDragBindSourceOptions {
1125
+ offers: MindooDBAppDragOffer[] | (() => MindooDBAppDragOffer[]);
1126
+ /** Touch only: hold this long before Haven takes over. Default 400. */
1127
+ longPressMs?: number;
1128
+ /** Mouse/pen move, or the scroll-cancel slop on touch. Default 8. */
1129
+ pointerThresholdPx?: number;
1130
+ /** Element to snapshot; defaults to the bound source element. */
1131
+ preview?: HTMLElement | (() => HTMLElement);
1132
+ }
1133
+ /**
1134
+ * Host-owned drag across iframe chicklets. Haven renders the ghost above
1135
+ * every frame; apps only start the gesture and hit-test drops.
1136
+ */
1137
+ interface MindooDBAppDragApi {
1138
+ /** Tell Haven which types this launch can receive. */
1139
+ setProfile(profile: MindooDBAppDragProfile): Promise<void>;
1140
+ /**
1141
+ * Hand the gesture to Haven. Resolves when the copy completes or the
1142
+ * user cancels. Iframe-only.
1143
+ */
1144
+ start(input: MindooDBAppDragStartInput): Promise<MindooDBAppDragStartResult>;
1145
+ /** Abort a gesture this app started. */
1146
+ cancel(): Promise<void>;
1147
+ /**
1148
+ * Pointer helper: mouse/pen starts after a small move; touch starts after
1149
+ * a long-press. Each element can be bound independently; the returned
1150
+ * function unbinds only that element.
1151
+ */
1152
+ bindSource(element: HTMLElement, options: MindooDBAppDragBindSourceOptions): () => void;
1153
+ }
1154
+ /** Host → target: pointer is over this iframe. */
1155
+ interface MindooDBAppBridgeDragOverMessage {
1156
+ protocol: "mindoodb-app-bridge";
1157
+ kind: "drag-over";
1158
+ x: number;
1159
+ y: number;
1160
+ types: string[];
1161
+ }
1162
+ /** Host → previous target: pointer left this iframe. */
1163
+ interface MindooDBAppBridgeDragLeaveMessage {
1164
+ protocol: "mindoodb-app-bridge";
1165
+ kind: "drag-leave";
1166
+ }
1167
+ /** Host → target: copy payloads for the types this launch accepts. */
1168
+ interface MindooDBAppBridgeDragDropMessage {
1169
+ protocol: "mindoodb-app-bridge";
1170
+ kind: "drag-drop";
1171
+ x: number;
1172
+ y: number;
1173
+ items: Record<string, string>;
1174
+ }
1027
1175
  interface MindooDBAppMenuApi {
1028
1176
  /**
1029
1177
  * Show a host-rendered menu at the given anchor (iframe-relative
@@ -2162,6 +2310,8 @@ interface MindooDBAppSession {
2162
2310
  */
2163
2311
  openViewNavigator(viewId: string, options?: MindooDBAppViewNavigatorOpenOptions): Promise<MindooDBAppViewNavigator>;
2164
2312
  menus: MindooDBAppMenuApi;
2313
+ /** Host-owned cross-iframe drag. Iframe-only; copy-only in v1. */
2314
+ drag: MindooDBAppDragApi;
2165
2315
  /**
2166
2316
  * Host-backed key/value storage for this app registration. Usable in both hosting
2167
2317
  * modes; required in `"hosted"` mode, where `localStorage` throws.
@@ -2219,4 +2369,4 @@ interface MindooDBAppBridge {
2219
2369
  connect(options?: MindooDBAppBridgeConnectOptions): Promise<MindooDBAppSession>;
2220
2370
  }
2221
2371
 
2222
- export { type MindooDBAppConfiguredViewFilterMode as $, type MindooDBAppBridgeLocaleChangedMessage as A, type MindooDBAppBridgePortMessage as B, type MindooDBAppBridgeQueryResultMessage as C, type MindooDBAppBridgeRpcError as D, type MindooDBAppBridgeRpcMessage as E, type MindooDBAppBridgeRpcRequest as F, type MindooDBAppBridgeRpcSuccess as G, type MindooDBAppBridgeStreamAbortRequest as H, type MindooDBAppBridgeStreamAck as I, type MindooDBAppBridgeStreamCloseRequest as J, type MindooDBAppBridgeStreamError as K, type MindooDBAppBridgeStreamMessage as L, type MindooDBAppAttachmentPreviewMode as M, type MindooDBAppBridgeStreamOpenResult as N, type MindooDBAppBridgeStreamReadRequest as O, type MindooDBAppBridgeStreamWriteRequest as P, type MindooDBAppBridgeThemeChangedMessage as Q, type MindooDBAppBridgeUiPreferencesChangedMessage as R, type MindooDBAppBridgeViewChangedMessage as S, type MindooDBAppBridgeViewportChangedMessage as T, type MindooDBAppCapability as U, type MindooDBAppConfiguredViewCategorizationStyle as V, type MindooDBAppConfiguredViewColumn as W, type MindooDBAppConfiguredViewColumnRole as X, type MindooDBAppConfiguredViewExpressionMode as Y, type MindooDBAppConfiguredViewFieldExpression as Z, type MindooDBAppConfiguredViewFilterDefinition as _, type MindooDBAppBridge as a, type MindooDBAppQueryRow as a$, type MindooDBAppConfiguredViewFilterRule as a0, type MindooDBAppConfiguredViewFormulaExpression as a1, type MindooDBAppConfiguredViewFormulaFilterDefinition as a2, type MindooDBAppConfiguredViewPreviewMode as a3, type MindooDBAppConfiguredViewRuleFilterDefinition as a4, type MindooDBAppConfiguredViewRuleMatchMode as a5, type MindooDBAppConfiguredViewRuleOperator as a6, type MindooDBAppConfiguredViewValueExpression as a7, type MindooDBAppCreateDocumentInput as a8, type MindooDBAppCreateKeyInfo as a9, type MindooDBAppInaccessibleDocumentListQuery as aA, type MindooDBAppInaccessibleDocumentListResult as aB, type MindooDBAppJsonListDeletePatch as aC, type MindooDBAppJsonListInsertPatch as aD, type MindooDBAppJsonPatch as aE, type MindooDBAppJsonSetPatch as aF, type MindooDBAppJsonTextMarkPatch as aG, type MindooDBAppJsonTextSplicePatch as aH, type MindooDBAppJsonTextUnmarkPatch as aI, type MindooDBAppJsonUnsetPatch as aJ, type MindooDBAppLaunchContext as aK, type MindooDBAppLiveQuerySubscription as aL, type MindooDBAppMenuAnchor as aM, type MindooDBAppMenuApi as aN, type MindooDBAppMenuCommandItem as aO, type MindooDBAppMenuDismissReason as aP, type MindooDBAppMenuDismissedResult as aQ, type MindooDBAppMenuItem as aR, type MindooDBAppMenuKind as aS, type MindooDBAppMenuPlacement as aT, type MindooDBAppMenuPointAnchor as aU, type MindooDBAppMenuRect as aV, type MindooDBAppMenuRectAnchor as aW, type MindooDBAppMenuSelectionResult as aX, type MindooDBAppMenuSeparatorItem as aY, type MindooDBAppQueryCoverage as aZ, type MindooDBAppQueryResult as a_, type MindooDBAppCreateViewInput as aa, type MindooDBAppCreateViewNavigatorInput as ab, type MindooDBAppDatabaseInfo as ac, type MindooDBAppDirectoryApi as ad, type MindooDBAppDirectoryEntry as ae, type MindooDBAppDocumentApi as af, type MindooDBAppDocumentHeadCursorResult as ag, type MindooDBAppDocumentHistoryEntry as ah, type MindooDBAppDocumentListQuery as ai, type MindooDBAppDocumentListResult as aj, type MindooDBAppDocumentQuery as ak, type MindooDBAppDocumentRevisionId as al, type MindooDBAppDocumentScanPreset as am, type MindooDBAppDocumentSummary as an, type MindooDBAppEntryAttachmentRef as ao, type MindooDBAppEntryProvenance as ap, type MindooDBAppExtractDocumentTextInput as aq, type MindooDBAppExtractDocumentTextResult as ar, type MindooDBAppExtractTextFormat as as, type MindooDBAppExtractionSetup as at, type MindooDBAppFulltextSetup as au, type MindooDBAppHistoricalDocument as av, type MindooDBAppHistoryQuery as aw, type MindooDBAppHostTheme as ax, type MindooDBAppIdentityApi as ay, type MindooDBAppInaccessibleDocument as az, type MindooDBAppHostingMode as b, type MindooDBAppQuerySortKey as b0, type MindooDBAppQueryTextClause as b1, type MindooDBAppReadableAttachmentStream as b2, type MindooDBAppRecipientOptions as b3, type MindooDBAppResolvedViewDefinition as b4, type MindooDBAppResolvedViewSource as b5, type MindooDBAppRevisionPhase as b6, type MindooDBAppRevisionVerification as b7, type MindooDBAppRichTextBlockSpan as b8, type MindooDBAppRichTextGetOptions as b9, type MindooDBAppTextEdit as bA, type MindooDBAppTextPatch as bB, type MindooDBAppThemeMode as bC, type MindooDBAppTimestampApi as bD, type MindooDBAppTimestampInput as bE, type MindooDBAppTimestampProvider as bF, type MindooDBAppTimestampResult as bG, type MindooDBAppUiPreferences as bH, type MindooDBAppUpdateDocumentInput as bI, type MindooDBAppViewCursorDocumentListResult as bJ, type MindooDBAppViewCursorResult as bK, type MindooDBAppViewEntry as bL, type MindooDBAppViewEntryKind as bM, type MindooDBAppViewNavigator as bN, type MindooDBAppViewNavigatorExpansionState as bO, type MindooDBAppViewNavigatorOpenOptions as bP, type MindooDBAppViewNavigatorPageOptions as bQ, type MindooDBAppViewNavigatorPageResult as bR, type MindooDBAppViewNavigatorRangeQuery as bS, type MindooDBAppViewNavigatorSelectionState as bT, type MindooDBAppViewUpdateStats as bU, type MindooDBAppViewport as bV, type MindooDBAppWritableAttachmentStream as bW, type MindooDBAppRichTextImmutableString as ba, type MindooDBAppRichTextMarkRange as bb, type MindooDBAppRichTextMaterializeValue as bc, type MindooDBAppRichTextPatch as bd, type MindooDBAppRichTextScalar as be, type MindooDBAppRichTextSpliceStep as bf, type MindooDBAppRichTextStep as bg, type MindooDBAppRichTextStepPatch as bh, type MindooDBAppRichTextTextSpan as bi, type MindooDBAppRuntime as bj, type MindooDBAppScanAttachmentOptions as bk, type MindooDBAppScanAttachmentResult as bl, type MindooDBAppScopedDocId as bm, type MindooDBAppScopedDocumentSummary as bn, type MindooDBAppSealIntent as bo, type MindooDBAppSealedChannelOpenInput as bp, type MindooDBAppSealedChannelOpenResult as bq, type MindooDBAppSealedChannelRequestInput as br, type MindooDBAppSession as bs, type MindooDBAppShowMenuInput as bt, type MindooDBAppShowMenuResult as bu, type MindooDBAppSignPreview as bv, type MindooDBAppSignPreviewScope as bw, type MindooDBAppSignStatementInput as bx, type MindooDBAppSignStatementResult as by, type MindooDBAppStorageApi as bz, type MindooDBAppDatabase as c, type MindooDBAppDocument as d, type MindooDBAppRichTextSpan as e, type MindooDBAppRichTextSnapshot as f, MINDOODB_APP_SEAL_SIGNING_DOMAIN as g, type MindooDBAppAccessDecision as h, type MindooDBAppAccessTier as i, type MindooDBAppAttachmentApi as j, type MindooDBAppAttachmentChunk as k, type MindooDBAppAttachmentInfo as l, type MindooDBAppAttachmentPreviewOptions as m, type MindooDBAppAttachmentPreviewSession as n, type MindooDBAppAutomergeChangesPatch as o, type MindooDBAppAutomergeChangesSince as p, type MindooDBAppAutomergeGetOptions as q, type MindooDBAppAutomergePatchResult as r, type MindooDBAppAutomergeSnapshot as s, type MindooDBAppBridgeBeforeCloseAck as t, type MindooDBAppBridgeBeforeCloseMessage as u, type MindooDBAppBridgeConnectMessage as v, type MindooDBAppBridgeConnectOptions as w, type MindooDBAppBridgeConnectedMessage as x, type MindooDBAppBridgeErrorPayload as y, type MindooDBAppBridgeHandshakeErrorMessage as z };
2372
+ export { type MindooDBAppBridgeStreamWriteRequest as $, type MindooDBAppBridgeBeforeCloseAck as A, type MindooDBAppBridgeBeforeCloseMessage as B, type MindooDBAppBridgeConnectMessage as C, type MindooDBAppBridgeConnectOptions as D, type MindooDBAppBridgeConnectedMessage as E, type MindooDBAppBridgeDragDropMessage as F, type MindooDBAppBridgeDragLeaveMessage as G, type MindooDBAppBridgeDragOverMessage as H, type MindooDBAppBridgeErrorPayload as I, type MindooDBAppBridgeHandshakeErrorMessage as J, type MindooDBAppBridgeLocaleChangedMessage as K, type MindooDBAppBridgePortMessage as L, type MindooDBAppAttachmentPreviewMode as M, type MindooDBAppBridgeQueryResultMessage as N, type MindooDBAppBridgeRpcError as O, type MindooDBAppBridgeRpcMessage as P, type MindooDBAppBridgeRpcRequest as Q, type MindooDBAppBridgeRpcSuccess as R, type MindooDBAppBridgeShortcutInvokedMessage as S, type MindooDBAppBridgeShortcutsChangedMessage as T, type MindooDBAppBridgeStreamAbortRequest as U, type MindooDBAppBridgeStreamAck as V, type MindooDBAppBridgeStreamCloseRequest as W, type MindooDBAppBridgeStreamError as X, type MindooDBAppBridgeStreamMessage as Y, type MindooDBAppBridgeStreamOpenResult as Z, type MindooDBAppBridgeStreamReadRequest as _, type MindooDBAppDragBindSourceOptions as a, type MindooDBAppJsonTextMarkPatch as a$, type MindooDBAppBridgeThemeChangedMessage as a0, type MindooDBAppBridgeUiPreferencesChangedMessage as a1, type MindooDBAppBridgeViewChangedMessage as a2, type MindooDBAppBridgeViewportChangedMessage as a3, type MindooDBAppCapability as a4, type MindooDBAppConfiguredViewCategorizationStyle as a5, type MindooDBAppConfiguredViewColumn as a6, type MindooDBAppConfiguredViewColumnRole as a7, type MindooDBAppConfiguredViewExpressionMode as a8, type MindooDBAppConfiguredViewFieldExpression as a9, type MindooDBAppDragApi as aA, type MindooDBAppDragCancelReason as aB, type MindooDBAppDragDropEvent as aC, type MindooDBAppDragEffect as aD, type MindooDBAppDragHoverResult as aE, type MindooDBAppDragOffer as aF, type MindooDBAppDragOverEvent as aG, type MindooDBAppDragPointer as aH, type MindooDBAppDragProfile as aI, type MindooDBAppEntryAttachmentRef as aJ, type MindooDBAppEntryProvenance as aK, type MindooDBAppExtractDocumentTextInput as aL, type MindooDBAppExtractDocumentTextResult as aM, type MindooDBAppExtractTextFormat as aN, type MindooDBAppExtractionSetup as aO, type MindooDBAppFulltextSetup as aP, type MindooDBAppHistoricalDocument as aQ, type MindooDBAppHistoryQuery as aR, type MindooDBAppHostTheme as aS, type MindooDBAppIdentityApi as aT, type MindooDBAppInaccessibleDocument as aU, type MindooDBAppInaccessibleDocumentListQuery as aV, type MindooDBAppInaccessibleDocumentListResult as aW, type MindooDBAppJsonListDeletePatch as aX, type MindooDBAppJsonListInsertPatch as aY, type MindooDBAppJsonPatch as aZ, type MindooDBAppJsonSetPatch as a_, type MindooDBAppConfiguredViewFilterDefinition as aa, type MindooDBAppConfiguredViewFilterMode as ab, type MindooDBAppConfiguredViewFilterRule as ac, type MindooDBAppConfiguredViewFormulaExpression as ad, type MindooDBAppConfiguredViewFormulaFilterDefinition as ae, type MindooDBAppConfiguredViewPreviewMode as af, type MindooDBAppConfiguredViewRuleFilterDefinition as ag, type MindooDBAppConfiguredViewRuleMatchMode as ah, type MindooDBAppConfiguredViewRuleOperator as ai, type MindooDBAppConfiguredViewValueExpression as aj, type MindooDBAppCreateDocumentInput as ak, type MindooDBAppCreateKeyInfo as al, type MindooDBAppCreateViewInput as am, type MindooDBAppCreateViewNavigatorInput as an, type MindooDBAppDatabaseInfo as ao, type MindooDBAppDirectoryApi as ap, type MindooDBAppDirectoryEntry as aq, type MindooDBAppDocumentApi as ar, type MindooDBAppDocumentHeadCursorResult as as, type MindooDBAppDocumentHistoryEntry as at, type MindooDBAppDocumentListQuery as au, type MindooDBAppDocumentListResult as av, type MindooDBAppDocumentQuery as aw, type MindooDBAppDocumentRevisionId as ax, type MindooDBAppDocumentScanPreset as ay, type MindooDBAppDocumentSummary as az, type MindooDBAppDragStartInput as b, type MindooDBAppTimestampResult as b$, type MindooDBAppJsonTextSplicePatch as b0, type MindooDBAppJsonTextUnmarkPatch as b1, type MindooDBAppJsonUnsetPatch as b2, type MindooDBAppLaunchContext as b3, type MindooDBAppLiveQuerySubscription as b4, type MindooDBAppMenuAnchor as b5, type MindooDBAppMenuApi as b6, type MindooDBAppMenuCommandItem as b7, type MindooDBAppMenuDismissReason as b8, type MindooDBAppMenuDismissedResult as b9, type MindooDBAppRichTextSpliceStep as bA, type MindooDBAppRichTextStep as bB, type MindooDBAppRichTextStepPatch as bC, type MindooDBAppRichTextTextSpan as bD, type MindooDBAppRuntime as bE, type MindooDBAppScanAttachmentOptions as bF, type MindooDBAppScanAttachmentResult as bG, type MindooDBAppScopedDocId as bH, type MindooDBAppScopedDocumentSummary as bI, type MindooDBAppSealIntent as bJ, type MindooDBAppSealedChannelOpenInput as bK, type MindooDBAppSealedChannelOpenResult as bL, type MindooDBAppSealedChannelRequestInput as bM, type MindooDBAppSession as bN, type MindooDBAppShowMenuInput as bO, type MindooDBAppShowMenuResult as bP, type MindooDBAppSignPreview as bQ, type MindooDBAppSignPreviewScope as bR, type MindooDBAppSignStatementInput as bS, type MindooDBAppSignStatementResult as bT, type MindooDBAppStorageApi as bU, type MindooDBAppTextEdit as bV, type MindooDBAppTextPatch as bW, type MindooDBAppThemeMode as bX, type MindooDBAppTimestampApi as bY, type MindooDBAppTimestampInput as bZ, type MindooDBAppTimestampProvider as b_, type MindooDBAppMenuItem as ba, type MindooDBAppMenuKind as bb, type MindooDBAppMenuPlacement as bc, type MindooDBAppMenuPointAnchor as bd, type MindooDBAppMenuRect as be, type MindooDBAppMenuRectAnchor as bf, type MindooDBAppMenuSelectionResult as bg, type MindooDBAppMenuSeparatorItem as bh, type MindooDBAppQueryCoverage as bi, type MindooDBAppQueryResult as bj, type MindooDBAppQueryRow as bk, type MindooDBAppQuerySortKey as bl, type MindooDBAppQueryTextClause as bm, type MindooDBAppReadableAttachmentStream as bn, type MindooDBAppRecipientOptions as bo, type MindooDBAppResolvedViewDefinition as bp, type MindooDBAppResolvedViewSource as bq, type MindooDBAppRevisionPhase as br, type MindooDBAppRevisionVerification as bs, type MindooDBAppRichTextBlockSpan as bt, type MindooDBAppRichTextGetOptions as bu, type MindooDBAppRichTextImmutableString as bv, type MindooDBAppRichTextMarkRange as bw, type MindooDBAppRichTextMaterializeValue as bx, type MindooDBAppRichTextPatch as by, type MindooDBAppRichTextScalar as bz, type MindooDBAppDragStartResult as c, type MindooDBAppUiPreferences as c0, type MindooDBAppUpdateDocumentInput as c1, type MindooDBAppViewCursorDocumentListResult as c2, type MindooDBAppViewCursorResult as c3, type MindooDBAppViewEntry as c4, type MindooDBAppViewEntryKind as c5, type MindooDBAppViewNavigator as c6, type MindooDBAppViewNavigatorExpansionState as c7, type MindooDBAppViewNavigatorOpenOptions as c8, type MindooDBAppViewNavigatorPageOptions as c9, type MindooDBAppViewNavigatorPageResult as ca, type MindooDBAppViewNavigatorRangeQuery as cb, type MindooDBAppViewNavigatorSelectionState as cc, type MindooDBAppViewUpdateStats as cd, type MindooDBAppViewport as ce, type MindooDBAppWellKnownDragType as cf, type MindooDBAppWritableAttachmentStream as cg, type MindooDBAppDragPreview as d, type MindooDBAppBridge as e, type MindooDBAppHostShortcutBinding as f, type MindooDBAppHostShortcutAction as g, type MindooDBAppHostingMode as h, type MindooDBAppDatabase as i, type MindooDBAppDocument as j, type MindooDBAppRichTextSpan as k, type MindooDBAppRichTextSnapshot as l, MINDOODB_APP_SEAL_SIGNING_DOMAIN as m, MINDOODB_APP_WELL_KNOWN_DRAG_TYPES as n, type MindooDBAppAccessDecision as o, type MindooDBAppAccessTier as p, type MindooDBAppAttachmentApi as q, type MindooDBAppAttachmentChunk as r, type MindooDBAppAttachmentInfo as s, type MindooDBAppAttachmentPreviewOptions as t, type MindooDBAppAttachmentPreviewSession as u, type MindooDBAppAutomergeChangesPatch as v, type MindooDBAppAutomergeChangesSince as w, type MindooDBAppAutomergeGetOptions as x, type MindooDBAppAutomergePatchResult as y, type MindooDBAppAutomergeSnapshot as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindoodb-app-sdk",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "engines": {
5
5
  "node": ">=22.13.0"
6
6
  },
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@automerge/automerge": "^3.3.2",
48
- "mindoodb": ">=0.0.57"
48
+ "mindoodb": ">=0.0.58"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "@automerge/automerge": {
@@ -57,8 +57,9 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@automerge/automerge": "^3.3.2",
60
- "mindoodb": "^0.0.57",
60
+ "mindoodb": "^0.0.58",
61
61
  "@types/node": "25.5.0",
62
+ "jsdom": "^29.0.1",
62
63
  "tsup": "^8.5.1",
63
64
  "typescript": "^6.0.2",
64
65
  "vitest": "^4.1.2"