@mlightcad/ui-components 0.0.6 → 0.0.7

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.
@@ -1,14 +1,102 @@
1
- import { ElIcon as g, ElButton as y, ElTooltip as C, ElButtonGroup as T } from "element-plus/es";
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".ml-dropdown-icon[data-v-05cd92db],.ml-dropdown-icon[data-v-05cd92db]:hover{outline:none;border:none}.ml-vertical-toolbar-button-group[data-v-7e12291d]{display:flex;flex-direction:column}.ml-horizontal-toolbar-button-group[data-v-7e12291d]{display:flex;flex-direction:row}.ml-toolbar-button[data-v-7e12291d]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px}.ml-toolbar-button-text[data-v-7e12291d]{margin-left:0;margin-top:5px}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ import { ElIcon as k, ElDropdownItem as B, ElDropdownMenu as S, ElDropdown as V, ElButton as D, ElTooltip as N, ElButtonGroup as $ } from "element-plus/es";
2
3
  import "element-plus/es/components/base/style/css";
4
+ import "element-plus/es/components/dropdown/style/css";
5
+ import "element-plus/es/components/dropdown-menu/style/css";
6
+ import "element-plus/es/components/dropdown-item/style/css";
7
+ import "element-plus/es/components/icon/style/css";
8
+ import { defineComponent as w, computed as p, openBlock as n, createBlock as u, withCtx as c, createVNode as v, createElementBlock as g, Fragment as z, renderList as M, createTextVNode as G, toDisplayString as C, pushScopeId as H, popScopeId as R, createElementVNode as f, normalizeClass as Y, normalizeStyle as F, createCommentVNode as O } from "vue";
3
9
  import "element-plus/es/components/button-group/style/css";
4
10
  import "element-plus/es/components/tooltip/style/css";
5
11
  import "element-plus/es/components/button/style/css";
