@vue/devtools-kit 7.6.4 → 7.6.5

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, target22) => (target22 = mod != null ? __create(
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.43.0_@types+node@22.9.0__@swc+core@1.5.29_jiti@2.0.0_po_lnt5yfvawfblpk67opvcdwbq7u/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.43.0_@types+node@22.10.0__@swc+core@1.5.29_jiti@2.0.0_p_lm6fffj5lkeoeahdikwtvgu66m/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.43.0_@types+node@22.9.0__@swc+core@1.5.29_jiti@2.0.0_po_lnt5yfvawfblpk67opvcdwbq7u/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.43.0_@types+node@22.10.0__@swc+core@1.5.29_jiti@2.0.0_p_lm6fffj5lkeoeahdikwtvgu66m/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -1695,28 +1695,11 @@ var import_devtools_shared19 = require("@vue/devtools-shared");
1695
1695
  init_cjs_shims();
1696
1696
  var import_devtools_shared17 = require("@vue/devtools-shared");
1697
1697
 
1698
- // src/core/component/state/editor.ts
1698
+ // src/core/component-highlighter/index.ts
1699
1699
  init_cjs_shims();
1700
1700
 
1701
- // src/shared/stub-vue.ts
1701
+ // src/core/component/state/bounding-rect.ts
1702
1702
  init_cjs_shims();
1703
- function isReadonly(value) {
1704
- return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
1705
- }
1706
- function isReactive(value) {
1707
- if (isReadonly(value)) {
1708
- return isReactive(value["__v_raw" /* RAW */]);
1709
- }
1710
- return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
1711
- }
1712
- function isRef(r) {
1713
- return !!(r && r.__v_isRef === true);
1714
- }
1715
- function toRaw(observed) {
1716
- const raw = observed && observed["__v_raw" /* RAW */];
1717
- return raw ? toRaw(raw) : observed;
1718
- }
1719
- var Fragment = Symbol.for("v-fgt");
1720
1703
 
1721
1704
  // src/core/component/utils/index.ts
1722
1705
  init_cjs_shims();
@@ -1829,178 +1812,7 @@ function ensurePropertyExists(obj, key, skipObjCheck = false) {
1829
1812
  return skipObjCheck ? key in obj : typeof obj === "object" && obj !== null ? key in obj : false;
1830
1813
  }
1831
1814
 
1832
- // src/core/component/state/editor.ts
1833
- var StateEditor = class {
1834
- constructor() {
1835
- this.refEditor = new RefStateEditor();
1836
- }
1837
- set(object, path, value, cb) {
1838
- const sections = Array.isArray(path) ? path : path.split(".");
1839
- const markRef = false;
1840
- while (sections.length > 1) {
1841
- const section = sections.shift();
1842
- if (object instanceof Map)
1843
- object = object.get(section);
1844
- if (object instanceof Set)
1845
- object = Array.from(object.values())[section];
1846
- else object = object[section];
1847
- if (this.refEditor.isRef(object))
1848
- object = this.refEditor.get(object);
1849
- }
1850
- const field = sections[0];
1851
- const item = this.refEditor.get(object)[field];
1852
- if (cb) {
1853
- cb(object, field, value);
1854
- } else {
1855
- if (this.refEditor.isRef(item))
1856
- this.refEditor.set(item, value);
1857
- else if (markRef)
1858
- object[field] = value;
1859
- else
1860
- object[field] = value;
1861
- }
1862
- }
1863
- get(object, path) {
1864
- const sections = Array.isArray(path) ? path : path.split(".");
1865
- for (let i = 0; i < sections.length; i++) {
1866
- if (object instanceof Map)
1867
- object = object.get(sections[i]);
1868
- else
1869
- object = object[sections[i]];
1870
- if (this.refEditor.isRef(object))
1871
- object = this.refEditor.get(object);
1872
- if (!object)
1873
- return void 0;
1874
- }
1875
- return object;
1876
- }
1877
- has(object, path, parent = false) {
1878
- if (typeof object === "undefined")
1879
- return false;
1880
- const sections = Array.isArray(path) ? path.slice() : path.split(".");
1881
- const size = !parent ? 1 : 2;
1882
- while (object && sections.length > size) {
1883
- const section = sections.shift();
1884
- object = object[section];
1885
- if (this.refEditor.isRef(object))
1886
- object = this.refEditor.get(object);
1887
- }
1888
- return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
1889
- }
1890
- createDefaultSetCallback(state) {
1891
- return (object, field, value) => {
1892
- if (state.remove || state.newKey) {
1893
- if (Array.isArray(object))
1894
- object.splice(field, 1);
1895
- else if (toRaw(object) instanceof Map)
1896
- object.delete(field);
1897
- else if (toRaw(object) instanceof Set)
1898
- object.delete(Array.from(object.values())[field]);
1899
- else Reflect.deleteProperty(object, field);
1900
- }
1901
- if (!state.remove) {
1902
- const target22 = object[state.newKey || field];
1903
- if (this.refEditor.isRef(target22))
1904
- this.refEditor.set(target22, value);
1905
- else if (toRaw(object) instanceof Map)
1906
- object.set(state.newKey || field, value);
1907
- else if (toRaw(object) instanceof Set)
1908
- object.add(value);
1909
- else
1910
- object[state.newKey || field] = value;
1911
- }
1912
- };
1913
- }
1914
- };
1915
- var RefStateEditor = class {
1916
- set(ref, value) {
1917
- if (isRef(ref)) {
1918
- ref.value = value;
1919
- } else {
1920
- if (ref instanceof Set && Array.isArray(value)) {
1921
- ref.clear();
1922
- value.forEach((v) => ref.add(v));
1923
- return;
1924
- }
1925
- const currentKeys = Object.keys(value);
1926
- if (ref instanceof Map) {
1927
- const previousKeysSet2 = new Set(ref.keys());
1928
- currentKeys.forEach((key) => {
1929
- ref.set(key, Reflect.get(value, key));
1930
- previousKeysSet2.delete(key);
1931
- });
1932
- previousKeysSet2.forEach((key) => ref.delete(key));
1933
- return;
1934
- }
1935
- const previousKeysSet = new Set(Object.keys(ref));
1936
- currentKeys.forEach((key) => {
1937
- Reflect.set(ref, key, Reflect.get(value, key));
1938
- previousKeysSet.delete(key);
1939
- });
1940
- previousKeysSet.forEach((key) => Reflect.deleteProperty(ref, key));
1941
- }
1942
- }
1943
- get(ref) {
1944
- return isRef(ref) ? ref.value : ref;
1945
- }
1946
- isRef(ref) {
1947
- return isRef(ref) || isReactive(ref);
1948
- }
1949
- };
1950
- async function editComponentState(payload, stateEditor2) {
1951
- const { path, nodeId, state, type } = payload;
1952
- const instance = getComponentInstance(activeAppRecord.value, nodeId);
1953
- if (!instance)
1954
- return;
1955
- const targetPath = path.slice();
1956
- let target22;
1957
- if (Object.keys(instance.props).includes(path[0])) {
1958
- target22 = instance.props;
1959
- } else if (instance.devtoolsRawSetupState && Object.keys(instance.devtoolsRawSetupState).includes(path[0])) {
1960
- target22 = instance.devtoolsRawSetupState;
1961
- } else if (instance.data && Object.keys(instance.data).includes(path[0])) {
1962
- target22 = instance.data;
1963
- } else {
1964
- target22 = instance.proxy;
1965
- }
1966
- if (target22 && targetPath) {
1967
- if (state.type === "object" && type === "reactive") {
1968
- }
1969
- stateEditor2.set(target22, targetPath, state.value, stateEditor2.createDefaultSetCallback(state));
1970
- }
1971
- }
1972
- var stateEditor = new StateEditor();
1973
- async function editState(payload) {
1974
- editComponentState(payload, stateEditor);
1975
- }
1976
-
1977
- // src/core/component/tree/el.ts
1978
- init_cjs_shims();
1979
- function getRootElementsFromComponentInstance(instance) {
1980
- if (isFragment(instance))
1981
- return getFragmentRootElements(instance.subTree);
1982
- if (!instance.subTree)
1983
- return [];
1984
- return [instance.subTree.el];
1985
- }
1986
- function getFragmentRootElements(vnode) {
1987
- if (!vnode.children)
1988
- return [];
1989
- const list = [];
1990
- vnode.children.forEach((childVnode) => {
1991
- if (childVnode.component)
1992
- list.push(...getRootElementsFromComponentInstance(childVnode.component));
1993
- else if (childVnode == null ? void 0 : childVnode.el)
1994
- list.push(childVnode.el);
1995
- });
1996
- return list;
1997
- }
1998
-
1999
- // src/core/component-highlighter/index.ts
2000
- init_cjs_shims();
2001
-
2002
1815
  // src/core/component/state/bounding-rect.ts
2003
- init_cjs_shims();
2004
1816
  function createRect() {
2005
1817
  const rect = {
2006
1818
  top: 0,
@@ -2078,6 +1890,28 @@ function getComponentBoundingRect(instance) {
2078
1890
  return DEFAULT_RECT;
2079
1891
  }
2080
1892
 
1893
+ // src/core/component/tree/el.ts
1894
+ init_cjs_shims();
1895
+ function getRootElementsFromComponentInstance(instance) {
1896
+ if (isFragment(instance))
1897
+ return getFragmentRootElements(instance.subTree);
1898
+ if (!instance.subTree)
1899
+ return [];
1900
+ return [instance.subTree.el];
1901
+ }
1902
+ function getFragmentRootElements(vnode) {
1903
+ if (!vnode.children)
1904
+ return [];
1905
+ const list = [];
1906
+ vnode.children.forEach((childVnode) => {
1907
+ if (childVnode.component)
1908
+ list.push(...getRootElementsFromComponentInstance(childVnode.component));
1909
+ else if (childVnode == null ? void 0 : childVnode.el)
1910
+ list.push(childVnode.el);
1911
+ });
1912
+ return list;
1913
+ }
1914
+
2081
1915
  // src/core/component-highlighter/index.ts
2082
1916
  var CONTAINER_ELEMENT_ID = "__vue-devtools-component-inspector__";
2083
1917
  var CARD_ELEMENT_ID = "__vue-devtools-component-inspector__card__";
@@ -2335,6 +2169,174 @@ function getComponentInspector() {
2335
2169
  });
2336
2170
  }
2337
2171
 
2172
+ // src/core/component/state/editor.ts
2173
+ init_cjs_shims();
2174
+
2175
+ // src/shared/stub-vue.ts
2176
+ init_cjs_shims();
2177
+ function isReadonly(value) {
2178
+ return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
2179
+ }
2180
+ function isReactive(value) {
2181
+ if (isReadonly(value)) {
2182
+ return isReactive(value["__v_raw" /* RAW */]);
2183
+ }
2184
+ return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
2185
+ }
2186
+ function isRef(r) {
2187
+ return !!(r && r.__v_isRef === true);
2188
+ }
2189
+ function toRaw(observed) {
2190
+ const raw = observed && observed["__v_raw" /* RAW */];
2191
+ return raw ? toRaw(raw) : observed;
2192
+ }
2193
+ var Fragment = Symbol.for("v-fgt");
2194
+
2195
+ // src/core/component/state/editor.ts
2196
+ var StateEditor = class {
2197
+ constructor() {
2198
+ this.refEditor = new RefStateEditor();
2199
+ }
2200
+ set(object, path, value, cb) {
2201
+ const sections = Array.isArray(path) ? path : path.split(".");
2202
+ const markRef = false;
2203
+ while (sections.length > 1) {
2204
+ const section = sections.shift();
2205
+ if (object instanceof Map)
2206
+ object = object.get(section);
2207
+ if (object instanceof Set)
2208
+ object = Array.from(object.values())[section];
2209
+ else object = object[section];
2210
+ if (this.refEditor.isRef(object))
2211
+ object = this.refEditor.get(object);
2212
+ }
2213
+ const field = sections[0];
2214
+ const item = this.refEditor.get(object)[field];
2215
+ if (cb) {
2216
+ cb(object, field, value);
2217
+ } else {
2218
+ if (this.refEditor.isRef(item))
2219
+ this.refEditor.set(item, value);
2220
+ else if (markRef)
2221
+ object[field] = value;
2222
+ else
2223
+ object[field] = value;
2224
+ }
2225
+ }
2226
+ get(object, path) {
2227
+ const sections = Array.isArray(path) ? path : path.split(".");
2228
+ for (let i = 0; i < sections.length; i++) {
2229
+ if (object instanceof Map)
2230
+ object = object.get(sections[i]);
2231
+ else
2232
+ object = object[sections[i]];
2233
+ if (this.refEditor.isRef(object))
2234
+ object = this.refEditor.get(object);
2235
+ if (!object)
2236
+ return void 0;
2237
+ }
2238
+ return object;
2239
+ }
2240
+ has(object, path, parent = false) {
2241
+ if (typeof object === "undefined")
2242
+ return false;
2243
+ const sections = Array.isArray(path) ? path.slice() : path.split(".");
2244
+ const size = !parent ? 1 : 2;
2245
+ while (object && sections.length > size) {
2246
+ const section = sections.shift();
2247
+ object = object[section];
2248
+ if (this.refEditor.isRef(object))
2249
+ object = this.refEditor.get(object);
2250
+ }
2251
+ return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
2252
+ }
2253
+ createDefaultSetCallback(state) {
2254
+ return (object, field, value) => {
2255
+ if (state.remove || state.newKey) {
2256
+ if (Array.isArray(object))
2257
+ object.splice(field, 1);
2258
+ else if (toRaw(object) instanceof Map)
2259
+ object.delete(field);
2260
+ else if (toRaw(object) instanceof Set)
2261
+ object.delete(Array.from(object.values())[field]);
2262
+ else Reflect.deleteProperty(object, field);
2263
+ }
2264
+ if (!state.remove) {
2265
+ const target22 = object[state.newKey || field];
2266
+ if (this.refEditor.isRef(target22))
2267
+ this.refEditor.set(target22, value);
2268
+ else if (toRaw(object) instanceof Map)
2269
+ object.set(state.newKey || field, value);
2270
+ else if (toRaw(object) instanceof Set)
2271
+ object.add(value);
2272
+ else
2273
+ object[state.newKey || field] = value;
2274
+ }
2275
+ };
2276
+ }
2277
+ };
2278
+ var RefStateEditor = class {
2279
+ set(ref, value) {
2280
+ if (isRef(ref)) {
2281
+ ref.value = value;
2282
+ } else {
2283
+ if (ref instanceof Set && Array.isArray(value)) {
2284
+ ref.clear();
2285
+ value.forEach((v) => ref.add(v));
2286
+ return;
2287
+ }
2288
+ const currentKeys = Object.keys(value);
2289
+ if (ref instanceof Map) {
2290
+ const previousKeysSet2 = new Set(ref.keys());
2291
+ currentKeys.forEach((key) => {
2292
+ ref.set(key, Reflect.get(value, key));
2293
+ previousKeysSet2.delete(key);
2294
+ });
2295
+ previousKeysSet2.forEach((key) => ref.delete(key));
2296
+ return;
2297
+ }
2298
+ const previousKeysSet = new Set(Object.keys(ref));
2299
+ currentKeys.forEach((key) => {
2300
+ Reflect.set(ref, key, Reflect.get(value, key));
2301
+ previousKeysSet.delete(key);
2302
+ });
2303
+ previousKeysSet.forEach((key) => Reflect.deleteProperty(ref, key));
2304
+ }
2305
+ }
2306
+ get(ref) {
2307
+ return isRef(ref) ? ref.value : ref;
2308
+ }
2309
+ isRef(ref) {
2310
+ return isRef(ref) || isReactive(ref);
2311
+ }
2312
+ };
2313
+ async function editComponentState(payload, stateEditor2) {
2314
+ const { path, nodeId, state, type } = payload;
2315
+ const instance = getComponentInstance(activeAppRecord.value, nodeId);
2316
+ if (!instance)
2317
+ return;
2318
+ const targetPath = path.slice();
2319
+ let target22;
2320
+ if (Object.keys(instance.props).includes(path[0])) {
2321
+ target22 = instance.props;
2322
+ } else if (instance.devtoolsRawSetupState && Object.keys(instance.devtoolsRawSetupState).includes(path[0])) {
2323
+ target22 = instance.devtoolsRawSetupState;
2324
+ } else if (instance.data && Object.keys(instance.data).includes(path[0])) {
2325
+ target22 = instance.data;
2326
+ } else {
2327
+ target22 = instance.proxy;
2328
+ }
2329
+ if (target22 && targetPath) {
2330
+ if (state.type === "object" && type === "reactive") {
2331
+ }
2332
+ stateEditor2.set(target22, targetPath, state.value, stateEditor2.createDefaultSetCallback(state));
2333
+ }
2334
+ }
2335
+ var stateEditor = new StateEditor();
2336
+ async function editState(payload) {
2337
+ editComponentState(payload, stateEditor);
2338
+ }
2339
+
2338
2340
  // src/core/open-in-editor/index.ts
2339
2341
  init_cjs_shims();
2340
2342
  var import_devtools_shared8 = require("@vue/devtools-shared");
@@ -3377,12 +3379,21 @@ function sanitize(data) {
3377
3379
  }
3378
3380
  }
3379
3381
  function getSetupStateType(raw) {
3380
- return {
3381
- ref: isRef2(raw),
3382
- computed: isComputed(raw),
3383
- reactive: isReactive2(raw),
3384
- readonly: isReadOnly(raw)
3385
- };
3382
+ try {
3383
+ return {
3384
+ ref: isRef2(raw),
3385
+ computed: isComputed(raw),
3386
+ reactive: isReactive2(raw),
3387
+ readonly: isReadOnly(raw)
3388
+ };
3389
+ } catch (e) {
3390
+ return {
3391
+ ref: false,
3392
+ computed: false,
3393
+ reactive: false,
3394
+ readonly: false
3395
+ };
3396
+ }
3386
3397
  }
3387
3398
  function toRaw2(value) {
3388
3399
  if (value == null ? void 0 : value.__v_raw)
@@ -3481,10 +3492,11 @@ function processSetupState(instance) {
3481
3492
  return Object.keys(instance.setupState).filter((key) => !vueBuiltins.has(key) && key.split(/(?=[A-Z])/)[0] !== "use").map((key) => {
3482
3493
  var _a25, _b25, _c, _d;
3483
3494
  const value = returnError(() => toRaw2(instance.setupState[key]));
3495
+ const accessError = value instanceof Error;
3484
3496
  const rawData = raw[key];
3485
3497
  let result;
3486
- let isOtherType = typeof value === "function" || ensurePropertyExists(value, "render") && typeof value.render === "function" || ensurePropertyExists(value, "__asyncLoader") && typeof value.__asyncLoader === "function" || typeof value === "object" && value && ("setup" in value || "props" in value) || /^v[A-Z]/.test(key);
3487
- if (rawData) {
3498
+ let isOtherType = accessError || typeof value === "function" || ensurePropertyExists(value, "render") && typeof value.render === "function" || ensurePropertyExists(value, "__asyncLoader") && typeof value.__asyncLoader === "function" || typeof value === "object" && value && ("setup" in value || "props" in value) || /^v[A-Z]/.test(key);
3499
+ if (rawData && !accessError) {
3488
3500
  const info = getSetupStateType(rawData);
3489
3501
  const { stateType, stateTypeName } = getStateTypeAndName(info);
3490
3502
  const isState = info.ref || info.computed || info.reactive;
package/dist/index.d.cts CHANGED
@@ -849,11 +849,6 @@ declare function callDevToolsPluginSetupFn(plugin: [PluginDescriptor, PluginSetu
849
849
  declare function removeRegisteredPluginApp(app: App): void;
850
850
  declare function registerDevToolsPlugin(app: App): void;
851
851
 
852
- declare const UNDEFINED = "__vue_devtool_undefined__";
853
- declare const INFINITY = "__vue_devtool_infinity__";
854
- declare const NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
855
- declare const NAN = "__vue_devtool_nan__";
856
-
857
852
  interface ComponentBoundingRect {
858
853
  left: number;
859
854
  top: number;
@@ -955,22 +950,6 @@ interface InspectorTree {
955
950
  children?: InspectorTree[];
956
951
  }
957
952
 
958
- declare function getInspectorStateValueType(value: any, raw?: boolean): string;
959
- declare function formatInspectorStateValue(value: any, quotes?: boolean, options?: {
960
- customClass?: Partial<Record<'string', string>>;
961
- }): any;
962
- declare function getRaw(value: InspectorState['value']): {
963
- value: object | string | number | boolean | null;
964
- inherit: Record<string, any> | {
965
- abstract: true;
966
- };
967
- customType?: customTypeEnums;
968
- };
969
- declare function toEdit(value: unknown, customType?: customTypeEnums): string;
970
- declare function toSubmit(value: string, customType?: customTypeEnums): any;
971
-
972
- declare function isPlainObject(obj: unknown): obj is object;
973
-
974
953
  interface ComponentHighLighterOptions {
975
954
  bounds: ComponentBoundingRect;
976
955
  name?: string;
@@ -988,6 +967,27 @@ declare function cancelInspectComponentHighLighter(): void;
988
967
  declare function inspectComponentHighLighter(): Promise<string>;
989
968
  declare function scrollToComponent(options: ScrollToComponentOptions): void;
990
969
 
970
+ declare const UNDEFINED = "__vue_devtool_undefined__";
971
+ declare const INFINITY = "__vue_devtool_infinity__";
972
+ declare const NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
973
+ declare const NAN = "__vue_devtool_nan__";
974
+
975
+ declare function getInspectorStateValueType(value: any, raw?: boolean): string;
976
+ declare function formatInspectorStateValue(value: any, quotes?: boolean, options?: {
977
+ customClass?: Partial<Record<'string', string>>;
978
+ }): any;
979
+ declare function getRaw(value: InspectorState['value']): {
980
+ value: object | string | number | boolean | null;
981
+ inherit: Record<string, any> | {
982
+ abstract: true;
983
+ };
984
+ customType?: customTypeEnums;
985
+ };
986
+ declare function toEdit(value: unknown, customType?: customTypeEnums): string;
987
+ declare function toSubmit(value: string, customType?: customTypeEnums): any;
988
+
989
+ declare function isPlainObject(obj: unknown): obj is object;
990
+
991
991
  declare function updateDevToolsClientDetected(params: Record<string, boolean>): void;
992
992
 
993
993
  interface EventEmitter$2 {
package/dist/index.d.ts CHANGED
@@ -849,11 +849,6 @@ declare function callDevToolsPluginSetupFn(plugin: [PluginDescriptor, PluginSetu
849
849
  declare function removeRegisteredPluginApp(app: App): void;
850
850
  declare function registerDevToolsPlugin(app: App): void;
851
851
 
852
- declare const UNDEFINED = "__vue_devtool_undefined__";
853
- declare const INFINITY = "__vue_devtool_infinity__";
854
- declare const NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
855
- declare const NAN = "__vue_devtool_nan__";
856
-
857
852
  interface ComponentBoundingRect {
858
853
  left: number;
859
854
  top: number;
@@ -955,22 +950,6 @@ interface InspectorTree {
955
950
  children?: InspectorTree[];
956
951
  }
957
952
 
958
- declare function getInspectorStateValueType(value: any, raw?: boolean): string;
959
- declare function formatInspectorStateValue(value: any, quotes?: boolean, options?: {
960
- customClass?: Partial<Record<'string', string>>;
961
- }): any;
962
- declare function getRaw(value: InspectorState['value']): {
963
- value: object | string | number | boolean | null;
964
- inherit: Record<string, any> | {
965
- abstract: true;
966
- };
967
- customType?: customTypeEnums;
968
- };
969
- declare function toEdit(value: unknown, customType?: customTypeEnums): string;
970
- declare function toSubmit(value: string, customType?: customTypeEnums): any;
971
-
972
- declare function isPlainObject(obj: unknown): obj is object;
973
-
974
953
  interface ComponentHighLighterOptions {
975
954
  bounds: ComponentBoundingRect;
976
955
  name?: string;
@@ -988,6 +967,27 @@ declare function cancelInspectComponentHighLighter(): void;
988
967
  declare function inspectComponentHighLighter(): Promise<string>;
989
968
  declare function scrollToComponent(options: ScrollToComponentOptions): void;
990
969
 
970
+ declare const UNDEFINED = "__vue_devtool_undefined__";
971
+ declare const INFINITY = "__vue_devtool_infinity__";
972
+ declare const NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
973
+ declare const NAN = "__vue_devtool_nan__";
974
+
975
+ declare function getInspectorStateValueType(value: any, raw?: boolean): string;
976
+ declare function formatInspectorStateValue(value: any, quotes?: boolean, options?: {
977
+ customClass?: Partial<Record<'string', string>>;
978
+ }): any;
979
+ declare function getRaw(value: InspectorState['value']): {
980
+ value: object | string | number | boolean | null;
981
+ inherit: Record<string, any> | {
982
+ abstract: true;
983
+ };
984
+ customType?: customTypeEnums;
985
+ };
986
+ declare function toEdit(value: unknown, customType?: customTypeEnums): string;
987
+ declare function toSubmit(value: string, customType?: customTypeEnums): any;
988
+
989
+ declare function isPlainObject(obj: unknown): obj is object;
990
+
991
991
  declare function updateDevToolsClientDetected(params: Record<string, boolean>): void;
992
992
 
993
993
  interface EventEmitter$2 {
package/dist/index.js CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target22) => (target22 = mod != null ? __create(
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.43.0_@types+node@22.9.0__@swc+core@1.5.29_jiti@2.0.0_po_lnt5yfvawfblpk67opvcdwbq7u/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.43.0_@types+node@22.10.0__@swc+core@1.5.29_jiti@2.0.0_p_lm6fffj5lkeoeahdikwtvgu66m/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.43.0_@types+node@22.9.0__@swc+core@1.5.29_jiti@2.0.0_po_lnt5yfvawfblpk67opvcdwbq7u/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.43.0_@types+node@22.10.0__@swc+core@1.5.29_jiti@2.0.0_p_lm6fffj5lkeoeahdikwtvgu66m/node_modules/tsup/assets/esm_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -1604,28 +1604,11 @@ import { target as target11 } from "@vue/devtools-shared";
1604
1604
  init_esm_shims();
1605
1605
  import { target as target9 } from "@vue/devtools-shared";
1606
1606
 
1607
- // src/core/component/state/editor.ts
1607
+ // src/core/component-highlighter/index.ts
1608
1608
  init_esm_shims();
1609
1609
 
1610
- // src/shared/stub-vue.ts
1610
+ // src/core/component/state/bounding-rect.ts
1611
1611
  init_esm_shims();
1612
- function isReadonly(value) {
1613
- return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
1614
- }
1615
- function isReactive(value) {
1616
- if (isReadonly(value)) {
1617
- return isReactive(value["__v_raw" /* RAW */]);
1618
- }
1619
- return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
1620
- }
1621
- function isRef(r) {
1622
- return !!(r && r.__v_isRef === true);
1623
- }
1624
- function toRaw(observed) {
1625
- const raw = observed && observed["__v_raw" /* RAW */];
1626
- return raw ? toRaw(raw) : observed;
1627
- }
1628
- var Fragment = Symbol.for("v-fgt");
1629
1612
 
1630
1613
  // src/core/component/utils/index.ts
1631
1614
  init_esm_shims();
@@ -1738,178 +1721,7 @@ function ensurePropertyExists(obj, key, skipObjCheck = false) {
1738
1721
  return skipObjCheck ? key in obj : typeof obj === "object" && obj !== null ? key in obj : false;
1739
1722
  }
1740
1723
 
1741
- // src/core/component/state/editor.ts
1742
- var StateEditor = class {
1743
- constructor() {
1744
- this.refEditor = new RefStateEditor();
1745
- }
1746
- set(object, path, value, cb) {
1747
- const sections = Array.isArray(path) ? path : path.split(".");
1748
- const markRef = false;
1749
- while (sections.length > 1) {
1750
- const section = sections.shift();
1751
- if (object instanceof Map)
1752
- object = object.get(section);
1753
- if (object instanceof Set)
1754
- object = Array.from(object.values())[section];
1755
- else object = object[section];
1756
- if (this.refEditor.isRef(object))
1757
- object = this.refEditor.get(object);
1758
- }
1759
- const field = sections[0];
1760
- const item = this.refEditor.get(object)[field];
1761
- if (cb) {
1762
- cb(object, field, value);
1763
- } else {
1764
- if (this.refEditor.isRef(item))
1765
- this.refEditor.set(item, value);
1766
- else if (markRef)
1767
- object[field] = value;
1768
- else
1769
- object[field] = value;
1770
- }
1771
- }
1772
- get(object, path) {
1773
- const sections = Array.isArray(path) ? path : path.split(".");
1774
- for (let i = 0; i < sections.length; i++) {
1775
- if (object instanceof Map)
1776
- object = object.get(sections[i]);
1777
- else
1778
- object = object[sections[i]];
1779
- if (this.refEditor.isRef(object))
1780
- object = this.refEditor.get(object);
1781
- if (!object)
1782
- return void 0;
1783
- }
1784
- return object;
1785
- }
1786
- has(object, path, parent = false) {
1787
- if (typeof object === "undefined")
1788
- return false;
1789
- const sections = Array.isArray(path) ? path.slice() : path.split(".");
1790
- const size = !parent ? 1 : 2;
1791
- while (object && sections.length > size) {
1792
- const section = sections.shift();
1793
- object = object[section];
1794
- if (this.refEditor.isRef(object))
1795
- object = this.refEditor.get(object);
1796
- }
1797
- return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
1798
- }
1799
- createDefaultSetCallback(state) {
1800
- return (object, field, value) => {
1801
- if (state.remove || state.newKey) {
1802
- if (Array.isArray(object))
1803
- object.splice(field, 1);
1804
- else if (toRaw(object) instanceof Map)
1805
- object.delete(field);
1806
- else if (toRaw(object) instanceof Set)
1807
- object.delete(Array.from(object.values())[field]);
1808
- else Reflect.deleteProperty(object, field);
1809
- }
1810
- if (!state.remove) {
1811
- const target22 = object[state.newKey || field];
1812
- if (this.refEditor.isRef(target22))
1813
- this.refEditor.set(target22, value);
1814
- else if (toRaw(object) instanceof Map)
1815
- object.set(state.newKey || field, value);
1816
- else if (toRaw(object) instanceof Set)
1817
- object.add(value);
1818
- else
1819
- object[state.newKey || field] = value;
1820
- }
1821
- };
1822
- }
1823
- };
1824
- var RefStateEditor = class {
1825
- set(ref, value) {
1826
- if (isRef(ref)) {
1827
- ref.value = value;
1828
- } else {
1829
- if (ref instanceof Set && Array.isArray(value)) {
1830
- ref.clear();
1831
- value.forEach((v) => ref.add(v));
1832
- return;
1833
- }
1834
- const currentKeys = Object.keys(value);
1835
- if (ref instanceof Map) {
1836
- const previousKeysSet2 = new Set(ref.keys());
1837
- currentKeys.forEach((key) => {
1838
- ref.set(key, Reflect.get(value, key));
1839
- previousKeysSet2.delete(key);
1840
- });
1841
- previousKeysSet2.forEach((key) => ref.delete(key));
1842
- return;
1843
- }
1844
- const previousKeysSet = new Set(Object.keys(ref));
1845
- currentKeys.forEach((key) => {
1846
- Reflect.set(ref, key, Reflect.get(value, key));
1847
- previousKeysSet.delete(key);
1848
- });
1849
- previousKeysSet.forEach((key) => Reflect.deleteProperty(ref, key));
1850
- }
1851
- }
1852
- get(ref) {
1853
- return isRef(ref) ? ref.value : ref;
1854
- }
1855
- isRef(ref) {
1856
- return isRef(ref) || isReactive(ref);
1857
- }
1858
- };
1859
- async function editComponentState(payload, stateEditor2) {
1860
- const { path, nodeId, state, type } = payload;
1861
- const instance = getComponentInstance(activeAppRecord.value, nodeId);
1862
- if (!instance)
1863
- return;
1864
- const targetPath = path.slice();
1865
- let target22;
1866
- if (Object.keys(instance.props).includes(path[0])) {
1867
- target22 = instance.props;
1868
- } else if (instance.devtoolsRawSetupState && Object.keys(instance.devtoolsRawSetupState).includes(path[0])) {
1869
- target22 = instance.devtoolsRawSetupState;
1870
- } else if (instance.data && Object.keys(instance.data).includes(path[0])) {
1871
- target22 = instance.data;
1872
- } else {
1873
- target22 = instance.proxy;
1874
- }
1875
- if (target22 && targetPath) {
1876
- if (state.type === "object" && type === "reactive") {
1877
- }
1878
- stateEditor2.set(target22, targetPath, state.value, stateEditor2.createDefaultSetCallback(state));
1879
- }
1880
- }
1881
- var stateEditor = new StateEditor();
1882
- async function editState(payload) {
1883
- editComponentState(payload, stateEditor);
1884
- }
1885
-
1886
- // src/core/component/tree/el.ts
1887
- init_esm_shims();
1888
- function getRootElementsFromComponentInstance(instance) {
1889
- if (isFragment(instance))
1890
- return getFragmentRootElements(instance.subTree);
1891
- if (!instance.subTree)
1892
- return [];
1893
- return [instance.subTree.el];
1894
- }
1895
- function getFragmentRootElements(vnode) {
1896
- if (!vnode.children)
1897
- return [];
1898
- const list = [];
1899
- vnode.children.forEach((childVnode) => {
1900
- if (childVnode.component)
1901
- list.push(...getRootElementsFromComponentInstance(childVnode.component));
1902
- else if (childVnode == null ? void 0 : childVnode.el)
1903
- list.push(childVnode.el);
1904
- });
1905
- return list;
1906
- }
1907
-
1908
- // src/core/component-highlighter/index.ts
1909
- init_esm_shims();
1910
-
1911
1724
  // src/core/component/state/bounding-rect.ts
1912
- init_esm_shims();
1913
1725
  function createRect() {
1914
1726
  const rect = {
1915
1727
  top: 0,
@@ -1987,6 +1799,28 @@ function getComponentBoundingRect(instance) {
1987
1799
  return DEFAULT_RECT;
1988
1800
  }
1989
1801
 
1802
+ // src/core/component/tree/el.ts
1803
+ init_esm_shims();
1804
+ function getRootElementsFromComponentInstance(instance) {
1805
+ if (isFragment(instance))
1806
+ return getFragmentRootElements(instance.subTree);
1807
+ if (!instance.subTree)
1808
+ return [];
1809
+ return [instance.subTree.el];
1810
+ }
1811
+ function getFragmentRootElements(vnode) {
1812
+ if (!vnode.children)
1813
+ return [];
1814
+ const list = [];
1815
+ vnode.children.forEach((childVnode) => {
1816
+ if (childVnode.component)
1817
+ list.push(...getRootElementsFromComponentInstance(childVnode.component));
1818
+ else if (childVnode == null ? void 0 : childVnode.el)
1819
+ list.push(childVnode.el);
1820
+ });
1821
+ return list;
1822
+ }
1823
+
1990
1824
  // src/core/component-highlighter/index.ts
1991
1825
  var CONTAINER_ELEMENT_ID = "__vue-devtools-component-inspector__";
1992
1826
  var CARD_ELEMENT_ID = "__vue-devtools-component-inspector__card__";
@@ -2244,6 +2078,174 @@ function getComponentInspector() {
2244
2078
  });
2245
2079
  }
2246
2080
 
2081
+ // src/core/component/state/editor.ts
2082
+ init_esm_shims();
2083
+
2084
+ // src/shared/stub-vue.ts
2085
+ init_esm_shims();
2086
+ function isReadonly(value) {
2087
+ return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
2088
+ }
2089
+ function isReactive(value) {
2090
+ if (isReadonly(value)) {
2091
+ return isReactive(value["__v_raw" /* RAW */]);
2092
+ }
2093
+ return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
2094
+ }
2095
+ function isRef(r) {
2096
+ return !!(r && r.__v_isRef === true);
2097
+ }
2098
+ function toRaw(observed) {
2099
+ const raw = observed && observed["__v_raw" /* RAW */];
2100
+ return raw ? toRaw(raw) : observed;
2101
+ }
2102
+ var Fragment = Symbol.for("v-fgt");
2103
+
2104
+ // src/core/component/state/editor.ts
2105
+ var StateEditor = class {
2106
+ constructor() {
2107
+ this.refEditor = new RefStateEditor();
2108
+ }
2109
+ set(object, path, value, cb) {
2110
+ const sections = Array.isArray(path) ? path : path.split(".");
2111
+ const markRef = false;
2112
+ while (sections.length > 1) {
2113
+ const section = sections.shift();
2114
+ if (object instanceof Map)
2115
+ object = object.get(section);
2116
+ if (object instanceof Set)
2117
+ object = Array.from(object.values())[section];
2118
+ else object = object[section];
2119
+ if (this.refEditor.isRef(object))
2120
+ object = this.refEditor.get(object);
2121
+ }
2122
+ const field = sections[0];
2123
+ const item = this.refEditor.get(object)[field];
2124
+ if (cb) {
2125
+ cb(object, field, value);
2126
+ } else {
2127
+ if (this.refEditor.isRef(item))
2128
+ this.refEditor.set(item, value);
2129
+ else if (markRef)
2130
+ object[field] = value;
2131
+ else
2132
+ object[field] = value;
2133
+ }
2134
+ }
2135
+ get(object, path) {
2136
+ const sections = Array.isArray(path) ? path : path.split(".");
2137
+ for (let i = 0; i < sections.length; i++) {
2138
+ if (object instanceof Map)
2139
+ object = object.get(sections[i]);
2140
+ else
2141
+ object = object[sections[i]];
2142
+ if (this.refEditor.isRef(object))
2143
+ object = this.refEditor.get(object);
2144
+ if (!object)
2145
+ return void 0;
2146
+ }
2147
+ return object;
2148
+ }
2149
+ has(object, path, parent = false) {
2150
+ if (typeof object === "undefined")
2151
+ return false;
2152
+ const sections = Array.isArray(path) ? path.slice() : path.split(".");
2153
+ const size = !parent ? 1 : 2;
2154
+ while (object && sections.length > size) {
2155
+ const section = sections.shift();
2156
+ object = object[section];
2157
+ if (this.refEditor.isRef(object))
2158
+ object = this.refEditor.get(object);
2159
+ }
2160
+ return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
2161
+ }
2162
+ createDefaultSetCallback(state) {
2163
+ return (object, field, value) => {
2164
+ if (state.remove || state.newKey) {
2165
+ if (Array.isArray(object))
2166
+ object.splice(field, 1);
2167
+ else if (toRaw(object) instanceof Map)
2168
+ object.delete(field);
2169
+ else if (toRaw(object) instanceof Set)
2170
+ object.delete(Array.from(object.values())[field]);
2171
+ else Reflect.deleteProperty(object, field);
2172
+ }
2173
+ if (!state.remove) {
2174
+ const target22 = object[state.newKey || field];
2175
+ if (this.refEditor.isRef(target22))
2176
+ this.refEditor.set(target22, value);
2177
+ else if (toRaw(object) instanceof Map)
2178
+ object.set(state.newKey || field, value);
2179
+ else if (toRaw(object) instanceof Set)
2180
+ object.add(value);
2181
+ else
2182
+ object[state.newKey || field] = value;
2183
+ }
2184
+ };
2185
+ }
2186
+ };
2187
+ var RefStateEditor = class {
2188
+ set(ref, value) {
2189
+ if (isRef(ref)) {
2190
+ ref.value = value;
2191
+ } else {
2192
+ if (ref instanceof Set && Array.isArray(value)) {
2193
+ ref.clear();
2194
+ value.forEach((v) => ref.add(v));
2195
+ return;
2196
+ }
2197
+ const currentKeys = Object.keys(value);
2198
+ if (ref instanceof Map) {
2199
+ const previousKeysSet2 = new Set(ref.keys());
2200
+ currentKeys.forEach((key) => {
2201
+ ref.set(key, Reflect.get(value, key));
2202
+ previousKeysSet2.delete(key);
2203
+ });
2204
+ previousKeysSet2.forEach((key) => ref.delete(key));
2205
+ return;
2206
+ }
2207
+ const previousKeysSet = new Set(Object.keys(ref));
2208
+ currentKeys.forEach((key) => {
2209
+ Reflect.set(ref, key, Reflect.get(value, key));
2210
+ previousKeysSet.delete(key);
2211
+ });
2212
+ previousKeysSet.forEach((key) => Reflect.deleteProperty(ref, key));
2213
+ }
2214
+ }
2215
+ get(ref) {
2216
+ return isRef(ref) ? ref.value : ref;
2217
+ }
2218
+ isRef(ref) {
2219
+ return isRef(ref) || isReactive(ref);
2220
+ }
2221
+ };
2222
+ async function editComponentState(payload, stateEditor2) {
2223
+ const { path, nodeId, state, type } = payload;
2224
+ const instance = getComponentInstance(activeAppRecord.value, nodeId);
2225
+ if (!instance)
2226
+ return;
2227
+ const targetPath = path.slice();
2228
+ let target22;
2229
+ if (Object.keys(instance.props).includes(path[0])) {
2230
+ target22 = instance.props;
2231
+ } else if (instance.devtoolsRawSetupState && Object.keys(instance.devtoolsRawSetupState).includes(path[0])) {
2232
+ target22 = instance.devtoolsRawSetupState;
2233
+ } else if (instance.data && Object.keys(instance.data).includes(path[0])) {
2234
+ target22 = instance.data;
2235
+ } else {
2236
+ target22 = instance.proxy;
2237
+ }
2238
+ if (target22 && targetPath) {
2239
+ if (state.type === "object" && type === "reactive") {
2240
+ }
2241
+ stateEditor2.set(target22, targetPath, state.value, stateEditor2.createDefaultSetCallback(state));
2242
+ }
2243
+ }
2244
+ var stateEditor = new StateEditor();
2245
+ async function editState(payload) {
2246
+ editComponentState(payload, stateEditor);
2247
+ }
2248
+
2247
2249
  // src/core/open-in-editor/index.ts
2248
2250
  init_esm_shims();
2249
2251
  import { target as target5 } from "@vue/devtools-shared";
@@ -3286,12 +3288,21 @@ function sanitize(data) {
3286
3288
  }
3287
3289
  }
3288
3290
  function getSetupStateType(raw) {
3289
- return {
3290
- ref: isRef2(raw),
3291
- computed: isComputed(raw),
3292
- reactive: isReactive2(raw),
3293
- readonly: isReadOnly(raw)
3294
- };
3291
+ try {
3292
+ return {
3293
+ ref: isRef2(raw),
3294
+ computed: isComputed(raw),
3295
+ reactive: isReactive2(raw),
3296
+ readonly: isReadOnly(raw)
3297
+ };
3298
+ } catch (e) {
3299
+ return {
3300
+ ref: false,
3301
+ computed: false,
3302
+ reactive: false,
3303
+ readonly: false
3304
+ };
3305
+ }
3295
3306
  }
3296
3307
  function toRaw2(value) {
3297
3308
  if (value == null ? void 0 : value.__v_raw)
@@ -3390,10 +3401,11 @@ function processSetupState(instance) {
3390
3401
  return Object.keys(instance.setupState).filter((key) => !vueBuiltins.has(key) && key.split(/(?=[A-Z])/)[0] !== "use").map((key) => {
3391
3402
  var _a25, _b25, _c, _d;
3392
3403
  const value = returnError(() => toRaw2(instance.setupState[key]));
3404
+ const accessError = value instanceof Error;
3393
3405
  const rawData = raw[key];
3394
3406
  let result;
3395
- let isOtherType = typeof value === "function" || ensurePropertyExists(value, "render") && typeof value.render === "function" || ensurePropertyExists(value, "__asyncLoader") && typeof value.__asyncLoader === "function" || typeof value === "object" && value && ("setup" in value || "props" in value) || /^v[A-Z]/.test(key);
3396
- if (rawData) {
3407
+ let isOtherType = accessError || typeof value === "function" || ensurePropertyExists(value, "render") && typeof value.render === "function" || ensurePropertyExists(value, "__asyncLoader") && typeof value.__asyncLoader === "function" || typeof value === "object" && value && ("setup" in value || "props" in value) || /^v[A-Z]/.test(key);
3408
+ if (rawData && !accessError) {
3397
3409
  const info = getSetupStateType(rawData);
3398
3410
  const { stateType, stateTypeName } = getStateTypeAndName(info);
3399
3411
  const isState = info.ref || info.computed || info.reactive;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue/devtools-kit",
3
3
  "type": "module",
4
- "version": "7.6.4",
4
+ "version": "7.6.5",
5
5
  "author": "webfansplz",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -29,12 +29,12 @@
29
29
  "perfect-debounce": "^1.0.0",
30
30
  "speakingurl": "^14.0.1",
31
31
  "superjson": "^2.2.1",
32
- "@vue/devtools-shared": "^7.6.4"
32
+ "@vue/devtools-shared": "^7.6.5"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/speakingurl": "^13.0.6",
36
- "vue": "^3.5.12",
37
- "vue-router": "^4.4.5"
36
+ "vue": "^3.5.13",
37
+ "vue-router": "^4.5.0"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsup --clean",