dom-render 1.0.97 → 1.0.99
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/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/dom-render.iml +9 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/jpa-buddy.xml +6 -0
- package/.idea/misc.xml +8 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/README.MD +6 -793
- package/package.json +1 -1
- package/DomRender.d.ts +0 -13
- package/DomRender.js +0 -72
- package/DomRenderProxy.d.ts +0 -30
- package/DomRenderProxy.js +0 -510
- package/components/ComponentSet.d.ts +0 -10
- package/components/ComponentSet.js +0 -13
- package/configs/Config.d.ts +0 -34
- package/configs/Config.js +0 -2
- package/configs/TargetAttr.d.ts +0 -6
- package/configs/TargetAttr.js +0 -2
- package/configs/TargetElement.d.ts +0 -14
- package/configs/TargetElement.js +0 -2
- package/css/parse/index.d.ts +0 -1
- package/css/parse/index.js +0 -512
- package/css/stringify/compiler.d.ts +0 -32
- package/css/stringify/compiler.js +0 -40
- package/css/stringify/compress.d.ts +0 -75
- package/css/stringify/compress.js +0 -156
- package/css/stringify/identity.d.ts +0 -85
- package/css/stringify/identity.js +0 -194
- package/css/stringify/index.d.ts +0 -14
- package/css/stringify/index.js +0 -44
- package/dist/bundle.js +0 -5493
- package/events/EventManager.d.ts +0 -49
- package/events/EventManager.js +0 -529
- package/iterators/Range.d.ts +0 -23
- package/iterators/Range.js +0 -80
- package/lifecycle/OnBeforeReturnGet.d.ts +0 -3
- package/lifecycle/OnBeforeReturnGet.js +0 -2
- package/lifecycle/OnBeforeReturnSet.d.ts +0 -3
- package/lifecycle/OnBeforeReturnSet.js +0 -2
- package/lifecycle/OnChangeAttrRender.d.ts +0 -3
- package/lifecycle/OnChangeAttrRender.js +0 -2
- package/lifecycle/OnCreateRender.d.ts +0 -3
- package/lifecycle/OnCreateRender.js +0 -2
- package/lifecycle/OnDestroyRender.d.ts +0 -4
- package/lifecycle/OnDestroyRender.js +0 -2
- package/lifecycle/OnInitRender.d.ts +0 -3
- package/lifecycle/OnInitRender.js +0 -2
- package/lifecycle/OnProxyDomRender.d.ts +0 -4
- package/lifecycle/OnProxyDomRender.js +0 -2
- package/managers/RenderManager.d.ts +0 -3
- package/managers/RenderManager.js +0 -18
- package/messenger/DefaultMessenger.d.ts +0 -3
- package/messenger/DefaultMessenger.js +0 -27
- package/messenger/Messenger.d.ts +0 -78
- package/messenger/Messenger.js +0 -201
- package/operators/Appender.d.ts +0 -10
- package/operators/Appender.js +0 -64
- package/operators/AttrExpresion.d.ts +0 -0
- package/operators/AttrExpresion.js +0 -44
- package/operators/Dr.d.ts +0 -8
- package/operators/Dr.js +0 -101
- package/operators/DrAppender.d.ts +0 -8
- package/operators/DrAppender.js +0 -107
- package/operators/DrFor.d.ts +0 -8
- package/operators/DrFor.js +0 -104
- package/operators/DrForOf.d.ts +0 -8
- package/operators/DrForOf.js +0 -107
- package/operators/DrForm.d.ts +0 -8
- package/operators/DrForm.js +0 -138
- package/operators/DrIf.d.ts +0 -8
- package/operators/DrIf.js +0 -108
- package/operators/DrInnerHTML.d.ts +0 -8
- package/operators/DrInnerHTML.js +0 -99
- package/operators/DrInnerText.d.ts +0 -8
- package/operators/DrInnerText.js +0 -97
- package/operators/DrPre.d.ts +0 -7
- package/operators/DrPre.js +0 -73
- package/operators/DrRepeat.d.ts +0 -8
- package/operators/DrRepeat.js +0 -105
- package/operators/DrTargetAttr.d.ts +0 -7
- package/operators/DrTargetAttr.js +0 -98
- package/operators/DrTargetElement.d.ts +0 -7
- package/operators/DrTargetElement.js +0 -114
- package/operators/DrThis.d.ts +0 -5
- package/operators/DrThis.js +0 -108
- package/operators/DrThisProperty.d.ts +0 -10
- package/operators/DrThisProperty.js +0 -143
- package/operators/OperatorExecuter.d.ts +0 -49
- package/operators/OperatorExecuter.js +0 -89
- package/operators/OperatorExecuterAttrRequire.d.ts +0 -8
- package/operators/OperatorExecuterAttrRequire.js +0 -79
- package/rawsets/AttrInitCallBack.d.ts +0 -5
- package/rawsets/AttrInitCallBack.js +0 -2
- package/rawsets/Attrs.d.ts +0 -24
- package/rawsets/Attrs.js +0 -2
- package/rawsets/CreatorMetaData.d.ts +0 -18
- package/rawsets/CreatorMetaData.js +0 -2
- package/rawsets/DestroyOptionType.d.ts +0 -4
- package/rawsets/DestroyOptionType.js +0 -8
- package/rawsets/ElementInitCallBack.d.ts +0 -8
- package/rawsets/ElementInitCallBack.js +0 -2
- package/rawsets/RawSet.d.ts +0 -118
- package/rawsets/RawSet.js +0 -1141
- package/rawsets/RawSetOperatorType.d.ts +0 -3
- package/rawsets/RawSetOperatorType.js +0 -7
- package/rawsets/RawSetType.d.ts +0 -7
- package/rawsets/RawSetType.js +0 -11
- package/rawsets/Render.d.ts +0 -17
- package/rawsets/Render.js +0 -2
- package/routers/HashRouter.d.ts +0 -9
- package/routers/HashRouter.js +0 -53
- package/routers/PathRouter.d.ts +0 -9
- package/routers/PathRouter.js +0 -52
- package/routers/Router.d.ts +0 -28
- package/routers/Router.js +0 -126
- package/types/Types.d.ts +0 -14
- package/types/Types.js +0 -36
- package/utils/clipboard/ClipBoardUtils.d.ts +0 -6
- package/utils/clipboard/ClipBoardUtils.js +0 -25
- package/utils/dom/DomUtils.d.ts +0 -13
- package/utils/dom/DomUtils.js +0 -47
- package/utils/location/LocationUtils.d.ts +0 -16
- package/utils/location/LocationUtils.js +0 -63
- package/utils/node/NodeUtils.d.ts +0 -10
- package/utils/node/NodeUtils.js +0 -27
- package/utils/random/RandomUtils.d.ts +0 -7
- package/utils/random/RandomUtils.js +0 -47
- package/utils/script/ScriptUtils.d.ts +0 -14
- package/utils/script/ScriptUtils.js +0 -89
- package/utils/storage/StorageUtils.d.ts +0 -16
- package/utils/storage/StorageUtils.js +0 -87
- package/utils/string/StringUtils.d.ts +0 -6
- package/utils/string/StringUtils.js +0 -58
- package/utils/valid/ValidUtils.d.ts +0 -10
- package/utils/valid/ValidUtils.js +0 -78
- package/validators/AllCheckedValidatorArray.d.ts +0 -6
- package/validators/AllCheckedValidatorArray.js +0 -32
- package/validators/AllUnCheckedValidatorArray.d.ts +0 -6
- package/validators/AllUnCheckedValidatorArray.js +0 -32
- package/validators/CheckedValidator.d.ts +0 -5
- package/validators/CheckedValidator.js +0 -32
- package/validators/CountEqualsCheckedValidatorArray.d.ts +0 -7
- package/validators/CountEqualsCheckedValidatorArray.js +0 -34
- package/validators/CountEqualsUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountEqualsUnCheckedValidatorArray.js +0 -34
- package/validators/CountGreaterThanCheckedValidatorArray.d.ts +0 -7
- package/validators/CountGreaterThanCheckedValidatorArray.js +0 -34
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.d.ts +0 -7
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.js +0 -34
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.js +0 -34
- package/validators/CountGreaterThanUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountGreaterThanUnCheckedValidatorArray.js +0 -34
- package/validators/CountLessThanCheckedValidatorArray.d.ts +0 -7
- package/validators/CountLessThanCheckedValidatorArray.js +0 -34
- package/validators/CountLessThanEqualsCheckedValidatorArray.d.ts +0 -7
- package/validators/CountLessThanEqualsCheckedValidatorArray.js +0 -34
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.js +0 -34
- package/validators/CountLessThanUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountLessThanUnCheckedValidatorArray.js +0 -34
- package/validators/CountUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountUnCheckedValidatorArray.js +0 -34
- package/validators/EmptyValidator.d.ts +0 -5
- package/validators/EmptyValidator.js +0 -33
- package/validators/ExcludeCheckedValidatorArray.d.ts +0 -8
- package/validators/ExcludeCheckedValidatorArray.js +0 -41
- package/validators/FormValidator.d.ts +0 -7
- package/validators/FormValidator.js +0 -37
- package/validators/IncludeCheckedValidatorArray.d.ts +0 -8
- package/validators/IncludeCheckedValidatorArray.js +0 -41
- package/validators/MultipleValidator.d.ts +0 -8
- package/validators/MultipleValidator.js +0 -48
- package/validators/NonPassValidator.d.ts +0 -5
- package/validators/NonPassValidator.js +0 -31
- package/validators/NotEmptyValidator.d.ts +0 -5
- package/validators/NotEmptyValidator.js +0 -34
- package/validators/NotRegExpTestValidator.d.ts +0 -6
- package/validators/NotRegExpTestValidator.js +0 -42
- package/validators/PassValidator.d.ts +0 -5
- package/validators/PassValidator.js +0 -31
- package/validators/RegExpTestValidator.d.ts +0 -6
- package/validators/RegExpTestValidator.js +0 -43
- package/validators/RequiredValidator.d.ts +0 -5
- package/validators/RequiredValidator.js +0 -33
- package/validators/UnCheckedValidator.d.ts +0 -5
- package/validators/UnCheckedValidator.js +0 -32
- package/validators/ValidMultipleValidator.d.ts +0 -9
- package/validators/ValidMultipleValidator.js +0 -34
- package/validators/ValidValidator.d.ts +0 -6
- package/validators/ValidValidator.js +0 -33
- package/validators/ValidValidatorArray.d.ts +0 -7
- package/validators/ValidValidatorArray.js +0 -33
- package/validators/Validator.d.ts +0 -57
- package/validators/Validator.js +0 -242
- package/validators/ValidatorArray.d.ts +0 -17
- package/validators/ValidatorArray.js +0 -99
- package/validators/ValueEqualsValidator.d.ts +0 -6
- package/validators/ValueEqualsValidator.js +0 -33
- package/validators/ValueNotEqualsValidator.d.ts +0 -6
- package/validators/ValueNotEqualsValidator.js +0 -33
package/iterators/Range.js
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Range = exports.RangeIterator = exports.RangeResult = void 0;
|
4
|
-
// within rangeResult.ts
|
5
|
-
// @ts-ignore
|
6
|
-
var RangeResult = /** @class */ (function () {
|
7
|
-
function RangeResult(value, done) {
|
8
|
-
this.done = done;
|
9
|
-
this.value = value !== null && value !== void 0 ? value : 0;
|
10
|
-
}
|
11
|
-
return RangeResult;
|
12
|
-
}());
|
13
|
-
exports.RangeResult = RangeResult;
|
14
|
-
var RangeIterator = /** @class */ (function () {
|
15
|
-
function RangeIterator(first, last, step) {
|
16
|
-
this._current = this._first = first;
|
17
|
-
this._last = last;
|
18
|
-
this._step = step;
|
19
|
-
}
|
20
|
-
RangeIterator.prototype.next = function (value) {
|
21
|
-
var r;
|
22
|
-
if (this._first < this._last && this._current < this._last) {
|
23
|
-
r = new RangeResult(this._current, false);
|
24
|
-
this._current += this._step;
|
25
|
-
}
|
26
|
-
else if (this._first < this._last && this._current === this._last) {
|
27
|
-
r = new RangeResult(this._current, false);
|
28
|
-
this._current += this._step;
|
29
|
-
}
|
30
|
-
else if (this._first > this._last && this._current > this._last) {
|
31
|
-
r = new RangeResult(this._current, false);
|
32
|
-
this._current -= this._step;
|
33
|
-
}
|
34
|
-
else if (this._first > this._last && this._current === this._last) {
|
35
|
-
r = new RangeResult(this._current, false);
|
36
|
-
this._current -= this._step;
|
37
|
-
}
|
38
|
-
else if (this._current === this._last) {
|
39
|
-
r = new RangeResult(this._current, false);
|
40
|
-
this._current -= this._step;
|
41
|
-
}
|
42
|
-
else {
|
43
|
-
r = new RangeResult(undefined, true);
|
44
|
-
}
|
45
|
-
return r;
|
46
|
-
};
|
47
|
-
return RangeIterator;
|
48
|
-
}());
|
49
|
-
exports.RangeIterator = RangeIterator;
|
50
|
-
var Range = /** @class */ (function () {
|
51
|
-
function Range(first, last, step) {
|
52
|
-
if (step === void 0) { step = 1; }
|
53
|
-
this.first = first;
|
54
|
-
this.last = last;
|
55
|
-
this.step = step;
|
56
|
-
this.isRange = true;
|
57
|
-
}
|
58
|
-
Range.prototype[Symbol.iterator] = function () {
|
59
|
-
return new RangeIterator(this.first, this.last, this.step);
|
60
|
-
};
|
61
|
-
Range.prototype.map = function (callbackfn, thisArg) {
|
62
|
-
return Array.from(this).map(callbackfn);
|
63
|
-
};
|
64
|
-
Range.range = function (first, last, step) {
|
65
|
-
if (step === void 0) { step = 1; }
|
66
|
-
if (typeof first === 'number' && last === undefined) {
|
67
|
-
return new Range(0, first, step);
|
68
|
-
}
|
69
|
-
else if (typeof first === 'string') {
|
70
|
-
var _a = first.split('..'), _first = _a[0], _b = _a[1], _last = _b === void 0 ? '0' : _b;
|
71
|
-
var _c = _last.split(','), __last = _c[0], _d = _c[1], _step = _d === void 0 ? '1' : _d;
|
72
|
-
return new Range(Number(_first.trim()), Number(__last.trim()), Number(_step.trim()));
|
73
|
-
}
|
74
|
-
else {
|
75
|
-
return new Range(first, last !== null && last !== void 0 ? last : 0, step);
|
76
|
-
}
|
77
|
-
};
|
78
|
-
return Range;
|
79
|
-
}());
|
80
|
-
exports.Range = Range;
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.RenderManager = void 0;
|
4
|
-
var RenderManager = /** @class */ (function () {
|
5
|
-
function RenderManager() {
|
6
|
-
}
|
7
|
-
RenderManager.render = function (obj, target) {
|
8
|
-
if (target === void 0) { target = Object.keys(obj); }
|
9
|
-
var domRenderProxy = obj._DomRender_proxy;
|
10
|
-
if (domRenderProxy) {
|
11
|
-
target.forEach(function (it) {
|
12
|
-
domRenderProxy.root([it], obj[it]);
|
13
|
-
});
|
14
|
-
}
|
15
|
-
};
|
16
|
-
return RenderManager;
|
17
|
-
}());
|
18
|
-
exports.RenderManager = RenderManager;
|
@@ -1,27 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
3
|
-
var extendStatics = function (d, b) {
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
-
return extendStatics(d, b);
|
8
|
-
};
|
9
|
-
return function (d, b) {
|
10
|
-
if (typeof b !== "function" && b !== null)
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
-
extendStatics(d, b);
|
13
|
-
function __() { this.constructor = d; }
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
-
};
|
16
|
-
})();
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
exports.DefaultMessenger = void 0;
|
19
|
-
var Messenger_1 = require("./Messenger");
|
20
|
-
var DefaultMessenger = /** @class */ (function (_super) {
|
21
|
-
__extends(DefaultMessenger, _super);
|
22
|
-
function DefaultMessenger() {
|
23
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
24
|
-
}
|
25
|
-
return DefaultMessenger;
|
26
|
-
}(Messenger_1.Messenger));
|
27
|
-
exports.DefaultMessenger = DefaultMessenger;
|
package/messenger/Messenger.d.ts
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
import { ConstructorType } from '../types/Types';
|
2
|
-
import { Config } from '../configs/Config';
|
3
|
-
declare enum CallBackType {
|
4
|
-
FILTER = 0,
|
5
|
-
MAP = 1,
|
6
|
-
SUBSCRIBE = 2
|
7
|
-
}
|
8
|
-
export declare type ChannelData = {
|
9
|
-
channel: Channel;
|
10
|
-
data?: (any | undefined);
|
11
|
-
};
|
12
|
-
export declare type ChannelMetaData = {
|
13
|
-
channel?: Channel;
|
14
|
-
action?: string;
|
15
|
-
};
|
16
|
-
export declare class ChannelSubscription {
|
17
|
-
channel: Channel;
|
18
|
-
subscriber: ChannelSubscriber;
|
19
|
-
constructor(channel: Channel, subscriber: ChannelSubscriber);
|
20
|
-
unsubscribe(): void;
|
21
|
-
}
|
22
|
-
export declare class ChannelSubscriber<SD = any> {
|
23
|
-
channel: Channel;
|
24
|
-
parentSubscriber?: ChannelSubscriber;
|
25
|
-
callbacks: ({
|
26
|
-
type: CallBackType;
|
27
|
-
callback: (data: any, metaData: ChannelMetaData) => any | undefined;
|
28
|
-
})[];
|
29
|
-
constructor(channel: Channel);
|
30
|
-
exeCallback(data: any, metaData: ChannelMetaData): any;
|
31
|
-
filter<D = SD>(callback: (data: D, meta: ChannelMetaData) => boolean): ChannelSubscriber<SD>;
|
32
|
-
map<D = SD, R = any>(callback: (data: D, meta: ChannelMetaData) => R): ChannelSubscriber<R>;
|
33
|
-
subscribe(callback: (data: SD, metaData: ChannelMetaData) => any | undefined): ChannelSubscription;
|
34
|
-
unsubscribe(): void;
|
35
|
-
deleteSubscriber(): void;
|
36
|
-
}
|
37
|
-
export declare class Channel {
|
38
|
-
private messenger;
|
39
|
-
obj: object;
|
40
|
-
key: string;
|
41
|
-
subscribers: Set<ChannelSubscriber<any>>;
|
42
|
-
constructor(messenger: Messenger, obj: object, key: string);
|
43
|
-
publish(key: string | object | ConstructorType<any>, data: any, action?: string): ChannelData[];
|
44
|
-
allPublish(data: any, action: string): any[];
|
45
|
-
filter<D = any>(filterF: (data: D, meta: ChannelMetaData) => boolean): ChannelSubscriber<D>;
|
46
|
-
map<D = any, R = any>(filterF: (data: D, meta: ChannelMetaData) => R): ChannelSubscriber<R>;
|
47
|
-
subscribe<D = any>(subscribeCallback: (data: D, meta: ChannelMetaData) => any | void | undefined): ChannelSubscription;
|
48
|
-
deleteChannel(): void;
|
49
|
-
}
|
50
|
-
declare type MessengerEventDetail = {
|
51
|
-
key: string | object | ConstructorType<any>;
|
52
|
-
data?: any;
|
53
|
-
action?: string;
|
54
|
-
result?: (c: ChannelData[]) => void;
|
55
|
-
};
|
56
|
-
declare type MessengerSubscribeEventDetail = {
|
57
|
-
obj: any;
|
58
|
-
key?: string | object | ConstructorType<any>;
|
59
|
-
init: (channel: Channel, subscription: ChannelSubscription) => void;
|
60
|
-
subscribe: (data: any, meta: ChannelMetaData) => void;
|
61
|
-
};
|
62
|
-
export declare abstract class Messenger {
|
63
|
-
private config;
|
64
|
-
private channels;
|
65
|
-
static readonly EVENT_PUBLISH_KEY = "domRenderMessenger_publish";
|
66
|
-
static readonly EVENT_SUBSCRIBE_KEY = "domRenderMessenger_subscribe";
|
67
|
-
constructor(config: Config);
|
68
|
-
static publish(window: Window, detail: MessengerEventDetail): void;
|
69
|
-
static subscribe(window: Window, detail: MessengerSubscribeEventDetail): void;
|
70
|
-
createChannel(obj: any, key?: any): Channel;
|
71
|
-
deleteChannel(channel: Channel): void;
|
72
|
-
deleteChannelFromObj(obj: any): void;
|
73
|
-
addChannel(channel: Channel): void;
|
74
|
-
getChannels(key: string | object | ConstructorType<any>): Channel[];
|
75
|
-
getAllChannels(): Channel[];
|
76
|
-
getAllChannelKeys(): string[];
|
77
|
-
}
|
78
|
-
export {};
|
package/messenger/Messenger.js
DELETED
@@ -1,201 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Messenger = exports.Channel = exports.ChannelSubscriber = exports.ChannelSubscription = void 0;
|
4
|
-
var Types_1 = require("../types/Types");
|
5
|
-
var CallBackType;
|
6
|
-
(function (CallBackType) {
|
7
|
-
CallBackType[CallBackType["FILTER"] = 0] = "FILTER";
|
8
|
-
CallBackType[CallBackType["MAP"] = 1] = "MAP";
|
9
|
-
CallBackType[CallBackType["SUBSCRIBE"] = 2] = "SUBSCRIBE";
|
10
|
-
})(CallBackType || (CallBackType = {}));
|
11
|
-
var ChannelSubscription = /** @class */ (function () {
|
12
|
-
function ChannelSubscription(channel, subscriber) {
|
13
|
-
this.channel = channel;
|
14
|
-
this.subscriber = subscriber;
|
15
|
-
}
|
16
|
-
ChannelSubscription.prototype.unsubscribe = function () {
|
17
|
-
this.subscriber.unsubscribe();
|
18
|
-
};
|
19
|
-
return ChannelSubscription;
|
20
|
-
}());
|
21
|
-
exports.ChannelSubscription = ChannelSubscription;
|
22
|
-
var ChannelSubscriber = /** @class */ (function () {
|
23
|
-
function ChannelSubscriber(channel) {
|
24
|
-
this.channel = channel;
|
25
|
-
this.callbacks = [];
|
26
|
-
}
|
27
|
-
ChannelSubscriber.prototype.exeCallback = function (data, metaData) {
|
28
|
-
for (var _i = 0, _a = this.callbacks; _i < _a.length; _i++) {
|
29
|
-
var callback = _a[_i];
|
30
|
-
if (callback.type === CallBackType.FILTER && !callback.callback(data, metaData)) {
|
31
|
-
break;
|
32
|
-
}
|
33
|
-
else if (callback.type === CallBackType.MAP) {
|
34
|
-
data = callback.callback(data, metaData);
|
35
|
-
}
|
36
|
-
else if (callback.type === CallBackType.SUBSCRIBE) {
|
37
|
-
data = callback.callback(data, metaData);
|
38
|
-
break;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
return data;
|
42
|
-
};
|
43
|
-
// chaining point
|
44
|
-
ChannelSubscriber.prototype.filter = function (callback) {
|
45
|
-
this.callbacks.push({ type: CallBackType.FILTER, callback: callback });
|
46
|
-
return this;
|
47
|
-
};
|
48
|
-
ChannelSubscriber.prototype.map = function (callback) {
|
49
|
-
this.callbacks.push({ type: CallBackType.MAP, callback: callback });
|
50
|
-
return this;
|
51
|
-
};
|
52
|
-
ChannelSubscriber.prototype.subscribe = function (callback) {
|
53
|
-
this.callbacks.push({ type: CallBackType.SUBSCRIBE, callback: callback });
|
54
|
-
this.channel.subscribers.add(this);
|
55
|
-
return new ChannelSubscription(this.channel, this);
|
56
|
-
};
|
57
|
-
ChannelSubscriber.prototype.unsubscribe = function () {
|
58
|
-
this.channel.subscribers.delete(this);
|
59
|
-
};
|
60
|
-
ChannelSubscriber.prototype.deleteSubscriber = function () {
|
61
|
-
this.unsubscribe();
|
62
|
-
this.channel.subscribers.delete(this);
|
63
|
-
};
|
64
|
-
return ChannelSubscriber;
|
65
|
-
}());
|
66
|
-
exports.ChannelSubscriber = ChannelSubscriber;
|
67
|
-
var Channel = /** @class */ (function () {
|
68
|
-
function Channel(messenger, obj, key) {
|
69
|
-
this.messenger = messenger;
|
70
|
-
this.obj = obj;
|
71
|
-
this.key = key;
|
72
|
-
this.subscribers = new Set();
|
73
|
-
}
|
74
|
-
Channel.prototype.publish = function (key, data, action) {
|
75
|
-
var _this = this;
|
76
|
-
var _a;
|
77
|
-
var rtns = [];
|
78
|
-
(_a = this.messenger.getChannels(key)) === null || _a === void 0 ? void 0 : _a.forEach(function (it) {
|
79
|
-
try {
|
80
|
-
it.subscribers.forEach(function (its) {
|
81
|
-
var rdata = its.exeCallback(data, { channel: _this, action: action });
|
82
|
-
rtns.push({ channel: it, data: rdata });
|
83
|
-
});
|
84
|
-
}
|
85
|
-
catch (e) {
|
86
|
-
console.error(e);
|
87
|
-
}
|
88
|
-
});
|
89
|
-
return rtns;
|
90
|
-
};
|
91
|
-
Channel.prototype.allPublish = function (data, action) {
|
92
|
-
var _this = this;
|
93
|
-
var rtns = [];
|
94
|
-
this.messenger.getAllChannelKeys().forEach(function (it) {
|
95
|
-
rtns.push(_this.publish(it, data));
|
96
|
-
});
|
97
|
-
return rtns.flat();
|
98
|
-
};
|
99
|
-
// string point
|
100
|
-
Channel.prototype.filter = function (filterF) {
|
101
|
-
var subscriber = new ChannelSubscriber(this);
|
102
|
-
subscriber.filter(filterF);
|
103
|
-
return subscriber;
|
104
|
-
};
|
105
|
-
Channel.prototype.map = function (filterF) {
|
106
|
-
var subscriber = new ChannelSubscriber(this);
|
107
|
-
subscriber.map(filterF);
|
108
|
-
return subscriber;
|
109
|
-
};
|
110
|
-
Channel.prototype.subscribe = function (subscribeCallback) {
|
111
|
-
var subscriber = new ChannelSubscriber(this);
|
112
|
-
return subscriber.subscribe(subscribeCallback);
|
113
|
-
};
|
114
|
-
;
|
115
|
-
Channel.prototype.deleteChannel = function () {
|
116
|
-
this.messenger.deleteChannel(this);
|
117
|
-
};
|
118
|
-
;
|
119
|
-
return Channel;
|
120
|
-
}());
|
121
|
-
exports.Channel = Channel;
|
122
|
-
var Messenger = /** @class */ (function () {
|
123
|
-
function Messenger(config) {
|
124
|
-
var _this = this;
|
125
|
-
this.config = config;
|
126
|
-
this.channels = new Set();
|
127
|
-
this.config.window.addEventListener(Messenger.EVENT_PUBLISH_KEY, function (e) {
|
128
|
-
var _a, _b;
|
129
|
-
var detail = e.detail;
|
130
|
-
// console.log('--->', detail)
|
131
|
-
var rtns = [];
|
132
|
-
(_a = _this.getChannels(detail.key)) === null || _a === void 0 ? void 0 : _a.forEach(function (it) {
|
133
|
-
try {
|
134
|
-
it.subscribers.forEach(function (its) {
|
135
|
-
var rdata = its.exeCallback(detail.data, { action: detail.action });
|
136
|
-
rtns.push({ channel: it, data: rdata });
|
137
|
-
});
|
138
|
-
}
|
139
|
-
catch (e) {
|
140
|
-
console.error(e);
|
141
|
-
}
|
142
|
-
});
|
143
|
-
(_b = detail.result) === null || _b === void 0 ? void 0 : _b.call(detail, rtns);
|
144
|
-
});
|
145
|
-
this.config.window.addEventListener(Messenger.EVENT_SUBSCRIBE_KEY, function (e) {
|
146
|
-
var detail = e.detail;
|
147
|
-
// console.log('--->', detail)
|
148
|
-
var channel = _this.createChannel(detail.obj, detail.key);
|
149
|
-
detail.init(channel, channel.subscribe(detail.subscribe));
|
150
|
-
});
|
151
|
-
}
|
152
|
-
Messenger.publish = function (window, detail) {
|
153
|
-
window.dispatchEvent(new CustomEvent(Messenger.EVENT_PUBLISH_KEY, { detail: detail }));
|
154
|
-
};
|
155
|
-
Messenger.subscribe = function (window, detail) {
|
156
|
-
window.dispatchEvent(new CustomEvent(Messenger.EVENT_SUBSCRIBE_KEY, { detail: detail }));
|
157
|
-
};
|
158
|
-
Messenger.prototype.createChannel = function (obj, key) {
|
159
|
-
if (key === void 0) { key = obj.constructor.name; }
|
160
|
-
var channel = Types_1.DomRenderFinalProxy.final(new Channel(this, obj, key));
|
161
|
-
this.channels.add(channel);
|
162
|
-
// this.channels.get(key) ? this.channels.get(key)!.push(channel) : this.channels.set(key, [channel]);
|
163
|
-
return channel;
|
164
|
-
};
|
165
|
-
Messenger.prototype.deleteChannel = function (channel) {
|
166
|
-
this.channels.delete(channel);
|
167
|
-
};
|
168
|
-
Messenger.prototype.deleteChannelFromObj = function (obj) {
|
169
|
-
var _this = this;
|
170
|
-
if (obj) {
|
171
|
-
this.channels.forEach(function (it) {
|
172
|
-
if (it.obj === obj) {
|
173
|
-
// console.log('dddddddddddd', obj)
|
174
|
-
_this.deleteChannel(it);
|
175
|
-
}
|
176
|
-
});
|
177
|
-
}
|
178
|
-
};
|
179
|
-
Messenger.prototype.addChannel = function (channel) {
|
180
|
-
this.channels.add(channel);
|
181
|
-
};
|
182
|
-
Messenger.prototype.getChannels = function (key) {
|
183
|
-
if (typeof key === 'object') {
|
184
|
-
key = key.constructor.name;
|
185
|
-
}
|
186
|
-
else if (typeof key === 'function') {
|
187
|
-
key = key.name;
|
188
|
-
}
|
189
|
-
return Array.from(this.channels.values()).filter(function (it) { return it.key === key; });
|
190
|
-
};
|
191
|
-
Messenger.prototype.getAllChannels = function () {
|
192
|
-
return Array.from(this.channels.values());
|
193
|
-
};
|
194
|
-
Messenger.prototype.getAllChannelKeys = function () {
|
195
|
-
return Array.from(this.channels.values()).map(function (it) { return it.key; });
|
196
|
-
};
|
197
|
-
Messenger.EVENT_PUBLISH_KEY = 'domRenderMessenger_publish';
|
198
|
-
Messenger.EVENT_SUBSCRIBE_KEY = 'domRenderMessenger_subscribe';
|
199
|
-
return Messenger;
|
200
|
-
}());
|
201
|
-
exports.Messenger = Messenger;
|
package/operators/Appender.d.ts
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
export declare class Appender<T = any> implements Iterable<T> {
|
2
|
-
[key: number]: T[] | undefined;
|
3
|
-
length: number;
|
4
|
-
constructor(defaultDatas?: T[]);
|
5
|
-
[Symbol.iterator](): Iterator<T>;
|
6
|
-
getAll(): T[];
|
7
|
-
getAlls(): T[][];
|
8
|
-
push(...items: T[]): void;
|
9
|
-
clear(): void;
|
10
|
-
}
|
package/operators/Appender.js
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Appender = void 0;
|
4
|
-
var Appender = /** @class */ (function () {
|
5
|
-
function Appender(defaultDatas) {
|
6
|
-
this.length = 0;
|
7
|
-
if (defaultDatas) {
|
8
|
-
this.push.apply(this, defaultDatas);
|
9
|
-
}
|
10
|
-
// (this.childs as any).isAppender = true;
|
11
|
-
}
|
12
|
-
Appender.prototype[Symbol.iterator] = function () {
|
13
|
-
var items = this.getAll();
|
14
|
-
var idx = 0;
|
15
|
-
return {
|
16
|
-
next: function (value) {
|
17
|
-
var r = { value: undefined, done: true };
|
18
|
-
if (items.length > idx) {
|
19
|
-
r = { value: items[idx], done: false };
|
20
|
-
}
|
21
|
-
idx++;
|
22
|
-
return r;
|
23
|
-
}
|
24
|
-
};
|
25
|
-
};
|
26
|
-
Appender.prototype.getAll = function () {
|
27
|
-
return this.getAlls().flat();
|
28
|
-
};
|
29
|
-
Appender.prototype.getAlls = function () {
|
30
|
-
var _this = this;
|
31
|
-
var map = Array.from({ length: this.length }).filter(function (it, idx) { return _this[idx]; }).map(function (it, idx) { return _this[idx]; });
|
32
|
-
return map;
|
33
|
-
};
|
34
|
-
Appender.prototype.push = function () {
|
35
|
-
var items = [];
|
36
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
37
|
-
items[_i] = arguments[_i];
|
38
|
-
}
|
39
|
-
// console.log('----2>', items, this.length);
|
40
|
-
items.index = this.length;
|
41
|
-
this[this.length++] = items;
|
42
|
-
// console.log('---22->', this.length)
|
43
|
-
// const appender = this.childs[this.lastIndex];
|
44
|
-
// appender.values = items;
|
45
|
-
// this.childs.push(new Appender(appender.index + 1));
|
46
|
-
};
|
47
|
-
// delete(idx: number): void {
|
48
|
-
// // if (idx in this) {
|
49
|
-
// // console.log('---------dele',idx)
|
50
|
-
// // delete this[idx];
|
51
|
-
// // this.length = this.length - 1;
|
52
|
-
// // }
|
53
|
-
// this.length = this.length - 1;
|
54
|
-
// }
|
55
|
-
Appender.prototype.clear = function () {
|
56
|
-
// console.log('length', this.length);
|
57
|
-
for (var i = 0; i < this.length; i++) {
|
58
|
-
delete this[i];
|
59
|
-
}
|
60
|
-
this.length = 0;
|
61
|
-
};
|
62
|
-
return Appender;
|
63
|
-
}());
|
64
|
-
exports.Appender = Appender;
|
File without changes
|
@@ -1,44 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
// import {ExecuteState, OperatorRender} from './OperatorRender';
|
3
|
-
// import {ScriptUtils} from '../utils/script/ScriptUtils';
|
4
|
-
// import {RawSet, Render} from '../RawSet';
|
5
|
-
//
|
6
|
-
// export class AttrExpresion extends OperatorRender {
|
7
|
-
// execRender(): ExecuteState {
|
8
|
-
// const targetAttrs = this.elementSource.element.getAttributeNames()
|
9
|
-
// .filter(it => RawSet.isExporesion(this.elementSource.element.getAttribute(it)))
|
10
|
-
// .map(it => ({name: it, expresion: RawSet.exporesionGrouops(this.elementSource.element.getAttribute(it))[0][1]}))
|
11
|
-
// .filter(it => it.name.length > 0 && it.expresion.length > 0)
|
12
|
-
// .map(it => {
|
13
|
-
// return `n.setAttribute('${it.name}', ${it.expresion})`;
|
14
|
-
// });
|
15
|
-
// // console.log('--!!!!!!!!!---', targetAttrs)
|
16
|
-
// if (targetAttrs?.length > 0) {
|
17
|
-
// const newTemp = this.source.config.window.document.createElement('temp');
|
18
|
-
// // console.log('------>', targetAttrs, targetAttrs.join(';'))
|
19
|
-
// ScriptUtils.eval(`
|
20
|
-
// ${this.render.bindScript}
|
21
|
-
// //const n = $element.cloneNode(true);
|
22
|
-
// const n = $element;
|
23
|
-
// ${targetAttrs.join(';')};
|
24
|
-
// // this.__render.fag.append(n);
|
25
|
-
// `, Object.assign(this.source.obj, {
|
26
|
-
// __render: Object.freeze({
|
27
|
-
// fag: newTemp,
|
28
|
-
// targetAttrs,
|
29
|
-
// ...this.render
|
30
|
-
// } as Render)
|
31
|
-
// }));
|
32
|
-
// // const tempalte = this.source.config.window.document.createElement('template');
|
33
|
-
// // tempalte.innerHTML = newTemp.innerHTML;
|
34
|
-
// // this.returnContainer.fag.append(tempalte.content);
|
35
|
-
// const rr = RawSet.checkPointCreates(this.render.element, this.source.config);
|
36
|
-
// // const rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
|
37
|
-
// // this.elementSource.element.parentNode?.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
38
|
-
// this.returnContainer.raws.push(...rr);
|
39
|
-
// // return ExecuteState.EXECUTE;
|
40
|
-
// return ExecuteState.NO_EXECUTE;
|
41
|
-
// }
|
42
|
-
// return ExecuteState.NO_EXECUTE;
|
43
|
-
// }
|
44
|
-
// }
|
package/operators/Dr.d.ts
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
import { OperatorExecuterAttrRequire } from './OperatorExecuterAttrRequire';
|
2
|
-
import { RawSet } from '../rawsets/RawSet';
|
3
|
-
import { Render } from '../rawsets/Render';
|
4
|
-
import { AfterCallBack, ElementSource, ExecuteState, ReturnContainer, Source } from './OperatorExecuter';
|
5
|
-
export declare class Dr extends OperatorExecuterAttrRequire<null> {
|
6
|
-
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
7
|
-
executeAttrRequire(data: null): Promise<ExecuteState>;
|
8
|
-
}
|