y-design-ssr 0.2.2 → 0.2.4

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 (119) hide show
  1. package/libs/button/index.css +1 -579
  2. package/libs/button/index.mjs +66 -111
  3. package/libs/button/index.umd.js +2 -203
  4. package/libs/button/package.json +5 -0
  5. package/libs/cell/index.css +1 -1077
  6. package/libs/cell/index.mjs +104 -167
  7. package/libs/cell/index.umd.js +2 -300
  8. package/libs/cell/package.json +5 -0
  9. package/libs/checkbox/index.css +1 -1053
  10. package/libs/checkbox/index.mjs +127 -242
  11. package/libs/checkbox/index.umd.js +2 -369
  12. package/libs/checkbox/package.json +5 -0
  13. package/libs/checkboxGroup/index.css +1 -422
  14. package/libs/checkboxGroup/index.mjs +87 -173
  15. package/libs/checkboxGroup/index.umd.js +2 -265
  16. package/libs/checkboxGroup/package.json +5 -0
  17. package/libs/col/index.css +1 -615
  18. package/libs/col/index.mjs +81 -246
  19. package/libs/col/index.umd.js +2 -305
  20. package/libs/col/package.json +5 -0
  21. package/libs/countdown/index.css +1 -417
  22. package/libs/countdown/index.mjs +71 -179
  23. package/libs/countdown/index.umd.js +2 -231
  24. package/libs/countdown/package.json +5 -0
  25. package/libs/dialog/index.css +1 -1405
  26. package/libs/dialog/index.mjs +476 -646
  27. package/libs/dialog/index.umd.js +2 -1128
  28. package/libs/dialog/package.json +5 -0
  29. package/libs/empty/index.css +1 -457
  30. package/libs/empty/index.mjs +44 -91
  31. package/libs/empty/index.umd.js +2 -139
  32. package/libs/empty/package.json +5 -0
  33. package/libs/form/index.css +1 -477
  34. package/libs/form/index.mjs +126 -226
  35. package/libs/form/index.umd.js +2 -319
  36. package/libs/form/package.json +5 -0
  37. package/libs/formItem/index.css +1 -477
  38. package/libs/formItem/index.mjs +126 -276
  39. package/libs/formItem/index.umd.js +2 -372
  40. package/libs/formItem/package.json +5 -0
  41. package/libs/icon/index.css +1 -982
  42. package/libs/icon/index.mjs +58 -107
  43. package/libs/icon/index.umd.js +2 -186
  44. package/libs/icon/package.json +5 -0
  45. package/libs/index.css +1 -2902
  46. package/libs/index.mjs +2348 -3789
  47. package/libs/index.umd.js +2 -5509
  48. package/libs/input/index.css +1 -483
  49. package/libs/input/index.mjs +92 -183
  50. package/libs/input/index.umd.js +2 -274
  51. package/libs/input/package.json +5 -0
  52. package/libs/layout/index.css +1 -684
  53. package/libs/layout/index.mjs +130 -230
  54. package/libs/layout/index.umd.js +2 -318
  55. package/libs/layout/package.json +5 -0
  56. package/libs/list/index.css +1 -440
  57. package/libs/list/index.mjs +207 -388
  58. package/libs/list/index.umd.js +2 -571
  59. package/libs/list/package.json +5 -0
  60. package/libs/loading/index.css +1 -548
  61. package/libs/loading/index.mjs +118 -196
  62. package/libs/loading/index.umd.js +2 -321
  63. package/libs/loading/package.json +5 -0
  64. package/libs/mask/index.css +1 -426
  65. package/libs/mask/index.mjs +70 -131
  66. package/libs/mask/index.umd.js +2 -201
  67. package/libs/mask/package.json +5 -0
  68. package/libs/popup/index.css +1 -465
  69. package/libs/popup/index.mjs +134 -210
  70. package/libs/popup/index.umd.js +2 -358
  71. package/libs/popup/package.json +5 -0
  72. package/libs/progress/index.css +1 -488
  73. package/libs/progress/index.mjs +128 -200
  74. package/libs/progress/index.umd.js +2 -322
  75. package/libs/progress/package.json +5 -0
  76. package/libs/pullrefresh/index.css +1 -441
  77. package/libs/pullrefresh/index.mjs +111 -241
  78. package/libs/pullrefresh/index.umd.js +2 -302
  79. package/libs/pullrefresh/package.json +5 -0
  80. package/libs/row/index.css +1 -485
  81. package/libs/row/index.mjs +89 -181
  82. package/libs/row/index.umd.js +2 -237
  83. package/libs/row/package.json +5 -0
  84. package/libs/slider/index.css +1 -558
  85. package/libs/slider/index.mjs +160 -356
  86. package/libs/slider/index.umd.js +2 -453
  87. package/libs/slider/package.json +5 -0
  88. package/libs/stepper/index.css +1 -489
  89. package/libs/stepper/index.mjs +101 -181
  90. package/libs/stepper/index.umd.js +2 -269
  91. package/libs/stepper/package.json +5 -0
  92. package/libs/swipe/index.css +1 -506
  93. package/libs/swipe/index.mjs +259 -542
  94. package/libs/swipe/index.umd.js +2 -703
  95. package/libs/swipe/package.json +5 -0
  96. package/libs/swipeItem/index.css +1 -424
  97. package/libs/swipeItem/index.mjs +52 -111
  98. package/libs/swipeItem/index.umd.js +2 -154
  99. package/libs/swipeItem/package.json +5 -0
  100. package/libs/switch/index.css +1 -472
  101. package/libs/switch/index.mjs +62 -121
  102. package/libs/switch/index.umd.js +2 -200
  103. package/libs/switch/package.json +5 -0
  104. package/libs/tab/index.mjs +68 -131
  105. package/libs/tab/index.umd.js +1 -190
  106. package/libs/tab/package.json +5 -0
  107. package/libs/tabs/index.css +1 -514
  108. package/libs/tabs/index.mjs +410 -751
  109. package/libs/tabs/index.umd.js +2 -1020
  110. package/libs/tabs/package.json +5 -0
  111. package/libs/toast/index.css +1 -1050
  112. package/libs/toast/index.mjs +114 -183
  113. package/libs/toast/index.umd.js +2 -306
  114. package/libs/toast/package.json +5 -0
  115. package/libs/tooltip/index.css +1 -514
  116. package/libs/tooltip/index.mjs +155 -293
  117. package/libs/tooltip/index.umd.js +2 -416
  118. package/libs/tooltip/package.json +5 -0
  119. package/package.json +5 -12
