@wular/coder 0.3.17 → 0.4.0
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/README.md +18 -16
- package/bin/coder.mjs +3 -1
- package/dist/actions-Mk3FSlpJ.js +20 -0
- package/dist/adapter-B0oYCI0S.js +1 -0
- package/dist/adapter-BKVzTDnn.js +1 -0
- package/dist/adapter-DPInwbJG.js +1 -0
- package/dist/adapter-DaiJMOYo.js +1 -0
- package/dist/adapter-PeKziOUg.js +1 -0
- package/dist/add-BxpLHnvD.js +1 -0
- package/dist/add-CE-70LFs.js +1 -0
- package/dist/add-U-pty9qJ.js +6 -0
- package/dist/add-ej0X9e3a.js +1 -0
- package/dist/add-json-CEa-6luW.js +1 -0
- package/dist/agent-BsYx3Odz.js +3 -0
- package/dist/agent-JdtZozvP.js +1 -0
- package/dist/alias-DX-Bm86x.js +2 -0
- package/dist/app-BT5f7zL5.js +1 -0
- package/dist/approvals-C-AvFt6s.js +2 -0
- package/dist/approve-DOmpQRNd.js +2 -0
- package/dist/apps-CjfrZyM5.js +1 -0
- package/dist/archive-BUB8gFKD.js +4 -0
- package/dist/archive-BziJ1rQ-.js +3 -0
- package/dist/archive-sweep-CtBcARgN.js +1 -0
- package/dist/args-BOEEdpWk.js +1 -0
- package/dist/ask-dE3U3ss2.js +4 -0
- package/dist/auth-BFny--17.js +1 -0
- package/dist/auth-DWHIzqbA.js +1 -0
- package/dist/builtin/coder/agent.json +24 -0
- package/dist/builtin/coder/system.md +17 -0
- package/dist/chat-3Znsevah.js +1 -0
- package/dist/chat-B_yhNTo0.js +13 -0
- package/dist/chat-bridge-BS9WtP3X.js +2 -0
- package/dist/cli-BilSDkvE.js +9 -0
- package/dist/cli.d.ts +71 -1
- package/dist/cli.js +1 -91
- package/dist/client-D9IoAuDD.js +1 -0
- package/dist/config-Da_cwoxI.js +3 -0
- package/dist/create-C_iMJV4Y.js +1 -0
- package/dist/credentials-B1jv6dkg.js +1 -0
- package/dist/dash/manifest.json +3427 -0
- package/dist/dash/public/assets/apple-touch-icon.png +0 -0
- package/dist/dash/public/assets/chunks/agent-pills-69c965aae1737cef.js +1 -0
- package/dist/dash/public/assets/chunks/agent-settings-form-a1ce70812eea3f20.js +1 -0
- package/dist/dash/public/assets/chunks/agents-grid-f62180478e43c192.js +1 -0
- package/dist/dash/public/assets/chunks/badge-d07f35e9abc80e14.js +1 -0
- package/dist/dash/public/assets/chunks/card-be04148b64223a52.js +1 -0
- package/dist/dash/public/assets/chunks/combo-32c321a7a84fa902.js +1 -0
- package/dist/dash/public/assets/chunks/composer-aec9c3c691f1f79a.js +1 -0
- package/dist/dash/public/assets/chunks/composer-data-6f7608fed13f3dd7.js +1 -0
- package/dist/dash/public/assets/chunks/composer-e56860d72742379e.js +1 -0
- package/dist/dash/public/assets/chunks/confirm-b4e2c16aef4b3431.js +1 -0
- package/dist/dash/public/assets/chunks/connect-apps-a5a63941e287c33f.js +1 -0
- package/dist/dash/public/assets/chunks/connect-repositories-e4c049b5b4384623.js +1 -0
- package/dist/dash/public/assets/chunks/credentials-list-2b7d0c771b89f9c5.js +2 -0
- package/dist/dash/public/assets/chunks/custom-range-53b70e0d9eeae84e.js +1 -0
- package/dist/dash/public/assets/chunks/editor-691d2bcecb1ecb87.js +7 -0
- package/dist/dash/public/assets/chunks/engines-list-a5fe1671601ce3b0.js +1 -0
- package/dist/dash/public/assets/chunks/field-9e12e5fc8774b6e5.js +1 -0
- package/dist/dash/public/assets/chunks/format-eb03fc9d9744d960.js +1 -0
- package/dist/dash/public/assets/chunks/heads-4041a925d63ab116.js +1 -0
- package/dist/dash/public/assets/chunks/instructions-4e0d18b9b40edbd7.js +2 -0
- package/dist/dash/public/assets/chunks/instructions-b00959bd4bb70502.js +1 -0
- package/dist/dash/public/assets/chunks/list-d7eb9e02cf261fbe.js +1 -0
- package/dist/dash/public/assets/chunks/mcp-list-a450533109045ef5.js +1 -0
- package/dist/dash/public/assets/chunks/model-options-15c53331a2f28a4f.js +1 -0
- package/dist/dash/public/assets/chunks/models-list-1e273c6843858148.js +1 -0
- package/dist/dash/public/assets/chunks/paged-bc6fa0c2b9d52ed7.js +1 -0
- package/dist/dash/public/assets/chunks/platform-actions-87f3f76ec1b840cb.js +1 -0
- package/dist/dash/public/assets/chunks/runners-list-fc7cdae4fa93e78b.js +1 -0
- package/dist/dash/public/assets/chunks/runtime-246221e985d863e5-1.js +2 -0
- package/dist/dash/public/assets/chunks/segmented-6091dfb2f954799f.js +1 -0
- package/dist/dash/public/assets/chunks/select-dd09a6b9544cfde2.js +1 -0
- package/dist/dash/public/assets/chunks/sentinel-ff7143a47fd22835.js +1 -0
- package/dist/dash/public/assets/chunks/shared-init-246221e985d863e5-2.js +1 -0
- package/dist/dash/public/assets/chunks/shared-init-8f2ac936c95a7f7b.js +1 -0
- package/dist/dash/public/assets/chunks/shared-init-986901c810947c12.js +5 -0
- package/dist/dash/public/assets/chunks/shared-init-baceed9fd2d43661.js +2 -0
- package/dist/dash/public/assets/chunks/tail-5a5bfcd308535d70.js +1 -0
- package/dist/dash/public/assets/chunks/task-actions-7919ca0e901131f4.js +1 -0
- package/dist/dash/public/assets/chunks/task-fa8b82e95e771c4a.js +1 -0
- package/dist/dash/public/assets/chunks/task-view-e8a0f99c992fa11e.js +3 -0
- package/dist/dash/public/assets/chunks/tasks-list-7b72f5b295349532.js +1 -0
- package/dist/dash/public/assets/chunks/toolbar-9b18a5d26dee37c3.js +1 -0
- package/dist/dash/public/assets/chunks/versions-list-8cdf3a41c56b2152.js +1 -0
- package/dist/dash/public/assets/chunks/wular-pnext-246221e985d863e5-0.js +1 -0
- package/dist/dash/public/assets/connect-382b1729a7ae7808.css +1 -0
- package/dist/dash/public/assets/dash-9e02d5d1a6d42ee3.css +1 -0
- package/dist/dash/public/assets/dash-account-04859899c1838ada.css +1 -0
- package/dist/dash/public/assets/dash-agents-9e678137267dec07.css +1 -0
- package/dist/dash/public/assets/dash-agents-new-26fa27b17ef9b8d8.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-b975c48f8abf3444.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-edit-e13fda599bb04843.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-platforms-70292932cb27bc96.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-settings-71f9a86251723fcc.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-tasks-fb8eb2ed71006601.css +1 -0
- package/dist/dash/public/assets/dash-agents-param-slug-usage-7c8740f1cdd52c71.css +1 -0
- package/dist/dash/public/assets/dash-settings-8eb818da462227e8.css +1 -0
- package/dist/dash/public/assets/dash-settings-param-tab-849a1a9542e273f5.css +1 -0
- package/dist/dash/public/assets/dash-tasks-81e510e0b6931b42.css +1 -0
- package/dist/dash/public/assets/dash-tasks-param-id-bbd2a83342f2ec10.css +1 -0
- package/dist/dash/public/assets/dash-usage-8e0259e03eaed1bd.css +1 -0
- package/dist/dash/public/assets/favicon.ico +0 -0
- package/dist/dash/public/assets/favicon.svg +1 -0
- package/dist/dash/public/assets/fonts/LICENSE-fira-code +93 -0
- package/dist/dash/public/assets/fonts/fira-code-latin-400-normal-717ee080.woff2 +0 -0
- package/dist/dash/public/assets/fonts/fira-code-latin-500-normal-530b6706.woff2 +0 -0
- package/dist/dash/public/assets/fonts/fira-code-latin-700-normal-98730669.woff2 +0 -0
- package/dist/dash/public/assets/global-d2adbf01910d9df5.css +1 -0
- package/dist/dash/public/assets/login-c129b1ce237be260.css +1 -0
- package/dist/dash/public/assets/pnext-client-073464b8f422ef57.js +1 -0
- package/dist/dash/public/assets/pnext-client-0b6720fdec66eeb0.js +1 -0
- package/dist/dash/public/assets/pnext-client-1e9cb2f4f6387a87.js +1 -0
- package/dist/dash/public/assets/pnext-client-2f0e78dd006fed0f.js +1 -0
- package/dist/dash/public/assets/pnext-client-3c62e2aa2cbe9fe1.js +1 -0
- package/dist/dash/public/assets/pnext-client-43a88896ed42dd39.js +1 -0
- package/dist/dash/public/assets/pnext-client-4cf2e27d0b9c0365.js +1 -0
- package/dist/dash/public/assets/pnext-client-587008fa987d3073.js +1 -0
- package/dist/dash/public/assets/pnext-client-676360cc86f31573.js +1 -0
- package/dist/dash/public/assets/pnext-client-813427605f424145.js +1 -0
- package/dist/dash/public/assets/pnext-client-82de7cf6dfc35b98.js +1 -0
- package/dist/dash/public/assets/pnext-client-831e8004c09f0b5b.js +1 -0
- package/dist/dash/public/assets/pnext-client-9b557fe468a45ca3.js +1 -0
- package/dist/dash/public/assets/pnext-client-ab7c900c802fe827.js +1 -0
- package/dist/dash/public/assets/pnext-client-d87d00e402811f0c.js +1 -0
- package/dist/dash/public/assets/pnext-client-fbdb7c1da7eda7e5.js +1 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/boot-B2MFTRO2.js +28 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/build-tier-XJJSL5FR.js +2702 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2HFY3DQT.js +206 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2ICEVELW.js +832 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-3UPROT2C.js +33 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4P5CMIYT.js +1580 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4TKZKZ3Q.js +129 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-5RDEILQB.js +435 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-62KEQM43.js +23 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-6KQSWT6D.js +829 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-7DCNCW6O.js +722 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-B4THCTQP.js +20 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-C2LIV2MM.js +170 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-CCATPVTW.js +376 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-COXJAPTU.js +87 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-E6IXL2NJ.js +6268 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FLGRBFAH.js +1196 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FTJVHFWD.js +59 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-H523KSIH.js +5149 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-HT6KKX6A.js +18 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JESFYECC.js +436 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JRPJM2XY.js +15 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L2IWDUXG.js +105 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L5P4Y4UC.js +181 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-NQE46AZN.js +645 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PA4QEARJ.js +127 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PZ5AXOLW.js +7144 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-SNVPTULL.js +2395 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-T3QZT3PG.js +218 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-VC5O2SDP.js +70 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-WZX4V6CM.js +229 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-XUUIDXY5.js +625 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-ZHFDO3PR.js +263 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/compile-CE2DN7ZA.js +16 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-UREY7XJT.js +14 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-loader-UI2XE3PZ.js +15 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/entry.js +217 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/generate-I2PPTDFD.js +14 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/modules-UVOCE4C2.js +46 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/pipeline-UW47K537.js +961 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/proxy-ITGOVJBW.js +24 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/register-4SA55SWT.js +12577 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/router-JNKHLBCZ.js +503 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/routes-PD6J2NXW.js +52 -0
- package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/tsconfig-defaults-ZXEH7RQK.js +13 -0
- package/dist/default-Bobztoxf.js +1 -0
- package/dist/default-vYPT26DR.js +1 -0
- package/dist/delete-D8gEwoOj.js +4 -0
- package/dist/delete-z1_86nf6.js +2 -0
- package/dist/disable-DVKd-0Xb.js +1 -0
- package/dist/discover-Df-a8K4R.js +3 -0
- package/dist/discover-Dvr_3_Xr.js +1 -0
- package/dist/dispatch-BKeAch9E.js +14 -0
- package/dist/docs-BX65z2Iu.js +2 -0
- package/dist/docs-DKJnqZqt.js +2 -0
- package/dist/enable-C8Zf_wpN.js +1 -0
- package/dist/env-CRf6wkM2.js +1 -0
- package/dist/exec-RZFLclKX.js +11 -0
- package/dist/executor-BvAA7Cgw.js +10 -0
- package/dist/flow/builtin/review.d.ts +157 -0
- package/dist/flow/builtin/review.js +19 -0
- package/dist/flow/index.d.ts +1 -1
- package/dist/flow/index.js +1 -1
- package/dist/flow-17k25MHt.js +1 -0
- package/dist/github-actions-DwUzm4hC.js +24 -0
- package/dist/http-Bkg_OQ6r.js +1 -0
- package/dist/{index-BQ-b77or.d.ts → index-DT7EST00.d.ts} +116 -238
- package/dist/init-CoMfFxbG.js +1 -0
- package/dist/integrations-5xCaXSd-.js +1 -0
- package/dist/integrations-BAgdVDhj.js +5 -0
- package/dist/lib/broker.js +3 -3
- package/dist/list-BAKvxSbh.js +4 -0
- package/dist/list-BYiG8Zav.js +2 -0
- package/dist/list-BxEywhHU.js +1 -0
- package/dist/list-C5w01-8q.js +1 -0
- package/dist/list-CIW2joV1.js +1 -0
- package/dist/list-DX-z3SBp.js +3 -0
- package/dist/list-DpCf4G-H.js +4 -0
- package/dist/list-VToARh3C.js +1 -0
- package/dist/load-BpEsAn51.js +2 -0
- package/dist/local-H3uvqEbq.js +1 -0
- package/dist/log-view-dg0TlKLA.js +1 -0
- package/dist/login-BFxX4jJy.js +1 -0
- package/dist/login-DkkslfBx.js +1 -0
- package/dist/logout-BHAtw4Z8.js +1 -0
- package/dist/maintenance-C5FklUw3.js +1 -0
- package/dist/match-CXAjDhg7.js +1 -0
- package/dist/mcp-BgKb2Cdk.js +1 -0
- package/dist/mcp-CCZOAo06.js +1 -0
- package/dist/mcp-server-DGzme0YX.js +1 -0
- package/dist/migrate-C4vM7DQN.js +2 -0
- package/dist/migrate-N-85_N7J.js +1 -0
- package/dist/model-Bs1StDo3.js +1 -0
- package/dist/models-_5LVGC3m.js +1 -0
- package/dist/output-BKeyLbvt.js +5 -0
- package/dist/prompt-CEuBMNhk.js +7 -0
- package/dist/push-CUC55Bqd.js +1 -0
- package/dist/queue-6io_NOP3.js +116 -0
- package/dist/refresh-BIrmrWYq.js +1 -0
- package/dist/remote-miQNTVRa.js +1 -0
- package/dist/remove-B93LNkZI.js +1 -0
- package/dist/remove-C5_xggx7.js +1 -0
- package/dist/remove-CuH8a3L9.js +1 -0
- package/dist/remove-eQ8y5C5p.js +1 -0
- package/dist/rename-CYfy03FE.js +1 -0
- package/dist/result-BEtQZHaY.js +5 -0
- package/dist/result-BzaM3inj.js +15 -0
- package/dist/resume-DYzKvyEw.js +3 -0
- package/dist/review-oIBeECZE.js +7 -0
- package/dist/rolldown-runtime-DT7IzrpZ.js +1 -0
- package/dist/rotate-key-IdMYH7gg.js +1 -0
- package/dist/run-BDYl0CKl.js +2 -0
- package/dist/run-CTtd0Znc.js +5 -0
- package/dist/run-CawRGnOg.js +2 -0
- package/dist/runner-D7ScbIHJ.js +1 -0
- package/dist/runner-sUpWJ_k0.js +1 -0
- package/dist/schema-CU2iFkp8.js +1 -0
- package/dist/sdk.d.ts +1166 -191
- package/dist/sdk.js +1 -1
- package/dist/serve-BTeomYxW.js +1 -0
- package/dist/serve-CE8YV2e9.js +1 -0
- package/dist/serve-CPnmrKyf.js +2 -0
- package/dist/serve-CQKZxzFE.js +4 -0
- package/dist/serve-GmRO89s5.js +12 -0
- package/dist/server-Kb22cWfF.js +1 -0
- package/dist/setup-host-GFTUzzZJ.js +6 -0
- package/dist/shared-DVtzWhUT.js +1 -0
- package/dist/show-CMUg8SJu.js +1 -0
- package/dist/show-COTZEYgc.js +1 -0
- package/dist/status-D26U--p8.js +1 -0
- package/dist/steer-C6uARLp5.js +4 -0
- package/dist/stop-BrGI3hSS.js +1 -0
- package/dist/stop-ByCAlbmN.js +3 -0
- package/dist/store-B94tSate.js +42 -0
- package/dist/store-DzqXS2wT.js +8 -0
- package/dist/task-C6VAg5WU.js +1 -0
- package/dist/task-CgOKgkEG.js +1 -0
- package/dist/task-DeglY79z.js +5 -0
- package/dist/test-NEbhlxvo.js +1 -0
- package/dist/tools-D0Zfs8Hx.js +1 -0
- package/dist/types-D0q15RJa.js +1 -0
- package/dist/types-Dve7Z0ZP.d.ts +389 -0
- package/dist/unalias-C9NqmSDq.js +1 -0
- package/dist/update-BTxYQj7Z.js +2 -0
- package/dist/upgrade-hA0yWBvx.js +2 -0
- package/dist/usage-BhqoCjvE.js +1 -0
- package/dist/usage-C4d9X2Uq.js +1 -0
- package/dist/watch-CSdj24ct.js +5 -0
- package/dist/watch-DtRuC0Wc.js +8 -0
- package/dist/wire-BeT1Axeo.js +1 -0
- package/dist/worker-CXndxmGF.js +9 -0
- package/dist/worker-DX7P9kWl.js +1 -0
- package/dist/workflow-Dcmdooi8.js +1 -0
- package/docs/agents/coder.md +26 -0
- package/docs/agents/index.md +120 -0
- package/docs/config.md +51 -30
- package/docs/dash.md +64 -0
- package/docs/flows.md +20 -15
- package/docs/mcp.md +62 -0
- package/docs/models.md +41 -23
- package/docs/review.md +41 -0
- package/docs/sdk.md +57 -38
- package/docs/self-host.md +188 -0
- package/migrations/0000_initial.sql +252 -0
- package/migrations/meta/0000_snapshot.json +1787 -0
- package/migrations/meta/_journal.json +13 -0
- package/package.json +37 -7
- package/plugins/agents/skills/coder/SKILL.md +14 -60
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/commands/setup.md +2 -2
- package/plugins/claude/skills/dispatch/SKILL.md +14 -58
- package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
- package/plugins/cursor/README.md +5 -5
- package/plugins/cursor/assets/logo.png +0 -0
- package/plugins/cursor/skills/coder/SKILL.md +14 -59
- package/src/client/index.ts +573 -0
- package/src/client/types.ts +506 -0
- package/src/core/errors.ts +72 -0
- package/src/core/task/log-view.ts +173 -0
- package/src/server/auth/sign-in.ts +14 -0
- package/src/server/dash/api/load.ts +62 -0
- package/src/server/dash/api/types.ts +11 -0
- package/src/server/dash/app/connect/page.tsx +42 -0
- package/src/server/dash/app/dash/account/loading.tsx +11 -0
- package/src/server/dash/app/dash/account/notify.tsx +42 -0
- package/src/server/dash/app/dash/account/page.css +81 -0
- package/src/server/dash/app/dash/account/page.tsx +126 -0
- package/src/server/dash/app/dash/account/sign-out.tsx +24 -0
- package/src/server/dash/app/dash/agents/(list)/agent-menu.tsx +10 -0
- package/src/server/dash/app/dash/agents/(list)/agents-grid.tsx +143 -0
- package/src/server/dash/app/dash/agents/(list)/connect-apps.tsx +46 -0
- package/src/server/dash/app/dash/agents/(list)/loading.tsx +14 -0
- package/src/server/dash/app/dash/agents/(list)/page.css +72 -0
- package/src/server/dash/app/dash/agents/(list)/page.tsx +89 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/layout.tsx +135 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/loading.tsx +5 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/page.css +21 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/page.tsx +173 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/loading.tsx +18 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/page.css +87 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/page.tsx +258 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/platform-actions.tsx +111 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/agent-settings-form.css +114 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/agent-settings-form.tsx +294 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/loading.tsx +5 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/page.tsx +54 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/tasks/loading.tsx +5 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/tasks/page.tsx +14 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/loading.tsx +31 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/page.css +12 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/page.tsx +163 -0
- package/src/server/dash/app/dash/agents/[slug]/(tabs)/versions-list.tsx +53 -0
- package/src/server/dash/app/dash/agents/[slug]/edit/loading.tsx +31 -0
- package/src/server/dash/app/dash/agents/[slug]/edit/page.tsx +91 -0
- package/src/server/dash/app/dash/agents/agent/agent-pills.css +27 -0
- package/src/server/dash/app/dash/agents/agent/agent-pills.tsx +133 -0
- package/src/server/dash/app/dash/agents/agent/hero.css +40 -0
- package/src/server/dash/app/dash/agents/agent/hero.tsx +60 -0
- package/src/server/dash/app/dash/agents/agent/instructions.css +29 -0
- package/src/server/dash/app/dash/agents/agent/instructions.tsx +82 -0
- package/src/server/dash/app/dash/agents/editor/connect-repositories.ts +16 -0
- package/src/server/dash/app/dash/agents/editor/editor.css +263 -0
- package/src/server/dash/app/dash/agents/editor/editor.tsx +774 -0
- package/src/server/dash/app/dash/agents/editor/import-picker.css +48 -0
- package/src/server/dash/app/dash/agents/editor/import-picker.tsx +253 -0
- package/src/server/dash/app/dash/agents/editor/names.ts +35 -0
- package/src/server/dash/app/dash/agents/new/loading.tsx +25 -0
- package/src/server/dash/app/dash/agents/new/page.tsx +72 -0
- package/src/server/dash/app/dash/layout.css +265 -0
- package/src/server/dash/app/dash/layout.tsx +332 -0
- package/src/server/dash/app/dash/page.tsx +14 -0
- package/src/server/dash/app/dash/settings/[tab]/credentials-list.css +94 -0
- package/src/server/dash/app/dash/settings/[tab]/credentials-list.tsx +619 -0
- package/src/server/dash/app/dash/settings/[tab]/credentials.tsx +36 -0
- package/src/server/dash/app/dash/settings/[tab]/engines-list.css +16 -0
- package/src/server/dash/app/dash/settings/[tab]/engines-list.tsx +135 -0
- package/src/server/dash/app/dash/settings/[tab]/list.css +98 -0
- package/src/server/dash/app/dash/settings/[tab]/list.tsx +215 -0
- package/src/server/dash/app/dash/settings/[tab]/loading.tsx +6 -0
- package/src/server/dash/app/dash/settings/[tab]/mcp-list.css +43 -0
- package/src/server/dash/app/dash/settings/[tab]/mcp-list.tsx +290 -0
- package/src/server/dash/app/dash/settings/[tab]/models-list.tsx +513 -0
- package/src/server/dash/app/dash/settings/[tab]/page.tsx +89 -0
- package/src/server/dash/app/dash/settings/[tab]/runners-list.css +153 -0
- package/src/server/dash/app/dash/settings/[tab]/runners-list.tsx +457 -0
- package/src/server/dash/app/dash/settings/layout.tsx +50 -0
- package/src/server/dash/app/dash/settings/model-options.ts +117 -0
- package/src/server/dash/app/dash/settings/page.tsx +7 -0
- package/src/server/dash/app/dash/settings/settings-head.tsx +24 -0
- package/src/server/dash/app/dash/settings/tunnel-guide.tsx +28 -0
- package/src/server/dash/app/dash/tasks/[id]/activity.tsx +202 -0
- package/src/server/dash/app/dash/tasks/[id]/loading.tsx +31 -0
- package/src/server/dash/app/dash/tasks/[id]/page.tsx +30 -0
- package/src/server/dash/app/dash/tasks/[id]/task-actions.tsx +164 -0
- package/src/server/dash/app/dash/tasks/[id]/task-view.css +407 -0
- package/src/server/dash/app/dash/tasks/[id]/task-view.tsx +513 -0
- package/src/server/dash/app/dash/tasks/composer-data.ts +96 -0
- package/src/server/dash/app/dash/tasks/composer.css +316 -0
- package/src/server/dash/app/dash/tasks/composer.tsx +890 -0
- package/src/server/dash/app/dash/tasks/list/status.css +50 -0
- package/src/server/dash/app/dash/tasks/list/status.tsx +20 -0
- package/src/server/dash/app/dash/tasks/list/task.ts +45 -0
- package/src/server/dash/app/dash/tasks/list/tasks-list.css +85 -0
- package/src/server/dash/app/dash/tasks/list/tasks-list.tsx +402 -0
- package/src/server/dash/app/dash/tasks/list/tasks-section.tsx +96 -0
- package/src/server/dash/app/dash/tasks/page.tsx +53 -0
- package/src/server/dash/app/dash/token-from-hash.tsx +17 -0
- package/src/server/dash/app/dash/usage/custom-range.tsx +63 -0
- package/src/server/dash/app/dash/usage/day-chart.css +109 -0
- package/src/server/dash/app/dash/usage/day-chart.tsx +110 -0
- package/src/server/dash/app/dash/usage/loading.tsx +17 -0
- package/src/server/dash/app/dash/usage/metric.ts +13 -0
- package/src/server/dash/app/dash/usage/page.tsx +117 -0
- package/src/server/dash/app/dash/usage/range-bar.css +13 -0
- package/src/server/dash/app/dash/usage/range-bar.tsx +69 -0
- package/src/server/dash/app/dash/usage/stats.css +52 -0
- package/src/server/dash/app/dash/usage/stats.tsx +19 -0
- package/src/server/dash/app/dash/usage/top-agents.css +40 -0
- package/src/server/dash/app/dash/usage/top-agents.tsx +138 -0
- package/src/server/dash/app/dash/usage/usage.css +0 -0
- package/src/server/dash/app/globals.css +692 -0
- package/src/server/dash/app/layout.tsx +52 -0
- package/src/server/dash/app/login/page.css +26 -0
- package/src/server/dash/app/login/page.tsx +57 -0
- package/src/server/dash/app/page.tsx +5 -0
- package/src/server/dash/app/responsive.css +49 -0
- package/src/server/dash/app/zone.tsx +13 -0
- package/src/server/dash/comps/frame/auth-panel.css +60 -0
- package/src/server/dash/comps/frame/auth-panel.tsx +44 -0
- package/src/server/dash/comps/frame/drawer.css +28 -0
- package/src/server/dash/comps/frame/drawer.tsx +39 -0
- package/src/server/dash/comps/frame/heads.ts +41 -0
- package/src/server/dash/comps/frame/loading-card.tsx +65 -0
- package/src/server/dash/comps/frame/page-head.css +83 -0
- package/src/server/dash/comps/frame/page-head.tsx +71 -0
- package/src/server/dash/comps/frame/stream.tsx +50 -0
- package/src/server/dash/comps/frame/task-toasts.tsx +214 -0
- package/src/server/dash/comps/frame/theme-choices.tsx +46 -0
- package/src/server/dash/comps/nav/current-link.tsx +53 -0
- package/src/server/dash/comps/nav/side-toggle.tsx +30 -0
- package/src/server/dash/comps/nav/to.ts +22 -0
- package/src/server/dash/comps/ui/badge.css +64 -0
- package/src/server/dash/comps/ui/badge.tsx +41 -0
- package/src/server/dash/comps/ui/card.css +93 -0
- package/src/server/dash/comps/ui/card.tsx +77 -0
- package/src/server/dash/comps/ui/collapse.css +32 -0
- package/src/server/dash/comps/ui/collapse.tsx +49 -0
- package/src/server/dash/comps/ui/combo.tsx +154 -0
- package/src/server/dash/comps/ui/confirm.css +36 -0
- package/src/server/dash/comps/ui/confirm.tsx +67 -0
- package/src/server/dash/comps/ui/field.css +25 -0
- package/src/server/dash/comps/ui/field.tsx +34 -0
- package/src/server/dash/comps/ui/icon.css +22 -0
- package/src/server/dash/comps/ui/icon.tsx +17 -0
- package/src/server/dash/comps/ui/icons.ts +44 -0
- package/src/server/dash/comps/ui/menu.css +178 -0
- package/src/server/dash/comps/ui/menu.tsx +152 -0
- package/src/server/dash/comps/ui/segmented.css +44 -0
- package/src/server/dash/comps/ui/segmented.tsx +58 -0
- package/src/server/dash/comps/ui/select.css +103 -0
- package/src/server/dash/comps/ui/select.tsx +250 -0
- package/src/server/dash/comps/ui/sentinel.css +58 -0
- package/src/server/dash/comps/ui/sentinel.tsx +67 -0
- package/src/server/dash/comps/ui/tabs.css +81 -0
- package/src/server/dash/comps/ui/tabs.tsx +32 -0
- package/src/server/dash/comps/ui/tail.css +12 -0
- package/src/server/dash/comps/ui/tail.tsx +37 -0
- package/src/server/dash/comps/ui/toast.css +72 -0
- package/src/server/dash/comps/ui/toolbar.css +143 -0
- package/src/server/dash/comps/ui/toolbar.tsx +93 -0
- package/src/server/dash/package.json +5 -0
- package/src/server/dash/pnext-env.d.ts +4 -0
- package/src/server/dash/pnext.config.ts +5 -0
- package/src/server/dash/public/assets/apple-touch-icon.png +0 -0
- package/src/server/dash/public/assets/favicon.ico +0 -0
- package/src/server/dash/public/assets/favicon.svg +1 -0
- package/src/server/dash/public/assets/fonts/LICENSE-fira-code +93 -0
- package/src/server/dash/public/assets/fonts/fira-code-latin-400-normal-717ee080.woff2 +0 -0
- package/src/server/dash/public/assets/fonts/fira-code-latin-500-normal-530b6706.woff2 +0 -0
- package/src/server/dash/public/assets/fonts/fira-code-latin-700-normal-98730669.woff2 +0 -0
- package/src/server/dash/tsconfig.json +10 -0
- package/src/server/dash/utils/client.ts +19 -0
- package/src/server/dash/utils/format.ts +75 -0
- package/src/server/dash/utils/paged.ts +184 -0
- package/src/server/dash/utils/range.ts +117 -0
- package/dist/app-server-bHl6RBZ2.js +0 -3
- package/dist/runtime-X5Bgf1qH.js +0 -26
- package/dist/upgrade-piLxMgEv.js +0 -37
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import '@/comps/ui/toast.css';
|
|
4
|
+
|
|
5
|
+
import { useEffect, useRef, useState } from 'preact/hooks';
|
|
6
|
+
|
|
7
|
+
import { serverEvents } from '@coder/client';
|
|
8
|
+
import type { TaskRow, TaskState } from '@coder/client/types';
|
|
9
|
+
import { client } from '@/utils/client';
|
|
10
|
+
import { Link } from '@wular/pnext/link';
|
|
11
|
+
import { usePathname, useRouter } from '@wular/pnext/navigation/client';
|
|
12
|
+
import { Status, STATUS_LABEL } from '@/app/dash/tasks/list/status';
|
|
13
|
+
|
|
14
|
+
type Watched = { title: string; status: TaskState; at: number };
|
|
15
|
+
type Live = Pick<TaskRow, 'status' | 'result' | 'error' | 'approval'>;
|
|
16
|
+
type Toast = { key: string; id?: string; title: string; status?: TaskState; line: string };
|
|
17
|
+
|
|
18
|
+
const WATCHED = 'coder:watched';
|
|
19
|
+
export const NOTIFY = 'coder:notify';
|
|
20
|
+
const TOAST = 'coder:toast';
|
|
21
|
+
const DONE = new Set<TaskState>(['completed', 'failed', 'cancelled']);
|
|
22
|
+
const SHOWN = new Set<TaskState>([...DONE, 'waiting']);
|
|
23
|
+
const KEEP = 20;
|
|
24
|
+
const STREAMS = 3;
|
|
25
|
+
const MAX = 3;
|
|
26
|
+
const TTL = 8000;
|
|
27
|
+
// Past any log line, so a stream sends status alone; log seqs are PostgreSQL integers.
|
|
28
|
+
const NO_LINES = 2 ** 31 - 1;
|
|
29
|
+
|
|
30
|
+
const read = (): Record<string, Watched> => {
|
|
31
|
+
try {
|
|
32
|
+
return JSON.parse(localStorage.getItem(WATCHED) ?? '{}') ?? {};
|
|
33
|
+
} catch {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const save = (all: Record<string, Watched>) => {
|
|
39
|
+
const kept = Object.entries(all)
|
|
40
|
+
.sort(([, a], [, b]) => b.at - a.at)
|
|
41
|
+
.slice(0, KEEP);
|
|
42
|
+
localStorage.setItem(WATCHED, JSON.stringify(Object.fromEntries(kept)));
|
|
43
|
+
dispatchEvent(new Event(WATCHED));
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** An error toast for an action whose page has no room for it. */
|
|
47
|
+
export const toastError = (title: string, line: string) =>
|
|
48
|
+
dispatchEvent(new CustomEvent(TOAST, { detail: { title, line } }));
|
|
49
|
+
|
|
50
|
+
/** Remembers a task this browser started or opened, so its finish shows a toast on any page. */
|
|
51
|
+
export function watchTask(id: string, status: TaskState, title?: string) {
|
|
52
|
+
const all = read();
|
|
53
|
+
const entry = all[id];
|
|
54
|
+
if (!entry && DONE.has(status)) return;
|
|
55
|
+
if (entry?.status === status && (!title || entry.title === title)) return;
|
|
56
|
+
all[id] = { title: title || entry?.title || id, status, at: entry?.at ?? Date.now() };
|
|
57
|
+
save(all);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const openTask = (path: string) => /^\/dash\/tasks\/([^/]+)$/.exec(path)?.[1];
|
|
61
|
+
|
|
62
|
+
function lineOf(live: Live): string {
|
|
63
|
+
const text = (value: unknown) => (typeof value === 'string' ? value.trim().split('\n')[0]! : '');
|
|
64
|
+
const approval = (live.approval ?? {}) as Record<string, unknown>;
|
|
65
|
+
const result = typeof live.result === 'object' ? live.result?.output : live.result;
|
|
66
|
+
if (live.status === 'waiting')
|
|
67
|
+
return (
|
|
68
|
+
text(approval.summary) ||
|
|
69
|
+
text(approval.reason) ||
|
|
70
|
+
text(approval.kind) ||
|
|
71
|
+
'It is waiting for your approval.'
|
|
72
|
+
);
|
|
73
|
+
if (live.status === 'completed') return text(result) || 'It finished.';
|
|
74
|
+
return text(live.error) || (live.status === 'failed' ? 'It failed.' : 'It was stopped.');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Follows one watched task's event stream for its status alone. */
|
|
78
|
+
function Follow({ id, onStatus }: { id: string; onStatus: (id: string, live: Live) => void }) {
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const abort = new AbortController();
|
|
81
|
+
const follow = async () => {
|
|
82
|
+
while (!abort.signal.aborted) {
|
|
83
|
+
try {
|
|
84
|
+
const response = await client.tasks.stream(id, NO_LINES, abort.signal);
|
|
85
|
+
if (response.status === 404) {
|
|
86
|
+
const all = read();
|
|
87
|
+
delete all[id];
|
|
88
|
+
return save(all);
|
|
89
|
+
}
|
|
90
|
+
if (!response.ok || !response.body) return;
|
|
91
|
+
for await (const event of serverEvents(response.body)) {
|
|
92
|
+
if (event.event === 'status') onStatus(id, JSON.parse(event.data));
|
|
93
|
+
else if (event.event === 'end') return;
|
|
94
|
+
}
|
|
95
|
+
} catch {
|
|
96
|
+
if (abort.signal.aborted) return;
|
|
97
|
+
}
|
|
98
|
+
await new Promise(done => setTimeout(done, 1000));
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
void follow();
|
|
102
|
+
return () => abort.abort();
|
|
103
|
+
}, [id]);
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function Item({ toast, dismiss }: { toast: Toast; dismiss: (key: string) => void }) {
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const timer = setTimeout(() => dismiss(toast.key), TTL);
|
|
110
|
+
return () => clearTimeout(timer);
|
|
111
|
+
}, []);
|
|
112
|
+
return (
|
|
113
|
+
<div class={toast.id ? 'toast' : 'toast err'} onClick={() => dismiss(toast.key)}>
|
|
114
|
+
<p class="toast-head">
|
|
115
|
+
{toast.id ? (
|
|
116
|
+
<Link class="cover" href="/dash/tasks/[id]" params={{ id: toast.id }}>
|
|
117
|
+
{toast.title}
|
|
118
|
+
</Link>
|
|
119
|
+
) : (
|
|
120
|
+
<span class="cover">{toast.title}</span>
|
|
121
|
+
)}
|
|
122
|
+
{toast.status ? <Status status={toast.status} /> : null}
|
|
123
|
+
</p>
|
|
124
|
+
<p class="toast-line">{toast.line}</p>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Toasts at the bottom right when a watched task finishes or needs approval, except on its own page. */
|
|
130
|
+
export function TaskToasts() {
|
|
131
|
+
const path = usePathname();
|
|
132
|
+
const nav = useRouter();
|
|
133
|
+
const [watched, setWatched] = useState<Record<string, Watched>>({});
|
|
134
|
+
const [toasts, setToasts] = useState<Toast[]>([]);
|
|
135
|
+
const open = useRef(openTask(path));
|
|
136
|
+
open.current = openTask(path);
|
|
137
|
+
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
const sync = () => setWatched(read());
|
|
140
|
+
sync();
|
|
141
|
+
addEventListener(WATCHED, sync);
|
|
142
|
+
addEventListener('storage', sync);
|
|
143
|
+
return () => {
|
|
144
|
+
removeEventListener(WATCHED, sync);
|
|
145
|
+
removeEventListener('storage', sync);
|
|
146
|
+
};
|
|
147
|
+
}, []);
|
|
148
|
+
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
const onToast = (event: Event) => {
|
|
151
|
+
const { title, line } = (event as CustomEvent<{ title: string; line: string }>).detail;
|
|
152
|
+
setToasts(list => [{ key: `${TOAST}:${Date.now()}`, title, line }, ...list].slice(0, MAX));
|
|
153
|
+
};
|
|
154
|
+
addEventListener(TOAST, onToast);
|
|
155
|
+
return () => removeEventListener(TOAST, onToast);
|
|
156
|
+
}, []);
|
|
157
|
+
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if (!toasts.length) return;
|
|
160
|
+
const onKey = (event: KeyboardEvent) => event.key === 'Escape' && setToasts([]);
|
|
161
|
+
addEventListener('keydown', onKey);
|
|
162
|
+
return () => removeEventListener('keydown', onKey);
|
|
163
|
+
}, [toasts.length]);
|
|
164
|
+
|
|
165
|
+
const dismiss = (key: string) => setToasts(list => list.filter(toast => toast.key !== key));
|
|
166
|
+
|
|
167
|
+
const onStatus = (id: string, live: Live) => {
|
|
168
|
+
const seen = read()[id];
|
|
169
|
+
if (!seen || seen.status === live.status) return;
|
|
170
|
+
watchTask(id, live.status);
|
|
171
|
+
if (!SHOWN.has(live.status) || open.current === id) return;
|
|
172
|
+
const toast = {
|
|
173
|
+
key: `${id}:${Date.now()}`,
|
|
174
|
+
id,
|
|
175
|
+
title: seen.title,
|
|
176
|
+
status: live.status,
|
|
177
|
+
line: lineOf(live),
|
|
178
|
+
};
|
|
179
|
+
setToasts(list => [toast, ...list].slice(0, MAX));
|
|
180
|
+
if (
|
|
181
|
+
localStorage.getItem(NOTIFY) !== '1' ||
|
|
182
|
+
typeof Notification === 'undefined' ||
|
|
183
|
+
Notification.permission !== 'granted'
|
|
184
|
+
)
|
|
185
|
+
return;
|
|
186
|
+
const notice = new Notification(`${toast.title} (${STATUS_LABEL[toast.status]})`, {
|
|
187
|
+
body: toast.line,
|
|
188
|
+
tag: id,
|
|
189
|
+
});
|
|
190
|
+
notice.onclick = () => {
|
|
191
|
+
focus();
|
|
192
|
+
nav.push('/dash/tasks/[id]', { params: { id } });
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// Its own page follows an open task; the rest share a few streams, newest first.
|
|
197
|
+
const follow = Object.entries(watched)
|
|
198
|
+
.filter(([id, entry]) => !DONE.has(entry.status) && id !== open.current)
|
|
199
|
+
.sort(([, a], [, b]) => b.at - a.at)
|
|
200
|
+
.slice(0, STREAMS);
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
<>
|
|
204
|
+
{follow.map(([id]) => (
|
|
205
|
+
<Follow key={id} id={id} onStatus={onStatus} />
|
|
206
|
+
))}
|
|
207
|
+
<section class="toasts" aria-label="Task updates" aria-live="polite">
|
|
208
|
+
{toasts.map(toast => (
|
|
209
|
+
<Item key={toast.key} toast={toast} dismiss={dismiss} />
|
|
210
|
+
))}
|
|
211
|
+
</section>
|
|
212
|
+
</>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'preact/hooks';
|
|
4
|
+
|
|
5
|
+
import { iCheck, iMonitor, iMoon, iSun } from '@/comps/ui/icons';
|
|
6
|
+
import { Icon } from '@/comps/ui/icon';
|
|
7
|
+
|
|
8
|
+
const YEAR = 60 * 60 * 24 * 365;
|
|
9
|
+
|
|
10
|
+
const THEMES = [
|
|
11
|
+
['light', 'Light', iSun],
|
|
12
|
+
['dark', 'Dark', iMoon],
|
|
13
|
+
['system', 'System', iMonitor],
|
|
14
|
+
] as const;
|
|
15
|
+
|
|
16
|
+
/** The theme menu's choices; a pick applies at once and is kept in a cookie. */
|
|
17
|
+
export function ThemeChoices({ theme: initial }: { theme: string }) {
|
|
18
|
+
const [theme, setTheme] = useState(initial);
|
|
19
|
+
const pick = (value: string) => {
|
|
20
|
+
const root = document.documentElement;
|
|
21
|
+
if (value === 'system') delete root.dataset.theme;
|
|
22
|
+
else root.dataset.theme = value;
|
|
23
|
+
|
|
24
|
+
document.cookie = `theme=${value}; path=/; max-age=${YEAR}; samesite=lax`;
|
|
25
|
+
setTheme(value);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
{THEMES.map(([value, label, icon]) => (
|
|
31
|
+
<button
|
|
32
|
+
key={value}
|
|
33
|
+
type="button"
|
|
34
|
+
class="pop-item"
|
|
35
|
+
role="menuitemradio"
|
|
36
|
+
aria-checked={theme === value}
|
|
37
|
+
onClick={() => pick(value)}
|
|
38
|
+
>
|
|
39
|
+
<Icon d={icon} />
|
|
40
|
+
<span class="grow">{label}</span>
|
|
41
|
+
<Icon d={iCheck} />
|
|
42
|
+
</button>
|
|
43
|
+
))}
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Link, type LinkProps } from '@wular/pnext/link';
|
|
4
|
+
import type { RefObject } from 'preact';
|
|
5
|
+
import { useLayoutEffect, useRef } from 'preact/hooks';
|
|
6
|
+
import { useLinkStatus, usePathname } from '@wular/pnext/navigation/client';
|
|
7
|
+
|
|
8
|
+
import { pathOf } from './to';
|
|
9
|
+
|
|
10
|
+
/** A link marked current when the address is its path, or under `within`. */
|
|
11
|
+
export function CurrentLink({
|
|
12
|
+
within,
|
|
13
|
+
children,
|
|
14
|
+
onClick,
|
|
15
|
+
...link
|
|
16
|
+
}: LinkProps & { within?: string }) {
|
|
17
|
+
const at = usePathname();
|
|
18
|
+
const current =
|
|
19
|
+
at === pathOf(link) || (within !== undefined && (at === within || at.startsWith(`${within}/`)));
|
|
20
|
+
|
|
21
|
+
const anchor = useRef<HTMLAnchorElement>(null);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Link
|
|
25
|
+
{...link}
|
|
26
|
+
aria-current={current ? 'page' : undefined}
|
|
27
|
+
onClick={event => {
|
|
28
|
+
anchor.current = event.currentTarget;
|
|
29
|
+
onClick?.(event);
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
<PendingCurrent anchor={anchor} current={current} />
|
|
34
|
+
</Link>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Link status belongs to a child of Link's context. A pending link marks itself, and CSS moves the underline there until the address catches up.
|
|
39
|
+
function PendingCurrent({
|
|
40
|
+
anchor,
|
|
41
|
+
current,
|
|
42
|
+
}: {
|
|
43
|
+
anchor: RefObject<HTMLAnchorElement>;
|
|
44
|
+
current: boolean;
|
|
45
|
+
}) {
|
|
46
|
+
const { pending } = useLinkStatus();
|
|
47
|
+
useLayoutEffect(() => {
|
|
48
|
+
if (!anchor.current) return;
|
|
49
|
+
if (pending && !current) anchor.current.setAttribute('data-pending', '');
|
|
50
|
+
else anchor.current.removeAttribute('data-pending');
|
|
51
|
+
}, [pending, current]);
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'preact/hooks';
|
|
4
|
+
|
|
5
|
+
import { iLeft, iRight } from '@/comps/ui/icons';
|
|
6
|
+
import { Icon } from '@/comps/ui/icon';
|
|
7
|
+
|
|
8
|
+
const COOKIE = 'side';
|
|
9
|
+
|
|
10
|
+
/** Collapses the sidebar to its icons; the choice lives in a cookie so the next page renders that way at once. */
|
|
11
|
+
export function SideToggle({ collapsed: initial }: { collapsed: boolean }) {
|
|
12
|
+
const [collapsed, setCollapsed] = useState(initial);
|
|
13
|
+
const toggle = () => {
|
|
14
|
+
const next = !collapsed;
|
|
15
|
+
setCollapsed(next);
|
|
16
|
+
document.querySelector('.app')?.classList.toggle('side-min', next);
|
|
17
|
+
document.cookie = `${COOKIE}=${next ? 'min' : ''}; path=/; max-age=${next ? 31536000 : 0}; samesite=lax`;
|
|
18
|
+
};
|
|
19
|
+
return (
|
|
20
|
+
<button
|
|
21
|
+
type="button"
|
|
22
|
+
class="icon-btn side-toggle"
|
|
23
|
+
aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
|
|
24
|
+
title={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
|
|
25
|
+
onClick={toggle}
|
|
26
|
+
>
|
|
27
|
+
<Icon d={collapsed ? iRight : iLeft} />
|
|
28
|
+
</button>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LinkProps } from '@wular/pnext/link';
|
|
2
|
+
import type { SearchInput } from '@wular/pnext/navigation';
|
|
3
|
+
|
|
4
|
+
/** A typed in-app link target: a route from the route list, its params and query. */
|
|
5
|
+
export type To = Pick<LinkProps, 'href' | 'params' | 'search'>;
|
|
6
|
+
|
|
7
|
+
/** The path a target resolves to, to compare with the address. */
|
|
8
|
+
export const pathOf = (to: To) => {
|
|
9
|
+
const params: Partial<Record<string, unknown>> = to.params ?? {};
|
|
10
|
+
return to.href.replace(/\[([^\]]+)\]/g, (_, key: string) =>
|
|
11
|
+
encodeURIComponent(String(params[key] ?? '')),
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** A query with some keys set on top of another. */
|
|
16
|
+
export function withSearch(base: SearchInput | undefined, set: Record<string, string>) {
|
|
17
|
+
const search = new URLSearchParams(
|
|
18
|
+
base instanceof URLSearchParams ? base : (base as Record<string, string> | undefined),
|
|
19
|
+
);
|
|
20
|
+
for (const [key, value] of Object.entries(set)) search.set(key, value);
|
|
21
|
+
return search;
|
|
22
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* badges and task states */
|
|
2
|
+
.badge {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 6px;
|
|
6
|
+
padding: 1px 7px;
|
|
7
|
+
border: 1px solid var(--line2);
|
|
8
|
+
font-size: 10px;
|
|
9
|
+
letter-spacing: 0.14em;
|
|
10
|
+
color: var(--muted);
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
}
|
|
13
|
+
.badge.acc {
|
|
14
|
+
border-color: transparent;
|
|
15
|
+
background: var(--accbg);
|
|
16
|
+
color: var(--acc);
|
|
17
|
+
}
|
|
18
|
+
.badge.ok {
|
|
19
|
+
border-color: transparent;
|
|
20
|
+
background: var(--okbg);
|
|
21
|
+
color: var(--ok);
|
|
22
|
+
}
|
|
23
|
+
.badge.warn {
|
|
24
|
+
border-color: transparent;
|
|
25
|
+
background: var(--warnbg);
|
|
26
|
+
color: var(--warn);
|
|
27
|
+
}
|
|
28
|
+
.badge.solid {
|
|
29
|
+
border-color: var(--fg);
|
|
30
|
+
background: var(--fg);
|
|
31
|
+
color: var(--bg);
|
|
32
|
+
}
|
|
33
|
+
a.badge:hover,
|
|
34
|
+
button.badge:hover {
|
|
35
|
+
border-color: var(--acc);
|
|
36
|
+
}
|
|
37
|
+
button.badge {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
.chips {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
flex-wrap: wrap;
|
|
43
|
+
gap: 4px;
|
|
44
|
+
}
|
|
45
|
+
.chip {
|
|
46
|
+
line-height: 18px;
|
|
47
|
+
padding: 0 6px;
|
|
48
|
+
border: 1px solid var(--line2);
|
|
49
|
+
font-size: 11.5px;
|
|
50
|
+
color: var(--muted);
|
|
51
|
+
}
|
|
52
|
+
.id {
|
|
53
|
+
font-size: 11.5px;
|
|
54
|
+
color: var(--dim);
|
|
55
|
+
}
|
|
56
|
+
button.chip {
|
|
57
|
+
background: none;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
}
|
|
60
|
+
button.chip:hover,
|
|
61
|
+
button.chip[aria-pressed="true"] {
|
|
62
|
+
border-color: var(--acc);
|
|
63
|
+
color: var(--acc);
|
|
64
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import './badge.css';
|
|
2
|
+
import type { ComponentChildren } from 'preact';
|
|
3
|
+
|
|
4
|
+
export function Badge({
|
|
5
|
+
tone,
|
|
6
|
+
title,
|
|
7
|
+
children,
|
|
8
|
+
}: {
|
|
9
|
+
tone?: 'acc' | 'ok' | 'warn' | 'solid';
|
|
10
|
+
title?: string;
|
|
11
|
+
children: ComponentChildren;
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<span class={tone ? `badge ${tone}` : 'badge'} title={title}>
|
|
15
|
+
{children}
|
|
16
|
+
</span>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function Chips({ values }: { values: Array<string | undefined> }) {
|
|
21
|
+
const shown = values.filter((value): value is string => Boolean(value));
|
|
22
|
+
if (!shown.length) return <span class="muted">None</span>;
|
|
23
|
+
return (
|
|
24
|
+
<span class="chips">
|
|
25
|
+
{shown.map(value => (
|
|
26
|
+
<span key={value} class="chip">
|
|
27
|
+
{value}
|
|
28
|
+
</span>
|
|
29
|
+
))}
|
|
30
|
+
</span>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** A record's id: secondary, never a page's or row's label; the line it sits on clips it when space runs out. */
|
|
35
|
+
export function Id({ value, title }: { value: string; title?: string }) {
|
|
36
|
+
return (
|
|
37
|
+
<span class="id" title={title ?? value}>
|
|
38
|
+
{value}
|
|
39
|
+
</span>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
.bar-r {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
margin-block: -2px;
|
|
5
|
+
gap: 8px;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
justify-content: flex-end;
|
|
8
|
+
}
|
|
9
|
+
.card.accent {
|
|
10
|
+
border-color: var(--warn);
|
|
11
|
+
}
|
|
12
|
+
.card.danger {
|
|
13
|
+
border-color: var(--bad);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* empty states */
|
|
17
|
+
.empty {
|
|
18
|
+
display: grid;
|
|
19
|
+
justify-items: center;
|
|
20
|
+
gap: 6px;
|
|
21
|
+
padding: 32px 16px;
|
|
22
|
+
border: 1px dashed var(--line2);
|
|
23
|
+
text-align: center;
|
|
24
|
+
color: var(--muted);
|
|
25
|
+
}
|
|
26
|
+
.empty b {
|
|
27
|
+
color: var(--fg);
|
|
28
|
+
font-weight: 500;
|
|
29
|
+
}
|
|
30
|
+
.card .empty {
|
|
31
|
+
border: 0;
|
|
32
|
+
}
|
|
33
|
+
.loading {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
gap: 10px;
|
|
38
|
+
flex: 1 0 auto;
|
|
39
|
+
min-height: var(--h, 240px);
|
|
40
|
+
color: var(--dim);
|
|
41
|
+
font-size: 12px;
|
|
42
|
+
}
|
|
43
|
+
.loading.inline {
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
min-height: 0;
|
|
46
|
+
}
|
|
47
|
+
.card:has(> .loading:not([style])) {
|
|
48
|
+
flex: 1 0 auto;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
}
|
|
52
|
+
.loading > span {
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
gap: 10px;
|
|
56
|
+
animation: loader-in 0s 60ms both;
|
|
57
|
+
}
|
|
58
|
+
.loading .spin {
|
|
59
|
+
flex: none;
|
|
60
|
+
width: 12px;
|
|
61
|
+
height: 12px;
|
|
62
|
+
border: 1.5px solid currentColor;
|
|
63
|
+
border-top-color: transparent;
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
animation: spin 0.8s linear infinite;
|
|
66
|
+
}
|
|
67
|
+
.loading .dots {
|
|
68
|
+
display: inline-flex;
|
|
69
|
+
gap: 3px;
|
|
70
|
+
}
|
|
71
|
+
.loading .dots > b {
|
|
72
|
+
width: 4px;
|
|
73
|
+
height: 4px;
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
background: currentColor;
|
|
76
|
+
animation: dots 1.2s ease-in-out infinite;
|
|
77
|
+
}
|
|
78
|
+
.loading .dots > b:nth-child(2) {
|
|
79
|
+
animation-delay: 0.2s;
|
|
80
|
+
}
|
|
81
|
+
.loading .dots > b:nth-child(3) {
|
|
82
|
+
animation-delay: 0.4s;
|
|
83
|
+
}
|
|
84
|
+
@keyframes dots {
|
|
85
|
+
0%,
|
|
86
|
+
80%,
|
|
87
|
+
100% {
|
|
88
|
+
opacity: 0.25;
|
|
89
|
+
}
|
|
90
|
+
40% {
|
|
91
|
+
opacity: 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import './card.css';
|
|
2
|
+
import type { ComponentChildren } from 'preact';
|
|
3
|
+
|
|
4
|
+
export function Card({
|
|
5
|
+
title,
|
|
6
|
+
count,
|
|
7
|
+
actions,
|
|
8
|
+
tone,
|
|
9
|
+
children,
|
|
10
|
+
}: {
|
|
11
|
+
title?: ComponentChildren;
|
|
12
|
+
count?: number | string;
|
|
13
|
+
actions?: ComponentChildren;
|
|
14
|
+
tone?: 'accent' | 'danger';
|
|
15
|
+
children: ComponentChildren;
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<section class={tone ? `card frame ${tone}` : 'card frame'}>
|
|
19
|
+
{title ? (
|
|
20
|
+
<div class="bar">
|
|
21
|
+
<h2>
|
|
22
|
+
{title}
|
|
23
|
+
{count !== undefined ? <span class="n">{count}</span> : null}
|
|
24
|
+
</h2>
|
|
25
|
+
{actions ? <span class="bar-r">{actions}</span> : null}
|
|
26
|
+
</div>
|
|
27
|
+
) : null}
|
|
28
|
+
{children}
|
|
29
|
+
</section>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function Empty({ title, children }: { title: string; children?: ComponentChildren }) {
|
|
34
|
+
return (
|
|
35
|
+
<div class="empty">
|
|
36
|
+
<b>{title}</b>
|
|
37
|
+
{children ? <span>{children}</span> : null}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The one loading state: a spinner and a short line; `inline` keeps it to one line. */
|
|
43
|
+
export function Loading({
|
|
44
|
+
label,
|
|
45
|
+
inline,
|
|
46
|
+
dots,
|
|
47
|
+
h,
|
|
48
|
+
}: {
|
|
49
|
+
label: string;
|
|
50
|
+
inline?: boolean;
|
|
51
|
+
/** Three pulsing dots instead of the ring, for a quiet wait. */
|
|
52
|
+
dots?: boolean;
|
|
53
|
+
/** The height, in pixels, of what arrives in its place. */
|
|
54
|
+
h?: number;
|
|
55
|
+
}) {
|
|
56
|
+
const Tag = inline ? 'span' : 'div';
|
|
57
|
+
return (
|
|
58
|
+
<Tag
|
|
59
|
+
class={inline ? 'loading inline' : 'loading'}
|
|
60
|
+
role="status"
|
|
61
|
+
style={h ? `--h:${h}px` : undefined}
|
|
62
|
+
>
|
|
63
|
+
<span>
|
|
64
|
+
{dots ? (
|
|
65
|
+
<i class="dots">
|
|
66
|
+
<b />
|
|
67
|
+
<b />
|
|
68
|
+
<b />
|
|
69
|
+
</i>
|
|
70
|
+
) : (
|
|
71
|
+
<i class="spin" />
|
|
72
|
+
)}
|
|
73
|
+
{label}
|
|
74
|
+
</span>
|
|
75
|
+
</Tag>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.collapse {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
/* room under the toggle so it never sits on the container edge */
|
|
5
|
+
.collapse:not(.open) {
|
|
6
|
+
padding-bottom: 6px;
|
|
7
|
+
}
|
|
8
|
+
/* room under the last line for the toggle, so it never covers text */
|
|
9
|
+
.collapse-box {
|
|
10
|
+
box-sizing: content-box;
|
|
11
|
+
max-height: calc(var(--lines) * 1lh + 44px);
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
.collapse.open > .collapse-box {
|
|
15
|
+
max-height: none;
|
|
16
|
+
}
|
|
17
|
+
.collapse.long:not(.open) > .collapse-box {
|
|
18
|
+
mask-image: linear-gradient(#000 calc(100% - 52px), transparent calc(100% - 36px));
|
|
19
|
+
}
|
|
20
|
+
.collapse > .btn.more-toggle {
|
|
21
|
+
position: absolute;
|
|
22
|
+
z-index: 1;
|
|
23
|
+
left: 50%;
|
|
24
|
+
bottom: 6px;
|
|
25
|
+
translate: -50% 0;
|
|
26
|
+
}
|
|
27
|
+
.collapse.open > .btn.more-toggle {
|
|
28
|
+
position: static;
|
|
29
|
+
display: flex;
|
|
30
|
+
margin: 0 auto 12px;
|
|
31
|
+
translate: none;
|
|
32
|
+
}
|