vue-dialog-view 1.2.1 → 1.4.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/README.md CHANGED
@@ -65,6 +65,7 @@ const showDialog = ref(false)
65
65
  | `modelValue` | `boolean` | **required** | Controls the visibility of the dialog |
66
66
  | `showTitleBar` | `boolean` | `true` | Whether to show the title bar |
67
67
  | `showCloseButton` | `boolean` | `true` | Whether to show the close button in title bar |
68
+ | `closable` | `boolean` | `true` | Control if the dialog can be closed **by the user** (programmatically close will always work) |
68
69
 
69
70
  ## Events
70
71
 
@@ -76,7 +77,8 @@ const showDialog = ref(false)
76
77
 
77
78
  | Slot | Description |
78
79
  |------|-------------|
79
- | `#title` | Content for the dialog title |
80
+ | `#title` | Content for the dialog title (optional) |
81
+ | `#footer` | Footer of the dialog (optional) |
80
82
  | `default` | Main content of the dialog |
81
83
 
82
84
  ## Methods
@@ -2,12 +2,14 @@ interface Props {
2
2
  modelValue: boolean;
3
3
  showTitleBar?: boolean;
4
4
  showCloseButton?: boolean;
5
+ closable?: boolean;
5
6
  }
6
7
  declare function __VLS_template(): {
7
8
  attrs: Partial<{}>;
8
9
  slots: {
9
10
  title?(_: {}): any;
10
11
  default?(_: {}): any;
12
+ footer?(_: {}): any;
11
13
  };
12
14
  refs: {
13
15
  dialogRef: HTMLDialogElement;
@@ -25,6 +27,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {
25
27
  }>, {
26
28
  showTitleBar: boolean;
27
29
  showCloseButton: boolean;
30
+ closable: boolean;
28
31
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
29
32
  dialogRef: HTMLDialogElement;
30
33
  }, HTMLDialogElement>;
@@ -1,59 +1,72 @@
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 _ = {
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}._61879ba330d9a71c{margin-top:.5em}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
+ import { defineComponent as v, ref as V, watch as g, nextTick as r, createElementBlock as t, openBlock as s, mergeProps as w, createCommentVNode as n, createElementVNode as c, renderSlot as d, withModifiers as _ } from "vue";
3
+ const b = {
4
4
  key: 0,
5
- class: "_f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619"
6
- }, B = { class: "_f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6" }, C = { class: "_3b2bdd19ddec80c5f0f162bc4b423dafa4f687f6f831e58742be40fb0e80838e" }, k = /* @__PURE__ */ m({
5
+ class: "_4d394b1507fdc584"
6
+ }, B = { class: "_088d860d2fd75292" }, y = { class: "_da3b3b2a4aeed1ee" }, k = {
7
+ key: 1,
8
+ class: "_61879ba330d9a71c"
9
+ }, C = /* @__PURE__ */ v({
7
10
  __name: "DialogView.obf",
8
11
  props: {
9
12
  modelValue: { type: Boolean },
10
13
  showTitleBar: { type: Boolean, default: !0 },
11
- showCloseButton: { type: Boolean, default: !0 }
14
+ showCloseButton: { type: Boolean, default: !0 },
15
+ closable: { type: Boolean, default: !0 }
12
16
  },
13
17
  emits: ["update:modelValue"],
14
- setup(o, { expose: f, emit: u }) {
15
- const s = o, r = u, e = v(null), b = () => {
16
- e.value && !e.value.open && e.value.showModal();
17
- }, c = () => {
18
- e.value && e.value.open && e.value.close();
19
- }, p = () => {
20
- s.modelValue && r("update:modelValue", !1);
18
+ setup(l, { expose: f, emit: p }) {
19
+ const a = l, i = p, e = V(null), m = () => {
20
+ i("update:modelValue", !0);
21
+ }, u = () => {
22
+ i("update:modelValue", !1);
23
+ }, h = () => {
24
+ if (!a.closable && a.modelValue) {
25
+ r(() => {
26
+ e.value && !e.value.open && e.value.showModal();
27
+ });
28
+ return;
29
+ }
30
+ a.modelValue && i("update:modelValue", !1);
21
31
  };
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();
32
+ return g(() => a.modelValue, async (o) => {
33
+ await r(), o ? e.value && !e.value.open && e.value.showModal() : e.value && e.value.open && e.value.close();
24
34
  }), f({
25
- open: b,
26
- close: c
27
- }), (a, y) => (t(), l("dialog", w({
35
+ open: m,
36
+ close: u
37
+ }), (o, D) => (s(), t("dialog", w({
28
38
  ref_key: "dialogRef",
29
39
  ref: e,
30
- class: "_0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f"
31
- }, a.$attrs, { onClose: p }), [
32
- o.showTitleBar ? (t(), l("div", _, [
33
- n("span", B, [
34
- i(a.$slots, "title")
40
+ class: "_b4102a3b79656a37"
41
+ }, o.$attrs, { onClose: h }), [
42
+ l.showTitleBar ? (s(), t("div", b, [
43
+ c("span", B, [
44
+ d(o.$slots, "title")
35
45
  ]),
36
- o.showCloseButton ? (t(), l("a", {
46
+ l.showCloseButton ? (s(), t("a", {
37
47
  key: 0,
38
48
  href: "javascript:void(0)",
39
49
  role: "button",
40
50
  "aria-label": "Close the dialog",
41
- class: "_2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c",
42
- onClick: V(c, ["prevent"])
43
- }, "×")) : d("", !0)
44
- ])) : d("", !0),
45
- n("div", C, [
46
- i(a.$slots, "default")
47
- ])
51
+ class: "_468ff1da37ead40a",
52
+ onClick: _(u, ["prevent"])
53
+ }, "×")) : n("", !0)
54
+ ])) : n("", !0),
55
+ c("div", y, [
56
+ d(o.$slots, "default")
57
+ ]),
58
+ o.$slots.footer ? (s(), t("div", k, [
59
+ d(o.$slots, "footer")
60
+ ])) : n("", !0)
48
61
  ], 16));
49
62
  }
50
63
  }), M = {
51
- install: (o) => {
52
- o.component("DialogView", k);
64
+ install: (l) => {
65
+ l.component("DialogView", C);
53
66
  }
54
67
  };
55
68
  export {
56
- k as DialogView,
69
+ C as DialogView,
57
70
  M as DialogViewPlugin,
58
71
  M as default
59
72
  };
@@ -1 +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;"}
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\n <div v-if=\"$slots.footer\" class=\"_61879ba330d9a71c\">\n <slot name=\"footer\"></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 closable?: boolean\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n showTitleBar: true,\n showCloseButton: true,\n closable: 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 emit('update:modelValue', true)\n}\n\nconst closeDialog = (): void => {\n emit('update:modelValue', false)\n}\n\nconst handleDialogClose = (): void => {\n if (!props.closable) {\n if (props.modelValue) {\n // not programmatically close\n // re-open the dialog\n nextTick(() => {\n if (dialogRef.value && !dialogRef.value.open) {\n dialogRef.value.showModal()\n }\n }) // Avoid using 'cancel' event because some browsers handle it incorrectly\n return;\n }\n }\n if (props.modelValue) {\n emit('update:modelValue', false)\n }\n}\n\nwatch(() => props.modelValue, async (newValue: boolean) => {\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\n._61879ba330d9a71c {\n margin-top: 0.5em;\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","nextTick","watch","newValue","__expose","_openBlock","_createElementBlock","_mergeProps","$attrs","_hoisted_1","_createElementVNode","_hoisted_2","_renderSlot","_ctx","_hoisted_3","$slots","_hoisted_4","DialogViewPlugin","app","DialogViewComponent"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,UAAMA,IAAQC,GAMRC,IAAOC,GAIPC,IAAYC,EAA8B,IAAI,GAE9CC,IAAa,MAAY;AAC7B,MAAAJ,EAAK,qBAAqB,EAAI;AAAA,IAChC,GAEMK,IAAc,MAAY;AAC9B,MAAAL,EAAK,qBAAqB,EAAK;AAAA,IACjC,GAEMM,IAAoB,MAAY;AACpC,UAAI,CAACR,EAAM,YACLA,EAAM,YAAY;AAGpB,QAAAS,EAAS,MAAM;AACb,UAAIL,EAAU,SAAS,CAACA,EAAU,MAAM,QACtCA,EAAU,MAAM,UAAA;AAAA,QAEpB,CAAC;AACD;AAAA,MACF;AAEF,MAAIJ,EAAM,cACRE,EAAK,qBAAqB,EAAK;AAAA,IAEnC;AAEA,WAAAQ,EAAM,MAAMV,EAAM,YAAY,OAAOW,MAAsB;AACzD,YAAMF,EAAA,GAEFE,IACEP,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,cA9FCM,EAAA,GAAAC,EA0BS,UA1BTC,EA0BS;AAAA,eAzBH;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;MAGJE,EAAAA,OAAO,UAAlBV,KAAAC,EAEM,OAFNU,GAEM;AAAA,QADJJ,EAA2BC,EAAA,QAAA,QAAA;AAAA,MAAA;;;ICpBpBI,IAA2B;AAAA,EACtC,SAAS,CAACC,MAAa;AACrB,IAAAA,EAAI,UAAU,cAAcC,CAAmB;AAAA,EACjD;AACF;"}
@@ -1,3 +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);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"}})}));
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}._61879ba330d9a71c{margin-top:.5em}")),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 r={key:0,class:"_4d394b1507fdc584"},f={class:"_088d860d2fd75292"},u={class:"_da3b3b2a4aeed1ee"},m={key:1,class:"_61879ba330d9a71c"},i=e.defineComponent({__name:"DialogView.obf",props:{modelValue:{type:Boolean},showTitleBar:{type:Boolean,default:!0},showCloseButton:{type:Boolean,default:!0},closable:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(a,{expose:p,emit:V}){const n=a,s=V,o=e.ref(null),h=()=>{s("update:modelValue",!0)},c=()=>{s("update:modelValue",!1)},g=()=>{if(!n.closable&&n.modelValue){e.nextTick(()=>{o.value&&!o.value.open&&o.value.showModal()});return}n.modelValue&&s("update:modelValue",!1)};return e.watch(()=>n.modelValue,async t=>{await e.nextTick(),t?o.value&&!o.value.open&&o.value.showModal():o.value&&o.value.open&&o.value.close()}),p({open:h,close:c}),(t,B)=>(e.openBlock(),e.createElementBlock("dialog",e.mergeProps({ref_key:"dialogRef",ref:o,class:"_b4102a3b79656a37"},t.$attrs,{onClose:g}),[a.showTitleBar?(e.openBlock(),e.createElementBlock("div",r,[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:"_468ff1da37ead40a",onClick:e.withModifiers(c,["prevent"])},"×")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",u,[e.renderSlot(t.$slots,"default")]),t.$slots.footer?(e.openBlock(),e.createElementBlock("div",m,[e.renderSlot(t.$slots,"footer")])):e.createCommentVNode("",!0)],16))}}),d={install:a=>{a.component("DialogView",i)}};l.DialogView=i,l.DialogViewPlugin=d,l.default=d,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
3
3
  //# sourceMappingURL=dialog-view.umd.js.map
