-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from Joery-M/16-sl-ui-make-panels-generic-and-…
…configurable 16 sl UI make panels generic and configurable
- Loading branch information
Showing
23 changed files
with
620 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div style="flex: 1; display: grid; place-items: center"> | ||
<p>No page</p> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div class="grid h-full w-full place-content-center"> | ||
<PhCircleNotch class="animate-spin" aria-label="Loading" size="48" /> | ||
</div> | ||
</template> |
48 changes: 48 additions & 0 deletions
48
packages/safelight/src/components/Panels/PanelContainer.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<template> | ||
<Splitter | ||
:layout="config.splitDirection" | ||
:pt="{ | ||
root: { | ||
style: 'min-height: 0; height: 100%; border-radius: 0;' | ||
} | ||
}" | ||
@resize="clearSelection" | ||
@resizestart="dragStart" | ||
@resizeend="dragEnd" | ||
> | ||
<SplitterPanel v-for="(split, i) in config.split" :key="i" :min-size="5"> | ||
<PanelContainer v-if="'splitDirection' in split" :config="split" /> | ||
<PanelGroup v-else :config="split" /> | ||
</SplitterPanel> | ||
</Splitter> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { PanelSplitConfig } from './injection'; | ||
defineProps<{ | ||
config: PanelSplitConfig; | ||
}>(); | ||
// Save the selection range for when the drag ends | ||
// Could just remove the ranges when dragging, but this is nicer IMO | ||
let originalSelection: Range[] = []; | ||
function dragStart() { | ||
originalSelection = []; | ||
for (let index = 0; index < (getSelection()?.rangeCount ?? 0); index++) { | ||
const element = getSelection()?.getRangeAt(index); | ||
if (element) { | ||
originalSelection.push(element); | ||
} | ||
} | ||
} | ||
function dragEnd() { | ||
originalSelection.forEach((range) => { | ||
getSelection()?.addRange(range); | ||
}); | ||
} | ||
function clearSelection() { | ||
getSelection()?.removeAllRanges(); | ||
} | ||
</script> |
Oops, something went wrong.