@dxos/plugin-template 0.7.4-staging.f7e8224 → 0.7.5-feature-compute.4d9d99a

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 (46) hide show
  1. package/dist/lib/browser/chunk-FLZIRPLH.mjs +47 -0
  2. package/dist/lib/browser/chunk-FLZIRPLH.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +51 -141
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/intent-resolver-7UI73TQM.mjs +19 -0
  6. package/dist/lib/browser/intent-resolver-7UI73TQM.mjs.map +7 -0
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/react-surface-UV46UZND.mjs +35 -0
  9. package/dist/lib/browser/react-surface-UV46UZND.mjs.map +7 -0
  10. package/dist/lib/browser/types.mjs +11 -0
  11. package/dist/types/src/TemplatePlugin.d.ts +1 -3
  12. package/dist/types/src/TemplatePlugin.d.ts.map +1 -1
  13. package/dist/types/src/capabilities/index.d.ts +3 -0
  14. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  15. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  16. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  17. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  18. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  19. package/dist/types/src/components/TemplateContainer.d.ts +7 -0
  20. package/dist/types/src/components/TemplateContainer.d.ts.map +1 -0
  21. package/dist/types/src/components/index.d.ts +1 -1
  22. package/dist/types/src/components/index.d.ts.map +1 -1
  23. package/dist/types/src/index.d.ts +1 -0
  24. package/dist/types/src/index.d.ts.map +1 -1
  25. package/dist/types/src/meta.d.ts +1 -2
  26. package/dist/types/src/meta.d.ts.map +1 -1
  27. package/dist/types/src/types.d.ts +23 -4
  28. package/dist/types/src/types.d.ts.map +1 -1
  29. package/dist/types/tsconfig.tsbuildinfo +1 -0
  30. package/package.json +19 -17
  31. package/src/TemplatePlugin.tsx +48 -90
  32. package/src/capabilities/index.ts +8 -0
  33. package/src/capabilities/intent-resolver.ts +16 -0
  34. package/src/capabilities/react-surface.tsx +23 -0
  35. package/src/components/TemplateContainer.tsx +18 -0
  36. package/src/components/index.ts +1 -1
  37. package/src/index.ts +1 -0
  38. package/src/meta.ts +1 -1
  39. package/src/types.ts +16 -17
  40. package/dist/lib/browser/chunk-CPSXHPOD.mjs +0 -14
  41. package/dist/lib/browser/chunk-CPSXHPOD.mjs.map +0 -7
  42. package/dist/lib/browser/meta.mjs +0 -9
  43. package/dist/types/src/components/TemplateMain.d.ts +0 -6
  44. package/dist/types/src/components/TemplateMain.d.ts.map +0 -1
  45. package/src/components/TemplateMain.tsx +0 -28
  46. /package/dist/lib/browser/{meta.mjs.map → types.mjs.map} +0 -0
@@ -0,0 +1,47 @@
1
+ // packages/plugins/experimental/plugin-template/src/types.ts
2
+ import { S, TypedObject } from "@dxos/echo-schema";
3
+ import { isEchoObject, ReactiveObjectSchema } from "@dxos/react-client/echo";
4
+
5
+ // packages/plugins/experimental/plugin-template/src/meta.ts
6
+ var TEMPLATE_PLUGIN = "dxos.org/plugin/template";
7
+ var meta = {
8
+ id: TEMPLATE_PLUGIN,
9
+ name: "Template",
10
+ icon: "ph--asterisk--regular",
11
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-template"
12
+ };
13
+
14
+ // packages/plugins/experimental/plugin-template/src/types.ts
15
+ var TemplateAction;
16
+ (function(TemplateAction2) {
17
+ const TEMPLATE_ACTION = `${TEMPLATE_PLUGIN}/action`;
18
+ class Create extends S.TaggedClass()(`${TEMPLATE_ACTION}/create`, {
19
+ input: S.Struct({
20
+ name: S.optional(S.String)
21
+ }),
22
+ output: S.Struct({
23
+ object: ReactiveObjectSchema
24
+ })
25
+ }) {
26
+ }
27
+ TemplateAction2.Create = Create;
28
+ })(TemplateAction || (TemplateAction = {}));
29
+ var isObject = (object) => {
30
+ return isEchoObject(object) && object.type === "template";
31
+ };
32
+ var TemplateType = class extends TypedObject({
33
+ typename: "dxos.org/type/Template",
34
+ version: "0.1.0"
35
+ })({
36
+ name: S.optional(S.String)
37
+ }) {
38
+ };
39
+
40
+ export {
41
+ TEMPLATE_PLUGIN,
42
+ meta,
43
+ TemplateAction,
44
+ isObject,
45
+ TemplateType
46
+ };
47
+ //# sourceMappingURL=chunk-FLZIRPLH.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types.ts", "../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { S, TypedObject } from '@dxos/echo-schema';\nimport { isEchoObject, ReactiveObjectSchema, type ReactiveEchoObject } 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 S.TaggedClass<Create>()(`${TEMPLATE_ACTION}/create`, {\n input: S.Struct({\n name: S.optional(S.String),\n }),\n output: S.Struct({\n object: ReactiveObjectSchema,\n }),\n }) {}\n}\n\n// TODO(burdon): Warning: Encountered two children with the same key, `dxos.org/plugin/template`.\n// TODO(burdon): Better way to detect?\nexport const isObject = (object: unknown): object is ReactiveEchoObject<any> => {\n return isEchoObject(object) && object.type === 'template';\n};\n\nexport class TemplateType extends TypedObject({ typename: 'dxos.org/type/Template', version: '0.1.0' })({\n name: S.optional(S.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 = {\n id: TEMPLATE_PLUGIN,\n name: 'Template',\n icon: 'ph--asterisk--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-template',\n} satisfies PluginMeta;\n"],
5
+ "mappings": ";AAIA,SAASA,GAAGC,mBAAmB;AAC/B,SAASC,cAAcC,4BAAqD;;;ACCrE,IAAMC,kBAAkB;AAExB,IAAMC,OAAO;EAClBC,IAAIF;EACJG,MAAM;EACNC,MAAM;EACNC,QAAQ;AACV;;;;UDJiBC,iBAAAA;AACf,QAAMC,kBAAkB,GAAGC,eAAAA;EAEpB,MAAMC,eAAeC,EAAEC,YAAW,EAAW,GAAGJ,eAAAA,WAA0B;IAC/EK,OAAOF,EAAEG,OAAO;MACdC,MAAMJ,EAAEK,SAASL,EAAEM,MAAM;IAC3B,CAAA;IACAC,QAAQP,EAAEG,OAAO;MACfK,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;kBAPSV,SAAAA;AAQf,GAXiBH,mBAAAA,iBAAAA,CAAAA,EAAAA;AAeV,IAAMc,WAAW,CAACF,WAAAA;AACvB,SAAOG,aAAaH,MAAAA,KAAWA,OAAOI,SAAS;AACjD;AAEO,IAAMC,eAAN,cAA2BC,YAAY;EAAEC,UAAU;EAA0BC,SAAS;AAAQ,CAAA,EAAG;EACtGZ,MAAMJ,EAAEK,SAASL,EAAEM,MAAM;AAC3B,CAAA,EAAA;AAAI;",
6
+ "names": ["S", "TypedObject", "isEchoObject", "ReactiveObjectSchema", "TEMPLATE_PLUGIN", "meta", "id", "name", "icon", "source", "TemplateAction", "TEMPLATE_ACTION", "TEMPLATE_PLUGIN", "Create", "S", "TaggedClass", "input", "Struct", "name", "optional", "String", "output", "object", "ReactiveObjectSchema", "isObject", "isEchoObject", "type", "TemplateType", "TypedObject", "typename", "version"]
7
+ }
@@ -1,38 +1,18 @@
1
1
  import {
2
2
  TEMPLATE_PLUGIN,
3
- meta_default
4
- } from "./chunk-CPSXHPOD.mjs";
3
+ TemplateAction,
4
+ TemplateType,
5
+ meta
6
+ } from "./chunk-FLZIRPLH.mjs";
5
7
 
6
8
  // packages/plugins/experimental/plugin-template/src/TemplatePlugin.tsx
7
- import React2 from "react";
8
- import { resolvePlugin, parseIntentPlugin, NavigationAction } from "@dxos/app-framework";
9
- import { parseClientPlugin } from "@dxos/plugin-client";
10
- import { createExtension, isActionGroup } from "@dxos/plugin-graph";
11
- import { SpaceAction } from "@dxos/plugin-space";
12
- import { create } from "@dxos/react-client/echo";
9
+ import { createIntent, Capabilities, contributes, Events, defineModule, definePlugin, oneOf } from "@dxos/app-framework";
10
+ import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
13
11
 
