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, inject, getCurrentInstance, watch, onUnmounted, defineComponent, computed, createVNode, withDirectives, vModelText } 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 V, reactive as z, inject as E, getCurrentInstance as F, watch as x, onUnmounted as A, defineComponent as T, computed as f, createVNode as d, withDirectives as k, vModelText as w } from "vue";
2
+ const b = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((l, n) => l + b(e, n), "") : Object.keys(t).reduce(
3
+ (l, n) => l + (t[n] ? b(e, n) : ""),
4
+ ""
5
+ ) : "", D = (e) => (t, l) => {
6
+ let n = t, i = l;
7
+ return n && typeof n != "string" && (i = n, n = ""), n = n ? `${e}__${n}` : e, `${n}${b(n, i)}`;
8
+ }, R = () => (e, t) => t ? `${b(`y-${e}`, t)}` : `y-${e}`, W = {
38
9
  "pull-refresh": {
39
10
  pulling: "下拉刷新...",
40
11
  loosing: "释放刷新...",
@@ -46,50 +17,31 @@ const defaultLang = {
46
17
  validateMessage: "请输入正确内容"
47
18
  }
48
19
  };
49
- ref("zh-CN");
50
- reactive({
51
- "zh-CN": defaultLang
20
+ V("zh-CN");
21
+ z({
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 FORM_ITEM_PROVIDE = "y-form-item";
64
- const useFormItem = () => {
65
- const parent = inject(FORM_ITEM_PROVIDE, null);
66
- const instance = getCurrentInstance();
67
- if (parent && (instance == null ? void 0 : instance.proxy)) {
68
- const { setField } = parent;
69
- const { resetValidation, change, validateWithTrigger } = parent;
70
- watch(
71
- () => instance.proxy.modelValue,
24
+ const O = (e) => {
25
+ const t = `y-${e}`;
26
+ return [t, D(t), R()];
27
+ }, U = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, j = "y-form-item", G = () => {
28
+ const e = E(j, null), t = F();
29
+ if (e && (t != null && t.proxy)) {
30
+ const { setField: l } = e, { resetValidation: n, change: i, validateWithTrigger: s } = e;
31
+ return x(
32
+ () => t.proxy.modelValue,
72
33
  () => {
73
- if (parent.instance && parent.instance.exposed) {
74
- resetValidation();
75
- change();
76
- validateWithTrigger("onChange");
77
- }
34
+ e.instance && e.instance.exposed && (n(), i(), s("onChange"));
78
35
  }
79
- );
80
- setField(instance);
81
- onUnmounted(() => setField(null));
82
- return {
83
- parent
36
+ ), l(t), A(() => l(null)), {
37
+ parent: e
84
38
  };
85
39
  }
86
40
  return {
87
41
  parent: null
88
42
  };
89
- };
90
- const [name, bem, gbem] = createNamespace("stepper");
91
- const Stepper = /* @__PURE__ */ defineComponent({
92
- name,
43
+ }, [P, m, v] = O("stepper"), g = /* @__PURE__ */ T({
44
+ name: P,
93
45
  props: {
94
46
  modelValue: {
95
47
  type: [Number, String],
@@ -109,7 +61,7 @@ const Stepper = /* @__PURE__ */ defineComponent({
109
61
  },
110
62
  integer: {
111
63
  type: Boolean,
112
- default: false
64
+ default: !1
113
65
  },
114
66
  max: {
115
67
  type: Number,
@@ -117,11 +69,11 @@ const Stepper = /* @__PURE__ */ defineComponent({
117
69
  },
118
70
  disabled: {
119
71
  type: Boolean,
120
- default: false
72
+ default: !1
121
73
  },
122
74
  disableInput: {
123
75
  type: Boolean,
124
- default: false
76
+ default: !1
125
77
  },
126
78
  inputWidth: {
127
79
  type: [Number, String],
@@ -133,131 +85,99 @@ const Stepper = /* @__PURE__ */ defineComponent({
133
85
  }
134
86
  },
135
87
  emits: ["change", "blur", "subtract", "addit", "foucs", "update:modelValue"],
136
- setup(props, {
137
- slots,
138
- emit
88
+ setup(e, {
89
+ slots: t,
90
+ emit: l
139
91
  }) {
140
92
  const {
141
- parent
142
- } = useFormItem();
143
- const currentValue = ref(props.modelValue);
144
- const size = computed(() => props.size || (parent == null ? void 0 : parent.getProp("size")));
145
- const subDisabled = computed(() => props.modelValue <= props.min || props.disabled);
146
- const addDisabled = computed(() => props.modelValue >= props.max || props.disabled);
147
- const format = (value) => {
148
- let bool = props.integer;
149
- return value.toString().replace(/([^0-9\.\-])/g, "").replace(/\./g, ($1) => {
150
- if (bool)
151
- return "";
152
- bool = true;
153
- return $1;
154
- }).replace(/\-/g, (_, i) => i === 0 ? "-" : "");
93
+ parent: n
94
+ } = G(), i = V(e.modelValue), s = f(() => e.size || (n == null ? void 0 : n.getProp("size"))), y = f(() => e.modelValue <= e.min || e.disabled), p = f(() => e.modelValue >= e.max || e.disabled), h = (a) => {
95
+ let u = e.integer;
96
+ return a.toString().replace(/([^0-9\.\-])/g, "").replace(/\./g, (r) => u ? "" : (u = !0, r)).replace(/\-/g, (r, c) => c === 0 ? "-" : "");
97
+ }, o = (a) => {
98
+ const u = h(a);
99
+ i.value = u, l("update:modelValue", u), l("change", u);
155
100
  };
156
- const changeValue = (number) => {
157
- const fNumber = format(number);
158
- currentValue.value = fNumber;
159
- emit("update:modelValue", fNumber);
160
- emit("change", fNumber);
161
- };
162
- watch(() => props.modelValue, (value) => {
163
- currentValue.value = value;
101
+ x(() => e.modelValue, (a) => {
102
+ i.value = a;
164
103
  });
165
- const onFocus = (e) => emit("focus", e);
166
- const onChange = (e) => {
104
+ const $ = (a) => l("focus", a), _ = (a) => {
167
105
  const {
168
- value
169
- } = e.target;
170
- changeValue(value);
171
- };
172
- const onBlurReset = (e) => {
106
+ value: u
107
+ } = a.target;
108
+ o(u);
109
+ }, B = (a) => {
173
110
  const {
174
- value
175
- } = e.target;
176
- const number = Number(format(value));
177
- if (number && number < props.min)
178
- changeValue(props.min);
179
- else if (number && number > props.max)
180
- changeValue(props.max);
181
- else if (number)
182
- changeValue(number);
183
- if (parent) {
111
+ value: u
112
+ } = a.target, r = Number(h(u));
113
+ if (r && r < e.min ? o(e.min) : r && r > e.max ? o(e.max) : r && o(r), n) {
184
114
  const {
185
- validateWithTrigger
186
- } = parent;
187
- validateWithTrigger("onBlur");
115
+ validateWithTrigger: c
116
+ } = n;
117
+ c("onBlur");
188
118
  }
189
- emit("blur", e);
190
- };
191
- const onSubtract = () => {
192
- const number = Number(props.modelValue) - props.step;
193
- changeValue(number);
194
- emit("subtract", number);
195
- };
196
- const onAddit = () => {
197
- const number = Number(props.modelValue) + props.step;
198
- changeValue(number);
199
- emit("addit", number);
119
+ l("blur", a);
120
+ }, C = () => {
121
+ const a = Number(e.modelValue) - e.step;
122
+ o(a), l("subtract", a);
123
+ }, I = () => {
124
+ const a = Number(e.modelValue) + e.step;
125
+ o(a), l("addit", a);
200
126
  };
201
127
  return () => {
202
128
  const {
203
- min,
204
- max,
205
- inputWidth,
206
- placeholder,
207
- disabled,
208
- disableInput
209
- } = props;
210
- return createVNode("div", {
211
- "class": bem({
212
- [size.value]: size.value
129
+ min: a,
130
+ max: u,
131
+ inputWidth: r,
132
+ placeholder: c,
133
+ disabled: S,
134
+ disableInput: N
135
+ } = e;
136
+ return d("div", {
137
+ class: m({
138
+ [s.value]: s.value
213
139
  })
214
- }, [slots.subtraction ? slots.subtraction() : createVNode("button", {
215
- "type": "button",
216
- "disabled": subDisabled.value,
217
- "class": [bem("subtraction"), gbem("el", {
218
- clickable: !subDisabled.value
140
+ }, [t.subtraction ? t.subtraction() : d("button", {
141
+ type: "button",
142
+ disabled: y.value,
143
+ class: [m("subtraction"), v("el", {
144
+ clickable: !y.value
219
145
  })],
220
- "onClick": onSubtract
221
- }, null), withDirectives(createVNode("input", {
222
- "type": "text",
223
- "class": bem("input", {
224
- "only-disable": disableInput
146
+ onClick: C
147
+ }, null), k(d("input", {
148
+ type: "text",
149
+ class: m("input", {
150
+ "only-disable": N
225
151
  }),
226
- "style": {
227
- width: parseUnit(inputWidth)
152
+ style: {
153
+ width: U(r)
228
154
  },
229
- "onUpdate:modelValue": ($event) => currentValue.value = $event,
230
- "role": "spinbutton",
231
- "inputmode": "decimal",
232
- "aria-min": min,
233
- "aria-max": max,
234
- "aria-valuenow": currentValue.value,
235
- "onInput": onChange,
236
- "onBlur": onBlurReset,
237
- "onFocus": onFocus,
238
- "placeholder": placeholder,
239
- "disabled": disabled || disableInput
240
- }, null), [[vModelText, currentValue.value]]), slots.addition ? slots.addition() : createVNode("button", {
241
- "type": "button",
242
- "disabled": addDisabled.value,
243
- "class": [bem("addition"), gbem("el", {
244
- clickable: !addDisabled.value
155
+ "onUpdate:modelValue": (M) => i.value = M,
156
+ role: "spinbutton",
157
+ inputmode: "decimal",
158
+ "aria-min": a,
159
+ "aria-max": u,
160
+ "aria-valuenow": i.value,
161
+ onInput: _,
162
+ onBlur: B,
163
+ onFocus: $,
164
+ placeholder: c,
165
+ disabled: S || N
166
+ }, null), [[w, i.value]]), t.addition ? t.addition() : d("button", {
167
+ type: "button",
168
+ disabled: p.value,
169
+ class: [m("addition"), v("el", {
170
+ clickable: !p.value
245
171
  })],
246
- "onClick": onAddit
172
+ onClick: I
247
173
  }, null)]);
248
174
  };
249
175
  }
250
176
  });
251
- const reset = "";
252
- const libs = "";
253
- const font = "";
254
- const animation = "";
255
- const theme = "";
256
- const style = "";
257
- Stepper.install = (Vue) => {
258
- const { name: name2 } = Stepper;
259
- Vue.component(name2, Stepper);
177
+ g.install = (e) => {
178
+ const { name: t } = g;
179
+ e.component(t, g);
260
180
  };
261
181
  export {
262
- Stepper as default
182
+ g as default
263
183
  };