qstd 0.2.10 → 0.2.12
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.
- package/dist/block/accordion.d.ts +18 -0
- package/dist/block/accordion.d.ts.map +1 -0
- package/dist/block/checkbox.d.ts +3 -0
- package/dist/block/checkbox.d.ts.map +1 -0
- package/dist/block/drawer.d.ts +9 -0
- package/dist/block/drawer.d.ts.map +1 -0
- package/dist/block/fns.d.ts +50 -0
- package/dist/block/fns.d.ts.map +1 -0
- package/dist/block/icon.d.ts +4 -0
- package/dist/block/icon.d.ts.map +1 -0
- package/dist/block/index.d.ts +62 -0
- package/dist/block/index.d.ts.map +1 -0
- package/dist/block/input.d.ts +23 -0
- package/dist/block/input.d.ts.map +1 -0
- package/dist/block/literals.d.ts +121 -0
- package/dist/block/literals.d.ts.map +1 -0
- package/dist/block/menu.d.ts +4 -0
- package/dist/block/menu.d.ts.map +1 -0
- package/dist/block/progress.d.ts +18 -0
- package/dist/block/progress.d.ts.map +1 -0
- package/dist/block/radio.d.ts +17 -0
- package/dist/block/radio.d.ts.map +1 -0
- package/dist/block/switch.d.ts +21 -0
- package/dist/block/switch.d.ts.map +1 -0
- package/dist/block/test-types.d.ts +4 -0
- package/dist/block/test-types.d.ts.map +1 -0
- package/dist/block/textarea.d.ts +33 -0
- package/dist/block/textarea.d.ts.map +1 -0
- package/dist/block/tooltip.d.ts +5 -0
- package/dist/block/tooltip.d.ts.map +1 -0
- package/dist/block/types.d.ts +384 -0
- package/dist/block/types.d.ts.map +1 -0
- package/dist/block/use-resize-observer.d.ts +24 -0
- package/dist/block/use-resize-observer.d.ts.map +1 -0
- package/dist/client/browser.d.ts +44 -0
- package/dist/client/browser.d.ts.map +1 -0
- package/dist/client/dom.d.ts +58 -0
- package/dist/client/dom.d.ts.map +1 -0
- package/dist/client/index.cjs +28 -0
- package/dist/client/index.d.ts +11 -75
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +28 -0
- package/dist/client/storage.d.ts +46 -0
- package/dist/client/storage.d.ts.map +1 -0
- package/dist/preset/index.d.ts +3 -4
- package/dist/preset/index.d.ts.map +1 -0
- package/dist/react/index.cjs +4 -3
- package/dist/react/index.d.ts +10 -21023
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +4 -3
- package/dist/react/use-theme/fns.d.ts +5 -0
- package/dist/react/use-theme/fns.d.ts.map +1 -0
- package/dist/react/use-theme/index.d.ts +13 -0
- package/dist/react/use-theme/index.d.ts.map +1 -0
- package/dist/react/use-theme/literals.d.ts +4 -0
- package/dist/react/use-theme/literals.d.ts.map +1 -0
- package/dist/react/use-theme/types.d.ts +6 -0
- package/dist/react/use-theme/types.d.ts.map +1 -0
- package/dist/server/file.d.ts +8 -0
- package/dist/server/file.d.ts.map +1 -0
- package/dist/server/index.cjs +28 -0
- package/dist/server/index.d.ts +11 -17
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +28 -0
- package/dist/shared/dict.d.ts +57 -0
- package/dist/shared/dict.d.ts.map +1 -0
- package/dist/shared/flow.d.ts +36 -0
- package/dist/shared/flow.d.ts.map +1 -0
- package/dist/shared/int.d.ts +49 -0
- package/dist/shared/int.d.ts.map +1 -0
- package/dist/shared/list.d.ts +29 -0
- package/dist/shared/list.d.ts.map +1 -0
- package/dist/shared/log.d.ts +98 -0
- package/dist/shared/log.d.ts.map +1 -0
- package/dist/shared/money.d.ts +18 -0
- package/dist/shared/money.d.ts.map +1 -0
- package/dist/shared/random.d.ts +41 -0
- package/dist/shared/random.d.ts.map +1 -0
- package/dist/shared/str.d.ts +74 -0
- package/dist/shared/str.d.ts.map +1 -0
- package/dist/shared/time.d.ts +112 -0
- package/dist/shared/time.d.ts.map +1 -0
- package/package.json +4 -2
- package/dist/client/index.d.cts +0 -75
- package/dist/log-DlaF8tUZ.d.cts +0 -496
- package/dist/log-DlaF8tUZ.d.ts +0 -496
- package/dist/preset/index.d.cts +0 -39
- package/dist/react/index.d.cts +0 -21058
- package/dist/server/index.d.cts +0 -17
package/dist/log-DlaF8tUZ.d.ts
DELETED
|
@@ -1,496 +0,0 @@
|
|
|
1
|
-
import { Locale } from 'date-fns';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Robust variadic zipWith with full type inference
|
|
5
|
-
*/
|
|
6
|
-
declare function zipWith<T extends readonly any[], R>(fn: (...args: T) => R, ...arrays: {
|
|
7
|
-
[K in keyof T]: T[K][];
|
|
8
|
-
}): R[];
|
|
9
|
-
/**
|
|
10
|
-
* Create an array of x length filled with items of type y.
|
|
11
|
-
* @param size
|
|
12
|
-
* @param fn
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
declare const create: <T>(size: number, fn?: (_: unknown, x: number) => T) => T[];
|
|
16
|
-
/**
|
|
17
|
-
* First list includes items that pass the predicate.
|
|
18
|
-
* Second list includes items that failed.
|
|
19
|
-
* @param xs
|
|
20
|
-
* @param predicate
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
declare const partition$1: <T>(xs: T[], predicate: (x: T) => boolean) => [T[], T[]];
|
|
24
|
-
/**
|
|
25
|
-
* Split an array into chunks of a specific size
|
|
26
|
-
* @param list
|
|
27
|
-
* @param chunkSize
|
|
28
|
-
* @returns
|
|
29
|
-
*/
|
|
30
|
-
declare const chunk: <T>(list: T[], chunkSize: number) => T[][];
|
|
31
|
-
|
|
32
|
-
declare const list_chunk: typeof chunk;
|
|
33
|
-
declare const list_create: typeof create;
|
|
34
|
-
declare const list_zipWith: typeof zipWith;
|
|
35
|
-
declare namespace list {
|
|
36
|
-
export { list_chunk as chunk, list_create as create, partition$1 as partition, list_zipWith as zipWith };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* dicts are homogeneous- their values must be of the same type
|
|
41
|
-
* records can hold values of different types
|
|
42
|
-
*/
|
|
43
|
-
type t = Record<string, unknown> | object;
|
|
44
|
-
/**
|
|
45
|
-
* Calculate the byte size of an object
|
|
46
|
-
* @param o
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
declare function byteSizeOfObj(o: any): number;
|
|
50
|
-
/**
|
|
51
|
-
* Return an object filter with a subset of properties.
|
|
52
|
-
* @param r
|
|
53
|
-
* @param predicate
|
|
54
|
-
*/
|
|
55
|
-
declare const filter: <R extends t>(r: R, predicate: (value: R[keyof R]) => boolean) => R;
|
|
56
|
-
/**
|
|
57
|
-
* Transform the values on an object
|
|
58
|
-
* @param r
|
|
59
|
-
* @param transformFn
|
|
60
|
-
*/
|
|
61
|
-
declare const transform: <R extends t>(r: R, transformFn: (key: keyof R, value: R[keyof R]) => Record<string, any>) => R;
|
|
62
|
-
/**
|
|
63
|
-
* First object contains key/value pairs that pass the predicate.
|
|
64
|
-
* Second object contains key/value pairs that failed.
|
|
65
|
-
* @param r
|
|
66
|
-
* @param predicate
|
|
67
|
-
* @returns
|
|
68
|
-
*/
|
|
69
|
-
declare const partition: <R extends t>(r: R, predicate: (key: keyof R) => boolean) => readonly [R, R];
|
|
70
|
-
/**
|
|
71
|
-
* Check if an object exists and has keys
|
|
72
|
-
* @param obj
|
|
73
|
-
* @returns
|
|
74
|
-
*/
|
|
75
|
-
declare const exists: <O>(obj: O) => boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Determine if an object is empty.
|
|
78
|
-
* @param obj
|
|
79
|
-
* @returns
|
|
80
|
-
*/
|
|
81
|
-
declare const isEmpty: <T extends t>(obj: T) => boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Return an object with a subset of properties.
|
|
84
|
-
* @param r
|
|
85
|
-
* @param paths
|
|
86
|
-
*/
|
|
87
|
-
declare const pick: <R extends t, U extends keyof R>(r: R, paths: Array<U>) => Pick<R, U>;
|
|
88
|
-
/**
|
|
89
|
-
* Return an object with a subset of properties omitted.
|
|
90
|
-
* @param r
|
|
91
|
-
* @param paths
|
|
92
|
-
*/
|
|
93
|
-
declare const omit: <R extends Record<string, any>, U extends keyof R>(r: R, paths: Array<U>) => Omit<R, U>;
|
|
94
|
-
|
|
95
|
-
declare const dict_byteSizeOfObj: typeof byteSizeOfObj;
|
|
96
|
-
declare const dict_exists: typeof exists;
|
|
97
|
-
declare const dict_filter: typeof filter;
|
|
98
|
-
declare const dict_isEmpty: typeof isEmpty;
|
|
99
|
-
declare const dict_omit: typeof omit;
|
|
100
|
-
declare const dict_partition: typeof partition;
|
|
101
|
-
declare const dict_pick: typeof pick;
|
|
102
|
-
declare const dict_transform: typeof transform;
|
|
103
|
-
declare namespace dict {
|
|
104
|
-
export { dict_byteSizeOfObj as byteSizeOfObj, dict_exists as exists, dict_filter as filter, dict_isEmpty as isEmpty, dict_omit as omit, dict_partition as partition, dict_pick as pick, dict_transform as transform };
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
type ParseJsonResult<T> = {
|
|
108
|
-
ok: true;
|
|
109
|
-
data: T;
|
|
110
|
-
} | {
|
|
111
|
-
ok: false;
|
|
112
|
-
error: Error;
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Parse a JSON string into an object
|
|
116
|
-
* - Safe by default: returns { ok, data/error }
|
|
117
|
-
* - Strict mode: throws on error, returns data directly
|
|
118
|
-
* - If input is already an object, returns it as-is
|
|
119
|
-
* - If input is null/undefined/empty string, returns error (or throws if strict)
|
|
120
|
-
* - Optional generic for typed output (no runtime validation)
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* // Safe mode (default)
|
|
124
|
-
* const result = parseJson(event.body);
|
|
125
|
-
* if (result.ok) console.log(result.data);
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* // Safe mode with type
|
|
129
|
-
* const result = parseJson<{ name: string }>(event.body);
|
|
130
|
-
* if (result.ok) console.log(result.data.name);
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* // Strict mode - throws on error
|
|
134
|
-
* const data = parseJson<MyType>(event.body, { strict: true });
|
|
135
|
-
*/
|
|
136
|
-
declare function parseJson<T = Record<string, unknown>>(input: string | object | null | undefined, opts: {
|
|
137
|
-
strict: true;
|
|
138
|
-
}): T;
|
|
139
|
-
declare function parseJson<T = Record<string, unknown>>(input: string | object | null | undefined, opts?: {
|
|
140
|
-
strict?: false;
|
|
141
|
-
}): ParseJsonResult<T>;
|
|
142
|
-
type CaseOpts = {
|
|
143
|
-
to: "title" | "snake" | "kebab";
|
|
144
|
-
clean?: boolean;
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Split text into sentences
|
|
148
|
-
* @param text
|
|
149
|
-
* @returns
|
|
150
|
-
*/
|
|
151
|
-
declare const createSentences: (text?: string) => string[];
|
|
152
|
-
/**
|
|
153
|
-
* Count words in text
|
|
154
|
-
* @param text
|
|
155
|
-
* @returns
|
|
156
|
-
*/
|
|
157
|
-
declare const countWords: (text: string) => number;
|
|
158
|
-
/**
|
|
159
|
-
* Concatenate strings with optional delimiter
|
|
160
|
-
* @param xs
|
|
161
|
-
* @param delimiter
|
|
162
|
-
* @returns
|
|
163
|
-
*/
|
|
164
|
-
declare const concat: (xs: (string | undefined)[], delimiter?: string) => string;
|
|
165
|
-
/**
|
|
166
|
-
* The number of times a character appears in a string
|
|
167
|
-
* @param str
|
|
168
|
-
* @param ch
|
|
169
|
-
* @returns
|
|
170
|
-
*/
|
|
171
|
-
declare const countChar: (str: string, ch: string) => number;
|
|
172
|
-
/**
|
|
173
|
-
* Convert a str to specific casing
|
|
174
|
-
* @param text
|
|
175
|
-
* @param opts
|
|
176
|
-
* @returns
|
|
177
|
-
*/
|
|
178
|
-
declare const changeCase: <T extends string>(text: string, opts: CaseOpts) => string;
|
|
179
|
-
|
|
180
|
-
declare const str_changeCase: typeof changeCase;
|
|
181
|
-
declare const str_concat: typeof concat;
|
|
182
|
-
declare const str_countChar: typeof countChar;
|
|
183
|
-
declare const str_countWords: typeof countWords;
|
|
184
|
-
declare const str_createSentences: typeof createSentences;
|
|
185
|
-
declare const str_parseJson: typeof parseJson;
|
|
186
|
-
declare namespace str {
|
|
187
|
-
export { str_changeCase as changeCase, str_concat as concat, str_countChar as countChar, str_countWords as countWords, str_createSentences as createSentences, str_parseJson as parseJson };
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
type Range = {
|
|
191
|
-
min: number;
|
|
192
|
-
max: number;
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* Clamp a number within a range
|
|
196
|
-
* @param num
|
|
197
|
-
* @param range
|
|
198
|
-
* @returns
|
|
199
|
-
*/
|
|
200
|
-
declare const clamp: (num: number, range: Range) => number;
|
|
201
|
-
/**
|
|
202
|
-
* Format a number with comma-separated thousandths
|
|
203
|
-
* @param n
|
|
204
|
-
* @returns
|
|
205
|
-
*/
|
|
206
|
-
declare const commaSeparateThousandths: (n: number | string) => string;
|
|
207
|
-
/**
|
|
208
|
-
* Convert bytes to other units.
|
|
209
|
-
* @param bytes
|
|
210
|
-
* @param decimals
|
|
211
|
-
* @param binaryUnits
|
|
212
|
-
* @example
|
|
213
|
-
* ```js
|
|
214
|
-
* formatBytes(293489203947847, 1); // 293.5 TB
|
|
215
|
-
* formatBytes(1234, 0); // 1 KB
|
|
216
|
-
* formatBytes(4534634523453678343456, 2); // 4.53 ZB
|
|
217
|
-
* formatBytes(4534634523453678343456, 2, true)); // 3.84 ZiB
|
|
218
|
-
* formatBytes(4566744, 1); // 4.6 MB
|
|
219
|
-
* formatBytes(534, 0); // 534 Bytes
|
|
220
|
-
* formatBytes(273403407, 0); // 273 MB
|
|
221
|
-
* ```
|
|
222
|
-
* @returns
|
|
223
|
-
*/
|
|
224
|
-
declare const formatBytes: (bytes?: number, decimals?: number, binaryUnits?: boolean) => {
|
|
225
|
-
value?: undefined;
|
|
226
|
-
unit?: undefined;
|
|
227
|
-
display?: undefined;
|
|
228
|
-
} | {
|
|
229
|
-
value: number;
|
|
230
|
-
unit: string;
|
|
231
|
-
display?: undefined;
|
|
232
|
-
} | {
|
|
233
|
-
value: number;
|
|
234
|
-
unit: string | undefined;
|
|
235
|
-
display: string;
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
declare const int_clamp: typeof clamp;
|
|
239
|
-
declare const int_commaSeparateThousandths: typeof commaSeparateThousandths;
|
|
240
|
-
declare const int_formatBytes: typeof formatBytes;
|
|
241
|
-
declare namespace int {
|
|
242
|
-
export { int_clamp as clamp, int_commaSeparateThousandths as commaSeparateThousandths, int_formatBytes as formatBytes };
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
type Opts = {
|
|
246
|
-
symbol?: boolean;
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* Convert cents to USD currency string
|
|
250
|
-
* @param cents
|
|
251
|
-
* @param opts
|
|
252
|
-
* @returns
|
|
253
|
-
*/
|
|
254
|
-
declare const convertToUsd: (cents?: number | string, opts?: Opts) => string | undefined;
|
|
255
|
-
/**
|
|
256
|
-
* Convert dollars to cents
|
|
257
|
-
* @param dollars
|
|
258
|
-
* @returns
|
|
259
|
-
*/
|
|
260
|
-
declare const convertToCents: (dollars: string | number) => number;
|
|
261
|
-
|
|
262
|
-
declare const money_convertToCents: typeof convertToCents;
|
|
263
|
-
declare const money_convertToUsd: typeof convertToUsd;
|
|
264
|
-
declare namespace money {
|
|
265
|
-
export { money_convertToCents as convertToCents, money_convertToUsd as convertToUsd };
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
type DurationFormat = "compact" | "full" | "clock" | "fractional";
|
|
269
|
-
type DurationOptions = {
|
|
270
|
-
/** Format style: 'compact' (1h 2m), 'full' (1 hour 2 minutes), 'clock' (01:02:03), 'fractional' (1.4s, 1m4.4s) */
|
|
271
|
-
format?: DurationFormat;
|
|
272
|
-
/** Show zero values for intermediate units (e.g., "1h 0m 30s" vs "1h 30s") */
|
|
273
|
-
showZero?: boolean;
|
|
274
|
-
};
|
|
275
|
-
/**
|
|
276
|
-
* Formats milliseconds into human-readable duration strings
|
|
277
|
-
* Supports compact (1h 2m), full (`1 hour 2 minutes`), clock (`01:02:03`), and fractional (1.4s, 1m4.4s) formats
|
|
278
|
-
*
|
|
279
|
-
* @param {Object} [options={}] - Configuration options
|
|
280
|
-
* @param {string} [options.format="clock"] - format
|
|
281
|
-
* @param {boolean} [options.showZero=false] - show zero prefix
|
|
282
|
-
*
|
|
283
|
-
* @example
|
|
284
|
-
* formatDuration(90000) // "1:30"
|
|
285
|
-
* formatDuration(3661000) // "1:01:01"
|
|
286
|
-
* formatDuration(90000, { format: "compact" }) // "1m 30s"
|
|
287
|
-
* formatDuration(90000, { format: "full" }) // "1 minute 30 seconds"
|
|
288
|
-
* formatDuration(3600000, { format: "compact" }) // "1h"
|
|
289
|
-
* formatDuration(3600000, { format: "compact", showZero: true }) // "1h 0m 0s"
|
|
290
|
-
* formatDuration(3660000, { format: "full", showZero: true }) // "1 hour 1 minute 0 seconds"
|
|
291
|
-
* formatDuration(1400, { format: "fractional" }) // "1.4s"
|
|
292
|
-
* formatDuration(45300, { format: "fractional" }) // "45.3s"
|
|
293
|
-
* formatDuration(64400, { format: "fractional" }) // "1m 4.4s"
|
|
294
|
-
*/
|
|
295
|
-
declare const formatDuration: (ms: number | null | undefined, options?: DurationOptions) => string;
|
|
296
|
-
type DateInput = Date | string | number;
|
|
297
|
-
type DateFormatStyle = "iso" | "short" | "medium" | "long" | "relative" | "year";
|
|
298
|
-
type DateOptions = {
|
|
299
|
-
/** Predefined format style */
|
|
300
|
-
style?: DateFormatStyle;
|
|
301
|
-
/** Custom date-fns format string (overrides style) */
|
|
302
|
-
pattern?: string;
|
|
303
|
-
/** Include time component */
|
|
304
|
-
includeTime?: boolean;
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* Flexible date formatter that handles multiple input types and format styles
|
|
308
|
-
* Supports ISO strings, timestamps, and Date objects with intelligent defaults
|
|
309
|
-
* @example
|
|
310
|
-
* // Date formatting with smart input handling
|
|
311
|
-
* formatDate(new Date()) // "Dec 1, 2023"
|
|
312
|
-
* formatDate("2023-12-01") // "Dec 1, 2023"
|
|
313
|
-
* formatDate(1701388800000) // "Dec 1, 2023"
|
|
314
|
-
* formatDate(date, { style: "short" }) // "12/1/23"
|
|
315
|
-
* formatDate(date, { style: "long" }) // "December 1, 2023"
|
|
316
|
-
* formatDate(date, { includeTime: true }) // "Dec 1, 2023 3:30 PM"
|
|
317
|
-
* formatDate(date, { pattern: "yyyy-MM-dd" }) // Custom format
|
|
318
|
-
*/
|
|
319
|
-
declare const formatDate: (input: DateInput, options?: DateOptions) => string;
|
|
320
|
-
type DateRangeInput = Date | string | number;
|
|
321
|
-
type DateRangeOptions = {
|
|
322
|
-
/** Reference date for today checks (defaults to new Date()) */
|
|
323
|
-
now?: Date;
|
|
324
|
-
/** Show time segment when start and end are the same day (default: true) */
|
|
325
|
-
showTimeWhenSameDay?: boolean;
|
|
326
|
-
/** If true, appends (today) next to whichever date equals today (default: true) */
|
|
327
|
-
markToday?: boolean;
|
|
328
|
-
/** Custom label for today marker (default: "today") */
|
|
329
|
-
todayLabel?: string;
|
|
330
|
-
/** Separator between start and end segments (default: " - ") */
|
|
331
|
-
separator?: string;
|
|
332
|
-
/** Month text style (default: "short") */
|
|
333
|
-
monthFormat?: "short" | "long";
|
|
334
|
-
/** Lowercase am/pm in time output (default: true) */
|
|
335
|
-
lowercaseAmPm?: boolean;
|
|
336
|
-
/** Locale for date-fns formatter */
|
|
337
|
-
locale?: Locale;
|
|
338
|
-
};
|
|
339
|
-
/**
|
|
340
|
-
* Formats a date range according to thread rules:
|
|
341
|
-
* - Same day: "MMM d (today), h:mma - h:mma" (am/pm lowercase, hyphen between times)
|
|
342
|
-
* - Different day, same month/year: "MMM d - d (today), yyyy"
|
|
343
|
-
* - Different month, same year: "MMM d - MMM d (today), yyyy"
|
|
344
|
-
* - Different year: "MMM d, yyyy - MMM d, yyyy" (append (today) next to the correct day if applicable)
|
|
345
|
-
*
|
|
346
|
-
* Notes:
|
|
347
|
-
* - "(today)" is appended next to whichever date matches today.
|
|
348
|
-
* - Times are shown only when start and end are the same calendar day.
|
|
349
|
-
*/
|
|
350
|
-
declare const formatDateRange: (startInput: DateRangeInput, endInput: DateRangeInput, options?: DateRangeOptions) => string;
|
|
351
|
-
declare const formatThreadDateRange: (startInput: DateRangeInput, endInput: DateRangeInput, options?: DateRangeOptions) => string;
|
|
352
|
-
type TimeUnit = "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" | "years" | "businessDays";
|
|
353
|
-
type TimeAdjustment = Partial<Record<TimeUnit, number>>;
|
|
354
|
-
/**
|
|
355
|
-
* Creates a new date by adding specified time units to a base date
|
|
356
|
-
* Defaults to current date if no base date provided
|
|
357
|
-
* @example
|
|
358
|
-
* // Date manipulation
|
|
359
|
-
* adjustDate({ hours: 2 }) // 2 hours from now
|
|
360
|
-
* adjustDate({ days: -7, hours: 3 }, someDate) // (7 days ago + 3 hours) from someDate
|
|
361
|
-
*/
|
|
362
|
-
declare const adjustDate: (adjustment: TimeAdjustment, baseDate?: Date) => Date;
|
|
363
|
-
/**
|
|
364
|
-
* Promise-based delay utility for async operations
|
|
365
|
-
*/
|
|
366
|
-
declare const sleep$1: (ms: number) => Promise<void>;
|
|
367
|
-
/**
|
|
368
|
-
* Gets the current timestamp in milliseconds
|
|
369
|
-
*/
|
|
370
|
-
declare const now: () => number;
|
|
371
|
-
/**
|
|
372
|
-
* Converts various time units to milliseconds
|
|
373
|
-
* @example
|
|
374
|
-
* const ms = toMs(5, "minutes") // Convert 5 minutes to milliseconds
|
|
375
|
-
*/
|
|
376
|
-
declare const toMs: (value: number, unit?: Exclude<TimeUnit, "businessDays">) => number;
|
|
377
|
-
|
|
378
|
-
declare const time_adjustDate: typeof adjustDate;
|
|
379
|
-
declare const time_formatDate: typeof formatDate;
|
|
380
|
-
declare const time_formatDateRange: typeof formatDateRange;
|
|
381
|
-
declare const time_formatDuration: typeof formatDuration;
|
|
382
|
-
declare const time_formatThreadDateRange: typeof formatThreadDateRange;
|
|
383
|
-
declare const time_now: typeof now;
|
|
384
|
-
declare const time_toMs: typeof toMs;
|
|
385
|
-
declare namespace time {
|
|
386
|
-
export { time_adjustDate as adjustDate, time_formatDate as formatDate, time_formatDateRange as formatDateRange, time_formatDuration as formatDuration, time_formatThreadDateRange as formatThreadDateRange, time_now as now, sleep$1 as sleep, time_toMs as toMs };
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Throttle a function call
|
|
391
|
-
* @param fn
|
|
392
|
-
* @param ms
|
|
393
|
-
* @returns
|
|
394
|
-
*/
|
|
395
|
-
declare const throttle: (fn: any, ms: number) => (...args: any[]) => void;
|
|
396
|
-
/**
|
|
397
|
-
* Ensure code is only triggered once per user input.
|
|
398
|
-
* The debounce forces another function to wait a certain amount of time before running again.
|
|
399
|
-
* Its purpose is to prevent a function from being called several times in succession.
|
|
400
|
-
* @param fn
|
|
401
|
-
* @param timeout
|
|
402
|
-
* @returns
|
|
403
|
-
*/
|
|
404
|
-
declare const debounce: <T extends any[]>(fn: (...args: T) => any, timeout: number) => ((...args: T) => void);
|
|
405
|
-
/**
|
|
406
|
-
* Sleep for x milliseconds.
|
|
407
|
-
* @param ms
|
|
408
|
-
* @returns
|
|
409
|
-
*/
|
|
410
|
-
declare const sleep: (ms: number) => Promise<void>;
|
|
411
|
-
/**
|
|
412
|
-
* Async pool for concurrent iteration with concurrency limit
|
|
413
|
-
* @example
|
|
414
|
-
* ```
|
|
415
|
-
* for await (const ms of asyncPool(2, [1000, 5000, 3000, 2000], ms => sleep(ms))) {
|
|
416
|
-
* console.log(ms);
|
|
417
|
-
* }
|
|
418
|
-
* ```
|
|
419
|
-
* @param concurrency
|
|
420
|
-
* @param iterable
|
|
421
|
-
* @param iterator_fn
|
|
422
|
-
*/
|
|
423
|
-
declare function asyncPool<T>(concurrency: number, iterable: T[], iterator_fn: (x: T, xs: T[]) => any): AsyncGenerator<any, void, unknown>;
|
|
424
|
-
|
|
425
|
-
declare const flow_asyncPool: typeof asyncPool;
|
|
426
|
-
declare const flow_debounce: typeof debounce;
|
|
427
|
-
declare const flow_sleep: typeof sleep;
|
|
428
|
-
declare const flow_throttle: typeof throttle;
|
|
429
|
-
declare namespace flow {
|
|
430
|
-
export { flow_asyncPool as asyncPool, flow_debounce as debounce, flow_sleep as sleep, flow_throttle as throttle };
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Randomly pick an item from an array.
|
|
435
|
-
* @param xs
|
|
436
|
-
* @returns
|
|
437
|
-
*/
|
|
438
|
-
declare const item: <T>(xs: T[]) => T | undefined;
|
|
439
|
-
type RandProps = {
|
|
440
|
-
min?: number;
|
|
441
|
-
max?: number;
|
|
442
|
-
};
|
|
443
|
-
/**
|
|
444
|
-
* Generate a random number (supposedly more random than v1)
|
|
445
|
-
* @param props
|
|
446
|
-
* @returns
|
|
447
|
-
*/
|
|
448
|
-
declare const num: (props?: RandProps) => number;
|
|
449
|
-
/**
|
|
450
|
-
* The Fisher-Yates shuffle is the most efficient algorithm for that purpose.
|
|
451
|
-
* @param xs
|
|
452
|
-
* @returns
|
|
453
|
-
*/
|
|
454
|
-
declare const shuffle: <T>(xs: T[]) => T[];
|
|
455
|
-
/**
|
|
456
|
-
* Randomly return true or false.
|
|
457
|
-
* @returns
|
|
458
|
-
*/
|
|
459
|
-
declare const coinFlip: () => boolean;
|
|
460
|
-
/**
|
|
461
|
-
* Generate a random date.
|
|
462
|
-
* 10000000000 keeps the date to within the current year.
|
|
463
|
-
* The more 0s, the greater the range.
|
|
464
|
-
* @returns
|
|
465
|
-
*/
|
|
466
|
-
declare const date: () => Date;
|
|
467
|
-
/**
|
|
468
|
-
* Generate a random hex color.
|
|
469
|
-
* @returns
|
|
470
|
-
*/
|
|
471
|
-
declare const hexColor: () => string;
|
|
472
|
-
|
|
473
|
-
declare const random_coinFlip: typeof coinFlip;
|
|
474
|
-
declare const random_date: typeof date;
|
|
475
|
-
declare const random_hexColor: typeof hexColor;
|
|
476
|
-
declare const random_item: typeof item;
|
|
477
|
-
declare const random_num: typeof num;
|
|
478
|
-
declare const random_shuffle: typeof shuffle;
|
|
479
|
-
declare namespace random {
|
|
480
|
-
export { random_coinFlip as coinFlip, random_date as date, random_hexColor as hexColor, random_item as item, random_num as num, random_shuffle as shuffle };
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
declare const log: (...values: unknown[]) => void;
|
|
484
|
-
declare const info: (...values: unknown[]) => void;
|
|
485
|
-
declare const warn: (...values: unknown[]) => void;
|
|
486
|
-
declare const error: (...values: unknown[]) => void;
|
|
487
|
-
|
|
488
|
-
declare const log$1_error: typeof error;
|
|
489
|
-
declare const log$1_info: typeof info;
|
|
490
|
-
declare const log$1_log: typeof log;
|
|
491
|
-
declare const log$1_warn: typeof warn;
|
|
492
|
-
declare namespace log$1 {
|
|
493
|
-
export { log$1_error as error, log$1_info as info, log$1_log as log, log$1_warn as warn };
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
export { log$1 as a, dict as d, flow as f, int as i, list as l, money as m, random as r, str as s, time as t };
|
package/dist/preset/index.d.cts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Preset } from '@pandacss/dev';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* QSTD PRESET - Single Source of Truth for Styles
|
|
5
|
-
*
|
|
6
|
-
* This preset is exported to consumers and also used by qstd's own panda.config.ts.
|
|
7
|
-
* It contains all style definitions that should be shared with consumers:
|
|
8
|
-
* - globalCss: Root styles and html defaults
|
|
9
|
-
* - theme: Semantic tokens, breakpoints, keyframes
|
|
10
|
-
* - conditions: Custom selectors (dark mode, hover, focus, etc.)
|
|
11
|
-
* - utilities: All custom utilities (flex, grid, rounded, etc.)
|
|
12
|
-
*
|
|
13
|
-
* USAGE IN CONSUMER PROJECTS:
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // panda.config.ts
|
|
16
|
-
* import qstdPreset from "qstd/preset";
|
|
17
|
-
* export default defineConfig({
|
|
18
|
-
* presets: ["@pandacss/dev/presets", qstdPreset],
|
|
19
|
-
* include: ["./src/**\/*.{ts,tsx}"]
|
|
20
|
-
* });
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* USAGE IN QSTD ITSELF:
|
|
24
|
-
* The qstd panda.config.ts imports this same preset to avoid duplicating
|
|
25
|
-
* style definitions. This ensures consistency between development and
|
|
26
|
-
* what consumers receive.
|
|
27
|
-
*
|
|
28
|
-
* IMPORTANT: This preset should be used WITH Panda's base preset:
|
|
29
|
-
* presets: ["@pandacss/dev/presets", qstdPreset]
|
|
30
|
-
*
|
|
31
|
-
* If you only use [qstdPreset], you'll lose Panda's default colors and tokens!
|
|
32
|
-
*
|
|
33
|
-
* DEPENDENCIES:
|
|
34
|
-
* - Requires @pandacss/dev/presets for base colors (neutral, red, blue, etc.)
|
|
35
|
-
* - Order matters: base preset must come first to provide foundational tokens
|
|
36
|
-
*/
|
|
37
|
-
declare const preset: Preset;
|
|
38
|
-
|
|
39
|
-
export { preset as default };
|