@dxos/plugin-template 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef
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/index.mjs +17 -77
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +27 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +16 -3
- package/dist/lib/browser/types/index.mjs.map +4 -4
- 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/index.d.ts +2 -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 +2 -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/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 +47 -33
- package/src/TemplatePlugin.test.ts +26 -0
- package/src/TemplatePlugin.tsx +39 -52
- package/src/capabilities/index.ts +2 -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 +6 -1
- package/src/meta.ts +9 -3
- package/src/translations.ts +12 -10
- package/src/types/schema.ts +13 -18
- package/dist/lib/browser/chunk-LT6IO5CC.mjs +0 -43
- package/dist/lib/browser/chunk-LT6IO5CC.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-R7R2H7HL.mjs +0 -20
- package/dist/lib/browser/intent-resolver-R7R2H7HL.mjs.map +0 -7
- package/dist/lib/browser/react-surface-DMBP6TLP.mjs +0 -40
- package/dist/lib/browser/react-surface-DMBP6TLP.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/package.json
CHANGED
|
@@ -1,19 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-template",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.abd8ff62ef",
|
|
4
4
|
"description": "Template for new plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
10
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#plugin": "./src/TemplatePlugin.tsx",
|
|
17
|
+
"#capabilities": "./src/capabilities/index.ts",
|
|
18
|
+
"#components": "./src/components/index.ts",
|
|
19
|
+
"#meta": "./src/meta.ts",
|
|
20
|
+
"#translations": "./src/translations.ts",
|
|
21
|
+
"#types": "./src/types/index.ts"
|
|
22
|
+
},
|
|
11
23
|
"exports": {
|
|
12
24
|
".": {
|
|
13
25
|
"source": "./src/index.ts",
|
|
14
26
|
"types": "./dist/types/src/index.d.ts",
|
|
15
27
|
"browser": "./dist/lib/browser/index.mjs"
|
|
16
28
|
},
|
|
29
|
+
"./translations": {
|
|
30
|
+
"source": "./src/translations.ts",
|
|
31
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
32
|
+
"browser": "./dist/lib/browser/translations.mjs",
|
|
33
|
+
"node": "./dist/lib/node-esm/translations.mjs"
|
|
34
|
+
},
|
|
17
35
|
"./types": {
|
|
18
36
|
"source": "./src/types/index.ts",
|
|
19
37
|
"types": "./dist/types/src/types/index.d.ts",
|
|
@@ -21,47 +39,43 @@
|
|
|
21
39
|
}
|
|
22
40
|
},
|
|
23
41
|
"types": "dist/types/src/index.d.ts",
|
|
24
|
-
"typesVersions": {
|
|
25
|
-
"*": {
|
|
26
|
-
"types": [
|
|
27
|
-
"dist/types/src/types/index.d.ts"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
42
|
"files": [
|
|
32
43
|
"dist",
|
|
33
44
|
"src"
|
|
34
45
|
],
|
|
35
46
|
"dependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"@dxos/app-
|
|
40
|
-
"@dxos/async": "0.8.4-main.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/echo
|
|
43
|
-
"@dxos/plugin-client": "0.8.4-main.
|
|
44
|
-
"@dxos/plugin-graph": "0.8.4-main.
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/react-ui-
|
|
47
|
+
"@radix-ui/react-context": "1.1.1",
|
|
48
|
+
"effect": "3.20.0",
|
|
49
|
+
"@dxos/app-framework": "0.8.4-main.abd8ff62ef",
|
|
50
|
+
"@dxos/app-toolkit": "0.8.4-main.abd8ff62ef",
|
|
51
|
+
"@dxos/async": "0.8.4-main.abd8ff62ef",
|
|
52
|
+
"@dxos/compute": "0.8.4-main.abd8ff62ef",
|
|
53
|
+
"@dxos/echo": "0.8.4-main.abd8ff62ef",
|
|
54
|
+
"@dxos/plugin-client": "0.8.4-main.abd8ff62ef",
|
|
55
|
+
"@dxos/plugin-graph": "0.8.4-main.abd8ff62ef",
|
|
56
|
+
"@dxos/react-client": "0.8.4-main.abd8ff62ef",
|
|
57
|
+
"@dxos/plugin-space": "0.8.4-main.abd8ff62ef",
|
|
58
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.abd8ff62ef",
|
|
59
|
+
"@dxos/react-ui-stack": "0.8.4-main.abd8ff62ef",
|
|
60
|
+
"@dxos/util": "0.8.4-main.abd8ff62ef"
|
|
48
61
|
},
|
|
49
62
|
"devDependencies": {
|
|
50
|
-
"@types/react": "~19.2.
|
|
51
|
-
"@types/react-dom": "~19.2.
|
|
52
|
-
"react": "~19.2.
|
|
53
|
-
"react-dom": "~19.2.
|
|
54
|
-
"vite": "
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
57
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
63
|
+
"@types/react": "~19.2.7",
|
|
64
|
+
"@types/react-dom": "~19.2.3",
|
|
65
|
+
"react": "~19.2.3",
|
|
66
|
+
"react-dom": "~19.2.3",
|
|
67
|
+
"vite": "^8.0.10",
|
|
68
|
+
"@dxos/plugin-testing": "0.8.4-main.abd8ff62ef",
|
|
69
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
70
|
+
"@dxos/storybook-utils": "0.8.4-main.abd8ff62ef",
|
|
71
|
+
"@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
|
|
58
72
|
},
|
|
59
73
|
"peerDependencies": {
|
|
60
|
-
"effect": "
|
|
61
|
-
"react": "
|
|
62
|
-
"react-dom": "
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/react-ui
|
|
74
|
+
"effect": "3.20.0",
|
|
75
|
+
"react": "~19.2.3",
|
|
76
|
+
"react-dom": "~19.2.3",
|
|
77
|
+
"@dxos/ui-theme": "0.8.4-main.abd8ff62ef",
|
|
78
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef"
|
|
65
79
|
},
|
|
66
80
|
"publishConfig": {
|
|
67
81
|
"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';
|
|
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('metadata'), moduleId('schema'), moduleId('ReactSurface')]),
|
|
24
|
+
);
|
|
25
|
+
}, 20_000);
|
|
26
|
+
});
|
package/src/TemplatePlugin.tsx
CHANGED
|
@@ -2,58 +2,45 @@
|
|
|
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 * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
9
7
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
8
|
+
import { Plugin } from '@dxos/app-framework';
|
|
9
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
import { Annotation } from '@dxos/echo';
|
|
12
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
13
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
objectSchema: Template.Data,
|
|
40
|
-
getIntent: () => createIntent(Template.Create),
|
|
41
|
-
}),
|
|
42
|
-
),
|
|
43
|
-
}),
|
|
44
|
-
defineModule({
|
|
45
|
-
id: `${meta.id}/module/schema`,
|
|
46
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
47
|
-
activate: () => contributes(ClientCapabilities.Schema, [Template.Data]),
|
|
48
|
-
}),
|
|
49
|
-
defineModule({
|
|
50
|
-
id: `${meta.id}/module/react-surface`,
|
|
51
|
-
activatesOn: Events.SetupReactSurface,
|
|
52
|
-
activate: ReactSurface,
|
|
53
|
-
}),
|
|
54
|
-
defineModule({
|
|
55
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
56
|
-
activatesOn: Events.SetupIntentResolver,
|
|
57
|
-
activate: IntentResolver,
|
|
15
|
+
import { ReactSurface } from '#capabilities';
|
|
16
|
+
import { meta } from '#meta';
|
|
17
|
+
import { translations } from '#translations';
|
|
18
|
+
import { Template } from '#types';
|
|
19
|
+
|
|
20
|
+
export const TemplatePlugin = Plugin.define(meta).pipe(
|
|
21
|
+
AppPlugin.addMetadataModule({
|
|
22
|
+
metadata: {
|
|
23
|
+
id: Template.Data.typename,
|
|
24
|
+
metadata: {
|
|
25
|
+
icon: Annotation.IconAnnotation.get(Template.Data).pipe(Option.getOrThrow).icon,
|
|
26
|
+
iconHue: Annotation.IconAnnotation.get(Template.Data).pipe(Option.getOrThrow).hue ?? 'white',
|
|
27
|
+
createObject: ((props, options) =>
|
|
28
|
+
Effect.gen(function* () {
|
|
29
|
+
const object = Template.make(props);
|
|
30
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
31
|
+
object,
|
|
32
|
+
target: options.target,
|
|
33
|
+
hidden: true,
|
|
34
|
+
targetNodeId: options.targetNodeId,
|
|
35
|
+
});
|
|
36
|
+
})) satisfies CreateObject,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
58
39
|
}),
|
|
59
|
-
])
|
|
40
|
+
AppPlugin.addSchemaModule({ schema: [Template.Data] }),
|
|
41
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
42
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
43
|
+
Plugin.make,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export default TemplatePlugin;
|
|
@@ -2,7 +2,6 @@
|
|
|
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 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.getDXN(object).toString()}</span>
|
|
18
|
+
</Panel.Content>
|
|
19
|
+
</Panel.Root>
|
|
20
|
+
);
|
|
21
|
+
};
|
package/src/components/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,5 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
5
9
|
export * from './meta';
|
|
6
|
-
|
|
10
|
+
|
|
11
|
+
export const TemplatePlugin = Plugin.lazy(meta, () => import('#plugin'));
|
package/src/meta.ts
CHANGED
|
@@ -2,11 +2,17 @@
|
|
|
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
|
+
description: trim`
|
|
12
|
+
Create reusable templates for documents, tables, and other objects.
|
|
13
|
+
Define structured patterns that can be quickly instantiated with pre-configured content and settings.
|
|
14
|
+
`,
|
|
10
15
|
icon: 'ph--asterisk--regular',
|
|
16
|
+
iconHue: 'sky',
|
|
11
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template',
|
|
12
18
|
};
|
package/src/translations.ts
CHANGED
|
@@ -4,23 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
8
|
-
import { Template } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
|
+
import { Template } from '#types';
|
|
9
9
|
|
|
10
10
|
export const translations = [
|
|
11
11
|
{
|
|
12
12
|
'en-US': {
|
|
13
13
|
[Template.Data.typename]: {
|
|
14
|
-
'typename
|
|
15
|
-
'typename
|
|
16
|
-
'typename
|
|
17
|
-
'typename
|
|
18
|
-
'object
|
|
19
|
-
'
|
|
20
|
-
'
|
|
14
|
+
'typename.label': 'Template',
|
|
15
|
+
'typename.label_zero': 'Templates',
|
|
16
|
+
'typename.label_one': 'Template',
|
|
17
|
+
'typename.label_other': 'Templates',
|
|
18
|
+
'object-name.placeholder': 'New template',
|
|
19
|
+
'add-object.label': 'Add template',
|
|
20
|
+
'rename-object.label': 'Rename template',
|
|
21
|
+
'delete-object.label': 'Delete template',
|
|
22
|
+
'object-deleted.label': 'Template deleted',
|
|
21
23
|
},
|
|
22
24
|
[meta.id]: {
|
|
23
|
-
'plugin
|
|
25
|
+
'plugin.name': 'Template',
|
|
24
26
|
},
|
|
25
27
|
},
|
|
26
28
|
},
|
package/src/types/schema.ts
CHANGED
|
@@ -2,30 +2,25 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { Obj } from '@dxos/echo';
|
|
8
|
-
import { TypedObject } from '@dxos/echo-schema';
|
|
9
|
-
import { ReactiveObjectSchema } from '@dxos/react-client/echo';
|
|
10
|
-
|
|
11
|
-
import { meta } from '../meta';
|
|
7
|
+
import { Annotation, Obj, Type } from '@dxos/echo';
|
|
12
8
|
|
|
13
9
|
export namespace Template {
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
export const Data = Schema.Struct({
|
|
11
|
+
name: Schema.optional(Schema.String),
|
|
12
|
+
}).pipe(
|
|
13
|
+
Type.object({
|
|
14
|
+
typename: 'org.dxos.type.data',
|
|
15
|
+
version: '0.1.0',
|
|
17
16
|
}),
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
Annotation.IconAnnotation.set({
|
|
18
|
+
icon: 'ph--asterisk--regular',
|
|
19
|
+
hue: 'sky',
|
|
20
20
|
}),
|
|
21
|
-
|
|
21
|
+
);
|
|
22
22
|
|
|
23
|
-
export
|
|
24
|
-
typename: 'dxos.org/type/Data',
|
|
25
|
-
version: '0.1.0',
|
|
26
|
-
})({
|
|
27
|
-
name: Schema.optional(Schema.String),
|
|
28
|
-
}) {}
|
|
23
|
+
export type Data = Schema.Schema.Type<typeof Data>;
|
|
29
24
|
|
|
30
25
|
export const make = (props: Partial<Data>) => Obj.make(Data, props);
|
|
31
26
|
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// src/types/schema.ts
|
|
2
|
-
import { Schema } from "effect";
|
|
3
|
-
import { Obj } from "@dxos/echo";
|
|
4
|
-
import { TypedObject } from "@dxos/echo-schema";
|
|
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-LT6IO5CC.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 { Schema } from 'effect';\n\nimport { Obj } from '@dxos/echo';\nimport { TypedObject } from '@dxos/echo-schema';\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,SAASA,cAAc;AAEvB,SAASC,WAAW;AACpB,SAASC,mBAAmB;AAC5B,SAASC,4BAA4B;;;ACF9B,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC,QAAQ;AACV;;;UDCiBC,WAAAA;EACR,MAAMC,eAAeC,OAAOC,YAAW,EAAW,GAAGC,KAAKC,EAAE,kBAAkB;IACnFC,OAAOJ,OAAOK,OAAO;MACnBC,MAAMN,OAAOO,SAASP,OAAOQ,MAAM;IACrC,CAAA;IACAC,QAAQT,OAAOK,OAAO;MACpBK,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;YAPSZ,SAAAA;EASN,MAAMa,aAAaC,YAAY;IACpCC,UAAU;IACVC,SAAS;EACX,CAAA,EAAG;IACDT,MAAMN,OAAOO,SAASP,OAAOQ,MAAM;EACrC,CAAA,EAAA;EAAI;YALSI,OAAAA;YAOAI,OAAO,CAACC,UAAyBC,IAAIF,KAAKJ,MAAMK,KAAAA;AAC/D,GAlBiBnB,aAAAA,WAAAA,CAAAA,EAAAA;;",
|
|
6
|
-
"names": ["Schema", "Obj", "TypedObject", "ReactiveObjectSchema", "meta", "id", "name", "icon", "source", "Template", "Create", "Schema", "TaggedClass", "meta", "id", "input", "Struct", "name", "optional", "String", "output", "object", "ReactiveObjectSchema", "Data", "TypedObject", "typename", "version", "make", "props", "Obj"]
|
|
7
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Template
|
|
3
|
-
} from "./chunk-LT6IO5CC.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/intent-resolver.ts
|
|
6
|
-
import { Capabilities, contributes, createResolver } from "@dxos/app-framework";
|
|
7
|
-
var intent_resolver_default = (() => contributes(Capabilities.IntentResolver, createResolver({
|
|
8
|
-
intent: Template.Create,
|
|
9
|
-
resolve: ({ name }) => ({
|
|
10
|
-
data: {
|
|
11
|
-
object: Template.make({
|
|
12
|
-
name
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
})));
|
|
17
|
-
export {
|
|
18
|
-
intent_resolver_default as default
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=intent-resolver-R7R2H7HL.mjs.map
|
|
@@ -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 { Capabilities, contributes, createResolver } from '@dxos/app-framework';\n\nimport { Template } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: Template.Create,\n resolve: ({ name }) => ({\n data: { object: Template.make({ name }) },\n }),\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,cAAcC,aAAaC,sBAAsB;AAI1D,IAAA,2BAAe,MACbC,YACEC,aAAaC,gBACbC,eAAe;EACbC,QAAQC,SAASC;EACjBC,SAAS,CAAC,EAAEC,KAAI,OAAQ;IACtBC,MAAM;MAAEC,QAAQL,SAASM,KAAK;QAAEH;MAAK,CAAA;IAAG;EAC1C;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["Capabilities", "contributes", "createResolver", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "Template", "Create", "resolve", "name", "data", "object", "make"]
|
|
7
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Template,
|
|
3
|
-
meta
|
|
4
|
-
} from "./chunk-LT6IO5CC.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/react-surface.tsx
|
|
7
|
-
import React2 from "react";
|
|
8
|
-
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
9
|
-
import { Obj } from "@dxos/echo";
|
|
10
|
-
|
|
11
|
-
// src/components/TemplateContainer.tsx
|
|
12
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
13
|
-
import React from "react";
|
|
14
|
-
import { fullyQualifiedId } from "@dxos/react-client/echo";
|
|
15
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
16
|
-
var TemplateContainer = ({ object }) => {
|
|
17
|
-
var _effect = _useSignals();
|
|
18
|
-
try {
|
|
19
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, null, /* @__PURE__ */ React.createElement("pre", {
|
|
20
|
-
className: "m-4 p-2 ring"
|
|
21
|
-
}, /* @__PURE__ */ React.createElement("span", null, fullyQualifiedId(object))));
|
|
22
|
-
} finally {
|
|
23
|
-
_effect.f();
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// src/capabilities/react-surface.tsx
|
|
28
|
-
var react_surface_default = (() => contributes(Capabilities.ReactSurface, createSurface({
|
|
29
|
-
id: meta.id,
|
|
30
|
-
role: "article",
|
|
31
|
-
filter: (data) => Obj.instanceOf(Template.Data, data.subject),
|
|
32
|
-
component: ({ data, role }) => /* @__PURE__ */ React2.createElement(TemplateContainer, {
|
|
33
|
-
role,
|
|
34
|
-
object: data.subject
|
|
35
|
-
})
|
|
36
|
-
})));
|
|
37
|
-
export {
|
|
38
|
-
react_surface_default as default
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=react-surface-DMBP6TLP.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface.tsx", "../../../src/components/TemplateContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\n\nimport { TemplateContainer } from '../components';\nimport { meta } from '../meta';\nimport { Template } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.ReactSurface,\n createSurface({\n id: meta.id,\n role: 'article',\n filter: (data): data is { subject: Obj.Any } => Obj.instanceOf(Template.Data, data.subject),\n component: ({ data, role }) => <TemplateContainer role={role} object={data.subject} />,\n }),\n );\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Obj } from '@dxos/echo';\nimport { fullyQualifiedId } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nexport const TemplateContainer = ({ object }: { object: Obj.Any; role: string }) => {\n return (\n <StackItem.Content>\n <pre className='m-4 p-2 ring'>\n <span>{fullyQualifiedId(object)}</span>\n </pre>\n </StackItem.Content>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,WAAW;;;;ACHpB,OAAOC,WAAW;AAGlB,SAASC,wBAAwB;AACjC,SAASC,iBAAiB;AAEnB,IAAMC,oBAAoB,CAAC,EAAEC,OAAM,MAAqC;;;AAC7E,WACE,sBAAA,cAACC,UAAUC,SAAO,MAChB,sBAAA,cAACC,OAAAA;MAAIC,WAAU;OACb,sBAAA,cAACC,QAAAA,MAAMC,iBAAiBN,MAAAA,CAAAA,CAAAA,CAAAA;;;;AAIhC;;;ADLA,IAAA,yBAAe,MACbO,YACEC,aAAaC,cACbC,cAAc;EACZC,IAAIC,KAAKD;EACTE,MAAM;EACNC,QAAQ,CAACC,SAAuCC,IAAIC,WAAWC,SAASC,MAAMJ,KAAKK,OAAO;EAC1FC,WAAW,CAAC,EAAEN,MAAMF,KAAI,MAAO,gBAAAS,OAAA,cAACC,mBAAAA;IAAkBV;IAAYW,QAAQT,KAAKK;;AAC7E,CAAA,CAAA;",
|
|
6
|
-
"names": ["React", "Capabilities", "contributes", "createSurface", "Obj", "React", "fullyQualifiedId", "StackItem", "TemplateContainer", "object", "StackItem", "Content", "pre", "className", "span", "fullyQualifiedId", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Template", "Data", "subject", "component", "React", "TemplateContainer", "object"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;;AAIhF,wBASI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/TemplateContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAItC,eAAO,MAAM,iBAAiB,GAAI,YAAY;IAAE,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,sBAQ9E,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes, createResolver } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
import { Template } from '../types';
|
|
8
|
-
|
|
9
|
-
export default () =>
|
|
10
|
-
contributes(
|
|
11
|
-
Capabilities.IntentResolver,
|
|
12
|
-
createResolver({
|
|
13
|
-
intent: Template.Create,
|
|
14
|
-
resolve: ({ name }) => ({
|
|
15
|
-
data: { object: Template.make({ name }) },
|
|
16
|
-
}),
|
|
17
|
-
}),
|
|
18
|
-
);
|