@seqyuan/annodex 0.1.12 → 0.1.14
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/.next/BUILD_ID +1 -0
- package/.next/app-path-routes-manifest.json +39 -0
- package/.next/build-manifest.json +20 -0
- package/.next/diagnostics/build-diagnostics.json +6 -0
- package/.next/diagnostics/framework.json +1 -0
- package/.next/export-marker.json +6 -0
- package/.next/images-manifest.json +68 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +109 -0
- package/.next/react-loadable-manifest.json +2320 -0
- package/.next/required-server-files.js +343 -0
- package/.next/required-server-files.json +343 -0
- package/.next/routes-manifest.json +286 -0
- package/.next/server/app/_global-error/page.js +32 -0
- package/.next/server/app/_global-error/page.js.nft.json +1 -0
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_global-error.html +1 -0
- package/.next/server/app/_global-error.meta +16 -0
- package/.next/server/app/_global-error.rsc +14 -0
- package/.next/server/app/_global-error.segments/_full.segment.rsc +14 -0
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
- package/.next/server/app/_not-found/page.js +2 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +16 -0
- package/.next/server/app/_not-found.rsc +18 -0
- package/.next/server/app/_not-found.segments/_full.segment.rsc +18 -0
- package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
- package/.next/server/app/_not-found.segments/_index.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +4 -0
- package/.next/server/app/api/agent/[id]/events/route.js +3 -0
- package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -0
- package/.next/server/app/api/agent/[id]/events/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/agent/[id]/route.js +1 -0
- package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/agent/[id]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/agent/new/route.js +1 -0
- package/.next/server/app/api/agent/new/route.js.nft.json +1 -0
- package/.next/server/app/api/agent/new/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/all-providers/route.js +1 -0
- package/.next/server/app/api/auth/all-providers/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/all-providers/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -0
- package/.next/server/app/api/auth/api-key/[provider]/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/api-key/[provider]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/login/[provider]/route.js +1 -0
- package/.next/server/app/api/auth/login/[provider]/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/login/[provider]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/login/route.js +1 -0
- package/.next/server/app/api/auth/login/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/logout/[provider]/route.js +1 -0
- package/.next/server/app/api/auth/logout/[provider]/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/logout/[provider]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/providers/route.js +1 -0
- package/.next/server/app/api/auth/providers/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/providers/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/status/route.js +1 -0
- package/.next/server/app/api/auth/status/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/default-cwd/route.js +1 -0
- package/.next/server/app/api/default-cwd/route.js.nft.json +1 -0
- package/.next/server/app/api/default-cwd/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/files/[...path]/route.js +4 -0
- package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -0
- package/.next/server/app/api/files/[...path]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/harness/route.js +1 -0
- package/.next/server/app/api/harness/route.js.nft.json +1 -0
- package/.next/server/app/api/harness/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/home/route.js +1 -0
- package/.next/server/app/api/home/route.js.nft.json +1 -0
- package/.next/server/app/api/home/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/internal/runtime/route.js +1 -0
- package/.next/server/app/api/internal/runtime/route.js.nft.json +1 -0
- package/.next/server/app/api/internal/runtime/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/models/route.js +1 -0
- package/.next/server/app/api/models/route.js.nft.json +1 -0
- package/.next/server/app/api/models/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/models-config/discover/route.js +1 -0
- package/.next/server/app/api/models-config/discover/route.js.nft.json +1 -0
- package/.next/server/app/api/models-config/discover/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/models-config/route.js +1 -0
- package/.next/server/app/api/models-config/route.js.nft.json +1 -0
- package/.next/server/app/api/models-config/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/models-config/test/route.js +1 -0
- package/.next/server/app/api/models-config/test/route.js.nft.json +1 -0
- package/.next/server/app/api/models-config/test/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/projects/browse/route.js +1 -0
- package/.next/server/app/api/projects/browse/route.js.nft.json +1 -0
- package/.next/server/app/api/projects/browse/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/projects/route.js +1 -0
- package/.next/server/app/api/projects/route.js.nft.json +1 -0
- package/.next/server/app/api/projects/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/reports/[id]/route.js +10 -0
- package/.next/server/app/api/reports/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/reports/[id]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/search/route.js +1 -0
- package/.next/server/app/api/search/route.js.nft.json +1 -0
- package/.next/server/app/api/search/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/[id]/context/route.js +1 -0
- package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/context/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/[id]/route.js +1 -0
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/new/route.js +1 -0
- package/.next/server/app/api/sessions/new/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/new/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/route.js +1 -0
- package/.next/server/app/api/sessions/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/settings/route.js +1 -0
- package/.next/server/app/api/settings/route.js.nft.json +1 -0
- package/.next/server/app/api/settings/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/install/route.js +5 -0
- package/.next/server/app/api/skills/install/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/install/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/route.js +6 -0
- package/.next/server/app/api/skills/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/search/route.js +1 -0
- package/.next/server/app/api/skills/search/route.js.nft.json +1 -0
- package/.next/server/app/api/skills/search/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/soul/route.js +1 -0
- package/.next/server/app/api/soul/route.js.nft.json +1 -0
- package/.next/server/app/api/soul/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/version/route.js +1 -0
- package/.next/server/app/api/version/route.js.nft.json +1 -0
- package/.next/server/app/api/version/route_client-reference-manifest.js +1 -0
- package/.next/server/app/index.html +1 -0
- package/.next/server/app/index.meta +14 -0
- package/.next/server/app/index.rsc +17 -0
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -0
- package/.next/server/app/index.segments/_full.segment.rsc +17 -0
- package/.next/server/app/index.segments/_head.segment.rsc +6 -0
- package/.next/server/app/index.segments/_index.segment.rsc +5 -0
- package/.next/server/app/index.segments/_tree.segment.rsc +4 -0
- package/.next/server/app/login/page.js +2 -0
- package/.next/server/app/login/page.js.nft.json +1 -0
- package/.next/server/app/login/page_client-reference-manifest.js +1 -0
- package/.next/server/app/login.html +1 -0
- package/.next/server/app/login.meta +15 -0
- package/.next/server/app/login.rsc +22 -0
- package/.next/server/app/login.segments/_full.segment.rsc +22 -0
- package/.next/server/app/login.segments/_head.segment.rsc +6 -0
- package/.next/server/app/login.segments/_index.segment.rsc +5 -0
- package/.next/server/app/login.segments/_tree.segment.rsc +4 -0
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +9 -0
- package/.next/server/app/login.segments/login.segment.rsc +5 -0
- package/.next/server/app/page.js +261 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +1 -0
- package/.next/server/app-paths-manifest.json +39 -0
- package/.next/server/chunks/1048.js +1 -0
- package/.next/server/chunks/1367.js +77 -0
- package/.next/server/chunks/1381.js +1 -0
- package/.next/server/chunks/165.js +1 -0
- package/.next/server/chunks/1681.js +215 -0
- package/.next/server/chunks/1688.js +45 -0
- package/.next/server/chunks/1703.js +79 -0
- package/.next/server/chunks/1712.js +43 -0
- package/.next/server/chunks/1813.js +1 -0
- package/.next/server/chunks/2325.js +80 -0
- package/.next/server/chunks/258.js +1 -0
- package/.next/server/chunks/2671.js +287 -0
- package/.next/server/chunks/2778.js +1 -0
- package/.next/server/chunks/2943.js +1 -0
- package/.next/server/chunks/3031.js +226 -0
- package/.next/server/chunks/3181.js +1 -0
- package/.next/server/chunks/3493.js +1 -0
- package/.next/server/chunks/3672.js +1 -0
- package/.next/server/chunks/3701.js +104 -0
- package/.next/server/chunks/4013.js +1 -0
- package/.next/server/chunks/402.js +2 -0
- package/.next/server/chunks/4035.js +80 -0
- package/.next/server/chunks/4248.js +153 -0
- package/.next/server/chunks/4367.js +1 -0
- package/.next/server/chunks/4406.js +141 -0
- package/.next/server/chunks/4741.js +18 -0
- package/.next/server/chunks/4768.js +1 -0
- package/.next/server/chunks/4858.js +148 -0
- package/.next/server/chunks/4980.js +1 -0
- package/.next/server/chunks/5155.js +5 -0
- package/.next/server/chunks/5293.js +166 -0
- package/.next/server/chunks/5399.js +8 -0
- package/.next/server/chunks/5409.js +1 -0
- package/.next/server/chunks/5797.js +93 -0
- package/.next/server/chunks/5851.js +36 -0
- package/.next/server/chunks/6206.js +1 -0
- package/.next/server/chunks/6296.js +1 -0
- package/.next/server/chunks/63.js +45 -0
- package/.next/server/chunks/6346.js +1 -0
- package/.next/server/chunks/6406.js +23 -0
- package/.next/server/chunks/642.js +1 -0
- package/.next/server/chunks/6429.js +50 -0
- package/.next/server/chunks/6729.js +64 -0
- package/.next/server/chunks/6907.js +115 -0
- package/.next/server/chunks/6980.js +1 -0
- package/.next/server/chunks/7073.js +24 -0
- package/.next/server/chunks/7233.js +24 -0
- package/.next/server/chunks/7307.js +1 -0
- package/.next/server/chunks/7362.js +9 -0
- package/.next/server/chunks/7567.js +29 -0
- package/.next/server/chunks/7765.js +1 -0
- package/.next/server/chunks/7890.js +1 -0
- package/.next/server/chunks/8065.js +1 -0
- package/.next/server/chunks/8238.js +34 -0
- package/.next/server/chunks/8276.js +1 -0
- package/.next/server/chunks/8336.js +1 -0
- package/.next/server/chunks/8477.js +3 -0
- package/.next/server/chunks/8490.js +1 -0
- package/.next/server/chunks/8916.js +1 -0
- package/.next/server/chunks/9280.js +252 -0
- package/.next/server/chunks/9315.js +1 -0
- package/.next/server/chunks/9537.js +90 -0
- package/.next/server/chunks/966.js +1 -0
- package/.next/server/chunks/9818.js +21 -0
- package/.next/server/chunks/static/media/pdf.worker.min.c476e1a0.mjs +6 -0
- package/.next/server/functions-config-manifest.json +16 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/middleware.js +18 -0
- package/.next/server/middleware.js.nft.json +1 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +1 -0
- package/.next/server/pages-manifest.json +4 -0
- package/.next/server/prefetch-hints.json +1 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +1 -0
- package/.next/server/webpack-runtime.js +1 -0
- package/.next/static/9tDQsVwah2dRfj3LNFKBR/_buildManifest.js +1 -0
- package/.next/static/9tDQsVwah2dRfj3LNFKBR/_ssgManifest.js +1 -0
- package/.next/static/chunks/0b9a0da7.9075af772487e743.js +62 -0
- package/.next/static/chunks/1413.922d232de90c0c41.js +115 -0
- package/.next/static/chunks/1643.467a526a1f24f54d.js +24 -0
- package/.next/static/chunks/1852.5543122f11aa7fed.js +1 -0
- package/.next/static/chunks/1960.b1e26436d7a5f586.js +1 -0
- package/.next/static/chunks/2170a4aa.4213bb2183c9cdf9.js +1 -0
- package/.next/static/chunks/2274.6cd173f80a1405a2.js +21 -0
- package/.next/static/chunks/2419.347fdfe3c170854d.js +166 -0
- package/.next/static/chunks/2619.9aac8983f30c7c8a.js +1 -0
- package/.next/static/chunks/2623.d20fabd8e18197c6.js +287 -0
- package/.next/static/chunks/2729.f5365061a849d659.js +34 -0
- package/.next/static/chunks/2821.934bcf60fbdc28c6.js +1 -0
- package/.next/static/chunks/2918becc.abff2ece1de37bc1.js +153 -0
- package/.next/static/chunks/2947.114e51cb06d1c01a.js +23 -0
- package/.next/static/chunks/3079.4c511fa1144e3adf.js +79 -0
- package/.next/static/chunks/3274.208ca44844cd7d95.js +148 -0
- package/.next/static/chunks/3308.465a94263d04bfea.js +73 -0
- package/.next/static/chunks/3325.e4bfe1ca657f3b5b.js +80 -0
- package/.next/static/chunks/3506.2a7eaa08b9f55337.js +90 -0
- package/.next/static/chunks/363642f4-043c1475ab9af70e.js +1 -0
- package/.next/static/chunks/3794-123fdf632563f469.js +32 -0
- package/.next/static/chunks/3837.a755ccfe6f9c1c1c.js +5 -0
- package/.next/static/chunks/394.91597771688df6d0.js +1 -0
- package/.next/static/chunks/3997.1009c06025691712.js +1 -0
- package/.next/static/chunks/4453.91a357dc43c21745.js +1 -0
- package/.next/static/chunks/4491.44fdf20580ac72bd.js +24 -0
- package/.next/static/chunks/4829.cf1d50e43e6d9db5.js +1 -0
- package/.next/static/chunks/498.fe1d9da9ecad6c36.js +1 -0
- package/.next/static/chunks/4bd1b696-e356ca5ba0218e27.js +1 -0
- package/.next/static/chunks/5019.b5a1a2b8daf17525.js +1 -0
- package/.next/static/chunks/5034.8f16c3fa3ce75411.js +1 -0
- package/.next/static/chunks/5074.d16651da01ec4e02.js +1 -0
- package/.next/static/chunks/51fb665c.0950e1b79671348d.js +45 -0
- package/.next/static/chunks/532.5956ed631aff722b.js +9 -0
- package/.next/static/chunks/5326.69460442bdcd6cd3.js +1 -0
- package/.next/static/chunks/5403.ff110bf5bf600758.js +64 -0
- package/.next/static/chunks/547.902a733488cfe3f7.js +77 -0
- package/.next/static/chunks/5567.540d7fc108ad6ee5.js +215 -0
- package/.next/static/chunks/5590.ef62922166d308b4.js +1 -0
- package/.next/static/chunks/5690.9d6eb1edb1399995.js +1 -0
- package/.next/static/chunks/5749.25faee4a1e55b854.js +226 -0
- package/.next/static/chunks/58bb9007.1ccb6bba34b4c635.js +80 -0
- package/.next/static/chunks/6121.f3f43f1896ea0cd9.js +1 -0
- package/.next/static/chunks/6600.583c88eef37aa524.js +1 -0
- package/.next/static/chunks/6696.a41aec266e657d54.js +141 -0
- package/.next/static/chunks/6922.42148793782d2fe7.js +1 -0
- package/.next/static/chunks/7006.e191611ffc2b9528.js +43 -0
- package/.next/static/chunks/7343.9fbb58204d8ac681.js +1 -0
- package/.next/static/chunks/73972abe.25a4cffa03b2bcef.js +119 -0
- package/.next/static/chunks/7547.58bda8a2aabba0d4.js +93 -0
- package/.next/static/chunks/7648.4ae2f183b4db0353.js +1 -0
- package/.next/static/chunks/7874.8db6929b94cdf697.js +1 -0
- package/.next/static/chunks/7959.1f20a35df316216a.js +104 -0
- package/.next/static/chunks/83.85d62d7fc9850b75.js +29 -0
- package/.next/static/chunks/8436.cab94b59cca0a8ff.js +1 -0
- package/.next/static/chunks/8451.ff6ff72b57dc52e1.js +1 -0
- package/.next/static/chunks/8489.45f22859734f514f.js +36 -0
- package/.next/static/chunks/8568.f85d8b36fc9a9037.js +1 -0
- package/.next/static/chunks/8771-3e14b6810486df1f.js +1 -0
- package/.next/static/chunks/8863.be51033a67436277.js +1 -0
- package/.next/static/chunks/90542734.dc1a2723e4f6affb.js +1 -0
- package/.next/static/chunks/9500.1488aec06ee78127.js +1 -0
- package/.next/static/chunks/9633.155548b5fca6e580.js +1 -0
- package/.next/static/chunks/9779.673004a62d70e36a.js +1 -0
- package/.next/static/chunks/app/_global-error/page-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/_not-found/page-c72daab99269beff.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/events/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/agent/new/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/all-providers/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/login/[provider]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/login/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/providers/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/auth/status/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/default-cwd/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/files/[...path]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/harness/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/home/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/internal/runtime/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/models/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/models-config/discover/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/models-config/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/models-config/test/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/projects/browse/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/projects/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/reports/[id]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/search/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/context/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/sessions/new/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/settings/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/skills/install/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/skills/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/skills/search/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/soul/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/api/version/route-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/app/layout-be148b7ae915b22a.js +1 -0
- package/.next/static/chunks/app/login/page-ebf0e6de99062783.js +1 -0
- package/.next/static/chunks/app/page-a26fde41f0bbe84c.js +260 -0
- package/.next/static/chunks/d3ac728e.7964f816a1ca64e5.js +1 -0
- package/.next/static/chunks/framework-711ef29bc66f648c.js +1 -0
- package/.next/static/chunks/main-app-45a0f19af99d61b6.js +1 -0
- package/.next/static/chunks/main-f74964b7ae52493e.js +5 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/global-error-9bfa08b9491621f2.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-cc518af6b1ffb191.js +1 -0
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/.next/static/chunks/webpack-fcf4a889ecbd753c.js +1 -0
- package/.next/static/css/45029451a1d7255d.css +3 -0
- package/.next/static/media/15605e25b523335c-s.woff2 +0 -0
- package/.next/static/media/1a3dce5cfb5f7760-s.woff2 +0 -0
- package/.next/static/media/1cdd02902f937a18-s.woff2 +0 -0
- package/.next/static/media/4c4b3b30b6bcb2be-s.woff2 +0 -0
- package/.next/static/media/641a7b8a5800ee0e-s.woff2 +0 -0
- package/.next/static/media/7deddc85b7ffd1dc-s.p.woff2 +0 -0
- package/.next/static/media/ec14413c594b3356-s.p.woff2 +0 -0
- package/.next/static/media/pdf.worker.min.29aaf158.mjs +6 -0
- package/package.json +21 -21
- package/app/api/agent/[id]/events/route.ts +0 -94
- package/app/api/agent/[id]/route.ts +0 -83
- package/app/api/agent/new/route.ts +0 -53
- package/app/api/auth/all-providers/route.ts +0 -21
- package/app/api/auth/api-key/[provider]/route.ts +0 -7
- package/app/api/auth/login/[provider]/route.ts +0 -7
- package/app/api/auth/login/route.ts +0 -22
- package/app/api/auth/logout/[provider]/route.ts +0 -7
- package/app/api/auth/providers/route.ts +0 -15
- package/app/api/auth/status/route.ts +0 -6
- package/app/api/default-cwd/route.ts +0 -22
- package/app/api/files/[...path]/route.ts +0 -621
- package/app/api/harness/route.ts +0 -47
- package/app/api/home/route.ts +0 -6
- package/app/api/internal/runtime/route.ts +0 -26
- package/app/api/models/route.ts +0 -67
- package/app/api/models-config/discover/route.ts +0 -42
- package/app/api/models-config/route.ts +0 -152
- package/app/api/models-config/test/route.ts +0 -154
- package/app/api/projects/browse/route.ts +0 -51
- package/app/api/projects/route.ts +0 -83
- package/app/api/reports/[id]/route.ts +0 -108
- package/app/api/search/route.ts +0 -122
- package/app/api/sessions/[id]/context/route.ts +0 -23
- package/app/api/sessions/[id]/route.ts +0 -124
- package/app/api/sessions/new/route.ts +0 -5
- package/app/api/sessions/route.ts +0 -16
- package/app/api/settings/route.ts +0 -51
- package/app/api/skills/install/route.ts +0 -249
- package/app/api/skills/route.ts +0 -161
- package/app/api/skills/search/route.ts +0 -121
- package/app/api/soul/route.ts +0 -47
- package/app/api/version/route.ts +0 -55
- package/app/globals.css +0 -736
- package/app/layout.tsx +0 -40
- package/app/login/page.tsx +0 -133
- package/app/page.tsx +0 -10
- package/components/AppShell.tsx +0 -1058
- package/components/ChatInput.tsx +0 -1103
- package/components/ChatMinimap.tsx +0 -381
- package/components/ChatWindow.tsx +0 -576
- package/components/CodeMirrorEditor.tsx +0 -137
- package/components/ConversationSearch.tsx +0 -369
- package/components/DataTableViewer.tsx +0 -248
- package/components/FileExplorer.tsx +0 -758
- package/components/FileIcons.tsx +0 -241
- package/components/FileViewer.tsx +0 -1273
- package/components/GlobalFileEditor.tsx +0 -98
- package/components/MarkdownRenderer.tsx +0 -331
- package/components/MermaidDiagram.tsx +0 -80
- package/components/MessageView.tsx +0 -1141
- package/components/ModelsConfig.tsx +0 -1991
- package/components/ProjectContext.tsx +0 -252
- package/components/ProjectFolderPicker.tsx +0 -202
- package/components/ProjectsConfig.tsx +0 -288
- package/components/ProviderIcons.tsx +0 -91
- package/components/ReportPanel.tsx +0 -237
- package/components/ResizeHandle.tsx +0 -105
- package/components/SessionSidebar.tsx +0 -1464
- package/components/SettingsDialog.tsx +0 -287
- package/components/SkillsConfig.tsx +0 -1093
- package/components/SubagentPanel.tsx +0 -191
- package/components/TabBar.tsx +0 -115
- package/components/ToolPanel.tsx +0 -131
- package/components/WidgetRenderer.tsx +0 -505
- package/components/viewers/DocumentToolbar.tsx +0 -78
- package/components/viewers/DocxViewer.tsx +0 -97
- package/components/viewers/PdfViewer.tsx +0 -206
- package/components/viewers/PptxViewer.tsx +0 -240
- package/components/viewers/XlsxViewer.tsx +0 -143
- package/hooks/useAgentSession.ts +0 -710
- package/hooks/useAudio.ts +0 -50
- package/hooks/useDragDrop.ts +0 -52
- package/hooks/useResizable.ts +0 -60
- package/hooks/useTheme.ts +0 -85
- package/lib/agent-client.ts +0 -39
- package/lib/annodex-config.ts +0 -556
- package/lib/auth-token.ts +0 -74
- package/lib/auth.ts +0 -90
- package/lib/brand.ts +0 -5
- package/lib/code-theme.ts +0 -32
- package/lib/codex-compat-proxy.ts +0 -1603
- package/lib/codex-home.ts +0 -6
- package/lib/codex-server.ts +0 -796
- package/lib/codex-session.ts +0 -590
- package/lib/codex-usage.ts +0 -213
- package/lib/file-paths.ts +0 -34
- package/lib/model-discovery.ts +0 -379
- package/lib/normalize.ts +0 -30
- package/lib/npx.ts +0 -87
- package/lib/pi-types.ts +0 -49
- package/lib/projects.ts +0 -269
- package/lib/provider-api.ts +0 -88
- package/lib/report-prompt.ts +0 -61
- package/lib/report-store.ts +0 -597
- package/lib/report-update-parser.ts +0 -66
- package/lib/rpc-manager.ts +0 -668
- package/lib/runtime-state.ts +0 -117
- package/lib/session-reader.ts +0 -903
- package/lib/session-runtime.ts +0 -105
- package/lib/subagent-progress.ts +0 -279
- package/lib/types.ts +0 -241
- package/lib/widget-export.ts +0 -318
- package/lib/widget-guidelines.ts +0 -288
- package/lib/widget-prompt.ts +0 -76
- package/lib/widget-utils.ts +0 -523
- package/postcss.config.mjs +0 -8
- package/proxy.ts +0 -64
- package/scripts/postinstall.cjs +0 -25
- package/tsconfig.json +0 -41
|
@@ -1,1273 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useEffect, useState, useRef, useCallback } from "react";
|
|
4
|
-
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
|
5
|
-
import { useTheme } from "@/hooks/useTheme";
|
|
6
|
-
import { encodeFilePathForApi, getFileName, getRelativeFilePath } from "@/lib/file-paths";
|
|
7
|
-
import { PdfViewer } from "@/components/viewers/PdfViewer";
|
|
8
|
-
import { DocxViewer } from "@/components/viewers/DocxViewer";
|
|
9
|
-
import { XlsxViewer } from "@/components/viewers/XlsxViewer";
|
|
10
|
-
import { PptxViewer } from "@/components/viewers/PptxViewer";
|
|
11
|
-
import { CodeMirrorEditor } from "@/components/CodeMirrorEditor";
|
|
12
|
-
import { MarkdownRenderer } from "@/components/MarkdownRenderer";
|
|
13
|
-
import { DataTableViewer } from "@/components/DataTableViewer";
|
|
14
|
-
import { resolveCodeTheme } from "@/lib/code-theme";
|
|
15
|
-
|
|
16
|
-
interface Props {
|
|
17
|
-
filePath: string;
|
|
18
|
-
cwd?: string;
|
|
19
|
-
onOpenFile?: (filePath: string, fileName: string) => void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface FileData {
|
|
23
|
-
content: string;
|
|
24
|
-
language: string;
|
|
25
|
-
size: number;
|
|
26
|
-
mtime?: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const IMAGE_EXTS = new Set(["png", "jpg", "jpeg", "gif", "webp", "svg", "bmp", "ico", "avif"]);
|
|
30
|
-
const AUDIO_EXTS = new Set(["mp3", "wav", "ogg", "oga", "opus", "m4a", "aac", "flac", "weba", "webm"]);
|
|
31
|
-
const DOC_EXTS = new Set(["pdf", "docx", "xlsx", "pptx", "doc", "xls", "ppt"]);
|
|
32
|
-
|
|
33
|
-
function isDocPath(filePath: string): boolean {
|
|
34
|
-
const base = getFileName(filePath);
|
|
35
|
-
const ext = base.toLowerCase().split(".").pop() ?? "";
|
|
36
|
-
return DOC_EXTS.has(ext);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function isImagePath(filePath: string): boolean {
|
|
40
|
-
const base = getFileName(filePath);
|
|
41
|
-
const ext = base.toLowerCase().split(".").pop() ?? "";
|
|
42
|
-
return IMAGE_EXTS.has(ext);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function isAudioPath(filePath: string): boolean {
|
|
46
|
-
const base = getFileName(filePath);
|
|
47
|
-
const ext = base.toLowerCase().split(".").pop() ?? "";
|
|
48
|
-
return AUDIO_EXTS.has(ext);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function getTableDelimiter(filePath: string): "," | "\t" | null {
|
|
52
|
-
const base = getFileName(filePath);
|
|
53
|
-
const ext = base.toLowerCase().split(".").pop() ?? "";
|
|
54
|
-
if (ext === "csv") return ",";
|
|
55
|
-
if (ext === "tsv") return "\t";
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
type DiffLine =
|
|
60
|
-
| { type: "unchanged"; text: string; lineNo: number }
|
|
61
|
-
| { type: "removed"; text: string; lineNo: number }
|
|
62
|
-
| { type: "added"; text: string; lineNo: number };
|
|
63
|
-
|
|
64
|
-
function formatSize(bytes: number): string {
|
|
65
|
-
if (bytes < 1024) return `${bytes} B`;
|
|
66
|
-
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
67
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Myers diff — returns line-level unified diff
|
|
71
|
-
function diffLines(oldLines: string[], newLines: string[]): DiffLine[] {
|
|
72
|
-
const m = oldLines.length;
|
|
73
|
-
const n = newLines.length;
|
|
74
|
-
const max = m + n;
|
|
75
|
-
const v: number[] = new Array(2 * max + 1).fill(0);
|
|
76
|
-
const trace: number[][] = [];
|
|
77
|
-
|
|
78
|
-
for (let d = 0; d <= max; d++) {
|
|
79
|
-
trace.push([...v]);
|
|
80
|
-
for (let k = -d; k <= d; k += 2) {
|
|
81
|
-
let x: number;
|
|
82
|
-
if (k === -d || (k !== d && v[k - 1 + max] < v[k + 1 + max])) {
|
|
83
|
-
x = v[k + 1 + max];
|
|
84
|
-
} else {
|
|
85
|
-
x = v[k - 1 + max] + 1;
|
|
86
|
-
}
|
|
87
|
-
let y = x - k;
|
|
88
|
-
while (x < m && y < n && oldLines[x] === newLines[y]) {
|
|
89
|
-
x++;
|
|
90
|
-
y++;
|
|
91
|
-
}
|
|
92
|
-
v[k + max] = x;
|
|
93
|
-
if (x >= m && y >= n) {
|
|
94
|
-
// backtrack
|
|
95
|
-
const result: DiffLine[] = [];
|
|
96
|
-
let cx = m, cy = n;
|
|
97
|
-
for (let dd = d; dd > 0; dd--) {
|
|
98
|
-
const pv = trace[dd - 1];
|
|
99
|
-
const pk = cx - cy;
|
|
100
|
-
let prevK: number;
|
|
101
|
-
if (pk === -dd || (pk !== dd && pv[pk - 1 + max] < pv[pk + 1 + max])) {
|
|
102
|
-
prevK = pk + 1;
|
|
103
|
-
} else {
|
|
104
|
-
prevK = pk - 1;
|
|
105
|
-
}
|
|
106
|
-
const prevX = pv[prevK + max];
|
|
107
|
-
const prevY = prevX - prevK;
|
|
108
|
-
while (cx > prevX && cy > prevY) {
|
|
109
|
-
cx--;
|
|
110
|
-
cy--;
|
|
111
|
-
result.unshift({ type: "unchanged", text: oldLines[cx], lineNo: cx + 1 });
|
|
112
|
-
}
|
|
113
|
-
if (dd > 0) {
|
|
114
|
-
if (cx > prevX) {
|
|
115
|
-
cx--;
|
|
116
|
-
result.unshift({ type: "removed", text: oldLines[cx], lineNo: cx + 1 });
|
|
117
|
-
} else {
|
|
118
|
-
cy--;
|
|
119
|
-
result.unshift({ type: "added", text: newLines[cy], lineNo: cy + 1 });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
while (cx > 0 && cy > 0) {
|
|
124
|
-
cx--;
|
|
125
|
-
cy--;
|
|
126
|
-
result.unshift({ type: "unchanged", text: oldLines[cx], lineNo: cx + 1 });
|
|
127
|
-
}
|
|
128
|
-
return result;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
// Fallback: treat all as replaced
|
|
133
|
-
return [
|
|
134
|
-
...oldLines.map((t, i) => ({ type: "removed" as const, text: t, lineNo: i + 1 })),
|
|
135
|
-
...newLines.map((t, i) => ({ type: "added" as const, text: t, lineNo: i + 1 })),
|
|
136
|
-
];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function DiffView({ oldContent, newContent }: { oldContent: string; newContent: string; language: string }) {
|
|
140
|
-
const oldLines = oldContent.split("\n");
|
|
141
|
-
const newLines = newContent.split("\n");
|
|
142
|
-
const diff = diffLines(oldLines, newLines);
|
|
143
|
-
|
|
144
|
-
const hasChanges = diff.some((l) => l.type !== "unchanged");
|
|
145
|
-
if (!hasChanges) {
|
|
146
|
-
return (
|
|
147
|
-
<div style={{ padding: "12px 16px", fontSize: 12, color: "var(--text-dim)", fontFamily: "var(--font-mono)" }}>
|
|
148
|
-
No changes
|
|
149
|
-
</div>
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Render with context: show 3 lines around each change, collapse the rest
|
|
154
|
-
const CONTEXT = 3;
|
|
155
|
-
const changed = new Set(diff.flatMap((l, i) => (l.type !== "unchanged" ? [i] : [])));
|
|
156
|
-
const visible = new Set<number>();
|
|
157
|
-
for (const ci of changed) {
|
|
158
|
-
for (let j = Math.max(0, ci - CONTEXT); j <= Math.min(diff.length - 1, ci + CONTEXT); j++) {
|
|
159
|
-
visible.add(j);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const segments: Array<{ hidden: true; count: number } | { hidden: false; lines: DiffLine[] }> = [];
|
|
164
|
-
let i = 0;
|
|
165
|
-
while (i < diff.length) {
|
|
166
|
-
if (visible.has(i)) {
|
|
167
|
-
const block: DiffLine[] = [];
|
|
168
|
-
while (i < diff.length && visible.has(i)) {
|
|
169
|
-
block.push(diff[i]);
|
|
170
|
-
i++;
|
|
171
|
-
}
|
|
172
|
-
segments.push({ hidden: false, lines: block });
|
|
173
|
-
} else {
|
|
174
|
-
let count = 0;
|
|
175
|
-
while (i < diff.length && !visible.has(i)) {
|
|
176
|
-
count++;
|
|
177
|
-
i++;
|
|
178
|
-
}
|
|
179
|
-
segments.push({ hidden: true, count });
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Track running line number for added/unchanged lines
|
|
184
|
-
const newLineNos: number[] = [];
|
|
185
|
-
let nlo = 1;
|
|
186
|
-
for (const line of diff) {
|
|
187
|
-
if (line.type === "removed") {
|
|
188
|
-
newLineNos.push(0);
|
|
189
|
-
} else {
|
|
190
|
-
newLineNos.push(nlo++);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
let diffIdx = 0;
|
|
195
|
-
|
|
196
|
-
return (
|
|
197
|
-
<div style={{ fontFamily: "var(--font-mono)", fontSize: 13, lineHeight: 1.6 }}>
|
|
198
|
-
{segments.map((seg, si) => {
|
|
199
|
-
if (seg.hidden) {
|
|
200
|
-
const result = (
|
|
201
|
-
<div
|
|
202
|
-
key={si}
|
|
203
|
-
style={{
|
|
204
|
-
padding: "2px 16px",
|
|
205
|
-
color: "var(--text-dim)",
|
|
206
|
-
background: "var(--bg-panel)",
|
|
207
|
-
fontSize: 11,
|
|
208
|
-
borderTop: "1px solid var(--border)",
|
|
209
|
-
borderBottom: "1px solid var(--border)",
|
|
210
|
-
}}
|
|
211
|
-
>
|
|
212
|
-
... {seg.count} unchanged lines ...
|
|
213
|
-
</div>
|
|
214
|
-
);
|
|
215
|
-
diffIdx += seg.count;
|
|
216
|
-
return result;
|
|
217
|
-
}
|
|
218
|
-
const lines = seg.lines.map((line, li) => {
|
|
219
|
-
const idx = diffIdx + li;
|
|
220
|
-
const newLno = newLineNos[idx];
|
|
221
|
-
const bg =
|
|
222
|
-
line.type === "added"
|
|
223
|
-
? "rgba(0,200,80,0.12)"
|
|
224
|
-
: line.type === "removed"
|
|
225
|
-
? "rgba(240,60,60,0.14)"
|
|
226
|
-
: "transparent";
|
|
227
|
-
const prefix =
|
|
228
|
-
line.type === "added" ? "+" : line.type === "removed" ? "-" : " ";
|
|
229
|
-
const prefixColor =
|
|
230
|
-
line.type === "added" ? "#4ade80" : line.type === "removed" ? "#f87171" : "var(--text-dim)";
|
|
231
|
-
|
|
232
|
-
return (
|
|
233
|
-
<div
|
|
234
|
-
key={li}
|
|
235
|
-
style={{
|
|
236
|
-
display: "flex",
|
|
237
|
-
background: bg,
|
|
238
|
-
borderLeft: line.type === "added"
|
|
239
|
-
? "3px solid #4ade80"
|
|
240
|
-
: line.type === "removed"
|
|
241
|
-
? "3px solid #f87171"
|
|
242
|
-
: "3px solid transparent",
|
|
243
|
-
}}
|
|
244
|
-
>
|
|
245
|
-
<span
|
|
246
|
-
style={{
|
|
247
|
-
minWidth: 44,
|
|
248
|
-
padding: "0 8px 0 16px",
|
|
249
|
-
textAlign: "right",
|
|
250
|
-
color: "var(--text-dim)",
|
|
251
|
-
userSelect: "none",
|
|
252
|
-
fontSize: 11,
|
|
253
|
-
lineHeight: 1.6,
|
|
254
|
-
borderRight: "1px solid var(--border)",
|
|
255
|
-
background: "var(--bg-panel)",
|
|
256
|
-
flexShrink: 0,
|
|
257
|
-
}}
|
|
258
|
-
>
|
|
259
|
-
{line.type === "removed" ? line.lineNo : newLno || ""}
|
|
260
|
-
</span>
|
|
261
|
-
<span
|
|
262
|
-
style={{
|
|
263
|
-
minWidth: 16,
|
|
264
|
-
padding: "0 6px",
|
|
265
|
-
color: prefixColor,
|
|
266
|
-
userSelect: "none",
|
|
267
|
-
flexShrink: 0,
|
|
268
|
-
fontWeight: 600,
|
|
269
|
-
}}
|
|
270
|
-
>
|
|
271
|
-
{prefix}
|
|
272
|
-
</span>
|
|
273
|
-
<span
|
|
274
|
-
style={{
|
|
275
|
-
flex: 1,
|
|
276
|
-
padding: "0 8px 0 0",
|
|
277
|
-
whiteSpace: "pre",
|
|
278
|
-
color: "var(--text)",
|
|
279
|
-
overflowX: "auto",
|
|
280
|
-
}}
|
|
281
|
-
>
|
|
282
|
-
{line.text || "\u00a0"}
|
|
283
|
-
</span>
|
|
284
|
-
</div>
|
|
285
|
-
);
|
|
286
|
-
});
|
|
287
|
-
diffIdx += seg.lines.length;
|
|
288
|
-
return <div key={si}>{lines}</div>;
|
|
289
|
-
})}
|
|
290
|
-
</div>
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
function ImageViewer({ filePath, cwd }: { filePath: string; cwd?: string }) {
|
|
295
|
-
const [watching, setWatching] = useState(false);
|
|
296
|
-
const [bust, setBust] = useState(0);
|
|
297
|
-
const [size, setSize] = useState<number | null>(null);
|
|
298
|
-
const [naturalSize, setNaturalSize] = useState<{ w: number; h: number } | null>(null);
|
|
299
|
-
const [error, setError] = useState<string | null>(null);
|
|
300
|
-
const [zoom, setZoom] = useState(100);
|
|
301
|
-
const esRef = useRef<EventSource | null>(null);
|
|
302
|
-
|
|
303
|
-
const ext = getFileName(filePath).toLowerCase().split(".").pop() ?? "";
|
|
304
|
-
|
|
305
|
-
useEffect(() => {
|
|
306
|
-
setBust(0);
|
|
307
|
-
setSize(null);
|
|
308
|
-
setNaturalSize(null);
|
|
309
|
-
setError(null);
|
|
310
|
-
setWatching(false);
|
|
311
|
-
setZoom(100);
|
|
312
|
-
|
|
313
|
-
if (esRef.current) {
|
|
314
|
-
esRef.current.close();
|
|
315
|
-
esRef.current = null;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
const encoded = encodeFilePathForApi(filePath);
|
|
319
|
-
const es = new EventSource(`/api/files/${encoded}?type=watch`);
|
|
320
|
-
esRef.current = es;
|
|
321
|
-
|
|
322
|
-
es.addEventListener("connected", () => setWatching(true));
|
|
323
|
-
es.addEventListener("change", (e) => {
|
|
324
|
-
try {
|
|
325
|
-
const d = JSON.parse((e as MessageEvent).data) as { size?: number };
|
|
326
|
-
if (typeof d.size === "number") setSize(d.size);
|
|
327
|
-
} catch { /* ignore */ }
|
|
328
|
-
setBust((b) => b + 1);
|
|
329
|
-
});
|
|
330
|
-
es.addEventListener("error", () => setWatching(false));
|
|
331
|
-
es.onerror = () => setWatching(false);
|
|
332
|
-
|
|
333
|
-
return () => {
|
|
334
|
-
es.close();
|
|
335
|
-
esRef.current = null;
|
|
336
|
-
};
|
|
337
|
-
}, [filePath]);
|
|
338
|
-
|
|
339
|
-
const encoded = encodeFilePathForApi(filePath);
|
|
340
|
-
const src = `/api/files/${encoded}?type=read${bust ? `&v=${bust}` : ""}`;
|
|
341
|
-
|
|
342
|
-
const formatSizeStr = size != null ? formatSize(size) : null;
|
|
343
|
-
const zoomOptions = [25, 50, 75, 100, 125, 150, 200, 300];
|
|
344
|
-
const setClampedZoom = (value: number) => setZoom(Math.max(10, Math.min(500, value)));
|
|
345
|
-
|
|
346
|
-
return (
|
|
347
|
-
<div style={{ display: "flex", flexDirection: "column", height: "100%", overflow: "hidden" }}>
|
|
348
|
-
<div
|
|
349
|
-
style={{
|
|
350
|
-
display: "flex",
|
|
351
|
-
alignItems: "center",
|
|
352
|
-
gap: 12,
|
|
353
|
-
padding: "4px 16px",
|
|
354
|
-
borderBottom: "1px solid var(--border)",
|
|
355
|
-
fontSize: 11,
|
|
356
|
-
color: "var(--text-dim)",
|
|
357
|
-
background: "var(--bg)",
|
|
358
|
-
flexShrink: 0,
|
|
359
|
-
}}
|
|
360
|
-
>
|
|
361
|
-
<span
|
|
362
|
-
style={{ flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", fontFamily: "var(--font-mono)" }}
|
|
363
|
-
title={filePath}
|
|
364
|
-
>
|
|
365
|
-
{getRelativeFilePath(filePath, cwd)}
|
|
366
|
-
</span>
|
|
367
|
-
<div style={{ display: "flex", alignItems: "center", gap: 4, flexShrink: 0 }}>
|
|
368
|
-
<button
|
|
369
|
-
onClick={() => setClampedZoom(zoom - 25)}
|
|
370
|
-
title="Zoom out"
|
|
371
|
-
style={{
|
|
372
|
-
width: 24,
|
|
373
|
-
height: 22,
|
|
374
|
-
border: "1px solid var(--border)",
|
|
375
|
-
borderRadius: 5,
|
|
376
|
-
background: "var(--bg-panel)",
|
|
377
|
-
color: "var(--text-muted)",
|
|
378
|
-
cursor: "pointer",
|
|
379
|
-
fontSize: 13,
|
|
380
|
-
lineHeight: 1,
|
|
381
|
-
}}
|
|
382
|
-
>
|
|
383
|
-
-
|
|
384
|
-
</button>
|
|
385
|
-
<select
|
|
386
|
-
value={zoom}
|
|
387
|
-
onChange={(e) => setClampedZoom(Number(e.target.value))}
|
|
388
|
-
title="Image zoom"
|
|
389
|
-
style={{
|
|
390
|
-
height: 22,
|
|
391
|
-
border: "1px solid var(--border)",
|
|
392
|
-
borderRadius: 5,
|
|
393
|
-
background: "var(--bg-panel)",
|
|
394
|
-
color: "var(--text)",
|
|
395
|
-
fontSize: 11,
|
|
396
|
-
fontFamily: "var(--font-mono)",
|
|
397
|
-
outline: "none",
|
|
398
|
-
cursor: "pointer",
|
|
399
|
-
}}
|
|
400
|
-
>
|
|
401
|
-
{zoomOptions.map((value) => (
|
|
402
|
-
<option key={value} value={value}>{value}%</option>
|
|
403
|
-
))}
|
|
404
|
-
</select>
|
|
405
|
-
<button
|
|
406
|
-
onClick={() => setClampedZoom(zoom + 25)}
|
|
407
|
-
title="Zoom in"
|
|
408
|
-
style={{
|
|
409
|
-
width: 24,
|
|
410
|
-
height: 22,
|
|
411
|
-
border: "1px solid var(--border)",
|
|
412
|
-
borderRadius: 5,
|
|
413
|
-
background: "var(--bg-panel)",
|
|
414
|
-
color: "var(--text-muted)",
|
|
415
|
-
cursor: "pointer",
|
|
416
|
-
fontSize: 13,
|
|
417
|
-
lineHeight: 1,
|
|
418
|
-
}}
|
|
419
|
-
>
|
|
420
|
-
+
|
|
421
|
-
</button>
|
|
422
|
-
</div>
|
|
423
|
-
<span style={{ flexShrink: 0 }}>{ext || "image"}</span>
|
|
424
|
-
{naturalSize && <span>{naturalSize.w} × {naturalSize.h}</span>}
|
|
425
|
-
{formatSizeStr && <span>{formatSizeStr}</span>}
|
|
426
|
-
<span
|
|
427
|
-
title={watching ? "Live sync active" : "Not watching"}
|
|
428
|
-
style={{ display: "flex", alignItems: "center", gap: 4, color: watching ? "#4ade80" : "var(--text-dim)" }}
|
|
429
|
-
>
|
|
430
|
-
<span
|
|
431
|
-
style={{
|
|
432
|
-
width: 7,
|
|
433
|
-
height: 7,
|
|
434
|
-
borderRadius: "50%",
|
|
435
|
-
background: watching ? "#4ade80" : "var(--border)",
|
|
436
|
-
display: "inline-block",
|
|
437
|
-
boxShadow: watching ? "0 0 4px #4ade80" : "none",
|
|
438
|
-
}}
|
|
439
|
-
/>
|
|
440
|
-
{watching ? "live" : "static"}
|
|
441
|
-
</span>
|
|
442
|
-
</div>
|
|
443
|
-
<div
|
|
444
|
-
style={{
|
|
445
|
-
flex: 1,
|
|
446
|
-
overflow: "auto",
|
|
447
|
-
background: "var(--bg-panel)",
|
|
448
|
-
WebkitOverflowScrolling: "touch",
|
|
449
|
-
overscrollBehavior: "contain",
|
|
450
|
-
backgroundImage:
|
|
451
|
-
"linear-gradient(45deg, var(--bg) 25%, transparent 25%), linear-gradient(-45deg, var(--bg) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--bg) 75%), linear-gradient(-45deg, transparent 75%, var(--bg) 75%)",
|
|
452
|
-
backgroundSize: "16px 16px",
|
|
453
|
-
backgroundPosition: "0 0, 0 8px, 8px -8px, -8px 0px",
|
|
454
|
-
}}
|
|
455
|
-
>
|
|
456
|
-
{error ? (
|
|
457
|
-
<div style={{ minWidth: "100%", minHeight: "100%", display: "flex", alignItems: "center", justifyContent: "center", color: "#f87171", fontSize: 13 }}>
|
|
458
|
-
{error}
|
|
459
|
-
</div>
|
|
460
|
-
) : (
|
|
461
|
-
<div
|
|
462
|
-
style={{
|
|
463
|
-
minWidth: "100%",
|
|
464
|
-
minHeight: "100%",
|
|
465
|
-
width: "max-content",
|
|
466
|
-
height: "max-content",
|
|
467
|
-
boxSizing: "border-box",
|
|
468
|
-
display: "flex",
|
|
469
|
-
alignItems: "flex-start",
|
|
470
|
-
justifyContent: "flex-start",
|
|
471
|
-
padding: 16,
|
|
472
|
-
}}
|
|
473
|
-
>
|
|
474
|
-
{/* eslint-disable-next-line @next/next/no-img-element */}
|
|
475
|
-
<img
|
|
476
|
-
src={src}
|
|
477
|
-
alt={filePath}
|
|
478
|
-
onLoad={(e) => {
|
|
479
|
-
const img = e.currentTarget;
|
|
480
|
-
setNaturalSize({ w: img.naturalWidth, h: img.naturalHeight });
|
|
481
|
-
}}
|
|
482
|
-
onError={() => setError("Failed to load image")}
|
|
483
|
-
style={{
|
|
484
|
-
width: naturalSize ? Math.max(1, Math.round(naturalSize.w * zoom / 100)) : "auto",
|
|
485
|
-
height: naturalSize ? Math.max(1, Math.round(naturalSize.h * zoom / 100)) : "auto",
|
|
486
|
-
maxWidth: "none",
|
|
487
|
-
maxHeight: "none",
|
|
488
|
-
objectFit: "contain",
|
|
489
|
-
boxShadow: "0 2px 8px rgba(0,0,0,0.15)",
|
|
490
|
-
}}
|
|
491
|
-
/>
|
|
492
|
-
</div>
|
|
493
|
-
)}
|
|
494
|
-
</div>
|
|
495
|
-
</div>
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
function formatDuration(seconds: number): string {
|
|
500
|
-
if (!Number.isFinite(seconds)) return "";
|
|
501
|
-
const totalSeconds = Math.round(seconds);
|
|
502
|
-
const mins = Math.floor(totalSeconds / 60);
|
|
503
|
-
const secs = totalSeconds % 60;
|
|
504
|
-
return `${mins}:${String(secs).padStart(2, "0")}`;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
function AudioViewer({ filePath, cwd }: { filePath: string; cwd?: string }) {
|
|
508
|
-
const [watching, setWatching] = useState(false);
|
|
509
|
-
const [bust, setBust] = useState(0);
|
|
510
|
-
const [size, setSize] = useState<number | null>(null);
|
|
511
|
-
const [duration, setDuration] = useState<number | null>(null);
|
|
512
|
-
const [error, setError] = useState<string | null>(null);
|
|
513
|
-
const esRef = useRef<EventSource | null>(null);
|
|
514
|
-
|
|
515
|
-
const ext = getFileName(filePath).toLowerCase().split(".").pop() ?? "";
|
|
516
|
-
|
|
517
|
-
useEffect(() => {
|
|
518
|
-
setBust(0);
|
|
519
|
-
setSize(null);
|
|
520
|
-
setDuration(null);
|
|
521
|
-
setError(null);
|
|
522
|
-
setWatching(false);
|
|
523
|
-
|
|
524
|
-
if (esRef.current) {
|
|
525
|
-
esRef.current.close();
|
|
526
|
-
esRef.current = null;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
const encoded = encodeFilePathForApi(filePath);
|
|
530
|
-
const es = new EventSource(`/api/files/${encoded}?type=watch`);
|
|
531
|
-
esRef.current = es;
|
|
532
|
-
|
|
533
|
-
es.addEventListener("connected", () => setWatching(true));
|
|
534
|
-
es.addEventListener("change", (e) => {
|
|
535
|
-
try {
|
|
536
|
-
const d = JSON.parse((e as MessageEvent).data) as { size?: number };
|
|
537
|
-
if (typeof d.size === "number") setSize(d.size);
|
|
538
|
-
} catch { /* ignore */ }
|
|
539
|
-
setDuration(null);
|
|
540
|
-
setError(null);
|
|
541
|
-
setBust((b) => b + 1);
|
|
542
|
-
});
|
|
543
|
-
es.addEventListener("error", () => setWatching(false));
|
|
544
|
-
es.onerror = () => setWatching(false);
|
|
545
|
-
|
|
546
|
-
return () => {
|
|
547
|
-
es.close();
|
|
548
|
-
esRef.current = null;
|
|
549
|
-
};
|
|
550
|
-
}, [filePath]);
|
|
551
|
-
|
|
552
|
-
const encoded = encodeFilePathForApi(filePath);
|
|
553
|
-
const src = `/api/files/${encoded}?type=read${bust ? `&v=${bust}` : ""}`;
|
|
554
|
-
|
|
555
|
-
return (
|
|
556
|
-
<div style={{ display: "flex", flexDirection: "column", height: "100%", overflow: "hidden" }}>
|
|
557
|
-
<div
|
|
558
|
-
style={{
|
|
559
|
-
display: "flex",
|
|
560
|
-
alignItems: "center",
|
|
561
|
-
gap: 12,
|
|
562
|
-
padding: "4px 16px",
|
|
563
|
-
borderBottom: "1px solid var(--border)",
|
|
564
|
-
fontSize: 11,
|
|
565
|
-
color: "var(--text-dim)",
|
|
566
|
-
background: "var(--bg)",
|
|
567
|
-
flexShrink: 0,
|
|
568
|
-
}}
|
|
569
|
-
>
|
|
570
|
-
<span style={{ fontFamily: "var(--font-mono)" }} title={filePath}>
|
|
571
|
-
{getRelativeFilePath(filePath, cwd)}
|
|
572
|
-
</span>
|
|
573
|
-
<span style={{ marginLeft: "auto" }}>{ext || "audio"}</span>
|
|
574
|
-
{duration != null && <span>{formatDuration(duration)}</span>}
|
|
575
|
-
{size != null && <span>{formatSize(size)}</span>}
|
|
576
|
-
<span
|
|
577
|
-
title={watching ? "Live sync active" : "Not watching"}
|
|
578
|
-
style={{ display: "flex", alignItems: "center", gap: 4, color: watching ? "#4ade80" : "var(--text-dim)" }}
|
|
579
|
-
>
|
|
580
|
-
<span
|
|
581
|
-
style={{
|
|
582
|
-
width: 7,
|
|
583
|
-
height: 7,
|
|
584
|
-
borderRadius: "50%",
|
|
585
|
-
background: watching ? "#4ade80" : "var(--border)",
|
|
586
|
-
display: "inline-block",
|
|
587
|
-
boxShadow: watching ? "0 0 4px #4ade80" : "none",
|
|
588
|
-
}}
|
|
589
|
-
/>
|
|
590
|
-
{watching ? "live" : "static"}
|
|
591
|
-
</span>
|
|
592
|
-
</div>
|
|
593
|
-
<div
|
|
594
|
-
style={{
|
|
595
|
-
flex: 1,
|
|
596
|
-
display: "flex",
|
|
597
|
-
alignItems: "center",
|
|
598
|
-
justifyContent: "center",
|
|
599
|
-
padding: 24,
|
|
600
|
-
background: "var(--bg-panel)",
|
|
601
|
-
}}
|
|
602
|
-
>
|
|
603
|
-
<div style={{ width: "min(680px, 100%)" }}>
|
|
604
|
-
{error && (
|
|
605
|
-
<div style={{ color: "#f87171", fontSize: 13, marginBottom: 12, textAlign: "center" }}>
|
|
606
|
-
{error}
|
|
607
|
-
</div>
|
|
608
|
-
)}
|
|
609
|
-
<audio
|
|
610
|
-
key={src}
|
|
611
|
-
controls
|
|
612
|
-
preload="metadata"
|
|
613
|
-
src={src}
|
|
614
|
-
onLoadedMetadata={(e) => setDuration(e.currentTarget.duration)}
|
|
615
|
-
onError={() => setError("Failed to load audio")}
|
|
616
|
-
style={{ width: "100%" }}
|
|
617
|
-
/>
|
|
618
|
-
</div>
|
|
619
|
-
</div>
|
|
620
|
-
</div>
|
|
621
|
-
);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
export function FileViewer({ filePath, cwd, onOpenFile }: Props) {
|
|
625
|
-
if (isImagePath(filePath)) {
|
|
626
|
-
return <ImageViewer filePath={filePath} cwd={cwd} />;
|
|
627
|
-
}
|
|
628
|
-
if (isAudioPath(filePath)) {
|
|
629
|
-
return <AudioViewer filePath={filePath} cwd={cwd} />;
|
|
630
|
-
}
|
|
631
|
-
if (isDocPath(filePath)) {
|
|
632
|
-
return <DocumentFileViewer filePath={filePath} cwd={cwd} />;
|
|
633
|
-
}
|
|
634
|
-
return <TextFileViewer filePath={filePath} cwd={cwd} onOpenFile={onOpenFile} />;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
function getDocType(filePath: string): "pdf" | "docx" | "xlsx" | "pptx" | "other" {
|
|
638
|
-
const ext = getFileName(filePath).toLowerCase().split(".").pop() ?? "";
|
|
639
|
-
if (ext === "pdf") return "pdf";
|
|
640
|
-
if (ext === "docx" || ext === "doc") return "docx";
|
|
641
|
-
if (ext === "xlsx" || ext === "xls") return "xlsx";
|
|
642
|
-
if (ext === "pptx" || ext === "ppt") return "pptx";
|
|
643
|
-
return "other";
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
function DocumentFileViewer({ filePath, cwd }: { filePath: string; cwd?: string }) {
|
|
647
|
-
const [arrayBuffer, setArrayBuffer] = useState<ArrayBuffer | null>(null);
|
|
648
|
-
const [loading, setLoading] = useState(true);
|
|
649
|
-
const [error, setError] = useState<string | null>(null);
|
|
650
|
-
const esRef = useRef<EventSource | null>(null);
|
|
651
|
-
const bustRef = useRef(0);
|
|
652
|
-
|
|
653
|
-
const docType = getDocType(filePath);
|
|
654
|
-
const ext = getFileName(filePath).toLowerCase().split(".").pop() ?? "";
|
|
655
|
-
|
|
656
|
-
const loadDocument = useCallback(async (filePath: string) => {
|
|
657
|
-
try {
|
|
658
|
-
const encoded = encodeFilePathForApi(filePath);
|
|
659
|
-
const bust = bustRef.current ? `&v=${bustRef.current}` : "";
|
|
660
|
-
const resp = await fetch(`/api/files/${encoded}?type=read${bust}`);
|
|
661
|
-
if (!resp.ok) {
|
|
662
|
-
const body = await resp.json().catch(() => ({ error: String(resp.status) }));
|
|
663
|
-
setError((body as { error?: string }).error ?? `HTTP ${resp.status}`);
|
|
664
|
-
return;
|
|
665
|
-
}
|
|
666
|
-
const buf = await resp.arrayBuffer();
|
|
667
|
-
setArrayBuffer(buf);
|
|
668
|
-
setError(null);
|
|
669
|
-
} catch (err: unknown) {
|
|
670
|
-
setError(String(err));
|
|
671
|
-
}
|
|
672
|
-
}, []);
|
|
673
|
-
|
|
674
|
-
useEffect(() => {
|
|
675
|
-
setLoading(true);
|
|
676
|
-
setError(null);
|
|
677
|
-
setArrayBuffer(null);
|
|
678
|
-
bustRef.current = 0;
|
|
679
|
-
|
|
680
|
-
if (esRef.current) {
|
|
681
|
-
esRef.current.close();
|
|
682
|
-
esRef.current = null;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
loadDocument(filePath).finally(() => setLoading(false));
|
|
686
|
-
|
|
687
|
-
const encoded = encodeFilePathForApi(filePath);
|
|
688
|
-
const es = new EventSource(`/api/files/${encoded}?type=watch`);
|
|
689
|
-
esRef.current = es;
|
|
690
|
-
|
|
691
|
-
es.addEventListener("connected", () => {});
|
|
692
|
-
es.addEventListener("change", () => {
|
|
693
|
-
bustRef.current += 1;
|
|
694
|
-
loadDocument(filePath);
|
|
695
|
-
});
|
|
696
|
-
es.addEventListener("error", () => {});
|
|
697
|
-
es.onerror = () => {};
|
|
698
|
-
|
|
699
|
-
return () => {
|
|
700
|
-
es.close();
|
|
701
|
-
esRef.current = null;
|
|
702
|
-
};
|
|
703
|
-
}, [filePath, loadDocument]);
|
|
704
|
-
|
|
705
|
-
if (loading && !arrayBuffer) {
|
|
706
|
-
return (
|
|
707
|
-
<div style={{ height: "100%", display: "flex", alignItems: "center", justifyContent: "center", color: "var(--text-muted)", fontSize: 13 }}>
|
|
708
|
-
Loading...
|
|
709
|
-
</div>
|
|
710
|
-
);
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
if (error && !arrayBuffer) {
|
|
714
|
-
return (
|
|
715
|
-
<div style={{ height: "100%", display: "flex", alignItems: "center", justifyContent: "center", color: "#f87171", fontSize: 13 }}>
|
|
716
|
-
{error}
|
|
717
|
-
</div>
|
|
718
|
-
);
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
if (!arrayBuffer) return null;
|
|
722
|
-
|
|
723
|
-
const fileName = getRelativeFilePath(filePath, cwd);
|
|
724
|
-
|
|
725
|
-
// Wrap with status bar
|
|
726
|
-
return (
|
|
727
|
-
<div style={{ display: "flex", flexDirection: "column", height: "100%", overflow: "hidden" }}>
|
|
728
|
-
{docType === "pdf" && <PdfViewer arrayBuffer={arrayBuffer} fileName={fileName} />}
|
|
729
|
-
{docType === "docx" && <DocxViewer arrayBuffer={arrayBuffer} fileName={fileName} />}
|
|
730
|
-
{docType === "xlsx" && <XlsxViewer arrayBuffer={arrayBuffer} fileName={fileName} />}
|
|
731
|
-
{docType === "pptx" && <PptxViewer arrayBuffer={arrayBuffer} fileName={fileName} />}
|
|
732
|
-
{docType === "other" && (
|
|
733
|
-
<div style={{ height: "100%", display: "flex", alignItems: "center", justifyContent: "center", color: "var(--text-muted)", fontSize: 13 }}>
|
|
734
|
-
Unsupported document format: .{ext}
|
|
735
|
-
</div>
|
|
736
|
-
)}
|
|
737
|
-
</div>
|
|
738
|
-
);
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
function TextFileViewer({ filePath, cwd, onOpenFile }: Props) {
|
|
742
|
-
const { isDark } = useTheme();
|
|
743
|
-
const [data, setData] = useState<FileData | null>(null);
|
|
744
|
-
const [prevContent, setPrevContent] = useState<string | null>(null);
|
|
745
|
-
const [loading, setLoading] = useState(true);
|
|
746
|
-
const [error, setError] = useState<string | null>(null);
|
|
747
|
-
const [saveError, setSaveError] = useState<string | null>(null);
|
|
748
|
-
const [previewMode, setPreviewMode] = useState(false);
|
|
749
|
-
const [viewMode, setViewMode] = useState<"source" | "diff">("source");
|
|
750
|
-
const [wrapLines, setWrapLines] = useState(false);
|
|
751
|
-
const [watching, setWatching] = useState(false);
|
|
752
|
-
const [changeCount, setChangeCount] = useState(0);
|
|
753
|
-
const [editing, setEditing] = useState(false);
|
|
754
|
-
const [editedContent, setEditedContent] = useState("");
|
|
755
|
-
const [saving, setSaving] = useState(false);
|
|
756
|
-
const [externalChangeWhileEditing, setExternalChangeWhileEditing] = useState(false);
|
|
757
|
-
const [saveConflict, setSaveConflict] = useState(false);
|
|
758
|
-
const [editBaseMtime, setEditBaseMtime] = useState<string | null>(null);
|
|
759
|
-
const esRef = useRef<EventSource | null>(null);
|
|
760
|
-
const editingRef = useRef(false);
|
|
761
|
-
editingRef.current = editing;
|
|
762
|
-
const dataRef = useRef<FileData | null>(null);
|
|
763
|
-
dataRef.current = data;
|
|
764
|
-
|
|
765
|
-
const fetchContent = useCallback((filePath: string, isRefresh = false) => {
|
|
766
|
-
const encoded = encodeFilePathForApi(filePath);
|
|
767
|
-
return fetch(`/api/files/${encoded}?type=read`)
|
|
768
|
-
.then((r) => r.json())
|
|
769
|
-
.then((d: FileData & { error?: string }) => {
|
|
770
|
-
if (d.error) {
|
|
771
|
-
setError(d.error);
|
|
772
|
-
return null;
|
|
773
|
-
}
|
|
774
|
-
if (isRefresh) {
|
|
775
|
-
setData((prev) => {
|
|
776
|
-
if (prev) setPrevContent(prev.content);
|
|
777
|
-
return d;
|
|
778
|
-
});
|
|
779
|
-
setChangeCount((c) => c + 1);
|
|
780
|
-
} else {
|
|
781
|
-
setData(d);
|
|
782
|
-
}
|
|
783
|
-
setError(null);
|
|
784
|
-
return d;
|
|
785
|
-
})
|
|
786
|
-
.catch((e) => {
|
|
787
|
-
setError(String(e));
|
|
788
|
-
return null;
|
|
789
|
-
});
|
|
790
|
-
}, []);
|
|
791
|
-
|
|
792
|
-
// Initial load + SSE watch setup
|
|
793
|
-
useEffect(() => {
|
|
794
|
-
setLoading(true);
|
|
795
|
-
setError(null);
|
|
796
|
-
setData(null);
|
|
797
|
-
setPrevContent(null);
|
|
798
|
-
setPreviewMode(false);
|
|
799
|
-
setViewMode("source");
|
|
800
|
-
setWrapLines(false);
|
|
801
|
-
setChangeCount(0);
|
|
802
|
-
setWatching(false);
|
|
803
|
-
|
|
804
|
-
if (esRef.current) {
|
|
805
|
-
esRef.current.close();
|
|
806
|
-
esRef.current = null;
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
fetchContent(filePath).then((d) => {
|
|
810
|
-
if (d?.language === "markdown" || getTableDelimiter(filePath)) setPreviewMode(true);
|
|
811
|
-
}).finally(() => setLoading(false));
|
|
812
|
-
|
|
813
|
-
// Set up SSE watch
|
|
814
|
-
const encoded = encodeFilePathForApi(filePath);
|
|
815
|
-
const es = new EventSource(`/api/files/${encoded}?type=watch`);
|
|
816
|
-
esRef.current = es;
|
|
817
|
-
|
|
818
|
-
es.addEventListener("connected", () => {
|
|
819
|
-
setWatching(true);
|
|
820
|
-
});
|
|
821
|
-
|
|
822
|
-
es.addEventListener("change", () => {
|
|
823
|
-
// During editing, don't auto-refresh — flag external change instead
|
|
824
|
-
if (editingRef.current) {
|
|
825
|
-
setExternalChangeWhileEditing(true);
|
|
826
|
-
} else {
|
|
827
|
-
fetchContent(filePath, true);
|
|
828
|
-
}
|
|
829
|
-
});
|
|
830
|
-
|
|
831
|
-
es.addEventListener("error", () => {
|
|
832
|
-
setWatching(false);
|
|
833
|
-
});
|
|
834
|
-
|
|
835
|
-
es.onerror = () => {
|
|
836
|
-
setWatching(false);
|
|
837
|
-
};
|
|
838
|
-
|
|
839
|
-
return () => {
|
|
840
|
-
es.close();
|
|
841
|
-
esRef.current = null;
|
|
842
|
-
};
|
|
843
|
-
}, [filePath, fetchContent]);
|
|
844
|
-
|
|
845
|
-
const handleStartEdit = useCallback(() => {
|
|
846
|
-
if (!data) return;
|
|
847
|
-
setEditing(true);
|
|
848
|
-
setEditedContent(data.content);
|
|
849
|
-
setEditBaseMtime(data.mtime ?? null);
|
|
850
|
-
setSaveConflict(false);
|
|
851
|
-
setSaveError(null);
|
|
852
|
-
setExternalChangeWhileEditing(false);
|
|
853
|
-
setPreviewMode(false);
|
|
854
|
-
setViewMode("source");
|
|
855
|
-
}, [data]);
|
|
856
|
-
|
|
857
|
-
const handleSave = useCallback(async (force = false) => {
|
|
858
|
-
const encoded = encodeFilePathForApi(filePath);
|
|
859
|
-
setSaving(true);
|
|
860
|
-
setSaveConflict(false);
|
|
861
|
-
setSaveError(null);
|
|
862
|
-
try {
|
|
863
|
-
const res = await fetch(`/api/files/${encoded}`, {
|
|
864
|
-
method: "PUT",
|
|
865
|
-
headers: { "Content-Type": "application/json" },
|
|
866
|
-
body: JSON.stringify({
|
|
867
|
-
content: editedContent,
|
|
868
|
-
...(force || !editBaseMtime ? {} : { baseMtime: editBaseMtime }),
|
|
869
|
-
}),
|
|
870
|
-
});
|
|
871
|
-
if (res.status === 409) {
|
|
872
|
-
const body = await res.json().catch(() => ({ error: "File changed on disk since it was opened" }));
|
|
873
|
-
setSaveConflict(true);
|
|
874
|
-
setExternalChangeWhileEditing(true);
|
|
875
|
-
throw new Error((body as { error?: string }).error ?? "File changed on disk since it was opened");
|
|
876
|
-
}
|
|
877
|
-
if (!res.ok) {
|
|
878
|
-
const body = await res.json().catch(() => ({ error: String(res.status) }));
|
|
879
|
-
throw new Error((body as { error?: string }).error ?? `HTTP ${res.status}`);
|
|
880
|
-
}
|
|
881
|
-
// Refresh data from file to get updated size & content
|
|
882
|
-
const refreshed = await fetchContent(filePath, true);
|
|
883
|
-
setEditBaseMtime(refreshed?.mtime ?? null);
|
|
884
|
-
setEditing(false);
|
|
885
|
-
setExternalChangeWhileEditing(false);
|
|
886
|
-
setSaveConflict(false);
|
|
887
|
-
} catch (err) {
|
|
888
|
-
setSaveError(err instanceof Error ? err.message : String(err));
|
|
889
|
-
} finally {
|
|
890
|
-
setSaving(false);
|
|
891
|
-
}
|
|
892
|
-
}, [filePath, editedContent, editBaseMtime, fetchContent]);
|
|
893
|
-
|
|
894
|
-
const handleCancelEdit = useCallback(() => {
|
|
895
|
-
setEditing(false);
|
|
896
|
-
setExternalChangeWhileEditing(false);
|
|
897
|
-
setSaveConflict(false);
|
|
898
|
-
setSaveError(null);
|
|
899
|
-
setEditBaseMtime(null);
|
|
900
|
-
}, []);
|
|
901
|
-
|
|
902
|
-
// Handle external change accepted — reload and continue editing
|
|
903
|
-
const handleAcceptExternalChange = useCallback(async () => {
|
|
904
|
-
const fresh = await fetchContent(filePath, true);
|
|
905
|
-
if (!fresh) return;
|
|
906
|
-
setEditedContent(fresh.content);
|
|
907
|
-
setEditBaseMtime(fresh.mtime ?? null);
|
|
908
|
-
setExternalChangeWhileEditing(false);
|
|
909
|
-
setSaveConflict(false);
|
|
910
|
-
setSaveError(null);
|
|
911
|
-
setError(null);
|
|
912
|
-
}, [fetchContent, filePath]);
|
|
913
|
-
|
|
914
|
-
if (loading) {
|
|
915
|
-
return (
|
|
916
|
-
<div style={{ height: "100%", display: "flex", alignItems: "center", justifyContent: "center", color: "var(--text-muted)", fontSize: 13 }}>
|
|
917
|
-
Loading...
|
|
918
|
-
</div>
|
|
919
|
-
);
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
if (error) {
|
|
923
|
-
return (
|
|
924
|
-
<div style={{ height: "100%", display: "flex", alignItems: "center", justifyContent: "center", color: "#f87171", fontSize: 13 }}>
|
|
925
|
-
{error}
|
|
926
|
-
</div>
|
|
927
|
-
);
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
if (!data) return null;
|
|
931
|
-
|
|
932
|
-
const isHtml = data.language === "html";
|
|
933
|
-
const isMarkdown = data.language === "markdown";
|
|
934
|
-
const tableDelimiter = getTableDelimiter(filePath);
|
|
935
|
-
const isTable = tableDelimiter !== null;
|
|
936
|
-
const lines = data.content.split("\n");
|
|
937
|
-
const hasDiff = prevContent !== null && prevContent !== data.content;
|
|
938
|
-
|
|
939
|
-
return (
|
|
940
|
-
<div style={{ display: "flex", flexDirection: "column", height: "100%", overflow: "hidden" }}>
|
|
941
|
-
{/* Status bar */}
|
|
942
|
-
<div
|
|
943
|
-
style={{
|
|
944
|
-
display: "flex",
|
|
945
|
-
alignItems: "center",
|
|
946
|
-
gap: 12,
|
|
947
|
-
padding: "4px 16px",
|
|
948
|
-
borderBottom: "1px solid var(--border)",
|
|
949
|
-
fontSize: 11,
|
|
950
|
-
color: "var(--text-dim)",
|
|
951
|
-
background: "var(--bg)",
|
|
952
|
-
flexShrink: 0,
|
|
953
|
-
}}
|
|
954
|
-
>
|
|
955
|
-
<span style={{ fontFamily: "var(--font-mono)" }} title={filePath}>
|
|
956
|
-
{getRelativeFilePath(filePath, cwd)}
|
|
957
|
-
</span>
|
|
958
|
-
<span style={{ marginLeft: "auto" }}>{data.language}</span>
|
|
959
|
-
{viewMode === "source" && <span>{lines.length} lines</span>}
|
|
960
|
-
<span>{formatSize(data.size)}</span>
|
|
961
|
-
|
|
962
|
-
{/* Live watch indicator */}
|
|
963
|
-
<span
|
|
964
|
-
title={watching ? "Live sync active" : "Not watching"}
|
|
965
|
-
style={{ display: "flex", alignItems: "center", gap: 4, color: watching ? "#4ade80" : "var(--text-dim)" }}
|
|
966
|
-
>
|
|
967
|
-
<span
|
|
968
|
-
style={{
|
|
969
|
-
width: 7,
|
|
970
|
-
height: 7,
|
|
971
|
-
borderRadius: "50%",
|
|
972
|
-
background: watching ? "#4ade80" : "var(--border)",
|
|
973
|
-
display: "inline-block",
|
|
974
|
-
boxShadow: watching ? "0 0 4px #4ade80" : "none",
|
|
975
|
-
}}
|
|
976
|
-
/>
|
|
977
|
-
{watching ? "live" : "static"}
|
|
978
|
-
</span>
|
|
979
|
-
|
|
980
|
-
{/* Edit / Save / Cancel buttons */}
|
|
981
|
-
{!editing ? (
|
|
982
|
-
<button
|
|
983
|
-
onClick={handleStartEdit}
|
|
984
|
-
title="Edit file"
|
|
985
|
-
style={{
|
|
986
|
-
padding: "2px 10px", fontSize: 11, cursor: "pointer",
|
|
987
|
-
background: "var(--bg-hover)", color: "var(--text-muted)",
|
|
988
|
-
border: "1px solid var(--border)", borderRadius: 5,
|
|
989
|
-
fontWeight: 600,
|
|
990
|
-
}}
|
|
991
|
-
onMouseEnter={(e) => { e.currentTarget.style.background = "var(--accent)"; e.currentTarget.style.color = "#fff"; e.currentTarget.style.borderColor = "var(--accent)"; }}
|
|
992
|
-
onMouseLeave={(e) => { e.currentTarget.style.background = "var(--bg-hover)"; e.currentTarget.style.color = "var(--text-muted)"; e.currentTarget.style.borderColor = "var(--border)"; }}
|
|
993
|
-
>
|
|
994
|
-
Edit
|
|
995
|
-
</button>
|
|
996
|
-
) : (
|
|
997
|
-
<>
|
|
998
|
-
{(externalChangeWhileEditing || saveConflict || saveError) && (
|
|
999
|
-
<span
|
|
1000
|
-
title="File changed on disk while editing"
|
|
1001
|
-
style={{
|
|
1002
|
-
padding: "2px 8px", fontSize: 11,
|
|
1003
|
-
background: "rgba(234,179,8,0.1)", color: "#b8860b",
|
|
1004
|
-
border: "1px solid rgba(234,179,8,0.3)", borderRadius: 5,
|
|
1005
|
-
display: "flex", alignItems: "center", gap: 4,
|
|
1006
|
-
}}
|
|
1007
|
-
>
|
|
1008
|
-
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
1009
|
-
<circle cx="12" cy="12" r="10" /><line x1="12" y1="8" x2="12" y2="12" /><line x1="12" y1="16" x2="12.01" y2="16" />
|
|
1010
|
-
</svg>
|
|
1011
|
-
{saveError ?? "External change"}
|
|
1012
|
-
{(externalChangeWhileEditing || saveConflict) && (
|
|
1013
|
-
<button
|
|
1014
|
-
onClick={handleAcceptExternalChange}
|
|
1015
|
-
style={{
|
|
1016
|
-
marginLeft: 4, padding: "1px 6px", fontSize: 10, cursor: "pointer",
|
|
1017
|
-
background: "rgba(234,179,8,0.2)", color: "#b8860b",
|
|
1018
|
-
border: "1px solid rgba(234,179,8,0.3)", borderRadius: 3,
|
|
1019
|
-
fontWeight: 600,
|
|
1020
|
-
}}
|
|
1021
|
-
>
|
|
1022
|
-
Reload
|
|
1023
|
-
</button>
|
|
1024
|
-
)}
|
|
1025
|
-
{saveConflict && (
|
|
1026
|
-
<button
|
|
1027
|
-
onClick={() => void handleSave(true)}
|
|
1028
|
-
disabled={saving}
|
|
1029
|
-
style={{
|
|
1030
|
-
marginLeft: 4, padding: "1px 6px", fontSize: 10, cursor: saving ? "not-allowed" : "pointer",
|
|
1031
|
-
background: "rgba(239,68,68,0.12)", color: "#ef4444",
|
|
1032
|
-
border: "1px solid rgba(239,68,68,0.3)", borderRadius: 3,
|
|
1033
|
-
fontWeight: 600,
|
|
1034
|
-
}}
|
|
1035
|
-
>
|
|
1036
|
-
Overwrite
|
|
1037
|
-
</button>
|
|
1038
|
-
)}
|
|
1039
|
-
</span>
|
|
1040
|
-
)}
|
|
1041
|
-
<button
|
|
1042
|
-
onClick={() => void handleSave()}
|
|
1043
|
-
disabled={saving}
|
|
1044
|
-
title="Save file (Ctrl+S)"
|
|
1045
|
-
style={{
|
|
1046
|
-
padding: "2px 10px", fontSize: 11, cursor: saving ? "not-allowed" : "pointer",
|
|
1047
|
-
background: "var(--accent)", color: "#fff",
|
|
1048
|
-
border: "1px solid var(--accent)", borderRadius: 5,
|
|
1049
|
-
fontWeight: 600, opacity: saving ? 0.6 : 1,
|
|
1050
|
-
}}
|
|
1051
|
-
>
|
|
1052
|
-
{saving ? "Saving…" : "Save"}
|
|
1053
|
-
</button>
|
|
1054
|
-
<button
|
|
1055
|
-
onClick={handleCancelEdit}
|
|
1056
|
-
title="Cancel editing"
|
|
1057
|
-
style={{
|
|
1058
|
-
padding: "2px 10px", fontSize: 11, cursor: "pointer",
|
|
1059
|
-
background: "var(--bg-hover)", color: "var(--text-muted)",
|
|
1060
|
-
border: "1px solid var(--border)", borderRadius: 5,
|
|
1061
|
-
fontWeight: 600,
|
|
1062
|
-
}}
|
|
1063
|
-
onMouseEnter={(e) => { e.currentTarget.style.background = "rgba(239,68,68,0.1)"; e.currentTarget.style.color = "#ef4444"; e.currentTarget.style.borderColor = "rgba(239,68,68,0.3)"; }}
|
|
1064
|
-
onMouseLeave={(e) => { e.currentTarget.style.background = "var(--bg-hover)"; e.currentTarget.style.color = "var(--text-muted)"; e.currentTarget.style.borderColor = "var(--border)"; }}
|
|
1065
|
-
>
|
|
1066
|
-
Cancel
|
|
1067
|
-
</button>
|
|
1068
|
-
</>
|
|
1069
|
-
)}
|
|
1070
|
-
|
|
1071
|
-
{/* Diff / Source toggle — shown only when there are changes */}
|
|
1072
|
-
{hasDiff && (
|
|
1073
|
-
<div style={{ display: "flex", borderRadius: 5, overflow: "hidden", border: "1px solid var(--border)" }}>
|
|
1074
|
-
<button
|
|
1075
|
-
onClick={() => setViewMode("source")}
|
|
1076
|
-
style={{
|
|
1077
|
-
padding: "2px 8px", fontSize: 11, border: "none", cursor: "pointer",
|
|
1078
|
-
background: viewMode === "source" ? "var(--bg-selected)" : "var(--bg-hover)",
|
|
1079
|
-
color: viewMode === "source" ? "var(--text)" : "var(--text-muted)",
|
|
1080
|
-
fontWeight: viewMode === "source" ? 600 : 400,
|
|
1081
|
-
}}
|
|
1082
|
-
>
|
|
1083
|
-
Source
|
|
1084
|
-
</button>
|
|
1085
|
-
<button
|
|
1086
|
-
onClick={() => setViewMode("diff")}
|
|
1087
|
-
style={{
|
|
1088
|
-
padding: "2px 8px", fontSize: 11, border: "none", borderLeft: "1px solid var(--border)", cursor: "pointer",
|
|
1089
|
-
background: viewMode === "diff" ? "var(--bg-selected)" : "var(--bg-hover)",
|
|
1090
|
-
color: viewMode === "diff" ? "var(--text)" : "var(--text-muted)",
|
|
1091
|
-
fontWeight: viewMode === "diff" ? 600 : 400,
|
|
1092
|
-
}}
|
|
1093
|
-
>
|
|
1094
|
-
Diff {changeCount > 0 && <span style={{ color: "#4ade80", marginLeft: 2 }}>+{changeCount}</span>}
|
|
1095
|
-
</button>
|
|
1096
|
-
</div>
|
|
1097
|
-
)}
|
|
1098
|
-
|
|
1099
|
-
{/* Word wrap toggle */}
|
|
1100
|
-
{viewMode === "source" && !previewMode && (
|
|
1101
|
-
<button
|
|
1102
|
-
onClick={() => setWrapLines((v) => !v)}
|
|
1103
|
-
title={wrapLines ? "Disable word wrap" : "Enable word wrap"}
|
|
1104
|
-
style={{
|
|
1105
|
-
padding: "2px 8px", fontSize: 11, cursor: "pointer",
|
|
1106
|
-
background: wrapLines ? "var(--bg-selected)" : "var(--bg-hover)",
|
|
1107
|
-
color: wrapLines ? "var(--text)" : "var(--text-muted)",
|
|
1108
|
-
border: "1px solid var(--border)", borderRadius: 5,
|
|
1109
|
-
fontWeight: wrapLines ? 600 : 400,
|
|
1110
|
-
}}
|
|
1111
|
-
>
|
|
1112
|
-
wrap
|
|
1113
|
-
</button>
|
|
1114
|
-
)}
|
|
1115
|
-
|
|
1116
|
-
{/* HTML source/preview toggle */}
|
|
1117
|
-
{isHtml && viewMode === "source" && (
|
|
1118
|
-
<div style={{ display: "flex", borderRadius: 5, overflow: "hidden", border: "1px solid var(--border)" }}>
|
|
1119
|
-
<button
|
|
1120
|
-
onClick={() => setPreviewMode(false)}
|
|
1121
|
-
style={{
|
|
1122
|
-
padding: "2px 8px", fontSize: 11, border: "none", cursor: "pointer",
|
|
1123
|
-
background: !previewMode ? "var(--bg-selected)" : "var(--bg-hover)",
|
|
1124
|
-
color: !previewMode ? "var(--text)" : "var(--text-muted)",
|
|
1125
|
-
fontWeight: !previewMode ? 600 : 400,
|
|
1126
|
-
}}
|
|
1127
|
-
>
|
|
1128
|
-
Code
|
|
1129
|
-
</button>
|
|
1130
|
-
<button
|
|
1131
|
-
onClick={() => setPreviewMode(true)}
|
|
1132
|
-
style={{
|
|
1133
|
-
padding: "2px 8px", fontSize: 11, border: "none", borderLeft: "1px solid var(--border)", cursor: "pointer",
|
|
1134
|
-
background: previewMode ? "var(--bg-selected)" : "var(--bg-hover)",
|
|
1135
|
-
color: previewMode ? "var(--text)" : "var(--text-muted)",
|
|
1136
|
-
fontWeight: previewMode ? 600 : 400,
|
|
1137
|
-
}}
|
|
1138
|
-
>
|
|
1139
|
-
Preview
|
|
1140
|
-
</button>
|
|
1141
|
-
</div>
|
|
1142
|
-
)}
|
|
1143
|
-
|
|
1144
|
-
{/* Markdown preview/raw toggle */}
|
|
1145
|
-
{isMarkdown && viewMode === "source" && (
|
|
1146
|
-
<div style={{ display: "flex", borderRadius: 5, overflow: "hidden", border: "1px solid var(--border)" }}>
|
|
1147
|
-
<button
|
|
1148
|
-
onClick={() => setPreviewMode(true)}
|
|
1149
|
-
style={{
|
|
1150
|
-
padding: "2px 8px", fontSize: 11, border: "none", cursor: "pointer",
|
|
1151
|
-
background: previewMode ? "var(--bg-selected)" : "var(--bg-hover)",
|
|
1152
|
-
color: previewMode ? "var(--text)" : "var(--text-muted)",
|
|
1153
|
-
fontWeight: previewMode ? 600 : 400,
|
|
1154
|
-
}}
|
|
1155
|
-
>
|
|
1156
|
-
Preview
|
|
1157
|
-
</button>
|
|
1158
|
-
<button
|
|
1159
|
-
onClick={() => setPreviewMode(false)}
|
|
1160
|
-
style={{
|
|
1161
|
-
padding: "2px 8px", fontSize: 11, border: "none", borderLeft: "1px solid var(--border)", cursor: "pointer",
|
|
1162
|
-
background: !previewMode ? "var(--bg-selected)" : "var(--bg-hover)",
|
|
1163
|
-
color: !previewMode ? "var(--text)" : "var(--text-muted)",
|
|
1164
|
-
fontWeight: !previewMode ? 600 : 400,
|
|
1165
|
-
}}
|
|
1166
|
-
>
|
|
1167
|
-
{editing ? "Edit" : "Raw"}
|
|
1168
|
-
</button>
|
|
1169
|
-
</div>
|
|
1170
|
-
)}
|
|
1171
|
-
|
|
1172
|
-
{/* CSV/TSV table/raw toggle */}
|
|
1173
|
-
{isTable && viewMode === "source" && (
|
|
1174
|
-
<div style={{ display: "flex", borderRadius: 5, overflow: "hidden", border: "1px solid var(--border)" }}>
|
|
1175
|
-
<button
|
|
1176
|
-
onClick={() => setPreviewMode(true)}
|
|
1177
|
-
style={{
|
|
1178
|
-
padding: "2px 8px", fontSize: 11, border: "none", cursor: "pointer",
|
|
1179
|
-
background: previewMode ? "var(--bg-selected)" : "var(--bg-hover)",
|
|
1180
|
-
color: previewMode ? "var(--text)" : "var(--text-muted)",
|
|
1181
|
-
fontWeight: previewMode ? 600 : 400,
|
|
1182
|
-
}}
|
|
1183
|
-
>
|
|
1184
|
-
Table
|
|
1185
|
-
</button>
|
|
1186
|
-
<button
|
|
1187
|
-
onClick={() => setPreviewMode(false)}
|
|
1188
|
-
style={{
|
|
1189
|
-
padding: "2px 8px", fontSize: 11, border: "none", borderLeft: "1px solid var(--border)", cursor: "pointer",
|
|
1190
|
-
background: !previewMode ? "var(--bg-selected)" : "var(--bg-hover)",
|
|
1191
|
-
color: !previewMode ? "var(--text)" : "var(--text-muted)",
|
|
1192
|
-
fontWeight: !previewMode ? 600 : 400,
|
|
1193
|
-
}}
|
|
1194
|
-
>
|
|
1195
|
-
Raw
|
|
1196
|
-
</button>
|
|
1197
|
-
</div>
|
|
1198
|
-
)}
|
|
1199
|
-
</div>
|
|
1200
|
-
|
|
1201
|
-
{/* Content area */}
|
|
1202
|
-
<div style={{ flex: 1, overflow: "auto", background: "var(--bg)" }}>
|
|
1203
|
-
{editing && !(isMarkdown && previewMode) ? (
|
|
1204
|
-
<CodeMirrorEditor
|
|
1205
|
-
initialContent={editedContent}
|
|
1206
|
-
language={data.language}
|
|
1207
|
-
isDark={isDark}
|
|
1208
|
-
onChange={setEditedContent}
|
|
1209
|
-
onSave={() => void handleSave()}
|
|
1210
|
-
/>
|
|
1211
|
-
) : editing && isMarkdown && previewMode ? (
|
|
1212
|
-
<MarkdownRenderer
|
|
1213
|
-
content={editedContent}
|
|
1214
|
-
className="markdown-body markdown-file-preview"
|
|
1215
|
-
codeBlockVariant="file"
|
|
1216
|
-
baseFilePath={filePath}
|
|
1217
|
-
onOpenLocalFile={onOpenFile}
|
|
1218
|
-
style={{ padding: "28px 36px", maxWidth: 920, margin: "0 auto" }}
|
|
1219
|
-
/>
|
|
1220
|
-
) : viewMode === "diff" && hasDiff ? (
|
|
1221
|
-
<DiffView oldContent={prevContent!} newContent={data.content} language={data.language} />
|
|
1222
|
-
) : isHtml && previewMode ? (
|
|
1223
|
-
<iframe
|
|
1224
|
-
srcDoc={data.content}
|
|
1225
|
-
sandbox="allow-scripts"
|
|
1226
|
-
style={{ width: "100%", height: "100%", border: "none", background: "var(--bg)" }}
|
|
1227
|
-
title="HTML preview"
|
|
1228
|
-
/>
|
|
1229
|
-
) : isMarkdown && previewMode ? (
|
|
1230
|
-
<MarkdownRenderer
|
|
1231
|
-
content={data.content}
|
|
1232
|
-
className="markdown-body markdown-file-preview"
|
|
1233
|
-
codeBlockVariant="file"
|
|
1234
|
-
baseFilePath={filePath}
|
|
1235
|
-
onOpenLocalFile={onOpenFile}
|
|
1236
|
-
style={{ padding: "28px 36px", maxWidth: 920, margin: "0 auto" }}
|
|
1237
|
-
/>
|
|
1238
|
-
) : isTable && previewMode && tableDelimiter ? (
|
|
1239
|
-
<DataTableViewer
|
|
1240
|
-
content={data.content}
|
|
1241
|
-
delimiter={tableDelimiter}
|
|
1242
|
-
fileName={getFileName(filePath)}
|
|
1243
|
-
/>
|
|
1244
|
-
) : (
|
|
1245
|
-
<SyntaxHighlighter
|
|
1246
|
-
language={data.language === "text" || data.language === "csv" || data.language === "tsv" ? "plaintext" : data.language}
|
|
1247
|
-
style={resolveCodeTheme(isDark)}
|
|
1248
|
-
showLineNumbers
|
|
1249
|
-
lineNumberStyle={{
|
|
1250
|
-
color: "var(--text-dim)",
|
|
1251
|
-
fontStyle: "normal",
|
|
1252
|
-
minWidth: "3em",
|
|
1253
|
-
paddingRight: "1em",
|
|
1254
|
-
}}
|
|
1255
|
-
customStyle={{
|
|
1256
|
-
margin: 0,
|
|
1257
|
-
padding: "12px 0",
|
|
1258
|
-
background: "var(--bg)",
|
|
1259
|
-
fontSize: 13,
|
|
1260
|
-
lineHeight: 1.6,
|
|
1261
|
-
fontFamily: "var(--font-mono)",
|
|
1262
|
-
minHeight: "100%",
|
|
1263
|
-
}}
|
|
1264
|
-
codeTagProps={{ style: { fontFamily: "var(--font-mono)" } }}
|
|
1265
|
-
wrapLongLines={wrapLines}
|
|
1266
|
-
>
|
|
1267
|
-
{data.content}
|
|
1268
|
-
</SyntaxHighlighter>
|
|
1269
|
-
)}
|
|
1270
|
-
</div>
|
|
1271
|
-
</div>
|
|
1272
|
-
);
|
|
1273
|
-
}
|