uicore-ts 1.1.388 → 1.1.389

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.
@@ -2,6 +2,24 @@ import { UIObject } from "./UIObject";
2
2
  import { UIPoint } from "./UIPoint";
3
3
  import { UIView } from "./UIView";
4
4
  export type SizeNumberOrFunctionOrView = number | ((constrainingOrthogonalSize: number) => number) | UIView;
5
+ /** A position along an axis (0 = start, 0.5 = centered, 1 = end), or "stretch" to fill the available space instead. */
6
+ export type UIRectanglePositionOrStretch = number | "stretch";
7
+ export interface UIRectangleFlowLayoutOptions {
8
+ /** Horizontal spacing between views on the same row. Defaults to 0. */
9
+ itemGap?: number;
10
+ /** Vertical spacing between wrapped rows. Defaults to 0. */
11
+ lineGap?: number;
12
+ /** Caps how many views a row may hold before wrapping, even if more would fit by width. Defaults to unlimited. */
13
+ maxViewsPerRow?: number;
14
+ /** Position of a row within this rectangle's width when that row holds more than one view. Defaults to 0 (left). */
15
+ centeredOnPosition?: number;
16
+ /**
17
+ * Position (or "stretch" to fill the row) of a view that wrapping isolated onto a row of its
18
+ * own - never consulted for a view still sharing a row with another. A single value broadcasts
19
+ * to every isolated view; an array is matched by index against `views`. Defaults to 0 (left).
20
+ */
21
+ positionOrStretchWhenIsolatedOnOwnWrappedRow?: UIRectanglePositionOrStretch | UIRectanglePositionOrStretch[];
22
+ }
5
23
  export type UIGroupingWrapperFrameConfiguration = {
6
24
  /** Stable identity used to reuse the same wrapper when surrounding conditional layout changes. */
7
25
  identifier?: string;
@@ -154,6 +172,25 @@ export declare class UIRectangle extends UIObject {
154
172
  * @returns Array of rectangles representing the frame for each view
155
173
  */
156
174
  framesByDistributingViewsAsRow(views: UIView[], paddings?: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[], absoluteWidths?: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[], centeredOnPosition?: number): UIRectangle[];
175
+ /**
176
+ * Flows views left-to-right at their preferred widths, wrapping to a new row below this
177
+ * rectangle whenever the next view no longer fits on the current row - the same idea as HTML
178
+ * inline/flow layout or a UICollectionView flow layout. Rows are packed greedily: each row
179
+ * holds as many views as actually fit before wrapping (up to `options.maxViewsPerRow`, if
180
+ * given), so this degenerates to a single row when everything fits, and to one view per row
181
+ * when nothing does.
182
+ * @param views - Array of views to distribute, in flow order
183
+ * @param preferredWidths - Preferred width for each view, matched by index
184
+ * @param itemHeight - Height applied to every row
185
+ * @param options - Wrapping and alignment settings, all optional
186
+ * @param options.itemGap - Horizontal spacing between views on the same row
187
+ * @param options.lineGap - Vertical spacing between wrapped rows
188
+ * @param options.maxViewsPerRow - Caps views per row even if more would fit by width
189
+ * @param options.centeredOnPosition - Position of a row holding more than one view
190
+ * @param options.positionOrStretchWhenIsolatedOnOwnWrappedRow - Position or stretch for a view wrapping isolated alone
191
+ * @returns Array of rectangles representing the frame for each view, matching `views`' order
192
+ */
193
+ framesByFlowingViewsAlongWidth(views: UIView[], preferredWidths: number[], itemHeight: SizeNumberOrFunctionOrView, options?: UIRectangleFlowLayoutOptions): UIRectangle[];
157
194
  /**
158
195
  * Distributes views as a grid (2D array), assigning frames and returning them.
159
196
  * The first index represents rows (vertical), the second index represents columns (horizontal).
@@ -671,6 +671,67 @@ const _UIRectangle = class extends import_UIObject.UIObject {
671
671
  frames.forEach((frame, index) => _UIRectangle._assignFrameToView(frame, views[index]));
672
672
  return frames;
673
673
  }
674
+ framesByFlowingViewsAlongWidth(views, preferredWidths, itemHeight, options = {}) {
675
+ const {
676
+ itemGap = 0,
677
+ lineGap = 0,
678
+ maxViewsPerRow = Infinity,
679
+ centeredOnPosition = 0,
680
+ positionOrStretchWhenIsolatedOnOwnWrappedRow = 0
681
+ } = options;
682
+ const heightNumber = this._heightNumberFromSizeNumberOrFunctionOrView(itemHeight);
683
+ const rowsOfIndices = [];
684
+ let currentRow = [];
685
+ let currentRowWidth = 0;
686
+ views.forEach((_view, index) => {
687
+ const width = preferredWidths[index];
688
+ const widthIfAdded = currentRow.length === 0 ? width : currentRowWidth + itemGap + width;
689
+ const overflowsWidth = currentRow.length > 0 && widthIfAdded > this.width;
690
+ const overflowsCount = currentRow.length >= maxViewsPerRow;
691
+ if (currentRow.length > 0 && (overflowsWidth || overflowsCount)) {
692
+ rowsOfIndices.push(currentRow);
693
+ currentRow = [];
694
+ currentRowWidth = 0;
695
+ }
696
+ currentRow.push(index);
697
+ currentRowWidth = currentRow.length === 1 ? width : currentRowWidth + itemGap + width;
698
+ });
699
+ if (currentRow.length > 0) {
700
+ rowsOfIndices.push(currentRow);
701
+ }
702
+ const frames = new Array(views.length);
703
+ let rowRectangle = this.rectangleWithHeight(heightNumber);
704
+ rowsOfIndices.forEach((rowIndices, rowNumber) => {
705
+ if (rowNumber > 0) {
706
+ rowRectangle = rowRectangle.rectangleForNextRow(lineGap);
707
+ }
708
+ if (rowIndices.length === 1) {
709
+ const index = rowIndices[0];
710
+ const isolatedValue = Array.isArray(positionOrStretchWhenIsolatedOnOwnWrappedRow) ? positionOrStretchWhenIsolatedOnOwnWrappedRow[index] : positionOrStretchWhenIsolatedOnOwnWrappedRow;
711
+ if (isolatedValue === "stretch") {
712
+ const frame = rowRectangle.lazyCopy();
713
+ _UIRectangle._assignFrameToView(frame, views[index]);
714
+ frames[index] = frame;
715
+ return;
716
+ }
717
+ const rowFrames2 = rowRectangle.framesByDistributingViewsAsRow(
718
+ [views[index]],
719
+ itemGap,
720
+ [preferredWidths[index]],
721
+ isolatedValue
722
+ );
723
+ frames[index] = rowFrames2[0];
724
+ return;
725
+ }
726
+ const rowViews = rowIndices.map((index) => views[index]);
727
+ const rowWidths = rowIndices.map((index) => preferredWidths[index]);
728
+ const rowFrames = rowRectangle.framesByDistributingViewsAsRow(rowViews, itemGap, rowWidths, centeredOnPosition);
729
+ rowIndices.forEach((index, position) => {
730
+ frames[index] = rowFrames[position];
731
+ });
732
+ });
733
+ return frames;
734
+ }
674
735
  framesByDistributingViewsAsGrid(views, paddings = 0, absoluteHeights = import_UIObject.nil) {
675
736
  const frames = [];
676
737
  let currentRowRectangle = this.lazyCopy();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UIRectangle.ts"],
4
- "sourcesContent": ["import { FIRST_OR_NIL, IS, IS_DEFINED, IS_NIL, IS_NOT_LIKE_NULL, IS_NOT_NIL, nil, NO, UIObject, YES } from \"./UIObject\"\nimport { UIPoint } from \"./UIPoint\"\nimport { UIView } from \"./UIView\"\n\n\nexport type SizeNumberOrFunctionOrView = number | ((constrainingOrthogonalSize: number) => number) | UIView\n\nexport type UIGroupingWrapperFrameConfiguration = {\n /** Stable identity used to reuse the same wrapper when surrounding conditional layout changes. */\n identifier?: string\n /** CSS classes applied to the generated outer wrapper element. */\n classNames?: string[]\n /** HTML attributes applied to the generated outer wrapper element. */\n attributes?: Record<string, string>\n /** Presentational CSS applied to the generated outer wrapper element. */\n style?: Partial<CSSStyleDeclaration>\n /** Optionally transforms the bounding frame calculated from all assigned view frames. */\n frame?: (defaultFrame: UIRectangle, assignedFrames: UIRectangle[]) => UIRectangle\n}\n\ntype UIGroupingWrapperFrameContext = {\n configuration: UIGroupingWrapperFrameConfiguration\n views: UIView[]\n framesByView: Map<UIView, UIRectangle>\n childContexts: UIGroupingWrapperFrameContext[]\n}\n\ntype UIGroupingWrapperFrameLayoutPass = {\n owner: UIView\n groupingContextStack: UIGroupingWrapperFrameContext[]\n requests: UIGroupingWrapperFrameContext[]\n}\n\ntype UIGroupingWrapperFrameRecord = {\n identifier?: string\n wrapperHTMLElement: HTMLDivElement\n coordinateSpaceHTMLElement: HTMLDivElement\n views: UIView[]\n childRecords: UIGroupingWrapperFrameRecord[]\n configuredClassNames: string[]\n configuredAttributeNames: string[]\n configuredStyleNames: string[]\n}\n\nexport class UIRectangle extends UIObject {\n\n static _groupingWrapperFrameLayoutPasses: UIGroupingWrapperFrameLayoutPass[] = []\n static _groupingWrapperFrameRecordsByOwner = new WeakMap<UIView, UIGroupingWrapperFrameRecord[]>()\n \n _isBeingUpdated: boolean\n rectanglePointDidChange?: (b: any) => void\n \n // COW: Internal data structure that can be shared\n private _data: {\n min: UIPoint\n max: UIPoint\n minHeight?: number\n maxHeight?: number\n minWidth?: number\n maxWidth?: number\n refCount: number\n }\n \n // COW: Flag to indicate this is a lazy copy\n private _isLazyCopy: boolean\n \n \n constructor(x: number = 0, y: number = 0, height: number = 0, width: number = 0) {\n \n super()\n \n this._isLazyCopy = NO\n this._isBeingUpdated = NO\n \n // COW: Create the shared data structure\n this._data = {\n min: new UIPoint(x, y),\n max: new UIPoint(x + width, y + height),\n refCount: 1\n }\n \n this._setupPointCallbacks()\n \n if (IS_NIL(height)) {\n this._data.max.y = height\n }\n \n if (IS_NIL(width)) {\n this._data.max.x = width\n }\n \n }\n \n // COW: Setup callbacks for point changes\n private _setupPointCallbacks() {\n this._data.min.didChange = (point) => {\n this.rectanglePointDidChange?.(point)\n this._rectanglePointDidChange()\n }\n this._data.max.didChange = (point) => {\n this.rectanglePointDidChange?.(point)\n this._rectanglePointDidChange()\n }\n }\n \n // COW: Materialize a lazy copy before mutation\n materialize() {\n if (this._isLazyCopy || this._data.refCount > 1) {\n this._data.refCount--\n \n const oldData = this._data\n this._data = {\n min: oldData.min.copy(),\n max: oldData.max.copy(),\n minHeight: oldData.minHeight,\n maxHeight: oldData.maxHeight,\n minWidth: oldData.minWidth,\n maxWidth: oldData.maxWidth,\n refCount: 1\n }\n \n this._setupPointCallbacks()\n this._isLazyCopy = NO\n }\n }\n \n // Copy on write: Lazy copy that shares data\n // Tested to reduce CPU time from 2.2% to 1% during heavy resizing\n lazyCopy(): UIRectangle {\n const result = Object.create(UIRectangle.prototype)\n result._data = this._data\n result._data.refCount++\n result._isLazyCopy = YES\n result._isBeingUpdated = NO\n result.rectanglePointDidChange = this.rectanglePointDidChange\n return result\n }\n \n // COW: Getters and setters that materialize on write\n get min(): UIPoint {\n return this._data.min\n }\n \n set min(value: UIPoint) {\n this.materialize()\n this._data.min = value\n this._setupPointCallbacks()\n }\n \n get max(): UIPoint {\n return this._data.max\n }\n \n set max(value: UIPoint) {\n this.materialize()\n this._data.max = value\n this._setupPointCallbacks()\n }\n \n get minHeight(): number | undefined {\n return this._data.minHeight\n }\n \n set minHeight(value: number | undefined) {\n this.materialize()\n this._data.minHeight = value\n }\n \n get maxHeight(): number | undefined {\n return this._data.maxHeight\n }\n \n set maxHeight(value: number | undefined) {\n this.materialize()\n this._data.maxHeight = value\n }\n \n get minWidth(): number | undefined {\n return this._data.minWidth\n }\n \n set minWidth(value: number | undefined) {\n this.materialize()\n this._data.minWidth = value\n }\n \n get maxWidth(): number | undefined {\n return this._data.maxWidth\n }\n \n set maxWidth(value: number | undefined) {\n this.materialize()\n this._data.maxWidth = value\n }\n \n \n copy() {\n \n const result = new UIRectangle(this.x, this.y, this.height, this.width)\n \n result.minHeight = this.minHeight\n result.minWidth = this.minWidth\n result.maxHeight = this.maxHeight\n result.maxWidth = this.maxWidth\n \n return result\n \n }\n \n isEqualTo(rectangle: UIRectangle | null | undefined) {\n return (IS(rectangle) && this.min.isEqualTo(rectangle.min) && this.max.isEqualTo(rectangle.max))\n }\n \n static zero() {\n return new UIRectangle(0, 0, 0, 0)\n }\n \n containsPoint(point: UIPoint) {\n return this.min.x <= point.x && this.min.y <= point.y &&\n point.x <= this.max.x && point.y <= this.max.y\n }\n \n updateByAddingPoint(point: UIPoint) {\n \n this.materialize() // COW: Materialize before mutation\n \n if (!point) {\n point = new UIPoint(0, 0)\n }\n \n this.beginUpdates()\n \n const min = this.min.copy()\n if (min.x === nil) {\n min.x = this.max.x\n }\n if (min.y === nil) {\n min.y = this.max.y\n }\n \n const max = this.max.copy()\n if (max.x === nil) {\n max.x = this.min.x\n }\n if (max.y === nil) {\n max.y = this.min.y\n }\n \n this.min.x = Math.min(min.x, point.x)\n this.min.y = Math.min(min.y, point.y)\n this.max.x = Math.max(max.x, point.x)\n this.max.y = Math.max(max.y, point.y)\n \n this.finishUpdates()\n \n }\n \n scale(scale: number) {\n this.materialize() // COW: Materialize before mutation\n if (IS_NOT_NIL(this.max.y)) {\n this.height = this.height * scale\n }\n if (IS_NOT_NIL(this.max.x)) {\n this.width = this.width * scale\n }\n }\n \n get height() {\n if (this.max.y === nil) {\n return nil\n }\n return this.max.y - this.min.y\n }\n \n set height(height: number) {\n this.materialize() // COW: Materialize before mutation\n this._data.max.y = this.min.y + height\n }\n \n \n get width() {\n if (this.max.x === nil) {\n return nil\n }\n return this.max.x - this.min.x\n }\n \n set width(width: number) {\n this.materialize() // COW: Materialize before mutation\n this._data.max.x = this.min.x + width\n }\n \n \n get x() {\n return this.min.x\n }\n \n set x(x: number) {\n \n this.materialize() // COW: Materialize before mutation\n this.beginUpdates()\n \n const width = this.width\n this._data.min.x = x\n this._data.max.x = this.min.x + width\n \n this.finishUpdates()\n \n }\n \n \n get y() {\n return this.min.y\n }\n \n \n set y(y: number) {\n \n this.materialize() // COW: Materialize before mutation\n this.beginUpdates()\n \n const height = this.height\n this._data.min.y = y\n this._data.max.y = this.min.y + height\n \n this.finishUpdates()\n \n }\n \n \n get topLeft() {\n return this.min.copy()\n }\n \n get topRight() {\n return new UIPoint(this.max.x, this.y)\n }\n \n get bottomLeft() {\n return new UIPoint(this.x, this.max.y)\n }\n \n get bottomRight() {\n return this.max.copy()\n }\n \n \n get center() {\n return this.min.copy().add(this.min.to(this.max).scale(0.5))\n }\n \n set center(center: UIPoint) {\n this.materialize() // COW: Materialize before mutation\n const offset = this.center.to(center)\n this.offsetByPoint(offset)\n }\n \n offsetByPoint(offset: UIPoint) {\n this.materialize() // COW: Materialize before mutation\n this.min.add(offset)\n this.max.add(offset)\n \n return this\n }\n \n \n concatenateWithRectangle(rectangle: UIRectangle) {\n this.updateByAddingPoint(rectangle.bottomRight)\n this.updateByAddingPoint(rectangle.topLeft)\n return this\n }\n \n rectangleByConcatenatingWithRectangle(rectangle: UIRectangle) {\n return this.lazyCopy().concatenateWithRectangle(rectangle) // COW: Use lazyCopy\n }\n \n \n intersectionRectangleWithRectangle(rectangle: UIRectangle): UIRectangle {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.materialize() // COW: We're going to modify it\n \n result.beginUpdates()\n \n const min = result.min\n if (min.x === nil) {\n min.x = rectangle.max.x - Math.min(result.width, rectangle.width)\n }\n if (min.y === nil) {\n min.y = rectangle.max.y - Math.min(result.height, rectangle.height)\n }\n \n const max = result.max\n if (max.x === nil) {\n max.x = rectangle.min.x + Math.min(result.width, rectangle.width)\n }\n if (max.y === nil) {\n max.y = rectangle.min.y + Math.min(result.height, rectangle.height)\n }\n \n result.min.x = Math.max(result.min.x, rectangle.min.x)\n result.min.y = Math.max(result.min.y, rectangle.min.y)\n result.max.x = Math.min(result.max.x, rectangle.max.x)\n result.max.y = Math.min(result.max.y, rectangle.max.y)\n \n \n if (result.height < 0) {\n \n const averageY = (this.center.y + rectangle.center.y) * 0.5\n result.min.y = averageY\n result.max.y = averageY\n \n }\n \n if (result.width < 0) {\n \n const averageX = (this.center.x + rectangle.center.x) * 0.5\n result.min.x = averageX\n result.max.x = averageX\n \n }\n \n result.finishUpdates()\n \n return result\n \n }\n \n \n get area() {\n return this.height * this.width\n }\n \n \n intersectsWithRectangle(rectangle: UIRectangle) {\n return (this.intersectionRectangleWithRectangle(rectangle).area != 0)\n }\n\n\n // Distance between two rectangles' facing edges, assuming `rectangle`\n // sits in the named direction from `this`. Zero means the edges touch\n // exactly; negative means the rectangles overlap in that axis.\n topGapToRectangle(rectangle: UIRectangle): number {\n return rectangle.min.y - this.max.y\n }\n\n bottomGapToRectangle(rectangle: UIRectangle): number {\n return this.min.y - rectangle.max.y\n }\n\n leftGapToRectangle(rectangle: UIRectangle): number {\n return rectangle.min.x - this.max.x\n }\n\n rightGapToRectangle(rectangle: UIRectangle): number {\n return this.min.x - rectangle.max.x\n }\n\n\n // True when `rectangle` lies entirely within this rectangle's bounds \u2014\n // stricter than intersectsWithRectangle; catches a child frame that\n // overflows its container.\n containsRectangle(rectangle: UIRectangle): boolean {\n return this.min.x <= rectangle.min.x && this.min.y <= rectangle.min.y &&\n this.max.x >= rectangle.max.x && this.max.y >= rectangle.max.y\n }\n\n\n // add some space around the rectangle\n rectangleWithInsets(left: number, right: number, bottom: number, top: number) {\n const result = this.lazyCopy() // COW: Use lazyCopy\n result.materialize() // COW: We're modifying multiple properties\n result.min.x = this.min.x + left\n result.max.x = this.max.x - right\n result.min.y = this.min.y + top\n result.max.y = this.max.y - bottom\n return result\n }\n \n rectangleWithInset(inset: number) {\n return this.rectangleWithInsets(inset, inset, inset, inset)\n }\n \n rectangleWithHeight(height: SizeNumberOrFunctionOrView, centeredOnPosition: number = nil) {\n \n height = this._heightNumberFromSizeNumberOrFunctionOrView(height)\n \n if (isNaN(centeredOnPosition)) {\n centeredOnPosition = nil\n }\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.height = height\n \n if (centeredOnPosition != nil) {\n const change = height - this.height\n result.offsetByPoint(new UIPoint(0, change * centeredOnPosition).scale(-1))\n }\n \n return result\n \n }\n \n rectangleWithWidth(width: SizeNumberOrFunctionOrView, centeredOnPosition: number = nil) {\n \n width = this._widthNumberFromSizeNumberOrFunctionOrView(width)\n \n if (isNaN(centeredOnPosition)) {\n centeredOnPosition = nil\n }\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.width = width\n \n if (centeredOnPosition != nil) {\n const change = width - this.width\n result.offsetByPoint(new UIPoint(change * centeredOnPosition, 0).scale(-1))\n }\n \n return result\n \n }\n \n rectangleWithHeightRelativeToWidth(heightRatio: number = 1, centeredOnPosition: number = nil) {\n return this.rectangleWithHeight(this.width * heightRatio, centeredOnPosition)\n }\n \n rectangleWithWidthRelativeToHeight(widthRatio: number = 1, centeredOnPosition: number = nil) {\n return this.rectangleWithWidth(this.height * widthRatio, centeredOnPosition)\n }\n \n rectangleWithX(x: number, centeredOnPosition: number = 0) {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.x = x - result.width * centeredOnPosition\n \n return result\n \n }\n \n rectangleWithY(y: number, centeredOnPosition: number = 0) {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.y = y - result.height * centeredOnPosition\n \n return result\n \n }\n \n \n rectangleByAddingX(x: number) {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.x = this.x + x\n \n return result\n \n }\n \n rectangleByAddingY(y: number) {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.y = this.y + y\n \n return result\n \n }\n \n rectangleByAddingWidth(widthToAdd: number, centeredOnPosition = 0) {\n \n const result = this.rectangleWithWidth(this.width + widthToAdd, centeredOnPosition)\n \n return result\n \n }\n \n rectangleByAddingHeight(heightToAdd: number, centeredOnPosition = 0) {\n \n const result = this.rectangleWithHeight(this.height + heightToAdd, centeredOnPosition)\n \n return result\n \n }\n \n \n rectangleWithRelativeValues(\n relativeXPosition: number,\n widthMultiplier: number,\n relativeYPosition: number,\n heightMultiplier: number\n ) {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.materialize() // COW: We're modifying multiple properties\n \n const width = result.width\n const height = result.height\n \n result.width = widthMultiplier * width\n result.height = heightMultiplier * height\n \n result.center = new UIPoint(\n relativeXPosition * width,\n relativeYPosition * height\n )\n \n return result\n \n }\n \n \n /**\n * Returns a rectangle with a maximum width constraint\n * If current width exceeds max, centers the constrained width\n */\n rectangleWithMaxWidth(maxWidth: number, centeredOnPosition: number = 0): UIRectangle {\n if (this.width <= maxWidth) {\n return this.lazyCopy() // COW: Use lazyCopy\n }\n return this.rectangleWithWidth(maxWidth, centeredOnPosition)\n }\n \n /**\n * Returns a rectangle with a maximum height constraint\n */\n rectangleWithMaxHeight(maxHeight: number, centeredOnPosition: number = 0): UIRectangle {\n if (this.height <= maxHeight) {\n return this.lazyCopy() // COW: Use lazyCopy\n }\n return this.rectangleWithHeight(maxHeight, centeredOnPosition)\n }\n \n /**\n * Returns a rectangle with minimum width constraint\n */\n rectangleWithMinWidth(minWidth: number, centeredOnPosition: number = 0): UIRectangle {\n if (this.width >= minWidth) {\n return this.lazyCopy() // COW: Use lazyCopy\n }\n return this.rectangleWithWidth(minWidth, centeredOnPosition)\n }\n \n /**\n * Returns a rectangle with minimum height constraint\n */\n rectangleWithMinHeight(minHeight: number, centeredOnPosition: number = 0): UIRectangle {\n if (this.height >= minHeight) {\n return this.lazyCopy() // COW: Use lazyCopy\n }\n return this.rectangleWithHeight(minHeight, centeredOnPosition)\n }\n \n // Returns a new rectangle that is positioned relative to the reference rectangle\n // By default, it makes a copy of this rectangle taht is centered in the target rectangle\n rectangleByCenteringInRectangle(referenceRectangle: UIRectangle, xPosition = 0.5, yPosition = 0.5) {\n const result = this.lazyCopy() // COW: Use lazyCopy\n result.center = referenceRectangle.topLeft\n .pointByAddingX(xPosition * referenceRectangle.width)\n .pointByAddingY(yPosition * referenceRectangle.height)\n return result\n }\n \n \n rectanglesBySplittingWidth(\n weights: SizeNumberOrFunctionOrView[],\n paddings: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 0,\n absoluteWidths: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = nil\n ) {\n \n if (IS_NIL(paddings)) {\n paddings = 1\n }\n if (!((paddings as any) instanceof Array)) {\n paddings = [paddings].arrayByRepeating(weights.length - 1)\n }\n paddings = (paddings as any[]).arrayByTrimmingToLengthIfLonger(weights.length - 1)\n paddings = paddings.map(padding => this._widthNumberFromSizeNumberOrFunctionOrView(padding))\n if (!(absoluteWidths instanceof Array) && IS_NOT_NIL(absoluteWidths)) {\n absoluteWidths = [absoluteWidths].arrayByRepeating(weights.length)\n }\n absoluteWidths = absoluteWidths.map(\n width => this._widthNumberFromSizeNumberOrFunctionOrView(width)\n )\n \n weights = weights.map(weight => this._widthNumberFromSizeNumberOrFunctionOrView(weight))\n const result: UIRectangle[] = []\n const sumOfWeights = (weights as number[]).reduce(\n (a, b, index) => {\n if (IS_NOT_NIL((absoluteWidths as number[])[index])) {\n b = 0\n }\n return a + b\n },\n 0\n )\n const sumOfPaddings = paddings.summedValue as number\n const sumOfAbsoluteWidths = (absoluteWidths as number[]).summedValue\n const totalRelativeWidth = this.width - sumOfPaddings - sumOfAbsoluteWidths\n let previousCellMaxX = this.x\n \n for (let i = 0; i < weights.length; i++) {\n \n let resultWidth: number\n if (IS_NOT_NIL(absoluteWidths[i])) {\n resultWidth = (absoluteWidths[i] || 0) as number\n }\n else {\n resultWidth = totalRelativeWidth * (weights[i] as number / sumOfWeights)\n }\n \n const rectangle = this.rectangleWithWidth(resultWidth)\n \n let padding = 0\n if (paddings.length > i && paddings[i]) {\n padding = paddings[i] as number\n }\n \n rectangle.x = previousCellMaxX\n previousCellMaxX = rectangle.max.x + padding\n result.push(rectangle)\n \n }\n \n return result\n \n }\n \n rectanglesBySplittingHeight(\n weights: SizeNumberOrFunctionOrView[],\n paddings: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 0,\n absoluteHeights: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = nil\n ) {\n \n if (IS_NIL(paddings)) {\n paddings = 1\n }\n if (!((paddings as any) instanceof Array)) {\n paddings = [paddings].arrayByRepeating(weights.length - 1)\n }\n paddings = (paddings as number[]).arrayByTrimmingToLengthIfLonger(weights.length - 1)\n paddings = paddings.map(padding => this._heightNumberFromSizeNumberOrFunctionOrView(padding))\n if (!(absoluteHeights instanceof Array) && IS_NOT_NIL(absoluteHeights)) {\n absoluteHeights = [absoluteHeights].arrayByRepeating(weights.length)\n }\n absoluteHeights = absoluteHeights.map(\n height => this._heightNumberFromSizeNumberOrFunctionOrView(height)\n )\n \n weights = weights.map(weight => this._heightNumberFromSizeNumberOrFunctionOrView(weight))\n const result: UIRectangle[] = []\n const sumOfWeights = (weights as number[]).reduce(\n (a, b, index) => {\n if (IS_NOT_NIL((absoluteHeights as number[])[index])) {\n b = 0\n }\n return a + b\n },\n 0\n )\n const sumOfPaddings = paddings.summedValue as number\n const sumOfAbsoluteHeights = (absoluteHeights as number[]).summedValue\n const totalRelativeHeight = this.height - sumOfPaddings - sumOfAbsoluteHeights\n let previousCellMaxY = this.y\n \n for (let i = 0; i < weights.length; i++) {\n let resultHeight: number\n if (IS_NOT_NIL(absoluteHeights[i])) {\n \n resultHeight = (absoluteHeights[i] || 0) as number\n \n }\n else {\n \n resultHeight = totalRelativeHeight * (weights[i] as number / sumOfWeights)\n \n }\n \n const rectangle = this.rectangleWithHeight(resultHeight)\n \n let padding = 0\n if (paddings.length > i && paddings[i]) {\n padding = paddings[i] as number\n }\n \n rectangle.y = previousCellMaxY\n previousCellMaxY = rectangle.max.y + padding\n //rectangle = rectangle.rectangleWithInsets(0, 0, padding, 0);\n result.push(rectangle)\n }\n \n return result\n \n }\n \n \n rectanglesByEquallySplittingWidth(numberOfFrames: number, padding: number = 0) {\n const result: UIRectangle[] = []\n const totalPadding = padding * (numberOfFrames - 1)\n const resultWidth = (this.width - totalPadding) / numberOfFrames\n for (var i = 0; i < numberOfFrames; i++) {\n const rectangle = this.rectangleWithWidth(resultWidth, i / (numberOfFrames - 1))\n result.push(rectangle)\n }\n return result\n }\n \n rectanglesByEquallySplittingHeight(numberOfFrames: number, padding: number = 0) {\n const result: UIRectangle[] = []\n const totalPadding = padding * (numberOfFrames - 1)\n const resultHeight = (this.height - totalPadding) / numberOfFrames\n for (var i = 0; i < numberOfFrames; i++) {\n const rectangle = this.rectangleWithHeight(resultHeight, i / (numberOfFrames - 1))\n result.push(rectangle)\n }\n return result\n }\n \n \n distributeViewsAlongWidth(\n views: UIView[],\n weights: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 1,\n paddings?: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[],\n absoluteWidths?: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[]\n ) {\n if (!(weights instanceof Array)) {\n weights = [weights].arrayByRepeating(views.length)\n }\n const frames = this.rectanglesBySplittingWidth(weights, paddings, absoluteWidths)\n frames.forEach((frame, index) => UIRectangle._assignFrameToView(frame, FIRST_OR_NIL(views[index])))\n return this\n }\n \n distributeViewsAlongHeight(\n views: UIView[],\n weights: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 1,\n paddings?: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[],\n absoluteHeights?: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[]\n ) {\n if (!(weights instanceof Array)) {\n weights = [weights].arrayByRepeating(views.length)\n }\n const frames = this.rectanglesBySplittingHeight(weights, paddings, absoluteHeights)\n frames.forEach((frame, index) => UIRectangle._assignFrameToView(frame, FIRST_OR_NIL(views[index])))\n return this\n }\n \n \n distributeViewsEquallyAlongWidth(views: UIView[], padding: number) {\n const frames = this.rectanglesByEquallySplittingWidth(views.length, padding)\n frames.forEach((frame, index) => UIRectangle._assignFrameToView(frame, views[index]))\n return this\n }\n \n distributeViewsEquallyAlongHeight(views: UIView[], padding: number) {\n const frames = this.rectanglesByEquallySplittingHeight(views.length, padding)\n frames.forEach((frame, index) => UIRectangle._assignFrameToView(frame, views[index]))\n return this\n }\n \n \n _heightNumberFromSizeNumberOrFunctionOrView(height: SizeNumberOrFunctionOrView) {\n if (height instanceof Function) {\n return height(this.width)\n }\n if (height instanceof UIView) {\n return height.intrinsicContentHeight(this.width)\n }\n return height\n }\n \n _widthNumberFromSizeNumberOrFunctionOrView(width: SizeNumberOrFunctionOrView) {\n if (width instanceof Function) {\n return width(this.height)\n }\n if (width instanceof UIView) {\n return width.intrinsicContentWidth(this.height)\n }\n return width\n }\n \n rectangleForNextRow(padding: number = 0, height: SizeNumberOrFunctionOrView = this.height) {\n const heightNumber = this._heightNumberFromSizeNumberOrFunctionOrView(height)\n const result = this.rectangleWithY(this.max.y + padding)\n if (heightNumber != this.height) {\n result.height = heightNumber\n }\n return result\n }\n \n rectangleForNextColumn(padding: number = 0, width: SizeNumberOrFunctionOrView = this.width) {\n const widthNumber = this._widthNumberFromSizeNumberOrFunctionOrView(width)\n const result = this.rectangleWithX(this.max.x + padding)\n if (widthNumber != this.width) {\n result.width = widthNumber\n }\n return result\n }\n \n rectangleForPreviousRow(padding: number = 0, height: SizeNumberOrFunctionOrView = this.height) {\n const heightNumber = this._heightNumberFromSizeNumberOrFunctionOrView(height)\n const result = this.rectangleWithY(this.min.y - heightNumber - padding)\n if (heightNumber != this.height) {\n result.height = heightNumber\n }\n return result\n }\n \n rectangleForPreviousColumn(padding: number = 0, width: SizeNumberOrFunctionOrView = this.width) {\n const widthNumber = this._widthNumberFromSizeNumberOrFunctionOrView(width)\n const result = this.rectangleWithX(this.min.x - widthNumber - padding)\n if (widthNumber != this.width) {\n result.width = widthNumber\n }\n return result\n \n }\n \n /**\n * Distributes views vertically as a column, assigning frames and returning them.\n * Each view is positioned below the previous one with optional padding between them.\n * @param views - Array of views to distribute\n * @param paddings - Padding between views (single value or array of values)\n * @param absoluteHeights - Optional fixed heights for views (overrides intrinsic height)\n * @returns Array of rectangles representing the frame for each view\n */\n framesByDistributingViewsAsColumn(\n views: UIView[],\n paddings: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 0,\n absoluteHeights: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = nil\n ) {\n const frames: UIRectangle[] = []\n let currentRectangle = this.lazyCopy() // COW: Use lazyCopy\n \n if (!(paddings instanceof Array)) {\n paddings = [paddings].arrayByRepeating(views.length - 1)\n }\n paddings = paddings.map(padding => this._heightNumberFromSizeNumberOrFunctionOrView(padding))\n \n if (!(absoluteHeights instanceof Array) && IS_NOT_NIL(absoluteHeights)) {\n absoluteHeights = [absoluteHeights].arrayByRepeating(views.length)\n }\n absoluteHeights = absoluteHeights.map(\n height => this._heightNumberFromSizeNumberOrFunctionOrView(height)\n )\n \n for (let i = 0; i < views.length; i++) {\n const frame = currentRectangle.rectangleWithHeight(views[i])\n \n if (IS_NOT_NIL(absoluteHeights[i])) {\n frame.height = absoluteHeights[i] as number\n }\n \n UIRectangle._assignFrameToView(frame, views[i])\n frames.push(frame)\n \n const padding = (paddings[i] || 0) as number\n currentRectangle = frame.rectangleForNextRow(padding)\n }\n \n return frames\n }\n \n /**\n * Distributes views horizontally as a row, assigning frames and returning them.\n * Each view is positioned to the right of the previous one with optional padding between them.\n * @param views - Array of views to distribute\n * @param paddings - Padding between views (single value or array of values)\n * @param absoluteWidths - Optional fixed widths for views (overrides intrinsic width)\n * @param centeredOnPosition - Horizontal alignment of the row within this rectangle: 0 = left (default), 0.5 =\n * center, 1 = right\n * @returns Array of rectangles representing the frame for each view\n */\n framesByDistributingViewsAsRow(\n views: UIView[],\n paddings: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 0,\n absoluteWidths: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = nil,\n centeredOnPosition = 0\n ) {\n const frames: UIRectangle[] = []\n let currentRectangle = this.lazyCopy() // COW: Use lazyCopy\n \n if (!(paddings instanceof Array)) {\n paddings = [paddings].arrayByRepeating(views.length - 1)\n }\n paddings = paddings.map(padding => this._widthNumberFromSizeNumberOrFunctionOrView(padding))\n \n if (!(absoluteWidths instanceof Array) && IS_NOT_NIL(absoluteWidths)) {\n absoluteWidths = [absoluteWidths].arrayByRepeating(views.length)\n }\n absoluteWidths = absoluteWidths.map(\n width => this._widthNumberFromSizeNumberOrFunctionOrView(width)\n )\n \n for (let i = 0; i < views.length; i++) {\n const frame = currentRectangle.rectangleWithWidth(views[i])\n \n if (IS_NOT_NIL(absoluteWidths[i])) {\n frame.width = absoluteWidths[i] as number\n }\n \n frames.push(frame)\n \n const padding = (paddings[i] || 0) as number\n currentRectangle = frame.rectangleForNextColumn(padding)\n }\n \n if (centeredOnPosition !== 0 && frames.length > 0) {\n const rowWidth = frames.lastElement.max.x - frames.firstElement.x\n const offset = (this.width - rowWidth) * centeredOnPosition - (frames.firstElement.x - this.x)\n frames.forEach(frame => { frame.x += offset })\n }\n \n frames.forEach((frame, index) => UIRectangle._assignFrameToView(frame, views[index]))\n \n return frames\n }\n \n /**\n * Distributes views as a grid (2D array), assigning frames and returning them.\n * The first index represents rows (vertical), the second index represents columns (horizontal).\n * Example: views[0] is the first row, views[0][0] is the first column in the first row.\n * Each row is laid out horizontally, and rows are stacked vertically.\n * @param views - 2D array where views[row][column] represents the grid structure\n * @param paddings - Vertical padding between rows (single value or array of values)\n * @param absoluteHeights - Optional fixed heights for each row (overrides intrinsic height)\n * @returns 2D array of rectangles where frames[row][column] matches views[row][column]\n */\n framesByDistributingViewsAsGrid(\n views: UIView[][],\n paddings: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 0,\n absoluteHeights: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = nil\n ) {\n const frames: UIRectangle[][] = []\n let currentRowRectangle = this.lazyCopy() // COW: Use lazyCopy\n \n if (!(paddings instanceof Array)) {\n paddings = [paddings].arrayByRepeating(views.length - 1)\n }\n paddings = paddings.map(padding => this._heightNumberFromSizeNumberOrFunctionOrView(padding))\n \n if (!(absoluteHeights instanceof Array) && IS_NOT_NIL(absoluteHeights)) {\n absoluteHeights = [absoluteHeights].arrayByRepeating(views.length)\n }\n absoluteHeights = absoluteHeights.map(\n height => this._heightNumberFromSizeNumberOrFunctionOrView(height)\n )\n \n for (let i = 0; i < views.length; i++) {\n const rowViews = views[i]\n const rowFrames = currentRowRectangle.framesByDistributingViewsAsRow(rowViews)\n \n if (IS_NOT_NIL(absoluteHeights[i])) {\n const heightNumber = absoluteHeights[i] as number\n rowFrames.forEach((frame, j) => {\n frame.height = heightNumber\n UIRectangle._assignFrameToView(frame, rowViews[j])\n })\n }\n \n frames.push(rowFrames)\n \n const padding = (paddings[i] || 0) as number\n const maxHeight = Math.max(...rowFrames.map(f => f.height))\n currentRowRectangle = currentRowRectangle.rectangleForNextRow(padding, maxHeight)\n }\n \n return frames\n }\n \n rectangleWithIntrinsicContentSizeForView(view: UIView, centeredOnXPosition = 0, centeredOnYPosition = 0) {\n const intrinsicContentSize = view.intrinsicContentSize()\n return this.rectangleWithHeight(intrinsicContentSize.height, centeredOnYPosition)\n .rectangleWithWidth(intrinsicContentSize.width, centeredOnXPosition)\n }\n \n settingMinHeight(minHeight?: number) {\n this.minHeight = minHeight\n return this\n }\n \n settingMinWidth(minWidth?: number) {\n this.minWidth = minWidth\n return this\n }\n \n settingMaxHeight(maxHeight?: number) {\n this.maxHeight = maxHeight\n return this\n }\n \n settingMaxWidth(maxWidth?: number) {\n this.maxWidth = maxWidth\n return this\n }\n \n rectangleByEnforcingMinAndMaxSizes(centeredOnXPosition = 0, centeredOnYPosition = 0) {\n return this.rectangleWithHeight(\n [\n [this.height, this.maxHeight].filter(value => IS_NOT_LIKE_NULL(value)).min(),\n this.minHeight\n ].filter(value => IS_NOT_LIKE_NULL(value)).max(),\n centeredOnYPosition\n ).rectangleWithWidth(\n [\n [this.width, this.maxWidth].filter(value => IS_NOT_LIKE_NULL(value)).min(),\n this.minWidth\n ].filter(value => IS_NOT_LIKE_NULL(value)).max(),\n centeredOnXPosition\n )\n }\n \n \n assignedAsFrameOfView(view: UIView, isWeakFrame = view.hasWeakFrame) {\n UIRectangle._assignFrameToView(this, view)\n view.hasWeakFrame = isWeakFrame\n return this\n }\n\n\n /**\n * Begins collecting views assigned through the rectangle frame-assignment API into a DOM wrapper.\n * The matching endGroupingWrapperFrame() returns the current rectangle unchanged, preserving the chain.\n */\n beginGroupingWrapperFrame(configuration: UIGroupingWrapperFrameConfiguration = {}) {\n const layoutPass = UIRectangle._groupingWrapperFrameLayoutPasses.lastElement\n if (!layoutPass) {\n throw new Error(\"beginGroupingWrapperFrame() must be called during a UIView layout pass\")\n }\n const groupingContext: UIGroupingWrapperFrameContext = {\n configuration,\n views: [],\n framesByView: new Map(),\n childContexts: []\n }\n const parentContext = layoutPass.groupingContextStack.lastElement\n if (parentContext) {\n parentContext.childContexts.push(groupingContext)\n }\n else {\n layoutPass.requests.push(groupingContext)\n }\n layoutPass.groupingContextStack.push(groupingContext)\n return this\n }\n\n\n /** Ends the current grouping wrapper frame and returns this rectangle unchanged. */\n endGroupingWrapperFrame() {\n const layoutPass = UIRectangle._groupingWrapperFrameLayoutPasses.lastElement\n if (!layoutPass?.groupingContextStack.length) {\n throw new Error(\"endGroupingWrapperFrame() requires a matching beginGroupingWrapperFrame()\")\n }\n layoutPass.groupingContextStack.pop()\n return this\n }\n\n\n static _beginGroupingWrapperFrameLayoutPass(owner: UIView) {\n UIRectangle._groupingWrapperFrameLayoutPasses.push({\n owner,\n groupingContextStack: [],\n requests: []\n })\n }\n\n\n static _endGroupingWrapperFrameLayoutPass(owner: UIView) {\n const layoutPass = UIRectangle._groupingWrapperFrameLayoutPasses.pop()\n if (!layoutPass || layoutPass.owner !== owner) {\n throw new Error(\"Unbalanced grouping wrapper frame layout pass\")\n }\n if (layoutPass.groupingContextStack.length) {\n console.error(\"beginGroupingWrapperFrame() was not balanced with endGroupingWrapperFrame()\", owner)\n layoutPass.groupingContextStack.length = 0\n }\n if (!UIView.isVirtualLayouting) {\n UIRectangle._reconcileGroupingWrapperFrames(layoutPass)\n }\n }\n\n\n static _assignFrameToView(frame: UIRectangle, view: UIView) {\n view.frame = frame\n const groupingContexts = UIRectangle._groupingWrapperFrameLayoutPasses.lastElement?.groupingContextStack\n if (!groupingContexts?.length) {\n return\n }\n groupingContexts.forEach(groupingContext => groupingContext.framesByView.set(view, frame.copy()))\n const innermostContext = groupingContexts.lastElement\n if (!innermostContext.views.contains(view)) {\n innermostContext.views.push(view)\n }\n }\n\n\n static _reconcileGroupingWrapperFrames(layoutPass: UIGroupingWrapperFrameLayoutPass) {\n const owner = layoutPass.owner\n const previousRecords = UIRectangle._groupingWrapperFrameRecordsByOwner.get(owner) ?? []\n const availablePreviousRecords = previousRecords.copy()\n const nextRecords: UIGroupingWrapperFrameRecord[] = []\n const groupedViews = new Set<UIView>()\n const configuredIdentifiers = new Set<string>()\n\n const validateContext = (request: UIGroupingWrapperFrameContext) => {\n if (request.configuration.identifier) {\n if (configuredIdentifiers.has(request.configuration.identifier)) {\n throw new Error(\"Grouping wrapper frame identifiers must be unique within one layout owner\")\n }\n configuredIdentifiers.add(request.configuration.identifier)\n }\n request.views.forEach(view => {\n if (view.superview !== owner) {\n throw new Error(\"Views in a grouping wrapper frame must be direct subviews of the layout owner\")\n }\n if (groupedViews.has(view)) {\n throw new Error(\"A view cannot belong to multiple grouping wrapper frames in one layout pass\")\n }\n groupedViews.add(view)\n })\n request.childContexts.forEach(validateContext)\n }\n layoutPass.requests.forEach(validateContext)\n\n const recordForRequest = (request: UIGroupingWrapperFrameContext) => {\n let record: UIGroupingWrapperFrameRecord | undefined\n if (request.configuration.identifier) {\n record = availablePreviousRecords.find(\n candidate => candidate.identifier === request.configuration.identifier\n )\n }\n else {\n record = availablePreviousRecords.find(candidate => !candidate.identifier)\n }\n if (record) {\n availablePreviousRecords.removeElement(record)\n }\n else {\n record = UIRectangle._newGroupingWrapperFrameRecord()\n }\n return record\n }\n\n const reconcileContext = (\n request: UIGroupingWrapperFrameContext,\n containerHTMLElement: HTMLElement\n ): UIGroupingWrapperFrameRecord | undefined => {\n if (!request.framesByView.size) {\n return\n }\n const record = recordForRequest(request)\n UIRectangle._configureGroupingWrapperFrameRecord(\n record,\n request,\n owner,\n containerHTMLElement\n )\n nextRecords.push(record)\n record.childRecords = request.childContexts.map(childContext =>\n reconcileContext(childContext, record.coordinateSpaceHTMLElement)\n ).filter((childRecord): childRecord is UIGroupingWrapperFrameRecord => !!childRecord)\n\n const elementByView = new Map<UIView, HTMLElement>()\n record.views.forEach(view => elementByView.set(view, view.viewHTMLElement))\n record.childRecords.forEach(childRecord => {\n UIRectangle._viewsInGroupingWrapperFrameRecord(childRecord).forEach(view =>\n elementByView.set(view, childRecord.wrapperHTMLElement)\n )\n })\n UIRectangle._reorderGroupingWrapperFrameElements(\n record.coordinateSpaceHTMLElement,\n owner.subviews.map(view => elementByView.get(view)).filter(\n (element): element is HTMLElement => !!element\n )\n )\n return record\n }\n\n const rootRecords = layoutPass.requests.map(request =>\n reconcileContext(request, owner.viewHTMLElement)\n ).filter((record): record is UIGroupingWrapperFrameRecord => !!record)\n\n availablePreviousRecords.forEach(record => {\n record.views.forEach(view => {\n if (view.viewHTMLElement.parentElement === record.coordinateSpaceHTMLElement) {\n owner.viewHTMLElement.appendChild(view.viewHTMLElement)\n }\n })\n record.wrapperHTMLElement.remove()\n })\n\n const rootRecordByView = new Map<UIView, UIGroupingWrapperFrameRecord>()\n rootRecords.forEach(record => {\n UIRectangle._viewsInGroupingWrapperFrameRecord(record).forEach(view =>\n rootRecordByView.set(view, record)\n )\n })\n const desiredTopLevelElements: HTMLElement[] = []\n owner.subviews.forEach(view => {\n const record = rootRecordByView.get(view)\n const element = record?.wrapperHTMLElement ?? view.viewHTMLElement\n if (!desiredTopLevelElements.contains(element)) {\n desiredTopLevelElements.push(element)\n }\n })\n UIRectangle._reorderGroupingWrapperFrameElements(owner.viewHTMLElement, desiredTopLevelElements)\n\n UIRectangle._groupingWrapperFrameRecordsByOwner.set(owner, nextRecords)\n }\n\n\n static _viewsInGroupingWrapperFrameRecord(record: UIGroupingWrapperFrameRecord): UIView[] {\n return record.views.concat(record.childRecords.flatMap(childRecord =>\n UIRectangle._viewsInGroupingWrapperFrameRecord(childRecord)\n ))\n }\n\n\n static _reorderGroupingWrapperFrameElements(containerHTMLElement: HTMLElement, desiredElements: HTMLElement[]) {\n const uniqueDesiredElements = desiredElements.filter(\n (element, index) => desiredElements.indexOf(element) === index\n )\n const currentElements = Array.from(containerHTMLElement.children).filter(element =>\n uniqueDesiredElements.contains(element as HTMLElement)\n ) as HTMLElement[]\n if (!currentElements.isEqualToArray(uniqueDesiredElements) ||\n uniqueDesiredElements.some(element => element.parentElement !== containerHTMLElement)) {\n uniqueDesiredElements.forEach(element => containerHTMLElement.appendChild(element))\n }\n }\n\n\n static _newGroupingWrapperFrameRecord(): UIGroupingWrapperFrameRecord {\n const wrapperHTMLElement = document.createElement(\"div\")\n const coordinateSpaceHTMLElement = document.createElement(\"div\")\n wrapperHTMLElement.classList.add(\"UICore_UIGroupingWrapperFrame\")\n wrapperHTMLElement.setAttribute(\"data-uicore-grouping-wrapper-frame\", \"\")\n coordinateSpaceHTMLElement.classList.add(\"UICore_UIGroupingWrapperFrame_CoordinateSpace\")\n coordinateSpaceHTMLElement.setAttribute(\"data-uicore-grouping-wrapper-coordinate-space\", \"\")\n wrapperHTMLElement.appendChild(coordinateSpaceHTMLElement)\n return {\n wrapperHTMLElement,\n coordinateSpaceHTMLElement,\n views: [],\n childRecords: [],\n configuredClassNames: [],\n configuredAttributeNames: [],\n configuredStyleNames: []\n }\n }\n\n\n static _configureGroupingWrapperFrameRecord(\n record: UIGroupingWrapperFrameRecord,\n request: UIGroupingWrapperFrameContext,\n owner: UIView,\n containerHTMLElement: HTMLElement\n ) {\n const wrapperHTMLElement = record.wrapperHTMLElement\n record.configuredClassNames.forEach(className => wrapperHTMLElement.classList.remove(className))\n record.configuredAttributeNames.forEach(attributeName => wrapperHTMLElement.removeAttribute(attributeName))\n record.configuredStyleNames.forEach(styleName => (wrapperHTMLElement.style as any)[styleName] = \"\")\n\n wrapperHTMLElement.classList.add(\"UICore_UIGroupingWrapperFrame\")\n wrapperHTMLElement.setAttribute(\"data-uicore-grouping-wrapper-frame\", \"\")\n\n record.identifier = request.configuration.identifier\n record.views = request.views.copy()\n record.configuredClassNames = request.configuration.classNames?.copy() ?? []\n record.configuredAttributeNames = Object.keys(request.configuration.attributes ?? {})\n record.configuredStyleNames = Object.keys(request.configuration.style ?? {})\n\n record.configuredClassNames.forEach(className => wrapperHTMLElement.classList.add(className))\n Object.keys(request.configuration.attributes ?? {}).forEach(attributeName => {\n wrapperHTMLElement.setAttribute(\n attributeName,\n (request.configuration.attributes as Record<string, string>)[attributeName]\n )\n })\n Object.keys(request.configuration.style ?? {}).forEach(styleName => {\n (wrapperHTMLElement.style as any)[styleName] = (request.configuration.style as any)[styleName]\n })\n if (record.identifier) {\n wrapperHTMLElement.setAttribute(\"data-uicore-grouping-wrapper-frame-identifier\", record.identifier)\n }\n else {\n wrapperHTMLElement.removeAttribute(\"data-uicore-grouping-wrapper-frame-identifier\")\n }\n\n const assignedFrames = Array.from(request.framesByView.values())\n const framePoints: UIPoint[] = []\n assignedFrames.forEach(frame => {\n framePoints.push(frame.min)\n framePoints.push(frame.max)\n })\n const defaultFrame = UIRectangle.boundingBoxForPoints(framePoints)\n const wrapperFrame = request.configuration.frame?.(defaultFrame.copy(), assignedFrames.copy()) ?? defaultFrame\n\n wrapperHTMLElement.style.position = \"absolute\"\n wrapperHTMLElement.style.left = wrapperFrame.x + \"px\"\n wrapperHTMLElement.style.top = wrapperFrame.y + \"px\"\n wrapperHTMLElement.style.width = wrapperFrame.width + \"px\"\n wrapperHTMLElement.style.height = wrapperFrame.height + \"px\"\n wrapperHTMLElement.style.boxSizing = \"border-box\"\n\n if (wrapperHTMLElement.parentElement !== containerHTMLElement) {\n containerHTMLElement.appendChild(wrapperHTMLElement)\n }\n\n const coordinateSpaceHTMLElement = record.coordinateSpaceHTMLElement\n coordinateSpaceHTMLElement.classList.add(\"UICore_UIGroupingWrapperFrame_CoordinateSpace\")\n coordinateSpaceHTMLElement.setAttribute(\"data-uicore-grouping-wrapper-coordinate-space\", \"\")\n coordinateSpaceHTMLElement.style.position = \"absolute\"\n coordinateSpaceHTMLElement.style.left =\n -wrapperFrame.x - (wrapperHTMLElement.clientLeft || 0) + \"px\"\n coordinateSpaceHTMLElement.style.top =\n -wrapperFrame.y - (wrapperHTMLElement.clientTop || 0) + \"px\"\n coordinateSpaceHTMLElement.style.width = owner.bounds.width + \"px\"\n coordinateSpaceHTMLElement.style.height = owner.bounds.height + \"px\"\n\n }\n\n\n static _topLevelHTMLElementForView(view: UIView) {\n let element = view.viewHTMLElement\n while (element.parentElement && element.parentElement !== view.superview?.viewHTMLElement) {\n element = element.parentElement as HTMLElement & typeof element\n }\n return element\n }\n\n\n static _detachViewFromGroupingWrapperFrame(view: UIView) {\n const superviewHTMLElement = view.superview?.viewHTMLElement\n if (!superviewHTMLElement || view.viewHTMLElement.parentElement === superviewHTMLElement) {\n return\n }\n const wrapperHTMLElement = view.viewHTMLElement.closest(\"[data-uicore-grouping-wrapper-frame]\")\n superviewHTMLElement.appendChild(view.viewHTMLElement)\n UIRectangle._removeEmptyGroupingWrapperFrameAncestors(wrapperHTMLElement)\n }\n\n\n static _removeEmptyGroupingWrapperFrameAncestors(wrapperHTMLElement: Element | null) {\n while (wrapperHTMLElement) {\n const parentWrapperHTMLElement = wrapperHTMLElement.parentElement?.closest(\n \"[data-uicore-grouping-wrapper-frame]\"\n ) ?? null\n const coordinateSpaceHTMLElement = wrapperHTMLElement.querySelector(\n \":scope > [data-uicore-grouping-wrapper-coordinate-space]\"\n )\n if (coordinateSpaceHTMLElement?.children.length) {\n return\n }\n wrapperHTMLElement.remove()\n wrapperHTMLElement = parentWrapperHTMLElement\n }\n }\n \n \n override toString() {\n \n const result = \"[\" + this.class.name + \"] { x: \" + this.x + \", y: \" + this.y + \", \" +\n \"height: \" + this.height.toFixed(2) + \", width: \" + this.height.toFixed(2) + \" }\"\n \n return result\n \n }\n \n get [Symbol.toStringTag]() {\n return this.toString()\n }\n \n \n IF(condition: boolean): UIRectangleConditionalChain<UIRectangle> {\n const conditionalBlock = new UIRectangleConditionalBlock(this, condition)\n // @ts-ignore\n return conditionalBlock.getProxy()\n }\n \n // These will be intercepted by the proxy, but we define them for TypeScript\n ELSE_IF(condition: boolean): UIRectangle {\n return this\n }\n \n ELSE(): UIRectangle {\n return this\n }\n \n ENDIF(): this\n ENDIF<T, R>(performFunction: (result: T) => R): R\n ENDIF<T, R>(performFunction?: (result: T) => R): R | this {\n if (performFunction) {\n return performFunction(this as any)\n }\n return this\n }\n \n \n // Bounding box\n static boundingBoxForPoints(points: UIPoint[]) {\n if (points.length === 0) {\n return new UIRectangle()\n }\n \n const first = points[0]\n const result = new UIRectangle(first.x, first.y, 0, 0)\n \n for (let i = 1; i < points.length; i++) {\n result.updateByAddingPoint(points[i])\n }\n return result\n }\n \n static boundingBoxForRectanglesAndPoints(rectanglesAndPoints: (UIPoint | UIRectangle)[]) {\n if (rectanglesAndPoints.length === 0) {\n return new UIRectangle()\n }\n \n const first = rectanglesAndPoints[0]\n const result = first instanceof UIRectangle\n ? new UIRectangle(first.x, first.y, first.height, first.width)\n : new UIRectangle(first.x, first.y, 0, 0)\n \n for (let i = 1; i < rectanglesAndPoints.length; i++) {\n const rectangleOrPoint = rectanglesAndPoints[i]\n if (rectangleOrPoint instanceof UIRectangle) {\n result.updateByAddingPoint(rectangleOrPoint.min)\n result.updateByAddingPoint(rectangleOrPoint.max)\n }\n else {\n result.updateByAddingPoint(rectangleOrPoint)\n }\n }\n return result\n }\n \n \n beginUpdates() {\n this._isBeingUpdated = YES\n }\n \n finishUpdates() {\n this._isBeingUpdated = NO\n this.didChange()\n }\n \n \n didChange() {\n \n // Callback to be set by delegate\n \n }\n \n _rectanglePointDidChange() {\n if (!this._isBeingUpdated) {\n this.didChange()\n }\n }\n \n \n}\n\n\ndeclare global {\n interface Array<T> {\n /** Returns the smallest rectangle containing every point and rectangle in the array. */\n boundingBox(this: Array<UIPoint | UIRectangle>): UIRectangle\n }\n}\n\n\nif (!(\"boundingBox\" in Array.prototype)) {\n Object.defineProperty(Array.prototype, \"boundingBox\", {\n configurable: YES,\n enumerable: NO,\n writable: YES,\n value: function (this: Array<UIPoint | UIRectangle>) {\n return UIRectangle.boundingBoxForRectanglesAndPoints(this)\n }\n })\n}\n\n\n// 1. Methods available when holding a UIRectangle\ntype RectangleChainMethods<TResult> = {\n [K in keyof UIRectangle as (\n K extends 'IF' | 'ELSE' | 'ELSE_IF' | 'ENDIF' ? never : K\n )]:\n UIRectangle[K] extends (...args: infer Args) => infer R\n ? R extends UIRectangle | UIRectangle[]\n // CHANGE: We do NOT add 'R' to 'TResult' here. We only update the current state (R).\n ? (...args: Args) => UIRectangleConditionalChain<R, TResult>\n : never\n : never\n};\n\n// 2. Methods available when holding a UIRectangle[]\ntype ArrayChainMethods<TResult> = {\n [K in keyof UIRectangle[]]:\n UIRectangle[][K] extends UIRectangle\n ? UIRectangleConditionalChain<UIRectangle, TResult> // No accumulation for properties\n : UIRectangle[][K] extends (...args: infer Args) => infer R\n ? R extends UIRectangle | UIRectangle[]\n // CHANGE: We do NOT add 'R' to 'TResult' here either.\n ? (...args: Args) => UIRectangleConditionalChain<R, TResult>\n : never\n : never\n};\n\n// 3. Methods available in both states (Control Flow + Transform)\ntype SharedChainMethods<TCurrent, TResult> = {\n // IF opens a nested conditional block. After the matching ENDIF(), the chain resumes\n // as a UIRectangle \u2014 both at runtime (the proxy forwards to the current rectangle) and\n // at the type level. Nesting is supported to arbitrary depth.\n IF(condition: boolean): UIRectangleConditionalChain<UIRectangle, TResult>;\n \n // TRANSFORM applies an inline function and continues the chain.\n TRANSFORM<R extends UIRectangle>(fn: (current: TCurrent) => R): UIRectangleConditionalChain<R, TResult>;\n \n // ELSE_IF / ELSE reset the branch state.\n ELSE_IF(condition: boolean): UIRectangleConditionalChain<UIRectangle, TResult | TCurrent>;\n ELSE(): UIRectangleConditionalChain<UIRectangle, TResult | TCurrent>;\n \n // ENDIF closes this IF block.\n // No-arg: always typed as UIRectangle so rectangle methods are available immediately\n // after. At runtime the proxy wraps the current rectangle and forwards all calls.\n // With transform fn: returns R directly, escaping the chain entirely.\n ENDIF(): UIRectangle;\n ENDIF<R>(performFunction: (result: TResult | TCurrent) => R): R;\n};\n\n// 4. The Main Type (No changes needed here, just re-stating for context)\ntype UIRectangleConditionalChain<TCurrent, TResult = TCurrent> =\n (TCurrent extends UIRectangle ? RectangleChainMethods<TResult> : {}) &\n (TCurrent extends UIRectangle[] ? ArrayChainMethods<TResult> : {}) &\n SharedChainMethods<TCurrent, TResult>;\n\n\ninterface UIRectangleConditionalFrame {\n // The result to resume from when this frame's ENDIF is reached (if no branch matched)\n resultBeforeIF: any\n // The result accumulated inside the active branch of this frame\n currentResult: any\n // The result at the point of IF \u2014 used to reset currentResult when entering each new branch\n originalResult: any\n // Whether any branch of this frame has already been taken (latches to true, never resets)\n anyConditionMet: boolean\n // Whether the current branch is the one that was taken (flips per ELSE_IF / ELSE)\n currentBranchActive: boolean\n}\n\nclass UIRectangleConditionalBlock {\n \n // Stack of nested IF frames. The top of the stack is the innermost active IF.\n private _stack: UIRectangleConditionalFrame[]\n \n constructor(initialResult: UIRectangle, condition: boolean) {\n // Seed the stack with the first IF frame.\n // resultBeforeIF is null here because this is the outermost block;\n // ENDIF on the last frame simply returns currentResult.\n this._stack = [{\n resultBeforeIF: null,\n currentResult: initialResult,\n originalResult: initialResult,\n anyConditionMet: condition,\n currentBranchActive: condition,\n }]\n }\n \n // Convenience getter that operates on the innermost frame.\n private get _top(): UIRectangleConditionalFrame {\n return this._stack[this._stack.length - 1]\n }\n \n // A method body should only execute when every frame in the stack has its\n // current branch active (handles nested IFs correctly).\n private get _shouldExecute(): boolean {\n return this._stack.every(frame => frame.currentBranchActive)\n }\n \n private createProxy(): UIRectangleConditionalChain<any, any> {\n const self = this\n \n return new Proxy({}, {\n get(_, prop) {\n \n // \u2500\u2500 Control Flow \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \n if (prop === 'IF') {\n return (condition: boolean) => {\n // Push a new frame. The new frame's result starts as a copy of\n // the current innermost result so that chaining inside the nested\n // IF begins from the right value.\n self._stack.push({\n resultBeforeIF: self._top.currentResult,\n currentResult: self._top.currentResult,\n originalResult: self._top.currentResult,\n anyConditionMet: condition,\n currentBranchActive: condition,\n })\n return self.createProxy()\n }\n }\n \n if (prop === 'TRANSFORM') {\n return <R extends UIRectangle>(fn: (current: any) => R) => {\n if (self._shouldExecute) {\n self._top.currentResult = fn(self._top.currentResult)\n }\n return self.createProxy()\n }\n }\n \n if (prop === 'ELSE_IF') {\n return (condition: boolean) => {\n const top = self._top\n // Only consider this branch if no prior branch has been taken.\n // Always deactivate the current branch first, then activate only\n // if this condition is true and nothing has matched yet.\n top.currentBranchActive = !top.anyConditionMet && condition\n if (top.currentBranchActive) {\n top.anyConditionMet = true\n top.currentResult = top.originalResult\n }\n return self.createProxy()\n }\n }\n \n if (prop === 'ELSE') {\n return () => {\n const top = self._top\n top.currentBranchActive = !top.anyConditionMet\n if (top.currentBranchActive) {\n top.anyConditionMet = true\n top.currentResult = top.originalResult\n }\n return self.createProxy()\n }\n }\n \n if (prop === 'ENDIF') {\n function endif(): any\n function endif<R>(performFunction: (result: any) => R): R\n function endif<R>(performFunction?: (result: any) => R): R | any {\n \n if (self._stack.length === 1) {\n // Outermost ENDIF. Return the bare rectangle (or transform it).\n const top = self._top\n const result = top.currentResult\n if (performFunction && top.anyConditionMet) {\n return performFunction(result)\n }\n else {\n return result\n }\n }\n \n // Pop the innermost (nested) frame.\n const completedFrame = self._stack.pop()!\n \n // If any branch was taken use its accumulated result; otherwise\n // fall back to the value that existed before entering this IF.\n const resolvedResult = completedFrame.anyConditionMet\n ? completedFrame.currentResult\n : completedFrame.resultBeforeIF\n \n // Optionally transform, then write back into the parent frame.\n const finalResult = performFunction ? performFunction(resolvedResult) : resolvedResult\n self._top.currentResult = finalResult\n \n // Return the proxy so the outer chain can continue.\n return self.createProxy()\n }\n return endif\n }\n \n // \u2500\u2500 Forward to currentResult (UIRectangle or UIRectangle[]) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \n const value = self._top.currentResult[prop]\n \n // Case A: method call\n if (typeof value === 'function') {\n return (...args: any[]) => {\n if (self._shouldExecute) {\n self._top.currentResult = value.apply(self._top.currentResult, args)\n }\n return self.createProxy()\n }\n }\n \n // Case B: property access (e.g. array .lastElement)\n if (self._shouldExecute) {\n self._top.currentResult = value\n }\n \n return self.createProxy()\n }\n }) as any\n }\n \n getProxy(): UIRectangleConditionalChain<any,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AAEA,eAAO,KAAK,YAAY;AAAA,MAC5B;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,WAAkD;AAC9C,WAAO,KAAK,YAAY;AAAA,EAC5B;AAEJ;",
6
- "names": ["_a", "endif"]
4
+ "sourcesContent": ["import {FIRST_OR_NIL, IS, IS_DEFINED, IS_NIL, IS_NOT_LIKE_NULL, IS_NOT_NIL, nil, NO, UIObject, YES} from \"./UIObject\"\nimport {UIPoint} from \"./UIPoint\"\nimport {UIView} from \"./UIView\"\n\n\nexport type SizeNumberOrFunctionOrView = number | ((constrainingOrthogonalSize: number) => number) | UIView\n\n/** A position along an axis (0 = start, 0.5 = centered, 1 = end), or \"stretch\" to fill the available space instead. */\nexport type UIRectanglePositionOrStretch = number | \"stretch\"\n\nexport interface UIRectangleFlowLayoutOptions {\n /** Horizontal spacing between views on the same row. Defaults to 0. */\n itemGap?: number\n /** Vertical spacing between wrapped rows. Defaults to 0. */\n lineGap?: number\n /** Caps how many views a row may hold before wrapping, even if more would fit by width. Defaults to unlimited. */\n maxViewsPerRow?: number\n /** Position of a row within this rectangle's width when that row holds more than one view. Defaults to 0 (left). */\n centeredOnPosition?: number\n /**\n * Position (or \"stretch\" to fill the row) of a view that wrapping isolated onto a row of its\n * own - never consulted for a view still sharing a row with another. A single value broadcasts\n * to every isolated view; an array is matched by index against `views`. Defaults to 0 (left).\n */\n positionOrStretchWhenIsolatedOnOwnWrappedRow?: UIRectanglePositionOrStretch | UIRectanglePositionOrStretch[]\n}\n\nexport type UIGroupingWrapperFrameConfiguration = {\n /** Stable identity used to reuse the same wrapper when surrounding conditional layout changes. */\n identifier?: string\n /** CSS classes applied to the generated outer wrapper element. */\n classNames?: string[]\n /** HTML attributes applied to the generated outer wrapper element. */\n attributes?: Record<string, string>\n /** Presentational CSS applied to the generated outer wrapper element. */\n style?: Partial<CSSStyleDeclaration>\n /** Optionally transforms the bounding frame calculated from all assigned view frames. */\n frame?: (defaultFrame: UIRectangle, assignedFrames: UIRectangle[]) => UIRectangle\n}\n\ntype UIGroupingWrapperFrameContext = {\n configuration: UIGroupingWrapperFrameConfiguration\n views: UIView[]\n framesByView: Map<UIView, UIRectangle>\n childContexts: UIGroupingWrapperFrameContext[]\n}\n\ntype UIGroupingWrapperFrameLayoutPass = {\n owner: UIView\n groupingContextStack: UIGroupingWrapperFrameContext[]\n requests: UIGroupingWrapperFrameContext[]\n}\n\ntype UIGroupingWrapperFrameRecord = {\n identifier?: string\n wrapperHTMLElement: HTMLDivElement\n coordinateSpaceHTMLElement: HTMLDivElement\n views: UIView[]\n childRecords: UIGroupingWrapperFrameRecord[]\n configuredClassNames: string[]\n configuredAttributeNames: string[]\n configuredStyleNames: string[]\n}\n\nexport class UIRectangle extends UIObject {\n \n static _groupingWrapperFrameLayoutPasses: UIGroupingWrapperFrameLayoutPass[] = []\n static _groupingWrapperFrameRecordsByOwner = new WeakMap<UIView, UIGroupingWrapperFrameRecord[]>()\n \n _isBeingUpdated: boolean\n rectanglePointDidChange?: (b: any) => void\n \n // COW: Internal data structure that can be shared\n private _data: {\n min: UIPoint\n max: UIPoint\n minHeight?: number\n maxHeight?: number\n minWidth?: number\n maxWidth?: number\n refCount: number\n }\n \n // COW: Flag to indicate this is a lazy copy\n private _isLazyCopy: boolean\n \n \n constructor(x: number = 0, y: number = 0, height: number = 0, width: number = 0) {\n \n super()\n \n this._isLazyCopy = NO\n this._isBeingUpdated = NO\n \n // COW: Create the shared data structure\n this._data = {\n min: new UIPoint(x, y),\n max: new UIPoint(x + width, y + height),\n refCount: 1\n }\n \n this._setupPointCallbacks()\n \n if (IS_NIL(height)) {\n this._data.max.y = height\n }\n \n if (IS_NIL(width)) {\n this._data.max.x = width\n }\n \n }\n \n // COW: Setup callbacks for point changes\n private _setupPointCallbacks() {\n this._data.min.didChange = (point) => {\n this.rectanglePointDidChange?.(point)\n this._rectanglePointDidChange()\n }\n this._data.max.didChange = (point) => {\n this.rectanglePointDidChange?.(point)\n this._rectanglePointDidChange()\n }\n }\n \n // COW: Materialize a lazy copy before mutation\n materialize() {\n if (this._isLazyCopy || this._data.refCount > 1) {\n this._data.refCount--\n \n const oldData = this._data\n this._data = {\n min: oldData.min.copy(),\n max: oldData.max.copy(),\n minHeight: oldData.minHeight,\n maxHeight: oldData.maxHeight,\n minWidth: oldData.minWidth,\n maxWidth: oldData.maxWidth,\n refCount: 1\n }\n \n this._setupPointCallbacks()\n this._isLazyCopy = NO\n }\n }\n \n // Copy on write: Lazy copy that shares data\n // Tested to reduce CPU time from 2.2% to 1% during heavy resizing\n lazyCopy(): UIRectangle {\n const result = Object.create(UIRectangle.prototype)\n result._data = this._data\n result._data.refCount++\n result._isLazyCopy = YES\n result._isBeingUpdated = NO\n result.rectanglePointDidChange = this.rectanglePointDidChange\n return result\n }\n \n // COW: Getters and setters that materialize on write\n get min(): UIPoint {\n return this._data.min\n }\n \n set min(value: UIPoint) {\n this.materialize()\n this._data.min = value\n this._setupPointCallbacks()\n }\n \n get max(): UIPoint {\n return this._data.max\n }\n \n set max(value: UIPoint) {\n this.materialize()\n this._data.max = value\n this._setupPointCallbacks()\n }\n \n get minHeight(): number | undefined {\n return this._data.minHeight\n }\n \n set minHeight(value: number | undefined) {\n this.materialize()\n this._data.minHeight = value\n }\n \n get maxHeight(): number | undefined {\n return this._data.maxHeight\n }\n \n set maxHeight(value: number | undefined) {\n this.materialize()\n this._data.maxHeight = value\n }\n \n get minWidth(): number | undefined {\n return this._data.minWidth\n }\n \n set minWidth(value: number | undefined) {\n this.materialize()\n this._data.minWidth = value\n }\n \n get maxWidth(): number | undefined {\n return this._data.maxWidth\n }\n \n set maxWidth(value: number | undefined) {\n this.materialize()\n this._data.maxWidth = value\n }\n \n \n copy() {\n \n const result = new UIRectangle(this.x, this.y, this.height, this.width)\n \n result.minHeight = this.minHeight\n result.minWidth = this.minWidth\n result.maxHeight = this.maxHeight\n result.maxWidth = this.maxWidth\n \n return result\n \n }\n \n isEqualTo(rectangle: UIRectangle | null | undefined) {\n return (IS(rectangle) && this.min.isEqualTo(rectangle.min) && this.max.isEqualTo(rectangle.max))\n }\n \n static zero() {\n return new UIRectangle(0, 0, 0, 0)\n }\n \n containsPoint(point: UIPoint) {\n return this.min.x <= point.x && this.min.y <= point.y &&\n point.x <= this.max.x && point.y <= this.max.y\n }\n \n updateByAddingPoint(point: UIPoint) {\n \n this.materialize() // COW: Materialize before mutation\n \n if (!point) {\n point = new UIPoint(0, 0)\n }\n \n this.beginUpdates()\n \n const min = this.min.copy()\n if (min.x === nil) {\n min.x = this.max.x\n }\n if (min.y === nil) {\n min.y = this.max.y\n }\n \n const max = this.max.copy()\n if (max.x === nil) {\n max.x = this.min.x\n }\n if (max.y === nil) {\n max.y = this.min.y\n }\n \n this.min.x = Math.min(min.x, point.x)\n this.min.y = Math.min(min.y, point.y)\n this.max.x = Math.max(max.x, point.x)\n this.max.y = Math.max(max.y, point.y)\n \n this.finishUpdates()\n \n }\n \n scale(scale: number) {\n this.materialize() // COW: Materialize before mutation\n if (IS_NOT_NIL(this.max.y)) {\n this.height = this.height * scale\n }\n if (IS_NOT_NIL(this.max.x)) {\n this.width = this.width * scale\n }\n }\n \n get height() {\n if (this.max.y === nil) {\n return nil\n }\n return this.max.y - this.min.y\n }\n \n set height(height: number) {\n this.materialize() // COW: Materialize before mutation\n this._data.max.y = this.min.y + height\n }\n \n \n get width() {\n if (this.max.x === nil) {\n return nil\n }\n return this.max.x - this.min.x\n }\n \n set width(width: number) {\n this.materialize() // COW: Materialize before mutation\n this._data.max.x = this.min.x + width\n }\n \n \n get x() {\n return this.min.x\n }\n \n set x(x: number) {\n \n this.materialize() // COW: Materialize before mutation\n this.beginUpdates()\n \n const width = this.width\n this._data.min.x = x\n this._data.max.x = this.min.x + width\n \n this.finishUpdates()\n \n }\n \n \n get y() {\n return this.min.y\n }\n \n \n set y(y: number) {\n \n this.materialize() // COW: Materialize before mutation\n this.beginUpdates()\n \n const height = this.height\n this._data.min.y = y\n this._data.max.y = this.min.y + height\n \n this.finishUpdates()\n \n }\n \n \n get topLeft() {\n return this.min.copy()\n }\n \n get topRight() {\n return new UIPoint(this.max.x, this.y)\n }\n \n get bottomLeft() {\n return new UIPoint(this.x, this.max.y)\n }\n \n get bottomRight() {\n return this.max.copy()\n }\n \n \n get center() {\n return this.min.copy().add(this.min.to(this.max).scale(0.5))\n }\n \n set center(center: UIPoint) {\n this.materialize() // COW: Materialize before mutation\n const offset = this.center.to(center)\n this.offsetByPoint(offset)\n }\n \n offsetByPoint(offset: UIPoint) {\n this.materialize() // COW: Materialize before mutation\n this.min.add(offset)\n this.max.add(offset)\n \n return this\n }\n \n \n concatenateWithRectangle(rectangle: UIRectangle) {\n this.updateByAddingPoint(rectangle.bottomRight)\n this.updateByAddingPoint(rectangle.topLeft)\n return this\n }\n \n rectangleByConcatenatingWithRectangle(rectangle: UIRectangle) {\n return this.lazyCopy().concatenateWithRectangle(rectangle) // COW: Use lazyCopy\n }\n \n \n intersectionRectangleWithRectangle(rectangle: UIRectangle): UIRectangle {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.materialize() // COW: We're going to modify it\n \n result.beginUpdates()\n \n const min = result.min\n if (min.x === nil) {\n min.x = rectangle.max.x - Math.min(result.width, rectangle.width)\n }\n if (min.y === nil) {\n min.y = rectangle.max.y - Math.min(result.height, rectangle.height)\n }\n \n const max = result.max\n if (max.x === nil) {\n max.x = rectangle.min.x + Math.min(result.width, rectangle.width)\n }\n if (max.y === nil) {\n max.y = rectangle.min.y + Math.min(result.height, rectangle.height)\n }\n \n result.min.x = Math.max(result.min.x, rectangle.min.x)\n result.min.y = Math.max(result.min.y, rectangle.min.y)\n result.max.x = Math.min(result.max.x, rectangle.max.x)\n result.max.y = Math.min(result.max.y, rectangle.max.y)\n \n \n if (result.height < 0) {\n \n const averageY = (this.center.y + rectangle.center.y) * 0.5\n result.min.y = averageY\n result.max.y = averageY\n \n }\n \n if (result.width < 0) {\n \n const averageX = (this.center.x + rectangle.center.x) * 0.5\n result.min.x = averageX\n result.max.x = averageX\n \n }\n \n result.finishUpdates()\n \n return result\n \n }\n \n \n get area() {\n return this.height * this.width\n }\n \n \n intersectsWithRectangle(rectangle: UIRectangle) {\n return (this.intersectionRectangleWithRectangle(rectangle).area != 0)\n }\n \n \n // Distance between two rectangles' facing edges, assuming `rectangle`\n // sits in the named direction from `this`. Zero means the edges touch\n // exactly; negative means the rectangles overlap in that axis.\n topGapToRectangle(rectangle: UIRectangle): number {\n return rectangle.min.y - this.max.y\n }\n \n bottomGapToRectangle(rectangle: UIRectangle): number {\n return this.min.y - rectangle.max.y\n }\n \n leftGapToRectangle(rectangle: UIRectangle): number {\n return rectangle.min.x - this.max.x\n }\n \n rightGapToRectangle(rectangle: UIRectangle): number {\n return this.min.x - rectangle.max.x\n }\n \n \n // True when `rectangle` lies entirely within this rectangle's bounds \u2014\n // stricter than intersectsWithRectangle; catches a child frame that\n // overflows its container.\n containsRectangle(rectangle: UIRectangle): boolean {\n return this.min.x <= rectangle.min.x && this.min.y <= rectangle.min.y &&\n this.max.x >= rectangle.max.x && this.max.y >= rectangle.max.y\n }\n \n \n // add some space around the rectangle\n rectangleWithInsets(left: number, right: number, bottom: number, top: number) {\n const result = this.lazyCopy() // COW: Use lazyCopy\n result.materialize() // COW: We're modifying multiple properties\n result.min.x = this.min.x + left\n result.max.x = this.max.x - right\n result.min.y = this.min.y + top\n result.max.y = this.max.y - bottom\n return result\n }\n \n rectangleWithInset(inset: number) {\n return this.rectangleWithInsets(inset, inset, inset, inset)\n }\n \n rectangleWithHeight(height: SizeNumberOrFunctionOrView, centeredOnPosition: number = nil) {\n \n height = this._heightNumberFromSizeNumberOrFunctionOrView(height)\n \n if (isNaN(centeredOnPosition)) {\n centeredOnPosition = nil\n }\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.height = height\n \n if (centeredOnPosition != nil) {\n const change = height - this.height\n result.offsetByPoint(new UIPoint(0, change * centeredOnPosition).scale(-1))\n }\n \n return result\n \n }\n \n rectangleWithWidth(width: SizeNumberOrFunctionOrView, centeredOnPosition: number = nil) {\n \n width = this._widthNumberFromSizeNumberOrFunctionOrView(width)\n \n if (isNaN(centeredOnPosition)) {\n centeredOnPosition = nil\n }\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.width = width\n \n if (centeredOnPosition != nil) {\n const change = width - this.width\n result.offsetByPoint(new UIPoint(change * centeredOnPosition, 0).scale(-1))\n }\n \n return result\n \n }\n \n rectangleWithHeightRelativeToWidth(heightRatio: number = 1, centeredOnPosition: number = nil) {\n return this.rectangleWithHeight(this.width * heightRatio, centeredOnPosition)\n }\n \n rectangleWithWidthRelativeToHeight(widthRatio: number = 1, centeredOnPosition: number = nil) {\n return this.rectangleWithWidth(this.height * widthRatio, centeredOnPosition)\n }\n \n rectangleWithX(x: number, centeredOnPosition: number = 0) {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.x = x - result.width * centeredOnPosition\n \n return result\n \n }\n \n rectangleWithY(y: number, centeredOnPosition: number = 0) {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.y = y - result.height * centeredOnPosition\n \n return result\n \n }\n \n \n rectangleByAddingX(x: number) {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.x = this.x + x\n \n return result\n \n }\n \n rectangleByAddingY(y: number) {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.y = this.y + y\n \n return result\n \n }\n \n rectangleByAddingWidth(widthToAdd: number, centeredOnPosition = 0) {\n \n const result = this.rectangleWithWidth(this.width + widthToAdd, centeredOnPosition)\n \n return result\n \n }\n \n rectangleByAddingHeight(heightToAdd: number, centeredOnPosition = 0) {\n \n const result = this.rectangleWithHeight(this.height + heightToAdd, centeredOnPosition)\n \n return result\n \n }\n \n \n rectangleWithRelativeValues(\n relativeXPosition: number,\n widthMultiplier: number,\n relativeYPosition: number,\n heightMultiplier: number\n ) {\n \n const result = this.lazyCopy() // COW: Use lazyCopy\n result.materialize() // COW: We're modifying multiple properties\n \n const width = result.width\n const height = result.height\n \n result.width = widthMultiplier * width\n result.height = heightMultiplier * height\n \n result.center = new UIPoint(\n relativeXPosition * width,\n relativeYPosition * height\n )\n \n return result\n \n }\n \n \n /**\n * Returns a rectangle with a maximum width constraint\n * If current width exceeds max, centers the constrained width\n */\n rectangleWithMaxWidth(maxWidth: number, centeredOnPosition: number = 0): UIRectangle {\n if (this.width <= maxWidth) {\n return this.lazyCopy() // COW: Use lazyCopy\n }\n return this.rectangleWithWidth(maxWidth, centeredOnPosition)\n }\n \n /**\n * Returns a rectangle with a maximum height constraint\n */\n rectangleWithMaxHeight(maxHeight: number, centeredOnPosition: number = 0): UIRectangle {\n if (this.height <= maxHeight) {\n return this.lazyCopy() // COW: Use lazyCopy\n }\n return this.rectangleWithHeight(maxHeight, centeredOnPosition)\n }\n \n /**\n * Returns a rectangle with minimum width constraint\n */\n rectangleWithMinWidth(minWidth: number, centeredOnPosition: number = 0): UIRectangle {\n if (this.width >= minWidth) {\n return this.lazyCopy() // COW: Use lazyCopy\n }\n return this.rectangleWithWidth(minWidth, centeredOnPosition)\n }\n \n /**\n * Returns a rectangle with minimum height constraint\n */\n rectangleWithMinHeight(minHeight: number, centeredOnPosition: number = 0): UIRectangle {\n if (this.height >= minHeight) {\n return this.lazyCopy() // COW: Use lazyCopy\n }\n return this.rectangleWithHeight(minHeight, centeredOnPosition)\n }\n \n // Returns a new rectangle that is positioned relative to the reference rectangle\n // By default, it makes a copy of this rectangle taht is centered in the target rectangle\n rectangleByCenteringInRectangle(referenceRectangle: UIRectangle, xPosition = 0.5, yPosition = 0.5) {\n const result = this.lazyCopy() // COW: Use lazyCopy\n result.center = referenceRectangle.topLeft\n .pointByAddingX(xPosition * referenceRectangle.width)\n .pointByAddingY(yPosition * referenceRectangle.height)\n return result\n }\n \n \n rectanglesBySplittingWidth(\n weights: SizeNumberOrFunctionOrView[],\n paddings: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 0,\n absoluteWidths: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = nil\n ) {\n \n if (IS_NIL(paddings)) {\n paddings = 1\n }\n if (!((paddings as any) instanceof Array)) {\n paddings = [paddings].arrayByRepeating(weights.length - 1)\n }\n paddings = (paddings as any[]).arrayByTrimmingToLengthIfLonger(weights.length - 1)\n paddings = paddings.map(padding => this._widthNumberFromSizeNumberOrFunctionOrView(padding))\n if (!(absoluteWidths instanceof Array) && IS_NOT_NIL(absoluteWidths)) {\n absoluteWidths = [absoluteWidths].arrayByRepeating(weights.length)\n }\n absoluteWidths = absoluteWidths.map(\n width => this._widthNumberFromSizeNumberOrFunctionOrView(width)\n )\n \n weights = weights.map(weight => this._widthNumberFromSizeNumberOrFunctionOrView(weight))\n const result: UIRectangle[] = []\n const sumOfWeights = (weights as number[]).reduce(\n (a, b, index) => {\n if (IS_NOT_NIL((absoluteWidths as number[])[index])) {\n b = 0\n }\n return a + b\n },\n 0\n )\n const sumOfPaddings = paddings.summedValue as number\n const sumOfAbsoluteWidths = (absoluteWidths as number[]).summedValue\n const totalRelativeWidth = this.width - sumOfPaddings - sumOfAbsoluteWidths\n let previousCellMaxX = this.x\n \n for (let i = 0; i < weights.length; i++) {\n \n let resultWidth: number\n if (IS_NOT_NIL(absoluteWidths[i])) {\n resultWidth = (absoluteWidths[i] || 0) as number\n } else {\n resultWidth = totalRelativeWidth * (weights[i] as number / sumOfWeights)\n }\n \n const rectangle = this.rectangleWithWidth(resultWidth)\n \n let padding = 0\n if (paddings.length > i && paddings[i]) {\n padding = paddings[i] as number\n }\n \n rectangle.x = previousCellMaxX\n previousCellMaxX = rectangle.max.x + padding\n result.push(rectangle)\n \n }\n \n return result\n \n }\n \n rectanglesBySplittingHeight(\n weights: SizeNumberOrFunctionOrView[],\n paddings: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 0,\n absoluteHeights: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = nil\n ) {\n \n if (IS_NIL(paddings)) {\n paddings = 1\n }\n if (!((paddings as any) instanceof Array)) {\n paddings = [paddings].arrayByRepeating(weights.length - 1)\n }\n paddings = (paddings as number[]).arrayByTrimmingToLengthIfLonger(weights.length - 1)\n paddings = paddings.map(padding => this._heightNumberFromSizeNumberOrFunctionOrView(padding))\n if (!(absoluteHeights instanceof Array) && IS_NOT_NIL(absoluteHeights)) {\n absoluteHeights = [absoluteHeights].arrayByRepeating(weights.length)\n }\n absoluteHeights = absoluteHeights.map(\n height => this._heightNumberFromSizeNumberOrFunctionOrView(height)\n )\n \n weights = weights.map(weight => this._heightNumberFromSizeNumberOrFunctionOrView(weight))\n const result: UIRectangle[] = []\n const sumOfWeights = (weights as number[]).reduce(\n (a, b, index) => {\n if (IS_NOT_NIL((absoluteHeights as number[])[index])) {\n b = 0\n }\n return a + b\n },\n 0\n )\n const sumOfPaddings = paddings.summedValue as number\n const sumOfAbsoluteHeights = (absoluteHeights as number[]).summedValue\n const totalRelativeHeight = this.height - sumOfPaddings - sumOfAbsoluteHeights\n let previousCellMaxY = this.y\n \n for (let i = 0; i < weights.length; i++) {\n let resultHeight: number\n if (IS_NOT_NIL(absoluteHeights[i])) {\n \n resultHeight = (absoluteHeights[i] || 0) as number\n \n } else {\n \n resultHeight = totalRelativeHeight * (weights[i] as number / sumOfWeights)\n \n }\n \n const rectangle = this.rectangleWithHeight(resultHeight)\n \n let padding = 0\n if (paddings.length > i && paddings[i]) {\n padding = paddings[i] as number\n }\n \n rectangle.y = previousCellMaxY\n previousCellMaxY = rectangle.max.y + padding\n //rectangle = rectangle.rectangleWithInsets(0, 0, padding, 0);\n result.push(rectangle)\n }\n \n return result\n \n }\n \n \n rectanglesByEquallySplittingWidth(numberOfFrames: number, padding: number = 0) {\n const result: UIRectangle[] = []\n const totalPadding = padding * (numberOfFrames - 1)\n const resultWidth = (this.width - totalPadding) / numberOfFrames\n for (var i = 0; i < numberOfFrames; i++) {\n const rectangle = this.rectangleWithWidth(resultWidth, i / (numberOfFrames - 1))\n result.push(rectangle)\n }\n return result\n }\n \n rectanglesByEquallySplittingHeight(numberOfFrames: number, padding: number = 0) {\n const result: UIRectangle[] = []\n const totalPadding = padding * (numberOfFrames - 1)\n const resultHeight = (this.height - totalPadding) / numberOfFrames\n for (var i = 0; i < numberOfFrames; i++) {\n const rectangle = this.rectangleWithHeight(resultHeight, i / (numberOfFrames - 1))\n result.push(rectangle)\n }\n return result\n }\n \n \n distributeViewsAlongWidth(\n views: UIView[],\n weights: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 1,\n paddings?: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[],\n absoluteWidths?: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[]\n ) {\n if (!(weights instanceof Array)) {\n weights = [weights].arrayByRepeating(views.length)\n }\n const frames = this.rectanglesBySplittingWidth(weights, paddings, absoluteWidths)\n frames.forEach((frame, index) => UIRectangle._assignFrameToView(frame, FIRST_OR_NIL(views[index])))\n return this\n }\n \n distributeViewsAlongHeight(\n views: UIView[],\n weights: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 1,\n paddings?: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[],\n absoluteHeights?: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[]\n ) {\n if (!(weights instanceof Array)) {\n weights = [weights].arrayByRepeating(views.length)\n }\n const frames = this.rectanglesBySplittingHeight(weights, paddings, absoluteHeights)\n frames.forEach((frame, index) => UIRectangle._assignFrameToView(frame, FIRST_OR_NIL(views[index])))\n return this\n }\n \n \n distributeViewsEquallyAlongWidth(views: UIView[], padding: number) {\n const frames = this.rectanglesByEquallySplittingWidth(views.length, padding)\n frames.forEach((frame, index) => UIRectangle._assignFrameToView(frame, views[index]))\n return this\n }\n \n distributeViewsEquallyAlongHeight(views: UIView[], padding: number) {\n const frames = this.rectanglesByEquallySplittingHeight(views.length, padding)\n frames.forEach((frame, index) => UIRectangle._assignFrameToView(frame, views[index]))\n return this\n }\n \n \n _heightNumberFromSizeNumberOrFunctionOrView(height: SizeNumberOrFunctionOrView) {\n if (height instanceof Function) {\n return height(this.width)\n }\n if (height instanceof UIView) {\n return height.intrinsicContentHeight(this.width)\n }\n return height\n }\n \n _widthNumberFromSizeNumberOrFunctionOrView(width: SizeNumberOrFunctionOrView) {\n if (width instanceof Function) {\n return width(this.height)\n }\n if (width instanceof UIView) {\n return width.intrinsicContentWidth(this.height)\n }\n return width\n }\n \n rectangleForNextRow(padding: number = 0, height: SizeNumberOrFunctionOrView = this.height) {\n const heightNumber = this._heightNumberFromSizeNumberOrFunctionOrView(height)\n const result = this.rectangleWithY(this.max.y + padding)\n if (heightNumber != this.height) {\n result.height = heightNumber\n }\n return result\n }\n \n rectangleForNextColumn(padding: number = 0, width: SizeNumberOrFunctionOrView = this.width) {\n const widthNumber = this._widthNumberFromSizeNumberOrFunctionOrView(width)\n const result = this.rectangleWithX(this.max.x + padding)\n if (widthNumber != this.width) {\n result.width = widthNumber\n }\n return result\n }\n \n rectangleForPreviousRow(padding: number = 0, height: SizeNumberOrFunctionOrView = this.height) {\n const heightNumber = this._heightNumberFromSizeNumberOrFunctionOrView(height)\n const result = this.rectangleWithY(this.min.y - heightNumber - padding)\n if (heightNumber != this.height) {\n result.height = heightNumber\n }\n return result\n }\n \n rectangleForPreviousColumn(padding: number = 0, width: SizeNumberOrFunctionOrView = this.width) {\n const widthNumber = this._widthNumberFromSizeNumberOrFunctionOrView(width)\n const result = this.rectangleWithX(this.min.x - widthNumber - padding)\n if (widthNumber != this.width) {\n result.width = widthNumber\n }\n return result\n \n }\n \n /**\n * Distributes views vertically as a column, assigning frames and returning them.\n * Each view is positioned below the previous one with optional padding between them.\n * @param views - Array of views to distribute\n * @param paddings - Padding between views (single value or array of values)\n * @param absoluteHeights - Optional fixed heights for views (overrides intrinsic height)\n * @returns Array of rectangles representing the frame for each view\n */\n framesByDistributingViewsAsColumn(\n views: UIView[],\n paddings: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 0,\n absoluteHeights: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = nil\n ) {\n const frames: UIRectangle[] = []\n let currentRectangle = this.lazyCopy() // COW: Use lazyCopy\n \n if (!(paddings instanceof Array)) {\n paddings = [paddings].arrayByRepeating(views.length - 1)\n }\n paddings = paddings.map(padding => this._heightNumberFromSizeNumberOrFunctionOrView(padding))\n \n if (!(absoluteHeights instanceof Array) && IS_NOT_NIL(absoluteHeights)) {\n absoluteHeights = [absoluteHeights].arrayByRepeating(views.length)\n }\n absoluteHeights = absoluteHeights.map(\n height => this._heightNumberFromSizeNumberOrFunctionOrView(height)\n )\n \n for (let i = 0; i < views.length; i++) {\n const frame = currentRectangle.rectangleWithHeight(views[i])\n \n if (IS_NOT_NIL(absoluteHeights[i])) {\n frame.height = absoluteHeights[i] as number\n }\n \n UIRectangle._assignFrameToView(frame, views[i])\n frames.push(frame)\n \n const padding = (paddings[i] || 0) as number\n currentRectangle = frame.rectangleForNextRow(padding)\n }\n \n return frames\n }\n \n /**\n * Distributes views horizontally as a row, assigning frames and returning them.\n * Each view is positioned to the right of the previous one with optional padding between them.\n * @param views - Array of views to distribute\n * @param paddings - Padding between views (single value or array of values)\n * @param absoluteWidths - Optional fixed widths for views (overrides intrinsic width)\n * @param centeredOnPosition - Horizontal alignment of the row within this rectangle: 0 = left (default), 0.5 =\n * center, 1 = right\n * @returns Array of rectangles representing the frame for each view\n */\n framesByDistributingViewsAsRow(\n views: UIView[],\n paddings: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 0,\n absoluteWidths: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = nil,\n centeredOnPosition = 0\n ) {\n const frames: UIRectangle[] = []\n let currentRectangle = this.lazyCopy() // COW: Use lazyCopy\n \n if (!(paddings instanceof Array)) {\n paddings = [paddings].arrayByRepeating(views.length - 1)\n }\n paddings = paddings.map(padding => this._widthNumberFromSizeNumberOrFunctionOrView(padding))\n \n if (!(absoluteWidths instanceof Array) && IS_NOT_NIL(absoluteWidths)) {\n absoluteWidths = [absoluteWidths].arrayByRepeating(views.length)\n }\n absoluteWidths = absoluteWidths.map(\n width => this._widthNumberFromSizeNumberOrFunctionOrView(width)\n )\n \n for (let i = 0; i < views.length; i++) {\n const frame = currentRectangle.rectangleWithWidth(views[i])\n \n if (IS_NOT_NIL(absoluteWidths[i])) {\n frame.width = absoluteWidths[i] as number\n }\n \n frames.push(frame)\n \n const padding = (paddings[i] || 0) as number\n currentRectangle = frame.rectangleForNextColumn(padding)\n }\n \n if (centeredOnPosition !== 0 && frames.length > 0) {\n const rowWidth = frames.lastElement.max.x - frames.firstElement.x\n const offset = (this.width - rowWidth) * centeredOnPosition - (frames.firstElement.x - this.x)\n frames.forEach(frame => {\n frame.x += offset\n })\n }\n \n frames.forEach((frame, index) => UIRectangle._assignFrameToView(frame, views[index]))\n \n return frames\n }\n \n /**\n * Flows views left-to-right at their preferred widths, wrapping to a new row below this\n * rectangle whenever the next view no longer fits on the current row - the same idea as HTML\n * inline/flow layout or a UICollectionView flow layout. Rows are packed greedily: each row\n * holds as many views as actually fit before wrapping (up to `options.maxViewsPerRow`, if\n * given), so this degenerates to a single row when everything fits, and to one view per row\n * when nothing does.\n * @param views - Array of views to distribute, in flow order\n * @param preferredWidths - Preferred width for each view, matched by index\n * @param itemHeight - Height applied to every row\n * @param options - Wrapping and alignment settings, all optional\n * @param options.itemGap - Horizontal spacing between views on the same row\n * @param options.lineGap - Vertical spacing between wrapped rows\n * @param options.maxViewsPerRow - Caps views per row even if more would fit by width\n * @param options.centeredOnPosition - Position of a row holding more than one view\n * @param options.positionOrStretchWhenIsolatedOnOwnWrappedRow - Position or stretch for a view wrapping isolated alone\n * @returns Array of rectangles representing the frame for each view, matching `views`' order\n */\n framesByFlowingViewsAlongWidth(\n views: UIView[],\n preferredWidths: number[],\n itemHeight: SizeNumberOrFunctionOrView,\n options: UIRectangleFlowLayoutOptions = {}\n ): UIRectangle[] {\n const {\n itemGap = 0,\n lineGap = 0,\n maxViewsPerRow = Infinity,\n centeredOnPosition = 0,\n positionOrStretchWhenIsolatedOnOwnWrappedRow = 0\n } = options\n \n const heightNumber = this._heightNumberFromSizeNumberOrFunctionOrView(itemHeight)\n \n // Pack view indices into rows first (no frames yet), so each row's placement can see\n // its whole membership - needed for group centering and for detecting isolation.\n const rowsOfIndices: number[][] = []\n let currentRow: number[] = []\n let currentRowWidth = 0\n \n views.forEach((_view, index) => {\n const width = preferredWidths[index]\n const widthIfAdded = currentRow.length === 0 ? width : currentRowWidth + itemGap + width\n const overflowsWidth = currentRow.length > 0 && widthIfAdded > this.width\n const overflowsCount = currentRow.length >= maxViewsPerRow\n \n if (currentRow.length > 0 && (overflowsWidth || overflowsCount)) {\n rowsOfIndices.push(currentRow)\n currentRow = []\n currentRowWidth = 0\n }\n \n currentRow.push(index)\n currentRowWidth = currentRow.length === 1 ? width : currentRowWidth + itemGap + width\n })\n if (currentRow.length > 0) {\n rowsOfIndices.push(currentRow)\n }\n \n const frames: UIRectangle[] = new Array(views.length)\n let rowRectangle = this.rectangleWithHeight(heightNumber)\n \n rowsOfIndices.forEach((rowIndices, rowNumber) => {\n if (rowNumber > 0) {\n rowRectangle = rowRectangle.rectangleForNextRow(lineGap)\n }\n \n if (rowIndices.length === 1) {\n const index = rowIndices[0]\n const isolatedValue = Array.isArray(positionOrStretchWhenIsolatedOnOwnWrappedRow)\n ? positionOrStretchWhenIsolatedOnOwnWrappedRow[index]\n : positionOrStretchWhenIsolatedOnOwnWrappedRow\n \n if (isolatedValue === \"stretch\") {\n const frame = rowRectangle.lazyCopy()\n UIRectangle._assignFrameToView(frame, views[index])\n frames[index] = frame\n return\n }\n \n const rowFrames = rowRectangle.framesByDistributingViewsAsRow(\n [views[index]], itemGap, [preferredWidths[index]], isolatedValue\n )\n frames[index] = rowFrames[0]\n return\n }\n \n const rowViews = rowIndices.map(index => views[index])\n const rowWidths = rowIndices.map(index => preferredWidths[index])\n const rowFrames = rowRectangle.framesByDistributingViewsAsRow(rowViews, itemGap, rowWidths, centeredOnPosition)\n rowIndices.forEach((index, position) => {\n frames[index] = rowFrames[position]\n })\n })\n \n return frames\n }\n \n /**\n * Distributes views as a grid (2D array), assigning frames and returning them.\n * The first index represents rows (vertical), the second index represents columns (horizontal).\n * Example: views[0] is the first row, views[0][0] is the first column in the first row.\n * Each row is laid out horizontally, and rows are stacked vertically.\n * @param views - 2D array where views[row][column] represents the grid structure\n * @param paddings - Vertical padding between rows (single value or array of values)\n * @param absoluteHeights - Optional fixed heights for each row (overrides intrinsic height)\n * @returns 2D array of rectangles where frames[row][column] matches views[row][column]\n */\n framesByDistributingViewsAsGrid(\n views: UIView[][],\n paddings: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = 0,\n absoluteHeights: SizeNumberOrFunctionOrView | SizeNumberOrFunctionOrView[] = nil\n ) {\n const frames: UIRectangle[][] = []\n let currentRowRectangle = this.lazyCopy() // COW: Use lazyCopy\n \n if (!(paddings instanceof Array)) {\n paddings = [paddings].arrayByRepeating(views.length - 1)\n }\n paddings = paddings.map(padding => this._heightNumberFromSizeNumberOrFunctionOrView(padding))\n \n if (!(absoluteHeights instanceof Array) && IS_NOT_NIL(absoluteHeights)) {\n absoluteHeights = [absoluteHeights].arrayByRepeating(views.length)\n }\n absoluteHeights = absoluteHeights.map(\n height => this._heightNumberFromSizeNumberOrFunctionOrView(height)\n )\n \n for (let i = 0; i < views.length; i++) {\n const rowViews = views[i]\n const rowFrames = currentRowRectangle.framesByDistributingViewsAsRow(rowViews)\n \n if (IS_NOT_NIL(absoluteHeights[i])) {\n const heightNumber = absoluteHeights[i] as number\n rowFrames.forEach((frame, j) => {\n frame.height = heightNumber\n UIRectangle._assignFrameToView(frame, rowViews[j])\n })\n }\n \n frames.push(rowFrames)\n \n const padding = (paddings[i] || 0) as number\n const maxHeight = Math.max(...rowFrames.map(f => f.height))\n currentRowRectangle = currentRowRectangle.rectangleForNextRow(padding, maxHeight)\n }\n \n return frames\n }\n \n rectangleWithIntrinsicContentSizeForView(view: UIView, centeredOnXPosition = 0, centeredOnYPosition = 0) {\n const intrinsicContentSize = view.intrinsicContentSize()\n return this.rectangleWithHeight(intrinsicContentSize.height, centeredOnYPosition)\n .rectangleWithWidth(intrinsicContentSize.width, centeredOnXPosition)\n }\n \n settingMinHeight(minHeight?: number) {\n this.minHeight = minHeight\n return this\n }\n \n settingMinWidth(minWidth?: number) {\n this.minWidth = minWidth\n return this\n }\n \n settingMaxHeight(maxHeight?: number) {\n this.maxHeight = maxHeight\n return this\n }\n \n settingMaxWidth(maxWidth?: number) {\n this.maxWidth = maxWidth\n return this\n }\n \n rectangleByEnforcingMinAndMaxSizes(centeredOnXPosition = 0, centeredOnYPosition = 0) {\n return this.rectangleWithHeight(\n [\n [this.height, this.maxHeight].filter(value => IS_NOT_LIKE_NULL(value)).min(),\n this.minHeight\n ].filter(value => IS_NOT_LIKE_NULL(value)).max(),\n centeredOnYPosition\n ).rectangleWithWidth(\n [\n [this.width, this.maxWidth].filter(value => IS_NOT_LIKE_NULL(value)).min(),\n this.minWidth\n ].filter(value => IS_NOT_LIKE_NULL(value)).max(),\n centeredOnXPosition\n )\n }\n \n \n assignedAsFrameOfView(view: UIView, isWeakFrame = view.hasWeakFrame) {\n UIRectangle._assignFrameToView(this, view)\n view.hasWeakFrame = isWeakFrame\n return this\n }\n \n \n /**\n * Begins collecting views assigned through the rectangle frame-assignment API into a DOM wrapper.\n * The matching endGroupingWrapperFrame() returns the current rectangle unchanged, preserving the chain.\n */\n beginGroupingWrapperFrame(configuration: UIGroupingWrapperFrameConfiguration = {}) {\n const layoutPass = UIRectangle._groupingWrapperFrameLayoutPasses.lastElement\n if (!layoutPass) {\n throw new Error(\"beginGroupingWrapperFrame() must be called during a UIView layout pass\")\n }\n const groupingContext: UIGroupingWrapperFrameContext = {\n configuration,\n views: [],\n framesByView: new Map(),\n childContexts: []\n }\n const parentContext = layoutPass.groupingContextStack.lastElement\n if (parentContext) {\n parentContext.childContexts.push(groupingContext)\n } else {\n layoutPass.requests.push(groupingContext)\n }\n layoutPass.groupingContextStack.push(groupingContext)\n return this\n }\n \n \n /** Ends the current grouping wrapper frame and returns this rectangle unchanged. */\n endGroupingWrapperFrame() {\n const layoutPass = UIRectangle._groupingWrapperFrameLayoutPasses.lastElement\n if (!layoutPass?.groupingContextStack.length) {\n throw new Error(\"endGroupingWrapperFrame() requires a matching beginGroupingWrapperFrame()\")\n }\n layoutPass.groupingContextStack.pop()\n return this\n }\n \n \n static _beginGroupingWrapperFrameLayoutPass(owner: UIView) {\n UIRectangle._groupingWrapperFrameLayoutPasses.push({\n owner,\n groupingContextStack: [],\n requests: []\n })\n }\n \n \n static _endGroupingWrapperFrameLayoutPass(owner: UIView) {\n const layoutPass = UIRectangle._groupingWrapperFrameLayoutPasses.pop()\n if (!layoutPass || layoutPass.owner !== owner) {\n throw new Error(\"Unbalanced grouping wrapper frame layout pass\")\n }\n if (layoutPass.groupingContextStack.length) {\n console.error(\"beginGroupingWrapperFrame() was not balanced with endGroupingWrapperFrame()\", owner)\n layoutPass.groupingContextStack.length = 0\n }\n if (!UIView.isVirtualLayouting) {\n UIRectangle._reconcileGroupingWrapperFrames(layoutPass)\n }\n }\n \n \n static _assignFrameToView(frame: UIRectangle, view: UIView) {\n view.frame = frame\n const groupingContexts = UIRectangle._groupingWrapperFrameLayoutPasses.lastElement?.groupingContextStack\n if (!groupingContexts?.length) {\n return\n }\n groupingContexts.forEach(groupingContext => groupingContext.framesByView.set(view, frame.copy()))\n const innermostContext = groupingContexts.lastElement\n if (!innermostContext.views.contains(view)) {\n innermostContext.views.push(view)\n }\n }\n \n \n static _reconcileGroupingWrapperFrames(layoutPass: UIGroupingWrapperFrameLayoutPass) {\n const owner = layoutPass.owner\n const previousRecords = UIRectangle._groupingWrapperFrameRecordsByOwner.get(owner) ?? []\n const availablePreviousRecords = previousRecords.copy()\n const nextRecords: UIGroupingWrapperFrameRecord[] = []\n const groupedViews = new Set<UIView>()\n const configuredIdentifiers = new Set<string>()\n \n const validateContext = (request: UIGroupingWrapperFrameContext) => {\n if (request.configuration.identifier) {\n if (configuredIdentifiers.has(request.configuration.identifier)) {\n throw new Error(\"Grouping wrapper frame identifiers must be unique within one layout owner\")\n }\n configuredIdentifiers.add(request.configuration.identifier)\n }\n request.views.forEach(view => {\n if (view.superview !== owner) {\n throw new Error(\"Views in a grouping wrapper frame must be direct subviews of the layout owner\")\n }\n if (groupedViews.has(view)) {\n throw new Error(\"A view cannot belong to multiple grouping wrapper frames in one layout pass\")\n }\n groupedViews.add(view)\n })\n request.childContexts.forEach(validateContext)\n }\n layoutPass.requests.forEach(validateContext)\n \n const recordForRequest = (request: UIGroupingWrapperFrameContext) => {\n let record: UIGroupingWrapperFrameRecord | undefined\n if (request.configuration.identifier) {\n record = availablePreviousRecords.find(\n candidate => candidate.identifier === request.configuration.identifier\n )\n } else {\n record = availablePreviousRecords.find(candidate => !candidate.identifier)\n }\n if (record) {\n availablePreviousRecords.removeElement(record)\n } else {\n record = UIRectangle._newGroupingWrapperFrameRecord()\n }\n return record\n }\n \n const reconcileContext = (\n request: UIGroupingWrapperFrameContext,\n containerHTMLElement: HTMLElement\n ): UIGroupingWrapperFrameRecord | undefined => {\n if (!request.framesByView.size) {\n return\n }\n const record = recordForRequest(request)\n UIRectangle._configureGroupingWrapperFrameRecord(\n record,\n request,\n owner,\n containerHTMLElement\n )\n nextRecords.push(record)\n record.childRecords = request.childContexts.map(childContext =>\n reconcileContext(childContext, record.coordinateSpaceHTMLElement)\n ).filter((childRecord): childRecord is UIGroupingWrapperFrameRecord => !!childRecord)\n \n const elementByView = new Map<UIView, HTMLElement>()\n record.views.forEach(view => elementByView.set(view, view.viewHTMLElement))\n record.childRecords.forEach(childRecord => {\n UIRectangle._viewsInGroupingWrapperFrameRecord(childRecord).forEach(view =>\n elementByView.set(view, childRecord.wrapperHTMLElement)\n )\n })\n UIRectangle._reorderGroupingWrapperFrameElements(\n record.coordinateSpaceHTMLElement,\n owner.subviews.map(view => elementByView.get(view)).filter(\n (element): element is HTMLElement => !!element\n )\n )\n return record\n }\n \n const rootRecords = layoutPass.requests.map(request =>\n reconcileContext(request, owner.viewHTMLElement)\n ).filter((record): record is UIGroupingWrapperFrameRecord => !!record)\n \n availablePreviousRecords.forEach(record => {\n record.views.forEach(view => {\n if (view.viewHTMLElement.parentElement === record.coordinateSpaceHTMLElement) {\n owner.viewHTMLElement.appendChild(view.viewHTMLElement)\n }\n })\n record.wrapperHTMLElement.remove()\n })\n \n const rootRecordByView = new Map<UIView, UIGroupingWrapperFrameRecord>()\n rootRecords.forEach(record => {\n UIRectangle._viewsInGroupingWrapperFrameRecord(record).forEach(view =>\n rootRecordByView.set(view, record)\n )\n })\n const desiredTopLevelElements: HTMLElement[] = []\n owner.subviews.forEach(view => {\n const record = rootRecordByView.get(view)\n const element = record?.wrapperHTMLElement ?? view.viewHTMLElement\n if (!desiredTopLevelElements.contains(element)) {\n desiredTopLevelElements.push(element)\n }\n })\n UIRectangle._reorderGroupingWrapperFrameElements(owner.viewHTMLElement, desiredTopLevelElements)\n \n UIRectangle._groupingWrapperFrameRecordsByOwner.set(owner, nextRecords)\n }\n \n \n static _viewsInGroupingWrapperFrameRecord(record: UIGroupingWrapperFrameRecord): UIView[] {\n return record.views.concat(record.childRecords.flatMap(childRecord =>\n UIRectangle._viewsInGroupingWrapperFrameRecord(childRecord)\n ))\n }\n \n \n static _reorderGroupingWrapperFrameElements(containerHTMLElement: HTMLElement, desiredElements: HTMLElement[]) {\n const uniqueDesiredElements = desiredElements.filter(\n (element, index) => desiredElements.indexOf(element) === index\n )\n const currentElements = Array.from(containerHTMLElement.children).filter(element =>\n uniqueDesiredElements.contains(element as HTMLElement)\n ) as HTMLElement[]\n if (!currentElements.isEqualToArray(uniqueDesiredElements) ||\n uniqueDesiredElements.some(element => element.parentElement !== containerHTMLElement)) {\n uniqueDesiredElements.forEach(element => containerHTMLElement.appendChild(element))\n }\n }\n \n \n static _newGroupingWrapperFrameRecord(): UIGroupingWrapperFrameRecord {\n const wrapperHTMLElement = document.createElement(\"div\")\n const coordinateSpaceHTMLElement = document.createElement(\"div\")\n wrapperHTMLElement.classList.add(\"UICore_UIGroupingWrapperFrame\")\n wrapperHTMLElement.setAttribute(\"data-uicore-grouping-wrapper-frame\", \"\")\n coordinateSpaceHTMLElement.classList.add(\"UICore_UIGroupingWrapperFrame_CoordinateSpace\")\n coordinateSpaceHTMLElement.setAttribute(\"data-uicore-grouping-wrapper-coordinate-space\", \"\")\n wrapperHTMLElement.appendChild(coordinateSpaceHTMLElement)\n return {\n wrapperHTMLElement,\n coordinateSpaceHTMLElement,\n views: [],\n childRecords: [],\n configuredClassNames: [],\n configuredAttributeNames: [],\n configuredStyleNames: []\n }\n }\n \n \n static _configureGroupingWrapperFrameRecord(\n record: UIGroupingWrapperFrameRecord,\n request: UIGroupingWrapperFrameContext,\n owner: UIView,\n containerHTMLElement: HTMLElement\n ) {\n const wrapperHTMLElement = record.wrapperHTMLElement\n record.configuredClassNames.forEach(className => wrapperHTMLElement.classList.remove(className))\n record.configuredAttributeNames.forEach(attributeName => wrapperHTMLElement.removeAttribute(attributeName))\n record.configuredStyleNames.forEach(styleName => (wrapperHTMLElement.style as any)[styleName] = \"\")\n \n wrapperHTMLElement.classList.add(\"UICore_UIGroupingWrapperFrame\")\n wrapperHTMLElement.setAttribute(\"data-uicore-grouping-wrapper-frame\", \"\")\n \n record.identifier = request.configuration.identifier\n record.views = request.views.copy()\n record.configuredClassNames = request.configuration.classNames?.copy() ?? []\n record.configuredAttributeNames = Object.keys(request.configuration.attributes ?? {})\n record.configuredStyleNames = Object.keys(request.configuration.style ?? {})\n \n record.configuredClassNames.forEach(className => wrapperHTMLElement.classList.add(className))\n Object.keys(request.configuration.attributes ?? {}).forEach(attributeName => {\n wrapperHTMLElement.setAttribute(\n attributeName,\n (request.configuration.attributes as Record<string, string>)[attributeName]\n )\n })\n Object.keys(request.configuration.style ?? {}).forEach(styleName => {\n (wrapperHTMLElement.style as any)[styleName] = (request.configuration.style as any)[styleName]\n })\n if (record.identifier) {\n wrapperHTMLElement.setAttribute(\"data-uicore-grouping-wrapper-frame-identifier\", record.identifier)\n } else {\n wrapperHTMLElement.removeAttribute(\"data-uicore-grouping-wrapper-frame-identifier\")\n }\n \n const assignedFrames = Array.from(request.framesByView.values())\n const framePoints: UIPoint[] = []\n assignedFrames.forEach(frame => {\n framePoints.push(frame.min)\n framePoints.push(frame.max)\n })\n const defaultFrame = UIRectangle.boundingBoxForPoints(framePoints)\n const wrapperFrame = request.configuration.frame?.(defaultFrame.copy(), assignedFrames.copy()) ?? defaultFrame\n \n wrapperHTMLElement.style.position = \"absolute\"\n wrapperHTMLElement.style.left = wrapperFrame.x + \"px\"\n wrapperHTMLElement.style.top = wrapperFrame.y + \"px\"\n wrapperHTMLElement.style.width = wrapperFrame.width + \"px\"\n wrapperHTMLElement.style.height = wrapperFrame.height + \"px\"\n wrapperHTMLElement.style.boxSizing = \"border-box\"\n \n if (wrapperHTMLElement.parentElement !== containerHTMLElement) {\n containerHTMLElement.appendChild(wrapperHTMLElement)\n }\n \n const coordinateSpaceHTMLElement = record.coordinateSpaceHTMLElement\n coordinateSpaceHTMLElement.classList.add(\"UICore_UIGroupingWrapperFrame_CoordinateSpace\")\n coordinateSpaceHTMLElement.setAttribute(\"data-uicore-grouping-wrapper-coordinate-space\", \"\")\n coordinateSpaceHTMLElement.style.position = \"absolute\"\n coordinateSpaceHTMLElement.style.left =\n -wrapperFrame.x - (wrapperHTMLElement.clientLeft || 0) + \"px\"\n coordinateSpaceHTMLElement.style.top =\n -wrapperFrame.y - (wrapperHTMLElement.clientTop || 0) + \"px\"\n coordinateSpaceHTMLElement.style.width = owner.bounds.width + \"px\"\n coordinateSpaceHTMLElement.style.height = owner.bounds.height + \"px\"\n \n }\n \n \n static _topLevelHTMLElementForView(view: UIView) {\n let element = view.viewHTMLElement\n while (element.parentElement && element.parentElement !== view.superview?.viewHTMLElement) {\n element = element.parentElement as HTMLElement & typeof element\n }\n return element\n }\n \n \n static _detachViewFromGroupingWrapperFrame(view: UIView) {\n const superviewHTMLElement = view.superview?.viewHTMLElement\n if (!superviewHTMLElement || view.viewHTMLElement.parentElement === superviewHTMLElement) {\n return\n }\n const wrapperHTMLElement = view.viewHTMLElement.closest(\"[data-uicore-grouping-wrapper-frame]\")\n superviewHTMLElement.appendChild(view.viewHTMLElement)\n UIRectangle._removeEmptyGroupingWrapperFrameAncestors(wrapperHTMLElement)\n }\n \n \n static _removeEmptyGroupingWrapperFrameAncestors(wrapperHTMLElement: Element | null) {\n while (wrapperHTMLElement) {\n const parentWrapperHTMLElement = wrapperHTMLElement.parentElement?.closest(\n \"[data-uicore-grouping-wrapper-frame]\"\n ) ?? null\n const coordinateSpaceHTMLElement = wrapperHTMLElement.querySelector(\n \":scope > [data-uicore-grouping-wrapper-coordinate-space]\"\n )\n if (coordinateSpaceHTMLElement?.children.length) {\n return\n }\n wrapperHTMLElement.remove()\n wrapperHTMLElement = parentWrapperHTMLElement\n }\n }\n \n \n override toString() {\n \n const result = \"[\" + this.class.name + \"] { x: \" + this.x + \", y: \" + this.y + \", \" +\n \"height: \" + this.height.toFixed(2) + \", width: \" + this.height.toFixed(2) + \" }\"\n \n return result\n \n }\n \n get [Symbol.toStringTag]() {\n return this.toString()\n }\n \n \n IF(condition: boolean): UIRectangleConditionalChain<UIRectangle> {\n const conditionalBlock = new UIRectangleConditionalBlock(this, condition)\n // @ts-ignore\n return conditionalBlock.getProxy()\n }\n \n // These will be intercepted by the proxy, but we define them for TypeScript\n ELSE_IF(condition: boolean): UIRectangle {\n return this\n }\n \n ELSE(): UIRectangle {\n return this\n }\n \n ENDIF(): this\n ENDIF<T, R>(performFunction: (result: T) => R): R\n ENDIF<T, R>(performFunction?: (result: T) => R): R | this {\n if (performFunction) {\n return performFunction(this as any)\n }\n return this\n }\n \n \n // Bounding box\n static boundingBoxForPoints(points: UIPoint[]) {\n if (points.length === 0) {\n return new UIRectangle()\n }\n \n const first = points[0]\n const result = new UIRectangle(first.x, first.y, 0, 0)\n \n for (let i = 1; i < points.length; i++) {\n result.updateByAddingPoint(points[i])\n }\n return result\n }\n \n static boundingBoxForRectanglesAndPoints(rectanglesAndPoints: (UIPoint | UIRectangle)[]) {\n if (rectanglesAndPoints.length === 0) {\n return new UIRectangle()\n }\n \n const first = rectanglesAndPoints[0]\n const result = first instanceof UIRectangle\n ? new UIRectangle(first.x, first.y, first.height, first.width)\n : new UIRectangle(first.x, first.y, 0, 0)\n \n for (let i = 1; i < rectanglesAndPoints.length; i++) {\n const rectangleOrPoint = rectanglesAndPoints[i]\n if (rectangleOrPoint instanceof UIRectangle) {\n result.updateByAddingPoint(rectangleOrPoint.min)\n result.updateByAddingPoint(rectangleOrPoint.max)\n } else {\n result.updateByAddingPoint(rectangleOrPoint)\n }\n }\n return result\n }\n \n \n beginUpdates() {\n this._isBeingUpdated = YES\n }\n \n finishUpdates() {\n this._isBeingUpdated = NO\n this.didChange()\n }\n \n \n didChange() {\n \n // Callback to be set by delegate\n \n }\n \n _rectanglePointDidChange() {\n if (!this._isBeingUpdated) {\n this.didChange()\n }\n }\n \n \n}\n\n\ndeclare global {\n interface Array<T> {\n /** Returns the smallest rectangle containing every point and rectangle in the array. */\n boundingBox(this: Array<UIPoint | UIRectangle>): UIRectangle\n }\n}\n\n\nif (!(\"boundingBox\" in Array.prototype)) {\n Object.defineProperty(Array.prototype, \"boundingBox\", {\n configurable: YES,\n enumerable: NO,\n writable: YES,\n value: function (this: Array<UIPoint | UIRectangle>) {\n return UIRectangle.boundingBoxForRectanglesAndPoints(this)\n }\n })\n}\n\n\n// 1. Methods available when holding a UIRectangle\ntype RectangleChainMethods<TResult> = {\n [K in keyof UIRectangle as (\n K extends 'IF' | 'ELSE' | 'ELSE_IF' | 'ENDIF' ? never : K\n )]:\n UIRectangle[K] extends (...args: infer Args) => infer R\n ? R extends UIRectangle | UIRectangle[]\n // CHANGE: We do NOT add 'R' to 'TResult' here. We only update the current state (R).\n ? (...args: Args) => UIRectangleConditionalChain<R, TResult>\n : never\n : never\n};\n\n// 2. Methods available when holding a UIRectangle[]\ntype ArrayChainMethods<TResult> = {\n [K in keyof UIRectangle[]]:\n UIRectangle[][K] extends UIRectangle\n ? UIRectangleConditionalChain<UIRectangle, TResult> // No accumulation for properties\n : UIRectangle[][K] extends (...args: infer Args) => infer R\n ? R extends UIRectangle | UIRectangle[]\n // CHANGE: We do NOT add 'R' to 'TResult' here either.\n ? (...args: Args) => UIRectangleConditionalChain<R, TResult>\n : never\n : never\n};\n\n// 3. Methods available in both states (Control Flow + Transform)\ntype SharedChainMethods<TCurrent, TResult> = {\n // IF opens a nested conditional block. After the matching ENDIF(), the chain resumes\n // as a UIRectangle \u2014 both at runtime (the proxy forwards to the current rectangle) and\n // at the type level. Nesting is supported to arbitrary depth.\n IF(condition: boolean): UIRectangleConditionalChain<UIRectangle, TResult>;\n \n // TRANSFORM applies an inline function and continues the chain.\n TRANSFORM<R extends UIRectangle>(fn: (current: TCurrent) => R): UIRectangleConditionalChain<R, TResult>;\n \n // ELSE_IF / ELSE reset the branch state.\n ELSE_IF(condition: boolean): UIRectangleConditionalChain<UIRectangle, TResult | TCurrent>;\n ELSE(): UIRectangleConditionalChain<UIRectangle, TResult | TCurrent>;\n \n // ENDIF closes this IF block.\n // No-arg: always typed as UIRectangle so rectangle methods are available immediately\n // after. At runtime the proxy wraps the current rectangle and forwards all calls.\n // With transform fn: returns R directly, escaping the chain entirely.\n ENDIF(): UIRectangle;\n ENDIF<R>(performFunction: (result: TResult | TCurrent) => R): R;\n};\n\n// 4. The Main Type (No changes needed here, just re-stating for context)\ntype UIRectangleConditionalChain<TCurrent, TResult = TCurrent> =\n (TCurrent extends UIRectangle ? RectangleChainMethods<TResult> : {}) &\n (TCurrent extends UIRectangle[] ? ArrayChainMethods<TResult> : {}) &\n SharedChainMethods<TCurrent, TResult>;\n\n\ninterface UIRectangleConditionalFrame {\n // The result to resume from when this frame's ENDIF is reached (if no branch matched)\n resultBeforeIF: any\n // The result accumulated inside the active branch of this frame\n currentResult: any\n // The result at the point of IF \u2014 used to reset currentResult when entering each new branch\n originalResult: any\n // Whether any branch of this frame has already been taken (latches to true, never resets)\n anyConditionMet: boolean\n // Whether the current branch is the one that was taken (flips per ELSE_IF / ELSE)\n currentBranchActive: boolean\n}\n\nclass UIRectangleConditionalBlock {\n \n // Stack of nested IF frames. The top of the stack is the innermost active IF.\n private _stack: UIRectangleConditionalFrame[]\n \n constructor(initialResult: UIRectangle, condition: boolean) {\n // Seed the stack with the first IF frame.\n // resultBeforeIF is null here because this is the outermost block;\n // ENDIF on the last frame simply returns currentResult.\n this._stack = [{\n resultBeforeIF: null,\n currentResult: initialResult,\n originalResult: initialResult,\n anyConditionMet: condition,\n currentBranchActive: condition,\n }]\n }\n \n // Convenience getter that operates on the innermost frame.\n private get _top(): UIRectangleConditionalFrame {\n return this._stack[this._stack.length - 1]\n }\n \n // A method body should only execute when every frame in the stack has its\n // current branch active (handles nested IFs correctly).\n private get _shouldExecute(): boolean {\n return this._stack.every(frame => frame.currentBranchActive)\n }\n \n private createProxy(): UIRectangleConditionalChain<any, any> {\n const self = this\n \n return new Proxy({}, {\n get(_, prop) {\n \n // \u2500\u2500 Control Flow \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \n if (prop === 'IF') {\n return (condition: boolean) => {\n // Push a new frame. The new frame's result starts as a copy of\n // the current innermost result so that chaining inside the nested\n // IF begins from the right value.\n self._stack.push({\n resultBeforeIF: self._top.currentResult,\n currentResult: self._top.currentResult,\n originalResult: self._top.currentResult,\n anyConditionMet: condition,\n currentBranchActive: condition,\n })\n return self.createProxy()\n }\n }\n \n if (prop === 'TRANSFORM') {\n return <R extends UIRectangle>(fn: (current: any) => R) => {\n if (self._shouldExecute) {\n self._top.currentResult = fn(self._top.currentResult)\n }\n return self.createProxy()\n }\n }\n \n if (prop === 'ELSE_IF') {\n return (condition: boolean) => {\n const top = self._top\n // Only consider this branch if no prior branch has been taken.\n // Always deactivate the current branch first, then activate only\n // if this condition is true and nothing has matched yet.\n top.currentBranchActive = !top.anyConditionMet && condition\n if (top.currentBranchActive) {\n top.anyConditionMet = true\n top.currentResult = top.originalResult\n }\n return self.createProxy()\n }\n }\n \n if (prop === 'ELSE') {\n return () => {\n const top = self._top\n top.currentBranchActive = !top.anyConditionMet\n if (top.currentBranchActive) {\n top.anyConditionMet = true\n top.currentResult = top.originalResult\n }\n return self.createProxy()\n }\n }\n \n if (prop === 'ENDIF') {\n function endif(): any\n function endif<R>(performFunction: (result: any) => R): R\n function endif<R>(performFunction?: (result: any) => R): R | any {\n \n if (self._stack.length === 1) {\n // Outermost ENDIF. Return the bare rectangle (or transform it).\n const top = self._top\n const result = top.currentResult\n if (performFunction && top.anyConditionMet) {\n return performFunction(result)\n } else {\n return result\n }\n }\n \n // Pop the innermost (nested) frame.\n const completedFrame = self._stack.pop()!\n \n // If any branch was taken use its accumulated result; otherwise\n // fall back to the value that existed before entering this IF.\n const resolvedResult = completedFrame.anyConditionMet\n ? completedFrame.currentResult\n : completedFrame.resultBeforeIF\n \n // Optionally transform, then write back into the parent frame.\n const finalResult = performFunction ? performFunction(resolvedResult) : resolvedResult\n self._top.currentResult = finalResult\n \n // Return the proxy so the outer chain can continue.\n return self.createProxy()\n }\n \n return endif\n }\n \n // \u2500\u2500 Forward to currentResult (UIRectangle or UIRectangle[]) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \n const value = self._top.currentResult[prop]\n \n // Case A: method call\n if (typeof value === 'function') {\n return (...args: any[]) => {\n if (self._shouldExecute) {\n self._top.currentResult = value.apply(self._top.currentResult, args)\n }\n return self.createProxy()\n }\n }\n \n // Case B: property access (e.g. array .lastElement)\n if (self._shouldExecute) {\n self._top.currentResult = value\n }\n \n return self.createProxy()\n }\n }) as any\n }\n \n getProxy(): UIRectangleConditionalChain<any, any> {\n return this.createProxy()\n }\n \n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyG;AACzG,qBAAsB;AACtB,oBAAqB;AA8Dd,MAAM,eAAN,cAA0B,yBAAS;AAAA,EAuBtC,YAAY,IAAY,GAAG,IAAY,GAAG,SAAiB,GAAG,QAAgB,GAAG;AAE7E,UAAM;AAEN,SAAK,cAAc;AACnB,SAAK,kBAAkB;AAGvB,SAAK,QAAQ;AAAA,MACT,KAAK,IAAI,uBAAQ,GAAG,CAAC;AAAA,MACrB,KAAK,IAAI,uBAAQ,IAAI,OAAO,IAAI,MAAM;AAAA,MACtC,UAAU;AAAA,IACd;AAEA,SAAK,qBAAqB;AAE1B,YAAI,wBAAO,MAAM,GAAG;AAChB,WAAK,MAAM,IAAI,IAAI;AAAA,IACvB;AAEA,YAAI,wBAAO,KAAK,GAAG;AACf,WAAK,MAAM,IAAI,IAAI;AAAA,IACvB;AAAA,EAEJ;AAAA,EAGQ,uBAAuB;AAC3B,SAAK,MAAM,IAAI,YAAY,CAAC,UAAU;AAnH9C;AAoHY,iBAAK,4BAAL,8BAA+B;AAC/B,WAAK,yBAAyB;AAAA,IAClC;AACA,SAAK,MAAM,IAAI,YAAY,CAAC,UAAU;AAvH9C;AAwHY,iBAAK,4BAAL,8BAA+B;AAC/B,WAAK,yBAAyB;AAAA,IAClC;AAAA,EACJ;AAAA,EAGA,cAAc;AACV,QAAI,KAAK,eAAe,KAAK,MAAM,WAAW,GAAG;AAC7C,WAAK,MAAM;AAEX,YAAM,UAAU,KAAK;AACrB,WAAK,QAAQ;AAAA,QACT,KAAK,QAAQ,IAAI,KAAK;AAAA,QACtB,KAAK,QAAQ,IAAI,KAAK;AAAA,QACtB,WAAW,QAAQ;AAAA,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