@ouroboros/browser 0.5.2 → 0.5.3

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/README.md CHANGED
@@ -1,5 +1,4 @@
1
1
  # @ouroboros/browser
2
-
3
2
  [![npm version](https://img.shields.io/npm/v/@ouroboros/browser.svg)](https://www.npmjs.com/package/@ouroboros/browser) ![MIT License](https://img.shields.io/npm/l/@ouroboros/browser.svg)
4
3
 
5
4
  A library of classes to manage functionality in browsers.
@@ -24,7 +23,7 @@ or
24
23
  import { clipboard } from '@ouroboros/browser';
25
24
  ```
26
25
 
27
- copy()
26
+ `clipboard.copy()`
28
27
 
29
28
  ## cookies
30
29
 
@@ -40,7 +39,23 @@ or
40
39
  import { cookies } from '@ouroboros/browser';
41
40
  ```
42
41
 
43
- get(), remove(), set()
42
+ `get()`, `remove()`, `set()`
43
+
44
+ ## devices
45
+
46
+ Import Devices into your code
47
+
48
+ ```javascript
49
+ import devices, { hasPointer } from '@ouroboros/browser/devices';
50
+ ```
51
+
52
+ or
53
+
54
+ ```javascript
55
+ import { devices } from '@ouroboros/browser';
56
+ ```
57
+
58
+ `devices.hasPointer()`
44
59
 
45
60
  ## hash
46
61
 
@@ -56,7 +71,7 @@ or
56
71
  import { hash } from '@ouroboros/browser';
57
72
  ```
58
73
 
59
- get(), set(), subscribe(), unsubscribe()
74
+ `hash.get()`, `hash.set()`, `hash.subscribe()`, `hash.unsubscribe()`
60
75
 
61
76
  ## network
62
77
 
@@ -72,7 +87,7 @@ or
72
87
  import { network } from '@ouroboros/browser';
73
88
  ```
74
89
 
75
- default (Subscribe)
90
+ default (`Subscribe`)
76
91
 
77
92
  ## pageVisibility
78
93
 
@@ -88,7 +103,7 @@ or
88
103
  import { pageVisibility } from '@ouroboros/browser';
89
104
  ```
90
105
 
91
- default (Subscribe)
106
+ default (`Subscribe`)
92
107
 
93
108
  ## safeLocalStorage
94
109
 
@@ -104,7 +119,7 @@ or
104
119
  import { safeLocalStorage } from '@ouroboros/browser';
105
120
  ```
106
121
 
107
- bool(), json(), string()
122
+ `safeLocalStorage.bool()`, `safeLocalStorage.json()`, `safeLocalStorage.string()`
108
123
 
109
124
  ## size
110
125
 
@@ -120,4 +135,4 @@ or
120
135
  import { size } from '@ouroboros/browser';
121
136
  ```
122
137
 
123
- size (Subscribe), compare(), greaterThan(), lessThan()
138
+ default (`Subscribe`), `size.compare()`, `size.greaterThan()`, `size.lessThan()`
package/devices.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Device
3
+ *
4
+ * Functions for getting device information
5
+ *
6
+ * @author Chris Nasr <chris@ouroboroscoding.com>
7
+ * @copyright Ouroboros Coding Inc.
8
+ * @created 2025-04-16
9
+ */
10
+ /**
11
+ * Has Pointer
12
+ *
13
+ * Returns true only if the device has some sort of pointer device like a mouse.
14
+ *
15
+ * @name hasPointer
16
+ * @access public
17
+ * @returns bool
18
+ */
19
+ export declare function hasPointer(): boolean;
20
+ declare const devices: {
21
+ hasPointer: typeof hasPointer;
22
+ };
23
+ export default devices;
package/devices.js ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Device
3
+ *
4
+ * Functions for getting device information
5
+ *
6
+ * @author Chris Nasr <chris@ouroboroscoding.com>
7
+ * @copyright Ouroboros Coding Inc.
8
+ * @created 2025-04-16
9
+ */
10
+ /**
11
+ * Has Pointer
12
+ *
13
+ * Returns true only if the device has some sort of pointer device like a mouse.
14
+ *
15
+ * @name hasPointer
16
+ * @access public
17
+ * @returns bool
18
+ */
19
+ export function hasPointer() {
20
+ return window.matchMedia("(any-hover: hover)").matches;
21
+ }
22
+ // Default export
23
+ const devices = { hasPointer };
24
+ export default devices;
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { default as clipboard } from './clipboard';
2
2
  export { default as cookies } from './cookies';
3
+ export { default as devices } from './devices';
3
4
  export { default as hash } from './hash';
4
5
  export { default as network } from './network';
5
6
  export { default as pageVisibility } from './pageVisibility';
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { default as clipboard } from './clipboard';
2
2
  export { default as cookies } from './cookies';
3
+ export { default as devices } from './devices';
3
4
  export { default as hash } from './hash';
4
5
  export { default as network } from './network';
5
6
  export { default as pageVisibility } from './pageVisibility';
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouroboros/browser",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Package to handle common browser functionality.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@ouroboros/clone": "^1.1.0",
40
- "@ouroboros/subscribe": "^1.3.1",
41
- "@ouroboros/tools": "^0.6.1"
40
+ "@ouroboros/subscribe": "^1.3.2",
41
+ "@ouroboros/tools": "^0.7.1"
42
42
  }
43
43
  }
package/src/devices.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Device
3
+ *
4
+ * Functions for getting device information
5
+ *
6
+ * @author Chris Nasr <chris@ouroboroscoding.com>
7
+ * @copyright Ouroboros Coding Inc.
8
+ * @created 2025-04-16
9
+ */
10
+
11
+ /**
12
+ * Has Pointer
13
+ *
14
+ * Returns true only if the device has some sort of pointer device like a mouse.
15
+ *
16
+ * @name hasPointer
17
+ * @access public
18
+ * @returns bool
19
+ */
20
+ export function hasPointer(): boolean {
21
+ return window.matchMedia("(any-hover: hover)").matches
22
+ }
23
+
24
+ // Default export
25
+ const devices = { hasPointer }
26
+ export default devices;
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { default as clipboard } from './clipboard';
2
2
  export { default as cookies } from './cookies';
3
+ export { default as devices } from './devices';
3
4
  export { default as hash } from './hash';
4
5
  export { default as network } from './network';
5
6
  export { default as pageVisibility } from './pageVisibility';