@powerhousedao/powerhouse-vetra-packages 6.2.0-dev.29 → 6.2.0-dev.30
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/browser/{connect-CahHnhpc.js → connect-CdR7HnG_.js} +60 -60
- package/dist/browser/{connect-CahHnhpc.js.map → connect-CdR7HnG_.js.map} +1 -1
- package/dist/browser/{editor-C4TXNppO.js → editor-Bzkc8cBh.js} +3 -3
- package/dist/browser/{editor-C4TXNppO.js.map → editor-Bzkc8cBh.js.map} +1 -1
- package/dist/browser/{editor-BzhVjRaX.js → editor-CwLkXRMi.js} +2 -2
- package/dist/browser/{editor-BzhVjRaX.js.map → editor-CwLkXRMi.js.map} +1 -1
- package/dist/browser/editors/document-model-editor/module.js +1 -1
- package/dist/browser/editors/generic-drive-explorer/index.js +2 -2
- package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
- package/dist/browser/{folder-view-DOGp5SR5.js → folder-view-SEF40UJw.js} +2 -2
- package/dist/browser/{folder-view-DOGp5SR5.js.map → folder-view-SEF40UJw.js.map} +1 -1
- package/dist/node/{connect-Ciu-R4m2.mjs → connect-C5Fwy1TV.mjs} +49 -49
- package/dist/node/{connect-Ciu-R4m2.mjs.map → connect-C5Fwy1TV.mjs.map} +1 -1
- package/dist/node/{editor-C3Oc-ZR6.mjs → editor-CIR848q-.mjs} +3 -3
- package/dist/node/{editor-C3Oc-ZR6.mjs.map → editor-CIR848q-.mjs.map} +1 -1
- package/dist/node/{editor-DDMLyH-3.mjs → editor-DmB3aE4K.mjs} +2 -2
- package/dist/node/{editor-DDMLyH-3.mjs.map → editor-DmB3aE4K.mjs.map} +1 -1
- package/dist/node/editors/document-model-editor/module.mjs +1 -1
- package/dist/node/editors/generic-drive-explorer/index.mjs +2 -2
- package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
- package/dist/node/{folder-view-BKWxyvOU.mjs → folder-view-OzKx5KyJ.mjs} +2 -2
- package/dist/node/{folder-view-BKWxyvOU.mjs.map → folder-view-OzKx5KyJ.mjs.map} +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as FolderItem, h as useWindowSize, i as FileItem, m as PowerhouseButton, o as useVirtualizer } from "./connect-
|
|
1
|
+
import { a as FolderItem, h as useWindowSize, i as FileItem, m as PowerhouseButton, o as useVirtualizer } from "./connect-C5Fwy1TV.mjs";
|
|
2
2
|
import { C as twMerge } from "./dist-BeZaEP6S.mjs";
|
|
3
3
|
import { O as useUserPermissions, i as isFolderNodeKind, r as isFileNodeKind, s as showCreateDocumentModal, u as useDocumentModelModules, v as useNodesInSelectedDriveOrFolder } from "./dist-BCpGdShB.mjs";
|
|
4
4
|
import React, { useRef } from "react";
|
|
@@ -190,4 +190,4 @@ function FolderView(props) {
|
|
|
190
190
|
//#endregion
|
|
191
191
|
export { CreateDocument as i, DriveLayout as n, FileContentView as r, FolderView as t };
|
|
192
192
|
|
|
193
|
-
//# sourceMappingURL=folder-view-
|
|
193
|
+
//# sourceMappingURL=folder-view-OzKx5KyJ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder-view-BKWxyvOU.mjs","names":[],"sources":["../../editors/generic-drive-explorer/components/create-document.tsx","../../editors/generic-drive-explorer/components/file-content-view.tsx","../../editors/generic-drive-explorer/components/layout.tsx","../../editors/generic-drive-explorer/components/folder-view.tsx"],"sourcesContent":["import { PowerhouseButton } from \"@powerhousedao/design-system\";\nimport {\n showCreateDocumentModal,\n useDocumentModelModules,\n useUserPermissions,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n DocumentModelGlobalState,\n DocumentModelModule,\n} from \"@powerhousedao/shared/document-model\";\n\nfunction getDocumentSpec(doc: DocumentModelModule): DocumentModelGlobalState {\n return doc.documentModel.global;\n}\n\nexport function CreateDocument() {\n const { isAllowedToCreateDocuments } = useUserPermissions();\n const documentModelModules = useDocumentModelModules();\n const nonDriveDocumentModelModules = documentModelModules?.filter(\n (module) => module.documentModel.global.id !== \"powerhouse/document-drive\",\n );\n if (!isAllowedToCreateDocuments) return null;\n return (\n <div className=\"px-6 py-4\">\n <h3 className=\"mb-3 text-xl font-bold text-foreground\">New document</h3>\n <div className=\"flex w-full flex-wrap gap-4\">\n {nonDriveDocumentModelModules?.map((doc) => {\n const spec = getDocumentSpec(doc);\n const versionLabel = doc.version ? ` v${doc.version}` : \"\";\n return (\n <PowerhouseButton\n key={`${spec.id}-v${doc.version ?? 1}`}\n color=\"light\"\n title={`${spec.name}${versionLabel}`}\n aria-description={spec.description}\n onClick={() => showCreateDocumentModal(spec.id)}\n >\n <span className=\"text-sm\">\n {spec.name}\n {versionLabel}\n </span>\n </PowerhouseButton>\n );\n })}\n </div>\n </div>\n );\n}\n","import { useWindowSize } from \"@powerhousedao/design-system\";\nimport { FileItem } from \"@powerhousedao/design-system/connect\";\nimport {\n isFileNodeKind,\n useNodesInSelectedDriveOrFolder,\n} from \"@powerhousedao/reactor-browser\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport type { FileNode } from \"@powerhousedao/shared/document-drive\";\nimport React, { useRef } from \"react\";\n\nconst GAP = 8;\nconst ITEM_WIDTH = 256;\nconst ITEM_HEIGHT = 48;\n\nconst USED_SPACE = 420;\n\nexport function FileContentView() {\n const parentRef = useRef(null);\n const windowSize = useWindowSize();\n const availableWidth = windowSize.innerWidth - USED_SPACE;\n const nodes = useNodesInSelectedDriveOrFolder();\n const fileNodes = nodes.filter((n) => isFileNodeKind(n));\n const columnCount = Math.floor(availableWidth / (ITEM_WIDTH + GAP)) || 1;\n const rowCount = Math.ceil(fileNodes.length / columnCount);\n\n const rowVirtualizer = useVirtualizer({\n count: rowCount,\n getScrollElement: () => parentRef.current,\n estimateSize: (index) => {\n if (index > 0) {\n return ITEM_HEIGHT + GAP;\n }\n return ITEM_HEIGHT;\n },\n overscan: 5,\n });\n\n const columnVirtualizer = useVirtualizer({\n horizontal: true,\n count: columnCount,\n getScrollElement: () => parentRef.current,\n estimateSize: (index) => {\n if (index > 0) {\n return ITEM_WIDTH + GAP;\n }\n return ITEM_WIDTH;\n },\n overscan: 5,\n });\n\n const getItemIndex = (rowIndex: number, columnIndex: number) =>\n rowIndex * columnCount + columnIndex;\n\n const getItem = (rowIndex: number, columnIndex: number): FileNode | null => {\n const index = getItemIndex(rowIndex, columnIndex);\n return fileNodes[index] || null;\n };\n\n if (fileNodes.length === 0) {\n return (\n <div className=\"mb-8 text-sm text-muted-foreground\">\n No documents or files 📄\n </div>\n );\n }\n\n const renderItem = (rowIndex: number, columnIndex: number) => {\n const fileNode = getItem(rowIndex, columnIndex);\n\n if (!fileNode) {\n return null;\n }\n\n return (\n <div\n style={{\n marginLeft: columnIndex === 0 ? 0 : GAP,\n }}\n >\n <FileItem key={fileNode.id} fileNode={fileNode} />\n </div>\n );\n };\n\n return (\n <div\n ref={parentRef}\n style={{\n width: `100%`,\n overflow: \"auto\",\n }}\n >\n <div\n style={{\n height: `${rowVirtualizer.getTotalSize()}px`,\n width: `${columnVirtualizer.getTotalSize()}px`,\n position: \"relative\",\n }}\n >\n {rowVirtualizer.getVirtualItems().map((virtualRow) => (\n <React.Fragment key={virtualRow.key}>\n {columnVirtualizer.getVirtualItems().map((virtualColumn) => (\n <div\n key={virtualColumn.key}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n marginTop: virtualRow.index === 0 ? 0 : GAP,\n width: `${virtualColumn.size}px`,\n height: `${ITEM_HEIGHT}px`,\n overflow: \"hidden\",\n transform: `translateX(${virtualColumn.start}px) translateY(${virtualRow.start}px)`,\n }}\n >\n {renderItem(virtualRow.index, virtualColumn.index)}\n </div>\n ))}\n </React.Fragment>\n ))}\n </div>\n </div>\n );\n}\n","import { twMerge } from \"tailwind-merge\";\nimport type { BaseProps } from \"../utils/types.js\";\n\nexport function DriveLayout({ children, className, ...props }: BaseProps) {\n return (\n <DriveLayout.Container className={className} {...props}>\n {children}\n </DriveLayout.Container>\n );\n}\n\nDriveLayout.Container = function DriveLayoutContainer({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div\n className={twMerge(\"flex grow flex-col overflow-auto\", className)}\n {...containerProps}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nDriveLayout.Header = function DriveLayoutHeader({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div\n className={twMerge(\"flex-0\", className)}\n {...containerProps}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nDriveLayout.Content = function DriveLayoutContent({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div\n className={twMerge(\"mb-5 flex-1 px-4\", className)}\n {...containerProps}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nDriveLayout.ContentSection = function DriveLayoutContentSection({\n title,\n children,\n className,\n containerProps,\n ...props\n}: BaseProps & { title?: string }) {\n return (\n <div className={twMerge(className)} {...containerProps} {...props}>\n {title && (\n <div className=\"mb-4 text-base font-semibold text-foreground\">\n {title}\n </div>\n )}\n <div className=\"flex flex-wrap gap-2\">{children}</div>\n </div>\n );\n};\n\nDriveLayout.Footer = function DriveLayoutFooter({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div\n className={twMerge(\"flex-0\", className)}\n {...containerProps}\n {...props}\n >\n {children}\n </div>\n );\n};\n","import { FolderItem } from \"@powerhousedao/design-system/connect\";\nimport {\n isFolderNodeKind,\n useNodesInSelectedDriveOrFolder,\n} from \"@powerhousedao/reactor-browser\";\nimport { twMerge } from \"tailwind-merge\";\nimport { FileContentView } from \"./file-content-view.js\";\nimport { DriveLayout } from \"./layout.js\";\n\nexport function FolderView(props: { className?: string }) {\n const { className } = props;\n const nodes = useNodesInSelectedDriveOrFolder();\n const folderNodes = nodes.filter((n) => isFolderNodeKind(n));\n return (\n <div\n className={twMerge(\n \"rounded-md border-2 border-transparent p-2\",\n className,\n )}\n >\n <DriveLayout.ContentSection title=\"Folders\" className=\"mb-4\">\n {folderNodes.length > 0 ? (\n folderNodes.map((folderNode) => (\n <FolderItem key={folderNode.id} folderNode={folderNode} />\n ))\n ) : (\n <div className=\"mb-8 text-sm text-muted-foreground\">\n No documents or files 📄\n </div>\n )}\n </DriveLayout.ContentSection>\n <DriveLayout.ContentSection title=\"Documents and files\">\n <div className=\"w-full\">\n <FileContentView />\n </div>\n </DriveLayout.ContentSection>\n </div>\n );\n}\n\nexport default FolderView;\n"],"mappings":";;;;;;AAWA,SAAS,gBAAgB,KAAoD;AAC3E,QAAO,IAAI,cAAc;;AAG3B,SAAgB,iBAAiB;CAC/B,MAAM,EAAE,+BAA+B,oBAAoB;CAE3D,MAAM,+BADuB,yBAAyB,EACK,QACxD,WAAW,OAAO,cAAc,OAAO,OAAO,4BAChD;AACD,KAAI,CAAC,2BAA4B,QAAO;AACxC,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,MAAD;GAAI,WAAU;aAAyC;GAAiB,CAAA,EACxE,oBAAC,OAAD;GAAK,WAAU;aACZ,8BAA8B,KAAK,QAAQ;IAC1C,MAAM,OAAO,gBAAgB,IAAI;IACjC,MAAM,eAAe,IAAI,UAAU,KAAK,IAAI,YAAY;AACxD,WACE,oBAAC,kBAAD;KAEE,OAAM;KACN,OAAO,GAAG,KAAK,OAAO;KACtB,oBAAkB,KAAK;KACvB,eAAe,wBAAwB,KAAK,GAAG;eAE/C,qBAAC,QAAD;MAAM,WAAU;gBAAhB,CACG,KAAK,MACL,aACI;;KACU,EAVZ,GAAG,KAAK,GAAG,IAAI,IAAI,WAAW,IAUlB;KAErB;GACE,CAAA,CACF;;;;;ACnCV,MAAM,MAAM;AACZ,MAAM,aAAa;AACnB,MAAM,cAAc;AAEpB,MAAM,aAAa;AAEnB,SAAgB,kBAAkB;CAChC,MAAM,YAAY,OAAO,KAAK;CAE9B,MAAM,iBADa,eAAe,CACA,aAAa;CAE/C,MAAM,YADQ,iCAAiC,CACvB,QAAQ,MAAM,eAAe,EAAE,CAAC;CACxD,MAAM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U,UAAU;EACvC,GAAI;EACJ,GAAI;EAEH;EACG,CAAA;;;;ACrFV,SAAgB,WAAW,OAA+B;CACxD,MAAM,EAAE,cAAc;CAEtB,MAAM,cADQ,iCAAiC,CACrB,QAAQ,MAAM,iBAAiB,EAAE,CAAC;AAC5D,QACE,qBAAC,OAAD;EACE,WAAW,QACT,8CACA,UACD;YAJH,CAME,oBAAC,YAAY,gBAAb;GAA4B,OAAM;GAAU,WAAU;aACnD,YAAY,SAAS,IACpB,YAAY,KAAK,eACf,oBAAC,YAAD,EAA4C,YAAc,EAAzC,WAAW,GAA8B,CAC1D,GAEF,oBAAC,OAAD;IAAK,WAAU;cAAqC;IAE9C,CAAA;GAEmB,CAAA,EAC7B,oBAAC,YAAY,gBAAb;GAA4B,OAAM;aAChC,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,iBAAD,EAAmB,CAAA;IACf,CAAA;GACqB,CAAA,CACzB"}
|
|
1
|
+
{"version":3,"file":"folder-view-OzKx5KyJ.mjs","names":[],"sources":["../../editors/generic-drive-explorer/components/create-document.tsx","../../editors/generic-drive-explorer/components/file-content-view.tsx","../../editors/generic-drive-explorer/components/layout.tsx","../../editors/generic-drive-explorer/components/folder-view.tsx"],"sourcesContent":["import { PowerhouseButton } from \"@powerhousedao/design-system\";\nimport {\n showCreateDocumentModal,\n useDocumentModelModules,\n useUserPermissions,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n DocumentModelGlobalState,\n DocumentModelModule,\n} from \"@powerhousedao/shared/document-model\";\n\nfunction getDocumentSpec(doc: DocumentModelModule): DocumentModelGlobalState {\n return doc.documentModel.global;\n}\n\nexport function CreateDocument() {\n const { isAllowedToCreateDocuments } = useUserPermissions();\n const documentModelModules = useDocumentModelModules();\n const nonDriveDocumentModelModules = documentModelModules?.filter(\n (module) => module.documentModel.global.id !== \"powerhouse/document-drive\",\n );\n if (!isAllowedToCreateDocuments) return null;\n return (\n <div className=\"px-6 py-4\">\n <h3 className=\"mb-3 text-xl font-bold text-foreground\">New document</h3>\n <div className=\"flex w-full flex-wrap gap-4\">\n {nonDriveDocumentModelModules?.map((doc) => {\n const spec = getDocumentSpec(doc);\n const versionLabel = doc.version ? ` v${doc.version}` : \"\";\n return (\n <PowerhouseButton\n key={`${spec.id}-v${doc.version ?? 1}`}\n color=\"light\"\n title={`${spec.name}${versionLabel}`}\n aria-description={spec.description}\n onClick={() => showCreateDocumentModal(spec.id)}\n >\n <span className=\"text-sm\">\n {spec.name}\n {versionLabel}\n </span>\n </PowerhouseButton>\n );\n })}\n </div>\n </div>\n );\n}\n","import { useWindowSize } from \"@powerhousedao/design-system\";\nimport { FileItem } from \"@powerhousedao/design-system/connect\";\nimport {\n isFileNodeKind,\n useNodesInSelectedDriveOrFolder,\n} from \"@powerhousedao/reactor-browser\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport type { FileNode } from \"@powerhousedao/shared/document-drive\";\nimport React, { useRef } from \"react\";\n\nconst GAP = 8;\nconst ITEM_WIDTH = 256;\nconst ITEM_HEIGHT = 48;\n\nconst USED_SPACE = 420;\n\nexport function FileContentView() {\n const parentRef = useRef(null);\n const windowSize = useWindowSize();\n const availableWidth = windowSize.innerWidth - USED_SPACE;\n const nodes = useNodesInSelectedDriveOrFolder();\n const fileNodes = nodes.filter((n) => isFileNodeKind(n));\n const columnCount = Math.floor(availableWidth / (ITEM_WIDTH + GAP)) || 1;\n const rowCount = Math.ceil(fileNodes.length / columnCount);\n\n const rowVirtualizer = useVirtualizer({\n count: rowCount,\n getScrollElement: () => parentRef.current,\n estimateSize: (index) => {\n if (index > 0) {\n return ITEM_HEIGHT + GAP;\n }\n return ITEM_HEIGHT;\n },\n overscan: 5,\n });\n\n const columnVirtualizer = useVirtualizer({\n horizontal: true,\n count: columnCount,\n getScrollElement: () => parentRef.current,\n estimateSize: (index) => {\n if (index > 0) {\n return ITEM_WIDTH + GAP;\n }\n return ITEM_WIDTH;\n },\n overscan: 5,\n });\n\n const getItemIndex = (rowIndex: number, columnIndex: number) =>\n rowIndex * columnCount + columnIndex;\n\n const getItem = (rowIndex: number, columnIndex: number): FileNode | null => {\n const index = getItemIndex(rowIndex, columnIndex);\n return fileNodes[index] || null;\n };\n\n if (fileNodes.length === 0) {\n return (\n <div className=\"mb-8 text-sm text-muted-foreground\">\n No documents or files 📄\n </div>\n );\n }\n\n const renderItem = (rowIndex: number, columnIndex: number) => {\n const fileNode = getItem(rowIndex, columnIndex);\n\n if (!fileNode) {\n return null;\n }\n\n return (\n <div\n style={{\n marginLeft: columnIndex === 0 ? 0 : GAP,\n }}\n >\n <FileItem key={fileNode.id} fileNode={fileNode} />\n </div>\n );\n };\n\n return (\n <div\n ref={parentRef}\n style={{\n width: `100%`,\n overflow: \"auto\",\n }}\n >\n <div\n style={{\n height: `${rowVirtualizer.getTotalSize()}px`,\n width: `${columnVirtualizer.getTotalSize()}px`,\n position: \"relative\",\n }}\n >\n {rowVirtualizer.getVirtualItems().map((virtualRow) => (\n <React.Fragment key={virtualRow.key}>\n {columnVirtualizer.getVirtualItems().map((virtualColumn) => (\n <div\n key={virtualColumn.key}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n marginTop: virtualRow.index === 0 ? 0 : GAP,\n width: `${virtualColumn.size}px`,\n height: `${ITEM_HEIGHT}px`,\n overflow: \"hidden\",\n transform: `translateX(${virtualColumn.start}px) translateY(${virtualRow.start}px)`,\n }}\n >\n {renderItem(virtualRow.index, virtualColumn.index)}\n </div>\n ))}\n </React.Fragment>\n ))}\n </div>\n </div>\n );\n}\n","import { twMerge } from \"tailwind-merge\";\nimport type { BaseProps } from \"../utils/types.js\";\n\nexport function DriveLayout({ children, className, ...props }: BaseProps) {\n return (\n <DriveLayout.Container className={className} {...props}>\n {children}\n </DriveLayout.Container>\n );\n}\n\nDriveLayout.Container = function DriveLayoutContainer({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div\n className={twMerge(\"flex grow flex-col overflow-auto\", className)}\n {...containerProps}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nDriveLayout.Header = function DriveLayoutHeader({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div\n className={twMerge(\"flex-0\", className)}\n {...containerProps}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nDriveLayout.Content = function DriveLayoutContent({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div\n className={twMerge(\"mb-5 flex-1 px-4\", className)}\n {...containerProps}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nDriveLayout.ContentSection = function DriveLayoutContentSection({\n title,\n children,\n className,\n containerProps,\n ...props\n}: BaseProps & { title?: string }) {\n return (\n <div className={twMerge(className)} {...containerProps} {...props}>\n {title && (\n <div className=\"mb-4 text-base font-semibold text-foreground\">\n {title}\n </div>\n )}\n <div className=\"flex flex-wrap gap-2\">{children}</div>\n </div>\n );\n};\n\nDriveLayout.Footer = function DriveLayoutFooter({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div\n className={twMerge(\"flex-0\", className)}\n {...containerProps}\n {...props}\n >\n {children}\n </div>\n );\n};\n","import { FolderItem } from \"@powerhousedao/design-system/connect\";\nimport {\n isFolderNodeKind,\n useNodesInSelectedDriveOrFolder,\n} from \"@powerhousedao/reactor-browser\";\nimport { twMerge } from \"tailwind-merge\";\nimport { FileContentView } from \"./file-content-view.js\";\nimport { DriveLayout } from \"./layout.js\";\n\nexport function FolderView(props: { className?: string }) {\n const { className } = props;\n const nodes = useNodesInSelectedDriveOrFolder();\n const folderNodes = nodes.filter((n) => isFolderNodeKind(n));\n return (\n <div\n className={twMerge(\n \"rounded-md border-2 border-transparent p-2\",\n className,\n )}\n >\n <DriveLayout.ContentSection title=\"Folders\" className=\"mb-4\">\n {folderNodes.length > 0 ? (\n folderNodes.map((folderNode) => (\n <FolderItem key={folderNode.id} folderNode={folderNode} />\n ))\n ) : (\n <div className=\"mb-8 text-sm text-muted-foreground\">\n No documents or files 📄\n </div>\n )}\n </DriveLayout.ContentSection>\n <DriveLayout.ContentSection title=\"Documents and files\">\n <div className=\"w-full\">\n <FileContentView />\n </div>\n </DriveLayout.ContentSection>\n </div>\n );\n}\n\nexport default FolderView;\n"],"mappings":";;;;;;AAWA,SAAS,gBAAgB,KAAoD;AAC3E,QAAO,IAAI,cAAc;;AAG3B,SAAgB,iBAAiB;CAC/B,MAAM,EAAE,+BAA+B,oBAAoB;CAE3D,MAAM,+BADuB,yBAAyB,EACK,QACxD,WAAW,OAAO,cAAc,OAAO,OAAO,4BAChD;AACD,KAAI,CAAC,2BAA4B,QAAO;AACxC,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,MAAD;GAAI,WAAU;aAAyC;GAAiB,CAAA,EACxE,oBAAC,OAAD;GAAK,WAAU;aACZ,8BAA8B,KAAK,QAAQ;IAC1C,MAAM,OAAO,gBAAgB,IAAI;IACjC,MAAM,eAAe,IAAI,UAAU,KAAK,IAAI,YAAY;AACxD,WACE,oBAAC,kBAAD;KAEE,OAAM;KACN,OAAO,GAAG,KAAK,OAAO;KACtB,oBAAkB,KAAK;KACvB,eAAe,wBAAwB,KAAK,GAAG;eAE/C,qBAAC,QAAD;MAAM,WAAU;gBAAhB,CACG,KAAK,MACL,aACI;;KACU,EAVZ,GAAG,KAAK,GAAG,IAAI,IAAI,WAAW,IAUlB;KAErB;GACE,CAAA,CACF;;;;;ACnCV,MAAM,MAAM;AACZ,MAAM,aAAa;AACnB,MAAM,cAAc;AAEpB,MAAM,aAAa;AAEnB,SAAgB,kBAAkB;CAChC,MAAM,YAAY,OAAO,KAAK;CAE9B,MAAM,iBADa,eAAe,CACA,aAAa;CAE/C,MAAM,YADQ,iCAAiC,CACvB,QAAQ,MAAM,eAAe,EAAE,CAAC;CACxD,MAAM,cAAc,KAAK,MAAM,kBAAkB,aAAa,KAAK,IAAI;CAGvE,MAAM,iBAAiB,eAAe;EACpC,OAHe,KAAK,KAAK,UAAU,SAAS,YAAY;EAIxD,wBAAw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iC,CACrB,QAAQ,MAAM,iBAAiB,EAAE,CAAC;AAC5D,QACE,qBAAC,OAAD;EACE,WAAW,QACT,8CACA,UACD;YAJH,CAME,oBAAC,YAAY,gBAAb;GAA4B,OAAM;GAAU,WAAU;aACnD,YAAY,SAAS,IACpB,YAAY,KAAK,eACf,oBAAC,YAAD,EAA4C,YAAc,EAAzC,WAAW,GAA8B,CAC1D,GAEF,oBAAC,OAAD;IAAK,WAAU;cAAqC;IAE9C,CAAA;GAEmB,CAAA,EAC7B,oBAAC,YAAY,gBAAb;GAA4B,OAAM;aAChC,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,iBAAD,EAAmB,CAAA;IACf,CAAA;GACqB,CAAA,CACzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/powerhouse-vetra-packages",
|
|
3
|
-
"version": "6.2.0-dev.
|
|
3
|
+
"version": "6.2.0-dev.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
"tsdown": "0.21.1",
|
|
106
106
|
"tsx": "4.21.0",
|
|
107
107
|
"zod": "4.3.6",
|
|
108
|
-
"@powerhousedao/
|
|
109
|
-
"@powerhousedao/
|
|
110
|
-
"@powerhousedao/reactor-drive": "6.2.0-dev.
|
|
111
|
-
"@powerhousedao/shared": "6.2.0-dev.
|
|
112
|
-
"document-model": "6.2.0-dev.
|
|
108
|
+
"@powerhousedao/design-system": "6.2.0-dev.30",
|
|
109
|
+
"@powerhousedao/reactor-browser": "6.2.0-dev.30",
|
|
110
|
+
"@powerhousedao/reactor-drive": "6.2.0-dev.30",
|
|
111
|
+
"@powerhousedao/shared": "6.2.0-dev.30",
|
|
112
|
+
"document-model": "6.2.0-dev.30"
|
|
113
113
|
},
|
|
114
114
|
"scripts": {
|
|
115
115
|
"tsc": "tsc",
|