solid-tiny-utils 0.2.0 → 0.4.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.
Files changed (58) hide show
  1. package/README.md +0 -68
  2. package/dist/chunk-BGLY6NJK.js +111 -0
  3. package/dist/{chunk-WLQ64SAO.js → chunk-CSAKXWF3.js} +5 -1
  4. package/dist/{chunk-YJB637I2.js → chunk-HPKVQC7S.js} +4 -3
  5. package/dist/chunk-II6INKPZ.js +8 -0
  6. package/dist/chunk-KFWZFQMB.js +8 -0
  7. package/dist/chunk-KLRTXD4R.js +53 -0
  8. package/dist/chunk-OUAI75QC.js +55 -0
  9. package/dist/{chunk-RRYFZNKE.js → chunk-PBALVUKK.js} +1 -1
  10. package/dist/chunk-PNR5G432.js +85 -0
  11. package/dist/chunk-YXRZ2KMJ.js +0 -0
  12. package/dist/dom/css.js +5 -3
  13. package/dist/dom/index.js +5 -3
  14. package/dist/event/create-click-outside.js +8 -5
  15. package/dist/event/create-event-listener.d.ts +23 -0
  16. package/dist/event/create-event-listener.js +16 -0
  17. package/dist/event/index.d.ts +3 -0
  18. package/dist/event/index.js +17 -7
  19. package/dist/event/make-event-listener.d.ts +49 -0
  20. package/dist/event/make-event-listener.js +15 -0
  21. package/dist/fn/create-debounce.js +6 -5
  22. package/dist/fn/create-loop-exec.js +6 -5
  23. package/dist/fn/create-throttle.d.ts +6 -0
  24. package/dist/fn/create-throttle.js +14 -0
  25. package/dist/fn/index.d.ts +1 -0
  26. package/dist/fn/index.js +10 -11
  27. package/dist/index.d.ts +9 -1
  28. package/dist/index.js +50 -13
  29. package/dist/jsx/attrs.d.ts +22 -0
  30. package/dist/jsx/attrs.js +6 -0
  31. package/dist/jsx/index.d.ts +1 -0
  32. package/dist/jsx/index.js +7 -0
  33. package/dist/lodash/array.d.ts +5 -1
  34. package/dist/lodash/array.js +3 -1
  35. package/dist/lodash/async.d.ts +6 -0
  36. package/dist/lodash/async.js +6 -0
  37. package/dist/lodash/index.d.ts +3 -1
  38. package/dist/lodash/index.js +27 -3
  39. package/dist/lodash/random.js +2 -2
  40. package/dist/lodash/str.d.ts +75 -0
  41. package/dist/lodash/str.js +20 -0
  42. package/dist/reactive/access.js +5 -3
  43. package/dist/reactive/create-debounce-watch.d.ts +12 -0
  44. package/dist/reactive/create-debounce-watch.js +14 -0
  45. package/dist/reactive/index.d.ts +1 -0
  46. package/dist/reactive/index.js +9 -4
  47. package/dist/types/fn.d.ts +2 -1
  48. package/dist/types/fn.js +1 -0
  49. package/dist/types/index.d.ts +1 -0
  50. package/dist/types/index.js +2 -1
  51. package/package.json +1 -2
  52. package/dist/chunk-2BGAGVTR.js +0 -7
  53. package/dist/chunk-H6VUVMSF.js +0 -23
  54. package/dist/chunk-WY5G2PJM.js +0 -60
  55. /package/dist/{chunk-2BUPSB7O.js → chunk-AZAXMGEB.js} +0 -0
  56. /package/dist/{chunk-33ZRZ4S2.js → chunk-B6TZK2S5.js} +0 -0
  57. /package/dist/{chunk-M53KPXWR.js → chunk-OECLQ3OT.js} +0 -0
  58. /package/dist/{chunk-ZZNAXGNU.js → chunk-SK6Y2YH6.js} +0 -0
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  createLoopExec
3
- } from "../chunk-WY5G2PJM.js";
4
- import "../chunk-ZZNAXGNU.js";
3
+ } from "../chunk-BGLY6NJK.js";
5
4
  import "../chunk-M5A3VVYI.js";
