hy-app 0.2.5 → 0.2.6

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 (37) hide show
  1. package/common/index.ts +2 -1
  2. package/common/shakeService.ts +62 -0
  3. package/components/hy-action-sheet/hy-action-sheet.vue +184 -0
  4. package/components/hy-action-sheet/index.scss +123 -0
  5. package/components/hy-action-sheet/props.ts +18 -0
  6. package/components/hy-action-sheet/typing.d.ts +96 -0
  7. package/components/hy-button/hy-button.vue +1 -1
  8. package/components/hy-button/typing.d.ts +35 -31
  9. package/components/hy-cell/typing.d.ts +27 -24
  10. package/components/hy-empty/hy-empty.vue +30 -37
  11. package/components/hy-empty/icon.ts +78 -0
  12. package/components/hy-empty/index.scss +2 -1
  13. package/components/hy-empty/props.ts +10 -9
  14. package/components/hy-empty/typing.d.ts +39 -14
  15. package/components/hy-float-button/hy-float-button.vue +98 -10
  16. package/components/hy-float-button/props.ts +16 -14
  17. package/components/hy-float-button/typing.d.ts +34 -23
  18. package/components/hy-icon/hy-icon.vue +40 -42
  19. package/components/hy-icon/props.ts +17 -16
  20. package/components/hy-icon/typing.d.ts +24 -20
  21. package/components/hy-modal/hy-modal.vue +42 -54
  22. package/components/hy-modal/index.scss +56 -32
  23. package/components/hy-modal/props.ts +15 -14
  24. package/components/hy-modal/typing.d.ts +23 -17
  25. package/components/hy-popup/index.scss +2 -2
  26. package/components/hy-popup/props.ts +7 -7
  27. package/components/hy-popup/typing.d.ts +17 -17
  28. package/components/hy-signature/props.ts +14 -14
  29. package/components/hy-tooltip/index.scss +2 -2
  30. package/libs/css/_config.scss +5 -0
  31. package/libs/css/_function.scss +89 -0
  32. package/libs/css/mixin.scss +58 -21
  33. package/libs/css/vars.css +3 -1
  34. package/package.json +2 -2
  35. package/theme.scss +2 -1
  36. package/utils/inspect.ts +48 -40
  37. package/utils/utils.ts +170 -187
@@ -6,70 +6,94 @@
6
6
  border-radius: $hy-border-radius-base;
7
7
  overflow: hidden;
8
8
 
9
+ /* 标题 */
9
10
  &__title {
10
11
  display: flex;
11
12
  flex-direction: column;
12
13
  justify-content: center;
13
14
  align-items: center;
14
- font-size: 16px;
15
+ font-size: $hy-font-size-base;
15
16
  font-weight: bold;
16
17
  color: $hy-text-color;
17
18
  text-align: center;
18
19
  padding-top: 25px;
19
20
  }
20
21
 
22
+ /* 内容 */
21
23
  &__content {
22
24
  padding: 20px;
23
25
  @include flex;
24
26
  justify-content: center;
25
27
 
26
28
  &__text {
27
- font-size: 15px;
29
+ font-size: $hy-font-size-sm;
28
30
  color: $hy-text-color--grey;
29
31
  flex: 1;
30
32
  text-align: center;
31
33
  }
32
34
  }
33
35
 
