@open-slide/core 0.0.8 → 0.0.9

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 (30) hide show
  1. package/dist/{build-CXY2DSzy.js → build-pqF4W1Yi.js} +1 -1
  2. package/dist/cli/bin.js +3 -3
  3. package/dist/{config-BYTf0qVz.js → config-CtwxMYv9.js} +365 -44
  4. package/dist/{dev-BxCKugi3.js → dev-CJX97uiy.js} +1 -1
  5. package/dist/{preview-C1F-rHfx.js → preview-IuLPcL5y.js} +1 -1
  6. package/dist/vite/index.js +1 -1
  7. package/package.json +3 -1
  8. package/src/app/App.tsx +2 -0
  9. package/src/app/components/PdfProgressToast.tsx +23 -0
  10. package/src/app/components/inspector/CommentWidget.tsx +1 -1
  11. package/src/app/components/inspector/InspectOverlay.tsx +81 -41
  12. package/src/app/components/inspector/InspectorPanel.tsx +805 -0
  13. package/src/app/components/inspector/InspectorProvider.tsx +199 -13
  14. package/src/app/components/inspector/SaveBar.tsx +77 -0
  15. package/src/app/components/ui/input.tsx +21 -0
  16. package/src/app/components/ui/label.tsx +24 -0
  17. package/src/app/components/ui/progress.tsx +31 -0
  18. package/src/app/components/ui/select.tsx +190 -0
  19. package/src/app/components/ui/slider.tsx +61 -0
  20. package/src/app/components/ui/sonner.tsx +38 -0
  21. package/src/app/components/ui/textarea.tsx +18 -0
  22. package/src/app/components/ui/toggle-group.tsx +83 -0
  23. package/src/app/components/ui/toggle.tsx +45 -0
  24. package/src/app/components/ui/tooltip.tsx +55 -0
  25. package/src/app/lib/export-pdf.ts +197 -0
  26. package/src/app/lib/inspector/fiber.ts +40 -5
  27. package/src/app/lib/inspector/useEditor.ts +61 -0
  28. package/src/app/lib/print-ready.ts +58 -0
  29. package/src/app/routes/Slide.tsx +47 -3
  30. package/src/app/components/inspector/CommentPopover.tsx +0 -94
@@ -1,94 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- import { createPortal } from 'react-dom';
3
- import { useInspector } from './InspectorProvider';
4
-
5
- const POPOVER_W = 320;
6
- const POPOVER_H = 180;
7
-
8
- export function CommentPopover() {
9
- const { pending, setPending, add, cancel } = useInspector();
10
- const [text, setText] = useState('');
11
- const [submitting, setSubmitting] = useState(false);
12
- const [error, setError] = useState<string | null>(null);
13
- const taRef = useRef<HTMLTextAreaElement>(null);
14
-
15
- useEffect(() => {
16
- taRef.current?.focus();
17
- }, []);
18
-
19
- if (!pending) return null;
20
-
21
- const left = clamp(pending.clickX + 12, 8, window.innerWidth - POPOVER_W - 8);
22
- const top = clamp(pending.clickY + 12, 8, window.innerHeight - POPOVER_H - 8);
23
-
24
- const onSubmit = async () => {
25
- const trimmed = text.trim();
26
- if (!trimmed) return;
27
- setSubmitting(true);
28
- try {
29
- await add(pending.line, pending.column, trimmed);
30
- setPending(null);
31
- } catch (e) {
32
- setError(String((e as Error).message ?? e));
33
- setSubmitting(false);
34
- }
35
- };
36
-
37
- return createPortal(
38
- <div
39
- data-inspector-ui
40
- className="fixed z-50 rounded-md border bg-card p-3 shadow-xl"
41
- style={{ left, top, width: POPOVER_W }}
42
- >
43
- <div className="mb-2 flex items-center justify-between">
44
- <span className="text-xs font-medium text-muted-foreground">
45
- Line {pending.line} · Comment
46
- </span>
47
- <button
48
- type="button"
49
- className="text-xs text-muted-foreground hover:text-foreground"
50
- onClick={cancel}
51
- >
52
-
53
- </button>
54
- </div>
55
- <textarea
56
- ref={taRef}
57
- value={text}
58
- onChange={(e) => setText(e.target.value)}
59
- placeholder="Describe the change…"
60
- className="h-20 w-full resize-none rounded border bg-background p-2 text-sm outline-none focus:ring-2 focus:ring-primary/40"
61
- onKeyDown={(e) => {
62
- if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
63
- e.preventDefault();
64
- onSubmit();
65
- }
66
- }}
67
- />
68
- {error && <p className="mt-1 text-xs text-red-600">{error}</p>}
69
- <div className="mt-2 flex items-center justify-end gap-2">
70
- <button
71
- type="button"
72
- onClick={cancel}
73
- className="rounded border px-2 py-1 text-xs hover:bg-muted"
74
- >
75
- Cancel
76
- </button>
77
- <button
78
- type="button"
79
- disabled={submitting || !text.trim()}
80
- onClick={onSubmit}
81
- className="rounded bg-primary px-3 py-1 text-xs font-medium text-primary-foreground disabled:opacity-50"
82
- >
83
- {submitting ? 'Saving…' : 'Submit'}
84
- </button>
85
- </div>
86
- <p className="mt-2 text-[10px] text-muted-foreground">⌘/Ctrl + Enter to submit</p>
87
- </div>,
88
- document.body,
89
- );
90
- }
91
-
92
- function clamp(n: number, lo: number, hi: number): number {
93
- return Math.max(lo, Math.min(hi, n));
94
- }