@dxos/plugin-presenter 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8
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-IFILQWPJ.mjs +52 -0
- package/dist/lib/browser/CollectionPresenterContainer-IFILQWPJ.mjs.map +7 -0
- package/dist/lib/browser/DocumentPresenterContainer-PMS5FH4A.mjs +28 -0
- package/dist/lib/browser/DocumentPresenterContainer-PMS5FH4A.mjs.map +7 -0
- package/dist/lib/browser/MarkdownSlide-EGVUVP2N.mjs +23 -0
- package/dist/lib/browser/MarkdownSlide-EGVUVP2N.mjs.map +7 -0
- package/dist/lib/browser/PresenterSettings-H3ELNHGX.mjs +31 -0
- package/dist/lib/browser/PresenterSettings-H3ELNHGX.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-2QAQR34J.mjs → app-graph-builder-T2BJ5XUZ.mjs} +19 -26
- package/dist/lib/browser/app-graph-builder-T2BJ5XUZ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GM4KOXJY.mjs → chunk-GQBEHCZW.mjs} +9 -8
- package/dist/lib/browser/chunk-GQBEHCZW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-4PZXJXBO.mjs → chunk-PBH33Y3O.mjs} +6 -6
- package/dist/lib/browser/chunk-PBH33Y3O.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VQVZVXPJ.mjs → chunk-PYBNNNNK.mjs} +2 -2
- package/dist/lib/browser/{chunk-VQVZVXPJ.mjs.map → chunk-PYBNNNNK.mjs.map} +1 -1
- package/dist/lib/browser/chunk-YNKUN3CU.mjs +485 -0
- package/dist/lib/browser/chunk-YNKUN3CU.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +28 -21
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-2VP2M4Z7.mjs → react-surface-XXUUAQNP.mjs} +25 -21
- package/dist/lib/browser/react-surface-XXUUAQNP.mjs.map +7 -0
- package/dist/lib/browser/{settings-RDHXCCT4.mjs → settings-FBHSLR6P.mjs} +6 -5
- package/dist/lib/browser/settings-FBHSLR6P.mjs.map +7 -0
- package/dist/types/src/PresenterPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +4 -3
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -1
- package/dist/types/src/components/Markdown/Panel.d.ts +8 -0
- package/dist/types/src/components/Markdown/Panel.d.ts.map +1 -0
- package/dist/types/src/components/Markdown/{Container.stories.d.ts → Panel.stories.d.ts} +1 -1
- package/dist/types/src/components/Markdown/Panel.stories.d.ts.map +1 -0
- package/dist/types/src/components/Markdown/index.d.ts +1 -1
- package/dist/types/src/components/Markdown/index.d.ts.map +1 -1
- package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -28
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.d.ts +7 -0
- package/dist/types/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.d.ts.map +1 -0
- package/dist/types/src/containers/CollectionPresenterContainer/index.d.ts +3 -0
- package/dist/types/src/containers/CollectionPresenterContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/DocumentPresenterContainer/DocumentPresenterContainer.d.ts +6 -0
- package/dist/types/src/containers/DocumentPresenterContainer/DocumentPresenterContainer.d.ts.map +1 -0
- package/dist/types/src/containers/DocumentPresenterContainer/index.d.ts +3 -0
- package/dist/types/src/containers/DocumentPresenterContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSlide/MarkdownSlide.d.ts +8 -0
- package/dist/types/src/containers/MarkdownSlide/MarkdownSlide.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSlide/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownSlide/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/PresenterSettings}/PresenterSettings.d.ts +1 -1
- package/dist/types/src/containers/PresenterSettings/PresenterSettings.d.ts.map +1 -0
- package/dist/types/src/containers/PresenterSettings/index.d.ts +3 -0
- package/dist/types/src/containers/PresenterSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/types.d.ts +2 -2
- package/dist/types/src/useExitPresenter.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -35
- package/src/PresenterPlugin.tsx +6 -5
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +24 -17
- package/src/capabilities/react-surface/react-surface.tsx +16 -15
- package/src/capabilities/settings/settings.ts +3 -2
- package/src/components/Markdown/{Container.stories.tsx → Panel.stories.tsx} +6 -6
- package/src/components/Markdown/{Container.tsx → Panel.tsx} +5 -5
- package/src/components/Markdown/Slide.stories.tsx +3 -3
- package/src/components/Markdown/index.ts +1 -1
- package/src/components/Markdown/theme.ts +6 -6
- package/src/components/Presenter/Layout.tsx +1 -1
- package/src/components/Presenter/Pager.stories.tsx +2 -2
- package/src/components/RevealPlayer/RevealPlayer.stories.tsx +3 -3
- package/src/components/RevealPlayer/RevealPlayer.tsx +3 -3
- package/src/components/index.ts +3 -7
- package/src/containers/CollectionPresenterContainer/CollectionPresenterContainer.tsx +43 -0
- package/src/containers/CollectionPresenterContainer/index.ts +7 -0
- package/src/containers/DocumentPresenterContainer/DocumentPresenterContainer.tsx +23 -0
- package/src/containers/DocumentPresenterContainer/index.ts +7 -0
- package/src/{components → containers/MarkdownSlide}/MarkdownSlide.tsx +4 -6
- package/src/containers/MarkdownSlide/index.ts +7 -0
- package/src/{components → containers/PresenterSettings}/PresenterSettings.tsx +11 -11
- package/src/containers/PresenterSettings/index.ts +7 -0
- package/src/containers/index.ts +10 -0
- package/src/meta.ts +1 -1
- package/src/types.ts +4 -4
- package/src/useExitPresenter.ts +10 -8
- package/dist/lib/browser/CollectionPresenterContainer-IHDZWP3U.mjs +0 -176
- package/dist/lib/browser/CollectionPresenterContainer-IHDZWP3U.mjs.map +0 -7
- package/dist/lib/browser/DocumentPresenterContainer-74M6XAAI.mjs +0 -173
- package/dist/lib/browser/DocumentPresenterContainer-74M6XAAI.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSlide-GIYJABHE.mjs +0 -200
- package/dist/lib/browser/MarkdownSlide-GIYJABHE.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-2QAQR34J.mjs.map +0 -7
- package/dist/lib/browser/chunk-4PZXJXBO.mjs.map +0 -7
- package/dist/lib/browser/chunk-5MC4V23G.mjs +0 -38
- package/dist/lib/browser/chunk-5MC4V23G.mjs.map +0 -7
- package/dist/lib/browser/chunk-GM4KOXJY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-2VP2M4Z7.mjs.map +0 -7
- package/dist/lib/browser/settings-RDHXCCT4.mjs.map +0 -7
- package/dist/types/src/components/CollectionPresenterContainer.d.ts +0 -7
- package/dist/types/src/components/CollectionPresenterContainer.d.ts.map +0 -1
- package/dist/types/src/components/DocumentPresenterContainer.d.ts +0 -7
- package/dist/types/src/components/DocumentPresenterContainer.d.ts.map +0 -1
- package/dist/types/src/components/Markdown/Container.d.ts +0 -8
- package/dist/types/src/components/Markdown/Container.d.ts.map +0 -1
- package/dist/types/src/components/Markdown/Container.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownSlide.d.ts +0 -8
- package/dist/types/src/components/MarkdownSlide.d.ts.map +0 -1
- package/dist/types/src/components/PresenterSettings.d.ts.map +0 -1
- package/src/components/CollectionPresenterContainer.tsx +0 -43
- package/src/components/DocumentPresenterContainer.tsx +0 -23
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.c351d160a8",
|
|
4
4
|
"description": "Braneframe presenter plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"browser": "./dist/lib/browser/index.mjs",
|
|
18
17
|
"source": "./src/index.ts",
|
|
18
|
+
"browser": "./dist/lib/browser/index.mjs",
|
|
19
19
|
"types": "./dist/types/src/index.d.ts"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"src"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@effect-atom/atom": "^0.
|
|
32
|
-
"@effect-atom/atom-react": "^0.
|
|
31
|
+
"@effect-atom/atom": "^0.5.1",
|
|
32
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
33
33
|
"hastscript": "^7.1.0",
|
|
34
34
|
"highlight.js": "^11.9.0",
|
|
35
35
|
"marked": "^12.0.2",
|
|
@@ -40,48 +40,49 @@
|
|
|
40
40
|
"remark-frontmatter": "^5.0.0",
|
|
41
41
|
"remark-parse-frontmatter": "^1.0.3",
|
|
42
42
|
"reveal.js": "^5.1.0",
|
|
43
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/log": "0.8.4-main.
|
|
46
|
-
"@dxos/echo": "0.8.4-main.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/plugin-
|
|
50
|
-
"@dxos/plugin-
|
|
51
|
-
"@dxos/plugin-graph": "0.8.4-main.
|
|
52
|
-
"@dxos/plugin-markdown": "0.8.4-main.
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/react-
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/react-ui-mosaic": "0.8.4-main.
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
43
|
+
"@dxos/app-framework": "0.8.4-main.c351d160a8",
|
|
44
|
+
"@dxos/app-toolkit": "0.8.4-main.c351d160a8",
|
|
45
|
+
"@dxos/log": "0.8.4-main.c351d160a8",
|
|
46
|
+
"@dxos/echo": "0.8.4-main.c351d160a8",
|
|
47
|
+
"@dxos/effect": "0.8.4-main.c351d160a8",
|
|
48
|
+
"@dxos/operation": "0.8.4-main.c351d160a8",
|
|
49
|
+
"@dxos/plugin-client": "0.8.4-main.c351d160a8",
|
|
50
|
+
"@dxos/plugin-deck": "0.8.4-main.c351d160a8",
|
|
51
|
+
"@dxos/plugin-graph": "0.8.4-main.c351d160a8",
|
|
52
|
+
"@dxos/plugin-markdown": "0.8.4-main.c351d160a8",
|
|
53
|
+
"@dxos/plugin-stack": "0.8.4-main.c351d160a8",
|
|
54
|
+
"@dxos/react-client": "0.8.4-main.c351d160a8",
|
|
55
|
+
"@dxos/react-ui-form": "0.8.4-main.c351d160a8",
|
|
56
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.c351d160a8",
|
|
57
|
+
"@dxos/react-ui-stack": "0.8.4-main.c351d160a8",
|
|
58
|
+
"@dxos/schema": "0.8.4-main.c351d160a8",
|
|
59
|
+
"@dxos/async": "0.8.4-main.c351d160a8",
|
|
60
|
+
"@dxos/types": "0.8.4-main.c351d160a8",
|
|
61
|
+
"@dxos/util": "0.8.4-main.c351d160a8"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
|
-
"@effect-atom/atom-react": "^0.
|
|
64
|
-
"@effect/platform": "0.
|
|
64
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
65
|
+
"@effect/platform": "0.94.4",
|
|
65
66
|
"@types/react": "~19.2.7",
|
|
66
67
|
"@types/react-dom": "~19.2.3",
|
|
67
68
|
"@types/reveal.js": "^5.0.3",
|
|
68
|
-
"effect": "3.19.
|
|
69
|
+
"effect": "3.19.16",
|
|
69
70
|
"react": "~19.2.3",
|
|
70
71
|
"react-dom": "~19.2.3",
|
|
71
|
-
"vite": "7.1.
|
|
72
|
-
"@dxos/random": "0.8.4-main.
|
|
73
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
72
|
+
"vite": "^7.1.11",
|
|
73
|
+
"@dxos/random": "0.8.4-main.c351d160a8",
|
|
74
|
+
"@dxos/react-ui": "0.8.4-main.c351d160a8",
|
|
75
|
+
"@dxos/storybook-utils": "0.8.4-main.c351d160a8",
|
|
76
|
+
"@dxos/ui-theme": "0.8.4-main.c351d160a8"
|
|
76
77
|
},
|
|
77
78
|
"peerDependencies": {
|
|
78
|
-
"@effect-atom/atom-react": "^0.
|
|
79
|
-
"@effect/platform": "0.
|
|
80
|
-
"effect": "3.19.
|
|
79
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
80
|
+
"@effect/platform": "0.94.4",
|
|
81
|
+
"effect": "3.19.16",
|
|
81
82
|
"react": "~19.2.3",
|
|
82
83
|
"react-dom": "~19.2.3",
|
|
83
|
-
"@dxos/ui
|
|
84
|
-
"@dxos/
|
|
84
|
+
"@dxos/react-ui": "0.8.4-main.c351d160a8",
|
|
85
|
+
"@dxos/ui-theme": "0.8.4-main.c351d160a8"
|
|
85
86
|
},
|
|
86
87
|
"publishConfig": {
|
|
87
88
|
"access": "public"
|
package/src/PresenterPlugin.tsx
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
6
7
|
|
|
7
8
|
import { AppGraphBuilder, PresenterSettings, ReactSurface } from './capabilities';
|
|
8
9
|
import { meta } from './meta';
|
|
@@ -12,9 +13,9 @@ import { translations } from './translations';
|
|
|
12
13
|
// TODO(burdon): Map stack content; Slide content type (e.g., markdown, sketch, IPFS image, table, etc.)
|
|
13
14
|
|
|
14
15
|
export const PresenterPlugin = Plugin.define(meta).pipe(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
17
|
+
AppPlugin.addSettingsModule({ activate: PresenterSettings }),
|
|
18
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
19
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
19
20
|
Plugin.make,
|
|
20
21
|
);
|
|
@@ -5,14 +5,21 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import * as Option from 'effect/Option';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import {
|
|
10
|
+
AppCapabilities,
|
|
11
|
+
COMPANION_PREFIX,
|
|
12
|
+
LayoutOperation,
|
|
13
|
+
getObjectPathFromObject,
|
|
14
|
+
getSpacePath,
|
|
15
|
+
} from '@dxos/app-toolkit';
|
|
9
16
|
import { Obj } from '@dxos/echo';
|
|
17
|
+
import { Collection } from '@dxos/echo';
|
|
10
18
|
import { Operation } from '@dxos/operation';
|
|
11
19
|
import { DeckCapabilities } from '@dxos/plugin-deck';
|
|
12
|
-
import {
|
|
20
|
+
import { DeckOperation, PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
|
|
13
21
|
import { GraphBuilder, type Node, NodeMatcher } from '@dxos/plugin-graph';
|
|
14
22
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
15
|
-
import { Collection } from '@dxos/schema';
|
|
16
23
|
|
|
17
24
|
import { meta } from '../../meta';
|
|
18
25
|
import { PresenterCapabilities, PresenterOperation } from '../../types';
|
|
@@ -28,7 +35,7 @@ export default Capability.makeModule(
|
|
|
28
35
|
const capabilities = yield* Capability.Service;
|
|
29
36
|
|
|
30
37
|
const extensions = yield* GraphBuilder.createExtension({
|
|
31
|
-
id: `${meta.id}
|
|
38
|
+
id: `${meta.id}.root`,
|
|
32
39
|
// TODO(wittjosiah): This is a hack to work around presenter previously relying on "variant". Remove.
|
|
33
40
|
match: whenPresentable,
|
|
34
41
|
connector: (object, get) => {
|
|
@@ -40,12 +47,12 @@ export default Capability.makeModule(
|
|
|
40
47
|
if (!isPresentable) {
|
|
41
48
|
return Effect.succeed([]);
|
|
42
49
|
}
|
|
43
|
-
|
|
50
|
+
|
|
44
51
|
return Effect.succeed([
|
|
45
52
|
{
|
|
46
|
-
id:
|
|
53
|
+
id: `${COMPANION_PREFIX}presenter`,
|
|
47
54
|
data: { type: meta.id, object },
|
|
48
|
-
type:
|
|
55
|
+
type: PLANK_COMPANION_TYPE,
|
|
49
56
|
properties: {
|
|
50
57
|
label: 'Presenter',
|
|
51
58
|
icon: 'ph--presentation--regular',
|
|
@@ -60,30 +67,30 @@ export default Capability.makeModule(
|
|
|
60
67
|
const isPresentable = settings?.presentCollections
|
|
61
68
|
? Obj.instanceOf(Collection.Collection, object) || Obj.instanceOf(Markdown.Document, object)
|
|
62
69
|
: Obj.instanceOf(Markdown.Document, object);
|
|
63
|
-
|
|
70
|
+
const db = Obj.getDatabase(object);
|
|
71
|
+
if (!isPresentable || !db) {
|
|
64
72
|
return Effect.succeed([]);
|
|
65
73
|
}
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const { spaceId } = dxn.asEchoDXN()!;
|
|
74
|
+
const objectPath = getObjectPathFromObject(object);
|
|
75
|
+
|
|
69
76
|
return Effect.succeed([
|
|
70
77
|
{
|
|
71
|
-
id:
|
|
78
|
+
id: PresenterOperation.TogglePresentation.meta.key,
|
|
72
79
|
// TODO(burdon): Allow function so can generate state when activated.
|
|
73
80
|
// So can set explicit fullscreen state coordinated with current presenter state.
|
|
74
81
|
data: Effect.fnUntraced(function* () {
|
|
75
|
-
const deckState = yield*
|
|
82
|
+
const deckState = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
76
83
|
const deck = deckState.decks[deckState.activeDeck];
|
|
77
|
-
const presenterId =
|
|
84
|
+
const presenterId = `${objectPath}/${COMPANION_PREFIX}presenter`;
|
|
78
85
|
if (!deck?.fullscreen) {
|
|
79
86
|
yield* Operation.invoke(DeckOperation.Adjust, {
|
|
80
87
|
type: 'solo--fullscreen' as const,
|
|
81
88
|
id: presenterId,
|
|
82
89
|
});
|
|
83
90
|
}
|
|
84
|
-
yield* Operation.invoke(
|
|
91
|
+
yield* Operation.invoke(LayoutOperation.Open, {
|
|
85
92
|
subject: [presenterId],
|
|
86
|
-
workspace: spaceId,
|
|
93
|
+
workspace: getSpacePath(db.spaceId),
|
|
87
94
|
});
|
|
88
95
|
}),
|
|
89
96
|
properties: {
|
|
@@ -100,6 +107,6 @@ export default Capability.makeModule(
|
|
|
100
107
|
},
|
|
101
108
|
});
|
|
102
109
|
|
|
103
|
-
return Capability.contributes(
|
|
110
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
104
111
|
}),
|
|
105
112
|
);
|
|
@@ -5,26 +5,27 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { useSettingsState } from '@dxos/app-framework/
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface, useSettingsState } from '@dxos/app-framework/ui';
|
|
10
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
10
11
|
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { Collection } from '@dxos/echo';
|
|
11
13
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
12
|
-
import { Collection } from '@dxos/schema';
|
|
13
14
|
|
|
14
15
|
import {
|
|
15
16
|
CollectionPresenterContainer,
|
|
16
17
|
DocumentPresenterContainer,
|
|
17
18
|
MarkdownSlide,
|
|
18
19
|
PresenterSettings,
|
|
19
|
-
} from '../../
|
|
20
|
+
} from '../../containers';
|
|
20
21
|
import { meta } from '../../meta';
|
|
21
22
|
import { type PresenterSettingsProps } from '../../types';
|
|
22
23
|
|
|
23
24
|
export default Capability.makeModule(() =>
|
|
24
25
|
Effect.succeed(
|
|
25
|
-
Capability.contributes(
|
|
26
|
-
|
|
27
|
-
id: `${meta.id}
|
|
26
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
27
|
+
Surface.create({
|
|
28
|
+
id: `${meta.id}.document`,
|
|
28
29
|
role: 'article',
|
|
29
30
|
position: 'hoist',
|
|
30
31
|
filter: (data): data is { subject: { type: typeof meta.id; object: Markdown.Document } } =>
|
|
@@ -36,8 +37,8 @@ export default Capability.makeModule(() =>
|
|
|
36
37
|
Obj.instanceOf(Markdown.Document, data.subject.object),
|
|
37
38
|
component: ({ data }) => <DocumentPresenterContainer document={data.subject.object} />,
|
|
38
39
|
}),
|
|
39
|
-
|
|
40
|
-
id: `${meta.id}
|
|
40
|
+
Surface.create({
|
|
41
|
+
id: `${meta.id}.collection`,
|
|
41
42
|
role: 'article',
|
|
42
43
|
position: 'hoist',
|
|
43
44
|
filter: (data): data is { subject: { type: typeof meta.id; object: Collection.Collection } } =>
|
|
@@ -49,17 +50,17 @@ export default Capability.makeModule(() =>
|
|
|
49
50
|
Obj.instanceOf(Collection.Collection, data.subject.object),
|
|
50
51
|
component: ({ role, data }) => <CollectionPresenterContainer role={role} subject={data.subject.object} />,
|
|
51
52
|
}),
|
|
52
|
-
|
|
53
|
-
id: `${meta.id}
|
|
53
|
+
Surface.create({
|
|
54
|
+
id: `${meta.id}.slide`,
|
|
54
55
|
role: 'slide',
|
|
55
56
|
filter: (data): data is { subject: Markdown.Document } => Obj.instanceOf(Markdown.Document, data.subject),
|
|
56
57
|
component: ({ data }) => <MarkdownSlide document={data.subject} />,
|
|
57
58
|
}),
|
|
58
|
-
|
|
59
|
-
id: `${meta.id}
|
|
59
|
+
Surface.create({
|
|
60
|
+
id: `${meta.id}.plugin-settings`,
|
|
60
61
|
role: 'article',
|
|
61
|
-
filter: (data): data is { subject:
|
|
62
|
-
|
|
62
|
+
filter: (data): data is { subject: AppCapabilities.Settings } =>
|
|
63
|
+
AppCapabilities.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
63
64
|
component: ({ data: { subject } }) => {
|
|
64
65
|
const { settings, updateSettings } = useSettingsState<PresenterSettingsProps>(subject.atom);
|
|
65
66
|
return <PresenterSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import { Capability
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
8
9
|
import { createKvsStore } from '@dxos/effect';
|
|
9
10
|
|
|
10
11
|
import { meta } from '../../meta';
|
|
@@ -20,7 +21,7 @@ export default Capability.makeModule(() =>
|
|
|
20
21
|
|
|
21
22
|
return [
|
|
22
23
|
Capability.contributes(PresenterCapabilities.Settings, settingsAtom),
|
|
23
|
-
Capability.contributes(
|
|
24
|
+
Capability.contributes(AppCapabilities.Settings, {
|
|
24
25
|
prefix: meta.id,
|
|
25
26
|
schema: PresenterSettingsSchema,
|
|
26
27
|
atom: settingsAtom,
|
|
@@ -5,25 +5,25 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
8
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
9
9
|
|
|
10
10
|
import { createSlide } from '../../testing';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { Panel } from './Panel';
|
|
13
13
|
import { Slide, type SlideProps } from './Slide';
|
|
14
14
|
|
|
15
15
|
const DefaultStory = ({ content = '' }: SlideProps) => {
|
|
16
16
|
return (
|
|
17
|
-
<
|
|
17
|
+
<Panel classNames='bg-neutral-200'>
|
|
18
18
|
<Slide content={content} />
|
|
19
|
-
</
|
|
19
|
+
</Panel>
|
|
20
20
|
);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const meta = {
|
|
24
|
-
title: 'plugins/plugin-presenter/
|
|
24
|
+
title: 'plugins/plugin-presenter/components/Panel',
|
|
25
25
|
render: DefaultStory,
|
|
26
|
-
decorators: [withTheme],
|
|
26
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
27
27
|
parameters: {
|
|
28
28
|
layout: 'fullscreen',
|
|
29
29
|
},
|
|
@@ -8,12 +8,12 @@ import { useResizeDetector } from 'react-resize-detector';
|
|
|
8
8
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
9
|
import { mx } from '@dxos/ui-theme';
|
|
10
10
|
|
|
11
|
-
export type
|
|
11
|
+
export type PanelProps = ThemedClassName<PropsWithChildren<{}>>;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Scaled markdown
|
|
14
|
+
* Scaled markdown panel.
|
|
15
15
|
*/
|
|
16
|
-
export const
|
|
16
|
+
export const Panel = ({ children, classNames }: PanelProps) => {
|
|
17
17
|
const [props, setProps] = useState({});
|
|
18
18
|
const {
|
|
19
19
|
ref: containerRef,
|
|
@@ -35,8 +35,8 @@ export const Container = ({ children, classNames }: ContainerProps) => {
|
|
|
35
35
|
// TODO(burdon): Reconcile highlight colors with markdown editor.
|
|
36
36
|
// https://www.npmjs.com/package/react-markdown
|
|
37
37
|
return (
|
|
38
|
-
<div ref={containerRef} className={mx('flex grow relative overflow-hidden bg-attention', classNames)}>
|
|
39
|
-
<div className={mx('flex
|
|
38
|
+
<div ref={containerRef} className={mx('flex grow relative overflow-hidden bg-attention-surface', classNames)}>
|
|
39
|
+
<div className={mx('flex w-full h-full overflow-hidden absolute')} style={props}>
|
|
40
40
|
{width && height && children}
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
|
|
7
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
7
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
8
|
|
|
9
9
|
import { createSlide } from '../../testing';
|
|
10
10
|
|
|
11
11
|
import { Slide } from './Slide';
|
|
12
12
|
|
|
13
13
|
const meta = {
|
|
14
|
-
title: 'plugins/plugin-presenter/Slide',
|
|
14
|
+
title: 'plugins/plugin-presenter/components/Slide',
|
|
15
15
|
component: Slide,
|
|
16
|
-
decorators: [withTheme],
|
|
16
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
17
17
|
parameters: {
|
|
18
18
|
layout: 'fullscreen',
|
|
19
19
|
},
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
// TODO(burdon): Create theme type and picker.
|
|
6
6
|
|
|
7
7
|
export const theme = {
|
|
8
|
-
root: 'bg-attention leading-relaxed font-mono',
|
|
8
|
+
root: 'bg-attention-surface leading-relaxed font-mono',
|
|
9
9
|
|
|
10
|
-
padding: '
|
|
10
|
+
padding: 'px-40 py-16 gap-8',
|
|
11
11
|
|
|
12
12
|
nodes: {
|
|
13
|
-
h1: 'text-[80px] text-
|
|
14
|
-
h2: 'text-[60px] text-
|
|
15
|
-
h3: 'text-[48px] text-
|
|
13
|
+
h1: 'text-[80px] text-accent-text',
|
|
14
|
+
h2: 'text-[60px] text-accent-text',
|
|
15
|
+
h3: 'text-[48px] text-accent-text',
|
|
16
16
|
|
|
17
17
|
p: 'text-[48px]',
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ export const theme = {
|
|
|
20
20
|
ol: 'my-[16px] ml-24 leading-relaxed list-decimal',
|
|
21
21
|
li: 'pl-6 text-[48px]',
|
|
22
22
|
|
|
23
|
-
pre: '
|
|
23
|
+
pre: 'w-full mx-0 my-[32px] p-4 bg-input-surface',
|
|
24
24
|
code: 'p-0 text-[40px]',
|
|
25
25
|
},
|
|
26
26
|
};
|
|
@@ -19,7 +19,7 @@ export type LayoutProps = ThemedClassName<
|
|
|
19
19
|
|
|
20
20
|
export const Layout = ({ children, classNames, topLeft, topRight, bottomLeft, bottomRight }: LayoutProps) => {
|
|
21
21
|
return (
|
|
22
|
-
<div className={mx('flex grow relative overflow-hidden bg-attention', classNames)}>
|
|
22
|
+
<div className={mx('flex grow relative overflow-hidden bg-attention-surface', classNames)}>
|
|
23
23
|
<div className={mx('flex flex-col grow overflow-hidden')}>{children}</div>
|
|
24
24
|
|
|
25
25
|
<div className='z-[200]'>
|
|
@@ -23,9 +23,9 @@ const DefaultStory = ({ count = 20 }: PagerProps) => {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const meta = {
|
|
26
|
-
title: 'plugins/plugin-presenter/Pager',
|
|
26
|
+
title: 'plugins/plugin-presenter/components/Pager',
|
|
27
27
|
render: DefaultStory,
|
|
28
|
-
decorators: [withTheme],
|
|
28
|
+
decorators: [withTheme()],
|
|
29
29
|
parameters: {
|
|
30
30
|
layout: 'centered',
|
|
31
31
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Meta } from '@storybook/react-vite';
|
|
6
6
|
|
|
7
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
7
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
8
|
|
|
9
9
|
import CONTENT from '../../../testing/deck.md?raw';
|
|
10
10
|
import { translations } from '../../translations';
|
|
@@ -20,9 +20,9 @@ import { RevealPlayer } from './RevealPlayer';
|
|
|
20
20
|
// https://fonts.google.com
|
|
21
21
|
|
|
22
22
|
const meta = {
|
|
23
|
-
title: 'plugins/plugin-presenter/RevealPlayer',
|
|
23
|
+
title: 'plugins/plugin-presenter/components/RevealPlayer',
|
|
24
24
|
component: RevealPlayer,
|
|
25
|
-
decorators: [withTheme],
|
|
25
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
26
26
|
parameters: {
|
|
27
27
|
layout: 'fullscreen',
|
|
28
28
|
translations,
|
|
@@ -149,12 +149,12 @@ export const RevealPlayer = ({ classNames, content, slide, fullscreen = true, on
|
|
|
149
149
|
return (
|
|
150
150
|
<div
|
|
151
151
|
className={mx(
|
|
152
|
-
'grid place-items-center
|
|
152
|
+
'grid place-items-center w-full h-full overflow-hidden bg-black',
|
|
153
153
|
fullscreen && 'absolute inset-0',
|
|
154
154
|
classNames,
|
|
155
155
|
)}
|
|
156
156
|
>
|
|
157
|
-
<div className='relative aspect-video
|
|
157
|
+
<div className='relative aspect-video w-full h-full h-auto max-h-full overflow-hidden'>
|
|
158
158
|
<div ref={deckDivRef} className='absolute inset-0 reveal'>
|
|
159
159
|
{/* NOTE: Must be in head. */}
|
|
160
160
|
<style>
|
|
@@ -166,7 +166,7 @@ export const RevealPlayer = ({ classNames, content, slide, fullscreen = true, on
|
|
|
166
166
|
/>
|
|
167
167
|
</style>
|
|
168
168
|
<div className='slides'>
|
|
169
|
-
<div className='
|
|
169
|
+
<div className='text-center!' />
|
|
170
170
|
<section {...{ 'data-markdown': [] }}>
|
|
171
171
|
<textarea {...{ 'data-template': true }} defaultValue={[styles, content].join('\n')}></textarea>
|
|
172
172
|
</section>
|
package/src/components/index.ts
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export * from './
|
|
8
|
-
|
|
9
|
-
export const MarkdownSlide = lazy(() => import('./MarkdownSlide'));
|
|
10
|
-
export const DocumentPresenterContainer = lazy(() => import('./DocumentPresenterContainer'));
|
|
11
|
-
export const CollectionPresenterContainer = lazy(() => import('./CollectionPresenterContainer'));
|
|
5
|
+
export * from './Markdown';
|
|
6
|
+
export * from './Presenter';
|
|
7
|
+
export * from './RevealPlayer';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useContext, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
9
|
+
import { type Collection } from '@dxos/echo';
|
|
10
|
+
import { Panel } from '@dxos/react-ui';
|
|
11
|
+
|
|
12
|
+
import { PageNumber, Pager, Layout as PresenterLayout } from '../../components';
|
|
13
|
+
import { PresenterContext } from '../../types';
|
|
14
|
+
import { useExitPresenter } from '../../useExitPresenter';
|
|
15
|
+
|
|
16
|
+
type CollectionPresenterContainerProps = SurfaceComponentProps<Collection.Collection>;
|
|
17
|
+
|
|
18
|
+
export const CollectionPresenterContainer = ({ role, subject: collection }: CollectionPresenterContainerProps) => {
|
|
19
|
+
const [slide, setSlide] = useState(0);
|
|
20
|
+
const { running } = useContext(PresenterContext);
|
|
21
|
+
const handleExit = useExitPresenter(collection);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Panel.Root role={role} classNames='relative'>
|
|
25
|
+
<Panel.Content asChild>
|
|
26
|
+
<PresenterLayout
|
|
27
|
+
bottomRight={<PageNumber index={slide} count={collection.objects.length} />}
|
|
28
|
+
bottomLeft={
|
|
29
|
+
<Pager
|
|
30
|
+
index={slide}
|
|
31
|
+
count={collection.objects.length}
|
|
32
|
+
keys={running}
|
|
33
|
+
onChange={setSlide}
|
|
34
|
+
onExit={handleExit}
|
|
35
|
+
/>
|
|
36
|
+
}
|
|
37
|
+
>
|
|
38
|
+
<Surface.Surface role='slide' data={{ subject: collection.objects[slide] }} />
|
|
39
|
+
</PresenterLayout>
|
|
40
|
+
</Panel.Content>
|
|
41
|
+
</Panel.Root>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type FC } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Markdown } from '@dxos/plugin-markdown/types';
|
|
8
|
+
import { Panel } from '@dxos/react-ui';
|
|
9
|
+
|
|
10
|
+
import { RevealPlayer } from '../../components';
|
|
11
|
+
import { useExitPresenter } from '../../useExitPresenter';
|
|
12
|
+
|
|
13
|
+
export const DocumentPresenterContainer: FC<{ document: Markdown.Document }> = ({ document }) => {
|
|
14
|
+
const handleExit = useExitPresenter(document);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Panel.Root classNames='relative'>
|
|
18
|
+
<Panel.Content asChild>
|
|
19
|
+
<RevealPlayer content={document.content.target?.content ?? ''} onExit={handleExit} />
|
|
20
|
+
</Panel.Content>
|
|
21
|
+
</Panel.Root>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -6,23 +6,21 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { type Markdown } from '@dxos/plugin-markdown/types';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { Panel, Slide } from '../../components';
|
|
10
10
|
|
|
11
11
|
type MarkdownSlideProps = {
|
|
12
12
|
document: Markdown.Document;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const MarkdownSlide = ({ document }: MarkdownSlideProps) => {
|
|
15
|
+
export const MarkdownSlide = ({ document }: MarkdownSlideProps) => {
|
|
16
16
|
const content = document.content.target?.content;
|
|
17
17
|
if (!content) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<
|
|
22
|
+
<Panel>
|
|
23
23
|
<Slide content={content} />
|
|
24
|
-
</
|
|
24
|
+
</Panel>
|
|
25
25
|
);
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
export default MarkdownSlide;
|