@lingjingai/script-editor 0.3.0 → 0.3.1

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.ts CHANGED
@@ -563,6 +563,19 @@ interface ScriptEditorProps extends ScriptEditorAdapters {
563
563
  /** the floating bottom-center capsule (save status + AI-diff + 返回 breadcrumb).
564
564
  * Default true. Set false for a pure display surface with no floating chrome. */
565
565
  showSaveCapsule?: boolean;
566
+ /** per-action hover (target on enter, null on leave) — pair with `highlights`
567
+ * to build a hover-to-highlight effect entirely host-side. */
568
+ onActionHover?: (target: {
569
+ episodeIdx: number;
570
+ sceneId: string;
571
+ actionIndex: number;
572
+ } | null) => void;
573
+ /** per-action click, with full address. */
574
+ onActionClick?: (target: {
575
+ episodeIdx: number;
576
+ sceneId: string;
577
+ actionIndex: number;
578
+ }) => void;
566
579
  }
567
580
  /** A host range highlight targeting one action (same coords as DiffActionMark). */
568
581
  interface ScriptHighlight {
@@ -574,7 +587,7 @@ interface ScriptHighlight {
574
587
  className?: string;
575
588
  style?: React.CSSProperties;
576
589
  }
577
- declare function ScriptEditor({ value, onEdit: onEditProp, selection: controlledSelection, onSelectionChange, format: controlledFormat, onFormatChange, disabled, className, dark, toc, onTitleChange, topBarActions, saveStatus, canUndo, canRedo, onUndo, onRedo, onEditingChange, referenceFocusRequest, scrollScopeKey, showAssets, showTitle, showFormatToggle, paper, showTimestamp, highlights, contentWidth, showSaveCapsule, diff, asset, onAddChatReferences, onRequestAssetDelete, }: ScriptEditorProps): react.JSX.Element;
590
+ declare function ScriptEditor({ value, onEdit: onEditProp, selection: controlledSelection, onSelectionChange, format: controlledFormat, onFormatChange, disabled, className, dark, toc, onTitleChange, topBarActions, saveStatus, canUndo, canRedo, onUndo, onRedo, onEditingChange, referenceFocusRequest, scrollScopeKey, showAssets, showTitle, showFormatToggle, paper, showTimestamp, highlights, contentWidth, showSaveCapsule, onActionHover, onActionClick, diff, asset, onAddChatReferences, onRequestAssetDelete, }: ScriptEditorProps): react.JSX.Element;
578
591
 
579
592
  /**
580
593
  * Action timestamps live at `action.extend.timestamp` as an in-episode
package/dist/index.js CHANGED
@@ -2650,6 +2650,8 @@ function SceneEditorImpl({
2650
2650
  actionDiff,
2651
2651
  showTimestamp = false,
2652
2652
  highlights,
2653
+ onActionHover,
2654
+ onActionClick,
2653
2655
  onEdit,
2654
2656
  onNavigateAsset,
2655
2657
  onRequestAssetDelete
@@ -2657,6 +2659,7 @@ function SceneEditorImpl({
2657
2659
  const [pendingEdit, setPendingEdit] = useState(null);
2658
2660
  const { actorMap, speakerMap, locationMap, propMap } = maps;
2659
2661
  const actions = scene.actions ?? [];
2662
+ const sceneId = scene.scene_id ?? "";
2660
2663
  const actorOptions = useMemo(() => {
2661
2664
  const out = [];
2662
2665
  for (const a of actorMap.values()) {
@@ -2769,6 +2772,9 @@ function SceneEditorImpl({
2769
2772
  style: hl?.style,
2770
2773
  onDragOver: (e) => onSlotDragOver(e, idx),
2771
2774
  onDrop: onSlotDrop,
2775
+ onMouseEnter: onActionHover ? () => onActionHover({ episodeIdx: episodeIndex, sceneId, actionIndex: idx }) : void 0,
2776
+ onMouseLeave: onActionHover ? () => onActionHover(null) : void 0,
2777
+ onClick: onActionClick ? () => onActionClick({ episodeIdx: episodeIndex, sceneId, actionIndex: idx }) : void 0,
2772
2778
  children: [
2773
2779
  ts ? /* @__PURE__ */ jsx("span", { className: "lj-se-ts", title: ts.full, children: ts.mmss }) : null,
2774
2780
  mark ? /* @__PURE__ */ jsx(
@@ -3656,6 +3662,8 @@ function ScriptStream({
3656
3662
  paper = true,
3657
3663
  showTimestamp = false,
3658
3664
  highlights,
3665
+ onActionHover,
3666
+ onActionClick,
3659
3667
  onEdit,
3660
3668
  onSelectionChange,
3661
3669
  onRequestAssetDelete
@@ -3857,6 +3865,8 @@ function ScriptStream({
3857
3865
  focused,
3858
3866
  showTimestamp,
3859
3867
  highlights: highlightsByScene.get(diffKey),
3868
+ onActionHover,
3869
+ onActionClick,
3860
3870
  onEdit,
3861
3871
  onNavigateAsset: select,
3862
3872
  onRequestAssetDelete
@@ -4628,6 +4638,8 @@ function ScriptEditor({
4628
4638
  highlights,
4629
4639
  contentWidth,
4630
4640
  showSaveCapsule = true,
4641
+ onActionHover,
4642
+ onActionClick,
4631
4643
  diff,
4632
4644
  asset,
4633
4645
  onAddChatReferences,
@@ -4792,6 +4804,8 @@ function ScriptEditor({
4792
4804
  paper,
4793
4805
  showTimestamp,
4794
4806
  highlights: streamHighlights,
4807
+ onActionHover,
4808
+ onActionClick,
4795
4809
  onEdit,
4796
4810
  onSelectionChange: setSelection,
4797
4811
  onRequestAssetDelete