From bce4ab3facf63f70a0dd3cefa1f8c82453dba2d4 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Fri, 24 Jun 2022 19:12:13 +1000 Subject: Add type annotations for UI options --- src/App.vue | 36 +++++++++++++++----------------- src/README.md | 4 ++-- src/components/AncestryBar.vue | 7 +++---- src/components/HelpModal.vue | 3 ++- src/components/SearchModal.vue | 4 ++-- src/components/SettingsModal.vue | 5 +++-- src/components/Tile.vue | 8 +++---- src/components/TileInfoModal.vue | 8 +++---- src/components/TutorialPane.vue | 6 +++--- src/layout.ts | 2 +- src/lib.ts | 45 ++++++++++++++++++++++++++++++++++++++++ 11 files changed, 84 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/App.vue b/src/App.vue index b2cb8ad..eae0a16 100644 --- a/src/App.vue +++ b/src/App.vue @@ -16,10 +16,8 @@ import SettingsIcon from './components/icon/SettingsIcon.vue'; import HelpIcon from './components/icon/HelpIcon.vue'; // Classes and types // Note: Import paths lack a .ts or .js extension because .ts makes vue-tsc complain, and .js makes vite complain -import {TolNode} from './lib'; -import type {TolMap, Action} from './lib'; -import {LayoutNode} from './layout'; -import type {LayoutOptions, LayoutTreeChg} from './layout'; +import {TolNode, TolMap, UiOptions, Action} from './lib'; +import {LayoutNode, LayoutOptions, LayoutTreeChg} from './layout'; // Functions import {arraySum, randWeightedChoice, getScrollBarWidth, getBreakpoint} from './lib'; import {initLayoutTree, initLayoutMap, tryLayout} from './layout'; @@ -65,44 +63,44 @@ function getDefaultLytOpts(): LayoutOptions { function getDefaultUiOpts(){ let screenSz = getBreakpoint(); return { - // For tiles + // Shared styling borderRadius: 5, //px shadowNormal: '0 0 2px black', shadowHighlight: '0 0 1px 2px greenyellow', shadowFocused: '0 0 1px 2px orange', + // Styling for App + appBgColor: '#292524', + tileAreaOffset: screenSz == 'sm' ? 6 : 10, //px (space between root tile and display boundary) + // Styling for tiles + headerColor: '#fafaf9', + childThresholds: [[1, 'greenyellow'], [10, 'orange'], [100, 'red']], infoIconSz: 18, //px infoIconMargin: 2, //px - childThresholds: [[1, 'greenyellow'], [10, 'orange'], [100, 'red']], - headerColor: '#fafaf9', - // For leaf tiles leafTilePadding: 4, //px leafHeaderFontSz: 15, //px - // For non-leaf tiles nonleafBgColors: ['#44403c', '#57534e'], //tiles at depth N use the Nth color, repeating from the start as needed nonleafHeaderFontSz: 15, //px nonleafHeaderColor: '#fafaf9', nonleafHeaderBgColor: '#1c1917', - // For other components - appBgColor: '#292524', - tileAreaOffset: screenSz == 'sm' ? 6 : 10, //px (space between root tile and display boundary) - scrollGap: getScrollBarWidth(), - ancestryBarImgSz: 100, //px + // Styling for other components + infoModalImgSz: 200, ancestryBarBgColor: '#44403c', + ancestryBarImgSz: 100, //px ancestryTileMargin: 5, //px (gap between detached-ancestor tiles) - infoModalImgSz: 200, - searchSuggLimit: 5, - autoWaitTime: 500, //ms (time to wait between actions (with their transitions)) tutorialPaneSz: 200, tutorialPaneBgColor: '#1c1917', tutorialPaneTextColor: 'white', - tutorialSkip: false, // Timing related - tileChgDuration: 300, //ms (for tile move/expand/collapse) clickHoldDuration: 400, //ms (duration after mousedown when a click-and-hold is recognised) + tileChgDuration: 300, //ms (for tile move/expand/collapse) + autoWaitTime: 500, //ms (time to wait between actions (with their transitions)) // Other useReducedTree: false, + searchSuggLimit: 5, jumpToSearchedNode: false, + tutorialSkip: false, disabledActions: new Set() as Set, + scrollGap: getScrollBarWidth(), }; } diff --git a/src/README.md b/src/README.md index bccc3b1..4c6f70b 100644 --- a/src/README.md +++ b/src/README.md @@ -3,12 +3,12 @@ - App.vue: The main Vue component. - components: - Tile.vue: Displays a tree-of-life node, and can include child nodes. - - AncestryBar.vue: Displays ancestors of the top-level Tile. - - TutorialPane.vue: Displays tutorial content. - TileInfoModal.vue: Modal displaying info about a Tile's node. - SearchModal.vue: Modal with a search bar. - SettingsModal: Modal displaying configurable settings. - HelpModal.vue: Modal displaying help info. + - AncestryBar.vue: Displays ancestors of the top-level Tile. + - TutorialPane.vue: Displays tutorial content. - RButton.vue: Basic button component. - icon: Contains components that display SVG icons. - layout.ts: Contains code for laying out Tiles. diff --git a/src/components/AncestryBar.vue b/src/components/AncestryBar.vue index e11725f..85a8f99 100644 --- a/src/components/AncestryBar.vue +++ b/src/components/AncestryBar.vue @@ -1,9 +1,8 @@