openapi-explorer 2.1.641 → 2.1.643

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.
@@ -0,0 +1,32 @@
1
+ /**
2
+ * reactEventListener - takes the hard work out of adding and removing listeners in React
3
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener}
4
+ *
5
+ * @param {object} React - The React object that contains the method { useEffect }.
6
+ * @param {string} eventName - A case-sensitive string or strings representing the event type to listen for
7
+ * @param {function} callbackFunction - callback function - The object that receives a notification (an object that implements the Event interface) when an event of the specified type occurs
8
+ */
9
+ export function reactEventListener({
10
+ useEffect
11
+ }, eventName, functionCallback) {
12
+ const targetElement = window;
13
+ useEffect(() => {
14
+ targetElement.addEventListener(eventName, functionCallback); // This is an effect that requires cleanup when the component using this
15
+ // custom hook unmounts:
16
+ // https://reactjs.org/docs/hooks-effect.html#effects-with-cleanup
17
+
18
+ return () => {
19
+ // Check if the event functionCallback we were given was a debounced or throttled
20
+ // event functionCallback, if it is, cancel any future events
21
+ // https://github.com/niksy/throttle-debounce#cancelling
22
+ if (functionCallback !== null && functionCallback !== void 0 && functionCallback.cancel) {
23
+ functionCallback.cancel();
24
+ } // Remove the event functionCallbacks
25
+
26
+
27
+ if (targetElement !== null && targetElement !== void 0 && targetElement.removeEventListener) {
28
+ targetElement.removeEventListener(eventName, functionCallback);
29
+ }
30
+ };
31
+ }, [eventName, functionCallback, targetElement]);
32
+ }
@@ -65,8 +65,8 @@ export function pathIsInSearch(searchVal, path) {
65
65
  return true;
66
66
  }
67
67
 
68
- const stringToSearch = `${path.method} ${path.path} ${path.summary || path.description || ''} ${path.operationId || ''}`.toLowerCase();
69
- return stringToSearch.includes(searchVal.toLowerCase());
68
+ const stringToSearch = `${path.method} ${path.path} ${path.summary || ''} ${path.description || ''} ${path.operationId || ''}`;
69
+ return stringToSearch.includes(searchVal) || stringToSearch.toLowerCase().includes(searchVal) || stringToSearch.normalize('NFD').replace(/[\u0300-\u036f]/g, '').includes(searchVal) || stringToSearch.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').includes(searchVal);
70
70
  }
71
71
  export function schemaKeys(schemaProps, result = new Set()) {
72
72
  if (!schemaProps) {
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.reactEventListener = reactEventListener;
5
+
6
+ /**
7
+ * reactEventListener - takes the hard work out of adding and removing listeners in React
8
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener}
9
+ *
10
+ * @param {object} React - The React object that contains the method { useEffect }.
11
+ * @param {string} eventName - A case-sensitive string or strings representing the event type to listen for
12
+ * @param {function} callbackFunction - callback function - The object that receives a notification (an object that implements the Event interface) when an event of the specified type occurs
13
+ */
14
+ function reactEventListener({
15
+ useEffect
16
+ }, eventName, functionCallback) {
17
+ const targetElement = window;
18
+ useEffect(() => {
19
+ targetElement.addEventListener(eventName, functionCallback); // This is an effect that requires cleanup when the component using this
20
+ // custom hook unmounts:
21
+ // https://reactjs.org/docs/hooks-effect.html#effects-with-cleanup
22
+
23
+ return () => {
24
+ // Check if the event functionCallback we were given was a debounced or throttled
25
+ // event functionCallback, if it is, cancel any future events
26
+ // https://github.com/niksy/throttle-debounce#cancelling
27
+ if (functionCallback !== null && functionCallback !== void 0 && functionCallback.cancel) {
28
+ functionCallback.cancel();
29
+ } // Remove the event functionCallbacks
30
+
31
+
32
+ if (targetElement !== null && targetElement !== void 0 && targetElement.removeEventListener) {
33
+ targetElement.removeEventListener(eventName, functionCallback);
34
+ }
35
+ };
36
+ }, [eventName, functionCallback, targetElement]);
37
+ }
@@ -87,8 +87,8 @@ function pathIsInSearch(searchVal, path) {
87
87
  return true;
88
88
  }
89
89
 
90
- const stringToSearch = `${path.method} ${path.path} ${path.summary || path.description || ''} ${path.operationId || ''}`.toLowerCase();
91
- return stringToSearch.includes(searchVal.toLowerCase());
90
+ const stringToSearch = `${path.method} ${path.path} ${path.summary || ''} ${path.description || ''} ${path.operationId || ''}`;
91
+ return stringToSearch.includes(searchVal) || stringToSearch.toLowerCase().includes(searchVal) || stringToSearch.normalize('NFD').replace(/[\u0300-\u036f]/g, '').includes(searchVal) || stringToSearch.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').includes(searchVal);
92
92
  }
93
93
 
94
94
  function schemaKeys(schemaProps, result = new Set()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "2.1.641",
3
+ "version": "2.1.643",
4
4
  "description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
5
5
  "author": "Authress Developers <developers@authress.io>",
6
6
  "type": "module",