@dxos/plugin-presenter 0.7.4 → 0.7.5-labs.a279d8c

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 (81) hide show
  1. package/dist/lib/browser/{MarkdownSlide-4FZ3XIH5.mjs → MarkdownSlide-5NYXG5SC.mjs} +2 -2
  2. package/dist/lib/browser/MarkdownSlide-5NYXG5SC.mjs.map +7 -0
  3. package/dist/lib/browser/{PresenterMain-FUIXINMC.mjs → PresenterMain-2RSALOUX.mjs} +14 -32
  4. package/dist/lib/browser/PresenterMain-2RSALOUX.mjs.map +7 -0
  5. package/dist/lib/browser/{RevealMain-YOFOFZJE.mjs → RevealMain-SWCWANYN.mjs} +13 -28
  6. package/dist/lib/browser/RevealMain-SWCWANYN.mjs.map +7 -0
  7. package/dist/lib/browser/app-graph-builder-6U7WTJKG.mjs +54 -0
  8. package/dist/lib/browser/app-graph-builder-6U7WTJKG.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-MSAMS5TA.mjs +16 -0
  10. package/dist/lib/browser/chunk-MSAMS5TA.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-P2BIPL4V.mjs +31 -0
  12. package/dist/lib/browser/chunk-P2BIPL4V.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-67PDV7KN.mjs → chunk-Q5U3VOZB.mjs} +3 -3
  14. package/dist/lib/browser/chunk-Q5U3VOZB.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-SFMK6EE3.mjs +39 -0
  16. package/dist/lib/browser/chunk-SFMK6EE3.mjs.map +7 -0
  17. package/dist/lib/browser/index.mjs +60 -188
  18. package/dist/lib/browser/index.mjs.map +4 -4
  19. package/dist/lib/browser/intent-resolver-CAYS4SCJ.mjs +46 -0
  20. package/dist/lib/browser/intent-resolver-CAYS4SCJ.mjs.map +7 -0
  21. package/dist/lib/browser/meta.json +1 -1
  22. package/dist/lib/browser/react-context-A3AXJRTF.mjs +30 -0
  23. package/dist/lib/browser/react-context-A3AXJRTF.mjs.map +7 -0
  24. package/dist/lib/browser/react-surface-U7AXT65E.mjs +58 -0
  25. package/dist/lib/browser/react-surface-U7AXT65E.mjs.map +7 -0
  26. package/dist/lib/browser/settings-L73ZKGLV.mjs +22 -0
  27. package/dist/lib/browser/settings-L73ZKGLV.mjs.map +7 -0
  28. package/dist/lib/browser/state-IGJRHRIA.mjs +18 -0
  29. package/dist/lib/browser/state-IGJRHRIA.mjs.map +7 -0
  30. package/dist/types/src/PresenterPlugin.d.ts +1 -3
  31. package/dist/types/src/PresenterPlugin.d.ts.map +1 -1
  32. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  33. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/capabilities.d.ts +8 -0
  35. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/index.d.ts +188 -0
  37. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  39. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  40. package/dist/types/src/capabilities/react-context.d.ts +8 -0
  41. package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
  42. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  43. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  44. package/dist/types/src/capabilities/settings.d.ts +4 -0
  45. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  46. package/dist/types/src/capabilities/state.d.ts +4 -0
  47. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  48. package/dist/types/src/components/PresenterMain.d.ts.map +1 -1
  49. package/dist/types/src/components/RevealMain.d.ts.map +1 -1
  50. package/dist/types/src/components/index.d.ts +1 -1
  51. package/dist/types/src/index.d.ts +2 -2
  52. package/dist/types/src/index.d.ts.map +1 -1
  53. package/dist/types/src/meta.d.ts +1 -2
  54. package/dist/types/src/meta.d.ts.map +1 -1
  55. package/dist/types/src/types.d.ts +21 -6
  56. package/dist/types/src/types.d.ts.map +1 -1
  57. package/dist/types/tsconfig.tsbuildinfo +1 -0
  58. package/package.json +21 -29
  59. package/src/PresenterPlugin.tsx +47 -146
  60. package/src/capabilities/app-graph-builder.ts +51 -0
  61. package/src/capabilities/capabilities.ts +13 -0
  62. package/src/capabilities/index.ts +14 -0
  63. package/src/capabilities/intent-resolver.ts +42 -0
  64. package/src/capabilities/react-context.tsx +31 -0
  65. package/src/capabilities/react-surface.tsx +48 -0
  66. package/src/capabilities/settings.ts +19 -0
  67. package/src/capabilities/state.ts +17 -0
  68. package/src/components/MarkdownSlide.tsx +1 -1
  69. package/src/components/PresenterMain.tsx +7 -29
  70. package/src/components/RevealMain.tsx +7 -18
  71. package/src/index.ts +2 -4
  72. package/src/meta.ts +1 -1
  73. package/src/types.ts +24 -17
  74. package/dist/lib/browser/MarkdownSlide-4FZ3XIH5.mjs.map +0 -7
  75. package/dist/lib/browser/PresenterMain-FUIXINMC.mjs.map +0 -7
  76. package/dist/lib/browser/RevealMain-YOFOFZJE.mjs.map +0 -7
  77. package/dist/lib/browser/chunk-67PDV7KN.mjs.map +0 -7
  78. package/dist/lib/browser/chunk-RXCQGKK4.mjs +0 -20
  79. package/dist/lib/browser/chunk-RXCQGKK4.mjs.map +0 -7
  80. package/dist/lib/browser/meta.mjs +0 -9
  81. package/dist/lib/browser/meta.mjs.map +0 -7
