@dxos/plugin-template 0.8.4-main.fffef41 → 0.8.4-staging.60fe92afc8

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.
Files changed (91) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/neutral/TemplatePlugin.mjs +24 -0
  4. package/dist/lib/neutral/TemplatePlugin.mjs.map +7 -0
  5. package/dist/lib/neutral/capabilities/index.mjs +9 -0
  6. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  7. package/dist/lib/neutral/chunk-7RN2XYO6.mjs +21 -0
  8. package/dist/lib/neutral/chunk-7RN2XYO6.mjs.map +7 -0
  9. package/dist/lib/neutral/chunk-XVITFXCJ.mjs +18 -0
  10. package/dist/lib/neutral/chunk-XVITFXCJ.mjs.map +7 -0
  11. package/dist/lib/neutral/components/index.mjs +14 -0
  12. package/dist/lib/neutral/components/index.mjs.map +7 -0
  13. package/dist/lib/neutral/create-object-K2JXEGV4.mjs +26 -0
  14. package/dist/lib/neutral/create-object-K2JXEGV4.mjs.map +7 -0
  15. package/dist/lib/neutral/index.mjs +11 -0
  16. package/dist/lib/neutral/meta.json +1 -0
  17. package/dist/lib/neutral/meta.mjs +7 -0
  18. package/dist/lib/neutral/meta.mjs.map +7 -0
  19. package/dist/lib/neutral/plugin.mjs +11 -0
  20. package/dist/lib/neutral/plugin.mjs.map +7 -0
  21. package/dist/lib/neutral/react-surface-SYA2674P.mjs +21 -0
  22. package/dist/lib/neutral/react-surface-SYA2674P.mjs.map +7 -0
  23. package/dist/lib/neutral/translations.mjs +28 -0
  24. package/dist/lib/neutral/translations.mjs.map +7 -0
  25. package/dist/lib/{browser → neutral}/types/index.mjs +1 -1
  26. package/dist/lib/neutral/types/index.mjs.map +7 -0
  27. package/dist/types/src/TemplatePlugin.d.ts +3 -1
  28. package/dist/types/src/TemplatePlugin.d.ts.map +1 -1
  29. package/dist/types/src/TemplatePlugin.test.d.ts +2 -0
  30. package/dist/types/src/TemplatePlugin.test.d.ts.map +1 -0
  31. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  32. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  33. package/dist/types/src/capabilities/index.d.ts +8 -2
  34. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  35. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  36. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  37. package/dist/types/src/components/TemplatePanel/TemplatePanel.d.ts +6 -0
  38. package/dist/types/src/components/TemplatePanel/TemplatePanel.d.ts.map +1 -0
  39. package/dist/types/src/components/TemplatePanel/index.d.ts +2 -0
  40. package/dist/types/src/components/TemplatePanel/index.d.ts.map +1 -0
  41. package/dist/types/src/components/index.d.ts +1 -2
  42. package/dist/types/src/components/index.d.ts.map +1 -1
  43. package/dist/types/src/index.d.ts +1 -1
  44. package/dist/types/src/index.d.ts.map +1 -1
  45. package/dist/types/src/meta.d.ts +2 -2
  46. package/dist/types/src/meta.d.ts.map +1 -1
  47. package/dist/types/src/plugin.d.ts +3 -0
  48. package/dist/types/src/plugin.d.ts.map +1 -0
  49. package/dist/types/src/translations.d.ts +22 -13
  50. package/dist/types/src/translations.d.ts.map +1 -1
  51. package/dist/types/src/types/schema.d.ts +8 -23
  52. package/dist/types/src/types/schema.d.ts.map +1 -1
  53. package/dist/types/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +71 -40
  55. package/src/TemplatePlugin.test.ts +26 -0
  56. package/src/TemplatePlugin.tsx +15 -54
  57. package/src/capabilities/create-object.ts +31 -0
  58. package/src/capabilities/index.ts +3 -3
  59. package/src/capabilities/react-surface.tsx +20 -15
  60. package/src/components/TemplatePanel/TemplatePanel.tsx +21 -0
  61. package/src/components/{Example → TemplatePanel}/index.ts +1 -1
  62. package/src/components/index.ts +1 -2
  63. package/src/index.ts +1 -1
  64. package/src/meta.ts +6 -4
  65. package/src/plugin.ts +9 -0
  66. package/src/translations.ts +14 -11
  67. package/src/types/schema.ts +8 -19
  68. package/dist/lib/browser/chunk-6T47OUOE.mjs +0 -49
  69. package/dist/lib/browser/chunk-6T47OUOE.mjs.map +0 -7
  70. package/dist/lib/browser/index.mjs +0 -85
  71. package/dist/lib/browser/index.mjs.map +0 -7
  72. package/dist/lib/browser/intent-resolver-4BJJ7NBA.mjs +0 -20
  73. package/dist/lib/browser/intent-resolver-4BJJ7NBA.mjs.map +0 -7
  74. package/dist/lib/browser/meta.json +0 -1
  75. package/dist/lib/browser/react-surface-7J6GGCX4.mjs +0 -68
  76. package/dist/lib/browser/react-surface-7J6GGCX4.mjs.map +0 -7
  77. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  78. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  79. package/dist/types/src/components/Example/Example.d.ts +0 -16
  80. package/dist/types/src/components/Example/Example.d.ts.map +0 -1
  81. package/dist/types/src/components/Example/Example.stories.d.ts +0 -19
  82. package/dist/types/src/components/Example/Example.stories.d.ts.map +0 -1
  83. package/dist/types/src/components/Example/index.d.ts +0 -2
  84. package/dist/types/src/components/Example/index.d.ts.map +0 -1
  85. package/dist/types/src/components/TemplateContainer.d.ts +0 -7
  86. package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
  87. package/src/capabilities/intent-resolver.ts +0 -18
  88. package/src/components/Example/Example.stories.tsx +0 -32
  89. package/src/components/Example/Example.tsx +0 -54
  90. package/src/components/TemplateContainer.tsx +0 -18
  91. /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
