@dxos/plugin-wnfs 0.8.3-staging.0fa589b → 0.8.4-main.f9ba587
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{FileContainer-7YOCEQ6P.mjs → FileContainer-Q4GUPBVD.mjs} +12 -11
- package/dist/lib/browser/FileContainer-Q4GUPBVD.mjs.map +7 -0
- package/dist/lib/browser/{blockstore-UT7233RJ.mjs → blockstore-KQO2NTVM.mjs} +7 -7
- package/dist/lib/browser/chunk-BANMVVJV.mjs +16 -0
- package/dist/lib/browser/{chunk-SCL6PT4P.mjs → chunk-GVBV2QWA.mjs} +4 -4
- package/dist/lib/browser/{chunk-DL7BBH57.mjs → chunk-KZANQHJY.mjs} +3 -3
- package/dist/lib/browser/{chunk-PHTWWADN.mjs → chunk-VDDGZWAY.mjs} +2 -2
- package/dist/lib/browser/{chunk-YYAW4U6J.mjs → chunk-VRRXG6IB.mjs} +6 -6
- package/dist/lib/browser/{file-uploader-RHINBPDQ.mjs → file-uploader-JA55DPMW.mjs} +4 -4
- package/dist/lib/browser/index.mjs +10 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-JDRRPIZC.mjs → intent-resolver-YM6QRFIH.mjs} +6 -6
- package/dist/lib/browser/{markdown-BWBHUHHH.mjs → markdown-6VH477GB.mjs} +7 -7
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-6GM4J4YG.mjs → react-surface-XAHVMWIH.mjs} +9 -9
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/FileContainer-22IPNDDA.mjs +108 -0
- package/dist/lib/node-esm/FileContainer-22IPNDDA.mjs.map +7 -0
- package/dist/lib/node-esm/blockstore-7KQTFHK5.mjs +192 -0
- package/dist/lib/node-esm/blockstore-7KQTFHK5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-47QYKNA6.mjs +17 -0
- package/dist/lib/node-esm/chunk-47QYKNA6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BM37ZAHF.mjs +65 -0
- package/dist/lib/node-esm/chunk-BM37ZAHF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CGW32EZB.mjs +161 -0
- package/dist/lib/node-esm/chunk-CGW32EZB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DWYM7FD7.mjs +18 -0
- package/dist/lib/node-esm/chunk-DWYM7FD7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YTWL64Z6.mjs +17 -0
- package/dist/lib/node-esm/chunk-YTWL64Z6.mjs.map +7 -0
- package/dist/lib/node-esm/file-uploader-WGDG2YV5.mjs +30 -0
- package/dist/lib/node-esm/file-uploader-WGDG2YV5.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +117 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/intent-resolver-5QOT2SLD.mjs +50 -0
- package/dist/lib/node-esm/intent-resolver-5QOT2SLD.mjs.map +7 -0
- package/dist/lib/node-esm/markdown-R4PBXDJO.mjs +197 -0
- package/dist/lib/node-esm/markdown-R4PBXDJO.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/react-surface-HAOUJUXJ.mjs +89 -0
- package/dist/lib/node-esm/react-surface-HAOUJUXJ.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +11 -0
- package/dist/lib/node-esm/types/index.mjs.map +7 -0
- package/dist/types/src/components/FileContainer.d.ts +4 -3
- package/dist/types/src/components/FileContainer.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +11 -11
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -26
- package/src/WnfsPlugin.tsx +1 -1
- package/src/components/FileContainer.tsx +6 -1
- package/src/translations.ts +6 -4
- package/dist/lib/browser/FileContainer-7YOCEQ6P.mjs.map +0 -7
- package/dist/lib/browser/chunk-WJVYRUYQ.mjs +0 -16
- /package/dist/lib/browser/{blockstore-UT7233RJ.mjs.map → blockstore-KQO2NTVM.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-WJVYRUYQ.mjs.map → chunk-BANMVVJV.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-SCL6PT4P.mjs.map → chunk-GVBV2QWA.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-DL7BBH57.mjs.map → chunk-KZANQHJY.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-PHTWWADN.mjs.map → chunk-VDDGZWAY.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-YYAW4U6J.mjs.map → chunk-VRRXG6IB.mjs.map} +0 -0
- /package/dist/lib/browser/{file-uploader-RHINBPDQ.mjs.map → file-uploader-JA55DPMW.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-JDRRPIZC.mjs.map → intent-resolver-YM6QRFIH.mjs.map} +0 -0
- /package/dist/lib/browser/{markdown-BWBHUHHH.mjs.map → markdown-6VH477GB.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-6GM4J4YG.mjs.map → react-surface-XAHVMWIH.mjs.map} +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-BANMVVJV.mjs";
|
|
2
2
|
import {
|
|
3
3
|
filePath,
|
|
4
4
|
getBlobUrl,
|
|
5
5
|
loadWnfs,
|
|
6
6
|
wnfsUrl
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VRRXG6IB.mjs";
|
|
8
8
|
import {
|
|
9
9
|
WnfsCapabilities
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-KZANQHJY.mjs";
|
|
11
|
+
import "./chunk-VDDGZWAY.mjs";
|
|
12
12
|
|
|
13
|
-
//
|
|
13
|
+
// src/components/FileContainer.tsx
|
|
14
14
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
15
15
|
import React2, { useEffect, useState } from "react";
|
|
16
16
|
import { useCapability } from "@dxos/app-framework";
|
|
@@ -18,7 +18,7 @@ import { invariant } from "@dxos/invariant";
|
|
|
18
18
|
import { getSpace } from "@dxos/react-client/echo";
|
|
19
19
|
import { StackItem } from "@dxos/react-ui-stack";
|
|
20
20
|
|
|
21
|
-
//
|
|
21
|
+
// src/components/FilePreview.tsx
|
|
22
22
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
23
23
|
import React from "react";
|
|
24
24
|
import { mx } from "@dxos/react-ui-theme";
|
|
@@ -47,9 +47,9 @@ var FilePreview = ({ type, url, classNames }) => {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
//
|
|
51
|
-
var __dxlog_file = "/
|
|
52
|
-
var FileContainer = ({
|
|
50
|
+
// src/components/FileContainer.tsx
|
|
51
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-wnfs/src/components/FileContainer.tsx";
|
|
52
|
+
var FileContainer = ({ role, file }) => {
|
|
53
53
|
var _effect = _useSignals2();
|
|
54
54
|
try {
|
|
55
55
|
const blockstore = useCapability(WnfsCapabilities.Blockstore);
|
|
@@ -60,7 +60,7 @@ var FileContainer = ({ file, role }) => {
|
|
|
60
60
|
const space = getSpace(file);
|
|
61
61
|
invariant(space, void 0, {
|
|
62
62
|
F: __dxlog_file,
|
|
63
|
-
L:
|
|
63
|
+
L: 30,
|
|
64
64
|
S: void 0,
|
|
65
65
|
A: [
|
|
66
66
|
"space",
|
|
@@ -101,6 +101,7 @@ var FileContainer = ({ file, role }) => {
|
|
|
101
101
|
};
|
|
102
102
|
var FileContainer_default = FileContainer;
|
|
103
103
|
export {
|
|
104
|
+
FileContainer,
|
|
104
105
|
FileContainer_default as default
|
|
105
106
|
};
|
|
106
|
-
//# sourceMappingURL=FileContainer-
|
|
107
|
+
//# sourceMappingURL=FileContainer-Q4GUPBVD.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/FileContainer.tsx", "../../../src/components/FilePreview.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useEffect, useState } from 'react';\n\nimport { useCapability } from '@dxos/app-framework';\nimport { invariant } from '@dxos/invariant';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { FilePreview } from './FilePreview';\nimport { WnfsCapabilities } from '../capabilities';\nimport { filePath, getBlobUrl, loadWnfs, wnfsUrl } from '../helpers';\nimport { type FileType } from '../types';\n\nexport type FileContainerProps = {\n role: string;\n file: FileType;\n};\n\nexport const FileContainer = ({ role, file }: FileContainerProps) => {\n const blockstore = useCapability(WnfsCapabilities.Blockstore);\n const instances = useCapability(WnfsCapabilities.Instances);\n const [blobUrl, setBlobUrl] = useState<string>();\n\n useEffect(() => {\n const timeout = setTimeout(async () => {\n const space = getSpace(file);\n invariant(space);\n const { directory, forest } = await loadWnfs({ blockstore, instances, space });\n const path = filePath(file.cid.toString(), space);\n const url = await getBlobUrl({ wnfsUrl: wnfsUrl(path), blockstore, directory, forest, type: file.type });\n setBlobUrl(url);\n });\n\n return () => clearTimeout(timeout);\n }, [file]);\n\n if (!blobUrl) {\n return null;\n }\n\n return (\n <StackItem.Content role={role}>\n <FilePreview type={file.type} url={blobUrl} />\n </StackItem.Content>\n );\n};\n\nexport default FileContainer;\n", "//\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,UAASC,WAAWC,gBAAgB;AAE3C,SAASC,qBAAqB;AAC9B,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;;;;ACL1B,OAAOC,WAAW;AAGlB,SAASC,UAAU;AAOZ,IAAMC,cAAc,CAAC,EAAEC,MAAMC,KAAKC,WAAU,MAAoB;;;AACrE,QAAIF,KAAKG,WAAW,QAAA,GAAW;AAC7B,aAAO,sBAAA,cAACC,OAAAA;QAAIC,WAAWC,GAAG,gCAAgCJ,UAAAA;QAAaK,KAAKN;;IAC9E,WAAWD,KAAKG,WAAW,QAAA,GAAW;AACpC,aAAO,sBAAA,cAACK,SAAAA;QAAMH,WAAWC,GAAG,gCAAgCJ,UAAAA;QAAaK,KAAKN;QAAKQ,UAAAA;;IACrF,OAAO;AACL,aAAO,sBAAA,cAACC,UAAAA;QAAOL,WAAWC,GAAG,+BAA+BJ,UAAAA;QAAaK,KAAKN;;IAChF;;;;AACF;;;;ADDO,IAAMU,gBAAgB,CAAC,EAAEC,MAAMC,KAAI,MAAsB;;;AAC9D,UAAMC,aAAaC,cAAcC,iBAAiBC,UAAU;AAC5D,UAAMC,YAAYH,cAAcC,iBAAiBG,SAAS;AAC1D,UAAM,CAACC,SAASC,UAAAA,IAAcC,SAAAA;AAE9BC,cAAU,MAAA;AACR,YAAMC,UAAUC,WAAW,YAAA;AACzB,cAAMC,QAAQC,SAASd,IAAAA;AACvBe,kBAAUF,OAAAA,QAAAA;;;;;;;;;AACV,cAAM,EAAEG,WAAWC,OAAM,IAAK,MAAMC,SAAS;UAAEjB;UAAYI;UAAWQ;QAAM,CAAA;AAC5E,cAAMM,OAAOC,SAASpB,KAAKqB,IAAIC,SAAQ,GAAIT,KAAAA;AAC3C,cAAMU,MAAM,MAAMC,WAAW;UAAEC,SAASA,QAAQN,IAAAA;UAAOlB;UAAYe;UAAWC;UAAQS,MAAM1B,KAAK0B;QAAK,CAAA;AACtGlB,mBAAWe,GAAAA;MACb,CAAA;AAEA,aAAO,MAAMI,aAAahB,OAAAA;IAC5B,GAAG;MAACX;KAAK;AAET,QAAI,CAACO,SAAS;AACZ,aAAO;IACT;AAEA,WACE,gBAAAqB,OAAA,cAACC,UAAUC,SAAO;MAAC/B;OACjB,gBAAA6B,OAAA,cAACG,aAAAA;MAAYL,MAAM1B,KAAK0B;MAAMH,KAAKhB;;;;;AAGzC;AAEA,IAAA,wBAAeT;",
|
|
6
|
+
"names": ["React", "useEffect", "useState", "useCapability", "invariant", "getSpace", "StackItem", "React", "mx", "FilePreview", "type", "url", "classNames", "startsWith", "img", "className", "mx", "src", "video", "controls", "iframe", "FileContainer", "role", "file", "blockstore", "useCapability", "WnfsCapabilities", "Blockstore", "instances", "Instances", "blobUrl", "setBlobUrl", "useState", "useEffect", "timeout", "setTimeout", "space", "getSpace", "invariant", "directory", "forest", "loadWnfs", "path", "filePath", "cid", "toString", "url", "getBlobUrl", "wnfsUrl", "type", "clearTimeout", "React", "StackItem", "Content", "FilePreview"]
|
|
7
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
storeName
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VRRXG6IB.mjs";
|
|
4
4
|
import {
|
|
5
5
|
WnfsCapabilities
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-KZANQHJY.mjs";
|
|
7
|
+
import "./chunk-VDDGZWAY.mjs";
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// src/capabilities/blockstore.ts
|
|
10
10
|
import { contributes } from "@dxos/app-framework";
|
|
11
11
|
import { ClientCapabilities } from "@dxos/plugin-client";
|
|
12
12
|
|
|
13
|
-
//
|
|
13
|
+
// src/blockstore.ts
|
|
14
14
|
import { CarWriter } from "@ipld/car";
|
|
15
15
|
import { BaseBlockstore } from "blockstore-core";
|
|
16
16
|
import { IDBBlockstore } from "blockstore-idb";
|
|
@@ -177,7 +177,7 @@ var MixedBlockstore = class extends BaseBlockstore {
|
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
-
//
|
|
180
|
+
// src/capabilities/blockstore.ts
|
|
181
181
|
var blockstore_default = async (context) => {
|
|
182
182
|
const client = context.getCapability(ClientCapabilities.Client);
|
|
183
183
|
const apiHost = client.config.values.runtime?.services?.edge?.url || "http://localhost:8787";
|
|
@@ -188,4 +188,4 @@ var blockstore_default = async (context) => {
|
|
|
188
188
|
export {
|
|
189
189
|
blockstore_default as default
|
|
190
190
|
};
|
|
191
|
-
//# sourceMappingURL=blockstore-
|
|
191
|
+
//# sourceMappingURL=blockstore-KQO2NTVM.mjs.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/capabilities/index.ts
|
|
2
|
+
import { lazy } from "@dxos/app-framework";
|
|
3
|
+
var Blockstore = lazy(() => import("./blockstore-KQO2NTVM.mjs"));
|
|
4
|
+
var FileUploader = lazy(() => import("./file-uploader-JA55DPMW.mjs"));
|
|
5
|
+
var IntentResolver = lazy(() => import("./intent-resolver-YM6QRFIH.mjs"));
|
|
6
|
+
var Markdown = lazy(() => import("./markdown-6VH477GB.mjs"));
|
|
7
|
+
var ReactSurface = lazy(() => import("./react-surface-XAHVMWIH.mjs"));
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
Blockstore,
|
|
11
|
+
FileUploader,
|
|
12
|
+
IntentResolver,
|
|
13
|
+
Markdown,
|
|
14
|
+
ReactSurface
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-BANMVVJV.mjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WNFS_PLUGIN
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VDDGZWAY.mjs";
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// src/types/file.ts
|
|
6
6
|
import { Schema } from "effect";
|
|
7
7
|
import { TypedObject } from "@dxos/echo-schema";
|
|
8
8
|
var FileType = class extends TypedObject({
|
|
@@ -16,7 +16,7 @@ var FileType = class extends TypedObject({
|
|
|
16
16
|
}) {
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
//
|
|
19
|
+
// src/types/types.ts
|
|
20
20
|
import { Schema as Schema2 } from "effect";
|
|
21
21
|
import { FileInfoSchema } from "@dxos/app-framework";
|
|
22
22
|
import { SpaceSchema } from "@dxos/react-client/echo";
|
|
@@ -61,4 +61,4 @@ export {
|
|
|
61
61
|
FileType,
|
|
62
62
|
WnfsAction
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
64
|
+
//# sourceMappingURL=chunk-GVBV2QWA.mjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WNFS_PLUGIN
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VDDGZWAY.mjs";
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// src/capabilities/capabilities.ts
|
|
6
6
|
import { defineCapability } from "@dxos/app-framework";
|
|
7
7
|
(function(WnfsCapabilities2) {
|
|
8
8
|
WnfsCapabilities2.Blockstore = defineCapability(`${WNFS_PLUGIN}/capability/blockstore`);
|
|
@@ -13,4 +13,4 @@ var WnfsCapabilities;
|
|
|
13
13
|
export {
|
|
14
14
|
WnfsCapabilities
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-KZANQHJY.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/meta.ts
|
|
2
2
|
var WNFS_PLUGIN = "dxos.org/plugin/wnfs";
|
|
3
3
|
var meta = {
|
|
4
4
|
id: WNFS_PLUGIN,
|
|
@@ -12,4 +12,4 @@ export {
|
|
|
12
12
|
WNFS_PLUGIN,
|
|
13
13
|
meta
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-VDDGZWAY.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/helpers/common.ts
|
|
2
2
|
import { CID } from "multiformats/cid";
|
|
3
3
|
import { sha256 } from "multiformats/hashes/sha2";
|
|
4
4
|
import * as crypto from "@dxos/crypto";
|
|
@@ -43,7 +43,7 @@ var store = (blockstore) => {
|
|
|
43
43
|
};
|
|
44
44
|
var storeName = () => "dxos/wnfs";
|
|
45
45
|
|
|
46
|
-
//
|
|
46
|
+
// src/helpers/load.ts
|
|
47
47
|
import { CID as CID2 } from "multiformats";
|
|
48
48
|
import * as Uint8Arrays from "uint8arrays";
|
|
49
49
|
import { AccessKey, PrivateForest, PrivateDirectory, PrivateNode } from "wnfs";
|
|
@@ -91,7 +91,7 @@ var loadWnfsDir = async (blockstore, space) => {
|
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
//
|
|
94
|
+
// src/helpers/wnfs-url.ts
|
|
95
95
|
var wnfsUrl = (filePath2) => {
|
|
96
96
|
return "wnfs://" + filePath2.map((f) => encodeURIComponent(f)).join("/");
|
|
97
97
|
};
|
|
@@ -108,12 +108,12 @@ var getBlobUrl = async ({ wnfsUrl: wnfsUrl2, blockstore, forest, directory, type
|
|
|
108
108
|
return URL.createObjectURL(blob);
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
//
|
|
111
|
+
// src/helpers/upload.ts
|
|
112
112
|
import { CID as CID3 } from "multiformats";
|
|
113
113
|
import * as Raw from "multiformats/codecs/raw";
|
|
114
114
|
import { sha256 as sha2562 } from "multiformats/hashes/sha2";
|
|
115
115
|
import { log } from "@dxos/log";
|
|
116
|
-
var __dxlog_file = "/
|
|
116
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-wnfs/src/helpers/upload.ts";
|
|
117
117
|
var upload = async ({ file, blockstore, instances, space }) => {
|
|
118
118
|
const { directory, forest } = await loadWnfs({
|
|
119
119
|
blockstore,
|
|
@@ -156,4 +156,4 @@ export {
|
|
|
156
156
|
getBlobUrl,
|
|
157
157
|
upload
|
|
158
158
|
};
|
|
159
|
-
//# sourceMappingURL=chunk-
|
|
159
|
+
//# sourceMappingURL=chunk-VRRXG6IB.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WnfsAction
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-GVBV2QWA.mjs";
|
|
4
|
+
import "./chunk-VDDGZWAY.mjs";
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// src/capabilities/file-uploader.ts
|
|
7
7
|
import { Effect, pipe } from "effect";
|
|
8
8
|
import { Capabilities, chain, contributes, createIntent } from "@dxos/app-framework";
|
|
9
9
|
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
@@ -26,4 +26,4 @@ var file_uploader_default = (context) => {
|
|
|
26
26
|
export {
|
|
27
27
|
file_uploader_default as default
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=file-uploader-
|
|
29
|
+
//# sourceMappingURL=file-uploader-JA55DPMW.mjs.map
|
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
IntentResolver,
|
|
5
5
|
Markdown,
|
|
6
6
|
ReactSurface
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BANMVVJV.mjs";
|
|
8
8
|
import {
|
|
9
9
|
WnfsCapabilities
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KZANQHJY.mjs";
|
|
11
11
|
import {
|
|
12
12
|
FileType,
|
|
13
13
|
WnfsAction
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GVBV2QWA.mjs";
|
|
15
15
|
import {
|
|
16
16
|
WNFS_PLUGIN,
|
|
17
17
|
meta
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VDDGZWAY.mjs";
|
|
19
19
|
|
|
20
|
-
//
|
|
20
|
+
// src/WnfsPlugin.tsx
|
|
21
21
|
import { pipe } from "effect";
|
|
22
22
|
import { Capabilities, Events, chain, contributes, createIntent, defineModule, definePlugin } from "@dxos/app-framework";
|
|
23
23
|
import { ClientEvents } from "@dxos/plugin-client";
|
|
@@ -25,15 +25,15 @@ import { MarkdownEvents } from "@dxos/plugin-markdown";
|
|
|
25
25
|
import { SpaceCapabilities } from "@dxos/plugin-space";
|
|
26
26
|
import { defineObjectForm } from "@dxos/plugin-space/types";
|
|
27
27
|
|
|
28
|
-
//
|
|
29
|
-
var
|
|
28
|
+
// src/translations.ts
|
|
29
|
+
var translations = [
|
|
30
30
|
{
|
|
31
31
|
"en-US": {
|
|
32
32
|
[FileType.typename]: {
|
|
33
33
|
"typename label": "File",
|
|
34
34
|
"object name placeholder": "New file"
|
|
35
35
|
},
|
|
36
|
-
[
|
|
36
|
+
[meta.id]: {
|
|
37
37
|
"plugin name": "Files",
|
|
38
38
|
"delete object label": "Delete",
|
|
39
39
|
"file input placeholder": "Drop a file here, or click to select a file"
|
|
@@ -42,7 +42,7 @@ var translations_default = [
|
|
|
42
42
|
}
|
|
43
43
|
];
|
|
44
44
|
|
|
45
|
-
//
|
|
45
|
+
// src/WnfsPlugin.tsx
|
|
46
46
|
var WnfsPlugin = () => definePlugin(meta, [
|
|
47
47
|
defineModule({
|
|
48
48
|
id: `${meta.id}/module/blockstore`,
|
|
@@ -60,7 +60,7 @@ var WnfsPlugin = () => definePlugin(meta, [
|
|
|
60
60
|
defineModule({
|
|
61
61
|
id: `${meta.id}/module/translations`,
|
|
62
62
|
activatesOn: Events.SetupTranslations,
|
|
63
|
-
activate: () => contributes(Capabilities.Translations,
|
|
63
|
+
activate: () => contributes(Capabilities.Translations, translations)
|
|
64
64
|
}),
|
|
65
65
|
defineModule({
|
|
66
66
|
id: `${meta.id}/module/metadata`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/WnfsPlugin.tsx", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { pipe } from 'effect';\n\nimport {\n Capabilities,\n Events,\n chain,\n contributes,\n createIntent,\n defineModule,\n definePlugin,\n} from '@dxos/app-framework';\nimport { ClientEvents } from '@dxos/plugin-client';\nimport { MarkdownEvents } from '@dxos/plugin-markdown';\nimport { SpaceCapabilities } from '@dxos/plugin-space';\nimport { defineObjectForm } from '@dxos/plugin-space/types';\n\nimport { Blockstore, FileUploader, IntentResolver, Markdown, ReactSurface, WnfsCapabilities } from './capabilities';\nimport { meta } from './meta';\nimport translations from './translations';\nimport { FileType, WnfsAction } from './types';\n\nexport const WnfsPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/blockstore`,\n activatesOn: ClientEvents.ClientReady,\n activate: Blockstore,\n }),\n defineModule({\n id: `${meta.id}/module/instances`,\n activatesOn: ClientEvents.ClientReady,\n activate: () => {\n const instances: WnfsCapabilities.Instances = {};\n return contributes(WnfsCapabilities.Instances, instances);\n },\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/metadata`,\n activatesOn: Events.SetupMetadata,\n activate: () =>\n contributes(Capabilities.Metadata, {\n id: FileType.typename,\n metadata: {\n label: (object: any) => (object instanceof FileType ? object.name : undefined),\n // TODO(wittjosiah): Would be nice if icon could change based on the type of the file.\n icon: 'ph--file--regular',\n },\n }),\n }),\n defineModule({\n id: `${meta.id}/module/object-form`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () =>\n contributes(\n SpaceCapabilities.ObjectForm,\n defineObjectForm({\n objectSchema: FileType,\n formSchema: WnfsAction.UploadFileSchema,\n getIntent: (props, options) =>\n pipe(createIntent(WnfsAction.Upload, { ...props, space: options.space }), chain(WnfsAction.Create, {})),\n }),\n ),\n }),\n defineModule({\n id: `${meta.id}/module/file-uploader`,\n activatesOn: ClientEvents.ClientReady,\n activate: FileUploader,\n }),\n defineModule({\n id: `${meta.id}/module/markdown`,\n activatesOn: MarkdownEvents.SetupExtensions,\n activate: Markdown,\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: ReactSurface,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntentResolver,\n activate: IntentResolver,\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAIA,SAASA,YAAY;AAErB,SACEC,cACAC,QACAC,OACAC,aACAC,cACAC,cACAC,oBACK;AACP,SAASC,oBAAoB;AAC7B,SAASC,sBAAsB;AAC/B,SAASC,yBAAyB;AAClC,SAASC,wBAAwB;;;
|
|
6
|
-
"names": ["pipe", "Capabilities", "Events", "chain", "contributes", "createIntent", "defineModule", "definePlugin", "ClientEvents", "MarkdownEvents", "SpaceCapabilities", "defineObjectForm", "FileType", "typename", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { pipe } from 'effect';\n\nimport {\n Capabilities,\n Events,\n chain,\n contributes,\n createIntent,\n defineModule,\n definePlugin,\n} from '@dxos/app-framework';\nimport { ClientEvents } from '@dxos/plugin-client';\nimport { MarkdownEvents } from '@dxos/plugin-markdown';\nimport { SpaceCapabilities } from '@dxos/plugin-space';\nimport { defineObjectForm } from '@dxos/plugin-space/types';\n\nimport { Blockstore, FileUploader, IntentResolver, Markdown, ReactSurface, WnfsCapabilities } from './capabilities';\nimport { meta } from './meta';\nimport { translations } from './translations';\nimport { FileType, WnfsAction } from './types';\n\nexport const WnfsPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/blockstore`,\n activatesOn: ClientEvents.ClientReady,\n activate: Blockstore,\n }),\n defineModule({\n id: `${meta.id}/module/instances`,\n activatesOn: ClientEvents.ClientReady,\n activate: () => {\n const instances: WnfsCapabilities.Instances = {};\n return contributes(WnfsCapabilities.Instances, instances);\n },\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/metadata`,\n activatesOn: Events.SetupMetadata,\n activate: () =>\n contributes(Capabilities.Metadata, {\n id: FileType.typename,\n metadata: {\n label: (object: any) => (object instanceof FileType ? object.name : undefined),\n // TODO(wittjosiah): Would be nice if icon could change based on the type of the file.\n icon: 'ph--file--regular',\n },\n }),\n }),\n defineModule({\n id: `${meta.id}/module/object-form`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () =>\n contributes(\n SpaceCapabilities.ObjectForm,\n defineObjectForm({\n objectSchema: FileType,\n formSchema: WnfsAction.UploadFileSchema,\n getIntent: (props, options) =>\n pipe(createIntent(WnfsAction.Upload, { ...props, space: options.space }), chain(WnfsAction.Create, {})),\n }),\n ),\n }),\n defineModule({\n id: `${meta.id}/module/file-uploader`,\n activatesOn: ClientEvents.ClientReady,\n activate: FileUploader,\n }),\n defineModule({\n id: `${meta.id}/module/markdown`,\n activatesOn: MarkdownEvents.SetupExtensions,\n activate: Markdown,\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: ReactSurface,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntentResolver,\n activate: IntentResolver,\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from './meta';\nimport { FileType } from './types';\n\nexport const translations = [\n {\n 'en-US': {\n [FileType.typename]: {\n 'typename label': 'File',\n 'object name placeholder': 'New file',\n },\n [meta.id]: {\n 'plugin name': 'Files',\n 'delete object label': 'Delete',\n 'file input placeholder': 'Drop a file here, or click to select a file',\n },\n },\n },\n] as const satisfies Resource[];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAIA,SAASA,YAAY;AAErB,SACEC,cACAC,QACAC,OACAC,aACAC,cACAC,cACAC,oBACK;AACP,SAASC,oBAAoB;AAC7B,SAASC,sBAAsB;AAC/B,SAASC,yBAAyB;AAClC,SAASC,wBAAwB;;;ACT1B,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,SAASC,QAAQ,GAAG;QACnB,kBAAkB;QAClB,2BAA2B;MAC7B;MACA,CAACC,KAAKC,EAAE,GAAG;QACT,eAAe;QACf,uBAAuB;QACvB,0BAA0B;MAC5B;IACF;EACF;;;;ADGK,IAAMC,aAAa,MACxBC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,aAAaC;IAC1BC,UAAUC;EACZ,CAAA;EACAN,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,aAAaC;IAC1BC,UAAU,MAAA;AACR,YAAME,YAAwC,CAAC;AAC/C,aAAOC,YAAYC,iBAAiBC,WAAWH,SAAAA;IACjD;EACF,CAAA;EACAP,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaS,OAAOC;IACpBP,UAAU,MAAMG,YAAYK,aAAaC,cAAcC,YAAAA;EACzD,CAAA;EACAf,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaS,OAAOK;IACpBX,UAAU,MACRG,YAAYK,aAAaI,UAAU;MACjChB,IAAIiB,SAASC;MACbC,UAAU;QACRC,OAAO,CAACC,WAAiBA,kBAAkBJ,WAAWI,OAAOC,OAAOC;;QAEpEC,MAAM;MACR;IACF,CAAA;EACJ,CAAA;EACAzB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,aAAauB;IAC1BrB,UAAU,MACRG,YACEmB,kBAAkBC,YAClBC,iBAAiB;MACfC,cAAcZ;MACda,YAAYC,WAAWC;MACvBC,WAAW,CAACC,OAAOC,YACjBC,KAAKC,aAAaN,WAAWO,QAAQ;QAAE,GAAGJ;QAAOK,OAAOJ,QAAQI;MAAM,CAAA,GAAIC,MAAMT,WAAWU,QAAQ,CAAC,CAAA,CAAA;IACxG,CAAA,CAAA;EAEN,CAAA;EACA1C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,aAAaC;IAC1BC,UAAUsC;EACZ,CAAA;EACA3C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAa0C,eAAeC;IAC5BxC,UAAUyC;EACZ,CAAA;EACA9C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaS,OAAOoC;IACpB1C,UAAU2C;EACZ,CAAA;EACAhD,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaS,OAAOsC;IACpB5C,UAAU6C;EACZ,CAAA;CACD;",
|
|
6
|
+
"names": ["pipe", "Capabilities", "Events", "chain", "contributes", "createIntent", "defineModule", "definePlugin", "ClientEvents", "MarkdownEvents", "SpaceCapabilities", "defineObjectForm", "translations", "FileType", "typename", "meta", "id", "WnfsPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "ClientEvents", "ClientReady", "activate", "Blockstore", "instances", "contributes", "WnfsCapabilities", "Instances", "Events", "SetupTranslations", "Capabilities", "Translations", "translations", "SetupMetadata", "Metadata", "FileType", "typename", "metadata", "label", "object", "name", "undefined", "icon", "SetupSchema", "SpaceCapabilities", "ObjectForm", "defineObjectForm", "objectSchema", "formSchema", "WnfsAction", "UploadFileSchema", "getIntent", "props", "options", "pipe", "createIntent", "Upload", "space", "chain", "Create", "FileUploader", "MarkdownEvents", "SetupExtensions", "Markdown", "SetupReactSurface", "ReactSurface", "SetupIntentResolver", "IntentResolver"]
|
|
7
7
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
upload
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VRRXG6IB.mjs";
|
|
4
4
|
import {
|
|
5
5
|
WnfsCapabilities
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KZANQHJY.mjs";
|
|
7
7
|
import {
|
|
8
8
|
FileType,
|
|
9
9
|
WnfsAction
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-GVBV2QWA.mjs";
|
|
11
|
+
import "./chunk-VDDGZWAY.mjs";
|
|
12
12
|
|
|
13
|
-
//
|
|
13
|
+
// src/capabilities/intent-resolver.ts
|
|
14
14
|
import { contributes, Capabilities, createResolver } from "@dxos/app-framework";
|
|
15
15
|
import { Obj } from "@dxos/echo";
|
|
16
16
|
var intent_resolver_default = (context) => contributes(Capabilities.IntentResolver, [
|
|
@@ -46,4 +46,4 @@ var intent_resolver_default = (context) => contributes(Capabilities.IntentResolv
|
|
|
46
46
|
export {
|
|
47
47
|
intent_resolver_default as default
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=intent-resolver-
|
|
49
|
+
//# sourceMappingURL=intent-resolver-YM6QRFIH.mjs.map
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
getBlobUrl,
|
|
3
3
|
getPathFromUrl,
|
|
4
4
|
loadWnfs
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VRRXG6IB.mjs";
|
|
6
6
|
import {
|
|
7
7
|
WnfsCapabilities
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KZANQHJY.mjs";
|
|
9
|
+
import "./chunk-VDDGZWAY.mjs";
|
|
10
10
|
|
|
11
|
-
//
|
|
11
|
+
// src/capabilities/markdown.ts
|
|
12
12
|
import { contributes } from "@dxos/app-framework";
|
|
13
13
|
import { MarkdownCapabilities } from "@dxos/plugin-markdown";
|
|
14
14
|
import { getSpace } from "@dxos/react-client/echo";
|
|
15
15
|
|
|
16
|
-
//
|
|
16
|
+
// src/extensions/image.tsx
|
|
17
17
|
import { syntaxTree } from "@codemirror/language";
|
|
18
18
|
import { StateField } from "@codemirror/state";
|
|
19
19
|
import { Decoration, EditorView, WidgetType } from "@codemirror/view";
|
|
@@ -172,7 +172,7 @@ var WnfsImageWidget = class extends WidgetType {
|
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
-
//
|
|
175
|
+
// src/capabilities/markdown.ts
|
|
176
176
|
var markdown_default = (context) => contributes(MarkdownCapabilities.Extensions, [
|
|
177
177
|
({ document: document2 }) => {
|
|
178
178
|
const blockstore = context.getCapability(WnfsCapabilities.Blockstore);
|
|
@@ -193,4 +193,4 @@ var markdown_default = (context) => contributes(MarkdownCapabilities.Extensions,
|
|
|
193
193
|
export {
|
|
194
194
|
markdown_default as default
|
|
195
195
|
};
|
|
196
|
-
//# sourceMappingURL=markdown-
|
|
196
|
+
//# sourceMappingURL=markdown-6VH477GB.mjs.map
|