dom-render 1.0.95 → 1.0.97

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/DomRender.d.ts +1 -1
  2. package/DomRender.js +3 -3
  3. package/DomRenderProxy.js +24 -30
  4. package/README.MD +41 -0
  5. package/components/ComponentSet.d.ts +1 -1
  6. package/configs/Config.d.ts +1 -1
  7. package/configs/TargetAttr.d.ts +1 -1
  8. package/configs/TargetElement.d.ts +1 -1
  9. package/css/parse/index.d.ts +1 -0
  10. package/css/parse/index.js +512 -0
  11. package/css/stringify/compiler.d.ts +32 -0
  12. package/css/stringify/compiler.js +40 -0
  13. package/css/stringify/compress.d.ts +75 -0
  14. package/css/stringify/compress.js +156 -0
  15. package/css/stringify/identity.d.ts +85 -0
  16. package/css/stringify/identity.js +194 -0
  17. package/css/stringify/index.d.ts +14 -0
  18. package/css/stringify/index.js +44 -0
  19. package/dist/bundle.js +1138 -385
  20. package/events/EventManager.js +27 -27
  21. package/iterators/Range.d.ts +1 -0
  22. package/iterators/Range.js +15 -0
  23. package/messenger/Messenger.d.ts +4 -4
  24. package/operators/Dr.js +2 -2
  25. package/operators/DrAppender.js +5 -3
  26. package/operators/DrFor.js +5 -3
  27. package/operators/DrForOf.js +5 -3
  28. package/operators/DrForm.js +12 -12
  29. package/operators/DrIf.js +5 -3
  30. package/operators/DrInnerHTML.js +2 -2
  31. package/operators/DrInnerText.js +2 -2
  32. package/operators/DrPre.js +4 -2
  33. package/operators/DrRepeat.js +5 -3
  34. package/operators/DrTargetAttr.js +4 -2
  35. package/operators/DrTargetElement.js +5 -3
  36. package/operators/DrThis.js +2 -2
  37. package/operators/{DrDictionary.d.ts → DrThisProperty.d.ts} +1 -2
  38. package/operators/{DrDictionary.js → DrThisProperty.js} +19 -42
  39. package/operators/OperatorExecuter.d.ts +5 -5
  40. package/operators/OperatorExecuter.js +2 -2
  41. package/operators/OperatorExecuterAttrRequire.js +1 -1
  42. package/package.json +3 -3
  43. package/rawsets/AttrInitCallBack.d.ts +1 -1
  44. package/rawsets/Attrs.d.ts +4 -3
  45. package/rawsets/CreatorMetaData.d.ts +1 -1
  46. package/rawsets/ElementInitCallBack.d.ts +1 -1
  47. package/rawsets/RawSet.d.ts +19 -7
  48. package/rawsets/RawSet.js +144 -73
  49. package/rawsets/RawSetOperatorType.d.ts +3 -0
  50. package/rawsets/RawSetOperatorType.js +7 -0
  51. package/rawsets/Render.d.ts +1 -1
  52. package/routers/Router.d.ts +1 -1
  53. package/routers/Router.js +1 -1
  54. package/utils/dom/DomUtils.d.ts +1 -1
  55. package/utils/node/NodeUtils.d.ts +1 -1
  56. package/utils/script/ScriptUtils.js +2 -2
  57. package/utils/storage/StorageUtils.d.ts +7 -0
  58. package/utils/storage/StorageUtils.js +39 -0
  59. package/utils/string/StringUtils.d.ts +1 -0
  60. package/utils/string/StringUtils.js +17 -0
  61. package/validators/EmptyValidator.js +2 -2
  62. package/validators/NotEmptyValidator.js +2 -2
  63. package/validators/ValidMultipleValidator.d.ts +1 -1
  64. package/validators/Validator.d.ts +2 -2
  65. package/validators/ValidatorArray.d.ts +1 -1
@@ -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 (g && (g = 0, op[0] && (_ = 0)), _) try {
43
+ while (_) 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,8 +71,10 @@ 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;
74
75
  source.operatorAround = undefined;
75
- return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
76
+ _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
77
+ return _this;
76
78
  }
