@backmatter/studio 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/UiKitPage-CgNMOqfE.js +172 -0
- package/dist/chunks/WorkspaceRoutes-DgRtdie8.js +87297 -0
- package/dist/chunks/abap-Y8Dl9g_6.js +6 -0
- package/dist/chunks/actionscript-3-DQVEcJUW.js +6 -0
- package/dist/chunks/ada-vP6ak0IW.js +6 -0
- package/dist/chunks/andromeeda-BbmzSJq1.js +4 -0
- package/dist/chunks/angular-html-DPB4Rf0C.js +32 -0
- package/dist/chunks/angular-ts-CTOR2ofC.js +21 -0
- package/dist/chunks/apache-BUjz-sD2.js +6 -0
- package/dist/chunks/apex-OyTfjCYK.js +6 -0
- package/dist/chunks/apl-CjNiDgad.js +16 -0
- package/dist/chunks/applescript-BPx7YFFu.js +6 -0
- package/dist/chunks/ara-Z2fSOxSw.js +6 -0
- package/dist/chunks/asciidoc-C1T9ziH6.js +6 -0
- package/dist/chunks/asm-BTWLY5ym.js +6 -0
- package/dist/chunks/astro-CFFExE8Q.js +18 -0
- package/dist/chunks/aurora-x-BwoVEUWZ.js +4 -0
- package/dist/chunks/awk-Fb0P9dkn.js +6 -0
- package/dist/chunks/ayu-dark-DJoqd4M9.js +4 -0
- package/dist/chunks/ayu-light-BzXEJRJ-.js +4 -0
- package/dist/chunks/ayu-mirage-BJ2oZGzi.js +4 -0
- package/dist/chunks/ballerina-oZK-YekG.js +6 -0
- package/dist/chunks/bat-0FvbqU9S.js +6 -0
- package/dist/chunks/beancount-DqJEb89h.js +6 -0
- package/dist/chunks/berry-DODBq_Ff.js +6 -0
- package/dist/chunks/bibtex-EULQRLY5.js +6 -0
- package/dist/chunks/bicep-BorU73w0.js +6 -0
- package/dist/chunks/bird2-CIjBSNj3.js +6 -0
- package/dist/chunks/blade-D0HyNvCw.js +20 -0
- package/dist/chunks/bsl-NkNNwerW.js +8 -0
- package/dist/chunks/c-eeMepfLm.js +6 -0
- package/dist/chunks/c3-BY5XW5ym.js +6 -0
- package/dist/chunks/cadence-02UX7mW8.js +6 -0
- package/dist/chunks/cairo-DM6WF2e3.js +8 -0
- package/dist/chunks/catppuccin-frappe-D3cH2rXe.js +4 -0
- package/dist/chunks/catppuccin-latte-C0LRGUW4.js +4 -0
- package/dist/chunks/catppuccin-macchiato-c5wQ11TT.js +4 -0
- package/dist/chunks/catppuccin-mocha-WMD6Qvya.js +4 -0
- package/dist/chunks/clarity-PKm5CwqM.js +6 -0
- package/dist/chunks/clojure-CXJfHrL3.js +6 -0
- package/dist/chunks/cmake-BJz8BOTU.js +6 -0
- package/dist/chunks/cobol-HihOMwht.js +10 -0
- package/dist/chunks/codeowners-Bt9yU6NX.js +6 -0
- package/dist/chunks/codeql-DHkodjjI.js +6 -0
- package/dist/chunks/coffee-DGBR_nr_.js +8 -0
- package/dist/chunks/common-lisp-EVqT9Zhp.js +6 -0
- package/dist/chunks/coq-B0L9upzn.js +6 -0
- package/dist/chunks/cpp-Cj177cuW.js +18 -0
- package/dist/chunks/crystal-CRJyc4G-.js +18 -0
- package/dist/chunks/csharp-CCgA4A09.js +6 -0
- package/dist/chunks/css-CECN5uSL.js +6 -0
- package/dist/chunks/csv-CmYOceLb.js +6 -0
- package/dist/chunks/cue-ZzumE7IT.js +6 -0
- package/dist/chunks/cypher-jpdmjtA6.js +6 -0
- package/dist/chunks/d-CBagWSwH.js +6 -0
- package/dist/chunks/dark-plus-pUHDTVV0.js +4 -0
- package/dist/chunks/dart-6ObCrKr9.js +6 -0
- package/dist/chunks/dashboard-XKKZuJGm.js +1736 -0
- package/dist/chunks/dax-CcDT-8dH.js +6 -0
- package/dist/chunks/define-studio-BYtYDGLX.js +33 -0
- package/dist/chunks/desktop-B93p9R9O.js +6 -0
- package/dist/chunks/diff-BxzP2J8R.js +6 -0
- package/dist/chunks/docker-CsHqm9tx.js +6 -0
- package/dist/chunks/dotenv-BMjVjUL1.js +6 -0
- package/dist/chunks/dracula-BtZx2Kac.js +4 -0
- package/dist/chunks/dracula-soft-BKa-aqBv.js +4 -0
- package/dist/chunks/dream-maker-PAx17jaB.js +6 -0
- package/dist/chunks/edge-BYQkOzbF.js +12 -0
- package/dist/chunks/elixir-Dh036GMp.js +8 -0
- package/dist/chunks/elm-BtNbw_Cd.js +8 -0
- package/dist/chunks/emacs-lisp-Cfxdx5D-.js +6 -0
- package/dist/chunks/erb-ScVOXVpH.js +10 -0
- package/dist/chunks/erlang-DNcDT8Hi.js +8 -0
- package/dist/chunks/everforest-dark-DMCBqXCK.js +4 -0
- package/dist/chunks/everforest-light-BbXl82Em.js +4 -0
- package/dist/chunks/fennel-N4WcXuKx.js +6 -0
- package/dist/chunks/fish-BTDEUgqH.js +6 -0
- package/dist/chunks/fluent-BMXUxfv1.js +6 -0
- package/dist/chunks/fortran-fixed-form-B67KFkXH.js +8 -0
- package/dist/chunks/fortran-free-form-CwqYvCLJ.js +6 -0
- package/dist/chunks/fsharp-CYOiIVNx.js +8 -0
- package/dist/chunks/gdresource-CvCIUjhi.js +10 -0
- package/dist/chunks/gdscript-DSAxJ_aS.js +6 -0
- package/dist/chunks/gdshader-Bk8fF6yr.js +6 -0
- package/dist/chunks/genie-DzUvd7U9.js +6 -0
- package/dist/chunks/gherkin-DHRaV0YP.js +6 -0
- package/dist/chunks/git-commit-Bd32YZ0K.js +8 -0
- package/dist/chunks/git-rebase-ZWUFO_T4.js +8 -0
- package/dist/chunks/github-dark-DenFmJkN.js +4 -0
- package/dist/chunks/github-dark-default-BJPUVz4H.js +4 -0
- package/dist/chunks/github-dark-dimmed-DUshB20C.js +4 -0
- package/dist/chunks/github-dark-high-contrast-D3aGCnF8.js +4 -0
- package/dist/chunks/github-light-JYsPkUQd.js +4 -0
- package/dist/chunks/github-light-default-D99KPAby.js +4 -0
- package/dist/chunks/github-light-high-contrast-BbmZE-Mp.js +4 -0
- package/dist/chunks/gleam-Bv284lvN.js +6 -0
- package/dist/chunks/glimmer-js-DkxNrfPT.js +14 -0
- package/dist/chunks/glimmer-ts-D6YZEmK_.js +14 -0
- package/dist/chunks/glsl-CkUcVZNK.js +8 -0
- package/dist/chunks/gn-XtJxiLa4.js +6 -0
- package/dist/chunks/gnuplot-yPG9-sE_.js +6 -0
- package/dist/chunks/go-CvFNMTvu.js +6 -0
- package/dist/chunks/graphql-CBu2ehBn.js +14 -0
- package/dist/chunks/groovy-CJQTphOW.js +6 -0
- package/dist/chunks/gruvbox-dark-hard-C5HOtKIh.js +4 -0
- package/dist/chunks/gruvbox-dark-medium-FVgwJHuz.js +4 -0
- package/dist/chunks/gruvbox-dark-soft-B46F314v.js +4 -0
- package/dist/chunks/gruvbox-light-hard-CJD38wDZ.js +4 -0
- package/dist/chunks/gruvbox-light-medium-BlIhMYTA.js +4 -0
- package/dist/chunks/gruvbox-light-soft-DoPHyLVZ.js +4 -0
- package/dist/chunks/hack-ItRNKiEb.js +10 -0
- package/dist/chunks/haml-NZLVzu_R.js +10 -0
- package/dist/chunks/handlebars-mxStpSE7.js +14 -0
- package/dist/chunks/haskell-WeIwNIP6.js +6 -0
- package/dist/chunks/haxe-TztHsm5T.js +6 -0
- package/dist/chunks/hcl-D438OF-I.js +6 -0
- package/dist/chunks/hjson-DYBUbqOl.js +6 -0
- package/dist/chunks/hlsl-Bk8TCZNL.js +6 -0
- package/dist/chunks/horizon-CJQ10nlf.js +4 -0
- package/dist/chunks/horizon-bright-CdkBZOMB.js +4 -0
- package/dist/chunks/houston-BDYrDoDW.js +4 -0
- package/dist/chunks/html-B50bmoVb.js +10 -0
- package/dist/chunks/html-derivative-C6bxFbFW.js +8 -0
- package/dist/chunks/http-DLvAkeD-.js +14 -0
- package/dist/chunks/hurl-CgkFN90t.js +12 -0
- package/dist/chunks/hxml-GbqSQCLa.js +8 -0
- package/dist/chunks/hy-Brt5EZ7-.js +6 -0
- package/dist/chunks/imba-CimUv-Uh.js +6 -0
- package/dist/chunks/index-CFAIR8GH.js +18924 -0
- package/dist/chunks/ini-BZIuRIvJ.js +6 -0
- package/dist/chunks/java-DY6VlHhP.js +6 -0
- package/dist/chunks/javascript-C25yR2R2.js +6 -0
- package/dist/chunks/jinja-CFW5uAwY.js +11 -0
- package/dist/chunks/jison-DdreslRX.js +8 -0
- package/dist/chunks/json-DxJze_jm.js +6 -0
- package/dist/chunks/json5-BT4Fjg39.js +6 -0
- package/dist/chunks/jsonc-CHjZD8gR.js +6 -0
- package/dist/chunks/jsonl-BGuvDmy9.js +6 -0
- package/dist/chunks/jsonnet-Bx2cfsXg.js +6 -0
- package/dist/chunks/jssm-BcADi6EI.js +6 -0
- package/dist/chunks/jsx-BtKADgXT.js +6 -0
- package/dist/chunks/julia-CZiKXNNP.js +16 -0
- package/dist/chunks/just-CEK2SJ_k.js +18 -0
- package/dist/chunks/kanagawa-dragon-CiKur4Hl.js +4 -0
- package/dist/chunks/kanagawa-lotus-BKu-smKu.js +4 -0
- package/dist/chunks/kanagawa-wave-CQwozSzG.js +4 -0
- package/dist/chunks/kdl-BNOv9TC3.js +6 -0
- package/dist/chunks/kotlin-ByBMgTeR.js +6 -0
- package/dist/chunks/kusto-DH_XitHS.js +6 -0
- package/dist/chunks/laserwave-6a00oqik.js +4 -0
- package/dist/chunks/latex-B8Egmqc5.js +8 -0
- package/dist/chunks/lean-BnVxaZxY.js +6 -0
- package/dist/chunks/less-B1GLI2Di.js +6 -0
- package/dist/chunks/light-plus-CZuVqSLX.js +4 -0
- package/dist/chunks/liquid-CHzkx3jT.js +14 -0
- package/dist/chunks/llvm-Bk2XctFf.js +6 -0
- package/dist/chunks/log-Al8wyEFV.js +6 -0
- package/dist/chunks/logo-DBa4JDzV.js +6 -0
- package/dist/chunks/lua-Bp3IRv7I.js +8 -0
- package/dist/chunks/luau-UQyhudEE.js +6 -0
- package/dist/chunks/make-CsMclxtr.js +6 -0
- package/dist/chunks/markdown-CrScaQ96.js +6 -0
- package/dist/chunks/marko-CJBA24Ri.js +14 -0
- package/dist/chunks/material-theme-D6KBX41T.js +4 -0
- package/dist/chunks/material-theme-darker-CkRroheE.js +4 -0
- package/dist/chunks/material-theme-lighter-BUBw43Yz.js +4 -0
- package/dist/chunks/material-theme-ocean-ClGX14Ja.js +4 -0
- package/dist/chunks/material-theme-palenight-C1RVm8K1.js +4 -0
- package/dist/chunks/matlab-BOAaUVP0.js +6 -0
- package/dist/chunks/mdc-C9YSUwVC.js +12 -0
- package/dist/chunks/mdx-BOhZZUJ8.js +6 -0
- package/dist/chunks/mermaid-C3rz4dYh.js +6 -0
- package/dist/chunks/min-dark-C7ak0t6c.js +4 -0
- package/dist/chunks/min-light-CKFxVcPp.js +4 -0
- package/dist/chunks/mipsasm-CTx18fBl.js +6 -0
- package/dist/chunks/mojo-EIZIZRTQ.js +6 -0
- package/dist/chunks/monokai-C1KBYcO0.js +4 -0
- package/dist/chunks/moonbit-B1TV0fG3.js +6 -0
- package/dist/chunks/move-Db4ltDq1.js +6 -0
- package/dist/chunks/narrat-DmhDCBs-.js +6 -0
- package/dist/chunks/nextflow-47kAzSl1.js +8 -0
- package/dist/chunks/nextflow-groovy-Drz_2V0j.js +6 -0
- package/dist/chunks/nginx-D7O4WoB1.js +8 -0
- package/dist/chunks/night-owl-Bm2rzalh.js +4 -0
- package/dist/chunks/night-owl-light-CBI5u5kw.js +4 -0
- package/dist/chunks/nim-QAjRdh9w.js +20 -0
- package/dist/chunks/nix-fTRXMGic.js +9 -0
- package/dist/chunks/nord-CC5OiUXg.js +4 -0
- package/dist/chunks/nushell-BGCPRlV5.js +6 -0
- package/dist/chunks/objective-c-Itk8tzmv.js +6 -0
- package/dist/chunks/objective-cpp-DGt5UKRO.js +6 -0
- package/dist/chunks/ocaml-eSVK32Eg.js +6 -0
- package/dist/chunks/odin-BItnF517.js +6 -0
- package/dist/chunks/one-dark-pro-DTA3VF0_.js +4 -0
- package/dist/chunks/one-light-LkMrt1Cf.js +4 -0
- package/dist/chunks/openscad-Sp5uZ6f2.js +6 -0
- package/dist/chunks/pascal-xy8pJNns.js +6 -0
- package/dist/chunks/perl-DkVrgJBg.js +16 -0
- package/dist/chunks/php-BIzsF_5x.js +18 -0
- package/dist/chunks/pkl-C-zSNmaA.js +6 -0
- package/dist/chunks/plastic-CSTz3KZp.js +4 -0
- package/dist/chunks/plsql-pVbGZfOv.js +6 -0
- package/dist/chunks/po-BNfHvqmm.js +6 -0
- package/dist/chunks/poimandres-C-VADXHD.js +4 -0
- package/dist/chunks/polar-CAZahv3u.js +6 -0
- package/dist/chunks/postcss-05aHdL-n.js +6 -0
- package/dist/chunks/powerquery-DI9HkTvs.js +6 -0
- package/dist/chunks/powershell-Clc4ydu-.js +6 -0
- package/dist/chunks/prisma-FZjmVtSl.js +6 -0
- package/dist/chunks/prolog-C5-yg4TO.js +6 -0
- package/dist/chunks/proto-C7QgialS.js +6 -0
- package/dist/chunks/pug-XOw9Q1Ho.js +12 -0
- package/dist/chunks/puppet-CUJHmnxV.js +6 -0
- package/dist/chunks/purescript-rUfGld-4.js +6 -0
- package/dist/chunks/python-BFNSHbwJ.js +6 -0
- package/dist/chunks/qml-rTNXsquU.js +8 -0
- package/dist/chunks/qmldir-BInDYbpo.js +6 -0
- package/dist/chunks/qss-AeJTysr_.js +6 -0
- package/dist/chunks/r-CSmzDPi7.js +6 -0
- package/dist/chunks/racket-B83wSAja.js +6 -0
- package/dist/chunks/raku-nEQ4ZJJ7.js +6 -0
- package/dist/chunks/razor-Ci8D0dQK.js +10 -0
- package/dist/chunks/red-7y8PH7HH.js +4 -0
- package/dist/chunks/reg-m_s_Kiip.js +6 -0
- package/dist/chunks/regexp-BazyLpPg.js +6 -0
- package/dist/chunks/rel-BcRfyd6Q.js +6 -0
- package/dist/chunks/riscv-Ce8MAQLP.js +6 -0
- package/dist/chunks/ron-DCEEQypA.js +6 -0
- package/dist/chunks/rose-pine-BKc3yVeu.js +4 -0
- package/dist/chunks/rose-pine-dawn-BulJcPZT.js +4 -0
- package/dist/chunks/rose-pine-moon-j6jiXKV8.js +4 -0
- package/dist/chunks/rosmsg-Cz0w1km8.js +6 -0
- package/dist/chunks/rst-DM32Wy3O.js +22 -0
- package/dist/chunks/ruby-BeqCs27h.js +30 -0
- package/dist/chunks/rust-CLzF9zIN.js +6 -0
- package/dist/chunks/sas-fpEvgATw.js +8 -0
- package/dist/chunks/sass-DxHp5rTx.js +6 -0
- package/dist/chunks/scala-D4grkFkl.js +6 -0
- package/dist/chunks/scheme-BCRWuEm4.js +6 -0
- package/dist/chunks/scss-B1FaCqwR.js +8 -0
- package/dist/chunks/sdbl-B7T8abf4.js +6 -0
- package/dist/chunks/shaderlab-Cr62-Wb4.js +8 -0
- package/dist/chunks/shellscript-InADTalH.js +6 -0
- package/dist/chunks/shellsession-DiDJNQdy.js +8 -0
- package/dist/chunks/slack-dark-i7wN4OET.js +4 -0
- package/dist/chunks/slack-ochin-ndHf0LoP.js +4 -0
- package/dist/chunks/smalltalk-BlI1_OkM.js +6 -0
- package/dist/chunks/snazzy-light-BlSJXAu4.js +4 -0
- package/dist/chunks/solarized-dark-UTmkh7lw.js +4 -0
- package/dist/chunks/solarized-light-BheCkDPT.js +4 -0
- package/dist/chunks/solidity-DUWnFhS6.js +6 -0
- package/dist/chunks/soy-C1-6njHa.js +8 -0
- package/dist/chunks/sparql-B0KWFEri.js +8 -0
- package/dist/chunks/splunk-CRXR8A9s.js +6 -0
- package/dist/chunks/sql-Cn_v3PB0.js +6 -0
- package/dist/chunks/ssh-config-DP-hNVbF.js +6 -0
- package/dist/chunks/stata-B8c5fTjX.js +8 -0
- package/dist/chunks/stylus-CyKEU1Ej.js +6 -0
- package/dist/chunks/surrealql-CQi7GQN7.js +8 -0
- package/dist/chunks/svelte-rYri41WT.js +14 -0
- package/dist/chunks/swift-DJpUqPLg.js +6 -0
- package/dist/chunks/synthwave-84-NU3C_KFZ.js +4 -0
- package/dist/chunks/system-verilog-BCm7smPJ.js +6 -0
- package/dist/chunks/systemd-C-4qm6XH.js +6 -0
- package/dist/chunks/talonscript-CFF3LF_O.js +6 -0
- package/dist/chunks/tasl-Cg_WBUAe.js +6 -0
- package/dist/chunks/tcl-DN7buRTF.js +6 -0
- package/dist/chunks/templ-Crs9Ui8q.js +12 -0
- package/dist/chunks/terraform-DGvcn9zM.js +6 -0
- package/dist/chunks/tex-AHxmLTL0.js +8 -0
- package/dist/chunks/tokyo-night-DP4TmcQl.js +4 -0
- package/dist/chunks/toml-DY62mUL_.js +6 -0
- package/dist/chunks/ts-tags-ioVe2PKw.js +41 -0
- package/dist/chunks/tsv-BtvSkaG0.js +6 -0
- package/dist/chunks/tsx-B8rCNbgL.js +6 -0
- package/dist/chunks/turtle-_H59FV7D.js +6 -0
- package/dist/chunks/twig-DwV2Fi4L.js +18 -0
- package/dist/chunks/typescript-RycA9KXf.js +6 -0
- package/dist/chunks/typespec-DWqp-kUU.js +6 -0
- package/dist/chunks/typst-D_1QKWns.js +6 -0
- package/dist/chunks/v-BPCNiyYe.js +6 -0
- package/dist/chunks/vala-uxaPR7d1.js +6 -0
- package/dist/chunks/vb-D8_c5-KN.js +6 -0
- package/dist/chunks/verilog-B-bybjPF.js +6 -0
- package/dist/chunks/vesper-BckBta1U.js +4 -0
- package/dist/chunks/vhdl-CUlNa8ac.js +6 -0
- package/dist/chunks/viml-DsfA-sWm.js +6 -0
- package/dist/chunks/vitesse-black-BoGvW84i.js +4 -0
- package/dist/chunks/vitesse-dark-Cym-eLtO.js +4 -0
- package/dist/chunks/vitesse-light-CcmG315c.js +4 -0
- package/dist/chunks/vue-DXEmyXn9.js +31 -0
- package/dist/chunks/vue-html-j9xNEdu3.js +8 -0
- package/dist/chunks/vue-vine-D41-N99t.js +18 -0
- package/dist/chunks/vyper-CPQuu50u.js +6 -0
- package/dist/chunks/wasm-BBXxrAl7.js +6 -0
- package/dist/chunks/wasm-DQxwEHae.js +7 -0
- package/dist/chunks/wenyan-pbVjoM9_.js +6 -0
- package/dist/chunks/wgsl-DY4iK1q1.js +6 -0
- package/dist/chunks/wikitext-Z-MoUasO.js +6 -0
- package/dist/chunks/wit-CQMQOlTg.js +6 -0
- package/dist/chunks/wolfram-Dz4KXISs.js +6 -0
- package/dist/chunks/xml-C2J0sS9M.js +8 -0
- package/dist/chunks/xsl-BmSZphgC.js +8 -0
- package/dist/chunks/yaml-DaO7k5B1.js +6 -0
- package/dist/chunks/zenscript-CxBjpf9c.js +6 -0
- package/dist/chunks/zig-Vm0PO9wB.js +6 -0
- package/dist/dashboard.js +8 -0
- package/dist/define.js +4 -0
- package/dist/index.js +317 -0
- package/dist/studio.css +2272 -0
- package/dist/styles.js +1 -0
- package/package.json +88 -0
- package/prose-node-shims/fs.ts +6 -0
- package/prose-node-shims/path.ts +16 -0
- package/prose-node-shims/sharp.ts +4 -0
- package/prose-ui-node-shim.ts +26 -0
- package/src/App.tsx +173 -0
- package/src/WorkspaceRoutes.tsx +38 -0
- package/src/api.ts +833 -0
- package/src/auth-client.ts +15 -0
- package/src/chat/ChangeCard.tsx +330 -0
- package/src/chat/ChatBar.tsx +238 -0
- package/src/chat/ChatMessage.tsx +478 -0
- package/src/chat/ChatPanel.tsx +406 -0
- package/src/chat/ChatProvider.tsx +661 -0
- package/src/chat/Composer.tsx +461 -0
- package/src/chat/DocListCard.tsx +322 -0
- package/src/chat/LiveStatus.tsx +83 -0
- package/src/chat/MentionPopover.tsx +164 -0
- package/src/chat/ModelPicker.tsx +113 -0
- package/src/chat/Shimmer.tsx +39 -0
- package/src/chat/ThreadHistory.tsx +268 -0
- package/src/chat/chat-context.ts +41 -0
- package/src/chat/chat-helpers.ts +402 -0
- package/src/chat/chat-state.ts +59 -0
- package/src/chat/icons.tsx +171 -0
- package/src/chat/useStickToBottom.ts +110 -0
- package/src/chrome/AppShell.tsx +100 -0
- package/src/chrome/AppSidebar.tsx +305 -0
- package/src/chrome/CommandPalette.tsx +559 -0
- package/src/chrome/ContentApiPopover.tsx +215 -0
- package/src/chrome/EditorActionsContext.tsx +63 -0
- package/src/chrome/EditorFocusContext.tsx +80 -0
- package/src/chrome/EditorStatusContext.tsx +84 -0
- package/src/chrome/NavItem.tsx +75 -0
- package/src/chrome/OpenSiteButton.tsx +148 -0
- package/src/chrome/StatusBar.tsx +73 -0
- package/src/chrome/UserMenu.tsx +130 -0
- package/src/chrome/WorkspaceNavContext.tsx +60 -0
- package/src/chrome/WorkspaceStatusBar.tsx +940 -0
- package/src/chrome/content-api-url.ts +111 -0
- package/src/chrome/content-type-groups.ts +32 -0
- package/src/chrome/hotkeys.ts +79 -0
- package/src/chrome/icons.tsx +191 -0
- package/src/chrome/open-site.ts +30 -0
- package/src/chrome/status-bar-action.ts +24 -0
- package/src/components/AppChromeContext.tsx +32 -0
- package/src/components/Shell.tsx +18 -0
- package/src/components/WorkspaceSwitcher.tsx +345 -0
- package/src/content-blocks/index.tsx +262 -0
- package/src/css.d.ts +2 -0
- package/src/dashboard.ts +5 -0
- package/src/define-studio.tsx +98 -0
- package/src/define.ts +12 -0
- package/src/index.css +123 -0
- package/src/index.ts +19 -0
- package/src/last-user.ts +40 -0
- package/src/last-workspace.ts +57 -0
- package/src/mcp/McpConnectorsPanel.tsx +872 -0
- package/src/mcp/parse-json.ts +52 -0
- package/src/pages/AcceptInvitePage.tsx +99 -0
- package/src/pages/BlockSettingsDialog.tsx +303 -0
- package/src/pages/BlocksList.tsx +402 -0
- package/src/pages/BodyProse.tsx +236 -0
- package/src/pages/DocEditorPage.tsx +1394 -0
- package/src/pages/EmbedChatPage.tsx +110 -0
- package/src/pages/EmbedPublishPage.tsx +259 -0
- package/src/pages/EnterPage.tsx +96 -0
- package/src/pages/GithubConnectPage.tsx +142 -0
- package/src/pages/LegacyWorkspaceRedirect.tsx +57 -0
- package/src/pages/LoginPage.tsx +335 -0
- package/src/pages/NewWorkspacePage.tsx +74 -0
- package/src/pages/RenderedBody.tsx +598 -0
- package/src/pages/ResumeHome.tsx +18 -0
- package/src/pages/SelectionBar.tsx +277 -0
- package/src/pages/SettingsGeneralPage.tsx +403 -0
- package/src/pages/SettingsGithubPage.tsx +277 -0
- package/src/pages/SettingsLayout.tsx +127 -0
- package/src/pages/SettingsMcpPage.tsx +30 -0
- package/src/pages/SettingsSchemaPage.tsx +93 -0
- package/src/pages/SettingsUsersPage.tsx +363 -0
- package/src/pages/TypeDocsPage.tsx +225 -0
- package/src/pages/UiKitPage.tsx +331 -0
- package/src/pages/UserSettingsPage.tsx +94 -0
- package/src/pages/WorkspaceHomeRedirect.tsx +17 -0
- package/src/pages/WorkspaceLayout.tsx +103 -0
- package/src/pages/WorkspacesPage.tsx +35 -0
- package/src/pages/blocks-list.ts +73 -0
- package/src/pages/body-blocks.ts +233 -0
- package/src/pages/body-mdx.tsx +82 -0
- package/src/pages/compile-body.ts +37 -0
- package/src/pages/host-env.ts +22 -0
- package/src/pages/html-to-markdown.ts +99 -0
- package/src/pages/preview-bridge.ts +46 -0
- package/src/pages/preview-split.ts +30 -0
- package/src/pages/preview-url.ts +92 -0
- package/src/pages/selection-format.ts +179 -0
- package/src/pages/type-docs.ts +9 -0
- package/src/replica/BootstrapSplash.tsx +80 -0
- package/src/replica/ReplicaProvider.tsx +267 -0
- package/src/replica/cache.ts +30 -0
- package/src/replica/idb.ts +89 -0
- package/src/replica/instance.ts +39 -0
- package/src/replica/pull.ts +23 -0
- package/src/replica/store.ts +497 -0
- package/src/replica/sync-cache.ts +51 -0
- package/src/replica/types.ts +119 -0
- package/src/replica/useReplica.ts +13 -0
- package/src/site.tsx +230 -0
- package/src/studio-config.ts +81 -0
- package/src/styles/themes.ts +49 -0
- package/src/styles/tokens.stylex.ts +58 -0
- package/src/styles.ts +11 -0
- package/src/theme/AccentOverride.tsx +29 -0
- package/src/theme/ThemeProvider.tsx +130 -0
- package/src/theme/apply-theme-class.ts +12 -0
- package/src/ui/BackLink.tsx +28 -0
- package/src/ui/Button.tsx +167 -0
- package/src/ui/ConfirmDialog.tsx +141 -0
- package/src/ui/Field.tsx +45 -0
- package/src/ui/Input.tsx +183 -0
- package/src/ui/ListRow.tsx +88 -0
- package/src/ui/Page.tsx +151 -0
- package/src/ui/Text.tsx +77 -0
- package/src/ui/Tooltip.tsx +85 -0
- package/src/ui/popup.ts +216 -0
- package/src/workspace/permissions.ts +17 -0
- package/src/workspace/types.ts +12 -0
- package/src/workspace-path.ts +98 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
// packages/studio/src/chat/DocListCard.tsx
|
|
2
|
+
//
|
|
3
|
+
// Renders listDocs / searchDocs tool results as a card of documents that link
|
|
4
|
+
// into the editor. Content models are user-defined, so rows lean on the
|
|
5
|
+
// server-derived `title` and fall back to the slug.
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { Link } from "react-router";
|
|
8
|
+
import * as stylex from "@stylexjs/stylex";
|
|
9
|
+
import { colors, radius, space, type } from "../styles/tokens.stylex";
|
|
10
|
+
import { contentDocPath } from "../workspace-path";
|
|
11
|
+
import { useWorkspaceNav } from "../chrome/WorkspaceNavContext";
|
|
12
|
+
import { ChevronDownIcon, FileIcon } from "./icons";
|
|
13
|
+
|
|
14
|
+
const hover = "@media (hover: hover)";
|
|
15
|
+
|
|
16
|
+
export type DocCardItem = {
|
|
17
|
+
locale: string;
|
|
18
|
+
type: string;
|
|
19
|
+
slug: string;
|
|
20
|
+
title?: string | null;
|
|
21
|
+
path?: string | null;
|
|
22
|
+
/** Working tree status against HEAD (listDocs). */
|
|
23
|
+
status?: "clean" | "modified" | "added" | "conflict";
|
|
24
|
+
/** Which copy a search matched: `head` or `tree` (searchDocs). */
|
|
25
|
+
source?: string;
|
|
26
|
+
excerpt?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** Badge text for a card row; clean/committed docs get none. */
|
|
30
|
+
export function docCardBadge(
|
|
31
|
+
doc: Pick<DocCardItem, "status" | "source">,
|
|
32
|
+
): "new" | "modified" | "conflict" | null {
|
|
33
|
+
if (doc.status === "added") return "new";
|
|
34
|
+
if (doc.status === "modified" || doc.status === "conflict") return doc.status;
|
|
35
|
+
if (doc.source === "tree") return "modified";
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const COLLAPSED_ROWS = 6;
|
|
40
|
+
|
|
41
|
+
export function DocListCard({
|
|
42
|
+
items,
|
|
43
|
+
total,
|
|
44
|
+
workspaceId,
|
|
45
|
+
emptyLabel = "No documents",
|
|
46
|
+
}: {
|
|
47
|
+
items: DocCardItem[];
|
|
48
|
+
/** Total available when the tool truncated its result. */
|
|
49
|
+
total?: number;
|
|
50
|
+
workspaceId: string;
|
|
51
|
+
emptyLabel?: string;
|
|
52
|
+
}) {
|
|
53
|
+
const [expanded, setExpanded] = useState(false);
|
|
54
|
+
if (items.length === 0) {
|
|
55
|
+
return <div {...stylex.props(styles.card, styles.empty)}>{emptyLabel}</div>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const groups = groupByType(items);
|
|
59
|
+
const multiType = groups.length > 1;
|
|
60
|
+
const multiLocale = new Set(items.map((d) => d.locale)).size > 1;
|
|
61
|
+
const hidden = expanded ? 0 : Math.max(0, items.length - COLLAPSED_ROWS);
|
|
62
|
+
const truncated = total !== undefined && total > items.length ? total - items.length : 0;
|
|
63
|
+
|
|
64
|
+
let budget = expanded ? Infinity : COLLAPSED_ROWS;
|
|
65
|
+
return (
|
|
66
|
+
<div {...stylex.props(styles.card)}>
|
|
67
|
+
{groups.map(([groupType, docs]) => {
|
|
68
|
+
if (budget <= 0) return null;
|
|
69
|
+
const shown = docs.slice(0, budget);
|
|
70
|
+
budget -= shown.length;
|
|
71
|
+
return (
|
|
72
|
+
<div key={groupType}>
|
|
73
|
+
{multiType ? (
|
|
74
|
+
<div {...stylex.props(styles.groupLabel)}>
|
|
75
|
+
{groupType}
|
|
76
|
+
<span {...stylex.props(styles.groupCount)}>{docs.length}</span>
|
|
77
|
+
</div>
|
|
78
|
+
) : null}
|
|
79
|
+
{shown.map((doc) => (
|
|
80
|
+
<DocRow
|
|
81
|
+
key={`${doc.locale}/${doc.type}/${doc.slug}`}
|
|
82
|
+
doc={doc}
|
|
83
|
+
workspaceId={workspaceId}
|
|
84
|
+
showLocale={multiLocale}
|
|
85
|
+
/>
|
|
86
|
+
))}
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
})}
|
|
90
|
+
{hidden > 0 || expanded ? (
|
|
91
|
+
<button
|
|
92
|
+
type="button"
|
|
93
|
+
onClick={() => setExpanded((v) => !v)}
|
|
94
|
+
{...stylex.props(styles.more)}
|
|
95
|
+
>
|
|
96
|
+
<span {...stylex.props(styles.moreIcon, expanded && styles.moreIconOpen)}>
|
|
97
|
+
<ChevronDownIcon size={11} />
|
|
98
|
+
</span>
|
|
99
|
+
{expanded ? "Show fewer" : `Show all ${items.length}`}
|
|
100
|
+
</button>
|
|
101
|
+
) : null}
|
|
102
|
+
{truncated > 0 ? (
|
|
103
|
+
<div {...stylex.props(styles.footnote)}>{truncated} more not shown</div>
|
|
104
|
+
) : null}
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function DocRow({
|
|
110
|
+
doc,
|
|
111
|
+
workspaceId,
|
|
112
|
+
showLocale,
|
|
113
|
+
}: {
|
|
114
|
+
doc: DocCardItem;
|
|
115
|
+
workspaceId: string;
|
|
116
|
+
showLocale: boolean;
|
|
117
|
+
}) {
|
|
118
|
+
const nav = useWorkspaceNav();
|
|
119
|
+
const to = nav
|
|
120
|
+
? contentDocPath(
|
|
121
|
+
nav.workspaceSlug,
|
|
122
|
+
doc.type,
|
|
123
|
+
doc.slug,
|
|
124
|
+
doc.locale,
|
|
125
|
+
nav.defaultLocale,
|
|
126
|
+
)
|
|
127
|
+
: "#";
|
|
128
|
+
const title = doc.title?.trim() || doc.slug;
|
|
129
|
+
const status = docCardBadge(doc);
|
|
130
|
+
const secondary = doc.path ?? `${doc.type}/${doc.slug}`;
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<Link to={to} {...stylex.props(styles.row)}>
|
|
134
|
+
<span {...stylex.props(styles.line)}>
|
|
135
|
+
<span {...stylex.props(styles.icon)}>
|
|
136
|
+
<FileIcon size={13} />
|
|
137
|
+
</span>
|
|
138
|
+
<span {...stylex.props(styles.title)}>{title}</span>
|
|
139
|
+
{showLocale ? <span {...stylex.props(styles.locale)}>{doc.locale}</span> : null}
|
|
140
|
+
{status ? (
|
|
141
|
+
<span
|
|
142
|
+
{...stylex.props(
|
|
143
|
+
styles.badge,
|
|
144
|
+
status === "new" && styles.badgeNew,
|
|
145
|
+
status === "conflict" && styles.badgeConflict,
|
|
146
|
+
)}
|
|
147
|
+
>
|
|
148
|
+
{status}
|
|
149
|
+
</span>
|
|
150
|
+
) : null}
|
|
151
|
+
<span {...stylex.props(styles.path)} title={secondary}>
|
|
152
|
+
{secondary}
|
|
153
|
+
</span>
|
|
154
|
+
</span>
|
|
155
|
+
{doc.excerpt ? <span {...stylex.props(styles.excerpt)}>{doc.excerpt}</span> : null}
|
|
156
|
+
</Link>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function groupByType(items: DocCardItem[]): Array<[string, DocCardItem[]]> {
|
|
161
|
+
const map = new Map<string, DocCardItem[]>();
|
|
162
|
+
for (const item of items) {
|
|
163
|
+
const list = map.get(item.type) ?? [];
|
|
164
|
+
list.push(item);
|
|
165
|
+
map.set(item.type, list);
|
|
166
|
+
}
|
|
167
|
+
return [...map.entries()];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const styles = stylex.create({
|
|
171
|
+
card: {
|
|
172
|
+
display: "flex",
|
|
173
|
+
flexDirection: "column",
|
|
174
|
+
paddingBlock: 2,
|
|
175
|
+
borderWidth: 1,
|
|
176
|
+
borderStyle: "solid",
|
|
177
|
+
borderColor: colors.border,
|
|
178
|
+
borderRadius: radius.md,
|
|
179
|
+
backgroundColor: colors.bgSurface,
|
|
180
|
+
overflow: "hidden",
|
|
181
|
+
},
|
|
182
|
+
empty: {
|
|
183
|
+
paddingInline: space.md,
|
|
184
|
+
paddingBlock: space.sm,
|
|
185
|
+
fontSize: type.sm,
|
|
186
|
+
color: colors.textMuted,
|
|
187
|
+
},
|
|
188
|
+
groupLabel: {
|
|
189
|
+
display: "flex",
|
|
190
|
+
alignItems: "center",
|
|
191
|
+
gap: space.sm,
|
|
192
|
+
paddingInline: space.md,
|
|
193
|
+
paddingTop: 6,
|
|
194
|
+
paddingBottom: 2,
|
|
195
|
+
fontSize: type.xs,
|
|
196
|
+
fontWeight: 500,
|
|
197
|
+
textTransform: "capitalize",
|
|
198
|
+
color: colors.textMuted,
|
|
199
|
+
},
|
|
200
|
+
groupCount: {
|
|
201
|
+
fontWeight: 400,
|
|
202
|
+
opacity: 0.8,
|
|
203
|
+
},
|
|
204
|
+
row: {
|
|
205
|
+
display: "flex",
|
|
206
|
+
flexDirection: "column",
|
|
207
|
+
gap: 2,
|
|
208
|
+
paddingInline: space.md,
|
|
209
|
+
paddingBlock: 6,
|
|
210
|
+
color: colors.text,
|
|
211
|
+
textDecoration: "none",
|
|
212
|
+
[hover]: {
|
|
213
|
+
":hover": { backgroundColor: colors.bgHover },
|
|
214
|
+
},
|
|
215
|
+
":focus-visible": {
|
|
216
|
+
outlineWidth: 2,
|
|
217
|
+
outlineStyle: "solid",
|
|
218
|
+
outlineColor: colors.focus,
|
|
219
|
+
outlineOffset: -2,
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
line: {
|
|
223
|
+
display: "flex",
|
|
224
|
+
minWidth: 0,
|
|
225
|
+
alignItems: "center",
|
|
226
|
+
gap: space.sm,
|
|
227
|
+
},
|
|
228
|
+
icon: {
|
|
229
|
+
display: "inline-flex",
|
|
230
|
+
flexShrink: 0,
|
|
231
|
+
color: colors.textMuted,
|
|
232
|
+
},
|
|
233
|
+
title: {
|
|
234
|
+
minWidth: 0,
|
|
235
|
+
flexShrink: 1,
|
|
236
|
+
overflow: "hidden",
|
|
237
|
+
textOverflow: "ellipsis",
|
|
238
|
+
whiteSpace: "nowrap",
|
|
239
|
+
fontSize: type.sm,
|
|
240
|
+
fontWeight: 500,
|
|
241
|
+
},
|
|
242
|
+
locale: {
|
|
243
|
+
flexShrink: 0,
|
|
244
|
+
fontSize: type.xs,
|
|
245
|
+
textTransform: "uppercase",
|
|
246
|
+
color: colors.textMuted,
|
|
247
|
+
},
|
|
248
|
+
badge: {
|
|
249
|
+
flexShrink: 0,
|
|
250
|
+
paddingInline: space.xs,
|
|
251
|
+
borderRadius: radius.sm,
|
|
252
|
+
backgroundColor: colors.bgActive,
|
|
253
|
+
fontSize: type.xs,
|
|
254
|
+
color: colors.textMuted,
|
|
255
|
+
},
|
|
256
|
+
badgeNew: {
|
|
257
|
+
backgroundColor: colors.accentMuted,
|
|
258
|
+
color: colors.accent,
|
|
259
|
+
},
|
|
260
|
+
badgeConflict: {
|
|
261
|
+
color: colors.danger,
|
|
262
|
+
borderColor: colors.danger,
|
|
263
|
+
},
|
|
264
|
+
// Right-aligned; yields to the title but keeps at least a readable tail.
|
|
265
|
+
path: {
|
|
266
|
+
marginLeft: "auto",
|
|
267
|
+
minWidth: 0,
|
|
268
|
+
maxWidth: "60%",
|
|
269
|
+
flexShrink: 2,
|
|
270
|
+
overflow: "hidden",
|
|
271
|
+
textOverflow: "ellipsis",
|
|
272
|
+
whiteSpace: "nowrap",
|
|
273
|
+
direction: "rtl",
|
|
274
|
+
textAlign: "right",
|
|
275
|
+
fontFamily: type.mono,
|
|
276
|
+
fontSize: type.xs,
|
|
277
|
+
color: colors.textMuted,
|
|
278
|
+
},
|
|
279
|
+
excerpt: {
|
|
280
|
+
paddingLeft: 21, // icon (13) + gap
|
|
281
|
+
fontSize: type.xs,
|
|
282
|
+
lineHeight: 1.45,
|
|
283
|
+
color: colors.textMuted,
|
|
284
|
+
display: "-webkit-box",
|
|
285
|
+
WebkitLineClamp: 2,
|
|
286
|
+
WebkitBoxOrient: "vertical",
|
|
287
|
+
overflow: "hidden",
|
|
288
|
+
},
|
|
289
|
+
more: {
|
|
290
|
+
display: "inline-flex",
|
|
291
|
+
alignItems: "center",
|
|
292
|
+
gap: space.xs,
|
|
293
|
+
alignSelf: "flex-start",
|
|
294
|
+
marginTop: space.xs,
|
|
295
|
+
marginInline: space.sm,
|
|
296
|
+
paddingInline: space.sm,
|
|
297
|
+
height: 24,
|
|
298
|
+
borderWidth: 0,
|
|
299
|
+
borderRadius: radius.sm,
|
|
300
|
+
backgroundColor: "transparent",
|
|
301
|
+
fontSize: type.xs,
|
|
302
|
+
color: colors.textMuted,
|
|
303
|
+
cursor: "pointer",
|
|
304
|
+
[hover]: {
|
|
305
|
+
":hover": { backgroundColor: colors.bgHover, color: colors.text },
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
moreIcon: {
|
|
309
|
+
display: "inline-flex",
|
|
310
|
+
transitionProperty: "transform",
|
|
311
|
+
transitionDuration: "120ms",
|
|
312
|
+
},
|
|
313
|
+
moreIconOpen: {
|
|
314
|
+
transform: "rotate(180deg)",
|
|
315
|
+
},
|
|
316
|
+
footnote: {
|
|
317
|
+
paddingInline: space.md,
|
|
318
|
+
paddingTop: space.xs,
|
|
319
|
+
fontSize: type.xs,
|
|
320
|
+
color: colors.textMuted,
|
|
321
|
+
},
|
|
322
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// packages/studio/src/chat/LiveStatus.tsx
|
|
2
|
+
//
|
|
3
|
+
// One-line live status for a chat turn: shimmering label that tracks the
|
|
4
|
+
// current thought or tool, plus an elapsed timer. Stays a single row so
|
|
5
|
+
// thinking / acting doesn't stack into a transcript of its own.
|
|
6
|
+
import { useEffect, useRef, useState } from "react";
|
|
7
|
+
import * as stylex from "@stylexjs/stylex";
|
|
8
|
+
import type { UIMessage } from "ai";
|
|
9
|
+
import { colors, space, type } from "../styles/tokens.stylex";
|
|
10
|
+
import { formatElapsed, liveActivity, type LiveActivity } from "./chat-helpers";
|
|
11
|
+
import { SparkIcon } from "./icons";
|
|
12
|
+
import { Shimmer } from "./Shimmer";
|
|
13
|
+
|
|
14
|
+
export function LiveStatus({
|
|
15
|
+
parts,
|
|
16
|
+
status,
|
|
17
|
+
}: {
|
|
18
|
+
parts: UIMessage["parts"] | undefined;
|
|
19
|
+
status: "submitted" | "streaming" | "ready" | "error";
|
|
20
|
+
}) {
|
|
21
|
+
const activity = liveActivity(parts, status);
|
|
22
|
+
if (!activity) return null;
|
|
23
|
+
return <LiveStatusLine activity={activity} />;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function activityKey(activity: LiveActivity) {
|
|
27
|
+
return activity.kind === "tool" ? `tool:${activity.label}` : activity.kind;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function LiveStatusLine({ activity }: { activity: LiveActivity }) {
|
|
31
|
+
const key = activityKey(activity);
|
|
32
|
+
const started = useRef({ key, at: Date.now() });
|
|
33
|
+
if (started.current.key !== key) {
|
|
34
|
+
started.current = { key, at: Date.now() };
|
|
35
|
+
}
|
|
36
|
+
const [now, setNow] = useState(() => Date.now());
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const id = window.setInterval(() => setNow(Date.now()), 100);
|
|
39
|
+
return () => window.clearInterval(id);
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<p {...stylex.props(styles.row)} aria-live="polite" aria-atomic="true">
|
|
44
|
+
<span {...stylex.props(styles.icon)}>
|
|
45
|
+
<SparkIcon size={12} />
|
|
46
|
+
</span>
|
|
47
|
+
<span {...stylex.props(styles.label)}>
|
|
48
|
+
<Shimmer>{activity.label}</Shimmer>
|
|
49
|
+
</span>
|
|
50
|
+
<span {...stylex.props(styles.time)}>{formatElapsed(now - started.current.at)}</span>
|
|
51
|
+
</p>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const styles = stylex.create({
|
|
56
|
+
row: {
|
|
57
|
+
display: "flex",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
gap: space.sm,
|
|
60
|
+
minHeight: 20,
|
|
61
|
+
margin: 0,
|
|
62
|
+
fontSize: type.sm,
|
|
63
|
+
color: colors.textMuted,
|
|
64
|
+
},
|
|
65
|
+
icon: {
|
|
66
|
+
display: "inline-flex",
|
|
67
|
+
flexShrink: 0,
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
justifyContent: "center",
|
|
70
|
+
},
|
|
71
|
+
label: {
|
|
72
|
+
minWidth: 0,
|
|
73
|
+
flex: 1,
|
|
74
|
+
overflow: "hidden",
|
|
75
|
+
textOverflow: "ellipsis",
|
|
76
|
+
whiteSpace: "nowrap",
|
|
77
|
+
},
|
|
78
|
+
time: {
|
|
79
|
+
flexShrink: 0,
|
|
80
|
+
fontVariantNumeric: "tabular-nums",
|
|
81
|
+
color: colors.textMuted,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// packages/studio/src/chat/MentionPopover.tsx
|
|
2
|
+
import { useEffect, useMemo, useState, type RefObject } from "react";
|
|
3
|
+
import { Popover } from "@base-ui/react/popover";
|
|
4
|
+
import * as stylex from "@stylexjs/stylex";
|
|
5
|
+
import { fetchDocs } from "../api";
|
|
6
|
+
import type { DocRef } from "../chrome/EditorFocusContext";
|
|
7
|
+
import { colors, type } from "../styles/tokens.stylex";
|
|
8
|
+
import { cx, popup, popupClassName } from "../ui/popup";
|
|
9
|
+
import { FileIcon } from "./icons";
|
|
10
|
+
import { filterDocs, type MentionDocItem as DocItem } from "./chat-helpers";
|
|
11
|
+
|
|
12
|
+
/** Keys the composer forwards while the popover is open. */
|
|
13
|
+
export type MentionKey = "ArrowDown" | "ArrowUp" | "Enter" | "Tab" | "Escape";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Inline document picker anchored to the composer while the user types an
|
|
17
|
+
* `@query`. The textarea keeps focus, so the composer forwards navigation keys
|
|
18
|
+
* through `keyHandlerRef` instead of the popover owning the keyboard.
|
|
19
|
+
*/
|
|
20
|
+
export function MentionPopover({
|
|
21
|
+
workspaceId,
|
|
22
|
+
anchor,
|
|
23
|
+
query,
|
|
24
|
+
exclude,
|
|
25
|
+
keyHandlerRef,
|
|
26
|
+
onSelect,
|
|
27
|
+
onClose,
|
|
28
|
+
}: {
|
|
29
|
+
workspaceId: string;
|
|
30
|
+
anchor: RefObject<HTMLElement | null>;
|
|
31
|
+
query: string;
|
|
32
|
+
exclude: DocRef[];
|
|
33
|
+
keyHandlerRef: RefObject<((key: MentionKey) => void) | null>;
|
|
34
|
+
onSelect: (ref: DocRef) => void;
|
|
35
|
+
onClose: () => void;
|
|
36
|
+
}) {
|
|
37
|
+
const [docs, setDocs] = useState<DocItem[]>([]);
|
|
38
|
+
const [active, setActive] = useState(0);
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
let cancelled = false;
|
|
42
|
+
fetchDocs(workspaceId)
|
|
43
|
+
.then((res) => {
|
|
44
|
+
if (!cancelled) setDocs(res.docs);
|
|
45
|
+
})
|
|
46
|
+
.catch(() => {
|
|
47
|
+
if (!cancelled) setDocs([]);
|
|
48
|
+
});
|
|
49
|
+
return () => {
|
|
50
|
+
cancelled = true;
|
|
51
|
+
};
|
|
52
|
+
}, [workspaceId]);
|
|
53
|
+
|
|
54
|
+
const items = useMemo(() => {
|
|
55
|
+
const excluded = new Set(exclude.map((r) => `${r.locale}/${r.type}/${r.slug}`));
|
|
56
|
+
return filterDocs(
|
|
57
|
+
docs.filter((d) => !excluded.has(`${d.locale}/${d.type}/${d.slug}`)),
|
|
58
|
+
query,
|
|
59
|
+
);
|
|
60
|
+
}, [docs, query, exclude]);
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
setActive(0);
|
|
64
|
+
}, [query]);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
keyHandlerRef.current = (key) => {
|
|
68
|
+
if (key === "ArrowDown") setActive((i) => Math.min(i + 1, Math.max(items.length - 1, 0)));
|
|
69
|
+
else if (key === "ArrowUp") setActive((i) => Math.max(i - 1, 0));
|
|
70
|
+
else if (key === "Enter" || key === "Tab") {
|
|
71
|
+
const item = items[active];
|
|
72
|
+
if (item) onSelect({ locale: item.locale, type: item.type, slug: item.slug });
|
|
73
|
+
else onClose();
|
|
74
|
+
} else if (key === "Escape") onClose();
|
|
75
|
+
};
|
|
76
|
+
return () => {
|
|
77
|
+
keyHandlerRef.current = null;
|
|
78
|
+
};
|
|
79
|
+
}, [items, active, onSelect, onClose, keyHandlerRef]);
|
|
80
|
+
|
|
81
|
+
const activeId = items[active]
|
|
82
|
+
? `mention-${items[active].locale}-${items[active].type}-${items[active].slug}`
|
|
83
|
+
: undefined;
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Popover.Root
|
|
87
|
+
open
|
|
88
|
+
modal={false}
|
|
89
|
+
onOpenChange={(next) => {
|
|
90
|
+
if (!next) onClose();
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
<Popover.Portal>
|
|
94
|
+
<Popover.Positioner
|
|
95
|
+
anchor={anchor}
|
|
96
|
+
side="top"
|
|
97
|
+
align="start"
|
|
98
|
+
sideOffset={6}
|
|
99
|
+
className={cx(popup.positioner)}
|
|
100
|
+
>
|
|
101
|
+
<Popover.Popup
|
|
102
|
+
initialFocus={false}
|
|
103
|
+
finalFocus={false}
|
|
104
|
+
role="listbox"
|
|
105
|
+
aria-label="Mention a document"
|
|
106
|
+
aria-activedescendant={activeId}
|
|
107
|
+
className={(state) => popupClassName(state, styles.popup)}
|
|
108
|
+
>
|
|
109
|
+
{items.length === 0 ? (
|
|
110
|
+
<p {...stylex.props(popup.empty)}>
|
|
111
|
+
{docs.length === 0 ? "No documents yet" : "No matches"}
|
|
112
|
+
</p>
|
|
113
|
+
) : (
|
|
114
|
+
items.map((item, i) => (
|
|
115
|
+
<div
|
|
116
|
+
key={`${item.locale}/${item.type}/${item.slug}`}
|
|
117
|
+
id={`mention-${item.locale}-${item.type}-${item.slug}`}
|
|
118
|
+
role="option"
|
|
119
|
+
aria-selected={i === active}
|
|
120
|
+
onMouseEnter={() => setActive(i)}
|
|
121
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
122
|
+
onClick={() => onSelect({ locale: item.locale, type: item.type, slug: item.slug })}
|
|
123
|
+
{...stylex.props(popup.item, styles.item, i === active && popup.itemHighlighted)}
|
|
124
|
+
>
|
|
125
|
+
<FileIcon size={12} />
|
|
126
|
+
<span {...stylex.props(styles.label)}>
|
|
127
|
+
{item.type}/{item.slug}
|
|
128
|
+
</span>
|
|
129
|
+
<span {...stylex.props(popup.itemMeta)}>
|
|
130
|
+
{item.locale}
|
|
131
|
+
{item.status === "added"
|
|
132
|
+
? " · new"
|
|
133
|
+
: item.status !== "clean"
|
|
134
|
+
? ` · ${item.status}`
|
|
135
|
+
: ""}
|
|
136
|
+
</span>
|
|
137
|
+
</div>
|
|
138
|
+
))
|
|
139
|
+
)}
|
|
140
|
+
</Popover.Popup>
|
|
141
|
+
</Popover.Positioner>
|
|
142
|
+
</Popover.Portal>
|
|
143
|
+
</Popover.Root>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const styles = stylex.create({
|
|
148
|
+
popup: {
|
|
149
|
+
width: "var(--anchor-width)",
|
|
150
|
+
maxHeight: "min(var(--available-height), 240px)",
|
|
151
|
+
},
|
|
152
|
+
item: {
|
|
153
|
+
cursor: "pointer",
|
|
154
|
+
color: colors.text,
|
|
155
|
+
},
|
|
156
|
+
label: {
|
|
157
|
+
fontFamily: type.mono,
|
|
158
|
+
fontSize: type.xs,
|
|
159
|
+
minWidth: 0,
|
|
160
|
+
overflow: "hidden",
|
|
161
|
+
textOverflow: "ellipsis",
|
|
162
|
+
whiteSpace: "nowrap",
|
|
163
|
+
},
|
|
164
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// packages/studio/src/chat/ModelPicker.tsx
|
|
2
|
+
import { Select } from "@base-ui/react/select";
|
|
3
|
+
import * as stylex from "@stylexjs/stylex";
|
|
4
|
+
import { colors, radius, space, type } from "../styles/tokens.stylex";
|
|
5
|
+
import { cx, popup, popupClassName } from "../ui/popup";
|
|
6
|
+
import { useChatUI } from "./ChatProvider";
|
|
7
|
+
import { CheckIcon, ChevronDownIcon } from "./icons";
|
|
8
|
+
|
|
9
|
+
const hover = "@media (hover: hover)";
|
|
10
|
+
|
|
11
|
+
export function ModelPicker() {
|
|
12
|
+
const ui = useChatUI();
|
|
13
|
+
if (ui.models.length === 0) return null;
|
|
14
|
+
|
|
15
|
+
const current = ui.models.find((m) => m.id === ui.model) ?? ui.models[0]!;
|
|
16
|
+
const single = ui.models.length < 2;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Select.Root
|
|
20
|
+
value={current.id}
|
|
21
|
+
onValueChange={(next) => {
|
|
22
|
+
if (typeof next === "string") ui.setModel(next);
|
|
23
|
+
}}
|
|
24
|
+
items={ui.models.map((m) => ({ value: m.id, label: m.label }))}
|
|
25
|
+
disabled={single}
|
|
26
|
+
>
|
|
27
|
+
<Select.Trigger aria-label="Model" className={cx(styles.trigger)}>
|
|
28
|
+
<Select.Value className={cx(styles.label)} />
|
|
29
|
+
{single ? null : (
|
|
30
|
+
<Select.Icon className={cx(styles.icon)}>
|
|
31
|
+
<ChevronDownIcon size={11} />
|
|
32
|
+
</Select.Icon>
|
|
33
|
+
)}
|
|
34
|
+
</Select.Trigger>
|
|
35
|
+
<Select.Portal>
|
|
36
|
+
<Select.Positioner
|
|
37
|
+
side="top"
|
|
38
|
+
align="end"
|
|
39
|
+
sideOffset={6}
|
|
40
|
+
alignItemWithTrigger={false}
|
|
41
|
+
className={cx(popup.positioner)}
|
|
42
|
+
>
|
|
43
|
+
<Select.Popup className={(state) => popupClassName(state, styles.popup)}>
|
|
44
|
+
<Select.List>
|
|
45
|
+
{ui.models.map((m) => (
|
|
46
|
+
<Select.Item
|
|
47
|
+
key={m.id}
|
|
48
|
+
value={m.id}
|
|
49
|
+
label={m.label}
|
|
50
|
+
className={(state) =>
|
|
51
|
+
cx(
|
|
52
|
+
popup.item,
|
|
53
|
+
state.highlighted && popup.itemHighlighted,
|
|
54
|
+
state.selected && popup.itemSelected,
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
>
|
|
58
|
+
<span {...stylex.props(popup.itemIndicator)}>
|
|
59
|
+
<Select.ItemIndicator>
|
|
60
|
+
<CheckIcon size={12} />
|
|
61
|
+
</Select.ItemIndicator>
|
|
62
|
+
</span>
|
|
63
|
+
<Select.ItemText>{m.label}</Select.ItemText>
|
|
64
|
+
<span {...stylex.props(popup.itemMeta)}>{m.provider}</span>
|
|
65
|
+
</Select.Item>
|
|
66
|
+
))}
|
|
67
|
+
</Select.List>
|
|
68
|
+
</Select.Popup>
|
|
69
|
+
</Select.Positioner>
|
|
70
|
+
</Select.Portal>
|
|
71
|
+
</Select.Root>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const styles = stylex.create({
|
|
76
|
+
trigger: {
|
|
77
|
+
display: "inline-flex",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
gap: 6,
|
|
80
|
+
height: 28,
|
|
81
|
+
paddingInline: space.sm,
|
|
82
|
+
borderWidth: 0,
|
|
83
|
+
borderRadius: radius.md,
|
|
84
|
+
backgroundColor: "transparent",
|
|
85
|
+
color: colors.textMuted,
|
|
86
|
+
fontFamily: type.sans,
|
|
87
|
+
fontSize: type.sm,
|
|
88
|
+
cursor: "pointer",
|
|
89
|
+
outline: "none",
|
|
90
|
+
[hover]: {
|
|
91
|
+
":hover": { backgroundColor: colors.bgHover, color: colors.text },
|
|
92
|
+
},
|
|
93
|
+
":focus-visible": {
|
|
94
|
+
outlineWidth: 2,
|
|
95
|
+
outlineStyle: "solid",
|
|
96
|
+
outlineColor: colors.focus,
|
|
97
|
+
outlineOffset: -1,
|
|
98
|
+
},
|
|
99
|
+
":disabled": { cursor: "default" },
|
|
100
|
+
},
|
|
101
|
+
label: {
|
|
102
|
+
maxWidth: 140,
|
|
103
|
+
overflow: "hidden",
|
|
104
|
+
textOverflow: "ellipsis",
|
|
105
|
+
whiteSpace: "nowrap",
|
|
106
|
+
},
|
|
107
|
+
icon: {
|
|
108
|
+
display: "inline-flex",
|
|
109
|
+
},
|
|
110
|
+
popup: {
|
|
111
|
+
minWidth: 200,
|
|
112
|
+
},
|
|
113
|
+
});
|