@burdenoff/microfe-bigconsole 2026.1113.2 → 2026.1115.1
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.
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { WidgetPosition } from './widgetPositioning';
|
|
2
|
+
/** The parts of a widget that hold its placement. Structural, so a test can pass a plain object. */
|
|
3
|
+
export interface PositionedWidget {
|
|
4
|
+
readonly position?: Partial<WidgetPosition> | null;
|
|
5
|
+
readonly positionX?: number | null;
|
|
6
|
+
readonly positionY?: number | null;
|
|
7
|
+
readonly positionWidth?: number | null;
|
|
8
|
+
readonly positionHeight?: number | null;
|
|
9
|
+
}
|
|
10
|
+
/** The cell a widget with no stored placement falls back to; matches the grid and `layoutBaseline`. */
|
|
11
|
+
export declare const DEFAULT_WIDGET_POSITION: Readonly<WidgetPosition>;
|
|
12
|
+
/** `position` is canonical; the flat `positionX|Y|Width|Height` mirrors are the fallback. */
|
|
13
|
+
export declare function readWidgetPosition(widget: PositionedWidget): WidgetPosition;
|
|
14
|
+
/** Same cell, by value. */
|
|
15
|
+
export declare function positionsEqual(a: WidgetPosition, b: WidgetPosition): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The placement the panel's save must send, or `undefined` when it must not send one.
|
|
18
|
+
*
|
|
19
|
+
* `current` is the widget as the store holds it at save time: it carries the panel's
|
|
20
|
+
* typed placement and any drag made on the canvas meanwhile, whichever came last.
|
|
21
|
+
* `seeded` is the placement the panel was opened (or last saved) with. Only a
|
|
22
|
+
* difference is sent, so a save of the title alone never rewrites the placement.
|
|
23
|
+
*/
|
|
24
|
+
export declare function positionToSave(current: PositionedWidget | undefined, seeded: WidgetPosition | null): WidgetPosition | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/bigconsole/utils/widgetPanelPosition.ts
|
|
2
|
+
var e = {
|
|
3
|
+
x: 0,
|
|
4
|
+
y: 0,
|
|
5
|
+
width: 4,
|
|
6
|
+
height: 4
|
|
7
|
+
}, t = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
8
|
+
function n(n) {
|
|
9
|
+
return {
|
|
10
|
+
x: t(n.position?.x) ?? t(n.positionX) ?? e.x,
|
|
11
|
+
y: t(n.position?.y) ?? t(n.positionY) ?? e.y,
|
|
12
|
+
width: t(n.position?.width) ?? t(n.positionWidth) ?? e.width,
|
|
13
|
+
height: t(n.position?.height) ?? t(n.positionHeight) ?? e.height
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function r(e, t) {
|
|
17
|
+
return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
|
|
18
|
+
}
|
|
19
|
+
function i(e, t) {
|
|
20
|
+
if (!e) return;
|
|
21
|
+
let i = n(e);
|
|
22
|
+
if (!(t && r(i, t))) return i;
|
|
23
|
+
}
|
|
24
|
+
export { e as DEFAULT_WIDGET_POSITION, i as positionToSave, r as positionsEqual, n as readWidgetPosition };
|