77
79
  DrRepeat.prototype.executeAttrRequire = function (attr) {
78
80
  var _a, _b, _c, _d;
@@ -83,7 +85,7 @@ var DrRepeat = /** @class */ (function (_super) {
83
85
  itRandom = RawSet_1.RawSet.drItOtherEncoding(this.elementSource.element);
84
86
  vars = RawSet_1.RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
85
87
  newTemp = this.source.config.window.document.createElement('temp');
86
- ScriptUtils_1.ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n ").concat((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '', "\n var i = 0; \n const repeat = ").concat(attr, ";\n const repeatStr = `").concat(attr, "`;\n let range = repeat;\n if (typeof repeat === 'number') {\n range = ").concat(EventManager_1.EventManager.RANGE_VARNAME, "(repeat);\n } \n for(const it of range) {\n var destIt = it;\n if (range.isRange) {\n destIt = it;\n } else {\n destIt = repeatStr + '[' + i +']'\n }\n const n = this.__render.element.cloneNode(true);\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt).replace(/\\#nearRangeIt\\#/g, destIt).replace(/\\#nearRangeIndex\\#/g, destIt)))\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt).replace(/\\#index\\#/g, destIt);\n \n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n i++;\n }\n ").concat((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '', "\n "), Object.assign(this.source.obj, {
88
+ ScriptUtils_1.ScriptUtils.eval("\n " + this.render.bindScript + "\n " + ((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '') + "\n var i = 0; \n const repeat = " + attr + ";\n const repeatStr = `" + attr + "`;\n let range = repeat;\n if (typeof repeat === 'number') {\n range = " + EventManager_1.EventManager.RANGE_VARNAME + "(repeat);\n } \n for(const it of range) {\n var destIt = it;\n if (range.isRange) {\n destIt = it;\n } else {\n destIt = repeatStr + '[' + i +']'\n }\n const n = this.__render.element.cloneNode(true);\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt).replace(/\\#nearRangeIt\\#/g, destIt).replace(/\\#nearRangeIndex\\#/g, destIt)))\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt).replace(/\\#index\\#/g, destIt);\n \n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n i++;\n }\n " + ((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '') + "\n ", Object.assign(this.source.obj, {
87
89
  __render: Object.freeze(__assign({ fag: newTemp, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
88
90
  }));
89
91
  RawSet_1.RawSet.drVarDecoding(newTemp, vars);
@@ -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 (g && (g = 0, op[0] && (_ = 0)), _) try {
32
+ while (_) 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,8 +57,10 @@ 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;
60
61
  source.operatorAround = undefined;
61
- return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
62
+ _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
63
+ return _this;
62
64
  }
63
65
  DrTargetAttr.prototype.execute = function () {
64
66
  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 (g && (g = 0, op[0] && (_ = 0)), _) try {
32
+ while (_) 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,8 +58,10 @@ 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;
61
62
  source.operatorAround = undefined;
62
- return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
63
+ _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
64
+ return _this;
63
65
  }
64
66
  DrTargetElement.prototype.execute = function () {
65
67
  var _a, _b, _c, _d;
@@ -83,7 +85,7 @@ var DrTargetElement = /** @class */ (function (_super) {
83
85
  if (detectAction_1 && render_1) {
84
86
  this.rawSet.detect = {
85
87
  action: function () {
86
- var script = "var $component = this.__render.component; var $element = this.__render.element; var $innerHTML = this.__render.innerHTML; var $attribute = this.__render.attribute; ".concat(detectAction_1, " ");
88
+ var script = "var $component = this.__render.component; var $element = this.__render.element; var $innerHTML = this.__render.innerHTML; var $attribute = this.__render.attribute; " + detectAction_1 + " ";
87
89
  ScriptUtils_1.ScriptUtils.eval(script, Object.assign(_this.source.obj, {
88
90
  __render: render_1
89
91
  }));
@@ -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 (g && (g = 0, op[0] && (_ = 0)), _) try {
32
+ while (_) 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]) {
@@ -76,7 +76,7 @@ var DrThis = /** @class */ (function (_super) {
76
76
  RawSet_1.RawSet.destroy(this.rawSet.data.obj, [], this.source.config, destroyOptions);
77
77
  }
78
78
  this.rawSet.data = attr;
79
- return [4 /*yield*/, RawSet_1.RawSet.drThisCreate(this.rawSet, this.elementSource.element, "".concat(this.elementSource.attrs.drThis).concat(attr.config.objPath ? ('.' + attr.config.objPath) : ''), (_c = this.elementSource.attrs.drVarOption) !== null && _c !== void 0 ? _c : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config, attr)];
79
+ return [4 /*yield*/, RawSet_1.RawSet.drThisCreate(this.rawSet, this.elementSource.element, "" + this.elementSource.attrs.drThis + (attr.config.objPath ? ('.' + attr.config.objPath) : ''), (_c = this.elementSource.attrs.drVarOption) !== null && _c !== void 0 ? _c : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config, attr)];
80
80
  case 1:
81
81
  componentBody = _j.sent();
82
82
  this.returnContainer.fag.append(componentBody);
@@ -3,9 +3,8 @@ import { RawSet } from '../rawsets/RawSet';
3
3
  import { Render } from '../rawsets/Render';
4
4
  import { AfterCallBack, ElementSource, ExecuteState, ReturnContainer, Source } from './OperatorExecuter';
5
5
  import { Config } from '../configs/Config';
6
- export declare class DrDictionary extends OperatorExecuterAttrRequire<string> {
6
+ export declare class DrThisProperty extends OperatorExecuterAttrRequire<string> {
7
7
  constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
8
8
  executeAttrRequire(attr: string): Promise<ExecuteState>;
9
- static getChildren(rawSet: RawSet, config: Config): Map<string, Node[]>;
10
9
  static append(obj: any, fullPath: string, key: string, rawSet: RawSet, config: Config): RawSet[];
11
10
  }
@@ -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 (g && (g = 0, op[0] && (_ = 0)), _) try {
43
+ while (_) 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]) {
@@ -62,18 +62,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
62
62
  }
63
63
  };
64
64
  Object.defineProperty(exports, "__esModule", { value: true });
65
- exports.DrDictionary = void 0;
65
+ exports.DrThisProperty = void 0;
66
66
  var OperatorExecuterAttrRequire_1 = require("./OperatorExecuterAttrRequire");
67
67
  var ScriptUtils_1 = require("../utils/script/ScriptUtils");
68
68
  var RawSet_1 = require("../rawsets/RawSet");
69
69
  var OperatorExecuter_1 = require("./OperatorExecuter");
70
- var DrDictionary = /** @class */ (function (_super) {
71
- __extends(DrDictionary, _super);
72
- function DrDictionary(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
70
+ var DrThisProperty = /** @class */ (function (_super) {
71
+ __extends(DrThisProperty, _super);
72
+ function DrThisProperty(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
73
+ var _this = this;
73
74
  source.operatorAround = undefined;
74
- return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
75
+ _this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
76
+ return _this;
75
77
  }
76
- DrDictionary.prototype.executeAttrRequire = function (attr) {
78
+ DrThisProperty.prototype.executeAttrRequire = function (attr) {
77
79
  var _a, _b, _c, _d, _e;
78
80
  return __awaiter(this, void 0, void 0, function () {
79
81
  var itRandom, vars, newTemp, dictioanry, dictionaryKey, tempalte, rr;
@@ -83,14 +85,14 @@ var DrDictionary = /** @class */ (function (_super) {
83
85
  vars = RawSet_1.RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
84
86
  newTemp = this.source.config.window.document.createElement('temp');
85
87
  dictioanry = ScriptUtils_1.ScriptUtils.evalReturn(attr, this.source.obj);
86
- dictionaryKey = (_b = this.elementSource.attrs.drDictionaryOption) !== null && _b !== void 0 ? _b : '';
88
+ dictionaryKey = (_b = this.elementSource.attrs.drKeyOption) !== null && _b !== void 0 ? _b : '';
87
89
  // console.log('--->', attr, dictionaryKey)
88
90
  // if (!(dictioanry instanceof Dictionary)) {
89
91
  // return ExecuteState.STOP;
90
92
  // }
91
93
  // await new Promise(resolve => setTimeout(resolve, 1000));
92
94
  // console.log('!!!!!!!!!!!!!!', this.rawSet);
93
- ScriptUtils_1.ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n ").concat((_c = this.elementSource.attrs.drBeforeOption) !== null && _c !== void 0 ? _c : '', "\n var i = 0; \n const dictionary = ").concat(attr, ";\n const dictionaryKey = '").concat(dictionaryKey, "';\n const dictionaryStr = `").concat(attr, "`.trim();\n // console.log('----@#!@#@!#', this.__render.oldChild);\n if (dictionary) {\n for(const it in dictionary) {\n // const oldChild = this.__render.oldChild.get(it);\n // if (oldChild && oldChild.length > 0) {\n // this.__render.fag.append(...oldChild);\n // } else {\n // var destIt = dictionaryStr + '[\"' + it + '\"]';\n // const n = this.__render.element.cloneNode(true);\n // n.setAttribute('dr-this', destIt);\n // // n.setAttribute('dr-dictionary', dictionaryStr);\n // n.setAttribute('dr-dictionary-key', it);\n // this.__render.fag.append(n);\n // }\n // if (!this.__render.oldChild.get(it)) {\n // var destIt = dictionaryStr + '[\"' + it + '\"]';\n // const n = this.__render.element.cloneNode(true);\n // n.setAttribute('dr-this', destIt);\n // // n.setAttribute('dr-dictionary', dictionaryStr);\n // n.setAttribute('dr-dictionary-key', it);\n // this.__render.fag.append(n);\n // }\n var destIt = dictionaryStr + '[\"' + it + '\"]';\n const n = this.__render.element.cloneNode(true);\n n.setAttribute('dr-this', destIt);\n // n.setAttribute('dr-dictionary', dictionaryStr);\n // n.setAttribute('dr-dictionary-key', it);\n this.__render.fag.append(n);\n i++;\n }\n this.__render.rawset.point.start.setAttribute('dictionary-keys',Object.keys(dictionary).join(','));\n }\n ").concat((_d = this.elementSource.attrs.drAfterOption) !== null && _d !== void 0 ? _d : '', "\n "), Object.assign(this.source.obj, {
95
+ ScriptUtils_1.ScriptUtils.eval("\n " + this.render.bindScript + "\n " + ((_c = this.elementSource.attrs.drBeforeOption) !== null && _c !== void 0 ? _c : '') + "\n var i = 0; \n const dictionary = " + attr + ";\n const dictionaryKey = '" + dictionaryKey + "';\n const dictionaryStr = `" + attr + "`.trim();\n // console.log('----@#!@#@!#', this.__render.oldChild);\n if (dictionary) {\n for(const it in dictionary) {\n var destIt = dictionaryStr + '[\"' + it + '\"]';\n const n = this.__render.element.cloneNode(true);\n n.setAttribute('dr-this', destIt);\n n.setAttribute('dr-key', it);\n // n.setAttribute('dr-dictionary-key', it);\n this.__render.fag.append(n);\n i++;\n }\n this.__render.rawset.point.start.setAttribute('dr-has-keys',Object.keys(dictionary).join(','));\n }\n " + ((_d = this.elementSource.attrs.drAfterOption) !== null && _d !== void 0 ? _d : '') + "\n ", Object.assign(this.source.obj, {
94
96
  __render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet_1.RawSet.drAttrsOriginName, fag: newTemp }, this.render))
95
97
  }));
96
98
  RawSet_1.RawSet.drVarDecoding(newTemp, vars);
@@ -106,29 +108,7 @@ var DrDictionary = /** @class */ (function (_super) {
106
108
  });
107
109
  });
108
110
  };
109
- DrDictionary.getChildren = function (rawSet, config) {
110
- var _a, _b, _c;
111
- var next = rawSet.point.start.nextSibling;
112
- var oldChild = new Map();
113
- var currentKey = '';
114
- while (next) {
115
- if (next === rawSet.point.end) {
116
- break;
117
- }
118
- var dictionaryKey = (_b = (_a = next).getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, 'dictionary-key');
119
- if (dictionaryKey) {
120
- currentKey = dictionaryKey;
121
- oldChild.set(dictionaryKey, []);
122
- }
123
- // console.log('next-------->', currentKey, next);
124
- if (currentKey) {
125
- (_c = oldChild.get(currentKey)) === null || _c === void 0 ? void 0 : _c.push(next);
126
- }
127
- next = next.nextSibling;
128
- }
129
- return oldChild;
130
- };
131
- DrDictionary.append = function (obj, fullPath, key, rawSet, config) {
111
+ DrThisProperty.append = function (obj, fullPath, key, rawSet, config) {
132
112
  var _this = this;
133
113
  var _a, _b;
134
114
  var genNode = config.window.document.importNode(rawSet.fragment, true);
@@ -137,30 +117,27 @@ var DrDictionary = /** @class */ (function (_super) {
137
117
  for (var _i = 0, _c = Array.from(genNode.childNodes.values()); _i < _c.length; _i++) {
138
118
  var cNode = _c[_i];
139
119
  var element = cNode.cloneNode(true);
140
- element.removeAttribute('dr-dictionary');
141
- element.setAttribute('dr-this', "this.".concat(fullPath));
120
+ element.removeAttribute(RawSet_1.RawSet.DR_THIS_PROPERTY_NAME);
121
+ element.setAttribute(RawSet_1.RawSet.DR_THIS_NAME, "this." + fullPath);
122
+ element.setAttribute(RawSet_1.RawSet.DR_KEY_OPTIONNAME, key);
142
123
  // rawSet.point.end.after(element);
143
124
  var fg = config.window.document.createDocumentFragment();
144
125
  fg.append(element);
145
126
  rawSets.push.apply(rawSets, RawSet_1.RawSet.checkPointCreates(fg, obj, config));
146
127
  rawSet.point.end.before(fg);
147
128
  var start = rawSet.point.start;
148
- var keys = (_b = (_a = start.getAttribute('dictionary-keys')) === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : [];
129
+ var keys = (_b = (_a = start.getAttribute(RawSet_1.RawSet.DR_HAS_KEYS_OPTIONNAME)) === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : [];
149
130
  keys.push(key);
150
- start.setAttribute('dictionary-keys', keys.join(','));
131
+ start.setAttribute(RawSet_1.RawSet.DR_HAS_KEYS_OPTIONNAME, keys.join(','));
151
132
  rawSets.forEach(function (it) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
152
133
  switch (_a.label) {
153
134
  case 0: return [4 /*yield*/, it.render(obj, config)];
154
135
  case 1: return [2 /*return*/, _a.sent()];
155
136
  }
156
137
  }); }); });
157
- // console.log('WWW', fg, Array.from(fg.childNodes));
158
- // console.log('--------------------------rawSets', rawSets);
159
138
  }
160
139
  return rawSets;
161
- // rawSet.
162
- // rawSet.point.end.before()
163
140
  };
164
- return DrDictionary;
141
+ return DrThisProperty;
165
142
  }(OperatorExecuterAttrRequire_1.OperatorExecuterAttrRequire));
166
- exports.DrDictionary = DrDictionary;
143
+ exports.DrThisProperty = DrThisProperty;
@@ -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 type OperatorAround = {
8
+ export declare 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 type AfterCallBack = {
18
+ export declare type AfterCallBack = {
19
19
  onAttrInitCallBacks: AttrInitCallBack[];
20
20
  onElementInitCallBacks: ElementInitCallBack[];
21
21
  onThisComponentSetCallBacks: ComponentSet[];
22
22
  };
23
- export type ReturnContainer = {
23
+ export declare type ReturnContainer = {
24
24
  raws: RawSet[];
25
25
  fag: DocumentFragment;
26
26
  };
27
- export type ElementSource = {
27
+ export declare type ElementSource = {
28
28
  element: Element;
29
29
  attrs: Attrs;
30
30
  attr?: string | null;
31
31
  attrName?: string | undefined;
32
32
  };
33
- export type Source = {
33
+ export declare 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 (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ while (_) 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]) {
@@ -69,7 +69,7 @@ var OperatorExecuter = /** @class */ (function () {
69
69
  }
70
70
  r = attrValue;
71
71
  if (r && this.startingExecute) {
72
- r = ScriptUtils_1.ScriptUtils.eval(" ".concat(this.render.bindScript, "; return ").concat(attrValue), Object.assign(this.source.obj, { __render: this.render }));
72
+ r = ScriptUtils_1.ScriptUtils.eval(" " + this.render.bindScript + "; return " + attrValue, Object.assign(this.source.obj, { __render: this.render }));
73
73
  }
74
74
  if ((_c = this.source.operatorAround) === null || _c === void 0 ? void 0 : _c.before) {
75
75
  r = (_d = this.source.operatorAround) === null || _d === void 0 ? void 0 : _d.before(r, this);
@@ -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 (g && (g = 0, op[0] && (_ = 0)), _) try {
32
+ while (_) 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.95",
3
+ "version": "1.0.97",
4
4
  "main": "DomRender.js",
5
5
  "license": "MIT",
6
6
  "description": "html view template engine",
@@ -58,8 +58,8 @@
58
58
  "bundle:watch": "rollup -c -w",
59
59
  "dev:start": "npm run start --workspace=dev",
60
60
  "dev:serve": "npm run serve --workspace=dev",
61
- "npm-build": "npm run build && cp package.json dist && cp .npmignore dist && cp README.MD dist && rm -rf dist/dist/bundle.js.map",
62
- "npm-publish": "npm run npm-build && npm publish ./dist",
61
+ "npm:build": "npm run build && cp package.json dist && cp .npmignore dist && cp README.MD dist && rm -rf dist/dist/bundle.js.map",
62
+ "npm:publish": "npm run npm:build && npm publish ./dist",
63
63
  "tsc": "tsc",
64
64
  "tsc:watch": "rm -rf ./dist && mkdir dist && cp package.json dist && tsc --watch --outDir dist --declarationDir dist --sourceMap true",
65
65
  "test": "jest --detectOpenHandles --forceExit"
@@ -1,4 +1,4 @@
1
- export type AttrInitCallBack = {
1
+ export declare type AttrInitCallBack = {
2
2
  attrName: string;
3
3
  attrValue: string;
4
4
  obj: any;
@@ -1,10 +1,10 @@
1
- export type Attrs = {
1
+ export declare type Attrs = {
2
2
  dr: string | null;
3
3
  drIf: string | null;
4
4
  drAppender: string | null;
5
5
  drFor: string | null;
6
6
  drForOf: string | null;
7
- drDictionary: string | null;
7
+ drThisProperty: string | null;
8
8
  drRepeat: string | null;
9
9
  drThis: string | null;
10
10
  drForm: string | null;
@@ -19,5 +19,6 @@ export type Attrs = {
19
19
  drCompleteOption: string | null;
20
20
  drStripOption: string | null;
21
21
  drDestroyOption: string | null;
22
- drDictionaryOption: string | null;
22
+ drHasKeysOption: string | null;
23
+ drKeyOption: string | null;
23
24
  };
@@ -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 type CreatorMetaData = {
4
+ export declare 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 type ElementInitCallBack = {
3
+ export declare type ElementInitCallBack = {
4
4
  name: string;
5
5
  obj: any;
6
6
  targetElement: TargetElement;
@@ -9,7 +9,9 @@ export declare class RawSet {
9
9
  uuid: string;
10
10
  type: RawSetType;
11
11
  point: {
12
- start: Comment | Text | HTMLMetaElement;
12
+ start: (Comment | Text | HTMLMetaElement) & {
13
+ rawSet?: RawSet;
14
+ };
13
15
  node: Node;
14
16
  end: Comment | Text | HTMLMetaElement;
15
17
  thisVariableName?: string | null;
@@ -24,7 +26,7 @@ export declare class RawSet {
24
26
  static readonly DR_IF_NAME = "dr-if";
25
27
  static readonly DR_FOR_NAME = "dr-for";
26
28
  static readonly DR_FOR_OF_NAME = "dr-for-of";
27
- static readonly DR_DICTIONARY_NAME = "dr-dictionary";
29
+ static readonly DR_THIS_PROPERTY_NAME = "dr-this-property";
28
30
  static readonly DR_REPEAT_NAME = "dr-repeat";
29
31
  static readonly DR_THIS_NAME = "dr-this";
30
32
  static readonly DR_FORM_NAME = "dr-form";
@@ -43,16 +45,19 @@ export declare class RawSet {
43
45
  static readonly DR_DESTROY_OPTIONNAME = "dr-destroy";
44
46
  static readonly DR_COMPONENT_NAME_OPTIONNAME = "dr-component-name";
45
47
  static readonly DR_COMPONENT_INNER_HTML_NAME_OPTIONNAME = "dr-component-inner-html-name";
46
- static readonly DR_DICTIONARY_OPTIONKEYNAME = "dr-dictionary-key";
48
+ static readonly DR_KEY_OPTIONNAME = "dr-key";
49
+ static readonly DR_HAS_KEYS_OPTIONNAME = "dr-has-keys";
47
50
  static readonly DR_ON_CREATE_ARGUMENTS_OPTIONNAME = "dr-on-create:arguments";
48
51
  static readonly DR_ON_CREATED_CALLBACK_OPTIONNAME = "dr-on-create:callback";
49
52
  static readonly DR_ON_INIT_ARGUMENTS_OPTIONNAME = "dr-on-init:arguments";
50
53
  static readonly DR_ON_CONSTRUCTOR_ARGUMENTS_OPTIONNAME = "dr-on-constructor:arguments";
51
54
  static readonly drAttrsOriginName: Attrs;
52
55
  static readonly DR_TAGS: never[];
53
- static readonly DR_ATTRIBUTES: readonly ["dr", "dr-appender", "dr-if", "dr-for-of", "dr-dictionary", "dr-for", "dr-this", "dr-form", "dr-pre", "dr-inner-html", "dr-inner-text", "dr-repeat", "dr-detect"];
56
+ static readonly DR_ATTRIBUTES: readonly ["dr", "dr-appender", "dr-if", "dr-for-of", "dr-this-property", "dr-for", "dr-this", "dr-form", "dr-pre", "dr-inner-html", "dr-inner-text", "dr-repeat", "dr-detect"];
54
57
  constructor(uuid: string, type: RawSetType, point: {
55
- start: Comment | Text | HTMLMetaElement;
58
+ start: (Comment | Text | HTMLMetaElement) & {
59
+ rawSet?: RawSet;
60
+ };
56
61
  node: Node;
57
62
  end: Comment | Text | HTMLMetaElement;
58
63
  thisVariableName?: string | null;
@@ -63,9 +68,13 @@ export declare class RawSet {
63
68
  get isConnected(): boolean;
64
69
  getUsingTriggerVariables(config?: Config): Set<string>;
65
70
  render(obj: any, config: Config): Promise<RawSet[]>;
66
- static generateStyleSheetsLocal(): void;
71
+ /**
72
+ * @deprecated
73
+ * @param config
74
+ */
75
+ static generateStyleSheetsLocal(config: Config): void;
67
76
  static generateCSS(id: string, cssRule: CSSRule): void;
68
- static generateStyleTransform(styleBody: string | string[], id: string, styleTagWrap?: boolean): string;
77
+ static generateStyleTransform(styleBody: string | string[], componentKey: string, styleTagWrap?: boolean): string;
69
78
  applyEvent(obj: any, fragment?: DocumentFragment, config?: Config): void;
70
79
  getAttribute(element: Element, attr: string): string | null;
71
80
  getAttributeAndDelete(element: Element, attr: string): string | null;
@@ -79,7 +88,10 @@ export declare class RawSet {
79
88
  start: Comment;
80
89
  end: Comment;
81
90
  };
91
+ remove(): void;
82
92
  childAllRemove(): void;
93
+ childs(stopNext?: (node: Node) => boolean): ChildNode[] | undefined;
94
+ getHasRawSet(key: string): RawSet | undefined;
83
95
  static drItOtherEncoding(element: Element | DocumentFragment): string;
84
96
  static drItOtherDecoding(element: Element | DocumentFragment, random: string): void;
85
97
  static drThisEncoding(element: Element, drThis: string): string;