msw-dev-tool 1.1.7 → 1.1.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/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { useState, useLayoutEffect, useEffect, useMemo, useId as useId$1, forwardRef } from 'react';
2
+ import React__default, { useState, useLayoutEffect, useEffect, useMemo, forwardRef, createElement, useId as useId$1 } from 'react';
3
3
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
4
4
  import * as ReactDOM from 'react-dom';
5
5
  import ReactDOM__default from 'react-dom';
@@ -27940,13 +27940,14 @@ const useUiControlStore = create((set) => ({
27940
27940
  const HttpControl = () => {
27941
27941
  const table = useFlattenHandlersTable();
27942
27942
  const { setDebuggerHandler } = useUiControlStore();
27943
+ const currentHandler = useUiControlStore((state) => state.currentHandler);
27943
27944
  return (React__default.createElement(p$3, { style: { flex: 3, overflowY: "auto" }, direction: "column", gap: "4" },
27944
27945
  React__default.createElement(r$8, { as: "h2", size: "5" }, "Handlers"),
27945
27946
  React__default.createElement(m, { onDragStart: (e) => e.stopPropagation(), style: { userSelect: "text" } },
27946
27947
  React__default.createElement(d, null, table.getHeaderGroups().map((headerGroup) => (React__default.createElement(P, { key: headerGroup.id }, headerGroup.headers.map((header) => (React__default.createElement(f$1, { key: header.id }, header.isPlaceholder
27947
27948
  ? null
27948
27949
  : flexRender(header.column.columnDef.header, header.getContext())))))))),
27949
- React__default.createElement(b, null, table.getRowModel().rows.map((row) => (React__default.createElement(P, { key: row.id, align: "center", className: "msw-dt-http-control-row", onClick: () => {
27950
+ React__default.createElement(b, null, table.getRowModel().rows.map((row) => (React__default.createElement(P, { key: row.id, align: "center", className: `msw-dt-http-control-row ${row.original.handler === currentHandler && "msw-dt-current-row"}`, onClick: () => {
27950
27951
  setDebuggerHandler(row.original.handler);
27951
27952
  } }, row.getVisibleCells().map((cell) => (React__default.createElement(T, { key: cell.id }, flexRender(cell.column.columnDef.cell, cell.getContext())))))))))));
27952
27953
  };
@@ -27967,6 +27968,109 @@ const PathParamSetter = ({ paramValues, onParamChange, }) => {
27967
27968
  } }))))))));
27968
27969
  };
27969
27970
 