@@ -1,5 +1,5 @@
1
- import { PresenterPlugin } from './PresenterPlugin';
2
- export default PresenterPlugin;
1
+ export { PresenterCapabilities } from './capabilities';
3
2
  export * from './components';
3
+ export * from './meta';
4
4
  export * from './PresenterPlugin';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAe,eAAe,CAAC;AAE/B,cAAc,cAAc,CAAC;AAE7B,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,cAAc,cAAc,CAAC;AAE7B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC"}
@@ -1,10 +1,9 @@
1
1
  export declare const PRESENTER_PLUGIN = "dxos.org/plugin/presenter";
2
- declare const _default: {
2
+ export declare const meta: {
3
3
  id: string;
4
4
  name: string;
5
5
  description: string;
6
6
  icon: string;
7
7
  source: string;
8
8
  };
9
- export default _default;
10
9
  //# sourceMappingURL=meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;;;;;;;;AAE5D,wBAMuB"}
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAE5D,eAAO,MAAM,IAAI;;;;;;CAMK,CAAC"}
@@ -1,14 +1,29 @@
1
1
  import { type Context } from 'react';
2
- import type { GraphBuilderProvides, IntentResolverProvides, SettingsProvides, SurfaceProvides, TranslationsProvides } from '@dxos/app-framework';
2
+ import { S } from '@dxos/echo-schema';
3
+ import { DocumentType } from '@dxos/plugin-markdown/types';
4
+ import { CollectionType } from '@dxos/plugin-space/types';
5
+ export declare namespace PresenterAction {
6
+ const TogglePresentation_base: S.TaggedClass<TogglePresentation, "dxos.org/plugin/presenter/action/toggle-presentation", {
7
+ readonly _tag: S.tag<"dxos.org/plugin/presenter/action/toggle-presentation">;
8
+ } & {
9
+ input: S.Struct<{
10
+ object: S.Union<[typeof DocumentType, typeof CollectionType]>;
11
+ state: S.optional<typeof S.Boolean>;
12
+ }>;
13
+ output: typeof S.Void;
14
+ }>;
15
+ export class TogglePresentation extends TogglePresentation_base {
16
+ }
17
+ export {};
18
+ }
3
19
  export type PresenterContextType = {
4
20
  running: boolean;
5
21
  start: () => void;
6
22
  stop: () => void;
7
23
  };
8
24
  export declare const PresenterContext: Context<PresenterContextType>;
9
- export type PresenterSettingsProps = {
10
- presentCollections?: boolean;
11
- };
12
- export type PresenterPluginProvides = SurfaceProvides & IntentResolverProvides & GraphBuilderProvides & TranslationsProvides & SettingsProvides<PresenterSettingsProps>;
13
- export declare const TOGGLE_PRESENTATION = "dxos.org/plugin/presenter/toggle-presentation";
25
+ export declare const PresenterSettingsSchema: S.mutable<S.Struct<{
26
+ presentCollections: S.optional<typeof S.Boolean>;
27
+ }>>;
28
+ export type PresenterSettingsProps = S.Schema.Type<typeof PresenterSettingsSchema>;
14
29
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,OAAO,CAAC;AAEpD,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAI7B,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC,oBAAoB,CAIzD,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG;IACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,eAAe,GACnD,sBAAsB,GACtB,oBAAoB,GACpB,oBAAoB,GACpB,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;AAE3C,eAAO,MAAM,mBAAmB,kDAA4C,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI1D,yBAAiB,eAAe,CAAC;;;;;;;;;;IAG/B,MAAM,OAAO,kBAAmB,SAAQ,uBASvC;KAAG;;CACL;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC,oBAAoB,CAIzD,CAAC;AAEH,eAAO,MAAM,uBAAuB;;GAInC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":"5.7.2"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-presenter",
3
- "version": "0.7.4",
3
+ "version": "0.7.5-labs.a279d8c",
4
4
  "description": "Braneframe presenter plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -11,19 +11,11 @@
11
11
  ".": {
12
12
  "types": "./dist/types/src/index.d.ts",
13
13
  "browser": "./dist/lib/browser/index.mjs"
14
- },
15
- "./meta": {
16
- "types": "./dist/types/src/meta.d.ts",
17
- "browser": "./dist/lib/browser/meta.mjs"
18
14
  }
19
15
  },
