@dxos/plugin-template 0.8.3 → 0.8.4-main.03d5cd7b56

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 (88) hide show
  1. package/dist/lib/neutral/TemplatePlugin.mjs +24 -0
  2. package/dist/lib/neutral/TemplatePlugin.mjs.map +7 -0
  3. package/dist/lib/neutral/capabilities/index.mjs +9 -0
  4. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  5. package/dist/lib/neutral/chunk-3GJBJD5H.mjs +21 -0
  6. package/dist/lib/neutral/chunk-3GJBJD5H.mjs.map +7 -0
  7. package/dist/lib/neutral/chunk-PXZQRDPR.mjs +18 -0
  8. package/dist/lib/neutral/chunk-PXZQRDPR.mjs.map +7 -0
  9. package/dist/lib/neutral/components/index.mjs +14 -0
  10. package/dist/lib/neutral/components/index.mjs.map +7 -0
  11. package/dist/lib/neutral/create-object-YYTSDVP3.mjs +25 -0
  12. package/dist/lib/neutral/create-object-YYTSDVP3.mjs.map +7 -0
  13. package/dist/lib/neutral/index.mjs +11 -0
  14. package/dist/lib/neutral/meta.json +1 -0
  15. package/dist/lib/neutral/meta.mjs +7 -0
  16. package/dist/lib/neutral/meta.mjs.map +7 -0
  17. package/dist/lib/neutral/plugin.mjs +11 -0
  18. package/dist/lib/neutral/plugin.mjs.map +7 -0
  19. package/dist/lib/neutral/react-surface-SYA2674P.mjs +21 -0
  20. package/dist/lib/neutral/react-surface-SYA2674P.mjs.map +7 -0
  21. package/dist/lib/neutral/translations.mjs +27 -0
  22. package/dist/lib/neutral/translations.mjs.map +7 -0
  23. package/dist/lib/neutral/types/index.mjs +7 -0
  24. package/dist/lib/neutral/types/index.mjs.map +7 -0
  25. package/dist/types/src/TemplatePlugin.d.ts +3 -1
  26. package/dist/types/src/TemplatePlugin.d.ts.map +1 -1
  27. package/dist/types/src/TemplatePlugin.test.d.ts +2 -0
  28. package/dist/types/src/TemplatePlugin.test.d.ts.map +1 -0
  29. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  30. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  31. package/dist/types/src/capabilities/index.d.ts +8 -2
  32. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  33. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  34. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  35. package/dist/types/src/components/TemplatePanel/TemplatePanel.d.ts +6 -0
  36. package/dist/types/src/components/TemplatePanel/TemplatePanel.d.ts.map +1 -0
  37. package/dist/types/src/components/TemplatePanel/index.d.ts +2 -0
  38. package/dist/types/src/components/TemplatePanel/index.d.ts.map +1 -0
  39. package/dist/types/src/components/index.d.ts +1 -1
  40. package/dist/types/src/components/index.d.ts.map +1 -1
  41. package/dist/types/src/index.d.ts +1 -1
  42. package/dist/types/src/index.d.ts.map +1 -1
  43. package/dist/types/src/meta.d.ts +2 -3
  44. package/dist/types/src/meta.d.ts.map +1 -1
  45. package/dist/types/src/plugin.d.ts +3 -0
  46. package/dist/types/src/plugin.d.ts.map +1 -0
  47. package/dist/types/src/translations.d.ts +24 -20
  48. package/dist/types/src/translations.d.ts.map +1 -1
  49. package/dist/types/src/types/index.d.ts +2 -0
  50. package/dist/types/src/types/index.d.ts.map +1 -0
  51. package/dist/types/src/types/schema.d.ts +12 -0
  52. package/dist/types/src/types/schema.d.ts.map +1 -0
  53. package/dist/types/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +76 -39
  55. package/src/TemplatePlugin.test.ts +26 -0
  56. package/src/TemplatePlugin.tsx +15 -54
  57. package/src/capabilities/create-object.ts +30 -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/TemplatePanel/index.ts +5 -0
  62. package/src/components/index.ts +1 -1
  63. package/src/index.ts +1 -1
  64. package/src/meta.ts +9 -5
  65. package/src/plugin.ts +9 -0
  66. package/src/translations.ts +17 -13
  67. package/src/types/index.ts +5 -0
  68. package/src/types/schema.ts +26 -0
  69. package/dist/lib/browser/chunk-GMDXCSM2.mjs +0 -49
  70. package/dist/lib/browser/chunk-GMDXCSM2.mjs.map +0 -7
  71. package/dist/lib/browser/index.mjs +0 -86
  72. package/dist/lib/browser/index.mjs.map +0 -7
  73. package/dist/lib/browser/intent-resolver-THP6KTJU.mjs +0 -22
  74. package/dist/lib/browser/intent-resolver-THP6KTJU.mjs.map +0 -7
  75. package/dist/lib/browser/meta.json +0 -1
  76. package/dist/lib/browser/react-surface-RRVJU3OV.mjs +0 -39
  77. package/dist/lib/browser/react-surface-RRVJU3OV.mjs.map +0 -7
  78. package/dist/lib/browser/types.mjs +0 -11
  79. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  80. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  81. package/dist/types/src/components/TemplateContainer.d.ts +0 -7
  82. package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
  83. package/dist/types/src/types.d.ts +0 -27
  84. package/dist/types/src/types.d.ts.map +0 -1
  85. package/src/capabilities/intent-resolver.ts +0 -19
  86. package/src/components/TemplateContainer.tsx +0 -19
  87. package/src/types.ts +0 -36
  88. /package/dist/lib/{browser/types.mjs.map → neutral/index.mjs.map} +0 -0
