@dxos/plugin-presenter 0.8.4-main.67995b8 → 0.8.4-main.6fa680abb7
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-IFILQWPJ.mjs +52 -0
- package/dist/lib/browser/CollectionPresenterContainer-IFILQWPJ.mjs.map +7 -0
- package/dist/lib/browser/DocumentPresenterContainer-PMS5FH4A.mjs +28 -0
- package/dist/lib/browser/DocumentPresenterContainer-PMS5FH4A.mjs.map +7 -0
- package/dist/lib/browser/MarkdownSlide-EGVUVP2N.mjs +23 -0
- package/dist/lib/browser/MarkdownSlide-EGVUVP2N.mjs.map +7 -0
- package/dist/lib/browser/PresenterSettings-H3ELNHGX.mjs +31 -0
- package/dist/lib/browser/PresenterSettings-H3ELNHGX.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-T2BJ5XUZ.mjs +105 -0
- package/dist/lib/browser/app-graph-builder-T2BJ5XUZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-GQBEHCZW.mjs +42 -0
- package/dist/lib/browser/chunk-GQBEHCZW.mjs.map +7 -0
- package/dist/lib/browser/chunk-PBH33Y3O.mjs +50 -0
- package/dist/lib/browser/chunk-PBH33Y3O.mjs.map +7 -0
- package/dist/lib/browser/chunk-PYBNNNNK.mjs +18 -0
- package/dist/lib/browser/chunk-PYBNNNNK.mjs.map +7 -0
- package/dist/lib/browser/chunk-YNKUN3CU.mjs +485 -0
- package/dist/lib/browser/chunk-YNKUN3CU.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +39 -40
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-XXUUAQNP.mjs +67 -0
- package/dist/lib/browser/react-surface-XXUUAQNP.mjs.map +7 -0
- package/dist/lib/browser/settings-FBHSLR6P.mjs +32 -0
- package/dist/lib/browser/settings-FBHSLR6P.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 +10 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/Markdown/Panel.d.ts +8 -0
- package/dist/types/src/components/Markdown/Panel.d.ts.map +1 -0
- package/dist/types/src/components/Markdown/Panel.stories.d.ts +18 -0
- package/dist/types/src/components/Markdown/Panel.stories.d.ts.map +1 -0
- package/dist/types/src/components/Markdown/Slide.d.ts +1 -3
- package/dist/types/src/components/Markdown/Slide.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/Slide.stories.d.ts +11 -12
- package/dist/types/src/components/Markdown/Slide.stories.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/index.d.ts +1 -1
- package/dist/types/src/components/Markdown/index.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/Presenter/Pager.stories.d.ts +12 -4
- package/dist/types/src/components/Presenter/Pager.stories.d.ts.map +1 -1
- package/dist/types/src/components/RevealPlayer/RevealPlayer.d.ts.map +1 -1
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts +18 -2
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -10
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.d.ts +7 -0
- package/dist/types/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.d.ts.map +1 -0
- package/dist/types/src/containers/CollectionPresenterContainer/index.d.ts +3 -0
- package/dist/types/src/containers/CollectionPresenterContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components/MarkdownSlide.d.ts → containers/DocumentPresenterContainer/DocumentPresenterContainer.d.ts} +2 -3
- package/dist/types/src/containers/DocumentPresenterContainer/DocumentPresenterContainer.d.ts.map +1 -0
- package/dist/types/src/containers/DocumentPresenterContainer/index.d.ts +3 -0
- package/dist/types/src/containers/DocumentPresenterContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSlide/MarkdownSlide.d.ts +8 -0
- package/dist/types/src/containers/MarkdownSlide/MarkdownSlide.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSlide/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownSlide/index.d.ts.map +1 -0
- package/dist/types/src/containers/PresenterSettings/PresenterSettings.d.ts +8 -0
- package/dist/types/src/containers/PresenterSettings/PresenterSettings.d.ts.map +1 -0
- package/dist/types/src/containers/PresenterSettings/index.d.ts +3 -0
- package/dist/types/src/containers/PresenterSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +36 -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 +48 -41
- package/src/PresenterPlugin.tsx +9 -24
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +112 -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 +71 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +31 -0
- package/src/components/Markdown/{Container.stories.tsx → Panel.stories.tsx} +24 -23
- package/src/components/Markdown/{Container.tsx → Panel.tsx} +5 -5
- package/src/components/Markdown/Slide.stories.tsx +12 -8
- package/src/components/Markdown/Slide.tsx +12 -128
- package/src/components/Markdown/index.ts +1 -1
- package/src/components/Markdown/styles.css +104 -0
- package/src/components/Markdown/theme.ts +5 -5
- package/src/components/Markdown/typings.d.ts +8 -0
- package/src/components/Presenter/Layout.tsx +2 -2
- package/src/components/Presenter/Pager.stories.tsx +10 -10
- package/src/components/Presenter/Pager.tsx +53 -18
- package/src/components/RevealPlayer/RevealPlayer.stories.tsx +8 -6
- package/src/components/RevealPlayer/RevealPlayer.tsx +66 -59
- package/src/components/index.ts +3 -7
- package/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.tsx +43 -0
- package/src/containers/CollectionPresenterContainer/index.ts +7 -0
- package/src/containers/DocumentPresenterContainer/DocumentPresenterContainer.tsx +23 -0
- package/src/containers/DocumentPresenterContainer/index.ts +7 -0
- package/src/{components → containers/MarkdownSlide}/MarkdownSlide.tsx +9 -7
- package/src/containers/MarkdownSlide/index.ts +7 -0
- package/src/containers/PresenterSettings/PresenterSettings.tsx +35 -0
- package/src/containers/PresenterSettings/index.ts +7 -0
- package/src/containers/index.ts +10 -0
- package/src/meta.ts +9 -6
- package/src/translations.ts +1 -0
- package/src/types.ts +18 -10
- package/src/useExitPresenter.ts +26 -24
- package/dist/lib/browser/CollectionPresenterContainer-IPDW4HZR.mjs +0 -191
- package/dist/lib/browser/CollectionPresenterContainer-IPDW4HZR.mjs.map +0 -7
- package/dist/lib/browser/DocumentPresenterContainer-LJBJM5UB.mjs +0 -185
- package/dist/lib/browser/DocumentPresenterContainer-LJBJM5UB.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSlide-KG7ESCSU.mjs +0 -336
- package/dist/lib/browser/MarkdownSlide-KG7ESCSU.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LURIPUEV.mjs +0 -77
- package/dist/lib/browser/app-graph-builder-LURIPUEV.mjs.map +0 -7
- package/dist/lib/browser/chunk-QWJM3ADC.mjs +0 -37
- package/dist/lib/browser/chunk-QWJM3ADC.mjs.map +0 -7
- package/dist/lib/browser/chunk-TANLITL2.mjs +0 -36
- package/dist/lib/browser/chunk-TANLITL2.mjs.map +0 -7
- package/dist/lib/browser/chunk-VSD5LSE5.mjs +0 -15
- package/dist/lib/browser/chunk-VSD5LSE5.mjs.map +0 -7
- package/dist/lib/browser/chunk-W4IR3DJE.mjs +0 -39
- package/dist/lib/browser/chunk-W4IR3DJE.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3SPF2ANF.mjs +0 -57
- package/dist/lib/browser/react-surface-3SPF2ANF.mjs.map +0 -7
- package/dist/lib/browser/settings-VBRYUIWN.mjs +0 -22
- package/dist/lib/browser/settings-VBRYUIWN.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/dist/types/src/components/CollectionPresenterContainer.d.ts +0 -7
- package/dist/types/src/components/CollectionPresenterContainer.d.ts.map +0 -1
- package/dist/types/src/components/DocumentPresenterContainer.d.ts +0 -7
- package/dist/types/src/components/DocumentPresenterContainer.d.ts.map +0 -1
- package/dist/types/src/components/Markdown/Container.d.ts +0 -8
- package/dist/types/src/components/Markdown/Container.d.ts.map +0 -1
- package/dist/types/src/components/Markdown/Container.stories.d.ts +0 -26
- package/dist/types/src/components/Markdown/Container.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownSlide.d.ts.map +0 -1
- package/dist/types/src/components/PresenterSettings.d.ts +0 -6
- package/dist/types/src/components/PresenterSettings.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -82
- package/src/capabilities/react-surface.tsx +0 -53
- package/src/capabilities/settings.ts +0 -19
- package/src/components/CollectionPresenterContainer.tsx +0 -43
- package/src/components/DocumentPresenterContainer.tsx +0 -22
- package/src/components/PresenterSettings.tsx +0 -26
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
// eslint-disable-next-line no-restricted-imports
|
|
6
5
|
import 'reveal.js/dist/reveal.css';
|
|
7
|
-
|
|
6
|
+
|
|
8
7
|
import 'reveal.js/dist/theme/black.css';
|
|
9
8
|
|
|
10
9
|
// https://github.com/highlightjs/highlight.js/tree/main/src/styles
|
|
@@ -13,13 +12,13 @@ import 'highlight.js/styles/tokyo-night-dark.css';
|
|
|
13
12
|
|
|
14
13
|
import hljs from 'highlight.js';
|
|
15
14
|
import typescript from 'highlight.js/lib/languages/typescript';
|
|
16
|
-
import React, {
|
|
15
|
+
import React, { useRef } from 'react';
|
|
17
16
|
import Reveal from 'reveal.js';
|
|
18
17
|
import RevealHighlight from 'reveal.js/plugin/highlight/highlight';
|
|
19
18
|
import RevealMarkdown from 'reveal.js/plugin/markdown/plugin.js';
|
|
20
19
|
|
|
21
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
22
|
-
import { mx } from '@dxos/
|
|
20
|
+
import { type ThemedClassName, useAsyncEffect } from '@dxos/react-ui';
|
|
21
|
+
import { mx } from '@dxos/ui-theme';
|
|
23
22
|
|
|
24
23
|
const styles = `
|
|
25
24
|
<style type="text/css">
|
|
@@ -72,7 +71,8 @@ export type RevealProps = ThemedClassName<{
|
|
|
72
71
|
export const RevealPlayer = ({ classNames, content, slide, fullscreen = true, onExit }: RevealProps) => {
|
|
73
72
|
const deckDivRef = useRef<HTMLDivElement>(null);
|
|
74
73
|
const deckRef = useRef<Reveal.Api | null>(null);
|
|
75
|
-
|
|
74
|
+
|
|
75
|
+
useAsyncEffect(async () => {
|
|
76
76
|
if (deckRef.current) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
@@ -80,76 +80,83 @@ export const RevealPlayer = ({ classNames, content, slide, fullscreen = true, on
|
|
|
80
80
|
// Required for syntax highlighting.
|
|
81
81
|
hljs.registerLanguage('typescript', typescript);
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
83
|
+
// https://revealjs.com/react
|
|
84
|
+
// https://revealjs.com/config
|
|
85
|
+
// https://github.com/hakimel/reveal.js
|
|
86
|
+
// TODO(burdon): Fragments and scroll view steps 2 at a time (safe mode?)
|
|
87
|
+
deckRef.current = new Reveal(deckDivRef.current!, {
|
|
88
|
+
// view: 'scroll',
|
|
89
|
+
progress: false,
|
|
90
|
+
transition: 'none',
|
|
91
|
+
slideNumber: false,
|
|
92
|
+
embedded: true,
|
|
93
|
+
|
|
94
|
+
// Disable autoplay to prevent errors in headless environments (e.g., CI).
|
|
95
|
+
autoPlayMedia: false,
|
|
96
|
+
|
|
97
|
+
// TODO(burdon): Speaker view requires server to serve popout window.
|
|
98
|
+
// https://revealjs.com/speaker-view
|
|
99
|
+
showNotes: false,
|
|
100
|
+
|
|
101
|
+
// width: 1600,
|
|
102
|
+
// height: 900,
|
|
103
|
+
margin: 0.1,
|
|
104
|
+
// center: false,
|
|
105
|
+
// minScale: 0.1,
|
|
106
|
+
// maxScale: 1.4,
|
|
107
|
+
|
|
108
|
+
// https://revealjs.com/markdown
|
|
109
|
+
// TODO(burdon): Requires server to serve popout window.
|
|
110
|
+
plugins: [RevealMarkdown, RevealHighlight],
|
|
111
|
+
|
|
112
|
+
// See https://marked.js.org/using_advanced#options
|
|
113
|
+
markdown: {
|
|
114
|
+
gfm: true,
|
|
115
|
+
smartypants: true,
|
|
116
|
+
highlight: (code, language) => {
|
|
117
|
+
if (language) {
|
|
118
|
+
return hljs.highlight(code, { language }).value;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return hljs.highlightAuto(code).value;
|
|
121
122
|
},
|
|
122
|
-
}
|
|
123
|
+
},
|
|
124
|
+
});
|
|
123
125
|
|
|
124
|
-
|
|
126
|
+
await deckRef.current.initialize();
|
|
125
127
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
if (slide !== undefined) {
|
|
129
|
+
deckRef.current.slide(slide < 0 ? deckRef.current?.getTotalSlides() + slide : slide - 1);
|
|
130
|
+
}
|
|
129
131
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
});
|
|
132
|
+
deckRef.current.addKeyBinding({ keyCode: 27, key: 'Escape', description: 'Exit full screen' }, () => {
|
|
133
|
+
onExit?.();
|
|
133
134
|
});
|
|
134
135
|
|
|
135
136
|
return () => {
|
|
136
137
|
try {
|
|
137
|
-
clearTimeout(t);
|
|
138
138
|
if (deckRef.current) {
|
|
139
139
|
deckRef.current.destroy();
|
|
140
140
|
deckRef.current = null;
|
|
141
141
|
}
|
|
142
|
-
} catch
|
|
142
|
+
} catch {
|
|
143
143
|
// Ignore.
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
+
// TOOD(burdon): Trap cursor keys (otherwise tabster grabs focus.)
|
|
148
149
|
return (
|
|
149
|
-
<div
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
<div
|
|
151
|
+
className={mx(
|
|
152
|
+
'grid place-items-center w-full h-full overflow-hidden bg-black',
|
|
153
|
+
fullscreen && 'absolute inset-0',
|
|
154
|
+
classNames,
|
|
155
|
+
)}
|
|
156
|
+
>
|
|
157
|
+
<div className='relative aspect-video w-full h-full h-auto max-h-full overflow-hidden'>
|
|
158
|
+
<div ref={deckDivRef} className='absolute inset-0 reveal'>
|
|
159
|
+
{/* NOTE: Must be in head. */}
|
|
153
160
|
<style>
|
|
154
161
|
<link rel='preconnect' href='https://fonts.googleapis.com' />
|
|
155
162
|
<link rel='preconnect' href='https://fonts.gstatic.com' {...{ crossOrigin: '' }} />
|
|
@@ -159,7 +166,7 @@ export const RevealPlayer = ({ classNames, content, slide, fullscreen = true, on
|
|
|
159
166
|
/>
|
|
160
167
|
</style>
|
|
161
168
|
<div className='slides'>
|
|
162
|
-
<div className='
|
|
169
|
+
<div className='text-center!' />
|
|
163
170
|
<section {...{ 'data-markdown': [] }}>
|
|
164
171
|
<textarea {...{ 'data-template': true }} defaultValue={[styles, content].join('\n')}></textarea>
|
|
165
172
|
</section>
|
package/src/components/index.ts
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export * from './
|
|
8
|
-
|
|
9
|
-
export const MarkdownSlide = lazy(() => import('./MarkdownSlide'));
|
|
10
|
-
export const DocumentPresenterContainer = lazy(() => import('./DocumentPresenterContainer'));
|
|
11
|
-
export const CollectionPresenterContainer = lazy(() => import('./CollectionPresenterContainer'));
|
|
5
|
+
export * from './Markdown';
|
|
6
|
+
export * from './Presenter';
|
|
7
|
+
export * from './RevealPlayer';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useContext, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
9
|
+
import { type Collection } from '@dxos/echo';
|
|
10
|
+
import { Panel } from '@dxos/react-ui';
|
|
11
|
+
|
|
12
|
+
import { PageNumber, Pager, Layout as PresenterLayout } from '../../components';
|
|
13
|
+
import { PresenterContext } from '../../types';
|
|
14
|
+
import { useExitPresenter } from '../../useExitPresenter';
|
|
15
|
+
|
|
16
|
+
type CollectionPresenterContainerProps = SurfaceComponentProps<Collection.Collection>;
|
|
17
|
+
|
|
18
|
+
export const CollectionPresenterContainer = ({ role, subject: collection }: CollectionPresenterContainerProps) => {
|
|
19
|
+
const [slide, setSlide] = useState(0);
|
|
20
|
+
const { running } = useContext(PresenterContext);
|
|
21
|
+
const handleExit = useExitPresenter(collection);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Panel.Root role={role} classNames='relative'>
|
|
25
|
+
<Panel.Content asChild>
|
|
26
|
+
<PresenterLayout
|
|
27
|
+
bottomRight={<PageNumber index={slide} count={collection.objects.length} />}
|
|
28
|
+
bottomLeft={
|
|
29
|
+
<Pager
|
|
30
|
+
index={slide}
|
|
31
|
+
count={collection.objects.length}
|
|
32
|
+
keys={running}
|
|
33
|
+
onChange={setSlide}
|
|
34
|
+
onExit={handleExit}
|
|
35
|
+
/>
|
|
36
|
+
}
|
|
37
|
+
>
|
|
38
|
+
<Surface.Surface role='slide' data={{ subject: collection.objects[slide] }} />
|
|
39
|
+
</PresenterLayout>
|
|
40
|
+
</Panel.Content>
|
|
41
|
+
</Panel.Root>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type FC } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Markdown } from '@dxos/plugin-markdown/types';
|
|
8
|
+
import { Panel } from '@dxos/react-ui';
|
|
9
|
+
|
|
10
|
+
import { RevealPlayer } from '../../components';
|
|
11
|
+
import { useExitPresenter } from '../../useExitPresenter';
|
|
12
|
+
|
|
13
|
+
export const DocumentPresenterContainer: FC<{ document: Markdown.Document }> = ({ document }) => {
|
|
14
|
+
const handleExit = useExitPresenter(document);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Panel.Root classNames='relative'>
|
|
18
|
+
<Panel.Content asChild>
|
|
19
|
+
<RevealPlayer content={document.content.target?.content ?? ''} onExit={handleExit} />
|
|
20
|
+
</Panel.Content>
|
|
21
|
+
</Panel.Root>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -2,23 +2,25 @@
|
|
|
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
|
-
import {
|
|
9
|
+
import { Panel, Slide } from '../../components';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
type MarkdownSlideProps = {
|
|
12
|
+
document: Markdown.Document;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const MarkdownSlide = ({ document }: MarkdownSlideProps) => {
|
|
12
16
|
const content = document.content.target?.content;
|
|
13
17
|
if (!content) {
|
|
14
18
|
return null;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
return (
|
|
18
|
-
<
|
|
22
|
+
<Panel>
|
|
19
23
|
<Slide content={content} />
|
|
20
|
-
</
|
|
24
|
+
</Panel>
|
|
21
25
|
);
|
|
22
26
|
};
|
|
23
|
-
|
|
24
|
-
export default MarkdownSlide;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Input, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
9
|
+
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
|
+
import { type PresenterSettingsProps } from '../../types';
|
|
12
|
+
|
|
13
|
+
export type PresenterSettingsComponentProps = {
|
|
14
|
+
settings: PresenterSettingsProps;
|
|
15
|
+
onSettingsChange: (fn: (current: PresenterSettingsProps) => PresenterSettingsProps) => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const PresenterSettings = ({ settings, onSettingsChange }: PresenterSettingsComponentProps) => {
|
|
19
|
+
const { t } = useTranslation(meta.id);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Settings.Root>
|
|
23
|
+
<Settings.Section title={t('settings title', { ns: meta.id })}>
|
|
24
|
+
<Settings.Group>
|
|
25
|
+
<Settings.ItemInput title={t('present collections label')}>
|
|
26
|
+
<Input.Switch
|
|
27
|
+
checked={settings.presentCollections}
|
|
28
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, presentCollections: !!checked }))}
|
|
29
|
+
/>
|
|
30
|
+
</Settings.ItemInput>
|
|
31
|
+
</Settings.Group>
|
|
32
|
+
</Settings.Section>
|
|
33
|
+
</Settings.Root>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const CollectionPresenterContainer: ComponentType<any> = lazy(() => import('./CollectionPresenterContainer'));
|
|
8
|
+
export const DocumentPresenterContainer: ComponentType<any> = lazy(() => import('./DocumentPresenterContainer'));
|
|
9
|
+
export const MarkdownSlide: ComponentType<any> = lazy(() => import('./MarkdownSlide'));
|
|
10
|
+
export const PresenterSettings: ComponentType<any> = lazy(() => import('./PresenterSettings'));
|
package/src/meta.ts
CHANGED
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: PRESENTER_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.presenter',
|
|
11
10
|
name: 'Presenter',
|
|
12
|
-
description:
|
|
11
|
+
description: trim`
|
|
12
|
+
Transform markdown documents into interactive presentation slideshows.
|
|
13
|
+
Navigate between slides with keyboard controls and present content in full-screen mode.
|
|
14
|
+
`,
|
|
13
15
|
icon: 'ph--presentation--regular',
|
|
16
|
+
iconHue: 'indigo',
|
|
14
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-presenter',
|
|
15
18
|
};
|
package/src/translations.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -2,27 +2,31 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
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 { Collection } from '@dxos/echo';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
8
12
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
9
|
-
import { DataType } from '@dxos/schema';
|
|
10
13
|
|
|
11
|
-
import {
|
|
14
|
+
import { meta } from './meta';
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
const PRESENTER_ACTION = `${PRESENTER_PLUGIN}/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
|
-
object: Schema.Union(Markdown.Document,
|
|
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
|
+
}
|
package/src/useExitPresenter.ts
CHANGED
|
@@ -2,34 +2,36 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import { useCallback, useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { useCapability, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { LayoutOperation, getObjectPathFromObject, getSpacePath } from '@dxos/app-toolkit';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
9
11
|
import { DeckCapabilities } from '@dxos/plugin-deck';
|
|
10
|
-
import {
|
|
11
|
-
import { fullyQualifiedId, getSpace } from '@dxos/react-client/echo';
|
|
12
|
+
import { DeckOperation } from '@dxos/plugin-deck/types';
|
|
12
13
|
|
|
13
|
-
export const useExitPresenter = (object:
|
|
14
|
-
const {
|
|
15
|
-
const
|
|
14
|
+
export const useExitPresenter = (object: any) => {
|
|
15
|
+
const { invokePromise } = useOperationInvoker();
|
|
16
|
+
const stateAtom = useCapability(DeckCapabilities.State);
|
|
17
|
+
const state = useAtomValue(stateAtom);
|
|
18
|
+
|
|
19
|
+
// Compute deck from decks[activeDeck] since the getter doesn't survive spread operations.
|
|
20
|
+
const deck = useMemo(() => state.decks[state.activeDeck], [state.decks, state.activeDeck]);
|
|
16
21
|
|
|
17
22
|
return useCallback(() => {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
);
|
|
23
|
+
const objectPath = getObjectPathFromObject(object);
|
|
24
|
+
const db = Obj.getDatabase(object);
|
|
25
|
+
if (deck?.fullscreen) {
|
|
26
|
+
void invokePromise(DeckOperation.Adjust, {
|
|
27
|
+
type: 'solo--fullscreen' as const,
|
|
28
|
+
id: objectPath,
|
|
29
|
+
});
|
|
26
30
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
);
|
|
34
|
-
}, [dispatch, object]);
|
|
31
|
+
|
|
32
|
+
return invokePromise(LayoutOperation.Open, {
|
|
33
|
+
subject: [objectPath],
|
|
34
|
+
workspace: db ? getSpacePath(db.spaceId) : undefined,
|
|
35
|
+
});
|
|
36
|
+
}, [invokePromise, object, deck]);
|
|
35
37
|
};
|