@dxos/plugin-template 0.8.4-main.d05673bc65 → 0.8.4-main.d9fc60f731

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 (74) 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/{browser/chunk-N5OOI66W.mjs → neutral/chunk-7RN2XYO6.mjs} +7 -4
  8. package/dist/lib/neutral/chunk-7RN2XYO6.mjs.map +7 -0
  9. package/dist/lib/{browser/chunk-4GOY3DOO.mjs → neutral/chunk-XVITFXCJ.mjs} +6 -6
  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 +1 -0
  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 -1
  34. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  35. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  36. package/dist/types/src/components/TemplatePanel/TemplatePanel.d.ts +3 -3
  37. package/dist/types/src/components/TemplatePanel/TemplatePanel.d.ts.map +1 -1
  38. package/dist/types/src/index.d.ts +1 -1
  39. package/dist/types/src/index.d.ts.map +1 -1
  40. package/dist/types/src/meta.d.ts +1 -1
  41. package/dist/types/src/meta.d.ts.map +1 -1
  42. package/dist/types/src/plugin.d.ts +3 -0
  43. package/dist/types/src/plugin.d.ts.map +1 -0
  44. package/dist/types/src/translations.d.ts +22 -15
  45. package/dist/types/src/translations.d.ts.map +1 -1
  46. package/dist/types/src/types/schema.d.ts +3 -3
  47. package/dist/types/src/types/schema.d.ts.map +1 -1
  48. package/dist/types/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +61 -35
  50. package/src/TemplatePlugin.test.ts +26 -0
  51. package/src/TemplatePlugin.tsx +7 -17
  52. package/src/capabilities/create-object.ts +31 -0
  53. package/src/capabilities/index.ts +4 -1
  54. package/src/capabilities/react-surface.tsx +28 -0
  55. package/src/components/TemplatePanel/TemplatePanel.tsx +5 -5
  56. package/src/index.ts +1 -1
  57. package/src/meta.ts +6 -4
  58. package/src/plugin.ts +9 -0
  59. package/src/translations.ts +14 -13
  60. package/src/types/schema.ts +4 -6
  61. package/dist/lib/browser/chunk-4GOY3DOO.mjs.map +0 -7
  62. package/dist/lib/browser/chunk-N5OOI66W.mjs.map +0 -7
  63. package/dist/lib/browser/index.mjs +0 -62
  64. package/dist/lib/browser/index.mjs.map +0 -7
  65. package/dist/lib/browser/meta.json +0 -1
  66. package/dist/lib/browser/react-surface-X7Z6HT56.mjs +0 -39
  67. package/dist/lib/browser/react-surface-X7Z6HT56.mjs.map +0 -7
  68. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  69. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  70. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  71. package/src/capabilities/react-surface/index.ts +0 -7
  72. package/src/capabilities/react-surface/react-surface.tsx +0 -30
  73. /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
  74. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-template",
3
- "version": "0.8.4-main.d05673bc65",
3
+ "version": "0.8.4-main.d9fc60f731",
4
4
  "description": "Template for new plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -8,66 +8,92 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/dxos/dxos"
10
10
  },
11
- "license": "MIT",
11
+ "license": "FSL-1.1-Apache-2.0",
12
12
  "author": "DXOS.org",
13
13
  "sideEffects": true,
14
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
+ },
15
47
  "exports": {
16
48
  ".": {
17
49
  "source": "./src/index.ts",
18
50
  "types": "./dist/types/src/index.d.ts",
19
- "browser": "./dist/lib/browser/index.mjs"
51
+ "default": "./dist/lib/neutral/index.mjs"
20
52
  },
21
- "./types": {
22
- "source": "./src/types/index.ts",
23
- "types": "./dist/types/src/types/index.d.ts",
24
- "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"
25
62
  }
26
63
  },
27
64
  "types": "dist/types/src/index.d.ts",