34
- &__button-group {
35
- border-top: $hy-border-line;
36
- @include flex;
37
-
38
- &--confirm-button {
39
- flex-direction: column;
40
- padding: 0 25px 15px;
36
+ /* 底部按钮 */
37
+ &__button {
38
+ /* 两个按钮的样式 */
39
+ &-exact {
40
+ view:first-child {
41
+ margin-right: $hy-border-margin-padding-lg;
42
+ }
43
+ &--reverse {
44
+ view:last-child {
45
+ margin-right: $hy-border-margin-padding-lg;
46
+ }
47
+ }
41
48
  }
42
49
 
43
- &__wrapper {
44
- flex: 1;
50
+
51
+ &-group {
45
52
  @include flex;
46
- justify-content: center;
47
- align-items: center;
48
- height: 48px;
53
+ padding: 20px;
49
54
 
50
- &--confirm,
51
- &--only-cancel {
52
- border-bottom-right-radius: $hy-border-radius-base;
55
+ /* 自定义底部按钮 */
56
+ &--confirm-button {
57
+ flex-direction: column;
58
+ padding: 0 25px 15px;
53
59
  }
54
60
 
55
- &--cancel,
56
- &--only-confirm {
57
- border-bottom-left-radius: $hy-border-radius-base;
58
- }
59
61
 
60
- &--hover {
61
- background-color: $hy-background--hover;
62
- }
62
+ &__wrapper {
63
+ flex: 1;
64
+ @include flex;
65
+ justify-content: center;
66
+ align-items: center;
67
+ height: 43px;
68
+ border-radius: $hy-border-radius-semicircle;
63
69
 
64
- &__text {
65
- color: $hy-text-color--2;
66
- font-size: 16px;
67
- text-align: center;
68
- }
70
+ /* 确认 */
71
+ &--confirm {
72
+ background-color: $hy-primary;
73
+ &-text {
74
+ color: #FFFFFF;
75
+ }
76
+ }
77
+
78
+ /* 取消 */
79
+ &--cancel {
80
+ //background-color: $hy-background--empty;
81
+ background-color: #323233;
82
+
83
+ &-text {
84
+ color: $hy-text-color;
85
+ }
86
+ }
87
+
88
+ &--hover {
89
+ background-color: $hy-background--hover;
90
+ }
69
91
 
70
- &--confirm-text {
71
- color: $hy-primary;
92
+ &__text {
93
+ font-size: 16px;
94
+ text-align: center;
95
+ }
72
96
  }
73
97
  }
74
98
  }
75
- }
99
+ }
@@ -1,24 +1,25 @@
1
- import type IProps from "./typing";
2
- import { ColorConfig } from "../../config";
1
+ import type IProps from './typing'
2
+ import { ColorConfig } from '../../config'
3
3
 
4
4
  const defaultProps: IProps = {
5
- show: false,
6
- title: "",
7
- content: "",
8
- confirmText: "确认",
9
- cancelText: "取消",
5
+ modelValue: false,
6
+ title: '',
7
+ content: '',
8
+ confirmText: '确认',
9
+ cancelText: '取消',
10
10
  showConfirmButton: true,
11
11
  showCancelButton: false,
12
- confirmColor: "",
13
- cancelColor: "",
12
+ confirmColor: '',
13
+ cancelColor: '',
14
14
  buttonReverse: false,
15
15
  zoom: true,
16
+ round: 16,
16
17
  asyncClose: false,
17
18
  closeOnClickOverlay: false,
18
19
  negativeTop: 0,
19
- width: "550rpx",
20
- confirmButtonShape: "",
21
- contentTextAlign: "left",
22
- };
20
+ width: '550rpx',
21
+ confirmButtonShape: '',
22
+ contentTextAlign: 'left',
23
+ }
23
24
 
24
- export default defaultProps;
25
+ export default defaultProps
@@ -1,70 +1,76 @@
1
+ import { RowCenterType } from 'hy-app/typing/modules/common'
2
+
1
3
  export default interface HyModalProps {
2
4
  /**
3
5
  * @description 是否显示模态框,请赋值给show (默认 false )
4
6
  * */
5
- show: boolean;
7
+ modelValue: boolean
6
8
  /**
7
9
  * @description 标题内容
8
10
  * */
9
- title?: string;
11
+ title?: string
10
12
  /**
11
13
  * @description 模态框内容,如传入slot内容,则此参数无效
12
14
  * */
13
- content?: string;
15
+ content?: string
14
16
  /**
15
17
  * @description 确认按钮的文字 (默认 '确认' )
16
18
  * */
17
- confirmText?: string;
19
+ confirmText?: string
18
20
  /**
19
21
  * @description 取消按钮的文字 (默认 '取消' )
20
22
  * */
21
- cancelText?: string;
23
+ cancelText?: string
22
24
  /**
23
25
  * @description 是否显示确认按钮 (默认 true )
24
26
  * */
25
- showConfirmButton?: boolean;
27
+ showConfirmButton?: boolean
26
28
  /**
27
29
  * @description 是否显示取消按钮 (默认 false )
28
30
  * */
29
- showCancelButton?: boolean;
31
+ showCancelButton?: boolean
30
32
  /**
31
33
  * @description 确认按钮的颜色 (默认 '#2979ff' )
32
34
  * */
33
- confirmColor?: string;
35
+ confirmColor?: string
34
36
  /**
35
37
  * @description 取消按钮的颜色 (默认 '#606266' )
36
38
  * */
37
- cancelColor?: string;
39
+ cancelColor?: string
38
40
  /**
39
41
  * @description 对调确认和取消的位置 (默认 false )
40
42
  * */
41
- buttonReverse?: boolean;
43
+ buttonReverse?: boolean
42
44
  /**
43
45
  * @description 是否开启缩放模式 (默认 true )
44
46
  * */
45
- zoom?: boolean;
47
+ zoom?: boolean
48
+ /**
49
+ * @description 弹窗的圆角 (默认 16 )
50
+ * */
51
+ round?: string | number
46
52
  /**
47
53
  * @description 是否异步关闭,只对确定按钮有效,见上方说明 (默认 false )
48
54
  * */
49
- asyncClose?: boolean;
55
+ asyncClose?: boolean
50
56
  /**
51
57
  * @description 是否允许点击遮罩关闭Modal (默认 false )
52
58
  * */
53
- closeOnClickOverlay?: boolean;
59
+ closeOnClickOverlay?: boolean
54
60
  /**
55
61
  * @description 往上偏移的值,给一个负的margin-top,往上偏移,避免和键盘重合的情况,单位任意,数值则默认为px单位 (默认 0 )
56
62
  * */
57
- negativeTop?: number;
63
+ negativeTop?: number
58
64
  /**
59
65
  * @description modal宽度,不支持百分比,可以数值,px,rpx单位 (默认 '650rpx' )
60
66
  * */
61
- width?: string | number;
67
+ width?: string | number
62
68
  /**
63
69
  * @description 确认按钮的样式,如设置,将不会显示取消按钮
64
70
  * */
65
- confirmButtonShape?: HyApp.ShapeType | "";
71
+ confirmButtonShape?: HyApp.ShapeType | ''
66
72
  /**
67
73
  * @description 文案对齐方式
68
74
  * */
69
- contentTextAlign?: HyApp.LeftRightType | "center";
75
+ contentTextAlign?: HyApp.RowCenterType
70
76
  }
@@ -6,7 +6,7 @@
6
6
  flex: 1;
7
7
 
8
8
  &__content {
9
- background-color: $hy-background--2;
9
+ background-color: $hy-background--container;
10
10
  position: relative;
11
11
 
12
12
  &--round-top {
@@ -57,4 +57,4 @@
57
57
  bottom: $hy-border-margin-padding-lg;
58
58
  }
59
59
  }
60
- }
60
+ }
@@ -1,9 +1,9 @@
1
- import type IProps from "./typing";
1
+ import type IProps from './typing'
2
2
 
