@dxos/plugin-presenter 0.7.5-main.499c70c → 0.7.5-main.5ae2ba8

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 (84) hide show
  1. package/dist/lib/browser/{PresenterMain-TQE4OZK2.mjs → PresenterMain-7JXM3QQ7.mjs} +8 -8
  2. package/dist/lib/browser/PresenterMain-7JXM3QQ7.mjs.map +7 -0
  3. package/dist/lib/browser/{RevealMain-JGKAQMQ4.mjs → RevealMain-YFG5E6JB.mjs} +6 -5
  4. package/dist/lib/browser/RevealMain-YFG5E6JB.mjs.map +7 -0
  5. package/dist/lib/browser/app-graph-builder-6U7WTJKG.mjs +54 -0
  6. package/dist/lib/browser/app-graph-builder-6U7WTJKG.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-MSAMS5TA.mjs +16 -0
  8. package/dist/lib/browser/chunk-MSAMS5TA.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-67PDV7KN.mjs → chunk-Q5U3VOZB.mjs} +3 -3
  10. package/dist/lib/browser/chunk-Q5U3VOZB.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-Z6QQB6KB.mjs → chunk-SFMK6EE3.mjs} +7 -3
  12. package/dist/lib/browser/chunk-SFMK6EE3.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-Y3TXMZKR.mjs +31 -0
  14. package/dist/lib/browser/chunk-Y3TXMZKR.mjs.map +7 -0
  15. package/dist/lib/browser/index.mjs +57 -172
  16. package/dist/lib/browser/index.mjs.map +4 -4
  17. package/dist/lib/browser/intent-resolver-27OZKSSE.mjs +46 -0
  18. package/dist/lib/browser/intent-resolver-27OZKSSE.mjs.map +7 -0
  19. package/dist/lib/browser/meta.json +1 -1
  20. package/dist/lib/browser/react-surface-OGCVIWCS.mjs +71 -0
  21. package/dist/lib/browser/react-surface-OGCVIWCS.mjs.map +7 -0
  22. package/dist/lib/browser/settings-L73ZKGLV.mjs +22 -0
  23. package/dist/lib/browser/settings-L73ZKGLV.mjs.map +7 -0
  24. package/dist/lib/browser/state-IGJRHRIA.mjs +18 -0
  25. package/dist/lib/browser/state-IGJRHRIA.mjs.map +7 -0
  26. package/dist/types/src/PresenterPlugin.d.ts +1 -3
  27. package/dist/types/src/PresenterPlugin.d.ts.map +1 -1
  28. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  29. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  30. package/dist/types/src/capabilities/capabilities.d.ts +8 -0
  31. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/index.d.ts +183 -0
  33. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  35. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  37. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/settings.d.ts +4 -0
  39. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  40. package/dist/types/src/capabilities/state.d.ts +4 -0
  41. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  42. package/dist/types/src/components/Markdown/Container.d.ts +2 -2
  43. package/dist/types/src/components/Markdown/Container.d.ts.map +1 -1
  44. package/dist/types/src/components/Markdown/Slide.d.ts +1 -2
  45. package/dist/types/src/components/Markdown/Slide.d.ts.map +1 -1
  46. package/dist/types/src/components/Presenter/Layout.d.ts +2 -2
  47. package/dist/types/src/components/Presenter/Layout.d.ts.map +1 -1
  48. package/dist/types/src/components/Presenter/Pager.d.ts +3 -3
  49. package/dist/types/src/components/Presenter/Pager.d.ts.map +1 -1
  50. package/dist/types/src/components/PresenterSettings.d.ts +1 -2
  51. package/dist/types/src/components/PresenterSettings.d.ts.map +1 -1
  52. package/dist/types/src/components/Reveal/Reveal.d.ts +1 -2
  53. package/dist/types/src/components/Reveal/Reveal.d.ts.map +1 -1
  54. package/dist/types/src/components/RevealMain.d.ts.map +1 -1
  55. package/dist/types/src/components/index.d.ts +3 -3
  56. package/dist/types/src/index.d.ts +2 -2
  57. package/dist/types/src/index.d.ts.map +1 -1
  58. package/dist/types/src/meta.d.ts +1 -2
  59. package/dist/types/src/meta.d.ts.map +1 -1
  60. package/dist/types/src/types.d.ts +4 -5
  61. package/dist/types/src/types.d.ts.map +1 -1
  62. package/dist/types/tsconfig.tsbuildinfo +1 -1
  63. package/package.json +23 -29
  64. package/src/PresenterPlugin.tsx +39 -142
  65. package/src/capabilities/app-graph-builder.ts +51 -0
  66. package/src/capabilities/capabilities.ts +13 -0
  67. package/src/capabilities/index.ts +13 -0
  68. package/src/capabilities/intent-resolver.ts +44 -0
  69. package/src/capabilities/react-surface.tsx +60 -0
  70. package/src/capabilities/settings.ts +19 -0
  71. package/src/capabilities/state.ts +17 -0
  72. package/src/components/Presenter/Pager.tsx +2 -2
  73. package/src/components/PresenterMain.tsx +3 -3
  74. package/src/components/PresenterSettings.tsx +3 -3
  75. package/src/components/RevealMain.tsx +3 -2
  76. package/src/index.ts +2 -4
  77. package/src/meta.ts +1 -1
  78. package/src/types.ts +6 -15
  79. package/dist/lib/browser/PresenterMain-TQE4OZK2.mjs.map +0 -7
  80. package/dist/lib/browser/RevealMain-JGKAQMQ4.mjs.map +0 -7
  81. package/dist/lib/browser/chunk-67PDV7KN.mjs.map +0 -7
  82. package/dist/lib/browser/chunk-Z6QQB6KB.mjs.map +0 -7
  83. package/dist/lib/browser/meta.mjs +0 -9
  84. 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;AAC7B,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,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"}
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"}
@@ -1 +1 @@
1
- {"version":"5.7.2"}
1
+ {"version":"5.7.3"}
package/package.json CHANGED
@@ -1,29 +1,22 @@
1
1
  {
2
2
  "name": "@dxos/plugin-presenter",
3
- "version": "0.7.5-main.499c70c",
3
+ "version": "0.7.5-main.5ae2ba8",
4
4
  "description": "Braneframe presenter plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
7
  "license": "MIT",
8
8
  "author": "DXOS.org",
9
9
  "sideEffects": true,
10
+ "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/types/src/index.d.ts",
13
14
  "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
15
  }
