@vue/devtools-kit 7.0.8 → 7.0.9

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
@@ -2070,7 +2070,8 @@ function formatInspectorStateValue(value, quotes = false) {
2070
2070
  if (result = internalStateTokenToString(value)) {
2071
2071
  return result;
2072
2072
  } else if (type === "custom") {
2073
- return (_a8 = value._custom.displayText) != null ? _a8 : value._custom.display;
2073
+ const nestedName = ((_a8 = value._custom.value) == null ? void 0 : _a8._custom) && formatInspectorStateValue(value._custom.value);
2074
+ return nestedName || value._custom.displayText || value._custom.display;
2074
2075
  } else if (type === "array") {
2075
2076
  return `Array[${value.length}]`;
2076
2077
  } else if (type === "plain-object") {
@@ -2090,13 +2091,14 @@ function formatInspectorStateValue(value, quotes = false) {
2090
2091
  return value;
2091
2092
  }
2092
2093
  function getRawValue(value) {
2093
- var _a8, _b8;
2094
+ var _a8, _b8, _c, _d;
2094
2095
  const isCustom = getInspectorStateValueType(value) === "custom";
2095
2096
  let inherit = {};
2096
2097
  if (isCustom) {
2097
2098
  const data = value;
2098
- inherit = ((_a8 = data._custom) == null ? void 0 : _a8.fields) || {};
2099
- value = (_b8 = data._custom) == null ? void 0 : _b8.value;
2099
+ const nestedCustom = typeof ((_a8 = data._custom) == null ? void 0 : _a8.value) === "object" && "_custom" in data._custom.value ? getRawValue((_b8 = data._custom) == null ? void 0 : _b8.value) : { inherit: void 0, value: void 0 };
2100
+ inherit = nestedCustom.inherit || ((_c = data._custom) == null ? void 0 : _c.fields) || {};
2101
+ value = nestedCustom.value || ((_d = data._custom) == null ? void 0 : _d.value);
2100
2102
  }
2101
2103
  if (value && value._isArray)
2102
2104
  value = value.items;
@@ -3102,7 +3104,8 @@ async function registerPlugin(options) {
3102
3104
  ...record,
3103
3105
  moduleDetectives: {
3104
3106
  vueRouter: !!globalProperties.$router,
3105
- pinia: !!globalProperties.$pinia
3107
+ pinia: !!globalProperties.$pinia,
3108
+ vueI18n: !!globalProperties.$i18n
3106
3109
  }
3107
3110
  };
3108
3111
  });
@@ -3856,6 +3859,17 @@ function toggleComponentInspector(options) {
3856
3859
  el.style.display = "none";
3857
3860
  }
3858
3861
  }
3862
+ function highlight(instance) {
3863
+ const bounds = getComponentBoundingRect(instance);
3864
+ const name = getInstanceName(instance);
3865
+ const container = getCotainerElement();
3866
+ container ? update({ bounds, name }) : create({ bounds, name });
3867
+ }
3868
+ function unhighlight() {
3869
+ const el = getCotainerElement();
3870
+ if (el)
3871
+ el.style.display = "none";
3872
+ }
3859
3873
  var inspectInstance = null;