package/package.json CHANGED
@@ -1,67 +1,104 @@
1
1
  {
2
2
  "name": "@dxos/plugin-template",
3
- "version": "0.8.3",
3
+ "version": "0.8.4-main.03d5cd7b56",
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
+ "#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
  ".": {
49
+ "source": "./src/index.ts",
13
50
  "types": "./dist/types/src/index.d.ts",
14
- "browser": "./dist/lib/browser/index.mjs"
51
+ "default": "./dist/lib/neutral/index.mjs"
52
+ },
53
+ "./plugin": {
54
+ "source": "./src/plugin.ts",
55
+ "types": "./dist/types/src/plugin.d.ts",
56
+ "default": "./dist/lib/neutral/plugin.mjs"
15
57
  },
16
- "./types": {
17
- "types": "./dist/types/src/types.d.ts",
18
- "browser": "./dist/lib/browser/types.mjs"
58
+ "./translations": {
59
+ "source": "./src/translations.ts",
60
+ "types": "./dist/types/src/translations.d.ts",
61
+ "default": "./dist/lib/neutral/translations.mjs"
19
62
  }
20
63
  },
21
64
  "types": "dist/types/src/index.d.ts",
22
- "typesVersions": {
23
- "*": {
24
- "types": [
25
- "dist/types/src/types.d.ts"
26
- ]
27
- }
28
- },
29
65
  "files": [
30
66
  "dist",
31
67
  "src"
32
68
  ],
33
69
  "dependencies": {
34
- "@preact-signals/safe-react": "^0.9.0",
35
- "@preact/signals-core": "^1.9.0",
36
- "effect": "3.14.21",
37
- "@dxos/app-framework": "0.8.3",
38
- "@dxos/echo-schema": "0.8.3",
39
- "@dxos/async": "0.8.3",
40
- "@dxos/plugin-client": "0.8.3",
41
- "@dxos/echo": "0.8.3",
42
- "@dxos/plugin-space": "0.8.3",
43
- "@dxos/plugin-graph": "0.8.3",
44
- "@dxos/react-client": "0.8.3",
45
- "@dxos/react-ui-stack": "0.8.3"
70
+ "@radix-ui/react-context": "1.1.1",
71
+ "effect": "3.20.0",
72
+ "@dxos/app-toolkit": "0.8.4-main.03d5cd7b56",
73
+ "@dxos/app-framework": "0.8.4-main.03d5cd7b56",
74
+ "@dxos/async": "0.8.4-main.03d5cd7b56",
75
+ "@dxos/compute": "0.8.4-main.03d5cd7b56",
76
+ "@dxos/echo": "0.8.4-main.03d5cd7b56",
77
+ "@dxos/plugin-graph": "0.8.4-main.03d5cd7b56",
78
+ "@dxos/plugin-client": "0.8.4-main.03d5cd7b56",
79
+ "@dxos/react-client": "0.8.4-main.03d5cd7b56",
80
+ "@dxos/plugin-space": "0.8.4-main.03d5cd7b56",
81
+ "@dxos/react-ui-mosaic": "0.8.4-main.03d5cd7b56",
82
+ "@dxos/react-ui-stack": "0.8.4-main.03d5cd7b56",
83
+ "@dxos/util": "0.8.4-main.03d5cd7b56"
46
84
  },
47
85
  "devDependencies": {
48
- "@phosphor-icons/react": "^2.1.5",
49
- "@types/react": "~18.2.0",
50
- "@types/react-dom": "~18.2.0",
51
- "react": "~18.2.0",
52
- "react-dom": "~18.2.0",
53
- "vite": "5.4.7",
54
- "@dxos/react-ui-theme": "0.8.3",
55
- "@dxos/react-ui": "0.8.3",
56
- "@dxos/storybook-utils": "0.8.3"
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.10",
91
+ "@dxos/plugin-testing": "0.8.4-main.03d5cd7b56",
92
+ "@dxos/react-ui": "0.8.4-main.03d5cd7b56",
93
+ "@dxos/storybook-utils": "0.8.4-main.03d5cd7b56",
94
+ "@dxos/ui-theme": "0.8.4-main.03d5cd7b56"
57
95
  },
58
96
  "peerDependencies": {
59
- "@phosphor-icons/react": "^2.1.5",
60
- "effect": "^3.13.3",
61
- "react": "~18.2.0",
62
- "react-dom": "~18.2.0",
63
- "@dxos/react-ui-theme": "0.8.3",
64
- "@dxos/react-ui": "0.8.3"
97
+ "effect": "3.20.0",
98
+ "react": "~19.2.3",
99
+ "react-dom": "~19.2.3",
100
+ "@dxos/react-ui": "0.8.4-main.03d5cd7b56",
101
+ "@dxos/ui-theme": "0.8.4-main.03d5cd7b56"
65
102
  },
66
103
  "publishConfig": {
67
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
+ });
@@ -2,59 +2,20 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { createIntent, Capabilities, contributes, Events, 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 { ReactSurface, IntentResolver } from './capabilities';
11
- import { meta } from './meta';
12
- import translations from './translations';
13
- import { TemplateAction, TemplateType } 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 = () =>
16
- definePlugin(meta, [
17
- defineModule({
18
- id: `${meta.id}/module/translations`,
19
- activatesOn: Events.SetupTranslations,
20
- activate: () => contributes(Capabilities.Translations, translations),
21
- }),
22
- defineModule({
23
- id: `${meta.id}/module/metadata`,
24
- activatesOn: Events.SetupMetadata,
25
- activate: () =>
26
- contributes(Capabilities.Metadata, {
27
- id: TemplateType.typename,
28
- metadata: {
29
- icon: 'ph--asterisk--regular',
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: TemplateType,
41
- getIntent: () => createIntent(TemplateAction.Create),
42
- }),
43
- ),
44
- }),
45
- defineModule({
46
- id: `${meta.id}/module/schema`,
47
- activatesOn: ClientEvents.SetupSchema,
48
- activate: () => contributes(ClientCapabilities.Schema, [TemplateType]),
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,30 @@
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 { SpaceOperation } from '@dxos/plugin-space';
10
+ import { SpaceCapabilities } from '@dxos/plugin-space';
11
+
12
+ import { Template } from '#types';
13
+
14
+ export default Capability.makeModule(
15
+ Effect.fnUntraced(function* () {
16
+ return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {
17
+ id: Template.Data.typename,
18
+ createObject: (props, options) =>
19
+ Effect.gen(function* () {
20
+ const object = Template.make(props);
21
+ return yield* Operation.invoke(SpaceOperation.AddObject, {
22
+ object,
23
+ target: options.target,
24
+ hidden: true,
25
+ targetNodeId: options.targetNodeId,
26
+ });
27
+ }),
28
+ });
29
+ }),
30
+ );
@@ -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 { type 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 { TEMPLATE_PLUGIN } from '../meta';
12
- import { isObject } 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: TEMPLATE_PLUGIN,
19
- role: 'article',
20
- filter: (data): data is { subject: Obj.Any } => isObject(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.getDXN(object).toString()}</span>
18
+ </Panel.Content>
19
+ </Panel.Root>
20
+ );
21
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './TemplatePanel';
@@ -2,4 +2,4 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- 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,13 +2,17 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
+ import { trim } from '@dxos/util';
6
7
 
7
- export const TEMPLATE_PLUGIN = 'dxos.org/plugin/template';
8
-
9
- export const meta: PluginMeta = {
10
- id: TEMPLATE_PLUGIN,
8
+ export const meta: Plugin.Meta = {
9
+ id: 'org.dxos.plugin.template',
11
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
+ `,
12
15
  icon: 'ph--asterisk--regular',
16
+ iconHue: 'sky',
13
17
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template',
14
18
  };
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,24 +2,28 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Type } from '@dxos/echo';
5
+ import { type Resource } from '@dxos/react-ui';
6
6
 
7
- import { TEMPLATE_PLUGIN } from './meta';
8
- import { TemplateType } from './types';
7
+ import { meta } from '#meta';
8
+ import { Template } from '#types';
9
9
 
10
- export default [
10
+ export const translations = [
11
11
  {
12
12
  'en-US': {
13
- [Type.getTypename(TemplateType)]: {
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',
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
+ 'add-object.label': 'Add template',
20
+ 'rename-object.label': 'Rename template',
21
+ 'delete-object.label': 'Delete template',
22
+ 'object-deleted.label': 'Template deleted',
19
23
  },
20
- [TEMPLATE_PLUGIN]: {
21
- 'plugin name': 'Template',
24
+ [meta.id]: {
25
+ 'plugin.name': 'Template',
22
26
  },
23
27
  },
24
28
  },
25
- ];
29
+ ] as const satisfies Resource[];
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './schema';
@@ -0,0 +1,26 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import * as Schema from 'effect/Schema';
6
+
7
+ import { Annotation, Obj, Type } from '@dxos/echo';
8
+
9
+ export namespace Template {
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',
16
+ }),
17
+ Annotation.IconAnnotation.set({
18
+ icon: 'ph--asterisk--regular',
19
+ hue: 'sky',
20
+ }),
21
+ );
22
+
23
+ export type Data = Schema.Schema.Type<typeof Data>;
24
+
25
+ export const make = (props: Partial<Data>) => Obj.make(Data, props);
26
+ }
@@ -1,49 +0,0 @@
1
- // packages/plugins/plugin-template/src/types.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
- // packages/plugins/plugin-template/src/meta.ts
8
- var TEMPLATE_PLUGIN = "dxos.org/plugin/template";
9
- var meta = {
10
- id: TEMPLATE_PLUGIN,
11
- name: "Template",
12
- icon: "ph--asterisk--regular",
13
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template"
14
- };
15
-
16
- // packages/plugins/plugin-template/src/types.ts
17
- (function(TemplateAction2) {
18
- const TEMPLATE_ACTION = `${TEMPLATE_PLUGIN}/action`;
19
- class Create extends Schema.TaggedClass()(`${TEMPLATE_ACTION}/create`, {
20
- input: Schema.Struct({
21
- name: Schema.optional(Schema.String)
22
- }),
23
- output: Schema.Struct({
24
- object: ReactiveObjectSchema
25
- })
26
- }) {
27
- }
28
- TemplateAction2.Create = Create;
29
- })(TemplateAction || (TemplateAction = {}));
30
- var isObject = (object) => {
31
- return Obj.isObject(object) && object.type === "template";
32
- };
33
- var TemplateType = class extends TypedObject({
34
- typename: "dxos.org/type/Template",
35
- version: "0.1.0"
36
- })({
37
- name: Schema.optional(Schema.String)
38
- }) {
39
- };
40
- var TemplateAction;
41
-
42
- export {
43
- TEMPLATE_PLUGIN,
44
- meta,
45
- isObject,
46
- TemplateType,
47
- TemplateAction
48
- };
49
- //# sourceMappingURL=chunk-GMDXCSM2.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types.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 { TEMPLATE_PLUGIN } from './meta';\n\nexport namespace TemplateAction {\n const TEMPLATE_ACTION = `${TEMPLATE_PLUGIN}/action`;\n\n export class Create extends Schema.TaggedClass<Create>()(`${TEMPLATE_ACTION}/create`, {\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n }),\n output: Schema.Struct({\n object: ReactiveObjectSchema,\n }),\n }) {}\n}\n\nexport const isObject = (object: unknown): object is Obj.Any => {\n // TODO(dmaretskyi): Can this be Obj.instanceOf(TemplateType)?\n return Obj.isObject(object) && (object as any).type === 'template';\n};\n\nexport class TemplateType extends TypedObject({\n typename: 'dxos.org/type/Template',\n version: '0.1.0',\n})({\n name: Schema.optional(Schema.String),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const TEMPLATE_PLUGIN = 'dxos.org/plugin/template';\n\nexport const meta: PluginMeta = {\n id: TEMPLATE_PLUGIN,\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,kBAAkB;AAExB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,MAAM;EACNC,QAAQ;AACV;;;UDDiBC,iBAAAA;AACf,QAAMC,kBAAkB,GAAGC,eAAAA;EAEpB,MAAMC,eAAeC,OAAOC,YAAW,EAAW,GAAGJ,eAAAA,WAA0B;IACpFK,OAAOF,OAAOG,OAAO;MACnBC,MAAMJ,OAAOK,SAASL,OAAOM,MAAM;IACrC,CAAA;IACAC,QAAQP,OAAOG,OAAO;MACpBK,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;kBAPSV,SAAAA;AAQf,GAXiBH,mBAAAA,iBAAAA,CAAAA,EAAAA;AAaV,IAAMc,WAAW,CAACF,WAAAA;AAEvB,SAAOG,IAAID,SAASF,MAAAA,KAAYA,OAAeI,SAAS;AAC1D;AAEO,IAAMC,eAAN,cAA2BC,YAAY;EAC5CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDZ,MAAMJ,OAAOK,SAASL,OAAOM,MAAM;AACrC,CAAA,EAAA;AAAI;;",
6
- "names": ["Schema", "Obj", "TypedObject", "ReactiveObjectSchema", "TEMPLATE_PLUGIN", "meta", "id", "name", "icon", "source", "TemplateAction", "TEMPLATE_ACTION", "TEMPLATE_PLUGIN", "Create", "Schema", "TaggedClass", "input", "Struct", "name", "optional", "String", "output", "object", "ReactiveObjectSchema", "isObject", "Obj", "type", "TemplateType", "TypedObject", "typename", "version"]
7
- }
@@ -1,86 +0,0 @@
1
- import {
2
- TEMPLATE_PLUGIN,
3
- TemplateAction,
4
- TemplateType,
5
- meta
6
- } from "./chunk-GMDXCSM2.mjs";
7
-
8
- // packages/plugins/plugin-template/src/TemplatePlugin.tsx
9
- import { createIntent, Capabilities, contributes, Events, defineModule, definePlugin } from "@dxos/app-framework";
10
- import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
11
- import { SpaceCapabilities } from "@dxos/plugin-space";
12
- import { defineObjectForm } from "@dxos/plugin-space/types";
13
-
14
- // packages/plugins/plugin-template/src/capabilities/index.ts
15
- import { lazy } from "@dxos/app-framework";
16
- var IntentResolver = lazy(() => import("./intent-resolver-THP6KTJU.mjs"));
17
- var ReactSurface = lazy(() => import("./react-surface-RRVJU3OV.mjs"));
18
-
19
- // packages/plugins/plugin-template/src/translations.ts
20
- import { Type } from "@dxos/echo";
21
- var translations_default = [
22
- {
23
- "en-US": {
24
- [Type.getTypename(TemplateType)]: {
25
- "typename label": "Template",
26
- "typename label_zero": "Templates",
27
- "typename label_one": "Template",
28
- "typename label_other": "Templates",
29
- "object name placeholder": "New template"
30
- },
31
- [TEMPLATE_PLUGIN]: {
32
- "plugin name": "Template"
33
- }
34
- }
35
- }
36
- ];
37
-
38
- // packages/plugins/plugin-template/src/TemplatePlugin.tsx
39
- var TemplatePlugin = () => definePlugin(meta, [
40
- defineModule({
41
- id: `${meta.id}/module/translations`,
42
- activatesOn: Events.SetupTranslations,
43
- activate: () => contributes(Capabilities.Translations, translations_default)
44
- }),
45
- defineModule({
46
- id: `${meta.id}/module/metadata`,
47
- activatesOn: Events.SetupMetadata,
48
- activate: () => contributes(Capabilities.Metadata, {
49
- id: TemplateType.typename,
50
- metadata: {
51
- icon: "ph--asterisk--regular"
52
- }
53
- })
54
- }),
55
- defineModule({
56
- id: `${meta.id}/module/object-form`,
57
- activatesOn: ClientEvents.SetupSchema,
58
- activate: () => contributes(SpaceCapabilities.ObjectForm, defineObjectForm({
59
- objectSchema: TemplateType,
60
- getIntent: () => createIntent(TemplateAction.Create)
61
- }))
62
- }),
63
- defineModule({
64
- id: `${meta.id}/module/schema`,
65
- activatesOn: ClientEvents.SetupSchema,
66
- activate: () => contributes(ClientCapabilities.Schema, [
67
- TemplateType
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
- TEMPLATE_PLUGIN,
83
- TemplatePlugin,
84
- meta
85
- };
86
- //# sourceMappingURL=index.mjs.map