28
- "typesVersions": {
29
- "*": {
30
- "types": [
31
- "dist/types/src/types/index.d.ts"
32
- ]
33
- }
34
- },
35
65
  "files": [
36
66
  "dist",
37
67
  "src"
38
68
  ],
39
69
  "dependencies": {
40
- "@radix-ui/react-context": "1.1.1",
41
- "effect": "3.19.16",
42
- "@dxos/app-toolkit": "0.8.4-main.d05673bc65",
43
- "@dxos/echo": "0.8.4-main.d05673bc65",
44
- "@dxos/async": "0.8.4-main.d05673bc65",
45
- "@dxos/operation": "0.8.4-main.d05673bc65",
46
- "@dxos/plugin-client": "0.8.4-main.d05673bc65",
47
- "@dxos/app-framework": "0.8.4-main.d05673bc65",
48
- "@dxos/plugin-graph": "0.8.4-main.d05673bc65",
49
- "@dxos/plugin-space": "0.8.4-main.d05673bc65",
50
- "@dxos/react-client": "0.8.4-main.d05673bc65",
51
- "@dxos/react-ui-mosaic": "0.8.4-main.d05673bc65",
52
- "@dxos/react-ui-stack": "0.8.4-main.d05673bc65",
53
- "@dxos/util": "0.8.4-main.d05673bc65"
70
+ "effect": "3.21.2",
71
+ "@dxos/app-framework": "0.8.4-main.d9fc60f731",
72
+ "@dxos/compute": "0.8.4-main.d9fc60f731",
73
+ "@dxos/plugin-client": "0.8.4-main.d9fc60f731",
74
+ "@dxos/echo": "0.8.4-main.d9fc60f731",
75
+ "@dxos/app-toolkit": "0.8.4-main.d9fc60f731",
76
+ "@dxos/plugin-space": "0.8.4-main.d9fc60f731",
77
+ "@dxos/util": "0.8.4-main.d9fc60f731",
78
+ "@dxos/keys": "0.8.4-main.d9fc60f731"
54
79
  },
55
80
  "devDependencies": {
56
81
  "@types/react": "~19.2.7",
57
82
  "@types/react-dom": "~19.2.3",
58
83
  "react": "~19.2.3",
59
84
  "react-dom": "~19.2.3",
60
- "vite": "^7.1.11",
61
- "@dxos/storybook-utils": "0.8.4-main.d05673bc65",
62
- "@dxos/ui-theme": "0.8.4-main.d05673bc65",
63
- "@dxos/react-ui": "0.8.4-main.d05673bc65"
85
+ "vite": "^8.0.14",
86
+ "@dxos/plugin-testing": "0.8.4-main.d9fc60f731",
87
+ "@dxos/react-ui": "0.8.4-main.d9fc60f731",
88
+ "@dxos/ui-theme": "0.8.4-main.d9fc60f731",
89
+ "@dxos/storybook-utils": "0.8.4-main.d9fc60f731"
64
90
  },
65
91
  "peerDependencies": {
66
- "effect": "3.19.16",
92
+ "effect": "3.21.2",
67
93
  "react": "~19.2.3",
68
94
  "react-dom": "~19.2.3",
69
- "@dxos/react-ui": "0.8.4-main.d05673bc65",
70
- "@dxos/ui-theme": "0.8.4-main.d05673bc65"
95
+ "@dxos/react-ui": "0.8.4-main.d9fc60f731",
96
+ "@dxos/ui-theme": "0.8.4-main.d9fc60f731"
71
97
  },
