@iobroker/json-config 7.3.1 → 7.3.2

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/build/Utils.d.ts DELETED
@@ -1,377 +0,0 @@
1
- export default Utils;
2
- declare class Utils {
3
- static namespace: string;
4
- static INSTANCES: string;
5
- static dateFormat: string[];
6
- static FORBIDDEN_CHARS: RegExp;
7
- /**
8
- * Capitalize words.
9
- * @param {string | undefined} name
10
- * @returns {string}
11
- */
12
- static CapitalWords(name: string | undefined): string;
13
- static formatSeconds(seconds: any): string;
14
- /**
15
- * Get the name of the object by id from the name or description.
16
- * @param {Record<string, ioBroker.Object>} objects
17
- * @param {string} id
18
- * @param {{ name: any; } | ioBroker.Languages | null} settings
19
- * @param {{ language?: ioBroker.Languages; }} options
20
- * @param {boolean} [isDesc] Set to true to get the description.
21
- * @returns {string}
22
- */
23
- static getObjectName(objects: Record<string, ioBroker.Object>, id: string, settings: {
24
- name: any;
25
- } | ioBroker.Languages | null, options: {
26
- language?: ioBroker.Languages;
27
- }, isDesc?: boolean): string;
28
- /**
29
- * Get the name of the object from the name or description.
30
- * @param {ioBroker.PartialObject} obj
31
- * @param {{ name: any; } | ioBroker.Languages | null } settings or language
32
- * @param {{ language?: ioBroker.Languages; } } options
33
- * @param {boolean} [isDesc] Set to true to get the description.
34
- * @param {boolean} [noTrim] Allow to use spaces in name (by edit)
35
- * @returns {string}
36
- */
37
- static getObjectNameFromObj(obj: ioBroker.PartialObject, settings: {
38
- name: any;
39
- } | ioBroker.Languages | null, options: {
40
- language?: ioBroker.Languages;
41
- }, isDesc?: boolean, noTrim?: boolean): string;
42
- /**
43
- * @param {ioBroker.PartialObject | ioBroker.ObjectCommon} obj
44
- * @param {string} forEnumId
45
- * @param {{ user: string; }} options
46
- * @returns {string | null}
47
- */
48
- static getSettingsOrder(obj: ioBroker.PartialObject | ioBroker.ObjectCommon, forEnumId: string, options: {
49
- user: string;
50
- }): string | null;
51
- /**
52
- * @param {ioBroker.PartialObject | ioBroker.ObjectCommon} obj
53
- * @param {string} forEnumId
54
- * @param {{ user: string; }} options
55
- */
56
- static getSettingsCustomURLs(obj: ioBroker.PartialObject | ioBroker.ObjectCommon, forEnumId: string, options: {
57
- user: string;
58
- }): any;
59
- /**
60
- * Reorder the array items in list between source and dest.
61
- * @param {Iterable<any> | ArrayLike<any>} list
62
- * @param {number} source
63
- * @param {number} dest
64
- */
65
- static reorder(list: Iterable<any> | ArrayLike<any>, source: number, dest: number): any[];
66
- /**
67
- * @param {any} obj
68
- * @param {{ id: any; user: any; name: any; icon: any; color: any; language: ioBroker.Languages; }} options
69
- * @param {boolean} [defaultEnabling]
70
- */
71
- static getSettings(obj: any, options: {
72
- id: any;
73
- user: any;
74
- name: any;
75
- icon: any;
76
- color: any;
77
- language: ioBroker.Languages;
78
- }, defaultEnabling?: boolean): any;
79
- /**
80
- * @param {any} obj
81
- * @param {any} settings
82
- * @param {{ user: any; language: ioBroker.Languages; }} options
83
- */
84
- static setSettings(obj: any, settings: any, options: {
85
- user: any;
86
- language: ioBroker.Languages;
87
- }): boolean;
88
- /**
89
- * Get the icon for the given settings.
90
- * @param {{ icon: string | undefined; name: string | undefined; prefix: string | undefined}} settings
91
- * @param {any} style
92
- * @returns {JSX.Element | null}
93
- */
94
- static getIcon(settings: {
95
- icon: string | undefined;
96
- name: string | undefined;
97
- prefix: string | undefined;
98
- }, style: any): JSX.Element | null;
99
- /**
100
- * Get the icon for the given object.
101
- * @param {string} id
102
- * @param {{ common: { icon: any; }; }} obj
103
- * @returns {string | null}
104
- */
105
- static getObjectIcon(id: string, obj: {
106
- common: {
107
- icon: any;
108
- };
109
- }): string | null;
110
- /**
111
- * Splits CamelCase into words.
112
- * @param {string | undefined} text
113
- * @returns {string}
114
- */
115
- static splitCamelCase(text: string | undefined): string;
116
- /**
117
- * Check if the given color is bright.
118
- * https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color
119
- * @param {string | null | undefined} color
120
- * @param {boolean} [defaultValue]
121
- * @returns {boolean}
122
- */
123
- static isUseBright(color: string | null | undefined, defaultValue?: boolean): boolean;
124
- /**
125
- * Get the time string in the format 00:00.
126
- * @param {string | number} seconds
127
- */
128
- static getTimeString(seconds: string | number): string;
129
- /**
130
- * Gets the wind direction with the given angle (degrees).
131
- * @param {number} angle in degrees.
132
- * @returns {string | undefined}
133
- */
134
- static getWindDirection(angle: number): string | undefined;
135
- /**
136
- * Pad the given number with a zero if it's not 2 digits long.
137
- * @param {string | number} num
138
- */
139
- static padding(num: string | number): string | number;
140
- /**
141
- * Sets the date format.
142
- * @param {string} format
143
- */
144
- static setDataFormat(format: string): void;
145
- /**
146
- * Converts the date to a string.
147
- * @param {string | number | Date} now
148
- * @returns {string}
149
- */
150
- static date2string(now: string | number | Date): string;
151
- /**
152
- * Render a text as a link.
153
- * @param {string} text
154
- * @returns {string | JSX.Element[]}
155
- */
156
- static renderTextWithA(text: string): string | JSX.Element[];
157
- /**
158
- * Get the smart name of the given state.
159
- * @param {Record<string, ioBroker.StateObject> | ioBroker.StateObject} states
160
- * @param {string} id
161
- * @param {string} instanceId
162
- * @param {boolean} [noCommon]
163
- */
164
- static getSmartName(states: Record<string, ioBroker.StateObject> | ioBroker.StateObject, id: string, instanceId: string, noCommon?: boolean): any;
165
- /**
166
- * Get the smart name from a state.
167
- * @param {ioBroker.StateObject} obj
168
- * @param {string} instanceId
169
- * @param {boolean} [noCommon]
170
- */
171
- static getSmartNameFromObj(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): any;
172
- /**
173
- * Enable smart name for a state.
174
- * @param {ioBroker.StateObject} obj
175
- * @param {string} instanceId
176
- * @param {boolean} [noCommon]
177
- */
178
- static enableSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void;
179
- /**
180
- * Completely remove smart name from a state.
181
- * @param {ioBroker.StateObject} obj
182
- * @param {string | number} instanceId
183
- * @param {boolean} [noCommon]
184
- */
185
- static removeSmartName(obj: ioBroker.StateObject, instanceId: string | number, noCommon?: boolean): void;
186
- /**
187
- * Update the smartname of a state.
188
- * @param {ioBroker.StateObject} obj
189
- * @param {string} newSmartName
190
- * @param {string | undefined} byON
191
- * @param {string | undefined} smartType
192
- * @param {string} instanceId
193
- * @param {boolean} [noCommon]
194
- */
195
- static updateSmartName(obj: ioBroker.StateObject, newSmartName: string, byON: string | undefined, smartType: string | undefined, instanceId: string, noCommon?: boolean): void;
196
- /**
197
- * Disable the smart name of a state.
198
- * @param {ioBroker.StateObject} obj
199
- * @param {string} instanceId
200
- * @param {boolean} [noCommon]
201
- */
202
- static disableSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void;
203
- /**
204
- * Copy text to the clipboard.
205
- * @param {string} text
206
- * @param {Event} [e]
207
- */
208
- static copyToClipboard(text: string, e?: Event): boolean;
209
- /**
210
- * Gets the extension of a file name.
211
- * @param {string | null} [fileName] the file name.
212
- * @returns {string | null} The extension in lower case.
213
- */
214
- static getFileExtension(fileName?: string | null): string | null;
215
- /**
216
- * Format number of bytes as a string with B, KB, MB or GB.
217
- * The base for all calculations is 1024.
218
- * @param {number} bytes The number of bytes.
219
- * @returns {string} The formatted string (e.g. '723.5 KB')
220
- */
221
- static formatBytes(bytes: number): string;
222
- /**
223
- * Invert the given color according to a theme type to get the inverted text color for background
224
- * @param {string} color Color in the format '#rrggbb' or '#rgb' (or without a hash)
225
- * @param {string} themeType theme type
226
- * @param {string} invert dark theme has light color in control or light theme has light color in control
227
- * @returns {string | undefined}
228
- */
229
- static getInvertedColor(color: string, themeType: string, invert: string): string | undefined;
230
- /**
231
- * Invert the given color
232
- * @param {string} hex Color in the format '#rrggbb' or '#rgb' (or without hash)
233
- * @param {boolean} bw Set to black or white.
234
- * @returns {string}
235
- */
236
- static invertColor(hex: string, bw: boolean): string;
237
- /**
238
- * Convert RGB to array [r, g, b]
239
- * @param {string} hex Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
240
- * @returns {Array<number>} Array with 3 elements [r, g, b]
241
- */
242
- static color2rgb(hex: string): Array<number>;
243
- /**
244
- * Convert RGB to LAB
245
- * @param {Array<number>} rgb color in format [r,g,b]
246
- * @returns {Array<number>} lab color in format [l,a,b]
247
- */
248
- static rgb2lab(rgb: Array<number>): Array<number>;
249
- /**
250
- * Calculate the distance between two colors in LAB color space in the range 0-100^2
251
- * If distance is less than 1000, the colors are similar
252
- * @param {string} color1 Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
253
- * @param {string} color2 Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
254
- * @returns {number} distance in the range 0-100^2
255
- */
256
- static colorDistance(color1: string, color2: string): number;
257
- /**
258
- * @private
259
- * @param {any} mix
260
- * @returns {string}
261
- */
262
- private static _toVal;
263
- /**
264
- * Convert any object to a string with its values.
265
- * @returns {string}
266
- */
267
- static clsx(...args: any[]): string;
268
- /**
269
- * Get the current theme name (either from local storage or the browser settings).
270
- * @param {string} [themeName]
271
- * @returns {string}
272
- */
273
- static getThemeName(themeName?: string): string;
274
- /**
275
- * Get the type of theme.
276
- * @param {string} [themeName]
277
- * @returns {'dark' | 'light'}
278
- */
279
- static getThemeType(themeName?: string): 'dark' | 'light';
280
- /**
281
- * Set the theme name and theme type.
282
- * @param {string} themeName
283
- */
284
- static setThemeName(themeName: string): void;
285
- /**
286
- * Toggle the theme name between 'dark' and 'colored'.
287
- * @param {string | null} themeName
288
- * @returns {string} the new theme name.
289
- */
290
- static toggleTheme(themeName: string | null): string;
291
- /**
292
- * Get the list of themes
293
- * @returns {array<string>} list of possible themes
294
- */
295
- static getThemeNames(): array<string>;
296
- /**
297
- * Parse a query string into its parts.
298
- * @param {string} query
299
- * @returns {Record<string, string | boolean | number>}
300
- */
301
- static parseQuery(query: string): Record<string, string | boolean | number>;
302
- /**
303
- * Returns parent ID.
304
- * @param {string} id
305
- * @returns {string | null} parent ID or null if no parent
306
- */
307
- static getParentId(id: string): string | null;
308
- static formatDate(dateObj: any, dateFormat: any): string;
309
- static formatTime(seconds: any): string;
310
- static MDtext2link(text: any): any;
311
- static openLink(url: any, target: any): void;
312
- static MDgetTitle(text: any): any;
313
- static MDextractHeader(text: any): {
314
- header: {};
315
- body: any;
316
- };
317
- static MDremoveDocsify(text: any): any;
318
- /**
319
- * Generate the json file on the file for download.
320
- * @param {string} filename file name
321
- * @param {Record<string, unknown>} json file data
322
- * @returns {object} json structure (not stringified)
323
- */
324
- static generateFile(filename: string, json: Record<string, unknown>): object;
325
- /**
326
- * Convert quality code into text
327
- * @param {number} quality code
328
- * @returns {array<string>} lines that decode quality
329
- */
330
- static quality2text(quality: number): array<string>;
331
- /**
332
- * Deep copy object
333
- * @param {object} object
334
- * @returns {object}
335
- */
336
- static clone(object: object): object;
337
- /**
338
- * Get states of object
339
- * @param {object} obj
340
- * @returns {object} states as an object in form {"value1": "label1", "value2": "label2"} or null
341
- */
342
- static getStates(obj: object): object;
343
- /**
344
- * Get svg file as text
345
- * @param {string} url URL of SVG file
346
- * @returns {object} Promise with "data:image..."
347
- */
348
- static getSvg(url: string): object;
349
- /**
350
- * Detect file extension by its content
351
- * @param {string} base64 Base64 encoded binary file
352
- * @returns {string} Detected extension, like 'jpg'
353
- */
354
- static detectMimeType(base64: string): string;
355
- /**
356
- * Check if configured repository is the stable repository
357
- *
358
- * @param {string | string[]} activeRepo current configured repository or multi repository
359
- * @return {boolean}
360
- */
361
- static isStableRepository(activeRepo: string | string[]): boolean;
362
- /**
363
- * Check if given string is an integer
364
- *
365
- * @param {string} str string to check
366
- * @return {boolean}
367
- */
368
- static isStringInteger(str: string): boolean;
369
- /**
370
- * Check if the date is valid
371
- *
372
- * @param {Date} date
373
- * @return {boolean}
374
- */
375
- static isValidDate(date: Date): boolean;
376
- static getStyle(theme: any, ...args: any[]): {};
377
- }