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, 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,74 +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
- createLoading,
310
- Loading as default,
311
- directive,
312
- directiveProps,
313
- directiveSlots,
314
- 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
315
237
  };