yummies 4.14.1 → 5.0.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.
- package/html.d.ts +2 -2
- package/html.d.ts.map +1 -1
- package/html.js +4 -13
- package/package.json +2 -3
package/html.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Config as DOMPurifyConfig } from 'dompurify';
|
|
2
2
|
import type { Maybe } from './utils/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Вытаскивает RGB из любого цвета
|
|
@@ -14,7 +14,7 @@ export declare function wrapTextToTagLink(link: string): string;
|
|
|
14
14
|
export declare const collectOffsetTop: (element: HTMLElement | null) => number;
|
|
15
15
|
export declare const skipEvent: (e: Event) => boolean;
|
|
16
16
|
export declare const globalScrollIntoViewForY: (node: HTMLElement) => void;
|
|
17
|
-
export declare const sanitizeHtml: (html: Maybe<string>, config?:
|
|
17
|
+
export declare const sanitizeHtml: (html: Maybe<string>, config?: DOMPurifyConfig) => string;
|
|
18
18
|
export declare const checkElementHasParent: (element: HTMLElement | null, parent: Maybe<HTMLElement>) => boolean;
|
|
19
19
|
/**
|
|
20
20
|
* Executes a function within a view transition if supported by the browser.
|
package/html.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../src/html.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../src/html.ts"],"names":[],"mappings":"AAAA,OAAkB,EAAE,KAAK,MAAM,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AAGtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAe1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,WAAW,MAAM,GAAG,IAAI,EACxB,WAAW,MAAM,SAgBlB,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,UAI7C;AAED,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,GAAG,IAAI,WAU3D,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,GAAG,KAAK,YAKjC,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,MAAM,WAAW,SAezD,CAAC;AAiDF,eAAO,MAAM,YAAY,GAAI,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,eAAe,WAKzE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,SAAS,WAAW,GAAG,IAAI,EAC3B,QAAQ,KAAK,CAAC,WAAW,CAAC,YAe3B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GACpC,IAAI,YAAY,EAChB,SAAS;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,+BAMhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,cAmB9B,CAAC;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,UAQzD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,WAAW,UAQnD;AAED,eAAO,MAAM,kBAAkB,eACqC,CAAC;AAErE,eAAO,MAAM,mBAAmB,eACqC,CAAC"}
|
package/html.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import DOMPurify from 'dompurify';
|
|
2
2
|
import { blobToUrl } from './media.js';
|
|
3
3
|
/**
|
|
4
4
|
* Вытаскивает RGB из любого цвета
|
|
@@ -63,15 +63,7 @@ export const globalScrollIntoViewForY = (node) => {
|
|
|
63
63
|
});
|
|
64
64
|
};
|
|
65
65
|
const sanitizeDefaults = {
|
|
66
|
-
|
|
67
|
-
a: ['href', 'name', 'target'],
|
|
68
|
-
img: ['src'],
|
|
69
|
-
span: ['class'],
|
|
70
|
-
code: ['class'],
|
|
71
|
-
},
|
|
72
|
-
allowedClasses: {},
|
|
73
|
-
allowedSchemes: ['http', 'https', 'mailto'],
|
|
74
|
-
allowedTags: [
|
|
66
|
+
ALLOWED_TAGS: [
|
|
75
67
|
'a',
|
|
76
68
|
'article',
|
|
77
69
|
'b',
|
|
@@ -114,11 +106,10 @@ const sanitizeDefaults = {
|
|
|
114
106
|
'u',
|
|
115
107
|
'ul',
|
|
116
108
|
],
|
|
117
|
-
|
|
118
|
-
transformText: undefined,
|
|
109
|
+
ALLOWED_ATTR: ['href', 'target', 'name', 'src', 'class'],
|
|
119
110
|
};
|
|
120
111
|
export const sanitizeHtml = (html, config) => {
|
|
121
|
-
return
|
|
112
|
+
return DOMPurify.sanitize(html || '', {
|
|
122
113
|
...sanitizeDefaults,
|
|
123
114
|
...config,
|
|
124
115
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yummies",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": "js2me",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,11 +27,10 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@types/insane": "^1.0.0",
|
|
31
30
|
"class-variance-authority": "^0.7.1",
|
|
32
31
|
"clsx": "^2.1.1",
|
|
33
32
|
"dayjs": "^1.11.13",
|
|
34
|
-
"
|
|
33
|
+
"dompurify": "^3.2.6",
|
|
35
34
|
"nanoid": "^5.1.5",
|
|
36
35
|
"tailwind-merge": "^3.3.1"
|
|
37
36
|
},
|