Thomas G. Lopes commited on
Commit
af10150
·
1 Parent(s): e355035

fix select

Browse files
package.json CHANGED
@@ -28,10 +28,12 @@
28
  "eslint-config-prettier": "^8.10.0",
29
  "eslint-plugin-svelte": "^2.45.1",
30
  "highlight.js": "^11.10.0",
 
31
  "postcss": "^8.4.38",
32
  "prettier": "^3.1.1",
33
  "prettier-plugin-svelte": "^3.2.6",
34
  "prettier-plugin-tailwindcss": "^0.6.11",
 
35
  "svelte": "^5.0.0",
36
  "svelte-check": "^4.0.0",
37
  "tailwind-merge": "^3.0.2",
 
28
  "eslint-config-prettier": "^8.10.0",
29
  "eslint-plugin-svelte": "^2.45.1",
30
  "highlight.js": "^11.10.0",
31
+ "melt": "^0.17.3",
32
  "postcss": "^8.4.38",
33
  "prettier": "^3.1.1",
34
  "prettier-plugin-svelte": "^3.2.6",
35
  "prettier-plugin-tailwindcss": "^0.6.11",
36
+ "runed": "^0.24.0",
37
  "svelte": "^5.0.0",
38
  "svelte-check": "^4.0.0",
39
  "tailwind-merge": "^3.0.2",
pnpm-lock.yaml CHANGED
@@ -72,6 +72,9 @@ importers:
72
  highlight.js:
73
  specifier: ^11.10.0
74
  version: 11.11.1
 
 
 
75
  postcss:
76
  specifier: ^8.4.38
77
  version: 8.5.3
@@ -84,6 +87,9 @@ importers:
84
  prettier-plugin-tailwindcss:
85
  specifier: ^0.6.11
86
 
 
 
87
  svelte:
88
  specifier: ^5.0.0
89
  version: 5.23.0
@@ -482,6 +488,10 @@ packages:
482
  '@internationalized/[email protected]':
483
  resolution: {integrity: sha512-VJ5WS3fcVx0bejE/YHfbDKR/yawZgKqn/if+oEeLqNwBtPzVB06olkfcnojTmEMX+gTpH+FlQ69SHNitJ8/erQ==}
484
 
 
 
 
 
485
  '@jridgewell/[email protected]':
486
  resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==}
487
  engines: {node: '>=6.0.0'}
@@ -657,6 +667,9 @@ packages:
657
  '@samchon/[email protected]':
658
  resolution: {integrity: sha512-eVQlyKRYv1/C2Mikc1xZr7c0jMjg1vjPkeY/gheKB4c5WOOWyTNZ1uvnXR+ETpPHwaQ54I9NrQZhoNk6BEGuuw==}
659
 
 
 
 
660
  '@sveltejs/[email protected]':
661
  resolution: {integrity: sha512-IwQk4yfwLdibDlrXVE04jTZYlLnwsTT2PIOQQGNLWfjavGifnk1JD1LcZjZaBTRcxZu2FfPfNLOE04DSu9lqtQ==}
662
  peerDependencies:
@@ -881,6 +894,10 @@ packages:
881
  resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
882
  engines: {node: '>=8'}
883
 
 
 
 
 
884
885
  resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
886
 
@@ -895,6 +912,10 @@ packages:
895
  resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==}
896
  engines: {node: '>=8'}
897
 
 
 
 
 
898
899
  resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==}
900
  engines: {node: '>= 0.4'}
@@ -1043,6 +1064,10 @@ packages:
1043
1044
  resolution: {integrity: sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==}
1045
 
 
 
 
 
1046
1047
  resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
1048
  engines: {node: '>=8'}
@@ -1361,6 +1386,22 @@ packages:
1361
  resolution: {integrity: sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==}
1362
  engines: {node: '>=16'}
1363
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1364
1365
  resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==}
1366
  hasBin: true
@@ -1495,6 +1536,12 @@ packages:
1495
1496
  resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==}
1497
 
 
 
 
 
 
 
1498
1499
  resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
1500
  engines: {node: '>= 8'}
@@ -1741,6 +1788,10 @@ packages:
1741
  engines: {node: '>=14'}
1742
  hasBin: true
1743
 
 
 
 
 
1744
1745
  resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
1746
  engines: {node: '>=6'}
@@ -1755,6 +1806,9 @@ packages:
1755
  resolution: {integrity: sha512-U+5l2KrcMNOUPYvazA3h5ekF80FHTUG+87SEAmHZmolh1M+i/WyTCxVzmi+tidIa1tM4BSe8g2Y/D3loWDjj+w==}
