y-design-ssr 0.2.6 → 0.2.8

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 (129) hide show
  1. package/README.md +1 -1
  2. package/libs/button/index.css +1 -579
  3. package/libs/button/index.d.ts +0 -1
  4. package/libs/button/index.mjs +65 -111
  5. package/libs/button/index.umd.js +2 -203
  6. package/libs/cell/index.css +1 -1077
  7. package/libs/cell/index.d.ts +0 -1
  8. package/libs/cell/index.mjs +104 -168
  9. package/libs/cell/index.umd.js +2 -301
  10. package/libs/checkbox/index.css +1 -1053
  11. package/libs/checkbox/index.d.ts +0 -1
  12. package/libs/checkbox/index.mjs +127 -243
  13. package/libs/checkbox/index.umd.js +2 -370
  14. package/libs/checkboxGroup/index.css +1 -422
  15. package/libs/checkboxGroup/index.d.ts +0 -1
  16. package/libs/checkboxGroup/index.mjs +87 -174
  17. package/libs/checkboxGroup/index.umd.js +2 -266
  18. package/libs/col/index.css +1 -615
  19. package/libs/col/index.d.ts +0 -1
  20. package/libs/col/index.mjs +81 -247
  21. package/libs/col/index.umd.js +2 -306
  22. package/libs/countdown/index.css +1 -417
  23. package/libs/countdown/index.d.ts +0 -1
  24. package/libs/countdown/index.mjs +71 -180
  25. package/libs/countdown/index.umd.js +2 -232
  26. package/libs/dialog/index.css +1 -1405
  27. package/libs/dialog/index.d.ts +0 -1
  28. package/libs/dialog/index.mjs +476 -647
  29. package/libs/dialog/index.umd.js +2 -1129
  30. package/libs/empty/index.css +1 -457
  31. package/libs/empty/index.d.ts +0 -1
  32. package/libs/empty/index.mjs +44 -92
  33. package/libs/empty/index.umd.js +2 -140
  34. package/libs/form/index.css +1 -477
  35. package/libs/form/index.d.ts +0 -1
  36. package/libs/form/index.mjs +126 -227
  37. package/libs/form/index.umd.js +2 -320
  38. package/libs/formItem/index.css +1 -477
  39. package/libs/formItem/index.d.ts +0 -1
  40. package/libs/formItem/index.mjs +126 -277
  41. package/libs/formItem/index.umd.js +2 -373
  42. package/libs/icon/index.css +1 -982
  43. package/libs/icon/index.d.ts +0 -1
  44. package/libs/icon/index.mjs +58 -108
  45. package/libs/icon/index.umd.js +2 -187
  46. package/libs/index.css +1 -2902
  47. package/libs/index.mjs +2348 -3789
  48. package/libs/index.umd.js +2 -5509
  49. package/libs/input/index.css +1 -483
  50. package/libs/input/index.d.ts +0 -1
  51. package/libs/input/index.mjs +92 -184
  52. package/libs/input/index.umd.js +2 -275
  53. package/libs/layout/index.css +1 -684
  54. package/libs/layout/index.mjs +130 -230
  55. package/libs/layout/index.umd.js +2 -318
  56. package/libs/list/index.css +1 -440
  57. package/libs/list/index.d.ts +0 -1
  58. package/libs/list/index.mjs +207 -389
  59. package/libs/list/index.umd.js +2 -572
  60. package/libs/loading/index.css +1 -548
  61. package/libs/loading/index.d.ts +0 -1
  62. package/libs/loading/index.mjs +118 -197
  63. package/libs/loading/index.umd.js +2 -322
  64. package/libs/locale/index.mjs +28 -0
  65. package/libs/locale/index.umd.js +1 -0
  66. package/libs/locale/package.json +6 -0
  67. package/libs/mask/index.css +1 -426
  68. package/libs/mask/index.d.ts +0 -1
  69. package/libs/mask/index.mjs +70 -132
  70. package/libs/mask/index.umd.js +2 -202
  71. package/libs/popup/index.css +1 -465
  72. package/libs/popup/index.d.ts +0 -1
  73. package/libs/popup/index.mjs +134 -211
  74. package/libs/popup/index.umd.js +2 -359
  75. package/libs/progress/index.css +1 -488
  76. package/libs/progress/index.d.ts +0 -1
  77. package/libs/progress/index.mjs +128 -201
  78. package/libs/progress/index.umd.js +2 -323
  79. package/libs/pullrefresh/index.css +1 -441
  80. package/libs/pullrefresh/index.d.ts +0 -1
  81. package/libs/pullrefresh/index.mjs +111 -242
  82. package/libs/pullrefresh/index.umd.js +2 -303
  83. package/libs/row/index.css +1 -485
  84. package/libs/row/index.d.ts +0 -1
  85. package/libs/row/index.mjs +89 -182
  86. package/libs/row/index.umd.js +2 -238
  87. package/libs/slider/index.css +1 -558
  88. package/libs/slider/index.d.ts +0 -1
  89. package/libs/slider/index.mjs +160 -357
  90. package/libs/slider/index.umd.js +2 -454
  91. package/libs/stepper/index.css +1 -489
  92. package/libs/stepper/index.d.ts +0 -1
  93. package/libs/stepper/index.mjs +101 -182
  94. package/libs/stepper/index.umd.js +2 -270
  95. package/libs/style/index.css +1 -0
  96. package/libs/style/index.mjs +1 -0
  97. package/libs/style/index.umd.js +2 -0
  98. package/libs/style/package.json +6 -0
  99. package/libs/swipe/index.css +1 -506
  100. package/libs/swipe/index.d.ts +0 -1
  101. package/libs/swipe/index.mjs +259 -543
  102. package/libs/swipe/index.umd.js +2 -704
  103. package/libs/swipeItem/index.css +1 -424
  104. package/libs/swipeItem/index.d.ts +0 -1
  105. package/libs/swipeItem/index.mjs +52 -112
  106. package/libs/swipeItem/index.umd.js +2 -155
  107. package/libs/switch/index.css +1 -472
  108. package/libs/switch/index.d.ts +0 -1
  109. package/libs/switch/index.mjs +62 -122
  110. package/libs/switch/index.umd.js +2 -201
  111. package/libs/tab/index.d.ts +0 -1
  112. package/libs/tab/index.mjs +68 -132
  113. package/libs/tab/index.umd.js +1 -191
  114. package/libs/tabs/index.css +1 -514
  115. package/libs/tabs/index.d.ts +0 -1
  116. package/libs/tabs/index.mjs +410 -752
  117. package/libs/tabs/index.umd.js +2 -1021
  118. package/libs/toast/index.css +1 -1050
  119. package/libs/toast/index.d.ts +0 -1
  120. package/libs/toast/index.mjs +114 -184
  121. package/libs/toast/index.umd.js +2 -307
  122. package/libs/tooltip/index.css +1 -514
  123. package/libs/tooltip/index.d.ts +0 -1
  124. package/libs/tooltip/index.mjs +155 -294
  125. package/libs/tooltip/index.umd.js +2 -417
  126. package/libs/utils/index.mjs +76 -0
  127. package/libs/utils/index.umd.js +1 -0
  128. package/libs/utils/package.json +6 -0
  129. package/package.json +2 -5
