@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.
- package/dist/lib/browser/{MarkdownSlide-4FZ3XIH5.mjs → MarkdownSlide-5NYXG5SC.mjs} +2 -2
- package/dist/lib/browser/MarkdownSlide-5NYXG5SC.mjs.map +7 -0
- package/dist/lib/browser/{PresenterMain-FUIXINMC.mjs → PresenterMain-2RSALOUX.mjs} +14 -32
- package/dist/lib/browser/PresenterMain-2RSALOUX.mjs.map +7 -0
- package/dist/lib/browser/{RevealMain-YOFOFZJE.mjs → RevealMain-SWCWANYN.mjs} +13 -28
- package/dist/lib/browser/RevealMain-SWCWANYN.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-6U7WTJKG.mjs +54 -0
- package/dist/lib/browser/app-graph-builder-6U7WTJKG.mjs.map +7 -0
- package/dist/lib/browser/chunk-MSAMS5TA.mjs +16 -0
- package/dist/lib/browser/chunk-MSAMS5TA.mjs.map +7 -0
- package/dist/lib/browser/chunk-P2BIPL4V.mjs +31 -0
- package/dist/lib/browser/chunk-P2BIPL4V.mjs.map +7 -0
- package/dist/lib/browser/{chunk-67PDV7KN.mjs → chunk-Q5U3VOZB.mjs} +3 -3
- package/dist/lib/browser/chunk-Q5U3VOZB.mjs.map +7 -0
- package/dist/lib/browser/chunk-SFMK6EE3.mjs +39 -0
- package/dist/lib/browser/chunk-SFMK6EE3.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +60 -188
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-CAYS4SCJ.mjs +46 -0
- package/dist/lib/browser/intent-resolver-CAYS4SCJ.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-A3AXJRTF.mjs +30 -0
- package/dist/lib/browser/react-context-A3AXJRTF.mjs.map +7 -0
- package/dist/lib/browser/react-surface-U7AXT65E.mjs +58 -0
- package/dist/lib/browser/react-surface-U7AXT65E.mjs.map +7 -0
- package/dist/lib/browser/settings-L73ZKGLV.mjs +22 -0
- package/dist/lib/browser/settings-L73ZKGLV.mjs.map +7 -0
- package/dist/lib/browser/state-IGJRHRIA.mjs +18 -0
- package/dist/lib/browser/state-IGJRHRIA.mjs.map +7 -0
- package/dist/types/src/PresenterPlugin.d.ts +1 -3
- package/dist/types/src/PresenterPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +8 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +188 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context.d.ts +8 -0
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +4 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/components/PresenterMain.d.ts.map +1 -1
- package/dist/types/src/components/RevealMain.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +21 -6
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +21 -29
- package/src/PresenterPlugin.tsx +47 -146
- package/src/capabilities/app-graph-builder.ts +51 -0
- package/src/capabilities/capabilities.ts +13 -0
- package/src/capabilities/index.ts +14 -0
- package/src/capabilities/intent-resolver.ts +42 -0
- package/src/capabilities/react-context.tsx +31 -0
- package/src/capabilities/react-surface.tsx +48 -0
- package/src/capabilities/settings.ts +19 -0
- package/src/capabilities/state.ts +17 -0
- package/src/components/MarkdownSlide.tsx +1 -1
- package/src/components/PresenterMain.tsx +7 -29
- package/src/components/RevealMain.tsx +7 -18
- package/src/index.ts +2 -4
- package/src/meta.ts +1 -1
- package/src/types.ts +24 -17
- package/dist/lib/browser/MarkdownSlide-4FZ3XIH5.mjs.map +0 -7
- package/dist/lib/browser/PresenterMain-FUIXINMC.mjs.map +0 -7
- package/dist/lib/browser/RevealMain-YOFOFZJE.mjs.map +0 -7
- package/dist/lib/browser/chunk-67PDV7KN.mjs.map +0 -7
- package/dist/lib/browser/chunk-RXCQGKK4.mjs +0 -20
- package/dist/lib/browser/chunk-RXCQGKK4.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/meta.mjs.map +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
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,
|
|
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"}
|
package/dist/types/src/meta.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export declare const PRESENTER_PLUGIN = "dxos.org/plugin/presenter";
|
|
2
|
-
declare const
|
|
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
|
|
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
|
|
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
|
|
10
|
-
presentCollections
|
|
11
|
-
}
|
|
12
|
-
export type
|
|
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,
|
|
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.
|
|
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/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/plugin-
|
|
53
|
-
"@dxos/plugin-
|
|
54
|
-
"@dxos/plugin-stack": "0.7.
|
|
55
|
-
"@dxos/react-client": "0.7.
|
|
56
|
-
"@dxos/react-ui-form": "0.7.
|
|
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/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
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.
|
|
77
|
-
"@dxos/react-ui-theme": "0.7.
|
|
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"
|
package/src/PresenterPlugin.tsx
CHANGED
|
@@ -2,156 +2,57 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { definePlugin, defineModule, Events, contributes, Capabilities } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from '
|
|
15
|
-
import {
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
translations
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
}
|