@dxos/plugin-presenter 0.7.4-staging.f7e8224 → 0.7.5-labs.071a3e2

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 (77) 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-O6SKQTTD.mjs} +14 -32
  4. package/dist/lib/browser/PresenterMain-O6SKQTTD.mjs.map +7 -0
  5. package/dist/lib/browser/{RevealMain-YOFOFZJE.mjs → RevealMain-YFG5E6JB.mjs} +13 -28
  6. package/dist/lib/browser/RevealMain-YFG5E6JB.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-3KYTF5X3.mjs +31 -0
  10. package/dist/lib/browser/chunk-3KYTF5X3.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-MSAMS5TA.mjs +16 -0
  12. package/dist/lib/browser/chunk-MSAMS5TA.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 +54 -188
  18. package/dist/lib/browser/index.mjs.map +4 -4
  19. package/dist/lib/browser/intent-resolver-27OZKSSE.mjs +46 -0
  20. package/dist/lib/browser/intent-resolver-27OZKSSE.mjs.map +7 -0
  21. package/dist/lib/browser/meta.json +1 -1
  22. package/dist/lib/browser/react-surface-DZEZSJT4.mjs +71 -0
  23. package/dist/lib/browser/react-surface-DZEZSJT4.mjs.map +7 -0
  24. package/dist/lib/browser/settings-L73ZKGLV.mjs +22 -0
  25. package/dist/lib/browser/settings-L73ZKGLV.mjs.map +7 -0
  26. package/dist/lib/browser/state-IGJRHRIA.mjs +18 -0
  27. package/dist/lib/browser/state-IGJRHRIA.mjs.map +7 -0
  28. package/dist/types/src/PresenterPlugin.d.ts +1 -3
  29. package/dist/types/src/PresenterPlugin.d.ts.map +1 -1
  30. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  31. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/capabilities.d.ts +8 -0
  33. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/index.d.ts +183 -0
  35. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  37. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  39. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  40. package/dist/types/src/capabilities/settings.d.ts +4 -0
  41. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  42. package/dist/types/src/capabilities/state.d.ts +4 -0
  43. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  44. package/dist/types/src/components/PresenterMain.d.ts.map +1 -1
  45. package/dist/types/src/components/RevealMain.d.ts.map +1 -1
  46. package/dist/types/src/components/index.d.ts +1 -1
  47. package/dist/types/src/index.d.ts +2 -2
  48. package/dist/types/src/index.d.ts.map +1 -1
  49. package/dist/types/src/meta.d.ts +1 -2
  50. package/dist/types/src/meta.d.ts.map +1 -1
  51. package/dist/types/src/types.d.ts +21 -6
  52. package/dist/types/src/types.d.ts.map +1 -1
  53. package/dist/types/tsconfig.tsbuildinfo +1 -0
  54. package/package.json +22 -29
  55. package/src/PresenterPlugin.tsx +36 -147
  56. package/src/capabilities/app-graph-builder.ts +51 -0
  57. package/src/capabilities/capabilities.ts +13 -0
  58. package/src/capabilities/index.ts +13 -0
  59. package/src/capabilities/intent-resolver.ts +44 -0
  60. package/src/capabilities/react-surface.tsx +60 -0
  61. package/src/capabilities/settings.ts +19 -0
  62. package/src/capabilities/state.ts +17 -0
  63. package/src/components/MarkdownSlide.tsx +1 -1
  64. package/src/components/PresenterMain.tsx +7 -29
  65. package/src/components/PresenterSettings.tsx +3 -3
  66. package/src/components/RevealMain.tsx +7 -18
  67. package/src/index.ts +2 -4
  68. package/src/meta.ts +1 -1
  69. package/src/types.ts +24 -17
  70. package/dist/lib/browser/MarkdownSlide-4FZ3XIH5.mjs.map +0 -7
  71. package/dist/lib/browser/PresenterMain-FUIXINMC.mjs.map +0 -7
  72. package/dist/lib/browser/RevealMain-YOFOFZJE.mjs.map +0 -7
  73. package/dist/lib/browser/chunk-67PDV7KN.mjs.map +0 -7
  74. package/dist/lib/browser/chunk-RXCQGKK4.mjs +0 -20
  75. package/dist/lib/browser/chunk-RXCQGKK4.mjs.map +0 -7
  76. package/dist/lib/browser/meta.mjs +0 -9
  77. package/dist/lib/browser/meta.mjs.map +0 -7
@@ -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.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-presenter",
3
- "version": "0.7.4-staging.f7e8224",
3
+ "version": "0.7.5-labs.071a3e2",
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,20 @@
41
33
  "remark-frontmatter": "^5.0.0",
42
34
  "remark-parse-frontmatter": "^1.0.3",
