@vue/devtools-kit 7.0.15 → 7.0.17

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/dist/index.js CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target9) => (target9 = mod != null ? __create(__
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.4.2/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.4.2/node_modules/tsup/assets/esm_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -1819,23 +1819,26 @@ function collectDevToolsPlugin(pluginDescriptor, setupFn) {
1819
1819
  function setupDevToolsPlugin(pluginDescriptor, setupFn) {
1820
1820
  return hook.setupDevToolsPlugin(pluginDescriptor, setupFn);
1821
1821
  }
1822
- function registerPlugin(app, api) {
1823
- const plugins = devtoolsState.pluginBuffer.filter(([plugin]) => plugin.app === app);
1824
- plugins.forEach(async ([plugin, setupFn]) => {
1825
- if (plugin.packageName === "vue-query") {
1826
- return;
1827
- }
1828
- if (plugin.packageName === "vue-router") {
1829
- const id = getRouterDevToolsId(`${plugin.id}`);
1830
- if (plugin.app === app) {
1831
- devtoolsAppRecords.value = devtoolsAppRecords.value.map((item) => ({
1832
- ...item,
1833
- routerId: id
1834
- }));
1835
- }
1822
+ function setupExternalPlugin(plugin, app, api) {
1823
+ const [pluginDescriptor, setupFn] = plugin;
1824
+ if (pluginDescriptor.app !== app)
1825
+ return;
1826
+ if (pluginDescriptor.packageName === "vue-query") {
1827
+ return;
1828
+ }
1829
+ if (pluginDescriptor.packageName === "vue-router") {
1830
+ const id = getRouterDevToolsId(`${pluginDescriptor.id}`);
1831
+ if (pluginDescriptor.app === app) {
1832
+ devtoolsAppRecords.value = devtoolsAppRecords.value.map((item) => ({
1833
+ ...item,
1834
+ routerId: id
1835
+ }));
1836
1836
  }
1837
- setupFn(api);
1838
- });
1837
+ }
1838
+ setupFn(api);
1839
+ }
1840
+ function registerPlugin(app, api) {
1841
+ devtoolsState.pluginBuffer.forEach((plugin) => setupExternalPlugin(plugin, app, api));
1839
1842
  devtoolsAppRecords.value = devtoolsAppRecords.value.map((record) => {
1840
1843
  var _a10, _b10;
1841
1844
  const globalProperties = (_b10 = (_a10 = record.app) == null ? void 0 : _a10.config) == null ? void 0 : _b10.globalProperties;
@@ -2295,6 +2298,8 @@ var StateEditor = class {
2295
2298
  const section = sections.shift();
2296
2299
  if (object instanceof Map)
2297
2300
  object = object.get(section);
2301
+ if (object instanceof Set)
2302
+ object = Array.from(object.values())[section];
2298
2303
  else
2299
2304
  object = object[section];
2300
2305
  if (this.refEditor.isRef(object))
@@ -2348,7 +2353,7 @@ var StateEditor = class {
2348
2353
  else if (toRaw(object) instanceof Map)
2349
2354
  object.delete(field);
2350
2355
  else if (toRaw(object) instanceof Set)
2351
- object.delete(value);
2356
+ object.delete(Array.from(object.values())[field]);
2352
2357
  else
2353
2358
  Reflect.deleteProperty(object, field);
2354
2359
  }
@@ -2358,6 +2363,8 @@ var StateEditor = class {
2358
2363
  this.refEditor.set(target9, value);
2359
2364
  else if (toRaw(object) instanceof Map)
2360
2365
  object.set(state.newKey || field, value);
2366
+ else if (toRaw(object) instanceof Set)
2367
+ object.add(value);
2361
2368
  else
2362
2369
  object[state.newKey || field] = value;
2363
2370
  }
@@ -2369,8 +2376,22 @@ var RefStateEditor = class {
2369
2376
  if (isRef(ref)) {
2370
2377
  ref.value = value;
2371
2378
  } else {
2372
- const previousKeysSet = new Set(Object.keys(ref));
2379
+ if (ref instanceof Set && Array.isArray(value)) {
2380
+ ref.clear();
2381
+ value.forEach((v) => ref.add(v));
2382
+ return;
2383
+ }
2373
2384
  const currentKeys = Object.keys(value);
2385
+ if (ref instanceof Map) {
2386
+ const previousKeysSet2 = new Set(ref.keys());
2387
+ currentKeys.forEach((key) => {
2388
+ ref.set(key, Reflect.get(value, key));
2389
+ previousKeysSet2.delete(key);
2390
+ });
2391
+ previousKeysSet2.forEach((key) => ref.delete(key));
2392
+ return;
2393
+ }
2394
+ const previousKeysSet = new Set(Object.keys(ref));
2374
2395
  currentKeys.forEach((key) => {
2375
2396
  Reflect.set(ref, key, Reflect.get(value, key));
2376
2397
  previousKeysSet.delete(key);
@@ -3026,10 +3047,6 @@ async function toggleActiveAppRecord(id) {
3026
3047
  const api = new DevToolsPluginApi();
3027
3048
  appRecord.api = api;
3028
3049
  setActiveAppRecord(appRecord);
3029
- window.postMessage({
3030
- event: "toggle-app-record",
3031
- target: "vue-devtools"
3032
- });
3033
3050
  }
3034
3051
  }
3035
3052
 
@@ -3289,6 +3306,17 @@ function getBigIntDetails(val) {
3289
3306
  }
3290
3307
  };
3291
3308
  }
3309
+ function getDateDetails(val) {
3310
+ const date = new Date(val.getTime());
3311
+ date.setMinutes(date.getMinutes() - date.getTimezoneOffset());
3312
+ return {
3313
+ _custom: {
3314
+ type: "date",
3315
+ displayText: Date.prototype.toString.call(val),
3316
+ value: date.toISOString().slice(0, -1)
3317
+ }
3318
+ };
3319
+ }
3292
3320
  function getMapDetails(val) {
3293
3321
  const list = Object.fromEntries(val);
3294
3322
  return {
@@ -3506,7 +3534,7 @@ function stringifyReplacer(key) {
3506
3534
  } else if (proto === "[object RegExp]") {
3507
3535
  return `[native RegExp ${RegExp.prototype.toString.call(val)}]`;
3508
3536
  } else if (proto === "[object Date]") {
3509
- return `[native Date ${Date.prototype.toString.call(val)}]`;
3537
+ return getDateDetails(val);
3510
3538
  } else if (proto === "[object Error]") {
3511
3539
  return `[native Error ${val.message}<>${val.stack}]`;
3512
3540
  } else if (val.state && val._vm) {
@@ -3780,11 +3808,15 @@ function getRaw(value) {
3780
3808
  function toEdit(value, customType) {
3781
3809
  if (customType === "bigint")
3782
3810
  return value;
3811
+ if (customType === "date")
3812
+ return value;
3783
3813
  return replaceTokenToString(JSON.stringify(value));
3784
3814
  }
3785
3815
  function toSubmit(value, customType) {
3786
3816
  if (customType === "bigint")
3787
3817
  return BigInt(value);
3818
+ if (customType === "date")
3819
+ return new Date(value);
3788
3820
  return JSON.parse(replaceStringToToken(value), reviver);
3789
3821
  }
3790
3822
 
@@ -3918,6 +3950,9 @@ var on2 = {
3918
3950
  },
3919
3951
  editComponentState() {
3920
3952
  },
3953
+ componentUpdated(fn) {
3954
+ apiHooks.hook("component:updated" /* COMPONENT_UPDATED */, fn);
3955
+ },
3921
3956
  // #endregion compatible with old devtools
3922
3957
  // router
3923
3958
  routerInfoUpdated(fn) {
@@ -3996,7 +4031,7 @@ var DevToolsPluginApi = class {
3996
4031
  resolve();
3997
4032
  }, "inspector-tree:get" /* GET_INSPECTOR_TREE */);
3998
4033
  });
3999
- return stringify(_payload.rootNodes);
4034
+ return _payload.rootNodes;
4000
4035
  }
4001
4036
  getInspectorState(payload = {}) {
4002
4037
  var _a10;
@@ -4014,7 +4049,7 @@ var DevToolsPluginApi = class {
4014
4049
  }, "inspector-state:get" /* GET_INSPECTOR_STATE */);
4015
4050
  const state = _payload.state;
4016
4051
  delete state.instance;
4017
- return stringify(state);
4052
+ return state;
4018
4053
  }
4019
4054
  async editInspectorState(payload) {
4020
4055
  var _a10;
@@ -4033,10 +4068,10 @@ var DevToolsPluginApi = class {
4033
4068
  const res = await this.getInspectorTree({
4034
4069
  inspectorId
4035
4070
  });
4036
- apiHooks.callHook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, stringify({
4071
+ apiHooks.callHook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, {
4037
4072
  inspectorId,
4038
- data: parse(res)
4039
- }));
4073
+ data: res
4074
+ });
4040
4075
  }
4041
4076
  }
4042
4077
  async sendInspectorState(inspectorId) {
@@ -4046,7 +4081,7 @@ var DevToolsPluginApi = class {
4046
4081
  inspectorId,
4047
4082
  nodeId: inspector.nodeId
4048
4083
  });
4049
- apiHooks.callHook("inspector-state:send" /* SEND_INSPECTOR_STATE */, stringify({ ...parse(res), inspectorId }));
4084
+ apiHooks.callHook("inspector-state:send" /* SEND_INSPECTOR_STATE */, { ...res, inspectorId });
4050
4085
  }
4051
4086
  }
4052
4087
  async getComponentInstances(app) {
@@ -4059,6 +4094,7 @@ var DevToolsPluginApi = class {
4059
4094
  apiHooks.callHook("component-tree:visit" /* VISIT_COMPONENT_TREE */, ...params);
4060
4095
  }
4061
4096
  notifyComponentUpdate() {
4097
+ apiHooks.callHook("component:updated" /* COMPONENT_UPDATED */);
4062
4098
  }
4063
4099
  now() {
4064
4100
  return now();
@@ -4305,7 +4341,13 @@ function initDevTools() {
4305
4341
  Object.assign(__VUE_DEVTOOLS_GLOBAL_HOOK__, createDevToolsHook());
4306
4342
  else
4307
4343
  target8.__VUE_DEVTOOLS_GLOBAL_HOOK__ = createDevToolsHook();
4308
- hook.on.setupDevtoolsPlugin(collectDevToolsPlugin);
4344
+ hook.on.setupDevtoolsPlugin((pluginDescriptor, setupFn) => {
4345
+ collectDevToolsPlugin(pluginDescriptor, setupFn);
4346
+ const { app, api } = devtoolsAppRecords.active || {};
4347
+ if (!app || !api)
4348
+ return;
4349
+ setupExternalPlugin([pluginDescriptor, setupFn], app, api);
4350
+ });
4309
4351
  hook.on.vueAppInit(async (app, version) => {
4310
4352
  const record = createAppRecord(app);
4311
4353
  const api = new DevToolsPluginApi();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue/devtools-kit",
3
3
  "type": "module",
4
- "version": "7.0.15",
4
+ "version": "7.0.17",
5
5
  "author": "webfansplz",
6
6
  "license": "MIT",
7
7
  "exports": {
@@ -25,12 +25,12 @@
25
25
  "mitt": "^3.0.1",
26
26
  "perfect-debounce": "^1.0.0",
27
27
  "speakingurl": "^14.0.1",
28
- "@vue/devtools-shared": "^7.0.15"
28
+ "@vue/devtools-shared": "^7.0.17"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/speakingurl": "^13.0.6",
32
- "vue": "^3.4.19",
33
- "vue-router": "^4.2.5"
32
+ "vue": "^3.4.21",
33
+ "vue-router": "^4.3.0"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup --clean",