y-design-ssr 0.2.6 → 0.2.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.
Files changed (101) hide show
  1. package/README.md +1 -1
  2. package/libs/button/index.css +1 -579
  3. package/libs/button/index.mjs +66 -111
  4. package/libs/button/index.umd.js +2 -203
  5. package/libs/cell/index.css +1 -1077
  6. package/libs/cell/index.mjs +105 -168
  7. package/libs/cell/index.umd.js +2 -301
  8. package/libs/checkbox/index.css +1 -1053
  9. package/libs/checkbox/index.mjs +128 -243
  10. package/libs/checkbox/index.umd.js +2 -370
  11. package/libs/checkboxGroup/index.css +1 -422
  12. package/libs/checkboxGroup/index.mjs +88 -174
  13. package/libs/checkboxGroup/index.umd.js +2 -266
  14. package/libs/col/index.css +1 -615
  15. package/libs/col/index.mjs +82 -247
  16. package/libs/col/index.umd.js +2 -306
  17. package/libs/countdown/index.css +1 -417
  18. package/libs/countdown/index.mjs +72 -180
  19. package/libs/countdown/index.umd.js +2 -232
  20. package/libs/dialog/index.css +1 -1405
  21. package/libs/dialog/index.mjs +477 -647
  22. package/libs/dialog/index.umd.js +2 -1129
  23. package/libs/empty/index.css +1 -457
  24. package/libs/empty/index.mjs +45 -92
  25. package/libs/empty/index.umd.js +2 -140
  26. package/libs/form/index.css +1 -477
  27. package/libs/form/index.mjs +127 -227
  28. package/libs/form/index.umd.js +2 -320
  29. package/libs/formItem/index.css +1 -477
  30. package/libs/formItem/index.mjs +127 -277
  31. package/libs/formItem/index.umd.js +2 -373
  32. package/libs/icon/index.css +1 -982
  33. package/libs/icon/index.mjs +59 -108
  34. package/libs/icon/index.umd.js +2 -187
  35. package/libs/index.css +1 -2902
  36. package/libs/index.mjs +2348 -3789
  37. package/libs/index.umd.js +2 -5509
  38. package/libs/input/index.css +1 -483
  39. package/libs/input/index.mjs +93 -184
  40. package/libs/input/index.umd.js +2 -275
  41. package/libs/layout/index.css +1 -684
  42. package/libs/layout/index.mjs +130 -230
  43. package/libs/layout/index.umd.js +2 -318
  44. package/libs/list/index.css +1 -440
  45. package/libs/list/index.mjs +208 -389
  46. package/libs/list/index.umd.js +2 -572
  47. package/libs/loading/index.css +1 -548
  48. package/libs/loading/index.mjs +119 -197
  49. package/libs/loading/index.umd.js +2 -322
  50. package/libs/locale/index.mjs +28 -0
  51. package/libs/locale/index.umd.js +1 -0
  52. package/libs/locale/package.json +6 -0
  53. package/libs/mask/index.css +1 -426
  54. package/libs/mask/index.mjs +71 -132
  55. package/libs/mask/index.umd.js +2 -202
  56. package/libs/popup/index.css +1 -465
  57. package/libs/popup/index.mjs +135 -211
  58. package/libs/popup/index.umd.js +2 -359
  59. package/libs/progress/index.css +1 -488
  60. package/libs/progress/index.mjs +129 -201
  61. package/libs/progress/index.umd.js +2 -323
  62. package/libs/pullrefresh/index.css +1 -441
  63. package/libs/pullrefresh/index.mjs +112 -242
  64. package/libs/pullrefresh/index.umd.js +2 -303
  65. package/libs/row/index.css +1 -485
  66. package/libs/row/index.mjs +90 -182
  67. package/libs/row/index.umd.js +2 -238
  68. package/libs/slider/index.css +1 -558
  69. package/libs/slider/index.mjs +161 -357
  70. package/libs/slider/index.umd.js +2 -454
  71. package/libs/stepper/index.css +1 -489
  72. package/libs/stepper/index.mjs +102 -182
  73. package/libs/stepper/index.umd.js +2 -270
  74. package/libs/style/index.css +1 -0
  75. package/libs/style/index.mjs +1 -0
  76. package/libs/style/index.umd.js +2 -0
  77. package/libs/style/package.json +6 -0
  78. package/libs/swipe/index.css +1 -506
  79. package/libs/swipe/index.mjs +260 -543
  80. package/libs/swipe/index.umd.js +2 -704
  81. package/libs/swipeItem/index.css +1 -424
  82. package/libs/swipeItem/index.mjs +53 -112
  83. package/libs/swipeItem/index.umd.js +2 -155
  84. package/libs/switch/index.css +1 -472
  85. package/libs/switch/index.mjs +63 -122
  86. package/libs/switch/index.umd.js +2 -201
  87. package/libs/tab/index.mjs +69 -132
  88. package/libs/tab/index.umd.js +1 -191
  89. package/libs/tabs/index.css +1 -514
  90. package/libs/tabs/index.mjs +411 -752
  91. package/libs/tabs/index.umd.js +2 -1021
  92. package/libs/toast/index.css +1 -1050
  93. package/libs/toast/index.mjs +115 -184
  94. package/libs/toast/index.umd.js +2 -307
  95. package/libs/tooltip/index.css +1 -514
  96. package/libs/tooltip/index.mjs +156 -294
  97. package/libs/tooltip/index.umd.js +2 -417
  98. package/libs/utils/index.mjs +76 -0
  99. package/libs/utils/index.umd.js +1 -0
  100. package/libs/utils/package.json +6 -0
  101. package/package.json +1 -4