20
16
  "types": "dist/types/src/index.d.ts",
21
17
  "typesVersions": {
22
- "*": {
23
- "meta": [
24
- "dist/types/src/meta.d.ts"
25
- ]
26
- }
18
+ "*": {}
27
19
  },
28
20
  "files": [
29
21
  "dist",
@@ -41,19 +33,19 @@
41
33
  "remark-frontmatter": "^5.0.0",
42
34
  "remark-parse-frontmatter": "^1.0.3",
43
35
  "reveal.js": "^5.1.0",
44
- "@dxos/async": "0.7.4",
45
- "@dxos/app-framework": "0.7.4",
46
- "@dxos/live-object": "0.7.4",
47
- "@dxos/echo-schema": "0.7.4",
48
- "@dxos/local-storage": "0.7.4",
49
- "@dxos/plugin-client": "0.7.4",
50
- "@dxos/log": "0.7.4",
51
- "@dxos/plugin-markdown": "0.7.4",
52
- "@dxos/plugin-space": "0.7.4",
53
- "@dxos/plugin-graph": "0.7.4",
54
- "@dxos/plugin-stack": "0.7.4",
55
- "@dxos/react-client": "0.7.4",
56
- "@dxos/react-ui-form": "0.7.4"
36
+ "@dxos/app-framework": "0.7.5-labs.a279d8c",
37
+ "@dxos/async": "0.7.5-labs.a279d8c",
38
+ "@dxos/local-storage": "0.7.5-labs.a279d8c",
39
+ "@dxos/live-object": "0.7.5-labs.a279d8c",
40
+ "@dxos/plugin-client": "0.7.5-labs.a279d8c",
41
+ "@dxos/echo-schema": "0.7.5-labs.a279d8c",
42
+ "@dxos/plugin-graph": "0.7.5-labs.a279d8c",
43
+ "@dxos/log": "0.7.5-labs.a279d8c",
44
+ "@dxos/plugin-markdown": "0.7.5-labs.a279d8c",
45
+ "@dxos/plugin-space": "0.7.5-labs.a279d8c",
46
+ "@dxos/plugin-stack": "0.7.5-labs.a279d8c",
47
+ "@dxos/react-client": "0.7.5-labs.a279d8c",
48
+ "@dxos/react-ui-form": "0.7.5-labs.a279d8c"
57
49
  },
58
50
  "devDependencies": {
59
51
  "@phosphor-icons/react": "^2.1.5",
@@ -64,17 +56,17 @@
64
56
  "react": "~18.2.0",
65
57
  "react-dom": "~18.2.0",
66
58
  "vite": "5.4.7",
67
- "@dxos/random": "0.7.4",
68
- "@dxos/react-ui-theme": "0.7.4",
69
- "@dxos/storybook-utils": "0.7.4",
70
- "@dxos/react-ui": "0.7.4"
59
+ "@dxos/react-ui": "0.7.5-labs.a279d8c",
60
+ "@dxos/random": "0.7.5-labs.a279d8c",
61
+ "@dxos/react-ui-theme": "0.7.5-labs.a279d8c",
62
+ "@dxos/storybook-utils": "0.7.5-labs.a279d8c"
71
63
  },
