@dxos/plugin-wnfs 0.7.4 → 0.7.5-labs.a279d8c

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.
Files changed (135) hide show
  1. package/dist/lib/browser/FileContainer-4FF5D2ZF.mjs +94 -0
  2. package/dist/lib/browser/FileContainer-4FF5D2ZF.mjs.map +7 -0
  3. package/dist/lib/browser/blockstore-6U5XTSIH.mjs +192 -0
  4. package/dist/lib/browser/blockstore-6U5XTSIH.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-357BWHML.mjs +16 -0
  6. package/dist/lib/browser/chunk-357BWHML.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-VL3H7P4F.mjs → chunk-6YFT42F7.mjs} +5 -8
  8. package/dist/lib/browser/chunk-6YFT42F7.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-ED7HMPYN.mjs +16 -0
  10. package/dist/lib/browser/chunk-ED7HMPYN.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-EMRQJXBW.mjs +60 -0
  12. package/dist/lib/browser/chunk-EMRQJXBW.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-SCQWJNHD.mjs +157 -0
  14. package/dist/lib/browser/chunk-SCQWJNHD.mjs.map +7 -0
  15. package/dist/lib/browser/file-uploader-EDHMSKYS.mjs +29 -0
  16. package/dist/lib/browser/file-uploader-EDHMSKYS.mjs.map +7 -0
  17. package/dist/lib/browser/index.mjs +96 -494
  18. package/dist/lib/browser/index.mjs.map +4 -4
  19. package/dist/lib/browser/intent-resolver-WDO4EIG3.mjs +43 -0
  20. package/dist/lib/browser/intent-resolver-WDO4EIG3.mjs.map +7 -0
  21. package/dist/lib/browser/markdown-MGSH5CVQ.mjs +198 -0
  22. package/dist/lib/browser/markdown-MGSH5CVQ.mjs.map +7 -0
  23. package/dist/lib/browser/meta.json +1 -1
  24. package/dist/lib/browser/react-surface-OUVGXVOP.mjs +81 -0
  25. package/dist/lib/browser/react-surface-OUVGXVOP.mjs.map +7 -0
  26. package/dist/lib/browser/types/index.mjs +2 -2
  27. package/dist/types/src/WnfsPlugin.d.ts +1 -3
  28. package/dist/types/src/WnfsPlugin.d.ts.map +1 -1
  29. package/dist/types/src/blockstore.d.ts +4 -1
  30. package/dist/types/src/blockstore.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/blockstore.d.ts +4 -0
  32. package/dist/types/src/capabilities/blockstore.d.ts.map +1 -0
  33. package/dist/types/src/capabilities/capabilities.d.ts +12 -0
  34. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  35. package/dist/types/src/capabilities/file-uploader.d.ts +4 -0
  36. package/dist/types/src/capabilities/file-uploader.d.ts.map +1 -0
  37. package/dist/types/src/capabilities/index.d.ts +7 -0
  38. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  39. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  40. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  41. package/dist/types/src/capabilities/markdown.d.ts +4 -0
  42. package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
  43. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  44. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  45. package/dist/types/src/components/FileContainer.d.ts +8 -0
  46. package/dist/types/src/components/FileContainer.d.ts.map +1 -0
  47. package/dist/types/src/components/FileInput.d.ts +8 -0
  48. package/dist/types/src/components/FileInput.d.ts.map +1 -0
  49. package/dist/types/src/components/index.d.ts +4 -11
  50. package/dist/types/src/components/index.d.ts.map +1 -1
  51. package/dist/types/src/extensions/image.d.ts +5 -0
  52. package/dist/types/src/extensions/image.d.ts.map +1 -1
  53. package/dist/types/src/extensions/image.stories.d.ts.map +1 -1
  54. package/dist/types/src/helpers/common.d.ts.map +1 -0
  55. package/dist/types/src/helpers/index.d.ts +5 -0
  56. package/dist/types/src/helpers/index.d.ts.map +1 -0
  57. package/dist/types/src/helpers/load.d.ts +13 -0
  58. package/dist/types/src/helpers/load.d.ts.map +1 -0
  59. package/dist/types/src/helpers/upload.d.ts +15 -0
  60. package/dist/types/src/helpers/upload.d.ts.map +1 -0
  61. package/dist/types/src/helpers/wnfs-url.d.ts +11 -0
  62. package/dist/types/src/helpers/wnfs-url.d.ts.map +1 -0
  63. package/dist/types/src/index.d.ts +2 -2
  64. package/dist/types/src/index.d.ts.map +1 -1
  65. package/dist/types/src/meta.d.ts +1 -3
  66. package/dist/types/src/meta.d.ts.map +1 -1
  67. package/dist/types/src/translations.d.ts +14 -0
  68. package/dist/types/src/translations.d.ts.map +1 -1
  69. package/dist/types/src/types/file.d.ts +7 -11
  70. package/dist/types/src/types/file.d.ts.map +1 -1
  71. package/dist/types/src/types/types.d.ts +49 -6
  72. package/dist/types/src/types/types.d.ts.map +1 -1
  73. package/dist/types/tsconfig.tsbuildinfo +1 -0
  74. package/package.json +28 -26
  75. package/src/WnfsPlugin.tsx +77 -92
  76. package/src/blockstore.ts +151 -21
  77. package/src/capabilities/blockstore.ts +18 -0
  78. package/src/capabilities/capabilities.ts +18 -0
  79. package/src/capabilities/file-uploader.ts +24 -0
  80. package/src/capabilities/index.ts +13 -0
  81. package/src/capabilities/intent-resolver.ts +26 -0
  82. package/src/capabilities/markdown.ts +25 -0
  83. package/src/capabilities/react-surface.tsx +41 -0
  84. package/src/components/FileContainer.tsx +46 -0
  85. package/src/components/FileInput.tsx +46 -0
  86. package/src/components/index.ts +3 -5
  87. package/src/extensions/image.stories.tsx +26 -68
  88. package/src/extensions/image.tsx +203 -0
  89. package/src/{common.ts → helpers/common.ts} +1 -1
  90. package/src/helpers/index.ts +8 -0
  91. package/src/{load.ts → helpers/load.ts} +38 -9
  92. package/src/{upload.ts → helpers/upload.ts} +18 -4
  93. package/src/helpers/wnfs-url.ts +36 -0
  94. package/src/index.ts +2 -4
  95. package/src/meta.ts +1 -2
  96. package/src/translations.ts +5 -0
  97. package/src/types/file.ts +2 -3
  98. package/src/types/types.ts +30 -19
  99. package/dist/lib/browser/FileCard-HJIZDWJF.mjs +0 -39
  100. package/dist/lib/browser/FileCard-HJIZDWJF.mjs.map +0 -7
  101. package/dist/lib/browser/FileMain-WEWTX7QB.mjs +0 -27
  102. package/dist/lib/browser/FileMain-WEWTX7QB.mjs.map +0 -7
  103. package/dist/lib/browser/FileSection-BEUGJ7EI.mjs +0 -24
  104. package/dist/lib/browser/FileSection-BEUGJ7EI.mjs.map +0 -7
  105. package/dist/lib/browser/FileSlide-NYBGZEZS.mjs +0 -21
  106. package/dist/lib/browser/FileSlide-NYBGZEZS.mjs.map +0 -7
  107. package/dist/lib/browser/chunk-2I63TM7M.mjs +0 -27
  108. package/dist/lib/browser/chunk-2I63TM7M.mjs.map +0 -7
  109. package/dist/lib/browser/chunk-JDSKIDDR.mjs +0 -30
  110. package/dist/lib/browser/chunk-JDSKIDDR.mjs.map +0 -7
  111. package/dist/lib/browser/chunk-VL3H7P4F.mjs.map +0 -7
  112. package/dist/lib/browser/meta.mjs +0 -9
  113. package/dist/lib/browser/meta.mjs.map +0 -7
  114. package/dist/types/src/common.d.ts.map +0 -1
  115. package/dist/types/src/components/FileCard.d.ts +0 -9
  116. package/dist/types/src/components/FileCard.d.ts.map +0 -1
  117. package/dist/types/src/components/FileMain.d.ts +0 -7
  118. package/dist/types/src/components/FileMain.d.ts.map +0 -1
  119. package/dist/types/src/components/FileSection.d.ts +0 -8
  120. package/dist/types/src/components/FileSection.d.ts.map +0 -1
  121. package/dist/types/src/components/FileSlide.d.ts +0 -8
  122. package/dist/types/src/components/FileSlide.d.ts.map +0 -1
  123. package/dist/types/src/load.d.ts +0 -8
  124. package/dist/types/src/load.d.ts.map +0 -1
  125. package/dist/types/src/upload.d.ts +0 -10
  126. package/dist/types/src/upload.d.ts.map +0 -1
  127. package/dist/types/src/wnfs-url.d.ts +0 -2
  128. package/dist/types/src/wnfs-url.d.ts.map +0 -1
  129. package/src/components/FileCard.tsx +0 -45
  130. package/src/components/FileMain.tsx +0 -28
  131. package/src/components/FileSection.tsx +0 -20
  132. package/src/components/FileSlide.tsx +0 -20
  133. package/src/extensions/image.ts +0 -244
  134. package/src/wnfs-url.ts +0 -7
  135. /package/dist/types/src/{common.d.ts → helpers/common.d.ts} +0 -0