package/package.json CHANGED
@@ -1,68 +1,99 @@
1
1
  {
2
2
  "name": "@dxos/plugin-template",
3
- "version": "0.8.4-main.fffef41",
3
+ "version": "0.8.4-staging.60fe92afc8",
4
4
  "description": "Template for new plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
- "license": "MIT",
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
- "browser": "./dist/lib/browser/index.mjs"
51
+ "default": "./dist/lib/neutral/index.mjs"
16
52
  },
17
- "./types": {
18
- "source": "./src/types/index.ts",
19
- "types": "./dist/types/src/types/index.d.ts",
20
- "browser": "./dist/lib/browser/types/index.mjs"
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
- "@preact-signals/safe-react": "^0.9.0",
37
- "@preact/signals-core": "^1.12.1",
38
- "@radix-ui/react-context": "1.1.1",
39
- "effect": "3.18.3",
40
- "@dxos/app-framework": "0.8.4-main.fffef41",
41
- "@dxos/async": "0.8.4-main.fffef41",
42
- "@dxos/plugin-client": "0.8.4-main.fffef41",
43
- "@dxos/plugin-graph": "0.8.4-main.fffef41",
44
- "@dxos/echo": "0.8.4-main.fffef41",
45
- "@dxos/plugin-space": "0.8.4-main.fffef41",
46
- "@dxos/react-client": "0.8.4-main.fffef41",
47
- "@dxos/react-ui-stack": "0.8.4-main.fffef41",
48
- "@dxos/util": "0.8.4-main.fffef41"
70
+ "effect": "3.21.3",
71
+ "@dxos/app-framework": "0.8.4-staging.60fe92afc8",
72
+ "@dxos/compute": "0.8.4-staging.60fe92afc8",
73
+ "@dxos/keys": "0.8.4-staging.60fe92afc8",
74
+ "@dxos/echo": "0.8.4-staging.60fe92afc8",
75
+ "@dxos/plugin-client": "0.8.4-staging.60fe92afc8",
76
+ "@dxos/util": "0.8.4-staging.60fe92afc8",
77
+ "@dxos/plugin-space": "0.8.4-staging.60fe92afc8",
78
+ "@dxos/app-toolkit": "0.8.4-staging.60fe92afc8"
49
79
  },