19
16
  },
20
17
  "types": "dist/types/src/index.d.ts",
21
18
  "typesVersions": {
22
- "*": {
23
- "meta": [
24
- "dist/types/src/meta.d.ts"
25
- ]
26
- }
19
+ "*": {}
27
20
  },
28
21
  "files": [
29
22
  "dist",
@@ -41,19 +34,20 @@
41
34
  "remark-frontmatter": "^5.0.0",
42
35
  "remark-parse-frontmatter": "^1.0.3",
43
36
  "reveal.js": "^5.1.0",
44
- "@dxos/app-framework": "0.7.5-main.499c70c",
45
- "@dxos/async": "0.7.5-main.499c70c",
46
- "@dxos/echo-schema": "0.7.5-main.499c70c",
47
- "@dxos/local-storage": "0.7.5-main.499c70c",
48
- "@dxos/live-object": "0.7.5-main.499c70c",
49
- "@dxos/log": "0.7.5-main.499c70c",
50
- "@dxos/plugin-client": "0.7.5-main.499c70c",
51
- "@dxos/plugin-graph": "0.7.5-main.499c70c",
52
- "@dxos/plugin-markdown": "0.7.5-main.499c70c",
53
- "@dxos/plugin-space": "0.7.5-main.499c70c",
54
- "@dxos/react-ui-form": "0.7.5-main.499c70c",
55
- "@dxos/react-client": "0.7.5-main.499c70c",
56
- "@dxos/plugin-stack": "0.7.5-main.499c70c"
37
+ "@dxos/async": "0.7.5-main.5ae2ba8",
38
+ "@dxos/app-framework": "0.7.5-main.5ae2ba8",
39
+ "@dxos/live-object": "0.7.5-main.5ae2ba8",
40
+ "@dxos/log": "0.7.5-main.5ae2ba8",
41
+ "@dxos/local-storage": "0.7.5-main.5ae2ba8",
42
+ "@dxos/echo-schema": "0.7.5-main.5ae2ba8",
43
+ "@dxos/plugin-client": "0.7.5-main.5ae2ba8",
44
+ "@dxos/plugin-graph": "0.7.5-main.5ae2ba8",
45
+ "@dxos/plugin-markdown": "0.7.5-main.5ae2ba8",
46
+ "@dxos/plugin-space": "0.7.5-main.5ae2ba8",
47
+ "@dxos/plugin-stack": "0.7.5-main.5ae2ba8",
48
+ "@dxos/react-client": "0.7.5-main.5ae2ba8",
49
+ "@dxos/react-ui-form": "0.7.5-main.5ae2ba8",
50
+ "@dxos/react-ui-stack": "0.7.5-main.5ae2ba8"
57
51
  },
