@dxos/plugin-wnfs 0.6.14-main.69511f5
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/LICENSE +8 -0
- package/README.md +15 -0
- package/dist/lib/browser/FileCard-HJIZDWJF.mjs +39 -0
- package/dist/lib/browser/FileCard-HJIZDWJF.mjs.map +7 -0
- package/dist/lib/browser/FileMain-WEWTX7QB.mjs +27 -0
- package/dist/lib/browser/FileMain-WEWTX7QB.mjs.map +7 -0
- package/dist/lib/browser/FileSection-BEUGJ7EI.mjs +24 -0
- package/dist/lib/browser/FileSection-BEUGJ7EI.mjs.map +7 -0
- package/dist/lib/browser/FileSlide-NYBGZEZS.mjs +21 -0
- package/dist/lib/browser/FileSlide-NYBGZEZS.mjs.map +7 -0
- package/dist/lib/browser/chunk-2I63TM7M.mjs +27 -0
- package/dist/lib/browser/chunk-2I63TM7M.mjs.map +7 -0
- package/dist/lib/browser/chunk-STEG7B5Y.mjs +17 -0
- package/dist/lib/browser/chunk-STEG7B5Y.mjs.map +7 -0
- package/dist/lib/browser/chunk-VI24OYJB.mjs +30 -0
- package/dist/lib/browser/chunk-VI24OYJB.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +517 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/browser/meta.mjs +9 -0
- package/dist/lib/browser/meta.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -0
- package/dist/lib/browser/types/index.mjs.map +7 -0
- package/dist/types/src/WnfsPlugin.d.ts +4 -0
- package/dist/types/src/WnfsPlugin.d.ts.map +1 -0
- package/dist/types/src/blockstore.d.ts +19 -0
- package/dist/types/src/blockstore.d.ts.map +1 -0
- package/dist/types/src/common.d.ts +11 -0
- package/dist/types/src/common.d.ts.map +1 -0
- package/dist/types/src/components/FileCard.d.ts +9 -0
- package/dist/types/src/components/FileCard.d.ts.map +1 -0
- package/dist/types/src/components/FileMain.d.ts +7 -0
- package/dist/types/src/components/FileMain.d.ts.map +1 -0
- package/dist/types/src/components/FilePreview.d.ts +11 -0
- package/dist/types/src/components/FilePreview.d.ts.map +1 -0
- package/dist/types/src/components/FileSection.d.ts +8 -0
- package/dist/types/src/components/FileSection.d.ts.map +1 -0
- package/dist/types/src/components/FileSlide.d.ts +8 -0
- package/dist/types/src/components/FileSlide.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +14 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/extensions/image.d.ts +9 -0
- package/dist/types/src/extensions/image.d.ts.map +1 -0
- package/dist/types/src/extensions/image.stories.d.ts +10 -0
- package/dist/types/src/extensions/image.stories.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +2 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/load.d.ts +8 -0
- package/dist/types/src/load.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +10 -0
- package/dist/types/src/meta.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +11 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/types/file.d.ts +20 -0
- package/dist/types/src/types/file.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +8 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/src/upload.d.ts +10 -0
- package/dist/types/src/upload.d.ts.map +1 -0
- package/dist/types/src/wnfs-url.d.ts +2 -0
- package/dist/types/src/wnfs-url.d.ts.map +1 -0
- package/package.json +82 -0
- package/src/WnfsPlugin.tsx +102 -0
- package/src/blockstore.ts +96 -0
- package/src/common.ts +84 -0
- package/src/components/FileCard.tsx +45 -0
- package/src/components/FileMain.tsx +28 -0
- package/src/components/FilePreview.tsx +23 -0
- package/src/components/FileSection.tsx +20 -0
- package/src/components/FileSlide.tsx +20 -0
- package/src/components/index.ts +11 -0
- package/src/extensions/image.stories.tsx +142 -0
- package/src/extensions/image.ts +244 -0
- package/src/extensions/index.ts +5 -0
- package/src/index.ts +9 -0
- package/src/load.ts +63 -0
- package/src/meta.tsx +15 -0
- package/src/translations.ts +17 -0
- package/src/types/file.ts +13 -0
- package/src/types/index.ts +6 -0
- package/src/types/types.ts +27 -0
- package/src/upload.ts +46 -0
- package/src/wnfs-url.ts +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
Copyright (c) 2024 DXOS
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @dxos/plugin-wnfs
|
|
2
|
+
|
|
3
|
+
Plugin that allows for data to be stored on WNFS.
|
|
4
|
+
|
|
5
|
+
## DXOS Resources
|
|
6
|
+
|
|
7
|
+
- [Website](https://dxos.org)
|
|
8
|
+
- [Developer Documentation](https://docs.dxos.org)
|
|
9
|
+
- Talk to us on [Discord](https://discord.gg/eXVfryv3sW)
|
|
10
|
+
|
|
11
|
+
## Contributions
|
|
12
|
+
|
|
13
|
+
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
14
|
+
|
|
15
|
+
License: [MIT](./LICENSE) Copyright 2024 © DXOS
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// packages/plugins/experimental/plugin-wnfs/src/meta.tsx
|
|
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
|
+
tags: [
|
|
8
|
+
"experimental"
|
|
9
|
+
],
|
|
10
|
+
icon: "ph--file-cloud--regular"
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
WNFS_PLUGIN,
|
|
15
|
+
meta_default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-STEG7B5Y.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.tsx"],
|
|
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 tags: ['experimental'],\n icon: 'ph--file-cloud--regular',\n} satisfies PluginMeta;\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,cAAc;AAE3B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;EACNC,aAAa;EACbC,MAAM;IAAC;;EACPC,MAAM;AACR;",
|
|
6
|
+
"names": ["WNFS_PLUGIN", "id", "name", "description", "tags", "icon"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WNFS_PLUGIN
|
|
3
|
+
} from "./chunk-STEG7B5Y.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-VI24OYJB.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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 SchemaProvides } from '@dxos/plugin-client';\nimport { type MarkdownExtensionProvides } from '@dxos/plugin-markdown/types';\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
|
+
}
|