@dxos/plugin-presenter 0.8.4-main.67995b8 → 0.8.4-main.ae835ea

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.
Files changed (87) hide show
  1. package/dist/lib/browser/{CollectionPresenterContainer-IPDW4HZR.mjs → CollectionPresenterContainer-ASH2TGJR.mjs} +7 -7
  2. package/dist/lib/browser/CollectionPresenterContainer-ASH2TGJR.mjs.map +7 -0
  3. package/dist/lib/browser/{DocumentPresenterContainer-LJBJM5UB.mjs → DocumentPresenterContainer-F42V4KAL.mjs} +48 -50
  4. package/dist/lib/browser/DocumentPresenterContainer-F42V4KAL.mjs.map +7 -0
  5. package/dist/lib/browser/{MarkdownSlide-KG7ESCSU.mjs → MarkdownSlide-BLVWTH3U.mjs} +15 -128
  6. package/dist/lib/browser/MarkdownSlide-BLVWTH3U.mjs.map +7 -0
  7. package/dist/lib/browser/{app-graph-builder-LURIPUEV.mjs → app-graph-builder-UGCZOBA6.mjs} +41 -12
  8. package/dist/lib/browser/app-graph-builder-UGCZOBA6.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-W4IR3DJE.mjs → chunk-EOT6RIHJ.mjs} +5 -5
  10. package/dist/lib/browser/chunk-EOT6RIHJ.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-TMTUZQCK.mjs +18 -0
  12. package/dist/lib/browser/chunk-TMTUZQCK.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-TANLITL2.mjs → chunk-UVGTHJUO.mjs} +2 -2
  14. package/dist/lib/browser/{chunk-TANLITL2.mjs.map → chunk-UVGTHJUO.mjs.map} +2 -2
  15. package/dist/lib/browser/{chunk-QWJM3ADC.mjs → chunk-WWKBVJB3.mjs} +15 -11
  16. package/dist/lib/browser/chunk-WWKBVJB3.mjs.map +7 -0
  17. package/dist/lib/browser/index.mjs +8 -9
  18. package/dist/lib/browser/index.mjs.map +3 -3
  19. package/dist/lib/browser/meta.json +1 -1
  20. package/dist/lib/browser/{react-surface-3SPF2ANF.mjs → react-surface-UIAHN2NJ.mjs} +15 -15
  21. package/dist/lib/browser/react-surface-UIAHN2NJ.mjs.map +7 -0
  22. package/dist/lib/browser/{settings-VBRYUIWN.mjs → settings-RZWQTJI2.mjs} +5 -5
  23. package/dist/lib/browser/{settings-VBRYUIWN.mjs.map → settings-RZWQTJI2.mjs.map} +2 -2
  24. package/dist/types/src/PresenterPlugin.d.ts +1 -1
  25. package/dist/types/src/PresenterPlugin.d.ts.map +1 -1
  26. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  27. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  28. package/dist/types/src/capabilities/index.d.ts +3 -3
  29. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  30. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  31. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  32. package/dist/types/src/capabilities/settings.d.ts +1 -1
  33. package/dist/types/src/components/CollectionPresenterContainer.d.ts.map +1 -1
  34. package/dist/types/src/components/DocumentPresenterContainer.d.ts.map +1 -1
  35. package/dist/types/src/components/Markdown/Container.stories.d.ts +14 -22
  36. package/dist/types/src/components/Markdown/Container.stories.d.ts.map +1 -1
  37. package/dist/types/src/components/Markdown/Slide.d.ts +1 -3
  38. package/dist/types/src/components/Markdown/Slide.d.ts.map +1 -1
  39. package/dist/types/src/components/Markdown/Slide.stories.d.ts +11 -12
  40. package/dist/types/src/components/Markdown/Slide.stories.d.ts.map +1 -1
  41. package/dist/types/src/components/Presenter/Pager.d.ts +1 -1
  42. package/dist/types/src/components/Presenter/Pager.d.ts.map +1 -1
  43. package/dist/types/src/components/Presenter/Pager.stories.d.ts +12 -4
  44. package/dist/types/src/components/Presenter/Pager.stories.d.ts.map +1 -1
  45. package/dist/types/src/components/PresenterSettings.d.ts.map +1 -1
  46. package/dist/types/src/components/RevealPlayer/RevealPlayer.d.ts.map +1 -1
  47. package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts +18 -2
  48. package/dist/types/src/components/RevealPlayer/RevealPlayer.stories.d.ts.map +1 -1
  49. package/dist/types/src/components/index.d.ts +20 -3
  50. package/dist/types/src/components/index.d.ts.map +1 -1
  51. package/dist/types/src/meta.d.ts +0 -1
  52. package/dist/types/src/meta.d.ts.map +1 -1
  53. package/dist/types/src/translations.d.ts +1 -0
  54. package/dist/types/src/translations.d.ts.map +1 -1
  55. package/dist/types/src/types.d.ts +7 -6
  56. package/dist/types/src/types.d.ts.map +1 -1
  57. package/dist/types/tsconfig.tsbuildinfo +1 -1
  58. package/package.json +37 -37
  59. package/src/PresenterPlugin.tsx +23 -24
  60. package/src/capabilities/app-graph-builder.ts +40 -9
  61. package/src/capabilities/react-surface.tsx +24 -14
  62. package/src/capabilities/settings.ts +1 -1
  63. package/src/components/CollectionPresenterContainer.tsx +2 -1
  64. package/src/components/DocumentPresenterContainer.tsx +2 -1
  65. package/src/components/Markdown/Container.stories.tsx +21 -20
  66. package/src/components/Markdown/Slide.stories.tsx +11 -7
  67. package/src/components/Markdown/Slide.tsx +12 -128
  68. package/src/components/Markdown/styles.css +104 -0
  69. package/src/components/Markdown/typings.d.ts +8 -0
  70. package/src/components/Presenter/Pager.stories.tsx +8 -8
  71. package/src/components/Presenter/Pager.tsx +3 -3
  72. package/src/components/PresenterSettings.tsx +15 -11
  73. package/src/components/RevealPlayer/RevealPlayer.stories.tsx +7 -5
  74. package/src/components/RevealPlayer/RevealPlayer.tsx +50 -53
  75. package/src/meta.ts +7 -4
  76. package/src/translations.ts +1 -0
  77. package/src/types.ts +3 -3
  78. package/src/useExitPresenter.ts +1 -1
  79. package/dist/lib/browser/CollectionPresenterContainer-IPDW4HZR.mjs.map +0 -7
  80. package/dist/lib/browser/DocumentPresenterContainer-LJBJM5UB.mjs.map +0 -7
  81. package/dist/lib/browser/MarkdownSlide-KG7ESCSU.mjs.map +0 -7
  82. package/dist/lib/browser/app-graph-builder-LURIPUEV.mjs.map +0 -7
  83. package/dist/lib/browser/chunk-QWJM3ADC.mjs.map +0 -7
  84. package/dist/lib/browser/chunk-VSD5LSE5.mjs +0 -15
  85. package/dist/lib/browser/chunk-VSD5LSE5.mjs.map +0 -7
  86. package/dist/lib/browser/chunk-W4IR3DJE.mjs.map +0 -7
  87. 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.67995b8",
