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.
Files changed (121) hide show
  1. package/{LICENSE.txt → LICENSE.md} +0 -0
  2. package/README.md +6 -0
  3. package/index.js +2 -12
  4. package/package.json +130 -136
  5. package/.editorconfig +0 -13
  6. package/.env +0 -3
  7. package/.eslintignore +0 -13
  8. package/.eslintrc.json +0 -87
  9. package/.eslintrc.legacy.json +0 -91
  10. package/.gitattributes +0 -2
  11. package/.github/FUNDING.yml +0 -12
  12. package/.github/dependabot.yml +0 -12
  13. package/.hintrc +0 -11
  14. package/.jsbeautifyrc +0 -25
  15. package/.jshintrc +0 -16
  16. package/.prettierignore +0 -2
  17. package/.prettierrc.json +0 -8
  18. package/.stylelintignore +0 -0
  19. package/.stylelintrc.json +0 -468
  20. package/.vscode/launch.json +0 -34
  21. package/.vscode/settings.json +0 -58
  22. package/3party/shortcut.js +0 -224
  23. package/CHANGELOG.txt +0 -4
  24. package/SECURITY.md +0 -3
  25. package/__mocks__/fileMock.js +0 -3
  26. package/__mocks__/styleMock.js +0 -3
  27. package/babel.config.js +0 -30
  28. package/backup.bat +0 -43
  29. package/coverage/coverage-final.json +0 -1
  30. package/coverage/lcov-report/base.css +0 -224
  31. package/coverage/lcov-report/block-navigation.js +0 -87
  32. package/coverage/lcov-report/favicon.png +0 -0
  33. package/coverage/lcov-report/index.html +0 -101
  34. package/coverage/lcov-report/prettify.css +0 -1
  35. package/coverage/lcov-report/prettify.js +0 -2
  36. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  37. package/coverage/lcov-report/sorter.js +0 -196
  38. package/coverage/lcov.info +0 -0
  39. package/data/list.json +0 -19
  40. package/dist/LICENSE.txt +0 -209
  41. package/dist/README.md +0 -79
  42. package/elements/button/component.js +0 -0
  43. package/elements/code/component.js +0 -0
  44. package/elements/costants.tsx +0 -13
  45. package/elements/fieldset/component.js +0 -0
  46. package/elements/input/checkbox/component.js +0 -0
  47. package/elements/input/date/component.js +0 -27
  48. package/elements/input/number/component.js +0 -0
  49. package/elements/input/radio/component.js +0 -0
  50. package/elements/input/search/component.js +0 -0
  51. package/elements/input/select/component.js +0 -0
  52. package/elements/input/slider/component.js +0 -0
  53. package/elements/input/switch/component.js +0 -0
  54. package/elements/tab/component.js +0 -0
  55. package/elements/table/component.js +0 -0
  56. package/elements/tags.less +0 -0
  57. package/elements/textarea/component.js +0 -0
  58. package/elements/x-foo/define.js +0 -33
  59. package/elements/x-foo/namespace.d.ts +0 -7
  60. package/init.js +0 -87
  61. package/jest.config.js +0 -81
  62. package/node/createTag.js +0 -7
  63. package/node/gitDeploy.js +0 -7
  64. package/node/goLive.js +0 -7
  65. package/public/assets/images/banner.png +0 -0
  66. package/public/assets/logos/logo.svg +0 -64
  67. package/public/documents/iDB/list.html +0 -11
  68. package/public/documents/iDB/toState.html +0 -11
  69. package/scripts/.OLD/import.js +0 -48
  70. package/scripts/.OLD/onBeforeUnLoad.js +0 -120
  71. package/scripts/.OLD/purge.js +0 -53
  72. package/scripts/.OLD/string.js +0 -27
  73. package/scripts/anchor.js +0 -73
  74. package/scripts/array.js +0 -203
  75. package/scripts/avoid.js +0 -48
  76. package/scripts/browser.js +0 -100
  77. package/scripts/color.js +0 -121
  78. package/scripts/console.js +0 -97
  79. package/scripts/console.mapped.js +0 -160
  80. package/scripts/coods.js +0 -57
  81. package/scripts/cookie.js +0 -105
  82. package/scripts/date.js +0 -179
  83. package/scripts/disable.js +0 -91
  84. package/scripts/errors.js +0 -3
  85. package/scripts/event.js +0 -57
  86. package/scripts/font.js +0 -60
  87. package/scripts/form.js +0 -211
  88. package/scripts/format.js +0 -71
  89. package/scripts/function.js +0 -55
  90. package/scripts/iDB.js +0 -688
  91. package/scripts/json.js +0 -84
  92. package/scripts/load.js +0 -112
  93. package/scripts/math.js +0 -100
  94. package/scripts/obj.js +0 -118
  95. package/scripts/path.js +0 -101
  96. package/scripts/promise.js +0 -56
  97. package/scripts/screen.js +0 -82
  98. package/scripts/scrollbar.js +0 -293
  99. package/scripts/shortcut.js +0 -83
  100. package/scripts/socket.js +0 -184
  101. package/scripts/state.js +0 -87
  102. package/scripts/storage.js +0 -93
  103. package/scripts/store.js +0 -115
  104. package/scripts/svg.js +0 -380
  105. package/scripts/text.js +0 -116
  106. package/scripts/time.js +0 -43
  107. package/scripts/timer.js +0 -54
  108. package/scripts/tool.js +0 -73
  109. package/scripts/trigger.js +0 -57
  110. package/scripts/type.js +0 -76
  111. package/scripts/ui.js +0 -41
  112. package/scripts/window.js +0 -244
  113. package/styles/console.less +0 -95
  114. package/tests/setupJest.tsx +0 -4
  115. package/typings/.OLD/cordova.d.ts +0 -12
  116. package/typings/.OLD/layerpro.d.ts +0 -20
  117. package/typings/.OLD/menupro.d.ts +0 -20
  118. package/typings/dphelper.d.ts +0 -26
  119. package/typings/image.d.ts +0 -5
  120. package/typings/styles.d.ts +0 -23
  121. package/webpack.config.js +0 -249
