dom-render 1.0.37 → 1.0.41
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/Config.js +1 -2
- package/DomRender.js +3 -6
- package/DomRenderLifeCycle.js +1 -2
- package/DomRenderProxy.d.ts +1 -1
- package/DomRenderProxy.js +16 -17
- package/RawSet.js +28 -31
- package/Shield.js +1 -4
- package/dist/Config.d.ts +26 -0
- package/dist/DomRender.d.ts +4 -0
- package/dist/DomRenderLifeCycle.d.ts +3 -0
- package/dist/DomRenderProxy.d.ts +27 -0
- package/dist/RawSet.d.ts +61 -0
- package/dist/Shield.d.ts +3 -0
- package/dist/{dom-render.js → bundle.js} +1092 -1085
- package/dist/bundle.js.map +1 -0
- package/dist/events/EventManager.d.ts +14 -0
- package/dist/types/Types.d.ts +3 -0
- package/dist/utils/dom/DomUtils.d.ts +13 -0
- package/dist/utils/node/NodeUtils.d.ts +10 -0
- package/dist/utils/random/RandomUtils.d.ts +7 -0
- package/dist/utils/script/ScriptUtils.d.ts +14 -0
- package/dist/utils/string/StringUtils.d.ts +4 -0
- package/dist/utils/valid/ValidUtils.d.ts +10 -0
- package/events/EventManager.d.ts +1 -1
- package/events/EventManager.js +11 -10
- package/package.json +16 -11
- package/types/Types.js +1 -2
- package/utils/dom/DomUtils.js +1 -4
- package/utils/node/NodeUtils.js +1 -4
- package/utils/random/RandomUtils.js +4 -7
- package/utils/script/ScriptUtils.js +1 -4
- package/utils/string/StringUtils.js +1 -4
- package/utils/valid/ValidUtils.js +1 -4
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bundle.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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attrPrefix: "dr-";
|
4
|
+
readonly eventNames: string[];
|
5
|
+
readonly attrNames: string[];
|
6
|
+
findAttrElements(fragment: DocumentFragment | Element, config?: Config | undefined): Set<Element>;
|
7
|
+
applyEvent(obj: any, childNodes: Set<ChildNode> | Set<Element>, config?: Config | undefined): void;
|
8
|
+
changeVar(obj: any, elements: Set<Element> | Set<ChildNode>, varName?: string | undefined): void;
|
9
|
+
addDrEvent(obj: any, eventName: string, elements: Set<Element> | Set<ChildNode>): void;
|
10
|
+
procAttr<T extends Element = Element>(elements: Set<Element> | Set<ChildNode> | undefined, attrName: string, callBack: (h: T, value: string) => void): void;
|
11
|
+
getValue<T_1 = any>(obj: any, name: string, value?: any): T_1;
|
12
|
+
setValue(obj: any, name: string, value?: any): void;
|
13
|
+
isUsingThisVar(raws: string | null | undefined, varName: string | null | undefined): boolean;
|
14
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export declare type Attr = {
|
2
|
+
name: string;
|
3
|
+
value: any;
|
4
|
+
};
|
5
|
+
export declare class DomUtils {
|
6
|
+
static selectorElements(selector: string, element?: Element | Document): Element[];
|
7
|
+
static selectorNodes(selector: string, element?: Element | Document): NodeListOf<Element>;
|
8
|
+
static removeAttribute(result: HTMLElement, attrs: string[]): void;
|
9
|
+
static setAttribute(result: HTMLElement, attrs: string[]): void;
|
10
|
+
static setAttributeAttr(result: HTMLElement, attrs: Attr[]): void;
|
11
|
+
static getAttributeToObject(input: HTMLElement): any;
|
12
|
+
static getStyleToObject(input: HTMLElement): any;
|
13
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export declare type Attr = {
|
2
|
+
name: string;
|
3
|
+
value: any;
|
4
|
+
};
|
5
|
+
export declare class NodeUtils {
|
6
|
+
static removeAllChildNode(node: Node): void;
|
7
|
+
static appendChild(parentNode: Node, childNode: Node): Node;
|
8
|
+
static replaceNode(targetNode: Node, newNode: Node): Node | undefined;
|
9
|
+
static addNode(targetNode: Node, newNode: Node): Node | undefined;
|
10
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export declare class ScriptUtils {
|
2
|
+
static getVariablePaths(script: string): Set<string>;
|
3
|
+
static evalReturn(script: string, thisTarget: any): any;
|
4
|
+
static eval(script: string, thisTarget: any): any;
|
5
|
+
static loadElement(name: string, attribute: {
|
6
|
+
[key: string]: string;
|
7
|
+
}, target?: Element): Promise<unknown>;
|
8
|
+
static loadStyleSheet(href: string, attribute?: {
|
9
|
+
[key: string]: string;
|
10
|
+
}): Promise<unknown>;
|
11
|
+
static loadScript(src: string, attribute?: {
|
12
|
+
[key: string]: string;
|
13
|
+
}): Promise<unknown>;
|
14
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export declare class ValidUtils {
|
2
|
+
static isNullOrUndefined(data: any): boolean;
|
3
|
+
static isNull(data: any): boolean;
|
4
|
+
static isArray(object_o: any): boolean;
|
5
|
+
static isNumber(object_o: any): boolean;
|
6
|
+
static isString(object_o: any): boolean;
|
7
|
+
static isFunction(object_o: any): boolean;
|
8
|
+
static isObject(object_o: any): boolean;
|
9
|
+
static isMap(object_o: any): boolean;
|
10
|
+
}
|
package/events/EventManager.d.ts
CHANGED
package/events/EventManager.js
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
exports.eventManager = void 0;
|
4
|
-
var ScriptUtils_1 = require("../utils/script/ScriptUtils");
|
5
|
-
exports.eventManager = new (function () {
|
1
|
+
import { ScriptUtils } from '../utils/script/ScriptUtils';
|
2
|
+
export var eventManager = new (function () {
|
6
3
|
function class_1() {
|
7
4
|
var _this = this;
|
8
5
|
this.attrPrefix = 'dr-';
|
9
|
-
this.eventNames = [
|
6
|
+
this.eventNames = [
|
7
|
+
'click', 'mousedown', 'mouseup', 'dblclick', 'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave', 'contextmenu',
|
8
|
+
'keyup', 'keydown', 'keypress',
|
9
|
+
'change', 'input', 'submit', 'resize'
|
10
|
+
];
|
10
11
|
this.attrNames = [
|
11
12
|
this.attrPrefix + 'value',
|
12
13
|
this.attrPrefix + 'value-link',
|
@@ -48,7 +49,7 @@ exports.eventManager = new (function () {
|
|
48
49
|
this.procAttr(childNodes, this.attrPrefix + 'value', function (it, attribute) {
|
49
50
|
var script = attribute;
|
50
51
|
if (script) {
|
51
|
-
var data =
|
52
|
+
var data = ScriptUtils.evalReturn(script, obj);
|
52
53
|
if (it.value !== data) {
|
53
54
|
it.value = data;
|
54
55
|
}
|
@@ -194,14 +195,14 @@ exports.eventManager = new (function () {
|
|
194
195
|
});
|
195
196
|
};
|
196
197
|
class_1.prototype.getValue = function (obj, name, value) {
|
197
|
-
var r =
|
198
|
+
var r = ScriptUtils.evalReturn(name, obj);
|
198
199
|
if (typeof r === 'function') {
|
199
200
|
r = r.bind(obj);
|
200
201
|
}
|
201
202
|
return r;
|
202
203
|
};
|
203
204
|
class_1.prototype.setValue = function (obj, name, value) {
|
204
|
-
|
205
|
+
ScriptUtils.eval("this." + name + " = this.value", {
|
205
206
|
this: obj,
|
206
207
|
value: value
|
207
208
|
});
|
@@ -211,7 +212,7 @@ exports.eventManager = new (function () {
|
|
211
212
|
if (varName.startsWith('this.')) {
|
212
213
|
varName = varName.replace(/this\./, '');
|
213
214
|
}
|
214
|
-
var variablePaths =
|
215
|
+
var variablePaths = ScriptUtils.getVariablePaths(raws !== null && raws !== void 0 ? raws : '');
|
215
216
|
return variablePaths.has(varName);
|
216
217
|
}
|
217
218
|
return false;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "dom-render",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.41",
|
4
4
|
"main": "DomRender.js",
|
5
5
|
"license": "MIT",
|
6
6
|
"description": "dom-render",
|
@@ -30,10 +30,6 @@
|
|
30
30
|
"type": "git",
|
31
31
|
"url": "https://github.com/visualkhh/dom-render"
|
32
32
|
},
|
33
|
-
"workspaces": [
|
34
|
-
"./",
|
35
|
-
"example"
|
36
|
-
],
|
37
33
|
"jest": {
|
38
34
|
"transform": {
|
39
35
|
"^.+\\.ts$": "ts-jest"
|
@@ -62,13 +58,14 @@
|
|
62
58
|
"npm-build": "npm run build && cp package.json dist && cp README.MD dist",
|
63
59
|
"npm-publish": "npm run npm-build && npm publish ./dist",
|
64
60
|
"tsc": "tsc",
|
61
|
+
"tsc:watch": "rm -rf ./dist && mkdir dist && cp package.json dist && tsc --watch --sourceMap true",
|
65
62
|
"test": "jest --detectOpenHandles --forceExit"
|
66
63
|
},
|
67
64
|
"devDependencies": {
|
65
|
+
"@rollup/plugin-babel": "^5.3.0",
|
66
|
+
"@rollup/plugin-node-resolve": "^13.0.5",
|
68
67
|
"@rollup/plugin-replace": "^2.4.2",
|
69
|
-
"@rollup/plugin-typescript": "^8.2.1",
|
70
68
|
"@types/jest": "^26.0.22",
|
71
|
-
"@types/node": "^16.4.6",
|
72
69
|
"@typescript-eslint/eslint-plugin": "^4.16.1",
|
73
70
|
"@typescript-eslint/parser": "^4.16.1",
|
74
71
|
"eslint": "^7.21.0",
|
@@ -77,12 +74,20 @@
|
|
77
74
|
"eslint-plugin-node": "^11.1.0",
|
78
75
|
"eslint-plugin-promise": "^4.3.1",
|
79
76
|
"jest": "^26.6.3",
|
80
|
-
"parcel-bundler": "^1.12.5",
|
81
|
-
"parcel-plugin-css-to-string": "^2.5.2",
|
82
77
|
"rollup": "^2.52.8",
|
83
|
-
"rollup-
|
78
|
+
"rollup-plugin-babel": "^4.4.0",
|
79
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
80
|
+
"rollup-plugin-copy": "^3.4.0",
|
81
|
+
"rollup-plugin-delete": "^2.0.0",
|
82
|
+
"rollup-plugin-html": "^0.2.1",
|
83
|
+
"rollup-plugin-import-css": "^3.0.2",
|
84
|
+
"rollup-plugin-node-resolve": "^5.2.0",
|
85
|
+
"rollup-plugin-sourcemaps": "^0.6.3",
|
86
|
+
"rollup-plugin-typescript2": "^0.30.0",
|
87
|
+
"rollup-watch": "^3.2.2",
|
84
88
|
"supertest": "^6.1.3",
|
85
89
|
"ts-jest": "^26.5.4",
|
86
|
-
"
|
90
|
+
"tslib": "^2.3.1",
|
91
|
+
"typescript": "^4.4.3"
|
87
92
|
}
|
88
93
|
}
|
package/types/Types.js
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
1
|
+
export {};
|
package/utils/dom/DomUtils.js
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DomUtils = void 0;
|
4
1
|
var DomUtils = (function () {
|
5
2
|
function DomUtils() {
|
6
3
|
}
|
@@ -42,4 +39,4 @@ var DomUtils = (function () {
|
|
42
39
|
};
|
43
40
|
return DomUtils;
|
44
41
|
}());
|
45
|
-
|
42
|
+
export { DomUtils };
|
package/utils/node/NodeUtils.js
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.NodeUtils = void 0;
|
4
1
|
var NodeUtils = (function () {
|
5
2
|
function NodeUtils() {
|
6
3
|
}
|
@@ -22,4 +19,4 @@ var NodeUtils = (function () {
|
|
22
19
|
};
|
23
20
|
return NodeUtils;
|
24
21
|
}());
|
25
|
-
|
22
|
+
export { NodeUtils };
|
@@ -1,15 +1,12 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.RandomUtils = void 0;
|
4
|
-
var ValidUtils_1 = require("../valid/ValidUtils");
|
1
|
+
import { ValidUtils } from '../valid/ValidUtils';
|
5
2
|
var RandomUtils = (function () {
|
6
3
|
function RandomUtils() {
|
7
4
|
}
|
8
5
|
RandomUtils.random = function (min, max) {
|
9
|
-
if (
|
6
|
+
if (ValidUtils.isNullOrUndefined(min)) {
|
10
7
|
return Math.random();
|
11
8
|
}
|
12
|
-
else if (!
|
9
|
+
else if (!ValidUtils.isNullOrUndefined(min) && ValidUtils.isNullOrUndefined(max)) {
|
13
10
|
return Math.random() * (min || 0);
|
14
11
|
}
|
15
12
|
else {
|
@@ -43,4 +40,4 @@ var RandomUtils = (function () {
|
|
43
40
|
RandomUtils.d = '';
|
44
41
|
return RandomUtils;
|
45
42
|
}());
|
46
|
-
|
43
|
+
export { RandomUtils };
|
@@ -1,6 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ScriptUtils = void 0;
|
4
1
|
var ScriptUtils = (function () {
|
5
2
|
function ScriptUtils() {
|
6
3
|
}
|
@@ -69,4 +66,4 @@ var ScriptUtils = (function () {
|
|
69
66
|
};
|
70
67
|
return ScriptUtils;
|
71
68
|
}());
|
72
|
-
|
69
|
+
export { ScriptUtils };
|
@@ -1,6 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.StringUtils = void 0;
|
4
1
|
var StringUtils = (function () {
|
5
2
|
function StringUtils() {
|
6
3
|
}
|
@@ -18,4 +15,4 @@ var StringUtils = (function () {
|
|
18
15
|
};
|
19
16
|
return StringUtils;
|
20
17
|
}());
|
21
|
-
|
18
|
+
export { StringUtils };
|
@@ -1,6 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ValidUtils = void 0;
|
4
1
|
var ValidUtils = (function () {
|
5
2
|
function ValidUtils() {
|
6
3
|
}
|
@@ -70,4 +67,4 @@ var ValidUtils = (function () {
|
|
70
67
|
};
|
71
68
|
return ValidUtils;
|
72
69
|
}());
|
73
|
-
|
70
|
+
export { ValidUtils };
|