@vue/devtools-kit 7.0.10 → 7.0.12

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, target8) => (target8 = 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.1_postcss@8.4.32_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.32_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -1605,6 +1605,8 @@ __export(src_exports, {
1605
1605
  specialTypeRE: () => specialTypeRE,
1606
1606
  stringify: () => stringify,
1607
1607
  symbolRE: () => symbolRE,
1608
+ toEdit: () => toEdit,
1609
+ toSubmit: () => toSubmit,
1608
1610
  vueBuiltins: () => vueBuiltins
1609
1611
  });
1610
1612
  module.exports = __toCommonJS(src_exports);
@@ -1903,7 +1905,7 @@ init_cjs_shims();
1903
1905
  // src/shared/util.ts
1904
1906
  init_cjs_shims();
1905
1907
 
1906
- // src/core/component/state/format.ts
1908
+ // src/core/component/state/replacer.ts
1907
1909
  init_cjs_shims();
1908
1910
 
1909
1911
  // src/core/component/state/constants.ts
@@ -1978,157 +1980,6 @@ var ESC = {
1978
1980
  "&": "&"
1979
1981
  };
1980
1982
 
1981
- // src/core/component/state/is.ts
1982
- init_cjs_shims();
1983
- function isVueInstance(value) {
1984
- return value._ && Object.keys(value._).includes("vnode");
1985
- }
1986
- function isPlainObject(obj) {
1987
- return Object.prototype.toString.call(obj) === "[object Object]";
1988
- }
1989
- function isPrimitive(data) {
1990
- if (data == null)
1991
- return true;
1992
- const type = typeof data;
1993
- return type === "string" || type === "number" || type === "boolean";
1994
- }
1995
- function isRef(raw) {
1996
- return !!raw.__v_isRef;
1997
- }
1998
- function isComputed(raw) {
1999
- return isRef(raw) && !!raw.effect;
2000
- }
2001
- function isReactive(raw) {
2002
- return !!raw.__v_isReactive;
2003
- }
2004
- function isReadOnly(raw) {
2005
- return !!raw.__v_isReadonly;
2006
- }
2007
-
2008
- // src/core/component/state/util.ts
2009
- init_cjs_shims();
2010
- function internalStateTokenToString(value) {
2011
- if (value === null)
2012
- return "null";
2013
- else if (value === UNDEFINED)
2014
- return "undefined";
2015
- else if (value === NAN)
2016
- return "NaN";
2017
- else if (value === INFINITY)
2018
- return "Infinity";
2019
- else if (value === NEGATIVE_INFINITY)
2020
- return "-Infinity";
2021
- return false;
2022
- }
2023
- function getPropType(type) {
2024
- if (Array.isArray(type))
2025
- return type.map((t) => getPropType(t)).join(" or ");
2026
- if (type == null)
2027
- return "null";
2028
- const match = type.toString().match(fnTypeRE);
2029
- return typeof type === "function" ? match && match[1] || "any" : "any";
2030
- }
2031
- function sanitize(data) {
2032
- if (!isPrimitive(data) && !Array.isArray(data) && !isPlainObject(data)) {
2033
- return Object.prototype.toString.call(data);
2034
- } else {
2035
- return data;
2036
- }
2037
- }
2038
- function getSetupStateType(raw) {
2039
- return {
2040
- ref: isRef(raw),
2041
- computed: isComputed(raw),
2042
- reactive: isReactive(raw),
2043
- readonly: isReadOnly(raw)
2044
- };
2045
- }
2046
- function toRaw(value) {
2047
- if (value == null ? void 0 : value.__v_raw)
2048
- return value.__v_raw;
2049
- return value;
2050
- }
2051
- function escape(s) {
2052
- return s.replace(/[<>"&]/g, (s2) => {
2053
- return ESC[s2] || s2;
2054
- });
2055
- }
2056
-
2057
- // src/core/component/state/format.ts
2058
- function getInspectorStateValueType(value, raw = true) {
2059
- const type = typeof value;
2060
- if (value == null || value === UNDEFINED) {
2061
- return "null";
2062
- } else if (type === "boolean" || type === "number" || value === INFINITY || value === NEGATIVE_INFINITY || value === NAN) {
2063
- return "literal";
2064
- } else if (value == null ? void 0 : value._custom) {
2065
- if (raw || value._custom.display != null || value._custom.displayText != null)
2066
- return "custom";
2067
- else
2068
- return getInspectorStateValueType(value._custom.value);
2069
- } else if (typeof value === "string") {
2070
- const typeMatch = specialTypeRE.exec(value);
2071
- if (typeMatch) {
2072
- const [, type2] = typeMatch;
2073
- return `native ${type2}`;
2074
- } else {
2075
- return "string";
2076
- }
2077
- } else if (Array.isArray(value) || (value == null ? void 0 : value._isArray)) {
2078
- return "array";
2079
- } else if (isPlainObject(value)) {
2080
- return "plain-object";
2081
- } else {
2082
- return "unknown";
2083
- }
2084
- }
2085
- function formatInspectorStateValue(value, quotes = false) {
2086
- var _a8, _b8;
2087
- let result;
2088
- const type = getInspectorStateValueType(value, false);
2089
- if (type !== "custom" && (value == null ? void 0 : value._custom))
2090
- value = value._custom.value;
2091
- if (result = internalStateTokenToString(value)) {
2092
- return result;
2093
- } else if (type === "custom") {
2094
- const nestedName = ((_a8 = value._custom.value) == null ? void 0 : _a8._custom) && formatInspectorStateValue(value._custom.value);
2095
- return nestedName || value._custom.displayText || value._custom.display;
2096
- } else if (type === "array") {
2097
- return `Array[${value.length}]`;
2098
- } else if (type === "plain-object") {
2099
- return `Object${Object.keys(value).length ? "" : " (empty)"}`;
2100
- } else if (type == null ? void 0 : type.includes("native")) {
2101
- return escape((_b8 = specialTypeRE.exec(value)) == null ? void 0 : _b8[2]);
2102
- } else if (typeof value === "string") {
2103
- const typeMatch = value.match(rawTypeRE);
2104
- if (typeMatch)
2105
- value = escape(typeMatch[1]);
2106
- else if (quotes)
2107
- value = `<span>"</span>${escape(value)}<span>"</span>`;
2108
- else
2109
- value = escape(value);
2110
- value = value.replace(/ /g, "&nbsp;").replace(/\n/g, "<span>\\n</span>");
2111
- }
2112
- return value;
2113
- }
2114
- function getRawValue(value) {
2115
- var _a8, _b8, _c, _d;
2116
- const isCustom = getInspectorStateValueType(value) === "custom";
2117
- let inherit = {};
2118
- if (isCustom) {
2119
- const data = value;
2120
- 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 };
2121
- inherit = nestedCustom.inherit || ((_c = data._custom) == null ? void 0 : _c.fields) || {};
2122
- value = nestedCustom.value || ((_d = data._custom) == null ? void 0 : _d.value);
2123
- }
2124
- if (value && value._isArray)
2125
- value = value.items;
2126
- return { value, inherit };
2127
- }
2128
-
2129
- // src/core/component/state/replacer.ts
2130
- init_cjs_shims();
2131
-
2132
1983
  // src/core/component/state/custom.ts
