@interlacejs/editor 1.1.0 → 1.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/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { Strings, ContentTypeRegistry, SerializedInteractiveMediaDocument, Placement, ContentInstance, Hook } from '@interlacejs/core';
3
+ import { Strings, InterlaceTheme, ContentTypeRegistry, SerializedInteractiveMediaDocument, Placement, ContentInstance, Hook } from '@interlacejs/core';
4
4
 
5
5
  /**
6
6
  * Localized strings consumed by `PreviewModal`. Extends the core
@@ -114,7 +114,12 @@ declare function VideoSourceInput({ value, onChange, onUpload, onError, strings:
114
114
  interface EditorStrings extends Strings {
115
115
  /** Heading for the video source step when no document is loaded. */
116
116
  videoSourceInputTitle: string;
117
- /** Title for the preview surface. */
117
+ /**
118
+ * Title for the preview surface.
119
+ *
120
+ * @deprecated Unused since the editor header shows the save status
121
+ * instead of a heading. Retained for backward compatibility.
122
+ */
118
123
  previewTitle: string;
119
124
  /** Label for the button that opens the preview modal. */
120
125
  previewLabel: string;
@@ -162,6 +167,26 @@ interface EditorStrings extends Strings {
162
167
  loadErrorTitle: string;
163
168
  /** Shown when the video element has not yet reported a duration. */
164
169
  durationUnknownLabel: string;
170
+ /** Prefix for the video duration under the video. */
171
+ durationLabel: string;
172
+ /** Header status while there are unsaved changes. */
173
+ unsavedChangesLabel: string;
174
+ /** Header status after a save with no further changes. */
175
+ savedLabel: string;
176
+ /** Header badge when hooks need attention; `{count}` is replaced. */
177
+ hooksNeedAttentionLabel: string;
178
+ /** Heading of the list shown when Save is blocked by problems. */
179
+ saveBlockedTitle: string;
180
+ /** Button next to each problem that selects the hook. */
181
+ goToHookLabel: string;
182
+ /** Problem: a hook has no title. */
183
+ needsTitleIssue: string;
184
+ /** Problem: a hook has no content type yet. */
185
+ needsContentTypeIssue: string;
186
+ /** Name shown for hooks without a title. */
187
+ untitledHookLabel: string;
188
+ /** Heading of the details column when no hook is selected. */
189
+ noHookSelectedTitle: string;
165
190
  /**
166
191
  * String overrides forwarded to the embedded `VideoSourceInput`. The
167
192
  * first screen of the drop-in component is otherwise unreachable to a
@@ -182,19 +207,12 @@ interface EditorStrings extends Strings {
182
207
  */
183
208
  declare const DEFAULT_EDITOR_STRINGS: EditorStrings;
184
209
  /**
185
- * Optional theme overrides. Hosts that want to recolor the editor without
186
- * shipping a CSS file can pass a `theme`; the editor applies these via
187
- * inline `style` on its root wrapper and on the save button. Anything not
188
- * provided falls back to a neutral default.
210
+ * Optional theme overrides. Every field becomes a `--interlace-*` CSS
211
+ * variable on the editor's root, so it reaches every surface inside it
212
+ * (timeline, Hook details, content editors, preview). Hosts can set the
213
+ * same variables from CSS instead; see `InterlaceTheme` in core.
189
214
  */
190
- interface EditorTheme {
191
- accentColor?: string;
192
- backgroundColor?: string;
193
- surfaceColor?: string;
194
- borderColor?: string;
195
- textColor?: string;
196
- mutedTextColor?: string;
197
- }
215
+ type EditorTheme = InterlaceTheme;
198
216
  interface InterlaceEditorProps {
199
217
  /** Registry of content types available for authoring. */
200
218
  contentTypeRegistry: ContentTypeRegistry;
@@ -226,8 +244,10 @@ interface InterlaceEditorProps {
226
244
  onDirtyChange?: (dirty: boolean) => void;
227
245
  /** Optional string overrides. */
228
246
  strings?: Partial<EditorStrings>;
229
- /** Optional theme overrides. */
247
+ /** Optional theme overrides (see `EditorTheme`). */
230
248
  theme?: EditorTheme;
249
+ /** Extra class name for the editor's root element. */
250
+ className?: string;
231
251
  /** Optional error callback for upload, load, and runtime failures. */
232
252
  onError?: (error: Error) => void;
233
253
  /**
@@ -267,7 +287,7 @@ interface InterlaceEditorProps {
267
287
  * - `adapterType` is a host-level prop (default `"native"`); it is not
268
288
  * written into the serialized document.
269
289
  */
270
- declare function InterlaceEditor({ contentTypeRegistry, document, onUpload, onSave, onDirtyChange, strings: stringsOverride, theme, onError, }: InterlaceEditorProps): React.JSX.Element;
290
+ declare function InterlaceEditor({ contentTypeRegistry, document, onUpload, onSave, onDirtyChange, strings: stringsOverride, theme, className, onError, }: InterlaceEditorProps): React.JSX.Element;
271
291
 
272
292
  interface ContentTypeEditorProps<TData = unknown> {
273
293
  /** The content type to mount, or `null` while the hook has no content type yet. */
@@ -308,13 +328,27 @@ interface ContentTypeEditorSlotProps<TData = unknown> {
308
328
  */
309
329
  declare function ContentTypeEditorSlot<TData = unknown>({ contentTypeId, isOpen, onClose, onSave, registry, data, onChange, }: ContentTypeEditorSlotProps<TData>): React__default.JSX.Element | null;
310
330
 
331
+ /** A content type as shown to authors. */
332
+ interface ContentTypeOption {
333
+ id: string;
334
+ /** Readable name; falls back to the id. */
335
+ label?: string;
336
+ /** One-line description shown under the name. */
337
+ description?: string;
338
+ }
311
339
  interface ContentTypePickerProps {
340
+ /** Registered content type ids (used when `options` is omitted). */
312
341
  registeredTypes: string[];
342
+ /** Named options; takes precedence over `registeredTypes`. */
343
+ options?: ContentTypeOption[];
313
344
  selectedType: string | null;
314
345
  onSelect: (typeId: string) => void;
346
+ /** Accessible name for the group. */
347
+ label?: string;
315
348
  }
316
349
  /**
317
- * ContentTypePicker - dropdown for selecting content type when creating new content.
350
+ * ContentTypePicker - a radio group of content types, each shown with
351
+ * its readable name and description. Arrow keys move between choices.
318
352
  */
319
353
  declare const ContentTypePicker: React__default.FC<ContentTypePickerProps>;
320
354
 
@@ -412,6 +446,24 @@ interface InspectorPanelStrings extends Strings {
412
446
  placementLabel: string;
413
447
  /** Label above the content type row. */
414
448
  contentTypeLabel: string;
449
+ /** Placeholder for the title input. */
450
+ titlePlaceholder: string;
451
+ /** Help text under the title input. */
452
+ titleHint: string;
453
+ /** Description of the blocking type, shown in the type switch. */
454
+ blockingTypeDescription: string;
455
+ /** Description of the non-blocking type, shown in the type switch. */
456
+ nonBlockingTypeDescription: string;
457
+ /** Help text under the position & size inputs. */
458
+ placementHint: string;
459
+ /** Button that reveals the content type choices for a typed hook. */
460
+ changeContentTypeLabel: string;
461
+ /** Warning shown while changing an existing hook's content type. */
462
+ changeContentTypeWarning: string;
463
+ /** Button that cancels changing the content type. */
464
+ cancelChangeContentTypeLabel: string;
465
+ /** Heading for the list of problems with this hook. */
466
+ issuesHeading: string;
415
467
  }
416
468
  declare const DEFAULT_INSPECTOR_PANEL_STRINGS: InspectorPanelStrings;
417
469
  interface InspectorPanelEntry {
@@ -433,6 +485,10 @@ interface InspectorPanelEntry {
433
485
  contentTypeId: string | null;
434
486
  /** Registered content type ids (drives the picker for pending hooks). */
435
487
  registeredTypes: string[];
488
+ /** Readable names/descriptions for the picker; ids are used when omitted. */
489
+ contentTypeOptions?: ContentTypeOption[];
490
+ /** Problems to fix before this hook can be saved. */
491
+ issues?: string[];
436
492
  }
437
493
  interface InspectorPanelProps {
438
494
  entry: InspectorPanelEntry;
@@ -447,6 +503,11 @@ interface InspectorPanelProps {
447
503
  placement?: Placement;
448
504
  onPlacementChange?: (placement: Placement) => void;
449
505
  onDelete: () => void;
506
+ /**
507
+ * Switches between blocking and non-blocking. When omitted the type is
508
+ * shown read-only.
509
+ */
510
+ onHookTypeChange?: (hookType: "blocking" | "non-blocking") => void;
450
511
  strings?: Partial<InspectorPanelStrings>;
451
512
  }
452
513
  /**
@@ -493,6 +554,14 @@ interface KeyframeTimelineStrings extends Strings {
493
554
  blockingKeyframeLabel: string;
494
555
  /** Accessible label prefix for a non-blocking range bar. */
495
556
  nonBlockingRangeLabel: string;
557
+ /** Tooltip for the "add blocking hook" button (where/how it is added). */
558
+ addBlockingHint?: string;
559
+ /** Tooltip for the "add non-blocking hook" button (where/how it is added). */
560
+ addNonBlockingHint?: string;
561
+ /** Shown (and announced) in place of an empty hook title. */
562
+ untitledLabel?: string;
563
+ /** Appended to a hook's accessible label when it needs attention. */
564
+ needsAttentionLabel?: string;
496
565
  }
497
566
  declare const DEFAULT_KEYFRAME_TIMELINE_STRINGS: KeyframeTimelineStrings;
498
567
  interface KeyframeTimelineEntry {
@@ -502,6 +571,10 @@ interface KeyframeTimelineEntry {
502
571
  timestamp?: number;
503
572
  start?: number;
504
573
  end?: number;
574
+ /** Marks the hook with a warning indicator (e.g. missing or invalid content). */
575
+ needsAttention?: boolean;
576
+ /** Announced with the hook when `needsAttention` is set; defaults to `strings.needsAttentionLabel`. */
577
+ attentionLabel?: string;
505
578
  }
506
579
  interface KeyframeTimelineProps {
507
580
  entries: KeyframeTimelineEntry[];
@@ -511,9 +584,13 @@ interface KeyframeTimelineProps {
511
584
  /** Current playhead position in seconds. */
512
585
  currentTime: number;
513
586
  /** Whether the authoring video is currently playing (drives the play/pause button). */
514
- isPlaying: boolean;
587
+ isPlaying?: boolean;
515
588
  onSeek: (time: number) => void;
516
- onTogglePlay: () => void;
589
+ /**
590
+ * Toggles playback. Omit when the host video already has its own
591
+ * controls; the timeline then renders no play button.
592
+ */
593
+ onTogglePlay?: () => void;
517
594
  onSelectEntry: (id: string) => void;
518
595
  onUpdateEntry: (id: string, updates: {
519
596
  timestamp?: number;
@@ -540,8 +617,9 @@ interface KeyframeTimelineProps {
540
617
  * - Drag survives the pointer leaving the strip (pointer capture +
541
618
  * window-level fallbacks — the PlacementEditor pattern).
542
619
  * - Drag snapping is to integer seconds; hold Shift to bypass.
543
- * - Zoom via the +/- buttons or ctrl+wheel (native non-passive listener,
544
- * since React's synthetic onWheel cannot preventDefault).
620
+ * - Zoom via the +/- buttons or the vertical mouse wheel (anchored at the
621
+ * pointer); horizontal wheel / Shift+wheel pans. Native non-passive
622
+ * listener, since React's synthetic onWheel cannot preventDefault.
545
623
  * - Keyboard: the playhead is a slider (arrow keys ±1s, ±5s with Shift);
546
624
  * a selected keyframe nudges with the same keys through `onUpdateEntry`.
547
625
  *
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { Strings, ContentTypeRegistry, SerializedInteractiveMediaDocument, Placement, ContentInstance, Hook } from '@interlacejs/core';
3
+ import { Strings, InterlaceTheme, ContentTypeRegistry, SerializedInteractiveMediaDocument, Placement, ContentInstance, Hook } from '@interlacejs/core';
4
4
 
5
5
  /**
6
6
  * Localized strings consumed by `PreviewModal`. Extends the core
@@ -114,7 +114,12 @@ declare function VideoSourceInput({ value, onChange, onUpload, onError, strings:
114
114
  interface EditorStrings extends Strings {
115
115
  /** Heading for the video source step when no document is loaded. */
116
116
  videoSourceInputTitle: string;
117
- /** Title for the preview surface. */
117
+ /**
118
+ * Title for the preview surface.
119
+ *
120
+ * @deprecated Unused since the editor header shows the save status
121
+ * instead of a heading. Retained for backward compatibility.
122
+ */
118
123
  previewTitle: string;
119
124
  /** Label for the button that opens the preview modal. */
120
125
  previewLabel: string;
@@ -162,6 +167,26 @@ interface EditorStrings extends Strings {
162
167
  loadErrorTitle: string;
163
168
  /** Shown when the video element has not yet reported a duration. */
164
169
  durationUnknownLabel: string;
170
+ /** Prefix for the video duration under the video. */
171
+ durationLabel: string;
172
+ /** Header status while there are unsaved changes. */
173
+ unsavedChangesLabel: string;
174
+ /** Header status after a save with no further changes. */
175
+ savedLabel: string;
176
+ /** Header badge when hooks need attention; `{count}` is replaced. */
177
+ hooksNeedAttentionLabel: string;
178
+ /** Heading of the list shown when Save is blocked by problems. */
179
+ saveBlockedTitle: string;
180
+ /** Button next to each problem that selects the hook. */
181
+ goToHookLabel: string;
182
+ /** Problem: a hook has no title. */
183
+ needsTitleIssue: string;
184
+ /** Problem: a hook has no content type yet. */
185
+ needsContentTypeIssue: string;
186
+ /** Name shown for hooks without a title. */
187
+ untitledHookLabel: string;
188
+ /** Heading of the details column when no hook is selected. */
189
+ noHookSelectedTitle: string;
165
190
  /**
166
191
  * String overrides forwarded to the embedded `VideoSourceInput`. The
167
192
  * first screen of the drop-in component is otherwise unreachable to a
@@ -182,19 +207,12 @@ interface EditorStrings extends Strings {
182
207
  */
183
208
  declare const DEFAULT_EDITOR_STRINGS: EditorStrings;
184
209
  /**
185
- * Optional theme overrides. Hosts that want to recolor the editor without
186
- * shipping a CSS file can pass a `theme`; the editor applies these via
187
- * inline `style` on its root wrapper and on the save button. Anything not
188
- * provided falls back to a neutral default.
210
+ * Optional theme overrides. Every field becomes a `--interlace-*` CSS
211
+ * variable on the editor's root, so it reaches every surface inside it
212
+ * (timeline, Hook details, content editors, preview). Hosts can set the
213
+ * same variables from CSS instead; see `InterlaceTheme` in core.
189
214
  */
190
- interface EditorTheme {
191
- accentColor?: string;
192
- backgroundColor?: string;
193
- surfaceColor?: string;
194
- borderColor?: string;
195
- textColor?: string;
196
- mutedTextColor?: string;
197
- }
215
+ type EditorTheme = InterlaceTheme;
198
216
  interface InterlaceEditorProps {
199
217
  /** Registry of content types available for authoring. */
200
218
  contentTypeRegistry: ContentTypeRegistry;
@@ -226,8 +244,10 @@ interface InterlaceEditorProps {
226
244
  onDirtyChange?: (dirty: boolean) => void;
227
245
  /** Optional string overrides. */
228
246
  strings?: Partial<EditorStrings>;
229
- /** Optional theme overrides. */
247
+ /** Optional theme overrides (see `EditorTheme`). */
230
248
  theme?: EditorTheme;
249
+ /** Extra class name for the editor's root element. */
250
+ className?: string;
231
251
  /** Optional error callback for upload, load, and runtime failures. */
232
252
  onError?: (error: Error) => void;
233
253
  /**
@@ -267,7 +287,7 @@ interface InterlaceEditorProps {
267
287
  * - `adapterType` is a host-level prop (default `"native"`); it is not
268
288
  * written into the serialized document.
269
289
  */
270
- declare function InterlaceEditor({ contentTypeRegistry, document, onUpload, onSave, onDirtyChange, strings: stringsOverride, theme, onError, }: InterlaceEditorProps): React.JSX.Element;
290
+ declare function InterlaceEditor({ contentTypeRegistry, document, onUpload, onSave, onDirtyChange, strings: stringsOverride, theme, className, onError, }: InterlaceEditorProps): React.JSX.Element;
271
291
 
272
292
  interface ContentTypeEditorProps<TData = unknown> {
273
293
  /** The content type to mount, or `null` while the hook has no content type yet. */
@@ -308,13 +328,27 @@ interface ContentTypeEditorSlotProps<TData = unknown> {
308
328
  */
309
329
  declare function ContentTypeEditorSlot<TData = unknown>({ contentTypeId, isOpen, onClose, onSave, registry, data, onChange, }: ContentTypeEditorSlotProps<TData>): React__default.JSX.Element | null;
310
330
 
331
+ /** A content type as shown to authors. */
332
+ interface ContentTypeOption {
333
+ id: string;
334
+ /** Readable name; falls back to the id. */
335
+ label?: string;
336
+ /** One-line description shown under the name. */
337
+ description?: string;
338
+ }
311
339
  interface ContentTypePickerProps {
340
+ /** Registered content type ids (used when `options` is omitted). */
312
341
  registeredTypes: string[];
342
+ /** Named options; takes precedence over `registeredTypes`. */
343
+ options?: ContentTypeOption[];
313
344
  selectedType: string | null;
314
345
  onSelect: (typeId: string) => void;
346
+ /** Accessible name for the group. */
347
+ label?: string;
315
348
  }
316
349
  /**
317
- * ContentTypePicker - dropdown for selecting content type when creating new content.
350
+ * ContentTypePicker - a radio group of content types, each shown with
351
+ * its readable name and description. Arrow keys move between choices.
318
352
  */
319
353
  declare const ContentTypePicker: React__default.FC<ContentTypePickerProps>;
320
354
 
@@ -412,6 +446,24 @@ interface InspectorPanelStrings extends Strings {
412
446
  placementLabel: string;
413
447
  /** Label above the content type row. */
414
448
  contentTypeLabel: string;
449
+ /** Placeholder for the title input. */
450
+ titlePlaceholder: string;
451
+ /** Help text under the title input. */
452
+ titleHint: string;
453
+ /** Description of the blocking type, shown in the type switch. */
454
+ blockingTypeDescription: string;
455
+ /** Description of the non-blocking type, shown in the type switch. */
456
+ nonBlockingTypeDescription: string;
457
+ /** Help text under the position & size inputs. */
458
+ placementHint: string;
459
+ /** Button that reveals the content type choices for a typed hook. */
460
+ changeContentTypeLabel: string;
461
+ /** Warning shown while changing an existing hook's content type. */
462
+ changeContentTypeWarning: string;
463
+ /** Button that cancels changing the content type. */
464
+ cancelChangeContentTypeLabel: string;
465
+ /** Heading for the list of problems with this hook. */
466
+ issuesHeading: string;
415
467
  }
416
468
  declare const DEFAULT_INSPECTOR_PANEL_STRINGS: InspectorPanelStrings;
417
469
  interface InspectorPanelEntry {
@@ -433,6 +485,10 @@ interface InspectorPanelEntry {
433
485
  contentTypeId: string | null;
434
486
  /** Registered content type ids (drives the picker for pending hooks). */
435
487
  registeredTypes: string[];
488
+ /** Readable names/descriptions for the picker; ids are used when omitted. */
489
+ contentTypeOptions?: ContentTypeOption[];
490
+ /** Problems to fix before this hook can be saved. */
491
+ issues?: string[];
436
492
  }
437
493
  interface InspectorPanelProps {
438
494
  entry: InspectorPanelEntry;
@@ -447,6 +503,11 @@ interface InspectorPanelProps {
447
503
  placement?: Placement;
448
504
  onPlacementChange?: (placement: Placement) => void;
449
505
  onDelete: () => void;
506
+ /**
507
+ * Switches between blocking and non-blocking. When omitted the type is
508
+ * shown read-only.
509
+ */
510
+ onHookTypeChange?: (hookType: "blocking" | "non-blocking") => void;
450
511
  strings?: Partial<InspectorPanelStrings>;
451
512
  }
452
513
  /**
@@ -493,6 +554,14 @@ interface KeyframeTimelineStrings extends Strings {
493
554
  blockingKeyframeLabel: string;
494
555
  /** Accessible label prefix for a non-blocking range bar. */
495
556
  nonBlockingRangeLabel: string;
557
+ /** Tooltip for the "add blocking hook" button (where/how it is added). */
558
+ addBlockingHint?: string;
559
+ /** Tooltip for the "add non-blocking hook" button (where/how it is added). */
560
+ addNonBlockingHint?: string;
561
+ /** Shown (and announced) in place of an empty hook title. */
562
+ untitledLabel?: string;
563
+ /** Appended to a hook's accessible label when it needs attention. */
564
+ needsAttentionLabel?: string;
496
565
  }
497
566
  declare const DEFAULT_KEYFRAME_TIMELINE_STRINGS: KeyframeTimelineStrings;
498
567
  interface KeyframeTimelineEntry {
@@ -502,6 +571,10 @@ interface KeyframeTimelineEntry {
502
571
  timestamp?: number;
503
572
  start?: number;
504
573
  end?: number;
574
+ /** Marks the hook with a warning indicator (e.g. missing or invalid content). */
575
+ needsAttention?: boolean;
576
+ /** Announced with the hook when `needsAttention` is set; defaults to `strings.needsAttentionLabel`. */
577
+ attentionLabel?: string;
505
578
  }
506
579
  interface KeyframeTimelineProps {
507
580
  entries: KeyframeTimelineEntry[];
@@ -511,9 +584,13 @@ interface KeyframeTimelineProps {
511
584
  /** Current playhead position in seconds. */
512
585
  currentTime: number;
513
586
  /** Whether the authoring video is currently playing (drives the play/pause button). */
514
- isPlaying: boolean;
587
+ isPlaying?: boolean;
515
588
  onSeek: (time: number) => void;
516
- onTogglePlay: () => void;
589
+ /**
590
+ * Toggles playback. Omit when the host video already has its own
591
+ * controls; the timeline then renders no play button.
592
+ */
593
+ onTogglePlay?: () => void;
517
594
  onSelectEntry: (id: string) => void;
518
595
  onUpdateEntry: (id: string, updates: {
519
596
  timestamp?: number;
@@ -540,8 +617,9 @@ interface KeyframeTimelineProps {
540
617
  * - Drag survives the pointer leaving the strip (pointer capture +
541
618
  * window-level fallbacks — the PlacementEditor pattern).
542
619
  * - Drag snapping is to integer seconds; hold Shift to bypass.
543
- * - Zoom via the +/- buttons or ctrl+wheel (native non-passive listener,
544
- * since React's synthetic onWheel cannot preventDefault).
620
+ * - Zoom via the +/- buttons or the vertical mouse wheel (anchored at the
621
+ * pointer); horizontal wheel / Shift+wheel pans. Native non-passive
622
+ * listener, since React's synthetic onWheel cannot preventDefault.
545
623
  * - Keyboard: the playhead is a slider (arrow keys ±1s, ±5s with Shift);
546
624
  * a selected keyframe nudges with the same keys through `onUpdateEntry`.
547
625
  *