@lichens-innovation/ts-common 1.6.2 → 1.7.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 (64) hide show
  1. package/dist/index.cjs +533 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +232 -0
  4. package/dist/index.d.ts +232 -2
  5. package/dist/index.js +439 -1
  6. package/dist/index.js.map +1 -1
  7. package/package.json +15 -4
  8. package/dist/index.d.ts.map +0 -1
  9. package/dist/utils/color.utils.d.ts +0 -41
  10. package/dist/utils/color.utils.d.ts.map +0 -1
  11. package/dist/utils/color.utils.js +0 -97
  12. package/dist/utils/color.utils.js.map +0 -1
  13. package/dist/utils/date.utils.d.ts +0 -33
  14. package/dist/utils/date.utils.d.ts.map +0 -1
  15. package/dist/utils/date.utils.js +0 -66
  16. package/dist/utils/date.utils.js.map +0 -1
  17. package/dist/utils/errors.utils.d.ts +0 -2
  18. package/dist/utils/errors.utils.d.ts.map +0 -1
  19. package/dist/utils/errors.utils.js +0 -13
  20. package/dist/utils/errors.utils.js.map +0 -1
  21. package/dist/utils/http.utils.d.ts +0 -4
  22. package/dist/utils/http.utils.d.ts.map +0 -1
  23. package/dist/utils/http.utils.js +0 -20
  24. package/dist/utils/http.utils.js.map +0 -1
  25. package/dist/utils/index.d.ts +0 -14
  26. package/dist/utils/index.d.ts.map +0 -1
  27. package/dist/utils/index.js +0 -14
  28. package/dist/utils/index.js.map +0 -1
  29. package/dist/utils/number.utils.d.ts +0 -4
  30. package/dist/utils/number.utils.d.ts.map +0 -1
  31. package/dist/utils/number.utils.js +0 -30
  32. package/dist/utils/number.utils.js.map +0 -1
  33. package/dist/utils/regex.d.ts +0 -3
  34. package/dist/utils/regex.d.ts.map +0 -1
  35. package/dist/utils/regex.js +0 -3
  36. package/dist/utils/regex.js.map +0 -1
  37. package/dist/utils/string.utils.d.ts +0 -38
  38. package/dist/utils/string.utils.d.ts.map +0 -1
  39. package/dist/utils/string.utils.js +0 -63
  40. package/dist/utils/string.utils.js.map +0 -1
  41. package/dist/utils/thread.utils.d.ts +0 -2
  42. package/dist/utils/thread.utils.d.ts.map +0 -1
  43. package/dist/utils/thread.utils.js +0 -2
  44. package/dist/utils/thread.utils.js.map +0 -1
  45. package/dist/utils/time.utils.d.ts +0 -7
  46. package/dist/utils/time.utils.d.ts.map +0 -1
  47. package/dist/utils/time.utils.js +0 -11
  48. package/dist/utils/time.utils.js.map +0 -1
  49. package/dist/utils/types.utils.d.ts +0 -5
  50. package/dist/utils/types.utils.d.ts.map +0 -1
  51. package/dist/utils/types.utils.js +0 -24
  52. package/dist/utils/types.utils.js.map +0 -1
  53. package/dist/utils/units.utils.d.ts +0 -16
  54. package/dist/utils/units.utils.d.ts.map +0 -1
  55. package/dist/utils/units.utils.js +0 -37
  56. package/dist/utils/units.utils.js.map +0 -1
  57. package/dist/utils/uri.utils.d.ts +0 -12
  58. package/dist/utils/uri.utils.d.ts.map +0 -1
  59. package/dist/utils/uri.utils.js +0 -19
  60. package/dist/utils/uri.utils.js.map +0 -1
  61. package/dist/utils/websocket.utils.d.ts +0 -4
  62. package/dist/utils/websocket.utils.d.ts.map +0 -1
  63. package/dist/utils/websocket.utils.js +0 -23
  64. package/dist/utils/websocket.utils.js.map +0 -1