3
3
  const defaultProps: IProps = {
4
4
  show: false,
5
5
  overlay: true,
6
- mode: "bottom",
6
+ mode: 'bottom',
7
7
  duration: 300,
8
8
  closeable: false,
9
9
  overlayStyle: {},
@@ -12,10 +12,10 @@ const defaultProps: IProps = {
12
12
  zIndex: 10075,
13
13
  safeAreaInsetBottom: true,
14
14
  safeAreaInsetTop: false,
15
- closeIconPos: "top-right",
16
- round: 0,
15
+ closeIconPos: 'top-right',
16
+ round: '',
17
17
  zoom: true,
18
- bgColor: "",
19
- };
18
+ bgColor: '',
19
+ }
20
20
 
21
- export default defaultProps;
21
+ export default defaultProps
@@ -1,68 +1,68 @@
1
- import type { CSSProperties } from "vue";
1
+ import type { CSSProperties } from 'vue'
2
2
 
3
3
  export default interface HyPopupProps {
4
4
  /**
5
5
  * @description 是否展示弹窗 (默认 false )
6
6
  * */
7
- show: boolean;
7
+ show: boolean
8
8
  /**
9
9
  * @description 是否显示遮罩 (默认 true )
10
10
  * */
11
- overlay?: boolean;
11
+ overlay?: boolean
12
12
  /**
13
13
  * @description 弹出方向(默认 'bottom' )
14
14
  * */
15
- mode?: HyApp.LayoutType;
15
+ mode?: HyApp.LayoutType
16
16
  /**
17
17
  * @description 动画时长,单位ms (默认 300 )
18
18
  * */
19
- duration?: number;
19
+ duration?: number
20
20
  /**
21
21
  * @description 是否显示关闭图标(默认 false )
22
22
  * */
23
- closeable?: boolean;
23
+ closeable?: boolean
24
24
  /**
25
25
  * @description 自定义遮罩的样式
26
26
  * */
27
- overlayStyle?: CSSProperties;
27
+ overlayStyle?: CSSProperties
28
28
  /**
29
29
  * @description 遮罩透明度,0-1之间(默认 0.5)
30
30
  * */
31
- overlayOpacity?: number;
31
+ overlayOpacity?: number
32
32
  /**
33
33
  * @description 点击遮罩是否关闭弹窗 (默认 true )
34
34
  * */
35
- closeOnClickOverlay?: boolean;
35
+ closeOnClickOverlay?: boolean
36
36
  /**
37
37
  * @description 层级 (默认 10075 )
38
38
  * */
39
- zIndex?: number;
39
+ zIndex?: number
40
40
  /**
41
41
  * @description 是否为iPhoneX留出底部安全距离 (默认 true )
42
42
  * */
43
- safeAreaInsetBottom?: boolean;
43
+ safeAreaInsetBottom?: boolean
44
44
  /**
45
45
  * @description 是否留出顶部安全距离(状态栏高度) (默认 false )
46
46
  * */
47
- safeAreaInsetTop?: boolean;
47
+ safeAreaInsetTop?: boolean
48
48
  /**
49
49
  * @description 自定义关闭图标位置(默认 'top-right' )
50
50
  * */
51
- closeIconPos?: "top-left" | "top-right";
51
+ closeIconPos?: 'top-left' | 'top-right'
52
52
  /**
53
53
  * @description 圆角值(默认 0)
54
54
  * */
55
- round?: number;
55
+ round?: string | number
56
56
  /**
57
57
  * @description 当mode=center时 是否开启缩放(默认 true )
58
58
  * */
59
- zoom?: boolean;
59
+ zoom?: boolean
60
60
  /**
61
61
  * @description 背景颜色
62
62
  * */
63
- bgColor?: string;
63
+ bgColor?: string
64
64
  /**
65
65
  * @description 自定义样式
66
66
  * */
67
- customStyle?: CSSProperties;
67
+ customStyle?: CSSProperties
68
68
  }
