@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,5 +1,4 @@
|
|
|
1
1
|
import { ArrowDownToLine, Loader2, Upload } from 'lucide-react';
|
|
2
|
-
import type React from 'react';
|
|
3
2
|
import { useCallback, useId, useRef, useState } from 'react';
|
|
4
3
|
import { toast } from 'sonner';
|
|
5
4
|
import {
|
|
@@ -10,12 +9,12 @@ import {
|
|
|
10
9
|
DialogTitle,
|
|
11
10
|
} from '@/components/ui/dialog';
|
|
12
11
|
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
|
13
|
-
import { type AssetEntry, uploadWithAutoRename, useAssets } from '@/lib/assets';
|
|
12
|
+
import { type AssetEntry, GLOBAL_ASSET_SCOPE, uploadWithAutoRename, useAssets } from '@/lib/assets';
|
|
13
|
+
import { dragHasFiles } from '@/lib/dom';
|
|
14
14
|
import { format, useLocale } from '@/lib/use-locale';
|
|
15
15
|
import { cn } from '@/lib/utils';
|
|
16
16
|
|
|
17
17
|
export type PickerScope = 'slide' | 'global';
|
|
18
|
-
const GLOBAL_PICKER_SLIDE_ID = '@global';
|
|
19
18
|
|
|
20
19
|
export function AssetPickerDialog({
|
|
21
20
|
slideId,
|
|
@@ -27,7 +26,7 @@ export function AssetPickerDialog({
|
|
|
27
26
|
onPick: (asset: AssetEntry, scope: PickerScope) => void;
|
|
28
27
|
}) {
|
|
29
28
|
const [scope, setScope] = useState<PickerScope>('slide');
|
|
30
|
-
const effectiveSlideId = scope === 'global' ?
|
|
29
|
+
const effectiveSlideId = scope === 'global' ? GLOBAL_ASSET_SCOPE : slideId;
|
|
31
30
|
const { assets, loading, refresh } = useAssets(effectiveSlideId);
|
|
32
31
|
const images = assets.filter((a) => a.mime.startsWith('image/'));
|
|
33
32
|
const t = useLocale();
|
|
@@ -105,13 +104,13 @@ export function AssetPickerDialog({
|
|
|
105
104
|
aria-label={t.inspector.replaceImageDialogTitle}
|
|
106
105
|
className="relative max-h-[60vh] overflow-y-auto"
|
|
107
106
|
onDragEnter={(e) => {
|
|
108
|
-
if (uploading || !
|
|
107
|
+
if (uploading || !dragHasFiles(e)) return;
|
|
109
108
|
e.preventDefault();
|
|
110
109
|
dragDepth.current += 1;
|
|
111
110
|
setDragActive(true);
|
|
112
111
|
}}
|
|
113
112
|
onDragOver={(e) => {
|
|
114
|
-
if (uploading || !
|
|
113
|
+
if (uploading || !dragHasFiles(e)) return;
|
|
115
114
|
e.preventDefault();
|
|
116
115
|
e.dataTransfer.dropEffect = 'copy';
|
|
117
116
|
}}
|
|
@@ -120,7 +119,7 @@ export function AssetPickerDialog({
|
|
|
120
119
|
if (dragDepth.current === 0) setDragActive(false);
|
|
121
120
|
}}
|
|
122
121
|
onDrop={(e) => {
|
|
123
|
-
if (uploading || !
|
|
122
|
+
if (uploading || !dragHasFiles(e)) return;
|
|
124
123
|
e.preventDefault();
|
|
125
124
|
dragDepth.current = 0;
|
|
126
125
|
setDragActive(false);
|
|
@@ -187,12 +186,3 @@ export function AssetPickerDialog({
|
|
|
187
186
|
</Dialog>
|
|
188
187
|
);
|
|
189
188
|
}
|
|
190
|
-
|
|
191
|
-
function hasFiles(e: React.DragEvent): boolean {
|
|
192
|
-
const types = e.dataTransfer?.types;
|
|
193
|
-
if (!types) return false;
|
|
194
|
-
for (let i = 0; i < types.length; i++) {
|
|
195
|
-
if (types[i] === 'Files') return true;
|
|
196
|
-
}
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type SyntheticEvent, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import ReactCrop, { type Crop, type PercentCrop } from 'react-image-crop';
|
|
3
|
+
import { round2 } from '@/lib/utils';
|
|
3
4
|
import 'react-image-crop/dist/ReactCrop.css';
|
|
4
5
|
import { Button } from '@/components/ui/button';
|
|
5
6
|
import {
|
|
@@ -212,7 +213,3 @@ function roundRect(crop: PercentCrop): ImageCropRect {
|
|
|
212
213
|
function clamp(v: number, lo: number, hi: number) {
|
|
213
214
|
return v < lo ? lo : v > hi ? hi : v;
|
|
214
215
|
}
|
|
215
|
-
|
|
216
|
-
function round2(n: number): number {
|
|
217
|
-
return Math.round(n * 100) / 100;
|
|
218
|
-
}
|