@grafloria/element 0.4.31 → 0.4.33
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/package.json +1 -1
- package/src/lib/dashboard-kit/dashboard.d.ts +16 -2
- package/src/lib/dashboard-kit/dashboard.js +428 -114
- package/src/lib/dashboard-kit/grid-binder.d.ts +82 -2
- package/src/lib/dashboard-kit/grid-binder.js +708 -109
- package/src/lib/dashboard-kit/split-binder.js +2 -0
- package/src/lib/dashboard-kit/tabs.d.ts +1 -1
- package/src/lib/dashboard-kit/tabs.js +1 -1
- package/src/lib/load.js +9 -1
|
@@ -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,12 @@ 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 strip's height on `targetId`, px — the band above its body. */
|
|
571
|
+
stripHeight(targetId: string): number;
|
|
572
|
+
/** The commands that REORDER the page to `index` along its own strip. Empty when nothing changes. */
|
|
573
|
+
reorder(index: number): Command[];
|
|
552
574
|
/**
|
|
553
575
|
* The commands for joining `targetId` at `index`: the page becomes its tab
|
|
554
576
|
* — and the active one — and the container it left closes when it was the
|
|
@@ -561,6 +583,47 @@ export interface TearOutPlan {
|
|
|
561
583
|
}
|
|
562
584
|
/** A torn-out page never arrives shorter than this: a strip with no room under it is not a group. */
|
|
563
585
|
export declare const TEAR_OUT_MIN_ROWS = 2;
|
|
586
|
+
/**
|
|
587
|
+
* Steps that depend on each other's RESULT — create a group, then move a page
|
|
588
|
+
* into it, then place the group on the board; or remove a member and then the
|
|
589
|
+
* group it emptied — run as one history step. A batch checks every member's
|
|
590
|
+
* `canExecute` before running any of them and every member's `canUndo` before
|
|
591
|
+
* undoing any, and a membership command's precondition (its group exists) is
|
|
592
|
+
* exactly what a neighbouring step creates or removes. This runs the chain in
|
|
593
|
+
* order and reverses it on undo, judging nothing up front.
|
|
594
|
+
*/
|
|
595
|
+
export declare class SequenceCommand extends Command {
|
|
596
|
+
private steps;
|
|
597
|
+
constructor(name: string, steps: Command[]);
|
|
598
|
+
execute(context: Parameters<Command['execute']>[0]): void;
|
|
599
|
+
undo(context: Parameters<Command['undo']>[0]): void;
|
|
600
|
+
canExecute(): boolean;
|
|
601
|
+
canUndo(): boolean;
|
|
602
|
+
serialize(): {
|
|
603
|
+
id: string;
|
|
604
|
+
name: string;
|
|
605
|
+
timestamp: number;
|
|
606
|
+
data: {
|
|
607
|
+
steps: import("@grafloria/engine").SerializedCommand[];
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* A WIDGET dropped on a tab strip becomes a new tab there (a tab dropped on
|
|
613
|
+
* one joins; a widget wraps into a page of its own first). The dashboard
|
|
614
|
+
* handle owns the strips and the registry; the binder owns the gesture.
|
|
615
|
+
*/
|
|
616
|
+
export interface TabDropHooks {
|
|
617
|
+
/** The strip under a CLIENT point, and the tab index that point means along it. */
|
|
618
|
+
stripAt(clientX: number, clientY: number): {
|
|
619
|
+
containerId: string;
|
|
620
|
+
index: number;
|
|
621
|
+
} | null;
|
|
622
|
+
/** Paint (or, with null, clear) the insertion mark on a strip. */
|
|
623
|
+
markDrop(containerId: string | null, index: number | null): void;
|
|
624
|
+
/** The commands that make `widgetId` a new tab of `containerId` at `index`; `displaced` are this board's survivors. Empty = refused. */
|
|
625
|
+
dropIntoStrip(widgetId: string, containerId: string, index: number, sourceBoardId: string, displaced: Command[]): Command[];
|
|
626
|
+
}
|
|
564
627
|
interface AdoptOptions {
|
|
565
628
|
/**
|
|
566
629
|
* 'shrink': take the cell under the pointer at the height that FITS there
|
|
@@ -589,17 +652,34 @@ interface AdoptedLeg {
|
|
|
589
652
|
x: number;
|
|
590
653
|
y: number;
|
|
591
654
|
}): void;
|
|
655
|
+
/** Put the tile at a PRESCRIBED cell (a split's half, a docking band): sized to it, unlocked tiles pushed. Answers whether it sits there. */
|
|
656
|
+
place(cell: {
|
|
657
|
+
x: number;
|
|
658
|
+
y: number;
|
|
659
|
+
w: number;
|
|
660
|
+
h: number;
|
|
661
|
+
}): boolean;
|
|
662
|
+
/** Every other tile's cell before the ghost entered — the layout a row insert translates. */
|
|
663
|
+
baseline(): Map<string, CellRect>;
|
|
592
664
|
/** Undo the adoption: target board back to its pre-entry layout. */
|
|
593
665
|
abort(): void;
|
|
594
666
|
/**
|
|
595
667
|
* Close the leg for commit: returns the target-side displaced commands, the
|
|
596
|
-
* tile's final cell and its projected rect
|
|
597
|
-
*
|
|
668
|
+
* tile's final cell and its projected rect — and the member GROUPS the
|
|
669
|
+
* adoption moved (the node commands skip groups; a dock that pushed sections
|
|
670
|
+
* commits them through these). Null when the tile is somehow gone.
|
|
598
671
|
*/
|
|
599
672
|
finalize(): {
|
|
600
673
|
commands: Command[];
|
|
601
674
|
cell: CellRect;
|
|
602
675
|
rect: WorldRect;
|
|
676
|
+
groups: Array<{
|
|
677
|
+
id: string;
|
|
678
|
+
cellBefore: CellRect;
|
|
679
|
+
cellAfter: CellRect;
|
|
680
|
+
frameBefore: WorldRect;
|
|
681
|
+
frameAfter: WorldRect;
|
|
682
|
+
}>;
|
|
603
683
|
} | null;
|
|
604
684
|
}
|
|
605
685
|
/**
|