@dxos/plugin-presenter 0.8.4-main.67995b8 → 0.8.4-main.69d29f4
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-IHDZWP3U.mjs +176 -0
- package/dist/lib/browser/CollectionPresenterContainer-IHDZWP3U.mjs.map +7 -0
- package/dist/lib/browser/DocumentPresenterContainer-74M6XAAI.mjs +173 -0
- package/dist/lib/browser/DocumentPresenterContainer-74M6XAAI.mjs.map +7 -0
- package/dist/lib/browser/MarkdownSlide-GIYJABHE.mjs +200 -0
- package/dist/lib/browser/MarkdownSlide-GIYJABHE.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-2QAQR34J.mjs +112 -0
- package/dist/lib/browser/app-graph-builder-2QAQR34J.mjs.map +7 -0
- package/dist/lib/browser/chunk-4PZXJXBO.mjs +50 -0
- package/dist/lib/browser/chunk-4PZXJXBO.mjs.map +7 -0
- package/dist/lib/browser/chunk-5MC4V23G.mjs +38 -0
- package/dist/lib/browser/chunk-5MC4V23G.mjs.map +7 -0
- package/dist/lib/browser/chunk-GM4KOXJY.mjs +41 -0
- package/dist/lib/browser/chunk-GM4KOXJY.mjs.map +7 -0
- package/dist/lib/browser/chunk-VQVZVXPJ.mjs +18 -0
- package/dist/lib/browser/chunk-VQVZVXPJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +24 -32
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-2VP2M4Z7.mjs +63 -0
- package/dist/lib/browser/react-surface-2VP2M4Z7.mjs.map +7 -0
- package/dist/lib/browser/settings-RDHXCCT4.mjs +31 -0
- package/dist/lib/browser/settings-RDHXCCT4.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/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- 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/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +7 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +9 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/CollectionPresenterContainer.d.ts +5 -5
- package/dist/types/src/components/CollectionPresenterContainer.d.ts.map +1 -1
- 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 +4 -3
- 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 +4 -2
- 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 +25 -7
- package/dist/types/src/components/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/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +36 -26
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/useExitPresenter.d.ts +2 -3
- package/dist/types/src/useExitPresenter.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +47 -41
- package/src/PresenterPlugin.tsx +8 -24
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +105 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +3 -5
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +70 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +30 -0
- package/src/components/CollectionPresenterContainer.tsx +14 -14
- package/src/components/DocumentPresenterContainer.tsx +5 -4
- package/src/components/Markdown/Container.stories.tsx +21 -20
- package/src/components/Markdown/Container.tsx +2 -2
- 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 +6 -2
- package/src/components/Presenter/Layout.tsx +1 -1
- package/src/components/Presenter/Pager.stories.tsx +8 -8
- package/src/components/Presenter/Pager.tsx +53 -18
- package/src/components/PresenterSettings.tsx +21 -12
- package/src/components/RevealPlayer/RevealPlayer.stories.tsx +7 -5
- package/src/components/RevealPlayer/RevealPlayer.tsx +65 -58
- package/src/meta.ts +9 -6
- package/src/translations.ts +1 -0
- package/src/types.ts +18 -10
- package/src/useExitPresenter.ts +24 -24
- package/dist/lib/browser/CollectionPresenterContainer-IPDW4HZR.mjs +0 -191
- package/dist/lib/browser/CollectionPresenterContainer-IPDW4HZR.mjs.map +0 -7
- package/dist/lib/browser/DocumentPresenterContainer-LJBJM5UB.mjs +0 -185
- package/dist/lib/browser/DocumentPresenterContainer-LJBJM5UB.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSlide-KG7ESCSU.mjs +0 -336
- package/dist/lib/browser/MarkdownSlide-KG7ESCSU.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LURIPUEV.mjs +0 -77
- package/dist/lib/browser/app-graph-builder-LURIPUEV.mjs.map +0 -7
- package/dist/lib/browser/chunk-QWJM3ADC.mjs +0 -37
- package/dist/lib/browser/chunk-QWJM3ADC.mjs.map +0 -7
- package/dist/lib/browser/chunk-TANLITL2.mjs +0 -36
- 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-W4IR3DJE.mjs +0 -39
- package/dist/lib/browser/chunk-W4IR3DJE.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3SPF2ANF.mjs +0 -57
- package/dist/lib/browser/react-surface-3SPF2ANF.mjs.map +0 -7
- package/dist/lib/browser/settings-VBRYUIWN.mjs +0 -22
- package/dist/lib/browser/settings-VBRYUIWN.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -82
- package/src/capabilities/react-surface.tsx +0 -53
- package/src/capabilities/settings.ts +0 -19
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useExitPresenter
|
|
3
|
-
} from "./chunk-TANLITL2.mjs";
|
|
4
|
-
|
|
5
|
-
// src/components/DocumentPresenterContainer.tsx
|
|
6
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
7
|
-
import React2 from "react";
|
|
8
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
9
|
-
|
|
10
|
-
// src/components/RevealPlayer/RevealPlayer.tsx
|
|
11
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
12
|
-
import "reveal.js/dist/reveal.css";
|
|
13
|
-
import "reveal.js/dist/theme/black.css";
|
|
14
|
-
import "highlight.js/styles/tokyo-night-dark.css";
|
|
15
|
-
import hljs from "highlight.js";
|
|
16
|
-
import typescript from "highlight.js/lib/languages/typescript";
|
|
17
|
-
import React, { useEffect, useRef } from "react";
|
|
18
|
-
import Reveal from "reveal.js";
|
|
19
|
-
import RevealHighlight from "reveal.js/plugin/highlight/highlight";
|
|
20
|
-
import RevealMarkdown from "reveal.js/plugin/markdown/plugin.js";
|
|
21
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
22
|
-
var styles = `
|
|
23
|
-
<style type="text/css">
|
|
24
|
-
.reveal h1 {
|
|
25
|
-
font-weight: 100;
|
|
26
|
-
font-size: 60px;
|
|
27
|
-
opacity: 0.5;
|
|
28
|
-
}
|
|
29
|
-
.reveal h2 {
|
|
30
|
-
font-weight: 100;
|
|
31
|
-
padding-top: 60px;
|
|
32
|
-
padding-left: 40px;
|
|
33
|
-
font-size: 48px;
|
|
34
|
-
opacity: 0.3;
|
|
35
|
-
}
|
|
36
|
-
.reveal h1, h2, p {
|
|
37
|
-
font-family: "Raleway", sans-serif;
|
|
38
|
-
text-align: left;
|
|
39
|
-
font-weight: 200;
|
|
40
|
-
}
|
|
41
|
-
.reveal ul {
|
|
42
|
-
font-family: "Raleway", sans-serif;
|
|
43
|
-
display: block;
|
|
44
|
-
list-style: "- ";
|
|
45
|
-
}
|
|
46
|
-
.reveal blockquote p {
|
|
47
|
-
text-align: center;
|
|
48
|
-
font-weight: 100;
|
|
49
|
-
padding: 32px;
|
|
50
|
-
}
|
|
51
|
-
.reveal pre {
|
|
52
|
-
margin-left: 0;
|
|
53
|
-
}
|
|
54
|
-
.reveal code {
|
|
55
|
-
font-size: 20px;
|
|
56
|
-
background: #111111;
|
|
57
|
-
color: #eeeeee;
|
|
58
|
-
max-height: unset !important;
|
|
59
|
-
}
|
|
60
|
-
</style>
|
|
61
|
-
`;
|
|
62
|
-
var RevealPlayer = ({ classNames, content, slide, fullscreen = true, onExit }) => {
|
|
63
|
-
var _effect = _useSignals();
|
|
64
|
-
try {
|
|
65
|
-
const deckDivRef = useRef(null);
|
|
66
|
-
const deckRef = useRef(null);
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
if (deckRef.current) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
hljs.registerLanguage("typescript", typescript);
|
|
72
|
-
const t = setTimeout(async () => {
|
|
73
|
-
deckRef.current = new Reveal(deckDivRef.current, {
|
|
74
|
-
// view: 'scroll',
|
|
75
|
-
progress: false,
|
|
76
|
-
transition: "none",
|
|
77
|
-
slideNumber: false,
|
|
78
|
-
embedded: true,
|
|
79
|
-
// TODO(burdon): Speaker view requires server to serve popout window.
|
|
80
|
-
// https://revealjs.com/speaker-view
|
|
81
|
-
showNotes: false,
|
|
82
|
-
// width: 1600,
|
|
83
|
-
// height: 900,
|
|
84
|
-
margin: 0.1,
|
|
85
|
-
// center: false,
|
|
86
|
-
// minScale: 0.1,
|
|
87
|
-
// maxScale: 1.4,
|
|
88
|
-
// https://revealjs.com/markdown
|
|
89
|
-
// TODO(burdon): Requires server to serve popout window.
|
|
90
|
-
plugins: [
|
|
91
|
-
RevealMarkdown,
|
|
92
|
-
RevealHighlight
|
|
93
|
-
],
|
|
94
|
-
// See https://marked.js.org/using_advanced#options
|
|
95
|
-
markdown: {
|
|
96
|
-
gfm: true,
|
|
97
|
-
smartypants: true,
|
|
98
|
-
highlight: (code, language) => {
|
|
99
|
-
if (language) {
|
|
100
|
-
return hljs.highlight(code, {
|
|
101
|
-
language
|
|
102
|
-
}).value;
|
|
103
|
-
}
|
|
104
|
-
return hljs.highlightAuto(code).value;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
await deckRef.current.initialize();
|
|
109
|
-
if (slide !== void 0) {
|
|
110
|
-
deckRef.current.slide(slide < 0 ? deckRef.current?.getTotalSlides() + slide : slide - 1);
|
|
111
|
-
}
|
|
112
|
-
deckRef.current.addKeyBinding({
|
|
113
|
-
keyCode: 27,
|
|
114
|
-
key: "Escape",
|
|
115
|
-
description: "Exit full screen"
|
|
116
|
-
}, () => {
|
|
117
|
-
onExit?.();
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
return () => {
|
|
121
|
-
try {
|
|
122
|
-
clearTimeout(t);
|
|
123
|
-
if (deckRef.current) {
|
|
124
|
-
deckRef.current.destroy();
|
|
125
|
-
deckRef.current = null;
|
|
126
|
-
}
|
|
127
|
-
} catch (err) {
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
});
|
|
131
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
132
|
-
className: mx("absolute flex h-full w-full items-center justify-center", fullscreen && "inset-0", classNames)
|
|
133
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
134
|
-
className: "relative aspect-video w-full"
|
|
135
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
136
|
-
ref: deckDivRef,
|
|
137
|
-
className: "reveal"
|
|
138
|
-
}, /* @__PURE__ */ React.createElement("style", null, /* @__PURE__ */ React.createElement("link", {
|
|
139
|
-
rel: "preconnect",
|
|
140
|
-
href: "https://fonts.googleapis.com"
|
|
141
|
-
}), /* @__PURE__ */ React.createElement("link", {
|
|
142
|
-
rel: "preconnect",
|
|
143
|
-
href: "https://fonts.gstatic.com",
|
|
144
|
-
crossOrigin: ""
|
|
145
|
-
}), /* @__PURE__ */ React.createElement("link", {
|
|
146
|
-
rel: "stylesheet",
|
|
147
|
-
href: "https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100..900;1,100..900&display=swap"
|
|
148
|
-
})), /* @__PURE__ */ React.createElement("div", {
|
|
149
|
-
className: "slides"
|
|
150
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
151
|
-
className: "!text-center"
|
|
152
|
-
}), /* @__PURE__ */ React.createElement("section", {
|
|
153
|
-
"data-markdown": []
|
|
154
|
-
}, /* @__PURE__ */ React.createElement("textarea", {
|
|
155
|
-
"data-template": true,
|
|
156
|
-
defaultValue: [
|
|
157
|
-
styles,
|
|
158
|
-
content
|
|
159
|
-
].join("\n")
|
|
160
|
-
}))))));
|
|
161
|
-
} finally {
|
|
162
|
-
_effect.f();
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
// src/components/DocumentPresenterContainer.tsx
|
|
167
|
-
var DocumentPresenterContainer = ({ document }) => {
|
|
168
|
-
var _effect = _useSignals2();
|
|
169
|
-
try {
|
|
170
|
-
const handleExit = useExitPresenter(document);
|
|
171
|
-
return /* @__PURE__ */ React2.createElement(StackItem.Content, {
|
|
172
|
-
classNames: "relative"
|
|
173
|
-
}, /* @__PURE__ */ React2.createElement(RevealPlayer, {
|
|
174
|
-
content: document.content.target?.content ?? "",
|
|
175
|
-
onExit: handleExit
|
|
176
|
-
}));
|
|
177
|
-
} finally {
|
|
178
|
-
_effect.f();
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
var DocumentPresenterContainer_default = DocumentPresenterContainer;
|
|
182
|
-
export {
|
|
183
|
-
DocumentPresenterContainer_default as default
|
|
184
|
-
};
|
|
185
|
-
//# sourceMappingURL=DocumentPresenterContainer-LJBJM5UB.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/DocumentPresenterContainer.tsx", "../../../src/components/RevealPlayer/RevealPlayer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\nimport React, { type FC } from 'react';\n\nimport { type Markdown } from '@dxos/plugin-markdown/types';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { RevealPlayer } from './RevealPlayer';\nimport { useExitPresenter } from '../useExitPresenter';\n\nconst DocumentPresenterContainer: FC<{ document: Markdown.Document }> = ({ document }) => {\n const handleExit = useExitPresenter(document);\n\n return (\n <StackItem.Content classNames='relative'>\n <RevealPlayer content={document.content.target?.content ?? ''} onExit={handleExit} />\n </StackItem.Content>\n );\n};\n\nexport default DocumentPresenterContainer;\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// eslint-disable-next-line no-restricted-imports\nimport 'reveal.js/dist/reveal.css';\n// eslint-disable-next-line no-restricted-imports\nimport 'reveal.js/dist/theme/black.css';\n\n// https://github.com/highlightjs/highlight.js/tree/main/src/styles\n// import 'highlight.js/styles/github-dark.css';\nimport 'highlight.js/styles/tokyo-night-dark.css';\n\nimport hljs from 'highlight.js';\nimport typescript from 'highlight.js/lib/languages/typescript';\nimport React, { useEffect, useRef } from 'react';\nimport Reveal from 'reveal.js';\nimport RevealHighlight from 'reveal.js/plugin/highlight/highlight';\nimport RevealMarkdown from 'reveal.js/plugin/markdown/plugin.js';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nconst styles = `\n<style type=\"text/css\">\n .reveal h1 {\n font-weight: 100;\n font-size: 60px;\n opacity: 0.5;\n }\n .reveal h2 {\n font-weight: 100;\n padding-top: 60px;\n padding-left: 40px;\n font-size: 48px;\n opacity: 0.3;\n }\n .reveal h1, h2, p {\n font-family: \"Raleway\", sans-serif;\n text-align: left;\n font-weight: 200;\n }\n .reveal ul {\n font-family: \"Raleway\", sans-serif;\n display: block;\n list-style: \"- \";\n }\n .reveal blockquote p {\n text-align: center;\n font-weight: 100;\n padding: 32px;\n }\n .reveal pre {\n margin-left: 0;\n }\n .reveal code {\n font-size: 20px;\n background: #111111;\n color: #eeeeee;\n max-height: unset !important;\n }\n</style>\n`;\n\nexport type RevealProps = ThemedClassName<{\n content: string;\n slide?: number;\n fullscreen?: boolean;\n onExit?: () => void;\n}>;\n\nexport const RevealPlayer = ({ classNames, content, slide, fullscreen = true, onExit }: RevealProps) => {\n const deckDivRef = useRef<HTMLDivElement>(null);\n const deckRef = useRef<Reveal.Api | null>(null);\n useEffect(() => {\n if (deckRef.current) {\n return;\n }\n\n // Required for syntax highlighting.\n hljs.registerLanguage('typescript', typescript);\n\n const t = setTimeout(async () => {\n // https://revealjs.com/react\n // https://revealjs.com/config\n // https://github.com/hakimel/reveal.js\n // TODO(burdon): Fragments and scroll view steps 2 at a time (safe mode?)\n deckRef.current = new Reveal(deckDivRef.current!, {\n // view: 'scroll',\n progress: false,\n transition: 'none',\n slideNumber: false,\n embedded: true,\n\n // TODO(burdon): Speaker view requires server to serve popout window.\n // https://revealjs.com/speaker-view\n showNotes: false,\n\n // width: 1600,\n // height: 900,\n margin: 0.1,\n // center: false,\n // minScale: 0.1,\n // maxScale: 1.4,\n\n // https://revealjs.com/markdown\n // TODO(burdon): Requires server to serve popout window.\n plugins: [RevealMarkdown, RevealHighlight],\n\n // See https://marked.js.org/using_advanced#options\n markdown: {\n gfm: true,\n smartypants: true,\n highlight: (code, language) => {\n if (language) {\n return hljs.highlight(code, { language }).value;\n }\n\n return hljs.highlightAuto(code).value;\n },\n },\n });\n\n await deckRef.current.initialize();\n\n if (slide !== undefined) {\n deckRef.current.slide(slide < 0 ? deckRef.current?.getTotalSlides() + slide : slide - 1);\n }\n\n deckRef.current.addKeyBinding({ keyCode: 27, key: 'Escape', description: 'Exit full screen' }, () => {\n onExit?.();\n });\n });\n\n return () => {\n try {\n clearTimeout(t);\n if (deckRef.current) {\n deckRef.current.destroy();\n deckRef.current = null;\n }\n } catch (err) {\n // Ignore.\n }\n };\n });\n\n return (\n <div className={mx('absolute flex h-full w-full items-center justify-center', fullscreen && 'inset-0', classNames)}>\n <div className='relative aspect-video w-full'>\n <div ref={deckDivRef} className='reveal'>\n {/* TODO(burdon): Must be in head. */}\n <style>\n <link rel='preconnect' href='https://fonts.googleapis.com' />\n <link rel='preconnect' href='https://fonts.gstatic.com' {...{ crossOrigin: '' }} />\n <link\n rel='stylesheet'\n href='https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100..900;1,100..900&display=swap'\n />\n </style>\n <div className='slides'>\n <div className='!text-center' />\n <section {...{ 'data-markdown': [] }}>\n <textarea {...{ 'data-template': true }} defaultValue={[styles, content].join('\\n')}></textarea>\n </section>\n </div>\n </div>\n </div>\n </div>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAGA,OAAOA,YAAwB;AAG/B,SAASC,iBAAiB;;;;ACD1B,OAAO;AAEP,OAAO;AAIP,OAAO;AAEP,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AACvB,OAAOC,SAASC,WAAWC,cAAc;AACzC,OAAOC,YAAY;AACnB,OAAOC,qBAAqB;AAC5B,OAAOC,oBAAoB;AAG3B,SAASC,UAAU;AAEnB,IAAMC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDR,IAAMC,eAAe,CAAC,EAAEC,YAAYC,SAASC,OAAOC,aAAa,MAAMC,OAAM,MAAe;;;AACjG,UAAMC,aAAaC,OAAuB,IAAA;AAC1C,UAAMC,UAAUD,OAA0B,IAAA;AAC1CE,cAAU,MAAA;AACR,UAAID,QAAQE,SAAS;AACnB;MACF;AAGAC,WAAKC,iBAAiB,cAAcC,UAAAA;AAEpC,YAAMC,IAAIC,WAAW,YAAA;AAKnBP,gBAAQE,UAAU,IAAIM,OAAOV,WAAWI,SAAU;;UAEhDO,UAAU;UACVC,YAAY;UACZC,aA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AAA;MAAIC,WAAU;QACf,sBAAA,cAACQ,WAAY;MAAE,iBAAiB,CAAA;IAAG,GACjC,sBAAA,cAACC,YAAAA;MAAe,iBAAiB;MAAQC,cAAc;QAACxD;QAAQG;QAASsD,KAAK,IAAA;;;;;AAO5F;;;AD/JA,IAAMC,6BAAkE,CAAC,EAAEC,SAAQ,MAAE;;;AACnF,UAAMC,aAAaC,iBAAiBF,QAAAA;AAEpC,WACE,gBAAAG,OAAA,cAACC,UAAUC,SAAO;MAACC,YAAW;OAC5B,gBAAAH,OAAA,cAACI,cAAAA;MAAaC,SAASR,SAASQ,QAAQC,QAAQD,WAAW;MAAIE,QAAQT;;;;;AAG7E;AAEA,IAAA,qCAAeF;",
|
|
6
|
-
"names": ["React", "StackItem", "hljs", "typescript", "React", "useEffect", "useRef", "Reveal", "RevealHighlight", "RevealMarkdown", "mx", "styles", "RevealPlayer", "classNames", "content", "slide", "fullscreen", "onExit", "deckDivRef", "useRef", "deckRef", "useEffect", "current", "hljs", "registerLanguage", "typescript", "t", "setTimeout", "Reveal", "progress", "transition", "slideNumber", "embedded", "showNotes", "margin", "plugins", "RevealMarkdown", "RevealHighlight", "markdown", "gfm", "smartypants", "highlight", "code", "language", "value", "highlightAuto", "initialize", "undefined", "getTotalSlides", "addKeyBinding", "keyCode", "key", "description", "clearTimeout", "destroy", "err", "div", "className", "mx", "ref", "style", "link", "rel", "href", "crossOrigin", "section", "textarea", "defaultValue", "join", "DocumentPresenterContainer", "document", "handleExit", "useExitPresenter", "React", "StackItem", "Content", "classNames", "RevealPlayer", "content", "target", "onExit"]
|
|
7
|
-
}
|
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
// src/components/MarkdownSlide.tsx
|
|
2
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import React3 from "react";
|
|
4
|
-
|
|
5
|
-
// src/components/Markdown/Container.tsx
|
|
6
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
7
|
-
import React, { useState } from "react";
|
|
8
|
-
import { useResizeDetector } from "react-resize-detector";
|
|
9
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
10
|
-
var Container = ({ children, classNames }) => {
|
|
11
|
-
var _effect = _useSignals();
|
|
12
|
-
try {
|
|
13
|
-
const [props, setProps] = useState({});
|
|
14
|
-
const { ref: containerRef, width, height } = useResizeDetector({
|
|
15
|
-
refreshMode: "debounce",
|
|
16
|
-
refreshRate: 200,
|
|
17
|
-
refreshOptions: {
|
|
18
|
-
leading: true
|
|
19
|
-
},
|
|
20
|
-
onResize: ({ width: width2, height: height2 }) => {
|
|
21
|
-
if (width2 && height2) {
|
|
22
|
-
setProps(createLayoutProps({
|
|
23
|
-
width: width2,
|
|
24
|
-
height: height2
|
|
25
|
-
}));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
30
|
-
ref: containerRef,
|
|
31
|
-
className: mx("flex grow relative overflow-hidden bg-attention", classNames)
|
|
32
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
33
|
-
className: mx("flex w-full h-full overflow-hidden absolute"),
|
|
34
|
-
style: props
|
|
35
|
-
}, width && height && children));
|
|
36
|
-
} finally {
|
|
37
|
-
_effect.f();
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var createLayoutProps = ({ width, height }) => {
|
|
41
|
-
const aspectRatio = 16 / 9;
|
|
42
|
-
const nominalWidth = 2560;
|
|
43
|
-
const nominalHeight = nominalWidth / aspectRatio;
|
|
44
|
-
const scale = Math.min(width / nominalWidth, height / nominalHeight);
|
|
45
|
-
return {
|
|
46
|
-
left: (width - nominalWidth) / 2,
|
|
47
|
-
top: (height - nominalHeight) / 2,
|
|
48
|
-
width: nominalWidth,
|
|
49
|
-
height: nominalHeight,
|
|
50
|
-
transform: `scale(${scale})`
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// src/components/Markdown/Slide.tsx
|
|
55
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
56
|
-
import { h } from "hastscript";
|
|
57
|
-
import React2 from "react";
|
|
58
|
-
import ReactMarkdown from "react-markdown";
|
|
59
|
-
import addClasses from "rehype-add-classes";
|
|
60
|
-
import highlight from "rehype-highlight";
|
|
61
|
-
import remarkFrontmatter from "remark-frontmatter";
|
|
62
|
-
import remarkParseFrontmatter from "remark-parse-frontmatter";
|
|
63
|
-
import "highlight.js/styles/github.css";
|
|
64
|
-
|
|
65
|
-
// src/components/Markdown/theme.ts
|
|
66
|
-
var theme = {
|
|
67
|
-
root: "bg-attention leading-relaxed font-mono",
|
|
68
|
-
padding: "px-40 py-16 gap-8",
|
|
69
|
-
nodes: {
|
|
70
|
-
h1: "text-[80px] text-accentText",
|
|
71
|
-
h2: "text-[60px] text-accentText",
|
|
72
|
-
h3: "text-[48px] text-accentText",
|
|
73
|
-
p: "text-[48px]",
|
|
74
|
-
ul: "my-[16px] ml-12 leading-relaxed list-disc",
|
|
75
|
-
ol: "my-[16px] ml-24 leading-relaxed list-decimal",
|
|
76
|
-
li: "pl-6 text-[48px]",
|
|
77
|
-
pre: "w-full mx-0 my-[32px] p-0 __border-l-[16px] bg-inputSurface p-4 __whitespace-pre-line",
|
|
78
|
-
code: "p-0 text-[40px]"
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// src/components/Markdown/Slide.tsx
|
|
83
|
-
var Slide = ({ content = "", classes = theme.nodes }) => {
|
|
84
|
-
var _effect = _useSignals2();
|
|
85
|
-
try {
|
|
86
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("style", null, `
|
|
87
|
-
.dark pre code.hljs {
|
|
88
|
-
display: block;
|
|
89
|
-
overflow-x: auto;
|
|
90
|
-
padding: 1em
|
|
91
|
-
}
|
|
92
|
-
.dark code.hljs {
|
|
93
|
-
padding: 3px 5px
|
|
94
|
-
}
|
|
95
|
-
/*!
|
|
96
|
-
Theme: GitHub Dark
|
|
97
|
-
Description: Dark theme as seen on github.com
|
|
98
|
-
Author: github.com
|
|
99
|
-
Maintainer: @Hirse
|
|
100
|
-
Updated: 2021-05-15
|
|
101
|
-
|
|
102
|
-
Outdated base version: https://github.com/primer/github-syntax-dark
|
|
103
|
-
Current colors taken from GitHub's CSS
|
|
104
|
-
*/
|
|
105
|
-
.dark .hljs {
|
|
106
|
-
color: #c9d1d9;
|
|
107
|
-
background: #0d1117
|
|
108
|
-
}
|
|
109
|
-
.dark .hljs-doctag,
|
|
110
|
-
.dark .hljs-keyword,
|
|
111
|
-
.dark .hljs-meta .hljs-keyword,
|
|
112
|
-
.dark .hljs-template-tag,
|
|
113
|
-
.dark .hljs-template-variable,
|
|
114
|
-
.dark .hljs-type,
|
|
115
|
-
.dark .hljs-variable.language_ {
|
|
116
|
-
/* prettylights-syntax-keyword */
|
|
117
|
-
color: #ff7b72
|
|
118
|
-
}
|
|
119
|
-
.dark .hljs-title,
|
|
120
|
-
.dark .hljs-title.class_,
|
|
121
|
-
.dark .hljs-title.class_.inherited__,
|
|
122
|
-
.dark .hljs-title.function_ {
|
|
123
|
-
/* prettylights-syntax-entity */
|
|
124
|
-
color: #d2a8ff
|
|
125
|
-
}
|
|
126
|
-
.dark .hljs-attr,
|
|
127
|
-
.dark .hljs-attribute,
|
|
128
|
-
.dark .hljs-literal,
|
|
129
|
-
.dark .hljs-meta,
|
|
130
|
-
.dark .hljs-number,
|
|
131
|
-
.dark .hljs-operator,
|
|
132
|
-
.dark .hljs-variable,
|
|
133
|
-
.dark .hljs-selector-attr,
|
|
134
|
-
.dark .hljs-selector-class,
|
|
135
|
-
.dark .hljs-selector-id {
|
|
136
|
-
/* prettylights-syntax-constant */
|
|
137
|
-
color: #79c0ff
|
|
138
|
-
}
|
|
139
|
-
.dark .hljs-regexp,
|
|
140
|
-
.dark .hljs-string,
|
|
141
|
-
.dark .hljs-meta .hljs-string {
|
|
142
|
-
/* prettylights-syntax-string */
|
|
143
|
-
color: #a5d6ff
|
|
144
|
-
}
|
|
145
|
-
.dark .hljs-built_in,
|
|
146
|
-
.dark .hljs-symbol {
|
|
147
|
-
/* prettylights-syntax-variable */
|
|
148
|
-
color: #ffa657
|
|
149
|
-
}
|
|
150
|
-
.dark .hljs-comment,
|
|
151
|
-
.dark .hljs-code,
|
|
152
|
-
.dark .hljs-formula {
|
|
153
|
-
/* prettylights-syntax-comment */
|
|
154
|
-
color: #8b949e
|
|
155
|
-
}
|
|
156
|
-
.dark .hljs-name,
|
|
157
|
-
.dark .hljs-quote,
|
|
158
|
-
.dark .hljs-selector-tag,
|
|
159
|
-
.dark .hljs-selector-pseudo {
|
|
160
|
-
/* prettylights-syntax-entity-tag */
|
|
161
|
-
color: #7ee787
|
|
162
|
-
}
|
|
163
|
-
.dark .hljs-subst {
|
|
164
|
-
/* prettylights-syntax-storage-modifier-import */
|
|
165
|
-
color: #c9d1d9
|
|
166
|
-
}
|
|
167
|
-
.dark .hljs-section {
|
|
168
|
-
/* prettylights-syntax-markup-heading */
|
|
169
|
-
color: #1f6feb;
|
|
170
|
-
font-weight: bold
|
|
171
|
-
}
|
|
172
|
-
.dark .hljs-bullet {
|
|
173
|
-
/* prettylights-syntax-markup-list */
|
|
174
|
-
color: #f2cc60
|
|
175
|
-
}
|
|
176
|
-
.dark .hljs-emphasis {
|
|
177
|
-
/* prettylights-syntax-markup-italic */
|
|
178
|
-
color: #c9d1d9;
|
|
179
|
-
font-style: italic
|
|
180
|
-
}
|
|
181
|
-
.dark .hljs-strong {
|
|
182
|
-
/* prettylights-syntax-markup-bold */
|
|
183
|
-
color: #c9d1d9;
|
|
184
|
-
font-weight: bold
|
|
185
|
-
}
|
|
186
|
-
.dark .hljs-addition {
|
|
187
|
-
/* prettylights-syntax-markup-inserted */
|
|
188
|
-
color: #aff5b4;
|
|
189
|
-
background-color: #033a16
|
|
190
|
-
}
|
|
191
|
-
.dark .hljs-deletion {
|
|
192
|
-
/* prettylights-syntax-markup-deleted */
|
|
193
|
-
color: #ffdcd7;
|
|
194
|
-
background-color: #67060c
|
|
195
|
-
}
|
|
196
|
-
.dark .hljs-char.escape_,
|
|
197
|
-
.dark .hljs-link,
|
|
198
|
-
.dark .hljs-params,
|
|
199
|
-
.dark .hljs-property,
|
|
200
|
-
.dark .hljs-punctuation,
|
|
201
|
-
.dark .hljs-tag {
|
|
202
|
-
/* purposely ignored */
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
`), /* @__PURE__ */ React2.createElement(ReactMarkdown, {
|
|
206
|
-
components,
|
|
207
|
-
// Markdown to HTML.
|
|
208
|
-
remarkPlugins: [
|
|
209
|
-
[
|
|
210
|
-
remarkFrontmatter,
|
|
211
|
-
"yaml"
|
|
212
|
-
],
|
|
213
|
-
remarkParseFrontmatter
|
|
214
|
-
],
|
|
215
|
-
// HTML processing.
|
|
216
|
-
rehypePlugins: [
|
|
217
|
-
highlight,
|
|
218
|
-
[
|
|
219
|
-
addClasses,
|
|
220
|
-
classes
|
|
221
|
-
],
|
|
222
|
-
slideLayout
|
|
223
|
-
]
|
|
224
|
-
}, content));
|
|
225
|
-
} finally {
|
|
226
|
-
_effect.f();
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
var slideLayout = (options = {}) => (tree, file) => {
|
|
230
|
-
const { data: { frontmatter = {} } } = file;
|
|
231
|
-
let content = tree.children;
|
|
232
|
-
const { layout, image } = frontmatter;
|
|
233
|
-
if (image) {
|
|
234
|
-
const img = h("div", {
|
|
235
|
-
class: "flex grow shrink-0 bg-cover bg-center bg-no-repeat",
|
|
236
|
-
style: {
|
|
237
|
-
backgroundImage: `url(${image})`
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
switch (layout) {
|
|
241
|
-
case "fullscreen": {
|
|
242
|
-
content = img;
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
case "columns": {
|
|
246
|
-
content = h("div", {
|
|
247
|
-
class: "flex grow grid grid-cols-2"
|
|
248
|
-
}, [
|
|
249
|
-
h("div", {
|
|
250
|
-
class: theme.padding
|
|
251
|
-
}, [
|
|
252
|
-
content
|
|
253
|
-
]),
|
|
254
|
-
img
|
|
255
|
-
]);
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
case "rows": {
|
|
259
|
-
content = h("div", {
|
|
260
|
-
class: "flex grow flex-col"
|
|
261
|
-
}, [
|
|
262
|
-
h("div", {
|
|
263
|
-
class: theme.padding
|
|
264
|
-
}, [
|
|
265
|
-
content
|
|
266
|
-
]),
|
|
267
|
-
h("div", {
|
|
268
|
-
class: [
|
|
269
|
-
"flex grow pt-0",
|
|
270
|
-
theme.padding
|
|
271
|
-
]
|
|
272
|
-
}, [
|
|
273
|
-
img
|
|
274
|
-
])
|
|
275
|
-
]);
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
} else {
|
|
280
|
-
content = h("div", {
|
|
281
|
-
class: [
|
|
282
|
-
"flex grow flex-col",
|
|
283
|
-
theme.padding
|
|
284
|
-
]
|
|
285
|
-
}, [
|
|
286
|
-
content
|
|
287
|
-
]);
|
|
288
|
-
}
|
|
289
|
-
const root = h("div", {
|
|
290
|
-
class: [
|
|
291
|
-
"flex flex-col grow",
|
|
292
|
-
theme.root
|
|
293
|
-
]
|
|
294
|
-
}, [
|
|
295
|
-
content
|
|
296
|
-
]);
|
|
297
|
-
tree.children = [
|
|
298
|
-
root
|
|
299
|
-
];
|
|
300
|
-
};
|
|
301
|
-
var ImageWrapper = ({ node, ...props }) => {
|
|
302
|
-
var _effect = _useSignals2();
|
|
303
|
-
try {
|
|
304
|
-
const { alt = "", src } = props;
|
|
305
|
-
return /* @__PURE__ */ React2.createElement("img", {
|
|
306
|
-
alt,
|
|
307
|
-
src
|
|
308
|
-
});
|
|
309
|
-
} finally {
|
|
310
|
-
_effect.f();
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
var components = {
|
|
314
|
-
img: ImageWrapper
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
// src/components/MarkdownSlide.tsx
|
|
318
|
-
var MarkdownSlide = ({ document }) => {
|
|
319
|
-
var _effect = _useSignals3();
|
|
320
|
-
try {
|
|
321
|
-
const content = document.content.target?.content;
|
|
322
|
-
if (!content) {
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
return /* @__PURE__ */ React3.createElement(Container, null, /* @__PURE__ */ React3.createElement(Slide, {
|
|
326
|
-
content
|
|
327
|
-
}));
|
|
328
|
-
} finally {
|
|
329
|
-
_effect.f();
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
var MarkdownSlide_default = MarkdownSlide;
|
|
333
|
-
export {
|
|
334
|
-
MarkdownSlide_default as default
|
|
335
|
-
};
|
|
336
|
-
//# sourceMappingURL=MarkdownSlide-KG7ESCSU.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/MarkdownSlide.tsx", "../../../src/components/Markdown/Container.tsx", "../../../src/components/Markdown/Slide.tsx", "../../../src/components/Markdown/theme.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { type Markdown } from '@dxos/plugin-markdown/types';\n\nimport { Container, Slide } from './Markdown';\n\nconst MarkdownSlide: FC<{ document: Markdown.Document }> = ({ document }) => {\n const content = document.content.target?.content;\n if (!content) {\n return null;\n }\n\n return (\n <Container>\n <Slide content={content} />\n </Container>\n );\n};\n\nexport default MarkdownSlide;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type PropsWithChildren, useState } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nexport type ContainerProps = ThemedClassName<PropsWithChildren<{}>>;\n\n/**\n * Scaled markdown container.\n */\nexport const Container = ({ children, classNames }: ContainerProps) => {\n const [props, setProps] = useState({});\n const {\n ref: containerRef,\n width,\n height,\n } = useResizeDetector({\n refreshMode: 'debounce',\n refreshRate: 200,\n refreshOptions: {\n leading: true,\n },\n onResize: ({ width, height }) => {\n if (width && height) {\n setProps(createLayoutProps({ width, height }));\n }\n },\n });\n\n // TODO(burdon): Reconcile highlight colors with markdown editor.\n // https://www.npmjs.com/package/react-markdown\n return (\n <div ref={containerRef} className={mx('flex grow relative overflow-hidden bg-attention', classNames)}>\n <div className={mx('flex w-full h-full overflow-hidden absolute')} style={props}>\n {width && height && children}\n </div>\n </div>\n );\n};\n\n/**\n * Compute CSS properties to transform DIV to be full screen.\n *\n * Display resolutions:\n * window.screen.{availWidth, availHeight}\n * 5K Studio 16.2-inch Macbook Pro\n * Max 5120 x 2880 3456 x 2234\n * Default 2560 x 1440 1728 x 1117 (Actual height 1080 - 37 pixel notch)\n * Aspect 1.77 (16/9) 1.54\n */\nconst createLayoutProps = ({ width, height }: { width: number; height: number }) => {\n // Config.\n const aspectRatio = 16 / 9;\n const nominalWidth = 2560;\n const nominalHeight = nominalWidth / aspectRatio;\n\n // NOTE: Hack to detect full height on Macbook Pro due to notch.\n // const macIntelNotch = 1117 - 1080;\n // const fullscreen =\n // height === screen.availHeight ||\n // (window.navigator.platform === 'MacIntel' && height === screen.availHeight - macIntelNotch);\n\n // If not fullscreen then make scale slightly smaller so there's a natural border.\n // const scaleFactor = fullscreen ? 1 : 0.95;\n\n // Compute scaling factor required.\n const scale = Math.min(width / nominalWidth, height / nominalHeight);\n\n return {\n left: (width - nominalWidth) / 2,\n top: (height - nominalHeight) / 2,\n width: nominalWidth,\n height: nominalHeight,\n transform: `scale(${scale})`,\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { h } from 'hastscript';\nimport React from 'react';\nimport ReactMarkdown from 'react-markdown';\nimport addClasses from 'rehype-add-classes';\nimport highlight from 'rehype-highlight';\nimport remarkFrontmatter from 'remark-frontmatter';\nimport remarkParseFrontmatter from 'remark-parse-frontmatter';\n\nimport 'highlight.js/styles/github.css';\n\nimport { theme } from './theme';\n\nexport type SlideProps = {\n content?: string;\n classes?: { [selector: string]: string };\n};\n\nexport const Slide = ({ content = '', classes = theme.nodes }: SlideProps) => {\n // TODO(thure): `rehype-highlight` ends up using `github.css` from `highlight.js`, but this does not appear to be\n // configurable. Find a way to remove the literal stylesheet here.\n return (\n <>\n <style>{`\n.dark pre code.hljs {\n display: block;\n overflow-x: auto;\n padding: 1em\n}\n.dark code.hljs {\n padding: 3px 5px\n}\n/*!\n Theme: GitHub Dark\n Description: Dark theme as seen on github.com\n Author: github.com\n Maintainer: @Hirse\n Updated: 2021-05-15\n\n Outdated base version: https://github.com/primer/github-syntax-dark\n Current colors taken from GitHub's CSS\n*/\n.dark .hljs {\n color: #c9d1d9;\n background: #0d1117\n}\n.dark .hljs-doctag,\n.dark .hljs-keyword,\n.dark .hljs-meta .hljs-keyword,\n.dark .hljs-template-tag,\n.dark .hljs-template-variable,\n.dark .hljs-type,\n.dark .hljs-variable.language_ {\n /* prettylights-syntax-keyword */\n color: #ff7b72\n}\n.dark .hljs-title,\n.dark .hljs-title.class_,\n.dark .hljs-title.class_.inherited__,\n.dark .hljs-title.function_ {\n /* prettylights-syntax-entity */\n color: #d2a8ff\n}\n.dark .hljs-attr,\n.dark .hljs-attribute,\n.dark .hljs-literal,\n.dark .hljs-meta,\n.dark .hljs-number,\n.dark .hljs-operator,\n.dark .hljs-variable,\n.dark .hljs-selector-attr,\n.dark .hljs-selector-class,\n.dark .hljs-selector-id {\n /* prettylights-syntax-constant */\n color: #79c0ff\n}\n.dark .hljs-regexp,\n.dark .hljs-string,\n.dark .hljs-meta .hljs-string {\n /* prettylights-syntax-string */\n color: #a5d6ff\n}\n.dark .hljs-built_in,\n.dark .hljs-symbol {\n /* prettylights-syntax-variable */\n color: #ffa657\n}\n.dark .hljs-comment,\n.dark .hljs-code,\n.dark .hljs-formula {\n /* prettylights-syntax-comment */\n color: #8b949e\n}\n.dark .hljs-name,\n.dark .hljs-quote,\n.dark .hljs-selector-tag,\n.dark .hljs-selector-pseudo {\n /* prettylights-syntax-entity-tag */\n color: #7ee787\n}\n.dark .hljs-subst {\n /* prettylights-syntax-storage-modifier-import */\n color: #c9d1d9\n}\n.dark .hljs-section {\n /* prettylights-syntax-markup-heading */\n color: #1f6feb;\n font-weight: bold\n}\n.dark .hljs-bullet {\n /* prettylights-syntax-markup-list */\n color: #f2cc60\n}\n.dark .hljs-emphasis {\n /* prettylights-syntax-markup-italic */\n color: #c9d1d9;\n font-style: italic\n}\n.dark .hljs-strong {\n /* prettylights-syntax-markup-bold */\n color: #c9d1d9;\n font-weight: bold\n}\n.dark .hljs-addition {\n /* prettylights-syntax-markup-inserted */\n color: #aff5b4;\n background-color: #033a16\n}\n.dark .hljs-deletion {\n /* prettylights-syntax-markup-deleted */\n color: #ffdcd7;\n background-color: #67060c\n}\n.dark .hljs-char.escape_,\n.dark .hljs-link,\n.dark .hljs-params,\n.dark .hljs-property,\n.dark .hljs-punctuation,\n.dark .hljs-tag {\n /* purposely ignored */\n \n}\n `}</style>\n <ReactMarkdown\n components={components}\n // Markdown to HTML.\n remarkPlugins={[[remarkFrontmatter, 'yaml'], remarkParseFrontmatter as any]}\n // HTML processing.\n rehypePlugins={[highlight, [addClasses, classes], slideLayout]}\n >\n {content}\n </ReactMarkdown>\n </>\n );\n};\n\n/**\n * Rehype plugin to format DOM based on frontmatter.\n * https://github.com/unifiedjs/unified#plugin\n * TODO(burdon): See tools/presenter: remarkPluginLayout\n * E.g., layout image from front-matter.\n */\nconst slideLayout =\n (options = {}) =>\n (tree: any, file: any) => {\n const {\n data: { frontmatter = {} },\n } = file;\n\n let content = tree.children;\n const { layout, image } = frontmatter;\n if (image) {\n const img = h('div', {\n class: 'flex grow shrink-0 bg-cover bg-center bg-no-repeat',\n style: {\n backgroundImage: `url(${image})`,\n },\n });\n\n switch (layout) {\n case 'fullscreen': {\n content = img;\n break;\n }\n\n case 'columns': {\n content = h('div', { class: 'flex grow grid grid-cols-2' }, [\n h('div', { class: theme.padding }, [content]),\n img,\n ]);\n break;\n }\n\n case 'rows': {\n content = h('div', { class: 'flex grow flex-col' }, [\n h('div', { class: theme.padding }, [content]),\n h('div', { class: ['flex grow pt-0', theme.padding] }, [img]),\n ]);\n break;\n }\n }\n } else {\n content = h('div', { class: ['flex grow flex-col', theme.padding] }, [content]);\n }\n\n const root = h('div', { class: ['flex flex-col grow', theme.root] }, [content]);\n tree.children = [root];\n };\n\nconst ImageWrapper = ({ node, ...props }: { node: any }) => {\n const { alt = '', src } = props as { alt: string; src: string };\n return <img alt={alt} src={src} />;\n};\n\nconst components = { img: ImageWrapper };\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Create theme type and picker.\n\nexport const theme = {\n root: 'bg-attention leading-relaxed font-mono',\n\n padding: 'px-40 py-16 gap-8',\n\n nodes: {\n h1: 'text-[80px] text-accentText',\n h2: 'text-[60px] text-accentText',\n h3: 'text-[48px] text-accentText',\n\n p: 'text-[48px]',\n\n ul: 'my-[16px] ml-12 leading-relaxed list-disc',\n ol: 'my-[16px] ml-24 leading-relaxed list-decimal',\n li: 'pl-6 text-[48px]',\n\n pre: 'w-full mx-0 my-[32px] p-0 __border-l-[16px] bg-inputSurface p-4 __whitespace-pre-line',\n code: 'p-0 text-[40px]',\n },\n};\n"],
|
|
5
|
-
"mappings": ";;AAIA,OAAOA,YAAwB;;;;ACA/B,OAAOC,SAAiCC,gBAAgB;AACxD,SAASC,yBAAyB;AAGlC,SAASC,UAAU;AAOZ,IAAMC,YAAY,CAAC,EAAEC,UAAUC,WAAU,MAAkB;;;AAChE,UAAM,CAACC,OAAOC,QAAAA,IAAYC,SAAS,CAAC,CAAA;AACpC,UAAM,EACJC,KAAKC,cACLC,OACAC,OAAM,IACJC,kBAAkB;MACpBC,aAAa;MACbC,aAAa;MACbC,gBAAgB;QACdC,SAAS;MACX;MACAC,UAAU,CAAC,EAA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,OAAO;IAAEC,OAAO;MAAC;MAAsBvB,MAAM0B;;EAAM,GAAG;IAAC5B;GAAQ;AAC9EgB,OAAKI,WAAW;IAACQ;;AACnB;AAEF,IAAMC,eAAe,CAAC,EAAEC,MAAM,GAAGC,MAAAA,MAAsB;;;AACrD,UAAM,EAAEC,MAAM,IAAIC,IAAG,IAAKF;AAC1B,WAAO,gBAAA3B,OAAA,cAACmB,OAAAA;MAAIS;MAAUC;;;;;AACxB;AAEA,IAAM1B,aAAa;EAAEgB,KAAKM;AAAa;;;AF/MvC,IAAMK,gBAAqD,CAAC,EAAEC,SAAQ,MAAE;;;AACtE,UAAMC,UAAUD,SAASC,QAAQC,QAAQD;AACzC,QAAI,CAACA,SAAS;AACZ,aAAO;IACT;AAEA,WACE,gBAAAE,OAAA,cAACC,WAAAA,MACC,gBAAAD,OAAA,cAACE,OAAAA;MAAMJ;;;;;AAGb;AAEA,IAAA,wBAAeF;",
|
|
6
|
-
"names": ["React", "React", "useState", "useResizeDetector", "mx", "Container", "children", "classNames", "props", "setProps", "useState", "ref", "containerRef", "width", "height", "useResizeDetector", "refreshMode", "refreshRate", "refreshOptions", "leading", "onResize", "createLayoutProps", "div", "className", "mx", "style", "aspectRatio", "nominalWidth", "nominalHeight", "scale", "Math", "min", "left", "top", "transform", "h", "React", "ReactMarkdown", "addClasses", "highlight", "remarkFrontmatter", "remarkParseFrontmatter", "theme", "root", "padding", "nodes", "h1", "h2", "h3", "p", "ul", "ol", "li", "pre", "code", "Slide", "content", "classes", "theme", "nodes", "React", "style", "ReactMarkdown", "components", "remarkPlugins", "remarkFrontmatter", "remarkParseFrontmatter", "rehypePlugins", "highlight", "addClasses", "slideLayout", "options", "tree", "file", "data", "frontmatter", "children", "layout", "image", "img", "h", "class", "backgroundImage", "padding", "root", "ImageWrapper", "node", "props", "alt", "src", "MarkdownSlide", "document", "content", "target", "React", "Container", "Slide"]
|
|
7
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PresenterAction
|
|
3
|
-
} from "./chunk-W4IR3DJE.mjs";
|
|
4
|
-
import {
|
|
5
|
-
PRESENTER_PLUGIN
|
|
6
|
-
} from "./chunk-VSD5LSE5.mjs";
|
|
7
|
-
|
|
8
|
-
// src/capabilities/app-graph-builder.ts
|
|
9
|
-
import { Rx } from "@effect-rx/rx-react";
|
|
10
|
-
import { Option, pipe } from "effect";
|
|
11
|
-
import { contributes, Capabilities, createIntent, LayoutAction } from "@dxos/app-framework";
|
|
12
|
-
import { Obj } from "@dxos/echo";
|
|
13
|
-
import { DeckCapabilities } from "@dxos/plugin-deck";
|
|
14
|
-
import { ATTENDABLE_PATH_SEPARATOR, DeckAction } from "@dxos/plugin-deck/types";
|
|
15
|
-
import { createExtension, rxFromSignal } from "@dxos/plugin-graph";
|
|
16
|
-
import { Markdown } from "@dxos/plugin-markdown/types";
|
|
17
|
-
import { fullyQualifiedId, getSpace } from "@dxos/react-client/echo";
|
|
18
|
-
import { DataType } from "@dxos/schema";
|
|
19
|
-
var app_graph_builder_default = (context) => contributes(Capabilities.AppGraphBuilder, createExtension({
|
|
20
|
-
id: PRESENTER_PLUGIN,
|
|
21
|
-
actions: (node) => Rx.make((get) => pipe(get(node), Option.flatMap((node2) => {
|
|
22
|
-
const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));
|
|
23
|
-
const settings = get(rxFromSignal(() => settingsStore?.getStore(PRESENTER_PLUGIN)?.value));
|
|
24
|
-
const isPresentable = settings?.presentCollections ? Obj.instanceOf(DataType.Collection, node2.data) || Obj.instanceOf(Markdown.Document, node2.data) : Obj.instanceOf(Markdown.Document, node2.data);
|
|
25
|
-
return isPresentable ? Option.some(node2.data) : Option.none();
|
|
26
|
-
}), Option.map((object) => {
|
|
27
|
-
const id = fullyQualifiedId(object);
|
|
28
|
-
const spaceId = getSpace(object)?.id;
|
|
29
|
-
return [
|
|
30
|
-
{
|
|
31
|
-
id: `${PresenterAction.TogglePresentation._tag}/${id}`,
|
|
32
|
-
// TODO(burdon): Allow function so can generate state when activated.
|
|
33
|
-
// So can set explicit fullscreen state coordinated with current presenter state.
|
|
34
|
-
data: async () => {
|
|
35
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
36
|
-
const layout = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
37
|
-
const presenterId = [
|
|
38
|
-
id,
|
|
39
|
-
"presenter"
|
|
40
|
-
].join(ATTENDABLE_PATH_SEPARATOR);
|
|
41
|
-
if (!layout.deck.fullscreen) {
|
|
42
|
-
void dispatch(createIntent(DeckAction.Adjust, {
|
|
43
|
-
type: "solo--fullscreen",
|
|
44
|
-
id: presenterId
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
await dispatch(createIntent(LayoutAction.Open, {
|
|
48
|
-
part: "main",
|
|
49
|
-
subject: [
|
|
50
|
-
presenterId
|
|
51
|
-
],
|
|
52
|
-
options: {
|
|
53
|
-
workspace: spaceId
|
|
54
|
-
}
|
|
55
|
-
}));
|
|
56
|
-
},
|
|
57
|
-
properties: {
|
|
58
|
-
label: [
|
|
59
|
-
"toggle presentation label",
|
|
60
|
-
{
|
|
61
|
-
ns: PRESENTER_PLUGIN
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
icon: "ph--presentation--regular",
|
|
65
|
-
keyBinding: {
|
|
66
|
-
macos: "shift+meta+p",
|
|
67
|
-
windows: "shift+alt+p"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
];
|
|
72
|
-
}), Option.getOrElse(() => [])))
|
|
73
|
-
}));
|
|
74
|
-
export {
|
|
75
|
-
app_graph_builder_default as default
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=app-graph-builder-LURIPUEV.mjs.map
|