@floegence/floe-webapp-core 0.57.1 → 0.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,20 @@
1
- import { createComponent as l, Portal as Je, spread as _e, mergeProps as Se, memo as B, insert as u, effect as f, setAttribute as Ze, addEventListener as b, className as w, template as s, use as Ie, delegateEvents as Ke } from "solid-js/web";
2
- import { createSignal as g, createUniqueId as Qe, onCleanup as C, onMount as et, createEffect as _, untrack as Pe, Show as z, batch as Re } from "solid-js";
1
+ import { createComponent as l, Portal as Ge, spread as _e, mergeProps as Se, memo as B, insert as c, effect as f, setAttribute as Je, addEventListener as b, className as w, template as s, use as Ie, delegateEvents as Qe } from "solid-js/web";
2
+ import { createSignal as g, createUniqueId as Ze, onCleanup as C, onMount as Ke, createEffect as _, untrack as Pe, Show as z, batch as Re } from "solid-js";
3
+ import { useMediaQuery as et } from "../../hooks/useMediaQuery.js";
3
4
  import { cn as D } from "../../utils/cn.js";
4
- import { useLayout as tt } from "../../context/LayoutContext.js";
5
+ import { useOptionalLayout as tt } from "../../context/LayoutContext.js";
5
6
  import { Button as Ae } from "./Button.js";
6
7
  import { Restore as nt, Maximize as it, X as ot } from "../icons/index.js";
7
8
  import { startHotInteraction as rt } from "../../utils/hotInteraction.js";
8
9
  import { startPointerSession as lt } from "./pointerSession.js";
9
- import { resolveFloatingWindowViewport as K, normalizeFloatingWindowRect as at, resolveFloatingWindowRect as st } from "./floatingWindowGeometry.js";
10
+ import { resolveFloatingWindowViewport as Z, normalizeFloatingWindowRect as at, resolveFloatingWindowRect as st } from "./floatingWindowGeometry.js";
10
11
  import { createFloatingPresence as dt } from "./floatingPresence.js";
11
12
  import { LOCAL_INTERACTION_SURFACE_ATTR as Ee } from "./localInteractionSurface.js";
12
- import { readSurfaceSafeArea as ct, resolveFloatingBoundary as ut } from "./surfaceFloatingBoundary.js";
13
+ import { readSurfaceSafeArea as ut, resolveFloatingBoundary as ct } from "./surfaceFloatingBoundary.js";
13
14
  import { SURFACE_PORTAL_LAYER_ATTR as ft, resolveSurfacePortalHost as ht, SURFACE_FLOATING_LAYER_ATTR as wt } from "./dialogSurfaceScope.js";
14
15
  var gt = /* @__PURE__ */ s("<span hidden>"), mt = /* @__PURE__ */ s('<h2 class="text-xs leading-none font-medium truncate select-none">'), vt = /* @__PURE__ */ s('<div data-floe-floating-window-header-actions=true class="flex shrink-0 cursor-default items-center gap-1"><span aria-hidden=true class="mx-2 h-4 w-px shrink-0 bg-border">'), yt = /* @__PURE__ */ s('<div data-floe-floating-window-footer=true class="flex items-center justify-end gap-2 p-3 border-t border-border">'), xt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=n style=touch-action:none>"), bt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=s style=touch-action:none>"), zt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=e style=touch-action:none>"), pt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=w style=touch-action:none>"), $t = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=ne style=touch-action:none>"), _t = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=nw style=touch-action:none>"), St = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=se style=touch-action:none>"), It = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=sw style=touch-action:none>"), Pt = /* @__PURE__ */ s('<div data-floe-geometry-surface=floating-window><div data-floe-dialog-surface-host=true><div data-floe-floating-window-titlebar=true style=touch-action:none><div class="flex-1 min-w-0 px-2"></div><div class="flex h-full shrink-0 items-stretch"></div></div><div data-floe-floating-window-content=true class="flex-1 overflow-auto p-3">');
