@lark.js/mvc 0.0.12 → 0.0.14
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/README.md +11 -20
- package/dist/compiler.cjs +18 -345
- package/dist/compiler.d.cts +1 -30
- package/dist/compiler.d.ts +1 -30
- package/dist/compiler.js +17 -343
- package/dist/devtool.cjs +38 -84
- package/dist/devtool.js +38 -84
- package/dist/index.cjs +45 -145
- package/dist/index.d.cts +5 -41
- package/dist/index.d.ts +5 -41
- package/dist/index.js +45 -144
- package/dist/rspack.cjs +23 -351
- package/dist/rspack.d.cts +9 -24
- package/dist/rspack.d.ts +9 -24
- package/dist/rspack.js +23 -351
- package/dist/vite.cjs +55 -365
- package/dist/vite.d.cts +17 -8
- package/dist/vite.d.ts +17 -8
- package/dist/vite.js +52 -364
- package/dist/webpack.cjs +23 -351
- package/dist/webpack.d.cts +9 -15
- package/dist/webpack.d.ts +9 -15
- package/dist/webpack.js +23 -351
- package/package.json +7 -5
- package/src/client.d.ts +0 -89
package/dist/devtool.cjs
CHANGED
|
@@ -785,61 +785,6 @@ var EventDelegator = {
|
|
|
785
785
|
}
|
|
786
786
|
};
|
|
787
787
|
|
|
788
|
-
// src/safeguard.ts
|
|
789
|
-
var proxiesPool = /* @__PURE__ */ new Map();
|
|
790
|
-
var SAFEGUARD_SENTINEL = "_safe_";
|
|
791
|
-
function safeguard(data, getter, setter, isRoot) {
|
|
792
|
-
if (typeof window.__lark_Debug === "undefined" || !window.__lark_Debug) {
|
|
793
|
-
return data;
|
|
794
|
-
}
|
|
795
|
-
if (typeof Proxy === "undefined") {
|
|
796
|
-
return data;
|
|
797
|
-
}
|
|
798
|
-
if (isPrimitive(data)) {
|
|
799
|
-
return data;
|
|
800
|
-
}
|
|
801
|
-
const build = (prefix, obj) => {
|
|
802
|
-
const cacheKey = (getter || "") + "" + (setter || "");
|
|
803
|
-
const cached = proxiesPool.get(obj);
|
|
804
|
-
if (cached && cached.cacheKey === cacheKey) {
|
|
805
|
-
return cached.entity;
|
|
806
|
-
}
|
|
807
|
-
if (Reflect.get(obj, SAFEGUARD_SENTINEL)) {
|
|
808
|
-
return obj;
|
|
809
|
-
}
|
|
810
|
-
const entity = new Proxy(obj, {
|
|
811
|
-
set(target, property, value) {
|
|
812
|
-
if (!setter && !prefix) {
|
|
813
|
-
throw new Error(
|
|
814
|
-
"Avoid write back, key: " + prefix + property + " value:" + value + " more: https://github.com/hangtiancheng/lark"
|
|
815
|
-
);
|
|
816
|
-
}
|
|
817
|
-
Reflect.set(target, property, value);
|
|
818
|
-
if (setter) {
|
|
819
|
-
setter(prefix + property, value);
|
|
820
|
-
}
|
|
821
|
-
return true;
|
|
822
|
-
},
|
|
823
|
-
get(target, property) {
|
|
824
|
-
if (property === SAFEGUARD_SENTINEL) {
|
|
825
|
-
return true;
|
|
826
|
-
}
|
|
827
|
-
const out = Reflect.get(target, property);
|
|
828
|
-
if (!prefix && getter) {
|
|
829
|
-
getter(property);
|
|
830
|
-
}
|
|
831
|
-
if (!isRoot && hasOwnProperty(target, property) && (Array.isArray(out) || isPlainObject(out))) {
|
|
832
|
-
return build(prefix + property + ".", out);
|
|
833
|
-
}
|
|
834
|
-
return out;
|
|
835
|
-
}
|
|
836
|
-
});
|
|
837
|
-
proxiesPool.set(obj, { cacheKey, entity });
|
|
838
|
-
return entity;
|
|
839
|
-
};
|
|
840
|
-
return build("", data);
|
|
841
|
-
}
|
|
842
|
-
|
|
843
788
|
// src/module-loader.ts
|
|
844
789
|
var config = {
|
|
845
790
|
rootId: "root",
|
|
@@ -887,6 +832,21 @@ function use(names, callback) {
|
|
|
887
832
|
return loadPromise;
|
|
888
833
|
}
|
|
889
834
|
|
|
835
|
+
// src/frame-registry.ts
|
|
836
|
+
var frameRegistry = /* @__PURE__ */ new Map();
|
|
837
|
+
function getFrame(id) {
|
|
838
|
+
return frameRegistry.get(id);
|
|
839
|
+
}
|
|
840
|
+
function getAllFrames() {
|
|
841
|
+
return frameRegistry;
|
|
842
|
+
}
|
|
843
|
+
function registerFrame(id, frame) {
|
|
844
|
+
frameRegistry.set(id, frame);
|
|
845
|
+
}
|
|
846
|
+
function removeFrame(id) {
|
|
847
|
+
frameRegistry.delete(id);
|
|
848
|
+
}
|
|
849
|
+
|
|
890
850
|
// src/dom.ts
|
|
891
851
|
var wrapMeta = {
|
|
892
852
|
option: [1, "<select multiple>"],
|
|
@@ -1544,9 +1504,6 @@ var Updater = class {
|
|
|
1544
1504
|
if (key) {
|
|
1545
1505
|
result = this.data[key];
|
|
1546
1506
|
}
|
|
1547
|
-
if (typeof window !== "undefined" && window.__lark_Debug) {
|
|
1548
|
-
return safeguard(result);
|
|
1549
|
-
}
|
|
1550
1507
|
return result;
|
|
1551
1508
|
}
|
|
1552
1509
|
/**
|
|
@@ -1600,7 +1557,7 @@ var Updater = class {
|
|
|
1600
1557
|
const changed = this.hasChangedFlag;
|
|
1601
1558
|
this.hasChangedFlag = 0;
|
|
1602
1559
|
this.changedKeys = /* @__PURE__ */ new Set();
|
|
1603
|
-
const frame =
|
|
1560
|
+
const frame = getFrame(this.viewId);
|
|
1604
1561
|
const view = frame?.view;
|
|
1605
1562
|
const node = getById(this.viewId);
|
|
1606
1563
|
if (changed && view && node && view.signature > 0 && frame) {
|
|
@@ -1922,9 +1879,6 @@ var Router = {
|
|
|
1922
1879
|
attachViewAndPath(location);
|
|
1923
1880
|
hrefCache.set(href, location);
|
|
1924
1881
|
}
|
|
1925
|
-
if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
|
|
1926
|
-
location["params"] = safeguard(location["params"]);
|
|
1927
|
-
}
|
|
1928
1882
|
return location;
|
|
1929
1883
|
},
|
|
1930
1884
|
/**
|
|
@@ -1943,9 +1897,6 @@ var Router = {
|
|
|
1943
1897
|
emitter.fire(RouterEvents.CHANGED, asRecord(lastChanged));
|
|
1944
1898
|
}
|
|
1945
1899
|
silent = 0;
|
|
1946
|
-
if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && lastChanged) {
|
|
1947
|
-
lastChanged = safeguard(lastChanged);
|
|
1948
|
-
}
|
|
1949
1900
|
return lastChanged;
|
|
1950
1901
|
},
|
|
1951
1902
|
/**
|
|
@@ -2152,7 +2103,7 @@ function invalidateViewClass(viewPath) {
|
|
|
2152
2103
|
|
|
2153
2104
|
// src/hmr.ts
|
|
2154
2105
|
function reloadViews(viewPath) {
|
|
2155
|
-
const allFrames =
|
|
2106
|
+
const allFrames = getAllFrames();
|
|
2156
2107
|
const toReload = [];
|
|
2157
2108
|
for (const [, frame] of allFrames) {
|
|
2158
2109
|
if (frame.viewPath) {
|
|
@@ -2173,9 +2124,13 @@ function acceptView(hot, viewPath) {
|
|
|
2173
2124
|
const NewViewClass = candidate;
|
|
2174
2125
|
registerViewClass(viewPath, NewViewClass);
|
|
2175
2126
|
reloadViews(viewPath);
|
|
2176
|
-
|
|
2177
|
-
|
|
2127
|
+
return;
|
|
2128
|
+
}
|
|
2129
|
+
if (getViewClass(viewPath)) {
|
|
2130
|
+
reloadViews(viewPath);
|
|
2131
|
+
return;
|
|
2178
2132
|
}
|
|
2133
|
+
hot.invalidate();
|
|
2179
2134
|
});
|
|
2180
2135
|
}
|
|
2181
2136
|
function disposeView(hot, viewPath) {
|
|
@@ -2817,7 +2772,6 @@ var View = class _View {
|
|
|
2817
2772
|
};
|
|
2818
2773
|
|
|
2819
2774
|
// src/frame.ts
|
|
2820
|
-
var frameRegistry = /* @__PURE__ */ new Map();
|
|
2821
2775
|
var rootFrame;
|
|
2822
2776
|
var globalAlter;
|
|
2823
2777
|
var MAX_FRAME_POOL = 64;
|
|
@@ -2869,7 +2823,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
2869
2823
|
if (parentId) {
|
|
2870
2824
|
this._parentId = parentId;
|
|
2871
2825
|
}
|
|
2872
|
-
|
|
2826
|
+
registerFrame(id, this);
|
|
2873
2827
|
const element = document.getElementById(id);
|
|
2874
2828
|
if (element) {
|
|
2875
2829
|
element.frame = this;
|
|
@@ -3000,7 +2954,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3000
2954
|
*/
|
|
3001
2955
|
mountFrame(frameId, viewPath, viewInitParams) {
|
|
3002
2956
|
notifyAlter(this, { id: frameId });
|
|
3003
|
-
let childFrame =
|
|
2957
|
+
let childFrame = getFrame(frameId);
|
|
3004
2958
|
if (!childFrame) {
|
|
3005
2959
|
if (!this.childrenMap[frameId]) {
|
|
3006
2960
|
this.childrenCount++;
|
|
@@ -3021,17 +2975,17 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3021
2975
|
*/
|
|
3022
2976
|
unmountFrame(id) {
|
|
3023
2977
|
const targetId = id ? this.childrenMap[id] : this.id;
|
|
3024
|
-
const frame =
|
|
2978
|
+
const frame = getFrame(targetId);
|
|
3025
2979
|
if (!frame) return;
|
|
3026
2980
|
const wasCreated = frame.readyCount > 0;
|
|
3027
2981
|
const pId = frame.parentId;
|
|
3028
2982
|
frame.unmountView();
|
|
3029
|
-
|
|
2983
|
+
removeFrame2(targetId, wasCreated);
|
|
3030
2984
|
reInitFrameForCache(frame);
|
|
3031
2985
|
if (frameCache.length < MAX_FRAME_POOL) {
|
|
3032
2986
|
frameCache.push(frame);
|
|
3033
2987
|
}
|
|
3034
|
-
const parent =
|
|
2988
|
+
const parent = getFrame(pId || "");
|
|
3035
2989
|
if (parent && parent.childrenMap[targetId]) {
|
|
3036
2990
|
Reflect.deleteProperty(parent.childrenMap, targetId);
|
|
3037
2991
|
parent.childrenCount--;
|
|
@@ -3096,7 +3050,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3096
3050
|
let currentPid = this.parentId;
|
|
3097
3051
|
let n = level >>> 0 || 1;
|
|
3098
3052
|
while (currentPid && n--) {
|
|
3099
|
-
frame =
|
|
3053
|
+
frame = getFrame(currentPid);
|
|
3100
3054
|
currentPid = frame?.parentId;
|
|
3101
3055
|
}
|
|
3102
3056
|
return frame;
|
|
@@ -3157,11 +3111,11 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3157
3111
|
// ============================================================
|
|
3158
3112
|
/** Get frame by ID */
|
|
3159
3113
|
static get(id) {
|
|
3160
|
-
return
|
|
3114
|
+
return getFrame(id);
|
|
3161
3115
|
}
|
|
3162
3116
|
/** Get all frames */
|
|
3163
3117
|
static getAll() {
|
|
3164
|
-
return
|
|
3118
|
+
return getAllFrames();
|
|
3165
3119
|
}
|
|
3166
3120
|
/**
|
|
3167
3121
|
* Returns the existing root frame, or `undefined` if none has been created.
|
|
@@ -3211,10 +3165,10 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3211
3165
|
function htmlElIsBound(element) {
|
|
3212
3166
|
return !!element.frameBound;
|
|
3213
3167
|
}
|
|
3214
|
-
function
|
|
3215
|
-
const frameInstance =
|
|
3168
|
+
function removeFrame2(id, wasCreated) {
|
|
3169
|
+
const frameInstance = getFrame(id);
|
|
3216
3170
|
if (!frameInstance) return;
|
|
3217
|
-
|
|
3171
|
+
removeFrame(id);
|
|
3218
3172
|
Frame.fire("remove", { frame: frameInstance, fcc: wasCreated });
|
|
3219
3173
|
const element = document.getElementById(id);
|
|
3220
3174
|
if (element) {
|
|
@@ -3231,7 +3185,7 @@ function notifyCreated(frameInstance) {
|
|
|
3231
3185
|
}
|
|
3232
3186
|
const pId = frameInstance.parentId;
|
|
3233
3187
|
if (pId) {
|
|
3234
|
-
const parent =
|
|
3188
|
+
const parent = getFrame(pId);
|
|
3235
3189
|
if (parent && !parent.readyMap.has(frameInstance.id)) {
|
|
3236
3190
|
parent.readyMap.add(frameInstance.id);
|
|
3237
3191
|
parent.readyCount++;
|
|
@@ -3247,7 +3201,7 @@ function notifyAlter(frameInstance, data) {
|
|
|
3247
3201
|
frameInstance.fire("alter", data);
|
|
3248
3202
|
const pId = frameInstance.parentId;
|
|
3249
3203
|
if (pId) {
|
|
3250
|
-
const parent =
|
|
3204
|
+
const parent = getFrame(pId);
|
|
3251
3205
|
if (parent && parent.readyMap.has(frameInstance.id)) {
|
|
3252
3206
|
parent.readyCount--;
|
|
3253
3207
|
parent.readyMap.delete(frameInstance.id);
|
|
@@ -3265,7 +3219,7 @@ function reInitFrame(frame, id, parentId) {
|
|
|
3265
3219
|
frame["signature"] = 1;
|
|
3266
3220
|
frame["readyMap"] = /* @__PURE__ */ new Set();
|
|
3267
3221
|
frame["invokeList"] = [];
|
|
3268
|
-
|
|
3222
|
+
registerFrame(id, frame);
|
|
3269
3223
|
}
|
|
3270
3224
|
function reInitFrameForCache(frame) {
|
|
3271
3225
|
Reflect.set(frame, "id", "");
|
|
@@ -3274,7 +3228,7 @@ function reInitFrameForCache(frame) {
|
|
|
3274
3228
|
frame["readyMap"] = /* @__PURE__ */ new Set();
|
|
3275
3229
|
}
|
|
3276
3230
|
function translateQuery(pId, src, params) {
|
|
3277
|
-
const parentFrame =
|
|
3231
|
+
const parentFrame = getFrame(pId);
|
|
3278
3232
|
const parentView = parentFrame?.view;
|
|
3279
3233
|
if (!parentView) return;
|
|
3280
3234
|
const parentRefData = parentView.updater.refData;
|
package/dist/devtool.js
CHANGED
|
@@ -698,61 +698,6 @@ var EventDelegator = {
|
|
|
698
698
|
}
|
|
699
699
|
};
|
|
700
700
|
|
|
701
|
-
// src/safeguard.ts
|
|
702
|
-
var proxiesPool = /* @__PURE__ */ new Map();
|
|
703
|
-
var SAFEGUARD_SENTINEL = "_safe_";
|
|
704
|
-
function safeguard(data, getter, setter, isRoot) {
|
|
705
|
-
if (typeof window.__lark_Debug === "undefined" || !window.__lark_Debug) {
|
|
706
|
-
return data;
|
|
707
|
-
}
|
|
708
|
-
if (typeof Proxy === "undefined") {
|
|
709
|
-
return data;
|
|
710
|
-
}
|
|
711
|
-
if (isPrimitive(data)) {
|
|
712
|
-
return data;
|
|
713
|
-
}
|
|
714
|
-
const build = (prefix, obj) => {
|
|
715
|
-
const cacheKey = (getter || "") + "" + (setter || "");
|
|
716
|
-
const cached = proxiesPool.get(obj);
|
|
717
|
-
if (cached && cached.cacheKey === cacheKey) {
|
|
718
|
-
return cached.entity;
|
|
719
|
-
}
|
|
720
|
-
if (Reflect.get(obj, SAFEGUARD_SENTINEL)) {
|
|
721
|
-
return obj;
|
|
722
|
-
}
|
|
723
|
-
const entity = new Proxy(obj, {
|
|
724
|
-
set(target, property, value) {
|
|
725
|
-
if (!setter && !prefix) {
|
|
726
|
-
throw new Error(
|
|
727
|
-
"Avoid write back, key: " + prefix + property + " value:" + value + " more: https://github.com/hangtiancheng/lark"
|
|
728
|
-
);
|
|
729
|
-
}
|
|
730
|
-
Reflect.set(target, property, value);
|
|
731
|
-
if (setter) {
|
|
732
|
-
setter(prefix + property, value);
|
|
733
|
-
}
|
|
734
|
-
return true;
|
|
735
|
-
},
|
|
736
|
-
get(target, property) {
|
|
737
|
-
if (property === SAFEGUARD_SENTINEL) {
|
|
738
|
-
return true;
|
|
739
|
-
}
|
|
740
|
-
const out = Reflect.get(target, property);
|
|
741
|
-
if (!prefix && getter) {
|
|
742
|
-
getter(property);
|
|
743
|
-
}
|
|
744
|
-
if (!isRoot && hasOwnProperty(target, property) && (Array.isArray(out) || isPlainObject(out))) {
|
|
745
|
-
return build(prefix + property + ".", out);
|
|
746
|
-
}
|
|
747
|
-
return out;
|
|
748
|
-
}
|
|
749
|
-
});
|
|
750
|
-
proxiesPool.set(obj, { cacheKey, entity });
|
|
751
|
-
return entity;
|
|
752
|
-
};
|
|
753
|
-
return build("", data);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
701
|
// src/module-loader.ts
|
|
757
702
|
var config = {
|
|
758
703
|
rootId: "root",
|
|
@@ -800,6 +745,21 @@ function use(names, callback) {
|
|
|
800
745
|
return loadPromise;
|
|
801
746
|
}
|
|
802
747
|
|
|
748
|
+
// src/frame-registry.ts
|
|
749
|
+
var frameRegistry = /* @__PURE__ */ new Map();
|
|
750
|
+
function getFrame(id) {
|
|
751
|
+
return frameRegistry.get(id);
|
|
752
|
+
}
|
|
753
|
+
function getAllFrames() {
|
|
754
|
+
return frameRegistry;
|
|
755
|
+
}
|
|
756
|
+
function registerFrame(id, frame) {
|
|
757
|
+
frameRegistry.set(id, frame);
|
|
758
|
+
}
|
|
759
|
+
function removeFrame(id) {
|
|
760
|
+
frameRegistry.delete(id);
|
|
761
|
+
}
|
|
762
|
+
|
|
803
763
|
// src/dom.ts
|
|
804
764
|
var wrapMeta = {
|
|
805
765
|
option: [1, "<select multiple>"],
|
|
@@ -1457,9 +1417,6 @@ var Updater = class {
|
|
|
1457
1417
|
if (key) {
|
|
1458
1418
|
result = this.data[key];
|
|
1459
1419
|
}
|
|
1460
|
-
if (typeof window !== "undefined" && window.__lark_Debug) {
|
|
1461
|
-
return safeguard(result);
|
|
1462
|
-
}
|
|
1463
1420
|
return result;
|
|
1464
1421
|
}
|
|
1465
1422
|
/**
|
|
@@ -1513,7 +1470,7 @@ var Updater = class {
|
|
|
1513
1470
|
const changed = this.hasChangedFlag;
|
|
1514
1471
|
this.hasChangedFlag = 0;
|
|
1515
1472
|
this.changedKeys = /* @__PURE__ */ new Set();
|
|
1516
|
-
const frame =
|
|
1473
|
+
const frame = getFrame(this.viewId);
|
|
1517
1474
|
const view = frame?.view;
|
|
1518
1475
|
const node = getById(this.viewId);
|
|
1519
1476
|
if (changed && view && node && view.signature > 0 && frame) {
|
|
@@ -1835,9 +1792,6 @@ var Router = {
|
|
|
1835
1792
|
attachViewAndPath(location);
|
|
1836
1793
|
hrefCache.set(href, location);
|
|
1837
1794
|
}
|
|
1838
|
-
if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug) {
|
|
1839
|
-
location["params"] = safeguard(location["params"]);
|
|
1840
|
-
}
|
|
1841
1795
|
return location;
|
|
1842
1796
|
},
|
|
1843
1797
|
/**
|
|
@@ -1856,9 +1810,6 @@ var Router = {
|
|
|
1856
1810
|
emitter.fire(RouterEvents.CHANGED, asRecord(lastChanged));
|
|
1857
1811
|
}
|
|
1858
1812
|
silent = 0;
|
|
1859
|
-
if (typeof window.__lark_Debug !== "undefined" && window.__lark_Debug && lastChanged) {
|
|
1860
|
-
lastChanged = safeguard(lastChanged);
|
|
1861
|
-
}
|
|
1862
1813
|
return lastChanged;
|
|
1863
1814
|
},
|
|
1864
1815
|
/**
|
|
@@ -2065,7 +2016,7 @@ function invalidateViewClass(viewPath) {
|
|
|
2065
2016
|
|
|
2066
2017
|
// src/hmr.ts
|
|
2067
2018
|
function reloadViews(viewPath) {
|
|
2068
|
-
const allFrames =
|
|
2019
|
+
const allFrames = getAllFrames();
|
|
2069
2020
|
const toReload = [];
|
|
2070
2021
|
for (const [, frame] of allFrames) {
|
|
2071
2022
|
if (frame.viewPath) {
|
|
@@ -2086,9 +2037,13 @@ function acceptView(hot, viewPath) {
|
|
|
2086
2037
|
const NewViewClass = candidate;
|
|
2087
2038
|
registerViewClass(viewPath, NewViewClass);
|
|
2088
2039
|
reloadViews(viewPath);
|
|
2089
|
-
|
|
2090
|
-
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2042
|
+
if (getViewClass(viewPath)) {
|
|
2043
|
+
reloadViews(viewPath);
|
|
2044
|
+
return;
|
|
2091
2045
|
}
|
|
2046
|
+
hot.invalidate();
|
|
2092
2047
|
});
|
|
2093
2048
|
}
|
|
2094
2049
|
function disposeView(hot, viewPath) {
|
|
@@ -2730,7 +2685,6 @@ var View = class _View {
|
|
|
2730
2685
|
};
|
|
2731
2686
|
|
|
2732
2687
|
// src/frame.ts
|
|
2733
|
-
var frameRegistry = /* @__PURE__ */ new Map();
|
|
2734
2688
|
var rootFrame;
|
|
2735
2689
|
var globalAlter;
|
|
2736
2690
|
var MAX_FRAME_POOL = 64;
|
|
@@ -2782,7 +2736,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
2782
2736
|
if (parentId) {
|
|
2783
2737
|
this._parentId = parentId;
|
|
2784
2738
|
}
|
|
2785
|
-
|
|
2739
|
+
registerFrame(id, this);
|
|
2786
2740
|
const element = document.getElementById(id);
|
|
2787
2741
|
if (element) {
|
|
2788
2742
|
element.frame = this;
|
|
@@ -2913,7 +2867,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
2913
2867
|
*/
|
|
2914
2868
|
mountFrame(frameId, viewPath, viewInitParams) {
|
|
2915
2869
|
notifyAlter(this, { id: frameId });
|
|
2916
|
-
let childFrame =
|
|
2870
|
+
let childFrame = getFrame(frameId);
|
|
2917
2871
|
if (!childFrame) {
|
|
2918
2872
|
if (!this.childrenMap[frameId]) {
|
|
2919
2873
|
this.childrenCount++;
|
|
@@ -2934,17 +2888,17 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
2934
2888
|
*/
|
|
2935
2889
|
unmountFrame(id) {
|
|
2936
2890
|
const targetId = id ? this.childrenMap[id] : this.id;
|
|
2937
|
-
const frame =
|
|
2891
|
+
const frame = getFrame(targetId);
|
|
2938
2892
|
if (!frame) return;
|
|
2939
2893
|
const wasCreated = frame.readyCount > 0;
|
|
2940
2894
|
const pId = frame.parentId;
|
|
2941
2895
|
frame.unmountView();
|
|
2942
|
-
|
|
2896
|
+
removeFrame2(targetId, wasCreated);
|
|
2943
2897
|
reInitFrameForCache(frame);
|
|
2944
2898
|
if (frameCache.length < MAX_FRAME_POOL) {
|
|
2945
2899
|
frameCache.push(frame);
|
|
2946
2900
|
}
|
|
2947
|
-
const parent =
|
|
2901
|
+
const parent = getFrame(pId || "");
|
|
2948
2902
|
if (parent && parent.childrenMap[targetId]) {
|
|
2949
2903
|
Reflect.deleteProperty(parent.childrenMap, targetId);
|
|
2950
2904
|
parent.childrenCount--;
|
|
@@ -3009,7 +2963,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3009
2963
|
let currentPid = this.parentId;
|
|
3010
2964
|
let n = level >>> 0 || 1;
|
|
3011
2965
|
while (currentPid && n--) {
|
|
3012
|
-
frame =
|
|
2966
|
+
frame = getFrame(currentPid);
|
|
3013
2967
|
currentPid = frame?.parentId;
|
|
3014
2968
|
}
|
|
3015
2969
|
return frame;
|
|
@@ -3070,11 +3024,11 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3070
3024
|
// ============================================================
|
|
3071
3025
|
/** Get frame by ID */
|
|
3072
3026
|
static get(id) {
|
|
3073
|
-
return
|
|
3027
|
+
return getFrame(id);
|
|
3074
3028
|
}
|
|
3075
3029
|
/** Get all frames */
|
|
3076
3030
|
static getAll() {
|
|
3077
|
-
return
|
|
3031
|
+
return getAllFrames();
|
|
3078
3032
|
}
|
|
3079
3033
|
/**
|
|
3080
3034
|
* Returns the existing root frame, or `undefined` if none has been created.
|
|
@@ -3124,10 +3078,10 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3124
3078
|
function htmlElIsBound(element) {
|
|
3125
3079
|
return !!element.frameBound;
|
|
3126
3080
|
}
|
|
3127
|
-
function
|
|
3128
|
-
const frameInstance =
|
|
3081
|
+
function removeFrame2(id, wasCreated) {
|
|
3082
|
+
const frameInstance = getFrame(id);
|
|
3129
3083
|
if (!frameInstance) return;
|
|
3130
|
-
|
|
3084
|
+
removeFrame(id);
|
|
3131
3085
|
Frame.fire("remove", { frame: frameInstance, fcc: wasCreated });
|
|
3132
3086
|
const element = document.getElementById(id);
|
|
3133
3087
|
if (element) {
|
|
@@ -3144,7 +3098,7 @@ function notifyCreated(frameInstance) {
|
|
|
3144
3098
|
}
|
|
3145
3099
|
const pId = frameInstance.parentId;
|
|
3146
3100
|
if (pId) {
|
|
3147
|
-
const parent =
|
|
3101
|
+
const parent = getFrame(pId);
|
|
3148
3102
|
if (parent && !parent.readyMap.has(frameInstance.id)) {
|
|
3149
3103
|
parent.readyMap.add(frameInstance.id);
|
|
3150
3104
|
parent.readyCount++;
|
|
@@ -3160,7 +3114,7 @@ function notifyAlter(frameInstance, data) {
|
|
|
3160
3114
|
frameInstance.fire("alter", data);
|
|
3161
3115
|
const pId = frameInstance.parentId;
|
|
3162
3116
|
if (pId) {
|
|
3163
|
-
const parent =
|
|
3117
|
+
const parent = getFrame(pId);
|
|
3164
3118
|
if (parent && parent.readyMap.has(frameInstance.id)) {
|
|
3165
3119
|
parent.readyCount--;
|
|
3166
3120
|
parent.readyMap.delete(frameInstance.id);
|
|
@@ -3178,7 +3132,7 @@ function reInitFrame(frame, id, parentId) {
|
|
|
3178
3132
|
frame["signature"] = 1;
|
|
3179
3133
|
frame["readyMap"] = /* @__PURE__ */ new Set();
|
|
3180
3134
|
frame["invokeList"] = [];
|
|
3181
|
-
|
|
3135
|
+
registerFrame(id, frame);
|
|
3182
3136
|
}
|
|
3183
3137
|
function reInitFrameForCache(frame) {
|
|
3184
3138
|
Reflect.set(frame, "id", "");
|
|
@@ -3187,7 +3141,7 @@ function reInitFrameForCache(frame) {
|
|
|
3187
3141
|
frame["readyMap"] = /* @__PURE__ */ new Set();
|
|
3188
3142
|
}
|
|
3189
3143
|
function translateQuery(pId, src, params) {
|
|
3190
|
-
const parentFrame =
|
|
3144
|
+
const parentFrame = getFrame(pId);
|
|
3191
3145
|
const parentView = parentFrame?.view;
|
|
3192
3146
|
if (!parentView) return;
|
|
3193
3147
|
const parentRefData = parentView.updater.refData;
|