@dxos/plugin-presenter 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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-BLVWTH3U.mjs → MarkdownSlide-GIYJABHE.mjs} +56 -79
- 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-UIAHN2NJ.mjs → react-surface-2VP2M4Z7.mjs} +26 -20
- 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 +5 -5
- 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 -39
- 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 +13 -14
- package/src/components/DocumentPresenterContainer.tsx +3 -3
- package/src/components/Markdown/Container.tsx +2 -2
- package/src/components/Markdown/theme.ts +2 -2
- package/src/components/MarkdownSlide.tsx +6 -2
- package/src/components/Presenter/Layout.tsx +1 -1
- package/src/components/Presenter/Pager.tsx +53 -18
- package/src/components/PresenterSettings.tsx +7 -2
- package/src/components/RevealPlayer/RevealPlayer.tsx +15 -5
- package/src/meta.ts +2 -2
- package/src/types.ts +16 -8
- package/src/useExitPresenter.ts +24 -24
- package/dist/lib/browser/CollectionPresenterContainer-ASH2TGJR.mjs +0 -191
- package/dist/lib/browser/CollectionPresenterContainer-ASH2TGJR.mjs.map +0 -7
- package/dist/lib/browser/DocumentPresenterContainer-F42V4KAL.mjs +0 -183
- package/dist/lib/browser/DocumentPresenterContainer-F42V4KAL.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSlide-BLVWTH3U.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-UGCZOBA6.mjs +0 -106
- package/dist/lib/browser/app-graph-builder-UGCZOBA6.mjs.map +0 -7
- package/dist/lib/browser/chunk-EOT6RIHJ.mjs +0 -39
- package/dist/lib/browser/chunk-EOT6RIHJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-TMTUZQCK.mjs.map +0 -7
- package/dist/lib/browser/chunk-UVGTHJUO.mjs +0 -36
- package/dist/lib/browser/chunk-UVGTHJUO.mjs.map +0 -7
- package/dist/lib/browser/chunk-WWKBVJB3.mjs +0 -41
- package/dist/lib/browser/chunk-WWKBVJB3.mjs.map +0 -7
- package/dist/lib/browser/react-surface-UIAHN2NJ.mjs.map +0 -7
- package/dist/lib/browser/settings-RZWQTJI2.mjs +0 -22
- package/dist/lib/browser/settings-RZWQTJI2.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 -113
- 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.bc674ce",
|
|
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,46 +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/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/plugin-
|
|
46
|
-
"@dxos/plugin-
|
|
47
|
-
"@dxos/plugin-
|
|
48
|
-
"@dxos/plugin-
|
|
49
|
-
"@dxos/react-client": "0.8.4-main.
|
|
50
|
-
"@dxos/react-ui-form": "0.8.4-main.
|
|
51
|
-
"@dxos/plugin-
|
|
52
|
-
"@dxos/react-ui-
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
43
|
+
"@dxos/app-framework": "0.8.4-main.bc674ce",
|
|
44
|
+
"@dxos/effect": "0.8.4-main.bc674ce",
|
|
45
|
+
"@dxos/log": "0.8.4-main.bc674ce",
|
|
46
|
+
"@dxos/echo": "0.8.4-main.bc674ce",
|
|
47
|
+
"@dxos/operation": "0.8.4-main.bc674ce",
|
|
48
|
+
"@dxos/async": "0.8.4-main.bc674ce",
|
|
49
|
+
"@dxos/plugin-deck": "0.8.4-main.bc674ce",
|
|
50
|
+
"@dxos/plugin-client": "0.8.4-main.bc674ce",
|
|
51
|
+
"@dxos/plugin-graph": "0.8.4-main.bc674ce",
|
|
52
|
+
"@dxos/plugin-markdown": "0.8.4-main.bc674ce",
|
|
53
|
+
"@dxos/react-client": "0.8.4-main.bc674ce",
|
|
54
|
+
"@dxos/react-ui-form": "0.8.4-main.bc674ce",
|
|
55
|
+
"@dxos/plugin-stack": "0.8.4-main.bc674ce",
|
|
56
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.bc674ce",
|
|
57
|
+
"@dxos/schema": "0.8.4-main.bc674ce",
|
|
58
|
+
"@dxos/react-ui-stack": "0.8.4-main.bc674ce",
|
|
59
|
+
"@dxos/types": "0.8.4-main.bc674ce",
|
|
60
|
+
"@dxos/util": "0.8.4-main.bc674ce"
|
|
55
61
|
},
|
|
56
62
|
"devDependencies": {
|
|
57
|
-
"@effect-
|
|
58
|
-
"@effect/platform": "0.
|
|
59
|
-
"@types/react": "~19.2.
|
|
60
|
-
"@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",
|
|
61
67
|
"@types/reveal.js": "^5.0.3",
|
|
62
|
-
"effect": "3.
|
|
63
|
-
"react": "~19.2.
|
|
64
|
-
"react-dom": "~19.2.
|
|
68
|
+
"effect": "3.19.11",
|
|
69
|
+
"react": "~19.2.3",
|
|
70
|
+
"react-dom": "~19.2.3",
|
|
65
71
|
"vite": "7.1.9",
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
72
|
+
"@dxos/random": "0.8.4-main.bc674ce",
|
|
73
|
+
"@dxos/react-ui": "0.8.4-main.bc674ce",
|
|
74
|
+
"@dxos/ui-theme": "0.8.4-main.bc674ce",
|
|
75
|
+
"@dxos/storybook-utils": "0.8.4-main.bc674ce"
|
|
70
76
|
},
|
|
71
77
|
"peerDependencies": {
|
|
72
|
-
"@effect-
|
|
73
|
-
"@effect/platform": "
|
|
74
|
-
"effect": "
|
|
75
|
-
"react": "
|
|
76
|
-
"react-dom": "
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/react-ui
|
|
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/ui-theme": "0.8.4-main.bc674ce",
|
|
84
|
+
"@dxos/react-ui": "0.8.4-main.bc674ce"
|
|
79
85
|
},
|
|
80
86
|
"publishConfig": {
|
|
81
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';
|
|
8
|
-
import {
|
|
9
|
-
import { type
|
|
7
|
+
import { Surface, type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
8
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
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: DataType.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
|
|
|
@@ -36,7 +36,7 @@ export const Container = ({ children, classNames }: ContainerProps) => {
|
|
|
36
36
|
// https://www.npmjs.com/package/react-markdown
|
|
37
37
|
return (
|
|
38
38
|
<div ref={containerRef} className={mx('flex grow relative overflow-hidden bg-attention', classNames)}>
|
|
39
|
-
<div className={mx('flex
|
|
39
|
+
<div className={mx('flex is-full bs-full overflow-hidden absolute')} style={props}>
|
|
40
40
|
{width && height && children}
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export const theme = {
|
|
8
8
|
root: 'bg-attention leading-relaxed font-mono',
|
|
9
9
|
|
|
10
|
-
padding: '
|
|
10
|
+
padding: 'pli-40 plb-16 gap-8',
|
|
11
11
|
|
|
12
12
|
nodes: {
|
|
13
13
|
h1: 'text-[80px] text-accentText',
|
|
@@ -20,7 +20,7 @@ export const theme = {
|
|
|
20
20
|
ol: 'my-[16px] ml-24 leading-relaxed list-decimal',
|
|
21
21
|
li: 'pl-6 text-[48px]',
|
|
22
22
|
|
|
23
|
-
pre: '
|
|
23
|
+
pre: 'is-full mx-0 my-[32px] p-0 __border-l-[16px] bg-inputSurface p-4 __whitespace-pre-line',
|
|
24
24
|
code: 'p-0 text-[40px]',
|
|
25
25
|
},
|
|
26
26
|
};
|
|
@@ -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<{
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { IconButton, useControlledState } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
9
|
export type PagerProps = {
|
|
10
10
|
index?: number;
|
|
@@ -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]);
|
|
@@ -76,18 +76,46 @@ export const Pager = ({ index: indexParam = 0, count = 0, keys, onChange, onExit
|
|
|
76
76
|
|
|
77
77
|
return (
|
|
78
78
|
<div className='flex items-center text-neutral-500'>
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
79
|
+
<IconButton
|
|
80
|
+
icon='ph--caret-double-left--regular'
|
|
81
|
+
size={6}
|
|
82
|
+
label='Jump to first'
|
|
83
|
+
iconOnly
|
|
84
|
+
noTooltip
|
|
85
|
+
variant='ghost'
|
|
86
|
+
classNames='p-0'
|
|
87
|
+
onClick={() => onChange?.(0)}
|
|
88
|
+
/>
|
|
89
|
+
<IconButton
|
|
90
|
+
icon='ph--caret-left--regular'
|
|
91
|
+
size={6}
|
|
92
|
+
label='Previous'
|
|
93
|
+
iconOnly
|
|
94
|
+
noTooltip
|
|
95
|
+
variant='ghost'
|
|
96
|
+
classNames='p-0'
|
|
97
|
+
onClick={() => handleChangeIndex(-1)}
|
|
98
|
+
/>
|
|
99
|
+
<IconButton
|
|
100
|
+
icon='ph--caret-right--regular'
|
|
101
|
+
size={6}
|
|
102
|
+
label='Next'
|
|
103
|
+
iconOnly
|
|
104
|
+
noTooltip
|
|
105
|
+
variant='ghost'
|
|
106
|
+
classNames='p-0'
|
|
107
|
+
onClick={() => handleChangeIndex(1)}
|
|
108
|
+
/>
|
|
109
|
+
<IconButton
|
|
110
|
+
icon='ph--caret-double-right--regular'
|
|
111
|
+
size={6}
|
|
112
|
+
label='Jump to last'
|
|
113
|
+
iconOnly
|
|
114
|
+
noTooltip
|
|
115
|
+
variant='ghost'
|
|
116
|
+
classNames='p-0'
|
|
117
|
+
onClick={() => onChange?.(count - 1)}
|
|
118
|
+
/>
|
|
91
119
|
</div>
|
|
92
120
|
);
|
|
93
121
|
};
|
|
@@ -113,8 +141,15 @@ export const PageNumber = ({ index = 0, count = 1 }: PageNumberProps) => {
|
|
|
113
141
|
|
|
114
142
|
export const StartButton = ({ running, onClick }: { running?: boolean; onClick?: (start: boolean) => void }) => {
|
|
115
143
|
return (
|
|
116
|
-
<
|
|
117
|
-
{
|
|
118
|
-
|
|
144
|
+
<IconButton
|
|
145
|
+
icon={running ? 'ph--x--regular' : 'ph--play--regular'}
|
|
146
|
+
size={6}
|
|
147
|
+
label={running ? 'Stop' : 'Play'}
|
|
148
|
+
iconOnly
|
|
149
|
+
noTooltip
|
|
150
|
+
variant='ghost'
|
|
151
|
+
classNames='p-0'
|
|
152
|
+
onClick={() => onClick?.(!running)}
|
|
153
|
+
/>
|
|
119
154
|
);
|
|
120
155
|
};
|