@@ -0,0 +1,232 @@
1
+ interface ToleranceArea {
2
+ flow: number;
3
+ toleranceRange: [number, number];
4
+ }
5
+ /**
6
+ * A chart point with required x and y coordinates.
7
+ */
8
+ interface ChartPoint {
9
+ x: number;
10
+ y: number;
11
+ }
12
+ /**
13
+ * A chart point with optional nullable x and y coordinates.
14
+ */
15
+ interface NullableChartPoint {
16
+ x?: number | null;
17
+ y?: number | null;
18
+ }
19
+ declare const getTickDomain: (ticks: number[]) => [number, number];
20
+ declare const tickFormatter: (value: number) => string;
21
+ declare const toToleranceLabel: (value: number) => string;
22
+ declare const tooltipValueFormatter: (data?: unknown | null) => string;
23
+ /**
24
+ * Rounds a raw value to a "nice" number for chart axis increments.
25
+ * Nice numbers are easy to read: 1, 2, 2.5, 5, or 10 multiplied by a power of 10.
26
+ *
27
+ * @param rawValue - The raw value to round to a nice number
28
+ * @returns A nice number close to the raw value
29
+ *
30
+ * @example
31
+ * roundToNiceNumber(0.7) // returns 1
32
+ * roundToNiceNumber(3) // returns 5
33
+ * roundToNiceNumber(17) // returns 20
34
+ * roundToNiceNumber(80) // returns 100
35
+ */
36
+ declare const roundToNiceNumber: (rawValue: number) => number;
37
+ /**
38
+ * Builds an array of "nice" tick values for a chart axis.
39
+ * The algorithm aims for approximately `targetTickCount` ticks with clean, readable values.
40
+ *
41
+ * @param max - The maximum value to display on the axis
42
+ * @param targetTickCount - The desired number of ticks (default: 10)
43
+ * @returns An array of tick values from 0 to at least `max`
44
+ */
45
+ declare const buildTicksForChart: (max: number, targetTickCount?: number) => number[];
46
+
47
+ interface RgbColor {
48
+ r: number;
49
+ g: number;
50
+ b: number;
51
+ }
52
+ interface RgbaColor extends RgbColor {
53
+ a: number;
54
+ }
55
+ declare const rgbToHex: (r: number, g: number, b: number) => string;
56
+ declare const hexToRgb: (hex: string) => RgbColor;
57
+ declare const rgbaToHex: (color: RgbaColor) => string;
58
+ declare const getOpacityHexValue: (opacity: number) => string;
59
+ declare const rgbaToHexWithAlpha: (color: RgbaColor) => string;
60
+ declare const rgbToString: (color: RgbColor) => string;
61
+ declare const rgbaToString: (color: RgbaColor) => string;
62
+ declare const getLuminance: (r: number, g: number, b: number) => number;
63
+ declare const getContrastTextColor: (hexColor: string) => string;
64
+ /**
65
+ * Normalized RGB color with values between 0 and 1.
66
+ * Useful for graphics libraries like Three.js.
67
+ */
68
+ interface NormalizedRgb {
69
+ r: number;
70
+ g: number;
71
+ b: number;
72
+ }
73
+ /**
74
+ * Convert a hex color string to normalized RGB values (0-1 range).
75
+ * @param hex - Hex color string (with or without # prefix)
76
+ * @returns Normalized RGB object with values between 0 and 1
77
+ */
78
+ declare const hexToNormalizedRgb: (hex: string) => NormalizedRgb;
79
+ /**
80
+ * Determine if a color is light or dark based on relative luminance.
81
+ * Useful for choosing contrasting text colors.
82
+ * @param hex - Hex color string
83
+ * @returns True if the color is considered light (luminance > 0.5)
84
+ */
85
+ declare const isLightColor: (hex: string) => boolean;
86
+ declare const getColorForPercentage: (percent: number) => string;
87
+
88
+ type DateInput = Date | string | number | null;
89
+ declare const dateAs_HHMMSS: (value?: DateInput) => string;
90
+ declare const dateAs_YYYYMMDD: (value?: DateInput) => string;
91
+ declare const dateAs_YYYYMMDD_HHMMSS: (value?: DateInput) => string;
92
+ declare const nowAsTime: () => string;
93
+ declare const nowAsDate: () => string;
94
+ declare const nowAsDateTime: () => string;
95
+ declare const nowAsDateTimeForFilename: () => string;
96
+ /**
97
+ * Format a Unix timestamp (seconds since epoch) to a human-readable string.
98
+ * @param timestamp - Unix timestamp in seconds
99
+ * @param dateFormat - Date format string (default: "yyyy-MM-dd HH:mm:ss")
100
+ * @returns Formatted date string or "N/A" if invalid or zero.
101
+ */
102
+ declare const formatUnixTimestamp: (timestamp: number, dateFormat?: string) => string;
103
+ /**
104
+ * Get the current Unix timestamp in seconds.
105
+ * @returns Current Unix timestamp
106
+ */
107
+ declare const getCurrentUnixTimestamp: () => number;
108
+ /**
109
+ * Check if a Unix timestamp has expired (is in the past).
110
+ * @param timestamp - Unix timestamp in seconds
111
+ * @returns True if the timestamp is in the past
112
+ */
113
+ declare const isExpiredTimestamp: (timestamp: number) => boolean;
114
+ /**
115
+ * Check if a Unix timestamp is active (current or past).
116
+ * @param timestamp - Unix timestamp in seconds
117
+ * @returns True if the timestamp is current or in the past
118
+ */
119
+ declare const isActiveTimestamp: (timestamp: number) => boolean;
120
+
121
+ interface Dimensions {
122
+ width: number;
123
+ height: number;
124
+ }
125
+
126
+ declare const getErrorMessage: (error: unknown) => string;
127
+
128
+ declare const isHttpSuccessStatus: (status?: number | null) => boolean;
129
+ declare const isHttpClientErrorStatus: (status?: number | null) => boolean;
130
+ declare const isHttpServerErrorStatus: (status?: number | null) => boolean;
131
+
132
+ declare const toFixed: (value?: number | null, decimals?: number) => number;
133
+ declare const roundUpToNearest10: (value?: number | null) => number;
134
+ declare const getOrderOfMagnitudeExponent: (n?: number | null) => number;
135
+
136
+ declare const REGEX_ALPHANUMERIC: RegExp;
137
+ declare const REGEX_IPV4: RegExp;
138
+
139
+ declare const isBlank: (str?: string | null) => str is null | undefined | "";
140
+ declare const isNotBlank: (str?: string | null) => str is string;
141
+ declare const isAlphanumeric: (value: string) => boolean;
142
+ /**
143
+ * Removes diacritical marks (e.g., accents, umlauts) from a string.
144
+ * This method normalizes the input string to its canonical decomposition
145
+ * form (NFD) and removes any combining diacritical marks.
146
+ *
147
+ * @param {string} value - The input string to normalize.
148
+ * @returns {string} - The normalized string with diacritical marks removed.
149
+ *
150
+ * @example
151
+ * const result = removeDiacriticalMarks("Ça va très bien, n'est-ce pas?");
152
+ * console.log(result); // "Ca va tres bien, n'est-ce pas?"
153
+ */
154
+ declare const removeDiacriticalMarks: (value: string) => string;
155
+ /**
156
+ * Capitalize the first letter of a string.
157
+ * @param str - The input string
158
+ * @returns The string with the first character uppercased
159
+ */
160
+ declare const capitalizeFirst: (str: string) => string;
161
+ /**
162
+ * Count the number of words in a text string.
163
+ * Words are separated by whitespace.
164
+ * @param text - The text to count words in
165
+ * @returns The number of words found
166
+ */
167
+ declare const countWords: (text: string) => number;
168
+ /**
169
+ * Truncate a string to a maximum length, adding an ellipsis if truncated.
170
+ * @param str - The string to truncate
171
+ * @param maxLength - Maximum length before truncation
172
+ * @param ellipsis - The ellipsis string to append (default: "...")
173
+ * @returns The truncated string
174
+ */
175
+ declare const truncate: (str: string, maxLength: number, ellipsis?: string) => string;
176
+
177
+ declare const sleep: (milliseconds: number) => Promise<unknown>;
178
+
179
+ declare const PeriodsInMS: {
180
+ readonly oneSecond: 1000;
181
+ readonly oneMinute: number;
182
+ readonly oneHour: number;
183
+ readonly oneDay: number;
184
+ };
185
+
186
+ declare const NO_OP: () => void;
187
+ declare const isNullish: (value: unknown) => value is null | undefined;
188
+ declare const isNumber: (value?: unknown | null) => value is number;
189
+ declare const isString: (value?: unknown | null) => value is string;
190
+
191
+ /** m³/s to gallons per minute */
192
+ declare const M3PS_TO_GPM = 15850.3;
193
+ /** Pascals to feet of head (1 Pa = 1 N/m²) */
194
+ declare const PA_TO_FT = 0.000334553;
195
+ /** Watts to Horsepower */
196
+ declare const W_TO_HP = 0.00134102;
197
+ /** meters to inches */
198
+ declare const M_TO_INCHES = 39.3701;
199
+ /** Hz to RPM (for synchronous speed) */
200
+ declare const HZ_TO_RPM = 60;
201
+ declare const fromM3psToGPM: (value?: number | null) => number;
202
+ declare const fromPaToFt: (value?: number | null) => number;
203
+ declare const fromWToHp: (value?: number | null) => number;
204
+ declare const fromMToInches: (value?: number | null) => number;
205
+ declare const fromHzToRpm: (value?: number | null) => number;
206
+
207
+ declare const SCHEME_PREFIXES: {
208
+ readonly file: "file";
209
+ readonly content: "content";
210
+ readonly http: "http";
211
+ readonly https: "https";
212
+ readonly ftp: "ftp";
213
+ readonly ftps: "ftps";
214
+ readonly sftp: "sftp";
215
+ readonly smb: "smb";
216
+ };
217
+ declare const hasScheme: (uri?: string | null) => boolean;
218
+ /**
219
+ * Extracts the base64 data from a data URI string.
220
+ * Data URIs have the format: data:[<mediatype>][;base64],<data>
221
+ * This function extracts everything after the first comma.
222
+ *
223
+ * @param dataUri - The data URI string (e.g., "data:image/png;base64,iVBORw0KG...")
224
+ * @returns The base64 data without the data URI prefix, or the original string if no comma is found
225
+ */
226
+ declare const extractBase64FromDataUri: (dataUri: string) => string;
227
+
228
+ declare const isWsClosable: (ws?: WebSocket | null) => ws is WebSocket;
229
+ declare const isWsOpenOrConnecting: (ws?: WebSocket | null) => ws is WebSocket;
230
+ declare const closeWebSocket: (ws?: WebSocket | null) => void;
231
+
232
+ export { type ChartPoint, type DateInput, type Dimensions, HZ_TO_RPM, M3PS_TO_GPM, M_TO_INCHES, NO_OP, type NormalizedRgb, type NullableChartPoint, PA_TO_FT, PeriodsInMS, REGEX_ALPHANUMERIC, REGEX_IPV4, type RgbColor, type RgbaColor, SCHEME_PREFIXES, type ToleranceArea, W_TO_HP, buildTicksForChart, capitalizeFirst, closeWebSocket, countWords, dateAs_HHMMSS, dateAs_YYYYMMDD, dateAs_YYYYMMDD_HHMMSS, extractBase64FromDataUri, formatUnixTimestamp, fromHzToRpm, fromM3psToGPM, fromMToInches, fromPaToFt, fromWToHp, getColorForPercentage, getContrastTextColor, getCurrentUnixTimestamp, getErrorMessage, getLuminance, getOpacityHexValue, getOrderOfMagnitudeExponent, getTickDomain, hasScheme, hexToNormalizedRgb, hexToRgb, isActiveTimestamp, isAlphanumeric, isBlank, isExpiredTimestamp, isHttpClientErrorStatus, isHttpServerErrorStatus, isHttpSuccessStatus, isLightColor, isNotBlank, isNullish, isNumber, isString, isWsClosable, isWsOpenOrConnecting, nowAsDate, nowAsDateTime, nowAsDateTimeForFilename, nowAsTime, removeDiacriticalMarks, rgbToHex, rgbToString, rgbaToHex, rgbaToHexWithAlpha, rgbaToString, roundToNiceNumber, roundUpToNearest10, sleep, tickFormatter, toFixed, toToleranceLabel, tooltipValueFormatter, truncate };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,232 @@
1
- export * from "./utils";
2
- //# sourceMappingURL=index.d.ts.map
1
+ interface ToleranceArea {
2
+ flow: number;
3
+ toleranceRange: [number, number];
4
+ }
5
+ /**
6
+ * A chart point with required x and y coordinates.
7
+ */
8
+ interface ChartPoint {
9
+ x: number;
10
+ y: number;
11
+ }
12
+ /**
13
+ * A chart point with optional nullable x and y coordinates.
14
+ */
15
+ interface NullableChartPoint {
16
+ x?: number | null;
17
+ y?: number | null;
18
+ }
19
+ declare const getTickDomain: (ticks: number[]) => [number, number];
20
+ declare const tickFormatter: (value: number) => string;
21
+ declare const toToleranceLabel: (value: number) => string;
22
+ declare const tooltipValueFormatter: (data?: unknown | null) => string;
23
+ /**
24
+ * Rounds a raw value to a "nice" number for chart axis increments.
25
+ * Nice numbers are easy to read: 1, 2, 2.5, 5, or 10 multiplied by a power of 10.
26
+ *
27
+ * @param rawValue - The raw value to round to a nice number
28
+ * @returns A nice number close to the raw value
29
+ *
30
+ * @example
31
+ * roundToNiceNumber(0.7) // returns 1
32
+ * roundToNiceNumber(3) // returns 5
33
+ * roundToNiceNumber(17) // returns 20
34
+ * roundToNiceNumber(80) // returns 100
35
+ */
36
+ declare const roundToNiceNumber: (rawValue: number) => number;
37
+ /**
38
+ * Builds an array of "nice" tick values for a chart axis.
39
+ * The algorithm aims for approximately `targetTickCount` ticks with clean, readable values.
40
+ *
41
+ * @param max - The maximum value to display on the axis
42
+ * @param targetTickCount - The desired number of ticks (default: 10)
43
+ * @returns An array of tick values from 0 to at least `max`
44
+ */
45
+ declare const buildTicksForChart: (max: number, targetTickCount?: number) => number[];
46
+
47
+ interface RgbColor {
48
+ r: number;
49
+ g: number;
50
+ b: number;
51
+ }
52
+ interface RgbaColor extends RgbColor {
53
+ a: number;
54
+ }
55
+ declare const rgbToHex: (r: number, g: number, b: number) => string;
56
+ declare const hexToRgb: (hex: string) => RgbColor;
57
+ declare const rgbaToHex: (color: RgbaColor) => string;
58
+ declare const getOpacityHexValue: (opacity: number) => string;
59
+ declare const rgbaToHexWithAlpha: (color: RgbaColor) => string;
60
+ declare const rgbToString: (color: RgbColor) => string;
61
+ declare const rgbaToString: (color: RgbaColor) => string;
62
+ declare const getLuminance: (r: number, g: number, b: number) => number;
63
+ declare const getContrastTextColor: (hexColor: string) => string;
64
+ /**
65
+ * Normalized RGB color with values between 0 and 1.
66
+ * Useful for graphics libraries like Three.js.
67
+ */
68
+ interface NormalizedRgb {
69
+ r: number;
70
+ g: number;
71
+ b: number;
72
+ }
73
+ /**
74
+ * Convert a hex color string to normalized RGB values (0-1 range).
75
+ * @param hex - Hex color string (with or without # prefix)
76
+ * @returns Normalized RGB object with values between 0 and 1
77
+ */
78
+ declare const hexToNormalizedRgb: (hex: string) => NormalizedRgb;
79
+ /**
80
+ * Determine if a color is light or dark based on relative luminance.
81
+ * Useful for choosing contrasting text colors.
82
+ * @param hex - Hex color string
83
+ * @returns True if the color is considered light (luminance > 0.5)
84
+ */
85
+ declare const isLightColor: (hex: string) => boolean;
86
+ declare const getColorForPercentage: (percent: number) => string;
87
+
88
+ type DateInput = Date | string | number | null;
89
+ declare const dateAs_HHMMSS: (value?: DateInput) => string;
90
+ declare const dateAs_YYYYMMDD: (value?: DateInput) => string;
91
+ declare const dateAs_YYYYMMDD_HHMMSS: (value?: DateInput) => string;
92
+ declare const nowAsTime: () => string;
93
+ declare const nowAsDate: () => string;
94
+ declare const nowAsDateTime: () => string;
95
+ declare const nowAsDateTimeForFilename: () => string;
96
+ /**
97
+ * Format a Unix timestamp (seconds since epoch) to a human-readable string.
98
+ * @param timestamp - Unix timestamp in seconds
99
+ * @param dateFormat - Date format string (default: "yyyy-MM-dd HH:mm:ss")
100
+ * @returns Formatted date string or "N/A" if invalid or zero.
101
+ */
102
+ declare const formatUnixTimestamp: (timestamp: number, dateFormat?: string) => string;
103
+ /**
104
+ * Get the current Unix timestamp in seconds.
105
+ * @returns Current Unix timestamp
106
+ */
107
+ declare const getCurrentUnixTimestamp: () => number;
108
+ /**
109
+ * Check if a Unix timestamp has expired (is in the past).
110
+ * @param timestamp - Unix timestamp in seconds
111
+ * @returns True if the timestamp is in the past
112
+ */
113
+ declare const isExpiredTimestamp: (timestamp: number) => boolean;
114
+ /**
115
+ * Check if a Unix timestamp is active (current or past).
116
+ * @param timestamp - Unix timestamp in seconds
117
+ * @returns True if the timestamp is current or in the past
118
+ */
119
+ declare const isActiveTimestamp: (timestamp: number) => boolean;
120
+
121
+ interface Dimensions {
122
+ width: number;
123
+ height: number;
124
+ }
125
+
126
+ declare const getErrorMessage: (error: unknown) => string;
127
+
128
+ declare const isHttpSuccessStatus: (status?: number | null) => boolean;
129
+ declare const isHttpClientErrorStatus: (status?: number | null) => boolean;
130
+ declare const isHttpServerErrorStatus: (status?: number | null) => boolean;
131
+
132
+ declare const toFixed: (value?: number | null, decimals?: number) => number;
133
+ declare const roundUpToNearest10: (value?: number | null) => number;
134
+ declare const getOrderOfMagnitudeExponent: (n?: number | null) => number;
135
+
136
+ declare const REGEX_ALPHANUMERIC: RegExp;
137
+ declare const REGEX_IPV4: RegExp;
138
+
139
+ declare const isBlank: (str?: string | null) => str is null | undefined | "";
140
+ declare const isNotBlank: (str?: string | null) => str is string;
141
+ declare const isAlphanumeric: (value: string) => boolean;
142
+ /**
143
+ * Removes diacritical marks (e.g., accents, umlauts) from a string.
144
+ * This method normalizes the input string to its canonical decomposition
145
+ * form (NFD) and removes any combining diacritical marks.
146
+ *
147
+ * @param {string} value - The input string to normalize.
148
+ * @returns {string} - The normalized string with diacritical marks removed.
149
+ *
150
+ * @example
151
+ * const result = removeDiacriticalMarks("Ça va très bien, n'est-ce pas?");
152
+ * console.log(result); // "Ca va tres bien, n'est-ce pas?"
153
+ */
154
+ declare const removeDiacriticalMarks: (value: string) => string;
155
+ /**
156
+ * Capitalize the first letter of a string.
157
+ * @param str - The input string
158
+ * @returns The string with the first character uppercased
159
+ */
160
+ declare const capitalizeFirst: (str: string) => string;
161
+ /**
162
+ * Count the number of words in a text string.
163
+ * Words are separated by whitespace.
164
+ * @param text - The text to count words in
165
+ * @returns The number of words found
166
+ */
167
+ declare const countWords: (text: string) => number;
168
+ /**
169
+ * Truncate a string to a maximum length, adding an ellipsis if truncated.
170
+ * @param str - The string to truncate
171
+ * @param maxLength - Maximum length before truncation
172
+ * @param ellipsis - The ellipsis string to append (default: "...")
173
+ * @returns The truncated string
174
+ */
175
+ declare const truncate: (str: string, maxLength: number, ellipsis?: string) => string;
176
+
177
+ declare const sleep: (milliseconds: number) => Promise<unknown>;
178
+
179
+ declare const PeriodsInMS: {
180
+ readonly oneSecond: 1000;
181
+ readonly oneMinute: number;
182
+ readonly oneHour: number;
183
+ readonly oneDay: number;
184
+ };
185
+
186
+ declare const NO_OP: () => void;
187
+ declare const isNullish: (value: unknown) => value is null | undefined;
188
+ declare const isNumber: (value?: unknown | null) => value is number;
189
+ declare const isString: (value?: unknown | null) => value is string;
190
+
191
+ /** m³/s to gallons per minute */
192
+ declare const M3PS_TO_GPM = 15850.3;
193
+ /** Pascals to feet of head (1 Pa = 1 N/m²) */
194
+ declare const PA_TO_FT = 0.000334553;
195
+ /** Watts to Horsepower */
196
+ declare const W_TO_HP = 0.00134102;
197
+ /** meters to inches */
198
+ declare const M_TO_INCHES = 39.3701;
199
+ /** Hz to RPM (for synchronous speed) */
200
+ declare const HZ_TO_RPM = 60;
201
+ declare const fromM3psToGPM: (value?: number | null) => number;
202
+ declare const fromPaToFt: (value?: number | null) => number;
203
+ declare const fromWToHp: (value?: number | null) => number;
204
+ declare const fromMToInches: (value?: number | null) => number;
205
+ declare const fromHzToRpm: (value?: number | null) => number;
206
+
207
+ declare const SCHEME_PREFIXES: {
208
+ readonly file: "file";
209
+ readonly content: "content";
210
+ readonly http: "http";
211
+ readonly https: "https";
212
+ readonly ftp: "ftp";
213
+ readonly ftps: "ftps";
214
+ readonly sftp: "sftp";
215
+ readonly smb: "smb";
216
+ };
217
+ declare const hasScheme: (uri?: string | null) => boolean;
218
+ /**
219
+ * Extracts the base64 data from a data URI string.
220
+ * Data URIs have the format: data:[<mediatype>][;base64],<data>
221
+ * This function extracts everything after the first comma.
222
+ *
223
+ * @param dataUri - The data URI string (e.g., "data:image/png;base64,iVBORw0KG...")
224
+ * @returns The base64 data without the data URI prefix, or the original string if no comma is found
225
+ */
226
+ declare const extractBase64FromDataUri: (dataUri: string) => string;
227
+
228
+ declare const isWsClosable: (ws?: WebSocket | null) => ws is WebSocket;
229
+ declare const isWsOpenOrConnecting: (ws?: WebSocket | null) => ws is WebSocket;
230
+ declare const closeWebSocket: (ws?: WebSocket | null) => void;
231
+
232
+ export { type ChartPoint, type DateInput, type Dimensions, HZ_TO_RPM, M3PS_TO_GPM, M_TO_INCHES, NO_OP, type NormalizedRgb, type NullableChartPoint, PA_TO_FT, PeriodsInMS, REGEX_ALPHANUMERIC, REGEX_IPV4, type RgbColor, type RgbaColor, SCHEME_PREFIXES, type ToleranceArea, W_TO_HP, buildTicksForChart, capitalizeFirst, closeWebSocket, countWords, dateAs_HHMMSS, dateAs_YYYYMMDD, dateAs_YYYYMMDD_HHMMSS, extractBase64FromDataUri, formatUnixTimestamp, fromHzToRpm, fromM3psToGPM, fromMToInches, fromPaToFt, fromWToHp, getColorForPercentage, getContrastTextColor, getCurrentUnixTimestamp, getErrorMessage, getLuminance, getOpacityHexValue, getOrderOfMagnitudeExponent, getTickDomain, hasScheme, hexToNormalizedRgb, hexToRgb, isActiveTimestamp, isAlphanumeric, isBlank, isExpiredTimestamp, isHttpClientErrorStatus, isHttpServerErrorStatus, isHttpSuccessStatus, isLightColor, isNotBlank, isNullish, isNumber, isString, isWsClosable, isWsOpenOrConnecting, nowAsDate, nowAsDateTime, nowAsDateTimeForFilename, nowAsTime, removeDiacriticalMarks, rgbToHex, rgbToString, rgbaToHex, rgbaToHexWithAlpha, rgbaToString, roundToNiceNumber, roundUpToNearest10, sleep, tickFormatter, toFixed, toToleranceLabel, tooltipValueFormatter, truncate };