@panyam/tsappkit-dock 0.7.10 → 0.7.11

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
@@ -13,11 +13,12 @@ It needs `dockview-core` 4.13 or later, up to 8.x, and no UI framework. It share
13
13
  - **`createDock`** builds the dock from a panel registry, a default layout, and `hostFor`, which returns the element each panel shows. `release` gets the element back when its panel leaves where it was. The returned dock has `show`, `place`, `where`, `toggle`, `toggleDrawer`, `reset`, `panelsMenu` (a Panels button with a toggle per panel and Reset layout) and `api`, the dockview api.
14
14
  - **Placement.** A panel lives in the grid, in a floating group over it, or in the drawer on one of the four edges. `dock.place(id, {kind: "drawer", edge: "bottom"})` moves it, and so does the ⋯ menu on each group and each drawer tab. `PanelDef.defaultPlacement` says where a panel starts, and Reset layout puts it back there. `dock.where(id)` also reports `{kind: "popout"}` for a panel popped out through `dock.api`.
15
15
  - **`moved`.** Called after a panel ends up somewhere new, with its element in place. Its `documentChanged` flag is true on the way into a popout window and back, which is when a canvas needs rebuilding.
16
- - **Drawers.** One per edge, laid over the dock with a scrim. A drawer holding several panels shows tabs. Escape or a click on the scrim closes it, and a drag on its inner edge resizes it. The saved layout keeps each drawer's panels, active tab, size and open state.
16
+ - **Drawers.** One per edge, laid over the dock with a scrim. A drawer holding several panels shows tabs. Escape or a click on the scrim closes it, and a drag on its inner edge resizes it. A drag below its minimum, or a finger flicked toward the edge, closes it. A `size` up to 1 is a share of the dock, `tabs: false` hides the tab strip, and `drawerChanged` reports each open, close and tab change. The saved layout keeps each drawer's panels, active tab, size and open state.
17
+ - **Phone pages.** One panel in the grid and the rest in a bottom drawer make a phone layout, with the app's own buttons calling `dock.show(id)`. This replaces tsappkit's deprecated `MobileBottomDrawer`. The [guide](https://panyam.github.io/goapplib/guide/dock/#phone-pages) has the setup.
17
18
  - **Panels added at runtime.** `resolve(id)` describes a panel the registry doesn't list, such as one per open document. `dock.show(id)` opens it, it can be placed anywhere, and a saved layout brings it back.
18
19
  - **`saveLayout`, `loadLayout`, `panelsToReconcile` and `panelsToPrune`** are the saved-layout logic `createDock` uses, without dockview, for an app that drives dockview itself. A save is `{v: 2, panels, layout, drawers}`: `panels` is the registry when it was saved, which is how a later load tells a new panel from a closed one. A version 1 save, from 0.7.10, loads as grid only.
19
20
  - **`resolveTheme` and `documentTheme`** map `<html data-theme>` and the OS colour scheme to light or dark. The dock follows both by default.
20
- - **`drawerSize`, `clampSize`, `loadDrawerSize` and `saveDrawerSize`** are the drawers' sizing, for an app that builds its own: a size on any edge from a drag on its inner edge, clamped to a minimum and a share of the viewport.
21
+ - **`drawerSize`, `clampSize`, `drawerPixels`, `closesOnRelease`, `loadDrawerSize` and `saveDrawerSize`** are the drawers' sizing and close rule, for an app that builds its own: a size on any edge from a drag on its inner edge, clamped to a minimum and a share of the viewport.
21
22
 
22
23
  A three-panel page whose content is built before the dock:
23
24
 
package/dist/index.d.mts CHANGED
@@ -24,6 +24,24 @@ declare function clampSize(px: number, viewport: number, bounds?: DrawerBounds):
24
24
  * left or right drawer, and `clientY` and the height for a top or bottom one.
25
25
  */
26
26
  declare function drawerSize(edge: DrawerEdge, pointer: number, viewport: number, bounds?: DrawerBounds): number;
27
+ /**
28
+ * Turns a configured or saved size into px against the viewport on the drawer's axis, clamped. A
29
+ * size up to 1 is a share of the viewport, so `0.65` makes a phone sheet that covers 65 percent of
30
+ * the screen whatever its height. A larger size is px.
31
+ */
32
+ declare function drawerPixels(size: number, viewport: number, bounds?: DrawerBounds): number;
33
+ /**
34
+ * How fast, in px per ms toward the anchored edge, a touch drag has to be moving when it's let go
35
+ * to close the drawer wherever it ends.
36
+ */
37
+ declare const DRAWER_FLICK = 0.5;
38
+ /**
39
+ * Whether letting go of a drag on a drawer's inner edge closes the drawer. It closes when the edge
40
+ * ends nearer the anchored edge than half of `min`, or when `speed` (px per ms toward the anchored
41
+ * edge, negative away from it) is over `DRAWER_FLICK`. Pass a speed of 0 for a mouse, so a quick
42
+ * resize on a desktop doesn't close anything.
43
+ */
44
+ declare function closesOnRelease(fromEdge: number, min: number, speed: number): boolean;
27
45
  /** The part of Web Storage drawer sizes need. A null storage means sizes aren't saved. */
28
46
  interface DrawerStorage {
29
47
  getItem(key: string): string | null;
@@ -39,8 +57,18 @@ declare function saveDrawerSize(storage: DrawerStorage | null, key: string, px:
39
57
 
40
58
  /** Per-edge drawer settings for `createDock`. */
41
59
  interface DrawerConfig extends DrawerBounds {
42
- /** The size, in px, when nothing is saved. Default `DRAWER_DEFAULT`. */
60
+ /**
61
+ * The size when nothing is saved. Over 1 it's px. Up to 1 it's a share of the drawer host on
62
+ * the drawer's axis, so `0.65` makes a bottom sheet 65 percent of the dock's height. Default
63
+ * `DRAWER_DEFAULT`.
64
+ */
43
65
  size?: number;
66
+ /**
67
+ * Whether the drawer shows its tab strip. Default true. Turn it off when the app picks the panel
68
+ * with its own buttons, such as a phone page's bottom bar calling `dock.show(id)`. The panels are
69
+ * still tabs underneath, and the drawer still drags from its edge.
70
+ */
71
+ tabs?: boolean;
44
72
  }
45
73
 
46
74
  /**
@@ -217,6 +245,13 @@ interface DockOptions {
217
245
  * starts with. See `MoveInfo.documentChanged` for the one move that breaks a canvas.
218
246
  */
219
247
  moved?: (id: string, el: HTMLElement, to: PanelLocation | null, from: PanelLocation | null, info: MoveInfo) => void;
248
+ /**
249
+ * Called when a drawer opens, closes, or shows a different tab, with whether it's open and its
250
+ * active panel afterwards. A phone page uses it to highlight the button for the panel on show.
251
+ * It covers the reader's taps, drags and Escape as well as `show`, `place`, `toggleDrawer` and
252
+ * Reset layout, and isn't called for the drawers the dock starts with.
253
+ */
254
+ drawerChanged?: (edge: DrawerEdge, open: boolean, active: string | undefined) => void;
220
255
  /** Where the layout is saved, usually `localStorage`. Null or absent: nothing is saved. */
221
256
  storage?: DockStorage | null;
222
257
  /** The storage key. Required with `storage`. */
@@ -296,4 +331,4 @@ interface Dock {
296
331
  */
297
332
  declare function createDock(opts: DockOptions): Dock;
298
333
 
299
- export { DRAWER_DEFAULT, DRAWER_MAX_FRAC, DRAWER_MIN, type Dock, type DockOptions, type DockStorage, type DrawerBounds, type DrawerConfig, type DrawerEdge, type DrawerStorage, type LoadedLayout, type MoveInfo, type PanelDef, type PanelLocation, type PanelPosition, type PanelSpec, type Placement, type SavedDrawer, type SavedDrawers, clampSize, createDock, documentTheme, drawerSize, loadDrawerSize, loadLayout, panelsToPrune, panelsToReconcile, resolveTheme, saveDrawerSize, saveLayout };
334
+ export { DRAWER_DEFAULT, DRAWER_FLICK, DRAWER_MAX_FRAC, DRAWER_MIN, type Dock, type DockOptions, type DockStorage, type DrawerBounds, type DrawerConfig, type DrawerEdge, type DrawerStorage, type LoadedLayout, type MoveInfo, type PanelDef, type PanelLocation, type PanelPosition, type PanelSpec, type Placement, type SavedDrawer, type SavedDrawers, clampSize, closesOnRelease, createDock, documentTheme, drawerPixels, drawerSize, loadDrawerSize, loadLayout, panelsToPrune, panelsToReconcile, resolveTheme, saveDrawerSize, saveLayout };
package/dist/index.d.ts CHANGED
@@ -24,6 +24,24 @@ declare function clampSize(px: number, viewport: number, bounds?: DrawerBounds):
24
24
  * left or right drawer, and `clientY` and the height for a top or bottom one.
25
25
  */
26
26
  declare function drawerSize(edge: DrawerEdge, pointer: number, viewport: number, bounds?: DrawerBounds): number;
27
+ /**
28
+ * Turns a configured or saved size into px against the viewport on the drawer's axis, clamped. A
29
+ * size up to 1 is a share of the viewport, so `0.65` makes a phone sheet that covers 65 percent of
30
+ * the screen whatever its height. A larger size is px.
31
+ */
32
+ declare function drawerPixels(size: number, viewport: number, bounds?: DrawerBounds): number;
33
+ /**
34
+ * How fast, in px per ms toward the anchored edge, a touch drag has to be moving when it's let go
35
+ * to close the drawer wherever it ends.
36
+ */
37
+ declare const DRAWER_FLICK = 0.5;
38
+ /**
39
+ * Whether letting go of a drag on a drawer's inner edge closes the drawer. It closes when the edge
40
+ * ends nearer the anchored edge than half of `min`, or when `speed` (px per ms toward the anchored
41
+ * edge, negative away from it) is over `DRAWER_FLICK`. Pass a speed of 0 for a mouse, so a quick
42
+ * resize on a desktop doesn't close anything.
43
+ */
44
+ declare function closesOnRelease(fromEdge: number, min: number, speed: number): boolean;
27
45
  /** The part of Web Storage drawer sizes need. A null storage means sizes aren't saved. */
28
46
  interface DrawerStorage {
29
47
  getItem(key: string): string | null;
@@ -39,8 +57,18 @@ declare function saveDrawerSize(storage: DrawerStorage | null, key: string, px:
39
57
 
40
58
  /** Per-edge drawer settings for `createDock`. */
41
59
  interface DrawerConfig extends DrawerBounds {
42
- /** The size, in px, when nothing is saved. Default `DRAWER_DEFAULT`. */
60
+ /**
61
+ * The size when nothing is saved. Over 1 it's px. Up to 1 it's a share of the drawer host on
62
+ * the drawer's axis, so `0.65` makes a bottom sheet 65 percent of the dock's height. Default
63
+ * `DRAWER_DEFAULT`.
64
+ */
43
65
  size?: number;
66
+ /**
67
+ * Whether the drawer shows its tab strip. Default true. Turn it off when the app picks the panel
68
+ * with its own buttons, such as a phone page's bottom bar calling `dock.show(id)`. The panels are
69
+ * still tabs underneath, and the drawer still drags from its edge.
70
+ */
71
+ tabs?: boolean;
44
72
  }
45
73
 
46
74
  /**
@@ -217,6 +245,13 @@ interface DockOptions {
217
245
  * starts with. See `MoveInfo.documentChanged` for the one move that breaks a canvas.
218
246
  */
219
247
  moved?: (id: string, el: HTMLElement, to: PanelLocation | null, from: PanelLocation | null, info: MoveInfo) => void;
248
+ /**
249
+ * Called when a drawer opens, closes, or shows a different tab, with whether it's open and its
250
+ * active panel afterwards. A phone page uses it to highlight the button for the panel on show.
251
+ * It covers the reader's taps, drags and Escape as well as `show`, `place`, `toggleDrawer` and
252
+ * Reset layout, and isn't called for the drawers the dock starts with.
253
+ */
254
+ drawerChanged?: (edge: DrawerEdge, open: boolean, active: string | undefined) => void;
220
255
  /** Where the layout is saved, usually `localStorage`. Null or absent: nothing is saved. */
221
256
  storage?: DockStorage | null;
222
257
  /** The storage key. Required with `storage`. */
@@ -296,4 +331,4 @@ interface Dock {
296
331
  */
297
332
  declare function createDock(opts: DockOptions): Dock;
298
333
 
299
- export { DRAWER_DEFAULT, DRAWER_MAX_FRAC, DRAWER_MIN, type Dock, type DockOptions, type DockStorage, type DrawerBounds, type DrawerConfig, type DrawerEdge, type DrawerStorage, type LoadedLayout, type MoveInfo, type PanelDef, type PanelLocation, type PanelPosition, type PanelSpec, type Placement, type SavedDrawer, type SavedDrawers, clampSize, createDock, documentTheme, drawerSize, loadDrawerSize, loadLayout, panelsToPrune, panelsToReconcile, resolveTheme, saveDrawerSize, saveLayout };
334
+ export { DRAWER_DEFAULT, DRAWER_FLICK, DRAWER_MAX_FRAC, DRAWER_MIN, type Dock, type DockOptions, type DockStorage, type DrawerBounds, type DrawerConfig, type DrawerEdge, type DrawerStorage, type LoadedLayout, type MoveInfo, type PanelDef, type PanelLocation, type PanelPosition, type PanelSpec, type Placement, type SavedDrawer, type SavedDrawers, clampSize, closesOnRelease, createDock, documentTheme, drawerPixels, drawerSize, loadDrawerSize, loadLayout, panelsToPrune, panelsToReconcile, resolveTheme, saveDrawerSize, saveLayout };
package/dist/index.js CHANGED
@@ -17,6 +17,13 @@ function drawerSize(edge, pointer, viewport, bounds) {
17
17
  const fromEdge = edge === "left" || edge === "top" ? pointer : viewport - pointer;
18
18
  return clampSize(fromEdge, viewport, bounds);
19
19
  }
20
+ function drawerPixels(size, viewport, bounds) {
21
+ return clampSize(size <= 1 ? size * viewport : size, viewport, bounds);
22
+ }
23
+ var DRAWER_FLICK = 0.5;
24
+ function closesOnRelease(fromEdge, min, speed) {
25
+ return fromEdge < min / 2 || speed > DRAWER_FLICK;
26
+ }
20
27
  function loadDrawerSize(storage, key, fallback = DRAWER_DEFAULT) {
21
28
  let raw = null;
22
29
  try {
@@ -38,6 +45,9 @@ function saveDrawerSize(storage, key, px) {
38
45
  var Z_SCRIM = "calc(var(--dv-overlay-z-index, 999) + 200)";
39
46
  var Z_DRAWER = "calc(var(--dv-overlay-z-index, 999) + 201)";
40
47
  var HORIZONTAL = { left: true, right: true, top: false, bottom: false };
48
+ var TOWARD = { left: -1, right: 1, top: -1, bottom: 1 };
49
+ var DRAG_SLOP = 6;
50
+ var FLICK_WINDOW_MS = 100;
41
51
  var DrawerView = class {
42
52
  constructor(edge, host, config, hooks) {
43
53
  this.edge = edge;
@@ -69,20 +79,25 @@ var DrawerView = class {
69
79
  this.tabStrip = doc.createElement("div");
70
80
  this.tabStrip.className = "dock-drawer-tabs";
71
81
  this.tabStrip.setAttribute("role", "tablist");
72
- Object.assign(this.tabStrip.style, { display: "flex", gap: "2px", alignItems: "center", flex: "none" });
82
+ Object.assign(this.tabStrip.style, { display: config.tabs === false ? "none" : "flex", gap: "2px", alignItems: "center", flex: "none" });
73
83
  this.body = doc.createElement("div");
74
84
  this.body.className = "dock-drawer-body";
75
85
  Object.assign(this.body.style, { flex: "1", minHeight: "0", overflow: "auto", position: "relative" });
76
86
  this.handle = doc.createElement("div");
77
87
  this.handle.className = "dock-drawer-handle";
78
88
  const inner = { left: "right", right: "left", top: "bottom", bottom: "top" }[edge];
89
+ const thick = doc.defaultView?.matchMedia?.("(pointer: coarse)").matches ? 24 : 6;
79
90
  Object.assign(this.handle.style, {
80
91
  position: "absolute",
81
- [inner]: "-3px",
82
- ...HORIZONTAL[edge] ? { top: "0", bottom: "0", width: "6px", cursor: "col-resize" } : { left: "0", right: "0", height: "6px", cursor: "row-resize" },
92
+ [inner]: `-${thick / 2}px`,
93
+ ...HORIZONTAL[edge] ? { top: "0", bottom: "0", width: `${thick}px`, cursor: "col-resize" } : { left: "0", right: "0", height: `${thick}px`, cursor: "row-resize" },
83
94
  touchAction: "none"
84
95
  });
85
- this.handle.addEventListener("pointerdown", (e) => this.drag(e));
96
+ this.handle.addEventListener("pointerdown", (e) => this.drag(e, 0));
97
+ if (edge === "bottom") {
98
+ this.tabStrip.style.touchAction = "none";
99
+ this.tabStrip.addEventListener("pointerdown", (e) => this.drag(e, DRAG_SLOP));
100
+ }
86
101
  this.root.append(this.tabStrip, this.body, this.handle);
87
102
  host.append(this.scrim, this.root);
88
103
  this.applySize();
@@ -96,9 +111,15 @@ var DrawerView = class {
96
111
  get open() {
97
112
  return this.isOpen;
98
113
  }
114
+ /** The size as configured, saved or dragged: px, or a share of the host when it's up to 1. */
99
115
  get size() {
100
116
  return this.px;
101
117
  }
118
+ /** The size in px against the host as it is now, or unclamped while the host has no size. */
119
+ get pixels() {
120
+ const span = this.span();
121
+ return span > 0 ? drawerPixels(this.px, span, this.config) : this.px;
122
+ }
102
123
  /** The element a panel in this drawer shows, or undefined if it isn't here. */
103
124
  elementOf(id) {
104
125
  return this.tabs.find((t) => t.id === id)?.el;
@@ -171,8 +192,8 @@ var DrawerView = class {
171
192
  if (show) this.applySize();
172
193
  if (notify) this.hooks.changed();
173
194
  }
174
- setSize(px, notify = true) {
175
- this.px = Math.round(px);
195
+ setSize(size, notify = true) {
196
+ this.px = size > 1 ? Math.round(size) : size;
176
197
  this.applySize();
177
198
  if (notify) this.hooks.changed();
178
199
  }
@@ -183,31 +204,88 @@ var DrawerView = class {
183
204
  this.scrim.remove();
184
205
  this.root.remove();
185
206
  }
207
+ span() {
208
+ const rect = this.host.getBoundingClientRect();
209
+ return HORIZONTAL[this.edge] ? rect.width : rect.height;
210
+ }
186
211
  // Clamps against the host as it is now, so a drawer saved on a big window still fits a small one.
212
+ // A host with no size yet (not laid out) gets a share as a percentage and px unclamped.
187
213
  applySize() {
188
- const rect = this.host.getBoundingClientRect();
189
- const span = HORIZONTAL[this.edge] ? rect.width : rect.height;
190
- const px = span > 0 ? clampSize(this.px, span, this.config) : this.px;
191
- this.root.style[HORIZONTAL[this.edge] ? "width" : "height"] = `${px}px`;
214
+ const span = this.span();
215
+ const css = span > 0 ? `${drawerPixels(this.px, span, this.config)}px` : this.px <= 1 ? `${this.px * 100}%` : `${this.px}px`;
216
+ this.root.style[HORIZONTAL[this.edge] ? "width" : "height"] = css;
192
217
  }
193
- drag(e) {
194
- e.preventDefault();
218
+ // A drag on the inner edge. It resizes while the edge is above `min`. Below it the drawer slides
219
+ // toward its edge under the pointer, and letting go there, or flicking a finger toward the edge,
220
+ // closes it at the size it had before the drag. `slop` is how far the pointer moves before this
221
+ // counts as a drag, so a tap on a tab in the strip still picks the tab.
222
+ drag(e, slop) {
223
+ if (e.button > 0) return;
224
+ const doc = this.host.ownerDocument;
225
+ const horizontal = HORIZONTAL[this.edge];
226
+ const toward = TOWARD[this.edge];
227
+ const touch = e.pointerType === "touch" || e.pointerType === "pen";
228
+ const min = this.config.min ?? DRAWER_MIN;
229
+ const at = (ev) => horizontal ? ev.clientX : ev.clientY;
230
+ const start = at(e);
231
+ const before = this.px;
232
+ let dragging = false;
233
+ let fromEdge = Number.NaN;
234
+ let last = { pos: start, t: e.timeStamp };
235
+ let speed = 0;
236
+ const begin = () => {
237
+ dragging = true;
238
+ this.root.classList.add("dock-drawer-resizing");
239
+ };
240
+ if (slop === 0) {
241
+ e.preventDefault();
242
+ begin();
243
+ }
195
244
  const move = (ev) => {
245
+ const pos = at(ev);
246
+ if (!dragging) {
247
+ if (Math.abs(pos - start) < slop) return;
248
+ begin();
249
+ }
250
+ ev.preventDefault();
196
251
  const rect = this.host.getBoundingClientRect();
197
- const horizontal = HORIZONTAL[this.edge];
198
- const pointer = horizontal ? ev.clientX - rect.left : ev.clientY - rect.top;
199
252
  const span = horizontal ? rect.width : rect.height;
200
- this.setSize(drawerSize(this.edge, pointer, span, this.config), false);
253
+ const pointer = pos - (horizontal ? rect.left : rect.top);
254
+ fromEdge = toward > 0 ? span - pointer : pointer;
255
+ const dt = ev.timeStamp - last.t;
256
+ if (dt > 0) speed = toward * (pos - last.pos) / dt;
257
+ last = { pos, t: ev.timeStamp };
258
+ const px = drawerPixels(fromEdge, span, this.config);
259
+ this.setSize(px, false);
260
+ const slide = Math.max(0, px - fromEdge);
261
+ this.root.style.transform = slide > 0 ? `translate${horizontal ? "X" : "Y"}(${toward * slide}px)` : "";
201
262
  };
202
- const up = () => {
203
- this.handle.ownerDocument.removeEventListener("pointermove", move);
204
- this.handle.ownerDocument.removeEventListener("pointerup", up);
263
+ const end = (ev) => {
264
+ doc.removeEventListener("pointermove", move);
265
+ doc.removeEventListener("pointerup", end);
266
+ doc.removeEventListener("pointercancel", end);
267
+ if (!dragging) return;
205
268
  this.root.classList.remove("dock-drawer-resizing");
269
+ this.root.style.transform = "";
270
+ if (slop > 0) {
271
+ const swallow = (c) => {
272
+ c.stopPropagation();
273
+ c.preventDefault();
274
+ };
275
+ this.tabStrip.addEventListener("click", swallow, { capture: true, once: true });
276
+ setTimeout(() => this.tabStrip.removeEventListener("click", swallow, { capture: true }), 0);
277
+ }
278
+ const fresh = ev.timeStamp - last.t <= FLICK_WINDOW_MS;
279
+ if (ev.type === "pointerup" && Number.isFinite(fromEdge) && closesOnRelease(fromEdge, min, touch && fresh ? speed : 0)) {
280
+ this.setSize(before, false);
281
+ this.setOpen(false);
282
+ return;
283
+ }
206
284
  this.hooks.changed();
207
285
  };
208
- this.root.classList.add("dock-drawer-resizing");
209
- this.handle.ownerDocument.addEventListener("pointermove", move);
210
- this.handle.ownerDocument.addEventListener("pointerup", up);
286
+ doc.addEventListener("pointermove", move);
287
+ doc.addEventListener("pointerup", end);
288
+ doc.addEventListener("pointercancel", end);
211
289
  }
212
290
  };
213
291
 
@@ -391,7 +469,7 @@ function createDock(opts) {
391
469
  const now = where(id);
392
470
  if (!same(now, target)) {
393
471
  if (now?.kind === "drawer" && target.kind === "grid") {
394
- const size = drawer(now.edge).size;
472
+ const size = drawer(now.edge).pixels;
395
473
  leave(id);
396
474
  addToGrid(id, { direction: TOWARD_EDGE[now.edge] });
397
475
  const horizontal = now.edge === "left" || now.edge === "right";
@@ -485,6 +563,7 @@ function createDock(opts) {
485
563
  };
486
564
  const seen = /* @__PURE__ */ new Map();
487
565
  const key0 = (p) => JSON.stringify(p);
566
+ const drawerSeen = /* @__PURE__ */ new Map();
488
567
  const sync = (notify = true) => {
489
568
  if (disposed || quiet) return;
490
569
  const ids = /* @__PURE__ */ new Set([...panels.map((p) => p.id), ...api.panels.map((p) => p.id), ...[...drawers.values()].flatMap((d) => d.ids), ...seen.keys()]);
@@ -499,6 +578,12 @@ function createDock(opts) {
499
578
  if (key0(at) === key0(prev?.at ?? null) && doc2 === prev?.doc) continue;
500
579
  opts.moved(id, el, at, prev?.at ?? null, { documentChanged: !!prev?.doc && doc2 !== prev.doc });
501
580
  }
581
+ for (const [edge, d] of drawers) {
582
+ const now = `${d.open} ${d.active ?? ""}`;
583
+ const before = drawerSeen.get(edge) ?? "false ";
584
+ drawerSeen.set(edge, now);
585
+ if (notify && now !== before) opts.drawerChanged?.(edge, d.open, d.active);
586
+ }
502
587
  };
503
588
  const changed = () => {
504
589
  save();
@@ -699,11 +784,14 @@ function createDock(opts) {
699
784
  }
700
785
 
701
786
  exports.DRAWER_DEFAULT = DRAWER_DEFAULT;
787
+ exports.DRAWER_FLICK = DRAWER_FLICK;
702
788
  exports.DRAWER_MAX_FRAC = DRAWER_MAX_FRAC;
703
789
  exports.DRAWER_MIN = DRAWER_MIN;
704
790
  exports.clampSize = clampSize;
791
+ exports.closesOnRelease = closesOnRelease;
705
792
  exports.createDock = createDock;
706
793
  exports.documentTheme = documentTheme;
794
+ exports.drawerPixels = drawerPixels;
707
795
  exports.drawerSize = drawerSize;
708
796
  exports.loadDrawerSize = loadDrawerSize;
709
797
  exports.loadLayout = loadLayout;