hy-app 0.2.0 → 0.2.2

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 (104) hide show
  1. package/README.md +2 -1
  2. package/components/hy-back-top/index.scss +1 -10
  3. package/components/hy-badge/index.scss +5 -5
  4. package/components/hy-button/hy-button.vue +6 -7
  5. package/components/hy-button/index.scss +4 -11
  6. package/components/hy-calendar/index.scss +21 -24
  7. package/components/hy-calendar/month.vue +28 -6
  8. package/components/hy-calendar/props.ts +1 -1
  9. package/components/hy-card/index.scss +2 -11
  10. package/components/hy-cell/index.scss +9 -22
  11. package/components/hy-checkbox/hy-checkbox.vue +9 -6
  12. package/components/hy-checkbox/index.scss +14 -17
  13. package/components/hy-code-input/hy-code-input.vue +223 -0
  14. package/components/hy-code-input/index.scss +108 -0
  15. package/components/hy-code-input/props.ts +21 -0
  16. package/components/hy-code-input/typing.d.ts +65 -0
  17. package/components/hy-config-provider/hy-config-provider.vue +2 -1
  18. package/components/hy-config-provider/index.scss +2 -6
  19. package/components/hy-count-down/index.scss +0 -9
  20. package/components/hy-count-to/index.scss +1 -9
  21. package/components/hy-divider/index.scss +2 -1
  22. package/components/hy-divider/props.ts +2 -2
  23. package/components/hy-dropdown/index.scss +1 -1
  24. package/components/hy-dropdown/props.ts +1 -1
  25. package/components/hy-dropdown-item/hy-dropdown-item.vue +2 -5
  26. package/components/hy-dropdown-item/index.scss +13 -30
  27. package/components/hy-empty/index.scss +1 -10
  28. package/components/hy-float-button/index.scss +4 -9
  29. package/components/hy-form/index.scss +1 -8
  30. package/components/hy-grid/hy-grid.vue +5 -5
  31. package/components/hy-grid/index.scss +1 -1
  32. package/components/hy-icon/index.scss +4 -9
  33. package/components/hy-image/hy-image.vue +5 -5
  34. package/components/hy-image/index.scss +2 -2
  35. package/components/hy-image/props.ts +1 -1
  36. package/components/hy-input/hy-input.vue +9 -14
  37. package/components/hy-input/index.scss +10 -12
  38. package/components/hy-input/props.ts +1 -1
  39. package/components/hy-line/index.scss +1 -0
  40. package/components/hy-line/props.ts +1 -1
  41. package/components/hy-line-progress/index.scss +1 -12
  42. package/components/hy-loading/index.scss +2 -2
  43. package/components/hy-modal/hy-modal.vue +8 -5
  44. package/components/hy-modal/index.scss +7 -25
  45. package/components/hy-modal/props.ts +3 -3
  46. package/components/hy-navbar/index.scss +3 -14
  47. package/components/hy-notice-bar/index.scss +31 -41
  48. package/components/hy-notice-bar/props.ts +2 -2
  49. package/components/hy-notify/hy-notify.vue +169 -0
  50. package/components/hy-notify/index.scss +25 -0
  51. package/components/hy-notify/props.ts +14 -0
  52. package/components/hy-notify/typing.d.ts +44 -0
  53. package/components/hy-number-step/index.scss +6 -24
  54. package/components/hy-pagination/hy-pagination.vue +125 -0
  55. package/components/hy-pagination/index.scss +46 -0
  56. package/components/hy-pagination/props.ts +15 -0
  57. package/components/hy-pagination/typing.d.ts +44 -0
  58. package/components/hy-picker/index.scss +5 -1
  59. package/components/hy-popup/index.scss +1 -10
  60. package/components/hy-price/index.scss +0 -6
  61. package/components/hy-qrcode/index.scss +1 -1
  62. package/components/hy-radio/hy-radio.vue +8 -5
  63. package/components/hy-radio/index.scss +16 -18
  64. package/components/hy-rate/index.scss +1 -6
  65. package/components/hy-read-more/index.scss +3 -20
  66. package/components/hy-scroll-list/index.scss +1 -1
  67. package/components/hy-search/index.scss +6 -26
  68. package/components/hy-signature/canvasHelper.ts +51 -0
  69. package/components/hy-signature/hy-signature.vue +656 -0
  70. package/components/hy-signature/index.scss +31 -0
  71. package/components/hy-signature/props.ts +28 -0
  72. package/components/hy-signature/typing.d.ts +177 -0
  73. package/components/hy-slider/index.scss +6 -2
  74. package/components/hy-slider/props.ts +2 -2
  75. package/components/hy-steps/hy-steps.vue +38 -20
  76. package/components/hy-steps/index.scss +6 -17
  77. package/components/hy-submit-bar/index.scss +1 -9
  78. package/components/hy-subsection/index.scss +2 -16
  79. package/components/hy-swipe-action/hy-swipe-action.vue +288 -248
  80. package/components/hy-swipe-action/index.scss +32 -7
  81. package/components/hy-swipe-action/index.ts +34 -0
  82. package/components/hy-swipe-action/props.ts +15 -9
  83. package/components/hy-swipe-action/typing.d.ts +20 -22
  84. package/components/hy-swiper/index.scss +5 -10
  85. package/components/hy-switch/index.scss +19 -18
  86. package/components/hy-switch/props.ts +0 -1
  87. package/components/hy-tabs/index.scss +4 -18
  88. package/components/hy-tag/index.scss +3 -3
  89. package/components/hy-text/hy-text.vue +5 -4
  90. package/components/hy-text/index.scss +3 -15
  91. package/components/hy-textarea/hy-textarea.vue +5 -5
  92. package/components/hy-textarea/index.scss +8 -20
  93. package/components/hy-toast/index.scss +5 -22
  94. package/components/hy-tooltip/index.scss +7 -5
  95. package/components/hy-upload/index.scss +5 -15
  96. package/composables/index.ts +1 -0
  97. package/composables/useTouch.ts +48 -0
  98. package/index.scss +1 -0
  99. package/libs/css/mixin.scss +58 -13
  100. package/libs/css/vars.css +53 -0
  101. package/package.json +2 -2
  102. package/theme.scss +42 -54
  103. package/components/hy-swipe-action/index.wxs +0 -235
  104. package/components/hy-swipe-action/wxs.js +0 -15