14
- // packages/plugins/experimental/plugin-template/src/components/TemplateMain.tsx
15
- import React from "react";
16
- import { PublicKey } from "@dxos/react-client";
17
- import { getSpace } from "@dxos/react-client/echo";
18
- import { Main } from "@dxos/react-ui";
19
- import { baseSurface, topbarBlockPaddingStart, fixedInsetFlexLayout, bottombarBlockPaddingEnd } from "@dxos/react-ui-theme";
20
- var TemplateMain = ({ object }) => {
21
- const space = getSpace(object);
22
- return (
23
- // TODO(burdon): Boilerplate.
24
- /* @__PURE__ */ React.createElement(Main.Content, {
25
- classNames: [
26
- baseSurface,
27
- fixedInsetFlexLayout,
28
- topbarBlockPaddingStart,
29
- bottombarBlockPaddingEnd
30
- ]
31
- }, /* @__PURE__ */ React.createElement("pre", {
32
- className: "m-4 p-2 ring"
33
- }, /* @__PURE__ */ React.createElement("span", null, space?.key.truncate()), "/", /* @__PURE__ */ React.createElement("span", null, PublicKey.from(object.id).truncate())))
34
- );
35
- };
12
+ // packages/plugins/experimental/plugin-template/src/capabilities/index.ts
13
+ import { lazy } from "@dxos/app-framework";
14
+ var IntentResolver = lazy(() => import("./intent-resolver-7UI73TQM.mjs"));
15
+ var ReactSurface = lazy(() => import("./react-surface-UV46UZND.mjs"));
36
16
 
37
17
  // packages/plugins/experimental/plugin-template/src/translations.ts
38
18
  var translations_default = [
@@ -48,121 +28,51 @@ var translations_default = [
48
28
  }
49
29
  ];
50
30
 
51
- // packages/plugins/experimental/plugin-template/src/types.ts
52
- import { isEchoObject } from "@dxos/react-client/echo";
53
- var TEMPLATE_ACTION = `${TEMPLATE_PLUGIN}/action`;
54
- var TemplateAction;
55
- (function(TemplateAction2) {
56
- TemplateAction2[TemplateAction2["CREATE"] = `${TEMPLATE_ACTION}/create`] = "CREATE";
57
- })(TemplateAction || (TemplateAction = {}));
58
- var isObject = (object) => {
59
- return isEchoObject(object) && object.type === "template";
60
- };
61
-
62
31
  // packages/plugins/experimental/plugin-template/src/TemplatePlugin.tsx
63
- var typename = "template";
64
- var TemplatePlugin = () => {
65
- return {
66
- meta: meta_default,
67
- provides: {
32
+ var TemplatePlugin = () => definePlugin(meta, [
33
+ defineModule({
34
+ id: `${meta.id}/module/translations`,
35
+ activatesOn: Events.SetupTranslations,
36
+ activate: () => contributes(Capabilities.Translations, translations_default)
37
+ }),
38
+ defineModule({
39
+ id: `${meta.id}/module/metadata`,
40
+ activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),
41
+ activate: () => contributes(Capabilities.Metadata, {
42
+ id: TemplateType.typename,
68
43
  metadata: {
69
- records: {
70
- [typename]: {
71
- placeholder: [
72
- "object placeholder",
73
- {
74
- ns: TEMPLATE_PLUGIN
75
- }
76
- ],
77
- icon: "ph--asterisk--regular"
78
- }
79
- }
80
- },
81
- translations: translations_default,
82
- graph: {
83
- builder: (plugins) => {
84
- const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
85
- const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;
86
- if (!client || !dispatch) {
87
- return [];
88
- }
89
- return createExtension({
90
- id: TemplateAction.CREATE,
91
- filter: (node) => isActionGroup(node) && node.id.startsWith(SpaceAction.ADD_OBJECT),
92
- actions: ({ node }) => {
93
- const id = node.id.split("/").at(-1);
94
- const [spaceId, objectId] = id?.split(":") ?? [];
95
- const space = client.spaces.get().find((space2) => space2.id === spaceId);
96
- const object = objectId && space?.db.getObjectById(objectId);
97
- const target = objectId ? object : space;
98
- if (!target) {
99
- return;
100
- }
101
- return [
102
- {
103
- id: `${TEMPLATE_PLUGIN}/create/${node.id}`,
104
- data: async () => {
105
- await dispatch([
106
- {
107
- plugin: TEMPLATE_PLUGIN,
108
- action: TemplateAction.CREATE
109
- },
110
- {
111
- action: SpaceAction.ADD_OBJECT,
112
- data: {
113
- target
114
- }
115
- },
116
- {
117
- action: NavigationAction.OPEN
118
- }
119
- ]);
120
- },
121
- properties: {
122
- label: [
123
- "create object label",
124
- {
125
- ns: TEMPLATE_PLUGIN
126
- }
127
- ],
128
- icon: "ph--placeholder--regular",
129
- testId: "templatePlugin.createObject"
130
- }
131
- }
132
- ];
133
- }
134
- });
135
- }
136
- },
137
- surface: {
138
- component: ({ data, role }) => {
139
- switch (role) {
140
- case "main": {
141
- return isObject(data.active) ? /* @__PURE__ */ React2.createElement(TemplateMain, {
142
- object: data.active
143
- }) : null;
144
- }
44
+ createObject: (props) => createIntent(TemplateAction.Create, props),
45
+ placeholder: [
46
+ "object placeholder",
47
+ {
48
+ ns: TEMPLATE_PLUGIN
145
49
  }
146
- return null;
147
- }
148
- },
149
- intent: {
150
- resolver: (intent) => {
151
- switch (intent.action) {
152
- case TemplateAction.CREATE: {
153
- return {
154
- data: create({
155
- type: "template"
156
- })
157
- };
158
- }
159
- }
160
- }
50
+ ],
51
+ icon: "ph--asterisk--regular"
161
52
  }
162
- }
163
- };
164
- };
53
+ })
54
+ }),
55
+ defineModule({
56
+ id: `${meta.id}/module/schema`,
57
+ activatesOn: ClientEvents.SetupClient,
58
+ activate: () => contributes(ClientCapabilities.Schema, [
59
+ TemplateType
60
+ ])
61
+ }),
62
+ defineModule({
63
+ id: `${meta.id}/module/react-surface`,
64
+ activatesOn: Events.Startup,
65
+ activate: ReactSurface
66
+ }),
67
+ defineModule({
68
+ id: `${meta.id}/module/intent-resolver`,
69
+ activatesOn: Events.SetupIntents,
70
+ activate: IntentResolver
71
+ })
72
+ ]);
165
73
  export {
166
- TemplatePlugin
74
+ TEMPLATE_PLUGIN,
75
+ TemplatePlugin,
76
+ meta
167
77
  };