1756
  engines: {node: '>=4'}
1757
 
 
 
 
1758
1759
  resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
1760
  engines: {node: '>= 6'}
@@ -1805,6 +1859,16 @@ packages:
1805
1806
  resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
1807
 
 
 
 
 
 
 
 
 
 
 
1808
1809
  resolution: {integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==}
1810
 
@@ -2387,6 +2451,10 @@ snapshots:
2387
  dependencies:
2388
  '@swc/helpers': 0.5.15
2389
 
 
 
 
 
2390
  '@jridgewell/[email protected]':
2391
  dependencies:
2392
  '@jridgewell/set-array': 1.2.1
@@ -2553,6 +2621,8 @@ snapshots:
2553
 
2554
  '@samchon/[email protected]': {}
2555
 
 
 
2556
2557
  dependencies:
2558
  acorn: 8.14.0
@@ -2800,6 +2870,8 @@ snapshots:
2800
  dependencies:
2801
  color-convert: 2.0.1
2802
 
 
 
2803
2804
 
2805
@@ -2808,6 +2880,8 @@ snapshots:
2808
 
2809
2810
 
 
 
2811
2812
 
2813
@@ -2925,6 +2999,8 @@ snapshots:
2925
 
2926
2927
 
 
 
2928
2929
  dependencies:
2930
  path-type: 4.0.0
@@ -3312,6 +3388,29 @@ snapshots:
3312
 
3313
3314
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3315
3316
 
3317
@@ -3417,6 +3516,14 @@ snapshots:
3417
  dependencies:
3418
  '@jridgewell/sourcemap-codec': 1.5.0
3419
 
 
 
 
 
 
 
 
 
3420
3421
 
3422
@@ -3591,6 +3698,12 @@ snapshots:
3591
 
3592
3593
 
 
 
 
 
 
 
3594
3595
 
3596
@@ -3602,6 +3715,8 @@ snapshots:
3602
  drange: 1.1.1
3603
  ret: 0.2.2
3604
 
 
 
3605
3606
  dependencies:
3607
  inherits: 2.0.4
@@ -3664,6 +3779,16 @@ snapshots:
3664
  dependencies:
3665
  queue-microtask: 1.2.3
3666
 
 
 
 
 
 
 
 
 
 
 
3667
3668
  dependencies:
3669
  tslib: 2.8.1
 
72
  highlight.js:
73
  specifier: ^11.10.0
74
  version: 11.11.1
75
+ melt:
76
+ specifier: ^0.17.3
77
+ version: 0.17.3(@floating-ui/[email protected])([email protected])
78
  postcss:
79
  specifier: ^8.4.38
80
  version: 8.5.3
 
87
  prettier-plugin-tailwindcss:
88
  specifier: ^0.6.11
89
90
+ runed:
91
+ specifier: ^0.24.0
92
+ version: 0.24.0([email protected])
93
  svelte:
94
  specifier: ^5.0.0
95
  version: 5.23.0
 
488
  '@internationalized/[email protected]':
489
  resolution: {integrity: sha512-VJ5WS3fcVx0bejE/YHfbDKR/yawZgKqn/if+oEeLqNwBtPzVB06olkfcnojTmEMX+gTpH+FlQ69SHNitJ8/erQ==}
490
 
491
+ '@jest/[email protected]':
492
+ resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==}
493
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
494
+
495
  '@jridgewell/[email protected]':
496
  resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==}
497
  engines: {node: '>=6.0.0'}
 
667
  '@samchon/[email protected]':
668
  resolution: {integrity: sha512-eVQlyKRYv1/C2Mikc1xZr7c0jMjg1vjPkeY/gheKB4c5WOOWyTNZ1uvnXR+ETpPHwaQ54I9NrQZhoNk6BEGuuw==}
669
 
670
+ '@sinclair/[email protected]':
671
+ resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==}
672
+
673
  '@sveltejs/[email protected]':
674
  resolution: {integrity: sha512-IwQk4yfwLdibDlrXVE04jTZYlLnwsTT2PIOQQGNLWfjavGifnk1JD1LcZjZaBTRcxZu2FfPfNLOE04DSu9lqtQ==}
675
  peerDependencies:
 
894
  resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
895
  engines: {node: '>=8'}
896
 
897
898
+ resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==}
899
+ engines: {node: '>=10'}
900
+
901
902
  resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
903
 
 
912
  resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==}
