|
2 | 2 | import type { DocksContext } from '@devframes/hub/client' |
3 | 3 | import type { CSSProperties } from 'vue' |
4 | 4 | import type { DockLayout } from './dock-layout' |
5 | | -import { useEventListener, useScreenSafeArea, whenever } from '@vueuse/core' |
| 5 | +import { useEventListener, whenever } from '@vueuse/core' |
6 | 6 | import { computed, onMounted, reactive, ref, useTemplateRef, watch } from 'vue' |
7 | 7 | import { BUILTIN_ENTRY_CLIENT_AUTH_NOTICE } from '../../constants' |
8 | 8 | import { t } from '../../i18n' |
9 | 9 | import { docksSplitGroupsWithCapacity, getEntryGroup, resolveNextRecentDockIds, resolveRecentDockEntries } from '../../state/dock-settings' |
10 | 10 | import { setDocksOverflowPanel, useDocksGroupPanel } from '../../state/floating-tooltip' |
11 | 11 | import { useSettings } from '../../state/settings-defaults' |
12 | 12 | import { useIsRpcTrusted } from '../../utils/useIsRpcTrusted' |
| 13 | +import { useSafeArea } from '../../utils/useSafeArea' |
13 | 14 | import BrandMark from '../icons/BrandMark.vue' |
14 | 15 | import { |
15 | 16 | dockLayoutCssVars, |
@@ -39,29 +40,15 @@ const layout = computed(() => resolveDockLayout(props.layout)) |
39 | 40 |
|
40 | 41 | const isSafari = navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome') |
41 | 42 |
|
42 | | -const safeArea = useScreenSafeArea() |
| 43 | +const anchorEl = useTemplateRef<HTMLDivElement>('anchorEl') |
43 | 44 |
|
44 | | -function toNumber(value: string) { |
45 | | - const num = +value |
46 | | - if (Number.isNaN(num)) |
47 | | - return 0 |
48 | | - return num |
49 | | -} |
| 45 | +const safeArea = useSafeArea(anchorEl) |
50 | 46 |
|
51 | 47 | // Effective spacing from the viewport edge: device safe-area insets plus the |
52 | 48 | // configured viewport margin. Passed down to the panel so both stay in sync. |
53 | | -const panelMargins = computed(() => resolveViewportMargins( |
54 | | - { |
55 | | - left: toNumber(safeArea.left.value), |
56 | | - top: toNumber(safeArea.top.value), |
57 | | - right: toNumber(safeArea.right.value), |
58 | | - bottom: toNumber(safeArea.bottom.value), |
59 | | - }, |
60 | | - layout.value, |
61 | | -)) |
| 49 | +const panelMargins = computed(() => resolveViewportMargins(safeArea.value, layout.value)) |
62 | 50 |
|
63 | 51 | const dockEl = useTemplateRef<HTMLDivElement>('dockEl') |
64 | | -const anchorEl = useTemplateRef<HTMLDivElement>('anchorEl') |
65 | 52 |
|
66 | 53 | const recalculateCounter = ref(0) |
67 | 54 | const isHovering = ref(false) |
|
0 commit comments