From d1bf68320e7fdb1f0d6376e4645dac330a69f313 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Mon, 31 May 2021 11:51:32 -0700 Subject: [PATCH] Implement menu bar floating list menus (#163) Progress towards #135 --- client/web/.eslintrc.js | 1 + client/web/assets/16px-solid/file-new.svg | 3 + client/web/src/App.vue | 1 + .../web/src/components/widgets/Separator.vue | 27 ++- .../src/components/widgets/WorkingColors.vue | 16 +- .../widgets/buttons/PopoverButton.vue | 2 +- .../widgets/floating-menus/FloatingMenu.vue | 97 +++++++++- .../widgets/floating-menus/MenuList.vue | 181 ++++++++++++++++++ .../widgets/inputs/MenuBarInput.vue | 142 ++++++++++++-- .../widgets/inputs/SwatchPairInput.vue | 4 +- .../src/components/widgets/labels/Icon.vue | 2 + .../widgets/labels/UserInputLabel.vue | 33 +++- .../window/status-bar/StatusBar.vue | 20 +- client/web/wasm/src/document.rs | 6 + core/editor/src/tool/tool_message_handler.rs | 4 +- docs/design/feature-goals.md | 1 + 16 files changed, 482 insertions(+), 58 deletions(-) create mode 100644 client/web/assets/16px-solid/file-new.svg create mode 100644 client/web/src/components/widgets/floating-menus/MenuList.vue diff --git a/client/web/.eslintrc.js b/client/web/.eslintrc.js index 2aeb2e37..181a3892 100644 --- a/client/web/.eslintrc.js +++ b/client/web/.eslintrc.js @@ -28,6 +28,7 @@ module.exports = { "eol-last": ["error", "always"], "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", + "no-param-reassign": ["error", { props: false }], "max-len": ["error", { code: 200, tabWidth: 4 }], "@typescript-eslint/camelcase": "off", "@typescript-eslint/no-use-before-define": "off", diff --git a/client/web/assets/16px-solid/file-new.svg b/client/web/assets/16px-solid/file-new.svg new file mode 100644 index 00000000..ac6e7b8a --- /dev/null +++ b/client/web/assets/16px-solid/file-new.svg @@ -0,0 +1,3 @@ + + + diff --git a/client/web/src/App.vue b/client/web/src/App.vue index 3ccf8560..fec39e78 100644 --- a/client/web/src/App.vue +++ b/client/web/src/App.vue @@ -27,6 +27,7 @@ // See https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color() and https://caniuse.com/css-color-function // E6 = 90% alpha --floating-menu-opacity-color-2-mildblack: #222222e6; + --floating-menu-shadow: rgba(0, 0, 0, 50%); } html, diff --git a/client/web/src/components/widgets/Separator.vue b/client/web/src/components/widgets/Separator.vue index e83c822a..ab9379fb 100644 --- a/client/web/src/components/widgets/Separator.vue +++ b/client/web/src/components/widgets/Separator.vue @@ -1,6 +1,6 @@ @@ -15,9 +15,9 @@ margin-top: 8px; } - &.section { + &.section, + &.list { width: 100%; - margin: 8px 0; div { height: 1px; @@ -26,6 +26,14 @@ background: var(--color-7-middlegray); } } + + &.section { + margin: 8px 0; + } + + &.list { + margin: 4px 0; + } } &.horizontal { @@ -37,9 +45,9 @@ margin-left: 8px; } - &.section { + &.section, + &.list { height: 100%; - margin: 0 8px; div { height: calc(100% - 8px); @@ -48,6 +56,14 @@ background: var(--color-7-middlegray); } } + + &.section { + margin: 0 8px; + } + + &.list { + margin: 0 4px; + } } } @@ -64,6 +80,7 @@ export enum SeparatorType { "Related" = "Related", "Unrelated" = "Unrelated", "Section" = "Section", + "List" = "List", } export default defineComponent({ diff --git a/client/web/src/components/widgets/WorkingColors.vue b/client/web/src/components/widgets/WorkingColors.vue index ba11fdc7..f9b67940 100644 --- a/client/web/src/components/widgets/WorkingColors.vue +++ b/client/web/src/components/widgets/WorkingColors.vue @@ -2,8 +2,8 @@
- - + +
@@ -21,7 +21,19 @@ import { defineComponent } from "vue"; import SwatchPairInput from "./inputs/SwatchPairInput.vue"; import IconButton from "./buttons/IconButton.vue"; +const wasm = import("../../../wasm/pkg"); + export default defineComponent({ + methods: { + async swapColors() { + const { swap_colors } = await wasm; + swap_colors(); + }, + async resetColors() { + const { reset_colors } = await wasm; + reset_colors(); + }, + }, components: { SwatchPairInput, IconButton, diff --git a/client/web/src/components/widgets/buttons/PopoverButton.vue b/client/web/src/components/widgets/buttons/PopoverButton.vue index f170518c..d1d5bf13 100644 --- a/client/web/src/components/widgets/buttons/PopoverButton.vue +++ b/client/web/src/components/widgets/buttons/PopoverButton.vue @@ -1,6 +1,6 @@