913
  engines: {node: '>=8'}
914
 
915
916
+ resolution: {integrity: sha512-QbUdXJVTpvUTHU7871ppZkdOLBeGUKBQWHkHrvN2V9IQWGMt61zf3B45BtzjxEJzYuj0JBjBZP/hmYS/R9pmAw==}
917
+ engines: {node: '>=4'}
918
+
919
920
  resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==}
921
  engines: {node: '>= 0.4'}
 
1064
1065
  resolution: {integrity: sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==}
1066
 
1067
1068
+ resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==}
1069
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
1070
+
1071
1072
  resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
1073
  engines: {node: '>=8'}
 
1386
  resolution: {integrity: sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==}
1387
  engines: {node: '>=16'}
1388
 
1389
1390
+ resolution: {integrity: sha512-Xt7O0+wIpW31lv0SO1wQZUTyJE7DEmnDEZeTt9/S9L5WUywxrv8BrgvTuQEqujtfaQOcJ70p4wg7UUgK1E2F5g==}
1391
+ engines: {node: '>= 16.0.0'}
1392
+
1393
1394
+ resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==}
1395
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
1396
+
1397
1398
+ resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==}
1399
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
1400
+
1401
1402
+ resolution: {integrity: sha512-4DkJ1sDPT+UX2MR7Y3od6KtvRi9Im1ZGLGgdLFLm4lPexbTaCgJW5NN3IOXlQHF7NSHY/VHhflQ+WoKtD/vyCw==}
1403
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
1404
+
1405
1406
  resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==}
1407
  hasBin: true
 
1536
1537
  resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==}
1538
 
1539
1540
+ resolution: {integrity: sha512-cQV/CvYNEW5JxkQLwNYG5cpZ1jSt1eLp2IPfWd94wAdaKhorAWGPc54CDaf1+wQcTSPkxIyJfKszsitTDUrOTA==}
1541
+ peerDependencies:
1542
+ '@floating-ui/dom': ^1.6.0
1543
+ svelte: ^5.0.0
1544
+
1545
1546
  resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
1547
  engines: {node: '>= 8'}
 
1788
  engines: {node: '>=14'}
1789
  hasBin: true
1790
 
1791
1792
+ resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==}
1793
+ engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
1794
+
1795
1796
  resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
1797
  engines: {node: '>=6'}
 
1806
  resolution: {integrity: sha512-U+5l2KrcMNOUPYvazA3h5ekF80FHTUG+87SEAmHZmolh1M+i/WyTCxVzmi+tidIa1tM4BSe8g2Y/D3loWDjj+w==}
1807
  engines: {node: '>=4'}
1808
 
1809
1810
+ resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==}
1811
+
1812
1813
  resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
1814
  engines: {node: '>= 6'}
 
1859
1860
  resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
1861
 
1862
1863
+ resolution: {integrity: sha512-9q8oUiBYeXIDLWNK5DfCWlkL0EW3oGbk845VdKlPeia28l751VpfesaB/+7pI6rnbx1I6rqoZ2fZxptOJLxILA==}
1864
+ peerDependencies:
1865
+ svelte: ^5.7.0
1866
+
1867
1868
+ resolution: {integrity: sha512-kLp0qUdiwEn1Q9zrQlToN7g1PQ+F0XI7J3eABPi/hSwMMy0vEQAdmZQkCvy1BtynAmGiD8CwNSy06KH7iUsCNg==}
1869
+ peerDependencies:
1870
+ svelte: ^5.7.0
1871
+
1872
1873
  resolution: {integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==}
1874
 
 
2451
  dependencies:
2452
  '@swc/helpers': 0.5.15
2453
 
2454
+ '@jest/[email protected]':
2455
+ dependencies:
2456
+ '@sinclair/typebox': 0.27.8
2457
+
2458
  '@jridgewell/[email protected]':
2459
  dependencies:
2460
  '@jridgewell/set-array': 1.2.1
 
2621
 
2622
  '@samchon/[email protected]': {}
2623
 
2624
+ '@sinclair/[email protected]': {}
2625
+
2626
2627
  dependencies:
2628
  acorn: 8.14.0
 
2870
  dependencies:
2871
  color-convert: 2.0.1
2872
 
2873
2874
+
2875
2876
 
2877
 
2880
 
2881
2882
 
2883
2884
+
2885
2886
 
2887
 
2999
 
3000
3001
 
3002
3003
+
3004
3005
  dependencies:
3006
  path-type: 4.0.0
 
3388
 
3389
3390
 
