uicore-ts 1.1.141 → 1.1.145
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/UIObject.d.ts +1 -1
- package/compiledScripts/UIObject.js.map +1 -1
- package/compiledScripts/UITableView.d.ts +1 -0
- package/compiledScripts/UITableView.js +28 -6
- package/compiledScripts/UITableView.js.map +2 -2
- package/compiledScripts/UITextField.js +10 -10
- package/compiledScripts/UITextField.js.map +2 -2
- package/compiledScripts/UITextView.d.ts +25 -5
- package/compiledScripts/UITextView.js +157 -57
- package/compiledScripts/UITextView.js.map +2 -2
- package/compiledScripts/UIView.d.ts +4 -4
- package/compiledScripts/UIView.js +2 -1
- package/compiledScripts/UIView.js.map +2 -2
- package/package.json +1 -1
- package/scripts/UIObject.ts +1 -1
- package/scripts/UITableView.ts +31 -6
- package/scripts/UITextField.ts +16 -72
- package/scripts/UITextView.ts +253 -81
- package/scripts/UIView.ts +9 -6
|
@@ -28,7 +28,9 @@ var import_UITextMeasurement = require("./UITextMeasurement");
|
|
|
28
28
|
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
|
+
const innerElementID = elementID ? `${elementID}_textElement` : void 0;
|
|
32
|
+
const _textElementView = new import_UIView.UIView(innerElementID, null, textViewType);
|
|
33
|
+
super(elementID, viewHTMLElement, "span", { _textElementView });
|
|
32
34
|
this.textPrefix = "";
|
|
33
35
|
this.textSuffix = "";
|
|
34
36
|
this._notificationAmount = 0;
|
|
@@ -36,33 +38,42 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
36
38
|
this._isSingleLine = import_UIObject.YES;
|
|
37
39
|
this._automaticFontSizeSelection = import_UIObject.NO;
|
|
38
40
|
this._fontInvalidationTriggers = {
|
|
39
|
-
fontSize:
|
|
40
|
-
fontFamily:
|
|
41
|
-
fontWeight:
|
|
42
|
-
fontStyle:
|
|
43
|
-
styleClasses:
|
|
41
|
+
fontSize: "",
|
|
42
|
+
fontFamily: "",
|
|
43
|
+
fontWeight: "",
|
|
44
|
+
fontStyle: "",
|
|
45
|
+
styleClasses: ""
|
|
44
46
|
};
|
|
45
47
|
this.changesOften = import_UIObject.NO;
|
|
46
48
|
this._intrinsicHeightCache = new import_UIObject.UIObject();
|
|
47
49
|
this._intrinsicWidthCache = new import_UIObject.UIObject();
|
|
48
50
|
this.usesVirtualLayoutingForIntrinsicSizing = import_UIObject.NO;
|
|
51
|
+
this.configureWithObject({
|
|
52
|
+
viewHTMLElement: {
|
|
53
|
+
style: {
|
|
54
|
+
display: "flex",
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
overflow: "hidden"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
49
60
|
this.text = "";
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
61
|
+
this._textElementView = _textElementView;
|
|
62
|
+
this._textElementView.configureWithObject({
|
|
63
|
+
style: {
|
|
64
|
+
position: "relative",
|
|
65
|
+
overflow: "hidden",
|
|
66
|
+
textOverflow: "ellipsis",
|
|
67
|
+
width: "100%",
|
|
68
|
+
margin: "0",
|
|
69
|
+
padding: "0"
|
|
70
|
+
},
|
|
71
|
+
sendControlEventForKey: (0, import_UIObject.EXTEND)(this.sendControlEventForKey.bind(this))
|
|
72
|
+
});
|
|
73
|
+
this.addSubview(this._textElementView);
|
|
52
74
|
this.isSingleLine = import_UIObject.YES;
|
|
53
75
|
this.textColor = this.textColor;
|
|
54
76
|
this.userInteractionEnabled = import_UIObject.YES;
|
|
55
|
-
this.configureWithObject({
|
|
56
|
-
style: {
|
|
57
|
-
display: "flex",
|
|
58
|
-
flexDirection: "column",
|
|
59
|
-
justifyContent: "safe center",
|
|
60
|
-
alignItems: "flex-start",
|
|
61
|
-
whiteSpace: "normal",
|
|
62
|
-
wordWrap: "break-word",
|
|
63
|
-
overflowWrap: "break-word"
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
77
|
if (textViewType == _UITextView.type.textArea) {
|
|
67
78
|
this.pausesPointerEvents = import_UIObject.YES;
|
|
68
79
|
this.addTargetForControlEvent(
|
|
@@ -71,6 +82,18 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
71
82
|
);
|
|
72
83
|
}
|
|
73
84
|
}
|
|
85
|
+
get textElementView() {
|
|
86
|
+
return this._textElementView;
|
|
87
|
+
}
|
|
88
|
+
get containerStyle() {
|
|
89
|
+
return this.viewHTMLElement.style;
|
|
90
|
+
}
|
|
91
|
+
get styleClasses() {
|
|
92
|
+
return this._textElementView.styleClasses;
|
|
93
|
+
}
|
|
94
|
+
set styleClasses(styleClasses) {
|
|
95
|
+
this._textElementView.styleClasses = styleClasses;
|
|
96
|
+
}
|
|
74
97
|
didReceiveBroadcastEvent(event) {
|
|
75
98
|
super.didReceiveBroadcastEvent(event);
|
|
76
99
|
}
|
|
@@ -81,7 +104,12 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
81
104
|
super.layoutSubviews();
|
|
82
105
|
if (this._automaticFontSizeSelection) {
|
|
83
106
|
this.fontSize = _UITextView.automaticallyCalculatedFontSize(
|
|
84
|
-
new import_UIRectangle.UIRectangle(
|
|
107
|
+
new import_UIRectangle.UIRectangle(
|
|
108
|
+
0,
|
|
109
|
+
0,
|
|
110
|
+
this.textElementView.viewHTMLElement.offsetHeight,
|
|
111
|
+
this.textElementView.viewHTMLElement.offsetWidth
|
|
112
|
+
),
|
|
85
113
|
this.intrinsicContentSize(),
|
|
86
114
|
this.fontSize,
|
|
87
115
|
this._minFontSize,
|
|
@@ -91,18 +119,18 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
91
119
|
}
|
|
92
120
|
_invalidateMeasurementStyles() {
|
|
93
121
|
this._cachedMeasurementStyles = void 0;
|
|
94
|
-
import_UITextMeasurement.UITextMeasurement.invalidateElement(this.viewHTMLElement);
|
|
122
|
+
import_UITextMeasurement.UITextMeasurement.invalidateElement(this.textElementView.viewHTMLElement);
|
|
95
123
|
this._intrinsicSizesCache = {};
|
|
96
124
|
}
|
|
97
125
|
_getMeasurementStyles() {
|
|
98
126
|
if (this._cachedMeasurementStyles) {
|
|
99
127
|
return this._cachedMeasurementStyles;
|
|
100
128
|
}
|
|
101
|
-
if (!this.viewHTMLElement.isConnected) {
|
|
129
|
+
if (!this.textElementView.viewHTMLElement.isConnected) {
|
|
102
130
|
return null;
|
|
103
131
|
}
|
|
104
|
-
this.viewHTMLElement.offsetHeight;
|
|
105
|
-
const computed = window.getComputedStyle(this.viewHTMLElement);
|
|
132
|
+
this.textElementView.viewHTMLElement.offsetHeight;
|
|
133
|
+
const computed = window.getComputedStyle(this.textElementView.viewHTMLElement);
|
|
106
134
|
const fontSizeStr = computed.fontSize;
|
|
107
135
|
const fontSize = parseFloat(fontSizeStr);
|
|
108
136
|
if (!fontSize || isNaN(fontSize)) {
|
|
@@ -145,7 +173,7 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
145
173
|
return fontSize * 1.2;
|
|
146
174
|
}
|
|
147
175
|
_shouldUseFastMeasurement() {
|
|
148
|
-
const content = this.text || this.innerHTML;
|
|
176
|
+
const content = this.text || this.textElementView.innerHTML;
|
|
149
177
|
if (this._innerHTMLKey || this._localizedTextObject) {
|
|
150
178
|
return false;
|
|
151
179
|
}
|
|
@@ -164,17 +192,18 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
164
192
|
this._invalidateMeasurementStyles();
|
|
165
193
|
}
|
|
166
194
|
get textAlignment() {
|
|
167
|
-
return this.style.
|
|
195
|
+
return this._textElementView.style.textAlign;
|
|
168
196
|
}
|
|
169
197
|
set textAlignment(textAlignment) {
|
|
170
|
-
this.
|
|
198
|
+
this._textAlignment = textAlignment;
|
|
199
|
+
this._textElementView.style.textAlign = textAlignment;
|
|
171
200
|
}
|
|
172
201
|
get textColor() {
|
|
173
202
|
return this._textColor;
|
|
174
203
|
}
|
|
175
204
|
set textColor(color) {
|
|
176
205
|
this._textColor = color || _UITextView.defaultTextColor;
|
|
177
|
-
this.style.color = this._textColor.stringValue;
|
|
206
|
+
this._textElementView.style.color = this._textColor.stringValue;
|
|
178
207
|
}
|
|
179
208
|
get isSingleLine() {
|
|
180
209
|
return this._isSingleLine;
|
|
@@ -184,10 +213,17 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
184
213
|
this._intrinsicHeightCache = new import_UIObject.UIObject();
|
|
185
214
|
this._intrinsicWidthCache = new import_UIObject.UIObject();
|
|
186
215
|
if (isSingleLine) {
|
|
187
|
-
this.style.whiteSpace = "
|
|
216
|
+
this._textElementView.style.whiteSpace = "nowrap";
|
|
217
|
+
this._textElementView.style.textOverflow = "ellipsis";
|
|
218
|
+
this._textElementView.style.display = "";
|
|
219
|
+
this._textElementView.style.webkitLineClamp = "";
|
|
220
|
+
this._textElementView.style.webkitBoxOrient = "";
|
|
188
221
|
return;
|
|
189
222
|
}
|
|
190
|
-
this.style.whiteSpace = "
|
|
223
|
+
this._textElementView.style.whiteSpace = "normal";
|
|
224
|
+
this._textElementView.style.textOverflow = "ellipsis";
|
|
225
|
+
this._textElementView.style.display = "-webkit-box";
|
|
226
|
+
this._textElementView.style.webkitBoxOrient = "vertical";
|
|
191
227
|
this.invalidateMeasurementStrategy();
|
|
192
228
|
}
|
|
193
229
|
get notificationAmount() {
|
|
@@ -205,7 +241,7 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
205
241
|
notificationAmountDidChange(notificationAmount) {
|
|
206
242
|
}
|
|
207
243
|
get text() {
|
|
208
|
-
return this._text || this.viewHTMLElement.innerHTML;
|
|
244
|
+
return this._text || this.textElementView.viewHTMLElement.innerHTML;
|
|
209
245
|
}
|
|
210
246
|
set text(text) {
|
|
211
247
|
this._text = text;
|
|
@@ -213,8 +249,11 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
213
249
|
if (this.notificationAmount) {
|
|
214
250
|
notificationText = '<span style="color: ' + _UITextView.notificationTextColor.stringValue + ';">' + (" (" + this.notificationAmount + ")").bold() + "</span>";
|
|
215
251
|
}
|
|
216
|
-
if (this.viewHTMLElement.innerHTML != this.textPrefix + text + this.textSuffix + notificationText) {
|
|
217
|
-
this.viewHTMLElement.innerHTML = this.textPrefix + (0, import_UIObject.FIRST)(
|
|
252
|
+
if (this.textElementView.viewHTMLElement.innerHTML != this.textPrefix + text + this.textSuffix + notificationText) {
|
|
253
|
+
this.textElementView.viewHTMLElement.innerHTML = this.textPrefix + (0, import_UIObject.FIRST)(
|
|
254
|
+
text,
|
|
255
|
+
""
|
|
256
|
+
) + this.textSuffix + notificationText;
|
|
218
257
|
}
|
|
219
258
|
if (this.changesOften) {
|
|
220
259
|
this._intrinsicHeightCache = new import_UIObject.UIObject();
|
|
@@ -235,17 +274,17 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
235
274
|
return this.viewHTMLElement.innerHTML;
|
|
236
275
|
}
|
|
237
276
|
setText(key, defaultString, parameters) {
|
|
238
|
-
this.setInnerHTML(key, defaultString, parameters);
|
|
277
|
+
this.textElementView.setInnerHTML(key, defaultString, parameters);
|
|
239
278
|
this.invalidateMeasurementStrategy();
|
|
240
279
|
}
|
|
241
280
|
get fontSize() {
|
|
242
|
-
const style = this.style.fontSize || window.getComputedStyle(this.viewHTMLElement, null).fontSize;
|
|
281
|
+
const style = this._textElementView.style.fontSize || window.getComputedStyle(this._textElementView.viewHTMLElement, null).fontSize;
|
|
243
282
|
const result = parseFloat(style) * _UITextView._pxToPt;
|
|
244
283
|
return result;
|
|
245
284
|
}
|
|
246
285
|
set fontSize(fontSize) {
|
|
247
286
|
if (fontSize != this.fontSize) {
|
|
248
|
-
this.style.fontSize = "" + fontSize + "pt";
|
|
287
|
+
this._textElementView.style.fontSize = "" + fontSize + "pt";
|
|
249
288
|
this._intrinsicHeightCache = new import_UIObject.UIObject();
|
|
250
289
|
this._intrinsicWidthCache = new import_UIObject.UIObject();
|
|
251
290
|
this._invalidateFontCache();
|
|
@@ -261,15 +300,15 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
261
300
|
}
|
|
262
301
|
_getFontCacheKey() {
|
|
263
302
|
const currentTriggers = {
|
|
264
|
-
fontSize: this.style.fontSize || "",
|
|
265
|
-
fontFamily: this.style.fontFamily || "",
|
|
266
|
-
fontWeight: this.style.fontWeight || "",
|
|
267
|
-
fontStyle: this.style.fontStyle || "",
|
|
303
|
+
fontSize: this._textElementView.style.fontSize || "",
|
|
304
|
+
fontFamily: this._textElementView.style.fontFamily || "",
|
|
305
|
+
fontWeight: this._textElementView.style.fontWeight || "",
|
|
306
|
+
fontStyle: this._textElementView.style.fontStyle || "",
|
|
268
307
|
styleClasses: this.styleClasses.join(",")
|
|
269
308
|
};
|
|
270
309
|
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;
|
|
271
310
|
if (!this._cachedFontKey || hasChanged) {
|
|
272
|
-
const computed = this.computedStyle;
|
|
311
|
+
const computed = this._textElementView.computedStyle;
|
|
273
312
|
this._cachedFontKey = [
|
|
274
313
|
computed.fontStyle,
|
|
275
314
|
computed.fontVariant,
|
|
@@ -313,9 +352,23 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
313
352
|
}
|
|
314
353
|
return maxFittingFontSize;
|
|
315
354
|
}
|
|
355
|
+
addStyleClass(styleClass) {
|
|
356
|
+
super.addStyleClass(styleClass);
|
|
357
|
+
this._invalidateFontCache();
|
|
358
|
+
}
|
|
359
|
+
removeStyleClass(styleClass) {
|
|
360
|
+
super.removeStyleClass(styleClass);
|
|
361
|
+
this._invalidateFontCache();
|
|
362
|
+
}
|
|
363
|
+
focus() {
|
|
364
|
+
this._textElementView.focus();
|
|
365
|
+
}
|
|
366
|
+
blur() {
|
|
367
|
+
this._textElementView.blur();
|
|
368
|
+
}
|
|
316
369
|
intrinsicContentHeight(constrainingWidth = 0) {
|
|
317
370
|
var _a;
|
|
318
|
-
const keyPath = (this.viewHTMLElement.innerHTML || this.text) + "_csf_" + this._getFontCacheKey() + "." + ("" + constrainingWidth).replace(new RegExp("\\.", "g"), "_");
|
|
371
|
+
const keyPath = (this.textElementView.viewHTMLElement.innerHTML || this.text) + "_csf_" + this._getFontCacheKey() + "." + ("" + constrainingWidth).replace(new RegExp("\\.", "g"), "_");
|
|
319
372
|
let cacheObject = _UITextView._intrinsicHeightCache;
|
|
320
373
|
if (this.changesOften) {
|
|
321
374
|
cacheObject = this._intrinsicHeightCache;
|
|
@@ -327,8 +380,8 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
327
380
|
const styles = this._getMeasurementStyles();
|
|
328
381
|
if (styles) {
|
|
329
382
|
const size = import_UITextMeasurement.UITextMeasurement.calculateTextSize(
|
|
330
|
-
this.viewHTMLElement,
|
|
331
|
-
this.text || this.innerHTML,
|
|
383
|
+
this.textElementView.viewHTMLElement,
|
|
384
|
+
this.text || this.textElementView.innerHTML,
|
|
332
385
|
constrainingWidth || void 0,
|
|
333
386
|
void 0,
|
|
334
387
|
styles
|
|
@@ -350,7 +403,7 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
350
403
|
}
|
|
351
404
|
intrinsicContentWidth(constrainingHeight = 0) {
|
|
352
405
|
var _a;
|
|
353
|
-
const keyPath = (this.viewHTMLElement.innerHTML || this.text) + "_csf_" + this._getFontCacheKey() + "." + ("" + constrainingHeight).replace(new RegExp("\\.", "g"), "_");
|
|
406
|
+
const keyPath = (this.textElementView.viewHTMLElement.innerHTML || this.text) + "_csf_" + this._getFontCacheKey() + "." + ("" + constrainingHeight).replace(new RegExp("\\.", "g"), "_");
|
|
354
407
|
let cacheObject = _UITextView._intrinsicWidthCache;
|
|
355
408
|
if (this.changesOften) {
|
|
356
409
|
cacheObject = this._intrinsicWidthCache;
|
|
@@ -362,8 +415,8 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
362
415
|
const styles = this._getMeasurementStyles();
|
|
363
416
|
if (styles) {
|
|
364
417
|
const size = import_UITextMeasurement.UITextMeasurement.calculateTextSize(
|
|
365
|
-
this.viewHTMLElement,
|
|
366
|
-
this.text || this.innerHTML,
|
|
418
|
+
this.textElementView.viewHTMLElement,
|
|
419
|
+
this.text || this.textElementView.innerHTML,
|
|
367
420
|
void 0,
|
|
368
421
|
constrainingHeight || void 0,
|
|
369
422
|
styles
|
|
@@ -379,13 +432,60 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
379
432
|
}
|
|
380
433
|
return result;
|
|
381
434
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
this.
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
435
|
+
intrinsicContentSizeWithConstraints(constrainingHeight = 0, constrainingWidth = 0) {
|
|
436
|
+
const cacheKey = this._getIntrinsicSizeCacheKey(constrainingHeight, constrainingWidth);
|
|
437
|
+
const cachedResult = this._getCachedIntrinsicSize(cacheKey);
|
|
438
|
+
if (cachedResult) {
|
|
439
|
+
return cachedResult;
|
|
440
|
+
}
|
|
441
|
+
const result = new import_UIRectangle.UIRectangle(0, 0, 0, 0);
|
|
442
|
+
if (this.rootView.forceIntrinsicSizeZero) {
|
|
443
|
+
return result;
|
|
444
|
+
}
|
|
445
|
+
let temporarilyInViewTree = import_UIObject.NO;
|
|
446
|
+
let nodeAboveThisView = null;
|
|
447
|
+
if (!this.isMemberOfViewTree) {
|
|
448
|
+
document.body.appendChild(this.viewHTMLElement);
|
|
449
|
+
temporarilyInViewTree = import_UIObject.YES;
|
|
450
|
+
nodeAboveThisView = this.viewHTMLElement.nextSibling;
|
|
451
|
+
}
|
|
452
|
+
const height = this._textElementView.style.height;
|
|
453
|
+
const width = this._textElementView.style.width;
|
|
454
|
+
this._textElementView.style.height = "" + constrainingHeight;
|
|
455
|
+
this._textElementView.style.width = "" + constrainingWidth;
|
|
456
|
+
const left = this._textElementView.style.left;
|
|
457
|
+
const right = this._textElementView.style.right;
|
|
458
|
+
const bottom = this._textElementView.style.bottom;
|
|
459
|
+
const top = this._textElementView.style.top;
|
|
460
|
+
this._textElementView.style.left = "";
|
|
461
|
+
this._textElementView.style.right = "";
|
|
462
|
+
this._textElementView.style.bottom = "";
|
|
463
|
+
this._textElementView.style.top = "";
|
|
464
|
+
const resultHeight = this._textElementView.viewHTMLElement.scrollHeight;
|
|
465
|
+
const whiteSpace = this._textElementView.style.whiteSpace;
|
|
466
|
+
this._textElementView.style.whiteSpace = "nowrap";
|
|
467
|
+
const resultWidth = this._textElementView.viewHTMLElement.scrollWidth;
|
|
468
|
+
this._textElementView.style.whiteSpace = whiteSpace;
|
|
469
|
+
this._textElementView.style.height = height;
|
|
470
|
+
this._textElementView.style.width = width;
|
|
471
|
+
this._textElementView.style.left = left;
|
|
472
|
+
this._textElementView.style.right = right;
|
|
473
|
+
this._textElementView.style.bottom = bottom;
|
|
474
|
+
this._textElementView.style.top = top;
|
|
475
|
+
if (temporarilyInViewTree) {
|
|
476
|
+
document.body.removeChild(this.viewHTMLElement);
|
|
477
|
+
if (this.superview) {
|
|
478
|
+
if (nodeAboveThisView) {
|
|
479
|
+
this.superview.viewHTMLElement.insertBefore(this.viewHTMLElement, nodeAboveThisView);
|
|
480
|
+
} else {
|
|
481
|
+
this.superview.viewHTMLElement.appendChild(this.viewHTMLElement);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
result.height = resultHeight;
|
|
486
|
+
result.width = resultWidth;
|
|
487
|
+
this._setCachedIntrinsicSize(cacheKey, result);
|
|
488
|
+
return result;
|
|
389
489
|
}
|
|
390
490
|
};
|
|
391
491
|
let UITextView = _UITextView;
|
|
@@ -407,10 +507,10 @@ UITextView.type = {
|
|
|
407
507
|
"label": "label"
|
|
408
508
|
};
|
|
409
509
|
UITextView.textAlignment = {
|
|
410
|
-
"left": "
|
|
510
|
+
"left": "left",
|
|
411
511
|
"center": "center",
|
|
412
|
-
"right": "
|
|
413
|
-
"justify": "
|
|
512
|
+
"right": "right",
|
|
513
|
+
"justify": "justify"
|
|
414
514
|
};
|
|
415
515
|
// Annotate the CommonJS export names for ESM import in node:
|
|
416
516
|
0 && (module.exports = {
|
|
@@ -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_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\": \"flex-start\",\n \"center\": \"center\",\n \"right\": \"flex-end\",\n \"justify\": \"stretch\"\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 (this as UITextView).configureWithObject({\n style: {\n display: \"flex\",\n flexDirection: \"column\", // Ensures vertical stacking logic\n \n // 'safe' ensures that if content overflows, it aligns to the start (top)\n // instead of overflowing upwards or downwards equally.\n justifyContent: \"safe center\",\n alignItems: \"flex-start\", // Keeps text left-aligned (change to \"center\" for horizontal center)\n \n // Optional: ensure text wraps if it gets too long\n whiteSpace: \"normal\",\n wordWrap: \"break-word\",\n overflowWrap: \"break-word\"\n }\n })\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 | null {\n if (this._cachedMeasurementStyles) {\n return this._cachedMeasurementStyles\n }\n \n // Ensure element is in document\n if (!this.viewHTMLElement.isConnected) {\n return null\n }\n \n // Force a layout flush ONCE to ensure computed styles are available\n // This is only paid once per style change, then we use cached values\n this.viewHTMLElement.offsetHeight\n \n const computed = window.getComputedStyle(this.viewHTMLElement)\n const fontSizeStr = computed.fontSize\n const fontSize = parseFloat(fontSizeStr)\n \n if (!fontSize || isNaN(fontSize)) {\n return null\n }\n \n const lineHeight = this._parseLineHeight(computed.lineHeight, fontSize)\n \n if (isNaN(lineHeight)) {\n return null\n }\n \n const font = [\n computed.fontStyle || 'normal',\n computed.fontVariant || 'normal',\n computed.fontWeight || 'normal',\n fontSize + 'px',\n computed.fontFamily || 'sans-serif'\n ].join(\" \")\n \n this._cachedMeasurementStyles = {\n font: font,\n fontSize: fontSize,\n lineHeight: lineHeight,\n whiteSpace: computed.whiteSpace || 'normal',\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.alignItems\n }\n \n set textAlignment(textAlignment: ValueOf<typeof UITextView.textAlignment>) {\n this.style.alignItems = 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 | null\n \n override usesVirtualLayoutingForIntrinsicSizing = NO\n \n //#endregion\n \n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = ((this.viewHTMLElement.innerHTML || this.text) + \"_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 // Determine if we should use fast measurement\n const shouldUseFastPath = this._useFastMeasurement ?? this._shouldUseFastMeasurement()\n \n if (shouldUseFastPath) {\n // Fast path: use UITextMeasurement with pre-extracted styles\n const styles = this._getMeasurementStyles()\n \n // If styles are invalid (element not properly initialized), fall back to DOM\n if (styles) {\n const size = UITextMeasurement.calculateTextSize(\n this.viewHTMLElement,\n this.text || this.innerHTML,\n constrainingWidth || undefined,\n undefined,\n styles\n )\n result = size.height\n } else {\n // Styles not ready, use DOM measurement\n result = super.intrinsicContentHeight(constrainingWidth)\n }\n } else {\n // Fallback: DOM-based measurement for complex content\n result = super.intrinsicContentHeight(constrainingWidth)\n }\n \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 || this.text) + \"_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 // Determine if we should use fast measurement\n const shouldUseFastPath = this._useFastMeasurement ?? this._shouldUseFastMeasurement()\n \n if (shouldUseFastPath) {\n // Fast path: use UITextMeasurement with pre-extracted styles\n const styles = this._getMeasurementStyles()\n \n // If styles are invalid (element not properly initialized), fall back to DOM\n if (styles) {\n const size = UITextMeasurement.calculateTextSize(\n this.viewHTMLElement,\n this.text || this.innerHTML,\n undefined,\n constrainingHeight || undefined,\n styles\n )\n result = size.width\n } else {\n // Styles not ready, use DOM measurement\n result = super.intrinsicContentWidth(constrainingHeight)\n }\n } else {\n // Fallback: DOM-based measurement for complex content\n result = super.intrinsicContentWidth(constrainingHeight)\n }\n \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;AAAA;AAAA;AAAA,qBAAwB;AAExB,sBAAqE;AACrE,yBAA4B;AAC5B,+BAAwD;AAC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AAA,UACJ;AACA,mBAAS,KAAK;AAAA,QAClB,OAAO;AAEH,mBAAS,MAAM,sBAAsB,kBAAkB;AAAA,QAC3D;AAAA,MACJ,OAAO;AAEH,iBAAS,MAAM,sBAAsB,kBAAkB;AAAA,MAC3D;AAEA,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;AAlnBO,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;",
|
|
4
|
+
"sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UILocalizedTextObject } from \"./UIInterfaces\"\nimport { EXTEND, 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 \n constructor(\n elementID?: string,\n textViewType: string | ValueOf<typeof UITextView.type> = UITextView.type.paragraph,\n viewHTMLElement = null\n ) {\n \n // Create inner text element as a UIView\n const innerElementID = elementID ? `${elementID}_textElement` : undefined\n const _textElementView = new UIView(innerElementID, null, textViewType)\n \n // Create outer container (wrapper) - this is the main viewHTMLElement\n super(elementID, viewHTMLElement, \"span\", { _textElementView })\n \n // Configure outer container for vertical centering using direct property access\n \n this.configureWithObject({\n // @ts-ignore\n viewHTMLElement: {\n style: {\n display: \"flex\",\n alignItems: \"center\", // Vertical centering\n overflow: \"hidden\"\n }\n }\n })\n \n this.text = \"\"\n \n this._textElementView = _textElementView\n \n // Configure inner text element for ellipsis and positioning\n this._textElementView.configureWithObject({\n style: {\n position: \"relative\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n width: \"100%\",\n margin: \"0\",\n padding: \"0\"\n },\n // Forward control events from text element to the container\n sendControlEventForKey: EXTEND(this.sendControlEventForKey.bind(this))\n })\n \n // Add text element as a subview\n this.addSubview(this._textElementView)\n \n \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 Text Element View Property\n \n private _textElementView: UIView\n \n /**\n * The inner text element that holds the actual text content\n */\n get textElementView(): UIView {\n return this._textElementView\n }\n \n /**\n * Override style to apply to the text element instead of the container\n */\n // override get style() {\n // return this._textElementView.style\n // }\n //\n // /**\n // * Override computedStyle to get computed styles from the text element\n // */\n // override get computedStyle() {\n // return this._textElementView.computedStyle\n // }\n \n /**\n * Access the outer container's style (for positioning, layout, etc.)\n */\n get containerStyle() {\n return this.viewHTMLElement.style\n }\n \n /**\n * Override styleClasses to apply to the text element\n */\n override get styleClasses() {\n return this._textElementView.styleClasses\n }\n \n override set styleClasses(styleClasses: string[]) {\n this._textElementView.styleClasses = styleClasses\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(\n 0,\n 0,\n this.textElementView.viewHTMLElement.offsetHeight,\n this.textElementView.viewHTMLElement.offsetWidth\n ),\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.textElementView.viewHTMLElement)\n this._intrinsicSizesCache = {}\n }\n \n private _getMeasurementStyles(): TextMeasurementStyle | null {\n if (this._cachedMeasurementStyles) {\n return this._cachedMeasurementStyles\n }\n \n // Ensure element is in document\n if (!this.textElementView.viewHTMLElement.isConnected) {\n return null\n }\n \n // Force a layout flush ONCE to ensure computed styles are available\n // This is only paid once per style change, then we use cached values\n this.textElementView.viewHTMLElement.offsetHeight\n \n const computed = window.getComputedStyle(this.textElementView.viewHTMLElement)\n const fontSizeStr = computed.fontSize\n const fontSize = parseFloat(fontSizeStr)\n \n if (!fontSize || isNaN(fontSize)) {\n return null\n }\n \n const lineHeight = this._parseLineHeight(computed.lineHeight, fontSize)\n \n if (isNaN(lineHeight)) {\n return null\n }\n \n const font = [\n computed.fontStyle || \"normal\",\n computed.fontVariant || \"normal\",\n computed.fontWeight || \"normal\",\n fontSize + \"px\",\n computed.fontFamily || \"sans-serif\"\n ].join(\" \")\n \n this._cachedMeasurementStyles = {\n font: font,\n fontSize: fontSize,\n lineHeight: lineHeight,\n whiteSpace: computed.whiteSpace || \"normal\",\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.textElementView.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 return this._textElementView.style.textAlign as ValueOf<typeof UITextView.textAlignment>\n }\n \n set textAlignment(textAlignment: ValueOf<typeof UITextView.textAlignment>) {\n this._textAlignment = textAlignment\n this._textElementView.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._textElementView.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 // Single line: use nowrap with ellipsis\n this._textElementView.style.whiteSpace = \"nowrap\"\n this._textElementView.style.textOverflow = \"ellipsis\"\n this._textElementView.style.display = \"\"\n this._textElementView.style.webkitLineClamp = \"\"\n this._textElementView.style.webkitBoxOrient = \"\"\n return\n }\n \n // Multiline: allow wrapping, but still show ellipsis if content overflows the container\n // This uses the -webkit-line-clamp approach which works for multiline ellipsis\n this._textElementView.style.whiteSpace = \"normal\"\n this._textElementView.style.textOverflow = \"ellipsis\"\n this._textElementView.style.display = \"-webkit-box\"\n this._textElementView.style.webkitBoxOrient = \"vertical\"\n // Don't set line-clamp to a specific number - let it fill available space\n // The overflow: hidden from the constructor will clip content that exceeds the height\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.textElementView.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.textElementView.viewHTMLElement.innerHTML != this.textPrefix + text + this.textSuffix + notificationText) {\n this.textElementView.viewHTMLElement.innerHTML = this.textPrefix + FIRST(\n 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.textElementView.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._textElementView.style.fontSize || window.getComputedStyle(this._textElementView.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._textElementView.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._textElementView.style.fontSize || \"\",\n fontFamily: this._textElementView.style.fontFamily || \"\",\n fontWeight: this._textElementView.style.fontWeight || \"\",\n fontStyle: this._textElementView.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._textElementView.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: \"\",\n fontFamily: \"\",\n fontWeight: \"\",\n fontStyle: \"\",\n styleClasses: \"\"\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 | null\n \n override usesVirtualLayoutingForIntrinsicSizing = NO\n \n //#endregion\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 // Override focus to focus the text element\n override focus() {\n this._textElementView.focus()\n }\n \n // Override blur to blur the text element\n override blur() {\n this._textElementView.blur()\n }\n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = ((this.textElementView.viewHTMLElement.innerHTML || this.text) + \"_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 // Determine if we should use fast measurement\n const shouldUseFastPath = this._useFastMeasurement ?? this._shouldUseFastMeasurement()\n \n if (shouldUseFastPath) {\n // Fast path: use UITextMeasurement with pre-extracted styles\n const styles = this._getMeasurementStyles()\n \n // If styles are invalid (element not properly initialized), fall back to DOM\n if (styles) {\n const size = UITextMeasurement.calculateTextSize(\n this.textElementView.viewHTMLElement,\n this.text || this.textElementView.innerHTML,\n constrainingWidth || undefined,\n undefined,\n styles\n )\n result = size.height\n }\n else {\n // Styles not ready, use DOM measurement\n result = super.intrinsicContentHeight(constrainingWidth)\n }\n }\n else {\n // Fallback: DOM-based measurement for complex content\n result = super.intrinsicContentHeight(constrainingWidth)\n }\n \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.textElementView.viewHTMLElement.innerHTML || this.text) + \"_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 // Determine if we should use fast measurement\n const shouldUseFastPath = this._useFastMeasurement ?? this._shouldUseFastMeasurement()\n \n if (shouldUseFastPath) {\n // Fast path: use UITextMeasurement with pre-extracted styles\n const styles = this._getMeasurementStyles()\n \n // If styles are invalid (element not properly initialized), fall back to DOM\n if (styles) {\n const size = UITextMeasurement.calculateTextSize(\n this.textElementView.viewHTMLElement,\n this.text || this.textElementView.innerHTML,\n undefined,\n constrainingHeight || undefined,\n styles\n )\n result = size.width\n }\n else {\n // Styles not ready, use DOM measurement\n result = super.intrinsicContentWidth(constrainingHeight)\n }\n }\n else {\n // Fallback: DOM-based measurement for complex content\n result = super.intrinsicContentWidth(constrainingHeight)\n }\n \n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n return result\n }\n \n \n override intrinsicContentSizeWithConstraints(constrainingHeight: number = 0, constrainingWidth: number = 0) {\n \n const cacheKey = this._getIntrinsicSizeCacheKey(constrainingHeight, constrainingWidth)\n const cachedResult = this._getCachedIntrinsicSize(cacheKey)\n if (cachedResult) {\n return cachedResult\n }\n \n // UITextView needs to measure the text element, not the outer container\n const result = new UIRectangle(0, 0, 0, 0)\n if (this.rootView.forceIntrinsicSizeZero) {\n return result\n }\n \n let temporarilyInViewTree = NO\n let nodeAboveThisView: Node | null = null\n if (!this.isMemberOfViewTree) {\n document.body.appendChild(this.viewHTMLElement)\n temporarilyInViewTree = YES\n nodeAboveThisView = this.viewHTMLElement.nextSibling\n }\n \n // Save and clear styles on the TEXT ELEMENT (not the container)\n const height = this._textElementView.style.height\n const width = this._textElementView.style.width\n \n this._textElementView.style.height = \"\" + constrainingHeight\n this._textElementView.style.width = \"\" + constrainingWidth\n \n const left = this._textElementView.style.left\n const right = this._textElementView.style.right\n const bottom = this._textElementView.style.bottom\n const top = this._textElementView.style.top\n \n this._textElementView.style.left = \"\"\n this._textElementView.style.right = \"\"\n this._textElementView.style.bottom = \"\"\n this._textElementView.style.top = \"\"\n \n // Measure height with the text element\n const resultHeight = this._textElementView.viewHTMLElement.scrollHeight\n \n // Measure width by temporarily setting nowrap\n const whiteSpace = this._textElementView.style.whiteSpace\n this._textElementView.style.whiteSpace = \"nowrap\"\n \n const resultWidth = this._textElementView.viewHTMLElement.scrollWidth\n \n this._textElementView.style.whiteSpace = whiteSpace\n \n // Restore styles on the TEXT ELEMENT\n this._textElementView.style.height = height\n this._textElementView.style.width = width\n \n this._textElementView.style.left = left\n this._textElementView.style.right = right\n this._textElementView.style.bottom = bottom\n this._textElementView.style.top = top\n \n if (temporarilyInViewTree) {\n document.body.removeChild(this.viewHTMLElement)\n if (this.superview) {\n if (nodeAboveThisView) {\n this.superview.viewHTMLElement.insertBefore(this.viewHTMLElement, nodeAboveThisView)\n }\n else {\n this.superview.viewHTMLElement.appendChild(this.viewHTMLElement)\n }\n }\n }\n \n result.height = resultHeight\n result.width = resultWidth\n \n this._setCachedIntrinsicSize(cacheKey, result)\n \n return result\n }\n \n \n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AAExB,sBAA6E;AAC7E,yBAA4B;AAC5B,+BAAwD;AACxD,oBAA6C;AAGtC,MAAM,cAAN,cAAyB,qBAAO;AAAA,EAwCnC,YACI,WACA,eAAyD,YAAW,KAAK,WACzE,kBAAkB,MACpB;AAGE,UAAM,iBAAiB,YAAY,GAAG,0BAA0B;AAChE,UAAM,mBAAmB,IAAI,qBAAO,gBAAgB,MAAM,YAAY;AAGtE,UAAM,WAAW,iBAAiB,QAAQ,EAAE,iBAAiB,CAAC;AAgflE,sBAAa;AACb,sBAAa;AACb,+BAAsB;AAMtB,sBAAsB,YAAW;AAEjC,yBAAgB;AAQhB,uCAA8B;AAI9B,SAAQ,4BAA4B;AAAA,MAChC,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,cAAc;AAAA,IAClB;AAMA,wBAAe;AAGf,iCAA+E,IAAI,yBAAS;AAC5F,gCAA8E,IAAI,yBAAS;AAK3F,SAAS,yCAAyC;AAvhB9C,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AAAA,QACnE;AAAA,MACJ;AAAA,IACJ;AAEA,WAAO,SAAS;AAChB,WAAO,QAAQ;AAEf,SAAK,wBAAwB,UAAU,MAAM;AAE7C,WAAO;AAAA,EACX;AAGJ;AA9xBO,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
|
}
|
|
@@ -163,7 +163,7 @@ export declare class UIView extends UIObject {
|
|
|
163
163
|
bottom: number;
|
|
164
164
|
right: number;
|
|
165
165
|
};
|
|
166
|
-
constructor(elementID?: string, viewHTMLElement?: HTMLElement & LooseObject | null, elementType?: string | null,
|
|
166
|
+
constructor(elementID?: string, viewHTMLElement?: HTMLElement & LooseObject | null, elementType?: string | null, preInitConfiguratorObject?: any);
|
|
167
167
|
static get nextIndex(): number;
|
|
168
168
|
private static _cachedPageWidth;
|
|
169
169
|
private static _cachedPageHeight;
|
|
@@ -444,9 +444,9 @@ export declare class UIView extends UIObject {
|
|
|
444
444
|
get contentBounds(): UIRectangle;
|
|
445
445
|
contentBoundsWithInset(inset: number): UIRectangle;
|
|
446
446
|
contentBoundsWithInsets(left: number, right: number, bottom: number, top: number): UIRectangle;
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
447
|
+
protected _getIntrinsicSizeCacheKey(constrainingHeight: number, constrainingWidth: number): string;
|
|
448
|
+
protected _getCachedIntrinsicSize(cacheKey: string): UIRectangle | undefined;
|
|
449
|
+
protected _setCachedIntrinsicSize(cacheKey: string, size: UIRectangle): void;
|
|
450
450
|
clearIntrinsicSizeCache(): void;
|
|
451
451
|
intrinsicContentSizeWithConstraints(constrainingHeight?: number, constrainingWidth?: number): UIRectangle;
|
|
452
452
|
private _intrinsicFrameFromSubviewFrames;
|
|
@@ -72,7 +72,7 @@ function UIComponentView(target, context) {
|
|
|
72
72
|
import_UIObject.UIObject.recordAnnotation(UIComponentView, target);
|
|
73
73
|
}
|
|
74
74
|
const _UIView = class extends import_UIObject.UIObject {
|
|
75
|
-
constructor(elementID = "UIView" + _UIView.nextIndex, viewHTMLElement = null, elementType = null,
|
|
75
|
+
constructor(elementID = "UIView" + _UIView.nextIndex, viewHTMLElement = null, elementType = null, preInitConfiguratorObject) {
|
|
76
76
|
super();
|
|
77
77
|
this._nativeSelectionEnabled = import_UIObject.YES;
|
|
78
78
|
this._enabled = import_UIObject.YES;
|
|
@@ -103,6 +103,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
103
103
|
this._contentInsets = { top: 0, left: 0, bottom: 0, right: 0 };
|
|
104
104
|
this.hasWeakFrame = import_UIObject.NO;
|
|
105
105
|
this.controlEvent = _UIView.controlEvent;
|
|
106
|
+
this.configureWithObject(preInitConfiguratorObject);
|
|
106
107
|
_UIView._UIViewIndex = _UIView.nextIndex;
|
|
107
108
|
this._UIViewIndex = _UIView._UIViewIndex;
|
|
108
109
|
this._styleClasses = [];
|