@av-pi-studio/web-client 0.0.20 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{BinaryFallbackViewer-J5mkbauH.js → BinaryFallbackViewer-BhFy0LGl.js} +2 -2
- package/dist/web/assets/{BinaryFallbackViewer-J5mkbauH.js.map → BinaryFallbackViewer-BhFy0LGl.js.map} +1 -1
- package/dist/web/assets/{ChatPanel-CR9Q7XT0.js → ChatPanel-DZ7FTqNn.js} +2 -2
- package/dist/web/assets/{ChatPanel-CR9Q7XT0.js.map → ChatPanel-DZ7FTqNn.js.map} +1 -1
- package/dist/web/assets/{CodeView-C85N-Hey.js → CodeView-ozTMONne.js} +2 -2
- package/dist/web/assets/{CodeView-C85N-Hey.js.map → CodeView-ozTMONne.js.map} +1 -1
- package/dist/web/assets/{FilePanel-CVkY49EH.js → FilePanel-DGpt9v6o.js} +3 -3
- package/dist/web/assets/{FilePanel-CVkY49EH.js.map → FilePanel-DGpt9v6o.js.map} +1 -1
- package/dist/web/assets/{ImageViewer-oBNHeO_9.js → ImageViewer-DHb5bAK_.js} +2 -2
- package/dist/web/assets/{ImageViewer-oBNHeO_9.js.map → ImageViewer-DHb5bAK_.js.map} +1 -1
- package/dist/web/assets/{MarkdownFileViewer-Bls9ucuT.js → MarkdownFileViewer-NgB_lfjf.js} +2 -2
- package/dist/web/assets/{MarkdownFileViewer-Bls9ucuT.js.map → MarkdownFileViewer-NgB_lfjf.js.map} +1 -1
- package/dist/web/assets/{TerminalPanel-D-E_p5vl.js → TerminalPanel-Z2unQlh4.js} +2 -2
- package/dist/web/assets/{TerminalPanel-D-E_p5vl.js.map → TerminalPanel-Z2unQlh4.js.map} +1 -1
- package/dist/web/assets/{TextViewer-SvlPgTJo.js → TextViewer-D3AXEjY4.js} +2 -2
- package/dist/web/assets/{TextViewer-SvlPgTJo.js.map → TextViewer-D3AXEjY4.js.map} +1 -1
- package/dist/web/assets/{VideoViewer-B2nu2FWw.js → VideoViewer-iipRPOwD.js} +2 -2
- package/dist/web/assets/{VideoViewer-B2nu2FWw.js.map → VideoViewer-iipRPOwD.js.map} +1 -1
- package/dist/web/assets/{index-CwsA41_m.js → index-hArhMYDk.js} +3 -3
- package/dist/web/assets/{index-CwsA41_m.js.map → index-hArhMYDk.js.map} +1 -1
- package/dist/web/assets/{use-file-download-BoIxzvuc.js → use-file-download-DbXY9KUV.js} +2 -2
- package/dist/web/assets/{use-file-download-BoIxzvuc.js.map → use-file-download-DbXY9KUV.js.map} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as a}from"./vendor-react-BoIQBqDW.js";import{u as f}from"./vendor-query-D5H9KBcL.js";import{a as s,c as m,r as y}from"./index-
|
|
2
|
-
//# sourceMappingURL=use-file-download-
|
|
1
|
+
import{r as a}from"./vendor-react-BoIQBqDW.js";import{u as f}from"./vendor-query-D5H9KBcL.js";import{a as s,c as m,r as y}from"./index-hArhMYDk.js";function p(o,u=!0){var i;const l=s(e=>e.client),n=s(e=>e.daemon),c=f({queryKey:y.fileDownload(o),queryFn:async()=>{if(!l||!n)throw new Error("not connected");const e=await m(n).download(o),t=new Blob([Uint8Array.from(e.bytes)],{type:e.mimeType||"application/octet-stream"});return{objectUrl:URL.createObjectURL(t),mimeType:e.mimeType,fileName:e.fileName}},enabled:!!l&&!!n&&!!o&&u,staleTime:1/0,gcTime:0}),r=a.useRef(null);return a.useEffect(()=>{var t;const e=((t=c.data)==null?void 0:t.objectUrl)??null;e&&r.current&&r.current!==e&&URL.revokeObjectURL(r.current),r.current=e},[(i=c.data)==null?void 0:i.objectUrl]),a.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]),c}export{p as u};
|
|
2
|
+
//# sourceMappingURL=use-file-download-DbXY9KUV.js.map
|
package/dist/web/assets/{use-file-download-BoIxzvuc.js.map → use-file-download-DbXY9KUV.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-file-download-
|
|
1
|
+
{"version":3,"file":"use-file-download-DbXY9KUV.js","sources":["../../../src/hooks/use-file-download.ts"],"sourcesContent":["/**\n * `use-file-download` — TanStack Query wrapper over the binary file-transfer download path\n * (`file_download_token_request` → `file_download_request` → chunked `Begin`/`Chunk`/`End`\n * binary frames), for viewers that need raw bytes rather than the UTF-8 preview\n * `file_read_request` returns (images, video — POC_TO_APP_PLAN_UI.md §4.5 follow-up: modular\n * file preview). Resolves to an object URL, revoked once superseded by a new one or once this\n * consumer unmounts.\n */\n\nimport { useEffect, useRef } from \"react\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useConnectionStore } from \"@pi-studio-ui/lib/connection/connection-store.js\";\nimport { rpcKeys } from \"@pi-studio-ui/lib/connection/rpc-keys.js\";\nimport { transferFor } from \"./file-transfer-instance.js\";\n\nexport interface FileDownload {\n objectUrl: string;\n mimeType?: string;\n fileName?: string;\n}\n\nexport function useFileDownload(path: string, enabled = true) {\n const client = useConnectionStore((s) => s.client);\n const daemon = useConnectionStore((s) => s.daemon);\n\n const query = useQuery({\n queryKey: rpcKeys.fileDownload(path),\n queryFn: async (): Promise<FileDownload> => {\n if (!client || !daemon) throw new Error(\"not connected\");\n const file = await transferFor(daemon).download(path);\n // `Blob`'s DOM typings require an `ArrayBuffer`-backed view; the assembled `Uint8Array`'s\n // `ArrayBufferLike` backing (a decode-time implementation detail) doesn't satisfy that on\n // its own, so copy into a plain `ArrayBuffer`-backed `Uint8Array` first.\n const blob = new Blob([Uint8Array.from(file.bytes)], {\n type: file.mimeType || \"application/octet-stream\",\n });\n return { objectUrl: URL.createObjectURL(blob), mimeType: file.mimeType, fileName: file.fileName };\n },\n enabled: Boolean(client) && Boolean(daemon) && Boolean(path) && enabled,\n // Object URLs are process-local, non-serializable browser resources — never persist them or\n // silently refetch behind this hook's back (that would leak the previous blob's URL).\n staleTime: Infinity,\n gcTime: 0,\n });\n\n // Revoke the previous object URL once a new one supersedes it, and the current one on unmount\n // — TanStack Query's cache has no notion that this value owns a browser resource to release.\n const urlRef = useRef<string | null>(null);\n useEffect(() => {\n const nextUrl = query.data?.objectUrl ?? null;\n if (nextUrl && urlRef.current && urlRef.current !== nextUrl) {\n URL.revokeObjectURL(urlRef.current);\n }\n urlRef.current = nextUrl;\n }, [query.data?.objectUrl]);\n\n useEffect(() => {\n return () => {\n if (urlRef.current) URL.revokeObjectURL(urlRef.current);\n };\n }, []);\n\n return query;\n}\n"],"names":["useFileDownload","path","enabled","client","useConnectionStore","s","daemon","query","useQuery","rpcKeys","file","transferFor","blob","urlRef","useRef","useEffect","nextUrl","_a"],"mappings":"oJAqBO,SAASA,EAAgBC,EAAcC,EAAU,GAAM,OAC5D,MAAMC,EAASC,EAAoBC,GAAMA,EAAE,MAAM,EAC3CC,EAASF,EAAoBC,GAAMA,EAAE,MAAM,EAE3CE,EAAQC,EAAS,CACrB,SAAUC,EAAQ,aAAaR,CAAI,EACnC,QAAS,SAAmC,CAC1C,GAAI,CAACE,GAAU,CAACG,EAAQ,MAAM,IAAI,MAAM,eAAe,EACvD,MAAMI,EAAO,MAAMC,EAAYL,CAAM,EAAE,SAASL,CAAI,EAI9CW,EAAO,IAAI,KAAK,CAAC,WAAW,KAAKF,EAAK,KAAK,CAAC,EAAG,CACnD,KAAMA,EAAK,UAAY,0BAAA,CACxB,EACD,MAAO,CAAE,UAAW,IAAI,gBAAgBE,CAAI,EAAG,SAAUF,EAAK,SAAU,SAAUA,EAAK,QAAA,CACzF,EACA,QAAS,EAAQP,GAAW,EAAQG,GAAW,EAAQL,GAASC,EAGhE,UAAW,IACX,OAAQ,CAAA,CACT,EAIKW,EAASC,EAAAA,OAAsB,IAAI,EACzCC,OAAAA,EAAAA,UAAU,IAAM,OACd,MAAMC,IAAUC,EAAAV,EAAM,OAAN,YAAAU,EAAY,YAAa,KACrCD,GAAWH,EAAO,SAAWA,EAAO,UAAYG,GAClD,IAAI,gBAAgBH,EAAO,OAAO,EAEpCA,EAAO,QAAUG,CACnB,EAAG,EAACC,EAAAV,EAAM,OAAN,YAAAU,EAAY,SAAS,CAAC,EAE1BF,EAAAA,UAAU,IACD,IAAM,CACPF,EAAO,SAAS,IAAI,gBAAgBA,EAAO,OAAO,CACxD,EACC,CAAA,CAAE,EAEEN,CACT"}
|
package/dist/web/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>Pi-Studio</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-hArhMYDk.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BoIQBqDW.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/vendor-query-D5H9KBcL.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/vendor-markdown-B8HSIhaA.js">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@av-pi-studio/web-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@av-pi-studio/client": "^0.0.
|
|
18
|
-
"@av-pi-studio/protocol": "^0.0.
|
|
17
|
+
"@av-pi-studio/client": "^0.0.21",
|
|
18
|
+
"@av-pi-studio/protocol": "^0.0.21",
|
|
19
19
|
"@codemirror/language": "^6.12.4",
|
|
20
20
|
"@codemirror/language-data": "^6.5.2",
|
|
21
21
|
"@codemirror/state": "^6.7.1",
|