@@ -1,40 +1,11 @@
1
- import { ref, reactive, defineComponent, getCurrentInstance, computed, onMounted, onUnmounted, createVNode } from "vue";
2
- const getMods = (el, mods) => {
3
- if (!mods) {
4
- return "";
5
- }
6
- if (typeof mods === "string") {
7
- return ` ${el}--${mods}`;
8
- }
9
- if (Array.isArray(mods)) {
10
- return mods.reduce((acc, cur) => acc + getMods(el, cur), "");
11
- }
12
- return Object.keys(mods).reduce(
13
- (acc, cur) => acc + (mods[cur] ? getMods(el, cur) : ""),
14
- ""
15
- );
16
- };
17
- const createBEM = (block) => {
18
- return (el, mods) => {
19
- let _el = el;
20
- let _mods = mods;
21
- if (_el && typeof _el !== "string") {
22
- _mods = _el;
23
- _el = "";
24
- }
25
- _el = _el ? `${block}__${_el}` : block;
26
- return `${_el}${getMods(_el, _mods)}`;
27
- };
28
- };
29
- const createGlobalBem = () => {
30
- return (el, mods) => {
31
- if (!mods) {
32
- return `y-${el}`;
33
- }
34
- return `${getMods(`y-${el}`, mods)}`;
35
- };
36
- };
37
- const defaultLang = {
1
+ import { ref as T, reactive as P, defineComponent as H, getCurrentInstance as F, computed as C, onMounted as Y, onUnmounted as X, createVNode as x } from "vue";
2
+ const y = (t, n) => n ? typeof n == "string" ? ` ${t}--${n}` : Array.isArray(n) ? n.reduce((r, a) => r + y(t, a), "") : Object.keys(n).reduce(
3
+ (r, a) => r + (n[a] ? y(t, a) : ""),
4
+ ""
5
+ ) : "", k = (t) => (n, r) => {
6
+ let a = n, s = r;
7
+ return a && typeof a != "string" && (s = a, a = ""), a = a ? `${t}__${a}` : t, `${a}${y(a, s)}`;
8
+ }, z = () => (t, n) => n ? `${y(`y-${t}`, n)}` : `y-${t}`, B = {
38
9
  "pull-refresh": {
39
10
  pulling: "下拉刷新...",
40
11
  loosing: "释放刷新...",
@@ -45,88 +16,59 @@ const defaultLang = {
45
16
  "form-item": {
46
17
  validateMessage: "请输入正确内容"
47
18
  }
48
- };
49
- const lang = ref("zh-CN");
50
- const langs = reactive({
51
- "zh-CN": defaultLang
52
- });
53
- const locale$1 = {
19
+ }, b = T("zh-CN"), M = P({
20
+ "zh-CN": B
21
+ }), j = {
54
22
  text() {
55
- return langs[lang.value];
23
+ return M[b.value];
56
24
  },
57
- use(newLang, newConfigs) {
58
- lang.value = newLang;
59
- this.add({ [newLang]: newConfigs });
25
+ use(t, n) {
26
+ b.value = t, this.add({ [t]: n });
60
27
  },
61
- add(newConfigs = {}) {
62
- Object.assign(langs, newConfigs);
28
+ add(t = {}) {
29
+ Object.assign(M, t);
63
30
  }
64
- };
65
- const createNamespace = (name2) => {
66
- const prefixedName = `y-${name2}`;
67
- return [prefixedName, createBEM(prefixedName), createGlobalBem()];
68
- };
69
- const createLocale = (name2) => {
70
- return locale$1.text()[name2];
71
- };
72
- const getAngle = (x1, y1, x2, y2) => {
73
- const x = Math.abs(x1 - x2);
74
- const y = Math.abs(y1 - y2);
75
- const z = Math.sqrt(x * x + y * y);
76
- return 90 - Math.round(Math.asin(y / z) / Math.PI * 180);
77
- };
78
- const hasInnerScroll = (e) => {
79
- const currentTarget = e.currentTarget;
80
- const target = e.target;
81
- let bool = false;
82
- if (currentTarget === target)
83
- return bool;
84
- const _hasInnerScroll = (t) => {
85
- if (t.offsetHeight !== t.scrollHeight && t.scrollTop !== 0) {
86
- bool = true;
87
- } else if (t.parentElement && t.parentElement !== currentTarget) {
88
- _hasInnerScroll(t.parentElement);
89
- }
31
+ }, V = (t) => {
32
+ const n = `y-${t}`;
33
+ return [n, k(n), z()];
34
+ }, W = (t) => j.text()[t], q = (t, n, r, a) => {
35
+ const s = Math.abs(t - r), l = Math.abs(n - a), g = Math.sqrt(s * s + l * l);
36
+ return 90 - Math.round(Math.asin(l / g) / Math.PI * 180);
37
+ }, w = (t) => {
38
+ const n = t.currentTarget, r = t.target;
39
+ let a = !1;
40
+ if (n === r)
41
+ return a;
42
+ const s = (l) => {
43
+ l.offsetHeight !== l.scrollHeight && l.scrollTop !== 0 ? a = !0 : l.parentElement && l.parentElement !== n && s(l.parentElement);
90
44
  };
91
- target && _hasInnerScroll(target);
92
- return bool;
93
- };
94
- const [name, bem] = createNamespace("pull-refresh");
95
- const locale = createLocale("pull-refresh");
96
- const ANGLE = 30;
97
- const ANIMATION_TIME = 0.5;
98
- let RefreshStatus = /* @__PURE__ */ function(RefreshStatus2) {
99
- RefreshStatus2["DEFUALT"] = "normal";
100
- RefreshStatus2["PULLING"] = "pulling";
101
- RefreshStatus2["LOOSING"] = "loosing";
102
- RefreshStatus2["LOADING"] = "loading";
103
- RefreshStatus2["SUCCESS"] = "success";
104
- RefreshStatus2["FAILED"] = "failed";
105
- return RefreshStatus2;
45
+ return r && s(r), a;
46
+ }, [J, S] = V("pull-refresh"), h = W("pull-refresh"), K = 30, U = 0.5;
47
+ let u = /* @__PURE__ */ function(t) {
48
+ return t.DEFUALT = "normal", t.PULLING = "pulling", t.LOOSING = "loosing", t.LOADING = "loading", t.SUCCESS = "success", t.FAILED = "failed", t;
106
49
  }({});
107
- const getScale = (num) => num < 60 ? 1 : 1 - (num - 60) / 600;
108
- const Pullrefresh = /* @__PURE__ */ defineComponent({
109
- name,
50
+ const Q = (t) => t < 60 ? 1 : 1 - (t - 60) / 600, A = /* @__PURE__ */ H({
51
+ name: J,
110
52
  props: {
111
53
  pullingText: {
112
54
  type: String,
113
- default: locale.pulling
55
+ default: h.pulling
114
56
  },
115
57
  loosingText: {
116
58
  type: String,
117
- default: locale.loosing
59
+ default: h.loosing
118
60
  },
119
61
  loadingText: {
120
62
  type: String,
121
- default: locale.loading
63
+ default: h.loading
122
64
  },
123
65
  successText: {
124
66
  type: String,
125
- default: locale.success
67
+ default: h.success
126
68
  },
127
69
  failedText: {
128
70
  type: String,
129
- default: locale.failed
71
+ default: h.failed
130
72
  },
131
73
  statusHeight: {
132
74
  type: Number,
@@ -134,164 +76,92 @@ const Pullrefresh = /* @__PURE__ */ defineComponent({
134
76
  },
135
77
  disabled: {
136
78
  type: Boolean,
137
- default: false
79
+ default: !1
138
80
  }
139
81
  },
140
- setup(props, {
141
- slots,
142
- emit,
143
- expose
82
+ setup(t, {
83
+ slots: n,
84
+ emit: r,
85
+ expose: a
144
86
  }) {
145
- const instance = getCurrentInstance();
146
- let _startPosX = 0;
147
- let _startPosY = 0;
148
- let _transitionHeight = 0;
149
- let $scroll = null;
150
- const translateY = ref(0);
151
- const transitionTime = ref(0);
152
- const refreshStatus = ref(RefreshStatus.DEFUALT);
153
- const children = computed(() => {
154
- var _a;
155
- const $el = (_a = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a.$el;
156
- const $children = [...$el.childNodes];
157
- return $children == null ? void 0 : $children.filter((node) => node.nodeType !== 3 || node.nodeValue !== "");
158
- });
159
- const callback = (status = "success") => {
160
- refreshStatus.value = status;
161
- setTimeout(() => {
162
- translateY.value = 0;
163
- }, 500);
164
- setTimeout(() => {
165
- refreshStatus.value = RefreshStatus.DEFUALT;
87
+ const s = F();
88
+ let l = 0, g = 0, p = 0, N = null;
89
+ const c = T(0), L = T(0), o = T(u.DEFUALT), I = C(() => {
90
+ var v;
91
+ const i = [...((v = s == null ? void 0 : s.proxy) == null ? void 0 : v.$el).childNodes];
92
+ return i == null ? void 0 : i.filter((d) => d.nodeType !== 3 || d.nodeValue !== "");
93
+ }), G = (e = "success") => {
94
+ o.value = e, setTimeout(() => {
95
+ c.value = 0;
96
+ }, 500), setTimeout(() => {
97
+ o.value = u.DEFUALT;
166
98
  }, 1e3);
99
+ }, D = () => {
100
+ c.value = t.statusHeight, L.value = U, o.value = u.LOADING, r("load", G);
101
+ }, m = (e) => {
102
+ l = e instanceof TouchEvent ? e.touches[0].pageX : e.pageX, g = e instanceof TouchEvent ? e.touches[0].pageY : e.pageY, I.value.length !== 2 || I.value[1].nodeType === 3 ? N = s == null ? void 0 : s.vnode.el : N = I.value[1], !t.disabled && !w(e) && N.scrollTop === 0 && o.value === u.DEFUALT && (o.value = u.PULLING, c.value = 0, L.value = 0);
103
+ }, E = (e) => {
104
+ const i = e instanceof TouchEvent ? e.touches[0].pageX : e.pageX, v = e instanceof TouchEvent ? e.touches[0].pageY : e.pageY, d = q(l, g, i, v);
105
+ p = v - g, (o.value === u.PULLING || o.value === u.LOOSING) && p > 0 && d < K && (e.preventDefault(), c.value = p * Q(p), p > t.statusHeight && o.value === u.PULLING && (o.value = u.LOOSING));
106
+ }, f = (e) => {
107
+ o.value === u.LOOSING ? (c.value = t.statusHeight, L.value = U, o.value = u.LOADING, r("load", G, e)) : o.value === u.PULLING && (c.value = 0, o.value = u.DEFUALT);
167
108
  };
168
- const refresh = () => {
169
- translateY.value = props.statusHeight;
170
- transitionTime.value = ANIMATION_TIME;
171
- refreshStatus.value = RefreshStatus.LOADING;
172
- emit("load", callback);
173
- };
174
- const touchStart = (e) => {
175
- _startPosX = e instanceof TouchEvent ? e.touches[0].pageX : e.pageX;
176
- _startPosY = e instanceof TouchEvent ? e.touches[0].pageY : e.pageY;
177
- if (children.value.length !== 2 || children.value[1].nodeType === 3) {
178
- $scroll = instance == null ? void 0 : instance.vnode.el;
179
- } else {
180
- $scroll = children.value[1];
181
- }
182
- if (!props.disabled && !hasInnerScroll(e) && $scroll.scrollTop === 0 && refreshStatus.value === RefreshStatus.DEFUALT) {
183
- refreshStatus.value = RefreshStatus.PULLING;
184
- translateY.value = 0;
185
- transitionTime.value = 0;
186
- }
187
- };
188
- const touchMove = (e) => {
189
- const x = e instanceof TouchEvent ? e.touches[0].pageX : e.pageX;
190
- const y = e instanceof TouchEvent ? e.touches[0].pageY : e.pageY;
191
- const angle = getAngle(_startPosX, _startPosY, x, y);
192
- _transitionHeight = y - _startPosY;
193
- if ((refreshStatus.value === RefreshStatus.PULLING || refreshStatus.value === RefreshStatus.LOOSING) && _transitionHeight > 0 && angle < ANGLE) {
194
- e.preventDefault();
195
- translateY.value = _transitionHeight * getScale(_transitionHeight);
196
- if (_transitionHeight > props.statusHeight && refreshStatus.value === RefreshStatus.PULLING) {
197
- refreshStatus.value = RefreshStatus.LOOSING;
198
- }
199
- }
200
- };
201
- const touchEnd = (e) => {
202
- if (refreshStatus.value === RefreshStatus.LOOSING) {
203
- translateY.value = props.statusHeight;
204
- transitionTime.value = ANIMATION_TIME;
205
- refreshStatus.value = RefreshStatus.LOADING;
206
- emit("load", callback, e);
207
- } else if (refreshStatus.value === RefreshStatus.PULLING) {
208
- translateY.value = 0;
209
- refreshStatus.value = RefreshStatus.DEFUALT;
210
- }
211
- };
212
- onMounted(() => {
213
- const $el = instance == null ? void 0 : instance.vnode.el;
214
- $el == null ? void 0 : $el.addEventListener("touchstart", touchStart, {
215
- passive: false
216
- });
217
- $el == null ? void 0 : $el.addEventListener("touchmove", touchMove, {
218
- passive: false
219
- });
220
- $el == null ? void 0 : $el.addEventListener("touchend", touchEnd, {
221
- passive: false
222
- });
223
- $el == null ? void 0 : $el.addEventListener("mousedown", touchStart, {
224
- passive: false
225
- });
226
- $el == null ? void 0 : $el.addEventListener("mousemove", touchMove, {
227
- passive: false
228
- });
229
- $el == null ? void 0 : $el.addEventListener("mouseup", touchEnd, {
230
- passive: false
231
- });
232
- $el == null ? void 0 : $el.addEventListener("mouseout", touchEnd, {
233
- passive: false
109
+ Y(() => {
110
+ const e = s == null ? void 0 : s.vnode.el;
111
+ e == null || e.addEventListener("touchstart", m, {
112
+ passive: !1
113
+ }), e == null || e.addEventListener("touchmove", E, {
114
+ passive: !1
115
+ }), e == null || e.addEventListener("touchend", f, {
116
+ passive: !1
117
+ }), e == null || e.addEventListener("mousedown", m, {
118
+ passive: !1
119
+ }), e == null || e.addEventListener("mousemove", E, {
120
+ passive: !1
121
+ }), e == null || e.addEventListener("mouseup", f, {
122
+ passive: !1
123
+ }), e == null || e.addEventListener("mouseout", f, {
124
+ passive: !1
234
125
  });
126
+ }), X(() => {
127
+ const e = s == null ? void 0 : s.vnode.el;
128
+ e == null || e.removeEventListener("touchstart", m), e == null || e.removeEventListener("touchmove", E), e == null || e.removeEventListener("touchend", f), e == null || e.removeEventListener("mousedown", m), e == null || e.removeEventListener("mousemove", E), e == null || e.removeEventListener("mouseup", f), e == null || e.removeEventListener("mouseout", f);
235
129
  });
236
- onUnmounted(() => {
237
- const $el = instance == null ? void 0 : instance.vnode.el;
238
- $el == null ? void 0 : $el.removeEventListener("touchstart", touchStart);
239
- $el == null ? void 0 : $el.removeEventListener("touchmove", touchMove);
240
- $el == null ? void 0 : $el.removeEventListener("touchend", touchEnd);
241
- $el == null ? void 0 : $el.removeEventListener("mousedown", touchStart);
242
- $el == null ? void 0 : $el.removeEventListener("mousemove", touchMove);
243
- $el == null ? void 0 : $el.removeEventListener("mouseup", touchEnd);
244
- $el == null ? void 0 : $el.removeEventListener("mouseout", touchEnd);
245
- });
246
- const _renderStatus = () => {
247
- var _a;
248
- if (refreshStatus.value === RefreshStatus.DEFUALT)
249
- return null;
250
- if (slots[refreshStatus.value])
251
- return (_a = slots[refreshStatus.value]) == null ? void 0 : _a.call(slots);
252
- return createVNode("p", null, [props[`${refreshStatus.value}Text`]]);
130
+ const _ = () => {
131
+ var e;
132
+ return o.value === u.DEFUALT ? null : n[o.value] ? (e = n[o.value]) == null ? void 0 : e.call(n) : x("p", null, [t[`${o.value}Text`]]);
253
133
  };
254
- expose({
255
- refresh
256
- });
257
- return () => {
258
- var _a;
134
+ return a({
135
+ refresh: D
136
+ }), () => {
137
+ var O;
259
138
  const {
260
- statusHeight
261
- } = props;
262
- const height = translateY.value > statusHeight ? statusHeight : translateY.value;
263
- const transition = `all ${transitionTime.value}s ease 0s`;
264
- const translate = `translate3d(0, ${-translateY.value}px, 0)`;
265
- return createVNode("div", {
266
- "class": bem(),
267
- "style": {
268
- WebkitTransform: `translate3d(0, ${translateY.value}px, 0)`,
269
- transform: `translate3d(0, ${translateY.value}px, 0)`,
270
- transition
139
+ statusHeight: e
140
+ } = t, i = c.value > e ? e : c.value, v = `all ${L.value}s ease 0s`, d = `translate3d(0, ${-c.value}px, 0)`;
141
+ return x("div", {
142
+ class: S(),
143
+ style: {
144
+ WebkitTransform: `translate3d(0, ${c.value}px, 0)`,
145
+ transform: `translate3d(0, ${c.value}px, 0)`,
146
+ transition: v
271
147
  }
272
- }, [createVNode("div", {
273
- "class": bem("status"),
274
- "style": {
275
- height: `${height}px`,
276
- WebkitTransform: `${translate} scale(${height / statusHeight})`,
277
- transform: `${translate} scale(${height / statusHeight})`,
278
- transition
148
+ }, [x("div", {
149
+ class: S("status"),
150
+ style: {
151
+ height: `${i}px`,
152
+ WebkitTransform: `${d} scale(${i / e})`,
153
+ transform: `${d} scale(${i / e})`,
154
+ transition: v
279
155
  }
280
- }, [_renderStatus()]), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
156
+ }, [_()]), (O = n.default) == null ? void 0 : O.call(n)]);
281
157
  };
282
158
  }
283
159
  });
284
- const reset = "";
285
- const libs = "";
286
- const font = "";
287
- const animation = "";
288
- const theme = "";
289
- const style = "";
290
- Pullrefresh.install = (Vue) => {
291
- const { name: name2 } = Pullrefresh;
292
- Vue.component(name2, Pullrefresh);
160
+ A.install = (t) => {
161
+ const { name: n } = A;
162
+ t.component(n, A);
293
163
  };
294
164
  export {
295
- Pullrefresh,
296
- Pullrefresh as default
165
+ A as Pullrefresh,
166
+ A as default
297
167
  };