uicore-ts 1.1.101 → 1.1.102
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.js +3 -0
- package/compiledScripts/UICore.js.map +2 -2
- package/compiledScripts/UITableView.d.ts +33 -0
- package/compiledScripts/UITableView.js +213 -25
- package/compiledScripts/UITableView.js.map +3 -3
- package/compiledScripts/UITextView.d.ts +49 -39
- package/compiledScripts/UITextView.js +131 -132
- package/compiledScripts/UITextView.js.map +2 -2
- package/compiledScripts/UIView.d.ts +21 -1
- package/compiledScripts/UIView.js +66 -8
- package/compiledScripts/UIView.js.map +2 -2
- package/package.json +1 -1
- package/scripts/UICore.ts +5 -0
- package/scripts/UITableView.ts +328 -93
- package/scripts/UITextView.ts +266 -376
- package/scripts/UIView.ts +131 -7
|
@@ -123,21 +123,75 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
123
123
|
static get nextIndex() {
|
|
124
124
|
return _UIView._UIViewIndex + 1;
|
|
125
125
|
}
|
|
126
|
-
static
|
|
126
|
+
static _initializePageDimensionsCacheIfNeeded() {
|
|
127
|
+
if (this._resizeObserverInitialized) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
this._resizeObserverInitialized = true;
|
|
131
|
+
window.addEventListener("resize", () => {
|
|
132
|
+
this._pageDimensionsCacheValid = false;
|
|
133
|
+
}, { passive: true });
|
|
134
|
+
const bodyObserver = new ResizeObserver(() => {
|
|
135
|
+
this._pageDimensionsCacheValid = false;
|
|
136
|
+
});
|
|
137
|
+
if (document.body) {
|
|
138
|
+
bodyObserver.observe(document.body);
|
|
139
|
+
} else {
|
|
140
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
141
|
+
bodyObserver.observe(document.body);
|
|
142
|
+
}, { once: true });
|
|
143
|
+
}
|
|
144
|
+
const mutationObserver = new MutationObserver(() => {
|
|
145
|
+
this._pageDimensionsCacheValid = false;
|
|
146
|
+
});
|
|
147
|
+
const observeMutations = () => {
|
|
148
|
+
mutationObserver.observe(document.body, {
|
|
149
|
+
childList: true,
|
|
150
|
+
subtree: true,
|
|
151
|
+
attributes: true,
|
|
152
|
+
attributeFilter: ["style", "class"]
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
if (document.body) {
|
|
156
|
+
observeMutations();
|
|
157
|
+
} else {
|
|
158
|
+
document.addEventListener("DOMContentLoaded", observeMutations, { once: true });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
static _updatePageDimensionsCacheIfNeeded() {
|
|
162
|
+
if (this._pageDimensionsCacheValid && this._cachedPageWidth !== void 0 && this._cachedPageHeight !== void 0) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
127
165
|
const body = document.body;
|
|
128
166
|
const html = document.documentElement;
|
|
129
|
-
|
|
167
|
+
this._cachedPageWidth = Math.max(
|
|
168
|
+
body.scrollWidth,
|
|
169
|
+
body.offsetWidth,
|
|
170
|
+
html.clientWidth,
|
|
171
|
+
html.scrollWidth,
|
|
172
|
+
html.offsetWidth
|
|
173
|
+
);
|
|
174
|
+
this._cachedPageHeight = Math.max(
|
|
130
175
|
body.scrollHeight,
|
|
131
176
|
body.offsetHeight,
|
|
132
177
|
html.clientHeight,
|
|
133
178
|
html.scrollHeight,
|
|
134
179
|
html.offsetHeight
|
|
135
180
|
);
|
|
181
|
+
this._pageDimensionsCacheValid = true;
|
|
136
182
|
}
|
|
137
183
|
static get pageWidth() {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return
|
|
184
|
+
this._initializePageDimensionsCacheIfNeeded();
|
|
185
|
+
this._updatePageDimensionsCacheIfNeeded();
|
|
186
|
+
return this._cachedPageWidth;
|
|
187
|
+
}
|
|
188
|
+
static get pageHeight() {
|
|
189
|
+
this._initializePageDimensionsCacheIfNeeded();
|
|
190
|
+
this._updatePageDimensionsCacheIfNeeded();
|
|
191
|
+
return this._cachedPageHeight;
|
|
192
|
+
}
|
|
193
|
+
static invalidatePageDimensionsCache() {
|
|
194
|
+
this._pageDimensionsCacheValid = false;
|
|
141
195
|
}
|
|
142
196
|
centerInContainer() {
|
|
143
197
|
this.style.left = "50%";
|
|
@@ -542,7 +596,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
542
596
|
}
|
|
543
597
|
}
|
|
544
598
|
get bounds() {
|
|
545
|
-
var _a, _b, _c, _d, _e;
|
|
599
|
+
var _a, _b, _c, _d, _e, _f;
|
|
546
600
|
let _frame;
|
|
547
601
|
if (!this.isVirtualLayouting) {
|
|
548
602
|
_frame = this._frame;
|
|
@@ -551,18 +605,19 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
551
605
|
}
|
|
552
606
|
let result;
|
|
553
607
|
if ((0, import_UIObject.IS_NOT)(_frame)) {
|
|
554
|
-
result = new import_UIRectangle.UIRectangle(
|
|
608
|
+
result = (_e = this._frameCache) != null ? _e : new import_UIRectangle.UIRectangle(
|
|
555
609
|
0,
|
|
556
610
|
0,
|
|
557
611
|
(_b = (_a = this._resizeObserverEntry) == null ? void 0 : _a.contentRect.height) != null ? _b : this.viewHTMLElement.offsetHeight,
|
|
558
612
|
(_d = (_c = this._resizeObserverEntry) == null ? void 0 : _c.contentRect.width) != null ? _d : this.viewHTMLElement.offsetWidth
|
|
559
613
|
);
|
|
614
|
+
this._frameCache = result;
|
|
560
615
|
} else {
|
|
561
616
|
let frame;
|
|
562
617
|
if (!this.isVirtualLayouting) {
|
|
563
618
|
frame = this.frame;
|
|
564
619
|
} else {
|
|
565
|
-
frame = (
|
|
620
|
+
frame = (_f = this._frameForVirtualLayouting) != null ? _f : this.frame;
|
|
566
621
|
}
|
|
567
622
|
result = frame.copy();
|
|
568
623
|
result.x = 0;
|
|
@@ -582,6 +637,7 @@ const _UIView = class extends import_UIObject.UIObject {
|
|
|
582
637
|
}
|
|
583
638
|
didResize(entry) {
|
|
584
639
|
this._resizeObserverEntry = entry;
|
|
640
|
+
this._frameCache = void 0;
|
|
585
641
|
this.setNeedsLayout();
|
|
586
642
|
this.boundsDidChange(new import_UIRectangle.UIRectangle(0, 0, entry.contentRect.height, entry.contentRect.width));
|
|
587
643
|
}
|
|
@@ -2387,6 +2443,8 @@ UIView._onWindowTouchMove = import_UIObject.nil;
|
|
|
2387
2443
|
UIView._onWindowMouseMove = import_UIObject.nil;
|
|
2388
2444
|
UIView._onWindowMouseup = import_UIObject.nil;
|
|
2389
2445
|
UIView._virtualLayoutingDepth = 0;
|
|
2446
|
+
UIView._pageDimensionsCacheValid = false;
|
|
2447
|
+
UIView._resizeObserverInitialized = false;
|
|
2390
2448
|
UIView._transformAttribute = ("transform" in document.documentElement.style ? "transform" : void 0) || ("-webkit-transform" in document.documentElement.style ? "-webkit-transform" : "undefined") || ("-moz-transform" in document.documentElement.style ? "-moz-transform" : "undefined") || ("-ms-transform" in document.documentElement.style ? "-ms-transform" : "undefined") || ("-o-transform" in document.documentElement.style ? "-o-transform" : "undefined");
|
|
2391
2449
|
UIView.constraintAttribute = {
|
|
2392
2450
|
"left": AutoLayout.Attribute.LEFT,
|