@inzombieland/nuxt-common 1.18.49 → 1.18.51

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/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/nuxt-common",
3
- "version": "1.18.49",
3
+ "version": "1.18.51",
4
4
  "configKey": "nuxt-common",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.6.0",
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
2
2
  import { defineNuxtModule, createResolver, addServerHandler, addImportsDir, addPlugin, addComponent } from '@nuxt/kit';
3
3
 
4
4
  const name = "@inzombieland/nuxt-common";
5
- const version = "1.18.49";
5
+ const version = "1.18.51";
6
6
 
7
7
  const module = defineNuxtModule({
8
8
  meta: {
@@ -48,7 +48,6 @@ const module = defineNuxtModule({
48
48
  addImportsDir(resolve(runtimeDir, "composables"));
49
49
  addPlugin(resolve(runtimeDir, "plugin"));
50
50
  addPlugin(resolve(runtimeDir, "plugins/device"));
51
- addPlugin(resolve(runtimeDir, "plugins/sanitize-html"));
52
51
  addComponent({
53
52
  name: "NuxtAppProvider",
54
53
  filePath: resolve(runtimeDir, "packages/core/AppProvider.vue")
@@ -1,6 +1,7 @@
1
- import { defineOtpInputPlugin, defineSanitizeUrlPlugin, defineVarletPlugin } from "./plugins/index.mjs";
1
+ import { defineOtpInputPlugin, defineSanitizeHtmlPlugin, defineSanitizeUrlPlugin, defineVarletPlugin } from "./plugins/index.mjs";
2
2
  export function defineVuePlugins(app) {
3
3
  defineOtpInputPlugin(app);
4
+ defineSanitizeHtmlPlugin(app);
4
5
  defineSanitizeUrlPlugin(app);
5
6
  defineVarletPlugin(app);
6
7
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/core",
3
- "version": "1.18.49",
3
+ "version": "1.18.51",
4
4
  "type": "module",
5
5
  "license": "ISC",
6
6
  "main": "./index.mjs",
@@ -19,6 +19,7 @@
19
19
  "ofetch": "^1.4.1",
20
20
  "ohash": "^2.0.11",
21
21
  "rxjs": "^7.8.2",
22
+ "ultrahtml": "^1.6.0",
22
23
  "vant": "^4.9.19",
23
24
  "vue3-otp-input": "^0.5.21",
24
25
  "zod": "^3.24.2"
@@ -1,3 +1,4 @@
1
1
  export * from "./otp-input";
2
+ export * from "./sanitize-html";
2
3
  export * from "./sanitize-url";
3
4
  export * from "./varlet-ui";
@@ -1,3 +1,4 @@
1
1
  export * from "./otp-input.mjs";
2
+ export * from "./sanitize-html.mjs";
2
3
  export * from "./sanitize-url.mjs";
3
4
  export * from "./varlet-ui.mjs";
@@ -0,0 +1,2 @@
1
+ import type { App } from "vue";
2
+ export declare function defineSanitizeHtmlPlugin(app: App): void;
@@ -0,0 +1,88 @@
1
+ import { transform } from "ultrahtml";
2
+ import sanitize from "ultrahtml/transformers/sanitize";
3
+ export function defineSanitizeHtmlPlugin(app) {
4
+ app.directive("sanitize-html", async (el, binding) => {
5
+ if (binding.value !== binding.oldValue) {
6
+ const allowElements = [
7
+ "address",
8
+ "article",
9
+ "aside",
10
+ "footer",
11
+ "header",
12
+ "h1",
13
+ "h2",
14
+ "h3",
15
+ "h4",
16
+ "h5",
17
+ "h6",
18
+ "hgroup",
19
+ "main",
20
+ "nav",
21
+ "section",
22
+ "blockquote",
23
+ "dd",
24
+ "div",
25
+ "dl",
26
+ "dt",
27
+ "figcaption",
28
+ "figure",
29
+ "hr",
30
+ "li",
31
+ "main",
32
+ "ol",
33
+ "p",
34
+ "pre",
35
+ "ul",
36
+ "a",
37
+ "abbr",
38
+ "b",
39
+ "bdi",
40
+ "bdo",
41
+ "br",
42
+ "cite",
43
+ "code",
44
+ "data",
45
+ "dfn",
46
+ "em",
47
+ "i",
48
+ "kbd",
49
+ "mark",
50
+ "q",
51
+ "rb",
52
+ "rp",
53
+ "rt",
54
+ "rtc",
55
+ "ruby",
56
+ "s",
57
+ "samp",
58
+ "small",
59
+ "span",
60
+ "strong",
61
+ "sub",
62
+ "sup",
63
+ "time",
64
+ "u",
65
+ "var",
66
+ "wbr",
67
+ "caption",
68
+ "col",
69
+ "colgroup",
70
+ "table",
71
+ "tbody",
72
+ "td",
73
+ "tfoot",
74
+ "th",
75
+ "thead",
76
+ "tr"
77
+ ];
78
+ const allowAttributes = {
79
+ a: ["href", "name", "target"],
80
+ img: ["src", "srcset", "alt", "title", "width", "height", "loading"]
81
+ };
82
+ if (!binding.modifiers.disallowimg) {
83
+ allowElements.push("img");
84
+ }
85
+ el.innerHTML = await transform(binding.value, [sanitize({ allowElements, allowAttributes })]);
86
+ }
87
+ });
88
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/nuxt-common",
3
- "version": "1.18.49",
3
+ "version": "1.18.51",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,2 +0,0 @@
1
- declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
2
- export default _default;
@@ -1,90 +0,0 @@
1
- import { defineNuxtPlugin } from "#app";
2
- import { transform } from "ultrahtml";
3
- import sanitize from "ultrahtml/transformers/sanitize";
4
- export default defineNuxtPlugin((nuxtApp) => {
5
- nuxtApp.vueApp.directive("sanitize-html", async (el, binding) => {
6
- if (binding.value !== binding.oldValue) {
7
- el.innerHTML = await transform(binding.value, [
8
- sanitize({
9
- allowElements: [
10
- "address",
11
- "article",
12
- "aside",
13
- "footer",
14
- "header",
15
- "h1",
16
- "h2",
17
- "h3",
18
- "h4",
19
- "h5",
20
- "h6",
21
- "hgroup",
22
- "main",
23
- "nav",
24
- "section",
25
- "blockquote",
26
- "dd",
27
- "div",
28
- "dl",
29
- "dt",
30
- "figcaption",
31
- "figure",
32
- "hr",
33
- "li",
34
- "main",
35
- "ol",
36
- "p",
37
- "pre",
38
- "ul",
39
- "a",
40
- "abbr",
41
- "b",
42
- "bdi",
43
- "bdo",
44
- "br",
45
- "cite",
46
- "code",
47
- "data",
48
- "dfn",
49
- "em",
50
- "i",
51
- "kbd",
52
- "mark",
53
- "q",
54
- "rb",
55
- "rp",
56
- "rt",
57
- "rtc",
58
- "ruby",
59
- "s",
60
- "samp",
61
- "small",
62
- "span",
63
- "strong",
64
- "sub",
65
- "sup",
66
- "time",
67
- "u",
68
- "var",
69
- "wbr",
70
- "caption",
71
- "col",
72
- "colgroup",
73
- "table",
74
- "tbody",
75
- "td",
76
- "tfoot",
77
- "th",
78
- "thead",
79
- "tr",
80
- "img"
81
- ],
82
- allowAttributes: {
83
- a: ["href", "name", "target"],
84
- img: ["src", "srcset", "alt", "title", "width", "height", "loading"]
85
- }
86
- })
87
- ]);
88
- }
89
- });
90
- });