@lark.js/mvc 0.0.13 → 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 +0 -1
- 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 -20
- package/dist/devtool.js +38 -20
- package/dist/index.cjs +38 -33
- package/dist/index.d.cts +1 -11
- package/dist/index.d.ts +1 -11
- package/dist/index.js +38 -33
- 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 +43 -363
- package/dist/vite.d.cts +10 -9
- package/dist/vite.d.ts +10 -9
- package/dist/vite.js +43 -363
- 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 +5 -4
- package/src/client.d.ts +0 -87
package/dist/devtool.js
CHANGED
|
@@ -745,6 +745,21 @@ function use(names, callback) {
|
|
|
745
745
|
return loadPromise;
|
|
746
746
|
}
|
|
747
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
|
+
|
|
748
763
|
// src/dom.ts
|
|
749
764
|
var wrapMeta = {
|
|
750
765
|
option: [1, "<select multiple>"],
|
|
@@ -1455,7 +1470,7 @@ var Updater = class {
|
|
|
1455
1470
|
const changed = this.hasChangedFlag;
|
|
1456
1471
|
this.hasChangedFlag = 0;
|
|
1457
1472
|
this.changedKeys = /* @__PURE__ */ new Set();
|
|
1458
|
-
const frame =
|
|
1473
|
+
const frame = getFrame(this.viewId);
|
|
1459
1474
|
const view = frame?.view;
|
|
1460
1475
|
const node = getById(this.viewId);
|
|
1461
1476
|
if (changed && view && node && view.signature > 0 && frame) {
|
|
@@ -2001,7 +2016,7 @@ function invalidateViewClass(viewPath) {
|
|
|
2001
2016
|
|
|
2002
2017
|
// src/hmr.ts
|
|
2003
2018
|
function reloadViews(viewPath) {
|
|
2004
|
-
const allFrames =
|
|
2019
|
+
const allFrames = getAllFrames();
|
|
2005
2020
|
const toReload = [];
|
|
2006
2021
|
for (const [, frame] of allFrames) {
|
|
2007
2022
|
if (frame.viewPath) {
|
|
@@ -2022,9 +2037,13 @@ function acceptView(hot, viewPath) {
|
|
|
2022
2037
|
const NewViewClass = candidate;
|
|
2023
2038
|
registerViewClass(viewPath, NewViewClass);
|
|
2024
2039
|
reloadViews(viewPath);
|
|
2025
|
-
|
|
2026
|
-
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2042
|
+
if (getViewClass(viewPath)) {
|
|
2043
|
+
reloadViews(viewPath);
|
|
2044
|
+
return;
|
|
2027
2045
|
}
|
|
2046
|
+
hot.invalidate();
|
|
2028
2047
|
});
|
|
2029
2048
|
}
|
|
2030
2049
|
function disposeView(hot, viewPath) {
|
|
@@ -2666,7 +2685,6 @@ var View = class _View {
|
|
|
2666
2685
|
};
|
|
2667
2686
|
|
|
2668
2687
|
// src/frame.ts
|
|
2669
|
-
var frameRegistry = /* @__PURE__ */ new Map();
|
|
2670
2688
|
var rootFrame;
|
|
2671
2689
|
var globalAlter;
|
|
2672
2690
|
var MAX_FRAME_POOL = 64;
|
|
@@ -2718,7 +2736,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
2718
2736
|
if (parentId) {
|
|
2719
2737
|
this._parentId = parentId;
|
|
2720
2738
|
}
|
|
2721
|
-
|
|
2739
|
+
registerFrame(id, this);
|
|
2722
2740
|
const element = document.getElementById(id);
|
|
2723
2741
|
if (element) {
|
|
2724
2742
|
element.frame = this;
|
|
@@ -2849,7 +2867,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
2849
2867
|
*/
|
|
2850
2868
|
mountFrame(frameId, viewPath, viewInitParams) {
|
|
2851
2869
|
notifyAlter(this, { id: frameId });
|
|
2852
|
-
let childFrame =
|
|
2870
|
+
let childFrame = getFrame(frameId);
|
|
2853
2871
|
if (!childFrame) {
|
|
2854
2872
|
if (!this.childrenMap[frameId]) {
|
|
2855
2873
|
this.childrenCount++;
|
|
@@ -2870,17 +2888,17 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
2870
2888
|
*/
|
|
2871
2889
|
unmountFrame(id) {
|
|
2872
2890
|
const targetId = id ? this.childrenMap[id] : this.id;
|
|
2873
|
-
const frame =
|
|
2891
|
+
const frame = getFrame(targetId);
|
|
2874
2892
|
if (!frame) return;
|
|
2875
2893
|
const wasCreated = frame.readyCount > 0;
|
|
2876
2894
|
const pId = frame.parentId;
|
|
2877
2895
|
frame.unmountView();
|
|
2878
|
-
|
|
2896
|
+
removeFrame2(targetId, wasCreated);
|
|
2879
2897
|
reInitFrameForCache(frame);
|
|
2880
2898
|
if (frameCache.length < MAX_FRAME_POOL) {
|
|
2881
2899
|
frameCache.push(frame);
|
|
2882
2900
|
}
|
|
2883
|
-
const parent =
|
|
2901
|
+
const parent = getFrame(pId || "");
|
|
2884
2902
|
if (parent && parent.childrenMap[targetId]) {
|
|
2885
2903
|
Reflect.deleteProperty(parent.childrenMap, targetId);
|
|
2886
2904
|
parent.childrenCount--;
|
|
@@ -2945,7 +2963,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
2945
2963
|
let currentPid = this.parentId;
|
|
2946
2964
|
let n = level >>> 0 || 1;
|
|
2947
2965
|
while (currentPid && n--) {
|
|
2948
|
-
frame =
|
|
2966
|
+
frame = getFrame(currentPid);
|
|
2949
2967
|
currentPid = frame?.parentId;
|
|
2950
2968
|
}
|
|
2951
2969
|
return frame;
|
|
@@ -3006,11 +3024,11 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3006
3024
|
// ============================================================
|
|
3007
3025
|
/** Get frame by ID */
|
|
3008
3026
|
static get(id) {
|
|
3009
|
-
return
|
|
3027
|
+
return getFrame(id);
|
|
3010
3028
|
}
|
|
3011
3029
|
/** Get all frames */
|
|
3012
3030
|
static getAll() {
|
|
3013
|
-
return
|
|
3031
|
+
return getAllFrames();
|
|
3014
3032
|
}
|
|
3015
3033
|
/**
|
|
3016
3034
|
* Returns the existing root frame, or `undefined` if none has been created.
|
|
@@ -3060,10 +3078,10 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3060
3078
|
function htmlElIsBound(element) {
|
|
3061
3079
|
return !!element.frameBound;
|
|
3062
3080
|
}
|
|
3063
|
-
function
|
|
3064
|
-
const frameInstance =
|
|
3081
|
+
function removeFrame2(id, wasCreated) {
|
|
3082
|
+
const frameInstance = getFrame(id);
|
|
3065
3083
|
if (!frameInstance) return;
|
|
3066
|
-
|
|
3084
|
+
removeFrame(id);
|
|
3067
3085
|
Frame.fire("remove", { frame: frameInstance, fcc: wasCreated });
|
|
3068
3086
|
const element = document.getElementById(id);
|
|
3069
3087
|
if (element) {
|
|
@@ -3080,7 +3098,7 @@ function notifyCreated(frameInstance) {
|
|
|
3080
3098
|
}
|
|
3081
3099
|
const pId = frameInstance.parentId;
|
|
3082
3100
|
if (pId) {
|
|
3083
|
-
const parent =
|
|
3101
|
+
const parent = getFrame(pId);
|
|
3084
3102
|
if (parent && !parent.readyMap.has(frameInstance.id)) {
|
|
3085
3103
|
parent.readyMap.add(frameInstance.id);
|
|
3086
3104
|
parent.readyCount++;
|
|
@@ -3096,7 +3114,7 @@ function notifyAlter(frameInstance, data) {
|
|
|
3096
3114
|
frameInstance.fire("alter", data);
|
|
3097
3115
|
const pId = frameInstance.parentId;
|
|
3098
3116
|
if (pId) {
|
|
3099
|
-
const parent =
|
|
3117
|
+
const parent = getFrame(pId);
|
|
3100
3118
|
if (parent && parent.readyMap.has(frameInstance.id)) {
|
|
3101
3119
|
parent.readyCount--;
|
|
3102
3120
|
parent.readyMap.delete(frameInstance.id);
|
|
@@ -3114,7 +3132,7 @@ function reInitFrame(frame, id, parentId) {
|
|
|
3114
3132
|
frame["signature"] = 1;
|
|
3115
3133
|
frame["readyMap"] = /* @__PURE__ */ new Set();
|
|
3116
3134
|
frame["invokeList"] = [];
|
|
3117
|
-
|
|
3135
|
+
registerFrame(id, frame);
|
|
3118
3136
|
}
|
|
3119
3137
|
function reInitFrameForCache(frame) {
|
|
3120
3138
|
Reflect.set(frame, "id", "");
|
|
@@ -3123,7 +3141,7 @@ function reInitFrameForCache(frame) {
|
|
|
3123
3141
|
frame["readyMap"] = /* @__PURE__ */ new Set();
|
|
3124
3142
|
}
|
|
3125
3143
|
function translateQuery(pId, src, params) {
|
|
3126
|
-
const parentFrame =
|
|
3144
|
+
const parentFrame = getFrame(pId);
|
|
3127
3145
|
const parentView = parentFrame?.view;
|
|
3128
3146
|
if (!parentView) return;
|
|
3129
3147
|
const parentRefData = parentView.updater.refData;
|
package/dist/index.cjs
CHANGED
|
@@ -1460,6 +1460,21 @@ function use(names, callback) {
|
|
|
1460
1460
|
return loadPromise;
|
|
1461
1461
|
}
|
|
1462
1462
|
|
|
1463
|
+
// src/frame-registry.ts
|
|
1464
|
+
var frameRegistry = /* @__PURE__ */ new Map();
|
|
1465
|
+
function getFrame(id) {
|
|
1466
|
+
return frameRegistry.get(id);
|
|
1467
|
+
}
|
|
1468
|
+
function getAllFrames() {
|
|
1469
|
+
return frameRegistry;
|
|
1470
|
+
}
|
|
1471
|
+
function registerFrame(id, frame) {
|
|
1472
|
+
frameRegistry.set(id, frame);
|
|
1473
|
+
}
|
|
1474
|
+
function removeFrame(id) {
|
|
1475
|
+
frameRegistry.delete(id);
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1463
1478
|
// src/dom.ts
|
|
1464
1479
|
var wrapMeta = {
|
|
1465
1480
|
option: [1, "<select multiple>"],
|
|
@@ -2281,7 +2296,7 @@ var Updater = class {
|
|
|
2281
2296
|
const changed = this.hasChangedFlag;
|
|
2282
2297
|
this.hasChangedFlag = 0;
|
|
2283
2298
|
this.changedKeys = /* @__PURE__ */ new Set();
|
|
2284
|
-
const frame =
|
|
2299
|
+
const frame = getFrame(this.viewId);
|
|
2285
2300
|
const view = frame?.view;
|
|
2286
2301
|
const node = getById(this.viewId);
|
|
2287
2302
|
if (changed && view && node && view.signature > 0 && frame) {
|
|
@@ -2438,7 +2453,7 @@ function getViewClassRegistry() {
|
|
|
2438
2453
|
|
|
2439
2454
|
// src/hmr.ts
|
|
2440
2455
|
function reloadViews(viewPath) {
|
|
2441
|
-
const allFrames =
|
|
2456
|
+
const allFrames = getAllFrames();
|
|
2442
2457
|
const toReload = [];
|
|
2443
2458
|
for (const [, frame] of allFrames) {
|
|
2444
2459
|
if (frame.viewPath) {
|
|
@@ -2459,9 +2474,13 @@ function acceptView(hot, viewPath) {
|
|
|
2459
2474
|
const NewViewClass = candidate;
|
|
2460
2475
|
registerViewClass(viewPath, NewViewClass);
|
|
2461
2476
|
reloadViews(viewPath);
|
|
2462
|
-
|
|
2463
|
-
|
|
2477
|
+
return;
|
|
2478
|
+
}
|
|
2479
|
+
if (getViewClass(viewPath)) {
|
|
2480
|
+
reloadViews(viewPath);
|
|
2481
|
+
return;
|
|
2464
2482
|
}
|
|
2483
|
+
hot.invalidate();
|
|
2465
2484
|
});
|
|
2466
2485
|
}
|
|
2467
2486
|
function disposeView(hot, viewPath) {
|
|
@@ -3106,7 +3125,6 @@ function defineView(props, statics) {
|
|
|
3106
3125
|
}
|
|
3107
3126
|
|
|
3108
3127
|
// src/frame.ts
|
|
3109
|
-
var frameRegistry = /* @__PURE__ */ new Map();
|
|
3110
3128
|
var rootFrame;
|
|
3111
3129
|
var globalAlter;
|
|
3112
3130
|
var MAX_FRAME_POOL = 64;
|
|
@@ -3158,7 +3176,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3158
3176
|
if (parentId) {
|
|
3159
3177
|
this._parentId = parentId;
|
|
3160
3178
|
}
|
|
3161
|
-
|
|
3179
|
+
registerFrame(id, this);
|
|
3162
3180
|
const element = document.getElementById(id);
|
|
3163
3181
|
if (element) {
|
|
3164
3182
|
element.frame = this;
|
|
@@ -3289,7 +3307,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3289
3307
|
*/
|
|
3290
3308
|
mountFrame(frameId, viewPath, viewInitParams) {
|
|
3291
3309
|
notifyAlter(this, { id: frameId });
|
|
3292
|
-
let childFrame =
|
|
3310
|
+
let childFrame = getFrame(frameId);
|
|
3293
3311
|
if (!childFrame) {
|
|
3294
3312
|
if (!this.childrenMap[frameId]) {
|
|
3295
3313
|
this.childrenCount++;
|
|
@@ -3310,17 +3328,17 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3310
3328
|
*/
|
|
3311
3329
|
unmountFrame(id) {
|
|
3312
3330
|
const targetId = id ? this.childrenMap[id] : this.id;
|
|
3313
|
-
const frame =
|
|
3331
|
+
const frame = getFrame(targetId);
|
|
3314
3332
|
if (!frame) return;
|
|
3315
3333
|
const wasCreated = frame.readyCount > 0;
|
|
3316
3334
|
const pId = frame.parentId;
|
|
3317
3335
|
frame.unmountView();
|
|
3318
|
-
|
|
3336
|
+
removeFrame2(targetId, wasCreated);
|
|
3319
3337
|
reInitFrameForCache(frame);
|
|
3320
3338
|
if (frameCache.length < MAX_FRAME_POOL) {
|
|
3321
3339
|
frameCache.push(frame);
|
|
3322
3340
|
}
|
|
3323
|
-
const parent =
|
|
3341
|
+
const parent = getFrame(pId || "");
|
|
3324
3342
|
if (parent && parent.childrenMap[targetId]) {
|
|
3325
3343
|
Reflect.deleteProperty(parent.childrenMap, targetId);
|
|
3326
3344
|
parent.childrenCount--;
|
|
@@ -3385,7 +3403,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3385
3403
|
let currentPid = this.parentId;
|
|
3386
3404
|
let n = level >>> 0 || 1;
|
|
3387
3405
|
while (currentPid && n--) {
|
|
3388
|
-
frame =
|
|
3406
|
+
frame = getFrame(currentPid);
|
|
3389
3407
|
currentPid = frame?.parentId;
|
|
3390
3408
|
}
|
|
3391
3409
|
return frame;
|
|
@@ -3446,11 +3464,11 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3446
3464
|
// ============================================================
|
|
3447
3465
|
/** Get frame by ID */
|
|
3448
3466
|
static get(id) {
|
|
3449
|
-
return
|
|
3467
|
+
return getFrame(id);
|
|
3450
3468
|
}
|
|
3451
3469
|
/** Get all frames */
|
|
3452
3470
|
static getAll() {
|
|
3453
|
-
return
|
|
3471
|
+
return getAllFrames();
|
|
3454
3472
|
}
|
|
3455
3473
|
/**
|
|
3456
3474
|
* Returns the existing root frame, or `undefined` if none has been created.
|
|
@@ -3500,10 +3518,10 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3500
3518
|
function htmlElIsBound(element) {
|
|
3501
3519
|
return !!element.frameBound;
|
|
3502
3520
|
}
|
|
3503
|
-
function
|
|
3504
|
-
const frameInstance =
|
|
3521
|
+
function removeFrame2(id, wasCreated) {
|
|
3522
|
+
const frameInstance = getFrame(id);
|
|
3505
3523
|
if (!frameInstance) return;
|
|
3506
|
-
|
|
3524
|
+
removeFrame(id);
|
|
3507
3525
|
Frame.fire("remove", { frame: frameInstance, fcc: wasCreated });
|
|
3508
3526
|
const element = document.getElementById(id);
|
|
3509
3527
|
if (element) {
|
|
@@ -3520,7 +3538,7 @@ function notifyCreated(frameInstance) {
|
|
|
3520
3538
|
}
|
|
3521
3539
|
const pId = frameInstance.parentId;
|
|
3522
3540
|
if (pId) {
|
|
3523
|
-
const parent =
|
|
3541
|
+
const parent = getFrame(pId);
|
|
3524
3542
|
if (parent && !parent.readyMap.has(frameInstance.id)) {
|
|
3525
3543
|
parent.readyMap.add(frameInstance.id);
|
|
3526
3544
|
parent.readyCount++;
|
|
@@ -3536,7 +3554,7 @@ function notifyAlter(frameInstance, data) {
|
|
|
3536
3554
|
frameInstance.fire("alter", data);
|
|
3537
3555
|
const pId = frameInstance.parentId;
|
|
3538
3556
|
if (pId) {
|
|
3539
|
-
const parent =
|
|
3557
|
+
const parent = getFrame(pId);
|
|
3540
3558
|
if (parent && parent.readyMap.has(frameInstance.id)) {
|
|
3541
3559
|
parent.readyCount--;
|
|
3542
3560
|
parent.readyMap.delete(frameInstance.id);
|
|
@@ -3554,7 +3572,7 @@ function reInitFrame(frame, id, parentId) {
|
|
|
3554
3572
|
frame["signature"] = 1;
|
|
3555
3573
|
frame["readyMap"] = /* @__PURE__ */ new Set();
|
|
3556
3574
|
frame["invokeList"] = [];
|
|
3557
|
-
|
|
3575
|
+
registerFrame(id, frame);
|
|
3558
3576
|
}
|
|
3559
3577
|
function reInitFrameForCache(frame) {
|
|
3560
3578
|
Reflect.set(frame, "id", "");
|
|
@@ -3563,7 +3581,7 @@ function reInitFrameForCache(frame) {
|
|
|
3563
3581
|
frame["readyMap"] = /* @__PURE__ */ new Set();
|
|
3564
3582
|
}
|
|
3565
3583
|
function translateQuery(pId, src, params) {
|
|
3566
|
-
const parentFrame =
|
|
3584
|
+
const parentFrame = getFrame(pId);
|
|
3567
3585
|
const parentView = parentFrame?.view;
|
|
3568
3586
|
if (!parentView) return;
|
|
3569
3587
|
const parentRefData = parentView.updater.refData;
|
|
@@ -4454,19 +4472,6 @@ var Framework = {
|
|
|
4454
4472
|
}
|
|
4455
4473
|
return config;
|
|
4456
4474
|
},
|
|
4457
|
-
/**
|
|
4458
|
-
* @deprecated Use `getConfig()` / `setConfig()`. Behavior unchanged.
|
|
4459
|
-
*/
|
|
4460
|
-
config(cfg) {
|
|
4461
|
-
if (!cfg) {
|
|
4462
|
-
return config;
|
|
4463
|
-
}
|
|
4464
|
-
if (typeof cfg === "string") {
|
|
4465
|
-
return config[cfg];
|
|
4466
|
-
}
|
|
4467
|
-
assign(config, cfg);
|
|
4468
|
-
return config;
|
|
4469
|
-
},
|
|
4470
4475
|
/**
|
|
4471
4476
|
* Boot the framework.
|
|
4472
4477
|
*/
|
package/dist/index.d.cts
CHANGED
|
@@ -1434,17 +1434,9 @@ interface FrameworkInterface {
|
|
|
1434
1434
|
getConfig<T = unknown>(key: string): T | undefined;
|
|
1435
1435
|
/**
|
|
1436
1436
|
* Merge a patch into the framework configuration and return the merged
|
|
1437
|
-
* config object.
|
|
1437
|
+
* config object.
|
|
1438
1438
|
*/
|
|
1439
1439
|
setConfig<T extends object = Partial<FrameworkConfig>>(patch: Partial<FrameworkConfig> & T): FrameworkConfig & T;
|
|
1440
|
-
/**
|
|
1441
|
-
* @deprecated Use `getConfig()` / `getConfig(key)` for reads and
|
|
1442
|
-
* `setConfig(patch)` for writes. The overloaded `config()` blurred the
|
|
1443
|
-
* two and confused TypeScript inference; the split is a drop-in upgrade.
|
|
1444
|
-
*/
|
|
1445
|
-
config<T extends object = Partial<FrameworkConfig>>(cfg?: Partial<FrameworkConfig> & T): FrameworkConfig & T;
|
|
1446
|
-
/** @deprecated See above. */
|
|
1447
|
-
config(key: string): unknown;
|
|
1448
1440
|
/**
|
|
1449
1441
|
* App initialization entry point, starts framework and renders root view.
|
|
1450
1442
|
* After invocation: merge config → bind route events → create root Frame → mount default view.
|
|
@@ -1758,8 +1750,6 @@ interface CompileOptions {
|
|
|
1758
1750
|
file?: string;
|
|
1759
1751
|
/** Generate VDOM output instead of HTML string (default: false) */
|
|
1760
1752
|
virtualDom?: boolean;
|
|
1761
|
-
/** Use SWC instead of Babel for parsing (default: false) */
|
|
1762
|
-
useSwc?: boolean;
|
|
1763
1753
|
}
|
|
1764
1754
|
|
|
1765
1755
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1434,17 +1434,9 @@ interface FrameworkInterface {
|
|
|
1434
1434
|
getConfig<T = unknown>(key: string): T | undefined;
|
|
1435
1435
|
/**
|
|
1436
1436
|
* Merge a patch into the framework configuration and return the merged
|
|
1437
|
-
* config object.
|
|
1437
|
+
* config object.
|
|
1438
1438
|
*/
|
|
1439
1439
|
setConfig<T extends object = Partial<FrameworkConfig>>(patch: Partial<FrameworkConfig> & T): FrameworkConfig & T;
|
|
1440
|
-
/**
|
|
1441
|
-
* @deprecated Use `getConfig()` / `getConfig(key)` for reads and
|
|
1442
|
-
* `setConfig(patch)` for writes. The overloaded `config()` blurred the
|
|
1443
|
-
* two and confused TypeScript inference; the split is a drop-in upgrade.
|
|
1444
|
-
*/
|
|
1445
|
-
config<T extends object = Partial<FrameworkConfig>>(cfg?: Partial<FrameworkConfig> & T): FrameworkConfig & T;
|
|
1446
|
-
/** @deprecated See above. */
|
|
1447
|
-
config(key: string): unknown;
|
|
1448
1440
|
/**
|
|
1449
1441
|
* App initialization entry point, starts framework and renders root view.
|
|
1450
1442
|
* After invocation: merge config → bind route events → create root Frame → mount default view.
|
|
@@ -1758,8 +1750,6 @@ interface CompileOptions {
|
|
|
1758
1750
|
file?: string;
|
|
1759
1751
|
/** Generate VDOM output instead of HTML string (default: false) */
|
|
1760
1752
|
virtualDom?: boolean;
|
|
1761
|
-
/** Use SWC instead of Babel for parsing (default: false) */
|
|
1762
|
-
useSwc?: boolean;
|
|
1763
1753
|
}
|
|
1764
1754
|
|
|
1765
1755
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1396,6 +1396,21 @@ function use(names, callback) {
|
|
|
1396
1396
|
return loadPromise;
|
|
1397
1397
|
}
|
|
1398
1398
|
|
|
1399
|
+
// src/frame-registry.ts
|
|
1400
|
+
var frameRegistry = /* @__PURE__ */ new Map();
|
|
1401
|
+
function getFrame(id) {
|
|
1402
|
+
return frameRegistry.get(id);
|
|
1403
|
+
}
|
|
1404
|
+
function getAllFrames() {
|
|
1405
|
+
return frameRegistry;
|
|
1406
|
+
}
|
|
1407
|
+
function registerFrame(id, frame) {
|
|
1408
|
+
frameRegistry.set(id, frame);
|
|
1409
|
+
}
|
|
1410
|
+
function removeFrame(id) {
|
|
1411
|
+
frameRegistry.delete(id);
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1399
1414
|
// src/dom.ts
|
|
1400
1415
|
var wrapMeta = {
|
|
1401
1416
|
option: [1, "<select multiple>"],
|
|
@@ -2217,7 +2232,7 @@ var Updater = class {
|
|
|
2217
2232
|
const changed = this.hasChangedFlag;
|
|
2218
2233
|
this.hasChangedFlag = 0;
|
|
2219
2234
|
this.changedKeys = /* @__PURE__ */ new Set();
|
|
2220
|
-
const frame =
|
|
2235
|
+
const frame = getFrame(this.viewId);
|
|
2221
2236
|
const view = frame?.view;
|
|
2222
2237
|
const node = getById(this.viewId);
|
|
2223
2238
|
if (changed && view && node && view.signature > 0 && frame) {
|
|
@@ -2374,7 +2389,7 @@ function getViewClassRegistry() {
|
|
|
2374
2389
|
|
|
2375
2390
|
// src/hmr.ts
|
|
2376
2391
|
function reloadViews(viewPath) {
|
|
2377
|
-
const allFrames =
|
|
2392
|
+
const allFrames = getAllFrames();
|
|
2378
2393
|
const toReload = [];
|
|
2379
2394
|
for (const [, frame] of allFrames) {
|
|
2380
2395
|
if (frame.viewPath) {
|
|
@@ -2395,9 +2410,13 @@ function acceptView(hot, viewPath) {
|
|
|
2395
2410
|
const NewViewClass = candidate;
|
|
2396
2411
|
registerViewClass(viewPath, NewViewClass);
|
|
2397
2412
|
reloadViews(viewPath);
|
|
2398
|
-
|
|
2399
|
-
|
|
2413
|
+
return;
|
|
2414
|
+
}
|
|
2415
|
+
if (getViewClass(viewPath)) {
|
|
2416
|
+
reloadViews(viewPath);
|
|
2417
|
+
return;
|
|
2400
2418
|
}
|
|
2419
|
+
hot.invalidate();
|
|
2401
2420
|
});
|
|
2402
2421
|
}
|
|
2403
2422
|
function disposeView(hot, viewPath) {
|
|
@@ -3042,7 +3061,6 @@ function defineView(props, statics) {
|
|
|
3042
3061
|
}
|
|
3043
3062
|
|
|
3044
3063
|
// src/frame.ts
|
|
3045
|
-
var frameRegistry = /* @__PURE__ */ new Map();
|
|
3046
3064
|
var rootFrame;
|
|
3047
3065
|
var globalAlter;
|
|
3048
3066
|
var MAX_FRAME_POOL = 64;
|
|
@@ -3094,7 +3112,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3094
3112
|
if (parentId) {
|
|
3095
3113
|
this._parentId = parentId;
|
|
3096
3114
|
}
|
|
3097
|
-
|
|
3115
|
+
registerFrame(id, this);
|
|
3098
3116
|
const element = document.getElementById(id);
|
|
3099
3117
|
if (element) {
|
|
3100
3118
|
element.frame = this;
|
|
@@ -3225,7 +3243,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3225
3243
|
*/
|
|
3226
3244
|
mountFrame(frameId, viewPath, viewInitParams) {
|
|
3227
3245
|
notifyAlter(this, { id: frameId });
|
|
3228
|
-
let childFrame =
|
|
3246
|
+
let childFrame = getFrame(frameId);
|
|
3229
3247
|
if (!childFrame) {
|
|
3230
3248
|
if (!this.childrenMap[frameId]) {
|
|
3231
3249
|
this.childrenCount++;
|
|
@@ -3246,17 +3264,17 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3246
3264
|
*/
|
|
3247
3265
|
unmountFrame(id) {
|
|
3248
3266
|
const targetId = id ? this.childrenMap[id] : this.id;
|
|
3249
|
-
const frame =
|
|
3267
|
+
const frame = getFrame(targetId);
|
|
3250
3268
|
if (!frame) return;
|
|
3251
3269
|
const wasCreated = frame.readyCount > 0;
|
|
3252
3270
|
const pId = frame.parentId;
|
|
3253
3271
|
frame.unmountView();
|
|
3254
|
-
|
|
3272
|
+
removeFrame2(targetId, wasCreated);
|
|
3255
3273
|
reInitFrameForCache(frame);
|
|
3256
3274
|
if (frameCache.length < MAX_FRAME_POOL) {
|
|
3257
3275
|
frameCache.push(frame);
|
|
3258
3276
|
}
|
|
3259
|
-
const parent =
|
|
3277
|
+
const parent = getFrame(pId || "");
|
|
3260
3278
|
if (parent && parent.childrenMap[targetId]) {
|
|
3261
3279
|
Reflect.deleteProperty(parent.childrenMap, targetId);
|
|
3262
3280
|
parent.childrenCount--;
|
|
@@ -3321,7 +3339,7 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3321
3339
|
let currentPid = this.parentId;
|
|
3322
3340
|
let n = level >>> 0 || 1;
|
|
3323
3341
|
while (currentPid && n--) {
|
|
3324
|
-
frame =
|
|
3342
|
+
frame = getFrame(currentPid);
|
|
3325
3343
|
currentPid = frame?.parentId;
|
|
3326
3344
|
}
|
|
3327
3345
|
return frame;
|
|
@@ -3382,11 +3400,11 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3382
3400
|
// ============================================================
|
|
3383
3401
|
/** Get frame by ID */
|
|
3384
3402
|
static get(id) {
|
|
3385
|
-
return
|
|
3403
|
+
return getFrame(id);
|
|
3386
3404
|
}
|
|
3387
3405
|
/** Get all frames */
|
|
3388
3406
|
static getAll() {
|
|
3389
|
-
return
|
|
3407
|
+
return getAllFrames();
|
|
3390
3408
|
}
|
|
3391
3409
|
/**
|
|
3392
3410
|
* Returns the existing root frame, or `undefined` if none has been created.
|
|
@@ -3436,10 +3454,10 @@ var Frame = class _Frame extends EventEmitter {
|
|
|
3436
3454
|
function htmlElIsBound(element) {
|
|
3437
3455
|
return !!element.frameBound;
|
|
3438
3456
|
}
|
|
3439
|
-
function
|
|
3440
|
-
const frameInstance =
|
|
3457
|
+
function removeFrame2(id, wasCreated) {
|
|
3458
|
+
const frameInstance = getFrame(id);
|
|
3441
3459
|
if (!frameInstance) return;
|
|
3442
|
-
|
|
3460
|
+
removeFrame(id);
|
|
3443
3461
|
Frame.fire("remove", { frame: frameInstance, fcc: wasCreated });
|
|
3444
3462
|
const element = document.getElementById(id);
|
|
3445
3463
|
if (element) {
|
|
@@ -3456,7 +3474,7 @@ function notifyCreated(frameInstance) {
|
|
|
3456
3474
|
}
|
|
3457
3475
|
const pId = frameInstance.parentId;
|
|
3458
3476
|
if (pId) {
|
|
3459
|
-
const parent =
|
|
3477
|
+
const parent = getFrame(pId);
|
|
3460
3478
|
if (parent && !parent.readyMap.has(frameInstance.id)) {
|
|
3461
3479
|
parent.readyMap.add(frameInstance.id);
|
|
3462
3480
|
parent.readyCount++;
|
|
@@ -3472,7 +3490,7 @@ function notifyAlter(frameInstance, data) {
|
|
|
3472
3490
|
frameInstance.fire("alter", data);
|
|
3473
3491
|
const pId = frameInstance.parentId;
|
|
3474
3492
|
if (pId) {
|
|
3475
|
-
const parent =
|
|
3493
|
+
const parent = getFrame(pId);
|
|
3476
3494
|
if (parent && parent.readyMap.has(frameInstance.id)) {
|
|
3477
3495
|
parent.readyCount--;
|
|
3478
3496
|
parent.readyMap.delete(frameInstance.id);
|
|
@@ -3490,7 +3508,7 @@ function reInitFrame(frame, id, parentId) {
|
|
|
3490
3508
|
frame["signature"] = 1;
|
|
3491
3509
|
frame["readyMap"] = /* @__PURE__ */ new Set();
|
|
3492
3510
|
frame["invokeList"] = [];
|
|
3493
|
-
|
|
3511
|
+
registerFrame(id, frame);
|
|
3494
3512
|
}
|
|
3495
3513
|
function reInitFrameForCache(frame) {
|
|
3496
3514
|
Reflect.set(frame, "id", "");
|
|
@@ -3499,7 +3517,7 @@ function reInitFrameForCache(frame) {
|
|
|
3499
3517
|
frame["readyMap"] = /* @__PURE__ */ new Set();
|
|
3500
3518
|
}
|
|
3501
3519
|
function translateQuery(pId, src, params) {
|
|
3502
|
-
const parentFrame =
|
|
3520
|
+
const parentFrame = getFrame(pId);
|
|
3503
3521
|
const parentView = parentFrame?.view;
|
|
3504
3522
|
if (!parentView) return;
|
|
3505
3523
|
const parentRefData = parentView.updater.refData;
|
|
@@ -4390,19 +4408,6 @@ var Framework = {
|
|
|
4390
4408
|
}
|
|
4391
4409
|
return config;
|
|
4392
4410
|
},
|
|
4393
|
-
/**
|
|
4394
|
-
* @deprecated Use `getConfig()` / `setConfig()`. Behavior unchanged.
|
|
4395
|
-
*/
|
|
4396
|
-
config(cfg) {
|
|
4397
|
-
if (!cfg) {
|
|
4398
|
-
return config;
|
|
4399
|
-
}
|
|
4400
|
-
if (typeof cfg === "string") {
|
|
4401
|
-
return config[cfg];
|
|
4402
|
-
}
|
|
4403
|
-
assign(config, cfg);
|
|
4404
|
-
return config;
|
|
4405
|
-
},
|
|
4406
4411
|
/**
|
|
4407
4412
|
* Boot the framework.
|
|
4408
4413
|
*/
|