3391
3392
+ dependencies:
3393
+ axe-core: 4.9.1
3394
+ chalk: 4.1.2
3395
+ jest-matcher-utils: 29.2.2
3396
+ lodash.merge: 4.6.2
3397
+
3398
3399
+ dependencies:
3400
+ chalk: 4.1.2
3401
+ diff-sequences: 29.6.3
3402
+ jest-get-type: 29.6.3
3403
+ pretty-format: 29.7.0
3404
+
3405
3406
+
3407
3408
+ dependencies:
3409
+ chalk: 4.1.2
3410
+ jest-diff: 29.7.0
3411
+ jest-get-type: 29.6.3
3412
+ pretty-format: 29.7.0
3413
+
3414
3415
 
3416
 
3516
  dependencies:
3517
  '@jridgewell/sourcemap-codec': 1.5.0
3518
 
3519
3520
+ dependencies:
3521
+ '@floating-ui/dom': 1.6.13
3522
+ jest-axe: 9.0.0
3523
+ nanoid: 5.1.2
3524
+ runed: 0.23.4([email protected])
3525
+ svelte: 5.23.0
3526
+
3527
3528
 
3529
 
3698
 
3699
3700
 
3701
3702
+ dependencies:
3703
+ '@jest/schemas': 29.6.3
3704
+ ansi-styles: 5.2.0
3705
+ react-is: 18.3.1
3706
+
3707
3708
 
3709
 
3715
  drange: 1.1.1
3716
  ret: 0.2.2
3717
 
3718
3719
+
3720
3721
  dependencies:
3722
  inherits: 2.0.4
 
3779
  dependencies:
3780
  queue-microtask: 1.2.3
3781
 
3782
3783
+ dependencies:
3784
+ esm-env: 1.2.2
3785
+ svelte: 5.23.0
3786
+
3787
3788
+ dependencies:
3789
+ esm-env: 1.2.2
3790
+ svelte: 5.23.0
3791
+
3792
3793
  dependencies:
3794
  tslib: 2.8.1
src/lib/components/InferencePlayground/InferencePlaygroundProjectSelect.svelte CHANGED
@@ -1,27 +1,29 @@
1
  <script lang="ts">
2
  import { getActiveProject, session } from "$lib/stores/session";
3
  import { cn } from "$lib/utils/cn";
4
- import { createSelect, createSync } from "@melt-ui/svelte";
5
  import IconCaret from "~icons/carbon/chevron-down";
6
  import IconCross from "~icons/carbon/close";
7
  import IconEdit from "~icons/carbon/edit";
8
  import IconSave from "~icons/carbon/save";
9
  import IconDelete from "~icons/carbon/trash-can";
10
  import { prompt } from "../Prompts.svelte";
 
11
 
12
- let classNames: string = "";
13
- export { classNames as class };
 
 
 
14
 
15
- $: isDefault = $session.activeProjectId === "default";
16
 
17
- const {
18
- elements: { trigger, menu, option },
19
- states: { selected },
20
- } = createSelect<string, false>();
21
- const sync = createSync({ selected });
22
- $: sync.selected({ value: getActiveProject($session).id, label: getActiveProject($session).name }, p => {
23
- if (!p) return;
24
- $session.activeProjectId = p?.value;
25
  });
26
 