@@ -1,29 +1,29 @@
1
- import type IProps from "./typing";
1
+ import type IProps from './typing'
2
2
 
3
3
  const defaultProps: IProps = {
4
- penColor: "#000",
5
- lineWidth: 2,
6
- clearText: "清空",
7
- revokeText: "撤销",
8
- restoreText: "恢复",
9
- confirmText: "确认",
10
- fileType: "png",
4
+ penColor: '#000',
5
+ lineWidth: 3,
6
+ clearText: '清空',
7
+ revokeText: '撤销',
8
+ restoreText: '恢复',
9
+ confirmText: '确认',
10
+ fileType: 'png',
11
11
  quality: 1,
12
12
  exportScale: 1,
13
13
  disabled: false,
14
14
  height: 1,
15
15
  width: 1,
16
- round: "10rpx",
17
- backgroundColor: "",
16
+ round: '10rpx',
17
+ backgroundColor: '',
18
18
  disableScroll: true,
19
19
  enableHistory: false,
20
20
  step: 1,
21
- undoText: "",
22
- redoText: "",
21
+ undoText: '',
22
+ redoText: '',
23
23
  pressure: false,
24
24
  minWidth: 2,
25
25
  maxWidth: 6,
26
26
  minSpeed: 1.5,
27
- };
27
+ }
28
28
 
