@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,277 @@
|
|
|
1
|
+
// packages/studio/src/pages/SelectionBar.tsx
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState, type FormEvent } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import * as stylex from "@stylexjs/stylex";
|
|
5
|
+
import { colors, radius, space, type, z } from "../styles/tokens.stylex";
|
|
6
|
+
import type { BlockFormat } from "./selection-format";
|
|
7
|
+
|
|
8
|
+
const hover = "@media (hover: hover)";
|
|
9
|
+
|
|
10
|
+
export type FormatSelection = {
|
|
11
|
+
top: number;
|
|
12
|
+
left: number;
|
|
13
|
+
width: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
format: BlockFormat;
|
|
16
|
+
bold: boolean;
|
|
17
|
+
italic: boolean;
|
|
18
|
+
href: string | null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const BLOCKS: { format: BlockFormat; label: string }[] = [
|
|
22
|
+
{ format: "paragraph", label: "Paragraph" },
|
|
23
|
+
{ format: "heading", label: "Heading" },
|
|
24
|
+
{ format: "list", label: "List" },
|
|
25
|
+
{ format: "quote", label: "Quote" },
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export function SelectionBar({
|
|
29
|
+
selection,
|
|
30
|
+
onFormat,
|
|
31
|
+
onInline,
|
|
32
|
+
onLink,
|
|
33
|
+
onLinking,
|
|
34
|
+
}: {
|
|
35
|
+
selection: FormatSelection;
|
|
36
|
+
onFormat: (format: BlockFormat) => void;
|
|
37
|
+
onInline: (tag: "strong" | "em") => void;
|
|
38
|
+
onLink: (href: string, range: Range) => void;
|
|
39
|
+
onLinking: (linking: boolean) => void;
|
|
40
|
+
}) {
|
|
41
|
+
const barRef = useRef<HTMLDivElement>(null);
|
|
42
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
43
|
+
const savedRange = useRef<Range | null>(null);
|
|
44
|
+
const onLinkingRef = useRef(onLinking);
|
|
45
|
+
onLinkingRef.current = onLinking;
|
|
46
|
+
const [linkOpen, setLinkOpen] = useState(false);
|
|
47
|
+
const [draft, setDraft] = useState("");
|
|
48
|
+
const [pos, setPos] = useState({ top: selection.top, left: selection.left });
|
|
49
|
+
|
|
50
|
+
useLayoutEffect(() => {
|
|
51
|
+
const bar = barRef.current;
|
|
52
|
+
if (!bar) return;
|
|
53
|
+
const width = bar.offsetWidth;
|
|
54
|
+
const height = bar.offsetHeight;
|
|
55
|
+
let left = selection.left + selection.width / 2 - width / 2;
|
|
56
|
+
left = Math.max(8, Math.min(left, window.innerWidth - width - 8));
|
|
57
|
+
let top = selection.top - height - 8;
|
|
58
|
+
if (top < 8) top = selection.bottom + 8;
|
|
59
|
+
setPos({ top, left });
|
|
60
|
+
}, [selection.top, selection.left, selection.width, selection.bottom, linkOpen]);
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!linkOpen) return;
|
|
64
|
+
inputRef.current?.focus();
|
|
65
|
+
inputRef.current?.select();
|
|
66
|
+
}, [linkOpen]);
|
|
67
|
+
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (!linkOpen) return;
|
|
70
|
+
function onPointerDown(event: PointerEvent) {
|
|
71
|
+
const target = event.target;
|
|
72
|
+
if (target instanceof Node && barRef.current?.contains(target)) return;
|
|
73
|
+
setLinkOpen(false);
|
|
74
|
+
savedRange.current = null;
|
|
75
|
+
onLinkingRef.current(false);
|
|
76
|
+
}
|
|
77
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
78
|
+
return () => document.removeEventListener("pointerdown", onPointerDown, true);
|
|
79
|
+
}, [linkOpen]);
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
return () => onLinkingRef.current(false);
|
|
83
|
+
}, []);
|
|
84
|
+
|
|
85
|
+
function openLink() {
|
|
86
|
+
const current = window.getSelection();
|
|
87
|
+
if (!current || current.rangeCount === 0) return;
|
|
88
|
+
savedRange.current = current.getRangeAt(0).cloneRange();
|
|
89
|
+
setDraft(selection.href ?? "");
|
|
90
|
+
setLinkOpen(true);
|
|
91
|
+
onLinkingRef.current(true);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function closeLink() {
|
|
95
|
+
setLinkOpen(false);
|
|
96
|
+
savedRange.current = null;
|
|
97
|
+
onLinkingRef.current(false);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function submitLink(event: FormEvent) {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
const range = savedRange.current;
|
|
103
|
+
if (!range) return;
|
|
104
|
+
onLink(draft, range);
|
|
105
|
+
setLinkOpen(false);
|
|
106
|
+
savedRange.current = null;
|
|
107
|
+
onLinkingRef.current(false);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const bar = stylex.props(styles.bar);
|
|
111
|
+
|
|
112
|
+
return createPortal(
|
|
113
|
+
<div
|
|
114
|
+
ref={barRef}
|
|
115
|
+
role="toolbar"
|
|
116
|
+
aria-label="Format selection"
|
|
117
|
+
data-selection-bar=""
|
|
118
|
+
className={bar.className}
|
|
119
|
+
style={{ ...bar.style, top: pos.top, left: pos.left }}
|
|
120
|
+
onPointerDown={(event) => {
|
|
121
|
+
const target = event.target;
|
|
122
|
+
if (target instanceof HTMLElement && target.closest("input")) return;
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
{linkOpen ? (
|
|
127
|
+
<form onSubmit={submitLink} {...stylex.props(styles.linkForm)}>
|
|
128
|
+
<input
|
|
129
|
+
ref={inputRef}
|
|
130
|
+
aria-label="Link address"
|
|
131
|
+
value={draft}
|
|
132
|
+
placeholder="https://"
|
|
133
|
+
onChange={(event) => setDraft(event.target.value)}
|
|
134
|
+
onKeyDown={(event) => {
|
|
135
|
+
if (event.key !== "Escape") return;
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
closeLink();
|
|
138
|
+
}}
|
|
139
|
+
{...stylex.props(styles.input)}
|
|
140
|
+
/>
|
|
141
|
+
<button
|
|
142
|
+
type="submit"
|
|
143
|
+
disabled={!draft.trim() && selection.href == null}
|
|
144
|
+
{...stylex.props(styles.action, styles.apply)}
|
|
145
|
+
>
|
|
146
|
+
{draft.trim() || selection.href == null ? "Apply" : "Remove"}
|
|
147
|
+
</button>
|
|
148
|
+
</form>
|
|
149
|
+
) : (
|
|
150
|
+
<>
|
|
151
|
+
{BLOCKS.map((item) => {
|
|
152
|
+
const active = selection.format === item.format;
|
|
153
|
+
return (
|
|
154
|
+
<button
|
|
155
|
+
key={item.format}
|
|
156
|
+
type="button"
|
|
157
|
+
aria-pressed={active}
|
|
158
|
+
onClick={() =>
|
|
159
|
+
onFormat(active && item.format !== "paragraph" ? "paragraph" : item.format)
|
|
160
|
+
}
|
|
161
|
+
{...stylex.props(styles.action, active && styles.actionOn)}
|
|
162
|
+
>
|
|
163
|
+
{item.label}
|
|
164
|
+
</button>
|
|
165
|
+
);
|
|
166
|
+
})}
|
|
167
|
+
<span aria-hidden="true" {...stylex.props(styles.sep)} />
|
|
168
|
+
<button
|
|
169
|
+
type="button"
|
|
170
|
+
aria-label="Bold"
|
|
171
|
+
aria-pressed={selection.bold}
|
|
172
|
+
onClick={() => onInline("strong")}
|
|
173
|
+
{...stylex.props(styles.action, styles.bold, selection.bold && styles.actionOn)}
|
|
174
|
+
>
|
|
175
|
+
B
|
|
176
|
+
</button>
|
|
177
|
+
<button
|
|
178
|
+
type="button"
|
|
179
|
+
aria-label="Italic"
|
|
180
|
+
aria-pressed={selection.italic}
|
|
181
|
+
onClick={() => onInline("em")}
|
|
182
|
+
{...stylex.props(styles.action, styles.italic, selection.italic && styles.actionOn)}
|
|
183
|
+
>
|
|
184
|
+
I
|
|
185
|
+
</button>
|
|
186
|
+
<button
|
|
187
|
+
type="button"
|
|
188
|
+
aria-pressed={selection.href != null}
|
|
189
|
+
onClick={openLink}
|
|
190
|
+
{...stylex.props(styles.action, selection.href != null && styles.actionOn)}
|
|
191
|
+
>
|
|
192
|
+
Link
|
|
193
|
+
</button>
|
|
194
|
+
</>
|
|
195
|
+
)}
|
|
196
|
+
</div>,
|
|
197
|
+
document.body,
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const styles = stylex.create({
|
|
202
|
+
bar: {
|
|
203
|
+
position: "fixed",
|
|
204
|
+
zIndex: z.tooltip,
|
|
205
|
+
display: "flex",
|
|
206
|
+
alignItems: "center",
|
|
207
|
+
gap: 2,
|
|
208
|
+
padding: space.xs,
|
|
209
|
+
borderWidth: 1,
|
|
210
|
+
borderStyle: "solid",
|
|
211
|
+
borderColor: colors.border,
|
|
212
|
+
borderRadius: radius.md,
|
|
213
|
+
backgroundColor: colors.bgSurface,
|
|
214
|
+
boxShadow: "0 8px 24px rgba(24, 24, 27, 0.12), 0 1px 2px rgba(24, 24, 27, 0.06)",
|
|
215
|
+
userSelect: "none",
|
|
216
|
+
whiteSpace: "nowrap",
|
|
217
|
+
},
|
|
218
|
+
action: {
|
|
219
|
+
margin: 0,
|
|
220
|
+
paddingBlock: space.xs,
|
|
221
|
+
paddingInline: space.sm,
|
|
222
|
+
borderWidth: 0,
|
|
223
|
+
borderRadius: radius.sm,
|
|
224
|
+
backgroundColor: "transparent",
|
|
225
|
+
color: colors.text,
|
|
226
|
+
fontFamily: type.sans,
|
|
227
|
+
fontSize: type.sm,
|
|
228
|
+
fontWeight: 500,
|
|
229
|
+
lineHeight: 1.2,
|
|
230
|
+
cursor: "pointer",
|
|
231
|
+
":disabled": {
|
|
232
|
+
opacity: 0.45,
|
|
233
|
+
cursor: "default",
|
|
234
|
+
},
|
|
235
|
+
[hover]: {
|
|
236
|
+
":hover": {
|
|
237
|
+
backgroundColor: colors.bgHover,
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
actionOn: {
|
|
242
|
+
backgroundColor: colors.bgActive,
|
|
243
|
+
},
|
|
244
|
+
bold: {
|
|
245
|
+
fontWeight: 700,
|
|
246
|
+
},
|
|
247
|
+
italic: {
|
|
248
|
+
fontStyle: "italic",
|
|
249
|
+
},
|
|
250
|
+
apply: {
|
|
251
|
+
color: colors.textMuted,
|
|
252
|
+
},
|
|
253
|
+
sep: {
|
|
254
|
+
width: 1,
|
|
255
|
+
height: 16,
|
|
256
|
+
marginInline: 2,
|
|
257
|
+
backgroundColor: colors.border,
|
|
258
|
+
},
|
|
259
|
+
linkForm: {
|
|
260
|
+
display: "flex",
|
|
261
|
+
alignItems: "center",
|
|
262
|
+
},
|
|
263
|
+
input: {
|
|
264
|
+
width: "12rem",
|
|
265
|
+
margin: 0,
|
|
266
|
+
paddingBlock: space.xs,
|
|
267
|
+
paddingInline: space.sm,
|
|
268
|
+
borderWidth: 0,
|
|
269
|
+
borderRadius: radius.sm,
|
|
270
|
+
backgroundColor: "transparent",
|
|
271
|
+
color: colors.text,
|
|
272
|
+
fontFamily: type.sans,
|
|
273
|
+
fontSize: type.sm,
|
|
274
|
+
lineHeight: 1.2,
|
|
275
|
+
outline: "none",
|
|
276
|
+
},
|
|
277
|
+
});
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
// packages/studio/src/pages/SettingsGeneralPage.tsx
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { useOutletContext } from "react-router";
|
|
4
|
+
import {
|
|
5
|
+
patchWorkspace,
|
|
6
|
+
rotateContentToken,
|
|
7
|
+
rotateHostToken,
|
|
8
|
+
rotatePreviewToken,
|
|
9
|
+
} from "../api";
|
|
10
|
+
import { hostEnvSnippet } from "./host-env";
|
|
11
|
+
import { revalidateWebhookUrl } from "./preview-url";
|
|
12
|
+
import { Button } from "../ui/Button";
|
|
13
|
+
import { Field } from "../ui/Field";
|
|
14
|
+
import { Input } from "../ui/Input";
|
|
15
|
+
import { PageHeader, Panel, Stack } from "../ui/Page";
|
|
16
|
+
import { Text } from "../ui/Text";
|
|
17
|
+
import * as stylex from "@stylexjs/stylex";
|
|
18
|
+
import { colors, radius, space, type } from "../styles/tokens.stylex";
|
|
19
|
+
import type { WorkspaceOutletContext } from "../workspace/types";
|
|
20
|
+
|
|
21
|
+
export function SettingsGeneralPage() {
|
|
22
|
+
const { workspace, setWorkspace } = useOutletContext<WorkspaceOutletContext>();
|
|
23
|
+
const [contentTokenOnce, setContentTokenOnce] = useState<string | null>(null);
|
|
24
|
+
const [previewTokenOnce, setPreviewTokenOnce] = useState<string | null>(null);
|
|
25
|
+
const [hostTokenOnce, setHostTokenOnce] = useState<string | null>(null);
|
|
26
|
+
const [copiedId, setCopiedId] = useState(false);
|
|
27
|
+
const [copiedEnv, setCopiedEnv] = useState(false);
|
|
28
|
+
const [siteUrl, setSiteUrl] = useState(workspace.siteUrls?.[0] ?? "");
|
|
29
|
+
const [error, setError] = useState<string | null>(null);
|
|
30
|
+
const [status, setStatus] = useState<string | null>(null);
|
|
31
|
+
const [busy, setBusy] = useState<string | null>(null);
|
|
32
|
+
|
|
33
|
+
const canEdit = workspace.role === "admin";
|
|
34
|
+
const webhookUrl = revalidateWebhookUrl(siteUrl);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!copiedId && !copiedEnv) return;
|
|
38
|
+
const id = window.setTimeout(() => {
|
|
39
|
+
setCopiedId(false);
|
|
40
|
+
setCopiedEnv(false);
|
|
41
|
+
}, 1500);
|
|
42
|
+
return () => window.clearTimeout(id);
|
|
43
|
+
}, [copiedId, copiedEnv]);
|
|
44
|
+
|
|
45
|
+
const envSnippet = hostEnvSnippet({
|
|
46
|
+
workspaceId: workspace.id,
|
|
47
|
+
contentToken: contentTokenOnce,
|
|
48
|
+
previewToken: previewTokenOnce,
|
|
49
|
+
hostToken: hostTokenOnce,
|
|
50
|
+
siteUrl: workspace.siteUrls?.[0],
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
async function onSaveSiteUrl(e: React.FormEvent) {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
setBusy("site-url");
|
|
56
|
+
setError(null);
|
|
57
|
+
setStatus(null);
|
|
58
|
+
const trimmed = siteUrl.trim();
|
|
59
|
+
try {
|
|
60
|
+
const res = await patchWorkspace(workspace.id, {
|
|
61
|
+
siteUrls: trimmed ? [trimmed] : [],
|
|
62
|
+
});
|
|
63
|
+
setWorkspace(res.workspace);
|
|
64
|
+
setSiteUrl(res.workspace.siteUrls[0] ?? "");
|
|
65
|
+
setStatus(trimmed ? "Site URL saved." : "Site URL cleared.");
|
|
66
|
+
} catch (err) {
|
|
67
|
+
setError(err instanceof Error ? err.message : "Could not save site URL");
|
|
68
|
+
} finally {
|
|
69
|
+
setBusy(null);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function onRotateToken() {
|
|
74
|
+
setBusy("token");
|
|
75
|
+
setError(null);
|
|
76
|
+
setStatus(null);
|
|
77
|
+
try {
|
|
78
|
+
const res = await rotateContentToken(workspace.id);
|
|
79
|
+
setContentTokenOnce(res.token);
|
|
80
|
+
setWorkspace((prev) =>
|
|
81
|
+
prev ? { ...prev, hasContentToken: true } : prev,
|
|
82
|
+
);
|
|
83
|
+
setStatus(
|
|
84
|
+
"Content token generated — copy it now; it won’t be shown again.",
|
|
85
|
+
);
|
|
86
|
+
} catch (err) {
|
|
87
|
+
setError(err instanceof Error ? err.message : "Token rotate failed");
|
|
88
|
+
} finally {
|
|
89
|
+
setBusy(null);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async function onRotatePreviewToken() {
|
|
94
|
+
setBusy("preview-token");
|
|
95
|
+
setError(null);
|
|
96
|
+
setStatus(null);
|
|
97
|
+
try {
|
|
98
|
+
const res = await rotatePreviewToken(workspace.id);
|
|
99
|
+
setPreviewTokenOnce(res.token);
|
|
100
|
+
setWorkspace((prev) =>
|
|
101
|
+
prev ? { ...prev, hasPreviewToken: true } : prev,
|
|
102
|
+
);
|
|
103
|
+
setStatus(
|
|
104
|
+
"Preview token generated — set BACKMATTER_PREVIEW_TOKEN on the test site.",
|
|
105
|
+
);
|
|
106
|
+
} catch (err) {
|
|
107
|
+
setError(err instanceof Error ? err.message : "Preview token failed");
|
|
108
|
+
} finally {
|
|
109
|
+
setBusy(null);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async function onRotateHostToken() {
|
|
114
|
+
setBusy("host-token");
|
|
115
|
+
setError(null);
|
|
116
|
+
setStatus(null);
|
|
117
|
+
try {
|
|
118
|
+
const res = await rotateHostToken(workspace.id);
|
|
119
|
+
setHostTokenOnce(res.token);
|
|
120
|
+
setWorkspace((prev) =>
|
|
121
|
+
prev ? { ...prev, hasHostToken: true } : prev,
|
|
122
|
+
);
|
|
123
|
+
setStatus(
|
|
124
|
+
"Host token generated — set BACKMATTER_HOST_TOKEN on the Next app.",
|
|
125
|
+
);
|
|
126
|
+
} catch (err) {
|
|
127
|
+
setError(err instanceof Error ? err.message : "Host token failed");
|
|
128
|
+
} finally {
|
|
129
|
+
setBusy(null);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<section>
|
|
135
|
+
<PageHeader
|
|
136
|
+
title="General"
|
|
137
|
+
description={`Production site URL and API tokens. Role: ${workspace.role}.`}
|
|
138
|
+
/>
|
|
139
|
+
{error ? <Text tone="danger">{error}</Text> : null}
|
|
140
|
+
{status ? <Text tone="success">{status}</Text> : null}
|
|
141
|
+
<Stack gap="lg">
|
|
142
|
+
<Panel>
|
|
143
|
+
<Text as="h2" size="lg" weight="medium">
|
|
144
|
+
Site URL
|
|
145
|
+
</Text>
|
|
146
|
+
<form onSubmit={(e) => void onSaveSiteUrl(e)}>
|
|
147
|
+
<div {...stylex.props(styles.block)}>
|
|
148
|
+
<Field
|
|
149
|
+
label="Site URL"
|
|
150
|
+
hint={
|
|
151
|
+
webhookUrl
|
|
152
|
+
? `Preview origin. Pushes POST ${webhookUrl}`
|
|
153
|
+
: "Preview origin. A content push POSTs the revalidate route on this origin."
|
|
154
|
+
}
|
|
155
|
+
>
|
|
156
|
+
<Input
|
|
157
|
+
type="url"
|
|
158
|
+
value={siteUrl}
|
|
159
|
+
readOnly={!canEdit}
|
|
160
|
+
placeholder="https://www.example.com"
|
|
161
|
+
autoComplete="off"
|
|
162
|
+
spellCheck={false}
|
|
163
|
+
data-lpignore="true"
|
|
164
|
+
data-1p-ignore
|
|
165
|
+
onChange={(e) => setSiteUrl(e.target.value)}
|
|
166
|
+
/>
|
|
167
|
+
</Field>
|
|
168
|
+
</div>
|
|
169
|
+
{canEdit ? (
|
|
170
|
+
<div {...stylex.props(styles.block)}>
|
|
171
|
+
<Button
|
|
172
|
+
type="submit"
|
|
173
|
+
variant="secondary"
|
|
174
|
+
disabled={busy !== null}
|
|
175
|
+
>
|
|
176
|
+
{busy === "site-url" ? "Saving…" : "Save"}
|
|
177
|
+
</Button>
|
|
178
|
+
</div>
|
|
179
|
+
) : null}
|
|
180
|
+
</form>
|
|
181
|
+
<StudioVersions versions={workspace.studioVersions} />
|
|
182
|
+
</Panel>
|
|
183
|
+
<Panel>
|
|
184
|
+
<Text as="h2" size="lg" weight="medium">
|
|
185
|
+
Workspace ID
|
|
186
|
+
</Text>
|
|
187
|
+
<div {...stylex.props(styles.idRow)}>
|
|
188
|
+
<pre {...stylex.props(styles.pre, styles.idPre)}>{workspace.id}</pre>
|
|
189
|
+
<Button
|
|
190
|
+
variant="secondary"
|
|
191
|
+
aria-label={copiedId ? "Copied workspace ID" : "Copy workspace ID"}
|
|
192
|
+
onClick={() => {
|
|
193
|
+
void navigator.clipboard.writeText(workspace.id).then(
|
|
194
|
+
() => setCopiedId(true),
|
|
195
|
+
() => setCopiedId(false),
|
|
196
|
+
);
|
|
197
|
+
}}
|
|
198
|
+
>
|
|
199
|
+
{copiedId ? "Copied" : "Copy"}
|
|
200
|
+
</Button>
|
|
201
|
+
</div>
|
|
202
|
+
<p {...stylex.props(styles.caption)}>
|
|
203
|
+
backmatter.config.ts workspaceId · public URLs use this id, not the slug
|
|
204
|
+
</p>
|
|
205
|
+
</Panel>
|
|
206
|
+
<Panel>
|
|
207
|
+
<Text as="h2" size="lg" weight="medium">
|
|
208
|
+
Host environment
|
|
209
|
+
</Text>
|
|
210
|
+
<div {...stylex.props(styles.block)}>
|
|
211
|
+
<Text tone="muted" size="sm">
|
|
212
|
+
Paste this into the Next host env. Put workspaceId in
|
|
213
|
+
backmatter.config.ts. Token values appear after you generate them
|
|
214
|
+
below; they are shown once.
|
|
215
|
+
</Text>
|
|
216
|
+
</div>
|
|
217
|
+
<pre {...stylex.props(styles.pre)}>{envSnippet}</pre>
|
|
218
|
+
<div {...stylex.props(styles.block)}>
|
|
219
|
+
<Button
|
|
220
|
+
variant="secondary"
|
|
221
|
+
aria-label={copiedEnv ? "Copied host environment" : "Copy host environment"}
|
|
222
|
+
onClick={() => {
|
|
223
|
+
void navigator.clipboard.writeText(envSnippet).then(
|
|
224
|
+
() => setCopiedEnv(true),
|
|
225
|
+
() => setCopiedEnv(false),
|
|
226
|
+
);
|
|
227
|
+
}}
|
|
228
|
+
>
|
|
229
|
+
{copiedEnv ? "Copied" : "Copy .env"}
|
|
230
|
+
</Button>
|
|
231
|
+
</div>
|
|
232
|
+
</Panel>
|
|
233
|
+
<Panel>
|
|
234
|
+
<Text as="h2" size="lg" weight="medium">
|
|
235
|
+
Content API token
|
|
236
|
+
</Text>
|
|
237
|
+
<div {...stylex.props(styles.block)}>
|
|
238
|
+
<Text tone="muted" size="sm">
|
|
239
|
+
Needed to read non-default branches (BACKMATTER_CONTENT_TOKEN). The
|
|
240
|
+
default branch is public.{" "}
|
|
241
|
+
{workspace.hasContentToken ? "A token is set." : "No token yet."}
|
|
242
|
+
</Text>
|
|
243
|
+
</div>
|
|
244
|
+
{contentTokenOnce ? (
|
|
245
|
+
<pre {...stylex.props(styles.pre)}>{contentTokenOnce}</pre>
|
|
246
|
+
) : null}
|
|
247
|
+
{canEdit ? (
|
|
248
|
+
<div {...stylex.props(styles.block)}>
|
|
249
|
+
<Button
|
|
250
|
+
variant="secondary"
|
|
251
|
+
disabled={busy !== null}
|
|
252
|
+
onClick={() => void onRotateToken()}
|
|
253
|
+
>
|
|
254
|
+
{busy === "token"
|
|
255
|
+
? "Generating…"
|
|
256
|
+
: workspace.hasContentToken
|
|
257
|
+
? "Rotate token"
|
|
258
|
+
: "Generate token"}
|
|
259
|
+
</Button>
|
|
260
|
+
</div>
|
|
261
|
+
) : null}
|
|
262
|
+
</Panel>
|
|
263
|
+
<Panel>
|
|
264
|
+
<Text as="h2" size="lg" weight="medium">
|
|
265
|
+
Preview token
|
|
266
|
+
</Text>
|
|
267
|
+
<div {...stylex.props(styles.block)}>
|
|
268
|
+
<Text tone="muted" size="sm">
|
|
269
|
+
Working tree SSE + preview session (BACKMATTER_PREVIEW_TOKEN).{" "}
|
|
270
|
+
{workspace.hasPreviewToken ? "A token is set." : "No token yet."}
|
|
271
|
+
</Text>
|
|
272
|
+
</div>
|
|
273
|
+
{previewTokenOnce ? (
|
|
274
|
+
<pre {...stylex.props(styles.pre)}>{previewTokenOnce}</pre>
|
|
275
|
+
) : null}
|
|
276
|
+
{canEdit ? (
|
|
277
|
+
<div {...stylex.props(styles.block)}>
|
|
278
|
+
<Button
|
|
279
|
+
variant="secondary"
|
|
280
|
+
disabled={busy !== null}
|
|
281
|
+
onClick={() => void onRotatePreviewToken()}
|
|
282
|
+
>
|
|
283
|
+
{busy === "preview-token"
|
|
284
|
+
? "Generating…"
|
|
285
|
+
: workspace.hasPreviewToken
|
|
286
|
+
? "Rotate preview token"
|
|
287
|
+
: "Generate preview token"}
|
|
288
|
+
</Button>
|
|
289
|
+
</div>
|
|
290
|
+
) : null}
|
|
291
|
+
</Panel>
|
|
292
|
+
<Panel>
|
|
293
|
+
<Text as="h2" size="lg" weight="medium">
|
|
294
|
+
Host token
|
|
295
|
+
</Text>
|
|
296
|
+
<div {...stylex.props(styles.block)}>
|
|
297
|
+
<Text tone="muted" size="sm">
|
|
298
|
+
Used by @backmatter/next to POST the schema snapshot on boot
|
|
299
|
+
(BACKMATTER_HOST_TOKEN).{" "}
|
|
300
|
+
{workspace.hasHostToken ? "A token is set." : "No token yet."}
|
|
301
|
+
</Text>
|
|
302
|
+
</div>
|
|
303
|
+
{hostTokenOnce ? (
|
|
304
|
+
<pre {...stylex.props(styles.pre)}>{hostTokenOnce}</pre>
|
|
305
|
+
) : null}
|
|
306
|
+
{canEdit ? (
|
|
307
|
+
<div {...stylex.props(styles.block)}>
|
|
308
|
+
<Button
|
|
309
|
+
variant="secondary"
|
|
310
|
+
disabled={busy !== null}
|
|
311
|
+
onClick={() => void onRotateHostToken()}
|
|
312
|
+
>
|
|
313
|
+
{busy === "host-token"
|
|
314
|
+
? "Generating…"
|
|
315
|
+
: workspace.hasHostToken
|
|
316
|
+
? "Rotate host token"
|
|
317
|
+
: "Generate host token"}
|
|
318
|
+
</Button>
|
|
319
|
+
</div>
|
|
320
|
+
) : null}
|
|
321
|
+
</Panel>
|
|
322
|
+
</Stack>
|
|
323
|
+
</section>
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/** Which Studio each site runs, as reported on its last session start. */
|
|
328
|
+
function StudioVersions({
|
|
329
|
+
versions,
|
|
330
|
+
}: {
|
|
331
|
+
versions: Record<string, { version: string; seenAt: string }> | undefined;
|
|
332
|
+
}) {
|
|
333
|
+
const entries = Object.entries(versions ?? {}).sort(([a], [b]) => a.localeCompare(b));
|
|
334
|
+
if (entries.length === 0) {
|
|
335
|
+
return (
|
|
336
|
+
<p {...stylex.props(styles.caption)}>
|
|
337
|
+
No site has opened its editor yet. Mount <code>@backmatter/studio</code> on the site and open
|
|
338
|
+
it from here.
|
|
339
|
+
</p>
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
return (
|
|
343
|
+
<div {...stylex.props(styles.block)}>
|
|
344
|
+
<Text tone="muted" size="sm">
|
|
345
|
+
Site editor
|
|
346
|
+
</Text>
|
|
347
|
+
{entries.map(([origin, seen]) => (
|
|
348
|
+
<p key={origin} {...stylex.props(styles.caption)}>
|
|
349
|
+
{origin} · @backmatter/studio {seen.version} · seen {relativeTime(seen.seenAt)}
|
|
350
|
+
</p>
|
|
351
|
+
))}
|
|
352
|
+
</div>
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export function relativeTime(iso: string, now = Date.now()): string {
|
|
357
|
+
const then = Date.parse(iso);
|
|
358
|
+
if (Number.isNaN(then)) return "unknown";
|
|
359
|
+
const minutes = Math.max(0, Math.round((now - then) / 60_000));
|
|
360
|
+
if (minutes < 1) return "just now";
|
|
361
|
+
if (minutes < 60) return `${minutes}m ago`;
|
|
362
|
+
const hours = Math.round(minutes / 60);
|
|
363
|
+
if (hours < 48) return `${hours}h ago`;
|
|
364
|
+
return `${Math.round(hours / 24)}d ago`;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const styles = stylex.create({
|
|
368
|
+
block: {
|
|
369
|
+
marginTop: space.md,
|
|
370
|
+
},
|
|
371
|
+
idRow: {
|
|
372
|
+
display: "flex",
|
|
373
|
+
alignItems: "center",
|
|
374
|
+
gap: space.sm,
|
|
375
|
+
marginTop: space.md,
|
|
376
|
+
minWidth: 0,
|
|
377
|
+
},
|
|
378
|
+
idPre: {
|
|
379
|
+
marginTop: 0,
|
|
380
|
+
flex: 1,
|
|
381
|
+
minWidth: 0,
|
|
382
|
+
},
|
|
383
|
+
caption: {
|
|
384
|
+
marginTop: space.sm,
|
|
385
|
+
marginBottom: 0,
|
|
386
|
+
color: colors.textMuted,
|
|
387
|
+
fontFamily: type.mono,
|
|
388
|
+
fontSize: type.xs,
|
|
389
|
+
lineHeight: 1.45,
|
|
390
|
+
},
|
|
391
|
+
pre: {
|
|
392
|
+
marginTop: space.md,
|
|
393
|
+
overflowX: "auto",
|
|
394
|
+
borderRadius: radius.md,
|
|
395
|
+
borderWidth: 1,
|
|
396
|
+
borderStyle: "solid",
|
|
397
|
+
borderColor: colors.border,
|
|
398
|
+
backgroundColor: colors.bgInput,
|
|
399
|
+
padding: space.md,
|
|
400
|
+
fontFamily: type.mono,
|
|
401
|
+
fontSize: type.xs,
|
|
402
|
+
},
|
|
403
|
+
});
|