72
98
  "publishConfig": {
73
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,30 +2,20 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import * as Effect from 'effect/Effect';
6
-
7
5
  import { Plugin } from '@dxos/app-framework';
8
6
  import { AppPlugin } from '@dxos/app-toolkit';
9
- import { type CreateObject } from '@dxos/plugin-space/types';
10
7
 
11
- import { ReactSurface } from './capabilities';
12
- import { meta } from './meta';
13
- import { translations } from './translations';
14
- 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';
15
12
 
16
13
  export const TemplatePlugin = Plugin.define(meta).pipe(
17
- AppPlugin.addMetadataModule({
18
- metadata: {
19
- id: Template.Data.typename,
20
- metadata: {
21
- icon: 'ph--asterisk--regular',
22
- iconHue: 'sky',
23
- createObject: ((props) => Effect.sync(() => Template.make(props))) satisfies CreateObject,
24
- },
25
- },
26
- }),
14
+ AppPlugin.addCreateObjectModule({ activate: CreateObject }),
27
15
  AppPlugin.addSchemaModule({ schema: [Template.Data] }),
28
16
  AppPlugin.addSurfaceModule({ activate: ReactSurface }),
29
17
  AppPlugin.addTranslationsModule({ translations }),
30
18
  Plugin.make,
31
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,4 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './react-surface';
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));
8
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -0,0 +1,28 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import React from 'react';
7
+
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface } from '@dxos/app-framework/ui';
10
+ import { AppSurface } from '@dxos/app-toolkit/ui';
11
+
12
+ import { TemplatePanel } from '#components';
13
+ import { Template } from '#types';
14
+
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
+ );
@@ -4,17 +4,17 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
7
+ import { type AppSurface } from '@dxos/app-toolkit/ui';
8
8
  import { Obj } from '@dxos/echo';
9
9
  import { Panel } from '@dxos/react-ui';
10
10
 
11
- export type TemplatePanelProps = SurfaceComponentProps<Obj.Unknown>;
11
+ export type TemplatePanelProps = AppSurface.ObjectArticleProps<Obj.Unknown>;
12
12
 
13
- export const TemplatePanel = ({ role, subject: object }: TemplatePanelProps) => {
13
+ export const TemplatePanel = ({ role, subject: object, attendableId: _attendableId }: TemplatePanelProps) => {
14
14
  return (
15
- <Panel.Root role={role} className='dx-article'>
15
+ <Panel.Root role={role} className='dx-document'>
16
16
  <Panel.Content>
17
- <span>{Obj.getDXN(object).toString()}</span>
17
+ <span>{Obj.getURI(object)}</span>
18
18
  </Panel.Content>
19
19
  </Panel.Root>
20
20
  );
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 Plugin } 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: Plugin.Meta = {
9
- id: 'org.dxos.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: Plugin.Meta = {
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,27 +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
- 'add object label': 'Add template',
20
- 'rename object label': 'Rename template',
21
- 'delete object label': 'Delete template',
22
- 'object deleted label': 'Template deleted',
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',
23
24
  },
24
25
  [meta.id]: {
25
- 'plugin name': 'Template',
26
+ 'plugin.name': 'Template',
26
27
  },
27
28
  },
28
29
  },
@@ -4,19 +4,17 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { Obj, Type } from '@dxos/echo';
7
+ import { DXN, Annotation, Obj, Type } from '@dxos/echo';
8
8
 
9
9
  export namespace Template {
10
10
  export const Data = Schema.Struct({
11
11
  name: Schema.optional(Schema.String),
12
12
  }).pipe(
13
- Type.object({
14
- typename: 'org.dxos.type.data',
15
- version: '0.1.0',
16
- }),
13
+ Annotation.IconAnnotation.set({ icon: 'ph--asterisk--regular', hue: 'sky' }),
14
+ Type.makeObject(DXN.make('org.dxos.type.data', '0.1.0')),
17
15
  );
18
16
 
19
- export type Data = Schema.Schema.Type<typeof Data>;
17
+ export type Data = Type.InstanceType<typeof Data>;
20
18
 
21
19
  export const make = (props: Partial<Data>) => Obj.make(Data, props);
22
20
  }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/schema.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Obj, Type } from '@dxos/echo';\n\nexport namespace Template {\n export const Data = Schema.Struct({\n name: Schema.optional(Schema.String),\n }).pipe(\n Type.object({\n typename: 'org.dxos.type.data',\n version: '0.1.0',\n }),\n );\n\n export type Data = Schema.Schema.Type<typeof Data>;\n\n export const make = (props: Partial<Data>) => Obj.make(Data, props);\n}\n"],
