uicore-ts 1.1.101 → 1.1.102

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.
@@ -1,20 +1,9 @@
1
1
  import { UIColor } from "./UIColor";
2
2
  import { UILocalizedTextObject } from "./UIInterfaces";
3
- import { UIObject } from "./UIObject";
3
+ import { UIObject, ValueOf } from "./UIObject";
4
4
  import { UIRectangle } from "./UIRectangle";
5
- import type { ValueOf } from "./UIObject";
6
5
  import { UIView, UIViewBroadcastEvent } from "./UIView";
7
6
  export declare class UITextView extends UIView {
8
- _textColor: UIColor;
9
- _textAlignment?: ValueOf<typeof UITextView.textAlignment>;
10
- _isSingleLine: boolean;
11
- textPrefix: string;
12
- textSuffix: string;
13
- _notificationAmount: number;
14
- _minFontSize?: number;
15
- _maxFontSize?: number;
16
- _automaticFontSizeSelection: boolean;
17
- changesOften: boolean;
18
7
  static defaultTextColor: UIColor;
19
8
  static notificationTextColor: UIColor;
20
9
  static _intrinsicHeightCache: {
@@ -27,24 +16,8 @@ export declare class UITextView extends UIView {
27
16
  [x: string]: number;
28
17
  };
29
18
  } & UIObject;
30
- _intrinsicHeightCache: {
31
- [x: string]: {
32
- [x: string]: number;
33
- };
34
- } & UIObject;
35
- _intrinsicWidthCache: {
36
- [x: string]: {
37
- [x: string]: number;
38
- };
39
- } & UIObject;
40
19
  static _ptToPx: number;
41
20
  static _pxToPt: number;
42
- _text?: string;
43
- private _useFastMeasurement;
44
- private _cachedMeasurementStyles;
45
- usesVirtualLayoutingForIntrinsicSizing: boolean;
46
- constructor(elementID?: string, textViewType?: string | ValueOf<typeof UITextView.type>, viewHTMLElement?: null);
47
- static _determinePXAndPTRatios(): void;
48
21
  static type: {
49
22
  readonly paragraph: "p";
50
23
  readonly header1: "h1";
@@ -64,6 +37,16 @@ export declare class UITextView extends UIView {
64
37
  readonly right: "right";
65
38
  readonly justify: "justify";
66
39
  };
40
+ constructor(elementID?: string, textViewType?: string | ValueOf<typeof UITextView.type>, viewHTMLElement?: null);
41
+ didReceiveBroadcastEvent(event: UIViewBroadcastEvent): void;
42
+ willMoveToSuperview(superview: UIView): void;
43
+ layoutSubviews(): void;
44
+ private _invalidateMeasurementStyles;
45
+ private _getMeasurementStyles;
46
+ private _parseLineHeight;
47
+ private _shouldUseFastMeasurement;
48
+ setUseFastMeasurement(useFast: boolean): void;
49
+ invalidateMeasurementStrategy(): void;
67
50
  get textAlignment(): ValueOf<typeof UITextView.textAlignment>;
68
51
  set textAlignment(textAlignment: ValueOf<typeof UITextView.textAlignment>);
69
52
  get textColor(): UIColor;
@@ -83,18 +66,45 @@ export declare class UITextView extends UIView {
83
66
  get fontSize(): number;
84
67
  set fontSize(fontSize: number);
85
68
  useAutomaticFontSize(minFontSize?: number, maxFontSize?: number): void;
69
+ /**
70
+ * Get a stable cache key for the font without triggering reflow.
71
+ * Only computes font on first access or when font properties change.
72
+ */
73
+ private _getFontCacheKey;
74
+ /**
75
+ * Invalidate font cache when font properties change
76
+ */
77
+ private _invalidateFontCache;
78
+ static _determinePXAndPTRatios(): void;
86
79
  static automaticallyCalculatedFontSize(bounds: UIRectangle, currentSize: UIRectangle, currentFontSize: number, minFontSize?: number, maxFontSize?: number): number;
87
- didReceiveBroadcastEvent(event: UIViewBroadcastEvent): void;
88
- willMoveToSuperview(superview: UIView): void;
89
- layoutSubviews(): void;
80
+ _text?: string;
81
+ textPrefix: string;
82
+ textSuffix: string;
83
+ _notificationAmount: number;
84
+ _textColor: UIColor;
85
+ _textAlignment?: ValueOf<typeof UITextView.textAlignment>;
86
+ _isSingleLine: boolean;
87
+ _minFontSize?: number;
88
+ _maxFontSize?: number;
89
+ _automaticFontSizeSelection: boolean;
90
+ private _cachedFontKey?;
91
+ private _fontInvalidationTriggers;
92
+ changesOften: boolean;
93
+ _intrinsicHeightCache: {
94
+ [x: string]: {
95
+ [x: string]: number;
96
+ };
97
+ } & UIObject;
98
+ _intrinsicWidthCache: {
99
+ [x: string]: {
100
+ [x: string]: number;
101
+ };
102
+ } & UIObject;
103
+ private _useFastMeasurement;
104
+ private _cachedMeasurementStyles;
105
+ usesVirtualLayoutingForIntrinsicSizing: boolean;
90
106
  intrinsicContentHeight(constrainingWidth?: number): any;
91
107
  intrinsicContentWidth(constrainingHeight?: number): any;
92
- private _invalidateMeasurementStyles;
93
- private _getMeasurementStyles;
94
- private _parseLineHeight;
95
- intrinsicContentSizeWithConstraints(constrainingHeight?: number, constrainingWidth?: number): UIRectangle;
96
- private _shouldUseFastMeasurement;
97
- setUseFastMeasurement(useFast: boolean): void;
98
- invalidateMeasurementStrategy(): void;
99
- intrinsicContentSize(): UIRectangle;
108
+ addStyleClass(styleClass: string): void;
109
+ removeStyleClass(styleClass: string): void;
100
110
  }
@@ -29,12 +29,19 @@ var import_UIView = require("./UIView");
29
29
  const _UITextView = class extends import_UIView.UIView {
30
30
  constructor(elementID, textViewType = _UITextView.type.paragraph, viewHTMLElement = null) {
31
31
  super(elementID, viewHTMLElement, textViewType);
32
- this._textColor = _UITextView.defaultTextColor;
33
- this._isSingleLine = import_UIObject.YES;
34
32
  this.textPrefix = "";
35
33
  this.textSuffix = "";
36
34
  this._notificationAmount = 0;
35
+ this._textColor = _UITextView.defaultTextColor;
36
+ this._isSingleLine = import_UIObject.YES;
37
37
  this._automaticFontSizeSelection = import_UIObject.NO;
38
+ this._fontInvalidationTriggers = {
39
+ fontSize: this.style.fontSize || "",
40
+ fontFamily: this.style.fontFamily || "",
41
+ fontWeight: this.style.fontWeight || "",
42
+ fontStyle: this.style.fontStyle || "",
43
+ styleClasses: this.styleClasses.join(",")
44
+ };
38
45
  this.changesOften = import_UIObject.NO;
39
46
  this._intrinsicHeightCache = new import_UIObject.UIObject();
40
47
  this._intrinsicWidthCache = new import_UIObject.UIObject();
@@ -53,16 +60,84 @@ const _UITextView = class extends import_UIView.UIView {
53
60
  );
54
61
  }
55
62
  }
56
- static _determinePXAndPTRatios() {
57
- if (_UITextView._ptToPx) {
58
- return;
63
+ didReceiveBroadcastEvent(event) {
64
+ super.didReceiveBroadcastEvent(event);
65
+ }
66
+ willMoveToSuperview(superview) {
67
+ super.willMoveToSuperview(superview);
68
+ }
69
+ layoutSubviews() {
70
+ super.layoutSubviews();
71
+ if (this._automaticFontSizeSelection) {
72
+ this.fontSize = _UITextView.automaticallyCalculatedFontSize(
73
+ new import_UIRectangle.UIRectangle(0, 0, 1 * this.viewHTMLElement.offsetHeight, 1 * this.viewHTMLElement.offsetWidth),
74
+ this.intrinsicContentSize(),
75
+ this.fontSize,
76
+ this._minFontSize,
77
+ this._maxFontSize
78
+ );
59
79
  }
60
- const o = document.createElement("div");
61
- o.style.width = "1000pt";
62
- document.body.appendChild(o);
63
- _UITextView._ptToPx = o.clientWidth / 1e3;
64
- document.body.removeChild(o);
65
- _UITextView._pxToPt = 1 / _UITextView._ptToPx;
80
+ }
81
+ _invalidateMeasurementStyles() {
82
+ this._cachedMeasurementStyles = void 0;
83
+ import_UITextMeasurement.UITextMeasurement.invalidateElement(this.viewHTMLElement);
84
+ this._intrinsicSizesCache = {};
85
+ }
86
+ _getMeasurementStyles() {
87
+ if (this._cachedMeasurementStyles) {
88
+ return this._cachedMeasurementStyles;
89
+ }
90
+ const computed = window.getComputedStyle(this.viewHTMLElement);
91
+ const fontSize = parseFloat(computed.fontSize);
92
+ this._cachedMeasurementStyles = {
93
+ font: [
94
+ computed.fontStyle,
95
+ computed.fontVariant,
96
+ computed.fontWeight,
97
+ computed.fontSize,
98
+ computed.fontFamily
99
+ ].join(" "),
100
+ fontSize,
101
+ lineHeight: this._parseLineHeight(computed.lineHeight, fontSize),
102
+ whiteSpace: computed.whiteSpace,
103
+ paddingLeft: parseFloat(computed.paddingLeft) || 0,
104
+ paddingRight: parseFloat(computed.paddingRight) || 0,
105
+ paddingTop: parseFloat(computed.paddingTop) || 0,
106
+ paddingBottom: parseFloat(computed.paddingBottom) || 0
107
+ };
108
+ return this._cachedMeasurementStyles;
109
+ }
110
+ _parseLineHeight(lineHeight, fontSize) {
111
+ if (lineHeight === "normal") {
112
+ return fontSize * 1.2;
113
+ }
114
+ if (lineHeight.endsWith("px")) {
115
+ return parseFloat(lineHeight);
116
+ }
117
+ const numericLineHeight = parseFloat(lineHeight);
118
+ if (!isNaN(numericLineHeight)) {
119
+ return fontSize * numericLineHeight;
120
+ }
121
+ return fontSize * 1.2;
122
+ }
123
+ _shouldUseFastMeasurement() {
124
+ const content = this.text || this.innerHTML;
125
+ if (this._innerHTMLKey || this._localizedTextObject) {
126
+ return false;
127
+ }
128
+ if (this.notificationAmount > 0) {
129
+ return false;
130
+ }
131
+ const hasComplexHTML = /<(?!\/?(b|i|em|strong|span|br)\b)[^>]+>/i.test(content);
132
+ return !hasComplexHTML;
133
+ }
134
+ setUseFastMeasurement(useFast) {
135
+ this._useFastMeasurement = useFast;
136
+ this._intrinsicSizesCache = {};
137
+ }
138
+ invalidateMeasurementStrategy() {
139
+ this._useFastMeasurement = void 0;
140
+ this._invalidateMeasurementStyles();
66
141
  }
67
142
  get textAlignment() {
68
143
  return this.style.textAlign;
@@ -150,6 +225,7 @@ const _UITextView = class extends import_UIView.UIView {
150
225
  this.style.fontSize = "" + fontSize + "pt";
151
226
  this._intrinsicHeightCache = new import_UIObject.UIObject();
152
227
  this._intrinsicWidthCache = new import_UIObject.UIObject();
228
+ this._invalidateFontCache();
153
229
  this._invalidateMeasurementStyles();
154
230
  this.clearIntrinsicSizeCache();
155
231
  }
@@ -160,6 +236,42 @@ const _UITextView = class extends import_UIView.UIView {
160
236
  this._maxFontSize = maxFontSize;
161
237
  this.setNeedsLayout();
162
238
  }
239
+ _getFontCacheKey() {
240
+ const currentTriggers = {
241
+ fontSize: this.style.fontSize || "",
242
+ fontFamily: this.style.fontFamily || "",
243
+ fontWeight: this.style.fontWeight || "",
244
+ fontStyle: this.style.fontStyle || "",
245
+ styleClasses: this.styleClasses.join(",")
246
+ };
247
+ const hasChanged = currentTriggers.fontSize !== this._fontInvalidationTriggers.fontSize || currentTriggers.fontFamily !== this._fontInvalidationTriggers.fontFamily || currentTriggers.fontWeight !== this._fontInvalidationTriggers.fontWeight || currentTriggers.fontStyle !== this._fontInvalidationTriggers.fontStyle || currentTriggers.styleClasses !== this._fontInvalidationTriggers.styleClasses;
248
+ if (!this._cachedFontKey || hasChanged) {
249
+ const computed = this.computedStyle;
250
+ this._cachedFontKey = [
251
+ computed.fontStyle,
252
+ computed.fontVariant,
253
+ computed.fontWeight,
254
+ computed.fontSize,
255
+ computed.fontFamily
256
+ ].join("_").replace(/[.\s]/g, "_");
257
+ this._fontInvalidationTriggers = currentTriggers;
258
+ }
259
+ return this._cachedFontKey;
260
+ }
261
+ _invalidateFontCache() {
262
+ this._cachedFontKey = void 0;
263
+ }
264
+ static _determinePXAndPTRatios() {
265
+ if (_UITextView._ptToPx) {
266
+ return;
267
+ }
268
+ const o = document.createElement("div");
269
+ o.style.width = "1000pt";
270
+ document.body.appendChild(o);
271
+ _UITextView._ptToPx = o.clientWidth / 1e3;
272
+ document.body.removeChild(o);
273
+ _UITextView._pxToPt = 1 / _UITextView._ptToPx;
274
+ }
163
275
  static automaticallyCalculatedFontSize(bounds, currentSize, currentFontSize, minFontSize, maxFontSize) {
164
276
  minFontSize = (0, import_UIObject.FIRST)(minFontSize, 1);
165
277
  maxFontSize = (0, import_UIObject.FIRST)(maxFontSize, 1e11);
@@ -178,29 +290,8 @@ const _UITextView = class extends import_UIView.UIView {
178
290
  }
179
291
  return maxFittingFontSize;
180
292
  }
181
- didReceiveBroadcastEvent(event) {
182
- super.didReceiveBroadcastEvent(event);
183
- }
184
- willMoveToSuperview(superview) {
185
- super.willMoveToSuperview(superview);
186
- }
187
- layoutSubviews() {
188
- super.layoutSubviews();
189
- if (this._automaticFontSizeSelection) {
190
- this.fontSize = _UITextView.automaticallyCalculatedFontSize(
191
- new import_UIRectangle.UIRectangle(0, 0, 1 * this.viewHTMLElement.offsetHeight, 1 * this.viewHTMLElement.offsetWidth),
192
- this.intrinsicContentSize(),
193
- this.fontSize,
194
- this._minFontSize,
195
- this._maxFontSize
196
- );
197
- }
198
- }
199
293
  intrinsicContentHeight(constrainingWidth = 0) {
200
- const keyPath = (this.viewHTMLElement.innerHTML + "_csf_" + this.computedStyle.font).replace(new RegExp(
201
- "\\.",
202
- "g"
203
- ), "_") + "." + ("" + constrainingWidth).replace(new RegExp("\\.", "g"), "_");
294
+ const keyPath = this.viewHTMLElement.innerHTML + "_csf_" + this._getFontCacheKey() + "." + ("" + constrainingWidth).replace(new RegExp("\\.", "g"), "_");
204
295
  let cacheObject = _UITextView._intrinsicHeightCache;
205
296
  if (this.changesOften) {
206
297
  cacheObject = this._intrinsicHeightCache;
@@ -211,18 +302,13 @@ const _UITextView = class extends import_UIView.UIView {
211
302
  cacheObject.setValueForKeyPath(keyPath, result);
212
303
  }
213
304
  if (isNaN(result) || !result && !this.text) {
214
- var asd = 1;
215
305
  result = super.intrinsicContentHeight(constrainingWidth);
216
306
  cacheObject.setValueForKeyPath(keyPath, result);
217
- var asdasd = 1;
218
307
  }
219
308
  return result;
220
309
  }
221
310
  intrinsicContentWidth(constrainingHeight = 0) {
222
- const keyPath = (this.viewHTMLElement.innerHTML + "_csf_" + this.computedStyle.font).replace(new RegExp(
223
- "\\.",
224
- "g"
225
- ), "_") + "." + ("" + constrainingHeight).replace(new RegExp("\\.", "g"), "_");
311
+ const keyPath = this.viewHTMLElement.innerHTML + "_csf_" + this._getFontCacheKey() + "." + ("" + constrainingHeight).replace(new RegExp("\\.", "g"), "_");
226
312
  let cacheObject = _UITextView._intrinsicWidthCache;
227
313
  if (this.changesOften) {
228
314
  cacheObject = this._intrinsicWidthCache;
@@ -234,99 +320,13 @@ const _UITextView = class extends import_UIView.UIView {
234
320
  }
235
321
  return result;
236
322
  }
237
- _invalidateMeasurementStyles() {
238
- this._cachedMeasurementStyles = void 0;
239
- import_UITextMeasurement.UITextMeasurement.invalidateElement(this.viewHTMLElement);
240
- this._intrinsicSizesCache = {};
241
- }
242
- _getMeasurementStyles() {
243
- if (this._cachedMeasurementStyles) {
244
- return this._cachedMeasurementStyles;
245
- }
246
- const computed = window.getComputedStyle(this.viewHTMLElement);
247
- const fontSize = parseFloat(computed.fontSize);
248
- this._cachedMeasurementStyles = {
249
- font: [
250
- computed.fontStyle,
251
- computed.fontVariant,
252
- computed.fontWeight,
253
- computed.fontSize,
254
- computed.fontFamily
255
- ].join(" "),
256
- fontSize,
257
- lineHeight: this._parseLineHeight(computed.lineHeight, fontSize),
258
- whiteSpace: computed.whiteSpace,
259
- paddingLeft: parseFloat(computed.paddingLeft) || 0,
260
- paddingRight: parseFloat(computed.paddingRight) || 0,
261
- paddingTop: parseFloat(computed.paddingTop) || 0,
262
- paddingBottom: parseFloat(computed.paddingBottom) || 0
263
- };
264
- return this._cachedMeasurementStyles;
265
- }
266
- _parseLineHeight(lineHeight, fontSize) {
267
- if (lineHeight === "normal") {
268
- return fontSize * 1.2;
269
- }
270
- if (lineHeight.endsWith("px")) {
271
- return parseFloat(lineHeight);
272
- }
273
- const numericLineHeight = parseFloat(lineHeight);
274
- if (!isNaN(numericLineHeight)) {
275
- return fontSize * numericLineHeight;
276
- }
277
- return fontSize * 1.2;
278
- }
279
- intrinsicContentSizeWithConstraints(constrainingHeight = 0, constrainingWidth = 0) {
280
- var _a;
281
- const cacheKey = "h_" + constrainingHeight + "__w_" + constrainingWidth;
282
- const cachedResult = this._intrinsicSizesCache[cacheKey];
283
- if (cachedResult) {
284
- return cachedResult;
285
- }
286
- const shouldUseFastPath = (_a = this._useFastMeasurement) != null ? _a : this._shouldUseFastMeasurement();
287
- let result;
288
- if (shouldUseFastPath) {
289
- const styles = this._getMeasurementStyles();
290
- const size = import_UITextMeasurement.UITextMeasurement.calculateTextSize(
291
- this.viewHTMLElement,
292
- this.text || this.innerHTML,
293
- constrainingWidth || void 0,
294
- constrainingHeight || void 0,
295
- styles
296
- );
297
- result = new import_UIRectangle.UIRectangle(0, 0, size.height, size.width);
298
- } else {
299
- result = super.intrinsicContentSizeWithConstraints(constrainingHeight, constrainingWidth);
300
- }
301
- if (isNaN(result.height) || isNaN(result.width)) {
302
- var asd = 1;
303
- result = super.intrinsicContentSizeWithConstraints(constrainingHeight, constrainingWidth);
304
- }
305
- this._intrinsicSizesCache[cacheKey] = result.copy();
306
- return result;
307
- }
308
- _shouldUseFastMeasurement() {
309
- const content = this.text || this.innerHTML;
310
- if (this._innerHTMLKey || this._localizedTextObject) {
311
- return false;
312
- }
313
- if (this.notificationAmount > 0) {
314
- return false;
315
- }
316
- const hasComplexHTML = /<(?!\/?(b|i|em|strong|span|br)\b)[^>]+>/i.test(content);
317
- return !hasComplexHTML;
318
- }
319
- setUseFastMeasurement(useFast) {
320
- this._useFastMeasurement = useFast;
321
- this._intrinsicSizesCache = {};
322
- }
323
- invalidateMeasurementStrategy() {
324
- this._useFastMeasurement = void 0;
325
- this._invalidateMeasurementStyles();
323
+ addStyleClass(styleClass) {
324
+ super.addStyleClass(styleClass);
325
+ this._invalidateFontCache();
326
326
  }
327
- intrinsicContentSize() {
328
- const result = this.intrinsicContentSizeWithConstraints(import_UIObject.nil, import_UIObject.nil);
329
- return result;
327
+ removeStyleClass(styleClass) {
328
+ super.removeStyleClass(styleClass);
329
+ this._invalidateFontCache();
330
330
  }
331
331
  };
332
332
  let UITextView = _UITextView;
@@ -353,7 +353,6 @@ UITextView.textAlignment = {
353
353
  "right": "right",
354
354
  "justify": "justify"
355
355
  };
356
- UITextView._determinePXAndPTRatios();
357
356
  // Annotate the CommonJS export names for ESM import in node:
358
357
  0 && (module.exports = {
359
358
  UITextView
@@ -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 // 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\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,EAyCnC,YACI,WACA,eAAyD,YAAW,KAAK,WACzE,kBAAkB,MACpB;AAEE,UAAM,WAAW,iBAAiB,YAAY;AA5ClD,sBAAsB,YAAW;AAGjC,yBAAgB;AAEhB,sBAAa;AACb,sBAAa;AAEb,+BAAsB;AAKtB,uCAA8B;AAE9B,wBAAe;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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;",
4
+ "sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UILocalizedTextObject } from \"./UIInterfaces\"\nimport { FIRST, IS_LIKE_NULL, nil, NO, UIObject, ValueOf, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { TextMeasurementStyle, UITextMeasurement } from \"./UITextMeasurement\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UITextView extends UIView {\n \n //#region Static Properties\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 static _ptToPx: number\n static _pxToPt: number\n \n static type = {\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 } as const\n \n static textAlignment = {\n \"left\": \"left\",\n \"center\": \"center\",\n \"right\": \"right\",\n \"justify\": \"justify\"\n } as const\n \n //#endregion\n \n //#region Constructor\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 if (textViewType == UITextView.type.textArea) {\n this.pausesPointerEvents = YES\n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n }\n }\n \n //#endregion\n \n //#region Lifecycle Methods\n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n super.didReceiveBroadcastEvent(event)\n }\n \n override willMoveToSuperview(superview: UIView) {\n super.willMoveToSuperview(superview)\n }\n \n override layoutSubviews() {\n super.layoutSubviews()\n \n if (this._automaticFontSizeSelection) {\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 //#endregion\n \n //#region Measurement & Sizing - Private Methods\n \n private _invalidateMeasurementStyles(): void {\n this._cachedMeasurementStyles = undefined\n UITextMeasurement.invalidateElement(this.viewHTMLElement)\n this._intrinsicSizesCache = {}\n }\n \n private _getMeasurementStyles(): TextMeasurementStyle {\n if (this._cachedMeasurementStyles) {\n return this._cachedMeasurementStyles\n }\n \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 private _shouldUseFastMeasurement(): boolean {\n const content = this.text || this.innerHTML\n \n if (this._innerHTMLKey || this._localizedTextObject) {\n return false\n }\n \n if (this.notificationAmount > 0) {\n return false\n }\n \n const hasComplexHTML = /<(?!\\/?(b|i|em|strong|span|br)\\b)[^>]+>/i.test(content)\n \n return !hasComplexHTML\n }\n \n //#endregion\n \n //#region Measurement & Sizing - Public Methods\n \n setUseFastMeasurement(useFast: boolean): void {\n this._useFastMeasurement = useFast\n this._intrinsicSizesCache = {}\n }\n \n invalidateMeasurementStrategy(): void {\n this._useFastMeasurement = undefined\n this._invalidateMeasurementStyles()\n }\n \n //#endregion\n \n //#region Getters & Setters - Text Alignment\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 //#endregion\n \n //#region Getters & Setters - Text Color\n \n get textColor() {\n return this._textColor\n }\n \n set textColor(color: UIColor) {\n this._textColor = color || UITextView.defaultTextColor\n this.style.color = this._textColor.stringValue\n }\n \n //#endregion\n \n //#region Getters & Setters - Single Line\n \n get isSingleLine() {\n return this._isSingleLine\n }\n \n set isSingleLine(isSingleLine: boolean) {\n this._isSingleLine = isSingleLine\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n if (isSingleLine) {\n this.style.whiteSpace = \"pre\"\n return\n }\n \n this.style.whiteSpace = \"pre-wrap\"\n this.invalidateMeasurementStrategy()\n }\n \n //#endregion\n \n //#region Getters & Setters - Notification Amount\n \n get notificationAmount() {\n return this._notificationAmount\n }\n \n set notificationAmount(notificationAmount: number) {\n if (this._notificationAmount == notificationAmount) {\n return\n }\n \n this._notificationAmount = notificationAmount\n this.text = this.text\n this.setNeedsLayoutUpToRootView()\n this.notificationAmountDidChange(notificationAmount)\n }\n \n notificationAmountDidChange(notificationAmount: number) {\n }\n \n //#endregion\n \n //#region Getters & Setters - Text Content\n \n get text() {\n return (this._text || this.viewHTMLElement.innerHTML)\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 \n this._useFastMeasurement = undefined\n this._intrinsicSizesCache = {}\n this.invalidateMeasurementStrategy()\n this._invalidateMeasurementStyles()\n this.clearIntrinsicSizeCache()\n \n this.setNeedsLayout()\n }\n \n override set innerHTML(innerHTML: string) {\n this.text = innerHTML\n this.invalidateMeasurementStrategy()\n }\n \n override get innerHTML() {\n return this.viewHTMLElement.innerHTML\n }\n \n setText(key: string, defaultString: string, parameters?: { [x: string]: string | UILocalizedTextObject }) {\n this.setInnerHTML(key, defaultString, parameters)\n this.invalidateMeasurementStrategy()\n }\n \n //#endregion\n \n //#region Getters & Setters - Font Size\n \n get fontSize() {\n const style = this.style.fontSize || window.getComputedStyle(this.viewHTMLElement, null).fontSize\n const result = (parseFloat(style) * UITextView._pxToPt)\n return result\n }\n \n set fontSize(fontSize: number) {\n if (fontSize != this.fontSize) {\n this.style.fontSize = \"\" + fontSize + \"pt\"\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n this._invalidateFontCache()\n this._invalidateMeasurementStyles()\n this.clearIntrinsicSizeCache()\n }\n }\n \n useAutomaticFontSize(minFontSize: number = nil, maxFontSize: number = nil) {\n this._automaticFontSizeSelection = YES\n this._minFontSize = minFontSize\n this._maxFontSize = maxFontSize\n this.setNeedsLayout()\n }\n \n //#endregion\n \n //#region Font Caching - Private Methods\n \n /**\n * Get a stable cache key for the font without triggering reflow.\n * Only computes font on first access or when font properties change.\n */\n private _getFontCacheKey(): string {\n // Check if font-related properties have changed\n const currentTriggers = {\n fontSize: this.style.fontSize || \"\",\n fontFamily: this.style.fontFamily || \"\",\n fontWeight: this.style.fontWeight || \"\",\n fontStyle: this.style.fontStyle || \"\",\n styleClasses: this.styleClasses.join(\",\")\n }\n \n const hasChanged =\n currentTriggers.fontSize !== this._fontInvalidationTriggers.fontSize ||\n currentTriggers.fontFamily !== this._fontInvalidationTriggers.fontFamily ||\n currentTriggers.fontWeight !== this._fontInvalidationTriggers.fontWeight ||\n currentTriggers.fontStyle !== this._fontInvalidationTriggers.fontStyle ||\n currentTriggers.styleClasses !== this._fontInvalidationTriggers.styleClasses\n \n if (!this._cachedFontKey || hasChanged) {\n // Only access computedStyle when we know something changed\n const computed = this.computedStyle\n this._cachedFontKey = [\n computed.fontStyle,\n computed.fontVariant,\n computed.fontWeight,\n computed.fontSize,\n computed.fontFamily\n ].join(\"_\").replace(/[.\\s]/g, \"_\")\n \n this._fontInvalidationTriggers = currentTriggers\n }\n \n return this._cachedFontKey\n }\n \n /**\n * Invalidate font cache when font properties change\n */\n private _invalidateFontCache(): void {\n this._cachedFontKey = undefined\n }\n \n //#endregion\n \n //#region Static Methods\n \n static _determinePXAndPTRatios() {\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 static automaticallyCalculatedFontSize(\n bounds: UIRectangle,\n currentSize: UIRectangle,\n currentFontSize: number,\n minFontSize?: number,\n maxFontSize?: number\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 //#endregion\n \n //#region Instance Properties - Text Content\n \n _text?: string\n textPrefix = \"\"\n textSuffix = \"\"\n _notificationAmount = 0\n \n //#endregion\n \n //#region Instance Properties - Styling\n \n _textColor: UIColor = UITextView.defaultTextColor\n _textAlignment?: ValueOf<typeof UITextView.textAlignment>\n _isSingleLine = YES\n \n //#endregion\n \n //#region Instance Properties - Font & Sizing\n \n _minFontSize?: number\n _maxFontSize?: number\n _automaticFontSizeSelection = NO\n \n // Cache for the computed font string\n private _cachedFontKey?: string\n private _fontInvalidationTriggers = {\n fontSize: this.style.fontSize || \"\",\n fontFamily: this.style.fontFamily || \"\",\n fontWeight: this.style.fontWeight || \"\",\n fontStyle: this.style.fontStyle || \"\",\n styleClasses: this.styleClasses.join(\",\")\n }\n \n //#endregion\n \n //#region Instance Properties - Caching & Performance\n \n changesOften = NO\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 private _useFastMeasurement: boolean | undefined\n private _cachedMeasurementStyles: TextMeasurementStyle | undefined\n \n override usesVirtualLayoutingForIntrinsicSizing = NO\n \n //#endregion\n \n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this._getFontCacheKey()) + \".\" +\n (\"\" + constrainingWidth).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicHeightCache\n \n if (this.changesOften) {\n cacheObject = this._intrinsicHeightCache\n }\n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n if (IS_LIKE_NULL(result)) {\n result = super.intrinsicContentHeight(constrainingWidth)\n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n if (isNaN(result) || (!result && !this.text)) {\n result = super.intrinsicContentHeight(constrainingWidth)\n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n return result\n }\n \n override intrinsicContentWidth(constrainingHeight = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this._getFontCacheKey()) + \".\" +\n (\"\" + constrainingHeight).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicWidthCache\n \n if (this.changesOften) {\n cacheObject = this._intrinsicWidthCache\n }\n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n if (IS_LIKE_NULL(result)) {\n result = super.intrinsicContentWidth(constrainingHeight)\n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n return result\n }\n \n \n // Override addStyleClass to invalidate font cache\n override addStyleClass(styleClass: string) {\n super.addStyleClass(styleClass)\n this._invalidateFontCache()\n }\n \n // Override removeStyleClass to invalidate font cache\n override removeStyleClass(styleClass: string) {\n super.removeStyleClass(styleClass)\n this._invalidateFontCache()\n }\n \n \n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;A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AAG,GAAG;AAEjE,QAAI,cAAc,YAAW;AAE7B,QAAI,KAAK,cAAc;AACnB,oBAAc,KAAK;AAAA,IACvB;AAEA,QAAI,SAAS,YAAY,gBAAgB,OAAO;AAEhD,YAAI,8BAAa,MAAM,GAAG;AACtB,eAAS,MAAM,sBAAsB,kBAAkB;AACvD,kBAAY,mBAAmB,SAAS,MAAM;AAAA,IAClD;AAEA,WAAO;AAAA,EACX;AAAA,EAIS,cAAc,YAAoB;AACvC,UAAM,cAAc,UAAU;AAC9B,SAAK,qBAAqB;AAAA,EAC9B;AAAA,EAGS,iBAAiB,YAAoB;AAC1C,UAAM,iBAAiB,UAAU;AACjC,SAAK,qBAAqB;AAAA,EAC9B;AAGJ;AA1hBO,IAAM,aAAN;AAAM,WAIF,mBAAmB,uBAAQ;AAJzB,WAKF,wBAAwB,uBAAQ;AAL9B,WAQF,wBAA+E,IAAI,yBAAS;AAR1F,WASF,uBAA8E,IAAI,yBAAS;AATzF,WAcF,OAAO;AAAA,EACV,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;AACb;AA1BS,WA4BF,gBAAgB;AAAA,EACnB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AACf;",
6
6
  "names": []
7
7
  }
@@ -84,6 +84,7 @@ export declare class UIView extends UIObject {
84
84
  _frame?: UIRectangle & {
85
85
  zIndex?: number;
86
86
  };
87
+ _frameCache?: UIRectangle;
87
88
  _backgroundColor: UIColor;
88
89
  _viewHTMLElement: HTMLElement & LooseObject;
89
90
  _innerHTMLKey?: string;
@@ -152,8 +153,27 @@ export declare class UIView extends UIObject {
152
153
  };
153
154
  constructor(elementID?: string, viewHTMLElement?: HTMLElement & LooseObject | null, elementType?: string | null, initViewData?: any);
154
155
  static get nextIndex(): number;
155
- static get pageHeight(): number;
156
+ private static _cachedPageWidth;
157
+ private static _cachedPageHeight;
158
+ private static _pageDimensionsCacheValid;
159
+ private static _resizeObserverInitialized;
160
+ /**
161
+ * Initialize resize observer to invalidate cache when page dimensions change.
162
+ * This is called lazily on first access.
163
+ */
164
+ private static _initializePageDimensionsCacheIfNeeded;
165
+ /**
166
+ * Compute and cache page dimensions.
167
+ * Only triggers reflow when cache is invalid.
168
+ */
169
+ private static _updatePageDimensionsCacheIfNeeded;
156
170
  static get pageWidth(): number;
171
+ static get pageHeight(): number;
172
+ /**
173
+ * Manually invalidate the page dimensions cache.
174
+ * Useful if you know dimensions changed and want to force a recalculation.
175
+ */
176
+ static invalidatePageDimensionsCache(): void;
157
177
  centerInContainer(): void;
158
178
  centerXInContainer(): void;
159
179
  centerYInContainer(): void;