15
- function Ht(n) {
16
- const Q = () => n.resizable ?? !0, H = () => n.maximizable ?? !0, ee = () => n.draggable ?? !0, te = () => n.minSize ?? {
16
+ function Yt(n) {
17
+ const K = () => n.resizable ?? !0, H = () => n.maximizable ?? !0, ee = () => n.draggable ?? !0, te = () => n.minSize ?? {
17
18
  width: 200,
18
19
  height: 150
19
20
  }, ne = () => n.maxSize ?? {
@@ -21,21 +22,21 @@ function Ht(n) {
21
22
  height: 1 / 0
22
23
  };
23
24
  let N;
24
- const Ce = ct(), [F, ie] = g({}), [Fe, oe] = g(1 / 0), [Y, re] = g(!0), h = () => !!(n.compactBelow && Fe() < n.compactBelow), S = () => ({
25
+ const Ce = ut(), [F, ie] = g({}), [Fe, oe] = g(1 / 0), [Y, re] = g(!0), h = () => !!(n.compactBelow && Fe() < n.compactBelow), S = () => ({
25
26
  top: (F().top ?? 0) + (n.viewportInsets?.top ?? 0),
26
27
  right: (F().right ?? 0) + (n.viewportInsets?.right ?? 0),
27
28
  bottom: (F().bottom ?? 0) + (n.viewportInsets?.bottom ?? 0),
28
29
  left: (F().left ?? 0) + (n.viewportInsets?.left ?? 0)
29
- }), Le = () => n.zIndex ?? 100, ke = Qe(), Me = tt(), L = () => Me.isMobile(), le = 16, ae = () => `floating-window-${ke}-title`, [q, Te] = g(n.defaultPosition ?? {
30
+ }), Le = () => n.zIndex ?? 100, ke = Ze(), L = tt()?.isMobile ?? et("(max-width: 767px)"), le = 16, ae = () => `floating-window-${ke}-title`, [q, Me] = g(n.defaultPosition ?? {
30
31
  x: 0,
31
32
  y: 0
32
- }), [X, We] = g(n.defaultSize ?? {
33
+ }), [X, Oe] = g(n.defaultSize ?? {
33
34
  width: 400,
34
35
  height: 300
35
- }), [d, se] = g(!1), [k, de] = g(!1), [M, ce] = g(!1), [Oe, U] = g(!1), I = dt({
36
+ }), [d, se] = g(!1), [k, de] = g(!1), [M, ue] = g(!1), [Te, U] = g(!1), I = dt({
36
37
  open: () => n.open
37
38
  });
38
- let ue = {
39
+ let ce = {
39
40
  x: 0,
40
41
  y: 0
41
42
  }, fe = {
@@ -51,10 +52,10 @@ function Ht(n) {
51
52
  y: 0,
52
53
  width: 0,
53
54
  height: 0
54
- }, ge = "se", a, c = null, T, m = null, E = {
55
+ }, ge = "se", a, u = null, O, m = null, E = {
55
56
  x: 0,
56
57
  y: 0
57
- }, P = null, W = null, j = !1, p = {
58
+ }, P = null, T = null, j = !1, p = {
58
59
  x: n.defaultPosition?.x ?? 0,
59
60
  y: n.defaultPosition?.y ?? 0,
60
61
  width: n.defaultSize?.width ?? 400,
@@ -66,7 +67,7 @@ function Ht(n) {
66
67
  v = {
67
68
  ...e
68
69
  };
69
- const t = K({
70
+ const t = Z({
70
71
  width: window.innerWidth,
71
72
  height: window.innerHeight
72
73
  }, S());
@@ -74,7 +75,7 @@ function Ht(n) {
74
75
  x: t.width > e.width ? (e.x - t.x) / (t.width - e.width) : $?.x ?? 0.5,
75
76
  y: t.height > e.height ? (e.y - t.y) / (t.height - e.height) : $?.y ?? 0.5
76
77
  };
77
- }, Be = {
78
+ }, We = {
78
79
  n: "ns-resize",
79
80
  s: "ns-resize",
80
81
  e: "ew-resize",
@@ -85,17 +86,17 @@ function Ht(n) {
85
86
  sw: "nesw-resize"
86
87
  }, V = (e, t) => {
87
88
  if (!e) {
88
- W?.(), W = null;
89
+ T?.(), T = null;
89
90
  return;
90
91
  }
91
- W?.(), W = rt({
92
+ T?.(), T = rt({
92
93
  kind: m === "resize" ? "resize" : "drag",
93
94
  cursor: t,
94
95
  lockUserSelect: !0
95
96
  });
96
97
  }, ve = (e) => {
97
98
  p = e, a && (a.style.transform = `translate3d(${e.x}px, ${e.y}px, 0)`, a.style.width = `${e.width}px`, a.style.height = `${e.height}px`);
98
- }, De = () => {
99
+ }, Be = () => {
99
100
  const e = q(), t = X();
100
101
  return {
101
102
  x: e.x,
@@ -104,27 +105,27 @@ function Ht(n) {
104
105
  height: t.height
105
106
  };
106
107
  }, G = (e) => {
107
- p = e, Te((t) => t.x === e.x && t.y === e.y ? t : {
108
+ p = e, Me((t) => t.x === e.x && t.y === e.y ? t : {
108
109
  x: e.x,
109
110
  y: e.y
110
- }), We((t) => t.width === e.width && t.height === e.height ? t : {
111
+ }), Oe((t) => t.width === e.width && t.height === e.height ? t : {
111
112
  width: e.width,
112
113
  height: e.height
113
114
  });
114
- }, He = () => {
115
+ }, De = () => {
115
116
  try {
116
117
  a?.focus({
117
118
  preventScroll: !0
118
119
  });
119
120
  } catch {
120
121
  }
121
- }, Ne = (e) => {
122
+ }, He = (e) => {
122
123
  const t = e instanceof Element ? e : null;
123
124
  return t ? t.closest('button, input, select, textarea, a, [role="button"], [tabindex]:not([tabindex="-1"])') === null : !0;
124
- }, J = (e) => !!a && e instanceof Node && a.contains(e), Ye = (e) => {
125
+ }, J = (e) => !!a && e instanceof Node && a.contains(e), Ne = (e) => {
125
126
  const o = (e instanceof Element ? e : null)?.closest('[role="menu"]')?.closest(`[${wt}="true"]`);
126
127
  return !!(o && a?.contains(o));
127
- }, qe = () => {
128
+ }, Ye = () => {
128
129
  if (!a) return null;
129
130
  const e = a.getBoundingClientRect();
130
131
  return {
@@ -134,10 +135,10 @@ function Ht(n) {
134
135
  height: e.height
135
136
  };
136
137
  }, ye = () => {
137
- n.open && (c === null || m === null || typeof window > "u" || ve(st({
138
+ n.open && (u === null || m === null || typeof window > "u" || ve(st({
138
139
  mode: m,
139
140
  pointer: E,
140
- dragStartPos: ue,
141
+ dragStartPos: ce,
141
142
  dragStartRect: fe,
142
143
  resizeStartPos: he,
143
144
  resizeStartRect: we,
@@ -159,7 +160,7 @@ function Ht(n) {
159
160
  height: window.innerHeight
160
161
  };
161
162
  if (d() || h()) {
162
- G(K(t, S()));
163
+ G(Z(t, S()));
163
164
  return;
164
165
  }
165
166
  let r = at({
@@ -173,7 +174,7 @@ function Ht(n) {
173
174
  center: e?.center ?? !1
174
175
  });
175
176
  if (n.boundary !== void 0 && $ && !e?.center) {
176
- const o = K(t, S());
177
+ const o = Z(t, S());
177
178
  r = {
178
179
  ...r,
179
180
  x: o.x + $.x * Math.max(0, o.width - r.width),
@@ -189,7 +190,7 @@ function Ht(n) {
189
190
  }
190
191
  }, xe = (e) => {
191
192
  P !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(P), P = null), e && ye();
192
- const t = e ? qe() ?? p : null;
193
+ const t = e ? Ye() ?? p : null;
193
194
  Re(() => {
194
195
  if (t) {
195
196
  G(t);
@@ -199,18 +200,18 @@ function Ht(n) {
199
200
  };
200
201
  me(t), m === "drag" && Object.assign(v, r);
201
202
  }
202
- c = null, m = null, de(!1), ce(!1);
203
- }), V(!1, ""), T = void 0;
204
- }, Z = (e = !1) => {
205
- T ? T.stop({
203
+ u = null, m = null, de(!1), ue(!1);
204
+ }), V(!1, ""), O = void 0;
205
+ }, Q = (e = !1) => {
206
+ O ? O.stop({
206
207
  commit: e
207
208
  }) : xe(e);
208
209
  };
209
- C(() => Z(!1)), et(() => {
210
+ C(() => Q(!1)), Ke(() => {
210
211
  let e = 0;
211
212
  const t = () => {
212
213
  if (n.boundary !== void 0) {
213
- const o = ut(ht({
214
+ const o = ct(ht({
214
215
  owner: N
215
216
  }), n.boundary, Ce), A = o ? {
216
217
  top: o.top,
@@ -219,7 +220,7 @@ function Ht(n) {
219
220
  bottom: window.innerHeight - o.bottom
220
221
  } : {};
221
222
  Re(() => {
222
- re(!!(o && o.width > 16 && o.height > 16)), oe(o?.width ?? 0), ie((O) => JSON.stringify(O) === JSON.stringify(A) ? O : A);
223
+ re(!!(o && o.width > 16 && o.height > 16)), oe(o?.width ?? 0), ie((W) => JSON.stringify(W) === JSON.stringify(A) ? W : A);
223
224
  });
224
225
  } else
225
226
  re(!0), oe(window.innerWidth), ie((o) => Object.keys(o).length ? {} : o);
@@ -229,7 +230,7 @@ function Ht(n) {
229
230
  center: !n.defaultPosition
230
231
  });
231
232
  const r = () => {
232
- c === null && R({
233
+ u === null && R({
233
234
  center: !1
234
235
  });
235
236
  };
@@ -248,7 +249,7 @@ function Ht(n) {
248
249
  }
249
250
  requestAnimationFrame(t);
250
251
  }), _(() => {
251
- S(), h(), !(!n.open || !j || c !== null) && Pe(() => R({
252
+ S(), h(), !(!n.open || !j || u !== null) && Pe(() => R({
252
253
  center: !1
253
254
  }));
254
255
  }), _(() => {
@@ -262,12 +263,12 @@ function Ht(n) {
262
263
  const e = (t) => {
263
264
  if (t.key !== "Escape") return;
264
265
  const r = typeof document < "u" ? document.activeElement : null;
265
- !J(t.target) && !J(r) || Ye(t.target) || (t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation(), n.onOpenChange(!1));
266
+ !J(t.target) && !J(r) || Ne(t.target) || (t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation(), n.onOpenChange(!1));
266
267
  };
267
268
  document.addEventListener("keydown", e, !0), C(() => document.removeEventListener("keydown", e, !0));
268
269
  }), _(() => {
269
270
  if (!n.open) {
270
- U(!1), Z(!1);
271
+ U(!1), Q(!1);
271
272
  return;
272
273
  }
273
274
  U(!0);
@@ -285,11 +286,11 @@ function Ht(n) {
285
286
  });
286
287
  }), _(() => {
287
288
  if (!n.open) return;
288
- const e = De();
289
- c === null ? ve(e) : p = e;
289
+ const e = Be();
290
+ u === null ? ve(e) : p = e;
290
291
  });
291
- const Xe = (e) => {
292
- !ee() || d() || h() || c !== null || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"], [data-floe-floating-window-header-actions]') || (e.preventDefault(), c = e.pointerId, m = "drag", de(!0), ue = {
292
+ const qe = (e) => {
293
+ !ee() || d() || h() || u !== null || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"], [data-floe-floating-window-header-actions]') || (e.preventDefault(), u = e.pointerId, m = "drag", de(!0), ce = {
293
294
  x: e.clientX,
294
295
  y: e.clientY
295
296
  }, fe = {
@@ -299,7 +300,7 @@ function Ht(n) {
299
300
  y: e.clientY
300
301
  }, V(!0, "grabbing"), ze(e));
301
302
  }, y = (e) => (t) => {
302
- !Q() || d() || h() || c !== null || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), c = t.pointerId, m = "resize", ce(!0), ge = e, he = {
303
+ !K() || d() || h() || u !== null || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), u = t.pointerId, m = "resize", ue(!0), ge = e, he = {
303
304
  x: t.clientX,
304
305
  y: t.clientY
305
306
  }, we = {
@@ -307,11 +308,11 @@ function Ht(n) {
307
308
  }, E = {
308
309
  x: t.clientX,
309
310
  y: t.clientY
310
- }, V(!0, Be[e]), ze(t));
311
+ }, V(!0, We[e]), ze(t));
311
312
  }, be = () => {
312
313
  P = null, ye();
313
- }, Ue = (e) => {
314
- if (!(c === null || e.pointerId !== c) && m !== null && (E = {
314
+ }, Xe = (e) => {
315
+ if (!(u === null || e.pointerId !== u) && m !== null && (E = {
315
316
  x: e.clientX,
316
317
  y: e.clientY
317
318
  }, P === null)) {
@@ -322,10 +323,10 @@ function Ht(n) {
322
323
  P = requestAnimationFrame(be);
323
324
  }
324
325
  }, ze = (e) => {
325
- T = lt({
326
+ O = lt({
326
327
  pointerEvent: e,
327
328
  captureEl: a,
328
- onMove: Ue,
329
+ onMove: Xe,
329
330
  onEnd: ({
330
331
  commit: t,
331
332
  reason: r,
@@ -338,11 +339,11 @@ function Ht(n) {
338
339
  }
339
340
  });
340
341
  }, pe = () => {
341
- !H() || h() || (c !== null && Z(!0), se(!d()), R());
342
- }, je = (e) => {
342
+ !H() || h() || (u !== null && Q(!0), se(!d()), R());
343
+ }, Ue = (e) => {
343
344
  e.target?.closest("button, [data-floe-floating-window-header-actions]") || pe();
344
- }, Ve = (e) => {
345
- Ne(e.target) && He();
345
+ }, je = (e) => {
346
+ He(e.target) && De();
346
347
  }, x = (e) => D("absolute z-10", {
347
348
  n: "cursor-ns-resize top-0 left-2 right-2 h-1",
348
349
  s: "cursor-ns-resize bottom-0 left-2 right-2 h-1",
@@ -361,9 +362,9 @@ function Ht(n) {
361
362
  return I.mounted();
362
363
  },
363
364
  get children() {
364
- return l(Je, {
365
+ return l(Ge, {
365
366
  get children() {
366
- var e = Pt(), t = e.firstChild, r = t.firstChild, o = r.firstChild, A = o.nextSibling, O = r.nextSibling, $e = a;
367
+ var e = Pt(), t = e.firstChild, r = t.firstChild, o = r.firstChild, A = o.nextSibling, W = r.nextSibling, $e = a;
367
368
  return typeof $e == "function" ? Ie($e, e) : a = e, _e(e, Se({
368
369
  get "data-floating-presence"() {
369
370
  return I.state();
@@ -398,7 +399,7 @@ function Ht(n) {
398
399
  return B(() => !!n.title)() ? ae() : void 0;
399
400
  },
400
401
  tabIndex: -1,
401
- onPointerDown: Ve
402
+ onPointerDown: je
402
403
  }), !1, !0), _e(t, Se({
403
404
  [ft]: "true"
404
405
  }, {
@@ -408,7 +409,7 @@ function Ht(n) {
408
409
  return k() || M() ? "true" : void 0;
409
410
  },
410
411
  get "data-floe-floating-window-state"() {
411
- return Oe() ? "active" : "inactive";
412
+ return Te() ? "active" : "inactive";
412
413
  }
413
414
  }, {
414
415
  [Ee]: "true"
@@ -424,23 +425,23 @@ function Ht(n) {
424
425
  get "data-floating-presence"() {
425
426
  return I.state();
426
427
  }
427
- }), !1, !0), r.$$dblclick = je, r.$$pointerdown = Xe, u(o, l(z, {
428
+ }), !1, !0), r.$$dblclick = Ue, r.$$pointerdown = qe, c(o, l(z, {
428
429
  get when() {
429
430
  return n.title;
430
431
  },
431
432
  get children() {
432
433
  var i = mt();
433
- return u(i, () => n.title), f(() => Ze(i, "id", ae())), i;
434
+ return c(i, () => n.title), f(() => Je(i, "id", ae())), i;
434
435
  }
435
- })), u(r, l(z, {
436
+ })), c(r, l(z, {
436
437
  get when() {
437
438
  return n.headerActions;
438
439
  },
439
440
  get children() {
440
- var i = vt(), Ge = i.firstChild;
441
- return u(i, () => n.headerActions, Ge), i;
441
+ var i = vt(), Ve = i.firstChild;
442
+ return c(i, () => n.headerActions, Ve), i;
442
443
  }
443
- }), A), u(A, l(z, {
444
+ }), A), c(A, l(z, {
444
445
  get when() {
445
446
  return B(() => !!H())() && !h();
446
447
  },
@@ -475,7 +476,7 @@ function Ht(n) {
475
476
  }
476
477
  });
477
478
  }
478
- }), null), u(A, l(Ae, {
479
+ }), null), c(A, l(Ae, {
479
480
  variant: "ghost-destructive",
480
481
  size: "icon",
481
482
  "data-floe-floating-window-control": "close",
@@ -491,17 +492,17 @@ function Ht(n) {
491
492
  class: "w-3.5 h-3.5"
492
493
  });
493
494
  }
494
- }), null), u(O, () => n.children), u(t, l(z, {
495
+ }), null), c(W, () => n.children), c(t, l(z, {
495
496
  get when() {
496
497
  return n.footer;
497
498
  },
498
499
  get children() {
499
500
  var i = yt();
500
- return u(i, () => n.footer), i;
501
+ return c(i, () => n.footer), i;
501
502
  }
502
- }), null), u(t, l(z, {
503
+ }), null), c(t, l(z, {
503
504
  get when() {
504
- return B(() => !!(Q() && !d()))() && !h();
505
+ return B(() => !!(K() && !d()))() && !h();
505
506
  },
506
507
  get children() {
507
508
  return [(() => {
@@ -543,7 +544,7 @@ function Ht(n) {
543
544
  }
544
545
  })];
545
546
  }
546
- Ke(["pointerdown", "dblclick"]);
547
+ Qe(["pointerdown", "dblclick"]);
547
548
  export {
548
- Ht as FloatingWindow
549
+ Yt as FloatingWindow
549
550
  };
@@ -24,5 +24,5 @@ export interface LayoutContextValue {
24
24
  }
25
25
  export declare const LayoutProvider: (props: {
26
26
  children: import("solid-js").JSX.Element;
27
- }) => import("solid-js").JSX.Element, useLayout: () => LayoutContextValue;
27
+ }) => import("solid-js").JSX.Element, useLayout: () => LayoutContextValue, useOptionalLayout: () => LayoutContextValue | undefined;
28
28
  export declare function createLayoutService(): LayoutContextValue;
@@ -4,13 +4,14 @@ import { createSimpleContext as u } from "./createSimpleContext.js";
4
4
  import { useResolvedFloeConfig as v } from "./FloeConfigContext.js";
5
5
  const {
6
6
  Provider: x,
7
- use: C
7
+ use: C,
8
+ useOptional: L
8
9
  } = u({
9
10
  name: "Layout",
10
11
  init: g
11
12
  });
12
13
  function g() {
13
- const n = v(), i = () => n.config.layout, p = () => typeof window > "u" ? !1 : window.matchMedia(i().mobileQuery).matches, s = n.persist.load(i().storageKey, {}), h = {
14
+ const d = v(), i = () => d.config.layout, p = () => typeof window > "u" ? !1 : window.matchMedia(i().mobileQuery).matches, s = d.persist.load(i().storageKey, {}), h = {
14
15
  sidebar: {
15
16
  width: s.sidebar?.width ?? i().sidebar.defaultWidth,
16
17
  activeTab: s.sidebar?.activeTab ?? i().sidebar.defaultActiveTab,
@@ -37,7 +38,7 @@ function g() {
37
38
  height: t.terminal.height
38
39
  }
39
40
  };
40
- n.persist.debouncedSave(i().storageKey, e);
41
+ d.persist.debouncedSave(i().storageKey, e);
41
42
  }), {
42
43
  // Sidebar accessors
43
44
  sidebarWidth: () => t.sidebar.width,
@@ -51,10 +52,10 @@ function g() {
51
52
  a.sidebar.width = m(e);
52
53
  })),
53
54
  setSidebarActiveTab: (e, a) => {
54
- o(r((d) => {
55
- d.sidebar.activeTab = e, a?.openSidebar !== !1 && (d.sidebar.collapsed = !1);
56
- })), a?.visibilityMotion === "instant" && b(r((d) => {
57
- d.motion = "instant", d.revision += 1;
55
+ o(r((n) => {
56
+ n.sidebar.activeTab = e, a?.openSidebar !== !1 && (n.sidebar.collapsed = !1);
57
+ })), a?.visibilityMotion === "instant" && b(r((n) => {
58
+ n.motion = "instant", n.revision += 1;
58
59
  }));
59
60
  },
60
61
  setSidebarCollapsed: (e) => o(r((a) => {
@@ -84,5 +85,6 @@ function g() {
84
85
  export {
85
86
  x as LayoutProvider,
86
87
  g as createLayoutService,
87
- C as useLayout
88
+ C as useLayout,
89
+ L as useOptionalLayout
88
90
  };