29
- export default defaultProps;
29
+ export default defaultProps
@@ -58,9 +58,9 @@
58
58
  z-index: -1;
59
59
 
60
60
  &--hover {
61
- background-color: $hy-text-color-hover;
61
+ background-color: $hy-text-color--hover;
62
62
  }
63
63
  }
64
64
  }
65
65
  }
66
- }
66
+ }
@@ -0,0 +1,5 @@
1
+ $namespace: 'hy' !default;
2
+ $common-separator: '-' !default;
3
+ $element-separator: '__' !default;
4
+ $modifier-separator: '--' !default;
5
+ $state-prefix: 'is-' !default;
@@ -0,0 +1,89 @@
1
+ /**
2
+ * 辅助函数
3
+ */
4
+ @import 'config';
5
+ $default-theme: #4d80f0 !default; // 正常色
6
+
7
+ /* 转换成字符串 */
8
+ @function selectorToString($selector) {
9
+ $selector: inspect($selector);
10
+ $selector: str-slice($selector, 2, -2);
11
+
12
+ @return $selector;
13
+ }
14
+
15
+ /* 判断是否存在 Modifier */
16
+ @function containsModifier($selector) {
17
+ $selector: selectorToString($selector);
18
+
19
+ @if str-index($selector, $modifierSeparator) {
20
+ @return true;
21
+ }
22
+
23
+ @else {
24
+ @return false;
25
+ }
26
+ }
27
+
28
+ /* 判断是否存在伪类 */
29
+ @function containsPseudo($selector) {
30
+ $selector: selectorToString($selector);
31
+
32
+ @if str-index($selector, ':') {
33
+ @return true;
34
+ }
35
+
36
+ @else {
37
+ @return false;
38
+ }
39
+ }
40
+
41
+
42
+ /**
43
+ * 主题色切换
44
+ * @params $theme-color 主题色
45
+ * @params $type 变暗’dark‘ 变亮 'light'
46
+ * @params $mix-color 自己设置的混色
47
+ */
48
+ @function themeColor($theme-color, $type: "", $mix-color: "") {
49
+ @if $default-theme !=#4d80f0 {
50
+ @if $type=="dark" {
51
+ @return darken($theme-color, 10%);
52
+ }
53
+
54
+ @else if $type=="light" {
55
+ @return lighten($theme-color, 10%);
56
+ }
57
+
58
+ @else {
59
+ @return $theme-color;
60
+ }
61
+ }
62
+
63
+ @else {
64
+ @return $mix-color;
65
+ }
66
+ }
67
+
68
+ /**
69
+ * 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
70
+ * @params $open-linear 是否开启线性渐变色
71
+ * @params $deg 渐变色角度
72
+ * @params $theme-color 当前配色
73
+ * @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
74
+ * @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
75
+ * @params [Array] $per-list 渐变色比例
76
+ */
77
+ @function resultColor($deg, $theme-color, $set, $color-list, $per-list) {
78
+ // 开启渐变
79
+
80
+ $len: length($color-list);
81
+ $arg: $deg;
82
+
83
+ @for $i from 1 through $len {
84
+ $arg: $arg + ","+ themeColor($theme-color, nth($set, $i), nth($color-list, $i)) + " "+ nth($per-list, $i);
85
+ }
86
+
87
+ @return linear-gradient(unquote($arg));
88
+
89
+ }
@@ -1,9 +1,7 @@
1
1
  @use "../../theme.scss";
2
- $namespace: 'hy' !default;
3
- $common-separator: '-' !default;
4
- $element-separator: '__' !default;
5
- $modifier-separator: '--' !default;
6
- $state-prefix: 'is-' !default;
2
+ @import "config";
3
+ @import "function";
4
+
7
5
 