27
  async function saveProject() {
@@ -31,8 +33,7 @@
31
 
32
  <div class={cn("flex w-full items-stretch gap-2 ", classNames)}>
33
  <button
34
- {...$trigger}
35
- use:trigger
36
  class={cn(
37
  "relative flex grow items-center justify-between gap-6 overflow-hidden rounded-lg border bg-gray-100/80 px-3 py-1.5 leading-tight whitespace-nowrap shadow-sm",
38
  "hover:brightness-95 dark:border-gray-700 dark:bg-gray-800 dark:hover:brightness-110"
@@ -48,19 +49,20 @@
48
  </div>
49
  </button>
50
  {#if isDefault}
51
- <button class="btn size-[32px] p-0" on:click={saveProject}>
52
  <IconSave />
53
  </button>
54
  {:else}
55
- <button class="btn size-[32px] p-0" on:click={() => ($session.activeProjectId = "default")}>
56
  <IconCross />
57
  </button>
58
  {/if}
59
  </div>
60
 
61
- <div {...$menu} use:menu class="rounded-lg border bg-gray-100 dark:border-gray-700 dark:bg-gray-800">
62
  {#each $session.projects as { name, id } (id)}
63
- <button {...$option({ value: id, label: name })} use:option class="group block w-full p-1 text-sm dark:text-white">
 
64
  <div
65
  class="flex items-center gap-2 rounded-md py-1.5 pr-1 pl-2 group-data-[highlighted]:bg-gray-200 dark:group-data-[highlighted]:bg-gray-700"
66
  >
@@ -69,7 +71,7 @@
69
  <div class="ml-auto flex items-center gap-1">
70
  <button
71
  class="grid place-items-center rounded-md p-1 text-xs hover:bg-gray-300 dark:hover:bg-gray-600"
72
- on:click={async e => {
73
  e.stopPropagation();
74
  session.updateProject(id, { name: (await prompt("Edit project name", name)) || name });
75
  }}
@@ -78,7 +80,7 @@
78
  </button>
79
  <button
80
  class="grid place-items-center rounded-md p-1 text-xs hover:bg-gray-300 dark:hover:bg-gray-600"
81
- on:click={e => {
82
  e.stopPropagation();
83
  session.deleteProject(id);
84
  }}
@@ -88,6 +90,6 @@
88
  </div>
89
  {/if}
90
  </div>
91
- </button>
92
  {/each}
93
  </div>
 
1
  <script lang="ts">
2
  import { getActiveProject, session } from "$lib/stores/session";
3
  import { cn } from "$lib/utils/cn";
4
+ import { Select } from "melt/builders";
5
  import IconCaret from "~icons/carbon/chevron-down";
6
  import IconCross from "~icons/carbon/close";
7
  import IconEdit from "~icons/carbon/edit";
8
  import IconSave from "~icons/carbon/save";
9
  import IconDelete from "~icons/carbon/trash-can";
10
  import { prompt } from "../Prompts.svelte";
11
+ import { fromStore } from "svelte/store";
12
 
13
+ interface Props {
14
+ class?: string;
15
+ }
16
+
17
+ let { class: classNames = "" }: Props = $props();
18
 
19
+ const isDefault = $derived($session.activeProjectId === "default");
20
 
21
+ const select = new Select({
22
+ value: () => $session.activeProjectId,
23
+ onValueChange(v) {
24
+ if (v) $session.activeProjectId = v;
25
+ },
26
+ sameWidth: true,
 
 
27
  });
28
 
29
  async function saveProject() {
 
33
 
34
  <div class={cn("flex w-full items-stretch gap-2 ", classNames)}>
35
  <button
36
+ {...select.trigger}
 
37
  class={cn(
38
  "relative flex grow items-center justify-between gap-6 overflow-hidden rounded-lg border bg-gray-100/80 px-3 py-1.5 leading-tight whitespace-nowrap shadow-sm",
39
  "hover:brightness-95 dark:border-gray-700 dark:bg-gray-800 dark:hover:brightness-110"
 
49
  </div>
50
  </button>
51
  {#if isDefault}
52
+ <button class="btn size-[32px] p-0" onclick={saveProject}>
53
  <IconSave />
54
  </button>
55
  {:else}
56
+ <button class="btn size-[32px] p-0" onclick={() => ($session.activeProjectId = "default")}>
57
  <IconCross />
58
  </button>
59
  {/if}
60
  </div>
61
 
62
+ <div {...select.content} class="rounded-lg border bg-gray-100 dark:border-gray-700 dark:bg-gray-800">
63
  {#each $session.projects as { name, id } (id)}
64
+ {@const option = select.getOption(id)}
65
+ <div {...option} class="group block w-full p-1 text-sm dark:text-white">
66
  <div
67
  class="flex items-center gap-2 rounded-md py-1.5 pr-1 pl-2 group-data-[highlighted]:bg-gray-200 dark:group-data-[highlighted]:bg-gray-700"
68
  >
 
71
  <div class="ml-auto flex items-center gap-1">
72
  <button
73
  class="grid place-items-center rounded-md p-1 text-xs hover:bg-gray-300 dark:hover:bg-gray-600"
74
+ onclick={async e => {
75
  e.stopPropagation();
76
  session.updateProject(id, { name: (await prompt("Edit project name", name)) || name });
77
  }}
 
80
  </button>
81
  <button
82
  class="grid place-items-center rounded-md p-1 text-xs hover:bg-gray-300 dark:hover:bg-gray-600"
83
+ onclick={e => {
84
  e.stopPropagation();
85
  session.deleteProject(id);
86
  }}
 
90
  </div>
91
  {/if}
92
  </div>
93
+ </div>
94
  {/each}
95
  </div>