@tarsis/toolkit 0.4.8 → 0.5.1

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 (97) hide show
  1. package/dist/fonts/GT-Flexa-VF-Trial.woff2 +0 -0
  2. package/dist/fonts/GT-Maru-Light-Oblique-Trial.woff2 +0 -0
  3. package/dist/fonts/GT-Maru-Light-Trial.woff2 +0 -0
  4. package/dist/fonts/GT-Maru-Medium-Oblique-Trial.woff2 +0 -0
  5. package/dist/fonts/GT-Maru-Medium-Trial.woff2 +0 -0
  6. package/dist/fonts/GT-Maru-Mono-Black-Oblique-Trial.woff2 +0 -0
  7. package/dist/fonts/GT-Maru-Mono-Black-Trial.woff2 +0 -0
  8. package/dist/fonts/GT-Maru-Mono-Bold-Oblique-Trial.woff2 +0 -0
  9. package/dist/fonts/GT-Maru-Mono-Bold-Trial.woff2 +0 -0
  10. package/dist/fonts/GT-Maru-Mono-Light-Oblique-Trial.woff2 +0 -0
  11. package/dist/fonts/GT-Maru-Mono-Light-Trial.woff2 +0 -0
  12. package/dist/fonts/GT-Maru-Mono-Medium-Oblique-Trial.woff2 +0 -0
  13. package/dist/fonts/GT-Maru-Mono-Medium-Trial.woff2 +0 -0
  14. package/dist/fonts/gt/maru/GT-Maru-Light-Oblique-Trial.woff2 +0 -0
  15. package/dist/fonts/gt/maru/GT-Maru-Light-Trial.woff2 +0 -0
  16. package/dist/fonts/gt/maru/GT-Maru-Medium-Oblique-Trial.woff2 +0 -0
  17. package/dist/fonts/gt/maru/GT-Maru-Medium-Trial.woff2 +0 -0
  18. package/dist/fonts/gt/maru/GT-Maru-Mono-Black-Oblique-Trial.woff2 +0 -0
  19. package/dist/fonts/gt/maru/GT-Maru-Mono-Black-Trial.woff2 +0 -0
  20. package/dist/fonts/gt/maru/GT-Maru-Mono-Bold-Oblique-Trial.woff2 +0 -0
  21. package/dist/fonts/gt/maru/GT-Maru-Mono-Bold-Trial.woff2 +0 -0
  22. package/dist/fonts/gt/maru/GT-Maru-Mono-Light-Oblique-Trial.woff2 +0 -0
  23. package/dist/fonts/gt/maru/GT-Maru-Mono-Light-Trial.woff2 +0 -0
  24. package/dist/fonts/gt/maru/GT-Maru-Mono-Medium-Oblique-Trial.woff2 +0 -0
  25. package/dist/fonts/gt/maru/GT-Maru-Mono-Medium-Trial.woff2 +0 -0
  26. package/dist/fonts/gt/maru/gt-maru-black-oblique.woff2 +0 -0
  27. package/dist/fonts/gt/maru/gt-maru-black.woff2 +0 -0
  28. package/dist/fonts/gt/maru/gt-maru-bold-oblique.woff2 +0 -0
  29. package/dist/fonts/gt/maru/gt-maru-bold.woff2 +0 -0
  30. package/dist/fonts/gt/maru/gt-maru-mega-l.woff2 +0 -0
  31. package/dist/fonts/gt/maru/gt-maru-mega-m.woff2 +0 -0
  32. package/dist/fonts/gt/maru/gt-maru-mega-s.woff2 +0 -0
  33. package/dist/fonts/gt/maru/gt-maru-mono-regular-oblique.woff2 +0 -0
  34. package/dist/fonts/gt/maru/gt-maru-mono-regular.woff2 +0 -0
  35. package/dist/fonts/gt/maru/gt-maru-regular-oblique.woff2 +0 -0
  36. package/dist/fonts/gt/maru/gt-maru-regular.woff2 +0 -0
  37. package/dist/fonts/gt-flexa/GT-Flexa-VF-Trial.woff2 +0 -0
  38. package/dist/fonts/gt-maru-black-oblique.woff2 +0 -0
  39. package/dist/fonts/gt-maru-black.woff2 +0 -0
  40. package/dist/fonts/gt-maru-bold-oblique.woff2 +0 -0
  41. package/dist/fonts/gt-maru-bold.woff2 +0 -0
  42. package/dist/fonts/gt-maru-mega-l.woff2 +0 -0
  43. package/dist/fonts/gt-maru-mega-m.woff2 +0 -0
  44. package/dist/fonts/gt-maru-mega-s.woff2 +0 -0
  45. package/dist/fonts/gt-maru-mono-regular-oblique.woff2 +0 -0
  46. package/dist/fonts/gt-maru-mono-regular.woff2 +0 -0
  47. package/dist/fonts/gt-maru-regular-oblique.woff2 +0 -0
  48. package/dist/fonts/gt-maru-regular.woff2 +0 -0
  49. package/dist/fonts/maru/GT-Maru-Light-Oblique-Trial.woff2 +0 -0
  50. package/dist/fonts/maru/GT-Maru-Light-Trial.woff2 +0 -0
  51. package/dist/fonts/maru/GT-Maru-Medium-Oblique-Trial.woff2 +0 -0
  52. package/dist/fonts/maru/GT-Maru-Medium-Trial.woff2 +0 -0
  53. package/dist/fonts/maru/GT-Maru-Mono-Black-Oblique-Trial.woff2 +0 -0
  54. package/dist/fonts/maru/GT-Maru-Mono-Black-Trial.woff2 +0 -0
  55. package/dist/fonts/maru/GT-Maru-Mono-Bold-Oblique-Trial.woff2 +0 -0
  56. package/dist/fonts/maru/GT-Maru-Mono-Bold-Trial.woff2 +0 -0
  57. package/dist/fonts/maru/GT-Maru-Mono-Light-Oblique-Trial.woff2 +0 -0
  58. package/dist/fonts/maru/GT-Maru-Mono-Light-Trial.woff2 +0 -0
  59. package/dist/fonts/maru/GT-Maru-Mono-Medium-Oblique-Trial.woff2 +0 -0
  60. package/dist/fonts/maru/GT-Maru-Mono-Medium-Trial.woff2 +0 -0
  61. package/dist/fonts/maru/gt-maru-black-oblique.woff2 +0 -0
  62. package/dist/fonts/maru/gt-maru-black.woff2 +0 -0
  63. package/dist/fonts/maru/gt-maru-bold-oblique.woff2 +0 -0
  64. package/dist/fonts/maru/gt-maru-bold.woff2 +0 -0
  65. package/dist/fonts/maru/gt-maru-mega-l.woff2 +0 -0
  66. package/dist/fonts/maru/gt-maru-mega-m.woff2 +0 -0
  67. package/dist/fonts/maru/gt-maru-mega-s.woff2 +0 -0
  68. package/dist/fonts/maru/gt-maru-mono-regular-oblique.woff2 +0 -0
  69. package/dist/fonts/maru/gt-maru-mono-regular.woff2 +0 -0
  70. package/dist/fonts/maru/gt-maru-regular-oblique.woff2 +0 -0
  71. package/dist/fonts/maru/gt-maru-regular.woff2 +0 -0
  72. package/dist/gl-B5722hRa.js +3258 -0
  73. package/dist/gl-Bw-y_sGO.cjs +3262 -0
  74. package/dist/hooks.cjs +24 -0
  75. package/dist/hooks.d.ts +190 -0
  76. package/dist/hooks.js +1 -0
  77. package/dist/index-BeKLV88y.js +3910 -0
  78. package/dist/index-C4Yt_aL6.cjs +114199 -0
  79. package/dist/index-COnXZQL9.cjs +3912 -0
  80. package/dist/index-CQ90hVPI.js +113847 -0
  81. package/dist/index.cjs +343 -41240
  82. package/dist/index.d.ts +470 -354
  83. package/dist/index.js +4 -40894
  84. package/dist/server.cjs +0 -3
  85. package/dist/server.d.ts +0 -2
  86. package/dist/server.js +1 -3
  87. package/dist/styles.css +961 -647
  88. package/dist/svg-Bi5ULzxB.cjs +73 -0
  89. package/dist/svg-CoSCBw2u.js +65 -0
  90. package/dist/useWindowReady-CESjx5iD.cjs +9275 -0
  91. package/dist/useWindowReady-CIGrizO6.js +9185 -0
  92. package/dist/utils.cjs +39 -0
  93. package/dist/utils.d.ts +90 -0
  94. package/dist/utils.js +2 -0
  95. package/package.json +71 -70
  96. package/dist/gl-BytuN41l.cjs +0 -380
  97. package/dist/gl-D_Ly48gx.js +0 -357