3860
3874
  function inspectFn(e) {
3861
3875
  const target8 = e.target;
@@ -4080,6 +4094,18 @@ var DevToolsPluginApi = class {
4080
4094
  openInEditor(payload) {
4081
4095
  openInEditor(payload);
4082
4096
  }
4097
+ highlightElement(instance) {
4098
+ highlight(instance);
4099
+ }
4100
+ unhighlightElement() {
4101
+ unhighlight();
4102
+ }
4103
+ async getComponentInstances(app) {
4104
+ const appRecord = app.__VUE_DEVTOOLS_APP_RECORD__;
4105
+ const appId = appRecord.id.toString();
4106
+ const instances = [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
4107
+ return instances;
4108
+ }
4083
4109
  // Vite only
4084
4110
  getVueInspector() {
4085
4111
  return getVueInspector();
package/dist/index.d.cts CHANGED
@@ -42,7 +42,7 @@ interface InspectorCustomState {
42
42
  type?: string;
43
43
  displayText?: string;
44
44
  tooltipText?: string;
45
- value?: string;
45
+ value?: string | InspectorCustomState;
46
46
  stateTypeName?: string;
47
47
  fields?: {
48
48
  abstract?: boolean;
@@ -51,7 +51,7 @@ interface InspectorCustomState {
51
51
  }
52
52
  interface InspectorState {
53
53
  key: string;
54
- value: string | number | Record<string, unknown> | InspectorCustomState | Array<unknown>;
54
+ value: string | number | boolean | null | Record<string, unknown> | InspectorCustomState | Array<unknown>;
55
55
  type: string;
56
56
  stateType?: string;
57
57
  stateTypeName?: string;
@@ -355,6 +355,9 @@ declare class DevToolsPluginApi {
355
355
  removeCustomCommand(actionId: CustomCommand['id']): void;
356
356
  addInspector(payload: AddInspectorApiPayload): void;
357
357
  openInEditor(payload: OpenInEditorOptions): void;
358
+ highlightElement(instance: any): void;
359
+ unhighlightElement(): void;
360
+ getComponentInstances(app: any): Promise<any[]>;
358
361
  getVueInspector(): Promise<VueInspector>;
359
362
  visitComponentTree(payload: Parameters<DevToolsEvent[DevToolsEvents.VISIT_COMPONENT_TREE]>[0]): void;
360
363
  addTimelineLayer(payload: {
@@ -377,10 +380,7 @@ declare function addCustomTab(tab: CustomTab): void;
377
380
 
378
381
  declare function getInspectorStateValueType(value: any, raw?: boolean): string;
379
382
  declare function formatInspectorStateValue(value: any, quotes?: boolean): any;
380
- declare function getRawValue(value: InspectorState['value']): {
381
- value: string | number | Record<string, unknown> | unknown[] | InspectorCustomState;
382
- inherit: {};
383
- };
383
+ declare function getRawValue(value: InspectorState['value']): any;
384
384
 
385
385
  declare function stringify<T extends object = Record<string, unknown>>(data: T): string | string[];
386
386
  declare function parse(data: string, revive?: boolean): any;
package/dist/index.d.ts CHANGED
@@ -42,7 +42,7 @@ interface InspectorCustomState {
42
42
  type?: string;
43
43
  displayText?: string;
44
44
  tooltipText?: string;
45
- value?: string;
45
+ value?: string | InspectorCustomState;
46
46
  stateTypeName?: string;
47
47
  fields?: {
48
48
  abstract?: boolean;
@@ -51,7 +51,7 @@ interface InspectorCustomState {
51
51
  }
52
52
  interface InspectorState {
53
53
  key: string;
54
- value: string | number | Record<string, unknown> | InspectorCustomState | Array<unknown>;
54
+ value: string | number | boolean | null | Record<string, unknown> | InspectorCustomState | Array<unknown>;
55
55
  type: string;
56
56
  stateType?: string;
57
57
  stateTypeName?: string;
@@ -355,6 +355,9 @@ declare class DevToolsPluginApi {
355
355
  removeCustomCommand(actionId: CustomCommand['id']): void;
356
356
  addInspector(payload: AddInspectorApiPayload): void;
357
357
  openInEditor(payload: OpenInEditorOptions): void;
358
+ highlightElement(instance: any): void;
359
+ unhighlightElement(): void;
360
+ getComponentInstances(app: any): Promise<any[]>;
358
361
  getVueInspector(): Promise<VueInspector>;
359
362
  visitComponentTree(payload: Parameters<DevToolsEvent[DevToolsEvents.VISIT_COMPONENT_TREE]>[0]): void;
360
363
  addTimelineLayer(payload: {
@@ -377,10 +380,7 @@ declare function addCustomTab(tab: CustomTab): void;
377
380
 
378
381
  declare function getInspectorStateValueType(value: any, raw?: boolean): string;
379
382
  declare function formatInspectorStateValue(value: any, quotes?: boolean): any;
380
- declare function getRawValue(value: InspectorState['value']): {
381
- value: string | number | Record<string, unknown> | unknown[] | InspectorCustomState;
382
- inherit: {};
383
- };
383
+ declare function getRawValue(value: InspectorState['value']): any;
384
384
 
385
385
  declare function stringify<T extends object = Record<string, unknown>>(data: T): string | string[];
386
386
  declare function parse(data: string, revive?: boolean): any;
package/dist/index.mjs CHANGED
@@ -2035,7 +2035,8 @@ function formatInspectorStateValue(value, quotes = false) {
2035
2035
  if (result = internalStateTokenToString(value)) {
2036
2036
  return result;
2037
2037
  } else if (type === "custom") {
2038
- return (_a8 = value._custom.displayText) != null ? _a8 : value._custom.display;
2038
+ const nestedName = ((_a8 = value._custom.value) == null ? void 0 : _a8._custom) && formatInspectorStateValue(value._custom.value);
2039
+ return nestedName || value._custom.displayText || value._custom.display;
2039
2040
  } else if (type === "array") {
2040
2041
  return `Array[${value.length}]`;
2041
2042
  } else if (type === "plain-object") {
@@ -2055,13 +2056,14 @@ function formatInspectorStateValue(value, quotes = false) {
2055
2056
  return value;
2056
2057
  }
2057
2058
  function getRawValue(value) {
2058
- var _a8, _b8;
2059
+ var _a8, _b8, _c, _d;
2059
2060
  const isCustom = getInspectorStateValueType(value) === "custom";
2060
2061
  let inherit = {};
2061
2062
  if (isCustom) {
2062
2063
  const data = value;
2063
- inherit = ((_a8 = data._custom) == null ? void 0 : _a8.fields) || {};
2064
- value = (_b8 = data._custom) == null ? void 0 : _b8.value;
2064
+ const nestedCustom = typeof ((_a8 = data._custom) == null ? void 0 : _a8.value) === "object" && "_custom" in data._custom.value ? getRawValue((_b8 = data._custom) == null ? void 0 : _b8.value) : { inherit: void 0, value: void 0 };
2065
+ inherit = nestedCustom.inherit || ((_c = data._custom) == null ? void 0 : _c.fields) || {};
2066
+ value = nestedCustom.value || ((_d = data._custom) == null ? void 0 : _d.value);
2065
2067
  }
2066
2068
  if (value && value._isArray)
2067
2069
  value = value.items;
@@ -3067,7 +3069,8 @@ async function registerPlugin(options) {
3067
3069
  ...record,
3068
3070
  moduleDetectives: {
3069
3071
  vueRouter: !!globalProperties.$router,
3070
- pinia: !!globalProperties.$pinia
3072
+ pinia: !!globalProperties.$pinia,
3073
+ vueI18n: !!globalProperties.$i18n
3071
3074
  }
3072
3075
  };
3073
3076
  });
@@ -3821,6 +3824,17 @@ function toggleComponentInspector(options) {
3821
3824
  el.style.display = "none";
3822
3825
  }
3823
3826
  }
3827
+ function highlight(instance) {
3828
+ const bounds = getComponentBoundingRect(instance);
3829
+ const name = getInstanceName(instance);
3830
+ const container = getCotainerElement();
3831
+ container ? update({ bounds, name }) : create({ bounds, name });
3832
+ }
3833
+ function unhighlight() {
3834
+ const el = getCotainerElement();
3835
+ if (el)
3836
+ el.style.display = "none";
3837
+ }
3824
3838
  var inspectInstance = null;
3825
3839
  function inspectFn(e) {
3826
3840
  const target8 = e.target;
@@ -4045,6 +4059,18 @@ var DevToolsPluginApi = class {
4045
4059
  openInEditor(payload) {
4046
4060
  openInEditor(payload);
4047
4061
  }
4062
+ highlightElement(instance) {
4063
+ highlight(instance);
4064
+ }
4065
+ unhighlightElement() {
4066
+ unhighlight();
4067
+ }
4068
+ async getComponentInstances(app) {
4069
+ const appRecord = app.__VUE_DEVTOOLS_APP_RECORD__;
4070
+ const appId = appRecord.id.toString();
4071
+ const instances = [...appRecord.instanceMap].filter(([key]) => key.split(":")[0] === appId).map(([, instance]) => instance);
4072
+ return instances;
4073
+ }
4048
4074
  // Vite only
4049
4075
  getVueInspector() {
4050
4076
  return getVueInspector();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue/devtools-kit",
3
3
  "type": "module",
4
- "version": "7.0.8",
4
+ "version": "7.0.9",
5
5
  "author": "webfansplz",
6
6
  "license": "MIT",
7
7
  "exports": {
@@ -21,8 +21,8 @@
21
21
  "mitt": "^3.0.1",
22
22
  "perfect-debounce": "^1.0.0",
23
23
  "speakingurl": "^14.0.1",
24
- "@vue/devtools-schema": "^7.0.8",
25
- "@vue/devtools-shared": "^7.0.8"
24
+ "@vue/devtools-shared": "^7.0.9",
25
+ "@vue/devtools-schema": "^7.0.9"
26
26
  },
27
27
  "devDependencies": {
28
28
  "vue": "^3.4.4",