@witchcraft/layout
    Preparing search index...
    • Returns a LayoutChange with the information necessary to rearrange a frame relative to another.

      Changes can be applied to a window with applyFrameChanges.

      Rearrangement is usually done by dragging a frame onto another frame's zone.

      The action taken depends on their placement relative to each other, see examples below.

      Dragging a frame onto itself in the left/right/top/bottom zones splits it and creates a new frame. Center returns an error.

      Then there are the more typical cases:

      Shared Edge Case:

      ┌─────┬─────┬─────┐ │A │B │C │ │ │ ├─────┤ │ │ │D │ └─────┴─────┴─────┘

      A and B here are on the same edge, with A on the left of B.

      Dragging A onto B will result in the following depending on what drop zone of B the dragged frame lands on:

      Left - Error that can be safely ignored - A is already on the left of B Right - Swap A and B Top - B is "split" up (we only simulate it to get the positions). The position of the new split frame is taken and applied to A to move it above B. - The gap left behind by A is filled however possible using getFillEmptySpaceInfo.

      The result looks like this:

      ┌───────────┬─────┐ │A │C │ ├───────────┼─────┤ │B │D │ └───────────┴─────┘

      Bottom - Like top, but A ends up on the bottom of B.

      Partially Shared Edge Case:

      ┌─────┬─────┬─────┐ │A │B │C │ │ │ │ │ │ │ │ │ │ │ ├─────┤ │ │ │D │ │ │ │ │ └─────┴─────┴─────┘

      Same case but we'll be using B and C here as they share part of an edge but not the whole edge. Dragging B onto C will result in the following:

      Left - C will be "split" to the left. The position of the new split frame is taken and applied to B. The space left behind is filled resulting in this. - Note how c has shrunk due to the initial location of the split.

      ┌─────┬────────┬──┐ │A │B │C │ │ │ │ │ │ │ │ │ │ ├────────┴──┤ │ │D │ │ │ │ └─────┴───────────┘

      Right - Like left but C ends up on the right of B.

      Top ┌─────┬───────────┐ │A │B │ │ ├───────────┤ │ │C │ │ ├───────────┤ │ │D │ │ │ │ └─────┴───────────┘

      Bottom - Like top, but B ends up on the bottom of C.

      None-Shared Edge Case:

      Same case but we'll be dragging A over C. ┌─────┬─────┬─────┐ │A │B │C │ │ │ │ │ │ │ │ │ │ │ ├─────┤ │ │ │D │ │ │ │ │ └─────┴─────┴─────┘

      These are a bit easier to reason about because the frame usually ends up at the split location exactly.

      Left ┌───────────┬──┬──┐ │B │A │C │ │ │ │ │ │ │ │ │ │ ├──┴──┤ │ │D │ │ │ │ └───────────┴─────┘ Right ┌───────────┬──┬──┐ │B │C │A │ │ │ │ │ │ │ │ │ │ ├──┴──┤ │ │D │ │ │ │ └───────────┴─────┘ Top ┌───────────┬─────┐ │B │A │ │ ├─────┤ │ │C │ │ ├─────┤ │ │D │ │ │ │ └───────────┴─────┘ Bottom ┌───────────┬─────┐ │B │C │ │ ├─────┤ │ │A │ │ ├─────┤ │ │D │ │ │ │ └───────────┴─────┘

      Parameters

      • win: BaseLayoutWindow
      • draggingFrameId: string
      • hoveredFrameId: string
      • zoneSide: "left" | "right" | "top" | "bottom" | "center"

      Returns
          | KnownError<"NO_FILL_CANDIDATES", {}>
          | KnownError<
              "CANT_SPLIT_FRAME_TOO_SMALL",
              { frame: LayoutFrame; minSize: number; newSize: number },
          >
          | KnownError<"CANT_SPLIT_DOCKED_FRAME", { frame: LayoutFrame }>
          | KnownError<"CANT_SWAP_WITH_SELF", { frame: LayoutFrame }>
          | LayoutChange<"split" | "swap" | "rearrange">
          | KnownError<
              "CANT_REARRANGE_TO_SAME_RELATIVE_POSITION",
              {
                  draggingFrameId: string;
                  hoveredFrameId: string;
                  zoneSide: "left"
                  | "right"
                  | "top"
                  | "bottom"
                  | "center";
              },
          >
          | KnownError<
              "CANT_REARRANGE_WITH_DOCKED_EDGES",
              {
                  draggingFrameId: string;
                  hoveredFrameId: string;
                  zoneSide: "left"
                  | "right"
                  | "top"
                  | "bottom"
                  | "center";
              },
          >
          | KnownError<
              "CANT_REARRANGE_DOCKED_WITH_NON_DOCKED",
              {
                  draggingFrameId: string;
                  hoveredFrameId: string;
                  zoneSide: "left"
                  | "right"
                  | "top"
                  | "bottom"
                  | "center";
              },
          >