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, getCurrentInstance, provide, isVNode, inject, onUnmounted, computed, defineComponent, 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 h, reactive as m, getCurrentInstance as v, provide as _, isVNode as j, inject as A, onUnmounted as L, computed as l, defineComponent as y, createVNode as $ } from "vue";
2
+ const p = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((n, r) => n + p(e, r), "") : Object.keys(t).reduce(
3
+ (n, r) => n + (t[r] ? p(e, r) : ""),
4
+ ""
5
+ ) : "", P = (e) => (t, n) => {
6
+ let r = t, i = n;
7
+ return r && typeof r != "string" && (i = r, r = ""), r = r ? `${e}__${r}` : e, `${r}${p(r, i)}`;
8
+ }, T = () => (e, t) => t ? `${p(`y-${e}`, t)}` : `y-${e}`, B = {
38
9
  "pull-refresh": {
39
10
  pulling: "下拉刷新...",
40
11
  loosing: "释放刷新...",
@@ -46,190 +17,63 @@ const defaultLang = {
46
17
  validateMessage: "请输入正确内容"
47
18
  }
48
19
  };
49
- ref("zh-CN");
50
- reactive({
51
- "zh-CN": defaultLang
20
+ h("zh-CN");
21
+ m({
22
+ "zh-CN": B
52
23
  });
53
- const createNamespace = (name2) => {
54
- const prefixedName = `y-${name2}`;
55
- return [prefixedName, createBEM(prefixedName), createGlobalBem()];
24
+ const C = (e) => {
25
+ const t = `y-${e}`;
26
+ return [t, P(t), T()];
56
27
  };
57
- var Vertical = /* @__PURE__ */ ((Vertical2) => {
58
- Vertical2["Top"] = "top";
59
- Vertical2["Middle"] = "middle";
60
- Vertical2["Bottom"] = "bottom";
61
- return Vertical2;
62
- })(Vertical || {});
63
- const filterChildren = (children) => {
64
- const vnodes = [];
65
- const _filterChildren = (childrens) => {
66
- if (Array.isArray(childrens)) {
67
- childrens.forEach((child) => {
68
- var _a;
69
- if (isVNode(child)) {
70
- vnodes.push(child);
71
- if ((_a = child.component) == null ? void 0 : _a.subTree) {
72
- _filterChildren(child.component.subTree.children);
73
- }
74
- if (child.children) {
75
- _filterChildren(child.children);
76
- }
77
- }
78
- });
79
- }
80
- };
81
- _filterChildren(children);
82
- return vnodes;
83
- };
84
- const sortChildren = (childrens, instance) => {
85
- const vnodes = filterChildren(instance.subTree.children);
86
- childrens.sort((a, b) => vnodes.indexOf(a.vnode) - vnodes.indexOf(b.vnode));
87
- };
88
- const setRelation = (key) => {
89
- const instance = getCurrentInstance();
90
- const childrens = reactive([]);
91
- const initProvide = (value) => {
92
- const addChild = (child) => {
93
- if (child.proxy) {
94
- childrens.push(child);
95
- instance && sortChildren(childrens, instance);
96
- }
97
- };
98
- const removeChild = (child) => {
99
- const index = childrens.indexOf(child);
100
- childrens.splice(index, 1);
101
- };
102
- provide(key, {
103
- addChild,
104
- removeChild,
105
- childrens,
106
- ...value
28
+ var b = /* @__PURE__ */ ((e) => (e.Top = "top", e.Middle = "middle", e.Bottom = "bottom", e))(b || {});
29
+ const M = (e) => {
30
+ const t = [], n = (r) => {
31
+ Array.isArray(r) && r.forEach((i) => {
32
+ var c;
33
+ j(i) && (t.push(i), (c = i.component) != null && c.subTree && n(i.component.subTree.children), i.children && n(i.children));
107
34
  });
108
35
  };
36
+ return n(e), t;
37
+ }, I = (e, t) => {
38
+ const n = M(t.subTree.children);
39
+ e.sort((r, i) => n.indexOf(r.vnode) - n.indexOf(i.vnode));
40
+ }, z = (e) => {
41
+ const t = v(), n = m([]);
109
42
  return {
110
- childrens,
111
- initProvide
43
+ childrens: n,
44
+ initProvide: (i) => {
45
+ _(e, {
46
+ addChild: (s) => {
47
+ s.proxy && (n.push(s), t && I(n, t));
48
+ },
49
+ removeChild: (s) => {
50
+ const a = n.indexOf(s);
51
+ n.splice(a, 1);
52
+ },
53
+ childrens: n,
54
+ ...i
55
+ });
56
+ }
112
57
  };
113
- };
114
- const useRelation = (key) => {
115
- const parent = inject(key, null);
116
- const currentInstance = getCurrentInstance();
117
- if (parent && currentInstance) {
118
- const { childrens, addChild, removeChild } = parent;
119
- addChild(currentInstance);
120
- onUnmounted(() => removeChild(currentInstance));
121
- const index = computed(() => childrens.indexOf(currentInstance));
122
- return {
123
- index,
124
- parent
58
+ }, D = (e) => {
59
+ const t = A(e, null), n = v();
60
+ if (t && n) {
61
+ const { childrens: r, addChild: i, removeChild: c } = t;
62
+ return i(n), L(() => c(n)), {
63
+ index: l(() => r.indexOf(n)),
64
+ parent: t
125
65
  };
126
66
  }
127
67
  return {
128
68
  parent: null,
129
- index: ref(-1)
69
+ index: h(-1)
130
70
  };
131
71
  };
132
- var RowJustify = /* @__PURE__ */ ((RowJustify2) => {
133
- RowJustify2["Start"] = "start";
134
- RowJustify2["Center"] = "center";
135
- RowJustify2["End"] = "end";
136
- RowJustify2["SpaceBetween"] = "space-between";
137
- RowJustify2["SpaceAround"] = "space-around";
138
- return RowJustify2;
139
- })(RowJustify || {});
140
- const [name$1, bem$1] = createNamespace("row");
141
- const ROW_PROVIDE = name$1;
142
- /* @__PURE__ */ defineComponent({
143
- name: name$1,
144
- props: {
145
- type: {
146
- type: String,
147
- default: ""
148
- },
149
- // 列元素之间的间距(单位为 px)
150
- gutter: {
151
- type: [Number, String],
152
- default: 0
153
- },
154
- align: {
155
- type: String,
156
- default: Vertical.Top
157
- },
158
- justify: {
159
- type: String,
160
- default: RowJustify.Start
161
- }
162
- },
163
- setup(props, {
164
- slots
165
- }) {
166
- const {
167
- childrens,
168
- initProvide
169
- } = setRelation(ROW_PROVIDE);
170
- const groupList = computed(() => {
171
- const groups = [[]];
172
- let totalSpan = 0;
173
- childrens.forEach((child, index) => {
174
- var _a;
175
- totalSpan += Number((_a = child.proxy) == null ? void 0 : _a.span);
176
- if (totalSpan > 24) {
177
- groups.push([index]);
178
- totalSpan -= 24;
179
- } else {
180
- groups[groups.length - 1].push(index);
181
- }
182
- });
183
- return groups;
184
- });
185
- const spaceList = computed(() => {
186
- const gutter = Number(props.gutter);
187
- const spaces = [];
188
- if (!gutter)
189
- return spaces;
190
- groupList.value.forEach((group) => {
191
- const averagePadding = gutter * (group.length - 1) / group.length;
192
- group.forEach((item, index) => {
193
- if (index === 0) {
194
- spaces.push({
195
- right: averagePadding,
196
- left: 0
197
- });
198
- } else {
199
- const left = gutter - spaces[item - 1].right;
200
- const right = averagePadding - left;
201
- spaces.push({
202
- left,
203
- right
204
- });
205
- }
206
- });
207
- });
208
- return spaces;
209
- });
210
- initProvide({
211
- spaceList
212
- });
213
- return () => {
214
- var _a;
215
- const {
216
- type,
217
- align,
218
- justify
219
- } = props;
220
- return createVNode("div", {
221
- "class": bem$1({
222
- [type]: type,
223
- [`align-${align}`]: type && align,
224
- [`justify-${justify}`]: type && justify
225
- })
226
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
227
- };
228
- }
229
- });
230
- const [name, bem] = createNamespace("col");
231
- const Col = /* @__PURE__ */ defineComponent({
232
- name,
72
+ var x = /* @__PURE__ */ ((e) => (e.Start = "start", e.Center = "center", e.End = "end", e.SpaceBetween = "space-between", e.SpaceAround = "space-around", e))(x || {});
73
+ const [N, G] = C("row"), S = N;
74
+ b.Top, x.Start;
75
+ const [R, U] = C("col"), f = /* @__PURE__ */ y({
76
+ name: R,
233
77
  props: {
234
78
  // 列数
235
79
  span: {
@@ -242,59 +86,50 @@ const Col = /* @__PURE__ */ defineComponent({
242
86
  default: 0
243
87
  }
244
88
  },
245
- setup(props, {
246
- slots
89
+ setup(e, {
90
+ slots: t
247
91
  }) {
248
92
  const {
249
- parent,
250
- index
251
- } = useRelation(ROW_PROVIDE);
252
- const style2 = computed(() => {
253
- if (!parent) {
93
+ parent: n,
94
+ index: r
95
+ } = D(S), i = l(() => {
96
+ if (!n)
254
97
  return {};
255
- }
256
98
  const {
257
- spaceList
258
- } = parent;
259
- const spaces = spaceList.value;
260
- if (spaces.length === 0)
99
+ spaceList: c
100
+ } = n, o = c.value;
101
+ if (o.length === 0)
261
102
  return {};
262
103
  const {
263
- left,
264
- right
265
- } = spaces[index.value] || {};
104
+ left: s,
105
+ right: a
106
+ } = o[r.value] || {};
266
107
  return {
267
- paddingLeft: left ? `${left}px` : 0,
268
- paddingRight: right ? `${right}px` : 0
108
+ paddingLeft: s ? `${s}px` : 0,
109
+ paddingRight: a ? `${a}px` : 0
269
110
  };
270
111
  });
271
112
  return () => {
272
- var _a;
113
+ var s;
273
114
  const {
274
- span,
275
- offset
276
- } = props;
277
- return createVNode("div", {
278
- "style": style2.value,
279
- "class": bem({
280
- [span]: span,
281
- [`offset-${offset}`]: offset
115
+ span: c,
116
+ offset: o
117
+ } = e;
118
+ return $("div", {
119
+ style: i.value,
120
+ class: U({
121
+ [c]: c,
122
+ [`offset-${o}`]: o
282
123
  })
283
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
124
+ }, [(s = t.default) == null ? void 0 : s.call(t)]);
284
125
  };
285
126
  }
286
127
  });
287
- const reset = "";
288
- const libs = "";
289
- const font = "";
290
- const animation = "";
291
- const theme = "";
292
- const style = "";
293
- Col.install = (app) => {
294
- const { name: name2 } = Col;
295
- app.component(name2, Col);
128
+ f.install = (e) => {
129
+ const { name: t } = f;
130
+ e.component(t, f);
296
131
  };
297
132
  export {
298
- Col,
299
- Col as default
133
+ f as Col,
134
+ f as default
300
135
  };