@mlightcad/ui-components 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .vertical-button-group[data-v-d11b3637]{display:flex;flex-direction:column;align-items:flex-start}.horizontal-button-group[data-v-d11b3637]{display:flex;flex-direction:row}.custom-button[data-v-d11b3637]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:10px}.icon-text-wrapper[data-v-d11b3637]{display:flex;flex-direction:column;align-items:center;justify-content:center}.button-text[data-v-d11b3637]{margin-left:0;margin-top:8px}
1
+ .ml-vertical-toolbar-button-group[data-v-dce3ecfb]{display:flex;flex-direction:column;align-items:flex-start}.ml-horizontal-toolbar-button-group[data-v-dce3ecfb]{display:flex;flex-direction:row}.ml-toolbar-button[data-v-dce3ecfb]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0}.ml-toolbar-button-text[data-v-dce3ecfb]{margin-left:0;margin-top:8px}
@@ -4,11 +4,11 @@ import "element-plus/es/components/button-group/style/css";
4
4
  import "element-plus/es/components/tooltip/style/css";
5
5
  import "element-plus/es/components/button/style/css";
6
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 w, renderList as M, normalizeStyle as S, createElementVNode as I, createVNode as L, toDisplayString as N, createCommentVNode as V } from "vue";
8
- const G = { class: "icon-text-wrapper" }, H = {
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 = {
9
9
  key: 0,
10
- class: "button-text"
11
- }, D = /* @__PURE__ */ B({
10
+ class: "ml-toolbar-button-text"
11
+ }, H = /* @__PURE__ */ B({
12
12
  __name: "MlToolbar",
13
13
  props: {
14
14
  items: {},
@@ -19,7 +19,7 @@ const G = { class: "icon-text-wrapper" }, H = {
19
19
  click: null
20
20
  },
21
21
  setup(e, { emit: c }) {
22
- const t = e, s = c, a = r(() => t.layout === "vertical" ? "vertical-button-group" : "horizontal-button-group"), _ = r(() => t.size === "small" ? 20 : 30), p = r(() => {
22
+ const t = e, s = c, a = r(() => t.layout === "vertical" ? "ml-vertical-toolbar-button-group" : "ml-horizontal-toolbar-button-group"), _ = r(() => t.size === "small" ? 20 : 30), p = r(() => {
23
23
  switch (t.size) {
24
24
  case "small":
25
25
  return 30;
@@ -27,32 +27,33 @@ const G = { class: "icon-text-wrapper" }, H = {
27
27
  return 50;
28
28
  }
29
29
  return 70;
30
- }), d = (o) => o.description ? o.description : o.text, b = r(() => t.size === "large"), v = (o) => {
30
+ }), d = (o) => o.description ? o.description : o.text, b = r(() => t.size === "large"), f = (o) => {
31
31
  s("click", o);
32
32
  };
33
- return (o, $) => {
34
- const f = y, h = g, x = C, z = T;
35
- return l(), i(z, {
33
+ return (o, O) => {
34
+ const v = y, z = g, h = C, k = T;
35
+ return l(), i(k, {
36
36
  class: E(a.value)
37
37
  }, {
38
38
  default: u(() => [
39
- (l(!0), m(w, null, M(o.items, (n, k) => (l(), i(x, {
39
+ (l(!0), m(M, null, S(o.items, (n, x) => (l(), i(h, {
40
40
  key: n.text,
41
41
  content: d(n)
42
42
  }, {
43
43
  default: u(() => [
44
- (l(), i(h, {
45
- style: S({ width: p.value + "px", height: p.value + "px" }),
46
- key: k,
47
- onClick: (j) => v(n.command)
44
+ (l(), i(z, {
45
+ class: "ml-toolbar-button",
46
+ style: w({ width: p.value + "px", height: p.value + "px" }),
47
+ key: x,
48
+ onClick: ($) => f(n.command)
48
49
  }, {
49
50
  default: u(() => [
50
- I("div", G, [
51
- L(f, {
51
+ I("div", null, [
52
+ L(v, {
52
53
  size: _.value,
53
54
  innerHTML: n.icon
54
55
  }, null, 8, ["size", "innerHTML"]),
55
- b.value ? (l(), m("div", H, N(n.text), 1)) : V("", !0)
56
+ b.value ? (l(), m("div", G, N(n.text), 1)) : V("", !0)
56
57
  ])
57
58
  ]),
58
59
  _: 2
@@ -65,18 +66,18 @@ const G = { class: "icon-text-wrapper" }, H = {
65
66
  }, 8, ["class"]);
66
67
  };
67
68
  }
68
- }), F = (e, c) => {
69
+ }), D = (e, c) => {
69
70
  const t = e.__vccOpts || e;
70
71
  for (const [s, a] of c)
71
72
  t[s] = a;
72
73
  return t;
73
- }, O = /* @__PURE__ */ F(D, [["__scopeId", "data-v-d11b3637"]]), U = {
74
+ }, F = /* @__PURE__ */ D(H, [["__scopeId", "data-v-dce3ecfb"]]), R = {
74
75
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
76
  install(e) {
76
- e.component("MlToolbar", O);
77
+ e.component("MlToolbar", F);
77
78
  }
78
79
  };
79
80
  export {
80
- O as MlToolbar,
81
- U as default
81
+ F as MlToolbar,
82
+ R as default
82
83
  };
@@ -1 +1 @@
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,C,M,q,w,e){"use strict";const m={class:"icon-text-wrapper"},d={key:0,class:"button-text"},u=((l,r)=>{const n=l.__vccOpts||l;for(const[i,p]of r)n[i]=p;return n})(e.defineComponent({__name:"MlToolbar",props:{items:{},size:{default:"large"},layout:{default:"horizontal"}},emits:{click:null},setup(l,{emit:r}){const n=l,i=r,p=e.computed(()=>n.layout==="vertical"?"vertical-button-group":"horizontal-button-group"),f=e.computed(()=>n.size==="small"?20:30),a=e.computed(()=>{switch(n.size){case"small":return 30;case"medium":return 50}return 70}),y=s=>s.description?s.description:s.text,b=e.computed(()=>n.size==="large"),k=s=>{i("click",s)};return(s,$)=>{const h=o.ElIcon,x=o.ElButton,B=o.ElTooltip,z=o.ElButtonGroup;return e.openBlock(),e.createBlock(z,{class:e.normalizeClass(p.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.items,(c,T)=>(e.openBlock(),e.createBlock(B,{key:c.text,content:y(c)},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(x,{style:e.normalizeStyle({width:a.value+"px",height:a.value+"px"}),key:T,onClick:I=>k(c.command)},{default:e.withCtx(()=>[e.createElementVNode("div",m,[e.createVNode(h,{size:f.value,innerHTML:c.icon},null,8,["size","innerHTML"]),b.value?(e.openBlock(),e.createElementBlock("div",d,e.toDisplayString(c.text),1)):e.createCommentVNode("",!0)])]),_:2},1032,["style","onClick"]))]),_:2},1032,["content"]))),128))]),_:1},8,["class"])}}}),[["__scopeId","data-v-d11b3637"]]),_={install(l){l.component("MlToolbar",u)}};t.MlToolbar=u,t.default=_,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
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,T,g,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[u,i]of r)n[u]=i;return n})(e.defineComponent({__name:"MlToolbar",props:{items:{},size:{default:"large"},layout:{default:"horizontal"}},emits:{click:null},setup(l,{emit:r}){const n=l,u=r,i=e.computed(()=>n.layout==="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=>{u("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(i.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.items,(c,z)=>(e.openBlock(),e.createBlock(x,{key:c.text,content:b(c)},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(h,{class:"ml-toolbar-button",style:e.normalizeStyle({width:a.value+"px",height:a.value+"px"}),key:z,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-dce3ecfb"]]),d={install(l){l.component("MlToolbar",p)}};t.MlToolbar=p,t.default=d,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -8,7 +8,7 @@ const emit = defineEmits({
8
8
  click: null
9
9
  });
10
10
  const buttonGroupClass = computed(() => {
11
- return props.layout === 'vertical' ? 'vertical-button-group' : 'horizontal-button-group';
11
+ return props.layout === 'vertical' ? 'ml-vertical-toolbar-button-group' : 'ml-horizontal-toolbar-button-group';
12
12
  });
13
13
  const buttonIconSize = computed(() => {
14
14
  return (props.size === 'small') ? 20 : 30;
@@ -67,8 +67,8 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.items))) {
67
67
  const __VLS_12 = __VLS_resolvedLocalAndGlobalComponents.ElButton;
68
68
  /** @type { [typeof __VLS_components.ElButton, typeof __VLS_components.elButton, typeof __VLS_components.ElButton, typeof __VLS_components.elButton, ] } */
69
69
  // @ts-ignore
70
- const __VLS_13 = __VLS_asFunctionalComponent(__VLS_12, new __VLS_12({ ...{ 'onClick': {} }, ...{ style: (({ width: __VLS_ctx.buttonSize + 'px', height: __VLS_ctx.buttonSize + 'px' })) }, key: ((index)), }));
71
- const __VLS_14 = __VLS_13({ ...{ 'onClick': {} }, ...{ style: (({ width: __VLS_ctx.buttonSize + 'px', height: __VLS_ctx.buttonSize + 'px' })) }, key: ((index)), }, ...__VLS_functionalComponentArgsRest(__VLS_13));
70
+ const __VLS_13 = __VLS_asFunctionalComponent(__VLS_12, new __VLS_12({ ...{ 'onClick': {} }, ...{ class: ("ml-toolbar-button") }, ...{ style: (({ width: __VLS_ctx.buttonSize + 'px', height: __VLS_ctx.buttonSize + 'px' })) }, key: ((index)), }));
71
+ const __VLS_14 = __VLS_13({ ...{ 'onClick': {} }, ...{ class: ("ml-toolbar-button") }, ...{ style: (({ width: __VLS_ctx.buttonSize + 'px', height: __VLS_ctx.buttonSize + 'px' })) }, key: ((index)), }, ...__VLS_functionalComponentArgsRest(__VLS_13));
72
72
  let __VLS_18;
73
73
  const __VLS_19 = {
74
74
  onClick: (...[$event]) => {
@@ -77,7 +77,7 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.items))) {
77
77
  };
78
78
  let __VLS_15;
79
79
  let __VLS_16;
80
- __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({ ...{ class: ("icon-text-wrapper") }, });
80
+ __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({});
81
81
  const __VLS_20 = __VLS_resolvedLocalAndGlobalComponents.ElIcon;
82
82
  /** @type { [typeof __VLS_components.ElIcon, typeof __VLS_components.elIcon, ] } */
83
83
  // @ts-ignore
@@ -85,7 +85,7 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.items))) {
85
85
  const __VLS_22 = __VLS_21({ size: ((__VLS_ctx.buttonIconSize)), }, ...__VLS_functionalComponentArgsRest(__VLS_21));
86
86
  __VLS_directiveAsFunction(__VLS_ctx.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (item.icon) }, null, null);
87
87
  if (__VLS_ctx.isShowButtonText) {
88
- __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({ ...{ class: ("button-text") }, });
88
+ __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({ ...{ class: ("ml-toolbar-button-text") }, });
89
89
  (item.text);
90
90
  }
91
91
  __VLS_nonNullable(__VLS_17.slots).default;
@@ -95,8 +95,8 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.items))) {
95
95
  }
96
96
  __VLS_nonNullable(__VLS_5.slots).default;
97
97
  const __VLS_5 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2);
98
- __VLS_styleScopedClasses['icon-text-wrapper'];
99
- __VLS_styleScopedClasses['button-text'];
98
+ __VLS_styleScopedClasses['ml-toolbar-button'];
99
+ __VLS_styleScopedClasses['ml-toolbar-button-text'];
100
100
  var __VLS_slots;
101
101
  var __VLS_inheritedAttrs;
102
102
  const __VLS_refs = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/ui-components",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
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>",
@@ -29,7 +29,8 @@
29
29
  "package.json"
30
30
  ],
31
31
  "devDependencies": {
32
- "rollup-plugin-peer-deps-external": "^2.2.4"
32
+ "rollup-plugin-peer-deps-external": "^2.2.4",
33
+ "vite-plugin-css-injected-by-js": "^3.5.1"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "element-plus": "^2.8.1",
package/src/MlToolbar.vue CHANGED
@@ -6,14 +6,15 @@
6
6
  :content="buttonTooltip(item)"
7
7
  >
8
8
  <el-button
9
+ class="ml-toolbar-button"
9
10
  :style="{ width: buttonSize + 'px', height: buttonSize + 'px' }"
10
11
  :key="index"
11
12
  @click="handleCommand(item.command)"
12
13
  >
13
- <div class="icon-text-wrapper">
14
+ <div>
14
15
  <!-- eslint-disable-next-line vue/no-v-text-v-html-on-component -->
15
16
  <el-icon :size="buttonIconSize" v-html="item.icon" />
16
- <div v-if="isShowButtonText" class="button-text">{{ item.text }}</div>
17
+ <div v-if="isShowButtonText" class="ml-toolbar-button-text">{{ item.text }}</div>
17
18
  </div>
18
19
  </el-button>
19
20
  </el-tooltip>
@@ -78,7 +79,7 @@ const emit = defineEmits({
78
79
  })
79
80
 
80
81
  const buttonGroupClass = computed(() => {
81
- return props.layout === 'vertical' ? 'vertical-button-group' : 'horizontal-button-group'
82
+ return props.layout === 'vertical' ? 'ml-vertical-toolbar-button-group' : 'ml-horizontal-toolbar-button-group'
82
83
  })
83
84
 
84
85
  const buttonIconSize = computed(() => {
@@ -109,33 +110,26 @@ const handleCommand = (command: string) => {
109
110
  </script>
110
111
 
111
112
  <style scoped>
112
- .vertical-button-group {
113
+ .ml-vertical-toolbar-button-group {
113
114
  display: flex;
114
115
  flex-direction: column;
115
116
  align-items: flex-start;
116
117
  }
117
118
 
118
- .horizontal-button-group {
119
+ .ml-horizontal-toolbar-button-group {
119
120
  display: flex;
120
121
  flex-direction: row;
121
122
  }
122
123
 
123
- .custom-button {
124
+ .ml-toolbar-button {
124
125
  display: flex;
125
126
  flex-direction: column;
126
127
  align-items: center;
127
128
  justify-content: center;
128
- padding: 10px;
129
+ padding: 0px;
129
130
  }
130
131
 
131
- .icon-text-wrapper {
132
- display: flex;
133
- flex-direction: column;
134
- align-items: center;
135
- justify-content: center;
136
- }
137
-
138
- .button-text {
132
+ .ml-toolbar-button-text {
139
133
  margin-left: 0px;
140
134
  margin-top: 8px;
141
135
  }