@dxos/plugin-wnfs 0.8.2-main.f11618f → 0.8.2-staging.42af850
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-SEU43TLT.mjs +106 -0
- package/dist/lib/browser/{FileContainer-W646BCAM.mjs.map → FileContainer-SEU43TLT.mjs.map} +1 -1
- package/dist/lib/browser/{blockstore-CTEISOKD.mjs → blockstore-UT7233RJ.mjs} +4 -4
- package/dist/lib/browser/blockstore-UT7233RJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NIDFBTNY.mjs → chunk-DL7BBH57.mjs} +3 -3
- package/dist/lib/browser/{chunk-NIDFBTNY.mjs.map → chunk-DL7BBH57.mjs.map} +1 -1
- package/dist/lib/browser/chunk-LQYDI474.mjs +16 -0
- package/dist/lib/browser/{chunk-X54OT4V3.mjs → chunk-PHTWWADN.mjs} +2 -2
- package/dist/lib/browser/{chunk-X54OT4V3.mjs.map → chunk-PHTWWADN.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-TOIGKYS7.mjs → chunk-RY5XZCVP.mjs} +18 -17
- package/dist/lib/browser/chunk-RY5XZCVP.mjs.map +7 -0
- package/dist/lib/browser/{file-uploader-F3C3A4TM.mjs → file-uploader-OQHVKRQ5.mjs} +4 -4
- package/dist/lib/browser/file-uploader-OQHVKRQ5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +4 -4
- package/dist/lib/browser/{intent-resolver-JSSHOBDG.mjs → intent-resolver-42B3MXJZ.mjs} +5 -5
- package/dist/lib/browser/intent-resolver-42B3MXJZ.mjs.map +7 -0
- package/dist/lib/browser/{markdown-G6DTBWWO.mjs → markdown-BWBHUHHH.mjs} +6 -8
- package/dist/lib/browser/markdown-BWBHUHHH.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-BAV7AAW6.mjs → react-surface-GTYQZY3L.mjs} +24 -18
- package/dist/lib/browser/react-surface-GTYQZY3L.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/types/src/blockstore.d.ts.map +1 -1
- package/dist/types/src/capabilities/blockstore.d.ts +2 -2
- package/dist/types/src/capabilities/blockstore.d.ts.map +1 -1
- package/dist/types/src/capabilities/file-uploader.d.ts +2 -2
- package/dist/types/src/capabilities/file-uploader.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +4 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +2 -2
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/FileContainer.d.ts.map +1 -1
- package/dist/types/src/components/FileInput.d.ts +2 -2
- package/dist/types/src/components/FileInput.d.ts.map +1 -1
- package/dist/types/src/components/FilePreview.d.ts.map +1 -1
- package/dist/types/src/extensions/image.d.ts.map +1 -1
- package/dist/types/src/helpers/common.d.ts.map +1 -1
- package/dist/types/src/helpers/load.d.ts.map +1 -1
- package/dist/types/src/helpers/upload.d.ts.map +1 -1
- package/dist/types/src/helpers/wnfs-url.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -10
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/file.d.ts +10 -10
- package/dist/types/src/types/file.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +15 -15
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -23
- package/src/blockstore.ts +9 -9
- package/src/capabilities/blockstore.ts +3 -3
- package/src/capabilities/file-uploader.ts +3 -3
- package/src/capabilities/intent-resolver.ts +3 -3
- package/src/capabilities/markdown.ts +4 -4
- package/src/capabilities/react-surface.tsx +6 -3
- package/src/components/FileInput.tsx +2 -2
- package/src/extensions/image.tsx +2 -2
- package/src/meta.ts +1 -1
- package/src/types/file.ts +7 -5
- package/src/types/types.ts +11 -10
- package/dist/lib/browser/FileContainer-W646BCAM.mjs +0 -94
- package/dist/lib/browser/blockstore-CTEISOKD.mjs.map +0 -7
- package/dist/lib/browser/chunk-TOIGKYS7.mjs.map +0 -7
- package/dist/lib/browser/chunk-XZFJLSBE.mjs +0 -16
- package/dist/lib/browser/file-uploader-F3C3A4TM.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-JSSHOBDG.mjs.map +0 -7
- package/dist/lib/browser/markdown-G6DTBWWO.mjs.map +0 -7
- package/dist/lib/browser/react-surface-BAV7AAW6.mjs.map +0 -7
- /package/dist/lib/browser/{chunk-XZFJLSBE.mjs.map → chunk-LQYDI474.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGlC,yBAAiB,UAAU,CAAC;;;;;;;;;;;;;;;;;IAC1B,MAAM,OAAO,MAAO,SAAQ,WAK1B;KAAG;IAEL,MAAM,CAAC,MAAM,kBAAkB,eAAiD,CAAC;IAEjF,MAAM,CAAC,MAAM,gBAAgB;;MAS3B,CAAC;IAEH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;IAEzE,MAAM,OAAO,MAAO,SAAQ,WAG1B;KAAG;;CACN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.
|
|
1
|
+
{"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-wnfs",
|
|
3
|
-
"version": "0.8.2-
|
|
3
|
+
"version": "0.8.2-staging.42af850",
|
|
4
4
|
"description": "WNFS file management plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
"@codemirror/state": "^6.4.1",
|
|
35
35
|
"@codemirror/view": "^6.34.1",
|
|
36
36
|
"@ipld/car": "^5.3.3",
|
|
37
|
+
"@preact-signals/safe-react": "^0.9.0",
|
|
37
38
|
"blockstore-core": "^5.0.1",
|
|
38
39
|
"blockstore-idb": "^2.0.0",
|
|
39
40
|
"debounce": "^2.2.0",
|
|
40
|
-
"effect": "3.
|
|
41
|
+
"effect": "3.14.21",
|
|
41
42
|
"idb-keyval": "^6.2.1",
|
|
42
43
|
"interface-blockstore": "^5.2.10",
|
|
43
44
|
"it-all": "^3.0.6",
|
|
@@ -45,22 +46,23 @@
|
|
|
45
46
|
"react-dropzone": "^14.2.3",
|
|
46
47
|
"uint8arrays": "^5.1.0",
|
|
47
48
|
"wnfs": "0.2.2",
|
|
48
|
-
"@dxos/app-framework": "0.8.2-
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/plugin-markdown": "0.8.2-
|
|
58
|
-
"@dxos/react-ui": "0.8.2-
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/react-ui-
|
|
61
|
-
"@dxos/react-ui-
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/react-ui-stack": "0.8.2-
|
|
49
|
+
"@dxos/app-framework": "0.8.2-staging.42af850",
|
|
50
|
+
"@dxos/echo-schema": "0.8.2-staging.42af850",
|
|
51
|
+
"@dxos/echo": "0.8.2-staging.42af850",
|
|
52
|
+
"@dxos/effect": "0.8.2-staging.42af850",
|
|
53
|
+
"@dxos/crypto": "0.8.2-staging.42af850",
|
|
54
|
+
"@dxos/invariant": "0.8.2-staging.42af850",
|
|
55
|
+
"@dxos/local-storage": "0.8.2-staging.42af850",
|
|
56
|
+
"@dxos/log": "0.8.2-staging.42af850",
|
|
57
|
+
"@dxos/plugin-client": "0.8.2-staging.42af850",
|
|
58
|
+
"@dxos/plugin-markdown": "0.8.2-staging.42af850",
|
|
59
|
+
"@dxos/react-ui": "0.8.2-staging.42af850",
|
|
60
|
+
"@dxos/react-client": "0.8.2-staging.42af850",
|
|
61
|
+
"@dxos/react-ui-editor": "0.8.2-staging.42af850",
|
|
62
|
+
"@dxos/react-ui-form": "0.8.2-staging.42af850",
|
|
63
|
+
"@dxos/plugin-space": "0.8.2-staging.42af850",
|
|
64
|
+
"@dxos/react-ui-stack": "0.8.2-staging.42af850",
|
|
65
|
+
"@dxos/util": "0.8.2-staging.42af850"
|
|
64
66
|
},
|
|
65
67
|
"devDependencies": {
|
|
66
68
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -69,16 +71,17 @@
|
|
|
69
71
|
"react": "~18.2.0",
|
|
70
72
|
"react-dom": "~18.2.0",
|
|
71
73
|
"vite": "5.4.7",
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/storybook-utils": "0.8.2-
|
|
74
|
+
"@dxos/react-ui-theme": "0.8.2-staging.42af850",
|
|
75
|
+
"@dxos/random": "0.8.2-staging.42af850",
|
|
76
|
+
"@dxos/storybook-utils": "0.8.2-staging.42af850"
|
|
75
77
|
},
|
|
76
78
|
"peerDependencies": {
|
|
77
79
|
"@phosphor-icons/react": "^2.0.5",
|
|
80
|
+
"effect": "^3.13.3",
|
|
78
81
|
"react": "~18.2.0",
|
|
79
82
|
"react-dom": "~18.2.0",
|
|
80
|
-
"@dxos/react-ui": "0.8.2-
|
|
81
|
-
"@dxos/react-ui
|
|
83
|
+
"@dxos/react-ui-theme": "0.8.2-staging.42af850",
|
|
84
|
+
"@dxos/react-ui": "0.8.2-staging.42af850"
|
|
82
85
|
},
|
|
83
86
|
"publishConfig": {
|
|
84
87
|
"access": "public"
|
package/src/blockstore.ts
CHANGED
|
@@ -41,7 +41,7 @@ export class MixedBlockstore extends BaseBlockstore {
|
|
|
41
41
|
this.#flushQueue = debounce(this.#flushQueueInt, 5000);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
async open() {
|
|
44
|
+
async open(): Promise<void> {
|
|
45
45
|
await this.#localStore.open();
|
|
46
46
|
await this.#restoreQueue();
|
|
47
47
|
|
|
@@ -55,7 +55,7 @@ export class MixedBlockstore extends BaseBlockstore {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
url(apiHost: string, cid?: CID) {
|
|
58
|
+
url(apiHost: string, cid?: CID): string {
|
|
59
59
|
const path = cid ? cid.toString() : '';
|
|
60
60
|
return `${apiHost}/api/file${path.length ? '/' + path : ''}`;
|
|
61
61
|
}
|
|
@@ -122,7 +122,7 @@ export class MixedBlockstore extends BaseBlockstore {
|
|
|
122
122
|
|
|
123
123
|
// REMOTE
|
|
124
124
|
|
|
125
|
-
async putRemote(key: CID, val: Uint8Array) {
|
|
125
|
+
async putRemote(key: CID, val: Uint8Array): Promise<void> {
|
|
126
126
|
if (this.#apiHost) {
|
|
127
127
|
await fetch(this.url(this.#apiHost, key), {
|
|
128
128
|
method: 'POST',
|
|
@@ -131,7 +131,7 @@ export class MixedBlockstore extends BaseBlockstore {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
async putCarRemote(car: Uint8Array) {
|
|
134
|
+
async putCarRemote(car: Uint8Array): Promise<void> {
|
|
135
135
|
if (this.#apiHost) {
|
|
136
136
|
await fetch(this.url(this.#apiHost), {
|
|
137
137
|
method: 'POST',
|
|
@@ -147,11 +147,11 @@ export class MixedBlockstore extends BaseBlockstore {
|
|
|
147
147
|
|
|
148
148
|
readonly queueCacheName = `${storeName()}/state/queue`;
|
|
149
149
|
|
|
150
|
-
async #addToQueue(key: CID) {
|
|
150
|
+
async #addToQueue(key: CID): Promise<void> {
|
|
151
151
|
await this.#saveQueue([...this.#queue, key.toString()]);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
async #flushQueueInt() {
|
|
154
|
+
async #flushQueueInt(): Promise<void> {
|
|
155
155
|
if (!this.#isConnected || !this.#apiHost) {
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
@@ -186,7 +186,7 @@ export class MixedBlockstore extends BaseBlockstore {
|
|
|
186
186
|
await this.#saveQueue(queue);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
async #restoreQueue() {
|
|
189
|
+
async #restoreQueue(): Promise<void> {
|
|
190
190
|
const fromCache = await IDB.get(this.queueCacheName);
|
|
191
191
|
if (fromCache && Array.isArray(fromCache)) {
|
|
192
192
|
this.#queue = fromCache;
|
|
@@ -194,7 +194,7 @@ export class MixedBlockstore extends BaseBlockstore {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
async #saveQueue(items: string[]) {
|
|
197
|
+
async #saveQueue(items: string[]): Promise<void> {
|
|
198
198
|
const arr = [...items];
|
|
199
199
|
this.#queue = arr;
|
|
200
200
|
await IDB.set(this.queueCacheName, arr);
|
|
@@ -202,7 +202,7 @@ export class MixedBlockstore extends BaseBlockstore {
|
|
|
202
202
|
|
|
203
203
|
// 🛠️
|
|
204
204
|
|
|
205
|
-
async #createCar(blocks: Block[]) {
|
|
205
|
+
async #createCar(blocks: Block[]): Promise<Uint8Array> {
|
|
206
206
|
const { writer, out } = CarWriter.create();
|
|
207
207
|
const outPromise = all(out);
|
|
208
208
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { contributes, type
|
|
5
|
+
import { contributes, type PluginContext } from '@dxos/app-framework';
|
|
6
6
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
7
7
|
|
|
8
8
|
import { WnfsCapabilities } from './capabilities';
|
|
9
9
|
import * as Blockstore from '../blockstore';
|
|
10
10
|
|
|
11
|
-
export default async (context:
|
|
12
|
-
const client = context.
|
|
11
|
+
export default async (context: PluginContext) => {
|
|
12
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
13
13
|
const apiHost = client.config.values.runtime?.services?.edge?.url || 'http://localhost:8787';
|
|
14
14
|
const blockstore = Blockstore.create(apiHost);
|
|
15
15
|
await blockstore.open();
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { Effect, pipe } from 'effect';
|
|
6
6
|
|
|
7
|
-
import { Capabilities, chain, contributes, createIntent, type
|
|
7
|
+
import { Capabilities, chain, contributes, createIntent, type PluginContext } from '@dxos/app-framework';
|
|
8
8
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
9
9
|
|
|
10
10
|
import { WnfsAction } from '../types';
|
|
11
11
|
|
|
12
|
-
export default (context:
|
|
12
|
+
export default (context: PluginContext) => {
|
|
13
13
|
return contributes(Capabilities.FileUploader, (file, space) => {
|
|
14
|
-
const { dispatch } = context.
|
|
14
|
+
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
15
15
|
|
|
16
16
|
const program = Effect.gen(function* () {
|
|
17
17
|
const fileInfo = yield* dispatch(createIntent(WnfsAction.Upload, { file, space }));
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { contributes, Capabilities, createResolver, type
|
|
5
|
+
import { contributes, Capabilities, createResolver, type PluginContext } from '@dxos/app-framework';
|
|
6
6
|
import { live } from '@dxos/react-client/echo';
|
|
7
7
|
|
|
8
8
|
import { WnfsCapabilities } from './capabilities';
|
|
9
9
|
import { upload } from '../helpers';
|
|
10
10
|
import { FileType, WnfsAction } from '../types';
|
|
11
11
|
|
|
12
|
-
export default (context:
|
|
12
|
+
export default (context: PluginContext) =>
|
|
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.
|
|
@@ -24,7 +24,7 @@ export default (context: PluginsContext) =>
|
|
|
24
24
|
createResolver({
|
|
25
25
|
intent: WnfsAction.Upload,
|
|
26
26
|
resolve: async ({ file, space }) => {
|
|
27
|
-
const blockstore = context.
|
|
27
|
+
const blockstore = context.getCapability(WnfsCapabilities.Blockstore);
|
|
28
28
|
const info = await upload({ file, blockstore, space });
|
|
29
29
|
return { data: info };
|
|
30
30
|
},
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { contributes, type
|
|
5
|
+
import { contributes, type PluginContext } from '@dxos/app-framework';
|
|
6
6
|
import { MarkdownCapabilities } from '@dxos/plugin-markdown';
|
|
7
7
|
import { getSpace } from '@dxos/react-client/echo';
|
|
8
8
|
|
|
9
9
|
import { WnfsCapabilities } from './capabilities';
|
|
10
10
|
import { image } from '../extensions';
|
|
11
11
|
|
|
12
|
-
export default (context:
|
|
12
|
+
export default (context: PluginContext) =>
|
|
13
13
|
contributes(MarkdownCapabilities.Extensions, [
|
|
14
14
|
({ document }) => {
|
|
15
|
-
const blockstore = context.
|
|
16
|
-
const instances = context.
|
|
15
|
+
const blockstore = context.getCapability(WnfsCapabilities.Blockstore);
|
|
16
|
+
const instances = context.getCapability(WnfsCapabilities.Instances);
|
|
17
17
|
|
|
18
18
|
if (document) {
|
|
19
19
|
const space = getSpace(document);
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Schema } from 'effect';
|
|
5
6
|
import React, { useCallback } from 'react';
|
|
6
7
|
|
|
7
8
|
import { contributes, Capabilities, createSurface } from '@dxos/app-framework';
|
|
8
9
|
import { isInstanceOf } from '@dxos/echo-schema';
|
|
9
|
-
import { type S } from '@dxos/echo-schema';
|
|
10
10
|
import { findAnnotation } from '@dxos/effect';
|
|
11
11
|
import { type InputProps } from '@dxos/react-ui-form';
|
|
12
12
|
|
|
@@ -25,8 +25,11 @@ export default () =>
|
|
|
25
25
|
createSurface({
|
|
26
26
|
id: `${WNFS_PLUGIN}/create-form`,
|
|
27
27
|
role: 'form-input',
|
|
28
|
-
filter: (data): data is { prop: string; schema:
|
|
29
|
-
const annotation = findAnnotation<boolean>(
|
|
28
|
+
filter: (data): data is { prop: string; schema: Schema.Schema.Any } => {
|
|
29
|
+
const annotation = findAnnotation<boolean>(
|
|
30
|
+
(data.schema as Schema.Schema.All).ast,
|
|
31
|
+
WnfsAction.UploadAnnotationId,
|
|
32
|
+
);
|
|
30
33
|
return !!annotation;
|
|
31
34
|
},
|
|
32
35
|
component: ({ data: { prop, schema }, ...props }) => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Schema
|
|
5
|
+
import { type Schema } from 'effect';
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
7
7
|
import { useDropzone } from 'react-dropzone';
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@ import { WNFS_PLUGIN } from '../meta';
|
|
|
14
14
|
import { WnfsAction } from '../types';
|
|
15
15
|
|
|
16
16
|
export type FileInputProps = {
|
|
17
|
-
schema:
|
|
17
|
+
schema: Schema.Schema.Any;
|
|
18
18
|
onChange: (file: File) => void;
|
|
19
19
|
};
|
|
20
20
|
|
package/src/extensions/image.tsx
CHANGED
|
@@ -165,11 +165,11 @@ class WnfsImageWidget extends WidgetType {
|
|
|
165
165
|
super();
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
override eq(other: this) {
|
|
168
|
+
override eq(other: this): boolean {
|
|
169
169
|
return this._wnfsUrl === (other as any as WnfsImageWidget)._wnfsUrl;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
override toDOM(view: EditorView) {
|
|
172
|
+
override toDOM(view: EditorView): HTMLDivElement {
|
|
173
173
|
if (typeof this._url === 'string') {
|
|
174
174
|
return createImg(view, this._url);
|
|
175
175
|
}
|
package/src/meta.ts
CHANGED
|
@@ -11,5 +11,5 @@ export const meta: PluginMeta = {
|
|
|
11
11
|
name: 'WNFS',
|
|
12
12
|
description: 'Manage and view files with via the Web Native File System (WNFS).',
|
|
13
13
|
icon: 'ph--file-cloud--regular',
|
|
14
|
-
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/
|
|
14
|
+
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-wnfs',
|
|
15
15
|
};
|
package/src/types/file.ts
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { TypedObject } from '@dxos/echo-schema';
|
|
6
8
|
|
|
7
9
|
export class FileType extends TypedObject({ typename: 'dxos.org/type/File', version: '0.1.0' })({
|
|
8
|
-
name:
|
|
9
|
-
type:
|
|
10
|
-
cid:
|
|
11
|
-
timestamp:
|
|
10
|
+
name: Schema.optional(Schema.String),
|
|
11
|
+
type: Schema.String,
|
|
12
|
+
cid: Schema.String,
|
|
13
|
+
timestamp: Schema.optional(Schema.String),
|
|
12
14
|
}) {}
|
package/src/types/types.ts
CHANGED
|
@@ -2,25 +2,26 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
5
7
|
import { FileInfoSchema } from '@dxos/app-framework';
|
|
6
|
-
import { S } from '@dxos/echo-schema';
|
|
7
8
|
import { SpaceSchema } from '@dxos/react-client/echo';
|
|
8
9
|
|
|
9
10
|
import { FileType } from './file';
|
|
10
11
|
import { WNFS_PLUGIN } from '../meta';
|
|
11
12
|
|
|
12
13
|
export namespace WnfsAction {
|
|
13
|
-
export class Create extends
|
|
14
|
-
input: FileInfoSchema.pick('name', 'type', 'cid').pipe(
|
|
15
|
-
output:
|
|
14
|
+
export class Create extends Schema.TaggedClass<Create>()(`${WNFS_PLUGIN}/action/create`, {
|
|
15
|
+
input: FileInfoSchema.pick('name', 'type', 'cid').pipe(Schema.required),
|
|
16
|
+
output: Schema.Struct({
|
|
16
17
|
object: FileType,
|
|
17
18
|
}),
|
|
18
19
|
}) {}
|
|
19
20
|
|
|
20
21
|
export const UploadAnnotationId = Symbol.for(`${WNFS_PLUGIN}/annotation/upload`);
|
|
21
22
|
|
|
22
|
-
export const UploadFileSchema =
|
|
23
|
-
file:
|
|
23
|
+
export const UploadFileSchema = Schema.Struct({
|
|
24
|
+
file: Schema.instanceOf(File).annotations({
|
|
24
25
|
[UploadAnnotationId]: {
|
|
25
26
|
// Accept file types.
|
|
26
27
|
'image/*': ['.jpg', '.jpeg', '.png', '.gif'],
|
|
@@ -30,10 +31,10 @@ export namespace WnfsAction {
|
|
|
30
31
|
}),
|
|
31
32
|
});
|
|
32
33
|
|
|
33
|
-
export type UploadFileForm =
|
|
34
|
+
export type UploadFileForm = Schema.Schema.Type<typeof UploadFileSchema>;
|
|
34
35
|
|
|
35
|
-
export class Upload extends
|
|
36
|
-
input:
|
|
37
|
-
output:
|
|
36
|
+
export class Upload extends Schema.TaggedClass<Upload>()(`${WNFS_PLUGIN}/action/upload`, {
|
|
37
|
+
input: Schema.extend(UploadFileSchema, Schema.Struct({ space: SpaceSchema })),
|
|
38
|
+
output: Schema.required(FileInfoSchema),
|
|
38
39
|
}) {}
|
|
39
40
|
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import "./chunk-XZFJLSBE.mjs";
|
|
2
|
-
import {
|
|
3
|
-
filePath,
|
|
4
|
-
getBlobUrl,
|
|
5
|
-
loadWnfs,
|
|
6
|
-
wnfsUrl
|
|
7
|
-
} from "./chunk-YYAW4U6J.mjs";
|
|
8
|
-
import {
|
|
9
|
-
WnfsCapabilities
|
|
10
|
-
} from "./chunk-NIDFBTNY.mjs";
|
|
11
|
-
import "./chunk-X54OT4V3.mjs";
|
|
12
|
-
|
|
13
|
-
// packages/plugins/plugin-wnfs/src/components/FileContainer.tsx
|
|
14
|
-
import React2, { useEffect, useState } from "react";
|
|
15
|
-
import { useCapability } from "@dxos/app-framework";
|
|
16
|
-
import { invariant } from "@dxos/invariant";
|
|
17
|
-
import { getSpace } from "@dxos/react-client/echo";
|
|
18
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
19
|
-
|
|
20
|
-
// packages/plugins/plugin-wnfs/src/components/FilePreview.tsx
|
|
21
|
-
import React from "react";
|
|
22
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
23
|
-
var FilePreview = ({ type, url, classNames }) => {
|
|
24
|
-
if (type.startsWith("image/")) {
|
|
25
|
-
return /* @__PURE__ */ React.createElement("img", {
|
|
26
|
-
className: mx("w-full h-full object-contain", classNames),
|
|
27
|
-
src: url
|
|
28
|
-
});
|
|
29
|
-
} else if (type.startsWith("video/")) {
|
|
30
|
-
return /* @__PURE__ */ React.createElement("video", {
|
|
31
|
-
className: mx("w-full h-full object-contain", classNames),
|
|
32
|
-
src: url,
|
|
33
|
-
controls: true
|
|
34
|
-
});
|
|
35
|
-
} else {
|
|
36
|
-
return /* @__PURE__ */ React.createElement("iframe", {
|
|
37
|
-
className: mx("w-full h-full overflow-auto", classNames),
|
|
38
|
-
src: url
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// packages/plugins/plugin-wnfs/src/components/FileContainer.tsx
|
|
44
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-wnfs/src/components/FileContainer.tsx";
|
|
45
|
-
var FileContainer = ({ file, role }) => {
|
|
46
|
-
const blockstore = useCapability(WnfsCapabilities.Blockstore);
|
|
47
|
-
const instances = useCapability(WnfsCapabilities.Instances);
|
|
48
|
-
const [blobUrl, setBlobUrl] = useState();
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
const timeout = setTimeout(async () => {
|
|
51
|
-
const space = getSpace(file);
|
|
52
|
-
invariant(space, void 0, {
|
|
53
|
-
F: __dxlog_file,
|
|
54
|
-
L: 25,
|
|
55
|
-
S: void 0,
|
|
56
|
-
A: [
|
|
57
|
-
"space",
|
|
58
|
-
""
|
|
59
|
-
]
|
|
60
|
-
});
|
|
61
|
-
const { directory, forest } = await loadWnfs({
|
|
62
|
-
blockstore,
|
|
63
|
-
instances,
|
|
64
|
-
space
|
|
65
|
-
});
|
|
66
|
-
const path = filePath(file.cid.toString(), space);
|
|
67
|
-
const url = await getBlobUrl({
|
|
68
|
-
wnfsUrl: wnfsUrl(path),
|
|
69
|
-
blockstore,
|
|
70
|
-
directory,
|
|
71
|
-
forest,
|
|
72
|
-
type: file.type
|
|
73
|
-
});
|
|
74
|
-
setBlobUrl(url);
|
|
75
|
-
});
|
|
76
|
-
return () => clearTimeout(timeout);
|
|
77
|
-
}, [
|
|
78
|
-
file
|
|
79
|
-
]);
|
|
80
|
-
if (!blobUrl) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
return /* @__PURE__ */ React2.createElement(StackItem.Content, {
|
|
84
|
-
role
|
|
85
|
-
}, /* @__PURE__ */ React2.createElement(FilePreview, {
|
|
86
|
-
type: file.type,
|
|
87
|
-
url: blobUrl
|
|
88
|
-
}));
|
|
89
|
-
};
|
|
90
|
-
var FileContainer_default = FileContainer;
|
|
91
|
-
export {
|
|
92
|
-
FileContainer_default as default
|
|
93
|
-
};
|
|
94
|
-
//# sourceMappingURL=FileContainer-W646BCAM.mjs.map
|
|
@@ -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/reader';\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 // Create & submit CAR\n const car = await this.#createCar(blocks);\n await this.putCarRemote(car);\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": ";;;;;;;;;AAIA,SAASA,mBAAwC;AACjD,SAASC,0BAA0B;;;ACDnC,SAASC,iBAAiB;AAE1B,SAASC,sBAAsB;AAC/B,SAASC,qBAAqB;AAC9B,OAAOC,cAAc;AACrB,YAAYC,SAAS;AACrB,OAAOC,SAAS;AAChB,SAASC,WAAW;AACpB,YAAYC,iBAAiB;AAItB,IAAMC,SAAS,CAACC,YAAAA;AACrB,SAAO,IAAIC,gBAAgBD,OAAAA;AAC7B;AAMO,IAAMC,kBAAN,cAA8BC,eAAAA;EAQnCC,YAAYH,SAAkB;AAC5B,UAAK;AAkHEI;0BAAiB,GAAGC,UAAAA,CAAAA;AAhH3B,SAAK,WAAWL,UAAUA,QAAQM,QAAQ,QAAQ,EAAA,IAAMC;AACxD,SAAK,cAAc,IAAIC,cAAcH,UAAAA,CAAAA;AACrC,SAAK,eAAeI,UAAUC;AAC9B,SAA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"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,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/file.ts", "../../../src/types/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { S, TypedObject } from '@dxos/echo-schema';\n\nexport class FileType extends TypedObject({ typename: 'dxos.org/type/File', version: '0.1.0' })({\n name: S.optional(S.String),\n type: S.String,\n cid: S.String,\n timestamp: S.optional(S.String),\n}) {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { FileInfoSchema } from '@dxos/app-framework';\nimport { S } from '@dxos/echo-schema';\nimport { SpaceSchema } from '@dxos/react-client/echo';\n\nimport { FileType } from './file';\nimport { WNFS_PLUGIN } from '../meta';\n\nexport namespace WnfsAction {\n export class Create extends S.TaggedClass<Create>()(`${WNFS_PLUGIN}/action/create`, {\n input: FileInfoSchema.pick('name', 'type', 'cid').pipe(S.required),\n output: S.Struct({\n object: FileType,\n }),\n }) {}\n\n export const UploadAnnotationId = Symbol.for(`${WNFS_PLUGIN}/annotation/upload`);\n\n export const UploadFileSchema = S.Struct({\n file: S.instanceOf(File).annotations({\n [UploadAnnotationId]: {\n // Accept file types.\n 'image/*': ['.jpg', '.jpeg', '.png', '.gif'],\n 'application/pdf': ['.pdf'],\n // TODO(wittjosiah): Add more file types.\n },\n }),\n });\n\n export type UploadFileForm = S.Schema.Type<typeof UploadFileSchema>;\n\n export class Upload extends S.TaggedClass<Upload>()(`${WNFS_PLUGIN}/action/upload`, {\n input: S.extend(UploadFileSchema, S.Struct({ space: SpaceSchema })),\n output: S.required(FileInfoSchema),\n }) {}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,GAAGC,mBAAmB;AAExB,IAAMC,WAAN,cAAuBC,YAAY;EAAEC,UAAU;EAAsBC,SAAS;AAAQ,CAAA,EAAG;EAC9FC,MAAMC,EAAEC,SAASD,EAAEE,MAAM;EACzBC,MAAMH,EAAEE;EACRE,KAAKJ,EAAEE;EACPG,WAAWL,EAAEC,SAASD,EAAEE,MAAM;AAChC,CAAA,EAAA;AAAI;;;ACPJ,SAASI,sBAAsB;AAC/B,SAASC,KAAAA,UAAS;AAClB,SAASC,mBAAmB;;UAKXC,aAAAA;EACR,MAAMC,eAAeC,GAAEC,YAAW,EAAW,GAAGC,WAAAA,kBAA6B;IAClFC,OAAOC,eAAeC,KAAK,QAAQ,QAAQ,KAAA,EAAOC,KAAKN,GAAEO,QAAQ;IACjEC,QAAQR,GAAES,OAAO;MACfC,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;cALSZ,SAAAA;cAOAa,qBAAqBC,OAAOC,IAAI,GAAGZ,WAAAA,oBAA+B;cAElEa,mBAAmBf,GAAES,OAAO;IACvCO,MAAMhB,GAAEiB,WAAWC,IAAAA,EAAMC,YAAY;MACnC,CAAArB,YAACc,kBAAAA,GAAqB;;QAEpB,WAAW;UAAC;UAAQ;UAAS;UAAQ;;QACrC,mBAAmB;UAAC;;MAEtB;IACF,CAAA;EACF,CAAA;EAIO,MAAMQ,eAAepB,GAAEC,YAAW,EAAW,GAAGC,WAAAA,kBAA6B;IAClFC,OAAOH,GAAEqB,OAAMvB,YAACiB,kBAAkBf,GAAES,OAAO;MAAEa,OAAOC;IAAY,CAAA,CAAA;IAChEf,QAAQR,GAAEO,SAASH,cAAAA;EACrB,CAAA,EAAA;EAAI;cAHSgB,SAAAA;AAIf,GA3BiBtB,eAAAA,aAAAA,CAAAA,EAAAA;",
|
|
6
|
-
"names": ["S", "TypedObject", "FileType", "TypedObject", "typename", "version", "name", "S", "optional", "String", "type", "cid", "timestamp", "FileInfoSchema", "S", "SpaceSchema", "WnfsAction", "Create", "S", "TaggedClass", "WNFS_PLUGIN", "input", "FileInfoSchema", "pick", "pipe", "required", "output", "Struct", "object", "FileType", "UploadAnnotationId", "Symbol", "for", "UploadFileSchema", "file", "instanceOf", "File", "annotations", "Upload", "extend", "space", "SpaceSchema"]
|
|
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-CTEISOKD.mjs"));
|
|
4
|
-
var FileUploader = lazy(() => import("./file-uploader-F3C3A4TM.mjs"));
|
|
5
|
-
var IntentResolver = lazy(() => import("./intent-resolver-JSSHOBDG.mjs"));
|
|
6
|
-
var Markdown = lazy(() => import("./markdown-G6DTBWWO.mjs"));
|
|
7
|
-
var ReactSurface = lazy(() => import("./react-surface-BAV7AAW6.mjs"));
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
Blockstore,
|
|
11
|
-
FileUploader,
|
|
12
|
-
IntentResolver,
|
|
13
|
-
Markdown,
|
|
14
|
-
ReactSurface
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=chunk-XZFJLSBE.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/file-uploader.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect, pipe } from 'effect';\n\nimport { Capabilities, chain, contributes, createIntent, type PluginsContext } from '@dxos/app-framework';\nimport { SpaceAction } from '@dxos/plugin-space/types';\n\nimport { WnfsAction } from '../types';\n\nexport default (context: PluginsContext) => {\n return contributes(Capabilities.FileUploader, (file, space) => {\n const { dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n\n const program = Effect.gen(function* () {\n const fileInfo = yield* dispatch(createIntent(WnfsAction.Upload, { file, space }));\n yield* dispatch(pipe(createIntent(WnfsAction.Create, fileInfo), chain(SpaceAction.AddObject, { target: space })));\n return fileInfo;\n });\n\n return Effect.runPromise(program);\n });\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,QAAQC,YAAY;AAE7B,SAASC,cAAcC,OAAOC,aAAaC,oBAAyC;AACpF,SAASC,mBAAmB;AAI5B,IAAA,wBAAe,CAACC,YAAAA;AACd,SAAOC,YAAYC,aAAaC,cAAc,CAACC,MAAMC,UAAAA;AACnD,UAAM,EAAEC,SAAQ,IAAKN,QAAQO,kBAAkBL,aAAaM,gBAAgB;AAE5E,UAAMC,UAAUC,OAAOC,IAAI,aAAA;AACzB,YAAMC,WAAW,OAAON,SAASO,aAAaC,WAAWC,QAAQ;QAAEX;QAAMC;MAAM,CAAA,CAAA;AAC/E,aAAOC,SAASU,KAAKH,aAAaC,WAAWG,QAAQL,QAAAA,GAAWM,MAAMC,YAAYC,WAAW;QAAEC,QAAQhB;MAAM,CAAA,CAAA,CAAA;AAC7G,aAAOO;IACT,CAAA;AAEA,WAAOF,OAAOY,WAAWb,OAAAA;EAC3B,CAAA;AACF;",
|
|
6
|
-
"names": ["Effect", "pipe", "Capabilities", "chain", "contributes", "createIntent", "SpaceAction", "context", "contributes", "Capabilities", "FileUploader", "file", "space", "dispatch", "requestCapability", "IntentDispatcher", "program", "Effect", "gen", "fileInfo", "createIntent", "WnfsAction", "Upload", "pipe", "Create", "chain", "SpaceAction", "AddObject", "target", "runPromise"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/intent-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, Capabilities, createResolver, type PluginsContext } from '@dxos/app-framework';\nimport { live } from '@dxos/react-client/echo';\n\nimport { WnfsCapabilities } from './capabilities';\nimport { upload } from '../helpers';\nimport { FileType, WnfsAction } from '../types';\n\nexport default (context: PluginsContext) =>\n contributes(Capabilities.IntentResolver, [\n // TODO(wittjosiah): Deleting the object doesn't delete the wnfs blob.\n // Consider ways to trigger blob deletion based on object deletion and/or adding file system manager.\n createResolver({\n intent: WnfsAction.Create,\n resolve: ({ name, type, cid }) => ({\n data: {\n object: live(FileType, { name, type, cid }),\n },\n }),\n }),\n createResolver({\n intent: WnfsAction.Upload,\n resolve: async ({ file, space }) => {\n const blockstore = context.requestCapability(WnfsCapabilities.Blockstore);\n const info = await upload({ file, blockstore, space });\n return { data: info };\n },\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;AAIA,SAASA,aAAaC,cAAcC,sBAA2C;AAC/E,SAASC,YAAY;AAMrB,IAAA,0BAAe,CAACC,YACdC,YAAYC,aAAaC,gBAAgB;;;EAGvCC,eAAe;IACbC,QAAQC,WAAWC;IACnBC,SAAS,CAAC,EAAEC,MAAMC,MAAMC,IAAG,OAAQ;MACjCC,MAAM;QACJC,QAAQC,KAAKC,UAAU;UAAEN;UAAMC;UAAMC;QAAI,CAAA;MAC3C;IACF;EACF,CAAA;EACAP,eAAe;IACbC,QAAQC,WAAWU;IACnBR,SAAS,OAAO,EAAES,MAAMC,MAAK,MAAE;AAC7B,YAAMC,aAAanB,QAAQoB,kBAAkBC,iBAAiBC,UAAU;AACxE,YAAMC,OAAO,MAAMC,OAAO;QAAEP;QAAME;QAAYD;MAAM,CAAA;AACpD,aAAO;QAAEN,MAAMW;MAAK;IACtB;EACF,CAAA;CACD;",
|
|
6
|
-
"names": ["contributes", "Capabilities", "createResolver", "live", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "WnfsAction", "Create", "resolve", "name", "type", "cid", "data", "object", "live", "FileType", "Upload", "file", "space", "blockstore", "requestCapability", "WnfsCapabilities", "Blockstore", "info", "upload"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/markdown.ts", "../../../src/extensions/image.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, type PluginsContext } from '@dxos/app-framework';\nimport { MarkdownCapabilities } from '@dxos/plugin-markdown';\nimport { getSpace } from '@dxos/react-client/echo';\n\nimport { WnfsCapabilities } from './capabilities';\nimport { image } from '../extensions';\n\nexport default (context: PluginsContext) =>\n contributes(MarkdownCapabilities.Extensions, [\n ({ document }) => {\n const blockstore = context.requestCapability(WnfsCapabilities.Blockstore);\n const instances = context.requestCapability(WnfsCapabilities.Instances);\n\n if (document) {\n const space = getSpace(document);\n return space ? [image({ blockstore, instances, space })] : [];\n }\n\n return [];\n },\n ]);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { syntaxTree } from '@codemirror/language';\nimport { type EditorState, type Extension, StateField, type Range } from '@codemirror/state';\nimport { Decoration, EditorView, WidgetType } from '@codemirror/view';\nimport type { Blockstore } from 'interface-blockstore';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport { type Space } from '@dxos/react-client/echo';\nimport { Status, ThemeProvider } from '@dxos/react-ui';\nimport { focusField } from '@dxos/react-ui-editor';\nimport { defaultTx } from '@dxos/react-ui-theme';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type WnfsCapabilities } from '../capabilities';\nimport { getBlobUrl, getPathFromUrl, loadWnfs } from '../helpers';\n\nconst WAIT_UNTIL_LOADER = 1500;\n\nexport type ImageOptions = {\n blockstore: Blockstore;\n instances: WnfsCapabilities.Instances;\n space: Space;\n};\n\n/**\n * Create WNFS image decorations.\n */\nexport const image = (options: ImageOptions): Extension[] => {\n const blobUrlCache: Record<string, string> = {};\n const preloaded = new Set<string>();\n\n const preload = (url: string) => {\n if (!preloaded.has(url)) {\n const img = document.createElement('img');\n img.src = url;\n preloaded.add(url);\n }\n };\n\n return [\n StateField.define({\n create: (state) => {\n return Decoration.set(\n buildDecorations({ from: 0, to: state.doc.length, state, blobUrlCache, preload, options }),\n );\n },\n update: (value, tr) => {\n if (!tr.docChanged && !tr.selection) {\n return value;\n }\n\n // Find range of changes and cursor changes.\n const cursor = tr.state.selection.main.head;\n const oldCursor = tr.changes.mapPos(tr.startState.selection.main.head);\n let from = Math.min(cursor, oldCursor);\n let to = Math.max(cursor, oldCursor);\n tr.changes.iterChangedRanges((fromA, toA, fromB, toB) => {\n from = Math.min(from, fromB);\n to = Math.max(to, toB);\n });\n\n // Expand to cover lines.\n from = tr.state.doc.lineAt(from).from;\n to = tr.state.doc.lineAt(to).to;\n\n return value.map(tr.changes).update({\n filterFrom: from,\n filterTo: to,\n filter: () => false,\n add: buildDecorations({ from, to, state: tr.state, blobUrlCache, preload, options }),\n });\n },\n provide: (field) => EditorView.decorations.from(field),\n }),\n ];\n};\n\nconst buildDecorations = ({\n from,\n to,\n state,\n blobUrlCache,\n preload,\n options: { blockstore, instances, space },\n}: {\n from: number;\n to: number;\n state: EditorState;\n blobUrlCache: Record<string, string>;\n preload: (url: string) => void;\n options: ImageOptions;\n}) => {\n const decorations: Range<Decoration>[] = [];\n const cursor = state.selection.main.head;\n syntaxTree(state).iterate({\n enter: (node) => {\n if (node.name !== 'Image') {\n return;\n }\n\n const urlNode = node.node.getChild('URL');\n if (!urlNode) {\n return;\n }\n\n const hide = state.readOnly || cursor < node.from || cursor > node.to;\n const wnfsUrl = state.sliceDoc(urlNode.from, urlNode.to);\n if (!wnfsUrl.startsWith('wnfs://')) {\n return;\n }\n\n const path = getPathFromUrl(wnfsUrl);\n\n // Cannot load images from other spaces\n const spaceId = path[1];\n if (spaceId !== space.id) {\n return;\n }\n\n // Load image contents into memory blob\n const blobUrlPromise = (async () => {\n const { directory, forest } = await loadWnfs({ blockstore, instances, space });\n const url = await getBlobUrl({ wnfsUrl, blockstore, directory, forest });\n blobUrlCache[path.join('/')] = url;\n preload(url);\n return url;\n })();\n\n decorations.push(\n Decoration.replace({\n block: true, // Prevent cursor from entering.\n widget: new WnfsImageWidget(wnfsUrl, blobUrlCache[path.join('/')] ?? blobUrlPromise),\n }).range(hide ? node.from : node.to, node.to),\n );\n },\n from,\n to,\n });\n\n return decorations;\n};\n\nconst createImg = (view: EditorView, url: string) => {\n const img = document.createElement('img');\n img.setAttribute('src', url);\n img.setAttribute('class', 'cm-image-with-loader');\n // If focused, hide image until successfully loaded to avoid flickering effects.\n if (view.state.field(focusField)) {\n img.onload = () => img.classList.add('cm-loaded-image');\n } else {\n img.classList.add('cm-loaded-image');\n }\n return img;\n};\n\nclass WnfsImageWidget extends WidgetType {\n constructor(\n readonly _wnfsUrl: string,\n readonly _url: MaybePromise<string>,\n ) {\n super();\n }\n\n override eq(other: this) {\n return this._wnfsUrl === (other as any as WnfsImageWidget)._wnfsUrl;\n }\n\n override toDOM(view: EditorView) {\n if (typeof this._url === 'string') {\n return createImg(view, this._url);\n }\n\n const widget = document.createElement('div');\n widget.className = 'cm-image-wrapper';\n const loader = document.createElement('div');\n loader.className = 'mx-auto transition-opacity';\n let loaderAdded = false;\n\n const timeout = setTimeout(() => {\n const root = createRoot(loader);\n root.render(\n <ThemeProvider tx={defaultTx}>\n <Status indeterminate />\n </ThemeProvider>,\n );\n widget.appendChild(loader);\n loaderAdded = true;\n }, WAIT_UNTIL_LOADER);\n\n void this._url.then((url) => {\n clearTimeout(timeout);\n const img = createImg(view, url);\n loaderAdded && widget.removeChild(loader);\n widget.appendChild(img);\n });\n\n return widget;\n }\n}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D,YAAY;AACnB,QAAIE,cAAc;AAElB,UAAMC,UAAUC,WAAW,MAAA;AACzB,YAAMC,OAAOC,WAAWL,MAAAA;AACxBI,WAAKE,OACH,sBAAA,cAACC,eAAAA;QAAcC,IAAIC;SACjB,sBAAA,cAACC,QAAAA;QAAOC,eAAAA;;AAGZ5B,aAAO6B,YAAYZ,MAAAA;AACnBC,oBAAc;IAChB,GAAGpG,iBAAAA;AAEH,SAAK,KAAK8F,KAAKkB,KAAK,CAACzG,QAAAA;AACnB0G,mBAAaZ,OAAAA;AACb,YAAM5F,MAAM4E,UAAUC,MAAM/E,GAAAA;AAC5B6F,qBAAelB,OAAOgC,YAAYf,MAAAA;AAClCjB,aAAO6B,YAAYtG,GAAAA;IACrB,CAAA;AAEA,WAAOyE;EACT;AACF;;;AD/LA,IAAA,mBAAe,CAACiC,YACdC,YAAYC,qBAAqBC,YAAY;EAC3C,CAAC,EAAEC,UAAAA,UAAQ,MAAE;AACX,UAAMC,aAAaL,QAAQM,kBAAkBC,iBAAiBC,UAAU;AACxE,UAAMC,YAAYT,QAAQM,kBAAkBC,iBAAiBG,SAAS;AAEtE,QAAIN,WAAU;AACZ,YAAMO,QAAQC,SAASR,SAAAA;AACvB,aAAOO,QAAQ;QAACE,MAAM;UAAER;UAAYI;UAAWE;QAAM,CAAA;UAAM,CAAA;IAC7D;AAEA,WAAO,CAAA;EACT;CACD;",
|
|
6
|
-
"names": ["contributes", "MarkdownCapabilities", "getSpace", "syntaxTree", "StateField", "Decoration", "EditorView", "WidgetType", "React", "createRoot", "Status", "ThemeProvider", "focusField", "defaultTx", "WAIT_UNTIL_LOADER", "image", "options", "blobUrlCache", "preloaded", "Set", "preload", "url", "has", "img", "document", "createElement", "src", "add", "StateField", "define", "create", "state", "Decoration", "set", "buildDecorations", "from", "to", "doc", "length", "update", "value", "tr", "docChanged", "selection", "cursor", "main", "head", "oldCursor", "changes", "mapPos", "startState", "Math", "min", "max", "iterChangedRanges", "fromA", "toA", "fromB", "toB", "lineAt", "map", "filterFrom", "filterTo", "filter", "provide", "field", "EditorView", "decorations", "blockstore", "instances", "space", "syntaxTree", "iterate", "enter", "node", "name", "urlNode", "getChild", "hide", "readOnly", "wnfsUrl", "sliceDoc", "startsWith", "path", "getPathFromUrl", "spaceId", "id", "blobUrlPromise", "directory", "forest", "loadWnfs", "getBlobUrl", "join", "push", "replace", "block", "widget", "WnfsImageWidget", "range", "createImg", "view", "setAttribute", "focusField", "onload", "classList", "WidgetType", "constructor", "_wnfsUrl", "_url", "eq", "other", "toDOM", "className", "loader", "loaderAdded", "timeout", "setTimeout", "root", "createRoot", "render", "ThemeProvider", "tx", "defaultTx", "Status", "indeterminate", "appendChild", "then", "clearTimeout", "removeChild", "context", "contributes", "MarkdownCapabilities", "Extensions", "document", "blockstore", "requestCapability", "WnfsCapabilities", "Blockstore", "instances", "Instances", "space", "getSpace", "image"]
|
|
7
|
-
}
|