6
5
  import "../chunk-4L6FK7MF.js";
7
- import "../chunk-33ZRZ4S2.js";
8
- import "../chunk-RRYFZNKE.js";
9
- import "../chunk-WLQ64SAO.js";
6
+ import "../chunk-OECLQ3OT.js";
7
+ import "../chunk-PBALVUKK.js";
8
+ import "../chunk-PNR5G432.js";
9
+ import "../chunk-CSAKXWF3.js";
10
10
  import "../chunk-ZGYORUAX.js";
11
+ import "../chunk-KFWZFQMB.js";
11
12
  export {
12
13
  createLoopExec
13
14
  };
@@ -0,0 +1,6 @@
1
+ import { MaybeAccessor } from '../types/maybe.js';
2
+ import 'solid-js';
3
+
4
+ declare function createThrottle<Args extends unknown[]>(callback: (...args: Args) => void, delay: MaybeAccessor<number>): (...args: Args) => void;
5
+
6
+ export { createThrottle };
@@ -0,0 +1,14 @@
1
+ import {
2
+ createThrottle
3
+ } from "../chunk-BGLY6NJK.js";
4
+ import "../chunk-M5A3VVYI.js";
5
+ import "../chunk-4L6FK7MF.js";
6
+ import "../chunk-OECLQ3OT.js";
7
+ import "../chunk-PBALVUKK.js";
8
+ import "../chunk-PNR5G432.js";
9
+ import "../chunk-CSAKXWF3.js";
10
+ import "../chunk-ZGYORUAX.js";
11
+ import "../chunk-KFWZFQMB.js";
12
+ export {
13
+ createThrottle
14
+ };
@@ -1,5 +1,6 @@
1
1
  export { createDebounce } from './create-debounce.js';
2
2
  export { createLoopExec } from './create-loop-exec.js';
3
+ export { createThrottle } from './create-throttle.js';
3
4
  import '../types/maybe.js';
4
5
  import 'solid-js';
5
6
 
package/dist/fn/index.js CHANGED
@@ -1,21 +1,20 @@
1
1
  import {
2
+ createDebounce,
3
+ createLoopExec,
4
+ createThrottle,
2
5
  noop
3
- } from "../chunk-2BGAGVTR.js";
4
- import {
5
- createDebounce
6
- } from "../chunk-H6VUVMSF.js";
7
- import {
8
- createLoopExec
9
- } from "../chunk-WY5G2PJM.js";
10
- import "../chunk-ZZNAXGNU.js";
6
+ } from "../chunk-BGLY6NJK.js";
11
7
  import "../chunk-M5A3VVYI.js";
12
8
  import "../chunk-4L6FK7MF.js";
13
- import "../chunk-33ZRZ4S2.js";
14
- import "../chunk-RRYFZNKE.js";
15
- import "../chunk-WLQ64SAO.js";
9
+ import "../chunk-OECLQ3OT.js";
10
+ import "../chunk-PBALVUKK.js";
11
+ import "../chunk-PNR5G432.js";
12
+ import "../chunk-CSAKXWF3.js";
16
13
  import "../chunk-ZGYORUAX.js";
14
+ import "../chunk-KFWZFQMB.js";
17
15
  export {
18
16
  createDebounce,
19
17
  createLoopExec,
18
+ createThrottle,
20
19
  noop
21
20
  };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,20 @@
1
1
  export { mountStyle } from './dom/css.js';
2
2
  export { createClickOutside } from './event/create-click-outside.js';
3
+ export { createEventListener } from './event/create-event-listener.js';
4
+ export { DocumentEventName, GeneralEventListener, WindowEventName, makeEventListener } from './event/make-event-listener.js';
3
5
  export { noop } from './fn/index.js';
