dom-render 1.0.96 → 1.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DomRender.d.ts +1 -1
- package/DomRender.js +3 -3
- package/DomRenderProxy.js +12 -14
- package/README.MD +41 -0
- package/components/ComponentSet.d.ts +1 -1
- package/configs/Config.d.ts +1 -1
- package/configs/TargetAttr.d.ts +1 -1
- package/configs/TargetElement.d.ts +1 -1
- package/css/parse/index.d.ts +1 -0
- package/css/parse/index.js +512 -0
- package/css/stringify/compiler.d.ts +32 -0
- package/css/stringify/compiler.js +40 -0
- package/css/stringify/compress.d.ts +75 -0
- package/css/stringify/compress.js +156 -0
- package/css/stringify/identity.d.ts +85 -0
- package/css/stringify/identity.js +194 -0
- package/css/stringify/index.d.ts +14 -0
- package/css/stringify/index.js +44 -0
- package/dist/bundle.js +1075 -328
- package/events/EventManager.js +27 -27
- package/iterators/Range.d.ts +1 -0
- package/iterators/Range.js +15 -0
- package/messenger/Messenger.d.ts +4 -4
- package/operators/Dr.js +2 -2
- package/operators/DrAppender.js +5 -3
- package/operators/DrFor.js +5 -3
- package/operators/DrForOf.js +5 -3
- package/operators/DrForm.js +12 -12
- package/operators/DrIf.js +5 -3
- package/operators/DrInnerHTML.js +2 -2
- package/operators/DrInnerText.js +2 -2
- package/operators/DrPre.js +4 -2
- package/operators/DrRepeat.js +5 -3
- package/operators/DrTargetAttr.js +4 -2
- package/operators/DrTargetElement.js +5 -3
- package/operators/DrThis.js +2 -2
- package/operators/DrThisProperty.js +6 -4
- package/operators/OperatorExecuter.d.ts +5 -5
- package/operators/OperatorExecuter.js +2 -2
- package/operators/OperatorExecuterAttrRequire.js +1 -1
- package/package.json +3 -3
- package/rawsets/AttrInitCallBack.d.ts +1 -1
- package/rawsets/Attrs.d.ts +1 -1
- package/rawsets/CreatorMetaData.d.ts +1 -1
- package/rawsets/ElementInitCallBack.d.ts +1 -1
- package/rawsets/RawSet.d.ts +6 -2
- package/rawsets/RawSet.js +93 -54
- package/rawsets/Render.d.ts +1 -1
- package/routers/Router.d.ts +1 -1
- package/routers/Router.js +1 -1
- package/utils/dom/DomUtils.d.ts +1 -1
- package/utils/node/NodeUtils.d.ts +1 -1
- package/utils/script/ScriptUtils.js +2 -2
- package/utils/storage/StorageUtils.d.ts +7 -0
- package/utils/storage/StorageUtils.js +39 -0
- package/utils/string/StringUtils.d.ts +1 -0
- package/utils/string/StringUtils.js +17 -0
- package/validators/EmptyValidator.js +2 -2
- package/validators/NotEmptyValidator.js +2 -2
- package/validators/ValidMultipleValidator.d.ts +1 -1
- package/validators/Validator.d.ts +2 -2
- package/validators/ValidatorArray.d.ts +1 -1
package/DomRender.d.ts
CHANGED
@@ -2,7 +2,7 @@ import { Config } from './configs/Config';
|
|
2
2
|
import { ConstructorType } from './types/Types';
|
3
3
|
import { RawSet } from './rawsets/RawSet';
|
4
4
|
export declare class DomRender {
|
5
|
-
static run<T extends object>(obj: T, target?: Node | null, oConfig?:
|
5
|
+
static run<T extends object>(obj: T, target?: Node | null, oConfig?: Config): T;
|
6
6
|
static createComponent(param: {
|
7
7
|
type: ConstructorType<any> | any;
|
8
8
|
tagName?: string;
|
package/DomRender.js
CHANGED
@@ -20,7 +20,7 @@ var DomRender = /** @class */ (function () {
|
|
20
20
|
function DomRender() {
|
21
21
|
}
|
22
22
|
DomRender.run = function (obj, target, oConfig) {
|
23
|
-
var _a, _b, _c
|
23
|
+
var _a, _b, _c;
|
24
24
|
var robj = obj;
|
25
25
|
if ('_DomRender_isProxy' in obj) {
|
26
26
|
if (target) {
|
@@ -48,8 +48,8 @@ var DomRender = /** @class */ (function () {
|
|
48
48
|
config.router = (_c = config.router) !== null && _c !== void 0 ? _c : new HashRouter_1.HashRouter(robj, config.window);
|
49
49
|
}
|
50
50
|
else { // default
|
51
|
-
config.routerType = 'hash';
|
52
|
-
config.router =
|
51
|
+
// config.routerType = 'hash';
|
52
|
+
// config.router = config.router ?? new HashRouter(robj, config.window);
|
53
53
|
}
|
54
54
|
domRender.run(robj);
|
55
55
|
return robj;
|
package/DomRenderProxy.js
CHANGED
@@ -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 (
|
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]) {
|
@@ -76,9 +76,9 @@ var DomRenderProxy = /** @class */ (function () {
|
|
76
76
|
};
|
77
77
|
DomRenderProxy.prototype.run = function (objProxy) {
|
78
78
|
var _this = this;
|
79
|
-
var _a;
|
79
|
+
var _a, _b;
|
80
80
|
this._domRender_proxy = objProxy;
|
81
|
-
(_a = objProxy === null ||
|
81
|
+
(_b = (_a = objProxy) === null || _a === void 0 ? void 0 : _a.onProxyDomRender) === null || _b === void 0 ? void 0 : _b.call(_a, this.config);
|
82
82
|
var obj = objProxy._DomRender_origin;
|
83
83
|
if (obj) {
|
84
84
|
Object.keys(obj).forEach(function (it) {
|
@@ -193,11 +193,11 @@ var DomRenderProxy = /** @class */ (function () {
|
|
193
193
|
new Map(JSON.parse(targetAttrMap)).forEach(function (v, k) {
|
194
194
|
var _a;
|
195
195
|
// it?.data.onChangeAttrRender(k, null, v);
|
196
|
-
var isUsing = EventManager_1.EventManager.isUsingThisVar(v, "this."
|
196
|
+
var isUsing = EventManager_1.EventManager.isUsingThisVar(v, "this." + fullPathStr);
|
197
197
|
if (isUsing) {
|
198
198
|
var render = it_1.fragment.render;
|
199
199
|
// console.log('render-->', (it.fragment as any).render)
|
200
|
-
var script =
|
200
|
+
var script = render.renderScript + " return " + v + " ";
|
201
201
|
var cval = ScriptUtils_1.ScriptUtils.eval(script, Object.assign((_a = _this._domRender_proxy) !== null && _a !== void 0 ? _a : {}, { __render: render }));
|
202
202
|
it_1.data.onChangeAttrRender(k, cval);
|
203
203
|
}
|
@@ -269,7 +269,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
269
269
|
// const firstPathStr = paths.slice(1).reverse().join('.');
|
270
270
|
var strings = paths.reverse();
|
271
271
|
// array같은경우도 키값으로 접근하기때문에 특정 인덱스를 찾아서 그부분만 바꿔줄수 있다.
|
272
|
-
var fullPathStr_1 = strings.map(function (it) { return isNaN(Number(it)) ? '.' + it : "["
|
272
|
+
var fullPathStr_1 = strings.map(function (it) { return isNaN(Number(it)) ? '.' + it : "[" + it + "]"; }).join('').slice(1);
|
273
273
|
// console.log('-------fullPathStr', fullPathStr, lastDoneExecute);
|
274
274
|
if (lastDoneExecute) {
|
275
275
|
// const firstData = ScriptUtils.evalReturn('this.' + firstPathStr, this._domRender_proxy);
|
@@ -278,7 +278,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
278
278
|
// }
|
279
279
|
var iterable_1 = this._rawSets.get(fullPathStr_1);
|
280
280
|
// array check
|
281
|
-
var front_1 = strings.slice(0, strings.length - 1).map(function (it) { return isNaN(Number(it)) ? '.' + it : "["
|
281
|
+
var front_1 = strings.slice(0, strings.length - 1).map(function (it) { return isNaN(Number(it)) ? '.' + it : "[" + it + "]"; }).join('');
|
282
282
|
var last_1 = strings[strings.length - 1];
|
283
283
|
var data_1 = ScriptUtils_1.ScriptUtils.evalReturn('this' + front_1, this._domRender_proxy);
|
284
284
|
// console.log('-------!!!!!', fullPathStr, iterable, data, front, last);
|
@@ -333,14 +333,12 @@ var DomRenderProxy = /** @class */ (function () {
|
|
333
333
|
return _this.render(Array.from(iterable_1), fullPathStr_1);
|
334
334
|
}
|
335
335
|
}).then(function (it) {
|
336
|
-
console.log('target1------->,', it);
|
337
336
|
_this._targets.forEach(function (it) {
|
338
|
-
console.log('target2------->,', it);
|
339
337
|
// return;
|
340
338
|
if (it.nodeType === Node.DOCUMENT_FRAGMENT_NODE || it.nodeType === Node.ELEMENT_NODE) {
|
341
339
|
var targets = EventManager_1.eventManager.findAttrElements(it, _this.config);
|
342
340
|
// console.log('------>', targets);
|
343
|
-
EventManager_1.eventManager.changeVar(_this._domRender_proxy, targets, "this."
|
341
|
+
EventManager_1.eventManager.changeVar(_this._domRender_proxy, targets, "this." + fullPathStr_1, _this.config);
|
344
342
|
}
|
345
343
|
});
|
346
344
|
});
|
@@ -350,7 +348,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
350
348
|
return fullPaths;
|
351
349
|
};
|
352
350
|
DomRenderProxy.prototype.set = function (target, p, value, receiver) {
|
353
|
-
var _a, _b;
|
351
|
+
var _a, _b, _c;
|
354
352
|
// console.log('set-->', p, value, target, receiver);
|
355
353
|
if (typeof p === 'string' && p !== '__domrender_components' && excludeGetSetPropertys.includes(p)) {
|
356
354
|
target[p] = value;
|
@@ -372,12 +370,12 @@ var DomRenderProxy = /** @class */ (function () {
|
|
372
370
|
}
|
373
371
|
// console.log('full path:', fullPath);
|
374
372
|
if (('onBeforeReturnSet' in receiver) && typeof p === 'string' && !((_a = this.config.proxyExcludeOnBeforeReturnSets) !== null && _a !== void 0 ? _a : []).concat(excludeGetSetPropertys).includes(p)) {
|
375
|
-
(_b = receiver === null ||
|
373
|
+
(_c = (_b = receiver) === null || _b === void 0 ? void 0 : _b.onBeforeReturnSet) === null || _c === void 0 ? void 0 : _c.call(_b, p, value, fullPath);
|
376
374
|
}
|
377
375
|
return true;
|
378
376
|
};
|
379
377
|
DomRenderProxy.prototype.get = function (target, p, receiver) {
|
380
|
-
var _a, _b;
|
378
|
+
var _a, _b, _c;
|
381
379
|
// console.log('get-->', target, p, receiver);
|
382
380
|
if (p === '_DomRender_origin') {
|
383
381
|
return this._domRender_origin;
|
@@ -408,7 +406,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
408
406
|
it_2 = it_2._DomRender_origin;
|
409
407
|
}
|
410
408
|
if (('onBeforeReturnGet' in receiver) && typeof p === 'string' && !((_a = this.config.proxyExcludeOnBeforeReturnGets) !== null && _a !== void 0 ? _a : []).concat(excludeGetSetPropertys).includes(p)) {
|
411
|
-
(_b = receiver === null ||
|
409
|
+
(_c = (_b = receiver) === null || _b === void 0 ? void 0 : _b.onBeforeReturnGet) === null || _c === void 0 ? void 0 : _c.call(_b, p, it_2, this.root([p], it_2, false));
|
412
410
|
}
|
413
411
|
return it_2;
|
414
412
|
}
|
package/README.MD
CHANGED
@@ -222,6 +222,47 @@ window-event-popstate: <input type="text" dr-window-event-popstate="alert(this.n
|
|
222
222
|
</details>
|
223
223
|
|
224
224
|
|
225
|
+
## this
|
226
|
+
<details>
|
227
|
+
<summary>dr-this<strong>🔻(click)</strong></summary>
|
228
|
+
* dr-this
|
229
|
+
* object mapping
|
230
|
+
|
231
|
+
```typescript
|
232
|
+
class data {
|
233
|
+
dictionary = {
|
234
|
+
name: 'visualkhh'
|
235
|
+
}
|
236
|
+
}
|
237
|
+
```
|
238
|
+
```html
|
239
|
+
<div dr-this="this.dictionary">
|
240
|
+
${this.name}$
|
241
|
+
</div>
|
242
|
+
```
|
243
|
+
</details>
|
244
|
+
|
245
|
+
<details>
|
246
|
+
<summary>dr-this-property<strong>🔻(click)</strong></summary>
|
247
|
+
* dr-property
|
248
|
+
* property forEach in object
|
249
|
+
* dynamic add, delete
|
250
|
+
|
251
|
+
```typescript
|
252
|
+
class data {
|
253
|
+
dictionary = {
|
254
|
+
name1: 'visualkhh1',
|
255
|
+
name2: 'visualkhh2',
|
256
|
+
name3: 'visualkhh3'
|
257
|
+
}
|
258
|
+
}
|
259
|
+
```
|
260
|
+
```html
|
261
|
+
<home dr-this-property="this.dictionary" dr-on-init:arguments="[2,#this#]">
|
262
|
+
${this}$
|
263
|
+
</home>
|
264
|
+
```
|
265
|
+
</details>
|
225
266
|
|
226
267
|
## value
|
227
268
|
<details>
|
package/configs/Config.d.ts
CHANGED
@@ -6,7 +6,7 @@ import { TargetElement } from './TargetElement';
|
|
6
6
|
import { TargetAttr } from './TargetAttr';
|
7
7
|
import { Attrs } from '../rawsets/Attrs';
|
8
8
|
import { OperatorAround } from '../operators/OperatorExecuter';
|
9
|
-
export type Config = {
|
9
|
+
export declare type Config = {
|
10
10
|
window: Window;
|
11
11
|
targetElements?: TargetElement[];
|
12
12
|
targetAttrs?: TargetAttr[];
|
package/configs/TargetAttr.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { RawSet } from '../rawsets/RawSet';
|
2
|
-
export type TargetAttr = {
|
2
|
+
export declare type TargetAttr = {
|
3
3
|
name: string;
|
4
4
|
callBack: (target: Element, attrValue: string, obj: any, rawSet: RawSet) => DocumentFragment;
|
5
5
|
complete?: (target: Element, attrValue: string, obj: any, rawSet: RawSet) => void;
|
@@ -3,7 +3,7 @@ import { Config } from './Config';
|
|
3
3
|
import { Attrs } from '../rawsets/Attrs';
|
4
4
|
import { CreatorMetaData } from '../rawsets/CreatorMetaData';
|
5
5
|
import { Render } from '../rawsets/Render';
|
6
|
-
export type TargetElement = {
|
6
|
+
export declare type TargetElement = {
|
7
7
|
name: string;
|
8
8
|
template?: string;
|
9
9
|
styles?: string[];
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function _default(css: any, options: any): any;
|