vue-dialog-view 1.2.0 → 1.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/dialog-view.es.js +34 -30
- 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 +61 -3
- package/package.json +1 -1
- package/src/DialogView.obf.vue +13 -13
- 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(".
|
|
2
|
-
import { defineComponent as v, ref as h, watch as
|
|
3
|
-
const
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._b4102a3b79656a37{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}._b4102a3b79656a37[open]{display:flex;flex-direction:column}._b4102a3b79656a37::backdrop{background:#00000080}._4d394b1507fdc584{display:flex;flex-direction:row;align-items:center;margin-bottom:.5em;min-height:24px;white-space:pre;overflow:hidden}._088d860d2fd75292{flex:1;text-align:center;font-weight:700;font-size:large;overflow:hidden;text-overflow:ellipsis}._468ff1da37ead40a{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}._468ff1da37ead40a:hover{color:#333;background-color:#f0f0f0;border-radius:3px}._da3b3b2a4aeed1ee{flex:1;overflow:auto;display:flex;flex-direction:column}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
+
import { defineComponent as v, ref as h, watch as g, nextTick as w, createElementBlock as a, openBlock as t, mergeProps as V, createCommentVNode as i, createElementVNode as d, renderSlot as u, withModifiers as _ } from "vue";
|
|
3
|
+
const B = {
|
|
4
4
|
key: 0,
|
|
5
|
-
class: "
|
|
6
|
-
},
|
|
5
|
+
class: "_4d394b1507fdc584"
|
|
6
|
+
}, b = { class: "_088d860d2fd75292" }, C = { class: "_da3b3b2a4aeed1ee" }, k = /* @__PURE__ */ v({
|
|
7
7
|
__name: "DialogView.obf",
|
|
8
8
|
props: {
|
|
9
9
|
modelValue: { type: Boolean },
|
|
@@ -11,46 +11,50 @@ 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: c, emit: r }) {
|
|
15
|
+
const s = o, f = r, e = h(null), p = () => {
|
|
16
16
|
e.value && !e.value.open && e.value.showModal();
|
|
17
|
-
},
|
|
17
|
+
}, n = () => {
|
|
18
18
|
e.value && e.value.open && e.value.close();
|
|
19
19
|
}, m = () => {
|
|
20
|
-
s.modelValue &&
|
|
20
|
+
s.modelValue && f("update:modelValue", !1);
|
|
21
21
|
};
|
|
22
|
-
return
|
|
23
|
-
await
|
|
24
|
-
}),
|
|
22
|
+
return g(() => s.modelValue, async (l) => {
|
|
23
|
+
await w(), l ? e.value && !e.value.open && e.value.showModal() : e.value && e.value.open && e.value.close();
|
|
24
|
+
}), c({
|
|
25
25
|
open: p,
|
|
26
|
-
close:
|
|
27
|
-
}), (
|
|
26
|
+
close: n
|
|
27
|
+
}), (l, y) => (t(), a("dialog", V({
|
|
28
28
|
ref_key: "dialogRef",
|
|
29
29
|
ref: e,
|
|
30
|
-
class: "
|
|
31
|
-
},
|
|
32
|
-
o.showTitleBar ? (t(),
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
class: "_b4102a3b79656a37"
|
|
31
|
+
}, l.$attrs, { onClose: m }), [
|
|
32
|
+
o.showTitleBar ? (t(), a("div", B, [
|
|
33
|
+
d("span", b, [
|
|
34
|
+
u(l.$slots, "title")
|
|
35
35
|
]),
|
|
36
|
-
o.showCloseButton ? (t(),
|
|
36
|
+
o.showCloseButton ? (t(), a("a", {
|
|
37
37
|
key: 0,
|
|
38
38
|
href: "javascript:void(0)",
|
|
39
39
|
role: "button",
|
|
40
40
|
"aria-label": "Close the dialog",
|
|
41
|
-
class: "
|
|
42
|
-
onClick:
|
|
43
|
-
}, "×")) :
|
|
44
|
-
])) :
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
class: "_468ff1da37ead40a",
|
|
42
|
+
onClick: _(n, ["prevent"])
|
|
43
|
+
}, "×")) : i("", !0)
|
|
44
|
+
])) : i("", !0),
|
|
45
|
+
d("div", C, [
|
|
46
|
+
u(l.$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=\"_b4102a3b79656a37\"\n v-bind=\"$attrs\"\n @close=\"handleDialogClose\"\n >\n <div v-if=\"showTitleBar\" class=\"_4d394b1507fdc584\">\n <span class=\"_088d860d2fd75292\">\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=\"_468ff1da37ead40a\"\n @click.prevent=\"closeDialog\"\n >×</a>\n </div>\n <div class=\"_da3b3b2a4aeed1ee\">\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._b4102a3b79656a37 {\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._b4102a3b79656a37[open] {\n display: flex;\n flex-direction: column;\n}\n\n._b4102a3b79656a37::backdrop {\n background: rgba(0, 0, 0, 0.5);\n}\n\n._4d394b1507fdc584 {\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._088d860d2fd75292 {\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._468ff1da37ead40a {\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._468ff1da37ead40a:hover {\n color: #333;\n background-color: #f0f0f0;\n border-radius: 3px;\n}\n\n._da3b3b2a4aeed1ee {\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(".
|
|
2
|
-
(function(e
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._b4102a3b79656a37{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}._b4102a3b79656a37[open]{display:flex;flex-direction:column}._b4102a3b79656a37::backdrop{background:#00000080}._4d394b1507fdc584{display:flex;flex-direction:row;align-items:center;margin-bottom:.5em;min-height:24px;white-space:pre;overflow:hidden}._088d860d2fd75292{flex:1;text-align:center;font-weight:700;font-size:large;overflow:hidden;text-overflow:ellipsis}._468ff1da37ead40a{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}._468ff1da37ead40a:hover{color:#333;background-color:#f0f0f0;border-radius:3px}._da3b3b2a4aeed1ee{flex:1;overflow:auto;display:flex;flex-direction:column}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
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:"_4d394b1507fdc584"},r={class:"_088d860d2fd75292"},f={class:"_da3b3b2a4aeed1ee"},n=e.defineComponent({__name:"DialogView.obf",props:{modelValue:{type:Boolean},showTitleBar:{type:Boolean,default:!0},showCloseButton:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{expose:u,emit:p}){const s=t,m=p,o=e.ref(null),h=()=>{o.value&&!o.value.open&&o.value.showModal()},d=()=>{o.value&&o.value.open&&o.value.close()},g=()=>{s.modelValue&&m("update:modelValue",!1)};return e.watch(()=>s.modelValue,async a=>{await e.nextTick(),a?o.value&&!o.value.open&&o.value.showModal():o.value&&o.value.open&&o.value.close()}),u({open:h,close:d}),(a,V)=>(e.openBlock(),e.createElementBlock("dialog",e.mergeProps({ref_key:"dialogRef",ref:o,class:"_b4102a3b79656a37"},a.$attrs,{onClose:g}),[t.showTitleBar?(e.openBlock(),e.createElementBlock("div",c,[e.createElementVNode("span",r,[e.renderSlot(a.$slots,"title")]),t.showCloseButton?(e.openBlock(),e.createElementBlock("a",{key:0,href:"javascript:void(0)",role:"button","aria-label":"Close the dialog",class:"_468ff1da37ead40a",onClick:e.withModifiers(d,["prevent"])},"×")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",f,[e.renderSlot(a.$slots,"default")])],16))}}),i={install:t=>{t.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=\"_b4102a3b79656a37\"\n v-bind=\"$attrs\"\n @close=\"handleDialogClose\"\n >\n <div v-if=\"showTitleBar\" class=\"_4d394b1507fdc584\">\n <span class=\"_088d860d2fd75292\">\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=\"_468ff1da37ead40a\"\n @click.prevent=\"closeDialog\"\n >×</a>\n </div>\n <div class=\"_da3b3b2a4aeed1ee\">\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._b4102a3b79656a37 {\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._b4102a3b79656a37[open] {\n display: flex;\n flex-direction: column;\n}\n\n._b4102a3b79656a37::backdrop {\n background: rgba(0, 0, 0, 0.5);\n}\n\n._4d394b1507fdc584 {\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._088d860d2fd75292 {\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._468ff1da37ead40a {\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._468ff1da37ead40a:hover {\n color: #333;\n background-color: #f0f0f0;\n border-radius: 3px;\n}\n\n._da3b3b2a4aeed1ee {\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":"6jBAmCA,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,mBAAA,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,oBACL,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;
|
package/obfuscate-classes.mjs
CHANGED
|
@@ -3,8 +3,11 @@ import fs from 'fs';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import crypto from 'crypto';
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
const SRC_DIR = path.resolve('./src');
|
|
7
8
|
const OBF_SUFFIX = '.obf.vue';
|
|
9
|
+
const PROJECT_NAME = 'https://registry.npmjs.org/vue-dialog-view/';
|
|
10
|
+
const PROJECT_SCOPE = 'npm';
|
|
8
11
|
|
|
9
12
|
// ----------------------------
|
|
10
13
|
// 遍历 Vue 文件(跳过 .obf.vue)
|
|
@@ -22,11 +25,64 @@ function getVueFiles(dir) {
|
|
|
22
25
|
return files;
|
|
23
26
|
}
|
|
24
27
|
|
|
28
|
+
class CRC64 {
|
|
29
|
+
static ECMA182_POLY = 0xC96C5795D7870F42n;
|
|
30
|
+
static ISO3309_POLY = 0xD800000000000000n;
|
|
31
|
+
|
|
32
|
+
static table = null;
|
|
33
|
+
|
|
34
|
+
static initTable(poly = CRC64.ECMA182_POLY) {
|
|
35
|
+
if (CRC64.table) return;
|
|
36
|
+
|
|
37
|
+
CRC64.table = new Array(256);
|
|
38
|
+
for (let i = 0; i < 256; i++) {
|
|
39
|
+
let crc = BigInt(i);
|
|
40
|
+
for (let j = 0; j < 8; j++) {
|
|
41
|
+
if (crc & 1n) {
|
|
42
|
+
crc = (crc >> 1n) ^ poly;
|
|
43
|
+
} else {
|
|
44
|
+
crc = crc >> 1n;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
CRC64.table[i] = crc;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static calculate(data, initial = 0n, poly = CRC64.ECMA182_POLY) {
|
|
52
|
+
CRC64.initTable(poly);
|
|
53
|
+
|
|
54
|
+
let crc = initial;
|
|
55
|
+
|
|
56
|
+
if (typeof data === 'string') {
|
|
57
|
+
data = Buffer.from(data);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
for (let i = 0; i < data.length; i++) {
|
|
61
|
+
const index = Number((crc ^ BigInt(data[i])) & 0xFFn);
|
|
62
|
+
crc = (crc >> 8n) ^ CRC64.table[index];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return crc;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static calculateECMA182(data) {
|
|
69
|
+
return CRC64.calculate(data, 0n, CRC64.ECMA182_POLY);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static calculateISO3309(data) {
|
|
73
|
+
return CRC64.calculate(data, 0n, CRC64.ISO3309_POLY);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
25
77
|
// ----------------------------
|
|
26
78
|
// SHA256 混淆类名
|
|
27
79
|
// ----------------------------
|
|
28
80
|
function obfClass(name) {
|
|
29
|
-
|
|
81
|
+
const sha256 = crypto.createHash('sha256')
|
|
82
|
+
.update(PROJECT_SCOPE + '@' + PROJECT_NAME + '::' + name)
|
|
83
|
+
.digest();
|
|
84
|
+
|
|
85
|
+
return '_' + CRC64.calculateECMA182(sha256).toString(16).padStart(16, '0')
|
|
30
86
|
}
|
|
31
87
|
|
|
32
88
|
// ----------------------------
|
|
@@ -67,6 +123,8 @@ function replaceClasses(content, classMap) {
|
|
|
67
123
|
// 主程序
|
|
68
124
|
// ----------------------------
|
|
69
125
|
function main() {
|
|
126
|
+
const startTime = Date.now()
|
|
127
|
+
|
|
70
128
|
const vueFiles = getVueFiles(SRC_DIR);
|
|
71
129
|
const allClasses = new Set();
|
|
72
130
|
|
|
@@ -84,7 +142,7 @@ function main() {
|
|
|
84
142
|
const classMap = {};
|
|
85
143
|
classList.forEach(cls => { classMap[cls] = obfClass(cls); });
|
|
86
144
|
|
|
87
|
-
console.log('🔹
|
|
145
|
+
console.log('🔹 Obfuscation Map: ');
|
|
88
146
|
console.table(classMap);
|
|
89
147
|
|
|
90
148
|
// 替换并生成 .obf.vue 文件
|
|
@@ -97,7 +155,7 @@ function main() {
|
|
|
97
155
|
console.log(`✅ ${file} -> ${obfFile}`);
|
|
98
156
|
});
|
|
99
157
|
|
|
100
|
-
console.log('🎉
|
|
158
|
+
console.log('🎉 Obfuscate SUCCESSFUL in ' + ((Date.now() - startTime)) + 'ms');
|
|
101
159
|
}
|
|
102
160
|
|
|
103
161
|
main();
|
package/package.json
CHANGED
package/src/DialogView.obf.vue
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<dialog
|
|
3
3
|
ref="dialogRef"
|
|
4
|
-
class="
|
|
4
|
+
class="_b4102a3b79656a37"
|
|
5
5
|
v-bind="$attrs"
|
|
6
6
|
@close="handleDialogClose"
|
|
7
7
|
>
|
|
8
|
-
<div v-if="showTitleBar" class="
|
|
9
|
-
<span class="
|
|
8
|
+
<div v-if="showTitleBar" class="_4d394b1507fdc584">
|
|
9
|
+
<span class="_088d860d2fd75292">
|
|
10
10
|
<slot name="title"></slot>
|
|
11
11
|
</span>
|
|
12
12
|
<a
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
href="javascript:void(0)"
|
|
15
15
|
role="button"
|
|
16
16
|
aria-label="Close the dialog"
|
|
17
|
-
class="
|
|
17
|
+
class="_468ff1da37ead40a"
|
|
18
18
|
@click.prevent="closeDialog"
|
|
19
19
|
>×</a>
|
|
20
20
|
</div>
|
|
21
|
-
<div class="
|
|
21
|
+
<div class="_da3b3b2a4aeed1ee">
|
|
22
22
|
<slot></slot>
|
|
23
23
|
</div>
|
|
24
24
|
</dialog>
|
|
@@ -83,7 +83,7 @@ defineExpose({
|
|
|
83
83
|
</script>
|
|
84
84
|
|
|
85
85
|
<style>
|
|
86
|
-
.
|
|
86
|
+
._b4102a3b79656a37 {
|
|
87
87
|
padding: 20px;
|
|
88
88
|
border-radius: 5px;
|
|
89
89
|
border: 1px solid gray;
|
|
@@ -94,16 +94,16 @@ defineExpose({
|
|
|
94
94
|
overflow: hidden;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
.
|
|
97
|
+
._b4102a3b79656a37[open] {
|
|
98
98
|
display: flex;
|
|
99
99
|
flex-direction: column;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
.
|
|
102
|
+
._b4102a3b79656a37::backdrop {
|
|
103
103
|
background: rgba(0, 0, 0, 0.5);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
.
|
|
106
|
+
._4d394b1507fdc584 {
|
|
107
107
|
display: flex;
|
|
108
108
|
flex-direction: row;
|
|
109
109
|
align-items: center;
|
|
@@ -113,7 +113,7 @@ defineExpose({
|
|
|
113
113
|
overflow: hidden;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.
|
|
116
|
+
._088d860d2fd75292 {
|
|
117
117
|
flex: 1;
|
|
118
118
|
text-align: center;
|
|
119
119
|
font-weight: bold;
|
|
@@ -122,7 +122,7 @@ defineExpose({
|
|
|
122
122
|
text-overflow: ellipsis;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
.
|
|
125
|
+
._468ff1da37ead40a {
|
|
126
126
|
margin-left: 0.5em;
|
|
127
127
|
text-decoration: none;
|
|
128
128
|
color: #666;
|
|
@@ -138,13 +138,13 @@ defineExpose({
|
|
|
138
138
|
background: none;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
.
|
|
141
|
+
._468ff1da37ead40a:hover {
|
|
142
142
|
color: #333;
|
|
143
143
|
background-color: #f0f0f0;
|
|
144
144
|
border-radius: 3px;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
.
|
|
147
|
+
._da3b3b2a4aeed1ee {
|
|
148
148
|
flex: 1;
|
|
149
149
|
overflow: auto;
|
|
150
150
|
display: flex;
|
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