@@ -1 +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"}
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\n <div v-if=\"$slots.footer\" class=\"_61879ba330d9a71c\">\n <slot name=\"footer\"></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 closable?: boolean\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n showTitleBar: true,\n showCloseButton: true,\n closable: 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 emit('update:modelValue', true)\n}\n\nconst closeDialog = (): void => {\n emit('update:modelValue', false)\n}\n\nconst handleDialogClose = (): void => {\n if (!props.closable) {\n if (props.modelValue) {\n // not programmatically close\n // re-open the dialog\n nextTick(() => {\n if (dialogRef.value && !dialogRef.value.open) {\n dialogRef.value.showModal()\n }\n }) // Avoid using 'cancel' event because some browsers handle it incorrectly\n return;\n }\n }\n if (props.modelValue) {\n emit('update:modelValue', false)\n }\n}\n\nwatch(() => props.modelValue, async (newValue: boolean) => {\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\n._61879ba330d9a71c {\n margin-top: 0.5em;\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","nextTick","watch","newValue","__expose","_openBlock","_createElementBlock","_mergeProps","$attrs","_hoisted_1","_createElementVNode","_hoisted_2","_renderSlot","_ctx","_hoisted_3","$slots","_hoisted_4","DialogViewPlugin","app","DialogViewComponent"],"mappings":"ooBAwCA,MAAMA,EAAQC,EAMRC,EAAOC,EAIPC,EAAYC,EAAAA,IAA8B,IAAI,EAE9CC,EAAa,IAAY,CAC7BJ,EAAK,oBAAqB,EAAI,CAChC,EAEMK,EAAc,IAAY,CAC9BL,EAAK,oBAAqB,EAAK,CACjC,EAEMM,EAAoB,IAAY,CACpC,GAAI,CAACR,EAAM,UACLA,EAAM,WAAY,CAGpBS,EAAAA,SAAS,IAAM,CACTL,EAAU,OAAS,CAACA,EAAU,MAAM,MACtCA,EAAU,MAAM,UAAA,CAEpB,CAAC,EACD,MACF,CAEEJ,EAAM,YACRE,EAAK,oBAAqB,EAAK,CAEnC,EAEAQ,OAAAA,EAAAA,MAAM,IAAMV,EAAM,WAAY,MAAOW,GAAsB,CACzD,MAAMF,WAAA,EAEFE,EACEP,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,UA9FCM,YAAA,EAAAC,qBA0BS,SA1BTC,EAAAA,WA0BS,SAzBH,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,GAGJE,EAAAA,OAAO,QAAlBV,EAAAA,YAAAC,EAAAA,mBAEM,MAFNU,EAEM,CADJJ,aAA2BC,EAAA,OAAA,QAAA,CAAA,yCCpBpBI,EAA2B,CACtC,QAAUC,GAAa,CACrBA,EAAI,UAAU,aAAcC,CAAmB,CACjD,CACF"}
@@ -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
- return '_' + crypto.createHash('sha256').update(name).digest('hex')
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-dialog-view",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
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",
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <dialog
3
3
  ref="dialogRef"
