dom-render 1.0.92 → 1.0.93

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.
Files changed (40) hide show
  1. package/DomRenderProxy.js +7 -7
  2. package/components/ComponentSet.d.ts +1 -1
  3. package/configs/Config.d.ts +4 -1
  4. package/configs/TargetAttr.d.ts +1 -1
  5. package/configs/TargetElement.d.ts +1 -1
  6. package/dist/bundle.js +224 -293
  7. package/events/EventManager.d.ts +1 -0
  8. package/events/EventManager.js +42 -54
  9. package/messenger/Messenger.d.ts +4 -4
  10. package/operators/Dr.js +1 -1
  11. package/operators/DrAppender.js +2 -4
  12. package/operators/DrFor.js +2 -4
  13. package/operators/DrForOf.js +2 -4
  14. package/operators/DrForm.js +1 -1
  15. package/operators/DrIf.js +2 -4
  16. package/operators/DrInnerHTML.js +1 -1
  17. package/operators/DrInnerText.js +1 -1
  18. package/operators/DrPre.js +2 -4
  19. package/operators/DrRepeat.js +2 -4
  20. package/operators/DrTargetAttr.js +2 -4
  21. package/operators/DrTargetElement.js +2 -4
  22. package/operators/DrThis.js +1 -1
  23. package/operators/OperatorExecuter.d.ts +5 -5
  24. package/operators/OperatorExecuter.js +1 -1
  25. package/operators/OperatorExecuterAttrRequire.js +1 -1
  26. package/package.json +1 -1
  27. package/rawsets/AttrInitCallBack.d.ts +1 -1
  28. package/rawsets/Attrs.d.ts +1 -1
  29. package/rawsets/CreatorMetaData.d.ts +1 -1
  30. package/rawsets/ElementInitCallBack.d.ts +1 -1
  31. package/rawsets/RawSet.js +1 -1
  32. package/rawsets/Render.d.ts +1 -1
  33. package/routers/Router.d.ts +1 -1
  34. package/utils/dom/DomUtils.d.ts +1 -1
  35. package/utils/node/NodeUtils.d.ts +1 -1
  36. package/validators/EmptyValidator.js +2 -2
  37. package/validators/NotEmptyValidator.js +2 -2
  38. package/validators/ValidMultipleValidator.d.ts +1 -1
  39. package/validators/Validator.d.ts +2 -2
  40. package/validators/ValidatorArray.d.ts +1 -1
@@ -44,5 +44,6 @@ export declare class EventManager {
44
44
  } | undefined, obj: any): {
45
45
  [p: string]: any;
46
46
  } | undefined;
47
+ getBindScript(config?: Config): string;
47
48
  }
48
49
  export declare const eventManager: EventManager;
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.eventManager = exports.EventManager = void 0;
4
15
  var ScriptUtils_1 = require("../utils/script/ScriptUtils");
@@ -46,7 +57,8 @@ var EventManager = /** @class */ (function () {
46
57
  element: it,
47
58
  event: event,
48
59
  range: Range_1.Range.range,
49
- scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj)
60
+ scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj),
61
+ // ...EventManager.eventVariables
50
62
  })
51
63
  }));
52
64
  }
