diff --git a/bun.lock b/bun.lock index 9b673b90..9b2ad654 100644 --- a/bun.lock +++ b/bun.lock @@ -45,7 +45,7 @@ "stylelint-config-standard": "^41.1.0", "tailwindcss": "^4.3.5", "tailwindcss-primeui": "^0.6.1", - "tar": "^8.0.2", + "tar": "^8.0.3", "typescript": "^7.0.2", "typescript-6": "npm:typescript@^6.0.3", "unplugin-vue-components": "^32.1.0", @@ -484,7 +484,7 @@ "boolean": ["boolean@3.2.0", "", {}, "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw=="], - "brace-expansion": ["brace-expansion@5.1.0", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg=="], + "brace-expansion": ["brace-expansion@5.1.2", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-ELhY3JEerIBbhgW+rh0/8glkZAaMqn1x3BAvp3yTULSEGozMK/5PT6WTdBgsdvJqwwmv7MAQNOydfYbvK1Vgfw=="], "browserslist": ["browserslist@4.29.6", "", { "dependencies": { "baseline-browser-mapping": "^2.11.37", "caniuse-lite": "^1.0.30001826", "electron-to-chromium": "^1.5.486", "node-releases": "^2.0.64", "update-browserslist-db": "^1.4.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-CmVVIQ3RVc5HxYEc9X84GvxK/C8C1wH8TlKAiO7uTxF8PDwt7r8t9Qk3J9NkMOVzX5O/HbLv3yzxZg9HPrnI9w=="], @@ -1062,7 +1062,7 @@ "tapable": ["tapable@2.3.4", "", {}, "sha512-NHFiWnAbMJxNNpBwiO7jJVGDuqMxT9/oV8v57RR+fgBQShkJil5inGD8/xWy0hjLyHQyX1tu27QANhlz3KBqCg=="], - "tar": ["tar@8.0.2", "", {}, "sha512-1keL/dBVXwzliTinVjILeV/qZ2K3NNVFpg4JM1h3REOUJFamSLZmzVbCJXS6mF91//NwSaCbQ0gqmNwzE+ExCA=="], + "tar": ["tar@8.0.3", "", {}, "sha512-S+Gnl5H2+dD5DF7h4e6BOftgFcCqPv3rDRXCvhPLPeX7o2hnQ/aCax5bjdzRBb886xvBGR1vs+wHComyXbnRhQ=="], "temp": ["temp@0.9.4", "", { "dependencies": { "mkdirp": "^0.5.1", "rimraf": "~2.6.2" } }, "sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA=="], diff --git a/package.json b/package.json index a83a5399..5592cf63 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "url": "git+https://github.com/opencor/webapp.git" }, "type": "module", - "version": "1.20261130.0", + "version": "1.20261130.1", "engines": { "bun": ">=1.2.0" }, @@ -90,7 +90,7 @@ "stylelint-config-standard": "^41.1.0", "tailwindcss": "^4.3.5", "tailwindcss-primeui": "^0.6.1", - "tar": "^8.0.2", + "tar": "^8.0.3", "typescript": "^7.0.2", "typescript-6": "npm:typescript@^6.0.3", "unplugin-vue-components": "^32.1.0", diff --git a/src/renderer/bun.lock b/src/renderer/bun.lock index 5a25cee4..1a129f55 100644 --- a/src/renderer/bun.lock +++ b/src/renderer/bun.lock @@ -31,7 +31,7 @@ "stylelint-config-standard": "^41.1.0", "tailwindcss": "^4.3.5", "tailwindcss-primeui": "^0.6.1", - "tar": "^8.0.2", + "tar": "^8.0.3", "typescript": "^7.0.2", "typescript-6": "npm:typescript@^6.0.3", "unplugin-vue-components": "^32.1.0", @@ -328,7 +328,7 @@ "baseline-browser-mapping": ["baseline-browser-mapping@2.11.41", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-yjL/sZCpbpL0ocwmrUe1YFUelyMcifcByF4UYCBDyubFXQRs3lUjo9VoPKdjoFFhmzLAAGNJb1GBBCQJ6B4eyg=="], - "brace-expansion": ["brace-expansion@5.1.0", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg=="], + "brace-expansion": ["brace-expansion@5.1.2", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-ELhY3JEerIBbhgW+rh0/8glkZAaMqn1x3BAvp3yTULSEGozMK/5PT6WTdBgsdvJqwwmv7MAQNOydfYbvK1Vgfw=="], "browserslist": ["browserslist@4.29.6", "", { "dependencies": { "baseline-browser-mapping": "^2.11.37", "caniuse-lite": "^1.0.30001826", "electron-to-chromium": "^1.5.486", "node-releases": "^2.0.64", "update-browserslist-db": "^1.4.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-CmVVIQ3RVc5HxYEc9X84GvxK/C8C1wH8TlKAiO7uTxF8PDwt7r8t9Qk3J9NkMOVzX5O/HbLv3yzxZg9HPrnI9w=="], @@ -582,7 +582,7 @@ "tapable": ["tapable@2.3.4", "", {}, "sha512-NHFiWnAbMJxNNpBwiO7jJVGDuqMxT9/oV8v57RR+fgBQShkJil5inGD8/xWy0hjLyHQyX1tu27QANhlz3KBqCg=="], - "tar": ["tar@8.0.2", "", {}, "sha512-1keL/dBVXwzliTinVjILeV/qZ2K3NNVFpg4JM1h3REOUJFamSLZmzVbCJXS6mF91//NwSaCbQ0gqmNwzE+ExCA=="], + "tar": ["tar@8.0.3", "", {}, "sha512-S+Gnl5H2+dD5DF7h4e6BOftgFcCqPv3rDRXCvhPLPeX7o2hnQ/aCax5bjdzRBb886xvBGR1vs+wHComyXbnRhQ=="], "tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], diff --git a/src/renderer/changelog.json b/src/renderer/changelog.json index b01adb1e..e6f3935c 100644 --- a/src/renderer/changelog.json +++ b/src/renderer/changelog.json @@ -1,4 +1,22 @@ [ + { + "version": "1.20261130.1", + "changes": [ + { + "type": "improved", + "description": "Splitters are now thicker, only show their grip while the mouse is moved, and get highlighted when hovered or dragged." + } + ] + }, + { + "version": "1.20261130.0", + "changes": [ + { + "type": "added", + "description": "OpenCOR's Web app can now be installed (e.g., on a desktop, a tablet, or a phone) and used offline." + } + ] + }, { "version": "1.20261127.1", "changes": [ diff --git a/src/renderer/package.json b/src/renderer/package.json index 0eb75406..3fa50240 100644 --- a/src/renderer/package.json +++ b/src/renderer/package.json @@ -42,7 +42,7 @@ }, "./style.css": "./dist/opencor.css" }, - "version": "1.20261130.0", + "version": "1.20261130.1", "libopencorVersion": "1.20261125.0", "scripts": { "build": "vite build && bun scripts/generate.version.ts", @@ -89,7 +89,7 @@ "stylelint-config-standard": "^41.1.0", "tailwindcss": "^4.3.5", "tailwindcss-primeui": "^0.6.1", - "tar": "^8.0.2", + "tar": "^8.0.3", "typescript": "^7.0.2", "typescript-6": "npm:typescript@^6.0.3", "unplugin-vue-components": "^32.1.0", diff --git a/src/renderer/src/common/vueCommon.ts b/src/renderer/src/common/vueCommon.ts index ba7fd8ce..7c64c4c5 100644 --- a/src/renderer/src/common/vueCommon.ts +++ b/src/renderer/src/common/vueCommon.ts @@ -57,6 +57,56 @@ export const useSidePanelSplitter = ( return { sizes, onResizeEnd }; }; +// A composable to show the grips of the splitters within the given element while the mouse is being moved over that +// element (and for a short while after it has stopped moving), so that the splitters can be found without their grips +// always being shown (see simulation-experiment-view.css). +// Note #1: we only add/remove a class to/from the given element, and our grips fade in/out using CSS transitions. +// Note #2: the mouse may be moved a lot, so rather than restart a timer for each move, we keep track of when the mouse +// was last moved and, once our timer is up, we only hide our grips if the mouse hasn't been moved since. + +const SPLITTER_GRIPS_LIFE = 2000; + +export const useSplitterGrips = (elementRef: vue.Ref): void => { + const visibleClass = 'splitter-grips-visible'; + let lastMoveTime = 0; + let timer: number | undefined; + + const hideGrips = (): void => { + window.clearTimeout(timer); + + timer = undefined; + + elementRef.value?.classList.remove(visibleClass); + }; + + const checkGrips = (): void => { + const remainingTime = lastMoveTime + SPLITTER_GRIPS_LIFE - performance.now(); + + if (remainingTime > 0) { + timer = window.setTimeout(checkGrips, remainingTime); + } else { + hideGrips(); + } + }; + + const showGrips = (): void => { + lastMoveTime = performance.now(); + + if (timer === undefined) { + elementRef.value?.classList.add(visibleClass); + + timer = window.setTimeout(checkGrips, SPLITTER_GRIPS_LIFE); + } + }; + + vueusecore.useEventListener(elementRef, ['pointermove', 'pointerdown'], showGrips, { passive: true }); + vueusecore.useEventListener(elementRef, 'pointerleave', hideGrips, { passive: true }); + + vue.onBeforeUnmount(() => { + window.clearTimeout(timer); + }); +}; + // A constant to know the UID of the active instance of OpenCOR. export const activeInstanceUid = vueusecore.createGlobalState(() => vue.ref(null)); diff --git a/src/renderer/src/components/views/SimulationExperimentInteractiveView.vue b/src/renderer/src/components/views/SimulationExperimentInteractiveView.vue index c3850e1d..2cbbc04e 100644 --- a/src/renderer/src/components/views/SimulationExperimentInteractiveView.vue +++ b/src/renderer/src/components/views/SimulationExperimentInteractiveView.vue @@ -346,6 +346,8 @@ const model = isDocumentValid ? document.model(0) : null; const narrowLayout = vueCommon.useNarrowLayout(rootRef); const { sizes: sidePanelSizes, onResizeEnd: onSidePanelResizeEnd } = vueCommon.useSidePanelSplitter(narrowLayout); +vueCommon.useSplitterGrips(rootRef); + // Some helper functions to evaluate and apply the model changes resulting from the given parameters and scope. interface ModelChange { diff --git a/src/renderer/src/components/views/SimulationExperimentStandardView.vue b/src/renderer/src/components/views/SimulationExperimentStandardView.vue index 71c0df10..97c7f9b1 100644 --- a/src/renderer/src/components/views/SimulationExperimentStandardView.vue +++ b/src/renderer/src/components/views/SimulationExperimentStandardView.vue @@ -258,6 +258,8 @@ const simulationStatus = vue.ref(instance?.status() const narrowLayout = vueCommon.useNarrowLayout(rootRef); const { sizes: sidePanelSizes, onResizeEnd: onSidePanelResizeEnd } = vueCommon.useSidePanelSplitter(narrowLayout); +vueCommon.useSplitterGrips(rootRef); + // The outcome of our last simulation run, if any, and the status of our simulation, which we show in our toolbar. interface LastRun { diff --git a/src/renderer/src/components/views/simulation-experiment-view.css b/src/renderer/src/components/views/simulation-experiment-view.css index 13ecf455..6c7644ce 100644 --- a/src/renderer/src/components/views/simulation-experiment-view.css +++ b/src/renderer/src/components/views/simulation-experiment-view.css @@ -97,82 +97,106 @@ /** * Splitters (i.e. between our side panel and our plots and, in the Standard view, our console), which gutters are - * shown as thin lines with a grip (i.e. their handle) in their middle, so that they can be told apart from plain - * lines, and which get highlighted when hovered, dragged, or focused. + * shown as thick lines (as thick as their grip). Their grip (i.e. their handle, three dots in their middle) is only + * shown while the mouse is being moved over our view (see useSplitterGrips()), and fades out once the mouse has + * stopped moving. A gutter gets highlighted (without its grip) when hovered (after a short delay, so that it doesn't + * flicker when the mouse merely passes over it) or dragged. + * Note: PrimeVue's Splitter sets the width (horizontal layout) or height (vertical layout) of a gutter handle inline + * (to its gutter size, i.e. 4px by default), so we use the same size for our gutter (which also means that the + * sizes of our panels, which PrimeVue computes using that gutter size, are right). */ .p-splitter-gutter { position: relative; background-color: var(--p-content-border-color); - transition: background-color 0.15s ease; + transition: background-color 0.15s ease-out; } .p-splitter-horizontal > .p-splitter-gutter { - width: 1px !important; + width: 4px !important; } .p-splitter-vertical > .p-splitter-gutter { - height: 1px !important; + height: 4px !important; } /** - * Note #1: our gutter handle is a grip, i.e. three dots in a gap of our gutter. Its dots are drawn using a repeated - * radial gradient (in its content box), and our gap using the background colour of our contents (in its - * padding box), which hides our gutter around our dots. - * Note #2: our dots are wider than our gutter (which is only 1px wide/high), so that they can be seen. They overflow - * our gutter on both sides (since our gutter centres our handle), which is why they are 3px wide/high (i.e. - * an odd number of pixels, so that they are centred on our gutter rather than straddle half pixels), and - * they are drawn above our panels (since our gutter has a z-index, see PrimeVue's Splitter). - * Note #3: PrimeVue's Splitter sets the width (horizontal layout) or height (vertical layout) of our handle inline - * (to its gutter size, i.e. 4px by default), hence we need !important to override it (as for our gutter). + * Note: our gutter handle is a grip, i.e. three small dots drawn using a repeated radial gradient, and centred on our + * gutter. */ .p-splitter-gutter-handle { - --grip-dot-color: var(--p-content-border-color); + --grip-dot-color: var(--p-text-muted-color); flex-shrink: 0; - box-sizing: content-box; border-radius: 0; - background: - radial-gradient(circle at 1.5px 1.5px, var(--grip-dot-color) 1.2px, transparent 1.6px) 0 0 / 3px 6px repeat-y - content-box, - var(--p-content-background); + opacity: 0; + transition: opacity 0.25s ease-in; } .p-splitter-horizontal > .p-splitter-gutter > .p-splitter-gutter-handle { - width: 3px !important; + width: 4px !important; height: 15px; - padding: 4px 0; + background: + radial-gradient(circle at 2px 2.5px, var(--grip-dot-color) 0.8px, transparent 1.2px) 0 0 / 4px 5px repeat-y; } .p-splitter-vertical > .p-splitter-gutter > .p-splitter-gutter-handle { width: 15px; - height: 3px !important; - padding: 0 4px; - background-size: - 6px 3px, - auto; - background-repeat: repeat-x, no-repeat; + height: 4px !important; + background: + radial-gradient(circle at 2.5px 2px, var(--grip-dot-color) 0.8px, transparent 1.2px) 0 0 / 5px 4px repeat-x; + } + + &.splitter-grips-visible .p-splitter-gutter > .p-splitter-gutter-handle { + opacity: 1; + transition-duration: 0.15s; } /** - * Note: a gutter is only 1px wide/high, so we make it easier to grab by extending its hit area. + * Note: a gutter is only 4px wide/high, so we make it easier to grab by extending its hit area. */ .p-splitter-gutter::after { position: absolute; - inset: -3px; + inset: -2px; z-index: 1; content: ""; } - .p-splitter-gutter:hover, - .p-splitter-gutter[data-p-gutter-resizing="true"], + .p-splitter-gutter:hover { + background-color: var(--p-primary-color); + transition-delay: 0.3s; + + & > .p-splitter-gutter-handle { + opacity: 0; + transition: opacity 0.1s ease-out 0.3s; + } + } + + .p-splitter-gutter[data-p-gutter-resizing="true"] { + background-color: var(--p-primary-color); + transition: none; + + & > .p-splitter-gutter-handle { + opacity: 0; + transition: none; + } + } + + /** + * Show our grip, highlighted, when it has the keyboard focus, so that its focus ring can be seen (see app.css). + */ + .p-splitter-gutter:has(.p-splitter-gutter-handle:focus-visible) { background-color: var(--p-primary-color); + transition: none; + + & > .p-splitter-gutter-handle { + --grip-dot-color: var(--p-primary-contrast-color); - .p-splitter-gutter-handle { - --grip-dot-color: var(--p-primary-color); + opacity: 1; + transition: none; } }