@dxos/plugin-presenter 0.8.3 → 0.8.4-main.03d5cd7b56
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/neutral/CollectionPresenterContainer-JMX6INMS.mjs +46 -0
- package/dist/lib/neutral/CollectionPresenterContainer-JMX6INMS.mjs.map +7 -0
- package/dist/lib/neutral/DocumentPresenterContainer-KCDZ2O2C.mjs +24 -0
- package/dist/lib/neutral/DocumentPresenterContainer-KCDZ2O2C.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownSlide-WXILOIBE.mjs +18 -0
- package/dist/lib/neutral/MarkdownSlide-WXILOIBE.mjs.map +7 -0
- package/dist/lib/neutral/PresenterPlugin.mjs +23 -0
- package/dist/lib/neutral/PresenterPlugin.mjs.map +7 -0
- package/dist/lib/neutral/PresenterPlugin.node.mjs +16 -0
- package/dist/lib/neutral/PresenterPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/PresenterSettings-2G4XD4QY.mjs +25 -0
- package/dist/lib/neutral/PresenterSettings-2G4XD4QY.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-LOVUQ6U5.mjs +98 -0
- package/dist/lib/neutral/app-graph-builder-LOVUQ6U5.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +13 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4XSSDLGN.mjs +18 -0
- package/dist/lib/neutral/chunk-4XSSDLGN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-DCPA267T.mjs +68 -0
- package/dist/lib/neutral/chunk-DCPA267T.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-V323QBC3.mjs +41 -0
- package/dist/lib/neutral/chunk-V323QBC3.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +502 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +13 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +18 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-ATYTHPAA.mjs +55 -0
- package/dist/lib/neutral/react-surface-ATYTHPAA.mjs.map +7 -0
- package/dist/lib/neutral/settings-R6LRDAAK.mjs +28 -0
- package/dist/lib/neutral/settings-R6LRDAAK.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +19 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +14 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/PresenterPlugin.d.ts +3 -1
- package/dist/types/src/PresenterPlugin.d.ts.map +1 -1
- package/dist/types/src/PresenterPlugin.node.d.ts +4 -0
- package/dist/types/src/PresenterPlugin.node.d.ts.map +1 -0
- package/dist/types/src/PresenterPlugin.test.d.ts +2 -0
- package/dist/types/src/PresenterPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- 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 +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +5 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- 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 +2 -4
- 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/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 +4 -4
- 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/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 +20 -3
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +5 -10
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.d.ts +6 -0
- package/dist/types/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.d.ts.map +1 -0
- package/dist/types/src/containers/CollectionPresenterContainer/index.d.ts +2 -0
- package/dist/types/src/containers/CollectionPresenterContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/DocumentPresenterContainer/DocumentPresenterContainer.d.ts +6 -0
- package/dist/types/src/containers/DocumentPresenterContainer/DocumentPresenterContainer.d.ts.map +1 -0
- package/dist/types/src/containers/DocumentPresenterContainer/index.d.ts +2 -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 +2 -0
- package/dist/types/src/containers/MarkdownSlide/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -8
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/PresenterCapabilities.d.ts +4 -0
- package/dist/types/src/types/PresenterCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/PresenterOperation.d.ts +17 -0
- package/dist/types/src/types/PresenterOperation.d.ts.map +1 -0
- 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 +11 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/useExitPresenter.d.ts +3 -4
- package/dist/types/src/useExitPresenter.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +102 -45
- package/src/PresenterPlugin.node.ts +16 -0
- package/src/PresenterPlugin.test.ts +23 -0
- package/src/PresenterPlugin.tsx +14 -27
- package/src/capabilities/app-graph-builder.ts +94 -73
- package/src/capabilities/index.ts +4 -4
- package/src/capabilities/react-surface.tsx +59 -44
- package/src/capabilities/settings.ts +24 -12
- package/src/components/Markdown/Panel.stories.tsx +58 -0
- package/src/components/Markdown/{Container.tsx → Panel.tsx} +6 -6
- package/src/components/Markdown/Slide.stories.tsx +12 -8
- package/src/components/Markdown/Slide.tsx +14 -130
- 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 +24 -23
- package/src/components/Presenter/Pager.stories.tsx +11 -8
- package/src/components/Presenter/Pager.tsx +55 -22
- 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 +9 -7
- package/src/components/RevealPlayer/RevealPlayer.tsx +58 -52
- package/src/components/index.ts +5 -5
- package/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.tsx +50 -0
- package/src/containers/CollectionPresenterContainer/index.ts +5 -0
- package/src/containers/DocumentPresenterContainer/DocumentPresenterContainer.tsx +24 -0
- package/src/containers/DocumentPresenterContainer/index.ts +5 -0
- package/src/containers/MarkdownSlide/MarkdownSlide.tsx +26 -0
- package/src/containers/MarkdownSlide/index.ts +5 -0
- package/src/containers/index.ts +9 -0
- package/src/index.ts +1 -3
- package/src/meta.ts +9 -6
- package/src/plugin.ts +9 -0
- package/src/testing.ts +6 -6
- package/src/translations.ts +9 -7
- package/src/types/PresenterCapabilities.ts +15 -0
- package/src/types/PresenterOperation.ts +25 -0
- package/src/types/Settings.ts +20 -0
- package/src/types/index.ts +21 -0
- package/src/useExitPresenter.ts +26 -25
- package/dist/lib/browser/CollectionPresenterContainer-YEJSMZFR.mjs +0 -189
- package/dist/lib/browser/CollectionPresenterContainer-YEJSMZFR.mjs.map +0 -7
- package/dist/lib/browser/DocumentPresenterContainer-QNXYZ5WX.mjs +0 -185
- package/dist/lib/browser/DocumentPresenterContainer-QNXYZ5WX.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSlide-EI5XTZGO.mjs +0 -336
- package/dist/lib/browser/MarkdownSlide-EI5XTZGO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-NEAHHOKU.mjs +0 -77
- package/dist/lib/browser/app-graph-builder-NEAHHOKU.mjs.map +0 -7
- package/dist/lib/browser/chunk-2RWWAQZK.mjs +0 -36
- package/dist/lib/browser/chunk-2RWWAQZK.mjs.map +0 -7
- package/dist/lib/browser/chunk-4OPZ2PG6.mjs +0 -37
- package/dist/lib/browser/chunk-4OPZ2PG6.mjs.map +0 -7
- package/dist/lib/browser/chunk-P2I7C2CY.mjs +0 -39
- package/dist/lib/browser/chunk-P2I7C2CY.mjs.map +0 -7
- package/dist/lib/browser/chunk-S2S5RFJ4.mjs +0 -15
- package/dist/lib/browser/chunk-S2S5RFJ4.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -66
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-6WH4XLTT.mjs +0 -57
- package/dist/lib/browser/react-surface-6WH4XLTT.mjs.map +0 -7
- package/dist/lib/browser/settings-KZGHTWTK.mjs +0 -22
- package/dist/lib/browser/settings-KZGHTWTK.mjs.map +0 -7
- 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 +0 -7
- 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/dist/types/src/types.d.ts +0 -39
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/components/CollectionPresenterContainer.tsx +0 -43
- package/src/components/DocumentPresenterContainer.tsx +0 -22
- package/src/components/Markdown/Container.stories.tsx +0 -57
- package/src/components/MarkdownSlide.tsx +0 -24
- package/src/components/PresenterSettings.tsx +0 -26
- package/src/types.ts +0 -46
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
|
|
7
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
|
+
|
|
9
|
+
import { translations } from '#translations';
|
|
10
|
+
|
|
11
|
+
import { PresenterSettings } from './PresenterSettings';
|
|
12
|
+
|
|
13
|
+
const meta = {
|
|
14
|
+
title: 'plugins/plugin-presenter/components/PresenterSettings',
|
|
15
|
+
component: PresenterSettings,
|
|
16
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
17
|
+
tags: ['settings'],
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: 'fullscreen',
|
|
20
|
+
translations,
|
|
21
|
+
},
|
|
22
|
+
} satisfies Meta<typeof PresenterSettings>;
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
settings: { presentCollections: true },
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Settings as SettingsForm } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
import { Settings } from '#types';
|
|
13
|
+
|
|
14
|
+
export type PresenterSettingsProps = AppSurface.SettingsArticleProps<Settings.Settings>;
|
|
15
|
+
|
|
16
|
+
export const PresenterSettings = ({ settings, onSettingsChange }: PresenterSettingsProps) => {
|
|
17
|
+
const { t } = useTranslation(meta.id);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<SettingsForm.Viewport>
|
|
21
|
+
<SettingsForm.Section title={t('settings.title', { ns: meta.id })}>
|
|
22
|
+
<SettingsForm.FieldSet
|
|
23
|
+
readonly={!onSettingsChange}
|
|
24
|
+
schema={Settings.Settings}
|
|
25
|
+
values={settings}
|
|
26
|
+
onValuesChanged={(values) => onSettingsChange?.(() => values)}
|
|
27
|
+
/>
|
|
28
|
+
</SettingsForm.Section>
|
|
29
|
+
</SettingsForm.Viewport>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
5
|
+
import { type Meta } from '@storybook/react-vite';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
|
+
|
|
9
|
+
import { translations } from '#translations';
|
|
8
10
|
|
|
9
|
-
import { RevealPlayer } from './RevealPlayer';
|
|
10
11
|
import CONTENT from '../../../testing/deck.md?raw';
|
|
11
|
-
import
|
|
12
|
+
import { RevealPlayer } from './RevealPlayer';
|
|
12
13
|
|
|
13
14
|
// https://revealjs.com/markdown
|
|
14
15
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/background-position
|
|
@@ -18,14 +19,15 @@ import translations from '../../translations';
|
|
|
18
19
|
// https://fontsource.org/fonts
|
|
19
20
|
// https://fonts.google.com
|
|
20
21
|
|
|
21
|
-
const meta
|
|
22
|
-
title: 'plugins/plugin-presenter/RevealPlayer',
|
|
22
|
+
const meta = {
|
|
23
|
+
title: 'plugins/plugin-presenter/components/RevealPlayer',
|
|
23
24
|
component: RevealPlayer,
|
|
25
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
24
26
|
parameters: {
|
|
25
27
|
layout: 'fullscreen',
|
|
26
28
|
translations,
|
|
27
29
|
},
|
|
28
|
-
}
|
|
30
|
+
} satisfies Meta<typeof RevealPlayer>;
|
|
29
31
|
|
|
30
32
|
export default meta;
|
|
31
33
|
|
|
@@ -2,24 +2,21 @@
|
|
|
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
|
-
// eslint-disable-next-line no-restricted-imports
|
|
8
6
|
import 'reveal.js/dist/theme/black.css';
|
|
9
|
-
|
|
10
7
|
// https://github.com/highlightjs/highlight.js/tree/main/src/styles
|
|
11
8
|
// import 'highlight.js/styles/github-dark.css';
|
|
12
9
|
import 'highlight.js/styles/tokyo-night-dark.css';
|
|
13
10
|
|
|
14
11
|
import hljs from 'highlight.js';
|
|
15
12
|
import typescript from 'highlight.js/lib/languages/typescript';
|
|
16
|
-
import React, {
|
|
13
|
+
import React, { useRef } from 'react';
|
|
17
14
|
import Reveal from 'reveal.js';
|
|
18
15
|
import RevealHighlight from 'reveal.js/plugin/highlight/highlight';
|
|
19
16
|
import RevealMarkdown from 'reveal.js/plugin/markdown/plugin.js';
|
|
20
17
|
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
18
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
19
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
23
20
|
|
|
24
21
|
const styles = `
|
|
25
22
|
<style type="text/css">
|
|
@@ -62,25 +59,26 @@ const styles = `
|
|
|
62
59
|
</style>
|
|
63
60
|
`;
|
|
64
61
|
|
|
65
|
-
export type RevealProps =
|
|
62
|
+
export type RevealProps = {
|
|
66
63
|
content: string;
|
|
67
64
|
slide?: number;
|
|
68
65
|
fullscreen?: boolean;
|
|
69
66
|
onExit?: () => void;
|
|
70
|
-
}
|
|
67
|
+
};
|
|
71
68
|
|
|
72
|
-
export const RevealPlayer =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (deckRef.current) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
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);
|
|
79
73
|
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
useAsyncEffect(async () => {
|
|
75
|
+
if (deckRef.current) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Required for syntax highlighting.
|
|
80
|
+
hljs.registerLanguage('typescript', typescript);
|
|
82
81
|
|
|
83
|
-
const t = setTimeout(async () => {
|
|
84
82
|
// https://revealjs.com/react
|
|
85
83
|
// https://revealjs.com/config
|
|
86
84
|
// https://github.com/hakimel/reveal.js
|
|
@@ -92,6 +90,9 @@ export const RevealPlayer = ({ classNames, content, slide, fullscreen = true, on
|
|
|
92
90
|
slideNumber: false,
|
|
93
91
|
embedded: true,
|
|
94
92
|
|
|
93
|
+
// Disable autoplay to prevent errors in headless environments (e.g., CI).
|
|
94
|
+
autoPlayMedia: false,
|
|
95
|
+
|
|
95
96
|
// TODO(burdon): Speaker view requires server to serve popout window.
|
|
96
97
|
// https://revealjs.com/speaker-view
|
|
97
98
|
showNotes: false,
|
|
@@ -130,42 +131,47 @@ export const RevealPlayer = ({ classNames, content, slide, fullscreen = true, on
|
|
|
130
131
|
deckRef.current.addKeyBinding({ keyCode: 27, key: 'Escape', description: 'Exit full screen' }, () => {
|
|
131
132
|
onExit?.();
|
|
132
133
|
});
|
|
133
|
-
});
|
|
134
134
|
|
|
135
|
-
|
|
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
|
-
rel='
|
|
158
|
-
href='https://fonts.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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 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>
|
|
166
172
|
</div>
|
|
167
173
|
</div>
|
|
168
174
|
</div>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
175
|
+
);
|
|
176
|
+
},
|
|
177
|
+
);
|
package/src/components/index.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
|
-
export * from './
|
|
7
|
+
export * from './Markdown';
|
|
8
|
+
export * from './Presenter';
|
|
9
|
+
export * from './RevealPlayer';
|
|
8
10
|
|
|
9
|
-
export const
|
|
10
|
-
export const DocumentPresenterContainer = lazy(() => import('./DocumentPresenterContainer'));
|
|
11
|
-
export const CollectionPresenterContainer = lazy(() => import('./CollectionPresenterContainer'));
|
|
11
|
+
export const PresenterSettings: ComponentType<any> = lazy(() => import('./PresenterSettings'));
|
|
@@ -0,0 +1,50 @@
|
|
|
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 { AppSurface } from '@dxos/app-toolkit/ui';
|
|
9
|
+
import { type Collection, Obj } 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
|
+
|
|
15
|
+
import { useExitPresenter } from '../../useExitPresenter';
|
|
16
|
+
|
|
17
|
+
export type CollectionPresenterContainerProps = AppSurface.ObjectArticleProps<Collection.Collection>;
|
|
18
|
+
|
|
19
|
+
export const CollectionPresenterContainer = ({ role, subject: collection }: CollectionPresenterContainerProps) => {
|
|
20
|
+
const [slide, setSlide] = useState(0);
|
|
21
|
+
const { running } = useContext(PresenterContext);
|
|
22
|
+
const handleExit = useExitPresenter(collection);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Panel.Root role={role} classNames='relative'>
|
|
26
|
+
<Panel.Content asChild>
|
|
27
|
+
<PresenterLayout
|
|
28
|
+
bottomRight={<PageNumber index={slide} count={collection.objects.length} />}
|
|
29
|
+
bottomLeft={
|
|
30
|
+
<Pager
|
|
31
|
+
index={slide}
|
|
32
|
+
count={collection.objects.length}
|
|
33
|
+
keys={running}
|
|
34
|
+
onChange={setSlide}
|
|
35
|
+
onExit={handleExit}
|
|
36
|
+
/>
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
<Surface.Surface
|
|
40
|
+
type={AppSurface.Slide}
|
|
41
|
+
data={{
|
|
42
|
+
subject: collection.objects[slide],
|
|
43
|
+
attendableId: Obj.getDXN(collection).toString(),
|
|
44
|
+
}}
|
|
45
|
+
/>
|
|
46
|
+
</PresenterLayout>
|
|
47
|
+
</Panel.Content>
|
|
48
|
+
</Panel.Root>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type FC } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Markdown } from '@dxos/plugin-markdown';
|
|
8
|
+
import { Panel } from '@dxos/react-ui';
|
|
9
|
+
|
|
10
|
+
import { RevealPlayer } from '#components';
|
|
11
|
+
|
|
12
|
+
import { useExitPresenter } from '../../useExitPresenter';
|
|
13
|
+
|
|
14
|
+
export const DocumentPresenterContainer: FC<{ document: Markdown.Document }> = ({ document }) => {
|
|
15
|
+
const handleExit = useExitPresenter(document);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Panel.Root classNames='relative'>
|
|
19
|
+
<Panel.Content asChild>
|
|
20
|
+
<RevealPlayer content={document.content.target?.content ?? ''} onExit={handleExit} />
|
|
21
|
+
</Panel.Content>
|
|
22
|
+
</Panel.Root>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Markdown } from '@dxos/plugin-markdown';
|
|
8
|
+
|
|
9
|
+
import { Panel, Slide } from '#components';
|
|
10
|
+
|
|
11
|
+
type MarkdownSlideProps = {
|
|
12
|
+
document: Markdown.Document;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const MarkdownSlide = ({ document }: MarkdownSlideProps) => {
|
|
16
|
+
const content = document.content.target?.content;
|
|
17
|
+
if (!content) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Panel>
|
|
23
|
+
<Slide content={content} />
|
|
24
|
+
</Panel>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
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'));
|
package/src/index.ts
CHANGED
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/plugin.ts
ADDED
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
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import { meta } from '#meta';
|
|
8
|
+
|
|
9
|
+
export const translations = [
|
|
8
10
|
{
|
|
9
11
|
'en-US': {
|
|
10
|
-
[
|
|
11
|
-
'plugin
|
|
12
|
-
'
|
|
13
|
-
'
|
|
12
|
+
[meta.id]: {
|
|
13
|
+
'plugin.name': 'Presenter',
|
|
14
|
+
'settings.title': 'Presenter settings',
|
|
15
|
+
'toggle-presentation.label': 'Present',
|
|
14
16
|
},
|
|
15
17
|
},
|
|
16
18
|
},
|
|
17
|
-
];
|
|
19
|
+
] as const satisfies Resource[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
8
|
+
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
// Inline import to avoid `Settings` namespace alias colliding with the
|
|
14
|
+
// `Settings` capability export below.
|
|
15
|
+
export const Settings = Capability.make<Atom.Writable<import('./Settings').Settings>>(`${meta.id}.capability.settings`);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Operation } from '@dxos/compute';
|
|
10
|
+
import { Collection } from '@dxos/echo';
|
|
11
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
12
|
+
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
|
|
15
|
+
const PRESENTER_OPERATION = `${meta.id}.operation`;
|
|
16
|
+
|
|
17
|
+
// TODO(wittjosiah): This appears to be unused.
|
|
18
|
+
export const TogglePresentation = Operation.make({
|
|
19
|
+
meta: { key: `${PRESENTER_OPERATION}.toggle-presentation`, name: 'Toggle Presentation' },
|
|
20
|
+
input: Schema.Struct({
|
|
21
|
+
object: Schema.Union(Markdown.Document, Collection.Collection),
|
|
22
|
+
state: Schema.optional(Schema.Boolean),
|
|
23
|
+
}),
|
|
24
|
+
output: Schema.Void,
|
|
25
|
+
});
|
|
@@ -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,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Context, createContext } from 'react';
|
|
6
|
+
|
|
7
|
+
export type PresenterContextType = {
|
|
8
|
+
running: boolean;
|
|
9
|
+
start: () => void;
|
|
10
|
+
stop: () => void;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const PresenterContext: Context<PresenterContextType> = createContext<PresenterContextType>({
|
|
14
|
+
running: false,
|
|
15
|
+
start: () => {},
|
|
16
|
+
stop: () => {},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export * as PresenterCapabilities from './PresenterCapabilities';
|
|
20
|
+
export * as PresenterOperation from './PresenterOperation';
|
|
21
|
+
export * as Settings from './Settings';
|