package/scripts/json.js DELETED
@@ -1,84 +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" : "Json",
12
- "description" : "",
13
- "version" : "0.0.1",
14
- "command" : "json",
15
- "subCommand" : [
16
- {
17
- "name":"counter",
18
- "description" : "",
19
- },
20
- {
21
- "name":"toCsv",
22
- "description" : "",
23
- },
24
- {
25
- "name":"saveCsvAs",
26
- "description" : "",
27
- }
28
- ],
29
- "example" : "",
30
- "author" : "Dario Passariello",
31
- "active" : true
32
- };
33
-
34
- dphelper._list.scripts.push( description );
35
-
36
- /***********************************************************************/
37
-
38
- dphelper.json = {
39
-
40
- counter: (json, key, val) => {
41
- if (!json) return null;
42
- let keyCount;
43
- if (key && val) {
44
- keyCount = Object.keys(jsonObject).length;
45
- } else {
46
- keyCount = json.items.filter(value => value.key === val).lengt;
47
- }
48
- return keyCount;
49
- },
50
-
51
- toCsv: (jsonInput) => {
52
- const items = jsonInput;
53
- const replacer = (key, value) => (value === null ? '' : value); // specify how you want to handle null values here
54
- const header = Object.keys(items[0]);
55
- let csv = items?.map(row => header?.map(fieldName => JSON.stringify(row[fieldName], replacer)).join(','));
56
- csv.unshift(header.join(','));
57
- csv = csv.join('\r\n');
58
- // csv = csv.split("\"").join("");
59
- return csv
60
- },
61
-
62
- saveCsvAs: (csvData, fileName) => {
63
- const blob = new Blob( [csvData] , { type: 'text/csv;charset=utf-8;' })
64
- const link = document.createElement('a')
65
- let urlFile = ''
66
- const d = dphelper.date.dateTimeToString( new Date( Date.now() ) )
67
- const filename = `${fileName}_${ d }.csv`
68
- urlFile = URL.createObjectURL(blob)
69
- link.setAttribute('href', urlFile)
70
- link.setAttribute('download', filename)
71
- link.style.visibility = 'hidden'
72
- document.body.appendChild(link)
73
- link.click()
74
- document.body.removeChild(link)
75
- }
76
-
77
- };
78
-
79
- Object.defineProperty( dphelper, 'json', {
80
- writable: false,
81
- configurable: false
82
- });
83
-
84
- //console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
package/scripts/load.js DELETED
@@ -1,112 +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" : "Load",
12
- "description" : "",
13
- "version" : "0.0.1",
14
- "command" : "load",
15
- "subCommand" : [
16
- {
17
- "name":"file",
18
- "description":"test"
19
- },{
20
- "name":"json",
21
- "description":"test"
22
- },{
23
- "name":"jsonRemote",
24
- "description":"test"
25
- }
26
- ],
27
- "example" : "",
28
- "author" : "Dario Passariello",
29
- "active" : true
30
- };
31
-
32
- dphelper._list.scripts.push( description );
33
-
34
- /***********************************************************************/
35
-
36
- dphelper.load = {
37
-
38
- /*
39
- Example:
40
- var cntx = require.context( __dirname + '/scripts/', false , /\.js$/ );
41
- dphelper.load.import( cntx );
42
- */
43
- /*
44
- import: ( dir , type = false , extension = /\.js$/ ) => {
45
- let r = require.context( dir , type , extension );
46
- r.keys().forEach(
47
- ( key ) => (
48
- cache[ key ] = r( key )
49
- )
50
- );
51
- },
52
- */
53
-
54
- file: (element, path) => {
55
- fetch(path).then(async function (response) {
56
- const text = await response.text();
57
- //document.querySelector( element ).innerHTML = dphelper.text.nl2br( String(text) );
58
- document.querySelector( element ).innerHTML = String(text);
59
- });
60
- },
61
-
62
- json: function( file ){
63
- if ( file.match(/.(json)$/i ) ) return require( '' + file + '' );
64
- },
65
-
66
- remote: ( path, method='GET', type='application/json' ) => {
67
-
68
- fetch( path ,{
69
- method: method,
70
- headers : {
71
- 'Content-Type': type
72
- }
73
- })
74
- .then(
75
- function(response) {
76
- //return response.json();
77
- return response;
78
- }
79
- )
80
- .then(
81
- function( myFile ) {
82
- return myFile;
83
- }
84
- );
85
-
86
- },
87
-
88
- //TODO: API functions (more to be added) should be in their own file!
89
- axios: ( url, name ) => {
90
-
91
- if( !url || !name ) return;
92
-
93
- axios
94
- .get( url )
95
- .then( response => {
96
- dphelper.state.api[ name ] = response;
97
- console.log( response );
98
- })
99
- .catch(function (error) {
100
- console.debug(error);
101
- });
102
-
103
- }
104
-
105
- };
106
-
107
- Object.defineProperty( dphelper, 'load', {
108
- writable: false,
109
- configurable: false
110
- });
111
-
112
- //console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
package/scripts/math.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" : "Math",
12
- "description" : "",
13
- "version" : "0.0.1",
14
- "command" : "math",
15
- "subCommand" : [
16
- {
17
- "name":"rnd",
18
- "description":"test",
19
- },{
20
- "name":"tmr",
21
- "description":"test",
22
- },{
23
- "name":"add",
24
- "description":"test",
25
- },{
26
- "name":"sub",
27
- "description":"test",
28
- },{
29
- "name":"multi",
30
- "description":"test",
31
- },{
32
- "name":"div",
33
- "description":"test",
34
- },{
35
- "name":"rem",
36
- "description":"test",
37
- },{
38
- "name":"exp",
39
- "description":"test",
40
- },{
41
- "name":"isOdd",
42
- "description":"check if math is odd or even",
43
- }
44
- ],
45
- "example" : "",
46
- "author" : "Dario Passariello",
47
- "active" : true
48
- };
49
-
50
- dphelper._list.scripts.push( description );
51
-
52
- /***********************************************************************/
53
-
54
- dphelper.math = {
55
-
56
- rnd: () => {
57
- return Math.floor( 100000 + Math.random() * dphelper.math.tmr() );
58
- },
59
-
60
- tmr: () => {
61
- return Math.round( dphelper.time.epoch() / 1000 );
62
- },
63
-
64
- add: ( a , b ) => {
65
- return a + b;
66
- },
67
-
68
- sub: ( a , b ) => {
69
- return a - b;
70
- },
71
-
72
- multi: ( a , b ) => {
73
- return a * b;
74
- },
75
-
76
- div: ( a , b ) => {
77
- return a - b;
78
- },
79
-
80
- rem: ( a , b ) => {
81
- return a % b;
82
- },
83
-
84
- exp: ( a , b ) => {
85
- return a ** b;
86
- },
87
-
88
- isOdd: ( num ) => {
89
- var result = num % 2 == 0 ? true : false;
90
- return result;
91
- },
92
-
93
- };
94
-
95
- Object.defineProperty( dphelper, 'math', {
96
- writable: false,
97
- configurable: false
98
- });
99
-
100
- //console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
package/scripts/obj.js DELETED
@@ -1,118 +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" : "Obj",
12
- "description" : "",
13
- "version" : "0.0.1",
14
- "command" : "obj",
15
- "subCommand" : [
16
- {
17
- "name":"toArray",
18
- "description":"test"
19
- },{
20
- "name":"replaceNullObjects",
21
- "description":"test"
22
- },{
23
- "name":"serialize",
24
- "description":"test"
25
- },{
26
- "name":"deSerialize",
27
- "description":"test"
28
- }
29
- ],
30
- "example" : "",
31
- "author" : "Dario Passariello",
32
- "active" : true
33
- };
34
-
35
- dphelper._list.scripts.push( description );
36
-
37
- /***********************************************************************/
38
-
39
- dphelper.obj = {
40
-
41
- toArray: ( object ) => {
42
- return Object.entries( object );
43
- // .map(
44
- // ([ key, value ]) => {
45
- // //console.log( ">" , [ key, value ] );
46
- // Object.assign(
47
- // { key } ,
48
- // value && typeof value === 'object' ? {
49
- // array: dphelper.obj.toArray( value )
50
- // } : {
51
- // value, array: []
52
- // }
53
- // );
54
- // }
55
- // );
56
-
57
- },
58
-
59
- replaceNullObjects: (data) => {
60
- const loData = data
61
- Object.keys(data).forEach((key) => {
62
- if (data[key] === null) {
63
- loData[key] = ''
64
- }
65
- })
66
- return loData
67
- },
68
-
69
- serialize: ( value ) => {
70
-
71
- if (typeof value === 'function') {
72
- return value.toString();
73
- }
74
-
75
- if (typeof value === 'object') {
76
- let serializeObject = {};
77
- for (const [objectKey, objectValue] of Object.entries(value)) {
78
- console.info( `objectKey=${objectKey} value=${objectValue}` );
79
- serializeObject[objectKey] = dphelper.obj.serialize(objectValue);
80
- }
81
- return serializeObject;
82
- }
83
-
84
- return value;
85
-
86
- },
87
-
88
- deSerialize: ( valueNew ) => {
89
-
90
- if (valueNew.toLowerCase().startsWith( 'function(' ) ) {
91
- return Function('"use strict"; return ' + valueNew);
92
- }
93
-
94
- if (typeof valueNew === 'object') {
95
- let deserializeObject = {};
96
- for (const [objectKey, objectValue] of Object.entries(valueNew)) {
97
- console.info( `objectKey=${objectKey} value=${objectValue}` );
98
- deserializeObject[objectKey] = dphelper.obj.deSerialize(objectValue);
99
- }
100
- return deserializeObject;
101
- }
102
-
103
- return value;
104
- },
105
-
106
- sort: ( o )=>{
107
- return Object.keys(o).sort().reduce((r, k) => (r[k] = o[k], r), {});
108
- }
109
-
110
- };
111
-
112
- Object.defineProperty( dphelper, 'obj', {
113
- writable: false,
114
- configurable: false
115
- });
116
-
117
- //console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
118
-
package/scripts/path.js DELETED
@@ -1,101 +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" : "Path",
12
- "description" : "url path: rail, hash or query to array",
13
- "version" : "0.0.1",
14
- "command" : "path",
15
- "subCommand" : [
16
- {
17
- "name":"rail",
18
- "description":"test"
19
- },{
20
- "name":"hash",
21
- "description":"test"
22
- },{
23
- "name":"query",
24
- "description":"test"
25
- }
26
- ],
27
- "example" : "",
28
- "author" : "Dario Passariello",
29
- "active" : true
30
- };
31
-
32
- dphelper._list.scripts.push( description );
33
-
34
- /***********************************************************************/
35
-
36
- // // ALIAS
37
- // dphelper.pathHash = () => {
38
- // console.debug( 'dpHelper: Please use "dphelper.path.hash()"' );
39
- // return dphelper.path.hash();
40
- // };
41
-
42
- // dphelper.pathQuery = () => {
43
- // console.debug( 'dpHelper: Please use "dphelper.path.query()"' );
44
- // return dphelper.path.query();
45
- // };
46
-
47
- // dphelper.pathRail = () => {
48
- // console.debug( 'dpHelper: Please use "dphelper.path.rail()"' );
49
- // return dphelper.path.rail();
50
- // };
51
-
52
- /***********************************************************************/
53
-
54
- dphelper.path = {
55
-
56
- rail: () => {
57
- const array = location.href
58
- .split("?")[0]
59
- .replace(location.protocol, '')
60
- .replace(location.host, '')
61
- .replace(location.hash, '')
62
- .split('/');
63
- if ( array.length > 0 ) {
64
- const arrayFinal = array.filter(item => item);
65
- return arrayFinal;
66
- } else {
67
- return;
68
- }
69
- },
70
-
71
- hash: () => {
72
- const array = location.hash.replace('#', '').split('/');
73
- if (array.length) {
74
- return array.filter(item => item);
75
- } else {
76
- return ["empty"];
77
- }
78
- },
79
-
80
- query: () => {
81
- let x, y, array = [], search = location.search;
82
- if (search) {
83
- search.replace("?", '').split('&')
84
- .map(x => {
85
- y = x.split('=');
86
- array[y[0]] = y[1];
87
- });
88
- return array;
89
- } else {
90
- return ["empty"];
91
- }
92
- }
93
-
94
- };
95
-
96
- Object.defineProperty( dphelper, 'path', {
97
- writable: false,
98
- configurable: false
99
- });
100
-
101
- //console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
@@ -1,56 +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" : "Promise",
12
- "description" : "",
13
- "version" : "0.0.1",
14
- "command" : "promise",
15
- "subCommand" : [
16
- {
17
- "name":"check",
18
- "description":"test"
19
- },{
20
- "name":"resolve",
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.promise = {
34
-
35
- check: (p) => {
36
- return p && Object.prototype.toString.call(p) === "[object Promise]";
37
- },
38
-
39
- resolve: async ( data ) => {
40
- var p = {};
41
- if( dphelper.promise.check( data ) ){
42
- Promise.resolve( data ).then( function( value ) {
43
- p.promise = value;
44
- });
45
- return await p;
46
- }
47
- },
48
-
49
- };
50
-
51
- Object.defineProperty( dphelper, 'promise', {
52
- writable: false,
53
- configurable: false
54
- });
55
-
56
- //console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
package/scripts/screen.js DELETED
@@ -1,82 +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" : "Screen",
12
- "description" : "",
13
- "version" : "0.0.1",
14
- "command" : "screen",
15
- "subCommand" : [
16
- {
17
- "name":"fullScreen",
18
- "description":"test"
19
- },{
20
- "name":"toggle",
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.screen = {
34
-
35
- fullScreen: function( el ){
36
-
37
- if ( el.requestFullScreen ) {
38
- el.requestFullScreen();
39
- } else if ( el.mozRequestFullScreen ) {
40
- el.mozRequestFullScreen();
41
- } else if ( el.webkitRequestFullScreen ) {
42
- el.webkitRequestFullScreen();
43
- }
44
-
45
- },
46
-
47
- toggle: function( el ) {
48
-
49
- let requestFullScreen = el.requestFullscreen || el.mozRequestFullScreen || el.webkitRequestFullScreen || el.msRequestFullscreen;
50
- let cancelFullScreen = el.exitFullscreen || el.mozCancelFullScreen || el.webkitExitFullscreen || el.msExitFullscreen;
51
-
52
- if( !doc.fullscreenElement && !el.mozFullScreenElement && !el.webkitFullscreenElement && !el.msFullscreenElement ) {
53
- requestFullScreen.call( el );
54
- }else{
55
- cancelFullScreen.call( el );
56
- }
57
-
58
- },
59
-
60
- info:() => {
61
- var final = [
62
- screen.width,
63
- screen.height,
64
- screen.availWidth,
65
- screen.availHeight,
66
- screen.colorDepth,
67
- screen.pixelDepth
68
- ];
69
- return final;
70
- }
71
-
72
- };
73
-
74
- // dphelper.fullScreen.go( document.body )
75
- // dphelper.fullScreen.toggle( document.body )
76
-
77
- Object.defineProperty( dphelper, 'screen', {
78
- writable: false,
79
- configurable: false
80
- });
81
-
82
- //console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )