uicore-ts 1.1.338 → 1.1.352

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.
@@ -91,6 +91,7 @@ const _UIDialogView = class extends import_UIView.UIView {
91
91
  _UIDialogView._activeDialogCount++;
92
92
  if (_UIDialogView._activeDialogCount >= 1) {
93
93
  document.body.style.overflow = "hidden";
94
+ this.style.overflowY = "auto";
94
95
  }
95
96
  }
96
97
  containerView.addSubview(this);
@@ -128,6 +129,7 @@ const _UIDialogView = class extends import_UIView.UIView {
128
129
  if (_UIDialogView._activeDialogCount === 0) {
129
130
  document.body.style.overflow = "";
130
131
  }
132
+ this.style.overflowY = "";
131
133
  }
132
134
  };
133
135
  if (animated) {
@@ -192,8 +194,6 @@ const _UIDialogView = class extends import_UIView.UIView {
192
194
  "100%"
193
195
  );
194
196
  }
195
- const bounds = this.bounds;
196
- const margin = 20;
197
197
  this.view.style.zIndex = "" + this.zIndex;
198
198
  this.view.setNeedsLayout();
199
199
  super.layoutSubviews();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UIDialogView.ts"],
4
- "sourcesContent": ["import { IS_FIREFOX } from \"./ClientCheckers\"\nimport { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { FIRST, IF, IS, nil, NO, YES } from \"./UIObject\"\nimport { UIScrollView } from \"./UIScrollView\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIDialogView<ViewType extends UIView = UIView> extends UIView {\n \n _isAUIDialogView = YES\n _view: ViewType = new UIView() as any\n _appearedAnimated?: boolean\n animationDuration: number = 0.25\n _zIndex: number = 100\n isVisible: boolean = NO\n dismissesOnTapOutside = YES\n \n static _activeDialogCount = 0\n _fillsViewport = NO\n \n constructor(elementID?: string, viewHTMLElement?: HTMLElement) {\n \n super(elementID, viewHTMLElement)\n \n this.addSubview(this.view)\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerTap,\n (sender: UIView, event: Event) => {\n \n this.didDetectTapOutside(sender, event)\n \n }\n )\n \n this.backgroundColor = UIColor.colorWithRGBA(0, 10, 25).colorWithAlpha(0.75) //CBColor.primaryContentColor.colorWithAlpha(0.75)\n \n this.zIndex = this._zIndex\n \n }\n \n \n didDetectTapOutside(sender: UIView, event: Event) {\n \n if (event.target == this.viewHTMLElement && this.dismissesOnTapOutside) {\n this.dismiss(this._appearedAnimated)\n }\n \n }\n \n \n set zIndex(zIndex: number) {\n \n this._zIndex = zIndex\n this.style.zIndex = \"\" + zIndex\n \n }\n \n get zIndex() {\n \n return this._zIndex\n \n }\n \n \n set view(view: ViewType) {\n \n this._view?.removeFromSuperview()\n \n this._view = view\n \n this.addSubview(view)\n \n }\n \n \n get view(): ViewType {\n \n return this._view\n \n }\n \n \n override willAppear(animated: boolean = NO) {\n \n if (animated) {\n \n this.style.opacity = \"0\"\n \n }\n \n this.style.height = \"\"\n \n this._frame = nil\n \n }\n \n \n animateAppearing() {\n \n this.style.opacity = \"1\"\n \n }\n \n animateDisappearing() {\n \n this.style.opacity = \"0\"\n \n }\n \n \n showInView(containerView: UIView, animated: boolean) {\n \n this._fillsViewport = containerView.rootView == containerView\n animated = (animated && !IS_FIREFOX)\n \n this._appearedAnimated = animated\n \n this.willAppear(animated)\n \n \n if (this._fillsViewport) {\n UIDialogView._activeDialogCount++\n if (UIDialogView._activeDialogCount >= 1) {\n document.body.style.overflow = \"hidden\"\n }\n }\n \n containerView.addSubview(this)\n this.view.setNeedsLayoutUpToRootView()\n \n if (animated) {\n \n UIView.layoutViewsIfNeeded()\n this.layoutSubviews()\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n () => this.animateAppearing(),\n nil\n )\n \n \n }\n else {\n \n this.setNeedsLayout()\n \n }\n \n this.isVisible = YES\n \n }\n \n \n showInRootView(animated: boolean) {\n \n this.showInView(UICore.main.rootViewController.view, animated)\n \n }\n \n \n dismiss(animated?: boolean) {\n \n if (!this.isVisible) {\n return\n }\n \n animated = (animated && !IS_FIREFOX)\n \n if (animated == undefined) {\n \n animated = this._appearedAnimated\n \n }\n \n const unlockScroll = () => {\n if (this._fillsViewport) {\n UIDialogView._activeDialogCount = Math.max(0, UIDialogView._activeDialogCount - 1)\n if (UIDialogView._activeDialogCount === 0) {\n document.body.style.overflow = \"\"\n }\n }\n }\n \n if (animated) {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n (() => {\n \n this.animateDisappearing()\n \n }).bind(this),\n () => {\n \n if (this.isVisible == NO) {\n \n this.removeFromSuperview()\n unlockScroll()\n \n }\n \n }\n )\n \n }\n else {\n \n this.removeFromSuperview()\n unlockScroll()\n \n }\n \n this.isVisible = NO\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UICore.broadcastEventName.WindowDidResize) {\n \n this.setNeedsLayout()\n \n }\n \n }\n \n \n override layoutSubviews() {\n \n \n if (!IS(this.view)) {\n \n return\n \n }\n \n //this.frame = this.superview.bounds;\n \n if (this._fillsViewport) {\n const containerRect = this.superview?.viewHTMLElement?.getBoundingClientRect()\n const topOffset = containerRect ? -containerRect.top / UIView.pageScale : 0\n this.setPosition(0, 0, 0, topOffset, window.innerHeight / UIView.pageScale, \"100%\")\n }\n else {\n this.setPosition(0, 0, 0, 0, 0, \"100%\")\n this.setPosition(\n 0,\n 0,\n 0,\n 0,\n FIRST(\n IF(this.superview?.isKindOfClass(UINativeScrollView))(() => this.superview?.scrollSize.height ?? 0)\n .ELSE_IF(this.superview?.isKindOfClass(UIScrollView))(\n () => this.superview?.scrollSize.height ?? 0)\n .ELSE(() => this.superview?.frame.height ?? 0),\n UIView.pageHeight\n ) / UIView.pageScale,\n \"100%\"\n )\n }\n \n const bounds = this.bounds\n \n const margin = 20\n \n //this.view.centerInContainer();\n \n this.view.style.zIndex = \"\" + this.zIndex\n \n this.view.setNeedsLayout()\n \n // this.view.style.maxHeight = \"\" + (bounds.height - margin * 2).integerValue + \"px\";\n // this.view.style.maxWidth = \"\" + (bounds.width - margin * 2).integerValue + \"px\";\n \n \n // var viewIntrinsicRectangle = this.view.intrinsicContentSize();\n // this.view.frame = new UIRectangle((bounds.width - viewIntrinsicRectangle.width)*0.5, )\n \n super.layoutSubviews()\n \n }\n \n \n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2B;AAC3B,qBAAwB;AACxB,oBAAuB;AACvB,gCAAmC;AACnC,sBAA4C;AAC5C,0BAA6B;AAC7B,oBAA6C;AAGtC,MAAM,gBAAN,cAA6D,qBAAO;AAAA,EAavE,YAAY,WAAoB,iBAA+B;AAE3D,UAAM,WAAW,eAAe;AAbpC,4BAAmB;AACnB,iBAAkB,IAAI,qBAAO;AAE7B,6BAA4B;AAC5B,mBAAkB;AAClB,qBAAqB;AACrB,iCAAwB;AAGxB,0BAAiB;AAMb,SAAK,WAAW,KAAK,IAAI;AAEzB,SAAK;AAAA,MACD,qBAAO,aAAa;AAAA,MACpB,CAAC,QAAgB,UAAiB;AAE9B,aAAK,oBAAoB,QAAQ,KAAK;AAAA,MAE1C;AAAA,IACJ;AAEA,SAAK,kBAAkB,uBAAQ,cAAc,GAAG,IAAI,EAAE,EAAE,eAAe,IAAI;AAE3E,SAAK,SAAS,KAAK;AAAA,EAEvB;AAAA,EAGA,oBAAoB,QAAgB,OAAc;AAE9C,QAAI,MAAM,UAAU,KAAK,mBAAmB,KAAK,uBAAuB;AACpE,WAAK,QAAQ,KAAK,iBAAiB;AAAA,IACvC;AAAA,EAEJ;AAAA,EAGA,IAAI,OAAO,QAAgB;AAEvB,SAAK,UAAU;AACf,SAAK,MAAM,SAAS,KAAK;AAAA,EAE7B;AAAA,EAEA,IAAI,SAAS;AAET,W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A;AAAA,cACI,qBAAG,UAAK,cAAL,mBAAgB,cAAc,6CAAmB,EAAE,MAAG;AAxQ7E,gBAAAA,KAAAC;AAwQgF,oBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,WAAW,WAA3B,OAAAC,MAAqC;AAAA,WAAC,EAC7F,SAAQ,UAAK,cAAL,mBAAgB,cAAc,iCAAa;AAAA,YAChD,MAAG;AA1Q/B,kBAAAD,KAAAC;AA0QkC,sBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,WAAW,WAA3B,OAAAC,MAAqC;AAAA;AAAA,UAAC,EAC/C,KAAK,MAAG;AA3QjC,gBAAAD,KAAAC;AA2QoC,oBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,MAAM,WAAtB,OAAAC,MAAgC;AAAA,WAAC;AAAA,UACjD,qBAAO;AAAA,QACX,IAAI,qBAAO;AAAA,QACX;AAAA,MACJ;AAAA,IACJ;AAEA,UAAM,SAAS,KAAK;AAEpB,UAAM,SAAS;AAIf,SAAK,KAAK,MAAM,SAAS,KAAK,KAAK;AAEnC,SAAK,KAAK,eAAe;AASzB,UAAM,eAAe;AAAA,EAEzB;AAGJ;AA/RO,IAAM,eAAN;AAAM,aAUF,qBAAqB;",
4
+ "sourcesContent": ["import { IS_FIREFOX } from \"./ClientCheckers\"\nimport { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { FIRST, IF, IS, nil, NO, YES } from \"./UIObject\"\nimport { UIScrollView } from \"./UIScrollView\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIDialogView<ViewType extends UIView = UIView> extends UIView {\n \n _isAUIDialogView = YES\n _view: ViewType = new UIView() as any\n _appearedAnimated?: boolean\n animationDuration: number = 0.25\n _zIndex: number = 100\n isVisible: boolean = NO\n dismissesOnTapOutside = YES\n \n static _activeDialogCount = 0\n _fillsViewport = NO\n \n constructor(elementID?: string, viewHTMLElement?: HTMLElement) {\n \n super(elementID, viewHTMLElement)\n \n this.addSubview(this.view)\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerTap,\n (sender: UIView, event: Event) => {\n \n this.didDetectTapOutside(sender, event)\n \n }\n )\n \n this.backgroundColor = UIColor.colorWithRGBA(0, 10, 25).colorWithAlpha(0.75) //CBColor.primaryContentColor.colorWithAlpha(0.75)\n \n this.zIndex = this._zIndex\n \n }\n \n \n didDetectTapOutside(sender: UIView, event: Event) {\n \n if (event.target == this.viewHTMLElement && this.dismissesOnTapOutside) {\n this.dismiss(this._appearedAnimated)\n }\n \n }\n \n \n set zIndex(zIndex: number) {\n \n this._zIndex = zIndex\n this.style.zIndex = \"\" + zIndex\n \n }\n \n get zIndex() {\n \n return this._zIndex\n \n }\n \n \n set view(view: ViewType) {\n \n this._view?.removeFromSuperview()\n \n this._view = view\n \n this.addSubview(view)\n \n }\n \n \n get view(): ViewType {\n \n return this._view\n \n }\n \n \n override willAppear(animated: boolean = NO) {\n \n if (animated) {\n \n this.style.opacity = \"0\"\n \n }\n \n this.style.height = \"\"\n \n this._frame = nil\n \n }\n \n \n animateAppearing() {\n \n this.style.opacity = \"1\"\n \n }\n \n animateDisappearing() {\n \n this.style.opacity = \"0\"\n \n }\n \n \n showInView(containerView: UIView, animated: boolean) {\n \n this._fillsViewport = containerView.rootView == containerView\n animated = (animated && !IS_FIREFOX)\n \n this._appearedAnimated = animated\n \n this.willAppear(animated)\n \n \n if (this._fillsViewport) {\n UIDialogView._activeDialogCount++\n if (UIDialogView._activeDialogCount >= 1) {\n document.body.style.overflow = \"hidden\"\n this.style.overflowY = \"auto\"\n }\n }\n \n containerView.addSubview(this)\n this.view.setNeedsLayoutUpToRootView()\n \n if (animated) {\n \n UIView.layoutViewsIfNeeded()\n this.layoutSubviews()\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n () => this.animateAppearing(),\n nil\n )\n \n \n }\n else {\n \n this.setNeedsLayout()\n \n }\n \n this.isVisible = YES\n \n }\n \n \n showInRootView(animated: boolean) {\n \n this.showInView(UICore.main.rootViewController.view, animated)\n \n }\n \n \n dismiss(animated?: boolean) {\n \n if (!this.isVisible) {\n return\n }\n \n animated = (animated && !IS_FIREFOX)\n \n if (animated == undefined) {\n \n animated = this._appearedAnimated\n \n }\n \n const unlockScroll = () => {\n if (this._fillsViewport) {\n UIDialogView._activeDialogCount = Math.max(0, UIDialogView._activeDialogCount - 1)\n if (UIDialogView._activeDialogCount === 0) {\n document.body.style.overflow = \"\"\n }\n this.style.overflowY = \"\"\n }\n }\n \n if (animated) {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n (() => {\n \n this.animateDisappearing()\n \n }).bind(this),\n () => {\n \n if (this.isVisible == NO) {\n \n this.removeFromSuperview()\n unlockScroll()\n \n }\n \n }\n )\n \n }\n else {\n \n this.removeFromSuperview()\n unlockScroll()\n \n }\n \n this.isVisible = NO\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UICore.broadcastEventName.WindowDidResize) {\n \n this.setNeedsLayout()\n \n }\n \n }\n \n \n override layoutSubviews() {\n \n \n if (!IS(this.view)) {\n \n return\n \n }\n \n if (this._fillsViewport) {\n const containerRect = this.superview?.viewHTMLElement?.getBoundingClientRect()\n const topOffset = containerRect ? -containerRect.top / UIView.pageScale : 0\n this.setPosition(0, 0, 0, topOffset, window.innerHeight / UIView.pageScale, \"100%\")\n }\n else {\n this.setPosition(0, 0, 0, 0, 0, \"100%\")\n this.setPosition(\n 0,\n 0,\n 0,\n 0,\n FIRST(\n IF(this.superview?.isKindOfClass(UINativeScrollView))(() => this.superview?.scrollSize.height ?? 0)\n .ELSE_IF(this.superview?.isKindOfClass(UIScrollView))(\n () => this.superview?.scrollSize.height ?? 0)\n .ELSE(() => this.superview?.frame.height ?? 0),\n UIView.pageHeight\n ) / UIView.pageScale,\n \"100%\"\n )\n }\n \n this.view.style.zIndex = \"\" + this.zIndex\n \n this.view.setNeedsLayout()\n \n super.layoutSubviews()\n \n }\n \n \n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2B;AAC3B,qBAAwB;AACxB,oBAAuB;AACvB,gCAAmC;AACnC,sBAA4C;AAC5C,0BAA6B;AAC7B,oBAA6C;AAGtC,MAAM,gBAAN,cAA6D,qBAAO;AAAA,EAavE,YAAY,WAAoB,iBAA+B;AAE3D,UAAM,WAAW,eAAe;AAbpC,4BAAmB;AACnB,iBAAkB,IAAI,qBAAO;AAE7B,6BAA4B;AAC5B,mBAAkB;AAClB,qBAAqB;AACrB,iCAAwB;AAGxB,0BAAiB;AAMb,SAAK,WAAW,KAAK,IAAI;AAEzB,SAAK;AAAA,MACD,qBAAO,aAAa;AAAA,MACpB,CAAC,QAAgB,UAAiB;AAE9B,aAAK,oBAAoB,QAAQ,KAAK;AAAA,MAE1C;AAAA,IACJ;AAEA,SAAK,kBAAkB,uBAAQ,cAAc,GAAG,IAAI,EAAE,EAAE,eAAe,IAAI;AAE3E,SAAK,SAAS,KAAK;AAAA,EAEvB;AAAA,EAGA,oBAAoB,QAAgB,OAAc;AAE9C,QAAI,MAAM,UAAU,KAAK,mBAAmB,KAAK,uBAAuB;AACpE,WAAK,QAAQ,KAAK,iBAAiB;AAAA,IACvC;AAAA,EAEJ;AAAA,EAGA,IAAI,OAAO,QAAgB;AAEvB,SAAK,UAAU;AACf,SAAK,MAAM,SAAS,KAAK;AAAA,EAE7B;AAAA,EAEA,IAAI,SAAS;AAET,WAAO,KAAK;AAAA,EAEhB;AAAA,EAGA,IAAI,KAAK,MAAgB;AAnE7B;AAqEQ,eAAK,UAAL,mBAAY;AAEZ,SAAK,QAAQ;AAEb,SAAK,WAAW,IAAI;AAAA,EAExB;AAAA,EAG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A,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,WAAW,WAA3B,OAAAC,MAAqC;AAAA,WAAC,EAC7F,SAAQ,UAAK,cAAL,mBAAgB,cAAc,iCAAa;AAAA,YAChD,MAAG;AA1Q/B,kBAAAD,KAAAC;AA0QkC,sBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,WAAW,WAA3B,OAAAC,MAAqC;AAAA;AAAA,UAAC,EAC/C,KAAK,MAAG;AA3QjC,gBAAAD,KAAAC;AA2QoC,oBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,MAAM,WAAtB,OAAAC,MAAgC;AAAA,WAAC;AAAA,UACjD,qBAAO;AAAA,QACX,IAAI,qBAAO;AAAA,QACX;AAAA,MACJ;AAAA,IACJ;AAEA,SAAK,KAAK,MAAM,SAAS,KAAK,KAAK;AAEnC,SAAK,KAAK,eAAe;AAEzB,UAAM,eAAe;AAAA,EAEzB;AAGJ;AAlRO,IAAM,eAAN;AAAM,aAUF,qBAAqB;",
6
6
  "names": ["_a", "_b"]
7
7
  }
@@ -11,8 +11,21 @@ export interface UIRouteComponent<T = any> {
11
11
  export declare class UIRoute extends Array<UIRouteComponent> {
12
12
  constructor(hash?: string);
13
13
  static get currentRoute(): UIRoute;
14
- apply(): void;
15
- applyByReplacingCurrentRouteInHistory(): void;
14
+ /**
15
+ * @param forcefully When `true`, applies the route even if its string
16
+ * representation is identical to the current URL hash, causing the browser
17
+ * to fire a `hashchange` event and re-run the full `handleRoute` flow.
18
+ * Use this only when you explicitly need re-entrant navigation (e.g. the
19
+ * "tap the already-active tab to reset to root" feature in TopBarView).
20
+ * Defaults to `false`.
21
+ */
22
+ apply(forcefully?: boolean): void;
23
+ /**
24
+ * @param forcefully When `true`, replaces the current history entry with
25
+ * this route even when the route is identical to the current URL hash.
26
+ * Defaults to `false`.
27
+ */
28
+ applyByReplacingCurrentRouteInHistory(forcefully?: boolean): void;
16
29
  copy(): UIRoute;
17
30
  routeByRemovingComponentsOtherThanOnesNamed(componentNames: string[]): UIRoute;
18
31
  routeByRemovingComponentNamed(componentName: string): UIRoute;
@@ -58,16 +58,16 @@ class UIRoute extends Array {
58
58
  static get currentRoute() {
59
59
  return new UIRoute(window.location.hash);
60
60
  }
61
- apply() {
61
+ apply(forcefully = import_UIObject.NO) {
62
62
  const stringRepresentation = this.stringRepresentation;
63
- if (new UIRoute(window.location.hash).stringRepresentation == stringRepresentation) {
63
+ if (!forcefully && new UIRoute(window.location.hash).stringRepresentation == stringRepresentation) {
64
64
  return;
65
65
  }
66
66
  window.location.hash = stringRepresentation;
67
67
  }
68
- applyByReplacingCurrentRouteInHistory() {
68
+ applyByReplacingCurrentRouteInHistory(forcefully = import_UIObject.NO) {
69
69
  const stringRepresentation = this.stringRepresentation;
70
- if (new UIRoute(window.location.hash).stringRepresentation == stringRepresentation) {
70
+ if (!forcefully && new UIRoute(window.location.hash).stringRepresentation == stringRepresentation) {
71
71
  return;
72
72
  }
73
73
  window.location.replace(this.linkRepresentation);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UIRoute.ts"],
4
- "sourcesContent": ["import { IS_NIL, IS_NOT, NO, ValueOf } from \"./UIObject\"\nimport { UIViewController } from \"./UIViewController\"\n\n\nexport type PropType<TObj, TProp extends keyof TObj> = TObj[TProp];\n\nexport type UIRouteParameters<T = any> = {\n \n [key: string]: string;\n \n} | T;\n\n\nexport interface UIRouteComponent<T = any> {\n \n name: string;\n parameters: UIRouteParameters<T>;\n \n}\n\n\nexport class UIRoute extends Array<UIRouteComponent> {\n \n constructor(hash?: string) {\n \n super()\n \n if (!hash || !hash.startsWith) {\n \n return\n \n }\n \n if (hash.startsWith(\"#\")) {\n hash = hash.slice(1)\n }\n \n hash = decodeURIComponent(hash)\n \n const components = hash.split(\"]\")\n components.forEach(component => {\n \n const componentName = component.split(\"[\")[0]\n const parameters: Record<string, string> = {}\n \n if (!componentName) {\n return\n }\n \n const parametersString = component.split(\"[\")[1] || \"\"\n const parameterPairStrings = parametersString.split(\",\") || []\n \n parameterPairStrings.forEach(pairString => {\n \n const keyAndValueArray = pairString.split(\":\")\n const key = decodeURIComponent(keyAndValueArray[0])\n const value = decodeURIComponent(keyAndValueArray[1])\n \n if (key) {\n parameters[key] = value\n }\n \n })\n \n \n this.push({\n name: componentName,\n parameters: parameters\n })\n \n })\n \n \n }\n \n \n static get currentRoute() {\n \n return new UIRoute(window.location.hash)\n \n }\n \n \n apply() {\n \n const stringRepresentation = this.stringRepresentation\n if (new UIRoute(window.location.hash).stringRepresentation == stringRepresentation) {\n return\n }\n \n window.location.hash = stringRepresentation\n \n }\n \n \n applyByReplacingCurrentRouteInHistory() {\n \n const stringRepresentation = this.stringRepresentation\n if (new UIRoute(window.location.hash).stringRepresentation == stringRepresentation) {\n return\n }\n \n window.location.replace(this.linkRepresentation)\n \n }\n \n \n override copy() {\n const result = new UIRoute(this.stringRepresentation)\n return result\n }\n \n \n routeByRemovingComponentsOtherThanOnesNamed(componentNames: string[]) {\n const result = this.copy()\n const indexesToRemove: number[] = []\n result.forEach(function (component, index, array) {\n if (!componentNames.contains(component.name)) {\n indexesToRemove.push(index)\n }\n })\n indexesToRemove.forEach(function (indexToRemove, index, array) {\n result.removeElementAtIndex(indexToRemove)\n })\n return result\n }\n \n \n routeByRemovingComponentNamed(componentName: string) {\n const result = this.copy()\n const componentIndex = result.findIndex(function (component, index) {\n return (component.name == componentName)\n })\n if (componentIndex != -1) {\n result.splice(componentIndex, 1)\n }\n return result\n }\n \n \n routeByRemovingParameterInComponent(componentName: string, parameterName: string, removeComponentIfEmpty = NO) {\n let result = this.copy()\n let parameters = result.componentWithName(componentName)?.parameters ?? {}\n delete parameters[parameterName]\n result = result.routeWithComponent(componentName, parameters)\n if (removeComponentIfEmpty && Object.keys(parameters).length == 0) {\n result = result.routeByRemovingComponentNamed(componentName)\n }\n return result\n }\n \n routeBySettingParameterInComponent(componentName: string, parameterName: string, valueToSet: string) {\n let result = this.copy()\n if (IS_NIL(valueToSet) || IS_NIL(parameterName)) {\n return result\n }\n let parameters = result.componentWithName(componentName)?.parameters\n if (IS_NOT(parameters)) {\n parameters = {}\n }\n parameters[parameterName] = valueToSet\n result = result.routeWithComponent(componentName, parameters)\n return result\n }\n \n \n routeWithViewControllerComponent<T extends typeof UIViewController>(\n viewController: T,\n parameters: UIRouteParameters<{ [P in keyof T[\"ParameterIdentifierName\"]]: string }>,\n extendParameters: boolean = NO\n ) {\n \n return this.routeWithComponent(viewController.routeComponentName, parameters, extendParameters)\n \n }\n \n routeWithComponent(name: string, parameters: UIRouteParameters, extendParameters: boolean = NO) {\n \n const result = this.copy()\n let component = result.componentWithName(name)\n if (IS_NOT(component)) {\n component = {\n name: name,\n parameters: {}\n }\n result.push(component)\n }\n \n if (IS_NOT(parameters)) {\n \n parameters = {}\n \n }\n \n if (extendParameters) {\n component.parameters = Object.assign(component.parameters, parameters)\n }\n else {\n component.parameters = parameters\n }\n \n return result\n \n }\n \n navigateBySettingComponent(name: string, parameters: UIRouteParameters, extendParameters: boolean = NO) {\n \n this.routeWithComponent(name, parameters, extendParameters).apply()\n \n }\n \n \n componentWithViewController<T extends typeof UIViewController>(viewController: T): UIRouteComponent<{ [P in ValueOf<T[\"ParameterIdentifierName\"]>]: string }> | undefined {\n \n return this.componentWithName(viewController.routeComponentName)\n \n }\n \n componentWithName(name: string): UIRouteComponent | undefined {\n let result\n this.forEach(function (component, index, self) {\n if (component.name == name) {\n result = component\n }\n })\n return result\n }\n \n \n get linkRepresentation() {\n return \"#\" + this.stringRepresentation\n }\n \n \n get stringRepresentation() {\n \n let result = \"\"\n this.forEach(function (component, index, self) {\n result = result + component.name\n const parameters = component.parameters\n result = result + \"[\"\n Object.keys(parameters).forEach(function (key, index, keys) {\n if (index) {\n result = result + \",\"\n }\n result = result + encodeURIComponent(key) + \":\" + encodeURIComponent(parameters[key])\n })\n result = result + \"]\"\n })\n \n return result\n \n }\n \n \n}\n\n\n\n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AM;AAC3C,UAAI,UAAU,QAAQ,MAAM;AACxB,iBAAS;AAAA,MACb;AAAA,IACJ,CAAC;AACD,WAAO;AAAA,EACX;AAAA,EAGA,IAAI,qBAAqB;AACrB,WAAO,MAAM,KAAK;AAAA,EACtB;AAAA,EAGA,IAAI,uBAAuB;AAEvB,QAAI,SAAS;AACb,SAAK,QAAQ,SAAU,WAAW,OAAO,MAAM;AAC3C,eAAS,SAAS,UAAU;AAC5B,YAAM,aAAa,UAAU;AAC7B,eAAS,SAAS;AAClB,aAAO,KAAK,UAAU,EAAE,QAAQ,SAAU,KAAKA,QAAO,MAAM;AACxD,YAAIA,QAAO;AACP,mBAAS,SAAS;AAAA,QACtB;AACA,iBAAS,SAAS,mBAAmB,GAAG,IAAI,MAAM,mBAAmB,WAAW,IAAI;AAAA,MACxF,CAAC;AACD,eAAS,SAAS;AAAA,IACtB,CAAC;AAED,WAAO;AAAA,EAEX;AAGJ;",
4
+ "sourcesContent": ["import { IS_NIL, IS_NOT, NO, ValueOf } from \"./UIObject\"\nimport { UIViewController } from \"./UIViewController\"\n\n\nexport type PropType<TObj, TProp extends keyof TObj> = TObj[TProp];\n\nexport type UIRouteParameters<T = any> = {\n \n [key: string]: string;\n \n} | T;\n\n\nexport interface UIRouteComponent<T = any> {\n \n name: string;\n parameters: UIRouteParameters<T>;\n \n}\n\n\nexport class UIRoute extends Array<UIRouteComponent> {\n \n constructor(hash?: string) {\n \n super()\n \n if (!hash || !hash.startsWith) {\n \n return\n \n }\n \n if (hash.startsWith(\"#\")) {\n hash = hash.slice(1)\n }\n \n hash = decodeURIComponent(hash)\n \n const components = hash.split(\"]\")\n components.forEach(component => {\n \n const componentName = component.split(\"[\")[0]\n const parameters: Record<string, string> = {}\n \n if (!componentName) {\n return\n }\n \n const parametersString = component.split(\"[\")[1] || \"\"\n const parameterPairStrings = parametersString.split(\",\") || []\n \n parameterPairStrings.forEach(pairString => {\n \n const keyAndValueArray = pairString.split(\":\")\n const key = decodeURIComponent(keyAndValueArray[0])\n const value = decodeURIComponent(keyAndValueArray[1])\n \n if (key) {\n parameters[key] = value\n }\n \n })\n \n \n this.push({\n name: componentName,\n parameters: parameters\n })\n \n })\n \n \n }\n \n \n static get currentRoute() {\n \n return new UIRoute(window.location.hash)\n \n }\n \n \n /**\n * @param forcefully When `true`, applies the route even if its string\n * representation is identical to the current URL hash, causing the browser\n * to fire a `hashchange` event and re-run the full `handleRoute` flow.\n * Use this only when you explicitly need re-entrant navigation (e.g. the\n * \"tap the already-active tab to reset to root\" feature in TopBarView).\n * Defaults to `false`.\n */\n apply(forcefully = NO) {\n \n const stringRepresentation = this.stringRepresentation\n if (!forcefully && new UIRoute(window.location.hash).stringRepresentation == stringRepresentation) {\n return\n }\n \n window.location.hash = stringRepresentation\n \n }\n \n \n /**\n * @param forcefully When `true`, replaces the current history entry with\n * this route even when the route is identical to the current URL hash.\n * Defaults to `false`.\n */\n applyByReplacingCurrentRouteInHistory(forcefully = NO) {\n \n const stringRepresentation = this.stringRepresentation\n if (!forcefully && new UIRoute(window.location.hash).stringRepresentation == stringRepresentation) {\n return\n }\n \n window.location.replace(this.linkRepresentation)\n \n }\n \n \n override copy() {\n const result = new UIRoute(this.stringRepresentation)\n return result\n }\n \n \n routeByRemovingComponentsOtherThanOnesNamed(componentNames: string[]) {\n const result = this.copy()\n const indexesToRemove: number[] = []\n result.forEach(function (component, index, array) {\n if (!componentNames.contains(component.name)) {\n indexesToRemove.push(index)\n }\n })\n indexesToRemove.forEach(function (indexToRemove, index, array) {\n result.removeElementAtIndex(indexToRemove)\n })\n return result\n }\n \n \n routeByRemovingComponentNamed(componentName: string) {\n const result = this.copy()\n const componentIndex = result.findIndex(function (component, index) {\n return (component.name == componentName)\n })\n if (componentIndex != -1) {\n result.splice(componentIndex, 1)\n }\n return result\n }\n \n \n routeByRemovingParameterInComponent(componentName: string, parameterName: string, removeComponentIfEmpty = NO) {\n let result = this.copy()\n let parameters = result.componentWithName(componentName)?.parameters ?? {}\n delete parameters[parameterName]\n result = result.routeWithComponent(componentName, parameters)\n if (removeComponentIfEmpty && Object.keys(parameters).length == 0) {\n result = result.routeByRemovingComponentNamed(componentName)\n }\n return result\n }\n \n routeBySettingParameterInComponent(componentName: string, parameterName: string, valueToSet: string) {\n let result = this.copy()\n if (IS_NIL(valueToSet) || IS_NIL(parameterName)) {\n return result\n }\n let parameters = result.componentWithName(componentName)?.parameters\n if (IS_NOT(parameters)) {\n parameters = {}\n }\n parameters[parameterName] = valueToSet\n result = result.routeWithComponent(componentName, parameters)\n return result\n }\n \n \n routeWithViewControllerComponent<T extends typeof UIViewController>(\n viewController: T,\n parameters: UIRouteParameters<{ [P in keyof T[\"ParameterIdentifierName\"]]: string }>,\n extendParameters: boolean = NO\n ) {\n \n return this.routeWithComponent(viewController.routeComponentName, parameters, extendParameters)\n \n }\n \n routeWithComponent(name: string, parameters: UIRouteParameters, extendParameters: boolean = NO) {\n \n const result = this.copy()\n let component = result.componentWithName(name)\n if (IS_NOT(component)) {\n component = {\n name: name,\n parameters: {}\n }\n result.push(component)\n }\n \n if (IS_NOT(parameters)) {\n \n parameters = {}\n \n }\n \n if (extendParameters) {\n component.parameters = Object.assign(component.parameters, parameters)\n }\n else {\n component.parameters = parameters\n }\n \n return result\n \n }\n \n navigateBySettingComponent(name: string, parameters: UIRouteParameters, extendParameters: boolean = NO) {\n \n this.routeWithComponent(name, parameters, extendParameters).apply()\n \n }\n \n \n componentWithViewController<T extends typeof UIViewController>(viewController: T): UIRouteComponent<{ [P in ValueOf<T[\"ParameterIdentifierName\"]>]: string }> | undefined {\n \n return this.componentWithName(viewController.routeComponentName)\n \n }\n \n componentWithName(name: string): UIRouteComponent | undefined {\n let result\n this.forEach(function (component, index, self) {\n if (component.name == name) {\n result = component\n }\n })\n return result\n }\n \n \n get linkRepresentation() {\n return \"#\" + this.stringRepresentation\n }\n \n \n get stringRepresentation() {\n \n let result = \"\"\n this.forEach(function (component, index, self) {\n result = result + component.name\n const parameters = component.parameters\n result = result + \"[\"\n Object.keys(parameters).forEach(function (key, index, keys) {\n if (index) {\n result = result + \",\"\n }\n result = result + encodeURIComponent(key) + \":\" + encodeURIComponent(parameters[key])\n })\n result = result + \"]\"\n })\n \n return result\n \n }\n \n \n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA4C;AAqBrC,MAAM,gBAAgB,MAAwB;AAAA,EAEjD,YAAY,MAAe;AAEvB,UAAM;AAEN,QAAI,CAAC,QAAQ,CAAC,KAAK,YAAY;AAE3B;AAAA,IAEJ;AAEA,QAAI,KAAK,WAAW,GAAG,GAAG;AACtB,aAAO,KAAK,MAAM,CAAC;AAAA,IACvB;AAEA,WAAO,mBAAmB,IAAI;AAE9B,UAAM,aAAa,KAAK,MAAM,GAAG;AACjC,eAAW,QAAQ,eAAa;AAE5B,YAAM,gBAAgB,UAAU,MAAM,GAAG,EAAE;AAC3C,YAAM,aAAqC,CAAC;AAE5C,UAAI,CAAC,eAAe;AAChB;AAAA,MACJ;AAEA,YAAM,mBAAmB,UAAU,MAAM,GAAG,EAAE,MAAM;AACpD,YAAM,uBAAuB,iBAAiB,MAAM,GAAG,KAAK,CAAC;AAE7D,2BAAqB,QAAQ,gBAAc;AAEvC,cAAM,mBAAmB,WAAW,MAAM,GAAG;AAC7C,cAAM,MAAM,mBAAmB,iBAAiB,EAAE;AAClD,cAAM,QAAQ,mBAAmB,iBAAiB,EAAE;AAEpD,YAAI,KAAK;AACL,qBAAW,OAAO;AAAA,QACtB;AAAA,MAEJ,CAAC;AAGD,WAAK,KAAK;AAAA,QACN,MAAM;AAAA,QACN;AAAA,MACJ,CAAC;AAAA,IAEL,CAAC;AAAA,EAGL;AAAA,EAGA,WAAW,eAAe;AAEtB,WAAO,IAAI,QAAQ,OAAO,SAAS,IAAI;AAAA,EAE3C;AAAA,EAWA,MAAM,aAAa,oBAAI;AAEnB,UAAM,uBAAuB,KAAK;AAClC,QAAI,CAAC,cAAc,I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AA,EAEnE;AAAA,EAEA,kBAAkB,MAA4C;AAC1D,QAAI;AACJ,SAAK,QAAQ,SAAU,WAAW,OAAO,MAAM;AAC3C,UAAI,UAAU,QAAQ,MAAM;AACxB,iBAAS;AAAA,MACb;AAAA,IACJ,CAAC;AACD,WAAO;AAAA,EACX;AAAA,EAGA,IAAI,qBAAqB;AACrB,WAAO,MAAM,KAAK;AAAA,EACtB;AAAA,EAGA,IAAI,uBAAuB;AAEvB,QAAI,SAAS;AACb,SAAK,QAAQ,SAAU,WAAW,OAAO,MAAM;AAC3C,eAAS,SAAS,UAAU;AAC5B,YAAM,aAAa,UAAU;AAC7B,eAAS,SAAS;AAClB,aAAO,KAAK,UAAU,EAAE,QAAQ,SAAU,KAAKA,QAAO,MAAM;AACxD,YAAIA,QAAO;AACP,mBAAS,SAAS;AAAA,QACtB;AACA,iBAAS,SAAS,mBAAmB,GAAG,IAAI,MAAM,mBAAmB,WAAW,IAAI;AAAA,MACxF,CAAC;AACD,eAAS,SAAS;AAAA,IACtB,CAAC;AAED,WAAO;AAAA,EAEX;AAGJ;",
6
6
  "names": ["index"]
7
7
  }
@@ -87,6 +87,7 @@ export declare function UIComponentView(target: Function, context: ClassDecorato
87
87
  export declare class UIView extends UIObject {
88
88
  _nativeSelectionEnabled: boolean;
89
89
  _shouldLayout?: boolean;
90
+ _shouldSetNeedsLayoutAfterAddingToViewTree: boolean;
90
91
  _UITableViewRowIndex?: number;
91
92
  _UITableViewReusabilityIdentifier: any;
92
93
  _UIViewIntrinsicTemporaryWidth?: string;
@@ -77,6 +77,7 @@ const _UIView = class extends import_UIObject.UIObject {
77
77
  constructor(elementID = "UIView" + _UIView.nextIndex, viewHTMLElement = null, elementType = null, preInitConfiguratorObject) {
78
78
  super();
79
79
  this._nativeSelectionEnabled = import_UIObject.YES;
80
+ this._shouldSetNeedsLayoutAfterAddingToViewTree = import_UIObject.NO;
80
81
  this._enabled = import_UIObject.YES;
81
82
  this._backgroundColor = import_UIObject.nil;
82
83
  this._liveCSSValues = /* @__PURE__ */ new Map();
@@ -1176,6 +1177,7 @@ const _UIView = class extends import_UIObject.UIObject {
1176
1177
  setNeedsLayout() {
1177
1178
  var _a, _b;
1178
1179
  this.clearIntrinsicSizeCache();
1180
+ this._shouldSetNeedsLayoutAfterAddingToViewTree = import_UIObject.NO;
1179
1181
  if (this.isVirtualLayouting) {
1180
1182
  return;
1181
1183
  }
@@ -1357,7 +1359,7 @@ const _UIView = class extends import_UIObject.UIObject {
1357
1359
  }
1358
1360
  view.core = this.core;
1359
1361
  view.didMoveToSuperview(this);
1360
- if (this.superview && this.isMemberOfViewTree) {
1362
+ if ((this.superview || this.rootView == this) && this.isMemberOfViewTree) {
1361
1363
  view.broadcastEventInSubtree({
1362
1364
  name: _UIView.broadcastEventName.AddedToViewTree,
1363
1365
  parameters: void 0
@@ -1396,6 +1398,9 @@ const _UIView = class extends import_UIObject.UIObject {
1396
1398
  }
1397
1399
  }
1398
1400
  cancelNeedsLayout() {
1401
+ if (this._shouldLayout) {
1402
+ this._shouldSetNeedsLayoutAfterAddingToViewTree = import_UIObject.YES;
1403
+ }
1399
1404
  this._shouldLayout = import_UIObject.NO;
1400
1405
  }
1401
1406
  removeFromSuperview() {
@@ -1446,6 +1451,10 @@ const _UIView = class extends import_UIObject.UIObject {
1446
1451
  }
1447
1452
  wasAddedToViewTree() {
1448
1453
  _UIView.resizeObserver.observe(this.viewHTMLElement);
1454
+ if (this._shouldSetNeedsLayoutAfterAddingToViewTree) {
1455
+ this._shouldSetNeedsLayoutAfterAddingToViewTree = import_UIObject.NO;
1456
+ this.setNeedsLayout();
1457
+ }
1449
1458
  if (_UIView.annotatePathOnViewHTMLElements) {
1450
1459
  this._annotatePathOnViewHTMLElement();
1451
1460
  }