typecomposer 0.0.12 → 0.0.13
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/dist/cjs/core/element/base/CSSStyle.js +5 -0
- package/dist/cjs/core/element/base/CSSStyle.js.map +1 -1
- package/dist/cjs/core/ref/Ref.d.ts +12 -0
- package/dist/cjs/core/ref/Ref.js +46 -24
- package/dist/cjs/core/ref/Ref.js.map +1 -1
- package/dist/cjs/core/ref/RefProxyHandler.d.ts +1 -0
- package/dist/cjs/core/ref/RefProxyHandler.js +110 -0
- package/dist/cjs/core/ref/RefProxyHandler.js.map +1 -0
- package/dist/cjs/core/ref/index.d.ts +1 -1
- package/dist/cjs/core/ref/index.js +2 -1
- package/dist/cjs/core/ref/index.js.map +1 -1
- package/dist/cjs/global/global.js +6 -0
- package/dist/cjs/global/global.js.map +1 -1
- package/dist/esm/core/element/base/CSSStyle.js +5 -0
- package/dist/esm/core/element/base/CSSStyle.js.map +1 -1
- package/dist/esm/core/ref/Ref.d.ts +12 -0
- package/dist/esm/core/ref/Ref.js +44 -23
- package/dist/esm/core/ref/Ref.js.map +1 -1
- package/dist/esm/core/ref/RefProxyHandler.d.ts +1 -0
- package/dist/esm/core/ref/RefProxyHandler.js +106 -0
- package/dist/esm/core/ref/RefProxyHandler.js.map +1 -0
- package/dist/esm/core/ref/index.d.ts +1 -1
- package/dist/esm/core/ref/index.js +1 -1
- package/dist/esm/core/ref/index.js.map +1 -1
- package/dist/esm/global/global.js +6 -0
- package/dist/esm/global/global.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/core/ref/Ref.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ref = void 0;
|
|
3
|
+
exports.ref = exports.RefString = void 0;
|
|
4
|
+
const RefProxyHandler_1 = require("./RefProxyHandler");
|
|
5
|
+
class RefString extends String {
|
|
6
|
+
refPropertyKey;
|
|
7
|
+
refTarget;
|
|
8
|
+
constructor(valor, refPropertyKey, refTarget) {
|
|
9
|
+
super(valor);
|
|
10
|
+
this.refPropertyKey = refPropertyKey;
|
|
11
|
+
this.refTarget = refTarget;
|
|
12
|
+
}
|
|
13
|
+
toString() {
|
|
14
|
+
return super.toString();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.RefString = RefString;
|
|
4
18
|
function ref(target) {
|
|
5
19
|
const _id = Math.random().toString(36).substr(2, 9);
|
|
6
20
|
const registry = new FinalizationRegistry((target) => {
|
|
@@ -15,21 +29,30 @@ function ref(target) {
|
|
|
15
29
|
onChange,
|
|
16
30
|
toString,
|
|
17
31
|
};
|
|
18
|
-
const proxy =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
const proxy = initRef();
|
|
33
|
+
function initRef() {
|
|
34
|
+
const result = createProxy(newTarget);
|
|
35
|
+
// console.log("initRef: ", newTarget.value);
|
|
36
|
+
if (typeof newTarget.value === "object") {
|
|
37
|
+
newTarget.value = createProxy(newTarget.value);
|
|
38
|
+
checkType(newTarget.value);
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
function checkType(value) {
|
|
43
|
+
for (let property in value) {
|
|
44
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, property);
|
|
45
|
+
if (descriptor &&
|
|
46
|
+
descriptor.writable &&
|
|
47
|
+
typeof value[property] === "object") {
|
|
48
|
+
value[property] = createProxy(value[property]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function createProxy(target) {
|
|
53
|
+
// console.log("createProxy: ", target, Object.keys(target));
|
|
54
|
+
return (0, RefProxyHandler_1.createProxyRef)(target, notify);
|
|
55
|
+
}
|
|
33
56
|
function notify() {
|
|
34
57
|
const remove = [];
|
|
35
58
|
_subscribers.forEach((subscriber) => {
|
|
@@ -49,8 +72,6 @@ function ref(target) {
|
|
|
49
72
|
else
|
|
50
73
|
return false;
|
|
51
74
|
}
|
|
52
|
-
else
|
|
53
|
-
target[subscriber.propertyKey] = newTarget.value;
|
|
54
75
|
}
|
|
55
76
|
else
|
|
56
77
|
return false;
|
|
@@ -61,11 +82,11 @@ function ref(target) {
|
|
|
61
82
|
return true;
|
|
62
83
|
}
|
|
63
84
|
function subscriber(target, propertyKey) {
|
|
64
|
-
const item = { target: new WeakRef(target), propertyKey };
|
|
65
|
-
if (setValueToSubscriber(item)) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
85
|
+
// const item = { target: new WeakRef(target), propertyKey };
|
|
86
|
+
// if (setValueToSubscriber(item)) {
|
|
87
|
+
// _subscribers.push(item);
|
|
88
|
+
// registry.register(item.target, item);
|
|
89
|
+
// }
|
|
69
90
|
}
|
|
70
91
|
function unsubscribe(data) {
|
|
71
92
|
// _subscribers = _subscribers.filter(
|
|
@@ -77,9 +98,10 @@ function ref(target) {
|
|
|
77
98
|
const item = {
|
|
78
99
|
target: target ? new WeakRef(target) : data,
|
|
79
100
|
propertyKey: undefined,
|
|
101
|
+
refPropertyKey: undefined,
|
|
80
102
|
fun: data,
|
|
81
103
|
};
|
|
82
|
-
if (setValueToSubscriber(item)) {
|
|
104
|
+
if (setValueToSubscriber(item) || fun) {
|
|
83
105
|
_subscribers.push(item);
|
|
84
106
|
registry.register(item.target, item);
|
|
85
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.js","sourceRoot":"","sources":["../../../../src/core/ref/Ref.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Ref.js","sourceRoot":"","sources":["../../../../src/core/ref/Ref.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AASnD,MAAa,SAAU,SAA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,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,UAAU,CAAC,MAAU,EAAE,WAA4B;QAC1D,6DAA6D;QAC7D,oCAAoC;QACpC,6BAA6B;QAC7B,0CAA0C;QAC1C,IAAI;IACN,CAAC;IAED,SAAS,WAAW,CAAC,IAAgD;QACnE,sCAAsC;QACtC,wCAAwC;QACxC,KAAK;IACP,CAAC;IAED,SAAS,QAAQ,CAAC,GAAuB,EAAE,MAAW;QACpD,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,IAAI,GAAG;YACX,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;YAC3C,WAAW,EAAE,SAAS;YACtB,cAAc,EAAE,SAAS;YACzB,GAAG,EAAE,IAAI;SACV,CAAC;QACF,IAAI,oBAAoB,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;YACtC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,SAAS,QAAQ;QACf,OAAO,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAlHD,kBAkHC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createProxyRef<T extends object>(target: T, onChange: () => void): T;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createProxyRef = void 0;
|
|
4
|
+
const Ref_1 = require("./Ref");
|
|
5
|
+
function createProxyRef(target, onChange) {
|
|
6
|
+
const handler = {};
|
|
7
|
+
const proxy = new Proxy(target, handler);
|
|
8
|
+
let _subscribers = [];
|
|
9
|
+
const registry = new FinalizationRegistry((target) => {
|
|
10
|
+
_subscribers = _subscribers.filter((subscriber) => subscriber.target != target);
|
|
11
|
+
});
|
|
12
|
+
function notify(prop, value) {
|
|
13
|
+
// console.log("notify: ", _subscribers);
|
|
14
|
+
const remove = [];
|
|
15
|
+
_subscribers.forEach((subscriber) => {
|
|
16
|
+
if (!setValueToSubscriber(subscriber, prop, value))
|
|
17
|
+
remove.push(subscriber);
|
|
18
|
+
});
|
|
19
|
+
_subscribers = _subscribers.filter((subscriber) => !remove.includes(subscriber));
|
|
20
|
+
}
|
|
21
|
+
function setValueToSubscriber(subscriber, prop, value) {
|
|
22
|
+
try {
|
|
23
|
+
const target = subscriber.target?.deref();
|
|
24
|
+
if (target) {
|
|
25
|
+
if (value && value instanceof Ref_1.RefString)
|
|
26
|
+
value = value?.toString() || "";
|
|
27
|
+
// if (subscriber.fun) {
|
|
28
|
+
// const fun = subscriber.fun?.deref();
|
|
29
|
+
// if (fun) fun(newTarget.value);
|
|
30
|
+
// else return false;
|
|
31
|
+
// // } else
|
|
32
|
+
// console.log(
|
|
33
|
+
// "setValueToSubscriber: ",
|
|
34
|
+
// prop,
|
|
35
|
+
// " subscriber.propertyKe: ",
|
|
36
|
+
// subscriber.propertyKey,
|
|
37
|
+
// " value: ",
|
|
38
|
+
// value,
|
|
39
|
+
// );
|
|
40
|
+
// if (prop == subscriber.propertyKey)
|
|
41
|
+
if (subscriber.refPropertyKey == undefined ||
|
|
42
|
+
prop == undefined ||
|
|
43
|
+
prop == subscriber.refPropertyKey)
|
|
44
|
+
target[subscriber.propertyKey] = value;
|
|
45
|
+
}
|
|
46
|
+
else
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
// function subscriber(target: {}, propertyKey: string | symbol) {
|
|
55
|
+
// const item = { target: new WeakRef(target), propertyKey };
|
|
56
|
+
// if (setValueToSubscriber(item)) {
|
|
57
|
+
// _subscribers.push(item);
|
|
58
|
+
// registry.register(item.target, item);
|
|
59
|
+
// }
|
|
60
|
+
// }
|
|
61
|
+
// function unsubscribe(data: { ref: any; name: string; fun?: Function }) {
|
|
62
|
+
// // _subscribers = _subscribers.filter(
|
|
63
|
+
// // (subscriber) => subscriber != data,
|
|
64
|
+
// // );
|
|
65
|
+
// }
|
|
66
|
+
const proxyHandler = {
|
|
67
|
+
get: function (target, prop, receiver) {
|
|
68
|
+
const value = Reflect.get(target, prop, receiver);
|
|
69
|
+
if (typeof value === "string")
|
|
70
|
+
return new Ref_1.RefString(value, prop, proxy);
|
|
71
|
+
return value;
|
|
72
|
+
},
|
|
73
|
+
set: function (target, prop, value, receiver) {
|
|
74
|
+
// console.log("prop: ", prop, " value: ", value, " receiver: ", receiver);
|
|
75
|
+
if (value instanceof Ref_1.RefString)
|
|
76
|
+
value = value?.toString();
|
|
77
|
+
// console.log("set: ", prop, value);
|
|
78
|
+
const resul = Reflect.set(target, prop, value, receiver);
|
|
79
|
+
notify(prop, value);
|
|
80
|
+
onChange();
|
|
81
|
+
return resul;
|
|
82
|
+
},
|
|
83
|
+
deleteProperty: function (target, prop) {
|
|
84
|
+
const resul = Reflect.deleteProperty(target, prop);
|
|
85
|
+
onChange();
|
|
86
|
+
return resul;
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
proxy["subscriber"] = function (target, propertyKey, refPropertyKey = undefined) {
|
|
90
|
+
const item = {
|
|
91
|
+
target: new WeakRef(target),
|
|
92
|
+
propertyKey,
|
|
93
|
+
refPropertyKey,
|
|
94
|
+
};
|
|
95
|
+
let value = refPropertyKey == undefined ? proxy["value"] : proxy[refPropertyKey];
|
|
96
|
+
if (value instanceof Ref_1.RefString)
|
|
97
|
+
value = value.toString();
|
|
98
|
+
if (setValueToSubscriber(item, refPropertyKey, value)) {
|
|
99
|
+
_subscribers.push(item);
|
|
100
|
+
registry.register(item.target, item);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
proxy["toString"] = function () {
|
|
104
|
+
return proxy["value"]?.toString() || "";
|
|
105
|
+
};
|
|
106
|
+
Object.setPrototypeOf(handler, proxyHandler);
|
|
107
|
+
return proxy;
|
|
108
|
+
}
|
|
109
|
+
exports.createProxyRef = createProxyRef;
|
|
110
|
+
//# sourceMappingURL=RefProxyHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefProxyHandler.js","sourceRoot":"","sources":["../../../../src/core/ref/RefProxyHandler.ts"],"names":[],"mappings":";;;AAAA,+BAA+C;AAE/C,SAAgB,cAAc,CAC5B,MAAS,EACT,QAAoB;IAEpB,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,IAAI,YAAY,GAAkB,EAAE,CAAC;IACrC,MAAM,QAAQ,GAA8B,IAAI,oBAAoB,CAClE,CAAC,MAAoB,EAAE,EAAE;QACvB,YAAY,GAAG,YAAY,CAAC,MAAM,CAChC,CAAC,UAAU,EAAE,EAAE,CAAE,UAAU,CAAC,MAAc,IAAI,MAAM,CACrD,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,SAAS,MAAM,CAAC,IAAqB,EAAE,KAAU;QAC/C,yCAAyC;QACzC,MAAM,MAAM,GAAkB,EAAE,CAAC;QACjC,YAAY,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YAClC,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC;gBAChD,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QACH,YAAY,GAAG,YAAY,CAAC,MAAM,CAChC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,C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M,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC;IACF,KAAK,CAAC,UAAU,CAAC,GAAG;QAClB,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC,CAAC;IACF,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC7C,OAAO,KAAK,CAAC;AACf,CAAC;AA1HD,wCA0HC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ref } from "./Ref";
|
|
1
|
+
export { ref, RefString } from "./Ref";
|
|
2
2
|
export { RefComponent } from "./RefComponent";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RefComponent = exports.ref = void 0;
|
|
3
|
+
exports.RefComponent = exports.RefString = exports.ref = void 0;
|
|
4
4
|
var Ref_1 = require("./Ref");
|
|
5
5
|
Object.defineProperty(exports, "ref", { enumerable: true, get: function () { return Ref_1.ref; } });
|
|
6
|
+
Object.defineProperty(exports, "RefString", { enumerable: true, get: function () { return Ref_1.RefString; } });
|
|
6
7
|
var RefComponent_1 = require("./RefComponent");
|
|
7
8
|
Object.defineProperty(exports, "RefComponent", { enumerable: true, get: function () { return RefComponent_1.RefComponent; } });
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/ref/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/ref/index.ts"],"names":[],"mappings":";;;AAAA,6BAAuC;AAA9B,0FAAA,GAAG,OAAA;AAAE,gGAAA,SAAS,OAAA;AACvB,+CAA8C;AAArC,4GAAA,YAAY,OAAA"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// Proxy.prototype.onChange = function (
|
|
4
|
+
// fun: (value: any) => void,
|
|
5
|
+
// target?: {},
|
|
6
|
+
// ): void {
|
|
7
|
+
// console.log("onChange: ", fun, target);
|
|
8
|
+
// };
|
|
3
9
|
Array.prototype.clear = function () {
|
|
4
10
|
this.length = 0;
|
|
5
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.js","sourceRoot":"","sources":["../../../src/global/global.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["../../../src/global/global.ts"],"names":[],"mappings":";;AAuBA,wCAAwC;AACxC,+BAA+B;AAC/B,iBAAiB;AACjB,YAAY;AACZ,4CAA4C;AAC5C,KAAK;AAEL,KAAK,CAAC,SAAS,CAAC,KAAK,GAAG;IACtB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,QAAQ,GAAG;IAC1B,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,QAAQ,GAAG,UAAU,KAAa;IACjD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,EAAE,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACxC,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RefString } from "../../ref";
|
|
1
2
|
const _styleAtributtes = [
|
|
2
3
|
"accentColor",
|
|
3
4
|
"additiveSymbols",
|
|
@@ -617,6 +618,10 @@ export class CSSStyleref {
|
|
|
617
618
|
_style;
|
|
618
619
|
stylerefMap = new Map();
|
|
619
620
|
setStylerefMap(propertyKey, ref) {
|
|
621
|
+
if (ref instanceof RefString) {
|
|
622
|
+
ref.refTarget.subscriber(this._style, propertyKey, ref.refPropertyKey);
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
620
625
|
let oldref = this.stylerefMap.get(propertyKey);
|
|
621
626
|
if (oldref)
|
|
622
627
|
oldref.ref.unsubscribe(oldref.data);
|