72
64
  "peerDependencies": {
73
65
  "@phosphor-icons/react": "^2.1.5",
74
66
  "react": "~18.2.0",
75
67
  "react-dom": "~18.2.0",
76
- "@dxos/react-ui": "0.7.4",
77
- "@dxos/react-ui-theme": "0.7.4"
68
+ "@dxos/react-ui": "0.7.5-labs.a279d8c",
69
+ "@dxos/react-ui-theme": "0.7.5-labs.a279d8c"
78
70
  },
79
71
  "publishConfig": {
80
72
  "access": "public"
@@ -2,156 +2,57 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import { definePlugin, defineModule, Events, contributes, Capabilities } from '@dxos/app-framework';
6
6
 
7
7
  import {
8
- resolvePlugin,
9
- type PluginDefinition,
10
- parseIntentPlugin,
11
- LayoutAction,
12
- NavigationAction,
13
- type Intent,
14
- } from '@dxos/app-framework';
15
- import { create } from '@dxos/live-object';
16
- import { LocalStorageStore } from '@dxos/local-storage';
17
- import { parseClientPlugin } from '@dxos/plugin-client';
18
- import { createExtension, type Node } from '@dxos/plugin-graph';
19
- import { DocumentType } from '@dxos/plugin-markdown/types';
20
- import { CollectionType } from '@dxos/plugin-space/types';
21
- import { fullyQualifiedId } from '@dxos/react-client/echo';
22
-
23
- import { PresenterMain, PresenterSettings, MarkdownSlide, RevealMain } from './components';
24
- import meta, { PRESENTER_PLUGIN } from './meta';
8
+ AppGraphBuilder,
9
+ IntentResolver,
10
+ PresenterSettings,
11
+ PresenterState,
12
+ ReactContext,
13
+ ReactSurface,
14
+ } from './capabilities';
15
+ import { meta } from './meta';
25
16
  import translations from './translations';
26
- import {
27
- PresenterContext,
28
- type PresenterSettingsProps,
29
- TOGGLE_PRESENTATION,
30
- type PresenterPluginProvides,
31
- } from './types';
32
17
 
33
18
  // TODO(burdon): Only scale markdown content.
34
19
  // TODO(burdon): Map stack content; Slide content type (e.g., markdown, sketch, IPFS image, table, etc.)
35
20
 