2133
1984
  init_cjs_shims();
2134
1985
 
@@ -2235,6 +2086,99 @@ function getComponentInstance(appRecord, instanceId) {
2235
2086
  // src/core/component/state/process.ts
2236
2087
  init_cjs_shims();
2237
2088
  var import_devtools_shared5 = require("@vue/devtools-shared");
2089
+
2090
+ // src/core/component/state/util.ts
2091
+ init_cjs_shims();
2092
+
2093
+ // src/core/component/state/is.ts
2094
+ init_cjs_shims();
2095
+ function isVueInstance(value) {
2096
+ return value._ && Object.keys(value._).includes("vnode");
2097
+ }
2098
+ function isPlainObject(obj) {
2099
+ return Object.prototype.toString.call(obj) === "[object Object]";
2100
+ }
2101
+ function isPrimitive(data) {
2102
+ if (data == null)
2103
+ return true;
2104
+ const type = typeof data;
2105
+ return type === "string" || type === "number" || type === "boolean";
2106
+ }
2107
+ function isRef(raw) {
2108
+ return !!raw.__v_isRef;
2109
+ }
2110
+ function isComputed(raw) {
2111
+ return isRef(raw) && !!raw.effect;
2112
+ }
2113
+ function isReactive(raw) {
2114
+ return !!raw.__v_isReactive;
2115
+ }
2116
+ function isReadOnly(raw) {
2117
+ return !!raw.__v_isReadonly;
2118
+ }
2119
+
2120
+ // src/core/component/state/util.ts
2121
+ var tokenMap = {
2122
+ [UNDEFINED]: "undefined",
2123
+ [NAN]: "NaN",
2124
+ [INFINITY]: "Infinity",
2125
+ [NEGATIVE_INFINITY]: "-Infinity"
2126
+ };
2127
+ var reversedTokenMap = Object.entries(tokenMap).reduce((acc, [key, value]) => {
2128
+ acc[value] = key;
2129
+ return acc;
2130
+ }, {});
2131
+ function internalStateTokenToString(value) {
2132
+ if (value === null)
2133
+ return "null";
2134
+ return typeof value === "string" && tokenMap[value] || false;
2135
+ }
2136
+ function replaceTokenToString(value) {
2137
+ const replaceRegex = new RegExp(`"(${Object.keys(tokenMap).join("|")})"`, "g");
2138
+ return value.replace(replaceRegex, (_, g1) => tokenMap[g1]);
2139
+ }
2140
+ function replaceStringToToken(value) {
2141
+ const literalValue = reversedTokenMap[value.trim()];
2142
+ if (literalValue)
2143
+ return `"${literalValue}"`;
2144
+ const replaceRegex = new RegExp(`:\\s*(${Object.keys(reversedTokenMap).join("|")})`, "g");
2145
+ return value.replace(replaceRegex, (_, g1) => `:"${reversedTokenMap[g1]}"`);
2146
+ }
2147
+ function getPropType(type) {
2148
+ if (Array.isArray(type))
2149
+ return type.map((t) => getPropType(t)).join(" or ");
2150
+ if (type == null)
2151
+ return "null";
2152
+ const match = type.toString().match(fnTypeRE);
2153
+ return typeof type === "function" ? match && match[1] || "any" : "any";
2154
+ }
2155
+ function sanitize(data) {
2156
+ if (!isPrimitive(data) && !Array.isArray(data) && !isPlainObject(data)) {
2157
+ return Object.prototype.toString.call(data);
2158
+ } else {
2159
+ return data;
2160
+ }
2161
+ }
2162
+ function getSetupStateType(raw) {
2163
+ return {
2164
+ ref: isRef(raw),
2165
+ computed: isComputed(raw),
2166
+ reactive: isReactive(raw),
2167
+ readonly: isReadOnly(raw)
2168
+ };
2169
+ }
2170
+ function toRaw(value) {
2171
+ if (value == null ? void 0 : value.__v_raw)
2172
+ return value.__v_raw;
2173
+ return value;
2174
+ }
2175
+ function escape(s) {
2176
+ return s.replace(/[<>"&]/g, (s2) => {
2177
+ return ESC[s2] || s2;
2178
+ });
2179
+ }
2180
+
2181
+ // src/core/component/state/process.ts
2238
2182
  function mergeOptions(to, from, instance) {
2239
2183
  if (typeof from === "function")
2240
2184
  from = from.options;
@@ -2904,6 +2848,86 @@ function parseCircularAutoChunks(data, reviver2 = null) {
2904
2848
  }
2905
2849
  }
2906
2850
 
2851
+ // src/core/component/state/format.ts
2852
+ init_cjs_shims();
2853
+ function getInspectorStateValueType(value, raw = true) {
2854
+ const type = typeof value;
2855
+ if (value == null || value === UNDEFINED) {
2856
+ return "null";
2857
+ } else if (type === "boolean" || type === "number" || value === INFINITY || value === NEGATIVE_INFINITY || value === NAN) {
2858
+ return "literal";
2859
+ } else if (value == null ? void 0 : value._custom) {
2860
+ if (raw || value._custom.display != null || value._custom.displayText != null)
2861
+ return "custom";
2862
+ else
2863
+ return getInspectorStateValueType(value._custom.value);
2864
+ } else if (typeof value === "string") {
2865
+ const typeMatch = specialTypeRE.exec(value);
2866
+ if (typeMatch) {
2867
+ const [, type2] = typeMatch;
2868
+ return `native ${type2}`;
2869
+ } else {
2870
+ return "string";
2871
+ }
2872
+ } else if (Array.isArray(value) || (value == null ? void 0 : value._isArray)) {
2873
+ return "array";
2874
+ } else if (isPlainObject(value)) {
2875
+ return "plain-object";
2876
+ } else {
2877
+ return "unknown";
2878
+ }
2879
+ }
2880
+ function formatInspectorStateValue(value, quotes = false) {
2881
+ var _a8, _b8;
2882
+ let result;
2883
+ const type = getInspectorStateValueType(value, false);
2884
+ if (type !== "custom" && (value == null ? void 0 : value._custom))
2885
+ value = value._custom.value;
2886
+ if (result = internalStateTokenToString(value)) {
2887
+ return result;
2888
+ } else if (type === "custom") {
2889
+ const nestedName = ((_a8 = value._custom.value) == null ? void 0 : _a8._custom) && formatInspectorStateValue(value._custom.value);
2890
+ return nestedName || value._custom.displayText || value._custom.display;
2891
+ } else if (type === "array") {
2892
+ return `Array[${value.length}]`;
2893
+ } else if (type === "plain-object") {
2894
+ return `Object${Object.keys(value).length ? "" : " (empty)"}`;
2895
+ } else if (type == null ? void 0 : type.includes("native")) {
2896
+ return escape((_b8 = specialTypeRE.exec(value)) == null ? void 0 : _b8[2]);
2897
+ } else if (typeof value === "string") {
2898
+ const typeMatch = value.match(rawTypeRE);
2899
+ if (typeMatch)
2900
+ value = escape(typeMatch[1]);
2901
+ else if (quotes)
2902
+ value = `<span>"</span>${escape(value)}<span>"</span>`;
2903
+ else
2904
+ value = escape(value);
2905
+ value = value.replace(/ /g, "&nbsp;").replace(/\n/g, "<span>\\n</span>");
2906
+ }
2907
+ return value;
2908
+ }
2909
+ function getRawValue(value) {
2910
+ var _a8, _b8;
2911
+ const isCustom = getInspectorStateValueType(value) === "custom";
2912
+ let inherit = {};
2913
+ if (isCustom) {
2914
+ const data = value;
2915
+ const customValue = (_a8 = data._custom) == null ? void 0 : _a8.value;
2916
+ const nestedCustom = typeof customValue === "object" && customValue !== null && "_custom" in customValue ? getRawValue(customValue) : { inherit: void 0, value: void 0 };
2917
+ inherit = nestedCustom.inherit || ((_b8 = data._custom) == null ? void 0 : _b8.fields) || {};
2918
+ value = nestedCustom.value || customValue;
2919
+ }
2920
+ if (value && value._isArray)
2921
+ value = value.items;
2922
+ return { value, inherit };
2923
+ }
2924
+ function toEdit(value) {
2925
+ return replaceTokenToString(JSON.stringify(value));
2926
+ }
2927
+ function toSubmit(value) {
2928
+ return JSON.parse(replaceStringToToken(value), reviver);
2929
+ }
2930
+
2907
2931
  // src/shared/util.ts
2908
2932
  function stringify(data) {
2909
2933
  return stringifyCircularAutoChunks(data, stringifyReplacer);
@@ -3027,15 +3051,14 @@ var RefStateEditor = class {
3027
3051
  if ((0, import_vue2.isRef)(ref)) {
3028
3052
  ref.value = value;
3029
3053
  } else {
3030
- const obj = JSON.parse(value);
3031
3054
  const previousKeys = Object.keys(ref);
3032
- const currentKeys = Object.keys(obj);
3055
+ const currentKeys = Object.keys(value);
3033
3056
  if (previousKeys.length > currentKeys.length) {
3034
3057
  const diffKeys = previousKeys.filter((key) => !currentKeys.includes(key));
3035
3058
  diffKeys.forEach((key) => Reflect.deleteProperty(ref, key));
3036
3059
  }
3037
3060
  currentKeys.forEach((key) => {
3038
- Reflect.set(ref, key, Reflect.get(obj, key));
3061
+ Reflect.set(ref, key, Reflect.get(value, key));
3039
3062
  });
3040
3063
  }
3041
3064
  }
@@ -4306,5 +4329,7 @@ var devtools = {
4306
4329
  specialTypeRE,
4307
4330
  stringify,
4308
4331
  symbolRE,
4332
+ toEdit,
4333
+ toSubmit,
4309
4334
  vueBuiltins
4310
4335
  });
package/dist/index.d.cts CHANGED
@@ -381,6 +381,8 @@ declare function addCustomTab(tab: CustomTab): void;
381
381
  declare function getInspectorStateValueType(value: any, raw?: boolean): string;
382
382
  declare function formatInspectorStateValue(value: any, quotes?: boolean): any;
383
383
  declare function getRawValue(value: InspectorState['value']): any;
384
+ declare function toEdit(value: unknown): string;
385
+ declare function toSubmit(value: string): any;
384
386
 
385
387
  declare function stringify<T extends object = Record<string, unknown>>(data: T): string | string[];
386
388
  declare function parse(data: string, revive?: boolean): any;
@@ -620,4 +622,4 @@ declare const devtools: {
620
622
  readonly api: DevToolsPluginApi;
621
623
  };
622
624
 
623
- export { type AddInspectorApiPayload, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, ESC, INFINITY, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTreeApiPayload, MAX_ARRAY_SIZE, MAX_STRING_SIZE, type ModuleIframeView, type ModuleVNodeView, type ModuleView, NAN, NEGATIVE_INFINITY, type OpenInEditorOptions, type PropPath, type RouterInfo, RouterKey, type ScrollToComponentOptions, type TimelineEvent, type TimelineEventData, type ToggleComponentInspectorOptions, UNDEFINED, type VueInspector, addCustomCommand, addCustomTab, devtools, devtoolsRouterInfo, fnTypeRE, formatInspectorStateValue, getInspectorStateValueType, getRawValue, getRouterDevToolsId, getVueInspector, normalizeRouterInfo, now, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, rawTypeRE, removeCustomCommand, setupDevToolsPlugin, specialTypeRE, stringify, symbolRE, vueBuiltins };
625
+ export { type AddInspectorApiPayload, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, ESC, INFINITY, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTreeApiPayload, MAX_ARRAY_SIZE, MAX_STRING_SIZE, type ModuleIframeView, type ModuleVNodeView, type ModuleView, NAN, NEGATIVE_INFINITY, type OpenInEditorOptions, type PropPath, type RouterInfo, RouterKey, type ScrollToComponentOptions, type TimelineEvent, type TimelineEventData, type ToggleComponentInspectorOptions, UNDEFINED, type VueInspector, addCustomCommand, addCustomTab, devtools, devtoolsRouterInfo, fnTypeRE, formatInspectorStateValue, getInspectorStateValueType, getRawValue, getRouterDevToolsId, getVueInspector, normalizeRouterInfo, now, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, rawTypeRE, removeCustomCommand, setupDevToolsPlugin, specialTypeRE, stringify, symbolRE, toEdit, toSubmit, vueBuiltins };
package/dist/index.d.ts CHANGED
@@ -381,6 +381,8 @@ declare function addCustomTab(tab: CustomTab): void;
381
381
  declare function getInspectorStateValueType(value: any, raw?: boolean): string;
382
382
  declare function formatInspectorStateValue(value: any, quotes?: boolean): any;
383
383
  declare function getRawValue(value: InspectorState['value']): any;
384
+ declare function toEdit(value: unknown): string;
385
+ declare function toSubmit(value: string): any;
384
386
 
385
387
  declare function stringify<T extends object = Record<string, unknown>>(data: T): string | string[];
386
388
  declare function parse(data: string, revive?: boolean): any;
@@ -620,4 +622,4 @@ declare const devtools: {
620
622
  readonly api: DevToolsPluginApi;
621
623
  };
622
624
 
623
- export { type AddInspectorApiPayload, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, ESC, INFINITY, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTreeApiPayload, MAX_ARRAY_SIZE, MAX_STRING_SIZE, type ModuleIframeView, type ModuleVNodeView, type ModuleView, NAN, NEGATIVE_INFINITY, type OpenInEditorOptions, type PropPath, type RouterInfo, RouterKey, type ScrollToComponentOptions, type TimelineEvent, type TimelineEventData, type ToggleComponentInspectorOptions, UNDEFINED, type VueInspector, addCustomCommand, addCustomTab, devtools, devtoolsRouterInfo, fnTypeRE, formatInspectorStateValue, getInspectorStateValueType, getRawValue, getRouterDevToolsId, getVueInspector, normalizeRouterInfo, now, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, rawTypeRE, removeCustomCommand, setupDevToolsPlugin, specialTypeRE, stringify, symbolRE, vueBuiltins };
625
+ export { type AddInspectorApiPayload, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, ESC, INFINITY, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTreeApiPayload, MAX_ARRAY_SIZE, MAX_STRING_SIZE, type ModuleIframeView, type ModuleVNodeView, type ModuleView, NAN, NEGATIVE_INFINITY, type OpenInEditorOptions, type PropPath, type RouterInfo, RouterKey, type ScrollToComponentOptions, type TimelineEvent, type TimelineEventData, type ToggleComponentInspectorOptions, UNDEFINED, type VueInspector, addCustomCommand, addCustomTab, devtools, devtoolsRouterInfo, fnTypeRE, formatInspectorStateValue, getInspectorStateValueType, getRawValue, getRouterDevToolsId, getVueInspector, normalizeRouterInfo, now, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, rawTypeRE, removeCustomCommand, setupDevToolsPlugin, specialTypeRE, stringify, symbolRE, toEdit, toSubmit, vueBuiltins };
package/dist/index.mjs CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target8) => (target8 = mod != null ? __create(__
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.32_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.32_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -1868,7 +1868,7 @@ init_esm_shims();
1868
1868
  // src/shared/util.ts
1869
1869
  init_esm_shims();
1870
1870
 
1871
- // src/core/component/state/format.ts
1871
+ // src/core/component/state/replacer.ts
1872
1872
  init_esm_shims();
1873
1873
 
1874
1874
  // src/core/component/state/constants.ts
@@ -1943,157 +1943,6 @@ var ESC = {
1943
1943
  "&": "&amp;"
1944
1944
  };
1945
1945
 
1946
- // src/core/component/state/is.ts
1947
- init_esm_shims();
1948
- function isVueInstance(value) {
1949
- return value._ && Object.keys(value._).includes("vnode");
1950
- }
1951
- function isPlainObject(obj) {
1952
- return Object.prototype.toString.call(obj) === "[object Object]";
1953
- }
1954
- function isPrimitive(data) {
1955
- if (data == null)
1956
- return true;
1957
- const type = typeof data;
1958
- return type === "string" || type === "number" || type === "boolean";
1959
- }
1960
- function isRef(raw) {
1961
- return !!raw.__v_isRef;
1962
- }
1963
- function isComputed(raw) {
1964
- return isRef(raw) && !!raw.effect;
1965
- }
1966
- function isReactive(raw) {
1967
- return !!raw.__v_isReactive;
1968
- }
1969
- function isReadOnly(raw) {
1970
- return !!raw.__v_isReadonly;
1971
- }
1972
-
1973
- // src/core/component/state/util.ts
1974
- init_esm_shims();
1975
- function internalStateTokenToString(value) {
1976
- if (value === null)
1977
- return "null";
1978
- else if (value === UNDEFINED)
1979
- return "undefined";
1980
- else if (value === NAN)
1981
- return "NaN";
1982
- else if (value === INFINITY)
1983
- return "Infinity";
1984
- else if (value === NEGATIVE_INFINITY)
1985
- return "-Infinity";
1986
- return false;
1987
- }
1988
- function getPropType(type) {
1989
- if (Array.isArray(type))
1990
- return type.map((t) => getPropType(t)).join(" or ");
1991
- if (type == null)
1992
- return "null";
1993
- const match = type.toString().match(fnTypeRE);
1994
- return typeof type === "function" ? match && match[1] || "any" : "any";
1995
- }
1996
- function sanitize(data) {
1997
- if (!isPrimitive(data) && !Array.isArray(data) && !isPlainObject(data)) {
1998
- return Object.prototype.toString.call(data);
1999
- } else {
2000
- return data;
2001
- }
2002
- }
2003
- function getSetupStateType(raw) {
2004
- return {
2005
- ref: isRef(raw),
2006
- computed: isComputed(raw),
2007
- reactive: isReactive(raw),
2008
- readonly: isReadOnly(raw)
2009
- };
2010
- }
2011
- function toRaw(value) {
2012
- if (value == null ? void 0 : value.__v_raw)
2013
- return value.__v_raw;
2014
- return value;
2015
- }
2016
- function escape(s) {
2017
- return s.replace(/[<>"&]/g, (s2) => {
2018
- return ESC[s2] || s2;
2019
- });
2020
- }
2021
-
2022
- // src/core/component/state/format.ts
2023
- function getInspectorStateValueType(value, raw = true) {
2024
- const type = typeof value;
2025
- if (value == null || value === UNDEFINED) {
2026
- return "null";
2027
- } else if (type === "boolean" || type === "number" || value === INFINITY || value === NEGATIVE_INFINITY || value === NAN) {
2028
- return "literal";
2029
- } else if (value == null ? void 0 : value._custom) {
2030
- if (raw || value._custom.display != null || value._custom.displayText != null)
2031
- return "custom";
2032
- else
2033
- return getInspectorStateValueType(value._custom.value);
2034
- } else if (typeof value === "string") {
2035
- const typeMatch = specialTypeRE.exec(value);
2036
- if (typeMatch) {
2037
- const [, type2] = typeMatch;
2038
- return `native ${type2}`;
2039
- } else {
2040
- return "string";
2041
- }
2042
- } else if (Array.isArray(value) || (value == null ? void 0 : value._isArray)) {
2043
- return "array";
2044
- } else if (isPlainObject(value)) {
2045
- return "plain-object";
2046
- } else {
2047
- return "unknown";
2048
- }
2049
- }
2050
- function formatInspectorStateValue(value, quotes = false) {
2051
- var _a8, _b8;
2052
- let result;
2053
- const type = getInspectorStateValueType(value, false);
2054
- if (type !== "custom" && (value == null ? void 0 : value._custom))
2055
- value = value._custom.value;
2056
- if (result = internalStateTokenToString(value)) {
2057
- return result;
2058
- } else if (type === "custom") {
2059
- const nestedName = ((_a8 = value._custom.value) == null ? void 0 : _a8._custom) && formatInspectorStateValue(value._custom.value);
2060
- return nestedName || value._custom.displayText || value._custom.display;
2061
- } else if (type === "array") {
2062
- return `Array[${value.length}]`;
2063
- } else if (type === "plain-object") {
2064
- return `Object${Object.keys(value).length ? "" : " (empty)"}`;
2065
- } else if (type == null ? void 0 : type.includes("native")) {
2066
- return escape((_b8 = specialTypeRE.exec(value)) == null ? void 0 : _b8[2]);
2067
- } else if (typeof value === "string") {
2068
- const typeMatch = value.match(rawTypeRE);
2069
- if (typeMatch)
2070
- value = escape(typeMatch[1]);
2071
- else if (quotes)
2072
- value = `<span>"</span>${escape(value)}<span>"</span>`;
2073
- else
2074
- value = escape(value);
2075
- value = value.replace(/ /g, "&nbsp;").replace(/\n/g, "<span>\\n</span>");
2076
- }
2077
- return value;
2078
- }
2079
- function getRawValue(value) {
2080
- var _a8, _b8, _c, _d;
2081
- const isCustom = getInspectorStateValueType(value) === "custom";
2082
- let inherit = {};
2083
- if (isCustom) {
2084
- const data = value;
2085
- 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 };
2086
- inherit = nestedCustom.inherit || ((_c = data._custom) == null ? void 0 : _c.fields) || {};
2087
- value = nestedCustom.value || ((_d = data._custom) == null ? void 0 : _d.value);
2088
- }
2089
- if (value && value._isArray)
2090
- value = value.items;
2091
- return { value, inherit };
2092
- }
2093
-
2094
- // src/core/component/state/replacer.ts
2095
- init_esm_shims();
2096
-
2097
1946
  // src/core/component/state/custom.ts
2098
1947
  init_esm_shims();
2099
1948
 
@@ -2200,6 +2049,99 @@ function getComponentInstance(appRecord, instanceId) {
2200
2049
  // src/core/component/state/process.ts
2201
2050
  init_esm_shims();
2202
2051
  import { camelize } from "@vue/devtools-shared";
2052
+
2053
+ // src/core/component/state/util.ts
2054
+ init_esm_shims();
2055
+
2056
+ // src/core/component/state/is.ts
2057
+ init_esm_shims();
2058
+ function isVueInstance(value) {
2059
+ return value._ && Object.keys(value._).includes("vnode");
2060
+ }
2061
+ function isPlainObject(obj) {
2062
+ return Object.prototype.toString.call(obj) === "[object Object]";
2063
+ }
2064
+ function isPrimitive(data) {
2065
+ if (data == null)
2066
+ return true;
2067
+ const type = typeof data;
2068
+ return type === "string" || type === "number" || type === "boolean";
2069
+ }
2070
+ function isRef(raw) {
2071
+ return !!raw.__v_isRef;
2072
+ }
2073
+ function isComputed(raw) {
2074
+ return isRef(raw) && !!raw.effect;
2075
+ }
2076
+ function isReactive(raw) {
2077
+ return !!raw.__v_isReactive;
2078
+ }
2079
+ function isReadOnly(raw) {
2080
+ return !!raw.__v_isReadonly;
2081
+ }
2082
+
2083
+ // src/core/component/state/util.ts
2084
+ var tokenMap = {
2085
+ [UNDEFINED]: "undefined",
2086
+ [NAN]: "NaN",
2087
+ [INFINITY]: "Infinity",
2088
+ [NEGATIVE_INFINITY]: "-Infinity"
2089
+ };
2090
+ var reversedTokenMap = Object.entries(tokenMap).reduce((acc, [key, value]) => {
2091
+ acc[value] = key;
2092
+ return acc;
2093
+ }, {});
2094
+ function internalStateTokenToString(value) {
2095
+ if (value === null)
2096
+ return "null";
2097
+ return typeof value === "string" && tokenMap[value] || false;
2098
+ }
2099
+ function replaceTokenToString(value) {
2100
+ const replaceRegex = new RegExp(`"(${Object.keys(tokenMap).join("|")})"`, "g");
2101
+ return value.replace(replaceRegex, (_, g1) => tokenMap[g1]);
2102
+ }
2103
+ function replaceStringToToken(value) {
2104
+ const literalValue = reversedTokenMap[value.trim()];
2105
+ if (literalValue)
2106
+ return `"${literalValue}"`;
2107
+ const replaceRegex = new RegExp(`:\\s*(${Object.keys(reversedTokenMap).join("|")})`, "g");
2108
+ return value.replace(replaceRegex, (_, g1) => `:"${reversedTokenMap[g1]}"`);
2109
+ }
2110
+ function getPropType(type) {
2111
+ if (Array.isArray(type))
2112
+ return type.map((t) => getPropType(t)).join(" or ");
2113
+ if (type == null)
2114
+ return "null";
2115
+ const match = type.toString().match(fnTypeRE);
2116
+ return typeof type === "function" ? match && match[1] || "any" : "any";
2117
+ }
2118
+ function sanitize(data) {
2119
+ if (!isPrimitive(data) && !Array.isArray(data) && !isPlainObject(data)) {
2120
+ return Object.prototype.toString.call(data);
2121
+ } else {
2122
+ return data;
2123
+ }
2124
+ }
2125
+ function getSetupStateType(raw) {
2126
+ return {
2127
+ ref: isRef(raw),
2128
+ computed: isComputed(raw),
2129
+ reactive: isReactive(raw),
2130
+ readonly: isReadOnly(raw)
2131
+ };
2132
+ }
2133
+ function toRaw(value) {
2134
+ if (value == null ? void 0 : value.__v_raw)
2135
+ return value.__v_raw;
2136
+ return value;
2137
+ }
2138
+ function escape(s) {
2139
+ return s.replace(/[<>"&]/g, (s2) => {
2140
+ return ESC[s2] || s2;
2141
+ });
2142
+ }
2143
+
2144
+ // src/core/component/state/process.ts
2203
2145
  function mergeOptions(to, from, instance) {
2204
2146
  if (typeof from === "function")
2205
2147
  from = from.options;
@@ -2869,6 +2811,86 @@ function parseCircularAutoChunks(data, reviver2 = null) {
2869
2811
  }
2870
2812
  }
2871
2813
 
2814
+ // src/core/component/state/format.ts
2815
+ init_esm_shims();
2816
+ function getInspectorStateValueType(value, raw = true) {
2817
+ const type = typeof value;
2818
+ if (value == null || value === UNDEFINED) {
2819
+ return "null";
2820
+ } else if (type === "boolean" || type === "number" || value === INFINITY || value === NEGATIVE_INFINITY || value === NAN) {
2821
+ return "literal";
2822
+ } else if (value == null ? void 0 : value._custom) {
2823
+ if (raw || value._custom.display != null || value._custom.displayText != null)
2824
+ return "custom";
2825
+ else
2826
+ return getInspectorStateValueType(value._custom.value);
2827
+ } else if (typeof value === "string") {
2828
+ const typeMatch = specialTypeRE.exec(value);
2829
+ if (typeMatch) {
2830
+ const [, type2] = typeMatch;
2831
+ return `native ${type2}`;
2832
+ } else {
2833
+ return "string";
2834
+ }
2835
+ } else if (Array.isArray(value) || (value == null ? void 0 : value._isArray)) {
2836
+ return "array";
2837
+ } else if (isPlainObject(value)) {
2838
+ return "plain-object";
2839
+ } else {
2840
+ return "unknown";
2841
+ }
2842
+ }
2843
+ function formatInspectorStateValue(value, quotes = false) {
2844
+ var _a8, _b8;
2845
+ let result;
2846
+ const type = getInspectorStateValueType(value, false);
2847
+ if (type !== "custom" && (value == null ? void 0 : value._custom))
2848
+ value = value._custom.value;
2849
+ if (result = internalStateTokenToString(value)) {
2850
+ return result;
2851
+ } else if (type === "custom") {
2852
+ const nestedName = ((_a8 = value._custom.value) == null ? void 0 : _a8._custom) && formatInspectorStateValue(value._custom.value);
2853
+ return nestedName || value._custom.displayText || value._custom.display;
2854
+ } else if (type === "array") {
2855
+ return `Array[${value.length}]`;
2856
+ } else if (type === "plain-object") {
2857
+ return `Object${Object.keys(value).length ? "" : " (empty)"}`;
2858
+ } else if (type == null ? void 0 : type.includes("native")) {
2859
+ return escape((_b8 = specialTypeRE.exec(value)) == null ? void 0 : _b8[2]);
2860
+ } else if (typeof value === "string") {
2861
+ const typeMatch = value.match(rawTypeRE);
2862
+ if (typeMatch)
2863
+ value = escape(typeMatch[1]);
2864
+ else if (quotes)
2865
+ value = `<span>"</span>${escape(value)}<span>"</span>`;
2866
+ else
2867
+ value = escape(value);
2868
+ value = value.replace(/ /g, "&nbsp;").replace(/\n/g, "<span>\\n</span>");
2869
+ }
2870
+ return value;
2871
+ }
2872
+ function getRawValue(value) {
2873
+ var _a8, _b8;
2874
+ const isCustom = getInspectorStateValueType(value) === "custom";
2875
+ let inherit = {};
2876
+ if (isCustom) {
2877
+ const data = value;
2878
+ const customValue = (_a8 = data._custom) == null ? void 0 : _a8.value;
2879
+ const nestedCustom = typeof customValue === "object" && customValue !== null && "_custom" in customValue ? getRawValue(customValue) : { inherit: void 0, value: void 0 };
2880
+ inherit = nestedCustom.inherit || ((_b8 = data._custom) == null ? void 0 : _b8.fields) || {};
2881
+ value = nestedCustom.value || customValue;
2882
+ }
2883
+ if (value && value._isArray)
2884
+ value = value.items;
2885
+ return { value, inherit };
2886
+ }
2887
+ function toEdit(value) {
2888
+ return replaceTokenToString(JSON.stringify(value));
2889
+ }
2890
+ function toSubmit(value) {
2891
+ return JSON.parse(replaceStringToToken(value), reviver);
2892
+ }
2893
+
2872
2894
  // src/shared/util.ts
2873
2895
  function stringify(data) {
2874
2896
  return stringifyCircularAutoChunks(data, stringifyReplacer);
@@ -2992,15 +3014,14 @@ var RefStateEditor = class {
2992
3014
  if (isRef2(ref)) {
2993
3015
  ref.value = value;
2994
3016
  } else {
2995
- const obj = JSON.parse(value);
2996
3017
  const previousKeys = Object.keys(ref);
2997
- const currentKeys = Object.keys(obj);
3018
+ const currentKeys = Object.keys(value);
2998
3019
  if (previousKeys.length > currentKeys.length) {
2999
3020
  const diffKeys = previousKeys.filter((key) => !currentKeys.includes(key));
3000
3021
  diffKeys.forEach((key) => Reflect.deleteProperty(ref, key));
3001
3022
  }
3002
3023
  currentKeys.forEach((key) => {
3003
- Reflect.set(ref, key, Reflect.get(obj, key));
3024
+ Reflect.set(ref, key, Reflect.get(value, key));
3004
3025
  });
3005
3026
  }
3006
3027
  }
@@ -4270,5 +4291,7 @@ export {
4270
4291
  specialTypeRE,
4271
4292
  stringify,
4272
4293
  symbolRE,
4294
+ toEdit,
4295
+ toSubmit,
4273
4296
  vueBuiltins
4274
4297
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue/devtools-kit",
3
3
  "type": "module",
4
- "version": "7.0.10",
4
+ "version": "7.0.12",
5
5
  "author": "webfansplz",
6
6
  "license": "MIT",
7
7
  "exports": {
@@ -21,11 +21,11 @@
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.10",
25
- "@vue/devtools-shared": "^7.0.10"
24
+ "@vue/devtools-schema": "^7.0.12",
25
+ "@vue/devtools-shared": "^7.0.12"
26
26
  },
27
27
  "devDependencies": {
28
- "vue": "^3.4.4",
28
+ "vue": "^3.4.15",
29
29
  "vue-router": "^4.2.5"
30
30
  },
31
31
  "scripts": {