package/src/meta.ts CHANGED
@@ -6,11 +6,10 @@ import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
7
  export const WNFS_PLUGIN = 'dxos.org/plugin/WNFS';
8
8
 
9
- export default {
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;
@@ -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
- filename: S.String,
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
  }) {}
@@ -1,27 +1,38 @@
1
1
  //
2
- // Copyright 2023 DXOS.org
2
+ // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import {
6
- type FileManagerProvides,
7
- type MetadataRecordsProvides,
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
- const WNFS_ACTION = `${WNFS_PLUGIN}/action`;
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 enum WnfsAction {
19
- CREATE = `${WNFS_ACTION}/create`,
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 WnfsPluginProvides = FileManagerProvides &
23
- SurfaceProvides &
24
- MetadataRecordsProvides &
25
- TranslationsProvides &
26
- SchemaProvides &
27
- MarkdownExtensionProvides;
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,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,9 +0,0 @@
1
- import {
2
- WNFS_PLUGIN,
3
- meta_default
4
- } from "./chunk-VL3H7P4F.mjs";
5
- export {
6
- WNFS_PLUGIN,
7
- meta_default as default
8
- };
9
- //# sourceMappingURL=meta.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
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,7 +0,0 @@
1
- import { type FC } from 'react';
2
- import { type FileType } from '../types';
3
- declare const FileMain: FC<{
4
- file: FileType;
5
- }>;
6
- export default FileMain;
7
- //# sourceMappingURL=FileMain.d.ts.map
@@ -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,8 +0,0 @@
1
- import { type FC } from 'react';
2
- import { type FileType } from '../types';
3
- declare const FileSection: FC<{
4
- file: FileType;
5
- height?: number;
6
- }>;
7
- export default FileSection;
8
- //# sourceMappingURL=FileSection.d.ts.map
@@ -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,8 +0,0 @@
1
- import { type FC } from 'react';
2
- import { type FileType } from '../types';
3
- declare const FileSlide: FC<{
4
- file: FileType;
5
- cover?: boolean;
6
- }>;
7
- export default FileSlide;
8
- //# sourceMappingURL=FileSlide.d.ts.map
@@ -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"}
@@ -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,2 +0,0 @@
1
- export declare const wnfsUrl: (filePath: string[]) => string;
2
- //# sourceMappingURL=wnfs-url.d.ts.map
@@ -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;