uicore-ts 1.1.142 → 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.
@@ -29,16 +29,16 @@ var import_UIView = require("./UIView");
29
29
  const _UITextField = class extends import_UITextView.UITextView {
30
30
  constructor(elementID, viewHTMLElement = null, type = import_UITextView.UITextView.type.textField) {
31
31
  super(elementID, type, viewHTMLElement);
32
- this.viewHTMLElement.setAttribute("type", "text");
32
+ this.textElementView.viewHTMLElement.setAttribute("type", "text");
33
33
  this.backgroundColor = import_UIColor.UIColor.whiteColor;
34
34
  this.addTargetForControlEvent(
35
35
  import_UIView.UIView.controlEvent.PointerUpInside,
36
36
  (sender, event) => sender.focus()
37
37
  );
38
- this.viewHTMLElement.oninput = (event) => {
38
+ this.textElementView.viewHTMLElement.oninput = (event) => {
39
39
  this.sendControlEventForKey(_UITextField.controlEvent.TextChange, event);
40
40
  };
41
- this.style.webkitUserSelect = "text";
41
+ this.textElementView.style.webkitUserSelect = "text";
42
42
  this.nativeSelectionEnabled = import_UIObject.YES;
43
43
  this.pausesPointerEvents = import_UIObject.NO;
44
44
  this.changesOften = import_UIObject.YES;
@@ -50,16 +50,16 @@ const _UITextField = class extends import_UITextView.UITextView {
50
50
  return this._viewHTMLElement;
51
51
  }
52
52
  set text(text) {
53
- this.viewHTMLElement.value = text;
53
+ this.textElementView.viewHTMLElement.value = text;
54
54
  }
55
55
  get text() {
56
- return this.viewHTMLElement.value;
56
+ return this.textElementView.viewHTMLElement.value;
57
57
  }
58
58
  set placeholderText(text) {
59
- this.viewHTMLElement.placeholder = text;
59
+ this.textElementView.viewHTMLElement.placeholder = text;
60
60
  }
61
61
  get placeholderText() {
62
- return this.viewHTMLElement.placeholder;
62
+ return this.textElementView.viewHTMLElement.placeholder;
63
63
  }
64
64
  setPlaceholderText(key, defaultString) {
65
65
  this._placeholderTextKey = key;
@@ -83,15 +83,15 @@ const _UITextField = class extends import_UITextView.UITextView {
83
83
  }
84
84
  }
85
85
  get isSecure() {
86
- const result = this.viewHTMLElement.type == "password";
86
+ const result = this.textElementView.viewHTMLElement.type == "password";
87
87
  return result;
88
88
  }
89
89
  set isSecure(secure) {
90
- var type = "text";
90
+ let type = "text";
91
91
  if (secure) {
92
92
  type = "password";
93
93
  }
94
- this.viewHTMLElement.type = type;
94
+ this.textElementView.viewHTMLElement.type = type;
95
95
  }
96
96
  };
97
97
  let UITextField = _UITextField;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UITextField.ts"],
4
- "sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { nil, NO, ValueOf, YES } from \"./UIObject\"\nimport { UITextView } from \"./UITextView\"\nimport { UIView, UIViewAddControlEventTargetObject, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UITextField extends UITextView {\n \n _placeholderTextKey?: string\n _defaultPlaceholderText?: string\n \n override _viewHTMLElement!: HTMLInputElement\n \n constructor(elementID?: string, viewHTMLElement = null, type: string | ValueOf<typeof UITextView.type> = UITextView.type.textField) {\n \n super(elementID, type, viewHTMLElement)\n \n this.viewHTMLElement.setAttribute(\"type\", \"text\")\n this.backgroundColor = UIColor.whiteColor\n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n this.viewHTMLElement.oninput = (event) => {\n this.sendControlEventForKey(UITextField.controlEvent.TextChange, event)\n }\n this.style.webkitUserSelect = \"text\"\n this.nativeSelectionEnabled = YES\n this.pausesPointerEvents = NO\n this.changesOften = YES\n \n }\n \n \n static override controlEvent = Object.assign({}, UITextView.controlEvent, {\n \n \"TextChange\": \"TextChange\"\n \n })\n \n \n override get controlEventTargetAccumulator(): UIViewAddControlEventTargetObject<typeof UITextField> {\n return (super.controlEventTargetAccumulator as any)\n }\n \n public override get viewHTMLElement() {\n return this._viewHTMLElement\n }\n \n \n public override set text(text: string) {\n \n this.viewHTMLElement.value = text\n \n }\n \n \n public override get text(): string {\n \n return this.viewHTMLElement.value\n \n }\n \n \n public set placeholderText(text: string) {\n \n this.viewHTMLElement.placeholder = text\n \n }\n \n \n public get placeholderText(): string {\n \n return this.viewHTMLElement.placeholder\n \n }\n \n \n setPlaceholderText(key: string, defaultString: string) {\n \n this._placeholderTextKey = key\n this._defaultPlaceholderText = defaultString\n \n const languageName = UICore.languageService.currentLanguageKey\n this.placeholderText = UICore.languageService.stringForKey(key, languageName, defaultString, nil)\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.LanguageChanged || event.name ==\n UIView.broadcastEventName.AddedToViewTree) {\n \n this._setPlaceholderFromKeyIfPossible()\n \n }\n \n }\n \n \n override willMoveToSuperview(superview: UIView) {\n \n super.willMoveToSuperview(superview)\n \n this._setPlaceholderFromKeyIfPossible()\n \n }\n \n _setPlaceholderFromKeyIfPossible() {\n \n if (this._placeholderTextKey && this._defaultPlaceholderText) {\n \n this.setPlaceholderText(this._placeholderTextKey, this._defaultPlaceholderText)\n \n }\n \n }\n \n \n public get isSecure(): boolean {\n \n const result = (this.viewHTMLElement.type == \"password\")\n \n return result\n \n }\n \n \n \n public set isSecure(secure: boolean) {\n \n var type = \"text\"\n \n if (secure) {\n \n type = \"password\"\n \n }\n \n this.viewHTMLElement.type = type\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\n\n\n\n\n\n\n\n\n\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AACxB,oBAAuB;AACvB,sBAAsC;AACtC,wBAA2B;AAC3B,oBAAgF;AAGzE,MAAM,eAAN,cAA0B,6BAAW;AAAA,EAOxC,YAAY,WAAoB,kBAAkB,MAAM,OAAiD,6BAAW,KAAK,WAAW;AAEhI,UAAM,WAA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,EAE1C;AAAA,EAEA,mCAAmC;AAE/B,QAAI,KAAK,uBAAuB,KAAK,yBAAyB;AAE1D,WAAK,mBAAmB,KAAK,qBAAqB,KAAK,uBAAuB;AAAA,IAElF;AAAA,EAEJ;AAAA,EAGA,IAAW,WAAoB;AAE3B,UAAM,SAAU,KAAK,gBAAgB,QAAQ;AAE7C,WAAO;AAAA,EAEX;AAAA,EAIA,IAAW,SAAS,QAAiB;AAEjC,QAAI,OAAO;AAEX,QAAI,QAAQ;AAER,aAAO;AAAA,IAEX;AAEA,SAAK,gBAAgB,OAAO;AAAA,EAEhC;AAMJ;AAhJO,IAAM,cAAN;AAAM,YA4BO,eAAe,OAAO,OAAO,CAAC,GAAG,6BAAW,cAAc;AAAA,EAEtE,cAAc;AAElB,CAAC;",
4
+ "sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { nil, NO, ValueOf, YES } from \"./UIObject\"\nimport { UITextView } from \"./UITextView\"\nimport { UIView, UIViewAddControlEventTargetObject, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UITextField extends UITextView {\n \n _placeholderTextKey?: string\n _defaultPlaceholderText?: string\n \n override _viewHTMLElement!: HTMLInputElement\n \n constructor(\n elementID?: string,\n viewHTMLElement = null,\n type: string | ValueOf<typeof UITextView.type> = UITextView.type.textField\n ) {\n \n super(elementID, type, viewHTMLElement)\n \n this.textElementView.viewHTMLElement.setAttribute(\"type\", \"text\")\n this.backgroundColor = UIColor.whiteColor\n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n this.textElementView.viewHTMLElement.oninput = (event) => {\n this.sendControlEventForKey(UITextField.controlEvent.TextChange, event)\n }\n this.textElementView.style.webkitUserSelect = \"text\"\n this.nativeSelectionEnabled = YES\n this.pausesPointerEvents = NO\n this.changesOften = YES\n \n }\n \n \n static override controlEvent = Object.assign({}, UITextView.controlEvent, {\n \n \"TextChange\": \"TextChange\"\n \n })\n \n \n override get controlEventTargetAccumulator(): UIViewAddControlEventTargetObject<typeof UITextField> {\n return (super.controlEventTargetAccumulator as any)\n }\n \n public override get viewHTMLElement() {\n return this._viewHTMLElement\n }\n \n \n public override set text(text: string) {\n this.textElementView.viewHTMLElement.value = text\n }\n \n public override get text(): string {\n return this.textElementView.viewHTMLElement.value\n }\n \n \n public set placeholderText(text: string) {\n this.textElementView.viewHTMLElement.placeholder = text\n }\n \n public get placeholderText(): string {\n return this.textElementView.viewHTMLElement.placeholder\n }\n \n \n setPlaceholderText(key: string, defaultString: string) {\n \n this._placeholderTextKey = key\n this._defaultPlaceholderText = defaultString\n \n const languageName = UICore.languageService.currentLanguageKey\n this.placeholderText = UICore.languageService.stringForKey(key, languageName, defaultString, nil)\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.LanguageChanged || event.name ==\n UIView.broadcastEventName.AddedToViewTree) {\n \n this._setPlaceholderFromKeyIfPossible()\n \n }\n \n }\n \n \n override willMoveToSuperview(superview: UIView) {\n \n super.willMoveToSuperview(superview)\n \n this._setPlaceholderFromKeyIfPossible()\n \n }\n \n _setPlaceholderFromKeyIfPossible() {\n \n if (this._placeholderTextKey && this._defaultPlaceholderText) {\n \n this.setPlaceholderText(this._placeholderTextKey, this._defaultPlaceholderText)\n \n }\n \n }\n \n \n public get isSecure(): boolean {\n const result = (this.textElementView.viewHTMLElement.type == \"password\")\n return result\n }\n \n public set isSecure(secure: boolean) {\n let type = \"text\"\n if (secure) {\n type = \"password\"\n }\n this.textElementView.viewHTMLElement.type = type\n }\n \n \n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AACxB,oBAAuB;AACvB,sBAAsC;AACtC,wBAA2B;AAC3B,oBAAgF;AAGzE,MAAM,eAAN,cAA0B,6BAAW;AAAA,EAOxC,YACI,WACA,kB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AA,IAE1C;AAAA,EAEJ;AAAA,EAGS,oBAAoB,WAAmB;AAE5C,UAAM,oBAAoB,SAAS;AAEnC,SAAK,iCAAiC;AAAA,EAE1C;AAAA,EAEA,mCAAmC;AAE/B,QAAI,KAAK,uBAAuB,KAAK,yBAAyB;AAE1D,WAAK,mBAAmB,KAAK,qBAAqB,KAAK,uBAAuB;AAAA,IAElF;AAAA,EAEJ;AAAA,EAGA,IAAW,WAAoB;AAC3B,UAAM,SAAU,KAAK,gBAAgB,gBAAgB,QAAQ;AAC7D,WAAO;AAAA,EACX;AAAA,EAEA,IAAW,SAAS,QAAiB;AACjC,QAAI,OAAO;AACX,QAAI,QAAQ;AACR,aAAO;AAAA,IACX;AACA,SAAK,gBAAgB,gBAAgB,OAAO;AAAA,EAChD;AAGJ;AA5HO,IAAM,cAAN;AAAM,YAgCO,eAAe,OAAO,OAAO,CAAC,GAAG,6BAAW,cAAc;AAAA,EAEtE,cAAc;AAElB,CAAC;",
6
6
  "names": []
7
7
  }
@@ -32,12 +32,29 @@ export declare class UITextView extends UIView {
32
32
  readonly label: "label";
33
33
  };
34
34
  static textAlignment: {
35
- readonly left: "flex-start";
35
+ readonly left: "left";
36
36
  readonly center: "center";
37
- readonly right: "flex-end";
38
- readonly justify: "stretch";
37
+ readonly right: "right";
38
+ readonly justify: "justify";
39
39
  };
40
40
  constructor(elementID?: string, textViewType?: string | ValueOf<typeof UITextView.type>, viewHTMLElement?: null);
41
+ private _textElementView;
42
+ /**
43
+ * The inner text element that holds the actual text content
44
+ */
45
+ get textElementView(): UIView;
46
+ /**
47
+ * Override style to apply to the text element instead of the container
48
+ */
49
+ /**
50
+ * Access the outer container's style (for positioning, layout, etc.)
51
+ */
52
+ get containerStyle(): CSSStyleDeclaration;
53
+ /**
54
+ * Override styleClasses to apply to the text element
55
+ */
56
+ get styleClasses(): string[];
57
+ set styleClasses(styleClasses: string[]);
41
58
  didReceiveBroadcastEvent(event: UIViewBroadcastEvent): void;
42
59
  willMoveToSuperview(superview: UIView): void;
43
60
  layoutSubviews(): void;
@@ -103,8 +120,11 @@ export declare class UITextView extends UIView {
103
120
  private _useFastMeasurement;
104
121
  private _cachedMeasurementStyles;
105
122
  usesVirtualLayoutingForIntrinsicSizing: boolean;
106
- intrinsicContentHeight(constrainingWidth?: number): any;
107
- intrinsicContentWidth(constrainingHeight?: number): any;
108
123
  addStyleClass(styleClass: string): void;
109
124
  removeStyleClass(styleClass: string): void;
125
+ focus(): void;
126
+ blur(): void;
127
+ intrinsicContentHeight(constrainingWidth?: number): any;
128
+ intrinsicContentWidth(constrainingHeight?: number): any;
129
+ intrinsicContentSizeWithConstraints(constrainingHeight?: number, constrainingWidth?: number): UIRectangle;
110
130
  }
@@ -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
- super(elementID, viewHTMLElement, textViewType);
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: this.style.fontSize || "",
40
- fontFamily: this.style.fontFamily || "",
41
- fontWeight: this.style.fontWeight || "",
42
- fontStyle: this.style.fontStyle || "",
43
- styleClasses: this.styleClasses.join(",")
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.style.overflow = "hidden";
51
- this.style.textOverflow = "ellipsis";
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(0, 0, 1 * this.viewHTMLElement.offsetHeight, 1 * this.viewHTMLElement.offsetWidth),
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.alignItems;
195
+ return this._textElementView.style.textAlign;
168
196
  }
169
197
  set textAlignment(textAlignment) {
170
- this.style.alignItems = textAlignment;
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 = "pre";
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 = "pre-wrap";
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)(text, "") + this.textSuffix + notificationText;
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
- addStyleClass(styleClass) {
383
- super.addStyleClass(styleClass);
384
- this._invalidateFontCache();
385
- }
386
- removeStyleClass(styleClass) {
387
- super.removeStyleClass(styleClass);
388
- this._invalidateFontCache();
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": "flex-start",
510
+ "left": "left",
411
511
  "center": "center",
412
- "right": "flex-end",
413
- "justify": "stretch"
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 = {