@gesslar/toolkit 1.0.2 → 1.0.4
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/package.json +1 -1
- package/src/browser/index.js +1 -0
- package/src/browser/lib/HTML.js +137 -0
- package/src/browser/lib/vendor/dompurify.esm.js +1515 -0
- package/src/lib/Contract.js +2 -2
- package/src/types/browser/index.d.ts +1 -0
- package/src/types/browser/lib/HTML.d.ts +38 -0
- package/src/types/browser/lib/HTML.d.ts.map +1 -0
- package/src/types/browser/lib/vendor/dompurify.esm.d.ts +29 -0
- package/src/types/browser/lib/vendor/dompurify.esm.d.ts.map +1 -0
- package/src/types/lib/Contract.d.ts +4 -4
- package/src/types/lib/Contract.d.ts.map +1 -1
package/src/lib/Contract.js
CHANGED
|
@@ -230,7 +230,7 @@ export default class Contract {
|
|
|
230
230
|
/**
|
|
231
231
|
* Get the provider terms (if any)
|
|
232
232
|
*
|
|
233
|
-
* @returns {Terms|null} Provider terms
|
|
233
|
+
* @returns {import("./Terms.js").default|null} Provider terms
|
|
234
234
|
*/
|
|
235
235
|
get providerTerms() {
|
|
236
236
|
return this.#providerTerms
|
|
@@ -239,7 +239,7 @@ export default class Contract {
|
|
|
239
239
|
/**
|
|
240
240
|
* Get the consumer terms (if any)
|
|
241
241
|
*
|
|
242
|
-
* @returns {Terms|null} Consumer terms
|
|
242
|
+
* @returns {import("./Terms.js").default|null} Consumer terms
|
|
243
243
|
*/
|
|
244
244
|
get consumerTerms() {
|
|
245
245
|
return this.#consumerTerms
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as Collection } from "./lib/Collection.js";
|
|
2
2
|
export { default as Data } from "./lib/Data.js";
|
|
3
|
+
export { default as HTML } from "./lib/HTML.js";
|
|
3
4
|
export { default as Sass } from "./lib/Sass.js";
|
|
4
5
|
export { default as Tantrum } from "./lib/Tantrum.js";
|
|
5
6
|
export { default as Type } from "./lib/TypeSpec.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default 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
|
+
//# sourceMappingURL=HTML.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { purify as default };
|
|
2
|
+
declare function purify(root: any): {
|
|
3
|
+
(root: any): /*elided*/ any;
|
|
4
|
+
version: string;
|
|
5
|
+
removed: any[];
|
|
6
|
+
isSupported: boolean;
|
|
7
|
+
sanitize(dirty: any, ...args: any[]): any;
|
|
8
|
+
setConfig(...args: any[]): void;
|
|
9
|
+
clearConfig(): void;
|
|
10
|
+
isValidAttribute(tag: any, attr: any, value: any): boolean;
|
|
11
|
+
addHook(entryPoint: any, hookFunction: any): void;
|
|
12
|
+
removeHook(entryPoint: any, hookFunction: any): any;
|
|
13
|
+
removeHooks(entryPoint: any): void;
|
|
14
|
+
removeAllHooks(): void;
|
|
15
|
+
};
|
|
16
|
+
declare namespace purify {
|
|
17
|
+
let version: string;
|
|
18
|
+
let removed: any[];
|
|
19
|
+
let isSupported: boolean;
|
|
20
|
+
function sanitize(dirty: any, ...args: any[]): any;
|
|
21
|
+
function setConfig(...args: any[]): void;
|
|
22
|
+
function clearConfig(): void;
|
|
23
|
+
function isValidAttribute(tag: any, attr: any, value: any): boolean;
|
|
24
|
+
function addHook(entryPoint: any, hookFunction: any): void;
|
|
25
|
+
function removeHook(entryPoint: any, hookFunction: any): any;
|
|
26
|
+
function removeHooks(entryPoint: any): void;
|
|
27
|
+
function removeAllHooks(): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=dompurify.esm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dompurify.esm.d.ts","sourceRoot":"","sources":["../../../../browser/lib/vendor/dompurify.esm.js"],"names":[],"mappings":";AA0UE;;;;;;;;;;;;;EAA+C;;;;;IA+9B/C,mDAiJC;IACD,yCAIC;IACD,6BAGC;IACD,oEAUC;IACD,2DAMC;IACD,6DAQC;IACD,4CAEC;IACD,gCAEC"}
|
|
@@ -51,15 +51,15 @@ export default class Contract {
|
|
|
51
51
|
/**
|
|
52
52
|
* Get the provider terms (if any)
|
|
53
53
|
*
|
|
54
|
-
* @returns {Terms|null} Provider terms
|
|
54
|
+
* @returns {import("./Terms.js").default|null} Provider terms
|
|
55
55
|
*/
|
|
56
|
-
get providerTerms(): Terms | null;
|
|
56
|
+
get providerTerms(): import("./Terms.js").default | null;
|
|
57
57
|
/**
|
|
58
58
|
* Get the consumer terms (if any)
|
|
59
59
|
*
|
|
60
|
-
* @returns {Terms|null} Consumer terms
|
|
60
|
+
* @returns {import("./Terms.js").default|null} Consumer terms
|
|
61
61
|
*/
|
|
62
|
-
get consumerTerms(): Terms | null;
|
|
62
|
+
get consumerTerms(): import("./Terms.js").default | null;
|
|
63
63
|
/**
|
|
64
64
|
* Get the contract validator
|
|
65
65
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contract.d.ts","sourceRoot":"","sources":["../../lib/Contract.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH;IAwBE;;;;;;;OAOG;IACH,oDAgBC;IAED;;;;;;;;OAQG;IACH,uBANW,MAAM,mBACN,MAAM,cACN,OAAO,KAAK,EAAE,gBAAgB,GAAC,IAAI,gBAEjC,QAAQ,CAsBpB;IAxED;;;;;;;OAOG;IACH,2BALW,OAAO,YAAY,EAAE,KAAK,iBAC1B,OAAO,YAAY,EAAE,KAAK,cAElC;QAAsD,KAAK,GAAnD,GAAmC;KAC7C,EAQA;IA6FD;;;;;;OAMG;IACH,eAJW,MAAM,GACJ,OAAO,CAsBnB;IAsED;;;;OAIG;IACH,oBAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,qBAFa,
|
|
1
|
+
{"version":3,"file":"Contract.d.ts","sourceRoot":"","sources":["../../lib/Contract.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH;IAwBE;;;;;;;OAOG;IACH,oDAgBC;IAED;;;;;;;;OAQG;IACH,uBANW,MAAM,mBACN,MAAM,cACN,OAAO,KAAK,EAAE,gBAAgB,GAAC,IAAI,gBAEjC,QAAQ,CAsBpB;IAxED;;;;;;;OAOG;IACH,2BALW,OAAO,YAAY,EAAE,KAAK,iBAC1B,OAAO,YAAY,EAAE,KAAK,cAElC;QAAsD,KAAK,GAAnD,GAAmC;KAC7C,EAQA;IA6FD;;;;;;OAMG;IACH,eAJW,MAAM,GACJ,OAAO,CAsBnB;IAsED;;;;OAIG;IACH,oBAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,qBAFa,OAAO,YAAY,EAAE,OAAO,GAAC,IAAI,CAI7C;IAED;;;;OAIG;IACH,qBAFa,OAAO,YAAY,EAAE,OAAO,GAAC,IAAI,CAI7C;IAED;;;;OAIG;IACH,iBAFa,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAC,IAAI,CAI1C;;CACF"}
|