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
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
type ParseJsonResult<T> = {
|
|
2
|
+
ok: true;
|
|
3
|
+
data: T;
|
|
4
|
+
} | {
|
|
5
|
+
ok: false;
|
|
6
|
+
error: Error;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Parse a JSON string into an object
|
|
10
|
+
* - Safe by default: returns { ok, data/error }
|
|
11
|
+
* - Strict mode: throws on error, returns data directly
|
|
12
|
+
* - If input is already an object, returns it as-is
|
|
13
|
+
* - If input is null/undefined/empty string, returns error (or throws if strict)
|
|
14
|
+
* - Optional generic for typed output (no runtime validation)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Safe mode (default)
|
|
18
|
+
* const result = parseJson(event.body);
|
|
19
|
+
* if (result.ok) console.log(result.data);
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Safe mode with type
|
|
23
|
+
* const result = parseJson<{ name: string }>(event.body);
|
|
24
|
+
* if (result.ok) console.log(result.data.name);
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Strict mode - throws on error
|
|
28
|
+
* const data = parseJson<MyType>(event.body, { strict: true });
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseJson<T = Record<string, unknown>>(input: string | object | null | undefined, opts: {
|
|
31
|
+
strict: true;
|
|
32
|
+
}): T;
|
|
33
|
+
export declare function parseJson<T = Record<string, unknown>>(input: string | object | null | undefined, opts?: {
|
|
34
|
+
strict?: false;
|
|
35
|
+
}): ParseJsonResult<T>;
|
|
36
|
+
type CaseOpts = {
|
|
37
|
+
to: "title" | "snake" | "kebab";
|
|
38
|
+
clean?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Split text into sentences
|
|
42
|
+
* @param text
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
export declare const createSentences: (text?: string) => string[];
|
|
46
|
+
/**
|
|
47
|
+
* Count words in text
|
|
48
|
+
* @param text
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
export declare const countWords: (text: string) => number;
|
|
52
|
+
/**
|
|
53
|
+
* Concatenate strings with optional delimiter
|
|
54
|
+
* @param xs
|
|
55
|
+
* @param delimiter
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
export declare const concat: (xs: (string | undefined)[], delimiter?: string) => string;
|
|
59
|
+
/**
|
|
60
|
+
* The number of times a character appears in a string
|
|
61
|
+
* @param str
|
|
62
|
+
* @param ch
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
export declare const countChar: (str: string, ch: string) => number;
|
|
66
|
+
/**
|
|
67
|
+
* Convert a str to specific casing
|
|
68
|
+
* @param text
|
|
69
|
+
* @param opts
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
export declare const changeCase: <T extends string>(text: string, opts: CaseOpts) => string;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=str.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"str.d.ts","sourceRoot":"","sources":["../../src/shared/str.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,CAAC,CAAC,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnD,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,IAAI,EAAE;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GACrB,CAAC,CAAC;AACL,wBAAgB,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnD,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,GACxB,eAAe,CAAC,CAAC,CAAC,CAAC;AAwCtB,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,aAG5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,WAStC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,YAAY,MAAM,WAEpE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,EAAE,IAAI,MAAM,WAEhD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,QAAQ,WAmBxE,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { Locale } from "date-fns";
|
|
2
|
+
type DurationFormat = "compact" | "full" | "clock" | "fractional";
|
|
3
|
+
type DurationOptions = {
|
|
4
|
+
/** Format style: 'compact' (1h 2m), 'full' (1 hour 2 minutes), 'clock' (01:02:03), 'fractional' (1.4s, 1m4.4s) */
|
|
5
|
+
format?: DurationFormat;
|
|
6
|
+
/** Show zero values for intermediate units (e.g., "1h 0m 30s" vs "1h 30s") */
|
|
7
|
+
showZero?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Formats milliseconds into human-readable duration strings
|
|
11
|
+
* Supports compact (1h 2m), full (`1 hour 2 minutes`), clock (`01:02:03`), and fractional (1.4s, 1m4.4s) formats
|
|
12
|
+
*
|
|
13
|
+
* @param {Object} [options={}] - Configuration options
|
|
14
|
+
* @param {string} [options.format="clock"] - format
|
|
15
|
+
* @param {boolean} [options.showZero=false] - show zero prefix
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* formatDuration(90000) // "1:30"
|
|
19
|
+
* formatDuration(3661000) // "1:01:01"
|
|
20
|
+
* formatDuration(90000, { format: "compact" }) // "1m 30s"
|
|
21
|
+
* formatDuration(90000, { format: "full" }) // "1 minute 30 seconds"
|
|
22
|
+
* formatDuration(3600000, { format: "compact" }) // "1h"
|
|
23
|
+
* formatDuration(3600000, { format: "compact", showZero: true }) // "1h 0m 0s"
|
|
24
|
+
* formatDuration(3660000, { format: "full", showZero: true }) // "1 hour 1 minute 0 seconds"
|
|
25
|
+
* formatDuration(1400, { format: "fractional" }) // "1.4s"
|
|
26
|
+
* formatDuration(45300, { format: "fractional" }) // "45.3s"
|
|
27
|
+
* formatDuration(64400, { format: "fractional" }) // "1m 4.4s"
|
|
28
|
+
*/
|
|
29
|
+
export declare const formatDuration: (ms: number | null | undefined, options?: DurationOptions) => string;
|
|
30
|
+
type DateInput = Date | string | number;
|
|
31
|
+
type DateFormatStyle = "iso" | "short" | "medium" | "long" | "relative" | "year";
|
|
32
|
+
type DateOptions = {
|
|
33
|
+
/** Predefined format style */
|
|
34
|
+
style?: DateFormatStyle;
|
|
35
|
+
/** Custom date-fns format string (overrides style) */
|
|
36
|
+
pattern?: string;
|
|
37
|
+
/** Include time component */
|
|
38
|
+
includeTime?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Flexible date formatter that handles multiple input types and format styles
|
|
42
|
+
* Supports ISO strings, timestamps, and Date objects with intelligent defaults
|
|
43
|
+
* @example
|
|
44
|
+
* // Date formatting with smart input handling
|
|
45
|
+
* formatDate(new Date()) // "Dec 1, 2023"
|
|
46
|
+
* formatDate("2023-12-01") // "Dec 1, 2023"
|
|
47
|
+
* formatDate(1701388800000) // "Dec 1, 2023"
|
|
48
|
+
* formatDate(date, { style: "short" }) // "12/1/23"
|
|
49
|
+
* formatDate(date, { style: "long" }) // "December 1, 2023"
|
|
50
|
+
* formatDate(date, { includeTime: true }) // "Dec 1, 2023 3:30 PM"
|
|
51
|
+
* formatDate(date, { pattern: "yyyy-MM-dd" }) // Custom format
|
|
52
|
+
*/
|
|
53
|
+
export declare const formatDate: (input: DateInput, options?: DateOptions) => string;
|
|
54
|
+
type DateRangeInput = Date | string | number;
|
|
55
|
+
type DateRangeOptions = {
|
|
56
|
+
/** Reference date for today checks (defaults to new Date()) */
|
|
57
|
+
now?: Date;
|
|
58
|
+
/** Show time segment when start and end are the same day (default: true) */
|
|
59
|
+
showTimeWhenSameDay?: boolean;
|
|
60
|
+
/** If true, appends (today) next to whichever date equals today (default: true) */
|
|
61
|
+
markToday?: boolean;
|
|
62
|
+
/** Custom label for today marker (default: "today") */
|
|
63
|
+
todayLabel?: string;
|
|
64
|
+
/** Separator between start and end segments (default: " - ") */
|
|
65
|
+
separator?: string;
|
|
66
|
+
/** Month text style (default: "short") */
|
|
67
|
+
monthFormat?: "short" | "long";
|
|
68
|
+
/** Lowercase am/pm in time output (default: true) */
|
|
69
|
+
lowercaseAmPm?: boolean;
|
|
70
|
+
/** Locale for date-fns formatter */
|
|
71
|
+
locale?: Locale;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Formats a date range according to thread rules:
|
|
75
|
+
* - Same day: "MMM d (today), h:mma - h:mma" (am/pm lowercase, hyphen between times)
|
|
76
|
+
* - Different day, same month/year: "MMM d - d (today), yyyy"
|
|
77
|
+
* - Different month, same year: "MMM d - MMM d (today), yyyy"
|
|
78
|
+
* - Different year: "MMM d, yyyy - MMM d, yyyy" (append (today) next to the correct day if applicable)
|
|
79
|
+
*
|
|
80
|
+
* Notes:
|
|
81
|
+
* - "(today)" is appended next to whichever date matches today.
|
|
82
|
+
* - Times are shown only when start and end are the same calendar day.
|
|
83
|
+
*/
|
|
84
|
+
export declare const formatDateRange: (startInput: DateRangeInput, endInput: DateRangeInput, options?: DateRangeOptions) => string;
|
|
85
|
+
export declare const formatThreadDateRange: (startInput: DateRangeInput, endInput: DateRangeInput, options?: DateRangeOptions) => string;
|
|
86
|
+
type TimeUnit = "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" | "years" | "businessDays";
|
|
87
|
+
type TimeAdjustment = Partial<Record<TimeUnit, number>>;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a new date by adding specified time units to a base date
|
|
90
|
+
* Defaults to current date if no base date provided
|
|
91
|
+
* @example
|
|
92
|
+
* // Date manipulation
|
|
93
|
+
* adjustDate({ hours: 2 }) // 2 hours from now
|
|
94
|
+
* adjustDate({ days: -7, hours: 3 }, someDate) // (7 days ago + 3 hours) from someDate
|
|
95
|
+
*/
|
|
96
|
+
export declare const adjustDate: (adjustment: TimeAdjustment, baseDate?: Date) => Date;
|
|
97
|
+
/**
|
|
98
|
+
* Promise-based delay utility for async operations
|
|
99
|
+
*/
|
|
100
|
+
export declare const sleep: (ms: number) => Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Gets the current timestamp in milliseconds
|
|
103
|
+
*/
|
|
104
|
+
export declare const now: () => number;
|
|
105
|
+
/**
|
|
106
|
+
* Converts various time units to milliseconds
|
|
107
|
+
* @example
|
|
108
|
+
* const ms = toMs(5, "minutes") // Convert 5 minutes to milliseconds
|
|
109
|
+
*/
|
|
110
|
+
export declare const toMs: (value: number, unit?: Exclude<TimeUnit, "businessDays">) => number;
|
|
111
|
+
export {};
|
|
112
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/shared/time.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMvC,KAAK,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,CAAC;AAElE,KAAK,eAAe,GAAG;IACrB,kHAAkH;IAClH,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc,GACzB,IAAI,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,UAAS,eAAoB,WA0F9B,CAAC;AAMF,KAAK,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC,KAAK,eAAe,GAChB,KAAK,GACL,OAAO,GACP,QAAQ,GACR,MAAM,GACN,UAAU,GACV,MAAM,CAAC;AAEX,KAAK,WAAW,GAAG;IACjB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,SAAS,EAAE,UAAS,WAAgB,WAgDrE,CAAC;AAMF,KAAK,cAAc,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7C,KAAK,gBAAgB,GAAG;IACtB,+DAA+D;IAC/D,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,mFAAmF;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC/B,qDAAqD;IACrD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAOF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,YAAY,cAAc,EAC1B,UAAU,cAAc,EACxB,UAAS,gBAAqB,WAiF/B,CAAC;AAGF,eAAO,MAAM,qBAAqB,GAChC,YAAY,cAAc,EAC1B,UAAU,cAAc,EACxB,UAAS,gBAAqB,WACmB,CAAC;AAMpD,KAAK,QAAQ,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,MAAM,GACN,OAAO,GACP,QAAQ,GACR,OAAO,GACP,cAAc,CAAC;AAEnB,KAAK,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GACrB,YAAY,cAAc,EAC1B,WAAU,IAAiB,SAe5B,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,KAAG,OAAO,CAAC,IAAI,CACI,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,GAAG,cAAmB,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,IAAI,GACf,OAAO,MAAM,EACb,OAAM,OAAO,CAAC,QAAQ,EAAE,cAAc,CAAa,WAapD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qstd",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "Standard Block component and utilities library with Panda CSS",
|
|
5
5
|
"author": "malin1",
|
|
6
6
|
"license": "MIT",
|
|
@@ -98,7 +98,9 @@
|
|
|
98
98
|
},
|
|
99
99
|
"homepage": "https://github.com/55cancri/qstd#readme",
|
|
100
100
|
"scripts": {
|
|
101
|
-
"build": "panda codegen && panda cssgen && tsup && node scripts/inject-css-import.js",
|
|
101
|
+
"build": "panda codegen && panda cssgen && tsup && tsc -p tsconfig.build.json && node scripts/inject-css-import.js",
|
|
102
|
+
"build:js": "tsup",
|
|
103
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
102
104
|
"dev": "tsup --watch",
|
|
103
105
|
"prepare:local": "pnpm build && cd playground && pnpm prepare",
|
|
104
106
|
"test": "vitest run",
|
package/dist/client/index.d.cts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export { d as Dict, f as Flow, i as Int, l as List, a as Log, m as Money, r as Random, s as Str, t as Time } from '../log-DlaF8tUZ.cjs';
|
|
2
|
-
import 'date-fns';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* DOM manipulation utilities
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Get element by ID
|
|
9
|
-
* @param id
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
declare const getElement: (id: string) => HTMLElement | null;
|
|
13
|
-
/**
|
|
14
|
-
* Query selector
|
|
15
|
-
* @param selector
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
declare const querySelector: (selector: string) => Element | null;
|
|
19
|
-
/**
|
|
20
|
-
* Query selector all
|
|
21
|
-
* @param selector
|
|
22
|
-
* @returns
|
|
23
|
-
*/
|
|
24
|
-
declare const querySelectorAll: (selector: string) => NodeListOf<Element>;
|
|
25
|
-
/**
|
|
26
|
-
* Scroll to top of page
|
|
27
|
-
*/
|
|
28
|
-
declare const scrollToTop: () => void;
|
|
29
|
-
/**
|
|
30
|
-
* Scroll to coordinates
|
|
31
|
-
* @param x
|
|
32
|
-
* @param y
|
|
33
|
-
*/
|
|
34
|
-
declare const scrollTo: (x: number, y: number) => void;
|
|
35
|
-
/**
|
|
36
|
-
* Get current scroll position
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
declare const getScrollPosition: () => {
|
|
40
|
-
x: number;
|
|
41
|
-
y: number;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Check if element is in viewport
|
|
45
|
-
* @param el
|
|
46
|
-
* @returns
|
|
47
|
-
*/
|
|
48
|
-
declare const isInViewport: (el: HTMLElement) => boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Scroll element into view
|
|
51
|
-
* @param el
|
|
52
|
-
* @param options
|
|
53
|
-
*/
|
|
54
|
-
declare const scrollIntoView: (el: HTMLElement, options?: ScrollIntoViewOptions) => void;
|
|
55
|
-
/**
|
|
56
|
-
* Copy text to clipboard
|
|
57
|
-
* @param text
|
|
58
|
-
* @returns
|
|
59
|
-
*/
|
|
60
|
-
declare const copy: (text: string) => Promise<void>;
|
|
61
|
-
|
|
62
|
-
declare const dom_copy: typeof copy;
|
|
63
|
-
declare const dom_getElement: typeof getElement;
|
|
64
|
-
declare const dom_getScrollPosition: typeof getScrollPosition;
|
|
65
|
-
declare const dom_isInViewport: typeof isInViewport;
|
|
66
|
-
declare const dom_querySelector: typeof querySelector;
|
|
67
|
-
declare const dom_querySelectorAll: typeof querySelectorAll;
|
|
68
|
-
declare const dom_scrollIntoView: typeof scrollIntoView;
|
|
69
|
-
declare const dom_scrollTo: typeof scrollTo;
|
|
70
|
-
declare const dom_scrollToTop: typeof scrollToTop;
|
|
71
|
-
declare namespace dom {
|
|
72
|
-
export { dom_copy as copy, dom_getElement as getElement, dom_getScrollPosition as getScrollPosition, dom_isInViewport as isInViewport, dom_querySelector as querySelector, dom_querySelectorAll as querySelectorAll, dom_scrollIntoView as scrollIntoView, dom_scrollTo as scrollTo, dom_scrollToTop as scrollToTop };
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export { dom as Dom };
|