@dxos/plugin-template 0.8.4-main.ead640a → 0.8.4-main.effb148878
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/TemplatePlugin.mjs +24 -0
- package/dist/lib/neutral/TemplatePlugin.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +9 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-AITG64J5.mjs +19 -0
- package/dist/lib/neutral/chunk-AITG64J5.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NFCVHUB5.mjs +18 -0
- package/dist/lib/neutral/chunk-NFCVHUB5.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +14 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-K2JXEGV4.mjs +26 -0
- package/dist/lib/neutral/create-object-K2JXEGV4.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +11 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +7 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +11 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-SYA2674P.mjs +21 -0
- package/dist/lib/neutral/react-surface-SYA2674P.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +28 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/types/index.mjs +1 -1
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/TemplatePlugin.d.ts +3 -1
- package/dist/types/src/TemplatePlugin.d.ts.map +1 -1
- package/dist/types/src/TemplatePlugin.test.d.ts +2 -0
- package/dist/types/src/TemplatePlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +8 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/TemplatePanel/TemplatePanel.d.ts +6 -0
- package/dist/types/src/components/TemplatePanel/TemplatePanel.d.ts.map +1 -0
- package/dist/types/src/components/TemplatePanel/index.d.ts +2 -0
- package/dist/types/src/components/TemplatePanel/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/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +22 -13
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +8 -23
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +76 -38
- package/src/TemplatePlugin.test.ts +26 -0
- package/src/TemplatePlugin.tsx +15 -54
- package/src/capabilities/create-object.ts +31 -0
- package/src/capabilities/index.ts +3 -3
- package/src/capabilities/react-surface.tsx +20 -15
- package/src/components/TemplatePanel/TemplatePanel.tsx +21 -0
- package/src/components/TemplatePanel/index.ts +5 -0
- package/src/components/index.ts +1 -1
- package/src/index.ts +1 -1
- package/src/meta.ts +10 -3
- package/src/plugin.ts +9 -0
- package/src/translations.ts +14 -11
- package/src/types/schema.ts +10 -18
- package/dist/lib/browser/chunk-2QKMXSV3.mjs +0 -43
- package/dist/lib/browser/chunk-2QKMXSV3.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -85
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5XH7GWYS.mjs +0 -20
- package/dist/lib/browser/intent-resolver-5XH7GWYS.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-A27A5AQR.mjs +0 -40
- package/dist/lib/browser/react-surface-A27A5AQR.mjs.map +0 -7
- 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/components/TemplateContainer.d.ts +0 -7
- package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -18
- package/src/components/TemplateContainer.tsx +0 -19
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
package/package.json
CHANGED
|
@@ -1,66 +1,104 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-template",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.effb148878",
|
|
4
4
|
"description": "Template for new plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
-
"
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
10
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#capabilities": {
|
|
17
|
+
"source": "./src/capabilities/index.ts",
|
|
18
|
+
"types": "./dist/types/src/capabilities/index.d.ts",
|
|
19
|
+
"default": "./dist/lib/neutral/capabilities/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"#components": {
|
|
22
|
+
"source": "./src/components/index.ts",
|
|
23
|
+
"types": "./dist/types/src/components/index.d.ts",
|
|
24
|
+
"default": "./dist/lib/neutral/components/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"#meta": {
|
|
27
|
+
"source": "./src/meta.ts",
|
|
28
|
+
"types": "./dist/types/src/meta.d.ts",
|
|
29
|
+
"default": "./dist/lib/neutral/meta.mjs"
|
|
30
|
+
},
|
|
31
|
+
"#plugin": {
|
|
32
|
+
"source": "./src/TemplatePlugin.tsx",
|
|
33
|
+
"types": "./dist/types/src/TemplatePlugin.d.ts",
|
|
34
|
+
"default": "./dist/lib/neutral/TemplatePlugin.mjs"
|
|
35
|
+
},
|
|
36
|
+
"#translations": {
|
|
37
|
+
"source": "./src/translations.ts",
|
|
38
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
39
|
+
"default": "./dist/lib/neutral/translations.mjs"
|
|
40
|
+
},
|
|
41
|
+
"#types": {
|
|
42
|
+
"source": "./src/types/index.ts",
|
|
43
|
+
"types": "./dist/types/src/types/index.d.ts",
|
|
44
|
+
"default": "./dist/lib/neutral/types/index.mjs"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
11
47
|
"exports": {
|
|
12
48
|
".": {
|
|
13
49
|
"source": "./src/index.ts",
|
|
14
50
|
"types": "./dist/types/src/index.d.ts",
|
|
15
|
-
"
|
|
51
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
16
52
|
},
|
|
17
|
-
"./
|
|
18
|
-
"source": "./src/
|
|
19
|
-
"types": "./dist/types/src/
|
|
20
|
-
"
|
|
53
|
+
"./plugin": {
|
|
54
|
+
"source": "./src/plugin.ts",
|
|
55
|
+
"types": "./dist/types/src/plugin.d.ts",
|
|
56
|
+
"default": "./dist/lib/neutral/plugin.mjs"
|
|
57
|
+
},
|
|
58
|
+
"./translations": {
|
|
59
|
+
"source": "./src/translations.ts",
|
|
60
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
61
|
+
"default": "./dist/lib/neutral/translations.mjs"
|
|
21
62
|
}
|
|
22
63
|
},
|
|
23
64
|
"types": "dist/types/src/index.d.ts",
|
|
24
|
-
"typesVersions": {
|
|
25
|
-
"*": {
|
|
26
|
-
"types": [
|
|
27
|
-
"dist/types/src/types/index.d.ts"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
65
|
"files": [
|
|
32
66
|
"dist",
|
|
33
67
|
"src"
|
|
34
68
|
],
|
|
35
69
|
"dependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/plugin-client": "0.8.4-main.
|
|
43
|
-
"@dxos/plugin-space": "0.8.4-main.
|
|
44
|
-
"@dxos/plugin-graph": "0.8.4-main.
|
|
45
|
-
"@dxos/react-
|
|
46
|
-
"@dxos/react-
|
|
70
|
+
"@radix-ui/react-context": "1.1.1",
|
|
71
|
+
"effect": "3.20.0",
|
|
72
|
+
"@dxos/app-toolkit": "0.8.4-main.effb148878",
|
|
73
|
+
"@dxos/async": "0.8.4-main.effb148878",
|
|
74
|
+
"@dxos/compute": "0.8.4-main.effb148878",
|
|
75
|
+
"@dxos/app-framework": "0.8.4-main.effb148878",
|
|
76
|
+
"@dxos/plugin-client": "0.8.4-main.effb148878",
|
|
77
|
+
"@dxos/plugin-space": "0.8.4-main.effb148878",
|
|
78
|
+
"@dxos/plugin-graph": "0.8.4-main.effb148878",
|
|
79
|
+
"@dxos/react-client": "0.8.4-main.effb148878",
|
|
80
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.effb148878",
|
|
81
|
+
"@dxos/util": "0.8.4-main.effb148878",
|
|
82
|
+
"@dxos/echo": "0.8.4-main.effb148878",
|
|
83
|
+
"@dxos/react-ui-stack": "0.8.4-main.effb148878"
|
|
47
84
|
},
|
|
48
85
|
"devDependencies": {
|
|
49
|
-
"@types/react": "~19.2.
|
|
50
|
-
"@types/react-dom": "~19.2.
|
|
51
|
-
"react": "~19.2.
|
|
52
|
-
"react-dom": "~19.2.
|
|
53
|
-
"vite": "
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
86
|
+
"@types/react": "~19.2.7",
|
|
87
|
+
"@types/react-dom": "~19.2.3",
|
|
88
|
+
"react": "~19.2.3",
|
|
89
|
+
"react-dom": "~19.2.3",
|
|
90
|
+
"vite": "^8.0.14",
|
|
91
|
+
"@dxos/plugin-testing": "0.8.4-main.effb148878",
|
|
92
|
+
"@dxos/storybook-utils": "0.8.4-main.effb148878",
|
|
93
|
+
"@dxos/react-ui": "0.8.4-main.effb148878",
|
|
94
|
+
"@dxos/ui-theme": "0.8.4-main.effb148878"
|
|
57
95
|
},
|
|
58
96
|
"peerDependencies": {
|
|
59
|
-
"effect": "
|
|
60
|
-
"react": "
|
|
61
|
-
"react-dom": "
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/react-ui
|
|
97
|
+
"effect": "3.20.0",
|
|
98
|
+
"react": "~19.2.3",
|
|
99
|
+
"react-dom": "~19.2.3",
|
|
100
|
+
"@dxos/ui-theme": "0.8.4-main.effb148878",
|
|
101
|
+
"@dxos/react-ui": "0.8.4-main.effb148878"
|
|
64
102
|
},
|
|
65
103
|
"publishConfig": {
|
|
66
104
|
"access": "public"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
8
|
+
import { createComposerTestApp } from '@dxos/plugin-testing/harness';
|
|
9
|
+
|
|
10
|
+
import { TemplatePlugin } from '#plugin';
|
|
11
|
+
|
|
12
|
+
import { meta } from './meta';
|
|
13
|
+
|
|
14
|
+
const moduleId = (name: string) => `${meta.id}.module.${name}`;
|
|
15
|
+
|
|
16
|
+
describe('TemplatePlugin', () => {
|
|
17
|
+
test('modules activate on the expected events', async ({ expect }) => {
|
|
18
|
+
await using harness = await createComposerTestApp({
|
|
19
|
+
plugins: [ClientPlugin({}), TemplatePlugin()],
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
expect(harness.manager.getActive()).toEqual(
|
|
23
|
+
expect.arrayContaining([moduleId('CreateObject'), moduleId('schema'), moduleId('ReactSurface')]),
|
|
24
|
+
);
|
|
25
|
+
}, 20_000);
|
|
26
|
+
});
|
package/src/TemplatePlugin.tsx
CHANGED
|
@@ -2,59 +2,20 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
8
|
-
import { defineObjectForm } from '@dxos/plugin-space/types';
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
9
7
|
|
|
10
|
-
import {
|
|
11
|
-
import { meta } from '
|
|
12
|
-
import { translations } from '
|
|
13
|
-
import { Template } from '
|
|
8
|
+
import { CreateObject, ReactSurface } from '#capabilities';
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { translations } from '#translations';
|
|
11
|
+
import { Template } from '#types';
|
|
14
12
|
|
|
15
|
-
export const TemplatePlugin =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
activate: () =>
|
|
25
|
-
contributes(Capabilities.Metadata, {
|
|
26
|
-
id: Template.Data.typename,
|
|
27
|
-
metadata: {
|
|
28
|
-
icon: 'ph--asterisk--regular',
|
|
29
|
-
iconClassName: 'text-skySurfaceText',
|
|
30
|
-
},
|
|
31
|
-
}),
|
|
32
|
-
}),
|
|
33
|
-
defineModule({
|
|
34
|
-
id: `${meta.id}/module/object-form`,
|
|
35
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
36
|
-
activate: () =>
|
|
37
|
-
contributes(
|
|
38
|
-
SpaceCapabilities.ObjectForm,
|
|
39
|
-
defineObjectForm({
|
|
40
|
-
objectSchema: Template.Data,
|
|
41
|
-
getIntent: () => createIntent(Template.Create),
|
|
42
|
-
}),
|
|
43
|
-
),
|
|
44
|
-
}),
|
|
45
|
-
defineModule({
|
|
46
|
-
id: `${meta.id}/module/schema`,
|
|
47
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
48
|
-
activate: () => contributes(ClientCapabilities.Schema, [Template.Data]),
|
|
49
|
-
}),
|
|
50
|
-
defineModule({
|
|
51
|
-
id: `${meta.id}/module/react-surface`,
|
|
52
|
-
activatesOn: Events.SetupReactSurface,
|
|
53
|
-
activate: ReactSurface,
|
|
54
|
-
}),
|
|
55
|
-
defineModule({
|
|
56
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
57
|
-
activatesOn: Events.SetupIntentResolver,
|
|
58
|
-
activate: IntentResolver,
|
|
59
|
-
}),
|
|
60
|
-
]);
|
|
13
|
+
export const TemplatePlugin = Plugin.define(meta).pipe(
|
|
14
|
+
AppPlugin.addCreateObjectModule({ activate: CreateObject }),
|
|
15
|
+
AppPlugin.addSchemaModule({ schema: [Template.Data] }),
|
|
16
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
17
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
18
|
+
Plugin.make,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export default TemplatePlugin;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Type } from '@dxos/echo';
|
|
10
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
11
|
+
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
12
|
+
|
|
13
|
+
import { Template } from '#types';
|
|
14
|
+
|
|
15
|
+
export default Capability.makeModule(
|
|
16
|
+
Effect.fnUntraced(function* () {
|
|
17
|
+
return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {
|
|
18
|
+
id: Type.getTypename(Template.Data),
|
|
19
|
+
createObject: (props, options) =>
|
|
20
|
+
Effect.gen(function* () {
|
|
21
|
+
const object = Template.make(props);
|
|
22
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
23
|
+
object,
|
|
24
|
+
target: options.target,
|
|
25
|
+
hidden: true,
|
|
26
|
+
targetNodeId: options.targetNodeId,
|
|
27
|
+
});
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const
|
|
8
|
-
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
7
|
+
export const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));
|
|
8
|
+
export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
|
|
@@ -2,22 +2,27 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
|
-
import { Capabilities,
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
10
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
9
11
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { Template } from '../types';
|
|
12
|
+
import { TemplatePanel } from '#components';
|
|
13
|
+
import { Template } from '#types';
|
|
13
14
|
|
|
14
|
-
export default () =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
export default Capability.makeModule(() =>
|
|
16
|
+
Effect.succeed(
|
|
17
|
+
Capability.contributes(
|
|
18
|
+
Capabilities.ReactSurface,
|
|
19
|
+
Surface.create({
|
|
20
|
+
id: 'root',
|
|
21
|
+
filter: AppSurface.object(AppSurface.Article, Template.Data),
|
|
22
|
+
component: ({ data, role }) => (
|
|
23
|
+
<TemplatePanel role={role} subject={data.subject} attendableId={data.attendableId} />
|
|
24
|
+
),
|
|
25
|
+
}),
|
|
26
|
+
),
|
|
27
|
+
),
|
|
28
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { Panel } from '@dxos/react-ui';
|
|
10
|
+
|
|
11
|
+
export type TemplatePanelProps = AppSurface.ObjectArticleProps<Obj.Unknown>;
|
|
12
|
+
|
|
13
|
+
export const TemplatePanel = ({ role, subject: object, attendableId: _attendableId }: TemplatePanelProps) => {
|
|
14
|
+
return (
|
|
15
|
+
<Panel.Root role={role} className='dx-document'>
|
|
16
|
+
<Panel.Content>
|
|
17
|
+
<span>{Obj.getURI(object)}</span>
|
|
18
|
+
</Panel.Content>
|
|
19
|
+
</Panel.Root>
|
|
20
|
+
);
|
|
21
|
+
};
|
package/src/components/index.ts
CHANGED
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const meta:
|
|
8
|
-
id: 'dxos.
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.template',
|
|
9
10
|
name: 'Template',
|
|
11
|
+
author: 'DXOS',
|
|
12
|
+
description: trim`
|
|
13
|
+
Create reusable templates for documents, tables, and other objects.
|
|
14
|
+
Define structured patterns that can be quickly instantiated with pre-configured content and settings.
|
|
15
|
+
`,
|
|
10
16
|
icon: 'ph--asterisk--regular',
|
|
17
|
+
iconHue: 'sky',
|
|
11
18
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template',
|
|
12
19
|
};
|
package/src/plugin.ts
ADDED
package/src/translations.ts
CHANGED
|
@@ -2,25 +2,28 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Type } from '@dxos/echo';
|
|
5
6
|
import { type Resource } from '@dxos/react-ui';
|
|
6
7
|
|
|
7
|
-
import { meta } from '
|
|
8
|
-
import { Template } from '
|
|
8
|
+
import { meta } from '#meta';
|
|
9
|
+
import { Template } from '#types';
|
|
9
10
|
|
|
10
11
|
export const translations = [
|
|
11
12
|
{
|
|
12
13
|
'en-US': {
|
|
13
|
-
[Template.Data
|
|
14
|
-
'typename
|
|
15
|
-
'typename
|
|
16
|
-
'typename
|
|
17
|
-
'typename
|
|
18
|
-
'object
|
|
19
|
-
'
|
|
20
|
-
'
|
|
14
|
+
[Type.getTypename(Template.Data)]: {
|
|
15
|
+
'typename.label': 'Template',
|
|
16
|
+
'typename.label_zero': 'Templates',
|
|
17
|
+
'typename.label_one': 'Template',
|
|
18
|
+
'typename.label_other': 'Templates',
|
|
19
|
+
'object-name.placeholder': 'New template',
|
|
20
|
+
'add-object.label': 'Add template',
|
|
21
|
+
'rename-object.label': 'Rename template',
|
|
22
|
+
'delete-object.label': 'Delete template',
|
|
23
|
+
'object-deleted.label': 'Template deleted',
|
|
21
24
|
},
|
|
22
25
|
[meta.id]: {
|
|
23
|
-
'plugin
|
|
26
|
+
'plugin.name': 'Template',
|
|
24
27
|
},
|
|
25
28
|
},
|
|
26
29
|
},
|
package/src/types/schema.ts
CHANGED
|
@@ -4,28 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { Obj } from '@dxos/echo';
|
|
8
|
-
import { TypedObject } from '@dxos/echo/internal';
|
|
9
|
-
import { ReactiveObjectSchema } from '@dxos/react-client/echo';
|
|
10
|
-
|
|
11
|
-
import { meta } from '../meta';
|
|
7
|
+
import { DXN, Annotation, Obj, Type } from '@dxos/echo';
|
|
12
8
|
|
|
13
9
|
export namespace Template {
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
export const Data = Schema.Struct({
|
|
11
|
+
name: Schema.optional(Schema.String),
|
|
12
|
+
}).pipe(
|
|
13
|
+
Annotation.IconAnnotation.set({
|
|
14
|
+
icon: 'ph--asterisk--regular',
|
|
15
|
+
hue: 'sky',
|
|
20
16
|
}),
|
|
21
|
-
|
|
17
|
+
Type.makeObject(DXN.make('org.dxos.type.data', '0.1.0')),
|
|
18
|
+
);
|
|
22
19
|
|
|
23
|
-
export
|
|
24
|
-
typename: 'dxos.org/type/Data',
|
|
25
|
-
version: '0.1.0',
|
|
26
|
-
})({
|
|
27
|
-
name: Schema.optional(Schema.String),
|
|
28
|
-
}) {}
|
|
20
|
+
export type Data = Type.InstanceType<typeof Data>;
|
|
29
21
|
|
|
30
22
|
export const make = (props: Partial<Data>) => Obj.make(Data, props);
|
|
31
23
|
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// src/types/schema.ts
|
|
2
|
-
import * as Schema from "effect/Schema";
|
|
3
|
-
import { Obj } from "@dxos/echo";
|
|
4
|
-
import { TypedObject } from "@dxos/echo/internal";
|
|
5
|
-
import { ReactiveObjectSchema } from "@dxos/react-client/echo";
|
|
6
|
-
|
|
7
|
-
// src/meta.ts
|
|
8
|
-
var meta = {
|
|
9
|
-
id: "dxos.org/plugin/template",
|
|
10
|
-
name: "Template",
|
|
11
|
-
icon: "ph--asterisk--regular",
|
|
12
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template"
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// src/types/schema.ts
|
|
16
|
-
(function(Template2) {
|
|
17
|
-
class Create extends Schema.TaggedClass()(`${meta.id}/action/create`, {
|
|
18
|
-
input: Schema.Struct({
|
|
19
|
-
name: Schema.optional(Schema.String)
|
|
20
|
-
}),
|
|
21
|
-
output: Schema.Struct({
|
|
22
|
-
object: ReactiveObjectSchema
|
|
23
|
-
})
|
|
24
|
-
}) {
|
|
25
|
-
}
|
|
26
|
-
Template2.Create = Create;
|
|
27
|
-
class Data extends TypedObject({
|
|
28
|
-
typename: "dxos.org/type/Data",
|
|
29
|
-
version: "0.1.0"
|
|
30
|
-
})({
|
|
31
|
-
name: Schema.optional(Schema.String)
|
|
32
|
-
}) {
|
|
33
|
-
}
|
|
34
|
-
Template2.Data = Data;
|
|
35
|
-
Template2.make = (props) => Obj.make(Data, props);
|
|
36
|
-
})(Template || (Template = {}));
|
|
37
|
-
var Template;
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
meta,
|
|
41
|
-
Template
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=chunk-2QKMXSV3.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/schema.ts", "../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Obj } from '@dxos/echo';\nimport { TypedObject } from '@dxos/echo/internal';\nimport { ReactiveObjectSchema } from '@dxos/react-client/echo';\n\nimport { meta } from '../meta';\n\nexport namespace Template {\n export class Create extends Schema.TaggedClass<Create>()(`${meta.id}/action/create`, {\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n }),\n output: Schema.Struct({\n object: ReactiveObjectSchema,\n }),\n }) {}\n\n export class Data extends TypedObject({\n typename: 'dxos.org/type/Data',\n version: '0.1.0',\n })({\n name: Schema.optional(Schema.String),\n }) {}\n\n export const make = (props: Partial<Data>) => Obj.make(Data, props);\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/template',\n name: 'Template',\n icon: 'ph--asterisk--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template',\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,WAAW;AACpB,SAASC,mBAAmB;AAC5B,SAASC,4BAA4B;;;ACF9B,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC,QAAQ;AACV;;;UDCiBC,WAAAA;EACR,MAAMC,eAAsBC,mBAAW,EAAW,GAAGC,KAAKC,EAAE,kBAAkB;IACnFC,OAAcC,cAAO;MACnBC,MAAaC,gBAAgBC,aAAM;IACrC,CAAA;IACAC,QAAeJ,cAAO;MACpBK,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;YAPSX,SAAAA;EASN,MAAMY,aAAaC,YAAY;IACpCC,UAAU;IACVC,SAAS;EACX,CAAA,EAAG;IACDT,MAAaC,gBAAgBC,aAAM;EACrC,CAAA,EAAA;EAAI;YALSI,OAAAA;YAOAI,OAAO,CAACC,UAAyBC,IAAIF,KAAKJ,MAAMK,KAAAA;AAC/D,GAlBiBlB,aAAAA,WAAAA,CAAAA,EAAAA;;",
|
|
6
|
-
"names": ["Schema", "Obj", "TypedObject", "ReactiveObjectSchema", "meta", "id", "name", "icon", "source", "Template", "Create", "TaggedClass", "meta", "id", "input", "Struct", "name", "optional", "String", "output", "object", "ReactiveObjectSchema", "Data", "TypedObject", "typename", "version", "make", "props", "Obj"]
|
|
7
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Template,
|
|
3
|
-
meta
|
|
4
|
-
} from "./chunk-2QKMXSV3.mjs";
|
|
5
|
-
|
|
6
|
-
// src/TemplatePlugin.tsx
|
|
7
|
-
import { Capabilities, Events, contributes, createIntent, defineModule, definePlugin } from "@dxos/app-framework";
|
|
8
|
-
import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
|
|
9
|
-
import { SpaceCapabilities } from "@dxos/plugin-space";
|
|
10
|
-
import { defineObjectForm } from "@dxos/plugin-space/types";
|
|
11
|
-
|
|
12
|
-
// src/capabilities/index.ts
|
|
13
|
-
import { lazy } from "@dxos/app-framework";
|
|
14
|
-
var IntentResolver = lazy(() => import("./intent-resolver-5XH7GWYS.mjs"));
|
|
15
|
-
var ReactSurface = lazy(() => import("./react-surface-A27A5AQR.mjs"));
|
|
16
|
-
|
|
17
|
-
// src/translations.ts
|
|
18
|
-
var translations = [
|
|
19
|
-
{
|
|
20
|
-
"en-US": {
|
|
21
|
-
[Template.Data.typename]: {
|
|
22
|
-
"typename label": "Template",
|
|
23
|
-
"typename label_zero": "Templates",
|
|
24
|
-
"typename label_one": "Template",
|
|
25
|
-
"typename label_other": "Templates",
|
|
26
|
-
"object name placeholder": "New template",
|
|
27
|
-
"rename object label": "Rename template",
|
|
28
|
-
"delete object label": "Delete template"
|
|
29
|
-
},
|
|
30
|
-
[meta.id]: {
|
|
31
|
-
"plugin name": "Template"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
// src/TemplatePlugin.tsx
|
|
38
|
-
var TemplatePlugin = definePlugin(meta, () => [
|
|
39
|
-
defineModule({
|
|
40
|
-
id: `${meta.id}/module/translations`,
|
|
41
|
-
activatesOn: Events.SetupTranslations,
|
|
42
|
-
activate: () => contributes(Capabilities.Translations, translations)
|
|
43
|
-
}),
|
|
44
|
-
defineModule({
|
|
45
|
-
id: `${meta.id}/module/metadata`,
|
|
46
|
-
activatesOn: Events.SetupMetadata,
|
|
47
|
-
activate: () => contributes(Capabilities.Metadata, {
|
|
48
|
-
id: Template.Data.typename,
|
|
49
|
-
metadata: {
|
|
50
|
-
icon: "ph--asterisk--regular",
|
|
51
|
-
iconClassName: "text-skySurfaceText"
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
}),
|
|
55
|
-
defineModule({
|
|
56
|
-
id: `${meta.id}/module/object-form`,
|
|
57
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
58
|
-
activate: () => contributes(SpaceCapabilities.ObjectForm, defineObjectForm({
|
|
59
|
-
objectSchema: Template.Data,
|
|
60
|
-
getIntent: () => createIntent(Template.Create)
|
|
61
|
-
}))
|
|
62
|
-
}),
|
|
63
|
-
defineModule({
|
|
64
|
-
id: `${meta.id}/module/schema`,
|
|
65
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
66
|
-
activate: () => contributes(ClientCapabilities.Schema, [
|
|
67
|
-
Template.Data
|
|
68
|
-
])
|
|
69
|
-
}),
|
|
70
|
-
defineModule({
|
|
71
|
-
id: `${meta.id}/module/react-surface`,
|
|
72
|
-
activatesOn: Events.SetupReactSurface,
|
|
73
|
-
activate: ReactSurface
|
|
74
|
-
}),
|
|
75
|
-
defineModule({
|
|
76
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
77
|
-
activatesOn: Events.SetupIntentResolver,
|
|
78
|
-
activate: IntentResolver
|
|
79
|
-
})
|
|
80
|
-
]);
|
|
81
|
-
export {
|
|
82
|
-
TemplatePlugin,
|
|
83
|
-
meta
|
|
84
|
-
};
|
|
85
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/TemplatePlugin.tsx", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Capabilities, Events, contributes, createIntent, defineModule, definePlugin } from '@dxos/app-framework';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\nimport { SpaceCapabilities } from '@dxos/plugin-space';\nimport { defineObjectForm } from '@dxos/plugin-space/types';\n\nimport { IntentResolver, ReactSurface } from './capabilities';\nimport { meta } from './meta';\nimport { translations } from './translations';\nimport { Template } from './types';\n\nexport const TemplatePlugin = definePlugin(meta, () => [\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: Template.Data.typename,\n metadata: {\n icon: 'ph--asterisk--regular',\n iconClassName: 'text-skySurfaceText',\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: Template.Data,\n getIntent: () => createIntent(Template.Create),\n }),\n ),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => contributes(ClientCapabilities.Schema, [Template.Data]),\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 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from './meta';\nimport { Template } from './types';\n\nexport const translations = [\n {\n 'en-US': {\n [Template.Data.typename]: {\n 'typename label': 'Template',\n 'typename label_zero': 'Templates',\n 'typename label_one': 'Template',\n 'typename label_other': 'Templates',\n 'object name placeholder': 'New template',\n 'rename object label': 'Rename template',\n 'delete object label': 'Delete template',\n },\n [meta.id]: {\n 'plugin name': 'Template',\n },\n },\n },\n] as const satisfies Resource[];\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,cAAcC,QAAQC,aAAaC,cAAcC,cAAcC,oBAAoB;AAC5F,SAASC,oBAAoBC,oBAAoB;AACjD,SAASC,yBAAyB;AAClC,SAASC,wBAAwB;;;ACHjC,SAASC,YAAY;AAEd,IAAMC,iBAAiBC,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAMC,eAAeD,KAAK,MAAM,OAAO,8BAAA,CAAA;;;ACEvC,IAAME,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,SAASC,KAAKC,QAAQ,GAAG;QACxB,kBAAkB;QAClB,uBAAuB;QACvB,sBAAsB;QACtB,wBAAwB;QACxB,2BAA2B;QAC3B,uBAAuB;QACvB,uBAAuB;MACzB;MACA,CAACC,KAAKC,EAAE,GAAG;QACT,eAAe;MACjB;IACF;EACF;;;;AFXK,IAAMC,iBAAiBC,aAAaC,MAAM,MAAM;EACrDC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,MAAMC,YAAYC,aAAaC,cAAcC,YAAAA;EACzD,CAAA;EACAT,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOO;IACpBL,UAAU,MACRC,YAAYC,aAAaI,UAAU;MACjCV,IAAIW,SAASC,KAAKC;MAClBC,UAAU;QACRC,MAAM;QACNC,eAAe;MACjB;IACF,CAAA;EACJ,CAAA;EACAjB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAagB,aAAaC;IAC1Bd,UAAU,MACRC,YACEc,kBAAkBC,YAClBC,iBAAiB;MACfC,cAAcX,SAASC;MACvBW,WAAW,MAAMC,aAAab,SAASc,MAAM;IAC/C,CAAA,CAAA;EAEN,CAAA;EACA1B,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAagB,aAAaC;IAC1Bd,UAAU,MAAMC,YAAYqB,mBAAmBC,QAAQ;MAAChB,SAASC;KAAK;EACxE,CAAA;EACAb,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAO0B;IACpBxB,UAAUyB;EACZ,CAAA;EACA9B,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAO4B;IACpB1B,UAAU2B;EACZ,CAAA;CACD;",
|
|
6
|
-
"names": ["Capabilities", "Events", "contributes", "createIntent", "defineModule", "definePlugin", "ClientCapabilities", "ClientEvents", "SpaceCapabilities", "defineObjectForm", "lazy", "IntentResolver", "lazy", "ReactSurface", "translations", "Template", "Data", "typename", "meta", "id", "TemplatePlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "Metadata", "Template", "Data", "typename", "metadata", "icon", "iconClassName", "ClientEvents", "SetupSchema", "SpaceCapabilities", "ObjectForm", "defineObjectForm", "objectSchema", "getIntent", "createIntent", "Create", "ClientCapabilities", "Schema", "SetupReactSurface", "ReactSurface", "SetupIntentResolver", "IntentResolver"]
|
|
7
|
-
}
|