@open-slide/core 2.0.1 → 2.2.0
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-DOgOEZZA.js → build-DTmKJyjX.js} +1 -1
- package/dist/cli/bin.js +4 -4
- package/dist/{config-hT1o6Jct.js → config-Ces2X_3T.js} +159 -17
- package/dist/{config-GMR1QUlM.d.ts → config-CpmGqpQi.d.ts} +1 -1
- package/dist/{dev-_YkLNJRt.js → dev-ldYag-pR.js} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/locale/index.d.ts +5 -2
- package/dist/locale/index.js +2 -2
- package/dist/{preview-pABcGTQh.js → preview-GYMbZvvk.js} +1 -1
- package/dist/{types-BcbaKTNY.d.ts → types-CvAqFqsY.d.ts} +10 -5
- package/dist/{update-moCkSyvg.js → update-CPBitJQq.js} +24 -14
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{zh-tw-DlZoAc2-.js → zh-tw-B7_Oqv2q.js} +550 -17
- package/package.json +3 -3
- package/skills/apply-comments/SKILL.md +10 -6
- package/skills/create-slide/SKILL.md +2 -0
- package/skills/current-slide/SKILL.md +1 -0
- package/skills/slide-authoring/SKILL.md +31 -1
- package/src/app/app.tsx +2 -0
- package/src/app/assets/open-slide.svg +39 -0
- package/src/app/components/command/command-menu.tsx +1 -3
- package/src/app/components/history-provider.tsx +25 -3
- package/src/app/components/icon-switcher-indicator.tsx +1 -1
- package/src/app/components/inspector/comment-layer.tsx +992 -0
- package/src/app/components/inspector/inspect-overlay.tsx +2 -39
- package/src/app/components/inspector/inspector-panel.tsx +9 -92
- package/src/app/components/inspector/inspector-provider.tsx +299 -67
- package/src/app/components/panel/editor-sidebar.tsx +1 -1
- package/src/app/components/panel/save-card.tsx +6 -2
- package/src/app/components/preview-step-host.tsx +16 -0
- package/src/app/components/sidebar/sidebar.tsx +2 -2
- package/src/app/components/slide-transition-layer.tsx +1 -1
- package/src/app/components/style-panel/style-panel.tsx +3 -2
- package/src/app/components/thumbnail-rail.tsx +76 -1
- package/src/app/favicon.ico +0 -0
- package/src/app/favicon.svg +39 -0
- package/src/app/index.html +2 -1
- package/src/app/lib/inspector/freeze-motion.ts +61 -0
- package/src/app/lib/inspector/use-comments.ts +32 -3
- package/src/app/lib/keys.ts +3 -0
- package/src/app/lib/locale-store.ts +6 -1
- package/src/app/lib/print-ready.ts +9 -6
- package/src/app/routes/presenter.tsx +1 -16
- package/src/app/routes/preview.tsx +169 -0
- package/src/app/routes/slide.tsx +119 -70
- package/src/app/styles.css +64 -80
- package/src/locale/en.ts +7 -4
- package/src/locale/es.ts +550 -0
- package/src/locale/index.ts +1 -0
- package/src/locale/ja.ts +7 -5
- package/src/locale/types.ts +10 -5
- package/src/locale/zh-cn.ts +7 -4
- package/src/locale/zh-tw.ts +7 -4
- package/src/app/assets/open-slide.png +0 -0
- package/src/app/components/inspector/comment-widget.tsx +0 -119
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Crop, ImageIcon } from 'lucide-react';
|
|
2
2
|
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
3
|
import { findSlideSource } from '@/lib/inspector/fiber';
|
|
4
|
+
import { useFreezeSlideMotion } from '@/lib/inspector/freeze-motion';
|
|
4
5
|
import {
|
|
5
6
|
type Guide,
|
|
6
7
|
type Point,
|
|
@@ -98,19 +99,7 @@ export function InspectOverlay() {
|
|
|
98
99
|
const [scale, setScale] = useState(1);
|
|
99
100
|
const displayed = localTargets ?? selection;
|
|
100
101
|
|
|
101
|
-
|
|
102
|
-
if (!active) return;
|
|
103
|
-
const root = document.querySelector<HTMLElement>('[data-inspector-root]');
|
|
104
|
-
if (!root) return;
|
|
105
|
-
const style = document.createElement('style');
|
|
106
|
-
style.textContent = EDITING_FREEZE_CSS;
|
|
107
|
-
document.head.appendChild(style);
|
|
108
|
-
root.dataset.inspectorEditing = 'true';
|
|
109
|
-
return () => {
|
|
110
|
-
style.remove();
|
|
111
|
-
delete root.dataset.inspectorEditing;
|
|
112
|
-
};
|
|
113
|
-
}, [active]);
|
|
102
|
+
useFreezeSlideMotion(active ? 'edit' : null);
|
|
114
103
|
|
|
115
104
|
useLayoutEffect(() => {
|
|
116
105
|
if (!active) return;
|
|
@@ -656,29 +645,3 @@ export function InspectOverlay() {
|
|
|
656
645
|
</div>
|
|
657
646
|
);
|
|
658
647
|
}
|
|
659
|
-
|
|
660
|
-
const EDITING_FREEZE_CSS = `
|
|
661
|
-
[data-inspector-editing] { touch-action: none; }
|
|
662
|
-
[data-inspector-editing] *:not([data-inspector-ui], [data-inspector-ui] *),
|
|
663
|
-
[data-inspector-editing] *:not([data-inspector-ui], [data-inspector-ui] *)::before,
|
|
664
|
-
[data-inspector-editing] *:not([data-inspector-ui], [data-inspector-ui] *)::after {
|
|
665
|
-
animation-duration: 1ms !important;
|
|
666
|
-
animation-delay: 0s !important;
|
|
667
|
-
animation-iteration-count: 1 !important;
|
|
668
|
-
animation-fill-mode: forwards !important;
|
|
669
|
-
transition: none !important;
|
|
670
|
-
view-transition-name: none !important;
|
|
671
|
-
user-select: none;
|
|
672
|
-
}
|
|
673
|
-
[data-inspector-editing] *:not([data-inspector-ui], [data-inspector-ui] *, [data-visual-gesture], [data-visual-gesture] *),
|
|
674
|
-
[data-inspector-editing] *:not([data-inspector-ui], [data-inspector-ui] *, [data-visual-gesture], [data-visual-gesture] *)::before,
|
|
675
|
-
[data-inspector-editing] *:not([data-inspector-ui], [data-inspector-ui] *, [data-visual-gesture], [data-visual-gesture] *)::after {
|
|
676
|
-
cursor: default !important;
|
|
677
|
-
}
|
|
678
|
-
[data-inspector-editing] [data-visual-gesture],
|
|
679
|
-
[data-inspector-editing] [data-visual-gesture] *,
|
|
680
|
-
[data-inspector-editing] [data-visual-gesture] *::before,
|
|
681
|
-
[data-inspector-editing] [data-visual-gesture] *::after {
|
|
682
|
-
cursor: var(--osd-gesture-cursor, default) !important;
|
|
683
|
-
}
|
|
684
|
-
`;
|
|
@@ -46,7 +46,7 @@ import { styleContext } from '@/lib/inspector/text-selection';
|
|
|
46
46
|
import type { EditOp } from '@/lib/inspector/use-editor';
|
|
47
47
|
import { useAgentSocketConnected } from '@/lib/use-agent-socket';
|
|
48
48
|
import { format, useLocale } from '@/lib/use-locale';
|
|
49
|
-
import {
|
|
49
|
+
import { round2 } from '@/lib/utils';
|
|
50
50
|
import type { Locale } from '../../../locale/types';
|
|
51
51
|
import { ArrangePanel } from './arrange-panel';
|
|
52
52
|
import { AssetPickerDialog } from './asset-picker-dialog';
|
|
@@ -107,7 +107,6 @@ export function InspectorPanel({
|
|
|
107
107
|
bufferOps,
|
|
108
108
|
pendingCount,
|
|
109
109
|
opsVersion,
|
|
110
|
-
add,
|
|
111
110
|
applyEdit,
|
|
112
111
|
} = useInspector();
|
|
113
112
|
const [snapshot, setSnapshot] = useState<ElementSnapshot | null>(null);
|
|
@@ -256,19 +255,14 @@ export function InspectorPanel({
|
|
|
256
255
|
);
|
|
257
256
|
const footer =
|
|
258
257
|
selected && snapshot && !multiple ? (
|
|
259
|
-
|
|
260
|
-
<
|
|
261
|
-
<
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
<
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
</span>
|
|
268
|
-
<AgentWatchingBadge />
|
|
269
|
-
</div>
|
|
270
|
-
</CollapsibleSection>
|
|
271
|
-
</>
|
|
258
|
+
<CollapsibleSection title={t.inspector.sourceSection}>
|
|
259
|
+
<div className="flex items-center justify-between gap-2">
|
|
260
|
+
<span className="font-mono text-[10.5px] text-muted-foreground">
|
|
261
|
+
<{selected.anchor.tagName.toLowerCase()}> · {selected.line}:{selected.column}
|
|
262
|
+
</span>
|
|
263
|
+
<AgentWatchingBadge />
|
|
264
|
+
</div>
|
|
265
|
+
</CollapsibleSection>
|
|
272
266
|
) : undefined;
|
|
273
267
|
|
|
274
268
|
return (
|
|
@@ -894,83 +888,6 @@ function AgentWatchingBadge() {
|
|
|
894
888
|
);
|
|
895
889
|
}
|
|
896
890
|
|
|
897
|
-
// The cue animation re-mounts with every element selection; without this
|
|
898
|
-
// guard it replays each time instead of once per inspector session.
|
|
899
|
-
let commentCuePlayed = false;
|
|
900
|
-
|
|
901
|
-
function CommentsSection({
|
|
902
|
-
selected,
|
|
903
|
-
onAdd,
|
|
904
|
-
}: {
|
|
905
|
-
selected: { line: number; column: number };
|
|
906
|
-
onAdd: (line: number, column: number, text: string) => Promise<void>;
|
|
907
|
-
}) {
|
|
908
|
-
const [draft, setDraft] = useState('');
|
|
909
|
-
const [submitting, setSubmitting] = useState(false);
|
|
910
|
-
const [showCue] = useState(() => !commentCuePlayed);
|
|
911
|
-
const wrapRef = useRef<HTMLDivElement>(null);
|
|
912
|
-
const t = useLocale();
|
|
913
|
-
|
|
914
|
-
useEffect(() => {
|
|
915
|
-
commentCuePlayed = true;
|
|
916
|
-
}, []);
|
|
917
|
-
|
|
918
|
-
useEffect(() => {
|
|
919
|
-
const onKey = (e: KeyboardEvent) => {
|
|
920
|
-
if (e.key !== '/') return;
|
|
921
|
-
if (!(e.metaKey || e.ctrlKey)) return;
|
|
922
|
-
if (e.altKey || e.shiftKey) return;
|
|
923
|
-
const ta = wrapRef.current?.querySelector('textarea');
|
|
924
|
-
if (!ta) return;
|
|
925
|
-
e.preventDefault();
|
|
926
|
-
const details = ta.closest('details');
|
|
927
|
-
if (details) details.open = true;
|
|
928
|
-
ta.focus({ preventScroll: true });
|
|
929
|
-
};
|
|
930
|
-
window.addEventListener('keydown', onKey);
|
|
931
|
-
return () => window.removeEventListener('keydown', onKey);
|
|
932
|
-
}, []);
|
|
933
|
-
|
|
934
|
-
const submit = async () => {
|
|
935
|
-
const trimmed = draft.trim();
|
|
936
|
-
if (!trimmed) return;
|
|
937
|
-
setSubmitting(true);
|
|
938
|
-
try {
|
|
939
|
-
await onAdd(selected.line, selected.column, trimmed);
|
|
940
|
-
setDraft('');
|
|
941
|
-
} finally {
|
|
942
|
-
setSubmitting(false);
|
|
943
|
-
}
|
|
944
|
-
};
|
|
945
|
-
|
|
946
|
-
return (
|
|
947
|
-
<>
|
|
948
|
-
<div ref={wrapRef} className={cn('rounded-[6px]', showCue && 'comment-cue')}>
|
|
949
|
-
<Textarea
|
|
950
|
-
value={draft}
|
|
951
|
-
onChange={(e) => setDraft(e.target.value)}
|
|
952
|
-
onKeyDown={(e) => {
|
|
953
|
-
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
|
|
954
|
-
e.preventDefault();
|
|
955
|
-
submit();
|
|
956
|
-
}
|
|
957
|
-
}}
|
|
958
|
-
placeholder={t.inspector.commentPlaceholder}
|
|
959
|
-
className="min-h-16 resize-none text-[12px]"
|
|
960
|
-
/>
|
|
961
|
-
</div>
|
|
962
|
-
<div className="flex items-center justify-between gap-2">
|
|
963
|
-
<span className="font-mono text-[10.5px] text-muted-foreground/70">
|
|
964
|
-
{t.inspector.commentShortcutHint}
|
|
965
|
-
</span>
|
|
966
|
-
<Button size="sm" variant="brand" disabled={submitting || !draft.trim()} onClick={submit}>
|
|
967
|
-
{t.inspector.addComment}
|
|
968
|
-
</Button>
|
|
969
|
-
</div>
|
|
970
|
-
</>
|
|
971
|
-
);
|
|
972
|
-
}
|
|
973
|
-
|
|
974
891
|
function readSnapshot(el: HTMLElement): ElementSnapshot {
|
|
975
892
|
const cs = getComputedStyle(el);
|
|
976
893
|
const text =
|