-
Notifications
You must be signed in to change notification settings - Fork 0
#15: Console integration #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
393c418
#15: Starting to integrate luna-console
ackzell 12ebbf4
Missing file.
ackzell 7bd62ed
fix: Hiding container for controls when none of them are presented.
ackzell c9e798e
#15: Serializing and rebuilding the messages.
ackzell 6b4d8e4
Updating lock file
ackzell 1bce669
Updating lock file once more
ackzell 7947ca0
#15: Adding some configs to show and hide the console and to display …
ackzell 3657836
#15 #28 Adding toggles for the different layout configs
ackzell 4bda50d
#15: Adding some animations
ackzell 6ecd351
#15: Making luna console theme reactive
ackzell d931bef
#15: Actually making luna console theme reactive this time
ackzell 6ff389f
Small tweak on the history snapshots
ackzell 207f7c1
chore: bump version to 0.2.0-beta
ackzell 05c2a8f
Fixing variation in the position for the connected/disconnected indic…
ackzell 6703bd1
#28: Adding a toggle for reverse layout
ackzell debb36b
#28: WIP fixing mobile output layout
ackzell cb0d5ef
#28: Fixing resizing for output in horizontal mode
ackzell 638f29d
Using more specific class names to preserve resizing on horizontal la…
ackzell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| { | ||
| "name": "yehyecoa-vue", | ||
| "type": "module", | ||
| "version": "0.1.0-beta", | ||
| "version": "0.2.0-beta", | ||
| "private": true, | ||
| "packageManager": "[email protected]", | ||
| "engines": { | ||
|
|
||
This file contains hidden or 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 hidden or 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,189 @@ | ||
| <script setup lang="ts"> | ||
| import { computed, inject, reactive, useTemplateRef } from 'vue' | ||
| import { injectKeyPreviewRef, injectKeyProps } from './types' | ||
|
|
||
| const props = defineProps<{ layout?: 'horizontal' | 'vertical' }>() | ||
| const isVertical = computed(() => props.layout === 'vertical') | ||
|
|
||
| const containerRef = useTemplateRef('container') | ||
| const previewRef = inject(injectKeyPreviewRef)! | ||
|
|
||
| const { store, layoutReverse, splitPaneOptions } = inject(injectKeyProps)! | ||
|
|
||
| const state = reactive({ | ||
| dragging: false, | ||
| split: 50, | ||
| viewHeight: 0, | ||
| viewWidth: 0, | ||
| }) | ||
|
|
||
| const boundSplit = computed(() => { | ||
| const { split } = state | ||
| return split < 20 ? 20 : split > 80 ? 80 : split | ||
| }) | ||
|
|
||
| let startPosition = 0 | ||
| let startSplit = 0 | ||
|
|
||
| function dragStart(e: MouseEvent) { | ||
| state.dragging = true | ||
| startPosition = isVertical.value ? e.pageY : e.pageX | ||
| startSplit = boundSplit.value | ||
|
|
||
| changeViewSize() | ||
| } | ||
|
|
||
| function dragMove(e: MouseEvent) { | ||
| if (containerRef.value && state.dragging) { | ||
| const position = isVertical.value ? e.pageY : e.pageX | ||
| const totalSize = isVertical.value | ||
| ? containerRef.value.offsetHeight | ||
| : containerRef.value.offsetWidth | ||
| const dp = position - startPosition | ||
| state.split = startSplit + +((dp / totalSize) * 100).toFixed(2) | ||
|
|
||
| changeViewSize() | ||
| } | ||
| } | ||
|
|
||
| function dragEnd() { | ||
| state.dragging = false | ||
| } | ||
|
|
||
| function changeViewSize() { | ||
| const el = previewRef.value | ||
| if (!el) return | ||
| state.viewHeight = el.offsetHeight | ||
| state.viewWidth = el.offsetWidth | ||
| } | ||
| </script> | ||
|
|
||
| <template> | ||
| <div | ||
| ref="container" class="output-split-pane" :class="{ | ||
| 'osp-dragging': state.dragging, | ||
| reverse: layoutReverse, | ||
| vertical: isVertical, | ||
| }" @mousemove="dragMove" @mouseup="dragEnd" @mouseleave="dragEnd" | ||
| > | ||
| <div class="first" :style="{ [isVertical ? 'height' : 'width']: boundSplit + '%' }"> | ||
| <slot name="first" /> | ||
| <div class="dragger" @mousedown.prevent="dragStart" /> | ||
| </div> | ||
| <div class="second" :style="{ [isVertical ? 'height' : 'width']: 100 - boundSplit + '%' }"> | ||
| <div v-show="state.dragging" class="view-size"> | ||
| {{ `${state.viewWidth}px x ${state.viewHeight}px` }} | ||
| </div> | ||
| <slot name="second" /> | ||
| </div> | ||
|
|
||
| <button class="toggler" @click="store.showOutput = !store.showOutput"> | ||
| {{ | ||
| store.showOutput | ||
| ? splitPaneOptions?.codeTogglerText || '< Code' : splitPaneOptions?.outputTogglerText || 'Output >' }} | ||
| </button> | ||
| </div> | ||
| </template> | ||
|
|
||
| <style scoped> | ||
| .output-split-pane { | ||
| display: flex; | ||
| flex-direction: row; | ||
| height: 100%; | ||
| position: relative; | ||
| } | ||
|
|
||
| .output-split-pane.osp-dragging { | ||
| cursor: ew-resize; | ||
| } | ||
|
|
||
| .osp-dragging .first, | ||
| .osp-dragging .second { | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| .first, | ||
| .second { | ||
| position: relative; | ||
| height: 100%; | ||
| } | ||
|
|
||
| .view-size { | ||
| position: absolute; | ||
| top: 40px; | ||
| left: 10px; | ||
| font-size: 12px; | ||
| color: var(--text-light); | ||
| z-index: 100; | ||
| background-color: var(--bg-soft); | ||
| padding: 0.5rem; | ||
| border-radius: 4px; | ||
| } | ||
|
|
||
| .first { | ||
| border-right: 1px solid var(--border); | ||
| } | ||
|
|
||
| .dragger { | ||
| position: absolute; | ||
| z-index: 3; | ||
| } | ||
|
|
||
| .vertical .dragger { | ||
| top: auto; | ||
| height: 10px; | ||
| width: 100%; | ||
| left: 0; | ||
| right: 0; | ||
| bottom: -5px; | ||
| cursor: ns-resize; | ||
| } | ||
|
|
||
| .toggler { | ||
| display: none; | ||
| z-index: 3; | ||
| font-family: var(--font-code); | ||
| color: var(--text-light); | ||
| position: absolute; | ||
| left: 50%; | ||
| bottom: 20px; | ||
| background-color: var(--bg); | ||
| padding: 8px 12px; | ||
| border-radius: 8px; | ||
| transform: translateX(-50%); | ||
| box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25); | ||
| } | ||
|
|
||
| .dark .toggler { | ||
| background-color: var(--bg); | ||
| } | ||
|
|
||
|
|
||
| .output-split-pane:not(.vertical) .dragger { | ||
| top: 0; | ||
| bottom: 0; | ||
| left: auto; | ||
| right: -5px; | ||
| width: 10px; | ||
| height: 100%; | ||
| cursor: ew-resize; | ||
| } | ||
|
|
||
| .output-split-pane.vertical { | ||
| flex-direction: column; | ||
| } | ||
|
|
||
| .output-split-pane.vertical.osp-dragging { | ||
| cursor: ns-resize; | ||
| } | ||
|
|
||
| .vertical .first, | ||
| .vertical .second { | ||
| width: 100%; | ||
| } | ||
|
|
||
| .vertical .first { | ||
| border-right: none; | ||
| border-bottom: 1px solid var(--border); | ||
| } | ||
| </style> |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -43,7 +43,10 @@ watch(showMessage, () => { | |
| /> | ||
| <Message v-show="showMessage" :err="store.errors[0]" /> | ||
|
|
||
| <div class="editor-floating"> | ||
| <div | ||
| v-show="editorOptions?.showErrorText !== false || editorOptions?.autoSaveText !== false" | ||
| class="editor-floating" | ||
|
Comment on lines
+47
to
+48
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. little square would just hang in there because there wasn't any switches present, so removing if no options are provided during repl instantiation |
||
| > | ||
| <ToggleButton | ||
| v-if="editorOptions?.showErrorText !== false" | ||
| v-model="showMessage" | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brand new component that does not care about responsiveness. This only determines whether the container is in vertical or horizontal mode and provides resize draggers for either case.