6
- import "element-plus/es/components/icon/style/css";
7
- import { defineComponent as B, computed as r, openBlock as l, createBlock as i, normalizeClass as E, withCtx as u, createElementBlock as m, Fragment as M, renderList as S, normalizeStyle as w, createElementVNode as I, createVNode as L, toDisplayString as N, createCommentVNode as V } from "vue";
8
- const G = {
12
+ const j = (t) => (H("data-v-05cd92db"), t = t(), R(), t), q = /* @__PURE__ */ j(() => /* @__PURE__ */ f("svg", {
13
+ preserveAspectRatio: "xMidYMid meet",
14
+ viewBox: "0 0 24 24",
15
+ width: "1.2em",
16
+ height: "1.2em",
17
+ "data-v-63d067da": ""
18
+ }, [
19
+ /* @__PURE__ */ f("path", {
20
+ fill: "currentColor",
21
+ d: "m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"
22
+ })
23
+ ], -1)), J = /* @__PURE__ */ w({
24
+ __name: "MlDropdown",
25
+ props: {
26
+ icon: {},
27
+ items: {},
28
+ current: { default: void 0 }
29
+ },
30
+ emits: {
31
+ click: null
32
+ },
33
+ setup(t, { emit: r }) {
34
+ const e = t, a = r, s = p(() => e.items.filter((l) => l.name !== e.current)), i = (l) => {
35
+ a("click", l);
36
+ };
37
+ return (l, x) => {
38
+ const _ = k, h = B, o = S, b = V;
39
+ return n(), u(b, { onCommand: i }, {
40
+ dropdown: c(() => [
41
+ v(o, null, {
42
+ default: c(() => [
43
+ (n(!0), g(z, null, M(s.value, (d) => (n(), u(h, {
44
+ key: d.text,
45
+ command: d.name
46
+ }, {
47
+ default: c(() => [
48
+ G(C(d.text), 1)
49
+ ]),
50
+ _: 2
51
+ }, 1032, ["command"]))), 128))
52
+ ]),
53
+ _: 1
54
+ })
55
+ ]),
56
+ default: c(() => [
57
+ v(_, {
58
+ size: "30",
59
+ class: "ml-dropdown-icon"
60
+ }, {
61
+ default: c(() => [
62
+ q
63
+ ]),
64
+ _: 1
65
+ })
66
+ ]),
67
+ _: 1
68
+ });
69
+ };
70
+ }
71
+ }), L = (t, r) => {
72
+ const e = t.__vccOpts || t;
73
+ for (const [a, s] of r)
74
+ e[a] = s;
75
+ return e;
76
+ }, y = /* @__PURE__ */ L(J, [["__scopeId", "data-v-05cd92db"]]), K = '<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" width="1.2em" height="1.2em" data-v-63d067da=""><path fill="currentColor" d="m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"></path></svg>', P = /* @__PURE__ */ w({
77
+ __name: "MlLanguage",
78
+ props: {
79
+ languages: {},
80
+ current: {}
81
+ },
82
+ emits: {
83
+ click: null
84
+ },
85
+ setup(t, { emit: r }) {
86
+ const e = t, a = r, s = (i) => {
87
+ a("click", i);
88
+ };
89
+ return (i, l) => (n(), u(y, {
90
+ icon: K,
91
+ items: e.languages,
92
+ current: e.current,
93
+ onClick: s
94
+ }, null, 8, ["items", "current"]));
95
+ }
96
+ }), Q = {
9
97
  key: 0,
10
98
  class: "ml-toolbar-button-text"
11
- }, H = /* @__PURE__ */ B({
99
+ }, U = /* @__PURE__ */ w({
12
100
  __name: "MlToolbar",
13
101
  props: {
14
102
  items: {},
@@ -18,43 +106,43 @@ const G = {
18
106
  emits: {
19
107
  click: null
20
108
  },
21
- setup(e, { emit: c }) {
22
- const t = e, s = c, a = r(() => t.direction === "vertical" ? "ml-vertical-toolbar-button-group" : "ml-horizontal-toolbar-button-group"), _ = r(() => t.size === "small" ? 20 : 30), p = r(() => {
23
- switch (t.size) {
109
+ setup(t, { emit: r }) {
110
+ const e = t, a = r, s = p(() => e.direction === "vertical" ? "ml-vertical-toolbar-button-group" : "ml-horizontal-toolbar-button-group"), i = p(() => e.size === "small" ? 20 : 30), l = p(() => {
111
+ switch (e.size) {
24
112
  case "small":
25
113
  return 30;
26
114
  case "medium":
27
115
  return 50;
28
116
  }
29
117
  return 70;
30
- }), d = (o) => o.description ? o.description : o.text, b = r(() => t.size === "large"), f = (o) => {
31
- s("click", o);
118
+ }), x = (o) => o.description ? o.description : o.text, _ = p(() => e.size === "large"), h = (o) => {
119
+ a("click", o);
32
120
  };
33
- return (o, O) => {
34
- const v = g, h = y, k = C, x = T;
35
- return l(), i(x, {
36
- class: E(a.value)
121
+ return (o, b) => {
122
+ const d = k, E = D, I = N, T = $;
123
+ return n(), u(T, {
124
+ class: Y(s.value)
37
125
  }, {
38
- default: u(() => [
39
- (l(!0), m(M, null, S(o.items, (n, z) => (l(), i(k, {
40
- key: n.text,
41
- content: d(n),
126
+ default: c(() => [
127
+ (n(!0), g(z, null, M(o.items, (m, A) => (n(), u(I, {
128
+ key: m.text,
129
+ content: x(m),
42
130
  "hide-after": 0
43
131
  }, {
44
- default: u(() => [
45
- (l(), i(h, {
132
+ default: c(() => [
133
+ (n(), u(E, {
46
134
  class: "ml-toolbar-button",
47
- style: w({ width: p.value + "px", height: p.value + "px" }),
48
- key: z,
49
- onClick: ($) => f(n.command)
135
+ style: F({ width: l.value + "px", height: l.value + "px" }),
136
+ key: A,
137
+ onClick: (X) => h(m.command)
50
138
  }, {
51
- default: u(() => [
52
- I("div", null, [
53
- L(v, {
54
- size: _.value,
55
- innerHTML: n.icon
139
+ default: c(() => [
140
+ f("div", null, [
141
+ v(d, {
142
+ size: i.value,
143
+ innerHTML: m.icon
56
144
  }, null, 8, ["size", "innerHTML"]),
57
- b.value ? (l(), m("div", G, N(n.text), 1)) : V("", !0)
145
+ _.value ? (n(), g("div", Q, C(m.text), 1)) : O("", !0)
58
146
  ])
59
147
  ]),
60
148
  _: 2
@@ -67,18 +155,14 @@ const G = {
67
155
  }, 8, ["class"]);
68
156
  };
69
157
  }
70
- }), D = (e, c) => {
71
- const t = e.__vccOpts || e;
72
- for (const [s, a] of c)
73
- t[s] = a;
74
- return t;
75
- }, F = /* @__PURE__ */ D(H, [["__scopeId", "data-v-0fe7ba99"]]), R = {
158
+ }), W = /* @__PURE__ */ L(U, [["__scopeId", "data-v-7e12291d"]]), it = {
76
159
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
- install(e) {
78
- e.component("MlToolbar", F);
160
+ install(t) {
161
+ t.component("MlDropdown", y), t.component("MlLanguage", P), t.component("MlToolbar", W);
79
162
  }
80
163
  };
81
164
  export {
82
- F as MlToolbar,
83
- R as default
165
+ P as MlLanguage,
166
+ W as MlToolbar,
167
+ it as default
84
168
  };
@@ -1 +1,2 @@
1
- (function(t,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("element-plus/es"),require("element-plus/es/components/base/style/css"),require("element-plus/es/components/button-group/style/css"),require("element-plus/es/components/tooltip/style/css"),require("element-plus/es/components/button/style/css"),require("element-plus/es/components/icon/style/css"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus/es","element-plus/es/components/base/style/css","element-plus/es/components/button-group/style/css","element-plus/es/components/tooltip/style/css","element-plus/es/components/button/style/css","element-plus/es/components/icon/style/css","vue"],o):(t=typeof globalThis<"u"?globalThis:t||self,o(t.UIComponents={},t.es,null,null,null,null,null,t.Vue))})(this,function(t,o,g,z,C,M,q,e){"use strict";const m={key:0,class:"ml-toolbar-button-text"},p=((l,r)=>{const n=l.__vccOpts||l;for(const[i,u]of r)n[i]=u;return n})(e.defineComponent({__name:"MlToolbar",props:{items:{},size:{default:"large"},direction:{}},emits:{click:null},setup(l,{emit:r}){const n=l,i=r,u=e.computed(()=>n.direction==="vertical"?"ml-vertical-toolbar-button-group":"ml-horizontal-toolbar-button-group"),_=e.computed(()=>n.size==="small"?20:30),a=e.computed(()=>{switch(n.size){case"small":return 30;case"medium":return 50}return 70}),b=s=>s.description?s.description:s.text,f=e.computed(()=>n.size==="large"),y=s=>{i("click",s)};return(s,w)=>{const k=o.ElIcon,h=o.ElButton,x=o.ElTooltip,B=o.ElButtonGroup;return e.openBlock(),e.createBlock(B,{class:e.normalizeClass(u.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.items,(c,T)=>(e.openBlock(),e.createBlock(x,{key:c.text,content:b(c),"hide-after":0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(h,{class:"ml-toolbar-button",style:e.normalizeStyle({width:a.value+"px",height:a.value+"px"}),key:T,onClick:$=>y(c.command)},{default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(k,{size:_.value,innerHTML:c.icon},null,8,["size","innerHTML"]),f.value?(e.openBlock(),e.createElementBlock("div",m,e.toDisplayString(c.text),1)):e.createCommentVNode("",!0)])]),_:2},1032,["style","onClick"]))]),_:2},1032,["content"]))),128))]),_:1},8,["class"])}}}),[["__scopeId","data-v-0fe7ba99"]]),d={install(l){l.component("MlToolbar",p)}};t.MlToolbar=p,t.default=d,Object.defineProperties(t,{__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(".ml-dropdown-icon[data-v-05cd92db],.ml-dropdown-icon[data-v-05cd92db]:hover{outline:none;border:none}.ml-vertical-toolbar-button-group[data-v-7e12291d]{display:flex;flex-direction:column}.ml-horizontal-toolbar-button-group[data-v-7e12291d]{display:flex;flex-direction:row}.ml-toolbar-button[data-v-7e12291d]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px}.ml-toolbar-button-text[data-v-7e12291d]{margin-left:0;margin-top:5px}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ (function(l,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("element-plus/es"),require("element-plus/es/components/base/style/css"),require("element-plus/es/components/dropdown/style/css"),require("element-plus/es/components/dropdown-menu/style/css"),require("element-plus/es/components/dropdown-item/style/css"),require("element-plus/es/components/icon/style/css"),require("vue"),require("element-plus/es/components/button-group/style/css"),require("element-plus/es/components/tooltip/style/css"),require("element-plus/es/components/button/style/css")):typeof define=="function"&&define.amd?define(["exports","element-plus/es","element-plus/es/components/base/style/css","element-plus/es/components/dropdown/style/css","element-plus/es/components/dropdown-menu/style/css","element-plus/es/components/dropdown-item/style/css","element-plus/es/components/icon/style/css","vue","element-plus/es/components/button-group/style/css","element-plus/es/components/tooltip/style/css","element-plus/es/components/button/style/css"],n):(l=typeof globalThis<"u"?globalThis:l||self,n(l.UIComponents={},l.es,null,null,null,null,null,l.Vue))})(this,function(l,n,V,I,S,q,A,e){"use strict";const b=(t=>(e.pushScopeId("data-v-05cd92db"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em","data-v-63d067da":""},[e.createElementVNode("path",{fill:"currentColor",d:"m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"})],-1)),x=e.defineComponent({__name:"MlDropdown",props:{icon:{},items:{},current:{default:void 0}},emits:{click:null},setup(t,{emit:r}){const o=t,i=r,p=e.computed(()=>o.items.filter(c=>c.name!==o.current)),a=c=>{i("click",c)};return(c,g)=>{const u=n.ElIcon,_=n.ElDropdownItem,s=n.ElDropdownMenu,y=n.ElDropdown;return e.openBlock(),e.createBlock(y,{onCommand:a},{dropdown:e.withCtx(()=>[e.createVNode(s,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,m=>(e.openBlock(),e.createBlock(_,{key:m.text,command:m.name},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.text),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:e.withCtx(()=>[e.createVNode(u,{size:"30",class:"ml-dropdown-icon"},{default:e.withCtx(()=>[b]),_:1})]),_:1})}}}),h=(t,r)=>{const o=t.__vccOpts||t;for(const[i,p]of r)o[i]=p;return o},f=h(x,[["__scopeId","data-v-05cd92db"]]),C='<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" width="1.2em" height="1.2em" data-v-63d067da=""><path fill="currentColor" d="m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"></path></svg>',w=e.defineComponent({__name:"MlLanguage",props:{languages:{},current:{}},emits:{click:null},setup(t,{emit:r}){const o=t,i=r,p=a=>{i("click",a)};return(a,c)=>(e.openBlock(),e.createBlock(f,{icon:C,items:o.languages,current:o.current,onClick:p},null,8,["items","current"]))}}),B={key:0,class:"ml-toolbar-button-text"},k=h(e.defineComponent({__name:"MlToolbar",props:{items:{},size:{default:"large"},direction:{}},emits:{click:null},setup(t,{emit:r}){const o=t,i=r,p=e.computed(()=>o.direction==="vertical"?"ml-vertical-toolbar-button-group":"ml-horizontal-toolbar-button-group"),a=e.computed(()=>o.size==="small"?20:30),c=e.computed(()=>{switch(o.size){case"small":return 30;case"medium":return 50}return 70}),g=s=>s.description?s.description:s.text,u=e.computed(()=>o.size==="large"),_=s=>{i("click",s)};return(s,y)=>{const m=n.ElIcon,z=n.ElButton,L=n.ElTooltip,E=n.ElButtonGroup;return e.openBlock(),e.createBlock(E,{class:e.normalizeClass(p.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.items,(d,T)=>(e.openBlock(),e.createBlock(L,{key:d.text,content:g(d),"hide-after":0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(z,{class:"ml-toolbar-button",style:e.normalizeStyle({width:c.value+"px",height:c.value+"px"}),key:T,onClick:$=>_(d.command)},{default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(m,{size:a.value,innerHTML:d.icon},null,8,["size","innerHTML"]),u.value?(e.openBlock(),e.createElementBlock("div",B,e.toDisplayString(d.text),1)):e.createCommentVNode("",!0)])]),_:2},1032,["style","onClick"]))]),_:2},1032,["content"]))),128))]),_:1},8,["class"])}}}),[["__scopeId","data-v-7e12291d"]]),M={install(t){t.component("MlDropdown",f),t.component("MlLanguage",w),t.component("MlToolbar",k)}};l.MlLanguage=w,l.MlToolbar=k,l.default=M,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Data to descibe dropdown menu item
3
+ */
4
+ export interface MlDropdownMenuItem {
5
+ /**
6
+ * Key of the dropdown menu item
7
+ */
8
+ name: string;
9
+ /**
10
+ * Text shown in dropdown menu item
11
+ */
12
+ text: string;
13
+ }
14
+ /**
15
+ * Properties of MlDropdown component
16
+ */
17
+ interface Props {
18
+ /**
19
+ * Dropdown icon represented by one SVG string
20
+ */
21
+ icon: string;
22
+ /**
23
+ * An array of avaiable language
24
+ */
25
+ items: MlDropdownMenuItem[];
26
+ /**
27
+ * Key of the current selected dropdown menu item
28
+ */
29
+ current?: string;
30
+ }
31
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
32
+ current: undefined;
33
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
34
+ click: (...args: any[]) => void;
35
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
36
+ current: undefined;
37
+ }>>> & {
38
+ onClick?: ((...args: any[]) => any) | undefined;
39
+ }, {
40
+ current: string;
41
+ }, {}>;
42
+ export default _default;
43
+ type __VLS_WithDefaults<P, D> = {
44
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
45
+ default: D[K];
46
+ }> : P[K];
47
+ };
48
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
49
+ type __VLS_TypePropsToOption<T> = {
50
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
51
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
52
+ } : {
53
+ type: import('vue').PropType<T[K]>;
54
+ required: true;
55
+ };
56
+ };
57
+ type __VLS_PrettifyLocal<T> = {
58
+ [K in keyof T]: T[K];
59
+ } & {};
@@ -0,0 +1,106 @@
1
+ import { computed } from 'vue';
2
+ let __VLS_typeProps;
3
+ const props = withDefaults(defineProps(), {
4
+ current: undefined
5
+ });
6
+ const emit = defineEmits({
7
+ click: null
8
+ });
9
+ // Filter out the current item
10
+ const filteredItems = computed(() => {
11
+ return props.items.filter(item => item.name !== props.current);
12
+ });
13
+ const handleCommand = (command) => {
14
+ emit('click', command);
15
+ };
16
+ const __VLS_withDefaultsArg = (function (t) { return t; })({
17
+ current: undefined
18
+ });
19
+ const __VLS_fnComponent = (await import('vue')).defineComponent({
20
+ emits: {},
21
+ });
22
+ ;
23
+ let __VLS_functionalComponentProps;
24
+ const __VLS_ctxBase = {};
25
+ const __VLS_ctx = __VLS_ctxBase;
26
+ let __VLS_name;
27
+ const __VLS_localComponents = {
28
+ ...{},
29
+ ...{},
30
+ ...__VLS_ctxBase,
31
+ };
32
+ let __VLS_components;
33
+ let __VLS_styleScopedClasses;
34
+ __VLS_styleScopedClasses['ml-dropdown-icon'];
35
+ // CSS variable injection
36
+ // CSS variable injection end
37
+ let __VLS_resolvedLocalAndGlobalComponents;
38
+ const __VLS_0 = __VLS_resolvedLocalAndGlobalComponents.ElDropdown;
39
+ /** @type { [typeof __VLS_components.ElDropdown, typeof __VLS_components.elDropdown, typeof __VLS_components.ElDropdown, typeof __VLS_components.elDropdown, ] } */
40
+ // @ts-ignore
41
+ const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({ ...{ 'onCommand': {} }, }));
42
+ const __VLS_2 = __VLS_1({ ...{ 'onCommand': {} }, }, ...__VLS_functionalComponentArgsRest(__VLS_1));
43
+ let __VLS_6;
44
+ const __VLS_7 = {
45
+ onCommand: (__VLS_ctx.handleCommand)
46
+ };
47
+ let __VLS_3;
48
+ let __VLS_4;
49
+ const __VLS_8 = __VLS_resolvedLocalAndGlobalComponents.ElIcon;
50
+ /** @type { [typeof __VLS_components.ElIcon, typeof __VLS_components.elIcon, typeof __VLS_components.ElIcon, typeof __VLS_components.elIcon, ] } */
51
+ // @ts-ignore
52
+ const __VLS_9 = __VLS_asFunctionalComponent(__VLS_8, new __VLS_8({ size: ("30"), ...{ class: ("ml-dropdown-icon") }, }));
53
+ const __VLS_10 = __VLS_9({ size: ("30"), ...{ class: ("ml-dropdown-icon") }, }, ...__VLS_functionalComponentArgsRest(__VLS_9));
54
+ __VLS_elementAsFunction(__VLS_intrinsicElements.svg, __VLS_intrinsicElements.svg)({ preserveAspectRatio: ("xMidYMid meet"), viewBox: ("0 0 24 24"), width: ("1.2em"), height: ("1.2em"), "data-v-63d067da": (""), });
55
+ __VLS_elementAsFunction(__VLS_intrinsicElements.path, __VLS_intrinsicElements.path)({ fill: ("currentColor"), d: ("m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"), });
56
+ __VLS_nonNullable(__VLS_13.slots).default;
57
+ const __VLS_13 = __VLS_pickFunctionalComponentCtx(__VLS_8, __VLS_10);
58
+ __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
59
+ {
60
+ const { dropdown: __VLS_thisSlot } = __VLS_nonNullable(__VLS_5.slots);
61
+ const __VLS_14 = __VLS_resolvedLocalAndGlobalComponents.ElDropdownMenu;
62
+ /** @type { [typeof __VLS_components.ElDropdownMenu, typeof __VLS_components.elDropdownMenu, typeof __VLS_components.ElDropdownMenu, typeof __VLS_components.elDropdownMenu, ] } */
63
+ // @ts-ignore
64
+ const __VLS_15 = __VLS_asFunctionalComponent(__VLS_14, new __VLS_14({}));
65
+ const __VLS_16 = __VLS_15({}, ...__VLS_functionalComponentArgsRest(__VLS_15));
66
+ for (const [item] of __VLS_getVForSourceType((__VLS_ctx.filteredItems))) {
67
+ const __VLS_20 = __VLS_resolvedLocalAndGlobalComponents.ElDropdownItem;
68
+ /** @type { [typeof __VLS_components.ElDropdownItem, typeof __VLS_components.elDropdownItem, typeof __VLS_components.ElDropdownItem, typeof __VLS_components.elDropdownItem, ] } */
69
+ // @ts-ignore
70
+ const __VLS_21 = __VLS_asFunctionalComponent(__VLS_20, new __VLS_20({ key: ((item.text)), command: ((item.name)), }));
71
+ const __VLS_22 = __VLS_21({ key: ((item.text)), command: ((item.name)), }, ...__VLS_functionalComponentArgsRest(__VLS_21));
72
+ (item.text);
73
+ __VLS_nonNullable(__VLS_25.slots).default;
74
+ const __VLS_25 = __VLS_pickFunctionalComponentCtx(__VLS_20, __VLS_22);
75
+ }
76
+ __VLS_nonNullable(__VLS_19.slots).default;
77
+ const __VLS_19 = __VLS_pickFunctionalComponentCtx(__VLS_14, __VLS_16);
78
+ }
79
+ const __VLS_5 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2);
80
+ __VLS_styleScopedClasses['ml-dropdown-icon'];
81
+ var __VLS_slots;
82
+ var __VLS_inheritedAttrs;
83
+ const __VLS_refs = {};
84
+ const __VLS_templateResult = { slots: __VLS_slots,
85
+ refs: $refs,
86
+ attrs: {},
87
+ };
88
+ const __VLS_internalComponent = (await import('vue')).defineComponent({
89
+ setup() {
90
+ return {
91
+ filteredItems: filteredItems,
92
+ handleCommand: handleCommand,
93
+ };
94
+ },
95
+ emits: {},
96
+ props: {},
97
+ });
98
+ export default (await import('vue')).defineComponent({
99
+ setup() {
100
+ return {};
101
+ },
102
+ emits: {},
103
+ props: {},
104
+ });
105
+ ;
106
+ //# sourceMappingURL=MlDropdown.vue.js.map
@@ -0,0 +1,29 @@
1
+ import { MlDropdownMenuItem } from './MlDropdown.vue';
2
+ /**
3
+ * Properties of MlLanguage component
4
+ */
5
+ interface Props {
6
+ /**
7
+ * An array of avaiable languages
8
+ */
9
+ languages: MlDropdownMenuItem[];
10
+ /**
11
+ * Key of the current language
12
+ */
13
+ current: string;
14
+ }
15
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ click: (...args: any[]) => void;
17
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<Props>>> & {
18
+ onClick?: ((...args: any[]) => any) | undefined;
19
+ }, {}, {}>;
20
+ export default _default;
21
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
22
+ type __VLS_TypePropsToOption<T> = {
23
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
24
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
25
+ } : {
26
+ type: import('vue').PropType<T[K]>;
27
+ required: true;
28
+ };
29
+ };
@@ -0,0 +1,67 @@
1
+ import MlDropdown from './MlDropdown.vue';
2
+ const svg = '<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" width="1.2em" height="1.2em" data-v-63d067da=""><path fill="currentColor" d="m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"></path></svg>';
3
+ let __VLS_typeProps;
4
+ const props = defineProps();
5
+ const emit = defineEmits({
6
+ click: null
7
+ });
8
+ const handleClick = (command) => {
9
+ emit('click', command);
10
+ };
11
+ const __VLS_fnComponent = (await import('vue')).defineComponent({
12
+ emits: {},
13
+ });
14
+ ;
15
+ let __VLS_functionalComponentProps;
16
+ const __VLS_ctxBase = {};
17
+ const __VLS_ctx = __VLS_ctxBase;
18
+ let __VLS_name;
19
+ const __VLS_localComponents = {
20
+ ...{},
21
+ ...{},
22
+ ...__VLS_ctxBase,
23
+ };
24
+ let __VLS_components;
25
+ let __VLS_styleScopedClasses;
26
+ // CSS variable injection
27
+ // CSS variable injection end
28
+ let __VLS_resolvedLocalAndGlobalComponents;
29
+ // @ts-ignore
30
+ [MlDropdown,];
31
+ // @ts-ignore
32
+ const __VLS_0 = __VLS_asFunctionalComponent(MlDropdown, new MlDropdown({ ...{ 'onClick': {} }, icon: ((__VLS_ctx.svg)), items: ((props.languages)), current: ((props.current)), }));
33
+ const __VLS_1 = __VLS_0({ ...{ 'onClick': {} }, icon: ((__VLS_ctx.svg)), items: ((props.languages)), current: ((props.current)), }, ...__VLS_functionalComponentArgsRest(__VLS_0));
34
+ let __VLS_5;
35
+ const __VLS_6 = {
36
+ onClick: (__VLS_ctx.handleClick)
37
+ };
38
+ let __VLS_2;
39
+ let __VLS_3;
40
+ const __VLS_4 = __VLS_pickFunctionalComponentCtx(MlDropdown, __VLS_1);
41
+ var __VLS_slots;
42
+ var __VLS_inheritedAttrs;
43
+ const __VLS_refs = {};
44
+ const __VLS_templateResult = { slots: __VLS_slots,
45
+ refs: $refs,
46
+ attrs: {},
47
+ };
48
+ const __VLS_internalComponent = (await import('vue')).defineComponent({
49
+ setup() {
50
+ return {
51
+ MlDropdown: MlDropdown,
52
+ svg: svg,
53
+ handleClick: handleClick,
54
+ };
55
+ },
56
+ emits: {},
57
+ props: {},
58
+ });
59
+ export default (await import('vue')).defineComponent({
60
+ setup() {
61
+ return {};
62
+ },
63
+ emits: {},
64
+ props: {},
65
+ });
66
+ ;
67
+ //# sourceMappingURL=MlLanguage.vue.js.map
@@ -20,7 +20,7 @@ export interface MlButtonData {
20
20
  description?: string;
21
21
  }
22
22
  /**
23
- * Properties of MLToolbar components
23
+ * Properties of MlToolbar component
24
24
  */
25
25
  interface Props {
26
26
  /**
package/lib/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import MlLanguage from './MlLanguage.vue';
1
2
  import MlToolbar from './MlToolbar.vue';
2
- export { MlToolbar };
3
+ export { MlLanguage, MlToolbar };
4
+ export type { MlDropdownMenuItem } from './MlDropdown.vue';
3
5
  export type { MlButtonData } from './MlToolbar.vue';
4
6
  declare const _default: {
5
7
  install(app: any): void;
package/lib/index.js CHANGED
@@ -1,9 +1,13 @@
1
+ import MlDropdown from './MlDropdown.vue';
2
+ import MlLanguage from './MlLanguage.vue';
1
3
  import MlToolbar from './MlToolbar.vue';
2
- export { MlToolbar };
4
+ export { MlLanguage, MlToolbar };
3
5
  // Optionally, export them as a plugin for Vue
4
6
  export default {
5
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
8
  install(app) {
9
+ app.component('MlDropdown', MlDropdown);
10
+ app.component('MlLanguage', MlLanguage);
7
11
  app.component('MlToolbar', MlToolbar);
8
12
  }
9
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/ui-components",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "One common UI component library based on Element Plus",
5
5
  "license": "MIT",
6
6
  "author": "MLight Lee <mlight.lee@outlook.com>",
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <el-dropdown @command="handleCommand">
3
+ <el-icon size="30" class="ml-dropdown-icon">
4
+ <svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" width="1.2em" height="1.2em" data-v-63d067da=""><path fill="currentColor" d="m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"></path></svg>
5
+ </el-icon>
6
+ <template #dropdown>
7
+ <el-dropdown-menu>
8
+ <el-dropdown-item
9
+ v-for="(item) in filteredItems"
10
+ :key="item.text"
11
+ :command="item.name">
12
+ {{ item.text }}
13
+ </el-dropdown-item>
14
+ </el-dropdown-menu>
15
+ </template>
16
+ </el-dropdown>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import { computed } from 'vue'
21
+
22
+ /**
23
+ * Data to descibe dropdown menu item
24
+ */
25
+ export interface MlDropdownMenuItem {
26
+ /**
27
+ * Key of the dropdown menu item
28
+ */
29
+ name: string
30
+ /**
31
+ * Text shown in dropdown menu item
32
+ */
33
+ text: string
34
+ }
35
+
36
+ /**
37
+ * Properties of MlDropdown component
38
+ */
39
+ interface Props {
40
+ /**
41
+ * Dropdown icon represented by one SVG string
42
+ */
43
+ icon: string
44
+ /**
45
+ * An array of avaiable language
46
+ */
47
+ items: MlDropdownMenuItem[]
48
+ /**
49
+ * Key of the current selected dropdown menu item
50
+ */
51
+ current?: string
52
+ }
53
+
54
+ const props = withDefaults(defineProps<Props>(), {
55
+ current: undefined
56
+ })
57
+
58
+ const emit = defineEmits({
59
+ click: null
60
+ })
61
+
62
+ // Filter out the current item
63
+ const filteredItems = computed(() => {
64
+ return props.items.filter(item => item.name !== props.current);
65
+ });
66
+
67
+
68
+ const handleCommand = (command: string) => {
69
+ emit('click', command)
70
+ }
71
+ </script>
72
+
73
+ <style scoped>
74
+ .ml-dropdown-icon {
75
+ outline: none;
76
+ border: none;
77
+ }
78
+
79
+ .ml-dropdown-icon:hover {
80
+ outline: none;
81
+ border: none;
82
+ }
83
+ </style>
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <ml-dropdown :icon="svg" :items="props.languages" :current="props.current" @click="handleClick" />
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import MlDropdown, { MlDropdownMenuItem } from './MlDropdown.vue'
7
+
8
+ const svg = '<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" width="1.2em" height="1.2em" data-v-63d067da=""><path fill="currentColor" d="m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"></path></svg>'
9
+
10
+ /**
11
+ * Properties of MlLanguage component
12
+ */
13
+ interface Props {
14
+ /**
15
+ * An array of avaiable languages
16
+ */
17
+ languages: MlDropdownMenuItem[]
18
+ /**
19
+ * Key of the current language
20
+ */
21
+ current: string
22
+ }
23
+
24
+ const props = defineProps<Props>()
25
+
26
+ const emit = defineEmits({
27
+ click: null
28
+ })
29
+
30
+ const handleClick = (command: string) => {
31
+ emit('click', command)
32
+ }
33
+ </script>
34
+
35
+ <style scoped>
36
+ </style>
package/src/MlToolbar.vue CHANGED
@@ -48,7 +48,7 @@ export interface MlButtonData {
48
48
  }
49
49
 
50
50
  /**
51
- * Properties of MLToolbar components
51
+ * Properties of MlToolbar component
52
52
  */
53
53
  interface Props {
54
54
  /**
package/src/index.ts CHANGED
@@ -1,11 +1,16 @@
1
+ import MlDropdown from './MlDropdown.vue'
2
+ import MlLanguage from './MlLanguage.vue'
1
3
  import MlToolbar from './MlToolbar.vue'
2
- export { MlToolbar }
4
+ export { MlLanguage, MlToolbar }
5
+ export type { MlDropdownMenuItem } from './MlDropdown.vue'
3
6
  export type { MlButtonData } from './MlToolbar.vue'
4
7
 
5
8
  // Optionally, export them as a plugin for Vue
6
9
  export default {
7
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
11
  install(app: any) {
12
+ app.component('MlDropdown', MlDropdown)
13
+ app.component('MlLanguage', MlLanguage)
9
14
  app.component('MlToolbar', MlToolbar)
10
15
  }
11
16
  }
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
- .ml-vertical-toolbar-button-group[data-v-0fe7ba99]{display:flex;flex-direction:column}.ml-horizontal-toolbar-button-group[data-v-0fe7ba99]{display:flex;flex-direction:row}.ml-toolbar-button[data-v-0fe7ba99]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px}.ml-toolbar-button-text[data-v-0fe7ba99]{margin-left:0;margin-top:5px}