50
80
  "devDependencies": {
51
- "@types/react": "~19.2.2",
52
- "@types/react-dom": "~19.2.2",
53
- "react": "~19.2.0",
54
- "react-dom": "~19.2.0",
55
- "vite": "7.1.9",
56
- "@dxos/react-ui": "0.8.4-main.fffef41",
57
- "@dxos/storybook-utils": "0.8.4-main.fffef41",
58
- "@dxos/react-ui-theme": "0.8.4-main.fffef41"
81
+ "@types/react": "~19.2.7",
82
+ "@types/react-dom": "~19.2.3",
83
+ "react": "~19.2.3",
84
+ "react-dom": "~19.2.3",
85
+ "vite": "^8.0.16",
86
+ "@dxos/plugin-testing": "0.8.4-staging.60fe92afc8",
87
+ "@dxos/react-ui": "0.8.4-staging.60fe92afc8",
88
+ "@dxos/storybook-utils": "0.8.4-staging.60fe92afc8",
89
+ "@dxos/ui-theme": "0.8.4-staging.60fe92afc8"
59
90
  },
60
91
  "peerDependencies": {
61
- "effect": "^3.13.3",
62
- "react": "^19.0.0",
63
- "react-dom": "^19.0.0",
64
- "@dxos/react-ui": "0.8.4-main.fffef41",
65
- "@dxos/react-ui-theme": "0.8.4-main.fffef41"
92
+ "effect": "3.21.3",
93
+ "react": "~19.2.3",
94
+ "react-dom": "~19.2.3",
95
+ "@dxos/react-ui": "0.8.4-staging.60fe92afc8",
96
+ "@dxos/ui-theme": "0.8.4-staging.60fe92afc8"
66
97
  },
