@burdenoff/microfe-files 2026.525.3 → 2026.527.2
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/files/components/ActionMenu.js +3 -1
- package/dist/files/components/ActionMenu.js.map +1 -1
- package/dist/files/components/ContextMenu.js +16 -112
- package/dist/files/components/ContextMenu.js.map +1 -1
- package/dist/files/components/CopyDialog.js +8 -0
- package/dist/files/components/CopyDialog.js.map +1 -1
- package/dist/files/components/EmptyState.js +2 -0
- package/dist/files/components/EmptyState.js.map +1 -1
- package/dist/files/components/FileBrowser.js +192 -171
- package/dist/files/components/FileBrowser.js.map +1 -1
- package/dist/files/components/FileCard.js +4 -0
- package/dist/files/components/FileCard.js.map +1 -1
- package/dist/files/components/FileInfoPanel.js +2 -0
- package/dist/files/components/FileInfoPanel.js.map +1 -1
- package/dist/files/components/FileListItem.js +6 -0
- package/dist/files/components/FileListItem.js.map +1 -1
- package/dist/files/components/FilePreviewModal.js +9 -3
- package/dist/files/components/FilePreviewModal.js.map +1 -1
- package/dist/files/components/FileVersionPanel.js +5 -0
- package/dist/files/components/FileVersionPanel.js.map +1 -1
- package/dist/files/components/FolderCard.js +147 -158
- package/dist/files/components/FolderCard.js.map +1 -1
- package/dist/files/components/MoveDialog.js +17 -12
- package/dist/files/components/MoveDialog.js.map +1 -1
- package/dist/files/components/SearchBar.js +4 -0
- package/dist/files/components/SearchBar.js.map +1 -1
- package/dist/files/components/ShareDialog.js +109 -104
- package/dist/files/components/ShareDialog.js.map +1 -1
- package/dist/files/components/TabBar.js +1 -0
- package/dist/files/components/TabBar.js.map +1 -1
- package/dist/files/components/Toast.js +1 -0
- package/dist/files/components/Toast.js.map +1 -1
- package/dist/files/components/UploadQueue.js +5 -0
- package/dist/files/components/UploadQueue.js.map +1 -1
- package/dist/files/components/contextMenuItems.js +103 -0
- package/dist/files/components/contextMenuItems.js.map +1 -0
- package/dist/files/components/viewers/AudioPlayer.js +4 -1
- package/dist/files/components/viewers/AudioPlayer.js.map +1 -1
- package/dist/files/components/viewers/CodeViewer.js +2 -0
- package/dist/files/components/viewers/CodeViewer.js.map +1 -1
- package/dist/files/components/viewers/ImageViewer.js +4 -0
- package/dist/files/components/viewers/ImageViewer.js.map +1 -1
- package/dist/files/components/viewers/PDFViewer.js +2 -0
- package/dist/files/components/viewers/PDFViewer.js.map +1 -1
- package/dist/files/components/viewers/TextViewer.js +4 -2
- package/dist/files/components/viewers/TextViewer.js.map +1 -1
- package/dist/files/components/viewers/VideoPlayer.js +5 -1
- package/dist/files/components/viewers/VideoPlayer.js.map +1 -1
- package/dist/files/hooks/useBatchOperations.js.map +1 -1
- package/dist/files/hooks/useCreateFolder.js +15 -7
- package/dist/files/hooks/useCreateFolder.js.map +1 -1
- package/dist/files/hooks/useFileVersions.js.map +1 -1
- package/dist/files/hooks/useMoveFile.js +1 -2
- package/dist/files/hooks/useMoveFile.js.map +1 -1
- package/dist/files/hooks/useMoveFolder.js +0 -2
- package/dist/files/hooks/useMoveFolder.js.map +1 -1
- package/dist/files/hooks/useStarredItems.js +4 -3
- package/dist/files/hooks/useStarredItems.js.map +1 -1
- package/dist/files/hooks/useToggleStar.js +10 -10
- package/dist/files/hooks/useToggleStar.js.map +1 -1
- package/dist/files/pages/BrowserPage.js +332 -302
- package/dist/files/pages/BrowserPage.js.map +1 -1
- package/dist/files/pages/ShareAccessPage.js +6 -5
- package/dist/files/pages/ShareAccessPage.js.map +1 -1
- package/dist/files/utils/index.js +1 -1
- package/dist/files/utils/index.js.map +1 -1
- package/dist/files/utils/quotaUtils.js +14 -0
- package/dist/files/utils/quotaUtils.js.map +1 -0
- package/dist/files/utils/thumbnail.js.map +1 -1
- package/dist/files.js +2 -1
- package/dist/translations/en.js +259 -0
- package/dist/translations/en.js.map +1 -0
- package/package.json +2 -5
- package/dist/files/components/viewers/index.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageViewer.js","names":[],"sources":["../../../../src/files/components/viewers/ImageViewer.tsx"],"sourcesContent":["import { useState, useRef } from \"react\";\nimport {\n ZoomIn,\n ZoomOut,\n RotateCw,\n Maximize2,\n Minimize2,\n AlertCircle,\n} from \"lucide-react\";\nimport type { FileItem } from \"../../types\";\n\ninterface ImageViewerProps {\n file: FileItem;\n url: string;\n}\n\nexport function ImageViewer({ file, url }: ImageViewerProps) {\n const [zoom, setZoom] = useState(1);\n const [rotation, setRotation] = useState(0);\n const [position, setPosition] = useState({ x: 0, y: 0 });\n const [isDragging, setIsDragging] = useState(false);\n const [dragStart, setDragStart] = useState({ x: 0, y: 0 });\n const [imageError, setImageError] = useState<string | null>(null);\n const imageRef = useRef<HTMLImageElement>(null);\n const [imageDimensions, setImageDimensions] = useState({\n width: 0,\n height: 0,\n });\n\n const handleZoomIn = () => setZoom((prev) => Math.min(prev + 0.25, 4));\n const handleZoomOut = () => setZoom((prev) => Math.max(prev - 0.25, 0.25));\n const handleResetZoom = () => {\n setZoom(1);\n setPosition({ x: 0, y: 0 });\n setRotation(0);\n };\n const handleRotate = () => setRotation((prev) => (prev + 90) % 360);\n\n const handleMouseDown = (e: React.MouseEvent) => {\n if (zoom > 1) {\n setIsDragging(true);\n setDragStart({ x: e.clientX - position.x, y: e.clientY - position.y });\n }\n };\n\n const handleMouseMove = (e: React.MouseEvent) => {\n if (isDragging && zoom > 1) {\n setPosition({\n x: e.clientX - dragStart.x,\n y: e.clientY - dragStart.y,\n });\n }\n };\n\n const handleMouseUp = () => {\n setIsDragging(false);\n };\n\n const handleImageLoad = () => {\n if (imageRef.current) {\n setImageDimensions({\n width: imageRef.current.naturalWidth,\n height: imageRef.current.naturalHeight,\n });\n }\n };\n\n const handleImageError = () => {\n setImageError(`Failed to load image from URL`);\n };\n\n return (\n <div className=\"flex flex-col h-full bg-bg-canvas\">\n {/* Toolbar */}\n <div className=\"flex items-center justify-center gap-2 p-4 bg-bg-surface border-b border-border-default\">\n <button\n onClick={handleZoomOut}\n disabled={zoom <= 0.25}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n title=\"Zoom out\"\n >\n <ZoomOut className=\"size-5\" />\n </button>\n\n <span className=\"min-w-16 text-center text-sm font-medium text-text-primary\">\n {Math.round(zoom * 100)}%\n </span>\n\n <button\n onClick={handleZoomIn}\n disabled={zoom >= 4}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n title=\"Zoom in\"\n >\n <ZoomIn className=\"size-5\" />\n </button>\n\n <div className=\"w-px h-6 bg-border-default mx-2\" />\n\n <button\n onClick={handleResetZoom}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200\"\n title=\"Fit to screen\"\n >\n <Minimize2 className=\"size-5\" />\n </button>\n\n <button\n onClick={handleRotate}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200\"\n title=\"Rotate 90°\"\n >\n <RotateCw className=\"size-5\" />\n </button>\n </div>\n\n {/* Image Container */}\n <div\n className=\"flex-1 overflow-hidden flex items-center justify-center relative\"\n onMouseDown={handleMouseDown}\n onMouseMove={handleMouseMove}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseUp}\n style={{\n cursor: zoom > 1 ? (isDragging ? \"grabbing\" : \"grab\") : \"default\",\n }}\n >\n <img\n ref={imageRef}\n src={url}\n alt={file.name}\n onLoad={handleImageLoad}\n onError={handleImageError}\n draggable={false}\n className=\"max-w-full max-h-full object-contain transition-transform duration-200\"\n style={{\n transform: `scale(${zoom}) rotate(${rotation}deg) translate(${position.x / zoom}px, ${position.y / zoom}px)`,\n userSelect: \"none\",\n }}\n />\n {imageError && (\n <div className=\"absolute inset-0 flex flex-col items-center justify-center bg-bg-canvas/90 z-10\">\n <AlertCircle className=\"size-12 text-status-error-text mb-4\" />\n <p className=\"text-text-primary font-medium mb-2\">\n Failed to load image\n </p>\n <p className=\"text-text-secondary text-sm max-w-md text-center px-4\">\n {imageError}\n </p>\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"mt-4 px-4 py-2 bg-action-primary-bg text-text-inverse rounded-lg hover:bg-action-primary-bg-hover\"\n >\n Open in new tab\n </a>\n </div>\n )}\n </div>\n\n {/* Metadata */}\n <div className=\"flex items-center justify-center gap-6 p-3 bg-bg-surface border-t border-border-default text-xs text-text-secondary\">\n <span>{file.name}</span>\n {imageDimensions.width > 0 && (\n <span>\n {imageDimensions.width} × {imageDimensions.height}\n </span>\n )}\n <span>{(file.size / 1024 / 1024).toFixed(2)} MB</span>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAgBA,SAAgB,EAAY,EAAE,SAAM,UAAyB;CAC3D,IAAM,CAAC,GAAM,KAAW,EAAS,EAAE,EAC7B,CAAC,GAAU,KAAe,EAAS,EAAE,EACrC,CAAC,GAAU,KAAe,EAAS;EAAE,GAAG;EAAG,GAAG;EAAG,CAAC,EAClD,CAAC,GAAY,KAAiB,EAAS,GAAM,EAC7C,CAAC,GAAW,KAAgB,EAAS;EAAE,GAAG;EAAG,GAAG;EAAG,CAAC,EACpD,CAAC,GAAY,KAAiB,EAAwB,KAAK,EAC3D,IAAW,EAAyB,KAAK,EACzC,CAAC,GAAiB,KAAsB,EAAS;EACrD,OAAO;EACP,QAAQ;EACT,CAAC,EAEI,UAAqB,GAAS,MAAS,KAAK,IAAI,IAAO,KAAM,EAAE,CAAC,EAChE,UAAsB,GAAS,MAAS,KAAK,IAAI,IAAO,KAAM,IAAK,CAAC,EACpE,UAAwB;AAG5B,EAFA,EAAQ,EAAE,EACV,EAAY;GAAE,GAAG;GAAG,GAAG;GAAG,CAAC,EAC3B,EAAY,EAAE;IAEV,UAAqB,GAAa,OAAU,IAAO,MAAM,IAAI,EAE7D,KAAmB,MAAwB;AAC/C,EAAI,IAAO,MACT,EAAc,GAAK,EACnB,EAAa;GAAE,GAAG,EAAE,UAAU,EAAS;GAAG,GAAG,EAAE,UAAU,EAAS;GAAG,CAAC;IAIpE,KAAmB,MAAwB;AAC/C,EAAI,KAAc,IAAO,KACvB,EAAY;GACV,GAAG,EAAE,UAAU,EAAU;GACzB,GAAG,EAAE,UAAU,EAAU;GAC1B,CAAC;IAIA,UAAsB;AAC1B,IAAc,GAAM;;AAgBtB,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GAEE,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,UAAD;MACE,SAAS;MACT,UAAU,KAAQ;MAClB,WAAU;MACV,OAAM;gBAEN,kBAAC,GAAD,EAAS,WAAU,UAAW,CAAA;MACvB,CAAA;KAET,kBAAC,QAAD;MAAM,WAAU;gBAAhB,CACG,KAAK,MAAM,IAAO,IAAI,EAAC,IACnB;;KAEP,kBAAC,UAAD;MACE,SAAS;MACT,UAAU,KAAQ;MAClB,WAAU;MACV,OAAM;gBAEN,kBAAC,GAAD,EAAQ,WAAU,UAAW,CAAA;MACtB,CAAA;KAET,kBAAC,OAAD,EAAK,WAAU,mCAAoC,CAAA;KAEnD,kBAAC,UAAD;MACE,SAAS;MACT,WAAU;MACV,OAAM;gBAEN,kBAAC,GAAD,EAAW,WAAU,UAAW,CAAA;MACzB,CAAA;KAET,kBAAC,UAAD;MACE,SAAS;MACT,WAAU;MACV,OAAM;gBAEN,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA;MACxB,CAAA;KACL;;GAGN,kBAAC,OAAD;IACE,WAAU;IACV,aAAa;IACb,aAAa;IACb,WAAW;IACX,cAAc;IACd,OAAO,EACL,QAAQ,IAAO,IAAK,IAAa,aAAa,SAAU,WACzD;cARH,CAUE,kBAAC,OAAD;KACE,KAAK;KACL,KAAK;KACL,KAAK,EAAK;KACV,
|
|
1
|
+
{"version":3,"file":"ImageViewer.js","names":[],"sources":["../../../../src/files/components/viewers/ImageViewer.tsx"],"sourcesContent":["import { useState, useRef } from \"react\";\nimport {\n ZoomIn,\n ZoomOut,\n RotateCw,\n Maximize2,\n Minimize2,\n AlertCircle,\n} from \"lucide-react\";\nimport type { FileItem } from \"../../types\";\n\ninterface ImageViewerProps {\n file: FileItem;\n url: string;\n}\n\nexport function ImageViewer({ file, url }: ImageViewerProps) {\n const [zoom, setZoom] = useState(1);\n const [rotation, setRotation] = useState(0);\n const [position, setPosition] = useState({ x: 0, y: 0 });\n const [isDragging, setIsDragging] = useState(false);\n const [dragStart, setDragStart] = useState({ x: 0, y: 0 });\n const [imageError, setImageError] = useState<string | null>(null);\n const imageRef = useRef<HTMLImageElement>(null);\n const [imageDimensions, setImageDimensions] = useState({\n width: 0,\n height: 0,\n });\n\n const handleZoomIn = () => setZoom((prev) => Math.min(prev + 0.25, 4));\n const handleZoomOut = () => setZoom((prev) => Math.max(prev - 0.25, 0.25));\n const handleResetZoom = () => {\n setZoom(1);\n setPosition({ x: 0, y: 0 });\n setRotation(0);\n };\n const handleRotate = () => setRotation((prev) => (prev + 90) % 360);\n\n const handleMouseDown = (e: React.MouseEvent) => {\n if (zoom > 1) {\n setIsDragging(true);\n setDragStart({ x: e.clientX - position.x, y: e.clientY - position.y });\n }\n };\n\n const handleMouseMove = (e: React.MouseEvent) => {\n if (isDragging && zoom > 1) {\n setPosition({\n x: e.clientX - dragStart.x,\n y: e.clientY - dragStart.y,\n });\n }\n };\n\n const handleMouseUp = () => {\n setIsDragging(false);\n };\n\n const handleImageLoad = () => {\n if (imageRef.current) {\n setImageDimensions({\n width: imageRef.current.naturalWidth,\n height: imageRef.current.naturalHeight,\n });\n }\n };\n\n const handleImageError = () => {\n setImageError(`Failed to load image from URL`);\n };\n\n return (\n <div className=\"flex flex-col h-full bg-bg-canvas\">\n {/* Toolbar */}\n <div className=\"flex items-center justify-center gap-2 p-4 bg-bg-surface border-b border-border-default\">\n <button\n type=\"button\"\n onClick={handleZoomOut}\n disabled={zoom <= 0.25}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n title=\"Zoom out\"\n >\n <ZoomOut className=\"size-5\" />\n </button>\n\n <span className=\"min-w-16 text-center text-sm font-medium text-text-primary\">\n {Math.round(zoom * 100)}%\n </span>\n\n <button\n type=\"button\"\n onClick={handleZoomIn}\n disabled={zoom >= 4}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n title=\"Zoom in\"\n >\n <ZoomIn className=\"size-5\" />\n </button>\n\n <div className=\"w-px h-6 bg-border-default mx-2\" />\n\n <button\n type=\"button\"\n onClick={handleResetZoom}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200\"\n title=\"Fit to screen\"\n >\n <Minimize2 className=\"size-5\" />\n </button>\n\n <button\n type=\"button\"\n onClick={handleRotate}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200\"\n title=\"Rotate 90°\"\n >\n <RotateCw className=\"size-5\" />\n </button>\n </div>\n\n {/* Image Container */}\n <div\n className=\"flex-1 overflow-hidden flex items-center justify-center relative\"\n onMouseDown={handleMouseDown}\n onMouseMove={handleMouseMove}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseUp}\n style={{\n cursor: zoom > 1 ? (isDragging ? \"grabbing\" : \"grab\") : \"default\",\n }}\n >\n <img\n ref={imageRef}\n src={url}\n alt={file.name}\n onLoad={handleImageLoad}\n onError={handleImageError}\n draggable={false}\n className=\"max-w-full max-h-full object-contain transition-transform duration-200\"\n style={{\n transform: `scale(${zoom}) rotate(${rotation}deg) translate(${position.x / zoom}px, ${position.y / zoom}px)`,\n userSelect: \"none\",\n }}\n />\n {imageError && (\n <div className=\"absolute inset-0 flex flex-col items-center justify-center bg-bg-canvas/90 z-10\">\n <AlertCircle className=\"size-12 text-status-error-text mb-4\" />\n <p className=\"text-text-primary font-medium mb-2\">\n Failed to load image\n </p>\n <p className=\"text-text-secondary text-sm max-w-md text-center px-4\">\n {imageError}\n </p>\n <a\n href={url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"mt-4 px-4 py-2 bg-action-primary-bg text-text-inverse rounded-lg hover:bg-action-primary-bg-hover\"\n >\n Open in new tab\n </a>\n </div>\n )}\n </div>\n\n {/* Metadata */}\n <div className=\"flex items-center justify-center gap-6 p-3 bg-bg-surface border-t border-border-default text-xs text-text-secondary\">\n <span>{file.name}</span>\n {imageDimensions.width > 0 && (\n <span>\n {imageDimensions.width} × {imageDimensions.height}\n </span>\n )}\n <span>{(file.size / 1024 / 1024).toFixed(2)} MB</span>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAgBA,SAAgB,EAAY,EAAE,SAAM,UAAyB;CAC3D,IAAM,CAAC,GAAM,KAAW,EAAS,EAAE,EAC7B,CAAC,GAAU,KAAe,EAAS,EAAE,EACrC,CAAC,GAAU,KAAe,EAAS;EAAE,GAAG;EAAG,GAAG;EAAG,CAAC,EAClD,CAAC,GAAY,KAAiB,EAAS,GAAM,EAC7C,CAAC,GAAW,KAAgB,EAAS;EAAE,GAAG;EAAG,GAAG;EAAG,CAAC,EACpD,CAAC,GAAY,KAAiB,EAAwB,KAAK,EAC3D,IAAW,EAAyB,KAAK,EACzC,CAAC,GAAiB,KAAsB,EAAS;EACrD,OAAO;EACP,QAAQ;EACT,CAAC,EAEI,UAAqB,GAAS,MAAS,KAAK,IAAI,IAAO,KAAM,EAAE,CAAC,EAChE,UAAsB,GAAS,MAAS,KAAK,IAAI,IAAO,KAAM,IAAK,CAAC,EACpE,UAAwB;AAG5B,EAFA,EAAQ,EAAE,EACV,EAAY;GAAE,GAAG;GAAG,GAAG;GAAG,CAAC,EAC3B,EAAY,EAAE;IAEV,UAAqB,GAAa,OAAU,IAAO,MAAM,IAAI,EAE7D,KAAmB,MAAwB;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I,EAAS,WACX,EAAmB;OACjB,OAAO,EAAS,QAAQ;OACxB,QAAQ,EAAS,QAAQ;OAC1B,CAAC;;KAyEE,eArEuB;AAC7B,QAAc,gCAAgC;;KAqExC,WAAW;KACX,WAAU;KACV,OAAO;MACL,WAAW,SAAS,EAAK,WAAW,EAAS,iBAAiB,EAAS,IAAI,EAAK,MAAM,EAAS,IAAI,EAAK;MACxG,YAAY;MACb;KACD,CAAA,EACD,KACC,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,GAAD,EAAa,WAAU,uCAAwC,CAAA;MAC/D,kBAAC,KAAD;OAAG,WAAU;iBAAqC;OAE9C,CAAA;MACJ,kBAAC,KAAD;OAAG,WAAU;iBACV;OACC,CAAA;MACJ,kBAAC,KAAD;OACE,MAAM;OACN,QAAO;OACP,KAAI;OACJ,WAAU;iBACX;OAEG,CAAA;MACA;OAEJ;;GAGN,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,QAAD,EAAA,UAAO,EAAK,MAAY,CAAA;KACvB,EAAgB,QAAQ,KACvB,kBAAC,QAAD,EAAA,UAAA;MACG,EAAgB;MAAM;MAAI,EAAgB;MACtC,EAAA,CAAA;KAET,kBAAC,QAAD,EAAA,UAAA,EAAQ,EAAK,OAAO,OAAO,MAAM,QAAQ,EAAE,EAAC,MAAU,EAAA,CAAA;KAClD;;GACF"}
|
|
@@ -13,6 +13,7 @@ function a({ file: a, url: o }) {
|
|
|
13
13
|
className: "flex items-center gap-2",
|
|
14
14
|
children: [
|
|
15
15
|
/* @__PURE__ */ r("button", {
|
|
16
|
+
type: "button",
|
|
16
17
|
onClick: u,
|
|
17
18
|
disabled: s <= 50,
|
|
18
19
|
className: "p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
@@ -24,6 +25,7 @@ function a({ file: a, url: o }) {
|
|
|
24
25
|
children: [s, "%"]
|
|
25
26
|
}),
|
|
26
27
|
/* @__PURE__ */ r("button", {
|
|
28
|
+
type: "button",
|
|
27
29
|
onClick: l,
|
|
28
30
|
disabled: s >= 200,
|
|
29
31
|
className: "p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PDFViewer.js","names":[],"sources":["../../../../src/files/components/viewers/PDFViewer.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { ZoomIn, ZoomOut } from \"lucide-react\";\nimport type { FileItem } from \"../../types\";\n\ninterface PDFViewerProps {\n file: FileItem;\n url: string;\n}\n\n/**\n * PDFViewer - Displays PDF files\n *\n * Note: This uses <object> tag for better browser PDF compatibility.\n * For a full-featured PDF viewer with more controls, install react-pdf:\n * bun add react-pdf pdfjs-dist\n */\nexport function PDFViewer({ file, url }: PDFViewerProps) {\n const [scale, setScale] = useState(100);\n\n const handleZoomIn = () => setScale((prev) => Math.min(prev + 25, 200));\n const handleZoomOut = () => setScale((prev) => Math.max(prev - 25, 50));\n\n // Create zoom-adjusted URL\n const pdfUrl = `${url}#view=FitH&zoom=${scale}`;\n\n return (\n <div className=\"flex flex-col h-full bg-bg-canvas\">\n {/* Toolbar */}\n <div className=\"flex items-center justify-between p-4 bg-bg-surface border-b border-border-default\">\n <div className=\"flex items-center gap-2\">\n <button\n onClick={handleZoomOut}\n disabled={scale <= 50}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n title=\"Zoom out\"\n >\n <ZoomOut className=\"size-5\" />\n </button>\n\n <span className=\"min-w-16 text-center text-sm font-medium text-text-primary\">\n {scale}%\n </span>\n\n <button\n onClick={handleZoomIn}\n disabled={scale >= 200}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n title=\"Zoom in\"\n >\n <ZoomIn className=\"size-5\" />\n </button>\n </div>\n\n <span className=\"text-sm text-text-secondary\">{file.name}</span>\n </div>\n\n {/* PDF Object - Using object tag instead of iframe for better compatibility */}\n <div className=\"flex-1 overflow-hidden\">\n <object\n data={pdfUrl}\n type=\"application/pdf\"\n className=\"w-full h-full\"\n title={file.name}\n >\n {/* Fallback content if PDF cannot be displayed */}\n <div className=\"flex flex-col items-center justify-center h-full gap-4 p-8\">\n <div className=\"text-text-secondary text-center\">\n <p className=\"font-text-lg font-weight-medium mb-2\">\n Unable to display PDF\n </p>\n <p className=\"font-text-sm\">\n Your browser may not support embedded PDF viewing.\n </p>\n </div>\n <a\n href={url}\n download={file.name}\n className=\"px-4 py-2 bg-action-primary-bg text-action-primary-text rounded-btn hover:bg-action-primary-bg-hover transition-colors\"\n >\n Download PDF\n </a>\n </div>\n </object>\n </div>\n\n {/* Info Footer */}\n <div className=\"flex items-center justify-center p-3 bg-bg-surface border-t border-border-default text-xs text-text-secondary\">\n <span>PDF Document · {(file.size / 1024 / 1024).toFixed(2)} MB</span>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAgBA,SAAgB,EAAU,EAAE,SAAM,UAAuB;CACvD,IAAM,CAAC,GAAO,KAAY,EAAS,IAAI,EAEjC,UAAqB,GAAU,MAAS,KAAK,IAAI,IAAO,IAAI,IAAI,CAAC,EACjE,UAAsB,GAAU,MAAS,KAAK,IAAI,IAAO,IAAI,GAAG,CAAC,EAGjE,IAAS,GAAG,EAAI,kBAAkB;AAExC,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GAEE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,UAAD;OACE,SAAS;OACT,UAAU,KAAS;OACnB,WAAU;OACV,OAAM;iBAEN,kBAAC,GAAD,EAAS,WAAU,UAAW,CAAA;OACvB,CAAA;MAET,kBAAC,QAAD;OAAM,WAAU;iBAAhB,CACG,GAAM,IACF;;MAEP,kBAAC,UAAD;OACE,SAAS;OACT,UAAU,KAAS;OACnB,WAAU;OACV,OAAM;iBAEN,kBAAC,GAAD,EAAQ,WAAU,UAAW,CAAA;OACtB,CAAA;MACL;QAEN,kBAAC,QAAD;KAAM,WAAU;eAA+B,EAAK;KAAY,CAAA,CAC5D;;GAGN,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,UAAD;KACE,MAAM;KACN,MAAK;KACL,WAAU;KACV,OAAO,EAAK;eAGZ,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,KAAD;QAAG,WAAU;kBAAuC;QAEhD,CAAA,EACJ,kBAAC,KAAD;QAAG,WAAU;kBAAe;QAExB,CAAA,CACA;UACN,kBAAC,KAAD;OACE,MAAM;OACN,UAAU,EAAK;OACf,WAAU;iBACX;OAEG,CAAA,CACA;;KACC,CAAA;IACL,CAAA;GAGN,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,QAAD,EAAA,UAAA;KAAM;MAAiB,EAAK,OAAO,OAAO,MAAM,QAAQ,EAAE;KAAC;KAAU,EAAA,CAAA;IACjE,CAAA;GACF"}
|
|
1
|
+
{"version":3,"file":"PDFViewer.js","names":[],"sources":["../../../../src/files/components/viewers/PDFViewer.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { ZoomIn, ZoomOut } from \"lucide-react\";\nimport type { FileItem } from \"../../types\";\n\ninterface PDFViewerProps {\n file: FileItem;\n url: string;\n}\n\n/**\n * PDFViewer - Displays PDF files\n *\n * Note: This uses <object> tag for better browser PDF compatibility.\n * For a full-featured PDF viewer with more controls, install react-pdf:\n * bun add react-pdf pdfjs-dist\n */\nexport function PDFViewer({ file, url }: PDFViewerProps) {\n const [scale, setScale] = useState(100);\n\n const handleZoomIn = () => setScale((prev) => Math.min(prev + 25, 200));\n const handleZoomOut = () => setScale((prev) => Math.max(prev - 25, 50));\n\n // Create zoom-adjusted URL\n const pdfUrl = `${url}#view=FitH&zoom=${scale}`;\n\n return (\n <div className=\"flex flex-col h-full bg-bg-canvas\">\n {/* Toolbar */}\n <div className=\"flex items-center justify-between p-4 bg-bg-surface border-b border-border-default\">\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={handleZoomOut}\n disabled={scale <= 50}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n title=\"Zoom out\"\n >\n <ZoomOut className=\"size-5\" />\n </button>\n\n <span className=\"min-w-16 text-center text-sm font-medium text-text-primary\">\n {scale}%\n </span>\n\n <button\n type=\"button\"\n onClick={handleZoomIn}\n disabled={scale >= 200}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed\"\n title=\"Zoom in\"\n >\n <ZoomIn className=\"size-5\" />\n </button>\n </div>\n\n <span className=\"text-sm text-text-secondary\">{file.name}</span>\n </div>\n\n {/* PDF Object - Using object tag instead of iframe for better compatibility */}\n <div className=\"flex-1 overflow-hidden\">\n <object\n data={pdfUrl}\n type=\"application/pdf\"\n className=\"w-full h-full\"\n title={file.name}\n >\n {/* Fallback content if PDF cannot be displayed */}\n <div className=\"flex flex-col items-center justify-center h-full gap-4 p-8\">\n <div className=\"text-text-secondary text-center\">\n <p className=\"font-text-lg font-weight-medium mb-2\">\n Unable to display PDF\n </p>\n <p className=\"font-text-sm\">\n Your browser may not support embedded PDF viewing.\n </p>\n </div>\n <a\n href={url}\n download={file.name}\n className=\"px-4 py-2 bg-action-primary-bg text-action-primary-text rounded-btn hover:bg-action-primary-bg-hover transition-colors\"\n >\n Download PDF\n </a>\n </div>\n </object>\n </div>\n\n {/* Info Footer */}\n <div className=\"flex items-center justify-center p-3 bg-bg-surface border-t border-border-default text-xs text-text-secondary\">\n <span>PDF Document · {(file.size /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cACb,kBAAC,QAAD,EAAA,UAAA;KAAM;MAAiB,EAAK,OAAO,OAAO,MAAM,QAAQ,EAAE;KAAC;KAAU,EAAA,CAAA;IACjE,CAAA;GACF"}
|
|
@@ -68,8 +68,7 @@ function d({ file: d, url: f }) {
|
|
|
68
68
|
value: y,
|
|
69
69
|
onChange: (e) => b(e.target.value),
|
|
70
70
|
placeholder: "Search...",
|
|
71
|
-
className: "w-40 bg-transparent text-sm text-text-primary placeholder:text-text-tertiary focus:outline-none"
|
|
72
|
-
autoFocus: !0
|
|
71
|
+
className: "w-40 bg-transparent text-sm text-text-primary placeholder:text-text-tertiary focus:outline-none"
|
|
73
72
|
}),
|
|
74
73
|
D > 0 && /* @__PURE__ */ l("span", {
|
|
75
74
|
className: "text-xs text-text-secondary",
|
|
@@ -82,6 +81,7 @@ function d({ file: d, url: f }) {
|
|
|
82
81
|
]
|
|
83
82
|
}),
|
|
84
83
|
/* @__PURE__ */ c("button", {
|
|
84
|
+
type: "button",
|
|
85
85
|
onClick: () => S(!x),
|
|
86
86
|
className: `p-2 rounded transition-colors duration-200 ${x ? "text-text-link bg-bg-accent" : "text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover"}`,
|
|
87
87
|
title: "Search",
|
|
@@ -89,6 +89,7 @@ function d({ file: d, url: f }) {
|
|
|
89
89
|
children: /* @__PURE__ */ c(a, { className: "size-4" })
|
|
90
90
|
}),
|
|
91
91
|
/* @__PURE__ */ c("button", {
|
|
92
|
+
type: "button",
|
|
92
93
|
onClick: () => v(!_),
|
|
93
94
|
className: `p-2 rounded transition-colors duration-200 ${_ ? "text-text-link bg-bg-accent" : "text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover"}`,
|
|
94
95
|
title: _ ? "Disable word wrap" : "Enable word wrap",
|
|
@@ -96,6 +97,7 @@ function d({ file: d, url: f }) {
|
|
|
96
97
|
children: /* @__PURE__ */ c(o, { className: "size-4" })
|
|
97
98
|
}),
|
|
98
99
|
/* @__PURE__ */ c("button", {
|
|
100
|
+
type: "button",
|
|
99
101
|
onClick: T,
|
|
100
102
|
className: "flex items-center gap-1.5 rounded px-3 py-1.5 text-sm font-medium text-text-inverse bg-action-primary-bg transition-colors duration-200 hover:bg-action-primary-bg-hover",
|
|
101
103
|
title: "Copy text",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextViewer.js","names":[],"sources":["../../../../src/files/components/viewers/TextViewer.tsx"],"sourcesContent":["import { useState, useEffect, useMemo } from \"react\";\nimport { Copy, Check, WrapText, Search } from \"lucide-react\";\nimport type { FileItem } from \"../../types\";\n\ninterface TextViewerProps {\n file: FileItem;\n url: string;\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nexport function TextViewer({ file, url }: TextViewerProps) {\n const [content, setContent] = useState(\"\");\n const [loading, setLoading] = useState(true);\n const [wordWrap, setWordWrap] = useState(true);\n const [searchTerm, setSearchTerm] = useState(\"\");\n const [showSearch, setShowSearch] = useState(false);\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n fetch(url)\n .then((res) => res.text())\n .then((text) => {\n setContent(text);\n setLoading(false);\n })\n .catch(() => {\n setLoading(false);\n });\n }, [url]);\n\n const handleCopy = () => {\n navigator.clipboard.writeText(content);\n setCopied(true);\n };\n\n // Cleanup timeout on unmount to prevent React state update warning\n useEffect(() => {\n if (copied) {\n const timer = setTimeout(() => setCopied(false), 2000);\n return () => clearTimeout(timer);\n }\n return undefined;\n }, [copied]);\n\n // Highlight search matches\n const highlightedLines = useMemo(() => {\n const lines = content.split(\"\\n\");\n\n if (!searchTerm.trim()) {\n return lines.map((line) => [{ text: line, isMatch: false }]);\n }\n\n const matcher = new RegExp(`(${escapeRegExp(searchTerm)})`, \"gi\");\n return lines.map((line) =>\n line.split(matcher).map((part) => ({\n text: part,\n isMatch: part.toLowerCase() === searchTerm.toLowerCase(),\n })),\n );\n }, [content, searchTerm]);\n\n const matchCount = useMemo(() => {\n if (!searchTerm.trim()) return 0;\n const regex = new RegExp(searchTerm, \"gi\");\n return (content.match(regex) || []).length;\n }, [content, searchTerm]);\n\n if (loading) {\n return (\n <div className=\"flex items-center justify-center h-full bg-bg-canvas\">\n <span className=\"text-text-secondary\">Loading text...</span>\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col h-full bg-bg-canvas\">\n {/* Toolbar */}\n <div className=\"flex items-center justify-between p-3 bg-bg-surface border-b border-border-default\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-text-secondary\">{file.name}</span>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {showSearch && (\n <div className=\"flex items-center gap-2 px-2 py-1 border border-border-default rounded\">\n <Search className=\"size-4 text-text-secondary\" />\n <input\n type=\"text\"\n value={searchTerm}\n onChange={(e) => setSearchTerm(e.target.value)}\n placeholder=\"Search...\"\n className=\"w-40 bg-transparent text-sm text-text-primary placeholder:text-text-tertiary focus:outline-none\"\n
|
|
1
|
+
{"version":3,"file":"TextViewer.js","names":[],"sources":["../../../../src/files/components/viewers/TextViewer.tsx"],"sourcesContent":["import { useState, useEffect, useMemo } from \"react\";\nimport { Copy, Check, WrapText, Search } from \"lucide-react\";\nimport type { FileItem } from \"../../types\";\n\ninterface TextViewerProps {\n file: FileItem;\n url: string;\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nexport function TextViewer({ file, url }: TextViewerProps) {\n const [content, setContent] = useState(\"\");\n const [loading, setLoading] = useState(true);\n const [wordWrap, setWordWrap] = useState(true);\n const [searchTerm, setSearchTerm] = useState(\"\");\n const [showSearch, setShowSearch] = useState(false);\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n fetch(url)\n .then((res) => res.text())\n .then((text) => {\n setContent(text);\n setLoading(false);\n })\n .catch(() => {\n setLoading(false);\n });\n }, [url]);\n\n const handleCopy = () => {\n navigator.clipboard.writeText(content);\n setCopied(true);\n };\n\n // Cleanup timeout on unmount to prevent React state update warning\n useEffect(() => {\n if (copied) {\n const timer = setTimeout(() => setCopied(false), 2000);\n return () => clearTimeout(timer);\n }\n return undefined;\n }, [copied]);\n\n // Highlight search matches\n const highlightedLines = useMemo(() => {\n const lines = content.split(\"\\n\");\n\n if (!searchTerm.trim()) {\n return lines.map((line) => [{ text: line, isMatch: false }]);\n }\n\n const matcher = new RegExp(`(${escapeRegExp(searchTerm)})`, \"gi\");\n return lines.map((line) =>\n line.split(matcher).map((part) => ({\n text: part,\n isMatch: part.toLowerCase() === searchTerm.toLowerCase(),\n })),\n );\n }, [content, searchTerm]);\n\n const matchCount = useMemo(() => {\n if (!searchTerm.trim()) return 0;\n const regex = new RegExp(searchTerm, \"gi\");\n return (content.match(regex) || []).length;\n }, [content, searchTerm]);\n\n if (loading) {\n return (\n <div className=\"flex items-center justify-center h-full bg-bg-canvas\">\n <span className=\"text-text-secondary\">Loading text...</span>\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col h-full bg-bg-canvas\">\n {/* Toolbar */}\n <div className=\"flex items-center justify-between p-3 bg-bg-surface border-b border-border-default\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-text-secondary\">{file.name}</span>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {showSearch && (\n <div className=\"flex items-center gap-2 px-2 py-1 border border-border-default rounded\">\n <Search className=\"size-4 text-text-secondary\" />\n <input\n type=\"text\"\n value={searchTerm}\n onChange={(e) => setSearchTerm(e.target.value)}\n placeholder=\"Search...\"\n className=\"w-40 bg-transparent text-sm text-text-primary placeholder:text-text-tertiary focus:outline-none\"\n />\n {matchCount > 0 && (\n <span className=\"text-xs text-text-secondary\">\n {matchCount} match{matchCount > 1 ? \"es\" : \"\"}\n </span>\n )}\n </div>\n )}\n\n <button\n type=\"button\"\n onClick={() => setShowSearch(!showSearch)}\n className={`p-2 rounded transition-colors duration-200 ${\n showSearch\n ? \"text-text-link bg-bg-accent\"\n : \"text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover\"\n }`}\n title=\"Search\"\n aria-label=\"Search within text file\"\n >\n <Search className=\"size-4\" />\n </button>\n\n <button\n type=\"button\"\n onClick={() => setWordWrap(!wordWrap)}\n className={`p-2 rounded transition-colors duration-200 ${\n wordWrap\n ? \"text-text-link bg-bg-accent\"\n : \"text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover\"\n }`}\n title={wordWrap ? \"Disable word wrap\" : \"Enable word wrap\"}\n aria-label={wordWrap ? \"Disable word wrap\" : \"Enable word wrap\"}\n >\n <WrapText className=\"size-4\" />\n </button>\n\n <button\n type=\"button\"\n onClick={handleCopy}\n className=\"flex items-center gap-1.5 rounded px-3 py-1.5 text-sm font-medium text-text-inverse bg-action-primary-bg transition-colors duration-200 hover:bg-action-primary-bg-hover\"\n title=\"Copy text\"\n aria-label=\"Copy text content\"\n >\n {copied ? (\n <>\n <Check className=\"size-4\" />\n Copied!\n </>\n ) : (\n <>\n <Copy className=\"size-4\" />\n Copy\n </>\n )}\n </button>\n </div>\n </div>\n\n {/* Text Content */}\n <div className=\"flex-1 overflow-auto\">\n <pre\n className={`p-4 text-sm font-mono leading-relaxed text-text-primary ${\n wordWrap ? \"whitespace-pre-wrap\" : \"whitespace-pre\"\n }`}\n >\n {highlightedLines.map((segments, lineIndex) => (\n <div key={lineIndex}>\n {segments.length === 0\n ? \" \"\n : segments.map((segment, partIndex) =>\n segment.isMatch ? (\n <mark\n key={`${lineIndex}-${partIndex}`}\n className=\"bg-status-warning-bg text-text-primary\"\n >\n {segment.text}\n </mark>\n ) : (\n <span key={`${lineIndex}-${partIndex}`}>\n {segment.text || \" \"}\n </span>\n ),\n )}\n </div>\n ))}\n </pre>\n </div>\n\n {/* Footer */}\n <div className=\"flex items-center justify-between p-3 bg-bg-surface border-t border-border-default text-xs text-text-secondary\">\n <span>{content.split(\"\\n\").length} lines</span>\n <span>{(file.size / 1024).toFixed(2)} KB</span>\n </div>\n </div>\n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AO,WAAU,UAAW,CAAA,EAAA,UAE3B,EAAA,CAAA,GAEH,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA,EAAA,OAE1B,EAAA,CAAA;OAEE,CAAA;MACL;OACF;;GAGN,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,OAAD;KACE,WAAW,2DACT,IAAW,wBAAwB;eAGpC,EAAiB,KAAK,GAAU,MAC/B,kBAAC,OAAD,EAAA,UACG,EAAS,WAAW,IACjB,MACA,EAAS,KAAK,GAAS,MACrB,EAAQ,UACN,kBAAC,QAAD;MAEE,WAAU;gBAET,EAAQ;MACJ,EAJA,GAAG,EAAU,GAAG,IAIhB,GAEP,kBAAC,QAAD,EAAA,UACG,EAAQ,QAAQ,KACZ,EAFI,GAAG,EAAU,GAAG,IAEpB,CAEV,EACD,EAjBI,EAiBJ,CACN;KACE,CAAA;IACF,CAAA;GAGN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD,EAAA,UAAA,CAAO,EAAQ,MAAM,KAAK,CAAC,QAAO,SAAa,EAAA,CAAA,EAC/C,kBAAC,QAAD,EAAA,UAAA,EAAQ,EAAK,OAAO,MAAM,QAAQ,EAAE,EAAC,MAAU,EAAA,CAAA,CAC3C;;GACF"}
|
|
@@ -36,7 +36,8 @@ function u({ file: u, url: d }) {
|
|
|
36
36
|
ref: f,
|
|
37
37
|
src: d,
|
|
38
38
|
className: "max-w-full max-h-full",
|
|
39
|
-
onClick: T
|
|
39
|
+
onClick: T,
|
|
40
|
+
children: /* @__PURE__ */ c("track", { kind: "captions" })
|
|
40
41
|
})
|
|
41
42
|
}), /* @__PURE__ */ l("div", {
|
|
42
43
|
className: "bg-bg-surface border-t border-border-default p-4",
|
|
@@ -59,6 +60,7 @@ function u({ file: u, url: d }) {
|
|
|
59
60
|
className: "flex items-center gap-2",
|
|
60
61
|
children: [
|
|
61
62
|
/* @__PURE__ */ c("button", {
|
|
63
|
+
type: "button",
|
|
62
64
|
onClick: T,
|
|
63
65
|
className: "p-2 text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200",
|
|
64
66
|
title: p ? "Pause" : "Play",
|
|
@@ -68,6 +70,7 @@ function u({ file: u, url: d }) {
|
|
|
68
70
|
/* @__PURE__ */ l("div", {
|
|
69
71
|
className: "flex items-center gap-2",
|
|
70
72
|
children: [/* @__PURE__ */ c("button", {
|
|
73
|
+
type: "button",
|
|
71
74
|
onClick: O,
|
|
72
75
|
className: "p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200",
|
|
73
76
|
title: x ? "Unmute" : "Mute",
|
|
@@ -121,6 +124,7 @@ function u({ file: u, url: d }) {
|
|
|
121
124
|
className: "text-sm text-text-secondary",
|
|
122
125
|
children: u.name
|
|
123
126
|
}), /* @__PURE__ */ c("button", {
|
|
127
|
+
type: "button",
|
|
124
128
|
onClick: A,
|
|
125
129
|
className: "p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200",
|
|
126
130
|
title: "Fullscreen",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoPlayer.js","names":[],"sources":["../../../../src/files/components/viewers/VideoPlayer.tsx"],"sourcesContent":["import { useState, useRef, useEffect } from \"react\";\nimport { Play, Pause, Volume2, VolumeX, Maximize } from \"lucide-react\";\nimport type { FileItem } from \"../../types\";\n\ninterface VideoPlayerProps {\n file: FileItem;\n url: string;\n}\n\nexport function VideoPlayer({ file, url }: VideoPlayerProps) {\n const videoRef = useRef<HTMLVideoElement>(null);\n const [isPlaying, setIsPlaying] = useState(false);\n const [currentTime, setCurrentTime] = useState(0);\n const [duration, setDuration] = useState(0);\n const [volume, setVolume] = useState(1);\n const [isMuted, setIsMuted] = useState(false);\n const [playbackRate, setPlaybackRate] = useState(1);\n\n useEffect(() => {\n const video = videoRef.current;\n if (!video) return;\n\n const handleTimeUpdate = () => setCurrentTime(video.currentTime);\n const handleLoadedMetadata = () => setDuration(video.duration);\n const handleEnded = () => setIsPlaying(false);\n\n video.addEventListener(\"timeupdate\", handleTimeUpdate);\n video.addEventListener(\"loadedmetadata\", handleLoadedMetadata);\n video.addEventListener(\"ended\", handleEnded);\n\n return () => {\n video.removeEventListener(\"timeupdate\", handleTimeUpdate);\n video.removeEventListener(\"loadedmetadata\", handleLoadedMetadata);\n video.removeEventListener(\"ended\", handleEnded);\n };\n }, []);\n\n const togglePlay = () => {\n if (videoRef.current) {\n if (isPlaying) {\n videoRef.current.pause();\n } else {\n videoRef.current.play();\n }\n setIsPlaying(!isPlaying);\n }\n };\n\n const handleSeek = (time: number) => {\n if (videoRef.current) {\n videoRef.current.currentTime = time;\n setCurrentTime(time);\n }\n };\n\n const handleVolumeChange = (newVolume: number) => {\n setVolume(newVolume);\n setIsMuted(newVolume === 0);\n if (videoRef.current) {\n videoRef.current.volume = newVolume;\n }\n };\n\n const toggleMute = () => {\n if (videoRef.current) {\n const newMuted = !isMuted;\n setIsMuted(newMuted);\n videoRef.current.muted = newMuted;\n }\n };\n\n const handlePlaybackRateChange = (rate: number) => {\n setPlaybackRate(rate);\n if (videoRef.current) {\n videoRef.current.playbackRate = rate;\n }\n };\n\n const handleFullscreen = () => {\n if (videoRef.current) {\n videoRef.current.requestFullscreen();\n }\n };\n\n const formatTime = (seconds: number): string => {\n const mins = Math.floor(seconds / 60);\n const secs = Math.floor(seconds % 60);\n return `${mins}:${secs.toString().padStart(2, \"0\")}`;\n };\n\n return (\n <div className=\"flex h-full flex-col bg-bg-canvas\">\n {/* Video */}\n <div className=\"flex-1 flex items-center justify-center\">\n <video\n ref={videoRef}\n src={url}\n className=\"max-w-full max-h-full\"\n onClick={togglePlay}\n />\n </div>\n\n {/* Controls */}\n <div className=\"bg-bg-surface border-t border-border-default p-4\">\n {/* Progress Bar */}\n <div className=\"mb-4\">\n <input\n type=\"range\"\n min={0}\n max={duration || 0}\n value={currentTime}\n onChange={(e) => handleSeek(Number(e.target.value))}\n className=\"w-full h-1 bg-bg-muted rounded-lg appearance-none cursor-pointer accent-action-primary-bg\"\n />\n <div className=\"flex justify-between mt-1 text-xs text-text-secondary\">\n <span>{formatTime(currentTime)}</span>\n <span>{formatTime(duration)}</span>\n </div>\n </div>\n\n {/* Control Buttons */}\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n {/* Play/Pause */}\n <button\n onClick={togglePlay}\n className=\"p-2 text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200\"\n title={isPlaying ? \"Pause\" : \"Play\"}\n aria-label={isPlaying ? \"Pause video\" : \"Play video\"}\n >\n {isPlaying ? (\n <Pause className=\"size-5\" />\n ) : (\n <Play className=\"size-5\" />\n )}\n </button>\n\n {/* Volume */}\n <div className=\"flex items-center gap-2\">\n <button\n onClick={toggleMute}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200\"\n title={isMuted ? \"Unmute\" : \"Mute\"}\n aria-label={isMuted ? \"Unmute video\" : \"Mute video\"}\n >\n {isMuted ? (\n <VolumeX className=\"size-5\" />\n ) : (\n <Volume2 className=\"size-5\" />\n )}\n </button>\n <input\n type=\"range\"\n min={0}\n max={1}\n step={0.1}\n value={volume}\n onChange={(e) => handleVolumeChange(Number(e.target.value))}\n className=\"w-20 h-1 bg-bg-muted rounded-lg appearance-none cursor-pointer accent-action-primary-bg\"\n />\n </div>\n\n {/* Playback Speed */}\n <select\n value={playbackRate}\n onChange={(e) => handlePlaybackRateChange(Number(e.target.value))}\n className=\"px-2 py-1 text-sm bg-bg-surface border border-border-default rounded text-text-primary cursor-pointer\"\n >\n <option value=\"0.5\">0.5x</option>\n <option value=\"0.75\">0.75x</option>\n <option value=\"1\">1x</option>\n <option value=\"1.25\">1.25x</option>\n <option value=\"1.5\">1.5x</option>\n <option value=\"2\">2x</option>\n </select>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-text-secondary\">{file.name}</span>\n <button\n onClick={handleFullscreen}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200\"\n title=\"Fullscreen\"\n aria-label=\"Open fullscreen\"\n >\n <Maximize className=\"size-5\" />\n </button>\n </div>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AASA,SAAgB,EAAY,EAAE,SAAM,UAAyB;CAC3D,IAAM,IAAW,EAAyB,KAAK,EACzC,CAAC,GAAW,KAAgB,EAAS,GAAM,EAC3C,CAAC,GAAa,KAAkB,EAAS,EAAE,EAC3C,CAAC,GAAU,KAAe,EAAS,EAAE,EACrC,CAAC,GAAQ,KAAa,EAAS,EAAE,EACjC,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAc,KAAmB,EAAS,EAAE;AAEnD,SAAgB;EACd,IAAM,IAAQ,EAAS;AACvB,MAAI,CAAC,EAAO;EAEZ,IAAM,UAAyB,EAAe,EAAM,YAAY,EAC1D,UAA6B,EAAY,EAAM,SAAS,EACxD,UAAoB,EAAa,GAAM;AAM7C,SAJA,EAAM,iBAAiB,cAAc,EAAiB,EACtD,EAAM,iBAAiB,kBAAkB,EAAqB,EAC9D,EAAM,iBAAiB,SAAS,EAAY,QAE/B;AAGX,GAFA,EAAM,oBAAoB,cAAc,EAAiB,EACzD,EAAM,oBAAoB,kBAAkB,EAAqB,EACjE,EAAM,oBAAoB,SAAS,EAAY;;IAEhD,EAAE,CAAC;CAEN,IAAM,UAAmB;AACvB,EAAI,EAAS,YACP,IACF,EAAS,QAAQ,OAAO,GAExB,EAAS,QAAQ,MAAM,EAEzB,EAAa,CAAC,EAAU;IAItB,KAAc,MAAiB;AACnC,EAAI,EAAS,YACX,EAAS,QAAQ,cAAc,GAC/B,EAAe,EAAK;IAIlB,KAAsB,MAAsB;AAGhD,EAFA,EAAU,EAAU,EACpB,EAAW,MAAc,EAAE,EACvB,EAAS,YACX,EAAS,QAAQ,SAAS;IAIxB,UAAmB;AACvB,MAAI,EAAS,SAAS;GACpB,IAAM,IAAW,CAAC;AAElB,GADA,EAAW,EAAS,EACpB,EAAS,QAAQ,QAAQ;;IAIvB,KAA4B,MAAiB;AAEjD,EADA,EAAgB,EAAK,EACjB,EAAS,YACX,EAAS,QAAQ,eAAe;IAI9B,UAAyB;AAC7B,EAAI,EAAS,WACX,EAAS,QAAQ,mBAAmB;IAIlC,KAAc,MAGX,GAFM,KAAK,MAAM,IAAU,GAAG,CAEtB,GADF,KAAK,MAAM,IAAU,GAAG,CACd,UAAU,CAAC,SAAS,GAAG,IAAI;AAGpD,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CAEE,kBAAC,OAAD;GAAK,WAAU;aACb,kBAAC,SAAD;IACE,KAAK;IACL,KAAK;IACL,WAAU;IACV,SAAS;
|
|
1
|
+
{"version":3,"file":"VideoPlayer.js","names":[],"sources":["../../../../src/files/components/viewers/VideoPlayer.tsx"],"sourcesContent":["import { useState, useRef, useEffect } from \"react\";\nimport { Play, Pause, Volume2, VolumeX, Maximize } from \"lucide-react\";\nimport type { FileItem } from \"../../types\";\n\ninterface VideoPlayerProps {\n file: FileItem;\n url: string;\n}\n\nexport function VideoPlayer({ file, url }: VideoPlayerProps) {\n const videoRef = useRef<HTMLVideoElement>(null);\n const [isPlaying, setIsPlaying] = useState(false);\n const [currentTime, setCurrentTime] = useState(0);\n const [duration, setDuration] = useState(0);\n const [volume, setVolume] = useState(1);\n const [isMuted, setIsMuted] = useState(false);\n const [playbackRate, setPlaybackRate] = useState(1);\n\n useEffect(() => {\n const video = videoRef.current;\n if (!video) return;\n\n const handleTimeUpdate = () => setCurrentTime(video.currentTime);\n const handleLoadedMetadata = () => setDuration(video.duration);\n const handleEnded = () => setIsPlaying(false);\n\n video.addEventListener(\"timeupdate\", handleTimeUpdate);\n video.addEventListener(\"loadedmetadata\", handleLoadedMetadata);\n video.addEventListener(\"ended\", handleEnded);\n\n return () => {\n video.removeEventListener(\"timeupdate\", handleTimeUpdate);\n video.removeEventListener(\"loadedmetadata\", handleLoadedMetadata);\n video.removeEventListener(\"ended\", handleEnded);\n };\n }, []);\n\n const togglePlay = () => {\n if (videoRef.current) {\n if (isPlaying) {\n videoRef.current.pause();\n } else {\n videoRef.current.play();\n }\n setIsPlaying(!isPlaying);\n }\n };\n\n const handleSeek = (time: number) => {\n if (videoRef.current) {\n videoRef.current.currentTime = time;\n setCurrentTime(time);\n }\n };\n\n const handleVolumeChange = (newVolume: number) => {\n setVolume(newVolume);\n setIsMuted(newVolume === 0);\n if (videoRef.current) {\n videoRef.current.volume = newVolume;\n }\n };\n\n const toggleMute = () => {\n if (videoRef.current) {\n const newMuted = !isMuted;\n setIsMuted(newMuted);\n videoRef.current.muted = newMuted;\n }\n };\n\n const handlePlaybackRateChange = (rate: number) => {\n setPlaybackRate(rate);\n if (videoRef.current) {\n videoRef.current.playbackRate = rate;\n }\n };\n\n const handleFullscreen = () => {\n if (videoRef.current) {\n videoRef.current.requestFullscreen();\n }\n };\n\n const formatTime = (seconds: number): string => {\n const mins = Math.floor(seconds / 60);\n const secs = Math.floor(seconds % 60);\n return `${mins}:${secs.toString().padStart(2, \"0\")}`;\n };\n\n return (\n <div className=\"flex h-full flex-col bg-bg-canvas\">\n {/* Video */}\n <div className=\"flex-1 flex items-center justify-center\">\n <video\n ref={videoRef}\n src={url}\n className=\"max-w-full max-h-full\"\n onClick={togglePlay}\n >\n <track kind=\"captions\" />\n </video>\n </div>\n\n {/* Controls */}\n <div className=\"bg-bg-surface border-t border-border-default p-4\">\n {/* Progress Bar */}\n <div className=\"mb-4\">\n <input\n type=\"range\"\n min={0}\n max={duration || 0}\n value={currentTime}\n onChange={(e) => handleSeek(Number(e.target.value))}\n className=\"w-full h-1 bg-bg-muted rounded-lg appearance-none cursor-pointer accent-action-primary-bg\"\n />\n <div className=\"flex justify-between mt-1 text-xs text-text-secondary\">\n <span>{formatTime(currentTime)}</span>\n <span>{formatTime(duration)}</span>\n </div>\n </div>\n\n {/* Control Buttons */}\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n {/* Play/Pause */}\n <button\n type=\"button\"\n onClick={togglePlay}\n className=\"p-2 text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200\"\n title={isPlaying ? \"Pause\" : \"Play\"}\n aria-label={isPlaying ? \"Pause video\" : \"Play video\"}\n >\n {isPlaying ? (\n <Pause className=\"size-5\" />\n ) : (\n <Play className=\"size-5\" />\n )}\n </button>\n\n {/* Volume */}\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={toggleMute}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200\"\n title={isMuted ? \"Unmute\" : \"Mute\"}\n aria-label={isMuted ? \"Unmute video\" : \"Mute video\"}\n >\n {isMuted ? (\n <VolumeX className=\"size-5\" />\n ) : (\n <Volume2 className=\"size-5\" />\n )}\n </button>\n <input\n type=\"range\"\n min={0}\n max={1}\n step={0.1}\n value={volume}\n onChange={(e) => handleVolumeChange(Number(e.target.value))}\n className=\"w-20 h-1 bg-bg-muted rounded-lg appearance-none cursor-pointer accent-action-primary-bg\"\n />\n </div>\n\n {/* Playback Speed */}\n <select\n value={playbackRate}\n onChange={(e) => handlePlaybackRateChange(Number(e.target.value))}\n className=\"px-2 py-1 text-sm bg-bg-surface border border-border-default rounded text-text-primary cursor-pointer\"\n >\n <option value=\"0.5\">0.5x</option>\n <option value=\"0.75\">0.75x</option>\n <option value=\"1\">1x</option>\n <option value=\"1.25\">1.25x</option>\n <option value=\"1.5\">1.5x</option>\n <option value=\"2\">2x</option>\n </select>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-text-secondary\">{file.name}</span>\n <button\n type=\"button\"\n onClick={handleFullscreen}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200\"\n title=\"Fullscreen\"\n aria-label=\"Open fullscreen\"\n >\n <Maximize className=\"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CAAA,EACT,kBAAC,SAAD;QACE,MAAK;QACL,KAAK;QACL,KAAK;QACL,MAAM;QACN,OAAO;QACP,WAAW,MAAM,EAAmB,OAAO,EAAE,OAAO,MAAM,CAAC;QAC3D,WAAU;QACV,CAAA,CACE;;MAGN,kBAAC,UAAD;OACE,OAAO;OACP,WAAW,MAAM,EAAyB,OAAO,EAAE,OAAO,MAAM,CAAC;OACjE,WAAU;iBAHZ;QAKE,kBAAC,UAAD;SAAQ,OAAM;mBAAM;SAAa,CAAA;QACjC,kBAAC,UAAD;SAAQ,OAAM;mBAAO;SAAc,CAAA;QACnC,kBAAC,UAAD;SAAQ,OAAM;mBAAI;SAAW,CAAA;QAC7B,kBAAC,UAAD;SAAQ,OAAM;mBAAO;SAAc,CAAA;QACnC,kBAAC,UAAD;SAAQ,OAAM;mBAAM;SAAa,CAAA;QACjC,kBAAC,UAAD;SAAQ,OAAM;mBAAI;SAAW,CAAA;QACtB;;MACL;QAEN,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,QAAD;MAAM,WAAU;gBAA+B,EAAK;MAAY,CAAA,EAChE,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,WAAU;MACV,OAAM;MACN,cAAW;gBAEX,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA;MACxB,CAAA,CACL;OACF;MACF;KACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBatchOperations.js","names":[],"sources":["../../../src/files/hooks/useBatchOperations.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useBatchOperations.js","names":[],"sources":["../../../src/files/hooks/useBatchOperations.ts"],"sourcesContent":["import { useBulkDeleteFilesMutation } from \"../../generated/wspace-operations\";\n\nexport const useBulkDelete = () => {\n const [bulkDeleteFilesMutation, { loading, error }] =\n useBulkDeleteFilesMutation({\n refetchQueries: [\"GetFiles\", \"GetFolders\", \"GetBinFiles\"],\n });\n\n return {\n mutateAsync: async (ids: string[]) => {\n const result = await bulkDeleteFilesMutation({\n variables: { ids },\n });\n\n return result.data?.bulkDeleteFiles;\n },\n isPending: loading,\n error,\n };\n};\n"],"mappings":";;AAEA,IAAa,UAAsB;CACjC,IAAM,CAAC,GAAyB,EAAE,YAAS,cACzC,EAA2B,EACzB,gBAAgB;EAAC;EAAY;EAAc;EAAc,EAC1D,CAAC;AAEJ,QAAO;EACL,aAAa,OAAO,OACH,MAAM,EAAwB,EAC3C,WAAW,EAAE,QAAK,EACnB,CAAC,EAEY,MAAM;EAEtB,WAAW;EACX;EACD"}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { useCreateFolderMutation as e } from "../../generated/wspace-operations.js";
|
|
2
2
|
//#region src/files/hooks/useCreateFolder.ts
|
|
3
3
|
var t = () => {
|
|
4
|
-
let [t, { loading: n, error: r }] = e({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
let [t, { loading: n, error: r }] = e({
|
|
5
|
+
refetchQueries: [
|
|
6
|
+
"GetFilesRootBrowsePage",
|
|
7
|
+
"GetFilesFolderBrowsePage",
|
|
8
|
+
"GetFilesRecentPage"
|
|
9
|
+
],
|
|
10
|
+
awaitRefetchQueries: !0
|
|
11
|
+
});
|
|
10
12
|
return {
|
|
11
|
-
mutateAsync: async (e) =>
|
|
13
|
+
mutateAsync: async (e) => {
|
|
14
|
+
let n = await t({ variables: { input: e } });
|
|
15
|
+
return {
|
|
16
|
+
data: n.data?.createFolder ?? null,
|
|
17
|
+
error: n.error ?? null
|
|
18
|
+
};
|
|
19
|
+
},
|
|
12
20
|
isPending: n,
|
|
13
21
|
error: r
|
|
14
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateFolder.js","names":[],"sources":["../../../src/files/hooks/useCreateFolder.ts"],"sourcesContent":["import { useCreateFolderMutation } from \"../../generated/wspace-operations\";\n\nexport interface CreateFolderInput {\n name: string;\n description?: string;\n parentFolderId?: string;\n visibility?: string;\n color?: string;\n icon?: string;\n}\n\nexport const useCreateFolder = () => {\n const [createFolderMutation, { loading, error }] = useCreateFolderMutation({\n refetchQueries: [\n \"GetFilesRootBrowsePage\",\n \"GetFilesFolderBrowsePage\",\n \"GetFilesRecentPage\",\n
|
|
1
|
+
{"version":3,"file":"useCreateFolder.js","names":[],"sources":["../../../src/files/hooks/useCreateFolder.ts"],"sourcesContent":["import { useCreateFolderMutation } from \"../../generated/wspace-operations\";\n\nexport interface CreateFolderInput {\n name: string;\n description?: string;\n parentFolderId?: string;\n visibility?: string;\n color?: string;\n icon?: string;\n}\n\nexport const useCreateFolder = () => {\n const [createFolderMutation, { loading, error }] = useCreateFolderMutation({\n refetchQueries: [\n \"GetFilesRootBrowsePage\",\n \"GetFilesFolderBrowsePage\",\n \"GetFilesRecentPage\",\n ],\n awaitRefetchQueries: true,\n });\n\n return {\n mutateAsync: async (input: CreateFolderInput) => {\n const result = await createFolderMutation({\n variables: { input },\n });\n return {\n data: result.data?.createFolder ?? null,\n error: result.error ?? null,\n };\n },\n isPending: loading,\n error,\n };\n};\n"],"mappings":";;AAWA,IAAa,UAAwB;CACnC,IAAM,CAAC,GAAsB,EAAE,YAAS,cAAW,EAAwB;EACzE,gBAAgB;GACd;GACA;GACA;GACD;EACD,qBAAqB;EACtB,CAAC;AAEF,QAAO;EACL,aAAa,OAAO,MAA6B;GAC/C,IAAM,IAAS,MAAM,EAAqB,EACxC,WAAW,EAAE,UAAO,EACrB,CAAC;AACF,UAAO;IACL,MAAM,EAAO,MAAM,gBAAgB;IACnC,OAAO,EAAO,SAAS;IACxB;;EAEH,WAAW;EACX;EACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFileVersions.js","names":[],"sources":["../../../src/files/hooks/useFileVersions.ts"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"file":"useFileVersions.js","names":[],"sources":["../../../src/files/hooks/useFileVersions.ts"],"sourcesContent":["import {\n useDeleteFileVersionMutation,\n useGetFileVersionDownloadUrlLazyQuery,\n useGetFileVersionsQuery,\n useRestoreFileVersionMutation,\n} from \"../../generated/wspace-operations\";\n\nexport const useFileVersions = (_fileId: string, _enabled: boolean = true) => {\n const query = useGetFileVersionsQuery({\n variables: {\n fileId: _fileId,\n pagination: { limit: 50 },\n },\n skip: !_enabled || !_fileId,\n });\n\n return {\n data: query.data?.getFileVersions ?? null,\n isLoading: query.loading,\n error: (query.error as Error | null) ?? null,\n refetch: query.refetch,\n };\n};\n\n/**\n * Hook to restore a previous version\n */\nexport const useRestoreFileVersion = () => {\n const [restoreFileVersionMutation, { loading, error }] =\n useRestoreFileVersionMutation({\n refetchQueries: [\"GetFileVersions\"],\n });\n\n return {\n mutateAsync: async (input: {\n versionId: string;\n createNewVersion?: boolean;\n changeMessage?: string;\n }) => {\n const result = await restoreFileVersionMutation({\n variables: {\n input: {\n versionId: input.versionId,\n createNewVersion: input.createNewVersion,\n changeMessage: input.changeMessage,\n },\n },\n });\n\n return result.data?.restoreFileVersion;\n },\n isPending: loading,\n error,\n };\n};\n\n/**\n * Hook to delete a specific version\n */\nexport const useDeleteFileVersion = () => {\n const [deleteFileVersionMutation, { loading, error }] =\n useDeleteFileVersionMutation({\n refetchQueries: [\"GetFileVersions\"],\n });\n\n return {\n mutateAsync: async (versionId: string) => {\n const result = await deleteFileVersionMutation({\n variables: { versionId },\n });\n\n return result.data?.deleteFileVersion;\n },\n isPending: loading,\n error,\n };\n};\n\n/**\n * Hook to get download URL for a specific version\n */\nexport const useVersionDownloadUrl = (\n _versionId?: string,\n _expiresIn?: number,\n) => {\n const [getDownloadUrl, { data, loading, error }] =\n useGetFileVersionDownloadUrlLazyQuery();\n\n return {\n data: data?.getFileVersionDownloadUrl,\n isLoading: loading,\n error,\n getDownloadUrl: async (versionId = _versionId, expiresIn = _expiresIn) => {\n if (!versionId) {\n return undefined;\n }\n\n const result = await getDownloadUrl({\n variables: { versionId, expiresIn },\n });\n\n return result.data?.getFileVersionDownloadUrl;\n },\n };\n};\n"],"mappings":";;AAOA,IAAa,KAAmB,GAAiB,IAAoB,OAAS;CAC5E,IAAM,IAAQ,EAAwB;EACpC,WAAW;GACT,QAAQ;GACR,YAAY,EAAE,OAAO,IAAI;GAC1B;EACD,MAAM,CAAC,KAAY,CAAC;EACrB,CAAC;AAEF,QAAO;EACL,MAAM,EAAM,MAAM,mBAAmB;EACrC,WAAW,EAAM;EACjB,OAAQ,EAAM,SAA0B;EACxC,SAAS,EAAM;EAChB;GAMU,UAA8B;CACzC,IAAM,CAAC,GAA4B,EAAE,YAAS,cAC5C,EAA8B,EAC5B,gBAAgB,CAAC,kBAAkB,EACpC,CAAC;AAEJ,QAAO;EACL,aAAa,OAAO,OAKH,MAAM,EAA2B,EAC9C,WAAW,EACT,OAAO;GACL,WAAW,EAAM;GACjB,kBAAkB,EAAM;GACxB,eAAe,EAAM;GACtB,EACF,EACF,CAAC,EAEY,MAAM;EAEtB,WAAW;EACX;EACD;GAMU,UAA6B;CACxC,IAAM,CAAC,GAA2B,EAAE,YAAS,cAC3C,EAA6B,EAC3B,gBAAgB,CAAC,kBAAkB,EACpC,CAAC;AAEJ,QAAO;EACL,aAAa,OAAO,OACH,MAAM,EAA0B,EAC7C,WAAW,EAAE,cAAW,EACzB,CAAC,EAEY,MAAM;EAEtB,WAAW;EACX;EACD;GAMU,KACX,GACA,MACG;CACH,IAAM,CAAC,GAAgB,EAAE,SAAM,YAAS,cACtC,GAAuC;AAEzC,QAAO;EACL,MAAM,GAAM;EACZ,WAAW;EACX;EACA,gBAAgB,OAAO,IAAY,GAAY,IAAY,MAAe;AACnE,SAQL,SAJe,MAAM,EAAe,EAClC,WAAW;IAAE;IAAW;IAAW,EACpC,CAAC,EAEY,MAAM;;EAEvB"}
|
|
@@ -4,8 +4,7 @@ var t = () => {
|
|
|
4
4
|
let [t, { loading: n, error: r }] = e({ refetchQueries: [
|
|
5
5
|
"GetFilesRootBrowsePage",
|
|
6
6
|
"GetFilesFolderBrowsePage",
|
|
7
|
-
"GetFilesRecentPage"
|
|
8
|
-
"GetFiles"
|
|
7
|
+
"GetFilesRecentPage"
|
|
9
8
|
] });
|
|
10
9
|
return {
|
|
11
10
|
mutateAsync: async ({ fileId: e, targetFolderId: n }) => (await t({ variables: { input: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMoveFile.js","names":[],"sources":["../../../src/files/hooks/useMoveFile.ts"],"sourcesContent":["import { useMoveFileMutation } from \"../../generated/wspace-operations\";\n\nexport interface MoveFileInput {\n fileId: string;\n targetFolderId: string | null;\n}\n\nexport const useMoveFile = () => {\n const [moveFileMutation, { loading, error }] = useMoveFileMutation({\n refetchQueries: [\n \"GetFilesRootBrowsePage\",\n \"GetFilesFolderBrowsePage\",\n \"GetFilesRecentPage\",\n
|
|
1
|
+
{"version":3,"file":"useMoveFile.js","names":[],"sources":["../../../src/files/hooks/useMoveFile.ts"],"sourcesContent":["import { useMoveFileMutation } from \"../../generated/wspace-operations\";\n\nexport interface MoveFileInput {\n fileId: string;\n targetFolderId: string | null;\n}\n\nexport const useMoveFile = () => {\n const [moveFileMutation, { loading, error }] = useMoveFileMutation({\n refetchQueries: [\n \"GetFilesRootBrowsePage\",\n \"GetFilesFolderBrowsePage\",\n \"GetFilesRecentPage\",\n ],\n });\n\n return {\n mutateAsync: async ({ fileId, targetFolderId }: MoveFileInput) => {\n const result = await moveFileMutation({\n variables: {\n input: {\n fileId,\n targetFolderId,\n },\n },\n });\n return result.data?.moveFile;\n },\n isPending: loading,\n error,\n };\n};\n"],"mappings":";;AAOA,IAAa,UAAoB;CAC/B,IAAM,CAAC,GAAkB,EAAE,YAAS,cAAW,EAAoB,EACjE,gBAAgB;EACd;EACA;EACA;EACD,EACF,CAAC;AAEF,QAAO;EACL,aAAa,OAAO,EAAE,WAAQ,yBACb,MAAM,EAAiB,EACpC,WAAW,EACT,OAAO;GACL;GACA;GACD,EACF,EACF,CAAC,EACY,MAAM;EAEtB,WAAW;EACX;EACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMoveFolder.js","names":[],"sources":["../../../src/files/hooks/useMoveFolder.ts"],"sourcesContent":["import { useMoveFolderMutation } from \"../../generated/wspace-operations\";\n\nexport interface MoveFolderInput {\n folderId: string;\n targetParentFolderId: string | null;\n}\n\nexport const useMoveFolder = () => {\n const [moveFolderMutation, { loading, error }] = useMoveFolderMutation({\n refetchQueries: [\n \"GetFilesRootBrowsePage\",\n \"GetFilesFolderBrowsePage\",\n \"
|
|
1
|
+
{"version":3,"file":"useMoveFolder.js","names":[],"sources":["../../../src/files/hooks/useMoveFolder.ts"],"sourcesContent":["import { useMoveFolderMutation } from \"../../generated/wspace-operations\";\n\nexport interface MoveFolderInput {\n folderId: string;\n targetParentFolderId: string | null;\n}\n\nexport const useMoveFolder = () => {\n const [moveFolderMutation, { loading, error }] = useMoveFolderMutation({\n refetchQueries: [\n \"GetFilesRootBrowsePage\",\n \"GetFilesFolderBrowsePage\",\n \"GetFilesRecentPage\",\n \"GetFolders\",\n ],\n });\n\n return {\n mutateAsync: async ({\n folderId,\n targetParentFolderId,\n }: MoveFolderInput) => {\n const result = await moveFolderMutation({\n variables: {\n input: {\n folderId,\n targetParentFolderId,\n },\n },\n });\n\n return result.data?.moveFolder;\n },\n isPending: loading,\n error,\n };\n};\n"],"mappings":";;AAOA,IAAa,UAAsB;CACjC,IAAM,CAAC,GAAoB,EAAE,YAAS,cAAW,EAAsB,EACrE,gBAAgB;EACd;EACA;EACA;EACA;EACD,EACF,CAAC;AAEF,QAAO;EACL,aAAa,OAAO,EAClB,aACA,+BAEe,MAAM,EAAmB,EACtC,WAAW,EACT,OAAO;GACL;GACA;GACD,EACF,EACF,CAAC,EAEY,MAAM;EAEtB,WAAW;EACX;EACD"}
|
|
@@ -3,13 +3,14 @@ import { useGetFilesStarredPageQuery as e } from "../../generated/wspace-operati
|
|
|
3
3
|
var t = (t) => {
|
|
4
4
|
let n = e({
|
|
5
5
|
variables: { pagination: { limit: 100 } },
|
|
6
|
-
skip: t?.skip
|
|
7
|
-
|
|
6
|
+
skip: t?.skip,
|
|
7
|
+
errorPolicy: "all"
|
|
8
|
+
}), r = (n.error?.message ?? "").includes("FEATURE_DISABLED");
|
|
8
9
|
return {
|
|
9
10
|
files: n.data?.getStarredFiles?.files || [],
|
|
10
11
|
folders: n.data?.getStarredFolders?.folders || [],
|
|
11
12
|
isLoading: n.loading,
|
|
12
|
-
error: n.error ?? null
|
|
13
|
+
error: r ? null : n.error ?? null
|
|
13
14
|
};
|
|
14
15
|
};
|
|
15
16
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStarredItems.js","names":[],"sources":["../../../src/files/hooks/useStarredItems.ts"],"sourcesContent":["/**\n * Starred Items Hook\n *\n * Fetches starred files and folders for the starred view.\n * Uses one page-owned query for both starred files and folders.\n */\n\nimport { useGetFilesStarredPageQuery } from \"../../generated/wspace-operations\";\nimport type { FileItem, FolderItem } from \"../types\";\n\nexport const useStarredItems = (options?: { skip?: boolean }) => {\n const query = useGetFilesStarredPageQuery({\n variables: {\n pagination: { limit: 100 },\n },\n skip: options?.skip,\n });\n\n return {\n files: (query.data?.getStarredFiles?.files || []) as FileItem[],\n folders: (query.data?.getStarredFolders?.folders || []) as FolderItem[],\n isLoading: query.loading,\n error: query.error ?? null,\n };\n};\n"],"mappings":";;AAUA,IAAa,KAAmB,MAAiC;CAC/D,IAAM,IAAQ,EAA4B;EACxC,WAAW,EACT,YAAY,EAAE,OAAO,KAAK,EAC3B;EACD,MAAM,GAAS;
|
|
1
|
+
{"version":3,"file":"useStarredItems.js","names":[],"sources":["../../../src/files/hooks/useStarredItems.ts"],"sourcesContent":["/**\n * Starred Items Hook\n *\n * Fetches starred files and folders for the starred view.\n * Uses one page-owned query for both starred files and folders.\n */\n\nimport { useGetFilesStarredPageQuery } from \"../../generated/wspace-operations\";\nimport type { FileItem, FolderItem } from \"../types\";\n\nexport const useStarredItems = (options?: { skip?: boolean }) => {\n const query = useGetFilesStarredPageQuery({\n variables: {\n pagination: { limit: 100 },\n },\n skip: options?.skip,\n errorPolicy: \"all\",\n });\n\n // ApolloError serialises all graphQL error messages into its top-level\n // message, so checking for the code string is a reliable way to detect\n // FEATURE_DISABLED without depending on Apollo 4's restricted ErrorLike type.\n const isFeatureDisabled = (query.error?.message ?? \"\").includes(\n \"FEATURE_DISABLED\",\n );\n\n return {\n files: (query.data?.getStarredFiles?.files || []) as FileItem[],\n folders: (query.data?.getStarredFolders?.folders || []) as FolderItem[],\n isLoading: query.loading,\n error: isFeatureDisabled ? null : (query.error ?? null),\n };\n};\n"],"mappings":";;AAUA,IAAa,KAAmB,MAAiC;CAC/D,IAAM,IAAQ,EAA4B;EACxC,WAAW,EACT,YAAY,EAAE,OAAO,KAAK,EAC3B;EACD,MAAM,GAAS;EACf,aAAa;EACd,CAAC,EAKI,KAAqB,EAAM,OAAO,WAAW,IAAI,SACrD,mBACD;AAED,QAAO;EACL,OAAQ,EAAM,MAAM,iBAAiB,SAAS,EAAE;EAChD,SAAU,EAAM,MAAM,mBAAmB,WAAW,EAAE;EACtD,WAAW,EAAM;EACjB,OAAO,IAAoB,OAAQ,EAAM,SAAS;EACnD"}
|
|
@@ -2,17 +2,17 @@ import { useToggleFileStarredMutation as e, useToggleFolderStarredMutation as t
|
|
|
2
2
|
//#region src/files/hooks/useToggleStar.ts
|
|
3
3
|
var n = () => {
|
|
4
4
|
let [n, { loading: r, error: i }] = e({ refetchQueries: [
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
5
|
+
"GetFilesRootBrowsePage",
|
|
6
|
+
"GetFilesFolderBrowsePage",
|
|
7
|
+
"GetFilesStarredPage",
|
|
8
|
+
"GetFilesRecentPage",
|
|
9
|
+
"GetFolders"
|
|
10
10
|
] }), [a, { loading: o, error: s }] = t({ refetchQueries: [
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
11
|
+
"GetFilesRootBrowsePage",
|
|
12
|
+
"GetFilesFolderBrowsePage",
|
|
13
|
+
"GetFilesStarredPage",
|
|
14
|
+
"GetFilesRecentPage",
|
|
15
|
+
"GetFolders"
|
|
16
16
|
] });
|
|
17
17
|
return {
|
|
18
18
|
mutateAsync: async ({ id: e, type: t }) => t === "file" ? (await n({ variables: { id: e } })).data?.toggleFileStarred : (await a({ variables: { id: e } })).data?.toggleFolderStarred,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToggleStar.js","names":[],"sources":["../../../src/files/hooks/useToggleStar.ts"],"sourcesContent":["import {\n useToggleFileStarredMutation,\n useToggleFolderStarredMutation,\n} from \"../../generated/wspace-operations\";\n\nexport interface ToggleStarInput {\n id: string;\n type: \"file\" | \"folder\";\n}\n\nexport const useToggleStar = () => {\n const [\n toggleFileStarredMutation,\n { loading: fileLoading, error: fileError },\n ] = useToggleFileStarredMutation({\n refetchQueries: [\n \"
|
|
1
|
+
{"version":3,"file":"useToggleStar.js","names":[],"sources":["../../../src/files/hooks/useToggleStar.ts"],"sourcesContent":["import {\n useToggleFileStarredMutation,\n useToggleFolderStarredMutation,\n} from \"../../generated/wspace-operations\";\n\nexport interface ToggleStarInput {\n id: string;\n type: \"file\" | \"folder\";\n}\n\nexport const useToggleStar = () => {\n const [\n toggleFileStarredMutation,\n { loading: fileLoading, error: fileError },\n ] = useToggleFileStarredMutation({\n refetchQueries: [\n \"GetFilesRootBrowsePage\",\n \"GetFilesFolderBrowsePage\",\n \"GetFilesStarredPage\",\n \"GetFilesRecentPage\",\n \"GetFolders\",\n ],\n });\n\n const [\n toggleFolderStarredMutation,\n { loading: folderLoading, error: folderError },\n ] = useToggleFolderStarredMutation({\n refetchQueries: [\n \"GetFilesRootBrowsePage\",\n \"GetFilesFolderBrowsePage\",\n \"GetFilesStarredPage\",\n \"GetFilesRecentPage\",\n \"GetFolders\",\n ],\n });\n\n return {\n mutateAsync: async ({ id, type }: ToggleStarInput) => {\n if (type === \"file\") {\n const result = await toggleFileStarredMutation({\n variables: { id },\n });\n return result.data?.toggleFileStarred;\n } else {\n const result = await toggleFolderStarredMutation({\n variables: { id },\n });\n return result.data?.toggleFolderStarred;\n }\n },\n isPending: fileLoading || folderLoading,\n error: fileError || folderError,\n };\n};\n"],"mappings":";;AAUA,IAAa,UAAsB;CACjC,IAAM,CACJ,GACA,EAAE,SAAS,GAAa,OAAO,OAC7B,EAA6B,EAC/B,gBAAgB;EACd;EACA;EACA;EACA;EACA;EACD,EACF,CAAC,EAEI,CACJ,GACA,EAAE,SAAS,GAAe,OAAO,OAC/B,EAA+B,EACjC,gBAAgB;EACd;EACA;EACA;EACA;EACA;EACD,EACF,CAAC;AAEF,QAAO;EACL,aAAa,OAAO,EAAE,OAAI,cACpB,MAAS,UACI,MAAM,EAA0B,EAC7C,WAAW,EAAE,OAAI,EAClB,CAAC,EACY,MAAM,qBAEL,MAAM,EAA4B,EAC/C,WAAW,EAAE,OAAI,EAClB,CAAC,EACY,MAAM;EAGxB,WAAW,KAAe;EAC1B,OAAO,KAAa;EACrB"}
|