@dxos/plugin-presenter 0.8.4-main.67995b8 → 0.8.4-main.dedc0f3
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-IPDW4HZR.mjs → CollectionPresenterContainer-U7D57ZVN.mjs} +5 -5
- package/dist/lib/browser/CollectionPresenterContainer-U7D57ZVN.mjs.map +7 -0
- package/dist/lib/browser/{DocumentPresenterContainer-LJBJM5UB.mjs → DocumentPresenterContainer-F42V4KAL.mjs} +48 -50
- package/dist/lib/browser/DocumentPresenterContainer-F42V4KAL.mjs.map +7 -0
- package/dist/lib/browser/{MarkdownSlide-KG7ESCSU.mjs → MarkdownSlide-ZUPODCSC.mjs} +15 -128
- package/dist/lib/browser/MarkdownSlide-ZUPODCSC.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-LURIPUEV.mjs → app-graph-builder-5LNLRZBN.mjs} +30 -2
- package/dist/lib/browser/app-graph-builder-5LNLRZBN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QWJM3ADC.mjs → chunk-ENIFUI47.mjs} +12 -8
- package/dist/lib/browser/chunk-ENIFUI47.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 +6 -5
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-3SPF2ANF.mjs → react-surface-UAXR5ZP3.mjs} +6 -6
- package/dist/lib/browser/react-surface-UAXR5ZP3.mjs.map +7 -0
- package/dist/lib/browser/{settings-VBRYUIWN.mjs → settings-VQVVDAGY.mjs} +1 -1
- package/dist/lib/browser/{settings-VBRYUIWN.mjs.map → settings-VQVVDAGY.mjs.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.map +1 -1
- package/dist/types/src/components/Markdown/Container.stories.d.ts +14 -21
- 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 +10 -11
- package/dist/types/src/components/Markdown/Slide.stories.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 -3
- 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 +17 -1
- 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/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +3 -3
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -28
- package/src/PresenterPlugin.tsx +1 -1
- package/src/capabilities/app-graph-builder.ts +35 -1
- package/src/capabilities/react-surface.tsx +18 -8
- package/src/capabilities/settings.ts +1 -1
- package/src/components/CollectionPresenterContainer.tsx +2 -1
- package/src/components/DocumentPresenterContainer.tsx +2 -1
- package/src/components/Markdown/Container.stories.tsx +20 -17
- package/src/components/Markdown/Slide.stories.tsx +9 -6
- 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/Presenter/Pager.stories.tsx +7 -5
- package/src/components/Presenter/Pager.tsx +3 -3
- package/src/components/PresenterSettings.tsx +13 -9
- package/src/components/RevealPlayer/RevealPlayer.stories.tsx +4 -3
- package/src/components/RevealPlayer/RevealPlayer.tsx +50 -53
- package/src/translations.ts +1 -0
- package/src/useExitPresenter.ts +1 -1
- package/dist/lib/browser/CollectionPresenterContainer-IPDW4HZR.mjs.map +0 -7
- package/dist/lib/browser/DocumentPresenterContainer-LJBJM5UB.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSlide-KG7ESCSU.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LURIPUEV.mjs.map +0 -7
- package/dist/lib/browser/chunk-QWJM3ADC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3SPF2ANF.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-presenter",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.dedc0f3",
|
|
4
4
|
"description": "Braneframe presenter plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
|
-
"browser": "./dist/lib/browser/index.mjs"
|
|
15
|
-
"source": "./src/index.ts"
|
|
15
|
+
"browser": "./dist/lib/browser/index.mjs"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -36,37 +36,37 @@
|
|
|
36
36
|
"remark-frontmatter": "^5.0.0",
|
|
37
37
|
"remark-parse-frontmatter": "^1.0.3",
|
|
38
38
|
"reveal.js": "^5.1.0",
|
|
39
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
40
|
-
"@dxos/async": "0.8.4-main.
|
|
41
|
-
"@dxos/echo": "0.8.4-main.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/plugin-
|
|
47
|
-
"@dxos/plugin-
|
|
48
|
-
"@dxos/plugin-markdown": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/plugin-stack": "0.8.4-main.
|
|
51
|
-
"@dxos/react-client": "0.8.4-main.
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/react-ui-form": "0.8.4-main.
|
|
39
|
+
"@dxos/app-framework": "0.8.4-main.dedc0f3",
|
|
40
|
+
"@dxos/async": "0.8.4-main.dedc0f3",
|
|
41
|
+
"@dxos/echo-schema": "0.8.4-main.dedc0f3",
|
|
42
|
+
"@dxos/live-object": "0.8.4-main.dedc0f3",
|
|
43
|
+
"@dxos/local-storage": "0.8.4-main.dedc0f3",
|
|
44
|
+
"@dxos/echo": "0.8.4-main.dedc0f3",
|
|
45
|
+
"@dxos/log": "0.8.4-main.dedc0f3",
|
|
46
|
+
"@dxos/plugin-client": "0.8.4-main.dedc0f3",
|
|
47
|
+
"@dxos/plugin-deck": "0.8.4-main.dedc0f3",
|
|
48
|
+
"@dxos/plugin-markdown": "0.8.4-main.dedc0f3",
|
|
49
|
+
"@dxos/plugin-graph": "0.8.4-main.dedc0f3",
|
|
50
|
+
"@dxos/plugin-stack": "0.8.4-main.dedc0f3",
|
|
51
|
+
"@dxos/react-client": "0.8.4-main.dedc0f3",
|
|
52
|
+
"@dxos/schema": "0.8.4-main.dedc0f3",
|
|
53
|
+
"@dxos/react-ui-stack": "0.8.4-main.dedc0f3",
|
|
54
|
+
"@dxos/react-ui-form": "0.8.4-main.dedc0f3"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@effect-rx/rx-react": "0.38.0",
|
|
58
|
-
"@effect/platform": "0.
|
|
58
|
+
"@effect/platform": "0.90.2",
|
|
59
59
|
"@types/react": "~18.2.0",
|
|
60
60
|
"@types/react-dom": "~18.2.0",
|
|
61
61
|
"@types/reveal.js": "^5.0.3",
|
|
62
|
-
"effect": "3.17.
|
|
62
|
+
"effect": "3.17.7",
|
|
63
63
|
"react": "~18.2.0",
|
|
64
64
|
"react-dom": "~18.2.0",
|
|
65
|
-
"vite": "
|
|
66
|
-
"@dxos/random": "0.8.4-main.
|
|
67
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
68
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
69
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
65
|
+
"vite": "7.1.1",
|
|
66
|
+
"@dxos/random": "0.8.4-main.dedc0f3",
|
|
67
|
+
"@dxos/react-ui": "0.8.4-main.dedc0f3",
|
|
68
|
+
"@dxos/react-ui-theme": "0.8.4-main.dedc0f3",
|
|
69
|
+
"@dxos/storybook-utils": "0.8.4-main.dedc0f3"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@effect-rx/rx-react": "^0.34.1",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"effect": "^3.13.3",
|
|
75
75
|
"react": "~18.2.0",
|
|
76
76
|
"react-dom": "~18.2.0",
|
|
77
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
78
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
77
|
+
"@dxos/react-ui": "0.8.4-main.dedc0f3",
|
|
78
|
+
"@dxos/react-ui-theme": "0.8.4-main.dedc0f3"
|
|
79
79
|
},
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
package/src/PresenterPlugin.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
7
|
import { AppGraphBuilder, PresenterSettings, ReactSurface } from './capabilities';
|
|
8
8
|
import { meta } from './meta';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
6
|
import { Option, pipe } from 'effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
10
|
import { DeckCapabilities } from '@dxos/plugin-deck';
|
|
11
11
|
import { ATTENDABLE_PATH_SEPARATOR, DeckAction } from '@dxos/plugin-deck/types';
|
|
@@ -22,6 +22,39 @@ export default (context: PluginContext) =>
|
|
|
22
22
|
Capabilities.AppGraphBuilder,
|
|
23
23
|
createExtension({
|
|
24
24
|
id: PRESENTER_PLUGIN,
|
|
25
|
+
// TODO(wittjosiah): This is a hack to work around presenter previously relying on "variant". Remove.
|
|
26
|
+
connector: (node) =>
|
|
27
|
+
Rx.make((get) =>
|
|
28
|
+
pipe(
|
|
29
|
+
get(node),
|
|
30
|
+
Option.flatMap((node) => {
|
|
31
|
+
const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));
|
|
32
|
+
const settings = get(
|
|
33
|
+
rxFromSignal(() => settingsStore?.getStore<PresenterSettingsProps>(PRESENTER_PLUGIN)?.value),
|
|
34
|
+
);
|
|
35
|
+
const isPresentable = settings?.presentCollections
|
|
36
|
+
? Obj.instanceOf(DataType.Collection, node.data) || Obj.instanceOf(Markdown.Document, node.data)
|
|
37
|
+
: Obj.instanceOf(Markdown.Document, node.data);
|
|
38
|
+
return isPresentable ? Option.some(node.data) : Option.none();
|
|
39
|
+
}),
|
|
40
|
+
Option.map((object) => {
|
|
41
|
+
const id = fullyQualifiedId(object);
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
id: [id, 'presenter'].join(ATTENDABLE_PATH_SEPARATOR),
|
|
45
|
+
data: { type: PRESENTER_PLUGIN, object },
|
|
46
|
+
type: PRESENTER_PLUGIN,
|
|
47
|
+
properties: {
|
|
48
|
+
label: 'Presenter',
|
|
49
|
+
icon: 'ph--presentation--regular',
|
|
50
|
+
disposition: 'hidden',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
}),
|
|
55
|
+
Option.getOrElse(() => []),
|
|
56
|
+
),
|
|
57
|
+
),
|
|
25
58
|
actions: (node) =>
|
|
26
59
|
Rx.make((get) =>
|
|
27
60
|
pipe(
|
|
@@ -67,6 +100,7 @@ export default (context: PluginContext) =>
|
|
|
67
100
|
properties: {
|
|
68
101
|
label: ['toggle presentation label', { ns: PRESENTER_PLUGIN }],
|
|
69
102
|
icon: 'ph--presentation--regular',
|
|
103
|
+
disposition: 'list-item',
|
|
70
104
|
keyBinding: {
|
|
71
105
|
macos: 'shift+meta+p',
|
|
72
106
|
windows: 'shift+alt+p',
|
|
@@ -11,10 +11,10 @@ import { Markdown } from '@dxos/plugin-markdown/types';
|
|
|
11
11
|
import { DataType } from '@dxos/schema';
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
|
+
CollectionPresenterContainer,
|
|
15
|
+
DocumentPresenterContainer,
|
|
14
16
|
MarkdownSlide,
|
|
15
17
|
PresenterSettings,
|
|
16
|
-
DocumentPresenterContainer,
|
|
17
|
-
CollectionPresenterContainer,
|
|
18
18
|
} from '../components';
|
|
19
19
|
import { PRESENTER_PLUGIN } from '../meta';
|
|
20
20
|
import { type PresenterSettingsProps } from '../types';
|
|
@@ -25,17 +25,27 @@ export default () =>
|
|
|
25
25
|
id: `${PRESENTER_PLUGIN}/document`,
|
|
26
26
|
role: 'article',
|
|
27
27
|
position: 'hoist',
|
|
28
|
-
filter: (data): data is { subject:
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
filter: (data): data is { subject: { type: typeof PRESENTER_PLUGIN; object: Markdown.Document } } =>
|
|
29
|
+
!!data.subject &&
|
|
30
|
+
typeof data.subject === 'object' &&
|
|
31
|
+
'type' in data.subject &&
|
|
32
|
+
'object' in data.subject &&
|
|
33
|
+
data.subject.type === PRESENTER_PLUGIN &&
|
|
34
|
+
Obj.instanceOf(Markdown.Document, data.subject.object),
|
|
35
|
+
component: ({ data }) => <DocumentPresenterContainer document={data.subject.object} />,
|
|
31
36
|
}),
|
|
32
37
|
createSurface({
|
|
33
38
|
id: `${PRESENTER_PLUGIN}/collection`,
|
|
34
39
|
role: 'article',
|
|
35
40
|
position: 'hoist',
|
|
36
|
-
filter: (data): data is { subject:
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
filter: (data): data is { subject: { type: typeof PRESENTER_PLUGIN; object: DataType.Collection } } =>
|
|
42
|
+
!!data.subject &&
|
|
43
|
+
typeof data.subject === 'object' &&
|
|
44
|
+
'type' in data.subject &&
|
|
45
|
+
'object' in data.subject &&
|
|
46
|
+
data.subject.type === PRESENTER_PLUGIN &&
|
|
47
|
+
Obj.instanceOf(DataType.Collection, data.subject.object),
|
|
48
|
+
component: ({ data }) => <CollectionPresenterContainer collection={data.subject.object} />,
|
|
39
49
|
}),
|
|
40
50
|
createSurface({
|
|
41
51
|
id: `${PRESENTER_PLUGIN}/slide`,
|
|
@@ -6,7 +6,7 @@ import { Capabilities, contributes } from '@dxos/app-framework';
|
|
|
6
6
|
import { live } from '@dxos/live-object';
|
|
7
7
|
|
|
8
8
|
import { meta } from '../meta';
|
|
9
|
-
import {
|
|
9
|
+
import { type PresenterSettingsProps, PresenterSettingsSchema } from '../types';
|
|
10
10
|
|
|
11
11
|
export default () => {
|
|
12
12
|
const settings = live<PresenterSettingsProps>({});
|
|
@@ -8,10 +8,11 @@ import { Surface } from '@dxos/app-framework';
|
|
|
8
8
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
9
9
|
import { type DataType } from '@dxos/schema';
|
|
10
10
|
|
|
11
|
-
import { Layout, PageNumber, Pager } from './Presenter';
|
|
12
11
|
import { PresenterContext } from '../types';
|
|
13
12
|
import { useExitPresenter } from '../useExitPresenter';
|
|
14
13
|
|
|
14
|
+
import { Layout, PageNumber, Pager } from './Presenter';
|
|
15
|
+
|
|
15
16
|
const CollectionPresenterContainer: FC<{ collection: DataType.Collection }> = ({ collection }) => {
|
|
16
17
|
const [slide, setSlide] = useState(0);
|
|
17
18
|
|
|
@@ -6,9 +6,10 @@ import React, { type FC } from 'react';
|
|
|
6
6
|
import { type Markdown } from '@dxos/plugin-markdown/types';
|
|
7
7
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
8
8
|
|
|
9
|
-
import { RevealPlayer } from './RevealPlayer';
|
|
10
9
|
import { useExitPresenter } from '../useExitPresenter';
|
|
11
10
|
|
|
11
|
+
import { RevealPlayer } from './RevealPlayer';
|
|
12
|
+
|
|
12
13
|
const DocumentPresenterContainer: FC<{ document: Markdown.Document }> = ({ document }) => {
|
|
13
14
|
const handleExit = useExitPresenter(document);
|
|
14
15
|
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
10
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
11
11
|
|
|
12
|
+
import { createSlide } from '../../testing';
|
|
13
|
+
|
|
12
14
|
import { Container } from './Container';
|
|
13
15
|
import { Slide, type SlideProps } from './Slide';
|
|
14
|
-
import { createSlide } from '../../testing';
|
|
15
16
|
|
|
16
17
|
const DefaultStory = ({ content = '' }: SlideProps) => {
|
|
17
18
|
return (
|
|
@@ -21,37 +22,39 @@ const DefaultStory = ({ content = '' }: SlideProps) => {
|
|
|
21
22
|
);
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
const meta = {
|
|
26
|
+
title: 'plugins/plugin-presenter/Container',
|
|
27
|
+
render: DefaultStory,
|
|
28
|
+
decorators: [withTheme, withLayout({ fullscreen: true })],
|
|
29
|
+
parameters: {
|
|
30
|
+
layout: 'fullscreen',
|
|
31
|
+
},
|
|
32
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
37
|
+
|
|
38
|
+
export const Default: Story = {
|
|
25
39
|
args: {
|
|
26
40
|
content: createSlide({ number: 1 }),
|
|
27
41
|
},
|
|
28
42
|
};
|
|
29
43
|
|
|
30
|
-
export const Code = {
|
|
44
|
+
export const Code: Story = {
|
|
31
45
|
args: {
|
|
32
46
|
content: createSlide({ code: true }),
|
|
33
47
|
},
|
|
34
48
|
};
|
|
35
49
|
|
|
36
|
-
export const List = {
|
|
50
|
+
export const List: Story = {
|
|
37
51
|
args: {
|
|
38
52
|
content: createSlide({ list: 3 }),
|
|
39
53
|
},
|
|
40
54
|
};
|
|
41
55
|
|
|
42
|
-
export const Ordered = {
|
|
56
|
+
export const Ordered: Story = {
|
|
43
57
|
args: {
|
|
44
58
|
content: createSlide({ ordered: 4 }),
|
|
45
59
|
},
|
|
46
60
|
};
|
|
47
|
-
|
|
48
|
-
const meta: Meta<typeof Slide> = {
|
|
49
|
-
title: 'plugins/plugin-presenter/Container',
|
|
50
|
-
render: DefaultStory,
|
|
51
|
-
decorators: [withTheme, withLayout({ fullscreen: true })],
|
|
52
|
-
parameters: {
|
|
53
|
-
layout: 'fullscreen',
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default meta;
|
|
@@ -4,28 +4,31 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
|
|
9
|
-
import { Slide } from './Slide';
|
|
10
9
|
import { createSlide } from '../../testing';
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
import { Slide } from './Slide';
|
|
12
|
+
|
|
13
|
+
const meta = {
|
|
13
14
|
title: 'plugins/plugin-presenter/Slide',
|
|
14
15
|
component: Slide,
|
|
15
16
|
parameters: {
|
|
16
17
|
layout: 'fullscreen',
|
|
17
18
|
},
|
|
18
|
-
}
|
|
19
|
+
} satisfies Meta<typeof Slide>;
|
|
19
20
|
|
|
20
21
|
export default meta;
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
23
26
|
args: {
|
|
24
27
|
content: createSlide(),
|
|
25
28
|
},
|
|
26
29
|
};
|
|
27
30
|
|
|
28
|
-
export const Code = {
|
|
31
|
+
export const Code: Story = {
|
|
29
32
|
args: {
|
|
30
33
|
content: createSlide({ code: true }),
|
|
31
34
|
},
|
|
@@ -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,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { withTheme } from '@dxos/storybook-utils';
|
|
@@ -24,15 +24,17 @@ const DefaultStory = ({ count = 20 }: PagerProps) => {
|
|
|
24
24
|
);
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const meta: Meta<PagerProps> = {
|
|
27
|
+
const meta = {
|
|
30
28
|
title: 'plugins/plugin-presenter/Pager',
|
|
31
29
|
render: DefaultStory,
|
|
32
30
|
decorators: [withTheme],
|
|
33
31
|
parameters: {
|
|
34
32
|
layout: 'centered',
|
|
35
33
|
},
|
|
36
|
-
}
|
|
34
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
37
35
|
|
|
38
36
|
export default meta;
|
|
37
|
+
|
|
38
|
+
type Story = StoryObj<typeof meta>;
|
|
39
|
+
|
|
40
|
+
export const Default: Story = {};
|