@slidev-react/client 0.2.5
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/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/README.md +16 -0
- package/package.json +44 -0
- package/src/addons/AddonProvider.tsx +25 -0
- package/src/addons/g2/G2Chart.tsx +370 -0
- package/src/addons/g2/chartPresets.ts +43 -0
- package/src/addons/g2/chartThemeTokens.ts +124 -0
- package/src/addons/g2/index.ts +36 -0
- package/src/addons/g2/style.css +31 -0
- package/src/addons/insight/Insight.tsx +10 -0
- package/src/addons/insight/InsightAddonProvider.tsx +20 -0
- package/src/addons/insight/SpotlightLayout.tsx +11 -0
- package/src/addons/insight/index.ts +17 -0
- package/src/addons/insight/style.css +34 -0
- package/src/addons/mermaid/MermaidDiagram.tsx +379 -0
- package/src/addons/mermaid/index.ts +10 -0
- package/src/addons/registry.test.ts +28 -0
- package/src/addons/registry.ts +61 -0
- package/src/addons/types.ts +6 -0
- package/src/app/App.tsx +125 -0
- package/src/app/README.md +18 -0
- package/src/app/providers/SlidesNavigationProvider.tsx +82 -0
- package/src/app/usePresentationBootstrap.ts +85 -0
- package/src/features/presentation/PresentationStatus.tsx +514 -0
- package/src/features/presentation/PrintSlidesView.tsx +350 -0
- package/src/features/presentation/browser.ts +5 -0
- package/src/features/presentation/draw/DrawOverlay.tsx +170 -0
- package/src/features/presentation/draw/DrawProvider.tsx +394 -0
- package/src/features/presentation/draw/persistence.test.ts +80 -0
- package/src/features/presentation/draw/persistence.ts +54 -0
- package/src/features/presentation/exportArtifacts.test.ts +48 -0
- package/src/features/presentation/exportArtifacts.ts +6 -0
- package/src/features/presentation/location.test.ts +73 -0
- package/src/features/presentation/location.ts +113 -0
- package/src/features/presentation/navigation/KeyboardController.tsx +73 -0
- package/src/features/presentation/navigation/PresentationNavbar.tsx +162 -0
- package/src/features/presentation/navigation/ShortcutsHelpOverlay.test.tsx +24 -0
- package/src/features/presentation/navigation/ShortcutsHelpOverlay.tsx +111 -0
- package/src/features/presentation/navigation/keyboardShortcuts.test.ts +74 -0
- package/src/features/presentation/navigation/keyboardShortcuts.ts +221 -0
- package/src/features/presentation/navigation/useSlidesNavigation.ts +15 -0
- package/src/features/presentation/overview/NotesOverview.tsx +200 -0
- package/src/features/presentation/overview/QuickOverview.tsx +126 -0
- package/src/features/presentation/path.ts +137 -0
- package/src/features/presentation/presenter/FlowTimelinePreview.test.tsx +54 -0
- package/src/features/presentation/presenter/FlowTimelinePreview.tsx +274 -0
- package/src/features/presentation/presenter/PresenterModeView.tsx +93 -0
- package/src/features/presentation/presenter/PresenterShell.tsx +286 -0
- package/src/features/presentation/presenter/PresenterSidePreview.tsx +68 -0
- package/src/features/presentation/presenter/PresenterTopProgress.tsx +28 -0
- package/src/features/presentation/presenter/SpeakerNotesPanel.tsx +51 -0
- package/src/features/presentation/presenter/StandaloneModeView.tsx +36 -0
- package/src/features/presentation/presenter/persistence.test.ts +26 -0
- package/src/features/presentation/presenter/persistence.ts +31 -0
- package/src/features/presentation/presenter/presentationSyncBridge.test.ts +87 -0
- package/src/features/presentation/presenter/presentationSyncBridge.ts +82 -0
- package/src/features/presentation/presenter/stage.ts +15 -0
- package/src/features/presentation/presenter/types.ts +30 -0
- package/src/features/presentation/presenter/useFullscreen.ts +58 -0
- package/src/features/presentation/presenter/useIdleCursor.ts +37 -0
- package/src/features/presentation/presenter/usePresentationFlowRuntime.ts +238 -0
- package/src/features/presentation/presenter/usePresenterChromeRuntime.ts +358 -0
- package/src/features/presentation/presenter/usePresenterSessionState.ts +226 -0
- package/src/features/presentation/presenter/useWakeLock.ts +110 -0
- package/src/features/presentation/recordingFilename.test.ts +46 -0
- package/src/features/presentation/recordingFilename.ts +56 -0
- package/src/features/presentation/reveal/Reveal.tsx +119 -0
- package/src/features/presentation/reveal/RevealContext.tsx +29 -0
- package/src/features/presentation/reveal/useRevealStep.ts +35 -0
- package/src/features/presentation/session.test.ts +122 -0
- package/src/features/presentation/session.ts +124 -0
- package/src/features/presentation/stage/SlidePreviewSurface.tsx +92 -0
- package/src/features/presentation/stage/SlideStage.tsx +159 -0
- package/src/features/presentation/stage/slideSurface.ts +71 -0
- package/src/features/presentation/stage/slideViewport.tsx +47 -0
- package/src/features/presentation/sync/adapters/broadcastChannelTransport.ts +40 -0
- package/src/features/presentation/sync/adapters/websocketTransport.ts +128 -0
- package/src/features/presentation/sync/model/presence.test.ts +42 -0
- package/src/features/presentation/sync/model/presence.ts +33 -0
- package/src/features/presentation/sync/model/replication.test.ts +72 -0
- package/src/features/presentation/sync/model/replication.ts +113 -0
- package/src/features/presentation/sync/model/status.test.ts +52 -0
- package/src/features/presentation/sync/model/status.ts +33 -0
- package/src/features/presentation/types.ts +1 -0
- package/src/features/presentation/usePresentationRecorder.ts +194 -0
- package/src/features/presentation/usePresentationSync.ts +423 -0
- package/src/index.ts +7 -0
- package/src/main.tsx +12 -0
- package/src/theme/ThemeProvider.test.ts +36 -0
- package/src/theme/ThemeProvider.tsx +79 -0
- package/src/theme/__mocks__/active-theme.ts +3 -0
- package/src/theme/base.css +14 -0
- package/src/theme/components.css +231 -0
- package/src/theme/index.css +11 -0
- package/src/theme/layouts/center.tsx +9 -0
- package/src/theme/layouts/cover.tsx +9 -0
- package/src/theme/layouts/default.tsx +5 -0
- package/src/theme/layouts/defaultLayouts.ts +20 -0
- package/src/theme/layouts/helpers.tsx +12 -0
- package/src/theme/layouts/image-right.tsx +21 -0
- package/src/theme/layouts/immersive.tsx +9 -0
- package/src/theme/layouts/resolveLayout.ts +9 -0
- package/src/theme/layouts/section.tsx +9 -0
- package/src/theme/layouts/statement.tsx +9 -0
- package/src/theme/layouts/two-cols.tsx +21 -0
- package/src/theme/layouts/types.ts +1 -0
- package/src/theme/layouts.css +133 -0
- package/src/theme/mark.css +379 -0
- package/src/theme/print.css +106 -0
- package/src/theme/prose.css +263 -0
- package/src/theme/registry.test.ts +21 -0
- package/src/theme/registry.ts +40 -0
- package/src/theme/tokens.css +148 -0
- package/src/theme/transitions.css +141 -0
- package/src/theme/types.ts +9 -0
- package/src/theme/useResolvedLayout.ts +24 -0
- package/src/types/generated-slides.d.ts +7 -0
- package/src/types/mdx-components.ts +7 -0
- package/src/types/plantuml-encoder.d.ts +7 -0
- package/src/ui/diagrams/PlantUmlDiagram.tsx +33 -0
- package/src/ui/mdx/MagicMoveDemo.tsx +114 -0
- package/src/ui/mdx/index.ts +21 -0
- package/src/ui/primitives/Annotate.test.tsx +64 -0
- package/src/ui/primitives/Annotate.tsx +82 -0
- package/src/ui/primitives/Badge.tsx +5 -0
- package/src/ui/primitives/Callout.tsx +24 -0
- package/src/ui/primitives/ChromeIconButton.tsx +58 -0
- package/src/ui/primitives/ChromePanel.tsx +79 -0
- package/src/ui/primitives/ChromeTag.tsx +70 -0
- package/src/ui/primitives/FormSelect.tsx +51 -0
package/src/main.tsx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StrictMode } from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import "katex/dist/katex.min.css";
|
|
4
|
+
import "shiki-magic-move/dist/style.css";
|
|
5
|
+
import App from "./app/App";
|
|
6
|
+
import "./theme/index.css";
|
|
7
|
+
|
|
8
|
+
createRoot(document.getElementById("root")!).render(
|
|
9
|
+
<StrictMode>
|
|
10
|
+
<App />
|
|
11
|
+
</StrictMode>,
|
|
12
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_SLIDES_VIEWPORT,
|
|
4
|
+
resolveSlidesViewportMeta,
|
|
5
|
+
} from "@slidev-react/core/slides/viewport";
|
|
6
|
+
import { resolveSlideTheme } from "./registry";
|
|
7
|
+
import { resolveThemeRootAttributes } from "./ThemeProvider";
|
|
8
|
+
|
|
9
|
+
describe("ThemeProvider root attributes", () => {
|
|
10
|
+
it("keeps theme attributes when no viewport is provided", () => {
|
|
11
|
+
const theme = resolveSlideTheme();
|
|
12
|
+
|
|
13
|
+
expect(resolveThemeRootAttributes(theme)).toEqual({
|
|
14
|
+
"data-slide-theme": "default",
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("adds a portrait orientation attribute for vertical decks", () => {
|
|
19
|
+
const theme = resolveSlideTheme();
|
|
20
|
+
const portraitViewport = resolveSlidesViewportMeta("3/4").viewport;
|
|
21
|
+
|
|
22
|
+
expect(resolveThemeRootAttributes(theme, portraitViewport)).toEqual({
|
|
23
|
+
"data-slide-theme": "default",
|
|
24
|
+
"data-slide-viewport-orientation": "portrait",
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("adds a landscape orientation attribute for standard decks", () => {
|
|
29
|
+
const theme = resolveSlideTheme();
|
|
30
|
+
|
|
31
|
+
expect(resolveThemeRootAttributes(theme, DEFAULT_SLIDES_VIEWPORT)).toEqual({
|
|
32
|
+
"data-slide-theme": "default",
|
|
33
|
+
"data-slide-viewport-orientation": "landscape",
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useContext,
|
|
4
|
+
useEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
type ReactNode,
|
|
7
|
+
} from "react";
|
|
8
|
+
import {
|
|
9
|
+
isPortraitViewport,
|
|
10
|
+
type SlidesViewport,
|
|
11
|
+
} from "@slidev-react/core/slides/viewport";
|
|
12
|
+
import { resolveSlideTheme } from "./registry";
|
|
13
|
+
import type { ResolvedSlideTheme } from "./types";
|
|
14
|
+
|
|
15
|
+
const ThemeContext = createContext<ResolvedSlideTheme | null>(null);
|
|
16
|
+
|
|
17
|
+
export function resolveThemeRootAttributes(
|
|
18
|
+
theme: ResolvedSlideTheme,
|
|
19
|
+
slidesViewport?: SlidesViewport,
|
|
20
|
+
) {
|
|
21
|
+
return {
|
|
22
|
+
...theme.rootAttributes,
|
|
23
|
+
...(slidesViewport
|
|
24
|
+
? {
|
|
25
|
+
"data-slide-viewport-orientation": isPortraitViewport(slidesViewport)
|
|
26
|
+
? "portrait"
|
|
27
|
+
: "landscape",
|
|
28
|
+
}
|
|
29
|
+
: {}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function applyRootThemeAttributes(theme: ResolvedSlideTheme, slidesViewport?: SlidesViewport) {
|
|
34
|
+
if (typeof document === "undefined") return () => {};
|
|
35
|
+
|
|
36
|
+
const root = document.documentElement;
|
|
37
|
+
const appliedEntries = Object.entries(resolveThemeRootAttributes(theme, slidesViewport));
|
|
38
|
+
const previousAttributes = new Map(
|
|
39
|
+
appliedEntries.map(([name]) => [name, root.getAttribute(name)]),
|
|
40
|
+
);
|
|
41
|
+
const hadThemeClass = theme.rootClassName ? root.classList.contains(theme.rootClassName) : false;
|
|
42
|
+
|
|
43
|
+
for (const [name, value] of appliedEntries) {
|
|
44
|
+
root.setAttribute(name, value);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (theme.rootClassName) root.classList.add(theme.rootClassName);
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
for (const [name] of appliedEntries) {
|
|
51
|
+
const previousValue = previousAttributes.get(name);
|
|
52
|
+
if (previousValue === null || previousValue === undefined) root.removeAttribute(name);
|
|
53
|
+
else root.setAttribute(name, previousValue);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (theme.rootClassName && !hadThemeClass) root.classList.remove(theme.rootClassName);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function ThemeProvider({
|
|
61
|
+
slidesViewport,
|
|
62
|
+
children,
|
|
63
|
+
}: {
|
|
64
|
+
slidesViewport?: SlidesViewport;
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
}) {
|
|
67
|
+
const theme = useMemo(() => resolveSlideTheme(), []);
|
|
68
|
+
|
|
69
|
+
useEffect(() => applyRootThemeAttributes(theme, slidesViewport), [slidesViewport, theme]);
|
|
70
|
+
|
|
71
|
+
return <ThemeContext.Provider value={theme}>{children}</ThemeContext.Provider>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function useSlideTheme() {
|
|
75
|
+
const context = useContext(ThemeContext);
|
|
76
|
+
if (!context) throw new Error("useSlideTheme must be used inside ThemeProvider");
|
|
77
|
+
|
|
78
|
+
return context;
|
|
79
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
.slide-surface-frame {
|
|
2
|
+
padding-inline: var(--slide-surface-padding-inline);
|
|
3
|
+
padding-block-start: var(--slide-surface-padding-block-start);
|
|
4
|
+
padding-block-end: var(--slide-surface-padding-block-end);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.slide-badge {
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
width: fit-content;
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
align-items: center;
|
|
12
|
+
border: var(--slide-badge-border);
|
|
13
|
+
border-radius: var(--slide-badge-radius);
|
|
14
|
+
background: var(--slide-badge-bg);
|
|
15
|
+
color: var(--slide-badge-color);
|
|
16
|
+
padding: var(--slide-badge-padding-y) var(--slide-badge-padding-x);
|
|
17
|
+
font-size: var(--slide-badge-font-size);
|
|
18
|
+
line-height: var(--slide-badge-line-height);
|
|
19
|
+
letter-spacing: var(--slide-badge-letter-spacing);
|
|
20
|
+
font-weight: var(--slide-badge-font-weight);
|
|
21
|
+
vertical-align: baseline;
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.code-heavy pre {
|
|
26
|
+
--slide-pre-font-size: 1.06rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.compact-copy {
|
|
30
|
+
--slide-font-size-body: clamp(1.15rem, 1.35vw, 1.45rem);
|
|
31
|
+
--slide-line-height-body: 1.46;
|
|
32
|
+
--slide-p-margin: 0.35rem 0 0.7rem;
|
|
33
|
+
--slide-p-font-size: clamp(1.15rem, 1.35vw, 1.45rem);
|
|
34
|
+
--slide-p-line-height: 1.46;
|
|
35
|
+
--slide-li-font-size: clamp(1.15rem, 1.35vw, 1.45rem);
|
|
36
|
+
--slide-li-line-height: 1.46;
|
|
37
|
+
--slide-badge-font-size: clamp(1.15rem, 1.35vw, 1.45rem);
|
|
38
|
+
--slide-badge-line-height: 1.46;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.compact-code {
|
|
42
|
+
--slide-pre-font-size: 1rem;
|
|
43
|
+
--slide-pre-padding: 0.75rem 0.875rem;
|
|
44
|
+
--slide-inline-code-font-size: 0.9em;
|
|
45
|
+
--slide-code-line-min-height: 1.28em;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.display-headline {
|
|
49
|
+
--slide-h1-size: clamp(3.8rem, 7.2vw, 7.6rem);
|
|
50
|
+
--slide-h1-line-height: 0.98;
|
|
51
|
+
--slide-h1-letter-spacing: -0.045em;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.course-cover {
|
|
55
|
+
--cc-accent: #22c55e;
|
|
56
|
+
position: absolute;
|
|
57
|
+
inset: 0;
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
background: #1c1c1c;
|
|
62
|
+
color: #ededed;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.course-cover[data-tone="light"] {
|
|
66
|
+
background: #f8fafc;
|
|
67
|
+
color: #0f172a;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.course-cover::before {
|
|
71
|
+
display: none !important;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.course-cover .lesson-number {
|
|
75
|
+
position: absolute;
|
|
76
|
+
top: -0.1em;
|
|
77
|
+
right: 0.05em;
|
|
78
|
+
z-index: 0;
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
font-size: 18rem;
|
|
81
|
+
font-weight: 900;
|
|
82
|
+
line-height: 1;
|
|
83
|
+
letter-spacing: -0.05em;
|
|
84
|
+
color: var(--cc-accent);
|
|
85
|
+
opacity: 0.06;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.course-cover[data-tone="light"] .lesson-number {
|
|
89
|
+
opacity: 0.13;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.course-cover .cover-header {
|
|
93
|
+
position: relative;
|
|
94
|
+
z-index: 3;
|
|
95
|
+
display: flex;
|
|
96
|
+
justify-content: space-between;
|
|
97
|
+
align-items: center;
|
|
98
|
+
padding: 32px 40px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.course-cover .progress-badge {
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: baseline;
|
|
104
|
+
gap: 4px;
|
|
105
|
+
padding: 8px 16px;
|
|
106
|
+
border-radius: 9999px;
|
|
107
|
+
border: 1px solid color-mix(in srgb, var(--cc-accent) 30%, #333 70%);
|
|
108
|
+
background: rgba(37, 37, 37, 0.6);
|
|
109
|
+
font-family: var(--font-mono);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.course-cover[data-tone="light"] .progress-badge {
|
|
113
|
+
border: 1px solid color-mix(in srgb, var(--cc-accent) 18%, #cbd5e1 82%);
|
|
114
|
+
background: rgba(255, 255, 255, 0.72);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.course-cover .badge-current {
|
|
118
|
+
font-size: 1.4rem;
|
|
119
|
+
font-weight: 700;
|
|
120
|
+
color: var(--cc-accent);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.course-cover .badge-divider,
|
|
124
|
+
.course-cover .badge-total {
|
|
125
|
+
color: #999;
|
|
126
|
+
font-size: 1rem;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.course-cover[data-tone="light"] .badge-divider,
|
|
130
|
+
.course-cover[data-tone="light"] .badge-total {
|
|
131
|
+
color: #64748b;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.course-cover .cover-content {
|
|
135
|
+
position: relative;
|
|
136
|
+
z-index: 1;
|
|
137
|
+
flex: 1;
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
align-items: center;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
text-align: center;
|
|
143
|
+
padding: 0 40px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.course-cover h1 {
|
|
147
|
+
margin: 0 0 1rem;
|
|
148
|
+
color: #ededed;
|
|
149
|
+
font-size: clamp(3.35rem, 5.7vw, 5.45rem);
|
|
150
|
+
line-height: 1.08;
|
|
151
|
+
letter-spacing: -0.03em;
|
|
152
|
+
font-weight: 700;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.course-cover[data-tone="light"] h1 {
|
|
156
|
+
color: #0f172a;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.course-cover .cover-subtitle {
|
|
160
|
+
max-width: 600px;
|
|
161
|
+
margin: 0;
|
|
162
|
+
color: #d4d4d4;
|
|
163
|
+
font-size: clamp(1.38rem, 2vw, 1.72rem);
|
|
164
|
+
line-height: 1.5;
|
|
165
|
+
opacity: 0.8;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.course-cover[data-tone="light"] .cover-subtitle {
|
|
169
|
+
color: #334155;
|
|
170
|
+
opacity: 0.92;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.course-cover .cover-footer {
|
|
174
|
+
position: relative;
|
|
175
|
+
z-index: 3;
|
|
176
|
+
display: flex;
|
|
177
|
+
justify-content: space-between;
|
|
178
|
+
align-items: center;
|
|
179
|
+
padding: 32px 40px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.course-cover .series-name {
|
|
183
|
+
display: inline-flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
padding: 8px 16px;
|
|
186
|
+
border-radius: 9999px;
|
|
187
|
+
border: 1px solid #333;
|
|
188
|
+
background: rgba(37, 37, 37, 0.6);
|
|
189
|
+
color: var(--cc-accent);
|
|
190
|
+
font-size: 1rem;
|
|
191
|
+
font-weight: 600;
|
|
192
|
+
letter-spacing: 0.05em;
|
|
193
|
+
text-transform: uppercase;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.course-cover[data-tone="light"] .series-name {
|
|
197
|
+
border: 1px solid color-mix(in srgb, var(--cc-accent) 18%, #cbd5e1 82%);
|
|
198
|
+
background: rgba(255, 255, 255, 0.72);
|
|
199
|
+
color: color-mix(in srgb, var(--cc-accent) 72%, #14532d 28%);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.course-cover .spacer {
|
|
203
|
+
flex: 1;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.course-cover .author-info {
|
|
207
|
+
display: flex;
|
|
208
|
+
align-items: center;
|
|
209
|
+
gap: 0.75rem;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.course-cover .author-label {
|
|
213
|
+
color: #999;
|
|
214
|
+
font-size: 0.82rem;
|
|
215
|
+
text-transform: uppercase;
|
|
216
|
+
letter-spacing: 0.1em;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.course-cover[data-tone="light"] .author-label {
|
|
220
|
+
color: #64748b;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.course-cover .author-name {
|
|
224
|
+
color: #d4d4d4;
|
|
225
|
+
font-size: 1.08rem;
|
|
226
|
+
font-weight: 500;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.course-cover[data-tone="light"] .author-name {
|
|
230
|
+
color: #0f172a;
|
|
231
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export function CenterLayout({ children }: { children: ReactNode }) {
|
|
4
|
+
return (
|
|
5
|
+
<section className="slide-layout-center grid size-full place-content-center text-center">
|
|
6
|
+
<div className="slide-layout-center-content mx-auto w-full max-w-[1180px]">{children}</div>
|
|
7
|
+
</section>
|
|
8
|
+
);
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export function CoverLayout({ children }: { children: ReactNode }) {
|
|
4
|
+
return (
|
|
5
|
+
<section className="slide-layout-cover grid size-full place-content-center">
|
|
6
|
+
<div className="slide-layout-cover-content mx-auto w-full max-w-[1480px]">{children}</div>
|
|
7
|
+
</section>
|
|
8
|
+
);
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CenterLayout } from "./center";
|
|
2
|
+
import { CoverLayout } from "./cover";
|
|
3
|
+
import { DefaultLayout } from "./default";
|
|
4
|
+
import { ImageRightLayout } from "./image-right";
|
|
5
|
+
import { ImmersiveLayout } from "./immersive";
|
|
6
|
+
import { SectionLayout } from "./section";
|
|
7
|
+
import { StatementLayout } from "./statement";
|
|
8
|
+
import { TwoColsLayout } from "./two-cols";
|
|
9
|
+
import type { LayoutRegistry } from "./types";
|
|
10
|
+
|
|
11
|
+
export const defaultLayouts: LayoutRegistry = {
|
|
12
|
+
default: DefaultLayout,
|
|
13
|
+
center: CenterLayout,
|
|
14
|
+
cover: CoverLayout,
|
|
15
|
+
section: SectionLayout,
|
|
16
|
+
immersive: ImmersiveLayout,
|
|
17
|
+
"two-cols": TwoColsLayout,
|
|
18
|
+
"image-right": ImageRightLayout,
|
|
19
|
+
statement: StatementLayout,
|
|
20
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Children, isValidElement, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export function splitByFirstHr(children: ReactNode): [ReactNode, ReactNode | null] {
|
|
4
|
+
const nodes = Children.toArray(children);
|
|
5
|
+
const index = nodes.findIndex((node) => isValidElement(node) && node.type === "hr");
|
|
6
|
+
|
|
7
|
+
if (index < 0) return [children, null];
|
|
8
|
+
|
|
9
|
+
const left = nodes.slice(0, index);
|
|
10
|
+
const right = nodes.slice(index + 1);
|
|
11
|
+
return [left, right.length > 0 ? right : null];
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { splitByFirstHr } from "./helpers";
|
|
3
|
+
|
|
4
|
+
export function ImageRightLayout({ children }: { children: ReactNode }) {
|
|
5
|
+
const [left, right] = splitByFirstHr(children);
|
|
6
|
+
|
|
7
|
+
if (!right) {
|
|
8
|
+
return (
|
|
9
|
+
<section className="slide-layout-image-right grid size-full place-content-start">
|
|
10
|
+
<div className="slide-layout-image-right-pane min-w-0">{left}</div>
|
|
11
|
+
</section>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<section className="slide-layout-image-right grid size-full grid-cols-[1.2fr_0.8fr] items-center gap-12">
|
|
17
|
+
<div className="slide-layout-image-right-pane min-w-0">{left}</div>
|
|
18
|
+
<div className="slide-layout-image-right-pane min-w-0">{right}</div>
|
|
19
|
+
</section>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LayoutName } from "@slidev-react/core/slides/layout";
|
|
2
|
+
import { defaultLayouts } from "./defaultLayouts";
|
|
3
|
+
import type { LayoutRegistry } from "./types";
|
|
4
|
+
|
|
5
|
+
export function resolveLayout(layout: LayoutName | undefined, layouts?: LayoutRegistry) {
|
|
6
|
+
const registry = layouts ?? defaultLayouts;
|
|
7
|
+
|
|
8
|
+
return registry[layout ?? "default"] ?? registry.default ?? defaultLayouts.default!;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export function SectionLayout({ children }: { children: ReactNode }) {
|
|
4
|
+
return (
|
|
5
|
+
<section className="slide-layout-section grid size-full place-content-center text-center">
|
|
6
|
+
<div className="slide-layout-section-content mx-auto w-full max-w-[1320px]">{children}</div>
|
|
7
|
+
</section>
|
|
8
|
+
);
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export function StatementLayout({ children }: { children: ReactNode }) {
|
|
4
|
+
return (
|
|
5
|
+
<section className="slide-layout-statement grid size-full place-content-center text-center">
|
|
6
|
+
<div className="slide-layout-statement-content mx-auto w-full max-w-[1240px]">{children}</div>
|
|
7
|
+
</section>
|
|
8
|
+
);
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { splitByFirstHr } from "./helpers";
|
|
3
|
+
|
|
4
|
+
export function TwoColsLayout({ children }: { children: ReactNode }) {
|
|
5
|
+
const [left, right] = splitByFirstHr(children);
|
|
6
|
+
|
|
7
|
+
if (!right) {
|
|
8
|
+
return (
|
|
9
|
+
<section className="slide-layout-two-cols grid size-full place-content-start">
|
|
10
|
+
<div className="slide-layout-two-cols-pane min-w-0">{left}</div>
|
|
11
|
+
</section>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<section className="slide-layout-two-cols grid size-full grid-cols-2 items-start gap-12">
|
|
17
|
+
<div className="slide-layout-two-cols-pane min-w-0">{left}</div>
|
|
18
|
+
<div className="slide-layout-two-cols-pane min-w-0">{right}</div>
|
|
19
|
+
</section>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { LayoutComponent, LayoutRegistry } from "@slidev-react/core/theme";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
.slide-layout-cover {
|
|
2
|
+
--slide-h1-margin: 0 0 1rem;
|
|
3
|
+
--slide-h1-size: clamp(3.4rem, 7vw, 7.2rem);
|
|
4
|
+
--slide-h1-line-height: 1;
|
|
5
|
+
--slide-h1-letter-spacing: -0.04em;
|
|
6
|
+
--slide-h2-margin: 0.5rem 0 0.85rem;
|
|
7
|
+
--slide-h2-size: clamp(1.35rem, 2.3vw, 2.35rem);
|
|
8
|
+
--slide-h2-color: #334155;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:root[data-slide-viewport-orientation="portrait"] .slide-layout-cover {
|
|
12
|
+
--slide-h1-size: clamp(3.7rem, 7.15vw, 6.5rem);
|
|
13
|
+
--slide-h2-size: clamp(1.55rem, 2.7vw, 2.62rem);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:root[data-slide-viewport-orientation="portrait"] .slide-layout-cover-content {
|
|
17
|
+
max-width: 62rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.slide-layout-center {
|
|
21
|
+
--slide-p-margin: 0.55rem 0 0.75rem;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:root[data-slide-viewport-orientation="portrait"] .slide-layout-center-content {
|
|
25
|
+
max-width: 54rem;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.slide-layout-section {
|
|
29
|
+
--slide-h1-margin: 0 0 0.6rem;
|
|
30
|
+
--slide-h1-size: clamp(3rem, 6vw, 6rem);
|
|
31
|
+
--slide-h1-line-height: 1.03;
|
|
32
|
+
--slide-h1-letter-spacing: -0.035em;
|
|
33
|
+
--slide-h2-size: clamp(1.1rem, 1.8vw, 1.8rem);
|
|
34
|
+
--slide-h2-color: #475569;
|
|
35
|
+
--slide-color-body: #475569;
|
|
36
|
+
--slide-font-size-body: clamp(1.1rem, 1.8vw, 1.8rem);
|
|
37
|
+
--slide-p-color: #475569;
|
|
38
|
+
--slide-p-font-size: clamp(1.1rem, 1.8vw, 1.8rem);
|
|
39
|
+
--slide-p-line-height: 1.48;
|
|
40
|
+
--slide-li-color: #475569;
|
|
41
|
+
--slide-li-font-size: clamp(1.1rem, 1.8vw, 1.8rem);
|
|
42
|
+
--slide-li-line-height: 1.48;
|
|
43
|
+
--slide-badge-font-size: clamp(1.1rem, 1.8vw, 1.8rem);
|
|
44
|
+
--slide-badge-line-height: 1.48;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:root[data-slide-viewport-orientation="portrait"] .slide-layout-section {
|
|
48
|
+
--slide-h1-size: clamp(3.35rem, 6.35vw, 6.2rem);
|
|
49
|
+
--slide-h2-size: clamp(1.32rem, 2.22vw, 2.08rem);
|
|
50
|
+
--slide-font-size-body: clamp(1.26rem, 2.02vw, 1.96rem);
|
|
51
|
+
--slide-p-font-size: clamp(1.26rem, 2.02vw, 1.96rem);
|
|
52
|
+
--slide-li-font-size: clamp(1.26rem, 2.02vw, 1.96rem);
|
|
53
|
+
--slide-badge-font-size: clamp(1.26rem, 2.02vw, 1.96rem);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:root[data-slide-viewport-orientation="portrait"] .slide-layout-section-content {
|
|
57
|
+
max-width: 56rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.slide-layout-statement {
|
|
61
|
+
--slide-h1-margin: 0;
|
|
62
|
+
--slide-h1-size: clamp(2.2rem, 4.4vw, 4.8rem);
|
|
63
|
+
--slide-h1-line-height: 1.14;
|
|
64
|
+
--slide-h1-letter-spacing: -0.03em;
|
|
65
|
+
--slide-h1-weight: 760;
|
|
66
|
+
--slide-h2-margin: 0;
|
|
67
|
+
--slide-h2-size: clamp(2.2rem, 4.4vw, 4.8rem);
|
|
68
|
+
--slide-h2-line-height: 1.14;
|
|
69
|
+
--slide-h2-letter-spacing: -0.03em;
|
|
70
|
+
--slide-h2-weight: 760;
|
|
71
|
+
--slide-h2-color: var(--slide-color-heading);
|
|
72
|
+
--slide-p-margin: 0.9rem 0 0;
|
|
73
|
+
--slide-color-body: #475569;
|
|
74
|
+
--slide-font-size-body: clamp(1rem, 1.45vw, 1.55rem);
|
|
75
|
+
--slide-p-color: #475569;
|
|
76
|
+
--slide-p-font-size: clamp(1rem, 1.45vw, 1.55rem);
|
|
77
|
+
--slide-p-line-height: 1.42;
|
|
78
|
+
--slide-p-letter-spacing: -0.01em;
|
|
79
|
+
--slide-li-color: #475569;
|
|
80
|
+
--slide-li-font-size: clamp(1rem, 1.45vw, 1.55rem);
|
|
81
|
+
--slide-li-line-height: 1.42;
|
|
82
|
+
--slide-li-letter-spacing: -0.01em;
|
|
83
|
+
--slide-badge-font-size: clamp(1rem, 1.45vw, 1.55rem);
|
|
84
|
+
--slide-badge-line-height: 1.42;
|
|
85
|
+
--slide-blockquote-font-size: clamp(2.2rem, 4.4vw, 4.8rem);
|
|
86
|
+
--slide-blockquote-line-height: 1.14;
|
|
87
|
+
--slide-blockquote-letter-spacing: -0.03em;
|
|
88
|
+
--slide-blockquote-font-weight: 760;
|
|
89
|
+
--slide-blockquote-color: var(--slide-color-heading);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:root[data-slide-viewport-orientation="portrait"] .slide-layout-statement {
|
|
93
|
+
--slide-h1-size: clamp(2.55rem, 4.85vw, 5.2rem);
|
|
94
|
+
--slide-h2-size: clamp(2.55rem, 4.85vw, 5.2rem);
|
|
95
|
+
--slide-font-size-body: clamp(1.18rem, 1.75vw, 1.88rem);
|
|
96
|
+
--slide-p-font-size: clamp(1.18rem, 1.75vw, 1.88rem);
|
|
97
|
+
--slide-li-font-size: clamp(1.18rem, 1.75vw, 1.88rem);
|
|
98
|
+
--slide-badge-font-size: clamp(1.18rem, 1.75vw, 1.88rem);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:root[data-slide-viewport-orientation="portrait"] .slide-layout-statement-content {
|
|
102
|
+
max-width: 52rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.slide-layout-two-cols > div,
|
|
106
|
+
.slide-layout-image-right > div {
|
|
107
|
+
min-width: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
:root[data-slide-viewport-orientation="portrait"] .slide-layout-two-cols {
|
|
111
|
+
grid-template-columns: minmax(0, 1fr);
|
|
112
|
+
gap: 2rem;
|
|
113
|
+
align-content: start;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:root[data-slide-viewport-orientation="portrait"] .slide-layout-two-cols-pane,
|
|
117
|
+
:root[data-slide-viewport-orientation="portrait"] .slide-layout-image-right-pane {
|
|
118
|
+
width: 100%;
|
|
119
|
+
max-width: 54rem;
|
|
120
|
+
margin-inline: auto;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:root[data-slide-viewport-orientation="portrait"] .slide-layout-image-right {
|
|
124
|
+
grid-template-columns: minmax(0, 1fr);
|
|
125
|
+
gap: 2rem;
|
|
126
|
+
align-content: start;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.slide-layout-image-right img {
|
|
130
|
+
width: 100%;
|
|
131
|
+
max-height: 640px;
|
|
132
|
+
object-fit: contain;
|
|
133
|
+
}
|