@dxos/plugin-presenter 0.8.4-main.2e9d522 → 0.8.4-main.548089c
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-4JFW3EKV.mjs} +33 -25
- package/dist/lib/browser/CollectionPresenterContainer-4JFW3EKV.mjs.map +7 -0
- package/dist/lib/browser/{DocumentPresenterContainer-E7RGK572.mjs → DocumentPresenterContainer-SX32NAEH.mjs} +51 -53
- package/dist/lib/browser/DocumentPresenterContainer-SX32NAEH.mjs.map +7 -0
- package/dist/lib/browser/{MarkdownSlide-QHC3GZII.mjs → MarkdownSlide-MEXR54L5.mjs} +18 -131
- package/dist/lib/browser/MarkdownSlide-MEXR54L5.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-2ZLAWPF2.mjs → app-graph-builder-5KXFJ3CR.mjs} +47 -18
- package/dist/lib/browser/app-graph-builder-5KXFJ3CR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TANLITL2.mjs → chunk-BJWK5GQV.mjs} +6 -4
- package/dist/lib/browser/chunk-BJWK5GQV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YYPOO6XK.mjs → chunk-Q3H4KEFB.mjs} +15 -11
- package/dist/lib/browser/chunk-Q3H4KEFB.mjs.map +7 -0
- package/dist/lib/browser/chunk-TMTUZQCK.mjs +18 -0
- package/dist/lib/browser/chunk-TMTUZQCK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SW3HIRDA.mjs → chunk-VRRPVTKA.mjs} +8 -8
- package/dist/lib/browser/chunk-VRRPVTKA.mjs.map +7 -0
- 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-S4T6X72R.mjs} +18 -18
- package/dist/lib/browser/react-surface-S4T6X72R.mjs.map +7 -0
- package/dist/lib/browser/{settings-X7M27QCY.mjs → settings-57TUVRW3.mjs} +5 -5
- package/dist/lib/browser/{settings-X7M27QCY.mjs.map → settings-57TUVRW3.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 +2 -2
- 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 +20 -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 +7 -6
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/useExitPresenter.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +38 -36
- package/src/PresenterPlugin.tsx +23 -24
- package/src/capabilities/app-graph-builder.ts +48 -17
- package/src/capabilities/react-surface.tsx +27 -17
- package/src/capabilities/settings.ts +1 -1
- package/src/components/CollectionPresenterContainer.tsx +5 -4
- package/src/components/DocumentPresenterContainer.tsx +4 -3
- package/src/components/Markdown/Container.stories.tsx +21 -20
- package/src/components/Markdown/Container.tsx +1 -1
- 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/theme.ts +2 -2
- 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 +53 -18
- package/src/components/PresenterSettings.tsx +15 -11
- package/src/components/RevealPlayer/RevealPlayer.stories.tsx +7 -5
- package/src/components/RevealPlayer/RevealPlayer.tsx +61 -57
- package/src/meta.ts +7 -4
- package/src/translations.ts +1 -0
- package/src/types.ts +6 -6
- package/src/useExitPresenter.ts +5 -3
- 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-TANLITL2.mjs.map +0 -7
- package/dist/lib/browser/chunk-VSD5LSE5.mjs +0 -15
- 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
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export const theme = {
|
|
8
8
|
root: 'bg-attention leading-relaxed font-mono',
|
|
9
9
|
|
|
10
|
-
padding: '
|
|
10
|
+
padding: 'pli-40 plb-16 gap-8',
|
|
11
11
|
|
|
12
12
|
nodes: {
|
|
13
13
|
h1: 'text-[80px] text-accentText',
|
|
@@ -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: 'is-full mx-0 my-[32px] p-0 __border-l-[16px] bg-inputSurface p-4 __whitespace-pre-line',
|
|
24
24
|
code: 'p-0 text-[40px]',
|
|
25
25
|
},
|
|
26
26
|
};
|
|
@@ -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 {
|
|
7
|
+
import { IconButton, 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]);
|
|
@@ -76,18 +76,46 @@ export const Pager = ({ index: controlledIndex = 0, count = 0, keys, onChange, o
|
|
|
76
76
|
|
|
77
77
|
return (
|
|
78
78
|
<div className='flex items-center text-neutral-500'>
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
79
|
+
<IconButton
|
|
80
|
+
icon='ph--caret-double-left--regular'
|
|
81
|
+
size={6}
|
|
82
|
+
label='Jump to first'
|
|
83
|
+
iconOnly
|
|
84
|
+
noTooltip
|
|
85
|
+
variant='ghost'
|
|
86
|
+
classNames='p-0'
|
|
87
|
+
onClick={() => onChange?.(0)}
|
|
88
|
+
/>
|
|
89
|
+
<IconButton
|
|
90
|
+
icon='ph--caret-left--regular'
|
|
91
|
+
size={6}
|
|
92
|
+
label='Previous'
|
|
93
|
+
iconOnly
|
|
94
|
+
noTooltip
|
|
95
|
+
variant='ghost'
|
|
96
|
+
classNames='p-0'
|
|
97
|
+
onClick={() => handleChangeIndex(-1)}
|
|
98
|
+
/>
|
|
99
|
+
<IconButton
|
|
100
|
+
icon='ph--caret-right--regular'
|
|
101
|
+
size={6}
|
|
102
|
+
label='Next'
|
|
103
|
+
iconOnly
|
|
104
|
+
noTooltip
|
|
105
|
+
variant='ghost'
|
|
106
|
+
classNames='p-0'
|
|
107
|
+
onClick={() => handleChangeIndex(1)}
|
|
108
|
+
/>
|
|
109
|
+
<IconButton
|
|
110
|
+
icon='ph--caret-double-right--regular'
|
|
111
|
+
size={6}
|
|
112
|
+
label='Jump to last'
|
|
113
|
+
iconOnly
|
|
114
|
+
noTooltip
|
|
115
|
+
variant='ghost'
|
|
116
|
+
classNames='p-0'
|
|
117
|
+
onClick={() => onChange?.(count - 1)}
|
|
118
|
+
/>
|
|
91
119
|
</div>
|
|
92
120
|
);
|
|
93
121
|
};
|
|
@@ -113,8 +141,15 @@ export const PageNumber = ({ index = 0, count = 1 }: PageNumberProps) => {
|
|
|
113
141
|
|
|
114
142
|
export const StartButton = ({ running, onClick }: { running?: boolean; onClick?: (start: boolean) => void }) => {
|
|
115
143
|
return (
|
|
116
|
-
<
|
|
117
|
-
{
|
|
118
|
-
|
|
144
|
+
<IconButton
|
|
145
|
+
icon={running ? 'ph--x--regular' : 'ph--play--regular'}
|
|
146
|
+
size={6}
|
|
147
|
+
label={running ? 'Stop' : 'Play'}
|
|
148
|
+
iconOnly
|
|
149
|
+
noTooltip
|
|
150
|
+
variant='ghost'
|
|
151
|
+
classNames='p-0'
|
|
152
|
+
onClick={() => onClick?.(!running)}
|
|
153
|
+
/>
|
|
119
154
|
);
|
|
120
155
|
};
|
|
@@ -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
|
|