@grafloria/element 0.4.31 → 0.4.32

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.
@@ -188,6 +188,14 @@ export interface DashboardGridOptions {
188
188
  * command path, folding `displaced` into the same batch.
189
189
  */
190
190
  onDropIn?: (node: NodeModel, cell: CellRect, displaced: Command[]) => void | Promise<void>;
191
+ /**
192
+ * A member is about to LEAVE this board through a gesture (moved into
193
+ * another board, made a tab of its own). Answers the commands that follow
194
+ * it in the same batch — a tab page emptied by the move closes.
195
+ */
196
+ onMemberLeaving?: (memberId: string) => Command[];
197
+ /** A widget dragged over a tab STRIP becomes a new tab there: the hooks that hit-test, mark and commit it. */
198
+ tabDrop?: TabDropHooks;
191
199
  /** Fires after commits/cancels/removals so the page can refocus/refit/flash. */
192
200
  onGesture?: (e: {
193
201
  type: 'commit' | 'cancel' | 'remove' | 'drop-in';
@@ -500,6 +508,14 @@ interface BinderPeer {
500
508
  * it, so the strip can leave the press alone.
501
509
  */
502
510
  tearOutMember(pageId: string, fromGroupId: string, ev: PointerEvent, plan: TearOutPlan): boolean;
511
+ /**
512
+ * Drag member section `id` by a press that did not go through this board's
513
+ * tool (a tab container's strip is a DOM overlay): the board runs the move
514
+ * from the pointer sequence itself. Answers false when it cannot.
515
+ */
516
+ dragMember(id: string, ev: PointerEvent): boolean;
517
+ /** Start a MOVE of member section `id` from a press this board's tool routed here. */
518
+ beginSlabMove?(id: string, ev: ToolPointerEvent): boolean;
503
519
  }
504
520
  /**
505
521
  * What a torn-out page becomes, decided by the dashboard handle (which owns
@@ -549,6 +565,10 @@ export interface TearOutPlan {
549
565
  dropIndex(targetId: string, clientX: number, clientY: number): number;
550
566
  /** Paint (or, with null, clear) the insertion mark on `targetId`'s strip. */
551
567
  markDrop(targetId: string | null, index: number | null): void;
568
+ /** The tab index a CLIENT point means along `targetId`'s strip — null when the point is not over that strip. */
569
+ stripIndex(targetId: string, clientX: number, clientY: number): number | null;
570
+ /** The commands that REORDER the page to `index` along its own strip. Empty when nothing changes. */
571
+ reorder(index: number): Command[];
552
572
  /**
553
573
  * The commands for joining `targetId` at `index`: the page becomes its tab
554
574
  * — and the active one — and the container it left closes when it was the
@@ -561,6 +581,47 @@ export interface TearOutPlan {
561
581
  }
562
582
  /** A torn-out page never arrives shorter than this: a strip with no room under it is not a group. */
563
583
  export declare const TEAR_OUT_MIN_ROWS = 2;
584
+ /**
585
+ * Steps that depend on each other's RESULT — create a group, then move a page
586
+ * into it, then place the group on the board; or remove a member and then the
587
+ * group it emptied — run as one history step. A batch checks every member's
588
+ * `canExecute` before running any of them and every member's `canUndo` before
589
+ * undoing any, and a membership command's precondition (its group exists) is
590
+ * exactly what a neighbouring step creates or removes. This runs the chain in
591
+ * order and reverses it on undo, judging nothing up front.
592
+ */
593
+ export declare class SequenceCommand extends Command {
594
+ private steps;
595
+ constructor(name: string, steps: Command[]);
596
+ execute(context: Parameters<Command['execute']>[0]): void;
597
+ undo(context: Parameters<Command['undo']>[0]): void;
598
+ canExecute(): boolean;
599
+ canUndo(): boolean;
600
+ serialize(): {
601
+ id: string;
602
+ name: string;
603
+ timestamp: number;
604
+ data: {
605
+ steps: import("@grafloria/engine").SerializedCommand[];
606
+ };
607
+ };
608
+ }
609
+ /**
610
+ * A WIDGET dropped on a tab strip becomes a new tab there (a tab dropped on
611
+ * one joins; a widget wraps into a page of its own first). The dashboard
612
+ * handle owns the strips and the registry; the binder owns the gesture.
613
+ */
614
+ export interface TabDropHooks {
615
+ /** The strip under a CLIENT point, and the tab index that point means along it. */
616
+ stripAt(clientX: number, clientY: number): {
617
+ containerId: string;
618
+ index: number;
619
+ } | null;
620
+ /** Paint (or, with null, clear) the insertion mark on a strip. */
621
+ markDrop(containerId: string | null, index: number | null): void;
622
+ /** The commands that make `widgetId` a new tab of `containerId` at `index`; `displaced` are this board's survivors. Empty = refused. */
623
+ dropIntoStrip(widgetId: string, containerId: string, index: number, sourceBoardId: string, displaced: Command[]): Command[];
624
+ }
564
625
  interface AdoptOptions {
565
626
  /**
566
627
  * 'shrink': take the cell under the pointer at the height that FITS there