From e35cbd43a1fee253b7e2c803ad912e945491f81e Mon Sep 17 00:00:00 2001 From: lyonsyonii Date: Thu, 21 Dec 2023 10:45:00 +0100 Subject: [PATCH 1/3] FIX: added margin to CodeBlock dummy to avoid layout shifts; multiple style fixes --- .../src/components/CodeBlock/CodeBlock.astro | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/frontend/src/components/CodeBlock/CodeBlock.astro b/frontend/src/components/CodeBlock/CodeBlock.astro index eef645b..95d420b 100644 --- a/frontend/src/components/CodeBlock/CodeBlock.astro +++ b/frontend/src/components/CodeBlock/CodeBlock.astro @@ -77,6 +77,7 @@ const props = { pre { color: gray; line-height: 1.4; + margin-bottom: 8px; /* 75.2px */ } .buttons { display: flex; @@ -89,7 +90,7 @@ const props = { color: var(--sl-color-white); cursor: pointer; border: 0; - margin: 0rem; + margin: 0; padding: 0; height: fit-content; transition: opacity 0.25s ease; @@ -150,9 +151,7 @@ const props = { this.output = this.querySelector("output")!; this.runButton = this.querySelector(".run")!; this.resetButton = this.querySelector(".reset")!; - this.runButton.addEventListener("click", () => { - this.handleRun(); - }); + this.runButton.addEventListener("click", () => this.handleRun()); this.resetButton.addEventListener("click", () => { this.setValue(this.code); }); @@ -206,6 +205,7 @@ const props = { ...defaultKeymap, ...historyKeymap, ...foldKeymap, + indentWithTab ]) ]; @@ -219,8 +219,7 @@ const props = { }, stopPropagation: true, preventDefault: true, - }, - indentWithTab, + } ]); const editable = this.getAttribute("editable") === "true"; const theme = document.documentElement.dataset.theme || "light"; @@ -239,9 +238,8 @@ const props = { ], }), }); - + // Can't disable outline in any other way this.editor.dom.style.outline = "none"; - this.querySelector("pre")?.replaceWith(this.editor.dom); // To avoid line gutter collapsing setTimeout(() => this.editor.requestMeasure(), 300); @@ -274,12 +272,10 @@ const props = { setRunning(running: boolean) { if (running) { this.setReadonly(true); - this.runButton.disabled = true; - this.resetButton.disabled = true; + this.runButton.disabled = this.resetButton.disabled = true; } else { this.setReadonly(false); - this.runButton.disabled = false; - this.resetButton.disabled = false; + this.runButton.disabled = this.resetButton.disabled = false; } } From 822f83e745cdbce6e8e1d49a85cba5f3ab29382c Mon Sep 17 00:00:00 2001 From: lyonsyonii Date: Thu, 21 Dec 2023 10:45:11 +0100 Subject: [PATCH 2/3] UPD: updated packages --- frontend/package.json | 2 +- frontend/pnpm-lock.yaml | 44 ++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index b92d528..b181ac6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -26,7 +26,7 @@ "devDependencies": { "@astrojs/check": "^0.3.3", "@astrojs/starlight": "^0.15.1", - "astro": "^4.0.6", + "astro": "^4.0.7", "astro-compress": "^2.2.5", "astro-robots-txt": "^1.0.0", "astro-webmanifest": "^1.0.0", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index df68d77..640d058 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -42,10 +42,10 @@ devDependencies: version: 0.3.3(prettier-plugin-astro@0.12.2)(prettier@3.1.1)(typescript@5.3.3) '@astrojs/starlight': specifier: ^0.15.1 - version: 0.15.1(astro@4.0.6) + version: 0.15.1(astro@4.0.7) astro: - specifier: ^4.0.6 - version: 4.0.6(terser@5.26.0)(typescript@5.3.3) + specifier: ^4.0.7 + version: 4.0.7(terser@5.26.0)(typescript@5.3.3) astro-compress: specifier: ^2.2.5 version: 2.2.5 @@ -173,8 +173,8 @@ packages: - supports-color dev: true - /@astrojs/mdx@2.0.1(astro@4.0.6): - resolution: {integrity: sha512-lWbiNoVV/6DO8hAf6eZmcN28hY/herif9eglw2PXZ5lEPoRu175BvBtuNTt9rH9YA/Ldm5mkNXhvMWNEnMqJkw==} + /@astrojs/mdx@2.0.2(astro@4.0.7): + resolution: {integrity: sha512-pTkUb0+aiVU8MZU6XQKA/FyXdNOKxHwq+3uCIuzWyqjZyRB9hN3G3iokmkXFJhwgxl6gilkYeAKmmciVwnpq6w==} engines: {node: '>=18.14.1'} peerDependencies: astro: ^4.0.0 @@ -182,7 +182,7 @@ packages: '@astrojs/markdown-remark': 4.0.1 '@mdx-js/mdx': 3.0.0 acorn: 8.11.2 - astro: 4.0.6(terser@5.26.0)(typescript@5.3.3) + astro: 4.0.7(terser@5.26.0)(typescript@5.3.3) es-module-lexer: 1.4.1 estree-util-visit: 2.0.0 github-slugger: 2.0.0 @@ -213,18 +213,18 @@ packages: zod: 3.22.4 dev: true - /@astrojs/starlight@0.15.1(astro@4.0.6): + /@astrojs/starlight@0.15.1(astro@4.0.7): resolution: {integrity: sha512-5AdySPQOG/+r1vHSNotQAGqhQIfF68hS8PfV+z4M2ewnrWoeCsHI3yYRFYgSRsVofcOEGTHiIryTRG/uRIvDkQ==} peerDependencies: astro: ^4.0.0 dependencies: - '@astrojs/mdx': 2.0.1(astro@4.0.6) + '@astrojs/mdx': 2.0.2(astro@4.0.7) '@astrojs/sitemap': 3.0.3 '@pagefind/default-ui': 1.0.4 '@types/hast': 3.0.3 '@types/mdast': 4.0.3 - astro: 4.0.6(terser@5.26.0)(typescript@5.3.3) - astro-expressive-code: 0.30.1(astro@4.0.6) + astro: 4.0.7(terser@5.26.0)(typescript@5.3.3) + astro-expressive-code: 0.30.1(astro@4.0.7) bcp-47: 2.1.0 execa: 8.0.1 hast-util-select: 6.0.2 @@ -1892,12 +1892,12 @@ packages: resolution: {integrity: sha512-IAgYAlxYRMolaptsFB9quH7RxX4eUeC4UfULCPhT+ILcg7m1kbaxuyUKqGg9Hh+KZ+FNPPDAz7DqUfl+HDWhQg==} dev: false - /astro-expressive-code@0.30.1(astro@4.0.6): + /astro-expressive-code@0.30.1(astro@4.0.7): resolution: {integrity: sha512-Dr3VbK4HvIXTT8rsvd8PuRW4uZOpfRz9J8noVSSxmx7/M7o73SBtqauBYvxXpGHnagTJPGzYOa9BQS7jDHNUVw==} peerDependencies: astro: ^3.3.0 || ^4.0.0-beta dependencies: - astro: 4.0.6(terser@5.26.0)(typescript@5.3.3) + astro: 4.0.7(terser@5.26.0)(typescript@5.3.3) remark-expressive-code: 0.30.1 dev: true @@ -1916,8 +1916,8 @@ packages: zod: 3.22.4 dev: true - /astro@4.0.6(terser@5.26.0)(typescript@5.3.3): - resolution: {integrity: sha512-P7CfFqWKzkJozzF6IoOC6qoI2ONndV8P3ULhGDgMiXPL7xVkWI5haTBSpyrcjBx643tVXspIRsSV/v+Cx+CjGw==} + /astro@4.0.7(terser@5.26.0)(typescript@5.3.3): + resolution: {integrity: sha512-K+Ms2AAQvi6yERPuglcI69tnHyTT44JCjzqprSjw3uOwFX7N9obpLgbhmLMH1fPFTgzt3ZD7APjmtDPN51makw==} engines: {node: '>=18.14.1', npm: '>=6.14.0'} hasBin: true dependencies: @@ -1962,7 +1962,7 @@ packages: mime: 3.0.0 ora: 7.0.1 p-limit: 5.0.0 - p-queue: 7.4.1 + p-queue: 8.0.1 path-to-regexp: 6.2.1 preferred-pm: 3.1.2 probe-image-size: 7.2.3 @@ -4461,17 +4461,17 @@ packages: p-limit: 3.1.0 dev: true - /p-queue@7.4.1: - resolution: {integrity: sha512-vRpMXmIkYF2/1hLBKisKeVYJZ8S2tZ0zEAmIJgdVKP2nq0nh4qCdf8bgw+ZgKrkh71AOCaqzwbJJk1WtdcF3VA==} - engines: {node: '>=12'} + /p-queue@8.0.1: + resolution: {integrity: sha512-NXzu9aQJTAzbBqOt2hwsR63ea7yvxJc0PwN/zobNAudYfb1B7R08SzB4TsLeSbUCuG467NhnoT0oO6w1qRO+BA==} + engines: {node: '>=18'} dependencies: eventemitter3: 5.0.1 - p-timeout: 5.1.0 + p-timeout: 6.1.2 dev: true - /p-timeout@5.1.0: - resolution: {integrity: sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==} - engines: {node: '>=12'} + /p-timeout@6.1.2: + resolution: {integrity: sha512-UbD77BuZ9Bc9aABo74gfXhNvzC9Tx7SxtHSh1fxvx3jTLLYvmVhiQZZrJzqqU0jKbN32kb5VOKiLEQI/3bIjgQ==} + engines: {node: '>=14.16'} dev: true /p-try@2.2.0: From 6e7e7be9b702993b571a09946576789b30c9ff53 Mon Sep 17 00:00:00 2001 From: lyonsyonii Date: Thu, 21 Dec 2023 11:10:05 +0100 Subject: [PATCH 3/3] FIX: turned off 'optimizeHoistedScript' as it disabled some starlight components --- frontend/astro.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/astro.config.mjs b/frontend/astro.config.mjs index ae0e04e..c6c0d25 100644 --- a/frontend/astro.config.mjs +++ b/frontend/astro.config.mjs @@ -67,6 +67,6 @@ export default defineConfig({ remarkPlugins: [], }, experimental: { - optimizeHoistedScript: true, + optimizeHoistedScript: false, /* Disables some Starlight components */ }, });