3
+ "version": "0.8.4-main.ae835ea",
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",
@@ -25,57 +25,57 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@preact-signals/safe-react": "^0.9.0",
28
- "@preact/signals-core": "^1.9.0",
28
+ "@preact/signals-core": "^1.12.1",
29
29
  "hastscript": "^7.1.0",
30
30
  "highlight.js": "^11.9.0",
31
31
  "marked": "^12.0.2",
32
- "react-markdown": "^8.0.5",
32
+ "react-markdown": "^10.1.0",
33
33
  "react-resize-detector": "^11.0.1",
34
34
  "rehype-add-classes": "^1.0.0",
35
35
  "rehype-highlight": "^6.0.0",
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.67995b8",
40
- "@dxos/async": "0.8.4-main.67995b8",
41
- "@dxos/echo": "0.8.4-main.67995b8",
42
- "@dxos/local-storage": "0.8.4-main.67995b8",
43
- "@dxos/echo-schema": "0.8.4-main.67995b8",
44
- "@dxos/log": "0.8.4-main.67995b8",
45
- "@dxos/plugin-client": "0.8.4-main.67995b8",
46
- "@dxos/plugin-deck": "0.8.4-main.67995b8",
47
- "@dxos/plugin-graph": "0.8.4-main.67995b8",
48
- "@dxos/plugin-markdown": "0.8.4-main.67995b8",
49
- "@dxos/live-object": "0.8.4-main.67995b8",
50
- "@dxos/plugin-stack": "0.8.4-main.67995b8",
51
- "@dxos/react-client": "0.8.4-main.67995b8",
52
- "@dxos/react-ui-stack": "0.8.4-main.67995b8",
53
- "@dxos/schema": "0.8.4-main.67995b8",
54
- "@dxos/react-ui-form": "0.8.4-main.67995b8"
39
+ "@dxos/app-framework": "0.8.4-main.ae835ea",
40
+ "@dxos/async": "0.8.4-main.ae835ea",
41
+ "@dxos/live-object": "0.8.4-main.ae835ea",
42
+ "@dxos/local-storage": "0.8.4-main.ae835ea",
43
+ "@dxos/log": "0.8.4-main.ae835ea",
44
+ "@dxos/echo": "0.8.4-main.ae835ea",
45
+ "@dxos/plugin-client": "0.8.4-main.ae835ea",
46
+ "@dxos/plugin-deck": "0.8.4-main.ae835ea",
47
+ "@dxos/plugin-markdown": "0.8.4-main.ae835ea",
48
+ "@dxos/plugin-stack": "0.8.4-main.ae835ea",
49
+ "@dxos/react-client": "0.8.4-main.ae835ea",
50
+ "@dxos/react-ui-form": "0.8.4-main.ae835ea",
51
+ "@dxos/plugin-graph": "0.8.4-main.ae835ea",
52
+ "@dxos/react-ui-stack": "0.8.4-main.ae835ea",
53
+ "@dxos/util": "0.8.4-main.ae835ea",
54
+ "@dxos/schema": "0.8.4-main.ae835ea"
55
55
  },