43
35
  "reveal.js": "^5.1.0",
44
- "@dxos/app-framework": "0.7.4-staging.f7e8224",
45
- "@dxos/async": "0.7.4-staging.f7e8224",
46
- "@dxos/echo-schema": "0.7.4-staging.f7e8224",
47
- "@dxos/live-object": "0.7.4-staging.f7e8224",
48
- "@dxos/log": "0.7.4-staging.f7e8224",
49
- "@dxos/local-storage": "0.7.4-staging.f7e8224",
50
- "@dxos/plugin-client": "0.7.4-staging.f7e8224",
51
- "@dxos/plugin-graph": "0.7.4-staging.f7e8224",
52
- "@dxos/plugin-markdown": "0.7.4-staging.f7e8224",
53
- "@dxos/plugin-space": "0.7.4-staging.f7e8224",
54
- "@dxos/plugin-stack": "0.7.4-staging.f7e8224",
55
- "@dxos/react-ui-form": "0.7.4-staging.f7e8224",
56
- "@dxos/react-client": "0.7.4-staging.f7e8224"
36
+ "@dxos/app-framework": "0.7.5-labs.071a3e2",
37
+ "@dxos/async": "0.7.5-labs.071a3e2",
38
+ "@dxos/echo-schema": "0.7.5-labs.071a3e2",
39
+ "@dxos/live-object": "0.7.5-labs.071a3e2",
40
+ "@dxos/local-storage": "0.7.5-labs.071a3e2",
41
+ "@dxos/log": "0.7.5-labs.071a3e2",
42
+ "@dxos/plugin-client": "0.7.5-labs.071a3e2",
43
+ "@dxos/plugin-space": "0.7.5-labs.071a3e2",
44
+ "@dxos/plugin-stack": "0.7.5-labs.071a3e2",
45
+ "@dxos/react-client": "0.7.5-labs.071a3e2",
46
+ "@dxos/plugin-markdown": "0.7.5-labs.071a3e2",
47
+ "@dxos/react-ui-stack": "0.7.5-labs.071a3e2",
48
+ "@dxos/react-ui-form": "0.7.5-labs.071a3e2",
49
+ "@dxos/plugin-graph": "0.7.5-labs.071a3e2"
57
50
  },
58
51
  "devDependencies": {
59
52
  "@phosphor-icons/react": "^2.1.5",
@@ -64,17 +57,17 @@
64
57
  "react": "~18.2.0",
65
58
  "react-dom": "~18.2.0",
66
59
  "vite": "5.4.7",
67
- "@dxos/react-ui": "0.7.4-staging.f7e8224",
68
- "@dxos/random": "0.7.4-staging.f7e8224",
69
- "@dxos/react-ui-theme": "0.7.4-staging.f7e8224",
70
- "@dxos/storybook-utils": "0.7.4-staging.f7e8224"
60
+ "@dxos/react-ui": "0.7.5-labs.071a3e2",
61
+ "@dxos/random": "0.7.5-labs.071a3e2",
62
+ "@dxos/react-ui-theme": "0.7.5-labs.071a3e2",
63
+ "@dxos/storybook-utils": "0.7.5-labs.071a3e2"
71
64
  },
72
65
  "peerDependencies": {
73
66
  "@phosphor-icons/react": "^2.1.5",
74
67
  "react": "~18.2.0",
75
68
  "react-dom": "~18.2.0",
76
- "@dxos/react-ui": "0.7.4-staging.f7e8224",
77
- "@dxos/react-ui-theme": "0.7.4-staging.f7e8224"
69
+ "@dxos/react-ui-theme": "0.7.5-labs.071a3e2",
70
+ "@dxos/react-ui": "0.7.5-labs.071a3e2"
78
71
  },
