@dooboostore/dom-render 1.0.98
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/DomRender.d.ts +24 -0
- package/DomRender.js +115 -0
- package/DomRenderProxy.d.ts +38 -0
- package/DomRenderProxy.js +586 -0
- package/README.MD +938 -0
- package/components/ComponentBase.d.ts +41 -0
- package/components/ComponentBase.js +210 -0
- package/components/ComponentSet.d.ts +22 -0
- package/components/ComponentSet.js +23 -0
- package/components/appender/Appender.d.ts +23 -0
- package/components/appender/Appender.js +59 -0
- package/components/checkbox/CheckBox.d.ts +47 -0
- package/components/checkbox/CheckBox.js +118 -0
- package/components/choose/Choose.d.ts +39 -0
- package/components/choose/Choose.js +110 -0
- package/components/details/Details.d.ts +57 -0
- package/components/details/Details.js +199 -0
- package/components/dialog/Dialog.d.ts +1 -0
- package/components/dialog/Dialog.js +85 -0
- package/components/dialog/example/ImageEditorDialog.d.ts +1 -0
- package/components/dialog/example/ImageEditorDialog.js +116 -0
- package/components/forOf/ForOf.d.ts +18 -0
- package/components/forOf/ForOf.js +32 -0
- package/components/if/If.d.ts +21 -0
- package/components/if/If.js +40 -0
- package/components/index.d.ts +27 -0
- package/components/index.js +13 -0
- package/components/input/Input.d.ts +34 -0
- package/components/input/Input.js +86 -0
- package/components/promise/PromiseSwitch.d.ts +55 -0
- package/components/promise/PromiseSwitch.js +181 -0
- package/components/radio/Radio.d.ts +45 -0
- package/components/radio/Radio.js +123 -0
- package/components/select/Select.d.ts +23 -0
- package/components/select/Select.js +52 -0
- package/components/this/This.d.ts +24 -0
- package/components/this/This.js +62 -0
- package/components/timer/Timer.d.ts +26 -0
- package/components/timer/Timer.js +102 -0
- package/configs/Config.d.ts +34 -0
- package/configs/Config.js +2 -0
- package/configs/TargetAttr.d.ts +7 -0
- package/configs/TargetAttr.js +2 -0
- package/configs/TargetElement.d.ts +16 -0
- package/configs/TargetElement.js +2 -0
- package/css/parse/index.d.ts +49 -0
- package/css/parse/index.js +498 -0
- package/css/stringify/compiler.d.ts +34 -0
- package/css/stringify/compiler.js +36 -0
- package/css/stringify/compress.d.ts +104 -0
- package/css/stringify/compress.js +147 -0
- package/css/stringify/identity.d.ts +109 -0
- package/css/stringify/identity.js +183 -0
- package/css/stringify/index.d.ts +24 -0
- package/css/stringify/index.js +27 -0
- package/css/stringify/types.d.ts +15 -0
- package/css/stringify/types.js +2 -0
- package/css/types.d.ts +10 -0
- package/css/types.js +2 -0
- package/decorators/DomRenderNoProxy.d.ts +4 -0
- package/decorators/DomRenderNoProxy.js +15 -0
- package/events/EventManager.d.ts +68 -0
- package/events/EventManager.js +477 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/iterators/Range.d.ts +24 -0
- package/iterators/Range.js +70 -0
- package/lifecycle/OnBeforeReturnGet.d.ts +4 -0
- package/lifecycle/OnBeforeReturnGet.js +2 -0
- package/lifecycle/OnBeforeReturnSet.d.ts +5 -0
- package/lifecycle/OnBeforeReturnSet.js +4 -0
- package/lifecycle/OnChangeAttrRender.d.ts +9 -0
- package/lifecycle/OnChangeAttrRender.js +4 -0
- package/lifecycle/OnChildRenderedByProperty.d.ts +5 -0
- package/lifecycle/OnChildRenderedByProperty.js +4 -0
- package/lifecycle/OnCreateRender.d.ts +5 -0
- package/lifecycle/OnCreateRender.js +4 -0
- package/lifecycle/OnCreateRenderData.d.ts +10 -0
- package/lifecycle/OnCreateRenderData.js +4 -0
- package/lifecycle/OnCreateRendered.d.ts +8 -0
- package/lifecycle/OnCreateRendered.js +4 -0
- package/lifecycle/OnCreatedThisChild.d.ts +6 -0
- package/lifecycle/OnCreatedThisChild.js +4 -0
- package/lifecycle/OnDestroyRender.d.ts +9 -0
- package/lifecycle/OnDestroyRender.js +4 -0
- package/lifecycle/OnInitRender.d.ts +6 -0
- package/lifecycle/OnInitRender.js +4 -0
- package/lifecycle/OnProxyDomRender.d.ts +5 -0
- package/lifecycle/OnProxyDomRender.js +2 -0
- package/lifecycle/dr-this/OnDrThisBind.d.ts +5 -0
- package/lifecycle/dr-this/OnDrThisBind.js +4 -0
- package/lifecycle/dr-this/OnDrThisUnBind.d.ts +5 -0
- package/lifecycle/dr-this/OnDrThisUnBind.js +4 -0
- package/managers/RenderManager.d.ts +2 -0
- package/managers/RenderManager.js +12 -0
- package/messenger/DefaultMessenger.d.ts +4 -0
- package/messenger/DefaultMessenger.js +4 -0
- package/messenger/Messenger.d.ts +79 -0
- package/messenger/Messenger.js +185 -0
- package/operators/Appender.d.ts +15 -0
- package/operators/Appender.js +90 -0
- package/operators/Dr.d.ts +9 -0
- package/operators/Dr.js +53 -0
- package/operators/DrAppender.d.ts +9 -0
- package/operators/DrAppender.js +69 -0
- package/operators/DrFor.d.ts +9 -0
- package/operators/DrFor.js +58 -0
- package/operators/DrForOf.d.ts +9 -0
- package/operators/DrForOf.js +120 -0
- package/operators/DrForm.d.ts +9 -0
- package/operators/DrForm.js +79 -0
- package/operators/DrIf.d.ts +9 -0
- package/operators/DrIf.js +70 -0
- package/operators/DrInnerHTML.d.ts +9 -0
- package/operators/DrInnerHTML.js +48 -0
- package/operators/DrInnerText.d.ts +9 -0
- package/operators/DrInnerText.js +46 -0
- package/operators/DrPre.d.ts +8 -0
- package/operators/DrPre.js +22 -0
- package/operators/DrRepeat.d.ts +9 -0
- package/operators/DrRepeat.js +70 -0
- package/operators/DrStripElement.d.ts +9 -0
- package/operators/DrStripElement.js +50 -0
- package/operators/DrTargetAttr.d.ts +8 -0
- package/operators/DrTargetAttr.js +45 -0
- package/operators/DrTargetElement.d.ts +13 -0
- package/operators/DrTargetElement.js +91 -0
- package/operators/DrTargetElementIsElement.d.ts +13 -0
- package/operators/DrTargetElementIsElement.js +79 -0
- package/operators/DrThis.d.ts +7 -0
- package/operators/DrThis.js +72 -0
- package/operators/DrThisProperty.d.ts +11 -0
- package/operators/DrThisProperty.js +93 -0
- package/operators/OperatorExecuter.d.ts +50 -0
- package/operators/OperatorExecuter.js +50 -0
- package/operators/OperatorExecuterAttrRequire.d.ts +9 -0
- package/operators/OperatorExecuterAttrRequire.js +25 -0
- package/package.json +70 -0
- package/rawsets/AttrInitCallBack.d.ts +6 -0
- package/rawsets/AttrInitCallBack.js +2 -0
- package/rawsets/Attrs.d.ts +27 -0
- package/rawsets/Attrs.js +2 -0
- package/rawsets/CreatorMetaData.d.ts +20 -0
- package/rawsets/CreatorMetaData.js +2 -0
- package/rawsets/DestroyOptionType.d.ts +5 -0
- package/rawsets/DestroyOptionType.js +6 -0
- package/rawsets/ElementInitCallBack.d.ts +9 -0
- package/rawsets/ElementInitCallBack.js +2 -0
- package/rawsets/RawSet.d.ts +180 -0
- package/rawsets/RawSet.js +1450 -0
- package/rawsets/RawSetOperatorType.d.ts +4 -0
- package/rawsets/RawSetOperatorType.js +5 -0
- package/rawsets/RawSetType.d.ts +8 -0
- package/rawsets/RawSetType.js +9 -0
- package/rawsets/Render.d.ts +27 -0
- package/rawsets/Render.js +2 -0
- package/routers/HashRouter.d.ts +24 -0
- package/routers/HashRouter.js +86 -0
- package/routers/PathRouter.d.ts +23 -0
- package/routers/PathRouter.js +73 -0
- package/routers/Router.d.ts +68 -0
- package/routers/Router.js +132 -0
- package/types/Types.d.ts +12 -0
- package/types/Types.js +26 -0
- package/validators/AllCheckedValidatorArray.d.ts +7 -0
- package/validators/AllCheckedValidatorArray.js +11 -0
- package/validators/AllUnCheckedValidatorArray.d.ts +7 -0
- package/validators/AllUnCheckedValidatorArray.js +11 -0
- package/validators/CheckedValidator.d.ts +6 -0
- package/validators/CheckedValidator.js +11 -0
- package/validators/CountEqualsCheckedValidatorArray.d.ts +8 -0
- package/validators/CountEqualsCheckedValidatorArray.js +12 -0
- package/validators/CountEqualsUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountEqualsUnCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanUnCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanEqualsCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanEqualsCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanUnCheckedValidatorArray.js +12 -0
- package/validators/CountUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountUnCheckedValidatorArray.js +12 -0
- package/validators/EmptyValidator.d.ts +6 -0
- package/validators/EmptyValidator.js +12 -0
- package/validators/ExcludeCheckedValidatorArray.d.ts +9 -0
- package/validators/ExcludeCheckedValidatorArray.js +17 -0
- package/validators/FormValidator.d.ts +8 -0
- package/validators/FormValidator.js +16 -0
- package/validators/IncludeCheckedValidatorArray.d.ts +9 -0
- package/validators/IncludeCheckedValidatorArray.js +17 -0
- package/validators/MultipleValidator.d.ts +9 -0
- package/validators/MultipleValidator.js +25 -0
- package/validators/NonPassValidator.d.ts +6 -0
- package/validators/NonPassValidator.js +10 -0
- package/validators/NotEmptyValidator.d.ts +6 -0
- package/validators/NotEmptyValidator.js +13 -0
- package/validators/NotRegExpTestValidator.d.ts +7 -0
- package/validators/NotRegExpTestValidator.js +20 -0
- package/validators/PassValidator.d.ts +6 -0
- package/validators/PassValidator.js +10 -0
- package/validators/RegExpTestValidator.d.ts +7 -0
- package/validators/RegExpTestValidator.js +21 -0
- package/validators/RequiredValidator.d.ts +6 -0
- package/validators/RequiredValidator.js +12 -0
- package/validators/UnCheckedValidator.d.ts +6 -0
- package/validators/UnCheckedValidator.js +11 -0
- package/validators/ValidMultipleValidator.d.ts +10 -0
- package/validators/ValidMultipleValidator.js +12 -0
- package/validators/ValidValidator.d.ts +7 -0
- package/validators/ValidValidator.js +11 -0
- package/validators/ValidValidatorArray.d.ts +8 -0
- package/validators/ValidValidatorArray.js +11 -0
- package/validators/Validator.d.ts +58 -0
- package/validators/Validator.js +203 -0
- package/validators/ValidatorArray.d.ts +18 -0
- package/validators/ValidatorArray.js +77 -0
- package/validators/ValueEqualsValidator.d.ts +7 -0
- package/validators/ValueEqualsValidator.js +11 -0
- package/validators/ValueNotEqualsValidator.d.ts +7 -0
- package/validators/ValueNotEqualsValidator.js +11 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OnCreateRenderDataParams } from '../lifecycle/OnCreateRenderData';
|
|
2
|
+
export interface OnCreatedThisChild {
|
|
3
|
+
onCreatedThisChild(child: any, childData: OnCreateRenderDataParams): void;
|
|
4
|
+
}
|
|
5
|
+
export declare const isOnCreatedThisChild: (obj: any) => obj is OnCreatedThisChild;
|
|
6
|
+
//# sourceMappingURL=OnCreatedThisChild.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
2
|
+
export type OnDestroyRenderParams = {
|
|
3
|
+
rawSet: RawSet;
|
|
4
|
+
};
|
|
5
|
+
export interface OnDestroyRender {
|
|
6
|
+
onDestroyRender(data: OnDestroyRenderParams): void;
|
|
7
|
+
}
|
|
8
|
+
export declare const isOnDestroyRender: (obj: any) => obj is OnDestroyRender;
|
|
9
|
+
//# sourceMappingURL=OnDestroyRender.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
// export class RenderManager {
|
|
3
|
+
// static render(obj: any, target = Object.keys(obj)) {
|
|
4
|
+
// const domRenderProxy = obj._DomRender_proxy as DomRenderProxy<any>;
|
|
5
|
+
// if (domRenderProxy) {
|
|
6
|
+
// target.forEach(it => {
|
|
7
|
+
// domRenderProxy.root([it], obj[it]);
|
|
8
|
+
// })
|
|
9
|
+
// }
|
|
10
|
+
// }
|
|
11
|
+
// }
|
|
12
|
+
//# sourceMappingURL=RenderManager.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ConstructorType } from '@dooboostore/core/types';
|
|
2
|
+
import { Config } from '../configs/Config';
|
|
3
|
+
declare enum CallBackType {
|
|
4
|
+
FILTER = 0,
|
|
5
|
+
MAP = 1,
|
|
6
|
+
SUBSCRIBE = 2
|
|
7
|
+
}
|
|
8
|
+
export type ChannelData = {
|
|
9
|
+
channel: Channel;
|
|
10
|
+
data?: (any | undefined);
|
|
11
|
+
};
|
|
12
|
+
export 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
|
+
type MessengerEventDetail = {
|
|
51
|
+
key: string | object | ConstructorType<any>;
|
|
52
|
+
data?: any;
|
|
53
|
+
action?: string;
|
|
54
|
+
result?: (c: ChannelData[]) => void;
|
|
55
|
+
};
|
|
56
|
+
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 {};
|
|
79
|
+
//# sourceMappingURL=Messenger.d.ts.map
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { DomRenderFinalProxy } from '../types/Types';
|
|
2
|
+
var CallBackType;
|
|
3
|
+
(function (CallBackType) {
|
|
4
|
+
CallBackType[CallBackType["FILTER"] = 0] = "FILTER";
|
|
5
|
+
CallBackType[CallBackType["MAP"] = 1] = "MAP";
|
|
6
|
+
CallBackType[CallBackType["SUBSCRIBE"] = 2] = "SUBSCRIBE";
|
|
7
|
+
})(CallBackType || (CallBackType = {}));
|
|
8
|
+
export class ChannelSubscription {
|
|
9
|
+
constructor(channel, subscriber) {
|
|
10
|
+
this.channel = channel;
|
|
11
|
+
this.subscriber = subscriber;
|
|
12
|
+
}
|
|
13
|
+
unsubscribe() {
|
|
14
|
+
this.subscriber.unsubscribe();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class ChannelSubscriber {
|
|
18
|
+
constructor(channel) {
|
|
19
|
+
this.channel = channel;
|
|
20
|
+
this.callbacks = [];
|
|
21
|
+
}
|
|
22
|
+
exeCallback(data, metaData) {
|
|
23
|
+
for (const callback of this.callbacks) {
|
|
24
|
+
if (callback.type === CallBackType.FILTER && !callback.callback(data, metaData)) {
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
else if (callback.type === CallBackType.MAP) {
|
|
28
|
+
data = callback.callback(data, metaData);
|
|
29
|
+
}
|
|
30
|
+
else if (callback.type === CallBackType.SUBSCRIBE) {
|
|
31
|
+
data = callback.callback(data, metaData);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
// chaining point
|
|
38
|
+
filter(callback) {
|
|
39
|
+
this.callbacks.push({ type: CallBackType.FILTER, callback });
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
map(callback) {
|
|
43
|
+
this.callbacks.push({ type: CallBackType.MAP, callback });
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
subscribe(callback) {
|
|
47
|
+
this.callbacks.push({ type: CallBackType.SUBSCRIBE, callback });
|
|
48
|
+
this.channel.subscribers.add(this);
|
|
49
|
+
return new ChannelSubscription(this.channel, this);
|
|
50
|
+
}
|
|
51
|
+
unsubscribe() {
|
|
52
|
+
this.channel.subscribers.delete(this);
|
|
53
|
+
}
|
|
54
|
+
deleteSubscriber() {
|
|
55
|
+
this.unsubscribe();
|
|
56
|
+
this.channel.subscribers.delete(this);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export class Channel {
|
|
60
|
+
constructor(messenger, obj, key) {
|
|
61
|
+
this.messenger = messenger;
|
|
62
|
+
this.obj = obj;
|
|
63
|
+
this.key = key;
|
|
64
|
+
this.subscribers = new Set();
|
|
65
|
+
}
|
|
66
|
+
publish(key, data, action) {
|
|
67
|
+
var _a;
|
|
68
|
+
const rtns = [];
|
|
69
|
+
(_a = this.messenger.getChannels(key)) === null || _a === void 0 ? void 0 : _a.forEach(it => {
|
|
70
|
+
try {
|
|
71
|
+
it.subscribers.forEach(its => {
|
|
72
|
+
const rdata = its.exeCallback(data, { channel: this, action });
|
|
73
|
+
rtns.push({ channel: it, data: rdata });
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
console.error(e);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return rtns;
|
|
81
|
+
}
|
|
82
|
+
allPublish(data, action) {
|
|
83
|
+
const rtns = [];
|
|
84
|
+
this.messenger.getAllChannelKeys().forEach(it => {
|
|
85
|
+
rtns.push(this.publish(it, data));
|
|
86
|
+
});
|
|
87
|
+
return rtns.flat();
|
|
88
|
+
}
|
|
89
|
+
// string point
|
|
90
|
+
filter(filterF) {
|
|
91
|
+
const subscriber = new ChannelSubscriber(this);
|
|
92
|
+
subscriber.filter(filterF);
|
|
93
|
+
return subscriber;
|
|
94
|
+
}
|
|
95
|
+
map(filterF) {
|
|
96
|
+
const subscriber = new ChannelSubscriber(this);
|
|
97
|
+
subscriber.map(filterF);
|
|
98
|
+
return subscriber;
|
|
99
|
+
}
|
|
100
|
+
subscribe(subscribeCallback) {
|
|
101
|
+
const subscriber = new ChannelSubscriber(this);
|
|
102
|
+
return subscriber.subscribe(subscribeCallback);
|
|
103
|
+
}
|
|
104
|
+
;
|
|
105
|
+
deleteChannel() {
|
|
106
|
+
this.messenger.deleteChannel(this);
|
|
107
|
+
}
|
|
108
|
+
;
|
|
109
|
+
}
|
|
110
|
+
export class Messenger {
|
|
111
|
+
constructor(config) {
|
|
112
|
+
this.config = config;
|
|
113
|
+
this.channels = new Set();
|
|
114
|
+
this.config.window.addEventListener(Messenger.EVENT_PUBLISH_KEY, (e) => {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
const detail = e.detail;
|
|
117
|
+
// console.log('--->', detail)
|
|
118
|
+
const rtns = [];
|
|
119
|
+
(_a = this.getChannels(detail.key)) === null || _a === void 0 ? void 0 : _a.forEach(it => {
|
|
120
|
+
try {
|
|
121
|
+
it.subscribers.forEach(its => {
|
|
122
|
+
const rdata = its.exeCallback(detail.data, { action: detail.action });
|
|
123
|
+
rtns.push({ channel: it, data: rdata });
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
console.error(e);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
(_b = detail.result) === null || _b === void 0 ? void 0 : _b.call(detail, rtns);
|
|
131
|
+
});
|
|
132
|
+
this.config.window.addEventListener(Messenger.EVENT_SUBSCRIBE_KEY, (e) => {
|
|
133
|
+
const detail = e.detail;
|
|
134
|
+
// console.log('--->', detail)
|
|
135
|
+
const channel = this.createChannel(detail.obj, detail.key);
|
|
136
|
+
detail.init(channel, channel.subscribe(detail.subscribe));
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
static publish(window, detail) {
|
|
140
|
+
window.dispatchEvent(new CustomEvent(Messenger.EVENT_PUBLISH_KEY, { detail }));
|
|
141
|
+
}
|
|
142
|
+
static subscribe(window, detail) {
|
|
143
|
+
window.dispatchEvent(new CustomEvent(Messenger.EVENT_SUBSCRIBE_KEY, { detail }));
|
|
144
|
+
}
|
|
145
|
+
createChannel(obj, key = obj.constructor.name) {
|
|
146
|
+
const channel = DomRenderFinalProxy.final(new Channel(this, obj, key));
|
|
147
|
+
this.channels.add(channel);
|
|
148
|
+
// this.channels.get(key) ? this.channels.get(key)!.push(channel) : this.channels.set(key, [channel]);
|
|
149
|
+
return channel;
|
|
150
|
+
}
|
|
151
|
+
deleteChannel(channel) {
|
|
152
|
+
this.channels.delete(channel);
|
|
153
|
+
}
|
|
154
|
+
deleteChannelFromObj(obj) {
|
|
155
|
+
if (obj) {
|
|
156
|
+
this.channels.forEach(it => {
|
|
157
|
+
if (it.obj === obj) {
|
|
158
|
+
// console.log('dddddddddddd', obj)
|
|
159
|
+
this.deleteChannel(it);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
addChannel(channel) {
|
|
165
|
+
this.channels.add(channel);
|
|
166
|
+
}
|
|
167
|
+
getChannels(key) {
|
|
168
|
+
if (typeof key === 'object') {
|
|
169
|
+
key = key.constructor.name;
|
|
170
|
+
}
|
|
171
|
+
else if (typeof key === 'function') {
|
|
172
|
+
key = key.name;
|
|
173
|
+
}
|
|
174
|
+
return Array.from(this.channels.values()).filter(it => it.key === key);
|
|
175
|
+
}
|
|
176
|
+
getAllChannels() {
|
|
177
|
+
return Array.from(this.channels.values());
|
|
178
|
+
}
|
|
179
|
+
getAllChannelKeys() {
|
|
180
|
+
return Array.from(this.channels.values()).map(it => it.key);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
Messenger.EVENT_PUBLISH_KEY = 'domRenderMessenger_publish';
|
|
184
|
+
Messenger.EVENT_SUBSCRIBE_KEY = 'domRenderMessenger_subscribe';
|
|
185
|
+
//# sourceMappingURL=Messenger.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class Appender<T = any> implements Iterable<T> {
|
|
2
|
+
[key: number]: T[] | undefined;
|
|
3
|
+
length: number;
|
|
4
|
+
keyMap: Map<string, number>;
|
|
5
|
+
isAppender: boolean;
|
|
6
|
+
constructor(...defaultDatas: T[]);
|
|
7
|
+
[Symbol.iterator](): Iterator<T>;
|
|
8
|
+
set(key: string, ...v: T[]): void;
|
|
9
|
+
delete(key: string): void;
|
|
10
|
+
getAll(): T[];
|
|
11
|
+
getAlls(): T[][];
|
|
12
|
+
push(...items: T[]): void;
|
|
13
|
+
clear(): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=Appender.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export class Appender {
|
|
2
|
+
constructor(...defaultDatas) {
|
|
3
|
+
this.length = 0;
|
|
4
|
+
this.keyMap = new Map();
|
|
5
|
+
this.isAppender = true;
|
|
6
|
+
// console.log('defaultDatas', defaultDatas);
|
|
7
|
+
this.push(...defaultDatas);
|
|
8
|
+
// (this.childs as any).isAppender = true;
|
|
9
|
+
}
|
|
10
|
+
[Symbol.iterator]() {
|
|
11
|
+
const items = this.getAll();
|
|
12
|
+
let idx = 0;
|
|
13
|
+
return {
|
|
14
|
+
next(value) {
|
|
15
|
+
let r = { value: undefined, done: true };
|
|
16
|
+
if (items.length > idx) {
|
|
17
|
+
r = { value: items[idx], done: false };
|
|
18
|
+
}
|
|
19
|
+
idx++;
|
|
20
|
+
return r;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
set(key, ...v) {
|
|
25
|
+
const o = this.keyMap.get(key);
|
|
26
|
+
// console.log('set!!', o);
|
|
27
|
+
if (o !== undefined) {
|
|
28
|
+
this[o] = v;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.keyMap.set(key, this.length);
|
|
32
|
+
// console.log('setPush', v)
|
|
33
|
+
this.push(...v);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
delete(key) {
|
|
37
|
+
const o = this.keyMap.get(key);
|
|
38
|
+
if (o !== undefined) {
|
|
39
|
+
this[o] = [];
|
|
40
|
+
this.keyMap.delete(key);
|
|
41
|
+
// this.length--;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
getAll() {
|
|
45
|
+
return this.getAlls().flat();
|
|
46
|
+
}
|
|
47
|
+
getAlls() {
|
|
48
|
+
const map = Array.from({ length: this.length }).filter((it, idx) => this[idx]).map((it, idx) => this[idx]);
|
|
49
|
+
return map;
|
|
50
|
+
}
|
|
51
|
+
push(...items) {
|
|
52
|
+
// console.log('----1>', items, items.length, this.length);
|
|
53
|
+
if (items && items.length > 0) {
|
|
54
|
+
items.index = this.length;
|
|
55
|
+
this[this.length++] = items;
|
|
56
|
+
// this[this.length] = [];
|
|
57
|
+
}
|
|
58
|
+
// console.log('----2>', items, items.length, this.length);
|
|
59
|
+
// console.log('---22->', this.length)
|
|
60
|
+
// const appender = this.childs[this.lastIndex];
|
|
61
|
+
// appender.values = items;
|
|
62
|
+
// this.childs.push(new Appender(appender.index + 1));
|
|
63
|
+
}
|
|
64
|
+
// delete(idx: number): void {
|
|
65
|
+
// // if (idx in this) {
|
|
66
|
+
// // console.log('---------dele',idx)
|
|
67
|
+
// // delete this[idx];
|
|
68
|
+
// // this.length = this.length - 1;
|
|
69
|
+
// // }
|
|
70
|
+
// this.length = this.length - 1;
|
|
71
|
+
// }
|
|
72
|
+
// 인덱스 접근을 위한 getter와 setter 추가
|
|
73
|
+
// get(index: number): T | undefined {
|
|
74
|
+
// return this.storage[index];
|
|
75
|
+
// }
|
|
76
|
+
//
|
|
77
|
+
// set(index: number, value: T): void {
|
|
78
|
+
// this.storage[index] = value;
|
|
79
|
+
// this.length = Math.max(this.length, index + 1);
|
|
80
|
+
// }
|
|
81
|
+
clear() {
|
|
82
|
+
// console.log('length', this.length);
|
|
83
|
+
for (let i = 0; i < this.length; i++) {
|
|
84
|
+
delete this[i];
|
|
85
|
+
}
|
|
86
|
+
this.keyMap.clear();
|
|
87
|
+
this.length = 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=Appender.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}
|
|
9
|
+
//# sourceMappingURL=Dr.d.ts.map
|
package/operators/Dr.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { OperatorExecuterAttrRequire } from './OperatorExecuterAttrRequire';
|
|
11
|
+
import { ScriptUtils } from '@dooboostore/core-web/script/ScriptUtils';
|
|
12
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
13
|
+
import { ExecuteState } from './OperatorExecuter';
|
|
14
|
+
export class Dr extends OperatorExecuterAttrRequire {
|
|
15
|
+
constructor(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
|
16
|
+
super(rawSet, render, returnContainer, elementSource, source, afterCallBack);
|
|
17
|
+
}
|
|
18
|
+
executeAttrRequire(data) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
|
22
|
+
const vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
|
23
|
+
const newTemp = this.source.config.window.document.createElement('temp');
|
|
24
|
+
ScriptUtils.eval(`
|
|
25
|
+
${this.render.bindScript}
|
|
26
|
+
const n = $element.cloneNode(true);
|
|
27
|
+
var destIt = ${this.elementSource.attrs.drItOption};
|
|
28
|
+
if (destIt !== undefined) {
|
|
29
|
+
n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt)))
|
|
30
|
+
// console.log('----', n.innerHTML);
|
|
31
|
+
n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);
|
|
32
|
+
// console.log('----', n.innerHTML);
|
|
33
|
+
}
|
|
34
|
+
if (this.__render.drStripOption === 'true') {
|
|
35
|
+
Array.from(n.childNodes).forEach(it => this.__fag.append(it));
|
|
36
|
+
} else {
|
|
37
|
+
this.__render.fag.append(n);
|
|
38
|
+
}`, Object.assign(this.source.obj, {
|
|
39
|
+
__render: Object.freeze(Object.assign({ fag: newTemp, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
|
40
|
+
}));
|
|
41
|
+
RawSet.drVarDecoding(newTemp, vars);
|
|
42
|
+
RawSet.drItOtherDecoding(newTemp, itRandom);
|
|
43
|
+
const tempalte = this.source.config.window.document.createElement('template');
|
|
44
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
|
45
|
+
this.returnContainer.fag.append(tempalte.content);
|
|
46
|
+
const rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
|
47
|
+
(_b = this.elementSource.element.parentNode) === null || _b === void 0 ? void 0 : _b.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
|
48
|
+
this.returnContainer.raws.push(...rr);
|
|
49
|
+
return ExecuteState.EXECUTE;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=Dr.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
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 DrAppender extends OperatorExecuterAttrRequire<string> {
|
|
6
|
+
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
|
7
|
+
executeAttrRequire(attr: string): Promise<ExecuteState>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=DrAppender.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { OperatorExecuterAttrRequire } from './OperatorExecuterAttrRequire';
|
|
11
|
+
import { ScriptUtils } from '@dooboostore/core-web/script/ScriptUtils';
|
|
12
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
13
|
+
import { ExecuteState } from './OperatorExecuter';
|
|
14
|
+
export class DrAppender extends OperatorExecuterAttrRequire {
|
|
15
|
+
constructor(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
|
16
|
+
source.operatorAround = undefined;
|
|
17
|
+
super(rawSet, render, returnContainer, elementSource, source, afterCallBack, false);
|
|
18
|
+
}
|
|
19
|
+
executeAttrRequire(attr) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
var _a, _b, _c, _d;
|
|
22
|
+
const itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
|
23
|
+
const vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
|
24
|
+
const newTemp = this.source.config.window.document.createElement('temp');
|
|
25
|
+
ScriptUtils.eval(`
|
|
26
|
+
try{
|
|
27
|
+
${this.render.bindScript}
|
|
28
|
+
${(_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : ''}
|
|
29
|
+
const ifWrap = document.createElement('div');
|
|
30
|
+
// ifWrap.setAttribute('${RawSet.DR_STRIP_OPTIONNAME}', 'true');
|
|
31
|
+
// ifWrap.setAttribute('${RawSet.DR_IF_NAME}', '${this.elementSource.attrs.drAppender} && ${this.elementSource.attrs.drAppender}.length > 0');
|
|
32
|
+
const n = this.__render.element.cloneNode(true);
|
|
33
|
+
Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drAppender' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v));
|
|
34
|
+
const length = ${this.elementSource.attrs.drAppender}.length;
|
|
35
|
+
if (length > 0) {
|
|
36
|
+
n.setAttribute('${RawSet.DR_FOR_OF_NAME}', '${this.elementSource.attrs.drAppender}[' + (length-1) + ']');
|
|
37
|
+
n.setAttribute('${RawSet.DR_NEXT_OPTIONNAME}', '${this.elementSource.attrs.drAppender},' + length);
|
|
38
|
+
} else {
|
|
39
|
+
n.setAttribute('${RawSet.DR_FOR_OF_NAME}', '${this.elementSource.attrs.drAppender}[0]');
|
|
40
|
+
n.setAttribute('${RawSet.DR_NEXT_OPTIONNAME}', '${this.elementSource.attrs.drAppender},' + 1);
|
|
41
|
+
}
|
|
42
|
+
// console.log('appender--->', Array.from(n.getAttributeNames()).map(it=>({name:it,attr: n.getAttribute(it)})));
|
|
43
|
+
// const drOptionThis = n.getAttribute('${RawSet.DR_THIS_OPTIONNAME}');
|
|
44
|
+
// if (drOptionThis) {
|
|
45
|
+
// }
|
|
46
|
+
// ifWrap.append(n);
|
|
47
|
+
// this.__render.fag.append(ifWrap);
|
|
48
|
+
this.__render.fag.append(n);
|
|
49
|
+
${(_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : ''}
|
|
50
|
+
}catch(e){}
|
|
51
|
+
`, Object.assign(this.source.obj, {
|
|
52
|
+
__render: Object.freeze(Object.assign({ drStripOption: this.elementSource.attrs.drStripOption, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet.drAttrsOriginName, fag: newTemp }, this.render
|
|
53
|
+
// eslint-disable-next-line no-use-before-define
|
|
54
|
+
))
|
|
55
|
+
}));
|
|
56
|
+
RawSet.drVarDecoding(newTemp, vars);
|
|
57
|
+
RawSet.drItOtherDecoding(newTemp, itRandom);
|
|
58
|
+
const tempalte = this.source.config.window.document.createElement('template');
|
|
59
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
|
60
|
+
this.returnContainer.fag.append(tempalte.content);
|
|
61
|
+
const rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
|
62
|
+
(_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
|
63
|
+
// const rrr = rr.flatMap(it => it.render(obj, config));// .flat();
|
|
64
|
+
this.returnContainer.raws.push(...rr);
|
|
65
|
+
return ExecuteState.EXECUTE;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=DrAppender.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
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 DrFor extends OperatorExecuterAttrRequire<string> {
|
|
6
|
+
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
|
7
|
+
executeAttrRequire(attr: string): Promise<ExecuteState>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=DrFor.d.ts.map
|