diff --git a/package-lock.json b/package-lock.json index c18b267..b90f805 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "@codemirror/state": "^6.5.0", "@codemirror/view": "^6.36.1", "@lezer/highlight": "^1.2.1", + "@rich_harris/svelte-split-pane": "^2.0.0", "@tauri-apps/api": "^2.2.0", "d3": "^7.9.0", "dayjs": "^1.11.13", @@ -64,7 +65,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", - "dev": true, "license": "Apache-2.0", "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", @@ -575,7 +575,6 @@ "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/set-array": "^1.2.1", @@ -590,7 +589,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, "license": "MIT", "engines": { "node": ">=6.0.0" @@ -600,7 +598,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, "license": "MIT", "engines": { "node": ">=6.0.0" @@ -610,14 +607,12 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -661,6 +656,14 @@ "dev": true, "license": "MIT" }, + "node_modules/@rich_harris/svelte-split-pane": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@rich_harris/svelte-split-pane/-/svelte-split-pane-2.0.0.tgz", + "integrity": "sha512-mwdBUw59nlozluhoU3fbMO11YZlJ6IM48ZT6jxen8hAJbGbjTZMDKpMwD1neuK8gxgBM1QKAHJLZN7DpSY+hjA==", + "peerDependencies": { + "svelte": "^5" + } + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.27.3", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.27.3.tgz", @@ -1509,7 +1512,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", - "dev": true, "license": "MIT" }, "node_modules/@types/geojson": { @@ -1533,7 +1535,6 @@ "version": "8.12.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", - "dev": true, "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -1546,7 +1547,6 @@ "version": "1.4.13", "resolved": "https://registry.npmjs.org/acorn-typescript/-/acorn-typescript-1.4.13.tgz", "integrity": "sha512-xsc9Xv0xlVfwp2o7sQ+GCQ1PgbkdcpWdTzrwXxO3xDMTAywVS3oXVOcOHuRjAPkS4P9b+yc/qNF15460v+jp4Q==", - "dev": true, "license": "MIT", "peerDependencies": { "acorn": ">=8.9.0" @@ -1556,7 +1556,6 @@ "version": "5.3.1", "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.1.tgz", "integrity": "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g==", - "dev": true, "license": "Apache-2.0", "engines": { "node": ">= 0.4" @@ -1566,7 +1565,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", - "dev": true, "license": "Apache-2.0", "engines": { "node": ">= 0.4" @@ -1592,7 +1590,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", - "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -2113,14 +2110,12 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.1.tgz", "integrity": "sha512-U9JedYYjCnadUlXk7e1Kr+aENQhtUaoaV9+gZm1T8LC/YBAPJx3NSPIAurFOC0U5vrdSevnUJS2/wUVxGwPhng==", - "dev": true, "license": "MIT" }, "node_modules/esrap": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/esrap/-/esrap-1.3.2.tgz", "integrity": "sha512-C4PXusxYhFT98GjLSmb20k9PREuUdporer50dhzGuJu9IJXktbMddVCMLAERl5dAHyAi73GWWCE4FVHGP1794g==", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" @@ -2206,7 +2201,6 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.3.tgz", "integrity": "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==", - "dev": true, "license": "MIT", "dependencies": { "@types/estree": "^1.0.6" @@ -2226,14 +2220,12 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==", - "dev": true, "license": "MIT" }, "node_modules/magic-string": { "version": "0.30.17", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" @@ -2488,7 +2480,6 @@ "version": "5.16.2", "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.16.2.tgz", "integrity": "sha512-S4mKWbjv53ik1NtGuO95TC7kBA8GYBIeT9fM6y2wHdLNqdCmPXJSWLVuO7vlJZ7TUksp+6qnvqCCtWnVXeTCyw==", - "dev": true, "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.3.0", @@ -2707,7 +2698,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/zimmerframe/-/zimmerframe-1.1.2.tgz", "integrity": "sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==", - "dev": true, "license": "MIT" } } diff --git a/package.json b/package.json index d7380a0..613a2a5 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@codemirror/state": "^6.5.0", "@codemirror/view": "^6.36.1", "@lezer/highlight": "^1.2.1", + "@rich_harris/svelte-split-pane": "^2.0.0", "@tauri-apps/api": "^2.2.0", "d3": "^7.9.0", "dayjs": "^1.11.13", diff --git a/src-tauri/capabilities/migrated.json b/src-tauri/capabilities/migrated.json index 2678577..0e7f579 100644 --- a/src-tauri/capabilities/migrated.json +++ b/src-tauri/capabilities/migrated.json @@ -6,7 +6,6 @@ "main" ], "permissions": [ - "core:default", - "core:window:allow-start-dragging" + "core:default" ] } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 4e4ffef..9dd79d9 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -40,7 +40,6 @@ "width": 1024, "height": 768, "theme": "Dark", - "titleBarStyle": "Overlay", "useHttpsScheme": true } ] diff --git a/src/lib/components/Drawer.svelte b/src/lib/components/Drawer.svelte new file mode 100644 index 0000000..5eeaa00 --- /dev/null +++ b/src/lib/components/Drawer.svelte @@ -0,0 +1,59 @@ + + +{#if open} +
(open = false)} + transition:fly={{ duration: 200, opacity: 0 }} + role="presentation" + > + +
+{/if} + + diff --git a/src/lib/components/History.svelte b/src/lib/components/History.svelte index 8cc3f39..3831e01 100644 --- a/src/lib/components/History.svelte +++ b/src/lib/components/History.svelte @@ -72,6 +72,7 @@ .content { height: 18px; + font-weight: 600; padding: 3px 0; line-height: 1.15; diff --git a/src/lib/components/Modal.svelte b/src/lib/components/Modal.svelte index 256229c..b0382a2 100644 --- a/src/lib/components/Modal.svelte +++ b/src/lib/components/Modal.svelte @@ -52,7 +52,6 @@ dialog { display: block; inset: 0; - top: var(--window-title-bar-height); max-inline-size: min(90vw, 60ch); max-block-size: min(80vh, 100%); margin-top: 0; diff --git a/src/lib/components/Queries/Queries.svelte b/src/lib/components/Queries/Queries.svelte index fad916d..c6a9aab 100644 --- a/src/lib/components/Queries/Queries.svelte +++ b/src/lib/components/Queries/Queries.svelte @@ -139,6 +139,7 @@ -webkit-appearance: none; width: 100%; height: 18px; + font-weight: 600; outline: none; margin: 0; padding: 0; @@ -149,6 +150,7 @@ & > span.name { display: block; height: 18px; + font-weight: 600; padding: 3px 0; line-height: 1.15; white-space: nowrap; diff --git a/src/lib/components/Result.svelte b/src/lib/components/Result.svelte index 5c35c51..d8c4638 100644 --- a/src/lib/components/Result.svelte +++ b/src/lib/components/Result.svelte @@ -52,6 +52,7 @@ } & > nav { + flex-shrink: 0; padding: 7px 5px; border-top: 1px solid hsl(0deg 0% 29%); user-select: none; diff --git a/src/lib/components/SideBar.svelte b/src/lib/components/SideBar.svelte index f126438..22d3d28 100644 --- a/src/lib/components/SideBar.svelte +++ b/src/lib/components/SideBar.svelte @@ -55,6 +55,9 @@ diff --git a/src/lib/components/SplitPane/index.ts b/src/lib/components/SplitPane/index.ts deleted file mode 100644 index 9eda3af..0000000 --- a/src/lib/components/SplitPane/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// TODO: Drop lib when `@rich_harris/svelte-split-pane` is updated for svelte5 -export { default as SplitPane } from './SplitPane.svelte'; diff --git a/src/lib/components/SplitPane/utils.ts b/src/lib/components/SplitPane/utils.ts deleted file mode 100644 index efb9ded..0000000 --- a/src/lib/components/SplitPane/utils.ts +++ /dev/null @@ -1,48 +0,0 @@ -export type Length = `${number}px` | `${number}%` | `${number}em` | `${number}rem`; - -export function constrain( - element: HTMLElement, - size: number, - min: Length, - max: Length, - pos: Length -): Length { - let min_px = normalize(min, element, size); - let max_px = normalize(max, element, size); - let pos_px = normalize(pos, element, size); - - if (min_px < 0) min_px += size; - if (max_px < 0) max_px += size; - - pos_px = Math.max(min_px, Math.min(max_px, pos_px)); - - const position: Length = pos.endsWith('%') - ? size - ? `${(100 * pos_px) / size}%` - : '0%' - : `${pos_px}px`; - - return position; -} - -function normalize(str: string, element: HTMLElement, size: number) { - const num = parseFloat(str); - - if (str.endsWith('px')) { - return num; - } - - if (str.endsWith('%')) { - return (size * num) / 100; - } - - if (str.endsWith('rem')) { - return num * parseFloat(getComputedStyle(document.documentElement).fontSize); - } - - if (str.endsWith('em')) { - return num * parseFloat(getComputedStyle(element).fontSize); - } - - throw new Error(`Invalid length: ${str}`); -} diff --git a/src/lib/components/WindowTitleBar.svelte b/src/lib/components/WindowTitleBar.svelte deleted file mode 100644 index d4f63f9..0000000 --- a/src/lib/components/WindowTitleBar.svelte +++ /dev/null @@ -1,39 +0,0 @@ - - - - -
-
- {@render actions()} -
-
- - diff --git a/src/lib/icons/Bars3.svelte b/src/lib/icons/Bars3.svelte new file mode 100644 index 0000000..f4cd077 --- /dev/null +++ b/src/lib/icons/Bars3.svelte @@ -0,0 +1,20 @@ + + + diff --git a/src/lib/icons/Play.svelte b/src/lib/icons/Play.svelte new file mode 100644 index 0000000..8784efc --- /dev/null +++ b/src/lib/icons/Play.svelte @@ -0,0 +1,20 @@ + + + diff --git a/src/lib/icons/Save.svelte b/src/lib/icons/Save.svelte new file mode 100644 index 0000000..8066ecc --- /dev/null +++ b/src/lib/icons/Save.svelte @@ -0,0 +1,16 @@ + + + + + diff --git a/src/lib/styles/main.css b/src/lib/styles/main.css index 4fb8c88..d0d4eea 100644 --- a/src/lib/styles/main.css +++ b/src/lib/styles/main.css @@ -4,8 +4,6 @@ @layer variables { :root { - --window-title-bar-height: 28px; - font-size: 0.75rem; } } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 151f95e..5cc35c9 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,23 +1,24 @@ - + - - {#snippet actions()} - - - {/snippet} - +{#snippet sidebar()} + +{/snippet}
- + {#if is_mobile} + + {@render sidebar()} + + {/if} + {#snippet a()} - { - await query_repository.delete(query.id); - const index = queries.indexOf(query); - queries = queries.slice(0, index).concat(queries.slice(index + 1)); - }} - onQueryOpen={(q) => { - query = q.sql; - }} - onQueryRename={async (q) => { - const updated = await query_repository.update(q); - const index = queries.findIndex((_q) => _q.id === updated.id); - if (index !== -1) { - queries = queries - .slice(0, index) - .concat(updated) - .concat(queries.slice(index + 1)); - } - }} - /> + {#if !is_mobile} + {@render sidebar()} + {/if} {/snippet} {#snippet b()} - + {#snippet a()} - +
+ +
+ +
+
{/snippet} {#snippet b()} @@ -136,15 +190,33 @@
- { - const q = await query_repository.create(name, query); - queries = queries.concat(q); - }} -/> +