@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.
@@ -35,7 +35,8 @@ export function Root({
35
35
  alignItems: "center",
36
36
  padding: "0 14px",
37
37
  gap: 10,
38
- background: "var(--slidewise-bar-bg, var(--app-bg))",
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 = "Save",
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 ?? "Saving…")
64
+ ? (labels?.saving ?? ctxLabels.save.saving)
63
65
  : phase === "saved"
64
- ? (labels?.saved ?? "Saved")
65
- : (labels?.idle ?? "Save");
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 ?? "Light mode")
31
- : (labels?.toggleToDark ?? "Dark mode");
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
- Smart
61
+ {labels.smart}
60
62
  </span>
61
63
  <input
62
- aria-label="Deck title"
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 = "Undo",
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={ariaLabel}
48
- aria-label={ariaLabel}
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,