@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,110 @@
|
|
|
1
|
+
// packages/studio/src/pages/EmbedChatPage.tsx
|
|
2
|
+
// The CMS chat, alone, so a site can frame it. The parent posts the open document.
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { ChatPanel } from "../chat/ChatPanel";
|
|
5
|
+
import { ChatProvider, ChatSessionScope, useChatUI } from "../chat/ChatProvider";
|
|
6
|
+
import { isPanelVisible } from "../chat/chat-state";
|
|
7
|
+
import {
|
|
8
|
+
DOC_CHANGED_EVENT,
|
|
9
|
+
EditorFocusProvider,
|
|
10
|
+
useEditorFocus,
|
|
11
|
+
type DocChangedDetail,
|
|
12
|
+
type DocRef,
|
|
13
|
+
} from "../chrome/EditorFocusContext";
|
|
14
|
+
import { installParentChatHotkey } from "../chrome/hotkeys";
|
|
15
|
+
import { TooltipProvider } from "../ui/Tooltip";
|
|
16
|
+
|
|
17
|
+
export function EmbedChatPage({ workspaceId }: { workspaceId: string }) {
|
|
18
|
+
useEffect(() => installParentChatHotkey(), []);
|
|
19
|
+
return (
|
|
20
|
+
<TooltipProvider>
|
|
21
|
+
<EditorFocusProvider>
|
|
22
|
+
<ChatProvider workspaceId={workspaceId} startOpen>
|
|
23
|
+
<ChatSessionScope>
|
|
24
|
+
<FocusBridge />
|
|
25
|
+
<ChatVisibilityBridge />
|
|
26
|
+
<ChatPanel fill />
|
|
27
|
+
</ChatSessionScope>
|
|
28
|
+
</ChatProvider>
|
|
29
|
+
</EditorFocusProvider>
|
|
30
|
+
</TooltipProvider>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function parentOrigin(): string {
|
|
35
|
+
if (!document.referrer) return "";
|
|
36
|
+
try {
|
|
37
|
+
return new URL(document.referrer).origin;
|
|
38
|
+
} catch {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function FocusBridge() {
|
|
44
|
+
const { setFocus } = useEditorFocus();
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const origin = parentOrigin();
|
|
48
|
+
function onMessage(event: MessageEvent) {
|
|
49
|
+
if (!origin || event.origin !== origin) return;
|
|
50
|
+
const data = event.data as { type?: string; doc?: Partial<DocRef> };
|
|
51
|
+
if (data?.type !== "backmatter:focus") return;
|
|
52
|
+
const doc = data.doc;
|
|
53
|
+
if (!doc?.locale || !doc.type || !doc.slug) return;
|
|
54
|
+
setFocus({
|
|
55
|
+
docRef: { locale: doc.locale, type: doc.type, slug: doc.slug },
|
|
56
|
+
frontmatter: {},
|
|
57
|
+
body: "",
|
|
58
|
+
selection: null,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
window.addEventListener("message", onMessage);
|
|
62
|
+
if (origin) window.parent.postMessage({ type: "backmatter:chat-ready" }, origin);
|
|
63
|
+
return () => window.removeEventListener("message", onMessage);
|
|
64
|
+
}, [setFocus]);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const origin = parentOrigin();
|
|
68
|
+
function onDoc(event: Event) {
|
|
69
|
+
const detail = (event as CustomEvent<DocChangedDetail>).detail;
|
|
70
|
+
if (!origin || !detail?.docRef) return;
|
|
71
|
+
window.parent.postMessage({ type: "backmatter:doc-changed", doc: detail.docRef }, origin);
|
|
72
|
+
}
|
|
73
|
+
window.addEventListener(DOC_CHANGED_EVENT, onDoc);
|
|
74
|
+
return () => window.removeEventListener(DOC_CHANGED_EVENT, onDoc);
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function ChatVisibilityBridge() {
|
|
81
|
+
const { panel, dispatch } = useChatUI();
|
|
82
|
+
const mode = panel.mode;
|
|
83
|
+
const previous = useRef(mode);
|
|
84
|
+
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
const origin = parentOrigin();
|
|
87
|
+
if (!origin || window.parent === window) return;
|
|
88
|
+
const wasVisible = isPanelVisible(previous.current);
|
|
89
|
+
previous.current = mode;
|
|
90
|
+
if (wasVisible && !isPanelVisible(mode)) {
|
|
91
|
+
window.parent.postMessage({ type: "backmatter:chat-closed" }, origin);
|
|
92
|
+
}
|
|
93
|
+
}, [mode]);
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
const origin = parentOrigin();
|
|
97
|
+
function onMessage(event: MessageEvent) {
|
|
98
|
+
if (!origin || event.origin !== origin) return;
|
|
99
|
+
if (event.data?.type !== "backmatter:chat-open") return;
|
|
100
|
+
dispatch({ type: "open" });
|
|
101
|
+
requestAnimationFrame(() => {
|
|
102
|
+
window.dispatchEvent(new Event("backmatter:chat-focus"));
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
window.addEventListener("message", onMessage);
|
|
106
|
+
return () => window.removeEventListener("message", onMessage);
|
|
107
|
+
}, [dispatch]);
|
|
108
|
+
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
// packages/studio/src/pages/EmbedPublishPage.tsx
|
|
2
|
+
// The CMS commit flow, alone, so the on-site bar can frame it.
|
|
3
|
+
import { useEffect, useMemo, useState, type FormEvent } from "react";
|
|
4
|
+
import { installParentChatHotkey } from "../chrome/hotkeys";
|
|
5
|
+
import * as stylex from "@stylexjs/stylex";
|
|
6
|
+
import {
|
|
7
|
+
commitWorkspace,
|
|
8
|
+
countConflicts,
|
|
9
|
+
defaultCommitMessage,
|
|
10
|
+
fetchGit,
|
|
11
|
+
fetchWorkspace,
|
|
12
|
+
notifyTreeChanged,
|
|
13
|
+
publishCommittedFiles,
|
|
14
|
+
resolveDoc,
|
|
15
|
+
type ApiError,
|
|
16
|
+
type GitChange,
|
|
17
|
+
type GitState,
|
|
18
|
+
} from "../api";
|
|
19
|
+
import { statusBarAction } from "../chrome/status-bar-action";
|
|
20
|
+
import { colors, space, type } from "../styles/tokens.stylex";
|
|
21
|
+
import { Button } from "../ui/Button";
|
|
22
|
+
import { Input } from "../ui/Input";
|
|
23
|
+
import { Text } from "../ui/Text";
|
|
24
|
+
import { canPublish } from "../workspace/permissions";
|
|
25
|
+
|
|
26
|
+
const POLL_MS = 8000;
|
|
27
|
+
|
|
28
|
+
function parentOrigin(): string {
|
|
29
|
+
if (!document.referrer) return "";
|
|
30
|
+
try {
|
|
31
|
+
return new URL(document.referrer).origin;
|
|
32
|
+
} catch {
|
|
33
|
+
return "";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function formatCommitError(err: unknown): string {
|
|
38
|
+
if (!(err instanceof Error)) return "Commit failed";
|
|
39
|
+
const apiErr = err as ApiError;
|
|
40
|
+
if (apiErr.code === "conflict") return "Resolve conflicts before committing";
|
|
41
|
+
if (apiErr.code === "nothing_to_commit") return "Nothing to commit";
|
|
42
|
+
if (apiErr.code === "validation") {
|
|
43
|
+
return err.message.replace(/^validation:\s*/, "Validation failed: ");
|
|
44
|
+
}
|
|
45
|
+
if (apiErr.code === "github_not_bound") return "Connect GitHub first";
|
|
46
|
+
return err.message;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function changeKey(doc: GitChange) {
|
|
50
|
+
return `${doc.locale}/${doc.type}/${doc.slug}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function EmbedPublishPage({ workspaceId }: { workspaceId: string }) {
|
|
54
|
+
useEffect(() => installParentChatHotkey(), []);
|
|
55
|
+
const [git, setGit] = useState<GitState | null>(null);
|
|
56
|
+
const [role, setRole] = useState("viewer");
|
|
57
|
+
const [message, setMessage] = useState("");
|
|
58
|
+
const [error, setError] = useState<string | null>(null);
|
|
59
|
+
const [committing, setCommitting] = useState(false);
|
|
60
|
+
const [resolvingKey, setResolvingKey] = useState<string | null>(null);
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
let stop = false;
|
|
64
|
+
void fetchWorkspace(workspaceId)
|
|
65
|
+
.then((res) => {
|
|
66
|
+
if (!stop) setRole(res.workspace.role);
|
|
67
|
+
})
|
|
68
|
+
.catch(() => {
|
|
69
|
+
if (!stop) setError("Could not load this workspace");
|
|
70
|
+
});
|
|
71
|
+
return () => {
|
|
72
|
+
stop = true;
|
|
73
|
+
};
|
|
74
|
+
}, [workspaceId]);
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
let stop = false;
|
|
78
|
+
const load = () => {
|
|
79
|
+
void fetchGit(workspaceId)
|
|
80
|
+
.then((next) => {
|
|
81
|
+
if (stop) return;
|
|
82
|
+
setGit(next);
|
|
83
|
+
const origin = parentOrigin();
|
|
84
|
+
if (!origin) return;
|
|
85
|
+
window.parent.postMessage(
|
|
86
|
+
{
|
|
87
|
+
type: "backmatter:git",
|
|
88
|
+
changeCount: next.changes.length,
|
|
89
|
+
conflictCount: countConflicts(next),
|
|
90
|
+
},
|
|
91
|
+
origin,
|
|
92
|
+
);
|
|
93
|
+
})
|
|
94
|
+
.catch((err: unknown) => {
|
|
95
|
+
if (!stop) setError(err instanceof Error ? err.message : "Git status failed");
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
load();
|
|
99
|
+
const timer = window.setInterval(load, POLL_MS);
|
|
100
|
+
return () => {
|
|
101
|
+
stop = true;
|
|
102
|
+
window.clearInterval(timer);
|
|
103
|
+
};
|
|
104
|
+
}, [workspaceId]);
|
|
105
|
+
|
|
106
|
+
const changes = git?.changes ?? [];
|
|
107
|
+
const conflictCount = countConflicts(git);
|
|
108
|
+
const action = statusBarAction(conflictCount, canPublish(role));
|
|
109
|
+
const conflicts = useMemo(
|
|
110
|
+
() => changes.filter((doc) => doc.status === "conflict"),
|
|
111
|
+
[changes],
|
|
112
|
+
);
|
|
113
|
+
const placeholder = defaultCommitMessage(changes);
|
|
114
|
+
|
|
115
|
+
async function onResolve(doc: GitChange, strategy: "mine" | "theirs") {
|
|
116
|
+
const key = `${changeKey(doc)}:${strategy}`;
|
|
117
|
+
setResolvingKey(key);
|
|
118
|
+
setError(null);
|
|
119
|
+
try {
|
|
120
|
+
await resolveDoc(workspaceId, doc.locale, doc.type, doc.slug, strategy);
|
|
121
|
+
notifyTreeChanged({
|
|
122
|
+
workspaceId,
|
|
123
|
+
locale: doc.locale,
|
|
124
|
+
type: doc.type,
|
|
125
|
+
slug: doc.slug,
|
|
126
|
+
status: strategy === "theirs" ? "clean" : "modified",
|
|
127
|
+
});
|
|
128
|
+
const next = await fetchGit(workspaceId);
|
|
129
|
+
setGit(next);
|
|
130
|
+
} catch (err) {
|
|
131
|
+
setError(err instanceof Error ? err.message : "Resolve failed");
|
|
132
|
+
} finally {
|
|
133
|
+
setResolvingKey(null);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async function onCommit(event: FormEvent) {
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
if (committing || action !== "commit" || changes.length === 0) return;
|
|
140
|
+
setCommitting(true);
|
|
141
|
+
setError(null);
|
|
142
|
+
try {
|
|
143
|
+
const result = await commitWorkspace(workspaceId, message);
|
|
144
|
+
setMessage("");
|
|
145
|
+
publishCommittedFiles(workspaceId, result.files);
|
|
146
|
+
const origin = parentOrigin();
|
|
147
|
+
if (origin) window.parent.postMessage({ type: "backmatter:published" }, origin);
|
|
148
|
+
setGit(await fetchGit(workspaceId));
|
|
149
|
+
} catch (err) {
|
|
150
|
+
setError(formatCommitError(err));
|
|
151
|
+
} finally {
|
|
152
|
+
setCommitting(false);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const label = committing
|
|
157
|
+
? "Committing…"
|
|
158
|
+
: conflictCount > 0
|
|
159
|
+
? `Resolve ${conflictCount} ${conflictCount === 1 ? "conflict" : "conflicts"}`
|
|
160
|
+
: action === "blocked"
|
|
161
|
+
? "Writers cannot publish"
|
|
162
|
+
: changes.length === 0
|
|
163
|
+
? "Nothing to publish"
|
|
164
|
+
: `Deploy ${changes.length} ${changes.length === 1 ? "change" : "changes"}`;
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<form {...stylex.props(styles.panel)} onSubmit={(event) => void onCommit(event)}>
|
|
168
|
+
<Text as="p" size="sm" weight="medium" tone="muted">
|
|
169
|
+
{git?.currentBranch ?? "Publish"}
|
|
170
|
+
</Text>
|
|
171
|
+
{changes.length === 0 ? (
|
|
172
|
+
<Text as="p" size="sm" tone="muted">
|
|
173
|
+
Nothing to publish
|
|
174
|
+
</Text>
|
|
175
|
+
) : (
|
|
176
|
+
<ul {...stylex.props(styles.list)}>
|
|
177
|
+
{changes.map((change) => (
|
|
178
|
+
<li key={changeKey(change)} {...stylex.props(styles.row)}>
|
|
179
|
+
<span>
|
|
180
|
+
{change.status} {change.type}/{change.slug}
|
|
181
|
+
</span>
|
|
182
|
+
{change.status === "conflict" ? (
|
|
183
|
+
<span {...stylex.props(styles.resolve)}>
|
|
184
|
+
<Button
|
|
185
|
+
size="sm"
|
|
186
|
+
variant="secondary"
|
|
187
|
+
disabled={resolvingKey !== null}
|
|
188
|
+
onClick={() => void onResolve(change, "mine")}
|
|
189
|
+
>
|
|
190
|
+
Keep mine
|
|
191
|
+
</Button>
|
|
192
|
+
<Button
|
|
193
|
+
size="sm"
|
|
194
|
+
variant="secondary"
|
|
195
|
+
disabled={resolvingKey !== null}
|
|
196
|
+
onClick={() => void onResolve(change, "theirs")}
|
|
197
|
+
>
|
|
198
|
+
Take theirs
|
|
199
|
+
</Button>
|
|
200
|
+
</span>
|
|
201
|
+
) : null}
|
|
202
|
+
</li>
|
|
203
|
+
))}
|
|
204
|
+
</ul>
|
|
205
|
+
)}
|
|
206
|
+
{conflicts.length > 0 ? null : (
|
|
207
|
+
<Input
|
|
208
|
+
value={message}
|
|
209
|
+
placeholder={placeholder}
|
|
210
|
+
aria-label="Commit message"
|
|
211
|
+
onChange={(event) => setMessage(event.target.value)}
|
|
212
|
+
/>
|
|
213
|
+
)}
|
|
214
|
+
{error ? (
|
|
215
|
+
<Text as="p" size="sm" tone="danger">
|
|
216
|
+
{error}
|
|
217
|
+
</Text>
|
|
218
|
+
) : null}
|
|
219
|
+
<Button
|
|
220
|
+
type="submit"
|
|
221
|
+
size="sm"
|
|
222
|
+
disabled={committing || action !== "commit" || changes.length === 0}
|
|
223
|
+
>
|
|
224
|
+
{label}
|
|
225
|
+
</Button>
|
|
226
|
+
</form>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const styles = stylex.create({
|
|
231
|
+
panel: {
|
|
232
|
+
display: "flex",
|
|
233
|
+
flexDirection: "column",
|
|
234
|
+
gap: space.lg,
|
|
235
|
+
minHeight: "100%",
|
|
236
|
+
boxSizing: "border-box",
|
|
237
|
+
padding: space.xl,
|
|
238
|
+
backgroundColor: colors.bgSurface,
|
|
239
|
+
color: colors.text,
|
|
240
|
+
fontSize: type.sm,
|
|
241
|
+
},
|
|
242
|
+
list: {
|
|
243
|
+
margin: 0,
|
|
244
|
+
padding: 0,
|
|
245
|
+
listStyle: "none",
|
|
246
|
+
display: "flex",
|
|
247
|
+
flexDirection: "column",
|
|
248
|
+
gap: space.md,
|
|
249
|
+
},
|
|
250
|
+
row: {
|
|
251
|
+
display: "flex",
|
|
252
|
+
flexDirection: "column",
|
|
253
|
+
gap: space.sm,
|
|
254
|
+
},
|
|
255
|
+
resolve: {
|
|
256
|
+
display: "flex",
|
|
257
|
+
gap: space.sm,
|
|
258
|
+
},
|
|
259
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// packages/studio/src/pages/EnterPage.tsx
|
|
2
|
+
// `/enter?workspace=…&return=…`. The browser arrives top-level from a customer
|
|
3
|
+
// site that has no session. This tab holds the first-party cookie, so it can
|
|
4
|
+
// mint a ticket and send the browser back to the site's preview entry route,
|
|
5
|
+
// which sets the site session cookie and lands on `return`.
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import * as stylex from "@stylexjs/stylex";
|
|
8
|
+
import { parseEnterSearch, previewEntryUrl, resolveEnterTarget } from "@backmatter/core";
|
|
9
|
+
import { createPreviewTicket, fetchWorkspace } from "../api";
|
|
10
|
+
import { Text } from "../ui/Text";
|
|
11
|
+
import { ButtonLink } from "../ui/Button";
|
|
12
|
+
import { colors, space } from "../styles/tokens.stylex";
|
|
13
|
+
|
|
14
|
+
type Phase = { kind: "working" } | { kind: "error"; message: string };
|
|
15
|
+
|
|
16
|
+
export function EnterPage({ userId }: { userId: string }) {
|
|
17
|
+
const [phase, setPhase] = useState<Phase>({ kind: "working" });
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const req = parseEnterSearch(window.location.search);
|
|
21
|
+
if (!req) {
|
|
22
|
+
setPhase({ kind: "error", message: "This link is missing the workspace or the page to return to." });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
let cancelled = false;
|
|
26
|
+
void (async () => {
|
|
27
|
+
try {
|
|
28
|
+
const { workspace } = await fetchWorkspace(req.workspaceId);
|
|
29
|
+
const target = resolveEnterTarget(req.returnUrl, workspace.siteUrls);
|
|
30
|
+
if (!target) {
|
|
31
|
+
setPhase({
|
|
32
|
+
kind: "error",
|
|
33
|
+
message: "That site is not listed under this workspace. Add its origin in Settings → General first.",
|
|
34
|
+
});
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const { ticket } = await createPreviewTicket(workspace.id, {
|
|
38
|
+
redirect: target.redirect,
|
|
39
|
+
tree: userId,
|
|
40
|
+
});
|
|
41
|
+
if (cancelled) return;
|
|
42
|
+
window.location.replace(previewEntryUrl(target.origin, ticket));
|
|
43
|
+
} catch (err) {
|
|
44
|
+
if (cancelled) return;
|
|
45
|
+
setPhase({ kind: "error", message: err instanceof Error ? err.message : "Could not open the site." });
|
|
46
|
+
}
|
|
47
|
+
})();
|
|
48
|
+
return () => {
|
|
49
|
+
cancelled = true;
|
|
50
|
+
};
|
|
51
|
+
}, [userId]);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div {...stylex.props(styles.page)}>
|
|
55
|
+
<div {...stylex.props(styles.card)}>
|
|
56
|
+
{phase.kind === "working" ? (
|
|
57
|
+
<>
|
|
58
|
+
<Text size="lg" weight="medium">
|
|
59
|
+
Opening your site…
|
|
60
|
+
</Text>
|
|
61
|
+
<Text tone="muted">Setting up editing on the site and sending you back.</Text>
|
|
62
|
+
</>
|
|
63
|
+
) : (
|
|
64
|
+
<>
|
|
65
|
+
<Text size="lg" weight="medium">
|
|
66
|
+
Could not open the site
|
|
67
|
+
</Text>
|
|
68
|
+
<Text tone="muted">{phase.message}</Text>
|
|
69
|
+
<ButtonLink to="/" variant="secondary">
|
|
70
|
+
Back to the dashboard
|
|
71
|
+
</ButtonLink>
|
|
72
|
+
</>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const styles = stylex.create({
|
|
80
|
+
page: {
|
|
81
|
+
minHeight: "100dvh",
|
|
82
|
+
display: "grid",
|
|
83
|
+
placeItems: "center",
|
|
84
|
+
padding: space.xl,
|
|
85
|
+
},
|
|
86
|
+
card: {
|
|
87
|
+
display: "flex",
|
|
88
|
+
flexDirection: "column",
|
|
89
|
+
gap: space.md,
|
|
90
|
+
maxWidth: 420,
|
|
91
|
+
padding: space.xl,
|
|
92
|
+
borderRadius: 12,
|
|
93
|
+
backgroundColor: colors.bgPanel,
|
|
94
|
+
border: `1px solid ${colors.border}`,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// packages/studio/src/pages/GithubConnectPage.tsx
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { useNavigate, useOutletContext } from "react-router";
|
|
4
|
+
import { bindGithub, fetchGithubRepos, type ApiError } from "../api";
|
|
5
|
+
import { BackLink } from "../ui/BackLink";
|
|
6
|
+
import { Button, ButtonLink } from "../ui/Button";
|
|
7
|
+
import { Field } from "../ui/Field";
|
|
8
|
+
import { Input, Select } from "../ui/Input";
|
|
9
|
+
import { PageHeader, Stack } from "../ui/Page";
|
|
10
|
+
import { Text } from "../ui/Text";
|
|
11
|
+
import type { WorkspaceOutletContext } from "../workspace/types";
|
|
12
|
+
import { settingsPath } from "../workspace-path";
|
|
13
|
+
|
|
14
|
+
export function GithubConnectPage() {
|
|
15
|
+
const { workspace, reload } = useOutletContext<WorkspaceOutletContext>();
|
|
16
|
+
const workspaceId = workspace.id;
|
|
17
|
+
const navigate = useNavigate();
|
|
18
|
+
const [repos, setRepos] = useState<
|
|
19
|
+
Array<{ fullName: string; defaultBranch: string }>
|
|
20
|
+
>([]);
|
|
21
|
+
const [selected, setSelected] = useState(
|
|
22
|
+
workspace.githubRepoFullName ?? "",
|
|
23
|
+
);
|
|
24
|
+
const [githubDirectory, setGithubDirectory] = useState(
|
|
25
|
+
workspace.githubDirectory ?? "",
|
|
26
|
+
);
|
|
27
|
+
const [error, setError] = useState<string | null>(null);
|
|
28
|
+
const [loading, setLoading] = useState(true);
|
|
29
|
+
const [saving, setSaving] = useState(false);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!workspaceId) return;
|
|
33
|
+
void fetchGithubRepos(workspaceId)
|
|
34
|
+
.then((data) => {
|
|
35
|
+
setRepos(data.repos);
|
|
36
|
+
setSelected((current) =>
|
|
37
|
+
current && data.repos.some((repo) => repo.fullName === current)
|
|
38
|
+
? current
|
|
39
|
+
: (data.repos[0]?.fullName ?? ""),
|
|
40
|
+
);
|
|
41
|
+
})
|
|
42
|
+
.catch((err: Error) => {
|
|
43
|
+
const code = err.message;
|
|
44
|
+
setError(
|
|
45
|
+
code === "github_not_installed" || code === "github_list_failed"
|
|
46
|
+
? "The saved GitHub installation is missing or this app cannot access it."
|
|
47
|
+
: code,
|
|
48
|
+
);
|
|
49
|
+
})
|
|
50
|
+
.finally(() => setLoading(false));
|
|
51
|
+
}, [workspaceId]);
|
|
52
|
+
|
|
53
|
+
async function onSubmit(e: React.FormEvent) {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
const repo = repos.find((r) => r.fullName === selected);
|
|
56
|
+
if (!repo) return;
|
|
57
|
+
setSaving(true);
|
|
58
|
+
setError(null);
|
|
59
|
+
try {
|
|
60
|
+
await bindGithub(workspaceId, {
|
|
61
|
+
repoFullName: repo.fullName,
|
|
62
|
+
defaultBranch: repo.defaultBranch,
|
|
63
|
+
githubDirectory,
|
|
64
|
+
});
|
|
65
|
+
await reload();
|
|
66
|
+
navigate(settingsPath(workspace.slug, "github"));
|
|
67
|
+
} catch (err) {
|
|
68
|
+
const code =
|
|
69
|
+
err && typeof err === "object" && "code" in err
|
|
70
|
+
? (err as ApiError).code
|
|
71
|
+
: undefined;
|
|
72
|
+
if (code === "invalid_github_directory") {
|
|
73
|
+
setError("The directory is invalid.");
|
|
74
|
+
} else {
|
|
75
|
+
setError(err instanceof Error ? err.message : "Bind failed");
|
|
76
|
+
}
|
|
77
|
+
} finally {
|
|
78
|
+
setSaving(false);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (loading) return <Text tone="muted">Loading repos…</Text>;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<section>
|
|
86
|
+
<PageHeader
|
|
87
|
+
kicker={
|
|
88
|
+
<BackLink to={settingsPath(workspace.slug, "github")}>
|
|
89
|
+
← GitHub settings
|
|
90
|
+
</BackLink>
|
|
91
|
+
}
|
|
92
|
+
title="Choose repository"
|
|
93
|
+
description="Select the repo this workspace will commit to."
|
|
94
|
+
/>
|
|
95
|
+
{error ? <Text tone="danger">{error}</Text> : null}
|
|
96
|
+
{repos.length === 0 ? (
|
|
97
|
+
<Stack>
|
|
98
|
+
<Text tone="muted">
|
|
99
|
+
{error
|
|
100
|
+
? "GitHub did not return repositories for the saved installation."
|
|
101
|
+
: "No repositories are available for this installation."}
|
|
102
|
+
</Text>
|
|
103
|
+
<div>
|
|
104
|
+
<ButtonLink to={settingsPath(workspace.slug, "github")} variant="secondary">
|
|
105
|
+
Back to GitHub settings
|
|
106
|
+
</ButtonLink>
|
|
107
|
+
</div>
|
|
108
|
+
</Stack>
|
|
109
|
+
) : (
|
|
110
|
+
<form onSubmit={onSubmit}>
|
|
111
|
+
<Stack>
|
|
112
|
+
<Field label="Repository">
|
|
113
|
+
<Select
|
|
114
|
+
aria-label="Repository"
|
|
115
|
+
value={selected}
|
|
116
|
+
onValueChange={(next) => setSelected(next ?? "")}
|
|
117
|
+
options={repos.map((repo) => ({
|
|
118
|
+
value: repo.fullName,
|
|
119
|
+
label: `${repo.fullName} (${repo.defaultBranch})`,
|
|
120
|
+
}))}
|
|
121
|
+
/>
|
|
122
|
+
</Field>
|
|
123
|
+
<Field
|
|
124
|
+
label="Directory"
|
|
125
|
+
hint="Folder inside the repository that contains this site. Leave empty for the repository root."
|
|
126
|
+
>
|
|
127
|
+
<Input
|
|
128
|
+
value={githubDirectory}
|
|
129
|
+
onChange={(e) => setGithubDirectory(e.target.value)}
|
|
130
|
+
/>
|
|
131
|
+
</Field>
|
|
132
|
+
<div>
|
|
133
|
+
<Button type="submit" disabled={saving}>
|
|
134
|
+
{saving ? "Saving…" : "Save connection"}
|
|
135
|
+
</Button>
|
|
136
|
+
</div>
|
|
137
|
+
</Stack>
|
|
138
|
+
</form>
|
|
139
|
+
)}
|
|
140
|
+
</section>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// packages/studio/src/pages/LegacyWorkspaceRedirect.tsx
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Navigate, useLocation, useParams } from "react-router";
|
|
4
|
+
import { fetchWorkspace } from "../api";
|
|
5
|
+
import { PageFrame } from "../ui/Page";
|
|
6
|
+
import { Text } from "../ui/Text";
|
|
7
|
+
import {
|
|
8
|
+
defaultLocaleOf,
|
|
9
|
+
rewriteLegacyWorkspacePath,
|
|
10
|
+
} from "../workspace-path";
|
|
11
|
+
|
|
12
|
+
export function LegacyWorkspaceRedirect() {
|
|
13
|
+
const { workspaceId = "", "*": rest } = useParams();
|
|
14
|
+
const location = useLocation();
|
|
15
|
+
const [to, setTo] = useState<string | null>(null);
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!workspaceId) {
|
|
19
|
+
setTo("/workspaces");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let cancelled = false;
|
|
23
|
+
void fetchWorkspace(workspaceId)
|
|
24
|
+
.then(({ workspace }) => {
|
|
25
|
+
if (cancelled) return;
|
|
26
|
+
const pathname = rest
|
|
27
|
+
? `/workspaces/${workspaceId}/${rest}`
|
|
28
|
+
: `/workspaces/${workspaceId}`;
|
|
29
|
+
const rewritten = rewriteLegacyWorkspacePath(
|
|
30
|
+
pathname,
|
|
31
|
+
workspace.slug,
|
|
32
|
+
defaultLocaleOf(workspace.locales),
|
|
33
|
+
);
|
|
34
|
+
const url = new URL(rewritten, "http://local");
|
|
35
|
+
new URLSearchParams(location.search).forEach((value, key) => {
|
|
36
|
+
url.searchParams.set(key, value);
|
|
37
|
+
});
|
|
38
|
+
setTo(`${url.pathname}${url.search}`);
|
|
39
|
+
})
|
|
40
|
+
.catch(() => {
|
|
41
|
+
if (!cancelled) setTo("/workspaces");
|
|
42
|
+
});
|
|
43
|
+
return () => {
|
|
44
|
+
cancelled = true;
|
|
45
|
+
};
|
|
46
|
+
}, [workspaceId, rest, location.search]);
|
|
47
|
+
|
|
48
|
+
if (!to) {
|
|
49
|
+
return (
|
|
50
|
+
<PageFrame>
|
|
51
|
+
<Text tone="muted">Loading…</Text>
|
|
52
|
+
</PageFrame>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return <Navigate to={to} replace />;
|
|
57
|
+
}
|