cbvirtua 1.0.6 → 1.0.8

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 (86) hide show
  1. package/asy.js +32 -0
  2. package/package.json +1 -1
  3. package/style/basic.less +69 -0
  4. package/style/index.less +125 -0
  5. package/style/index.tsx +2 -0
  6. package/style/mixin.less +53 -0
  7. package/style/rtl.less +68 -0
  8. package/v2/App.vue +0 -56
  9. package/v2/components/Dropdown.vue +0 -28
  10. package/v2/components/Menu.vue +0 -9
  11. package/v2/components/Popper.js +0 -1011
  12. package/v2/components/PopperContent.vue +0 -270
  13. package/v2/components/PopperMethods.js +0 -17
  14. package/v2/components/PopperWrapper.vue +0 -101
  15. package/v2/components/ResizeObserver.vue +0 -151
  16. package/v2/components/ThemeClass.js +0 -9
  17. package/v2/components/Tooltip.vue +0 -22
  18. package/v2/components/TooltipDirective.vue +0 -171
  19. package/v2/config.js +0 -133
  20. package/v2/directives/v-close-popper.js +0 -67
  21. package/v2/directives/v-tooltip.js +0 -116
  22. package/v2/floating-ui/core/computeCoordsFromPlacement.js +0 -39
  23. package/v2/floating-ui/core/computePosition.js +0 -52
  24. package/v2/floating-ui/core/detectOverflow.js +0 -36
  25. package/v2/floating-ui/core/enums.js +0 -7
  26. package/v2/floating-ui/core/index.js +0 -11
  27. package/v2/floating-ui/core/middleware/arrow.js +0 -52
  28. package/v2/floating-ui/core/middleware/autoPlacement.js +0 -84
  29. package/v2/floating-ui/core/middleware/flip.js +0 -82
  30. package/v2/floating-ui/core/middleware/hide.js +0 -36
  31. package/v2/floating-ui/core/middleware/inline.js +0 -100
  32. package/v2/floating-ui/core/middleware/offset.js +0 -26
  33. package/v2/floating-ui/core/middleware/shift.js +0 -99
  34. package/v2/floating-ui/core/middleware/size.js +0 -58
  35. package/v2/floating-ui/core/types.js +0 -11
  36. package/v2/floating-ui/core/utils/expandPaddingObject.js +0 -3
  37. package/v2/floating-ui/core/utils/getAlignment.js +0 -3
  38. package/v2/floating-ui/core/utils/getAlignmentSides.js +0 -23
  39. package/v2/floating-ui/core/utils/getBasePlacement.js +0 -3
  40. package/v2/floating-ui/core/utils/getCrossAxis.js +0 -3
  41. package/v2/floating-ui/core/utils/getExpandedPlacements.js +0 -10
  42. package/v2/floating-ui/core/utils/getLengthFromAxis.js +0 -3
  43. package/v2/floating-ui/core/utils/getMainAxisFromPlacement.js +0 -4
  44. package/v2/floating-ui/core/utils/getOppositeAlignmentPlacement.js +0 -4
  45. package/v2/floating-ui/core/utils/getOppositePlacement.js +0 -4
  46. package/v2/floating-ui/core/utils/getPaddingObject.js +0 -6
  47. package/v2/floating-ui/core/utils/math.js +0 -2
  48. package/v2/floating-ui/core/utils/rectToClientRect.js +0 -9
  49. package/v2/floating-ui/core/utils/within.js +0 -4
  50. package/v2/floating-ui/dom/index.js +0 -5
  51. package/v2/floating-ui/dom/platform.js +0 -20
  52. package/v2/floating-ui/dom/utils/contains.js +0 -22
  53. package/v2/floating-ui/dom/utils/convertOffsetParentRelativeRectToViewportRelativeRect.js +0 -35
  54. package/v2/floating-ui/dom/utils/getBoundingClientRect.js +0 -27
  55. package/v2/floating-ui/dom/utils/getClippingClientRect.js +0 -76
  56. package/v2/floating-ui/dom/utils/getComputedStyle.js +0 -4
  57. package/v2/floating-ui/dom/utils/getDimensions.js +0 -6
  58. package/v2/floating-ui/dom/utils/getDocumentElement.js +0 -4
  59. package/v2/floating-ui/dom/utils/getDocumentRect.js +0 -21
  60. package/v2/floating-ui/dom/utils/getNodeName.js +0 -4
  61. package/v2/floating-ui/dom/utils/getNodeScroll.js +0 -13
  62. package/v2/floating-ui/dom/utils/getOffsetParent.js +0 -43
  63. package/v2/floating-ui/dom/utils/getParentNode.js +0 -16
  64. package/v2/floating-ui/dom/utils/getRectRelativeToOffsetParent.js +0 -40
  65. package/v2/floating-ui/dom/utils/getScrollParent.js +0 -13
  66. package/v2/floating-ui/dom/utils/getScrollParents.js +0 -18
  67. package/v2/floating-ui/dom/utils/getViewportRect.js +0 -25
  68. package/v2/floating-ui/dom/utils/getWindowScrollBarX.js +0 -9
  69. package/v2/floating-ui/dom/utils/is.js +0 -38
  70. package/v2/floating-ui/dom/utils/math.js +0 -3
  71. package/v2/floating-ui/dom/utils/window.js +0 -13
  72. package/v2/index.js +0 -75
  73. package/v2/util/assign-deep.js +0 -12
  74. package/v2/util/env.js +0 -18
  75. package/v2/util/events.js +0 -12
  76. package/v2/util/frame.js +0 -5
  77. package/v2/util/lang.js +0 -6
  78. package/v2/util/popper.js +0 -5
  79. package/vue/ListItem.js +0 -44
  80. package/vue/ListItem.tsx +0 -64
  81. package/vue/VList.js +0 -133
  82. package/vue/VList.tsx +0 -291
  83. package/vue/ec.css +0 -48
  84. package/vue/ec.js +0 -78
  85. package/vue/index.js +0 -4
  86. package/vue/l.less +0 -69
