@dxos/plugin-presenter 0.8.4-main.4a85c3132b → 0.8.4-main.51f1e5ca51
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/PresenterSettings-2G4XD4QY.mjs +25 -0
- package/dist/lib/browser/PresenterSettings-2G4XD4QY.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/index.mjs +507 -37
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +30 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +19 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +2 -5
- package/dist/types/src/capabilities/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/Slide.d.ts +1 -1
- package/dist/types/src/components/Markdown/Slide.d.ts.map +1 -1
- 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/Markdown/theme.d.ts.map +1 -1
- package/dist/types/src/components/Presenter/Layout.d.ts +5 -5
- package/dist/types/src/components/Presenter/Layout.d.ts.map +1 -1
- package/dist/types/src/components/Presenter/Pager.d.ts.map +1 -1
- package/dist/types/src/components/Presenter/Pager.stories.d.ts.map +1 -1
- package/dist/types/src/components/PresenterSettings/PresenterSettings.d.ts +6 -0
- package/dist/types/src/components/PresenterSettings/PresenterSettings.d.ts.map +1 -0
- package/dist/types/src/components/PresenterSettings/PresenterSettings.stories.d.ts +23 -0
- package/dist/types/src/components/PresenterSettings/PresenterSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/PresenterSettings/index.d.ts +2 -0
- package/dist/types/src/components/PresenterSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/RevealPlayer/RevealPlayer.d.ts +5 -4
- package/dist/types/src/components/RevealPlayer/RevealPlayer.d.ts.map +1 -1
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts +7 -6
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.d.ts +2 -3
- package/dist/types/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.d.ts.map +1 -1
- package/dist/types/src/containers/CollectionPresenterContainer/index.d.ts +1 -2
- package/dist/types/src/containers/CollectionPresenterContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/DocumentPresenterContainer/DocumentPresenterContainer.d.ts.map +1 -1
- package/dist/types/src/containers/DocumentPresenterContainer/index.d.ts +1 -2
- package/dist/types/src/containers/DocumentPresenterContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownSlide/MarkdownSlide.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownSlide/index.d.ts +1 -2
- package/dist/types/src/containers/MarkdownSlide/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +0 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/operations/definitions.d.ts +17 -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/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +4 -6
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +7 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +15 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/useExitPresenter.d.ts +1 -1
- package/dist/types/src/useExitPresenter.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +51 -32
- package/src/PresenterPlugin.tsx +3 -3
- package/src/capabilities/{app-graph-builder/app-graph-builder.ts → app-graph-builder.ts} +22 -24
- package/src/capabilities/index.ts +5 -3
- package/src/capabilities/react-surface.tsx +68 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +4 -4
- package/src/components/Markdown/{Container.stories.tsx → Panel.stories.tsx} +5 -5
- package/src/components/Markdown/{Container.tsx → Panel.tsx} +4 -4
- package/src/components/Markdown/Slide.stories.tsx +1 -1
- package/src/components/Markdown/Slide.tsx +2 -2
- package/src/components/Markdown/index.ts +1 -1
- package/src/components/Presenter/Layout.tsx +24 -23
- package/src/components/PresenterSettings/PresenterSettings.stories.tsx +32 -0
- package/src/components/PresenterSettings/PresenterSettings.tsx +31 -0
- package/src/components/PresenterSettings/index.ts +5 -0
- package/src/components/RevealPlayer/RevealPlayer.stories.tsx +2 -2
- package/src/components/RevealPlayer/RevealPlayer.tsx +104 -105
- package/src/components/index.ts +4 -0
- package/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.tsx +13 -6
- package/src/containers/CollectionPresenterContainer/index.ts +1 -3
- package/src/containers/DocumentPresenterContainer/DocumentPresenterContainer.tsx +2 -1
- package/src/containers/DocumentPresenterContainer/index.ts +1 -3
- package/src/containers/MarkdownSlide/MarkdownSlide.tsx +3 -3
- package/src/containers/MarkdownSlide/index.ts +1 -3
- package/src/containers/index.ts +0 -1
- package/src/meta.ts +1 -1
- package/src/operations/definitions.ts +23 -0
- package/src/operations/index.ts +5 -0
- package/src/testing.ts +6 -6
- package/src/translations.ts +4 -5
- package/src/types/Settings.ts +20 -0
- package/src/types/index.ts +30 -0
- package/src/useExitPresenter.ts +9 -7
- package/dist/lib/browser/CollectionPresenterContainer-5RJIT3DA.mjs +0 -52
- package/dist/lib/browser/CollectionPresenterContainer-5RJIT3DA.mjs.map +0 -7
- package/dist/lib/browser/DocumentPresenterContainer-ISD6N5FM.mjs +0 -28
- package/dist/lib/browser/DocumentPresenterContainer-ISD6N5FM.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSlide-Q2XLZTMW.mjs +0 -23
- package/dist/lib/browser/MarkdownSlide-Q2XLZTMW.mjs.map +0 -7
- package/dist/lib/browser/PresenterSettings-WGQMXH4I.mjs +0 -31
- package/dist/lib/browser/PresenterSettings-WGQMXH4I.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LNUGLW3H.mjs +0 -113
- package/dist/lib/browser/app-graph-builder-LNUGLW3H.mjs.map +0 -7
- package/dist/lib/browser/chunk-46CHA6Y5.mjs +0 -41
- package/dist/lib/browser/chunk-46CHA6Y5.mjs.map +0 -7
- package/dist/lib/browser/chunk-BHTOR7TG.mjs +0 -485
- package/dist/lib/browser/chunk-BHTOR7TG.mjs.map +0 -7
- package/dist/lib/browser/chunk-PSOOAW44.mjs +0 -50
- package/dist/lib/browser/chunk-PSOOAW44.mjs.map +0 -7
- package/dist/lib/browser/chunk-VQVZVXPJ.mjs +0 -18
- package/dist/lib/browser/chunk-VQVZVXPJ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-UCM2KRSP.mjs +0 -67
- package/dist/lib/browser/react-surface-UCM2KRSP.mjs.map +0 -7
- package/dist/lib/browser/settings-GIQOCH6O.mjs +0 -32
- package/dist/lib/browser/settings-GIQOCH6O.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -7
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.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/containers/PresenterSettings/PresenterSettings.d.ts +0 -8
- package/dist/types/src/containers/PresenterSettings/PresenterSettings.d.ts.map +0 -1
- package/dist/types/src/containers/PresenterSettings/index.d.ts +0 -3
- package/dist/types/src/containers/PresenterSettings/index.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -49
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -71
- package/src/capabilities/settings/index.ts +0 -7
- package/src/containers/PresenterSettings/PresenterSettings.tsx +0 -35
- package/src/containers/PresenterSettings/index.ts +0 -7
- package/src/types.ts +0 -54
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import 'reveal.js/dist/reveal.css';
|
|
6
|
-
|
|
7
6
|
import 'reveal.js/dist/theme/black.css';
|
|
8
|
-
|
|
9
7
|
// https://github.com/highlightjs/highlight.js/tree/main/src/styles
|
|
10
8
|
// import 'highlight.js/styles/github-dark.css';
|
|
11
9
|
import 'highlight.js/styles/tokyo-night-dark.css';
|
|
@@ -17,8 +15,8 @@ import Reveal from 'reveal.js';
|
|
|
17
15
|
import RevealHighlight from 'reveal.js/plugin/highlight/highlight';
|
|
18
16
|
import RevealMarkdown from 'reveal.js/plugin/markdown/plugin.js';
|
|
19
17
|
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
18
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
19
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
22
20
|
|
|
23
21
|
const styles = `
|
|
24
22
|
<style type="text/css">
|
|
@@ -61,118 +59,119 @@ const styles = `
|
|
|
61
59
|
</style>
|
|
62
60
|
`;
|
|
63
61
|
|
|
64
|
-
export type RevealProps =
|
|
62
|
+
export type RevealProps = {
|
|
65
63
|
content: string;
|
|
66
64
|
slide?: number;
|
|
67
65
|
fullscreen?: boolean;
|
|
68
66
|
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
|
-
// 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
|
-
}
|
|
67
|
+
};
|
|
120
68
|
|
|
121
|
-
|
|
69
|
+
export const RevealPlayer = composable<HTMLDivElement, RevealProps>(
|
|
70
|
+
({ content, slide, fullscreen = true, onExit, children, ...props }, forwardedRef) => {
|
|
71
|
+
const deckDivRef = useRef<HTMLDivElement>(null);
|
|
72
|
+
const deckRef = useRef<Reveal.Api | null>(null);
|
|
73
|
+
|
|
74
|
+
useAsyncEffect(async () => {
|
|
75
|
+
if (deckRef.current) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Required for syntax highlighting.
|
|
80
|
+
hljs.registerLanguage('typescript', typescript);
|
|
81
|
+
|
|
82
|
+
// https://revealjs.com/react
|
|
83
|
+
// https://revealjs.com/config
|
|
84
|
+
// https://github.com/hakimel/reveal.js
|
|
85
|
+
// TODO(burdon): Fragments and scroll view steps 2 at a time (safe mode?)
|
|
86
|
+
deckRef.current = new Reveal(deckDivRef.current!, {
|
|
87
|
+
// view: 'scroll',
|
|
88
|
+
progress: false,
|
|
89
|
+
transition: 'none',
|
|
90
|
+
slideNumber: false,
|
|
91
|
+
embedded: true,
|
|
92
|
+
|
|
93
|
+
// Disable autoplay to prevent errors in headless environments (e.g., CI).
|
|
94
|
+
autoPlayMedia: false,
|
|
95
|
+
|
|
96
|
+
// TODO(burdon): Speaker view requires server to serve popout window.
|
|
97
|
+
// https://revealjs.com/speaker-view
|
|
98
|
+
showNotes: false,
|
|
99
|
+
|
|
100
|
+
// width: 1600,
|
|
101
|
+
// height: 900,
|
|
102
|
+
margin: 0.1,
|
|
103
|
+
// center: false,
|
|
104
|
+
// minScale: 0.1,
|
|
105
|
+
// maxScale: 1.4,
|
|
106
|
+
|
|
107
|
+
// https://revealjs.com/markdown
|
|
108
|
+
// TODO(burdon): Requires server to serve popout window.
|
|
109
|
+
plugins: [RevealMarkdown, RevealHighlight],
|
|
110
|
+
|
|
111
|
+
// See https://marked.js.org/using_advanced#options
|
|
112
|
+
markdown: {
|
|
113
|
+
gfm: true,
|
|
114
|
+
smartypants: true,
|
|
115
|
+
highlight: (code, language) => {
|
|
116
|
+
if (language) {
|
|
117
|
+
return hljs.highlight(code, { language }).value;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return hljs.highlightAuto(code).value;
|
|
121
|
+
},
|
|
122
122
|
},
|
|
123
|
-
}
|
|
124
|
-
});
|
|
123
|
+
});
|
|
125
124
|
|
|
126
|
-
|
|
125
|
+
await deckRef.current.initialize();
|
|
127
126
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
if (slide !== undefined) {
|
|
128
|
+
deckRef.current.slide(slide < 0 ? deckRef.current?.getTotalSlides() + slide : slide - 1);
|
|
129
|
+
}
|
|
131
130
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
deckRef.current.addKeyBinding({ keyCode: 27, key: 'Escape', description: 'Exit full screen' }, () => {
|
|
132
|
+
onExit?.();
|
|
133
|
+
});
|
|
135
134
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
135
|
+
return () => {
|
|
136
|
+
try {
|
|
137
|
+
if (deckRef.current) {
|
|
138
|
+
deckRef.current.destroy();
|
|
139
|
+
deckRef.current = null;
|
|
140
|
+
}
|
|
141
|
+
} catch {
|
|
142
|
+
// Ignore.
|
|
141
143
|
}
|
|
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
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
<section {...{ 'data-markdown': [] }}>
|
|
171
|
-
<textarea {...{ 'data-template': true }} defaultValue={[styles, content].join('\n')}></textarea>
|
|
172
|
-
</section>
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// TOOD(burdon): Trap cursor keys (otherwise tabster grabs focus.)
|
|
148
|
+
return (
|
|
149
|
+
<div
|
|
150
|
+
{...composableProps(props, {
|
|
151
|
+
classNames: ['dx-container grid place-items-center bg-black', fullscreen && 'absolute inset-0'],
|
|
152
|
+
})}
|
|
153
|
+
ref={forwardedRef}
|
|
154
|
+
>
|
|
155
|
+
<div role='none' className='relative aspect-video h-full w-full h-auto max-h-full overflow-hidden'>
|
|
156
|
+
<div ref={deckDivRef} className='absolute inset-0 reveal'>
|
|
157
|
+
{/* NOTE: Must be in head. */}
|
|
158
|
+
<style>
|
|
159
|
+
<link rel='preconnect' href='https://fonts.googleapis.com' />
|
|
160
|
+
<link rel='preconnect' href='https://fonts.gstatic.com' {...{ crossOrigin: '' }} />
|
|
161
|
+
<link
|
|
162
|
+
rel='stylesheet'
|
|
163
|
+
href='https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100..900;1,100..900&display=swap'
|
|
164
|
+
/>
|
|
165
|
+
</style>
|
|
166
|
+
<div className='slides'>
|
|
167
|
+
<div className='text-center!' />
|
|
168
|
+
<section {...{ 'data-markdown': [] }}>
|
|
169
|
+
<textarea {...{ 'data-template': true }} defaultValue={[styles, content].join('\n')}></textarea>
|
|
170
|
+
</section>
|
|
171
|
+
</div>
|
|
173
172
|
</div>
|
|
174
173
|
</div>
|
|
175
174
|
</div>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
);
|
|
176
|
+
},
|
|
177
|
+
);
|
package/src/components/index.ts
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
5
7
|
export * from './Markdown';
|
|
6
8
|
export * from './Presenter';
|
|
7
9
|
export * from './RevealPlayer';
|
|
10
|
+
|
|
11
|
+
export const PresenterSettings: ComponentType<any> = lazy(() => import('./PresenterSettings'));
|
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
import React, { useContext, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Surface } from '@dxos/app-framework/ui';
|
|
8
|
-
import {
|
|
9
|
-
import { type Collection } from '@dxos/echo';
|
|
8
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
9
|
+
import { type Collection, Obj } from '@dxos/echo';
|
|
10
10
|
import { Panel } from '@dxos/react-ui';
|
|
11
11
|
|
|
12
|
-
import { PageNumber, Pager, Layout as PresenterLayout } from '
|
|
13
|
-
import { PresenterContext } from '
|
|
12
|
+
import { PageNumber, Pager, Layout as PresenterLayout } from '#components';
|
|
13
|
+
import { PresenterContext } from '#types';
|
|
14
|
+
|
|
14
15
|
import { useExitPresenter } from '../../useExitPresenter';
|
|
15
16
|
|
|
16
|
-
type CollectionPresenterContainerProps =
|
|
17
|
+
export type CollectionPresenterContainerProps = AppSurface.ObjectArticleProps<Collection.Collection>;
|
|
17
18
|
|
|
18
19
|
export const CollectionPresenterContainer = ({ role, subject: collection }: CollectionPresenterContainerProps) => {
|
|
19
20
|
const [slide, setSlide] = useState(0);
|
|
@@ -35,7 +36,13 @@ export const CollectionPresenterContainer = ({ role, subject: collection }: Coll
|
|
|
35
36
|
/>
|
|
36
37
|
}
|
|
37
38
|
>
|
|
38
|
-
<Surface.Surface
|
|
39
|
+
<Surface.Surface
|
|
40
|
+
type={AppSurface.Slide}
|
|
41
|
+
data={{
|
|
42
|
+
subject: collection.objects[slide],
|
|
43
|
+
attendableId: Obj.getDXN(collection).toString(),
|
|
44
|
+
}}
|
|
45
|
+
/>
|
|
39
46
|
</PresenterLayout>
|
|
40
47
|
</Panel.Content>
|
|
41
48
|
</Panel.Root>
|
|
@@ -7,7 +7,8 @@ import React, { type FC } from 'react';
|
|
|
7
7
|
import { type Markdown } from '@dxos/plugin-markdown/types';
|
|
8
8
|
import { Panel } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
|
-
import { RevealPlayer } from '
|
|
10
|
+
import { RevealPlayer } from '#components';
|
|
11
|
+
|
|
11
12
|
import { useExitPresenter } from '../../useExitPresenter';
|
|
12
13
|
|
|
13
14
|
export const DocumentPresenterContainer: FC<{ document: Markdown.Document }> = ({ document }) => {
|
|
@@ -6,7 +6,7 @@ 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
12
|
document: Markdown.Document;
|
|
@@ -19,8 +19,8 @@ export const MarkdownSlide = ({ document }: MarkdownSlideProps) => {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<
|
|
22
|
+
<Panel>
|
|
23
23
|
<Slide content={content} />
|
|
24
|
-
</
|
|
24
|
+
</Panel>
|
|
25
25
|
);
|
|
26
26
|
};
|
package/src/containers/index.ts
CHANGED
|
@@ -7,4 +7,3 @@ import { type ComponentType, lazy } from 'react';
|
|
|
7
7
|
export const CollectionPresenterContainer: ComponentType<any> = lazy(() => import('./CollectionPresenterContainer'));
|
|
8
8
|
export const DocumentPresenterContainer: ComponentType<any> = lazy(() => import('./DocumentPresenterContainer'));
|
|
9
9
|
export const MarkdownSlide: ComponentType<any> = lazy(() => import('./MarkdownSlide'));
|
|
10
|
-
export const PresenterSettings: ComponentType<any> = lazy(() => import('./PresenterSettings'));
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
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 { Operation } from '@dxos/compute';
|
|
8
|
+
import { Collection } from '@dxos/echo';
|
|
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/testing.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { random } from '@dxos/random';
|
|
6
6
|
|
|
7
7
|
type SlideOptions = {
|
|
8
8
|
text?: string;
|
|
@@ -26,21 +26,21 @@ export const createSlide = (options: SlideOptions = {}) => {
|
|
|
26
26
|
|
|
27
27
|
const list = (length = 3) =>
|
|
28
28
|
Array.from({ length })
|
|
29
|
-
.map(() => `- ${
|
|
29
|
+
.map(() => `- ${random.lorem.sentence(3)}`)
|
|
30
30
|
.join('\n');
|
|
31
31
|
|
|
32
32
|
const ordered = (length = 3) =>
|
|
33
33
|
Array.from({ length })
|
|
34
|
-
.map((_, i) => `${i + 1}. ${
|
|
34
|
+
.map((_, i) => `${i + 1}. ${random.lorem.sentence(3)}`)
|
|
35
35
|
.join('\n');
|
|
36
36
|
|
|
37
37
|
return [
|
|
38
|
-
`# ${num}${
|
|
39
|
-
options.text &&
|
|
38
|
+
`# ${num}${random.lorem.sentence(3)}`,
|
|
39
|
+
options.text && random.lorem.sentences(),
|
|
40
40
|
options.code && code(),
|
|
41
41
|
options.list && list(options.list),
|
|
42
42
|
options.ordered && ordered(options.ordered),
|
|
43
|
-
|
|
43
|
+
random.lorem.sentences(),
|
|
44
44
|
]
|
|
45
45
|
.filter(Boolean)
|
|
46
46
|
.join('\n\r');
|
package/src/translations.ts
CHANGED
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
14
|
-
'settings
|
|
15
|
-
'toggle
|
|
16
|
-
'present collections label': 'Present collections (experimental)',
|
|
13
|
+
'plugin.name': 'Presenter',
|
|
14
|
+
'settings.title': 'Presenter settings',
|
|
15
|
+
'toggle-presentation.label': 'Present',
|
|
17
16
|
},
|
|
18
17
|
},
|
|
19
18
|
},
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
export const Settings = Schema.mutable(
|
|
10
|
+
Schema.Struct({
|
|
11
|
+
presentCollections: Schema.optional(
|
|
12
|
+
Schema.Boolean.annotations({
|
|
13
|
+
title: 'Present collections (experimental)',
|
|
14
|
+
description: 'Enable presenting collections of documents as a slideshow.',
|
|
15
|
+
}),
|
|
16
|
+
),
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export interface Settings extends Schema.Schema.Type<typeof Settings> {}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import { type Context, createContext } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability } from '@dxos/app-framework';
|
|
9
|
+
|
|
10
|
+
import { meta } from '#meta';
|
|
11
|
+
|
|
12
|
+
import * as Settings from './Settings';
|
|
13
|
+
|
|
14
|
+
export type PresenterContextType = {
|
|
15
|
+
running: boolean;
|
|
16
|
+
start: () => void;
|
|
17
|
+
stop: () => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const PresenterContext: Context<PresenterContextType> = createContext<PresenterContextType>({
|
|
21
|
+
running: false,
|
|
22
|
+
start: () => {},
|
|
23
|
+
stop: () => {},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export * as Settings from './Settings';
|
|
27
|
+
|
|
28
|
+
export namespace PresenterCapabilities {
|
|
29
|
+
export const Settings = Capability.make<Atom.Writable<Settings.Settings>>(`${meta.id}.capability.settings`);
|
|
30
|
+
}
|
package/src/useExitPresenter.ts
CHANGED
|
@@ -6,10 +6,10 @@ import { useAtomValue } from '@effect-atom/atom-react';
|
|
|
6
6
|
import { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { useCapability, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
-
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { LayoutOperation, getObjectPathFromObject, getSpacePath } from '@dxos/app-toolkit';
|
|
10
10
|
import { Obj } from '@dxos/echo';
|
|
11
11
|
import { DeckCapabilities } from '@dxos/plugin-deck';
|
|
12
|
-
import { DeckOperation } from '@dxos/plugin-deck/
|
|
12
|
+
import { DeckOperation } from '@dxos/plugin-deck/operations';
|
|
13
13
|
|
|
14
14
|
export const useExitPresenter = (object: any) => {
|
|
15
15
|
const { invokePromise } = useOperationInvoker();
|
|
@@ -20,16 +20,18 @@ export const useExitPresenter = (object: any) => {
|
|
|
20
20
|
const deck = useMemo(() => state.decks[state.activeDeck], [state.decks, state.activeDeck]);
|
|
21
21
|
|
|
22
22
|
return useCallback(() => {
|
|
23
|
-
const
|
|
23
|
+
const objectPath = getObjectPathFromObject(object);
|
|
24
|
+
const db = Obj.getDatabase(object);
|
|
24
25
|
if (deck?.fullscreen) {
|
|
25
26
|
void invokePromise(DeckOperation.Adjust, {
|
|
26
|
-
type: 'solo--fullscreen',
|
|
27
|
-
id:
|
|
27
|
+
type: 'solo--fullscreen' as const,
|
|
28
|
+
id: objectPath,
|
|
28
29
|
});
|
|
29
30
|
}
|
|
31
|
+
|
|
30
32
|
return invokePromise(LayoutOperation.Open, {
|
|
31
|
-
subject: [
|
|
32
|
-
workspace:
|
|
33
|
+
subject: [objectPath],
|
|
34
|
+
workspace: db ? getSpacePath(db.spaceId) : undefined,
|
|
33
35
|
});
|
|
34
36
|
}, [invokePromise, object, deck]);
|
|
35
37
|
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useExitPresenter
|
|
3
|
-
} from "./chunk-46CHA6Y5.mjs";
|
|
4
|
-
import {
|
|
5
|
-
Layout,
|
|
6
|
-
PageNumber,
|
|
7
|
-
Pager
|
|
8
|
-
} from "./chunk-BHTOR7TG.mjs";
|
|
9
|
-
import {
|
|
10
|
-
PresenterContext
|
|
11
|
-
} from "./chunk-PSOOAW44.mjs";
|
|
12
|
-
import "./chunk-VQVZVXPJ.mjs";
|
|
13
|
-
|
|
14
|
-
// src/containers/CollectionPresenterContainer/CollectionPresenterContainer.tsx
|
|
15
|
-
import React, { useContext, useState } from "react";
|
|
16
|
-
import { Surface } from "@dxos/app-framework/ui";
|
|
17
|
-
import { Panel } from "@dxos/react-ui";
|
|
18
|
-
var CollectionPresenterContainer = ({ role, subject: collection }) => {
|
|
19
|
-
const [slide, setSlide] = useState(0);
|
|
20
|
-
const { running } = useContext(PresenterContext);
|
|
21
|
-
const handleExit = useExitPresenter(collection);
|
|
22
|
-
return /* @__PURE__ */ React.createElement(Panel.Root, {
|
|
23
|
-
role,
|
|
24
|
-
classNames: "relative"
|
|
25
|
-
}, /* @__PURE__ */ React.createElement(Panel.Content, {
|
|
26
|
-
asChild: true
|
|
27
|
-
}, /* @__PURE__ */ React.createElement(Layout, {
|
|
28
|
-
bottomRight: /* @__PURE__ */ React.createElement(PageNumber, {
|
|
29
|
-
index: slide,
|
|
30
|
-
count: collection.objects.length
|
|
31
|
-
}),
|
|
32
|
-
bottomLeft: /* @__PURE__ */ React.createElement(Pager, {
|
|
33
|
-
index: slide,
|
|
34
|
-
count: collection.objects.length,
|
|
35
|
-
keys: running,
|
|
36
|
-
onChange: setSlide,
|
|
37
|
-
onExit: handleExit
|
|
38
|
-
})
|
|
39
|
-
}, /* @__PURE__ */ React.createElement(Surface.Surface, {
|
|
40
|
-
role: "slide",
|
|
41
|
-
data: {
|
|
42
|
-
subject: collection.objects[slide]
|
|
43
|
-
}
|
|
44
|
-
}))));
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// src/containers/CollectionPresenterContainer/index.ts
|
|
48
|
-
var CollectionPresenterContainer_default = CollectionPresenterContainer;
|
|
49
|
-
export {
|
|
50
|
-
CollectionPresenterContainer_default as default
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=CollectionPresenterContainer-5RJIT3DA.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/CollectionPresenterContainer/CollectionPresenterContainer.tsx", "../../../src/containers/CollectionPresenterContainer/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useContext, useState } from 'react';\n\nimport { Surface } from '@dxos/app-framework/ui';\nimport { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';\nimport { type Collection } from '@dxos/echo';\nimport { Panel } from '@dxos/react-ui';\n\nimport { PageNumber, Pager, Layout as PresenterLayout } from '../../components';\nimport { PresenterContext } from '../../types';\nimport { useExitPresenter } from '../../useExitPresenter';\n\ntype CollectionPresenterContainerProps = SurfaceComponentProps<Collection.Collection>;\n\nexport const CollectionPresenterContainer = ({ role, subject: collection }: CollectionPresenterContainerProps) => {\n const [slide, setSlide] = useState(0);\n const { running } = useContext(PresenterContext);\n const handleExit = useExitPresenter(collection);\n\n return (\n <Panel.Root role={role} classNames='relative'>\n <Panel.Content asChild>\n <PresenterLayout\n bottomRight={<PageNumber index={slide} count={collection.objects.length} />}\n bottomLeft={\n <Pager\n index={slide}\n count={collection.objects.length}\n keys={running}\n onChange={setSlide}\n onExit={handleExit}\n />\n }\n >\n <Surface.Surface role='slide' data={{ subject: collection.objects[slide] }} />\n </PresenterLayout>\n </Panel.Content>\n </Panel.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CollectionPresenterContainer } from './CollectionPresenterContainer';\n\nexport default CollectionPresenterContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAIA,OAAOA,SAASC,YAAYC,gBAAgB;AAE5C,SAASC,eAAe;AAGxB,SAASC,aAAa;AAQf,IAAMC,+BAA+B,CAAC,EAAEC,MAAMC,SAASC,WAAU,MAAqC;AAC3G,QAAM,CAACC,OAAOC,QAAAA,IAAYC,SAAS,CAAA;AACnC,QAAM,EAAEC,QAAO,IAAKC,WAAWC,gBAAAA;AAC/B,QAAMC,aAAaC,iBAAiBR,UAAAA;AAEpC,SACE,sBAAA,cAACS,MAAMC,MAAI;IAACZ;IAAYa,YAAW;KACjC,sBAAA,cAACF,MAAMG,SAAO;IAACC,SAAAA;KACb,sBAAA,cAACC,QAAAA;IACCC,aAAa,sBAAA,cAACC,YAAAA;MAAWC,OAAOhB;MAAOiB,OAAOlB,WAAWmB,QAAQC;;IACjEC,YACE,sBAAA,cAACC,OAAAA;MACCL,OAAOhB;MACPiB,OAAOlB,WAAWmB,QAAQC;MAC1BG,MAAMnB;MACNoB,UAAUtB;MACVuB,QAAQlB;;KAIZ,sBAAA,cAACmB,QAAQA,SAAO;IAAC5B,MAAK;IAAQ6B,MAAM;MAAE5B,SAASC,WAAWmB,QAAQlB,KAAAA;IAAO;;AAKnF;;;ACpCA,IAAA,uCAAe2B;",
|
|
6
|
-
"names": ["React", "useContext", "useState", "Surface", "Panel", "CollectionPresenterContainer", "role", "subject", "collection", "slide", "setSlide", "useState", "running", "useContext", "PresenterContext", "handleExit", "useExitPresenter", "Panel", "Root", "classNames", "Content", "asChild", "PresenterLayout", "bottomRight", "PageNumber", "index", "count", "objects", "length", "bottomLeft", "Pager", "keys", "onChange", "onExit", "Surface", "data", "CollectionPresenterContainer"]
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useExitPresenter
|
|
3
|
-
} from "./chunk-46CHA6Y5.mjs";
|
|
4
|
-
import {
|
|
5
|
-
RevealPlayer
|
|
6
|
-
} from "./chunk-BHTOR7TG.mjs";
|
|
7
|
-
|
|
8
|
-
// src/containers/DocumentPresenterContainer/DocumentPresenterContainer.tsx
|
|
9
|
-
import React from "react";
|
|
10
|
-
import { Panel } from "@dxos/react-ui";
|
|
11
|
-
var DocumentPresenterContainer = ({ document }) => {
|
|
12
|
-
const handleExit = useExitPresenter(document);
|
|
13
|
-
return /* @__PURE__ */ React.createElement(Panel.Root, {
|
|
14
|
-
classNames: "relative"
|
|
15
|
-
}, /* @__PURE__ */ React.createElement(Panel.Content, {
|
|
16
|
-
asChild: true
|
|
17
|
-
}, /* @__PURE__ */ React.createElement(RevealPlayer, {
|
|
18
|
-
content: document.content.target?.content ?? "",
|
|
19
|
-
onExit: handleExit
|
|
20
|
-
})));
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// src/containers/DocumentPresenterContainer/index.ts
|
|
24
|
-
var DocumentPresenterContainer_default = DocumentPresenterContainer;
|
|
25
|
-
export {
|
|
26
|
-
DocumentPresenterContainer_default as default
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=DocumentPresenterContainer-ISD6N5FM.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/DocumentPresenterContainer/DocumentPresenterContainer.tsx", "../../../src/containers/DocumentPresenterContainer/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { type Markdown } from '@dxos/plugin-markdown/types';\nimport { Panel } from '@dxos/react-ui';\n\nimport { RevealPlayer } from '../../components';\nimport { useExitPresenter } from '../../useExitPresenter';\n\nexport const DocumentPresenterContainer: FC<{ document: Markdown.Document }> = ({ document }) => {\n const handleExit = useExitPresenter(document);\n\n return (\n <Panel.Root classNames='relative'>\n <Panel.Content asChild>\n <RevealPlayer content={document.content.target?.content ?? ''} onExit={handleExit} />\n </Panel.Content>\n </Panel.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DocumentPresenterContainer } from './DocumentPresenterContainer';\n\nexport default DocumentPresenterContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,OAAOA,WAAwB;AAG/B,SAASC,aAAa;AAKf,IAAMC,6BAAkE,CAAC,EAAEC,SAAQ,MAAE;AAC1F,QAAMC,aAAaC,iBAAiBF,QAAAA;AAEpC,SACE,sBAAA,cAACG,MAAMC,MAAI;IAACC,YAAW;KACrB,sBAAA,cAACF,MAAMG,SAAO;IAACC,SAAAA;KACb,sBAAA,cAACC,cAAAA;IAAaC,SAAST,SAASS,QAAQC,QAAQD,WAAW;IAAIE,QAAQV;;AAI/E;;;AChBA,IAAA,qCAAeW;",
|
|
6
|
-
"names": ["React", "Panel", "DocumentPresenterContainer", "document", "handleExit", "useExitPresenter", "Panel", "Root", "classNames", "Content", "asChild", "RevealPlayer", "content", "target", "onExit", "DocumentPresenterContainer"]
|
|
7
|
-
}
|