uicore-ts 1.0.521 → 1.0.525
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.d.ts +2 -2
- package/compiledScripts/UIButton.js +1 -0
- package/compiledScripts/UIButton.js.map +2 -2
- package/compiledScripts/UICore.js +3 -1
- package/compiledScripts/UICore.js.map +2 -2
- package/compiledScripts/UICoreExtensions.d.ts +3 -1
- package/compiledScripts/UICoreExtensions.js +20 -3
- package/compiledScripts/UICoreExtensions.js.map +2 -2
- package/compiledScripts/UIDialogView.d.ts +2 -2
- package/compiledScripts/UIDialogView.js +1 -0
- package/compiledScripts/UIDialogView.js.map +2 -2
- package/compiledScripts/UIImageView.js +4 -1
- package/compiledScripts/UIImageView.js.map +2 -2
- package/compiledScripts/UILinkButton.d.ts +1 -1
- package/compiledScripts/UINativeScrollView.d.ts +1 -0
- package/compiledScripts/UINativeScrollView.js +7 -3
- package/compiledScripts/UINativeScrollView.js.map +2 -2
- package/compiledScripts/UIObject.d.ts +14 -4
- package/compiledScripts/UIObject.js +4 -0
- package/compiledScripts/UIObject.js.map +2 -2
- package/compiledScripts/UIRootViewController.js +8 -9
- package/compiledScripts/UIRootViewController.js.map +2 -2
- package/compiledScripts/UITableView.d.ts +1 -0
- package/compiledScripts/UITableView.js +3 -1
- package/compiledScripts/UITableView.js.map +2 -2
- package/compiledScripts/UITextField.d.ts +1 -1
- package/compiledScripts/UITextField.js.map +2 -2
- package/compiledScripts/UITextView.js +4 -2
- package/compiledScripts/UITextView.js.map +2 -2
- package/compiledScripts/UIView.d.ts +12 -3
- package/compiledScripts/UIView.js +101 -40
- package/compiledScripts/UIView.js.map +2 -2
- package/compiledScripts/UIViewController.js +4 -2
- package/compiledScripts/UIViewController.js.map +2 -2
- package/package.json +1 -1
- package/scripts/UIButton.ts +2 -2
- package/scripts/UICore.ts +37 -36
- package/scripts/UICoreExtensions.ts +28 -4
- package/scripts/UIDialogView.ts +2 -2
- package/scripts/UIImageView.ts +1 -1
- package/scripts/UINativeScrollView.ts +10 -4
- package/scripts/UIObject.ts +24 -6
- package/scripts/UIRootViewController.ts +16 -5
- package/scripts/UITableView.ts +4 -5
- package/scripts/UITextField.ts +1 -1
- package/scripts/UITextView.ts +20 -12
- package/scripts/UIView.ts +165 -65
- package/scripts/UIViewController.ts +7 -3
|
@@ -31,7 +31,7 @@ export declare class UITextField extends UITextView {
|
|
|
31
31
|
} & {
|
|
32
32
|
TextChange: string;
|
|
33
33
|
};
|
|
34
|
-
get controlEventTargetAccumulator(): UIViewAddControlEventTargetObject<UITextField>;
|
|
34
|
+
get controlEventTargetAccumulator(): UIViewAddControlEventTargetObject<typeof UITextField>;
|
|
35
35
|
get viewHTMLElement(): HTMLInputElement;
|
|
36
36
|
set text(text: string);
|
|
37
37
|
get text(): string;
|
|
@@ -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 \n this.backgroundColor = UIColor.whiteColor\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n \n this.viewHTMLElement.oninput = (event) => {\n this.sendControlEventForKey(UITextField.controlEvent.TextChange, event)\n }\n \n \n this.style.webkitUserSelect = \"text\"\n \n this.nativeSelectionEnabled = YES\n \n this.pausesPointerEvents = NO\n \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<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,WAAW,MAAM,eAAe;AAEtC,SAAK,gBAAgB,aAAa,QAAQ,MAAM;AAEhD,SAAK,kBAAkB,uBAAQ;AAE/B,SAAK;AAAA,MACD,qBAAO,aAAa;AAAA,MACpB,CAAC,QAAQ,UAAU,OAAO,MAAM;AAAA,IACpC;AAEA,SAAK,gBAAgB,UAAU,CAAC,UAAU;AACtC,WAAK,uBAAuB,aAAY,aAAa,YAAY,KAAK;AAAA,IAC1E;AAGA,SAAK,MAAM,mBAAmB;AAE9B,SAAK,yBAAyB;AAE9B,SAAK,sBAAsB;AAAA,EAG/B;AAAA,EAUA,IAAa,
|
|
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 \n this.backgroundColor = UIColor.whiteColor\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n \n this.viewHTMLElement.oninput = (event) => {\n this.sendControlEventForKey(UITextField.controlEvent.TextChange, event)\n }\n \n \n this.style.webkitUserSelect = \"text\"\n \n this.nativeSelectionEnabled = YES\n \n this.pausesPointerEvents = NO\n \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\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AAgB,aAAa,KAAK,cAAc,eAAe,mBAAG;AAAA,EAEpG;AAAA,EAGS,yBAAyB,OAA6B;AAE3D,UAAM,yBAAyB,KAAK;AAEpC,QAAI,MAAM,QAAQ,qBAAO,mBAAmB,mBAAmB,MAAM,QACjE,qBAAO,mBAAmB,iBAAiB;AAE3C,WAAK,iCAAiC;AAAA,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;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;AAvJO,IAAM,cAAN;AAAM,YAmCO,eAAe,OAAO,OAAO,CAAC,GAAG,6BAAW,cAAc;AAAA,EAEtE,cAAc;AAElB,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -115,8 +115,10 @@ const _UITextView = class extends import_UIView.UIView {
|
|
|
115
115
|
if (this.viewHTMLElement.innerHTML != this.textPrefix + text + this.textSuffix + notificationText) {
|
|
116
116
|
this.viewHTMLElement.innerHTML = this.textPrefix + (0, import_UIObject.FIRST)(text, "") + this.textSuffix + notificationText;
|
|
117
117
|
}
|
|
118
|
-
this.
|
|
119
|
-
|
|
118
|
+
if (this.changesOften) {
|
|
119
|
+
this._intrinsicHeightCache = new import_UIObject.UIObject();
|
|
120
|
+
this._intrinsicWidthCache = new import_UIObject.UIObject();
|
|
121
|
+
}
|
|
120
122
|
this.setNeedsLayout();
|
|
121
123
|
}
|
|
122
124
|
set innerHTML(innerHTML) {
|
|
@@ -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, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport type { ValueOf } from \"./UIObject\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UITextView extends UIView {\n \n \n _textColor: UIColor = UITextView.defaultTextColor\n _textAlignment?: ValueOf<typeof UITextView.textAlignment>\n \n _isSingleLine = YES\n \n textPrefix = \"\"\n textSuffix = \"\"\n \n _notificationAmount = 0\n \n _minFontSize?: number\n _maxFontSize?: number\n \n _automaticFontSizeSelection = NO\n \n changesOften = NO\n \n static defaultTextColor = UIColor.blackColor\n static notificationTextColor = UIColor.redColor\n \n static _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n static _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n \n static _ptToPx: number\n static _pxToPt: number\n _text?: string\n \n \n constructor(elementID?: string, textViewType: string | ValueOf<typeof UITextView.type> = UITextView.type.paragraph, viewHTMLElement = null) {\n \n super(elementID, viewHTMLElement, textViewType)\n \n this.text = \"\"\n \n this.style.overflow = \"hidden\"\n this.style.textOverflow = \"ellipsis\"\n this.isSingleLine = YES\n \n this.textColor = this.textColor\n \n this.userInteractionEnabled = YES\n \n \n if (textViewType == UITextView.type.textArea) {\n \n this.pausesPointerEvents = YES\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n \n \n }\n \n \n }\n \n \n static _determinePXAndPTRatios() {\n \n if (UITextView._ptToPx) {\n return\n }\n \n const o = document.createElement(\"div\")\n o.style.width = \"1000pt\"\n document.body.appendChild(o)\n UITextView._ptToPx = o.clientWidth / 1000\n document.body.removeChild(o)\n UITextView._pxToPt = 1 / UITextView._ptToPx\n \n }\n \n \n static type = {\n \n \"paragraph\": \"p\",\n \"header1\": \"h1\",\n \"header2\": \"h2\",\n \"header3\": \"h3\",\n \"header4\": \"h4\",\n \"header5\": \"h5\",\n \"header6\": \"h6\",\n \"textArea\": \"textarea\",\n \"textField\": \"input\",\n \"span\": \"span\",\n \"label\": \"label\"\n \n } as const\n \n \n static textAlignment = {\n \n \"left\": \"left\",\n \"center\": \"center\",\n \"right\": \"right\",\n \"justify\": \"justify\"\n \n } as const\n \n get textAlignment() {\n // @ts-ignore\n return this.style.textAlign\n }\n \n set textAlignment(textAlignment: ValueOf<typeof UITextView.textAlignment>) {\n this._textAlignment = textAlignment\n this.style.textAlign = textAlignment\n }\n \n \n get textColor() {\n return this._textColor\n }\n \n set textColor(color: UIColor) {\n \n this._textColor = color || UITextView.defaultTextColor\n this.style.color = this._textColor.stringValue\n \n }\n \n \n get isSingleLine() {\n \n return this._isSingleLine\n \n }\n \n set isSingleLine(isSingleLine: boolean) {\n \n this._isSingleLine = isSingleLine\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n if (isSingleLine) {\n \n this.style.whiteSpace = \"pre\"\n \n return\n \n }\n \n this.style.whiteSpace = \"pre-wrap\"\n \n }\n \n \n get notificationAmount() {\n \n return this._notificationAmount\n \n }\n \n set notificationAmount(notificationAmount: number) {\n \n if (this._notificationAmount == notificationAmount) {\n \n return\n \n }\n \n this._notificationAmount = notificationAmount\n \n this.text = this.text\n \n this.setNeedsLayoutUpToRootView()\n \n this.notificationAmountDidChange(notificationAmount)\n \n }\n \n notificationAmountDidChange(notificationAmount: number) {\n \n \n }\n \n \n get text() {\n \n return (this._text || this.viewHTMLElement.innerHTML)\n \n }\n \n set text(text) {\n \n this._text = text\n \n var notificationText = \"\"\n \n if (this.notificationAmount) {\n \n notificationText = \"<span style=\\\"color: \" + UITextView.notificationTextColor.stringValue + \";\\\">\" +\n (\" (\" + this.notificationAmount + \")\").bold() + \"</span>\"\n \n }\n \n if (this.viewHTMLElement.innerHTML != this.textPrefix + text + this.textSuffix + notificationText) {\n \n this.viewHTMLElement.innerHTML = this.textPrefix + FIRST(text, \"\") + this.textSuffix + notificationText\n \n }\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n this.setNeedsLayout()\n \n }\n \n override set innerHTML(innerHTML: string) {\n \n this.text = innerHTML\n \n }\n \n override get innerHTML() {\n \n return this.viewHTMLElement.innerHTML\n \n }\n \n \n setText(key: string, defaultString: string, parameters?: { [x: string]: string | UILocalizedTextObject }) {\n \n this.setInnerHTML(key, defaultString, parameters)\n \n }\n \n \n get fontSize() {\n \n const style = window.getComputedStyle(this.viewHTMLElement, null).fontSize\n \n const result = (parseFloat(style) * UITextView._pxToPt)\n \n return result\n \n }\n \n set fontSize(fontSize: number) {\n \n \n this.style.fontSize = \"\" + fontSize + \"pt\"\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any // MEETOD LUUA!!!!\n \n \n }\n \n \n useAutomaticFontSize(minFontSize: number = nil, maxFontSize: number = nil) {\n \n \n this._automaticFontSizeSelection = YES\n \n \n this._minFontSize = minFontSize\n \n this._maxFontSize = maxFontSize\n \n this.setNeedsLayout()\n \n \n }\n \n \n static automaticallyCalculatedFontSize(\n bounds: UIRectangle,\n currentSize: UIRectangle,\n currentFontSize: number,\n minFontSize?: number,\n maxFontSize?: number\n ) {\n \n minFontSize = FIRST(minFontSize, 1)\n \n maxFontSize = FIRST(maxFontSize, 100000000000)\n \n \n const heightMultiplier = bounds.height / (currentSize.height + 1)\n \n const widthMultiplier = bounds.width / (currentSize.width + 1)\n \n \n var multiplier = heightMultiplier\n \n if (heightMultiplier > widthMultiplier) {\n \n multiplier = widthMultiplier\n \n \n }\n \n \n const maxFittingFontSize = currentFontSize * multiplier\n \n \n if (maxFittingFontSize > maxFontSize) {\n \n return maxFontSize\n \n }\n \n if (minFontSize > maxFittingFontSize) {\n \n return minFontSize\n \n }\n \n \n return maxFittingFontSize\n \n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n }\n \n \n override willMoveToSuperview(superview: UIView) {\n \n super.willMoveToSuperview(superview)\n \n }\n \n \n override layoutSubviews() {\n \n super.layoutSubviews()\n \n \n if (this._automaticFontSizeSelection) {\n \n this.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(0, 0, 1 *\n this.viewHTMLElement.offsetHeight, 1 *\n this.viewHTMLElement.offsetWidth),\n this.intrinsicContentSize(),\n this.fontSize,\n this._minFontSize,\n this._maxFontSize\n )\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingWidth).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicHeightCache\n \n if (this.changesOften) {\n \n // @ts-ignore\n cacheObject = this._intrinsicHeightCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentHeight(constrainingWidth)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n return result\n \n }\n \n override intrinsicContentWidth(constrainingHeight = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingHeight).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicWidthCache\n \n if (this.changesOften) {\n \n // @ts-ignore\n cacheObject = this._intrinsicWidthCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentWidth(constrainingHeight)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n return result\n \n }\n \n \n override intrinsicContentSize() {\n \n // This works but is slow\n const result = this.intrinsicContentSizeWithConstraints(nil, nil)\n \n return result\n \n }\n \n \n}\n\n\nUITextView._determinePXAndPTRatios()\n\n\n// /**\n// * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.\n// * \n// * @param {String} text The text to be rendered.\n// * @param {String} font The css font descriptor that text is to be rendered with (e.g. \"bold 14px verdana\").\n// * \n// * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393\n// */\n// function getTextMetrics(text, font) {\n// // re-use canvas object for better performance\n// var canvas = getTextMetrics.canvas || (getTextMetrics.canvas = document.createElement(\"canvas\"));\n// var context = canvas.getContext(\"2d\");\n// context.font = font;\n// var metrics = context.measureText(text);\n// return metrics;\n// }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AAExB,sBAA4D;AAC5D,yBAA4B;AAE5B,oBAA6C;AAGtC,MAAM,cAAN,cAAyB,qBAAO;AAAA,EAmCnC,
|
|
4
|
+
"sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UILocalizedTextObject } from \"./UIInterfaces\"\nimport { FIRST, IS_LIKE_NULL, nil, NO, UIObject, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport type { ValueOf } from \"./UIObject\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UITextView extends UIView {\n \n \n _textColor: UIColor = UITextView.defaultTextColor\n _textAlignment?: ValueOf<typeof UITextView.textAlignment>\n \n _isSingleLine = YES\n \n textPrefix = \"\"\n textSuffix = \"\"\n \n _notificationAmount = 0\n \n _minFontSize?: number\n _maxFontSize?: number\n \n _automaticFontSizeSelection = NO\n \n changesOften = NO\n \n static defaultTextColor = UIColor.blackColor\n static notificationTextColor = UIColor.redColor\n \n static _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n static _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n \n static _ptToPx: number\n static _pxToPt: number\n _text?: string\n \n \n constructor(\n elementID?: string,\n textViewType: string | ValueOf<typeof UITextView.type> = UITextView.type.paragraph,\n viewHTMLElement = null\n ) {\n \n super(elementID, viewHTMLElement, textViewType)\n \n this.text = \"\"\n \n this.style.overflow = \"hidden\"\n this.style.textOverflow = \"ellipsis\"\n this.isSingleLine = YES\n \n this.textColor = this.textColor\n \n this.userInteractionEnabled = YES\n \n \n if (textViewType == UITextView.type.textArea) {\n \n this.pausesPointerEvents = YES\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n \n \n }\n \n \n }\n \n \n static _determinePXAndPTRatios() {\n \n if (UITextView._ptToPx) {\n return\n }\n \n const o = document.createElement(\"div\")\n o.style.width = \"1000pt\"\n document.body.appendChild(o)\n UITextView._ptToPx = o.clientWidth / 1000\n document.body.removeChild(o)\n UITextView._pxToPt = 1 / UITextView._ptToPx\n \n }\n \n \n static type = {\n \n \"paragraph\": \"p\",\n \"header1\": \"h1\",\n \"header2\": \"h2\",\n \"header3\": \"h3\",\n \"header4\": \"h4\",\n \"header5\": \"h5\",\n \"header6\": \"h6\",\n \"textArea\": \"textarea\",\n \"textField\": \"input\",\n \"span\": \"span\",\n \"label\": \"label\"\n \n } as const\n \n \n static textAlignment = {\n \n \"left\": \"left\",\n \"center\": \"center\",\n \"right\": \"right\",\n \"justify\": \"justify\"\n \n } as const\n \n get textAlignment() {\n // @ts-ignore\n return this.style.textAlign\n }\n \n set textAlignment(textAlignment: ValueOf<typeof UITextView.textAlignment>) {\n this._textAlignment = textAlignment\n this.style.textAlign = textAlignment\n }\n \n \n get textColor() {\n return this._textColor\n }\n \n set textColor(color: UIColor) {\n \n this._textColor = color || UITextView.defaultTextColor\n this.style.color = this._textColor.stringValue\n \n }\n \n \n get isSingleLine() {\n \n return this._isSingleLine\n \n }\n \n set isSingleLine(isSingleLine: boolean) {\n \n this._isSingleLine = isSingleLine\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n if (isSingleLine) {\n \n this.style.whiteSpace = \"pre\"\n \n return\n \n }\n \n this.style.whiteSpace = \"pre-wrap\"\n \n }\n \n \n get notificationAmount() {\n \n return this._notificationAmount\n \n }\n \n set notificationAmount(notificationAmount: number) {\n \n if (this._notificationAmount == notificationAmount) {\n \n return\n \n }\n \n this._notificationAmount = notificationAmount\n \n this.text = this.text\n \n this.setNeedsLayoutUpToRootView()\n \n this.notificationAmountDidChange(notificationAmount)\n \n }\n \n notificationAmountDidChange(notificationAmount: number) {\n \n \n }\n \n \n get text() {\n \n return (this._text || this.viewHTMLElement.innerHTML)\n \n }\n \n set text(text) {\n \n this._text = text\n \n var notificationText = \"\"\n \n if (this.notificationAmount) {\n \n notificationText = \"<span style=\\\"color: \" + UITextView.notificationTextColor.stringValue + \";\\\">\" +\n (\" (\" + this.notificationAmount + \")\").bold() + \"</span>\"\n \n }\n \n if (this.viewHTMLElement.innerHTML != this.textPrefix + text + this.textSuffix + notificationText) {\n \n this.viewHTMLElement.innerHTML = this.textPrefix + FIRST(text, \"\") + this.textSuffix + notificationText\n \n }\n \n if (this.changesOften) {\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n }\n \n this.setNeedsLayout()\n \n }\n \n override set innerHTML(innerHTML: string) {\n \n this.text = innerHTML\n \n }\n \n override get innerHTML() {\n \n return this.viewHTMLElement.innerHTML\n \n }\n \n \n setText(key: string, defaultString: string, parameters?: { [x: string]: string | UILocalizedTextObject }) {\n \n this.setInnerHTML(key, defaultString, parameters)\n \n }\n \n \n get fontSize() {\n \n const style = window.getComputedStyle(this.viewHTMLElement, null).fontSize\n \n const result = (parseFloat(style) * UITextView._pxToPt)\n \n return result\n \n }\n \n set fontSize(fontSize: number) {\n \n \n this.style.fontSize = \"\" + fontSize + \"pt\"\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any // MEETOD LUUA!!!!\n \n \n }\n \n \n useAutomaticFontSize(minFontSize: number = nil, maxFontSize: number = nil) {\n \n \n this._automaticFontSizeSelection = YES\n \n \n this._minFontSize = minFontSize\n \n this._maxFontSize = maxFontSize\n \n this.setNeedsLayout()\n \n \n }\n \n \n static automaticallyCalculatedFontSize(\n bounds: UIRectangle,\n currentSize: UIRectangle,\n currentFontSize: number,\n minFontSize?: number,\n maxFontSize?: number\n ) {\n \n minFontSize = FIRST(minFontSize, 1)\n \n maxFontSize = FIRST(maxFontSize, 100000000000)\n \n \n const heightMultiplier = bounds.height / (currentSize.height + 1)\n \n const widthMultiplier = bounds.width / (currentSize.width + 1)\n \n \n var multiplier = heightMultiplier\n \n if (heightMultiplier > widthMultiplier) {\n \n multiplier = widthMultiplier\n \n \n }\n \n \n const maxFittingFontSize = currentFontSize * multiplier\n \n \n if (maxFittingFontSize > maxFontSize) {\n \n return maxFontSize\n \n }\n \n if (minFontSize > maxFittingFontSize) {\n \n return minFontSize\n \n }\n \n \n return maxFittingFontSize\n \n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n }\n \n \n override willMoveToSuperview(superview: UIView) {\n \n super.willMoveToSuperview(superview)\n \n }\n \n \n override layoutSubviews() {\n \n super.layoutSubviews()\n \n \n if (this._automaticFontSizeSelection) {\n \n this.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(0, 0, 1 *\n this.viewHTMLElement.offsetHeight, 1 *\n this.viewHTMLElement.offsetWidth),\n this.intrinsicContentSize(),\n this.fontSize,\n this._minFontSize,\n this._maxFontSize\n )\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingWidth).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicHeightCache\n \n if (this.changesOften) {\n \n // @ts-ignore\n cacheObject = this._intrinsicHeightCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentHeight(constrainingWidth)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n return result\n \n }\n \n override intrinsicContentWidth(constrainingHeight = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingHeight).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicWidthCache\n \n if (this.changesOften) {\n \n // @ts-ignore\n cacheObject = this._intrinsicWidthCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentWidth(constrainingHeight)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n return result\n \n }\n \n \n override intrinsicContentSize() {\n \n // This works but is slow\n const result = this.intrinsicContentSizeWithConstraints(nil, nil)\n \n return result\n \n }\n \n \n}\n\n\nUITextView._determinePXAndPTRatios()\n\n\n// /**\n// * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.\n// * \n// * @param {String} text The text to be rendered.\n// * @param {String} font The css font descriptor that text is to be rendered with (e.g. \"bold 14px verdana\").\n// * \n// * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393\n// */\n// function getTextMetrics(text, font) {\n// // re-use canvas object for better performance\n// var canvas = getTextMetrics.canvas || (getTextMetrics.canvas = document.createElement(\"canvas\"));\n// var context = canvas.getContext(\"2d\");\n// context.font = font;\n// var metrics = context.measureText(text);\n// return metrics;\n// }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AAExB,sBAA4D;AAC5D,yBAA4B;AAE5B,oBAA6C;AAGtC,MAAM,cAAN,cAAyB,qBAAO;AAAA,EAmCnC,YACI,WACA,eAAyD,YAAW,KAAK,WACzE,kBAAkB,MACpB;AAEE,UAAM,WAAW,iBAAiB,YAAY;AAtClD,sBAAsB,YAAW;AAGjC,yBAAgB;AAEhB,sBAAa;AACb,sBAAa;AAEb,+BAAsB;AAKtB,uCAA8B;AAE9B,wBAAe;AAQf,iCAA+E,IAAI,yBAAS;AAC5F,gCAA8E,IAAI,yBAAS;AAgBvF,SAAK,OAAO;AAEZ,SAAK,MAAM,WAAW;AACtB,SAAK,MAAM,eAAe;AAC1B,SAAK,eAAe;AAEpB,SAAK,YAAY,KAAK;AAEtB,SAAK,yBAAyB;AAG9B,QAAI,gBAAgB,YAAW,KAAK,UAAU;AAE1C,WAAK,sBAAsB;AAE3B,WAAK;AAAA,QACD,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6VJ,WAAW,wBAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -37,6 +37,11 @@ declare module AutoLayout {
|
|
|
37
37
|
GEQ = 2
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
declare global {
|
|
41
|
+
interface HTMLElement {
|
|
42
|
+
UIView?: UIView;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
40
45
|
export interface LooseObject {
|
|
41
46
|
[key: string]: any;
|
|
42
47
|
}
|
|
@@ -118,7 +123,7 @@ export declare class UIView extends UIObject {
|
|
|
118
123
|
static _pageScale: number;
|
|
119
124
|
_scale: number;
|
|
120
125
|
isInternalScaling: boolean;
|
|
121
|
-
|
|
126
|
+
static resizeObserver: ResizeObserver;
|
|
122
127
|
private _isMovable;
|
|
123
128
|
makeNotMovable?: () => void;
|
|
124
129
|
private _isResizable;
|
|
@@ -130,6 +135,8 @@ export declare class UIView extends UIObject {
|
|
|
130
135
|
static _onWindowTouchMove: (event: TouchEvent) => void;
|
|
131
136
|
static _onWindowMouseMove: (event: MouseEvent) => void;
|
|
132
137
|
static _onWindowMouseup: (event: MouseEvent) => void;
|
|
138
|
+
private _resizeObserverEntry?;
|
|
139
|
+
private _intrinsicSizesCache;
|
|
133
140
|
constructor(elementID?: string, viewHTMLElement?: HTMLElement & LooseObject | null, elementType?: string | null, initViewData?: any);
|
|
134
141
|
static get nextIndex(): number;
|
|
135
142
|
static get pageHeight(): number;
|
|
@@ -198,7 +205,8 @@ export declare class UIView extends UIObject {
|
|
|
198
205
|
}, zIndex?: number, performUncheckedLayout?: boolean): void;
|
|
199
206
|
get bounds(): UIRectangle;
|
|
200
207
|
set bounds(rectangle: UIRectangle);
|
|
201
|
-
boundsDidChange(): void;
|
|
208
|
+
boundsDidChange(bounds: UIRectangle): void;
|
|
209
|
+
didResize(entry: ResizeObserverEntry): void;
|
|
202
210
|
get frameTransform(): string;
|
|
203
211
|
set frameTransform(value: string);
|
|
204
212
|
setPosition(left?: number | string, right?: number | string, bottom?: number | string, top?: number | string, height?: number | string, width?: number | string): void;
|
|
@@ -275,7 +283,7 @@ export declare class UIView extends UIObject {
|
|
|
275
283
|
get viewAboveThisView(): UIView;
|
|
276
284
|
addSubview(view: UIView, aboveView?: UIView): void;
|
|
277
285
|
addSubviews(views: UIView[]): void;
|
|
278
|
-
addedAsSubviewToView(view: UIView, aboveView?: UIView): this;
|
|
286
|
+
addedAsSubviewToView(view: UIView | undefined, aboveView?: UIView): this;
|
|
279
287
|
moveToBottomOfSuperview(): void;
|
|
280
288
|
moveToTopOfSuperview(): void;
|
|
281
289
|
removeFromSuperview(): void;
|
|
@@ -286,6 +294,7 @@ export declare class UIView extends UIObject {
|
|
|
286
294
|
wasRemovedFromViewTree(): void;
|
|
287
295
|
get isMemberOfViewTree(): boolean;
|
|
288
296
|
get withAllSuperviews(): UIView[];
|
|
297
|
+
get elementWithAllSuperviewElements(): HTMLElement[];
|
|
289
298
|
setNeedsLayoutOnAllSuperviews(): void;
|
|
290
299
|
setNeedsLayoutUpToRootView(): void;
|
|
291
300
|
focus(): void;
|
|
@@ -61,6 +61,7 @@ if (!window.AutoLayout) {
|
|
|
61
61
|
window.AutoLayout = import_UIObject.nil;
|
|
62
62
|
}
|
|
63
63
|
function UIComponentView(target, context) {
|
|
64
|
+
console.log("Recording annotation UIComponentView on " + target.name);
|
|
64
65
|
import_UIObject.UIObject.recordAnnotation(UIComponentView, target);
|
|
65
66
|
}
|
|
66
67
|
const _UIView = class extends import_UIObject.UIObject {
|
|
@@ -90,6 +91,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
90
91
|
this._isMoving = import_UIObject.NO;
|
|
91
92
|
this._isCBEditorTemporaryResizable = import_UIObject.NO;
|
|
92
93
|
this._isCBEditorTemporaryMovable = import_UIObject.NO;
|
|
94
|
+
this._intrinsicSizesCache = {};
|
|
93
95
|
this.controlEvent = _UIView.controlEvent;
|
|
94
96
|
_UIView._UIViewIndex = _UIView.nextIndex;
|
|
95
97
|
this._UIViewIndex = _UIView._UIViewIndex;
|
|
@@ -150,8 +152,6 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
150
152
|
this.viewHTMLElement.obeyAutolayout = import_UIObject.YES;
|
|
151
153
|
this.viewHTMLElement.UIView = this;
|
|
152
154
|
this.addStyleClass(this.styleClassName);
|
|
153
|
-
this._resizeObserver = new ResizeObserver(() => this.setNeedsLayout());
|
|
154
|
-
this._resizeObserver.observe(this.viewHTMLElement);
|
|
155
155
|
}
|
|
156
156
|
set nativeSelectionEnabled(selectable) {
|
|
157
157
|
this._nativeSelectionEnabled = selectable;
|
|
@@ -456,14 +456,14 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
456
456
|
calculateAndSetViewFrame() {
|
|
457
457
|
}
|
|
458
458
|
get frame() {
|
|
459
|
-
var _a;
|
|
459
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
460
460
|
let result = (_a = this._frame) == null ? void 0 : _a.copy();
|
|
461
461
|
if (!result) {
|
|
462
462
|
result = new import_UIRectangle.UIRectangle(
|
|
463
|
-
this.viewHTMLElement.offsetLeft,
|
|
464
|
-
this.viewHTMLElement.offsetTop,
|
|
465
|
-
this.viewHTMLElement.offsetHeight,
|
|
466
|
-
this.viewHTMLElement.offsetWidth
|
|
463
|
+
(_c = (_b = this._resizeObserverEntry) == null ? void 0 : _b.contentRect.left) != null ? _c : this.viewHTMLElement.offsetLeft,
|
|
464
|
+
(_e = (_d = this._resizeObserverEntry) == null ? void 0 : _d.contentRect.top) != null ? _e : this.viewHTMLElement.offsetTop,
|
|
465
|
+
(_g = (_f = this._resizeObserverEntry) == null ? void 0 : _f.contentRect.height) != null ? _g : this.viewHTMLElement.offsetHeight,
|
|
466
|
+
(_i = (_h = this._resizeObserverEntry) == null ? void 0 : _h.contentRect.width) != null ? _i : this.viewHTMLElement.offsetWidth
|
|
467
467
|
);
|
|
468
468
|
result.zIndex = 0;
|
|
469
469
|
}
|
|
@@ -480,7 +480,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
480
480
|
rectangle.zIndex = zIndex;
|
|
481
481
|
}
|
|
482
482
|
this._frame = rectangle;
|
|
483
|
-
if (frame && frame.isEqualTo(rectangle) && frame.zIndex == rectangle.zIndex && !performUncheckedLayout) {
|
|
483
|
+
if (frame && frame != import_UIObject.nil && frame.isEqualTo(rectangle) && frame.zIndex == rectangle.zIndex && !performUncheckedLayout) {
|
|
484
484
|
return;
|
|
485
485
|
}
|
|
486
486
|
if (this.isInternalScaling) {
|
|
@@ -497,13 +497,19 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
497
497
|
);
|
|
498
498
|
if (frame.height != rectangle.height || frame.width != rectangle.width || performUncheckedLayout) {
|
|
499
499
|
this.setNeedsLayout();
|
|
500
|
-
this.boundsDidChange();
|
|
500
|
+
this.boundsDidChange(this.bounds);
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
503
|
get bounds() {
|
|
504
|
+
var _a, _b, _c, _d;
|
|
504
505
|
let result;
|
|
505
506
|
if ((0, import_UIObject.IS_NOT)(this._frame)) {
|
|
506
|
-
result = new import_UIRectangle.UIRectangle(
|
|
507
|
+
result = new import_UIRectangle.UIRectangle(
|
|
508
|
+
0,
|
|
509
|
+
0,
|
|
510
|
+
(_b = (_a = this._resizeObserverEntry) == null ? void 0 : _a.contentRect.height) != null ? _b : this.viewHTMLElement.offsetHeight,
|
|
511
|
+
(_d = (_c = this._resizeObserverEntry) == null ? void 0 : _c.contentRect.width) != null ? _d : this.viewHTMLElement.offsetWidth
|
|
512
|
+
);
|
|
507
513
|
} else {
|
|
508
514
|
result = this.frame.copy();
|
|
509
515
|
result.x = 0;
|
|
@@ -517,7 +523,12 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
517
523
|
newFrame.zIndex = frame.zIndex;
|
|
518
524
|
this.frame = newFrame;
|
|
519
525
|
}
|
|
520
|
-
boundsDidChange() {
|
|
526
|
+
boundsDidChange(bounds) {
|
|
527
|
+
}
|
|
528
|
+
didResize(entry) {
|
|
529
|
+
this._resizeObserverEntry = entry;
|
|
530
|
+
this.setNeedsLayout();
|
|
531
|
+
this.boundsDidChange(new import_UIRectangle.UIRectangle(0, 0, entry.contentRect.height, entry.contentRect.width));
|
|
521
532
|
}
|
|
522
533
|
get frameTransform() {
|
|
523
534
|
return this._frameTransform;
|
|
@@ -537,7 +548,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
537
548
|
const bounds = this.bounds;
|
|
538
549
|
if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
|
|
539
550
|
this.setNeedsLayout();
|
|
540
|
-
this.boundsDidChange();
|
|
551
|
+
this.boundsDidChange(bounds);
|
|
541
552
|
}
|
|
542
553
|
}
|
|
543
554
|
setSizes(height, width) {
|
|
@@ -547,7 +558,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
547
558
|
const bounds = this.bounds;
|
|
548
559
|
if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
|
|
549
560
|
this.setNeedsLayout();
|
|
550
|
-
this.boundsDidChange();
|
|
561
|
+
this.boundsDidChange(bounds);
|
|
551
562
|
}
|
|
552
563
|
}
|
|
553
564
|
setMinSizes(height, width) {
|
|
@@ -557,7 +568,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
557
568
|
const bounds = this.bounds;
|
|
558
569
|
if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
|
|
559
570
|
this.setNeedsLayout();
|
|
560
|
-
this.boundsDidChange();
|
|
571
|
+
this.boundsDidChange(bounds);
|
|
561
572
|
}
|
|
562
573
|
}
|
|
563
574
|
setMaxSizes(height, width) {
|
|
@@ -567,7 +578,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
567
578
|
const bounds = this.bounds;
|
|
568
579
|
if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
|
|
569
580
|
this.setNeedsLayout();
|
|
570
|
-
this.boundsDidChange();
|
|
581
|
+
this.boundsDidChange(bounds);
|
|
571
582
|
}
|
|
572
583
|
}
|
|
573
584
|
setMargin(margin) {
|
|
@@ -576,7 +587,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
576
587
|
const bounds = this.bounds;
|
|
577
588
|
if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
|
|
578
589
|
this.setNeedsLayout();
|
|
579
|
-
this.boundsDidChange();
|
|
590
|
+
this.boundsDidChange(bounds);
|
|
580
591
|
}
|
|
581
592
|
}
|
|
582
593
|
setMargins(left, right, bottom, top) {
|
|
@@ -588,7 +599,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
588
599
|
const bounds = this.bounds;
|
|
589
600
|
if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
|
|
590
601
|
this.setNeedsLayout();
|
|
591
|
-
this.boundsDidChange();
|
|
602
|
+
this.boundsDidChange(bounds);
|
|
592
603
|
}
|
|
593
604
|
}
|
|
594
605
|
setPadding(padding) {
|
|
@@ -597,7 +608,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
597
608
|
const bounds = this.bounds;
|
|
598
609
|
if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
|
|
599
610
|
this.setNeedsLayout();
|
|
600
|
-
this.boundsDidChange();
|
|
611
|
+
this.boundsDidChange(bounds);
|
|
601
612
|
}
|
|
602
613
|
}
|
|
603
614
|
setPaddings(left, right, bottom, top) {
|
|
@@ -609,7 +620,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
609
620
|
const bounds = this.bounds;
|
|
610
621
|
if (bounds.height != previousBounds.height || bounds.width != previousBounds.width) {
|
|
611
622
|
this.setNeedsLayout();
|
|
612
|
-
this.boundsDidChange();
|
|
623
|
+
this.boundsDidChange(bounds);
|
|
613
624
|
}
|
|
614
625
|
}
|
|
615
626
|
setBorder(radius = import_UIObject.nil, width = 1, color = import_UIColor.UIColor.blackColor, style = "solid") {
|
|
@@ -756,29 +767,27 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
756
767
|
if ((0, import_UIObject.IS)(width)) {
|
|
757
768
|
width = width.integerValue + "px";
|
|
758
769
|
}
|
|
759
|
-
|
|
760
|
-
|
|
770
|
+
frameTransform = "translate3d(" + left.integerValue + "px, " + top.integerValue + "px, 0px)" + frameTransform;
|
|
771
|
+
const style = element.style;
|
|
761
772
|
if (element.UIView) {
|
|
762
|
-
|
|
773
|
+
frameTransform = frameTransform + ((_b = (_a = style.transform.match(
|
|
763
774
|
new RegExp("scale\\(.*\\)", "g")
|
|
764
|
-
)) == null ? void 0 : _a.firstElement) != null ? _b : "")
|
|
775
|
+
)) == null ? void 0 : _a.firstElement) != null ? _b : "");
|
|
765
776
|
}
|
|
766
777
|
if ((0, import_UIObject.IS_NIL)(height)) {
|
|
767
|
-
|
|
768
|
-
} else {
|
|
769
|
-
str = str + " height:" + height + ";";
|
|
778
|
+
height = "unset";
|
|
770
779
|
}
|
|
771
780
|
if ((0, import_UIObject.IS_NIL)(width)) {
|
|
772
|
-
|
|
773
|
-
} else {
|
|
774
|
-
str = str + " width:" + width + ";";
|
|
781
|
+
width = "unset";
|
|
775
782
|
}
|
|
783
|
+
let zIndexString = "" + zIndex;
|
|
776
784
|
if ((0, import_UIObject.IS_NIL)(zIndex)) {
|
|
777
|
-
|
|
778
|
-
} else {
|
|
779
|
-
str = str + " z-index:" + zIndex + ";";
|
|
785
|
+
zIndexString = "unset";
|
|
780
786
|
}
|
|
781
|
-
|
|
787
|
+
style.transform = frameTransform;
|
|
788
|
+
style.height = height;
|
|
789
|
+
style.width = width;
|
|
790
|
+
style.zIndex = zIndexString;
|
|
782
791
|
}
|
|
783
792
|
static performAutoLayout(parentElement, visualFormatArray, constraintsArray) {
|
|
784
793
|
const view = new AutoLayout.View();
|
|
@@ -857,6 +866,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
857
866
|
}
|
|
858
867
|
this._shouldLayout = import_UIObject.YES;
|
|
859
868
|
_UIView._viewsToLayout.push(this);
|
|
869
|
+
this._intrinsicSizesCache = {};
|
|
860
870
|
if (_UIView._viewsToLayout.length == 1) {
|
|
861
871
|
_UIView.scheduleLayoutViewsIfNeeded();
|
|
862
872
|
}
|
|
@@ -894,7 +904,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
894
904
|
applyClassesAndStyles() {
|
|
895
905
|
for (let i = 0; i < this.styleClasses.length; i++) {
|
|
896
906
|
const styleClass = this.styleClasses[i];
|
|
897
|
-
if (styleClass) {
|
|
907
|
+
if (styleClass && !this.viewHTMLElement.classList.contains(styleClass)) {
|
|
898
908
|
this.viewHTMLElement.classList.add(styleClass);
|
|
899
909
|
}
|
|
900
910
|
}
|
|
@@ -1022,7 +1032,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1022
1032
|
views.forEach((view) => this.addSubview(view));
|
|
1023
1033
|
}
|
|
1024
1034
|
addedAsSubviewToView(view, aboveView) {
|
|
1025
|
-
view.addSubview(this, aboveView);
|
|
1035
|
+
view == null ? void 0 : view.addSubview(this, aboveView);
|
|
1026
1036
|
return this;
|
|
1027
1037
|
}
|
|
1028
1038
|
moveToBottomOfSuperview() {
|
|
@@ -1072,8 +1082,10 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1072
1082
|
this.superview = superview;
|
|
1073
1083
|
}
|
|
1074
1084
|
wasAddedToViewTree() {
|
|
1085
|
+
_UIView.resizeObserver.observe(this.viewHTMLElement);
|
|
1075
1086
|
}
|
|
1076
1087
|
wasRemovedFromViewTree() {
|
|
1088
|
+
_UIView.resizeObserver.unobserve(this.viewHTMLElement);
|
|
1077
1089
|
}
|
|
1078
1090
|
get isMemberOfViewTree() {
|
|
1079
1091
|
let element = this.viewHTMLElement;
|
|
@@ -1094,6 +1106,18 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
1094
1106
|
}
|
|
1095
1107
|
return result;
|
|
1096
1108
|
}
|
|
1109
|
+
get elementWithAllSuperviewElements() {
|
|
1110
|
+
const result = [];
|
|
1111
|
+
let view = this.viewHTMLElement;
|
|
1112
|
+
for (let i = 0; (0, import_UIObject.IS)(view); i = i) {
|
|
1113
|
+
if (!view) {
|
|
1114
|
+
return result;
|
|
1115
|
+
}
|
|
1116
|
+
result.push(view);
|
|
1117
|
+
view = view.parentElement;
|
|
1118
|
+
}
|
|
1119
|
+
return result;
|
|
1120
|
+
}
|
|
1097
1121
|
setNeedsLayoutOnAllSuperviews() {
|
|
1098
1122
|
this.withAllSuperviews.reverse().everyElement.setNeedsLayout();
|
|
1099
1123
|
}
|
|
@@ -2034,20 +2058,48 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
2034
2058
|
this.subviews.everyElement.forEachViewInSubtree(functionToCall);
|
|
2035
2059
|
}
|
|
2036
2060
|
rectangleInView(rectangle, view) {
|
|
2061
|
+
var _a, _b, _c, _d;
|
|
2037
2062
|
if (!view.isMemberOfViewTree || !this.isMemberOfViewTree) {
|
|
2038
2063
|
return import_UIObject.nil;
|
|
2039
2064
|
}
|
|
2040
|
-
const
|
|
2041
|
-
const
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2065
|
+
const allViewSuperviewElements = view.elementWithAllSuperviewElements;
|
|
2066
|
+
const superviewElementsUntilCommonElement = this.elementWithAllSuperviewElements.slice(
|
|
2067
|
+
0,
|
|
2068
|
+
this.elementWithAllSuperviewElements.findIndex(
|
|
2069
|
+
(viewElement) => allViewSuperviewElements.contains(viewElement)
|
|
2070
|
+
) + 1
|
|
2071
|
+
);
|
|
2072
|
+
const commonElement = superviewElementsUntilCommonElement.lastElement;
|
|
2073
|
+
const viewSuperviewElementsUntilCommonElement = allViewSuperviewElements.slice(
|
|
2074
|
+
0,
|
|
2075
|
+
allViewSuperviewElements.findIndex((viewElement) => viewElement == commonElement) + 1
|
|
2076
|
+
);
|
|
2077
|
+
let selfOffsetPoint = new import_UIPoint.UIPoint(0, 0);
|
|
2078
|
+
for (let i = 0; i < superviewElementsUntilCommonElement.length - 1; i++) {
|
|
2079
|
+
const element = superviewElementsUntilCommonElement[i];
|
|
2080
|
+
selfOffsetPoint = selfOffsetPoint.add(
|
|
2081
|
+
(_b = (_a = element.UIView) == null ? void 0 : _a.frame.min) != null ? _b : new import_UIPoint.UIPoint(element.offsetLeft, element.offsetTop)
|
|
2082
|
+
);
|
|
2083
|
+
}
|
|
2084
|
+
let viewOffsetPoint = new import_UIPoint.UIPoint(0, 0);
|
|
2085
|
+
for (let i = 0; i < viewSuperviewElementsUntilCommonElement.length - 1; i++) {
|
|
2086
|
+
const element = viewSuperviewElementsUntilCommonElement[i];
|
|
2087
|
+
viewOffsetPoint = viewOffsetPoint.add(
|
|
2088
|
+
(_d = (_c = element.UIView) == null ? void 0 : _c.frame.min) != null ? _d : new import_UIPoint.UIPoint(element.offsetLeft, element.offsetTop)
|
|
2089
|
+
);
|
|
2090
|
+
}
|
|
2091
|
+
const offsetPoint = selfOffsetPoint.subtract(viewOffsetPoint);
|
|
2045
2092
|
return rectangle.copy().offsetByPoint(offsetPoint);
|
|
2046
2093
|
}
|
|
2047
2094
|
rectangleFromView(rectangle, view) {
|
|
2048
2095
|
return view.rectangleInView(rectangle, this);
|
|
2049
2096
|
}
|
|
2050
2097
|
intrinsicContentSizeWithConstraints(constrainingHeight = 0, constrainingWidth = 0) {
|
|
2098
|
+
const cacheKey = "h_" + constrainingHeight + "__w_" + constrainingWidth;
|
|
2099
|
+
const cachedResult = this._intrinsicSizesCache[cacheKey];
|
|
2100
|
+
if (cachedResult) {
|
|
2101
|
+
return cachedResult;
|
|
2102
|
+
}
|
|
2051
2103
|
const result = new import_UIRectangle.UIRectangle(0, 0, 0, 0);
|
|
2052
2104
|
if (this.rootView.forceIntrinsicSizeZero) {
|
|
2053
2105
|
return result;
|
|
@@ -2094,6 +2146,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
2094
2146
|
}
|
|
2095
2147
|
result.height = resultHeight;
|
|
2096
2148
|
result.width = resultWidth;
|
|
2149
|
+
this._intrinsicSizesCache[cacheKey] = result.copy();
|
|
2097
2150
|
return result;
|
|
2098
2151
|
}
|
|
2099
2152
|
intrinsicContentWidth(constrainingHeight = 0) {
|
|
@@ -2110,6 +2163,14 @@ let UIView = _UIView;
|
|
|
2110
2163
|
UIView._UIViewIndex = -1;
|
|
2111
2164
|
UIView._viewsToLayout = [];
|
|
2112
2165
|
UIView._pageScale = 1;
|
|
2166
|
+
UIView.resizeObserver = new ResizeObserver((entries, observer) => {
|
|
2167
|
+
var _a;
|
|
2168
|
+
for (let i = 0; i < entries.length; i++) {
|
|
2169
|
+
const entry = entries[i];
|
|
2170
|
+
const view = entry.target.UIView;
|
|
2171
|
+
(_a = view == null ? void 0 : view.didResize) == null ? void 0 : _a.call(view, entry);
|
|
2172
|
+
}
|
|
2173
|
+
});
|
|
2113
2174
|
UIView._onWindowTouchMove = import_UIObject.nil;
|
|
2114
2175
|
UIView._onWindowMouseMove = import_UIObject.nil;
|
|
2115
2176
|
UIView._onWindowMouseup = import_UIObject.nil;
|