@textcortex/slidewise 1.4.0 → 1.5.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/index.mjs +4576 -4462
- package/dist/index.mjs.map +1 -1
- package/dist/slidewise.css +1 -1
- package/package.json +1 -1
- package/src/SlidewiseEditor.css +34 -0
- package/src/SlidewiseEditor.tsx +17 -0
- package/src/SlidewiseFileEditor.tsx +32 -6
- package/src/compound/LabelsContext.tsx +121 -0
- package/src/compound/SlidewiseRoot.tsx +47 -11
- package/src/compound/SurfacesContext.tsx +128 -0
- package/src/compound/index.ts +13 -0
- package/src/compound/parts.tsx +1 -1
- package/src/compound/topbar/Export.tsx +7 -4
- package/src/compound/topbar/Play.tsx +7 -4
- package/src/compound/topbar/Redo.tsx +6 -3
- package/src/compound/topbar/Root.tsx +2 -1
- package/src/compound/topbar/Save.tsx +7 -5
- package/src/compound/topbar/ThemeToggle.tsx +4 -2
- package/src/compound/topbar/Title.tsx +4 -2
- package/src/compound/topbar/Undo.tsx +6 -3
- package/src/index.ts +5 -0
|
@@ -35,7 +35,8 @@ export function Root({
|
|
|
35
35
|
alignItems: "center",
|
|
36
36
|
padding: "0 14px",
|
|
37
37
|
gap: 10,
|
|
38
|
-
background:
|
|
38
|
+
background:
|
|
39
|
+
"var(--slidewise-bg-topbar, var(--slidewise-bar-bg, var(--app-bg)))",
|
|
39
40
|
borderBottom: "1px solid var(--border)",
|
|
40
41
|
boxShadow: "var(--topbar-shadow)",
|
|
41
42
|
fontFamily: "Inter, system-ui, sans-serif",
|
|
@@ -4,6 +4,7 @@ import { useEditorStore } from "@/lib/StoreProvider";
|
|
|
4
4
|
import { useHostCallbacks } from "../HostContext";
|
|
5
5
|
import { useIcons } from "../IconContext";
|
|
6
6
|
import { useReadOnly } from "../ReadOnlyContext";
|
|
7
|
+
import { useLabels } from "../LabelsContext";
|
|
7
8
|
import { chromeBtnStyle, hoverHandlers } from "./styles";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -27,7 +28,7 @@ export interface TopBarSaveProps {
|
|
|
27
28
|
export function Save({
|
|
28
29
|
className,
|
|
29
30
|
style,
|
|
30
|
-
ariaLabel
|
|
31
|
+
ariaLabel,
|
|
31
32
|
labels,
|
|
32
33
|
children,
|
|
33
34
|
}: TopBarSaveProps = {}) {
|
|
@@ -35,6 +36,7 @@ export function Save({
|
|
|
35
36
|
const { onSave: onSaveHost } = useHostCallbacks();
|
|
36
37
|
const icons = useIcons();
|
|
37
38
|
const readOnly = useReadOnly();
|
|
39
|
+
const ctxLabels = useLabels();
|
|
38
40
|
const [phase, setPhase] = useState<"idle" | "saving" | "saved">("idle");
|
|
39
41
|
|
|
40
42
|
if (readOnly) return null;
|
|
@@ -59,16 +61,16 @@ export function Save({
|
|
|
59
61
|
|
|
60
62
|
const text =
|
|
61
63
|
phase === "saving"
|
|
62
|
-
? (labels?.saving ??
|
|
64
|
+
? (labels?.saving ?? ctxLabels.save.saving)
|
|
63
65
|
: phase === "saved"
|
|
64
|
-
? (labels?.saved ??
|
|
65
|
-
: (labels?.idle ??
|
|
66
|
+
? (labels?.saved ?? ctxLabels.save.saved)
|
|
67
|
+
: (labels?.idle ?? ctxLabels.save.idle);
|
|
66
68
|
|
|
67
69
|
return (
|
|
68
70
|
<button
|
|
69
71
|
type="button"
|
|
70
72
|
className={className}
|
|
71
|
-
aria-label={ariaLabel}
|
|
73
|
+
aria-label={ariaLabel ?? ctxLabels.save.idle}
|
|
72
74
|
onClick={onClick}
|
|
73
75
|
style={{ ...chromeBtnStyle(), ...style }}
|
|
74
76
|
{...hoverHandlers()}
|
|
@@ -2,6 +2,7 @@ import type { CSSProperties, ReactNode } from "react";
|
|
|
2
2
|
import { Sun, Moon } from "lucide-react";
|
|
3
3
|
import { useEditor } from "@/lib/StoreProvider";
|
|
4
4
|
import { useIcons } from "../IconContext";
|
|
5
|
+
import { useLabels } from "../LabelsContext";
|
|
5
6
|
import { iconBtnStyle, hoverHandlers } from "./styles";
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -24,11 +25,12 @@ export function ThemeToggle({
|
|
|
24
25
|
const theme = useEditor((s) => s.theme);
|
|
25
26
|
const toggleTheme = useEditor((s) => s.toggleTheme);
|
|
26
27
|
const icons = useIcons();
|
|
28
|
+
const ctxLabels = useLabels();
|
|
27
29
|
|
|
28
30
|
const label =
|
|
29
31
|
theme === "dark"
|
|
30
|
-
? (labels?.toggleToLight ??
|
|
31
|
-
: (labels?.toggleToDark ??
|
|
32
|
+
? (labels?.toggleToLight ?? ctxLabels.themeToggle.toLight)
|
|
33
|
+
: (labels?.toggleToDark ?? ctxLabels.themeToggle.toDark);
|
|
32
34
|
|
|
33
35
|
return (
|
|
34
36
|
<button
|
|
@@ -3,6 +3,7 @@ import { Sparkles } from "lucide-react";
|
|
|
3
3
|
import { useEditor } from "@/lib/StoreProvider";
|
|
4
4
|
import { useIcons } from "../IconContext";
|
|
5
5
|
import { useReadOnly } from "../ReadOnlyContext";
|
|
6
|
+
import { useLabels } from "../LabelsContext";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Deck title input wrapped in the "Smart" pill. Reads + writes
|
|
@@ -23,6 +24,7 @@ export function Title({ className, style }: TopBarTitleProps = {}) {
|
|
|
23
24
|
const setTitle = useEditor((s) => s.setTitle);
|
|
24
25
|
const icons = useIcons();
|
|
25
26
|
const readOnly = useReadOnly();
|
|
27
|
+
const labels = useLabels();
|
|
26
28
|
|
|
27
29
|
return (
|
|
28
30
|
<div
|
|
@@ -56,10 +58,10 @@ export function Title({ className, style }: TopBarTitleProps = {}) {
|
|
|
56
58
|
}}
|
|
57
59
|
>
|
|
58
60
|
{icons.smart ?? <Sparkles size={11} />}
|
|
59
|
-
|
|
61
|
+
{labels.smart}
|
|
60
62
|
</span>
|
|
61
63
|
<input
|
|
62
|
-
aria-label=
|
|
64
|
+
aria-label={labels.titleAriaLabel}
|
|
63
65
|
value={title}
|
|
64
66
|
readOnly={readOnly}
|
|
65
67
|
onChange={(e) => setTitle(e.target.value)}
|
|
@@ -3,6 +3,7 @@ import { Undo2 } from "lucide-react";
|
|
|
3
3
|
import { useEditor } from "@/lib/StoreProvider";
|
|
4
4
|
import { useIcons } from "../IconContext";
|
|
5
5
|
import { useReadOnly } from "../ReadOnlyContext";
|
|
6
|
+
import { useLabels } from "../LabelsContext";
|
|
6
7
|
import { iconBtnStyle, hoverHandlers } from "./styles";
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -31,21 +32,23 @@ export interface TopBarUndoProps {
|
|
|
31
32
|
export function Undo({
|
|
32
33
|
className,
|
|
33
34
|
style,
|
|
34
|
-
ariaLabel
|
|
35
|
+
ariaLabel,
|
|
35
36
|
children,
|
|
36
37
|
}: TopBarUndoProps = {}) {
|
|
37
38
|
const undo = useEditor((s) => s.undo);
|
|
38
39
|
const canUndo = useEditor((s) => s.history.length > 0);
|
|
39
40
|
const icons = useIcons();
|
|
40
41
|
const readOnly = useReadOnly();
|
|
42
|
+
const labels = useLabels();
|
|
43
|
+
const resolvedAria = ariaLabel ?? labels.undo;
|
|
41
44
|
if (readOnly) return null;
|
|
42
45
|
|
|
43
46
|
return (
|
|
44
47
|
<button
|
|
45
48
|
type="button"
|
|
46
49
|
className={className}
|
|
47
|
-
title={
|
|
48
|
-
aria-label={
|
|
50
|
+
title={resolvedAria}
|
|
51
|
+
aria-label={resolvedAria}
|
|
49
52
|
disabled={!canUndo}
|
|
50
53
|
onClick={undo}
|
|
51
54
|
style={{
|
package/src/index.ts
CHANGED
|
@@ -46,6 +46,8 @@ export {
|
|
|
46
46
|
useIcons,
|
|
47
47
|
useReadOnly,
|
|
48
48
|
useDirty,
|
|
49
|
+
useLabels,
|
|
50
|
+
useSurfaces,
|
|
49
51
|
useEditor,
|
|
50
52
|
useEditorStore,
|
|
51
53
|
useSlides,
|
|
@@ -63,6 +65,9 @@ export {
|
|
|
63
65
|
type SelectionSnapshot,
|
|
64
66
|
type SlidewiseHostCallbacks,
|
|
65
67
|
type SlidewiseIcons,
|
|
68
|
+
type SlidewiseLabels,
|
|
69
|
+
type SlidewiseSurfaces,
|
|
70
|
+
type ResolvedLabels,
|
|
66
71
|
type RegionProps,
|
|
67
72
|
type TopBarProps,
|
|
68
73
|
type TopBarSlotId,
|