4
- class="_0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f"
4
+ class="_b4102a3b79656a37"
5
5
  v-bind="$attrs"
6
6
  @close="handleDialogClose"
7
7
  >
8
- <div v-if="showTitleBar" class="_f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619">
9
- <span class="_f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6">
8
+ <div v-if="showTitleBar" class="_4d394b1507fdc584">
9
+ <span class="_088d860d2fd75292">
10
10
  <slot name="title"></slot>
11
11
  </span>
12
12
  <a
@@ -14,13 +14,17 @@
14
14
  href="javascript:void(0)"
15
15
  role="button"
16
16
  aria-label="Close the dialog"
17
- class="_2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c"
17
+ class="_468ff1da37ead40a"
18
18
  @click.prevent="closeDialog"
19
19
  >×</a>
20
20
  </div>
21
- <div class="_3b2bdd19ddec80c5f0f162bc4b423dafa4f687f6f831e58742be40fb0e80838e">
21
+ <div class="_da3b3b2a4aeed1ee">
22
22
  <slot></slot>
23
23
  </div>
24
+
25
+ <div v-if="$slots.footer" class="_61879ba330d9a71c">
26
+ <slot name="footer"></slot>
27
+ </div>
24
28
  </dialog>
25
29
  </template>
26
30
 
@@ -31,11 +35,13 @@ interface Props {
31
35
  modelValue: boolean
32
36
  showTitleBar?: boolean
33
37
  showCloseButton?: boolean
38
+ closable?: boolean
34
39
  }