58
52
  "devDependencies": {
59
53
  "@phosphor-icons/react": "^2.1.5",
@@ -64,17 +58,17 @@
64
58
  "react": "~18.2.0",
65
59
  "react-dom": "~18.2.0",
66
60
  "vite": "5.4.7",
67
- "@dxos/react-ui": "0.7.5-main.499c70c",
68
- "@dxos/storybook-utils": "0.7.5-main.499c70c",
69
- "@dxos/react-ui-theme": "0.7.5-main.499c70c",
70
- "@dxos/random": "0.7.5-main.499c70c"
61
+ "@dxos/react-ui": "0.7.5-main.5ae2ba8",
62
+ "@dxos/random": "0.7.5-main.5ae2ba8",
63
+ "@dxos/react-ui-theme": "0.7.5-main.5ae2ba8",
64
+ "@dxos/storybook-utils": "0.7.5-main.5ae2ba8"
71
65
  },
72
66
  "peerDependencies": {
73
67
  "@phosphor-icons/react": "^2.1.5",
74
68
  "react": "~18.2.0",
75
69
  "react-dom": "~18.2.0",
76
- "@dxos/react-ui-theme": "0.7.5-main.499c70c",
77
- "@dxos/react-ui": "0.7.5-main.499c70c"
70
+ "@dxos/react-ui": "0.7.5-main.5ae2ba8",
71
+ "@dxos/react-ui-theme": "0.7.5-main.5ae2ba8"
78
72
  },
79
73
  "publishConfig": {
80
74
  "access": "public"
@@ -2,151 +2,48 @@
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
- createSurface,
14
- createIntent,
15
- createResolver,
16
- } from '@dxos/app-framework';
17
- import { create } from '@dxos/live-object';
18
- import { LocalStorageStore } from '@dxos/local-storage';
19
- import { createExtension, type Node } from '@dxos/plugin-graph';
20
- import { DocumentType } from '@dxos/plugin-markdown/types';
21
- import { CollectionType } from '@dxos/plugin-space/types';
22
- import { fullyQualifiedId } from '@dxos/react-client/echo';
23
-
24
- import { PresenterMain, PresenterSettings, MarkdownSlide, RevealMain } from './components';
25
- import meta, { PRESENTER_PLUGIN } from './meta';
7
+ import { AppGraphBuilder, IntentResolver, PresenterSettings, PresenterState, ReactSurface } from './capabilities';
8
+ import { meta } from './meta';
26
9
  import translations from './translations';
27
- import { PresenterContext, type PresenterSettingsProps, type PresenterPluginProvides, PresenterAction } from './types';
28
10
 
29
11
  // TODO(burdon): Only scale markdown content.
30
12
  // TODO(burdon): Map stack content; Slide content type (e.g., markdown, sketch, IPFS image, table, etc.)
31
13
 
