@signalsafe/slide-editor-react 0.1.2 → 0.1.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## Unreleased
2
+
3
+ ## 0.1.4 — authorized release (2026-11-30)
4
+
5
+ - Require Content Editor 0.1.7 so normal installations receive its validated editor input boundary.
6
+ - Preserve existing runtime, declarations, styling and source implementation fingerprints; refresh the package metadata fingerprint.
7
+
8
+ ## 0.1.3 — authorized release (2026-11-29)
9
+
10
+ Qualify React 18.3.1 and 19.3.1 without changing existing extraction behavior or coverage thresholds. Preserve the published 0.1.2 baseline and require the new content owner exports explicitly in the slide package.
11
+
12
+
13
+ - Extract shared slide workspace state, collection controls, issue navigation and deck commands.
14
+ - Add reusable destination selection, timeline intervals/markers and cursor overlay geometry.
15
+ - Reuse the content owner's overflow measurement while preserving the slide API.
16
+ - Support an explicit local-candidate TypeScript build configuration without changing release defaults.
17
+
1
18
  # Changelog
2
19
 
3
20
  ## @signalsafe/slide-editor-react 0.1.2
package/README.md CHANGED
@@ -1,15 +1,17 @@
1
1
  # @signalsafe/slide-editor-react
2
2
 
3
+ Version 0.1.3: React 18.3.1 and 19.3.1 are qualified with actual owner tests, strict declarations and packed consumers. Defining module imports and host-owned state/events remain unchanged. The published 0.1.2 baseline stays immutable. Publication was authorized on 2026-11-29; matching release workflows and verified registry archives establish availability. No deployment is included.
4
+
3
5
  [Documentation](docs/README.md) · [Current state](docs/current-state-summary.md) ·
