vue-dialog-view 1.5.2 → 1.6.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.
@@ -0,0 +1,40 @@
1
+ interface Props {
2
+ modelValue: boolean;
3
+ showTitleBar?: boolean;
4
+ showCloseButton?: boolean;
5
+ closable?: boolean;
6
+ }
7
+ declare function __VLS_template(): {
8
+ attrs: Partial<{}>;
9
+ slots: {
10
+ title?(_: {}): any;
11
+ default?(_: {}): any;
12
+ footer?(_: {}): any;
13
+ };
14
+ refs: {
15
+ dialogRef: HTMLDialogElement;
16
+ };
17
+ rootEl: HTMLDialogElement;
18
+ };
19
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
20
+ declare const __VLS_component: import('vue').DefineComponent<Props, {
21
+ open: () => void;
22
+ close: () => void;
23
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
24
+ "update:modelValue": (value: boolean) => any;
25
+ }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
26
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
27
+ }>, {
28
+ showTitleBar: boolean;
29
+ showCloseButton: boolean;
30
+ closable: boolean;
31
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
32
+ dialogRef: HTMLDialogElement;
33
+ }, HTMLDialogElement>;
34
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
35
+ export default _default;
36
+ type __VLS_WithTemplateSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -0,0 +1,4 @@
1
+ import { Plugin } from 'vue';
2
+ export { default as DialogView } from './DialogView.vue';
3
+ export declare const DialogViewPlugin: Plugin;
4
+ export default DialogViewPlugin;
@@ -0,0 +1,74 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dialog-view{padding:var(--dialog-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}.dialog-view[open]{display:flex;flex-direction:column}.dialog-view::backdrop{background:#00000080}.dialog-title-bar{display:flex;flex-direction:row;align-items:center;margin-bottom:.5em;min-height:var(--dialog-title-height, 24px);white-space:pre;overflow:hidden;-webkit-user-select:none;user-select:none}.dialog-title{flex:1;text-align:center;font-weight:700;font-size:large;overflow:hidden;text-overflow:ellipsis}.dialog-close-button{margin-left:.5em;text-decoration:none;color:#666;font-size:1.5em;line-height:1;width:24px;height:24px;padding:10px;display:flex;align-items:center;justify-content:center;cursor:pointer;border:none;background:none}.dialog-close-button:hover{color:#333;background-color:#f0f0f0;border-radius:3px}.dialog-close-button:focus-visible{outline:2px solid rgb(160,207,255);outline-offset:-2px}.dialog-content{flex:1;overflow:auto;display:flex;flex-direction:column}.dialog-footer{margin-top:.5em}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
+ import { defineComponent as w, ref as V, watch as h, nextTick as r, onMounted as y, createElementBlock as a, openBlock as s, mergeProps as B, createCommentVNode as n, createElementVNode as c, renderSlot as u, withModifiers as b } from "vue";
3
+ const k = {
4
+ key: 0,
5
+ class: "dialog-title-bar"
6
+ }, C = { class: "dialog-title" }, D = { class: "dialog-content" }, $ = {
7
+ key: 1,
8
+ class: "dialog-footer"
9
+ }, M = /* @__PURE__ */ w({
10
+ __name: "DialogView",
11
+ props: {
12
+ modelValue: { type: Boolean },
13
+ showTitleBar: { type: Boolean, default: !0 },
14
+ showCloseButton: { type: Boolean, default: !0 },
15
+ closable: { type: Boolean, default: !0 }
16
+ },
17
+ emits: ["update:modelValue"],
18
+ setup(l, { expose: f, emit: m }) {
19
+ const t = l, i = m, e = V(null), p = () => {
20
+ i("update:modelValue", !0);
21
+ }, g = () => {
22
+ i("update:modelValue", !1);
23
+ }, v = () => {
24
+ if (!t.closable && t.modelValue) {
25
+ r(() => {
26
+ e.value && !e.value.open && e.value.showModal();
27
+ });
28
+ return;
29
+ }
30
+ t.modelValue && i("update:modelValue", !1);
31
+ };
32
+ return h(() => t.modelValue, async (o) => {
33
+ await r(), o ? e.value && !e.value.open && e.value.showModal() : e.value && e.value.open && e.value.close();
34
+ }), y(() => {
35
+ t.modelValue && e.value && !e.value.open && e.value.showModal();
36
+ }), f({
37
+ open: p,
38
+ close: g
39
+ }), (o, d) => (s(), a("dialog", B({
40
+ ref_key: "dialogRef",
41
+ ref: e,
42
+ class: "dialog-view"
43
+ }, o.$attrs, { onClose: v }), [
44
+ l.showTitleBar ? (s(), a("div", k, [
45
+ c("span", C, [
46
+ u(o.$slots, "title")
47
+ ]),
48
+ l.showCloseButton && l.closable ? (s(), a("button", {
49
+ key: 0,
50
+ type: "button",
51
+ "aria-label": "Close the dialog",
52
+ class: "dialog-close-button",
53
+ onClick: d[0] || (d[0] = b((T) => e.value?.close(), ["prevent"]))
54
+ }, "×")) : n("", !0)
55
+ ])) : n("", !0),
56
+ c("div", D, [
57
+ u(o.$slots, "default")
58
+ ]),
59
+ o.$slots.footer ? (s(), a("div", $, [
60
+ u(o.$slots, "footer")
61
+ ])) : n("", !0)
62
+ ], 16));
63
+ }
64
+ }), N = {
65
+ install: (l) => {
66
+ l.component("DialogView", M);
67
+ }
68
+ };
69
+ export {
70
+ M as DialogView,
71
+ N as DialogViewPlugin,
72
+ N as default
73
+ };
74
+ //# sourceMappingURL=unobfuscated.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unobfuscated.es.js","sources":["../src/DialogView.vue","../src/unobfuscated.ts"],"sourcesContent":["<template>\n <dialog\n ref=\"dialogRef\"\n class=\"dialog-view\"\n v-bind=\"$attrs\"\n @close=\"handleDialogClose\"\n >\n <div v-if=\"showTitleBar\" class=\"dialog-title-bar\">\n <span class=\"dialog-title\">\n <slot name=\"title\"></slot>\n </span>\n <button\n v-if=\"showCloseButton && closable\"\n type=\"button\"\n aria-label=\"Close the dialog\"\n class=\"dialog-close-button\"\n @click.prevent=\"dialogRef?.close()\"\n >&times;</button>\n </div>\n \n <div class=\"dialog-content\">\n <slot></slot>\n </div>\n\n <div v-if=\"$slots.footer\" class=\"dialog-footer\">\n <slot name=\"footer\"></slot>\n </div>\n </dialog>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, nextTick, onMounted } 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\nonMounted(() => {\n if (props.modelValue) {\n if (dialogRef.value && !dialogRef.value.open) {\n dialogRef.value.showModal()\n }\n }\n})\n\ndefineExpose({\n open: openDialog,\n close: closeDialog,\n})\n</script>\n\n<style>\n.dialog-view {\n padding: var(--dialog-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.dialog-view[open] {\n display: flex;\n flex-direction: column;\n}\n\n.dialog-view::backdrop {\n background: rgba(0, 0, 0, 0.5);\n}\n\n.dialog-title-bar {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 0.5em;\n min-height: var(--dialog-title-height, 24px);\n white-space: pre;\n overflow: hidden;\n user-select: none;\n}\n\n.dialog-title {\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.dialog-close-button {\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 padding: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n border: none;\n background: none;\n}\n\n.dialog-close-button:hover {\n color: #333;\n background-color: #f0f0f0;\n border-radius: 3px;\n}\n\n.dialog-close-button:focus-visible {\n outline: 2px solid rgb(160, 207, 255);\n outline-offset: -2px;\n}\n\n.dialog-content {\n flex: 1;\n overflow: auto;\n display: flex;\n flex-direction: column;\n}\n\n.dialog-footer {\n margin-top: 0.5em;\n}\n</style>","import { App, Plugin } from 'vue'\nimport DialogViewComponent from './DialogView.vue'\n\nexport { default as DialogView } from './DialogView.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","onMounted","__expose","_openBlock","_createElementBlock","_mergeProps","$attrs","_hoisted_1","_createElementVNode","_hoisted_2","_renderSlot","_ctx","_cache","_withModifiers","$event","_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,MA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CAAA;AAAA,QAAA,GACjC,GAAO;;MAGVe,EAEM,OAFNO,GAEM;AAAA,QADJL,EAAaC,EAAA,QAAA,SAAA;AAAA,MAAA;MAGJK,EAAAA,OAAO,UAAlBb,KAAAC,EAEM,OAFNa,GAEM;AAAA,QADJP,EAA2BC,EAAA,QAAA,QAAA;AAAA,MAAA;;;ICpBpBO,IAA2B;AAAA,EACtC,SAAS,CAACC,MAAa;AACrB,IAAAA,EAAI,UAAU,cAAcC,CAAmB;AAAA,EACjD;AACF;"}
@@ -0,0 +1,3 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dialog-view{padding:var(--dialog-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}.dialog-view[open]{display:flex;flex-direction:column}.dialog-view::backdrop{background:#00000080}.dialog-title-bar{display:flex;flex-direction:row;align-items:center;margin-bottom:.5em;min-height:var(--dialog-title-height, 24px);white-space:pre;overflow:hidden;-webkit-user-select:none;user-select:none}.dialog-title{flex:1;text-align:center;font-weight:700;font-size:large;overflow:hidden;text-overflow:ellipsis}.dialog-close-button{margin-left:.5em;text-decoration:none;color:#666;font-size:1.5em;line-height:1;width:24px;height:24px;padding:10px;display:flex;align-items:center;justify-content:center;cursor:pointer;border:none;background:none}.dialog-close-button:hover{color:#333;background-color:#f0f0f0;border-radius:3px}.dialog-close-button:focus-visible{outline:2px solid rgb(160,207,255);outline-offset:-2px}.dialog-content{flex:1;overflow:auto;display:flex;flex-direction:column}.dialog-footer{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:"dialog-title-bar"},u={class:"dialog-title"},f={class:"dialog-content"},m={key:1,class:"dialog-footer"},s=e.defineComponent({__name:"DialogView",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:g}){const n=a,i=g,o=e.ref(null),V=()=>{i("update:modelValue",!0)},h=()=>{i("update:modelValue",!1)},w=()=>{if(!n.closable&&n.modelValue){e.nextTick(()=>{o.value&&!o.value.open&&o.value.showModal()});return}n.modelValue&&i("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()}),e.onMounted(()=>{n.modelValue&&o.value&&!o.value.open&&o.value.showModal()}),p({open:V,close:h}),(t,c)=>(e.openBlock(),e.createElementBlock("dialog",e.mergeProps({ref_key:"dialogRef",ref:o,class:"dialog-view"},t.$attrs,{onClose:w}),[a.showTitleBar?(e.openBlock(),e.createElementBlock("div",r,[e.createElementVNode("span",u,[e.renderSlot(t.$slots,"title")]),a.showCloseButton&&a.closable?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button","aria-label":"Close the dialog",class:"dialog-close-button",onClick:c[0]||(c[0]=e.withModifiers(B=>o.value?.close(),["prevent"]))},"×")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",f,[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",s)}};l.DialogView=s,l.DialogViewPlugin=d,l.default=d,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
3
+ //# sourceMappingURL=unobfuscated.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unobfuscated.umd.js","sources":["../src/DialogView.vue","../src/unobfuscated.ts"],"sourcesContent":["<template>\n <dialog\n ref=\"dialogRef\"\n class=\"dialog-view\"\n v-bind=\"$attrs\"\n @close=\"handleDialogClose\"\n >\n <div v-if=\"showTitleBar\" class=\"dialog-title-bar\">\n <span class=\"dialog-title\">\n <slot name=\"title\"></slot>\n </span>\n <button\n v-if=\"showCloseButton && closable\"\n type=\"button\"\n aria-label=\"Close the dialog\"\n class=\"dialog-close-button\"\n @click.prevent=\"dialogRef?.close()\"\n >&times;</button>\n </div>\n \n <div class=\"dialog-content\">\n <slot></slot>\n </div>\n\n <div v-if=\"$slots.footer\" class=\"dialog-footer\">\n <slot name=\"footer\"></slot>\n </div>\n </dialog>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, nextTick, onMounted } 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\nonMounted(() => {\n if (props.modelValue) {\n if (dialogRef.value && !dialogRef.value.open) {\n dialogRef.value.showModal()\n }\n }\n})\n\ndefineExpose({\n open: openDialog,\n close: closeDialog,\n})\n</script>\n\n<style>\n.dialog-view {\n padding: var(--dialog-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.dialog-view[open] {\n display: flex;\n flex-direction: column;\n}\n\n.dialog-view::backdrop {\n background: rgba(0, 0, 0, 0.5);\n}\n\n.dialog-title-bar {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 0.5em;\n min-height: var(--dialog-title-height, 24px);\n white-space: pre;\n overflow: hidden;\n user-select: none;\n}\n\n.dialog-title {\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.dialog-close-button {\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 padding: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n border: none;\n background: none;\n}\n\n.dialog-close-button:hover {\n color: #333;\n background-color: #f0f0f0;\n border-radius: 3px;\n}\n\n.dialog-close-button:focus-visible {\n outline: 2px solid rgb(160, 207, 255);\n outline-offset: -2px;\n}\n\n.dialog-content {\n flex: 1;\n overflow: auto;\n display: flex;\n flex-direction: column;\n}\n\n.dialog-footer {\n margin-top: 0.5em;\n}\n</style>","import { App, Plugin } from 'vue'\nimport DialogViewComponent from './DialogView.vue'\n\nexport { default as DialogView } from './DialogView.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","onMounted","__expose","_openBlock","_createElementBlock","_mergeProps","$attrs","_hoisted_1","_createElementVNode","_hoisted_2","_renderSlot","_ctx","_cache","_withModifi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,MAAM,sBACL,QAAKQ,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAC,EAAAA,cAAAC,GAAUrB,EAAA,OAAW,MAAA,EAAK,CAAA,SAAA,CAAA,EAAA,EACjC,GAAO,8DAGVe,EAAAA,mBAEM,MAFNO,EAEM,CADJL,aAAaC,EAAA,OAAA,SAAA,CAAA,GAGJK,EAAAA,OAAO,QAAlBb,EAAAA,YAAAC,EAAAA,mBAEM,MAFNa,EAEM,CADJP,aAA2BC,EAAA,OAAA,QAAA,CAAA,yCCpBpBO,EAA2B,CACtC,QAAUC,GAAa,CACrBA,EAAI,UAAU,aAAcC,CAAmB,CACjD,CACF"}
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-dialog-view",
3
- "version": "1.5.2",
3
+ "version": "1.6.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",
@@ -11,6 +11,11 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "import": "./dist/dialog-view.es.js",
13
13
  "require": "./dist/dialog-view.umd.js"
14
+ },
15
+ "./unobfuscated": {
16
+ "types": "./dist/unobfuscated.d.ts",
17
+ "import": "./dist/unobfuscated.es.js",
18
+ "require": "./dist/unobfuscated.umd.js"
14
19
  }
15
20
  },
16
21
  "files": [
@@ -27,7 +32,9 @@
27
32
  "clean": "rimraf dist",
28
33
  "obfuscate": "node ./obfuscate-classes.mjs",
29
34
  "build": "npm run clean && npm run obfuscate && npm run build-only",
30
- "build-only": "vue-tsc --noEmit && vite build",
35
+ "build-only": "npm run build-only:normal && npm run build-only:unobfuscated",
36
+ "build-only:normal": "vue-tsc --noEmit && vite build",
37
+ "build-only:unobfuscated": "vue-tsc --noEmit && vite build --mode unobfuscated",
31
38
  "preview": "vite preview"
32
39
  },
33
40
  "peerDependencies": {
@@ -0,0 +1,12 @@
1
+ import { App, Plugin } from 'vue'
2
+ import DialogViewComponent from './DialogView.vue'
3
+
4
+ export { default as DialogView } from './DialogView.vue'
5
+
6
+ export const DialogViewPlugin: Plugin = {
7
+ install: (app: App) => {
8
+ app.component('DialogView', DialogViewComponent)
9
+ }
10
+ }
11
+
12
+ export default DialogViewPlugin
package/vite.config.ts CHANGED
@@ -4,7 +4,7 @@ import { fileURLToPath, URL } from 'node:url'
4
4
  import dts from 'vite-plugin-dts'
5
5
  import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
6
6
 
7
- export default defineConfig({
7
+ const config = ({
8
8
  plugins: [
9
9
  vue(),
10
10
  cssInjectedByJsPlugin(),
@@ -14,9 +14,10 @@ export default defineConfig({
14
14
  ],
15
15
  build: {
16
16
  lib: {
17
- entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
17
+ entry: null,
18
18
  name: 'DialogView',
19
- fileName: (format) => `dialog-view.${format}.js`
19
+ fileName: () => { throw new Error('stub function') },
20
+ formats: ['umd', 'es'],
20
21
  },
21
22
  rollupOptions: {
22
23
  external: ['vue'],
@@ -28,10 +29,22 @@ export default defineConfig({
28
29
  },
29
30
  },
30
31
  sourcemap: true,
32
+ emptyOutDir: false,
31
33
  },
32
34
  css: {
33
35
  modules: {
34
36
  generateScopedName: '[hash:sha256]',
35
37
  },
36
38
  },
37
- })
39
+ });
40
+
41
+ export default defineConfig(({ mode }) => {
42
+ if (mode === 'unobfuscated') {
43
+ config.build.lib.entry = fileURLToPath(new URL('./src/unobfuscated.ts', import.meta.url));
44
+ config.build.lib.fileName = _ => `unobfuscated.${_}.js`;
45
+ } else {
46
+ config.build.lib.entry = fileURLToPath(new URL('./src/index.ts', import.meta.url));
47
+ config.build.lib.fileName = _ => `dialog-view.${_}.js`;
48
+ }
49
+ return defineConfig(config);
50
+ })