@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.cjs CHANGED
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target9) => (target9 = mod != null ? __create(__
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.4.2/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.35_typescript@5.4.2/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -1846,23 +1846,26 @@ function collectDevToolsPlugin(pluginDescriptor, setupFn) {
1846
1846
  function setupDevToolsPlugin(pluginDescriptor, setupFn) {
1847
1847
  return hook.setupDevToolsPlugin(pluginDescriptor, setupFn);
1848
1848
  }
1849
- function registerPlugin(app, api) {
1850
- const plugins = devtoolsState.pluginBuffer.filter(([plugin]) => plugin.app === app);
1851
- plugins.forEach(async ([plugin, setupFn]) => {
1852
- if (plugin.packageName === "vue-query") {
1853
- return;
1854
- }
1855
- if (plugin.packageName === "vue-router") {
1856
- const id = getRouterDevToolsId(`${plugin.id}`);
1857
- if (plugin.app === app) {
1858
- devtoolsAppRecords.value = devtoolsAppRecords.value.map((item) => ({
1859
- ...item,
1860
- routerId: id
1861
- }));
1862
- }
1849
+ function setupExternalPlugin(plugin, app, api) {
1850
+ const [pluginDescriptor, setupFn] = plugin;
1851
+ if (pluginDescriptor.app !== app)
1852
+ return;
1853
+ if (pluginDescriptor.packageName === "vue-query") {
1854
+ return;
1855
+ }
1856
+ if (pluginDescriptor.packageName === "vue-router") {
1857
+ const id = getRouterDevToolsId(`${pluginDescriptor.id}`);
1858
+ if (pluginDescriptor.app === app) {
1859
+ devtoolsAppRecords.value = devtoolsAppRecords.value.map((item) => ({
1860
+ ...item,
1861
+ routerId: id
1862
+ }));
1863
1863
  }
1864
- setupFn(api);
1865
- });
1864
+ }
1865
+ setupFn(api);
1866
+ }
1867
+ function registerPlugin(app, api) {
1868
+ devtoolsState.pluginBuffer.forEach((plugin) => setupExternalPlugin(plugin, app, api));
1866
1869
  devtoolsAppRecords.value = devtoolsAppRecords.value.map((record) => {
1867
1870
  var _a10, _b10;
1868
1871
  const globalProperties = (_b10 = (_a10 = record.app) == null ? void 0 : _a10.config) == null ? void 0 : _b10.globalProperties;
@@ -2322,6 +2325,8 @@ var StateEditor = class {
2322
2325
  const section = sections.shift();
2323
2326
  if (object instanceof Map)
2324
2327
  object = object.get(section);
2328
+ if (object instanceof Set)
2329
+ object = Array.from(object.values())[section];
2325
2330
  else
2326
2331
  object = object[section];
2327
2332
  if (this.refEditor.isRef(object))
@@ -2375,7 +2380,7 @@ var StateEditor = class {
2375
2380
  else if ((0, import_vue2.toRaw)(object) instanceof Map)
2376
2381
  object.delete(field);
2377
2382
  else if ((0, import_vue2.toRaw)(object) instanceof Set)
2378
- object.delete(value);
2383
+ object.delete(Array.from(object.values())[field]);
2379
2384
  else
2380
2385
  Reflect.deleteProperty(object, field);
2381
2386
  }
@@ -2385,6 +2390,8 @@ var StateEditor = class {
2385
2390
  this.refEditor.set(target9, value);
2386
2391
  else if ((0, import_vue2.toRaw)(object) instanceof Map)
2387
2392
  object.set(state.newKey || field, value);
2393
+ else if ((0, import_vue2.toRaw)(object) instanceof Set)
2394
+ object.add(value);
2388
2395
  else
2389
2396
  object[state.newKey || field] = value;
2390
2397
  }
@@ -2396,8 +2403,22 @@ var RefStateEditor = class {
2396
2403
  if ((0, import_vue2.isRef)(ref)) {
2397
2404
  ref.value = value;
2398
2405
  } else {
2399
- const previousKeysSet = new Set(Object.keys(ref));
2406
+ if (ref instanceof Set && Array.isArray(value)) {
2407
+ ref.clear();
2408
+ value.forEach((v) => ref.add(v));
2409
+ return;
2410
+ }
2400
2411
  const currentKeys = Object.keys(value);
2412
+ if (ref instanceof Map) {
2413
+ const previousKeysSet2 = new Set(ref.keys());
2414
+ currentKeys.forEach((key) => {
2415
+ ref.set(key, Reflect.get(value, key));
2416
+ previousKeysSet2.delete(key);
2417
+ });
2418
+ previousKeysSet2.forEach((key) => ref.delete(key));
2419
+ return;
2420
+ }
2421
+ const previousKeysSet = new Set(Object.keys(ref));
2401
2422
  currentKeys.forEach((key) => {
2402
2423
  Reflect.set(ref, key, Reflect.get(value, key));
2403
2424
  previousKeysSet.delete(key);
@@ -3053,10 +3074,6 @@ async function toggleActiveAppRecord(id) {
3053
3074
  const api = new DevToolsPluginApi();
3054
3075
  appRecord.api = api;
3055
3076
  setActiveAppRecord(appRecord);
3056
- window.postMessage({
3057
- event: "toggle-app-record",
3058
- target: "vue-devtools"
3059
- });
3060
3077
  }
3061
3078
  }
3062
3079
 
@@ -3316,6 +3333,17 @@ function getBigIntDetails(val) {
3316
3333
  }
3317
3334
  };
3318
3335
  }
3336
+ function getDateDetails(val) {
3337
+ const date = new Date(val.getTime());
3338
+ date.setMinutes(date.getMinutes() - date.getTimezoneOffset());
3339
+ return {
3340
+ _custom: {
3341
+ type: "date",
3342
+ displayText: Date.prototype.toString.call(val),
3343
+ value: date.toISOString().slice(0, -1)
3344
+ }
3345
+ };
3346
+ }
3319
3347
  function getMapDetails(val) {
3320
3348
  const list = Object.fromEntries(val);
3321
3349
  return {
@@ -3533,7 +3561,7 @@ function stringifyReplacer(key) {
3533
3561
  } else if (proto === "[object RegExp]") {
3534
3562
  return `[native RegExp ${RegExp.prototype.toString.call(val)}]`;
3535
3563
  } else if (proto === "[object Date]") {
3536
- return `[native Date ${Date.prototype.toString.call(val)}]`;
3564
+ return getDateDetails(val);
3537
3565
  } else if (proto === "[object Error]") {
3538
3566
  return `[native Error ${val.message}<>${val.stack}]`;
3539
3567
  } else if (val.state && val._vm) {
@@ -3807,11 +3835,15 @@ function getRaw(value) {
3807
3835
  function toEdit(value, customType) {
3808
3836
  if (customType === "bigint")
3809
3837
  return value;
3838
+ if (customType === "date")
3839
+ return value;
3810
3840
  return replaceTokenToString(JSON.stringify(value));
3811
3841
  }
3812
3842
  function toSubmit(value, customType) {
3813
3843
  if (customType === "bigint")
3814
3844
  return BigInt(value);
3845
+ if (customType === "date")
3846
+ return new Date(value);
3815
3847
  return JSON.parse(replaceStringToToken(value), reviver);
3816
3848
  }
3817
3849
 
@@ -3945,6 +3977,9 @@ var on2 = {
3945
3977
  },
3946
3978
  editComponentState() {
3947
3979
  },
3980
+ componentUpdated(fn) {
3981
+ apiHooks.hook("component:updated" /* COMPONENT_UPDATED */, fn);
3982
+ },
3948
3983
  // #endregion compatible with old devtools
3949
3984
  // router
3950
3985
  routerInfoUpdated(fn) {
@@ -4023,7 +4058,7 @@ var DevToolsPluginApi = class {
4023
4058
  resolve();
4024
4059
  }, "inspector-tree:get" /* GET_INSPECTOR_TREE */);
4025
4060
  });
4026
- return stringify(_payload.rootNodes);
4061
+ return _payload.rootNodes;
4027
4062
  }
4028
4063
  getInspectorState(payload = {}) {
4029
4064
  var _a10;
@@ -4041,7 +4076,7 @@ var DevToolsPluginApi = class {
4041
4076
  }, "inspector-state:get" /* GET_INSPECTOR_STATE */);
4042
4077
  const state = _payload.state;
4043
4078
  delete state.instance;
4044
- return stringify(state);
4079
+ return state;
4045
4080
  }
4046
4081
  async editInspectorState(payload) {
4047
4082
  var _a10;
@@ -4060,10 +4095,10 @@ var DevToolsPluginApi = class {
4060
4095
  const res = await this.getInspectorTree({
4061
4096
  inspectorId
4062
4097
  });
4063
- apiHooks.callHook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, stringify({
4098
+ apiHooks.callHook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, {
4064
4099
  inspectorId,
4065
- data: parse(res)
4066
- }));
4100
+ data: res
4101
+ });
4067
4102
  }
4068
4103
  }
4069
4104
  async sendInspectorState(inspectorId) {
@@ -4073,7 +4108,7 @@ var DevToolsPluginApi = class {
4073
4108
  inspectorId,
4074
4109
  nodeId: inspector.nodeId
4075
4110
  });
4076
- apiHooks.callHook("inspector-state:send" /* SEND_INSPECTOR_STATE */, stringify({ ...parse(res), inspectorId }));
4111
+ apiHooks.callHook("inspector-state:send" /* SEND_INSPECTOR_STATE */, { ...res, inspectorId });
4077
4112
  }
4078
4113
  }
4079
4114
  async getComponentInstances(app) {
@@ -4086,6 +4121,7 @@ var DevToolsPluginApi = class {
4086
4121
  apiHooks.callHook("component-tree:visit" /* VISIT_COMPONENT_TREE */, ...params);
4087
4122
  }
4088
4123
  notifyComponentUpdate() {
4124
+ apiHooks.callHook("component:updated" /* COMPONENT_UPDATED */);
4089
4125
  }
4090
4126
  now() {
4091
4127
  return now();
@@ -4332,7 +4368,13 @@ function initDevTools() {
4332
4368
  Object.assign(__VUE_DEVTOOLS_GLOBAL_HOOK__, createDevToolsHook());
4333
4369
  else
4334
4370
  import_devtools_shared15.target.__VUE_DEVTOOLS_GLOBAL_HOOK__ = createDevToolsHook();
4335
- hook.on.setupDevtoolsPlugin(collectDevToolsPlugin);
4371
+ hook.on.setupDevtoolsPlugin((pluginDescriptor, setupFn) => {
4372
+ collectDevToolsPlugin(pluginDescriptor, setupFn);
4373
+ const { app, api } = devtoolsAppRecords.active || {};
4374
+ if (!app || !api)
4375
+ return;
4376
+ setupExternalPlugin([pluginDescriptor, setupFn], app, api);
4377
+ });
4336
4378
  hook.on.vueAppInit(async (app, version) => {
4337
4379
  const record = createAppRecord(app);
4338
4380
  const api = new DevToolsPluginApi();