5
- "mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,KAAKC,YAAY;UAETC,WAAAA;YACFC,OAAcC,cAAO;IAChCC,MAAaC,gBAAgBC,aAAM;EACrC,CAAA,EAAGC,KACDC,KAAKC,OAAO;IACVC,UAAU;IACVC,SAAS;EACX,CAAA,CAAA;YAKWC,OAAO,CAACC,UAAyBC,IAAIF,KAAIX,UAACC,MAAMW,KAAAA;AAC/D,GAbiBZ,aAAAA,WAAAA,CAAAA,EAAAA;;",
6
- "names": ["Schema", "Obj", "Type", "Template", "Data", "Struct", "name", "optional", "String", "pipe", "Type", "object", "typename", "version", "make", "props", "Obj"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.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": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;AACV;",
6
- "names": ["trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source"]
7
- }
@@ -1,62 +0,0 @@
1
- import {
2
- meta
3
- } from "./chunk-N5OOI66W.mjs";
4
- import {
5
- Template
6
- } from "./chunk-4GOY3DOO.mjs";
7
-
8
- // src/TemplatePlugin.tsx
9
- import * as Effect from "effect/Effect";
10
- import { Plugin } from "@dxos/app-framework";
11
- import { AppPlugin } from "@dxos/app-toolkit";
12
-
13
- // src/capabilities/react-surface/index.ts
14
- import { Capability } from "@dxos/app-framework";
15
- var ReactSurface = Capability.lazy("ReactSurface", () => import("./react-surface-X7Z6HT56.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
- "add object label": "Add template",
28
- "rename object label": "Rename template",
29
- "delete object label": "Delete template",
30
- "object deleted label": "Template deleted"
31
- },
32
- [meta.id]: {
33
- "plugin name": "Template"
34
- }
35
- }
36
- }
37
- ];
38
-
39
- // src/TemplatePlugin.tsx
40
- var TemplatePlugin = Plugin.define(meta).pipe(AppPlugin.addMetadataModule({
41
- metadata: {
42
- id: Template.Data.typename,
43
- metadata: {
44
- icon: "ph--asterisk--regular",
45
- iconHue: "sky",
46
- createObject: (props) => Effect.sync(() => Template.make(props))
47
- }
48
- }
49
- }), AppPlugin.addSchemaModule({
50
- schema: [
51
- Template.Data
52
- ]
53
- }), AppPlugin.addSurfaceModule({
54
- activate: ReactSurface
55
- }), AppPlugin.addTranslationsModule({
56
- translations
57
- }), Plugin.make);
58
- export {
59
- TemplatePlugin,
60
- meta
61
- };
62
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/TemplatePlugin.tsx", "../../../src/capabilities/react-surface/index.ts", "../../../src/translations.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { type CreateObject } from '@dxos/plugin-space/types';\n\nimport { ReactSurface } from './capabilities';\nimport { meta } from './meta';\nimport { translations } from './translations';\nimport { Template } from './types';\n\nexport const TemplatePlugin = Plugin.define(meta).pipe(\n AppPlugin.addMetadataModule({\n metadata: {\n id: Template.Data.typename,\n metadata: {\n icon: 'ph--asterisk--regular',\n iconHue: 'sky',\n createObject: ((props) => Effect.sync(() => Template.make(props))) satisfies CreateObject,\n },\n },\n }),\n AppPlugin.addSchemaModule({ schema: [Template.Data] }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.make,\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const ReactSurface = Capability.lazy('ReactSurface', () => 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 'add object label': 'Add template',\n 'rename object label': 'Rename template',\n 'delete object label': 'Delete template',\n 'object deleted label': 'Template deleted',\n },\n [meta.id]: {\n 'plugin name': 'Template',\n },\n },\n },\n] as const satisfies Resource[];\n"],
5
- "mappings": ";;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAc;AACvB,SAASC,iBAAiB;;;ACH1B,SAASC,kBAAkB;AAEpB,IAAMC,eAAeC,WAAWC,KAAK,gBAAgB,MAAM,OAAO,8BAAA,CAAA;;;ACGlE,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,SAASC,KAAKC,QAAQ,GAAG;QACxB,kBAAkB;QAClB,uBAAuB;QACvB,sBAAsB;QACtB,wBAAwB;QACxB,2BAA2B;QAC3B,oBAAoB;QACpB,uBAAuB;QACvB,uBAAuB;QACvB,wBAAwB;MAC1B;MACA,CAACC,KAAKC,EAAE,GAAG;QACT,eAAe;MACjB;IACF;EACF;;;;AFZK,IAAMC,iBAAiBC,OAAOC,OAAOC,IAAAA,EAAMC,KAChDC,UAAUC,kBAAkB;EAC1BC,UAAU;IACRC,IAAIC,SAASC,KAAKC;IAClBJ,UAAU;MACRK,MAAM;MACNC,SAAS;MACTC,cAAe,CAACC,UAAiBC,YAAK,MAAMP,SAASQ,KAAKF,KAAAA,CAAAA;IAC5D;EACF;AACF,CAAA,GACAV,UAAUa,gBAAgB;EAAEC,QAAQ;IAACV,SAASC;;AAAM,CAAA,GACpDL,UAAUe,iBAAiB;EAAEC,UAAUC;AAAa,CAAA,GACpDjB,UAAUkB,sBAAsB;EAAEC;AAAa,CAAA,GAC/CvB,OAAOgB,IAAI;",
6
- "names": ["Effect", "Plugin", "AppPlugin", "Capability", "ReactSurface", "Capability", "lazy", "translations", "Template", "Data", "typename", "meta", "id", "TemplatePlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addMetadataModule", "metadata", "id", "Template", "Data", "typename", "icon", "iconHue", "createObject", "props", "sync", "make", "addSchemaModule", "schema", "addSurfaceModule", "activate", "ReactSurface", "addTranslationsModule", "translations"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"src/meta.ts":{"bytes":1835,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/components/TemplatePanel/TemplatePanel.tsx":{"bytes":2068,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"format":"esm"},"src/components/TemplatePanel/index.ts":{"bytes":501,"imports":[{"path":"src/components/TemplatePanel/TemplatePanel.tsx","kind":"import-statement","original":"./TemplatePanel"}],"format":"esm"},"src/components/index.ts":{"bytes":487,"imports":[{"path":"src/components/TemplatePanel/index.ts","kind":"import-statement","original":"./TemplatePanel"}],"format":"esm"},"src/types/schema.ts":{"bytes":1897,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"format":"esm"},"src/types/index.ts":{"bytes":463,"imports":[{"path":"src/types/schema.ts","kind":"import-statement","original":"./schema"}],"format":"esm"},"src/capabilities/react-surface/react-surface.tsx":{"bytes":3342,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/components/index.ts","kind":"import-statement","original":"../../components"},{"path":"src/meta.ts","kind":"import-statement","original":"../../meta"},{"path":"src/types/index.ts","kind":"import-statement","original":"../../types"}],"format":"esm"},"src/capabilities/react-surface/index.ts":{"bytes":912,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/react-surface/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"src/capabilities/index.ts":{"bytes":489,"imports":[{"path":"src/capabilities/react-surface/index.ts","kind":"import-statement","original":"./react-surface"}],"format":"esm"},"src/translations.ts":{"bytes":2686,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/TemplatePlugin.tsx":{"bytes":3632,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/index.ts":{"bytes":557,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/TemplatePlugin.tsx","kind":"import-statement","original":"./TemplatePlugin"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3366},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-N5OOI66W.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-4GOY3DOO.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/browser/react-surface-X7Z6HT56.mjs","kind":"dynamic-import"}],"exports":["TemplatePlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/TemplatePlugin.tsx":{"bytesInOutput":607},"src/capabilities/react-surface/index.ts":{"bytesInOutput":148},"src/capabilities/index.ts":{"bytesInOutput":0},"src/translations.ts":{"bytesInOutput":572}},"bytes":1619},"dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/types/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-4GOY3DOO.mjs","kind":"import-statement"}],"exports":["Template"],"entryPoint":"src/types/index.ts","inputs":{},"bytes":110},"dist/lib/browser/react-surface-X7Z6HT56.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2778},"dist/lib/browser/react-surface-X7Z6HT56.mjs":{"imports":[{"path":"dist/lib/browser/chunk-N5OOI66W.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-4GOY3DOO.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/capabilities/react-surface/react-surface.tsx","inputs":{"src/capabilities/react-surface/react-surface.tsx":{"bytesInOutput":598},"src/components/TemplatePanel/TemplatePanel.tsx":{"bytesInOutput":400},"src/components/TemplatePanel/index.ts":{"bytesInOutput":0},"src/components/index.ts":{"bytesInOutput":0}},"bytes":1352},"dist/lib/browser/chunk-N5OOI66W.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":878},"dist/lib/browser/chunk-N5OOI66W.mjs":{"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["meta"],"inputs":{"src/meta.ts":{"bytesInOutput":444}},"bytes":523},"dist/lib/browser/chunk-4GOY3DOO.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1019},"dist/lib/browser/chunk-4GOY3DOO.mjs":{"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["Template"],"inputs":{"src/types/schema.ts":{"bytesInOutput":378},"src/types/index.ts":{"bytesInOutput":0}},"bytes":469}}}
@@ -1,39 +0,0 @@
1
- import {
2
- meta
3
- } from "./chunk-N5OOI66W.mjs";
4
- import {
5
- Template
6
- } from "./chunk-4GOY3DOO.mjs";
7
-
8
- // src/capabilities/react-surface/react-surface.tsx
9
- import * as Effect from "effect/Effect";
10
- import React2 from "react";
11
- import { Capabilities, Capability } from "@dxos/app-framework";
12
- import { Surface } from "@dxos/app-framework/ui";
13
- import { Obj as Obj2 } from "@dxos/echo";
14
-
15
- // src/components/TemplatePanel/TemplatePanel.tsx
16
- import React from "react";
17
- import { Obj } from "@dxos/echo";
18
- import { Panel } from "@dxos/react-ui";
19
- var TemplatePanel = ({ role, subject: object }) => {
20
- return /* @__PURE__ */ React.createElement(Panel.Root, {
21
- role,
22
- className: "dx-article"
23
- }, /* @__PURE__ */ React.createElement(Panel.Content, null, /* @__PURE__ */ React.createElement("span", null, Obj.getDXN(object).toString())));
24
- };
25
-
26
- // src/capabilities/react-surface/react-surface.tsx
27
- var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Capabilities.ReactSurface, Surface.create({
28
- id: meta.id,
29
- role: "article",
30
- filter: (data) => Obj2.instanceOf(Template.Data, data.subject),
31
- component: ({ data, role }) => /* @__PURE__ */ React2.createElement(TemplatePanel, {
32
- role,
33
- subject: data.subject
34
- })
35
- }))));
36
- export {
37
- react_surface_default as default
38
- };
39
- //# sourceMappingURL=react-surface-X7Z6HT56.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/react-surface/react-surface.tsx", "../../../src/components/TemplatePanel/TemplatePanel.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React from 'react';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Surface } from '@dxos/app-framework/ui';\nimport { Obj } from '@dxos/echo';\n\nimport { TemplatePanel } from '../../components';\nimport { meta } from '../../meta';\nimport { Template } from '../../types';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(\n Capabilities.ReactSurface,\n Surface.create({\n id: meta.id,\n role: 'article',\n filter: (data): data is { subject: Obj.Unknown } => Obj.instanceOf(Template.Data, data.subject),\n component: ({ data, role }: { data: { subject: Obj.Unknown }; role: string }) => (\n <TemplatePanel role={role} subject={data.subject} />\n ),\n }),\n ),\n ),\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';\nimport { Obj } from '@dxos/echo';\nimport { Panel } from '@dxos/react-ui';\n\nexport type TemplatePanelProps = SurfaceComponentProps<Obj.Unknown>;\n\nexport const TemplatePanel = ({ role, subject: object }: TemplatePanelProps) => {\n return (\n <Panel.Root role={role} className='dx-article'>\n <Panel.Content>\n <span>{Obj.getDXN(object).toString()}</span>\n </Panel.Content>\n </Panel.Root>\n );\n};\n"],
5
- "mappings": ";;;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,YAAW;AAElB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,eAAe;AACxB,SAASC,OAAAA,YAAW;;;ACLpB,OAAOC,WAAW;AAGlB,SAASC,WAAW;AACpB,SAASC,aAAa;AAIf,IAAMC,gBAAgB,CAAC,EAAEC,MAAMC,SAASC,OAAM,MAAsB;AACzE,SACE,sBAAA,cAACC,MAAMC,MAAI;IAACJ;IAAYK,WAAU;KAChC,sBAAA,cAACF,MAAMG,SAAO,MACZ,sBAAA,cAACC,QAAAA,MAAMC,IAAIC,OAAOP,MAAAA,EAAQQ,SAAQ,CAAA,CAAA,CAAA;AAI1C;;;ADLA,IAAA,wBAAeC,WAAWC,WAAW,MAC5BC,eACLF,WAAWG,YACTC,aAAaC,cACbC,QAAQC,OAAO;EACbC,IAAIC,KAAKD;EACTE,MAAM;EACNC,QAAQ,CAACC,SAA2CC,KAAIC,WAAWC,SAASC,MAAMJ,KAAKK,OAAO;EAC9FC,WAAW,CAAC,EAAEN,MAAMF,KAAI,MACtB,gBAAAS,OAAA,cAACC,eAAAA;IAAcV;IAAYO,SAASL,KAAKK;;AAE7C,CAAA,CAAA,CAAA,CAAA;",
6
- "names": ["Effect", "React", "Capabilities", "Capability", "Surface", "Obj", "React", "Obj", "Panel", "TemplatePanel", "role", "subject", "object", "Panel", "Root", "className", "Content", "span", "Obj", "getDXN", "toString", "Capability", "makeModule", "succeed", "contributes", "Capabilities", "ReactSurface", "Surface", "create", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Template", "Data", "subject", "component", "React", "TemplatePanel"]
7
- }
@@ -1,3 +0,0 @@
1
- import { Capability } from '@dxos/app-framework';
2
- export declare const ReactSurface: Capability.LazyCapability<void, Capability.Capability<Capability.InterfaceDef<import("@dxos/app-framework/Capabilities").ReactSurface>>, Error>;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,YAAY,iJAAmE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/react-surface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;;AAQ/D,wBAcE"}
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Capability } from '@dxos/app-framework';
6
-
7
- export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -1,30 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import * as Effect from 'effect/Effect';
6
- import React from 'react';
7
-
8
- import { Capabilities, Capability } from '@dxos/app-framework';
9
- import { Surface } from '@dxos/app-framework/ui';
10
- import { Obj } from '@dxos/echo';
11
-
12
- import { TemplatePanel } from '../../components';
13
- import { meta } from '../../meta';
14
- import { Template } from '../../types';
15
-
16
- export default Capability.makeModule(() =>
17
- Effect.succeed(
18
- Capability.contributes(
19
- Capabilities.ReactSurface,
20
- Surface.create({
21
- id: meta.id,
22
- role: 'article',
23
- filter: (data): data is { subject: Obj.Unknown } => Obj.instanceOf(Template.Data, data.subject),
24
- component: ({ data, role }: { data: { subject: Obj.Unknown }; role: string }) => (
25
- <TemplatePanel role={role} subject={data.subject} />
26
- ),
27
- }),
28
- ),
29
- ),
30
- );