@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.
Files changed (88) hide show
  1. package/dist/build-Bzy-qlGc.js +19 -0
  2. package/dist/cli/bin.d.ts +1 -1
  3. package/dist/cli/bin.js +331 -25
  4. package/dist/{config-CDHB8Oow.d.ts → config-AtA2Bqtn.d.ts} +4 -4
  5. package/dist/{config-GA6NMgs_.js → config-nbSvY7z_.js} +547 -778
  6. package/dist/{design-cpzS8aud.js → design-Cpqx7SJs.js} +1 -2
  7. package/dist/{dev-D57ui2yV.js → dev-MXa5Tod4.js} +39 -16
  8. package/dist/index.d.ts +7 -37
  9. package/dist/index.js +51 -54
  10. package/dist/locale/index.d.ts +2 -8
  11. package/dist/locale/index.js +13 -3
  12. package/dist/preview-DEpQcKz3.js +24 -0
  13. package/dist/{types-8HghULIe.d.ts → types-BzPSOxe-.d.ts} +5 -9
  14. package/dist/vite/index.d.ts +1 -4
  15. package/dist/vite/index.js +2 -4
  16. package/dist/{format-74A3B6zu.js → zh-tw-BxZ_pYqe.js} +13 -49
  17. package/package.json +12 -12
  18. package/skills/create-slide/SKILL.md +4 -1
  19. package/skills/slide-authoring/SKILL.md +25 -2
  20. package/src/app/app.tsx +1 -3
  21. package/src/app/assets/open-slide.png +0 -0
  22. package/src/app/components/asset-view.tsx +8 -16
  23. package/src/app/components/command/home-command-menu.tsx +6 -6
  24. package/src/app/components/export-progress-toast.tsx +80 -0
  25. package/src/app/components/history-provider.tsx +1 -5
  26. package/src/app/components/image-placeholder.tsx +4 -12
  27. package/src/app/components/inspector/asset-picker-dialog.tsx +6 -16
  28. package/src/app/components/inspector/image-crop-dialog.tsx +1 -4
  29. package/src/app/components/inspector/inline-text-editor.tsx +798 -0
  30. package/src/app/components/inspector/inspect-overlay.tsx +30 -72
  31. package/src/app/components/inspector/inspector-panel.tsx +17 -49
  32. package/src/app/components/inspector/inspector-provider.tsx +53 -36
  33. package/src/app/components/notes-drawer.tsx +2 -5
  34. package/src/app/components/overview-grid.tsx +5 -4
  35. package/src/app/components/panel/panel-shell.tsx +1 -3
  36. package/src/app/components/player.tsx +5 -6
  37. package/src/app/components/present/control-bar.tsx +4 -4
  38. package/src/app/components/present/jump-input.tsx +3 -2
  39. package/src/app/components/present/use-presenter-channel.ts +0 -1
  40. package/src/app/components/sidebar/folder-item.tsx +39 -16
  41. package/src/app/components/sidebar/sidebar-footer.tsx +7 -1
  42. package/src/app/components/sidebar/sidebar.tsx +91 -64
  43. package/src/app/components/slide-canvas.tsx +2 -6
  44. package/src/app/components/slide-transition-layer.tsx +48 -76
  45. package/src/app/components/style-panel/design-provider.tsx +1 -14
  46. package/src/app/components/style-panel/use-design.ts +1 -28
  47. package/src/app/components/themes/theme-detail.tsx +4 -4
  48. package/src/app/components/themes/themes-gallery.tsx +11 -6
  49. package/src/app/components/thumbnail-rail.tsx +7 -12
  50. package/src/app/lib/assets.ts +6 -7
  51. package/src/app/lib/dom.ts +42 -0
  52. package/src/app/lib/export-html.ts +10 -25
  53. package/src/app/lib/export-pdf.ts +11 -28
  54. package/src/app/lib/export-pptx.ts +6 -36
  55. package/src/app/lib/folders.ts +51 -46
  56. package/src/app/lib/inspector/inline-text.ts +31 -0
  57. package/src/app/lib/inspector/pick-target.ts +38 -0
  58. package/src/app/lib/inspector/use-comments.ts +1 -1
  59. package/src/app/lib/keys.ts +18 -0
  60. package/src/app/lib/last-home-location.ts +18 -0
  61. package/src/app/lib/print-ready.ts +2 -4
  62. package/src/app/lib/slides.ts +7 -4
  63. package/src/app/lib/text-diff.ts +19 -0
  64. package/src/app/lib/use-click-page-navigation.ts +2 -6
  65. package/src/app/lib/use-is-mobile.ts +2 -14
  66. package/src/app/lib/use-media-query.ts +20 -0
  67. package/src/app/lib/use-prefers-reduced-motion.ts +5 -13
  68. package/src/app/lib/use-slide-module.ts +1 -1
  69. package/src/app/lib/use-wheel-page-navigation.ts +1 -1
  70. package/src/app/lib/utils.test.ts +25 -1
  71. package/src/app/lib/utils.ts +8 -0
  72. package/src/app/routes/home-shell.tsx +71 -64
  73. package/src/app/routes/home.tsx +41 -52
  74. package/src/app/routes/presenter.tsx +10 -20
  75. package/src/app/routes/slide.tsx +84 -71
  76. package/src/app/routes/themes.tsx +7 -8
  77. package/src/app/styles.css +33 -44
  78. package/src/locale/en.ts +2 -7
  79. package/src/locale/ja.ts +2 -7
  80. package/src/locale/types.ts +2 -7
  81. package/src/locale/zh-cn.ts +2 -7
  82. package/src/locale/zh-tw.ts +2 -7
  83. package/dist/build-CaV_vhIw.js +0 -17
  84. package/dist/preview-D40Zw_o0.js +0 -18
  85. package/dist/sync-BCJDRIqo.js +0 -139
  86. package/dist/sync-j9_QPovT.js +0 -3
  87. package/src/app/components/pdf-progress-toast.tsx +0 -36
  88. 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' ? GLOBAL_PICKER_SLIDE_ID : slideId;
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 || !hasFiles(e)) return;
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 || !hasFiles(e)) return;
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 || !hasFiles(e)) return;
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
- }