@bagelink/vue 1.21.75 → 1.22.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.21.75",
4
+ "version": "1.22.1",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -63,7 +63,7 @@
63
63
  "@types/signature_pad": "^4.0.0",
64
64
  "vue": "^3.5.45",
65
65
  "vue-component-type-helpers": "^2.2.12",
66
- "@bagelink/sdk": "1.21.75"
66
+ "@bagelink/sdk": "1.22.1"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "@bagelink/sdk": "*",
@@ -560,12 +560,20 @@ background: var(--bgl-gray-light);
560
560
  }
561
561
 
562
562
  @media (max-width: 910px) {
563
+ .table-list-wrap {
564
+ -webkit-overflow-scrolling: touch;
565
+ overscroll-behavior: contain;
566
+ }
563
567
  .col {
564
568
  max-width: 60vw !important;
565
569
  }
566
570
  .max-col-width {
567
571
  max-width: 60vw !important;
568
572
  }
573
+ td,
574
+ th {
575
+ padding: 0.9rem 0.75rem;
576
+ }
569
577
  }
570
578
 
571
579
  </style>
@@ -318,7 +318,8 @@ onMounted(() => {
318
318
  @keydown.down.prevent="navigate('down')" @keydown.up.prevent="navigate('up')"
319
319
  >
320
320
  <Icon v-if="icon" :icon="icon" class="selectinput-btn__icon" aria-hidden="true" />
321
- <p v-if="!hideLabel" class="selectinput-btn__label" :class="{ 'ms-05': icon }">
321
+ <!-- hideLabel only hides the outer field label above; the trigger always shows the value. -->
322
+ <p class="selectinput-btn__label" :class="{ 'ms-05': icon }">
322
323
  {{ selectedItemCount > 0 ? selectedLabel : (underlined ? '' : (resolveI18n(placeholder)
323
324
  || 'Select...')) }}
324
325
  </p>
@@ -327,7 +328,7 @@ onMounted(() => {
327
328
  <span v-if="clearable && selectedItemCount > 0" class="selectinput-btn__clear ps-05">
328
329
  <Btn flat thin icon="clear" class="color-gray" @click="selectedItems = []; emitUpdate()" />
329
330
  </span>
330
- <Icon v-if="!disabled" thin transition="scale" class="selectinput-btn__icon" aria-hidden="true" :icon="open ? (underlined ? 'expand_less' : 'unfold_less') : (underlined ? 'expand_more' : 'unfold_more')" />
331
+ <Icon thin transition="scale" class="selectinput-btn__icon" aria-hidden="true" :icon="open ? (underlined ? 'expand_less' : 'unfold_less') : (underlined ? 'expand_more' : 'unfold_more')" />
331
332
  </span>
332
333
  </button>
333
334
  <input
@@ -142,8 +142,25 @@ watch(isOpen, (v) => {
142
142
  })
143
143
 
144
144
  function checkMobile() {
145
- isMobile.value = window.innerWidth <= MOBILE_BREAKPOINT
146
- if (isMobile.value) { isOpen.value = false }
145
+ const nextMobile = window.innerWidth <= MOBILE_BREAKPOINT
146
+ const wasMobile = isMobile.value
147
+ isMobile.value = nextMobile
148
+
149
+ if (nextMobile) {
150
+ // Entering mobile (e.g. Duo portrait): close the overlay drawer.
151
+ // Do NOT persist — desktop open/collapsed preference stays in localStorage.
152
+ isOpen.value = false
153
+ return
154
+ }
155
+
156
+ if (wasMobile) {
157
+ // Leaving mobile → desktop (e.g. Duo landscape): restore the stored
158
+ // desktop preference so an open mobile drawer doesn't leave the push
159
+ // sidebar stuck open.
160
+ if (props.open === undefined) {
161
+ isOpen.value = readStored() ?? props.defaultOpen
162
+ }
163
+ }
147
164
  }
148
165
 
149
166
  // Suppress push transitions during a resize, re-enabling them shortly after it
@@ -349,9 +366,13 @@ provide(AppLayoutKey, {
349
366
  onMounted(() => {
350
367
  checkMobile()
351
368
  window.addEventListener('resize', onResize)
369
+ // iPhone Duo fold/unfold + iOS keyboard often update visualViewport without a
370
+ // matching window resize; keep the mobile/desktop shell in sync.
371
+ window.visualViewport?.addEventListener('resize', onResize)
352
372
  })
353
373
  onUnmounted(() => {
354
374
  window.removeEventListener('resize', onResize)
375
+ window.visualViewport?.removeEventListener('resize', onResize)
355
376
  clearTimeout(resizeAnimTimer)
356
377
  })
357
378
 
@@ -430,13 +451,28 @@ const slotBind = computed(() => ({ isOpen, isMobile, toggleMenu, closeOnMobile }
430
451
 
431
452
  <style scoped>
432
453
 
433
- /* Root is a column: [top band] · [start|center|end row] · [bottom band]. */
454
+ /* Root is a column: [top band] · [start|center|end row] · [bottom band].
455
+ Safe-area uses physical left/right (not a single inline shorthand) — iPhone Duo
456
+ insets are often asymmetric across the fold. `svh` keeps the shell stable while
457
+ the Safari chrome shows/hides; standalone PWAs prefer `vh` (WebKit subtracts
458
+ the top inset from svh/dvh incorrectly there). */
434
459
  .app-layout {
435
460
  display: flex;
436
461
  flex-direction: column;
437
462
  height: 100vh;
438
463
  height: 100svh;
439
464
  overflow: hidden;
465
+ overscroll-behavior: none;
466
+ padding-top: env(safe-area-inset-top, 0px);
467
+ padding-bottom: env(safe-area-inset-bottom, 0px);
468
+ padding-left: env(safe-area-inset-left, 0px);
469
+ padding-right: env(safe-area-inset-right, 0px);
470
+ box-sizing: border-box;
471
+ }
472
+ @media all and (display-mode: standalone) {
473
+ .app-layout {
474
+ height: 100vh;
475
+ }
440
476
  }
441
477
 
442
478
  /* Full-width nav bands — span the entire viewport width, above/below the rails. */
@@ -535,6 +571,8 @@ overflow: hidden;
535
571
  mobile spacing (`m_p-*`). The var stays the single gutter knob. */
536
572
  .page-content {
537
573
  overflow: auto;
574
+ overscroll-behavior: contain;
575
+ -webkit-overflow-scrolling: touch;
538
576
  padding-inline: var(--bgl-content-padding, 1rem);
539
577
  }
540
578
  @media screen and (max-width: 910px) {
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import type { NavLink } from '../../index'
3
3
  import { Btn, Dropdown, Icon } from '../../index'
4
- import { computed, ref, watch } from 'vue'
4
+ import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
5
5
  import { useRoute } from 'vue-router'
6
6
  import { resolveI18n } from '../../i18n'
7
7
  import { useAppLayout, SIDEBAR_COLLAPSED_WIDTH, SIDEBAR_COLLAPSED_WIDTH_CARD } from './appLayoutContext'
@@ -157,6 +157,143 @@ const leafPlacement = computed(() => {
157
157
  || document.body?.classList.contains('rtl'))
158
158
  return rtl ? 'left-start' : 'right-start'
159
159
  })
160
+
161
+ /** Floating overlay scrollbar — native bar is hidden so it never steals layout width. */
162
+ const navEl = ref<HTMLElement | null>(null)
163
+ const canScroll = ref(false)
164
+ const atTop = ref(true)
165
+ const atBottom = ref(true)
166
+ const isScrolling = ref(false)
167
+ const isDragging = ref(false)
168
+ const thumbTop = ref(0)
169
+ const thumbHeight = ref(0)
170
+
171
+ const THUMB_MIN = 24
172
+ let scrollFadeTimer: ReturnType<typeof setTimeout> | undefined
173
+ let resizeObserver: ResizeObserver | undefined
174
+ let mutationObserver: MutationObserver | undefined
175
+
176
+ const thumbStyle = computed(() => ({
177
+ height: `${thumbHeight.value}px`,
178
+ transform: `translateY(${thumbTop.value}px)`,
179
+ }))
180
+
181
+ function updateFloatingScrollbar() {
182
+ const el = navEl.value
183
+ if (!el) return
184
+
185
+ const { scrollTop, scrollHeight, clientHeight } = el
186
+ const overflow = scrollHeight - clientHeight
187
+ canScroll.value = overflow > 1
188
+ atTop.value = scrollTop <= 1
189
+ atBottom.value = !canScroll.value || scrollTop >= overflow - 1
190
+
191
+ if (!canScroll.value) {
192
+ thumbHeight.value = 0
193
+ thumbTop.value = 0
194
+ return
195
+ }
196
+
197
+ const nextHeight = Math.max((clientHeight / scrollHeight) * clientHeight, THUMB_MIN)
198
+ const maxTop = Math.max(clientHeight - nextHeight, 0)
199
+ thumbHeight.value = nextHeight
200
+ thumbTop.value = overflow > 0 ? (scrollTop / overflow) * maxTop : 0
201
+ }
202
+
203
+ function onNavScroll() {
204
+ updateFloatingScrollbar()
205
+ isScrolling.value = true
206
+ clearTimeout(scrollFadeTimer)
207
+ scrollFadeTimer = setTimeout(() => {
208
+ if (!isDragging.value) isScrolling.value = false
209
+ }, 900)
210
+ }
211
+
212
+ function onThumbPointerDown(event: PointerEvent) {
213
+ const el = navEl.value
214
+ if (!el || !canScroll.value) return
215
+
216
+ event.preventDefault()
217
+ event.stopPropagation()
218
+
219
+ const thumb = event.currentTarget as HTMLElement
220
+ thumb.setPointerCapture(event.pointerId)
221
+
222
+ const startY = event.clientY
223
+ const startScroll = el.scrollTop
224
+ const maxScroll = el.scrollHeight - el.clientHeight
225
+ const maxTop = Math.max(el.clientHeight - thumbHeight.value, 0)
226
+
227
+ isDragging.value = true
228
+ isScrolling.value = true
229
+
230
+ const onMove = (ev: PointerEvent) => {
231
+ if (maxTop <= 0 || maxScroll <= 0) return
232
+ const delta = ev.clientY - startY
233
+ el.scrollTop = startScroll + (delta / maxTop) * maxScroll
234
+ }
235
+
236
+ const onUp = (ev: PointerEvent) => {
237
+ thumb.releasePointerCapture(ev.pointerId)
238
+ thumb.removeEventListener('pointermove', onMove)
239
+ thumb.removeEventListener('pointerup', onUp)
240
+ thumb.removeEventListener('pointercancel', onUp)
241
+ isDragging.value = false
242
+ clearTimeout(scrollFadeTimer)
243
+ scrollFadeTimer = setTimeout(() => {
244
+ isScrolling.value = false
245
+ }, 900)
246
+ }
247
+
248
+ thumb.addEventListener('pointermove', onMove)
249
+ thumb.addEventListener('pointerup', onUp)
250
+ thumb.addEventListener('pointercancel', onUp)
251
+ }
252
+
253
+ function onTrackPointerDown(event: PointerEvent) {
254
+ const el = navEl.value
255
+ if (!el || !canScroll.value) return
256
+ if ((event.target as HTMLElement).closest('.sidebar-nav-scrollbar-thumb')) return
257
+
258
+ const track = event.currentTarget as HTMLElement
259
+ const rect = track.getBoundingClientRect()
260
+ const clickY = event.clientY - rect.top
261
+ const maxScroll = el.scrollHeight - el.clientHeight
262
+ const maxTop = Math.max(el.clientHeight - thumbHeight.value, 0)
263
+ const nextTop = Math.min(Math.max(clickY - thumbHeight.value / 2, 0), maxTop)
264
+
265
+ el.scrollTop = maxTop > 0 ? (nextTop / maxTop) * maxScroll : 0
266
+ }
267
+
268
+ onMounted(() => {
269
+ const el = navEl.value
270
+ if (!el || typeof ResizeObserver === 'undefined') {
271
+ updateFloatingScrollbar()
272
+ return
273
+ }
274
+
275
+ resizeObserver = new ResizeObserver(() => updateFloatingScrollbar())
276
+ resizeObserver.observe(el)
277
+
278
+ mutationObserver = new MutationObserver(() => updateFloatingScrollbar())
279
+ mutationObserver.observe(el, { childList: true, subtree: true, characterData: true })
280
+
281
+ updateFloatingScrollbar()
282
+ })
283
+
284
+ onBeforeUnmount(() => {
285
+ clearTimeout(scrollFadeTimer)
286
+ resizeObserver?.disconnect()
287
+ mutationObserver?.disconnect()
288
+ })
289
+
290
+ watch(
291
+ () => [props.navLinks, isOpen.value, isVisuallyOpen.value, isMobile.value] as const,
292
+ async () => {
293
+ await nextTick()
294
+ updateFloatingScrollbar()
295
+ },
296
+ )
160
297
  </script>
161
298
 
162
299
  <template>
@@ -207,36 +344,61 @@ const leafPlacement = computed(() => {
207
344
  </router-link>
208
345
  </div>
209
346
 
210
- <nav
211
- class="sidebar-nav flex column flex-stretch gap-025 overflow-y scrollbar-gutter-both"
347
+ <div
348
+ class="sidebar-nav-wrap"
212
349
  :class="{
213
- 'flex-grow justify-content-center': props.centerlinks,
214
- 'align-items-center': !isMobile && !isOpen,
350
+ 'is-scrolling': isScrolling,
351
+ 'is-dragging': isDragging,
352
+ 'can-scroll': canScroll,
353
+ 'at-top': atTop,
354
+ 'at-bottom': atBottom,
215
355
  }"
216
356
  >
217
- <!-- Hosts that group their own nav replace the loop entirely.
218
- The default keeps every existing caller rendering navLinks. -->
219
- <slot
220
- name="nav"
221
- :is-open="isOpen"
222
- :is-visually-open="isVisuallyOpen"
223
- :is-mobile="isMobile"
224
- :bg-color="props.bgColor"
225
- :text-color="props.textColor"
226
- :active-color="props.activeColor"
357
+ <nav
358
+ ref="navEl"
359
+ class="sidebar-nav flex column flex-stretch gap-025 overflow-y"
360
+ :class="{
361
+ 'justify-content-center': props.centerlinks,
362
+ 'align-items-center': !isMobile && !isOpen,
363
+ }"
364
+ @scroll.passive="onNavScroll"
227
365
  >
228
- <SidebarNavItem
229
- v-for="link in props.navLinks" :key="link.to || link.label"
230
- :link="link"
231
- :open="isVisuallyOpen"
232
- :real-open="isOpen"
366
+ <!-- Hosts that group their own nav replace the loop entirely.
367
+ The default keeps every existing caller rendering navLinks. -->
368
+ <slot
369
+ name="nav"
370
+ :is-open="isOpen"
371
+ :is-visually-open="isVisuallyOpen"
233
372
  :is-mobile="isMobile"
234
373
  :bg-color="props.bgColor"
235
374
  :text-color="props.textColor"
236
375
  :active-color="props.activeColor"
376
+ >
377
+ <SidebarNavItem
378
+ v-for="link in props.navLinks" :key="link.to || link.label"
379
+ :link="link"
380
+ :open="isVisuallyOpen"
381
+ :real-open="isOpen"
382
+ :is-mobile="isMobile"
383
+ :bg-color="props.bgColor"
384
+ :text-color="props.textColor"
385
+ :active-color="props.activeColor"
386
+ />
387
+ </slot>
388
+ </nav>
389
+ <div
390
+ v-show="canScroll"
391
+ class="sidebar-nav-scrollbar"
392
+ aria-hidden="true"
393
+ @pointerdown="onTrackPointerDown"
394
+ >
395
+ <div
396
+ class="sidebar-nav-scrollbar-thumb"
397
+ :style="thumbStyle"
398
+ @pointerdown="onThumbPointerDown"
237
399
  />
238
- </slot>
239
- </nav>
400
+ </div>
401
+ </div>
240
402
  <div class="sidebar-footer flex column flex-stretch gap-025 px-05 mx-auto mt-auto m_border-top m_pt-05">
241
403
  <Dropdown
242
404
  v-for="link in props.footerLinks" :key="link.to || link.label"
@@ -279,7 +441,9 @@ const leafPlacement = computed(() => {
279
441
  outline: 1px solid var(--bgl-border-color);
280
442
  }
281
443
  .app-sidebar{
282
- --bgl-scrollbar-size: .5rem;
444
+ /* Reserved padding so content stays centered; visual thumb is thinner. */
445
+ --bgl-scrollbar-size: 0.375rem;
446
+ --sidebar-scroll-thumb-width: 3px;
283
447
  }
284
448
 
285
449
 
@@ -389,6 +553,15 @@ transition:
389
553
  filter 0.2s ease;
390
554
  }
391
555
 
556
+ .sidebar-nav-wrap {
557
+ position: relative;
558
+ flex: 1 1 auto;
559
+ min-height: 0;
560
+ width: 100%;
561
+ display: flex;
562
+ flex-direction: column;
563
+ }
564
+
392
565
  .sidebar-nav,
393
566
  .sidebar-footer {
394
567
  width: 100%;
@@ -396,8 +569,122 @@ margin-inline: auto;
396
569
  padding-block: 0.25rem;
397
570
  }
398
571
 
399
- .app-sidebar ::-webkit-scrollbar-track {
400
- margin: 0 !important;
572
+ .sidebar-nav {
573
+ flex: 1 1 auto;
574
+ min-height: 0;
575
+ padding-inline: var(--bgl-scrollbar-size);
576
+ /* Native bar must not consume layout width (Safari/classic scrollbars). */
577
+ scrollbar-width: none;
578
+ -ms-overflow-style: none;
579
+ /* Soft edge fades — toggled via wrap scroll-edge classes. */
580
+ --sidebar-nav-fade: 1rem;
581
+ -webkit-mask-image: linear-gradient(#000, #000);
582
+ mask-image: linear-gradient(#000, #000);
583
+ -webkit-mask-size: 100% 100%;
584
+ mask-size: 100% 100%;
585
+ -webkit-mask-repeat: no-repeat;
586
+ mask-repeat: no-repeat;
587
+ }
588
+
589
+ .sidebar-nav::-webkit-scrollbar {
590
+ width: 0;
591
+ height: 0;
592
+ display: none;
593
+ }
594
+
595
+ /* Fade only edges that still have more content beyond them. */
596
+ .sidebar-nav-wrap.can-scroll.at-top:not(.at-bottom) .sidebar-nav {
597
+ -webkit-mask-image: linear-gradient(
598
+ to bottom,
599
+ #000 0,
600
+ #000 calc(100% - var(--sidebar-nav-fade)),
601
+ transparent
602
+ );
603
+ mask-image: linear-gradient(
604
+ to bottom,
605
+ #000 0,
606
+ #000 calc(100% - var(--sidebar-nav-fade)),
607
+ transparent
608
+ );
609
+ }
610
+
611
+ .sidebar-nav-wrap.can-scroll:not(.at-top).at-bottom .sidebar-nav {
612
+ -webkit-mask-image: linear-gradient(
613
+ to bottom,
614
+ transparent,
615
+ #000 var(--sidebar-nav-fade),
616
+ #000 100%
617
+ );
618
+ mask-image: linear-gradient(
619
+ to bottom,
620
+ transparent,
621
+ #000 var(--sidebar-nav-fade),
622
+ #000 100%
623
+ );
624
+ }
625
+
626
+ .sidebar-nav-wrap.can-scroll:not(.at-top):not(.at-bottom) .sidebar-nav {
627
+ -webkit-mask-image: linear-gradient(
628
+ to bottom,
629
+ transparent,
630
+ #000 var(--sidebar-nav-fade),
631
+ #000 calc(100% - var(--sidebar-nav-fade)),
632
+ transparent
633
+ );
634
+ mask-image: linear-gradient(
635
+ to bottom,
636
+ transparent,
637
+ #000 var(--sidebar-nav-fade),
638
+ #000 calc(100% - var(--sidebar-nav-fade)),
639
+ transparent
640
+ );
641
+ }
642
+
643
+ .sidebar-nav-scrollbar {
644
+ position: absolute;
645
+ inset-block: 0.25rem;
646
+ inset-inline-end: 0;
647
+ /* Wider hit area than the visible thumb for easier dragging. */
648
+ width: var(--bgl-scrollbar-size);
649
+ z-index: 2;
650
+ pointer-events: auto;
651
+ }
652
+
653
+ .sidebar-nav-scrollbar-thumb {
654
+ position: absolute;
655
+ inset-inline: 0;
656
+ width: var(--sidebar-scroll-thumb-width);
657
+ margin-inline: auto;
658
+ border-radius: 999px;
659
+ background-color: var(--bgl-scrollbar-thumb);
660
+ opacity: 0;
661
+ /* Smooth size/position when nav content expands/collapses. */
662
+ transition:
663
+ opacity 0.2s ease,
664
+ height 0.3s ease,
665
+ transform 0.3s ease;
666
+ cursor: grab;
667
+ touch-action: none;
668
+ will-change: transform, height;
669
+ }
670
+
671
+ .sidebar-nav-scrollbar-thumb:active {
672
+ cursor: grabbing;
673
+ }
674
+
675
+ /* While scrolling/dragging, keep thumb position snappy (no transform lag). */
676
+ .sidebar-nav-wrap.is-scrolling .sidebar-nav-scrollbar-thumb,
677
+ .sidebar-nav-wrap.is-dragging .sidebar-nav-scrollbar-thumb {
678
+ transition:
679
+ opacity 0.2s ease,
680
+ height 0.3s ease;
681
+ }
682
+
683
+ .sidebar-nav-wrap:hover .sidebar-nav-scrollbar-thumb,
684
+ .sidebar-nav-wrap.is-scrolling .sidebar-nav-scrollbar-thumb,
685
+ .sidebar-nav-wrap.is-dragging .sidebar-nav-scrollbar-thumb,
686
+ .sidebar-nav-wrap:focus-within .sidebar-nav-scrollbar-thumb {
687
+ opacity: 0.85;
401
688
  }
402
689
 
403
690
  @media (min-width: 911px) {
@@ -412,6 +699,13 @@ margin: 0 !important;
412
699
  .app-sidebar {
413
700
  transform: translateX(-100%);
414
701
  transition: transform 0.4s ease;
702
+ /* Fixed drawer escapes AppLayout padding — inset itself. Physical L/R
703
+ (not a single inline shorthand): iPhone Duo safe-areas are asymmetric. */
704
+ padding-top: env(safe-area-inset-top, 0px);
705
+ padding-bottom: env(safe-area-inset-bottom, 0px);
706
+ padding-left: env(safe-area-inset-left, 0px);
707
+ padding-right: env(safe-area-inset-right, 0px);
708
+ box-sizing: border-box;
415
709
  }
416
710
 
417
711
  .sidebar-mobile-open {
@@ -426,9 +720,6 @@ margin: 0 !important;
426
720
  .rtl .sidebar-mobile-closed {
427
721
  transform: translateX(100%);
428
722
  }
429
- .sidebar-nav{
430
- mask: linear-gradient(to top, transparent, var(--bgl-box-bg) 5px);
431
- }
432
723
  }
433
724
 
434
725
  </style>
@@ -74,6 +74,18 @@ watch(() => props.size, (val) => {
74
74
  if (clamped !== panelState.value.size.value) panelState.value.size.value = clamped
75
75
  })
76
76
 
77
+ // Keep drag clamps in sync when the consumer changes min/max (e.g. fit-to-container).
78
+ watch(
79
+ () => [props.min, props.max] as const,
80
+ ([min, max]) => {
81
+ if (!panelState.value) return
82
+ panelState.value.config.min = min
83
+ panelState.value.config.max = max
84
+ const clamped = Math.max(min, Math.min(max, panelState.value.size.value))
85
+ if (clamped !== panelState.value.size.value) panelState.value.size.value = clamped
86
+ },
87
+ )
88
+
77
89
  // Internal → prop (drag end syncs back up via v-model:size)
78
90
  // Skip the initial mount transition (undefined → number) to avoid spurious emits
79
91
  watch(
@@ -14,6 +14,19 @@ export interface BoundedRectDragOptions {
14
14
  threshold?: number
15
15
  /** Client pixels per rectangle unit (defaults to screen-space geometry). */
16
16
  scale?: number
17
+ /**
18
+ * Element (or document) that holds pointer capture. Prefer a stable ancestor
19
+ * of the drag handle — capturing on a tiny handle fails when the pointer
20
+ * races over an iframe before capture sticks.
21
+ */
22
+ target?: Element | Document | null
23
+ cursor?: string
24
+ /**
25
+ * When the pointer session is interrupted, restore the pre-drag rect.
26
+ * Default true. Set false for free-floating UI where keeping the last
27
+ * previewed position feels better than snapping back.
28
+ */
29
+ rollbackOnCancel?: boolean
17
30
  onUpdate: (rect: DragRect) => void
18
31
  onCommit?: (moved: boolean) => void
19
32
  onCancel?: () => void
@@ -49,13 +62,15 @@ export function useBoundedRectDrag() {
49
62
  }
50
63
  const started = session.start(event, {
51
64
  threshold: options.threshold,
65
+ target: options.target,
66
+ cursor: options.cursor,
52
67
  onMove: (_next, { dx, dy }) => applyMove(dx, dy),
53
68
  onEnd: (_next, { dx, dy }) => {
54
69
  try { applyMove(dx, dy); options.onCommit?.(moved) } finally { active.value = false }
55
70
  },
56
71
  onCancel: () => {
57
72
  active.value = false
58
- if (previewed) options.onUpdate({ ...initial })
73
+ if (previewed && options.rollbackOnCancel !== false) options.onUpdate({ ...initial })
59
74
  options.onCancel?.()
60
75
  },
61
76
  })
@@ -79,7 +79,6 @@ export function createPointerSession() {
79
79
  view!.removeEventListener('pointercancel', interrupted)
80
80
  view!.removeEventListener('blur', cancel)
81
81
  view!.removeEventListener('keydown', keydown)
82
- targetEl?.removeEventListener('lostpointercapture', interrupted as EventListener)
83
82
  try {
84
83
  if (targetEl?.hasPointerCapture?.(id)) targetEl.releasePointerCapture(id)
85
84
  } catch { /* Detached targets may already have lost capture. */ }
@@ -101,7 +100,8 @@ export function createPointerSession() {
101
100
  view.addEventListener('pointercancel', interrupted)
102
101
  view.addEventListener('blur', cancel)
103
102
  view.addEventListener('keydown', keydown)
104
- targetEl?.addEventListener('lostpointercapture', interrupted as EventListener)
103
+ // Capture helps over iframes, but losing it must NOT abort — window
104
+ // listeners keep the session alive (fast drags often drop capture).
105
105
  try { targetEl?.setPointerCapture?.(id) } catch { /* Window listeners remain a capture fallback. */ }
106
106
  return true
107
107
  }
@@ -170,12 +170,17 @@ defineExpose({ close })
170
170
 
171
171
  <style scoped>
172
172
 
173
- /* Base dialog styles */
173
+ /* Base dialog styles.
174
+ Height cascade: vh fallback → dvh (tracks iOS chrome / fold) → subtract
175
+ asymmetric safe-area so content clears notch + home indicator on Duo. */
174
176
  dialog {
175
177
  border-radius: var(--bgl-card-radius, 12px);
176
178
  max-width: var(--dialog-width);
177
179
  width: calc(100% - 2rem);
178
180
  max-height: calc(100vh - 2rem);
181
+ max-height: calc(100dvh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
182
+ margin-top: max(1rem, env(safe-area-inset-top, 0px));
183
+ margin-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
179
184
  background: var(--bgl-popup-bg, #fff);
180
185
  color: var(--bgl-popup-text, black);
181
186
  }
@@ -189,10 +194,12 @@ border-radius: var(--bgl-card-radius, 12px);
189
194
 
190
195
  .height-100-2 {
191
196
  height: calc(100vh - 2rem);
197
+ height: calc(100dvh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
192
198
  }
193
199
 
194
200
  .max-height-100-2 {
195
201
  max-height: calc(100vh - 2rem);
202
+ max-height: calc(100dvh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
196
203
  }
197
204
 
198
205
  .dialog-close {
@@ -285,7 +292,17 @@ dialog.dialog-bottom {
285
292
  border-end-start-radius: 0;
286
293
  }
287
294
  @media (max-width: 910px) {
288
- dialog.dialog-bottom { width: 100%; max-width: 100%; margin-inline: 0; }
295
+ dialog.dialog-bottom {
296
+ width: 100%;
297
+ max-width: 100%;
298
+ margin-inline: 0;
299
+ margin-bottom: 0;
300
+ padding-bottom: env(safe-area-inset-bottom, 0px);
301
+ padding-left: env(safe-area-inset-left, 0px);
302
+ padding-right: env(safe-area-inset-right, 0px);
303
+ max-height: calc(100dvh - env(safe-area-inset-top, 0px));
304
+ box-sizing: border-box;
305
+ }
289
306
  }
290
307
 
291
308
  /* Drag-handle grip for bottom sheets. */
@@ -463,12 +480,18 @@ dialog.dialog-right .grid-dialog {
463
480
  dialog.dialog-left .grid-dialog,
464
481
  dialog.dialog-right .grid-dialog {
465
482
  max-height: 100vh;
483
+ max-height: 100dvh;
466
484
  height: unset !important;
467
485
  }
468
486
 
469
487
  dialog.dialog-left,
470
488
  dialog.dialog-right {
471
489
  width: 100%;
490
+ padding-top: env(safe-area-inset-top, 0px);
491
+ padding-bottom: env(safe-area-inset-bottom, 0px);
492
+ padding-left: env(safe-area-inset-left, 0px);
493
+ padding-right: env(safe-area-inset-right, 0px);
494
+ box-sizing: border-box;
472
495
  }
473
496
  }
474
497