@dxos/plugin-presenter 0.8.4-main.72ec0f3 → 0.8.4-main.74a063c4e0
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-DZO2DC53.mjs +29 -0
- package/dist/lib/browser/PresenterSettings-DZO2DC53.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 +533 -46
- 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/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.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 +8 -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 +8 -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/{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/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/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 +25 -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 +9 -4
- package/dist/types/src/components/RevealPlayer/RevealPlayer.d.ts.map +1 -1
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts +12 -5
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +5 -27
- 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/{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 +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/meta.d.ts +2 -2
- package/dist/types/src/meta.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/translations.d.ts +6 -5
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +6 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +18 -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 +62 -41
- package/src/PresenterPlugin.tsx +12 -25
- package/src/capabilities/app-graph-builder.ts +91 -104
- package/src/capabilities/index.ts +4 -4
- package/src/capabilities/react-surface.tsx +56 -53
- package/src/capabilities/settings.ts +24 -12
- package/src/components/Markdown/{Container.stories.tsx → Panel.stories.tsx} +7 -7
- package/src/components/Markdown/{Container.tsx → Panel.tsx} +6 -6
- package/src/components/Markdown/Slide.stories.tsx +4 -4
- package/src/components/Markdown/Slide.tsx +2 -2
- 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/PresenterSettings/PresenterSettings.stories.tsx +31 -0
- package/src/components/PresenterSettings/PresenterSettings.tsx +32 -0
- package/src/components/PresenterSettings/index.ts +5 -0
- package/src/components/RevealPlayer/RevealPlayer.stories.tsx +3 -4
- package/src/components/RevealPlayer/RevealPlayer.tsx +104 -102
- package/src/components/index.ts +5 -5
- package/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.tsx +44 -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/{components → containers/MarkdownSlide}/MarkdownSlide.tsx +9 -7
- package/src/containers/MarkdownSlide/index.ts +5 -0
- package/src/containers/index.ts +9 -0
- package/src/meta.ts +3 -3
- package/src/operations/definitions.ts +23 -0
- package/src/operations/index.ts +5 -0
- package/src/testing.ts +6 -6
- package/src/translations.ts +6 -5
- package/src/types/Settings.ts +15 -0
- package/src/types/index.ts +30 -0
- 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 +0 -18
- 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/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/dist/types/src/types.d.ts +0 -40
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/components/CollectionPresenterContainer.tsx +0 -44
- package/src/components/DocumentPresenterContainer.tsx +0 -23
- package/src/components/PresenterSettings.tsx +0 -30
- package/src/types.ts +0 -46
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
|
|
7
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
7
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
8
|
|
|
9
|
-
import { createSlide } from '
|
|
9
|
+
import { createSlide } from '#testing';
|
|
10
10
|
|
|
11
11
|
import { Slide } from './Slide';
|
|
12
12
|
|
|
13
13
|
const meta = {
|
|
14
|
-
title: 'plugins/plugin-presenter/Slide',
|
|
14
|
+
title: 'plugins/plugin-presenter/components/Slide',
|
|
15
15
|
component: Slide,
|
|
16
|
-
decorators: [withTheme],
|
|
16
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
17
17
|
parameters: {
|
|
18
18
|
layout: 'fullscreen',
|
|
19
19
|
},
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import 'highlight.js/styles/github.css';
|
|
6
|
+
|
|
5
7
|
import { h } from 'hastscript';
|
|
6
8
|
import React from 'react';
|
|
7
9
|
import ReactMarkdown, { type Options as ReactMarkdownOptions } from 'react-markdown';
|
|
@@ -10,8 +12,6 @@ import rehypeHighlight from 'rehype-highlight';
|
|
|
10
12
|
import remarkFrontmatter from 'remark-frontmatter';
|
|
11
13
|
import remarkParseFrontmatter from 'remark-parse-frontmatter';
|
|
12
14
|
|
|
13
|
-
import 'highlight.js/styles/github.css';
|
|
14
|
-
|
|
15
15
|
import styles from './styles.css?raw';
|
|
16
16
|
import { theme } from './theme';
|
|
17
17
|
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
// TODO(burdon): Create theme type and picker.
|
|
6
6
|
|
|
7
7
|
export const theme = {
|
|
8
|
-
root: 'bg-attention leading-relaxed font-mono',
|
|
8
|
+
root: 'bg-attention-surface leading-relaxed font-mono',
|
|
9
9
|
|
|
10
|
-
padding: '
|
|
10
|
+
padding: 'px-40 py-16 gap-8',
|
|
11
11
|
|
|
12
12
|
nodes: {
|
|
13
|
-
h1: 'text-[80px] text-
|
|
14
|
-
h2: 'text-[60px] text-
|
|
15
|
-
h3: 'text-[48px] text-
|
|
13
|
+
h1: 'text-[80px] text-accent-text',
|
|
14
|
+
h2: 'text-[60px] text-accent-text',
|
|
15
|
+
h3: 'text-[48px] text-accent-text',
|
|
16
16
|
|
|
17
17
|
p: 'text-[48px]',
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ export const theme = {
|
|
|
20
20
|
ol: 'my-[16px] ml-24 leading-relaxed list-decimal',
|
|
21
21
|
li: 'pl-6 text-[48px]',
|
|
22
22
|
|
|
23
|
-
pre: '
|
|
23
|
+
pre: 'w-full mx-0 my-[32px] p-4 bg-input-surface',
|
|
24
24
|
code: 'p-0 text-[40px]',
|
|
25
25
|
},
|
|
26
26
|
};
|
|
@@ -4,30 +4,31 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type PropsWithChildren, type ReactNode } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
7
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
9
8
|
|
|
10
|
-
export type LayoutProps =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
bottomRight?: ReactNode;
|
|
17
|
-
}>
|
|
18
|
-
>;
|
|
9
|
+
export type LayoutProps = PropsWithChildren<{
|
|
10
|
+
topLeft?: ReactNode;
|
|
11
|
+
topRight?: ReactNode;
|
|
12
|
+
bottomLeft?: ReactNode;
|
|
13
|
+
bottomRight?: ReactNode;
|
|
14
|
+
}>;
|
|
19
15
|
|
|
20
|
-
export const Layout =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<div
|
|
16
|
+
export const Layout = composable<HTMLDivElement, LayoutProps>(
|
|
17
|
+
({ children, topLeft, topRight, bottomLeft, bottomRight, ...props }, forwardedRef) => {
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
{...composableProps(props, { classNames: 'flex grow relative overflow-hidden bg-attention-surface' })}
|
|
21
|
+
ref={forwardedRef}
|
|
22
|
+
>
|
|
23
|
+
<div className='flex flex-col grow overflow-hidden'>{children}</div>
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
<div className='z-[200]'>
|
|
26
|
+
<div className='absolute top-4 left-4'>{topLeft}</div>
|
|
27
|
+
<div className='absolute top-4 right-4'>{topRight}</div>
|
|
28
|
+
<div className='absolute bottom-4 left-4'>{bottomLeft}</div>
|
|
29
|
+
<div className='absolute bottom-4 right-4'>{bottomRight}</div>
|
|
30
|
+
</div>
|
|
30
31
|
</div>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
);
|
|
@@ -23,9 +23,9 @@ const DefaultStory = ({ count = 20 }: PagerProps) => {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const meta = {
|
|
26
|
-
title: 'plugins/plugin-presenter/Pager',
|
|
26
|
+
title: 'plugins/plugin-presenter/components/Pager',
|
|
27
27
|
render: DefaultStory,
|
|
28
|
-
decorators: [withTheme],
|
|
28
|
+
decorators: [withTheme()],
|
|
29
29
|
parameters: {
|
|
30
30
|
layout: 'centered',
|
|
31
31
|
},
|
|
@@ -14,8 +14,8 @@ export type PagerProps = {
|
|
|
14
14
|
onExit?: () => void;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const Pager = ({ index:
|
|
18
|
-
const [index, setIndex] = useControlledState(
|
|
17
|
+
export const Pager = ({ index: indexProp = 0, count = 0, keys, onChange, onExit }: PagerProps) => {
|
|
18
|
+
const [index, setIndex] = useControlledState(indexProp);
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
onChange?.(index);
|
|
21
21
|
}, [index]);
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
import { PresenterSettings } from './PresenterSettings';
|
|
11
|
+
|
|
12
|
+
const meta = {
|
|
13
|
+
title: 'plugins/plugin-presenter/components/PresenterSettings',
|
|
14
|
+
component: PresenterSettings,
|
|
15
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
16
|
+
tags: ['settings'],
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: 'fullscreen',
|
|
19
|
+
translations,
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<typeof PresenterSettings>;
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
settings: { presentCollections: true },
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { Input, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Settings as SettingsForm } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
import { type 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.Item title={t('present-collections.label')} description={t('present-collections.description')}>
|
|
23
|
+
<Input.Switch
|
|
24
|
+
disabled={!onSettingsChange}
|
|
25
|
+
checked={settings.presentCollections}
|
|
26
|
+
onCheckedChange={(checked) => onSettingsChange?.((s) => ({ ...s, presentCollections: !!checked }))}
|
|
27
|
+
/>
|
|
28
|
+
</SettingsForm.Item>
|
|
29
|
+
</SettingsForm.Section>
|
|
30
|
+
</SettingsForm.Viewport>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Meta } from '@storybook/react-vite';
|
|
6
6
|
|
|
7
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
7
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
8
|
|
|
9
9
|
import CONTENT from '../../../testing/deck.md?raw';
|
|
10
10
|
import { translations } from '../../translations';
|
|
11
|
-
|
|
12
11
|
import { RevealPlayer } from './RevealPlayer';
|
|
13
12
|
|
|
14
13
|
// https://revealjs.com/markdown
|
|
@@ -20,9 +19,9 @@ import { RevealPlayer } from './RevealPlayer';
|
|
|
20
19
|
// https://fonts.google.com
|
|
21
20
|
|
|
22
21
|
const meta = {
|
|
23
|
-
title: 'plugins/plugin-presenter/RevealPlayer',
|
|
22
|
+
title: 'plugins/plugin-presenter/components/RevealPlayer',
|
|
24
23
|
component: RevealPlayer,
|
|
25
|
-
decorators: [withTheme],
|
|
24
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
26
25
|
parameters: {
|
|
27
26
|
layout: 'fullscreen',
|
|
28
27
|
translations,
|
|
@@ -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,115 +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
|
-
// 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
|
-
}
|
|
67
|
+
};
|
|
117
68
|
|
|
118
|
-
|
|
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
|
+
},
|
|
119
122
|
},
|
|
120
|
-
}
|
|
121
|
-
});
|
|
123
|
+
});
|
|
122
124
|
|
|
123
|
-
|
|
125
|
+
await deckRef.current.initialize();
|
|
124
126
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
if (slide !== undefined) {
|
|
128
|
+
deckRef.current.slide(slide < 0 ? deckRef.current?.getTotalSlides() + slide : slide - 1);
|
|
129
|
+
}
|
|
128
130
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
deckRef.current.addKeyBinding({ keyCode: 27, key: 'Escape', description: 'Exit full screen' }, () => {
|
|
132
|
+
onExit?.();
|
|
133
|
+
});
|
|
132
134
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
return () => {
|
|
136
|
+
try {
|
|
137
|
+
if (deckRef.current) {
|
|
138
|
+
deckRef.current.destroy();
|
|
139
|
+
deckRef.current = null;
|
|
140
|
+
}
|
|
141
|
+
} catch {
|
|
142
|
+
// Ignore.
|
|
138
143
|
}
|
|
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>
|
|
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>
|
|
170
172
|
</div>
|
|
171
173
|
</div>
|
|
172
174
|
</div>
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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,44 @@
|
|
|
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 AppSurface } 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
|
+
|
|
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 role='slide' data={{ subject: collection.objects[slide] }} />
|
|
40
|
+
</PresenterLayout>
|
|
41
|
+
</Panel.Content>
|
|
42
|
+
</Panel.Root>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -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/types';
|
|
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
|
+
};
|
|
@@ -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,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/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.
|