@we-debug/miniprogram 0.17.3 → 0.18.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.18.0](https://github.com/dlhandsome/we-debug/compare/v0.17.3...v0.18.0) (2023-08-18)
7
+
8
+ **Note:** Version bump only for package @we-debug/miniprogram
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.17.3](https://github.com/dlhandsome/we-debug/compare/v0.17.2...v0.17.3) (2022-03-02)
7
15
 
8
16
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _exportNames={},_core=(exports.default=void 0,_interopRequireWildcard(require("@we-debug/core")));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e){return e?t:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};r=_getRequireWildcardCache(r);if(r&&r.has(e))return r.get(e);var t,o,n={},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&((o=u?Object.getOwnPropertyDescriptor(e,t):null)&&(o.get||o.set)?Object.defineProperty(n,t,o):n[t]=e[t]);return n.default=e,r&&r.set(e,n),n}Object.keys(_core).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_core[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _core[e]}})});var _default=_core.default;exports.default=_default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _exportNames={};exports.default=void 0;var _core=_interopRequireWildcard(require("@we-debug/core"));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e){return e?t:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};r=_getRequireWildcardCache(r);if(r&&r.has(e))return r.get(e);var t,o,n={},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&((o=u?Object.getOwnPropertyDescriptor(e,t):null)&&(o.get||o.set)?Object.defineProperty(n,t,o):n[t]=e[t]);return n.default=e,r&&r.set(e,n),n}Object.keys(_core).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_core[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _core[e]}}))});var _default=_core.default;exports.default=_default;
@@ -0,0 +1,77 @@
1
+ @import "./_variable.less";
2
+
3
+ .@{prefix}-ui-check {
4
+ position: fixed;
5
+ z-index: @zindex-ui-check;
6
+
7
+ &__operation-bar {
8
+ display: flex;
9
+ position: fixed;
10
+ justify-content: space-between;
11
+ left: 20rpx;
12
+ width: 710rpx;
13
+ height: 196rpx;
14
+ padding: 0 @padding-sm;
15
+ box-sizing: border-box;
16
+ background-color: fade(#000, 85%);
17
+ align-items: center;
18
+ border-radius: @border-radius-md;
19
+ }
20
+
21
+ &__operation-bar-hd {
22
+ display: flex;
23
+ flex-direction: column;
24
+ justify-content: space-between;
25
+ width: 500rpx;
26
+ height: 160rpx;
27
+ align-items: left;
28
+ }
29
+
30
+ &__hd-title {
31
+ color: fade(@white, 50%);
32
+ padding-top: @border-radius-md;
33
+ padding-left: @border-radius-md;
34
+ }
35
+
36
+ &__hd-slider {
37
+ width: 100%;
38
+ }
39
+
40
+ &__operation-bar-ft {
41
+ display: flex;
42
+ flex-direction: column;
43
+ justify-content: space-between;
44
+ height: 160rpx;
45
+ align-items: center;
46
+ }
47
+
48
+ &__ft-btn {
49
+ display: flex;
50
+ justify-content: center;
51
+ align-items: center;
52
+ width: 72rpx;
53
+ height: 72rpx;
54
+ border-radius: 72rpx;
55
+ background-color: fade(#fff, 9%);
56
+
57
+ &.active{
58
+ opacity: @active-opacity;
59
+ }
60
+
61
+ .triangle {
62
+ width: 16rpx;
63
+ height: 28rpx;
64
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAABABAMAAACEvhjaAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAVUExURUdwTMzMzP///83NzdjY2M/Pz8zMzF/cqpMAAAAGdFJOUwCmA8UNSje3QCEAAABFSURBVDjLY2BgCFRgQAesaUIYYmFpiQoYytIwFDIDxdAVsphhUeg8qnBUoRBhMSx6R5WNDGXYyhJsZQ62sglrGYZZ1gEA+XNnGTClJnIAAAAASUVORK5CYII=');
65
+ background-repeat: no-repeat;
66
+ background-size: 16rpx 28rpx;
67
+
68
+ &.up {
69
+ transform: rotate(-90deg)
70
+ }
71
+
72
+ &.down {
73
+ transform: rotate(90deg)
74
+ }
75
+ }
76
+ }
77
+ }
@@ -0,0 +1,202 @@
1
+ import { Debug, prefix, closeBadge, MoveAreaHelper } from '@we-debug/plugin-ui-check';
2
+
3
+ let _timer;
4
+ let _pixelTimer;
5
+ let _y = 0;
6
+ let _maHelper;
7
+ // 滑块容器的头尾预留高度
8
+ const reservedDistance = 150;
9
+
10
+ Component({
11
+ properties: {},
12
+ data: {
13
+ safeArea: null,
14
+ url: '',
15
+ moveArea: {
16
+ // 滑块容器的头尾预留高度
17
+ reservedDistance,
18
+ top: 0,
19
+ left: 0,
20
+ width: 0,
21
+ height: 0
22
+ },
23
+ moveView: {
24
+ y: _y,
25
+ width: 0,
26
+ height: 0,
27
+ opacity: 0.3,
28
+ direction: 'vertical'
29
+ },
30
+ operationBar: {
31
+ visible: false,
32
+ slider: {
33
+ min: 0,
34
+ max: 100,
35
+ blockColor: 'rgba(255,255,255,0.09)',
36
+ activeColor: '#ffffff',
37
+ backgroundColor: 'rgba(255,255,255,0.25)'
38
+ }
39
+ }
40
+ },
41
+ methods: {
42
+ badges({ show = false } = {}) {
43
+ const badges = Debug.getBadge();
44
+ badges
45
+ .filter(badge => badge !== closeBadge)
46
+ .forEach(badge => {
47
+ badge.emit({ show });
48
+ });
49
+ },
50
+ closeBadge({ show = false } = {}) {
51
+ closeBadge.emit({ show });
52
+ },
53
+ getMaHelper() {
54
+ if (!_maHelper) {
55
+ _maHelper = new MoveAreaHelper(Debug);
56
+ }
57
+ return _maHelper;
58
+ },
59
+ initSafeArea() {
60
+ const maHelper = this.getMaHelper();
61
+ const { safeArea } = maHelper.systemInfo;
62
+
63
+ this.setData({ safeArea });
64
+ },
65
+ initMoveArea() {
66
+ const maHelper = this.getMaHelper();
67
+
68
+ this.setData({
69
+ // 滑块容器的头尾预留高度
70
+ reservedDistance,
71
+ top: maHelper.getTop(reservedDistance),
72
+ left: maHelper.getLeft(),
73
+ width: maHelper.getWidth(),
74
+ height: maHelper.getHeight(reservedDistance)
75
+ });
76
+ },
77
+ imgLoad(e) {
78
+ const maHelper = this.getMaHelper();
79
+
80
+ const { width, height } = e.detail;
81
+ const safeAreaWidth = this.data.safeArea.width;
82
+ const ratio = safeAreaWidth / width;
83
+ const moveViewHeight = height * ratio;
84
+
85
+ const deltaHeight = moveViewHeight - maHelper.systemInfo.windowHeight;
86
+ const newReservedDistance = deltaHeight > reservedDistance ? deltaHeight : reservedDistance;
87
+
88
+ this.setData({
89
+ 'moveView.width': safeAreaWidth,
90
+ 'moveView.height': moveViewHeight,
91
+ 'moveArea.top': maHelper.getTop(newReservedDistance),
92
+ 'moveArea.height': maHelper.getHeight(newReservedDistance)
93
+ });
94
+ },
95
+ removeImg() {
96
+ this.setData({ url: '' });
97
+ },
98
+ addImg(url) {
99
+ this.setData({ url });
100
+ },
101
+ slideChanging(e) {
102
+ const opacity = e.detail.value;
103
+ this.setData({
104
+ 'moveView.opacity': opacity / 100
105
+ });
106
+ this.toggleOperationBar({ immediate: false });
107
+ },
108
+ showOperationBar() {
109
+ this.setData({
110
+ 'operationBar.visible': true
111
+ });
112
+ },
113
+ hideOperationBar() {
114
+ this.setData({
115
+ 'operationBar.visible': false
116
+ });
117
+ },
118
+ moveViewChange(e) {
119
+ // 更新偏移量
120
+ _y = e.detail.y;
121
+ },
122
+ toggleOperationBar({ immediate = true } = {}) {
123
+ if (!this.data.operationBar.visible) {
124
+ this.showOperationBar();
125
+ } else {
126
+ immediate && this.hideOperationBar();
127
+ }
128
+ clearTimeout(_timer);
129
+ _timer = setTimeout(() => {
130
+ this.hideOperationBar();
131
+ }, 5000);
132
+ },
133
+ moveViewRising() {
134
+ clearTimeout(_pixelTimer);
135
+ this.setData({
136
+ 'moveView.y': --_y
137
+ });
138
+ this.toggleOperationBar({ immediate: false });
139
+ // 60fps
140
+ _pixelTimer = setTimeout(() => {
141
+ this.moveViewRising();
142
+ }, 16);
143
+ },
144
+ moveViewFalling() {
145
+ clearTimeout(_pixelTimer);
146
+ this.setData({
147
+ 'moveView.y': ++_y
148
+ });
149
+ this.toggleOperationBar({ immediate: false });
150
+ // 60fps
151
+ _pixelTimer = setTimeout(() => {
152
+ this.moveViewFalling();
153
+ }, 16);
154
+ },
155
+ increaseTouchstart() {
156
+ this.moveViewRising();
157
+ },
158
+ increaseTouchend() {
159
+ clearTimeout(_pixelTimer);
160
+ },
161
+ decreaseTouchstart() {
162
+ this.moveViewFalling();
163
+ },
164
+ decreaseTouchend() {
165
+ clearTimeout(_pixelTimer);
166
+ },
167
+ init(url) {
168
+ this.initSafeArea();
169
+ this.initMoveArea();
170
+ this.addImg(url);
171
+ this.badges({ show: false });
172
+ this.closeBadge({ show: true });
173
+ Debug.store.event.emit('debug:mask:hide-modal');
174
+ },
175
+ destory() {
176
+ this.removeImg();
177
+ this.badges({ show: true });
178
+ this.closeBadge({ show: false });
179
+ },
180
+ addListeners() {
181
+ if (Debug) {
182
+ Debug.store.event.on(prefix + 'init', this.init.bind(this));
183
+ Debug.store.event.on(prefix + 'destory', this.destory.bind(this));
184
+ } else {
185
+ console.warn(`[we-debug]: please init before component attached`);
186
+ }
187
+ },
188
+
189
+ removeListeners() {
190
+ if (Debug) {
191
+ Debug.store.event.off(prefix + 'init', this.init.bind(this));
192
+ Debug.store.event.off(prefix + 'destory', this.destory.bind(this));
193
+ }
194
+ }
195
+ },
196
+ attached() {
197
+ this.addListeners();
198
+ },
199
+ detached() {
200
+ this.removeListeners();
201
+ }
202
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1 @@
1
+ @import '../less/ui-check.less';
@@ -0,0 +1,42 @@
1
+ <movable-area class="w-ui-check" wx:if="{{url}}" style="top: {{moveArea.top}}px; left: {{moveArea.left}}px; width: {{moveArea.width}}px; height: {{moveArea.height}}px;">
2
+ <movable-view direction="{{moveView.direction}}"
3
+ y="{{moveView.y}}"
4
+ animation="{{false}}"
5
+ out-of-bounds="{{true}}"
6
+ inertia="{{true}}"
7
+ bindchange="moveViewChange"
8
+ bindtap="toggleOperationBar"
9
+ style="width: {{moveView.width}}px; height: {{moveView.height}}px;">
10
+ <image src="{{url}}" style="width: {{safeArea.width}}px; opacity: {{moveView.opacity}}" mode="widthFix" bindload="imgLoad"/>
11
+ </movable-view>
12
+ <block wx:if="{{operationBar.visible}}">
13
+ <view class="w-ui-check__operation-bar" style="top: {{safeArea.height - safeArea.top - 100 }}px;">
14
+ <view class="w-ui-check__operation-bar-hd">
15
+ <view class="w-ui-check__hd-title">UI 透明度</view>
16
+ <slider class="w-ui-check__hd-slider"
17
+ show-value
18
+ bindchanging="slideChanging"
19
+ value="{{moveView.opacity * 100}}"
20
+ min="{{operationBar.slider.min}}"
21
+ max="{{operationBar.slider.max}}"
22
+ block-color="{{operationBar.slider.blockColor}}"
23
+ activeColor="{{operationBar.slider.activeColor}}"
24
+ backgroundColor="{{operationBar.slider.backgroundColor}}" />
25
+ </view>
26
+ <view class="w-ui-check__operation-bar-ft">
27
+ <view class="w-ui-check__ft-btn"
28
+ hover-class="active"
29
+ catchtouchstart="increaseTouchstart"
30
+ catchtouchend="increaseTouchend">
31
+ <view class="triangle up"></view>
32
+ </view>
33
+ <view class="w-ui-check__ft-btn"
34
+ hover-class="active"
35
+ catchtouchstart="decreaseTouchstart"
36
+ bindtouchend="decreaseTouchend">
37
+ <view class="triangle down"></view>
38
+ </view>
39
+ </view>
40
+ </view>
41
+ </block>
42
+ </movable-area>
@@ -0,0 +1,65 @@
1
+ .w-ui-check {
2
+ position: fixed;
3
+ z-index: 999900;
4
+ }
5
+ .w-ui-check__operation-bar {
6
+ display: flex;
7
+ position: fixed;
8
+ justify-content: space-between;
9
+ left: 20rpx;
10
+ width: 710rpx;
11
+ height: 196rpx;
12
+ padding: 0 12px;
13
+ box-sizing: border-box;
14
+ background-color: rgba(0, 0, 0, 0.85);
15
+ align-items: center;
16
+ border-radius: 4px;
17
+ }
18
+ .w-ui-check__operation-bar-hd {
19
+ display: flex;
20
+ flex-direction: column;
21
+ justify-content: space-between;
22
+ width: 500rpx;
23
+ height: 160rpx;
24
+ align-items: left;
25
+ }
26
+ .w-ui-check__hd-title {
27
+ color: rgba(255, 255, 255, 0.5);
28
+ padding-top: 4px;
29
+ padding-left: 4px;
30
+ }
31
+ .w-ui-check__hd-slider {
32
+ width: 100%;
33
+ }
34
+ .w-ui-check__operation-bar-ft {
35
+ display: flex;
36
+ flex-direction: column;
37
+ justify-content: space-between;
38
+ height: 160rpx;
39
+ align-items: center;
40
+ }
41
+ .w-ui-check__ft-btn {
42
+ display: flex;
43
+ justify-content: center;
44
+ align-items: center;
45
+ width: 72rpx;
46
+ height: 72rpx;
47
+ border-radius: 72rpx;
48
+ background-color: rgba(255, 255, 255, 0.09);
49
+ }
50
+ .w-ui-check__ft-btn.active {
51
+ opacity: 0.7;
52
+ }
53
+ .w-ui-check__ft-btn .triangle {
54
+ width: 16rpx;
55
+ height: 28rpx;
56
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAABABAMAAACEvhjaAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAVUExURUdwTMzMzP///83NzdjY2M/Pz8zMzF/cqpMAAAAGdFJOUwCmA8UNSje3QCEAAABFSURBVDjLY2BgCFRgQAesaUIYYmFpiQoYytIwFDIDxdAVsphhUeg8qnBUoRBhMSx6R5WNDGXYyhJsZQ62sglrGYZZ1gEA+XNnGTClJnIAAAAASUVORK5CYII=');
57
+ background-repeat: no-repeat;
58
+ background-size: 16rpx 28rpx;
59
+ }
60
+ .w-ui-check__ft-btn .triangle.up {
61
+ transform: rotate(-90deg);
62
+ }
63
+ .w-ui-check__ft-btn .triangle.down {
64
+ transform: rotate(90deg);
65
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@we-debug/miniprogram",
3
- "version": "0.17.3",
3
+ "version": "0.18.0",
4
4
  "description": "we-debug miniprogram component",
5
5
  "author": {
6
6
  "name": "dlhandsome"
@@ -25,16 +25,16 @@
25
25
  },
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
- "@we-debug/core": "0.17.2",
29
- "@we-debug/plugin-error": "0.17.1",
30
- "@we-debug/plugin-launcher": "0.17.0",
31
- "@we-debug/plugin-network": "0.17.2",
32
- "@we-debug/plugin-router": "0.17.0",
33
- "@we-debug/plugin-ui-check": "0.17.0",
28
+ "@we-debug/core": "0.18.0",
29
+ "@we-debug/plugin-error": "0.18.0",
30
+ "@we-debug/plugin-launcher": "0.18.0",
31
+ "@we-debug/plugin-network": "0.18.0",
32
+ "@we-debug/plugin-router": "0.18.0",
33
+ "@we-debug/plugin-ui-check": "0.18.0",
34
34
  "deepmerge": "^4.2.2"
35
35
  },
36
36
  "readme": "ERROR: No README data found!",
37
37
  "_id": "@we-debug/core@0.3.5",
38
38
  "_commitid": "6c3f04b",
39
- "gitHead": "aaf0bd5c629578e613b7c5a31370dee5793f53b9"
39
+ "gitHead": "3938419d4d5cf325d92aaad8582c090d8ffcf6ed"
40
40
  }