@open-slide/core 1.19.1 → 2.0.0-beta.1
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/build-Bzy-qlGc.js +19 -0
- package/dist/cli/bin.d.ts +1 -1
- package/dist/cli/bin.js +331 -25
- package/dist/{config-CDHB8Oow.d.ts → config-AtA2Bqtn.d.ts} +4 -4
- package/dist/{config-GA6NMgs_.js → config-nbSvY7z_.js} +547 -778
- package/dist/{design-cpzS8aud.js → design-Cpqx7SJs.js} +1 -2
- package/dist/{dev-D57ui2yV.js → dev-MXa5Tod4.js} +39 -16
- package/dist/index.d.ts +7 -37
- package/dist/index.js +51 -54
- package/dist/locale/index.d.ts +2 -8
- package/dist/locale/index.js +13 -3
- package/dist/preview-DEpQcKz3.js +24 -0
- package/dist/{types-8HghULIe.d.ts → types-BzPSOxe-.d.ts} +5 -9
- package/dist/vite/index.d.ts +1 -4
- package/dist/vite/index.js +2 -4
- package/dist/{format-74A3B6zu.js → zh-tw-BxZ_pYqe.js} +13 -49
- package/package.json +12 -12
- package/skills/create-slide/SKILL.md +4 -1
- package/skills/slide-authoring/SKILL.md +25 -2
- package/src/app/app.tsx +1 -3
- package/src/app/assets/open-slide.png +0 -0
- package/src/app/components/asset-view.tsx +8 -16
- package/src/app/components/command/home-command-menu.tsx +6 -6
- package/src/app/components/export-progress-toast.tsx +80 -0
- package/src/app/components/history-provider.tsx +1 -5
- package/src/app/components/image-placeholder.tsx +4 -12
- package/src/app/components/inspector/asset-picker-dialog.tsx +6 -16
- package/src/app/components/inspector/image-crop-dialog.tsx +1 -4
- package/src/app/components/inspector/inline-text-editor.tsx +798 -0
- package/src/app/components/inspector/inspect-overlay.tsx +30 -72
- package/src/app/components/inspector/inspector-panel.tsx +17 -49
- package/src/app/components/inspector/inspector-provider.tsx +53 -36
- package/src/app/components/notes-drawer.tsx +2 -5
- package/src/app/components/overview-grid.tsx +5 -4
- package/src/app/components/panel/panel-shell.tsx +1 -3
- package/src/app/components/player.tsx +5 -6
- package/src/app/components/present/control-bar.tsx +4 -4
- package/src/app/components/present/jump-input.tsx +3 -2
- package/src/app/components/present/use-presenter-channel.ts +0 -1
- package/src/app/components/sidebar/folder-item.tsx +39 -16
- package/src/app/components/sidebar/sidebar-footer.tsx +7 -1
- package/src/app/components/sidebar/sidebar.tsx +91 -64
- package/src/app/components/slide-canvas.tsx +2 -6
- package/src/app/components/slide-transition-layer.tsx +48 -76
- package/src/app/components/style-panel/design-provider.tsx +1 -14
- package/src/app/components/style-panel/use-design.ts +1 -28
- package/src/app/components/themes/theme-detail.tsx +4 -4
- package/src/app/components/themes/themes-gallery.tsx +11 -6
- package/src/app/components/thumbnail-rail.tsx +7 -12
- package/src/app/lib/assets.ts +6 -7
- package/src/app/lib/dom.ts +42 -0
- package/src/app/lib/export-html.ts +10 -25
- package/src/app/lib/export-pdf.ts +11 -28
- package/src/app/lib/export-pptx.ts +6 -36
- package/src/app/lib/folders.ts +51 -46
- package/src/app/lib/inspector/inline-text.ts +31 -0
- package/src/app/lib/inspector/pick-target.ts +38 -0
- package/src/app/lib/inspector/use-comments.ts +1 -1
- package/src/app/lib/keys.ts +18 -0
- package/src/app/lib/last-home-location.ts +18 -0
- package/src/app/lib/print-ready.ts +2 -4
- package/src/app/lib/slides.ts +7 -4
- package/src/app/lib/text-diff.ts +19 -0
- package/src/app/lib/use-click-page-navigation.ts +2 -6
- package/src/app/lib/use-is-mobile.ts +2 -14
- package/src/app/lib/use-media-query.ts +20 -0
- package/src/app/lib/use-prefers-reduced-motion.ts +5 -13
- package/src/app/lib/use-slide-module.ts +1 -1
- package/src/app/lib/use-wheel-page-navigation.ts +1 -1
- package/src/app/lib/utils.test.ts +25 -1
- package/src/app/lib/utils.ts +8 -0
- package/src/app/routes/home-shell.tsx +71 -64
- package/src/app/routes/home.tsx +41 -52
- package/src/app/routes/presenter.tsx +10 -20
- package/src/app/routes/slide.tsx +84 -71
- package/src/app/routes/themes.tsx +7 -8
- package/src/app/styles.css +33 -44
- package/src/locale/en.ts +2 -7
- package/src/locale/ja.ts +2 -7
- package/src/locale/types.ts +2 -7
- package/src/locale/zh-cn.ts +2 -7
- package/src/locale/zh-tw.ts +2 -7
- package/dist/build-CaV_vhIw.js +0 -17
- package/dist/preview-D40Zw_o0.js +0 -18
- package/dist/sync-BCJDRIqo.js +0 -139
- package/dist/sync-j9_QPovT.js +0 -3
- package/src/app/components/pdf-progress-toast.tsx +0 -36
- package/src/app/components/pptx-progress-toast.tsx +0 -36
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { DEV_SUPERVISED_ENV,
|
|
3
|
-
import chalk from "chalk";
|
|
1
|
+
import { a as printUrls, i as printShortcutsHint, n as formatError, o as shortcutsEnabled, r as printHeader, s as startupDuration, t as createCliLogger } from "./cli/bin.js";
|
|
2
|
+
import { n as DEV_SUPERVISED_ENV, t as createViteConfig } from "./config-nbSvY7z_.js";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
import { existsSync } from "node:fs";
|
|
6
5
|
import { fork } from "node:child_process";
|
|
7
6
|
import { createServer, mergeConfig } from "vite";
|
|
8
|
-
|
|
9
7
|
//#region src/cli/dev.ts
|
|
10
8
|
async function dev(opts = {}) {
|
|
11
|
-
if (process.env[
|
|
9
|
+
if (process.env["OPEN_SLIDE_DEV_SUPERVISED"] === "1") {
|
|
12
10
|
await startServer(opts);
|
|
13
11
|
return;
|
|
14
12
|
}
|
|
@@ -16,21 +14,47 @@ async function dev(opts = {}) {
|
|
|
16
14
|
}
|
|
17
15
|
async function startServer(opts) {
|
|
18
16
|
const base = await createViteConfig({ userCwd: process.cwd() });
|
|
19
|
-
const config = mergeConfig(base, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
const config = mergeConfig(base, {
|
|
18
|
+
customLogger: createCliLogger(),
|
|
19
|
+
server: {
|
|
20
|
+
...opts.port !== void 0 ? { port: opts.port } : {},
|
|
21
|
+
...opts.host !== void 0 ? { host: opts.host } : {},
|
|
22
|
+
...opts.open !== void 0 ? { open: opts.open } : {}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
24
25
|
const server = await createServer(config);
|
|
25
26
|
await server.listen();
|
|
26
|
-
|
|
27
|
-
server.
|
|
27
|
+
printHeader(startupDuration());
|
|
28
|
+
printUrls(server.resolvedUrls, opts.host);
|
|
29
|
+
if (shortcutsEnabled()) {
|
|
30
|
+
printShortcutsHint();
|
|
31
|
+
server.bindCLIShortcuts({ customShortcuts: devShortcuts(opts) });
|
|
32
|
+
}
|
|
28
33
|
const address = server.httpServer?.address();
|
|
29
34
|
if (process.send && address && typeof address === "object") process.send({
|
|
30
35
|
type: "open-slide:listening",
|
|
31
36
|
port: address.port
|
|
32
37
|
});
|
|
33
38
|
}
|
|
39
|
+
function devShortcuts(opts) {
|
|
40
|
+
const showUrls = (server) => {
|
|
41
|
+
console.log("");
|
|
42
|
+
printUrls(server.resolvedUrls, opts.host);
|
|
43
|
+
};
|
|
44
|
+
return [{
|
|
45
|
+
key: "r",
|
|
46
|
+
description: "restart the server",
|
|
47
|
+
async action(server) {
|
|
48
|
+
const before = JSON.stringify(server.resolvedUrls);
|
|
49
|
+
await server.restart();
|
|
50
|
+
if (JSON.stringify(server.resolvedUrls) !== before) showUrls(server);
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "u",
|
|
54
|
+
description: "show server url",
|
|
55
|
+
action: showUrls
|
|
56
|
+
}];
|
|
57
|
+
}
|
|
34
58
|
function supervise(opts) {
|
|
35
59
|
const userCwd = process.cwd();
|
|
36
60
|
let port = opts.port;
|
|
@@ -51,7 +75,7 @@ function supervise(opts) {
|
|
|
51
75
|
}
|
|
52
76
|
});
|
|
53
77
|
child.on("error", (err) => {
|
|
54
|
-
process.stderr.write(
|
|
78
|
+
process.stderr.write(formatError(err.message));
|
|
55
79
|
process.exit(1);
|
|
56
80
|
});
|
|
57
81
|
child.on("message", (message) => {
|
|
@@ -61,7 +85,7 @@ function supervise(opts) {
|
|
|
61
85
|
});
|
|
62
86
|
child.on("exit", (code, signal) => {
|
|
63
87
|
if (shuttingDown) process.exit(0);
|
|
64
|
-
if (code ===
|
|
88
|
+
if (code === 52) {
|
|
65
89
|
openBrowser = false;
|
|
66
90
|
spawnChild();
|
|
67
91
|
return;
|
|
@@ -89,6 +113,5 @@ function resolveDevEntry(userCwd) {
|
|
|
89
113
|
if (existsSync(installed)) return installed;
|
|
90
114
|
return process.argv[1];
|
|
91
115
|
}
|
|
92
|
-
|
|
93
116
|
//#endregion
|
|
94
|
-
export { dev };
|
|
117
|
+
export { dev };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OpenSlideConfig } from "./config-
|
|
1
|
+
import { n as Plural, t as Locale } from "./types-BzPSOxe-.js";
|
|
2
|
+
import { t as OpenSlideConfig } from "./config-AtA2Bqtn.js";
|
|
3
3
|
import { CSSProperties, ComponentType, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
|
|
4
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
-
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
6
|
-
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
7
|
-
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
8
|
-
|
|
9
4
|
//#region src/app/components/image-placeholder.d.ts
|
|
10
5
|
type ImagePlaceholderProps = {
|
|
11
6
|
hint: string;
|
|
@@ -14,15 +9,7 @@ type ImagePlaceholderProps = {
|
|
|
14
9
|
style?: CSSProperties;
|
|
15
10
|
className?: string;
|
|
16
11
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'style' | 'className'>;
|
|
17
|
-
declare function ImagePlaceholder({
|
|
18
|
-
hint,
|
|
19
|
-
width,
|
|
20
|
-
height,
|
|
21
|
-
style,
|
|
22
|
-
className,
|
|
23
|
-
...rest
|
|
24
|
-
}: ImagePlaceholderProps): react_jsx_runtime0.JSX.Element;
|
|
25
|
-
|
|
12
|
+
declare function ImagePlaceholder({ hint, width, height, style, className, ...rest }: ImagePlaceholderProps): import("react").JSX.Element;
|
|
26
13
|
//#endregion
|
|
27
14
|
//#region src/app/components/morph-element.d.ts
|
|
28
15
|
type MorphElementProps = {
|
|
@@ -31,13 +18,7 @@ type MorphElementProps = {
|
|
|
31
18
|
className?: string;
|
|
32
19
|
style?: CSSProperties;
|
|
33
20
|
};
|
|
34
|
-
declare function MorphElement({
|
|
35
|
-
id,
|
|
36
|
-
children,
|
|
37
|
-
className,
|
|
38
|
-
style
|
|
39
|
-
}: MorphElementProps): react_jsx_runtime1.JSX.Element;
|
|
40
|
-
|
|
21
|
+
declare function MorphElement({ id, children, className, style }: MorphElementProps): import("react").JSX.Element;
|
|
41
22
|
//#endregion
|
|
42
23
|
//#region src/app/lib/design.d.ts
|
|
43
24
|
type DesignPalette = {
|
|
@@ -62,14 +43,12 @@ type DesignSystem = {
|
|
|
62
43
|
declare function designToCssVars(d: DesignSystem): Record<string, string>;
|
|
63
44
|
declare function cssVarsToString(vars: Record<string, string>): string;
|
|
64
45
|
declare const defaultDesign: DesignSystem;
|
|
65
|
-
|
|
66
46
|
//#endregion
|
|
67
47
|
//#region src/app/lib/page-context.d.ts
|
|
68
48
|
declare function useSlidePageNumber(): {
|
|
69
49
|
current: number;
|
|
70
50
|
total: number;
|
|
71
51
|
};
|
|
72
|
-
|
|
73
52
|
//#endregion
|
|
74
53
|
//#region src/app/lib/transition.d.ts
|
|
75
54
|
type TransitionPhase = {
|
|
@@ -90,7 +69,6 @@ type MorphTransition = {
|
|
|
90
69
|
easing?: string;
|
|
91
70
|
delay?: number;
|
|
92
71
|
};
|
|
93
|
-
|
|
94
72
|
//#endregion
|
|
95
73
|
//#region src/app/lib/sdk.d.ts
|
|
96
74
|
type Page = ComponentType & {
|
|
@@ -111,25 +89,17 @@ type SlideModule = {
|
|
|
111
89
|
};
|
|
112
90
|
declare const CANVAS_WIDTH = 1920;
|
|
113
91
|
declare const CANVAS_HEIGHT = 1080;
|
|
114
|
-
|
|
115
92
|
//#endregion
|
|
116
93
|
//#region src/app/lib/step-context.d.ts
|
|
117
94
|
declare function useIsActivePage(): boolean;
|
|
118
95
|
type StepsProps = PropsWithChildren;
|
|
119
|
-
declare function Steps({
|
|
120
|
-
children
|
|
121
|
-
}: StepsProps): react_jsx_runtime4.JSX.Element;
|
|
96
|
+
declare function Steps({ children }: StepsProps): import("react").JSX.Element;
|
|
122
97
|
type StepProps = PropsWithChildren<{
|
|
123
98
|
duration?: number;
|
|
124
99
|
}>;
|
|
125
100
|
type InternalStepProps = StepProps & {
|
|
126
101
|
_revealed?: boolean;
|
|
127
102
|
};
|
|
128
|
-
declare function Step({
|
|
129
|
-
children,
|
|
130
|
-
duration,
|
|
131
|
-
_revealed
|
|
132
|
-
}: InternalStepProps): react_jsx_runtime5.JSX.Element;
|
|
133
|
-
|
|
103
|
+
declare function Step({ children, duration, _revealed }: InternalStepProps): import("react").JSX.Element;
|
|
134
104
|
//#endregion
|
|
135
|
-
export { CANVAS_HEIGHT, CANVAS_WIDTH, DesignFonts, DesignPalette, DesignSystem, DesignTypeScale, ImagePlaceholder, ImagePlaceholderProps, Locale, MorphElement, MorphElementProps, MorphTransition, OpenSlideConfig, Page, Plural, SlideMeta, SlideModule, SlideTransition, Step, StepProps, Steps, StepsProps, TransitionPhase, cssVarsToString, defaultDesign, designToCssVars, useIsActivePage, useSlidePageNumber };
|
|
105
|
+
export { CANVAS_HEIGHT, CANVAS_WIDTH, type DesignFonts, type DesignPalette, type DesignSystem, type DesignTypeScale, ImagePlaceholder, type ImagePlaceholderProps, type Locale, MorphElement, type MorphElementProps, type MorphTransition, type OpenSlideConfig, type Page, type Plural, type SlideMeta, type SlideModule, type SlideTransition, Step, type StepProps, Steps, type StepsProps, type TransitionPhase, cssVarsToString, defaultDesign, designToCssVars, useIsActivePage, useSlidePageNumber };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { en,
|
|
2
|
-
import {
|
|
1
|
+
import { i as en, n as zhCN, r as ja, t as zhTW } from "./zh-tw-BxZ_pYqe.js";
|
|
2
|
+
import { n as defaultDesign, r as designToCssVars, t as cssVarsToString } from "./design-Cpqx7SJs.js";
|
|
3
3
|
import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { toast } from "sonner";
|
|
5
|
+
import "virtual:open-slide/slides";
|
|
5
6
|
import config from "virtual:open-slide/config";
|
|
6
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
8
8
|
//#region src/app/lib/assets.ts
|
|
9
9
|
async function listAssets(slideId) {
|
|
10
10
|
const res = await fetch(`/__assets/${slideId}`);
|
|
11
11
|
if (!res.ok) throw new Error(`GET /__assets/${slideId} ${res.status}`);
|
|
12
|
-
|
|
13
|
-
return data.assets ?? [];
|
|
12
|
+
return (await res.json()).assets ?? [];
|
|
14
13
|
}
|
|
15
14
|
async function uploadAsset(slideId, file, opts = {}) {
|
|
16
15
|
const qs = opts.overwrite ? "?overwrite=1" : "";
|
|
@@ -80,7 +79,6 @@ function renamedCopy(file, taken) {
|
|
|
80
79
|
lastModified: file.lastModified
|
|
81
80
|
});
|
|
82
81
|
}
|
|
83
|
-
|
|
84
82
|
//#endregion
|
|
85
83
|
//#region src/app/lib/locale-store.ts
|
|
86
84
|
const LOCALES = {
|
|
@@ -102,7 +100,7 @@ function readStored() {
|
|
|
102
100
|
return configLocale ?? en;
|
|
103
101
|
}
|
|
104
102
|
let current = readStored();
|
|
105
|
-
const listeners = new Set();
|
|
103
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
106
104
|
function subscribe(listener) {
|
|
107
105
|
listeners.add(listener);
|
|
108
106
|
return () => {
|
|
@@ -115,16 +113,22 @@ function getSnapshot() {
|
|
|
115
113
|
function useLocaleValue() {
|
|
116
114
|
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
117
115
|
}
|
|
118
|
-
|
|
119
116
|
//#endregion
|
|
120
117
|
//#region src/app/lib/use-locale.ts
|
|
121
118
|
function useLocale() {
|
|
122
119
|
return useLocaleValue();
|
|
123
120
|
}
|
|
124
|
-
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/app/lib/dom.ts
|
|
123
|
+
function dragHasFiles(e) {
|
|
124
|
+
const types = e.dataTransfer?.types;
|
|
125
|
+
if (!types) return false;
|
|
126
|
+
for (let i = 0; i < types.length; i++) if (types[i] === "Files") return true;
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
125
129
|
//#endregion
|
|
126
130
|
//#region src/app/components/image-placeholder.tsx
|
|
127
|
-
function ImagePlaceholder({ hint, width, height, style, className
|
|
131
|
+
function ImagePlaceholder({ hint, width, height, style, className, ...rest }) {
|
|
128
132
|
const dims = width && height ? `${width} × ${height}` : null;
|
|
129
133
|
const [dragActive, setDragActive] = useState(false);
|
|
130
134
|
const [uploading, setUploading] = useState(false);
|
|
@@ -132,13 +136,13 @@ function ImagePlaceholder({ hint, width, height, style, className,...rest }) {
|
|
|
132
136
|
const t = useLocale();
|
|
133
137
|
const dndProps = import.meta.env.DEV ? {
|
|
134
138
|
onDragEnter: (e) => {
|
|
135
|
-
if (uploading || !
|
|
139
|
+
if (uploading || !dragHasFiles(e)) return;
|
|
136
140
|
e.preventDefault();
|
|
137
141
|
dragDepth.current += 1;
|
|
138
142
|
setDragActive(true);
|
|
139
143
|
},
|
|
140
144
|
onDragOver: (e) => {
|
|
141
|
-
if (uploading || !
|
|
145
|
+
if (uploading || !dragHasFiles(e)) return;
|
|
142
146
|
e.preventDefault();
|
|
143
147
|
e.dataTransfer.dropEffect = "copy";
|
|
144
148
|
},
|
|
@@ -147,7 +151,7 @@ function ImagePlaceholder({ hint, width, height, style, className,...rest }) {
|
|
|
147
151
|
if (dragDepth.current === 0) setDragActive(false);
|
|
148
152
|
},
|
|
149
153
|
onDrop: (e) => {
|
|
150
|
-
if (uploading || !
|
|
154
|
+
if (uploading || !dragHasFiles(e)) return;
|
|
151
155
|
e.preventDefault();
|
|
152
156
|
dragDepth.current = 0;
|
|
153
157
|
setDragActive(false);
|
|
@@ -270,12 +274,6 @@ function DropOverlay({ label }) {
|
|
|
270
274
|
})
|
|
271
275
|
});
|
|
272
276
|
}
|
|
273
|
-
function hasImageFile(e) {
|
|
274
|
-
const types = e.dataTransfer?.types;
|
|
275
|
-
if (!types) return false;
|
|
276
|
-
for (let i = 0; i < types.length; i++) if (types[i] === "Files") return true;
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
277
|
function pickImageFile(files) {
|
|
280
278
|
for (let i = 0; i < files.length; i++) {
|
|
281
279
|
const f = files[i];
|
|
@@ -332,7 +330,6 @@ function PlaceholderIcon() {
|
|
|
332
330
|
]
|
|
333
331
|
});
|
|
334
332
|
}
|
|
335
|
-
|
|
336
333
|
//#endregion
|
|
337
334
|
//#region src/app/components/morph-element.tsx
|
|
338
335
|
function MorphElement({ id, children, className, style }) {
|
|
@@ -352,7 +349,6 @@ function MorphElement({ id, children, className, style }) {
|
|
|
352
349
|
children
|
|
353
350
|
});
|
|
354
351
|
}
|
|
355
|
-
|
|
356
352
|
//#endregion
|
|
357
353
|
//#region src/app/lib/page-context.tsx
|
|
358
354
|
const GLOBAL_KEY$1 = "__open_slide_page_context__";
|
|
@@ -367,29 +363,33 @@ function useSlidePageNumber() {
|
|
|
367
363
|
total: ctx.total
|
|
368
364
|
};
|
|
369
365
|
}
|
|
370
|
-
|
|
371
366
|
//#endregion
|
|
372
367
|
//#region src/app/lib/sdk.ts
|
|
373
368
|
const CANVAS_WIDTH = 1920;
|
|
374
369
|
const CANVAS_HEIGHT = 1080;
|
|
375
|
-
|
|
376
370
|
//#endregion
|
|
377
|
-
//#region src/app/lib/use-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
371
|
+
//#region src/app/lib/use-media-query.ts
|
|
372
|
+
function matchesMediaQuery(query) {
|
|
373
|
+
if (typeof window === "undefined") return false;
|
|
374
|
+
return window.matchMedia(query).matches;
|
|
375
|
+
}
|
|
376
|
+
function useMediaQuery(query) {
|
|
377
|
+
const [matches, setMatches] = useState(() => matchesMediaQuery(query));
|
|
384
378
|
useEffect(() => {
|
|
385
|
-
const mql = window.matchMedia(
|
|
386
|
-
|
|
379
|
+
const mql = window.matchMedia(query);
|
|
380
|
+
setMatches(mql.matches);
|
|
381
|
+
const onChange = (e) => setMatches(e.matches);
|
|
387
382
|
mql.addEventListener("change", onChange);
|
|
388
383
|
return () => mql.removeEventListener("change", onChange);
|
|
389
|
-
}, []);
|
|
390
|
-
return
|
|
384
|
+
}, [query]);
|
|
385
|
+
return matches;
|
|
386
|
+
}
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/app/lib/use-prefers-reduced-motion.ts
|
|
389
|
+
const QUERY = "(prefers-reduced-motion: reduce)";
|
|
390
|
+
function usePrefersReducedMotion() {
|
|
391
|
+
return useMediaQuery(QUERY);
|
|
391
392
|
}
|
|
392
|
-
|
|
393
393
|
//#endregion
|
|
394
394
|
//#region src/app/lib/step-context.tsx
|
|
395
395
|
const GLOBAL_KEY = "__open_slide_step_host_context__";
|
|
@@ -414,25 +414,24 @@ function Steps({ children }) {
|
|
|
414
414
|
useLayoutEffect(() => {
|
|
415
415
|
if (!host) return;
|
|
416
416
|
const id = idRef.current;
|
|
417
|
-
const ctrl = {
|
|
418
|
-
advance: () => {
|
|
419
|
-
if (revealedRef.current >= stepCount) return false;
|
|
420
|
-
applyRevealed(revealedRef.current + 1);
|
|
421
|
-
host.reportRevealed(id, revealedRef.current);
|
|
422
|
-
return true;
|
|
423
|
-
},
|
|
424
|
-
retreat: () => {
|
|
425
|
-
if (revealedRef.current <= 0) return false;
|
|
426
|
-
applyRevealed(revealedRef.current - 1);
|
|
427
|
-
host.reportRevealed(id, revealedRef.current);
|
|
428
|
-
return true;
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
417
|
return host.register({
|
|
432
418
|
id,
|
|
433
419
|
stepCount,
|
|
434
420
|
initialRevealed: revealedRef.current,
|
|
435
|
-
controller:
|
|
421
|
+
controller: {
|
|
422
|
+
advance: () => {
|
|
423
|
+
if (revealedRef.current >= stepCount) return false;
|
|
424
|
+
applyRevealed(revealedRef.current + 1);
|
|
425
|
+
host.reportRevealed(id, revealedRef.current);
|
|
426
|
+
return true;
|
|
427
|
+
},
|
|
428
|
+
retreat: () => {
|
|
429
|
+
if (revealedRef.current <= 0) return false;
|
|
430
|
+
applyRevealed(revealedRef.current - 1);
|
|
431
|
+
host.reportRevealed(id, revealedRef.current);
|
|
432
|
+
return true;
|
|
433
|
+
}
|
|
434
|
+
},
|
|
436
435
|
setRevealed: applyRevealed
|
|
437
436
|
});
|
|
438
437
|
}, [
|
|
@@ -456,17 +455,15 @@ function Steps({ children }) {
|
|
|
456
455
|
function Step({ children, duration = 180, _revealed }) {
|
|
457
456
|
const reduceMotion = usePrefersReducedMotion();
|
|
458
457
|
const revealed = _revealed ?? true;
|
|
459
|
-
const ms = reduceMotion ? 0 : duration;
|
|
460
458
|
return /* @__PURE__ */ jsx("div", {
|
|
461
459
|
"data-osd-step": revealed ? "revealed" : "pending",
|
|
462
460
|
style: {
|
|
463
461
|
opacity: revealed ? 1 : 0,
|
|
464
462
|
visibility: revealed ? "visible" : "hidden",
|
|
465
|
-
transition: `opacity ${
|
|
463
|
+
transition: `opacity ${reduceMotion ? 0 : duration}ms cubic-bezier(0, 0, 0.2, 1)`
|
|
466
464
|
},
|
|
467
465
|
children
|
|
468
466
|
});
|
|
469
467
|
}
|
|
470
|
-
|
|
471
468
|
//#endregion
|
|
472
|
-
export { CANVAS_HEIGHT, CANVAS_WIDTH, ImagePlaceholder, MorphElement, Step, Steps, cssVarsToString, defaultDesign, designToCssVars, useIsActivePage, useSlidePageNumber };
|
|
469
|
+
export { CANVAS_HEIGHT, CANVAS_WIDTH, ImagePlaceholder, MorphElement, Step, Steps, cssVarsToString, defaultDesign, designToCssVars, useIsActivePage, useSlidePageNumber };
|
package/dist/locale/index.d.ts
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as Plural, t as Locale } from "../types-BzPSOxe-.js";
|
|
3
2
|
//#region src/locale/en.d.ts
|
|
4
3
|
declare const en: Locale;
|
|
5
|
-
|
|
6
4
|
//#endregion
|
|
7
5
|
//#region src/locale/format.d.ts
|
|
8
6
|
declare function format(template: string, vars: Record<string, string | number>): string;
|
|
9
7
|
declare function plural(count: number, forms: Plural): string;
|
|
10
|
-
|
|
11
8
|
//#endregion
|
|
12
9
|
//#region src/locale/ja.d.ts
|
|
13
10
|
declare const ja: Locale;
|
|
14
|
-
|
|
15
11
|
//#endregion
|
|
16
12
|
//#region src/locale/zh-cn.d.ts
|
|
17
13
|
declare const zhCN: Locale;
|
|
18
|
-
|
|
19
14
|
//#endregion
|
|
20
15
|
//#region src/locale/zh-tw.d.ts
|
|
21
16
|
declare const zhTW: Locale;
|
|
22
|
-
|
|
23
17
|
//#endregion
|
|
24
|
-
export { Locale, Plural, en, format, ja, plural, zhCN, zhTW };
|
|
18
|
+
export { type Locale, type Plural, en, format, ja, plural, zhCN, zhTW };
|
package/dist/locale/index.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import { en,
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { i as en, n as zhCN, r as ja, t as zhTW } from "../zh-tw-BxZ_pYqe.js";
|
|
2
|
+
//#region src/locale/format.ts
|
|
3
|
+
function format(template, vars) {
|
|
4
|
+
return template.replace(/\{(\w+)\}/g, (m, key) => {
|
|
5
|
+
const v = vars[key];
|
|
6
|
+
return v === void 0 ? m : String(v);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function plural(count, forms) {
|
|
10
|
+
return count === 1 ? forms.one : forms.other;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { en, format, ja, plural, zhCN, zhTW };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { a as printUrls, i as printShortcutsHint, o as shortcutsEnabled, r as printHeader, s as startupDuration, t as createCliLogger } from "./cli/bin.js";
|
|
2
|
+
import { t as createViteConfig } from "./config-nbSvY7z_.js";
|
|
3
|
+
import { mergeConfig, preview as preview$1 } from "vite";
|
|
4
|
+
//#region src/cli/preview.ts
|
|
5
|
+
async function preview(opts = {}) {
|
|
6
|
+
const base = await createViteConfig({ userCwd: process.cwd() });
|
|
7
|
+
const config = mergeConfig(base, {
|
|
8
|
+
customLogger: createCliLogger(),
|
|
9
|
+
preview: {
|
|
10
|
+
...opts.port !== void 0 ? { port: opts.port } : {},
|
|
11
|
+
...opts.host !== void 0 ? { host: opts.host } : {},
|
|
12
|
+
...opts.open !== void 0 ? { open: opts.open } : {}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const server = await preview$1(config);
|
|
16
|
+
printHeader(`preview · ${startupDuration()}`);
|
|
17
|
+
printUrls(server.resolvedUrls, opts.host);
|
|
18
|
+
if (shortcutsEnabled()) {
|
|
19
|
+
printShortcutsHint();
|
|
20
|
+
server.bindCLIShortcuts();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { preview };
|
|
@@ -19,16 +19,11 @@ type Locale = {
|
|
|
19
19
|
loadFailed: string;
|
|
20
20
|
failedToLoadSlide: string;
|
|
21
21
|
home: string;
|
|
22
|
-
backToHome: string;
|
|
23
|
-
preview: string;
|
|
24
22
|
add: string;
|
|
25
23
|
done: string;
|
|
26
24
|
tryAgain: string;
|
|
27
25
|
undo: string;
|
|
28
26
|
redo: string;
|
|
29
|
-
light: string;
|
|
30
|
-
dark: string;
|
|
31
|
-
system: string;
|
|
32
27
|
selected: string;
|
|
33
28
|
};
|
|
34
29
|
notFound: {
|
|
@@ -136,7 +131,6 @@ type Locale = {
|
|
|
136
131
|
loadingAssetsEyebrow: string;
|
|
137
132
|
emptyEyebrow: string;
|
|
138
133
|
nothingToShow: string;
|
|
139
|
-
emptyHintPrefix: string;
|
|
140
134
|
emptyHintMust: string;
|
|
141
135
|
emptyHintSuffix: string;
|
|
142
136
|
};
|
|
@@ -245,7 +239,6 @@ type Locale = {
|
|
|
245
239
|
cropFitCover: string;
|
|
246
240
|
cropFitContain: string;
|
|
247
241
|
cropApply: string;
|
|
248
|
-
cropResetAria: string;
|
|
249
242
|
leaveComment: string;
|
|
250
243
|
commentPlaceholder: string;
|
|
251
244
|
commentShortcutHint: string;
|
|
@@ -262,6 +255,8 @@ type Locale = {
|
|
|
262
255
|
commentDeleteAria: string;
|
|
263
256
|
/** Prefix for the toast shown when one or more buffered edits fail to write to disk. */
|
|
264
257
|
saveFailed: string;
|
|
258
|
+
decreaseFontSize: string;
|
|
259
|
+
increaseFontSize: string;
|
|
265
260
|
};
|
|
266
261
|
stylePanel: {
|
|
267
262
|
designTokens: string;
|
|
@@ -501,5 +496,6 @@ type Locale = {
|
|
|
501
496
|
expandPromptAria: string;
|
|
502
497
|
collapsePromptAria: string;
|
|
503
498
|
};
|
|
504
|
-
};
|
|
505
|
-
|
|
499
|
+
};
|
|
500
|
+
//#endregion
|
|
501
|
+
export { Plural as n, Locale as t };
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import { OpenSlideConfig } from "../config-CDHB8Oow.js";
|
|
1
|
+
import { t as OpenSlideConfig } from "../config-AtA2Bqtn.js";
|
|
3
2
|
import { InlineConfig } from "vite";
|
|
4
|
-
|
|
5
3
|
//#region src/vite/config.d.ts
|
|
6
4
|
type CreateViteConfigOptions = {
|
|
7
5
|
userCwd: string;
|
|
@@ -9,6 +7,5 @@ type CreateViteConfigOptions = {
|
|
|
9
7
|
mode?: 'serve' | 'build';
|
|
10
8
|
};
|
|
11
9
|
declare function createViteConfig(opts: CreateViteConfigOptions): Promise<InlineConfig>;
|
|
12
|
-
|
|
13
10
|
//#endregion
|
|
14
11
|
export { createViteConfig };
|
package/dist/vite/index.js
CHANGED