package/dist/hooks.cjs ADDED
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const useWindowReady = require('./useWindowReady-CESjx5iD.cjs');
6
+
7
+
8
+
9
+ exports.useAnimatedText = useWindowReady.useAnimatedText;
10
+ exports.useBowser = useWindowReady.useBowser;
11
+ exports.useDebounce = useWindowReady.useDebounce;
12
+ exports.useEffectEvent = useWindowReady.useEffectEvent;
13
+ exports.useInterval = useWindowReady.useInterval;
14
+ exports.useLiveRef = useWindowReady.useLiveRef;
15
+ exports.useMatchMedia = useWindowReady.useMatchMedia;
16
+ exports.useOklch = useWindowReady.useOklch;
17
+ exports.useOutsideClick = useWindowReady.useOutsideClick;
18
+ exports.usePreviousRender = useWindowReady.usePreviousRender;
19
+ exports.usePreviousState = useWindowReady.usePreviousState;
20
+ exports.useRaf = useWindowReady.useRaf;
21
+ exports.useThrottle = useWindowReady.useThrottle;
22
+ exports.useTimeout = useWindowReady.useTimeout;
23
+ exports.useUniversalLayoutEffect = useWindowReady.useUniversalLayoutEffect;
24
+ exports.useWindowReady = useWindowReady.useWindowReady;
@@ -0,0 +1,190 @@
1
+ import { default as default_2 } from 'react';
2
+ import { DependencyList } from 'react';
3
+ import { RefObject } from 'react';
4
+
5
+ export declare function useAnimatedText(text: string, delimiter?: 'letter' | 'word'): string;
6
+
7
+ export declare const useBowser: () => UseBowserResult | null;
8
+
9
+ declare interface UseBowserResult {
10
+ isMobile: boolean;
11
+ isDesktop: boolean;
12
+ isMacOS: boolean;
13
+ isIOS: boolean;
14
+ isSafari: boolean;
15
+ isFirefox: boolean;
16
+ isChrome: boolean;
17
+ }
18
+
19
+ /**
20
+ * Custom hook that debounces a callback function to delay its execution until after
21
+ * a specified wait time has elapsed since the last time it was invoked.
22
+ *
23
+ * Debouncing ensures that the callback is only executed once after a series of rapid calls,
24
+ * waiting for a pause in the calls before executing.
25
+ *
26
+ * @param callback - The function to debounce
27
+ * @param delay - The delay time (in milliseconds) to wait before executing the callback
28
+ * @returns A debounced version of the callback function
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * const debouncedSearch = useDebounce((query: string) => {
33
+ * console.log('Searching for:', query)
34
+ * }, 300)
35
+ *
36
+ * return <input onChange={(e) => debouncedSearch(e.target.value)} />
37
+ * ```
38
+ */
39
+ export declare const useDebounce: <T extends (...args: any[]) => any>(callback: T, delay: number) => T;
40
+
41
+ /**
42
+ * A React hook that implements the useEffectEvent pattern from React RFC.
43
+ * This hook allows you to define an event handler that can access the latest props/state
44
+ * without triggering effect dependency lists when the handler changes.
45
+ * @see https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md#internal-implementation
46
+ * @react https://react.dev/learn/separating-events-from-effects
47
+ */
48
+ export declare function useEffectEvent<TArgs extends any[], TReturn extends undefined>(callback: undefined): (...args: TArgs) => TReturn;
49
+
50
+ export declare function useEffectEvent<TArgs extends any[], TReturn>(callback: (...args: TArgs) => TReturn): (...args: TArgs) => TReturn;
51
+
52
+ export declare function useEffectEvent<TArgs extends any[], TReturn>(callback: ((...args: TArgs) => TReturn) | undefined): (...args: TArgs) => TReturn | undefined;
53
+
54
+ /**
55
+ * Custom hook that manages an interval with automatic cleanup.
56
+ * Provides a reliable way to handle intervals that are properly cleaned up
57
+ * on component unmount or when dependencies change.
58
+ *
59
+ * @param callback - The function to execute on each interval
60
+ * @param delay - The delay in milliseconds (null to clear the interval)
61
+ * @param deps - Optional dependency array. If provided, interval restarts when deps change.
62
+ * If not provided, callback updates via ref without restarting interval.
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * // Runs continuously, callback updates via ref
67
+ * useInterval(() => {
68
+ * console.log('This runs every second')
69
+ * }, 1000)
70
+ *
71
+ * // Restarts interval when count changes
72
+ * useInterval(() => {
73
+ * console.log('Count:', count)
74
+ * }, 1000, [count])
75
+ * ```
76
+ */
77
+ export declare const useInterval: (callback: VoidFunction, delay?: number | null, deps?: DependencyList) => void;
78
+
79
+ export declare const useLiveRef: <T>(value: T) => RefObject<T>;
80
+
81
+ export declare const useMatchMedia: (query: string) => boolean | null;
82
+
83
+ export declare const useOklch: () => void;
84
+
85
+ /**
86
+ * Custom hook that detects clicks outside of a specified element and triggers a callback.
87
+ *
88
+ * Useful for implementing dropdown menus, modals, or any component that should close
89
+ * when the user clicks outside of it.
90
+ *
91
+ * @param ref - React ref object pointing to the element to monitor
92
+ * @param callback - Function to call when a click occurs outside the element
93
+ * @param isActive - Whether the outside click detection should be active (default: true)
94
+ *
95
+ * @example
96
+ * ```tsx
97
+ * const ref = useRef<HTMLDivElement>(null)
98
+ * const [isOpen, setIsOpen] = useState(false)
99
+ *
100
+ * useOutsideClick(ref, () => setIsOpen(false), isOpen)
101
+ *
102
+ * return <div ref={ref}>...</div>
103
+ * ```
104
+ */
105
+ export declare const useOutsideClick: <T extends HTMLElement = HTMLElement>(ref: RefObject<T | null>, callback: VoidFunction, isActive?: boolean) => void;
106
+
107
+ export declare const usePreviousRender: <T>(value: T) => T | undefined;
108
+
109
+ export declare const usePreviousState: <T>(value: T) => T | undefined;
110
+
111
+ /**
112
+ * Custom hook that provides a requestAnimationFrame-based callback execution.
113
+ * Useful for performance-critical animations and continuous updates that should
114
+ * be synchronized with the browser's refresh rate.
115
+ *
116
+ * The callback will be executed on the next animation frame, and can be
117
+ * controlled with an enabled flag for conditional execution.
118
+ *
119
+ * @param callback - The function to execute on each animation frame
120
+ * @param enabled - Whether the animation loop should be active (default: true)
121
+ * @returns A function to manually trigger the animation frame callback
122
+ *
123
+ * @example
124
+ * ```tsx
125
+ * const animate = useRaf(() => {
126
+ * // Animation logic here
127
+ * console.log('Animation frame')
128
+ * }, isAnimating)
129
+ *
130
+ * // Manually trigger
131
+ * animate()
132
+ * ```
133
+ */
134
+ export declare const useRaf: (callback: VoidFunction, enabled?: boolean) => VoidFunction;
135
+
136
+ /**
137
+ * Custom hook that throttles a callback function to limit how often it can be invoked.
138
+ *
139
+ * Throttling ensures that the callback is executed at most once per specified time interval,
140
+ * regardless of how many times the throttled function is called.
141
+ *
142
+ * @param callback - The function to throttle
143
+ * @param delay - The minimum time interval (in milliseconds) between executions
144
+ * @returns A throttled version of the callback function
145
+ *
146
+ * @example
147
+ * ```tsx
148
+ * const throttledClick = useThrottle(() => {
149
+ * console.log('Button clicked')
150
+ * }, 500)
151
+ *
152
+ * return <button onClick={throttledClick}>Click me</button>
153
+ * ```
154
+ */
155
+ export declare const useThrottle: <T extends (...args: any[]) => any>(callback: T, delay: number) => T;
156
+
157
+ /**
158
+ * Custom hook that manages a timeout with automatic cleanup.
159
+ * Provides a reliable way to handle timeouts that are properly cleaned up
160
+ * on component unmount or when dependencies change.
161
+ *
162
+ * @param callback - The function to execute after the delay
163
+ * @param delay - The delay in milliseconds (null to clear the timeout)
164
+ * @param deps - Optional dependency array. If provided, timeout restarts when deps change.
165
+ * If not provided, callback updates via ref without restarting timeout.
166
+ *
167
+ * @example
168
+ * ```tsx
169
+ * // Runs once, callback updates via ref
170
+ * useTimeout(() => {
171
+ * console.log('This runs after 1 second')
172
+ * }, 1000)
173
+ *
174
+ * // Restarts timeout when count changes
175
+ * useTimeout(() => {
176
+ * console.log('Count:', count)
177
+ * }, 1000, [count])
178
+ * ```
179
+ */
180
+ export declare const useTimeout: (callback: VoidFunction, delay?: number | null, deps?: DependencyList) => void;
181
+
182
+ /**
183
+ * Universal layout effect that uses useLayoutEffect in browser environments
184
+ * and falls back to useEffect in SSR environments
185
+ */
186
+ export declare const useUniversalLayoutEffect: typeof default_2.useEffect;
187
+
188
+ export declare const useWindowReady: () => boolean;
189
+
190
+ export { }
package/dist/hooks.js ADDED
@@ -0,0 +1 @@
1
+ export { u as useAnimatedText, a as useBowser, b as useDebounce, d as useEffectEvent, e as useInterval, f as useLiveRef, g as useMatchMedia, h as useOklch, i as useOutsideClick, k as usePreviousRender, j as usePreviousState, l as useRaf, m as useThrottle, n as useTimeout, c as useUniversalLayoutEffect, o as useWindowReady } from './useWindowReady-CIGrizO6.js';