35
40
 
36
41
  const props = withDefaults(defineProps<Props>(), {
37
42
  showTitleBar: true,
38
- showCloseButton: true
43
+ showCloseButton: true,
44
+ closable: true,
39
45
  })
40
46
 
41
47
  const emit = defineEmits<{
@@ -45,24 +51,32 @@ const emit = defineEmits<{
45
51
  const dialogRef = ref<HTMLDialogElement | null>(null)
46
52
 
47
53
  const openDialog = (): void => {
48
- if (dialogRef.value && !dialogRef.value.open) {
49
- dialogRef.value.showModal()
50
- }
54
+ emit('update:modelValue', true)
51
55
  }
52
56
 
53
57
  const closeDialog = (): void => {
54
- if (dialogRef.value && dialogRef.value.open) {
55
- dialogRef.value.close()
56
- }
58
+ emit('update:modelValue', false)
57
59
  }
58
60
 
59
61
  const handleDialogClose = (): void => {
62
+ if (!props.closable) {
63
+ if (props.modelValue) {
64
+ // not programmatically close
65
+ // re-open the dialog
66
+ nextTick(() => {
67
+ if (dialogRef.value && !dialogRef.value.open) {
68
+ dialogRef.value.showModal()
69
+ }
70
+ }) // Avoid using 'cancel' event because some browsers handle it incorrectly
71
+ return;
72
+ }
73
+ }
60
74
  if (props.modelValue) {
61
75
  emit('update:modelValue', false)
62
76
  }
63
77
  }
64
78
 
65
- watch(() => props.modelValue, async (newValue) => {
79
+ watch(() => props.modelValue, async (newValue: boolean) => {
66
80
  await nextTick()
67
81
 
68
82
  if (newValue) {
@@ -83,7 +97,7 @@ defineExpose({
83
97
  </script>
84
98
 
85
99
  <style>
86
- ._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f {
100
+ ._b4102a3b79656a37 {
87
101
  padding: 20px;
88
102
  border-radius: 5px;
89
103
  border: 1px solid gray;
@@ -94,16 +108,16 @@ defineExpose({
94
108
  overflow: hidden;
95
109
  }
96
110
 
97
- ._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f[open] {
111
+ ._b4102a3b79656a37[open] {
98
112
  display: flex;
99
113
  flex-direction: column;
100
114
  }
101
115
 
102
- ._0e414b08e017324be9d8055e33e9e57a5d618fd64445845aa3d1c9c71a1cf19f::backdrop {
116
+ ._b4102a3b79656a37::backdrop {
103
117
  background: rgba(0, 0, 0, 0.5);
104
118
  }
105
119
 
106
- ._f1bcbda2e971453cc116bd5c6d4a303f38ac3e0618c26210b206271398b2f619 {
120
+ ._4d394b1507fdc584 {
107
121
  display: flex;
108
122
  flex-direction: row;
109
123
  align-items: center;
@@ -113,7 +127,7 @@ defineExpose({
113
127
  overflow: hidden;
114
128
  }
115
129
 
116
- ._f365dae0582379d563ee03ab860c73c916d68f096a41a8bd34e05e566987b1f6 {
130
+ ._088d860d2fd75292 {
117
131
  flex: 1;
118
132
  text-align: center;
119
133
  font-weight: bold;
@@ -122,7 +136,7 @@ defineExpose({
122
136
  text-overflow: ellipsis;
123
137
  }
124
138
 
125
- ._2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c {
139
+ ._468ff1da37ead40a {
126
140
  margin-left: 0.5em;
127
141
  text-decoration: none;
128
142
  color: #666;
@@ -138,16 +152,20 @@ defineExpose({
138
152
  background: none;
139
153
  }
140
154
 
141
- ._2b0f1321796c8091f668958929ed738b53afcb63d79387dc52ddc75b55ffb46c:hover {
155
+ ._468ff1da37ead40a:hover {
142
156
  color: #333;
143
157
  background-color: #f0f0f0;
144
158
  border-radius: 3px;
145
159
  }
146
160
 
147
- ._3b2bdd19ddec80c5f0f162bc4b423dafa4f687f6f831e58742be40fb0e80838e {
161
+ ._da3b3b2a4aeed1ee {
148
162
  flex: 1;
149
163
  overflow: auto;
150
164
  display: flex;
151
165
  flex-direction: column;
152
166
  }
167
+
168
+ ._61879ba330d9a71c {
169
+ margin-top: 0.5em;
170
+ }
153
171
  </style>
@@ -21,6 +21,10 @@
21
21
  <div class="dialog-content">
22
22
  <slot></slot>
23
23
  </div>
24
+
25
+ <div v-if="$slots.footer" class="dialog-footer">
26
+ <slot name="footer"></slot>
27
+ </div>
24
28
  </dialog>
25
29
  </template>
26
30
 
@@ -31,11 +35,13 @@ interface Props {
31
35
  modelValue: boolean
32
36
  showTitleBar?: boolean
33
37
  showCloseButton?: boolean
38
+ closable?: boolean
34
39
  }
35
40
 
36
41
  const props = withDefaults(defineProps<Props>(), {
37
42
  showTitleBar: true,
38
- showCloseButton: true
43
+ showCloseButton: true,
44
+ closable: true,
39
45
  })
40
46
 
41
47
  const emit = defineEmits<{
@@ -45,24 +51,32 @@ const emit = defineEmits<{
45
51
  const dialogRef = ref<HTMLDialogElement | null>(null)
46
52
 
47
53
  const openDialog = (): void => {
48
- if (dialogRef.value && !dialogRef.value.open) {
49
- dialogRef.value.showModal()
50
- }
54
+ emit('update:modelValue', true)
51
55
  }
52
56
 
53
57
  const closeDialog = (): void => {
54
- if (dialogRef.value && dialogRef.value.open) {
55
- dialogRef.value.close()
56
- }
58
+ emit('update:modelValue', false)
57
59
  }
58
60
 
59
61
  const handleDialogClose = (): void => {
62
+ if (!props.closable) {
63
+ if (props.modelValue) {
64
+ // not programmatically close
65
+ // re-open the dialog
66
+ nextTick(() => {
67
+ if (dialogRef.value && !dialogRef.value.open) {
68
+ dialogRef.value.showModal()
69
+ }
70
+ }) // Avoid using 'cancel' event because some browsers handle it incorrectly
71
+ return;
72
+ }
73
+ }
60
74
  if (props.modelValue) {
61
75
  emit('update:modelValue', false)
62
76
  }
63
77
  }
64
78
 
65
- watch(() => props.modelValue, async (newValue) => {
79
+ watch(() => props.modelValue, async (newValue: boolean) => {
66
80
  await nextTick()
67
81
 
68
82
  if (newValue) {
@@ -150,4 +164,8 @@ defineExpose({
150
164
  display: flex;
151
165
  flex-direction: column;
152
166
  }
167
+
168
+ .dialog-footer {
169
+ margin-top: 0.5em;
170
+ }
153
171
  </style>