lew-ui 1.0.16 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,10 @@
1
+ ![471656552467_.pic_i9uhs1_.jpeg](https://cdn.jsdelivr.net/gh/lewkamtao/PicHub-Cloud@master/PicHub/471656552467_.pic_i9uhs1_.jpeg)
2
+
1
3
  # Lew-UI
2
4
 
3
5
  A Component Library for Vue3.js.
4
6
  Doc address: https://lew.kamtao.com
5
7
 
6
-
7
8
  ## Install
8
9
 
9
10
  ```bash
@@ -12,13 +13,15 @@ npm install lew-ui --save
12
13
 
13
14
  ## How to use
14
15
 
15
- 引入css
16
+ 引入 css
17
+
16
18
  ```js
17
19
  // main.ts
18
- import "lew-ui/dist/style.css";
20
+ import 'lew-ui/dist/style.css';
19
21
  ```
20
22
 
21
23
  页面
24
+
22
25
  ```vue
23
26
  <script setup lang="ts">
24
27
  import { LewButton } from 'lew-ui';
@@ -28,3 +31,10 @@ import { LewButton } from 'lew-ui';
28
31
  <lew-button> 发送 </lew-button>
29
32
  </template>
30
33
  ```
34
+
35
+ ## Thanks
36
+
37
+ - https://github.com/TuSimple/naive-ui
38
+ - https://github.com/atomiks/tippyjs
39
+ - https://github.com/fancyapps/ui
40
+ - https://github.com/sampotts/plyr
package/dist/lew.es.ts CHANGED
@@ -29,7 +29,7 @@ var __objRest = (source2, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { defineComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot, inject, ref, onMounted, onUnmounted, createElementVNode, unref, Fragment, renderList, toDisplayString, createCommentVNode, pushScopeId, popScopeId, watch, withDirectives, vModelText, vShow, createTextVNode, createBlock, createVNode, vModelCheckbox, provide, computed, onBeforeMount, h as h$1, withCtx, Teleport, createApp, Transition, withModifiers, resolveComponent, resolveDirective, isRef } from "vue";
32
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot, onUnmounted, onMounted, getCurrentInstance, unref, ref, createElementVNode, Fragment, renderList, toDisplayString, createCommentVNode, pushScopeId, popScopeId, watch, withDirectives, vModelText, vShow, createTextVNode, createBlock, createVNode, vModelCheckbox, provide, inject, computed, onBeforeMount, h as h$1, withCtx, Teleport, createApp, Transition, withModifiers, resolveComponent, resolveDirective, isRef } from "vue";
33
33
  var LewFlex_vue_vue_type_style_index_0_scoped_true_lang = "";
34
34
  var _export_sfc = (sfc, props) => {
35
35
  const target = sfc.__vccOpts || sfc;
@@ -128,33 +128,34 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
128
128
  }
129
129
  });
130
130
  var LewLayout = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-38cc287d"], ["__file", "/Users/kamtao/Documents/GitHub/Lew-UI/packages/components/layout/src/LewLayout.vue"]]);
131
- /*!
132
- * vue-router v4.0.13
133
- * (c) 2022 Eduardo San Martin Morote
134
- * @license MIT
135
- */
136
- const hasSymbol = typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol";
137
- const PolySymbol = (name) => hasSymbol ? Symbol("[vue-router]: " + name) : "[vue-router]: " + name;
138
- const routerKey = /* @__PURE__ */ PolySymbol("router");
139
- var NavigationType;
140
- (function(NavigationType2) {
141
- NavigationType2["pop"] = "pop";
142
- NavigationType2["push"] = "push";
143
- })(NavigationType || (NavigationType = {}));
144
- var NavigationDirection;
145
- (function(NavigationDirection2) {
146
- NavigationDirection2["back"] = "back";
147
- NavigationDirection2["forward"] = "forward";
148
- NavigationDirection2["unknown"] = "";
149
- })(NavigationDirection || (NavigationDirection = {}));
150
- var NavigationFailureType;
151
- (function(NavigationFailureType2) {
152
- NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted";
153
- NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled";
154
- NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated";
155
- })(NavigationFailureType || (NavigationFailureType = {}));
156
- function useRouter() {
157
- return inject(routerKey);
131
+ function useDOMCreate(nodeId) {
132
+ const node = document.createElement("div");
133
+ node.id = nodeId;
134
+ document.body.appendChild(node);
135
+ onUnmounted(() => {
136
+ document.body.removeChild(node);
137
+ });
138
+ }
139
+ let instance$1;
140
+ function useLewTo() {
141
+ const lewTo = (path) => {
142
+ var _a;
143
+ const router = (_a = instance$1.appContext.config) == null ? void 0 : _a.globalProperties.$router;
144
+ if (!path)
145
+ return;
146
+ if (path && path.startsWith("http")) {
147
+ window.open(path);
148
+ } else {
149
+ router.push(path);
150
+ }
151
+ return;
152
+ };
153
+ onMounted(() => {
154
+ instance$1 = getCurrentInstance();
155
+ });
156
+ return {
157
+ lewTo
158
+ };
158
159
  }
159
160
  var LewMark_vue_vue_type_style_index_0_lang = "";
160
161
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
@@ -168,7 +169,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
168
169
  type: Boolean,
169
170
  default: false
170
171
  },
171
- link: {
172
+ to: {
172
173
  type: String,
173
174
  default: ""
174
175
  },
@@ -178,22 +179,12 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
178
179
  }
179
180
  },
180
181
  setup(__props) {
181
- const props = __props;
182
- const router = useRouter();
183
- const toPath = () => {
184
- if (props.link) {
185
- if (props.link.startsWith("http")) {
186
- window.open(props.link);
187
- } else {
188
- router.push(props.link);
189
- }
190
- }
191
- };
182
+ const { lewTo } = useLewTo();
192
183
  return (_ctx, _cache) => {
193
184
  return openBlock(), createElementBlock("span", {
194
- class: normalizeClass(["lew-mark", `lew-mark-${__props.type} ${__props.round ? "lew-mark-round" : ""} ${__props.link ? "lew-mark-link" : ""}`]),
185
+ class: normalizeClass(["lew-mark", `lew-mark-${__props.type} ${__props.round ? "lew-mark-round" : ""} ${__props.to ? "lew-mark-to" : ""}`]),
195
186
  style: normalizeStyle(`font-weight:${__props.bold};`),
196
- onClick: toPath
187
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(lewTo)(__props.to))
197
188
  }, [
198
189
  renderSlot(_ctx.$slots, "default")
199
190
  ], 6);
@@ -350,16 +341,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
350
341
  }
351
342
  },
352
343
  setup(__props) {
353
- const router = useRouter();
354
- const toPath = (path) => {
355
- if (path) {
356
- if (path.startsWith("http")) {
357
- window.open(path);
358
- } else {
359
- router.push(path);
360
- }
361
- }
362
- };
344
+ const { lewTo } = useLewTo();
363
345
  return (_ctx, _cache) => {
364
346
  return openBlock(), createElementBlock("div", _hoisted_1$r, [
365
347
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index2) => {
@@ -368,8 +350,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
368
350
  class: normalizeClass(["lew-breadcrumb-item", { "lew-breadcrumb-active": item.active }])
369
351
  }, [
370
352
  createElementVNode("span", {
371
- class: normalizeClass({ "lew-breadcrumb-isPath": !!item.path }),
372
- onClick: ($event) => toPath(item.path)
353
+ class: normalizeClass({ "lew-breadcrumb-isPath": !!item.to }),
354
+ onClick: ($event) => unref(lewTo)(item.to)
373
355
  }, toDisplayString(item.label), 11, _hoisted_2$l),
374
356
  index2 != __props.options.length - 1 ? (openBlock(), createElementBlock("div", _hoisted_3$f, [
375
357
  __props.iconType == "sprit" ? (openBlock(), createElementBlock("svg", _hoisted_4$4, _hoisted_6$2)) : createCommentVNode("v-if", true),
@@ -3702,8 +3684,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3702
3684
  return openBlock(), createElementBlock("div", _hoisted_1$i, [
3703
3685
  createElementVNode("img", {
3704
3686
  src: __props.src,
3705
- class: normalizeClass({ round: __props.round }),
3706
- alt: __props.alt
3687
+ alt: __props.alt,
3688
+ class: normalizeClass(__props.round ? "lew-avarar-round" : "")
3707
3689
  }, null, 10, _hoisted_2$g),
3708
3690
  __props.status ? (openBlock(), createElementBlock("span", {
3709
3691
  key: 0,
@@ -4478,7 +4460,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4478
4460
  type: Boolean,
4479
4461
  default: false
4480
4462
  },
4481
- link: {
4463
+ to: {
4482
4464
  type: String,
4483
4465
  default: ""
4484
4466
  }
@@ -4486,26 +4468,17 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4486
4468
  emits: ["close"],
4487
4469
  setup(__props, { emit }) {
4488
4470
  const props = __props;
4489
- const router = useRouter();
4471
+ const { lewTo } = useLewTo();
4490
4472
  const close = () => {
4491
4473
  if (props.disabled) {
4492
4474
  return;
4493
4475
  }
4494
4476
  emit("close");
4495
4477
  };
4496
- const toPath = () => {
4497
- if (props.link) {
4498
- if (props.link.startsWith("http")) {
4499
- window.open(props.link);
4500
- } else {
4501
- router.push(props.link);
4502
- }
4503
- }
4504
- };
4505
4478
  return (_ctx, _cache) => {
4506
4479
  return openBlock(), createElementBlock("div", {
4507
- class: normalizeClass(["lew-tag", `lew-tag-${__props.size} lew-tag-${__props.type} ${__props.round ? "lew-tag-round" : ""} ${__props.disabled ? "lew-tag-disabled" : ""} ${__props.link ? "lew-tag-link" : ""}`]),
4508
- onClick: toPath
4480
+ class: normalizeClass(["lew-tag", `lew-tag-${__props.size} lew-tag-${__props.type} ${__props.round ? "lew-tag-round" : ""} ${__props.disabled ? "lew-tag-disabled" : ""} ${__props.to ? "lew-tag-to" : ""}`]),
4481
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(lewTo)(__props.to))
4509
4482
  }, [
4510
4483
  createElementVNode("div", _hoisted_1$7, [
4511
4484
  renderSlot(_ctx.$slots, "left")
@@ -4823,14 +4796,6 @@ const addMessage = (type, text) => {
4823
4796
  }, 10);
4824
4797
  };
4825
4798
  var index$3 = { warning, info, normal, success, error };
4826
- function useDOMCreate(nodeId) {
4827
- const node = document.createElement("div");
4828
- node.id = nodeId;
4829
- document.body.appendChild(node);
4830
- onUnmounted(() => {
4831
- document.body.removeChild(node);
4832
- });
4833
- }
4834
4799
  var LewModal_vue_vue_type_style_index_0_scoped_true_lang = "";
4835
4800
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4836
4801
  name: "LewModal",