@dxos/plugin-wnfs 0.7.5-main.9d26e3a → 0.7.5-main.b19bfc8
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/lib/browser/FileContainer-JP3ZCHVO.mjs +94 -0
- package/dist/lib/browser/FileContainer-JP3ZCHVO.mjs.map +7 -0
- package/dist/lib/browser/blockstore-55OY65BY.mjs +191 -0
- package/dist/lib/browser/blockstore-55OY65BY.mjs.map +7 -0
- package/dist/lib/browser/chunk-3ERFJ7W2.mjs +16 -0
- package/dist/lib/browser/chunk-3ERFJ7W2.mjs.map +7 -0
- package/dist/lib/browser/chunk-EELFT4QP.mjs +15 -0
- package/dist/lib/browser/chunk-EELFT4QP.mjs.map +7 -0
- package/dist/lib/browser/chunk-KFKLBRAQ.mjs +16 -0
- package/dist/lib/browser/chunk-KFKLBRAQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-RYOWC7TX.mjs +60 -0
- package/dist/lib/browser/chunk-RYOWC7TX.mjs.map +7 -0
- package/dist/lib/browser/chunk-SCQWJNHD.mjs +157 -0
- package/dist/lib/browser/chunk-SCQWJNHD.mjs.map +7 -0
- package/dist/lib/browser/file-uploader-3DF5T3EZ.mjs +29 -0
- package/dist/lib/browser/file-uploader-3DF5T3EZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +99 -486
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-6IX7MROZ.mjs +49 -0
- package/dist/lib/browser/intent-resolver-6IX7MROZ.mjs.map +7 -0
- package/dist/lib/browser/markdown-MGMT4KWF.mjs +198 -0
- package/dist/lib/browser/markdown-MGMT4KWF.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-DPJ6WGOE.mjs +81 -0
- package/dist/lib/browser/react-surface-DPJ6WGOE.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/types/src/WnfsPlugin.d.ts +1 -3
- package/dist/types/src/WnfsPlugin.d.ts.map +1 -1
- package/dist/types/src/blockstore.d.ts +4 -1
- package/dist/types/src/blockstore.d.ts.map +1 -1
- package/dist/types/src/capabilities/blockstore.d.ts +4 -0
- package/dist/types/src/capabilities/blockstore.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +12 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/file-uploader.d.ts +4 -0
- package/dist/types/src/capabilities/file-uploader.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown.d.ts +4 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/FileContainer.d.ts +7 -0
- package/dist/types/src/components/FileContainer.d.ts.map +1 -0
- package/dist/types/src/components/FileInput.d.ts +7 -0
- package/dist/types/src/components/FileInput.d.ts.map +1 -0
- package/dist/types/src/components/FilePreview.d.ts +1 -2
- package/dist/types/src/components/FilePreview.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -11
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/extensions/image.d.ts +5 -0
- package/dist/types/src/extensions/image.d.ts.map +1 -1
- package/dist/types/src/extensions/image.stories.d.ts +2 -3
- package/dist/types/src/extensions/image.stories.d.ts.map +1 -1
- package/dist/types/src/helpers/common.d.ts.map +1 -0
- package/dist/types/src/helpers/index.d.ts +5 -0
- package/dist/types/src/helpers/index.d.ts.map +1 -0
- package/dist/types/src/helpers/load.d.ts +13 -0
- package/dist/types/src/helpers/load.d.ts.map +1 -0
- package/dist/types/src/helpers/upload.d.ts +15 -0
- package/dist/types/src/helpers/upload.d.ts.map +1 -0
- package/dist/types/src/helpers/wnfs-url.d.ts +11 -0
- package/dist/types/src/helpers/wnfs-url.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +15 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/file.d.ts +5 -7
- package/dist/types/src/types/file.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +49 -6
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +29 -26
- package/src/WnfsPlugin.tsx +83 -85
- package/src/blockstore.ts +143 -21
- package/src/capabilities/blockstore.ts +18 -0
- package/src/capabilities/capabilities.ts +18 -0
- package/src/capabilities/file-uploader.ts +24 -0
- package/src/capabilities/index.ts +13 -0
- package/src/capabilities/intent-resolver.ts +32 -0
- package/src/capabilities/markdown.ts +25 -0
- package/src/capabilities/react-surface.tsx +41 -0
- package/src/components/FileContainer.tsx +46 -0
- package/src/components/FileInput.tsx +46 -0
- package/src/components/index.ts +3 -5
- package/src/extensions/image.stories.tsx +26 -68
- package/src/extensions/image.tsx +203 -0
- package/src/{common.ts → helpers/common.ts} +1 -1
- package/src/helpers/index.ts +8 -0
- package/src/{load.ts → helpers/load.ts} +38 -9
- package/src/{upload.ts → helpers/upload.ts} +18 -4
- package/src/helpers/wnfs-url.ts +36 -0
- package/src/index.ts +2 -4
- package/src/meta.ts +2 -3
- package/src/translations.ts +5 -0
- package/src/types/file.ts +2 -3
- package/src/types/types.ts +30 -19
- package/dist/lib/browser/FileCard-HJIZDWJF.mjs +0 -39
- package/dist/lib/browser/FileCard-HJIZDWJF.mjs.map +0 -7
- package/dist/lib/browser/FileMain-WEWTX7QB.mjs +0 -27
- package/dist/lib/browser/FileMain-WEWTX7QB.mjs.map +0 -7
- package/dist/lib/browser/FileSection-BEUGJ7EI.mjs +0 -24
- package/dist/lib/browser/FileSection-BEUGJ7EI.mjs.map +0 -7
- package/dist/lib/browser/FileSlide-NYBGZEZS.mjs +0 -21
- package/dist/lib/browser/FileSlide-NYBGZEZS.mjs.map +0 -7
- package/dist/lib/browser/chunk-2I63TM7M.mjs +0 -27
- package/dist/lib/browser/chunk-2I63TM7M.mjs.map +0 -7
- package/dist/lib/browser/chunk-JDSKIDDR.mjs +0 -30
- package/dist/lib/browser/chunk-JDSKIDDR.mjs.map +0 -7
- package/dist/lib/browser/chunk-VL3H7P4F.mjs +0 -18
- package/dist/lib/browser/chunk-VL3H7P4F.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/types/src/common.d.ts.map +0 -1
- package/dist/types/src/components/FileCard.d.ts +0 -9
- package/dist/types/src/components/FileCard.d.ts.map +0 -1
- package/dist/types/src/components/FileMain.d.ts +0 -7
- package/dist/types/src/components/FileMain.d.ts.map +0 -1
- package/dist/types/src/components/FileSection.d.ts +0 -8
- package/dist/types/src/components/FileSection.d.ts.map +0 -1
- package/dist/types/src/components/FileSlide.d.ts +0 -8
- package/dist/types/src/components/FileSlide.d.ts.map +0 -1
- package/dist/types/src/load.d.ts +0 -8
- package/dist/types/src/load.d.ts.map +0 -1
- package/dist/types/src/upload.d.ts +0 -10
- package/dist/types/src/upload.d.ts.map +0 -1
- package/dist/types/src/wnfs-url.d.ts +0 -2
- package/dist/types/src/wnfs-url.d.ts.map +0 -1
- package/src/components/FileCard.tsx +0 -45
- package/src/components/FileMain.tsx +0 -28
- package/src/components/FileSection.tsx +0 -20
- package/src/components/FileSlide.tsx +0 -20
- package/src/extensions/image.ts +0 -244
- package/src/wnfs-url.ts +0 -7
- /package/dist/types/src/{common.d.ts → helpers/common.d.ts} +0 -0
package/src/meta.ts
CHANGED
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const WNFS_PLUGIN = 'dxos.org/plugin/
|
|
7
|
+
export const WNFS_PLUGIN = 'dxos.org/plugin/wnfs';
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export const meta = {
|
|
10
10
|
id: WNFS_PLUGIN,
|
|
11
11
|
name: 'WNFS',
|
|
12
12
|
description: 'Upload & view files with WNFS.',
|
|
13
13
|
icon: 'ph--file-cloud--regular',
|
|
14
14
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-wnfs',
|
|
15
|
-
tags: ['experimental'],
|
|
16
15
|
} satisfies PluginMeta;
|
package/src/translations.ts
CHANGED
|
@@ -3,14 +3,19 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { WNFS_PLUGIN } from './meta';
|
|
6
|
+
import { FileType } from './types';
|
|
6
7
|
|
|
7
8
|
export default [
|
|
8
9
|
{
|
|
9
10
|
'en-US': {
|
|
11
|
+
[FileType.typename]: {
|
|
12
|
+
'typename label': 'File',
|
|
13
|
+
},
|
|
10
14
|
[WNFS_PLUGIN]: {
|
|
11
15
|
'plugin name': 'Files',
|
|
12
16
|
'file title placeholder': 'New file',
|
|
13
17
|
'delete object label': 'Delete',
|
|
18
|
+
'file input placeholder': 'Drop a file here, or click to select a file',
|
|
14
19
|
},
|
|
15
20
|
},
|
|
16
21
|
},
|
package/src/types/file.ts
CHANGED
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
import { S, TypedObject } from '@dxos/echo-schema';
|
|
6
6
|
|
|
7
7
|
export class FileType extends TypedObject({ typename: 'dxos.org/type/File', version: '0.1.0' })({
|
|
8
|
-
|
|
8
|
+
name: S.optional(S.String),
|
|
9
9
|
type: S.String,
|
|
10
|
+
cid: S.String,
|
|
10
11
|
timestamp: S.optional(S.String),
|
|
11
|
-
name: S.optional(S.String),
|
|
12
|
-
cid: S.optional(S.String),
|
|
13
12
|
}) {}
|
package/src/types/types.ts
CHANGED
|
@@ -1,27 +1,38 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type SurfaceProvides,
|
|
9
|
-
type TranslationsProvides,
|
|
10
|
-
} from '@dxos/app-framework';
|
|
11
|
-
import { type MarkdownExtensionProvides } from '@dxos/plugin-markdown/types';
|
|
12
|
-
import { type SchemaProvides } from '@dxos/plugin-space';
|
|
5
|
+
import { FileInfoSchema } from '@dxos/app-framework';
|
|
6
|
+
import { S } from '@dxos/echo-schema';
|
|
7
|
+
import { SpaceSchema } from '@dxos/react-client/echo';
|
|
13
8
|
|
|
9
|
+
import { FileType } from './file';
|
|
14
10
|
import { WNFS_PLUGIN } from '../meta';
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
export namespace WnfsAction {
|
|
13
|
+
export class Create extends S.TaggedClass<Create>()(`${WNFS_PLUGIN}/action/create`, {
|
|
14
|
+
input: FileInfoSchema.pick('name', 'type', 'cid').pipe(S.required),
|
|
15
|
+
output: S.Struct({
|
|
16
|
+
object: FileType,
|
|
17
|
+
}),
|
|
18
|
+
}) {}
|
|
17
19
|
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
export const UploadAnnotationId = Symbol.for(`${WNFS_PLUGIN}/annotation/upload`);
|
|
21
|
+
|
|
22
|
+
export const UploadFileSchema = S.Struct({
|
|
23
|
+
file: S.instanceOf(File).annotations({
|
|
24
|
+
[UploadAnnotationId]: {
|
|
25
|
+
// Accept file types.
|
|
26
|
+
'image/*': ['.jpg', '.jpeg', '.png', '.gif'],
|
|
27
|
+
// TODO(wittjosiah): Add more file types.
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
21
31
|
|
|
22
|
-
export type
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
export type UploadFileForm = S.Schema.Type<typeof UploadFileSchema>;
|
|
33
|
+
|
|
34
|
+
export class Upload extends S.TaggedClass<Upload>()(`${WNFS_PLUGIN}/action/upload`, {
|
|
35
|
+
input: S.extend(UploadFileSchema, S.Struct({ space: SpaceSchema })),
|
|
36
|
+
output: S.required(FileInfoSchema),
|
|
37
|
+
}) {}
|
|
38
|
+
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// packages/plugins/experimental/plugin-wnfs/src/components/FileCard.tsx
|
|
2
|
-
import React, { forwardRef } from "react";
|
|
3
|
-
import { DropdownMenu } from "@dxos/react-ui";
|
|
4
|
-
import { Card } from "@dxos/react-ui-card";
|
|
5
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
6
|
-
var FileCard = /* @__PURE__ */ forwardRef(({ classNames, isDragging, draggableStyle, draggableProps, item: { id, object: file }, grow, onSelect, onAction }, forwardRef2) => {
|
|
7
|
-
const url = "TODO";
|
|
8
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
9
|
-
role: "none",
|
|
10
|
-
ref: forwardRef2,
|
|
11
|
-
className: "flex w-full",
|
|
12
|
-
style: draggableStyle
|
|
13
|
-
}, /* @__PURE__ */ React.createElement(Card.Root, {
|
|
14
|
-
classNames: mx("w-full snap-center", isDragging && "opacity-20", classNames),
|
|
15
|
-
grow
|
|
16
|
-
}, /* @__PURE__ */ React.createElement(Card.Header, {
|
|
17
|
-
onDoubleClick: () => onSelect?.(),
|
|
18
|
-
floating: !!url
|
|
19
|
-
}, /* @__PURE__ */ React.createElement(Card.DragHandle, {
|
|
20
|
-
...draggableProps,
|
|
21
|
-
position: "left"
|
|
22
|
-
}), /* @__PURE__ */ React.createElement(Card.Menu, {
|
|
23
|
-
position: "right"
|
|
24
|
-
}, /* @__PURE__ */ React.createElement(DropdownMenu.Item, {
|
|
25
|
-
onClick: () => onAction?.({
|
|
26
|
-
id,
|
|
27
|
-
action: "delete"
|
|
28
|
-
})
|
|
29
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
30
|
-
className: "grow"
|
|
31
|
-
}, "Delete")))), /* @__PURE__ */ React.createElement(Card.Media, {
|
|
32
|
-
src: url
|
|
33
|
-
})));
|
|
34
|
-
});
|
|
35
|
-
var FileCard_default = FileCard;
|
|
36
|
-
export {
|
|
37
|
-
FileCard_default as default
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=FileCard-HJIZDWJF.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/FileCard.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { forwardRef } from 'react';\n\nimport { DropdownMenu } from '@dxos/react-ui';\nimport { Card } from '@dxos/react-ui-card';\nimport type { MosaicTileComponent } from '@dxos/react-ui-mosaic';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { type FileType } from '../types';\n\nexport type FileCardProps = {\n id: string;\n object: FileType;\n};\n\nconst FileCard: MosaicTileComponent<FileCardProps> = forwardRef(\n (\n { classNames, isDragging, draggableStyle, draggableProps, item: { id, object: file }, grow, onSelect, onAction },\n forwardRef,\n ) => {\n const url = 'TODO';\n\n return (\n <div role='none' ref={forwardRef} className='flex w-full' style={draggableStyle}>\n <Card.Root classNames={mx('w-full snap-center', isDragging && 'opacity-20', classNames)} grow={grow}>\n <Card.Header onDoubleClick={() => onSelect?.()} floating={!!url}>\n <Card.DragHandle {...draggableProps} position='left' />\n <Card.Menu position='right'>\n {/* TODO(burdon): Handle events/intents? */}\n <DropdownMenu.Item onClick={() => onAction?.({ id, action: 'delete' })}>\n <span className='grow'>Delete</span>\n </DropdownMenu.Item>\n </Card.Menu>\n </Card.Header>\n <Card.Media src={url} />\n </Card.Root>\n </div>\n );\n },\n);\n\nexport default FileCard;\n"],
|
|
5
|
-
"mappings": ";AAIA,OAAOA,SAASC,kBAAkB;AAElC,SAASC,oBAAoB;AAC7B,SAASC,YAAY;AAErB,SAASC,UAAU;AASnB,IAAMC,WAA+CC,2BACnD,CACE,EAAEC,YAAYC,YAAYC,gBAAgBC,gBAAgBC,MAAM,EAAEC,IAAIC,QAAQC,KAAI,GAAIC,MAAMC,UAAUC,SAAQ,GAC9GX,gBAAAA;AAEA,QAAMY,MAAM;AAEZ,SACE,sBAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,KAAKf;IAAYgB,WAAU;IAAcC,OAAOd;KAC/D,sBAAA,cAACe,KAAKC,MAAI;IAAClB,YAAYmB,GAAG,sBAAsBlB,cAAc,cAAcD,UAAAA;IAAaQ;KACvF,sBAAA,cAACS,KAAKG,QAAM;IAACC,eAAe,MAAMZ,WAAAA;IAAca,UAAU,CAAC,CAACX;KAC1D,sBAAA,cAACM,KAAKM,YAAU;IAAE,GAAGpB;IAAgBqB,UAAS;MAC9C,sBAAA,cAACP,KAAKQ,MAAI;IAACD,UAAS;KAElB,sBAAA,cAACE,aAAaC,MAAI;IAACC,SAAS,MAAMlB,WAAW;MAAEL;MAAIwB,QAAQ;IAAS,CAAA;KAClE,sBAAA,cAACC,QAAAA;IAAKf,WAAU;KAAO,QAAA,CAAA,CAAA,CAAA,GAI7B,sBAAA,cAACE,KAAKc,OAAK;IAACC,KAAKrB;;AAIzB,CAAA;AAGF,IAAA,mBAAeb;",
|
|
6
|
-
"names": ["React", "forwardRef", "DropdownMenu", "Card", "mx", "FileCard", "forwardRef", "classNames", "isDragging", "draggableStyle", "draggableProps", "item", "id", "object", "file", "grow", "onSelect", "onAction", "url", "div", "role", "ref", "className", "style", "Card", "Root", "mx", "Header", "onDoubleClick", "floating", "DragHandle", "position", "Menu", "DropdownMenu", "Item", "onClick", "action", "span", "Media", "src"]
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FilePreview
|
|
3
|
-
} from "./chunk-2I63TM7M.mjs";
|
|
4
|
-
|
|
5
|
-
// packages/plugins/experimental/plugin-wnfs/src/components/FileMain.tsx
|
|
6
|
-
import React from "react";
|
|
7
|
-
import { Main } from "@dxos/react-ui";
|
|
8
|
-
import { baseSurface, topbarBlockPaddingStart, fixedInsetFlexLayout, bottombarBlockPaddingEnd } from "@dxos/react-ui-theme";
|
|
9
|
-
var FileMain = ({ file }) => {
|
|
10
|
-
const url = "TODO";
|
|
11
|
-
return /* @__PURE__ */ React.createElement(Main.Content, {
|
|
12
|
-
classNames: [
|
|
13
|
-
baseSurface,
|
|
14
|
-
fixedInsetFlexLayout,
|
|
15
|
-
topbarBlockPaddingStart,
|
|
16
|
-
bottombarBlockPaddingEnd
|
|
17
|
-
]
|
|
18
|
-
}, /* @__PURE__ */ React.createElement(FilePreview, {
|
|
19
|
-
type: file.type,
|
|
20
|
-
url
|
|
21
|
-
}));
|
|
22
|
-
};
|
|
23
|
-
var FileMain_default = FileMain;
|
|
24
|
-
export {
|
|
25
|
-
FileMain_default as default
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=FileMain-WEWTX7QB.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/FileMain.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { Main } from '@dxos/react-ui';\nimport {\n baseSurface,\n topbarBlockPaddingStart,\n fixedInsetFlexLayout,\n bottombarBlockPaddingEnd,\n} from '@dxos/react-ui-theme';\n\nimport { FilePreview } from './FilePreview';\nimport { type FileType } from '../types';\n\nconst FileMain: FC<{ file: FileType }> = ({ file }) => {\n const url = 'TODO';\n\n return (\n <Main.Content classNames={[baseSurface, fixedInsetFlexLayout, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>\n <FilePreview type={file.type} url={url} />\n </Main.Content>\n );\n};\n\nexport default FileMain;\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,OAAOA,WAAwB;AAE/B,SAASC,YAAY;AACrB,SACEC,aACAC,yBACAC,sBACAC,gCACK;AAKP,IAAMC,WAAmC,CAAC,EAAEC,KAAI,MAAE;AAChD,QAAMC,MAAM;AAEZ,SACE,sBAAA,cAACC,KAAKC,SAAO;IAACC,YAAY;MAACC;MAAaC;MAAsBC;MAAyBC;;KACrF,sBAAA,cAACC,aAAAA;IAAYC,MAAMV,KAAKU;IAAMT;;AAGpC;AAEA,IAAA,mBAAeF;",
|
|
6
|
-
"names": ["React", "Main", "baseSurface", "topbarBlockPaddingStart", "fixedInsetFlexLayout", "bottombarBlockPaddingEnd", "FileMain", "file", "url", "Main", "Content", "classNames", "baseSurface", "fixedInsetFlexLayout", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "FilePreview", "type"]
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FilePreview
|
|
3
|
-
} from "./chunk-2I63TM7M.mjs";
|
|
4
|
-
|
|
5
|
-
// packages/plugins/experimental/plugin-wnfs/src/components/FileSection.tsx
|
|
6
|
-
import React from "react";
|
|
7
|
-
var FileSection = ({ file, height = 400 }) => {
|
|
8
|
-
const url = "TODO";
|
|
9
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
10
|
-
style: {
|
|
11
|
-
height
|
|
12
|
-
},
|
|
13
|
-
className: "flex w-full p-2 justify-center align-center"
|
|
14
|
-
}, /* @__PURE__ */ React.createElement(FilePreview, {
|
|
15
|
-
type: file.type,
|
|
16
|
-
url,
|
|
17
|
-
classNames: "object-contain"
|
|
18
|
-
}));
|
|
19
|
-
};
|
|
20
|
-
var FileSection_default = FileSection;
|
|
21
|
-
export {
|
|
22
|
-
FileSection_default as default
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=FileSection-BEUGJ7EI.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/FileSection.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { FilePreview } from './FilePreview';\nimport { type FileType } from '../types';\n\nconst FileSection: FC<{ file: FileType; height?: number }> = ({ file, height = 400 }) => {\n const url = 'TODO';\n\n return (\n <div style={{ height }} className='flex w-full p-2 justify-center align-center'>\n <FilePreview type={file.type} url={url} classNames='object-contain' />\n </div>\n );\n};\n\nexport default FileSection;\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,OAAOA,WAAwB;AAK/B,IAAMC,cAAuD,CAAC,EAAEC,MAAMC,SAAS,IAAG,MAAE;AAClF,QAAMC,MAAM;AAEZ,SACE,sBAAA,cAACC,OAAAA;IAAIC,OAAO;MAAEH;IAAO;IAAGI,WAAU;KAChC,sBAAA,cAACC,aAAAA;IAAYC,MAAMP,KAAKO;IAAML;IAAUM,YAAW;;AAGzD;AAEA,IAAA,sBAAeT;",
|
|
6
|
-
"names": ["React", "FileSection", "file", "height", "url", "div", "style", "className", "FilePreview", "type", "classNames"]
|
|
7
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FilePreview
|
|
3
|
-
} from "./chunk-2I63TM7M.mjs";
|
|
4
|
-
|
|
5
|
-
// packages/plugins/experimental/plugin-wnfs/src/components/FileSlide.tsx
|
|
6
|
-
import React from "react";
|
|
7
|
-
var FileSlide = ({ file, cover }) => {
|
|
8
|
-
const url = "TODO";
|
|
9
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
10
|
-
className: "h-full flex justify-center align-center"
|
|
11
|
-
}, /* @__PURE__ */ React.createElement(FilePreview, {
|
|
12
|
-
type: file.type,
|
|
13
|
-
url,
|
|
14
|
-
classNames: cover ? "object-cover" : "object-contain"
|
|
15
|
-
}));
|
|
16
|
-
};
|
|
17
|
-
var FileSlide_default = FileSlide;
|
|
18
|
-
export {
|
|
19
|
-
FileSlide_default as default
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=FileSlide-NYBGZEZS.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/FileSlide.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { FilePreview } from './FilePreview';\nimport { type FileType } from '../types';\n\nconst FileSlide: FC<{ file: FileType; cover?: boolean }> = ({ file, cover }) => {\n const url = 'TODO';\n\n return (\n <div className='h-full flex justify-center align-center'>\n <FilePreview type={file.type} url={url} classNames={cover ? 'object-cover' : 'object-contain'} />\n </div>\n );\n};\n\nexport default FileSlide;\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,OAAOA,WAAwB;AAK/B,IAAMC,YAAqD,CAAC,EAAEC,MAAMC,MAAK,MAAE;AACzE,QAAMC,MAAM;AAEZ,SACE,sBAAA,cAACC,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACC,aAAAA;IAAYC,MAAMN,KAAKM;IAAMJ;IAAUK,YAAYN,QAAQ,iBAAiB;;AAGnF;AAEA,IAAA,oBAAeF;",
|
|
6
|
-
"names": ["React", "FileSlide", "file", "cover", "url", "div", "className", "FilePreview", "type", "classNames"]
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// packages/plugins/experimental/plugin-wnfs/src/components/FilePreview.tsx
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
4
|
-
var FilePreview = ({ type, url, classNames }) => {
|
|
5
|
-
if (type.startsWith("image/")) {
|
|
6
|
-
return /* @__PURE__ */ React.createElement("img", {
|
|
7
|
-
className: mx("w-full h-full object-contain", classNames),
|
|
8
|
-
src: url
|
|
9
|
-
});
|
|
10
|
-
} else if (type.startsWith("video/")) {
|
|
11
|
-
return /* @__PURE__ */ React.createElement("video", {
|
|
12
|
-
className: mx("w-full h-full object-contain", classNames),
|
|
13
|
-
src: url,
|
|
14
|
-
controls: true
|
|
15
|
-
});
|
|
16
|
-
} else {
|
|
17
|
-
return /* @__PURE__ */ React.createElement("iframe", {
|
|
18
|
-
className: mx("w-full h-full overflow-auto", classNames),
|
|
19
|
-
src: url
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
FilePreview
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=chunk-2I63TM7M.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/FilePreview.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nexport type FilePreviewProps = ThemedClassName<{ type: string; url: string }>;\n\n/**\n * File/content preview iframe.\n */\nexport const FilePreview = ({ type, url, classNames }: FilePreviewProps) => {\n if (type.startsWith('image/')) {\n return <img className={mx('w-full h-full object-contain', classNames)} src={url} />;\n } else if (type.startsWith('video/')) {\n return <video className={mx('w-full h-full object-contain', classNames)} src={url} controls />;\n } else {\n return <iframe className={mx('w-full h-full overflow-auto', classNames)} src={url} />;\n }\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,OAAOA,WAAW;AAGlB,SAASC,UAAU;AAOZ,IAAMC,cAAc,CAAC,EAAEC,MAAMC,KAAKC,WAAU,MAAoB;AACrE,MAAIF,KAAKG,WAAW,QAAA,GAAW;AAC7B,WAAO,sBAAA,cAACC,OAAAA;MAAIC,WAAWC,GAAG,gCAAgCJ,UAAAA;MAAaK,KAAKN;;EAC9E,WAAWD,KAAKG,WAAW,QAAA,GAAW;AACpC,WAAO,sBAAA,cAACK,SAAAA;MAAMH,WAAWC,GAAG,gCAAgCJ,UAAAA;MAAaK,KAAKN;MAAKQ,UAAAA;;EACrF,OAAO;AACL,WAAO,sBAAA,cAACC,UAAAA;MAAOL,WAAWC,GAAG,+BAA+BJ,UAAAA;MAAaK,KAAKN;;EAChF;AACF;",
|
|
6
|
-
"names": ["React", "mx", "FilePreview", "type", "url", "classNames", "startsWith", "img", "className", "mx", "src", "video", "controls", "iframe"]
|
|
7
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
WNFS_PLUGIN
|
|
3
|
-
} from "./chunk-VL3H7P4F.mjs";
|
|
4
|
-
|
|
5
|
-
// packages/plugins/experimental/plugin-wnfs/src/types/file.ts
|
|
6
|
-
import { S, TypedObject } from "@dxos/echo-schema";
|
|
7
|
-
var FileType = class extends TypedObject({
|
|
8
|
-
typename: "dxos.org/type/File",
|
|
9
|
-
version: "0.1.0"
|
|
10
|
-
})({
|
|
11
|
-
filename: S.String,
|
|
12
|
-
type: S.String,
|
|
13
|
-
timestamp: S.optional(S.String),
|
|
14
|
-
name: S.optional(S.String),
|
|
15
|
-
cid: S.optional(S.String)
|
|
16
|
-
}) {
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// packages/plugins/experimental/plugin-wnfs/src/types/types.ts
|
|
20
|
-
var WNFS_ACTION = `${WNFS_PLUGIN}/action`;
|
|
21
|
-
var WnfsAction;
|
|
22
|
-
(function(WnfsAction2) {
|
|
23
|
-
WnfsAction2[WnfsAction2["CREATE"] = `${WNFS_ACTION}/create`] = "CREATE";
|
|
24
|
-
})(WnfsAction || (WnfsAction = {}));
|
|
25
|
-
|
|
26
|
-
export {
|
|
27
|
-
FileType,
|
|
28
|
-
WnfsAction
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=chunk-JDSKIDDR.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/file.ts", "../../../src/types/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { S, TypedObject } from '@dxos/echo-schema';\n\nexport class FileType extends TypedObject({ typename: 'dxos.org/type/File', version: '0.1.0' })({\n filename: S.String,\n type: S.String,\n timestamp: S.optional(S.String),\n name: S.optional(S.String),\n cid: S.optional(S.String),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport {\n type FileManagerProvides,\n type MetadataRecordsProvides,\n type SurfaceProvides,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { type MarkdownExtensionProvides } from '@dxos/plugin-markdown/types';\nimport { type SchemaProvides } from '@dxos/plugin-space';\n\nimport { WNFS_PLUGIN } from '../meta';\n\nconst WNFS_ACTION = `${WNFS_PLUGIN}/action`;\n\nexport enum WnfsAction {\n CREATE = `${WNFS_ACTION}/create`,\n}\n\nexport type WnfsPluginProvides = FileManagerProvides &\n SurfaceProvides &\n MetadataRecordsProvides &\n TranslationsProvides &\n SchemaProvides &\n MarkdownExtensionProvides;\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,GAAGC,mBAAmB;AAExB,IAAMC,WAAN,cAAuBC,YAAY;EAAEC,UAAU;EAAsBC,SAAS;AAAQ,CAAA,EAAG;EAC9FC,UAAUC,EAAEC;EACZC,MAAMF,EAAEC;EACRE,WAAWH,EAAEI,SAASJ,EAAEC,MAAM;EAC9BI,MAAML,EAAEI,SAASJ,EAAEC,MAAM;EACzBK,KAAKN,EAAEI,SAASJ,EAAEC,MAAM;AAC1B,CAAA,EAAA;AAAI;;;ACGJ,IAAMM,cAAc,GAAGC,WAAAA;;UAEXC,aAAAA;sCACD,GAAGF,WAAAA,SAAoB,IAAA;GADtBE,eAAAA,aAAAA,CAAAA,EAAAA;",
|
|
6
|
-
"names": ["S", "TypedObject", "FileType", "TypedObject", "typename", "version", "filename", "S", "String", "type", "timestamp", "optional", "name", "cid", "WNFS_ACTION", "WNFS_PLUGIN", "WnfsAction"]
|
|
7
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// packages/plugins/experimental/plugin-wnfs/src/meta.ts
|
|
2
|
-
var WNFS_PLUGIN = "dxos.org/plugin/WNFS";
|
|
3
|
-
var meta_default = {
|
|
4
|
-
id: WNFS_PLUGIN,
|
|
5
|
-
name: "WNFS",
|
|
6
|
-
description: "Upload & view files with WNFS.",
|
|
7
|
-
icon: "ph--file-cloud--regular",
|
|
8
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-wnfs",
|
|
9
|
-
tags: [
|
|
10
|
-
"experimental"
|
|
11
|
-
]
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
WNFS_PLUGIN,
|
|
16
|
-
meta_default
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=chunk-VL3H7P4F.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const WNFS_PLUGIN = 'dxos.org/plugin/WNFS';\n\nexport default {\n id: WNFS_PLUGIN,\n name: 'WNFS',\n description: 'Upload & view files with WNFS.',\n icon: 'ph--file-cloud--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-wnfs',\n tags: ['experimental'],\n} satisfies PluginMeta;\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,cAAc;AAE3B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;AACT;",
|
|
6
|
-
"names": ["WNFS_PLUGIN", "id", "name", "description", "icon", "source", "tags"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,KAAK,UAAU,IAAI,cAAc,EAAE,MAAM,MAAM,CAAC;AAGzD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAMrD,eAAO,MAAM,QAAQ,aAAc,MAAM,SAAS,KAAK,aAEtD,CAAC;AAMF,qBAAa,GAAG;IACd,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;CAGvC;AAMD,eAAO,MAAM,KAAK,eAAgB,UAAU,KAAG,cAyB9C,CAAC;AAEF,eAAO,MAAM,SAAS,cAAoB,CAAC;AAM3C,eAAO,MAAM,QAAQ,SAAU,IAAI,KAAG,OAAO,CAAC,UAAU,CAgBvD,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { MosaicTileComponent } from '@dxos/react-ui-mosaic';
|
|
2
|
-
import { type FileType } from '../types';
|
|
3
|
-
export type FileCardProps = {
|
|
4
|
-
id: string;
|
|
5
|
-
object: FileType;
|
|
6
|
-
};
|
|
7
|
-
declare const FileCard: MosaicTileComponent<FileCardProps>;
|
|
8
|
-
export default FileCard;
|
|
9
|
-
//# sourceMappingURL=FileCard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileCard.d.ts","sourceRoot":"","sources":["../../../../src/components/FileCard.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGjE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,mBAAmB,CAAC,aAAa,CAwBhD,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileMain.d.ts","sourceRoot":"","sources":["../../../../src/components/FileMain.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAWvC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAQpC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileSection.d.ts","sourceRoot":"","sources":["../../../../src/components/FileSection.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAQxD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileSlide.d.ts","sourceRoot":"","sources":["../../../../src/components/FileSlide.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAQtD,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/dist/types/src/load.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Blockstore } from 'interface-blockstore';
|
|
2
|
-
import { PrivateDirectory } from 'wnfs';
|
|
3
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
4
|
-
export declare const loadWnfs: (space: Space, blockstore: Blockstore) => Promise<{
|
|
5
|
-
directory: PrivateDirectory;
|
|
6
|
-
forest: any;
|
|
7
|
-
}>;
|
|
8
|
-
//# sourceMappingURL=load.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/load.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAA4B,gBAAgB,EAAe,MAAM,MAAM,CAAC;AAE/E,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAQrD,eAAO,MAAM,QAAQ,UAAiB,KAAK,cAAc,UAAU;;;EAKlE,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Blockstore } from 'interface-blockstore';
|
|
2
|
-
import type { Space } from '@dxos/client/echo';
|
|
3
|
-
export declare const upload: ({ blockstore, file, space }: {
|
|
4
|
-
blockstore: Blockstore;
|
|
5
|
-
file: File;
|
|
6
|
-
space: Space;
|
|
7
|
-
}) => Promise<{
|
|
8
|
-
url: string;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/upload.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAKvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAO/C,eAAO,MAAM,MAAM,gCAAuC;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE;;EA6B7G,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wnfs-url.d.ts","sourceRoot":"","sources":["../../../src/wnfs-url.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,aAAc,MAAM,EAAE,WAEzC,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { forwardRef } from 'react';
|
|
6
|
-
|
|
7
|
-
import { DropdownMenu } from '@dxos/react-ui';
|
|
8
|
-
import { Card } from '@dxos/react-ui-card';
|
|
9
|
-
import type { MosaicTileComponent } from '@dxos/react-ui-mosaic';
|
|
10
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
11
|
-
|
|
12
|
-
import { type FileType } from '../types';
|
|
13
|
-
|
|
14
|
-
export type FileCardProps = {
|
|
15
|
-
id: string;
|
|
16
|
-
object: FileType;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const FileCard: MosaicTileComponent<FileCardProps> = forwardRef(
|
|
20
|
-
(
|
|
21
|
-
{ classNames, isDragging, draggableStyle, draggableProps, item: { id, object: file }, grow, onSelect, onAction },
|
|
22
|
-
forwardRef,
|
|
23
|
-
) => {
|
|
24
|
-
const url = 'TODO';
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div role='none' ref={forwardRef} className='flex w-full' style={draggableStyle}>
|
|
28
|
-
<Card.Root classNames={mx('w-full snap-center', isDragging && 'opacity-20', classNames)} grow={grow}>
|
|
29
|
-
<Card.Header onDoubleClick={() => onSelect?.()} floating={!!url}>
|
|
30
|
-
<Card.DragHandle {...draggableProps} position='left' />
|
|
31
|
-
<Card.Menu position='right'>
|
|
32
|
-
{/* TODO(burdon): Handle events/intents? */}
|
|
33
|
-
<DropdownMenu.Item onClick={() => onAction?.({ id, action: 'delete' })}>
|
|
34
|
-
<span className='grow'>Delete</span>
|
|
35
|
-
</DropdownMenu.Item>
|
|
36
|
-
</Card.Menu>
|
|
37
|
-
</Card.Header>
|
|
38
|
-
<Card.Media src={url} />
|
|
39
|
-
</Card.Root>
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
},
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
export default FileCard;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type FC } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Main } from '@dxos/react-ui';
|
|
8
|
-
import {
|
|
9
|
-
baseSurface,
|
|
10
|
-
topbarBlockPaddingStart,
|
|
11
|
-
fixedInsetFlexLayout,
|
|
12
|
-
bottombarBlockPaddingEnd,
|
|
13
|
-
} from '@dxos/react-ui-theme';
|
|
14
|
-
|
|
15
|
-
import { FilePreview } from './FilePreview';
|
|
16
|
-
import { type FileType } from '../types';
|
|
17
|
-
|
|
18
|
-
const FileMain: FC<{ file: FileType }> = ({ file }) => {
|
|
19
|
-
const url = 'TODO';
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Main.Content classNames={[baseSurface, fixedInsetFlexLayout, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>
|
|
23
|
-
<FilePreview type={file.type} url={url} />
|
|
24
|
-
</Main.Content>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default FileMain;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type FC } from 'react';
|
|
6
|
-
|
|
7
|
-
import { FilePreview } from './FilePreview';
|
|
8
|
-
import { type FileType } from '../types';
|
|
9
|
-
|
|
10
|
-
const FileSection: FC<{ file: FileType; height?: number }> = ({ file, height = 400 }) => {
|
|
11
|
-
const url = 'TODO';
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div style={{ height }} className='flex w-full p-2 justify-center align-center'>
|
|
15
|
-
<FilePreview type={file.type} url={url} classNames='object-contain' />
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default FileSection;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type FC } from 'react';
|
|
6
|
-
|
|
7
|
-
import { FilePreview } from './FilePreview';
|
|
8
|
-
import { type FileType } from '../types';
|
|
9
|
-
|
|
10
|
-
const FileSlide: FC<{ file: FileType; cover?: boolean }> = ({ file, cover }) => {
|
|
11
|
-
const url = 'TODO';
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div className='h-full flex justify-center align-center'>
|
|
15
|
-
<FilePreview type={file.type} url={url} classNames={cover ? 'object-cover' : 'object-contain'} />
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default FileSlide;
|