uicore-ts 1.1.88 → 1.1.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiledScripts/UIRectangle.d.ts +4 -0
- package/compiledScripts/UIRectangle.js +19 -4
- package/compiledScripts/UIRectangle.js.map +2 -2
- package/compiledScripts/UITableView.d.ts +1 -0
- package/compiledScripts/UITableView.js +1 -0
- package/compiledScripts/UITableView.js.map +2 -2
- package/compiledScripts/UITextView.js +12 -0
- package/compiledScripts/UITextView.js.map +2 -2
- package/compiledScripts/UIView.d.ts +19 -1
- package/compiledScripts/UIView.js +176 -81
- package/compiledScripts/UIView.js.map +2 -2
- package/package.json +1 -1
- package/scripts/UIRectangle.ts +35 -5
- package/scripts/UITableView.ts +2 -0
- package/scripts/UITextView.ts +72 -47
- package/scripts/UIView.ts +230 -83
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../scripts/UITextView.ts"],
|
|
4
|
-
"sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UILocalizedTextObject } from \"./UIInterfaces\"\nimport { FIRST, IS, IS_LIKE_NULL, nil, NO, UIObject, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport type { ValueOf } from \"./UIObject\"\nimport { TextMeasurementStyle, UITextMeasurement } from \"./UITextMeasurement\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UITextView extends UIView {\n \n \n _textColor: UIColor = UITextView.defaultTextColor\n _textAlignment?: ValueOf<typeof UITextView.textAlignment>\n \n _isSingleLine = YES\n \n textPrefix = \"\"\n textSuffix = \"\"\n \n _notificationAmount = 0\n \n _minFontSize?: number\n _maxFontSize?: number\n \n _automaticFontSizeSelection = NO\n \n changesOften = NO\n \n static defaultTextColor = UIColor.blackColor\n static notificationTextColor = UIColor.redColor\n \n static _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n static _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n \n static _ptToPx: number\n static _pxToPt: number\n _text?: string\n \n private _useFastMeasurement: boolean | undefined;\n private _cachedMeasurementStyles: TextMeasurementStyle | undefined;\n \n override usesVirtualLayoutingForIntrinsicSizing = NO\n \n \n constructor(\n elementID?: string,\n textViewType: string | ValueOf<typeof UITextView.type> = UITextView.type.paragraph,\n viewHTMLElement = null\n ) {\n \n super(elementID, viewHTMLElement, textViewType)\n \n this.text = \"\"\n \n this.style.overflow = \"hidden\"\n this.style.textOverflow = \"ellipsis\"\n this.isSingleLine = YES\n \n this.textColor = this.textColor\n \n this.userInteractionEnabled = YES\n \n \n if (textViewType == UITextView.type.textArea) {\n \n this.pausesPointerEvents = YES\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n \n \n }\n \n \n }\n \n \n static _determinePXAndPTRatios() {\n \n if (UITextView._ptToPx) {\n return\n }\n \n const o = document.createElement(\"div\")\n o.style.width = \"1000pt\"\n document.body.appendChild(o)\n UITextView._ptToPx = o.clientWidth / 1000\n document.body.removeChild(o)\n UITextView._pxToPt = 1 / UITextView._ptToPx\n \n }\n \n \n static type = {\n \n \"paragraph\": \"p\",\n \"header1\": \"h1\",\n \"header2\": \"h2\",\n \"header3\": \"h3\",\n \"header4\": \"h4\",\n \"header5\": \"h5\",\n \"header6\": \"h6\",\n \"textArea\": \"textarea\",\n \"textField\": \"input\",\n \"span\": \"span\",\n \"label\": \"label\"\n \n } as const\n \n \n static textAlignment = {\n \n \"left\": \"left\",\n \"center\": \"center\",\n \"right\": \"right\",\n \"justify\": \"justify\"\n \n } as const\n \n get textAlignment() {\n // @ts-ignore\n return this.style.textAlign\n }\n \n set textAlignment(textAlignment: ValueOf<typeof UITextView.textAlignment>) {\n this._textAlignment = textAlignment\n this.style.textAlign = textAlignment\n }\n \n \n get textColor() {\n return this._textColor\n }\n \n set textColor(color: UIColor) {\n \n this._textColor = color || UITextView.defaultTextColor\n this.style.color = this._textColor.stringValue\n \n }\n \n \n get isSingleLine() {\n \n return this._isSingleLine\n \n }\n \n set isSingleLine(isSingleLine: boolean) {\n \n this._isSingleLine = isSingleLine\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n if (isSingleLine) {\n \n this.style.whiteSpace = \"pre\"\n \n return\n \n }\n \n this.style.whiteSpace = \"pre-wrap\"\n \n this.invalidateMeasurementStrategy()\n \n }\n \n \n get notificationAmount() {\n \n return this._notificationAmount\n \n }\n \n set notificationAmount(notificationAmount: number) {\n \n if (this._notificationAmount == notificationAmount) {\n \n return\n \n }\n \n this._notificationAmount = notificationAmount\n \n this.text = this.text\n \n this.setNeedsLayoutUpToRootView()\n \n this.notificationAmountDidChange(notificationAmount)\n \n }\n \n notificationAmountDidChange(notificationAmount: number) {\n \n \n }\n \n \n get text() {\n \n return (this._text || this.viewHTMLElement.innerHTML)\n \n }\n \n set text(text) {\n this._text = text\n var notificationText = \"\"\n if (this.notificationAmount) {\n notificationText = \"<span style=\\\"color: \" + UITextView.notificationTextColor.stringValue + \";\\\">\" +\n (\" (\" + this.notificationAmount + \")\").bold() + \"</span>\"\n }\n \n if (this.viewHTMLElement.innerHTML != this.textPrefix + text + this.textSuffix + notificationText) {\n this.viewHTMLElement.innerHTML = this.textPrefix + FIRST(text, \"\") + this.textSuffix + notificationText\n }\n \n if (this.changesOften) {\n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n }\n // Invalidate measurement strategy when text changes significantly\n this._useFastMeasurement = undefined;\n this._intrinsicSizesCache = {};\n this.invalidateMeasurementStrategy()\n this._invalidateMeasurementStyles()\n \n this.setNeedsLayout()\n \n }\n \n override set innerHTML(innerHTML: string) {\n \n this.text = innerHTML\n this.invalidateMeasurementStrategy()\n \n }\n \n override get innerHTML() {\n \n return this.viewHTMLElement.innerHTML\n \n }\n \n \n setText(key: string, defaultString: string, parameters?: { [x: string]: string | UILocalizedTextObject }) {\n \n this.setInnerHTML(key, defaultString, parameters)\n this.invalidateMeasurementStrategy()\n \n }\n \n \n get fontSize() {\n \n const style = this.style.fontSize || window.getComputedStyle(this.viewHTMLElement, null).fontSize\n \n const result = (parseFloat(style) * UITextView._pxToPt)\n \n return result\n \n }\n \n set fontSize(fontSize: number) {\n \n if (fontSize != this.fontSize) {\n \n this.style.fontSize = \"\" + fontSize + \"pt\"\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any // MEETOD LUUA!!!!\n \n this._invalidateMeasurementStyles() // Invalidate when font changes\n \n }\n \n }\n \n \n \n useAutomaticFontSize(minFontSize: number = nil, maxFontSize: number = nil) {\n \n this._automaticFontSizeSelection = YES\n \n this._minFontSize = minFontSize\n this._maxFontSize = maxFontSize\n \n this.setNeedsLayout()\n \n }\n \n \n static automaticallyCalculatedFontSize(\n bounds: UIRectangle,\n currentSize: UIRectangle,\n currentFontSize: number,\n minFontSize?: number,\n maxFontSize?: number\n ) {\n \n minFontSize = FIRST(minFontSize, 1)\n maxFontSize = FIRST(maxFontSize, 100000000000)\n \n const heightMultiplier = bounds.height / (currentSize.height + 1)\n const widthMultiplier = bounds.width / (currentSize.width + 1)\n \n var multiplier = heightMultiplier\n if (heightMultiplier > widthMultiplier) {\n multiplier = widthMultiplier\n }\n \n const maxFittingFontSize = currentFontSize * multiplier\n \n if (maxFittingFontSize > maxFontSize) {\n return maxFontSize\n }\n \n if (minFontSize > maxFittingFontSize) {\n return minFontSize\n }\n \n return maxFittingFontSize\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n }\n \n \n override willMoveToSuperview(superview: UIView) {\n \n super.willMoveToSuperview(superview)\n \n }\n \n \n override layoutSubviews() {\n \n super.layoutSubviews()\n \n \n if (this._automaticFontSizeSelection) {\n \n this.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(0, 0, 1 *\n this.viewHTMLElement.offsetHeight, 1 *\n this.viewHTMLElement.offsetWidth),\n this.intrinsicContentSize(),\n this.fontSize,\n this._minFontSize,\n this._maxFontSize\n )\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingWidth).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicHeightCache\n \n if (this.changesOften) {\n \n // @ts-ignore\n cacheObject = this._intrinsicHeightCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentHeight(constrainingWidth)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n return result\n \n }\n \n override intrinsicContentWidth(constrainingHeight = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingHeight).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicWidthCache\n \n if (this.changesOften) {\n \n // @ts-ignore\n cacheObject = this._intrinsicWidthCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentWidth(constrainingHeight)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n return result\n \n }\n \n \n // Call this when styles change (fontSize, padding, etc.)\n private _invalidateMeasurementStyles(): void {\n this._cachedMeasurementStyles = undefined;\n UITextMeasurement.invalidateElement(this.viewHTMLElement);\n this._intrinsicSizesCache = {};\n }\n \n // Extract styles ONCE and cache them (avoids getComputedStyle)\n private _getMeasurementStyles(): TextMeasurementStyle {\n if (this._cachedMeasurementStyles) {\n return this._cachedMeasurementStyles;\n }\n \n // Only call getComputedStyle once and cache the result\n const computed = window.getComputedStyle(this.viewHTMLElement);\n const fontSize = parseFloat(computed.fontSize);\n \n this._cachedMeasurementStyles = {\n font: [\n computed.fontStyle,\n computed.fontVariant,\n computed.fontWeight,\n computed.fontSize,\n computed.fontFamily\n ].join(' '),\n fontSize: fontSize,\n lineHeight: this._parseLineHeight(computed.lineHeight, fontSize),\n whiteSpace: computed.whiteSpace,\n paddingLeft: parseFloat(computed.paddingLeft) || 0,\n paddingRight: parseFloat(computed.paddingRight) || 0,\n paddingTop: parseFloat(computed.paddingTop) || 0,\n paddingBottom: parseFloat(computed.paddingBottom) || 0\n };\n \n return this._cachedMeasurementStyles;\n }\n \n private _parseLineHeight(lineHeight: string, fontSize: number): number {\n if (lineHeight === 'normal') {\n return fontSize * 1.2;\n }\n if (lineHeight.endsWith('px')) {\n return parseFloat(lineHeight);\n }\n const numericLineHeight = parseFloat(lineHeight);\n if (!isNaN(numericLineHeight)) {\n return fontSize * numericLineHeight;\n }\n return fontSize * 1.2;\n }\n \n // Override the intrinsic size method\n override intrinsicContentSizeWithConstraints(\n constrainingHeight: number = 0,\n constrainingWidth: number = 0\n ): UIRectangle {\n const cacheKey = \"h_\" + constrainingHeight + \"__w_\" + constrainingWidth;\n const cachedResult = this._intrinsicSizesCache[cacheKey];\n if (cachedResult) {\n return cachedResult;\n }\n \n // Determine measurement strategy\n const shouldUseFastPath = this._useFastMeasurement ?? this._shouldUseFastMeasurement();\n \n let result: UIRectangle;\n \n if (shouldUseFastPath) {\n // Fast path: canvas-based measurement with pre-extracted styles\n const styles = this._getMeasurementStyles();\n const size = UITextMeasurement.calculateTextSize(\n this.viewHTMLElement,\n this.text || this.innerHTML,\n constrainingWidth || undefined,\n constrainingHeight || undefined,\n styles // Pass pre-computed styles to avoid getComputedStyle!\n );\n result = new UIRectangle(0, 0, size.height, size.width);\n } else {\n // Fallback: original DOM-based measurement for complex content\n result = super.intrinsicContentSizeWithConstraints(constrainingHeight, constrainingWidth);\n }\n \n this._intrinsicSizesCache[cacheKey] = result.copy();\n return result;\n }\n \n // Helper to determine if we can use fast measurement\n private _shouldUseFastMeasurement(): boolean {\n const content = this.text || this.innerHTML;\n \n // If using dynamic innerHTML with parameters, use DOM measurement\n if (this._innerHTMLKey || this._localizedTextObject) {\n return false;\n }\n \n // Check for notification badges\n if (this.notificationAmount > 0) {\n return false; // Has span with colored text\n }\n \n // Check content complexity\n const hasComplexHTML = /<(?!\\/?(b|i|em|strong|span|br)\\b)[^>]+>/i.test(content);\n \n return !hasComplexHTML;\n }\n \n // Optional: Allow manual override for specific instances\n setUseFastMeasurement(useFast: boolean): void {\n this._useFastMeasurement = useFast;\n this._intrinsicSizesCache = {};\n }\n \n // Optional: Force re-evaluation of measurement strategy\n invalidateMeasurementStrategy(): void {\n this._useFastMeasurement = undefined;\n this._invalidateMeasurementStyles();\n }\n \n \n \n \n \n override intrinsicContentSize() {\n \n // This works but is slow\n const result = this.intrinsicContentSizeWithConstraints(nil, nil)\n \n return result\n \n }\n \n \n}\n\n\nUITextView._determinePXAndPTRatios()\n\n\n// /**\n// * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.\n// * \n// * @param {String} text The text to be rendered.\n// * @param {String} font The css font descriptor that text is to be rendered with (e.g. \"bold 14px verdana\").\n// * \n// * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393\n// */\n// function getTextMetrics(text, font) {\n// // re-use canvas object for better performance\n// var canvas = getTextMetrics.canvas || (getTextMetrics.canvas = document.createElement(\"canvas\"));\n// var context = canvas.getContext(\"2d\");\n// context.font = font;\n// var metrics = context.measureText(text);\n// return metrics;\n// }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AAExB,sBAAgE;AAChE,yBAA4B;AAE5B,+BAAwD;AACxD,oBAA6C;AAGtC,MAAM,cAAN,cAAyB,qBAAO;AAAA,
|
|
4
|
+
"sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UILocalizedTextObject } from \"./UIInterfaces\"\nimport { FIRST, IS, IS_LIKE_NULL, nil, NO, UIObject, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport type { ValueOf } from \"./UIObject\"\nimport { TextMeasurementStyle, UITextMeasurement } from \"./UITextMeasurement\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UITextView extends UIView {\n \n \n _textColor: UIColor = UITextView.defaultTextColor\n _textAlignment?: ValueOf<typeof UITextView.textAlignment>\n \n _isSingleLine = YES\n \n textPrefix = \"\"\n textSuffix = \"\"\n \n _notificationAmount = 0\n \n _minFontSize?: number\n _maxFontSize?: number\n \n _automaticFontSizeSelection = NO\n \n changesOften = NO\n \n static defaultTextColor = UIColor.blackColor\n static notificationTextColor = UIColor.redColor\n \n // Global caches for all UILabels\n static _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n static _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n // Local cache for this instance if the label changes often\n _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n \n static _ptToPx: number\n static _pxToPt: number\n _text?: string\n \n private _useFastMeasurement: boolean | undefined\n private _cachedMeasurementStyles: TextMeasurementStyle | undefined\n \n override usesVirtualLayoutingForIntrinsicSizing = NO\n \n constructor(\n elementID?: string,\n textViewType: string | ValueOf<typeof UITextView.type> = UITextView.type.paragraph,\n viewHTMLElement = null\n ) {\n \n super(elementID, viewHTMLElement, textViewType)\n \n this.text = \"\"\n \n this.style.overflow = \"hidden\"\n this.style.textOverflow = \"ellipsis\"\n this.isSingleLine = YES\n \n this.textColor = this.textColor\n \n this.userInteractionEnabled = YES\n \n \n if (textViewType == UITextView.type.textArea) {\n \n this.pausesPointerEvents = YES\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n \n \n }\n \n \n }\n \n \n static _determinePXAndPTRatios() {\n \n if (UITextView._ptToPx) {\n return\n }\n \n const o = document.createElement(\"div\")\n o.style.width = \"1000pt\"\n document.body.appendChild(o)\n UITextView._ptToPx = o.clientWidth / 1000\n document.body.removeChild(o)\n UITextView._pxToPt = 1 / UITextView._ptToPx\n \n }\n \n \n static type = {\n \n \"paragraph\": \"p\",\n \"header1\": \"h1\",\n \"header2\": \"h2\",\n \"header3\": \"h3\",\n \"header4\": \"h4\",\n \"header5\": \"h5\",\n \"header6\": \"h6\",\n \"textArea\": \"textarea\",\n \"textField\": \"input\",\n \"span\": \"span\",\n \"label\": \"label\"\n \n } as const\n \n \n static textAlignment = {\n \n \"left\": \"left\",\n \"center\": \"center\",\n \"right\": \"right\",\n \"justify\": \"justify\"\n \n } as const\n \n get textAlignment() {\n // @ts-ignore\n return this.style.textAlign\n }\n \n set textAlignment(textAlignment: ValueOf<typeof UITextView.textAlignment>) {\n this._textAlignment = textAlignment\n this.style.textAlign = textAlignment\n }\n \n \n get textColor() {\n return this._textColor\n }\n \n set textColor(color: UIColor) {\n \n this._textColor = color || UITextView.defaultTextColor\n this.style.color = this._textColor.stringValue\n \n }\n \n \n get isSingleLine() {\n \n return this._isSingleLine\n \n }\n \n set isSingleLine(isSingleLine: boolean) {\n \n this._isSingleLine = isSingleLine\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n if (isSingleLine) {\n \n this.style.whiteSpace = \"pre\"\n \n return\n \n }\n \n this.style.whiteSpace = \"pre-wrap\"\n \n this.invalidateMeasurementStrategy()\n \n }\n \n \n get notificationAmount() {\n \n return this._notificationAmount\n \n }\n \n set notificationAmount(notificationAmount: number) {\n \n if (this._notificationAmount == notificationAmount) {\n \n return\n \n }\n \n this._notificationAmount = notificationAmount\n \n this.text = this.text\n \n this.setNeedsLayoutUpToRootView()\n \n this.notificationAmountDidChange(notificationAmount)\n \n }\n \n notificationAmountDidChange(notificationAmount: number) {\n \n \n }\n \n \n get text() {\n \n return (this._text || this.viewHTMLElement.innerHTML)\n \n }\n \n set text(text) {\n this._text = text\n var notificationText = \"\"\n if (this.notificationAmount) {\n notificationText = \"<span style=\\\"color: \" + UITextView.notificationTextColor.stringValue + \";\\\">\" +\n (\" (\" + this.notificationAmount + \")\").bold() + \"</span>\"\n }\n \n if (this.viewHTMLElement.innerHTML != this.textPrefix + text + this.textSuffix + notificationText) {\n this.viewHTMLElement.innerHTML = this.textPrefix + FIRST(text, \"\") + this.textSuffix + notificationText\n }\n \n if (this.changesOften) {\n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n }\n // Invalidate measurement strategy when text changes significantly\n this._useFastMeasurement = undefined\n this._intrinsicSizesCache = {}\n this.invalidateMeasurementStrategy()\n this._invalidateMeasurementStyles()\n this.clearIntrinsicSizeCache()\n \n this.setNeedsLayout()\n \n }\n \n override set innerHTML(innerHTML: string) {\n \n this.text = innerHTML\n this.invalidateMeasurementStrategy()\n \n }\n \n override get innerHTML() {\n \n return this.viewHTMLElement.innerHTML\n \n }\n \n \n setText(key: string, defaultString: string, parameters?: { [x: string]: string | UILocalizedTextObject }) {\n \n this.setInnerHTML(key, defaultString, parameters)\n this.invalidateMeasurementStrategy()\n \n }\n \n \n get fontSize() {\n \n const style = this.style.fontSize || window.getComputedStyle(this.viewHTMLElement, null).fontSize\n \n const result = (parseFloat(style) * UITextView._pxToPt)\n \n return result\n \n }\n \n set fontSize(fontSize: number) {\n \n if (fontSize != this.fontSize) {\n \n this.style.fontSize = \"\" + fontSize + \"pt\"\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any // MEETOD LUUA!!!!\n \n this._invalidateMeasurementStyles() // Invalidate when font changes\n this.clearIntrinsicSizeCache()\n \n }\n \n }\n \n \n useAutomaticFontSize(minFontSize: number = nil, maxFontSize: number = nil) {\n \n this._automaticFontSizeSelection = YES\n \n this._minFontSize = minFontSize\n this._maxFontSize = maxFontSize\n \n this.setNeedsLayout()\n \n }\n \n \n static automaticallyCalculatedFontSize(\n bounds: UIRectangle,\n currentSize: UIRectangle,\n currentFontSize: number,\n minFontSize?: number,\n maxFontSize?: number\n ) {\n \n minFontSize = FIRST(minFontSize, 1)\n maxFontSize = FIRST(maxFontSize, 100000000000)\n \n const heightMultiplier = bounds.height / (currentSize.height + 1)\n const widthMultiplier = bounds.width / (currentSize.width + 1)\n \n var multiplier = heightMultiplier\n if (heightMultiplier > widthMultiplier) {\n multiplier = widthMultiplier\n }\n \n const maxFittingFontSize = currentFontSize * multiplier\n \n if (maxFittingFontSize > maxFontSize) {\n return maxFontSize\n }\n \n if (minFontSize > maxFittingFontSize) {\n return minFontSize\n }\n \n return maxFittingFontSize\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n }\n \n \n override willMoveToSuperview(superview: UIView) {\n \n super.willMoveToSuperview(superview)\n \n }\n \n \n override layoutSubviews() {\n \n super.layoutSubviews()\n \n \n if (this._automaticFontSizeSelection) {\n \n this.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(0, 0, 1 *\n this.viewHTMLElement.offsetHeight, 1 *\n this.viewHTMLElement.offsetWidth),\n this.intrinsicContentSize(),\n this.fontSize,\n this._minFontSize,\n this._maxFontSize\n )\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingWidth).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicHeightCache\n \n if (this.changesOften) {\n \n // @ts-ignore\n cacheObject = this._intrinsicHeightCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentHeight(constrainingWidth)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n if (isNaN(result) || (!result && !this.text) ) {\n \n // console.error(\"Failed to calculate intrinsic height (\" + this.elementID + \")\", this, this.viewHTMLElement)\n var asd = 1\n \n result = super.intrinsicContentHeight(constrainingWidth)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n var asdasd = 1\n \n \n }\n \n return result\n \n }\n \n override intrinsicContentWidth(constrainingHeight = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingHeight).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicWidthCache\n \n if (this.changesOften) {\n \n // @ts-ignore\n cacheObject = this._intrinsicWidthCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentWidth(constrainingHeight)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n return result\n \n }\n \n \n // Call this when styles change (fontSize, padding, etc.)\n private _invalidateMeasurementStyles(): void {\n this._cachedMeasurementStyles = undefined\n UITextMeasurement.invalidateElement(this.viewHTMLElement)\n this._intrinsicSizesCache = {}\n }\n \n // Extract styles ONCE and cache them (avoids getComputedStyle)\n private _getMeasurementStyles(): TextMeasurementStyle {\n if (this._cachedMeasurementStyles) {\n return this._cachedMeasurementStyles\n }\n \n // Only call getComputedStyle once and cache the result\n const computed = window.getComputedStyle(this.viewHTMLElement)\n const fontSize = parseFloat(computed.fontSize)\n \n this._cachedMeasurementStyles = {\n font: [\n computed.fontStyle,\n computed.fontVariant,\n computed.fontWeight,\n computed.fontSize,\n computed.fontFamily\n ].join(\" \"),\n fontSize: fontSize,\n lineHeight: this._parseLineHeight(computed.lineHeight, fontSize),\n whiteSpace: computed.whiteSpace,\n paddingLeft: parseFloat(computed.paddingLeft) || 0,\n paddingRight: parseFloat(computed.paddingRight) || 0,\n paddingTop: parseFloat(computed.paddingTop) || 0,\n paddingBottom: parseFloat(computed.paddingBottom) || 0\n }\n \n return this._cachedMeasurementStyles\n }\n \n private _parseLineHeight(lineHeight: string, fontSize: number): number {\n if (lineHeight === \"normal\") {\n return fontSize * 1.2\n }\n if (lineHeight.endsWith(\"px\")) {\n return parseFloat(lineHeight)\n }\n const numericLineHeight = parseFloat(lineHeight)\n if (!isNaN(numericLineHeight)) {\n return fontSize * numericLineHeight\n }\n return fontSize * 1.2\n }\n \n // Override the intrinsic size method\n override intrinsicContentSizeWithConstraints(\n constrainingHeight: number = 0,\n constrainingWidth: number = 0\n ): UIRectangle {\n const cacheKey = \"h_\" + constrainingHeight + \"__w_\" + constrainingWidth\n const cachedResult = this._intrinsicSizesCache[cacheKey]\n if (cachedResult) {\n return cachedResult\n }\n \n // Determine measurement strategy\n const shouldUseFastPath = this._useFastMeasurement ?? this._shouldUseFastMeasurement()\n \n let result: UIRectangle\n \n if (shouldUseFastPath) {\n // Fast path: canvas-based measurement with pre-extracted styles\n const styles = this._getMeasurementStyles()\n const size = UITextMeasurement.calculateTextSize(\n this.viewHTMLElement,\n this.text || this.innerHTML,\n constrainingWidth || undefined,\n constrainingHeight || undefined,\n styles // Pass pre-computed styles to avoid getComputedStyle!\n )\n result = new UIRectangle(0, 0, size.height, size.width)\n }\n else {\n // Fallback: original DOM-based measurement for complex content\n result = super.intrinsicContentSizeWithConstraints(constrainingHeight, constrainingWidth)\n }\n \n if (isNaN(result.height) || isNaN(result.width)) {\n \n // console.error(\"Failed to calculate intrinsic height (\" + this.elementID + \")\", this)\n var asd = 1\n \n // Fallback: original DOM-based measurement\n result = super.intrinsicContentSizeWithConstraints(constrainingHeight, constrainingWidth)\n \n \n }\n \n this._intrinsicSizesCache[cacheKey] = result.copy()\n return result\n }\n \n // Helper to determine if we can use fast measurement\n private _shouldUseFastMeasurement(): boolean {\n const content = this.text || this.innerHTML\n \n // If using dynamic innerHTML with parameters, use DOM measurement\n if (this._innerHTMLKey || this._localizedTextObject) {\n return false\n }\n \n // Check for notification badges\n if (this.notificationAmount > 0) {\n return false // Has span with colored text\n }\n \n // Check content complexity\n const hasComplexHTML = /<(?!\\/?(b|i|em|strong|span|br)\\b)[^>]+>/i.test(content)\n \n return !hasComplexHTML\n }\n \n // Optional: Allow manual override for specific instances\n setUseFastMeasurement(useFast: boolean): void {\n this._useFastMeasurement = useFast\n this._intrinsicSizesCache = {}\n }\n \n // Optional: Force re-evaluation of measurement strategy\n invalidateMeasurementStrategy(): void {\n this._useFastMeasurement = undefined\n this._invalidateMeasurementStyles()\n }\n \n \n override intrinsicContentSize() {\n \n // This works but is slow\n const result = this.intrinsicContentSizeWithConstraints(nil, nil)\n \n return result\n \n }\n \n \n}\n\n\nUITextView._determinePXAndPTRatios()\n\n\n// /**\n// * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.\n// * \n// * @param {String} text The text to be rendered.\n// * @param {String} font The css font descriptor that text is to be rendered with (e.g. \"bold 14px verdana\").\n// * \n// * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393\n// */\n// function getTextMetrics(text, font) {\n// // re-use canvas object for better performance\n// var canvas = getTextMetrics.canvas || (getTextMetrics.canvas = document.createElement(\"canvas\"));\n// var context = canvas.getContext(\"2d\");\n// context.font = font;\n// var metrics = context.measureText(text);\n// return metrics;\n// }\n\n\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U,KAAK,QAAQ,KAAK;AAGlC,QAAI,KAAK,iBAAiB,KAAK,sBAAsB;AACjD,aAAO;AAAA,IACX;AAGA,QAAI,KAAK,qBAAqB,GAAG;AAC7B,aAAO;AAAA,IACX;AAGA,UAAM,iBAAiB,2CAA2C,KAAK,OAAO;AAE9E,WAAO,CAAC;AAAA,EACZ;AAAA,EAGA,sBAAsB,SAAwB;AAC1C,SAAK,sBAAsB;AAC3B,SAAK,uBAAuB,CAAC;AAAA,EACjC;AAAA,EAGA,gCAAsC;AAClC,SAAK,sBAAsB;AAC3B,SAAK,6BAA6B;AAAA,EACtC;AAAA,EAGS,uBAAuB;AAG5B,UAAM,SAAS,KAAK,oCAAoC,qBAAK,mBAAG;AAEhE,WAAO;AAAA,EAEX;AAGJ;AAllBO,IAAM,aAAN;AAAM,WAoBF,mBAAmB,uBAAQ;AApBzB,WAqBF,wBAAwB,uBAAQ;AArB9B,WAwBF,wBAA+E,IAAI,yBAAS;AAxB1F,WAyBF,uBAA8E,IAAI,yBAAS;AAzBzF,WA4FF,OAAO;AAAA,EAEV,aAAa;AAAA,EACb,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,SAAS;AAEb;AA1GS,WA6GF,gBAAgB;AAAA,EAEnB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AAEf;AAieJ,WAAW,wBAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -137,9 +137,19 @@ export declare class UIView extends UIObject {
|
|
|
137
137
|
static _onWindowMouseup: (event: MouseEvent) => void;
|
|
138
138
|
private _resizeObserverEntry?;
|
|
139
139
|
protected _intrinsicSizesCache: Record<string, UIRectangle>;
|
|
140
|
-
static
|
|
140
|
+
private static _virtualLayoutingDepth;
|
|
141
|
+
static get isVirtualLayouting(): boolean;
|
|
142
|
+
get isVirtualLayouting(): boolean;
|
|
143
|
+
startVirtualLayout(): void;
|
|
144
|
+
finishVirtualLayout(): void;
|
|
141
145
|
_frameForVirtualLayouting?: UIRectangle;
|
|
142
146
|
usesVirtualLayoutingForIntrinsicSizing: boolean;
|
|
147
|
+
_contentInsets: {
|
|
148
|
+
top: number;
|
|
149
|
+
left: number;
|
|
150
|
+
bottom: number;
|
|
151
|
+
right: number;
|
|
152
|
+
};
|
|
143
153
|
constructor(elementID?: string, viewHTMLElement?: HTMLElement & LooseObject | null, elementType?: string | null, initViewData?: any);
|
|
144
154
|
static get nextIndex(): number;
|
|
145
155
|
static get pageHeight(): number;
|
|
@@ -392,7 +402,15 @@ export declare class UIView extends UIObject {
|
|
|
392
402
|
forEachViewInSubtree(functionToCall: (view: UIView) => void): void;
|
|
393
403
|
rectangleInView(rectangle: UIRectangle, view: UIView, forceIfNotInViewTree?: boolean): any;
|
|
394
404
|
rectangleFromView(rectangle: UIRectangle, view: UIView): any;
|
|
405
|
+
get contentBounds(): UIRectangle;
|
|
406
|
+
contentBoundsWithInset(inset: number): UIRectangle;
|
|
407
|
+
contentBoundsWithInsets(left: number, right: number, bottom: number, top: number): UIRectangle;
|
|
408
|
+
private _getIntrinsicSizeCacheKey;
|
|
409
|
+
private _getCachedIntrinsicSize;
|
|
410
|
+
private _setCachedIntrinsicSize;
|
|
411
|
+
clearIntrinsicSizeCache(): void;
|
|
395
412
|
intrinsicContentSizeWithConstraints(constrainingHeight?: number, constrainingWidth?: number): UIRectangle;
|
|
413
|
+
private _intrinsicFrameFromSubviewFrames;
|
|
396
414
|
intrinsicContentWidth(constrainingHeight?: number): number;
|
|
397
415
|
intrinsicContentHeight(constrainingWidth?: number): number;
|
|
398
416
|
intrinsicContentSize(): UIRectangle;
|
|
@@ -93,6 +93,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
93
93
|
this._isCBEditorTemporaryMovable = import_UIObject.NO;
|
|
94
94
|
this._intrinsicSizesCache = {};
|
|
95
95
|
this.usesVirtualLayoutingForIntrinsicSizing = import_UIObject.YES;
|
|
96
|
+
this._contentInsets = { top: 0, left: 0, bottom: 0, right: 0 };
|
|
96
97
|
this.controlEvent = _UIView.controlEvent;
|
|
97
98
|
_UIView._UIViewIndex = _UIView.nextIndex;
|
|
98
99
|
this._UIViewIndex = _UIView._UIViewIndex;
|
|
@@ -104,6 +105,21 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
104
105
|
this._loadUIEvents();
|
|
105
106
|
this.setNeedsLayout();
|
|
106
107
|
}
|
|
108
|
+
static get isVirtualLayouting() {
|
|
109
|
+
return this._virtualLayoutingDepth > 0;
|
|
110
|
+
}
|
|
111
|
+
get isVirtualLayouting() {
|
|
112
|
+
return _UIView._virtualLayoutingDepth > 0;
|
|
113
|
+
}
|
|
114
|
+
startVirtualLayout() {
|
|
115
|
+
_UIView._virtualLayoutingDepth = _UIView._virtualLayoutingDepth + 1;
|
|
116
|
+
}
|
|
117
|
+
finishVirtualLayout() {
|
|
118
|
+
if (_UIView._virtualLayoutingDepth === 0) {
|
|
119
|
+
throw new Error("Unbalanced finishVirtualLayout()");
|
|
120
|
+
}
|
|
121
|
+
_UIView._virtualLayoutingDepth = _UIView._virtualLayoutingDepth - 1;
|
|
122
|
+
}
|
|
107
123
|
static get nextIndex() {
|
|
108
124
|
return _UIView._UIViewIndex + 1;
|
|
109
125
|
}
|
|
@@ -470,7 +486,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
470
486
|
get frame() {
|
|
471
487
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
472
488
|
let result;
|
|
473
|
-
if (!
|
|
489
|
+
if (!this.isVirtualLayouting) {
|
|
474
490
|
result = (_a = this._frame) == null ? void 0 : _a.copy();
|
|
475
491
|
} else {
|
|
476
492
|
result = (_b = this._frameForVirtualLayouting) == null ? void 0 : _b.copy();
|
|
@@ -496,7 +512,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
496
512
|
if (zIndex != void 0) {
|
|
497
513
|
rectangle.zIndex = zIndex;
|
|
498
514
|
}
|
|
499
|
-
if (!
|
|
515
|
+
if (!this.isVirtualLayouting) {
|
|
500
516
|
this._frame = rectangle;
|
|
501
517
|
} else {
|
|
502
518
|
this._frameForVirtualLayouting = rectangle;
|
|
@@ -509,7 +525,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
509
525
|
if (this.isInternalScaling) {
|
|
510
526
|
rectangle.scale(1 / this.scale);
|
|
511
527
|
}
|
|
512
|
-
if (!
|
|
528
|
+
if (!this.isVirtualLayouting) {
|
|
513
529
|
_UIView._setAbsoluteSizeAndPosition(
|
|
514
530
|
this.viewHTMLElement,
|
|
515
531
|
rectangle.topLeft.x,
|
|
@@ -528,7 +544,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
528
544
|
get bounds() {
|
|
529
545
|
var _a, _b, _c, _d, _e;
|
|
530
546
|
let _frame;
|
|
531
|
-
if (!
|
|
547
|
+
if (!this.isVirtualLayouting) {
|
|
532
548
|
_frame = this._frame;
|
|
533
549
|
} else {
|
|
534
550
|
_frame = this._frameForVirtualLayouting;
|
|
@@ -543,7 +559,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
543
559
|
);
|
|
544
560
|
} else {
|
|
545
561
|
let frame;
|
|
546
|
-
if (!
|
|
562
|
+
if (!this.isVirtualLayouting) {
|
|
547
563
|
frame = this.frame;
|
|
548
564
|
} else {
|
|
549
565
|
frame = (_e = this._frameForVirtualLayouting) != null ? _e : this.frame;
|
|
@@ -552,6 +568,8 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
552
568
|
result.x = 0;
|
|
553
569
|
result.y = 0;
|
|
554
570
|
}
|
|
571
|
+
result.minHeight = 0;
|
|
572
|
+
result.minWidth = 0;
|
|
555
573
|
return result;
|
|
556
574
|
}
|
|
557
575
|
set bounds(rectangle) {
|
|
@@ -891,19 +909,42 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
891
909
|
_UIView.runFunctionBeforeNextFrame(_UIView.layoutViewsIfNeeded);
|
|
892
910
|
}
|
|
893
911
|
static layoutViewsIfNeeded() {
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
912
|
+
const maxIterations = 10;
|
|
913
|
+
let iteration = 0;
|
|
914
|
+
const layoutCounts = /* @__PURE__ */ new Map();
|
|
915
|
+
while (_UIView._viewsToLayout.length > 0 && iteration < maxIterations) {
|
|
916
|
+
const viewsToProcess = _UIView._viewsToLayout;
|
|
917
|
+
_UIView._viewsToLayout = [];
|
|
918
|
+
const viewDepthMap = /* @__PURE__ */ new Map();
|
|
919
|
+
for (let i = 0; i < viewsToProcess.length; i++) {
|
|
920
|
+
const view = viewsToProcess[i];
|
|
921
|
+
const layoutCount = layoutCounts.get(view) || 0;
|
|
922
|
+
if (layoutCount >= 5) {
|
|
923
|
+
console.warn("View layout cycle detected:", view);
|
|
924
|
+
continue;
|
|
925
|
+
}
|
|
926
|
+
if (!viewDepthMap.has(view)) {
|
|
927
|
+
viewDepthMap.set(view, view.withAllSuperviews.length);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
const sortedViews = Array.from(viewDepthMap.keys()).sort((a, b) => {
|
|
931
|
+
return viewDepthMap.get(a) - viewDepthMap.get(b);
|
|
932
|
+
});
|
|
933
|
+
for (let i = 0; i < sortedViews.length; i++) {
|
|
934
|
+
const view = sortedViews[i];
|
|
935
|
+
view.layoutIfNeeded();
|
|
936
|
+
layoutCounts.set(view, (layoutCounts.get(view) || 0) + 1);
|
|
937
|
+
}
|
|
938
|
+
iteration++;
|
|
897
939
|
}
|
|
898
|
-
_UIView._viewsToLayout = [];
|
|
899
940
|
}
|
|
900
941
|
setNeedsLayout() {
|
|
901
|
-
if (this._shouldLayout) {
|
|
942
|
+
if (this._shouldLayout && _UIView._viewsToLayout.contains(this)) {
|
|
902
943
|
return;
|
|
903
944
|
}
|
|
904
945
|
this._shouldLayout = import_UIObject.YES;
|
|
905
946
|
_UIView._viewsToLayout.push(this);
|
|
906
|
-
this.
|
|
947
|
+
this.clearIntrinsicSizeCache();
|
|
907
948
|
if (_UIView._viewsToLayout.length == 1) {
|
|
908
949
|
_UIView.scheduleLayoutViewsIfNeeded();
|
|
909
950
|
}
|
|
@@ -915,7 +956,9 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
915
956
|
if (!this._shouldLayout) {
|
|
916
957
|
return;
|
|
917
958
|
}
|
|
918
|
-
this.
|
|
959
|
+
if (!this.isVirtualLayouting) {
|
|
960
|
+
this._shouldLayout = import_UIObject.NO;
|
|
961
|
+
}
|
|
919
962
|
try {
|
|
920
963
|
this.layoutSubviews();
|
|
921
964
|
} catch (exception) {
|
|
@@ -925,7 +968,9 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
925
968
|
layoutSubviews() {
|
|
926
969
|
var _a, _b;
|
|
927
970
|
this.willLayoutSubviews();
|
|
928
|
-
this.
|
|
971
|
+
if (!this.isVirtualLayouting) {
|
|
972
|
+
this._shouldLayout = import_UIObject.NO;
|
|
973
|
+
}
|
|
929
974
|
if (this.constraints.length) {
|
|
930
975
|
this._updateLayoutFunction = _UIView.performAutoLayout(this.viewHTMLElement, null, this.constraints);
|
|
931
976
|
}
|
|
@@ -2140,9 +2185,55 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
2140
2185
|
rectangleFromView(rectangle, view) {
|
|
2141
2186
|
return view.rectangleInView(rectangle, this);
|
|
2142
2187
|
}
|
|
2188
|
+
get contentBounds() {
|
|
2189
|
+
const bounds = this.bounds;
|
|
2190
|
+
const insets = this._contentInsets;
|
|
2191
|
+
return new import_UIRectangle.UIRectangle(
|
|
2192
|
+
insets.left,
|
|
2193
|
+
insets.top,
|
|
2194
|
+
bounds.height - insets.top - insets.bottom,
|
|
2195
|
+
bounds.width - insets.left - insets.right
|
|
2196
|
+
);
|
|
2197
|
+
}
|
|
2198
|
+
contentBoundsWithInset(inset) {
|
|
2199
|
+
this._contentInsets = { top: inset, left: inset, bottom: inset, right: inset };
|
|
2200
|
+
const bounds = this.bounds;
|
|
2201
|
+
return new import_UIRectangle.UIRectangle(
|
|
2202
|
+
inset,
|
|
2203
|
+
inset,
|
|
2204
|
+
bounds.height - inset * 2,
|
|
2205
|
+
bounds.width - inset * 2
|
|
2206
|
+
);
|
|
2207
|
+
}
|
|
2208
|
+
contentBoundsWithInsets(left, right, bottom, top) {
|
|
2209
|
+
this._contentInsets = { left, right, bottom, top };
|
|
2210
|
+
const bounds = this.bounds;
|
|
2211
|
+
return new import_UIRectangle.UIRectangle(
|
|
2212
|
+
left,
|
|
2213
|
+
top,
|
|
2214
|
+
bounds.height - top - bottom,
|
|
2215
|
+
bounds.width - left - right
|
|
2216
|
+
);
|
|
2217
|
+
}
|
|
2218
|
+
_getIntrinsicSizeCacheKey(constrainingHeight, constrainingWidth) {
|
|
2219
|
+
return `h_${constrainingHeight}__w_${constrainingWidth}`;
|
|
2220
|
+
}
|
|
2221
|
+
_getCachedIntrinsicSize(cacheKey) {
|
|
2222
|
+
return this._intrinsicSizesCache[cacheKey];
|
|
2223
|
+
}
|
|
2224
|
+
_setCachedIntrinsicSize(cacheKey, size) {
|
|
2225
|
+
this._intrinsicSizesCache[cacheKey] = size.copy();
|
|
2226
|
+
}
|
|
2227
|
+
clearIntrinsicSizeCache() {
|
|
2228
|
+
var _a;
|
|
2229
|
+
this._intrinsicSizesCache = {};
|
|
2230
|
+
if ((_a = this.superview) == null ? void 0 : _a.usesVirtualLayoutingForIntrinsicSizing) {
|
|
2231
|
+
this.superview.clearIntrinsicSizeCache();
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2143
2234
|
intrinsicContentSizeWithConstraints(constrainingHeight = 0, constrainingWidth = 0) {
|
|
2144
|
-
const cacheKey =
|
|
2145
|
-
const cachedResult = this.
|
|
2235
|
+
const cacheKey = this._getIntrinsicSizeCacheKey(constrainingHeight, constrainingWidth);
|
|
2236
|
+
const cachedResult = this._getCachedIntrinsicSize(cacheKey);
|
|
2146
2237
|
if (cachedResult) {
|
|
2147
2238
|
return cachedResult;
|
|
2148
2239
|
}
|
|
@@ -2192,85 +2283,89 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
2192
2283
|
}
|
|
2193
2284
|
result.height = resultHeight;
|
|
2194
2285
|
result.width = resultWidth;
|
|
2195
|
-
this.
|
|
2286
|
+
this._setCachedIntrinsicSize(cacheKey, result);
|
|
2196
2287
|
return result;
|
|
2197
2288
|
}
|
|
2289
|
+
_intrinsicFrameFromSubviewFrames() {
|
|
2290
|
+
var _a, _b, _c, _d;
|
|
2291
|
+
const framePoints = [];
|
|
2292
|
+
this.subviews.forEach((subview) => {
|
|
2293
|
+
subview.layoutIfNeeded();
|
|
2294
|
+
framePoints.push(subview.frame.min);
|
|
2295
|
+
framePoints.push(subview.frame.max);
|
|
2296
|
+
});
|
|
2297
|
+
const resultFrame = import_UIRectangle.UIRectangle.boundingBoxForPoints(framePoints).rectangleWithInsets(
|
|
2298
|
+
-((_a = this._contentInsets) == null ? void 0 : _a.left),
|
|
2299
|
+
-((_b = this._contentInsets) == null ? void 0 : _b.right),
|
|
2300
|
+
-((_c = this._contentInsets) == null ? void 0 : _c.bottom),
|
|
2301
|
+
-((_d = this._contentInsets) == null ? void 0 : _d.top)
|
|
2302
|
+
);
|
|
2303
|
+
return resultFrame;
|
|
2304
|
+
}
|
|
2198
2305
|
intrinsicContentWidth(constrainingHeight = 0) {
|
|
2306
|
+
const cacheKey = this._getIntrinsicSizeCacheKey(constrainingHeight, 0);
|
|
2307
|
+
const cached = this._getCachedIntrinsicSize(cacheKey);
|
|
2308
|
+
if (cached) {
|
|
2309
|
+
return cached.width;
|
|
2310
|
+
}
|
|
2199
2311
|
if (this.usesVirtualLayoutingForIntrinsicSizing) {
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
frame = view.rectangleInView(
|
|
2211
|
-
frame,
|
|
2212
|
-
this,
|
|
2213
|
-
import_UIObject.YES
|
|
2214
|
-
);
|
|
2215
|
-
}
|
|
2216
|
-
framePoints.push(frame.min);
|
|
2217
|
-
framePoints.push(frame.max);
|
|
2218
|
-
});
|
|
2219
|
-
const resultFrame = import_UIRectangle.UIRectangle.boundingBoxForPoints(framePoints);
|
|
2220
|
-
_UIView.isVirtualLayouting = import_UIObject.NO;
|
|
2312
|
+
this.startVirtualLayout();
|
|
2313
|
+
let resultFrame;
|
|
2314
|
+
try {
|
|
2315
|
+
this.frame = this.frame.rectangleWithHeight(constrainingHeight);
|
|
2316
|
+
this.layoutIfNeeded();
|
|
2317
|
+
resultFrame = this._intrinsicFrameFromSubviewFrames();
|
|
2318
|
+
} finally {
|
|
2319
|
+
this.finishVirtualLayout();
|
|
2320
|
+
}
|
|
2321
|
+
this._setCachedIntrinsicSize(cacheKey, new import_UIRectangle.UIRectangle(0, 0, resultFrame.height, resultFrame.width));
|
|
2221
2322
|
return resultFrame.width;
|
|
2222
2323
|
}
|
|
2223
|
-
|
|
2324
|
+
const size = this.intrinsicContentSizeWithConstraints(constrainingHeight, 0);
|
|
2325
|
+
return size.width;
|
|
2224
2326
|
}
|
|
2225
2327
|
intrinsicContentHeight(constrainingWidth = 0) {
|
|
2328
|
+
const cacheKey = this._getIntrinsicSizeCacheKey(0, constrainingWidth);
|
|
2329
|
+
const cached = this._getCachedIntrinsicSize(cacheKey);
|
|
2330
|
+
if (cached) {
|
|
2331
|
+
return cached.height;
|
|
2332
|
+
}
|
|
2226
2333
|
if (this.usesVirtualLayoutingForIntrinsicSizing) {
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
frame = view.rectangleInView(
|
|
2238
|
-
frame,
|
|
2239
|
-
this,
|
|
2240
|
-
import_UIObject.YES
|
|
2241
|
-
);
|
|
2242
|
-
}
|
|
2243
|
-
framePoints.push(frame.min);
|
|
2244
|
-
framePoints.push(frame.max);
|
|
2245
|
-
});
|
|
2246
|
-
const resultFrame = import_UIRectangle.UIRectangle.boundingBoxForPoints(framePoints);
|
|
2247
|
-
_UIView.isVirtualLayouting = import_UIObject.NO;
|
|
2334
|
+
this.startVirtualLayout();
|
|
2335
|
+
let resultFrame;
|
|
2336
|
+
try {
|
|
2337
|
+
this.frame = this.frame.rectangleWithWidth(constrainingWidth);
|
|
2338
|
+
this.layoutIfNeeded();
|
|
2339
|
+
resultFrame = this._intrinsicFrameFromSubviewFrames();
|
|
2340
|
+
} finally {
|
|
2341
|
+
this.finishVirtualLayout();
|
|
2342
|
+
}
|
|
2343
|
+
this._setCachedIntrinsicSize(cacheKey, new import_UIRectangle.UIRectangle(0, 0, resultFrame.height, resultFrame.width));
|
|
2248
2344
|
return resultFrame.height;
|
|
2249
2345
|
}
|
|
2250
|
-
|
|
2346
|
+
const size = this.intrinsicContentSizeWithConstraints(0, constrainingWidth);
|
|
2347
|
+
if (isNaN(size.height)) {
|
|
2348
|
+
console.error("NaN in intrinsicContentHeight", this);
|
|
2349
|
+
var asd = 1;
|
|
2350
|
+
}
|
|
2351
|
+
return size.height;
|
|
2251
2352
|
}
|
|
2252
2353
|
intrinsicContentSize() {
|
|
2354
|
+
const cacheKey = this._getIntrinsicSizeCacheKey(0, 0);
|
|
2355
|
+
const cached = this._getCachedIntrinsicSize(cacheKey);
|
|
2356
|
+
if (cached) {
|
|
2357
|
+
return cached;
|
|
2358
|
+
}
|
|
2253
2359
|
if (this.usesVirtualLayoutingForIntrinsicSizing) {
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
frame = view.rectangleInView(
|
|
2264
|
-
frame,
|
|
2265
|
-
this,
|
|
2266
|
-
import_UIObject.YES
|
|
2267
|
-
);
|
|
2268
|
-
}
|
|
2269
|
-
framePoints.push(frame.min);
|
|
2270
|
-
framePoints.push(frame.max);
|
|
2271
|
-
});
|
|
2272
|
-
const resultFrame = import_UIRectangle.UIRectangle.boundingBoxForPoints(framePoints);
|
|
2273
|
-
_UIView.isVirtualLayouting = import_UIObject.NO;
|
|
2360
|
+
this.startVirtualLayout();
|
|
2361
|
+
let resultFrame;
|
|
2362
|
+
try {
|
|
2363
|
+
this.layoutIfNeeded();
|
|
2364
|
+
resultFrame = this._intrinsicFrameFromSubviewFrames();
|
|
2365
|
+
} finally {
|
|
2366
|
+
this.finishVirtualLayout();
|
|
2367
|
+
}
|
|
2368
|
+
this._setCachedIntrinsicSize(cacheKey, resultFrame);
|
|
2274
2369
|
return resultFrame;
|
|
2275
2370
|
}
|
|
2276
2371
|
return import_UIObject.nil;
|
|
@@ -2291,7 +2386,7 @@ UIView.resizeObserver = new ResizeObserver((entries, observer) => {
|
|
|
2291
2386
|
UIView._onWindowTouchMove = import_UIObject.nil;
|
|
2292
2387
|
UIView._onWindowMouseMove = import_UIObject.nil;
|
|
2293
2388
|
UIView._onWindowMouseup = import_UIObject.nil;
|
|
2294
|
-
UIView.
|
|
2389
|
+
UIView._virtualLayoutingDepth = 0;
|
|
2295
2390
|
UIView._transformAttribute = ("transform" in document.documentElement.style ? "transform" : void 0) || ("-webkit-transform" in document.documentElement.style ? "-webkit-transform" : "undefined") || ("-moz-transform" in document.documentElement.style ? "-moz-transform" : "undefined") || ("-ms-transform" in document.documentElement.style ? "-ms-transform" : "undefined") || ("-o-transform" in document.documentElement.style ? "-o-transform" : "undefined");
|
|
2296
2391
|
UIView.constraintAttribute = {
|
|
2297
2392
|
"left": AutoLayout.Attribute.LEFT,
|