32
- type PresenterState = {
33
- presenting: boolean;
34
- };
35
-
36
- export const PresenterPlugin = (): PluginDefinition<PresenterPluginProvides> => {
37
- const settings = new LocalStorageStore<PresenterSettingsProps>(PRESENTER_PLUGIN);
38
-
39
- // TODO(burdon): Do we need context providers if we can get the state from the plugin?
40
- const state = create<PresenterState>({ presenting: false });
41
-
42
- return {
43
- meta,
44
- provides: {
45
- translations,
46
- settings: settings.values,
47
- graph: {
48
- builder: (plugins) => {
49
- const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatchPromise;
50
- if (!dispatch) {
51
- return [];
52
- }
53
-
54
- return createExtension({
55
- id: PRESENTER_PLUGIN,
56
- filter: (node): node is Node<CollectionType | DocumentType> =>
57
- settings.values.presentCollections
58
- ? node.data instanceof CollectionType || node.data instanceof DocumentType
59
- : node.data instanceof DocumentType,
60
- actions: ({ node }) => {
61
- const object = node.data;
62
- const id = fullyQualifiedId(object);
63
- return [
64
- {
65
- id: `${PresenterAction.TogglePresentation._tag}/${id}`,
66
- // TODO(burdon): Allow function so can generate state when activated.
67
- // So can set explicit fullscreen state coordinated with current presenter state.
68
- data: async () => {
69
- await dispatch(createIntent(PresenterAction.TogglePresentation, { object }));
70
- },
71
- properties: {
72
- label: ['toggle presentation label', { ns: PRESENTER_PLUGIN }],
73
- icon: 'ph--presentation--regular',
74
- keyBinding: {
75
- macos: 'shift+meta+p',
76
- windows: 'shift+alt+p',
77
- },
78
- },
79
- },
80
- ];
81
- },
82
- });
83
- },
84
- },
85
- context: ({ children }) => {
86
- return (
87
- <PresenterContext.Provider
88
- value={{
89
- running: state.presenting,
90
- start: () => (state.presenting = true),
91
- stop: () => (state.presenting = false),
92
- }}
93
- >
94
- {children}
95
- </PresenterContext.Provider>
96
- );
97
- },
98
- surface: {
99
- definitions: () => [
100
- createSurface({
101
- id: `${PRESENTER_PLUGIN}/document`,
102
- role: 'main',
103
- disposition: 'hoist',
104
- filter: (data): data is { subject: DocumentType } => data.subject instanceof DocumentType,
105
- component: ({ data }) => <RevealMain document={data.subject} />,
106
- }),
107
- createSurface({
108
- id: `${PRESENTER_PLUGIN}/collection`,
109
- role: 'main',
110
- disposition: 'hoist',
111
- filter: (data): data is { subject: CollectionType } => data.subject instanceof CollectionType,
112
- component: ({ data }) => <PresenterMain collection={data.subject} />,
113
- }),
114
- createSurface({
115
- id: `${PRESENTER_PLUGIN}/slide`,
116
- role: 'slide',
117
- filter: (data): data is { subject: DocumentType } => data.subject instanceof DocumentType,
118
- component: ({ data }) => <MarkdownSlide document={data.subject} />,
119
- }),
120
- createSurface({
121
- id: `${PRESENTER_PLUGIN}/settings`,
122
- role: 'settings',
123
- filter: (data): data is any => data.subject === PRESENTER_PLUGIN,
124
- component: () => <PresenterSettings settings={settings.values} />,
125
- }),
126
- ],
127
- },
128
- intent: {
129
- resolvers: () =>
130
- createResolver(PresenterAction.TogglePresentation, ({ object, state: next }) => {
131
- state.presenting = next ?? !state.presenting;
132
-
133
- if (state.presenting) {
134
- return {
135
- intents: [
136
- createIntent(LayoutAction.SetLayoutMode, { layoutMode: 'fullscreen' }),
137
- createIntent(NavigationAction.Open, { activeParts: { fullScreen: fullyQualifiedId(object) } }),
138
- ],
139
- };
140
- } else {
141
- return {
142
- intents: [
143
- createIntent(LayoutAction.SetLayoutMode, { revert: true }),
144
- createIntent(NavigationAction.Close, { activeParts: { fullScreen: fullyQualifiedId(object) } }),
145
- ],
146
- };
147
- }
148
- }),
149
- },
150
- },
151
- };
152
- };
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
+ // TODO(wittjosiah): Does not integrate with settings store.
24
+ // Should this be a different event?
25
+ // Should settings store be renamed to be more generic?
26
+ activatesOn: Events.SetupSettings,
27
+ activate: PresenterState,
28
+ }),
29
+ defineModule({
30
+ id: `${meta.id}/module/translations`,
31
+ activatesOn: Events.SetupTranslations,
32
+ activate: () => contributes(Capabilities.Translations, translations),
33
+ }),
34
+ defineModule({
35
+ id: `${meta.id}/module/react-surface`,
36
+ activatesOn: Events.SetupReactSurface,
37
+ activate: ReactSurface,
38
+ }),
39
+ defineModule({
40
+ id: `${meta.id}/module/intent-resolver`,
41
+ activatesOn: Events.SetupIntentResolver,
42
+ activate: IntentResolver,
43
+ }),
44
+ defineModule({
45
+ id: `${meta.id}/module/app-graph-builder`,
46
+ activatesOn: Events.SetupAppGraph,
47
+ activate: AppGraphBuilder,
48
+ }),
49
+ ]);
@@ -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
+ };
@@ -5,7 +5,7 @@
5
5
  import { Play, X, CaretDoubleLeft, CaretDoubleRight, CaretLeft, CaretRight } from '@phosphor-icons/react';
6
6
  import React, { type FC, useEffect } from 'react';
7
7
 
8
- import { Button, useControlledValue } from '@dxos/react-ui';
8
+ import { Button, useControlledState } from '@dxos/react-ui';
9
9
  import { getSize, mx } from '@dxos/react-ui-theme';
10
10
 
