@vue/devtools-kit 7.1.3 → 7.2.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/dist/index.cjs CHANGED
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target10) => (target10 = 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_@microsoft+api-extractor@7.43.0_@types+node@20.12.7__postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.0_@types+node@20.12.12__postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.0_@types+node@20.12.7__postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.0_@types+node@20.12.12__postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -1873,9 +1873,6 @@ function setupExternalPlugin(plugin, app, api) {
1873
1873
  const [pluginDescriptor, setupFn] = plugin;
1874
1874
  if (pluginDescriptor.app !== app)
1875
1875
  return;
1876
- if (pluginDescriptor.packageName === "vue-query") {
1877
- return;
1878
- }
1879
1876
  if (pluginDescriptor.packageName === "vue-router") {
1880
1877
  const id = getRouterDevToolsId(`${pluginDescriptor.id}`);
1881
1878
  if (pluginDescriptor.app === app) {
@@ -1885,10 +1882,26 @@ function setupExternalPlugin(plugin, app, api) {
1885
1882
  }));
1886
1883
  }
1887
1884
  }
1888
- setupFn(api);
1885
+ const extendedApi = new Proxy(api, {
1886
+ get(target10, prop, receiver) {
1887
+ if (prop === "getSettings") {
1888
+ return function() {
1889
+ const _settings = {};
1890
+ Object.keys(pluginDescriptor.settings).forEach((key) => {
1891
+ _settings[key] = pluginDescriptor.settings[key].defaultValue;
1892
+ });
1893
+ return _settings;
1894
+ };
1895
+ }
1896
+ return Reflect.get(target10, prop, receiver);
1897
+ },
1898
+ set(target10, prop, value, receiver) {
1899
+ return Reflect.set(target10, prop, value, receiver);
1900
+ }
1901
+ });
1902
+ setupFn(extendedApi);
1889
1903
  }
1890
- function registerPlugin(app, api) {
1891
- devtoolsState.pluginBuffer.forEach((plugin) => setupExternalPlugin(plugin, app, api));
1904
+ function updatePluginDetectives() {
1892
1905
  devtoolsAppRecords.value = devtoolsAppRecords.value.map((record) => {
1893
1906
  var _a10, _b10;
1894
1907
  const globalProperties = (_b10 = (_a10 = record.app) == null ? void 0 : _a10.config) == null ? void 0 : _b10.globalProperties;
@@ -1897,13 +1910,20 @@ function registerPlugin(app, api) {
1897
1910
  return {
1898
1911
  ...record,
1899
1912
  moduleDetectives: {
1913
+ vueQuery: !!getInspector("vue-query"),
1914
+ veeValidate: !!getInspector("vee-validate-inspector"),
1900
1915
  vueRouter: !!globalProperties.$router,
1901
1916
  pinia: !!globalProperties.$pinia,
1902
- vueI18n: !!globalProperties.$i18n
1917
+ vueI18n: !!globalProperties.$i18n,
1918
+ vuex: !!globalProperties.$store
1903
1919
  }
1904
1920
  };
1905
1921
  });
1906
1922
  }
1923
+ function registerPlugin(app, api) {
1924
+ devtoolsState.pluginBuffer.forEach((plugin) => setupExternalPlugin(plugin, app, api));
1925
+ updatePluginDetectives();
1926
+ }
1907
1927
 
1908
1928
  // src/plugins/index.ts
1909
1929
  init_cjs_shims();
@@ -2542,8 +2562,8 @@ var vueBuiltins = /* @__PURE__ */ new Set([
2542
2562
  "withModifiers"
2543
2563
  ]);
2544
2564
  var symbolRE = /^\[native Symbol Symbol\((.*)\)\]$/;
2545
- var rawTypeRE = /^\[object (\w+)]$/;
2546
- var specialTypeRE = /^\[native (\w+) (.*?)(<>((.|\s)*))?\]$/;
2565
+ var rawTypeRE = /^\[object (\w+)\]$/;
2566
+ var specialTypeRE = /^\[native (\w+) (.*?)(<>(([\s\S])*))?\]$/;
2547
2567
  var fnTypeRE = /^(?:function|class) (\w+)/;
2548
2568
  var MAX_STRING_SIZE = 1e4;
2549
2569
  var MAX_ARRAY_SIZE = 5e3;
@@ -3416,7 +3436,7 @@ function getSetDetails(val) {
3416
3436
  }
3417
3437
  };
3418
3438
  }
