@plurid/plurid-functions-react 0.0.0-4 → 0.0.0-6

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.
@@ -1,304 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react';
2
-
3
- // #region imports
4
- // #endregion imports
5
- // #region module
6
- const useWindowEvent = (event, callback) => {
7
- useEffect(() => {
8
- if (typeof window === 'undefined') {
9
- return;
10
- }
11
- window.addEventListener(event, callback, { passive: false });
12
- return () => {
13
- if (typeof window === 'undefined') {
14
- return;
15
- }
16
- window.removeEventListener(event, callback);
17
- };
18
- }, [
19
- event,
20
- callback,
21
- ]);
22
- };
23
- const useElementEvent = (event, element, callback) => {
24
- useEffect(() => {
25
- if (element) {
26
- element.addEventListener(event, callback, { passive: false });
27
- }
28
- return () => element.removeEventListener(event, callback);
29
- }, [event, callback]);
30
- };
31
- const useGlobalKeyDown = (callback, element) => {
32
- // if (!element) {
33
- // return useWindowEvent('keydown', callback);
34
- // }
35
- return useElementEvent('keydown', element, callback);
36
- };
37
- const useGlobalWheel = (callback, element) => {
38
- // if (!element) {
39
- // return useWindowEvent('wheel', callback);
40
- // }
41
- return useElementEvent('wheel', element, callback);
42
- };
43
- // #endregion module
44
-
45
- // #region imports
46
- // #endregion imports
47
- // #region module
48
- /**
49
- * Source: https://stackoverflow.com/a/57335271
50
- *
51
- * @param callback Function to be called.
52
- * @param wait Debounce time.
53
- */
54
- function useDebouncedCallback(callback, wait) {
55
- // track args & timeout handle between calls
56
- const argsRef = useRef();
57
- const timeout = useRef();
58
- function cleanup() {
59
- if (timeout.current) {
60
- clearTimeout(timeout.current);
61
- }
62
- }
63
- // make sure our timeout gets cleared if
64
- // our consuming component gets unmounted
65
- useEffect(() => cleanup, []);
66
- return function debouncedCallback(...args) {
67
- // capture latest args
68
- argsRef.current = args;
69
- // clear debounce timer
70
- cleanup();
71
- // start waiting again
72
- timeout.current = setTimeout(() => {
73
- if (argsRef.current) {
74
- callback(...argsRef.current);
75
- }
76
- }, wait);
77
- };
78
- }
79
- // #endregion exports
80
-
81
- // #region imports
82
- // #endregion imports
83
- // #region module
84
- /**
85
- * @param callback
86
- * @param delay
87
- */
88
- const useThrottledCallback = (callback, delay) => {
89
- // track args & timeout handle between calls
90
- const lastRan = useRef(Date.now());
91
- const argsRef = useRef();
92
- const timeout = useRef();
93
- const cleanup = () => {
94
- if (timeout.current) {
95
- clearTimeout(timeout.current);
96
- }
97
- };
98
- useEffect(() => cleanup, []);
99
- return (...args) => {
100
- argsRef.current = args;
101
- timeout.current = setTimeout(() => {
102
- if (Date.now() - lastRan.current >= delay) {
103
- if (argsRef.current) {
104
- callback(...argsRef.current);
105
- }
106
- lastRan.current = Date.now();
107
- }
108
- }, delay - (Date.now() - lastRan.current));
109
- };
110
- };
111
- // #endregion exports
112
-
113
- /**
114
- * Based on
115
- * https://www.jayfreestone.com/writing/react-portals-with-hooks/
116
- *
117
- */
118
- // #endregion imports
119
- // #region module
120
- const createRootElement = (id) => {
121
- const rootContainer = document.createElement('div');
122
- rootContainer.setAttribute('id', id);
123
- return rootContainer;
124
- };
125
- /**
126
- * Appends element as last child of body.
127
- *
128
- * @param rootElement
129
- */
130
- const addRootElement = (rootElement, parentID) => {
131
- const parent = document.getElementById(parentID);
132
- if (parent) {
133
- parent.appendChild(rootElement);
134
- }
135
- };
136
- /**
137
- * Hook to create a React Portal.
138
- * Automatically handles creating and tearing-down the root elements (no SRR
139
- * makes this trivial), so there is no need to ensure the parent target already
140
- * exists.
141
- * @example
142
- * const target = usePortal(id, [id]);
143
- * return createPortal(children, target);
144
- *
145
- * @param id The id of the target container, e.g 'modal' or 'spotlight'
146
- * @returns The DOM node to use as the Portal target.
147
- */
148
- const usePortal = (id, parentID) => {
149
- const rootElemRef = useRef(null);
150
- useEffect(() => {
151
- // Look for existing target dom element to append to
152
- const existingParent = document.querySelector(`#${id}`);
153
- // Parent is either a new root or the existing dom element
154
- const parentElem = existingParent || createRootElement(id);
155
- // If there is no existing DOM element, add a new one.
156
- if (!existingParent) {
157
- addRootElement(parentElem, parentID);
158
- }
159
- // Add the detached element to the parent
160
- if (rootElemRef.current) {
161
- parentElem.appendChild(rootElemRef.current);
162
- }
163
- return () => {
164
- if (rootElemRef.current) {
165
- rootElemRef.current.remove();
166
- }
167
- if (parentElem.childNodes.length === -1) {
168
- parentElem.remove();
169
- }
170
- };
171
- }, []);
172
- /**
173
- * It's important we evaluate this lazily:
174
- * - We need first render to contain the DOM element, so it shouldn't happen
175
- * in useEffect. We would normally put this in the constructor().
176
- * - We can't do 'const rootElemRef = useRef(document.createElement('div))',
177
- * since this will run every single render (that's a lot).
178
- * - We want the ref to consistently point to the same DOM element and only
179
- * ever run once.
180
- * @link https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily
181
- */
182
- const getRootElem = () => {
183
- if (!rootElemRef.current) {
184
- rootElemRef.current = document.createElement('div');
185
- }
186
- return rootElemRef.current;
187
- };
188
- return getRootElem();
189
- };
190
- // #endregion exports
191
-
192
- // #region imports
193
- // #endregion libraries
194
- // #region imports
195
- // #region module
196
- /**
197
- * After a `true` dispatch, it will wait the `intervalTime` and autoset to `false`.
198
- *
199
- * @param intervalTime
200
- * @returns
201
- */
202
- const useFalseAfterTimedTrue = (intervalTime = 2000) => {
203
- // #region references
204
- const mounted = useMounted();
205
- // #endregion references
206
- // #region state
207
- const [disabledAfterActivation, setDisabledAfterActivation,] = useState(false);
208
- // #endregion state
209
- // #region effects
210
- useEffect(() => {
211
- let timeout;
212
- if (disabledAfterActivation) {
213
- timeout = setTimeout(() => {
214
- if (!mounted) {
215
- return;
216
- }
217
- setDisabledAfterActivation(false);
218
- }, intervalTime);
219
- }
220
- return () => {
221
- if (timeout) {
222
- clearTimeout(timeout);
223
- timeout = undefined;
224
- }
225
- };
226
- }, [
227
- disabledAfterActivation,
228
- ]);
229
- // #endregion effects
230
- // #region return
231
- return [
232
- disabledAfterActivation,
233
- setDisabledAfterActivation,
234
- ];
235
- // #endregion return
236
- };
237
- /**
238
- * Keeps reference of the current mounted component.
239
- *
240
- * @returns
241
- */
242
- const useMounted = () => {
243
- // #region references
244
- const isMounted = useRef(false);
245
- // #endregion references
246
- // #region effects
247
- useEffect(() => {
248
- isMounted.current = true;
249
- return () => {
250
- isMounted.current = false;
251
- };
252
- }, []);
253
- // #endregion effects
254
- // #region return
255
- return isMounted.current;
256
- // #endregion return
257
- };
258
- // #endregion exports
259
-
260
- // #region module
261
- const createMarkup = (text) => {
262
- return {
263
- __html: text,
264
- };
265
- };
266
- // #endregion exports
267
-
268
- // #region module
269
- /**
270
- * Merges multiple references into one `ref` attribute.
271
- *
272
- * ``` jsx
273
- * <SomeComponent
274
- * ref={merge(ref1, ref2)}
275
- * />
276
- * ```
277
- *
278
- * Source: https://www.davedrinks.coffee/how-do-i-use-two-react-refs/
279
- *
280
- * @param refs
281
- */
282
- const mergeReferences = (...refs) => {
283
- const filteredRefs = refs.filter(Boolean);
284
- if (!filteredRefs.length) {
285
- return null;
286
- }
287
- if (filteredRefs.length === 1) {
288
- return filteredRefs[0];
289
- }
290
- return (inst) => {
291
- for (const ref of filteredRefs) {
292
- if (typeof ref === 'function') {
293
- ref(inst);
294
- }
295
- else if (ref) {
296
- ref.current = inst;
297
- }
298
- }
299
- };
300
- };
301
- // #endregion exports
302
-
303
- export { createMarkup, mergeReferences, useDebouncedCallback, useElementEvent, useFalseAfterTimedTrue, useGlobalKeyDown, useGlobalWheel, useMounted, usePortal, useThrottledCallback, useWindowEvent };
304
- //# sourceMappingURL=index.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.es.js","sources":["../source/hooks/event/index.ts","../source/hooks/debounce/index.ts","../source/hooks/throttle/index.ts","../source/hooks/portal/index.tsx","../source/hooks/general/index.ts","../source/utilities/createMarkup/index.ts","../source/utilities/mergeReferences/index.ts"],"sourcesContent":["// #region imports\nimport {\n useEffect,\n} from 'react';\n// #endregion imports\n\n\n\n// #region module\nexport const useWindowEvent = (\n event: any,\n callback: any,\n) => {\n useEffect(() => {\n if (typeof window === 'undefined') {\n return;\n }\n window.addEventListener(event, callback, { passive: false });\n\n return () => {\n if (typeof window === 'undefined') {\n return;\n }\n window.removeEventListener(event, callback);\n }\n }, [\n event,\n callback,\n ]);\n};\n\n\nexport const useElementEvent = (\n event: any,\n element: any,\n callback: any,\n) => {\n useEffect(() => {\n if (element) {\n element.addEventListener(event, callback, { passive: false });\n }\n return () => element.removeEventListener(event, callback);\n }, [event, callback]);\n}\n\nexport const useGlobalKeyDown = (\n callback: any,\n element?: any,\n) => {\n // if (!element) {\n // return useWindowEvent('keydown', callback);\n // }\n\n return useElementEvent(\n 'keydown',\n element,\n callback,\n );\n}\n\nexport const useGlobalWheel = (\n callback: any,\n element?: any,\n) => {\n // if (!element) {\n // return useWindowEvent('wheel', callback);\n // }\n\n return useElementEvent(\n 'wheel',\n element,\n callback,\n );\n}\n// #endregion module\n","// #region imports\nimport {\n useRef,\n useEffect,\n} from 'react';\n// #endregion imports\n\n\n\n// #region module\n/**\n * Source: https://stackoverflow.com/a/57335271\n *\n * @param callback Function to be called.\n * @param wait Debounce time.\n */\nfunction useDebouncedCallback<A extends any[]>(\n callback: (...args: A) => void,\n wait: number,\n) {\n // track args & timeout handle between calls\n const argsRef = useRef<A>();\n const timeout = useRef<ReturnType<typeof setTimeout>>();\n\n function cleanup() {\n if(timeout.current) {\n clearTimeout(timeout.current);\n }\n }\n\n // make sure our timeout gets cleared if\n // our consuming component gets unmounted\n useEffect(() => cleanup, []);\n\n return function debouncedCallback(\n ...args: A\n ) {\n // capture latest args\n argsRef.current = args;\n\n // clear debounce timer\n cleanup();\n\n // start waiting again\n timeout.current = setTimeout(() => {\n if(argsRef.current) {\n callback(...argsRef.current);\n }\n }, wait);\n };\n}\n// #endregion module\n\n\n\n// #region exports\nexport default useDebouncedCallback;\n// #endregion exports\n","// #region imports\nimport {\n useEffect,\n useRef,\n} from 'react';\n// #endregion imports\n\n\n\n// #region module\n/**\n * @param callback\n * @param delay\n */\nconst useThrottledCallback = <A extends any[]>(\n callback: (...args: A) => void,\n delay: number,\n) => {\n // track args & timeout handle between calls\n const lastRan = useRef(Date.now());\n const argsRef = useRef<A>();\n const timeout = useRef<ReturnType<typeof setTimeout>>();\n\n const cleanup = () => {\n if(timeout.current) {\n clearTimeout(timeout.current);\n }\n }\n\n useEffect(() => cleanup, []);\n\n return (\n ...args: A\n ) => {\n argsRef.current = args;\n\n timeout.current = setTimeout(\n () => {\n if (Date.now() - lastRan.current >= delay) {\n if(argsRef.current) {\n callback(...argsRef.current);\n }\n lastRan.current = Date.now();\n }\n },\n delay - (Date.now() - lastRan.current)\n );\n };\n}\n// #endregion module\n\n\n\n// #region exports\nexport default useThrottledCallback;\n// #endregion exports\n","/**\n * Based on\n * https://www.jayfreestone.com/writing/react-portals-with-hooks/\n *\n */\n\n\n// #region imports\nimport {\n useRef,\n useEffect,\n} from 'react';\n// #endregion imports\n\n\n\n// #region module\nconst createRootElement = (\n id: string,\n): Element => {\n const rootContainer = document.createElement('div');\n rootContainer.setAttribute('id', id);\n return rootContainer;\n}\n\n\n/**\n * Appends element as last child of body.\n *\n * @param rootElement\n */\nconst addRootElement = (\n rootElement: Element,\n parentID: string,\n) => {\n const parent = document.getElementById(parentID);\n\n if (parent) {\n parent.appendChild(rootElement);\n }\n}\n\n\n/**\n * Hook to create a React Portal.\n * Automatically handles creating and tearing-down the root elements (no SRR\n * makes this trivial), so there is no need to ensure the parent target already\n * exists.\n * @example\n * const target = usePortal(id, [id]);\n * return createPortal(children, target);\n *\n * @param id The id of the target container, e.g 'modal' or 'spotlight'\n * @returns The DOM node to use as the Portal target.\n */\nconst usePortal = (\n id: string,\n parentID: string,\n): any => {\n const rootElemRef = useRef<Element | null>(null);\n\n useEffect(() => {\n // Look for existing target dom element to append to\n const existingParent = document.querySelector(`#${id}`);\n // Parent is either a new root or the existing dom element\n const parentElem = existingParent || createRootElement(id);\n\n // If there is no existing DOM element, add a new one.\n if (!existingParent) {\n addRootElement(parentElem, parentID);\n }\n\n // Add the detached element to the parent\n if (rootElemRef.current) {\n parentElem.appendChild(rootElemRef.current);\n }\n\n return () => {\n if (rootElemRef.current) {\n rootElemRef.current.remove();\n }\n\n if (parentElem.childNodes.length === -1) {\n parentElem.remove();\n }\n };\n }, []);\n\n /**\n * It's important we evaluate this lazily:\n * - We need first render to contain the DOM element, so it shouldn't happen\n * in useEffect. We would normally put this in the constructor().\n * - We can't do 'const rootElemRef = useRef(document.createElement('div))',\n * since this will run every single render (that's a lot).\n * - We want the ref to consistently point to the same DOM element and only\n * ever run once.\n * @link https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily\n */\n const getRootElem = () => {\n if (!rootElemRef.current) {\n rootElemRef.current = document.createElement('div');\n }\n return rootElemRef.current;\n }\n\n return getRootElem();\n}\n// #endregion module\n\n\n\n// #region exports\nexport default usePortal;\n// #endregion exports\n","// #region imports\n // #region libraries\n import React, {\n useRef,\n useState,\n useEffect,\n } from 'react';\n // #endregion libraries\n// #region imports\n\n\n\n// #region module\n/**\n * After a `true` dispatch, it will wait the `intervalTime` and autoset to `false`.\n *\n * @param intervalTime\n * @returns\n */\nconst useFalseAfterTimedTrue = (\n intervalTime = 2_000, // ms\n): [boolean, React.Dispatch<React.SetStateAction<boolean>>] => {\n // #region references\n const mounted = useMounted();\n // #endregion references\n\n // #region state\n const [\n disabledAfterActivation,\n setDisabledAfterActivation,\n ] = useState(false);\n // #endregion state\n\n // #region effects\n useEffect(() => {\n let timeout: NodeJS.Timeout | undefined;\n\n if (disabledAfterActivation) {\n timeout = setTimeout(() => {\n if (!mounted) {\n return;\n }\n\n setDisabledAfterActivation(false);\n }, intervalTime);\n }\n\n return () => {\n if (timeout) {\n clearTimeout(timeout);\n timeout = undefined;\n }\n }\n }, [\n disabledAfterActivation,\n ]);\n // #endregion effects\n\n // #region return\n return [\n disabledAfterActivation,\n setDisabledAfterActivation,\n ];\n // #endregion return\n}\n\n\n/**\n * Keeps reference of the current mounted component.\n *\n * @returns\n */\nconst useMounted = () => {\n // #region references\n const isMounted = useRef(false);\n // #endregion references\n\n // #region effects\n useEffect(() => {\n isMounted.current = true;\n\n return () => {\n isMounted.current = false;\n }\n }, []);\n // #endregion effects\n\n // #region return\n return isMounted.current;\n // #endregion return\n}\n// #endregion module\n\n\n\n// #region exports\nexport {\n useFalseAfterTimedTrue,\n useMounted,\n};\n// #endregion exports\n","// #region module\nconst createMarkup = (\n text: string,\n) => {\n return {\n __html: text,\n };\n}\n// #endregion module\n\n\n\n// #region exports\nexport default createMarkup;\n// #endregion exports\n","// #region module\n/**\n * Merges multiple references into one `ref` attribute.\n *\n * ``` jsx\n * <SomeComponent\n * ref={merge(ref1, ref2)}\n * />\n * ```\n *\n * Source: https://www.davedrinks.coffee/how-do-i-use-two-react-refs/\n *\n * @param refs\n */\nconst mergeReferences = (\n ...refs: any[]\n) => {\n const filteredRefs = refs.filter(Boolean);\n\n if (!filteredRefs.length) {\n return null;\n }\n\n if (filteredRefs.length === 1) {\n return filteredRefs[0];\n }\n\n return (inst: any) => {\n for (const ref of filteredRefs) {\n if (typeof ref === 'function') {\n ref(inst);\n } else if (ref) {\n ref.current = inst;\n }\n }\n };\n};\n// #endregion module\n\n\n\n// #region exports\nexport default mergeReferences;\n// #endregion exports\n"],"names":[],"mappings":";;AAAA;AAIA;AAIA;MACa,cAAc,GAAG,CAC1B,KAAU,EACV,QAAa;IAEb,SAAS,CAAC;QACN,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YAC/B,OAAO;SACV;QACD,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAE7D,OAAO;YACH,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;gBAC/B,OAAO;aACV;YACD,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;SAC/C,CAAA;KACJ,EAAE;QACC,KAAK;QACL,QAA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,EAAE;QAC3B,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;KAC1B;IAED,OAAO,CAAC,IAAS;QACb,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE;YAC5B,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;gBAC3B,GAAG,CAAC,IAAI,CAAC,CAAC;aACb;iBAAM,IAAI,GAAG,EAAE;gBACZ,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;aACtB;SACJ;KACJ,CAAC;AACN,EAAE;AAOF;;;;"}
@@ -1,4 +0,0 @@
1
- declare const createMarkup: (text: string) => {
2
- __html: string;
3
- };
4
- export default createMarkup;
@@ -1,3 +0,0 @@
1
- import createMarkup from './createMarkup';
2
- import mergeReferences from './mergeReferences';
3
- export { createMarkup, mergeReferences, };
@@ -1,15 +0,0 @@
1
- /**
2
- * Merges multiple references into one `ref` attribute.
3
- *
4
- * ``` jsx
5
- * <SomeComponent
6
- * ref={merge(ref1, ref2)}
7
- * />
8
- * ```
9
- *
10
- * Source: https://www.davedrinks.coffee/how-do-i-use-two-react-refs/
11
- *
12
- * @param refs
13
- */
14
- declare const mergeReferences: (...refs: any[]) => any;
15
- export default mergeReferences;