dphelper 0.2.89 → 0.2.93
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/{LICENSE.txt → LICENSE.md} +0 -0
- package/README.md +6 -0
- package/index.js +2 -12
- package/package.json +130 -136
- package/.editorconfig +0 -13
- package/.env +0 -3
- package/.eslintignore +0 -13
- package/.eslintrc.json +0 -87
- package/.eslintrc.legacy.json +0 -91
- package/.gitattributes +0 -2
- package/.github/FUNDING.yml +0 -12
- package/.github/dependabot.yml +0 -12
- package/.hintrc +0 -11
- package/.jsbeautifyrc +0 -25
- package/.jshintrc +0 -16
- package/.prettierignore +0 -2
- package/.prettierrc.json +0 -8
- package/.stylelintignore +0 -0
- package/.stylelintrc.json +0 -468
- package/.vscode/launch.json +0 -34
- package/.vscode/settings.json +0 -58
- package/3party/shortcut.js +0 -224
- package/CHANGELOG.txt +0 -4
- package/SECURITY.md +0 -3
- package/__mocks__/fileMock.js +0 -3
- package/__mocks__/styleMock.js +0 -3
- package/babel.config.js +0 -30
- package/backup.bat +0 -43
- package/coverage/coverage-final.json +0 -1
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -101
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -0
- package/data/list.json +0 -19
- package/dist/LICENSE.txt +0 -209
- package/dist/README.md +0 -79
- package/elements/button/component.js +0 -0
- package/elements/code/component.js +0 -0
- package/elements/costants.tsx +0 -13
- package/elements/fieldset/component.js +0 -0
- package/elements/input/checkbox/component.js +0 -0
- package/elements/input/date/component.js +0 -27
- 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 +0 -33
- package/elements/x-foo/namespace.d.ts +0 -7
- package/init.js +0 -87
- package/jest.config.js +0 -81
- package/node/createTag.js +0 -7
- package/node/gitDeploy.js +0 -7
- package/node/goLive.js +0 -7
- package/public/assets/images/banner.png +0 -0
- package/public/assets/logos/logo.svg +0 -64
- package/public/documents/iDB/list.html +0 -11
- package/public/documents/iDB/toState.html +0 -11
- package/scripts/.OLD/import.js +0 -48
- package/scripts/.OLD/onBeforeUnLoad.js +0 -120
- package/scripts/.OLD/purge.js +0 -53
- package/scripts/.OLD/string.js +0 -27
- package/scripts/anchor.js +0 -73
- package/scripts/array.js +0 -203
- package/scripts/avoid.js +0 -48
- package/scripts/browser.js +0 -100
- package/scripts/color.js +0 -121
- package/scripts/console.js +0 -97
- package/scripts/console.mapped.js +0 -160
- package/scripts/coods.js +0 -57
- package/scripts/cookie.js +0 -105
- package/scripts/date.js +0 -179
- package/scripts/disable.js +0 -91
- package/scripts/errors.js +0 -3
- package/scripts/event.js +0 -57
- package/scripts/font.js +0 -60
- package/scripts/form.js +0 -211
- package/scripts/format.js +0 -71
- package/scripts/function.js +0 -55
- package/scripts/iDB.js +0 -688
- package/scripts/json.js +0 -84
- package/scripts/load.js +0 -112
- package/scripts/math.js +0 -100
- package/scripts/obj.js +0 -118
- package/scripts/path.js +0 -101
- package/scripts/promise.js +0 -56
- package/scripts/screen.js +0 -82
- package/scripts/scrollbar.js +0 -293
- package/scripts/shortcut.js +0 -83
- package/scripts/socket.js +0 -184
- package/scripts/state.js +0 -87
- package/scripts/storage.js +0 -93
- package/scripts/store.js +0 -115
- package/scripts/svg.js +0 -380
- package/scripts/text.js +0 -116
- package/scripts/time.js +0 -43
- package/scripts/timer.js +0 -54
- package/scripts/tool.js +0 -73
- package/scripts/trigger.js +0 -57
- package/scripts/type.js +0 -76
- package/scripts/ui.js +0 -41
- package/scripts/window.js +0 -244
- package/styles/console.less +0 -95
- package/tests/setupJest.tsx +0 -4
- package/typings/.OLD/cordova.d.ts +0 -12
- package/typings/.OLD/layerpro.d.ts +0 -20
- package/typings/.OLD/menupro.d.ts +0 -20
- package/typings/dphelper.d.ts +0 -26
- package/typings/image.d.ts +0 -5
- package/typings/styles.d.ts +0 -23
- package/webpack.config.js +0 -249
package/scripts/anchor.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
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" : "Anchor",
|
|
12
|
-
"type" : "function",
|
|
13
|
-
"version" : "0.0.1",
|
|
14
|
-
"command" : "anchor",
|
|
15
|
-
"example" : "",
|
|
16
|
-
"author" : "Dario Passariello",
|
|
17
|
-
"creationDate" : "20110101",
|
|
18
|
-
"lastMod" : "20110101",
|
|
19
|
-
"active" : true,
|
|
20
|
-
"description" : `
|
|
21
|
-
This tools allows you to convert all links in an element to 'onclick'.
|
|
22
|
-
It allows you to avoid the message with the path relative to the requested address
|
|
23
|
-
and it is very useful when you work with SPA but you want to keep even older browsers.`,
|
|
24
|
-
"subCommand" : [
|
|
25
|
-
{
|
|
26
|
-
"name":"toOnClick",
|
|
27
|
-
"version" : "0.0.1",
|
|
28
|
-
"example" : "dphelper.anchor.toOnClick('nav') or ('.foo') or ('#foo')",
|
|
29
|
-
"type" : "function",
|
|
30
|
-
"active": true,
|
|
31
|
-
"description":"test",
|
|
32
|
-
"subCommand" : []
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
dphelper._list.scripts.push( description );
|
|
38
|
-
|
|
39
|
-
/***********************************************************************/
|
|
40
|
-
|
|
41
|
-
dphelper.anchor ={
|
|
42
|
-
|
|
43
|
-
toOnClick: ( el ) => {
|
|
44
|
-
|
|
45
|
-
$( el + ' a' ).each( function( index ) {
|
|
46
|
-
let elem = $( this );
|
|
47
|
-
let href = elem.attr( 'href' );
|
|
48
|
-
|
|
49
|
-
if( href ){
|
|
50
|
-
elem
|
|
51
|
-
.on( 'mouseup', function(){
|
|
52
|
-
Loader( 'body' , null );
|
|
53
|
-
})
|
|
54
|
-
.css('cursor','pointer')
|
|
55
|
-
.addClass( dphelper.pathRail()[3].replace(/\//g, '') )
|
|
56
|
-
.removeAttr( 'href' )
|
|
57
|
-
.on( 'click', function(){
|
|
58
|
-
dphelper.browser.href( href );
|
|
59
|
-
dphelper.browser.push( '', '', href );
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
Object.defineProperty( dphelper, 'anchor', {
|
|
69
|
-
writable: false,
|
|
70
|
-
configurable: false
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
package/scripts/array.js
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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' ) )
|
package/scripts/browser.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
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' ) )
|
package/scripts/console.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
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' ) )
|