uicore-ts 1.1.382 → 1.1.385
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiledScripts/UICore.d.ts +24 -0
- package/compiledScripts/UICore.js +56 -8
- package/compiledScripts/UICore.js.map +2 -2
- package/compiledScripts/UIDialogView.js +11 -2
- package/compiledScripts/UIDialogView.js.map +2 -2
- package/compiledScripts/UIRectangle.d.ts +1 -1
- package/compiledScripts/UIRectangle.js +7 -9
- package/compiledScripts/UIRectangle.js.map +2 -2
- package/compiledScripts/UITableView.d.ts +39 -0
- package/compiledScripts/UITableView.js +11 -0
- package/compiledScripts/UITableView.js.map +2 -2
- package/compiledScripts/UIViewController.d.ts +11 -1
- package/compiledScripts/UIViewController.js +11 -4
- package/compiledScripts/UIViewController.js.map +2 -2
- package/package.json +1 -1
- package/scripts/UICore.ts +116 -32
- package/scripts/UIDialogView.ts +46 -23
- package/scripts/UIRectangle.ts +71 -73
- package/scripts/UITableView.ts +61 -6
- package/scripts/UIViewController.ts +37 -11
|
@@ -12,5 +12,29 @@ export declare class UICore extends UIObject {
|
|
|
12
12
|
RouteDidChange: string;
|
|
13
13
|
WindowDidResize: string;
|
|
14
14
|
};
|
|
15
|
+
_isApplyingRoute: boolean;
|
|
16
|
+
_hasQueuedRouteChangeWhileApplying: boolean;
|
|
17
|
+
_currentRouteApplicationPromise?: Promise<void>;
|
|
15
18
|
constructor(rootDivElementID: string, rootViewControllerClass: typeof UIViewController, paddingLength?: number);
|
|
19
|
+
/**
|
|
20
|
+
* Re-runs route handling for `UIRoute.currentRoute` against `rootViewController`,
|
|
21
|
+
* serialized against every other caller of this method (including the
|
|
22
|
+
* `hashchange` listener installed in the constructor).
|
|
23
|
+
*
|
|
24
|
+
* This is the ONLY correct way to force route handling to (re-)run - never
|
|
25
|
+
* call `rootViewController.handleRoute(...)` or `handleRouteRecursively(...)`
|
|
26
|
+
* directly. A route change can legitimately be requested twice in quick
|
|
27
|
+
* succession from independent, uncoordinated places (e.g. two related
|
|
28
|
+
* server-pushed broadcasts derived from one real-world event, each
|
|
29
|
+
* triggering its own re-apply). Without serialization, two concurrent,
|
|
30
|
+
* un-synchronized route applications race on shared root-view-controller
|
|
31
|
+
* state (`contentViewController`, `detailsViewController`) and whichever
|
|
32
|
+
* finishes last wins - regardless of which request was actually last, or
|
|
33
|
+
* which request even reflects the current, settled state. Serializing here
|
|
34
|
+
* instead coalesces a request that arrives mid-application into a single
|
|
35
|
+
* trailing re-run rather than starting a second, overlapping one, and that
|
|
36
|
+
* re-run re-reads `UIRoute.currentRoute` fresh once the burst has settled,
|
|
37
|
+
* so the final state always matches the truly-last route.
|
|
38
|
+
*/
|
|
39
|
+
reapplyCurrentRoute(): Promise<void>;
|
|
16
40
|
}
|
|
@@ -16,6 +16,26 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __async = (__this, __arguments, generator) => {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
var fulfilled = (value) => {
|
|
22
|
+
try {
|
|
23
|
+
step(generator.next(value));
|
|
24
|
+
} catch (e) {
|
|
25
|
+
reject(e);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var rejected = (value) => {
|
|
29
|
+
try {
|
|
30
|
+
step(generator.throw(value));
|
|
31
|
+
} catch (e) {
|
|
32
|
+
reject(e);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
36
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
37
|
+
});
|
|
38
|
+
};
|
|
19
39
|
var UICore_exports = {};
|
|
20
40
|
__export(UICore_exports, {
|
|
21
41
|
UICore: () => UICore
|
|
@@ -30,6 +50,8 @@ const _UICore = class extends import_UIObject.UIObject {
|
|
|
30
50
|
constructor(rootDivElementID, rootViewControllerClass, paddingLength = 20) {
|
|
31
51
|
super();
|
|
32
52
|
this.paddingLength = paddingLength;
|
|
53
|
+
this._isApplyingRoute = false;
|
|
54
|
+
this._hasQueuedRouteChangeWhileApplying = false;
|
|
33
55
|
_UICore.RootViewControllerClass = rootViewControllerClass;
|
|
34
56
|
_UICore.main = _UICore.main || this;
|
|
35
57
|
const rootViewElement = document.getElementById(rootDivElementID);
|
|
@@ -52,9 +74,14 @@ const _UICore = class extends import_UIObject.UIObject {
|
|
|
52
74
|
);
|
|
53
75
|
this.rootViewController.view.addTargetForControlEvent(
|
|
54
76
|
import_UIView.UIView.controlEvent.PointerUpInside,
|
|
55
|
-
() => {
|
|
56
|
-
var _a
|
|
57
|
-
|
|
77
|
+
(sender, event) => {
|
|
78
|
+
var _a;
|
|
79
|
+
const activeElement = document.activeElement;
|
|
80
|
+
const eventTarget = event == null ? void 0 : event.target;
|
|
81
|
+
if (activeElement && eventTarget && (activeElement === eventTarget || activeElement.contains(eventTarget))) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
(_a = activeElement == null ? void 0 : activeElement.blur) == null ? void 0 : _a.call(activeElement);
|
|
58
85
|
}
|
|
59
86
|
);
|
|
60
87
|
const windowDidResize = () => {
|
|
@@ -81,15 +108,36 @@ const _UICore = class extends import_UIObject.UIObject {
|
|
|
81
108
|
};
|
|
82
109
|
window.addEventListener("scroll", didScroll, false);
|
|
83
110
|
const hashDidChange = () => {
|
|
84
|
-
this.
|
|
85
|
-
this.rootViewController.view.broadcastEventInSubtree({
|
|
86
|
-
name: _UICore.broadcastEventName.RouteDidChange,
|
|
87
|
-
parameters: import_UIObject.nil
|
|
88
|
-
});
|
|
111
|
+
this.reapplyCurrentRoute();
|
|
89
112
|
};
|
|
90
113
|
window.addEventListener("hashchange", hashDidChange, false);
|
|
91
114
|
hashDidChange();
|
|
92
115
|
}
|
|
116
|
+
reapplyCurrentRoute() {
|
|
117
|
+
return __async(this, null, function* () {
|
|
118
|
+
if (this._isApplyingRoute) {
|
|
119
|
+
this._hasQueuedRouteChangeWhileApplying = true;
|
|
120
|
+
return this._currentRouteApplicationPromise;
|
|
121
|
+
}
|
|
122
|
+
this._isApplyingRoute = true;
|
|
123
|
+
this._currentRouteApplicationPromise = (() => __async(this, null, function* () {
|
|
124
|
+
try {
|
|
125
|
+
do {
|
|
126
|
+
this._hasQueuedRouteChangeWhileApplying = false;
|
|
127
|
+
yield this.rootViewController.handleRouteRecursively(import_UIRoute.UIRoute.currentRoute);
|
|
128
|
+
this.rootViewController.view.broadcastEventInSubtree({
|
|
129
|
+
name: _UICore.broadcastEventName.RouteDidChange,
|
|
130
|
+
parameters: import_UIObject.nil
|
|
131
|
+
});
|
|
132
|
+
} while (this._hasQueuedRouteChangeWhileApplying);
|
|
133
|
+
} finally {
|
|
134
|
+
this._isApplyingRoute = false;
|
|
135
|
+
this._currentRouteApplicationPromise = void 0;
|
|
136
|
+
}
|
|
137
|
+
}))();
|
|
138
|
+
return this._currentRouteApplicationPromise;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
93
141
|
};
|
|
94
142
|
let UICore = _UICore;
|
|
95
143
|
UICore.languageService = import_UIObject.nil;
|
|
@@ -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
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import \"./UICoreExtensions\"\nimport { UILanguageService } from \"./UIInterfaces\"\nimport { nil, NO, UIObject } from \"./UIObject\"\nimport { UIRoute } from \"./UIRoute\"\nimport { UIView } from \"./UIView\"\nimport { UIViewController } from \"./UIViewController\"\n\n\nexport class UICore extends UIObject {\n\n rootViewController: UIViewController\n\n\n\n static RootViewControllerClass: typeof UIViewController\n static main: UICore\n\n static languageService: UILanguageService = nil\n\n static readonly broadcastEventName = {\n\n \"RouteDidChange\": \"RouteDidChange\",\n \"WindowDidResize\": \"WindowDidResize\"\n\n }\n\n // See `reapplyCurrentRoute` for why these exist and why route application\n // must always go through it rather than calling `rootViewController.handleRoute`\n // or `handleRouteRecursively` directly.\n _isApplyingRoute = false\n _hasQueuedRouteChangeWhileApplying = false\n _currentRouteApplicationPromise?: Promise<void>\n\n constructor(rootDivElementID: string, rootViewControllerClass: typeof UIViewController, public paddingLength = 20) {\n \n super()\n \n UICore.RootViewControllerClass = rootViewControllerClass\n UICore.main = UICore.main || this\n \n const rootViewElement = document.getElementById(rootDivElementID)\n const rootView = new UIView(rootDivElementID, rootViewElement)\n rootView.pausesPointerEvents = NO //YES;\n rootView.core = this\n \n if (UICore.RootViewControllerClass) {\n \n if (!(UICore.RootViewControllerClass.prototype instanceof UIViewController) ||\n (UICore.RootViewControllerClass as any) === UIViewController) {\n \n console.log(\n \"Error, UICore.RootViewControllerClass must be UIViewController or a subclass of UIViewController, \" +\n \"falling back to UIViewController.\"\n )\n \n UICore.RootViewControllerClass = UIViewController\n \n }\n \n this.rootViewController = new UICore.RootViewControllerClass(rootView)\n \n }\n else {\n \n this.rootViewController = new UIViewController(rootView)\n \n }\n \n this.rootViewController.viewWillAppear().then(() =>\n this.rootViewController.viewDidAppear()\n )\n \n \n this.rootViewController.view.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => {\n\n // Only dismiss focus for taps genuinely outside the focused element - not for\n // the tap that just focused it (or a tap on one of its own children). Native\n // controls like <select> gain focus on mousedown and open their own popup; if\n // this handler blurs them on the very next PointerUpInside regardless of target,\n // it closes that popup before the user can pick an option (macOS Chrome renders\n // <select> popups as a native control that closes as soon as its anchor blurs).\n const activeElement = document.activeElement as HTMLElement | null\n const eventTarget = event?.target as Node | null\n\n if (activeElement && eventTarget &&\n (activeElement === eventTarget || activeElement.contains(eventTarget))) {\n return\n }\n\n activeElement?.blur?.()\n\n }\n )\n \n \n const windowDidResize = () => {\n \n UIView.resetLayoutCycleTrackingForAllViews()\n \n this.rootViewController.view.forEachViewInSubtree((view) => {\n \n view._frameCache = undefined\n \n })\n // Doing layout two times to prevent page scrollbars from confusing the layout\n this.rootViewController.view.setNeedsLayout()\n this.rootViewController._triggerLayoutViewSubviews()\n UIView.layoutViewsIfNeeded()\n \n this.rootViewController._triggerLayoutViewSubviews()\n UIView.layoutViewsIfNeeded()\n \n this.rootViewController.view.broadcastEventInSubtree({\n \n name: UICore.broadcastEventName.WindowDidResize,\n parameters: nil\n \n })\n \n }\n \n window.addEventListener(\"resize\", windowDidResize)\n \n const didScroll = () => {\n \n //code\n \n this.rootViewController.view.broadcastEventInSubtree({\n \n name: UIView.broadcastEventName.PageDidScroll,\n parameters: nil\n \n })\n \n \n }\n \n window.addEventListener(\"scroll\", didScroll, false)\n\n const hashDidChange = () => {\n\n //code\n\n this.reapplyCurrentRoute()\n\n }\n\n window.addEventListener(\"hashchange\", hashDidChange, false)\n\n hashDidChange()\n\n\n }\n\n\n /**\n * Re-runs route handling for `UIRoute.currentRoute` against `rootViewController`,\n * serialized against every other caller of this method (including the\n * `hashchange` listener installed in the constructor).\n *\n * This is the ONLY correct way to force route handling to (re-)run - never\n * call `rootViewController.handleRoute(...)` or `handleRouteRecursively(...)`\n * directly. A route change can legitimately be requested twice in quick\n * succession from independent, uncoordinated places (e.g. two related\n * server-pushed broadcasts derived from one real-world event, each\n * triggering its own re-apply). Without serialization, two concurrent,\n * un-synchronized route applications race on shared root-view-controller\n * state (`contentViewController`, `detailsViewController`) and whichever\n * finishes last wins - regardless of which request was actually last, or\n * which request even reflects the current, settled state. Serializing here\n * instead coalesces a request that arrives mid-application into a single\n * trailing re-run rather than starting a second, overlapping one, and that\n * re-run re-reads `UIRoute.currentRoute` fresh once the burst has settled,\n * so the final state always matches the truly-last route.\n */\n async reapplyCurrentRoute(): Promise<void> {\n\n if (this._isApplyingRoute) {\n\n // Joining an in-flight application: request one more loop pass\n // (guaranteed to observe `UIRoute.currentRoute` fresh, since the\n // owner below re-reads it at the top of every pass) and await the\n // SAME promise the owner is already awaiting, rather than\n // returning early - a caller of this method expects route\n // handling to have actually run by the time it resolves.\n this._hasQueuedRouteChangeWhileApplying = true\n return this._currentRouteApplicationPromise\n\n }\n\n this._isApplyingRoute = true\n\n this._currentRouteApplicationPromise = (async () => {\n\n try {\n\n do {\n\n this._hasQueuedRouteChangeWhileApplying = false\n\n await this.rootViewController.handleRouteRecursively(UIRoute.currentRoute)\n\n this.rootViewController.view.broadcastEventInSubtree({\n\n name: UICore.broadcastEventName.RouteDidChange,\n parameters: nil\n\n })\n\n } while (this._hasQueuedRouteChangeWhileApplying)\n\n }\n finally {\n\n this._isApplyingRoute = false\n this._currentRouteApplicationPromise = undefined\n\n }\n\n })()\n\n return this._currentRouteApplicationPromise\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,EAyBjC,YAAY,kBAA0B,yB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WAAW;AACrB,MAAI,MAAM,GAAG;AACT,WAAO;AAAA,EACX;AAEA,MAAI,CAAC,KAAK;AACV,eAAa,KAAK,IAAI,CAAC,MAAM,IAAI;AACjC,MAAI,KAAK,GAAG;AACR,WAAO;AAAA,EACX;AACA,OAAK,IAAI,KAAK,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,KAAI;AACxD,QAAI,KAAK,KAAK,EAAE,OAAO,GAAG;AACtB,aAAO;AAAA,IACX;AACA;AAAA,EACJ;AACA,SAAO;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -134,6 +134,15 @@ const _UIDialogView = class extends import_UIView.UIView {
|
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
if (animated) {
|
|
137
|
+
let hasCompletedDismissal = import_UIObject.NO;
|
|
138
|
+
const completeDismissalIfNeeded = () => {
|
|
139
|
+
if (hasCompletedDismissal) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
hasCompletedDismissal = import_UIObject.YES;
|
|
143
|
+
this.removeFromSuperview();
|
|
144
|
+
unlockScroll();
|
|
145
|
+
};
|
|
137
146
|
import_UIView.UIView.animateViewOrViewsWithDurationDelayAndFunction(
|
|
138
147
|
this,
|
|
139
148
|
this.animationDuration,
|
|
@@ -144,12 +153,12 @@ const _UIDialogView = class extends import_UIView.UIView {
|
|
|
144
153
|
}).bind(this),
|
|
145
154
|
() => {
|
|
146
155
|
if (this.isVisible == import_UIObject.NO) {
|
|
147
|
-
|
|
148
|
-
unlockScroll();
|
|
156
|
+
completeDismissalIfNeeded();
|
|
149
157
|
}
|
|
150
158
|
},
|
|
151
159
|
"opacity"
|
|
152
160
|
);
|
|
161
|
+
new import_UIObject.UIObject().performFunctionWithDelay(this.animationDuration, completeDismissalIfNeeded);
|
|
153
162
|
} else {
|
|
154
163
|
this.removeFromSuperview();
|
|
155
164
|
unlockScroll();
|
|
@@ -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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2B;AAC3B,qBAAwB;AACxB,oBAAuB;AACvB,gCAAmC;AACnC,
|
|
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, UIObject, 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 \"opacity\"\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 // `transitionend` only fires when the CSS transition actually runs a\n // visible course - if this dialog is dismissed again shortly after\n // being shown (e.g. a server-pushed event auto-cancels a just-opened\n // confirmation), the opacity can revert to its starting value before\n // the browser ever paints the intermediate \"shown\" state, and the\n // browser correctly considers there to be nothing to transition -\n // `transitionend` then never dispatches for either transition. Without\n // a fallback, `removeFromSuperview` below (inside the transitionend\n // callback) would never run: `isVisible` correctly becomes NO, but the\n // dialog's DOM element is never actually removed, leaving it stuck\n // visibly open. `hasCompletedDismissal` makes the fallback a no-op\n // when the normal transitionend-driven removal already ran.\n let hasCompletedDismissal = NO\n const completeDismissalIfNeeded = () => {\n if (hasCompletedDismissal) {\n return\n }\n hasCompletedDismissal = YES\n this.removeFromSuperview()\n unlockScroll()\n }\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 completeDismissalIfNeeded()\n\n }\n\n },\n \"opacity\"\n )\n\n new UIObject().performFunctionWithDelay(this.animationDuration, completeDismissalIfNeeded)\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 if (event.name == UIView.broadcastEventName.PageDidScroll) {\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,sBAAsD;AACtD,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;AA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AACvD,YAAM,YAAY,gBAAgB,CAAC,cAAc,MAAM,qBAAO,YAAY;AAC1E,WAAK,YAAY,GAAG,GAAG,GAAG,WAAW,OAAO,cAAc,qBAAO,WAAW,MAAM;AAAA,IACtF,OACK;AACD,WAAK,YAAY,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM;AACtC,WAAK;AAAA,QACD;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,YACA;AAAA,cACI,qBAAG,UAAK,cAAL,mBAAgB,cAAc,6CAAmB,EAAE,MAAG;AAvS7E,gBAAAA,KAAAC;AAuSgF,oBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,WAAW,WAA3B,OAAAC,MAAqC;AAAA,WAAC,EAC7F,SAAQ,UAAK,cAAL,mBAAgB,cAAc,iCAAa;AAAA,YAChD,MAAG;AAzS/B,kBAAAD,KAAAC;AAySkC,sBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,WAAW,WAA3B,OAAAC,MAAqC;AAAA;AAAA,UAAC,EAC/C,KAAK,MAAG;AA1SjC,gBAAAD,KAAAC;AA0SoC,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;AAjTO,IAAM,eAAN;AAAM,aAUF,qBAAqB;",
|
|
6
6
|
"names": ["_a", "_b"]
|
|
7
7
|
}
|
|
@@ -211,7 +211,7 @@ declare global {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
type RectangleChainMethods<TResult> = {
|
|
214
|
-
[K in keyof UIRectangle as (K extends
|
|
214
|
+
[K in keyof UIRectangle as (K extends 'IF' | 'ELSE' | 'ELSE_IF' | 'ENDIF' ? never : K)]: UIRectangle[K] extends (...args: infer Args) => infer R ? R extends UIRectangle | UIRectangle[] ? (...args: Args) => UIRectangleConditionalChain<R, TResult> : never : never;
|
|
215
215
|
};
|
|
216
216
|
type ArrayChainMethods<TResult> = {
|
|
217
217
|
[K in keyof UIRectangle[]]: UIRectangle[][K] extends UIRectangle ? UIRectangleConditionalChain<UIRectangle, TResult> : UIRectangle[][K] extends (...args: infer Args) => infer R ? R extends UIRectangle | UIRectangle[] ? (...args: Args) => UIRectangleConditionalChain<R, TResult> : never : never;
|
|
@@ -1107,15 +1107,13 @@ if (!("boundingBox" in Array.prototype)) {
|
|
|
1107
1107
|
}
|
|
1108
1108
|
class UIRectangleConditionalBlock {
|
|
1109
1109
|
constructor(initialResult, condition) {
|
|
1110
|
-
this._stack = [
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
}
|
|
1118
|
-
];
|
|
1110
|
+
this._stack = [{
|
|
1111
|
+
resultBeforeIF: null,
|
|
1112
|
+
currentResult: initialResult,
|
|
1113
|
+
originalResult: initialResult,
|
|
1114
|
+
anyConditionMet: condition,
|
|
1115
|
+
currentBranchActive: condition
|
|
1116
|
+
}];
|
|
1119
1117
|
}
|
|
1120
1118
|
get _top() {
|
|
1121
1119
|
return this._stack[this._stack.length - 1];
|