@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,215 @@
|
|
|
1
|
+
// packages/studio/src/chrome/ContentApiPopover.tsx
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Popover } from "@base-ui/react/popover";
|
|
4
|
+
import * as stylex from "@stylexjs/stylex";
|
|
5
|
+
import { publicApiUrl } from "../studio-config";
|
|
6
|
+
import { colors, radius, space, type } from "../styles/tokens.stylex";
|
|
7
|
+
import { cx, popup, popupClassName } from "../ui/popup";
|
|
8
|
+
import { contentApiLinks } from "./content-api-url";
|
|
9
|
+
import { ApiIcon } from "./icons";
|
|
10
|
+
|
|
11
|
+
const hover = "@media (hover: hover)";
|
|
12
|
+
|
|
13
|
+
function CopyUrl({ label, href }: { label: string; href: string }) {
|
|
14
|
+
const [copied, setCopied] = useState(false);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!copied) return;
|
|
18
|
+
const id = window.setTimeout(() => setCopied(false), 1500);
|
|
19
|
+
return () => window.clearTimeout(id);
|
|
20
|
+
}, [copied]);
|
|
21
|
+
|
|
22
|
+
async function copy() {
|
|
23
|
+
try {
|
|
24
|
+
await navigator.clipboard.writeText(href);
|
|
25
|
+
setCopied(true);
|
|
26
|
+
} catch {
|
|
27
|
+
setCopied(false);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div {...stylex.props(styles.row)}>
|
|
33
|
+
<p {...stylex.props(popup.groupLabel)}>{label}</p>
|
|
34
|
+
<div {...stylex.props(styles.urlRow)}>
|
|
35
|
+
<a
|
|
36
|
+
href={href}
|
|
37
|
+
target="_blank"
|
|
38
|
+
rel="noreferrer"
|
|
39
|
+
{...stylex.props(styles.href)}
|
|
40
|
+
>
|
|
41
|
+
{href}
|
|
42
|
+
</a>
|
|
43
|
+
<button
|
|
44
|
+
type="button"
|
|
45
|
+
onClick={() => void copy()}
|
|
46
|
+
aria-label={copied ? "Copied" : `Copy ${label} URL`}
|
|
47
|
+
{...stylex.props(styles.copy)}
|
|
48
|
+
>
|
|
49
|
+
{copied ? "Copied" : "Copy"}
|
|
50
|
+
</button>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function ContentApiPopover({
|
|
57
|
+
workspaceId,
|
|
58
|
+
branch,
|
|
59
|
+
defaultBranch,
|
|
60
|
+
pathname,
|
|
61
|
+
search,
|
|
62
|
+
}: {
|
|
63
|
+
workspaceId: string;
|
|
64
|
+
branch?: string | null;
|
|
65
|
+
defaultBranch?: string | null;
|
|
66
|
+
pathname: string;
|
|
67
|
+
search?: string;
|
|
68
|
+
}) {
|
|
69
|
+
const links = contentApiLinks({
|
|
70
|
+
apiUrl: publicApiUrl(),
|
|
71
|
+
workspaceId,
|
|
72
|
+
branch,
|
|
73
|
+
defaultBranch,
|
|
74
|
+
pathname,
|
|
75
|
+
search,
|
|
76
|
+
});
|
|
77
|
+
const locked = Boolean(branch && defaultBranch && branch !== defaultBranch);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Popover.Root>
|
|
81
|
+
<Popover.Trigger aria-label="Content API" className={cx(styles.trigger)}>
|
|
82
|
+
<ApiIcon />
|
|
83
|
+
<span>API</span>
|
|
84
|
+
</Popover.Trigger>
|
|
85
|
+
<Popover.Portal>
|
|
86
|
+
<Popover.Positioner
|
|
87
|
+
side="bottom"
|
|
88
|
+
align="start"
|
|
89
|
+
sideOffset={6}
|
|
90
|
+
className={cx(popup.positioner)}
|
|
91
|
+
>
|
|
92
|
+
<Popover.Popup
|
|
93
|
+
aria-label="Content API"
|
|
94
|
+
className={(state) => popupClassName(state, styles.popup)}
|
|
95
|
+
>
|
|
96
|
+
<p {...stylex.props(popup.groupLabel)}>Content API</p>
|
|
97
|
+
<p {...stylex.props(styles.hint)}>
|
|
98
|
+
{locked
|
|
99
|
+
? "This branch needs the content token from Settings → General."
|
|
100
|
+
: "Default branch is public — no token. URLs use the workspace id."}
|
|
101
|
+
</p>
|
|
102
|
+
{links.map((link) => (
|
|
103
|
+
<CopyUrl key={link.href} label={link.label} href={link.href} />
|
|
104
|
+
))}
|
|
105
|
+
</Popover.Popup>
|
|
106
|
+
</Popover.Positioner>
|
|
107
|
+
</Popover.Portal>
|
|
108
|
+
</Popover.Root>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const styles = stylex.create({
|
|
113
|
+
trigger: {
|
|
114
|
+
display: "inline-flex",
|
|
115
|
+
alignItems: "center",
|
|
116
|
+
gap: space.xs,
|
|
117
|
+
minHeight: "24px",
|
|
118
|
+
paddingInline: space.xs,
|
|
119
|
+
borderWidth: 0,
|
|
120
|
+
backgroundColor: "transparent",
|
|
121
|
+
color: colors.textMuted,
|
|
122
|
+
fontSize: type.xs,
|
|
123
|
+
fontFamily: type.mono,
|
|
124
|
+
cursor: "pointer",
|
|
125
|
+
touchAction: "manipulation",
|
|
126
|
+
":focus-visible": {
|
|
127
|
+
outlineWidth: 2,
|
|
128
|
+
outlineStyle: "solid",
|
|
129
|
+
outlineColor: colors.focus,
|
|
130
|
+
outlineOffset: "-2px",
|
|
131
|
+
},
|
|
132
|
+
[hover]: {
|
|
133
|
+
":hover": {
|
|
134
|
+
color: colors.text,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
popup: {
|
|
139
|
+
width: "380px",
|
|
140
|
+
paddingBottom: space.md,
|
|
141
|
+
overflow: "hidden",
|
|
142
|
+
},
|
|
143
|
+
hint: {
|
|
144
|
+
margin: 0,
|
|
145
|
+
paddingInline: space.lg,
|
|
146
|
+
paddingBottom: space.sm,
|
|
147
|
+
fontFamily: type.mono,
|
|
148
|
+
fontSize: type.xs,
|
|
149
|
+
lineHeight: 1.45,
|
|
150
|
+
color: colors.textMuted,
|
|
151
|
+
},
|
|
152
|
+
row: {
|
|
153
|
+
display: "flex",
|
|
154
|
+
flexDirection: "column",
|
|
155
|
+
gap: space.xs,
|
|
156
|
+
paddingBottom: space.sm,
|
|
157
|
+
},
|
|
158
|
+
urlRow: {
|
|
159
|
+
display: "flex",
|
|
160
|
+
alignItems: "center",
|
|
161
|
+
gap: space.sm,
|
|
162
|
+
minWidth: 0,
|
|
163
|
+
marginInline: space.lg,
|
|
164
|
+
},
|
|
165
|
+
href: {
|
|
166
|
+
minWidth: 0,
|
|
167
|
+
flex: 1,
|
|
168
|
+
overflow: "hidden",
|
|
169
|
+
textOverflow: "ellipsis",
|
|
170
|
+
whiteSpace: "nowrap",
|
|
171
|
+
color: colors.text,
|
|
172
|
+
fontFamily: type.mono,
|
|
173
|
+
fontSize: type.xs,
|
|
174
|
+
textDecoration: "none",
|
|
175
|
+
[hover]: {
|
|
176
|
+
":hover": {
|
|
177
|
+
textDecoration: "underline",
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
":focus-visible": {
|
|
181
|
+
outlineWidth: 2,
|
|
182
|
+
outlineStyle: "solid",
|
|
183
|
+
outlineColor: colors.focus,
|
|
184
|
+
outlineOffset: 2,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
copy: {
|
|
188
|
+
flexShrink: 0,
|
|
189
|
+
minWidth: "52px",
|
|
190
|
+
minHeight: "24px",
|
|
191
|
+
paddingInline: space.sm,
|
|
192
|
+
borderWidth: 1,
|
|
193
|
+
borderStyle: "solid",
|
|
194
|
+
borderColor: colors.border,
|
|
195
|
+
borderRadius: radius.md,
|
|
196
|
+
backgroundColor: colors.bgSurface,
|
|
197
|
+
color: colors.textMuted,
|
|
198
|
+
fontSize: type.xs,
|
|
199
|
+
fontFamily: type.sans,
|
|
200
|
+
cursor: "pointer",
|
|
201
|
+
touchAction: "manipulation",
|
|
202
|
+
[hover]: {
|
|
203
|
+
":hover": {
|
|
204
|
+
color: colors.text,
|
|
205
|
+
backgroundColor: colors.bgHover,
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
":focus-visible": {
|
|
209
|
+
outlineWidth: 2,
|
|
210
|
+
outlineStyle: "solid",
|
|
211
|
+
outlineColor: colors.focus,
|
|
212
|
+
outlineOffset: 1,
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// packages/studio/src/chrome/EditorActionsContext.tsx
|
|
2
|
+
import {
|
|
3
|
+
createContext,
|
|
4
|
+
useCallback,
|
|
5
|
+
useContext,
|
|
6
|
+
useMemo,
|
|
7
|
+
useState,
|
|
8
|
+
} from "react";
|
|
9
|
+
|
|
10
|
+
export type EditorActions = {
|
|
11
|
+
save: (() => Promise<void>) | null;
|
|
12
|
+
revert: (() => Promise<void>) | null;
|
|
13
|
+
canRevert: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const EMPTY: EditorActions = {
|
|
17
|
+
save: null,
|
|
18
|
+
revert: null,
|
|
19
|
+
canRevert: false,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type EditorActionsContextValue = {
|
|
23
|
+
actions: EditorActions;
|
|
24
|
+
setActions: (actions: EditorActions) => void;
|
|
25
|
+
clear: () => void;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const EditorActionsContext = createContext<EditorActionsContextValue | null>(
|
|
29
|
+
null,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export function EditorActionsProvider({
|
|
33
|
+
children,
|
|
34
|
+
}: {
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
}) {
|
|
37
|
+
const [actions, setActionsState] = useState<EditorActions>(EMPTY);
|
|
38
|
+
const setActions = useCallback((next: EditorActions) => {
|
|
39
|
+
setActionsState(next);
|
|
40
|
+
}, []);
|
|
41
|
+
const clear = useCallback(() => setActionsState(EMPTY), []);
|
|
42
|
+
const value = useMemo(
|
|
43
|
+
() => ({ actions, setActions, clear }),
|
|
44
|
+
[actions, setActions, clear],
|
|
45
|
+
);
|
|
46
|
+
return (
|
|
47
|
+
<EditorActionsContext.Provider value={value}>
|
|
48
|
+
{children}
|
|
49
|
+
</EditorActionsContext.Provider>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function useEditorActions() {
|
|
54
|
+
return useContext(EditorActionsContext)?.actions ?? EMPTY;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function useSetEditorActions() {
|
|
58
|
+
const ctx = useContext(EditorActionsContext);
|
|
59
|
+
if (!ctx) {
|
|
60
|
+
throw new Error("useSetEditorActions must be used within EditorActionsProvider");
|
|
61
|
+
}
|
|
62
|
+
return ctx;
|
|
63
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// packages/studio/src/chrome/EditorFocusContext.tsx
|
|
2
|
+
//
|
|
3
|
+
// Bridge between the open document editor and the global AI chat.
|
|
4
|
+
// The editor publishes what is focused (doc, content, selection); the chat
|
|
5
|
+
// publishes which doc it is currently editing so the editor can pause autosave.
|
|
6
|
+
import {
|
|
7
|
+
createContext,
|
|
8
|
+
useCallback,
|
|
9
|
+
useContext,
|
|
10
|
+
useMemo,
|
|
11
|
+
useState,
|
|
12
|
+
} from "react";
|
|
13
|
+
|
|
14
|
+
export type DocRef = { locale: string; type: string; slug: string };
|
|
15
|
+
|
|
16
|
+
export type EditorSelection = { start: number; end: number };
|
|
17
|
+
|
|
18
|
+
export type EditorFocus = {
|
|
19
|
+
docRef: DocRef;
|
|
20
|
+
frontmatter: Record<string, unknown>;
|
|
21
|
+
body: string;
|
|
22
|
+
selection: EditorSelection | null;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function docKey(ref: DocRef): string {
|
|
26
|
+
return `${ref.locale}/${ref.type}/${ref.slug}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function sameDocRef(a: DocRef | null | undefined, b: DocRef | null | undefined) {
|
|
30
|
+
if (!a || !b) return false;
|
|
31
|
+
return a.locale === b.locale && a.type === b.type && a.slug === b.slug;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type EditorFocusContextValue = {
|
|
35
|
+
focus: EditorFocus | null;
|
|
36
|
+
setFocus: (focus: EditorFocus | null) => void;
|
|
37
|
+
/** docKey of the document the AI is currently writing to, if any. */
|
|
38
|
+
aiEditingDocKey: string | null;
|
|
39
|
+
setAiEditingDocKey: (key: string | null) => void;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const EditorFocusContext = createContext<EditorFocusContextValue | null>(null);
|
|
43
|
+
|
|
44
|
+
export function EditorFocusProvider({ children }: { children: React.ReactNode }) {
|
|
45
|
+
const [focus, setFocusState] = useState<EditorFocus | null>(null);
|
|
46
|
+
const [aiEditingDocKey, setAiEditingDocKey] = useState<string | null>(null);
|
|
47
|
+
const setFocus = useCallback((next: EditorFocus | null) => {
|
|
48
|
+
setFocusState(next);
|
|
49
|
+
}, []);
|
|
50
|
+
const value = useMemo(
|
|
51
|
+
() => ({ focus, setFocus, aiEditingDocKey, setAiEditingDocKey }),
|
|
52
|
+
[focus, setFocus, aiEditingDocKey],
|
|
53
|
+
);
|
|
54
|
+
return (
|
|
55
|
+
<EditorFocusContext.Provider value={value}>{children}</EditorFocusContext.Provider>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function useEditorFocus(): EditorFocusContextValue {
|
|
60
|
+
const ctx = useContext(EditorFocusContext);
|
|
61
|
+
if (!ctx) {
|
|
62
|
+
throw new Error("useEditorFocus must be used within EditorFocusProvider");
|
|
63
|
+
}
|
|
64
|
+
return ctx;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function useEditorFocusOptional(): EditorFocusContextValue | null {
|
|
68
|
+
return useContext(EditorFocusContext);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Fired by the chat when a document in the working tree was changed (write, create, undo). */
|
|
72
|
+
export const DOC_CHANGED_EVENT = "backmatter:doc-changed";
|
|
73
|
+
|
|
74
|
+
export type DocChangedDetail = { docRef: DocRef };
|
|
75
|
+
|
|
76
|
+
export function notifyDocChanged(docRef: DocRef) {
|
|
77
|
+
window.dispatchEvent(
|
|
78
|
+
new CustomEvent<DocChangedDetail>(DOC_CHANGED_EVENT, { detail: { docRef } }),
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// packages/studio/src/chrome/EditorStatusContext.tsx
|
|
2
|
+
import {
|
|
3
|
+
createContext,
|
|
4
|
+
useCallback,
|
|
5
|
+
useContext,
|
|
6
|
+
useMemo,
|
|
7
|
+
useState,
|
|
8
|
+
} from "react";
|
|
9
|
+
|
|
10
|
+
export type EditorStatus = {
|
|
11
|
+
locale: string | null;
|
|
12
|
+
/** committed | uncommitted | conflict */
|
|
13
|
+
status: string | null;
|
|
14
|
+
saveLabel: string | null;
|
|
15
|
+
saveTone: "muted" | "danger" | "success";
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const EMPTY: EditorStatus = {
|
|
19
|
+
locale: null,
|
|
20
|
+
status: null,
|
|
21
|
+
saveLabel: null,
|
|
22
|
+
saveTone: "muted",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type EditorStatusSetters = {
|
|
26
|
+
setStatus: (status: EditorStatus) => void;
|
|
27
|
+
clear: () => void;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type EditorStatusContextValue = {
|
|
31
|
+
status: EditorStatus;
|
|
32
|
+
setters: EditorStatusSetters;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const EditorStatusContext = createContext<EditorStatusContextValue | null>(
|
|
36
|
+
null,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
function sameStatus(a: EditorStatus, b: EditorStatus) {
|
|
40
|
+
return (
|
|
41
|
+
a.locale === b.locale &&
|
|
42
|
+
a.status === b.status &&
|
|
43
|
+
a.saveLabel === b.saveLabel &&
|
|
44
|
+
a.saveTone === b.saveTone
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function EditorStatusProvider({
|
|
49
|
+
children,
|
|
50
|
+
}: {
|
|
51
|
+
children: React.ReactNode;
|
|
52
|
+
}) {
|
|
53
|
+
const [status, setStatusState] = useState<EditorStatus>(EMPTY);
|
|
54
|
+
const setStatus = useCallback((next: EditorStatus) => {
|
|
55
|
+
setStatusState((prev) => (sameStatus(prev, next) ? prev : next));
|
|
56
|
+
}, []);
|
|
57
|
+
const clear = useCallback(() => setStatusState(EMPTY), []);
|
|
58
|
+
const setters = useMemo<EditorStatusSetters>(
|
|
59
|
+
() => ({ setStatus, clear }),
|
|
60
|
+
[setStatus, clear],
|
|
61
|
+
);
|
|
62
|
+
const value = useMemo(
|
|
63
|
+
() => ({ status, setters }),
|
|
64
|
+
[status, setters],
|
|
65
|
+
);
|
|
66
|
+
return (
|
|
67
|
+
<EditorStatusContext.Provider value={value}>
|
|
68
|
+
{children}
|
|
69
|
+
</EditorStatusContext.Provider>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function useEditorStatus() {
|
|
74
|
+
const ctx = useContext(EditorStatusContext);
|
|
75
|
+
return ctx?.status ?? EMPTY;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function useSetEditorStatus(): EditorStatusSetters {
|
|
79
|
+
const ctx = useContext(EditorStatusContext);
|
|
80
|
+
if (!ctx) {
|
|
81
|
+
throw new Error("useSetEditorStatus must be used within EditorStatusProvider");
|
|
82
|
+
}
|
|
83
|
+
return ctx.setters;
|
|
84
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// packages/studio/src/chrome/NavItem.tsx
|
|
2
|
+
import { NavLink } from "react-router";
|
|
3
|
+
import * as stylex from "@stylexjs/stylex";
|
|
4
|
+
import { colors, radius, space, type } from "../styles/tokens.stylex";
|
|
5
|
+
|
|
6
|
+
const hover = "@media (hover: hover)";
|
|
7
|
+
|
|
8
|
+
export function NavItem({
|
|
9
|
+
to,
|
|
10
|
+
children,
|
|
11
|
+
end,
|
|
12
|
+
active,
|
|
13
|
+
}: {
|
|
14
|
+
to: string;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
end?: boolean;
|
|
17
|
+
active?: boolean;
|
|
18
|
+
}) {
|
|
19
|
+
return (
|
|
20
|
+
<NavLink to={to} end={end} {...stylex.props(styles.anchor)}>
|
|
21
|
+
{({ isActive }) => {
|
|
22
|
+
const sx = stylex.props(
|
|
23
|
+
styles.item,
|
|
24
|
+
(active ?? isActive) && styles.itemActive,
|
|
25
|
+
);
|
|
26
|
+
return (
|
|
27
|
+
<span className={sx.className} style={sx.style}>
|
|
28
|
+
{children}
|
|
29
|
+
</span>
|
|
30
|
+
);
|
|
31
|
+
}}
|
|
32
|
+
</NavLink>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Plain link in the sidebar's nav style, for hrefs outside the router (site menu). */
|
|
37
|
+
export function NavAnchor({ href, children }: { href: string; children: React.ReactNode }) {
|
|
38
|
+
const sx = stylex.props(styles.item);
|
|
39
|
+
return (
|
|
40
|
+
<a href={href} {...stylex.props(styles.anchor)}>
|
|
41
|
+
<span className={sx.className} style={sx.style}>
|
|
42
|
+
{children}
|
|
43
|
+
</span>
|
|
44
|
+
</a>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const styles = stylex.create({
|
|
49
|
+
anchor: {
|
|
50
|
+
display: "block",
|
|
51
|
+
color: "inherit",
|
|
52
|
+
textDecoration: "none",
|
|
53
|
+
},
|
|
54
|
+
item: {
|
|
55
|
+
display: "flex",
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
gap: space.sm,
|
|
58
|
+
borderRadius: radius.md,
|
|
59
|
+
paddingInline: space.md,
|
|
60
|
+
paddingBlock: space.sm,
|
|
61
|
+
fontSize: type.md,
|
|
62
|
+
fontWeight: 500,
|
|
63
|
+
width: "100%",
|
|
64
|
+
textDecoration: "none",
|
|
65
|
+
color: colors.text,
|
|
66
|
+
[hover]: {
|
|
67
|
+
":hover": {
|
|
68
|
+
backgroundColor: colors.bgHover,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
itemActive: {
|
|
73
|
+
backgroundColor: colors.bgActive,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// packages/studio/src/chrome/OpenSiteButton.tsx
|
|
2
|
+
// Dashboard-only: mint a site session for the workspace's site and go there.
|
|
3
|
+
// The site then shows the editing bar and its mounted Studio, with no
|
|
4
|
+
// dashboard cookie involved. Same bounce `/enter` runs for a site that asks.
|
|
5
|
+
// One site URL opens on click; several show a picker.
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { Menu } from "@base-ui/react/menu";
|
|
8
|
+
import * as stylex from "@stylexjs/stylex";
|
|
9
|
+
import { previewEntryUrl, resolveEnterTarget } from "@backmatter/core";
|
|
10
|
+
import { createPreviewTicket } from "../api";
|
|
11
|
+
import { studioConfig } from "../studio-config";
|
|
12
|
+
import { colors, space, type } from "../styles/tokens.stylex";
|
|
13
|
+
import { cx, popup, popupClassName } from "../ui/popup";
|
|
14
|
+
import { ExternalIcon } from "./icons";
|
|
15
|
+
import { openableSites, siteLabel } from "./open-site";
|
|
16
|
+
|
|
17
|
+
const hover = "@media (hover: hover)";
|
|
18
|
+
|
|
19
|
+
/** The dashboard talks to the API directly; a site Studio goes through its proxy. */
|
|
20
|
+
export function showsOpenSite(): boolean {
|
|
21
|
+
return studioConfig().credentials === "include";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function OpenSiteButton({
|
|
25
|
+
workspaceId,
|
|
26
|
+
userId,
|
|
27
|
+
siteUrls,
|
|
28
|
+
}: {
|
|
29
|
+
workspaceId: string;
|
|
30
|
+
userId: string;
|
|
31
|
+
siteUrls: readonly string[];
|
|
32
|
+
}) {
|
|
33
|
+
const [busy, setBusy] = useState(false);
|
|
34
|
+
const [error, setError] = useState<string | null>(null);
|
|
35
|
+
const sites = openableSites(siteUrls);
|
|
36
|
+
if (sites.length === 0 || !showsOpenSite()) return null;
|
|
37
|
+
|
|
38
|
+
async function open(site: string) {
|
|
39
|
+
const target = resolveEnterTarget(site, siteUrls);
|
|
40
|
+
if (!target) {
|
|
41
|
+
setError("Site URL is not valid");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
setBusy(true);
|
|
45
|
+
setError(null);
|
|
46
|
+
try {
|
|
47
|
+
const { ticket } = await createPreviewTicket(workspaceId, {
|
|
48
|
+
redirect: target.redirect,
|
|
49
|
+
tree: userId,
|
|
50
|
+
});
|
|
51
|
+
window.location.assign(previewEntryUrl(target.origin, ticket));
|
|
52
|
+
} catch (err) {
|
|
53
|
+
setBusy(false);
|
|
54
|
+
setError(err instanceof Error ? err.message : "Could not open the site");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const label = <span>{busy ? "Opening…" : "Open site"}</span>;
|
|
59
|
+
|
|
60
|
+
if (sites.length === 1) {
|
|
61
|
+
const site = sites[0]!;
|
|
62
|
+
return (
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
disabled={busy}
|
|
66
|
+
onClick={() => void open(site)}
|
|
67
|
+
title={error ?? `Open ${site} with editing on`}
|
|
68
|
+
aria-label="Open site"
|
|
69
|
+
className={cx(styles.trigger)}
|
|
70
|
+
>
|
|
71
|
+
<ExternalIcon />
|
|
72
|
+
{label}
|
|
73
|
+
</button>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<Menu.Root>
|
|
79
|
+
<Menu.Trigger
|
|
80
|
+
disabled={busy}
|
|
81
|
+
title={error ?? "Open a site with editing on"}
|
|
82
|
+
aria-label="Open site"
|
|
83
|
+
className={cx(styles.trigger)}
|
|
84
|
+
>
|
|
85
|
+
<ExternalIcon />
|
|
86
|
+
{label}
|
|
87
|
+
</Menu.Trigger>
|
|
88
|
+
<Menu.Portal>
|
|
89
|
+
<Menu.Positioner side="bottom" align="start" sideOffset={6} className={cx(popup.positioner)}>
|
|
90
|
+
<Menu.Popup aria-label="Sites" className={(state) => popupClassName(state, styles.menu)}>
|
|
91
|
+
{sites.map((site) => (
|
|
92
|
+
<Menu.Item
|
|
93
|
+
key={site}
|
|
94
|
+
label={siteLabel(site)}
|
|
95
|
+
onClick={() => void open(site)}
|
|
96
|
+
className={(state) =>
|
|
97
|
+
cx(popup.item, styles.item, state.highlighted && popup.itemHighlighted)
|
|
98
|
+
}
|
|
99
|
+
>
|
|
100
|
+
{siteLabel(site)}
|
|
101
|
+
</Menu.Item>
|
|
102
|
+
))}
|
|
103
|
+
</Menu.Popup>
|
|
104
|
+
</Menu.Positioner>
|
|
105
|
+
</Menu.Portal>
|
|
106
|
+
</Menu.Root>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const styles = stylex.create({
|
|
111
|
+
trigger: {
|
|
112
|
+
display: "inline-flex",
|
|
113
|
+
alignItems: "center",
|
|
114
|
+
gap: space.xs,
|
|
115
|
+
minHeight: "24px",
|
|
116
|
+
paddingInline: space.xs,
|
|
117
|
+
borderWidth: 0,
|
|
118
|
+
backgroundColor: "transparent",
|
|
119
|
+
color: colors.textMuted,
|
|
120
|
+
fontSize: type.xs,
|
|
121
|
+
fontFamily: type.mono,
|
|
122
|
+
cursor: "pointer",
|
|
123
|
+
touchAction: "manipulation",
|
|
124
|
+
":disabled": {
|
|
125
|
+
cursor: "default",
|
|
126
|
+
opacity: 0.6,
|
|
127
|
+
},
|
|
128
|
+
":focus-visible": {
|
|
129
|
+
outlineWidth: 2,
|
|
130
|
+
outlineStyle: "solid",
|
|
131
|
+
outlineColor: colors.focus,
|
|
132
|
+
outlineOffset: "-2px",
|
|
133
|
+
},
|
|
134
|
+
[hover]: {
|
|
135
|
+
":hover": {
|
|
136
|
+
color: colors.text,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
menu: {
|
|
141
|
+
minWidth: "200px",
|
|
142
|
+
},
|
|
143
|
+
item: {
|
|
144
|
+
cursor: "pointer",
|
|
145
|
+
fontFamily: type.mono,
|
|
146
|
+
fontSize: type.xs,
|
|
147
|
+
},
|
|
148
|
+
});
|