27971
+ function _objectWithoutPropertiesLoose(source, excluded) {
27972
+ if (source == null) return {};
27973
+ var target = {};
27974
+ var sourceKeys = Object.keys(source);
27975
+ var key, i;
27976
+
27977
+ for (i = 0; i < sourceKeys.length; i++) {
27978
+ key = sourceKeys[i];
27979
+ if (excluded.indexOf(key) >= 0) continue;
27980
+ target[key] = source[key];
27981
+ }
27982
+
27983
+ return target;
27984
+ }
27985
+
27986
+ var _excluded$3w = ["color"];
27987
+ var PlayIcon = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
27988
+ var _ref$color = _ref.color,
27989
+ color = _ref$color === void 0 ? 'currentColor' : _ref$color,
27990
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3w);
27991
+
27992
+ return createElement("svg", Object.assign({
27993
+ width: "15",
27994
+ height: "15",
27995
+ viewBox: "0 0 15 15",
27996
+ fill: "none",
27997
+ xmlns: "http://www.w3.org/2000/svg"
27998
+ }, props, {
27999
+ ref: forwardedRef
28000
+ }), createElement("path", {
28001
+ d: "M3.24182 2.32181C3.3919 2.23132 3.5784 2.22601 3.73338 2.30781L12.7334 7.05781C12.8974 7.14436 13 7.31457 13 7.5C13 7.68543 12.8974 7.85564 12.7334 7.94219L3.73338 12.6922C3.5784 12.774 3.3919 12.7687 3.24182 12.6782C3.09175 12.5877 3 12.4252 3 12.25V2.75C3 2.57476 3.09175 2.4123 3.24182 2.32181ZM4 3.57925V11.4207L11.4288 7.5L4 3.57925Z",
28002
+ fill: color,
28003
+ fillRule: "evenodd",
28004
+ clipRule: "evenodd"
28005
+ }));
28006
+ });
28007
+
28008
+ var _excluded$3x = ["color"];
28009
+ var PlusIcon = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
28010
+ var _ref$color = _ref.color,
28011
+ color = _ref$color === void 0 ? 'currentColor' : _ref$color,
28012
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3x);
28013
+
28014
+ return createElement("svg", Object.assign({
28015
+ width: "15",
28016
+ height: "15",
28017
+ viewBox: "0 0 15 15",
28018
+ fill: "none",
28019
+ xmlns: "http://www.w3.org/2000/svg"
28020
+ }, props, {
28021
+ ref: forwardedRef
28022
+ }), createElement("path", {
28023
+ d: "M8 2.75C8 2.47386 7.77614 2.25 7.5 2.25C7.22386 2.25 7 2.47386 7 2.75V7H2.75C2.47386 7 2.25 7.22386 2.25 7.5C2.25 7.77614 2.47386 8 2.75 8H7V12.25C7 12.5261 7.22386 12.75 7.5 12.75C7.77614 12.75 8 12.5261 8 12.25V8H12.25C12.5261 8 12.75 7.77614 12.75 7.5C12.75 7.22386 12.5261 7 12.25 7H8V2.75Z",
28024
+ fill: color,
28025
+ fillRule: "evenodd",
28026
+ clipRule: "evenodd"
28027
+ }));
28028
+ });
28029
+
28030
+ var _excluded$3E = ["color"];
28031
+ var ReloadIcon = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
28032
+ var _ref$color = _ref.color,
28033
+ color = _ref$color === void 0 ? 'currentColor' : _ref$color,
28034
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3E);
28035
+
28036
+ return createElement("svg", Object.assign({
28037
+ width: "15",
28038
+ height: "15",
28039
+ viewBox: "0 0 15 15",
28040
+ fill: "none",
28041
+ xmlns: "http://www.w3.org/2000/svg"
28042
+ }, props, {
28043
+ ref: forwardedRef
28044
+ }), createElement("path", {
28045
+ d: "M1.84998 7.49998C1.84998 4.66458 4.05979 1.84998 7.49998 1.84998C10.2783 1.84998 11.6515 3.9064 12.2367 5H10.5C10.2239 5 10 5.22386 10 5.5C10 5.77614 10.2239 6 10.5 6H13.5C13.7761 6 14 5.77614 14 5.5V2.5C14 2.22386 13.7761 2 13.5 2C13.2239 2 13 2.22386 13 2.5V4.31318C12.2955 3.07126 10.6659 0.849976 7.49998 0.849976C3.43716 0.849976 0.849976 4.18537 0.849976 7.49998C0.849976 10.8146 3.43716 14.15 7.49998 14.15C9.44382 14.15 11.0622 13.3808 12.2145 12.2084C12.8315 11.5806 13.3133 10.839 13.6418 10.0407C13.7469 9.78536 13.6251 9.49315 13.3698 9.38806C13.1144 9.28296 12.8222 9.40478 12.7171 9.66014C12.4363 10.3425 12.0251 10.9745 11.5013 11.5074C10.5295 12.4963 9.16504 13.15 7.49998 13.15C4.05979 13.15 1.84998 10.3354 1.84998 7.49998Z",
28046
+ fill: color,
28047
+ fillRule: "evenodd",
28048
+ clipRule: "evenodd"
28049
+ }));
28050
+ });
28051
+
28052
+ var _excluded$4G = ["color"];
28053
+ var TrashIcon = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
28054
+ var _ref$color = _ref.color,
28055
+ color = _ref$color === void 0 ? 'currentColor' : _ref$color,
28056
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4G);
28057
+
28058
+ return createElement("svg", Object.assign({
28059
+ width: "15",
28060
+ height: "15",
28061
+ viewBox: "0 0 15 15",
28062
+ fill: "none",
28063
+ xmlns: "http://www.w3.org/2000/svg"
28064
+ }, props, {
28065
+ ref: forwardedRef
28066
+ }), createElement("path", {
28067
+ d: "M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z",
28068
+ fill: color,
28069
+ fillRule: "evenodd",
28070
+ clipRule: "evenodd"
28071
+ }));
28072
+ });
28073
+
27970
28074
  const KeyValueInputList = ({ items, setItems, title, }) => {
27971
28075
  const id = useId$1();
27972
28076
  const [key, setKey] = useState("");
@@ -28003,15 +28107,27 @@ const KeyValueInputList = ({ items, setItems, title, }) => {
28003
28107
  border: "1px solid #ccc",
28004
28108
  width: "180px",
28005
28109
  } }),