4
6
  [Live demo](https://signalsafesoftware.github.io/slide-editor-react/) ·
5
7
  [npm](https://www.npmjs.com/package/@signalsafe/slide-editor-react) ·
6
8
  [GitHub](https://github.com/SignalSafeSoftware/slide-editor-react) · [MIT license](LICENSE)
7
9
 
8
- Reusable controlled slide editing and read-only presentation playback for React 18.
10
+ Reusable controlled slide editing and read-only presentation playback for React 18.3.1 and 19.3.1.
9
11
  The package owns deck operations, outline/overview, playback clocks, speech controls,
10
12
  interaction sessions and responsive viewport primitives. Hosts supply typed content
11
- renderers, identifiers and persistence. Lesson contracts, metadata, publication,
12
- actor-scoped recovery and simulator/image service adapters belong to DeliveryPlus.
13
+ renderers, identifiers and persistence. Domain packages supply lesson contracts, metadata and publication workflows. Hosts supply
14
+ authorization, persistence and simulator/image services.
13
15
 
14
16
  ## Install
15
17
 
@@ -85,3 +87,26 @@ The repository retains its predecessor history and tags. New slide releases use
85
87
  DeliveryPlus retains the `deliveryplus-slides-v3` envelope and existing storage keys;
86
88
  this package does not rename persisted lesson JSON or provide old lesson API aliases.
87
89
  See [release procedure](RELEASING.md) and [migration boundaries](docs/README.md).
90
+
91
+ ## Composing a specialized workspace
92
+
93
+ `SlideEditor` remains the ready-to-use controlled deck editor. Applications requiring
94
+ custom inspectors, issue navigation or timeline tools can compose the same package-owned
95
+ behavior through `useSlideWorkspace`, `SlideWorkspace` and `SlideCollectionPanel`.
96
+ The controller owns selected-slide fallback, focus restoration, preview state,
97
+ continuous playback and volume. The workspace owns sidebar layout and toolbar portals;
98
+ collection rows own accessible keyboard navigation, overview and action presentation.
99
+
100
+ `slideCommands` applies add, duplicate, remove, move and reorder operations to a typed
101
+ `SlideDeck`. Callers supply identity/content factories, limits and the accepted-deck
102
+ callback. A duplicate factory may return `undefined` to reject unavailable source content
103
+ without modifying the deck. Persistence, document envelopes and authorization stay with
104
+ callers. `CopyComponentDialog` accepts typed `{id,title}` destinations and `canCreate`;
105
+ it does not impose an application-specific slide limit.
106
+
107
+ `SlideIssuesPanel` renders issue descriptors with host-provided navigation callbacks.
108
+ `SlideTimeline` renders interval descriptors and clock markers; callbacks own interval
109
+ constraints and event interpretation. `CursorOverlay` measures visible anchor geometry,
110
+ tracks clipping/resize/scroll/mutation changes, and animates generic cursor states.
111
+ Applications supply the anchor resolver, readiness explanation and relevant mutation
112
+ attributes. The package never resolves simulator records or persisted lesson fields.
package/RELEASING.md CHANGED
@@ -42,3 +42,7 @@ publication. Only then replace DeliveryPlus's local migration candidate with the
42
42
  exact registry version and integrity-pinned lockfile and remove its temporary local
43
43
  candidate exception. Run host package/source checks, lint/types, focused integration
44
44
  coverage and affected builds. Preserve unrelated uncommitted host work.
45
+
46
+ ## Authorized 2026-11-29 release without deployment
47
+
48
+ The current package release is authorized; publication remains conditional on its existing verify/release workflow and registry prerequisites. Main merge commit subjects include `[skip deploy]`. The Pages deploy job alone honors this marker; gallery builds, tests and artifact upload still run. Tag workflows publish the verified npm archive and do not trigger Pages. Normal future main pushes and explicit manual Pages runs retain their existing deployment policy. This release does not authorize a Pages or application deployment.
@@ -0,0 +1,10 @@
1
+ export declare function CopyComponentDialog({ slides, sourceId, onClose, onCopy, canCreate, }: Readonly<{
2
+ slides: readonly Readonly<{
3
+ id: string;
4
+ title: string;
5
+ }>[];
6
+ sourceId: string;
7
+ canCreate?: boolean;
8
+ onClose: () => void;
9
+ onCopy: (targetId: string) => string | undefined;
10
+ }>): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Button, Modal } from 'react-bootstrap';
4
+ export function CopyComponentDialog({ slides, sourceId, onClose, onCopy, canCreate = true, }) {
5
+ const [target, setTarget] = useState(slides.find((item) => item.id !== sourceId)?.id ?? '');
6
+ const [error, setError] = useState('');
7
+ return (_jsxs(Modal, { show: true, onHide: onClose, "aria-labelledby": "copy-component-title", centered: true, children: [_jsx(Modal.Header, { closeButton: true, children: _jsx(Modal.Title, { id: "copy-component-title", children: "Copy component to slide" }) }), _jsxs(Modal.Body, { children: [_jsx("p", { children: "The original stays in place. Nested content and appearance are copied with new identities." }), _jsxs("label", { className: "d-block", children: ["Destination slide", ' ', _jsxs("select", { className: "form-select mt-1", value: target, onChange: (event) => {
8
+ setTarget(event.target.value);
9
+ setError('');
10
+ }, children: [_jsx("option", { value: "", disabled: !canCreate, children: "New slide" }), slides
11
+ .filter((slide) => slide.id !== sourceId)
12
+ .map((slide) => (_jsx("option", { value: slide.id, children: slide.title }, slide.id)))] })] }), error && (_jsx("p", { role: "alert", className: "text-danger mt-3", children: error }))] }), _jsxs(Modal.Footer, { children: [_jsx(Button, { variant: "secondary", onClick: onClose, children: "Cancel" }), _jsx(Button, { onClick: () => {
13
+ const message = onCopy(target);
14
+ if (message)
15
+ setError(message);
16
+ else
17
+ onClose();
18
+ }, children: "Copy component" })] })] }));
19
+ }
@@ -0,0 +1,27 @@
1
+ export interface CursorOverlayState<Anchor> {
2
+ event: {
3
+ id: string;
4
+ from: Anchor;
5
+ to: Anchor;
6
+ color: string;
7
+ rotationDegrees: number;
8
+ };
9
+ progress: number;
10
+ ringProgress?: number;
11
+ }
12
+ interface Point {
13
+ x: number;
14
+ y: number;
15
+ }
16
+ /** Intersect with clipping ancestors inside the canvas, including the phone's viewport. */
17
+ export declare function visibleAnchorPoint(element: HTMLElement, canvas: HTMLElement): Point | undefined;
18
+ /** Animated cursor geometry; domain anchor lookup and readiness remain with the host. */
19
+ export declare function CursorOverlay<Anchor>({ cursor, contextKey, resolve, reason, onIssue, mutationAttributes }: Readonly<{
20
+ cursor?: CursorOverlayState<Anchor>;
21
+ contextKey: string;
22
+ resolve: (canvas: HTMLElement, anchor: Anchor) => HTMLElement | undefined;
23
+ reason?: (anchor: Anchor) => string | undefined;
24
+ onIssue?: (message: string) => void;
25
+ mutationAttributes?: readonly string[];
26
+ }>): import("react").JSX.Element;
27
+ export {};
@@ -0,0 +1,134 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useLayoutEffect, useRef, useState } from 'react';
3
+ const DEFAULT_MUTATION_ATTRIBUTES = ['hidden', 'style', 'class'];
4
+ /** Intersect with clipping ancestors inside the canvas, including the phone's viewport. */
5
+ export function visibleAnchorPoint(element, canvas) {
6
+ if (element.closest('[hidden]'))
7
+ return;
8
+ const style = getComputedStyle(element);
9
+ if (style.display === 'none' || style.visibility === 'hidden' || style.opacity === '0')
10
+ return;
11
+ let { left, right, top, bottom } = element.getBoundingClientRect();
12
+ for (let parent = element.parentElement; parent && parent !== canvas; parent = parent.parentElement) {
13
+ const computed = getComputedStyle(parent);
14
+ if (computed.display === 'none' || computed.visibility === 'hidden' || parent.hidden)
15
+ return;
16
+ const bounds = parent.getBoundingClientRect();
17
+ if (/(auto|scroll|hidden|clip)/.test(computed.overflowX)) {
18
+ left = Math.max(left, bounds.left);
19
+ right = Math.min(right, bounds.right);
20
+ }
21
+ if (/(auto|scroll|hidden|clip)/.test(computed.overflowY)) {
22
+ top = Math.max(top, bounds.top);
23
+ bottom = Math.min(bottom, bounds.bottom);
24
+ }
25
+ }
26
+ if (right <= left || bottom <= top)
27
+ return;
28
+ const bounds = canvas.getBoundingClientRect();
29
+ const scaleX = bounds.width / (canvas.offsetWidth || bounds.width);
30
+ const scaleY = bounds.height / (canvas.offsetHeight || bounds.height);
31
+ if (!scaleX || !scaleY)
32
+ return;
33
+ return {
34
+ x: ((left + right) / 2 - bounds.left) / scaleX,
35
+ y: ((top + bottom) / 2 - bounds.top) / scaleY,
36
+ };
37
+ }
38
+ /** Animated cursor geometry; domain anchor lookup and readiness remain with the host. */
39
+ export function CursorOverlay({ cursor, contextKey, resolve, reason, onIssue, mutationAttributes = DEFAULT_MUTATION_ATTRIBUTES }) {
40
+ const overlay = useRef(null);
41
+ const [geometry, setGeometry] = useState();
42
+ const [reducedMotion, setReducedMotion] = useState(() => window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false);
43
+ const event = cursor?.event;
44
+ const key = JSON.stringify([contextKey, event?.id, event?.from, event?.to]);
45
+ useLayoutEffect(() => {
46
+ const media = window.matchMedia?.('(prefers-reduced-motion: reduce)');
47
+ if (!media)
48
+ return;
49
+ const change = () => setReducedMotion(media.matches);
50
+ media.addEventListener?.('change', change);
51
+ return () => media.removeEventListener?.('change', change);
52
+ }, []);
53
+ useLayoutEffect(() => {
54
+ const canvas = overlay.current?.parentElement;
55
+ if (!canvas || !event) {
56
+ setGeometry(undefined);
57
+ onIssue?.('');
58
+ return;
59
+ }
60
+ let frame = 0;
61
+ let observed = new Set();
62
+ const measure = () => {
63
+ const fromElement = resolve(canvas, event.from);
64
+ const toElement = resolve(canvas, event.to);
65
+ const nextObserved = new Set([fromElement, toElement].filter((element) => element !== undefined));
66
+ for (const element of observed)
67
+ if (!nextObserved.has(element))
68
+ resize?.unobserve(element);
69
+ for (const element of nextObserved)
70
+ if (!observed.has(element))
71
+ resize?.observe(element);
72
+ observed = nextObserved;
73
+ const from = fromElement && visibleAnchorPoint(fromElement, canvas);
74
+ const to = toElement && visibleAnchorPoint(toElement, canvas);
75
+ if (!from || !to) {
76
+ setGeometry(undefined);
77
+ onIssue?.(reason?.(!from ? event.from : event.to) ??
78
+ 'The cursor target is not visible.');
79
+ return;
80
+ }
81
+ setGeometry((current) => current?.key === key &&
82
+ current.from.x === from.x &&
83
+ current.from.y === from.y &&
84
+ current.to.x === to.x &&
85
+ current.to.y === to.y
86
+ ? current
87
+ : { key, from, to });
88
+ onIssue?.('');
89
+ };
90
+ const schedule = () => {
91
+ cancelAnimationFrame(frame);
92
+ frame = requestAnimationFrame(measure);
93
+ };
94
+ const resize = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(schedule);
95
+ resize?.observe(canvas);
96
+ measure();
97
+ const mutation = new MutationObserver((records) => {
98
+ if (records.some((record) => !overlay.current?.contains(record.target)))
99
+ measure();
100
+ });
101
+ mutation.observe(canvas, {
102
+ childList: true,
103
+ subtree: true,
104
+ attributes: true,
105
+ attributeFilter: [...mutationAttributes],
106
+ });
107
+ canvas.addEventListener('scroll', schedule, true);
108
+ window.addEventListener('resize', schedule);
109
+ return () => {
110
+ cancelAnimationFrame(frame);
111
+ resize?.disconnect();
112
+ mutation.disconnect();
113
+ canvas.removeEventListener('scroll', schedule, true);
114
+ window.removeEventListener('resize', schedule);
115
+ };
116
+ }, [event, key, resolve, reason, mutationAttributes, onIssue]);
117
+ const ready = geometry?.key === key && cursor ? geometry : undefined;
118
+ const progress = reducedMotion ? 1 : (cursor?.progress ?? 0);
119
+ const x = ready ? ready.from.x + (ready.to.x - ready.from.x) * progress : 0;
120
+ const y = ready ? ready.from.y + (ready.to.y - ready.from.y) * progress : 0;
121
+ return (_jsx("div", { className: "lesson-demo-overlay", ref: overlay, "aria-hidden": "true", children: ready && cursor && (_jsxs(_Fragment, { children: [_jsx("div", { className: "lesson-demo-cursor", "data-event-id": cursor.event.id, "data-progress": cursor.progress, style: {
122
+ left: x,
123
+ top: y,
124
+ color: cursor.event.color,
125
+ transform: `translate(-1px, -1px) rotate(${cursor.event.rotationDegrees}deg)`,
126
+ }, children: _jsx("svg", { width: "30", height: "36", viewBox: "0 0 30 36", focusable: "false", children: _jsx("path", { d: "M1 1 L1 27 L8 20 L13 32 L19 29 L13 17 L25 17 Z", fill: "currentColor", stroke: "white", strokeWidth: "1.5" }) }) }), cursor.ringProgress !== undefined && (_jsx("div", { className: "lesson-demo-click", "data-ring-progress": cursor.ringProgress, style: {
127
+ left: x,
128
+ top: y,
129
+ width: reducedMotion ? 36 : 16 + cursor.ringProgress * 40,
130
+ height: reducedMotion ? 36 : 16 + cursor.ringProgress * 40,
131
+ color: cursor.event.color,
132
+ opacity: reducedMotion ? 1 : 1 - cursor.ringProgress,
133
+ } }))] })) }));
134
+ }
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { Slide } from './deck.js';
3
+ import type { useSlideWorkspace } from './useSlideWorkspace.js';
4
+ /** Shared slide navigation and mutation controls; factories and policy stay with the caller. */
5
+ export declare function SlideCollectionPanel<S extends Slide>({ slides, workspace, readOnly, canAdd, title, renderThumbnail, onAdd, onDuplicate, onMove, onRemove, onReorder, onAddContent, children }: Readonly<{
6
+ slides: readonly S[];
7
+ workspace: ReturnType<typeof useSlideWorkspace<S>>;
8
+ readOnly: boolean;
9
+ canAdd: boolean;
10
+ title?: (slide: S) => string;
11
+ renderThumbnail: (slide: S) => ReactNode;
12
+ onAdd: () => void;
13
+ onDuplicate: (position?: number) => void;
14
+ onMove: (offset: number, position?: number) => void;
15
+ onRemove: (position?: number) => void;
16
+ onReorder: (source: string, target: string, after?: boolean) => void;
17
+ onAddContent: () => void;
18
+ children?: ReactNode;
19
+ }>): import("react").JSX.Element;
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from 'react-bootstrap';
3
+ import { EditorPanel } from '@signalsafe/content-editor-react/EditorPanel';
4
+ import { EditorCollectionAdd } from '@signalsafe/content-editor-react/EditorCollectionAdd';
5
+ import { CollectionRowActions } from '@signalsafe/content-editor-react/CollectionRowActions';
6
+ import { isContentEditingTarget } from '@signalsafe/content-editor-react/contentEditingCommands';
7
+ import { collectionEditingCommand } from '@signalsafe/content-editor-react/collectionNavigation';
8
+ import { SlideOutline } from './SlideOutline.js';
9
+ import { SlideOverview } from './SlideOverview.js';
10
+ /** Shared slide navigation and mutation controls; factories and policy stay with the caller. */
11
+ export function SlideCollectionPanel({ slides, workspace, readOnly, canAdd, title, renderThumbnail, onAdd, onDuplicate, onMove, onRemove, onReorder, onAddContent, children }) {
12
+ const { index, expanded, setExpanded, overview, setOverview, select, requestSlideFocus, editing } = workspace;
13
+ const slide = slides[index];
14
+ if (!slide)
15
+ throw new Error('A slide collection must contain a slide.');
16
+ return (_jsx(EditorPanel, { title: "Slides", fields: false, className: "slide-tree-panel", actions: _jsxs(_Fragment, { children: [" ", !readOnly && (_jsx(Button, { variant: "outline-secondary", size: "sm", type: "button", className: "ms-auto me-2", "aria-label": "Slide overview", title: overview ? 'Show outline' : 'Show slide thumbnails', "aria-pressed": overview, onClick: (event) => {
17
+ event.preventDefault();
18
+ event.stopPropagation();
19
+ setOverview(!overview);
20
+ }, children: _jsx("i", { className: overview ? 'bi bi-list-ul' : 'bi bi-grid-3x2-gap', "aria-hidden": "true" }) })), editing && (_jsx(EditorCollectionAdd, { label: "Add slide", disabled: !canAdd, onAdd: onAdd }))] }), children: overview ? (_jsx(SlideOverview, { slides: slides, renderThumbnail: renderThumbnail, selectedId: slide.id, editing: editing, onSelect: select, onReorder: onReorder })) : (_jsx(SlideOutline, { slides: slides, selectedId: slide.id, editing: editing, expanded: expanded, title: item => title?.(item) || item.title, onSelect: select, onToggle: position => { if (position === index)
21
+ setExpanded(value => !value);
22
+ else
23
+ select(position); }, onReorder: onReorder, onKeyDown: (event, position) => {
24
+ const item = slides[position];
25
+ if (isContentEditingTarget(event.target))
26
+ return;
27
+ const command = collectionEditingCommand(event, position, slides.length);
28
+ if (!command || (!editing && command.kind !== 'select'))
29
+ return;
30
+ event.preventDefault();
31
+ event.stopPropagation();
32
+ switch (command.kind) {
33
+ case 'select': {
34
+ requestSlideFocus(slides[command.index].id);
35
+ select(command.index);
36
+ break;
37
+ }
38
+ case 'move':
39
+ onMove(command.offset, position);
40
+ break;
41
+ case 'duplicate':
42
+ onDuplicate(position);
43
+ break;
44
+ case 'delete':
45
+ onRemove(position);
46
+ break;
47
+ case 'collapse':
48
+ requestSlideFocus(item.id);
49
+ select(position);
50
+ setExpanded(false);
51
+ break;
52
+ case 'expand':
53
+ requestSlideFocus(item.id, position === index && expanded ? 'child' : 'row');
54
+ select(position);
55
+ break;
56
+ case 'edit':
57
+ requestSlideFocus(item.id, 'inspector');
58
+ select(position);
59
+ break;
60
+ }
61
+ }, actions: position => editing && position === index && _jsx(CollectionRowActions, { className: "slide-row-actions", index: index, count: slides.length, readOnly: !editing, duplicateDisabled: !canAdd, addDisabled: false, labels: { duplicate: 'Duplicate slide', up: 'Move up', down: 'Move down', add: 'Add element', delete: 'Remove slide' }, titles: { duplicate: 'Duplicate slide', up: 'Move up', down: 'Move down', add: 'Add element', delete: 'Remove slide' }, onDuplicate: onDuplicate, onMove: onMove, onAdd: onAddContent, onDelete: onRemove }), children: children })) }));
62
+ }
@@ -1,6 +1,6 @@
1
- import { type ReactNode } from 'react';
1
+ import type { ReactNode } from 'react';
2
2
  import { type Slide, type SlideDeck } from './deck.js';
3
- import { type SlidePlaybackState } from './usePlayback.js';
3
+ import type { SlidePlaybackState } from './usePlayback.js';
4
4
  /** Controlled slide shell. Domain inspectors, data providers and content renderers are slots. */
5
5
  export declare function SlideEditor<S extends Slide, C>({ deck, onChange, renderSlide, readOnly, label, createSlide, duplicateSlide, children }: Readonly<{
6
6
  deck: SlideDeck<S, C>;
@@ -1,31 +1,28 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
2
  import { EditorSidebarLayout } from '@signalsafe/content-editor-react/EditorSidebarLayout';
4
3
  import { EditorPanel } from '@signalsafe/content-editor-react/EditorPanel';
5
4
  import { Button } from 'react-bootstrap';
6
5
  import { SlideOutline } from './SlideOutline.js';
7
6
  import { SlidePlaybackControls } from './SlidePlaybackControls.js';
8
7
  import { insertSlide, removeSlide, replaceSlides, reorderSlide } from './deck.js';
9
- import { usePlayback } from './usePlayback.js';
8
+ import { useSlideWorkspace } from './useSlideWorkspace.js';
10
9
  /** Controlled slide shell. Domain inspectors, data providers and content renderers are slots. */
11
10
  export function SlideEditor({ deck, onChange, renderSlide, readOnly = false, label = 'Slide editor', createSlide, duplicateSlide, children }) {
12
- const [selectedId, setSelectedId] = useState(deck.slides[0]?.id);
13
- const [volume, setVolume] = useState(1);
14
- const slide = deck.slides.find(item => item.id === selectedId) ?? deck.slides[0];
11
+ const workspace = useSlideWorkspace(deck.slides, readOnly, undefined, { selection: 'identity', advanceOnComplete: false });
12
+ const { index, volume, setVolume, playback, select, setRequestedId } = workspace;
13
+ const slide = deck.slides[index];
15
14
  if (!slide)
16
15
  throw new Error('A presentation must contain a slide.');
17
- const playback = usePlayback(slide.durationMs, slide.id);
18
16
  const editing = !readOnly && !!onChange;
19
- const select = (index) => { playback.pause(); setSelectedId(deck.slides[index]?.id); };
20
17
  return _jsx("section", { className: "slide-editor content-editor-shell", "aria-label": label, children: _jsxs(EditorSidebarLayout, { showRight: false, children: [_jsx("aside", { children: _jsx(EditorPanel, { title: "Slides", actions: editing && createSlide && _jsx(Button, { type: "button", size: "sm", onClick: () => {
21
18
  const next = createSlide();
22
19
  onChange?.(insertSlide(deck, next.slide, next.content));
23
- setSelectedId(next.slide.id);
20
+ setRequestedId(next.slide.id);
24
21
  }, children: "Add slide" }), children: _jsx(SlideOutline, { slides: deck.slides, selectedId: slide.id, editing: !readOnly && !!onChange, expanded: false, actions: position => editing && _jsxs(_Fragment, { children: [duplicateSlide && _jsx(Button, { type: "button", size: "sm", "aria-label": `Duplicate slide ${position + 1}`, onClick: () => {
25
22
  const original = deck.slides[position];
26
23
  const next = duplicateSlide(original, deck.content[original.id]);
27
24
  onChange?.(insertSlide(deck, next.slide, next.content, position + 1));
28
- setSelectedId(next.slide.id);
25
+ setRequestedId(next.slide.id);
29
26
  }, children: "Duplicate" }), _jsx(Button, { type: "button", size: "sm", "aria-label": `Remove slide ${position + 1}`, disabled: deck.slides.length === 1, onClick: () => onChange?.(removeSlide(deck, deck.slides[position].id)), children: "Remove" })] }), onSelect: select, onToggle: select, onReorder: (source, target, after) => onChange?.(reorderSlide(deck, source, target, after)) }) }) }), _jsxs("div", { "data-slide-deck-current": true, children: [renderSlide(slide, deck.content[slide.id], playback.timeMs, content => { if (editing)
30
27
  onChange?.(replaceSlides(deck, deck.slides, { ...deck.content, [slide.id]: content })); }, { ...playback, volume }), children, _jsx(SlidePlaybackControls, { playback: playback, durationMs: slide.durationMs, volume: volume, onVolume: setVolume })] })] }) });
31
28
  }
@@ -14,8 +14,8 @@ export declare function SlideInteractionProvider({ children, onNavigate, canNavi
14
14
  type?: string;
15
15
  props: Readonly<{
16
16
  id: string;
17
- parentId?: string | null;
18
- eventKey?: string | null;
17
+ parentId?: string | null | undefined;
18
+ eventKey?: string | null | undefined;
19
19
  }>;
20
20
  }>[];
21
21
  selectedId?: string;
@@ -0,0 +1,11 @@
1
+ export type SlideIssue = Readonly<{
2
+ id: string;
3
+ title: string;
4
+ message: string;
5
+ severity: 'danger' | 'warning';
6
+ onSelect: () => void;
7
+ }>;
8
+ /** Generic issue navigation. The host maps schema paths and domain diagnostics. */
9
+ export declare function SlideIssuesPanel({ issues }: Readonly<{
10
+ issues: readonly SlideIssue[];
11
+ }>): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ListGroup } from 'react-bootstrap';
3
+ import { EditorIssuesPanel } from '@signalsafe/content-editor-react/EditorIssuesPanel';
4
+ /** Generic issue navigation. The host maps schema paths and domain diagnostics. */
5
+ export function SlideIssuesPanel({ issues }) {
6
+ return _jsx(EditorIssuesPanel, { count: issues.length, children: _jsxs(ListGroup, { variant: "flush", as: "ul", className: "list-unstyled", "aria-live": "polite", children: [issues.map(issue => _jsx("li", { children: _jsxs(ListGroup.Item, { as: "button", action: true, type: "button", variant: issue.severity, onClick: issue.onSelect, children: [_jsx("strong", { className: "d-block", children: issue.title }), issue.message] }) }, issue.id)), !issues.length && _jsx(ListGroup.Item, { as: "li", children: _jsx("em", { className: "text-muted", children: "No issues" }) })] }) });
7
+ }
@@ -5,7 +5,7 @@ import { ReorderTarget } from '@signalsafe/content-editor-react/ReorderTarget';
5
5
  import { ReorderHandle, SLIDE_DRAG_TYPE } from '@signalsafe/content-editor-react/ReorderHandle';
6
6
  /** Shared slide rows; hosts add their selected slide's content tree and domain actions. */
7
7
  export function SlideOutline({ slides, selectedId, editing, expanded, title, onSelect, onToggle, onKeyDown, onReorder, actions, children }) {
8
- return _jsx(ListGroup, { variant: "flush", className: "slide-tree-list editor-tree-list", role: "region", "aria-label": "Slides and content", tabIndex: 0, children: slides.map((slide, position) => _jsxs("div", { children: [_jsx(ReorderTarget, { className: "slide-tree-row", type: SLIDE_DRAG_TYPE, label: `slide ${position + 1}`, onMove: (source, after) => { if (editing)
8
+ return _jsx(ListGroup, { "data-content-collection-tree": true, variant: "flush", className: "slide-tree-list editor-tree-list", role: "region", "aria-label": "Slides and content", tabIndex: 0, children: slides.map((slide, position) => _jsxs("div", { children: [_jsx(ReorderTarget, { className: "slide-tree-row", type: SLIDE_DRAG_TYPE, label: `slide ${position + 1}`, onMove: (source, after) => { if (editing)
9
9
  onReorder(source, slide.id, after); }, children: _jsx(EditorCollectionRow, { id: slide.id, index: position, title: title?.(slide) || slide.title, selected: slide.id === selectedId, current: slide.id === selectedId ? 'step' : undefined, expanded: editing ? slide.id === selectedId && expanded : undefined, toggleLabel: `${slide.id === selectedId && expanded ? 'Collapse' : 'Expand'} slide ${position + 1}`, onToggle: () => onToggle(position), onSelect: () => onSelect(position), onKeyDown: event => onKeyDown?.(event, position), handle: editing && _jsx(ReorderHandle, { id: slide.id, label: `slide ${position + 1}`, type: SLIDE_DRAG_TYPE, onMove: offset => {
10
10
  const target = slides[position + offset];
11
11
  if (target)
@@ -0,0 +1,27 @@
1
+ export type TimelineInterval = Readonly<{
2
+ id: string;
3
+ text?: string;
4
+ startSeconds: number;
5
+ endSeconds: number;
6
+ }>;
7
+ export type TimelineMarker = Readonly<{
8
+ id: string;
9
+ atMs: number;
10
+ label: string;
11
+ color?: string;
12
+ endMs?: number;
13
+ }>;
14
+ /** A shared clock ruler; callers own interval constraints and event semantics. */
15
+ export declare function SlideTimeline({ intervals, events, timeMs, onSeek, durationMs, onIntervalChange, onSelect, selectedEventId, onSelectEvent, intervalLabel, label }: Readonly<{
16
+ intervals: readonly TimelineInterval[];
17
+ events?: readonly TimelineMarker[];
18
+ timeMs: number;
19
+ onSeek: (timeMs: number) => void;
20
+ durationMs: number;
21
+ onIntervalChange: (id: string, edge: 'start' | 'end', valueSeconds: number) => void;
22
+ onSelect: (id: string) => void;
23
+ selectedEventId?: string;
24
+ onSelectEvent?: (id: string) => void;
25
+ intervalLabel?: string;
26
+ label?: string;
27
+ }>): import("react").JSX.Element | null;
@@ -0,0 +1,65 @@
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ const STEP_SECONDS = 0.1;
4
+ function timePosition(fraction) {
5
+ return `${fraction * 100}%`;
6
+ }
7
+ /** A shared clock ruler; callers own interval constraints and event semantics. */
8
+ export function SlideTimeline({ intervals, events = [], timeMs, onSeek, durationMs, onIntervalChange, onSelect, selectedEventId, onSelectEvent, intervalLabel = 'Interval', label = 'Slide timeline' }) {
9
+ const [selectedId, setSelectedId] = useState('');
10
+ const selected = intervals.find((item) => item.id === selectedId) ?? intervals[0];
11
+ if (!selected && !events.length)
12
+ return null;
13
+ const eventGroups = new Map();
14
+ events.forEach((event, index) => {
15
+ const group = eventGroups.get(event.atMs);
16
+ if (group)
17
+ group.push({ event, index });
18
+ else
19
+ eventGroups.set(event.atMs, [{ event, index }]);
20
+ });
21
+ const duration = durationMs / 1000;
22
+ const start = selected?.startSeconds ?? 0;
23
+ const end = selected?.endSeconds ?? duration;
24
+ const name = `${intervalLabel} ${selected ? intervals.indexOf(selected) + 1 : 0}`;
25
+ const bound = (value) => Math.max(0, Math.min(duration, value));
26
+ const fraction = (value) => Math.max(0, Math.min(1, value / durationMs));
27
+ return (_jsxs("section", { className: "lesson-callout-timeline mb-2", "aria-label": label, children: [intervals.length > 1 && (_jsx("select", { className: "form-select form-select-sm mb-2", "aria-label": `${intervalLabel} timing selection`, value: selected?.id, onChange: (event) => {
28
+ setSelectedId(event.target.value);
29
+ onSelect(event.target.value);
30
+ }, children: intervals.map((block, index) => (_jsxs("option", { value: block.id, children: [intervalLabel, " ", index + 1, ": ", block.text || 'Untitled'] }, block.id))) })), _jsxs("div", { className: "lesson-timeline-active", children: [_jsx("div", { className: "d-flex justify-content-end", children: _jsxs("output", { className: "text-nowrap small", children: [start, "\u2013", end, "s"] }) }), _jsxs("div", { className: "lesson-time-track mt-3", onPointerDown: (event) => {
31
+ if (event.target instanceof Element &&
32
+ event.target.closest('input, button, select'))
33
+ return;
34
+ const bounds = event.currentTarget.getBoundingClientRect();
35
+ const origin = bounds.left + event.currentTarget.clientLeft;
36
+ const travel = event.currentTarget.clientWidth;
37
+ if (travel > 0)
38
+ onSeek(Math.round(Math.max(0, Math.min(1, (event.clientX - origin) / travel)) *
39
+ durationMs));
40
+ }, children: [_jsx("input", { type: "range", min: 0, max: durationMs, step: 100, value: timeMs, "aria-label": "Slide time", "aria-valuetext": `${(timeMs / 1000).toFixed(1)} seconds`, className: "lesson-time-range lesson-time-playhead", onChange: (event) => onSeek(Number(event.target.value)) }), _jsx("div", { className: "lesson-time-cursor", "aria-hidden": "true", style: { left: timePosition(fraction(timeMs)) } }), selected && (_jsxs(_Fragment, { children: [_jsx("div", { className: "lesson-time-window", style: {
41
+ left: timePosition(bound(start) / duration),
42
+ right: timePosition(1 - Math.max(bound(start), bound(end)) / duration),
43
+ } }), _jsx("input", { type: "range", min: 0, max: duration, step: STEP_SECONDS, value: bound(start), className: "lesson-time-range lesson-time-start", "aria-label": `${name} show time`, "aria-valuetext": `${start} seconds`, onChange: (event) => onIntervalChange(selected.id, 'start', Number(event.target.value)) }), _jsx("input", { type: "range", min: 0, max: duration, step: STEP_SECONDS, value: bound(end), className: "lesson-time-range lesson-time-end", "aria-label": `${name} hide time`, "aria-valuetext": `${end} seconds`, onChange: (event) => onIntervalChange(selected.id, 'end', Number(event.target.value)) })] })), events.map((event) => event.endMs !== undefined && (_jsx("span", { className: "lesson-timeline-motion", "aria-hidden": "true", style: {
44
+ left: timePosition(fraction(event.atMs)),
45
+ width: timePosition(fraction(event.endMs) - fraction(event.atMs)),
46
+ background: event.color,
47
+ } }, event.id))), Array.from(eventGroups, ([atMs, group]) => {
48
+ const first = group[0];
49
+ if (group.length === 1)
50
+ return (_jsx("button", { type: "button", className: "lesson-timeline-event", style: {
51
+ left: timePosition(fraction(atMs)),
52
+ ...(first.event.endMs !== undefined
53
+ ? { background: first.event.color }
54
+ : {}),
55
+ }, title: first.event.label, "aria-label": `Select timeline event ${first.index + 1}`, "aria-pressed": first.event.id === selectedEventId, onClick: () => onSelectEvent?.(first.event.id) }, atMs));
56
+ const selectedEvent = group.find(({ event }) => event.id === selectedEventId);
57
+ return (_jsxs("select", { className: "form-select form-select-sm lesson-timeline-event-group", style: { left: timePosition(fraction(atMs)) }, "aria-label": `Timeline events at ${atMs / 1000} seconds`, title: selectedEvent
58
+ ? selectedEvent.event.label
59
+ : `${group.length} events at ${atMs / 1000}s`, "data-selected": selectedEvent ? true : undefined, value: selectedEvent?.event.id ?? '', onChange: (change) => {
60
+ const selection = group.find(({ event }) => event.id === change.target.value);
61
+ if (selection)
62
+ onSelectEvent?.(selection.event.id);
63
+ }, children: [_jsxs("option", { value: "", disabled: true, children: [group.length, " events"] }), group.map(({ event }) => (_jsx("option", { value: event.id, children: event.label }, event.id)))] }, atMs));
64
+ })] }), selected && (start >= end || end > duration) && (_jsx("small", { className: "text-warning-emphasis", children: "Timing extends outside this slide or needs correction in the inspector." }))] })] }));
65
+ }
@@ -0,0 +1,18 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { EditorSiteTheme } from '@signalsafe/content-editor-react/EditorLayoutMenu';
3
+ import type { Slide } from './deck.js';
4
+ import type { useSlideWorkspace } from './useSlideWorkspace.js';
5
+ /** Portable three-column workspace. Domain content, diagnostics and toolbar commands are slots. */
6
+ export declare function SlideWorkspace<S extends Slide>({ workspace, className, columnsClassName, label, readOnly, siteTheme, controlsTarget, tools, collection, issues, children }: Readonly<{
7
+ workspace: ReturnType<typeof useSlideWorkspace<S>>;
8
+ className?: string;
9
+ columnsClassName?: string;
10
+ label?: string;
11
+ readOnly: boolean;
12
+ siteTheme?: EditorSiteTheme;
13
+ controlsTarget?: HTMLElement | null;
14
+ tools?: ReactNode;
15
+ collection: ReactNode;
16
+ issues?: ReactNode;
17
+ children: ReactNode;
18
+ }>): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import { EditorSidebarLayout } from '@signalsafe/content-editor-react/EditorSidebarLayout';
5
+ /** Portable three-column workspace. Domain content, diagnostics and toolbar commands are slots. */
6
+ export function SlideWorkspace({ workspace, className, columnsClassName, label = 'Slide workspace', readOnly, siteTheme, controlsTarget, tools, collection, issues, children }) {
7
+ const [sidebarControlsTarget, setSidebarControlsTarget] = useState(null);
8
+ const { root, editing, preview, moveAnnouncement, setInspector } = workspace;
9
+ const controls = _jsxs("div", { className: "lesson-workspace-tools d-flex flex-wrap align-items-center gap-2", children: [_jsx("span", { ref: setSidebarControlsTarget }), tools] });
10
+ return _jsxs("section", { ref: root, className: ['slide-editor content-editor-shell', className].filter(Boolean).join(' '), "data-preview": preview, "aria-label": label, children: [!readOnly && (controlsTarget ? createPortal(controls, controlsTarget) : controls), _jsxs(EditorSidebarLayout, { className: columnsClassName, showRight: editing && !preview, controlsTarget: sidebarControlsTarget, siteTheme: siteTheme, children: [_jsxs("aside", { "aria-label": "Slides tree", children: [_jsx("output", { className: "visually-hidden", children: moveAnnouncement }), collection, issues] }), _jsx("div", { className: "lesson-slide-center", children: children }), editing && _jsx("aside", { className: "content-editor-inspector", ref: setInspector, "aria-label": "Slide inspector" })] })] });
11
+ }
@@ -53,3 +53,246 @@
53
53
  font: var(--bs-body-font-size) / var(--bs-body-line-height) var(--bs-body-font-family);
54
54
  color: var(--bs-body-color);
55
55
  }
56
+
57
+ /* Shared slide ruler and event markers. */
58
+
59
+ .lesson-callout-timeline {
60
+ background: var(--bs-body-bg);
61
+ }
62
+
63
+ .lesson-time-track {
64
+ position: relative;
65
+ height: 2rem;
66
+ background: var(--bs-tertiary-bg);
67
+ border: 1px solid var(--bs-border-color);
68
+ border-radius: var(--bs-border-radius);
69
+ }
70
+
71
+ .lesson-time-window {
72
+ position: absolute;
73
+ top: 0;
74
+ bottom: 0;
75
+ background: var(--bs-primary-bg-subtle);
76
+ border-inline: 2px solid var(--bs-primary);
77
+ pointer-events: none;
78
+ }
79
+
80
+ .lesson-time-range {
81
+ position: absolute;
82
+ inset: 0 auto 0 calc(var(--lesson-time-thumb-size, 1rem) / -2);
83
+ width: calc(100% + var(--lesson-time-thumb-size, 1rem));
84
+ margin: 0;
85
+ background: transparent;
86
+ pointer-events: none;
87
+ appearance: none;
88
+ }
89
+
90
+ .lesson-time-range::-webkit-slider-runnable-track {
91
+ background: transparent;
92
+ }
93
+
94
+ .lesson-time-range::-webkit-slider-thumb {
95
+ appearance: none;
96
+ width: var(--lesson-time-thumb-size, 1rem);
97
+ height: 1.75rem;
98
+ border: 2px solid var(--bs-body-bg);
99
+ border-radius: 0.25rem;
100
+ background: var(--bs-primary);
101
+ cursor: ew-resize;
102
+ pointer-events: auto;
103
+ }
104
+
105
+ .lesson-time-range::-moz-range-track {
106
+ background: transparent;
107
+ }
108
+
109
+ .lesson-time-range::-moz-range-thumb {
110
+ width: var(--lesson-time-thumb-size, 1rem);
111
+ height: 1.75rem;
112
+ border: 2px solid var(--bs-body-bg);
113
+ border-radius: 0.25rem;
114
+ background: var(--bs-primary);
115
+ cursor: ew-resize;
116
+ pointer-events: auto;
117
+ }
118
+
119
+ .lesson-time-range:focus-visible {
120
+ outline: 2px solid var(--bs-primary);
121
+ outline-offset: 3px;
122
+ }
123
+
124
+ .lesson-time-start {
125
+ z-index: 1;
126
+ }
127
+
128
+ .lesson-time-end {
129
+ z-index: 2;
130
+ }
131
+
132
+ /* One shared scale: round playback marker above the callout's rectangular bounds. */
133
+ .lesson-time-playhead {
134
+ z-index: 3;
135
+ top: -0.6rem;
136
+ bottom: auto;
137
+ height: 1rem;
138
+ }
139
+
140
+ .lesson-time-playhead::-webkit-slider-thumb {
141
+ width: var(--lesson-time-thumb-size, 1rem);
142
+ height: 1rem;
143
+ border-radius: 50%;
144
+ background: var(--bs-dark);
145
+ cursor: ew-resize;
146
+ }
147
+
148
+ .lesson-time-playhead::-moz-range-thumb {
149
+ width: var(--lesson-time-thumb-size, 1rem);
150
+ height: 1rem;
151
+ border-radius: 50%;
152
+ background: var(--bs-dark);
153
+ cursor: ew-resize;
154
+ }
155
+
156
+ .lesson-time-cursor {
157
+ position: absolute;
158
+ transform: translateX(-50%);
159
+ top: 0;
160
+ bottom: 0;
161
+ border-left: 2px solid var(--bs-dark);
162
+ pointer-events: none;
163
+ z-index: 2;
164
+ }
165
+
166
+ .lesson-time-playhead:focus-visible {
167
+ outline: none;
168
+ }
169
+
170
+ .lesson-time-playhead:focus-visible::-webkit-slider-thumb {
171
+ outline: 2px solid var(--bs-primary);
172
+ outline-offset: 2px;
173
+ }
174
+
175
+ .lesson-time-playhead:focus-visible::-moz-range-thumb {
176
+ outline: 2px solid var(--bs-primary);
177
+ outline-offset: 2px;
178
+ }
179
+
180
+ .lesson-timeline-event {
181
+ position: absolute;
182
+ z-index: 3;
183
+ top: -1.1rem;
184
+ width: 1rem;
185
+ height: 1rem;
186
+ padding: 0;
187
+ border: 2px solid var(--bs-body-bg);
188
+ border-radius: 50%;
189
+ background: var(--bs-info);
190
+ transform: translateX(-50%);
191
+ }
192
+
193
+ .lesson-timeline-event[aria-pressed='true'] {
194
+ outline: 2px solid var(--bs-primary);
195
+ outline-offset: 1px;
196
+ }
197
+
198
+ .lesson-timeline-motion {
199
+ position: absolute;
200
+ bottom: 0;
201
+ height: 0.25rem;
202
+ pointer-events: none;
203
+ }
204
+
205
+
206
+ /* Same-time events share one exact clock position and remain individually selectable. */
207
+ .lesson-timeline-event-group {
208
+ position: absolute;
209
+ z-index: 4;
210
+ top: -2.25rem;
211
+ width: 5rem;
212
+ min-height: 0;
213
+ padding-block: 0.1rem;
214
+ font-size: 0.75rem;
215
+ transform: translateX(-50%);
216
+ }
217
+
218
+ .lesson-timeline-event-group[data-selected='true'] {
219
+ border-color: var(--bs-primary);
220
+ }
221
+
222
+ /* Shared cursor overlay. */
223
+
224
+ .lesson-demo-overlay {
225
+ position: absolute;
226
+ inset: 0;
227
+ pointer-events: none;
228
+ z-index: 10;
229
+ }
230
+
231
+ .lesson-demo-cursor {
232
+ position: absolute;
233
+ transform-origin: 1px 1px;
234
+ line-height: 0;
235
+ }
236
+
237
+ .lesson-demo-click {
238
+ position: absolute;
239
+ border: 3px solid currentColor;
240
+ border-radius: 50%;
241
+ transform: translate(-50%, -50%);
242
+ }
243
+
244
+ .lesson-slides-columns {
245
+ display: grid;
246
+ align-items: start;
247
+ }
248
+ .lesson-slides-columns > *,
249
+ .lesson-slide-center {
250
+ min-width: 0;
251
+ }
252
+ .slide-editor .lesson-slide-center {
253
+ border: 1px solid var(--bs-border-color);
254
+ border-radius: var(--bs-border-radius);
255
+ background: var(--bs-body-bg);
256
+ }
257
+ .slide-editor .lesson-slide-center:has(.slide-authoring) {
258
+ border: 0;
259
+ }
260
+ .slide-editor .lesson-slide-center:has(.slide-authoring) > .center-playback-footer {
261
+ border: 1px solid var(--bs-border-color);
262
+ border-radius: 0 0 var(--bs-border-radius) var(--bs-border-radius);
263
+ }
264
+ .slide-editor .slide-settings label {
265
+ display: block;
266
+ margin: 0;
267
+ }
268
+ .slide-editor .slide-settings label > :is(input, select) {
269
+ margin-top: 0.25rem;
270
+ }
271
+ .slide-editor .slide-settings {
272
+ display: grid;
273
+ gap: 0.75rem;
274
+ min-width: 0;
275
+ }
276
+ .slide-editor .lesson-slide-center:has(.slide-authoring:not([data-active-tab='Canvas']))
277
+ .center-playback-footer {
278
+ display: none;
279
+ }
280
+ .slide-editor .narration-settings {
281
+ border: 0;
282
+ display: flex;
283
+ flex-wrap: wrap;
284
+ align-items: center;
285
+ gap: 1rem;
286
+ }
287
+ .slide-editor .narration-settings label {
288
+ min-width: 0;
289
+ }
290
+ .slide-editor .narration-settings .editor-checkbox {
291
+ display: flex;
292
+ align-items: center;
293
+ gap: 0.5rem;
294
+ }
295
+ .slide-editor .narration-settings legend {
296
+ font-size: 1rem;
297
+ font-weight: 600;
298
+ }
@@ -0,0 +1,23 @@
1
+ import { type Slide, type SlideDeck } from './deck.js';
2
+ import type { useSlideWorkspace } from './useSlideWorkspace.js';
3
+ /** Pure deck commands with host-supplied identity/content factories and mutation policy. */
4
+ export declare function slideCommands<S extends Slide, C>({ deck, workspace, canAdd, onChange, create, duplicate: duplicateFactory }: Readonly<{
5
+ deck: SlideDeck<S, C>;
6
+ workspace: ReturnType<typeof useSlideWorkspace<S>>;
7
+ canAdd: boolean;
8
+ onChange: (deck: SlideDeck<S, C>, label: string) => void;
9
+ create: (index: number) => {
10
+ slide: S;
11
+ content: C;
12
+ };
13
+ duplicate: (slide: S, content: C) => {
14
+ slide: S;
15
+ content: C;
16
+ } | undefined;
17
+ }>): {
18
+ add: () => void;
19
+ duplicate: (position?: number) => void;
20
+ remove: (position?: number) => void;
21
+ move: (offset: number, position?: number) => void;
22
+ reorder: (sourceId: string, targetId: string, after?: boolean) => void;
23
+ };
@@ -0,0 +1,18 @@
1
+ import { insertSlide, removeSlide, reorderSlide } from './deck.js';
2
+ /** Pure deck commands with host-supplied identity/content factories and mutation policy. */
3
+ export function slideCommands({ deck, workspace, canAdd, onChange, create, duplicate: duplicateFactory }) {
4
+ const { index, editing, select, requestSlideFocus, setMoveAnnouncement } = workspace;
5
+ const add = () => { if (!editing || !canAdd)
6
+ return; const next = create(deck.slides.length); onChange(insertSlide(deck, next.slide, next.content), 'Slide added'); select(deck.slides.length); };
7
+ const duplicate = (position = index) => { if (!editing || !canAdd)
8
+ return; const source = deck.slides[position]; if (!source || !Object.hasOwn(deck.content, source.id))
9
+ return; const next = duplicateFactory(source, deck.content[source.id]); if (!next)
10
+ return; onChange(insertSlide(deck, next.slide, next.content, position + 1), 'Slide duplicated'); requestSlideFocus(next.slide.id); select(position + 1); };
11
+ const remove = (position = index) => { if (!editing || deck.slides.length <= 1)
12
+ return; const next = removeSlide(deck, deck.slides[position].id); onChange(next, 'Slide deleted'); const nextIndex = Math.min(position, next.slides.length - 1); requestSlideFocus(next.slides[nextIndex].id); select(nextIndex); };
13
+ const move = (offset, position = index) => { const target = position + offset; if (!editing || target < 0 || target >= deck.slides.length)
14
+ return; const source = deck.slides[position]; const slides = [...deck.slides]; slides.splice(position, 1); slides.splice(target, 0, source); onChange({ ...deck, slides }, 'Slide moved'); requestSlideFocus(source.id); select(target); };
15
+ const reorder = (sourceId, targetId, after = false) => { const source = deck.slides.find(item => item.id === sourceId); if (!editing || !source || sourceId === targetId)
16
+ return; const next = reorderSlide(deck, sourceId, targetId, after); onChange(next, 'Slide moved'); select(next.slides.findIndex(item => item.id === deck.slides[index].id)); setMoveAnnouncement(`Slide order updated. ${source.title} is now slide ${next.slides.indexOf(source) + 1}.`); };
17
+ return { add, duplicate, remove, move, reorder };
18
+ }
@@ -1,22 +1,30 @@
1
1
  {
2
+ "src/CopyComponentDialog.tsx": "a94690c9b57eb47c808c343201e264b514880d59a423b091bce12865ef48b599",
3
+ "src/CursorOverlay.tsx": "35b5363627e9a0599e51273f2b185089c30b043ab234375f1cd34e695ed63c59",
2
4
  "src/ResponsiveViewport.tsx": "f6ebba20cbc95e27a69e1ae98b002d38f21d00f3121822bc104b75815935d654",
3
- "src/SlideEditor.tsx": "275733cb08c03fe0bd9e0ee2aabf6df754a06c616cb7c25c97dca5a8841ac4d2",
4
- "src/SlideInteractions.tsx": "f519f643431b0d292d5b42ecf7301c48d1ad40e4a5285035f8be66b2b74fda99",
5
- "src/SlideOutline.tsx": "e286ac3cf2f049b3dd670e7daefa9bf96f3d243368be0cd39a9904c89d44c09c",
5
+ "src/SlideCollectionPanel.tsx": "dc3cec042d9614f305199b6c5c24065eea74ef39a8ef6c2baf548877eeb5adaa",
6
+ "src/SlideEditor.tsx": "a66480d68a01fa0e58d985e7b1204e8358acf7f9ff3a7b131f2d9046be254826",
7
+ "src/SlideInteractions.tsx": "3cef67c530cd97e715ce264ec278c1dc5358eee32443dfd4eaa27dc23ee15dba",
8
+ "src/SlideIssuesPanel.tsx": "5aab462eeea585bc708e1b9d986b0565f508671bf68efffca252f6a1405ae966",
9
+ "src/SlideOutline.tsx": "e8cbcd8c1386c0f03bda744604add1e23fef0e3ae1431d1f2ab1f153678b0ee6",
6
10
  "src/SlideOverview.tsx": "bc69f5813071ad7d2b4d8fe2b47c19b72556a4a7242897a3ff7f5e9fd10e82aa",
7
11
  "src/SlidePlaybackControls.tsx": "d69fdf5646b9b72dc79df3d694c41f02a58b84b05dbf560142c30a8ef53a1eee",
8
12
  "src/SlidePlayer.tsx": "8ad893667c8661d2dd805a112f54017d6fd5e3da7f6a170607abae107a8af158",
13
+ "src/SlideTimeline.tsx": "96af0dfe489b3283aa46c28e72cc26cc66296511318bf49392e689ef8fa9fe83",
14
+ "src/SlideWorkspace.tsx": "08d6a06ed5da0d252f01bd153038f0d1830a4b028de367f456fb34b2e31a1f13",
9
15
  "src/SpeechControls.tsx": "e76ef5a6ddf8d2da1ab7ba5a8258e269523820b266d93cedf6d5cc19a6801226",
10
16
  "src/deck.ts": "116360eaec4fa6dd44d5ffb859e4a3b64c2e85e33e89649fd4c1ab5346885b87",
11
17
  "src/narration.ts": "9d299bfb41ddd7fad3a37f75b84229a7e14d21485e61dff8b4f63a2cdb82f4c8",
12
18
  "src/narrationDom.ts": "63dc17012fe6208f78a6ad941efc953331a78d4e31dbfbe33a6f3577eafcd000",
13
- "src/slide-editor.css": "b1783a0bbedd679c05c2cf33fe06ef1098002d6d0b1649dcabca48d156067bdd",
19
+ "src/slide-editor.css": "f55ffea7302cd0b3b5634d20b8316c0390375f7d2fbe40d9e94e3945347cde91",
20
+ "src/slideCommands.ts": "89c3883ca41e6ef82d60a4c4ea167a90b04a50a224865221e4593a87187991d0",
14
21
  "src/styles.d.ts": "92928288338e79b01c9489616dd824dcddf1f22cb6a520056c8f516a69ea46cd",
15
22
  "src/thumbnailObservers.ts": "07f2e0efb338d0826076bef72963b491b44894c3658d5425cfe0799f73794750",
16
- "src/useCanvasOverflow.ts": "0d0bce25398b0441ac6761a0070d7bc93eb91e4f3025cd4ccb3be39550c16dc6",
23
+ "src/useCanvasOverflow.ts": "591fc96a2e31c43c87f95c4f05877f6c72069b9865e5a43710a12b1fe7198dc7",
17
24
  "src/usePlayback.ts": "832e37693e73013f6dd37ed7f26c3432ff69a68cf2c1c541fe1f16f2e9ba20ae",
25
+ "src/useSlideWorkspace.ts": "46af462f6a0627be112efac4376c3d9d79e2c896a6e94ae7c6c5edd6a8cdc5d6",
18
26
  "src/validationIssueRows.ts": "9aefc967eddbb5878ece976f54c364b346142855e65e4a3c6d8c5c6c6c482c9c",
19
- "package.json": "22c4f2a0da5137578feb3a3340a819496554be234fa936bca46f0fb8bd6febf2",
27
+ "package.json": "74bb950dc565d0804651599ac862b60b7303b6cb38f0e5e7b3a9585b442911d2",
20
28
  "tsconfig.json": "d0afb06c670b0c2aafbbd4809e34d79bb65a82073561efe96b6e86736fffb71e",
21
- "scripts/build.mjs": "c3451e4cb3222d84cb41640d7392b20b93cfbb0b78d31c2a275a009a8da142ba"
29
+ "scripts/build.mjs": "9a9d3a89a1d811640dc3fcad70c03a2c38ec5fb6216003286d235d02651c5947"
22
30
  }
@@ -1,5 +1,5 @@
1
- import { type RefObject } from 'react';
2
- /** Measure authored leaf content, not the intentionally scrollable viewport or device shell. */
1
+ import type { RefObject } from 'react';
2
+ /** Slide consumers use the content owner's leaf-overflow measurement. */
3
3
  export declare function useCanvasOverflow(canvas: RefObject<HTMLElement | null>, blocks: readonly {
4
4
  type: string;
5
5
  props: {
@@ -1,51 +1,5 @@
1
- import { useEffect, useLayoutEffect, useRef } from 'react';
2
- /** Measure authored leaf content, not the intentionally scrollable viewport or device shell. */
1
+ import { useContentOverflow } from '@signalsafe/content-editor-react/useContentOverflow';
2
+ /** Slide consumers use the content owner's leaf-overflow measurement. */
3
3
  export function useCanvasOverflow(canvas, blocks, enabled, width, onChange) {
4
- const callback = useRef(onChange);
5
- useLayoutEffect(() => { callback.current = onChange; }, [onChange]);
6
- useEffect(() => {
7
- const element = canvas.current;
8
- if (!enabled || !element) {
9
- callback.current?.([]);
10
- return;
11
- }
12
- let frame = 0;
13
- const measure = () => {
14
- cancelAnimationFrame(frame);
15
- frame = requestAnimationFrame(() => {
16
- const ids = blocks
17
- .filter((block) => !['Row', 'Column'].includes(block.type))
18
- .flatMap((block) => blockOverflows(element, block.props.id) ? [block.props.id] : []);
19
- callback.current?.(ids);
20
- });
21
- };
22
- const resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);
23
- resize?.observe(element);
24
- const observer = new MutationObserver(measure);
25
- observer.observe(element, {
26
- subtree: true,
27
- childList: true,
28
- characterData: true,
29
- attributes: true,
30
- attributeFilter: ['style', 'class', 'hidden'],
31
- });
32
- element.addEventListener('load', measure, true);
33
- measure();
34
- return () => {
35
- cancelAnimationFrame(frame);
36
- resize?.disconnect();
37
- observer.disconnect();
38
- element.removeEventListener('load', measure, true);
39
- };
40
- }, [canvas, blocks, enabled, width]);
41
- }
42
- function blockOverflows(element, id) {
43
- const node = Array.from(element.querySelectorAll('[data-block-id]'))
44
- .find((item) => item.dataset.blockId === id);
45
- if (!node || node.querySelector('.content-inline-editor'))
46
- return false;
47
- const children = Array.from(node.children)
48
- .filter((item) => !item.hasAttribute('data-slide-canvas-tools'));
49
- return children.some((item) => item.clientWidth > 0 &&
50
- item.scrollWidth > Math.min(item.clientWidth, node.clientWidth) + 2);
4
+ useContentOverflow(canvas, blocks, enabled, width, onChange);
51
5
  }
@@ -0,0 +1,45 @@
1
+ import type { Slide } from './deck.js';
2
+ /** Selection, focus and continuous playback shared by slide-authoring workspaces. */
3
+ export declare function useSlideWorkspace<S extends Slide>(slides: readonly S[], readOnly?: boolean, onPreviewChange?: (preview: boolean) => void, options?: Readonly<{
4
+ selection?: 'index' | 'identity';
5
+ advanceOnComplete?: boolean;
6
+ }>): {
7
+ index: number;
8
+ root: import("react").RefObject<HTMLElement>;
9
+ requestSlideFocus: (id: string, target?: "row" | "inspector" | "child") => void;
10
+ moveAnnouncement: string;
11
+ setMoveAnnouncement: import("react").Dispatch<import("react").SetStateAction<string>>;
12
+ addOpen: boolean;
13
+ setAddOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
14
+ preview: boolean;
15
+ changePreview: (value: boolean) => void;
16
+ overview: boolean;
17
+ setOverview: import("react").Dispatch<import("react").SetStateAction<boolean>>;
18
+ continuous: boolean;
19
+ setContinuous: import("react").Dispatch<import("react").SetStateAction<boolean>>;
20
+ selection: number;
21
+ expanded: boolean;
22
+ setExpanded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
23
+ inspector: HTMLElement | null;
24
+ setInspector: import("react").Dispatch<import("react").SetStateAction<HTMLElement | null>>;
25
+ tree: HTMLElement | null;
26
+ setTree: import("react").Dispatch<import("react").SetStateAction<HTMLElement | null>>;
27
+ volume: number;
28
+ setVolume: import("react").Dispatch<import("react").SetStateAction<number>>;
29
+ setBusy: import("react").Dispatch<import("react").SetStateAction<boolean>>;
30
+ playback: {
31
+ timeMs: number;
32
+ playing: boolean;
33
+ speed: number;
34
+ revision: number;
35
+ pause: () => void;
36
+ seek: (next: number) => void;
37
+ setSpeed: import("react").Dispatch<import("react").SetStateAction<number>>;
38
+ play: () => void;
39
+ };
40
+ setRequestedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
41
+ setRequestedId: import("react").Dispatch<import("react").SetStateAction<string>>;
42
+ select: (position: number) => void;
43
+ openComponentPicker: () => void;
44
+ editing: boolean;
45
+ };
@@ -0,0 +1,83 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ import { findOutlineElement } from '@signalsafe/content-editor-react/collectionNavigation';
3
+ import { usePlayback } from './usePlayback.js';
4
+ /** Selection, focus and continuous playback shared by slide-authoring workspaces. */
5
+ export function useSlideWorkspace(slides, readOnly = false, onPreviewChange, options = {}) {
6
+ const [requestedIndex, setRequestedIndex] = useState(0);
7
+ const [requestedId, setRequestedId] = useState(slides[0]?.id);
8
+ const identityIndex = slides.findIndex(slide => slide.id === requestedId);
9
+ const index = options.selection === 'identity' ? Math.max(0, identityIndex) : slides[requestedIndex] ? requestedIndex : 0;
10
+ const root = useRef(null);
11
+ const focusSlide = useRef(undefined);
12
+ const collectionFocus = useRef('row');
13
+ const [moveAnnouncement, setMoveAnnouncement] = useState('');
14
+ const [addOpen, setAddOpen] = useState(false);
15
+ const [preview, setPreview] = useState(false);
16
+ const changePreview = (value) => { setPreview(value); onPreviewChange?.(value); };
17
+ const [overview, setOverview] = useState(false);
18
+ const [continuous, setContinuous] = useState(false);
19
+ const [selection, setSelection] = useState(0);
20
+ const [expanded, setExpanded] = useState(true);
21
+ const [inspector, setInspector] = useState(null);
22
+ const [tree, setTree] = useState(null);
23
+ const [busy, setBusy] = useState(false);
24
+ const [volume, setVolume] = useState(1);
25
+ const slide = slides[index];
26
+ const playback = usePlayback(slide?.durationMs ?? 0, slide?.id ?? '', busy, () => {
27
+ if (options.advanceOnComplete === false)
28
+ return;
29
+ if (index < slides.length - 1) {
30
+ setRequestedIndex(index + 1);
31
+ setRequestedId(slides[index + 1].id);
32
+ }
33
+ else
34
+ setContinuous(false);
35
+ });
36
+ const play = playback.play;
37
+ useEffect(() => { if (continuous)
38
+ play(); }, [slide?.id, continuous, play]);
39
+ useEffect(() => {
40
+ if (!focusSlide.current)
41
+ return;
42
+ if (collectionFocus.current === 'row') {
43
+ findOutlineElement(root.current, 'data-outline-collection', focusSlide.current)?.focus();
44
+ focusSlide.current = undefined;
45
+ return;
46
+ }
47
+ const target = collectionFocus.current;
48
+ const frame = requestAnimationFrame(() => {
49
+ if (target === 'inspector')
50
+ inspector?.querySelector('input, textarea, select')?.focus();
51
+ else {
52
+ const child = tree?.querySelector('[data-outline-block]');
53
+ child?.click();
54
+ child?.focus();
55
+ }
56
+ focusSlide.current = undefined;
57
+ collectionFocus.current = 'row';
58
+ });
59
+ return () => cancelAnimationFrame(frame);
60
+ }, [slides, index, selection, inspector, tree]);
61
+ const select = (position) => {
62
+ if (options.selection === 'identity') {
63
+ playback.pause();
64
+ setRequestedId(slides[position]?.id);
65
+ return;
66
+ }
67
+ setContinuous(false);
68
+ playback.pause();
69
+ playback.seek(0);
70
+ setRequestedIndex(position);
71
+ setExpanded(true);
72
+ setSelection(value => value + 1);
73
+ };
74
+ const openComponentPicker = () => { playback.pause(); setExpanded(true); setAddOpen(true); };
75
+ const requestSlideFocus = (id, target = 'row') => {
76
+ focusSlide.current = id;
77
+ collectionFocus.current = target;
78
+ };
79
+ return { index, root, requestSlideFocus, moveAnnouncement, setMoveAnnouncement,
80
+ addOpen, setAddOpen, preview, changePreview, overview, setOverview, continuous, setContinuous,
81
+ selection, expanded, setExpanded, inspector, setInspector, tree, setTree, volume, setVolume,
82
+ setBusy, playback, setRequestedIndex, setRequestedId, select, openComponentPicker, editing: !readOnly && !preview };
83
+ }
@@ -1,5 +1,9 @@
1
1
  # slide-editor-react current state
2
2
 
3
+ ## Version 0.1.3 — release authorized 2026-11-29
4
+
5
+ The current source preserves the DeliveryPlus installed published runtime baseline and qualifies React 18.3.1 and 19.3.1. New lower dependencies use the already-consumed core 0.7.4, simulator theme 0.13.6 and editor theme 0.3.9 where applicable. The sealed archives identify the original review cohort. Publication was authorized on 2026-11-29; matching release workflows and verified registry archives establish availability. No deployment is included. Older dated release receipts below retain their original versions and publication context.
6
+
3
7
  ## Initial release 0.1.0
4
8
 
5
9
  This is the first distribution under `@signalsafe/slide-editor-react`. Its predecessor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalsafe/slide-editor-react",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "description": "Reusable controlled slide decks, editing navigation, narration and presentation playback.",
6
6
  "license": "MIT",
@@ -77,6 +77,38 @@
77
77
  "./SlidePlayer": {
78
78
  "types": "./dist/SlidePlayer.d.ts",
79
79
  "import": "./dist/SlidePlayer.js"
80
+ },
81
+ "./useSlideWorkspace": {
82
+ "types": "./dist/useSlideWorkspace.d.ts",
83
+ "import": "./dist/useSlideWorkspace.js"
84
+ },
85
+ "./CopyComponentDialog": {
86
+ "types": "./dist/CopyComponentDialog.d.ts",
87
+ "import": "./dist/CopyComponentDialog.js"
88
+ },
89
+ "./SlideCollectionPanel": {
90
+ "types": "./dist/SlideCollectionPanel.d.ts",
91
+ "import": "./dist/SlideCollectionPanel.js"
92
+ },
93
+ "./SlideTimeline": {
94
+ "types": "./dist/SlideTimeline.d.ts",
95
+ "import": "./dist/SlideTimeline.js"
96
+ },
97
+ "./SlideIssuesPanel": {
98
+ "types": "./dist/SlideIssuesPanel.d.ts",
99
+ "import": "./dist/SlideIssuesPanel.js"
100
+ },
101
+ "./SlideWorkspace": {
102
+ "types": "./dist/SlideWorkspace.d.ts",
103
+ "import": "./dist/SlideWorkspace.js"
104
+ },
105
+ "./slideCommands": {
106
+ "types": "./dist/slideCommands.d.ts",
107
+ "import": "./dist/slideCommands.js"
108
+ },
109
+ "./CursorOverlay": {
110
+ "types": "./dist/CursorOverlay.d.ts",
111
+ "import": "./dist/CursorOverlay.js"
80
112
  }
81
113
  },
82
114
  "scripts": {
@@ -91,17 +123,17 @@
91
123
  "showcase:check": "node showcase/check-build.mjs"
92
124
  },
93
125
  "dependencies": {
94
- "@signalsafe/content-editor-react": "0.1.5",
126
+ "@signalsafe/content-editor-react": "^0.1.7",
95
127
  "zod": "4.6.7"
96
128
  },
97
129
  "peerDependencies": {
98
130
  "bootstrap": "^5.3.3",
99
- "react": "^18.3.1",
131
+ "react": "^18.3.1 || ^19.3.1",
100
132
  "react-bootstrap": "^2.10.2",
101
- "react-dom": "^18.3.1"
133
+ "react-dom": "^18.3.1 || ^19.3.1"
102
134
  },
103
135
  "devDependencies": {
104
- "@eslint/js": "^10.0.1",
136
+ "@eslint/js": "9.39.5",
105
137
  "@testing-library/dom": "^10.4.0",
106
138
  "@testing-library/jest-dom": "^8.0.0",
107
139
  "@testing-library/react": "^16.0.1",
@@ -136,5 +168,8 @@
136
168
  "bugs": {
137
169
  "url": "https://github.com/SignalSafeSoftware/slide-editor-react/issues"
138
170
  },
139
- "packageManager": "yarn@1.22.22"
171
+ "packageManager": "yarn@1.22.22",
172
+ "engines": {
173
+ "node": ">=24"
174
+ }
140
175
  }