@thestarweb/star-framework-app-web 1.2.5 → 1.3.0
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/CHANGELOG.md +46 -0
- package/dist/abort-signal/browser.js +2 -2
- package/dist/abort-signal/browser.js.map +1 -1
- package/dist/abort-signal/index.js +3 -3
- package/dist/abort-signal/index.js.map +1 -1
- package/dist/abort-signal/server.js +4 -3
- package/dist/abort-signal/server.js.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/cli/dev-server.js +1 -1
- package/dist/cli/dev-server.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/interceptor/index.js +5 -4
- package/dist/interceptor/index.js.map +1 -1
- package/dist/interceptor/middleware-to-interceptor/index.js +1 -1
- package/dist/interceptor/middleware-to-interceptor/index.js.map +1 -1
- package/dist/params/index.js +1 -0
- package/dist/params/index.js.map +1 -1
- package/dist/request/index.js +2 -2
- package/dist/request/index.js.map +1 -1
- package/dist/request/server.js +2 -2
- package/dist/request/server.js.map +1 -1
- package/dist/request/types.js +5 -4
- package/dist/request/types.js.map +1 -1
- package/dist/route/index.js +7 -3
- package/dist/route/index.js.map +1 -1
- package/dist/server/body/helper.js +1 -1
- package/dist/server/body/helper.js.map +1 -1
- package/dist/server/dump-api-type.js +1 -1
- package/dist/server/dump-api-type.js.map +1 -1
- package/dist/server/index.js +8 -5
- package/dist/server/index.js.map +1 -1
- package/dist/view/data-context/context.js +9 -6
- package/dist/view/data-context/context.js.map +1 -1
- package/dist/view/data-context/index.js +1 -1
- package/dist/view/html/create-element.js +2 -2
- package/dist/view/html/create-element.js.map +1 -1
- package/dist/view/html/parse-html-to-v-dom.js +1 -1
- package/dist/view/html/parse-html-to-v-dom.js.map +1 -1
- package/dist/view/html/render-v-dom-to-string.js +3 -3
- package/dist/view/html/render-v-dom-to-string.js.map +1 -1
- package/dist/view/layout.js +6 -4
- package/dist/view/layout.js.map +1 -1
- package/dist/view/render/render.js +5 -3
- package/dist/view/render/render.js.map +1 -1
- package/dist/view/types.js +1 -1
- package/dist/view/utils/find-route-dom.js +1 -1
- package/dist/view/utils/find-route-dom.js.map +1 -1
- package/dist/view/utils/get-render/client.js +10 -6
- package/dist/view/utils/get-render/client.js.map +1 -1
- package/dist/view/utils/get-render/common.js +6 -6
- package/dist/view/utils/get-render/common.js.map +1 -1
- package/dist/view/utils/get-render/server.js +26 -1
- package/dist/view/utils/get-render/server.js.map +1 -1
- package/dist/view/utils/remove-prefix.js +8 -0
- package/dist/view/utils/remove-prefix.js.map +1 -0
- package/dist/view/view.js +1 -1
- package/dist/view/view.js.map +1 -1
- package/package.json +10 -7
- package/resource/base-style.css +27 -27
- package/resource/default-index.html +10 -10
- package/src/cli-helper.ts +5 -5
- package/src/interceptor/index.ts +26 -26
- package/src/interceptor/middleware-to-interceptor/index.ts +29 -29
- package/src/interceptor/middleware-to-interceptor/mock-res.ts +255 -255
- package/src/interceptor/middleware-to-interceptor/mook-req.ts +218 -218
- package/src/interceptor/types.ts +7 -7
- package/src/params/index.ts +1 -0
- package/src/request/server.ts +2 -2
- package/src/request/types.ts +6 -5
- package/src/return-types/index.ts +2 -2
- package/src/return-types/location-to.ts +8 -8
- package/src/return-types/response-with-meta.ts +17 -17
- package/src/route/index.ts +43 -43
- package/src/route/types.ts +11 -11
- package/src/server/body/helper.ts +110 -110
- package/src/server/body/json.ts +217 -217
- package/src/server/body/types.ts +6 -6
- package/src/server/index.ts +8 -2
- package/src/server/types.ts +11 -11
- package/src/view/const.ts +2 -2
- package/src/view/data-context/index.ts +18 -18
- package/src/view/html/index.ts +3 -3
- package/src/view/html/render-v-dom-to-string.ts +79 -79
- package/src/view/html/types.ts +32 -32
- package/src/view/index.ts +6 -6
- package/src/view/render/html-render.ts +21 -21
- package/src/view/render/index.ts +2 -2
- package/src/view/types.ts +1 -1
- package/src/view/utils/find-route-dom.ts +19 -19
- package/src/view/utils/get-render/client.ts +9 -3
- package/src/view/utils/get-render/common.ts +2 -2
- package/src/view/utils/get-render/server.ts +34 -1
- package/src/view/utils/index.ts +2 -2
- package/src/view/utils/loading-progress.ts +58 -58
- package/src/view/utils/remove-prefix.ts +5 -0
- package/dist/runtime/index.js +0 -84
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/type.js +0 -11
- package/dist/runtime/type.js.map +0 -1
- package/dist/server/utils/pass-through-readable.js +0 -13
- package/dist/server/utils/pass-through-readable.js.map +0 -1
- package/dist/view/data-context/conetext.js +0 -70
- package/dist/view/data-context/conetext.js.map +0 -1
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
export class LoadingProgress {
|
|
2
|
-
private div = document.createElement("div");
|
|
3
|
-
private span = document.createElement("span");
|
|
4
|
-
private constructor() {
|
|
5
|
-
this.div.className = "sf-page-loading-progress";
|
|
6
|
-
this.div.append(this.span);
|
|
7
|
-
document.body.append(this.div);
|
|
8
|
-
this.span.addEventListener("transitionend", () => {
|
|
9
|
-
if (this.progress >= 100) {
|
|
10
|
-
this.div.style.display = "none";
|
|
11
|
-
} else {
|
|
12
|
-
this.progress = 1 - (1 - this.progress) * 0.9;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
static _instance: LoadingProgress;
|
|
17
|
-
static get instance() {
|
|
18
|
-
if (!this._instance) {
|
|
19
|
-
this._instance = new LoadingProgress();
|
|
20
|
-
}
|
|
21
|
-
return this._instance;
|
|
22
|
-
}
|
|
23
|
-
private _progress = 0;
|
|
24
|
-
get progress() {
|
|
25
|
-
return this._progress;
|
|
26
|
-
}
|
|
27
|
-
set progress(value: number) {
|
|
28
|
-
this._progress = value;
|
|
29
|
-
this.div.style.setProperty("--progress", this._progress.toString());
|
|
30
|
-
}
|
|
31
|
-
set transitionTime(value: number) {
|
|
32
|
-
this.div.style.setProperty("--transition-time", value.toString());
|
|
33
|
-
}
|
|
34
|
-
timeout?: NodeJS.Timeout;
|
|
35
|
-
interval?: NodeJS.Timeout;
|
|
36
|
-
private stop() {
|
|
37
|
-
clearTimeout(this.timeout);
|
|
38
|
-
clearInterval(this.interval);
|
|
39
|
-
}
|
|
40
|
-
start() {
|
|
41
|
-
this.stop();
|
|
42
|
-
this.div.style.display = "block";
|
|
43
|
-
this.transitionTime = 0;
|
|
44
|
-
this.progress = 0;
|
|
45
|
-
this.timeout = setTimeout(() => {
|
|
46
|
-
this.transitionTime = 2;
|
|
47
|
-
this.progress = 0.2;
|
|
48
|
-
}, 100);
|
|
49
|
-
}
|
|
50
|
-
end() {
|
|
51
|
-
if (this.progress <= 0.2) {
|
|
52
|
-
this.div.style.display = "none";
|
|
53
|
-
}
|
|
54
|
-
this.stop();
|
|
55
|
-
this.transitionTime = 0.2;
|
|
56
|
-
this.progress = 100;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
1
|
+
export class LoadingProgress {
|
|
2
|
+
private div = document.createElement("div");
|
|
3
|
+
private span = document.createElement("span");
|
|
4
|
+
private constructor() {
|
|
5
|
+
this.div.className = "sf-page-loading-progress";
|
|
6
|
+
this.div.append(this.span);
|
|
7
|
+
document.body.append(this.div);
|
|
8
|
+
this.span.addEventListener("transitionend", () => {
|
|
9
|
+
if (this.progress >= 100) {
|
|
10
|
+
this.div.style.display = "none";
|
|
11
|
+
} else {
|
|
12
|
+
this.progress = 1 - (1 - this.progress) * 0.9;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static _instance: LoadingProgress;
|
|
17
|
+
static get instance() {
|
|
18
|
+
if (!this._instance) {
|
|
19
|
+
this._instance = new LoadingProgress();
|
|
20
|
+
}
|
|
21
|
+
return this._instance;
|
|
22
|
+
}
|
|
23
|
+
private _progress = 0;
|
|
24
|
+
get progress() {
|
|
25
|
+
return this._progress;
|
|
26
|
+
}
|
|
27
|
+
set progress(value: number) {
|
|
28
|
+
this._progress = value;
|
|
29
|
+
this.div.style.setProperty("--progress", this._progress.toString());
|
|
30
|
+
}
|
|
31
|
+
set transitionTime(value: number) {
|
|
32
|
+
this.div.style.setProperty("--transition-time", value.toString());
|
|
33
|
+
}
|
|
34
|
+
timeout?: NodeJS.Timeout;
|
|
35
|
+
interval?: NodeJS.Timeout;
|
|
36
|
+
private stop() {
|
|
37
|
+
clearTimeout(this.timeout);
|
|
38
|
+
clearInterval(this.interval);
|
|
39
|
+
}
|
|
40
|
+
start() {
|
|
41
|
+
this.stop();
|
|
42
|
+
this.div.style.display = "block";
|
|
43
|
+
this.transitionTime = 0;
|
|
44
|
+
this.progress = 0;
|
|
45
|
+
this.timeout = setTimeout(() => {
|
|
46
|
+
this.transitionTime = 2;
|
|
47
|
+
this.progress = 0.2;
|
|
48
|
+
}, 100);
|
|
49
|
+
}
|
|
50
|
+
end() {
|
|
51
|
+
if (this.progress <= 0.2) {
|
|
52
|
+
this.div.style.display = "none";
|
|
53
|
+
}
|
|
54
|
+
this.stop();
|
|
55
|
+
this.transitionTime = 0.2;
|
|
56
|
+
this.progress = 100;
|
|
57
|
+
}
|
|
58
|
+
}
|
package/dist/runtime/index.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
function __assignType(fn, args) {
|
|
2
|
-
fn.__type = args;
|
|
3
|
-
return fn;
|
|
4
|
-
}
|
|
5
|
-
import { createServer } from "http";
|
|
6
|
-
/*@ts-ignore*/
|
|
7
|
-
import { __ΩServerInstanceConfig, __ΩServerConfig } from "./type.js";
|
|
8
|
-
import { Readable } from "stream";
|
|
9
|
-
async function createHandle(instances) {
|
|
10
|
-
return await Promise.all(instances.map(__assignType(async (i) => {
|
|
11
|
-
const ret = {
|
|
12
|
-
...i,
|
|
13
|
-
instance: undefined,
|
|
14
|
-
};
|
|
15
|
-
const { main } = i;
|
|
16
|
-
switch (typeof main) {
|
|
17
|
-
case "object":
|
|
18
|
-
ret.instance = main;
|
|
19
|
-
break;
|
|
20
|
-
case "string":
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
return ret;
|
|
24
|
-
}, ['i', '', 'P"2!"/"'])));
|
|
25
|
-
}
|
|
26
|
-
createHandle.__type = [() => __ΩServerInstanceConfig, 'instances', 'createHandle', 'Pn!F2""/#'];
|
|
27
|
-
export async function createHttpServer(config) {
|
|
28
|
-
const server = createServer();
|
|
29
|
-
let handles = await createHandle(config.instances);
|
|
30
|
-
server.on("request", __assignType(async (req, res) => {
|
|
31
|
-
const url = new URL(req.url || "/", `http://${req.headers.host || "127.0.0.1"}/`);
|
|
32
|
-
const instance = handles.find(__assignType((i) => !i.if || i.if(url), ['i', '', 'P"2!"/"']));
|
|
33
|
-
if (instance) {
|
|
34
|
-
try {
|
|
35
|
-
const ret = await instance.instance.onRequert(req.method?.toLocaleUpperCase() || "GET", url, req.headers, req);
|
|
36
|
-
if (ret) {
|
|
37
|
-
if (ret.code) {
|
|
38
|
-
res.statusCode = ret.code;
|
|
39
|
-
}
|
|
40
|
-
Object.entries(ret.header).forEach(__assignType(([key, data]) => {
|
|
41
|
-
res.setHeader(key, data);
|
|
42
|
-
}, ['param0', '', 'P"2!"/"']));
|
|
43
|
-
if (ret.res) {
|
|
44
|
-
if (ret.res instanceof ReadableStream) {
|
|
45
|
-
// const read = ret.res.getReader();
|
|
46
|
-
// let t: ReadableStreamReadResult<any>;
|
|
47
|
-
// while ((t = await read.read())) {
|
|
48
|
-
// t.value;
|
|
49
|
-
// }
|
|
50
|
-
Readable.fromWeb(ret.res).pipe(res);
|
|
51
|
-
// for await (const item of ret.res) {
|
|
52
|
-
// //
|
|
53
|
-
// }
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
ret.res.pipe(res);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
res.end();
|
|
61
|
-
}
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
catch (e) {
|
|
66
|
-
console.warn(e);
|
|
67
|
-
res.statusCode = 500;
|
|
68
|
-
res.end();
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
res.statusCode = 404;
|
|
73
|
-
res.end();
|
|
74
|
-
}, ['req', 'res', '', 'P"2!"2""/#']));
|
|
75
|
-
server.listen(config.port);
|
|
76
|
-
console.log(`server start at: http://127.0.0.1:${config.port}`);
|
|
77
|
-
return {
|
|
78
|
-
updateinstances: __assignType(async function updateinstances(ins) {
|
|
79
|
-
handles = await createHandle(ins);
|
|
80
|
-
}, [() => __ΩServerInstanceConfig, 'ins', 'updateinstances', 'Pn!F2""/#']),
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
createHttpServer.__type = [() => __ΩServerConfig, 'config', 'createHttpServer', 'Pn!2""/#'];
|
|
84
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;;yDAC+B,WAAW;AAE9E,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,KAAK,UAAU,YAAY,CAAC,SAAiC;IAC5D,OAAO,MAAM,OAAO,CAAC,GAAG,CACvB,SAAS,CAAC,GAAG,cAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QACzB,MAAM,GAAG,GAAG;YACX,GAAG,CAAC;YACJ,QAAQ,EAAE,SAAsC;SAChD,CAAC;QACF,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACnB,QAAQ,OAAO,IAAI,EAAE,CAAC;YACrB,KAAK,QAAQ;gBACZ,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACpB,MAAM;YACP,KAAK,QAAQ;gBACZ,MAAM;QACR,CAAC;QACD,OAAO,GAAG,CAAC;IACZ,CAAC,wBAAC,CACF,CAAC;AACH,CAAC;;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAoB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AY;4BACZ,IAAI;4BACJ,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,GAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;4BAC3C,sCAAsC;4BACtC,MAAM;4BACN,IAAI;wBACL,CAAC;6BAAM,CAAC;4BACP,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;wBACnB,CAAC;oBACF,CAAC;yBAAM,CAAC;wBACP,GAAG,CAAC,GAAG,EAAE,CAAC;oBACX,CAAC;oBACD,OAAO;gBACR,CAAC;YACF,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAChB,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;gBACrB,GAAG,CAAC,GAAG,EAAE,CAAC;gBACV,OAAO;YACR,CAAC;QACF,CAAC;QACD,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;QACrB,GAAG,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,oCAAC,CAAC;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,CAAC,GAAG,CAAC,qCAAqC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAChE,OAAO;QACA,eAAe,eAArB,KAAK,UAAC,eAAe,CAAC,GAA2B;YAChD,OAAO,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/dist/runtime/type.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*@ts-ignore*/
|
|
2
|
-
import { __ΩMethod } from "../route/types.js";
|
|
3
|
-
/*@ts-ignore*/
|
|
4
|
-
import { __ΩInterceptor } from "../interceptor/index.js";
|
|
5
|
-
const __ΩServerInstanceConfig = [() => __ΩServerInstance, 'main', 'url', '', 'if', 'importent', 'ServerInstanceConfig', 'PPn!&J4"P!2#)/$4%8\'4&8Mw\'y'];
|
|
6
|
-
export { __ΩServerInstanceConfig as __ΩServerInstanceConfig };
|
|
7
|
-
const __ΩServerConfig = [() => __ΩServerInstanceConfig, 'instances', 'port', 'ServerConfig', 'Pn!F4"\'4#Mw$y'];
|
|
8
|
-
export { __ΩServerConfig as __ΩServerConfig };
|
|
9
|
-
const __ΩServerInstance = [() => __ΩMethod, 'method', 'url', 'header', 'body', 'code', 'res', '', 'onRequert', () => __ΩInterceptor, 'i', 'addGlobalInterceptor', 'ServerInstance', 'PPn!2"P&!J2#"2$!2%8PP\'4&"4$P!!,J4\'M-J`/(4)Pn*2+$1,Mw-y'];
|
|
10
|
-
export { __ΩServerInstance as __ΩServerInstance };
|
|
11
|
-
//# sourceMappingURL=type.js.map
|
package/dist/runtime/type.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/runtime/type.ts"],"names":[],"mappings":";0BAGuB,mBAAmB;;+BACd,yBAAyB"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Readable } from "stream";
|
|
2
|
-
export class PassThroughReadable extends Readable {
|
|
3
|
-
p;
|
|
4
|
-
constructor(p) {
|
|
5
|
-
super();
|
|
6
|
-
this.p = p;
|
|
7
|
-
}
|
|
8
|
-
_read(size) {
|
|
9
|
-
return this.p.read(size);
|
|
10
|
-
}
|
|
11
|
-
static __type = [() => Readable, 'p', 'constructor', 'size', '_read', 'PassThroughReadable', 'P7!P!2";9"0#P\'2$$0%5w&'];
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=pass-through-readable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pass-through-readable.js","sourceRoot":"","sources":["../../../src/server/utils/pass-through-readable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE/C,MAAM,OAAO,mBAAoB,SAAQ,QAAQ;IACnB;IAA7B,YAA6B,CAAc;QAC1C,KAAK,EAAE,CAAC;QADoB,MAAC,GAAD,CAAC,CAAa;IAE3C,CAAC;IACD,KAAK,CAAC,IAAY;QACjB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
function __assignType(fn, args) {
|
|
2
|
-
fn.__type = args;
|
|
3
|
-
return fn;
|
|
4
|
-
}
|
|
5
|
-
export class SFDataContext {
|
|
6
|
-
_root;
|
|
7
|
-
constructor(_root) {
|
|
8
|
-
this._root = _root;
|
|
9
|
-
}
|
|
10
|
-
get value() {
|
|
11
|
-
return this._root.value;
|
|
12
|
-
}
|
|
13
|
-
callbacks = (Set.Ω = [['newValue', '', 'P!2!$/"']], new Set());
|
|
14
|
-
children = (Set.Ω = [[() => SFDataContext, 'P!7!']], new Set());
|
|
15
|
-
fock() {
|
|
16
|
-
return this._root.createChild();
|
|
17
|
-
}
|
|
18
|
-
watch(callback, updateNow = false) {
|
|
19
|
-
if (this.callbacks.size === 0)
|
|
20
|
-
// @ts-ignore 2341
|
|
21
|
-
this._root.children.add(this);
|
|
22
|
-
this.callbacks.add(callback);
|
|
23
|
-
if (updateNow)
|
|
24
|
-
callback(this.value);
|
|
25
|
-
}
|
|
26
|
-
distory() {
|
|
27
|
-
this._root.distoryChild(this);
|
|
28
|
-
}
|
|
29
|
-
static __type = ['T', () => SFRawDataContext, '_root', 'constructor', 'callbacks', function () { return (Set.Ω = [['newValue', '', 'P!2!$/"']], new Set()); }, 'children', function () { return (Set.Ω = [[() => SFDataContext, 'P!7!']], new Set()); }, 'fock', 'newValue', '', 'callback', 'updateNow', 'watch', 'distory', 'SFDataContext', 'b!PPe#!7"2#;"0$!!3%;>&!3\';>(P"0)PPe#!2*$/+2,"2-"0.P"0/5w0'];
|
|
30
|
-
}
|
|
31
|
-
export class SFRawDataContext {
|
|
32
|
-
_value;
|
|
33
|
-
constructor(_value) {
|
|
34
|
-
this._value = _value;
|
|
35
|
-
}
|
|
36
|
-
get value() {
|
|
37
|
-
return this._value;
|
|
38
|
-
}
|
|
39
|
-
update(newValue) {
|
|
40
|
-
this._value = newValue;
|
|
41
|
-
const called = new Set();
|
|
42
|
-
this.children.forEach(__assignType((i) => {
|
|
43
|
-
i.callbacks.forEach(__assignType((c) => {
|
|
44
|
-
if (!called.has(c)) {
|
|
45
|
-
called.add(c);
|
|
46
|
-
c(newValue);
|
|
47
|
-
}
|
|
48
|
-
}, ['c', '', 'P"2!"/"']));
|
|
49
|
-
}, ['i', '', 'P"2!"/"']));
|
|
50
|
-
}
|
|
51
|
-
children = (Set.Ω = [[() => SFDataContext, 'P!7!']], new Set());
|
|
52
|
-
createChild() {
|
|
53
|
-
const child =
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
new SFDataContext(this);
|
|
56
|
-
return child;
|
|
57
|
-
}
|
|
58
|
-
distoryChild(child) {
|
|
59
|
-
this.children.delete(child);
|
|
60
|
-
}
|
|
61
|
-
static __type = ['T', '_value', 'constructor', 'newValue', 'update', 'children', function () { return (Set.Ω = [[() => SFDataContext, 'P!7!']], new Set()); }, 'createChild', () => SFDataContext, 'child', 'distoryChild', 'SFRawDataContext', 'b!Pe"!2";"0#!Pe"!2$"0%!3&;>\'P"0(PPe#!7)2*"0+5w,'];
|
|
62
|
-
}
|
|
63
|
-
export function forkDataContextRecord(data) {
|
|
64
|
-
return Object.fromEntries(Object.entries(data).map(__assignType(([k, context]) => [
|
|
65
|
-
k,
|
|
66
|
-
context instanceof SFDataContext ? context.fock() : context,
|
|
67
|
-
], ['param0', '', 'P"2!"/"'])));
|
|
68
|
-
}
|
|
69
|
-
forkDataContextRecord.__type = ['data', 'forkDataContextRecord', 'P"2!"/"'];
|
|
70
|
-
//# sourceMappingURL=conetext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conetext.js","sourceRoot":"","sources":["../../../src/view/data-context/conetext.ts"],"names":[],"mappings":";;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