8
6
  @mixin b($block) {
9
7
  $B: $namespace + '-' + $block !global;
@@ -31,36 +29,75 @@ $state-prefix: 'is-' !default;
31
29
  }
32
30
  }
33
31
 
34
- @mixin e($element) {
35
- $E: $element !global;
32
+ /* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
33
+ @mixin e($element...) {
36
34
  $selector: &;
37
- $currentSelector: '';
38
- @each $unit in $element {
39
- $currentSelector: #{$currentSelector +
40
- '.' +
41
- $B +
42
- $element-separator +
43
- $unit +
44
- ','};
45
- }
35
+ $selectors: "";
36
+
37
+ @if containsPseudo($selector) {
38
+ @each $item in $element {
39
+ $selectors: #{$selectors + "." + $B + $element-separator + $item + ","};
40
+ }
46
41
 
47
- @if hitAllSpecialNestRule($selector) {
48
42
  @at-root {
49
43
  #{$selector} {
50
- #{$currentSelector} {
44
+ #{$selectors} {
51
45
  @content;
52
46
  }
53
47
  }
54
48
  }
55
- } @else {
49
+ }
50
+
51
+ @else {
52
+ @each $item in $element {
53
+ $selectors: #{$selectors + $selector + $element-separator + $item + ","};
54
+ }
55
+
56
56
  @at-root {
57
- #{$currentSelector} {
57
+ #{$selectors} {
58
58
  @content;
59
59
  }
60
60
  }
61
61
  }
62
62
  }
63
63
 
64
+
65
+ /* 定义元素(e),对于伪类,会自动将 e 嵌套在 伪类 底下 */
66
+ @mixin edeep($element...) {
67
+ $selector: &;
68
+ $selectors: "";
69
+
70
+ @if containsPseudo($selector) {
71
+ @each $item in $element {
72
+ $selectors: #{$selectors + "." + $B + $element-separator + $item + ","};
73
+ }
74
+
75
+ @at-root {
76
+ #{$selector} {
77
+ :deep() {
78
+ #{$selectors} {
79
+ @content;
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+
86
+ @else {
87
+ @each $item in $element {
88
+ $selectors: #{$selectors + $selector + $element-separator + $item + ","};
89
+ }
90
+
91
+ @at-root {
92
+ :deep() {
93
+ #{$selectors} {
94
+ @content;
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+
64
101
  /* 状态,生成 is-$state 类名 */
65
102
  @mixin is($states...) {
66
103
  @at-root {
@@ -135,4 +172,4 @@ $state-prefix: 'is-' !default;
135
172
  -webkit-line-clamp: $lineNumber;
136
173
  overflow: hidden;
137
174
  text-overflow: ellipsis;
138
- }
175
+ }
package/libs/css/vars.css CHANGED
@@ -19,6 +19,7 @@
19
19
  --hy-background--empty: #F3F3F3;
20
20
  --hy-background--hover: rgba(0,0,0,0.05);
21
21
  --hy-background--active: #FFFFFF;
22
+ --hy-background--close: #f0f0f0;
22
23
 
23
24
  --hy-border-line: 1rpx solid #c2c2c4;
24
25
  --hy-border-color: #c2c2c4;
@@ -50,8 +51,9 @@
50
51
  --hy-background--empty: #3A3A44;
51
52
  --hy-background--hover: rgba(255,255,255,0.2);
52
53
  --hy-background--active: #000000;
54
+ --hy-background--close: #323233;
53
55
 
54
56
  --hy-border-line: 1rpx solid #3c3f44;
55
57
  --hy-border-color: #3c3f44;
56
58
  --hy-border-color--2: #FFFFFF;
57
- }
59
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hy-app",
3
- "version": "0.2.5",
4
- "description": "修复在微信小程序线上bug",
3
+ "version": "0.2.6",
4
+ "description": "修改模态框样式、加了摇一摇功能",
5
5
  "main": "./index.ts",
6
6
  "private": false,
7
7
  "scripts": {},