@witchcraft/layout 0.5.3 → 0.5.4
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/module.json +1 -1
- package/dist/runtime/layout/getFrameCollapseInfo.d.ts +1 -1
- package/dist/runtime/layout/getFrameShrinkInfo.d.ts +1 -1
- package/dist/runtime/layout/getFrameShrinkInfo.js +1 -1
- package/package.json +1 -1
- package/src/runtime/layout/getFrameCollapseInfo.ts +2 -1
- package/src/runtime/layout/getFrameShrinkInfo.ts +3 -2
package/dist/module.json
CHANGED
|
@@ -13,4 +13,4 @@ import { KnownError } from "../utils/KnownError.js";
|
|
|
13
13
|
export declare function getFrameCollapseInfo(win: LayoutWindow, frameId: string, { collapseSizeScaled }?: {
|
|
14
14
|
/** Override the target collapse size. If provided, the frame will collapse to this size instead of settings.collapseSizeScaled. */
|
|
15
15
|
collapseSizeScaled?: Size;
|
|
16
|
-
}): LayoutChange | KnownError<typeof LAYOUT_ERROR.CANT_COLLAPSE_NOT_DOCKED> | KnownError<typeof LAYOUT_ERROR.REDISTRIBUTE_WOULD_RESULT_IN_INVALID_FRAMES> | KnownError<typeof LAYOUT_ERROR.CANT_RESIZE_SINGLE_FRAME>;
|
|
16
|
+
}): LayoutChange | KnownError<typeof LAYOUT_ERROR.CANT_COLLAPSE_NOT_DOCKED> | KnownError<typeof LAYOUT_ERROR.REDISTRIBUTE_WOULD_RESULT_IN_INVALID_FRAMES> | KnownError<typeof LAYOUT_ERROR.CANT_RESIZE_SINGLE_FRAME> | KnownError<typeof LAYOUT_ERROR.NO_SPACE_TO_REDISTRIBUTE>;
|
|
@@ -11,4 +11,4 @@ import { KnownError } from "../utils/KnownError.js";
|
|
|
11
11
|
export declare function getFrameShrinkInfo(win: LayoutWindow, frameId: string, amount: number, shrinkSide: EdgeSide, { allowOutOfBounds }?: {
|
|
12
12
|
/** Allow the resize span to exceed window bounds. */
|
|
13
13
|
allowOutOfBounds?: boolean;
|
|
14
|
-
}): LayoutChange | KnownError<typeof LAYOUT_ERROR.REDISTRIBUTE_WOULD_RESULT_IN_INVALID_FRAMES> | KnownError<typeof LAYOUT_ERROR.CANT_RESIZE_SINGLE_FRAME>;
|
|
14
|
+
}): LayoutChange | KnownError<typeof LAYOUT_ERROR.REDISTRIBUTE_WOULD_RESULT_IN_INVALID_FRAMES> | KnownError<typeof LAYOUT_ERROR.CANT_RESIZE_SINGLE_FRAME> | KnownError<typeof LAYOUT_ERROR.NO_SPACE_TO_REDISTRIBUTE>;
|
|
@@ -30,7 +30,7 @@ export function getFrameShrinkInfo(win, frameId, amount, shrinkSide, {
|
|
|
30
30
|
const pinnedEdgeCoordinates = getPinnedEdgesForCollapsedFrames(win, frame, shrinkSide, posKey, sizeKey);
|
|
31
31
|
const changes = getFramesRedistributeInfo(win, redistributeSide, otherFrameIds, -amount, { allowOutOfBounds, pinnedEdgeCoordinates });
|
|
32
32
|
if (changes instanceof KnownError) {
|
|
33
|
-
if (changes.code === LAYOUT_ERROR.REDISTRIBUTE_OUT_OF_BOUNDS
|
|
33
|
+
if (changes.code === LAYOUT_ERROR.REDISTRIBUTE_OUT_OF_BOUNDS) {
|
|
34
34
|
changes.message = `This error should never happen, please file a bug report: ${changes.message}`;
|
|
35
35
|
throw changes;
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -30,7 +30,8 @@ export function getFrameCollapseInfo(
|
|
|
30
30
|
): LayoutChange
|
|
31
31
|
| KnownError<typeof LAYOUT_ERROR.CANT_COLLAPSE_NOT_DOCKED>
|
|
32
32
|
| KnownError<typeof LAYOUT_ERROR.REDISTRIBUTE_WOULD_RESULT_IN_INVALID_FRAMES>
|
|
33
|
-
| KnownError<typeof LAYOUT_ERROR.CANT_RESIZE_SINGLE_FRAME>
|
|
33
|
+
| KnownError<typeof LAYOUT_ERROR.CANT_RESIZE_SINGLE_FRAME>
|
|
34
|
+
| KnownError<typeof LAYOUT_ERROR.NO_SPACE_TO_REDISTRIBUTE> {
|
|
34
35
|
collapseSizeScaled = collapseSizeScaled ?? settings.getCollapseSizeScaled(win)
|
|
35
36
|
win = walk(win, undefined, { save: true }) as typeof win
|
|
36
37
|
const frame = win.frames[frameId]
|
|
@@ -32,7 +32,8 @@ export function getFrameShrinkInfo(
|
|
|
32
32
|
} = {}
|
|
33
33
|
): LayoutChange
|
|
34
34
|
| KnownError<typeof LAYOUT_ERROR.REDISTRIBUTE_WOULD_RESULT_IN_INVALID_FRAMES>
|
|
35
|
-
| KnownError<typeof LAYOUT_ERROR.CANT_RESIZE_SINGLE_FRAME>
|
|
35
|
+
| KnownError<typeof LAYOUT_ERROR.CANT_RESIZE_SINGLE_FRAME>
|
|
36
|
+
| KnownError<typeof LAYOUT_ERROR.NO_SPACE_TO_REDISTRIBUTE> {
|
|
36
37
|
win = walk(win, undefined, { save: true }) as typeof win
|
|
37
38
|
const frame = win.frames[frameId]
|
|
38
39
|
if (!frame) throw new Error(`Unknown frame ${frameId}`)
|
|
@@ -65,7 +66,7 @@ export function getFrameShrinkInfo(
|
|
|
65
66
|
|
|
66
67
|
if (changes instanceof KnownError) {
|
|
67
68
|
// we should never get out of bounds and because this is a shrink there should always be space
|
|
68
|
-
if (changes.code === LAYOUT_ERROR.REDISTRIBUTE_OUT_OF_BOUNDS
|
|
69
|
+
if (changes.code === LAYOUT_ERROR.REDISTRIBUTE_OUT_OF_BOUNDS) {
|
|
69
70
|
changes.message = `This error should never happen, please file a bug report: ${changes.message}`
|
|
70
71
|
throw changes
|
|
71
72
|
}
|