28006
- React__default.createElement(o$2, { onClick: handleAdd, variant: "soft" }, "Add")),
28110
+ React__default.createElement(o$2, { onClick: handleAdd, variant: "soft" },
28111
+ React__default.createElement(PlusIcon, null),
28112
+ "Add")),
28007
28113
  React__default.createElement(p$3, { direction: "column", gap: "1" }, Object.entries(items).map(([key, value]) => (React__default.createElement(p$3, { key: key, style: {
28008
28114
  backgroundColor: "#f5f5f5",
28009
28115
  borderRadius: "4px",
28010
- width: "fit-content"
28116
+ width: "fit-content",
28011
28117
  }, align: "center", gap: "2", py: "1" },
28012
- React__default.createElement("span", { style: { width: "160px", paddingLeft: "8px", boxSizing: "border-box" } }, key),
28013
- React__default.createElement("span", { style: { width: "180px", paddingLeft: "8px", boxSizing: "border-box" } }, value),
28014
- React__default.createElement(o$2, { onClick: () => handleDelete(key), variant: "soft", color: "crimson" }, "Delete")))))));
28118
+ React__default.createElement("span", { style: {
28119
+ width: "160px",
28120
+ paddingLeft: "8px",
28121
+ boxSizing: "border-box",
28122
+ } }, key),
28123
+ React__default.createElement("span", { style: {
28124
+ width: "180px",
28125
+ paddingLeft: "8px",
28126
+ boxSizing: "border-box",
28127
+ } }, value),
28128
+ React__default.createElement(o$2, { onClick: () => handleDelete(key), variant: "soft", color: "crimson" },
28129
+ React__default.createElement(TrashIcon, null),
28130
+ "Delete")))))));
28015
28131
  };
28016
28132
 
28017
28133
  /**
@@ -28085,7 +28201,9 @@ const RequestPreview = ({ url, paramValues, headers = {}, searchParams = {}, })
28085
28201
  borderRadius: "4px",
28086
28202
  backgroundColor: loading ? "#f5f5f5" : undefined,
28087
28203
  cursor: loading ? "not-allowed" : "pointer",
28088
- }, color: "gray", variant: "outline" }, loading ? "Fetching..." : "Send Request"),
28204
+ }, color: "gray", variant: "outline" },
28205
+ React__default.createElement(PlayIcon, null),
28206
+ loading ? "Fetching..." : "Send Request"),
28089
28207
  error && (React__default.createElement(p$6, { style: {
28090
28208
  marginTop: "8px",
28091
28209
  color: "#f44336",
@@ -28170,7 +28288,9 @@ ThemeProvider.displayName = "ThemeProvider";
28170
28288
  const ToolButtonGroup = () => {
28171
28289
  const { resetMSWDevTool } = useHandlerStore();
28172
28290
  return (React__default.createElement(p$3, { gap: "8", py: "4" },
28173
- React__default.createElement(o$2, { onClick: () => resetMSWDevTool() }, "Reset Dev tool")));
28291
+ React__default.createElement(o$2, { onClick: () => resetMSWDevTool() },
28292
+ React__default.createElement(ReloadIcon, null),
28293
+ "Reset Dev tool")));
28174
28294
  };
28175
28295
 
28176
28296
  const MSWDevTool = () => {