@gesslar/toolkit 3.13.0 → 3.14.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 (76) hide show
  1. package/README.md +5 -4
  2. package/package.json +2 -2
  3. package/src/{index.js → node/index.js} +11 -10
  4. package/src/{lib → node/lib}/DirectoryObject.js +47 -56
  5. package/src/{lib → node/lib}/FileObject.js +76 -149
  6. package/src/{lib/FS.js → node/lib/FileSystem.js} +7 -7
  7. package/src/{lib → node/lib}/Glog.js +2 -2
  8. package/src/{lib → node/lib}/Logger.js +1 -1
  9. package/src/{lib → node/lib}/Sass.js +1 -1
  10. package/src/{lib → node/lib}/Tantrum.js +1 -1
  11. package/src/{lib → node/lib}/TempDirectoryObject.js +9 -9
  12. package/src/{lib → node/lib}/Util.js +1 -1
  13. package/src/{lib/CappedDirectoryObject.js → node/lib/VDirectoryObject.js} +37 -92
  14. package/src/node/lib/VFileObject.js +61 -0
  15. package/src/{lib → node/lib}/Valid.js +11 -5
  16. package/src/types/browser/index.d.ts +0 -13
  17. package/src/types/browser/index.d.ts.map +0 -1
  18. package/src/types/browser/lib/Collection.d.ts +0 -248
  19. package/src/types/browser/lib/Collection.d.ts.map +0 -1
  20. package/src/types/browser/lib/Data.d.ts +0 -250
  21. package/src/types/browser/lib/Data.d.ts.map +0 -1
  22. package/src/types/browser/lib/Disposer.d.ts +0 -33
  23. package/src/types/browser/lib/Disposer.d.ts.map +0 -1
  24. package/src/types/browser/lib/HTML.d.ts +0 -40
  25. package/src/types/browser/lib/HTML.d.ts.map +0 -1
  26. package/src/types/browser/lib/Notify.d.ts +0 -60
  27. package/src/types/browser/lib/Notify.d.ts.map +0 -1
  28. package/src/types/browser/lib/Promised.d.ts +0 -119
  29. package/src/types/browser/lib/Promised.d.ts.map +0 -1
  30. package/src/types/browser/lib/Sass.d.ts +0 -63
  31. package/src/types/browser/lib/Sass.d.ts.map +0 -1
  32. package/src/types/browser/lib/Tantrum.d.ts +0 -52
  33. package/src/types/browser/lib/Tantrum.d.ts.map +0 -1
  34. package/src/types/browser/lib/Time.d.ts +0 -42
  35. package/src/types/browser/lib/Time.d.ts.map +0 -1
  36. package/src/types/browser/lib/TypeSpec.d.ts +0 -90
  37. package/src/types/browser/lib/TypeSpec.d.ts.map +0 -1
  38. package/src/types/browser/lib/Util.d.ts +0 -62
  39. package/src/types/browser/lib/Util.d.ts.map +0 -1
  40. package/src/types/browser/lib/Valid.d.ts +0 -33
  41. package/src/types/browser/lib/Valid.d.ts.map +0 -1
  42. package/src/types/browser/lib/vendor/dompurify.esm.d.ts +0 -29
  43. package/src/types/browser/lib/vendor/dompurify.esm.d.ts.map +0 -1
  44. package/src/types/index.d.ts +0 -20
  45. package/src/types/index.d.ts.map +0 -1
  46. package/src/types/lib/Cache.d.ts +0 -27
  47. package/src/types/lib/Cache.d.ts.map +0 -1
  48. package/src/types/lib/CappedDirectoryObject.d.ts +0 -144
  49. package/src/types/lib/CappedDirectoryObject.d.ts.map +0 -1
  50. package/src/types/lib/DirectoryObject.d.ts +0 -277
  51. package/src/types/lib/DirectoryObject.d.ts.map +0 -1
  52. package/src/types/lib/FS.d.ts +0 -188
  53. package/src/types/lib/FS.d.ts.map +0 -1
  54. package/src/types/lib/FileObject.d.ts +0 -238
  55. package/src/types/lib/FileObject.d.ts.map +0 -1
  56. package/src/types/lib/Glog.d.ts +0 -228
  57. package/src/types/lib/Glog.d.ts.map +0 -1
  58. package/src/types/lib/Logger.d.ts +0 -46
  59. package/src/types/lib/Logger.d.ts.map +0 -1
  60. package/src/types/lib/Notify.d.ts +0 -54
  61. package/src/types/lib/Notify.d.ts.map +0 -1
  62. package/src/types/lib/Sass.d.ts +0 -9
  63. package/src/types/lib/Sass.d.ts.map +0 -1
  64. package/src/types/lib/Tantrum.d.ts +0 -9
  65. package/src/types/lib/Tantrum.d.ts.map +0 -1
  66. package/src/types/lib/TempDirectoryObject.d.ts +0 -42
  67. package/src/types/lib/TempDirectoryObject.d.ts.map +0 -1
  68. package/src/types/lib/Term.d.ts +0 -127
  69. package/src/types/lib/Term.d.ts.map +0 -1
  70. package/src/types/lib/Util.d.ts +0 -100
  71. package/src/types/lib/Util.d.ts.map +0 -1
  72. package/src/types/lib/Valid.d.ts +0 -33
  73. package/src/types/lib/Valid.d.ts.map +0 -1
  74. /package/src/{lib → node/lib}/Cache.js +0 -0
  75. /package/src/{lib → node/lib}/Notify.js +0 -0
  76. /package/src/{lib → node/lib}/Term.js +0 -0
