@dxos/plugin-wnfs 0.8.3-staging.0fa589b → 0.8.4-main.1068cf700f
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-FUAINNAS.mjs +91 -0
- package/dist/lib/browser/FileContainer-FUAINNAS.mjs.map +7 -0
- package/dist/lib/browser/{blockstore-UT7233RJ.mjs → blockstore-U42RF6KA.mjs} +20 -20
- package/dist/lib/browser/blockstore-U42RF6KA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YYAW4U6J.mjs → chunk-NCTUASHL.mjs} +23 -15
- package/dist/lib/browser/chunk-NCTUASHL.mjs.map +7 -0
- package/dist/lib/browser/chunk-PCYQNMXS.mjs +155 -0
- package/dist/lib/browser/chunk-PCYQNMXS.mjs.map +7 -0
- package/dist/lib/browser/file-uploader-VBBUS2GG.mjs +35 -0
- package/dist/lib/browser/file-uploader-VBBUS2GG.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +92 -91
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{markdown-BWBHUHHH.mjs → markdown-ZLOS5HZU.mjs} +32 -27
- package/dist/lib/browser/markdown-ZLOS5HZU.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-7TLMWGST.mjs +99 -0
- package/dist/lib/browser/operation-resolver-7TLMWGST.mjs.map +7 -0
- package/dist/lib/browser/react-surface-YTIVVF2C.mjs +82 -0
- package/dist/lib/browser/react-surface-YTIVVF2C.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +9 -6
- package/dist/types/src/WnfsPlugin.d.ts +2 -1
- package/dist/types/src/WnfsPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/blockstore/blockstore.d.ts +5 -0
- package/dist/types/src/capabilities/blockstore/blockstore.d.ts.map +1 -0
- package/dist/types/src/capabilities/blockstore/index.d.ts +3 -0
- package/dist/types/src/capabilities/blockstore/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/file-uploader/file-uploader.d.ts +6 -0
- package/dist/types/src/capabilities/file-uploader/file-uploader.d.ts.map +1 -0
- package/dist/types/src/capabilities/file-uploader/index.d.ts +3 -0
- package/dist/types/src/capabilities/file-uploader/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown/index.d.ts +3 -0
- package/dist/types/src/capabilities/markdown/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/FileContainer.d.ts +4 -5
- package/dist/types/src/components/FileContainer.d.ts.map +1 -1
- package/dist/types/src/components/FileInput.d.ts +1 -1
- package/dist/types/src/components/FileInput.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/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 +5 -4
- package/dist/types/src/extensions/image.stories.d.ts.map +1 -1
- package/dist/types/src/helpers/load.d.ts +2 -2
- 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/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +17 -12
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/File.d.ts +16 -0
- package/dist/types/src/types/File.d.ts.map +1 -0
- package/dist/types/src/{capabilities → types}/capabilities.d.ts +3 -2
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +108 -47
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -42
- package/src/WnfsPlugin.tsx +64 -81
- package/src/blockstore.ts +2 -2
- package/src/capabilities/blockstore/blockstore.ts +22 -0
- package/src/capabilities/blockstore/index.ts +7 -0
- package/src/capabilities/file-uploader/file-uploader.ts +34 -0
- package/src/capabilities/file-uploader/index.ts +7 -0
- package/src/capabilities/index.ts +5 -9
- package/src/capabilities/markdown/index.ts +7 -0
- package/src/capabilities/markdown/markdown.ts +33 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +62 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +50 -0
- package/src/components/FileContainer.tsx +30 -19
- package/src/components/FileInput.tsx +5 -5
- package/src/components/FilePreview.tsx +4 -4
- package/src/extensions/image.stories.tsx +18 -14
- package/src/extensions/image.tsx +9 -9
- package/src/helpers/load.ts +14 -8
- package/src/helpers/upload.ts +6 -2
- package/src/index.ts +1 -1
- package/src/meta.ts +9 -6
- package/src/translations.ts +14 -7
- package/src/types/File.ts +24 -0
- package/src/{capabilities → types}/capabilities.ts +4 -4
- package/src/types/index.ts +2 -1
- package/src/types/types.ts +58 -17
- package/dist/lib/browser/FileContainer-7YOCEQ6P.mjs +0 -106
- package/dist/lib/browser/FileContainer-7YOCEQ6P.mjs.map +0 -7
- package/dist/lib/browser/blockstore-UT7233RJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-DL7BBH57.mjs +0 -16
- package/dist/lib/browser/chunk-DL7BBH57.mjs.map +0 -7
- package/dist/lib/browser/chunk-PHTWWADN.mjs +0 -15
- package/dist/lib/browser/chunk-PHTWWADN.mjs.map +0 -7
- package/dist/lib/browser/chunk-SCL6PT4P.mjs +0 -64
- package/dist/lib/browser/chunk-SCL6PT4P.mjs.map +0 -7
- package/dist/lib/browser/chunk-WJVYRUYQ.mjs +0 -16
- package/dist/lib/browser/chunk-WJVYRUYQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-YYAW4U6J.mjs.map +0 -7
- package/dist/lib/browser/file-uploader-RHINBPDQ.mjs +0 -29
- package/dist/lib/browser/file-uploader-RHINBPDQ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-JDRRPIZC.mjs +0 -49
- package/dist/lib/browser/intent-resolver-JDRRPIZC.mjs.map +0 -7
- package/dist/lib/browser/markdown-BWBHUHHH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-6GM4J4YG.mjs +0 -88
- package/dist/lib/browser/react-surface-6GM4J4YG.mjs.map +0 -7
- package/dist/types/src/capabilities/blockstore.d.ts +0 -4
- package/dist/types/src/capabilities/blockstore.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/file-uploader.d.ts +0 -4
- package/dist/types/src/capabilities/file-uploader.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown.d.ts +0 -4
- package/dist/types/src/capabilities/markdown.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/types/file.d.ts +0 -16
- package/dist/types/src/types/file.d.ts.map +0 -1
- package/src/capabilities/blockstore.ts +0 -18
- package/src/capabilities/file-uploader.ts +0 -24
- package/src/capabilities/intent-resolver.ts +0 -32
- package/src/capabilities/markdown.ts +0 -25
- package/src/capabilities/react-surface.tsx +0 -45
- package/src/types/file.ts +0 -17
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { contributes, type PluginContext } from '@dxos/app-framework';
|
|
6
|
-
import { MarkdownCapabilities } from '@dxos/plugin-markdown';
|
|
7
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
8
|
-
|
|
9
|
-
import { WnfsCapabilities } from './capabilities';
|
|
10
|
-
import { image } from '../extensions';
|
|
11
|
-
|
|
12
|
-
export default (context: PluginContext) =>
|
|
13
|
-
contributes(MarkdownCapabilities.Extensions, [
|
|
14
|
-
({ document }) => {
|
|
15
|
-
const blockstore = context.getCapability(WnfsCapabilities.Blockstore);
|
|
16
|
-
const instances = context.getCapability(WnfsCapabilities.Instances);
|
|
17
|
-
|
|
18
|
-
if (document) {
|
|
19
|
-
const space = getSpace(document);
|
|
20
|
-
return space ? [image({ blockstore, instances, space })] : [];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return [];
|
|
24
|
-
},
|
|
25
|
-
]);
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Schema } from 'effect';
|
|
6
|
-
import React, { useCallback } from 'react';
|
|
7
|
-
|
|
8
|
-
import { contributes, Capabilities, createSurface } from '@dxos/app-framework';
|
|
9
|
-
import { Obj } from '@dxos/echo';
|
|
10
|
-
import { findAnnotation } from '@dxos/effect';
|
|
11
|
-
import { type InputProps } from '@dxos/react-ui-form';
|
|
12
|
-
|
|
13
|
-
import { FileContainer, FileInput } from '../components';
|
|
14
|
-
import { WNFS_PLUGIN } from '../meta';
|
|
15
|
-
import { FileType, WnfsAction } from '../types';
|
|
16
|
-
|
|
17
|
-
export default () =>
|
|
18
|
-
contributes(Capabilities.ReactSurface, [
|
|
19
|
-
createSurface({
|
|
20
|
-
id: `${WNFS_PLUGIN}/article`,
|
|
21
|
-
role: ['article', 'section', 'slide'],
|
|
22
|
-
filter: (data): data is { subject: FileType } => Obj.instanceOf(FileType, data.subject),
|
|
23
|
-
component: ({ data, role }) => <FileContainer role={role} file={data.subject} />,
|
|
24
|
-
}),
|
|
25
|
-
createSurface({
|
|
26
|
-
id: `${WNFS_PLUGIN}/create-form`,
|
|
27
|
-
role: 'form-input',
|
|
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
|
-
);
|
|
33
|
-
return !!annotation;
|
|
34
|
-
},
|
|
35
|
-
component: ({ data: { prop, schema }, ...props }) => {
|
|
36
|
-
const inputProps = props as unknown as InputProps;
|
|
37
|
-
const handleChange = useCallback(
|
|
38
|
-
(file: File) => inputProps.onValueChange?.('object', file),
|
|
39
|
-
[prop, inputProps.onValueChange],
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
return <FileInput schema={schema} onChange={handleChange} />;
|
|
43
|
-
},
|
|
44
|
-
}),
|
|
45
|
-
]);
|
package/src/types/file.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { TypedObject } from '@dxos/echo-schema';
|
|
8
|
-
|
|
9
|
-
export class FileType extends TypedObject({
|
|
10
|
-
typename: 'dxos.org/type/File',
|
|
11
|
-
version: '0.1.0',
|
|
12
|
-
})({
|
|
13
|
-
name: Schema.optional(Schema.String),
|
|
14
|
-
type: Schema.String,
|
|
15
|
-
cid: Schema.String,
|
|
16
|
-
timestamp: Schema.optional(Schema.String),
|
|
17
|
-
}) {}
|