dom-render 1.0.93 → 1.0.95

Sign up to get free protection for your applications and to get access to all the features.
@@ -203,6 +203,7 @@ var EventManager = /** @class */ (function () {
203
203
  EventManager.prototype.changeVar = function (obj, elements, varName, config) {
204
204
  var _this = this;
205
205
  // console.log('-changeVar-->', obj, elements, varName);
206
+ // forEach elements
206
207
  // value-link event
207
208
  this.procAttr(elements, EventManager.valueLinkAttrName, function (it, attribute) {
208
209
  var ownerVariablePathName = it.getAttribute(EventManager.ownerVariablePathAttrName);
@@ -36,7 +36,7 @@ var Appender = /** @class */ (function () {
36
36
  for (var _i = 0; _i < arguments.length; _i++) {
37
37
  items[_i] = arguments[_i];
38
38
  }
39
- // console.log('----2>', this.length)
39
+ // console.log('----2>', items, this.length);
40
40
  items.index = this.length;
41
41
  this[this.length++] = items;
42
42
  // console.log('---22->', this.length)
@@ -44,6 +44,14 @@ var Appender = /** @class */ (function () {
44
44
  // appender.values = items;
45
45
  // this.childs.push(new Appender(appender.index + 1));
46
46
  };
47
+ // delete(idx: number): void {
48
+ // // if (idx in this) {
49
+ // // console.log('---------dele',idx)
50
+ // // delete this[idx];
51
+ // // this.length = this.length - 1;
52
+ // // }
53
+ // this.length = this.length - 1;
54
+ // }
47
55
  Appender.prototype.clear = function () {
48
56
  // console.log('length', this.length);
49
57
  for (var i = 0; i < this.length; i++) {
@@ -0,0 +1,11 @@
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
+ import { Config } from '../configs/Config';
6
+ export declare class DrDictionary extends OperatorExecuterAttrRequire<string> {
7
+ constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
8
+ executeAttrRequire(attr: string): Promise<ExecuteState>;
9
+ static getChildren(rawSet: RawSet, config: Config): Map<string, Node[]>;
10
+ static append(obj: any, fullPath: string, key: string, rawSet: RawSet, config: Config): RawSet[];
11
+ }
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ };
37
+ var __generator = (this && this.__generator) || function (thisArg, body) {
38
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
39
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
+ function verb(n) { return function (v) { return step([n, v]); }; }
41
+ function step(op) {
42
+ if (f) throw new TypeError("Generator is already executing.");
43
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
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
+ if (y = 0, t) op = [op[0] & 2, t.value];
46
+ switch (op[0]) {
47
+ case 0: case 1: t = op; break;
48
+ case 4: _.label++; return { value: op[1], done: false };
49
+ case 5: _.label++; y = op[1]; op = [0]; continue;
50
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
51
+ default:
52
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
53
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
55
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
56
+ if (t[2]) _.ops.pop();
57
+ _.trys.pop(); continue;
58
+ }
59
+ op = body.call(thisArg, _);
60
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
61
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
+ }
63
+ };
64
+ Object.defineProperty(exports, "__esModule", { value: true });
65
+ exports.DrDictionary = void 0;
66
+ var OperatorExecuterAttrRequire_1 = require("./OperatorExecuterAttrRequire");
67
+ var ScriptUtils_1 = require("../utils/script/ScriptUtils");
68
+ var RawSet_1 = require("../rawsets/RawSet");
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) {
73
+ source.operatorAround = undefined;
74
+ return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
75
+ }
76
+ DrDictionary.prototype.executeAttrRequire = function (attr) {
77
+ var _a, _b, _c, _d, _e;
78
+ return __awaiter(this, void 0, void 0, function () {
79
+ var itRandom, vars, newTemp, dictioanry, dictionaryKey, tempalte, rr;
80
+ var _f;
81
+ return __generator(this, function (_g) {
82
+ itRandom = RawSet_1.RawSet.drItOtherEncoding(this.elementSource.element);
83
+ vars = RawSet_1.RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
84
+ newTemp = this.source.config.window.document.createElement('temp');
85
+ dictioanry = ScriptUtils_1.ScriptUtils.evalReturn(attr, this.source.obj);
86
+ dictionaryKey = (_b = this.elementSource.attrs.drDictionaryOption) !== null && _b !== void 0 ? _b : '';
87
+ // console.log('--->', attr, dictionaryKey)
88
+ // if (!(dictioanry instanceof Dictionary)) {
89
+ // return ExecuteState.STOP;
90
+ // }
91
+ // await new Promise(resolve => setTimeout(resolve, 1000));
92
+ // 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, {
94
+ __render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet_1.RawSet.drAttrsOriginName, fag: newTemp }, this.render))
95
+ }));
96
+ RawSet_1.RawSet.drVarDecoding(newTemp, vars);
97
+ RawSet_1.RawSet.drItOtherDecoding(newTemp, itRandom);
98
+ tempalte = this.source.config.window.document.createElement('template');
99
+ tempalte.innerHTML = newTemp.innerHTML;
100
+ this.returnContainer.fag.append(tempalte.content);
101
+ rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
102
+ (_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
103
+ // const rrr = rr.flatMap(it => it.render(obj, config));// .flat();
104
+ (_f = this.returnContainer.raws).push.apply(_f, rr);
105
+ return [2 /*return*/, OperatorExecuter_1.ExecuteState.EXECUTE];
106
+ });
107
+ });
108
+ };
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) {
132
+ var _this = this;
133
+ var _a, _b;
134
+ var genNode = config.window.document.importNode(rawSet.fragment, true);
135
+ // console.log('---> append', rawSet, genNode);
136
+ var rawSets = [];
137
+ for (var _i = 0, _c = Array.from(genNode.childNodes.values()); _i < _c.length; _i++) {
138
+ var cNode = _c[_i];
139
+ var element = cNode.cloneNode(true);
140
+ element.removeAttribute('dr-dictionary');
141
+ element.setAttribute('dr-this', "this.".concat(fullPath));
142
+ // rawSet.point.end.after(element);
143
+ var fg = config.window.document.createDocumentFragment();
144
+ fg.append(element);
145
+ rawSets.push.apply(rawSets, RawSet_1.RawSet.checkPointCreates(fg, obj, config));
146
+ rawSet.point.end.before(fg);
147
+ 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 : [];
149
+ keys.push(key);
150
+ start.setAttribute('dictionary-keys', keys.join(','));
151
+ rawSets.forEach(function (it) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
152
+ switch (_a.label) {
153
+ case 0: return [4 /*yield*/, it.render(obj, config)];
154
+ case 1: return [2 /*return*/, _a.sent()];
155
+ }
156
+ }); }); });
157
+ // console.log('WWW', fg, Array.from(fg.childNodes));
158
+ // console.log('--------------------------rawSets', rawSets);
159
+ }
160
+ return rawSets;
161
+ // rawSet.
162
+ // rawSet.point.end.before()
163
+ };
164
+ return DrDictionary;
165
+ }(OperatorExecuterAttrRequire_1.OperatorExecuterAttrRequire));
166
+ exports.DrDictionary = DrDictionary;
@@ -83,9 +83,11 @@ var DrThis = /** @class */ (function (_super) {
83
83
  this.afterCallBack.onThisComponentSetCallBacks.push(attr);
84
84
  return [3 /*break*/, 4];
85
85
  case 2:
86
+ // console.log('dr-this!!!!!!!', this.rawSet, this.source.obj)
86
87
  _g = (_f = this.returnContainer.fag).append;
87
88
  return [4 /*yield*/, RawSet_1.RawSet.drThisCreate(this.rawSet, this.elementSource.element, this.elementSource.attrs.drThis, (_d = this.elementSource.attrs.drVarOption) !== null && _d !== void 0 ? _d : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config)];
88
89
  case 3:
90
+ // console.log('dr-this!!!!!!!', this.rawSet, this.source.obj)
89
91
  _g.apply(_f, [_j.sent()]);
90
92
  _j.label = 4;
91
93
  case 4:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dom-render",
3
- "version": "1.0.93",
3
+ "version": "1.0.95",
4
4
  "main": "DomRender.js",
5
5
  "license": "MIT",
6
6
  "description": "html view template engine",
@@ -4,6 +4,7 @@ export type Attrs = {
4
4
  drAppender: string | null;
5
5
  drFor: string | null;
6
6
  drForOf: string | null;
7
+ drDictionary: string | null;
7
8
  drRepeat: string | null;
8
9
  drThis: string | null;
9
10
  drForm: string | null;
@@ -18,4 +19,5 @@ export type Attrs = {
18
19
  drCompleteOption: string | null;
19
20
  drStripOption: string | null;
20
21
  drDestroyOption: string | null;
22
+ drDictionaryOption: string | null;
21
23
  };
@@ -24,6 +24,7 @@ export declare class RawSet {
24
24
  static readonly DR_IF_NAME = "dr-if";
25
25
  static readonly DR_FOR_NAME = "dr-for";
26
26
  static readonly DR_FOR_OF_NAME = "dr-for-of";
27
+ static readonly DR_DICTIONARY_NAME = "dr-dictionary";
27
28
  static readonly DR_REPEAT_NAME = "dr-repeat";
28
29
  static readonly DR_THIS_NAME = "dr-this";
29
30
  static readonly DR_FORM_NAME = "dr-form";
@@ -42,13 +43,14 @@ export declare class RawSet {
42
43
  static readonly DR_DESTROY_OPTIONNAME = "dr-destroy";
43
44
  static readonly DR_COMPONENT_NAME_OPTIONNAME = "dr-component-name";
44
45
  static readonly DR_COMPONENT_INNER_HTML_NAME_OPTIONNAME = "dr-component-inner-html-name";
46
+ static readonly DR_DICTIONARY_OPTIONKEYNAME = "dr-dictionary-key";
45
47
  static readonly DR_ON_CREATE_ARGUMENTS_OPTIONNAME = "dr-on-create:arguments";
46
48
  static readonly DR_ON_CREATED_CALLBACK_OPTIONNAME = "dr-on-create:callback";
47
49
  static readonly DR_ON_INIT_ARGUMENTS_OPTIONNAME = "dr-on-init:arguments";
48
50
  static readonly DR_ON_CONSTRUCTOR_ARGUMENTS_OPTIONNAME = "dr-on-constructor:arguments";
49
51
  static readonly drAttrsOriginName: Attrs;
50
52
  static readonly DR_TAGS: never[];
51
- static readonly DR_ATTRIBUTES: readonly ["dr", "dr-appender", "dr-if", "dr-for-of", "dr-for", "dr-this", "dr-form", "dr-pre", "dr-inner-html", "dr-inner-text", "dr-repeat", "dr-detect"];
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"];
52
54
  constructor(uuid: string, type: RawSetType, point: {
53
55
  start: Comment | Text | HTMLMetaElement;
54
56
  node: Node;
@@ -70,7 +72,7 @@ export declare class RawSet {
70
72
  getDrAppendAttributeAndDelete(element: Element, obj: any): string | null;
71
73
  replaceBody(genNode: Node): void;
72
74
  static checkPointCreates(element: Node, obj: any, config: Config): RawSet[];
73
- static createStartEndPoint(id: string, type: RawSetType, config: Config): {
75
+ static createStartEndPoint(node: Node, id: string, type: RawSetType, config: Config): {
74
76
  start: HTMLMetaElement;
75
77
  end: HTMLMetaElement;
76
78
  } | {
package/rawsets/RawSet.js CHANGED
@@ -80,6 +80,7 @@ var DrTargetElement_1 = require("../operators/DrTargetElement");
80
80
  var DrTargetAttr_1 = require("../operators/DrTargetAttr");
81
81
  var DestroyOptionType_1 = require("./DestroyOptionType");
82
82
  var RawSetType_1 = require("./RawSetType");
83
+ var DrDictionary_1 = require("../operators/DrDictionary");
83
84
  var RawSet = /** @class */ (function () {
84
85
  function RawSet(uuid, type, point, fragment, detect, data) {
85
86
  this.uuid = uuid;
@@ -145,12 +146,12 @@ var RawSet = /** @class */ (function () {
145
146
  };
146
147
  // 중요 render 처리 부분
147
148
  RawSet.prototype.render = function (obj, config) {
148
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
149
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
149
150
  return __awaiter(this, void 0, void 0, function () {
150
- var genNode, raws, onAttrInitCallBacks, onElementInitCallBacks, onThisComponentSetCallBacks, drAttrs, _i, _y, cNode, attribute, __render, fag, textContent, runText, newNode, r, template, r, element, drAttr, operators, _z, operators_1, operator, state, _0, onThisComponentSetCallBacks_1, it_1, _1, onElementInitCallBacks_1, it_2, oninit, param, script, _2, onAttrInitCallBacks_1, it_3;
151
+ var genNode, raws, onAttrInitCallBacks, onElementInitCallBacks, onThisComponentSetCallBacks, drAttrs, _i, _z, cNode, attribute, __render, fag, textContent, runText, newNode, r, template, r, element, drAttr, operators, _0, operators_1, operator, state, _1, onThisComponentSetCallBacks_1, it_1, _2, onElementInitCallBacks_1, it_2, oninit, param, script, _3, onAttrInitCallBacks_1, it_3;
151
152
  var _this = this;
152
- return __generator(this, function (_3) {
153
- switch (_3.label) {
153
+ return __generator(this, function (_4) {
154
+ switch (_4.label) {
154
155
  case 0:
155
156
  genNode = config.window.document.importNode(this.fragment, true);
156
157
  raws = [];
@@ -158,11 +159,11 @@ var RawSet = /** @class */ (function () {
158
159
  onElementInitCallBacks = [];
159
160
  onThisComponentSetCallBacks = [];
160
161
  drAttrs = [];
161
- _i = 0, _y = Array.from(genNode.childNodes.values());
162
- _3.label = 1;
162
+ _i = 0, _z = Array.from(genNode.childNodes.values());
163
+ _4.label = 1;
163
164
  case 1:
164
- if (!(_i < _y.length)) return [3 /*break*/, 7];
165
- cNode = _y[_i];
165
+ if (!(_i < _z.length)) return [3 /*break*/, 7];
166
+ cNode = _z[_i];
166
167
  attribute = {};
167
168
  if (cNode.nodeType === Node.ELEMENT_NODE) {
168
169
  attribute = DomUtils_1.DomUtils.getAttributeToObject(cNode);
@@ -207,6 +208,7 @@ var RawSet = /** @class */ (function () {
207
208
  drIf: this.getAttributeAndDelete(element, RawSet.DR_IF_NAME),
208
209
  drFor: this.getAttributeAndDelete(element, RawSet.DR_FOR_NAME),
209
210
  drForOf: this.getAttributeAndDelete(element, RawSet.DR_FOR_OF_NAME),
211
+ drDictionary: this.getAttributeAndDelete(element, RawSet.DR_DICTIONARY_NAME),
210
212
  drAppender: this.getAttributeAndDelete(element, RawSet.DR_APPENDER_NAME),
211
213
  drRepeat: this.getAttributeAndDelete(element, RawSet.DR_REPEAT_NAME),
212
214
  drThis: this.getAttributeAndDelete(element, RawSet.DR_THIS_NAME),
@@ -221,7 +223,8 @@ var RawSet = /** @class */ (function () {
221
223
  drBeforeOption: this.getAttributeAndDelete(element, RawSet.DR_BEFORE_OPTIONNAME),
222
224
  drCompleteOption: this.getAttributeAndDelete(element, RawSet.DR_COMPLETE_OPTIONNAME),
223
225
  drStripOption: this.getAttributeAndDelete(element, RawSet.DR_STRIP_OPTIONNAME),
224
- drDestroyOption: this.getAttributeAndDelete(element, RawSet.DR_DESTROY_OPTIONNAME)
226
+ drDestroyOption: this.getAttributeAndDelete(element, RawSet.DR_DESTROY_OPTIONNAME),
227
+ drDictionaryOption: this.getAttributeAndDelete(element, RawSet.DR_DICTIONARY_OPTIONKEYNAME)
225
228
  };
226
229
  drAttrs.push(drAttr);
227
230
  operators = [
@@ -234,28 +237,29 @@ var RawSet = /** @class */ (function () {
234
237
  new DrInnerHTML_1.DrInnerHTML(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_INNERHTML_NAME, attr: drAttr.drInnerHTML, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_h = config.operatorAround) === null || _h === void 0 ? void 0 : _h.drInnerHTML }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
235
238
  new DrFor_1.DrFor(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_FOR_NAME, attr: drAttr.drFor, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_j = config.operatorAround) === null || _j === void 0 ? void 0 : _j.drFor }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
236
239
  new DrForOf_1.DrForOf(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_FOR_OF_NAME, attr: drAttr.drForOf, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_k = config.operatorAround) === null || _k === void 0 ? void 0 : _k.drForOf }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
237
- new DrAppender_1.DrAppender(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_APPENDER_NAME, attr: drAttr.drAppender, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_l = config.operatorAround) === null || _l === void 0 ? void 0 : _l.drAppender }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
238
- new DrRepeat_1.DrRepeat(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_REPEAT_NAME, attr: drAttr.drRepeat, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_m = config.operatorAround) === null || _m === void 0 ? void 0 : _m.drRepeat }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
240
+ new DrDictionary_1.DrDictionary(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_DICTIONARY_NAME, attr: drAttr.drDictionary, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_l = config.operatorAround) === null || _l === void 0 ? void 0 : _l.drDictionary }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
241
+ new DrAppender_1.DrAppender(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_APPENDER_NAME, attr: drAttr.drAppender, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_m = config.operatorAround) === null || _m === void 0 ? void 0 : _m.drAppender }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
242
+ new DrRepeat_1.DrRepeat(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_REPEAT_NAME, attr: drAttr.drRepeat, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_o = config.operatorAround) === null || _o === void 0 ? void 0 : _o.drRepeat }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
239
243
  new DrTargetElement_1.DrTargetElement(this, __render, { raws: raws, fag: fag }, { element: element, attrs: drAttr }, { config: config, obj: obj }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
240
244
  new DrTargetAttr_1.DrTargetAttr(this, __render, { raws: raws, fag: fag }, { element: element, attrs: drAttr }, { config: config, obj: obj }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks })
241
245
  ];
242
- _z = 0, operators_1 = operators;
243
- _3.label = 3;
246
+ _0 = 0, operators_1 = operators;
247
+ _4.label = 3;
244
248
  case 3:
245
- if (!(_z < operators_1.length)) return [3 /*break*/, 6];
246
- operator = operators_1[_z];
249
+ if (!(_0 < operators_1.length)) return [3 /*break*/, 6];
250
+ operator = operators_1[_0];
247
251
  return [4 /*yield*/, operator.start()];
248
252
  case 4:
249
- state = _3.sent();
253
+ state = _4.sent();
250
254
  if (state === OperatorExecuter_1.ExecuteState.EXECUTE) {
251
255
  return [3 /*break*/, 6];
252
256
  }
253
257
  else if (state === OperatorExecuter_1.ExecuteState.STOP) {
254
258
  return [2 /*return*/, raws];
255
259
  }
256
- _3.label = 5;
260
+ _4.label = 5;
257
261
  case 5:
258
- _z++;
262
+ _0++;
259
263
  return [3 /*break*/, 3];
260
264
  case 6:
261
265
  _i++;
@@ -276,13 +280,13 @@ var RawSet = /** @class */ (function () {
276
280
  });
277
281
  // 중요 style isolation 나중에 :scope로 대체 가능할듯.
278
282
  RawSet.generateStyleSheetsLocal();
279
- for (_0 = 0, onThisComponentSetCallBacks_1 = onThisComponentSetCallBacks; _0 < onThisComponentSetCallBacks_1.length; _0++) {
280
- it_1 = onThisComponentSetCallBacks_1[_0];
281
- (_p = (_o = it_1.obj) === null || _o === void 0 ? void 0 : _o.onInitRender) === null || _p === void 0 ? void 0 : _p.call(_o);
283
+ for (_1 = 0, onThisComponentSetCallBacks_1 = onThisComponentSetCallBacks; _1 < onThisComponentSetCallBacks_1.length; _1++) {
284
+ it_1 = onThisComponentSetCallBacks_1[_1];
285
+ (_q = (_p = it_1.obj) === null || _p === void 0 ? void 0 : _p.onInitRender) === null || _q === void 0 ? void 0 : _q.call(_p);
282
286
  }
283
- for (_1 = 0, onElementInitCallBacks_1 = onElementInitCallBacks; _1 < onElementInitCallBacks_1.length; _1++) {
284
- it_2 = onElementInitCallBacks_1[_1];
285
- if (((_r = (_q = it_2.targetElement) === null || _q === void 0 ? void 0 : _q.__render) === null || _r === void 0 ? void 0 : _r.element) && ((_t = (_s = it_2.targetElement) === null || _s === void 0 ? void 0 : _s.__render) === null || _t === void 0 ? void 0 : _t.component)) {
287
+ for (_2 = 0, onElementInitCallBacks_1 = onElementInitCallBacks; _2 < onElementInitCallBacks_1.length; _2++) {
288
+ it_2 = onElementInitCallBacks_1[_2];
289
+ if (((_s = (_r = it_2.targetElement) === null || _r === void 0 ? void 0 : _r.__render) === null || _s === void 0 ? void 0 : _s.element) && ((_u = (_t = it_2.targetElement) === null || _t === void 0 ? void 0 : _t.__render) === null || _u === void 0 ? void 0 : _u.component)) {
286
290
  oninit = it_2.targetElement.__render.element.getAttribute(RawSet.DR_ON_INIT_ARGUMENTS_OPTIONNAME);
287
291
  param = [];
288
292
  if (oninit) {
@@ -294,14 +298,14 @@ var RawSet = /** @class */ (function () {
294
298
  param = [param];
295
299
  }
296
300
  }
297
- (_v = (_u = it_2.targetElement.__render.component).onInitRender) === null || _v === void 0 ? void 0 : _v.call.apply(_v, __spreadArray([_u], param, false));
301
+ (_w = (_v = it_2.targetElement.__render.component).onInitRender) === null || _w === void 0 ? void 0 : _w.call.apply(_w, __spreadArray([_v], param, false));
298
302
  }
299
- (_w = config === null || config === void 0 ? void 0 : config.onElementInit) === null || _w === void 0 ? void 0 : _w.call(config, it_2.name, obj, this, it_2.targetElement);
303
+ (_x = config === null || config === void 0 ? void 0 : config.onElementInit) === null || _x === void 0 ? void 0 : _x.call(config, it_2.name, obj, this, it_2.targetElement);
300
304
  }
301
305
  // TODO: 이부분도 위에 targetElement 처럼 해야될까?
302
- for (_2 = 0, onAttrInitCallBacks_1 = onAttrInitCallBacks; _2 < onAttrInitCallBacks_1.length; _2++) {
303
- it_3 = onAttrInitCallBacks_1[_2];
304
- (_x = config === null || config === void 0 ? void 0 : config.onAttrInit) === null || _x === void 0 ? void 0 : _x.call(config, it_3.attrName, it_3.attrValue, obj, this);
306
+ for (_3 = 0, onAttrInitCallBacks_1 = onAttrInitCallBacks; _3 < onAttrInitCallBacks_1.length; _3++) {
307
+ it_3 = onAttrInitCallBacks_1[_3];
308
+ (_y = config === null || config === void 0 ? void 0 : config.onAttrInit) === null || _y === void 0 ? void 0 : _y.call(config, it_3.attrName, it_3.attrValue, obj, this);
305
309
  }
306
310
  // component destroy
307
311
  if (obj.__domrender_components) {
@@ -499,9 +503,10 @@ var RawSet = /** @class */ (function () {
499
503
  else {
500
504
  type = RawSetType_1.RawSetType.TEXT;
501
505
  }
502
- var startEndPoint = RawSet.createStartEndPoint(it_4.uuid, type, config);
506
+ var node = document.createTextNode(preparedText);
507
+ var startEndPoint = RawSet.createStartEndPoint(node, it_4.uuid, type, config);
503
508
  // layout setting
504
- template.content.append(document.createTextNode(preparedText)); // 앞 부분 넣고
509
+ template.content.append(node); // 앞 부분 넣고
505
510
  template.content.append(startEndPoint.start); // add start checkpoint
506
511
  template.content.append(startEndPoint.end); // add end checkpoint
507
512
  // content 안쪽 RawSet render 할때 start 와 end 사이에 fragment 연산해서 들어간다.
@@ -524,7 +529,7 @@ var RawSet = /** @class */ (function () {
524
529
  var element_3 = currentNode;
525
530
  var fragment = config.window.document.createDocumentFragment();
526
531
  var type = RawSetType_1.RawSetType.TARGET_ELEMENT;
527
- var startEndPoint = RawSet.createStartEndPoint(uuid, type, config);
532
+ var startEndPoint = RawSet.createStartEndPoint(element_3, uuid, type, config);
528
533
  var isElement = ((_d = (_c = config.targetElements) === null || _c === void 0 ? void 0 : _c.map(function (it) { return it.name.toLowerCase(); })) !== null && _d !== void 0 ? _d : []).includes(element_3.tagName.toLowerCase());
529
534
  var targetAttrNames_2 = ((_f = (_e = config.targetAttrs) === null || _e === void 0 ? void 0 : _e.map(function (it) { return it.name; })) !== null && _f !== void 0 ? _f : []).concat(RawSet.DR_ATTRIBUTES);
530
535
  var isAttr = element_3.getAttributeNames().filter(function (it) { return targetAttrNames_2.includes(it.toLowerCase()); }).length > 0;
@@ -547,11 +552,20 @@ var RawSet = /** @class */ (function () {
547
552
  // console.log('check-->', pars)
548
553
  return pars;
549
554
  };
550
- RawSet.createStartEndPoint = function (id, type, config) {
555
+ RawSet.createStartEndPoint = function (node, id, type, config) {
551
556
  if (type === RawSetType_1.RawSetType.TARGET_ELEMENT) {
557
+ var element = node;
552
558
  var start = config.window.document.createElement('meta');
553
559
  var end = config.window.document.createElement('meta');
554
560
  start.setAttribute('id', "".concat(id, "-start"));
561
+ var dictionaryKey = element.getAttribute('dr-dictionary-key');
562
+ var dictionary = element.getAttribute('dr-dictionary');
563
+ if (dictionary) {
564
+ start.setAttribute('type', 'dictionary');
565
+ }
566
+ if (dictionaryKey) {
567
+ start.setAttribute('dictionary-key', dictionaryKey);
568
+ }
555
569
  end.setAttribute('id', "".concat(id, "-end"));
556
570
  return {
557
571
  start: start,
@@ -1002,6 +1016,7 @@ var RawSet = /** @class */ (function () {
1002
1016
  RawSet.DR_IF_NAME = 'dr-if';
1003
1017
  RawSet.DR_FOR_NAME = 'dr-for';
1004
1018
  RawSet.DR_FOR_OF_NAME = 'dr-for-of';
1019
+ RawSet.DR_DICTIONARY_NAME = 'dr-dictionary';
1005
1020
  RawSet.DR_REPEAT_NAME = 'dr-repeat';
1006
1021
  RawSet.DR_THIS_NAME = 'dr-this';
1007
1022
  RawSet.DR_FORM_NAME = 'dr-form';
@@ -1020,6 +1035,7 @@ var RawSet = /** @class */ (function () {
1020
1035
  RawSet.DR_DESTROY_OPTIONNAME = 'dr-destroy';
1021
1036
  RawSet.DR_COMPONENT_NAME_OPTIONNAME = 'dr-component-name';
1022
1037
  RawSet.DR_COMPONENT_INNER_HTML_NAME_OPTIONNAME = 'dr-component-inner-html-name';
1038
+ RawSet.DR_DICTIONARY_OPTIONKEYNAME = 'dr-dictionary-key';
1023
1039
  RawSet.DR_ON_CREATE_ARGUMENTS_OPTIONNAME = 'dr-on-create:arguments';
1024
1040
  RawSet.DR_ON_CREATED_CALLBACK_OPTIONNAME = 'dr-on-create:callback';
1025
1041
  RawSet.DR_ON_INIT_ARGUMENTS_OPTIONNAME = 'dr-on-init:arguments';
@@ -1029,6 +1045,7 @@ var RawSet = /** @class */ (function () {
1029
1045
  drIf: RawSet.DR_IF_NAME,
1030
1046
  drFor: RawSet.DR_FOR_NAME,
1031
1047
  drForOf: RawSet.DR_FOR_OF_NAME,
1048
+ drDictionary: RawSet.DR_DICTIONARY_NAME,
1032
1049
  drAppender: RawSet.DR_APPENDER_NAME,
1033
1050
  drRepeat: RawSet.DR_REPEAT_NAME,
1034
1051
  drThis: RawSet.DR_THIS_NAME,
@@ -1043,10 +1060,11 @@ var RawSet = /** @class */ (function () {
1043
1060
  drBeforeOption: RawSet.DR_BEFORE_OPTIONNAME,
1044
1061
  drCompleteOption: RawSet.DR_COMPLETE_OPTIONNAME,
1045
1062
  drStripOption: RawSet.DR_STRIP_OPTIONNAME,
1046
- drDestroyOption: RawSet.DR_DESTROY_OPTIONNAME
1063
+ drDestroyOption: RawSet.DR_DESTROY_OPTIONNAME,
1064
+ drDictionaryOption: RawSet.DR_DICTIONARY_OPTIONKEYNAME
1047
1065
  };
1048
1066
  RawSet.DR_TAGS = [];
1049
- RawSet.DR_ATTRIBUTES = [RawSet.DR_NAME, RawSet.DR_APPENDER_NAME, RawSet.DR_IF_NAME, RawSet.DR_FOR_OF_NAME, RawSet.DR_FOR_NAME, RawSet.DR_THIS_NAME, RawSet.DR_FORM_NAME, RawSet.DR_PRE_NAME, RawSet.DR_INNERHTML_NAME, RawSet.DR_INNERTEXT_NAME, RawSet.DR_REPEAT_NAME, RawSet.DR_DETECT_NAME];
1067
+ RawSet.DR_ATTRIBUTES = [RawSet.DR_NAME, RawSet.DR_APPENDER_NAME, RawSet.DR_IF_NAME, RawSet.DR_FOR_OF_NAME, RawSet.DR_DICTIONARY_NAME, RawSet.DR_FOR_NAME, RawSet.DR_THIS_NAME, RawSet.DR_FORM_NAME, RawSet.DR_PRE_NAME, RawSet.DR_INNERHTML_NAME, RawSet.DR_INNERTEXT_NAME, RawSet.DR_REPEAT_NAME, RawSet.DR_DETECT_NAME];
1050
1068
  return RawSet;
1051
1069
  }());
1052
1070
  exports.RawSet = RawSet;