dphelper 0.2.88 → 0.2.89
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/.editorconfig +13 -0
- package/.env +3 -0
- package/.eslintignore +13 -0
- package/.eslintrc.json +87 -0
- package/.eslintrc.legacy.json +91 -0
- package/.gitattributes +2 -0
- package/.hintrc +11 -0
- package/.jsbeautifyrc +25 -0
- package/.jshintrc +16 -0
- package/.prettierignore +2 -0
- package/.prettierrc.json +8 -0
- package/.stylelintignore +0 -0
- package/.stylelintrc.json +468 -0
- package/.vscode/launch.json +34 -0
- package/.vscode/settings.json +58 -0
- package/3party/shortcut.js +224 -0
- package/__mocks__/fileMock.js +3 -0
- package/__mocks__/styleMock.js +3 -0
- package/babel.config.js +30 -0
- package/backup.bat +43 -0
- package/coverage/coverage-final.json +1 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +101 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +0 -0
- package/data/list.json +19 -0
- package/dist/LICENSE.txt +209 -0
- package/dist/README.md +79 -0
- package/elements/button/component.js +0 -0
- package/elements/code/component.js +0 -0
- package/elements/costants.tsx +13 -0
- package/elements/fieldset/component.js +0 -0
- package/elements/input/checkbox/component.js +0 -0
- package/elements/input/date/component.js +27 -0
- package/elements/input/number/component.js +0 -0
- package/elements/input/radio/component.js +0 -0
- package/elements/input/search/component.js +0 -0
- package/elements/input/select/component.js +0 -0
- package/elements/input/slider/component.js +0 -0
- package/elements/input/switch/component.js +0 -0
- package/elements/tab/component.js +0 -0
- package/elements/table/component.js +0 -0
- package/elements/tags.less +0 -0
- package/elements/textarea/component.js +0 -0
- package/elements/x-foo/define.js +33 -0
- package/elements/x-foo/namespace.d.ts +7 -0
- package/index.js +12 -2
- package/init.js +87 -0
- package/jest.config.js +81 -0
- package/node/createTag.js +7 -0
- package/node/gitDeploy.js +7 -0
- package/node/goLive.js +7 -0
- package/package.json +7 -7
- package/{assets → public/assets}/images/banner.png +0 -0
- package/{assets → public/assets}/logos/logo.svg +0 -0
- package/{documents → public/documents}/iDB/list.html +0 -0
- package/{documents → public/documents}/iDB/toState.html +0 -0
- package/scripts/.OLD/import.js +48 -0
- package/scripts/.OLD/onBeforeUnLoad.js +120 -0
- package/scripts/.OLD/purge.js +53 -0
- package/scripts/.OLD/string.js +27 -0
- package/scripts/anchor.js +73 -0
- package/scripts/array.js +203 -0
- package/scripts/avoid.js +48 -0
- package/scripts/browser.js +100 -0
- package/scripts/color.js +121 -0
- package/scripts/console.js +97 -0
- package/scripts/console.mapped.js +160 -0
- package/scripts/coods.js +57 -0
- package/scripts/cookie.js +105 -0
- package/scripts/date.js +179 -0
- package/scripts/disable.js +91 -0
- package/scripts/errors.js +3 -0
- package/scripts/event.js +57 -0
- package/scripts/font.js +60 -0
- package/scripts/form.js +211 -0
- package/scripts/format.js +71 -0
- package/scripts/function.js +55 -0
- package/scripts/iDB.js +688 -0
- package/scripts/json.js +84 -0
- package/scripts/load.js +112 -0
- package/scripts/math.js +100 -0
- package/scripts/obj.js +118 -0
- package/scripts/path.js +101 -0
- package/scripts/promise.js +56 -0
- package/scripts/screen.js +82 -0
- package/scripts/scrollbar.js +293 -0
- package/scripts/shortcut.js +83 -0
- package/scripts/socket.js +184 -0
- package/scripts/state.js +87 -0
- package/scripts/storage.js +93 -0
- package/scripts/store.js +115 -0
- package/scripts/svg.js +380 -0
- package/scripts/text.js +116 -0
- package/scripts/time.js +43 -0
- package/scripts/timer.js +54 -0
- package/scripts/tool.js +73 -0
- package/scripts/trigger.js +57 -0
- package/scripts/type.js +76 -0
- package/scripts/ui.js +41 -0
- package/scripts/window.js +244 -0
- package/styles/console.less +95 -0
- package/tests/setupJest.tsx +4 -0
- package/typings/.OLD/cordova.d.ts +12 -0
- package/typings/.OLD/layerpro.d.ts +20 -0
- package/typings/.OLD/menupro.d.ts +20 -0
- package/typings/dphelper.d.ts +26 -0
- package/typings/image.d.ts +5 -0
- package/typings/styles.d.ts +23 -0
- package/webpack.config.js +249 -0
- package/index.js.LICENSE.txt +0 -31
package/scripts/array.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
dpHelper
|
|
3
|
+
Copyright (c) 2021 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
+
Licensed under the Apache-2.0, see
|
|
5
|
+
https://dario.passariello.ca
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/***********************************************************************/
|
|
9
|
+
|
|
10
|
+
var description = {
|
|
11
|
+
"name" : "Array",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "array",
|
|
14
|
+
"example" : "",
|
|
15
|
+
"author" : "Dario Passariello",
|
|
16
|
+
"creationDate" : "20110101",
|
|
17
|
+
"lastMod" : "20110101",
|
|
18
|
+
"type" : "object",
|
|
19
|
+
"active" : true,
|
|
20
|
+
"description" : "",
|
|
21
|
+
"subCommand" : [
|
|
22
|
+
{
|
|
23
|
+
"name":"find",
|
|
24
|
+
"version" : "0.0.1",
|
|
25
|
+
"example" : "",
|
|
26
|
+
"type" : "function",
|
|
27
|
+
"active": true,
|
|
28
|
+
"description":"test",
|
|
29
|
+
"subCommand" : []
|
|
30
|
+
},{
|
|
31
|
+
"name":"unique",
|
|
32
|
+
"version" : "0.0.1",
|
|
33
|
+
"example" : "",
|
|
34
|
+
"type" : "function",
|
|
35
|
+
"active": true,
|
|
36
|
+
"description":"test",
|
|
37
|
+
"subCommand" : []
|
|
38
|
+
},{
|
|
39
|
+
"name":"delete",
|
|
40
|
+
"version" : "0.0.1",
|
|
41
|
+
"example" : "",
|
|
42
|
+
"type" : "function",
|
|
43
|
+
"active": true,
|
|
44
|
+
"description":"test",
|
|
45
|
+
"subCommand" : []
|
|
46
|
+
},{
|
|
47
|
+
"name":"merge",
|
|
48
|
+
"version" : "0.0.1",
|
|
49
|
+
"example" : "",
|
|
50
|
+
"type" : "function",
|
|
51
|
+
"active": true,
|
|
52
|
+
"description":"test",
|
|
53
|
+
"subCommand" : []
|
|
54
|
+
},{
|
|
55
|
+
"name":"asc",
|
|
56
|
+
"version" : "0.0.1",
|
|
57
|
+
"example" : "",
|
|
58
|
+
"type" : "function",
|
|
59
|
+
"active": true,
|
|
60
|
+
"description":"test",
|
|
61
|
+
"subCommand" : []
|
|
62
|
+
},{
|
|
63
|
+
"name":"desc",
|
|
64
|
+
"version" : "0.0.1",
|
|
65
|
+
"example" : "",
|
|
66
|
+
"type" : "function",
|
|
67
|
+
"active": true,
|
|
68
|
+
"description":"test",
|
|
69
|
+
"subCommand" : []
|
|
70
|
+
},{
|
|
71
|
+
"name":"duplicates",
|
|
72
|
+
"version" : "0.0.1",
|
|
73
|
+
"example" : "",
|
|
74
|
+
"type" : "function",
|
|
75
|
+
"active": true,
|
|
76
|
+
"description":"test",
|
|
77
|
+
"subCommand" : []
|
|
78
|
+
},{
|
|
79
|
+
"name":"even",
|
|
80
|
+
"version" : "0.0.1",
|
|
81
|
+
"example" : "",
|
|
82
|
+
"type" : "function",
|
|
83
|
+
"active": true,
|
|
84
|
+
"description":"test",
|
|
85
|
+
"subCommand" : []
|
|
86
|
+
},{
|
|
87
|
+
"name":"odd",
|
|
88
|
+
"version" : "0.0.1",
|
|
89
|
+
"example" : "",
|
|
90
|
+
"type" : "function",
|
|
91
|
+
"active": true,
|
|
92
|
+
"description":"test",
|
|
93
|
+
"subCommand" : []
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
dphelper._list.scripts.push( description );
|
|
100
|
+
|
|
101
|
+
/***********************************************************************/
|
|
102
|
+
|
|
103
|
+
dphelper.array = {
|
|
104
|
+
|
|
105
|
+
// FIND
|
|
106
|
+
find: ( id, array )=>{
|
|
107
|
+
for (let node of array) {
|
|
108
|
+
if (node.id === id) return node;
|
|
109
|
+
|
|
110
|
+
if (node.children) {
|
|
111
|
+
let finalNode = dphelper.array.find(id, node.children);
|
|
112
|
+
if (finalNode) return finalNode;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
// UNIQUE
|
|
119
|
+
unique: ( array ) => {
|
|
120
|
+
let unique = [...new Set( array )];
|
|
121
|
+
return unique;
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
// DELETE
|
|
125
|
+
delete: ( array , id ) => {
|
|
126
|
+
array.some(function iter (o,i,a) {
|
|
127
|
+
|
|
128
|
+
if (o.Id === id) {
|
|
129
|
+
a.splice(i, 1);
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
for (let key of Object.keys(o)) {
|
|
134
|
+
let value = o[key];
|
|
135
|
+
if(value.length && typeof value === 'object') return value && value.map(iter);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// OLD SCHOOL WAY
|
|
139
|
+
//var key = Object.keys(o);
|
|
140
|
+
// for (var p=0; p < key.length; ++p){
|
|
141
|
+
// if( o[key[p]]?.length && typeof o[key[p]] === 'object') return o[key[p]] && o[key[p]].some(iter);
|
|
142
|
+
// }
|
|
143
|
+
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
// MERGE
|
|
149
|
+
merge: ( arrayA, arrayB ) => {
|
|
150
|
+
for (const key of Object.keys(arrayA)) {
|
|
151
|
+
if (arrayA[key] instanceof Object && arrayB[key]) Object.assign(arrayA[key], dphelper.mergeArrays(arrayB[key], arrayA[key]));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
Object.assign(arrayB || {}, arrayA);
|
|
155
|
+
return arrayB;
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
// ASCENDING
|
|
159
|
+
asc: ( array ) => {
|
|
160
|
+
array.sort((a, b) => a - b);
|
|
161
|
+
return array;
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
// ASCENDING
|
|
165
|
+
desc: ( array ) => {
|
|
166
|
+
array.sort(function(a, b){ return b-a; });
|
|
167
|
+
return array;
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
// FIND DUPLICATES
|
|
171
|
+
duplicates: ( array ) => {
|
|
172
|
+
const toFindDuplicates = arr => arr.filter( (item, index) => arr.indexOf( item ) !== index);
|
|
173
|
+
const duplicateElements = toFindDuplicates( array );
|
|
174
|
+
return duplicateElements;
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
even: ( array ) => {
|
|
178
|
+
var cur = [];
|
|
179
|
+
for (var i = 0; i < array.length; i++) {
|
|
180
|
+
if (array[i] % 2 === 0 ) cur.push(array[i]);
|
|
181
|
+
} return cur;
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
odd: ( array ) => {
|
|
185
|
+
var cur = [];
|
|
186
|
+
for (var i = 0; i < array.length; i++) {
|
|
187
|
+
if (array[i] % 2) cur.push(array[i]);
|
|
188
|
+
} return cur;
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
toObj: ( array ) => {
|
|
192
|
+
return Object.assign({}, array);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
Object.defineProperty( dphelper, 'array', {
|
|
198
|
+
writable: false,
|
|
199
|
+
configurable: false
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
|
203
|
+
|
package/scripts/avoid.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
dpHelper
|
|
3
|
+
Copyright (c) 2021 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
+
Licensed under the Apache-2.0, see
|
|
5
|
+
https://dario.passariello.ca
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/***********************************************************************/
|
|
9
|
+
|
|
10
|
+
var description = {
|
|
11
|
+
"name" : "Avoid",
|
|
12
|
+
"description" : "",
|
|
13
|
+
"version" : "0.0.1",
|
|
14
|
+
"command" : "avoid",
|
|
15
|
+
"subCommand" : [
|
|
16
|
+
{
|
|
17
|
+
"name":"cache",
|
|
18
|
+
"version" : "0.0.1",
|
|
19
|
+
"example" : "dphelper.avoid.cache",
|
|
20
|
+
"type" : "function",
|
|
21
|
+
"active": true,
|
|
22
|
+
"description":"test",
|
|
23
|
+
"subCommand" : []
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
"example" : "",
|
|
27
|
+
"author" : "Dario Passariello",
|
|
28
|
+
"active" : true
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
dphelper._list.scripts.push( description );
|
|
32
|
+
|
|
33
|
+
/***********************************************************************/
|
|
34
|
+
|
|
35
|
+
dphelper.avoid = {
|
|
36
|
+
|
|
37
|
+
cache: (uri) => {
|
|
38
|
+
return uri.concat( /\?/.test(uri) ? '&' : '?', 't=', dphelper.rnd() );
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
Object.defineProperty( dphelper, 'avoid', {
|
|
44
|
+
writable: false,
|
|
45
|
+
configurable: false
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
dpHelper
|
|
3
|
+
Copyright (c) 2021 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
+
Licensed under the Apache-2.0, see
|
|
5
|
+
https://dario.passariello.ca
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/***********************************************************************/
|
|
9
|
+
|
|
10
|
+
var description = {
|
|
11
|
+
"name" : "Browser",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "browser",
|
|
14
|
+
"author" : "Dario Passariello",
|
|
15
|
+
"active" : true,
|
|
16
|
+
"example" : "",
|
|
17
|
+
"type" : "object",
|
|
18
|
+
"description":"test",
|
|
19
|
+
"subCommand" : [
|
|
20
|
+
{
|
|
21
|
+
"name":"state",
|
|
22
|
+
"version" : "0.0.1",
|
|
23
|
+
"example" : "",
|
|
24
|
+
"type" : "function",
|
|
25
|
+
"active": true,
|
|
26
|
+
"description":"test",
|
|
27
|
+
"subCommand" : []
|
|
28
|
+
},{
|
|
29
|
+
"name":"forw",
|
|
30
|
+
"version" : "0.0.1",
|
|
31
|
+
"example" : "",
|
|
32
|
+
"type" : "function",
|
|
33
|
+
"active": true,
|
|
34
|
+
"description":"test",
|
|
35
|
+
"subCommand" : []
|
|
36
|
+
},{
|
|
37
|
+
"name":"back",
|
|
38
|
+
"version" : "0.0.1",
|
|
39
|
+
"example" : "",
|
|
40
|
+
"type" : "function",
|
|
41
|
+
"active": true,
|
|
42
|
+
"description":"test",
|
|
43
|
+
"subCommand" : []
|
|
44
|
+
},{
|
|
45
|
+
"name":"reload",
|
|
46
|
+
"version" : "0.0.1",
|
|
47
|
+
"example" : "",
|
|
48
|
+
"type" : "function",
|
|
49
|
+
"active": true,
|
|
50
|
+
"description":"test",
|
|
51
|
+
"subCommand" : []
|
|
52
|
+
},{
|
|
53
|
+
"name":"href",
|
|
54
|
+
"version" : "0.0.1",
|
|
55
|
+
"example" : "",
|
|
56
|
+
"type" : "function",
|
|
57
|
+
"active": true,
|
|
58
|
+
"description":"test",
|
|
59
|
+
"subCommand" : []
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
dphelper._list.scripts.push( description );
|
|
66
|
+
|
|
67
|
+
/***********************************************************************/
|
|
68
|
+
|
|
69
|
+
dphelper.browser = {
|
|
70
|
+
|
|
71
|
+
state: (state, title, url) => {
|
|
72
|
+
return history.pushState( state, title, url );
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
forw: ( times ) => {
|
|
76
|
+
return history.go( times );
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
back: ( times ) => {
|
|
80
|
+
return history.go( -Math.abs( times ) );
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
reload: () => {
|
|
84
|
+
// DISCARD POST
|
|
85
|
+
return window.location.href = window.location.href;
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
href: ( url ) => {
|
|
89
|
+
// DISCARD POST
|
|
90
|
+
return window.location.href = url;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
Object.defineProperty( dphelper, 'browser', {
|
|
96
|
+
writable: false,
|
|
97
|
+
configurable: false
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
package/scripts/color.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
dpHelper
|
|
3
|
+
Copyright (c) 2021 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
+
Licensed under the Apache-2.0, see
|
|
5
|
+
https://dario.passariello.ca
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/***********************************************************************/
|
|
9
|
+
|
|
10
|
+
var description = {
|
|
11
|
+
"name" : "Color",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "color",
|
|
14
|
+
"author" : "Dario Passariello",
|
|
15
|
+
"active" : true,
|
|
16
|
+
"example" : "",
|
|
17
|
+
"type" : "object",
|
|
18
|
+
"description":"test",
|
|
19
|
+
"subCommand" : [
|
|
20
|
+
{
|
|
21
|
+
"name":"hex",
|
|
22
|
+
"version" : "0.0.1",
|
|
23
|
+
"example" : "",
|
|
24
|
+
"type" : "function",
|
|
25
|
+
"active": true,
|
|
26
|
+
"description":"test",
|
|
27
|
+
"subCommand" : []
|
|
28
|
+
},{
|
|
29
|
+
"name":"toHex",
|
|
30
|
+
"version" : "0.0.1",
|
|
31
|
+
"example" : "",
|
|
32
|
+
"type" : "function",
|
|
33
|
+
"active": true,
|
|
34
|
+
"description":"test",
|
|
35
|
+
"subCommand" : []
|
|
36
|
+
},{
|
|
37
|
+
"name":"toRGB",
|
|
38
|
+
"version" : "0.0.1",
|
|
39
|
+
"example" : "",
|
|
40
|
+
"type" : "function",
|
|
41
|
+
"active": true,
|
|
42
|
+
"description":"test",
|
|
43
|
+
"subCommand" : []
|
|
44
|
+
},{
|
|
45
|
+
"name":"gradient",
|
|
46
|
+
"version" : "0.0.1",
|
|
47
|
+
"example" : "",
|
|
48
|
+
"type" : "function",
|
|
49
|
+
"active": true,
|
|
50
|
+
"description":"test",
|
|
51
|
+
"subCommand" : []
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
dphelper._list.scripts.push( description );
|
|
58
|
+
|
|
59
|
+
/***********************************************************************/
|
|
60
|
+
|
|
61
|
+
dphelper.color = {
|
|
62
|
+
|
|
63
|
+
hex: (c) => {
|
|
64
|
+
var s = "0123456789abcdef";
|
|
65
|
+
var i = parseInt (c);
|
|
66
|
+
|
|
67
|
+
if (i == 0 || isNaN (c)) return "00";
|
|
68
|
+
|
|
69
|
+
i = Math.round (Math.min (Math.max (0, i), 255));
|
|
70
|
+
return s.charAt ((i - i % 16) / 16) + s.charAt (i % 16);
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/* Convert an RGB triplet to a hex string */
|
|
74
|
+
toHex: (rgb) => {
|
|
75
|
+
return dphelper.color.hex(rgb[0]) +
|
|
76
|
+
dphelper.color.hex(rgb[1]) +
|
|
77
|
+
dphelper.color.hex(rgb[2]);
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
/* Convert a hex string to an RGB triplet */
|
|
81
|
+
toRGB: (hex) => {
|
|
82
|
+
var color = [];
|
|
83
|
+
color[0] = parseInt (( dphelper.text.trim( hex, '#', 1, 7 ) ).substring (0, 2), 16);
|
|
84
|
+
color[1] = parseInt (( dphelper.text.trim( hex, '#', 1, 7 ) ).substring (2, 4), 16);
|
|
85
|
+
color[2] = parseInt (( dphelper.text.trim( hex, '#', 1, 7 ) ).substring (4, 6), 16);
|
|
86
|
+
return color;
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
gradient: ( colorStart, colorEnd, colorCount ) => {
|
|
90
|
+
|
|
91
|
+
var start = dphelper.color.toRGB (colorStart);
|
|
92
|
+
var end = dphelper.color.toRGB (colorEnd);
|
|
93
|
+
var len = colorCount;
|
|
94
|
+
var alpha = 0.0;
|
|
95
|
+
var colors = [];
|
|
96
|
+
|
|
97
|
+
for (var i = 0; i < len; i++) {
|
|
98
|
+
|
|
99
|
+
var c = [];
|
|
100
|
+
alpha += (1.0/len);
|
|
101
|
+
|
|
102
|
+
c[0] = start[0] * alpha + (1 - alpha) * end[0];
|
|
103
|
+
c[1] = start[1] * alpha + (1 - alpha) * end[1];
|
|
104
|
+
c[2] = start[2] * alpha + (1 - alpha) * end[2];
|
|
105
|
+
|
|
106
|
+
colors.push( dphelper.color.toHex (c) );
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return colors;
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
Object.defineProperty( dphelper, 'color', {
|
|
117
|
+
writable: false,
|
|
118
|
+
configurable: false
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
dpHelper
|
|
3
|
+
Copyright (c) 2021 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
+
Licensed under the Apache-2.0, see
|
|
5
|
+
https://dario.passariello.ca
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/***********************************************************************/
|
|
9
|
+
|
|
10
|
+
var description = {
|
|
11
|
+
"name" : "Console",
|
|
12
|
+
"description" : "",
|
|
13
|
+
"version" : "0.0.1",
|
|
14
|
+
"command" : "console",
|
|
15
|
+
"subCommand" : [
|
|
16
|
+
{
|
|
17
|
+
"name":"info",
|
|
18
|
+
"description":"test"
|
|
19
|
+
},{
|
|
20
|
+
"name":"stop",
|
|
21
|
+
"description":"test"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"example" : "",
|
|
25
|
+
"author" : "Dario Passariello",
|
|
26
|
+
"active" : true
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
dphelper._list.scripts.push( description );
|
|
30
|
+
|
|
31
|
+
/***********************************************************************/
|
|
32
|
+
|
|
33
|
+
// dphelper.printInfo = () => {
|
|
34
|
+
// console.debug( 'dpHelper: Please use "dphelper.path.rail()"' );
|
|
35
|
+
// return dphelper.console.info();
|
|
36
|
+
// };
|
|
37
|
+
|
|
38
|
+
/***********************************************************************/
|
|
39
|
+
|
|
40
|
+
dphelper.console = {
|
|
41
|
+
|
|
42
|
+
info: ( name, message, func ) => {
|
|
43
|
+
console.groupCollapsed('%c'+ name +':%c', "color:orange", "");
|
|
44
|
+
console.debug( message, dphelper[ func ] );
|
|
45
|
+
console.groupEnd();
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
stop: ( options = [
|
|
49
|
+
'assert',
|
|
50
|
+
'clear',
|
|
51
|
+
'count',
|
|
52
|
+
'debug',
|
|
53
|
+
'dir',
|
|
54
|
+
'dirxml',
|
|
55
|
+
'error',
|
|
56
|
+
'exception',
|
|
57
|
+
'group',
|
|
58
|
+
'groupCollapsed',
|
|
59
|
+
'groupEnd',
|
|
60
|
+
'info',
|
|
61
|
+
'log',
|
|
62
|
+
'markTimeline',
|
|
63
|
+
'profile',
|
|
64
|
+
'profileEnd',
|
|
65
|
+
'table',
|
|
66
|
+
'time',
|
|
67
|
+
'timeEnd',
|
|
68
|
+
'timeline',
|
|
69
|
+
'timelineEnd',
|
|
70
|
+
'timeStamp',
|
|
71
|
+
'trace',
|
|
72
|
+
'warn',
|
|
73
|
+
'verbose'
|
|
74
|
+
]) => {
|
|
75
|
+
|
|
76
|
+
console.clear();
|
|
77
|
+
console.disableYellowBox = true;
|
|
78
|
+
console = {};
|
|
79
|
+
console.log = function(){};
|
|
80
|
+
window.console = console;
|
|
81
|
+
if(!window.console) window.console = {};
|
|
82
|
+
const noop = () => {};
|
|
83
|
+
|
|
84
|
+
options.forEach( ( method ) => {
|
|
85
|
+
window.console[ method ] = noop;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
Object.defineProperty( dphelper, 'console', {
|
|
93
|
+
writable: false,
|
|
94
|
+
configurable: false
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|