@learnpress/utils 0.2.1 → 0.3.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/dist/index.cjs +14 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
@@ -24,6 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
let entities = require("entities");
|
|
25
25
|
let sanitize_html = require("sanitize-html");
|
|
26
26
|
sanitize_html = __toESM(sanitize_html, 1);
|
|
27
|
+
let tailwind_variants = require("tailwind-variants");
|
|
27
28
|
//#region src/html.ts
|
|
28
29
|
const stripHtml = (html) => (0, entities.decodeHTML)(html.replace(/<[^>]*>/g, "")).trim();
|
|
29
30
|
const sanitizeHtml = (html) => (0, sanitize_html.default)(html, {
|
|
@@ -127,5 +128,17 @@ const sanitizeHtml = (html) => (0, sanitize_html.default)(html, {
|
|
|
127
128
|
}) }
|
|
128
129
|
});
|
|
129
130
|
//#endregion
|
|
131
|
+
Object.defineProperty(exports, "cn", {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function() {
|
|
134
|
+
return tailwind_variants.cn;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
130
137
|
exports.sanitizeHtml = sanitizeHtml;
|
|
131
138
|
exports.stripHtml = stripHtml;
|
|
139
|
+
Object.defineProperty(exports, "tv", {
|
|
140
|
+
enumerable: true,
|
|
141
|
+
get: function() {
|
|
142
|
+
return tailwind_variants.tv;
|
|
143
|
+
}
|
|
144
|
+
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { VariantProps, cn, tv } from "tailwind-variants";
|
|
1
2
|
//#region src/html.d.ts
|
|
2
|
-
declare const stripHtml: (html: string) => string;
|
|
3
|
-
declare const sanitizeHtml: (html: string) => string;
|
|
3
|
+
export declare const stripHtml: (html: string) => string;
|
|
4
|
+
export declare const sanitizeHtml: (html: string) => string;
|
|
4
5
|
//#endregion
|
|
5
|
-
export {
|
|
6
|
+
export { type VariantProps, cn, tv };
|
|
6
7
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/html.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/html.ts"],"mappings":";;qBAGa,YAAS;qBAET,eAAY"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { VariantProps, cn, tv } from "tailwind-variants";
|
|
1
2
|
//#region src/html.d.ts
|
|
2
|
-
declare const stripHtml: (html: string) => string;
|
|
3
|
-
declare const sanitizeHtml: (html: string) => string;
|
|
3
|
+
export declare const stripHtml: (html: string) => string;
|
|
4
|
+
export declare const sanitizeHtml: (html: string) => string;
|
|
4
5
|
//#endregion
|
|
5
|
-
export {
|
|
6
|
+
export { type VariantProps, cn, tv };
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/html.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/html.ts"],"mappings":";;qBAGa,YAAS;qBAET,eAAY"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { decodeHTML } from "entities";
|
|
2
2
|
import sanitizeHtmlLib from "sanitize-html";
|
|
3
|
+
import { cn, tv } from "tailwind-variants";
|
|
3
4
|
//#region src/html.ts
|
|
4
5
|
const stripHtml = (html) => decodeHTML(html.replace(/<[^>]*>/g, "")).trim();
|
|
5
6
|
const sanitizeHtml = (html) => sanitizeHtmlLib(html, {
|
|
@@ -103,6 +104,6 @@ const sanitizeHtml = (html) => sanitizeHtmlLib(html, {
|
|
|
103
104
|
}) }
|
|
104
105
|
});
|
|
105
106
|
//#endregion
|
|
106
|
-
export { sanitizeHtml, stripHtml };
|
|
107
|
+
export { cn, sanitizeHtml, stripHtml, tv };
|
|
107
108
|
|
|
108
109
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/html.ts"],"sourcesContent":["import { decodeHTML } from \"entities\";\nimport sanitizeHtmlLib from \"sanitize-html\";\n\nexport const stripHtml = (html: string): string => decodeHTML(html.replace(/<[^>]*>/g, \"\")).trim();\n\nexport const sanitizeHtml = (html: string): string =>\n sanitizeHtmlLib(html, {\n allowedTags: sanitizeHtmlLib.defaults.allowedTags.concat([\n \"img\",\n \"figure\",\n \"figcaption\",\n \"iframe\",\n \"video\",\n \"audio\",\n \"source\",\n \"track\",\n ]),\n allowedAttributes: {\n ...sanitizeHtmlLib.defaults.allowedAttributes,\n \"*\": [\"class\", \"id\", \"style\"],\n img: [\"src\", \"srcset\", \"sizes\", \"alt\", \"width\", \"height\", \"loading\", \"decoding\"],\n a: [\"href\", \"name\", \"target\", \"rel\", \"title\"],\n iframe: [\"src\", \"width\", \"height\", \"frameborder\", \"allow\", \"allowfullscreen\"],\n video: [\n \"src\",\n \"controls\",\n \"poster\",\n \"width\",\n \"height\",\n \"preload\",\n \"playsinline\",\n \"muted\",\n \"loop\",\n \"autoplay\",\n ],\n audio: [\"src\", \"controls\", \"preload\", \"loop\", \"autoplay\"],\n source: [\"src\", \"type\", \"media\"],\n track: [\"src\", \"kind\", \"srclang\", \"label\", \"default\"],\n },\n allowedSchemes: [\"http\", \"https\", \"mailto\", \"tel\", \"data\"],\n allowedSchemesByTag: { img: [\"http\", \"https\", \"data\"] },\n allowedIframeHostnames: [\"www.youtube.com\", \"youtube.com\", \"player.vimeo.com\"],\n transformTags: {\n a: (tagName, attribs) => ({\n tagName,\n attribs: {\n ...attribs,\n ...(attribs.target === \"_blank\" ? { rel: \"noopener noreferrer\" } : {}),\n },\n }),\n },\n });\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/html.ts"],"sourcesContent":["import { decodeHTML } from \"entities\";\nimport sanitizeHtmlLib from \"sanitize-html\";\n\nexport const stripHtml = (html: string): string => decodeHTML(html.replace(/<[^>]*>/g, \"\")).trim();\n\nexport const sanitizeHtml = (html: string): string =>\n sanitizeHtmlLib(html, {\n allowedTags: sanitizeHtmlLib.defaults.allowedTags.concat([\n \"img\",\n \"figure\",\n \"figcaption\",\n \"iframe\",\n \"video\",\n \"audio\",\n \"source\",\n \"track\",\n ]),\n allowedAttributes: {\n ...sanitizeHtmlLib.defaults.allowedAttributes,\n \"*\": [\"class\", \"id\", \"style\"],\n img: [\"src\", \"srcset\", \"sizes\", \"alt\", \"width\", \"height\", \"loading\", \"decoding\"],\n a: [\"href\", \"name\", \"target\", \"rel\", \"title\"],\n iframe: [\"src\", \"width\", \"height\", \"frameborder\", \"allow\", \"allowfullscreen\"],\n video: [\n \"src\",\n \"controls\",\n \"poster\",\n \"width\",\n \"height\",\n \"preload\",\n \"playsinline\",\n \"muted\",\n \"loop\",\n \"autoplay\",\n ],\n audio: [\"src\", \"controls\", \"preload\", \"loop\", \"autoplay\"],\n source: [\"src\", \"type\", \"media\"],\n track: [\"src\", \"kind\", \"srclang\", \"label\", \"default\"],\n },\n allowedSchemes: [\"http\", \"https\", \"mailto\", \"tel\", \"data\"],\n allowedSchemesByTag: { img: [\"http\", \"https\", \"data\"] },\n allowedIframeHostnames: [\"www.youtube.com\", \"youtube.com\", \"player.vimeo.com\"],\n transformTags: {\n a: (tagName, attribs) => ({\n tagName,\n attribs: {\n ...attribs,\n ...(attribs.target === \"_blank\" ? { rel: \"noopener noreferrer\" } : {}),\n },\n }),\n },\n });\n"],"mappings":";;;;AAGA,MAAa,aAAa,SAAyB,WAAW,KAAK,QAAQ,YAAY,EAAE,CAAC,CAAC,CAAC,KAAK;AAEjG,MAAa,gBAAgB,SAC3B,gBAAgB,MAAM;CACpB,aAAa,gBAAgB,SAAS,YAAY,OAAO;EACvD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,mBAAmB;EACjB,GAAG,gBAAgB,SAAS;EAC5B,KAAK;GAAC;GAAS;GAAM;EAAO;EAC5B,KAAK;GAAC;GAAO;GAAU;GAAS;GAAO;GAAS;GAAU;GAAW;EAAU;EAC/E,GAAG;GAAC;GAAQ;GAAQ;GAAU;GAAO;EAAO;EAC5C,QAAQ;GAAC;GAAO;GAAS;GAAU;GAAe;GAAS;EAAiB;EAC5E,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,OAAO;GAAC;GAAO;GAAY;GAAW;GAAQ;EAAU;EACxD,QAAQ;GAAC;GAAO;GAAQ;EAAO;EAC/B,OAAO;GAAC;GAAO;GAAQ;GAAW;GAAS;EAAS;CACtD;CACA,gBAAgB;EAAC;EAAQ;EAAS;EAAU;EAAO;CAAM;CACzD,qBAAqB,EAAE,KAAK;EAAC;EAAQ;EAAS;CAAM,EAAE;CACtD,wBAAwB;EAAC;EAAmB;EAAe;CAAkB;CAC7E,eAAe,EACb,IAAI,SAAS,aAAa;EACxB;EACA,SAAS;GACP,GAAG;GACH,GAAI,QAAQ,WAAW,WAAW,EAAE,KAAK,sBAAsB,IAAI,CAAC;EACtE;CACF,GACF;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learnpress/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Shared utility helpers for LearnPress packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"learnpress",
|
|
@@ -41,7 +41,9 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"entities": "^8.0.0",
|
|
44
|
-
"sanitize-html": "^2.17.
|
|
44
|
+
"sanitize-html": "^2.17.7",
|
|
45
|
+
"tailwind-merge": "^3.6.0",
|
|
46
|
+
"tailwind-variants": "^3.3.1"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
49
|
"@types/sanitize-html": "^2.16.1",
|