@vue/devtools-kit 8.0.1 → 8.0.2

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
@@ -24,10 +24,14 @@ var __toESM = (mod, isNodeMode, target$21) => (target$21 = mod != null ? __creat
24
24
  }) : target$21, mod));
25
25
 
26
26
  //#endregion
27
- const __vue_devtools_shared = __toESM(require("@vue/devtools-shared"));
28
- const perfect_debounce = __toESM(require("perfect-debounce"));
29
- const hookable = __toESM(require("hookable"));
30
- const birpc = __toESM(require("birpc"));
27
+ let __vue_devtools_shared = require("@vue/devtools-shared");
28
+ __vue_devtools_shared = __toESM(__vue_devtools_shared);
29
+ let perfect_debounce = require("perfect-debounce");
30
+ perfect_debounce = __toESM(perfect_debounce);
31
+ let hookable = require("hookable");
32
+ hookable = __toESM(hookable);
33
+ let birpc = require("birpc");
34
+ birpc = __toESM(birpc);
31
35
 
32
36
  //#region src/compat/index.ts
33
37
  function onLegacyDevToolsPluginApiAvailable(cb) {
@@ -127,8 +131,7 @@ function returnError(cb) {
127
131
  }
128
132
  function getComponentInstance(appRecord, instanceId) {
129
133
  instanceId = instanceId || `${appRecord.id}:root`;
130
- const instance = appRecord.instanceMap.get(instanceId);
131
- return instance || appRecord.instanceMap.get(":root");
134
+ return appRecord.instanceMap.get(instanceId) || appRecord.instanceMap.get(":root");
132
135
  }
133
136
  function ensurePropertyExists(obj, key, skipObjCheck = false) {
134
137
  return skipObjCheck ? key in obj : typeof obj === "object" && obj !== null ? key in obj : false;
@@ -317,8 +320,7 @@ function highlight(instance) {
317
320
  const bounds = getComponentBoundingRect(instance);
318
321
  if (!bounds.width && !bounds.height) return;
319
322
  const name = getInstanceName(instance);
320
- const container = getContainerElement();
321
- container ? update({
323
+ getContainerElement() ? update({
322
324
  bounds,
323
325
  name
324
326
  }) : create({
@@ -337,12 +339,10 @@ function inspectFn(e) {
337
339
  const instance = target$21.__vueParentComponent;
338
340
  if (instance) {
339
341
  inspectInstance = instance;
340
- const el = instance.vnode.el;
341
- if (el) {
342
+ if (instance.vnode.el) {
342
343
  const bounds = getComponentBoundingRect(instance);
343
344
  const name = getInstanceName(instance);
344
- const container = getContainerElement();
345
- container ? update({
345
+ getContainerElement() ? update({
346
346
  bounds,
347
347
  name
348
348
  }) : create({
@@ -515,7 +515,9 @@ const Fragment = Symbol.for("v-fgt");
515
515
  //#endregion
516
516
  //#region src/core/component/state/editor.ts
517
517
  var StateEditor = class {
518
- refEditor = new RefStateEditor();
518
+ constructor() {
519
+ this.refEditor = new RefStateEditor();
520
+ }
519
521
  set(object, path, value, cb) {
520
522
  const sections = Array.isArray(path) ? path : path.split(".");
521
523
  while (sections.length > 1) {
@@ -733,12 +735,10 @@ function getInspector(id, app) {
733
735
  return devtoolsInspector.find((inspector) => inspector.options.id === id && (app ? inspector.descriptor.app === app : true));
734
736
  }
735
737
  function getInspectorActions(id) {
736
- const inspector = getInspector(id);
737
- return inspector?.options.actions;
738
+ return getInspector(id)?.options.actions;
738
739
  }
739
740
  function getInspectorNodeActions(id) {
740
- const inspector = getInspector(id);
741
- return inspector?.options.nodeActions;
741
+ return getInspector(id)?.options.nodeActions;
742
742
  }
743
743
 
744
744
  //#endregion
@@ -842,13 +842,12 @@ function createDevToolsCtxHooks() {
842
842
  addTimelineLayer(options, plugin.descriptor);
843
843
  });
844
844
  hooks$1.hook(DevToolsContextHookKeys.TIMELINE_EVENT_ADDED, ({ options, plugin }) => {
845
- const internalLayerIds = [
845
+ if (devtoolsState.highPerfModeEnabled || !devtoolsState.timelineLayersState?.[plugin.descriptor.id] && ![
846
846
  "performance",
847
847
  "component-event",
848
848
  "keyboard",
849
849
  "mouse"
850
- ];
851
- if (devtoolsState.highPerfModeEnabled || !devtoolsState.timelineLayersState?.[plugin.descriptor.id] && !internalLayerIds.includes(options.layerId)) return;
850
+ ].includes(options.layerId)) return;
852
851
  hooks$1.callHookWith(async (callbacks) => {
853
852
  await Promise.all(callbacks.map((cb) => cb(options)));
854
853
  }, DevToolsMessagingHookKeys.SEND_TIMELINE_EVENT_TO_CLIENT);
@@ -857,16 +856,13 @@ function createDevToolsCtxHooks() {
857
856
  const appRecord = app.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
858
857
  if (!appRecord) return null;
859
858
  const appId = appRecord.id.toString();
860
- const instances = [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
861
- return instances;
859
+ return [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
862
860
  });
863
861
  hooks$1.hook(DevToolsContextHookKeys.GET_COMPONENT_BOUNDS, async ({ instance }) => {
864
- const bounds = getComponentBoundingRect(instance);
865
- return bounds;
862
+ return getComponentBoundingRect(instance);
866
863
  });
867
864
  hooks$1.hook(DevToolsContextHookKeys.GET_COMPONENT_NAME, ({ instance }) => {
868
- const name = getInstanceName(instance);
869
- return name;
865
+ return getInstanceName(instance);
870
866
  });
871
867
  hooks$1.hook(DevToolsContextHookKeys.COMPONENT_HIGHLIGHT, ({ uid }) => {
872
868
  const instance = activeAppRecord.value.instanceMap.get(uid);
@@ -1075,8 +1071,7 @@ function getPluginLocalKey(pluginId) {
1075
1071
  return `__VUE_DEVTOOLS_NEXT_PLUGIN_SETTINGS__${pluginId}__`;
1076
1072
  }
1077
1073
  function getPluginSettingsOptions(pluginId) {
1078
- const item = devtoolsPluginBuffer.find((item$1) => item$1[0].id === pluginId && !!item$1[0]?.settings)?.[0] ?? null;
1079
- return item?.settings ?? null;
1074
+ return (devtoolsPluginBuffer.find((item) => item[0].id === pluginId && !!item[0]?.settings)?.[0] ?? null)?.settings ?? null;
1080
1075
  }
1081
1076
  function getPluginSettings(pluginId, fallbackValue) {
1082
1077
  const localKey = getPluginLocalKey(pluginId);
@@ -1092,8 +1087,7 @@ function getPluginSettings(pluginId, fallbackValue) {
1092
1087
  }
1093
1088
  function initPluginSettings(pluginId, settings) {
1094
1089
  const localKey = getPluginLocalKey(pluginId);
1095
- const localSettings = localStorage.getItem(localKey);
1096
- if (!localSettings) localStorage.setItem(localKey, JSON.stringify(_getSettings(settings)));
1090
+ if (!localStorage.getItem(localKey)) localStorage.setItem(localKey, JSON.stringify(_getSettings(settings)));
1097
1091
  }
1098
1092
  function setPluginSettings(pluginId, key, value) {
1099
1093
  const localKey = getPluginLocalKey(pluginId);
@@ -1251,8 +1245,6 @@ const hook = {
1251
1245
  //#endregion
1252
1246
  //#region src/api/v6/index.ts
1253
1247
  var DevToolsV6PluginAPI = class {
1254
- plugin;
1255
- hooks;
1256
1248
  constructor({ plugin, ctx }) {
1257
1249
  this.hooks = ctx.hooks;
1258
1250
  this.plugin = plugin;
@@ -1653,11 +1645,10 @@ function processSetupState(instance) {
1653
1645
  editable: isState && !info.readonly
1654
1646
  };
1655
1647
  }
1656
- const type = isOtherType ? "setup (other)" : "setup";
1657
1648
  return {
1658
1649
  key,
1659
1650
  value,
1660
- type,
1651
+ type: isOtherType ? "setup (other)" : "setup",
1661
1652
  ...result
1662
1653
  };
1663
1654
  });
@@ -1778,7 +1769,6 @@ function getInstanceState(params) {
1778
1769
  //#endregion
1779
1770
  //#region src/core/component/tree/filter.ts
1780
1771
  var ComponentFilter = class {
1781
- filter;
1782
1772
  constructor(filter) {
1783
1773
  this.filter = filter || "";
1784
1774
  }
@@ -1800,12 +1790,8 @@ function createComponentFilter(filterText) {
1800
1790
  //#endregion
1801
1791
  //#region src/core/component/tree/walker.ts
1802
1792
  var ComponentWalker = class {
1803
- maxDepth;
1804
- recursively;
1805
- componentFilter;
1806
- api;
1807
- captureIds = /* @__PURE__ */ new Map();
1808
1793
  constructor(options) {
1794
+ this.captureIds = /* @__PURE__ */ new Map();
1809
1795
  const { filterText = "", maxDepth, recursively, api } = options;
1810
1796
  this.componentFilter = createComponentFilter(filterText);
1811
1797
  this.maxDepth = maxDepth;
@@ -1877,8 +1863,7 @@ var ComponentWalker = class {
1877
1863
  if (node) treeNode.children.push(node);
1878
1864
  }
1879
1865
  }
1880
- const rootElements = getRootElementsFromComponentInstance(instance);
1881
- const firstElement = rootElements[0];
1866
+ const firstElement = getRootElementsFromComponentInstance(instance)[0];
1882
1867
  if (firstElement?.parentElement) {
1883
1868
  const parentInstance = instance.parent;
1884
1869
  const parentRootElements = parentInstance ? getRootElementsFromComponentInstance(parentInstance) : [];
@@ -2199,15 +2184,12 @@ function createComponentsDevToolsPlugin(app) {
2199
2184
  api.on.getInspectorTree(async (payload) => {
2200
2185
  if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
2201
2186
  const instance = getComponentInstance(activeAppRecord.value, payload.instanceId);
2202
- if (instance) {
2203
- const walker$1 = new ComponentWalker({
2204
- filterText: payload.filter,
2205
- maxDepth: 100,
2206
- recursively: false,
2207
- api
2208
- });
2209
- payload.rootNodes = await walker$1.getComponentTree(instance);
2210
- }
2187
+ if (instance) payload.rootNodes = await new ComponentWalker({
2188
+ filterText: payload.filter,
2189
+ maxDepth: 100,
2190
+ recursively: false,
2191
+ api
2192
+ }).getComponentTree(instance);
2211
2193
  }
2212
2194
  });
2213
2195
  api.on.getInspectorState(async (payload) => {
@@ -4169,15 +4151,13 @@ function initDevTools() {
4169
4151
  callDevToolsPluginSetupFn([pluginDescriptor, setupFn], app);
4170
4152
  });
4171
4153
  onLegacyDevToolsPluginApiAvailable(() => {
4172
- const normalizedPluginBuffer = devtoolsPluginBuffer.filter(([item]) => item.id !== "components");
4173
- normalizedPluginBuffer.forEach(([pluginDescriptor, setupFn]) => {
4154
+ devtoolsPluginBuffer.filter(([item]) => item.id !== "components").forEach(([pluginDescriptor, setupFn]) => {
4174
4155
  _devtoolsHook.emit(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn, { target: "legacy" });
4175
4156
  });
4176
4157
  });
4177
4158
  hook.on.vueAppInit(async (app, version, types) => {
4178
- const appRecord = createAppRecord(app, types);
4179
4159
  const normalizedAppRecord = {
4180
- ...appRecord,
4160
+ ...createAppRecord(app, types),
4181
4161
  app,
4182
4162
  version
4183
4163
  };
@@ -4257,7 +4237,7 @@ function reviveMap(val) {
4257
4237
  return result;
4258
4238
  }
4259
4239
  function revive(val) {
4260
- if (val === UNDEFINED) return void 0;
4240
+ if (val === UNDEFINED) return;
4261
4241
  else if (val === INFINITY) return Number.POSITIVE_INFINITY;
4262
4242
  else if (val === NEGATIVE_INFINITY) return Number.NEGATIVE_INFINITY;
4263
4243
  else if (val === NAN) return NaN;
@@ -4306,10 +4286,8 @@ function formatInspectorStateValue(value, quotes = false, options) {
4306
4286
  const type = getInspectorStateValueType(value, false);
4307
4287
  if (type !== "custom" && value?._custom) value = value._custom.value;
4308
4288
  if (result = internalStateTokenToString(value)) return result;
4309
- else if (type === "custom") {
4310
- const nestedName = value._custom.value?._custom && formatInspectorStateValue(value._custom.value, quotes, options);
4311
- return nestedName || value._custom.displayText || value._custom.display;
4312
- } else if (type === "array") return `Array[${value.length}]`;
4289
+ else if (type === "custom") return value._custom.value?._custom && formatInspectorStateValue(value._custom.value, quotes, options) || value._custom.displayText || value._custom.display;
4290
+ else if (type === "array") return `Array[${value.length}]`;
4313
4291
  else if (type === "plain-object") return `Object${Object.keys(value).length ? "" : " (empty)"}`;
4314
4292
  else if (type?.includes("native")) return escape(specialTypeRE.exec(value)?.[2]);
4315
4293
  else if (typeof value === "string") {
@@ -4450,7 +4428,6 @@ function find(record, predicate) {
4450
4428
  const value = valuesNotNever[i];
4451
4429
  if (predicate(value)) return value;
4452
4430
  }
4453
- return void 0;
4454
4431
  }
4455
4432
  function forEach(record, run) {
4456
4433
  Object.entries(record).forEach(([key, value]) => run(value, key));
@@ -4463,7 +4440,6 @@ function findArr(record, predicate) {
4463
4440
  const value = record[i];
4464
4441
  if (predicate(value)) return value;
4465
4442
  }
4466
- return void 0;
4467
4443
  }
4468
4444
 
4469
4445
  //#endregion
@@ -4521,14 +4497,12 @@ const parsePath = (string) => {
4521
4497
  let segment = "";
4522
4498
  for (let i = 0; i < string.length; i++) {
4523
4499
  let char = string.charAt(i);
4524
- const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
4525
- if (isEscapedDot) {
4500
+ if (char === "\\" && string.charAt(i + 1) === ".") {
4526
4501
  segment += ".";
4527
4502
  i++;
4528
4503
  continue;
4529
4504
  }
4530
- const isEndOfSegment = char === ".";
4531
- if (isEndOfSegment) {
4505
+ if (char === ".") {
4532
4506
  result.push(segment);
4533
4507
  segment = "";
4534
4508
  continue;
@@ -4602,14 +4576,10 @@ function compositeTransformation(isApplicable, annotation, transform, untransfor
4602
4576
  };
4603
4577
  }
4604
4578
  const symbolRule = compositeTransformation((s, superJson) => {
4605
- if (isSymbol(s)) {
4606
- const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
4607
- return isRegistered;
4608
- }
4579
+ if (isSymbol(s)) return !!superJson.symbolRegistry.getIdentifier(s);
4609
4580
  return false;
4610
4581
  }, (s, superJson) => {
4611
- const identifier = superJson.symbolRegistry.getIdentifier(s);
4612
- return ["symbol", identifier];
4582
+ return ["symbol", superJson.symbolRegistry.getIdentifier(s)];
4613
4583
  }, (v) => v.description, (_, a, superJson) => {
4614
4584
  const value = superJson.symbolRegistry.getValue(a[1]);
4615
4585
  if (!value) throw new Error("Trying to deserialize unknown symbol");
@@ -4635,15 +4605,11 @@ const typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-arra
4635
4605
  return new ctor(v);
4636
4606
  });
4637
4607
  function isInstanceOfRegisteredClass(potentialClass, superJson) {
4638
- if (potentialClass?.constructor) {
4639
- const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
4640
- return isRegistered;
4641
- }
4608
+ if (potentialClass?.constructor) return !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
4642
4609
  return false;
4643
4610
  }
4644
4611
  const classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
4645
- const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
4646
- return ["class", identifier];
4612
+ return ["class", superJson.classRegistry.getIdentifier(clazz.constructor)];
4647
4613
  }, (clazz, superJson) => {
4648
4614
  const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
4649
4615
  if (!allowedProps) return { ...clazz };
@@ -4660,11 +4626,9 @@ const classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, s
4660
4626
  const customRule = compositeTransformation((value, superJson) => {
4661
4627
  return !!superJson.customTransformerRegistry.findApplicable(value);
4662
4628
  }, (value, superJson) => {
4663
- const transformer = superJson.customTransformerRegistry.findApplicable(value);
4664
- return ["custom", transformer.name];
4629
+ return ["custom", superJson.customTransformerRegistry.findApplicable(value).name];
4665
4630
  }, (value, superJson) => {
4666
- const transformer = superJson.customTransformerRegistry.findApplicable(value);
4667
- return transformer.serialize(value);
4631
+ return superJson.customTransformerRegistry.findApplicable(value).serialize(value);
4668
4632
  }, (v, a, superJson) => {
4669
4633
  const transformer = superJson.customTransformerRegistry.findByName(a[1]);
4670
4634
  if (!transformer) throw new Error("Trying to deserialize unknown custom value");
@@ -4687,7 +4651,6 @@ const transformValue = (value, superJson) => {
4687
4651
  value: applicableSimpleRule.transform(value, superJson),
4688
4652
  type: applicableSimpleRule.annotation
4689
4653
  };
4690
- return void 0;
4691
4654
  };
4692
4655
  const simpleRulesByAnnotation = {};
4693
4656
  simpleRules.forEach((rule) => {
@@ -4759,8 +4722,7 @@ const setDeep = (object, path, mapper) => {
4759
4722
  const row = +key;
4760
4723
  parent = getNthKey(parent, row);
4761
4724
  } else if (isMap(parent)) {
4762
- const isEnd = i === path.length - 2;
4763
- if (isEnd) break;
4725
+ if (i === path.length - 2) break;
4764
4726
  const row = +key;
4765
4727
  const type = +path[++i] === 0 ? "key" : "value";
4766
4728
  const keyOfRow = getNthKey(parent, row);
@@ -4788,8 +4750,7 @@ const setDeep = (object, path, mapper) => {
4788
4750
  if (isMap(parent)) {
4789
4751
  const row = +path[path.length - 2];
4790
4752
  const keyToRow = getNthKey(parent, row);
4791
- const type = +lastKey === 0 ? "key" : "value";
4792
- switch (type) {
4753
+ switch (+lastKey === 0 ? "key" : "value") {
4793
4754
  case "key": {
4794
4755
  const newKey = mapper(keyToRow);
4795
4756
  parent.set(newKey, parent.get(keyToRow));
@@ -5276,8 +5237,7 @@ function createIframeServerChannel() {
5276
5237
  };
5277
5238
  return {
5278
5239
  post: (data) => {
5279
- const iframe = getIframeServerContext();
5280
- iframe?.contentWindow?.postMessage(SuperJSON.stringify({
5240
+ getIframeServerContext()?.contentWindow?.postMessage(SuperJSON.stringify({
5281
5241
  event: __DEVTOOLS_KIT_IFRAME_MESSAGING_EVENT_KEY,
5282
5242
  data
5283
5243
  }), "*");
@@ -5479,11 +5439,10 @@ function getDateDetails(val) {
5479
5439
  } };
5480
5440
  }
5481
5441
  function getMapDetails(val) {
5482
- const list = Object.fromEntries(val);
5483
5442
  return { _custom: {
5484
5443
  type: "map",
5485
5444
  displayText: "Map",
5486
- value: list,
5445
+ value: Object.fromEntries(val),
5487
5446
  readOnly: true,
5488
5447
  fields: { abstract: true }
5489
5448
  } };
@@ -5605,8 +5564,7 @@ function tryGetRefValue(ref) {
5605
5564
  }
5606
5565
  function getObjectDetails(object) {
5607
5566
  const info = getSetupStateType(object);
5608
- const isState = info.ref || info.computed || info.reactive;
5609
- if (isState) {
5567
+ if (info.ref || info.computed || info.reactive) {
5610
5568
  const stateTypeName = info.computed ? "Computed" : info.ref ? "Ref" : info.reactive ? "Reactive" : null;
5611
5569
  const value = toRaw(info.reactive ? object : tryGetRefValue(object));
5612
5570
  const raw = ensurePropertyExists(object, "effect") ? object.effect?.raw?.toString() || object.effect?.fn?.toString() : null;
@@ -5788,8 +5746,7 @@ function stringifyStrictCircularAutoChunks(data, replacer = null, space = null)
5788
5746
  }
5789
5747
  function parseCircularAutoChunks(data, reviver$1 = null) {
5790
5748
  if (Array.isArray(data)) data = data.join("");
5791
- const hasCircular = /^\s/.test(data);
5792
- if (!hasCircular) return arguments.length === 1 ? JSON.parse(data) : JSON.parse(data, reviver$1);
5749
+ if (!/^\s/.test(data)) return arguments.length === 1 ? JSON.parse(data) : JSON.parse(data, reviver$1);
5793
5750
  else {
5794
5751
  const list = JSON.parse(data);
5795
5752
  decode(list, reviver$1);
package/dist/index.d.cts CHANGED
@@ -244,8 +244,16 @@ interface DevToolsState {
244
244
  perfUniqueGroupId: number;
245
245
  timelineLayersState: Record<string, boolean>;
246
246
  }
247
- declare const callStateUpdatedHook: (state: DevToolsState) => Promise<void>;
248
- declare const callConnectedUpdatedHook: (state: DevToolsState, oldState: DevToolsState) => Promise<void>;
247
+ declare const callStateUpdatedHook: ((state: DevToolsState) => Promise<void>) & {
248
+ cancel: () => void;
249
+ flush: () => Promise<void> | undefined;
250
+ isPending: () => boolean;
251
+ };
252
+ declare const callConnectedUpdatedHook: ((state: DevToolsState, oldState: DevToolsState) => Promise<void>) & {
253
+ cancel: () => void;
254
+ flush: () => Promise<void> | undefined;
255
+ isPending: () => boolean;
256
+ };
249
257
  declare const devtoolsAppRecords: DevToolsAppRecords[] & {
250
258
  value: DevToolsAppRecords[];
251
259
  };
@@ -554,7 +562,11 @@ interface DevToolsKitInspector {
554
562
  appRecord: unknown;
555
563
  }
556
564
  declare const devtoolsInspector: DevToolsKitInspector[];
557
- declare const callInspectorUpdatedHook: () => Promise<void>;
565
+ declare const callInspectorUpdatedHook: (() => Promise<void>) & {
566
+ cancel: () => void;
567
+ flush: () => Promise<void> | undefined;
568
+ isPending: () => boolean;
569
+ };
558
570
  declare function addInspector(inspector: CustomInspectorOptions, descriptor: PluginDescriptor): void;
559
571
  declare function getActiveInspectors(): {
560
572
  id: string;
package/dist/index.d.ts CHANGED
@@ -244,8 +244,16 @@ interface DevToolsState {
244
244
  perfUniqueGroupId: number;
245
245
  timelineLayersState: Record<string, boolean>;
246
246
  }
247
- declare const callStateUpdatedHook: (state: DevToolsState) => Promise<void>;
248
- declare const callConnectedUpdatedHook: (state: DevToolsState, oldState: DevToolsState) => Promise<void>;
247
+ declare const callStateUpdatedHook: ((state: DevToolsState) => Promise<void>) & {
248
+ cancel: () => void;
249
+ flush: () => Promise<void> | undefined;
250
+ isPending: () => boolean;
251
+ };
252
+ declare const callConnectedUpdatedHook: ((state: DevToolsState, oldState: DevToolsState) => Promise<void>) & {
253
+ cancel: () => void;
254
+ flush: () => Promise<void> | undefined;
255
+ isPending: () => boolean;
256
+ };
249
257
  declare const devtoolsAppRecords: DevToolsAppRecords[] & {
250
258
  value: DevToolsAppRecords[];
251
259
  };
@@ -554,7 +562,11 @@ interface DevToolsKitInspector {
554
562
  appRecord: unknown;
555
563
  }
556
564
  declare const devtoolsInspector: DevToolsKitInspector[];
557
- declare const callInspectorUpdatedHook: () => Promise<void>;
565
+ declare const callInspectorUpdatedHook: (() => Promise<void>) & {
566
+ cancel: () => void;
567
+ flush: () => Promise<void> | undefined;
568
+ isPending: () => boolean;
569
+ };
558
570
  declare function addInspector(inspector: CustomInspectorOptions, descriptor: PluginDescriptor): void;
559
571
  declare function getActiveInspectors(): {
560
572
  id: string;
package/dist/index.js CHANGED
@@ -127,8 +127,7 @@ function returnError(cb) {
127
127
  }
128
128
  function getComponentInstance(appRecord, instanceId) {
129
129
  instanceId = instanceId || `${appRecord.id}:root`;
130
- const instance = appRecord.instanceMap.get(instanceId);
131
- return instance || appRecord.instanceMap.get(":root");
130
+ return appRecord.instanceMap.get(instanceId) || appRecord.instanceMap.get(":root");
132
131
  }
133
132
  function ensurePropertyExists(obj, key, skipObjCheck = false) {
134
133
  return skipObjCheck ? key in obj : typeof obj === "object" && obj !== null ? key in obj : false;
@@ -317,8 +316,7 @@ function highlight(instance) {
317
316
  const bounds = getComponentBoundingRect(instance);
318
317
  if (!bounds.width && !bounds.height) return;
319
318
  const name = getInstanceName(instance);
320
- const container = getContainerElement();
321
- container ? update({
319
+ getContainerElement() ? update({
322
320
  bounds,
323
321
  name
324
322
  }) : create({
@@ -337,12 +335,10 @@ function inspectFn(e) {
337
335
  const instance = target$1.__vueParentComponent;
338
336
  if (instance) {
339
337
  inspectInstance = instance;
340
- const el = instance.vnode.el;
341
- if (el) {
338
+ if (instance.vnode.el) {
342
339
  const bounds = getComponentBoundingRect(instance);
343
340
  const name = getInstanceName(instance);
344
- const container = getContainerElement();
345
- container ? update({
341
+ getContainerElement() ? update({
346
342
  bounds,
347
343
  name
348
344
  }) : create({
@@ -515,7 +511,9 @@ const Fragment = Symbol.for("v-fgt");
515
511
  //#endregion
516
512
  //#region src/core/component/state/editor.ts
517
513
  var StateEditor = class {
518
- refEditor = new RefStateEditor();
514
+ constructor() {
515
+ this.refEditor = new RefStateEditor();
516
+ }
519
517
  set(object, path, value, cb) {
520
518
  const sections = Array.isArray(path) ? path : path.split(".");
521
519
  while (sections.length > 1) {
@@ -733,12 +731,10 @@ function getInspector(id, app) {
733
731
  return devtoolsInspector.find((inspector) => inspector.options.id === id && (app ? inspector.descriptor.app === app : true));
734
732
  }
735
733
  function getInspectorActions(id) {
736
- const inspector = getInspector(id);
737
- return inspector?.options.actions;
734
+ return getInspector(id)?.options.actions;
738
735
  }
739
736
  function getInspectorNodeActions(id) {
740
- const inspector = getInspector(id);
741
- return inspector?.options.nodeActions;
737
+ return getInspector(id)?.options.nodeActions;
742
738
  }
743
739
 
744
740
  //#endregion
@@ -842,13 +838,12 @@ function createDevToolsCtxHooks() {
842
838
  addTimelineLayer(options, plugin.descriptor);
843
839
  });
844
840
  hooks$1.hook(DevToolsContextHookKeys.TIMELINE_EVENT_ADDED, ({ options, plugin }) => {
845
- const internalLayerIds = [
841
+ if (devtoolsState.highPerfModeEnabled || !devtoolsState.timelineLayersState?.[plugin.descriptor.id] && ![
846
842
  "performance",
847
843
  "component-event",
848
844
  "keyboard",
849
845
  "mouse"
850
- ];
851
- if (devtoolsState.highPerfModeEnabled || !devtoolsState.timelineLayersState?.[plugin.descriptor.id] && !internalLayerIds.includes(options.layerId)) return;
846
+ ].includes(options.layerId)) return;
852
847
  hooks$1.callHookWith(async (callbacks) => {
853
848
  await Promise.all(callbacks.map((cb) => cb(options)));
854
849
  }, DevToolsMessagingHookKeys.SEND_TIMELINE_EVENT_TO_CLIENT);
@@ -857,16 +852,13 @@ function createDevToolsCtxHooks() {
857
852
  const appRecord = app.__VUE_DEVTOOLS_NEXT_APP_RECORD__;
858
853
  if (!appRecord) return null;
859
854
  const appId = appRecord.id.toString();
860
- const instances = [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
861
- return instances;
855
+ return [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
862
856
  });
863
857
  hooks$1.hook(DevToolsContextHookKeys.GET_COMPONENT_BOUNDS, async ({ instance }) => {
864
- const bounds = getComponentBoundingRect(instance);
865
- return bounds;
858
+ return getComponentBoundingRect(instance);
866
859
  });
867
860
  hooks$1.hook(DevToolsContextHookKeys.GET_COMPONENT_NAME, ({ instance }) => {
868
- const name = getInstanceName(instance);
869
- return name;
861
+ return getInstanceName(instance);
870
862
  });
871
863
  hooks$1.hook(DevToolsContextHookKeys.COMPONENT_HIGHLIGHT, ({ uid }) => {
872
864
  const instance = activeAppRecord.value.instanceMap.get(uid);
@@ -1075,8 +1067,7 @@ function getPluginLocalKey(pluginId) {
1075
1067
  return `__VUE_DEVTOOLS_NEXT_PLUGIN_SETTINGS__${pluginId}__`;
1076
1068
  }
1077
1069
  function getPluginSettingsOptions(pluginId) {
1078
- const item = devtoolsPluginBuffer.find((item$1) => item$1[0].id === pluginId && !!item$1[0]?.settings)?.[0] ?? null;
1079
- return item?.settings ?? null;
1070
+ return (devtoolsPluginBuffer.find((item) => item[0].id === pluginId && !!item[0]?.settings)?.[0] ?? null)?.settings ?? null;
1080
1071
  }
1081
1072
  function getPluginSettings(pluginId, fallbackValue) {
1082
1073
  const localKey = getPluginLocalKey(pluginId);
@@ -1092,8 +1083,7 @@ function getPluginSettings(pluginId, fallbackValue) {
1092
1083
  }
1093
1084
  function initPluginSettings(pluginId, settings) {
1094
1085
  const localKey = getPluginLocalKey(pluginId);
1095
- const localSettings = localStorage.getItem(localKey);
1096
- if (!localSettings) localStorage.setItem(localKey, JSON.stringify(_getSettings(settings)));
1086
+ if (!localStorage.getItem(localKey)) localStorage.setItem(localKey, JSON.stringify(_getSettings(settings)));
1097
1087
  }
1098
1088
  function setPluginSettings(pluginId, key, value) {
1099
1089
  const localKey = getPluginLocalKey(pluginId);
@@ -1251,8 +1241,6 @@ const hook = {
1251
1241
  //#endregion
1252
1242
  //#region src/api/v6/index.ts
1253
1243
  var DevToolsV6PluginAPI = class {
1254
- plugin;
1255
- hooks;
1256
1244
  constructor({ plugin, ctx }) {
1257
1245
  this.hooks = ctx.hooks;
1258
1246
  this.plugin = plugin;
@@ -1653,11 +1641,10 @@ function processSetupState(instance) {
1653
1641
  editable: isState && !info.readonly
1654
1642
  };
1655
1643
  }
1656
- const type = isOtherType ? "setup (other)" : "setup";
1657
1644
  return {
1658
1645
  key,
1659
1646
  value,
1660
- type,
1647
+ type: isOtherType ? "setup (other)" : "setup",
1661
1648
  ...result
1662
1649
  };
1663
1650
  });
@@ -1778,7 +1765,6 @@ function getInstanceState(params) {
1778
1765
  //#endregion
1779
1766
  //#region src/core/component/tree/filter.ts
1780
1767
  var ComponentFilter = class {
1781
- filter;
1782
1768
  constructor(filter) {
1783
1769
  this.filter = filter || "";
1784
1770
  }
@@ -1800,12 +1786,8 @@ function createComponentFilter(filterText) {
1800
1786
  //#endregion
1801
1787
  //#region src/core/component/tree/walker.ts
1802
1788
  var ComponentWalker = class {
1803
- maxDepth;
1804
- recursively;
1805
- componentFilter;
1806
- api;
1807
- captureIds = /* @__PURE__ */ new Map();
1808
1789
  constructor(options) {
1790
+ this.captureIds = /* @__PURE__ */ new Map();
1809
1791
  const { filterText = "", maxDepth, recursively, api } = options;
1810
1792
  this.componentFilter = createComponentFilter(filterText);
1811
1793
  this.maxDepth = maxDepth;
@@ -1877,8 +1859,7 @@ var ComponentWalker = class {
1877
1859
  if (node) treeNode.children.push(node);
1878
1860
  }
1879
1861
  }
1880
- const rootElements = getRootElementsFromComponentInstance(instance);
1881
- const firstElement = rootElements[0];
1862
+ const firstElement = getRootElementsFromComponentInstance(instance)[0];
1882
1863
  if (firstElement?.parentElement) {
1883
1864
  const parentInstance = instance.parent;
1884
1865
  const parentRootElements = parentInstance ? getRootElementsFromComponentInstance(parentInstance) : [];
@@ -2199,15 +2180,12 @@ function createComponentsDevToolsPlugin(app) {
2199
2180
  api.on.getInspectorTree(async (payload) => {
2200
2181
  if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
2201
2182
  const instance = getComponentInstance(activeAppRecord.value, payload.instanceId);
2202
- if (instance) {
2203
- const walker$1 = new ComponentWalker({
2204
- filterText: payload.filter,
2205
- maxDepth: 100,
2206
- recursively: false,
2207
- api
2208
- });
2209
- payload.rootNodes = await walker$1.getComponentTree(instance);
2210
- }
2183
+ if (instance) payload.rootNodes = await new ComponentWalker({
2184
+ filterText: payload.filter,
2185
+ maxDepth: 100,
2186
+ recursively: false,
2187
+ api
2188
+ }).getComponentTree(instance);
2211
2189
  }
2212
2190
  });
2213
2191
  api.on.getInspectorState(async (payload) => {
@@ -4169,15 +4147,13 @@ function initDevTools() {
4169
4147
  callDevToolsPluginSetupFn([pluginDescriptor, setupFn], app);
4170
4148
  });
4171
4149
  onLegacyDevToolsPluginApiAvailable(() => {
4172
- const normalizedPluginBuffer = devtoolsPluginBuffer.filter(([item]) => item.id !== "components");
4173
- normalizedPluginBuffer.forEach(([pluginDescriptor, setupFn]) => {
4150
+ devtoolsPluginBuffer.filter(([item]) => item.id !== "components").forEach(([pluginDescriptor, setupFn]) => {
4174
4151
  _devtoolsHook.emit(DevToolsHooks.SETUP_DEVTOOLS_PLUGIN, pluginDescriptor, setupFn, { target: "legacy" });
4175
4152
  });
4176
4153
  });
4177
4154
  hook.on.vueAppInit(async (app, version, types) => {
4178
- const appRecord = createAppRecord(app, types);
4179
4155
  const normalizedAppRecord = {
4180
- ...appRecord,
4156
+ ...createAppRecord(app, types),
4181
4157
  app,
4182
4158
  version
4183
4159
  };
@@ -4257,7 +4233,7 @@ function reviveMap(val) {
4257
4233
  return result;
4258
4234
  }
4259
4235
  function revive(val) {
4260
- if (val === UNDEFINED) return void 0;
4236
+ if (val === UNDEFINED) return;
4261
4237
  else if (val === INFINITY) return Number.POSITIVE_INFINITY;
4262
4238
  else if (val === NEGATIVE_INFINITY) return Number.NEGATIVE_INFINITY;
4263
4239
  else if (val === NAN) return NaN;
@@ -4306,10 +4282,8 @@ function formatInspectorStateValue(value, quotes = false, options) {
4306
4282
  const type = getInspectorStateValueType(value, false);
4307
4283
  if (type !== "custom" && value?._custom) value = value._custom.value;
4308
4284
  if (result = internalStateTokenToString(value)) return result;
4309
- else if (type === "custom") {
4310
- const nestedName = value._custom.value?._custom && formatInspectorStateValue(value._custom.value, quotes, options);
4311
- return nestedName || value._custom.displayText || value._custom.display;
4312
- } else if (type === "array") return `Array[${value.length}]`;
4285
+ else if (type === "custom") return value._custom.value?._custom && formatInspectorStateValue(value._custom.value, quotes, options) || value._custom.displayText || value._custom.display;
4286
+ else if (type === "array") return `Array[${value.length}]`;
4313
4287
  else if (type === "plain-object") return `Object${Object.keys(value).length ? "" : " (empty)"}`;
4314
4288
  else if (type?.includes("native")) return escape(specialTypeRE.exec(value)?.[2]);
4315
4289
  else if (typeof value === "string") {
@@ -4450,7 +4424,6 @@ function find(record, predicate) {
4450
4424
  const value = valuesNotNever[i];
4451
4425
  if (predicate(value)) return value;
4452
4426
  }
4453
- return void 0;
4454
4427
  }
4455
4428
  function forEach(record, run) {
4456
4429
  Object.entries(record).forEach(([key, value]) => run(value, key));
@@ -4463,7 +4436,6 @@ function findArr(record, predicate) {
4463
4436
  const value = record[i];
4464
4437
  if (predicate(value)) return value;
4465
4438
  }
4466
- return void 0;
4467
4439
  }
4468
4440
 
4469
4441
  //#endregion
@@ -4521,14 +4493,12 @@ const parsePath = (string) => {
4521
4493
  let segment = "";
4522
4494
  for (let i = 0; i < string.length; i++) {
4523
4495
  let char = string.charAt(i);
4524
- const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
4525
- if (isEscapedDot) {
4496
+ if (char === "\\" && string.charAt(i + 1) === ".") {
4526
4497
  segment += ".";
4527
4498
  i++;
4528
4499
  continue;
4529
4500
  }
4530
- const isEndOfSegment = char === ".";
4531
- if (isEndOfSegment) {
4501
+ if (char === ".") {
4532
4502
  result.push(segment);
4533
4503
  segment = "";
4534
4504
  continue;
@@ -4602,14 +4572,10 @@ function compositeTransformation(isApplicable, annotation, transform, untransfor
4602
4572
  };
4603
4573
  }
4604
4574
  const symbolRule = compositeTransformation((s, superJson) => {
4605
- if (isSymbol(s)) {
4606
- const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
4607
- return isRegistered;
4608
- }
4575
+ if (isSymbol(s)) return !!superJson.symbolRegistry.getIdentifier(s);
4609
4576
  return false;
4610
4577
  }, (s, superJson) => {
4611
- const identifier = superJson.symbolRegistry.getIdentifier(s);
4612
- return ["symbol", identifier];
4578
+ return ["symbol", superJson.symbolRegistry.getIdentifier(s)];
4613
4579
  }, (v) => v.description, (_, a, superJson) => {
4614
4580
  const value = superJson.symbolRegistry.getValue(a[1]);
4615
4581
  if (!value) throw new Error("Trying to deserialize unknown symbol");
@@ -4635,15 +4601,11 @@ const typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-arra
4635
4601
  return new ctor(v);
4636
4602
  });
4637
4603
  function isInstanceOfRegisteredClass(potentialClass, superJson) {
4638
- if (potentialClass?.constructor) {
4639
- const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
4640
- return isRegistered;
4641
- }
4604
+ if (potentialClass?.constructor) return !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
4642
4605
  return false;
4643
4606
  }
4644
4607
  const classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
4645
- const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
4646
- return ["class", identifier];
4608
+ return ["class", superJson.classRegistry.getIdentifier(clazz.constructor)];
4647
4609
  }, (clazz, superJson) => {
4648
4610
  const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
4649
4611
  if (!allowedProps) return { ...clazz };
@@ -4660,11 +4622,9 @@ const classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, s
4660
4622
  const customRule = compositeTransformation((value, superJson) => {
4661
4623
  return !!superJson.customTransformerRegistry.findApplicable(value);
4662
4624
  }, (value, superJson) => {
4663
- const transformer = superJson.customTransformerRegistry.findApplicable(value);
4664
- return ["custom", transformer.name];
4625
+ return ["custom", superJson.customTransformerRegistry.findApplicable(value).name];
4665
4626
  }, (value, superJson) => {
4666
- const transformer = superJson.customTransformerRegistry.findApplicable(value);
4667
- return transformer.serialize(value);
4627
+ return superJson.customTransformerRegistry.findApplicable(value).serialize(value);
4668
4628
  }, (v, a, superJson) => {
4669
4629
  const transformer = superJson.customTransformerRegistry.findByName(a[1]);
4670
4630
  if (!transformer) throw new Error("Trying to deserialize unknown custom value");
@@ -4687,7 +4647,6 @@ const transformValue = (value, superJson) => {
4687
4647
  value: applicableSimpleRule.transform(value, superJson),
4688
4648
  type: applicableSimpleRule.annotation
4689
4649
  };
4690
- return void 0;
4691
4650
  };
4692
4651
  const simpleRulesByAnnotation = {};
4693
4652
  simpleRules.forEach((rule) => {
@@ -4759,8 +4718,7 @@ const setDeep = (object, path, mapper) => {
4759
4718
  const row = +key;
4760
4719
  parent = getNthKey(parent, row);
4761
4720
  } else if (isMap(parent)) {
4762
- const isEnd = i === path.length - 2;
4763
- if (isEnd) break;
4721
+ if (i === path.length - 2) break;
4764
4722
  const row = +key;
4765
4723
  const type = +path[++i] === 0 ? "key" : "value";
4766
4724
  const keyOfRow = getNthKey(parent, row);
@@ -4788,8 +4746,7 @@ const setDeep = (object, path, mapper) => {
4788
4746
  if (isMap(parent)) {
4789
4747
  const row = +path[path.length - 2];
4790
4748
  const keyToRow = getNthKey(parent, row);
4791
- const type = +lastKey === 0 ? "key" : "value";
4792
- switch (type) {
4749
+ switch (+lastKey === 0 ? "key" : "value") {
4793
4750
  case "key": {
4794
4751
  const newKey = mapper(keyToRow);
4795
4752
  parent.set(newKey, parent.get(keyToRow));
@@ -5276,8 +5233,7 @@ function createIframeServerChannel() {
5276
5233
  };
5277
5234
  return {
5278
5235
  post: (data) => {
5279
- const iframe = getIframeServerContext();
5280
- iframe?.contentWindow?.postMessage(SuperJSON.stringify({
5236
+ getIframeServerContext()?.contentWindow?.postMessage(SuperJSON.stringify({
5281
5237
  event: __DEVTOOLS_KIT_IFRAME_MESSAGING_EVENT_KEY,
5282
5238
  data
5283
5239
  }), "*");
@@ -5479,11 +5435,10 @@ function getDateDetails(val) {
5479
5435
  } };
5480
5436
  }
5481
5437
  function getMapDetails(val) {
5482
- const list = Object.fromEntries(val);
5483
5438
  return { _custom: {
5484
5439
  type: "map",
5485
5440
  displayText: "Map",
5486
- value: list,
5441
+ value: Object.fromEntries(val),
5487
5442
  readOnly: true,
5488
5443
  fields: { abstract: true }
5489
5444
  } };
@@ -5605,8 +5560,7 @@ function tryGetRefValue(ref) {
5605
5560
  }
5606
5561
  function getObjectDetails(object) {
5607
5562
  const info = getSetupStateType(object);
5608
- const isState = info.ref || info.computed || info.reactive;
5609
- if (isState) {
5563
+ if (info.ref || info.computed || info.reactive) {
5610
5564
  const stateTypeName = info.computed ? "Computed" : info.ref ? "Ref" : info.reactive ? "Reactive" : null;
5611
5565
  const value = toRaw(info.reactive ? object : tryGetRefValue(object));
5612
5566
  const raw = ensurePropertyExists(object, "effect") ? object.effect?.raw?.toString() || object.effect?.fn?.toString() : null;
@@ -5788,8 +5742,7 @@ function stringifyStrictCircularAutoChunks(data, replacer = null, space = null)
5788
5742
  }
5789
5743
  function parseCircularAutoChunks(data, reviver$1 = null) {
5790
5744
  if (Array.isArray(data)) data = data.join("");
5791
- const hasCircular = /^\s/.test(data);
5792
- if (!hasCircular) return arguments.length === 1 ? JSON.parse(data) : JSON.parse(data, reviver$1);
5745
+ if (!/^\s/.test(data)) return arguments.length === 1 ? JSON.parse(data) : JSON.parse(data, reviver$1);
5793
5746
  else {
5794
5747
  const list = JSON.parse(data);
5795
5748
  decode(list, reviver$1);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue/devtools-kit",
3
3
  "type": "module",
4
- "version": "8.0.1",
4
+ "version": "8.0.2",
5
5
  "author": "webfansplz",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -26,14 +26,14 @@
26
26
  "birpc": "^2.5.0",
27
27
  "hookable": "^5.5.3",
28
28
  "mitt": "^3.0.1",
29
- "perfect-debounce": "^1.0.0",
29
+ "perfect-debounce": "^2.0.0",
30
30
  "speakingurl": "^14.0.1",
31
31
  "superjson": "^2.2.2",
32
- "@vue/devtools-shared": "^8.0.1"
32
+ "@vue/devtools-shared": "^8.0.2"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/speakingurl": "^13.0.6",
36
- "vue": "^3.5.18",
36
+ "vue": "^3.5.21",
37
37
  "vue-router": "^4.5.1"
38
38
  },
39
39
  "scripts": {