uicore-ts 1.0.518 → 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.
Files changed (78) hide show
  1. package/compiledScripts/UIBaseButton.js +1 -1
  2. package/compiledScripts/UIBaseButton.js.map +2 -2
  3. package/compiledScripts/UIButton.d.ts +3 -3
  4. package/compiledScripts/UIButton.js +26 -16
  5. package/compiledScripts/UIButton.js.map +2 -2
  6. package/compiledScripts/UIColor.js.map +2 -2
  7. package/compiledScripts/UICore.js +3 -3
  8. package/compiledScripts/UICore.js.map +2 -2
  9. package/compiledScripts/UICoreExtensions.d.ts +3 -1
  10. package/compiledScripts/UICoreExtensions.js +20 -3
  11. package/compiledScripts/UICoreExtensions.js.map +2 -2
  12. package/compiledScripts/UIDateTimeInput.js +1 -2
  13. package/compiledScripts/UIDateTimeInput.js.map +2 -2
  14. package/compiledScripts/UIDialogView.js +14 -3
  15. package/compiledScripts/UIDialogView.js.map +3 -3
  16. package/compiledScripts/UIImageView.js +5 -2
  17. package/compiledScripts/UIImageView.js.map +2 -2
  18. package/compiledScripts/UIKeyValueStringSorterWebWorker.worker.js +1 -1
  19. package/compiledScripts/UIKeyValueStringSorterWebWorker.worker.js.map +2 -2
  20. package/compiledScripts/UILink.js.map +2 -2
  21. package/compiledScripts/UINativeScrollView.d.ts +1 -0
  22. package/compiledScripts/UINativeScrollView.js +8 -5
  23. package/compiledScripts/UINativeScrollView.js.map +2 -2
  24. package/compiledScripts/UIObject.d.ts +14 -4
  25. package/compiledScripts/UIObject.js +4 -0
  26. package/compiledScripts/UIObject.js.map +2 -2
  27. package/compiledScripts/UIRectangle.d.ts +1 -1
  28. package/compiledScripts/UIRectangle.js +4 -3
  29. package/compiledScripts/UIRectangle.js.map +2 -2
  30. package/compiledScripts/UIRootViewController.d.ts +7 -7
  31. package/compiledScripts/UIRootViewController.js +24 -21
  32. package/compiledScripts/UIRootViewController.js.map +2 -2
  33. package/compiledScripts/UIRoute.d.ts +2 -2
  34. package/compiledScripts/UIRoute.js +9 -10
  35. package/compiledScripts/UIRoute.js.map +2 -2
  36. package/compiledScripts/UIScrollView.d.ts +1 -1
  37. package/compiledScripts/UIScrollView.js +1 -2
  38. package/compiledScripts/UIScrollView.js.map +2 -2
  39. package/compiledScripts/UISlideScrollerView.d.ts +1 -1
  40. package/compiledScripts/UISlideScrollerView.js +11 -7
  41. package/compiledScripts/UISlideScrollerView.js.map +2 -2
  42. package/compiledScripts/UITableView.d.ts +1 -0
  43. package/compiledScripts/UITableView.js +4 -2
  44. package/compiledScripts/UITableView.js.map +2 -2
  45. package/compiledScripts/UITextField.d.ts +1 -1
  46. package/compiledScripts/UITextField.js.map +2 -2
  47. package/compiledScripts/UITextView.d.ts +2 -2
  48. package/compiledScripts/UITextView.js +4 -4
  49. package/compiledScripts/UITextView.js.map +2 -2
  50. package/compiledScripts/UIView.d.ts +20 -11
  51. package/compiledScripts/UIView.js +117 -58
  52. package/compiledScripts/UIView.js.map +2 -2
  53. package/compiledScripts/UIViewController.d.ts +1 -1
  54. package/compiledScripts/UIViewController.js +10 -7
  55. package/compiledScripts/UIViewController.js.map +2 -2
  56. package/package.json +2 -2
  57. package/scripts/UIBaseButton.ts +1 -1
  58. package/scripts/UIButton.ts +49 -35
  59. package/scripts/UIColor.ts +37 -51
  60. package/scripts/UICore.ts +39 -38
  61. package/scripts/UICoreExtensions.ts +28 -4
  62. package/scripts/UIDateTimeInput.ts +1 -2
  63. package/scripts/UIDialogView.ts +33 -33
  64. package/scripts/UIImageView.ts +3 -3
  65. package/scripts/UIKeyValueStringSorterWebWorker.worker.ts +1 -1
  66. package/scripts/UILink.ts +1 -1
  67. package/scripts/UINativeScrollView.ts +11 -6
  68. package/scripts/UIObject.ts +24 -6
  69. package/scripts/UIRectangle.ts +3 -3
  70. package/scripts/UIRootViewController.ts +42 -26
  71. package/scripts/UIRoute.ts +11 -14
  72. package/scripts/UIScrollView.ts +2 -2
  73. package/scripts/UISlideScrollerView.ts +54 -54
  74. package/scripts/UITableView.ts +6 -7
  75. package/scripts/UITextField.ts +1 -1
  76. package/scripts/UITextView.ts +22 -14
  77. package/scripts/UIView.ts +193 -97
  78. package/scripts/UIViewController.ts +12 -8
@@ -26,7 +26,7 @@ var import_UIObject = require("./UIObject");
26
26
  var import_UIView = require("./UIView");
