@dxos/plugin-presenter 0.8.4-main.72ec0f3 → 0.8.4-main.937b3ca
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/CollectionPresenterContainer-IHDZWP3U.mjs +176 -0
- package/dist/lib/browser/CollectionPresenterContainer-IHDZWP3U.mjs.map +7 -0
- package/dist/lib/browser/DocumentPresenterContainer-74M6XAAI.mjs +173 -0
- package/dist/lib/browser/DocumentPresenterContainer-74M6XAAI.mjs.map +7 -0
- package/dist/lib/browser/{MarkdownSlide-MEXR54L5.mjs → MarkdownSlide-GIYJABHE.mjs} +54 -77
- package/dist/lib/browser/MarkdownSlide-GIYJABHE.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-2QAQR34J.mjs +112 -0
- package/dist/lib/browser/app-graph-builder-2QAQR34J.mjs.map +7 -0
- package/dist/lib/browser/chunk-4PZXJXBO.mjs +50 -0
- package/dist/lib/browser/chunk-4PZXJXBO.mjs.map +7 -0
- package/dist/lib/browser/chunk-5MC4V23G.mjs +38 -0
- package/dist/lib/browser/chunk-5MC4V23G.mjs.map +7 -0
- package/dist/lib/browser/chunk-GM4KOXJY.mjs +41 -0
- package/dist/lib/browser/chunk-GM4KOXJY.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TMTUZQCK.mjs → chunk-VQVZVXPJ.mjs} +1 -1
- package/dist/lib/browser/chunk-VQVZVXPJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +23 -30
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-S4T6X72R.mjs → react-surface-2VP2M4Z7.mjs} +24 -18
- package/dist/lib/browser/react-surface-2VP2M4Z7.mjs.map +7 -0
- package/dist/lib/browser/settings-RDHXCCT4.mjs +31 -0
- package/dist/lib/browser/settings-RDHXCCT4.mjs.map +7 -0
- package/dist/types/src/PresenterPlugin.d.ts +2 -1
- package/dist/types/src/PresenterPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +3 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +7 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +9 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/CollectionPresenterContainer.d.ts +4 -4
- package/dist/types/src/components/CollectionPresenterContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSlide.d.ts +4 -3
- package/dist/types/src/components/MarkdownSlide.d.ts.map +1 -1
- package/dist/types/src/components/Presenter/Pager.d.ts +1 -1
- package/dist/types/src/components/Presenter/Pager.d.ts.map +1 -1
- package/dist/types/src/components/PresenterSettings.d.ts +4 -2
- package/dist/types/src/components/PresenterSettings.d.ts.map +1 -1
- package/dist/types/src/components/RevealPlayer/RevealPlayer.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +20 -19
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +35 -26
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/useExitPresenter.d.ts +2 -3
- package/dist/types/src/useExitPresenter.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +45 -40
- package/src/PresenterPlugin.tsx +8 -23
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +105 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +3 -5
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +70 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +30 -0
- package/src/components/CollectionPresenterContainer.tsx +12 -13
- package/src/components/DocumentPresenterContainer.tsx +3 -3
- package/src/components/Markdown/Container.tsx +1 -1
- package/src/components/MarkdownSlide.tsx +6 -2
- package/src/components/Presenter/Layout.tsx +1 -1
- package/src/components/Presenter/Pager.tsx +2 -2
- package/src/components/PresenterSettings.tsx +7 -2
- package/src/components/RevealPlayer/RevealPlayer.tsx +4 -1
- package/src/meta.ts +2 -2
- package/src/types.ts +14 -6
- package/src/useExitPresenter.ts +22 -24
- package/dist/lib/browser/CollectionPresenterContainer-4JFW3EKV.mjs +0 -199
- package/dist/lib/browser/CollectionPresenterContainer-4JFW3EKV.mjs.map +0 -7
- package/dist/lib/browser/DocumentPresenterContainer-SX32NAEH.mjs +0 -183
- package/dist/lib/browser/DocumentPresenterContainer-SX32NAEH.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSlide-MEXR54L5.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-UJEKUKAP.mjs +0 -106
- package/dist/lib/browser/app-graph-builder-UJEKUKAP.mjs.map +0 -7
- package/dist/lib/browser/chunk-BJWK5GQV.mjs +0 -38
- package/dist/lib/browser/chunk-BJWK5GQV.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q3H4KEFB.mjs +0 -41
- package/dist/lib/browser/chunk-Q3H4KEFB.mjs.map +0 -7
- package/dist/lib/browser/chunk-TMTUZQCK.mjs.map +0 -7
- package/dist/lib/browser/chunk-VRRPVTKA.mjs +0 -39
- package/dist/lib/browser/chunk-VRRPVTKA.mjs.map +0 -7
- package/dist/lib/browser/react-surface-S4T6X72R.mjs.map +0 -7
- package/dist/lib/browser/settings-57TUVRW3.mjs +0 -22
- package/dist/lib/browser/settings-57TUVRW3.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -117
- package/src/capabilities/react-surface.tsx +0 -63
- package/src/capabilities/settings.ts +0 -19
package/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-presenter",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.937b3ca",
|
|
4
4
|
"description": "Braneframe presenter plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
10
14
|
"type": "module",
|
|
11
15
|
"exports": {
|
|
12
16
|
".": {
|
|
17
|
+
"browser": "./dist/lib/browser/index.mjs",
|
|
13
18
|
"source": "./src/index.ts",
|
|
14
|
-
"types": "./dist/types/src/index.d.ts"
|
|
15
|
-
"browser": "./dist/lib/browser/index.mjs"
|
|
19
|
+
"types": "./dist/types/src/index.d.ts"
|
|
16
20
|
}
|
|
17
21
|
},
|
|
18
22
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -24,8 +28,8 @@
|
|
|
24
28
|
"src"
|
|
25
29
|
],
|
|
26
30
|
"dependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
31
|
+
"@effect-atom/atom": "^0.4.13",
|
|
32
|
+
"@effect-atom/atom-react": "^0.4.6",
|
|
29
33
|
"hastscript": "^7.1.0",
|
|
30
34
|
"highlight.js": "^11.9.0",
|
|
31
35
|
"marked": "^12.0.2",
|
|
@@ -36,47 +40,48 @@
|
|
|
36
40
|
"remark-frontmatter": "^5.0.0",
|
|
37
41
|
"remark-parse-frontmatter": "^1.0.3",
|
|
38
42
|
"reveal.js": "^5.1.0",
|
|
39
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
40
|
-
"@dxos/async": "0.8.4-main.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/log": "0.8.4-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/plugin-
|
|
46
|
-
"@dxos/plugin-
|
|
47
|
-
"@dxos/plugin-
|
|
48
|
-
"@dxos/plugin-
|
|
49
|
-
"@dxos/plugin-stack": "0.8.4-main.
|
|
50
|
-
"@dxos/react-client": "0.8.4-main.
|
|
51
|
-
"@dxos/react-ui-
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
43
|
+
"@dxos/app-framework": "0.8.4-main.937b3ca",
|
|
44
|
+
"@dxos/async": "0.8.4-main.937b3ca",
|
|
45
|
+
"@dxos/effect": "0.8.4-main.937b3ca",
|
|
46
|
+
"@dxos/log": "0.8.4-main.937b3ca",
|
|
47
|
+
"@dxos/echo": "0.8.4-main.937b3ca",
|
|
48
|
+
"@dxos/operation": "0.8.4-main.937b3ca",
|
|
49
|
+
"@dxos/plugin-client": "0.8.4-main.937b3ca",
|
|
50
|
+
"@dxos/plugin-deck": "0.8.4-main.937b3ca",
|
|
51
|
+
"@dxos/plugin-markdown": "0.8.4-main.937b3ca",
|
|
52
|
+
"@dxos/plugin-graph": "0.8.4-main.937b3ca",
|
|
53
|
+
"@dxos/plugin-stack": "0.8.4-main.937b3ca",
|
|
54
|
+
"@dxos/react-client": "0.8.4-main.937b3ca",
|
|
55
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.937b3ca",
|
|
56
|
+
"@dxos/react-ui-stack": "0.8.4-main.937b3ca",
|
|
57
|
+
"@dxos/react-ui-form": "0.8.4-main.937b3ca",
|
|
58
|
+
"@dxos/schema": "0.8.4-main.937b3ca",
|
|
59
|
+
"@dxos/types": "0.8.4-main.937b3ca",
|
|
60
|
+
"@dxos/util": "0.8.4-main.937b3ca"
|
|
56
61
|
},
|
|
57
62
|
"devDependencies": {
|
|
58
|
-
"@effect-atom/atom-react": "^0.
|
|
59
|
-
"@effect/platform": "0.
|
|
60
|
-
"@types/react": "~19.2.
|
|
61
|
-
"@types/react-dom": "~19.2.
|
|
63
|
+
"@effect-atom/atom-react": "^0.4.6",
|
|
64
|
+
"@effect/platform": "0.93.6",
|
|
65
|
+
"@types/react": "~19.2.7",
|
|
66
|
+
"@types/react-dom": "~19.2.3",
|
|
62
67
|
"@types/reveal.js": "^5.0.3",
|
|
63
|
-
"effect": "3.
|
|
64
|
-
"react": "~19.2.
|
|
65
|
-
"react-dom": "~19.2.
|
|
68
|
+
"effect": "3.19.11",
|
|
69
|
+
"react": "~19.2.3",
|
|
70
|
+
"react-dom": "~19.2.3",
|
|
66
71
|
"vite": "7.1.9",
|
|
67
|
-
"@dxos/random": "0.8.4-main.
|
|
68
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
69
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
70
|
-
"@dxos/
|
|
72
|
+
"@dxos/random": "0.8.4-main.937b3ca",
|
|
73
|
+
"@dxos/react-ui": "0.8.4-main.937b3ca",
|
|
74
|
+
"@dxos/storybook-utils": "0.8.4-main.937b3ca",
|
|
75
|
+
"@dxos/ui-theme": "0.8.4-main.937b3ca"
|
|
71
76
|
},
|
|
72
77
|
"peerDependencies": {
|
|
73
|
-
"@effect-atom/atom-react": "^0.
|
|
74
|
-
"@effect/platform": "
|
|
75
|
-
"effect": "
|
|
76
|
-
"react": "
|
|
77
|
-
"react-dom": "
|
|
78
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
79
|
-
"@dxos/
|
|
78
|
+
"@effect-atom/atom-react": "^0.4.6",
|
|
79
|
+
"@effect/platform": "0.93.6",
|
|
80
|
+
"effect": "3.19.11",
|
|
81
|
+
"react": "~19.2.3",
|
|
82
|
+
"react-dom": "~19.2.3",
|
|
83
|
+
"@dxos/react-ui": "0.8.4-main.937b3ca",
|
|
84
|
+
"@dxos/ui-theme": "0.8.4-main.937b3ca"
|
|
80
85
|
},
|
|
81
86
|
"publishConfig": {
|
|
82
87
|
"access": "public"
|
package/src/PresenterPlugin.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Common, Plugin } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
7
|
import { AppGraphBuilder, PresenterSettings, ReactSurface } from './capabilities';
|
|
8
8
|
import { meta } from './meta';
|
|
@@ -11,25 +11,10 @@ import { translations } from './translations';
|
|
|
11
11
|
// TODO(burdon): Only scale markdown content.
|
|
12
12
|
// TODO(burdon): Map stack content; Slide content type (e.g., markdown, sketch, IPFS image, table, etc.)
|
|
13
13
|
|
|
14
|
-
export const PresenterPlugin =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
id: `${meta.id}/module/translations`,
|
|
22
|
-
activatesOn: Events.SetupTranslations,
|
|
23
|
-
activate: () => contributes(Capabilities.Translations, translations),
|
|
24
|
-
}),
|
|
25
|
-
defineModule({
|
|
26
|
-
id: `${meta.id}/module/react-surface`,
|
|
27
|
-
activatesOn: Events.SetupReactSurface,
|
|
28
|
-
activate: ReactSurface,
|
|
29
|
-
}),
|
|
30
|
-
defineModule({
|
|
31
|
-
id: `${meta.id}/module/app-graph-builder`,
|
|
32
|
-
activatesOn: Events.SetupAppGraph,
|
|
33
|
-
activate: AppGraphBuilder,
|
|
34
|
-
}),
|
|
35
|
-
]);
|
|
14
|
+
export const PresenterPlugin = Plugin.define(meta).pipe(
|
|
15
|
+
Common.Plugin.addSettingsModule({ activate: PresenterSettings }),
|
|
16
|
+
Common.Plugin.addTranslationsModule({ translations }),
|
|
17
|
+
Common.Plugin.addSurfaceModule({ activate: ReactSurface }),
|
|
18
|
+
Common.Plugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
19
|
+
Plugin.make,
|
|
20
|
+
);
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { Operation } from '@dxos/operation';
|
|
11
|
+
import { DeckCapabilities } from '@dxos/plugin-deck';
|
|
12
|
+
import { ATTENDABLE_PATH_SEPARATOR, DeckOperation } from '@dxos/plugin-deck/types';
|
|
13
|
+
import { GraphBuilder, type Node, NodeMatcher } from '@dxos/plugin-graph';
|
|
14
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
15
|
+
import { Collection } from '@dxos/schema';
|
|
16
|
+
|
|
17
|
+
import { meta } from '../../meta';
|
|
18
|
+
import { PresenterCapabilities, PresenterOperation } from '../../types';
|
|
19
|
+
|
|
20
|
+
/** Match nodes that can be presented (Collection or Document). */
|
|
21
|
+
const whenPresentable = (node: Node.Node) =>
|
|
22
|
+
Option.orElse(NodeMatcher.whenEchoType(Collection.Collection)(node), () =>
|
|
23
|
+
NodeMatcher.whenEchoType(Markdown.Document)(node),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export default Capability.makeModule(
|
|
27
|
+
Effect.fnUntraced(function* () {
|
|
28
|
+
const capabilities = yield* Capability.Service;
|
|
29
|
+
|
|
30
|
+
const extensions = yield* GraphBuilder.createExtension({
|
|
31
|
+
id: `${meta.id}/root`,
|
|
32
|
+
// TODO(wittjosiah): This is a hack to work around presenter previously relying on "variant". Remove.
|
|
33
|
+
match: whenPresentable,
|
|
34
|
+
connector: (object, get) => {
|
|
35
|
+
const settingsAtom = capabilities.get(PresenterCapabilities.Settings);
|
|
36
|
+
const settings = get(settingsAtom);
|
|
37
|
+
const isPresentable = settings?.presentCollections
|
|
38
|
+
? Obj.instanceOf(Collection.Collection, object) || Obj.instanceOf(Markdown.Document, object)
|
|
39
|
+
: Obj.instanceOf(Markdown.Document, object);
|
|
40
|
+
if (!isPresentable) {
|
|
41
|
+
return Effect.succeed([]);
|
|
42
|
+
}
|
|
43
|
+
const id = Obj.getDXN(object).toString();
|
|
44
|
+
return Effect.succeed([
|
|
45
|
+
{
|
|
46
|
+
id: [id, 'presenter'].join(ATTENDABLE_PATH_SEPARATOR),
|
|
47
|
+
data: { type: meta.id, object },
|
|
48
|
+
type: meta.id,
|
|
49
|
+
properties: {
|
|
50
|
+
label: 'Presenter',
|
|
51
|
+
icon: 'ph--presentation--regular',
|
|
52
|
+
disposition: 'hidden',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
]);
|
|
56
|
+
},
|
|
57
|
+
actions: (object, get) => {
|
|
58
|
+
const settingsAtom = capabilities.get(PresenterCapabilities.Settings);
|
|
59
|
+
const settings = get(settingsAtom);
|
|
60
|
+
const isPresentable = settings?.presentCollections
|
|
61
|
+
? Obj.instanceOf(Collection.Collection, object) || Obj.instanceOf(Markdown.Document, object)
|
|
62
|
+
: Obj.instanceOf(Markdown.Document, object);
|
|
63
|
+
if (!isPresentable) {
|
|
64
|
+
return Effect.succeed([]);
|
|
65
|
+
}
|
|
66
|
+
const dxn = Obj.getDXN(object);
|
|
67
|
+
const id = dxn.toString();
|
|
68
|
+
const { spaceId } = dxn.asEchoDXN()!;
|
|
69
|
+
return Effect.succeed([
|
|
70
|
+
{
|
|
71
|
+
id: `${PresenterOperation.TogglePresentation.meta.key}/${id}`,
|
|
72
|
+
// TODO(burdon): Allow function so can generate state when activated.
|
|
73
|
+
// So can set explicit fullscreen state coordinated with current presenter state.
|
|
74
|
+
data: Effect.fnUntraced(function* () {
|
|
75
|
+
const deckState = yield* Common.Capability.getAtomValue(DeckCapabilities.State);
|
|
76
|
+
const deck = deckState.decks[deckState.activeDeck];
|
|
77
|
+
const presenterId = [id, 'presenter'].join(ATTENDABLE_PATH_SEPARATOR);
|
|
78
|
+
if (!deck?.fullscreen) {
|
|
79
|
+
yield* Operation.invoke(DeckOperation.Adjust, {
|
|
80
|
+
type: 'solo--fullscreen' as const,
|
|
81
|
+
id: presenterId,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
yield* Operation.invoke(Common.LayoutOperation.Open, {
|
|
85
|
+
subject: [presenterId],
|
|
86
|
+
workspace: spaceId,
|
|
87
|
+
});
|
|
88
|
+
}),
|
|
89
|
+
properties: {
|
|
90
|
+
label: ['toggle presentation label', { ns: meta.id }],
|
|
91
|
+
icon: 'ph--presentation--regular',
|
|
92
|
+
disposition: 'list-item',
|
|
93
|
+
keyBinding: {
|
|
94
|
+
macos: 'shift+meta+p',
|
|
95
|
+
windows: 'shift+alt+p',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
]);
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return Capability.contributes(Common.Capability.AppGraphBuilder, extensions);
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
9
|
-
export const PresenterSettings = lazy(() => import('./settings'));
|
|
5
|
+
export * from './app-graph-builder';
|
|
6
|
+
export * from './react-surface';
|
|
7
|
+
export * from './settings';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import { useSettingsState } from '@dxos/app-framework/react';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
12
|
+
import { Collection } from '@dxos/schema';
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
CollectionPresenterContainer,
|
|
16
|
+
DocumentPresenterContainer,
|
|
17
|
+
MarkdownSlide,
|
|
18
|
+
PresenterSettings,
|
|
19
|
+
} from '../../components';
|
|
20
|
+
import { meta } from '../../meta';
|
|
21
|
+
import { type PresenterSettingsProps } from '../../types';
|
|
22
|
+
|
|
23
|
+
export default Capability.makeModule(() =>
|
|
24
|
+
Effect.succeed(
|
|
25
|
+
Capability.contributes(Common.Capability.ReactSurface, [
|
|
26
|
+
Common.createSurface({
|
|
27
|
+
id: `${meta.id}/document`,
|
|
28
|
+
role: 'article',
|
|
29
|
+
position: 'hoist',
|
|
30
|
+
filter: (data): data is { subject: { type: typeof meta.id; object: Markdown.Document } } =>
|
|
31
|
+
!!data.subject &&
|
|
32
|
+
typeof data.subject === 'object' &&
|
|
33
|
+
'type' in data.subject &&
|
|
34
|
+
'object' in data.subject &&
|
|
35
|
+
data.subject.type === meta.id &&
|
|
36
|
+
Obj.instanceOf(Markdown.Document, data.subject.object),
|
|
37
|
+
component: ({ data }) => <DocumentPresenterContainer document={data.subject.object} />,
|
|
38
|
+
}),
|
|
39
|
+
Common.createSurface({
|
|
40
|
+
id: `${meta.id}/collection`,
|
|
41
|
+
role: 'article',
|
|
42
|
+
position: 'hoist',
|
|
43
|
+
filter: (data): data is { subject: { type: typeof meta.id; object: Collection.Collection } } =>
|
|
44
|
+
!!data.subject &&
|
|
45
|
+
typeof data.subject === 'object' &&
|
|
46
|
+
'type' in data.subject &&
|
|
47
|
+
'object' in data.subject &&
|
|
48
|
+
data.subject.type === meta.id &&
|
|
49
|
+
Obj.instanceOf(Collection.Collection, data.subject.object),
|
|
50
|
+
component: ({ role, data }) => <CollectionPresenterContainer role={role} subject={data.subject.object} />,
|
|
51
|
+
}),
|
|
52
|
+
Common.createSurface({
|
|
53
|
+
id: `${meta.id}/slide`,
|
|
54
|
+
role: 'slide',
|
|
55
|
+
filter: (data): data is { subject: Markdown.Document } => Obj.instanceOf(Markdown.Document, data.subject),
|
|
56
|
+
component: ({ data }) => <MarkdownSlide document={data.subject} />,
|
|
57
|
+
}),
|
|
58
|
+
Common.createSurface({
|
|
59
|
+
id: `${meta.id}/plugin-settings`,
|
|
60
|
+
role: 'article',
|
|
61
|
+
filter: (data): data is { subject: Common.Capability.Settings } =>
|
|
62
|
+
Common.Capability.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
63
|
+
component: ({ data: { subject } }) => {
|
|
64
|
+
const { settings, updateSettings } = useSettingsState<PresenterSettingsProps>(subject.atom);
|
|
65
|
+
return <PresenterSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
]),
|
|
69
|
+
),
|
|
70
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
import { createKvsStore } from '@dxos/effect';
|
|
9
|
+
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
|
+
import { PresenterCapabilities, PresenterSettingsSchema } from '../../types';
|
|
12
|
+
|
|
13
|
+
export default Capability.makeModule(() =>
|
|
14
|
+
Effect.sync(() => {
|
|
15
|
+
const settingsAtom = createKvsStore({
|
|
16
|
+
key: meta.id,
|
|
17
|
+
schema: PresenterSettingsSchema,
|
|
18
|
+
defaultValue: () => ({}),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return [
|
|
22
|
+
Capability.contributes(PresenterCapabilities.Settings, settingsAtom),
|
|
23
|
+
Capability.contributes(Common.Capability.Settings, {
|
|
24
|
+
prefix: meta.id,
|
|
25
|
+
schema: PresenterSettingsSchema,
|
|
26
|
+
atom: settingsAtom,
|
|
27
|
+
}),
|
|
28
|
+
];
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { useContext, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface } from '@dxos/app-framework/react';
|
|
8
|
-
import {
|
|
7
|
+
import { Surface, type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
8
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
9
9
|
import { type Collection } from '@dxos/schema';
|
|
10
10
|
|
|
11
11
|
import { PresenterContext } from '../types';
|
|
12
12
|
import { useExitPresenter } from '../useExitPresenter';
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import { PageNumber, Pager, Layout as PresenterLayout } from './Presenter';
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
const [slide, setSlide] = useState(0);
|
|
16
|
+
type CollectionPresenterContainerProps = SurfaceComponentProps<Collection.Collection>;
|
|
18
17
|
|
|
18
|
+
const CollectionPresenterContainer = ({ role, subject: collection }: CollectionPresenterContainerProps) => {
|
|
19
|
+
const [slide, setSlide] = useState(0);
|
|
19
20
|
const { running } = useContext(PresenterContext);
|
|
20
|
-
|
|
21
21
|
const handleExit = useExitPresenter(collection);
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
|
-
<
|
|
25
|
-
<
|
|
24
|
+
<Layout.Main role={role} classNames='relative'>
|
|
25
|
+
<PresenterLayout
|
|
26
26
|
bottomRight={<PageNumber index={slide} count={collection.objects.length} />}
|
|
27
27
|
bottomLeft={
|
|
28
28
|
<Pager
|
|
@@ -34,10 +34,9 @@ const CollectionPresenterContainer: FC<{ collection: Collection.Collection }> =
|
|
|
34
34
|
/>
|
|
35
35
|
}
|
|
36
36
|
>
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</StackItem.Content>
|
|
37
|
+
<Surface role='slide' data={{ subject: collection.objects[slide] }} />
|
|
38
|
+
</PresenterLayout>
|
|
39
|
+
</Layout.Main>
|
|
41
40
|
);
|
|
42
41
|
};
|
|
43
42
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import React, { type FC } from 'react';
|
|
5
5
|
|
|
6
6
|
import { type Markdown } from '@dxos/plugin-markdown/types';
|
|
7
|
-
import {
|
|
7
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
8
8
|
|
|
9
9
|
import { useExitPresenter } from '../useExitPresenter';
|
|
10
10
|
|
|
@@ -14,9 +14,9 @@ const DocumentPresenterContainer: FC<{ document: Markdown.Document }> = ({ docum
|
|
|
14
14
|
const handleExit = useExitPresenter(document);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<
|
|
17
|
+
<Layout.Main classNames='relative'>
|
|
18
18
|
<RevealPlayer content={document.content.target?.content ?? ''} onExit={handleExit} />
|
|
19
|
-
</
|
|
19
|
+
</Layout.Main>
|
|
20
20
|
);
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -6,7 +6,7 @@ import React, { type PropsWithChildren, useState } from 'react';
|
|
|
6
6
|
import { useResizeDetector } from 'react-resize-detector';
|
|
7
7
|
|
|
8
8
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
|
-
import { mx } from '@dxos/
|
|
9
|
+
import { mx } from '@dxos/ui-theme';
|
|
10
10
|
|
|
11
11
|
export type ContainerProps = ThemedClassName<PropsWithChildren<{}>>;
|
|
12
12
|
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { type Markdown } from '@dxos/plugin-markdown/types';
|
|
8
8
|
|
|
9
9
|
import { Container, Slide } from './Markdown';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
type MarkdownSlideProps = {
|
|
12
|
+
document: Markdown.Document;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const MarkdownSlide = ({ document }: MarkdownSlideProps) => {
|
|
12
16
|
const content = document.content.target?.content;
|
|
13
17
|
if (!content) {
|
|
14
18
|
return null;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React, { type PropsWithChildren, type ReactNode } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
8
|
-
import { mx } from '@dxos/
|
|
8
|
+
import { mx } from '@dxos/ui-theme';
|
|
9
9
|
|
|
10
10
|
export type LayoutProps = ThemedClassName<
|
|
11
11
|
PropsWithChildren<{
|
|
@@ -14,8 +14,8 @@ export type PagerProps = {
|
|
|
14
14
|
onExit?: () => void;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const Pager = ({ index:
|
|
18
|
-
const [index, setIndex] = useControlledState(
|
|
17
|
+
export const Pager = ({ index: indexProp = 0, count = 0, keys, onChange, onExit }: PagerProps) => {
|
|
18
|
+
const [index, setIndex] = useControlledState(indexProp);
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
onChange?.(index);
|
|
21
21
|
}, [index]);
|
|
@@ -10,7 +10,12 @@ import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dx
|
|
|
10
10
|
import { meta } from '../meta';
|
|
11
11
|
import { type PresenterSettingsProps } from '../types';
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type PresenterSettingsComponentProps = {
|
|
14
|
+
settings: PresenterSettingsProps;
|
|
15
|
+
onSettingsChange: (fn: (current: PresenterSettingsProps) => PresenterSettingsProps) => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const PresenterSettings = ({ settings, onSettingsChange }: PresenterSettingsComponentProps) => {
|
|
14
19
|
const { t } = useTranslation(meta.id);
|
|
15
20
|
|
|
16
21
|
return (
|
|
@@ -20,7 +25,7 @@ export const PresenterSettings = ({ settings }: { settings: PresenterSettingsPro
|
|
|
20
25
|
<ControlItemInput title={t('present collections label')}>
|
|
21
26
|
<Input.Switch
|
|
22
27
|
checked={settings.presentCollections}
|
|
23
|
-
onCheckedChange={(checked) => (
|
|
28
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, presentCollections: !!checked }))}
|
|
24
29
|
/>
|
|
25
30
|
</ControlItemInput>
|
|
26
31
|
</ControlGroup>
|
|
@@ -18,7 +18,7 @@ import RevealHighlight from 'reveal.js/plugin/highlight/highlight';
|
|
|
18
18
|
import RevealMarkdown from 'reveal.js/plugin/markdown/plugin.js';
|
|
19
19
|
|
|
20
20
|
import { type ThemedClassName, useAsyncEffect } from '@dxos/react-ui';
|
|
21
|
-
import { mx } from '@dxos/
|
|
21
|
+
import { mx } from '@dxos/ui-theme';
|
|
22
22
|
|
|
23
23
|
const styles = `
|
|
24
24
|
<style type="text/css">
|
|
@@ -91,6 +91,9 @@ export const RevealPlayer = ({ classNames, content, slide, fullscreen = true, on
|
|
|
91
91
|
slideNumber: false,
|
|
92
92
|
embedded: true,
|
|
93
93
|
|
|
94
|
+
// Disable autoplay to prevent errors in headless environments (e.g., CI).
|
|
95
|
+
autoPlayMedia: false,
|
|
96
|
+
|
|
94
97
|
// TODO(burdon): Speaker view requires server to serve popout window.
|
|
95
98
|
// https://revealjs.com/speaker-view
|
|
96
99
|
showNotes: false,
|
package/src/meta.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'dxos.org/plugin/presenter',
|
|
10
10
|
name: 'Presenter',
|
|
11
11
|
description: trim`
|
package/src/types.ts
CHANGED
|
@@ -2,27 +2,31 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
5
6
|
import * as Schema from 'effect/Schema';
|
|
6
7
|
import { type Context, createContext } from 'react';
|
|
7
8
|
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
import { Operation } from '@dxos/operation';
|
|
8
11
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
9
12
|
import { Collection } from '@dxos/schema';
|
|
10
13
|
|
|
11
14
|
import { meta } from './meta';
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
const PRESENTER_ACTION = `${meta.id}/action`;
|
|
16
|
+
const PRESENTER_OPERATION = `${meta.id}/operation`;
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
// TODO(wittjosiah): This appears to be unused.
|
|
19
|
+
export namespace PresenterOperation {
|
|
20
|
+
export const TogglePresentation = Operation.make({
|
|
21
|
+
meta: { key: `${PRESENTER_OPERATION}/toggle-presentation`, name: 'Toggle Presentation' },
|
|
22
|
+
schema: {
|
|
19
23
|
input: Schema.Struct({
|
|
20
24
|
object: Schema.Union(Markdown.Document, Collection.Collection),
|
|
21
25
|
state: Schema.optional(Schema.Boolean),
|
|
22
26
|
}),
|
|
23
27
|
output: Schema.Void,
|
|
24
28
|
},
|
|
25
|
-
)
|
|
29
|
+
});
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
export type PresenterContextType = {
|
|
@@ -44,3 +48,7 @@ export const PresenterSettingsSchema = Schema.mutable(
|
|
|
44
48
|
);
|
|
45
49
|
|
|
46
50
|
export type PresenterSettingsProps = Schema.Schema.Type<typeof PresenterSettingsSchema>;
|
|
51
|
+
|
|
52
|
+
export namespace PresenterCapabilities {
|
|
53
|
+
export const Settings = Capability.make<Atom.Writable<PresenterSettingsProps>>(`${meta.id}/capability/settings`);
|
|
54
|
+
}
|