79
72
  "publishConfig": {
80
73
  "access": "public"
@@ -2,156 +2,45 @@
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
- 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';
7
+ import { AppGraphBuilder, IntentResolver, PresenterSettings, PresenterState, ReactSurface } from './capabilities';
8
+ import { meta } from './meta';
25
9
  import translations from './translations';
26
- import {
27
- PresenterContext,
28
- type PresenterSettingsProps,
29
- TOGGLE_PRESENTATION,
30
- type PresenterPluginProvides,
31
- } from './types';
32
10
 
33
11
  // TODO(burdon): Only scale markdown content.
34
12
  // TODO(burdon): Map stack content; Slide content type (e.g., markdown, sketch, IPFS image, table, etc.)
35
13
 
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
- };
14
+ export const PresenterPlugin = () =>
15
+ definePlugin(meta, [
16
+ defineModule({
17
+ id: `${meta.id}/module/settings`,
18
+ activatesOn: Events.SetupSettings,
19
+ activate: PresenterSettings,
20
+ }),
21
+ defineModule({
22
+ id: `${meta.id}/module/state`,
23
+ activatesOn: Events.Startup,
24
+ activate: PresenterState,
25
+ }),
26
+ defineModule({
27
+ id: `${meta.id}/module/translations`,
28
+ activatesOn: Events.SetupTranslations,
29
+ activate: () => contributes(Capabilities.Translations, translations),
30
+ }),
31
+ defineModule({
32
+ id: `${meta.id}/module/react-surface`,
33
+ activatesOn: Events.SetupSurfaces,
34
+ activate: ReactSurface,
35
+ }),
36
+ defineModule({
37
+ id: `${meta.id}/module/intent-resolver`,
38
+ activatesOn: Events.SetupIntents,
39
+ activate: IntentResolver,
40
+ }),
41
+ defineModule({
42
+ id: `${meta.id}/module/app-graph-builder`,
43
+ activatesOn: Events.SetupAppGraph,
44
+ activate: AppGraphBuilder,
45
+ }),
46
+ ]);
@@ -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,13 @@
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 ReactSurface = lazy(() => import('./react-surface'));
10
+ export const PresenterSettings = lazy(() => import('./settings'));
11
+ export const PresenterState = lazy(() => import('./state'));
12
+
13
+ export * from './capabilities';
@@ -0,0 +1,44 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import {
6
+ Capabilities,
7
+ contributes,
8
+ createIntent,
9
+ createResolver,
10
+ LayoutAction,
11
+ type PluginsContext,
12
+ } from '@dxos/app-framework';
13
+ import { fullyQualifiedId } from '@dxos/react-client/echo';
14
+
15
+ import { PresenterCapabilities } from './capabilities';
16
+ import { PresenterAction } from '../types';
17
+
18
+ export default (context: PluginsContext) =>
19
+ contributes(
20
+ Capabilities.IntentResolver,
21
+ createResolver({
22
+ intent: PresenterAction.TogglePresentation,
23
+ resolve: ({ object, state: next }) => {
24
+ const state = context.requestCapability(PresenterCapabilities.MutableState);
25
+ state.presenting = next ?? !state.presenting;
26
+
27
+ if (state.presenting) {
28
+ return {
29
+ intents: [
30
+ createIntent(LayoutAction.SetLayoutMode, {
31
+ part: 'mode',
32
+ subject: fullyQualifiedId(object),
33
+ options: { mode: 'fullscreen' },
34
+ }),
35
+ ],
36
+ };
37
+ } else {
38
+ return {
39
+ intents: [createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { revert: true } })],
40
+ };
41
+ }
42
+ },
43
+ }),
44
+ );
@@ -0,0 +1,60 @@
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 { SettingsStore } from '@dxos/local-storage';
9
+ import { DocumentType } from '@dxos/plugin-markdown/types';
10
+ import { CollectionType } from '@dxos/plugin-space/types';
11
+
12
+ import { PresenterCapabilities } from './capabilities';
13
+ import { MarkdownSlide, PresenterSettings, PresenterMain, RevealMain } from '../components';
14
+ import { PRESENTER_PLUGIN } from '../meta';
15
+ import { PresenterContext, type PresenterSettingsProps } from '../types';
16
+
17
+ export default () =>
18
+ contributes(Capabilities.ReactSurface, [
19
+ createSurface({
20
+ id: `${PRESENTER_PLUGIN}/document`,
21
+ role: 'main',
22
+ position: 'hoist',
23
+ filter: (data): data is { subject: DocumentType } => data.subject instanceof DocumentType,
24
+ component: ({ data }) => <RevealMain document={data.subject} />,
25
+ }),
26
+ createSurface({
27
+ id: `${PRESENTER_PLUGIN}/collection`,
28
+ role: 'main',
29
+ position: 'hoist',
30
+ filter: (data): data is { subject: CollectionType } => data.subject instanceof CollectionType,
31
+ component: ({ data }) => {
32
+ const state = useCapability(PresenterCapabilities.MutableState);
33
+
34
+ return (
35
+ <PresenterContext.Provider
36
+ value={{
37
+ running: state.presenting,
38
+ start: () => (state.presenting = true),
39
+ stop: () => (state.presenting = false),
40
+ }}
41
+ >
42
+ <PresenterMain collection={data.subject} />
43
+ </PresenterContext.Provider>
44
+ );
45
+ },
46
+ }),
47
+ createSurface({
48
+ id: `${PRESENTER_PLUGIN}/slide`,
49
+ role: 'slide',
50
+ filter: (data): data is { subject: DocumentType } => data.subject instanceof DocumentType,
51
+ component: ({ data }) => <MarkdownSlide document={data.subject} />,
52
+ }),
53
+ createSurface({
54
+ id: `${PRESENTER_PLUGIN}/settings`,
55
+ role: 'article',
56
+ filter: (data): data is { subject: SettingsStore<PresenterSettingsProps> } =>
57
+ data.subject instanceof SettingsStore && data.subject.prefix === PRESENTER_PLUGIN,
58
+ component: ({ data: { subject } }) => <PresenterSettings settings={subject.value} />,
59
+ }),
60
+ ]);
@@ -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
  }
