@fluixi/core 1.0.0-alpha.53

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 (198) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +611 -0
  3. package/dist/cdn/core.global.js +3 -0
  4. package/dist/cli/generate.cjs +1814 -0
  5. package/dist/cli/generate.d.ts +7 -0
  6. package/dist/cli/generate.d.ts.map +1 -0
  7. package/dist/cli/generate.js +2580 -0
  8. package/dist/cli/generate.mjs +1814 -0
  9. package/dist/cli/index.cjs +1814 -0
  10. package/dist/cli/index.d.ts +7 -0
  11. package/dist/cli/index.d.ts.map +1 -0
  12. package/dist/cli/index.js +2580 -0
  13. package/dist/cli/index.mjs +1814 -0
  14. package/dist/cli/run.cjs +2 -0
  15. package/dist/cli/run.d.ts +3 -0
  16. package/dist/cli/run.d.ts.map +1 -0
  17. package/dist/cli/run.js +62 -0
  18. package/dist/cli/run.mjs +2 -0
  19. package/dist/fluixi.d.ts +5 -0
  20. package/dist/src/cdn/chunk-PFM5O5UE.mjs +1 -0
  21. package/dist/src/cdn/core.cjs +1 -0
  22. package/dist/src/cdn/core.d.ts +16 -0
  23. package/dist/src/cdn/core.d.ts.map +1 -0
  24. package/dist/src/cdn/core.js +15 -0
  25. package/dist/src/cdn/core.mjs +1 -0
  26. package/dist/src/cdn/router-next-WNWCFVC2.mjs +1 -0
  27. package/dist/src/index.cjs +1 -0
  28. package/dist/src/index.d.ts +7 -0
  29. package/dist/src/index.d.ts.map +1 -0
  30. package/dist/src/index.js +26 -0
  31. package/dist/src/index.mjs +1 -0
  32. package/dist/src/jsx-dev-runtime.cjs +1 -0
  33. package/dist/src/jsx-dev-runtime.d.ts +2 -0
  34. package/dist/src/jsx-dev-runtime.d.ts.map +1 -0
  35. package/dist/src/jsx-dev-runtime.js +1 -0
  36. package/dist/src/jsx-dev-runtime.mjs +1 -0
  37. package/dist/src/jsx-runtime.cjs +1 -0
  38. package/dist/src/jsx-runtime.d.ts +7 -0
  39. package/dist/src/jsx-runtime.d.ts.map +1 -0
  40. package/dist/src/jsx-runtime.js +17 -0
  41. package/dist/src/jsx-runtime.mjs +1 -0
  42. package/dist/src/lib/client/chunk-D3VTWVNJ.mjs +1 -0
  43. package/dist/src/lib/client/index.cjs +1 -0
  44. package/dist/src/lib/client/index.d.ts +54 -0
  45. package/dist/src/lib/client/index.d.ts.map +1 -0
  46. package/dist/src/lib/client/index.js +142 -0
  47. package/dist/src/lib/client/index.mjs +1 -0
  48. package/dist/src/lib/client/router-next-UYIYMRJL.mjs +1 -0
  49. package/dist/src/lib/context/context.cjs +1 -0
  50. package/dist/src/lib/context/context.d.ts +337 -0
  51. package/dist/src/lib/context/context.d.ts.map +1 -0
  52. package/dist/src/lib/context/context.js +462 -0
  53. package/dist/src/lib/context/context.mjs +1 -0
  54. package/dist/src/lib/context/index.cjs +1 -0
  55. package/dist/src/lib/context/index.d.ts +3 -0
  56. package/dist/src/lib/context/index.d.ts.map +1 -0
  57. package/dist/src/lib/context/index.js +5 -0
  58. package/dist/src/lib/context/index.mjs +1 -0
  59. package/dist/src/lib/control-flow.cjs +1 -0
  60. package/dist/src/lib/control-flow.d.ts +4 -0
  61. package/dist/src/lib/control-flow.d.ts.map +1 -0
  62. package/dist/src/lib/control-flow.js +1 -0
  63. package/dist/src/lib/control-flow.mjs +1 -0
  64. package/dist/src/lib/core.cjs +1 -0
  65. package/dist/src/lib/core.d.ts +90 -0
  66. package/dist/src/lib/core.d.ts.map +1 -0
  67. package/dist/src/lib/core.js +181 -0
  68. package/dist/src/lib/core.mjs +1 -0
  69. package/dist/src/lib/directives/lit.cjs +1 -0
  70. package/dist/src/lib/directives/lit.d.ts +2 -0
  71. package/dist/src/lib/directives/lit.d.ts.map +1 -0
  72. package/dist/src/lib/directives/lit.js +31 -0
  73. package/dist/src/lib/directives/lit.mjs +0 -0
  74. package/dist/src/lib/env/index.cjs +1 -0
  75. package/dist/src/lib/env/index.d.ts +39 -0
  76. package/dist/src/lib/env/index.d.ts.map +1 -0
  77. package/dist/src/lib/env/index.js +50 -0
  78. package/dist/src/lib/env/index.mjs +1 -0
  79. package/dist/src/lib/i18n/index.cjs +1 -0
  80. package/dist/src/lib/i18n/index.d.ts +79 -0
  81. package/dist/src/lib/i18n/index.d.ts.map +1 -0
  82. package/dist/src/lib/i18n/index.js +127 -0
  83. package/dist/src/lib/i18n/index.mjs +1 -0
  84. package/dist/src/lib/index.cjs +1 -0
  85. package/dist/src/lib/index.d.ts +83 -0
  86. package/dist/src/lib/index.d.ts.map +1 -0
  87. package/dist/src/lib/index.js +147 -0
  88. package/dist/src/lib/index.mjs +1 -0
  89. package/dist/src/lib/isomorphic.cjs +1 -0
  90. package/dist/src/lib/isomorphic.d.ts +69 -0
  91. package/dist/src/lib/isomorphic.d.ts.map +1 -0
  92. package/dist/src/lib/isomorphic.js +92 -0
  93. package/dist/src/lib/isomorphic.mjs +1 -0
  94. package/dist/src/lib/jsx-runtime/index.cjs +1 -0
  95. package/dist/src/lib/jsx-runtime/index.d.ts +13 -0
  96. package/dist/src/lib/jsx-runtime/index.d.ts.map +1 -0
  97. package/dist/src/lib/jsx-runtime/index.js +23 -0
  98. package/dist/src/lib/jsx-runtime/index.mjs +1 -0
  99. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.cjs +1 -0
  100. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.d.ts +2 -0
  101. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.d.ts.map +1 -0
  102. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.js +1 -0
  103. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.mjs +1 -0
  104. package/dist/src/lib/plugins/fluixi-routes-plugin.cjs +13 -0
  105. package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts +21 -0
  106. package/dist/src/lib/plugins/fluixi-routes-plugin.d.ts.map +1 -0
  107. package/dist/src/lib/plugins/fluixi-routes-plugin.js +102 -0
  108. package/dist/src/lib/plugins/fluixi-routes-plugin.mjs +13 -0
  109. package/dist/src/lib/plugins/index.cjs +13 -0
  110. package/dist/src/lib/plugins/index.d.ts +4 -0
  111. package/dist/src/lib/plugins/index.d.ts.map +1 -0
  112. package/dist/src/lib/plugins/index.js +3 -0
  113. package/dist/src/lib/plugins/index.mjs +13 -0
  114. package/dist/src/lib/plugins/route-codegen.cjs +8 -0
  115. package/dist/src/lib/plugins/route-codegen.d.ts +13 -0
  116. package/dist/src/lib/plugins/route-codegen.d.ts.map +1 -0
  117. package/dist/src/lib/plugins/route-codegen.js +81 -0
  118. package/dist/src/lib/plugins/route-codegen.mjs +8 -0
  119. package/dist/src/lib/plugins/route-scanner.cjs +1 -0
  120. package/dist/src/lib/plugins/route-scanner.d.ts +39 -0
  121. package/dist/src/lib/plugins/route-scanner.d.ts.map +1 -0
  122. package/dist/src/lib/plugins/route-scanner.js +216 -0
  123. package/dist/src/lib/plugins/route-scanner.mjs +1 -0
  124. package/dist/src/lib/plugins/vite.cjs +1 -0
  125. package/dist/src/lib/plugins/vite.d.ts +3 -0
  126. package/dist/src/lib/plugins/vite.d.ts.map +1 -0
  127. package/dist/src/lib/plugins/vite.js +1 -0
  128. package/dist/src/lib/plugins/vite.mjs +1 -0
  129. package/dist/src/lib/render/component.cjs +1 -0
  130. package/dist/src/lib/render/component.d.ts +328 -0
  131. package/dist/src/lib/render/component.d.ts.map +1 -0
  132. package/dist/src/lib/render/component.js +520 -0
  133. package/dist/src/lib/render/component.mjs +1 -0
  134. package/dist/src/lib/render/index.cjs +1 -0
  135. package/dist/src/lib/render/index.d.ts +113 -0
  136. package/dist/src/lib/render/index.d.ts.map +1 -0
  137. package/dist/src/lib/render/index.js +201 -0
  138. package/dist/src/lib/render/index.mjs +1 -0
  139. package/dist/src/lib/render/lazy.cjs +1 -0
  140. package/dist/src/lib/render/lazy.d.ts +28 -0
  141. package/dist/src/lib/render/lazy.d.ts.map +1 -0
  142. package/dist/src/lib/render/lazy.js +62 -0
  143. package/dist/src/lib/render/lazy.mjs +1 -0
  144. package/dist/src/lib/render/suspense.cjs +1 -0
  145. package/dist/src/lib/render/suspense.d.ts +25 -0
  146. package/dist/src/lib/render/suspense.d.ts.map +1 -0
  147. package/dist/src/lib/render/suspense.js +139 -0
  148. package/dist/src/lib/render/suspense.mjs +1 -0
  149. package/dist/src/lib/router-next/data.cjs +1 -0
  150. package/dist/src/lib/router-next/data.d.ts +101 -0
  151. package/dist/src/lib/router-next/data.d.ts.map +1 -0
  152. package/dist/src/lib/router-next/data.js +179 -0
  153. package/dist/src/lib/router-next/data.mjs +1 -0
  154. package/dist/src/lib/router-next/index.cjs +1 -0
  155. package/dist/src/lib/router-next/index.d.ts +156 -0
  156. package/dist/src/lib/router-next/index.d.ts.map +1 -0
  157. package/dist/src/lib/router-next/index.js +464 -0
  158. package/dist/src/lib/router-next/index.mjs +1 -0
  159. package/dist/src/lib/server/hydration.cjs +1 -0
  160. package/dist/src/lib/server/hydration.d.ts +238 -0
  161. package/dist/src/lib/server/hydration.d.ts.map +1 -0
  162. package/dist/src/lib/server/hydration.js +384 -0
  163. package/dist/src/lib/server/hydration.mjs +1 -0
  164. package/dist/src/lib/server/index.cjs +16 -0
  165. package/dist/src/lib/server/index.d.ts +91 -0
  166. package/dist/src/lib/server/index.d.ts.map +1 -0
  167. package/dist/src/lib/server/index.js +141 -0
  168. package/dist/src/lib/server/index.mjs +16 -0
  169. package/dist/src/lib/server/reactive.cjs +1 -0
  170. package/dist/src/lib/server/reactive.d.ts +298 -0
  171. package/dist/src/lib/server/reactive.d.ts.map +1 -0
  172. package/dist/src/lib/server/reactive.js +472 -0
  173. package/dist/src/lib/server/reactive.mjs +1 -0
  174. package/dist/src/lib/theme/index.cjs +1 -0
  175. package/dist/src/lib/theme/index.d.ts +51 -0
  176. package/dist/src/lib/theme/index.d.ts.map +1 -0
  177. package/dist/src/lib/theme/index.js +79 -0
  178. package/dist/src/lib/theme/index.mjs +1 -0
  179. package/dist/src/lib/utils/index.cjs +1 -0
  180. package/dist/src/lib/utils/index.d.ts +379 -0
  181. package/dist/src/lib/utils/index.d.ts.map +1 -0
  182. package/dist/src/lib/utils/index.js +527 -0
  183. package/dist/src/lib/utils/index.mjs +1 -0
  184. package/dist/src/rx.cjs +1 -0
  185. package/dist/src/rx.d.ts +2 -0
  186. package/dist/src/rx.d.ts.map +1 -0
  187. package/dist/src/rx.js +101 -0
  188. package/dist/src/rx.mjs +0 -0
  189. package/dist/src/server.cjs +16 -0
  190. package/dist/src/server.d.ts +64 -0
  191. package/dist/src/server.d.ts.map +1 -0
  192. package/dist/src/server.js +63 -0
  193. package/dist/src/server.mjs +16 -0
  194. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  195. package/package.json +128 -0
  196. package/src/index.ts +31 -0
  197. package/types/fluixi.d.ts +5 -0
  198. package/types/vinxi.d.ts +50 -0