27
27
  class UIBaseButton extends import_UIView.UIView {
28
28
  constructor(elementID, elementType) {
29
- super(elementID, import_UIObject.nil, elementType);
29
+ super(elementID, void 0, elementType);
30
30
  this._selected = import_UIObject.NO;
31
31
  this._highlighted = import_UIObject.NO;
32
32
  this._isToggleable = import_UIObject.NO;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UIBaseButton.ts"],
4
- "sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { IS, nil, NO, YES } from \"./UIObject\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIBaseButton extends UIView {\n \n _selected: boolean = NO\n _highlighted: boolean = NO\n \n override _isPointerInside: boolean\n \n \n _isToggleable: boolean = NO\n _hovered?: boolean\n _focused?: boolean\n \n \n constructor(elementID?: string, elementType?: string) {\n \n super(elementID, nil, elementType)\n \n // Instance variables\n \n \n this._isPointerInside = NO\n \n \n const setHovered = () => {\n this.hovered = YES\n }\n this.addTargetForControlEvent(UIView.controlEvent.PointerHover, setHovered)\n \n const setNotHovered = () => {\n \n this.hovered = NO\n \n }\n \n this.addTargetForControlEvents([\n UIView.controlEvent.PointerLeave, UIView.controlEvent.PointerCancel, UIView.controlEvent.MultipleTouches\n ], setNotHovered)\n \n \n let highlightingTime: number\n const setHighlighted = () => {\n this.highlighted = YES\n highlightingTime = Date.now()\n }\n this.addTargetForControlEvent(UIView.controlEvent.PointerDown, setHighlighted)\n this.addTargetForControlEvent(UIView.controlEvent.PointerEnter, setHighlighted)\n \n const setNotHighlighted = () => {\n this.highlighted = NO\n }\n const setNotHighlightedWithMinimumDuration = () => {\n const minimumDurationInMilliseconds = 50\n const elapsedTime = Date.now() - highlightingTime\n if (minimumDurationInMilliseconds < elapsedTime) {\n this.highlighted = NO\n }\n else {\n setTimeout(() => {\n this.highlighted = NO\n }, minimumDurationInMilliseconds - elapsedTime)\n }\n }\n this.addTargetForControlEvents([\n UIView.controlEvent.PointerLeave, UIView.controlEvent.PointerCancel, UIView.controlEvent.MultipleTouches\n ], setNotHighlighted)\n this.addTargetForControlEvent(UIView.controlEvent.PointerUp, setNotHighlightedWithMinimumDuration)\n \n // Handle enter key press\n this.addTargetForControlEvent(UIView.controlEvent.EnterDown, () => {\n \n setHighlighted()\n setNotHighlightedWithMinimumDuration()\n \n })\n \n \n this.addTargetForControlEvent(\n UIView.controlEvent.Focus,\n (sender: UIView, event: Event) => {\n \n this.focused = YES\n \n }\n )\n \n this.addTargetForControlEvent(\n UIView.controlEvent.Blur,\n (sender: UIView, event: Event) => {\n \n this.focused = NO\n \n }\n )\n \n \n this.pausesPointerEvents = YES\n this.tabIndex = 1\n \n this.style.cursor = \"pointer\"\n \n //this.style.outline = \"none\";\n \n \n this.nativeSelectionEnabled = NO\n \n \n this.addTargetForControlEvents([\n UIView.controlEvent.EnterDown, UIView.controlEvent.PointerUpInside\n ], () => {\n \n if (this.isToggleable) {\n \n this.toggleSelectedState()\n \n }\n \n })\n \n }\n \n public set hovered(hovered: boolean) {\n this._hovered = hovered\n this.updateContentForCurrentState()\n }\n \n public get hovered(): boolean {\n return this._hovered ?? NO\n }\n \n public set highlighted(highlighted: boolean) {\n this._highlighted = highlighted\n this.updateContentForCurrentState()\n }\n \n public get highlighted(): boolean {\n return this._highlighted\n }\n \n public 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 get focused(): boolean {\n return this._focused ?? NO\n }\n \n public set selected(selected: boolean) {\n this._selected = selected\n this.updateContentForCurrentState()\n }\n \n public get selected(): boolean {\n return this._selected\n }\n \n \n 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 this.backgroundColor = UIColor.nilColor\n }\n else {\n updateFunction.call(this)\n }\n \n }\n \n updateContentForNormalState() {\n \n \n }\n \n updateContentForHoveredState() {\n \n this.updateContentForNormalState()\n \n }\n \n updateContentForFocusedState() {\n \n this.updateContentForHoveredState()\n \n }\n \n updateContentForHighlightedState() {\n \n \n }\n \n updateContentForSelectedState() {\n \n \n }\n \n updateContentForSelectedAndHighlightedState() {\n \n this.updateContentForSelectedState()\n \n }\n \n \n override set enabled(enabled: boolean) {\n super.enabled = enabled\n this.updateContentForCurrentEnabledState()\n }\n \n override get enabled() {\n return super.enabled\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 override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.PageDidScroll || event.name ==\n UIView.broadcastEventName.AddedToViewTree) {\n \n this.hovered = NO\n \n this.highlighted = NO\n \n this.updateContentForCurrentState()\n \n }\n \n \n }\n \n \n toggleSelectedState() {\n \n \n this.selected = !this.selected\n \n \n }\n \n set isToggleable(isToggleable: boolean) {\n \n this._isToggleable = isToggleable\n \n }\n \n get isToggleable() {\n \n return this._isToggleable\n \n }\n \n \n override layoutSubviews() {\n \n super.layoutSubviews()\n \n const bounds = this.bounds\n \n \n }\n \n \n override sendControlEventForKey(eventKey: string, nativeEvent: Event) {\n \n if (eventKey == UIView.controlEvent.PointerUpInside && !this.highlighted) {\n \n // Do not send the event in this case\n //super.sendControlEventForKey(eventKey, nativeEvent);\n \n const asd = 1\n \n }\n else {\n \n super.sendControlEventForKey(eventKey, nativeEvent)\n \n }\n \n }\n \n \n static getEventCoordinatesInDocument(touchOrMouseEvent: any) {\n // http://www.quirksmode.org/js/events_properties.html\n var posx = 0\n var posy = 0\n var e = touchOrMouseEvent\n if (!e) {\n e = window.event\n }\n if (e.pageX || e.pageY) {\n posx = e.pageX\n posy = e.pageY\n }\n else if (e.clientX || e.clientY) {\n posx = e.clientX + document.body.scrollLeft\n + document.documentElement.scrollLeft\n posy = e.clientY + document.body.scrollTop\n + document.documentElement.scrollTop\n }\n // posx and posy contain the mouse position relative to the document\n \n const coordinates = { \"x\": posx, \"y\": posy }\n \n return coordinates\n \n }\n \n \n static getElementPositionInDocument(el: { tagName: string; offsetLeft: number; scrollLeft: number; clientLeft: number; offsetTop: number; scrollTop: number; clientTop: number; offsetParent: any }) {\n //https://www.kirupa.com/html5/getting_mouse_click_position.htm\n var xPosition = 0\n var yPosition = 0\n \n while (el) {\n if (el.tagName == \"BODY\") {\n \n // Coordinates in document are coordinates in body, therefore subtracting the scroll position of the body is not needed\n \n // // deal with browser quirks with body/window/document and page scroll\n // var xScrollPos = el.scrollLeft || document.documentElement.scrollLeft;\n // var yScrollPos = el.scrollTop || document.documentElement.scrollTop;\n //\n // xPosition += (el.offsetLeft - xScrollPos + el.clientLeft);\n // yPosition += (el.offsetTop - yScrollPos + el.clientTop);\n }\n else {\n xPosition += (el.offsetLeft - el.scrollLeft + el.clientLeft)\n yPosition += (el.offsetTop - el.scrollTop + el.clientTop)\n }\n \n el = el.offsetParent\n }\n return {\n x: xPosition,\n y: yPosition\n }\n }\n \n static convertCoordinatesFromDocumentToElement(x: number, y: number, element: any) {\n const elementPositionInDocument = this.getElementPositionInDocument(element)\n const coordinatesInElement = { \"x\": x - elementPositionInDocument.x, \"y\": y - elementPositionInDocument.y }\n return coordinatesInElement\n }\n \n static getEventCoordinatesInElement(touchOrMouseEvent: any, element: any) {\n const coordinatesInDocument = this.getEventCoordinatesInDocument(touchOrMouseEvent)\n const coordinatesInElement = this.convertCoordinatesFromDocumentToElement(\n coordinatesInDocument.x,\n coordinatesInDocument.y,\n element\n )\n return coordinatesInElement\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\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\n\n\n\n\n\n\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AACxB,sBAAiC;AACjC,oBAA6C;AAGtC,MAAM,qBAAqB,qBAAO;AAAA,EAarC,YAAY,WAAoB,aAAsB;AAElD,UAAM,WAAW,qBAAK,WAAW;AAbrC,qBAAqB;AACrB,wBAAwB;AAKxB,yBAAyB;AAYrB,SAAK,mBAAmB;AAGxB,UAAM,aAAa,MAAM;AACrB,WAAK,UAAU;AAAA,IACnB;AACA,SAAK,yBAAyB,qBAAO,aAAa,cAAc,UAAU;AAE1E,UAAM,gBAAgB,MAAM;AAExB,WAAK,UAAU;AAAA,IAEnB;AAEA,SAAK,0BAA0B;AAAA,MAC3B,qBAAO,aAAa;AAAA,MAAc,qBAAO,aAAa;AAAA,MAAe,qBAAO,aAAa;AAAA,IAC7F,GAAG,aAAa;AAGhB,QAAI;AACJ,UAAM,iBAAiB,MAAM;AACzB,WAAK,cAAc;AACnB,yBAAmB,KAAK,IAAI;AAAA,IAChC;AACA,SAAK,yBAAyB,qBAAO,aAAa,aAAa,cAA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;AACX,QAAI,IAAI;AACR,QAAI,CAAC,GAAG;AACJ,UAAI,OAAO;AAAA,IACf;AACA,QAAI,EAAE,SAAS,EAAE,OAAO;AACpB,aAAO,EAAE;AACT,aAAO,EAAE;AAAA,IACb,WACS,EAAE,WAAW,EAAE,SAAS;AAC7B,aAAO,EAAE,UAAU,SAAS,KAAK,aAC3B,SAAS,gBAAgB;AAC/B,aAAO,EAAE,UAAU,SAAS,KAAK,YAC3B,SAAS,gBAAgB;AAAA,IACnC;AAGA,UAAM,cAAc,EAAE,KAAK,MAAM,KAAK,KAAK;AAE3C,WAAO;AAAA,EAEX;AAAA,EAGA,OAAO,6BAA6B,IAAiK;AAEjM,QAAI,YAAY;AAChB,QAAI,YAAY;AAEhB,WAAO,IAAI;AACP,UAAI,GAAG,WAAW,QAAQ;AAAA,MAU1B,OACK;AACD,qBAAc,GAAG,aAAa,GAAG,aAAa,GAAG;AACjD,qBAAc,GAAG,YAAY,GAAG,YAAY,GAAG;AAAA,MACnD;AAEA,WAAK,GAAG;AAAA,IACZ;AACA,WAAO;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IACP;AAAA,EACJ;AAAA,EAEA,OAAO,wCAAwC,GAAW,GAAW,SAAc;AAC/E,UAAM,4BAA4B,KAAK,6BAA6B,OAAO;AAC3E,UAAM,uBAAuB,EAAE,KAAK,IAAI,0BAA0B,GAAG,KAAK,IAAI,0BAA0B,EAAE;AAC1G,WAAO;AAAA,EACX;AAAA,EAEA,OAAO,6BAA6B,mBAAwB,SAAc;AACtE,UAAM,wBAAwB,KAAK,8BAA8B,iBAAiB;AAClF,UAAM,uBAAuB,KAAK;AAAA,MAC9B,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AAGJ;",
4
+ "sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { IS, nil, NO, YES } from \"./UIObject\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIBaseButton extends UIView {\n \n _selected: boolean = NO\n _highlighted: boolean = NO\n \n override _isPointerInside: boolean\n \n \n _isToggleable: boolean = NO\n _hovered?: boolean\n _focused?: boolean\n \n \n constructor(elementID?: string, elementType?: string) {\n \n super(elementID, undefined, elementType)\n \n // Instance variables\n \n \n this._isPointerInside = NO\n \n \n const setHovered = () => {\n this.hovered = YES\n }\n this.addTargetForControlEvent(UIView.controlEvent.PointerHover, setHovered)\n \n const setNotHovered = () => {\n \n this.hovered = NO\n \n }\n \n this.addTargetForControlEvents([\n UIView.controlEvent.PointerLeave, UIView.controlEvent.PointerCancel, UIView.controlEvent.MultipleTouches\n ], setNotHovered)\n \n \n let highlightingTime: number\n const setHighlighted = () => {\n this.highlighted = YES\n highlightingTime = Date.now()\n }\n this.addTargetForControlEvent(UIView.controlEvent.PointerDown, setHighlighted)\n this.addTargetForControlEvent(UIView.controlEvent.PointerEnter, setHighlighted)\n \n const setNotHighlighted = () => {\n this.highlighted = NO\n }\n const setNotHighlightedWithMinimumDuration = () => {\n const minimumDurationInMilliseconds = 50\n const elapsedTime = Date.now() - highlightingTime\n if (minimumDurationInMilliseconds < elapsedTime) {\n this.highlighted = NO\n }\n else {\n setTimeout(() => {\n this.highlighted = NO\n }, minimumDurationInMilliseconds - elapsedTime)\n }\n }\n this.addTargetForControlEvents([\n UIView.controlEvent.PointerLeave, UIView.controlEvent.PointerCancel, UIView.controlEvent.MultipleTouches\n ], setNotHighlighted)\n this.addTargetForControlEvent(UIView.controlEvent.PointerUp, setNotHighlightedWithMinimumDuration)\n \n // Handle enter key press\n this.addTargetForControlEvent(UIView.controlEvent.EnterDown, () => {\n \n setHighlighted()\n setNotHighlightedWithMinimumDuration()\n \n })\n \n \n this.addTargetForControlEvent(\n UIView.controlEvent.Focus,\n (sender: UIView, event: Event) => {\n \n this.focused = YES\n \n }\n )\n \n this.addTargetForControlEvent(\n UIView.controlEvent.Blur,\n (sender: UIView, event: Event) => {\n \n this.focused = NO\n \n }\n )\n \n \n this.pausesPointerEvents = YES\n this.tabIndex = 1\n \n this.style.cursor = \"pointer\"\n \n //this.style.outline = \"none\";\n \n \n this.nativeSelectionEnabled = NO\n \n \n this.addTargetForControlEvents([\n UIView.controlEvent.EnterDown, UIView.controlEvent.PointerUpInside\n ], () => {\n \n if (this.isToggleable) {\n \n this.toggleSelectedState()\n \n }\n \n })\n \n }\n \n public set hovered(hovered: boolean) {\n this._hovered = hovered\n this.updateContentForCurrentState()\n }\n \n public get hovered(): boolean {\n return this._hovered ?? NO\n }\n \n public set highlighted(highlighted: boolean) {\n this._highlighted = highlighted\n this.updateContentForCurrentState()\n }\n \n public get highlighted(): boolean {\n return this._highlighted\n }\n \n public 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 get focused(): boolean {\n return this._focused ?? NO\n }\n \n public set selected(selected: boolean) {\n this._selected = selected\n this.updateContentForCurrentState()\n }\n \n public get selected(): boolean {\n return this._selected\n }\n \n \n 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 this.backgroundColor = UIColor.nilColor\n }\n else {\n updateFunction.call(this)\n }\n \n }\n \n updateContentForNormalState() {\n \n \n }\n \n updateContentForHoveredState() {\n \n this.updateContentForNormalState()\n \n }\n \n updateContentForFocusedState() {\n \n this.updateContentForHoveredState()\n \n }\n \n updateContentForHighlightedState() {\n \n \n }\n \n updateContentForSelectedState() {\n \n \n }\n \n updateContentForSelectedAndHighlightedState() {\n \n this.updateContentForSelectedState()\n \n }\n \n \n override set enabled(enabled: boolean) {\n super.enabled = enabled\n this.updateContentForCurrentEnabledState()\n }\n \n override get enabled() {\n return super.enabled\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 override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.PageDidScroll || event.name ==\n UIView.broadcastEventName.AddedToViewTree) {\n \n this.hovered = NO\n \n this.highlighted = NO\n \n this.updateContentForCurrentState()\n \n }\n \n \n }\n \n \n toggleSelectedState() {\n \n \n this.selected = !this.selected\n \n \n }\n \n set isToggleable(isToggleable: boolean) {\n \n this._isToggleable = isToggleable\n \n }\n \n get isToggleable() {\n \n return this._isToggleable\n \n }\n \n \n override layoutSubviews() {\n \n super.layoutSubviews()\n \n const bounds = this.bounds\n \n \n }\n \n \n override sendControlEventForKey(eventKey: string, nativeEvent: Event) {\n \n if (eventKey == UIView.controlEvent.PointerUpInside && !this.highlighted) {\n \n // Do not send the event in this case\n //super.sendControlEventForKey(eventKey, nativeEvent);\n \n const asd = 1\n \n }\n else {\n \n super.sendControlEventForKey(eventKey, nativeEvent)\n \n }\n \n }\n \n \n static getEventCoordinatesInDocument(touchOrMouseEvent: any) {\n // http://www.quirksmode.org/js/events_properties.html\n var posx = 0\n var posy = 0\n var e = touchOrMouseEvent\n if (!e) {\n e = window.event\n }\n if (e.pageX || e.pageY) {\n posx = e.pageX\n posy = e.pageY\n }\n else if (e.clientX || e.clientY) {\n posx = e.clientX + document.body.scrollLeft\n + document.documentElement.scrollLeft\n posy = e.clientY + document.body.scrollTop\n + document.documentElement.scrollTop\n }\n // posx and posy contain the mouse position relative to the document\n \n const coordinates = { \"x\": posx, \"y\": posy }\n \n return coordinates\n \n }\n \n \n static getElementPositionInDocument(el: { tagName: string; offsetLeft: number; scrollLeft: number; clientLeft: number; offsetTop: number; scrollTop: number; clientTop: number; offsetParent: any }) {\n //https://www.kirupa.com/html5/getting_mouse_click_position.htm\n var xPosition = 0\n var yPosition = 0\n \n while (el) {\n if (el.tagName == \"BODY\") {\n \n // Coordinates in document are coordinates in body, therefore subtracting the scroll position of the body is not needed\n \n // // deal with browser quirks with body/window/document and page scroll\n // var xScrollPos = el.scrollLeft || document.documentElement.scrollLeft;\n // var yScrollPos = el.scrollTop || document.documentElement.scrollTop;\n //\n // xPosition += (el.offsetLeft - xScrollPos + el.clientLeft);\n // yPosition += (el.offsetTop - yScrollPos + el.clientTop);\n }\n else {\n xPosition += (el.offsetLeft - el.scrollLeft + el.clientLeft)\n yPosition += (el.offsetTop - el.scrollTop + el.clientTop)\n }\n \n el = el.offsetParent\n }\n return {\n x: xPosition,\n y: yPosition\n }\n }\n \n static convertCoordinatesFromDocumentToElement(x: number, y: number, element: any) {\n const elementPositionInDocument = this.getElementPositionInDocument(element)\n const coordinatesInElement = { \"x\": x - elementPositionInDocument.x, \"y\": y - elementPositionInDocument.y }\n return coordinatesInElement\n }\n \n static getEventCoordinatesInElement(touchOrMouseEvent: any, element: any) {\n const coordinatesInDocument = this.getEventCoordinatesInDocument(touchOrMouseEvent)\n const coordinatesInElement = this.convertCoordinatesFromDocumentToElement(\n coordinatesInDocument.x,\n coordinatesInDocument.y,\n element\n )\n return coordinatesInElement\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\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\n\n\n\n\n\n\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAA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AAY,GAAG,YAAY,GAAG;AAAA,MACnD;AAEA,WAAK,GAAG;AAAA,IACZ;AACA,WAAO;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IACP;AAAA,EACJ;AAAA,EAEA,OAAO,wCAAwC,GAAW,GAAW,SAAc;AAC/E,UAAM,4BAA4B,KAAK,6BAA6B,OAAO;AAC3E,UAAM,uBAAuB,EAAE,KAAK,IAAI,0BAA0B,GAAG,KAAK,IAAI,0BAA0B,EAAE;AAC1G,WAAO;AAAA,EACX;AAAA,EAEA,OAAO,6BAA6B,mBAAwB,SAAc;AACtE,UAAM,wBAAwB,KAAK,8BAA8B,iBAAiB;AAClF,UAAM,uBAAuB,KAAK;AAAA,MAC9B,sBAAsB;AAAA,MACtB,sBAAsB;AAAA,MACtB;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AAGJ;",
6
6
  "names": []
7
7
  }
@@ -17,11 +17,11 @@ export interface UIButtonElementColorSpecifier {
17
17
  }
18
18
  export declare class UIButton extends UIBaseButton {
19
19
  _contentPadding: number;
20
- _titleLabel?: UITextView;
20
+ _titleLabel: UITextView;
21
21
  _imageView: UIImageView;
22
22
  usesAutomaticTitleFontSize: boolean;
23
- minAutomaticFontSize: number;
24
- maxAutomaticFontSize: number;
23
+ minAutomaticFontSize?: number;
24
+ maxAutomaticFontSize?: number;
25
25
  colors: UIButtonColorSpecifier;
26
26
  constructor(elementID?: string, elementType?: string, titleType?: string | ValueOf<typeof UITextView.type>);
27
27
  get contentPadding(): number;
@@ -31,8 +31,8 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
31
31
  constructor(elementID, elementType, titleType = import_UITextView.UITextView.type.span) {
32
32
  super(elementID, elementType);
33
33
  this._contentPadding = 0;
34
+ this._titleLabel = import_UIObject.nil;
34
35
  this.usesAutomaticTitleFontSize = import_UIObject.NO;
35
- this.minAutomaticFontSize = import_UIObject.nil;
36
36
  this.maxAutomaticFontSize = 25;
37
37
  this.colors = {
38
38
  titleLabel: {
@@ -58,8 +58,10 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
58
58
  }
59
59
  this.contentPadding = 10;
60
60
  this.imageView.userInteractionEnabled = import_UIObject.NO;
61
- this.titleLabel.textAlignment = import_UITextView.UITextView.textAlignment.center;
62
- this.titleLabel.nativeSelectionEnabled = import_UIObject.NO;
61
+ if (this.titleLabel) {
62
+ this.titleLabel.textAlignment = import_UITextView.UITextView.textAlignment.center;
63
+ this.titleLabel.nativeSelectionEnabled = import_UIObject.NO;
64
+ }
63
65
  }
64
66
  get contentPadding() {
65
67
  return this._contentPadding.integerValue;
@@ -117,7 +119,9 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
117
119
  updateFunction = this.updateContentForHoveredState;
118
120
  }
119
121
  if (!(0, import_UIObject.IS)(updateFunction)) {
120
- this.titleLabel.textColor = import_UIColor.UIColor.nilColor;
122
+ if (this.titleLabel) {
123
+ this.titleLabel.textColor = import_UIColor.UIColor.nilColor;
124
+ }
121
125
  this.backgroundColor = import_UIColor.UIColor.nilColor;
122
126
  } else {
123
127
  updateFunction.call(this);
@@ -126,14 +130,16 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
126
130
  }
127
131
  updateContentForNormalState() {
128
132
  this.backgroundColor = this.colors.background.normal;
129
- this.titleLabel.textColor = this.colors.titleLabel.normal;
133
+ if (this.titleLabel) {
134
+ this.titleLabel.textColor = this.colors.titleLabel.normal;
135
+ }
130
136
  }
131
137
  updateContentForHoveredState() {
132
138
  this.updateContentForNormalState();
133
139
  if (this.colors.background.hovered) {
134
140
  this.backgroundColor = this.colors.background.hovered;
135
141
  }
136
- if (this.colors.titleLabel.hovered) {
142
+ if (this.colors.titleLabel.hovered && this.titleLabel) {
137
143
  this.titleLabel.textColor = this.colors.titleLabel.hovered;
138
144
  }
139
145
  }
@@ -142,24 +148,28 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
142
148
  if (this.colors.background.focused) {
143
149
  this.backgroundColor = this.colors.background.focused;
144
150
  }
145
- if (this.colors.titleLabel.focused) {
151
+ if (this.colors.titleLabel.focused && this.titleLabel) {
146
152
  this.titleLabel.textColor = this.colors.titleLabel.focused;
147
153
  }
148
154
  }
149
155
  updateContentForHighlightedState() {
150
156
  this.backgroundColor = this.colors.background.highlighted;
151
- this.titleLabel.textColor = this.colors.titleLabel.highlighted;
157
+ if (this.titleLabel) {
158
+ this.titleLabel.textColor = this.colors.titleLabel.highlighted;
159
+ }
152
160
  }
153
161
  updateContentForSelectedState() {
154
162
  this.backgroundColor = this.colors.background.selected;
155
- this.titleLabel.textColor = this.colors.titleLabel.selected;
163
+ if (this.titleLabel) {
164
+ this.titleLabel.textColor = this.colors.titleLabel.selected;
165
+ }
156
166
  }
157
167
  updateContentForSelectedAndHighlightedState() {
158
168
  this.updateContentForSelectedState();
159
169
  if (this.colors.background.selectedAndHighlighted) {
160
170
  this.backgroundColor = this.colors.background.selectedAndHighlighted;
161
171
  }
162
- if (this.colors.titleLabel.selectedAndHighlighted) {
172
+ if (this.colors.titleLabel.selectedAndHighlighted && this.titleLabel) {
163
173
  this.titleLabel.textColor = this.colors.titleLabel.selectedAndHighlighted;
164
174
  }
165
175
  }
@@ -185,20 +195,20 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
185
195
  }
186
196
  }
187
197
  get titleLabel() {
188
- var _a;
189
- return (_a = this._titleLabel) != null ? _a : import_UIObject.nil;
198
+ return this._titleLabel;
190
199
  }
191
200
  get imageView() {
192
201
  return this._imageView;
193
202
  }
194
203
  layoutSubviews() {
204
+ var _a, _b, _c, _d, _e;
195
205
  super.layoutSubviews();
196
206
  let bounds = this.bounds;
197
- this.hoverText = this.titleLabel.text;
198
- if ((0, import_UIObject.IS_NOT)(this.imageView.hidden) && !(0, import_UIObject.IS)(this.titleLabel.text)) {
207
+ this.hoverText = (_b = (_a = this.titleLabel) == null ? void 0 : _a.text) != null ? _b : "";
208
+ if ((0, import_UIObject.IS_NOT)(this.imageView.hidden) && !(0, import_UIObject.IS)((_c = this.titleLabel) == null ? void 0 : _c.text)) {
199
209
  this.imageView.frame = bounds;
200
210
  }
201
- if ((0, import_UIObject.IS)(this.imageView.hidden) && (0, import_UIObject.IS)(this.titleLabel.text)) {
211
+ if ((0, import_UIObject.IS)(this.imageView.hidden) && ((_d = this.titleLabel) == null ? void 0 : _d.text)) {
202
212
  this.titleLabel.style.left = this.contentPadding + "px";
203
213
  this.titleLabel.style.right = this.contentPadding + "px";
204
214
  this.titleLabel.style.top = "50%";
@@ -223,7 +233,7 @@ class UIButton extends import_UIBaseButton.UIBaseButton {
223
233
  this.titleLabel.hidden = hidden;
224
234
  }
225
235
  }
226
- if ((0, import_UIObject.IS_NOT)(this.imageView.hidden) && (0, import_UIObject.IS)(this.titleLabel.text)) {
236
+ if ((0, import_UIObject.IS_NOT)(this.imageView.hidden) && ((_e = this.titleLabel) == null ? void 0 : _e.text)) {
227
237
  bounds = bounds.rectangleWithInset(this.contentPadding);
228
238
  const imageFrame = bounds.copy();
229
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\n _imageView: UIImageView\n \n usesAutomaticTitleFontSize = NO\n minAutomaticFontSize: number = nil\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(elementID?: string, elementType?: string, titleType: string | ValueOf<typeof UITextView.type> = UITextView.type.span) {\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 this.titleLabel.textAlignment = UITextView.textAlignment.center\n this.titleLabel.nativeSelectionEnabled = NO\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 this.titleLabel.textColor = UIColor.nilColor\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 this.titleLabel.textColor = this.colors.titleLabel.normal\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) {\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) {\n this.titleLabel.textColor = this.colors.titleLabel.focused\n }\n \n }\n \n override updateContentForHighlightedState() {\n \n this.backgroundColor = this.colors.background.highlighted\n this.titleLabel.textColor = this.colors.titleLabel.highlighted\n \n }\n \n override updateContentForSelectedState() {\n \n this.backgroundColor = this.colors.background.selected\n this.titleLabel.textColor = this.colors.titleLabel.selected\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) {\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 ?? nil\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) && IS(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) && IS(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 + \" + .\" + 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\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\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\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAC7B,qBAAwB;AACxB,yBAA4B;AAC5B,sB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AAEtD,YAAM,aAAa,OAAO,KAAK;AAC/B,iBAAW,QAAQ,OAAO,SAAS,KAAK,iBAAiB;AACzD,WAAK,UAAU,QAAQ;AAEvB,WAAK,WAAW,MAAM,OAAO,WAAW,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,EAWpF;AAGJ;",
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 + \" + .\" + 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\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\n\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pF;AAGJ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UIColor.ts"],
4
- "sourcesContent": ["import { UIObject } from \"./UIObject\"\n\n\nexport interface UIColorDescriptor {\n \n red: number;\n green: number;\n blue: number;\n alpha?: number;\n \n}\n\n\n\n\n\nexport class UIColor extends UIObject {\n \n \n constructor(public stringValue: string) {\n \n super()\n \n }\n \n \n \n override toString() {\n return this.stringValue\n }\n \n static get redColor() {\n return new UIColor(\"red\")\n }\n \n static get blueColor() {\n return new UIColor(\"blue\")\n }\n \n static get greenColor() {\n return new UIColor(\"green\")\n }\n \n static get yellowColor() {\n return new UIColor(\"yellow\")\n }\n \n static get blackColor() {\n return new UIColor(\"black\")\n }\n \n static get brownColor() {\n return new UIColor(\"brown\")\n }\n \n static get whiteColor() {\n return new UIColor(\"white\")\n }\n \n static get greyColor() {\n return new UIColor(\"grey\")\n }\n \n static get lightGreyColor() {\n return new UIColor(\"lightgrey\")\n }\n \n static get transparentColor() {\n return new UIColor(\"transparent\")\n }\n \n static get undefinedColor() {\n return new UIColor(\"\")\n }\n \n static get nilColor() {\n return new UIColor(\"\")\n }\n \n \n \n static nameToHex(name: string) {\n return {\n \"aliceblue\": \"#f0f8ff\",\n \"antiquewhite\": \"#faebd7\",\n \"aqua\": \"#00ffff\",\n \"aquamarine\": \"#7fffd4\",\n \"azure\": \"#f0ffff\",\n \"beige\": \"#f5f5dc\",\n \"bisque\": \"#ffe4c4\",\n \"black\": \"#000000\",\n \"blanchedalmond\": \"#ffebcd\",\n \"blue\": \"#0000ff\",\n \"blueviolet\": \"#8a2be2\",\n \"brown\": \"#a52a2a\",\n \"burlywood\": \"#deb887\",\n \"cadetblue\": \"#5f9ea0\",\n \"chartreuse\": \"#7fff00\",\n \"chocolate\": \"#d2691e\",\n \"coral\": \"#ff7f50\",\n \"cornflowerblue\": \"#6495ed\",\n \"cornsilk\": \"#fff8dc\",\n \"crimson\": \"#dc143c\",\n \"cyan\": \"#00ffff\",\n \"darkblue\": \"#00008b\",\n \"darkcyan\": \"#008b8b\",\n \"darkgoldenrod\": \"#b8860b\",\n \"darkgray\": \"#a9a9a9\",\n \"darkgreen\": \"#006400\",\n \"darkkhaki\": \"#bdb76b\",\n \"darkmagenta\": \"#8b008b\",\n \"darkolivegreen\": \"#556b2f\",\n \"darkorange\": \"#ff8c00\",\n \"darkorchid\": \"#9932cc\",\n \"darkred\": \"#8b0000\",\n \"darksalmon\": \"#e9967a\",\n \"darkseagreen\": \"#8fbc8f\",\n \"darkslateblue\": \"#483d8b\",\n \"darkslategray\": \"#2f4f4f\",\n \"darkturquoise\": \"#00ced1\",\n \"darkviolet\": \"#9400d3\",\n \"deeppink\": \"#ff1493\",\n \"deepskyblue\": \"#00bfff\",\n \"dimgray\": \"#696969\",\n \"dodgerblue\": \"#1e90ff\",\n \"firebrick\": \"#b22222\",\n \"floralwhite\": \"#fffaf0\",\n \"forestgreen\": \"#228b22\",\n \"fuchsia\": \"#ff00ff\",\n \"gainsboro\": \"#dcdcdc\",\n \"ghostwhite\": \"#f8f8ff\",\n \"gold\": \"#ffd700\",\n \"goldenrod\": \"#daa520\",\n \"gray\": \"#808080\",\n \"green\": \"#008000\",\n \"greenyellow\": \"#adff2f\",\n \"honeydew\": \"#f0fff0\",\n \"hotpink\": \"#ff69b4\",\n \"indianred \": \"#cd5c5c\",\n \"indigo\": \"#4b0082\",\n \"ivory\": \"#fffff0\",\n \"khaki\": \"#f0e68c\",\n \"lavender\": \"#e6e6fa\",\n \"lavenderblush\": \"#fff0f5\",\n \"lawngreen\": \"#7cfc00\",\n \"lemonchiffon\": \"#fffacd\",\n \"lightblue\": \"#add8e6\",\n \"lightcoral\": \"#f08080\",\n \"lightcyan\": \"#e0ffff\",\n \"lightgoldenrodyellow\": \"#fafad2\",\n \"lightgrey\": \"#d3d3d3\",\n \"lightgreen\": \"#90ee90\",\n \"lightpink\": \"#ffb6c1\",\n \"lightsalmon\": \"#ffa07a\",\n \"lightseagreen\": \"#20b2aa\",\n \"lightskyblue\": \"#87cefa\",\n \"lightslategray\": \"#778899\",\n \"lightsteelblue\": \"#b0c4de\",\n \"lightyellow\": \"#ffffe0\",\n \"lime\": \"#00ff00\",\n \"limegreen\": \"#32cd32\",\n \"linen\": \"#faf0e6\",\n \"magenta\": \"#ff00ff\",\n \"maroon\": \"#800000\",\n \"mediumaquamarine\": \"#66cdaa\",\n \"mediumblue\": \"#0000cd\",\n \"mediumorchid\": \"#ba55d3\",\n \"mediumpurple\": \"#9370d8\",\n \"mediumseagreen\": \"#3cb371\",\n \"mediumslateblue\": \"#7b68ee\",\n \"mediumspringgreen\": \"#00fa9a\",\n \"mediumturquoise\": \"#48d1cc\",\n \"mediumvioletred\": \"#c71585\",\n \"midnightblue\": \"#191970\",\n \"mintcream\": \"#f5fffa\",\n \"mistyrose\": \"#ffe4e1\",\n \"moccasin\": \"#ffe4b5\",\n \"navajowhite\": \"#ffdead\",\n \"navy\": \"#000080\",\n \"oldlace\": \"#fdf5e6\",\n \"olive\": \"#808000\",\n \"olivedrab\": \"#6b8e23\",\n \"orange\": \"#ffa500\",\n \"orangered\": \"#ff4500\",\n \"orchid\": \"#da70d6\",\n \"palegoldenrod\": \"#eee8aa\",\n \"palegreen\": \"#98fb98\",\n \"paleturquoise\": \"#afeeee\",\n \"palevioletred\": \"#d87093\",\n \"papayawhip\": \"#ffefd5\",\n \"peachpuff\": \"#ffdab9\",\n \"peru\": \"#cd853f\",\n \"pink\": \"#ffc0cb\",\n \"plum\": \"#dda0dd\",\n \"powderblue\": \"#b0e0e6\",\n \"purple\": \"#800080\",\n \"red\": \"#ff0000\",\n \"rosybrown\": \"#bc8f8f\",\n \"royalblue\": \"#4169e1\",\n \"saddlebrown\": \"#8b4513\",\n \"salmon\": \"#fa8072\",\n \"sandybrown\": \"#f4a460\",\n \"seagreen\": \"#2e8b57\",\n \"seashell\": \"#fff5ee\",\n \"sienna\": \"#a0522d\",\n \"silver\": \"#c0c0c0\",\n \"skyblue\": \"#87ceeb\",\n \"slateblue\": \"#6a5acd\",\n \"slategray\": \"#708090\",\n \"snow\": \"#fffafa\",\n \"springgreen\": \"#00ff7f\",\n \"steelblue\": \"#4682b4\",\n \"tan\": \"#d2b48c\",\n \"teal\": \"#008080\",\n \"thistle\": \"#d8bfd8\",\n \"tomato\": \"#ff6347\",\n \"turquoise\": \"#40e0d0\",\n \"violet\": \"#ee82ee\",\n \"wheat\": \"#f5deb3\",\n \"white\": \"#ffffff\",\n \"whitesmoke\": \"#f5f5f5\",\n \"yellow\": \"#ffff00\",\n \"yellowgreen\": \"#9acd32\"\n }[name.toLowerCase()]\n }\n \n \n \n static hexToDescriptor(c: string): UIColorDescriptor {\n if (c[0] === \"#\") {\n c = c.substr(1)\n }\n const r = parseInt(c.slice(0, 2), 16)\n const g = parseInt(c.slice(2, 4), 16)\n const b = parseInt(c.slice(4, 6), 16)\n const a = parseInt(c.slice(6, 8), 16)\n \n const result = { \"red\": r, \"green\": g, \"blue\": b, \"alpha\": a }\n \n return result\n \n //return 'rgb(' + r + ',' + g + ',' + b + ')';\n \n }\n \n static rgbToDescriptor(colorString: string) {\n \n \n if (colorString.startsWith(\"rgba(\")) {\n \n colorString = colorString.slice(5, colorString.length - 1)\n \n }\n \n if (colorString.startsWith(\"rgb(\")) {\n \n colorString = colorString.slice(4, colorString.length - 1) + \", 0\"\n \n }\n \n \n const components = colorString.split(\",\")\n \n \n \n const result = {\n \"red\": Number(components[0]),\n \"green\": Number(components[1]),\n \"blue\": Number(components[2]),\n \"alpha\": Number(components[3])\n }\n \n \n return result\n \n \n }\n \n \n \n get colorDescriptor(): UIColorDescriptor {\n \n var descriptor\n \n const colorHEXFromName = UIColor.nameToHex(this.stringValue)\n \n if (this.stringValue.startsWith(\"rgb\")) {\n \n descriptor = UIColor.rgbToDescriptor(this.stringValue)\n \n }\n else if (colorHEXFromName) {\n \n descriptor = UIColor.hexToDescriptor(colorHEXFromName)\n \n }\n else {\n \n descriptor = UIColor.hexToDescriptor(this.stringValue)\n \n }\n \n return descriptor\n \n }\n \n \n \n colorWithRed(red: number) {\n \n \n const descriptor = this.colorDescriptor\n \n const result = new UIColor(\"rgba(\" + red + \",\" + descriptor.green + \",\" + descriptor.blue + \",\" +\n descriptor.alpha + \")\")\n \n return result\n \n }\n \n colorWithGreen(green: number) {\n \n \n const descriptor = this.colorDescriptor\n \n const result = new UIColor(\"rgba(\" + descriptor.red + \",\" + green + \",\" + descriptor.blue + \",\" +\n descriptor.alpha + \")\")\n \n return result\n \n }\n \n colorWithBlue(blue: number) {\n \n \n const descriptor = this.colorDescriptor\n \n const result = new UIColor(\"rgba(\" + descriptor.red + \",\" + descriptor.green + \",\" + blue + \",\" +\n descriptor.alpha + \")\")\n \n return result\n \n }\n \n \n colorWithAlpha(alpha: number) {\n \n \n const descriptor = this.colorDescriptor\n \n const result = new UIColor(\"rgba(\" + descriptor.red + \",\" + descriptor.green + \",\" + descriptor.blue + \",\" +\n alpha + \")\")\n \n return result\n \n }\n \n \n \n static colorWithRGBA(red: number, green: number, blue: number, alpha: number = 1) {\n \n \n const result = new UIColor(\"rgba(\" + red + \",\" + green + \",\" + blue + \",\" + alpha + \")\")\n \n return result\n \n \n }\n \n static colorWithDescriptor(descriptor: UIColorDescriptor) {\n \n \n const result = new UIColor(\"rgba(\" + descriptor.red.toFixed(0) + \",\" + descriptor.green.toFixed(0) + \",\" +\n descriptor.blue.toFixed(0) + \",\" + this.defaultAlphaToOne(descriptor.alpha) + \")\")\n \n return result\n \n }\n \n \n private static defaultAlphaToOne(value = 1) {\n if (value != value) {\n value = 1\n }\n return value\n }\n \n \n \n colorByMultiplyingRGB(multiplier: number) {\n \n const descriptor = this.colorDescriptor\n \n descriptor.red = descriptor.red * multiplier\n descriptor.green = descriptor.green * multiplier\n descriptor.blue = descriptor.blue * multiplier\n \n const result = UIColor.colorWithDescriptor(descriptor)\n \n return result\n \n }\n \n \n \n \n \n}\n\n\n\n\n\n\n\n\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B;AAEtC,UAAM,aAAa,KAAK;AAExB,eAAW,MAAM,WAAW,MAAM;AAClC,eAAW,QAAQ,WAAW,QAAQ;AACtC,eAAW,OAAO,WAAW,OAAO;AAEpC,UAAM,SAAS,QAAQ,oBAAoB,UAAU;AAErD,WAAO;AAAA,EAEX;AAMJ;",
4
+ "sourcesContent": ["import { UIObject } from \"./UIObject\"\n\n\nexport interface UIColorDescriptor {\n \n red: number;\n green: number;\n blue: number;\n alpha?: number;\n \n}\n\n\nexport class UIColor extends UIObject {\n \n \n constructor(public stringValue: string) {\n \n super()\n \n }\n \n \n override toString() {\n return this.stringValue\n }\n \n static get redColor() {\n return new UIColor(\"red\")\n }\n \n static get blueColor() {\n return new UIColor(\"blue\")\n }\n \n static get greenColor() {\n return new UIColor(\"green\")\n }\n \n static get yellowColor() {\n return new UIColor(\"yellow\")\n }\n \n static get blackColor() {\n return new UIColor(\"black\")\n }\n \n static get brownColor() {\n return new UIColor(\"brown\")\n }\n \n static get whiteColor() {\n return new UIColor(\"white\")\n }\n \n static get greyColor() {\n return new UIColor(\"grey\")\n }\n \n static get lightGreyColor() {\n return new UIColor(\"lightgrey\")\n }\n \n static get transparentColor() {\n return new UIColor(\"transparent\")\n }\n \n static get undefinedColor() {\n return new UIColor(\"\")\n }\n \n static get nilColor() {\n return new UIColor(\"\")\n }\n \n \n static nameToHex(name: string) {\n return {\n \"aliceblue\": \"#f0f8ff\",\n \"antiquewhite\": \"#faebd7\",\n \"aqua\": \"#00ffff\",\n \"aquamarine\": \"#7fffd4\",\n \"azure\": \"#f0ffff\",\n \"beige\": \"#f5f5dc\",\n \"bisque\": \"#ffe4c4\",\n \"black\": \"#000000\",\n \"blanchedalmond\": \"#ffebcd\",\n \"blue\": \"#0000ff\",\n \"blueviolet\": \"#8a2be2\",\n \"brown\": \"#a52a2a\",\n \"burlywood\": \"#deb887\",\n \"cadetblue\": \"#5f9ea0\",\n \"chartreuse\": \"#7fff00\",\n \"chocolate\": \"#d2691e\",\n \"coral\": \"#ff7f50\",\n \"cornflowerblue\": \"#6495ed\",\n \"cornsilk\": \"#fff8dc\",\n \"crimson\": \"#dc143c\",\n \"cyan\": \"#00ffff\",\n \"darkblue\": \"#00008b\",\n \"darkcyan\": \"#008b8b\",\n \"darkgoldenrod\": \"#b8860b\",\n \"darkgray\": \"#a9a9a9\",\n \"darkgreen\": \"#006400\",\n \"darkkhaki\": \"#bdb76b\",\n \"darkmagenta\": \"#8b008b\",\n \"darkolivegreen\": \"#556b2f\",\n \"darkorange\": \"#ff8c00\",\n \"darkorchid\": \"#9932cc\",\n \"darkred\": \"#8b0000\",\n \"darksalmon\": \"#e9967a\",\n \"darkseagreen\": \"#8fbc8f\",\n \"darkslateblue\": \"#483d8b\",\n \"darkslategray\": \"#2f4f4f\",\n \"darkturquoise\": \"#00ced1\",\n \"darkviolet\": \"#9400d3\",\n \"deeppink\": \"#ff1493\",\n \"deepskyblue\": \"#00bfff\",\n \"dimgray\": \"#696969\",\n \"dodgerblue\": \"#1e90ff\",\n \"firebrick\": \"#b22222\",\n \"floralwhite\": \"#fffaf0\",\n \"forestgreen\": \"#228b22\",\n \"fuchsia\": \"#ff00ff\",\n \"gainsboro\": \"#dcdcdc\",\n \"ghostwhite\": \"#f8f8ff\",\n \"gold\": \"#ffd700\",\n \"goldenrod\": \"#daa520\",\n \"gray\": \"#808080\",\n \"green\": \"#008000\",\n \"greenyellow\": \"#adff2f\",\n \"honeydew\": \"#f0fff0\",\n \"hotpink\": \"#ff69b4\",\n \"indianred \": \"#cd5c5c\",\n \"indigo\": \"#4b0082\",\n \"ivory\": \"#fffff0\",\n \"khaki\": \"#f0e68c\",\n \"lavender\": \"#e6e6fa\",\n \"lavenderblush\": \"#fff0f5\",\n \"lawngreen\": \"#7cfc00\",\n \"lemonchiffon\": \"#fffacd\",\n \"lightblue\": \"#add8e6\",\n \"lightcoral\": \"#f08080\",\n \"lightcyan\": \"#e0ffff\",\n \"lightgoldenrodyellow\": \"#fafad2\",\n \"lightgrey\": \"#d3d3d3\",\n \"lightgreen\": \"#90ee90\",\n \"lightpink\": \"#ffb6c1\",\n \"lightsalmon\": \"#ffa07a\",\n \"lightseagreen\": \"#20b2aa\",\n \"lightskyblue\": \"#87cefa\",\n \"lightslategray\": \"#778899\",\n \"lightsteelblue\": \"#b0c4de\",\n \"lightyellow\": \"#ffffe0\",\n \"lime\": \"#00ff00\",\n \"limegreen\": \"#32cd32\",\n \"linen\": \"#faf0e6\",\n \"magenta\": \"#ff00ff\",\n \"maroon\": \"#800000\",\n \"mediumaquamarine\": \"#66cdaa\",\n \"mediumblue\": \"#0000cd\",\n \"mediumorchid\": \"#ba55d3\",\n \"mediumpurple\": \"#9370d8\",\n \"mediumseagreen\": \"#3cb371\",\n \"mediumslateblue\": \"#7b68ee\",\n \"mediumspringgreen\": \"#00fa9a\",\n \"mediumturquoise\": \"#48d1cc\",\n \"mediumvioletred\": \"#c71585\",\n \"midnightblue\": \"#191970\",\n \"mintcream\": \"#f5fffa\",\n \"mistyrose\": \"#ffe4e1\",\n \"moccasin\": \"#ffe4b5\",\n \"navajowhite\": \"#ffdead\",\n \"navy\": \"#000080\",\n \"oldlace\": \"#fdf5e6\",\n \"olive\": \"#808000\",\n \"olivedrab\": \"#6b8e23\",\n \"orange\": \"#ffa500\",\n \"orangered\": \"#ff4500\",\n \"orchid\": \"#da70d6\",\n \"palegoldenrod\": \"#eee8aa\",\n \"palegreen\": \"#98fb98\",\n \"paleturquoise\": \"#afeeee\",\n \"palevioletred\": \"#d87093\",\n \"papayawhip\": \"#ffefd5\",\n \"peachpuff\": \"#ffdab9\",\n \"peru\": \"#cd853f\",\n \"pink\": \"#ffc0cb\",\n \"plum\": \"#dda0dd\",\n \"powderblue\": \"#b0e0e6\",\n \"purple\": \"#800080\",\n \"red\": \"#ff0000\",\n \"rosybrown\": \"#bc8f8f\",\n \"royalblue\": \"#4169e1\",\n \"saddlebrown\": \"#8b4513\",\n \"salmon\": \"#fa8072\",\n \"sandybrown\": \"#f4a460\",\n \"seagreen\": \"#2e8b57\",\n \"seashell\": \"#fff5ee\",\n \"sienna\": \"#a0522d\",\n \"silver\": \"#c0c0c0\",\n \"skyblue\": \"#87ceeb\",\n \"slateblue\": \"#6a5acd\",\n \"slategray\": \"#708090\",\n \"snow\": \"#fffafa\",\n \"springgreen\": \"#00ff7f\",\n \"steelblue\": \"#4682b4\",\n \"tan\": \"#d2b48c\",\n \"teal\": \"#008080\",\n \"thistle\": \"#d8bfd8\",\n \"tomato\": \"#ff6347\",\n \"turquoise\": \"#40e0d0\",\n \"violet\": \"#ee82ee\",\n \"wheat\": \"#f5deb3\",\n \"white\": \"#ffffff\",\n \"whitesmoke\": \"#f5f5f5\",\n \"yellow\": \"#ffff00\",\n \"yellowgreen\": \"#9acd32\"\n }[name.toLowerCase()]\n }\n \n \n static hexToDescriptor(c: string): UIColorDescriptor {\n if (c[0] === \"#\") {\n c = c.substr(1)\n }\n const r = parseInt(c.slice(0, 2), 16)\n const g = parseInt(c.slice(2, 4), 16)\n const b = parseInt(c.slice(4, 6), 16)\n const a = parseInt(c.slice(6, 8), 16)\n \n const result = { \"red\": r, \"green\": g, \"blue\": b, \"alpha\": a }\n \n return result\n \n //return 'rgb(' + r + ',' + g + ',' + b + ')';\n \n }\n \n static rgbToDescriptor(colorString: string) {\n \n \n if (colorString.startsWith(\"rgba(\")) {\n \n colorString = colorString.slice(5, colorString.length - 1)\n \n }\n \n if (colorString.startsWith(\"rgb(\")) {\n \n colorString = colorString.slice(4, colorString.length - 1) + \", 0\"\n \n }\n \n \n const components = colorString.split(\",\")\n \n \n const result = {\n \"red\": Number(components[0]),\n \"green\": Number(components[1]),\n \"blue\": Number(components[2]),\n \"alpha\": Number(components[3])\n }\n \n \n return result\n \n \n }\n \n \n get colorDescriptor(): UIColorDescriptor {\n \n var descriptor\n \n const colorHEXFromName = UIColor.nameToHex(this.stringValue)\n \n if (this.stringValue.startsWith(\"rgb\")) {\n \n descriptor = UIColor.rgbToDescriptor(this.stringValue)\n \n }\n else if (colorHEXFromName) {\n \n descriptor = UIColor.hexToDescriptor(colorHEXFromName)\n \n }\n else {\n \n descriptor = UIColor.hexToDescriptor(this.stringValue)\n \n }\n \n return descriptor\n \n }\n \n \n colorWithRed(red: number) {\n \n \n const descriptor = this.colorDescriptor\n \n const result = new UIColor(\"rgba(\" + red + \",\" + descriptor.green + \",\" + descriptor.blue + \",\" +\n descriptor.alpha + \")\")\n \n return result\n \n }\n \n colorWithGreen(green: number) {\n \n \n const descriptor = this.colorDescriptor\n \n const result = new UIColor(\"rgba(\" + descriptor.red + \",\" + green + \",\" + descriptor.blue + \",\" +\n descriptor.alpha + \")\")\n \n return result\n \n }\n \n colorWithBlue(blue: number) {\n \n \n const descriptor = this.colorDescriptor\n \n const result = new UIColor(\"rgba(\" + descriptor.red + \",\" + descriptor.green + \",\" + blue + \",\" +\n descriptor.alpha + \")\")\n \n return result\n \n }\n \n \n colorWithAlpha(alpha: number) {\n \n \n const descriptor = this.colorDescriptor\n \n const result = new UIColor(\"rgba(\" + descriptor.red + \",\" + descriptor.green + \",\" + descriptor.blue + \",\" +\n alpha + \")\")\n \n return result\n \n }\n \n \n static colorWithRGBA(red: number, green: number, blue: number, alpha: number = 1) {\n \n \n const result = new UIColor(\"rgba(\" + red + \",\" + green + \",\" + blue + \",\" + alpha + \")\")\n \n return result\n \n \n }\n \n static colorWithDescriptor(descriptor: UIColorDescriptor) {\n \n \n const result = new UIColor(\"rgba(\" + descriptor.red.toFixed(0) + \",\" + descriptor.green.toFixed(0) + \",\" +\n descriptor.blue.toFixed(0) + \",\" + this.defaultAlphaToOne(descriptor.alpha) + \")\")\n \n return result\n \n }\n \n \n private static defaultAlphaToOne(value = 1) {\n if (value != value) {\n value = 1\n }\n return value\n }\n \n \n colorByMultiplyingRGB(multiplier: number) {\n \n const descriptor = this.colorDescriptor\n \n descriptor.red = descriptor.red * multiplier\n descriptor.green = descriptor.green * multiplier\n descriptor.blue = descriptor.blue * multiplier\n \n const result = UIColor.colorWith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,IACZ;AACA,WAAO;AAAA,EACX;AAAA,EAGA,sBAAsB,YAAoB;AAEtC,UAAM,aAAa,KAAK;AAExB,eAAW,MAAM,WAAW,MAAM;AAClC,eAAW,QAAQ,WAAW,QAAQ;AACtC,eAAW,OAAO,WAAW,OAAO;AAEpC,UAAM,SAAS,QAAQ,oBAAoB,UAAU;AAErD,WAAO;AAAA,EAEX;AAGJ;",
6
6
  "names": []
7
7
  }
@@ -29,7 +29,6 @@ var import_UIViewController = require("./UIViewController");
29
29
  const _UICore = class extends import_UIObject.UIObject {
30
30
  constructor(rootDivElementID, rootViewControllerClass) {
31
31
  super();
32
- this.rootViewController = import_UIObject.nil;
33
32
  this.paddingLength = 20;
34
33
  _UICore.RootViewControllerClass = rootViewControllerClass;
35
34
  _UICore.main = _UICore.main || this;
@@ -54,10 +53,12 @@ const _UICore = class extends import_UIObject.UIObject {
54
53
  this.rootViewController.view.addTargetForControlEvent(
55
54
  import_UIView.UIView.controlEvent.PointerUpInside,
56
55
  () => {
57
- document.activeElement.blur();
56
+ var _a, _b;
57
+ (_b = (_a = document.activeElement) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
58
58
  }
59
59
  );
60
60
  const windowDidResize = () => {
61
+ this.rootViewController.view.setNeedsLayout();
61
62
  this.rootViewController._triggerLayoutViewSubviews();
62
63
  import_UIView.UIView.layoutViewsIfNeeded();
63
64
  this.rootViewController._triggerLayoutViewSubviews();
@@ -86,7 +87,6 @@ const _UICore = class extends import_UIObject.UIObject {
86
87
  }
87
88
  };
88
89
  let UICore = _UICore;
89
- UICore.RootViewControllerClass = import_UIObject.nil;
90
90
  UICore.languageService = import_UIObject.nil;
91
91
  UICore.broadcastEventName = {
92
92
  "RouteDidChange": "RouteDidChange",
@@ -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 = nil\n \n paddingLength = 20\n \n static RootViewControllerClass: typeof UIViewController = nil\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) {\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 // Doing layout two times to prevent page scrollbars from confusing the layout\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,yBAAkD;AAEpF,UAAM;AAlBV,8BAAuC;AAEvC,yBAAgB;AAkBZ,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,0CA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mBAAmB;AAEvB;AAmHJ,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;",
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 paddingLength = 20\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) {\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 // 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)\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EACJ;AACA,SAAO;AACX;",
6
6
  "names": []
7
7
  }
@@ -32,14 +32,16 @@ declare global {
32
32
  interface Number {
33
33
  isANumber: boolean;
34
34
  readonly integerValue: number;
35
+ constrainedValue(min: number, max: number): number;
35
36
  }
36
37
  interface Date {
37
38
  readonly dateString: string;
38
39
  }
39
40
  interface Object {
40
41
  forEach(callbackFunction: (value: any, key: string, stopLooping: () => void) => void): void;
42
+ objectByCopyingValuesRecursivelyFromObject<T extends object>(object: T): T & this;
41
43
  readonly allValues: Array<any>;
42
- readonly allKeys: string[];
44
+ readonly allKeys: (keyof this)[];
43
45
  }
44
46
  }
45
47
  export {};
@@ -148,15 +148,16 @@ if ("everyElement" in Array.prototype == NO) {
148
148
  const valueKeys = [];
149
149
  const targetFunction = (objects) => {
150
150
  return this.map((element) => {
151
+ var _a;
151
152
  const thisObject = import_UIObject.UIObject.valueForKeyPath(
152
153
  valueKeys.arrayByTrimmingToLengthIfLonger(valueKeys.length - 1).join("."),
153
154
  element
154
155
  ) || element;
155
- const elementFunction = import_UIObject.UIObject.valueForKeyPath(valueKeys.join("."), element).bind(
156
+ const elementFunction = (_a = import_UIObject.UIObject.valueForKeyPath(valueKeys.join("."), element)) == null ? void 0 : _a.bind(
156
157
  thisObject,
157
158
  objects
158
159
  );
159
- return elementFunction();
160
+ return elementFunction == null ? void 0 : elementFunction();
160
161
  });
161
162
  };
162
163
  const result = new Proxy(
@@ -297,8 +298,9 @@ if ("objectByCopyingValuesRecursivelyFromObject" in Object.prototype == NO) {
297
298
  const output = Object.assign({}, target);
298
299
  if (isAnObject(target) && isAnObject(source)) {
299
300
  Object.keys(source).forEach(function(key) {
301
+ var _a;
300
302
  if (isAnObject(source[key])) {
301
- output[key] = mergeRecursively(target[key], source[key]);
303
+ output[key] = mergeRecursively((_a = target[key]) != null ? _a : {}, source[key]);
302
304
  } else {
303
305
  Object.assign(output, { [key]: source[key] });
304
306
  }
@@ -354,7 +356,22 @@ if ("integerValue" in Number.prototype == NO) {
354
356
  Object.defineProperty(Number.prototype, "integerValue", {
355
357
  get: function() {
356
358
  return parseInt("" + (Math.round(this) + 0.5));
359
+ },
360
+ enumerable: NO
361
+ });
362
+ }
363
+ if ("constrainedValue" in Number.prototype == NO) {
364
+ Number.prototype.constrainedValue = function(min, max) {
365
+ if (this < min) {
366
+ return min;
357
367
  }
368
+ if (this > max) {
369
+ return max;
370
+ }
371
+ return this;
372
+ };
373
+ Object.defineProperty(Number.prototype, "constrainedValue", {
374
+ enumerable: NO
358
375
  });
359
376
  }
360
377
  if ("integerValue" in Boolean.prototype == NO) {