@dxos/plugin-wnfs 0.7.5-main.2567c87 → 0.7.5-main.5ae2ba8

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 (55) hide show
  1. package/dist/lib/browser/{FileContainer-I2P6I7CX.mjs → FileContainer-JP3ZCHVO.mjs} +4 -4
  2. package/dist/lib/browser/{blockstore-6U5XTSIH.mjs → blockstore-55OY65BY.mjs} +5 -6
  3. package/dist/lib/browser/blockstore-55OY65BY.mjs.map +7 -0
  4. package/dist/lib/browser/chunk-3ERFJ7W2.mjs +16 -0
  5. package/dist/lib/browser/{chunk-6YFT42F7.mjs → chunk-EELFT4QP.mjs} +2 -2
  6. package/dist/lib/browser/{chunk-6YFT42F7.mjs.map → chunk-EELFT4QP.mjs.map} +1 -1
  7. package/dist/lib/browser/{chunk-357BWHML.mjs → chunk-KFKLBRAQ.mjs} +2 -2
  8. package/dist/lib/browser/{chunk-EMRQJXBW.mjs → chunk-RYOWC7TX.mjs} +2 -2
  9. package/dist/lib/browser/{file-uploader-EDHMSKYS.mjs → file-uploader-3DF5T3EZ.mjs} +3 -3
  10. package/dist/lib/browser/index.mjs +24 -21
  11. package/dist/lib/browser/index.mjs.map +3 -3
  12. package/dist/lib/browser/intent-resolver-6IX7MROZ.mjs +49 -0
  13. package/dist/lib/browser/intent-resolver-6IX7MROZ.mjs.map +7 -0
  14. package/dist/lib/browser/{markdown-MGSH5CVQ.mjs → markdown-MGMT4KWF.mjs} +3 -3
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/{react-surface-EBQICOUA.mjs → react-surface-DPJ6WGOE.mjs} +5 -5
  17. package/dist/lib/browser/{react-surface-EBQICOUA.mjs.map → react-surface-DPJ6WGOE.mjs.map} +2 -2
  18. package/dist/lib/browser/types/index.mjs +2 -2
  19. package/dist/types/src/WnfsPlugin.d.ts.map +1 -1
  20. package/dist/types/src/blockstore.d.ts.map +1 -1
  21. package/dist/types/src/capabilities/index.d.ts +5 -5
  22. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  23. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/markdown.d.ts +1 -1
  25. package/dist/types/src/components/FileContainer.d.ts +1 -2
  26. package/dist/types/src/components/FileContainer.d.ts.map +1 -1
  27. package/dist/types/src/components/FileInput.d.ts +1 -2
  28. package/dist/types/src/components/FileInput.d.ts.map +1 -1
  29. package/dist/types/src/components/FilePreview.d.ts +1 -2
  30. package/dist/types/src/components/FilePreview.d.ts.map +1 -1
  31. package/dist/types/src/components/index.d.ts +1 -1
  32. package/dist/types/src/components/index.d.ts.map +1 -1
  33. package/dist/types/src/extensions/image.stories.d.ts +2 -3
  34. package/dist/types/src/extensions/image.stories.d.ts.map +1 -1
  35. package/dist/types/src/meta.d.ts +1 -1
  36. package/dist/types/src/translations.d.ts +1 -1
  37. package/dist/types/src/types/file.d.ts +2 -2
  38. package/dist/types/src/types/types.d.ts +5 -5
  39. package/package.json +24 -23
  40. package/src/WnfsPlugin.tsx +21 -14
  41. package/src/blockstore.ts +4 -12
  42. package/src/capabilities/intent-resolver.ts +14 -8
  43. package/src/capabilities/react-surface.tsx +2 -2
  44. package/src/components/index.ts +0 -1
  45. package/src/meta.ts +1 -1
  46. package/dist/lib/browser/blockstore-6U5XTSIH.mjs.map +0 -7
  47. package/dist/lib/browser/chunk-YLGCDZV3.mjs +0 -16
  48. package/dist/lib/browser/intent-resolver-WDO4EIG3.mjs +0 -43
  49. package/dist/lib/browser/intent-resolver-WDO4EIG3.mjs.map +0 -7
  50. /package/dist/lib/browser/{FileContainer-I2P6I7CX.mjs.map → FileContainer-JP3ZCHVO.mjs.map} +0 -0
  51. /package/dist/lib/browser/{chunk-YLGCDZV3.mjs.map → chunk-3ERFJ7W2.mjs.map} +0 -0
  52. /package/dist/lib/browser/{chunk-357BWHML.mjs.map → chunk-KFKLBRAQ.mjs.map} +0 -0
  53. /package/dist/lib/browser/{chunk-EMRQJXBW.mjs.map → chunk-RYOWC7TX.mjs.map} +0 -0
  54. /package/dist/lib/browser/{file-uploader-EDHMSKYS.mjs.map → file-uploader-3DF5T3EZ.mjs.map} +0 -0
  55. /package/dist/lib/browser/{markdown-MGSH5CVQ.mjs.map → markdown-MGMT4KWF.mjs.map} +0 -0
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  FileType,
3
3
  WnfsAction
4
- } from "./chunk-EMRQJXBW.mjs";
4
+ } from "./chunk-RYOWC7TX.mjs";
5
5
  import {
6
6
  WNFS_PLUGIN
7
- } from "./chunk-6YFT42F7.mjs";
7
+ } from "./chunk-EELFT4QP.mjs";
8
8
 
9
9
  // packages/plugins/plugin-wnfs/src/capabilities/react-surface.tsx
10
10
  import React3, { useCallback as useCallback2 } from "react";
@@ -38,7 +38,7 @@ var FileInput = ({ schema, onChange }) => {
38
38
  };
39
39
 
40
40
  // packages/plugins/plugin-wnfs/src/components/index.ts
41
- var FileContainer = React2.lazy(() => import("./FileContainer-I2P6I7CX.mjs"));
41
+ var FileContainer = React2.lazy(() => import("./FileContainer-JP3ZCHVO.mjs"));
42
42
 
43
43
  // packages/plugins/plugin-wnfs/src/capabilities/react-surface.tsx