67
98
  "publishConfig": {
68
99
  "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
+ });
@@ -2,59 +2,20 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Capabilities, Events, contributes, createIntent, defineModule, definePlugin } from '@dxos/app-framework';
6
- import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
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 { IntentResolver, ReactSurface } from './capabilities';
11
- import { meta } from './meta';
12
- import { translations } from './translations';
13
- import { Template } from './types';
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 = definePlugin(meta, () => [
16
- defineModule({
17
- id: `${meta.id}/module/translations`,
18
- activatesOn: Events.SetupTranslations,
19
- activate: () => contributes(Capabilities.Translations, translations),
20
- }),
21
- defineModule({
22
- id: `${meta.id}/module/metadata`,
23
- activatesOn: Events.SetupMetadata,
24
- activate: () =>
25
- contributes(Capabilities.Metadata, {
26
- id: Template.Data.typename,
27
- metadata: {
28
- icon: 'ph--asterisk--regular',
29
- iconHue: 'sky',
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 { lazy } from '@dxos/app-framework';
5
+ import { Capability } from '@dxos/app-framework';
6
6
 
7
- export const IntentResolver = lazy(() => import('./intent-resolver'));
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, contributes, createSurface } from '@dxos/app-framework';
8
- import { Obj } from '@dxos/echo';
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 { TemplateContainer } from '../components';
11
- import { meta } from '../meta';
12
- import { Template } from '../types';
12
+ import { TemplatePanel } from '#components';
13
+ import { Template } from '#types';
13
14
 
14
- export default () =>
15
- contributes(
16
- Capabilities.ReactSurface,
17
- createSurface({
18
- id: meta.id,
19
- role: 'article',
20
- filter: (data): data is { subject: Obj.Any } => Obj.instanceOf(Template.Data, data.subject),
21
- component: ({ data, role }) => <TemplateContainer role={role} object={data.subject} />,
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
+ };
@@ -2,4 +2,4 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './Example';
5
+ export * from './TemplatePanel';
@@ -2,5 +2,4 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './Example';
6
- export * from './TemplateContainer';
5
+ export * from './TemplatePanel';
package/src/index.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  //
4
4
 
5
5
  export * from './meta';
6
- export * from './TemplatePlugin';
6
+ export * from './types';
package/src/meta.ts CHANGED
@@ -2,12 +2,14 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { DXN } from '@dxos/keys';
6
7
  import { trim } from '@dxos/util';
7
8
 
8
- export const meta: PluginMeta = {
9
- id: 'dxos.org/plugin/template',
9
+ export const meta = Plugin.makeMeta({
10
+ key: DXN.make('org.dxos.plugin.template'),
10
11
  name: 'Template',
12
+ author: 'DXOS',
11
13
  description: trim`
12
14
  Create reusable templates for documents, tables, and other objects.
13
15
  Define structured patterns that can be quickly instantiated with pre-configured content and settings.
@@ -15,4 +17,4 @@ export const meta: PluginMeta = {
15
17
  icon: 'ph--asterisk--regular',
16
18
  iconHue: 'sky',
17
19
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template',
18
- };
20
+ });
package/src/plugin.ts ADDED
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Plugin } from '@dxos/app-framework';
6
+
7
+ import { meta } from './meta';
8
+
9
+ export const TemplatePlugin = Plugin.lazy(meta, () => import('#plugin'));
@@ -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 './meta';
8
- import { Template } from './types';
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.typename]: {
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
- 'rename object label': 'Rename template',
20
- 'delete object label': 'Delete template',
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 name': 'Template',
26
+ 'plugin.name': 'Template',
24
27
  },
25
28
  },
26
29
  },
@@ -4,28 +4,17 @@
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 class Create extends Schema.TaggedClass<Create>()(`${meta.id}/action/create`, {
15
- input: Schema.Struct({
16
- name: Schema.optional(Schema.String),
17
- }),
18
- output: Schema.Struct({
19
- object: ReactiveObjectSchema,
20
- }),
21
- }) {}
22
-
23
- export class Data extends TypedObject({
24
- typename: 'dxos.org/type/Data',
25
- version: '0.1.0',
26
- })({
10
+ export const Data = Schema.Struct({
27
11
  name: Schema.optional(Schema.String),
28
- }) {}
12
+ }).pipe(
13
+ Annotation.IconAnnotation.set({ icon: 'ph--asterisk--regular', hue: 'sky' }),
14
+ Type.makeObject(DXN.make('org.dxos.type.data', '0.1.0')),
15
+ );
16
+
17
+ export type Data = Type.InstanceType<typeof Data>;
29
18
 
30
19
  export const make = (props: Partial<Data>) => Obj.make(Data, props);
31
20
  }
@@ -1,49 +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
- import { trim } from "@dxos/util";
9
- var meta = {
10
- id: "dxos.org/plugin/template",
11
- name: "Template",
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
- `,
16
- icon: "ph--asterisk--regular",
17
- iconHue: "sky",
18
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template"
19
- };
20
-
21
- // src/types/schema.ts
22
- (function(Template2) {
23
- class Create extends Schema.TaggedClass()(`${meta.id}/action/create`, {
24
- input: Schema.Struct({
25
- name: Schema.optional(Schema.String)
26
- }),
27
- output: Schema.Struct({
28
- object: ReactiveObjectSchema
29
- })
30
- }) {
31
- }
32
- Template2.Create = Create;
33
- class Data extends TypedObject({
34
- typename: "dxos.org/type/Data",
35
- version: "0.1.0"
36
- })({
37
- name: Schema.optional(Schema.String)
38
- }) {
39
- }
40
- Template2.Data = Data;
41
- Template2.make = (props) => Obj.make(Data, props);
42
- })(Template || (Template = {}));
43
- var Template;
44
-
45
- export {
46
- meta,
47
- Template
48
- };
49
- //# sourceMappingURL=chunk-6T47OUOE.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';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/template',\n name: 'Template',\n description: trim`\n Create reusable templates for documents, tables, and other objects.\n Define structured patterns that can be quickly instantiated with pre-configured content and settings.\n `,\n icon: 'ph--asterisk--regular',\n iconHue: 'sky',\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;;;ACHrC,SAASC,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;AACV;;;UDLiBC,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", "trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "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-6T47OUOE.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-4BJJ7NBA.mjs"));
15
- var ReactSurface = lazy(() => import("./react-surface-7J6GGCX4.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
- iconHue: "sky"
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