@bagelink/vue 1.21.71 → 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/dist/{StructuredEditor-B3FBmkDp.js → StructuredEditor-BiBhDIf8.js} +1 -1
- package/dist/{StructuredEditor-DU80v1ME.cjs → StructuredEditor-Cdl9_djZ.cjs} +1 -1
- package/dist/components/dataTable/DataTable.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectBtn.vue.d.ts +6 -0
- package/dist/components/form/inputs/SelectBtn.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/layout/AppLayout.vue.d.ts.map +1 -1
- package/dist/components/layout/AppSidebar.vue.d.ts.map +1 -1
- package/dist/components/layout/Panel.vue.d.ts.map +1 -1
- package/dist/composables/useBoundedRectDrag.d.ts +13 -0
- package/dist/composables/useBoundedRectDrag.d.ts.map +1 -1
- package/dist/core.css +2 -2
- package/dist/dialog/Dialog.vue.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/src-CyUKZxJV.cjs +764 -0
- package/dist/{src-BzdyPQ2G.js → src-lXTK29UB.js} +10053 -9929
- package/dist/src.css +1 -1
- package/dist/style.css +2 -2
- package/package.json +2 -2
- package/src/components/Icon/Icon.vue +1 -1
- package/src/components/dataTable/DataTable.vue +8 -0
- package/src/components/form/inputs/DatePicker.vue +36 -1
- package/src/components/form/inputs/SelectBtn.vue +25 -1
- package/src/components/form/inputs/SelectInput.vue +3 -2
- package/src/components/layout/AppLayout.vue +41 -3
- package/src/components/layout/AppSidebar.vue +319 -28
- package/src/components/layout/Panel.vue +12 -0
- package/src/composables/useBoundedRectDrag.ts +16 -1
- package/src/composables/usePointerSession.ts +2 -2
- package/src/dialog/Dialog.vue +25 -2
- package/src/styles/app-layout.css +4 -0
- package/src/styles/core.css +1 -1
- package/src/styles/toast-overrides.css +8 -2
- package/dist/src-D4naZ4N-.cjs +0 -764
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagelink/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
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.
|
|
66
|
+
"@bagelink/sdk": "1.22.1"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@bagelink/sdk": "*",
|
|
@@ -225,7 +225,7 @@ const iconStyle = computed(() => {
|
|
|
225
225
|
* (`GRAD`) — so pin those to a single value. Dropping two of the four axis
|
|
226
226
|
* RANGES shrinks the served font dramatically (the full ~3.8MB font is the
|
|
227
227
|
* single biggest asset on the page) while keeping weight/fill working. */
|
|
228
|
-
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,100..700,0..1,0&display=
|
|
228
|
+
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,100..700,0..1,0&display=block');
|
|
229
229
|
|
|
230
230
|
[dir='rtl'] .data-row .bgl_icon-font,
|
|
231
231
|
[dir='rtl'] .embedded-field .bgl_icon-font,
|
|
@@ -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>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { MaybeRefOrGetter } from 'vue'
|
|
3
3
|
import type { ModeType } from '../../../utils/calendar/typings'
|
|
4
4
|
import { Btn, NumberInput, local } from '../../../index'
|
|
5
|
-
import { computed, ref, toValue } from 'vue'
|
|
5
|
+
import { computed, nextTick, ref, toValue } from 'vue'
|
|
6
6
|
import Time, { WEEK_START_DAY } from '../../../utils/calendar/time'
|
|
7
7
|
import { parseCalendarDate } from '../../../utils/calendarDate'
|
|
8
8
|
|
|
@@ -381,6 +381,38 @@ function useTimeHandling() {
|
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
+
const hourInputRef = ref<{ $el?: Element } | null>(null)
|
|
385
|
+
const minuteInputRef = ref<{ $el?: Element } | null>(null)
|
|
386
|
+
|
|
387
|
+
function focusTimeInput(target: { $el?: Element } | null) {
|
|
388
|
+
const input = target?.$el?.querySelector('input') as HTMLInputElement | null
|
|
389
|
+
if (!input) return
|
|
390
|
+
input.focus()
|
|
391
|
+
input.select()
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// Typing "09:30" should not require a Tab between the hour and the minute.
|
|
395
|
+
// The colon is the separator people type; two hour digits mean the rest
|
|
396
|
+
// belongs to the minutes. The hour field rejects ":", so without this the
|
|
397
|
+
// keystroke lands on the date field behind the popup and changes the date.
|
|
398
|
+
const hourDigits = ref(0)
|
|
399
|
+
|
|
400
|
+
function onTimeKeydown(event: KeyboardEvent, part: 'hour' | 'minute') {
|
|
401
|
+
const input = event.target as HTMLInputElement
|
|
402
|
+
if (part === 'hour' && /\d/.test(event.key)) {
|
|
403
|
+
hourDigits.value = input.selectionStart === input.value.length ? hourDigits.value + 1 : 1
|
|
404
|
+
if (hourDigits.value >= 2) nextTick(() => focusTimeInput(minuteInputRef.value))
|
|
405
|
+
return
|
|
406
|
+
}
|
|
407
|
+
hourDigits.value = 0
|
|
408
|
+
if (event.key !== ':' && event.key !== 'ArrowRight') return
|
|
409
|
+
const atEnd = input.selectionStart === input.value.length
|
|
410
|
+
if (part === 'hour' && (event.key === ':' || atEnd)) {
|
|
411
|
+
event.preventDefault()
|
|
412
|
+
focusTimeInput(minuteInputRef.value)
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
384
416
|
// Centralized date emission function
|
|
385
417
|
function emitDateValue(date: Date) {
|
|
386
418
|
if (props.enableTime) {
|
|
@@ -538,13 +570,16 @@ function selectDate(date: Date | null) {
|
|
|
538
570
|
>
|
|
539
571
|
<div class="flex gap-025">
|
|
540
572
|
<NumberInput
|
|
573
|
+
ref="hourInputRef"
|
|
541
574
|
center :modelValue="hours" :disabled="!selectedDate" :min="0" :max="23" layout="vertical"
|
|
542
575
|
:padZero="2" @update:modelValue="handleHourInput"
|
|
576
|
+
@keydown="onTimeKeydown($event, 'hour')"
|
|
543
577
|
/>
|
|
544
578
|
<p class="pb-075">
|
|
545
579
|
:
|
|
546
580
|
</p>
|
|
547
581
|
<NumberInput
|
|
582
|
+
ref="minuteInputRef"
|
|
548
583
|
center :modelValue="minutes" :disabled="!selectedDate" :min="0" :max="59" :padZero="2"
|
|
549
584
|
layout="vertical" @update:modelValue="handleMinuteInput"
|
|
550
585
|
/>
|
|
@@ -15,6 +15,8 @@ const props = withDefaults(
|
|
|
15
15
|
required?: boolean
|
|
16
16
|
error?: string
|
|
17
17
|
thin?: boolean
|
|
18
|
+
/** Thin only on mobile screens (≤ 910px), matching Btn. */
|
|
19
|
+
thinMobile?: boolean
|
|
18
20
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
19
21
|
multiselect?: boolean
|
|
20
22
|
disabled?: boolean
|
|
@@ -47,8 +49,10 @@ const props = withDefaults(
|
|
|
47
49
|
iconOnly?: boolean
|
|
48
50
|
/** Background applied to the options area only; the field label stays outside it. */
|
|
49
51
|
bgColor?: string
|
|
52
|
+
/** On mobile (≤ 910px): stretch to full width with equal-width option buttons. */
|
|
53
|
+
fullWidthMobile?: boolean
|
|
50
54
|
} & BagelInputShellProps>(),
|
|
51
|
-
{ multiselect: false, iconOnly: false, inactiveCheckIcon: 'remove' },
|
|
55
|
+
{ multiselect: false, iconOnly: false, inactiveCheckIcon: 'remove', fullWidthMobile: false, thinMobile: false },
|
|
52
56
|
)
|
|
53
57
|
|
|
54
58
|
const { shellClass, shellStyle } = useBagelInputShell(() => ({
|
|
@@ -119,6 +123,8 @@ function isSelected(val: OptionValue) {
|
|
|
119
123
|
'has-custom-font-size': fontSize != null,
|
|
120
124
|
'has-mobile-height': mobileHeight != null,
|
|
121
125
|
'has-mobile-font-size': mobileFontSize != null,
|
|
126
|
+
'is-full-width-mobile': fullWidthMobile,
|
|
127
|
+
'is-thin-mobile': thinMobile,
|
|
122
128
|
}]"
|
|
123
129
|
:style="[shellStyle, optionStyle]"
|
|
124
130
|
>
|
|
@@ -132,6 +138,7 @@ function isSelected(val: OptionValue) {
|
|
|
132
138
|
>
|
|
133
139
|
<Btn
|
|
134
140
|
v-for="option in options" :key="String(getOptionValue(option))" :thin="thin"
|
|
141
|
+
:thin-mobile="thinMobile"
|
|
135
142
|
:size="size"
|
|
136
143
|
:disabled="disabled"
|
|
137
144
|
type="button"
|
|
@@ -259,5 +266,22 @@ function isSelected(val: OptionValue) {
|
|
|
259
266
|
.SelectBtn.has-mobile-font-size .SelectBtn-padding {
|
|
260
267
|
font-size: var(--bgl-select-btn-mobile-font-size);
|
|
261
268
|
}
|
|
269
|
+
|
|
270
|
+
.SelectBtn.is-full-width-mobile .select-btn-items {
|
|
271
|
+
width: 100%;
|
|
272
|
+
flex-wrap: nowrap;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.SelectBtn.is-full-width-mobile .select-btn-items > .bgl_btn {
|
|
276
|
+
flex: 1 1 0;
|
|
277
|
+
min-width: 0;
|
|
278
|
+
justify-content: center;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* Let Btn thinMobile win over framed/default-size height on mobile */
|
|
282
|
+
.SelectBtn.is-thin-mobile .select-btn-items.default-size .bgl_btn {
|
|
283
|
+
height: calc(var(--bgl-btn-height) * 0.7);
|
|
284
|
+
line-height: calc(var(--bgl-btn-height) * 0.7);
|
|
285
|
+
}
|
|
262
286
|
}
|
|
263
287
|
</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
|
-
|
|
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
|
|
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
|
-
|
|
146
|
-
|
|
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
|
-
<
|
|
211
|
-
class="sidebar-nav
|
|
347
|
+
<div
|
|
348
|
+
class="sidebar-nav-wrap"
|
|
212
349
|
:class="{
|
|
213
|
-
'
|
|
214
|
-
'
|
|
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
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
:
|
|
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
|
-
</
|
|
239
|
-
</
|
|
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
|
-
|
|
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
|
-
.
|
|
400
|
-
|
|
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>
|