@@ -1,40 +1,11 @@
1
- import { ref, reactive, defineComponent, onMounted, onUnmounted, watch, createVNode, Transition, withDirectives, vShow, computed, Teleport } 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 h, reactive as _, defineComponent as C, onMounted as B, onUnmounted as A, watch as L, createVNode as i, Transition as N, withDirectives as M, vShow as V, computed as g, Teleport as z } from "vue";
2
+ const k = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((l, a) => l + k(e, a), "") : Object.keys(t).reduce(
3
+ (l, a) => l + (t[a] ? k(e, a) : ""),
4
+ ""
5
+ ) : "", I = (e) => (t, l) => {
6
+ let a = t, c = l;
7
+ return a && typeof a != "string" && (c = a, a = ""), a = a ? `${e}__${a}` : e, `${a}${k(a, c)}`;
8
+ }, O = () => (e, t) => t ? `${k(`y-${e}`, t)}` : `y-${e}`, w = {
38
9
  "pull-refresh": {
39
10
  pulling: "下拉刷新...",
40
11
  loosing: "释放刷新...",
@@ -46,26 +17,18 @@ const defaultLang = {
46
17
  validateMessage: "请输入正确内容"
47
18
  }
48
19
  };
49
- ref("zh-CN");
50
- reactive({
51
- "zh-CN": defaultLang
20
+ h("zh-CN");
21
+ _({
22
+ "zh-CN": w
52
23
  });
53
- const createNamespace = (name2) => {
54
- const prefixedName = `y-${name2}`;
55
- return [prefixedName, createBEM(prefixedName), createGlobalBem()];
56
- };
57
- const parseUnit = (val) => {
58
- if (isNaN(Number(val)) && typeof val === "string") {
59
- return val;
60
- }
61
- return `${val}px`;
62
- };
63
- const [name$1, bem$1, gBem$1] = createNamespace("mask");
64
- const _props$1 = {
24
+ const x = (e) => {
25
+ const t = `y-${e}`;
26
+ return [t, I(t), O()];
27
+ }, D = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, [R, T, j] = x("mask"), U = {
65
28
  // 控制显示
66
29
  modelValue: {
67
30
  type: Boolean,
68
- default: false
31
+ default: !1
69
32
  },
70
33
  // 层级
71
34
  zIndex: {
@@ -90,118 +53,87 @@ const _props$1 = {
90
53
  // 触摸滚动开关
91
54
  lockScroll: {
92
55
  type: Boolean,
93
- default: true
56
+ default: !0
94
57
  },
95
58
  onAfterLeave: {
96
59
  type: Function,
97
60
  default: null
98
61
  }
99
- };
100
- const stack = reactive([]);
101
- let num = 0;
102
- const Mask = /* @__PURE__ */ defineComponent({
103
- name: name$1,
104
- props: _props$1,
62
+ }, r = _([]);
63
+ let v = 0;
64
+ const $ = /* @__PURE__ */ C({
65
+ name: R,
66
+ props: U,
105
67
  emits: ["update:modelValue"],
106
- setup(props, {
107
- slots
68
+ setup(e, {
69
+ slots: t
108
70
  }) {
109
- const id = ref("");
110
- onMounted(() => {
111
- id.value = `mask${num}`;
112
- num += 1;
113
- stackIntercept(props.modelValue, true);
71
+ const l = h("");
72
+ B(() => {
73
+ l.value = `mask${v}`, v += 1, a(e.modelValue, !0);
74
+ }), A(() => {
75
+ const n = r.findIndex((o) => o._id === l.value);
76
+ n >= 0 && r.splice(n, 1);
77
+ }), L(() => e.modelValue, (n) => {
78
+ a(n);
114
79
  });
115
- onUnmounted(() => {
116
- const index = stack.findIndex((v) => v._id === id.value);
117
- index >= 0 && stack.splice(index, 1);
118
- });
119
- watch(() => props.modelValue, (val) => {
120
- stackIntercept(val);
121
- });
122
- const stackIntercept = (val, isMounted) => {
123
- if (val) {
124
- stack.unshift({
125
- _id: id.value,
126
- _state: val
127
- });
128
- if (stack.length > 1) {
129
- stack[1]._state = false;
130
- }
131
- } else if (!isMounted) {
132
- stack.splice(0, 1);
133
- if (stack.length > 0) {
134
- stack[0]._state = true;
135
- }
136
- }
137
- };
138
- const find = () => {
139
- let _state = false;
140
- for (let i = 0; i < stack.length; i++) {
141
- if (stack[i]._id === id.value) {
142
- _state = stack[i]._state;
143
- }
144
- }
80
+ const a = (n, o) => {
81
+ n ? (r.unshift({
82
+ _id: l.value,
83
+ _state: n
84
+ }), r.length > 1 && (r[1]._state = !1)) : o || (r.splice(0, 1), r.length > 0 && (r[0]._state = !0));
85
+ }, c = () => {
86
+ let n = !1;
87
+ for (let o = 0; o < r.length; o++)
88
+ r[o]._id === l.value && (n = r[o]._state);
145
89
  return {
146
- _state
90
+ _state: n
147
91
  };
148
- };
149
- const onTouchMove = (payload) => {
92
+ }, d = (n) => {
150
93
  const {
151
- lockScroll
152
- } = props;
153
- if (lockScroll) {
154
- payload.preventDefault();
155
- payload.stopPropagation();
156
- }
94
+ lockScroll: o
95
+ } = e;
96
+ o && (n.preventDefault(), n.stopPropagation());
157
97
  };
158
98
  return () => {
159
99
  const {
160
- customClass,
161
- duration,
162
- zIndex,
163
- customStyle,
164
- onAfterLeave
165
- } = props;
166
- const {
167
- _state
168
- } = find();
169
- return createVNode(Transition, {
170
- "name": gBem$1("animation", "fade"),
171
- "onAfterLeave": onAfterLeave
100
+ customClass: n,
101
+ duration: o,
102
+ zIndex: f,
103
+ customStyle: m,
104
+ onAfterLeave: u
105
+ } = e, {
106
+ _state: s
107
+ } = c();
108
+ return i(N, {
109
+ name: j("animation", "fade"),
110
+ onAfterLeave: u
172
111
  }, {
173
112
  default: () => {
174
- var _a;
175
- return [withDirectives(createVNode("div", {
176
- "style": {
177
- animationDuration: `${duration}ms`,
178
- zIndex,
179
- ...customStyle
113
+ var p;
114
+ return [M(i("div", {
115
+ style: {
116
+ animationDuration: `${o}ms`,
117
+ zIndex: f,
118
+ ...m
180
119
  },
181
- "class": [bem$1(), customClass],
182
- "onTouchmove": onTouchMove
183
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vShow, _state]])];
120
+ class: [T(), n],
121
+ onTouchmove: d
122
+ }, [(p = t.default) == null ? void 0 : p.call(t)]), [[V, s]])];
184
123
  }
185
124
  });
186
125
  };
187
126
  }
188
127
  });
189
- const reset = "";
190
- const libs = "";
191
- const font = "";
192
- const animation = "";
193
- const theme = "";
194
- const style$1 = "";
195
- Mask.install = (app) => {
196
- const { name: name2 } = Mask;
197
- app.component(name2, Mask);
128
+ $.install = (e) => {
129
+ const { name: t } = $;
130
+ e.component(t, $);
198
131
  };
199
- const [name, bem, gBem] = createNamespace("popup");
200
- const _props = {
132
+ const [F, S, P] = x("popup"), E = {
201
133
  // 控制显示
202
134
  modelValue: {
203
135
  type: Boolean,
204
- default: false
136
+ default: !1
205
137
  },
206
138
  // 位置
207
139
  position: {
@@ -236,7 +168,7 @@ const _props = {
236
168
  // 点击遮罩是否关闭
237
169
  isCloseOnClickMask: {
238
170
  type: Boolean,
239
- default: true
171
+ default: !0
240
172
  },
241
173
  onAfterLeave: {
242
174
  type: Function,
@@ -244,109 +176,101 @@ const _props = {
244
176
  },
245
177
  lockScroll: {
246
178
  type: Boolean,
247
- default: true
179
+ default: !0
248
180
  },
249
181
  zIndex: {
250
182
  type: Number,
251
183
  default: 101
252
184
  }
253
- };
254
- const Popup = /* @__PURE__ */ defineComponent({
255
- name,
256
- props: _props,
185
+ }, b = /* @__PURE__ */ C({
186
+ name: F,
187
+ props: E,
257
188
  emits: ["clickMask", "update:modelValue"],
258
- setup(props, {
259
- slots,
260
- emit
189
+ setup(e, {
190
+ slots: t,
191
+ emit: l
261
192
  }) {
262
- const style2 = computed(() => {
193
+ const a = g(() => {
263
194
  const {
264
- position,
265
- borderRadius,
266
- customStyle,
267
- duration
268
- } = props;
269
- const tbR = parseUnit(borderRadius);
270
- let br = `0`;
271
- switch (position) {
195
+ position: n,
196
+ borderRadius: o,
197
+ customStyle: f,
198
+ duration: m
199
+ } = e, u = D(o);
200
+ let s = "0";
201
+ switch (n) {
272
202
  case "top":
273
- br = ` 0 0 ${tbR} ${tbR}`;
203
+ s = ` 0 0 ${u} ${u}`;
274
204
  break;
275
205
  case "bottom":
276
- br = `${tbR} ${tbR} 0 0`;
206
+ s = `${u} ${u} 0 0`;
277
207
  break;
278
208
  case "left":
279
- br = `0 ${tbR} ${tbR} 0`;
209
+ s = `0 ${u} ${u} 0`;
280
210
  break;
281
211
  case "right":
282
- br = `${tbR} 0 0 ${tbR}`;
212
+ s = `${u} 0 0 ${u}`;
283
213
  break;
284
214
  default:
285
- br = `${tbR}`;
215
+ s = `${u}`;
286
216
  }
287
217
  return {
288
- borderRadius: br,
289
- animationDuration: `${duration}ms`,
290
- ...customStyle
218
+ borderRadius: s,
219
+ animationDuration: `${m}ms`,
220
+ ...f
291
221
  };
292
- });
293
- const onClickMask = (event) => {
294
- emit("clickMask", event);
295
- if (props.isCloseOnClickMask) {
296
- visible.value = false;
297
- }
298
- };
299
- const visible = computed({
300
- get: () => props.modelValue,
301
- set: (value) => emit("update:modelValue", value)
222
+ }), c = (n) => {
223
+ l("clickMask", n), e.isCloseOnClickMask && (d.value = !1);
224
+ }, d = g({
225
+ get: () => e.modelValue,
226
+ set: (n) => l("update:modelValue", n)
302
227
  });
303
228
  return () => {
304
229
  const {
305
- teleport,
306
- position,
307
- customClass,
308
- duration,
309
- onAfterLeave,
310
- lockScroll,
311
- zIndex
312
- } = props;
313
- return createVNode(Teleport, {
314
- "to": teleport
230
+ teleport: n,
231
+ position: o,
232
+ customClass: f,
233
+ duration: m,
234
+ onAfterLeave: u,
235
+ lockScroll: s,
236
+ zIndex: p
237
+ } = e;
238
+ return i(z, {
239
+ to: n
315
240
  }, {
316
- default: () => [createVNode("div", {
317
- "class": bem(),
318
- "style": {
319
- zIndex
241
+ default: () => [i("div", {
242
+ class: S(),
243
+ style: {
244
+ zIndex: p
320
245
  }
321
- }, [createVNode(Mask, {
322
- "modelValue": visible.value,
323
- "onUpdate:modelValue": ($event) => visible.value = $event,
324
- "duration": duration,
325
- "lockScroll": lockScroll,
326
- "onClick": onClickMask,
327
- "onAfterLeave": onAfterLeave
328
- }, null), createVNode(Transition, {
329
- "name": gBem("animation", `slide-${position}`)
246
+ }, [i($, {
247
+ modelValue: d.value,
248
+ "onUpdate:modelValue": (y) => d.value = y,
249
+ duration: m,
250
+ lockScroll: s,
251
+ onClick: c,
252
+ onAfterLeave: u
253
+ }, null), i(N, {
254
+ name: P("animation", `slide-${o}`)
330
255
  }, {
331
256
  default: () => {
332
- var _a;
333
- return [withDirectives(createVNode("div", {
334
- "style": style2.value,
335
- "class": [bem("content", {
336
- [position]: position
337
- }), customClass]
338
- }, [((_a = slots.default) == null ? void 0 : _a.call(slots)) || null]), [[vShow, visible.value]])];
257
+ var y;
258
+ return [M(i("div", {
259
+ style: a.value,
260
+ class: [S("content", {
261
+ [o]: o
262
+ }), f]
263
+ }, [((y = t.default) == null ? void 0 : y.call(t)) || null]), [[V, d.value]])];
339
264
  }
340
265
  })])]
341
266
  });
342
267
  };
343
268
  }
344
269
  });
345
- const style = "";
346
- Popup.install = (app) => {
347
- const { name: name2 } = Popup;
348
- app.component(name2, Popup);
270
+ b.install = (e) => {
271
+ const { name: t } = b;
272
+ e.component(t, b);
349
273
  };
350
274
  export {
351
- Popup as default
275
+ b as default
352
276
  };