36
- type PresenterState = {
37
- presenting: boolean;
38
- };
39
-
40
- export const PresenterPlugin = (): PluginDefinition<PresenterPluginProvides> => {
41
- const settings = new LocalStorageStore<PresenterSettingsProps>(PRESENTER_PLUGIN);
42
-
43
- // TODO(burdon): Do we need context providers if we can get the state from the plugin?
44
- const state = create<PresenterState>({ presenting: false });
45
-
46
- return {
47
- meta,
48
- provides: {
49
- translations,
50
- settings: settings.values,
51
- graph: {
52
- builder: (plugins) => {
53
- const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
54
- const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;
55
- if (!client || !dispatch) {
56
- return [];
57
- }
58
-
59
- return createExtension({
60
- id: PRESENTER_PLUGIN,
61
- filter: (node): node is Node<CollectionType | DocumentType> =>
62
- settings.values.presentCollections
63
- ? node.data instanceof CollectionType || node.data instanceof DocumentType
64
- : node.data instanceof DocumentType,
65
- actions: ({ node }) => {
66
- const object = node.data;
67
- const id = fullyQualifiedId(object);
68
- return [
69
- {
70
- id: `${TOGGLE_PRESENTATION}/${id}`,
71
- // TODO(burdon): Allow function so can generate state when activated.
72
- // So can set explicit fullscreen state coordinated with current presenter state.
73
- data: async () => {
74
- await dispatch([
75
- {
76
- plugin: PRESENTER_PLUGIN,
77
- action: TOGGLE_PRESENTATION,
78
- data: { object },
79
- },
80
- {
81
- action: NavigationAction.OPEN,
82
- data: { activeParts: { fullScreen: id } },
83
- },
84
- ]);
85
- },
86
- properties: {
87
- label: ['toggle presentation label', { ns: PRESENTER_PLUGIN }],
88
- icon: 'ph--presentation--regular',
89
- keyBinding: {
90
- macos: 'shift+meta+p',
91
- windows: 'shift+alt+p',
92
- },
93
- },
94
- },
95
- ];
96
- },
97
- });
98
- },
99
- },
100
- context: ({ children }) => {
101
- return (
102
- <PresenterContext.Provider
103
- value={{
104
- running: state.presenting,
105
- start: () => (state.presenting = true),
106
- stop: () => (state.presenting = false),
107
- }}
108
- >
109
- {children}
110
- </PresenterContext.Provider>
111
- );
112
- },
113
- surface: {
114
- component: ({ data, role }) => {
115
- switch (role) {
116
- case 'main': {
117
- if (state.presenting) {
118
- if (data.active instanceof CollectionType) {
119
- return { node: <PresenterMain collection={data.active} />, disposition: 'hoist' };
120
- } else if (data.active instanceof DocumentType) {
121
- return { node: <RevealMain document={data.active} />, disposition: 'hoist' };
122
- }
123
- }
124
- return null;
125
- }
126
- case 'slide': {
127
- return data.slide instanceof DocumentType ? <MarkdownSlide document={data.slide} /> : null;
128
- }
129
- case 'settings': {
130
- return data.plugin === meta.id ? <PresenterSettings settings={settings.values} /> : null;
131
- }
132
- }
133
-
134
- return null;
135
- },
136
- },
137
- intent: {
138
- resolver: (intent) => {
139
- switch (intent.action) {
140
- case TOGGLE_PRESENTATION: {
141
- state.presenting = intent.data?.state ?? !state.presenting;
142
-
143
- const intents = [] as Intent[][];
144
- if (state.presenting) {
145
- intents.push([{ action: LayoutAction.SET_LAYOUT_MODE, data: { layoutMode: 'fullscreen' } }]);
146
- } else {
147
- intents.push([{ action: LayoutAction.SET_LAYOUT_MODE, data: { revert: true } }]);
148
- }
149
-
150
- return { data: state.presenting, intents };
151
- }
152
- }
153
- },
154
- },
155
- },
156
- };
157
- };
21
+ export const PresenterPlugin = () =>
22
+ definePlugin(meta, [
23
+ defineModule({
24
+ id: `${meta.id}/module/settings`,
25
+ activatesOn: Events.SetupSettings,
26
+ activate: PresenterSettings,
27
+ }),
28
+ defineModule({
29
+ id: `${meta.id}/module/state`,
30
+ activatesOn: Events.Startup,
31
+ activate: PresenterState,
32
+ }),
33
+ defineModule({
34
+ id: `${meta.id}/module/translations`,
35
+ activatesOn: Events.SetupTranslations,
36
+ activate: () => contributes(Capabilities.Translations, translations),
37
+ }),
38
+ defineModule({
39
+ id: `${meta.id}/module/react-context`,
40
+ activatesOn: Events.Startup,
41
+ activate: ReactContext,
42
+ }),
43
+ defineModule({
44
+ id: `${meta.id}/module/react-surface`,
45
+ activatesOn: Events.Startup,
46
+ activate: ReactSurface,
47
+ }),
48
+ defineModule({
49
+ id: `${meta.id}/module/intent-resolver`,
50
+ activatesOn: Events.SetupIntents,
51
+ activate: IntentResolver,
52
+ }),
53
+ defineModule({
54
+ id: `${meta.id}/module/app-graph-builder`,
55
+ activatesOn: Events.SetupAppGraph,
56
+ activate: AppGraphBuilder,
57
+ }),
58
+ ]);
@@ -0,0 +1,51 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { contributes, type PluginsContext, Capabilities, createIntent } from '@dxos/app-framework';
6
+ import { createExtension, type Node } from '@dxos/plugin-graph';
7
+ import { DocumentType } from '@dxos/plugin-markdown/types';
8
+ import { CollectionType } from '@dxos/plugin-space/types';
9
+ import { fullyQualifiedId } from '@dxos/react-client/echo';
10
+
11
+ import { PRESENTER_PLUGIN } from '../meta';
12
+ import { PresenterAction, type PresenterSettingsProps } from '../types';
13
+
14
+ export default (context: PluginsContext) =>
15
+ contributes(
16
+ Capabilities.AppGraphBuilder,
17
+ createExtension({
18
+ id: PRESENTER_PLUGIN,
19
+ filter: (node): node is Node<CollectionType | DocumentType> => {
20
+ const settings = context
21
+ .requestCapabilities(Capabilities.SettingsStore)[0]
22
+ ?.getStore<PresenterSettingsProps>(PRESENTER_PLUGIN)?.value;
23
+ return settings?.presentCollections
24
+ ? node.data instanceof CollectionType || node.data instanceof DocumentType
25
+ : node.data instanceof DocumentType;
26
+ },
27
+ actions: ({ node }) => {
28
+ const object = node.data;
29
+ const id = fullyQualifiedId(object);
30
+ return [
31
+ {
32
+ id: `${PresenterAction.TogglePresentation._tag}/${id}`,
33
+ // TODO(burdon): Allow function so can generate state when activated.
34
+ // So can set explicit fullscreen state coordinated with current presenter state.
35
+ data: async () => {
36
+ const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
37
+ await dispatch(createIntent(PresenterAction.TogglePresentation, { object }));
38
+ },
39
+ properties: {
40
+ label: ['toggle presentation label', { ns: PRESENTER_PLUGIN }],
41
+ icon: 'ph--presentation--regular',
42
+ keyBinding: {
43
+ macos: 'shift+meta+p',
44
+ windows: 'shift+alt+p',
45
+ },
46
+ },
47
+ },
48
+ ];
49
+ },
50
+ }),
51
+ );
@@ -0,0 +1,13 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { defineCapability } from '@dxos/app-framework';
6
+
7
+ import { PRESENTER_PLUGIN } from '../meta';
8
+
9
+ export namespace PresenterCapabilities {
10
+ export type State = { presenting: boolean };
11
+ export const State = defineCapability<Readonly<State>>(`${PRESENTER_PLUGIN}/capability/state`);
12
+ export const MutableState = defineCapability<State>(`${PRESENTER_PLUGIN}/capability/state`);
13
+ }
@@ -0,0 +1,14 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { lazy } from '@dxos/app-framework';
6
+
7
+ export const AppGraphBuilder = lazy(() => import('./app-graph-builder'));
8
+ export const IntentResolver = lazy(() => import('./intent-resolver'));
9
+ export const ReactContext = lazy(() => import('./react-context'));
10
+ export const ReactSurface = lazy(() => import('./react-surface'));
11
+ export const PresenterSettings = lazy(() => import('./settings'));
12
+ export const PresenterState = lazy(() => import('./state'));
13
+
14
+ export * from './capabilities';
@@ -0,0 +1,42 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import {
6
+ Capabilities,
7
+ contributes,
8
+ createIntent,
9
+ createResolver,
10
+ LayoutAction,
11
+ NavigationAction,
12
+ type PluginsContext,
13
+ } from '@dxos/app-framework';
14
+ import { fullyQualifiedId } from '@dxos/react-client/echo';
15
+
16
+ import { PresenterCapabilities } from './capabilities';
17
+ import { PresenterAction } from '../types';
18
+
19
+ export default (context: PluginsContext) =>
20
+ contributes(
21
+ Capabilities.IntentResolver,
22
+ createResolver(PresenterAction.TogglePresentation, ({ object, state: next }) => {
23
+ const state = context.requestCapability(PresenterCapabilities.MutableState);
24
+ state.presenting = next ?? !state.presenting;
25
+
26
+ if (state.presenting) {
27
+ return {
28
+ intents: [
29
+ createIntent(LayoutAction.SetLayoutMode, { layoutMode: 'fullscreen' }),
30
+ createIntent(NavigationAction.Open, { activeParts: { fullScreen: fullyQualifiedId(object) } }),
31
+ ],
32
+ };
33
+ } else {
34
+ return {
35
+ intents: [
36
+ createIntent(LayoutAction.SetLayoutMode, { revert: true }),
37
+ createIntent(NavigationAction.Close, { activeParts: { fullScreen: fullyQualifiedId(object) } }),
38
+ ],
39
+ };
40
+ }
41
+ }),
42
+ );
@@ -0,0 +1,31 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
8
+
9
+ import { PresenterCapabilities } from './capabilities';
10
+ import { PRESENTER_PLUGIN } from '../meta';
11
+ import { PresenterContext } from '../types';
12
+
13
+ export default () =>
14
+ contributes(Capabilities.ReactContext, {
15
+ id: PRESENTER_PLUGIN,
16
+ context: ({ children }) => {
17
+ const state = useCapability(PresenterCapabilities.MutableState);
18
+
19
+ return (
20
+ <PresenterContext.Provider
21
+ value={{
22
+ running: state.presenting,
23
+ start: () => (state.presenting = true),
24
+ stop: () => (state.presenting = false),
25
+ }}
26
+ >
27
+ {children}
28
+ </PresenterContext.Provider>
29
+ );
30
+ },
31
+ });
@@ -0,0 +1,48 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Capabilities, contributes, createSurface, useCapability } from '@dxos/app-framework';
8
+ import { DocumentType } from '@dxos/plugin-markdown/types';
9
+ import { CollectionType } from '@dxos/plugin-space/types';
10
+
11
+ import { MarkdownSlide, PresenterSettings, PresenterMain, RevealMain } from '../components';
12
+ import { PRESENTER_PLUGIN } from '../meta';
13
+ import { type PresenterSettingsProps } from '../types';
14
+
15
+ export default () =>
16
+ contributes(Capabilities.ReactSurface, [
17
+ createSurface({
18
+ id: `${PRESENTER_PLUGIN}/document`,
19
+ role: 'main',
20
+ disposition: 'hoist',
21
+ filter: (data): data is { subject: DocumentType } => data.subject instanceof DocumentType,
22
+ component: ({ data }) => <RevealMain document={data.subject} />,
23
+ }),
24
+ createSurface({
25
+ id: `${PRESENTER_PLUGIN}/collection`,
26
+ role: 'main',
27
+ disposition: 'hoist',
28
+ filter: (data): data is { subject: CollectionType } => data.subject instanceof CollectionType,
29
+ component: ({ data }) => <PresenterMain collection={data.subject} />,
30
+ }),
31
+ createSurface({
32
+ id: `${PRESENTER_PLUGIN}/slide`,
33
+ role: 'slide',
34
+ filter: (data): data is { subject: DocumentType } => data.subject instanceof DocumentType,
35
+ component: ({ data }) => <MarkdownSlide document={data.subject} />,
36
+ }),
37
+ createSurface({
38
+ id: `${PRESENTER_PLUGIN}/settings`,
39
+ role: 'settings',
40
+ filter: (data): data is any => data.subject === PRESENTER_PLUGIN,
41
+ component: () => {
42
+ const settings = useCapability(Capabilities.SettingsStore).getStore<PresenterSettingsProps>(
43
+ PRESENTER_PLUGIN,
44
+ )!.value;
45
+ return <PresenterSettings settings={settings} />;
46
+ },
47
+ }),
48
+ ]);
@@ -0,0 +1,19 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capabilities, contributes } from '@dxos/app-framework';
6
+ import { create } from '@dxos/live-object';
7
+
8
+ import { PRESENTER_PLUGIN } from '../meta';
9
+ import { PresenterSettingsSchema, type PresenterSettingsProps } from '../types';
10
+
11
+ export default () => {
12
+ const settings = create<PresenterSettingsProps>({});
13
+
14
+ return contributes(Capabilities.Settings, {
15
+ schema: PresenterSettingsSchema,
16
+ prefix: PRESENTER_PLUGIN,
17
+ value: settings,
18
+ });
19
+ };
@@ -0,0 +1,17 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { contributes } from '@dxos/app-framework';
6
+ import { create } from '@dxos/live-object';
7
+
8
+ import { PresenterCapabilities } from './capabilities';
9
+
10
+ export default () => {
11
+ // TODO(burdon): Do we need context providers if we can get the state from the plugin?
12
+ // No, the main reason would be compability with existing apis.
13
+ // For anything made specifically for the plugin framework they can depend on `useCapabilities`.
14
+ const state = create<PresenterCapabilities.State>({ presenting: false });
15
+
16
+ return contributes(PresenterCapabilities.State, state);
17
+ };
@@ -9,7 +9,7 @@ import { type DocumentType } from '@dxos/plugin-markdown/types';
9
9
  import { Container, Slide } from './Markdown';
10
10
 
11
11
  const MarkdownSlide: FC<{ document: DocumentType }> = ({ document }) => {
12
- const content = document.content?.content;
12
+ const content = document.content.target?.content;
13
13
  if (!content) {
14
14
  return null;
15
15
  }