package/asy.js ADDED
@@ -0,0 +1,32 @@
1
+ async function asyncTaskWithCb(cb) {
2
+ let err, user, savedTask, notification;
3
+
4
+ [ err, user ] = await to(UserModel.findById(1));
5
+ if(!user) return cb('No user found');
6
+
7
+ [ err, savedTask ] = await to(TaskModel({userId: user.id, name: 'Demo Task'}));
8
+ if(err) return cb('Error occurred while saving task');
9
+
10
+ if(user.notificationsEnabled) {
11
+ [ err ] = await to(NotificationService.sendNotification(user.id, 'Task Created'));
12
+ if(err) return cb('Error while sending notification');
13
+ }
14
+
15
+ if(savedTask.assignedUser.id !== user.id) {
16
+ [ err, notification ] = await to(NotificationService.sendNotification(savedTask.assignedUser.id, 'Task was created for you'));
17
+ if(err) return cb('Error while sending notification');
18
+ }
19
+
20
+ cb(null, savedTask);
21
+ }
22
+
23
+ function to(promise, errorExt) {
24
+ return promise
25
+ .then(function (data) { return [null, data]; }) // 执行成功,返回数组第一项为 null。第二个是结果。
26
+ .catch(function (err) {
27
+ if (errorExt) {
28
+ Object.assign(err, errorExt);
29
+ }
30
+ return [err, undefined]; // 执行失败,返回数组第一项为错误信息,第二项为 undefined
31
+ });
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cbvirtua",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,69 @@
1
+ @sides: {
2
+ top: bottom;
3
+ bottom: top;
4
+ left: right;
5
+ right: left;
6
+ }
7
+ @N: .van-popper;
8
+ @{N} {
9
+ --van-arrow-size: 10px;
10
+ --van-popper-content-bg: #fff;
11
+ --van-popper-border: 1px solid #ebedf0;
12
+ border-radius: 4px;
13
+ color: #000;
14
+ background-color: var(--van-popper-content-bg);
15
+ padding: 10px 12px;
16
+ border: var(--van-popper-border);
17
+ position: absolute;
18
+ white-space: nowrap;
19
+ transition: opacity .3s;
20
+ font-size: 13px;
21
+ z-index: 1000;
22
+ width: max-content;
23
+
24
+ &__arrow {
25
+ position: absolute;
26
+ width: 10px;
27
+ height: 10px;
28
+ background: var(--van-popper-content-bg);
29
+ transform: rotate(45deg);
30
+ }
31
+
32
+ each(@sides, {
33
+ &[data-side^='@{value}'] {
34
+ @{N}__arrow {
35
+ @{key}: -5px;
36
+ }
37
+ @{N}__arrow {
38
+ border-@{key}: var(--van-popper-border);
39
+ }
40
+ @{N}__arrow when (@value =top) {
41
+ border-right: var(--van-popper-border);
42
+ }
43
+ @{N}__arrow when (@value =bottom) {
44
+ border-left: var(--van-popper-border);
45
+ }
46
+ @{N}__arrow when (@value =left) {
47
+ border-top: var(--van-popper-border);
48
+ }
49
+ @{N}__arrow when (@value =right) {
50
+ border-bottom: var(--van-popper-border);
51
+ }
52
+ }
53
+ });
54
+
55
+ &.is-dark {
56
+ --van-popper-content-bg: #000;
57
+ color: #fff;
58
+ border: none;
59
+
60
+ @{N}__arrow {
61
+ border-color: transparent;
62
+ }
63
+ }
64
+ }
65
+
66
+ .van-popper-fade-enter-from,
67
+ .van-popper-fade-leave-to {
68
+ opacity: 0;
69
+ }
@@ -0,0 +1,125 @@
1
+ @import '../../style/themes/index';
2
+ @import '../../style/mixins/index';
3
+ @import './mixin';
4
+
5
+ @row-prefix-cls: ~'@{ant-prefix}-row';
6
+ @col-prefix-cls: ~'@{ant-prefix}-col';
7
+
8
+ // Grid system
9
+ .@{row-prefix-cls} {
10
+ display: flex;
11
+ flex-flow: row wrap;
12
+
13
+ &::before,
14
+ &::after {
15
+ display: flex;
16
+ }
17
+
18
+ // No wrap of flex
19
+ &-no-wrap {
20
+ flex-wrap: nowrap;
21
+ }
22
+ }
23
+
24
+ // x轴原点
25
+ .@{row-prefix-cls}-start {
26
+ justify-content: flex-start;
27
+ }
28
+
29
+ // x轴居中
30
+ .@{row-prefix-cls}-center {
31
+ justify-content: center;
32
+ }
33
+
34
+ // x轴反方向
35
+ .@{row-prefix-cls}-end {
36
+ justify-content: flex-end;
37
+ }
38
+
39
+ // x轴平分
40
+ .@{row-prefix-cls}-space-between {
41
+ justify-content: space-between;
42
+ }
43
+
44
+ // x轴有间隔地平分
45
+ .@{row-prefix-cls}-space-around {
46
+ justify-content: space-around;
47
+ }
48
+
49
+ // 顶部对齐
50
+ .@{row-prefix-cls}-top {
51
+ align-items: flex-start;
52
+ }
53
+
54
+ // 居中对齐
55
+ .@{row-prefix-cls}-middle {
56
+ align-items: center;
57
+ }
58
+
59
+ // 底部对齐
60
+ .@{row-prefix-cls}-bottom {
61
+ align-items: flex-end;
62
+ }
63
+
64
+ .@{col-prefix-cls} {
65
+ position: relative;
66
+ max-width: 100%;
67
+ // Prevent columns from collapsing when empty
68
+ min-height: 1px;
69
+ }
70
+
71
+ .make-grid();
72
+
73
+ // Extra small grid
74
+ //
75
+ // Columns, offsets, pushes, and pulls for extra small devices like
76
+ // smartphones.
77
+
78
+ .make-grid(-xs);
79
+
80
+ // Small grid
81
+ //
82
+ // Columns, offsets, pushes, and pulls for the small device range, from phones
83
+ // to tablets.
84
+
85
+ @media (min-width: @screen-sm-min) {
86
+ .make-grid(-sm);
87
+ }
88
+
89
+ // Medium grid
90
+ //
91
+ // Columns, offsets, pushes, and pulls for the desktop device range.
92
+
93
+ @media (min-width: @screen-md-min) {
94
+ .make-grid(-md);
95
+ }
96
+
97
+ // Large grid
98
+ //
99
+ // Columns, offsets, pushes, and pulls for the large desktop device range.
100
+
101
+ @media (min-width: @screen-lg-min) {
102
+ .make-grid(-lg);
103
+ }
104
+
105
+ // Extra Large grid
106
+ //
107
+ // Columns, offsets, pushes, and pulls for the full hd device range.
108
+
109
+ @media (min-width: @screen-xl-min) {
110
+ .make-grid(-xl);
111
+ }
112
+
113
+ // Extra Extra Large grid
114
+ //
115
+ // Columns, offsets, pushes, and pulls for the full hd device range.
116
+
117
+ @media (min-width: @screen-xxl-min) {
118
+ .make-grid(-xxl);
119
+ }
120
+
121
+ @media (min-width: @screen-xxxl-min) {
122
+ .make-grid(-xxxl);
123
+ }
124
+
125
+ @import './rtl';
@@ -0,0 +1,2 @@
1
+ import '../../style/index.less';
2
+ import './index.less';
@@ -0,0 +1,53 @@
1
+ @import '../../style/mixins/index';
2
+
3
+ // mixins for grid system
4
+ // ------------------------
5
+
6
+ .loop-grid-columns(@index, @class) when (@index > 0) {
7
+ .@{ant-prefix}-col@{class}-@{index} {
8
+ display: block;
9
+ flex: 0 0 percentage((@index / @grid-columns));
10
+ max-width: percentage((@index / @grid-columns));
11
+ }
12
+ .@{ant-prefix}-col@{class}-push-@{index} {
13
+ left: percentage((@index / @grid-columns));
14
+ }
15
+ .@{ant-prefix}-col@{class}-pull-@{index} {
16
+ right: percentage((@index / @grid-columns));
17
+ }
18
+ .@{ant-prefix}-col@{class}-offset-@{index} {
19
+ margin-left: percentage((@index / @grid-columns));
20
+ }
21
+ .@{ant-prefix}-col@{class}-order-@{index} {
22
+ order: @index;
23
+ }
24
+ .loop-grid-columns((@index - 1), @class);
25
+ }
26
+
27
+ .loop-grid-columns(@index, @class) when (@index = 0) {
28
+ .@{ant-prefix}-col@{class}-@{index} {
29
+ display: none;
30
+ }
31
+ .@{ant-prefix}-col-push-@{index} {
32
+ left: auto;
33
+ }
34
+ .@{ant-prefix}-col-pull-@{index} {
35
+ right: auto;
36
+ }
37
+ .@{ant-prefix}-col@{class}-push-@{index} {
38
+ left: auto;
39
+ }
40
+ .@{ant-prefix}-col@{class}-pull-@{index} {
41
+ right: auto;
42
+ }
43
+ .@{ant-prefix}-col@{class}-offset-@{index} {
44
+ margin-left: 0;
45
+ }
46
+ .@{ant-prefix}-col@{class}-order-@{index} {
47
+ order: 0;
48
+ }
49
+ }
50
+
51
+ .make-grid(@class: ~'') {
52
+ .loop-grid-columns(@grid-columns, @class);
53
+ }
package/style/rtl.less ADDED
@@ -0,0 +1,68 @@
1
+ @import '../../style/themes/index';
2
+ @import '../../style/mixins/index';
3
+
4
+ .@{ant-prefix}-row {
5
+ &-rtl {
6
+ direction: rtl;
7
+ }
8
+ }
9
+
10
+ // mixin
11
+ .loop-grid-columns(@index, @class) when (@index > 0) {
12
+ .@{ant-prefix}-col@{class}-push-@{index} {
13
+ // reset property in RTL direction
14
+ &.@{ant-prefix}-col-rtl {
15
+ right: percentage((@index / @grid-columns));
16
+ left: auto;
17
+ }
18
+ }
19
+
20
+ .@{ant-prefix}-col@{class}-pull-@{index} {
21
+ // reset property in RTL direction
22
+ &.@{ant-prefix}-col-rtl {
23
+ right: auto;
24
+ left: percentage((@index / @grid-columns));
25
+ }
26
+ }
27
+
28
+ .@{ant-prefix}-col@{class}-offset-@{index} {
29
+ // reset property in RTL direction
30
+ &.@{ant-prefix}-col-rtl {
31
+ margin-right: percentage((@index / @grid-columns));
32
+ margin-left: 0;
33
+ }
34
+ }
35
+ }
36
+
37
+ .loop-grid-columns(@index, @class) when (@index = 0) {
38
+ .@{ant-prefix}-col-push-@{index} {
39
+ // reset property in RTL direction
40
+ &.@{ant-prefix}-col-rtl {
41
+ right: auto;
42
+ }
43
+ }
44
+
45
+ .@{ant-prefix}-col-pull-@{index} {
46
+ &.@{ant-prefix}-col-rtl {
47
+ left: auto;
48
+ }
49
+ }
50
+
51
+ .@{ant-prefix}-col@{class}-push-@{index} {
52
+ &.@{ant-prefix}-col-rtl {
53
+ right: auto;
54
+ }
55
+ }
56
+
57
+ .@{ant-prefix}-col@{class}-pull-@{index} {
58
+ &.@{ant-prefix}-col-rtl {
59
+ left: auto;
60
+ }
61
+ }
62
+
63
+ .@{ant-prefix}-col@{class}-offset-@{index} {
64
+ &.@{ant-prefix}-col-rtl {
65
+ margin-right: 0;
66
+ }
67
+ }
68
+ }
package/v2/App.vue DELETED
@@ -1,56 +0,0 @@
1
- <template>
2
- <div id="app">
3
- <Dropdown :distance="6">
4
- <button>Click me</button>
5
- <template #popper>
6
- <button v-close-popper="myBooleanProp" @click="hide">Close</button>
7
- </template>
8
- </Dropdown>
9
-
10
- </div>
11
- </template>
12
-
13
- <script>
14
- import {
15
- // Directives
16
- vTooltip,
17
- VClosePopper,
18
- // Components
19
- Dropdown,
20
- Tooltip,
21
- Menu
22
- } from './components/v2'
23
- console.log(VClosePopper)
24
- export default {
25
- name: 'App',
26
- data() {
27
- return {
28
- myBooleanProp: true
29
- }
30
- },
31
- directives: {
32
- 'close-popper': VClosePopper
33
- },
34
- components: {
35
- Dropdown
36
- },
37
- methods: {
38
- hide() {
39
- console.log(123)
40
- this.myBooleanProp = true
41
- console.log(this.myBooleanProp)
42
- }
43
- }
44
- }
45
- </script>
46
-
47
- <style>
48
- #app {
49
- font-family: Avenir, Helvetica, Arial, sans-serif;
50
- -webkit-font-smoothing: antialiased;
51
- -moz-osx-font-smoothing: grayscale;
52
- text-align: center;
53
- color: #2c3e50;
54
- margin-top: 60px;
55
- }
56
- </style>
@@ -1,28 +0,0 @@
1
- <script lang="ts">
2
- import PopperWrapper from './PopperWrapper.vue'
3
-
4
- export default {
5
- ...PopperWrapper,
6
- name: 'VDropdown',
7
- vPopperTheme: 'dropdown',
8
- }
9
- </script>
10
-
11
- <style>
12
- .v-popper--theme-dropdown .v-popper__inner {
13
- background: #fff;
14
- color: black;
15
- border-radius: 6px;
16
- border: 1px solid #ddd;
17
- box-shadow: 0 6px 30px rgba(0, 0, 0, .1);
18
- }
19
-
20
- .v-popper--theme-dropdown .v-popper__arrow-inner {
21
- visibility: visible;
22
- border-color: #fff;
23
- }
24
-
25
- .v-popper--theme-dropdown .v-popper__arrow-outer {
26
- border-color: #ddd;
27
- }
28
- </style>
@@ -1,9 +0,0 @@
1
- <script lang="ts">
2
- import PopperWrapper from './PopperWrapper.vue'
3
-
4
- export default {
5
- ...PopperWrapper,
6
- name: 'VMenu',
7
- vPopperTheme: 'menu',
8
- }
9
- </script>