@grafloria/element 0.4.30 → 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
@@ -538,9 +554,74 @@ export interface TearOutPlan {
538
554
  move: Command[];
539
555
  collapse: Command[];
540
556
  };
557
+ /**
558
+ * The tab containers the page may JOIN instead of forming a group of its
559
+ * own — VS Code's editor dragged from one group into another. Every one it
560
+ * may legally enter (not the container it left, none inside itself); the
561
+ * board hit-tests them against the pointer, and a release over one joins.
562
+ */
563
+ joinTargets: string[];
564
+ /** The tab index a release at this CLIENT point means for `targetId`: over the strip, between the tabs there; over the body, the end. */
565
+ dropIndex(targetId: string, clientX: number, clientY: number): number;
566
+ /** Paint (or, with null, clear) the insertion mark on `targetId`'s strip. */
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[];
572
+ /**
573
+ * The commands for joining `targetId` at `index`: the page becomes its tab
574
+ * — and the active one — and the container it left closes when it was the
575
+ * last page. No cell is taken on any board.
576
+ */
577
+ join(targetId: string, index: number, boardId: string): {
578
+ move: Command[];
579
+ collapse: Command[];
580
+ };
541
581
  }
542
582
  /** A torn-out page never arrives shorter than this: a strip with no room under it is not a group. */
543
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
+ }
544
625
  interface AdoptOptions {
545
626
  /**
546
627
  * 'shrink': take the cell under the pointer at the height that FITS there
@@ -559,6 +640,16 @@ interface AdoptedLeg {
559
640
  x: number;
560
641
  y: number;
561
642
  }): void;
643
+ /**
644
+ * Take the tile OFF the board while the pointer is somewhere the board is
645
+ * not the target (over a group the page will join instead); the tiles it
646
+ * displaced come home. `enter` puts it back at the pointer.
647
+ */
648
+ leave(): void;
649
+ enter(world: {
650
+ x: number;
651
+ y: number;
652
+ }): void;
562
653
  /** Undo the adoption: target board back to its pre-entry layout. */
563
654
  abort(): void;
564
655
  /**