@umbra.ui/core 0.1.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.
- package/dist/components/controls/Dropdown/types.d.ts +5 -0
- package/dist/components/controls/Dropdown/types.d.ts.map +1 -0
- package/dist/components/controls/Dropdown/types.js +1 -0
- package/dist/components/controls/SegmentedControl/types.d.ts +6 -0
- package/dist/components/controls/SegmentedControl/types.d.ts.map +1 -0
- package/dist/components/controls/SegmentedControl/types.js +1 -0
- package/dist/components/dialogs/Alert/types.d.ts +7 -0
- package/dist/components/dialogs/Alert/types.d.ts.map +1 -0
- package/dist/components/dialogs/Alert/types.js +1 -0
- package/dist/components/dialogs/Toast/types.d.ts +34 -0
- package/dist/components/dialogs/Toast/types.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/types.js +10 -0
- package/dist/components/dialogs/Toast/useToast.d.ts +36 -0
- package/dist/components/dialogs/Toast/useToast.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/useToast.js +90 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts +3 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/tooltip.js +33 -0
- package/dist/components/indicators/Tooltip/types.d.ts +14 -0
- package/dist/components/indicators/Tooltip/types.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/types.js +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts +18 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.js +57 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts +14 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts.map +1 -0
- package/dist/components/inputs/Tags/tag-bar-styles.js +313 -0
- package/dist/components/inputs/Tags/types.d.ts +93 -0
- package/dist/components/inputs/Tags/types.d.ts.map +1 -0
- package/dist/components/inputs/Tags/types.js +216 -0
- package/dist/components/inputs/search/types.d.ts +9 -0
- package/dist/components/inputs/search/types.d.ts.map +1 -0
- package/dist/components/inputs/search/types.js +1 -0
- package/dist/components/navigation/adaptive/types.d.ts +16 -0
- package/dist/components/navigation/adaptive/types.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/types.js +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts +27 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.js +40 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts +6 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useBreakpoints.js +37 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts +93 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.js +145 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts +31 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewAnimation.js +591 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts +52 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewResize.js +146 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts +25 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts.map +1 -0
- package/dist/components/navigation/navstack/useNavigationStack.js +133 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts +20 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts.map +1 -0
- package/dist/components/navigation/slideover/useSlideoverController.js +267 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts +20 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts.map +1 -0
- package/dist/components/navigation/splitview/useSplitViewController.js +325 -0
- package/dist/components/navigation/tabcontroller/types.d.ts +21 -0
- package/dist/components/navigation/tabcontroller/types.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/types.js +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts +5 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.js +10 -0
- package/dist/components/navigation/types.d.ts +8 -0
- package/dist/components/navigation/types.d.ts.map +1 -0
- package/dist/components/navigation/types.js +1 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts +11 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts.map +1 -0
- package/dist/components/pickers/CollectionPicker/types.js +1 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts +13 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts.map +1 -0
- package/dist/components/pickers/ColorPicker/colors.js +266 -0
- package/dist/components/pickers/FilePicker/types.d.ts +10 -0
- package/dist/components/pickers/FilePicker/types.d.ts.map +1 -0
- package/dist/components/pickers/FilePicker/types.js +1 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/theme.d.ts +73 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +279 -0
- package/dist/themes/blank.d.ts +7 -0
- package/dist/themes/blank.d.ts.map +1 -0
- package/dist/themes/blank.js +543 -0
- package/dist/themes/crimson-dark.d.ts +4 -0
- package/dist/themes/crimson-dark.d.ts.map +1 -0
- package/dist/themes/crimson-dark.js +552 -0
- package/dist/themes/cyan-light.d.ts +4 -0
- package/dist/themes/cyan-light.d.ts.map +1 -0
- package/dist/themes/cyan-light.js +552 -0
- package/dist/themes/dark.d.ts +4 -0
- package/dist/themes/dark.d.ts.map +1 -0
- package/dist/themes/dark.js +551 -0
- package/dist/themes/gold-dark.d.ts +4 -0
- package/dist/themes/gold-dark.d.ts.map +1 -0
- package/dist/themes/gold-dark.js +552 -0
- package/dist/themes/grass-dark.d.ts +4 -0
- package/dist/themes/grass-dark.d.ts.map +1 -0
- package/dist/themes/grass-dark.js +552 -0
- package/dist/themes/indigo.d.ts +4 -0
- package/dist/themes/indigo.d.ts.map +1 -0
- package/dist/themes/indigo.js +552 -0
- package/dist/themes/light.d.ts +4 -0
- package/dist/themes/light.d.ts.map +1 -0
- package/dist/themes/light.js +551 -0
- package/dist/themes/orange-dark.d.ts +4 -0
- package/dist/themes/orange-dark.d.ts.map +1 -0
- package/dist/themes/orange-dark.js +551 -0
- package/dist/themes/orange-light.d.ts +4 -0
- package/dist/themes/orange-light.d.ts.map +1 -0
- package/dist/themes/orange-light.js +551 -0
- package/package.json +62 -0
- package/src/components/controls/Button/Button.vue +417 -0
- package/src/components/controls/Button/README.md +348 -0
- package/src/components/controls/Button/theme.css +200 -0
- package/src/components/controls/Checkbox/Checkbox.vue +164 -0
- package/src/components/controls/Checkbox/README.md +441 -0
- package/src/components/controls/Checkbox/theme.css +36 -0
- package/src/components/controls/Dropdown/Dropdown.vue +476 -0
- package/src/components/controls/Dropdown/README.md +370 -0
- package/src/components/controls/Dropdown/theme.css +50 -0
- package/src/components/controls/Dropdown/types.ts +6 -0
- package/src/components/controls/IconButton/IconButton.vue +267 -0
- package/src/components/controls/IconButton/README.md +502 -0
- package/src/components/controls/IconButton/theme.css +89 -0
- package/src/components/controls/Radio/README.md +591 -0
- package/src/components/controls/Radio/Radio.vue +89 -0
- package/src/components/controls/Radio/theme.css +14 -0
- package/src/components/controls/RangeSlider/README.md +608 -0
- package/src/components/controls/RangeSlider/RangeSlider.vue +535 -0
- package/src/components/controls/RangeSlider/theme.css +80 -0
- package/src/components/controls/SegmentedControl/README.md +587 -0
- package/src/components/controls/SegmentedControl/SegmentedControl.vue +284 -0
- package/src/components/controls/SegmentedControl/theme.css +60 -0
- package/src/components/controls/SegmentedControl/types.ts +5 -0
- package/src/components/controls/Slider/README.md +627 -0
- package/src/components/controls/Slider/Slider.vue +260 -0
- package/src/components/controls/Slider/theme.css +74 -0
- package/src/components/controls/Stepper/README.md +601 -0
- package/src/components/controls/Stepper/Stepper.vue +103 -0
- package/src/components/controls/Stepper/theme.css +53 -0
- package/src/components/controls/Switch/README.md +667 -0
- package/src/components/controls/Switch/Switch.vue +127 -0
- package/src/components/controls/Switch/theme.css +42 -0
- package/src/components/dialogs/Alert/Alert.vue +218 -0
- package/src/components/dialogs/Alert/README.md +450 -0
- package/src/components/dialogs/Alert/theme.css +44 -0
- package/src/components/dialogs/Alert/types.ts +11 -0
- package/src/components/dialogs/Toast/README.md +522 -0
- package/src/components/dialogs/Toast/Toast.vue +296 -0
- package/src/components/dialogs/Toast/ToastContainer.vue +330 -0
- package/src/components/dialogs/Toast/theme.css +44 -0
- package/src/components/dialogs/Toast/types.ts +46 -0
- package/src/components/dialogs/Toast/useToast.ts +127 -0
- package/src/components/indicators/ProgressBar/ProgressBar.vue +98 -0
- package/src/components/indicators/ProgressBar/README.md +744 -0
- package/src/components/indicators/ProgressBar/theme.css +36 -0
- package/src/components/indicators/Tooltip/README.md +723 -0
- package/src/components/indicators/Tooltip/TooltipProvider.vue +142 -0
- package/src/components/indicators/Tooltip/theme.css +18 -0
- package/src/components/indicators/Tooltip/tooltip.ts +48 -0
- package/src/components/indicators/Tooltip/types.ts +15 -0
- package/src/components/indicators/Tooltip/useTooltip.ts +71 -0
- package/src/components/inputs/AutogrowTextView/AutogrowTextView.vue +110 -0
- package/src/components/inputs/AutogrowTextView/README.md +643 -0
- package/src/components/inputs/AutogrowTextView/theme.css +28 -0
- package/src/components/inputs/InputCard/InputCard.vue +600 -0
- package/src/components/inputs/InputCard/README.md +636 -0
- package/src/components/inputs/InputEmail/InputEmail.vue +698 -0
- package/src/components/inputs/InputEmail/README.md +764 -0
- package/src/components/inputs/InputNumber/InputNumber.vue +300 -0
- package/src/components/inputs/InputNumber/README.md +749 -0
- package/src/components/inputs/InputPhone/InputPhone.vue +645 -0
- package/src/components/inputs/InputPhone/README.md +636 -0
- package/src/components/inputs/InputSecure/InputSecure.vue +646 -0
- package/src/components/inputs/InputSecure/README.md +771 -0
- package/src/components/inputs/InputText/InputText.vue +225 -0
- package/src/components/inputs/InputText/README.md +844 -0
- package/src/components/inputs/OTP/OTP.vue +349 -0
- package/src/components/inputs/OTP/README.md +736 -0
- package/src/components/inputs/OTP/theme.css +50 -0
- package/src/components/inputs/StringCapture/README.md +718 -0
- package/src/components/inputs/StringCapture/StringCapture.vue +315 -0
- package/src/components/inputs/StringCapture/theme.css +86 -0
- package/src/components/inputs/Tags/README.md +897 -0
- package/src/components/inputs/Tags/TagBar.vue +793 -0
- package/src/components/inputs/Tags/TagCreation.vue +219 -0
- package/src/components/inputs/Tags/TagPicker.vue +380 -0
- package/src/components/inputs/Tags/tag-bar-styles.ts +354 -0
- package/src/components/inputs/Tags/theme.css +121 -0
- package/src/components/inputs/Tags/types.ts +346 -0
- package/src/components/inputs/search/README.md +759 -0
- package/src/components/inputs/search/SearchBar.vue +394 -0
- package/src/components/inputs/search/SearchResults.vue +310 -0
- package/src/components/inputs/search/theme.css +187 -0
- package/src/components/inputs/search/types.ts +8 -0
- package/src/components/inputs/theme.css +102 -0
- package/src/components/menus/ActionMenu/ActionMenu.vue +383 -0
- package/src/components/menus/ActionMenu/README.md +825 -0
- package/src/components/menus/ActionMenu/theme.css +93 -0
- package/src/components/models/Popover/Popover.vue +551 -0
- package/src/components/models/Popover/README.md +885 -0
- package/src/components/models/Popover/theme.css +52 -0
- package/src/components/models/Sheet/README.md +1159 -0
- package/src/components/models/Sheet/Sheet.vue +465 -0
- package/src/components/models/Sheet/theme.css +72 -0
- package/src/components/models/Sidebar/README.md +1228 -0
- package/src/components/models/Sidebar/Sidebar.vue +480 -0
- package/src/components/models/Sidebar/theme.css +90 -0
- package/src/components/navigation/adaptive/AdaptiveLayout.vue +779 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutBreadcrumbs.vue +192 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutMenuButton.vue +149 -0
- package/src/components/navigation/adaptive/README.md +768 -0
- package/src/components/navigation/adaptive/types.ts +19 -0
- package/src/components/navigation/adaptive/useAdaptiveLayout.ts +89 -0
- package/src/components/navigation/adaptive/useBreakpoints.ts +41 -0
- package/src/components/navigation/adaptive/useContainerMonitor.ts +214 -0
- package/src/components/navigation/adaptive/useViewAnimation.ts +721 -0
- package/src/components/navigation/adaptive/useViewResize.ts +211 -0
- package/src/components/navigation/navstack/NavigationStack.vue +180 -0
- package/src/components/navigation/navstack/README.md +994 -0
- package/src/components/navigation/navstack/useNavigationStack.ts +164 -0
- package/src/components/navigation/slideover/README.md +1275 -0
- package/src/components/navigation/slideover/SlideoverController.vue +287 -0
- package/src/components/navigation/slideover/useSlideoverController.ts +320 -0
- package/src/components/navigation/splitview/README.md +1115 -0
- package/src/components/navigation/splitview/SplitViewController.vue +176 -0
- package/src/components/navigation/splitview/useSplitViewController.ts +388 -0
- package/src/components/navigation/tabcontroller/README.md +919 -0
- package/src/components/navigation/tabcontroller/TabController.vue +307 -0
- package/src/components/navigation/tabcontroller/TabItem.vue +57 -0
- package/src/components/navigation/tabcontroller/types.ts +24 -0
- package/src/components/navigation/tabcontroller/useTabController.ts +18 -0
- package/src/components/navigation/theme.css +91 -0
- package/src/components/navigation/types.ts +7 -0
- package/src/components/pickers/CollectionPicker/CollectionPicker.vue +398 -0
- package/src/components/pickers/CollectionPicker/README.md +1115 -0
- package/src/components/pickers/CollectionPicker/theme.css +14 -0
- package/src/components/pickers/CollectionPicker/types.ts +11 -0
- package/src/components/pickers/ColorPicker/ColorPicker.vue +376 -0
- package/src/components/pickers/ColorPicker/README.md +1439 -0
- package/src/components/pickers/ColorPicker/colors.ts +299 -0
- package/src/components/pickers/ColorPicker/theme.css +32 -0
- package/src/components/pickers/DatePicker/DatePicker.vue +660 -0
- package/src/components/pickers/DatePicker/README.md +1195 -0
- package/src/components/pickers/DatePicker/theme.css +22 -0
- package/src/components/pickers/FilePicker/FilePicker.vue +534 -0
- package/src/components/pickers/FilePicker/README.md +1542 -0
- package/src/components/pickers/FilePicker/theme.css +48 -0
- package/src/components/pickers/FilePicker/types.ts +10 -0
- package/src/components/pickers/IconPicker/IconPicker.vue +327 -0
- package/src/components/pickers/IconPicker/README.md +1161 -0
- package/src/components/pickers/IconPicker/theme.css +28 -0
- package/src/components/pickers/theme.css +82 -0
- package/src/components/views/MarkdownViewer/MarkdownViewer.vue +442 -0
- package/src/components/views/MarkdownViewer/README.md +833 -0
- package/src/components/views/MarkdownViewer/theme.css +130 -0
- package/src/index.ts +263 -0
- package/src/theme.ts +378 -0
- package/src/themes/crimson-dark.ts +556 -0
- package/src/themes/cyan-light.ts +556 -0
- package/src/themes/dark.ts +557 -0
- package/src/themes/gold-dark.ts +556 -0
- package/src/themes/grass-dark.ts +556 -0
- package/src/themes/indigo.ts +556 -0
- package/src/themes/light.ts +557 -0
- package/src/themes/orange-dark.ts +557 -0
- package/src/themes/orange-light.ts +557 -0
- package/src/vue.d.ts +45 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// useViewResize.ts
|
|
2
|
+
import { ref, watch, onUnmounted } from "vue";
|
|
3
|
+
export const useViewResize = (onScreenViews, config, props, getViewId, // Changed from (index: number) => string
|
|
4
|
+
getOnscreenId) => {
|
|
5
|
+
const resizing = ref(null);
|
|
6
|
+
const resizeTooltip = ref({
|
|
7
|
+
visible: false,
|
|
8
|
+
x: 0,
|
|
9
|
+
y: 0,
|
|
10
|
+
width: 0,
|
|
11
|
+
});
|
|
12
|
+
const updateViewWidth = (viewId, width) => {
|
|
13
|
+
const view = onScreenViews.value.find((v) => v.id === viewId);
|
|
14
|
+
if (view) {
|
|
15
|
+
view.currentWidth = width;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const calculateMaxWidthWithoutOverflow = (viewIndex) => {
|
|
19
|
+
const container = document.querySelector(`#${getOnscreenId()}`);
|
|
20
|
+
if (!container) {
|
|
21
|
+
return Infinity;
|
|
22
|
+
}
|
|
23
|
+
const containerWidth = container.clientWidth;
|
|
24
|
+
const containerPadding = parseFloat(props.padding) || 0;
|
|
25
|
+
const gap = parseFloat(props.gap) || 0;
|
|
26
|
+
// Calculate available width considering padding
|
|
27
|
+
let availableWidth = containerWidth - containerPadding * 2;
|
|
28
|
+
// Calculate total width used by other views
|
|
29
|
+
let totalOtherViewsWidth = 0;
|
|
30
|
+
for (let i = 0; i < onScreenViews.value.length; i++) {
|
|
31
|
+
if (i !== viewIndex) {
|
|
32
|
+
const view = onScreenViews.value[i];
|
|
33
|
+
const viewElement = document.getElementById(getViewId(view) // Changed from getViewId(i)
|
|
34
|
+
);
|
|
35
|
+
if (viewElement) {
|
|
36
|
+
// For views that aren't the last one, use their current width
|
|
37
|
+
// For the last view (if it's not the one being resized), use its minimum width
|
|
38
|
+
if (i === onScreenViews.value.length - 1) {
|
|
39
|
+
// Last view uses its minimum width when calculating constraints
|
|
40
|
+
totalOtherViewsWidth += view.minWidth || config.defaultMinWidth;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Use actual width for non-last views
|
|
44
|
+
totalOtherViewsWidth +=
|
|
45
|
+
view.currentWidth || viewElement.offsetWidth;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Calculate gaps between views
|
|
51
|
+
const totalGaps = gap * (onScreenViews.value.length - 1);
|
|
52
|
+
// Calculate maximum width for the resizing view
|
|
53
|
+
const maxWidth = availableWidth - totalOtherViewsWidth - totalGaps;
|
|
54
|
+
// Ensure we return a positive value
|
|
55
|
+
return Math.max(config.defaultMinWidth, maxWidth);
|
|
56
|
+
};
|
|
57
|
+
const startResize = (viewId, event) => {
|
|
58
|
+
const view = onScreenViews.value.find((v) => v.id === viewId);
|
|
59
|
+
if (!view) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
// Use getViewId to find the element more reliably
|
|
63
|
+
const viewElement = document.getElementById(getViewId(view));
|
|
64
|
+
if (!viewElement) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const currentWidth = view.currentWidth || viewElement.offsetWidth;
|
|
68
|
+
resizing.value = {
|
|
69
|
+
viewId,
|
|
70
|
+
startX: event.clientX,
|
|
71
|
+
startWidth: currentWidth,
|
|
72
|
+
};
|
|
73
|
+
// Show tooltip with initial width
|
|
74
|
+
resizeTooltip.value = {
|
|
75
|
+
visible: true,
|
|
76
|
+
x: event.clientX,
|
|
77
|
+
y: event.clientY - 40,
|
|
78
|
+
width: Math.round(currentWidth),
|
|
79
|
+
};
|
|
80
|
+
// Prevent text selection during resize
|
|
81
|
+
document.body.style.userSelect = "none";
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
};
|
|
84
|
+
const handleMouseResize = (event) => {
|
|
85
|
+
if (!resizing.value)
|
|
86
|
+
return;
|
|
87
|
+
const view = onScreenViews.value.find((v) => v.id === resizing.value?.viewId);
|
|
88
|
+
if (!view)
|
|
89
|
+
return;
|
|
90
|
+
const viewIndex = onScreenViews.value.findIndex((v) => v.id === resizing.value?.viewId);
|
|
91
|
+
if (viewIndex === -1)
|
|
92
|
+
return;
|
|
93
|
+
const deltaX = event.clientX - resizing.value.startX;
|
|
94
|
+
const newWidth = resizing.value.startWidth + deltaX;
|
|
95
|
+
// Apply constraints
|
|
96
|
+
const minWidth = view.minWidth || config.defaultMinWidth;
|
|
97
|
+
const maxWidthFromView = view.maxWidth || Infinity;
|
|
98
|
+
const maxWidthFromContainer = calculateMaxWidthWithoutOverflow(viewIndex);
|
|
99
|
+
const maxWidth = Math.min(maxWidthFromView, maxWidthFromContainer);
|
|
100
|
+
const constrainedWidth = Math.max(minWidth, Math.min(newWidth, maxWidth));
|
|
101
|
+
// Update width through the callback function
|
|
102
|
+
updateViewWidth(view.id, constrainedWidth);
|
|
103
|
+
// Check if a constraint was hit
|
|
104
|
+
const isConstrained = newWidth !== constrainedWidth;
|
|
105
|
+
// Update tooltip position and value
|
|
106
|
+
resizeTooltip.value = {
|
|
107
|
+
visible: !isConstrained, // Hide when hitting a constraint
|
|
108
|
+
x: event.clientX,
|
|
109
|
+
y: event.clientY - 40,
|
|
110
|
+
width: Math.round(constrainedWidth),
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const endResize = () => {
|
|
114
|
+
if (!resizing.value)
|
|
115
|
+
return;
|
|
116
|
+
resizing.value = null;
|
|
117
|
+
document.body.style.userSelect = "";
|
|
118
|
+
// Hide tooltip
|
|
119
|
+
resizeTooltip.value.visible = false;
|
|
120
|
+
};
|
|
121
|
+
// Set up event listeners when resizing starts/ends
|
|
122
|
+
watch(resizing, (newVal) => {
|
|
123
|
+
if (newVal) {
|
|
124
|
+
document.addEventListener("mousemove", handleMouseResize);
|
|
125
|
+
document.addEventListener("mouseup", endResize);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
document.removeEventListener("mousemove", handleMouseResize);
|
|
129
|
+
document.removeEventListener("mouseup", endResize);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
// Cleanup on unmount
|
|
133
|
+
const cleanup = () => {
|
|
134
|
+
document.removeEventListener("mousemove", handleMouseResize);
|
|
135
|
+
document.removeEventListener("mouseup", endResize);
|
|
136
|
+
};
|
|
137
|
+
onUnmounted(() => {
|
|
138
|
+
cleanup();
|
|
139
|
+
});
|
|
140
|
+
return {
|
|
141
|
+
resizing,
|
|
142
|
+
resizeTooltip,
|
|
143
|
+
startResize,
|
|
144
|
+
updateViewWidth,
|
|
145
|
+
};
|
|
146
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
import { Pane } from "../types";
|
|
3
|
+
export declare function useNavigationStack(initialPanes: Pane[], taskKey: string): {
|
|
4
|
+
panes: Ref<{
|
|
5
|
+
name: string;
|
|
6
|
+
background: string;
|
|
7
|
+
foreground: string;
|
|
8
|
+
component: any;
|
|
9
|
+
props: Record<string, any>;
|
|
10
|
+
}[], Pane[] | {
|
|
11
|
+
name: string;
|
|
12
|
+
background: string;
|
|
13
|
+
foreground: string;
|
|
14
|
+
component: any;
|
|
15
|
+
props: Record<string, any>;
|
|
16
|
+
}[]>;
|
|
17
|
+
visiblePanes: import("vue").ComputedRef<boolean[]>;
|
|
18
|
+
currentIndex: Ref<number, number>;
|
|
19
|
+
navigate: (index: number, animated?: boolean) => void;
|
|
20
|
+
addPane: (pane: Pane, navigateToNew?: boolean) => void;
|
|
21
|
+
removePane: (index: number) => void;
|
|
22
|
+
insertPane: (index: number, pane: Pane, navigateToNew?: boolean) => void;
|
|
23
|
+
updatePanes: (newPanes: Pane[]) => void;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=useNavigationStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNavigationStack.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/navstack/useNavigationStack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,GAAG,EAAmB,MAAM,KAAK,CAAC;AAGhD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIhC,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;sBAO7C,MAAM,aAAY,OAAO;oBA4E3B,IAAI,kBAAiB,OAAO;wBAWxB,MAAM;wBAqBxB,MAAM,QACP,IAAI,kBACK,OAAO;4BAqBO,IAAI,EAAE;EAkBtC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
import { gsap } from "gsap";
|
|
3
|
+
import { Flip } from "gsap/Flip";
|
|
4
|
+
gsap.registerPlugin(Flip);
|
|
5
|
+
export function useNavigationStack(initialPanes, taskKey) {
|
|
6
|
+
const panes = ref(initialPanes);
|
|
7
|
+
const currentIndex = ref(0);
|
|
8
|
+
const visiblePanes = computed(() => panes.value.map((_, index) => index === currentIndex.value));
|
|
9
|
+
const navigate = (index, animated = true) => {
|
|
10
|
+
// Ensure index is within bounds
|
|
11
|
+
if (index < 0 || index >= panes.value.length) {
|
|
12
|
+
console.warn(`Navigation index ${index} out of bounds`);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const offscreenLeft = document.getElementById(`${taskKey}-offscreen-left`);
|
|
16
|
+
const onscreen = document.getElementById(`${taskKey}-onscreen`);
|
|
17
|
+
const offscreenRight = document.getElementById(`${taskKey}-offscreen-right`);
|
|
18
|
+
if (!offscreenLeft || !onscreen || !offscreenRight) {
|
|
19
|
+
console.log(`Elements are null for key \`${taskKey}\`. Unable to animate`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Hide all panes initially
|
|
23
|
+
panes.value.forEach((_, idx) => {
|
|
24
|
+
const element = document.getElementById(`${taskKey}-pane-${idx}`);
|
|
25
|
+
if (element) {
|
|
26
|
+
element.style.display = "none";
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
let states = [];
|
|
30
|
+
const next = document.getElementById(`${taskKey}-pane-${index}`);
|
|
31
|
+
if (next) {
|
|
32
|
+
next.style.display = "grid";
|
|
33
|
+
states.push(next);
|
|
34
|
+
}
|
|
35
|
+
const current = onscreen.children[0];
|
|
36
|
+
if (current) {
|
|
37
|
+
current.style.display = "grid";
|
|
38
|
+
states.push(current);
|
|
39
|
+
}
|
|
40
|
+
if (!animated) {
|
|
41
|
+
states = [];
|
|
42
|
+
}
|
|
43
|
+
const state = Flip.getState(states);
|
|
44
|
+
// Reorganize panes
|
|
45
|
+
for (let i = 0; i < panes.value.length; i++) {
|
|
46
|
+
const pane = document.getElementById(`${taskKey}-pane-${i}`);
|
|
47
|
+
if (!pane)
|
|
48
|
+
continue;
|
|
49
|
+
if (i < index) {
|
|
50
|
+
pane.parentNode?.removeChild(pane);
|
|
51
|
+
offscreenLeft.appendChild(pane);
|
|
52
|
+
}
|
|
53
|
+
else if (i > index) {
|
|
54
|
+
pane.parentNode?.removeChild(pane);
|
|
55
|
+
offscreenRight.appendChild(pane);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
pane.parentNode?.removeChild(pane);
|
|
59
|
+
onscreen.appendChild(pane);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
currentIndex.value = index;
|
|
63
|
+
Flip.from(state, {
|
|
64
|
+
duration: 0.3,
|
|
65
|
+
ease: "power1.inOut",
|
|
66
|
+
absolute: true,
|
|
67
|
+
}).then(() => {
|
|
68
|
+
if (current && current !== next) {
|
|
69
|
+
current.style.display = "none";
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const addPane = (pane, navigateToNew = false) => {
|
|
74
|
+
panes.value.push(pane);
|
|
75
|
+
// Wait for next tick to ensure DOM is updated
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
if (navigateToNew) {
|
|
78
|
+
navigate(panes.value.length - 1, true);
|
|
79
|
+
}
|
|
80
|
+
}, 0);
|
|
81
|
+
};
|
|
82
|
+
const removePane = (index) => {
|
|
83
|
+
if (index < 0 || index >= panes.value.length) {
|
|
84
|
+
console.warn(`Cannot remove pane at index ${index}`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// If we're removing the current pane, navigate away first
|
|
88
|
+
if (index === currentIndex.value) {
|
|
89
|
+
const newIndex = index > 0 ? index - 1 : 0;
|
|
90
|
+
if (panes.value.length > 1) {
|
|
91
|
+
navigate(newIndex, false);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else if (index < currentIndex.value) {
|
|
95
|
+
// Adjust current index if removing a pane before current
|
|
96
|
+
currentIndex.value--;
|
|
97
|
+
}
|
|
98
|
+
panes.value.splice(index, 1);
|
|
99
|
+
};
|
|
100
|
+
const insertPane = (index, pane, navigateToNew = false) => {
|
|
101
|
+
if (index < 0 || index > panes.value.length) {
|
|
102
|
+
console.warn(`Cannot insert pane at index ${index}`);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
panes.value.splice(index, 0, pane);
|
|
106
|
+
// Adjust current index if inserting before current position
|
|
107
|
+
if (index <= currentIndex.value) {
|
|
108
|
+
currentIndex.value++;
|
|
109
|
+
}
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
if (navigateToNew) {
|
|
112
|
+
navigate(index, true);
|
|
113
|
+
}
|
|
114
|
+
}, 0);
|
|
115
|
+
};
|
|
116
|
+
const updatePanes = (newPanes) => {
|
|
117
|
+
panes.value = newPanes;
|
|
118
|
+
// Reset to first pane if current index is out of bounds
|
|
119
|
+
if (currentIndex.value >= newPanes.length) {
|
|
120
|
+
navigate(0, false);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
return {
|
|
124
|
+
panes,
|
|
125
|
+
visiblePanes,
|
|
126
|
+
currentIndex,
|
|
127
|
+
navigate,
|
|
128
|
+
addPane,
|
|
129
|
+
removePane,
|
|
130
|
+
insertPane,
|
|
131
|
+
updatePanes,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
interface Pane {
|
|
3
|
+
name: string;
|
|
4
|
+
background: string;
|
|
5
|
+
foreground: string;
|
|
6
|
+
component: any;
|
|
7
|
+
props: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export declare const useSlideoverController: (panes: Pane[], componentId: string) => {
|
|
10
|
+
visiblePanes: Ref<boolean[], boolean[]>;
|
|
11
|
+
currentPaneIndex: import("vue").ComputedRef<number>;
|
|
12
|
+
showPane: (index: number) => void;
|
|
13
|
+
hidePane: (index: number) => void;
|
|
14
|
+
togglePane: (index: number) => void;
|
|
15
|
+
showAll: () => void;
|
|
16
|
+
hideAll: () => void;
|
|
17
|
+
navigate: (index: number, animated?: boolean) => void;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=useSlideoverController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSlideoverController.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/slideover/useSlideoverController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,GAAG,EAAY,MAAM,KAAK,CAAC;AAMzC,UAAU,IAAI;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,sBAAsB,GAAI,OAAO,IAAI,EAAE,EAAE,aAAa,MAAM;;;sBAqC9C,MAAM;sBAiDN,MAAM;wBAyCJ,MAAM;;;sBA6HR,MAAM,aAAY,OAAO;CAqDnD,CAAC"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
import { gsap } from "gsap";
|
|
3
|
+
import { Flip } from "gsap/Flip";
|
|
4
|
+
gsap.registerPlugin(Flip);
|
|
5
|
+
export const useSlideoverController = (panes, componentId) => {
|
|
6
|
+
// State to track visibility of panes
|
|
7
|
+
const visiblePanes = ref(panes.map(() => false));
|
|
8
|
+
// Track the current active pane index
|
|
9
|
+
const currentPaneIndex = computed(() => {
|
|
10
|
+
// Find the highest index that's visible
|
|
11
|
+
for (let i = visiblePanes.value.length - 1; i >= 0; i--) {
|
|
12
|
+
if (visiblePanes.value[i]) {
|
|
13
|
+
return i;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return -1;
|
|
17
|
+
});
|
|
18
|
+
// Helper functions to get unique element IDs
|
|
19
|
+
const getOffscreenId = () => `${componentId}-offscreen`;
|
|
20
|
+
const getOnscreenId = () => `${componentId}-onscreen`;
|
|
21
|
+
const getOverlayId = () => `${componentId}-overlay`;
|
|
22
|
+
const getDarkenId = () => `${componentId}-darken`;
|
|
23
|
+
const getPaneId = (index) => `${componentId}-pane-${index}`;
|
|
24
|
+
// Animate darken overlay
|
|
25
|
+
const animateDarken = (show) => {
|
|
26
|
+
const darken = document.getElementById(getDarkenId());
|
|
27
|
+
if (!darken)
|
|
28
|
+
return;
|
|
29
|
+
if (show) {
|
|
30
|
+
darken.style.pointerEvents = "all";
|
|
31
|
+
gsap.to(darken, { duration: 0.5, opacity: 1, ease: "circ.outOut" });
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
darken.style.pointerEvents = "none";
|
|
35
|
+
gsap.to(darken, { duration: 0.5, opacity: 0, ease: "circ.outOut" });
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
// Show a specific pane and all panes after it
|
|
39
|
+
const showPane = (index) => {
|
|
40
|
+
const offscreen = document.getElementById(getOffscreenId());
|
|
41
|
+
const overlay = document.getElementById(getOverlayId());
|
|
42
|
+
if (!offscreen || !overlay) {
|
|
43
|
+
console.error(`Elements are null for key '${componentId}'. Unable to animate`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// Don't show if it's the main pane (last one)
|
|
47
|
+
if (index >= panes.length - 1)
|
|
48
|
+
return;
|
|
49
|
+
// Get state for animation
|
|
50
|
+
const paneElements = panes
|
|
51
|
+
.slice(0, -1) // Exclude main pane
|
|
52
|
+
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
53
|
+
.filter((el) => el !== null);
|
|
54
|
+
const state = Flip.getState(paneElements);
|
|
55
|
+
// Show all panes from the selected index onward
|
|
56
|
+
for (let i = 0; i < panes.length - 1; i++) {
|
|
57
|
+
const pane = document.getElementById(getPaneId(i));
|
|
58
|
+
if (pane) {
|
|
59
|
+
if (i >= index) {
|
|
60
|
+
visiblePanes.value[i] = true;
|
|
61
|
+
pane.parentNode?.removeChild(pane);
|
|
62
|
+
overlay.appendChild(pane);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
visiblePanes.value[i] = false;
|
|
66
|
+
pane.parentNode?.removeChild(pane);
|
|
67
|
+
offscreen.appendChild(pane);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Animate
|
|
72
|
+
Flip.from(state, {
|
|
73
|
+
duration: 0.3,
|
|
74
|
+
ease: "power1.inOut",
|
|
75
|
+
absolute: true,
|
|
76
|
+
});
|
|
77
|
+
// Show darken overlay if any panes are visible
|
|
78
|
+
animateDarken(true);
|
|
79
|
+
};
|
|
80
|
+
// Hide a specific pane and all panes before it
|
|
81
|
+
const hidePane = (index) => {
|
|
82
|
+
const offscreen = document.getElementById(getOffscreenId());
|
|
83
|
+
const overlay = document.getElementById(getOverlayId());
|
|
84
|
+
if (!offscreen || !overlay) {
|
|
85
|
+
console.error(`Elements are null for key '${componentId}'. Unable to animate`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
// Get state for animation
|
|
89
|
+
const paneElements = panes
|
|
90
|
+
.slice(0, -1)
|
|
91
|
+
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
92
|
+
.filter((el) => el !== null);
|
|
93
|
+
const state = Flip.getState(paneElements);
|
|
94
|
+
// Hide all panes up to and including the specified index
|
|
95
|
+
for (let i = 0; i <= index && i < panes.length - 1; i++) {
|
|
96
|
+
const pane = document.getElementById(getPaneId(i));
|
|
97
|
+
if (pane) {
|
|
98
|
+
visiblePanes.value[i] = false;
|
|
99
|
+
pane.parentNode?.removeChild(pane);
|
|
100
|
+
offscreen.appendChild(pane);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Animate
|
|
104
|
+
Flip.from(state, {
|
|
105
|
+
duration: 0.3,
|
|
106
|
+
ease: "power1.inOut",
|
|
107
|
+
absolute: true,
|
|
108
|
+
});
|
|
109
|
+
// Hide darken if no panes are visible
|
|
110
|
+
const anyVisible = visiblePanes.value.slice(0, -1).some((v) => v);
|
|
111
|
+
animateDarken(anyVisible);
|
|
112
|
+
};
|
|
113
|
+
// Toggle a pane at a specific index
|
|
114
|
+
const togglePane = (index) => {
|
|
115
|
+
if (index <= 0 || index >= panes.length - 1)
|
|
116
|
+
return;
|
|
117
|
+
const offscreen = document.getElementById(getOffscreenId());
|
|
118
|
+
const overlay = document.getElementById(getOverlayId());
|
|
119
|
+
if (!offscreen || !overlay) {
|
|
120
|
+
console.error(`Elements are null for key '${componentId}'. Unable to animate`);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
// Get state for animation
|
|
124
|
+
const paneElements = panes
|
|
125
|
+
.slice(0, -1)
|
|
126
|
+
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
127
|
+
.filter((el) => el !== null);
|
|
128
|
+
const state = Flip.getState(paneElements);
|
|
129
|
+
// If the previous pane is visible, hide all before this one
|
|
130
|
+
if (visiblePanes.value[index - 1]) {
|
|
131
|
+
for (let i = 0; i < index; i++) {
|
|
132
|
+
const pane = document.getElementById(getPaneId(i));
|
|
133
|
+
if (pane) {
|
|
134
|
+
visiblePanes.value[i] = false;
|
|
135
|
+
pane.parentNode?.removeChild(pane);
|
|
136
|
+
offscreen.appendChild(pane);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
// Show only the pane immediately before the clicked pane
|
|
142
|
+
const pane = document.getElementById(getPaneId(index - 1));
|
|
143
|
+
if (pane) {
|
|
144
|
+
visiblePanes.value[index - 1] = true;
|
|
145
|
+
pane.parentNode?.removeChild(pane);
|
|
146
|
+
overlay.insertBefore(pane, overlay.children[index - 1] || null);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Animate
|
|
150
|
+
Flip.from(state, {
|
|
151
|
+
duration: 0.3,
|
|
152
|
+
ease: "power1.inOut",
|
|
153
|
+
absolute: true,
|
|
154
|
+
});
|
|
155
|
+
animateDarken(true);
|
|
156
|
+
};
|
|
157
|
+
// Show all secondary panes
|
|
158
|
+
const showAll = () => {
|
|
159
|
+
const offscreen = document.getElementById(getOffscreenId());
|
|
160
|
+
const overlay = document.getElementById(getOverlayId());
|
|
161
|
+
if (!offscreen || !overlay) {
|
|
162
|
+
console.error(`Elements are null for key '${componentId}'. Unable to animate`);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const paneElements = panes
|
|
166
|
+
.slice(0, -1)
|
|
167
|
+
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
168
|
+
.filter((el) => el !== null);
|
|
169
|
+
const state = Flip.getState(paneElements);
|
|
170
|
+
// Move all secondary panes to overlay
|
|
171
|
+
for (let i = 0; i < panes.length - 1; i++) {
|
|
172
|
+
const pane = document.getElementById(getPaneId(i));
|
|
173
|
+
if (pane) {
|
|
174
|
+
visiblePanes.value[i] = true;
|
|
175
|
+
pane.parentNode?.removeChild(pane);
|
|
176
|
+
overlay.appendChild(pane);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
Flip.from(state, {
|
|
180
|
+
duration: 0.3,
|
|
181
|
+
ease: "power1.inOut",
|
|
182
|
+
absolute: true,
|
|
183
|
+
});
|
|
184
|
+
animateDarken(true);
|
|
185
|
+
};
|
|
186
|
+
// Hide all secondary panes
|
|
187
|
+
const hideAll = () => {
|
|
188
|
+
const offscreen = document.getElementById(getOffscreenId());
|
|
189
|
+
const overlay = document.getElementById(getOverlayId());
|
|
190
|
+
if (!offscreen || !overlay) {
|
|
191
|
+
console.error(`Elements are null for key '${componentId}'. Unable to animate`);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const paneElements = panes
|
|
195
|
+
.slice(0, -1)
|
|
196
|
+
.map((_, i) => document.getElementById(getPaneId(i)))
|
|
197
|
+
.filter((el) => el !== null);
|
|
198
|
+
const state = Flip.getState(paneElements);
|
|
199
|
+
// Move all panes from overlay to offscreen
|
|
200
|
+
for (let i = 0; i < panes.length - 1; i++) {
|
|
201
|
+
const pane = document.getElementById(getPaneId(i));
|
|
202
|
+
if (pane) {
|
|
203
|
+
visiblePanes.value[i] = false;
|
|
204
|
+
pane.parentNode?.removeChild(pane);
|
|
205
|
+
offscreen.appendChild(pane);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
Flip.from(state, {
|
|
209
|
+
duration: 0.3,
|
|
210
|
+
ease: "power1.inOut",
|
|
211
|
+
absolute: true,
|
|
212
|
+
});
|
|
213
|
+
animateDarken(false);
|
|
214
|
+
};
|
|
215
|
+
// Navigate to a specific pane (show it and hide others)
|
|
216
|
+
const navigate = (index, animated = true) => {
|
|
217
|
+
if (index < 0 || index >= panes.length)
|
|
218
|
+
return;
|
|
219
|
+
// If navigating to the main pane, hide all
|
|
220
|
+
if (index === panes.length - 1) {
|
|
221
|
+
hideAll();
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
// If not animated, directly manipulate DOM without GSAP
|
|
225
|
+
if (!animated) {
|
|
226
|
+
const offscreen = document.getElementById(getOffscreenId());
|
|
227
|
+
const overlay = document.getElementById(getOverlayId());
|
|
228
|
+
if (!offscreen || !overlay)
|
|
229
|
+
return;
|
|
230
|
+
// Reset all panes
|
|
231
|
+
for (let i = 0; i < panes.length - 1; i++) {
|
|
232
|
+
const pane = document.getElementById(getPaneId(i));
|
|
233
|
+
if (pane) {
|
|
234
|
+
pane.parentNode?.removeChild(pane);
|
|
235
|
+
if (i === index) {
|
|
236
|
+
visiblePanes.value[i] = true;
|
|
237
|
+
overlay.appendChild(pane);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
visiblePanes.value[i] = false;
|
|
241
|
+
offscreen.appendChild(pane);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// Set darken state instantly
|
|
246
|
+
const darken = document.getElementById(getDarkenId());
|
|
247
|
+
if (darken) {
|
|
248
|
+
darken.style.opacity = "1";
|
|
249
|
+
darken.style.pointerEvents = "all";
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
// Otherwise show the requested pane with animation
|
|
254
|
+
showPane(index);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
return {
|
|
258
|
+
visiblePanes,
|
|
259
|
+
currentPaneIndex,
|
|
260
|
+
showPane,
|
|
261
|
+
hidePane,
|
|
262
|
+
togglePane,
|
|
263
|
+
showAll,
|
|
264
|
+
hideAll,
|
|
265
|
+
navigate,
|
|
266
|
+
};
|
|
267
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
import { Pane } from "../types";
|
|
3
|
+
export declare const useSplitViewController: (panes: Pane[] | Ref<Pane[]>, componentId: string) => {
|
|
4
|
+
visiblePanes: Ref<boolean[], boolean[]>;
|
|
5
|
+
currentPaneIndex: import("vue").ComputedRef<number>;
|
|
6
|
+
lastVisibilityEvent: Ref<{
|
|
7
|
+
type: "show" | "hide";
|
|
8
|
+
index: number;
|
|
9
|
+
} | null, {
|
|
10
|
+
type: "show" | "hide";
|
|
11
|
+
index: number;
|
|
12
|
+
} | null>;
|
|
13
|
+
showPane: (index: number) => void;
|
|
14
|
+
hidePane: (index: number) => void;
|
|
15
|
+
togglePane: (index: number) => void;
|
|
16
|
+
showAll: () => void;
|
|
17
|
+
hideAll: () => void;
|
|
18
|
+
navigate: (index: number, animated?: boolean) => void;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useSplitViewController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSplitViewController.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/splitview/useSplitViewController.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,GAAG,EAA0B,MAAM,KAAK,CAAC;AAGvD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIhC,eAAO,MAAM,sBAAsB,GACjC,OAAO,IAAI,EAAE,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,EAC3B,aAAa,MAAM;;;;cAUX,MAAM,GAAG,MAAM;eACd,MAAM;;cADP,MAAM,GAAG,MAAM;eACd,MAAM;;sBA2BU,MAAM;sBAqDN,MAAM;wBAqCJ,MAAM;;;sBAwIR,MAAM,aAAY,OAAO;CAiHnD,CAAC"}
|