@@ -1,40 +1,11 @@
1
- import { ref, reactive, defineComponent, createVNode, createApp, h } 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 C, reactive as _, defineComponent as L, createVNode as i, createApp as z, h as P } from "vue";
2
+ const u = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((n, r) => n + u(e, r), "") : Object.keys(t).reduce(
3
+ (n, r) => n + (t[r] ? u(e, r) : ""),
4
+ ""
5
+ ) : "", R = (e) => (t, n) => {
6
+ let r = t, o = n;
7
+ return r && typeof r != "string" && (o = r, r = ""), r = r ? `${e}__${r}` : e, `${r}${u(r, o)}`;
8
+ }, k = () => (e, t) => t ? `${u(`y-${e}`, t)}` : `y-${e}`, B = {
38
9
  "pull-refresh": {
39
10
  pulling: "下拉刷新...",
40
11
  loosing: "释放刷新...",
@@ -46,22 +17,15 @@ const defaultLang = {
46
17
  validateMessage: "请输入正确内容"
47
18
  }
48
19
  };
49
- ref("zh-CN");
50
- reactive({
51
- "zh-CN": defaultLang
20
+ C("zh-CN");
21
+ _({
22
+ "zh-CN": B
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 parseFlexDirection = (location) => {
64
- switch (location) {
24
+ const M = (e) => {
25
+ const t = `y-${e}`;
26
+ return [t, R(t), k()];
27
+ }, s = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, A = (e) => {
28
+ switch (e) {
65
29
  case "top":
66
30
  return "column-reverse";
67
31
  case "bottom":
@@ -73,9 +37,7 @@ const parseFlexDirection = (location) => {
73
37
  default:
74
38
  return "column";
75
39
  }
76
- };
77
- const [name, bem] = createNamespace("loading");
78
- const _props = {
40
+ }, [D, c] = M("loading"), E = {
79
41
  // Loading icon 的颜色
80
42
  color: {
81
43
  type: String,
@@ -134,107 +96,97 @@ const _props = {
134
96
  type: String,
135
97
  default: "relative"
136
98
  }
137
- };
138
- const Loading = /* @__PURE__ */ defineComponent({
139
- name,
140
- props: _props,
141
- setup(props, {
142
- slots
99
+ }, l = /* @__PURE__ */ L({
100
+ name: D,
101
+ props: E,
102
+ setup(e, {
103
+ slots: t
143
104
  }) {
144
105
  return () => {
145
- var _a, _b;
106
+ var f, m;
146
107
  const {
147
- position,
148
- textLocation,
149
- bgColor,
150
- bgBorderRadius,
151
- size,
152
- padding,
153
- color,
154
- thick,
155
- direction,
156
- text,
157
- textColor,
158
- textSize
159
- } = props;
160
- const showText = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || text;
161
- return createVNode("div", {
162
- "class": bem({
163
- [position]: position !== "relative"
108
+ position: n,
109
+ textLocation: r,
110
+ bgColor: o,
111
+ bgBorderRadius: S,
112
+ size: d,
113
+ padding: x,
114
+ color: b,
115
+ thick: h,
116
+ direction: p,
117
+ text: $,
118
+ textColor: w,
119
+ textSize: N
120
+ } = e, g = ((f = t.default) == null ? void 0 : f.call(t)) || $;
121
+ return i("div", {
122
+ class: c({
123
+ [n]: n !== "relative"
164
124
  })
165
- }, [createVNode("div", {
166
- "class": bem("bg", {
167
- [position]: position !== "relative"
125
+ }, [i("div", {
126
+ class: c("bg", {
127
+ [n]: n !== "relative"
168
128
  }),
169
- "style": {
170
- flexDirection: parseFlexDirection(textLocation),
171
- backgroundColor: bgColor,
172
- borderRadius: parseUnit(bgBorderRadius),
173
- padding: parseUnit(padding)
129
+ style: {
130
+ flexDirection: A(r),
131
+ backgroundColor: o,
132
+ borderRadius: s(S),
133
+ padding: s(x)
174
134
  }
175
- }, [createVNode("span", {
176
- "class": bem("icon-wrapper"),
177
- "style": {
178
- width: parseUnit(size),
179
- height: parseUnit(size)
135
+ }, [i("span", {
136
+ class: c("icon-wrapper"),
137
+ style: {
138
+ width: s(d),
139
+ height: s(d)
180
140
  }
181
- }, [((_b = slots.icon) == null ? void 0 : _b.call(slots)) || createVNode("svg", {
182
- "class": bem("icon", {
183
- [direction]: direction
141
+ }, [((m = t.icon) == null ? void 0 : m.call(t)) || i("svg", {
142
+ class: c("icon", {
143
+ [p]: p
184
144
  }),
185
- "viewBox": "25 25 50 50"
186
- }, [createVNode("circle", {
187
- "class": bem("icon-circle"),
188
- "style": {
189
- stroke: color,
190
- strokeWidth: parseUnit(thick)
145
+ viewBox: "25 25 50 50"
146
+ }, [i("circle", {
147
+ class: c("icon-circle"),
148
+ style: {
149
+ stroke: b,
150
+ strokeWidth: s(h)
191
151
  },
192
- "cx": "50",
193
- "cy": "50",
194
- "r": "20",
195
- "fill": "none"
196
- }, null)])]), showText && createVNode("span", {
197
- "class": bem("text", {
198
- [textLocation]: textLocation
152
+ cx: "50",
153
+ cy: "50",
154
+ r: "20",
155
+ fill: "none"
156
+ }, null)])]), g && i("span", {
157
+ class: c("text", {
158
+ [r]: r
199
159
  }),
200
- "style": {
201
- color: textColor,
202
- fontSize: parseUnit(textSize)
160
+ style: {
161
+ color: w,
162
+ fontSize: s(N)
203
163
  }
204
- }, [showText])])]);
164
+ }, [g])])]);
205
165
  };
206
166
  }
207
- });
208
- const globalOptions = {
167
+ }), O = {
209
168
  position: "fixed"
210
169
  };
211
- let instance = null;
212
- const initInstance = (customProps, customSlots) => {
213
- const wrapper = {
214
- render: () => {
215
- return h(Loading, { ...customProps }, { ...customSlots });
216
- }
217
- };
218
- const customApp = createApp(wrapper);
219
- const element = document.createElement("div");
220
- return customApp.mount(element);
221
- };
222
- const createLoading = {
170
+ let a = null;
171
+ const v = (e, t) => {
172
+ const r = z({
173
+ render: () => P(l, { ...e }, { ...t })
174
+ }), o = document.createElement("div");
175
+ return r.mount(o);
176
+ }, V = {
223
177
  /**
224
178
  * @description: show
225
179
  * @param {LoadingPropsType} options
226
180
  * @return {*}
227
181
  */
228
- show: (customProps, customSlots) => {
229
- if (!instance)
230
- instance = initInstance(
231
- {
232
- ...globalOptions,
233
- ...customProps
234
- },
235
- customSlots
236
- );
237
- document.body.appendChild(instance.$el);
182
+ show: (e, t) => {
183
+ a || (a = v(
184
+ {
185
+ ...O,
186
+ ...e
187
+ },
188
+ t
189
+ )), document.body.appendChild(a.$el);
238
190
  },
239
191
  /**
240
192
  * @description: hide
@@ -242,75 +194,44 @@ const createLoading = {
242
194
  * @return {*}
243
195
  */
244
196
  hide: () => {
245
- instance && instance.$el.remove();
246
- }
247
- };
248
- const toggleLoading = (el, binding) => {
249
- if (binding.value) {
250
- el.classList.add("y-loading__wrap");
251
- el.appendChild(el.instance.$el);
252
- } else {
253
- el.classList.remove("y-loading__wrap");
254
- el.removeChild(el.instance.$el);
197
+ a && a.$el.remove();
255
198
  }
256
- };
257
- const loadingDirective = {
258
- install: (app) => {
259
- app.directive("loading", directive);
260
- app.directive("loading-props", directiveProps);
261
- app.directive("loading-slots", directiveSlots);
199
+ }, y = (e, t) => {
200
+ t.value ? (e.classList.add("y-loading__wrap"), e.appendChild(e.instance.$el)) : (e.classList.remove("y-loading__wrap"), e.removeChild(e.instance.$el));
201
+ }, j = {
202
+ install: (e) => {
203
+ e.directive("loading", F), e.directive("loading-props", G), e.directive("loading-slots", I);
262
204
  }
263
- };
264
- const directive = {
265
- getSSRProps: (binding) => {
266
- return { ...binding };
205
+ }, F = {
206
+ getSSRProps: (e) => ({ ...e }),
207
+ mounted: (e, t) => {
208
+ e.instance = v({ ...e.customProps }, { ...e.customSlots }), t.value && y(e, t);
267
209
  },
268
- mounted: (el, binding) => {
269
- el.instance = initInstance({ ...el.customProps }, { ...el.customSlots });
270
- binding.value && toggleLoading(el, binding);
210
+ updated: (e, t) => {
211
+ t.oldValue !== t.value && y(e, t);
271
212
  },
272
- updated: (el, binding) => {
273
- if (binding.oldValue !== binding.value) {
274
- toggleLoading(el, binding);
275
- }
276
- },
277
- unmounted: (el) => {
278
- el.instance && el.instance.$el.remove();
213
+ unmounted: (e) => {
214
+ e.instance && e.instance.$el.remove();
279
215
  }
280
- };
281
- const directiveProps = {
282
- getSSRProps: (binding) => {
283
- return { ...binding };
284
- },
285
- beforeMount: (el, binding) => {
286
- el.customProps = { ...binding.value };
216
+ }, G = {
217
+ getSSRProps: (e) => ({ ...e }),
218
+ beforeMount: (e, t) => {
219
+ e.customProps = { ...t.value };
287
220
  }
288
- };
289
- const directiveSlots = {
290
- getSSRProps: (binding) => {
291
- return { ...binding };
292
- },
293
- beforeMount: (el, binding) => {
294
- el.customSlots = { ...binding.value };
221
+ }, I = {
222
+ getSSRProps: (e) => ({ ...e }),
223
+ beforeMount: (e, t) => {
224
+ e.customSlots = { ...t.value };
295
225
  }
296
226
  };
297
- const reset = "";
298
- const libs = "";
299
- const font = "";
300
- const animation = "";
301
- const theme = "";
302
- const style = "";
303
- Loading.install = (app) => {
304
- app.component(Loading.name, Loading);
305
- app.provide("loading", createLoading);
306
- app.use(loadingDirective);
227
+ l.install = (e) => {
228
+ e.component(l.name, l), e.provide("loading", V), e.use(j);
307
229
  };
308
230
  export {
309
- Loading,
310
- createLoading,
311
- Loading as default,
312
- directive,
313
- directiveProps,
314
- directiveSlots,
315
- loadingDirective
231
+ V as createLoading,
232
+ l as default,
233
+ F as directive,
234
+ G as directiveProps,
235
+ I as directiveSlots,
236
+ j as loadingDirective
316
237
  };