56
56
  "devDependencies": {
57
- "@effect-rx/rx-react": "0.38.0",
58
- "@effect/platform": "0.89.0",
59
- "@types/react": "~18.2.0",
60
- "@types/react-dom": "~18.2.0",
57
+ "@effect-rx/rx-react": "0.42.4",
58
+ "@effect/platform": "0.92.1",
59
+ "@types/react": "~19.2.2",
60
+ "@types/react-dom": "~19.2.2",
61
61
  "@types/reveal.js": "^5.0.3",
62
- "effect": "3.17.0",
63
- "react": "~18.2.0",
64
- "react-dom": "~18.2.0",
65
- "vite": "5.4.7",
66
- "@dxos/random": "0.8.4-main.67995b8",
67
- "@dxos/react-ui": "0.8.4-main.67995b8",
68
- "@dxos/react-ui-theme": "0.8.4-main.67995b8",
69
- "@dxos/storybook-utils": "0.8.4-main.67995b8"
62
+ "effect": "3.18.3",
63
+ "react": "~19.2.0",
64
+ "react-dom": "~19.2.0",
65
+ "vite": "7.1.9",
66
+ "@dxos/react-ui": "0.8.4-main.ae835ea",
67
+ "@dxos/random": "0.8.4-main.ae835ea",
68
+ "@dxos/storybook-utils": "0.8.4-main.ae835ea",
69
+ "@dxos/react-ui-theme": "0.8.4-main.ae835ea"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@effect-rx/rx-react": "^0.34.1",
73
73
  "@effect/platform": "^0.80.12",
74
74
  "effect": "^3.13.3",
75
- "react": "~18.2.0",
76
- "react-dom": "~18.2.0",
77
- "@dxos/react-ui": "0.8.4-main.67995b8",
78
- "@dxos/react-ui-theme": "0.8.4-main.67995b8"
75
+ "react": "^19.0.0",
76
+ "react-dom": "^19.0.0",
77
+ "@dxos/react-ui": "0.8.4-main.ae835ea",
78
+ "@dxos/react-ui-theme": "0.8.4-main.ae835ea"
79
79
  },
