@we-debug/plugin-appdata 0.44.0 → 0.45.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,25 @@
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.45.0](https://github.com/dlhandsome/we-debug/compare/v0.44.2...v0.45.0) (2025-03-11)
7
+
8
+ **Note:** Version bump only for package @we-debug/plugin-appdata
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.44.2](https://github.com/dlhandsome/we-debug/compare/v0.44.1...v0.44.2) (2025-03-10)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * fixed plugin appdata ([f961f60](https://github.com/dlhandsome/we-debug/commit/f961f60570c9cabecd9290448cd3a9ed1aa76f98))
20
+
21
+
22
+
23
+
24
+
6
25
  # [0.44.0](https://github.com/dlhandsome/we-debug/compare/v0.43.5...v0.44.0) (2025-03-10)
7
26
 
8
27
 
package/dist/index.js CHANGED
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  var APP_DATA_VIEW_CONFIG = {
4
15
  group: {
@@ -12,9 +23,9 @@ function getCurrentPage() {
12
23
  var pages = getCurrentPages();
13
24
  return pages.length > 0 ? pages[pages.length - 1] : null;
14
25
  }
15
- function getJsonViewOption(page, options) {
26
+ function getJsonView(weDebug, page, options) {
16
27
  var _a, _b;
17
- return {
28
+ return weDebug.createJsonView({
18
29
  data: (page === null || page === void 0 ? void 0 : page.data) || {},
19
30
  editable: (_a = options.editable) !== null && _a !== void 0 ? _a : true,
20
31
  expandLevel: (_b = options.expandLevel) !== null && _b !== void 0 ? _b : 1,
@@ -27,18 +38,17 @@ function getJsonViewOption(page, options) {
27
38
  page === null || page === void 0 ? void 0 : page.setData(changeData);
28
39
  }
29
40
  }
30
- };
41
+ });
31
42
  }
32
43
  AppDataPlugin.install = function (weDebug, options) {
33
- var jsonViewOptions = getJsonViewOption({}, options);
34
- var currentJsonView = weDebug.createJsonView(jsonViewOptions);
44
+ var currentJsonView = getJsonView(weDebug, {}, options);
35
45
  weDebug.addJsonView(currentJsonView, APP_DATA_VIEW_CONFIG);
36
46
  weDebug.event.on('debug:mask:show-modal', function () {
37
47
  var page = getCurrentPage();
38
48
  if (!page)
39
49
  return;
40
- var newJsonViewOptions = getJsonViewOption(page, options);
41
- weDebug.updateJsonView(newJsonViewOptions, APP_DATA_VIEW_CONFIG);
50
+ var newJsonView = getJsonView(weDebug, page, options);
51
+ weDebug.updateJsonView(__assign(__assign({}, newJsonView), { id: currentJsonView.id }), APP_DATA_VIEW_CONFIG);
42
52
  });
43
53
  };
44
54
  exports.default = AppDataPlugin;
@@ -0,0 +1,4 @@
1
+ export declare const showToast: (options: WechatMiniprogram.ShowToastOption) => Promise<void>;
2
+ export declare const showModal: (options: WechatMiniprogram.ShowModalOption) => Promise<WechatMiniprogram.ShowModalSuccessCallbackResult>;
3
+ export declare const showActionSheet: (options: WechatMiniprogram.ShowActionSheetOption) => Promise<WechatMiniprogram.ShowActionSheetSuccessCallbackResult>;
4
+ export declare const setClipboardData: (data: string) => Promise<void>;
package/dist/utils.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.setClipboardData = exports.showActionSheet = exports.showModal = exports.showToast = void 0;
15
+ var showToast = function (options) {
16
+ return new Promise(function (resolve, reject) {
17
+ wx.showToast(__assign(__assign({}, options), { success: function () { return resolve(); }, fail: reject }));
18
+ });
19
+ };
20
+ exports.showToast = showToast;
21
+ var showModal = function (options) {
22
+ return new Promise(function (resolve, reject) {
23
+ wx.showModal(__assign(__assign({}, options), { success: resolve, fail: reject }));
24
+ });
25
+ };
26
+ exports.showModal = showModal;
27
+ var showActionSheet = function (options) {
28
+ return new Promise(function (resolve, reject) {
29
+ wx.showActionSheet(__assign(__assign({}, options), { success: resolve, fail: reject }));
30
+ });
31
+ };
32
+ exports.showActionSheet = showActionSheet;
33
+ var setClipboardData = function (data) {
34
+ return new Promise(function (resolve, reject) {
35
+ wx.setClipboardData({
36
+ data: data,
37
+ success: function () { return resolve(); },
38
+ fail: reject,
39
+ });
40
+ });
41
+ };
42
+ exports.setClipboardData = setClipboardData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@we-debug/plugin-appdata",
3
- "version": "0.44.0",
3
+ "version": "0.45.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "Sail <505441575@qq.com>",
6
6
  "homepage": "https://github.com/dlhandsome/we-debug/tree/master/packages/runtime/plugin-appdata#readme",
@@ -20,5 +20,5 @@
20
20
  "bugs": {
21
21
  "url": "https://github.com/dlhandsome/we-debug/issues"
22
22
  },
23
- "gitHead": "d7451a394de645a2db8e32c81f07df47a6e5aa26"
23
+ "gitHead": "b2aeae566a4a1865fe7f6005b0a7b27bd0e6a536"
24
24
  }
package/src/index.ts CHANGED
@@ -20,8 +20,8 @@ function getCurrentPage(): WechatMiniprogram.Page.Instance<any, any> | null {
20
20
  return pages.length > 0 ? pages[pages.length - 1] : null;
21
21
  }
22
22
 
23
- function getJsonViewOption (page: WechatMiniprogram.Page.Instance<any, any> | null, options: IPluginInitOptions) {
24
- return {
23
+ function getJsonView (weDebug: IAnyObject, page: WechatMiniprogram.Page.Instance<any, any> | null, options: IPluginInitOptions) {
24
+ return weDebug.createJsonView({
25
25
  data: page?.data || {},
26
26
  editable: options.editable ?? true,
27
27
  expandLevel: options.expandLevel ?? 1,
@@ -34,21 +34,24 @@ function getJsonViewOption (page: WechatMiniprogram.Page.Instance<any, any> | nu
34
34
  page?.setData(changeData);
35
35
  }
36
36
  }
37
- }
37
+ })
38
38
  }
39
39
 
40
40
  AppDataPlugin.install = function (weDebug, options: IPluginInitOptions) {
41
41
  // 调试面板弹出时,触发规则更新
42
- const jsonViewOptions = getJsonViewOption({}, options);
43
- let currentJsonView = weDebug.createJsonView(jsonViewOptions);
42
+ const currentJsonView = getJsonView(weDebug, {}, options);
44
43
  weDebug.addJsonView(currentJsonView, APP_DATA_VIEW_CONFIG);
45
44
 
46
45
  weDebug.event.on('debug:mask:show-modal', () => {
47
46
  const page = getCurrentPage();
48
47
  if (!page) return;
48
+
49
+ const newJsonView = getJsonView(weDebug, page, options);
49
50
 
50
- const newJsonViewOptions = getJsonViewOption(page, options);
51
- weDebug.updateJsonView(newJsonViewOptions, APP_DATA_VIEW_CONFIG);
51
+ weDebug.updateJsonView({
52
+ ...newJsonView,
53
+ id: currentJsonView.id
54
+ }, APP_DATA_VIEW_CONFIG);
52
55
  });
53
56
  }
54
57