11
11
  export type PagerProps = {
@@ -17,7 +17,7 @@ export type PagerProps = {
17
17
  };
18
18
 
19
19
  export const Pager = ({ index: controlledIndex = 0, count = 0, keys, onChange, onExit }: PagerProps) => {
20
- const [index, setIndex] = useControlledValue(controlledIndex);
20
+ const [index, setIndex] = useControlledState(controlledIndex);
21
21
  useEffect(() => {
22
22
  onChange?.(index);
23
23
  }, [index]);
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React, { type FC, useContext, useState } from 'react';
6
6
 
7
- import { Surface, useIntentDispatcher, useResolvePlugin, parseLayoutPlugin, createIntent } from '@dxos/app-framework';
7
+ import { Surface, createIntent, useLayout, useIntentDispatcher } from '@dxos/app-framework';
8
8
  import { type CollectionType } from '@dxos/plugin-space/types';
9
9
  import { Main } from '@dxos/react-ui';
10
10
  import {
@@ -21,8 +21,8 @@ const PresenterMain: FC<{ collection: CollectionType }> = ({ collection }) => {
21
21
  const [slide, setSlide] = useState(0);
22
22
 
23
23
  // TODO(burdon): Should not depend on split screen.
24
- const layoutPlugin = useResolvePlugin(parseLayoutPlugin);
25
- const fullscreen = layoutPlugin?.provides.layout.layoutMode === 'fullscreen';
24
+ const layout = useLayout();
25
+ const fullscreen = layout.mode === 'fullscreen';
26
26
  const { running } = useContext(PresenterContext);
27
27
 
28
28
  // TODO(burdon): Currently conflates fullscreen and running.
@@ -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
  };
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React, { type FC } from 'react';
6
6
 
7
- import { useIntentDispatcher, useResolvePlugin, parseLayoutPlugin, createIntent } from '@dxos/app-framework';
7
+ import { createIntent, useLayout, useIntentDispatcher } from '@dxos/app-framework';
8
8
  import { type DocumentType } from '@dxos/plugin-markdown/types';
9
9
  import { Main } from '@dxos/react-ui';
10
10
  import { topbarBlockPaddingStart, fixedInsetFlexLayout, bottombarBlockPaddingEnd } from '@dxos/react-ui-theme';
@@ -13,7 +13,8 @@ import { RevealPlayer } from './Reveal';
13
13
  import { PresenterAction } from '../types';
14
14
 
15
15
  const PresenterMain: FC<{ document: DocumentType }> = ({ document }) => {
16
- const fullscreen = useResolvePlugin(parseLayoutPlugin)?.provides.layout.layoutMode === 'fullscreen';
16
+ const layout = useLayout();
17
+ const fullscreen = layout.mode === 'fullscreen';
17
18
  const { dispatchPromise: dispatch } = useIntentDispatcher();
18
19
 
19
20
  return (
package/src/index.ts CHANGED
@@ -2,10 +2,8 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { PresenterPlugin } from './PresenterPlugin';
6
-
7
- export default PresenterPlugin;
8
-
5
+ export { PresenterCapabilities } from './capabilities';
9
6
  export * from './components';
10
7
 
8
+ export * from './meta';
11
9
  export * from './PresenterPlugin';
package/src/meta.ts CHANGED
@@ -6,7 +6,7 @@ import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
7
  export const PRESENTER_PLUGIN = 'dxos.org/plugin/presenter';
8
8
 
9
- export default {
9
+ export const meta = {
10
10
  id: PRESENTER_PLUGIN,
11
11
  name: 'Presenter',
12
12
  description: 'Present documents as slideshows.',
package/src/types.ts CHANGED
@@ -4,13 +4,6 @@
4
4
 
5
5
  import { type Context, createContext } from 'react';
6
6
 
7
- import type {
8
- GraphBuilderProvides,
9
- IntentResolverProvides,
10
- SettingsProvides,
11
- SurfaceProvides,
12
- TranslationsProvides,
13
- } from '@dxos/app-framework';
14
7
  import { S } from '@dxos/echo-schema';
15
8
  import { DocumentType } from '@dxos/plugin-markdown/types';
16
9
  import { CollectionType } from '@dxos/plugin-space/types';
@@ -44,12 +37,10 @@ export const PresenterContext: Context<PresenterContextType> = createContext<Pre
44
37
  stop: () => {},
45
38
  });
46
39
 
47
- export type PresenterSettingsProps = {
48
- presentCollections?: boolean;
49
- };
40
+ export const PresenterSettingsSchema = S.mutable(
41
+ S.Struct({
42
+ presentCollections: S.optional(S.Boolean),
43
+ }),
44
+ );
50
45
 
51
- export type PresenterPluginProvides = SurfaceProvides &
52
- IntentResolverProvides &
53
- GraphBuilderProvides &
54
- TranslationsProvides &
55
- SettingsProvides<PresenterSettingsProps>;
46
+ export type PresenterSettingsProps = S.Schema.Type<typeof PresenterSettingsSchema>;