@dxos/plugin-presenter 0.8.4-main.c1de068 → 0.8.4-main.c4373fc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{CollectionPresenterContainer-GH4GIA6P.mjs → CollectionPresenterContainer-LPJILYRF.mjs} +7 -7
- package/dist/lib/browser/CollectionPresenterContainer-LPJILYRF.mjs.map +7 -0
- package/dist/lib/browser/{DocumentPresenterContainer-E7RGK572.mjs → DocumentPresenterContainer-F42V4KAL.mjs} +48 -50
- package/dist/lib/browser/DocumentPresenterContainer-F42V4KAL.mjs.map +7 -0
- package/dist/lib/browser/{MarkdownSlide-QHC3GZII.mjs → MarkdownSlide-BLVWTH3U.mjs} +15 -128
- package/dist/lib/browser/MarkdownSlide-BLVWTH3U.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-2ZLAWPF2.mjs → app-graph-builder-RLGABE65.mjs} +43 -14
- package/dist/lib/browser/app-graph-builder-RLGABE65.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VSD5LSE5.mjs → chunk-6ZM323ED.mjs} +2 -4
- package/dist/lib/browser/chunk-6ZM323ED.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SW3HIRDA.mjs → chunk-7DV6S5XB.mjs} +7 -7
- package/dist/lib/browser/chunk-7DV6S5XB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YYPOO6XK.mjs → chunk-QTSOWA2K.mjs} +15 -11
- package/dist/lib/browser/chunk-QTSOWA2K.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TANLITL2.mjs → chunk-UVGTHJUO.mjs} +2 -2
- package/dist/lib/browser/{chunk-TANLITL2.mjs.map → chunk-UVGTHJUO.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +8 -9
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-GQSVWJBG.mjs → react-surface-P7YJFHF3.mjs} +17 -17
- package/dist/lib/browser/react-surface-P7YJFHF3.mjs.map +7 -0
- package/dist/lib/browser/{settings-X7M27QCY.mjs → settings-7A4A2H6X.mjs} +5 -5
- package/dist/lib/browser/{settings-X7M27QCY.mjs.map → settings-7A4A2H6X.mjs.map} +2 -2
- package/dist/types/src/PresenterPlugin.d.ts +1 -1
- package/dist/types/src/PresenterPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/components/CollectionPresenterContainer.d.ts.map +1 -1
- package/dist/types/src/components/DocumentPresenterContainer.d.ts +2 -2
- package/dist/types/src/components/DocumentPresenterContainer.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/Container.stories.d.ts +14 -22
- package/dist/types/src/components/Markdown/Container.stories.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/Slide.d.ts +1 -3
- package/dist/types/src/components/Markdown/Slide.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/Slide.stories.d.ts +11 -12
- package/dist/types/src/components/Markdown/Slide.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSlide.d.ts +2 -2
- package/dist/types/src/components/MarkdownSlide.d.ts.map +1 -1
- package/dist/types/src/components/Presenter/Pager.d.ts +1 -1
- package/dist/types/src/components/Presenter/Pager.d.ts.map +1 -1
- package/dist/types/src/components/Presenter/Pager.stories.d.ts +12 -4
- package/dist/types/src/components/Presenter/Pager.stories.d.ts.map +1 -1
- package/dist/types/src/components/PresenterSettings.d.ts.map +1 -1
- package/dist/types/src/components/RevealPlayer/RevealPlayer.d.ts.map +1 -1
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts +18 -2
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +18 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +6 -6
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +35 -35
- package/src/PresenterPlugin.tsx +23 -24
- package/src/capabilities/app-graph-builder.ts +43 -12
- package/src/capabilities/react-surface.tsx +26 -16
- package/src/capabilities/settings.ts +1 -1
- package/src/components/CollectionPresenterContainer.tsx +2 -1
- package/src/components/DocumentPresenterContainer.tsx +4 -3
- package/src/components/Markdown/Container.stories.tsx +21 -20
- package/src/components/Markdown/Slide.stories.tsx +11 -7
- package/src/components/Markdown/Slide.tsx +12 -128
- package/src/components/Markdown/styles.css +104 -0
- package/src/components/Markdown/typings.d.ts +8 -0
- package/src/components/MarkdownSlide.tsx +2 -2
- package/src/components/Presenter/Pager.stories.tsx +8 -8
- package/src/components/Presenter/Pager.tsx +3 -3
- package/src/components/PresenterSettings.tsx +15 -11
- package/src/components/RevealPlayer/RevealPlayer.stories.tsx +7 -5
- package/src/components/RevealPlayer/RevealPlayer.tsx +50 -53
- package/src/meta.ts +1 -3
- package/src/translations.ts +1 -0
- package/src/types.ts +5 -5
- package/src/useExitPresenter.ts +1 -1
- package/dist/lib/browser/CollectionPresenterContainer-GH4GIA6P.mjs.map +0 -7
- package/dist/lib/browser/DocumentPresenterContainer-E7RGK572.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSlide-QHC3GZII.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-2ZLAWPF2.mjs.map +0 -7
- package/dist/lib/browser/chunk-SW3HIRDA.mjs.map +0 -7
- package/dist/lib/browser/chunk-VSD5LSE5.mjs.map +0 -7
- package/dist/lib/browser/chunk-YYPOO6XK.mjs.map +0 -7
- package/dist/lib/browser/react-surface-GQSVWJBG.mjs.map +0 -7
|
@@ -4,19 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
import { h } from 'hastscript';
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import ReactMarkdown from 'react-markdown';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import ReactMarkdown, { type Options as ReactMarkdownOptions } from 'react-markdown';
|
|
8
|
+
import rehypeAddClasses from 'rehype-add-classes';
|
|
9
|
+
import rehypeHighlight from 'rehype-highlight';
|
|
10
10
|
import remarkFrontmatter from 'remark-frontmatter';
|
|
11
11
|
import remarkParseFrontmatter from 'remark-parse-frontmatter';
|
|
12
12
|
|
|
13
13
|
import 'highlight.js/styles/github.css';
|
|
14
14
|
|
|
15
|
+
import styles from './styles.css?raw';
|
|
15
16
|
import { theme } from './theme';
|
|
16
17
|
|
|
17
18
|
export type SlideProps = {
|
|
18
19
|
content?: string;
|
|
19
|
-
classes?:
|
|
20
|
+
classes?: Record<string, string>;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export const Slide = ({ content = '', classes = theme.nodes }: SlideProps) => {
|
|
@@ -24,132 +25,13 @@ export const Slide = ({ content = '', classes = theme.nodes }: SlideProps) => {
|
|
|
24
25
|
// configurable. Find a way to remove the literal stylesheet here.
|
|
25
26
|
return (
|
|
26
27
|
<>
|
|
27
|
-
<style>{
|
|
28
|
-
.dark pre code.hljs {
|
|
29
|
-
display: block;
|
|
30
|
-
overflow-x: auto;
|
|
31
|
-
padding: 1em
|
|
32
|
-
}
|
|
33
|
-
.dark code.hljs {
|
|
34
|
-
padding: 3px 5px
|
|
35
|
-
}
|
|
36
|
-
/*!
|
|
37
|
-
Theme: GitHub Dark
|
|
38
|
-
Description: Dark theme as seen on github.com
|
|
39
|
-
Author: github.com
|
|
40
|
-
Maintainer: @Hirse
|
|
41
|
-
Updated: 2021-05-15
|
|
42
|
-
|
|
43
|
-
Outdated base version: https://github.com/primer/github-syntax-dark
|
|
44
|
-
Current colors taken from GitHub's CSS
|
|
45
|
-
*/
|
|
46
|
-
.dark .hljs {
|
|
47
|
-
color: #c9d1d9;
|
|
48
|
-
background: #0d1117
|
|
49
|
-
}
|
|
50
|
-
.dark .hljs-doctag,
|
|
51
|
-
.dark .hljs-keyword,
|
|
52
|
-
.dark .hljs-meta .hljs-keyword,
|
|
53
|
-
.dark .hljs-template-tag,
|
|
54
|
-
.dark .hljs-template-variable,
|
|
55
|
-
.dark .hljs-type,
|
|
56
|
-
.dark .hljs-variable.language_ {
|
|
57
|
-
/* prettylights-syntax-keyword */
|
|
58
|
-
color: #ff7b72
|
|
59
|
-
}
|
|
60
|
-
.dark .hljs-title,
|
|
61
|
-
.dark .hljs-title.class_,
|
|
62
|
-
.dark .hljs-title.class_.inherited__,
|
|
63
|
-
.dark .hljs-title.function_ {
|
|
64
|
-
/* prettylights-syntax-entity */
|
|
65
|
-
color: #d2a8ff
|
|
66
|
-
}
|
|
67
|
-
.dark .hljs-attr,
|
|
68
|
-
.dark .hljs-attribute,
|
|
69
|
-
.dark .hljs-literal,
|
|
70
|
-
.dark .hljs-meta,
|
|
71
|
-
.dark .hljs-number,
|
|
72
|
-
.dark .hljs-operator,
|
|
73
|
-
.dark .hljs-variable,
|
|
74
|
-
.dark .hljs-selector-attr,
|
|
75
|
-
.dark .hljs-selector-class,
|
|
76
|
-
.dark .hljs-selector-id {
|
|
77
|
-
/* prettylights-syntax-constant */
|
|
78
|
-
color: #79c0ff
|
|
79
|
-
}
|
|
80
|
-
.dark .hljs-regexp,
|
|
81
|
-
.dark .hljs-string,
|
|
82
|
-
.dark .hljs-meta .hljs-string {
|
|
83
|
-
/* prettylights-syntax-string */
|
|
84
|
-
color: #a5d6ff
|
|
85
|
-
}
|
|
86
|
-
.dark .hljs-built_in,
|
|
87
|
-
.dark .hljs-symbol {
|
|
88
|
-
/* prettylights-syntax-variable */
|
|
89
|
-
color: #ffa657
|
|
90
|
-
}
|
|
91
|
-
.dark .hljs-comment,
|
|
92
|
-
.dark .hljs-code,
|
|
93
|
-
.dark .hljs-formula {
|
|
94
|
-
/* prettylights-syntax-comment */
|
|
95
|
-
color: #8b949e
|
|
96
|
-
}
|
|
97
|
-
.dark .hljs-name,
|
|
98
|
-
.dark .hljs-quote,
|
|
99
|
-
.dark .hljs-selector-tag,
|
|
100
|
-
.dark .hljs-selector-pseudo {
|
|
101
|
-
/* prettylights-syntax-entity-tag */
|
|
102
|
-
color: #7ee787
|
|
103
|
-
}
|
|
104
|
-
.dark .hljs-subst {
|
|
105
|
-
/* prettylights-syntax-storage-modifier-import */
|
|
106
|
-
color: #c9d1d9
|
|
107
|
-
}
|
|
108
|
-
.dark .hljs-section {
|
|
109
|
-
/* prettylights-syntax-markup-heading */
|
|
110
|
-
color: #1f6feb;
|
|
111
|
-
font-weight: bold
|
|
112
|
-
}
|
|
113
|
-
.dark .hljs-bullet {
|
|
114
|
-
/* prettylights-syntax-markup-list */
|
|
115
|
-
color: #f2cc60
|
|
116
|
-
}
|
|
117
|
-
.dark .hljs-emphasis {
|
|
118
|
-
/* prettylights-syntax-markup-italic */
|
|
119
|
-
color: #c9d1d9;
|
|
120
|
-
font-style: italic
|
|
121
|
-
}
|
|
122
|
-
.dark .hljs-strong {
|
|
123
|
-
/* prettylights-syntax-markup-bold */
|
|
124
|
-
color: #c9d1d9;
|
|
125
|
-
font-weight: bold
|
|
126
|
-
}
|
|
127
|
-
.dark .hljs-addition {
|
|
128
|
-
/* prettylights-syntax-markup-inserted */
|
|
129
|
-
color: #aff5b4;
|
|
130
|
-
background-color: #033a16
|
|
131
|
-
}
|
|
132
|
-
.dark .hljs-deletion {
|
|
133
|
-
/* prettylights-syntax-markup-deleted */
|
|
134
|
-
color: #ffdcd7;
|
|
135
|
-
background-color: #67060c
|
|
136
|
-
}
|
|
137
|
-
.dark .hljs-char.escape_,
|
|
138
|
-
.dark .hljs-link,
|
|
139
|
-
.dark .hljs-params,
|
|
140
|
-
.dark .hljs-property,
|
|
141
|
-
.dark .hljs-punctuation,
|
|
142
|
-
.dark .hljs-tag {
|
|
143
|
-
/* purposely ignored */
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
`}</style>
|
|
28
|
+
<style>{styles}</style>
|
|
147
29
|
<ReactMarkdown
|
|
148
30
|
components={components}
|
|
149
31
|
// Markdown to HTML.
|
|
150
32
|
remarkPlugins={[[remarkFrontmatter, 'yaml'], remarkParseFrontmatter as any]}
|
|
151
33
|
// HTML processing.
|
|
152
|
-
rehypePlugins={[
|
|
34
|
+
rehypePlugins={[[rehypeAddClasses, classes], rehypeHighlight as any, slideLayout]}
|
|
153
35
|
>
|
|
154
36
|
{content}
|
|
155
37
|
</ReactMarkdown>
|
|
@@ -164,7 +46,7 @@ export const Slide = ({ content = '', classes = theme.nodes }: SlideProps) => {
|
|
|
164
46
|
* E.g., layout image from front-matter.
|
|
165
47
|
*/
|
|
166
48
|
const slideLayout =
|
|
167
|
-
(
|
|
49
|
+
(_options = {}) =>
|
|
168
50
|
(tree: any, file: any) => {
|
|
169
51
|
const {
|
|
170
52
|
data: { frontmatter = {} },
|
|
@@ -210,9 +92,11 @@ const slideLayout =
|
|
|
210
92
|
tree.children = [root];
|
|
211
93
|
};
|
|
212
94
|
|
|
213
|
-
const ImageWrapper = ({ node, ...props }: { node: any }) => {
|
|
95
|
+
const ImageWrapper = ({ node: _, ...props }: { node: any }) => {
|
|
214
96
|
const { alt = '', src } = props as { alt: string; src: string };
|
|
215
97
|
return <img alt={alt} src={src} />;
|
|
216
98
|
};
|
|
217
99
|
|
|
218
|
-
const components = {
|
|
100
|
+
const components: ReactMarkdownOptions['components'] = {
|
|
101
|
+
img: ({ node, ...props }) => <ImageWrapper node={node} {...props} />,
|
|
102
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
Theme: GitHub Dark
|
|
3
|
+
Description: Dark theme as seen on github.com
|
|
4
|
+
Author: github.com
|
|
5
|
+
Maintainer: @Hirse
|
|
6
|
+
Updated: 2021-05-15
|
|
7
|
+
Outdated base version: https://github.com/primer/github-syntax-dark
|
|
8
|
+
Current colors taken from GitHub's CSS
|
|
9
|
+
*/
|
|
10
|
+
/* TODO(burdon): Use tokens. */
|
|
11
|
+
.dark pre code.hljs {
|
|
12
|
+
display: block;
|
|
13
|
+
overflow-x: auto;
|
|
14
|
+
padding: 1em;
|
|
15
|
+
}
|
|
16
|
+
.dark code.hljs {
|
|
17
|
+
padding: 3px 5px;
|
|
18
|
+
}
|
|
19
|
+
.dark .hljs {
|
|
20
|
+
color: #c9d1d9;
|
|
21
|
+
background: #0d1117;
|
|
22
|
+
}
|
|
23
|
+
.dark .hljs-doctag,
|
|
24
|
+
.dark .hljs-keyword,
|
|
25
|
+
.dark .hljs-meta .hljs-keyword,
|
|
26
|
+
.dark .hljs-template-tag,
|
|
27
|
+
.dark .hljs-template-variable,
|
|
28
|
+
.dark .hljs-type,
|
|
29
|
+
.dark .hljs-variable.language_ {
|
|
30
|
+
color: #ff7b72;
|
|
31
|
+
}
|
|
32
|
+
.dark .hljs-title,
|
|
33
|
+
.dark .hljs-title.class_,
|
|
34
|
+
.dark .hljs-title.class_.inherited__,
|
|
35
|
+
.dark .hljs-title.function_ {
|
|
36
|
+
color: #d2a8ff;
|
|
37
|
+
}
|
|
38
|
+
.dark .hljs-attr,
|
|
39
|
+
.dark .hljs-attribute,
|
|
40
|
+
.dark .hljs-literal,
|
|
41
|
+
.dark .hljs-meta,
|
|
42
|
+
.dark .hljs-number,
|
|
43
|
+
.dark .hljs-operator,
|
|
44
|
+
.dark .hljs-variable,
|
|
45
|
+
.dark .hljs-selector-attr,
|
|
46
|
+
.dark .hljs-selector-class,
|
|
47
|
+
.dark .hljs-selector-id {
|
|
48
|
+
color: #79c0ff;
|
|
49
|
+
}
|
|
50
|
+
.dark .hljs-regexp,
|
|
51
|
+
.dark .hljs-string,
|
|
52
|
+
.dark .hljs-meta .hljs-string {
|
|
53
|
+
color: #a5d6ff;
|
|
54
|
+
}
|
|
55
|
+
.dark .hljs-built_in,
|
|
56
|
+
.dark .hljs-symbol {
|
|
57
|
+
color: #ffa657;
|
|
58
|
+
}
|
|
59
|
+
.dark .hljs-comment,
|
|
60
|
+
.dark .hljs-code,
|
|
61
|
+
.dark .hljs-formula {
|
|
62
|
+
color: #8b949e;
|
|
63
|
+
}
|
|
64
|
+
.dark .hljs-name,
|
|
65
|
+
.dark .hljs-quote,
|
|
66
|
+
.dark .hljs-selector-tag,
|
|
67
|
+
.dark .hljs-selector-pseudo {
|
|
68
|
+
color: #7ee787;
|
|
69
|
+
}
|
|
70
|
+
.dark .hljs-subst {
|
|
71
|
+
color: #c9d1d9;
|
|
72
|
+
}
|
|
73
|
+
.dark .hljs-section {
|
|
74
|
+
color: #1f6feb;
|
|
75
|
+
font-weight: bold;
|
|
76
|
+
}
|
|
77
|
+
.dark .hljs-bullet {
|
|
78
|
+
color: #f2cc60;
|
|
79
|
+
}
|
|
80
|
+
.dark .hljs-emphasis {
|
|
81
|
+
color: #c9d1d9;
|
|
82
|
+
font-style: italic;
|
|
83
|
+
}
|
|
84
|
+
.dark .hljs-strong {
|
|
85
|
+
color: #c9d1d9;
|
|
86
|
+
font-weight: bold;
|
|
87
|
+
}
|
|
88
|
+
.dark .hljs-addition {
|
|
89
|
+
color: #aff5b4;
|
|
90
|
+
background-color: #033a16;
|
|
91
|
+
}
|
|
92
|
+
.dark .hljs-deletion {
|
|
93
|
+
color: #ffdcd7;
|
|
94
|
+
background-color: #67060c;
|
|
95
|
+
}
|
|
96
|
+
.dark .hljs-char.escape_,
|
|
97
|
+
.dark .hljs-link,
|
|
98
|
+
.dark .hljs-params,
|
|
99
|
+
.dark .hljs-property,
|
|
100
|
+
.dark .hljs-punctuation,
|
|
101
|
+
.dark .hljs-tag {
|
|
102
|
+
/* purposely ignored */
|
|
103
|
+
all: unset;
|
|
104
|
+
}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type FC } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type Markdown } from '@dxos/plugin-markdown/types';
|
|
8
8
|
|
|
9
9
|
import { Container, Slide } from './Markdown';
|
|
10
10
|
|
|
11
|
-
const MarkdownSlide: FC<{ document:
|
|
11
|
+
const MarkdownSlide: FC<{ document: Markdown.Document }> = ({ document }) => {
|
|
12
12
|
const content = document.content.target?.content;
|
|
13
13
|
if (!content) {
|
|
14
14
|
return null;
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
|
-
import { withTheme } from '@dxos/
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
9
|
|
|
12
10
|
import { PageNumber, Pager, type PagerProps, StartButton } from './Pager';
|
|
13
11
|
|
|
@@ -24,15 +22,17 @@ const DefaultStory = ({ count = 20 }: PagerProps) => {
|
|
|
24
22
|
);
|
|
25
23
|
};
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const meta: Meta<PagerProps> = {
|
|
25
|
+
const meta = {
|
|
30
26
|
title: 'plugins/plugin-presenter/Pager',
|
|
31
27
|
render: DefaultStory,
|
|
32
28
|
decorators: [withTheme],
|
|
33
29
|
parameters: {
|
|
34
30
|
layout: 'centered',
|
|
35
31
|
},
|
|
36
|
-
}
|
|
32
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
37
33
|
|
|
38
34
|
export default meta;
|
|
35
|
+
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
37
|
+
|
|
38
|
+
export const Default: Story = {};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Button,
|
|
7
|
+
import { Button, Icon, useControlledState } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
9
|
export type PagerProps = {
|
|
10
10
|
index?: number;
|
|
@@ -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: indexParam = 0, count = 0, keys, onChange, onExit }: PagerProps) => {
|
|
18
|
+
const [index, setIndex] = useControlledState(indexParam);
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
onChange?.(index);
|
|
21
21
|
}, [index]);
|
|
@@ -5,22 +5,26 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Input, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import {
|
|
8
|
+
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { meta } from '../meta';
|
|
11
11
|
import { type PresenterSettingsProps } from '../types';
|
|
12
12
|
|
|
13
13
|
export const PresenterSettings = ({ settings }: { settings: PresenterSettingsProps }) => {
|
|
14
|
-
const { t } = useTranslation(
|
|
14
|
+
const { t } = useTranslation(meta.id);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
<ControlPage>
|
|
18
|
+
<ControlSection title={t('settings title', { ns: meta.id })}>
|
|
19
|
+
<ControlGroup>
|
|
20
|
+
<ControlItemInput title={t('present collections label')}>
|
|
21
|
+
<Input.Switch
|
|
22
|
+
checked={settings.presentCollections}
|
|
23
|
+
onCheckedChange={(checked) => (settings.presentCollections = !!checked)}
|
|
24
|
+
/>
|
|
25
|
+
</ControlItemInput>
|
|
26
|
+
</ControlGroup>
|
|
27
|
+
</ControlSection>
|
|
28
|
+
</ControlPage>
|
|
25
29
|
);
|
|
26
30
|
};
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta } from '@storybook/react-vite';
|
|
8
6
|
|
|
9
|
-
import {
|
|
7
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
8
|
+
|
|
10
9
|
import CONTENT from '../../../testing/deck.md?raw';
|
|
11
10
|
import { translations } from '../../translations';
|
|
12
11
|
|
|
12
|
+
import { RevealPlayer } from './RevealPlayer';
|
|
13
|
+
|
|
13
14
|
// https://revealjs.com/markdown
|
|
14
15
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/background-position
|
|
15
16
|
// https://colorhunt.co/palettes/dark
|
|
@@ -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
|
+
const meta = {
|
|
22
23
|
title: 'plugins/plugin-presenter/RevealPlayer',
|
|
23
24
|
component: RevealPlayer,
|
|
25
|
+
decorators: [withTheme],
|
|
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,9 +2,8 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
// eslint-disable-next-line no-restricted-imports
|
|
6
5
|
import 'reveal.js/dist/reveal.css';
|
|
7
|
-
|
|
6
|
+
|
|
8
7
|
import 'reveal.js/dist/theme/black.css';
|
|
9
8
|
|
|
10
9
|
// https://github.com/highlightjs/highlight.js/tree/main/src/styles
|
|
@@ -13,12 +12,12 @@ import 'highlight.js/styles/tokyo-night-dark.css';
|
|
|
13
12
|
|
|
14
13
|
import hljs from 'highlight.js';
|
|
15
14
|
import typescript from 'highlight.js/lib/languages/typescript';
|
|
16
|
-
import React, {
|
|
15
|
+
import React, { useRef } from 'react';
|
|
17
16
|
import Reveal from 'reveal.js';
|
|
18
17
|
import RevealHighlight from 'reveal.js/plugin/highlight/highlight';
|
|
19
18
|
import RevealMarkdown from 'reveal.js/plugin/markdown/plugin.js';
|
|
20
19
|
|
|
21
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
20
|
+
import { type ThemedClassName, useAsyncEffect } from '@dxos/react-ui';
|
|
22
21
|
import { mx } from '@dxos/react-ui-theme';
|
|
23
22
|
|
|
24
23
|
const styles = `
|
|
@@ -72,7 +71,8 @@ export type RevealProps = ThemedClassName<{
|
|
|
72
71
|
export const RevealPlayer = ({ classNames, content, slide, fullscreen = true, onExit }: RevealProps) => {
|
|
73
72
|
const deckDivRef = useRef<HTMLDivElement>(null);
|
|
74
73
|
const deckRef = useRef<Reveal.Api | null>(null);
|
|
75
|
-
|
|
74
|
+
|
|
75
|
+
useAsyncEffect(async () => {
|
|
76
76
|
if (deckRef.current) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
@@ -80,66 +80,63 @@ export const RevealPlayer = ({ classNames, content, slide, fullscreen = true, on
|
|
|
80
80
|
// Required for syntax highlighting.
|
|
81
81
|
hljs.registerLanguage('typescript', typescript);
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return hljs.highlightAuto(code).value;
|
|
120
|
-
},
|
|
83
|
+
// https://revealjs.com/react
|
|
84
|
+
// https://revealjs.com/config
|
|
85
|
+
// https://github.com/hakimel/reveal.js
|
|
86
|
+
// TODO(burdon): Fragments and scroll view steps 2 at a time (safe mode?)
|
|
87
|
+
deckRef.current = new Reveal(deckDivRef.current!, {
|
|
88
|
+
// view: 'scroll',
|
|
89
|
+
progress: false,
|
|
90
|
+
transition: 'none',
|
|
91
|
+
slideNumber: false,
|
|
92
|
+
embedded: true,
|
|
93
|
+
|
|
94
|
+
// 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
|
+
}
|
|
117
|
+
|
|
118
|
+
return hljs.highlightAuto(code).value;
|
|
121
119
|
},
|
|
122
|
-
}
|
|
120
|
+
},
|
|
121
|
+
});
|
|
123
122
|
|
|
124
|
-
|
|
123
|
+
await deckRef.current.initialize();
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
if (slide !== undefined) {
|
|
126
|
+
deckRef.current.slide(slide < 0 ? deckRef.current?.getTotalSlides() + slide : slide - 1);
|
|
127
|
+
}
|
|
129
128
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
});
|
|
129
|
+
deckRef.current.addKeyBinding({ keyCode: 27, key: 'Escape', description: 'Exit full screen' }, () => {
|
|
130
|
+
onExit?.();
|
|
133
131
|
});
|
|
134
132
|
|
|
135
133
|
return () => {
|
|
136
134
|
try {
|
|
137
|
-
clearTimeout(t);
|
|
138
135
|
if (deckRef.current) {
|
|
139
136
|
deckRef.current.destroy();
|
|
140
137
|
deckRef.current = null;
|
|
141
138
|
}
|
|
142
|
-
} catch
|
|
139
|
+
} catch {
|
|
143
140
|
// Ignore.
|
|
144
141
|
}
|
|
145
142
|
};
|
package/src/meta.ts
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const PRESENTER_PLUGIN = 'dxos.org/plugin/presenter';
|
|
8
|
-
|
|
9
7
|
export const meta: PluginMeta = {
|
|
10
|
-
id:
|
|
8
|
+
id: 'dxos.org/plugin/presenter',
|
|
11
9
|
name: 'Presenter',
|
|
12
10
|
description: 'Present documents as slideshows.',
|
|
13
11
|
icon: 'ph--presentation--regular',
|
package/src/translations.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { type Context, createContext } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
9
9
|
import { DataType } from '@dxos/schema';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { meta } from './meta';
|
|
12
12
|
|
|
13
13
|
export namespace PresenterAction {
|
|
14
|
-
const PRESENTER_ACTION = `${
|
|
14
|
+
const PRESENTER_ACTION = `${meta.id}/action`;
|
|
15
15
|
|
|
16
16
|
export class TogglePresentation extends Schema.TaggedClass<TogglePresentation>()(
|
|
17
17
|
`${PRESENTER_ACTION}/toggle-presentation`,
|
|
18
18
|
{
|
|
19
19
|
input: Schema.Struct({
|
|
20
|
-
object: Schema.Union(
|
|
20
|
+
object: Schema.Union(Markdown.Document, DataType.Collection),
|
|
21
21
|
state: Schema.optional(Schema.Boolean),
|
|
22
22
|
}),
|
|
23
23
|
output: Schema.Void,
|
package/src/useExitPresenter.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LayoutAction, createIntent, useCapability, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { type Live } from '@dxos/live-object';
|
|
9
9
|
import { DeckCapabilities } from '@dxos/plugin-deck';
|
|
10
10
|
import { DeckAction } from '@dxos/plugin-deck/types';
|