@@ -133,7 +145,7 @@ var EventManager = /** @class */ (function () {
133
145
  if (typeof getValue === 'function' && getValue) {
134
146
  var setValue = it.value;
135
147
  if (mapScript_1) {
136
- setValue = ScriptUtils_1.ScriptUtils.eval("".concat(_this.bindScript, " return ").concat(mapScript_1), Object.assign(bindObj_1, { __render: Object.freeze({ element: it, target: bindObj_1, range: Range_1.Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }) }));
148
+ setValue = ScriptUtils_1.ScriptUtils.eval("".concat(_this.getBindScript(config), " return ").concat(mapScript_1), Object.assign(bindObj_1, { __render: Object.freeze(__assign({ element: it, target: bindObj_1, range: Range_1.Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables)) }));
137
149
  }
138
150
  getValue(setValue);
139
151
  // 여기서 value가 먼저냐 value-link가 먼저냐 선을 정해야되는거네...
@@ -141,36 +153,15 @@ var EventManager = /** @class */ (function () {
141
153
  else if (getValue) {
142
154
  var setValue = getValue;
143
155
  if (mapScript_1) {
144
- setValue = ScriptUtils_1.ScriptUtils.eval("".concat(_this.bindScript, " return ").concat(mapScript_1), Object.assign(bindObj_1, { __render: Object.freeze({ element: it, target: bindObj_1, range: Range_1.Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }) }));
156
+ setValue = ScriptUtils_1.ScriptUtils.eval("".concat(_this.getBindScript(config), " return ").concat(mapScript_1), Object.assign(bindObj_1, { __render: Object.freeze(__assign({ element: it, target: bindObj_1, range: Range_1.Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables)) }));
145
157
  }
146
158
  it.value = setValue;
147
- // this.setValue(obj, varName, setValue)
148
159
  }
149
- // } else if (getValue) { // 이구분이 있어야되나?? 없어도될것같은데..
150
- // let setValue = getValue;
151
- // if (inMapScript) {
152
- // setValue = ScriptUtils.eval(`${this.bindScript} return ${inMapScript}`, Object.assign(bindObj, {__render: Object.freeze({element: it, target: bindObj, range: Range.range, value: setValue, scripts: EventManager.setBindProperty(config?.scripts, obj)})}));
153
- // }
154
- // this.setValue(obj, varName, setValue)
155
- // } else {
156
- // let setValue = it.value;
157
- // if (mapScript) {
158
- // setValue = ScriptUtils.eval(`${this.bindScript} return ${mapScript}`, Object.assign(bindObj, {__render: Object.freeze({element: it, target: bindObj, range: Range.range, value: setValue, scripts: EventManager.setBindProperty(config?.scripts, obj)})}));
159
- // }
160
- // this.setValue(obj, varName, setValue)
161
- // }
162
160
  it.addEventListener('input', function (event) {
163
161
  var value = it.value;
164
162
  if (mapScript_1) {
165
- value = ScriptUtils_1.ScriptUtils.eval("".concat(_this.bindScript, " return ").concat(mapScript_1), Object.assign(bindObj_1, {
166
- __render: Object.freeze({
167
- event: event,
168
- element: it,
169
- attribute: DomUtils_1.DomUtils.getAttributeToObject(it),
170
- target: event.target,
171
- range: Range_1.Range.range,
172
- scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj)
173
- })
163
+ value = ScriptUtils_1.ScriptUtils.eval("".concat(_this.getBindScript(config), " return ").concat(mapScript_1), Object.assign(bindObj_1, {
164
+ __render: Object.freeze(__assign({ event: event, element: it, attribute: DomUtils_1.DomUtils.getAttributeToObject(it), target: event.target, range: Range_1.Range.range, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables))
174
165
  }));
175
166
  }
176
167
  if (typeof _this.getValue(obj, varName, bindObj_1) === 'function') {
@@ -189,11 +180,8 @@ var EventManager = /** @class */ (function () {
189
180
  script = 'return ' + script;
190
181
  }
191
182
  if (script) {
192
- ScriptUtils_1.ScriptUtils.eval("".concat(_this.bindScript, "; ").concat(script, " "), Object.assign(obj, {
193
- __render: Object.freeze({
194
- element: it,
195
- attribute: DomUtils_1.DomUtils.getAttributeToObject(it)
196
- })
183
+ ScriptUtils_1.ScriptUtils.eval("".concat(_this.getBindScript(config), "; ").concat(script, " "), Object.assign(obj, {
184
+ __render: Object.freeze(__assign({ element: it, attribute: DomUtils_1.DomUtils.getAttributeToObject(it) }, config === null || config === void 0 ? void 0 : config.eventVariables))
197
185
  }));
198
186
  // console.log('onInit--->', obj, varName, it)
199
187
  // if (typeof this.getValue(obj, varName) === 'function') {
@@ -228,14 +216,14 @@ var EventManager = /** @class */ (function () {
228
216
  if (typeof getValue === 'function' && getValue) {
229
217
  var setValue = it.value;
230
218
  if (mapScript) {
231
- setValue = ScriptUtils_1.ScriptUtils.eval("".concat(_this.bindScript, " return ").concat(mapScript), Object.assign(bindObj, { __render: Object.freeze({ element: it, target: bindObj, range: Range_1.Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }) }));
219
+ setValue = ScriptUtils_1.ScriptUtils.eval("".concat(_this.getBindScript(config), " return ").concat(mapScript), Object.assign(bindObj, { __render: Object.freeze(__assign({ element: it, target: bindObj, range: Range_1.Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables)) }));
232
220
  }
233
221
  getValue(setValue);
234
222
  }
235
223
  else { // if (getValue !== undefined && getValue !== null)
236
224
  var setValue = getValue;
237
225
  if (mapScript) {
238
- setValue = ScriptUtils_1.ScriptUtils.eval("".concat(_this.bindScript, " return ").concat(mapScript), Object.assign(bindObj, { __render: Object.freeze({ element: it, target: bindObj, range: Range_1.Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }) }));
226
+ setValue = ScriptUtils_1.ScriptUtils.eval("".concat(_this.getBindScript(config), " return ").concat(mapScript), Object.assign(bindObj, { __render: Object.freeze(__assign({ element: it, target: bindObj, range: Range_1.Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables)) }));
239
227
  }
240
228
  it.value = setValue;
241
229
  }
@@ -386,21 +374,13 @@ var EventManager = /** @class */ (function () {
386
374
  var filter = true;
387
375
  var filterScript = it.getAttribute("".concat(attr, ":filter"));
388
376
  var thisTarget = Object.assign(obj, {
389
- __render: Object.freeze({
390
- event: event,
391
- element: it,
392
- target: event.target,
393
- range: Range_1.Range.range,
394
- attribute: DomUtils_1.DomUtils.getAttributeToObject(it),
395
- router: config === null || config === void 0 ? void 0 : config.router,
396
- scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj)
397
- })
377
+ __render: Object.freeze(__assign({ event: event, element: it, target: event.target, range: Range_1.Range.range, attribute: DomUtils_1.DomUtils.getAttributeToObject(it), router: config === null || config === void 0 ? void 0 : config.router, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables))
398
378
  });
399
379
  if (filterScript) {
400
- filter = ScriptUtils_1.ScriptUtils.eval("".concat(_this.bindScript, " return ").concat(filterScript), thisTarget);
380
+ filter = ScriptUtils_1.ScriptUtils.eval("".concat(_this.getBindScript(config), " return ").concat(filterScript), thisTarget);
401
381
  }
402
382
  if (filter) {
403
- ScriptUtils_1.ScriptUtils.eval("".concat(_this.bindScript, " ").concat(script, " "), thisTarget);
383
+ ScriptUtils_1.ScriptUtils.eval("".concat(_this.getBindScript(config), " ").concat(script, " "), thisTarget);
404
384
  }
405
385
  });
406
386
  });
@@ -423,16 +403,8 @@ var EventManager = /** @class */ (function () {
423
403
  });
424
404
  bind.split(',').forEach(function (eventName) {
425
405
  it.addEventListener(eventName.trim(), function (event) {
426
- ScriptUtils_1.ScriptUtils.eval("const $params = this.__render.params; ".concat(_this.bindScript, " ").concat(script_1, " "), Object.assign(obj, {
427
- __render: Object.freeze({
428
- event: event,
429
- element: it,
430
- attribute: DomUtils_1.DomUtils.getAttributeToObject(it),
431
- target: event.target,
432
- range: Range_1.Range.range,
433
- scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj),
434
- params: params_1
435
- })
406
+ ScriptUtils_1.ScriptUtils.eval("const $params = this.__render.params; ".concat(_this.getBindScript(config), " ").concat(script_1, " "), Object.assign(obj, {
407
+ __render: Object.freeze(__assign({ event: event, element: it, attribute: DomUtils_1.DomUtils.getAttributeToObject(it), target: event.target, range: Range_1.Range.range, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj), params: params_1 }, config === null || config === void 0 ? void 0 : config.eventVariables))
436
408
  }));
437
409
  });
438
410
  });
@@ -509,6 +481,22 @@ var EventManager = /** @class */ (function () {
509
481
  return newScripts;
510
482
  }
511
483
  };
484
+ EventManager.prototype.getBindScript = function (config) {
485
+ var _this = this;
486
+ if (config === null || config === void 0 ? void 0 : config.eventVariables) {
487
+ var bindScript = Object.entries(config.eventVariables).filter(function (_a) {
488
+ var key = _a[0], value = _a[1];
489
+ return !_this.bindScript.includes("const ".concat(key));
490
+ }).map(function (_a) {
491
+ var key = _a[0], value = _a[1];
492
+ return "const ".concat(key, " = this.__render.").concat(key, ";");
493
+ }).join(';');
494
+ return this.bindScript + '' + bindScript;
495
+ }
496
+ else {
497
+ return this.bindScript;
498
+ }
499
+ };
512
500
  EventManager.ownerVariablePathAttrName = 'dr-owner-variable-path';
513
501
  EventManager.attrPrefix = 'dr-';
514
502
  EventManager.onInitAttrName = EventManager.attrPrefix + 'on-init';
@@ -5,11 +5,11 @@ declare enum CallBackType {
5
5
  MAP = 1,
6
6
  SUBSCRIBE = 2
7
7
  }
8
- export declare type ChannelData = {
8
+ export type ChannelData = {
9
9
  channel: Channel;
10
10
  data?: (any | undefined);
11
11
  };
12
- export declare type ChannelMetaData = {
12
+ export type ChannelMetaData = {
13
13
  channel?: Channel;
14
14
  action?: string;
15
15
  };
@@ -47,13 +47,13 @@ export declare class Channel {
47
47
  subscribe<D = any>(subscribeCallback: (data: D, meta: ChannelMetaData) => any | void | undefined): ChannelSubscription;
48
48
  deleteChannel(): void;
49
49
  }
50
- declare type MessengerEventDetail = {
50
+ type MessengerEventDetail = {
51
51
  key: string | object | ConstructorType<any>;
52
52
  data?: any;
53
53
  action?: string;
54
54
  result?: (c: ChannelData[]) => void;
55
55
  };
56
- declare type MessengerSubscribeEventDetail = {
56
+ type MessengerSubscribeEventDetail = {
57
57
  obj: any;
58
58
  key?: string | object | ConstructorType<any>;
59
59
  init: (channel: Channel, subscription: ChannelSubscription) => void;
package/operators/Dr.js CHANGED
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
40
40
  function verb(n) { return function (v) { return step([n, v]); }; }
41
41
  function step(op) {
42
42
  if (f) throw new TypeError("Generator is already executing.");
43
- while (_) try {
43
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
44
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
45
  if (y = 0, t) op = [op[0] & 2, t.value];
46
46
  switch (op[0]) {
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
40
40
  function verb(n) { return function (v) { return step([n, v]); }; }
41
41
  function step(op) {
42
42
  if (f) throw new TypeError("Generator is already executing.");
43
- while (_) try {
43
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
44
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
45
  if (y = 0, t) op = [op[0] & 2, t.value];
46
46
  switch (op[0]) {
@@ -70,10 +70,8 @@ var OperatorExecuter_1 = require("./OperatorExecuter");
70
70
  var DrAppender = /** @class */ (function (_super) {
71
71
  __extends(DrAppender, _super);
72
72
  function DrAppender(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
73
- var _this = this;
74
73
  source.operatorAround = undefined;
75
- _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
76
- return _this;
74
+ return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
77
75
  }
78
76
  DrAppender.prototype.executeAttrRequire = function (attr) {
79
77
  var _a, _b, _c, _d;
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
40
40
  function verb(n) { return function (v) { return step([n, v]); }; }
41
41
  function step(op) {
42
42
  if (f) throw new TypeError("Generator is already executing.");
43
- while (_) try {
43
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
44
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
45
  if (y = 0, t) op = [op[0] & 2, t.value];
46
46
  switch (op[0]) {
@@ -70,10 +70,8 @@ var OperatorExecuter_1 = require("./OperatorExecuter");
70
70
  var DrFor = /** @class */ (function (_super) {
71
71
  __extends(DrFor, _super);
72
72
  function DrFor(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
73
- var _this = this;
74
73
  source.operatorAround = undefined;
75
- _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
76
- return _this;
74
+ return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
77
75
  }
78
76
  DrFor.prototype.executeAttrRequire = function (attr) {
79
77
  var _a, _b, _c, _d;
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
40
40
  function verb(n) { return function (v) { return step([n, v]); }; }
41
41
  function step(op) {
42
42
  if (f) throw new TypeError("Generator is already executing.");
43
- while (_) try {
43
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
44
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
45
  if (y = 0, t) op = [op[0] & 2, t.value];
46
46
  switch (op[0]) {
@@ -70,10 +70,8 @@ var OperatorExecuter_1 = require("./OperatorExecuter");
70
70
  var DrForOf = /** @class */ (function (_super) {
71
71
  __extends(DrForOf, _super);
72
72
  function DrForOf(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
73
- var _this = this;
74
73
  source.operatorAround = undefined;
75
- _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
76
- return _this;
74
+ return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
77
75
  }
78
76
  DrForOf.prototype.executeAttrRequire = function (attr) {
79
77
  var _a, _b, _c, _d;
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
40
40
  function verb(n) { return function (v) { return step([n, v]); }; }
41
41
  function step(op) {
42
42
  if (f) throw new TypeError("Generator is already executing.");
43
- while (_) try {
43
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
44
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
45
  if (y = 0, t) op = [op[0] & 2, t.value];
46
46
  switch (op[0]) {
package/operators/DrIf.js CHANGED
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
40
40
  function verb(n) { return function (v) { return step([n, v]); }; }
41
41
  function step(op) {
42
42
  if (f) throw new TypeError("Generator is already executing.");
43
- while (_) try {
43
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
44
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
45
  if (y = 0, t) op = [op[0] & 2, t.value];
46
46
  switch (op[0]) {
@@ -70,10 +70,8 @@ var OperatorExecuter_1 = require("./OperatorExecuter");
70
70
  var DrIf = /** @class */ (function (_super) {
71
71
  __extends(DrIf, _super);
72
72
  function DrIf(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
73
- var _this = this;
74
73
  source.operatorAround = undefined;
75
- _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
76
- return _this;
74
+ return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
77
75
  }
78
76
  DrIf.prototype.executeAttrRequire = function (attr) {
79
77
  var _a, _b, _c, _d;
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
40
40
  function verb(n) { return function (v) { return step([n, v]); }; }
41
41
  function step(op) {
42
42
  if (f) throw new TypeError("Generator is already executing.");
43
- while (_) try {
43
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
44
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
45
  if (y = 0, t) op = [op[0] & 2, t.value];
46
46
  switch (op[0]) {
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
40
40
  function verb(n) { return function (v) { return step([n, v]); }; }
41
41
  function step(op) {
42
42
  if (f) throw new TypeError("Generator is already executing.");
43
- while (_) try {
43
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
44
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
45
  if (y = 0, t) op = [op[0] & 2, t.value];
46
46
  switch (op[0]) {
@@ -29,7 +29,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
@@ -56,10 +56,8 @@ var OperatorExecuter_1 = require("./OperatorExecuter");
56
56
  var DrPre = /** @class */ (function (_super) {
57
57
  __extends(DrPre, _super);
58
58
  function DrPre(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
59
- var _this = this;
60
59
  source.operatorAround = undefined;
61
- _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack) || this;
62
- return _this;
60
+ return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack) || this;
63
61
  }
64
62
  DrPre.prototype.execute = function (value) {
65
63
  return __awaiter(this, void 0, void 0, function () {
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
40
40
  function verb(n) { return function (v) { return step([n, v]); }; }
41
41
  function step(op) {
42
42
  if (f) throw new TypeError("Generator is already executing.");
43
- while (_) try {
43
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
44
44
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
45
  if (y = 0, t) op = [op[0] & 2, t.value];
46
46
  switch (op[0]) {
@@ -71,10 +71,8 @@ var OperatorExecuter_1 = require("./OperatorExecuter");
71
71
  var DrRepeat = /** @class */ (function (_super) {
72
72
  __extends(DrRepeat, _super);
73
73
  function DrRepeat(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
74
- var _this = this;
75
74
  source.operatorAround = undefined;
76
- _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
77
- return _this;
75
+ return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
78
76
  }
79
77
  DrRepeat.prototype.executeAttrRequire = function (attr) {
80
78
  var _a, _b, _c, _d;
@@ -29,7 +29,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
@@ -57,10 +57,8 @@ var OperatorExecuter_1 = require("./OperatorExecuter");
57
57
  var DrTargetAttr = /** @class */ (function (_super) {
58
58
  __extends(DrTargetAttr, _super);
59
59
  function DrTargetAttr(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
60
- var _this = this;
61
60
  source.operatorAround = undefined;
62
- _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
63
- return _this;
61
+ return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
64
62
  }
65
63
  DrTargetAttr.prototype.execute = function () {
66
64
  var _a, _b, _c, _d;
@@ -29,7 +29,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
@@ -58,10 +58,8 @@ var OperatorExecuter_1 = require("./OperatorExecuter");
58
58
  var DrTargetElement = /** @class */ (function (_super) {
59
59
  __extends(DrTargetElement, _super);
60
60
  function DrTargetElement(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
61
- var _this = this;
62
61
  source.operatorAround = undefined;
63
- _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
64
- return _this;
62
+ return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
65
63
  }
66
64
  DrTargetElement.prototype.execute = function () {
67
65
  var _a, _b, _c, _d;
@@ -29,7 +29,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
@@ -5,7 +5,7 @@ import { RawSet } from '../rawsets/RawSet';
5
5
  import { Render } from '../rawsets/Render';
6
6
  import { Attrs } from '../rawsets/Attrs';
7
7
  import { Config } from '../configs/Config';
8
- export declare type OperatorAround = {
8
+ export type OperatorAround = {
9
9
  beforeAttr?: (value: string | null | undefined, opratorExecutor: OperatorExecuter) => string | null | undefined;
10
10
  before?: (data: any, opratorExecutor: OperatorExecuter) => any;
11
11
  after?: (data: any, opratorExecutor: OperatorExecuter) => void;
@@ -15,22 +15,22 @@ export declare enum ExecuteState {
15
15
  NO_EXECUTE = 1,
16
16
  STOP = 2
17
17
  }
18
- export declare type AfterCallBack = {
18
+ export type AfterCallBack = {
19
19
  onAttrInitCallBacks: AttrInitCallBack[];
20
20
  onElementInitCallBacks: ElementInitCallBack[];
21
21
  onThisComponentSetCallBacks: ComponentSet[];
22
22
  };
23
- export declare type ReturnContainer = {
23
+ export type ReturnContainer = {
24
24
  raws: RawSet[];
25
25
  fag: DocumentFragment;
26
26
  };
27
- export declare type ElementSource = {
27
+ export type ElementSource = {
28
28
  element: Element;
29
29
  attrs: Attrs;
30
30
  attr?: string | null;
31
31
  attrName?: string | undefined;
32
32
  };
33
- export declare type Source = {
33
+ export type Source = {
34
34
  config: Config;
35
35
  operatorAround?: OperatorAround;
36
36
  obj: any;
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -29,7 +29,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
29
29
  function verb(n) { return function (v) { return step([n, v]); }; }
30
30
  function step(op) {
31
31
  if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
33
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
34
  if (y = 0, t) op = [op[0] & 2, t.value];
35
35
  switch (op[0]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dom-render",
3
- "version": "1.0.92",
3
+ "version": "1.0.93",
4
4
  "main": "DomRender.js",
5
5
  "license": "MIT",
6
6
  "description": "html view template engine",
@@ -1,4 +1,4 @@
1
- export declare type AttrInitCallBack = {
1
+ export type AttrInitCallBack = {
2
2
  attrName: string;
3
3
  attrValue: string;
4
4
  obj: any;
@@ -1,4 +1,4 @@
1
- export declare type Attrs = {
1
+ export type Attrs = {
2
2
  dr: string | null;
3
3
  drIf: string | null;
4
4
  drAppender: string | null;
@@ -1,7 +1,7 @@
1
1
  import { Router } from '../routers/Router';
2
2
  import { Attrs } from './Attrs';
3
3
  import { RawSet } from './RawSet';
4
- export declare type CreatorMetaData = {
4
+ export type CreatorMetaData = {
5
5
  thisVariableName?: string | null;
6
6
  thisFullVariableName?: string | null;
7
7
  componentKey?: string | null;
@@ -1,6 +1,6 @@
1
1
  import { TargetElement } from '../configs/TargetElement';
2
2
  import { CreatorMetaData } from './CreatorMetaData';
3
- export declare type ElementInitCallBack = {
3
+ export type ElementInitCallBack = {
4
4
  name: string;
5
5
  obj: any;
6
6
  targetElement: TargetElement;
package/rawsets/RawSet.js CHANGED
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
29
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
30
  if (y = 0, t) op = [op[0] & 2, t.value];
31
31
  switch (op[0]) {
@@ -1,7 +1,7 @@
1
1
  import { CreatorMetaData } from './CreatorMetaData';
2
2
  import { Router } from '../routers/Router';
3
3
  import { RawSet } from './RawSet';
4
- export declare type Render = {
4
+ export type Render = {
5
5
  rawset?: RawSet;
6
6
  scripts?: {
7
7
  [n: string]: any;
@@ -1,4 +1,4 @@
1
- export declare type RouteData = {
1
+ export type RouteData = {
2
2
  path: string;
3
3
  url: string;
4
4
  data?: any;
@@ -1,4 +1,4 @@
1
- export declare type Attr = {
1
+ export type Attr = {
2
2
  name: string;
3
3
  value: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type Attr = {
1
+ export type Attr = {
2
2
  name: string;
3
3
  value: any;
4
4
  };
@@ -24,9 +24,9 @@ var EmptyValidator = /** @class */ (function (_super) {
24
24
  return _super.call(this, value, target, event, autoValid) || this;
25
25
  }
26
26
  EmptyValidator.prototype.valid = function () {
27
- var _a, _b;
27
+ var _a;
28
28
  var value = this.value;
29
- return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
29
+ return value === undefined || value === null || ((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 0) <= 0;
30
30
  };
31
31
  return EmptyValidator;
32
32
  }(Validator_1.Validator));
@@ -24,10 +24,10 @@ var NotEmptyValidator = /** @class */ (function (_super) {
24
24
  return _super.call(this, value, target, event, autoValid) || this;
25
25
  }
26
26
  NotEmptyValidator.prototype.valid = function () {
27
- var _a, _b;
27
+ var _a;
28
28
  var value = this.value;
29
29
  // console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
30
- return value !== undefined && value !== null && ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
30
+ return value !== undefined && value !== null && ((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 0) > 0;
31
31
  };
32
32
  return NotEmptyValidator;
33
33
  }(Validator_1.Validator));
@@ -1,6 +1,6 @@
1
1
  import { Validator } from './Validator';
2
2
  import { MultipleValidator } from './MultipleValidator';
3
- export declare type ValidMulltiple<T = any, E = Element> = (validators: Validator<T, E>[], value?: T, target?: E, event?: Event) => boolean;
3
+ export type ValidMulltiple<T = any, E = Element> = (validators: Validator<T, E>[], value?: T, target?: E, event?: Event) => boolean;
4
4
  export declare class ValidMultipleValidator<T = any, E = Element> extends MultipleValidator<T, E> {
5
5
  validMultipleCallback: ValidMulltiple<T, E>;
6
6
  validators: Validator<T, E>[];