168
78
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/TemplatePlugin.tsx", "../../../src/components/TemplateMain.tsx", "../../../src/translations.ts", "../../../src/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { resolvePlugin, parseIntentPlugin, type PluginDefinition, NavigationAction } from '@dxos/app-framework';\nimport { parseClientPlugin } from '@dxos/plugin-client';\nimport { type ActionGroup, createExtension, isActionGroup } from '@dxos/plugin-graph';\nimport { SpaceAction } from '@dxos/plugin-space';\nimport { create } from '@dxos/react-client/echo';\n\nimport { TemplateMain } from './components';\nimport meta, { TEMPLATE_PLUGIN } from './meta';\nimport translations from './translations';\nimport { TemplateAction, type TemplatePluginProvides, isObject } from './types';\n\nconst typename = 'template'; // Type.schema.typename\n\nexport const TemplatePlugin = (): PluginDefinition<TemplatePluginProvides> => {\n return {\n meta,\n provides: {\n metadata: {\n records: {\n [typename]: {\n placeholder: ['object placeholder', { ns: TEMPLATE_PLUGIN }],\n icon: 'ph--asterisk--regular',\n },\n },\n },\n translations,\n graph: {\n builder: (plugins) => {\n const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;\n const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;\n if (!client || !dispatch) {\n return [];\n }\n\n return createExtension({\n id: TemplateAction.CREATE,\n filter: (node): node is ActionGroup => isActionGroup(node) && node.id.startsWith(SpaceAction.ADD_OBJECT),\n actions: ({ node }) => {\n const id = node.id.split('/').at(-1);\n const [spaceId, objectId] = id?.split(':') ?? [];\n const space = client.spaces.get().find((space) => space.id === spaceId);\n const object = objectId && space?.db.getObjectById(objectId);\n const target = objectId ? object : space;\n if (!target) {\n return;\n }\n\n return [\n {\n id: `${TEMPLATE_PLUGIN}/create/${node.id}`,\n data: async () => {\n await dispatch([\n { plugin: TEMPLATE_PLUGIN, action: TemplateAction.CREATE },\n { action: SpaceAction.ADD_OBJECT, data: { target } },\n { action: NavigationAction.OPEN },\n ]);\n },\n properties: {\n label: ['create object label', { ns: TEMPLATE_PLUGIN }],\n icon: 'ph--placeholder--regular',\n testId: 'templatePlugin.createObject',\n },\n },\n ];\n },\n });\n },\n },\n surface: {\n component: ({ data, role }) => {\n switch (role) {\n case 'main': {\n return isObject(data.active) ? <TemplateMain object={data.active} /> : null;\n }\n }\n\n return null;\n },\n },\n intent: {\n resolver: (intent) => {\n switch (intent.action) {\n case TemplateAction.CREATE: {\n // TODO(burdon): Set typename.\n return { data: create({ type: 'template' }) };\n }\n }\n },\n },\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { PublicKey } from '@dxos/react-client';\nimport { type ReactiveEchoObject, getSpace } from '@dxos/react-client/echo';\nimport { Main } from '@dxos/react-ui';\nimport {\n baseSurface,\n topbarBlockPaddingStart,\n fixedInsetFlexLayout,\n bottombarBlockPaddingEnd,\n} from '@dxos/react-ui-theme';\n\nexport const TemplateMain: FC<{ object: ReactiveEchoObject<any> }> = ({ object }) => {\n const space = getSpace(object);\n\n return (\n // TODO(burdon): Boilerplate.\n <Main.Content classNames={[baseSurface, fixedInsetFlexLayout, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>\n <pre className='m-4 p-2 ring'>\n <span>{space?.key.truncate()}</span>/<span>{PublicKey.from(object.id).truncate()}</span>\n </pre>\n </Main.Content>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { TEMPLATE_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [TEMPLATE_PLUGIN]: {\n 'plugin name': 'Template',\n 'object placeholder': 'New object',\n 'create object label': 'Create object',\n 'delete object label': 'Delete', // TODO(burdon): Standard for actions menu.\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type {\n GraphBuilderProvides,\n IntentResolverProvides,\n TranslationsProvides,\n SurfaceProvides,\n MetadataRecordsProvides,\n} from '@dxos/app-framework';\nimport { isEchoObject, type ReactiveEchoObject } from '@dxos/react-client/echo';\n\nimport { TEMPLATE_PLUGIN } from './meta';\n\nconst TEMPLATE_ACTION = `${TEMPLATE_PLUGIN}/action`;\n\nexport enum TemplateAction {\n CREATE = `${TEMPLATE_ACTION}/create`,\n}\n\nexport type TemplatePluginProvides = SurfaceProvides &\n IntentResolverProvides &\n GraphBuilderProvides &\n MetadataRecordsProvides &\n TranslationsProvides;\n\n// TODO(burdon): Warning: Encountered two children with the same key, `dxos.org/plugin/template`.\n// TODO(burdon): Better way to detect?\nexport const isObject = (object: unknown): object is ReactiveEchoObject<any> => {\n return isEchoObject(object) && object.type === 'template';\n};\n"],
5
- "mappings": ";;;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,eAAeC,mBAA0CC,wBAAwB;AAC1F,SAASC,yBAAyB;AAClC,SAA2BC,iBAAiBC,qBAAqB;AACjE,SAASC,mBAAmB;AAC5B,SAASC,cAAc;;;ACNvB,OAAOC,WAAwB;AAE/B,SAASC,iBAAiB;AAC1B,SAAkCC,gBAAgB;AAClD,SAASC,YAAY;AACrB,SACEC,aACAC,yBACAC,sBACAC,gCACK;AAEA,IAAMC,eAAwD,CAAC,EAAEC,OAAM,MAAE;AAC9E,QAAMC,QAAQC,SAASF,MAAAA;AAEvB;;IAEE,sBAAA,cAACG,KAAKC,SAAO;MAACC,YAAY;QAACC;QAAaC;QAAsBC;QAAyBC;;OACrF,sBAAA,cAACC,OAAAA;MAAIC,WAAU;OACb,sBAAA,cAACC,QAAAA,MAAMX,OAAOY,IAAIC,SAAAA,CAAAA,GAAkB,KAAC,sBAAA,cAACF,QAAAA,MAAMG,UAAUC,KAAKhB,OAAOiB,EAAE,EAAEH,SAAQ,CAAA,CAAA,CAAA;;AAItF;;;ACrBA,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACI,eAAAA,GAAkB;QACjB,eAAe;QACf,sBAAsB;QACtB,uBAAuB;QACvB,uBAAuB;MACzB;IACF;EACF;;;;ACLF,SAASC,oBAA6C;AAItD,IAAMC,kBAAkB,GAAGC,eAAAA;;UAEfC,iBAAAA;8CACD,GAAGF,eAAAA,SAAwB,IAAA;GAD1BE,mBAAAA,iBAAAA,CAAAA,EAAAA;AAYL,IAAMC,WAAW,CAACC,WAAAA;AACvB,SAAOC,aAAaD,MAAAA,KAAWA,OAAOE,SAAS;AACjD;;;AHdA,IAAMC,WAAW;AAEV,IAAMC,iBAAiB,MAAA;AAC5B,SAAO;IACLC;IACAC,UAAU;MACRC,UAAU;QACRC,SAAS;UACP,CAACL,QAAAA,GAAW;YACVM,aAAa;cAAC;cAAsB;gBAAEC,IAAIC;cAAgB;;YAC1DC,MAAM;UACR;QACF;MACF;MACAC;MACAC,OAAO;QACLC,SAAS,CAACC,YAAAA;AACR,gBAAMC,SAASC,cAAcF,SAASG,iBAAAA,GAAoBb,SAASW;AACnE,gBAAMG,WAAWF,cAAcF,SAASK,iBAAAA,GAAoBf,SAASgB,OAAOF;AAC5E,cAAI,CAACH,UAAU,CAACG,UAAU;AACxB,mBAAO,CAAA;UACT;AAEA,iBAAOG,gBAAgB;YACrBC,IAAIC,eAAeC;YACnBC,QAAQ,CAACC,SAA8BC,cAAcD,IAAAA,KAASA,KAAKJ,GAAGM,WAAWC,YAAYC,UAAU;YACvGC,SAAS,CAAC,EAAEL,KAAI,MAAE;AAChB,oBAAMJ,KAAKI,KAAKJ,GAAGU,MAAM,GAAA,EAAKC,GAAG,EAAC;AAClC,oBAAM,CAACC,SAASC,QAAAA,IAAYb,IAAIU,MAAM,GAAA,KAAQ,CAAA;AAC9C,oBAAMI,QAAQrB,OAAOsB,OAAOC,IAAG,EAAGC,KAAK,CAACH,WAAUA,OAAMd,OAAOY,OAAAA;AAC/D,oBAAMM,SAASL,YAAYC,OAAOK,GAAGC,cAAcP,QAAAA;AACnD,oBAAMQ,SAASR,WAAWK,SAASJ;AACnC,kBAAI,CAACO,QAAQ;AACX;cACF;AAEA,qBAAO;gBACL;kBACErB,IAAI,GAAGb,eAAAA,WAA0BiB,KAAKJ,EAAE;kBACxCsB,MAAM,YAAA;AACJ,0BAAM1B,SAAS;sBACb;wBAAE2B,QAAQpC;wBAAiBqC,QAAQvB,eAAeC;sBAAO;sBACzD;wBAAEsB,QAAQjB,YAAYC;wBAAYc,MAAM;0BAAED;wBAAO;sBAAE;sBACnD;wBAAEG,QAAQC,iBAAiBC;sBAAK;qBACjC;kBACH;kBACAC,YAAY;oBACVC,OAAO;sBAAC;sBAAuB;wBAAE1C,IAAIC;sBAAgB;;oBACrDC,MAAM;oBACNyC,QAAQ;kBACV;gBACF;;YAEJ;UACF,CAAA;QACF;MACF;MACAC,SAAS;QACPC,WAAW,CAAC,EAAET,MAAMU,KAAI,MAAE;AACxB,kBAAQA,MAAAA;YACN,KAAK,QAAQ;AACX,qBAAOC,SAASX,KAAKY,MAAM,IAAI,gBAAAC,OAAA,cAACC,cAAAA;gBAAalB,QAAQI,KAAKY;mBAAa;YACzE;UACF;AAEA,iBAAO;QACT;MACF;MACApC,QAAQ;QACNuC,UAAU,CAACvC,WAAAA;AACT,kBAAQA,OAAO0B,QAAM;YACnB,KAAKvB,eAAeC,QAAQ;AAE1B,qBAAO;gBAAEoB,MAAMgB,OAAO;kBAAEC,MAAM;gBAAW,CAAA;cAAG;YAC9C;UACF;QACF;MACF;IACF;EACF;AACF;",
6
- "names": ["React", "resolvePlugin", "parseIntentPlugin", "NavigationAction", "parseClientPlugin", "createExtension", "isActionGroup", "SpaceAction", "create", "React", "PublicKey", "getSpace", "Main", "baseSurface", "topbarBlockPaddingStart", "fixedInsetFlexLayout", "bottombarBlockPaddingEnd", "TemplateMain", "object", "space", "getSpace", "Main", "Content", "classNames", "baseSurface", "fixedInsetFlexLayout", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "pre", "className", "span", "key", "truncate", "PublicKey", "from", "id", "TEMPLATE_PLUGIN", "isEchoObject", "TEMPLATE_ACTION", "TEMPLATE_PLUGIN", "TemplateAction", "isObject", "object", "isEchoObject", "type", "typename", "TemplatePlugin", "meta", "provides", "metadata", "records", "placeholder", "ns", "TEMPLATE_PLUGIN", "icon", "translations", "graph", "builder", "plugins", "client", "resolvePlugin", "parseClientPlugin", "dispatch", "parseIntentPlugin", "intent", "createExtension", "id", "TemplateAction", "CREATE", "filter", "node", "isActionGroup", "startsWith", "SpaceAction", "ADD_OBJECT", "actions", "split", "at", "spaceId", "objectId", "space", "spaces", "get", "find", "object", "db", "getObjectById", "target", "data", "plugin", "action", "NavigationAction", "OPEN", "properties", "label", "testId", "surface", "component", "role", "isObject", "active", "React", "TemplateMain", "resolver", "create", "type"]
3
+ "sources": ["../../../src/TemplatePlugin.tsx", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport {\n createIntent,\n Capabilities,\n contributes,\n Events,\n defineModule,\n definePlugin,\n oneOf,\n} from '@dxos/app-framework';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\n\nimport { ReactSurface, IntentResolver } from './capabilities';\nimport { meta, TEMPLATE_PLUGIN } from './meta';\nimport translations from './translations';\nimport { TemplateAction, TemplateType } from './types';\n\nexport const TemplatePlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/metadata`,\n activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),\n activate: () =>\n contributes(Capabilities.Metadata, {\n id: TemplateType.typename,\n metadata: {\n createObject: (props: { name?: string }) => createIntent(TemplateAction.Create, props),\n placeholder: ['object placeholder', { ns: TEMPLATE_PLUGIN }],\n icon: 'ph--asterisk--regular',\n },\n }),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupClient,\n activate: () => contributes(ClientCapabilities.Schema, [TemplateType]),\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.Startup,\n activate: ReactSurface,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntents,\n activate: IntentResolver,\n }),\n ]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { TEMPLATE_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [TEMPLATE_PLUGIN]: {\n 'plugin name': 'Template',\n 'object placeholder': 'New object',\n 'create object label': 'Create object',\n 'delete object label': 'Delete', // TODO(burdon): Standard for actions menu.\n },\n },\n },\n];\n"],
5
+ "mappings": ";;;;;;;;AAIA,SACEA,cACAC,cACAC,aACAC,QACAC,cACAC,cACAC,aACK;AACP,SAASC,oBAAoBC,oBAAoB;;;ACTjD,SAASC,YAAY;AAEd,IAAMC,iBAAiBC,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAMC,eAAeD,KAAK,MAAM,OAAO,8BAAA,CAAA;;;ACD9C,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACE,eAAAA,GAAkB;QACjB,eAAe;QACf,sBAAsB;QACtB,uBAAuB;QACvB,uBAAuB;MACzB;IACF;EACF;;;;AFIK,IAAMC,iBAAiB,MAC5BC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,MAAMC,YAAYC,aAAaC,cAAcC,oBAAAA;EACzD,CAAA;EACAT,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaQ,MAAMP,OAAOQ,SAASR,OAAOS,aAAa;IACvDP,UAAU,MACRC,YAAYC,aAAaM,UAAU;MACjCZ,IAAIa,aAAaC;MACjBC,UAAU;QACRC,cAAc,CAACC,UAA6BC,aAAaC,eAAeC,QAAQH,KAAAA;QAChFI,aAAa;UAAC;UAAsB;YAAEC,IAAIC;UAAgB;;QAC1DC,MAAM;MACR;IACF,CAAA;EACJ,CAAA;EACAzB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAawB,aAAaC;IAC1BtB,UAAU,MAAMC,YAAYsB,mBAAmBC,QAAQ;MAACf;KAAa;EACvE,CAAA;EACAd,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOQ;IACpBN,UAAUyB;EACZ,CAAA;EACA9B,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAO4B;IACpB1B,UAAU2B;EACZ,CAAA;CACD;",
6
+ "names": ["createIntent", "Capabilities", "contributes", "Events", "defineModule", "definePlugin", "oneOf", "ClientCapabilities", "ClientEvents", "lazy", "IntentResolver", "lazy", "ReactSurface", "TEMPLATE_PLUGIN", "TemplatePlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "oneOf", "Startup", "SetupAppGraph", "Metadata", "TemplateType", "typename", "metadata", "createObject", "props", "createIntent", "TemplateAction", "Create", "placeholder", "ns", "TEMPLATE_PLUGIN", "icon", "ClientEvents", "SetupClient", "ClientCapabilities", "Schema", "ReactSurface", "SetupIntents", "IntentResolver"]
7
7
  }
@@ -0,0 +1,19 @@
1
+ import {
2
+ TemplateAction,
3
+ TemplateType
4
+ } from "./chunk-FLZIRPLH.mjs";
5
+
6
+ // packages/plugins/experimental/plugin-template/src/capabilities/intent-resolver.ts
7
+ import { contributes, Capabilities, createResolver } from "@dxos/app-framework";
8
+ import { create } from "@dxos/react-client/echo";
9
+ var intent_resolver_default = () => contributes(Capabilities.IntentResolver, createResolver(TemplateAction.Create, ({ name }) => ({
10
+ data: {
11
+ object: create(TemplateType, {
12
+ name
13
+ })
14
+ }
15
+ })));
16
+ export {
17
+ intent_resolver_default as default
18
+ };
19
+ //# sourceMappingURL=intent-resolver-7UI73TQM.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/intent-resolver.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, Capabilities, createResolver } from '@dxos/app-framework';\nimport { create } from '@dxos/react-client/echo';\n\nimport { TemplateAction, TemplateType } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.IntentResolver,\n createResolver(TemplateAction.Create, ({ name }) => ({\n data: { object: create(TemplateType, { name }) },\n })),\n );\n"],
5
+ "mappings": ";;;;;;AAIA,SAASA,aAAaC,cAAcC,sBAAsB;AAC1D,SAASC,cAAc;AAIvB,IAAA,0BAAe,MACbC,YACEC,aAAaC,gBACbC,eAAeC,eAAeC,QAAQ,CAAC,EAAEC,KAAI,OAAQ;EACnDC,MAAM;IAAEC,QAAQC,OAAOC,cAAc;MAAEJ;IAAK,CAAA;EAAG;AACjD,EAAA,CAAA;",
6
+ "names": ["contributes", "Capabilities", "createResolver", "create", "contributes", "Capabilities", "IntentResolver", "createResolver", "TemplateAction", "Create", "name", "data", "object", "create", "TemplateType"]
7
+ }
@@ -1 +1 @@
1
- {"inputs":{"packages/plugins/experimental/plugin-template/src/components/TemplateMain.tsx":{"bytes":3412,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/components/index.ts":{"bytes":540,"imports":[{"path":"packages/plugins/experimental/plugin-template/src/components/TemplateMain.tsx","kind":"import-statement","original":"./TemplateMain"}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/meta.ts":{"bytes":1340,"imports":[],"format":"esm"},"packages/plugins/experimental/plugin-template/src/translations.ts":{"bytes":1513,"imports":[{"path":"packages/plugins/experimental/plugin-template/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/types.ts":{"bytes":2678,"imports":[{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-template/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/TemplatePlugin.tsx":{"bytes":13797,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-template/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/experimental/plugin-template/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/experimental/plugin-template/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/experimental/plugin-template/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/index.ts":{"bytes":535,"imports":[{"path":"packages/plugins/experimental/plugin-template/src/TemplatePlugin.tsx","kind":"import-statement","original":"./TemplatePlugin"}],"format":"esm"}},"outputs":{"packages/plugins/experimental/plugin-template/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9702},"packages/plugins/experimental/plugin-template/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-template/dist/lib/browser/chunk-CPSXHPOD.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["TemplatePlugin"],"entryPoint":"packages/plugins/experimental/plugin-template/src/index.ts","inputs":{"packages/plugins/experimental/plugin-template/src/TemplatePlugin.tsx":{"bytesInOutput":3442},"packages/plugins/experimental/plugin-template/src/components/TemplateMain.tsx":{"bytesInOutput":876},"packages/plugins/experimental/plugin-template/src/components/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-template/src/translations.ts":{"bytesInOutput":263},"packages/plugins/experimental/plugin-template/src/types.ts":{"bytesInOutput":381},"packages/plugins/experimental/plugin-template/src/index.ts":{"bytesInOutput":0}},"bytes":5461},"packages/plugins/experimental/plugin-template/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-template/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-template/dist/lib/browser/chunk-CPSXHPOD.mjs","kind":"import-statement"}],"exports":["TEMPLATE_PLUGIN","default"],"entryPoint":"packages/plugins/experimental/plugin-template/src/meta.ts","inputs":{},"bytes":165},"packages/plugins/experimental/plugin-template/dist/lib/browser/chunk-CPSXHPOD.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":630},"packages/plugins/experimental/plugin-template/dist/lib/browser/chunk-CPSXHPOD.mjs":{"imports":[],"exports":["TEMPLATE_PLUGIN","meta_default"],"inputs":{"packages/plugins/experimental/plugin-template/src/meta.ts":{"bytesInOutput":247}},"bytes":399}}}
1
+ {"inputs":{"packages/plugins/experimental/plugin-template/src/meta.ts":{"bytes":1377,"imports":[],"format":"esm"},"packages/plugins/experimental/plugin-template/src/types.ts":{"bytes":3904,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-template/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/capabilities/intent-resolver.ts":{"bytes":2022,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-template/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/components/TemplateContainer.tsx":{"bytes":2003,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/components/index.ts":{"bytes":553,"imports":[{"path":"packages/plugins/experimental/plugin-template/src/components/TemplateContainer.tsx","kind":"import-statement","original":"./TemplateContainer"}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/capabilities/react-surface.tsx":{"bytes":2712,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-template/src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"packages/plugins/experimental/plugin-template/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/experimental/plugin-template/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/capabilities/index.ts":{"bytes":1096,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-template/src/capabilities/intent-resolver.ts","kind":"dynamic-import","original":"./intent-resolver"},{"path":"packages/plugins/experimental/plugin-template/src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/translations.ts":{"bytes":1513,"imports":[{"path":"packages/plugins/experimental/plugin-template/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/TemplatePlugin.tsx":{"bytes":6905,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-template/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/experimental/plugin-template/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/experimental/plugin-template/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/experimental/plugin-template/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/experimental/plugin-template/src/index.ts":{"bytes":615,"imports":[{"path":"packages/plugins/experimental/plugin-template/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/experimental/plugin-template/src/TemplatePlugin.tsx","kind":"import-statement","original":"./TemplatePlugin"}],"format":"esm"}},"outputs":{"packages/plugins/experimental/plugin-template/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4300},"packages/plugins/experimental/plugin-template/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-template/dist/lib/browser/chunk-FLZIRPLH.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-template/dist/lib/browser/intent-resolver-7UI73TQM.mjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-template/dist/lib/browser/react-surface-UV46UZND.mjs","kind":"dynamic-import"}],"exports":["TEMPLATE_PLUGIN","TemplatePlugin","meta"],"entryPoint":"packages/plugins/experimental/plugin-template/src/index.ts","inputs":{"packages/plugins/experimental/plugin-template/src/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-template/src/TemplatePlugin.tsx":{"bytesInOutput":1367},"packages/plugins/experimental/plugin-template/src/capabilities/index.ts":{"bytesInOutput":190},"packages/plugins/experimental/plugin-template/src/translations.ts":{"bytesInOutput":263}},"bytes":2303},"packages/plugins/experimental/plugin-template/dist/lib/browser/types.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-template/dist/lib/browser/types.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-template/dist/lib/browser/chunk-FLZIRPLH.mjs","kind":"import-statement"}],"exports":["TemplateAction","TemplateType","isObject"],"entryPoint":"packages/plugins/experimental/plugin-template/src/types.ts","inputs":{},"bytes":177},"packages/plugins/experimental/plugin-template/dist/lib/browser/intent-resolver-7UI73TQM.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":988},"packages/plugins/experimental/plugin-template/dist/lib/browser/intent-resolver-7UI73TQM.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-template/dist/lib/browser/chunk-FLZIRPLH.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-template/src/capabilities/intent-resolver.ts","inputs":{"packages/plugins/experimental/plugin-template/src/capabilities/intent-resolver.ts":{"bytesInOutput":336}},"bytes":598},"packages/plugins/experimental/plugin-template/dist/lib/browser/react-surface-UV46UZND.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2314},"packages/plugins/experimental/plugin-template/dist/lib/browser/react-surface-UV46UZND.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-template/dist/lib/browser/chunk-FLZIRPLH.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-template/src/capabilities/react-surface.tsx","inputs":{"packages/plugins/experimental/plugin-template/src/capabilities/react-surface.tsx":{"bytesInOutput":419},"packages/plugins/experimental/plugin-template/src/components/TemplateContainer.tsx":{"bytesInOutput":431},"packages/plugins/experimental/plugin-template/src/components/index.ts":{"bytesInOutput":0}},"bytes":1276},"packages/plugins/experimental/plugin-template/dist/lib/browser/chunk-FLZIRPLH.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2545},"packages/plugins/experimental/plugin-template/dist/lib/browser/chunk-FLZIRPLH.mjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["TEMPLATE_PLUGIN","TemplateAction","TemplateType","isObject","meta"],"inputs":{"packages/plugins/experimental/plugin-template/src/types.ts":{"bytesInOutput":762},"packages/plugins/experimental/plugin-template/src/meta.ts":{"bytesInOutput":239}},"bytes":1317}}}
@@ -0,0 +1,35 @@
1
+ import {
2
+ TEMPLATE_PLUGIN,
3
+ isObject
4
+ } from "./chunk-FLZIRPLH.mjs";
5
+
6
+ // packages/plugins/experimental/plugin-template/src/capabilities/react-surface.tsx
7
+ import React2 from "react";
8
+ import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
9
+
10
+ // packages/plugins/experimental/plugin-template/src/components/TemplateContainer.tsx
11
+ import React from "react";
12
+ import { fullyQualifiedId } from "@dxos/react-client/echo";
13
+ import { StackItem } from "@dxos/react-ui-stack";
14
+ var TemplateContainer = ({ object }) => {
15
+ return /* @__PURE__ */ React.createElement(StackItem.Content, {
16
+ toolbar: false
17
+ }, /* @__PURE__ */ React.createElement("pre", {
18
+ className: "m-4 p-2 ring"
19
+ }, /* @__PURE__ */ React.createElement("span", null, fullyQualifiedId(object))));
20
+ };
21
+
22
+ // packages/plugins/experimental/plugin-template/src/capabilities/react-surface.tsx
23
+ var react_surface_default = () => contributes(Capabilities.ReactSurface, createSurface({
24
+ id: TEMPLATE_PLUGIN,
25
+ role: "article",
26
+ filter: (data) => isObject(data.subject),
27
+ component: ({ data, role }) => /* @__PURE__ */ React2.createElement(TemplateContainer, {
28
+ role,
29
+ object: data.subject
30
+ })
31
+ }));
32
+ export {
33
+ react_surface_default as default
34
+ };
35
+ //# sourceMappingURL=react-surface-UV46UZND.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/react-surface.tsx", "../../../src/components/TemplateContainer.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { type ReactiveEchoObject } from '@dxos/react-client/echo';\n\nimport { TemplateContainer } from '../components';\nimport { TEMPLATE_PLUGIN } from '../meta';\nimport { isObject } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.ReactSurface,\n createSurface({\n id: TEMPLATE_PLUGIN,\n role: 'article',\n filter: (data): data is { subject: ReactiveEchoObject<any> } => isObject(data.subject),\n component: ({ data, role }) => <TemplateContainer role={role} object={data.subject} />,\n }),\n );\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ReactiveEchoObject, fullyQualifiedId } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nexport const TemplateContainer = ({ object }: { object: ReactiveEchoObject<any>; role: string }) => {\n return (\n <StackItem.Content toolbar={false}>\n <pre className='m-4 p-2 ring'>\n <span>{fullyQualifiedId(object)}</span>\n </pre>\n </StackItem.Content>\n );\n};\n"],
5
+ "mappings": ";;;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;;;ACFzD,OAAOC,WAAW;AAElB,SAAkCC,wBAAwB;AAC1D,SAASC,iBAAiB;AAEnB,IAAMC,oBAAoB,CAAC,EAAEC,OAAM,MAAqD;AAC7F,SACE,sBAAA,cAACC,UAAUC,SAAO;IAACC,SAAS;KAC1B,sBAAA,cAACC,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACC,QAAAA,MAAMC,iBAAiBP,MAAAA,CAAAA,CAAAA,CAAAA;AAIhC;;;ADJA,IAAA,wBAAe,MACbQ,YACEC,aAAaC,cACbC,cAAc;EACZC,IAAIC;EACJC,MAAM;EACNC,QAAQ,CAACC,SAAuDC,SAASD,KAAKE,OAAO;EACrFC,WAAW,CAAC,EAAEH,MAAMF,KAAI,MAAO,gBAAAM,OAAA,cAACC,mBAAAA;IAAkBP;IAAYQ,QAAQN,KAAKE;;AAC7E,CAAA,CAAA;",
6
+ "names": ["React", "Capabilities", "contributes", "createSurface", "React", "fullyQualifiedId", "StackItem", "TemplateContainer", "object", "StackItem", "Content", "toolbar", "pre", "className", "span", "fullyQualifiedId", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "TEMPLATE_PLUGIN", "role", "filter", "data", "isObject", "subject", "component", "React", "TemplateContainer", "object"]
7
+ }
@@ -0,0 +1,11 @@
1
+ import {
2
+ TemplateAction,
3
+ TemplateType,
4
+ isObject
5
+ } from "./chunk-FLZIRPLH.mjs";
6
+ export {
7
+ TemplateAction,
8
+ TemplateType,
9
+ isObject
10
+ };
11
+ //# sourceMappingURL=types.mjs.map
@@ -1,4 +1,2 @@
1
- import { type PluginDefinition } from '@dxos/app-framework';
2
- import { type TemplatePluginProvides } from './types';
3
- export declare const TemplatePlugin: () => PluginDefinition<TemplatePluginProvides>;
1
+ export declare const TemplatePlugin: () => import("@dxos/app-framework").Plugin;
4
2
  //# sourceMappingURL=TemplatePlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TemplatePlugin.d.ts","sourceRoot":"","sources":["../../../src/TemplatePlugin.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAoC,KAAK,gBAAgB,EAAoB,MAAM,qBAAqB,CAAC;AAShH,OAAO,EAAkB,KAAK,sBAAsB,EAAY,MAAM,SAAS,CAAC;AAIhF,eAAO,MAAM,cAAc,QAAO,gBAAgB,CAAC,sBAAsB,CA8ExE,CAAC"}
1
+ {"version":3,"file":"TemplatePlugin.d.ts","sourceRoot":"","sources":["../../../src/TemplatePlugin.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,cAAc,4CAmCvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const IntentResolver: (props?: unknown) => Promise<import("@dxos/app-framework").Capability<import("@dxos/app-framework").Capabilities.IntentResolver>>;
2
+ export declare const ReactSurface: (props?: unknown) => Promise<import("@dxos/app-framework").Capability<import("@dxos/app-framework").Capabilities.ReactSurface>>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,mIAA0C,CAAC;AACtE,eAAO,MAAM,YAAY,iIAAwC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Capabilities } from '@dxos/app-framework';
2
+ declare const _default: () => import("@dxos/app-framework").Capability<Capabilities.IntentResolver>;
3
+ export default _default;
4
+ //# sourceMappingURL=intent-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,YAAY,EAAkB,MAAM,qBAAqB,CAAC;;AAKhF,wBAMI"}
@@ -0,0 +1,4 @@
1
+ import { Capabilities } from '@dxos/app-framework';
2
+ declare const _default: () => import("@dxos/app-framework").Capability<Capabilities.ReactSurface>;
3
+ export default _default;
4
+ //# sourceMappingURL=react-surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-surface.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAA8B,MAAM,qBAAqB,CAAC;;AAO/E,wBASI"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { type ReactiveEchoObject } from '@dxos/react-client/echo';
3
+ export declare const TemplateContainer: ({ object }: {
4
+ object: ReactiveEchoObject<any>;
5
+ role: string;
6
+ }) => React.JSX.Element;
7
+ //# sourceMappingURL=TemplateContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/TemplateContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,yBAAyB,CAAC;AAGpF,eAAO,MAAM,iBAAiB,eAAgB;IAAE,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,sBAQ9F,CAAC"}
@@ -1,2 +1,2 @@
1
- export * from './TemplateMain';
1
+ export * from './TemplateContainer';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAC"}
@@ -1,2 +1,3 @@
1
+ export * from './meta';
1
2
  export * from './TemplatePlugin';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC"}
@@ -1,9 +1,8 @@
1
1
  export declare const TEMPLATE_PLUGIN = "dxos.org/plugin/template";
2
- declare const _default: {
2
+ export declare const meta: {
3
3
  id: string;
4
4
  name: string;
5
5
  icon: string;
6
6
  source: string;
7
7
  };
8
- export default _default;
9
8
  //# sourceMappingURL=meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe,6BAA6B,CAAC;;;;;;;AAE1D,wBAKuB"}
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAE1D,eAAO,MAAM,IAAI;;;;;CAKK,CAAC"}
@@ -1,8 +1,27 @@
1
- import type { GraphBuilderProvides, IntentResolverProvides, TranslationsProvides, SurfaceProvides, MetadataRecordsProvides } from '@dxos/app-framework';
1
+ import { S } from '@dxos/echo-schema';
2
2
  import { type ReactiveEchoObject } from '@dxos/react-client/echo';
3
- export declare enum TemplateAction {
4
- CREATE = "dxos.org/plugin/template/action/create"
3
+ export declare namespace TemplateAction {
4
+ const Create_base: S.TaggedClass<Create, "dxos.org/plugin/template/action/create", {
5
+ readonly _tag: S.tag<"dxos.org/plugin/template/action/create">;
6
+ } & {
7
+ input: S.Struct<{
8
+ name: S.optional<typeof S.String>;
9
+ }>;
10
+ output: S.Struct<{
11
+ object: S.Schema<import("@dxos/react-client/echo").ReactiveObject<any>, import("@dxos/react-client/echo").ReactiveObject<any>, never>;
12
+ }>;
13
+ }>;
14
+ export class Create extends Create_base {
15
+ }
16
+ export {};
5
17
  }
6
- export type TemplatePluginProvides = SurfaceProvides & IntentResolverProvides & GraphBuilderProvides & MetadataRecordsProvides & TranslationsProvides;
7
18
  export declare const isObject: (object: unknown) => object is ReactiveEchoObject<any>;
19
+ declare const TemplateType_base: import("@dxos/echo-schema").TypedObjectPrototype<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
20
+ name: S.optional<typeof S.String>;
21
+ }, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>, S.Struct.Encoded<{
22
+ name: S.optional<typeof S.String>;
23
+ }>>;
24
+ export declare class TemplateType extends TemplateType_base {
25
+ }
26
+ export {};
8
27
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAMhF,oBAAY,cAAc;IACxB,MAAM,2CAA8B;CACrC;AAED,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAClD,sBAAsB,GACtB,oBAAoB,GACpB,uBAAuB,GACvB,oBAAoB,CAAC;AAIvB,eAAO,MAAM,QAAQ,WAAY,OAAO,KAAG,MAAM,IAAI,kBAAkB,CAAC,GAAG,CAE1E,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAItG,yBAAiB,cAAc,CAAC;;;;;;;;;;;IAG9B,MAAM,OAAO,MAAO,SAAQ,WAO1B;KAAG;;CACN;AAID,eAAO,MAAM,QAAQ,WAAY,OAAO,KAAG,MAAM,IAAI,kBAAkB,CAAC,GAAG,CAE1E,CAAC;;;;;;AAEF,qBAAa,YAAa,SAAQ,iBAEhC;CAAG"}
@@ -0,0 +1 @@
1
+ {"version":"5.7.2"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-template",
3
- "version": "0.7.4-staging.f7e8224",
3
+ "version": "0.7.5-feature-compute.4d9d99a",
4
4
  "description": "Template for new plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -12,16 +12,16 @@
12
12
  "types": "./dist/types/src/index.d.ts",
13
13
  "browser": "./dist/lib/browser/index.mjs"
14
14
  },
15
- "./meta": {
16
- "types": "./dist/types/src/meta.d.ts",
17
- "browser": "./dist/lib/browser/meta.mjs"
15
+ "./types": {
16
+ "types": "./dist/types/src/types.d.ts",
17
+ "browser": "./dist/lib/browser/types.mjs"
18
18
  }
19
19
  },
20
20
  "types": "dist/types/src/index.d.ts",
21
21
  "typesVersions": {
22
22
  "*": {
23
- "meta": [
24
- "dist/types/src/meta.d.ts"
23
+ "types": [
24
+ "dist/types/src/types.d.ts"
25
25
  ]
26
26
  }
27
27
  },
@@ -31,12 +31,14 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@preact/signals-core": "^1.6.0",
34
- "@dxos/app-framework": "0.7.4-staging.f7e8224",
35
- "@dxos/async": "0.7.4-staging.f7e8224",
36
- "@dxos/plugin-graph": "0.7.4-staging.f7e8224",
37
- "@dxos/react-client": "0.7.4-staging.f7e8224",
38
- "@dxos/plugin-client": "0.7.4-staging.f7e8224",
39
- "@dxos/plugin-space": "0.7.4-staging.f7e8224"
34
+ "@dxos/app-framework": "0.7.5-feature-compute.4d9d99a",
35
+ "@dxos/plugin-client": "0.7.5-feature-compute.4d9d99a",
36
+ "@dxos/echo-schema": "0.7.5-feature-compute.4d9d99a",
37
+ "@dxos/async": "0.7.5-feature-compute.4d9d99a",
38
+ "@dxos/plugin-graph": "0.7.5-feature-compute.4d9d99a",
39
+ "@dxos/react-client": "0.7.5-feature-compute.4d9d99a",
40
+ "@dxos/react-ui-stack": "0.7.5-feature-compute.4d9d99a",
41
+ "@dxos/plugin-space": "0.7.5-feature-compute.4d9d99a"
40
42
  },
41
43
  "devDependencies": {
42
44
  "@phosphor-icons/react": "^2.1.5",
@@ -45,16 +47,16 @@
45
47
  "react": "~18.2.0",
46
48
  "react-dom": "~18.2.0",
47
49
  "vite": "5.4.7",
48
- "@dxos/react-ui": "0.7.4-staging.f7e8224",
49
- "@dxos/react-ui-theme": "0.7.4-staging.f7e8224",
50
- "@dxos/storybook-utils": "0.7.4-staging.f7e8224"
50
+ "@dxos/react-ui": "0.7.5-feature-compute.4d9d99a",
51
+ "@dxos/react-ui-theme": "0.7.5-feature-compute.4d9d99a",
52
+ "@dxos/storybook-utils": "0.7.5-feature-compute.4d9d99a"
51
53
  },
52
54
  "peerDependencies": {
53
55
  "@phosphor-icons/react": "^2.1.5",
54
56
  "react": "~18.2.0",
55
57
  "react-dom": "~18.2.0",
56
- "@dxos/react-ui-theme": "0.7.4-staging.f7e8224",
57
- "@dxos/react-ui": "0.7.4-staging.f7e8224"
58
+ "@dxos/react-ui": "0.7.5-feature-compute.4d9d99a",
59
+ "@dxos/react-ui-theme": "0.7.5-feature-compute.4d9d99a"
58
60
  },
59
61
  "publishConfig": {
60
62
  "access": "public"
@@ -2,97 +2,55 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
6
-
7
- import { resolvePlugin, parseIntentPlugin, type PluginDefinition, NavigationAction } from '@dxos/app-framework';
8
- import { parseClientPlugin } from '@dxos/plugin-client';
9
- import { type ActionGroup, createExtension, isActionGroup } from '@dxos/plugin-graph';
10
- import { SpaceAction } from '@dxos/plugin-space';
11
- import { create } from '@dxos/react-client/echo';
12
-
13
- import { TemplateMain } from './components';
14
- import meta, { TEMPLATE_PLUGIN } from './meta';
5
+ import {
6
+ createIntent,
7
+ Capabilities,
8
+ contributes,
9
+ Events,
10
+ defineModule,
11
+ definePlugin,
12
+ oneOf,
13
+ } from '@dxos/app-framework';
14
+ import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
15
+
16
+ import { ReactSurface, IntentResolver } from './capabilities';
17
+ import { meta, TEMPLATE_PLUGIN } from './meta';
15
18
  import translations from './translations';
16
- import { TemplateAction, type TemplatePluginProvides, isObject } from './types';
17
-
18
- const typename = 'template'; // Type.schema.typename
19
-
20
- export const TemplatePlugin = (): PluginDefinition<TemplatePluginProvides> => {
21
- return {
22
- meta,
23
- provides: {
24
- metadata: {
25
- records: {
26
- [typename]: {
19
+ import { TemplateAction, TemplateType } from './types';
20
+
21
+ export const TemplatePlugin = () =>
22
+ definePlugin(meta, [
23
+ defineModule({
24
+ id: `${meta.id}/module/translations`,
25
+ activatesOn: Events.SetupTranslations,
26
+ activate: () => contributes(Capabilities.Translations, translations),
27
+ }),
28
+ defineModule({
29
+ id: `${meta.id}/module/metadata`,
30
+ activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),
31
+ activate: () =>
32
+ contributes(Capabilities.Metadata, {
33
+ id: TemplateType.typename,
34
+ metadata: {
35
+ createObject: (props: { name?: string }) => createIntent(TemplateAction.Create, props),
27
36
  placeholder: ['object placeholder', { ns: TEMPLATE_PLUGIN }],
28
37
  icon: 'ph--asterisk--regular',
29
38
  },
30
- },
31
- },
32
- translations,
33
- graph: {
34
- builder: (plugins) => {
35
- const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
36
- const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;
37
- if (!client || !dispatch) {
38
- return [];
39
- }
40
-
41
- return createExtension({
42
- id: TemplateAction.CREATE,
43
- filter: (node): node is ActionGroup => isActionGroup(node) && node.id.startsWith(SpaceAction.ADD_OBJECT),
44
- actions: ({ node }) => {
45
- const id = node.id.split('/').at(-1);
46
- const [spaceId, objectId] = id?.split(':') ?? [];
47
- const space = client.spaces.get().find((space) => space.id === spaceId);
48
- const object = objectId && space?.db.getObjectById(objectId);
49
- const target = objectId ? object : space;
50
- if (!target) {
51
- return;
52
- }
53
-
54
- return [
55
- {
56
- id: `${TEMPLATE_PLUGIN}/create/${node.id}`,
57
- data: async () => {
58
- await dispatch([
59
- { plugin: TEMPLATE_PLUGIN, action: TemplateAction.CREATE },
60
- { action: SpaceAction.ADD_OBJECT, data: { target } },
61
- { action: NavigationAction.OPEN },
62
- ]);
63
- },
64
- properties: {
65
- label: ['create object label', { ns: TEMPLATE_PLUGIN }],
66
- icon: 'ph--placeholder--regular',
67
- testId: 'templatePlugin.createObject',
68
- },
69
- },
70
- ];
71
- },
72
- });
73
- },
74
- },
75
- surface: {
76
- component: ({ data, role }) => {
77
- switch (role) {
78
- case 'main': {
79
- return isObject(data.active) ? <TemplateMain object={data.active} /> : null;
80
- }
81
- }
82
-
83
- return null;
84
- },
85
- },
86
- intent: {
87
- resolver: (intent) => {
88
- switch (intent.action) {
89
- case TemplateAction.CREATE: {
90
- // TODO(burdon): Set typename.
91
- return { data: create({ type: 'template' }) };
92
- }
93
- }
94
- },
95
- },
96
- },
97
- };
98
- };
39
+ }),
40
+ }),
41
+ defineModule({
42
+ id: `${meta.id}/module/schema`,
43
+ activatesOn: ClientEvents.SetupClient,
44
+ activate: () => contributes(ClientCapabilities.Schema, [TemplateType]),
45
+ }),
46
+ defineModule({
47
+ id: `${meta.id}/module/react-surface`,
48
+ activatesOn: Events.Startup,
49
+ activate: ReactSurface,
50
+ }),
51
+ defineModule({
52
+ id: `${meta.id}/module/intent-resolver`,
53
+ activatesOn: Events.SetupIntents,
54
+ activate: IntentResolver,
55
+ }),
56
+ ]);
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { lazy } from '@dxos/app-framework';
6
+
7
+ export const IntentResolver = lazy(() => import('./intent-resolver'));
8
+ export const ReactSurface = lazy(() => import('./react-surface'));
@@ -0,0 +1,16 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { contributes, Capabilities, createResolver } from '@dxos/app-framework';
6
+ import { create } from '@dxos/react-client/echo';
7
+
8
+ import { TemplateAction, TemplateType } from '../types';
9
+
10
+ export default () =>
11
+ contributes(
12
+ Capabilities.IntentResolver,
13
+ createResolver(TemplateAction.Create, ({ name }) => ({
14
+ data: { object: create(TemplateType, { name }) },
15
+ })),
16
+ );
@@ -0,0 +1,23 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
8
+ import { type ReactiveEchoObject } from '@dxos/react-client/echo';
9
+
10
+ import { TemplateContainer } from '../components';
11
+ import { TEMPLATE_PLUGIN } from '../meta';
12
+ import { isObject } from '../types';
13
+
14
+ export default () =>
15
+ contributes(
16
+ Capabilities.ReactSurface,
17
+ createSurface({
18
+ id: TEMPLATE_PLUGIN,
19
+ role: 'article',
20
+ filter: (data): data is { subject: ReactiveEchoObject<any> } => isObject(data.subject),
21
+ component: ({ data, role }) => <TemplateContainer role={role} object={data.subject} />,
22
+ }),
23
+ );
@@ -0,0 +1,18 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { type ReactiveEchoObject, fullyQualifiedId } from '@dxos/react-client/echo';
8
+ import { StackItem } from '@dxos/react-ui-stack';
9
+
10
+ export const TemplateContainer = ({ object }: { object: ReactiveEchoObject<any>; role: string }) => {
11
+ return (
12
+ <StackItem.Content toolbar={false}>
13
+ <pre className='m-4 p-2 ring'>
14
+ <span>{fullyQualifiedId(object)}</span>
15
+ </pre>
16
+ </StackItem.Content>
17
+ );
18
+ };
@@ -2,4 +2,4 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './TemplateMain';
5
+ export * from './TemplateContainer';
package/src/index.ts CHANGED
@@ -2,4 +2,5 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ export * from './meta';
5
6
  export * from './TemplatePlugin';
package/src/meta.ts CHANGED
@@ -6,7 +6,7 @@ import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
7
  export const TEMPLATE_PLUGIN = 'dxos.org/plugin/template';
8
8
 
9
- export default {
9
+ export const meta = {
10
10
  id: TEMPLATE_PLUGIN,
11
11
  name: 'Template',
12
12
  icon: 'ph--asterisk--regular',
package/src/types.ts CHANGED
@@ -2,31 +2,30 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import type {
6
- GraphBuilderProvides,
7
- IntentResolverProvides,
8
- TranslationsProvides,
9
- SurfaceProvides,
10
- MetadataRecordsProvides,
11
- } from '@dxos/app-framework';
12
- import { isEchoObject, type ReactiveEchoObject } from '@dxos/react-client/echo';
5
+ import { S, TypedObject } from '@dxos/echo-schema';
6
+ import { isEchoObject, ReactiveObjectSchema, type ReactiveEchoObject } from '@dxos/react-client/echo';
13
7
 
14
8
  import { TEMPLATE_PLUGIN } from './meta';
15
9
 
16
- const TEMPLATE_ACTION = `${TEMPLATE_PLUGIN}/action`;
10
+ export namespace TemplateAction {
11
+ const TEMPLATE_ACTION = `${TEMPLATE_PLUGIN}/action`;
17
12
 
18
- export enum TemplateAction {
19
- CREATE = `${TEMPLATE_ACTION}/create`,
13
+ export class Create extends S.TaggedClass<Create>()(`${TEMPLATE_ACTION}/create`, {
14
+ input: S.Struct({
15
+ name: S.optional(S.String),
16
+ }),
17
+ output: S.Struct({
18
+ object: ReactiveObjectSchema,
19
+ }),
20
+ }) {}
20
21
  }
21
22
 
22
- export type TemplatePluginProvides = SurfaceProvides &
23
- IntentResolverProvides &
24
- GraphBuilderProvides &
25
- MetadataRecordsProvides &
26
- TranslationsProvides;
27
-
28
23
  // TODO(burdon): Warning: Encountered two children with the same key, `dxos.org/plugin/template`.
29
24
  // TODO(burdon): Better way to detect?
30
25
  export const isObject = (object: unknown): object is ReactiveEchoObject<any> => {
31
26
  return isEchoObject(object) && object.type === 'template';
32
27
  };
28
+
29
+ export class TemplateType extends TypedObject({ typename: 'dxos.org/type/Template', version: '0.1.0' })({
30
+ name: S.optional(S.String),
31
+ }) {}
@@ -1,14 +0,0 @@
1
- // packages/plugins/experimental/plugin-template/src/meta.ts
2
- var TEMPLATE_PLUGIN = "dxos.org/plugin/template";
3
- var meta_default = {
4
- id: TEMPLATE_PLUGIN,
5
- name: "Template",
6
- icon: "ph--asterisk--regular",
7
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-template"
8
- };
9
-
10
- export {
11
- TEMPLATE_PLUGIN,
12
- meta_default
13
- };
14
- //# sourceMappingURL=chunk-CPSXHPOD.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\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 default {\n id: TEMPLATE_PLUGIN,\n name: 'Template',\n icon: 'ph--asterisk--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-template',\n} satisfies PluginMeta;\n"],
5
- "mappings": ";AAMO,IAAMA,kBAAkB;AAE/B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;EACNC,MAAM;EACNC,QAAQ;AACV;",
6
- "names": ["TEMPLATE_PLUGIN", "id", "name", "icon", "source"]
7
- }
@@ -1,9 +0,0 @@
1
- import {
2
- TEMPLATE_PLUGIN,
3
- meta_default
4
- } from "./chunk-CPSXHPOD.mjs";
5
- export {
6
- TEMPLATE_PLUGIN,
7
- meta_default as default
8
- };
9
- //# sourceMappingURL=meta.mjs.map
@@ -1,6 +0,0 @@
1
- import { type FC } from 'react';
2
- import { type ReactiveEchoObject } from '@dxos/react-client/echo';
3
- export declare const TemplateMain: FC<{
4
- object: ReactiveEchoObject<any>;
5
- }>;
6
- //# sourceMappingURL=TemplateMain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TemplateMain.d.ts","sourceRoot":"","sources":["../../../../src/components/TemplateMain.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAE,KAAK,kBAAkB,EAAY,MAAM,yBAAyB,CAAC;AAS5E,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC;IAAE,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAA;CAAE,CAWhE,CAAC"}
@@ -1,28 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import React, { type FC } from 'react';
6
-
7
- import { PublicKey } from '@dxos/react-client';
8
- import { type ReactiveEchoObject, getSpace } from '@dxos/react-client/echo';
9
- import { Main } from '@dxos/react-ui';
10
- import {
11
- baseSurface,
12
- topbarBlockPaddingStart,
13
- fixedInsetFlexLayout,
14
- bottombarBlockPaddingEnd,
15
- } from '@dxos/react-ui-theme';
16
-
17
- export const TemplateMain: FC<{ object: ReactiveEchoObject<any> }> = ({ object }) => {
18
- const space = getSpace(object);
19
-
20
- return (
21
- // TODO(burdon): Boilerplate.
22
- <Main.Content classNames={[baseSurface, fixedInsetFlexLayout, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>
23
- <pre className='m-4 p-2 ring'>
24
- <span>{space?.key.truncate()}</span>/<span>{PublicKey.from(object.id).truncate()}</span>
25
- </pre>
26
- </Main.Content>
27
- );
28
- };