@@ -4,15 +4,8 @@
4
4
 
5
5
  import React, { type FC, useContext, useState } from 'react';
6
6
 
7
- import {
8
- Surface,
9
- useIntentDispatcher,
10
- useResolvePlugin,
11
- parseLayoutPlugin,
12
- NavigationAction,
13
- } from '@dxos/app-framework';
7
+ import { Surface, createIntent, useLayout, useIntentDispatcher } from '@dxos/app-framework';
14
8
  import { type CollectionType } from '@dxos/plugin-space/types';
15
- import { fullyQualifiedId } from '@dxos/react-client/echo';
16
9
  import { Main } from '@dxos/react-ui';
17
10
  import {
18
11
  baseSurface,
@@ -22,35 +15,20 @@ import {
22
15
  } from '@dxos/react-ui-theme';
23
16
 
24
17
  import { Layout, PageNumber, Pager, StartButton } from './Presenter';
25
- import { PRESENTER_PLUGIN } from '../meta';
26
- import { PresenterContext, TOGGLE_PRESENTATION } from '../types';
18
+ import { PresenterContext, PresenterAction } from '../types';
27
19
 
28
20
  const PresenterMain: FC<{ collection: CollectionType }> = ({ collection }) => {
29
21
  const [slide, setSlide] = useState(0);
30
22
 
31
23
  // TODO(burdon): Should not depend on split screen.
32
- const layoutPlugin = useResolvePlugin(parseLayoutPlugin);
33
- const fullscreen = layoutPlugin?.provides.layout.layoutMode === 'fullscreen';
24
+ const layout = useLayout();
25
+ const fullscreen = layout.mode === 'fullscreen';
34
26
  const { running } = useContext(PresenterContext);
35
27
 
36
28
  // TODO(burdon): Currently conflates fullscreen and running.
37
- const dispatch = useIntentDispatcher();
29
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
38
30
  const handleSetRunning = (running: boolean) => {
39
- void dispatch([
40
- {
41
- plugin: PRESENTER_PLUGIN,
42
- action: TOGGLE_PRESENTATION,
43
- data: { state: running },
44
- },
45
- ...(!running
46
- ? [
47
- {
48
- action: NavigationAction.CLOSE,
49
- data: { activeParts: { fullScreen: fullyQualifiedId(collection) } },
50
- },
51
- ]
52
- : []),
53
- ]);
31
+ void dispatch(createIntent(PresenterAction.TogglePresentation, { object: collection, state: running }));
54
32
  };
55
33
 
56
34
  return (
@@ -76,7 +54,7 @@ const PresenterMain: FC<{ collection: CollectionType }> = ({ collection }) => {
76
54
  }
77
55
  >
78
56
  {/* TODO(wittjosiah): Better slide placeholder. */}
79
- <Surface role='slide' data={{ slide: collection.objects[slide] }} placeholder={<></>} />
57
+ <Surface role='slide' data={{ subject: collection.objects[slide] }} placeholder={<></>} />
80
58
  </Layout>
81
59
  </Main.Content>
82
60
  );
@@ -5,7 +5,7 @@
5
5
  import React from 'react';
6
6
 
7
7
  import { Input, useTranslation } from '@dxos/react-ui';
8
- import { DeprecatedFormInput } from '@dxos/react-ui-form';
8
+ import { DeprecatedFormContainer, DeprecatedFormInput } from '@dxos/react-ui-form';
9
9
 
10
10
  import { PRESENTER_PLUGIN } from '../meta';
11
11
  import { type PresenterSettingsProps } from '../types';
@@ -14,13 +14,13 @@ export const PresenterSettings = ({ settings }: { settings: PresenterSettingsPro
14
14
  const { t } = useTranslation(PRESENTER_PLUGIN);
15
15
 
16
16
  return (
17
- <>
17
+ <DeprecatedFormContainer>
18
18
  <DeprecatedFormInput label={t('present collections label')}>
19
19
  <Input.Switch
20
20
  checked={settings.presentCollections}
21
21
  onCheckedChange={(checked) => (settings.presentCollections = !!checked)}
22
22
  />
23
23
  </DeprecatedFormInput>
24
- </>
24
+ </DeprecatedFormContainer>
25
25
  );
26
26
  };