@@ -0,0 +1,379 @@
1
+ /**
2
+ * @fileoverview General utilities for Fluixi
3
+ * @module @fluixi/core/utils
4
+ *
5
+ * This module provides general utility functions for common operations.
6
+ */
7
+ /**
8
+ * Debounces a function call
9
+ *
10
+ * @template T - Function type
11
+ * @param {T} fn - Function to debounce
12
+ * @param {number} delay - Delay in milliseconds
13
+ * @returns {(...args: Parameters<T>) => void} Debounced function
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import { debounce } from '@fluixi/core/utils';
18
+ *
19
+ * const handleInput = debounce((value: string) => {
20
+ * console.log('Input:', value);
21
+ * }, 300);
22
+ * ```
23
+ */
24
+ export declare function debounce<T extends (...args: any[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void;
25
+ /**
26
+ * Throttles a function call
27
+ *
28
+ * @template T - Function type
29
+ * @param {T} fn - Function to throttle
30
+ * @param {number} limit - Time limit in milliseconds
31
+ * @returns {(...args: Parameters<T>) => void} Throttled function
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * import { throttle } from '@fluixi/core/utils';
36
+ *
37
+ * const handleScroll = throttle(() => {
38
+ * console.log('Scrolled');
39
+ * }, 100);
40
+ * ```
41
+ */
42
+ export declare function throttle<T extends (...args: any[]) => any>(fn: T, limit: number): (...args: Parameters<T>) => void;
43
+ /**
44
+ * Creates a memoized version of a function
45
+ *
46
+ * @template T - Function type
47
+ * @param {T} fn - Function to memoize
48
+ * @returns {T} Memoized function
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * import { memoize } from '@fluixi/core/utils';
53
+ *
54
+ * const expensiveCalc = memoize((n: number) => {
55
+ * return n * n;
56
+ * });
57
+ * ```
58
+ */
59
+ export declare function memoize<T extends (...args: any[]) => any>(fn: T): T;
60
+ /**
61
+ * Deep clones an object
62
+ *
63
+ * @template T - Object type
64
+ * @param {T} obj - Object to clone
65
+ * @returns {T} Cloned object
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * import { deepClone } from '@fluixi/core/utils';
70
+ *
71
+ * const original = { a: 1, b: { c: 2 } };
72
+ * const copy = deepClone(original);
73
+ * ```
74
+ */
75
+ export declare function deepClone<T>(obj: T): T;
76
+ /**
77
+ * Deep merges multiple objects
78
+ *
79
+ * @template T - Object type
80
+ * @param {...Partial<T>[]} objects - Objects to merge
81
+ * @returns {T} Merged object
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * import { deepMerge } from '@fluixi/core/utils';
86
+ *
87
+ * const result = deepMerge(
88
+ * { a: 1, b: { c: 2 } },
89
+ * { b: { d: 3 } }
90
+ * );
91
+ * // { a: 1, b: { c: 2, d: 3 } }
92
+ * ```
93
+ */
94
+ export declare function deepMerge<T extends Record<string, any>>(...objects: Partial<T>[]): T;
95
+ /**
96
+ * Generates a unique ID
97
+ *
98
+ * @param {string} prefix - Optional prefix
99
+ * @returns {string} Unique ID
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * import { uniqueId } from '@fluixi/core/utils';
104
+ *
105
+ * const id = uniqueId('component-');
106
+ * // 'component-abc123def456'
107
+ * ```
108
+ */
109
+ export declare function uniqueId(prefix?: string): string;
110
+ /**
111
+ * Formats a number with commas
112
+ *
113
+ * @param {number} num - Number to format
114
+ * @returns {string} Formatted number
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * import { formatNumber } from '@fluixi/core/utils';
119
+ *
120
+ * formatNumber(1234567); // '1,234,567'
121
+ * ```
122
+ */
123
+ export declare function formatNumber(num: number): string;
124
+ /**
125
+ * Formats bytes to human readable string
126
+ *
127
+ * @param {number} bytes - Number of bytes
128
+ * @param {number} decimals - Decimal places (default: 2)
129
+ * @returns {string} Formatted string
130
+ *
131
+ * @example
132
+ * ```typescript
133
+ * import { formatBytes } from '@fluixi/core/utils';
134
+ *
135
+ * formatBytes(1024); // '1 KB'
136
+ * formatBytes(1048576); // '1 MB'
137
+ * ```
138
+ */
139
+ export declare function formatBytes(bytes: number, decimals?: number): string;
140
+ /**
141
+ * Capitalizes first letter of a string
142
+ *
143
+ * @param {string} str - String to capitalize
144
+ * @returns {string} Capitalized string
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * import { capitalize } from '@fluixi/core/utils';
149
+ *
150
+ * capitalize('hello'); // 'Hello'
151
+ * ```
152
+ */
153
+ export declare function capitalize(str: string): string;
154
+ /**
155
+ * Converts string to kebab-case
156
+ *
157
+ * @param {string} str - String to convert
158
+ * @returns {string} Kebab-case string
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * import { kebabCase } from '@fluixi/core/utils';
163
+ *
164
+ * kebabCase('HelloWorld'); // 'hello-world'
165
+ * ```
166
+ */
167
+ export declare function kebabCase(str: string): string;
168
+ /**
169
+ * Converts string to camelCase
170
+ *
171
+ * @param {string} str - String to convert
172
+ * @returns {string} CamelCase string
173
+ *
174
+ * @example
175
+ * ```typescript
176
+ * import { camelCase } from '@fluixi/core/utils';
177
+ *
178
+ * camelCase('hello-world'); // 'helloWorld'
179
+ * ```
180
+ */
181
+ export declare function camelCase(str: string): string;
182
+ /**
183
+ * Clamps a number between min and max
184
+ *
185
+ * @param {number} value - Value to clamp
186
+ * @param {number} min - Minimum value
187
+ * @param {number} max - Maximum value
188
+ * @returns {number} Clamped value
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * import { clamp } from '@fluixi/core/utils';
193
+ *
194
+ * clamp(5, 0, 10); // 5
195
+ * clamp(-5, 0, 10); // 0
196
+ * clamp(15, 0, 10); // 10
197
+ * ```
198
+ */
199
+ export declare function clamp(value: number, min: number, max: number): number;
200
+ /**
201
+ * Generates a random number between min and max
202
+ *
203
+ * @param {number} min - Minimum value
204
+ * @param {number} max - Maximum value
205
+ * @returns {number} Random number
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * import { random } from '@fluixi/core/utils';
210
+ *
211
+ * const num = random(1, 100);
212
+ * ```
213
+ */
214
+ export declare function random(min: number, max: number): number;
215
+ /**
216
+ * Checks if a value is empty
217
+ *
218
+ * @param {any} value - Value to check
219
+ * @returns {boolean} True if empty
220
+ *
221
+ * @example
222
+ * ```typescript
223
+ * import { isEmpty } from '@fluixi/core/utils';
224
+ *
225
+ * isEmpty(''); // true
226
+ * isEmpty([]); // true
227
+ * isEmpty({}); // true
228
+ * isEmpty(null); // true
229
+ * isEmpty('text'); // false
230
+ * ```
231
+ */
232
+ export declare function isEmpty(value: any): boolean;
233
+ /**
234
+ * Picks specific keys from an object
235
+ *
236
+ * @template T - Object type
237
+ * @template K - Keys to pick
238
+ * @param {T} obj - Source object
239
+ * @param {...K[]} keys - Keys to pick
240
+ * @returns {Pick<T, K>} Object with picked keys
241
+ *
242
+ * @example
243
+ * ```typescript
244
+ * import { pick } from '@fluixi/core/utils';
245
+ *
246
+ * const obj = { a: 1, b: 2, c: 3 };
247
+ * pick(obj, 'a', 'c'); // { a: 1, c: 3 }
248
+ * ```
249
+ */
250
+ export declare function pick<T extends object, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K>;
251
+ /**
252
+ * Omits specific keys from an object
253
+ *
254
+ * @template T - Object type
255
+ * @template K - Keys to omit
256
+ * @param {T} obj - Source object
257
+ * @param {...K[]} keys - Keys to omit
258
+ * @returns {Omit<T, K>} Object without omitted keys
259
+ *
260
+ * @example
261
+ * ```typescript
262
+ * import { omit } from '@fluixi/core/utils';
263
+ *
264
+ * const obj = { a: 1, b: 2, c: 3 };
265
+ * omit(obj, 'b'); // { a: 1, c: 3 }
266
+ * ```
267
+ */
268
+ export declare function omit<T extends object, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K>;
269
+ /**
270
+ * Groups array items by a key
271
+ *
272
+ * @template T - Array item type
273
+ * @template K - Key type
274
+ * @param {T[]} array - Array to group
275
+ * @param {(item: T) => K} fn - Key extraction function
276
+ * @returns {Map<K, T[]>} Grouped items
277
+ *
278
+ * @example
279
+ * ```typescript
280
+ * import { groupBy } from '@fluixi/core/utils';
281
+ *
282
+ * const users = [
283
+ * { name: 'Alice', role: 'admin' },
284
+ * { name: 'Bob', role: 'user' },
285
+ * { name: 'Charlie', role: 'admin' }
286
+ * ];
287
+ * const grouped = groupBy(users, u => u.role);
288
+ * // Map { 'admin' => [...], 'user' => [...] }
289
+ * ```
290
+ */
291
+ export declare function groupBy<T, K>(array: T[], fn: (item: T) => K): Map<K, T[]>;
292
+ /**
293
+ * Creates an array of numbers from start to end
294
+ *
295
+ * @param {number} start - Start number
296
+ * @param {number} end - End number
297
+ * @param {number} step - Step size (default: 1)
298
+ * @returns {number[]} Array of numbers
299
+ *
300
+ * @example
301
+ * ```typescript
302
+ * import { range } from '@fluixi/core/utils';
303
+ *
304
+ * range(0, 5); // [0, 1, 2, 3, 4, 5]
305
+ * range(0, 10, 2); // [0, 2, 4, 6, 8, 10]
306
+ * ```
307
+ */
308
+ export declare function range(start: number, end: number, step?: number): number[];
309
+ /**
310
+ * Retries an async function
311
+ *
312
+ * @template T - Return type
313
+ * @param {() => Promise<T>} fn - Async function to retry
314
+ * @param {number} retries - Number of retries (default: 3)
315
+ * @param {number} delay - Delay between retries in ms (default: 1000)
316
+ * @returns {Promise<T>} Promise that resolves with the result
317
+ *
318
+ * @example
319
+ * ```typescript
320
+ * import { retry } from '@fluixi/core/utils';
321
+ *
322
+ * const data = await retry(
323
+ * () => fetch('/api/data').then(r => r.json()),
324
+ * 3,
325
+ * 1000
326
+ * );
327
+ * ```
328
+ */
329
+ export declare function retry<T>(fn: () => Promise<T>, retries?: number, delay?: number): Promise<T>;
330
+ /**
331
+ * Sleep for specified milliseconds
332
+ *
333
+ * @param {number} ms - Milliseconds to sleep
334
+ * @returns {Promise<void>} Promise that resolves after delay
335
+ *
336
+ * @example
337
+ * ```typescript
338
+ * import { sleep } from '@fluixi/core/utils';
339
+ *
340
+ * await sleep(1000); // Wait 1 second
341
+ * ```
342
+ */
343
+ export declare function sleep(ms: number): Promise<void>;
344
+ /**
345
+ * Type guard to check if value is defined
346
+ *
347
+ * @template T - Value type
348
+ * @param {T | null | undefined} value - Value to check
349
+ * @returns {value is T} True if value is defined
350
+ *
351
+ * @example
352
+ * ```typescript
353
+ * import { isDefined } from '@fluixi/core/utils';
354
+ *
355
+ * const values = [1, null, 2, undefined, 3];
356
+ * const defined = values.filter(isDefined); // [1, 2, 3]
357
+ * ```
358
+ */
359
+ export declare function isDefined<T>(value: T | null | undefined): value is T;
360
+ /**
361
+ * Creates a chainable pipe function
362
+ *
363
+ * @param {...Function[]} fns - Functions to chain
364
+ * @returns {Function} Piped function
365
+ *
366
+ * @example
367
+ * ```typescript
368
+ * import { pipe } from '@fluixi/core/utils';
369
+ *
370
+ * const transform = pipe(
371
+ * (x: number) => x * 2,
372
+ * (x: number) => x + 1,
373
+ * (x: number) => x.toString()
374
+ * );
375
+ * transform(5); // '11'
376
+ * ```
377
+ */
378
+ export declare function pipe<T>(...fns: Array<(arg: any) => any>): (arg: T) => any;
379
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EA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