uicore-ts 1.1.116 → 1.1.121
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/UIButton.js +5 -5
- package/compiledScripts/UIButton.js.map +2 -2
- package/compiledScripts/UICore.d.ts +2 -2
- package/compiledScripts/UICore.js +2 -2
- package/compiledScripts/UICore.js.map +2 -2
- package/compiledScripts/UIDialogView.js +3 -0
- package/compiledScripts/UIDialogView.js.map +2 -2
- package/compiledScripts/UITextView.js +61 -12
- package/compiledScripts/UITextView.js.map +2 -2
- package/compiledScripts/UIView.d.ts +2 -2
- package/compiledScripts/UIView.js +6 -3
- package/compiledScripts/UIView.js.map +2 -2
- package/package.json +1 -1
- package/scripts/UIButton.ts +1 -1
- package/scripts/UICore.ts +2 -2
- package/scripts/UIDialogView.ts +4 -0
- package/scripts/UITextView.ts +86 -14
- package/scripts/UIView.ts +23 -5
|
@@ -201,14 +201,14 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
|
|
|
201
201
|
return this._imageView;
|
|
202
202
|
}
|
|
203
203
|
layoutSubviews() {
|
|
204
|
-
var _a, _b, _c, _d, _e;
|
|
204
|
+
var _a, _b, _c, _d, _e, _f;
|
|
205
205
|
super.layoutSubviews();
|
|
206
206
|
let bounds = this.bounds;
|
|
207
|
-
this.hoverText = (_b = (_a = this.titleLabel) == null ? void 0 : _a.text) != null ?
|
|
208
|
-
if ((0, import_UIObject.IS_NOT)(this.imageView.hidden) && !(0, import_UIObject.IS)((
|
|
207
|
+
this.hoverText = (_c = (_b = this.hoverText) != null ? _b : (_a = this.titleLabel) == null ? void 0 : _a.text) != null ? _c : "";
|
|
208
|
+
if ((0, import_UIObject.IS_NOT)(this.imageView.hidden) && !(0, import_UIObject.IS)((_d = this.titleLabel) == null ? void 0 : _d.text)) {
|
|
209
209
|
this.imageView.frame = bounds;
|
|
210
210
|
}
|
|
211
|
-
if ((0, import_UIObject.IS)(this.imageView.hidden) && ((
|
|
211
|
+
if ((0, import_UIObject.IS)(this.imageView.hidden) && ((_e = this.titleLabel) == null ? void 0 : _e.text)) {
|
|
212
212
|
this.titleLabel.style.left = this.contentPadding + "px";
|
|
213
213
|
this.titleLabel.style.right = this.contentPadding + "px";
|
|
214
214
|
this.titleLabel.style.top = "50%";
|
|
@@ -233,7 +233,7 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
|
|
|
233
233
|
this.titleLabel.hidden = hidden;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
if ((0, import_UIObject.IS_NOT)(this.imageView.hidden) && ((
|
|
236
|
+
if ((0, import_UIObject.IS_NOT)(this.imageView.hidden) && ((_f = this.titleLabel) == null ? void 0 : _f.text)) {
|
|
237
237
|
bounds = bounds.rectangleWithInset(this.contentPadding);
|
|
238
238
|
const imageFrame = bounds.copy();
|
|
239
239
|
imageFrame.width = bounds.height - this.contentPadding * 0.5;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../scripts/UIButton.ts"],
|
|
4
|
-
"sourcesContent": ["import { UIBaseButton } from \"./UIBaseButton\"\nimport { UIColor } from \"./UIColor\"\nimport { UIImageView } from \"./UIImageView\"\nimport { IS, IS_NOT, IS_NOT_NIL, nil, NO, ValueOf, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UITextView } from \"./UITextView\"\n\n\nexport interface UIButtonColorSpecifier {\n \n titleLabel: UIButtonElementColorSpecifier;\n background: UIButtonElementColorSpecifier;\n \n}\n\n\nexport interface UIButtonElementColorSpecifier {\n \n normal: UIColor;\n hovered?: UIColor;\n highlighted: UIColor;\n focused?: UIColor;\n selected: UIColor;\n selectedAndHighlighted?: UIColor;\n \n}\n\n\nexport class UIButton extends UIBaseButton {\n \n _contentPadding = 0\n _titleLabel: UITextView = nil\n _imageView: UIImageView\n \n usesAutomaticTitleFontSize = NO\n minAutomaticFontSize?: number\n maxAutomaticFontSize?: number = 25\n \n colors: UIButtonColorSpecifier = {\n \n titleLabel: {\n \n normal: UIColor.whiteColor,\n highlighted: UIColor.whiteColor,\n selected: UIColor.whiteColor\n \n },\n \n background: {\n \n normal: UIColor.blueColor,\n highlighted: UIColor.greenColor,\n selected: UIColor.redColor\n \n }\n \n }\n \n \n constructor(\n elementID?: string,\n elementType?: string,\n titleType: string | ValueOf<typeof UITextView.type> = UITextView.type.span\n ) {\n \n super(elementID, elementType)\n \n // Instance variables\n \n this._imageView = new UIImageView(this.elementID + \"ImageView\")\n this._imageView.hidden = YES\n this.addSubview(this.imageView)\n \n this.imageView.fillMode = UIImageView.fillMode.aspectFitIfLarger\n \n \n if (IS_NOT_NIL(titleType)) {\n \n this._titleLabel = new UITextView(this.elementID + \"TitleLabel\", titleType)\n this.titleLabel!.style.whiteSpace = \"nowrap\"\n this.addSubview(this.titleLabel!)\n \n this.titleLabel!.userInteractionEnabled = NO\n \n }\n \n this.contentPadding = 10\n \n this.imageView.userInteractionEnabled = NO\n if (this.titleLabel) {\n this.titleLabel.textAlignment = UITextView.textAlignment.center\n this.titleLabel.nativeSelectionEnabled = NO\n }\n \n }\n \n \n get contentPadding() {\n return this._contentPadding.integerValue\n }\n \n set contentPadding(contentPadding) {\n this._contentPadding = contentPadding\n this.setNeedsLayout()\n }\n \n \n public override set hovered(hovered: boolean) {\n this._hovered = hovered\n this.updateContentForCurrentState()\n }\n \n public override get hovered(): boolean {\n return this._hovered ?? NO\n }\n \n public override set highlighted(highlighted: boolean) {\n this._highlighted = highlighted\n this.updateContentForCurrentState()\n }\n \n public override get highlighted(): boolean {\n return this._highlighted\n }\n \n public override set focused(focused: boolean) {\n this._focused = focused\n if (focused) {\n this.focus()\n }\n else {\n this.blur()\n }\n this.updateContentForCurrentState()\n }\n \n public override get focused(): boolean {\n return this._focused ?? NO\n }\n \n public override set selected(selected: boolean) {\n this._selected = selected\n this.updateContentForCurrentState()\n }\n \n public override get selected(): boolean {\n return this._selected\n }\n \n \n override updateContentForCurrentState() {\n \n let updateFunction: Function = this.updateContentForNormalState\n if (this.selected && this.highlighted) {\n updateFunction = this.updateContentForSelectedAndHighlightedState\n }\n else if (this.selected) {\n updateFunction = this.updateContentForSelectedState\n }\n else if (this.focused) {\n updateFunction = this.updateContentForFocusedState\n }\n else if (this.highlighted) {\n updateFunction = this.updateContentForHighlightedState\n }\n else if (this.hovered) {\n updateFunction = this.updateContentForHoveredState\n }\n \n if (!IS(updateFunction)) {\n if (this.titleLabel) {\n this.titleLabel.textColor = UIColor.nilColor\n }\n this.backgroundColor = UIColor.nilColor\n }\n else {\n updateFunction.call(this)\n }\n \n this.updateContentForCurrentEnabledState()\n \n }\n \n override updateContentForNormalState() {\n \n this.backgroundColor = this.colors.background.normal\n if (this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.normal\n }\n \n }\n \n override updateContentForHoveredState() {\n \n this.updateContentForNormalState()\n \n if (this.colors.background.hovered) {\n this.backgroundColor = this.colors.background.hovered\n }\n \n if (this.colors.titleLabel.hovered && this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.hovered\n }\n \n }\n \n override updateContentForFocusedState() {\n \n this.updateContentForHoveredState()\n \n if (this.colors.background.focused) {\n this.backgroundColor = this.colors.background.focused\n }\n \n if (this.colors.titleLabel.focused && this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.focused\n }\n \n }\n \n override updateContentForHighlightedState() {\n \n this.backgroundColor = this.colors.background.highlighted\n if (this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.highlighted\n }\n \n }\n \n override updateContentForSelectedState() {\n \n this.backgroundColor = this.colors.background.selected\n if (this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.selected\n }\n \n }\n \n override updateContentForSelectedAndHighlightedState() {\n \n this.updateContentForSelectedState()\n \n if (this.colors.background.selectedAndHighlighted) {\n this.backgroundColor = this.colors.background.selectedAndHighlighted\n }\n \n if (this.colors.titleLabel.selectedAndHighlighted && this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.selectedAndHighlighted\n }\n \n }\n \n \n override set enabled(enabled: boolean) {\n \n // @ts-ignore\n super.enabled = enabled\n \n this.updateContentForCurrentState()\n \n }\n \n override get enabled() {\n \n // @ts-ignore\n return super.enabled\n \n }\n \n override updateContentForCurrentEnabledState() {\n \n if (this.enabled) {\n this.alpha = 1\n }\n else {\n this.alpha = 0.5\n }\n \n this.userInteractionEnabled = this.enabled\n \n }\n \n \n override addStyleClass(styleClassName: string) {\n \n super.addStyleClass(styleClassName)\n \n if (this.styleClassName != styleClassName) {\n \n this.updateContentForCurrentState.call(this)\n \n }\n \n }\n \n \n get titleLabel(): UITextView {\n return this._titleLabel\n }\n \n get imageView() {\n \n return this._imageView\n \n }\n \n \n override layoutSubviews() {\n \n super.layoutSubviews()\n \n let bounds = this.bounds\n \n this.hoverText = this.titleLabel?.text ?? \"\"\n \n // Image only if text is not present\n if (IS_NOT(this.imageView.hidden) && !IS(this.titleLabel?.text)) {\n \n this.imageView.frame = bounds\n \n }\n \n // Text only if image is not present\n if (IS(this.imageView.hidden) && this.titleLabel?.text) {\n \n this.titleLabel.style.left = this.contentPadding + \"px\"\n this.titleLabel.style.right = this.contentPadding + \"px\"\n // this.titleLabel.style.marginLeft = \"\"\n // this.titleLabel.style.right = this.contentPadding\n this.titleLabel.style.top = \"50%\"\n this.titleLabel.style.transform = \"translateY(-50%)\"\n this.titleLabel.frame = new UIRectangle(nil, nil, nil, nil)\n \n if (this.usesAutomaticTitleFontSize) {\n \n const hidden = this.titleLabel.hidden\n \n this.titleLabel.hidden = YES\n \n this.titleLabel.fontSize = 15\n \n this.titleLabel.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(\n 0,\n 0,\n this.bounds.height,\n this.titleLabel.viewHTMLElement.offsetWidth\n ),\n this.titleLabel.intrinsicContentSize(),\n this.titleLabel.fontSize,\n this.minAutomaticFontSize,\n this.maxAutomaticFontSize\n )\n \n this.titleLabel.hidden = hidden\n \n }\n \n \n }\n \n // Image and text both present\n if (IS_NOT(this.imageView.hidden) && this.titleLabel?.text) {\n \n //const imageShareOfWidth = 0.25\n \n bounds = bounds.rectangleWithInset(this.contentPadding)\n \n const imageFrame = bounds.copy()\n imageFrame.width = bounds.height - this.contentPadding * 0.5\n this.imageView.frame = imageFrame\n \n this.titleLabel.style.left = imageFrame.max.x + this.contentPadding + \"px\"\n this.titleLabel.style.right = this.contentPadding + \"px\"\n this.titleLabel.style.top = \"50%\"\n this.titleLabel.style.transform = \"translateY(-50%)\"\n \n if (this.usesAutomaticTitleFontSize) {\n \n const hidden = this.titleLabel.hidden\n \n this.titleLabel.hidden = YES\n \n this.titleLabel.fontSize = 15\n \n this.titleLabel.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(\n 0,\n 0,\n this.bounds.height,\n this.titleLabel.viewHTMLElement.offsetWidth\n ),\n this.titleLabel.intrinsicContentSize(),\n this.titleLabel.fontSize,\n this.minAutomaticFontSize,\n this.maxAutomaticFontSize\n )\n \n this.titleLabel.hidden = hidden\n \n }\n \n }\n \n this.applyClassesAndStyles()\n \n }\n \n override initViewStyleSelectors() {\n \n this.initStyleSelector(\".\" + this.styleClassName, \"background-color: lightblue;\")\n \n // var selectorWithoutImage = \".\" + this.styleClassName + \" .\" + this.imageView.styleClassName + \" + .\" +\n // this.titleLabel.styleClassName;\n \n // this.initStyleSelector(\n // selectorWithoutImage,\n // \"left: \" + this.contentPadding + \";\" +\n // \"right: \" + this.contentPadding + \";\" +\n // \"top: 50%;\" +\n // \"transform: translateY(-50%);\");\n \n }\n \n \n}\n\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAC7B,qBAAwB;AACxB,yBAA4B;AAC5B,sBAA8D;AAC9D,yBAA4B;AAC5B,wBAA2B;AAuBpB,MAAM,iBAAiB,iCAAa;AAAA,EA+BvC,YACI,WACA,aACA,YAAsD,6BAA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KAAK;AAAA,EAEvC;AAAA,EAGS,cAAc,gBAAwB;AAE3C,UAAM,cAAc,cAAc;AAElC,QAAI,KAAK,kBAAkB,gBAAgB;AAEvC,WAAK,6BAA6B,KAAK,IAAI;AAAA,IAE/C;AAAA,EAEJ;AAAA,EAGA,IAAI,aAAyB;AACzB,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,YAAY;AAEZ,WAAO,KAAK;AAAA,EAEhB;AAAA,EAGS,iBAAiB;AAnT9B;AAqTQ,UAAM,eAAe;AAErB,QAAI,SAAS,KAAK;AAElB,SAAK,aAAY,gBAAK,eAAL,mBAAiB,
|
|
4
|
+
"sourcesContent": ["import { UIBaseButton } from \"./UIBaseButton\"\nimport { UIColor } from \"./UIColor\"\nimport { UIImageView } from \"./UIImageView\"\nimport { IS, IS_NOT, IS_NOT_NIL, nil, NO, ValueOf, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UITextView } from \"./UITextView\"\n\n\nexport interface UIButtonColorSpecifier {\n \n titleLabel: UIButtonElementColorSpecifier;\n background: UIButtonElementColorSpecifier;\n \n}\n\n\nexport interface UIButtonElementColorSpecifier {\n \n normal: UIColor;\n hovered?: UIColor;\n highlighted: UIColor;\n focused?: UIColor;\n selected: UIColor;\n selectedAndHighlighted?: UIColor;\n \n}\n\n\nexport class UIButton extends UIBaseButton {\n \n _contentPadding = 0\n _titleLabel: UITextView = nil\n _imageView: UIImageView\n \n usesAutomaticTitleFontSize = NO\n minAutomaticFontSize?: number\n maxAutomaticFontSize?: number = 25\n \n colors: UIButtonColorSpecifier = {\n \n titleLabel: {\n \n normal: UIColor.whiteColor,\n highlighted: UIColor.whiteColor,\n selected: UIColor.whiteColor\n \n },\n \n background: {\n \n normal: UIColor.blueColor,\n highlighted: UIColor.greenColor,\n selected: UIColor.redColor\n \n }\n \n }\n \n \n constructor(\n elementID?: string,\n elementType?: string,\n titleType: string | ValueOf<typeof UITextView.type> = UITextView.type.span\n ) {\n \n super(elementID, elementType)\n \n // Instance variables\n \n this._imageView = new UIImageView(this.elementID + \"ImageView\")\n this._imageView.hidden = YES\n this.addSubview(this.imageView)\n \n this.imageView.fillMode = UIImageView.fillMode.aspectFitIfLarger\n \n \n if (IS_NOT_NIL(titleType)) {\n \n this._titleLabel = new UITextView(this.elementID + \"TitleLabel\", titleType)\n this.titleLabel!.style.whiteSpace = \"nowrap\"\n this.addSubview(this.titleLabel!)\n \n this.titleLabel!.userInteractionEnabled = NO\n \n }\n \n this.contentPadding = 10\n \n this.imageView.userInteractionEnabled = NO\n if (this.titleLabel) {\n this.titleLabel.textAlignment = UITextView.textAlignment.center\n this.titleLabel.nativeSelectionEnabled = NO\n }\n \n }\n \n \n get contentPadding() {\n return this._contentPadding.integerValue\n }\n \n set contentPadding(contentPadding) {\n this._contentPadding = contentPadding\n this.setNeedsLayout()\n }\n \n \n public override set hovered(hovered: boolean) {\n this._hovered = hovered\n this.updateContentForCurrentState()\n }\n \n public override get hovered(): boolean {\n return this._hovered ?? NO\n }\n \n public override set highlighted(highlighted: boolean) {\n this._highlighted = highlighted\n this.updateContentForCurrentState()\n }\n \n public override get highlighted(): boolean {\n return this._highlighted\n }\n \n public override set focused(focused: boolean) {\n this._focused = focused\n if (focused) {\n this.focus()\n }\n else {\n this.blur()\n }\n this.updateContentForCurrentState()\n }\n \n public override get focused(): boolean {\n return this._focused ?? NO\n }\n \n public override set selected(selected: boolean) {\n this._selected = selected\n this.updateContentForCurrentState()\n }\n \n public override get selected(): boolean {\n return this._selected\n }\n \n \n override updateContentForCurrentState() {\n \n let updateFunction: Function = this.updateContentForNormalState\n if (this.selected && this.highlighted) {\n updateFunction = this.updateContentForSelectedAndHighlightedState\n }\n else if (this.selected) {\n updateFunction = this.updateContentForSelectedState\n }\n else if (this.focused) {\n updateFunction = this.updateContentForFocusedState\n }\n else if (this.highlighted) {\n updateFunction = this.updateContentForHighlightedState\n }\n else if (this.hovered) {\n updateFunction = this.updateContentForHoveredState\n }\n \n if (!IS(updateFunction)) {\n if (this.titleLabel) {\n this.titleLabel.textColor = UIColor.nilColor\n }\n this.backgroundColor = UIColor.nilColor\n }\n else {\n updateFunction.call(this)\n }\n \n this.updateContentForCurrentEnabledState()\n \n }\n \n override updateContentForNormalState() {\n \n this.backgroundColor = this.colors.background.normal\n if (this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.normal\n }\n \n }\n \n override updateContentForHoveredState() {\n \n this.updateContentForNormalState()\n \n if (this.colors.background.hovered) {\n this.backgroundColor = this.colors.background.hovered\n }\n \n if (this.colors.titleLabel.hovered && this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.hovered\n }\n \n }\n \n override updateContentForFocusedState() {\n \n this.updateContentForHoveredState()\n \n if (this.colors.background.focused) {\n this.backgroundColor = this.colors.background.focused\n }\n \n if (this.colors.titleLabel.focused && this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.focused\n }\n \n }\n \n override updateContentForHighlightedState() {\n \n this.backgroundColor = this.colors.background.highlighted\n if (this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.highlighted\n }\n \n }\n \n override updateContentForSelectedState() {\n \n this.backgroundColor = this.colors.background.selected\n if (this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.selected\n }\n \n }\n \n override updateContentForSelectedAndHighlightedState() {\n \n this.updateContentForSelectedState()\n \n if (this.colors.background.selectedAndHighlighted) {\n this.backgroundColor = this.colors.background.selectedAndHighlighted\n }\n \n if (this.colors.titleLabel.selectedAndHighlighted && this.titleLabel) {\n this.titleLabel.textColor = this.colors.titleLabel.selectedAndHighlighted\n }\n \n }\n \n \n override set enabled(enabled: boolean) {\n \n // @ts-ignore\n super.enabled = enabled\n \n this.updateContentForCurrentState()\n \n }\n \n override get enabled() {\n \n // @ts-ignore\n return super.enabled\n \n }\n \n override updateContentForCurrentEnabledState() {\n \n if (this.enabled) {\n this.alpha = 1\n }\n else {\n this.alpha = 0.5\n }\n \n this.userInteractionEnabled = this.enabled\n \n }\n \n \n override addStyleClass(styleClassName: string) {\n \n super.addStyleClass(styleClassName)\n \n if (this.styleClassName != styleClassName) {\n \n this.updateContentForCurrentState.call(this)\n \n }\n \n }\n \n \n get titleLabel(): UITextView {\n return this._titleLabel\n }\n \n get imageView() {\n \n return this._imageView\n \n }\n \n \n override layoutSubviews() {\n \n super.layoutSubviews()\n \n let bounds = this.bounds\n \n this.hoverText = this.hoverText ?? this.titleLabel?.text ?? \"\"\n \n // Image only if text is not present\n if (IS_NOT(this.imageView.hidden) && !IS(this.titleLabel?.text)) {\n \n this.imageView.frame = bounds\n \n }\n \n // Text only if image is not present\n if (IS(this.imageView.hidden) && this.titleLabel?.text) {\n \n this.titleLabel.style.left = this.contentPadding + \"px\"\n this.titleLabel.style.right = this.contentPadding + \"px\"\n // this.titleLabel.style.marginLeft = \"\"\n // this.titleLabel.style.right = this.contentPadding\n this.titleLabel.style.top = \"50%\"\n this.titleLabel.style.transform = \"translateY(-50%)\"\n this.titleLabel.frame = new UIRectangle(nil, nil, nil, nil)\n \n if (this.usesAutomaticTitleFontSize) {\n \n const hidden = this.titleLabel.hidden\n \n this.titleLabel.hidden = YES\n \n this.titleLabel.fontSize = 15\n \n this.titleLabel.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(\n 0,\n 0,\n this.bounds.height,\n this.titleLabel.viewHTMLElement.offsetWidth\n ),\n this.titleLabel.intrinsicContentSize(),\n this.titleLabel.fontSize,\n this.minAutomaticFontSize,\n this.maxAutomaticFontSize\n )\n \n this.titleLabel.hidden = hidden\n \n }\n \n \n }\n \n // Image and text both present\n if (IS_NOT(this.imageView.hidden) && this.titleLabel?.text) {\n \n //const imageShareOfWidth = 0.25\n \n bounds = bounds.rectangleWithInset(this.contentPadding)\n \n const imageFrame = bounds.copy()\n imageFrame.width = bounds.height - this.contentPadding * 0.5\n this.imageView.frame = imageFrame\n \n this.titleLabel.style.left = imageFrame.max.x + this.contentPadding + \"px\"\n this.titleLabel.style.right = this.contentPadding + \"px\"\n this.titleLabel.style.top = \"50%\"\n this.titleLabel.style.transform = \"translateY(-50%)\"\n \n if (this.usesAutomaticTitleFontSize) {\n \n const hidden = this.titleLabel.hidden\n \n this.titleLabel.hidden = YES\n \n this.titleLabel.fontSize = 15\n \n this.titleLabel.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(\n 0,\n 0,\n this.bounds.height,\n this.titleLabel.viewHTMLElement.offsetWidth\n ),\n this.titleLabel.intrinsicContentSize(),\n this.titleLabel.fontSize,\n this.minAutomaticFontSize,\n this.maxAutomaticFontSize\n )\n \n this.titleLabel.hidden = hidden\n \n }\n \n }\n \n this.applyClassesAndStyles()\n \n }\n \n override initViewStyleSelectors() {\n \n this.initStyleSelector(\".\" + this.styleClassName, \"background-color: lightblue;\")\n \n // var selectorWithoutImage = \".\" + this.styleClassName + \" .\" + this.imageView.styleClassName + \" + .\" +\n // this.titleLabel.styleClassName;\n \n // this.initStyleSelector(\n // selectorWithoutImage,\n // \"left: \" + this.contentPadding + \";\" +\n // \"right: \" + this.contentPadding + \";\" +\n // \"top: 50%;\" +\n // \"transform: translateY(-50%);\");\n \n }\n \n \n}\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAC7B,qBAAwB;AACxB,yBAA4B;AAC5B,sBAA8D;AAC9D,yBAA4B;AAC5B,wBAA2B;AAuBpB,MAAM,iBAAiB,iCAAa;AAAA,EA+BvC,YACI,WACA,aACA,YAAsD,6BAAW,KAAK,MACxE;AAEE,UAAM,WAAW,WAAW;AAnChC,2BAAkB;AAClB,uBAA0B;AAG1B,sCAA6B;AAE7B,gCAAgC;AAEhC,kBAAiC;AAAA,MAE7B,YAAY;AAAA,QAER,QAAQ,uBAAQ;AAAA,QAChB,aAAa,uBAAQ;AAAA,QACrB,UAAU,uBAAQ;AAAA,MAEtB;AAAA,MAEA,YAAY;AAAA,QAER,QAAQ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AW,IAAI,IAAI,KAAK,iBAAiB;AACtE,WAAK,WAAW,MAAM,QAAQ,KAAK,iBAAiB;AACpD,WAAK,WAAW,MAAM,MAAM;AAC5B,WAAK,WAAW,MAAM,YAAY;AAElC,UAAI,KAAK,4BAA4B;AAEjC,cAAM,SAAS,KAAK,WAAW;AAE/B,aAAK,WAAW,SAAS;AAEzB,aAAK,WAAW,WAAW;AAE3B,aAAK,WAAW,WAAW,6BAAW;AAAA,UAClC,IAAI;AAAA,YACA;AAAA,YACA;AAAA,YACA,KAAK,OAAO;AAAA,YACZ,KAAK,WAAW,gBAAgB;AAAA,UACpC;AAAA,UACA,KAAK,WAAW,qBAAqB;AAAA,UACrC,KAAK,WAAW;AAAA,UAChB,KAAK;AAAA,UACL,KAAK;AAAA,QACT;AAEA,aAAK,WAAW,SAAS;AAAA,MAE7B;AAAA,IAEJ;AAEA,SAAK,sBAAsB;AAAA,EAE/B;AAAA,EAES,yBAAyB;AAE9B,SAAK,kBAAkB,MAAM,KAAK,gBAAgB,8BAA8B;AAAA,EAYpF;AAGJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,8 +3,8 @@ import { UILanguageService } from "./UIInterfaces";
|
|
|
3
3
|
import { UIObject } from "./UIObject";
|
|
4
4
|
import { UIViewController } from "./UIViewController";
|
|
5
5
|
export declare class UICore extends UIObject {
|
|
6
|
-
rootViewController: UIViewController;
|
|
7
6
|
paddingLength: number;
|
|
7
|
+
rootViewController: UIViewController;
|
|
8
8
|
static RootViewControllerClass: typeof UIViewController;
|
|
9
9
|
static main: UICore;
|
|
10
10
|
static languageService: UILanguageService;
|
|
@@ -12,5 +12,5 @@ export declare class UICore extends UIObject {
|
|
|
12
12
|
RouteDidChange: string;
|
|
13
13
|
WindowDidResize: string;
|
|
14
14
|
};
|
|
15
|
-
constructor(rootDivElementID: string, rootViewControllerClass: typeof UIViewController);
|
|
15
|
+
constructor(rootDivElementID: string, rootViewControllerClass: typeof UIViewController, paddingLength?: number);
|
|
16
16
|
}
|
|
@@ -27,9 +27,9 @@ var import_UIRoute = require("./UIRoute");
|
|
|
27
27
|
var import_UIView = require("./UIView");
|
|
28
28
|
var import_UIViewController = require("./UIViewController");
|
|
29
29
|
const _UICore = class extends import_UIObject.UIObject {
|
|
30
|
-
constructor(rootDivElementID, rootViewControllerClass) {
|
|
30
|
+
constructor(rootDivElementID, rootViewControllerClass, paddingLength = 20) {
|
|
31
31
|
super();
|
|
32
|
-
this.paddingLength =
|
|
32
|
+
this.paddingLength = paddingLength;
|
|
33
33
|
_UICore.RootViewControllerClass = rootViewControllerClass;
|
|
34
34
|
_UICore.main = _UICore.main || this;
|
|
35
35
|
const rootViewElement = document.getElementById(rootDivElementID);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../scripts/UICore.ts"],
|
|
4
|
-
"sourcesContent": ["import \"./UICoreExtensions\"\nimport { UILanguageService } from \"./UIInterfaces\"\nimport { nil, NO, UIObject } from \"./UIObject\"\nimport { UIRoute } from \"./UIRoute\"\nimport { UIView } from \"./UIView\"\nimport { UIViewController } from \"./UIViewController\"\n\n\nexport class UICore extends UIObject {\n \n rootViewController: UIViewController\n \n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAO;AAEP,sBAAkC;AAClC,qBAAwB;AACxB,oBAAuB;AACvB,8BAAiC;AAG1B,MAAM,UAAN,cAAqB,yBAAS;AAAA,EAkBjC,YAAY,kBAA0B,
|
|
4
|
+
"sourcesContent": ["import \"./UICoreExtensions\"\nimport { UILanguageService } from \"./UIInterfaces\"\nimport { nil, NO, UIObject } from \"./UIObject\"\nimport { UIRoute } from \"./UIRoute\"\nimport { UIView } from \"./UIView\"\nimport { UIViewController } from \"./UIViewController\"\n\n\nexport class UICore extends UIObject {\n \n rootViewController: UIViewController\n \n \n \n static RootViewControllerClass: typeof UIViewController\n static main: UICore\n \n static languageService: UILanguageService = nil\n \n static readonly broadcastEventName = {\n \n \"RouteDidChange\": \"RouteDidChange\",\n \"WindowDidResize\": \"WindowDidResize\"\n \n }\n \n constructor(rootDivElementID: string, rootViewControllerClass: typeof UIViewController, public paddingLength = 20) {\n \n super()\n \n UICore.RootViewControllerClass = rootViewControllerClass\n UICore.main = UICore.main || this\n \n const rootViewElement = document.getElementById(rootDivElementID)\n const rootView = new UIView(rootDivElementID, rootViewElement)\n rootView.pausesPointerEvents = NO //YES;\n rootView.core = this\n \n if (UICore.RootViewControllerClass) {\n \n if (!(UICore.RootViewControllerClass.prototype instanceof UIViewController) ||\n (UICore.RootViewControllerClass as any) === UIViewController) {\n \n console.log(\n \"Error, UICore.RootViewControllerClass must be UIViewController or a subclass of UIViewController, \" +\n \"falling back to UIViewController.\"\n )\n \n UICore.RootViewControllerClass = UIViewController\n \n }\n \n this.rootViewController = new UICore.RootViewControllerClass(rootView)\n \n }\n else {\n \n this.rootViewController = new UIViewController(rootView)\n \n }\n \n this.rootViewController.viewWillAppear().then(() =>\n this.rootViewController.viewDidAppear()\n )\n \n \n this.rootViewController.view.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n () => {\n \n (document.activeElement as HTMLElement)?.blur?.()\n \n }\n )\n \n \n const windowDidResize = () => {\n \n this.rootViewController.view.forEachViewInSubtree((view) => {\n \n view._frameCache = undefined\n \n })\n // Doing layout two times to prevent page scrollbars from confusing the layout\n this.rootViewController.view.setNeedsLayout()\n this.rootViewController._triggerLayoutViewSubviews()\n UIView.layoutViewsIfNeeded()\n \n this.rootViewController._triggerLayoutViewSubviews()\n //UIView.layoutViewsIfNeeded()\n \n this.rootViewController.view.broadcastEventInSubtree({\n \n name: UICore.broadcastEventName.WindowDidResize,\n parameters: nil\n \n })\n \n }\n \n window.addEventListener(\"resize\", windowDidResize)\n \n const didScroll = () => {\n \n //code\n \n this.rootViewController.view.broadcastEventInSubtree({\n \n name: UIView.broadcastEventName.PageDidScroll,\n parameters: nil\n \n })\n \n \n }\n \n window.addEventListener(\"scroll\", didScroll, false)\n \n const hashDidChange = () => {\n \n //code\n \n this.rootViewController.handleRouteRecursively(UIRoute.currentRoute)\n \n this.rootViewController.view.broadcastEventInSubtree({\n \n name: UICore.broadcastEventName.RouteDidChange,\n parameters: nil\n \n })\n \n \n }\n \n window.addEventListener(\"hashchange\", hashDidChange, false)\n \n hashDidChange()\n \n \n }\n \n \n}\n\n\nArray.prototype.indexOf || (Array.prototype.indexOf = function (d, e) {\n let a\n if (null == this) {\n throw new TypeError(\"\\\"this\\\" is null or not defined\")\n }\n const c = Object(this),\n b = c.length >>> 0\n if (0 === b) {\n return -1\n }\n // @ts-ignore\n a = +e || 0\n Infinity === Math.abs(a) && (a = 0)\n if (a >= b) {\n return -1\n }\n for (a = Math.max(0 <= a ? a : b - Math.abs(a), 0); a < b;) {\n if (a in c && c[a] === d) {\n return a\n }\n a++\n }\n return -1\n})\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAO;AAEP,sBAAkC;AAClC,qBAAwB;AACxB,oBAAuB;AACvB,8BAAiC;AAG1B,MAAM,UAAN,cAAqB,yBAAS;AAAA,EAkBjC,YAAY,kBAA0B,yBAAyD,gBAAgB,IAAI;AAE/G,UAAM;AAFqF;AAI3F,YAAO,0BAA0B;AACjC,YAAO,OAAO,QAAO,QAAQ;AAE7B,UAAM,kBAAkB,SAAS,eAAe,gBAAgB;AAChE,UAAM,WAAW,IAAI,qBAAO,kBAAkB,eAAe;AAC7D,aAAS,sBAAsB;AAC/B,aAAS,OAAO;AAEhB,QAAI,QAAO,yBAAyB;AAEhC,UAAI,EAAE,QAAO,wBAAwB,qBAAqB,6CACrD,QAAO,4BAAoC,0CAAkB;AAE9D,gBAAQ;AAAA,UACJ;AAAA,QAEJ;AAEA,gBAAO,0BAA0B;AAAA,MAErC;AAEA,WAAK,qBA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BAAkB;AAAA,EAClB,mBAAmB;AAEvB;AAyHJ,MAAM,UAAU,YAAY,MAAM,UAAU,UAAU,SAAU,GAAG,GAAG;AAClE,MAAI;AACJ,MAAI,QAAQ,MAAM;AACd,UAAM,IAAI,UAAU,+BAAiC;AAAA,EACzD;AACA,QAAM,IAAI,OAAO,IAAI,GACjB,IAAI,EAAE,WAAW;AACrB,MAAI,MAAM,GAAG;AACT,WAAO;AAAA,EACX;AAEA,MAAI,CAAC,KAAK;AACV,eAAa,KAAK,IAAI,CAAC,MAAM,IAAI;AACjC,MAAI,KAAK,GAAG;AACR,WAAO;AAAA,EACX;AACA,OAAK,IAAI,KAAK,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,KAAI;AACxD,QAAI,KAAK,KAAK,EAAE,OAAO,GAAG;AACtB,aAAO;AAAA,IACX;AACA;AAAA,EACJ;AACA,SAAO;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -85,7 +85,9 @@ class UIDialogView extends import_UIView.UIView {
|
|
|
85
85
|
this._appearedAnimated = animated;
|
|
86
86
|
this.willAppear(animated);
|
|
87
87
|
containerView.addSubview(this);
|
|
88
|
+
this.view.setNeedsLayoutUpToRootView();
|
|
88
89
|
if (animated) {
|
|
90
|
+
import_UIView.UIView.layoutViewsIfNeeded();
|
|
89
91
|
this.layoutSubviews();
|
|
90
92
|
import_UIView.UIView.animateViewOrViewsWithDurationDelayAndFunction(
|
|
91
93
|
this,
|
|
@@ -167,6 +169,7 @@ class UIDialogView extends import_UIView.UIView {
|
|
|
167
169
|
const margin = 20;
|
|
168
170
|
this.view.style.position = "relative";
|
|
169
171
|
this.view.style.zIndex = "" + this.zIndex;
|
|
172
|
+
this.view.setNeedsLayout();
|
|
170
173
|
super.layoutSubviews();
|
|
171
174
|
}
|
|
172
175
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../scripts/UIDialogView.ts"],
|
|
4
|
-
"sourcesContent": ["import { IS_FIREFOX } from \"./ClientCheckers\"\nimport { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { FIRST, IF, IS, nil, NO, YES } from \"./UIObject\"\nimport { UIScrollView } from \"./UIScrollView\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIDialogView<ViewType extends UIView = UIView> extends UIView {\n \n _isAUIDialogView = YES\n _view: ViewType = new UIView() as any\n _appearedAnimated?: boolean\n animationDuration: number = 0.25\n _zIndex: number = 100\n isVisible: boolean = NO\n dismissesOnTapOutside = YES\n \n constructor(elementID?: string, viewHTMLElement?: HTMLElement) {\n \n \n super(elementID, viewHTMLElement)\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerTap,\n function (this: UIDialogView, sender: UIView, event: Event) {\n \n this.didDetectTapOutside(sender, event)\n \n }.bind(this)\n )\n \n this.backgroundColor = UIColor.colorWithRGBA(0, 10, 25).colorWithAlpha(0.75) //CBColor.primaryContentColor.colorWithAlpha(0.75)\n \n this.zIndex = this._zIndex\n \n }\n \n \n didDetectTapOutside(sender: UIView, event: Event) {\n \n if (event.target == this.viewHTMLElement && this.dismissesOnTapOutside) {\n this.dismiss(this._appearedAnimated)\n }\n \n }\n \n \n set zIndex(zIndex: number) {\n \n this._zIndex = zIndex\n this.style.zIndex = \"\" + zIndex\n \n }\n \n get zIndex() {\n \n return this._zIndex\n \n }\n \n \n set view(view: ViewType) {\n \n this._view?.removeFromSuperview()\n \n this._view = view\n \n this.addSubview(view)\n \n }\n \n \n get view(): ViewType {\n \n return this._view\n \n }\n \n \n override willAppear(animated: boolean = NO) {\n \n if (animated) {\n \n this.style.opacity = \"0\"\n \n }\n \n this.style.height = \"\"\n \n this._frame = nil\n \n }\n \n \n animateAppearing() {\n \n this.style.opacity = \"1\"\n \n }\n \n animateDisappearing() {\n \n this.style.opacity = \"0\"\n \n }\n \n \n showInView(containerView: UIView, animated: boolean) {\n \n \n animated = (animated && !IS_FIREFOX)\n \n this._appearedAnimated = animated\n \n this.willAppear(animated)\n \n \n containerView.addSubview(this)\n \n if (animated) {\n \n this.layoutSubviews()\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n () => this.animateAppearing(),\n nil\n )\n \n \n }\n else {\n \n this.setNeedsLayout()\n \n }\n \n this.isVisible = YES\n \n }\n \n \n showInRootView(animated: boolean) {\n \n this.showInView(UICore.main.rootViewController.view, animated)\n \n }\n \n \n dismiss(animated?: boolean) {\n \n if (!this.isVisible) {\n return\n }\n \n animated = (animated && !IS_FIREFOX)\n \n if (animated == undefined) {\n \n animated = this._appearedAnimated\n \n }\n \n if (animated) {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n (() => {\n \n this.animateDisappearing()\n \n }).bind(this),\n () => {\n \n if (this.isVisible == NO) {\n \n this.removeFromSuperview()\n \n }\n \n }\n )\n \n }\n else {\n \n this.removeFromSuperview()\n \n }\n \n this.isVisible = NO\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UICore.broadcastEventName.WindowDidResize) {\n \n this.setNeedsLayout()\n \n }\n \n }\n \n \n override layoutSubviews() {\n \n \n if (!IS(this.view)) {\n \n return\n \n }\n \n //this.frame = this.superview.bounds;\n \n this.setPosition(0, 0, 0, 0, 0, \"100%\")\n this.setPosition(\n 0,\n 0,\n 0,\n 0,\n FIRST(\n IF(this.superview?.isKindOfClass(UINativeScrollView))(() => this.superview?.scrollSize.height ?? 0)\n .ELSE_IF(this.superview?.isKindOfClass(UIScrollView))(() => this.superview?.scrollSize.height ?? 0)\n .ELSE(() => this.superview?.frame.height ?? 0),\n UIView.pageHeight\n ) / UIView.pageScale,\n \"100%\"\n )\n \n const bounds = this.bounds\n \n const margin = 20\n \n //this.view.centerInContainer();\n \n this.view.style.position = \"relative\"\n \n this.view.style.zIndex = \"\" + this.zIndex\n \n // this.view.style.maxHeight = \"\" + (bounds.height - margin * 2).integerValue + \"px\";\n // this.view.style.maxWidth = \"\" + (bounds.width - margin * 2).integerValue + \"px\";\n \n \n // var viewIntrinsicRectangle = this.view.intrinsicContentSize();\n // this.view.frame = new UIRectangle((bounds.width - viewIntrinsicRectangle.width)*0.5, )\n \n super.layoutSubviews()\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,4BAA2B;AAC3B,qBAAwB;AACxB,oBAAuB;AACvB,gCAAmC;AACnC,sBAA4C;AAC5C,0BAA6B;AAC7B,oBAA6C;AAGtC,MAAM,qBAAuD,qBAAO;AAAA,EAUvE,YAAY,WAAoB,iBAA+B;AAG3D,UAAM,WAAW,eAAe;AAXpC,4BAAmB;AACnB,iBAAkB,IAAI,qBAAO;AAE7B,6BAA4B;AAC5B,mBAAkB;AAClB,qBAAqB;AACrB,iCAAwB;AAOpB,SAAK;AAAA,MACD,qBAAO,aAAa;AAAA,MACpB,SAA8B,QAAgB,OAAc;AAExD,aAAK,oBAAoB,QAAQ,KAAK;AAAA,MAE1C,EAAE,KAAK,IAAI;AAAA,IACf;AAEA,SAAK,kBAAkB,uBAAQ,cAAc,GAAG,IAAI,EAAE,EAAE,eAAe,IAAI;AAE3E,SAAK,SAAS,KAAK;AAAA,EAEvB;AAAA,EAGA,oBAAoB,QAAgB,OAAc;AAE9C,QAAI,MAAM,UAAU,KAAK,mBAAmB,KAAK,uBAAuB;AACpE,WAAK,QAAQ,KAAK,iBAAiB;AAAA,IACvC;AAAA,EAEJ;AAAA,EAGA,IAAI,OAAO,QAAgB;AAEvB,SAAK,UAAU;AACf,SAAK,MAAM,SAAS,KAAK;AAAA,EAE7B;AAAA,EAEA,IAAI,SAAS;AAET,WAAO,KAAK;AAAA,EAEhB;AAAA,EAGA,IAAI,KAAK,MAAgB;AA/D7B;AAiEQ,eAAK,UAAL,mBAAY;AAEZ,SAAK,QAAQ;AAEb,SAAK,WAAW,IAAI;AAAA,EAExB;AAAA,EAGA,IAAI,OAAiB;AAEjB,WAAO,KAAK;AAAA,EAEhB;AAAA,EAGS,WAAW,WAAoB,oBAAI;AAExC,QAAI,UAAU;AAEV,WAAK,MAAM,UAAU;AAAA,IAEzB;AAEA,SAAK,MAAM,SAAS;AAEpB,SAAK,SAAS;AAAA,EAElB;AAAA,EAGA,mBAAmB;AAEf,SAAK,MAAM,UAAU;AAAA,EAEzB;AAAA,EAEA,sBAAsB;AAElB,SAAK,MAAM,UAAU;AAAA,EAEzB;AAAA,EAGA,WAAW,eAAuB,UAAmB;AAGjD,eAAY,YAAY,CAAC;AAEzB,SAAK,oBAAoB;AAEzB,SAAK,WAAW,QAAQ;AAGxB,kBAAc,WAAW,IAAI;
|
|
4
|
+
"sourcesContent": ["import { IS_FIREFOX } from \"./ClientCheckers\"\nimport { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { FIRST, IF, IS, nil, NO, YES } from \"./UIObject\"\nimport { UIScrollView } from \"./UIScrollView\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIDialogView<ViewType extends UIView = UIView> extends UIView {\n \n _isAUIDialogView = YES\n _view: ViewType = new UIView() as any\n _appearedAnimated?: boolean\n animationDuration: number = 0.25\n _zIndex: number = 100\n isVisible: boolean = NO\n dismissesOnTapOutside = YES\n \n constructor(elementID?: string, viewHTMLElement?: HTMLElement) {\n \n \n super(elementID, viewHTMLElement)\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerTap,\n function (this: UIDialogView, sender: UIView, event: Event) {\n \n this.didDetectTapOutside(sender, event)\n \n }.bind(this)\n )\n \n this.backgroundColor = UIColor.colorWithRGBA(0, 10, 25).colorWithAlpha(0.75) //CBColor.primaryContentColor.colorWithAlpha(0.75)\n \n this.zIndex = this._zIndex\n \n }\n \n \n didDetectTapOutside(sender: UIView, event: Event) {\n \n if (event.target == this.viewHTMLElement && this.dismissesOnTapOutside) {\n this.dismiss(this._appearedAnimated)\n }\n \n }\n \n \n set zIndex(zIndex: number) {\n \n this._zIndex = zIndex\n this.style.zIndex = \"\" + zIndex\n \n }\n \n get zIndex() {\n \n return this._zIndex\n \n }\n \n \n set view(view: ViewType) {\n \n this._view?.removeFromSuperview()\n \n this._view = view\n \n this.addSubview(view)\n \n }\n \n \n get view(): ViewType {\n \n return this._view\n \n }\n \n \n override willAppear(animated: boolean = NO) {\n \n if (animated) {\n \n this.style.opacity = \"0\"\n \n }\n \n this.style.height = \"\"\n \n this._frame = nil\n \n }\n \n \n animateAppearing() {\n \n this.style.opacity = \"1\"\n \n }\n \n animateDisappearing() {\n \n this.style.opacity = \"0\"\n \n }\n \n \n showInView(containerView: UIView, animated: boolean) {\n \n \n animated = (animated && !IS_FIREFOX)\n \n this._appearedAnimated = animated\n \n this.willAppear(animated)\n \n \n containerView.addSubview(this)\n this.view.setNeedsLayoutUpToRootView()\n \n if (animated) {\n \n UIView.layoutViewsIfNeeded()\n this.layoutSubviews()\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n () => this.animateAppearing(),\n nil\n )\n \n \n }\n else {\n \n this.setNeedsLayout()\n \n }\n \n this.isVisible = YES\n \n }\n \n \n showInRootView(animated: boolean) {\n \n this.showInView(UICore.main.rootViewController.view, animated)\n \n }\n \n \n dismiss(animated?: boolean) {\n \n if (!this.isVisible) {\n return\n }\n \n animated = (animated && !IS_FIREFOX)\n \n if (animated == undefined) {\n \n animated = this._appearedAnimated\n \n }\n \n if (animated) {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n (() => {\n \n this.animateDisappearing()\n \n }).bind(this),\n () => {\n \n if (this.isVisible == NO) {\n \n this.removeFromSuperview()\n \n }\n \n }\n )\n \n }\n else {\n \n this.removeFromSuperview()\n \n }\n \n this.isVisible = NO\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UICore.broadcastEventName.WindowDidResize) {\n \n this.setNeedsLayout()\n \n }\n \n }\n \n \n override layoutSubviews() {\n \n \n if (!IS(this.view)) {\n \n return\n \n }\n \n //this.frame = this.superview.bounds;\n \n this.setPosition(0, 0, 0, 0, 0, \"100%\")\n this.setPosition(\n 0,\n 0,\n 0,\n 0,\n FIRST(\n IF(this.superview?.isKindOfClass(UINativeScrollView))(() => this.superview?.scrollSize.height ?? 0)\n .ELSE_IF(this.superview?.isKindOfClass(UIScrollView))(() => this.superview?.scrollSize.height ?? 0)\n .ELSE(() => this.superview?.frame.height ?? 0),\n UIView.pageHeight\n ) / UIView.pageScale,\n \"100%\"\n )\n \n const bounds = this.bounds\n \n const margin = 20\n \n //this.view.centerInContainer();\n \n this.view.style.position = \"relative\"\n \n this.view.style.zIndex = \"\" + this.zIndex\n \n this.view.setNeedsLayout()\n \n // this.view.style.maxHeight = \"\" + (bounds.height - margin * 2).integerValue + \"px\";\n // this.view.style.maxWidth = \"\" + (bounds.width - margin * 2).integerValue + \"px\";\n \n \n // var viewIntrinsicRectangle = this.view.intrinsicContentSize();\n // this.view.frame = new UIRectangle((bounds.width - viewIntrinsicRectangle.width)*0.5, )\n \n super.layoutSubviews()\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,4BAA2B;AAC3B,qBAAwB;AACxB,oBAAuB;AACvB,gCAAmC;AACnC,sBAA4C;AAC5C,0BAA6B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AAY,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM;AACtC,SAAK;AAAA,MACD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,UACA;AAAA,YACI,qBAAG,UAAK,cAAL,mBAAgB,cAAc,6CAAmB,EAAE,MAAG;AA5OzE,cAAAA,KAAAC;AA4O4E,kBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,WAAW,WAA3B,OAAAC,MAAqC;AAAA,SAAC,EAC7F,SAAQ,UAAK,cAAL,mBAAgB,cAAc,iCAAa,EAAE,MAAG;AA7O7E,cAAAD,KAAAC;AA6OgF,kBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,WAAW,WAA3B,OAAAC,MAAqC;AAAA,SAAC,EACjG,KAAK,MAAG;AA9O7B,cAAAD,KAAAC;AA8OgC,kBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,MAAM,WAAtB,OAAAC,MAAgC;AAAA,SAAC;AAAA,QACjD,qBAAO;AAAA,MACX,IAAI,qBAAO;AAAA,MACX;AAAA,IACJ;AAEA,UAAM,SAAS,KAAK;AAEpB,UAAM,SAAS;AAIf,SAAK,KAAK,MAAM,WAAW;AAE3B,SAAK,KAAK,MAAM,SAAS,KAAK,KAAK;AAEnC,SAAK,KAAK,eAAe;AASzB,UAAM,eAAe;AAAA,EAEzB;AAGJ;",
|
|
6
6
|
"names": ["_a", "_b"]
|
|
7
7
|
}
|
|
@@ -98,19 +98,32 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
98
98
|
if (this._cachedMeasurementStyles) {
|
|
99
99
|
return this._cachedMeasurementStyles;
|
|
100
100
|
}
|
|
101
|
+
if (!this.viewHTMLElement.isConnected) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
this.viewHTMLElement.offsetHeight;
|
|
101
105
|
const computed = window.getComputedStyle(this.viewHTMLElement);
|
|
102
|
-
const
|
|
106
|
+
const fontSizeStr = computed.fontSize;
|
|
107
|
+
const fontSize = parseFloat(fontSizeStr);
|
|
108
|
+
if (!fontSize || isNaN(fontSize)) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const lineHeight = this._parseLineHeight(computed.lineHeight, fontSize);
|
|
112
|
+
if (isNaN(lineHeight)) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
const font = [
|
|
116
|
+
computed.fontStyle || "normal",
|
|
117
|
+
computed.fontVariant || "normal",
|
|
118
|
+
computed.fontWeight || "normal",
|
|
119
|
+
fontSize + "px",
|
|
120
|
+
computed.fontFamily || "sans-serif"
|
|
121
|
+
].join(" ");
|
|
103
122
|
this._cachedMeasurementStyles = {
|
|
104
|
-
font
|
|
105
|
-
computed.fontStyle,
|
|
106
|
-
computed.fontVariant,
|
|
107
|
-
computed.fontWeight,
|
|
108
|
-
computed.fontSize,
|
|
109
|
-
computed.fontFamily
|
|
110
|
-
].join(" "),
|
|
123
|
+
font,
|
|
111
124
|
fontSize,
|
|
112
|
-
lineHeight
|
|
113
|
-
whiteSpace: computed.whiteSpace,
|
|
125
|
+
lineHeight,
|
|
126
|
+
whiteSpace: computed.whiteSpace || "normal",
|
|
114
127
|
paddingLeft: parseFloat(computed.paddingLeft) || 0,
|
|
115
128
|
paddingRight: parseFloat(computed.paddingRight) || 0,
|
|
116
129
|
paddingTop: parseFloat(computed.paddingTop) || 0,
|
|
@@ -301,6 +314,7 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
301
314
|
return maxFittingFontSize;
|
|
302
315
|
}
|
|
303
316
|
intrinsicContentHeight(constrainingWidth = 0) {
|
|
317
|
+
var _a;
|
|
304
318
|
const keyPath = this.viewHTMLElement.innerHTML + "_csf_" + this._getFontCacheKey() + "." + ("" + constrainingWidth).replace(new RegExp("\\.", "g"), "_");
|
|
305
319
|
let cacheObject = _UITextView._intrinsicHeightCache;
|
|
306
320
|
if (this.changesOften) {
|
|
@@ -308,7 +322,24 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
308
322
|
}
|
|
309
323
|
var result = cacheObject.valueForKeyPath(keyPath);
|
|
310
324
|
if ((0, import_UIObject.IS_LIKE_NULL)(result)) {
|
|
311
|
-
|
|
325
|
+
const shouldUseFastPath = (_a = this._useFastMeasurement) != null ? _a : this._shouldUseFastMeasurement();
|
|
326
|
+
if (shouldUseFastPath) {
|
|
327
|
+
const styles = this._getMeasurementStyles();
|
|
328
|
+
if (styles) {
|
|
329
|
+
const size = import_UITextMeasurement.UITextMeasurement.calculateTextSize(
|
|
330
|
+
this.viewHTMLElement,
|
|
331
|
+
this.text || this.innerHTML,
|
|
332
|
+
constrainingWidth || void 0,
|
|
333
|
+
void 0,
|
|
334
|
+
styles
|
|
335
|
+
);
|
|
336
|
+
result = size.height;
|
|
337
|
+
} else {
|
|
338
|
+
result = super.intrinsicContentHeight(constrainingWidth);
|
|
339
|
+
}
|
|
340
|
+
} else {
|
|
341
|
+
result = super.intrinsicContentHeight(constrainingWidth);
|
|
342
|
+
}
|
|
312
343
|
cacheObject.setValueForKeyPath(keyPath, result);
|
|
313
344
|
}
|
|
314
345
|
if (isNaN(result) || !result && !this.text) {
|
|
@@ -318,6 +349,7 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
318
349
|
return result;
|
|
319
350
|
}
|
|
320
351
|
intrinsicContentWidth(constrainingHeight = 0) {
|
|
352
|
+
var _a;
|
|
321
353
|
const keyPath = this.viewHTMLElement.innerHTML + "_csf_" + this._getFontCacheKey() + "." + ("" + constrainingHeight).replace(new RegExp("\\.", "g"), "_");
|
|
322
354
|
let cacheObject = _UITextView._intrinsicWidthCache;
|
|
323
355
|
if (this.changesOften) {
|
|
@@ -325,7 +357,24 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
325
357
|
}
|
|
326
358
|
var result = cacheObject.valueForKeyPath(keyPath);
|
|
327
359
|
if ((0, import_UIObject.IS_LIKE_NULL)(result)) {
|
|
328
|
-
|
|
360
|
+
const shouldUseFastPath = (_a = this._useFastMeasurement) != null ? _a : this._shouldUseFastMeasurement();
|
|
361
|
+
if (shouldUseFastPath) {
|
|
362
|
+
const styles = this._getMeasurementStyles();
|
|
363
|
+
if (styles) {
|
|
364
|
+
const size = import_UITextMeasurement.UITextMeasurement.calculateTextSize(
|
|
365
|
+
this.viewHTMLElement,
|
|
366
|
+
this.text || this.innerHTML,
|
|
367
|
+
void 0,
|
|
368
|
+
constrainingHeight || void 0,
|
|
369
|
+
styles
|
|
370
|
+
);
|
|
371
|
+
result = size.width;
|
|
372
|
+
} else {
|
|
373
|
+
result = super.intrinsicContentWidth(constrainingHeight);
|
|
374
|
+
}
|
|
375
|
+
} else {
|
|
376
|
+
result = super.intrinsicContentWidth(constrainingHeight);
|
|
377
|
+
}
|
|
329
378
|
cacheObject.setValueForKeyPath(keyPath, result);
|
|
330
379
|
}
|
|
331
380
|
return result;
|
|
@@ -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 {\n if (this._cachedMeasurementStyles) {\n return this._cachedMeasurementStyles\n }\n \n const computed = window.getComputedStyle(this.viewHTMLElement)\n const fontSize = parseFloat(computed.fontSize)\n \n this._cachedMeasurementStyles = {\n font: [\n computed.fontStyle,\n computed.fontVariant,\n computed.fontWeight,\n computed.fontSize,\n computed.fontFamily\n ].join(\" \"),\n fontSize: fontSize,\n lineHeight: this._parseLineHeight(computed.lineHeight, fontSize),\n whiteSpace: computed.whiteSpace,\n paddingLeft: parseFloat(computed.paddingLeft) || 0,\n paddingRight: parseFloat(computed.paddingRight) || 0,\n paddingTop: parseFloat(computed.paddingTop) || 0,\n paddingBottom: parseFloat(computed.paddingBottom) || 0\n }\n \n return this._cachedMeasurementStyles\n }\n \n private _parseLineHeight(lineHeight: string, fontSize: number): number {\n if (lineHeight === \"normal\") {\n return fontSize * 1.2\n }\n if (lineHeight.endsWith(\"px\")) {\n return parseFloat(lineHeight)\n }\n const numericLineHeight = parseFloat(lineHeight)\n if (!isNaN(numericLineHeight)) {\n return fontSize * numericLineHeight\n }\n return fontSize * 1.2\n }\n \n private _shouldUseFastMeasurement(): boolean {\n const content = this.text || this.innerHTML\n \n if (this._innerHTMLKey || this._localizedTextObject) {\n return false\n }\n \n if (this.notificationAmount > 0) {\n return false\n }\n \n const hasComplexHTML = /<(?!\\/?(b|i|em|strong|span|br)\\b)[^>]+>/i.test(content)\n \n return !hasComplexHTML\n }\n \n //#endregion\n \n //#region Measurement & Sizing - Public Methods\n \n setUseFastMeasurement(useFast: boolean): void {\n this._useFastMeasurement = useFast\n this._intrinsicSizesCache = {}\n }\n \n invalidateMeasurementStrategy(): void {\n this._useFastMeasurement = undefined\n this._invalidateMeasurementStyles()\n }\n \n //#endregion\n \n //#region Getters & Setters - Text Alignment\n \n get textAlignment() {\n // @ts-ignore\n return this.style.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\n \n override usesVirtualLayoutingForIntrinsicSizing = NO\n \n //#endregion\n \n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this._getFontCacheKey()) + \".\" +\n (\"\" + constrainingWidth).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicHeightCache\n \n if (this.changesOften) {\n cacheObject = this._intrinsicHeightCache\n }\n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n if (IS_LIKE_NULL(result)) {\n result = super.intrinsicContentHeight(constrainingWidth)\n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n if (isNaN(result) || (!result && !this.text)) {\n result = super.intrinsicContentHeight(constrainingWidth)\n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n return result\n }\n \n override intrinsicContentWidth(constrainingHeight = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this._getFontCacheKey()) + \".\" +\n (\"\" + constrainingHeight).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicWidthCache\n \n if (this.changesOften) {\n cacheObject = this._intrinsicWidthCache\n }\n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n if (IS_LIKE_NULL(result)) {\n result = super.intrinsicContentWidth(constrainingHeight)\n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n return result\n }\n \n \n // Override addStyleClass to invalidate font cache\n override addStyleClass(styleClass: string) {\n super.addStyleClass(styleClass)\n this._invalidateFontCache()\n }\n \n // Override removeStyleClass to invalidate font cache\n override removeStyleClass(styleClass: string) {\n super.removeStyleClass(styleClass)\n this._invalidateFontCache()\n }\n \n \n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AAExB,sBAAqE;AACrE,yBAA4B;AAC5B,+BAAwD;AACxD,oBAA6C;AAGtC,MAAM,cAAN,cAAyB,qBAAO;AAAA,EAuCnC,YACI,WACA,eAAyD,YAAW,KAAK,WACzE,kBAAkB,MACpB;AAEE,UAAM,WAAW,iBAAiB,YAAY;
|
|
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 + \"_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 + \"_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;AACxD,oBAA6C;AAGtC,MAAM,cAAN,cAAyB,qBAAO;AAAA,EAuCnC,YACI,WACA,eAAyD,YAAW,KAAK,WACzE,kBAAkB,MACpB;AAEE,UAAM,WAAW,iBAAiB,YAAY;AAqalD,sBAAa;AACb,sBAAa;AACb,+BAAsB;AAMtB,sBAAsB,YAAW;AAEjC,yBAAgB;AAQhB,uCAA8B;AAI9B,SAAQ,4BAA4B;AAAA,MAChC,UAAU,KAAK,MAAM,YAAY;AAAA,MACjC,YAAY,KAAK,MAAM,cAAc;AAAA,MACrC,YAAY,KAAK,MAAM,cAAc;AAAA,MACrC,WAAW,KAAK,MAAM,aAAa;AAAA,MACnC,cAAc,KAAK,aAAa,KAAK,GAAG;AAAA,IAC5C;AAMA,wBAAe;AAGf,iCAA+E,IAAI,yBAAS;AAC5F,gCAA8E,IAAI,yBAAS;AAK3F,SAAS,yCAAyC;AA9c9C,SAAK,OAAO;AAEZ,SAAK,MAAM,WAAW;AACtB,SAAK,MAAM,eAAe;AAC1B,SAAK,eAAe;AAEpB,SAAK,YAAY,KAAK;AAEtB,SAAK,yBAAyB;AAE9B,IAAC,KAAoB,oBAAoB;AAAA,MACrC,OAAO;AAAA,QACH,SAAS;AAAA,QACT,eAAe;AAAA,QAIf,gBAAgB;AAAA,QAChB,YAAY;AAAA,QAGZ,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,cAAc;AAAA,MAClB;AAAA,IACJ,CAAC;AAED,QAAI,gBAAgB,YAAW,KAAK,UAAU;AAC1C,WAA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izedTextObject(localizedTextObject: UILocalizedTextObject | undefined);
|
|
204
204
|
get innerHTML(): string;
|
|
205
205
|
set innerHTML(innerHTML: string);
|
|
206
|
-
set hoverText(hoverText: string);
|
|
207
|
-
get hoverText(): string;
|
|
206
|
+
set hoverText(hoverText: string | undefined | null);
|
|
207
|
+
get hoverText(): string | undefined | null;
|
|
208
208
|
get scrollSize(): UIRectangle;
|
|
209
209
|
get dialogView(): UIDialogView | undefined;
|
|
210
210
|
get rootView(): UIView;
|
|
@@ -322,11 +322,14 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
set hoverText(hoverText) {
|
|
325
|
-
|
|
325
|
+
if ((0, import_UIObject.IS_NOT_LIKE_NULL)(hoverText)) {
|
|
326
|
+
this.viewHTMLElement.setAttribute("title", hoverText);
|
|
327
|
+
} else {
|
|
328
|
+
this.viewHTMLElement.removeAttribute("title");
|
|
329
|
+
}
|
|
326
330
|
}
|
|
327
331
|
get hoverText() {
|
|
328
|
-
|
|
329
|
-
return (_a = this.viewHTMLElement.getAttribute("title")) != null ? _a : "";
|
|
332
|
+
return this.viewHTMLElement.getAttribute("title");
|
|
330
333
|
}
|
|
331
334
|
get scrollSize() {
|
|
332
335
|
return new import_UIRectangle.UIRectangle(0, 0, this.viewHTMLElement.scrollHeight, this.viewHTMLElement.scrollWidth);
|