44
44
  var react_surface_default = () => contributes(Capabilities.ReactSurface, [
@@ -64,7 +64,7 @@ var react_surface_default = () => contributes(Capabilities.ReactSurface, [
64
64
  },
65
65
  component: ({ data: { prop, schema }, ...props }) => {
66
66
  const inputProps = props;
67
- const handleChange = useCallback2((file) => inputProps.onValueChange?.(prop, "object", file), [
67
+ const handleChange = useCallback2((file) => inputProps.onValueChange?.("object", file), [
68
68
  prop,
69
69
  inputProps.onValueChange
70
70
  ]);
@@ -78,4 +78,4 @@ var react_surface_default = () => contributes(Capabilities.ReactSurface, [
78
78
  export {
79
79
  react_surface_default as default
80
80
  };
81
- //# sourceMappingURL=react-surface-EBQICOUA.mjs.map
81
+ //# sourceMappingURL=react-surface-DPJ6WGOE.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/capabilities/react-surface.tsx", "../../../src/components/index.ts", "../../../src/components/FileInput.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { contributes, Capabilities, createSurface } from '@dxos/app-framework';\nimport { type S } from '@dxos/echo-schema';\nimport { findAnnotation } from '@dxos/effect';\nimport { type InputProps } from '@dxos/react-ui-form';\n\nimport { FileContainer, FileInput } from '../components';\nimport { WNFS_PLUGIN } from '../meta';\nimport { FileType, WnfsAction } from '../types';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${WNFS_PLUGIN}/article`,\n role: ['article', 'section', 'slide'],\n filter: (data): data is { subject: FileType } => data.subject instanceof FileType,\n component: ({ data, role }) => <FileContainer role={role} file={data.subject} />,\n }),\n createSurface({\n id: `${WNFS_PLUGIN}/create-form`,\n role: 'form-input',\n filter: (data): data is { prop: string; schema: S.Schema.Any } => {\n const annotation = findAnnotation<boolean>((data.schema as S.Schema.All).ast, WnfsAction.UploadAnnotationId);\n return !!annotation;\n },\n component: ({ data: { prop, schema }, ...props }) => {\n const inputProps = props as unknown as InputProps<any>;\n const handleChange = useCallback(\n (file: File) => inputProps.onValueChange?.(prop, 'object', file),\n [prop, inputProps.onValueChange],\n );\n\n return <FileInput schema={schema} onChange={handleChange} />;\n },\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\n// Lazily load components for content surfaces.\nexport const FileContainer = React.lazy(() => import('./FileContainer'));\n\nexport * from './FileInput';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\nimport { useDropzone } from 'react-dropzone';\n\nimport { findAnnotation, type S } from '@dxos/effect';\nimport { useTranslation } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { WNFS_PLUGIN } from '../meta';\nimport { WnfsAction } from '../types';\n\nexport type FileInputProps = {\n schema: S.Schema.Any;\n onChange: (file: File) => void;\n};\n\nexport const FileInput = ({ schema, onChange }: FileInputProps) => {\n const { t } = useTranslation(WNFS_PLUGIN);\n const accept = findAnnotation<Record<string, string[]>>(schema.ast, WnfsAction.UploadAnnotationId);\n\n const onDropAccepted = useCallback((files: File[]) => onChange?.(files[0]), [onChange]);\n\n const { acceptedFiles, getRootProps, getInputProps, isFocused, isDragAccept, isDragReject } = useDropzone({\n multiple: false,\n accept,\n onDropAccepted,\n });\n\n return (\n <div\n {...getRootProps()}\n className={mx(\n 'flex flex-col items-center p-8 border border-separator',\n isFocused && 'focus-ring',\n isDragAccept && 'bg-attention',\n isDragReject && 'border-error',\n )}\n >\n <input {...getInputProps()} />\n {acceptedFiles[0] ? <p>{acceptedFiles[0].name}</p> : <p>{t('file input placeholder')}</p>}\n </div>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;AAIA,OAAOA,UAASC,eAAAA,oBAAmB;AAEnC,SAASC,aAAaC,cAAcC,qBAAqB;AAEzD,SAASC,kBAAAA,uBAAsB;;;ACJ/B,OAAOC,YAAW;;;ACAlB,OAAOC,SAASC,mBAAmB;AACnC,SAASC,mBAAmB;AAE5B,SAASC,sBAA8B;AACvC,SAASC,sBAAsB;AAC/B,SAASC,UAAU;AAUZ,IAAMC,YAAY,CAAC,EAAEC,QAAQC,SAAQ,MAAkB;AAC5D,QAAM,EAAEC,EAAC,IAAKC,eAAeC,WAAAA;AAC7B,QAAMC,SAASC,eAAyCN,OAAOO,KAAKC,WAAWC,kBAAkB;AAEjG,QAAMC,iBAAiBC,YAAY,CAACC,UAAkBX,WAAWW,MAAM,CAAA,CAAE,GAAG;IAACX;GAAS;AAEtF,QAAM,EAAEY,eAAeC,cAAcC,eAAeC,WAAWC,cAAcC,aAAY,IAAKC,YAAY;IACxGC,UAAU;IACVf;IACAK;EACF,CAAA;AAEA,SACE,sBAAA,cAACW,OAAAA;IACE,GAAGP,aAAAA;IACJQ,WAAWC,GACT,0DACAP,aAAa,cACbC,gBAAgB,gBAChBC,gBAAgB,cAAA;KAGlB,sBAAA,cAACM,SAAUT,cAAAA,CAAAA,GACVF,cAAc,CAAA,IAAK,sBAAA,cAACY,KAAAA,MAAGZ,cAAc,CAAA,EAAGa,IAAI,IAAQ,sBAAA,cAACD,KAAAA,MAAGvB,EAAE,wBAAA,CAAA,CAAA;AAGjE;;;ADtCO,IAAMyB,gBAAgBC,OAAMC,KAAK,MAAM,OAAO,8BAAA,CAAA;;;ADQrD,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAI,GAAGC,WAAAA;IACPC,MAAM;MAAC;MAAW;MAAW;;IAC7BC,QAAQ,CAACC,SAAwCA,KAAKC,mBAAmBC;IACzEC,WAAW,CAAC,EAAEH,MAAMF,KAAI,MAAO,gBAAAM,OAAA,cAACC,eAAAA;MAAcP;MAAYQ,MAAMN,KAAKC;;EACvE,CAAA;EACAN,cAAc;IACZC,IAAI,GAAGC,WAAAA;IACPC,MAAM;IACNC,QAAQ,CAACC,SAAAA;AACP,YAAMO,aAAaC,gBAAyBR,KAAKS,OAAwBC,KAAKC,WAAWC,kBAAkB;AAC3G,aAAO,CAAC,CAACL;IACX;IACAJ,WAAW,CAAC,EAAEH,MAAM,EAAEa,MAAMJ,OAAM,GAAI,GAAGK,MAAAA,MAAO;AAC9C,YAAMC,aAAaD;AACnB,YAAME,eAAeC,aACnB,CAACX,SAAeS,WAAWG,gBAAgBL,MAAM,UAAUP,IAAAA,GAC3D;QAACO;QAAME,WAAWG;OAAc;AAGlC,aAAO,gBAAAd,OAAA,cAACe,WAAAA;QAAUV;QAAgBW,UAAUJ;;IAC9C;EACF,CAAA;CACD;",
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { contributes, Capabilities, createSurface } from '@dxos/app-framework';\nimport { type S } from '@dxos/echo-schema';\nimport { findAnnotation } from '@dxos/effect';\nimport { type InputProps } from '@dxos/react-ui-form';\n\nimport { FileContainer, FileInput } from '../components';\nimport { WNFS_PLUGIN } from '../meta';\nimport { FileType, WnfsAction } from '../types';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${WNFS_PLUGIN}/article`,\n role: ['article', 'section', 'slide'],\n filter: (data): data is { subject: FileType } => data.subject instanceof FileType,\n component: ({ data, role }) => <FileContainer role={role} file={data.subject} />,\n }),\n createSurface({\n id: `${WNFS_PLUGIN}/create-form`,\n role: 'form-input',\n filter: (data): data is { prop: string; schema: S.Schema.Any } => {\n const annotation = findAnnotation<boolean>((data.schema as S.Schema.All).ast, WnfsAction.UploadAnnotationId);\n return !!annotation;\n },\n component: ({ data: { prop, schema }, ...props }) => {\n const inputProps = props as unknown as InputProps;\n const handleChange = useCallback(\n (file: File) => inputProps.onValueChange?.('object', file),\n [prop, inputProps.onValueChange],\n );\n\n return <FileInput schema={schema} onChange={handleChange} />;\n },\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nexport const FileContainer = React.lazy(() => import('./FileContainer'));\n\nexport * from './FileInput';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\nimport { useDropzone } from 'react-dropzone';\n\nimport { findAnnotation, type S } from '@dxos/effect';\nimport { useTranslation } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { WNFS_PLUGIN } from '../meta';\nimport { WnfsAction } from '../types';\n\nexport type FileInputProps = {\n schema: S.Schema.Any;\n onChange: (file: File) => void;\n};\n\nexport const FileInput = ({ schema, onChange }: FileInputProps) => {\n const { t } = useTranslation(WNFS_PLUGIN);\n const accept = findAnnotation<Record<string, string[]>>(schema.ast, WnfsAction.UploadAnnotationId);\n\n const onDropAccepted = useCallback((files: File[]) => onChange?.(files[0]), [onChange]);\n\n const { acceptedFiles, getRootProps, getInputProps, isFocused, isDragAccept, isDragReject } = useDropzone({\n multiple: false,\n accept,\n onDropAccepted,\n });\n\n return (\n <div\n {...getRootProps()}\n className={mx(\n 'flex flex-col items-center p-8 border border-separator',\n isFocused && 'focus-ring',\n isDragAccept && 'bg-attention',\n isDragReject && 'border-error',\n )}\n >\n <input {...getInputProps()} />\n {acceptedFiles[0] ? <p>{acceptedFiles[0].name}</p> : <p>{t('file input placeholder')}</p>}\n </div>\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;AAIA,OAAOA,UAASC,eAAAA,oBAAmB;AAEnC,SAASC,aAAaC,cAAcC,qBAAqB;AAEzD,SAASC,kBAAAA,uBAAsB;;;ACJ/B,OAAOC,YAAW;;;ACAlB,OAAOC,SAASC,mBAAmB;AACnC,SAASC,mBAAmB;AAE5B,SAASC,sBAA8B;AACvC,SAASC,sBAAsB;AAC/B,SAASC,UAAU;AAUZ,IAAMC,YAAY,CAAC,EAAEC,QAAQC,SAAQ,MAAkB;AAC5D,QAAM,EAAEC,EAAC,IAAKC,eAAeC,WAAAA;AAC7B,QAAMC,SAASC,eAAyCN,OAAOO,KAAKC,WAAWC,kBAAkB;AAEjG,QAAMC,iBAAiBC,YAAY,CAACC,UAAkBX,WAAWW,MAAM,CAAA,CAAE,GAAG;IAACX;GAAS;AAEtF,QAAM,EAAEY,eAAeC,cAAcC,eAAeC,WAAWC,cAAcC,aAAY,IAAKC,YAAY;IACxGC,UAAU;IACVf;IACAK;EACF,CAAA;AAEA,SACE,sBAAA,cAACW,OAAAA;IACE,GAAGP,aAAAA;IACJQ,WAAWC,GACT,0DACAP,aAAa,cACbC,gBAAgB,gBAChBC,gBAAgB,cAAA;KAGlB,sBAAA,cAACM,SAAUT,cAAAA,CAAAA,GACVF,cAAc,CAAA,IAAK,sBAAA,cAACY,KAAAA,MAAGZ,cAAc,CAAA,EAAGa,IAAI,IAAQ,sBAAA,cAACD,KAAAA,MAAGvB,EAAE,wBAAA,CAAA,CAAA;AAGjE;;;ADvCO,IAAMyB,gBAAgBC,OAAMC,KAAK,MAAM,OAAO,8BAAA,CAAA;;;ADSrD,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAI,GAAGC,WAAAA;IACPC,MAAM;MAAC;MAAW;MAAW;;IAC7BC,QAAQ,CAACC,SAAwCA,KAAKC,mBAAmBC;IACzEC,WAAW,CAAC,EAAEH,MAAMF,KAAI,MAAO,gBAAAM,OAAA,cAACC,eAAAA;MAAcP;MAAYQ,MAAMN,KAAKC;;EACvE,CAAA;EACAN,cAAc;IACZC,IAAI,GAAGC,WAAAA;IACPC,MAAM;IACNC,QAAQ,CAACC,SAAAA;AACP,YAAMO,aAAaC,gBAAyBR,KAAKS,OAAwBC,KAAKC,WAAWC,kBAAkB;AAC3G,aAAO,CAAC,CAACL;IACX;IACAJ,WAAW,CAAC,EAAEH,MAAM,EAAEa,MAAMJ,OAAM,GAAI,GAAGK,MAAAA,MAAO;AAC9C,YAAMC,aAAaD;AACnB,YAAME,eAAeC,aACnB,CAACX,SAAeS,WAAWG,gBAAgB,UAAUZ,IAAAA,GACrD;QAACO;QAAME,WAAWG;OAAc;AAGlC,aAAO,gBAAAd,OAAA,cAACe,WAAAA;QAAUV;QAAgBW,UAAUJ;;IAC9C;EACF,CAAA;CACD;",
6
6
  "names": ["React", "useCallback", "contributes", "Capabilities", "createSurface", "findAnnotation", "React", "React", "useCallback", "useDropzone", "findAnnotation", "useTranslation", "mx", "FileInput", "schema", "onChange", "t", "useTranslation", "WNFS_PLUGIN", "accept", "findAnnotation", "ast", "WnfsAction", "UploadAnnotationId", "onDropAccepted", "useCallback", "files", "acceptedFiles", "getRootProps", "getInputProps", "isFocused", "isDragAccept", "isDragReject", "useDropzone", "multiple", "div", "className", "mx", "input", "p", "name", "FileContainer", "React", "lazy", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "WNFS_PLUGIN", "role", "filter", "data", "subject", "FileType", "component", "React", "FileContainer", "file", "annotation", "findAnnotation", "schema", "ast", "WnfsAction", "UploadAnnotationId", "prop", "props", "inputProps", "handleChange", "useCallback", "onValueChange", "FileInput", "onChange"]
7
7
  }
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  FileType,
3
3
  WnfsAction
4
- } from "../chunk-EMRQJXBW.mjs";
5
- import "../chunk-6YFT42F7.mjs";
4
+ } from "../chunk-RYOWC7TX.mjs";
5
+ import "../chunk-EELFT4QP.mjs";
6
6
  export {
7
7
  FileType,
8
8
  WnfsAction
@@ -1 +1 @@
1
- {"version":3,"file":"WnfsPlugin.d.ts","sourceRoot":"","sources":["../../../src/WnfsPlugin.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,UAAU,4CA8DnB,CAAC"}
1
+ {"version":3,"file":"WnfsPlugin.d.ts","sourceRoot":"","sources":["../../../src/WnfsPlugin.tsx"],"names":[],"mappings":"AAyBA,eAAO,MAAM,UAAU,4CAoEnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"blockstore.d.ts","sourceRoot":"","sources":["../../../src/blockstore.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKjD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKnC,eAAO,MAAM,MAAM,aAAc,MAAM,oBAEtC,CAAC;AAEF;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,cAAc;;gBAQrC,OAAO,CAAC,EAAE,MAAM;IAWtB,IAAI;IAcV,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG;IAOf,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAU/B,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;IAqBlC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAc/B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IASrD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAMxB,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU;IASnC,YAAY,CAAC,GAAG,EAAE,UAAU;IAclC,QAAQ,CAAC,cAAc,SAAgC;CA8ExD"}
1
+ {"version":3,"file":"blockstore.d.ts","sourceRoot":"","sources":["../../../src/blockstore.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKjD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKnC,eAAO,MAAM,MAAM,aAAc,MAAM,oBAEtC,CAAC;AAEF;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,cAAc;;gBAQrC,OAAO,CAAC,EAAE,MAAM;IAWtB,IAAI;IAcV,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG;IAOf,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAU/B,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;IAqBlC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAc/B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IASrD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAMxB,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU;IASnC,YAAY,CAAC,GAAG,EAAE,UAAU;IAclC,QAAQ,CAAC,cAAc,SAAgC;CAsExD"}
@@ -1,7 +1,7 @@
1
- export declare const Blockstore: (props?: import("@dxos/app-framework").PluginsContext | undefined) => Promise<import("@dxos/app-framework").Capability<import("interface-blockstore").Blockstore<{}, {}, {}, {}, {}, {}, {}, {}>>>;
2
- export declare const FileUploader: (props?: import("@dxos/app-framework").PluginsContext | undefined) => Promise<import("@dxos/app-framework").Capability<import("@dxos/app-framework").Capabilities.FileUploader>>;
3
- export declare const IntentResolver: (props?: import("@dxos/app-framework").PluginsContext | undefined) => Promise<import("@dxos/app-framework").Capability<import("@dxos/app-framework").Capabilities.IntentResolver>>;
4
- export declare const Markdown: (props?: import("@dxos/app-framework").PluginsContext | undefined) => Promise<import("@dxos/app-framework").Capability<import("packages/plugins/plugin-markdown/dist/types/src/types").MarkdownExtensionProvider[]>>;
5
- export declare const ReactSurface: (props?: unknown) => Promise<import("@dxos/app-framework").Capability<import("@dxos/app-framework").Capabilities.ReactSurface>>;
1
+ export declare const Blockstore: (props?: import("@dxos/app-framework").PluginsContext | undefined) => Promise<() => Promise<import("@dxos/app-framework").Capability<import("interface-blockstore").Blockstore<{}, {}, {}, {}, {}, {}, {}, {}>> | import("@dxos/app-framework").AnyCapability[]>>;
2
+ export declare const FileUploader: (props?: import("@dxos/app-framework").PluginsContext | undefined) => Promise<() => Promise<import("@dxos/app-framework").Capability<import("@dxos/app-framework").Capabilities.FileUploader> | import("@dxos/app-framework").AnyCapability[]>>;
3
+ export declare const IntentResolver: (props?: import("@dxos/app-framework").PluginsContext | undefined) => Promise<() => Promise<import("@dxos/app-framework").Capability<import("@dxos/app-framework").Capabilities.IntentResolver> | import("@dxos/app-framework").AnyCapability[]>>;
4
+ export declare const Markdown: (props?: import("@dxos/app-framework").PluginsContext | undefined) => Promise<() => Promise<import("@dxos/app-framework").Capability<import("@dxos/plugin-markdown/types").MarkdownExtensionProvider[]> | import("@dxos/app-framework").AnyCapability[]>>;
5
+ export declare const ReactSurface: (props?: unknown) => Promise<() => Promise<import("@dxos/app-framework").Capability<import("@dxos/app-framework").Capabilities.ReactSurface> | import("@dxos/app-framework").AnyCapability[]>>;
6
6
  export * from './capabilities';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU,oMAAqC,CAAC;AAC7D,eAAO,MAAM,YAAY,kLAAwC,CAAC;AAClE,eAAO,MAAM,cAAc,oLAA0C,CAAC;AACtE,eAAO,MAAM,QAAQ,sNAAmC,CAAC;AACzD,eAAO,MAAM,YAAY,iIAAwC,CAAC;AAElE,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU,mQAAqC,CAAC;AAC7D,eAAO,MAAM,YAAY,iPAAwC,CAAC;AAClE,eAAO,MAAM,cAAc,mPAA0C,CAAC;AACtE,eAAO,MAAM,QAAQ,2PAAmC,CAAC;AACzD,eAAO,MAAM,YAAY,gMAAwC,CAAC;AAElE,cAAc,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,YAAY,EAAkB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;kCAO5E,cAAc;AAAvC,wBAcK"}
1
+ {"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,YAAY,EAAkB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;kCAO5E,cAAc;AAAvC,wBAoBK"}
@@ -1,4 +1,4 @@
1
1
  import { type PluginsContext } from '@dxos/app-framework';
2
- declare const _default: (context: PluginsContext) => import("@dxos/app-framework").Capability<import("packages/plugins/plugin-markdown/dist/types/src/types").MarkdownExtensionProvider[]>;
2
+ declare const _default: (context: PluginsContext) => import("@dxos/app-framework").Capability<import("@dxos/plugin-markdown/types").MarkdownExtensionProvider[]>;
3
3
  export default _default;
4
4
  //# sourceMappingURL=markdown.d.ts.map
@@ -1,8 +1,7 @@
1
- import React from 'react';
2
1
  import { type FileType } from '../types';
3
2
  declare const FileContainer: ({ file, role }: {
4
3
  file: FileType;
5
4
  role: string;
6
- }) => React.JSX.Element | null;
5
+ }) => import("react/jsx-runtime").JSX.Element | null;
7
6
  export default FileContainer;
8
7
  //# sourceMappingURL=FileContainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/FileContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAUnD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,QAAA,MAAM,aAAa,mBAAoB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,6BA2BtE,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"FileContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/FileContainer.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,QAAA,MAAM,aAAa,mBAAoB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,mDA2BtE,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,8 +1,7 @@
1
- import React from 'react';
2
1
  import { type S } from '@dxos/effect';
3
2
  export type FileInputProps = {
4
3
  schema: S.Schema.Any;
5
4
  onChange: (file: File) => void;
6
5
  };
7
- export declare const FileInput: ({ schema, onChange }: FileInputProps) => React.JSX.Element;
6
+ export declare const FileInput: ({ schema, onChange }: FileInputProps) => import("react/jsx-runtime").JSX.Element;
8
7
  //# sourceMappingURL=FileInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileInput.d.ts","sourceRoot":"","sources":["../../../../src/components/FileInput.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAG3C,OAAO,EAAkB,KAAK,CAAC,EAAE,MAAM,cAAc,CAAC;AAOtD,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,SAAS,yBAA0B,cAAc,sBA0B7D,CAAC"}
1
+ {"version":3,"file":"FileInput.d.ts","sourceRoot":"","sources":["../../../../src/components/FileInput.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAkB,KAAK,CAAC,EAAE,MAAM,cAAc,CAAC;AAOtD,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,SAAS,yBAA0B,cAAc,4CA0B7D,CAAC"}
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { type ThemedClassName } from '@dxos/react-ui';
3
2
  export type FilePreviewProps = ThemedClassName<{
4
3
  type: string;
@@ -7,5 +6,5 @@ export type FilePreviewProps = ThemedClassName<{
7
6
  /**
8
7
  * File/content preview iframe.
9
8
  */
10
- export declare const FilePreview: ({ type, url, classNames }: FilePreviewProps) => React.JSX.Element;
9
+ export declare const FilePreview: ({ type, url, classNames }: FilePreviewProps) => import("react/jsx-runtime").JSX.Element;
11
10
  //# sourceMappingURL=FilePreview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilePreview.d.ts","sourceRoot":"","sources":["../../../../src/components/FilePreview.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,WAAW,8BAA+B,gBAAgB,sBAQtE,CAAC"}
1
+ {"version":3,"file":"FilePreview.d.ts","sourceRoot":"","sources":["../../../../src/components/FilePreview.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,WAAW,8BAA+B,gBAAgB,4CAQtE,CAAC"}
@@ -2,6 +2,6 @@ import React from 'react';
2
2
  export declare const FileContainer: React.LazyExoticComponent<({ file, role }: {
3
3
  file: import("../types").FileType;
4
4
  role: string;
5
- }) => React.JSX.Element | null>;
5
+ }) => import("react/jsx-runtime").JSX.Element | null>;
6
6
  export * from './FileInput';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,aAAa;;;+BAA8C,CAAC;AAEzE,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,aAAa;;;qDAA8C,CAAC;AAEzE,cAAc,aAAa,CAAC"}
@@ -1,9 +1,8 @@
1
1
  import '@dxos-theme';
2
- import React from 'react';
3
2
  declare const _default: {
4
3
  title: string;
5
- render: () => React.JSX.Element;
6
- decorators: import("@storybook/react/*").Decorator[];
4
+ render: () => import("react/jsx-runtime").JSX.Element;
5
+ decorators: import("@storybook/react").Decorator[];
7
6
  };
8
7
  export default _default;
9
8
  export declare const Default: {};
@@ -1 +1 @@
1
- {"version":3,"file":"image.stories.d.ts","sourceRoot":"","sources":["../../../../src/extensions/image.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAA8B,MAAM,OAAO,CAAC;;;;;;AAsFnD,wBAIE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
1
+ {"version":3,"file":"image.stories.d.ts","sourceRoot":"","sources":["../../../../src/extensions/image.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;;;;;;AAyFrB,wBAIE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare const WNFS_PLUGIN = "dxos.org/plugin/WNFS";
1
+ export declare const WNFS_PLUGIN = "dxos.org/plugin/wnfs";
2
2
  export declare const meta: {
3
3
  id: string;
4
4
  name: string;
@@ -13,7 +13,7 @@ declare const _default: {
13
13
  'file input placeholder': string;
14
14
  'typename label'?: undefined;
15
15
  };
16
- "dxos.org/plugin/WNFS": {
16
+ "dxos.org/plugin/wnfs": {
17
17
  'plugin name': string;
18
18
  'file title placeholder': string;
19
19
  'delete object label': string;
@@ -1,10 +1,10 @@
1
1
  import { S } from '@dxos/echo-schema';
2
- declare const FileType_base: import("@dxos/echo-schema").TypedObjectPrototype<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
2
+ declare const FileType_base: import("@dxos/echo-schema").TypedObjectPrototype<import("@dxos/echo-schema").TypedObjectFields<{
3
3
  name: S.optional<typeof S.String>;
4
4
  type: typeof S.String;
5
5
  cid: typeof S.String;
6
6
  timestamp: S.optional<typeof S.String>;
7
- }, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>, S.Struct.Encoded<{
7
+ }, import("@dxos/echo-schema").TypedObjectOptions>, S.Struct.Encoded<{
8
8
  name: S.optional<typeof S.String>;
9
9
  type: typeof S.String;
10
10
  cid: typeof S.String;
@@ -1,8 +1,8 @@
1
1
  import { S } from '@dxos/echo-schema';
2
2
  import { FileType } from './file';
3
3
  export declare namespace WnfsAction {
4
- const Create_base: S.TaggedClass<Create, "dxos.org/plugin/WNFS/action/create", {
5
- readonly _tag: S.tag<"dxos.org/plugin/WNFS/action/create">;
4
+ const Create_base: S.TaggedClass<Create, "dxos.org/plugin/wnfs/action/create", {
5
+ readonly _tag: S.tag<"dxos.org/plugin/wnfs/action/create">;
6
6
  } & {
7
7
  input: S.SchemaClass<{
8
8
  readonly name: string;
@@ -24,13 +24,13 @@ export declare namespace WnfsAction {
24
24
  file: S.instanceOf<File>;
25
25
  }>;
26
26
  export type UploadFileForm = S.Schema.Type<typeof UploadFileSchema>;
27
- const Upload_base: S.TaggedClass<Upload, "dxos.org/plugin/WNFS/action/upload", {
28
- readonly _tag: S.tag<"dxos.org/plugin/WNFS/action/upload">;
27
+ const Upload_base: S.TaggedClass<Upload, "dxos.org/plugin/wnfs/action/upload", {
28
+ readonly _tag: S.tag<"dxos.org/plugin/wnfs/action/upload">;
29
29
  } & {
30
30
  input: S.extend<S.Struct<{
31
31
  file: S.instanceOf<File>;
32
32
  }>, S.Struct<{
33
- space: S.Schema<import("@dxos/react-client/echo").Space, import("@dxos/react-client/echo").Space, never>;
33
+ space: S.Schema<import("@dxos/client-protocol").Space, import("@dxos/client-protocol").Space, never>;
34
34
  }>>;
35
35
  output: S.SchemaClass<{
36
36
  readonly name: string;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@dxos/plugin-wnfs",
3
- "version": "0.7.5-main.2567c87",
3
+ "version": "0.7.5-main.5ae2ba8",
4
4
  "description": "WNFS file management plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
7
  "license": "MIT",
8
8
  "author": "DXOS.org",
9
+ "type": "module",
9
10
  "exports": {
10
11
  ".": {
11
12
  "types": "./dist/types/src/index.d.ts",
@@ -36,7 +37,7 @@
36
37
  "blockstore-core": "^5.0.1",
37
38
  "blockstore-idb": "^2.0.0",
38
39
  "debounce": "^2.2.0",
39
- "effect": "^3.12.1",
40
+ "effect": "^3.12.3",
40
41
  "idb-keyval": "^6.2.1",
41
42
  "interface-blockstore": "^5.2.10",
42
43
  "it-all": "^3.0.6",
@@ -44,22 +45,22 @@
44
45
  "react-dropzone": "^14.2.3",
45
46
  "uint8arrays": "^5.1.0",
46
47
  "wnfs": "0.2.2",
47
- "@dxos/app-framework": "0.7.5-main.2567c87",
48
- "@dxos/crypto": "0.7.5-main.2567c87",
49
- "@dxos/effect": "0.7.5-main.2567c87",
50
- "@dxos/invariant": "0.7.5-main.2567c87",
51
- "@dxos/echo-schema": "0.7.5-main.2567c87",
52
- "@dxos/plugin-client": "0.7.5-main.2567c87",
53
- "@dxos/local-storage": "0.7.5-main.2567c87",
54
- "@dxos/log": "0.7.5-main.2567c87",
55
- "@dxos/plugin-markdown": "0.7.5-main.2567c87",
56
- "@dxos/plugin-space": "0.7.5-main.2567c87",
57
- "@dxos/react-client": "0.7.5-main.2567c87",
58
- "@dxos/react-ui": "0.7.5-main.2567c87",
59
- "@dxos/react-ui-form": "0.7.5-main.2567c87",
60
- "@dxos/react-ui-stack": "0.7.5-main.2567c87",
61
- "@dxos/react-ui-editor": "0.7.5-main.2567c87",
62
- "@dxos/util": "0.7.5-main.2567c87"
48
+ "@dxos/crypto": "0.7.5-main.5ae2ba8",
49
+ "@dxos/echo-schema": "0.7.5-main.5ae2ba8",
50
+ "@dxos/app-framework": "0.7.5-main.5ae2ba8",
51
+ "@dxos/effect": "0.7.5-main.5ae2ba8",
52
+ "@dxos/log": "0.7.5-main.5ae2ba8",
53
+ "@dxos/plugin-markdown": "0.7.5-main.5ae2ba8",
54
+ "@dxos/local-storage": "0.7.5-main.5ae2ba8",
55
+ "@dxos/plugin-client": "0.7.5-main.5ae2ba8",
56
+ "@dxos/invariant": "0.7.5-main.5ae2ba8",
57
+ "@dxos/plugin-space": "0.7.5-main.5ae2ba8",
58
+ "@dxos/react-client": "0.7.5-main.5ae2ba8",
59
+ "@dxos/react-ui-editor": "0.7.5-main.5ae2ba8",
60
+ "@dxos/react-ui-form": "0.7.5-main.5ae2ba8",
61
+ "@dxos/react-ui": "0.7.5-main.5ae2ba8",
62
+ "@dxos/react-ui-stack": "0.7.5-main.5ae2ba8",
63
+ "@dxos/util": "0.7.5-main.5ae2ba8"
63
64
  },
64
65
  "devDependencies": {
65
66
  "@phosphor-icons/react": "^2.1.5",
@@ -68,16 +69,16 @@
68
69
  "react": "~18.2.0",
69
70
  "react-dom": "~18.2.0",
70
71
  "vite": "5.4.7",
71
- "@dxos/random": "0.7.5-main.2567c87",
72
- "@dxos/react-ui-theme": "0.7.5-main.2567c87",
73
- "@dxos/storybook-utils": "0.7.5-main.2567c87"
72
+ "@dxos/random": "0.7.5-main.5ae2ba8",
73
+ "@dxos/react-ui-theme": "0.7.5-main.5ae2ba8",
74
+ "@dxos/storybook-utils": "0.7.5-main.5ae2ba8"
74
75
  },
75
76
  "peerDependencies": {
76
77
  "@phosphor-icons/react": "^2.0.5",
77
78
  "react": "~18.2.0",
78
79
  "react-dom": "~18.2.0",
79
- "@dxos/react-ui": "0.7.5-main.2567c87",
80
- "@dxos/react-ui-theme": "0.7.5-main.2567c87"
80
+ "@dxos/react-ui-theme": "0.7.5-main.5ae2ba8",
81
+ "@dxos/react-ui": "0.7.5-main.5ae2ba8"
81
82
  },
82
83
  "publishConfig": {
83
84
  "access": "public"
@@ -12,10 +12,11 @@ import {
12
12
  createIntent,
13
13
  defineModule,
14
14
  definePlugin,
15
- oneOf,
16
15
  } from '@dxos/app-framework';
17
- import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
18
- import { type Space } from '@dxos/react-client/echo';
16
+ import { ClientEvents } from '@dxos/plugin-client';
17
+ import { MarkdownEvents } from '@dxos/plugin-markdown';
18
+ import { SpaceCapabilities } from '@dxos/plugin-space';
19
+ import { defineObjectForm } from '@dxos/plugin-space/types';
19
20
 
20
21
  import { Blockstore, FileUploader, IntentResolver, Markdown, ReactSurface, WnfsCapabilities } from './capabilities';
21
22
  import { meta, WNFS_PLUGIN } from './meta';
@@ -31,7 +32,7 @@ export const WnfsPlugin = () =>
31
32
  }),
32
33
  defineModule({
33
34
  id: `${meta.id}/module/instances`,
34
- activatesOn: Events.Startup,
35
+ activatesOn: ClientEvents.ClientReady,
35
36
  activate: () => {
36
37
  const instances: WnfsCapabilities.Instances = {};
37
38
  return contributes(WnfsCapabilities.Instances, instances);
@@ -44,14 +45,11 @@ export const WnfsPlugin = () =>
44
45
  }),
45
46
  defineModule({
46
47
  id: `${meta.id}/module/metadata`,
47
- activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),
48
+ activatesOn: Events.SetupMetadata,
48
49
  activate: () =>
49
50
  contributes(Capabilities.Metadata, {
50
51
  id: FileType.typename,
51
52
  metadata: {
52
- creationSchema: WnfsAction.UploadFileSchema,
53
- createObject: ({ file }: WnfsAction.UploadFileForm, { space }: { space: Space }) =>
54
- pipe(createIntent(WnfsAction.Upload, { file, space }), chain(WnfsAction.Create, {})),
55
53
  label: (object: any) => (object instanceof FileType ? object.name : undefined),
56
54
  placeholder: ['file title placeholder', { ns: WNFS_PLUGIN }],
57
55
  // TODO(wittjosiah): Would be nice if icon could change based on the type of the file.
@@ -60,9 +58,18 @@ export const WnfsPlugin = () =>
60
58
  }),
61
59
  }),
62
60
  defineModule({
63
- id: `${meta.id}/module/schema`,
64
- activatesOn: ClientEvents.SetupClient,
65
- activate: () => contributes(ClientCapabilities.Schema, [FileType]),
61
+ id: `${meta.id}/module/object-form`,
62
+ activatesOn: ClientEvents.SetupSchema,
63
+ activate: () =>
64
+ contributes(
65
+ SpaceCapabilities.ObjectForm,
66
+ defineObjectForm({
67
+ objectSchema: FileType,
68
+ formSchema: WnfsAction.UploadFileSchema,
69
+ getIntent: (props, options) =>
70
+ pipe(createIntent(WnfsAction.Upload, { ...props, space: options.space }), chain(WnfsAction.Create, {})),
71
+ }),
72
+ ),
66
73
  }),
67
74
  defineModule({
68
75
  id: `${meta.id}/module/file-uploader`,
@@ -71,17 +78,17 @@ export const WnfsPlugin = () =>
71
78
  }),
72
79
  defineModule({
73
80
  id: `${meta.id}/module/markdown`,
74
- activatesOn: Events.Startup,
81
+ activatesOn: MarkdownEvents.SetupExtensions,
75
82
  activate: Markdown,
76
83
  }),
77
84
  defineModule({
78
85
  id: `${meta.id}/module/react-surface`,
79
- activatesOn: Events.Startup,
86
+ activatesOn: Events.SetupReactSurface,
80
87
  activate: ReactSurface,
81
88
  }),
82
89
  defineModule({
83
90
  id: `${meta.id}/module/intent-resolver`,
84
- activatesOn: Events.SetupIntents,
91
+ activatesOn: Events.SetupIntentResolver,
85
92
  activate: IntentResolver,
86
93
  }),
87
94
  ]);
package/src/blockstore.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { CarWriter } from '@ipld/car';
6
- import type { Block } from '@ipld/car/api';
6
+ import type { Block } from '@ipld/car/reader';
7
7
  import { BaseBlockstore } from 'blockstore-core';
8
8
  import { IDBBlockstore } from 'blockstore-idb';
9
9
  import debounce from 'debounce';
@@ -170,17 +170,9 @@ export class MixedBlockstore extends BaseBlockstore {
170
170
  }),
171
171
  );
172
172
 
173
- // TODO: Create & submit CAR
174
- // DEPENDS ON EDGE BLOB-SERVICE CHANGES
175
- // const car = await this.#createCar(blocks);
176
- // await this.putCarRemote(car);
177
- //
178
- // Temporary solution:
179
- await Promise.all(
180
- blocks.map((block: Block) => {
181
- return this.putRemote(block.cid, block.bytes);
182
- }),
183
- );
173
+ // Create & submit CAR
174
+ const car = await this.#createCar(blocks);
175
+ await this.putCarRemote(car);
184
176
 
185
177
  // Adjust queue
186
178
  const queue = [...this.#queue].filter((k) => {
@@ -13,14 +13,20 @@ export default (context: PluginsContext) =>
13
13
  contributes(Capabilities.IntentResolver, [
14
14
  // TODO(wittjosiah): Deleting the object doesn't delete the wnfs blob.
15
15
  // Consider ways to trigger blob deletion based on object deletion and/or adding file system manager.
16
- createResolver(WnfsAction.Create, ({ name, type, cid }) => ({
17
- data: {
18
- object: create(FileType, { name, type, cid }),
16
+ createResolver({
17
+ intent: WnfsAction.Create,
18
+ resolve: ({ name, type, cid }) => ({
19
+ data: {
20
+ object: create(FileType, { name, type, cid }),
21
+ },
22
+ }),
23
+ }),
24
+ createResolver({
25
+ intent: WnfsAction.Upload,
26
+ resolve: async ({ file, space }) => {
27
+ const blockstore = context.requestCapability(WnfsCapabilities.Blockstore);
28
+ const info = await upload({ file, blockstore, space });
29
+ return { data: info };
19
30
  },
20
- })),
21
- createResolver(WnfsAction.Upload, async ({ file, space }) => {
22
- const blockstore = context.requestCapability(WnfsCapabilities.Blockstore);
23
- const info = await upload({ file, blockstore, space });
24
- return { data: info };
25
31
  }),
26
32
  ]);
@@ -29,9 +29,9 @@ export default () =>
29
29
  return !!annotation;
30
30
  },
31
31
  component: ({ data: { prop, schema }, ...props }) => {
32
- const inputProps = props as unknown as InputProps<any>;
32
+ const inputProps = props as unknown as InputProps;
33
33
  const handleChange = useCallback(
34
- (file: File) => inputProps.onValueChange?.(prop, 'object', file),
34
+ (file: File) => inputProps.onValueChange?.('object', file),
35
35
  [prop, inputProps.onValueChange],
36
36
  );
37
37
 
@@ -4,7 +4,6 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- // Lazily load components for content surfaces.
8
7
  export const FileContainer = React.lazy(() => import('./FileContainer'));
9
8
 
10
9
  export * from './FileInput';
package/src/meta.ts CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
- export const WNFS_PLUGIN = 'dxos.org/plugin/WNFS';
7
+ export const WNFS_PLUGIN = 'dxos.org/plugin/wnfs';
8
8
 
9
9
  export const meta = {
10
10
  id: WNFS_PLUGIN,
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/blockstore.ts", "../../../src/blockstore.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, type PluginsContext } from '@dxos/app-framework';\nimport { ClientCapabilities } from '@dxos/plugin-client';\n\nimport { WnfsCapabilities } from './capabilities';\nimport * as Blockstore from '../blockstore';\n\nexport default async (context: PluginsContext) => {\n const client = context.requestCapability(ClientCapabilities.Client);\n const apiHost = client.config.values.runtime?.services?.edge?.url || 'http://localhost:8787';\n const blockstore = Blockstore.create(apiHost);\n await blockstore.open();\n\n return contributes(WnfsCapabilities.Blockstore, blockstore);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { CarWriter } from '@ipld/car';\nimport type { Block } from '@ipld/car/api';\nimport { BaseBlockstore } from 'blockstore-core';\nimport { IDBBlockstore } from 'blockstore-idb';\nimport debounce from 'debounce';\nimport * as IDB from 'idb-keyval';\nimport all from 'it-all';\nimport { CID } from 'multiformats';\nimport * as Uint8Arrays from 'uint8arrays';\n\nimport { storeName } from './helpers';\n\nexport const create = (apiHost?: string) => {\n return new MixedBlockstore(apiHost);\n};\n\n/**\n * A blockstore that communicates with the DXOS blob service,\n * and which uses an indexedDB blockstore as a client cache.\n */\nexport class MixedBlockstore extends BaseBlockstore {\n readonly #apiHost: string | undefined;\n readonly #localStore: IDBBlockstore;\n\n #isConnected: boolean;\n #flushQueue: () => void;\n #queue: string[];\n\n constructor(apiHost?: string) {\n super();\n\n this.#apiHost = apiHost ? apiHost.replace(/\\/?$/, '') : undefined;\n this.#localStore = new IDBBlockstore(storeName());\n this.#isConnected = navigator.onLine;\n this.#queue = [];\n\n this.#flushQueue = debounce(this.#flushQueueInt, 5000);\n }\n\n async open() {\n await this.#localStore.open();\n await this.#restoreQueue();\n\n window.addEventListener('offline', async () => {\n this.#isConnected = false;\n });\n\n window.addEventListener('online', async () => {\n this.#isConnected = true;\n this.#flushQueue();\n });\n }\n\n url(apiHost: string, cid?: CID) {\n const path = cid ? cid.toString() : '';\n return `${apiHost}/api/file${path.length ? '/' + path : ''}`;\n }\n\n // BLOCKSTORE IMPLEMENTATION\n\n override async delete(key: CID): Promise<void> {\n await this.#localStore.delete(key);\n\n if (this.#isConnected && this.#apiHost) {\n await fetch(this.url(this.#apiHost, key), {\n method: 'DELETE',\n });\n }\n }\n\n override async get(key: CID): Promise<Uint8Array> {\n if (await this.#localStore.has(key)) {\n return await this.#localStore.get(key);\n }\n\n if (this.#isConnected && this.#apiHost) {\n const block = await fetch(this.url(this.#apiHost, key), {\n method: 'GET',\n })\n .then((r) => r.arrayBuffer())\n .then((r) => new Uint8Array(r));\n\n // Make sure it is cached locally\n await this.#localStore.put(key, block);\n\n return block;\n }\n\n return await this.#localStore.get(key);\n }\n\n override async has(key: CID): Promise<boolean> {\n if (await this.#localStore.has(key)) {\n return true;\n }\n\n if (this.#isConnected && this.#apiHost) {\n return await fetch(this.url(this.#apiHost, key), {\n method: 'HEAD',\n }).then((r) => r.ok);\n }\n\n return false;\n }\n\n override async put(key: CID, val: Uint8Array): Promise<CID> {\n await this.#localStore.put(key, val);\n\n await this.#addToQueue(key);\n this.#flushQueue();\n\n return key;\n }\n\n async destroy(): Promise<void> {\n await this.#localStore.destroy();\n }\n\n // REMOTE\n\n async putRemote(key: CID, val: Uint8Array) {\n if (this.#apiHost) {\n await fetch(this.url(this.#apiHost, key), {\n method: 'POST',\n body: val,\n });\n }\n }\n\n async putCarRemote(car: Uint8Array) {\n if (this.#apiHost) {\n await fetch(this.url(this.#apiHost), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/vnd.ipld.car',\n },\n body: car,\n });\n }\n }\n\n // QUEUE\n\n readonly queueCacheName = `${storeName()}/state/queue`;\n\n async #addToQueue(key: CID) {\n await this.#saveQueue([...this.#queue, key.toString()]);\n }\n\n async #flushQueueInt() {\n if (!this.#isConnected || !this.#apiHost) {\n return;\n }\n\n const keys = [...this.#queue];\n if (keys.length === 0) {\n return;\n }\n\n // Collect blocks\n const blocks = await Promise.all(\n keys.map(async (key) => {\n const cid = CID.parse(key);\n const bytes = await this.#localStore.get(cid);\n return { cid, bytes };\n }),\n );\n\n // TODO: Create & submit CAR\n // DEPENDS ON EDGE BLOB-SERVICE CHANGES\n // const car = await this.#createCar(blocks);\n // await this.putCarRemote(car);\n //\n // Temporary solution:\n await Promise.all(\n blocks.map((block: Block) => {\n return this.putRemote(block.cid, block.bytes);\n }),\n );\n\n // Adjust queue\n const queue = [...this.#queue].filter((k) => {\n if (keys.includes(k)) {\n return false;\n }\n\n return true;\n });\n\n await this.#saveQueue(queue);\n }\n\n async #restoreQueue() {\n const fromCache = await IDB.get(this.queueCacheName);\n if (fromCache && Array.isArray(fromCache)) {\n this.#queue = fromCache;\n this.#flushQueue();\n }\n }\n\n async #saveQueue(items: string[]) {\n const arr = [...items];\n this.#queue = arr;\n await IDB.set(this.queueCacheName, arr);\n }\n\n // 🛠️\n\n async #createCar(blocks: Block[]) {\n const { writer, out } = CarWriter.create();\n const outPromise = all(out);\n\n await Promise.all(\n blocks.map((block) => {\n return writer.put(block);\n }),\n );\n\n await writer.close();\n return Uint8Arrays.concat(await outPromise);\n }\n}\n"],
5
- "mappings": "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",
6
- "names": ["contributes", "ClientCapabilities", "CarWriter", "BaseBlockstore", "IDBBlockstore", "debounce", "IDB", "all", "CID", "Uint8Arrays", "create", "apiHost", "MixedBlockstore", "BaseBlockstore", "constructor", "queueCacheName", "storeName", "replace", "undefined", "IDBBlockstore", "navigator", "onLine", "debounce", "open", "window", "addEventListener", "url", "cid", "path", "toString", "length", "delete", "key", "fetch", "method", "get", "has", "block", "then", "r", "arrayBuffer", "Uint8Array", "put", "ok", "val", "destroy", "putRemote", "body", "putCarRemote", "car", "headers", "keys", "blocks", "Promise", "all", "map", "CID", "parse", "bytes", "queue", "filter", "k", "includes", "fromCache", "Array", "isArray", "items", "arr", "set", "writer", "out", "CarWriter", "outPromise", "close", "concat", "context", "client", "requestCapability", "ClientCapabilities", "Client", "apiHost", "config", "values", "runtime", "services", "edge", "url", "blockstore", "create", "open", "contributes", "WnfsCapabilities", "Blockstore"]
7
- }
@@ -1,16 +0,0 @@
1
- // packages/plugins/plugin-wnfs/src/capabilities/index.ts
2
- import { lazy } from "@dxos/app-framework";
3
- var Blockstore = lazy(() => import("./blockstore-6U5XTSIH.mjs"));
4
- var FileUploader = lazy(() => import("./file-uploader-EDHMSKYS.mjs"));
5
- var IntentResolver = lazy(() => import("./intent-resolver-WDO4EIG3.mjs"));
6
- var Markdown = lazy(() => import("./markdown-MGSH5CVQ.mjs"));
7
- var ReactSurface = lazy(() => import("./react-surface-EBQICOUA.mjs"));
8
-
9
- export {
10
- Blockstore,
11
- FileUploader,
12
- IntentResolver,
13
- Markdown,
14
- ReactSurface
15
- };
16
- //# sourceMappingURL=chunk-YLGCDZV3.mjs.map