3419
- function getCatchedGetters(store) {
3439
+ function getCaughtGetters(store) {
3420
3440
  const getters = {};
3421
3441
  const origGetters = store.getters || {};
3422
3442
  const keys = Object.keys(origGetters);
@@ -3461,7 +3481,7 @@ function getStoreDetails(store) {
3461
3481
  displayText: "Store",
3462
3482
  value: {
3463
3483
  state: store.state,
3464
- getters: getCatchedGetters(store)
3484
+ getters: getCaughtGetters(store)
3465
3485
  },
3466
3486
  fields: {
3467
3487
  abstract: true
@@ -4011,6 +4031,8 @@ var on2 = {
4011
4031
  visitComponentTree(fn) {
4012
4032
  registerInstanceHook("component-tree:visit" /* VISIT_COMPONENT_TREE */, fn);
4013
4033
  },
4034
+ setPluginSettings() {
4035
+ },
4014
4036
  getInspectorTree(fn) {
4015
4037
  registerInstanceHook("inspector-tree:get" /* GET_INSPECTOR_TREE */, fn);
4016
4038
  },
@@ -4080,8 +4102,41 @@ var DevToolsPluginApi = class {
4080
4102
  id: payload.id,
4081
4103
  nodeId: "",
4082
4104
  filter: "",
4083
- treeFilterPlaceholder: payload.treeFilterPlaceholder || ""
4105
+ treeFilterPlaceholder: payload.treeFilterPlaceholder || "",
4106
+ actions: payload.actions || [],
4107
+ nodeActions: payload.nodeActions || []
4084
4108
  });
4109
+ updatePluginDetectives();
4110
+ }
4111
+ // get inspector node action
4112
+ getInspectorNodeActions(inspectorId) {
4113
+ var _a10;
4114
+ const inspector = getInspector(inspectorId);
4115
+ return ((_a10 = inspector == null ? void 0 : inspector.nodeActions) == null ? void 0 : _a10.map(({ icon, tooltip }) => ({ icon, tooltip }))) || [];
4116
+ }
4117
+ // call inspector node action
4118
+ callInspectorNodeAction(inspectorId, actionIndex, nodeId) {
4119
+ var _a10;
4120
+ const inspector = getInspector(inspectorId);
4121
+ if (inspector && inspector.nodeActions) {
4122
+ const item = inspector.nodeActions[actionIndex];
4123
+ (_a10 = item.action) == null ? void 0 : _a10.call(item, nodeId);
4124
+ }
4125
+ }
4126
+ // get inspector action
4127
+ getInspectorActions(inspectorId) {
4128
+ var _a10;
4129
+ const inspector = getInspector(inspectorId);
4130
+ return ((_a10 = inspector == null ? void 0 : inspector.actions) == null ? void 0 : _a10.map(({ icon, tooltip }) => ({ icon, tooltip }))) || [];
4131
+ }
4132
+ // call inspector action
4133
+ callInspectorAction(inspectorId, actionIndex, nodeId) {
4134
+ var _a10;
4135
+ const inspector = getInspector(inspectorId);
4136
+ if (inspector && inspector.actions) {
4137
+ const item = inspector.actions[actionIndex];
4138
+ (_a10 = item.action) == null ? void 0 : _a10.call(item, nodeId);
4139
+ }
4085
4140
  }
4086
4141
  highlightElement(instance) {
4087
4142
  highlight(instance);
@@ -4119,14 +4174,17 @@ var DevToolsPluginApi = class {
4119
4174
  inspectorId,
4120
4175
  nodeId
4121
4176
  };
4177
+ const ctx = {
4178
+ currentTab: `custom-inspector:${inspectorId}`
4179
+ };
4122
4180
  updateInspector(inspectorId, {
4123
4181
  nodeId
4124
4182
  });
4125
4183
  apiHooks.callHookWith((callbacks) => {
4126
- callbacks.forEach((cb) => cb(_payload));
4184
+ callbacks.forEach((cb) => cb(_payload, ctx));
4127
4185
  }, "inspector-state:get" /* GET_INSPECTOR_STATE */);
4128
4186
  const state = _payload.state;
4129
- delete state.instance;
4187
+ state == null ? true : delete state.instance;
4130
4188
  return state;
4131
4189
  }
4132
4190
  async editInspectorState(payload) {
@@ -4177,11 +4235,6 @@ var DevToolsPluginApi = class {
4177
4235
  now() {
4178
4236
  return now();
4179
4237
  }
4180
- getSettings() {
4181
- return {
4182
- logStoreChanges: null
4183
- };
4184
- }
4185
4238
  // #endregion compatible with old devtools
4186
4239
  // #region highlighter
4187
4240
  toggleComponentInspector(...params) {
@@ -4395,7 +4448,7 @@ var devtoolsAppRecords = new Proxy(devtoolsState.appRecords, {
4395
4448
  }
4396
4449
  });
4397
4450
  var _a8, _b8;
4398
- var appRecordInfo = (_b8 = (_a8 = import_devtools_shared13.target).__VUE_DEVTOOLS_NEXT_APP_RECROD_INFO__) != null ? _b8 : _a8.__VUE_DEVTOOLS_NEXT_APP_RECROD_INFO__ = {
4451
+ var appRecordInfo = (_b8 = (_a8 = import_devtools_shared13.target).__VUE_DEVTOOLS_NEXT_APP_RECORD_INFO__) != null ? _b8 : _a8.__VUE_DEVTOOLS_NEXT_APP_RECORD_INFO__ = {
4399
4452
  id: 0,
4400
4453
  appIds: /* @__PURE__ */ new Set()
4401
4454
  };
@@ -4420,7 +4473,7 @@ function setDevToolsEnv(env) {
4420
4473
  // src/compat/index.ts
4421
4474
  init_cjs_shims();
4422
4475
  var import_devtools_shared15 = require("@vue/devtools-shared");
4423
- function onLegacyDevToolsPluginApiAvailabled(cb) {
4476
+ function onLegacyDevToolsPluginApiAvailable(cb) {
4424
4477
  if (import_devtools_shared15.target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__) {
4425
4478
  cb();
4426
4479
  return;
@@ -4455,7 +4508,7 @@ function initDevTools() {
4455
4508
  return;
4456
4509
  setupExternalPlugin([pluginDescriptor, setupFn], app, api);
4457
4510
  });
4458
- onLegacyDevToolsPluginApiAvailabled(() => {
4511
+ onLegacyDevToolsPluginApiAvailable(() => {
4459
4512
  const normalizedPluginBuffer = devtoolsState.pluginBuffer.filter(([item]) => item.id !== "components");
4460
4513
  normalizedPluginBuffer.forEach(([pluginDescriptor, setupFn]) => {
4461
4514
  import_devtools_shared16.target.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, pluginDescriptor, setupFn, { target: "legacy" });
@@ -4473,7 +4526,7 @@ function initDevTools() {
4473
4526
  api
4474
4527
  }
4475
4528
  ];
4476
- if (devtoolsAppRecords.value.length === 1) {
4529
+ if (devtoolsAppRecords.value.length >= 1) {
4477
4530
  await setActiveAppRecord(devtoolsAppRecords.value[0]);
4478
4531
  devtoolsState.connected = true;
4479
4532
  devtoolsHooks.callHook("app:connected" /* APP_CONNECTED */);
@@ -4481,6 +4534,10 @@ function initDevTools() {
4481
4534
  });
4482
4535
  hook.on.vueAppUnmount(async (app) => {
4483
4536
  const activeRecords = devtoolsAppRecords.value.filter((appRecord) => appRecord.app !== app);
4537
+ if (activeRecords.length === 0) {
4538
+ devtoolsState.connected = false;
4539
+ return;
4540
+ }
4484
4541
  devtoolsAppRecords.value = activeRecords;
4485
4542
  if (devtoolsAppRecords.active.app === app)
4486
4543
  await setActiveAppRecord(activeRecords[0]);
package/dist/index.d.cts CHANGED
@@ -45,6 +45,16 @@ interface Inspector {
45
45
  nodeId: string;
46
46
  filter: string;
47
47
  treeFilterPlaceholder: string;
48
+ actions?: {
49
+ icon: string;
50
+ tooltip: string;
51
+ action: (payload: unknown) => void;
52
+ }[];
53
+ nodeActions?: {
54
+ icon: string;
55
+ tooltip: string;
56
+ action: (payload: unknown) => void;
57
+ }[];
48
58
  }
49
59
  interface InspectorApiPayload {
50
60
  id: string;
@@ -56,6 +66,11 @@ interface InspectorApiPayload {
56
66
  tooltip: string;
57
67
  action: (payload: unknown) => void;
58
68
  }[];
69
+ nodeActions?: {
70
+ icon: string;
71
+ tooltip: string;
72
+ action: (payload: unknown) => void;
73
+ }[];
59
74
  }
60
75
  declare function addInspector(payload: Inspector): void;
61
76
  declare function getInspector(inspectorId: string): Inspector | undefined;
@@ -152,8 +167,11 @@ interface AppRecord {
152
167
  api?: PluginApi;
153
168
  routerId?: string;
154
169
  moduleDetectives?: {
170
+ vueQuery: boolean;
155
171
  vueRouter: boolean;
172
+ veeValidate: boolean;
156
173
  pinia: boolean;
174
+ vuex: boolean;
157
175
  vueI18n: boolean;
158
176
  };
159
177
  }
@@ -365,6 +383,12 @@ interface InspectorTreeApiPayload {
365
383
  instanceId?: string;
366
384
  rootNodes?: ComponentTreeNode[];
367
385
  }
386
+ interface InspectorTree {
387
+ id: string;
388
+ label: string;
389
+ tags?: InspectorNodeTag[];
390
+ children?: InspectorTree[];
391
+ }
368
392
 
369
393
  interface ComponentBoundingRect {
370
394
  left: number;
@@ -397,6 +421,7 @@ interface InspectorState {
397
421
  key: string;
398
422
  value: string | number | boolean | null | Record<string, unknown> | InspectorCustomState | Array<unknown>;
399
423
  type: string;
424
+ path?: string[];
400
425
  stateType?: string;
401
426
  stateTypeName?: string;
402
427
  meta?: Record<string, boolean | string>;
@@ -517,7 +542,9 @@ interface DevToolsEvent {
517
542
  inspectorId: string;
518
543
  data: InspectorTreeApiPayload['rootNodes'];
519
544
  }) => void;
520
- [DevToolsEvents.GET_INSPECTOR_STATE]: (payload: InspectorStateApiPayload) => Promise<void>;
545
+ [DevToolsEvents.GET_INSPECTOR_STATE]: (payload: InspectorStateApiPayload, ctx: {
546
+ currentTab: string;
547
+ }) => Promise<void>;
521
548
  [DevToolsEvents.EDIT_INSPECTOR_STATE]: (payload: InspectorStateEditorPayload) => Promise<void>;
522
549
  [DevToolsEvents.SEND_INSPECTOR_STATE]: (payload: string) => void;
523
550
  [DevToolsEvents.VISIT_COMPONENT_TREE]: (payload: {
@@ -536,6 +563,7 @@ declare const on: {
536
563
  readonly addTimelineEvent: (fn: DevToolsEvent[DevToolsEvents.ADD_TIMELINE_EVENT]) => void;
537
564
  readonly inspectComponent: (fn: DevToolsEvent[DevToolsEvents.COMPONENT_STATE_INSPECT]) => void;
538
565
  readonly visitComponentTree: (fn: DevToolsEvent[DevToolsEvents.VISIT_COMPONENT_TREE]) => void;
566
+ readonly setPluginSettings: () => void;
539
567
  readonly getInspectorTree: (fn: DevToolsEvent[DevToolsEvents.GET_INSPECTOR_TREE]) => void;
540
568
  readonly getInspectorState: (fn: DevToolsEvent[DevToolsEvents.GET_INSPECTOR_STATE]) => void;
541
569
  readonly sendInspectorTree: (fn: DevToolsEvent[DevToolsEvents.SEND_INSPECTOR_TREE]) => void;
@@ -561,6 +589,16 @@ declare class DevToolsPluginApi {
561
589
  addTimelineLayer(payload: TimelineLayerItem): void;
562
590
  addTimelineEvent(...params: DevToolsEventParams<DevToolsEvents.ADD_TIMELINE_EVENT>): void;
563
591
  addInspector(payload: InspectorApiPayload): void;
592
+ getInspectorNodeActions(inspectorId: string): {
593
+ icon: string;
594
+ tooltip: string;
595
+ }[];
596
+ callInspectorNodeAction(inspectorId: string, actionIndex: number, nodeId: string): void;
597
+ getInspectorActions(inspectorId: string): {
598
+ icon: string;
599
+ tooltip: string;
600
+ }[];
601
+ callInspectorAction(inspectorId: string, actionIndex: number, nodeId: string): void;
564
602
  highlightElement(instance: VueAppInstance): void;
565
603
  unhighlightElement(): void;
566
604
  getInspectorTree(payload?: DevToolsEventParams<DevToolsEvents.GET_INSPECTOR_TREE>[0]): Promise<ComponentTreeNode[]>;
@@ -575,9 +613,6 @@ declare class DevToolsPluginApi {
575
613
  visitComponentTree(...params: DevToolsEventParams<DevToolsEvents.VISIT_COMPONENT_TREE>): void;
576
614
  notifyComponentUpdate(): void;
577
615
  now(): number;
578
- getSettings(): {
579
- logStoreChanges: null;
580
- };
581
616
  toggleComponentInspector(...params: DevToolsEventParams<DevToolsEvents.TOGGLE_COMPONENT_HIGHLIGHTER>): void;
582
617
  inspectComponentInspector(): Promise<string>;
583
618
  cancelInspectComponentInspector(): void;
@@ -644,4 +679,4 @@ declare const devtools: {
644
679
  readonly api: DevToolsPluginApi;
645
680
  };
646
681
 
647
- export { type AddInspectorApiPayload, type AppRecord, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentHighLighterOptions, type ComponentInspector, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, type DevToolsContext, type DevToolsEnv, type DevToolsEvent$1 as DevToolsEvent, type DevToolsHook, DevToolsHooks, type DevToolsState, type DevToolsType, INFINITY, type Inspector, type InspectorApiPayload, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTreeApiPayload, NAN, NEGATIVE_INFINITY, type OpenInEditorOptions, type PluginApi, type PluginDescriptor, type PluginSettingsItem, type PluginSetupFunction, type PropPath, type RouterInfo, type ScrollToComponentOptions, type TimelineEvent, type TimelineLayerItem, UNDEFINED, type VueAppInstance, type VueHooks, addCustomCommand, addCustomTab, addInspector, addTimelineLayer, cancelInspectComponentHighLighter, type customTypeEnums, devtools, formatInspectorStateValue, getComponentInspector, getInspector, getInspectorStateValueType, getRaw, getTimelineLayer, highlight, inspectComponentHighLighter, isPlainObject, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, removeCustomCommand, scrollToComponent, setDevToolsEnv, setOpenInEditorBaseUrl, setupDevToolsPlugin, stringify, toEdit, toSubmit, toggleComponentHighLighter, toggleComponentInspectorEnabled, toggleHighPerfMode, unhighlight, updateInspector };
682
+ export { type AddInspectorApiPayload, type AppRecord, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentHighLighterOptions, type ComponentInspector, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, type DevToolsContext, type DevToolsEnv, type DevToolsEvent$1 as DevToolsEvent, type DevToolsHook, DevToolsHooks, type DevToolsState, type DevToolsType, INFINITY, type Inspector, type InspectorApiPayload, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTree, type InspectorTreeApiPayload, NAN, NEGATIVE_INFINITY, type OpenInEditorOptions, type PluginApi, type PluginDescriptor, type PluginSettingsItem, type PluginSetupFunction, type PropPath, type RouterInfo, type ScrollToComponentOptions, type TimelineEvent, type TimelineLayerItem, UNDEFINED, type VueAppInstance, type VueHooks, addCustomCommand, addCustomTab, addInspector, addTimelineLayer, cancelInspectComponentHighLighter, type customTypeEnums, devtools, formatInspectorStateValue, getComponentInspector, getInspector, getInspectorStateValueType, getRaw, getTimelineLayer, highlight, inspectComponentHighLighter, isPlainObject, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, removeCustomCommand, scrollToComponent, setDevToolsEnv, setOpenInEditorBaseUrl, setupDevToolsPlugin, stringify, toEdit, toSubmit, toggleComponentHighLighter, toggleComponentInspectorEnabled, toggleHighPerfMode, unhighlight, updateInspector };
package/dist/index.d.ts CHANGED
@@ -45,6 +45,16 @@ interface Inspector {
45
45
  nodeId: string;
46
46
  filter: string;
47
47
  treeFilterPlaceholder: string;
48
+ actions?: {
49
+ icon: string;
50
+ tooltip: string;
51
+ action: (payload: unknown) => void;
52
+ }[];
53
+ nodeActions?: {
54
+ icon: string;
55
+ tooltip: string;
56
+ action: (payload: unknown) => void;
57
+ }[];
48
58
  }
49
59
  interface InspectorApiPayload {
50
60
  id: string;
@@ -56,6 +66,11 @@ interface InspectorApiPayload {
56
66
  tooltip: string;
57
67
  action: (payload: unknown) => void;
58
68
  }[];
69
+ nodeActions?: {
70
+ icon: string;
71
+ tooltip: string;
72
+ action: (payload: unknown) => void;
73
+ }[];
59
74
  }
60
75
  declare function addInspector(payload: Inspector): void;
61
76
  declare function getInspector(inspectorId: string): Inspector | undefined;
@@ -152,8 +167,11 @@ interface AppRecord {
152
167
  api?: PluginApi;
153
168
  routerId?: string;
154
169
  moduleDetectives?: {
170
+ vueQuery: boolean;
155
171
  vueRouter: boolean;
172
+ veeValidate: boolean;
156
173
  pinia: boolean;
174
+ vuex: boolean;
157
175
  vueI18n: boolean;
158
176
  };
159
177
  }
@@ -365,6 +383,12 @@ interface InspectorTreeApiPayload {
365
383
  instanceId?: string;
366
384
  rootNodes?: ComponentTreeNode[];
367
385
  }
386
+ interface InspectorTree {
387
+ id: string;
388
+ label: string;
389
+ tags?: InspectorNodeTag[];
390
+ children?: InspectorTree[];
391
+ }
368
392
 
369
393
  interface ComponentBoundingRect {
370
394
  left: number;
@@ -397,6 +421,7 @@ interface InspectorState {
397
421
  key: string;
398
422
  value: string | number | boolean | null | Record<string, unknown> | InspectorCustomState | Array<unknown>;
399
423
  type: string;
424
+ path?: string[];
400
425
  stateType?: string;
401
426
  stateTypeName?: string;
402
427
  meta?: Record<string, boolean | string>;
@@ -517,7 +542,9 @@ interface DevToolsEvent {
517
542
  inspectorId: string;
518
543
  data: InspectorTreeApiPayload['rootNodes'];
519
544
  }) => void;
520
- [DevToolsEvents.GET_INSPECTOR_STATE]: (payload: InspectorStateApiPayload) => Promise<void>;
545
+ [DevToolsEvents.GET_INSPECTOR_STATE]: (payload: InspectorStateApiPayload, ctx: {
546
+ currentTab: string;
547
+ }) => Promise<void>;
521
548
  [DevToolsEvents.EDIT_INSPECTOR_STATE]: (payload: InspectorStateEditorPayload) => Promise<void>;
522
549
  [DevToolsEvents.SEND_INSPECTOR_STATE]: (payload: string) => void;
523
550
  [DevToolsEvents.VISIT_COMPONENT_TREE]: (payload: {
@@ -536,6 +563,7 @@ declare const on: {
536
563
  readonly addTimelineEvent: (fn: DevToolsEvent[DevToolsEvents.ADD_TIMELINE_EVENT]) => void;
537
564
  readonly inspectComponent: (fn: DevToolsEvent[DevToolsEvents.COMPONENT_STATE_INSPECT]) => void;
538
565
  readonly visitComponentTree: (fn: DevToolsEvent[DevToolsEvents.VISIT_COMPONENT_TREE]) => void;
566
+ readonly setPluginSettings: () => void;
539
567
  readonly getInspectorTree: (fn: DevToolsEvent[DevToolsEvents.GET_INSPECTOR_TREE]) => void;
540
568
  readonly getInspectorState: (fn: DevToolsEvent[DevToolsEvents.GET_INSPECTOR_STATE]) => void;
541
569
  readonly sendInspectorTree: (fn: DevToolsEvent[DevToolsEvents.SEND_INSPECTOR_TREE]) => void;
@@ -561,6 +589,16 @@ declare class DevToolsPluginApi {
561
589
  addTimelineLayer(payload: TimelineLayerItem): void;
562
590
  addTimelineEvent(...params: DevToolsEventParams<DevToolsEvents.ADD_TIMELINE_EVENT>): void;
563
591
  addInspector(payload: InspectorApiPayload): void;
592
+ getInspectorNodeActions(inspectorId: string): {
593
+ icon: string;
594
+ tooltip: string;
595
+ }[];
596
+ callInspectorNodeAction(inspectorId: string, actionIndex: number, nodeId: string): void;
597
+ getInspectorActions(inspectorId: string): {
598
+ icon: string;
599
+ tooltip: string;
600
+ }[];
601
+ callInspectorAction(inspectorId: string, actionIndex: number, nodeId: string): void;
564
602
  highlightElement(instance: VueAppInstance): void;
565
603
  unhighlightElement(): void;
566
604
  getInspectorTree(payload?: DevToolsEventParams<DevToolsEvents.GET_INSPECTOR_TREE>[0]): Promise<ComponentTreeNode[]>;
@@ -575,9 +613,6 @@ declare class DevToolsPluginApi {
575
613
  visitComponentTree(...params: DevToolsEventParams<DevToolsEvents.VISIT_COMPONENT_TREE>): void;
576
614
  notifyComponentUpdate(): void;
577
615
  now(): number;
578
- getSettings(): {
579
- logStoreChanges: null;
580
- };
581
616
  toggleComponentInspector(...params: DevToolsEventParams<DevToolsEvents.TOGGLE_COMPONENT_HIGHLIGHTER>): void;
582
617
  inspectComponentInspector(): Promise<string>;
583
618
  cancelInspectComponentInspector(): void;
@@ -644,4 +679,4 @@ declare const devtools: {
644
679
  readonly api: DevToolsPluginApi;
645
680
  };
646
681
 
647
- export { type AddInspectorApiPayload, type AppRecord, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentHighLighterOptions, type ComponentInspector, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, type DevToolsContext, type DevToolsEnv, type DevToolsEvent$1 as DevToolsEvent, type DevToolsHook, DevToolsHooks, type DevToolsState, type DevToolsType, INFINITY, type Inspector, type InspectorApiPayload, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTreeApiPayload, NAN, NEGATIVE_INFINITY, type OpenInEditorOptions, type PluginApi, type PluginDescriptor, type PluginSettingsItem, type PluginSetupFunction, type PropPath, type RouterInfo, type ScrollToComponentOptions, type TimelineEvent, type TimelineLayerItem, UNDEFINED, type VueAppInstance, type VueHooks, addCustomCommand, addCustomTab, addInspector, addTimelineLayer, cancelInspectComponentHighLighter, type customTypeEnums, devtools, formatInspectorStateValue, getComponentInspector, getInspector, getInspectorStateValueType, getRaw, getTimelineLayer, highlight, inspectComponentHighLighter, isPlainObject, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, removeCustomCommand, scrollToComponent, setDevToolsEnv, setOpenInEditorBaseUrl, setupDevToolsPlugin, stringify, toEdit, toSubmit, toggleComponentHighLighter, toggleComponentInspectorEnabled, toggleHighPerfMode, unhighlight, updateInspector };
682
+ export { type AddInspectorApiPayload, type AppRecord, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentHighLighterOptions, type ComponentInspector, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, type DevToolsContext, type DevToolsEnv, type DevToolsEvent$1 as DevToolsEvent, type DevToolsHook, DevToolsHooks, type DevToolsState, type DevToolsType, INFINITY, type Inspector, type InspectorApiPayload, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTree, type InspectorTreeApiPayload, NAN, NEGATIVE_INFINITY, type OpenInEditorOptions, type PluginApi, type PluginDescriptor, type PluginSettingsItem, type PluginSetupFunction, type PropPath, type RouterInfo, type ScrollToComponentOptions, type TimelineEvent, type TimelineLayerItem, UNDEFINED, type VueAppInstance, type VueHooks, addCustomCommand, addCustomTab, addInspector, addTimelineLayer, cancelInspectComponentHighLighter, type customTypeEnums, devtools, formatInspectorStateValue, getComponentInspector, getInspector, getInspectorStateValueType, getRaw, getTimelineLayer, highlight, inspectComponentHighLighter, isPlainObject, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, removeCustomCommand, scrollToComponent, setDevToolsEnv, setOpenInEditorBaseUrl, setupDevToolsPlugin, stringify, toEdit, toSubmit, toggleComponentHighLighter, toggleComponentInspectorEnabled, toggleHighPerfMode, unhighlight, updateInspector };
package/dist/index.js CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target10) => (target10 = mod != null ? __create(
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.0_@types+node@20.12.7__postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.0_@types+node@20.12.12__postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.0_@types+node@20.12.7__postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.0_@types+node@20.12.12__postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -1840,9 +1840,6 @@ function setupExternalPlugin(plugin, app, api) {
1840
1840
  const [pluginDescriptor, setupFn] = plugin;
1841
1841
  if (pluginDescriptor.app !== app)
1842
1842
  return;
1843
- if (pluginDescriptor.packageName === "vue-query") {
1844
- return;
1845
- }
1846
1843
  if (pluginDescriptor.packageName === "vue-router") {
1847
1844
  const id = getRouterDevToolsId(`${pluginDescriptor.id}`);
1848
1845
  if (pluginDescriptor.app === app) {
@@ -1852,10 +1849,26 @@ function setupExternalPlugin(plugin, app, api) {
1852
1849
  }));
1853
1850
  }
1854
1851
  }
1855
- setupFn(api);
1852
+ const extendedApi = new Proxy(api, {
1853
+ get(target10, prop, receiver) {
1854
+ if (prop === "getSettings") {
1855
+ return function() {
1856
+ const _settings = {};
1857
+ Object.keys(pluginDescriptor.settings).forEach((key) => {
1858
+ _settings[key] = pluginDescriptor.settings[key].defaultValue;
1859
+ });
1860
+ return _settings;
1861
+ };
1862
+ }
1863
+ return Reflect.get(target10, prop, receiver);
1864
+ },
1865
+ set(target10, prop, value, receiver) {
1866
+ return Reflect.set(target10, prop, value, receiver);
1867
+ }
1868
+ });
1869
+ setupFn(extendedApi);
1856
1870
  }
1857
- function registerPlugin(app, api) {
1858
- devtoolsState.pluginBuffer.forEach((plugin) => setupExternalPlugin(plugin, app, api));
1871
+ function updatePluginDetectives() {
1859
1872
  devtoolsAppRecords.value = devtoolsAppRecords.value.map((record) => {
1860
1873
  var _a10, _b10;
1861
1874
  const globalProperties = (_b10 = (_a10 = record.app) == null ? void 0 : _a10.config) == null ? void 0 : _b10.globalProperties;
@@ -1864,13 +1877,20 @@ function registerPlugin(app, api) {
1864
1877
  return {
1865
1878
  ...record,
1866
1879
  moduleDetectives: {
1880
+ vueQuery: !!getInspector("vue-query"),
1881
+ veeValidate: !!getInspector("vee-validate-inspector"),
1867
1882
  vueRouter: !!globalProperties.$router,
1868
1883
  pinia: !!globalProperties.$pinia,
1869
- vueI18n: !!globalProperties.$i18n
1884
+ vueI18n: !!globalProperties.$i18n,
1885
+ vuex: !!globalProperties.$store
1870
1886
  }
1871
1887
  };
1872
1888
  });
1873
1889
  }
1890
+ function registerPlugin(app, api) {
1891
+ devtoolsState.pluginBuffer.forEach((plugin) => setupExternalPlugin(plugin, app, api));
1892
+ updatePluginDetectives();
1893
+ }
1874
1894
 
1875
1895
  // src/plugins/index.ts
1876
1896
  init_esm_shims();
@@ -2509,8 +2529,8 @@ var vueBuiltins = /* @__PURE__ */ new Set([
2509
2529
  "withModifiers"
2510
2530
  ]);
2511
2531
  var symbolRE = /^\[native Symbol Symbol\((.*)\)\]$/;
2512
- var rawTypeRE = /^\[object (\w+)]$/;
2513
- var specialTypeRE = /^\[native (\w+) (.*?)(<>((.|\s)*))?\]$/;
2532
+ var rawTypeRE = /^\[object (\w+)\]$/;
2533
+ var specialTypeRE = /^\[native (\w+) (.*?)(<>(([\s\S])*))?\]$/;
2514
2534
  var fnTypeRE = /^(?:function|class) (\w+)/;
2515
2535
  var MAX_STRING_SIZE = 1e4;
2516
2536
  var MAX_ARRAY_SIZE = 5e3;
@@ -3383,7 +3403,7 @@ function getSetDetails(val) {
3383
3403
  }
3384
3404
  };
3385
3405
  }
3386
- function getCatchedGetters(store) {
3406
+ function getCaughtGetters(store) {
3387
3407
  const getters = {};
3388
3408
  const origGetters = store.getters || {};
3389
3409
  const keys = Object.keys(origGetters);
@@ -3428,7 +3448,7 @@ function getStoreDetails(store) {
3428
3448
  displayText: "Store",
3429
3449
  value: {
3430
3450
  state: store.state,
3431
- getters: getCatchedGetters(store)
3451
+ getters: getCaughtGetters(store)
3432
3452
  },
3433
3453
  fields: {
3434
3454
  abstract: true
@@ -3978,6 +3998,8 @@ var on2 = {
3978
3998
  visitComponentTree(fn) {
3979
3999
  registerInstanceHook("component-tree:visit" /* VISIT_COMPONENT_TREE */, fn);
3980
4000
  },
4001
+ setPluginSettings() {
4002
+ },
3981
4003
  getInspectorTree(fn) {
3982
4004
  registerInstanceHook("inspector-tree:get" /* GET_INSPECTOR_TREE */, fn);
3983
4005
  },
@@ -4047,8 +4069,41 @@ var DevToolsPluginApi = class {
4047
4069
  id: payload.id,
4048
4070
  nodeId: "",
4049
4071
  filter: "",
4050
- treeFilterPlaceholder: payload.treeFilterPlaceholder || ""
4072
+ treeFilterPlaceholder: payload.treeFilterPlaceholder || "",
4073
+ actions: payload.actions || [],
4074
+ nodeActions: payload.nodeActions || []
4051
4075
  });
4076
+ updatePluginDetectives();
4077
+ }
4078
+ // get inspector node action
4079
+ getInspectorNodeActions(inspectorId) {
4080
+ var _a10;
4081
+ const inspector = getInspector(inspectorId);
4082
+ return ((_a10 = inspector == null ? void 0 : inspector.nodeActions) == null ? void 0 : _a10.map(({ icon, tooltip }) => ({ icon, tooltip }))) || [];
4083
+ }
4084
+ // call inspector node action
4085
+ callInspectorNodeAction(inspectorId, actionIndex, nodeId) {
4086
+ var _a10;
4087
+ const inspector = getInspector(inspectorId);
4088
+ if (inspector && inspector.nodeActions) {
4089
+ const item = inspector.nodeActions[actionIndex];
4090
+ (_a10 = item.action) == null ? void 0 : _a10.call(item, nodeId);
4091
+ }
4092
+ }
4093
+ // get inspector action
4094
+ getInspectorActions(inspectorId) {
4095
+ var _a10;
4096
+ const inspector = getInspector(inspectorId);
4097
+ return ((_a10 = inspector == null ? void 0 : inspector.actions) == null ? void 0 : _a10.map(({ icon, tooltip }) => ({ icon, tooltip }))) || [];
4098
+ }
4099
+ // call inspector action
4100
+ callInspectorAction(inspectorId, actionIndex, nodeId) {
4101
+ var _a10;
4102
+ const inspector = getInspector(inspectorId);
4103
+ if (inspector && inspector.actions) {
4104
+ const item = inspector.actions[actionIndex];
4105
+ (_a10 = item.action) == null ? void 0 : _a10.call(item, nodeId);
4106
+ }
4052
4107
  }
4053
4108
  highlightElement(instance) {
4054
4109
  highlight(instance);
@@ -4086,14 +4141,17 @@ var DevToolsPluginApi = class {
4086
4141
  inspectorId,
4087
4142
  nodeId
4088
4143
  };
4144
+ const ctx = {
4145
+ currentTab: `custom-inspector:${inspectorId}`
4146
+ };
4089
4147
  updateInspector(inspectorId, {
4090
4148
  nodeId
4091
4149
  });
4092
4150
  apiHooks.callHookWith((callbacks) => {
4093
- callbacks.forEach((cb) => cb(_payload));
4151
+ callbacks.forEach((cb) => cb(_payload, ctx));
4094
4152
  }, "inspector-state:get" /* GET_INSPECTOR_STATE */);
4095
4153
  const state = _payload.state;
4096
- delete state.instance;
4154
+ state == null ? true : delete state.instance;
4097
4155
  return state;
4098
4156
  }
4099
4157
  async editInspectorState(payload) {
@@ -4144,11 +4202,6 @@ var DevToolsPluginApi = class {
4144
4202
  now() {
4145
4203
  return now();
4146
4204
  }
4147
- getSettings() {
4148
- return {
4149
- logStoreChanges: null
4150
- };
4151
- }
4152
4205
  // #endregion compatible with old devtools
4153
4206
  // #region highlighter
4154
4207
  toggleComponentInspector(...params) {
@@ -4362,7 +4415,7 @@ var devtoolsAppRecords = new Proxy(devtoolsState.appRecords, {
4362
4415
  }
4363
4416
  });
4364
4417
  var _a8, _b8;
4365
- var appRecordInfo = (_b8 = (_a8 = target6).__VUE_DEVTOOLS_NEXT_APP_RECROD_INFO__) != null ? _b8 : _a8.__VUE_DEVTOOLS_NEXT_APP_RECROD_INFO__ = {
4418
+ var appRecordInfo = (_b8 = (_a8 = target6).__VUE_DEVTOOLS_NEXT_APP_RECORD_INFO__) != null ? _b8 : _a8.__VUE_DEVTOOLS_NEXT_APP_RECORD_INFO__ = {
4366
4419
  id: 0,
4367
4420
  appIds: /* @__PURE__ */ new Set()
4368
4421
  };
@@ -4387,7 +4440,7 @@ function setDevToolsEnv(env) {
4387
4440
  // src/compat/index.ts
4388
4441
  init_esm_shims();
4389
4442
  import { target as target8 } from "@vue/devtools-shared";
4390
- function onLegacyDevToolsPluginApiAvailabled(cb) {
4443
+ function onLegacyDevToolsPluginApiAvailable(cb) {
4391
4444
  if (target8.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__) {
4392
4445
  cb();
4393
4446
  return;
@@ -4422,7 +4475,7 @@ function initDevTools() {
4422
4475
  return;
4423
4476
  setupExternalPlugin([pluginDescriptor, setupFn], app, api);
4424
4477
  });
4425
- onLegacyDevToolsPluginApiAvailabled(() => {
4478
+ onLegacyDevToolsPluginApiAvailable(() => {
4426
4479
  const normalizedPluginBuffer = devtoolsState.pluginBuffer.filter(([item]) => item.id !== "components");
4427
4480
  normalizedPluginBuffer.forEach(([pluginDescriptor, setupFn]) => {
4428
4481
  target9.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, pluginDescriptor, setupFn, { target: "legacy" });
@@ -4440,7 +4493,7 @@ function initDevTools() {
4440
4493
  api
4441
4494
  }
4442
4495
  ];
4443
- if (devtoolsAppRecords.value.length === 1) {
4496
+ if (devtoolsAppRecords.value.length >= 1) {
4444
4497
  await setActiveAppRecord(devtoolsAppRecords.value[0]);
4445
4498
  devtoolsState.connected = true;
4446
4499
  devtoolsHooks.callHook("app:connected" /* APP_CONNECTED */);
@@ -4448,6 +4501,10 @@ function initDevTools() {
4448
4501
  });
4449
4502
  hook.on.vueAppUnmount(async (app) => {
4450
4503
  const activeRecords = devtoolsAppRecords.value.filter((appRecord) => appRecord.app !== app);
4504
+ if (activeRecords.length === 0) {
4505
+ devtoolsState.connected = false;
4506
+ return;
4507
+ }
4451
4508
  devtoolsAppRecords.value = activeRecords;
4452
4509
  if (devtoolsAppRecords.active.app === app)
4453
4510
  await setActiveAppRecord(activeRecords[0]);
package/global.d.ts CHANGED
@@ -5,7 +5,7 @@ declare global {
5
5
  var __VUE_DEVTOOLS_GLOBAL_HOOK__: DevToolsHook
6
6
  var __VUE_DEVTOOLS_GLOBAL_STATE__: DevToolsState
7
7
  var __VUE_DEVTOOLS_CONTEXT__: DevToolsContext
8
- var __VUE_DEVTOOLS_NEXT_APP_RECROD_INFO__: {
8
+ var __VUE_DEVTOOLS_NEXT_APP_RECORD_INFO__: {
9
9
  id: number
10
10
  appIds: Set<string>
11
11
  }
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@vue/devtools-kit",
3
3
  "type": "module",
4
- "version": "7.1.3",
4
+ "version": "7.2.0",
5
5
  "author": "webfansplz",
6
6
  "license": "MIT",
7
+ "repository": {
8
+ "directory": "packages/devtools-kit",
9
+ "type": "git",
10
+ "url": "git+https://github.com/vuejs/devtools-next.git"
11
+ },
7
12
  "exports": {
8
13
  ".": {
9
14
  "import": "./dist/index.js",
@@ -25,11 +30,11 @@
25
30
  "mitt": "^3.0.1",
26
31
  "perfect-debounce": "^1.0.0",
27
32
  "speakingurl": "^14.0.1",
28
- "@vue/devtools-shared": "^7.1.3"
33
+ "@vue/devtools-shared": "^7.2.0"
29
34
  },
30
35
  "devDependencies": {
31
36
  "@types/speakingurl": "^13.0.6",
32
- "vue": "^3.4.23",
37
+ "vue": "^3.4.27",
33
38
  "vue-router": "^4.3.2"
34
39
  },
35
40
  "scripts": {