@vtj/ui 0.4.5 → 0.5.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/cdn/index.js +1 -1
- package/lib/index.js +108 -107
- package/package.json +6 -6
- package/types/components/shared.d.ts +1 -0
- package/types/components/simple-mask/SimpleMask.d.ts +6 -0
package/cdn/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(l,f){typeof exports=="object"&&typeof module!="undefined"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(l=typeof globalThis!="undefined"?globalThis:l||self,f(l.VtjUI={}))})(this,function(l){"use strict";var ee=Object.defineProperty;var A=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var x=(l,f,p)=>f in l?ee(l,f,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[f]=p,I=(l,f)=>{for(var p in f||(f={}))te.call(f,p)&&x(l,p,f[p]);if(A)for(var p of A(f))ne.call(f,p)&&x(l,p,f[p]);return l};const f="";function p(e){return typeof e=="string"?e:`${e}px`}function R(e=0,t){if(typeof e=="number")return e;if(/(%|vh|vw)$/i.test(e)){const u=Number.parseInt(e);return t*u/100}return Number.parseInt(e)}function N(e,t){const n={};return Object.keys(e).forEach(u=>{t.includes(u)||(n[u]=e[u])}),n}function j(e,t){const n={};return Object.keys(e).forEach(u=>{t.includes(u)&&(n[u]=e[u])}),n}const C=()=>{},O=(e,t)=>{if(e.install=n=>{for(const u of[e,...Object.values(t!=null?t:{})])typeof u=="function"?n.use(u):u.name&&n.component(u.name,u)},t)for(const[n,u]of Object.entries(t))e[n]=u;return e},T=(e,t)=>(e.install=n=>{e._context=n._context,n.config.globalProperties[t]=e},e),X=(e,t)=>(e.install=n=>{n.directive(t,e)},e),U=e=>(e.install=C,e),S=Symbol("INSTALLED_KEY"),E="is-dragging",k="is-resizing",B=(e=[])=>({install:n=>{n[S]||(n[S]=!0,e.forEach(u=>n.use(u)))}}),G={class:"x-startup"},b=Vue.defineComponent({name:"XStartup",__name:"Startup",props:{text:{default:"Hello VTJ."}},setup(e){const t=e;return(n,u)=>(Vue.openBlock(),Vue.createElementBlock("div",G,[Vue.renderSlot(n.$slots,"default",{},()=>[Vue.createElementVNode("span",null,Vue.toDisplayString(t.text),1)])]))}}),ue="",M={default:14,small:12,large:18},P={icon:{type:[String,Object]},color:{type:String},size:{type:[Number,String],default:"inherit"},src:{type:String},disabled:{type:Boolean}},H=["src"],_=Vue.defineComponent({name:"XIcon",__name:"Icon",props:P,setup(e){const t=e,n=Vue.useAttrs(),u=Vue.computed(()=>typeof t.icon=="object"?Vue.markRaw(t.icon):null),r=Vue.computed(()=>{const o={"is-pointer":!!n.onClick};return!u.value&&t.icon&&(o[t.icon]=!0),o}),c=Vue.computed(()=>{var o;return typeof t.size=="number"?t.size:(o=M[t.size])!=null?o:void 0});return(o,a)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(ElementPlus.ElIcon),{class:Vue.normalizeClass(["x-icon",r.value]),color:t.color,size:c.value},{default:Vue.withCtx(()=>[Vue.renderSlot(o.$slots,"default",{},()=>[u.value?(Vue.openBlock(),Vue.createBlock(Vue.resolveDynamicComponent(u.value),{key:0})):Vue.createCommentVNode("",!0),t.src?(Vue.openBlock(),Vue.createElementBlock("img",{key:1,src:t.src},null,8,H)):Vue.createCommentVNode("",!0)])]),_:3},8,["class","color","size"]))}}),L=Vue.defineComponent({name:"XMenuItem",__name:"MenuItem",props:{item:{}},setup(e){const t=e,n=Vue.getCurrentInstance(),u=(c="")=>{if(!c)return;const o=n==null?void 0:n.appContext.app;return(o==null?void 0:o.component(c))||c},r=c=>c.filter(o=>!o.hidden);return(c,o)=>t.item.children?(Vue.openBlock(),Vue.createBlock(Vue.unref(ElementPlus.ElSubMenu),{key:0,index:t.item.id},{title:Vue.withCtx(()=>[Vue.createElementVNode("div",null,[Vue.createVNode(Vue.unref(_),{icon:u(t.item.icon)},null,8,["icon"]),Vue.createElementVNode("span",null,Vue.toDisplayString(t.item.title),1)])]),default:Vue.withCtx(()=>[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(r(t.item.children),a=>(Vue.openBlock(),Vue.createBlock(Vue.unref(L),{item:a},null,8,["item"]))),256))]),_:1},8,["index"])):(Vue.openBlock(),Vue.createBlock(Vue.unref(ElementPlus.ElMenuItem),Vue.mergeProps({key:1,index:t.item.id},t.item),{default:Vue.withCtx(()=>[Vue.createVNode(Vue.unref(_),{icon:u(t.item.icon)},null,8,["icon"]),Vue.createElementVNode("span",null,Vue.toDisplayString(t.item.title),1)]),_:1},16,["index"]))}}),y=Vue.defineComponent({name:"XMenu",__name:"Menu",props:{data:{default:()=>[]},mode:{},defaultActive:{},defaultOpeneds:{},uniqueOpened:{type:Boolean},router:{type:Boolean},menuTrigger:{},collapse:{type:Boolean},backgroundColor:{},textColor:{},activeTextColor:{},collapseTransition:{type:Boolean},ellipsis:{type:Boolean},popperEffect:{}},emits:["select"],setup(e,{emit:t}){const n=e,u=Vue.computed(()=>n.data.filter(o=>!o.hidden)),r=(o,a)=>{const i=(s,
|
|
1
|
+
(function(l,f){typeof exports=="object"&&typeof module!="undefined"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(l=typeof globalThis!="undefined"?globalThis:l||self,f(l.VtjUI={}))})(this,function(l){"use strict";var ee=Object.defineProperty;var A=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var x=(l,f,p)=>f in l?ee(l,f,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[f]=p,I=(l,f)=>{for(var p in f||(f={}))te.call(f,p)&&x(l,p,f[p]);if(A)for(var p of A(f))ne.call(f,p)&&x(l,p,f[p]);return l};const f="";function p(e){return typeof e=="string"?e:`${e}px`}function R(e=0,t){if(typeof e=="number")return e;if(/(%|vh|vw)$/i.test(e)){const u=Number.parseInt(e);return t*u/100}return Number.parseInt(e)}function N(e,t){const n={};return Object.keys(e).forEach(u=>{t.includes(u)||(n[u]=e[u])}),n}function j(e,t){const n={};return Object.keys(e).forEach(u=>{t.includes(u)&&(n[u]=e[u])}),n}const C=()=>{},O=(e,t)=>{if(e.install=n=>{for(const u of[e,...Object.values(t!=null?t:{})])typeof u=="function"?n.use(u):u.name&&n.component(u.name,u)},t)for(const[n,u]of Object.entries(t))e[n]=u;return e},T=(e,t)=>(e.install=n=>{e._context=n._context,n.config.globalProperties[t]=e},e),X=(e,t)=>(e.install=n=>{n.directive(t,e)},e),U=e=>(e.install=C,e),S=Symbol("INSTALLED_KEY"),E="is-dragging",k="is-resizing",B=(e=[])=>({install:n=>{n[S]||(n[S]=!0,e.forEach(u=>n.use(u)))}}),G={class:"x-startup"},b=Vue.defineComponent({name:"XStartup",__name:"Startup",props:{text:{default:"Hello VTJ."}},setup(e){const t=e;return(n,u)=>(Vue.openBlock(),Vue.createElementBlock("div",G,[Vue.renderSlot(n.$slots,"default",{},()=>[Vue.createElementVNode("span",null,Vue.toDisplayString(t.text),1)])]))}}),ue="",M={default:14,small:12,large:18},P={icon:{type:[String,Object]},color:{type:String},size:{type:[Number,String],default:"inherit"},src:{type:String},disabled:{type:Boolean}},H=["src"],_=Vue.defineComponent({name:"XIcon",__name:"Icon",props:P,setup(e){const t=e,n=Vue.useAttrs(),u=Vue.computed(()=>typeof t.icon=="object"?Vue.markRaw(t.icon):null),r=Vue.computed(()=>{const o={"is-pointer":!!n.onClick};return!u.value&&t.icon&&(o[t.icon]=!0),o}),c=Vue.computed(()=>{var o;return typeof t.size=="number"?t.size:(o=M[t.size])!=null?o:void 0});return(o,a)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(ElementPlus.ElIcon),{class:Vue.normalizeClass(["x-icon",r.value]),color:t.color,size:c.value},{default:Vue.withCtx(()=>[Vue.renderSlot(o.$slots,"default",{},()=>[u.value?(Vue.openBlock(),Vue.createBlock(Vue.resolveDynamicComponent(u.value),{key:0})):Vue.createCommentVNode("",!0),t.src?(Vue.openBlock(),Vue.createElementBlock("img",{key:1,src:t.src},null,8,H)):Vue.createCommentVNode("",!0)])]),_:3},8,["class","color","size"]))}}),L=Vue.defineComponent({name:"XMenuItem",__name:"MenuItem",props:{item:{}},setup(e){const t=e,n=Vue.getCurrentInstance(),u=(c="")=>{if(!c)return;const o=n==null?void 0:n.appContext.app;return(o==null?void 0:o.component(c))||c},r=c=>c.filter(o=>!o.hidden);return(c,o)=>t.item.children?(Vue.openBlock(),Vue.createBlock(Vue.unref(ElementPlus.ElSubMenu),{key:0,index:t.item.id},{title:Vue.withCtx(()=>[Vue.createElementVNode("div",null,[Vue.createVNode(Vue.unref(_),{icon:u(t.item.icon)},null,8,["icon"]),Vue.createElementVNode("span",null,Vue.toDisplayString(t.item.title),1)])]),default:Vue.withCtx(()=>[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(r(t.item.children),a=>(Vue.openBlock(),Vue.createBlock(Vue.unref(L),{item:a},null,8,["item"]))),256))]),_:1},8,["index"])):(Vue.openBlock(),Vue.createBlock(Vue.unref(ElementPlus.ElMenuItem),Vue.mergeProps({key:1,index:t.item.id},t.item),{default:Vue.withCtx(()=>[Vue.createVNode(Vue.unref(_),{icon:u(t.item.icon)},null,8,["icon"]),Vue.createElementVNode("span",null,Vue.toDisplayString(t.item.title),1)]),_:1},16,["index"]))}}),y=Vue.defineComponent({name:"XMenu",__name:"Menu",props:{data:{default:()=>[]},mode:{},defaultActive:{},defaultOpeneds:{},uniqueOpened:{type:Boolean},router:{type:Boolean},menuTrigger:{},collapse:{type:Boolean},backgroundColor:{},textColor:{},activeTextColor:{},collapseTransition:{type:Boolean},ellipsis:{type:Boolean},popperEffect:{}},emits:["select"],setup(e,{emit:t}){const n=e,u=Vue.computed(()=>n.data.filter(o=>!o.hidden)),r=(o,a)=>{const i=(s,m=[])=>{var d;for(const V of m){if(V.id===s)return V;if((d=V.children)!=null&&d.length){const h=i(s,V.children);if(h)return h}}};return i(a,o)},c=o=>{const a=r(u.value,o);a&&t("select",a)};return(o,a)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(ElementPlus.ElMenu),Vue.mergeProps({class:"x-menu"},n,{onSelect:c}),{default:Vue.withCtx(()=>[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(u.value,i=>(Vue.openBlock(),Vue.createBlock(Vue.unref(L),{item:i},null,8,["item"]))),256))]),_:1},16))}}),F={class:"x-simple-mask__brand"},Y={class:"x-simple-mask__aciton"},z=Vue.defineComponent({name:"XSimpleMask",__name:"SimpleMask",props:{preview:{type:Boolean},project:{default:()=>({name:"Logo",home:"/"})},menu:{}},setup(e,{expose:t}){const n=e,u=VueRouter.useRouter(),r=VueRouter.useRoute(),c=Vue.computed(()=>r.params.id),o=()=>{const i=n.project.home;i&&u.push(i)},a=i=>{const s=i==null?void 0:i.id;if(s){const d=`${n.preview?"/preview":n.project.page}/${s}`;u.push(d)}};return t({goHome:o}),(i,s)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(ElementPlus.ElContainer),{class:"x-simple-mask"},{default:Vue.withCtx(()=>[Vue.createVNode(Vue.unref(ElementPlus.ElHeader),{class:"x-simple-mask__header"},{default:Vue.withCtx(()=>[Vue.createElementVNode("div",F,[Vue.createElementVNode("span",{class:"x-simple-mask__logo",onClick:o},[Vue.renderSlot(i.$slots,"logo",{},()=>[Vue.createTextVNode(Vue.toDisplayString(n.project.name),1)])])]),Vue.createElementVNode("div",Y,[Vue.renderSlot(i.$slots,"action")])]),_:3}),Vue.createVNode(Vue.unref(ElementPlus.ElContainer),null,{default:Vue.withCtx(()=>[Vue.createVNode(Vue.unref(ElementPlus.ElAside),{class:"x-simple-mask__aside"},{default:Vue.withCtx(()=>[Vue.createVNode(Vue.unref(y),Vue.mergeProps(n.menu,{"default-active":c.value,onSelect:a}),null,16,["default-active"])]),_:1}),Vue.createVNode(Vue.unref(ElementPlus.ElMain),{class:"x-simple-mask__main"},{default:Vue.withCtx(()=>[Vue.renderSlot(i.$slots,"default",{},()=>[Vue.createVNode(Vue.unref(VueRouter.RouterView))])]),_:3})]),_:3}),i.$slots.footer?(Vue.openBlock(),Vue.createBlock(Vue.unref(ElementPlus.ElFooter),{key:0,class:"x-simple-mask__footer",height:"40px"},{default:Vue.withCtx(()=>[Vue.renderSlot(i.$slots,"footer")]),_:3})):Vue.createCommentVNode("",!0)]),_:3}))}}),D=[b,_,y,z];function $(e){return Vue.computed(()=>e?typeof e=="string"||e.setup||e.render||Vue.isVNode(e)?{icon:e}:e:null)}function K(e){const t=$(e);return t.value?Vue.defineComponent({render:()=>Vue.h(_,t.value)}):null}function W(e,t={}){const n=t.edge||40,u=Vue.computed(()=>{var s;return t.selector?typeof t.selector=="string"?(s=Vue.unref(e))==null?void 0:s.querySelector(t.selector):Vue.unref(e):null}),r=Vue.computed(()=>Vue.unref(t.wrapper)),{x:c,y:o,isDragging:a}=VueUse.useDraggable(e,I({preventDefault:!1,stopPropagation:!1,handle:t.selector?u:null},N(t,["handle","edge"]))),i=(s,m,d,V,h,g)=>{const v=[-d.value+n,V.value-n];m.value=Math.min(Math.max(m.value,g.value),h.value-n),s.value<v[0]&&(s.value=v[0]),s.value>v[1]&&(s.value=v[1])};if(t.wrapper){const{width:s,height:m,top:d}=VueUse.useElementBounding(r),{width:V}=VueUse.useElementSize(e);Vue.watch([c,o],()=>{i(c,o,V,s,m,d)})}return Vue.watch(a,s=>{s?document.body.classList.add(E):document.body.classList.remove(E)}),{x:c,y:o,isDragging:a}}function q(e,t,n){const{dirs:u=["n","s","w","e"],edge:r=5}=e;let c="";const{left:o,top:a,width:i,height:s}=n,{clientX:m,clientY:d}=t;return u.includes("n")&&d>a.value-r&&d<a.value+r?c+="n":u.includes("s")&&d<a.value+s.value+r&&d>a.value+s.value-r&&(c+="s"),u.includes("w")&&m>o.value-r&&m<o.value+r?c+="w":u.includes("e")&&m<o.value+i.value+r&&m>o.value+i.value-r&&(c+="e"),c}function Z(e,t,n,u){if(!n)return;const{minWidth:r=0,minHeight:c=0,maxWidth:o,maxHeight:a}=e,{clientX:i,clientY:s}=t,{left:m,top:d,width:V,height:h}=u;n.includes("e")&&(V.value=Math.max(i-m.value,r)),n.includes("w")&&(V.value=Math.max(V.value+m.value-i,r),m.value=i),n.includes("s")&&(h.value=Math.max(s-d.value,c)),n.includes("n")&&(h.value=Math.max(h.value+d.value-s,c),d.value=s),o&&(V.value=Math.min(V.value,o)),a&&(h.value=Math.min(h.value,a)),e.onResizing&&e.onResizing(u)}function J(e,t={}){const n=I({edge:5,minWidth:50,minHeight:50,dirs:["n","s","w","e"]},t),u=Vue.effectScope(),r=Vue.ref(""),c=Vue.ref(!1),{onStart:o,onEnd:a,boundingOptions:i}=n,s=VueUse.useElementBounding(e,i),{left:m,top:d,width:V,height:h,update:g}=s;return u.run(()=>{VueUse.useEventListener(document,"mousemove",v=>{c.value?Z(n,v,r.value,s):r.value=q(n,v,s)}),VueUse.useEventListener(document,"mousedown",()=>{g(),r.value&&(c.value=!0,o&&o(s))}),VueUse.useEventListener(document,"mouseup",()=>{c.value=!1,r.value="",a&&a(s),g()}),Vue.watch(r,v=>{const w=document.body;w.style.cursor=v?`${v}-resize`:"",v?w.classList.add(k):w.classList.remove(k)})}),Vue.onUnmounted(()=>{u.stop()}),{left:m,top:d,width:V,height:h,direction:r,resizing:c,update:g}}const Q=B(D).install;l.INSTALLED_KEY=S,l.IS_DRAGGING_CLASS_NAME=E,l.IS_RESIZING_CLASS_NAME=k,l.NOOP=C,l.XIcon=_,l.XMenu=y,l.XSimpleMask=z,l.XStartup=b,l.components=D,l.getSizeValue=p,l.iconProps=P,l.iconSizeMap=M,l.install=Q,l.makeInstaller=B,l.omit=N,l.parseSize=R,l.pick=j,l.useDraggable=W,l.useIcon=K,l.useIconProps=$,l.useResizable=J,l.withInstall=O,l.withInstallDirective=X,l.withInstallFunction=T,l.withNoopInstall=U,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as w, openBlock as f, createElementBlock as M, renderSlot as b, createElementVNode as x, toDisplayString as E, useAttrs as H, computed as S, markRaw as G, createBlock as g, unref as m, normalizeClass as Y, withCtx as _, resolveDynamicComponent as F, createCommentVNode as N, getCurrentInstance as W, createVNode as y, Fragment as O, renderList as R, mergeProps as D, createTextVNode as q, isVNode as K, h as J, watch as z, effectScope as U, ref as L, onUnmounted as Z } from "vue";
|
|
2
2
|
import { ElIcon as Q, ElSubMenu as ee, ElMenuItem as te, ElMenu as ne, ElContainer as A, ElHeader as se, ElAside as oe, ElMain as le, ElFooter as re } from "element-plus";
|
|
3
|
-
import { useRouter as ae, useRoute as
|
|
4
|
-
import { useDraggable as ce, useElementBounding as
|
|
3
|
+
import { useRouter as ae, useRoute as ie, RouterView as ue } from "vue-router";
|
|
4
|
+
import { useDraggable as ce, useElementBounding as P, useElementSize as me, useEventListener as C } from "@vueuse/core";
|
|
5
5
|
function De(e) {
|
|
6
6
|
return typeof e == "string" ? e : `${e}px`;
|
|
7
7
|
}
|
|
@@ -14,7 +14,7 @@ function Le(e = 0, t) {
|
|
|
14
14
|
}
|
|
15
15
|
return Number.parseInt(e);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function pe(e, t) {
|
|
18
18
|
const n = {};
|
|
19
19
|
return Object.keys(e).forEach((s) => {
|
|
20
20
|
t.includes(s) || (n[s] = e[s]);
|
|
@@ -26,8 +26,8 @@ function Ae(e, t) {
|
|
|
26
26
|
t.includes(s) && (n[s] = e[s]);
|
|
27
27
|
}), n;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
},
|
|
29
|
+
const de = () => {
|
|
30
|
+
}, Be = (e, t) => {
|
|
31
31
|
if (e.install = (n) => {
|
|
32
32
|
for (const s of [e, ...Object.values(t ?? {})])
|
|
33
33
|
typeof s == "function" ? n.use(s) : s.name && n.component(s.name, s);
|
|
@@ -35,15 +35,15 @@ const pe = () => {
|
|
|
35
35
|
for (const [n, s] of Object.entries(t))
|
|
36
36
|
e[n] = s;
|
|
37
37
|
return e;
|
|
38
|
-
},
|
|
38
|
+
}, Xe = (e, t) => (e.install = (n) => {
|
|
39
39
|
e._context = n._context, n.config.globalProperties[t] = e;
|
|
40
|
-
}, e),
|
|
40
|
+
}, e), je = (e, t) => (e.install = (n) => {
|
|
41
41
|
n.directive(t, e);
|
|
42
|
-
}, e), Oe = (e) => (e.install =
|
|
42
|
+
}, e), Oe = (e) => (e.install = de, e), B = Symbol("INSTALLED_KEY"), X = "is-dragging", j = "is-resizing", fe = (e = []) => ({
|
|
43
43
|
install: (n) => {
|
|
44
|
-
n[
|
|
44
|
+
n[B] || (n[B] = !0, e.forEach((s) => n.use(s)));
|
|
45
45
|
}
|
|
46
|
-
}), ve = { class: "x-startup" }, _e = /* @__PURE__ */
|
|
46
|
+
}), ve = { class: "x-startup" }, _e = /* @__PURE__ */ w({
|
|
47
47
|
name: "XStartup",
|
|
48
48
|
__name: "Startup",
|
|
49
49
|
props: {
|
|
@@ -52,8 +52,8 @@ const pe = () => {
|
|
|
52
52
|
setup(e) {
|
|
53
53
|
const t = e;
|
|
54
54
|
return (n, s) => (f(), M("div", ve, [
|
|
55
|
-
|
|
56
|
-
x("span", null,
|
|
55
|
+
b(n.$slots, "default", {}, () => [
|
|
56
|
+
x("span", null, E(t.text), 1)
|
|
57
57
|
])
|
|
58
58
|
]));
|
|
59
59
|
}
|
|
@@ -79,24 +79,24 @@ const he = {
|
|
|
79
79
|
disabled: {
|
|
80
80
|
type: Boolean
|
|
81
81
|
}
|
|
82
|
-
}, ye = ["src"], k = /* @__PURE__ */
|
|
82
|
+
}, ye = ["src"], k = /* @__PURE__ */ w({
|
|
83
83
|
name: "XIcon",
|
|
84
84
|
__name: "Icon",
|
|
85
85
|
props: ge,
|
|
86
86
|
setup(e) {
|
|
87
|
-
const t = e, n =
|
|
87
|
+
const t = e, n = H(), s = S(() => typeof t.icon == "object" ? G(t.icon) : null), r = S(() => {
|
|
88
88
|
const o = {
|
|
89
89
|
"is-pointer": !!n.onClick
|
|
90
90
|
};
|
|
91
91
|
return !s.value && t.icon && (o[t.icon] = !0), o;
|
|
92
92
|
}), l = S(() => typeof t.size == "number" ? t.size : he[t.size] ?? void 0);
|
|
93
|
-
return (o,
|
|
93
|
+
return (o, u) => (f(), g(m(Q), {
|
|
94
94
|
class: Y(["x-icon", r.value]),
|
|
95
95
|
color: t.color,
|
|
96
96
|
size: l.value
|
|
97
97
|
}, {
|
|
98
98
|
default: _(() => [
|
|
99
|
-
|
|
99
|
+
b(o.$slots, "default", {}, () => [
|
|
100
100
|
s.value ? (f(), g(F(s.value), { key: 0 })) : N("", !0),
|
|
101
101
|
t.src ? (f(), M("img", {
|
|
102
102
|
key: 1,
|
|
@@ -107,7 +107,7 @@ const he = {
|
|
|
107
107
|
_: 3
|
|
108
108
|
}, 8, ["class", "color", "size"]));
|
|
109
109
|
}
|
|
110
|
-
}),
|
|
110
|
+
}), V = /* @__PURE__ */ w({
|
|
111
111
|
name: "XMenuItem",
|
|
112
112
|
__name: "MenuItem",
|
|
113
113
|
props: {
|
|
@@ -115,36 +115,36 @@ const he = {
|
|
|
115
115
|
},
|
|
116
116
|
setup(e) {
|
|
117
117
|
const t = e, n = W(), s = (l = "") => l ? n?.appContext.app?.component(l) || l : void 0, r = (l) => l.filter((o) => !o.hidden);
|
|
118
|
-
return (l, o) => t.item.children ? (f(), g(
|
|
118
|
+
return (l, o) => t.item.children ? (f(), g(m(ee), {
|
|
119
119
|
key: 0,
|
|
120
120
|
index: t.item.id
|
|
121
121
|
}, {
|
|
122
122
|
title: _(() => [
|
|
123
123
|
x("div", null, [
|
|
124
|
-
y(
|
|
124
|
+
y(m(k), {
|
|
125
125
|
icon: s(t.item.icon)
|
|
126
126
|
}, null, 8, ["icon"]),
|
|
127
|
-
x("span", null,
|
|
127
|
+
x("span", null, E(t.item.title), 1)
|
|
128
128
|
])
|
|
129
129
|
]),
|
|
130
130
|
default: _(() => [
|
|
131
|
-
(f(!0), M(O, null, R(r(t.item.children), (
|
|
131
|
+
(f(!0), M(O, null, R(r(t.item.children), (u) => (f(), g(m(V), { item: u }, null, 8, ["item"]))), 256))
|
|
132
132
|
]),
|
|
133
133
|
_: 1
|
|
134
|
-
}, 8, ["index"])) : (f(), g(
|
|
134
|
+
}, 8, ["index"])) : (f(), g(m(te), D({
|
|
135
135
|
key: 1,
|
|
136
136
|
index: t.item.id
|
|
137
137
|
}, t.item), {
|
|
138
138
|
default: _(() => [
|
|
139
|
-
y(
|
|
139
|
+
y(m(k), {
|
|
140
140
|
icon: s(t.item.icon)
|
|
141
141
|
}, null, 8, ["icon"]),
|
|
142
|
-
x("span", null,
|
|
142
|
+
x("span", null, E(t.item.title), 1)
|
|
143
143
|
]),
|
|
144
144
|
_: 1
|
|
145
145
|
}, 16, ["index"]));
|
|
146
146
|
}
|
|
147
|
-
}),
|
|
147
|
+
}), T = /* @__PURE__ */ w({
|
|
148
148
|
name: "XMenu",
|
|
149
149
|
__name: "Menu",
|
|
150
150
|
props: {
|
|
@@ -165,34 +165,35 @@ const he = {
|
|
|
165
165
|
},
|
|
166
166
|
emits: ["select"],
|
|
167
167
|
setup(e, { emit: t }) {
|
|
168
|
-
const n = e, s = S(() => n.data.filter((o) => !o.hidden)), r = (o,
|
|
169
|
-
const
|
|
170
|
-
for (const
|
|
171
|
-
if (
|
|
172
|
-
return
|
|
173
|
-
if (
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
176
|
-
return
|
|
168
|
+
const n = e, s = S(() => n.data.filter((o) => !o.hidden)), r = (o, u) => {
|
|
169
|
+
const i = (a, p = []) => {
|
|
170
|
+
for (const c of p) {
|
|
171
|
+
if (c.id === a)
|
|
172
|
+
return c;
|
|
173
|
+
if (c.children?.length) {
|
|
174
|
+
const d = i(a, c.children);
|
|
175
|
+
if (d)
|
|
176
|
+
return d;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
|
-
return u
|
|
180
|
+
return i(u, o);
|
|
181
181
|
}, l = (o) => {
|
|
182
|
-
const
|
|
183
|
-
|
|
182
|
+
const u = r(s.value, o);
|
|
183
|
+
u && t("select", u);
|
|
184
184
|
};
|
|
185
|
-
return (o,
|
|
185
|
+
return (o, u) => (f(), g(m(ne), D({ class: "x-menu" }, n, { onSelect: l }), {
|
|
186
186
|
default: _(() => [
|
|
187
|
-
(f(!0), M(O, null, R(s.value, (
|
|
187
|
+
(f(!0), M(O, null, R(s.value, (i) => (f(), g(m(V), { item: i }, null, 8, ["item"]))), 256))
|
|
188
188
|
]),
|
|
189
189
|
_: 1
|
|
190
190
|
}, 16));
|
|
191
191
|
}
|
|
192
|
-
}), Se = { class: "x-simple-mask__brand" }, xe = { class: "x-simple-mask__aciton" },
|
|
192
|
+
}), Se = { class: "x-simple-mask__brand" }, xe = { class: "x-simple-mask__aciton" }, be = /* @__PURE__ */ w({
|
|
193
193
|
name: "XSimpleMask",
|
|
194
194
|
__name: "SimpleMask",
|
|
195
195
|
props: {
|
|
196
|
+
preview: { type: Boolean },
|
|
196
197
|
project: { default: () => ({
|
|
197
198
|
name: "Logo",
|
|
198
199
|
home: "/"
|
|
@@ -200,53 +201,53 @@ const he = {
|
|
|
200
201
|
menu: {}
|
|
201
202
|
},
|
|
202
203
|
setup(e, { expose: t }) {
|
|
203
|
-
const n = e, s = ae(), r =
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
const a =
|
|
204
|
+
const n = e, s = ae(), r = ie(), l = S(() => r.params.id), o = () => {
|
|
205
|
+
const i = n.project.home;
|
|
206
|
+
i && s.push(i);
|
|
207
|
+
}, u = (i) => {
|
|
208
|
+
const a = i?.id;
|
|
208
209
|
if (a) {
|
|
209
|
-
const c = `${n.project.page}/${a}`;
|
|
210
|
+
const c = `${n.preview ? "/preview" : n.project.page}/${a}`;
|
|
210
211
|
s.push(c);
|
|
211
212
|
}
|
|
212
213
|
};
|
|
213
214
|
return t({
|
|
214
215
|
goHome: o
|
|
215
|
-
}), (
|
|
216
|
+
}), (i, a) => (f(), g(m(A), { class: "x-simple-mask" }, {
|
|
216
217
|
default: _(() => [
|
|
217
|
-
y(
|
|
218
|
+
y(m(se), { class: "x-simple-mask__header" }, {
|
|
218
219
|
default: _(() => [
|
|
219
220
|
x("div", Se, [
|
|
220
221
|
x("span", {
|
|
221
222
|
class: "x-simple-mask__logo",
|
|
222
223
|
onClick: o
|
|
223
224
|
}, [
|
|
224
|
-
|
|
225
|
-
q(
|
|
225
|
+
b(i.$slots, "logo", {}, () => [
|
|
226
|
+
q(E(n.project.name), 1)
|
|
226
227
|
])
|
|
227
228
|
])
|
|
228
229
|
]),
|
|
229
230
|
x("div", xe, [
|
|
230
|
-
|
|
231
|
+
b(i.$slots, "action")
|
|
231
232
|
])
|
|
232
233
|
]),
|
|
233
234
|
_: 3
|
|
234
235
|
}),
|
|
235
|
-
y(
|
|
236
|
+
y(m(A), null, {
|
|
236
237
|
default: _(() => [
|
|
237
|
-
y(
|
|
238
|
+
y(m(oe), { class: "x-simple-mask__aside" }, {
|
|
238
239
|
default: _(() => [
|
|
239
|
-
y(
|
|
240
|
+
y(m(T), D(n.menu, {
|
|
240
241
|
"default-active": l.value,
|
|
241
|
-
onSelect:
|
|
242
|
+
onSelect: u
|
|
242
243
|
}), null, 16, ["default-active"])
|
|
243
244
|
]),
|
|
244
245
|
_: 1
|
|
245
246
|
}),
|
|
246
|
-
y(
|
|
247
|
+
y(m(le), { class: "x-simple-mask__main" }, {
|
|
247
248
|
default: _(() => [
|
|
248
|
-
|
|
249
|
-
y(
|
|
249
|
+
b(i.$slots, "default", {}, () => [
|
|
250
|
+
y(m(ue))
|
|
250
251
|
])
|
|
251
252
|
]),
|
|
252
253
|
_: 3
|
|
@@ -254,13 +255,13 @@ const he = {
|
|
|
254
255
|
]),
|
|
255
256
|
_: 3
|
|
256
257
|
}),
|
|
257
|
-
|
|
258
|
+
i.$slots.footer ? (f(), g(m(re), {
|
|
258
259
|
key: 0,
|
|
259
260
|
class: "x-simple-mask__footer",
|
|
260
261
|
height: "40px"
|
|
261
262
|
}, {
|
|
262
263
|
default: _(() => [
|
|
263
|
-
|
|
264
|
+
b(i.$slots, "footer")
|
|
264
265
|
]),
|
|
265
266
|
_: 3
|
|
266
267
|
})) : N("", !0)
|
|
@@ -268,108 +269,108 @@ const he = {
|
|
|
268
269
|
_: 3
|
|
269
270
|
}));
|
|
270
271
|
}
|
|
271
|
-
}),
|
|
272
|
-
function
|
|
272
|
+
}), we = [_e, k, T, be];
|
|
273
|
+
function Ie(e) {
|
|
273
274
|
return S(() => e ? typeof e == "string" || e.setup || e.render || K(e) ? {
|
|
274
275
|
icon: e
|
|
275
276
|
} : e : null);
|
|
276
277
|
}
|
|
277
278
|
function Re(e) {
|
|
278
|
-
const t =
|
|
279
|
-
return t.value ?
|
|
279
|
+
const t = Ie(e);
|
|
280
|
+
return t.value ? w({ render: () => J(k, t.value) }) : null;
|
|
280
281
|
}
|
|
281
|
-
function
|
|
282
|
-
const n = t.edge || 40, s = S(() => t.selector ? typeof t.selector == "string" ?
|
|
282
|
+
function Pe(e, t = {}) {
|
|
283
|
+
const n = t.edge || 40, s = S(() => t.selector ? typeof t.selector == "string" ? m(e)?.querySelector(t.selector) : m(e) : null), r = S(() => m(t.wrapper)), { x: l, y: o, isDragging: u } = ce(e, {
|
|
283
284
|
preventDefault: !1,
|
|
284
285
|
stopPropagation: !1,
|
|
285
286
|
handle: t.selector ? s : null,
|
|
286
|
-
...
|
|
287
|
-
}),
|
|
288
|
-
const v = [-
|
|
289
|
-
|
|
287
|
+
...pe(t, ["handle", "edge"])
|
|
288
|
+
}), i = (a, p, c, d, h, I) => {
|
|
289
|
+
const v = [-c.value + n, d.value - n];
|
|
290
|
+
p.value = Math.min(Math.max(p.value, I.value), h.value - n), a.value < v[0] && (a.value = v[0]), a.value > v[1] && (a.value = v[1]);
|
|
290
291
|
};
|
|
291
292
|
if (t.wrapper) {
|
|
292
|
-
const { width: a, height:
|
|
293
|
+
const { width: a, height: p, top: c } = P(r), { width: d } = me(e);
|
|
293
294
|
z([l, o], () => {
|
|
294
|
-
|
|
295
|
+
i(l, o, d, a, p, c);
|
|
295
296
|
});
|
|
296
297
|
}
|
|
297
|
-
return z(
|
|
298
|
-
a ? document.body.classList.add(
|
|
298
|
+
return z(u, (a) => {
|
|
299
|
+
a ? document.body.classList.add(X) : document.body.classList.remove(X);
|
|
299
300
|
}), {
|
|
300
301
|
x: l,
|
|
301
302
|
y: o,
|
|
302
|
-
isDragging:
|
|
303
|
+
isDragging: u
|
|
303
304
|
};
|
|
304
305
|
}
|
|
305
|
-
function
|
|
306
|
+
function Ee(e, t, n) {
|
|
306
307
|
const { dirs: s = ["n", "s", "w", "e"], edge: r = 5 } = e;
|
|
307
308
|
let l = "";
|
|
308
|
-
const { left: o, top:
|
|
309
|
-
return s.includes("n") &&
|
|
309
|
+
const { left: o, top: u, width: i, height: a } = n, { clientX: p, clientY: c } = t;
|
|
310
|
+
return s.includes("n") && c > u.value - r && c < u.value + r ? l += "n" : s.includes("s") && c < u.value + a.value + r && c > u.value + a.value - r && (l += "s"), s.includes("w") && p > o.value - r && p < o.value + r ? l += "w" : s.includes("e") && p < o.value + i.value + r && p > o.value + i.value - r && (l += "e"), l;
|
|
310
311
|
}
|
|
311
312
|
function ke(e, t, n, s) {
|
|
312
313
|
if (!n)
|
|
313
314
|
return;
|
|
314
|
-
const { minWidth: r = 0, minHeight: l = 0, maxWidth: o, maxHeight:
|
|
315
|
-
n.includes("e") && (
|
|
315
|
+
const { minWidth: r = 0, minHeight: l = 0, maxWidth: o, maxHeight: u } = e, { clientX: i, clientY: a } = t, { left: p, top: c, width: d, height: h } = s;
|
|
316
|
+
n.includes("e") && (d.value = Math.max(i - p.value, r)), n.includes("w") && (d.value = Math.max(d.value + p.value - i, r), p.value = i), n.includes("s") && (h.value = Math.max(a - c.value, l)), n.includes("n") && (h.value = Math.max(h.value + c.value - a, l), c.value = a), o && (d.value = Math.min(d.value, o)), u && (h.value = Math.min(h.value, u)), e.onResizing && e.onResizing(s);
|
|
316
317
|
}
|
|
317
|
-
function
|
|
318
|
+
function Ve(e, t = {}) {
|
|
318
319
|
const n = {
|
|
319
320
|
edge: 5,
|
|
320
321
|
minWidth: 50,
|
|
321
322
|
minHeight: 50,
|
|
322
323
|
dirs: ["n", "s", "w", "e"],
|
|
323
324
|
...t
|
|
324
|
-
}, s = U(), r = L(""), l = L(!1), { onStart: o, onEnd:
|
|
325
|
+
}, s = U(), r = L(""), l = L(!1), { onStart: o, onEnd: u, boundingOptions: i } = n, a = P(e, i), { left: p, top: c, width: d, height: h, update: I } = a;
|
|
325
326
|
return s.run(() => {
|
|
326
327
|
C(document, "mousemove", (v) => {
|
|
327
|
-
l.value ? ke(n, v, r.value, a) : r.value =
|
|
328
|
+
l.value ? ke(n, v, r.value, a) : r.value = Ee(n, v, a);
|
|
328
329
|
}), C(document, "mousedown", () => {
|
|
329
|
-
|
|
330
|
+
I(), r.value && (l.value = !0, o && o(a));
|
|
330
331
|
}), C(document, "mouseup", () => {
|
|
331
|
-
l.value = !1, r.value = "",
|
|
332
|
+
l.value = !1, r.value = "", u && u(a), I();
|
|
332
333
|
}), z(r, (v) => {
|
|
333
334
|
const $ = document.body;
|
|
334
|
-
$.style.cursor = v ? `${v}-resize` : "", v ? $.classList.add(
|
|
335
|
+
$.style.cursor = v ? `${v}-resize` : "", v ? $.classList.add(j) : $.classList.remove(j);
|
|
335
336
|
});
|
|
336
337
|
}), Z(() => {
|
|
337
338
|
s.stop();
|
|
338
339
|
}), {
|
|
339
|
-
left:
|
|
340
|
-
top:
|
|
341
|
-
width:
|
|
340
|
+
left: p,
|
|
341
|
+
top: c,
|
|
342
|
+
width: d,
|
|
342
343
|
height: h,
|
|
343
344
|
direction: r,
|
|
344
345
|
resizing: l,
|
|
345
|
-
update:
|
|
346
|
+
update: I
|
|
346
347
|
};
|
|
347
348
|
}
|
|
348
|
-
const Me = fe(
|
|
349
|
+
const Me = fe(we), Te = Me.install;
|
|
349
350
|
export {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
351
|
+
B as INSTALLED_KEY,
|
|
352
|
+
X as IS_DRAGGING_CLASS_NAME,
|
|
353
|
+
j as IS_RESIZING_CLASS_NAME,
|
|
354
|
+
de as NOOP,
|
|
354
355
|
k as XIcon,
|
|
355
|
-
|
|
356
|
-
|
|
356
|
+
T as XMenu,
|
|
357
|
+
be as XSimpleMask,
|
|
357
358
|
_e as XStartup,
|
|
358
|
-
|
|
359
|
+
we as components,
|
|
359
360
|
De as getSizeValue,
|
|
360
361
|
ge as iconProps,
|
|
361
362
|
he as iconSizeMap,
|
|
362
|
-
|
|
363
|
+
Te as install,
|
|
363
364
|
fe as makeInstaller,
|
|
364
|
-
|
|
365
|
+
pe as omit,
|
|
365
366
|
Le as parseSize,
|
|
366
367
|
Ae as pick,
|
|
367
|
-
|
|
368
|
+
Pe as useDraggable,
|
|
368
369
|
Re as useIcon,
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
370
|
+
Ie as useIconProps,
|
|
371
|
+
Ve as useResizable,
|
|
372
|
+
Be as withInstall,
|
|
373
|
+
je as withInstallDirective,
|
|
374
|
+
Xe as withInstallFunction,
|
|
374
375
|
Oe as withNoopInstall
|
|
375
376
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"setup": "pnpm install --registry=https://registry.npmmirror.com",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"node": ">=16.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@vtj/deps": "0.
|
|
20
|
-
"@vtj/icons": "0.
|
|
21
|
-
"@vtj/utils": "0.
|
|
19
|
+
"@vtj/deps": "0.5.0",
|
|
20
|
+
"@vtj/icons": "0.5.0",
|
|
21
|
+
"@vtj/utils": "0.5.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@vtj/cli": "0.
|
|
24
|
+
"@vtj/cli": "0.5.0"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"lib",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "53b27ae2dc4309e33627a1d9354bfa12cde4263b"
|
|
46
46
|
}
|
|
@@ -5,6 +5,9 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<{
|
|
|
5
5
|
menu: {
|
|
6
6
|
type: PropType<MenuProps>;
|
|
7
7
|
};
|
|
8
|
+
preview: {
|
|
9
|
+
type: PropType<boolean>;
|
|
10
|
+
};
|
|
8
11
|
project: {
|
|
9
12
|
type: PropType<MaskProject>;
|
|
10
13
|
default: () => {
|
|
@@ -18,6 +21,9 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<{
|
|
|
18
21
|
menu: {
|
|
19
22
|
type: PropType<MenuProps>;
|
|
20
23
|
};
|
|
24
|
+
preview: {
|
|
25
|
+
type: PropType<boolean>;
|
|
26
|
+
};
|
|
21
27
|
project: {
|
|
22
28
|
type: PropType<MaskProject>;
|
|
23
29
|
default: () => {
|