4
- export { iterate, list, range } from './lodash/array.js';
6
+ export { dataIf } from './jsx/attrs.js';
7
+ export { clearArray, iterate, list, range } from './lodash/array.js';
8
+ export { sleep } from './lodash/async.js';
5
9
  export { isArray, isClient, isDate, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol } from './lodash/is.js';
6
10
  export { draw, random, shuffle, uid } from './lodash/random.js';
11
+ export { camel, capitalize, dash, pascal, snake, template, title, trim } from './lodash/str.js';
7
12
  export { access } from './reactive/access.js';
13
+ export { createDebouncedWatch } from './reactive/create-debounce-watch.js';
8
14
  export { createWatch } from './reactive/create-watch.js';
15
+ export { AnyFn, Fn } from './types/fn.js';
9
16
  export { MaybeAccessor, MaybeArray, MaybePromise } from './types/maybe.js';
10
17
  export { createDebounce } from './fn/create-debounce.js';
11
18
  export { createLoopExec } from './fn/create-loop-exec.js';
19
+ export { createThrottle } from './fn/create-throttle.js';
12
20
  import 'solid-js';
package/dist/index.js CHANGED
@@ -1,41 +1,60 @@
1
- import "./chunk-2BUPSB7O.js";
1
+ import "./chunk-SK6Y2YH6.js";
2
2
  import "./chunk-EZML2DEC.js";
3
+ import "./chunk-AZAXMGEB.js";
4
+ import "./chunk-YXRZ2KMJ.js";
5
+ import {
6
+ dataIf
7
+ } from "./chunk-II6INKPZ.js";
3
8
  import "./chunk-FFBJP5FE.js";
4
9
  import {
5
10
  mountStyle
6
11
  } from "./chunk-KVG6TCSE.js";
7
- import "./chunk-M53KPXWR.js";
12
+ import "./chunk-B6TZK2S5.js";
8
13
  import {
9
14
  createClickOutside
10
- } from "./chunk-YJB637I2.js";
15
+ } from "./chunk-HPKVQC7S.js";
11
16
  import {
12
- noop
13
- } from "./chunk-2BGAGVTR.js";
17
+ createEventListener
18
+ } from "./chunk-KLRTXD4R.js";
14
19
  import {
15
- createDebounce
16
- } from "./chunk-H6VUVMSF.js";
20
+ makeEventListener
21
+ } from "./chunk-OUAI75QC.js";
17
22
  import {
18
- createLoopExec
19
- } from "./chunk-WY5G2PJM.js";
20
- import "./chunk-ZZNAXGNU.js";
23
+ createDebounce,
24
+ createDebouncedWatch,
25
+ createLoopExec,
26
+ createThrottle,
27
+ noop
28
+ } from "./chunk-BGLY6NJK.js";
21
29
  import {
22
30
  access
23
31
  } from "./chunk-M5A3VVYI.js";
24
32
  import {
25
33
  createWatch
26
34
  } from "./chunk-4L6FK7MF.js";