80
80
  "publishConfig": {
81
81
  "access": "public"
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { definePlugin, defineModule, Events, contributes, Capabilities } from '@dxos/app-framework';
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';
@@ -11,26 +11,25 @@ import { translations } from './translations';
11
11
  // TODO(burdon): Only scale markdown content.
12
12
  // TODO(burdon): Map stack content; Slide content type (e.g., markdown, sketch, IPFS image, table, etc.)
13
13
 
14
- export const PresenterPlugin = () =>
15
- definePlugin(meta, [
16
- defineModule({
17
- id: `${meta.id}/module/settings`,
18
- activatesOn: Events.SetupSettings,
19
- activate: PresenterSettings,
20
- }),
21
- defineModule({
22
- id: `${meta.id}/module/translations`,
23
- activatesOn: Events.SetupTranslations,
24
- activate: () => contributes(Capabilities.Translations, translations),
25
- }),
26
- defineModule({
27
- id: `${meta.id}/module/react-surface`,
28
- activatesOn: Events.SetupReactSurface,
29
- activate: ReactSurface,
30
- }),
31
- defineModule({
32
- id: `${meta.id}/module/app-graph-builder`,
33
- activatesOn: Events.SetupAppGraph,
34
- activate: AppGraphBuilder,
35
- }),
36
- ]);
14
+ export const PresenterPlugin = definePlugin(meta, () => [
15
+ defineModule({
16
+ id: `${meta.id}/module/settings`,
17
+ activatesOn: Events.SetupSettings,
18
+ activate: PresenterSettings,
19
+ }),
20
+ defineModule({
21
+ id: `${meta.id}/module/translations`,
22
+ activatesOn: Events.SetupTranslations,
23
+ activate: () => contributes(Capabilities.Translations, translations),
24
+ }),
25
+ defineModule({
26
+ id: `${meta.id}/module/react-surface`,
27
+ activatesOn: Events.SetupReactSurface,
28
+ activate: ReactSurface,
29
+ }),
30
+ defineModule({
31
+ id: `${meta.id}/module/app-graph-builder`,
32
+ activatesOn: Events.SetupAppGraph,
33
+ activate: AppGraphBuilder,
34
+ }),
35
+ ]);
@@ -3,9 +3,10 @@
3
3
  //
4
4
 
5
5
  import { Rx } from '@effect-rx/rx-react';
6
- import { Option, pipe } from 'effect';
6
+ import * as Function from 'effect/Function';
7
+ import * as Option from 'effect/Option';
7
8
 
8
- import { contributes, type PluginContext, Capabilities, createIntent, LayoutAction } from '@dxos/app-framework';
9
+ import { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
9
10
  import { Obj } from '@dxos/echo';
10
11
  import { DeckCapabilities } from '@dxos/plugin-deck';
11
12
  import { ATTENDABLE_PATH_SEPARATOR, DeckAction } from '@dxos/plugin-deck/types';
@@ -14,23 +15,52 @@ import { Markdown } from '@dxos/plugin-markdown/types';
14
15
  import { fullyQualifiedId, getSpace } from '@dxos/react-client/echo';
15
16
  import { DataType } from '@dxos/schema';
16
17
 
17
- import { PRESENTER_PLUGIN } from '../meta';
18
+ import { meta } from '../meta';
18
19
  import { PresenterAction, type PresenterSettingsProps } from '../types';
19
20
 
20
21
  export default (context: PluginContext) =>
21
22
  contributes(
22
23
  Capabilities.AppGraphBuilder,
23
24
  createExtension({
24
- id: PRESENTER_PLUGIN,
25
+ id: `${meta.id}/root`,
26
+ // TODO(wittjosiah): This is a hack to work around presenter previously relying on "variant". Remove.
27
+ connector: (node) =>
28
+ Rx.make((get) =>
29
+ Function.pipe(
30
+ get(node),
31
+ Option.flatMap((node) => {
32
+ const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));
33
+ const settings = get(rxFromSignal(() => settingsStore?.getStore<PresenterSettingsProps>(meta.id)?.value));
34
+ const isPresentable = settings?.presentCollections
35
+ ? Obj.instanceOf(DataType.Collection, node.data) || Obj.instanceOf(Markdown.Document, node.data)
36
+ : Obj.instanceOf(Markdown.Document, node.data);
37
+ return isPresentable ? Option.some(node.data) : Option.none();
38
+ }),
39
+ Option.map((object) => {
40
+ const id = fullyQualifiedId(object);
41
+ return [
42
+ {
43
+ id: [id, 'presenter'].join(ATTENDABLE_PATH_SEPARATOR),
44
+ data: { type: meta.id, object },
45
+ type: meta.id,
46
+ properties: {
47
+ label: 'Presenter',
48
+ icon: 'ph--presentation--regular',
49
+ disposition: 'hidden',
50
+ },
51
+ },
52
+ ];
53
+ }),
54
+ Option.getOrElse(() => []),
55
+ ),
56
+ ),
25
57
  actions: (node) =>
26
58
  Rx.make((get) =>
27
- pipe(
59
+ Function.pipe(
28
60
  get(node),
29
61
  Option.flatMap((node) => {
30
62
  const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));
31
- const settings = get(
32
- rxFromSignal(() => settingsStore?.getStore<PresenterSettingsProps>(PRESENTER_PLUGIN)?.value),
33
- );
63
+ const settings = get(rxFromSignal(() => settingsStore?.getStore<PresenterSettingsProps>(meta.id)?.value));
34
64
  const isPresentable = settings?.presentCollections
35
65
  ? Obj.instanceOf(DataType.Collection, node.data) || Obj.instanceOf(Markdown.Document, node.data)
36
66
  : Obj.instanceOf(Markdown.Document, node.data);
@@ -65,8 +95,9 @@ export default (context: PluginContext) =>
65
95
  );
66
96
  },
67
97
  properties: {
68
- label: ['toggle presentation label', { ns: PRESENTER_PLUGIN }],
98
+ label: ['toggle presentation label', { ns: meta.id }],
69
99
  icon: 'ph--presentation--regular',
100
+ disposition: 'list-item',
70
101
  keyBinding: {
71
102
  macos: 'shift+meta+p',
72
103
  windows: 'shift+alt+p',
@@ -11,43 +11,53 @@ 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
- import { PRESENTER_PLUGIN } from '../meta';
19
+ import { meta } from '../meta';
20
20
  import { type PresenterSettingsProps } from '../types';
21
21
 
22
22
  export default () =>
23
23
  contributes(Capabilities.ReactSurface, [
24
24
  createSurface({
25
- id: `${PRESENTER_PLUGIN}/document`,
25
+ id: `${meta.id}/document`,
26
26
  role: 'article',
27
27
  position: 'hoist',
28
- filter: (data): data is { subject: Markdown.Document; variant: 'presenter' } =>
29
- Obj.instanceOf(Markdown.Document, data.subject) && data.variant === 'presenter',
30
- component: ({ data }) => <DocumentPresenterContainer document={data.subject} />,
28
+ filter: (data): data is { subject: { type: typeof meta.id; 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 === meta.id &&
34
+ Obj.instanceOf(Markdown.Document, data.subject.object),
35
+ component: ({ data }) => <DocumentPresenterContainer document={data.subject.object} />,
31
36
  }),
32
37
  createSurface({
33
- id: `${PRESENTER_PLUGIN}/collection`,
38
+ id: `${meta.id}/collection`,
34
39
  role: 'article',
35
40
  position: 'hoist',
36
- filter: (data): data is { subject: DataType.Collection; variant: 'presenter' } =>
37
- Obj.instanceOf(DataType.Collection, data.subject) && data.variant === 'presenter',
38
- component: ({ data }) => <CollectionPresenterContainer collection={data.subject} />,
41
+ filter: (data): data is { subject: { type: typeof meta.id; 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 === meta.id &&
47
+ Obj.instanceOf(DataType.Collection, data.subject.object),
48
+ component: ({ data }) => <CollectionPresenterContainer collection={data.subject.object} />,
39
49
  }),
40
50
  createSurface({
41
- id: `${PRESENTER_PLUGIN}/slide`,
51
+ id: `${meta.id}/slide`,
42
52
  role: 'slide',
43
53
  filter: (data): data is { subject: Markdown.Document } => Obj.instanceOf(Markdown.Document, data.subject),
44
54
  component: ({ data }) => <MarkdownSlide document={data.subject} />,
45
55
  }),
46
56
  createSurface({
47
- id: `${PRESENTER_PLUGIN}/plugin-settings`,
57
+ id: `${meta.id}/plugin-settings`,
48
58
  role: 'article',
49
59
  filter: (data): data is { subject: SettingsStore<PresenterSettingsProps> } =>
50
- data.subject instanceof SettingsStore && data.subject.prefix === PRESENTER_PLUGIN,
60
+ data.subject instanceof SettingsStore && data.subject.prefix === meta.id,
51
61
  component: ({ data: { subject } }) => <PresenterSettings settings={subject.value} />,
52
62
  }),
53
63
  ]);
@@ -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 { PresenterSettingsSchema, type PresenterSettingsProps } from '../types';
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
 
@@ -2,16 +2,15 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
- import { type Meta } from '@storybook/react-vite';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React from 'react';
9
7
 
10
- import { withLayout, withTheme } from '@dxos/storybook-utils';
8
+ import { withTheme } from '@dxos/react-ui/testing';
9
+
10
+ import { createSlide } from '../../testing';
11
11
 
12
12
  import { Container } from './Container';
13
13
  import { Slide, type SlideProps } from './Slide';
14
- import { createSlide } from '../../testing';
15
14
 
16
15
  const DefaultStory = ({ content = '' }: SlideProps) => {
17
16
  return (
@@ -21,37 +20,39 @@ const DefaultStory = ({ content = '' }: SlideProps) => {
21
20
  );
22
21
  };
23
22
 
24
- export const Default = {
23
+ const meta = {
24
+ title: 'plugins/plugin-presenter/Container',
25
+ render: DefaultStory,
26
+ decorators: [withTheme],
27
+ parameters: {
28
+ layout: 'fullscreen',
29
+ },
30
+ } satisfies Meta<typeof DefaultStory>;
31
+
32
+ export default meta;
33
+
34
+ type Story = StoryObj<typeof meta>;
35
+
36
+ export const Default: Story = {
25
37
  args: {
26
38
  content: createSlide({ number: 1 }),
27
39
  },
28
40
  };
29
41
 
30
- export const Code = {
42
+ export const Code: Story = {
31
43
  args: {
32
44
  content: createSlide({ code: true }),
33
45
  },
34
46
  };
35
47
 
36
- export const List = {
48
+ export const List: Story = {
37
49
  args: {
38
50
  content: createSlide({ list: 3 }),
39
51
  },
40
52
  };
41
53
 
42
- export const Ordered = {
54
+ export const Ordered: Story = {
43
55
  args: {
44
56
  content: createSlide({ ordered: 4 }),
45
57
  },
46
58
  };
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;
@@ -2,30 +2,34 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
 
7
- import { type Meta } from '@storybook/react-vite';
7
+ import { withTheme } from '@dxos/react-ui/testing';
8
8
 
9
- import { Slide } from './Slide';
10
9
  import { createSlide } from '../../testing';
11
10
 
12
- const meta: Meta = {
11
+ import { Slide } from './Slide';
12
+
13
+ const meta = {
13
14
  title: 'plugins/plugin-presenter/Slide',
14
15
  component: Slide,
16
+ decorators: [withTheme],
15
17
  parameters: {
16
18
  layout: 'fullscreen',
17
19
  },
18
- };
20
+ } satisfies Meta<typeof Slide>;
19
21
 
20
22
  export default meta;
21
23
 
22
- export const Default = {
24
+ type Story = StoryObj<typeof meta>;
25
+
26
+ export const Default: Story = {
23
27
  args: {
24
28
  content: createSlide(),
25
29
  },
26
30
  };
27
31
 
28
- export const Code = {
32
+ export const Code: Story = {
29
33
  args: {
30
34
  content: createSlide({ code: true }),
31
35
  },
@@ -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 addClasses from 'rehype-add-classes';
9
- import highlight from 'rehype-highlight';
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?: { [selector: string]: string };
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={[highlight, [addClasses, classes], slideLayout]}
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
- (options = {}) =>
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 = { img: ImageWrapper };
100
+ const components: ReactMarkdownOptions['components'] = {
101
+ img: ({ node, ...props }) => <ImageWrapper node={node} {...props} />,
102
+ };