dphelper 2.6.4 → 3.0.0
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/CODE_OF_CONDUCT.md +108 -0
- package/COPYRIGHT.md +6 -0
- package/README.md +133 -291
- package/SECURITY.md +3 -0
- package/index.js +173 -1
- package/package.json +53 -153
- package/types/dphelper.d.ts +143 -543
- package/types/index.d.ts +48 -0
- package/types/scripts/generate-imports.d.ts +1 -0
- package/types/scripts/over.d.ts +1 -0
- package/types/scripts/setProps.d.ts +1 -0
- package/types/scripts/setupGlobal.d.ts +1 -0
- package/types/tools/ai/index.d.ts +1 -0
- package/types/tools/anchor/index.d.ts +1 -0
- package/types/tools/array/index.d.ts +1 -0
- package/types/tools/audio/index.d.ts +1 -0
- package/types/tools/avoid/index.d.ts +1 -0
- package/types/tools/browser/index.d.ts +1 -0
- package/types/tools/check/index.d.ts +1 -0
- package/types/tools/color/index.d.ts +1 -0
- package/types/tools/cookie/index.d.ts +1 -0
- package/types/tools/coords/index.d.ts +1 -0
- package/types/tools/credits/index.d.ts +1 -0
- package/types/tools/date/index.d.ts +1 -0
- package/types/tools/disable/index.d.ts +1 -0
- package/types/tools/dispatch/index.d.ts +1 -0
- package/types/tools/elements/index.d.ts +1 -0
- package/types/tools/events/index.d.ts +1 -0
- package/types/tools/fetch/index.d.ts +1 -0
- package/types/tools/form/index.d.ts +1 -0
- package/types/tools/format/index.d.ts +1 -0
- package/types/tools/json/index.d.ts +1 -0
- package/types/tools/load/index.d.ts +1 -0
- package/types/tools/logging/index.d.ts +1 -0
- package/types/tools/math/index.d.ts +1 -0
- package/types/tools/memory/index.d.ts +1 -0
- package/types/tools/objects/index.d.ts +1 -0
- package/types/tools/path/index.d.ts +1 -0
- package/types/tools/promise/index.d.ts +1 -0
- package/types/tools/sanitize/index.d.ts +1 -0
- package/types/tools/screen/index.d.ts +1 -0
- package/types/tools/screen/popupManager.d.ts +32 -0
- package/types/tools/scrollbar/index.d.ts +1 -0
- package/types/tools/security/index.d.ts +1 -0
- package/types/tools/shortcut/index.d.ts +1 -0
- package/types/tools/socket/index.d.ts +1 -0
- package/types/tools/sse/index.d.ts +1 -0
- package/types/tools/svg/index.d.ts +1 -0
- package/types/tools/sync/index.d.ts +1 -0
- package/types/tools/system/index.d.ts +1 -0
- package/types/tools/text/index.d.ts +1 -0
- package/types/tools/timer/index.d.ts +1 -0
- package/types/tools/tools/index.d.ts +1 -0
- package/types/tools/translators/index.d.ts +1 -0
- package/types/tools/triggers/index.d.ts +1 -0
- package/types/tools/types/index.d.ts +1 -0
- package/types/tools/ui/index.d.ts +1 -0
- package/types/tools/window/index.d.ts +1 -0
- package/DISCLAIMER.md +0 -11
- package/docs/_config.yml +0 -1
- package/docs/index.md +0 -380
- package/documents/OBSERVER.md +0 -63
- package/documents/SESSION.md +0 -54
- package/documents/STATE.md +0 -65
- package/documents/STORE.md +0 -76
- package/documents/SUMMARY.md +0 -24
- package/documents/TOOLS.md +0 -1282
- package/documents/USEOBSERVER.md +0 -26
- package/index.d.ts +0 -22
- package/types/cache.d.ts +0 -27
- package/types/idb.d.ts +0 -21
- package/types/jquery.d.ts +0 -20
- package/types/memorio.d.ts +0 -21
- package/types/observer.d.ts +0 -47
- package/types/session.d.ts +0 -67
- package/types/state.d.ts +0 -71
- package/types/store.d.ts +0 -91
- package/types/useobserver.d.ts +0 -28
package/documents/USEOBSERVER.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# useObserver
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This document provides a comprehensive list of all available useObserver functions in the `dpHelper` library along with their descriptions and examples.
|
|
6
|
-
|
|
7
|
-
## Functions
|
|
8
|
-
|
|
9
|
-
### useObserver(()=>{ YOUR CODE }, "state.name")
|
|
10
|
-
|
|
11
|
-
- **Description:** Sets up an useObserver to monitor state changes and trigger a callback.
|
|
12
|
-
- **Parameters:**
|
|
13
|
-
- `stateName` (string): The name of the state to monitor.
|
|
14
|
-
- `callBack` (Function): The callback function to run when the state changes.
|
|
15
|
-
- `option` (object): Additional options for the useObserver.
|
|
16
|
-
|
|
17
|
-
- **Example:**
|
|
18
|
-
> The format is really similar to React useEffect
|
|
19
|
-
|
|
20
|
-
```javascript
|
|
21
|
-
useObserver(
|
|
22
|
-
() => {
|
|
23
|
-
console.log('State changed:', newValue);
|
|
24
|
-
}, 'state.test'
|
|
25
|
-
);
|
|
26
|
-
```
|
package/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
dphelper
|
|
3
|
-
Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under MIT License, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// VENDORS
|
|
9
|
-
/// <reference path="./types/jquery.d.ts" />
|
|
10
|
-
/// <reference path="./types/idb.d.ts" />
|
|
11
|
-
|
|
12
|
-
// BY DARIO PASSARIELLO
|
|
13
|
-
/// <reference path="./types/dphelper.d.ts" />
|
|
14
|
-
/// <reference path="./types/memorio.d.ts" />
|
|
15
|
-
/// <reference path="./types/observer.d.ts" />
|
|
16
|
-
/// <reference path="./types/useObserver.d.ts" />
|
|
17
|
-
/// <reference path="./types/state.d.ts" />
|
|
18
|
-
/// <reference path="./types/session.d.ts" />
|
|
19
|
-
/// <reference path="./types/store.d.ts" />
|
|
20
|
-
/// <reference path="./types/cache.d.ts" />
|
|
21
|
-
|
|
22
|
-
|
package/types/cache.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
dphelper
|
|
3
|
-
Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under MIT License, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Cache is used for internal use only... but you can use if you need.
|
|
10
|
-
* @return Some stuff you cache... usually used for dynamic imports from dphelper.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
interface _cache {
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Create a cache, please use state instead!
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* cache.myCache = any
|
|
20
|
-
*
|
|
21
|
-
* @since dphelper 1.0.6
|
|
22
|
-
*/
|
|
23
|
-
[key: string]: any
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
declare var cache: _cache
|
|
27
|
-
type cache = _cache
|
package/types/idb.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
dphelper
|
|
3
|
-
Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under MIT License, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* idb is indexedDB simplification by dphelper
|
|
10
|
-
* @return IndexedDB editing and maintain.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
interface _idb {
|
|
14
|
-
[key: string]: any
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare var idb: _idb
|
|
18
|
-
declare var idbases: any
|
|
19
|
-
|
|
20
|
-
type idb = _idb
|
|
21
|
-
type idbases = {}
|
package/types/jquery.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
dphelper
|
|
3
|
-
Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under MIT License, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
declare var $: any
|
|
9
|
-
declare var jQuery: any
|
|
10
|
-
declare module 'jquery'
|
|
11
|
-
|
|
12
|
-
// ////////////////////////////////////////////////////////////////
|
|
13
|
-
|
|
14
|
-
interface window {
|
|
15
|
-
$: any
|
|
16
|
-
jQuery: any
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
type $ = {}
|
|
20
|
-
type jQuery = {}
|
package/types/memorio.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
memorio
|
|
3
|
-
Copyright (c) 2025 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under MIT License, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
////////////////////
|
|
9
|
-
// Global object
|
|
10
|
-
////////////////////
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @return memorio Root.
|
|
14
|
-
*/
|
|
15
|
-
interface _memorio {}
|
|
16
|
-
|
|
17
|
-
////////////////////////////////////////////////////////////////////////////
|
|
18
|
-
|
|
19
|
-
declare var memorio: _memorio
|
|
20
|
-
type memorio = _memorio
|
|
21
|
-
|
package/types/observer.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
memorio
|
|
3
|
-
Copyright (c) 2025 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under MIT License, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Observer run a callback anytime the associated state going to change
|
|
10
|
-
* @return Execution of function after state change.
|
|
11
|
-
*/
|
|
12
|
-
interface _observer {
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Generate your observer
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* observer("myState", Function)
|
|
19
|
-
*
|
|
20
|
-
* @since memorio 1.0.6
|
|
21
|
-
*/
|
|
22
|
-
(stateName: string, callBack: any): any
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* List of active observers
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* observer.list()
|
|
29
|
-
*
|
|
30
|
-
* @since memorio 1.0.6
|
|
31
|
-
*/
|
|
32
|
-
readonly list?: () => void
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Remove the active observer (not the state)
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* observer.remove("myState")
|
|
39
|
-
*
|
|
40
|
-
* @since memorio 1.0.6
|
|
41
|
-
*/
|
|
42
|
-
readonly remove?: (name: string, callBack?: any, flag?: boolean) => void
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
declare var observer: _observer
|
|
47
|
-
type observer = _observer
|
package/types/session.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
memorio
|
|
3
|
-
Copyright (c) 2025 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under MIT License, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Create states using: session.set("example",{test:"test"})
|
|
10
|
-
*/
|
|
11
|
-
interface _session {
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Create a new session
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* session.set("test","example") // or Array, Object, Number, Functions...
|
|
18
|
-
*
|
|
19
|
-
* @since memorio 0.0.1
|
|
20
|
-
* @param name The String as name to define the session.
|
|
21
|
-
* @param param The information taht you want to session (Any).
|
|
22
|
-
* @return boolean
|
|
23
|
-
*/
|
|
24
|
-
set: (name: string, value: any) => void
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Have back the data from a session.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* session.get("test")
|
|
31
|
-
*
|
|
32
|
-
* @since memorio 0.0.1
|
|
33
|
-
* @param name The String as name to define the session.
|
|
34
|
-
*/
|
|
35
|
-
get: (name: string) => any
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Delete an existing session:
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* session.delete("test")
|
|
42
|
-
* session.remove("test")
|
|
43
|
-
*
|
|
44
|
-
* @since memorio 0.0.1
|
|
45
|
-
* @param name The String as name to define the session.
|
|
46
|
-
* @return boolean
|
|
47
|
-
*/
|
|
48
|
-
delete: (name: string) => boolean | undefined
|
|
49
|
-
remove: (name: string) => boolean | undefined
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Delete all storages
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* session.clearAll()
|
|
56
|
-
* session.removeAll()
|
|
57
|
-
*
|
|
58
|
-
* @since memorio 0.0.1
|
|
59
|
-
* @return boolean
|
|
60
|
-
*/
|
|
61
|
-
clearAll: () => boolean
|
|
62
|
-
removeAll: () => boolean
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
declare var session: _session
|
|
67
|
-
type session = _session
|
package/types/state.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
memorio
|
|
3
|
-
Copyright (c) 2025 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under MIT License, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* If you use only "state" you get the entire Proxy object
|
|
10
|
-
* @return Proxy Object of all states.
|
|
11
|
-
*/
|
|
12
|
-
interface _state {
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Create states using: state.test = "example"
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* state.myStuff = any
|
|
19
|
-
*
|
|
20
|
-
* @since memorio 0.0.1
|
|
21
|
-
* @param key The name of the state for which you want to modify the action.
|
|
22
|
-
* @return The previous values (Any).
|
|
23
|
-
* Important: Object is a Proxy.
|
|
24
|
-
*/
|
|
25
|
-
[key: string]: any
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Delete entire state using: state.remove("test")
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* state.remove(stateName)
|
|
32
|
-
*
|
|
33
|
-
* @since memorio 0.0.1
|
|
34
|
-
* @param stateName The name of the state for which you want to delete.
|
|
35
|
-
* @return boolean.
|
|
36
|
-
*/
|
|
37
|
-
readonly remove?: (stateName: string) => any
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* List all states using: state.list
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* state.removeAll()
|
|
44
|
-
*
|
|
45
|
-
* @since memorio 1.8.92
|
|
46
|
-
* @return Remove all states.
|
|
47
|
-
*/
|
|
48
|
-
readonly removeAll?: () => any
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* List all states using: state.list
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* state.list
|
|
55
|
-
*
|
|
56
|
-
* @since memorio 0.0.1
|
|
57
|
-
* @return Object of all states (Not the Proxy).
|
|
58
|
-
*/
|
|
59
|
-
readonly list?: (stateName: string) => any
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Generate a message for "memorio"
|
|
63
|
-
* Note: FOR INTERNAL USE ONLY.
|
|
64
|
-
* @since memorio 0.0.1
|
|
65
|
-
*/
|
|
66
|
-
readonly mex?: any
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
declare var state: _state
|
|
71
|
-
type state = _state
|
package/types/store.d.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
memorio
|
|
3
|
-
Copyright (c) 2025 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under MIT License, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Create states using: store.set("example",{test:"test"})
|
|
10
|
-
*/
|
|
11
|
-
interface _store {
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Create a new store
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* store.set("test","example") // or Array, Object, Number, Functions...
|
|
18
|
-
*
|
|
19
|
-
* @since memorio 0.0.1
|
|
20
|
-
* @param name The String as name to define the store.
|
|
21
|
-
* @param param The information taht you want to store (Any).
|
|
22
|
-
* @return boolean
|
|
23
|
-
*/
|
|
24
|
-
set: (name: string, value: any) => void
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Have back the data from a store.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* store.get("test")
|
|
31
|
-
*
|
|
32
|
-
* @since memorio 0.0.1
|
|
33
|
-
* @param name The String as name to define the store.
|
|
34
|
-
*/
|
|
35
|
-
get: (name: string) => any
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Delete an existing store:
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* store.delete("test")
|
|
42
|
-
* store.remove("test")
|
|
43
|
-
*
|
|
44
|
-
* @since memorio 0.0.1
|
|
45
|
-
* @param name The String as name to define the store.
|
|
46
|
-
* @return boolean
|
|
47
|
-
*/
|
|
48
|
-
delete: (name: string) => boolean | undefined
|
|
49
|
-
remove: (name: string) => boolean | undefined
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Delete all storages
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* store.clearAll()
|
|
56
|
-
* store.removeAll()
|
|
57
|
-
*
|
|
58
|
-
* @since memorio 0.0.1
|
|
59
|
-
* @return boolean
|
|
60
|
-
*/
|
|
61
|
-
clearAll: () => boolean
|
|
62
|
-
removeAll: () => boolean
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Know how much space you have for total storages
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* store.quota()
|
|
69
|
-
*
|
|
70
|
-
* @since memorio 0.0.1
|
|
71
|
-
* @return values
|
|
72
|
-
*/
|
|
73
|
-
quota: () => void
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Get the size of stores an the total
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* store.size()
|
|
80
|
-
*
|
|
81
|
-
* @since memorio 0.0.1
|
|
82
|
-
* @return dimension in kb
|
|
83
|
-
*/
|
|
84
|
-
size: () => number
|
|
85
|
-
|
|
86
|
-
// TODO
|
|
87
|
-
// readonly increaseQuota: (value: number) => void
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
declare var store: _store
|
|
91
|
-
type store = _store
|
package/types/useobserver.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
memorio
|
|
3
|
-
Copyright (c) 2025 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
-
Licensed under MIT License, see
|
|
5
|
-
https://dario.passariello.ca
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* useObserver run a callback anytime the associated state going to change
|
|
10
|
-
* @return Execution of function after state change.
|
|
11
|
-
*/
|
|
12
|
-
interface _useObserver {
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Generate your useObserver
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* useObserver(Function, "state.myState")
|
|
19
|
-
*
|
|
20
|
-
* @since memorio 1.0.6
|
|
21
|
-
*/
|
|
22
|
-
(func: Function, stateName: string): any
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
declare var useObserver: _useObserver
|
|
28
|
-
type useObserver = _useObserver
|