@@ -1,4 +1,4 @@
1
- import type { CSSProperties } from "vue";
1
+ import type { CSSProperties, PropType } from "vue";
2
2
 
3
3
  interface SwipeActionOptionsVo {
4
4
  text: string;
@@ -6,36 +6,33 @@ interface SwipeActionOptionsVo {
6
6
  icon?: string;
7
7
  iconSize?: string | number;
8
8
  }
9
+ export type SwipeActionStatus = "close" | "left" | "right";
10
+ // 点击关闭按钮、滑动关闭按钮、通过控制value关闭按钮
11
+ export type SwipeActionReason = "click" | "swipe" | "value";
12
+ export type SwipeActionPosition = SwipeActionStatus | "inside";
13
+ export type SwipeActionBeforeClose = (
14
+ reason: SwipeActionReason,
15
+ position: SwipeActionPosition,
16
+ ) => void;
9
17
 
10
18
  export default interface SwipeActionProps {
11
19
  /**
12
- * @description 数据列表
20
+ * @description 滑动按钮的状态,使用v-model进行双向绑定。
21
+ * 选值为:'left'(左滑)、'close'(关闭状态)、'right'(右滑)。
13
22
  * */
14
- list: Record<string, any>[];
23
+ modelValue?: SwipeActionStatus;
15
24
  /**
16
- * @description 控制打开或者关闭(默认 false )
17
- * */
18
- show?: boolean;
19
- /**
20
- * @description 标识符,如果是v-for,可用index索引值
21
- * */
22
- name?: string;
23
- /**
24
- * @description 唯一键值
25
- * */
26
- key?: string;
27
- /**
28
- * @description 是否禁用(默认 false )
25
+ * @description 是否禁用滑动操作
29
26
  * */
30
27
  disabled?: boolean;
31
- /**
32
- * @description 滑动距离阈值,只有大于此值,才被认为是要打开菜单(默认 30 )
33
- * */
34
- threshold?: number;
35
28
  /**
36
29
  * @description 是否自动关闭其他swipe按钮组(默认 true )
37
30
  * */
38
31
  autoClose?: boolean;
32
+ /**
33
+ * @description 显示底部边框
34
+ * */
35
+ borderBottom?: boolean;
39
36
  /**
40
37
  * @description 右侧按钮内容
41
38
  * */
@@ -45,9 +42,10 @@ export default interface SwipeActionProps {
45
42
  * */
46
43
  duration?: number;
47
44
  /**
48
- * @description 是否关闭
45
+ * @description 在关闭滑动按钮前调用的钩子函数
46
+ * @desc 可以在此函数中执行一些关闭前的操作,如确认提示等。
49
47
  * */
50
- closeOnClick: boolean;
48
+ beforeClose?: funtion | PropType<SwipeActionBeforeClose>;
51
49
  /**
52
50
  * @description 定义需要用到的外部样式
53
51
  * */
@@ -1,16 +1,6 @@
1
1
  @use "../../theme.scss" as *;
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
- /* 暗色主题 */
5
- @include b(theme) {
6
- @include m(dark) {
7
- @include b(swiper__wrapper) {
8
- :deep(.uni-swiper-wrapper) {
9
- background-color: $hy-dark-background--container;
10
- }
11
- }
12
- }
13
- }
14
4
 
15
5
  @include b(swiper) {
16
6
  @include flex;
@@ -22,6 +12,10 @@
22
12
  &__wrapper {
23
13
  flex: 1;
24
14
 
15
+ :deep(.uni-swiper-wrapper) {
16
+ background-color: $hy-background;
17
+ }
18
+
25
19
  &__item {
26
20
  flex: 1;
27
21
 
@@ -32,6 +26,7 @@
32
26
  transition: transform 0.3s;
33
27
  flex: 1;
34
28
 
29
+
35
30
  &__image {
36
31
  flex: 1;
37
32
  }
@@ -2,28 +2,29 @@
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
4
  /* 暗色主题 */
5
- @include b(theme){
6
- @include m(dark) {
7
- @include b(switch) {
8
- color: $hy-dark-color;
9
- @include m(container) {
10
- background-color: $hy-dark-background--track;
11
- }
12
- @include m(node) {
13
- background-color: $hy-dark-background--container;
14
- }
15
- @include m(bg) {
16
- background-color: $hy-dark-background--track;
17
- }
18
- }
19
- }
20
- }
5
+ //@include b(theme){
6
+ // @include m(dark) {
7
+ // @include b(switch) {
8
+ // color: $hy-dark-color;
9
+ // @include m(container) {
10
+ // background-color: $hy-dark-background--track;
11
+ // }
12
+ // @include m(node) {
13
+ // background-color: $hy-dark-background--container;
14
+ // }
15
+ // @include m(bg) {
16
+ // background-color: $hy-dark-background--track;
17
+ // }
18
+ // }
19
+ // }
20
+ //}
21
21
 
22
22
  @include b(switch) {
23
23
  @include flex(row);
24
24
  /* #ifndef APP-NVUE */
25
25
  box-sizing: border-box;
26
26
  /* #endif */
27
+ background-color: $hy-background--3;
27
28
  position: relative;
28
29
  border-radius: $hy-border-radius-semicircle;
29
30
  transition: background-color 0.4s;
@@ -41,7 +42,7 @@
41
42
  @include flex(row);
42
43
  align-items: center;
43
44
  justify-content: center;
44
- background-color: #fff;
45
+ background-color: $hy-background--container;
45
46
  border-radius: $hy-border-radius-semicircle;
46
47
  box-shadow: 1px 1px 1px 0 rgba(0, 0, 0, 0.25);
47
48
  transition-property: transform;
@@ -52,7 +53,7 @@
52
53
  @include m(bg) {
53
54
  position: absolute;
54
55
  border-radius: $hy-border-radius-semicircle;
55
- background-color: #ffffff;
56
+ background-color: $hy-background--3;
56
57
  transition-property: transform;
57
58
  transition-duration: 0.4s;
58
59
  transition-timing-function: ease;
@@ -1,5 +1,4 @@
1
1
  import type IProps from "./typing";
2
- import { ColorConfig } from "../../config";
3
2
 
4
3
  const defaultProps: IProps = {
5
4
  modelValue: false,
@@ -1,20 +1,6 @@
1
1
  @use "../../theme.scss" as *;
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
- /* 暗色主题 */
5
- @include b(theme){
6
- @include m(dark) {
7
- @include b(tabs) {
8
- color: $hy-dark-color;
9
- &__wrapper__nav__item--active {
10
- .hy-tabs__wrapper__nav__item--text {
11
- color: $hy-dark-color;
12
- }
13
- }
14
- }
15
- }
16
- }
17
-
18
4
  @include b(tabs) {
19
5
  &__wrapper {
20
6
  @include flex;
@@ -54,17 +40,17 @@
54
40
 
55
41
  &--active {
56
42
  .hy-tabs__wrapper__nav__item--text {
57
- color: #303133;
43
+ color: $hy-text-color;
58
44
  }
59
45
  }
60
46
 
61
47
  &--text {
62
48
  font-size: 15px;
63
- color: #606266;
64
- white-space: nowrap !important;
49
+ color: $hy-text-color;
50
+ white-space: nowrap;
65
51
 
66
52
  &--disabled {
67
- color: $hy-light-background-disabled !important;
53
+ color: $hy-background--disabled !important;
68
54
  }
69
55
  }
70
56
  }
@@ -13,8 +13,8 @@
13
13
  }
14
14
 
15
15
  /*禁用*/
16
- @include themeColor(disabled, $hy-light-background-disabled, $hy-color-disable-icon,
17
- $hy-light-background-disabled);
16
+ @include themeColor(disabled, $hy-background--disabled, $hy-text-color--disabled,
17
+ $hy-background--disabled);
18
18
 
19
19
  /*圆角*/
20
20
  @include borderRadio(circle);
@@ -75,7 +75,7 @@ $hy-light-background-disabled);
75
75
  @include themeColor(info--plain, transparent, $hy-info, $hy-info);
76
76
 
77
77
  /* 主题色镂空带背景色 */
78
- @include themeColor(primary--plain__fill, var(--hy-tag-plain--fill__bg, $hy-primary-light), $hy-primary, $hy-primary);
78
+ @include themeColor(primary--plain__fill, $hy-primary-light, $hy-primary, $hy-primary);
79
79
  @include themeColor(error--plain__fill, $hy-error-light, $hy-error, $hy-error);
80
80
  @include themeColor(warning--plain__fill, $hy-warning-light, $hy-warning, $hy-warning);
81
81
  @include themeColor(success--plain__fill, $hy-success-light, $hy-success, $hy-success);
@@ -51,13 +51,13 @@
51
51
 
52
52
  <script lang="ts">
53
53
  export default {
54
- name: 'hy-text',
54
+ name: "hy-text",
55
55
  options: {
56
56
  addGlobalClass: true,
57
57
  virtualHost: true,
58
- styleIsolation: 'shared'
59
- }
60
- }
58
+ styleIsolation: "shared",
59
+ },
60
+ };
61
61
  </script>
62
62
 
63
63
  <script setup lang="ts">
@@ -243,6 +243,7 @@ const toLink = () => {
243
243
  <style scoped lang="scss">
244
244
  @import "./index.scss";
245
245
  @import "../../libs/css/mixin.scss";
246
+ /*超出出现省略号*/
246
247
  .hy-text__value--lines {
247
248
  @include multiEllipsis(v-bind(lines));
248
249
  }
@@ -1,23 +1,16 @@
1
1
  @use "../../libs/css/mixin.scss" as *;
2
2
  @use "../../theme.scss" as *;
3
3
 
4
- /* 暗色主题 */
5
- @include b(theme){
6
- @include m(dark) {
7
- @include b(text) {
8
- color: $hy-dark-color;
9
- }
10
- }
11
- }
12
4
 
13
5
  @include b(text) {
14
6
  @include flex(row);
15
7
  align-items: center;
16
8
  flex-wrap: nowrap;
9
+ color: $hy-text-color;
17
10
 
18
11
  &__price {
19
12
  font-size: 14px;
20
- color: $hy-text-color-grey;
13
+ color: $hy-text-color--grey;
21
14
  }
22
15
 
23
16
  &__value {
@@ -34,18 +27,13 @@
34
27
  color: $hy-primary;
35
28
  }
36
29
 
37
- /*超出出现省略号*/
38
- &--lines {
39
- @include multiEllipsis(v-bind(lines));
40
- }
41
-
42
30
  @include themeColor(primary, "", "", $hy-primary);
43
31
  @include themeColor(warning, "", "", $hy-warning);
44
32
  @include themeColor(success, "", "", $hy-success);
45
33
  @include themeColor(info, "", "", $hy-info);
46
34
  @include themeColor(error, "", "", $hy-error);
47
35
  @include themeColor(main, "", "", $hy-light-color);
48
- @include themeColor(content, "", "", $hy-text-color-grey);
36
+ @include themeColor(content, "", "", $hy-text-color--grey);
49
37
  @include themeColor(tips, "", "",$hy-tips-color);
50
38
  @include themeColor(light, "", "", $hy-border-color-light);
51
39
 
@@ -5,7 +5,7 @@
5
5
  :style="[textareaStyle, borderStyle(isFocus)]"
6
6
  >
7
7
  <textarea
8
- class="hy-textarea__field"
8
+ class="hy-textarea--field"
9
9
  :value="innerValue"
10
10
  :style="{ height: addUnit(height) }"
11
11
  :placeholder="placeholder || ''"
@@ -47,13 +47,13 @@
47
47
 
48
48
  <script lang="ts">
49
49
  export default {
50
- name: 'hy-textarea',
50
+ name: "hy-textarea",
51
51
  options: {
52
52
  addGlobalClass: true,
53
53
  virtualHost: true,
54
- styleIsolation: 'shared'
55
- }
56
- }
54
+ styleIsolation: "shared",
55
+ },
56
+ };
57
57
  </script>
58
58
 
59
59
  <script setup lang="ts">
@@ -1,18 +1,6 @@
1
1
  @use "../../theme.scss" as *;
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
- /* 暗色主题 */
5
- @include b(theme){
6
- @include m(dark) {
7
- @include b(textarea) {
8
- color: $hy-dark-color;
9
- &--count {
10
- background-color: $hy-dark-background--container;
11
- }
12
- }
13
- }
14
- }
15
-
16
4
  @include b(textarea) {
17
5
  border-radius: $hy-border-radius-sm;
18
6
  position: relative;
@@ -20,31 +8,31 @@
20
8
  flex: 1;
21
9
  padding: $hy-border-margin-padding-base;
22
10
 
23
- &--radius {
11
+ @include m(radius) {
24
12
  border-radius: $hy-border-radius-sm;
25
13
  }
26
14
 
27
- &--no-radius {
15
+ @include m(no-radius) {
28
16
  border-radius: $hy-border-radius-no;
29
17
  }
30
18
 
31
- &--disabled {
32
- background-color: $hy-light-background-disabled;
19
+ @include m(disabled) {
20
+ background-color: $hy-background--disabled;
21
+ color: $hy-text-color--disabled;
33
22
  }
34
23
 
35
- &__field {
24
+ @include m(field) {
36
25
  flex: 1;
37
26
  font-size: 15px;
38
27
  width: 100%;
39
28
  }
40
29
 
41
- &--count {
30
+ @include m(count) {
42
31
  position: absolute;
43
32
  right: 5px;
44
33
  bottom: 2px;
45
34
  font-size: 12px;
46
- color: $hy-tips-color;
47
- background-color: #ffffff;
35
+ background-color: $hy-background--3;
48
36
  padding: 1px 4px;
49
37
  border-radius: $hy-border-radius-sm;
50
38
  }
@@ -46,29 +46,12 @@
46
46
  }
47
47
  }
48
48
 
49
- @include m(success) {
50
- color: $hy-success;
51
- background-color: $hy-success-light;
52
- border: 1px solid #bef5c8;
53
- }
54
-
55
- @include m(primary) {
56
- color: $hy-primary;
57
- background-color: $hy-primary-light;
58
- border: 1px solid rgb(215, 234, 254);
59
- }
49
+ @include themeColor(success, $hy-success-light, #bef5c8, $hy-success);
50
+ @include themeColor(primary, $hy-primary-light, rgb(215, 234, 254), $hy-primary);
51
+ @include themeColor(error, $hy-error-light, #fde2e2, $hy-error);
52
+ @include themeColor(warning, $hy-warning-light, #faecd8, $hy-warning);
53
+ @include themeColor(info, $hy-info-light, $hy-info, $hy-info);
60
54
 
61
- @include m(error) {
62
- color: $hy-error;
63
- background-color: $hy-error-light;
64
- border: 1px solid #fde2e2;
65
- }
66
-
67
- @include m(warning) {
68
- color: $hy-warning;
69
- background-color: $hy-warning-light;
70
- border: 1px solid #faecd8;
71
- }
72
55
 
73
56
  @include m(default) {
74
57
  color: #ffffff;
@@ -21,7 +21,7 @@
21
21
  justify-content: center;
22
22
 
23
23
  &__list {
24
- background-color: #060607;
24
+ background-color: rgb(50, 50, 51);
25
25
  position: relative;
26
26
  flex: 1;
27
27
  border-radius: $hy-border-radius-sm;
@@ -31,14 +31,16 @@
31
31
  overflow: hidden;
32
32
 
33
33
  &__btn {
34
- padding: $hy-border-margin-padding-base;
34
+ padding: $hy-border-margin-padding-sm $hy-border-margin-padding-base;
35
+ display: flex;
36
+ justify-content: center;
37
+ align-items: center;
35
38
 
36
39
  &--hover {
37
- background-color: $hy-text-color-hover;
40
+ background-color: $hy-background--hover;
38
41
  }
39
42
 
40
43
  &__text {
41
- line-height: 12px;
42
44
  font-size: 13px;
43
45
  color: #ffffff;
44
46
  }
@@ -47,7 +49,7 @@
47
49
 
48
50
  &__indicator {
49
51
  position: absolute;
50
- background-color: #060607;
52
+ background-color: rgb(50, 50, 51);
51
53
  width: 14px;
52
54
  height: 14px;
53
55
  bottom: -4px;
@@ -4,16 +4,6 @@
4
4
  $hy-upload-image-width: 80px !default;
5
5
  $hy-upload-text-font-size: 11px !default;
6
6
 
7
- /* 暗色主题 */
8
- @include b(theme){
9
- @include m(dark) {
10
- @include b(upload) {
11
- &__button {
12
- background-color: $hy-dark-background--container;
13
- }
14
- }
15
- }
16
- }
17
7
 
18
8
  @include b(upload) {
19
9
  @include flex(column);
@@ -47,7 +37,7 @@ $hy-upload-text-font-size: 11px !default;
47
37
 
48
38
  &__text {
49
39
  font-size: $hy-upload-text-font-size;
50
- color: $hy-tips-color;
40
+ color: $hy-text-color--grey;
51
41
  margin-top: 2px;
52
42
  }
53
43
  }
@@ -110,7 +100,7 @@ $hy-upload-text-font-size: 11px !default;
110
100
  justify-content: center;
111
101
  width: $hy-upload-image-width;
112
102
  height: $hy-upload-image-width;
113
- background-color: rgb(244, 245, 247);
103
+ background-color: $hy-background--empty;
114
104
  border-radius: 2px;
115
105
  margin: 0 8px 8px 0;
116
106
  /* #ifndef APP-NVUE */
@@ -119,12 +109,12 @@ $hy-upload-text-font-size: 11px !default;
119
109
 
120
110
  &__text {
121
111
  font-size: $hy-upload-text-font-size;
122
- color: $hy-tips-color;
112
+ color: $hy-text-color--grey;
123
113
  margin-top: 2px;
124
114
  }
125
115
 
126
116
  &--hover {
127
- background-color: rgb(230, 231, 233);
117
+ background-color: $hy-background--hover;
128
118
  }
129
119
 
130
120
  &--disabled {
@@ -153,6 +143,6 @@ $hy-upload-text-font-size: 11px !default;
153
143
 
154
144
  .tips-text {
155
145
  font-size: 12px;
156
- color: #b99c65;
146
+ color: $hy-primary;
157
147
  }
158
148
  }
@@ -1 +1,2 @@
1
1
  export * from "./useShare";
2
+ export * from "./useTouch";
@@ -0,0 +1,48 @@
1
+ import { ref } from "vue";
2
+
3
+ export function useTouch() {
4
+ const direction = ref<string>("");
5
+ const deltaX = ref<number>(0);
6
+ const deltaY = ref<number>(0);
7
+ const offsetX = ref<number>(0);
8
+ const offsetY = ref<number>(0);
9
+ const startX = ref<number>(0);
10
+ const startY = ref<number>(0);
11
+
12
+ function touchStart(event: any) {
13
+ const touch = event.touches[0];
14
+ direction.value = "";
15
+ deltaX.value = 0;
16
+ deltaY.value = 0;
17
+ offsetX.value = 0;
18
+ offsetY.value = 0;
19
+ startX.value = touch.clientX;
20
+ startY.value = touch.clientY;
21
+ }
22
+
23
+ function touchMove(event: any) {
24
+ const touch = event.touches[0];
25
+ deltaX.value = touch.clientX - startX.value;
26
+ deltaY.value = touch.clientY - startY.value;
27
+ offsetX.value = Math.abs(deltaX.value);
28
+ offsetY.value = Math.abs(deltaY.value);
29
+ direction.value =
30
+ offsetX.value > offsetY.value
31
+ ? "horizontal"
32
+ : offsetX.value < offsetY.value
33
+ ? "vertical"
34
+ : "";
35
+ }
36
+
37
+ return {
38
+ touchStart,
39
+ touchMove,
40
+ direction,
41
+ deltaX,
42
+ deltaY,
43
+ offsetX,
44
+ offsetY,
45
+ startX,
46
+ startY,
47
+ };
48
+ }
package/index.scss CHANGED
@@ -1,2 +1,3 @@
1
1
  @use "./libs/css/common.scss";
2
+ @use "./libs/css/vars.css";
2
3
  //@use "./libs/css/mixin.scss" as HyMixin;
@@ -1,6 +1,9 @@
1
1
  @use "../../theme.scss";
2
- $namespace: hy;
3
- $modifier-separator: '--';
2
+ $namespace: 'hy' !default;
3
+ $common-separator: '-' !default;
4
+ $element-separator: '__' !default;
5
+ $modifier-separator: '--' !default;
6
+ $state-prefix: 'is-' !default;
4
7
 
5
8
  @mixin b($block) {
6
9
  $B: $namespace + '-' + $block !global;
@@ -28,11 +31,64 @@ $modifier-separator: '--';
28
31
  }
29
32
  }
30
33
 
34
+ @mixin e($element) {
35
+ $E: $element !global;
36
+ $selector: &;
37
+ $currentSelector: '';
38
+ @each $unit in $element {
39
+ $currentSelector: #{$currentSelector +
40
+ '.' +
41
+ $B +
42
+ $element-separator +
43
+ $unit +
44
+ ','};
45
+ }
46
+
47
+ @if hitAllSpecialNestRule($selector) {
48
+ @at-root {
49
+ #{$selector} {
50
+ #{$currentSelector} {
51
+ @content;
52
+ }
53
+ }
54
+ }
55
+ } @else {
56
+ @at-root {
57
+ #{$currentSelector} {
58
+ @content;
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ /* 状态,生成 is-$state 类名 */
65
+ @mixin is($states...) {
66
+ @at-root {
67
+ @each $state in $states {
68
+ &.#{$state-prefix + $state} {
69
+ @content;
70
+ }
71
+ }
72
+ }
73
+ }
74
+ /* 添加伪类元素 */
75
+ @mixin pseudo($pseudo) {
76
+ @at-root #{&}#{':#{$pseudo}'} {
77
+ @content;
78
+ }
79
+ }
80
+
31
81
  @mixin themeColor($type, $bg-color: transparent, $border-color: transparent, $color: #FFFFFF) {
32
82
  @include m($type) {
33
83
  background-color: $bg-color;
34
84
  border: 1px solid $border-color;
35
85
  color: $color;
86
+
87
+ :deep() {
88
+ @include b(icon) {
89
+ color: $color;
90
+ }
91
+ }
36
92
  }
37
93
  }
38
94
 
@@ -56,17 +112,6 @@ $modifier-separator: '--';
56
112
  flex-direction: $direction;
57
113
  }
58
114
 
59
- /* 状态,生成 is-$state 类名 */
60
- @mixin when($states...) {
61
- @at-root {
62
- @each $state in $states {
63
- &.#{$state-prefix + $state} {
64
- @content;
65
- }
66
- }
67
- }
68
- }
69
-
70
115
  /* 几行出现省略号 */
71
116
  @mixin line-feed($line: 1) {
72
117
  display: -webkit-box;