27
- import "./chunk-33ZRZ4S2.js";
35
+ import "./chunk-OECLQ3OT.js";
28
36
  import {
29
37
  draw,
30
38
  random,
31
39
  shuffle,
32
40
  uid
33
- } from "./chunk-RRYFZNKE.js";
41
+ } from "./chunk-PBALVUKK.js";
42
+ import {
43
+ camel,
44
+ capitalize,
45
+ dash,
46
+ pascal,
47
+ snake,
48
+ template,
49
+ title,
50
+ trim
51
+ } from "./chunk-PNR5G432.js";
34
52
  import {
53
+ clearArray,
35
54
  iterate,
36
55
  list,
37
56
  range
38
- } from "./chunk-WLQ64SAO.js";
57
+ } from "./chunk-CSAKXWF3.js";
39
58
  import {
40
59
  isArray,
41
60
  isClient,
@@ -51,12 +70,23 @@ import {
51
70
  isString,
52
71
  isSymbol
53
72
  } from "./chunk-ZGYORUAX.js";
73
+ import {
74
+ sleep
75
+ } from "./chunk-KFWZFQMB.js";
54
76
  export {
55
77
  access,
78
+ camel,
79
+ capitalize,
80
+ clearArray,
56
81
  createClickOutside,
57
82
  createDebounce,
83
+ createDebouncedWatch,
84
+ createEventListener,
58
85
  createLoopExec,
86
+ createThrottle,
59
87
  createWatch,
88
+ dash,
89
+ dataIf,
60
90
  draw,
61
91
  isArray,
62
92
  isClient,
@@ -73,10 +103,17 @@ export {
73
103
  isSymbol,
74
104
  iterate,
75
105
  list,
106
+ makeEventListener,
76
107
  mountStyle,
77
108
  noop,
109
+ pascal,
78
110
  random,
79
111
  range,
80
112
  shuffle,
113
+ sleep,
114
+ snake,
115
+ template,
116
+ title,
117
+ trim,
81
118
  uid
82
119
  };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * return '' if show is true
3
+ *
4
+ * suitable when you want to conditionally apply data attributes
5
+ *
6
+ * @example
7
+ *
8
+ * ```tsx
9
+ *
10
+ * function MyComponent(props:{size:'small'|'medium'|'large'}) {
11
+ * return <div
12
+ * data-size-small={dataIf(props.size === 'small')}
13
+ * data-size-medium={dataIf(props.size === 'medium')}
14
+ * data-size-large={dataIf(props.size === 'large')}
15
+ * >Hello</div>;
16
+ * }
17
+ *
18
+ * ```
19
+ */
20
+ declare function dataIf(show: boolean): "" | undefined;
21
+
22
+ export { dataIf };
@@ -0,0 +1,6 @@
1
+ import {
2
+ dataIf
3
+ } from "../chunk-II6INKPZ.js";
4
+ export {
5
+ dataIf
6
+ };
@@ -0,0 +1 @@
1
+ export { dataIf } from './attrs.js';
@@ -0,0 +1,7 @@
1
+ import "../chunk-YXRZ2KMJ.js";
2
+ import {
3
+ dataIf
4
+ } from "../chunk-II6INKPZ.js";
5
+ export {
6
+ dataIf
7
+ };
@@ -38,5 +38,9 @@ declare function range<T = number>(startOrLength: number, end?: number, valueOrM
38
38
  * list(0, 6, i => i, 2) // 0, 2, 4, 6
39
39
  */
40
40
  declare const list: <T = number>(startOrLength: number, end?: number, valueOrMapper?: T | ((i: number) => T), step?: number) => T[];
41
+ /**
42
+ * set arr.length to 0
43
+ */
44
+ declare function clearArray<T>(arr: T[]): void;
41
45
 
42
- export { iterate, list, range };
46
+ export { clearArray, iterate, list, range };
@@ -1,10 +1,12 @@
1
1
  import {
2
+ clearArray,
2
3
  iterate,
3
4
  list,
4
5
  range
5
- } from "../chunk-WLQ64SAO.js";
6
+ } from "../chunk-CSAKXWF3.js";
6
7
  import "../chunk-ZGYORUAX.js";
7
8
  export {
9
+ clearArray,
8
10
  iterate,
9
11
  list,
10
12
  range
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Async wait
3
+ */
4
+ declare const sleep: (milliseconds: number) => Promise<unknown>;
5
+
6
+ export { sleep };
@@ -0,0 +1,6 @@
1
+ import {
2
+ sleep
3
+ } from "../chunk-KFWZFQMB.js";
4
+ export {
5
+ sleep
6
+ };
@@ -1,3 +1,5 @@
1
- export { iterate, list, range } from './array.js';
1
+ export { clearArray, iterate, list, range } from './array.js';
2
+ export { sleep } from './async.js';
2
3
  export { isArray, isClient, isDate, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol } from './is.js';
3
4
  export { draw, random, shuffle, uid } from './random.js';
5
+ export { camel, capitalize, dash, pascal, snake, template, title, trim } from './str.js';
@@ -1,15 +1,26 @@
1
- import "../chunk-33ZRZ4S2.js";
1
+ import "../chunk-OECLQ3OT.js";
2
2
  import {
3
3
  draw,
4
4
  random,
5
5
  shuffle,
6
6
  uid
7
- } from "../chunk-RRYFZNKE.js";
7
+ } from "../chunk-PBALVUKK.js";
8
8
  import {
9
+ camel,
10
+ capitalize,
11
+ dash,
12
+ pascal,
13
+ snake,
14
+ template,
15
+ title,
16
+ trim
17
+ } from "../chunk-PNR5G432.js";
18
+ import {
19
+ clearArray,
9
20
  iterate,
10
21
  list,
11
22
  range
12
- } from "../chunk-WLQ64SAO.js";
23
+ } from "../chunk-CSAKXWF3.js";
13
24
  import {
14
25
  isArray,
15
26
  isClient,
@@ -25,7 +36,14 @@ import {
25
36
  isString,
26
37
  isSymbol
27
38
  } from "../chunk-ZGYORUAX.js";
39
+ import {
40
+ sleep
41
+ } from "../chunk-KFWZFQMB.js";
28
42
  export {
43
+ camel,
44
+ capitalize,
45
+ clearArray,
46
+ dash,
29
47
  draw,
30
48
  isArray,
31
49
  isClient,
@@ -42,8 +60,14 @@ export {
42
60
  isSymbol,
43
61
  iterate,
44
62
  list,
63
+ pascal,
45
64
  random,
46
65
  range,
47
66
  shuffle,
67
+ sleep,
68
+ snake,
69
+ template,
70
+ title,
71
+ trim,
48
72
  uid
49
73
  };
@@ -3,8 +3,8 @@ import {
3
3
  random,
4
4
  shuffle,
5
5
  uid
6
- } from "../chunk-RRYFZNKE.js";
7
- import "../chunk-WLQ64SAO.js";
6
+ } from "../chunk-PBALVUKK.js";
7
+ import "../chunk-CSAKXWF3.js";
8
8
  import "../chunk-ZGYORUAX.js";
9
9
  export {
10
10
  draw,
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Capitalize the first word of the string
3
+ *
4
+ * capitalize('hello') -> 'Hello'
5
+ * capitalize('va va voom') -> 'Va va voom'
6
+ */
7
+ declare const capitalize: (str: string) => string;
8
+ /**
9
+ * Formats the given string in camel case fashion
10
+ *
11
+ * camel('hello world') -> 'helloWorld'
12
+ * camel('va va-VOOM') -> 'vaVaVoom'
13
+ * camel('helloWorld') -> 'helloWorld'
14
+ */
15
+ declare const camel: (str: string) => string;
16
+ /**
17
+ * Formats the given string in snake case fashion
18
+ *
19
+ * splitOnNumber? Treat number as capital, default is true
20
+ *
21
+ * snake('hello world') -> 'hello_world'
22
+ * snake('va va-VOOM') -> 'va_va_voom'
23
+ * snake('helloWord') -> 'hello_world'
24
+ */
25
+ declare const snake: (str: string, options?: {
26
+ splitOnNumber?: boolean;
27
+ }) => string;
28
+ /**
29
+ * Formats the given string in dash case fashion
30
+ *
31
+ * dash('hello world') -> 'hello-world'
32
+ * dash('va va_VOOM') -> 'va-va-voom'
33
+ * dash('helloWord') -> 'hello-word'
34
+ */
35
+ declare const dash: (str: string) => string;
36
+ /**
37
+ * Formats the given string in pascal case fashion
38
+ *
39
+ * pascal('hello world') -> 'HelloWorld'
40
+ * pascal('va va boom') -> 'VaVaBoom'
41
+ */
42
+ declare const pascal: (str: string) => string;
43
+ /**
44
+ * Formats the given string in title case fashion
45
+ *
46
+ * title('hello world') -> 'Hello World'
47
+ * title('va_va_boom') -> 'Va Va Boom'
48
+ * title('root-hook') -> 'Root Hook'
49
+ * title('queryItems') -> 'Query Items'
50
+ */
51
+ declare const title: (str: string | null | undefined) => string;
52
+ /**
53
+ * template is used to replace data by name in template strings.
54
+ * The default expression looks for {{name}} to identify names.
55
+ *
56
+ * Ex. template('Hello, {{name}}', { name: 'ray' })
57
+ * Ex. template('Hello, <name>', { name: 'ray' }, /<(.+?)>/g)
58
+ */
59
+ declare const template: (str: string, data: Record<string, any>, regex?: RegExp) => string;
60
+ /**
61
+ * Trims all prefix and suffix characters from the given
62
+ * string. Like the builtin trim function but accepts
63
+ * other characters you would like to trim and trims
64
+ * multiple characters.
65
+ *
66
+ * ```typescript
67
+ * trim(' hello ') // => 'hello'
68
+ * trim('__hello__', '_') // => 'hello'
69
+ * trim('/repos/:owner/:repo/', '/') // => 'repos/:owner/:repo'
70
+ * trim('222222__hello__1111111', '12_') // => 'hello'
71
+ * ```
72
+ */
73
+ declare const trim: (str: string | null | undefined, charsToTrim?: string) => string;
74
+
75
+ export { camel, capitalize, dash, pascal, snake, template, title, trim };
@@ -0,0 +1,20 @@
1
+ import {
2
+ camel,
3
+ capitalize,
4
+ dash,
5
+ pascal,
6
+ snake,
7
+ template,
8
+ title,
9
+ trim
10
+ } from "../chunk-PNR5G432.js";
11
+ export {
12
+ camel,
13
+ capitalize,
14
+ dash,
15
+ pascal,
16
+ snake,
17
+ template,
18
+ title,
19
+ trim
20
+ };
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  access
3
3
  } from "../chunk-M5A3VVYI.js";
4
- import "../chunk-33ZRZ4S2.js";
5
- import "../chunk-RRYFZNKE.js";
6
- import "../chunk-WLQ64SAO.js";
4
+ import "../chunk-OECLQ3OT.js";
5
+ import "../chunk-PBALVUKK.js";
6
+ import "../chunk-PNR5G432.js";
7
+ import "../chunk-CSAKXWF3.js";
7
8
  import "../chunk-ZGYORUAX.js";
9
+ import "../chunk-KFWZFQMB.js";
8
10
  export {
9
11
  access
10
12
  };
@@ -0,0 +1,12 @@
1
+ import { AccessorArray, Accessor, OnOptions } from 'solid-js';
2
+
3
+ /**
4
+ * Creates a debounced watch effect.
5
+ *
6
+ * opt.delay - The debounce delay in milliseconds. Default is 10ms.
7
+ */
8
+ declare function createDebouncedWatch<S, Next extends Prev, Prev = Next>(targets: AccessorArray<S> | Accessor<S>, fn: (input: S, prevInput?: S) => void, opt?: OnOptions & {
9
+ delay?: number;
10
+ }): void;
11
+
12
+ export { createDebouncedWatch };
@@ -0,0 +1,14 @@
1
+ import {
2
+ createDebouncedWatch
3
+ } from "../chunk-BGLY6NJK.js";
4
+ import "../chunk-M5A3VVYI.js";
5
+ import "../chunk-4L6FK7MF.js";
6
+ import "../chunk-OECLQ3OT.js";
7
+ import "../chunk-PBALVUKK.js";
8
+ import "../chunk-PNR5G432.js";
9
+ import "../chunk-CSAKXWF3.js";
10
+ import "../chunk-ZGYORUAX.js";
11
+ import "../chunk-KFWZFQMB.js";
12
+ export {
13
+ createDebouncedWatch
14
+ };
@@ -1,4 +1,5 @@
1
1
  export { access } from './access.js';
2
+ export { createDebouncedWatch } from './create-debounce-watch.js';
2
3
  export { createWatch } from './create-watch.js';
3
4
  import '../types/maybe.js';
4
5
  import 'solid-js';
@@ -1,15 +1,20 @@
1
- import "../chunk-ZZNAXGNU.js";
1
+ import {
2
+ createDebouncedWatch
3
+ } from "../chunk-BGLY6NJK.js";
2
4
  import {
3
5
  access
4
6
  } from "../chunk-M5A3VVYI.js";
5
7
  import {
6
8
  createWatch
7
9
  } from "../chunk-4L6FK7MF.js";
8
- import "../chunk-33ZRZ4S2.js";
9
- import "../chunk-RRYFZNKE.js";
10
- import "../chunk-WLQ64SAO.js";
10
+ import "../chunk-OECLQ3OT.js";
11
+ import "../chunk-PBALVUKK.js";
12
+ import "../chunk-PNR5G432.js";
13
+ import "../chunk-CSAKXWF3.js";
11
14
  import "../chunk-ZGYORUAX.js";
15
+ import "../chunk-KFWZFQMB.js";
12
16
  export {
13
17
  access,
18
+ createDebouncedWatch,
14
19
  createWatch
15
20
  };
@@ -1,3 +1,4 @@
1
1
  type AnyFn<R = any> = (...args: any[]) => R;
2
+ type Fn = () => void;
2
3
 
3
- export type { AnyFn };
4
+ export type { AnyFn, Fn };
package/dist/types/fn.js CHANGED
@@ -0,0 +1 @@
1
+ import "../chunk-AZAXMGEB.js";
@@ -1,2 +1,3 @@
1
+ export { AnyFn, Fn } from './fn.js';
1
2
  export { MaybeAccessor, MaybeArray, MaybePromise } from './maybe.js';
2
3
  import 'solid-js';
@@ -1,2 +1,3 @@
1
- import "../chunk-2BUPSB7O.js";
1
+ import "../chunk-SK6Y2YH6.js";
2
2
  import "../chunk-EZML2DEC.js";
3
+ import "../chunk-AZAXMGEB.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-tiny-utils",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "A collection of tiny utilities for SolidJS applications",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
@@ -40,7 +40,6 @@
40
40
  "author": "",
41
41
  "license": "MIT",
42
42
  "dependencies": {
43
- "@solid-primitives/event-listener": "^2.4.3",
44
43
  "solid-tiny-context": "0.1.2"
45
44
  },
46
45
  "scripts": {
@@ -1,7 +0,0 @@
1
- // src/fn/index.ts
2
- var noop = () => {
3
- };
4
-
5
- export {
6
- noop
7
- };
@@ -1,23 +0,0 @@
1
- import {
2
- access
3
- } from "./chunk-M5A3VVYI.js";
4
-
5
- // src/fn/create-debounce.ts
6
- import { onCleanup } from "solid-js";
7
- function createDebounce(callback, delay) {
8
- let timeoutId;
9
- onCleanup(() => {
10
- clearTimeout(timeoutId);
11
- });
12
- const run = (...args) => {
13
- clearTimeout(timeoutId);
14
- timeoutId = setTimeout(() => {
15
- callback(...args);
16
- }, access(delay));
17
- };
18
- return run;
19
- }
20
-
21
- export {
22
- createDebounce
23
- };