vue-dialog-view 1.1.0 → 1.2.1
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/dialog-view.es.js +33 -29
- package/dist/dialog-view.es.js.map +1 -0
- package/dist/dialog-view.umd.js +3 -2
- package/dist/dialog-view.umd.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/obfuscate-classes.mjs +103 -0
- package/package.json +8 -3
- package/src/DialogView.obf.vue +8 -3
- package/src/DialogView.vue +7 -2
- package/src/index.ts +9 -5
- package/vite.config.ts +4 -3
package/dist/dialog-view.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f{padding:20px;border-radius:5px;border:1px solid gray;outline:0!important;max-width:calc(100% - 2em);max-height:calc(100% - 2em)}._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f[open]{display:flex;flex-direction:column}._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f::backdrop{background:#00000080}.
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
const
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f{padding:20px;border-radius:5px;border:1px solid gray;outline:0!important;max-width:calc(100% - 2em);max-height:calc(100% - 2em);box-sizing:border-box;overflow:hidden}._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f[open]{display:flex;flex-direction:column}._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f::backdrop{background:#00000080}._f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619{display:flex;flex-direction:row;align-items:center;margin-bottom:.5em;min-height:24px;white-space:pre;overflow:hidden}._f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6{flex:1;text-align:center;font-weight:700;font-size:large;overflow:hidden;text-overflow:ellipsis}._2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c{margin-left:.5em;text-decoration:none;color:#666;font-size:1.5em;line-height:1;width:24px;height:24px;display:flex;align-items:center;justify-content:center;cursor:pointer;border:none;background:none}._2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c:hover{color:#333;background-color:#f0f0f0;border-radius:3px}._3b2bdd19ddec80c5f0f162bc4b423dafa4f687f6f831e58742be40fb0e80838e{flex:1;overflow:auto;display:flex;flex-direction:column}")),document.head.appendChild(e)}}catch(d){console.error("vite-plugin-css-injected-by-js",d)}})();
|
|
2
|
+
import { defineComponent as m, ref as v, watch as h, nextTick as g, createElementBlock as l, openBlock as t, mergeProps as w, createCommentVNode as d, createElementVNode as n, renderSlot as i, withModifiers as V } from "vue";
|
|
3
|
+
const _ = {
|
|
4
4
|
key: 0,
|
|
5
|
-
class: "
|
|
6
|
-
},
|
|
5
|
+
class: "_f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619"
|
|
6
|
+
}, B = { class: "_f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6" }, C = { class: "_3b2bdd19ddec80c5f0f162bc4b423dafa4f687f6f831e58742be40fb0e80838e" }, k = /* @__PURE__ */ m({
|
|
7
7
|
__name: "DialogView.obf",
|
|
8
8
|
props: {
|
|
9
9
|
modelValue: { type: Boolean },
|
|
@@ -11,27 +11,27 @@ const V = {
|
|
|
11
11
|
showCloseButton: { type: Boolean, default: !0 }
|
|
12
12
|
},
|
|
13
13
|
emits: ["update:modelValue"],
|
|
14
|
-
setup(o, { expose:
|
|
15
|
-
const s = o,
|
|
14
|
+
setup(o, { expose: f, emit: u }) {
|
|
15
|
+
const s = o, r = u, e = v(null), b = () => {
|
|
16
16
|
e.value && !e.value.open && e.value.showModal();
|
|
17
|
-
},
|
|
17
|
+
}, c = () => {
|
|
18
18
|
e.value && e.value.open && e.value.close();
|
|
19
|
-
},
|
|
20
|
-
s.modelValue &&
|
|
19
|
+
}, p = () => {
|
|
20
|
+
s.modelValue && r("update:modelValue", !1);
|
|
21
21
|
};
|
|
22
|
-
return
|
|
23
|
-
await
|
|
24
|
-
}),
|
|
25
|
-
open:
|
|
26
|
-
close:
|
|
27
|
-
}), (a, y) => (t(), l("dialog",
|
|
22
|
+
return h(() => s.modelValue, async (a) => {
|
|
23
|
+
await g(), a ? e.value && !e.value.open && e.value.showModal() : e.value && e.value.open && e.value.close();
|
|
24
|
+
}), f({
|
|
25
|
+
open: b,
|
|
26
|
+
close: c
|
|
27
|
+
}), (a, y) => (t(), l("dialog", w({
|
|
28
28
|
ref_key: "dialogRef",
|
|
29
29
|
ref: e,
|
|
30
30
|
class: "_0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f"
|
|
31
|
-
}, a.$attrs, { onClose:
|
|
32
|
-
o.showTitleBar ? (t(), l("div",
|
|
33
|
-
n("span",
|
|
34
|
-
|
|
31
|
+
}, a.$attrs, { onClose: p }), [
|
|
32
|
+
o.showTitleBar ? (t(), l("div", _, [
|
|
33
|
+
n("span", B, [
|
|
34
|
+
i(a.$slots, "title")
|
|
35
35
|
]),
|
|
36
36
|
o.showCloseButton ? (t(), l("a", {
|
|
37
37
|
key: 0,
|
|
@@ -39,18 +39,22 @@ const V = {
|
|
|
39
39
|
role: "button",
|
|
40
40
|
"aria-label": "Close the dialog",
|
|
41
41
|
class: "_2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c",
|
|
42
|
-
onClick:
|
|
43
|
-
}, "×")) :
|
|
44
|
-
])) :
|
|
45
|
-
n("div",
|
|
46
|
-
|
|
42
|
+
onClick: V(c, ["prevent"])
|
|
43
|
+
}, "×")) : d("", !0)
|
|
44
|
+
])) : d("", !0),
|
|
45
|
+
n("div", C, [
|
|
46
|
+
i(a.$slots, "default")
|
|
47
47
|
])
|
|
48
48
|
], 16));
|
|
49
49
|
}
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
}), M = {
|
|
51
|
+
install: (o) => {
|
|
52
|
+
o.component("DialogView", k);
|
|
53
|
+
}
|
|
53
54
|
};
|
|
54
55
|
export {
|
|
55
|
-
|
|
56
|
+
k as DialogView,
|
|
57
|
+
M as DialogViewPlugin,
|
|
58
|
+
M as default
|
|
56
59
|
};
|
|
60
|
+
//# sourceMappingURL=dialog-view.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-view.es.js","sources":["../src/DialogView.obf.vue","../src/index.ts"],"sourcesContent":["<template>\n <dialog\n ref=\"dialogRef\"\n class=\"_0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f\"\n v-bind=\"$attrs\"\n @close=\"handleDialogClose\"\n >\n <div v-if=\"showTitleBar\" class=\"_f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619\">\n <span class=\"_f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6\">\n <slot name=\"title\"></slot>\n </span>\n <a\n v-if=\"showCloseButton\"\n href=\"javascript:void(0)\"\n role=\"button\"\n aria-label=\"Close the dialog\"\n class=\"_2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c\"\n @click.prevent=\"closeDialog\"\n >×</a>\n </div>\n <div class=\"_3b2bdd19ddec80c5f0f162bc4b423dafa4f687f6f831e58742be40fb0e80838e\">\n <slot></slot>\n </div>\n </dialog>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, nextTick } from 'vue'\n\ninterface Props {\n modelValue: boolean\n showTitleBar?: boolean\n showCloseButton?: boolean\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n showTitleBar: true,\n showCloseButton: true\n})\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: boolean): void\n}>()\n\nconst dialogRef = ref<HTMLDialogElement | null>(null)\n\nconst openDialog = (): void => {\n if (dialogRef.value && !dialogRef.value.open) {\n dialogRef.value.showModal()\n }\n}\n\nconst closeDialog = (): void => {\n if (dialogRef.value && dialogRef.value.open) {\n dialogRef.value.close()\n }\n}\n\nconst handleDialogClose = (): void => {\n if (props.modelValue) {\n emit('update:modelValue', false)\n }\n}\n\nwatch(() => props.modelValue, async (newValue) => {\n await nextTick()\n \n if (newValue) {\n if (dialogRef.value && !dialogRef.value.open) {\n dialogRef.value.showModal()\n }\n } else {\n if (dialogRef.value && dialogRef.value.open) {\n dialogRef.value.close()\n }\n }\n})\n\ndefineExpose({\n open: openDialog,\n close: closeDialog,\n})\n</script>\n\n<style>\n._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f {\n padding: 20px;\n border-radius: 5px;\n border: 1px solid gray;\n outline: 0 !important;\n max-width: calc(100% - 2em);\n max-height: calc(100% - 2em);\n box-sizing: border-box;\n overflow: hidden;\n}\n\n._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f[open] {\n display: flex;\n flex-direction: column;\n}\n\n._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f::backdrop {\n background: rgba(0, 0, 0, 0.5);\n}\n\n._f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619 {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 0.5em;\n min-height: 24px;\n white-space: pre;\n overflow: hidden;\n}\n\n._f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6 {\n flex: 1;\n text-align: center;\n font-weight: bold;\n font-size: large;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n._2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c {\n margin-left: 0.5em;\n text-decoration: none;\n color: #666;\n font-size: 1.5em;\n line-height: 1;\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n border: none;\n background: none;\n}\n\n._2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c:hover {\n color: #333;\n background-color: #f0f0f0;\n border-radius: 3px;\n}\n\n._3b2bdd19ddec80c5f0f162bc4b423dafa4f687f6f831e58742be40fb0e80838e {\n flex: 1;\n overflow: auto;\n display: flex;\n flex-direction: column;\n}\n</style>","import { App, Plugin } from 'vue'\nimport DialogViewComponent from './DialogView.obf.vue'\n\nexport { default as DialogView } from './DialogView.obf.vue'\n\nexport const DialogViewPlugin: Plugin = {\n install: (app: App) => {\n app.component('DialogView', DialogViewComponent)\n }\n}\n\nexport default DialogViewPlugin\n"],"names":["props","__props","emit","__emit","dialogRef","ref","openDialog","closeDialog","handleDialogClose","watch","newValue","nextTick","__expose","_openBlock","_createElementBlock","_mergeProps","$attrs","_hoisted_1","_createElementVNode","_hoisted_2","_renderSlot","_ctx","_hoisted_3","DialogViewPlugin","app","DialogViewComponent"],"mappings":";;;;;;;;;;;;;AAmCA,UAAMA,IAAQC,GAKRC,IAAOC,GAIPC,IAAYC,EAA8B,IAAI,GAE9CC,IAAa,MAAY;AAC7B,MAAIF,EAAU,SAAS,CAACA,EAAU,MAAM,QACtCA,EAAU,MAAM,UAAA;AAAA,IAEpB,GAEMG,IAAc,MAAY;AAC9B,MAAIH,EAAU,SAASA,EAAU,MAAM,QACrCA,EAAU,MAAM,MAAA;AAAA,IAEpB,GAEMI,IAAoB,MAAY;AACpC,MAAIR,EAAM,cACRE,EAAK,qBAAqB,EAAK;AAAA,IAEnC;AAEA,WAAAO,EAAM,MAAMT,EAAM,YAAY,OAAOU,MAAa;AAChD,YAAMC,EAAA,GAEFD,IACEN,EAAU,SAAS,CAACA,EAAU,MAAM,QACtCA,EAAU,MAAM,UAAA,IAGdA,EAAU,SAASA,EAAU,MAAM,QACrCA,EAAU,MAAM,MAAA;AAAA,IAGtB,CAAC,GAEDQ,EAAa;AAAA,MACX,MAAMN;AAAA,MACN,OAAOC;AAAA,IAAA,CACR,cAhFCM,EAAA,GAAAC,EAsBS,UAtBTC,EAsBS;AAAA,eArBH;AAAA,MAAJ,KAAIX;AAAA,MACJ,OAAM;AAAA,IAAA,GACEY,EAAAA,QAAM,EACb,SAAOR,EAAA,CAAiB,GAAA;AAAA,MAEdP,EAAA,gBAAXY,EAAA,GAAAC,EAYM,OAZNG,GAYM;AAAA,QAXJC,EAEO,QAFPC,GAEO;AAAA,UADLC,EAA0BC,EAAA,QAAA,OAAA;AAAA,QAAA;QAGpBpB,EAAA,wBADRa,EAOM,KAAA;AAAA;UALJ,MAAK;AAAA,UACL,MAAK;AAAA,UACL,cAAW;AAAA,UACX,OAAM;AAAA,UACL,WAAeP,GAAW,CAAA,SAAA,CAAA;AAAA,QAAA,GAC5B,GAAC;;MAEJW,EAEM,OAFNI,GAEM;AAAA,QADJF,EAAaC,EAAA,QAAA,SAAA;AAAA,MAAA;;;IChBNE,IAA2B;AAAA,EACtC,SAAS,CAACC,MAAa;AACrB,IAAAA,EAAI,UAAU,cAAcC,CAAmB;AAAA,EACjD;AACF;"}
|
package/dist/dialog-view.umd.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f{padding:20px;border-radius:5px;border:1px solid gray;outline:0!important;max-width:calc(100% - 2em);max-height:calc(100% - 2em)}._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f[open]{display:flex;flex-direction:column}._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f::backdrop{background:#00000080}.
|
|
2
|
-
(function(e
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f{padding:20px;border-radius:5px;border:1px solid gray;outline:0!important;max-width:calc(100% - 2em);max-height:calc(100% - 2em);box-sizing:border-box;overflow:hidden}._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f[open]{display:flex;flex-direction:column}._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f::backdrop{background:#00000080}._f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619{display:flex;flex-direction:row;align-items:center;margin-bottom:.5em;min-height:24px;white-space:pre;overflow:hidden}._f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6{flex:1;text-align:center;font-weight:700;font-size:large;overflow:hidden;text-overflow:ellipsis}._2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c{margin-left:.5em;text-decoration:none;color:#666;font-size:1.5em;line-height:1;width:24px;height:24px;display:flex;align-items:center;justify-content:center;cursor:pointer;border:none;background:none}._2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c:hover{color:#333;background-color:#f0f0f0;border-radius:3px}._3b2bdd19ddec80c5f0f162bc4b423dafa4f687f6f831e58742be40fb0e80838e{flex:1;overflow:auto;display:flex;flex-direction:column}")),document.head.appendChild(e)}}catch(d){console.error("vite-plugin-css-injected-by-js",d)}})();
|
|
2
|
+
(function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l.DialogView={},l.Vue))})(this,(function(l,e){"use strict";const c={key:0,class:"_f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619"},f={class:"_f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6"},r={class:"_3b2bdd19ddec80c5f0f162bc4b423dafa4f687f6f831e58742be40fb0e80838e"},n=e.defineComponent({__name:"DialogView.obf",props:{modelValue:{type:Boolean},showTitleBar:{type:Boolean,default:!0},showCloseButton:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(a,{expose:u,emit:p}){const d=a,b=p,o=e.ref(null),m=()=>{o.value&&!o.value.open&&o.value.showModal()},s=()=>{o.value&&o.value.open&&o.value.close()},h=()=>{d.modelValue&&b("update:modelValue",!1)};return e.watch(()=>d.modelValue,async t=>{await e.nextTick(),t?o.value&&!o.value.open&&o.value.showModal():o.value&&o.value.open&&o.value.close()}),u({open:m,close:s}),(t,g)=>(e.openBlock(),e.createElementBlock("dialog",e.mergeProps({ref_key:"dialogRef",ref:o,class:"_0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f"},t.$attrs,{onClose:h}),[a.showTitleBar?(e.openBlock(),e.createElementBlock("div",c,[e.createElementVNode("span",f,[e.renderSlot(t.$slots,"title")]),a.showCloseButton?(e.openBlock(),e.createElementBlock("a",{key:0,href:"javascript:void(0)",role:"button","aria-label":"Close the dialog",class:"_2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c",onClick:e.withModifiers(s,["prevent"])},"×")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",r,[e.renderSlot(t.$slots,"default")])],16))}}),i={install:a=>{a.component("DialogView",n)}};l.DialogView=n,l.DialogViewPlugin=i,l.default=i,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
3
|
+
//# sourceMappingURL=dialog-view.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-view.umd.js","sources":["../src/DialogView.obf.vue","../src/index.ts"],"sourcesContent":["<template>\n <dialog\n ref=\"dialogRef\"\n class=\"_0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f\"\n v-bind=\"$attrs\"\n @close=\"handleDialogClose\"\n >\n <div v-if=\"showTitleBar\" class=\"_f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619\">\n <span class=\"_f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6\">\n <slot name=\"title\"></slot>\n </span>\n <a\n v-if=\"showCloseButton\"\n href=\"javascript:void(0)\"\n role=\"button\"\n aria-label=\"Close the dialog\"\n class=\"_2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c\"\n @click.prevent=\"closeDialog\"\n >×</a>\n </div>\n <div class=\"_3b2bdd19ddec80c5f0f162bc4b423dafa4f687f6f831e58742be40fb0e80838e\">\n <slot></slot>\n </div>\n </dialog>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, nextTick } from 'vue'\n\ninterface Props {\n modelValue: boolean\n showTitleBar?: boolean\n showCloseButton?: boolean\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n showTitleBar: true,\n showCloseButton: true\n})\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: boolean): void\n}>()\n\nconst dialogRef = ref<HTMLDialogElement | null>(null)\n\nconst openDialog = (): void => {\n if (dialogRef.value && !dialogRef.value.open) {\n dialogRef.value.showModal()\n }\n}\n\nconst closeDialog = (): void => {\n if (dialogRef.value && dialogRef.value.open) {\n dialogRef.value.close()\n }\n}\n\nconst handleDialogClose = (): void => {\n if (props.modelValue) {\n emit('update:modelValue', false)\n }\n}\n\nwatch(() => props.modelValue, async (newValue) => {\n await nextTick()\n \n if (newValue) {\n if (dialogRef.value && !dialogRef.value.open) {\n dialogRef.value.showModal()\n }\n } else {\n if (dialogRef.value && dialogRef.value.open) {\n dialogRef.value.close()\n }\n }\n})\n\ndefineExpose({\n open: openDialog,\n close: closeDialog,\n})\n</script>\n\n<style>\n._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f {\n padding: 20px;\n border-radius: 5px;\n border: 1px solid gray;\n outline: 0 !important;\n max-width: calc(100% - 2em);\n max-height: calc(100% - 2em);\n box-sizing: border-box;\n overflow: hidden;\n}\n\n._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f[open] {\n display: flex;\n flex-direction: column;\n}\n\n._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f::backdrop {\n background: rgba(0, 0, 0, 0.5);\n}\n\n._f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619 {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 0.5em;\n min-height: 24px;\n white-space: pre;\n overflow: hidden;\n}\n\n._f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6 {\n flex: 1;\n text-align: center;\n font-weight: bold;\n font-size: large;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n._2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c {\n margin-left: 0.5em;\n text-decoration: none;\n color: #666;\n font-size: 1.5em;\n line-height: 1;\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n border: none;\n background: none;\n}\n\n._2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c:hover {\n color: #333;\n background-color: #f0f0f0;\n border-radius: 3px;\n}\n\n._3b2bdd19ddec80c5f0f162bc4b423dafa4f687f6f831e58742be40fb0e80838e {\n flex: 1;\n overflow: auto;\n display: flex;\n flex-direction: column;\n}\n</style>","import { App, Plugin } from 'vue'\nimport DialogViewComponent from './DialogView.obf.vue'\n\nexport { default as DialogView } from './DialogView.obf.vue'\n\nexport const DialogViewPlugin: Plugin = {\n install: (app: App) => {\n app.component('DialogView', DialogViewComponent)\n }\n}\n\nexport default DialogViewPlugin\n"],"names":["props","__props","emit","__emit","dialogRef","ref","openDialog","closeDialog","handleDialogClose","watch","newValue","nextTick","__expose","_openBlock","_createElementBlock","_mergeProps","$attrs","_hoisted_1","_createElementVNode","_hoisted_2","_renderSlot","_ctx","_hoisted_3","DialogViewPlugin","app","DialogViewComponent"],"mappings":"6sBAmCA,MAAMA,EAAQC,EAKRC,EAAOC,EAIPC,EAAYC,EAAAA,IAA8B,IAAI,EAE9CC,EAAa,IAAY,CACzBF,EAAU,OAAS,CAACA,EAAU,MAAM,MACtCA,EAAU,MAAM,UAAA,CAEpB,EAEMG,EAAc,IAAY,CAC1BH,EAAU,OAASA,EAAU,MAAM,MACrCA,EAAU,MAAM,MAAA,CAEpB,EAEMI,EAAoB,IAAY,CAChCR,EAAM,YACRE,EAAK,oBAAqB,EAAK,CAEnC,EAEAO,OAAAA,EAAAA,MAAM,IAAMT,EAAM,WAAY,MAAOU,GAAa,CAChD,MAAMC,WAAA,EAEFD,EACEN,EAAU,OAAS,CAACA,EAAU,MAAM,MACtCA,EAAU,MAAM,UAAA,EAGdA,EAAU,OAASA,EAAU,MAAM,MACrCA,EAAU,MAAM,MAAA,CAGtB,CAAC,EAEDQ,EAAa,CACX,KAAMN,EACN,MAAOC,CAAA,CACR,UAhFCM,YAAA,EAAAC,qBAsBS,SAtBTC,EAAAA,WAsBS,SArBH,YAAJ,IAAIX,EACJ,MAAM,mEAAA,EACEY,EAAAA,OAAM,CACb,QAAOR,CAAA,CAAiB,EAAA,CAEdP,EAAA,cAAXY,EAAAA,UAAA,EAAAC,EAAAA,mBAYM,MAZNG,EAYM,CAXJC,EAAAA,mBAEO,OAFPC,EAEO,CADLC,aAA0BC,EAAA,OAAA,OAAA,CAAA,GAGpBpB,EAAA,+BADRa,EAAAA,mBAOM,IAAA,OALJ,KAAK,qBACL,KAAK,SACL,aAAW,mBACX,MAAM,oEACL,wBAAeP,EAAW,CAAA,SAAA,CAAA,CAAA,EAC5B,GAAC,8DAEJW,EAAAA,mBAEM,MAFNI,EAEM,CADJF,aAAaC,EAAA,OAAA,SAAA,CAAA,YChBNE,EAA2B,CACtC,QAAUC,GAAa,CACrBA,EAAI,UAAU,aAAcC,CAAmB,CACjD,CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default DialogView;
|
|
1
|
+
import { Plugin } from 'vue';
|
|
2
|
+
export { default as DialogView } from './DialogView.obf.vue';
|
|
3
|
+
export declare const DialogViewPlugin: Plugin;
|
|
4
|
+
export default DialogViewPlugin;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import crypto from 'crypto';
|
|
5
|
+
|
|
6
|
+
const SRC_DIR = path.resolve('./src');
|
|
7
|
+
const OBF_SUFFIX = '.obf.vue';
|
|
8
|
+
|
|
9
|
+
// ----------------------------
|
|
10
|
+
// 遍历 Vue 文件(跳过 .obf.vue)
|
|
11
|
+
// ----------------------------
|
|
12
|
+
function getVueFiles(dir) {
|
|
13
|
+
let files = [];
|
|
14
|
+
for (const item of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
15
|
+
const fullPath = path.join(dir, item.name);
|
|
16
|
+
if (item.isDirectory()) {
|
|
17
|
+
files = files.concat(getVueFiles(fullPath));
|
|
18
|
+
} else if (item.isFile() && item.name.endsWith('.vue') && !item.name.endsWith(OBF_SUFFIX)) {
|
|
19
|
+
files.push(fullPath);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return files;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ----------------------------
|
|
26
|
+
// SHA256 混淆类名
|
|
27
|
+
// ----------------------------
|
|
28
|
+
function obfClass(name) {
|
|
29
|
+
return '_' + crypto.createHash('sha256').update(name).digest('hex')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ----------------------------
|
|
33
|
+
// 提取 template 内的 class
|
|
34
|
+
// ----------------------------
|
|
35
|
+
function extractClasses(template) {
|
|
36
|
+
const classes = new Set();
|
|
37
|
+
|
|
38
|
+
// class="..."
|
|
39
|
+
const classAttrRegex = /class\s*=\s*"([^"]+)"/g;
|
|
40
|
+
let match;
|
|
41
|
+
while ((match = classAttrRegex.exec(template)) !== null) {
|
|
42
|
+
match[1].split(/\s+/).forEach(cls => cls && classes.add(cls));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return classes;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ----------------------------
|
|
49
|
+
// 替换模板和 style 中的 class
|
|
50
|
+
// ----------------------------
|
|
51
|
+
function replaceClasses(content, classMap) {
|
|
52
|
+
// 替换 class="..."
|
|
53
|
+
content = content.replace(/class\s*=\s*"([^"]+)"/g, (match, group1) => {
|
|
54
|
+
const replaced = group1.split(/\s+/).map(cls => classMap[cls] || cls).join(' ');
|
|
55
|
+
return `class="${replaced}"`;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// 替换 <style> 中的类名
|
|
59
|
+
content = content.replace(/(\.)([\w-]+)/g, (match, dot, cls) => {
|
|
60
|
+
return classMap[cls] ? `.${classMap[cls]}` : match;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return content;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ----------------------------
|
|
67
|
+
// 主程序
|
|
68
|
+
// ----------------------------
|
|
69
|
+
function main() {
|
|
70
|
+
const vueFiles = getVueFiles(SRC_DIR);
|
|
71
|
+
const allClasses = new Set();
|
|
72
|
+
|
|
73
|
+
// 提取所有 template class
|
|
74
|
+
vueFiles.forEach(file => {
|
|
75
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
76
|
+
const templateMatch = content.match(/<template[^>]*>([\s\S]*?)<\/template>/);
|
|
77
|
+
if (!templateMatch) return;
|
|
78
|
+
const templateContent = templateMatch[1];
|
|
79
|
+
extractClasses(templateContent).forEach(cls => allClasses.add(cls));
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// 按长度降序避免短类名覆盖长类名
|
|
83
|
+
const classList = Array.from(allClasses).sort((a, b) => b.length - a.length);
|
|
84
|
+
const classMap = {};
|
|
85
|
+
classList.forEach(cls => { classMap[cls] = obfClass(cls); });
|
|
86
|
+
|
|
87
|
+
console.log('🔹 类名混淆映射:');
|
|
88
|
+
console.table(classMap);
|
|
89
|
+
|
|
90
|
+
// 替换并生成 .obf.vue 文件
|
|
91
|
+
vueFiles.forEach(file => {
|
|
92
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
93
|
+
const replacedContent = replaceClasses(content, classMap);
|
|
94
|
+
|
|
95
|
+
const obfFile = path.join(path.dirname(file), path.basename(file, '.vue') + OBF_SUFFIX);
|
|
96
|
+
fs.writeFileSync(obfFile, replacedContent, 'utf-8');
|
|
97
|
+
console.log(`✅ ${file} -> ${obfFile}`);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
console.log('🎉 所有文件混淆完成!');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-dialog-view",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A modern Vue 3 dialog component using native dialog element",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/dialog-view.umd.js",
|
|
@@ -19,11 +19,15 @@
|
|
|
19
19
|
"README.md",
|
|
20
20
|
"tsconfig.json",
|
|
21
21
|
"vite.config.ts",
|
|
22
|
+
"obfuscate-classes.mjs",
|
|
22
23
|
"LICENSE"
|
|
23
24
|
],
|
|
24
25
|
"scripts": {
|
|
25
26
|
"dev": "vite",
|
|
26
|
-
"
|
|
27
|
+
"clean": "rimraf dist",
|
|
28
|
+
"obfuscate": "node ./obfuscate-classes.mjs",
|
|
29
|
+
"build": "npm run clean && npm run obfuscate && npm run build-only",
|
|
30
|
+
"build-only": "vue-tsc --noEmit && vite build",
|
|
27
31
|
"preview": "vite preview"
|
|
28
32
|
},
|
|
29
33
|
"peerDependencies": {
|
|
@@ -31,6 +35,7 @@
|
|
|
31
35
|
},
|
|
32
36
|
"devDependencies": {
|
|
33
37
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
38
|
+
"rimraf": "^6.0.1",
|
|
34
39
|
"typescript": "^5.9.3",
|
|
35
40
|
"vite": "^7.1.10",
|
|
36
41
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
@@ -51,4 +56,4 @@
|
|
|
51
56
|
"url": "https://github.com/shc0743/MyUtility/issues"
|
|
52
57
|
},
|
|
53
58
|
"homepage": "https://github.com/shc0743/MyUtility/tree/main/js/lib/vue-dialog-view#readme"
|
|
54
|
-
}
|
|
59
|
+
}
|
package/src/DialogView.obf.vue
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
v-bind="$attrs"
|
|
6
6
|
@close="handleDialogClose"
|
|
7
7
|
>
|
|
8
|
-
<div v-if="showTitleBar" class="
|
|
8
|
+
<div v-if="showTitleBar" class="_f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619">
|
|
9
9
|
<span class="_f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6">
|
|
10
10
|
<slot name="title"></slot>
|
|
11
11
|
</span>
|
|
@@ -90,6 +90,8 @@ defineExpose({
|
|
|
90
90
|
outline: 0 !important;
|
|
91
91
|
max-width: calc(100% - 2em);
|
|
92
92
|
max-height: calc(100% - 2em);
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
overflow: hidden;
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f[open] {
|
|
@@ -101,20 +103,23 @@ defineExpose({
|
|
|
101
103
|
background: rgba(0, 0, 0, 0.5);
|
|
102
104
|
}
|
|
103
105
|
|
|
104
|
-
.
|
|
106
|
+
._f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619 {
|
|
105
107
|
display: flex;
|
|
106
108
|
flex-direction: row;
|
|
107
109
|
align-items: center;
|
|
108
110
|
margin-bottom: 0.5em;
|
|
109
111
|
min-height: 24px;
|
|
110
112
|
white-space: pre;
|
|
113
|
+
overflow: hidden;
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
._f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6 {
|
|
114
117
|
flex: 1;
|
|
115
118
|
text-align: center;
|
|
116
119
|
font-weight: bold;
|
|
117
|
-
font-size:
|
|
120
|
+
font-size: large;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
text-overflow: ellipsis;
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
._2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c {
|
package/src/DialogView.vue
CHANGED
|
@@ -82,7 +82,7 @@ defineExpose({
|
|
|
82
82
|
})
|
|
83
83
|
</script>
|
|
84
84
|
|
|
85
|
-
<style
|
|
85
|
+
<style>
|
|
86
86
|
.dialog-view {
|
|
87
87
|
padding: 20px;
|
|
88
88
|
border-radius: 5px;
|
|
@@ -90,6 +90,8 @@ defineExpose({
|
|
|
90
90
|
outline: 0 !important;
|
|
91
91
|
max-width: calc(100% - 2em);
|
|
92
92
|
max-height: calc(100% - 2em);
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
overflow: hidden;
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
.dialog-view[open] {
|
|
@@ -108,13 +110,16 @@ defineExpose({
|
|
|
108
110
|
margin-bottom: 0.5em;
|
|
109
111
|
min-height: 24px;
|
|
110
112
|
white-space: pre;
|
|
113
|
+
overflow: hidden;
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
.dialog-title {
|
|
114
117
|
flex: 1;
|
|
115
118
|
text-align: center;
|
|
116
119
|
font-weight: bold;
|
|
117
|
-
font-size:
|
|
120
|
+
font-size: large;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
text-overflow: ellipsis;
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
.dialog-close-button {
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { App } from 'vue'
|
|
2
|
-
import
|
|
1
|
+
import { App, Plugin } from 'vue'
|
|
2
|
+
import DialogViewComponent from './DialogView.obf.vue'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export { default as DialogView } from './DialogView.obf.vue'
|
|
5
|
+
|
|
6
|
+
export const DialogViewPlugin: Plugin = {
|
|
7
|
+
install: (app: App) => {
|
|
8
|
+
app.component('DialogView', DialogViewComponent)
|
|
9
|
+
}
|
|
6
10
|
}
|
|
7
11
|
|
|
8
|
-
export default
|
|
12
|
+
export default DialogViewPlugin
|
package/vite.config.ts
CHANGED