@dxos/plugin-wnfs 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-BM3MEFES.mjs +69 -0
- package/dist/lib/browser/chunk-BM3MEFES.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NCTUASHL.mjs → chunk-N6Y4QPNF.mjs} +15 -32
- package/dist/lib/browser/chunk-N6Y4QPNF.mjs.map +7 -0
- package/dist/lib/browser/chunk-VXUCZHVZ.mjs +69 -0
- package/dist/lib/browser/chunk-VXUCZHVZ.mjs.map +7 -0
- package/dist/lib/browser/create-NOHKWE67.mjs +24 -0
- package/dist/lib/browser/create-NOHKWE67.mjs.map +7 -0
- package/dist/lib/browser/create-file-N7ADCFOF.mjs +49 -0
- package/dist/lib/browser/create-file-N7ADCFOF.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +71 -70
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -5
- package/dist/lib/browser/upload-DA7GBOXF.mjs +42 -0
- package/dist/lib/browser/upload-DA7GBOXF.mjs.map +7 -0
- package/dist/types/src/WnfsPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/blockstore.d.ts +5 -0
- package/dist/types/src/capabilities/blockstore.d.ts.map +1 -0
- package/dist/types/src/capabilities/file-uploader.d.ts +6 -0
- package/dist/types/src/capabilities/file-uploader.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/FileInput/FileInput.d.ts.map +1 -0
- package/dist/types/src/components/FileInput/index.d.ts +2 -0
- package/dist/types/src/components/FileInput/index.d.ts.map +1 -0
- package/dist/types/src/components/FilePreview/FilePreview.d.ts +12 -0
- package/dist/types/src/components/FilePreview/FilePreview.d.ts.map +1 -0
- package/dist/types/src/components/FilePreview/index.d.ts +2 -0
- package/dist/types/src/components/FilePreview/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/FileContainer/FileContainer.d.ts +7 -0
- package/dist/types/src/containers/FileContainer/FileContainer.d.ts.map +1 -0
- package/dist/types/src/containers/FileContainer/index.d.ts +2 -0
- package/dist/types/src/containers/FileContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/extensions/image.d.ts +1 -1
- package/dist/types/src/extensions/image.d.ts.map +1 -1
- package/dist/types/src/extensions/image.stories.d.ts.map +1 -1
- package/dist/types/src/helpers/load.d.ts +1 -1
- package/dist/types/src/helpers/load.d.ts.map +1 -1
- package/dist/types/src/helpers/upload.d.ts +1 -1
- package/dist/types/src/helpers/upload.d.ts.map +1 -1
- package/dist/types/src/operations/create-file.d.ts +5 -0
- package/dist/types/src/operations/create-file.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +38 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/upload.d.ts +5 -0
- package/dist/types/src/operations/upload.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +13 -12
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/File.d.ts +1 -1
- package/dist/types/src/types/File.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +1 -104
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +47 -30
- package/src/WnfsPlugin.tsx +36 -36
- package/src/blockstore.ts +1 -1
- package/src/capabilities/{blockstore/blockstore.ts → blockstore.ts} +4 -3
- package/src/capabilities/{file-uploader/file-uploader.ts → file-uploader.ts} +6 -5
- package/src/capabilities/index.ts +11 -5
- package/src/capabilities/{markdown/markdown.ts → markdown.ts} +3 -2
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +13 -11
- package/src/components/{FileInput.tsx → FileInput/FileInput.tsx} +5 -5
- package/src/components/FileInput/index.ts +5 -0
- package/src/components/FilePreview/FilePreview.tsx +43 -0
- package/src/components/FilePreview/index.ts +5 -0
- package/src/components/index.ts +1 -4
- package/src/{components → containers/FileContainer}/FileContainer.tsx +12 -11
- package/src/containers/FileContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/extensions/image.stories.tsx +9 -10
- package/src/extensions/image.tsx +2 -1
- package/src/helpers/load.ts +6 -6
- package/src/helpers/upload.ts +3 -3
- package/src/meta.ts +1 -1
- package/src/operations/create-file.ts +31 -0
- package/src/operations/create.ts +22 -0
- package/src/operations/definitions.ts +41 -0
- package/src/operations/index.ts +13 -0
- package/src/operations/upload.ts +29 -0
- package/src/translations.ts +13 -12
- package/src/types/File.ts +6 -2
- package/src/types/capabilities.ts +3 -3
- package/src/types/types.ts +3 -59
- package/dist/lib/browser/FileContainer-O5YFSIWV.mjs +0 -91
- package/dist/lib/browser/FileContainer-O5YFSIWV.mjs.map +0 -7
- package/dist/lib/browser/blockstore-KKFOALUH.mjs +0 -191
- package/dist/lib/browser/blockstore-KKFOALUH.mjs.map +0 -7
- package/dist/lib/browser/chunk-GXXEH7H6.mjs +0 -154
- package/dist/lib/browser/chunk-GXXEH7H6.mjs.map +0 -7
- package/dist/lib/browser/chunk-NCTUASHL.mjs.map +0 -7
- package/dist/lib/browser/file-uploader-BUHAXRSV.mjs +0 -34
- package/dist/lib/browser/file-uploader-BUHAXRSV.mjs.map +0 -7
- package/dist/lib/browser/markdown-BRT2MN6C.mjs +0 -201
- package/dist/lib/browser/markdown-BRT2MN6C.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-F6GUL54A.mjs +0 -99
- package/dist/lib/browser/operation-resolver-F6GUL54A.mjs.map +0 -7
- package/dist/lib/browser/react-surface-UNAYSIAC.mjs +0 -81
- package/dist/lib/browser/react-surface-UNAYSIAC.mjs.map +0 -7
- package/dist/types/src/capabilities/blockstore/blockstore.d.ts +0 -5
- package/dist/types/src/capabilities/blockstore/blockstore.d.ts.map +0 -1
- package/dist/types/src/capabilities/blockstore/index.d.ts +0 -3
- package/dist/types/src/capabilities/blockstore/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/file-uploader/file-uploader.d.ts +0 -5
- package/dist/types/src/capabilities/file-uploader/file-uploader.d.ts.map +0 -1
- package/dist/types/src/capabilities/file-uploader/index.d.ts +0 -3
- package/dist/types/src/capabilities/file-uploader/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/index.d.ts +0 -3
- package/dist/types/src/capabilities/markdown/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/markdown.d.ts +0 -5
- package/dist/types/src/capabilities/markdown/markdown.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/FileContainer.d.ts +0 -7
- package/dist/types/src/components/FileContainer.d.ts.map +0 -1
- package/dist/types/src/components/FileInput.d.ts.map +0 -1
- package/dist/types/src/components/FilePreview.d.ts +0 -11
- package/dist/types/src/components/FilePreview.d.ts.map +0 -1
- package/src/capabilities/blockstore/index.ts +0 -7
- package/src/capabilities/file-uploader/index.ts +0 -7
- package/src/capabilities/markdown/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -62
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/components/FilePreview.tsx +0 -23
- /package/dist/types/src/components/{FileInput.d.ts → FileInput/FileInput.d.ts} +0 -0
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
File_exports,
|
|
3
|
-
WnfsAction,
|
|
4
|
-
meta
|
|
5
|
-
} from "./chunk-GXXEH7H6.mjs";
|
|
6
|
-
|
|
7
|
-
// src/capabilities/react-surface/react-surface.tsx
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
|
-
import React2, { useCallback as useCallback2 } from "react";
|
|
10
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
11
|
-
import { Obj } from "@dxos/echo";
|
|
12
|
-
import { findAnnotation as findAnnotation2 } from "@dxos/effect";
|
|
13
|
-
|
|
14
|
-
// src/components/index.ts
|
|
15
|
-
import { lazy } from "react";
|
|
16
|
-
|
|
17
|
-
// src/components/FileInput.tsx
|
|
18
|
-
import React, { useCallback } from "react";
|
|
19
|
-
import { useDropzone } from "react-dropzone";
|
|
20
|
-
import { findAnnotation } from "@dxos/effect";
|
|
21
|
-
import { useTranslation } from "@dxos/react-ui";
|
|
22
|
-
import { mx } from "@dxos/ui-theme";
|
|
23
|
-
var FileInput = ({ schema, onChange }) => {
|
|
24
|
-
const { t } = useTranslation(meta.id);
|
|
25
|
-
const accept = findAnnotation(schema.ast, WnfsAction.UploadAnnotationId);
|
|
26
|
-
const onDropAccepted = useCallback((files) => onChange?.(files[0]), [
|
|
27
|
-
onChange
|
|
28
|
-
]);
|
|
29
|
-
const { acceptedFiles, getRootProps, getInputProps, isFocused, isDragAccept, isDragReject } = useDropzone({
|
|
30
|
-
multiple: false,
|
|
31
|
-
accept,
|
|
32
|
-
onDropAccepted
|
|
33
|
-
});
|
|
34
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
35
|
-
...getRootProps(),
|
|
36
|
-
className: mx("flex flex-col items-center p-8 border border-separator", isFocused && "focus-ring", isDragAccept && "bg-attention", isDragReject && "border-roseFill")
|
|
37
|
-
}, /* @__PURE__ */ React.createElement("input", getInputProps()), acceptedFiles[0] ? /* @__PURE__ */ React.createElement("p", null, acceptedFiles[0].name) : /* @__PURE__ */ React.createElement("p", null, t("file input placeholder")));
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// src/components/index.ts
|
|
41
|
-
var FileContainer = lazy(() => import("./FileContainer-O5YFSIWV.mjs"));
|
|
42
|
-
|
|
43
|
-
// src/capabilities/react-surface/react-surface.tsx
|
|
44
|
-
var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Common.Capability.ReactSurface, [
|
|
45
|
-
Common.createSurface({
|
|
46
|
-
id: `${meta.id}/article`,
|
|
47
|
-
role: [
|
|
48
|
-
"article",
|
|
49
|
-
"section",
|
|
50
|
-
"slide"
|
|
51
|
-
],
|
|
52
|
-
filter: (data) => Obj.instanceOf(File_exports.File, data.subject),
|
|
53
|
-
component: ({ data, role }) => /* @__PURE__ */ React2.createElement(FileContainer, {
|
|
54
|
-
role,
|
|
55
|
-
subject: data.subject
|
|
56
|
-
})
|
|
57
|
-
}),
|
|
58
|
-
Common.createSurface({
|
|
59
|
-
id: `${meta.id}/create-form`,
|
|
60
|
-
role: "form-input",
|
|
61
|
-
filter: (data) => {
|
|
62
|
-
const annotation = findAnnotation2(data.schema.ast, WnfsAction.UploadAnnotationId);
|
|
63
|
-
return !!annotation;
|
|
64
|
-
},
|
|
65
|
-
component: ({ data: { schema }, ...props }) => {
|
|
66
|
-
const inputProps = props;
|
|
67
|
-
const handleChange = useCallback2((file) => inputProps.onValueChange?.(inputProps.type, file), [
|
|
68
|
-
inputProps.type,
|
|
69
|
-
inputProps.onValueChange
|
|
70
|
-
]);
|
|
71
|
-
return /* @__PURE__ */ React2.createElement(FileInput, {
|
|
72
|
-
schema,
|
|
73
|
-
onChange: handleChange
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
])));
|
|
78
|
-
export {
|
|
79
|
-
react_surface_default as default
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=react-surface-UNAYSIAC.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface/react-surface.tsx", "../../../src/components/index.ts", "../../../src/components/FileInput.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport type * as Schema from 'effect/Schema';\nimport React, { useCallback } from 'react';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { findAnnotation } from '@dxos/effect';\nimport { type FormFieldComponentProps } from '@dxos/react-ui-form';\n\nimport { FileContainer, FileInput } from '../../components';\nimport { meta } from '../../meta';\nimport { WnfsAction, WnfsFile } from '../../types';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Common.Capability.ReactSurface, [\n Common.createSurface({\n id: `${meta.id}/article`,\n role: ['article', 'section', 'slide'],\n filter: (data): data is { subject: WnfsFile.File } => Obj.instanceOf(WnfsFile.File, data.subject),\n component: ({ data, role }) => <FileContainer role={role} subject={data.subject} />,\n }),\n Common.createSurface({\n id: `${meta.id}/create-form`,\n role: 'form-input',\n filter: (data): data is { prop: string; schema: Schema.Schema.Any } => {\n const annotation = findAnnotation<boolean>(\n (data.schema as Schema.Schema.All).ast,\n WnfsAction.UploadAnnotationId,\n );\n return !!annotation;\n },\n component: ({ data: { schema }, ...props }) => {\n const inputProps = props as unknown as FormFieldComponentProps;\n const handleChange = useCallback(\n (file: File) => inputProps.onValueChange?.(inputProps.type, file),\n [inputProps.type, inputProps.onValueChange],\n );\n\n return <FileInput schema={schema} onChange={handleChange} />;\n },\n }),\n ]),\n ),\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport const FileContainer = lazy(() => import('./FileContainer'));\n\nexport * from './FileInput';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Schema from 'effect/Schema';\nimport React, { useCallback } from 'react';\nimport { useDropzone } from 'react-dropzone';\n\nimport { findAnnotation } from '@dxos/effect';\nimport { useTranslation } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { meta } from '../meta';\nimport { WnfsAction } from '../types';\n\nexport type FileInputProps = {\n schema: Schema.Schema.Any;\n onChange: (file: File) => void;\n};\n\nexport const FileInput = ({ schema, onChange }: FileInputProps) => {\n const { t } = useTranslation(meta.id);\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-roseFill',\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,YAAYA,YAAY;AAExB,OAAOC,UAASC,eAAAA,oBAAmB;AAEnC,SAASC,YAAYC,cAAc;AACnC,SAASC,WAAW;AACpB,SAASC,kBAAAA,uBAAsB;;;ACN/B,SAASC,YAAY;;;ACCrB,OAAOC,SAASC,mBAAmB;AACnC,SAASC,mBAAmB;AAE5B,SAASC,sBAAsB;AAC/B,SAASC,sBAAsB;AAC/B,SAASC,UAAU;AAUZ,IAAMC,YAAY,CAAC,EAAEC,QAAQC,SAAQ,MAAkB;AAC5D,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,QAAMC,SAASC,eAAyCP,OAAOQ,KAAKC,WAAWC,kBAAkB;AAEjG,QAAMC,iBAAiBC,YAAY,CAACC,UAAkBZ,WAAWY,MAAM,CAAA,CAAE,GAAG;IAACZ;GAAS;AAEtF,QAAM,EAAEa,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,iBAAA;KAGlB,sBAAA,cAACM,SAAUT,cAAAA,CAAAA,GACVF,cAAc,CAAA,IAAK,sBAAA,cAACY,KAAAA,MAAGZ,cAAc,CAAA,EAAGa,IAAI,IAAQ,sBAAA,cAACD,KAAAA,MAAGxB,EAAE,wBAAA,CAAA,CAAA;AAGjE;;;ADxCO,IAAM0B,gBAAgBC,KAAK,MAAM,OAAO,8BAAA,CAAA;;;ADW/C,IAAA,wBAAeC,WAAWC,WAAW,MAC5BC,eACLF,WAAWG,YAAYC,OAAOJ,WAAWK,cAAc;EACrDD,OAAOE,cAAc;IACnBC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;MAAC;MAAW;MAAW;;IAC7BC,QAAQ,CAACC,SAA6CC,IAAIC,WAAWC,aAASC,MAAMJ,KAAKK,OAAO;IAChGC,WAAW,CAAC,EAAEN,MAAMF,KAAI,MAAO,gBAAAS,OAAA,cAACC,eAAAA;MAAcV;MAAYO,SAASL,KAAKK;;EAC1E,CAAA;EACAZ,OAAOE,cAAc;IACnBC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAAA;AACP,YAAMS,aAAaC,gBAChBV,KAAKW,OAA6BC,KACnCC,WAAWC,kBAAkB;AAE/B,aAAO,CAAC,CAACL;IACX;IACAH,WAAW,CAAC,EAAEN,MAAM,EAAEW,OAAM,GAAI,GAAGI,MAAAA,MAAO;AACxC,YAAMC,aAAaD;AACnB,YAAME,eAAeC,aACnB,CAACC,SAAeH,WAAWI,gBAAgBJ,WAAWK,MAAMF,IAAAA,GAC5D;QAACH,WAAWK;QAAML,WAAWI;OAAc;AAG7C,aAAO,gBAAAb,OAAA,cAACe,WAAAA;QAAUX;QAAgBY,UAAUN;;IAC9C;EACF,CAAA;CACD,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "React", "useCallback", "Capability", "Common", "Obj", "findAnnotation", "lazy", "React", "useCallback", "useDropzone", "findAnnotation", "useTranslation", "mx", "FileInput", "schema", "onChange", "t", "useTranslation", "meta", "id", "accept", "findAnnotation", "ast", "WnfsAction", "UploadAnnotationId", "onDropAccepted", "useCallback", "files", "acceptedFiles", "getRootProps", "getInputProps", "isFocused", "isDragAccept", "isDragReject", "useDropzone", "multiple", "div", "className", "mx", "input", "p", "name", "FileContainer", "lazy", "Capability", "makeModule", "succeed", "contributes", "Common", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "WnfsFile", "File", "subject", "component", "React", "FileContainer", "annotation", "findAnnotation", "schema", "ast", "WnfsAction", "UploadAnnotationId", "props", "inputProps", "handleChange", "useCallback", "file", "onValueChange", "type", "FileInput", "onChange"]
|
|
7
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<import("interface-blockstore").Blockstore<{}, {}, {}, {}, {}, {}, {}, {}>>>, Error, Capability.Service>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=blockstore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blockstore.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/blockstore/blockstore.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;;AAMjD,wBASE"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Capability } from '@dxos/app-framework';
|
|
2
|
-
export declare const Blockstore: Capability.LazyCapability<void, Capability.Capability<Capability.InterfaceDef<import("interface-blockstore").Blockstore<{}, {}, {}, {}, {}, {}, {}, {}>>>, Error>;
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/blockstore/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,UAAU,mKAA8D,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Common.Capability.FileUploader>>, never, Capability.Service>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=file-uploader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-uploader.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/file-uploader/file-uploader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;;AAMzD,wBAoBE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/file-uploader/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,YAAY,sJAAmE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/markdown/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,QAAQ,qJAA0D,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<import("@dxos/plugin-markdown").MarkdownExtensionProvider[]>>, never, Capability.Service>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/markdown/markdown.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;;AAOjD,wBAmBE"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Capability } from '@dxos/app-framework';
|
|
2
|
-
export declare const OperationResolver: Capability.LazyCapability<void, Capability.Capability<Capability.InterfaceDef<import("@dxos/app-framework/Common").Capability.OperationResolver[]>>, Error>;
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/operation-resolver/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,6JAA6E,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Common.Capability.OperationResolver[]>>, never, never>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=operation-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-resolver.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/operation-resolver/operation-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;;AAUzD,wBA6CE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,YAAY,sJAAmE,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Common.Capability.ReactSurface>>, never, never>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=react-surface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/react-surface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;;AASzD,wBA+BE"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
3
|
-
import { type WnfsFile } from '../types';
|
|
4
|
-
export type FileContainerProps = SurfaceComponentProps<WnfsFile.File>;
|
|
5
|
-
export declare const FileContainer: ({ role, subject: file }: FileContainerProps) => React.JSX.Element | null;
|
|
6
|
-
export default FileContainer;
|
|
7
|
-
//# sourceMappingURL=FileContainer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/FileContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,KAAK,qBAAqB,EAAiB,MAAM,2BAA2B,CAAC;AAQtF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzC,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAEtE,eAAO,MAAM,aAAa,GAAI,yBAAyB,kBAAkB,6BAiCxE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.d.ts","sourceRoot":"","sources":["../../../../src/components/FileInput.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAsB,MAAM,OAAO,CAAC;AAU3C,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,sBAAsB,cAAc,sBA0B7D,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
|
-
export type FilePreviewProps = ThemedClassName<{
|
|
4
|
-
type: string;
|
|
5
|
-
url: string;
|
|
6
|
-
}>;
|
|
7
|
-
/**
|
|
8
|
-
* File/content preview iframe.
|
|
9
|
-
*/
|
|
10
|
-
export declare const FilePreview: ({ type, url, classNames }: FilePreviewProps) => React.JSX.Element;
|
|
11
|
-
//# sourceMappingURL=FilePreview.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,GAAI,2BAA2B,gBAAgB,sBAQtE,CAAC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
-
import { Obj, Ref, Type } from '@dxos/echo';
|
|
9
|
-
import { invariant } from '@dxos/invariant';
|
|
10
|
-
import { OperationResolver } from '@dxos/operation';
|
|
11
|
-
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
12
|
-
import { Collection } from '@dxos/schema';
|
|
13
|
-
|
|
14
|
-
import { upload } from '../../helpers';
|
|
15
|
-
import { WnfsCapabilities, WnfsFile, WnfsOperation } from '../../types';
|
|
16
|
-
|
|
17
|
-
export default Capability.makeModule(
|
|
18
|
-
Effect.fnUntraced(function* () {
|
|
19
|
-
return Capability.contributes(Common.Capability.OperationResolver, [
|
|
20
|
-
OperationResolver.make({
|
|
21
|
-
operation: WnfsOperation.OnCreateSpace,
|
|
22
|
-
handler: Effect.fnUntraced(function* ({ rootCollection }) {
|
|
23
|
-
const collection = Collection.makeManaged({ key: Type.getTypename(WnfsFile.File) });
|
|
24
|
-
Obj.change(rootCollection, (c) => {
|
|
25
|
-
c.objects.push(Ref.make(collection));
|
|
26
|
-
});
|
|
27
|
-
}),
|
|
28
|
-
}),
|
|
29
|
-
OperationResolver.make({
|
|
30
|
-
operation: WnfsOperation.Create,
|
|
31
|
-
handler: ({ name, type, cid }) =>
|
|
32
|
-
Effect.succeed({
|
|
33
|
-
object: WnfsFile.make({ name, type, cid }),
|
|
34
|
-
}),
|
|
35
|
-
}),
|
|
36
|
-
OperationResolver.make({
|
|
37
|
-
operation: WnfsOperation.Upload,
|
|
38
|
-
handler: Effect.fnUntraced(function* ({ file, db }) {
|
|
39
|
-
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
40
|
-
const blockstore = yield* Capability.get(WnfsCapabilities.Blockstore);
|
|
41
|
-
const space = client.spaces.get(db.spaceId);
|
|
42
|
-
invariant(space, 'Space not found');
|
|
43
|
-
const info = yield* Effect.promise(() => upload({ file, blockstore, space }));
|
|
44
|
-
return info;
|
|
45
|
-
}),
|
|
46
|
-
}),
|
|
47
|
-
OperationResolver.make({
|
|
48
|
-
operation: WnfsOperation.CreateFile,
|
|
49
|
-
handler: Effect.fnUntraced(function* ({ file, db }) {
|
|
50
|
-
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
51
|
-
const blockstore = yield* Capability.get(WnfsCapabilities.Blockstore);
|
|
52
|
-
const space = client.spaces.get(db.spaceId);
|
|
53
|
-
invariant(space, 'Space not found');
|
|
54
|
-
const info = yield* Effect.promise(() => upload({ file, blockstore, space }));
|
|
55
|
-
return {
|
|
56
|
-
object: WnfsFile.make({ name: info.name, type: info.type, cid: info.cid }),
|
|
57
|
-
};
|
|
58
|
-
}),
|
|
59
|
-
}),
|
|
60
|
-
]);
|
|
61
|
-
}),
|
|
62
|
-
);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
8
|
-
import { mx } from '@dxos/ui-theme';
|
|
9
|
-
|
|
10
|
-
export type FilePreviewProps = ThemedClassName<{ type: string; url: string }>;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* File/content preview iframe.
|
|
14
|
-
*/
|
|
15
|
-
export const FilePreview = ({ type, url, classNames }: FilePreviewProps) => {
|
|
16
|
-
if (type.startsWith('image/')) {
|
|
17
|
-
return <img className={mx('is-full bs-full object-contain', classNames)} src={url} />;
|
|
18
|
-
} else if (type.startsWith('video/')) {
|
|
19
|
-
return <video className={mx('is-full bs-full object-contain', classNames)} src={url} controls />;
|
|
20
|
-
} else {
|
|
21
|
-
return <iframe className={mx('is-full bs-full overflow-auto', classNames)} src={url} />;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
File without changes
|