Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Thomas G. Lopes
commited on
convert actions to attachments (#84)
Browse files- package.json +3 -3
- pnpm-lock.yaml +61 -73
- src/lib/actions/autofocus.ts +0 -14
- src/lib/actions/click-outside.ts +0 -55
- src/lib/attachments/autofocus.ts +12 -0
- src/lib/attachments/click-outside.ts +48 -0
- src/lib/{actions → attachments}/observe.svelte.ts +45 -49
- src/lib/components/dialog.svelte +5 -2
- src/lib/components/inference-playground/checkpoints-menu.svelte +2 -2
- src/lib/components/inference-playground/custom-model-config.svelte +4 -4
- src/lib/components/inference-playground/hf-token-modal.svelte +4 -4
- src/lib/components/inference-playground/img-preview.svelte +2 -2
- src/lib/components/inference-playground/message.svelte +2 -4
- src/lib/components/inference-playground/model-selector-modal.svelte +2 -2
- src/lib/components/inference-playground/playground.svelte +8 -4
- src/lib/components/inference-playground/project-select.svelte +2 -2
- src/lib/components/local-toasts.svelte +5 -6
- src/lib/components/prompts.svelte +4 -4
- src/lib/components/quota-modal.svelte +2 -2
- src/lib/components/share-modal.svelte +2 -2
package.json
CHANGED
|
@@ -45,11 +45,11 @@
|
|
| 45 |
"openai": "^4.90.0",
|
| 46 |
"postcss": "^8.4.38",
|
| 47 |
"prettier": "^3.1.1",
|
| 48 |
-
"prettier-plugin-svelte": "^3.
|
| 49 |
"prettier-plugin-tailwindcss": "^0.6.11",
|
| 50 |
"runed": "^0.25.0",
|
| 51 |
"shiki": "^3.4.0",
|
| 52 |
-
"svelte": "^5.
|
| 53 |
"svelte-check": "^4.0.0",
|
| 54 |
"tailwind-merge": "^3.0.2",
|
| 55 |
"tailwindcss": "^4.0.9",
|
|
@@ -63,7 +63,7 @@
|
|
| 63 |
"type": "module",
|
| 64 |
"dependencies": {
|
| 65 |
"dequal": "^2.0.3",
|
| 66 |
-
"eslint-plugin-svelte": "^3.
|
| 67 |
"remult": "^3.0.2",
|
| 68 |
"typia": "^8.0.0"
|
| 69 |
}
|
|
|
|
| 45 |
"openai": "^4.90.0",
|
| 46 |
"postcss": "^8.4.38",
|
| 47 |
"prettier": "^3.1.1",
|
| 48 |
+
"prettier-plugin-svelte": "^3.4.0",
|
| 49 |
"prettier-plugin-tailwindcss": "^0.6.11",
|
| 50 |
"runed": "^0.25.0",
|
| 51 |
"shiki": "^3.4.0",
|
| 52 |
+
"svelte": "^5.30.1",
|
| 53 |
"svelte-check": "^4.0.0",
|
| 54 |
"tailwind-merge": "^3.0.2",
|
| 55 |
"tailwindcss": "^4.0.9",
|
|
|
|
| 63 |
"type": "module",
|
| 64 |
"dependencies": {
|
| 65 |
"dequal": "^2.0.3",
|
| 66 |
+
"eslint-plugin-svelte": "^3.6.0",
|
| 67 |
"remult": "^3.0.2",
|
| 68 |
"typia": "^8.0.0"
|
| 69 |
}
|
pnpm-lock.yaml
CHANGED
|
@@ -12,8 +12,8 @@ importers:
|
|
| 12 |
specifier: ^2.0.3
|
| 13 |
version: 2.0.3
|
| 14 |
eslint-plugin-svelte:
|
| 15 |
-
specifier: ^3.
|
| 16 |
-
version: 3.
|
| 17 |
remult:
|
| 18 |
specifier: ^3.0.2
|
| 19 |
version: 3.0.2
|
|
@@ -56,16 +56,16 @@ importers:
|
|
| 56 |
version: 3.0.0
|
| 57 |
'@sveltejs/adapter-auto':
|
| 58 |
specifier: ^3.2.2
|
| 59 |
-
version: 3.3.1(@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.
|
| 60 |
'@sveltejs/adapter-node':
|
| 61 |
specifier: ^5.2.0
|
| 62 |
-
version: 5.2.12(@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.
|
| 63 |
'@sveltejs/kit':
|
| 64 |
specifier: ^2.5.27
|
| 65 |
-
version: 2.18.0(@sveltejs/[email protected](svelte@5.
|
| 66 |
'@sveltejs/vite-plugin-svelte':
|
| 67 |
specifier: ^4.0.0
|
| 68 |
-
version: 4.0.4(svelte@5.
|
| 69 |
'@tailwindcss/container-queries':
|
| 70 |
specifier: ^0.1.1
|
| 71 |
version: 0.1.1([email protected])
|
|
@@ -101,7 +101,7 @@ importers:
|
|
| 101 |
version: 2.4.2
|
| 102 |
melt:
|
| 103 |
specifier: ^0.30.1
|
| 104 |
-
version: 0.30.1(@floating-ui/[email protected])(svelte@5.
|
| 105 |
openai:
|
| 106 |
specifier: ^4.90.0
|
| 107 |
version: 4.90.0
|
|
@@ -112,23 +112,23 @@ importers:
|
|
| 112 |
specifier: ^3.1.1
|
| 113 |
version: 3.5.3
|
| 114 |
prettier-plugin-svelte:
|
| 115 |
-
specifier: ^3.
|
| 116 |
-
version: 3.
|
| 117 |
prettier-plugin-tailwindcss:
|
| 118 |
specifier: ^0.6.11
|
| 119 |
-
version: 0.6.11(prettier-plugin-svelte@3.
|
| 120 |
runed:
|
| 121 |
specifier: ^0.25.0
|
| 122 |
-
version: 0.25.0(svelte@5.
|
| 123 |
shiki:
|
| 124 |
specifier: ^3.4.0
|
| 125 |
version: 3.4.0
|
| 126 |
svelte:
|
| 127 |
-
specifier: ^5.
|
| 128 |
-
version: 5.
|
| 129 |
svelte-check:
|
| 130 |
specifier: ^4.0.0
|
| 131 |
-
version: 4.1.5([email protected])(svelte@5.
|
| 132 |
tailwind-merge:
|
| 133 |
specifier: ^3.0.2
|
| 134 |
version: 3.0.2
|
|
@@ -149,7 +149,7 @@ importers:
|
|
| 149 |
version: 8.26.1([email protected]([email protected]))([email protected])
|
| 150 |
unplugin-icons:
|
| 151 |
specifier: ^22.1.0
|
| 152 |
-
version: 22.1.0(svelte@5.
|
| 153 |
vite:
|
| 154 |
specifier: ^5.4.4
|
| 155 |
version: 5.4.14(@types/[email protected])([email protected])
|
|
@@ -1410,12 +1410,6 @@ packages:
|
|
| 1410 |
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
| 1411 |
engines: {node: '>=10'}
|
| 1412 |
|
| 1413 | |
| 1414 |
-
resolution: {integrity: sha512-/u+GQt8NMfXO8w17QendT4gvO5acfxQsAKirAt0LVxDnr2N8YLCVbregaNc/Yhp7NM128DwCaRvr8PLDfeNkQw==}
|
| 1415 |
-
engines: {node: '>=12'}
|
| 1416 |
-
peerDependencies:
|
| 1417 |
-
eslint: '>=6.0.0'
|
| 1418 |
-
|
| 1419 | |
| 1420 |
resolution: {integrity: sha512-4EQQr6wXwS+ZJSzaR5ZCrYgLxqvUjdXctaEtBqHcbkW944B1NQyO4qpdHQbXBONfwxXdkAY81HH4+LUfrg+zPw==}
|
| 1421 |
hasBin: true
|
|
@@ -1436,8 +1430,8 @@ packages:
|
|
| 1436 |
eslint-config-prettier:
|
| 1437 |
optional: true
|
| 1438 |
|
| 1439 |
-
eslint-plugin-svelte@3.
|
| 1440 |
-
resolution: {integrity: sha512-
|
| 1441 |
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
| 1442 |
peerDependencies:
|
| 1443 |
eslint: ^8.57.1 || ^9.0.0
|
|
@@ -1798,8 +1792,8 @@ packages:
|
|
| 1798 |
resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==}
|
| 1799 |
engines: {node: '>=6'}
|
| 1800 |
|
| 1801 |
-
known-css-properties@0.
|
| 1802 |
-
resolution: {integrity: sha512-
|
| 1803 |
|
| 1804 | |
| 1805 |
resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==}
|
|
@@ -2176,8 +2170,8 @@ packages:
|
|
| 2176 |
resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==}
|
| 2177 |
engines: {node: '>=6.0.0'}
|
| 2178 |
|
| 2179 |
-
prettier-plugin-svelte@3.
|
| 2180 |
-
resolution: {integrity: sha512-
|
| 2181 |
peerDependencies:
|
| 2182 |
prettier: ^3.0.0
|
| 2183 |
svelte: ^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0
|
|
@@ -2427,8 +2421,8 @@ packages:
|
|
| 2427 |
svelte: ^4.0.0 || ^5.0.0-next.0
|
| 2428 |
typescript: '>=5.0.0'
|
| 2429 |
|
| 2430 |
-
svelte-eslint-parser@1.
|
| 2431 |
-
resolution: {integrity: sha512-
|
| 2432 |
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
| 2433 |
peerDependencies:
|
| 2434 |
svelte: ^3.37.0 || ^4.0.0 || ^5.0.0
|
|
@@ -2436,8 +2430,8 @@ packages:
|
|
| 2436 |
svelte:
|
| 2437 |
optional: true
|
| 2438 |
|
| 2439 |
-
svelte@5.
|
| 2440 |
-
resolution: {integrity: sha512-
|
| 2441 |
engines: {node: '>=18'}
|
| 2442 |
|
| 2443 | |
|
@@ -3335,22 +3329,22 @@ snapshots:
|
|
| 3335 |
dependencies:
|
| 3336 |
acorn: 8.14.0
|
| 3337 |
|
| 3338 |
-
'@sveltejs/[email protected](@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.
|
| 3339 |
dependencies:
|
| 3340 |
-
'@sveltejs/kit': 2.18.0(@sveltejs/[email protected](svelte@5.
|
| 3341 |
import-meta-resolve: 4.1.0
|
| 3342 |
|
| 3343 |
-
'@sveltejs/[email protected](@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.
|
| 3344 |
dependencies:
|
| 3345 |
'@rollup/plugin-commonjs': 28.0.2([email protected])
|
| 3346 |
'@rollup/plugin-json': 6.1.0([email protected])
|
| 3347 |
'@rollup/plugin-node-resolve': 16.0.0([email protected])
|
| 3348 |
-
'@sveltejs/kit': 2.18.0(@sveltejs/[email protected](svelte@5.
|
| 3349 |
rollup: 4.34.9
|
| 3350 |
|
| 3351 |
-
'@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.
|
| 3352 |
dependencies:
|
| 3353 |
-
'@sveltejs/vite-plugin-svelte': 4.0.4(svelte@5.
|
| 3354 |
'@types/cookie': 0.6.0
|
| 3355 |
cookie: 0.6.0
|
| 3356 |
devalue: 5.1.1
|
|
@@ -3362,26 +3356,26 @@ snapshots:
|
|
| 3362 |
sade: 1.8.1
|
| 3363 |
set-cookie-parser: 2.7.1
|
| 3364 |
sirv: 3.0.1
|
| 3365 |
-
svelte: 5.
|
| 3366 |
vite: 5.4.14(@types/[email protected])([email protected])
|
| 3367 |
|
| 3368 |
-
'@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.
|
| 3369 |
dependencies:
|
| 3370 |
-
'@sveltejs/vite-plugin-svelte': 4.0.4(svelte@5.
|
| 3371 |
debug: 4.4.0
|
| 3372 |
-
svelte: 5.
|
| 3373 |
vite: 5.4.14(@types/[email protected])([email protected])
|
| 3374 |
transitivePeerDependencies:
|
| 3375 |
- supports-color
|
| 3376 |
|
| 3377 |
-
'@sveltejs/[email protected](svelte@5.
|
| 3378 |
dependencies:
|
| 3379 |
-
'@sveltejs/vite-plugin-svelte-inspector': 3.0.1(@sveltejs/[email protected](svelte@5.
|
| 3380 |
debug: 4.4.0
|
| 3381 |
deepmerge: 4.3.1
|
| 3382 |
kleur: 4.1.5
|
| 3383 |
magic-string: 0.30.17
|
| 3384 |
-
svelte: 5.
|
| 3385 |
vite: 5.4.14(@types/[email protected])([email protected])
|
| 3386 |
vitefu: 1.0.6([email protected](@types/[email protected])([email protected]))
|
| 3387 |
transitivePeerDependencies:
|
|
@@ -3852,11 +3846,6 @@ snapshots:
|
|
| 3852 |
|
| 3853 | |
| 3854 |
|
| 3855 | |
| 3856 |
-
dependencies:
|
| 3857 |
-
eslint: 9.22.0([email protected])
|
| 3858 |
-
semver: 7.7.1
|
| 3859 |
-
|
| 3860 | |
| 3861 |
dependencies:
|
| 3862 |
eslint: 9.22.0([email protected])
|
|
@@ -3870,21 +3859,20 @@ snapshots:
|
|
| 3870 |
optionalDependencies:
|
| 3871 |
eslint-config-prettier: 10.1.1([email protected]([email protected]))
|
| 3872 |
|
| 3873 |
-
eslint-plugin-svelte@3.
|
| 3874 |
dependencies:
|
| 3875 |
'@eslint-community/eslint-utils': 4.4.1([email protected]([email protected]))
|
| 3876 |
'@jridgewell/sourcemap-codec': 1.5.0
|
| 3877 |
eslint: 9.22.0([email protected])
|
| 3878 |
-
eslint-compat-utils: 0.6.4([email protected]([email protected]))
|
| 3879 |
esutils: 2.0.3
|
| 3880 |
-
known-css-properties: 0.
|
| 3881 |
postcss: 8.5.3
|
| 3882 |
postcss-load-config: 3.1.4([email protected])
|
| 3883 |
postcss-safe-parser: 7.0.1([email protected])
|
| 3884 |
semver: 7.7.1
|
| 3885 |
-
svelte-eslint-parser: 1.
|
| 3886 |
optionalDependencies:
|
| 3887 |
-
svelte: 5.
|
| 3888 |
transitivePeerDependencies:
|
| 3889 |
- ts-node
|
| 3890 |
|
|
@@ -4258,7 +4246,7 @@ snapshots:
|
|
| 4258 |
|
| 4259 | |
| 4260 |
|
| 4261 |
-
known-css-properties@0.
|
| 4262 |
|
| 4263 | |
| 4264 |
|
|
@@ -4359,14 +4347,14 @@ snapshots:
|
|
| 4359 |
unist-util-visit: 5.0.0
|
| 4360 |
vfile: 6.0.3
|
| 4361 |
|
| 4362 |
-
[email protected](@floating-ui/[email protected])(svelte@5.
|
| 4363 |
dependencies:
|
| 4364 |
'@floating-ui/dom': 1.6.13
|
| 4365 |
dequal: 2.0.3
|
| 4366 |
jest-axe: 9.0.0
|
| 4367 |
nanoid: 5.1.5
|
| 4368 |
-
runed: 0.23.4(svelte@5.
|
| 4369 |
-
svelte: 5.
|
| 4370 |
|
| 4371 | |
| 4372 |
|
|
@@ -4602,16 +4590,16 @@ snapshots:
|
|
| 4602 |
dependencies:
|
| 4603 |
fast-diff: 1.3.0
|
| 4604 |
|
| 4605 |
-
prettier-plugin-svelte@3.
|
| 4606 |
dependencies:
|
| 4607 |
prettier: 3.5.3
|
| 4608 |
-
svelte: 5.
|
| 4609 |
|
| 4610 |
-
[email protected](prettier-plugin-svelte@3.
|
| 4611 |
dependencies:
|
| 4612 |
prettier: 3.5.3
|
| 4613 |
optionalDependencies:
|
| 4614 |
-
prettier-plugin-svelte: 3.
|
| 4615 |
|
| 4616 | |
| 4617 |
|
|
@@ -4728,15 +4716,15 @@ snapshots:
|
|
| 4728 |
dependencies:
|
| 4729 |
queue-microtask: 1.2.3
|
| 4730 |
|
| 4731 |
-
[email protected](svelte@5.
|
| 4732 |
dependencies:
|
| 4733 |
esm-env: 1.2.2
|
| 4734 |
-
svelte: 5.
|
| 4735 |
|
| 4736 |
-
[email protected](svelte@5.
|
| 4737 |
dependencies:
|
| 4738 |
esm-env: 1.2.2
|
| 4739 |
-
svelte: 5.
|
| 4740 |
|
| 4741 | |
| 4742 |
dependencies:
|
|
@@ -4840,19 +4828,19 @@ snapshots:
|
|
| 4840 |
|
| 4841 | |
| 4842 |
|
| 4843 |
-
[email protected]([email protected])(svelte@5.
|
| 4844 |
dependencies:
|
| 4845 |
'@jridgewell/trace-mapping': 0.3.25
|
| 4846 |
chokidar: 4.0.3
|
| 4847 |
fdir: 6.4.3([email protected])
|
| 4848 |
picocolors: 1.1.1
|
| 4849 |
sade: 1.8.1
|
| 4850 |
-
svelte: 5.
|
| 4851 |
typescript: 5.8.2
|
| 4852 |
transitivePeerDependencies:
|
| 4853 |
- picomatch
|
| 4854 |
|
| 4855 |
-
svelte-eslint-parser@1.
|
| 4856 |
dependencies:
|
| 4857 |
eslint-scope: 8.3.0
|
| 4858 |
eslint-visitor-keys: 4.2.0
|
|
@@ -4861,9 +4849,9 @@ snapshots:
|
|
| 4861 |
postcss-scss: 4.0.9([email protected])
|
| 4862 |
postcss-selector-parser: 7.1.0
|
| 4863 |
optionalDependencies:
|
| 4864 |
-
svelte: 5.
|
| 4865 |
|
| 4866 |
-
svelte@5.
|
| 4867 |
dependencies:
|
| 4868 |
'@ampproject/remapping': 2.3.0
|
| 4869 |
'@jridgewell/sourcemap-codec': 1.5.0
|
|
@@ -5004,7 +4992,7 @@ snapshots:
|
|
| 5004 |
unist-util-is: 6.0.0
|
| 5005 |
unist-util-visit-parents: 6.0.1
|
| 5006 |
|
| 5007 |
-
[email protected](svelte@5.
|
| 5008 |
dependencies:
|
| 5009 |
'@antfu/install-pkg': 1.0.0
|
| 5010 |
'@iconify/utils': 2.3.0
|
|
@@ -5012,7 +5000,7 @@ snapshots:
|
|
| 5012 |
local-pkg: 1.1.1
|
| 5013 |
unplugin: 2.2.0
|
| 5014 |
optionalDependencies:
|
| 5015 |
-
svelte: 5.
|
| 5016 |
transitivePeerDependencies:
|
| 5017 |
- supports-color
|
| 5018 |
|
|
|
|
| 12 |
specifier: ^2.0.3
|
| 13 |
version: 2.0.3
|
| 14 |
eslint-plugin-svelte:
|
| 15 |
+
specifier: ^3.6.0
|
| 16 |
+
version: 3.6.0([email protected]([email protected]))(svelte@5.30.1)
|
| 17 |
remult:
|
| 18 |
specifier: ^3.0.2
|
| 19 |
version: 3.0.2
|
|
|
|
| 56 |
version: 3.0.0
|
| 57 |
'@sveltejs/adapter-auto':
|
| 58 |
specifier: ^3.2.2
|
| 59 |
+
version: 3.3.1(@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.30.1)([email protected](@types/[email protected])([email protected])))(svelte@5.30.1)([email protected](@types/[email protected])([email protected])))
|
| 60 |
'@sveltejs/adapter-node':
|
| 61 |
specifier: ^5.2.0
|
| 62 |
+
version: 5.2.12(@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.30.1)([email protected](@types/[email protected])([email protected])))(svelte@5.30.1)([email protected](@types/[email protected])([email protected])))
|
| 63 |
'@sveltejs/kit':
|
| 64 |
specifier: ^2.5.27
|
| 65 |
+
version: 2.18.0(@sveltejs/[email protected](svelte@5.30.1)([email protected](@types/[email protected])([email protected])))(svelte@5.30.1)([email protected](@types/[email protected])([email protected]))
|
| 66 |
'@sveltejs/vite-plugin-svelte':
|
| 67 |
specifier: ^4.0.0
|
| 68 |
+
version: 4.0.4(svelte@5.30.1)([email protected](@types/[email protected])([email protected]))
|
| 69 |
'@tailwindcss/container-queries':
|
| 70 |
specifier: ^0.1.1
|
| 71 |
version: 0.1.1([email protected])
|
|
|
|
| 101 |
version: 2.4.2
|
| 102 |
melt:
|
| 103 |
specifier: ^0.30.1
|
| 104 |
+
version: 0.30.1(@floating-ui/[email protected])(svelte@5.30.1)
|
| 105 |
openai:
|
| 106 |
specifier: ^4.90.0
|
| 107 |
version: 4.90.0
|
|
|
|
| 112 |
specifier: ^3.1.1
|
| 113 |
version: 3.5.3
|
| 114 |
prettier-plugin-svelte:
|
| 115 |
+
specifier: ^3.4.0
|
| 116 |
+
version: 3.4.0([email protected])(svelte@5.30.1)
|
| 117 |
prettier-plugin-tailwindcss:
|
| 118 |
specifier: ^0.6.11
|
| 119 |
+
version: 0.6.11(prettier-plugin-svelte@3.4.0([email protected])(svelte@5.30.1))([email protected])
|
| 120 |
runed:
|
| 121 |
specifier: ^0.25.0
|
| 122 |
+
version: 0.25.0(svelte@5.30.1)
|
| 123 |
shiki:
|
| 124 |
specifier: ^3.4.0
|
| 125 |
version: 3.4.0
|
| 126 |
svelte:
|
| 127 |
+
specifier: ^5.30.1
|
| 128 |
+
version: 5.30.1
|
| 129 |
svelte-check:
|
| 130 |
specifier: ^4.0.0
|
| 131 |
+
version: 4.1.5([email protected])(svelte@5.30.1)([email protected])
|
| 132 |
tailwind-merge:
|
| 133 |
specifier: ^3.0.2
|
| 134 |
version: 3.0.2
|
|
|
|
| 149 |
version: 8.26.1([email protected]([email protected]))([email protected])
|
| 150 |
unplugin-icons:
|
| 151 |
specifier: ^22.1.0
|
| 152 |
+
version: 22.1.0(svelte@5.30.1)
|
| 153 |
vite:
|
| 154 |
specifier: ^5.4.4
|
| 155 |
version: 5.4.14(@types/[email protected])([email protected])
|
|
|
|
| 1410 |
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
| 1411 |
engines: {node: '>=10'}
|
| 1412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1413 | |
| 1414 |
resolution: {integrity: sha512-4EQQr6wXwS+ZJSzaR5ZCrYgLxqvUjdXctaEtBqHcbkW944B1NQyO4qpdHQbXBONfwxXdkAY81HH4+LUfrg+zPw==}
|
| 1415 |
hasBin: true
|
|
|
|
| 1430 |
eslint-config-prettier:
|
| 1431 |
optional: true
|
| 1432 |
|
| 1433 |
+
eslint-plugin-svelte@3.6.0:
|
| 1434 |
+
resolution: {integrity: sha512-IIf6Cj6yQuCwL7Qd8bX13BZspz+DQsOkClozMF9EkW20FSxI75Ndd5ZzbviCn32DdXRo9FUWXn+YMIL46qPOOg==}
|
| 1435 |
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
| 1436 |
peerDependencies:
|
| 1437 |
eslint: ^8.57.1 || ^9.0.0
|
|
|
|
| 1792 |
resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==}
|
| 1793 |
engines: {node: '>=6'}
|
| 1794 |
|
| 1795 |
+
known-css-properties@0.36.0:
|
| 1796 |
+
resolution: {integrity: sha512-A+9jP+IUmuQsNdsLdcg6Yt7voiMF/D4K83ew0OpJtpu+l34ef7LaohWV0Rc6KNvzw6ZDizkqfyB5JznZnzuKQA==}
|
| 1797 |
|
| 1798 | |
| 1799 |
resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==}
|
|
|
|
| 2170 |
resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==}
|
| 2171 |
engines: {node: '>=6.0.0'}
|
| 2172 |
|
| 2173 |
+
prettier-plugin-svelte@3.4.0:
|
| 2174 |
+
resolution: {integrity: sha512-pn1ra/0mPObzqoIQn/vUTR3ZZI6UuZ0sHqMK5x2jMLGrs53h0sXhkVuDcrlssHwIMk7FYrMjHBPoUSyyEEDlBQ==}
|
| 2175 |
peerDependencies:
|
| 2176 |
prettier: ^3.0.0
|
| 2177 |
svelte: ^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0
|
|
|
|
| 2421 |
svelte: ^4.0.0 || ^5.0.0-next.0
|
| 2422 |
typescript: '>=5.0.0'
|
| 2423 |
|
| 2424 |
+
svelte-eslint-parser@1.2.0:
|
| 2425 |
+
resolution: {integrity: sha512-mbPtajIeuiyU80BEyGvwAktBeTX7KCr5/0l+uRGLq1dafwRNrjfM5kHGJScEBlPG3ipu6dJqfW/k0/fujvIEVw==}
|
| 2426 |
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
| 2427 |
peerDependencies:
|
| 2428 |
svelte: ^3.37.0 || ^4.0.0 || ^5.0.0
|
|
|
|
| 2430 |
svelte:
|
| 2431 |
optional: true
|
| 2432 |
|
| 2433 |
+
svelte@5.30.1:
|
| 2434 |
+
resolution: {integrity: sha512-QIYtKnJGkubWXtNkrUBKVCvyo9gjcccdbnvXfwsGNhvbeNNdQjRDTa/BiQcJ2kWXbXPQbWKyT7CUu53KIj1rfw==}
|
| 2435 |
engines: {node: '>=18'}
|
| 2436 |
|
| 2437 | |
|
|
|
| 3329 |
dependencies:
|
| 3330 |
acorn: 8.14.0
|
| 3331 |
|
| 3332 |
+
'@sveltejs/[email protected](@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.30.1)([email protected](@types/[email protected])([email protected])))(svelte@5.30.1)([email protected](@types/[email protected])([email protected])))':
|
| 3333 |
dependencies:
|
| 3334 |
+
'@sveltejs/kit': 2.18.0(@sveltejs/[email protected](svelte@5.30.1)([email protected](@types/[email protected])([email protected])))(svelte@5.30.1)([email protected](@types/[email protected])([email protected]))
|
| 3335 |
import-meta-resolve: 4.1.0
|
| 3336 |
|
| 3337 |
+
'@sveltejs/[email protected](@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.30.1)([email protected](@types/[email protected])([email protected])))(svelte@5.30.1)([email protected](@types/[email protected])([email protected])))':
|
| 3338 |
dependencies:
|
| 3339 |
'@rollup/plugin-commonjs': 28.0.2([email protected])
|
| 3340 |
'@rollup/plugin-json': 6.1.0([email protected])
|
| 3341 |
'@rollup/plugin-node-resolve': 16.0.0([email protected])
|
| 3342 |
+
'@sveltejs/kit': 2.18.0(@sveltejs/[email protected](svelte@5.30.1)([email protected](@types/[email protected])([email protected])))(svelte@5.30.1)([email protected](@types/[email protected])([email protected]))
|
| 3343 |
rollup: 4.34.9
|
| 3344 |
|
| 3345 |
+
'@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.30.1)([email protected](@types/[email protected])([email protected])))(svelte@5.30.1)([email protected](@types/[email protected])([email protected]))':
|
| 3346 |
dependencies:
|
| 3347 |
+
'@sveltejs/vite-plugin-svelte': 4.0.4(svelte@5.30.1)([email protected](@types/[email protected])([email protected]))
|
| 3348 |
'@types/cookie': 0.6.0
|
| 3349 |
cookie: 0.6.0
|
| 3350 |
devalue: 5.1.1
|
|
|
|
| 3356 |
sade: 1.8.1
|
| 3357 |
set-cookie-parser: 2.7.1
|
| 3358 |
sirv: 3.0.1
|
| 3359 |
+
svelte: 5.30.1
|
| 3360 |
vite: 5.4.14(@types/[email protected])([email protected])
|
| 3361 |
|
| 3362 |
+
'@sveltejs/[email protected](@sveltejs/[email protected](svelte@5.30.1)([email protected](@types/[email protected])([email protected])))(svelte@5.30.1)([email protected](@types/[email protected])([email protected]))':
|
| 3363 |
dependencies:
|
| 3364 |
+
'@sveltejs/vite-plugin-svelte': 4.0.4(svelte@5.30.1)([email protected](@types/[email protected])([email protected]))
|
| 3365 |
debug: 4.4.0
|
| 3366 |
+
svelte: 5.30.1
|
| 3367 |
vite: 5.4.14(@types/[email protected])([email protected])
|
| 3368 |
transitivePeerDependencies:
|
| 3369 |
- supports-color
|
| 3370 |
|
| 3371 |
+
'@sveltejs/[email protected](svelte@5.30.1)([email protected](@types/[email protected])([email protected]))':
|
| 3372 |
dependencies:
|
| 3373 |
+
'@sveltejs/vite-plugin-svelte-inspector': 3.0.1(@sveltejs/[email protected](svelte@5.30.1)([email protected](@types/[email protected])([email protected])))(svelte@5.30.1)([email protected](@types/[email protected])([email protected]))
|
| 3374 |
debug: 4.4.0
|
| 3375 |
deepmerge: 4.3.1
|
| 3376 |
kleur: 4.1.5
|
| 3377 |
magic-string: 0.30.17
|
| 3378 |
+
svelte: 5.30.1
|
| 3379 |
vite: 5.4.14(@types/[email protected])([email protected])
|
| 3380 |
vitefu: 1.0.6([email protected](@types/[email protected])([email protected]))
|
| 3381 |
transitivePeerDependencies:
|
|
|
|
| 3846 |
|
| 3847 | |
| 3848 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3849 | |
| 3850 |
dependencies:
|
| 3851 |
eslint: 9.22.0([email protected])
|
|
|
|
| 3859 |
optionalDependencies:
|
| 3860 |
eslint-config-prettier: 10.1.1([email protected]([email protected]))
|
| 3861 |
|
| 3862 |
+
eslint-plugin-svelte@3.6.0([email protected]([email protected]))(svelte@5.30.1):
|
| 3863 |
dependencies:
|
| 3864 |
'@eslint-community/eslint-utils': 4.4.1([email protected]([email protected]))
|
| 3865 |
'@jridgewell/sourcemap-codec': 1.5.0
|
| 3866 |
eslint: 9.22.0([email protected])
|
|
|
|
| 3867 |
esutils: 2.0.3
|
| 3868 |
+
known-css-properties: 0.36.0
|
| 3869 |
postcss: 8.5.3
|
| 3870 |
postcss-load-config: 3.1.4([email protected])
|
| 3871 |
postcss-safe-parser: 7.0.1([email protected])
|
| 3872 |
semver: 7.7.1
|
| 3873 |
+
svelte-eslint-parser: 1.2.0(svelte@5.30.1)
|
| 3874 |
optionalDependencies:
|
| 3875 |
+
svelte: 5.30.1
|
| 3876 |
transitivePeerDependencies:
|
| 3877 |
- ts-node
|
| 3878 |
|
|
|
|
| 4246 |
|
| 4247 | |
| 4248 |
|
| 4249 |
+
known-css-properties@0.36.0: {}
|
| 4250 |
|
| 4251 | |
| 4252 |
|
|
|
|
| 4347 |
unist-util-visit: 5.0.0
|
| 4348 |
vfile: 6.0.3
|
| 4349 |
|
| 4350 |
+
[email protected](@floating-ui/[email protected])(svelte@5.30.1):
|
| 4351 |
dependencies:
|
| 4352 |
'@floating-ui/dom': 1.6.13
|
| 4353 |
dequal: 2.0.3
|
| 4354 |
jest-axe: 9.0.0
|
| 4355 |
nanoid: 5.1.5
|
| 4356 |
+
runed: 0.23.4(svelte@5.30.1)
|
| 4357 |
+
svelte: 5.30.1
|
| 4358 |
|
| 4359 | |
| 4360 |
|
|
|
|
| 4590 |
dependencies:
|
| 4591 |
fast-diff: 1.3.0
|
| 4592 |
|
| 4593 |
+
prettier-plugin-svelte@3.4.0([email protected])(svelte@5.30.1):
|
| 4594 |
dependencies:
|
| 4595 |
prettier: 3.5.3
|
| 4596 |
+
svelte: 5.30.1
|
| 4597 |
|
| 4598 |
+
[email protected](prettier-plugin-svelte@3.4.0([email protected])(svelte@5.30.1))([email protected]):
|
| 4599 |
dependencies:
|
| 4600 |
prettier: 3.5.3
|
| 4601 |
optionalDependencies:
|
| 4602 |
+
prettier-plugin-svelte: 3.4.0([email protected])(svelte@5.30.1)
|
| 4603 |
|
| 4604 | |
| 4605 |
|
|
|
|
| 4716 |
dependencies:
|
| 4717 |
queue-microtask: 1.2.3
|
| 4718 |
|
| 4719 |
+
[email protected](svelte@5.30.1):
|
| 4720 |
dependencies:
|
| 4721 |
esm-env: 1.2.2
|
| 4722 |
+
svelte: 5.30.1
|
| 4723 |
|
| 4724 |
+
[email protected](svelte@5.30.1):
|
| 4725 |
dependencies:
|
| 4726 |
esm-env: 1.2.2
|
| 4727 |
+
svelte: 5.30.1
|
| 4728 |
|
| 4729 | |
| 4730 |
dependencies:
|
|
|
|
| 4828 |
|
| 4829 | |
| 4830 |
|
| 4831 |
+
[email protected]([email protected])(svelte@5.30.1)([email protected]):
|
| 4832 |
dependencies:
|
| 4833 |
'@jridgewell/trace-mapping': 0.3.25
|
| 4834 |
chokidar: 4.0.3
|
| 4835 |
fdir: 6.4.3([email protected])
|
| 4836 |
picocolors: 1.1.1
|
| 4837 |
sade: 1.8.1
|
| 4838 |
+
svelte: 5.30.1
|
| 4839 |
typescript: 5.8.2
|
| 4840 |
transitivePeerDependencies:
|
| 4841 |
- picomatch
|
| 4842 |
|
| 4843 |
+
svelte-eslint-parser@1.2.0(svelte@5.30.1):
|
| 4844 |
dependencies:
|
| 4845 |
eslint-scope: 8.3.0
|
| 4846 |
eslint-visitor-keys: 4.2.0
|
|
|
|
| 4849 |
postcss-scss: 4.0.9([email protected])
|
| 4850 |
postcss-selector-parser: 7.1.0
|
| 4851 |
optionalDependencies:
|
| 4852 |
+
svelte: 5.30.1
|
| 4853 |
|
| 4854 |
+
svelte@5.30.1:
|
| 4855 |
dependencies:
|
| 4856 |
'@ampproject/remapping': 2.3.0
|
| 4857 |
'@jridgewell/sourcemap-codec': 1.5.0
|
|
|
|
| 4992 |
unist-util-is: 6.0.0
|
| 4993 |
unist-util-visit-parents: 6.0.1
|
| 4994 |
|
| 4995 |
+
[email protected](svelte@5.30.1):
|
| 4996 |
dependencies:
|
| 4997 |
'@antfu/install-pkg': 1.0.0
|
| 4998 |
'@iconify/utils': 2.3.0
|
|
|
|
| 5000 |
local-pkg: 1.1.1
|
| 5001 |
unplugin: 2.2.0
|
| 5002 |
optionalDependencies:
|
| 5003 |
+
svelte: 5.30.1
|
| 5004 |
transitivePeerDependencies:
|
| 5005 |
- supports-color
|
| 5006 |
|
src/lib/actions/autofocus.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
import { tick } from "svelte";
|
| 2 |
-
|
| 3 |
-
export function autofocus(node: HTMLElement, enabled = true) {
|
| 4 |
-
function update(enabled = true) {
|
| 5 |
-
if (enabled) {
|
| 6 |
-
tick().then(() => {
|
| 7 |
-
node.focus();
|
| 8 |
-
});
|
| 9 |
-
}
|
| 10 |
-
}
|
| 11 |
-
update(enabled);
|
| 12 |
-
|
| 13 |
-
return { update };
|
| 14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/lib/actions/click-outside.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
| 1 |
-
import type { Action } from "svelte/action";
|
| 2 |
-
|
| 3 |
-
export const clickOutside: Action<HTMLElement, () => void> = (node, callback) => {
|
| 4 |
-
let _callback = callback;
|
| 5 |
-
|
| 6 |
-
function update(newCallback: () => void) {
|
| 7 |
-
_callback = newCallback;
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
function handleClick(event: MouseEvent) {
|
| 11 |
-
if (window.getSelection()?.toString()) {
|
| 12 |
-
// Don't close if text is selected
|
| 13 |
-
return;
|
| 14 |
-
}
|
| 15 |
-
|
| 16 |
-
// For dialog elements, check if click was on the backdrop
|
| 17 |
-
if (node instanceof HTMLDialogElement) {
|
| 18 |
-
const rect = node.getBoundingClientRect();
|
| 19 |
-
const isInDialog =
|
| 20 |
-
event.clientX >= rect.left &&
|
| 21 |
-
event.clientX <= rect.right &&
|
| 22 |
-
event.clientY >= rect.top &&
|
| 23 |
-
event.clientY <= rect.bottom;
|
| 24 |
-
|
| 25 |
-
if (!isInDialog) {
|
| 26 |
-
_callback();
|
| 27 |
-
return;
|
| 28 |
-
}
|
| 29 |
-
}
|
| 30 |
-
|
| 31 |
-
// For non-dialog elements, use the standard contains check
|
| 32 |
-
if (!node.contains(event.target as Node) && !event.defaultPrevented) {
|
| 33 |
-
_callback();
|
| 34 |
-
}
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
// For dialogs, listen on the element itself
|
| 38 |
-
if (node instanceof HTMLDialogElement) {
|
| 39 |
-
node.addEventListener("click", handleClick);
|
| 40 |
-
} else {
|
| 41 |
-
// For other elements, listen on the document
|
| 42 |
-
document.addEventListener("click", handleClick, true);
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
return {
|
| 46 |
-
update,
|
| 47 |
-
destroy() {
|
| 48 |
-
if (node instanceof HTMLDialogElement) {
|
| 49 |
-
node.removeEventListener("click", handleClick);
|
| 50 |
-
} else {
|
| 51 |
-
document.removeEventListener("click", handleClick, true);
|
| 52 |
-
}
|
| 53 |
-
},
|
| 54 |
-
};
|
| 55 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/lib/attachments/autofocus.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { tick } from "svelte";
|
| 2 |
+
import type { Attachment } from "svelte/attachments";
|
| 3 |
+
|
| 4 |
+
export function autofocus(enabled = true): Attachment<HTMLElement> {
|
| 5 |
+
return node => {
|
| 6 |
+
if (!enabled) return;
|
| 7 |
+
|
| 8 |
+
tick().then(() => {
|
| 9 |
+
node.focus();
|
| 10 |
+
});
|
| 11 |
+
};
|
| 12 |
+
}
|
src/lib/attachments/click-outside.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Attachment } from "svelte/attachments";
|
| 2 |
+
|
| 3 |
+
export function clickOutside(callback: () => void): Attachment {
|
| 4 |
+
return node => {
|
| 5 |
+
function handleClick(event: MouseEvent) {
|
| 6 |
+
if (window.getSelection()?.toString()) {
|
| 7 |
+
// Don't close if text is selected
|
| 8 |
+
return;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
// For dialog elements, check if click was on the backdrop
|
| 12 |
+
if (node instanceof HTMLDialogElement) {
|
| 13 |
+
const rect = node.getBoundingClientRect();
|
| 14 |
+
const isInDialog =
|
| 15 |
+
event.clientX >= rect.left &&
|
| 16 |
+
event.clientX <= rect.right &&
|
| 17 |
+
event.clientY >= rect.top &&
|
| 18 |
+
event.clientY <= rect.bottom;
|
| 19 |
+
|
| 20 |
+
if (!isInDialog) {
|
| 21 |
+
callback();
|
| 22 |
+
return;
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
// For non-dialog elements, use the standard contains check
|
| 27 |
+
if (!node.contains(event.target as Node) && !event.defaultPrevented) {
|
| 28 |
+
callback();
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// For dialogs, listen on the element itself
|
| 33 |
+
if (node instanceof HTMLDialogElement) {
|
| 34 |
+
node.addEventListener("click", handleClick);
|
| 35 |
+
} else {
|
| 36 |
+
// For other elements, listen on the document
|
| 37 |
+
document.addEventListener("click", handleClick, true);
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
return () => {
|
| 41 |
+
if (node instanceof HTMLDialogElement) {
|
| 42 |
+
node.removeEventListener("click", handleClick);
|
| 43 |
+
} else {
|
| 44 |
+
document.removeEventListener("click", handleClick, true);
|
| 45 |
+
}
|
| 46 |
+
};
|
| 47 |
+
};
|
| 48 |
+
}
|
src/lib/{actions → attachments}/observe.svelte.ts
RENAMED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
import
|
|
|
|
| 2 |
|
| 3 |
export enum ObservedElements {
|
| 4 |
BottomActions = "bottom-actions",
|
|
@@ -55,6 +56,7 @@ export const observed: Record<ObservedElements, ObservedData> = $state(
|
|
| 55 |
|
| 56 |
type ObserveArgs = {
|
| 57 |
name: ObservedElements;
|
|
|
|
| 58 |
};
|
| 59 |
|
| 60 |
function getOffsetPosition(el: HTMLElement) {
|
|
@@ -72,42 +74,42 @@ function getOffsetPosition(el: HTMLElement) {
|
|
| 72 |
return { top, left, width, height, right: left + width, bottom: top + height };
|
| 73 |
}
|
| 74 |
|
| 75 |
-
export
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
}
|
| 101 |
-
}
|
| 102 |
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
resizeObserver.disconnect();
|
| 106 |
}
|
| 107 |
|
| 108 |
-
|
|
|
|
| 109 |
setVars(args.name);
|
| 110 |
});
|
|
|
|
| 111 |
resizeObserver.observe(node);
|
| 112 |
|
| 113 |
// Listen for scroll and resize events
|
|
@@ -115,22 +117,16 @@ export const observe: Action<HTMLElement, ObserveArgs> = (node, args) => {
|
|
| 115 |
window.addEventListener("resize", onWindowChange, true);
|
| 116 |
|
| 117 |
setVars(args.name); // Initial set after observing
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
update(args); // Initial setup
|
| 125 |
-
|
| 126 |
-
function destroy() {
|
| 127 |
-
resizeObserver.disconnect();
|
| 128 |
-
window.removeEventListener("scroll", onWindowChange, true);
|
| 129 |
-
window.removeEventListener("resize", onWindowChange, true);
|
| 130 |
-
}
|
| 131 |
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
|
|
|
|
|
|
| 135 |
};
|
| 136 |
-
}
|
|
|
|
| 1 |
+
import { AnimationFrames } from "runed";
|
| 2 |
+
import type { Attachment } from "svelte/attachments";
|
| 3 |
|
| 4 |
export enum ObservedElements {
|
| 5 |
BottomActions = "bottom-actions",
|
|
|
|
| 56 |
|
| 57 |
type ObserveArgs = {
|
| 58 |
name: ObservedElements;
|
| 59 |
+
useRaf?: boolean;
|
| 60 |
};
|
| 61 |
|
| 62 |
function getOffsetPosition(el: HTMLElement) {
|
|
|
|
| 74 |
return { top, left, width, height, right: left + width, bottom: top + height };
|
| 75 |
}
|
| 76 |
|
| 77 |
+
export function observe(args: ObserveArgs): Attachment<HTMLElement> {
|
| 78 |
+
return node => {
|
| 79 |
+
function setVars(name: ObservedElements) {
|
| 80 |
+
// 1. Standard rect (includes transforms)
|
| 81 |
+
const rect = node.getBoundingClientRect();
|
| 82 |
+
document.documentElement.style.setProperty(`--${name}-width`, `${rect.width}px`);
|
| 83 |
+
document.documentElement.style.setProperty(`--${name}-height`, `${rect.height}px`);
|
| 84 |
+
document.documentElement.style.setProperty(`--${name}-top`, `${rect.top}px`);
|
| 85 |
+
document.documentElement.style.setProperty(`--${name}-left`, `${rect.left}px`);
|
| 86 |
+
document.documentElement.style.setProperty(`--${name}-right`, `${rect.right}px`);
|
| 87 |
+
document.documentElement.style.setProperty(`--${name}-bottom`, `${rect.bottom}px`);
|
| 88 |
+
|
| 89 |
+
// 2. Offset position (ignores transforms)
|
| 90 |
+
const offset = getOffsetPosition(node);
|
| 91 |
+
document.documentElement.style.setProperty(`--${name}-width-offset`, `${offset.width}px`);
|
| 92 |
+
document.documentElement.style.setProperty(`--${name}-height-offset`, `${offset.height}px`);
|
| 93 |
+
document.documentElement.style.setProperty(`--${name}-top-offset`, `${offset.top}px`);
|
| 94 |
+
document.documentElement.style.setProperty(`--${name}-left-offset`, `${offset.left}px`);
|
| 95 |
+
document.documentElement.style.setProperty(`--${name}-right-offset`, `${offset.right}px`);
|
| 96 |
+
document.documentElement.style.setProperty(`--${name}-bottom-offset`, `${offset.bottom}px`);
|
| 97 |
+
|
| 98 |
+
observed[name] = {
|
| 99 |
+
rect,
|
| 100 |
+
offset,
|
| 101 |
+
};
|
| 102 |
+
}
|
|
|
|
| 103 |
|
| 104 |
+
function onWindowChange() {
|
| 105 |
+
setVars(args.name);
|
|
|
|
| 106 |
}
|
| 107 |
|
| 108 |
+
/** Initialize */
|
| 109 |
+
const resizeObserver = new ResizeObserver(() => {
|
| 110 |
setVars(args.name);
|
| 111 |
});
|
| 112 |
+
|
| 113 |
resizeObserver.observe(node);
|
| 114 |
|
| 115 |
// Listen for scroll and resize events
|
|
|
|
| 117 |
window.addEventListener("resize", onWindowChange, true);
|
| 118 |
|
| 119 |
setVars(args.name); // Initial set after observing
|
| 120 |
+
if (args.useRaf) {
|
| 121 |
+
new AnimationFrames(() => {
|
| 122 |
+
setVars(args.name);
|
| 123 |
+
});
|
| 124 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
+
return function destroy() {
|
| 127 |
+
resizeObserver.disconnect();
|
| 128 |
+
window.removeEventListener("scroll", onWindowChange, true);
|
| 129 |
+
window.removeEventListener("resize", onWindowChange, true);
|
| 130 |
+
};
|
| 131 |
};
|
| 132 |
+
}
|
src/lib/components/dialog.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import { clickOutside } from "$lib/
|
| 3 |
import type { Snippet } from "svelte";
|
| 4 |
import type { EventHandler } from "svelte/elements";
|
| 5 |
import IconCross from "~icons/carbon/close";
|
|
@@ -29,7 +29,10 @@
|
|
| 29 |
<dialog bind:this={dialog} onclose={onClose}>
|
| 30 |
{#if open}
|
| 31 |
<form class="fixed inset-0 z-50 flex items-center justify-center overflow-hidden bg-black/85" onsubmit={onSubmit}>
|
| 32 |
-
<div
|
|
|
|
|
|
|
|
|
|
| 33 |
<div class="flex items-center justify-between rounded-t border-b p-4 md:px-5 md:py-4 dark:border-gray-800">
|
| 34 |
{#if typeof title === "string"}
|
| 35 |
<h3 class="flex items-center gap-2.5 text-lg font-semibold text-gray-900 dark:text-white">
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import { clickOutside } from "$lib/attachments/click-outside.js";
|
| 3 |
import type { Snippet } from "svelte";
|
| 4 |
import type { EventHandler } from "svelte/elements";
|
| 5 |
import IconCross from "~icons/carbon/close";
|
|
|
|
| 29 |
<dialog bind:this={dialog} onclose={onClose}>
|
| 30 |
{#if open}
|
| 31 |
<form class="fixed inset-0 z-50 flex items-center justify-center overflow-hidden bg-black/85" onsubmit={onSubmit}>
|
| 32 |
+
<div
|
| 33 |
+
class="relative w-xl rounded-xl bg-white shadow-sm dark:bg-gray-900"
|
| 34 |
+
{@attach clickOutside(() => onClose?.())}
|
| 35 |
+
>
|
| 36 |
<div class="flex items-center justify-between rounded-t border-b p-4 md:px-5 md:py-4 dark:border-gray-800">
|
| 37 |
{#if typeof title === "string"}
|
| 38 |
<h3 class="flex items-center gap-2.5 text-lg font-semibold text-gray-900 dark:text-white">
|
src/lib/components/inference-playground/checkpoints-menu.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import { clickOutside } from "$lib/
|
| 3 |
import { checkpoints } from "$lib/state/checkpoints.svelte";
|
| 4 |
import { projects } from "$lib/state/projects.svelte";
|
| 5 |
import { iterate } from "$lib/utils/array.js";
|
|
@@ -37,7 +37,7 @@
|
|
| 37 |
<dialog
|
| 38 |
bind:this={dialog}
|
| 39 |
class="mb-2 !overflow-visible rounded-xl border border-gray-200 bg-white shadow-lg dark:border-gray-700 dark:bg-gray-800"
|
| 40 |
-
|
| 41 |
{...popover.content}
|
| 42 |
>
|
| 43 |
<div
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import { clickOutside } from "$lib/attachments/click-outside.js";
|
| 3 |
import { checkpoints } from "$lib/state/checkpoints.svelte";
|
| 4 |
import { projects } from "$lib/state/projects.svelte";
|
| 5 |
import { iterate } from "$lib/utils/array.js";
|
|
|
|
| 37 |
<dialog
|
| 38 |
bind:this={dialog}
|
| 39 |
class="mb-2 !overflow-visible rounded-xl border border-gray-200 bg-white shadow-lg dark:border-gray-700 dark:bg-gray-800"
|
| 40 |
+
{@attach clickOutside(() => (popover.open = false))}
|
| 41 |
{...popover.content}
|
| 42 |
>
|
| 43 |
<div
|
src/lib/components/inference-playground/custom-model-config.svelte
CHANGED
|
@@ -20,8 +20,8 @@
|
|
| 20 |
</script>
|
| 21 |
|
| 22 |
<script lang="ts">
|
| 23 |
-
import { autofocus } from "$lib/
|
| 24 |
-
import { clickOutside } from "$lib/
|
| 25 |
import { models } from "$lib/state/models.svelte";
|
| 26 |
import { PipelineTag, pipelineTagLabel, type Conversation, type CustomModel } from "$lib/types.js";
|
| 27 |
import { createFieldValidation } from "$lib/utils/form.svelte.js";
|
|
@@ -140,7 +140,7 @@
|
|
| 140 |
<!-- Content -->
|
| 141 |
<form
|
| 142 |
class="relative w-xl rounded-xl bg-white shadow-sm dark:bg-gray-900"
|
| 143 |
-
|
| 144 |
transition:scale={{ start: 0.975, duration: 250 }}
|
| 145 |
{onsubmit}
|
| 146 |
>
|
|
@@ -166,12 +166,12 @@
|
|
| 166 |
Model ID <span class="text-red-800 dark:text-red-300">*</span>
|
| 167 |
</p>
|
| 168 |
<input
|
| 169 |
-
use:autofocus
|
| 170 |
bind:value={model.id}
|
| 171 |
required
|
| 172 |
placeholder="e.g. mistralai/mistral-large-2407"
|
| 173 |
type="text"
|
| 174 |
class="input block w-full"
|
|
|
|
| 175 |
/>
|
| 176 |
</label>
|
| 177 |
<label class="flex flex-col gap-2">
|
|
|
|
| 20 |
</script>
|
| 21 |
|
| 22 |
<script lang="ts">
|
| 23 |
+
import { autofocus } from "$lib/attachments/autofocus.js";
|
| 24 |
+
import { clickOutside } from "$lib/attachments/click-outside.js";
|
| 25 |
import { models } from "$lib/state/models.svelte";
|
| 26 |
import { PipelineTag, pipelineTagLabel, type Conversation, type CustomModel } from "$lib/types.js";
|
| 27 |
import { createFieldValidation } from "$lib/utils/form.svelte.js";
|
|
|
|
| 140 |
<!-- Content -->
|
| 141 |
<form
|
| 142 |
class="relative w-xl rounded-xl bg-white shadow-sm dark:bg-gray-900"
|
| 143 |
+
{@attach clickOutside(() => close())}
|
| 144 |
transition:scale={{ start: 0.975, duration: 250 }}
|
| 145 |
{onsubmit}
|
| 146 |
>
|
|
|
|
| 166 |
Model ID <span class="text-red-800 dark:text-red-300">*</span>
|
| 167 |
</p>
|
| 168 |
<input
|
|
|
|
| 169 |
bind:value={model.id}
|
| 170 |
required
|
| 171 |
placeholder="e.g. mistralai/mistral-large-2407"
|
| 172 |
type="text"
|
| 173 |
class="input block w-full"
|
| 174 |
+
{@attach autofocus()}
|
| 175 |
/>
|
| 176 |
</label>
|
| 177 |
<label class="flex flex-col gap-2">
|
src/lib/components/inference-playground/hf-token-modal.svelte
CHANGED
|
@@ -2,11 +2,11 @@
|
|
| 2 |
import { createBubbler, preventDefault } from "svelte/legacy";
|
| 3 |
|
| 4 |
const bubble = createBubbler();
|
| 5 |
-
import { clickOutside } from "$lib/
|
| 6 |
import { createEventDispatcher, onDestroy, onMount } from "svelte";
|
| 7 |
|
| 8 |
import IconCross from "~icons/carbon/close";
|
| 9 |
-
import { autofocus } from "$lib/
|
| 10 |
|
| 11 |
interface Props {
|
| 12 |
storeLocallyHfToken?: boolean;
|
|
@@ -51,7 +51,7 @@
|
|
| 51 |
class="relative max-h-full w-full max-w-xl p-4 outline-hidden"
|
| 52 |
bind:this={modalEl}
|
| 53 |
onkeydown={handleKeydown}
|
| 54 |
-
|
| 55 |
>
|
| 56 |
<form onsubmit={preventDefault(bubble("submit"))} class="relative rounded-lg bg-white shadow-sm dark:bg-gray-900">
|
| 57 |
<div class="flex items-center justify-between rounded-t border-b p-4 md:px-5 md:py-4 dark:border-gray-800">
|
|
@@ -85,13 +85,13 @@
|
|
| 85 |
Hugging Face Token
|
| 86 |
</label>
|
| 87 |
<input
|
| 88 |
-
use:autofocus
|
| 89 |
required
|
| 90 |
placeholder="Enter HF Token"
|
| 91 |
type="text"
|
| 92 |
id="hf-token"
|
| 93 |
name="hf-token"
|
| 94 |
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
|
|
|
|
| 95 |
/>
|
| 96 |
</div>
|
| 97 |
<label class="mt-4 flex items-center gap-x-1.5 text-gray-900 dark:text-gray-200">
|
|
|
|
| 2 |
import { createBubbler, preventDefault } from "svelte/legacy";
|
| 3 |
|
| 4 |
const bubble = createBubbler();
|
| 5 |
+
import { clickOutside } from "$lib/attachments/click-outside.js";
|
| 6 |
import { createEventDispatcher, onDestroy, onMount } from "svelte";
|
| 7 |
|
| 8 |
import IconCross from "~icons/carbon/close";
|
| 9 |
+
import { autofocus } from "$lib/attachments/autofocus.js";
|
| 10 |
|
| 11 |
interface Props {
|
| 12 |
storeLocallyHfToken?: boolean;
|
|
|
|
| 51 |
class="relative max-h-full w-full max-w-xl p-4 outline-hidden"
|
| 52 |
bind:this={modalEl}
|
| 53 |
onkeydown={handleKeydown}
|
| 54 |
+
{@attach clickOutside(() => dispatch("close"))}
|
| 55 |
>
|
| 56 |
<form onsubmit={preventDefault(bubble("submit"))} class="relative rounded-lg bg-white shadow-sm dark:bg-gray-900">
|
| 57 |
<div class="flex items-center justify-between rounded-t border-b p-4 md:px-5 md:py-4 dark:border-gray-800">
|
|
|
|
| 85 |
Hugging Face Token
|
| 86 |
</label>
|
| 87 |
<input
|
|
|
|
| 88 |
required
|
| 89 |
placeholder="Enter HF Token"
|
| 90 |
type="text"
|
| 91 |
id="hf-token"
|
| 92 |
name="hf-token"
|
| 93 |
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
|
| 94 |
+
{@attach autofocus()}
|
| 95 |
/>
|
| 96 |
</div>
|
| 97 |
<label class="mt-4 flex items-center gap-x-1.5 text-gray-900 dark:text-gray-200">
|
src/lib/components/inference-playground/img-preview.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import { clickOutside } from "$lib/
|
| 3 |
import { fade, scale } from "svelte/transition";
|
| 4 |
import IconCross from "~icons/carbon/close";
|
| 5 |
|
|
@@ -39,7 +39,7 @@
|
|
| 39 |
class="max-h-[calc(100vh-120px)] max-w-[calc(100vw-120px)] object-contain"
|
| 40 |
src={img}
|
| 41 |
alt=""
|
| 42 |
-
|
| 43 |
transition:scale={{ start: 0.975, duration: 250 }}
|
| 44 |
/>
|
| 45 |
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import { clickOutside } from "$lib/attachments/click-outside.js";
|
| 3 |
import { fade, scale } from "svelte/transition";
|
| 4 |
import IconCross from "~icons/carbon/close";
|
| 5 |
|
|
|
|
| 39 |
class="max-h-[calc(100vh-120px)] max-w-[calc(100vw-120px)] object-contain"
|
| 40 |
src={img}
|
| 41 |
alt=""
|
| 42 |
+
{@attach clickOutside(() => (img = undefined))}
|
| 43 |
transition:scale={{ start: 0.975, duration: 250 }}
|
| 44 |
/>
|
| 45 |
|
src/lib/components/inference-playground/message.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import { autofocus as autofocusAction } from "$lib/
|
| 3 |
import Tooltip from "$lib/components/tooltip.svelte";
|
| 4 |
import { TextareaAutosize } from "$lib/spells/textarea-autosize.svelte.js";
|
| 5 |
import { type ConversationClass } from "$lib/state/conversations.svelte.js";
|
|
@@ -51,7 +51,6 @@
|
|
| 51 |
}
|
| 52 |
|
| 53 |
fileQueue.add(async () => {
|
| 54 |
-
console.log("queue item start");
|
| 55 |
const key = await images.upload(file);
|
| 56 |
|
| 57 |
const prev = message.images ?? [];
|
|
@@ -59,7 +58,6 @@
|
|
| 59 |
// We're dealing with files ourselves, so we don't want fileUpload to have any internal state,
|
| 60 |
// to avoid conflicts
|
| 61 |
if (fileQueue.queue.length <= 1) fileUpload.clear();
|
| 62 |
-
console.log("queue item end");
|
| 63 |
});
|
| 64 |
},
|
| 65 |
disabled: () => !canUploadImgs,
|
|
@@ -102,7 +100,6 @@
|
|
| 102 |
<div class="flex w-full gap-4">
|
| 103 |
<textarea
|
| 104 |
bind:this={element}
|
| 105 |
-
use:autofocusAction={autofocus}
|
| 106 |
value={message?.content}
|
| 107 |
onchange={e => {
|
| 108 |
const el = e.target as HTMLTextAreaElement;
|
|
@@ -114,6 +111,7 @@
|
|
| 114 |
class="grow resize-none overflow-hidden rounded-lg bg-transparent px-2 py-2.5 ring-gray-100 outline-none group-hover/message:ring-3 hover:bg-white focus:bg-white focus:ring-3 @2xl:px-3 dark:ring-gray-600 dark:hover:bg-gray-900 dark:focus:bg-gray-900"
|
| 115 |
rows="1"
|
| 116 |
data-message
|
|
|
|
| 117 |
></textarea>
|
| 118 |
|
| 119 |
<!-- Sticky wrapper for action buttons -->
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import { autofocus as autofocusAction } from "$lib/attachments/autofocus.js";
|
| 3 |
import Tooltip from "$lib/components/tooltip.svelte";
|
| 4 |
import { TextareaAutosize } from "$lib/spells/textarea-autosize.svelte.js";
|
| 5 |
import { type ConversationClass } from "$lib/state/conversations.svelte.js";
|
|
|
|
| 51 |
}
|
| 52 |
|
| 53 |
fileQueue.add(async () => {
|
|
|
|
| 54 |
const key = await images.upload(file);
|
| 55 |
|
| 56 |
const prev = message.images ?? [];
|
|
|
|
| 58 |
// We're dealing with files ourselves, so we don't want fileUpload to have any internal state,
|
| 59 |
// to avoid conflicts
|
| 60 |
if (fileQueue.queue.length <= 1) fileUpload.clear();
|
|
|
|
| 61 |
});
|
| 62 |
},
|
| 63 |
disabled: () => !canUploadImgs,
|
|
|
|
| 100 |
<div class="flex w-full gap-4">
|
| 101 |
<textarea
|
| 102 |
bind:this={element}
|
|
|
|
| 103 |
value={message?.content}
|
| 104 |
onchange={e => {
|
| 105 |
const el = e.target as HTMLTextAreaElement;
|
|
|
|
| 111 |
class="grow resize-none overflow-hidden rounded-lg bg-transparent px-2 py-2.5 ring-gray-100 outline-none group-hover/message:ring-3 hover:bg-white focus:bg-white focus:ring-3 @2xl:px-3 dark:ring-gray-600 dark:hover:bg-gray-900 dark:focus:bg-gray-900"
|
| 112 |
rows="1"
|
| 113 |
data-message
|
| 114 |
+
{@attach autofocusAction(autofocus)}
|
| 115 |
></textarea>
|
| 116 |
|
| 117 |
<!-- Sticky wrapper for action buttons -->
|
src/lib/components/inference-playground/model-selector-modal.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import { autofocus } from "$lib/
|
| 3 |
import type { ConversationClass } from "$lib/state/conversations.svelte";
|
| 4 |
import { models } from "$lib/state/models.svelte.js";
|
| 5 |
import type { CustomModel, Model } from "$lib/types.js";
|
|
@@ -81,10 +81,10 @@
|
|
| 81 |
</div>
|
| 82 |
<input
|
| 83 |
{...combobox.input}
|
| 84 |
-
use:autofocus
|
| 85 |
class="flex h-10 w-full rounded-md bg-transparent py-3 text-sm placeholder-gray-400 outline-hidden"
|
| 86 |
placeholder="Search models ..."
|
| 87 |
bind:value={query}
|
|
|
|
| 88 |
/>
|
| 89 |
</div>
|
| 90 |
<div
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import { autofocus } from "$lib/attachments/autofocus.js";
|
| 3 |
import type { ConversationClass } from "$lib/state/conversations.svelte";
|
| 4 |
import { models } from "$lib/state/models.svelte.js";
|
| 5 |
import type { CustomModel, Model } from "$lib/types.js";
|
|
|
|
| 81 |
</div>
|
| 82 |
<input
|
| 83 |
{...combobox.input}
|
|
|
|
| 84 |
class="flex h-10 w-full rounded-md bg-transparent py-3 text-sm placeholder-gray-400 outline-hidden"
|
| 85 |
placeholder="Search models ..."
|
| 86 |
bind:value={query}
|
| 87 |
+
{@attach autofocus()}
|
| 88 |
/>
|
| 89 |
</div>
|
| 90 |
<div
|
src/lib/components/inference-playground/playground.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import { observe, observed, ObservedElements } from "$lib/
|
| 3 |
import { token } from "$lib/state/token.svelte.js";
|
| 4 |
import { cmdOrCtrl, optOrAlt } from "$lib/utils/platform.js";
|
| 5 |
import { Popover } from "melt/components";
|
|
@@ -170,9 +170,13 @@
|
|
| 170 |
{@const tceRight = observed["token-count-end"].offset.right}
|
| 171 |
<span
|
| 172 |
style:translate={isLast ? (baLeft - 12 < tceRight ? baLeft - tceRight - 12 + "px" : "") : undefined}
|
| 173 |
-
|
| 174 |
-
|
|
|
|
|
|
|
| 175 |
>
|
|
|
|
|
|
|
| 176 |
{/each}
|
| 177 |
</div>
|
| 178 |
<div class="flex flex-1 justify-end gap-x-2">
|
|
@@ -180,7 +184,7 @@
|
|
| 180 |
type="button"
|
| 181 |
onclick={() => (viewCode = !viewCode)}
|
| 182 |
class="btn"
|
| 183 |
-
|
| 184 |
>
|
| 185 |
<IconCode />
|
| 186 |
{!viewCode ? "View Code" : "Hide Code"}
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import { observe, observed, ObservedElements } from "$lib/attachments/observe.svelte.js";
|
| 3 |
import { token } from "$lib/state/token.svelte.js";
|
| 4 |
import { cmdOrCtrl, optOrAlt } from "$lib/utils/platform.js";
|
| 5 |
import { Popover } from "melt/components";
|
|
|
|
| 170 |
{@const tceRight = observed["token-count-end"].offset.right}
|
| 171 |
<span
|
| 172 |
style:translate={isLast ? (baLeft - 12 < tceRight ? baLeft - tceRight - 12 + "px" : "") : undefined}
|
| 173 |
+
{@attach observe({
|
| 174 |
+
name: isLast ? ObservedElements.TokenCountEnd : ObservedElements.TokenCountStart,
|
| 175 |
+
useRaf: true,
|
| 176 |
+
})}
|
| 177 |
>
|
| 178 |
+
{tokens} tokens · Latency {latency}ms
|
| 179 |
+
</span>
|
| 180 |
{/each}
|
| 181 |
</div>
|
| 182 |
<div class="flex flex-1 justify-end gap-x-2">
|
|
|
|
| 184 |
type="button"
|
| 185 |
onclick={() => (viewCode = !viewCode)}
|
| 186 |
class="btn"
|
| 187 |
+
{@attach observe({ name: ObservedElements.BottomActions, useRaf: true })}
|
| 188 |
>
|
| 189 |
<IconCode />
|
| 190 |
{!viewCode ? "View Code" : "Hide Code"}
|
src/lib/components/inference-playground/project-select.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import { autofocus } from "$lib/
|
| 3 |
import { checkpoints } from "$lib/state/checkpoints.svelte";
|
| 4 |
import { cn } from "$lib/utils/cn.js";
|
| 5 |
import { Select } from "melt/builders";
|
|
@@ -156,9 +156,9 @@
|
|
| 156 |
<input
|
| 157 |
bind:value={sdState.name}
|
| 158 |
placeholder={projectPlaceholder}
|
| 159 |
-
use:autofocus
|
| 160 |
type="text"
|
| 161 |
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"
|
|
|
|
| 162 |
/>
|
| 163 |
</label>
|
| 164 |
<label class="mt-4 flex gap-2 font-medium text-gray-900 dark:text-white">
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import { autofocus } from "$lib/attachments/autofocus.js";
|
| 3 |
import { checkpoints } from "$lib/state/checkpoints.svelte";
|
| 4 |
import { cn } from "$lib/utils/cn.js";
|
| 5 |
import { Select } from "melt/builders";
|
|
|
|
| 156 |
<input
|
| 157 |
bind:value={sdState.name}
|
| 158 |
placeholder={projectPlaceholder}
|
|
|
|
| 159 |
type="text"
|
| 160 |
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"
|
| 161 |
+
{@attach autofocus()}
|
| 162 |
/>
|
| 163 |
</label>
|
| 164 |
<label class="mt-4 flex gap-2 font-medium text-gray-900 dark:text-white">
|
src/lib/components/local-toasts.svelte
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
import { autoUpdate, computePosition } from "@floating-ui/dom";
|
| 3 |
import { Toaster } from "melt/builders";
|
| 4 |
import { type Snippet } from "svelte";
|
|
|
|
| 5 |
import { fly } from "svelte/transition";
|
| 6 |
|
| 7 |
interface Props {
|
|
@@ -29,7 +30,7 @@
|
|
| 29 |
|
| 30 |
export const addToast = toaster.addToast;
|
| 31 |
|
| 32 |
-
|
| 33 |
const triggerEl = document.querySelector(`[data-local-toast-trigger=${id}]`);
|
| 34 |
if (!triggerEl) return;
|
| 35 |
|
|
@@ -44,10 +45,8 @@
|
|
| 44 |
});
|
| 45 |
});
|
| 46 |
|
| 47 |
-
return
|
| 48 |
-
|
| 49 |
-
};
|
| 50 |
-
}
|
| 51 |
|
| 52 |
const classMap: Record<ToastData["variant"], string> = {
|
| 53 |
info: "border border-blue-400 bg-gradient-to-b from-blue-500 to-blue-600",
|
|
@@ -65,7 +64,7 @@
|
|
| 65 |
class={[!toastSnippet && `${classMap[toast.data.variant]} rounded-full px-2 py-1 text-xs`]}
|
| 66 |
in:fly={{ y: 10 }}
|
| 67 |
out:fly={{ y: -4 }}
|
| 68 |
-
|
| 69 |
>
|
| 70 |
{#if toastSnippet}
|
| 71 |
{@render toastSnippet({ toast, float })}
|
|
|
|
| 2 |
import { autoUpdate, computePosition } from "@floating-ui/dom";
|
| 3 |
import { Toaster } from "melt/builders";
|
| 4 |
import { type Snippet } from "svelte";
|
| 5 |
+
import { type Attachment } from "svelte/attachments";
|
| 6 |
import { fly } from "svelte/transition";
|
| 7 |
|
| 8 |
interface Props {
|
|
|
|
| 30 |
|
| 31 |
export const addToast = toaster.addToast;
|
| 32 |
|
| 33 |
+
const float: Attachment<HTMLElement> = function (node) {
|
| 34 |
const triggerEl = document.querySelector(`[data-local-toast-trigger=${id}]`);
|
| 35 |
if (!triggerEl) return;
|
| 36 |
|
|
|
|
| 45 |
});
|
| 46 |
});
|
| 47 |
|
| 48 |
+
return autoUpdate(triggerEl, node, compute);
|
| 49 |
+
};
|
|
|
|
|
|
|
| 50 |
|
| 51 |
const classMap: Record<ToastData["variant"], string> = {
|
| 52 |
info: "border border-blue-400 bg-gradient-to-b from-blue-500 to-blue-600",
|
|
|
|
| 64 |
class={[!toastSnippet && `${classMap[toast.data.variant]} rounded-full px-2 py-1 text-xs`]}
|
| 65 |
in:fly={{ y: 10 }}
|
| 66 |
out:fly={{ y: -4 }}
|
| 67 |
+
{@attach float}
|
| 68 |
>
|
| 69 |
{#if toastSnippet}
|
| 70 |
{@render toastSnippet({ toast, float })}
|
src/lib/components/prompts.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<script lang="ts" module>
|
| 2 |
-
import { autofocus } from "$lib/
|
| 3 |
-
import { clickOutside } from "$lib/
|
| 4 |
import IconCross from "~icons/carbon/close";
|
| 5 |
|
| 6 |
type Prompt = {
|
|
@@ -49,7 +49,7 @@
|
|
| 49 |
<form
|
| 50 |
onsubmit={onSubmit}
|
| 51 |
class="relative w-xl rounded-lg bg-white shadow-sm dark:bg-gray-900"
|
| 52 |
-
|
| 53 |
>
|
| 54 |
<div class="flex items-center justify-between rounded-t border-b p-4 md:px-5 md:py-4 dark:border-gray-800">
|
| 55 |
<h3 class="flex items-center gap-2.5 text-lg font-semibold text-gray-900 dark:text-white">
|
|
@@ -73,9 +73,9 @@
|
|
| 73 |
bind:value={current.value}
|
| 74 |
placeholder={current.placeholder}
|
| 75 |
required
|
| 76 |
-
use:autofocus
|
| 77 |
type="text"
|
| 78 |
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
|
|
|
|
| 79 |
/>
|
| 80 |
</label>
|
| 81 |
</div>
|
|
|
|
| 1 |
<script lang="ts" module>
|
| 2 |
+
import { autofocus } from "$lib/attachments/autofocus.js";
|
| 3 |
+
import { clickOutside } from "$lib/attachments/click-outside.js";
|
| 4 |
import IconCross from "~icons/carbon/close";
|
| 5 |
|
| 6 |
type Prompt = {
|
|
|
|
| 49 |
<form
|
| 50 |
onsubmit={onSubmit}
|
| 51 |
class="relative w-xl rounded-lg bg-white shadow-sm dark:bg-gray-900"
|
| 52 |
+
{@attach clickOutside(resolvePrompt)}
|
| 53 |
>
|
| 54 |
<div class="flex items-center justify-between rounded-t border-b p-4 md:px-5 md:py-4 dark:border-gray-800">
|
| 55 |
<h3 class="flex items-center gap-2.5 text-lg font-semibold text-gray-900 dark:text-white">
|
|
|
|
| 73 |
bind:value={current.value}
|
| 74 |
placeholder={current.placeholder}
|
| 75 |
required
|
|
|
|
| 76 |
type="text"
|
| 77 |
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
|
| 78 |
+
{@attach autofocus()}
|
| 79 |
/>
|
| 80 |
</label>
|
| 81 |
</div>
|
src/lib/components/quota-modal.svelte
CHANGED
|
@@ -7,7 +7,7 @@
|
|
| 7 |
</script>
|
| 8 |
|
| 9 |
<script lang="ts">
|
| 10 |
-
import { clickOutside } from "$lib/
|
| 11 |
import IconCross from "~icons/carbon/close";
|
| 12 |
import IconCheck from "~icons/carbon/checkmark";
|
| 13 |
import IconExternal from "~icons/carbon/arrow-up-right";
|
|
@@ -41,7 +41,7 @@
|
|
| 41 |
<!-- Content -->
|
| 42 |
<div
|
| 43 |
class="relative w-lg rounded-xl bg-white shadow-sm dark:bg-gray-900"
|
| 44 |
-
|
| 45 |
transition:scale={{ start: 0.975, duration: 250 }}
|
| 46 |
>
|
| 47 |
<h2 class="mt-8 text-center text-2xl font-semibold text-balance sm:text-3xl dark:text-white">
|
|
|
|
| 7 |
</script>
|
| 8 |
|
| 9 |
<script lang="ts">
|
| 10 |
+
import { clickOutside } from "$lib/attachments/click-outside.js";
|
| 11 |
import IconCross from "~icons/carbon/close";
|
| 12 |
import IconCheck from "~icons/carbon/checkmark";
|
| 13 |
import IconExternal from "~icons/carbon/arrow-up-right";
|
|
|
|
| 41 |
<!-- Content -->
|
| 42 |
<div
|
| 43 |
class="relative w-lg rounded-xl bg-white shadow-sm dark:bg-gray-900"
|
| 44 |
+
{@attach clickOutside(() => (open = false))}
|
| 45 |
transition:scale={{ start: 0.975, duration: 250 }}
|
| 46 |
>
|
| 47 |
<h2 class="mt-8 text-center text-2xl font-semibold text-balance sm:text-3xl dark:text-white">
|
src/lib/components/share-modal.svelte
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
</script>
|
| 12 |
|
| 13 |
<script lang="ts">
|
| 14 |
-
import { clickOutside } from "$lib/
|
| 15 |
import { ProjectEntity, projects, type ProjectEntityMembers } from "$lib/state/projects.svelte";
|
| 16 |
import { copyToClipboard } from "$lib/utils/copy.js";
|
| 17 |
import { decodeString, encodeObject } from "$lib/utils/encode.js";
|
|
@@ -87,7 +87,7 @@
|
|
| 87 |
<!-- Content -->
|
| 88 |
<div
|
| 89 |
class="relative w-xl max-w-[calc(100dvw-2rem)] rounded-xl bg-white shadow-sm dark:bg-gray-900"
|
| 90 |
-
|
| 91 |
transition:scale={{ start: 0.975, duration: 250 }}
|
| 92 |
>
|
| 93 |
<div class="flex items-center justify-between rounded-t border-b p-4 md:px-5 md:py-4 dark:border-gray-800">
|
|
|
|
| 11 |
</script>
|
| 12 |
|
| 13 |
<script lang="ts">
|
| 14 |
+
import { clickOutside } from "$lib/attachments/click-outside.js";
|
| 15 |
import { ProjectEntity, projects, type ProjectEntityMembers } from "$lib/state/projects.svelte";
|
| 16 |
import { copyToClipboard } from "$lib/utils/copy.js";
|
| 17 |
import { decodeString, encodeObject } from "$lib/utils/encode.js";
|
|
|
|
| 87 |
<!-- Content -->
|
| 88 |
<div
|
| 89 |
class="relative w-xl max-w-[calc(100dvw-2rem)] rounded-xl bg-white shadow-sm dark:bg-gray-900"
|
| 90 |
+
{@attach clickOutside(() => close())}
|
| 91 |
transition:scale={{ start: 0.975, duration: 250 }}
|
| 92 |
>
|
| 93 |
<div class="flex items-center justify-between rounded-t border-b p-4 md:px-5 md:py-4 dark:border-gray-800">
|