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
@@ -1,93 +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" : "Storage",
12
- "description" : "",
13
- "version" : "0.0.1",
14
- "command" : "storage",
15
- "subCommand" : [
16
- {
17
- "name":"get",
18
- "description":"test"
19
- },{
20
- "name":"set",
21
- "description":"test"
22
- },{
23
- "name":"delete",
24
- "description":"test"
25
- },{
26
- "name":"clearAll",
27
- "description":"test"
28
- },{
29
- "name":"increaseQuota",
30
- "description":"test"
31
- }
32
- ],
33
- "example" : "",
34
- "author" : "Dario Passariello",
35
- "active" : true
36
- };
37
-
38
- dphelper._list.scripts.push( description );
39
-
40
- /***********************************************************************/
41
-
42
- dphelper.storage = {
43
-
44
- get: ( name ) => {
45
- if(!name) return;
46
- return window.localStorage.getItem( name );
47
- },
48
-
49
- set: ( name, value ) => {
50
- if(!name || !value) return;
51
- window.localStorage.setItem( name, JSON.stringify(value) );
52
- },
53
-
54
- delete: ( name ) => {
55
- if(!name) return;
56
- window.localStorage.removeItem( name );
57
- },
58
-
59
- clearAll: () => {
60
- window.localStorage.clear();
61
- },
62
-
63
- quota: () => {
64
- if ('storage' in navigator && 'estimate' in navigator.storage) {
65
- navigator.storage.estimate().then(({usage, quota}) => {
66
- console.log(`Using ${usage/1024} out of ${quota/1024} Mb.`);
67
- });
68
- }
69
- },
70
-
71
- increaseQuota: ( quota ) => {
72
- window.webkitStorageInfo.requestQuota(
73
- window.PERSISTENT,
74
- quota,
75
- function( bytes ) {
76
- alert( "Quota is available: " + bytes );
77
- },
78
- function( e ) {
79
- alert( "Error allocating quota: " + e );
80
- });
81
- }
82
-
83
- };
84
-
85
- // START STORAGE DB
86
- // dphelper.storage.set( "dpHelper", 'active' );
87
-
88
- Object.defineProperty( dphelper, 'storage', {
89
- writable: false,
90
- configurable: false
91
- });
92
-
93
- //console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
package/scripts/store.js DELETED
@@ -1,115 +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" : "Store",
12
- "description" : "",
13
- "version" : "0.0.1",
14
- "command" : "store",
15
- "subCommand" : [
16
- {
17
- "name":"get",
18
- "description":"test"
19
- },{
20
- "name":"set",
21
- "description":"test"
22
- },{
23
- "name":"update",
24
- "description":"test"
25
- },{
26
- "name":"clear",
27
- "description":"test"
28
- },{
29
- "name":"delete",
30
- "description":"test"
31
- },
32
- ],
33
- "example" : "",
34
- "author" : "Dario Passariello",
35
- "active" : true
36
- };
37
-
38
- dphelper._list.scripts.push( description );
39
-
40
- /***********************************************************************/
41
-
42
- dphelper.store = {
43
-
44
- data: [],
45
-
46
- get: ( name ) => {
47
- if(!name) return;
48
- return window.store.data[name];
49
- },
50
-
51
- set: ( name , value , protect = false ) => {
52
- if( !name ) return;
53
- if( protect === true ) value = [...value, protect=true ];
54
- window.store.data[ name ] = value;
55
- },
56
-
57
- update: ( name , value ) => {},
58
-
59
- clear: () => {},
60
-
61
- clearAll: () => {},
62
-
63
- delete: () => {}
64
-
65
- };
66
-
67
- // SET STORE
68
- window.store = dphelper.store;
69
-
70
- /***********************************************************************/
71
-
72
- // set: ( name, value, persist = true, protect = true )=>{
73
- // let n = dphelper.text.sanitize( name );
74
- // let data = window._dph_State[ name ];
75
-
76
- // const persistent = ( name, value ) => {
77
- // dphelper.indexedDB.create( 'dphelper', 'state' );
78
- // dphelper.indexedDB.create( name, value );
79
- // };
80
-
81
- // // CHECK OVERRIDE
82
- // if( data && data['protect'] === true ){
83
- // console.debug( name + ' is data protected, please delete first' );
84
- // return;
85
- // }
86
-
87
- // // OVERRIDE IF IT'S POSSIBLE
88
- // if( !data || !data['protect'] || data['protect'] === false ){
89
- // window._dph_State[ name ] = value;
90
- // window._dph_State[ name ]['protected'] = protect;
91
-
92
- // // SAVE AS PERSISTENT DATA INTO INDEXEDBD
93
- // if( persist ){
94
- // persistent( name, value );
95
- // }
96
- // }
97
-
98
-
99
- // },
100
-
101
- // get: ( name )=>{
102
- // let data = window._dph_State[ name ];
103
- // if(!data) console.debug( name + ' not in state memory' );
104
- // else return data;
105
- // },
106
-
107
- // delete: ()=>{}
108
- // },
109
-
110
- Object.defineProperty( dphelper, 'store', {
111
- writable: false,
112
- configurable: false
113
- });
114
-
115
- //console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
package/scripts/svg.js DELETED
@@ -1,380 +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" : "Svg",
12
- "description" : "realtime SVG",
13
- "version" : "0.0.1",
14
- "command" : "svg",
15
- "subCommand" : [
16
- {
17
- "name":"check",
18
- "description":"test"
19
- },{
20
- "name":"init",
21
- "description":"test"
22
- },{
23
- "name":"update",
24
- "description":"test"
25
- },{
26
- "name":"getCurve",
27
- "description":"test"
28
- },{
29
- "name":"getIntersection",
30
- "description":"test"
31
- },{
32
- "name":"setConnector",
33
- "description":"test"
34
- },{
35
- "name":"removeConnection",
36
- "description":"test"
37
- },{
38
- "name":"makeScrollable",
39
- "description":"test"
40
- },{
41
- "name":"makeDraggable",
42
- "description":"test"
43
- },{
44
- "name":"toggle",
45
- "description":"test"
46
- }
47
- ],
48
- "example" : "",
49
- "author" : "Dario Passariello",
50
- "active" : true
51
- };
52
-
53
- dphelper._list.scripts.push( description );
54
-
55
- /***********************************************************************/
56
-
57
- dphelper.svg = {
58
-
59
- check: () => {
60
- if ( typeof dphelper.svg.check.supported == "undefined" ) {
61
- let a = document.body.appendChild( document.createElement( 'div' ) );
62
- a.innerHTML = '<v:shape id="vml_flag1" adj="1" />';
63
- let b = a.firstChild;
64
- b.style.behavior = "url(#default#VML)";
65
- dphelper.svg.check.supported = b ? typeof b.adj == "object" : true;
66
- a.parentNode.removeChild( a );
67
- }
68
- return dphelper.svg.check.supported;
69
- },
70
-
71
- init: function( container, source1, source2, cb ) {
72
-
73
- if( $( container ).find( 'svg' ) ) {
74
- dphelper.svg_removeConnection( container );
75
- }
76
-
77
- source1 = dphelper.svg.setConnector( source1[ 0 ], source1[ 1 ] );
78
- source2 = dphelper.svg.setConnector( source2[ 0 ], source2[ 1 ] );
79
-
80
- let parentCoords = container.getBoundingClientRect();
81
-
82
- let xmlns = "http://www.w3.org/2000/svg";
83
- let boxWidth = container.offsetWidth * 10;
84
- let boxHeight = container.offsetHeight * 10;
85
-
86
- // create svg container
87
- let svgElem = document.createElementNS( xmlns, "svg" );
88
-
89
- svgElem.setAttribute( "xmlns" , xmlns );
90
- svgElem.setAttributeNS( null , "id" , "pathConnection" );
91
- svgElem.setAttributeNS( null , "viewBox" , "0 0 " + boxWidth + " " + boxHeight );
92
- svgElem.setAttributeNS( null , "width" , boxWidth );
93
- svgElem.setAttributeNS( null , "height" , boxHeight );
94
- svgElem.style.display = "block";
95
-
96
- /*
97
- // TO DO: smaller cyrcle
98
- // DARIO: probably is too invasive on UI, I change just border on parts_container_
99
-
100
- // create arrow
101
- let defs = document.createElementNS(xmlns, "defs");
102
- let marker = document.createElementNS(xmlns, "marker");
103
- let path = document.createElementNS(xmlns, "path");
104
- marker.setAttributeNS(null, 'id', 'head');
105
- marker.setAttributeNS(null, 'orient', 'auto');
106
- marker.setAttributeNS(null, 'markerWidth', '20');
107
- marker.setAttributeNS(null, 'markerHeight', '40');
108
- marker.setAttributeNS(null, 'refX', '0');
109
- marker.setAttributeNS(null, 'refY', '3');
110
- path.setAttributeNS(null, 'd', 'M0,0 V6 L3,3 Z');
111
- marker.appendChild(path);
112
- defs.appendChild(marker);
113
- svgElem.appendChild(defs);
114
- */
115
-
116
- // create rect which overlaps source1
117
- let rect1 = document.createElementNS( xmlns , "rect" );
118
- let coords = source1.getBoundingClientRect();
119
-
120
- rect1.setAttributeNS( null, 'x', coords.left - parentCoords.left );
121
- rect1.setAttributeNS( null, 'y', coords.top - parentCoords.top );
122
- rect1.setAttributeNS( null, 'width', coords.width );
123
- rect1.setAttributeNS( null, 'height', coords.height );
124
- svgElem.appendChild( rect1 );
125
-
126
- // create rect which overlaps source2
127
- let rect2 = document.createElementNS( xmlns, "rect" );
128
- coords = source2.getBoundingClientRect();
129
-
130
- rect2.setAttributeNS( null, 'x', coords.left - parentCoords.left );
131
- rect2.setAttributeNS( null, 'y', coords.top - parentCoords.top );
132
- rect2.setAttributeNS( null, 'width', coords.width );
133
- rect2.setAttributeNS( null, 'height', coords.height );
134
- svgElem.appendChild( rect2 );
135
-
136
- // create path connecting both rects
137
- let path = document.createElementNS( xmlns, "path" );
138
-
139
- path.setAttributeNS( null, 'id', 'connection' );
140
- path.setAttributeNS( null, 'marker-end', 'url(#head)' );
141
- svgElem.appendChild( path );
142
-
143
- container.appendChild( svgElem );
144
-
145
- dphelper.svg.update( $( rect1 )[0], $( rect2 )[0], $( '#connection' )[0]);
146
-
147
- if( typeof cb == 'function' ) {
148
- cb( source1, source2 );
149
- }
150
-
151
- },
152
-
153
- update: function( rect1 , rect2 , cxn ) {
154
-
155
- // Top left coordinates
156
- let x1 = parseFloat( rect1.getAttribute( 'x' ) );
157
- let y1 = parseFloat( rect1.getAttribute( 'y' ) );
158
- let x2 = parseFloat( rect2.getAttribute( 'x') );
159
- let y2 = parseFloat( rect2.getAttribute( 'y' ) );
160
-
161
- // Half widths and half heights
162
- let w1 = parseFloat( rect1.getAttribute( 'width' ) ) / 2;
163
- let h1 = parseFloat( rect1.getAttribute( 'height' ) ) / 2;
164
- let w2 = parseFloat( rect2.getAttribute( 'width' ) ) / 2;
165
- let h2 = parseFloat( rect2.getAttribute( 'height' ) ) / 2;
166
-
167
- // Center coordinates
168
- let cx1 = x1 + w1;
169
- let cy1 = y1 + h1;
170
- let cx2 = x2 + w2;
171
- let cy2 = y2 + h2;
172
-
173
- // Distance between centers
174
- let dx = cx2 - cx1;
175
- let dy = cy2 - cy1;
176
-
177
- let p1 = dphelper.svg.getIntersection( dx , dy , cx1 , cy1 , w1 , h1 );
178
- let p2 = dphelper.svg.getIntersection( -dx , -dy , cx2 , cy2 , w2 , h2 );
179
-
180
- // Distance between edges
181
- let dx1 = p2[ 0 ] - p1[ 0 ];
182
-
183
- let d = dphelper.svg.getCurve( p1 , p2 , dx1 );
184
-
185
- // Set a path connector
186
- cxn.setAttributeNS( null , 'd' , "M" + cx1 + "," + cy1 + d + cx2 + "," + cy2 );
187
-
188
- // Set a line connector
189
- // cxn.setAttributeNS( null , 'x1' , p1[0] );
190
- // cxn.setAttributeNS( null , 'y1' , p1[1] );
191
- // cxn.setAttributeNS( null , 'x2' , p2[0] );
192
- // cxn.setAttributeNS( null , 'y2' , p2[1] );
193
-
194
- },
195
-
196
- getCurve: function( p1 , p2 , dx ) {
197
-
198
- let curve = dx / 2;
199
- let d = " C" + ( curve + p1[0] ) + "," + p1[1] + " " + ( p2[0] - curve ) + "," + p2[1] + " ";
200
- return d;
201
-
202
- },
203
-
204
- getIntersection: function( dx , dy , cx , cy , w , h ) {
205
-
206
- if ( Math.abs( dy / dx ) < h / w )
207
- return [ cx + ( dx > 0 ? w : -w ), cy + dy * w / Math.abs( dx ) ];
208
- else
209
- return [ cx + dx * h / Math.abs( dy ), cy + ( dy > 0 ? h : -h ) ];
210
-
211
- },
212
-
213
- setConnector: function( source , side ) {
214
-
215
- let style;
216
- let span = $( '<span class="connector"></span>' );
217
-
218
- $( source ).css( 'position' , 'relative' );
219
-
220
- span.css({
221
- position: 'absolute',
222
- width: '5px',
223
- height: '5px',
224
- });
225
-
226
- switch( side ) {
227
- case 'top':
228
- style = {
229
- left: '50%',
230
- top: '2.5px',
231
- marginLeft: '2.5px'
232
- };
233
- break;
234
- case 'right':
235
- style = {
236
- top: '50%',
237
- right: '2.5px',
238
- marginTop: '-2.5px'
239
- };
240
- break;
241
- case 'bottom':
242
- style = {
243
- left: '50%',
244
- bottom: '-2.5px',
245
- marginLeft: '2.5px'
246
- };
247
- break;
248
- case 'left':
249
- style = {
250
- top: '50%',
251
- left: '-2.5px',
252
- marginTop: '-2.5px'
253
- };
254
- break;
255
- default:
256
- style = {};
257
- }
258
-
259
- span.css( style );
260
-
261
- $( source ).append( span );
262
-
263
- return $( span )[ 0 ];
264
- },
265
-
266
- removeConnection: function( container ) {
267
-
268
- $( container ).find( 'svg#pathConnection' ).each( function( i , elm ) {
269
- $( elm ).remove();
270
- });
271
-
272
- },
273
-
274
- makeScrollable: function( svgContainer , scrollContainer , elm1 , elm2 , rect1 , rect2 ) {
275
-
276
- //let scrollCoords = scrollContainer.getBoundingClientRect();
277
- let svgCoords = svgContainer.getBoundingClientRect();
278
-
279
- let el = [ elm1 , elm2 ];
280
- let rec = [ rect1 , rect2 ];
281
- let coords = [];
282
-
283
- for( let i = 0; i < el.length; i++ ){
284
-
285
- coords[ i ] = el[ i ].getBoundingClientRect();
286
-
287
- rec[ i ].setAttributeNS( null, 'x', coords[ i ].left - svgCoords.left );
288
- rec[ i ].setAttributeNS( null, 'y', coords[ i ].top - svgCoords.top );
289
- rec[ i ].setAttributeNS( null, 'width', coords[ i ].width );
290
- rec[ i ].setAttributeNS( null, 'height', coords[ i ].height );
291
-
292
- }
293
-
294
- //***************************************************************
295
-
296
- dphelper.svg.update( $( rect1 )[ 0 ], $( rect2 )[ 0 ], $( '#connection' )[ 0 ]);
297
-
298
- },
299
-
300
- makeDraggable: function( evt ) {
301
-
302
- let svg = evt.target;
303
- svg.addEventListener( 'mousedown' , startDrag );
304
- svg.addEventListener( 'mousemove' , drag );
305
- svg.addEventListener( 'mouseup' , endDrag );
306
-
307
- function getMousePosition( e ) {
308
- let CTM = svg.getScreenCTM();
309
- return {
310
- x: ( evt.clientX - CTM.e ) / CTM.a,
311
- y: ( evt.clientY - CTM.f ) / CTM.d
312
- };
313
- }
314
-
315
- let selectedElement, offset;
316
-
317
- function startDrag( evt ) {
318
-
319
- if ( evt.target.classList.contains( 'draggable' ) ) {
320
- selectedElement = evt.target;
321
- offset = getMousePosition( evt );
322
- offset.x -= parseFloat( selectedElement.getAttributeNS( null , "x" ) );
323
- offset.y -= parseFloat( selectedElement.getAttributeNS( null , "y" ) );
324
- }
325
-
326
- }
327
-
328
- function drag( evt ) {
329
-
330
- if ( selectedElement ) {
331
- let coord = getMousePosition( evt );
332
- selectedElement.setAttributeNS( null, "x" , coord.x - offset.x );
333
- selectedElement.setAttributeNS( null, "y" , coord.y - offset.y );
334
- dphelper.svg.update();
335
- }
336
-
337
- }
338
-
339
- function endDrag( evt ) {
340
- selectedElement = null;
341
- }
342
-
343
- },
344
-
345
- toggle: function( evt , container , source1 , source2 ) {
346
-
347
- if( $( evt.target ).prop( 'checked' ) && $( source1 ).length && $( source2 ).length ) {
348
-
349
- dphelper.cookie.set( $( evt.target ).attr( 'id' ), 1, 365 );
350
-
351
- dphelper.svg_initConnection( container[0], [ $( source1 )[0], 'right' ], [ $( source2 )[0], 'left' ], function( source1 , source2 ) {
352
-
353
- $( '#parts-left-body' ).on( 'scroll', function( evt ){
354
- dphelper.svg.makeScrollable( $( container )[0], $( '#parts-left-body' )[0], $( source1 )[0],
355
- $( source2 )[0], $( '#parts svg rect' )[0], $( '#parts svg rect' )[ 1 ] );
356
- });
357
-
358
- });
359
-
360
- } else {
361
-
362
- dphelper.svg_removeConnection( container );
363
- $( '#parts-left-body' ).unbind( 'scroll' );
364
- dphelper.cookie.set( $( evt.target ).attr( 'id' ), 0, 365 );
365
-
366
- }
367
-
368
- }
369
-
370
- };
371
-
372
- dphelper.svg.check();
373
-
374
- Object.defineProperty( dphelper, 'svg', {
375
- writable: false,
376
- configurable: false
377
- });
378
-
379
- //console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
380
-
package/scripts/text.js DELETED
@@ -1,116 +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" : "Text",
12
- "description" : "",
13
- "version" : "0.0.1",
14
- "command" : "text",
15
- "subCommand" : [
16
- {
17
- "name":"trim",
18
- "description":"test"
19
- },{
20
- "name":"capitalize",
21
- "description":"test"
22
- },{
23
- "name":"lower",
24
- "description":"test"
25
- },{
26
- "name":"upper",
27
- "description":"test"
28
- },{
29
- "name":"nl2br",
30
- "description":"test"
31
- },{
32
- "name":"sanitize",
33
- "description":"test"
34
- },{
35
- "name":"camelCase",
36
- "description":"test",
37
- "subCommand" : [
38
- {
39
- "name":"toSpace",
40
- "description":"test",
41
- "subCommand" : []
42
- },{
43
- "name":"toUnderscore",
44
- "description":"test",
45
- "subCommand" : []
46
- }
47
- ]
48
- }
49
- ],
50
- "example" : "",
51
- "author" : "Dario Passariello",
52
- "active" : true
53
- };
54
-
55
- dphelper._list.scripts.push( description );
56
-
57
- /***********************************************************************/
58
-
59
- dphelper.text ={
60
-
61
- trim: ( s, c, b, e ) => {
62
- // trim(string, '#', 1, 7
63
- return ( s.charAt(0) === c ) ? s.substring(b, e) : s;
64
- },
65
-
66
- capitalize: (txt) => {
67
- return txt
68
- .toLowerCase()
69
- .replace(/\b\w/g, function (l) {
70
- return l.toUpperCase();
71
- });
72
- },
73
-
74
- lower: (txt) => {
75
- return txt.toLowerCase();
76
- },
77
-
78
- upper: (txt) => {
79
- return txt.toUpperCase();
80
- },
81
-
82
- nl2br: (str) => {
83
- return str.replace(/(?:\r\n|\r|\n)/g, '<br>');
84
- },
85
-
86
- sanitize: (str) => {
87
- return str.replace(/[^\w ]/g, '');
88
- },
89
-
90
- camelCase: {
91
-
92
- toSpace: ( string ) => {
93
- return string
94
- .replace(/([A-Z])/g, ' $1')
95
- .replace(/^./, function(str){
96
- return str.toUpperCase();
97
- });
98
- },
99
-
100
- toUnderscore: ( string ) => {
101
- return string
102
- .replace(/\.?([A-Z])/g, function (x,y){
103
- return "_" + y.toLowerCase();
104
- }).replace(/^_/, "");
105
- },
106
-
107
- }
108
-
109
- };
110
-
111
- Object.defineProperty( dphelper, 'text', {
112
- writable: false,
113
- configurable: false
114
- });
115
-
116
- //console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )