@dxos/plugin-presenter 0.8.4-main.72ec0f3 → 0.8.4-main.7996785055
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-JXB7MHRE.mjs +53 -0
- package/dist/lib/browser/CollectionPresenterContainer-JXB7MHRE.mjs.map +7 -0
- package/dist/lib/browser/DocumentPresenterContainer-ZGA4OUSU.mjs +29 -0
- package/dist/lib/browser/DocumentPresenterContainer-ZGA4OUSU.mjs.map +7 -0
- package/dist/lib/browser/MarkdownSlide-JW66CKQF.mjs +24 -0
- package/dist/lib/browser/MarkdownSlide-JW66CKQF.mjs.map +7 -0
- package/dist/lib/browser/PresenterSettings-XNHQGQTS.mjs +32 -0
- package/dist/lib/browser/PresenterSettings-XNHQGQTS.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-N6HFHTXF.mjs +109 -0
- package/dist/lib/browser/app-graph-builder-N6HFHTXF.mjs.map +7 -0
- package/dist/lib/browser/chunk-2HIBOSEH.mjs +29 -0
- package/dist/lib/browser/chunk-2HIBOSEH.mjs.map +7 -0
- package/dist/lib/browser/chunk-GK6SUI2J.mjs +42 -0
- package/dist/lib/browser/chunk-GK6SUI2J.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-JIHV5GLM.mjs +33 -0
- package/dist/lib/browser/chunk-JIHV5GLM.mjs.map +7 -0
- package/dist/lib/browser/chunk-NPELNO5W.mjs +495 -0
- package/dist/lib/browser/chunk-NPELNO5W.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TMTUZQCK.mjs → chunk-PYBNNNNK.mjs} +2 -2
- package/dist/lib/browser/chunk-PYBNNNNK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +39 -38
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +9 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/react-surface-6H73FBMG.mjs +68 -0
- package/dist/lib/browser/react-surface-6H73FBMG.mjs.map +7 -0
- package/dist/lib/browser/settings-NWPZKMSH.mjs +33 -0
- package/dist/lib/browser/settings-NWPZKMSH.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/{Container.stories.d.ts → Panel.stories.d.ts} +1 -1
- package/dist/types/src/components/Markdown/Panel.stories.d.ts.map +1 -0
- 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/Layout.d.ts +9 -5
- package/dist/types/src/components/Presenter/Layout.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/RevealPlayer/RevealPlayer.d.ts +9 -4
- package/dist/types/src/components/RevealPlayer/RevealPlayer.d.ts.map +1 -1
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts +7 -1
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -27
- 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 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/definitions.d.ts +16 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +2 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +9 -27
- 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 +52 -41
- package/src/PresenterPlugin.tsx +9 -23
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +115 -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} +6 -6
- package/src/components/Markdown/{Container.tsx → Panel.tsx} +6 -6
- package/src/components/Markdown/Slide.stories.tsx +3 -3
- package/src/components/Markdown/index.ts +1 -1
- package/src/components/Markdown/theme.ts +6 -6
- package/src/components/Presenter/Layout.tsx +24 -23
- package/src/components/Presenter/Pager.stories.tsx +2 -2
- package/src/components/Presenter/Pager.tsx +2 -2
- package/src/components/RevealPlayer/RevealPlayer.stories.tsx +3 -3
- package/src/components/RevealPlayer/RevealPlayer.tsx +104 -100
- 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 +3 -3
- package/src/operations/definitions.ts +23 -0
- package/src/operations/index.ts +5 -0
- package/src/types.ts +6 -17
- package/src/useExitPresenter.ts +25 -25
- 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 +0 -223
- 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 +0 -57
- 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/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.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 -117
- package/src/capabilities/react-surface.tsx +0 -63
- package/src/capabilities/settings.ts +0 -19
- package/src/components/CollectionPresenterContainer.tsx +0 -44
- package/src/components/DocumentPresenterContainer.tsx +0 -23
- package/src/components/PresenterSettings.tsx +0 -30
|
@@ -17,8 +17,8 @@ import Reveal from 'reveal.js';
|
|
|
17
17
|
import RevealHighlight from 'reveal.js/plugin/highlight/highlight';
|
|
18
18
|
import RevealMarkdown from 'reveal.js/plugin/markdown/plugin.js';
|
|
19
19
|
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
20
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
21
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
22
22
|
|
|
23
23
|
const styles = `
|
|
24
24
|
<style type="text/css">
|
|
@@ -61,115 +61,119 @@ const styles = `
|
|
|
61
61
|
</style>
|
|
62
62
|
`;
|
|
63
63
|
|
|
64
|
-
export type RevealProps =
|
|
64
|
+
export type RevealProps = {
|
|
65
65
|
content: string;
|
|
66
66
|
slide?: number;
|
|
67
67
|
fullscreen?: boolean;
|
|
68
68
|
onExit?: () => void;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export const RevealPlayer = ({ classNames, content, slide, fullscreen = true, onExit }: RevealProps) => {
|
|
72
|
-
const deckDivRef = useRef<HTMLDivElement>(null);
|
|
73
|
-
const deckRef = useRef<Reveal.Api | null>(null);
|
|
74
|
-
|
|
75
|
-
useAsyncEffect(async () => {
|
|
76
|
-
if (deckRef.current) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Required for syntax highlighting.
|
|
81
|
-
hljs.registerLanguage('typescript', typescript);
|
|
82
|
-
|
|
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
|
-
// TODO(burdon): Speaker view requires server to serve popout window.
|
|
95
|
-
// https://revealjs.com/speaker-view
|
|
96
|
-
showNotes: false,
|
|
97
|
-
|
|
98
|
-
// width: 1600,
|
|
99
|
-
// height: 900,
|
|
100
|
-
margin: 0.1,
|
|
101
|
-
// center: false,
|
|
102
|
-
// minScale: 0.1,
|
|
103
|
-
// maxScale: 1.4,
|
|
104
|
-
|
|
105
|
-
// https://revealjs.com/markdown
|
|
106
|
-
// TODO(burdon): Requires server to serve popout window.
|
|
107
|
-
plugins: [RevealMarkdown, RevealHighlight],
|
|
108
|
-
|
|
109
|
-
// See https://marked.js.org/using_advanced#options
|
|
110
|
-
markdown: {
|
|
111
|
-
gfm: true,
|
|
112
|
-
smartypants: true,
|
|
113
|
-
highlight: (code, language) => {
|
|
114
|
-
if (language) {
|
|
115
|
-
return hljs.highlight(code, { language }).value;
|
|
116
|
-
}
|
|
69
|
+
};
|
|
117
70
|
|
|
118
|
-
|
|
71
|
+
export const RevealPlayer = composable<HTMLDivElement, RevealProps>(
|
|
72
|
+
({ content, slide, fullscreen = true, onExit, children, ...props }, forwardedRef) => {
|
|
73
|
+
const deckDivRef = useRef<HTMLDivElement>(null);
|
|
74
|
+
const deckRef = useRef<Reveal.Api | null>(null);
|
|
75
|
+
|
|
76
|
+
useAsyncEffect(async () => {
|
|
77
|
+
if (deckRef.current) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Required for syntax highlighting.
|
|
82
|
+
hljs.registerLanguage('typescript', typescript);
|
|
83
|
+
|
|
84
|
+
// https://revealjs.com/react
|
|
85
|
+
// https://revealjs.com/config
|
|
86
|
+
// https://github.com/hakimel/reveal.js
|
|
87
|
+
// TODO(burdon): Fragments and scroll view steps 2 at a time (safe mode?)
|
|
88
|
+
deckRef.current = new Reveal(deckDivRef.current!, {
|
|
89
|
+
// view: 'scroll',
|
|
90
|
+
progress: false,
|
|
91
|
+
transition: 'none',
|
|
92
|
+
slideNumber: false,
|
|
93
|
+
embedded: true,
|
|
94
|
+
|
|
95
|
+
// Disable autoplay to prevent errors in headless environments (e.g., CI).
|
|
96
|
+
autoPlayMedia: false,
|
|
97
|
+
|
|
98
|
+
// TODO(burdon): Speaker view requires server to serve popout window.
|
|
99
|
+
// https://revealjs.com/speaker-view
|
|
100
|
+
showNotes: false,
|
|
101
|
+
|
|
102
|
+
// width: 1600,
|
|
103
|
+
// height: 900,
|
|
104
|
+
margin: 0.1,
|
|
105
|
+
// center: false,
|
|
106
|
+
// minScale: 0.1,
|
|
107
|
+
// maxScale: 1.4,
|
|
108
|
+
|
|
109
|
+
// https://revealjs.com/markdown
|
|
110
|
+
// TODO(burdon): Requires server to serve popout window.
|
|
111
|
+
plugins: [RevealMarkdown, RevealHighlight],
|
|
112
|
+
|
|
113
|
+
// See https://marked.js.org/using_advanced#options
|
|
114
|
+
markdown: {
|
|
115
|
+
gfm: true,
|
|
116
|
+
smartypants: true,
|
|
117
|
+
highlight: (code, language) => {
|
|
118
|
+
if (language) {
|
|
119
|
+
return hljs.highlight(code, { language }).value;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return hljs.highlightAuto(code).value;
|
|
123
|
+
},
|
|
119
124
|
},
|
|
120
|
-
}
|
|
121
|
-
});
|
|
125
|
+
});
|
|
122
126
|
|
|
123
|
-
|
|
127
|
+
await deckRef.current.initialize();
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
129
|
+
if (slide !== undefined) {
|
|
130
|
+
deckRef.current.slide(slide < 0 ? deckRef.current?.getTotalSlides() + slide : slide - 1);
|
|
131
|
+
}
|
|
128
132
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
deckRef.current.addKeyBinding({ keyCode: 27, key: 'Escape', description: 'Exit full screen' }, () => {
|
|
134
|
+
onExit?.();
|
|
135
|
+
});
|
|
132
136
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
return () => {
|
|
138
|
+
try {
|
|
139
|
+
if (deckRef.current) {
|
|
140
|
+
deckRef.current.destroy();
|
|
141
|
+
deckRef.current = null;
|
|
142
|
+
}
|
|
143
|
+
} catch {
|
|
144
|
+
// Ignore.
|
|
138
145
|
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
<section {...{ 'data-markdown': [] }}>
|
|
168
|
-
<textarea {...{ 'data-template': true }} defaultValue={[styles, content].join('\n')}></textarea>
|
|
169
|
-
</section>
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// TOOD(burdon): Trap cursor keys (otherwise tabster grabs focus.)
|
|
150
|
+
return (
|
|
151
|
+
<div
|
|
152
|
+
{...composableProps(props, {
|
|
153
|
+
classNames: ['dx-container grid place-items-center bg-black', fullscreen && 'absolute inset-0'],
|
|
154
|
+
})}
|
|
155
|
+
ref={forwardedRef}
|
|
156
|
+
>
|
|
157
|
+
<div role='none' className='relative aspect-video h-full w-full h-auto max-h-full overflow-hidden'>
|
|
158
|
+
<div ref={deckDivRef} className='absolute inset-0 reveal'>
|
|
159
|
+
{/* NOTE: Must be in head. */}
|
|
160
|
+
<style>
|
|
161
|
+
<link rel='preconnect' href='https://fonts.googleapis.com' />
|
|
162
|
+
<link rel='preconnect' href='https://fonts.gstatic.com' {...{ crossOrigin: '' }} />
|
|
163
|
+
<link
|
|
164
|
+
rel='stylesheet'
|
|
165
|
+
href='https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100..900;1,100..900&display=swap'
|
|
166
|
+
/>
|
|
167
|
+
</style>
|
|
168
|
+
<div className='slides'>
|
|
169
|
+
<div className='text-center!' />
|
|
170
|
+
<section {...{ 'data-markdown': [] }}>
|
|
171
|
+
<textarea {...{ 'data-template': true }} defaultValue={[styles, content].join('\n')}></textarea>
|
|
172
|
+
</section>
|
|
173
|
+
</div>
|
|
170
174
|
</div>
|
|
171
175
|
</div>
|
|
172
176
|
</div>
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
);
|
|
178
|
+
},
|
|
179
|
+
);
|
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,11 +2,11 @@
|
|
|
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:
|
|
9
|
-
id: 'dxos.
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.presenter',
|
|
10
10
|
name: 'Presenter',
|
|
11
11
|
description: trim`
|
|
12
12
|
Transform markdown documents into interactive presentation slideshows.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Collection } from '@dxos/echo';
|
|
8
|
+
import { Operation } from '@dxos/operation';
|
|
9
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../meta';
|
|
12
|
+
|
|
13
|
+
const PRESENTER_OPERATION = `${meta.id}.operation`;
|
|
14
|
+
|
|
15
|
+
// TODO(wittjosiah): This appears to be unused.
|
|
16
|
+
export const TogglePresentation = Operation.make({
|
|
17
|
+
meta: { key: `${PRESENTER_OPERATION}.toggle-presentation`, name: 'Toggle Presentation' },
|
|
18
|
+
input: Schema.Struct({
|
|
19
|
+
object: Schema.Union(Markdown.Document, Collection.Collection),
|
|
20
|
+
state: Schema.optional(Schema.Boolean),
|
|
21
|
+
}),
|
|
22
|
+
output: Schema.Void,
|
|
23
|
+
});
|
package/src/types.ts
CHANGED
|
@@ -2,29 +2,14 @@
|
|
|
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
|
|
|
8
|
-
import {
|
|
9
|
-
import { Collection } from '@dxos/schema';
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
10
|
|
|
11
11
|
import { meta } from './meta';
|
|
12
12
|
|
|
13
|
-
export namespace PresenterAction {
|
|
14
|
-
const PRESENTER_ACTION = `${meta.id}/action`;
|
|
15
|
-
|
|
16
|
-
export class TogglePresentation extends Schema.TaggedClass<TogglePresentation>()(
|
|
17
|
-
`${PRESENTER_ACTION}/toggle-presentation`,
|
|
18
|
-
{
|
|
19
|
-
input: Schema.Struct({
|
|
20
|
-
object: Schema.Union(Markdown.Document, Collection.Collection),
|
|
21
|
-
state: Schema.optional(Schema.Boolean),
|
|
22
|
-
}),
|
|
23
|
-
output: Schema.Void,
|
|
24
|
-
},
|
|
25
|
-
) {}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
13
|
export type PresenterContextType = {
|
|
29
14
|
running: boolean;
|
|
30
15
|
start: () => void;
|
|
@@ -44,3 +29,7 @@ export const PresenterSettingsSchema = Schema.mutable(
|
|
|
44
29
|
);
|
|
45
30
|
|
|
46
31
|
export type PresenterSettingsProps = Schema.Schema.Type<typeof PresenterSettingsSchema>;
|
|
32
|
+
|
|
33
|
+
export namespace PresenterCapabilities {
|
|
34
|
+
export const Settings = Capability.make<Atom.Writable<PresenterSettingsProps>>(`${meta.id}.capability.settings`);
|
|
35
|
+
}
|
package/src/useExitPresenter.ts
CHANGED
|
@@ -2,36 +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';
|
|
9
10
|
import { Obj } from '@dxos/echo';
|
|
10
|
-
import { type Live } from '@dxos/live-object';
|
|
11
11
|
import { DeckCapabilities } from '@dxos/plugin-deck';
|
|
12
|
-
import {
|
|
13
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
12
|
+
import { DeckOperation } from '@dxos/plugin-deck/operations';
|
|
14
13
|
|
|
15
|
-
export const useExitPresenter = (object:
|
|
16
|
-
const {
|
|
17
|
-
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]);
|
|
18
21
|
|
|
19
22
|
return useCallback(() => {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
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
|
+
});
|
|
28
30
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
);
|
|
36
|
-
}, [dispatch, object]);
|
|
31
|
+
|
|
32
|
+
return invokePromise(LayoutOperation.Open, {
|
|
33
|
+
subject: [objectPath],
|
|
34
|
+
workspace: db ? getSpacePath(db.spaceId) : undefined,
|
|
35
|
+
});
|
|
36
|
+
}, [invokePromise, object, deck]);
|
|
37
37
|
};
|