@@ -1,250 +0,0 @@
1
- export default class Data {
2
- /**
3
- * Array of JavaScript primitive type names.
4
- * Includes basic types and object categories from the typeof operator.
5
- *
6
- * @type {Array<string>}
7
- */
8
- static primitives: Array<string>;
9
- /**
10
- * Array of JavaScript constructor names for built-in objects.
11
- * Includes common object types and typed arrays.
12
- *
13
- * @type {Array<string>}
14
- */
15
- static constructors: Array<string>;
16
- /**
17
- * Combined array of all supported data types (primitives and constructors in
18
- * lowercase).
19
- *
20
- * Used for type validation throughout the utility functions.
21
- *
22
- * @type {Array<string>}
23
- */
24
- static dataTypes: Array<string>;
25
- /**
26
- * Array of type names that can be checked for emptiness.
27
- * These types have meaningful empty states that can be tested.
28
- *
29
- * @type {Array<string>}
30
- */
31
- static emptyableTypes: Array<string>;
32
- /**
33
- * Appends a string to another string if it does not already end with it.
34
- *
35
- * @param {string} string - The string to append to
36
- * @param {string} append - The string to append
37
- * @returns {string} The appended string
38
- */
39
- static append(string: string, append: string): string;
40
- /**
41
- * Prepends a string to another string if it does not already start with it.
42
- *
43
- * @param {string} string - The string to prepend to
44
- * @param {string} prepend - The string to prepend
45
- * @returns {string} The prepended string
46
- */
47
- static prepend(string: string, prepend: string): string;
48
- /**
49
- * Remove a suffix from the end of a string if present.
50
- *
51
- * @param {string} string - The string to process
52
- * @param {string} toChop - The suffix to remove from the end
53
- * @param {boolean} [caseInsensitive=false] - Whether to perform case-insensitive matching
54
- * @returns {string} The string with suffix removed, or original if suffix not found
55
- * @example
56
- * Data.chopRight("hello.txt", ".txt") // "hello"
57
- * Data.chopRight("Hello", "o") // "Hell"
58
- * Data.chopRight("HELLO", "lo", true) // "HEL"
59
- */
60
- static chopRight(string: string, toChop: string, caseInsensitive?: boolean): string;
61
- /**
62
- * Remove a prefix from the beginning of a string if present.
63
- *
64
- * @param {string} string - The string to process
65
- * @param {string} toChop - The prefix to remove from the beginning
66
- * @param {boolean} [caseInsensitive=false] - Whether to perform case-insensitive matching
67
- * @returns {string} The string with prefix removed, or original if prefix not found
68
- * @example
69
- * Data.chopLeft("hello.txt", "hello") // ".txt"
70
- * Data.chopLeft("Hello", "H") // "ello"
71
- * Data.chopLeft("HELLO", "he", true) // "LLO"
72
- */
73
- static chopLeft(string: string, toChop: string, caseInsensitive?: boolean): string;
74
- /**
75
- * Chop a string after the first occurence of another string.
76
- *
77
- * @param {string} string - The string to search
78
- * @param {string} needle - The bit to chop after
79
- * @param {boolean} caseInsensitive - Whether to search insensitive to case
80
- * @returns {string} The remaining string
81
- */
82
- static chopAfter(string: string, needle: string, caseInsensitive?: boolean): string;
83
- /**
84
- * Chop a string before the first occurrence of another string.
85
- *
86
- * @param {string} string - The string to search
87
- * @param {string} needle - The bit to chop before
88
- * @param {boolean} caseInsensitive - Whether to search insensitive to case
89
- * @returns {string} The remaining string
90
- */
91
- static chopBefore(string: string, needle: string, caseInsensitive?: boolean): string;
92
- /**
93
- * Creates a type spec from a string. A type spec is an array of objects
94
- * defining the type of a value and whether an array is expected.
95
- *
96
- * @param {string} string - The string to parse into a type spec.
97
- * @param {object} options - Additional options for parsing.
98
- * @returns {Array<object>} An array of type specs.
99
- */
100
- static newTypeSpec(string: string, options: object): Array<object>;
101
- /**
102
- * Checks if a value is of a specified type
103
- *
104
- * @param {unknown} value The value to check
105
- * @param {string|TypeSpec} type The type to check for
106
- * @param {object} options Additional options for checking
107
- * @returns {boolean} Whether the value is of the specified type
108
- */
109
- static isType(value: unknown, type: string | TypeSpec, options?: object): boolean;
110
- /**
111
- * Checks if a type is valid
112
- *
113
- * @param {string} type - The type to check
114
- * @returns {boolean} Whether the type is valid
115
- */
116
- static isValidType(type: string): boolean;
117
- /**
118
- * Checks if a value is of a specified type. Unlike the type function, this
119
- * function does not parse the type string, and only checks for primitive
120
- * or constructor types.
121
- *
122
- * @param {unknown} value - The value to check
123
- * @param {string} type - The type to check for
124
- * @returns {boolean} Whether the value is of the specified type
125
- */
126
- static isBaseType(value: unknown, type: string): boolean;
127
- /**
128
- * Returns the type of a value, whether it be a primitive, object, or function.
129
- *
130
- * @param {unknown} value - The value to check
131
- * @returns {string} The type of the value
132
- */
133
- static typeOf(value: unknown): string;
134
- /**
135
- * Checks a value is undefined or null.
136
- *
137
- * @param {unknown} value The value to check
138
- * @returns {boolean} Whether the value is undefined or null
139
- */
140
- static isNothing(value: unknown): boolean;
141
- /**
142
- * Checks if a value is empty. This function is used to check if an object,
143
- * array, or string is empty. Null and undefined values are considered empty.
144
- *
145
- * @param {unknown} value The value to check
146
- * @param {boolean} checkForNothing Whether to check for null or undefined
147
- * values
148
- * @returns {boolean} Whether the value is empty
149
- */
150
- static isEmpty(value: unknown, checkForNothing?: boolean): boolean;
151
- /**
152
- * Freezes an object and all of its properties recursively.
153
- *
154
- * @param {object} obj The object to freeze.
155
- * @returns {object} The frozen object.
156
- */
157
- static deepFreezeObject(obj: object): object;
158
- /**
159
- * Ensures that a nested path of objects exists within the given object.
160
- * Creates empty objects along the path if they don't exist.
161
- *
162
- * @param {object} obj - The object to check/modify
163
- * @param {Array<string>} keys - Array of keys representing the path to ensure
164
- * @returns {object} Reference to the deepest nested object in the path
165
- */
166
- static assureObjectPath(obj: object, keys: Array<string>): object;
167
- /**
168
- * Sets a value in a nested object structure using an array of keys; creating
169
- * the structure if it does not exist.
170
- *
171
- * @param {object} obj - The target object to set the value in
172
- * @param {Array<string>} keys - Array of keys representing the path to the target property
173
- * @param {unknown} value - The value to set at the target location
174
- */
175
- static setNestedValue(obj: object, keys: Array<string>, value: unknown): void;
176
- /**
177
- * Deeply merges two or more objects. Arrays are replaced, not merged.
178
- *
179
- * @param {...object} sources - Objects to merge (left to right)
180
- * @returns {object} The merged object
181
- */
182
- static mergeObject(...sources: object[]): object;
183
- /**
184
- * Filters an array asynchronously using a predicate function.
185
- * Applies the predicate to all items in parallel and returns filtered results.
186
- *
187
- * @param {Array<unknown>} arr - The array to filter
188
- * @param {(value: unknown) => Promise<boolean>} predicate - Async predicate function that returns a promise resolving to boolean
189
- * @returns {Promise<Array<unknown>>} Promise resolving to the filtered array
190
- */
191
- static asyncFilter(arr: Array<unknown>, predicate: (value: unknown) => Promise<boolean>): Promise<Array<unknown>>;
192
- /**
193
- * Ensures a value is within a specified range.
194
- *
195
- * @param {number} val - The value to check.
196
- * @param {number} min - The minimum value.
197
- * @param {number} max - The maximum value.
198
- * @returns {number} The value, constrained within the range of `min` to `max`.
199
- */
200
- static clamp(val: number, min: number, max: number): number;
201
- /**
202
- * Checks if a value is within a specified range (inclusive).
203
- *
204
- * @param {number} val - The value to check.
205
- * @param {number} min - The minimum value (inclusive).
206
- * @param {number} max - The maximum value (inclusive).
207
- * @returns {boolean} True if the value is within the range, false otherwise.
208
- */
209
- static clamped(val: number, min: number, max: number): boolean;
210
- /**
211
- * Checks if a value is a plain object - created with object literals {},
212
- * new Object(), or Object.create(null).
213
- *
214
- * Distinguishes plain objects from objects created by custom constructors, built-ins,
215
- * or primitives. Plain objects only have Object.prototype or null in their prototype chain.
216
- *
217
- * @param {unknown} value - The value to check
218
- * @returns {boolean} True if the value is a plain object, false otherwise
219
- *
220
- * @example
221
- * isPlainObject({}) // true
222
- * isPlainObject(new Object()) // true
223
- * isPlainObject(Object.create(null)) // true
224
- * isPlainObject([]) // false
225
- * isPlainObject(new Date()) // false
226
- * isPlainObject(null) // false
227
- * isPlainObject("string") // false
228
- * isPlainObject(class Person{}) // false
229
- */
230
- static isPlainObject(value: unknown): boolean;
231
- /**
232
- * Checks if a value is binary data.
233
- * Returns true for ArrayBuffer, TypedArrays (Uint8Array, Int16Array, etc.),
234
- * Blob, and Node Buffer instances.
235
- *
236
- * @param {unknown} value - The value to check
237
- * @returns {boolean} True if the value is binary data, false otherwise
238
- * @example
239
- * Data.isBinary(new Uint8Array([1, 2, 3])) // true
240
- * Data.isBinary(new ArrayBuffer(10)) // true
241
- * Data.isBinary(Buffer.from('hello')) // true
242
- * Data.isBinary(new Blob(['text'])) // true
243
- * Data.isBinary('string') // false
244
- * Data.isBinary({}) // false
245
- * Data.isBinary(undefined) // false
246
- */
247
- static isBinary(value: unknown): boolean;
248
- }
249
- import TypeSpec from "./TypeSpec.js";
250
- //# sourceMappingURL=Data.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Data.d.ts","sourceRoot":"","sources":["../../../browser/lib/Data.js"],"names":[],"mappings":"AAUA;IACA;;;;;OAKG;IACD,mBAFQ,KAAK,CAAC,MAAM,CAAC,CAgBnB;IAEF;;;;;OAKG;IACH,qBAFU,KAAK,CAAC,MAAM,CAAC,CAmBrB;IAEF;;;;;;;OAOG;IACH,kBAFU,KAAK,CAAC,MAAM,CAAC,CAKrB;IAEF;;;;;OAKG;IACH,uBAFU,KAAK,CAAC,MAAM,CAAC,CAE2D;IAElF;;;;;;OAMG;IACH,sBAJW,MAAM,UACN,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;;OAMG;IACH,uBAJW,MAAM,WACN,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;;;;;;;OAWG;IACH,yBATW,MAAM,UACN,MAAM,oBACN,OAAO,GACL,MAAM,CAWlB;IAED;;;;;;;;;;;OAWG;IACH,wBATW,MAAM,UACN,MAAM,oBACN,OAAO,GACL,MAAM,CAWlB;IAED;;;;;;;OAOG;IACH,yBALW,MAAM,UACN,MAAM,oBACN,OAAO,GACL,MAAM,CAWlB;IAED;;;;;;;OAOG;IACH,0BALW,MAAM,UACN,MAAM,oBACN,OAAO,GACL,MAAM,CAYlB;IAED;;;;;;;OAOG;IACH,2BAJW,MAAM,WACN,MAAM,GACJ,KAAK,CAAC,MAAM,CAAC,CAIzB;IAED;;;;;;;OAOG;IACH,qBALW,OAAO,QACP,MAAM,GAAC,QAAQ,YACf,MAAM,GACJ,OAAO,CAQnB;IAED;;;;;OAKG;IACH,yBAHW,MAAM,GACJ,OAAO,CASnB;IAED;;;;;;;;OAQG;IACH,yBAJW,OAAO,QACP,MAAM,GACJ,OAAO,CAwBnB;IAED;;;;;OAKG;IACH,qBAHW,OAAO,GACL,MAAM,CAclB;IAED;;;;;OAKG;IACH,wBAHW,OAAO,GACL,OAAO,CAInB;IAED;;;;;;;;OAQG;IACH,sBALW,OAAO,oBACP,OAAO,GAEL,OAAO,CA8BnB;IAED;;;;;OAKG;IACH,6BAHW,MAAM,GACJ,MAAM,CAmBlB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,QACN,KAAK,CAAC,MAAM,CAAC,GACX,MAAM,CAiBlB;IAED;;;;;;;OAOG;IACH,2BAJW,MAAM,QACN,KAAK,CAAC,MAAM,CAAC,SACb,OAAO,QAMjB;IAED;;;;;OAKG;IACH,+BAHc,MAAM,EAAA,GACP,MAAM,CAqBlB;IAED;;;;;;;OAOG;IACH,wBAJW,KAAK,CAAC,OAAO,CAAC,aACd,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAClC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAMnC;IAED;;;;;;;OAOG;IACH,kBALW,MAAM,OACN,MAAM,OACN,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,oBALW,MAAM,OACN,MAAM,OACN,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,4BAbW,OAAO,GACL,OAAO,CA+BnB;IAED;;;;;;;;;;;;;;;OAeG;IACH,uBAXW,OAAO,GACL,OAAO,CAgBnB;CACF;qBAhgBoB,eAAe"}
@@ -1,33 +0,0 @@
1
- /**
2
- * Simple lifecycle helper that tracks disposer callbacks.
3
- * Register any teardown functions and call dispose() to run them in reverse.
4
- */
5
- export class Disposer {
6
- /**
7
- * Registers a disposer callback to be executed when disposed.
8
- *
9
- * Accepts one or more callbacks (or a single array) and returns matching
10
- * unregisters. A single disposer returns a single unregister for
11
- * convenience.
12
- *
13
- * @param {...(() => void)|Array<() => void>} disposers - Cleanup callbacks.
14
- * @returns {(() => void)|Array<() => void>} Unregister function(s).
15
- */
16
- register(...disposers: ((() => void) | Array<() => void>)[]): (() => void) | Array<() => void>;
17
- /**
18
- * Runs all registered disposers in reverse order.
19
- *
20
- * @returns {void}
21
- */
22
- dispose(): void;
23
- /**
24
- * Read-only list of registered disposers.
25
- *
26
- * @returns {Array<() => void>} Snapshot of disposer callbacks.
27
- */
28
- get disposers(): Array<() => void>;
29
- #private;
30
- }
31
- declare const _default: Disposer;
32
- export default _default;
33
- //# sourceMappingURL=Disposer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Disposer.d.ts","sourceRoot":"","sources":["../../../browser/lib/Disposer.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH;IAGE;;;;;;;;;OASG;IACH,uBAHW,CAAG,CAAC,MAAM,IAAI,CAAC,GAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GAAA,GAC/B,CAAC,MAAM,IAAI,CAAC,GAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAS1C;IAWD;;;;OAIG;IACH,WAFa,IAAI,CAehB;IAcD;;;;OAIG;IACH,iBAFa,KAAK,CAAC,MAAM,IAAI,CAAC,CAI7B;;CAQF"}
@@ -1,40 +0,0 @@
1
- export class HTML {
2
- /**
3
- * Lightweight HTML helper utilities for browser contexts.
4
- *
5
- * @param {object|(() => unknown)} domPurify - Optional DOMPurify instance or factory.
6
- */
7
- constructor(domPurify?: object | (() => unknown));
8
- /**
9
- * Fetches an HTML fragment and returns the contents inside the <body> tag when present.
10
- *
11
- * @param {string} url - Location of the HTML resource to load.
12
- * @param {boolean} filterBodyContent - If true, returns only content found between the <body> tags. Defaults to false.
13
- * @returns {Promise<string>} Sanitized HTML string or empty string on missing content.
14
- */
15
- loadHTML(url: string, filterBodyContent?: boolean): Promise<string>;
16
- /**
17
- * Sanitizes arbitrary HTML using DOMPurify.
18
- *
19
- * @param {string} text - HTML string to sanitize. Defaults to "".
20
- * @returns {string} Sanitized HTML.
21
- */
22
- sanitise(text?: string): string;
23
- /**
24
- * Sanitizes an HTML string and replaces the element's children with the result.
25
- *
26
- * @param {Element} element - Target element to replace content within.
27
- * @param {string} htmlString - HTML string to sanitize and insert.
28
- */
29
- setHTMLContent(element: Element, htmlString: string): void;
30
- /**
31
- * Removes all child nodes from the given element.
32
- *
33
- * @param {Element} element - Element to clear.
34
- */
35
- clearHTMLContent(element: Element): void;
36
- #private;
37
- }
38
- declare const _default: HTML;
39
- export default _default;
40
- //# sourceMappingURL=HTML.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HTML.d.ts","sourceRoot":"","sources":["../../../browser/lib/HTML.js"],"names":[],"mappings":"AAGA;IAGE;;;;OAIG;IACH,wBAFW,MAAM,GAAC,CAAC,MAAM,OAAO,CAAC,EAIhC;IAED;;;;;;OAMG;IACH,cAJW,MAAM,sBACN,OAAO,GACL,OAAO,CAAC,MAAM,CAAC,CAmB3B;IAED;;;;;OAKG;IACH,gBAHW,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;OAKG;IACH,wBAHW,OAAO,cACP,MAAM,QA+BhB;IAED;;;;OAIG;IACH,0BAFW,OAAO,QAmBjB;;CAwBF"}
@@ -1,60 +0,0 @@
1
- declare const _default: {
2
- /** @type {string} Display name for debugging. */
3
- name: string;
4
- /**
5
- * Emits a CustomEvent without expecting a return value.
6
- *
7
- * @param {string} type - Event name to dispatch.
8
- * @param {unknown} [payload] - Value assigned to `event.detail`.
9
- * @param {boolean | NotifyEventOptions} [options] - CustomEvent options or boolean to set `bubbles`.
10
- * @returns {void}
11
- */
12
- emit(type: string, payload?: unknown, options?: boolean | NotifyEventOptions): void;
13
- /**
14
- * Emits a CustomEvent and returns the detail for simple request/response flows.
15
- *
16
- * @param {string} type - Event name to dispatch.
17
- * @param {unknown} [payload] - Value assigned to `event.detail`.
18
- * @param {boolean | NotifyEventOptions} [options] - CustomEvent options or boolean to set `bubbles`.
19
- * @returns {unknown} The detail placed on the CustomEvent.
20
- */
21
- request(type: string, payload?: unknown, options?: boolean | NotifyEventOptions): unknown;
22
- /**
23
- * Registers a listener for the given event type on an HTMLElement (or
24
- * window, if not specified).
25
- *
26
- * @param {string} type - Event name to listen for.
27
- * @param {(evt: Notify) => void} handler - Listener callback.
28
- * @param {HTMLElement | Window} [element] - The object to which to attach the handler. Default is window.
29
- * @param {boolean | object} [options] - Options to pass to addEventListener.
30
- * @returns {() => void} Dispose function to unregister the handler.
31
- */
32
- on(type: string, handler: (evt: /*elided*/ any) => void, element?: HTMLElement | Window, options?: boolean | object): () => void;
33
- /**
34
- * Removes a previously registered listener for the given event type.
35
- *
36
- * @param {string} type - Event name to remove.
37
- * @param {(evt: Notify) => void} handler - Listener callback to detach.
38
- * @param {HTMLElement | Window} [element] - The object from which to remove the handler. Default is window.
39
- * @param {boolean | object} [options] - Options to pass to removeEventListener.
40
- * @returns {void}
41
- */
42
- off(type: string, handler: (evt: /*elided*/ any) => void, element?: HTMLElement | Window, options?: boolean | object): void;
43
- "__#private@#buildEventInit"(detail: any, options: any): any;
44
- };
45
- export default _default;
46
- export type NotifyEventOptions = {
47
- /**
48
- * - Whether the event bubbles up the DOM tree.
49
- */
50
- bubbles?: boolean;
51
- /**
52
- * - Whether the event can be canceled.
53
- */
54
- cancelable?: boolean;
55
- /**
56
- * - Whether the event can cross the shadow DOM boundary.
57
- */
58
- composed?: boolean;
59
- };
60
- //# sourceMappingURL=Notify.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Notify.d.ts","sourceRoot":"","sources":["../../../browser/lib/Notify.js"],"names":[],"mappings":";IAaE,iDAAiD;UAAtC,MAAM;IAGjB;;;;;;;OAOG;eAJQ,MAAM,YACN,OAAO,YACP,OAAO,GAAG,kBAAkB,GAC1B,IAAI;IAOjB;;;;;;;OAOG;kBAJQ,MAAM,YACN,OAAO,YACP,OAAO,GAAG,kBAAkB,GAC1B,OAAO;IASpB;;;;;;;;;OASG;aALQ,MAAM,WACN,CAAC,GAAG,gBAAQ,KAAK,IAAI,YACrB,WAAW,GAAG,MAAM,YACpB,OAAO,GAAG,MAAM,GACd,MAAM,IAAI;IAcvB;;;;;;;;OAQG;cALQ,MAAM,WACN,CAAC,GAAG,gBAAQ,KAAK,IAAI,YACrB,WAAW,GAAG,MAAM,YACpB,OAAO,GAAG,MAAM,GACd,IAAI;;;;;;;;cAjEL,OAAO;;;;iBACP,OAAO;;;;eACP,OAAO"}
@@ -1,119 +0,0 @@
1
- /**
2
- * Utility class providing helper functions for working with Promises,
3
- * including settling, filtering, and extracting values from promise results.
4
- */
5
- export default class Promised {
6
- /**
7
- * Asynchronously awaits all promises in parallel.
8
- * Wrapper around Promise.all for consistency with other utility methods.
9
- *
10
- * @param {Array<Promise<unknown>>} promises - Array of promises to await
11
- * @returns {Promise<Array<unknown>>} Results of all promises
12
- */
13
- static await(promises: Array<Promise<unknown>>): Promise<Array<unknown>>;
14
- /**
15
- * Settles all promises (both fulfilled and rejected) in parallel.
16
- * Wrapper around Promise.allSettled for consistency with other utility methods.
17
- *
18
- * @param {Array<Promise<unknown>>} promises - Array of promises to settle
19
- * @returns {Promise<Array<{status: 'fulfilled'|'rejected', value?: unknown, reason?: unknown}>>} Results of all settled promises with status and value/reason
20
- */
21
- static settle(promises: Array<Promise<unknown>>): Promise<Array<{
22
- status: "fulfilled" | "rejected";
23
- value?: unknown;
24
- reason?: unknown;
25
- }>>;
26
- /**
27
- * Checks if any result in the settled promise array is rejected.
28
- *
29
- * @param {Array<{status: 'fulfilled'|'rejected', value?: unknown, reason?: unknown}>} settled - Array of settled promise results
30
- * @returns {boolean} True if any result is rejected, false otherwise
31
- */
32
- static hasRejected(settled: Array<{
33
- status: "fulfilled" | "rejected";
34
- value?: unknown;
35
- reason?: unknown;
36
- }>): boolean;
37
- /**
38
- * Checks if any result in the settled promise array is fulfilled.
39
- *
40
- * @param {Array<{status: 'fulfilled'|'rejected', value?: unknown, reason?: unknown}>} settled - Array of settled promise results
41
- * @returns {boolean} True if any result is fulfilled, false otherwise
42
- */
43
- static hasFulfilled(settled: Array<{
44
- status: "fulfilled" | "rejected";
45
- value?: unknown;
46
- reason?: unknown;
47
- }>): boolean;
48
- /**
49
- * Filters and returns all rejected results from a settled promise array.
50
- *
51
- * @param {Array<{status: 'fulfilled'|'rejected', value?: unknown, reason?: unknown}>} settled - Array of settled promise results
52
- * @returns {Array<{status: 'rejected', reason: unknown}>} Array of rejected results
53
- */
54
- static rejected(settled: Array<{
55
- status: "fulfilled" | "rejected";
56
- value?: unknown;
57
- reason?: unknown;
58
- }>): Array<{
59
- status: "rejected";
60
- reason: unknown;
61
- }>;
62
- /**
63
- * Filters and returns all fulfilled results from a settled promise array.
64
- *
65
- * @param {Array<{status: 'fulfilled'|'rejected', value?: unknown, reason?: unknown}>} result - Array of settled promise results
66
- * @returns {Array<{status: 'fulfilled', value: unknown}>} Array of fulfilled results
67
- */
68
- static fulfilled(result: Array<{
69
- status: "fulfilled" | "rejected";
70
- value?: unknown;
71
- reason?: unknown;
72
- }>): Array<{
73
- status: "fulfilled";
74
- value: unknown;
75
- }>;
76
- /**
77
- * Extracts the rejection reasons from a settled promise array.
78
- *
79
- * @param {Array<{status: 'fulfilled'|'rejected', value?: unknown, reason?: unknown}>} settled - Array of settled promise results
80
- * @returns {Array<unknown>} Array of rejection reasons
81
- */
82
- static reasons(settled: Array<{
83
- status: "fulfilled" | "rejected";
84
- value?: unknown;
85
- reason?: unknown;
86
- }>): Array<unknown>;
87
- /**
88
- * Extracts the values from fulfilled results in a settled promise array.
89
- *
90
- * @param {Array<{status: 'fulfilled'|'rejected', value?: unknown, reason?: unknown}>} settled - Array of settled promise results
91
- * @returns {Array<unknown>} Array of fulfilled values
92
- */
93
- static values(settled: Array<{
94
- status: "fulfilled" | "rejected";
95
- value?: unknown;
96
- reason?: unknown;
97
- }>): Array<unknown>;
98
- /**
99
- * Throws a Tantrum containing all rejection reasons from settled promises.
100
- *
101
- * @param {string} message - Error message. Defaults to "GIGO"
102
- * @param {Array<{status: 'fulfilled'|'rejected', value?: unknown, reason?: unknown}>} settled - Array of settled promise results
103
- * @throws {Tantrum} Throws a Tantrum error with rejection reasons
104
- */
105
- static throw(message: string, settled: Array<{
106
- status: "fulfilled" | "rejected";
107
- value?: unknown;
108
- reason?: unknown;
109
- }>): void;
110
- /**
111
- * Returns the first promise to resolve or reject from an array of promises.
112
- * Wrapper around Promise.race for consistency with other utility methods.
113
- *
114
- * @param {Array<Promise<unknown>>} promises - Array of promises to race
115
- * @returns {Promise<unknown>} Result of the first settled promise
116
- */
117
- static race(promises: Array<Promise<unknown>>): Promise<unknown>;
118
- }
119
- //# sourceMappingURL=Promised.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Promised.d.ts","sourceRoot":"","sources":["../../../browser/lib/Promised.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH;IACE;;;;;;OAMG;IACH,uBAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACrB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAInC;IAED;;;;;;OAMG;IACH,wBAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACrB,OAAO,CAAC,KAAK,CAAC;QAAC,MAAM,EAAE,WAAW,GAAC,UAAU,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC,CAAC,CAI/F;IAED;;;;;OAKG;IACH,4BAHW,KAAK,CAAC;QAAC,MAAM,EAAE,WAAW,GAAC,UAAU,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC,GACxE,OAAO,CAInB;IAED;;;;;OAKG;IACH,6BAHW,KAAK,CAAC;QAAC,MAAM,EAAE,WAAW,GAAC,UAAU,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC,GACxE,OAAO,CAInB;IAED;;;;;OAKG;IACH,yBAHW,KAAK,CAAC;QAAC,MAAM,EAAE,WAAW,GAAC,UAAU,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC,GACxE,KAAK,CAAC;QAAC,MAAM,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAC,CAAC,CAIxD;IAED;;;;;OAKG;IACH,yBAHW,KAAK,CAAC;QAAC,MAAM,EAAE,WAAW,GAAC,UAAU,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC,GACxE,KAAK,CAAC;QAAC,MAAM,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAC,CAAC,CAIxD;IAED;;;;;OAKG;IACH,wBAHW,KAAK,CAAC;QAAC,MAAM,EAAE,WAAW,GAAC,UAAU,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC,GACxE,KAAK,CAAC,OAAO,CAAC,CAO1B;IAED;;;;;OAKG;IACH,uBAHW,KAAK,CAAC;QAAC,MAAM,EAAE,WAAW,GAAC,UAAU,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC,GACxE,KAAK,CAAC,OAAO,CAAC,CAO1B;IAED;;;;;;OAMG;IACH,sBAJW,MAAM,WACN,KAAK,CAAC;QAAC,MAAM,EAAE,WAAW,GAAC,UAAU,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC,QAQpF;IAED;;;;;;OAMG;IACH,sBAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACrB,OAAO,CAAC,OAAO,CAAC,CAI5B;CACF"}
@@ -1,63 +0,0 @@
1
- /**
2
- * Custom error class for toolkit errors.
3
- * Provides error chaining, trace management, and formatted error reporting.
4
- */
5
- export default class Sass extends Error {
6
- /**
7
- * Creates an Sass from an existing Error object with additional
8
- * trace message.
9
- *
10
- * @param {Error} error - The original error object
11
- * @param {string} message - Additional trace message to add
12
- * @returns {Sass} New Sass instance with trace from the original error
13
- * @throws {Sass} If the first parameter is not an Error instance
14
- */
15
- static from(error: Error, message: string): Sass;
16
- /**
17
- * Factory method to create or enhance Sass instances.
18
- * If error parameter is provided, enhances existing Sass or wraps
19
- * other errors. Otherwise creates a new Sass instance.
20
- *
21
- * @param {string} message - The error message
22
- * @param {Error|Sass|Tantrum} [error] - Optional existing error to wrap or enhance
23
- * @returns {Sass} New or enhanced Sass instance
24
- */
25
- static "new"(message: string, error?: Error | Sass | Tantrum): Sass;
26
- /**
27
- * Creates a new Sass instance.
28
- *
29
- * @param {string} message - The error message
30
- * @param {...unknown} [arg] - Additional arguments passed to parent Error constructor
31
- */
32
- constructor(message: string, ...arg?: unknown[]);
33
- /**
34
- * Adds a message to the beginning of the trace array.
35
- *
36
- * @param {string} message - The trace message to add
37
- */
38
- set trace(message: string);
39
- /**
40
- * Gets the error trace array.
41
- *
42
- * @returns {Array<string>} Array of trace messages
43
- */
44
- get trace(): Array<string>;
45
- /**
46
- * Adds a trace message and returns this instance for chaining.
47
- *
48
- * @param {string} message - The trace message to add
49
- * @returns {this} This Sass instance for method chaining
50
- */
51
- addTrace(message: string): this;
52
- /**
53
- * Reports the error to the console with formatted output.
54
- * Optionally includes detailed stack trace information.
55
- *
56
- * @param {boolean} [nerdMode] - Whether to include detailed stack trace
57
- * @param {boolean} [isNested] - Whether this is a nested error report
58
- */
59
- report(nerdMode?: boolean, isNested?: boolean): void;
60
- #private;
61
- }
62
- import Tantrum from "./Tantrum.js";
63
- //# sourceMappingURL=Sass.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sass.d.ts","sourceRoot":"","sources":["../../../browser/lib/Sass.js"],"names":[],"mappings":"AAeA;;;GAGG;AACH;IAgIE;;;;;;;;OAQG;IACH,mBALW,KAAK,WACL,MAAM,GACJ,IAAI,CAahB;IAED;;;;;;;;OAQG;IACH,sBAJW,MAAM,UACN,KAAK,GAAC,IAAI,GAAC,OAAO,GAChB,IAAI,CAchB;IAvKD;;;;;OAKG;IACH,qBAHW,MAAM,WACH,OAAO,EAAA,EAMpB;IAWD;;;;OAIG;IACH,mBAFW,MAAM,EAIhB;IAhBD;;;;OAIG;IACH,aAFa,KAAK,CAAC,MAAM,CAAC,CAIzB;IAWD;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,IAAI,CAShB;IAED;;;;;;OAMG;IACH,kBAHW,OAAO,aACP,OAAO,QAyCjB;;CA6EF;oBAjLmB,cAAc"}
@@ -1,52 +0,0 @@
1
- /**
2
- * Custom aggregate error class that extends AggregateError.
3
- * Automatically wraps plain errors in Sass instances for consistent reporting.
4
- */
5
- export default class Tantrum extends AggregateError {
6
- /**
7
- * Factory method to create a Tantrum instance.
8
- *
9
- * @param {string} message - The aggregate error message
10
- * @param {Array<Error|Sass>} errors - Array of errors to aggregate
11
- * @returns {Tantrum} New Tantrum instance
12
- */
13
- static "new"(message: string, errors?: Array<Error | Sass>): Tantrum;
14
- /**
15
- * Creates a new Tantrum instance.
16
- *
17
- * @param {string} message - The aggregate error message
18
- * @param {Array<Error|Sass>} errors - Array of errors to aggregate
19
- * @param {Sass} sass - Sass constructor
20
- */
21
- constructor(message: string, errors?: Array<Error | Sass>, sass?: Sass);
22
- /**
23
- * Adds a trace message and returns this instance for chaining.
24
- *
25
- * @param {string} message - The trace message to add
26
- * @param {Error|Sass} [_error] - Optional error (currently unused, reserved for future use)
27
- * @returns {this} This Tantrum instance for method chaining
28
- */
29
- addTrace(message: string, _error?: Error | Sass): this;
30
- /**
31
- * Adds a message to the beginning of the trace array.
32
- *
33
- * @param {string} message - The trace message to add
34
- */
35
- set trace(message: string);
36
- /**
37
- * Gets the error trace array.
38
- *
39
- * @returns {Array<string>} Array of trace messages
40
- */
41
- get trace(): Array<string>;
42
- /**
43
- * Reports all aggregated errors to the console with formatted output.
44
- *
45
- * @param {boolean} [nerdMode] - Whether to include detailed stack traces
46
- * @param {boolean} [isNested] - Whether this is a nested error report
47
- */
48
- report(nerdMode?: boolean, isNested?: boolean): void;
49
- #private;
50
- }
51
- import Sass from "./Sass.js";
52
- //# sourceMappingURL=Tantrum.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tantrum.d.ts","sourceRoot":"","sources":["../../../browser/lib/Tantrum.js"],"names":[],"mappings":"AAaA;;;GAGG;AACH;IAwFE;;;;;;OAMG;IACH,sBAJW,MAAM,WACN,KAAK,CAAC,KAAK,GAAC,IAAI,CAAC,GACf,OAAO,CAOnB;IAhGD;;;;;;OAMG;IACH,qBAJW,MAAM,WACN,KAAK,CAAC,KAAK,GAAC,IAAI,CAAC,SACjB,IAAI,EAkBd;IAED;;;;;;OAMG;IACH,kBAJW,MAAM,WACN,KAAK,GAAC,IAAI,GACR,IAAI,CAShB;IAWD;;;;OAIG;IACH,mBAFW,MAAM,EAIhB;IAhBD;;;;OAIG;IACH,aAFa,KAAK,CAAC,MAAM,CAAC,CAIzB;IAWD;;;;;OAKG;IACH,kBAHW,OAAO,aACP,OAAO,QAmBjB;;CAeF;iBA3GgB,WAAW"}