@tanstack/pacer-devtools 1.3.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -6
- package/dist/{components-hqYwCNDx.js → components-BwcTEJfm.js} +34 -14
- package/dist/{components-DZv7GBzY.js → components-D6zc5Wjw.js} +49 -29
- package/dist/index.d.ts +6 -4
- package/dist/index.js +1 -1
- package/dist/production/index.d.ts +2 -3
- package/dist/production/index.js +1 -1
- package/dist/production/server.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +12 -12
- package/src/PacerContextProvider.tsx +0 -172
- package/src/components/ActionButtons.tsx +0 -170
- package/src/components/DetailsPanel.tsx +0 -62
- package/src/components/Shell.tsx +0 -176
- package/src/components/StateHeader.tsx +0 -139
- package/src/components/UtilList.tsx +0 -62
- package/src/components/UtilStateJsonTree.tsx +0 -25
- package/src/components/index.tsx +0 -19
- package/src/components/util-groups.ts +0 -54
- package/src/core.tsx +0 -9
- package/src/index.ts +0 -10
- package/src/production.ts +0 -5
- package/src/styles/tokens.ts +0 -305
- package/src/styles/use-styles.ts +0 -385
- package/src/utils/read-pacer-store-state.ts +0 -33
package/README.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<
|
|
2
|
+
<picture>
|
|
3
|
+
<source
|
|
4
|
+
media="(prefers-color-scheme: dark)"
|
|
5
|
+
srcset="https://tanstack.com/api/readme/pacer.png?theme=dark"
|
|
6
|
+
/>
|
|
7
|
+
<source
|
|
8
|
+
media="(prefers-color-scheme: light)"
|
|
9
|
+
srcset="https://tanstack.com/api/readme/pacer.png"
|
|
10
|
+
/>
|
|
11
|
+
<img
|
|
12
|
+
src="https://tanstack.com/api/readme/pacer.png"
|
|
13
|
+
alt="TanStack Pacer"
|
|
14
|
+
width="900"
|
|
15
|
+
/>
|
|
16
|
+
</picture>
|
|
3
17
|
</div>
|
|
4
18
|
|
|
5
19
|
<br />
|
|
@@ -29,8 +43,9 @@
|
|
|
29
43
|
</div>
|
|
30
44
|
|
|
31
45
|
<div align="center">
|
|
32
|
-
|
|
46
|
+
|
|
33
47
|
### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/)
|
|
48
|
+
|
|
34
49
|
</div>
|
|
35
50
|
|
|
36
51
|
# TanStack Pacer
|
|
@@ -88,10 +103,10 @@ A lightweight timing and scheduling library for debouncing, throttling, rate lim
|
|
|
88
103
|
> [!NOTE]
|
|
89
104
|
> You may know **TanStack Pacer** by our adapter names, too!
|
|
90
105
|
>
|
|
91
|
-
> - [**React Pacer**](https://tanstack.com/pacer/latest/docs/framework/react
|
|
92
|
-
> - [**Preact Pacer**](https://tanstack.com/pacer/latest/docs/framework/preact
|
|
93
|
-
> - [**Solid Pacer**](https://tanstack.com/pacer/latest/docs/framework/solid
|
|
94
|
-
> - [**Angular Pacer**](https://tanstack.com/pacer/latest/docs/framework/angular
|
|
106
|
+
> - [**React Pacer**](https://tanstack.com/pacer/latest/docs/framework/react)
|
|
107
|
+
> - [**Preact Pacer**](https://tanstack.com/pacer/latest/docs/framework/preact)
|
|
108
|
+
> - [**Solid Pacer**](https://tanstack.com/pacer/latest/docs/framework/solid)
|
|
109
|
+
> - [**Angular Pacer**](https://tanstack.com/pacer/latest/docs/framework/angular)
|
|
95
110
|
> - Svelte Pacer - needs a contributor!
|
|
96
111
|
> - Vue Pacer - needs a contributor!
|
|
97
112
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { className, createComponent, delegateEvents, effect, insert, memo, setStyleProperty, style, template, use } from "solid-js/web";
|
|
2
|
-
import { Header, HeaderLogo, JsonTree, MainPanel, ThemeContextProvider,
|
|
2
|
+
import { Header, HeaderLogo, JsonTree, MainPanel, ThemeContextProvider, createTheme } from "@tanstack/devtools-ui";
|
|
3
3
|
import { createStore, produce } from "solid-js/store";
|
|
4
4
|
import { For, Show, createContext, createEffect, createMemo, createSignal, onCleanup, onMount, useContext } from "solid-js";
|
|
5
5
|
import { getPacerDevtoolsInstance, pacerEventClient } from "@tanstack/pacer/event-client";
|
|
@@ -779,7 +779,7 @@ const stylesFactory = (theme) => {
|
|
|
779
779
|
};
|
|
780
780
|
};
|
|
781
781
|
function useStyles() {
|
|
782
|
-
const { theme } =
|
|
782
|
+
const { theme } = createTheme();
|
|
783
783
|
const [styles, setStyles] = createSignal(stylesFactory(theme()));
|
|
784
784
|
createEffect(() => {
|
|
785
785
|
setStyles(stylesFactory(theme()));
|
|
@@ -842,7 +842,9 @@ const UTIL_GROUPS = [
|
|
|
842
842
|
];
|
|
843
843
|
//#endregion
|
|
844
844
|
//#region src/components/UtilList.tsx
|
|
845
|
-
var _tmpl$$4 =
|
|
845
|
+
var _tmpl$$4 = /*#__PURE__*/ template(`<div>`);
|
|
846
|
+
var _tmpl$2$3 = /*#__PURE__*/ template(`<div><div>`);
|
|
847
|
+
var _tmpl$3$2 = /*#__PURE__*/ template(`<div><div></div><div>`);
|
|
846
848
|
function UtilList(props) {
|
|
847
849
|
const styles = useStyles();
|
|
848
850
|
return (() => {
|
|
@@ -921,7 +923,13 @@ function getPacerUtilStoreState(instance) {
|
|
|
921
923
|
}
|
|
922
924
|
//#endregion
|
|
923
925
|
//#region src/components/ActionButtons.tsx
|
|
924
|
-
var _tmpl$$3 =
|
|
926
|
+
var _tmpl$$3 = /*#__PURE__*/ template(`<div>No actions available for this util`);
|
|
927
|
+
var _tmpl$2$2 = /*#__PURE__*/ template(`<div>`);
|
|
928
|
+
var _tmpl$3$1 = /*#__PURE__*/ template(`<button><span>`);
|
|
929
|
+
var _tmpl$4 = /*#__PURE__*/ template(`<button><span></span>Flush`);
|
|
930
|
+
var _tmpl$5 = /*#__PURE__*/ template(`<button><span></span>Cancel`);
|
|
931
|
+
var _tmpl$6 = /*#__PURE__*/ template(`<button><span></span>Reset`);
|
|
932
|
+
var _tmpl$7 = /*#__PURE__*/ template(`<button><span></span>Clear`);
|
|
925
933
|
function ActionButtons(props) {
|
|
926
934
|
const styles = useStyles();
|
|
927
935
|
const utilInstance = props.instance;
|
|
@@ -1083,16 +1091,20 @@ function ActionButtons(props) {
|
|
|
1083
1091
|
}
|
|
1084
1092
|
delegateEvents(["mousedown"]);
|
|
1085
1093
|
//#endregion
|
|
1086
|
-
//#region src/
|
|
1087
|
-
|
|
1088
|
-
|
|
1094
|
+
//#region src/utils/reduction-from-state.ts
|
|
1095
|
+
/**
|
|
1096
|
+
* Calculates the percentage of requests saved by a Pacer utility.
|
|
1097
|
+
* Async batch totals include both successful and failed items because both
|
|
1098
|
+
* outcomes contribute to the completed execution count.
|
|
1099
|
+
*/
|
|
1089
1100
|
function reductionFromState(entry, state) {
|
|
1090
1101
|
if (!state) return 0;
|
|
1091
|
-
const
|
|
1102
|
+
const isAsync = entry.type.toLowerCase().includes("async");
|
|
1103
|
+
const completedExecutions = isAsync ? Number(state.settleCount ?? state.settledCount) || 0 : Number(state.executionCount) || 0;
|
|
1092
1104
|
if (entry.type.toLowerCase().includes("batcher")) {
|
|
1093
|
-
const
|
|
1094
|
-
if (
|
|
1095
|
-
return Math.round((
|
|
1105
|
+
const totalItems = (Number(state.totalItemsProcessed) || 0) + (isAsync ? Number(state.totalItemsFailed) || 0 : 0);
|
|
1106
|
+
if (totalItems === 0) return 0;
|
|
1107
|
+
return Math.round((totalItems - completedExecutions) / totalItems * 100);
|
|
1096
1108
|
}
|
|
1097
1109
|
let requestCount = 0;
|
|
1098
1110
|
if (state.maybeExecuteCount !== void 0) requestCount = Number(state.maybeExecuteCount) || 0;
|
|
@@ -1102,6 +1114,10 @@ function reductionFromState(entry, state) {
|
|
|
1102
1114
|
const reduction = requestCount - completedExecutions;
|
|
1103
1115
|
return Math.round(reduction / requestCount * 100);
|
|
1104
1116
|
}
|
|
1117
|
+
//#endregion
|
|
1118
|
+
//#region src/components/StateHeader.tsx
|
|
1119
|
+
var _tmpl$$2 = /*#__PURE__*/ template(`<div><div></div><div style=display:flex;align-items:center;gap:16px><div><div>Key</div><div></div><div>Last Updated</div><div> (<!>)</div></div><div style=margin-left:auto;font-weight:bold>% reduction`);
|
|
1120
|
+
dayjs.extend(relativeTime);
|
|
1105
1121
|
function StateHeaderInner(props) {
|
|
1106
1122
|
const key = props.entry.instance.key;
|
|
1107
1123
|
const updatedAt = () => props.utilState().lastUpdatedByKey[key] ?? Date.now();
|
|
@@ -1198,7 +1214,9 @@ function UtilStateJsonTree(props) {
|
|
|
1198
1214
|
}
|
|
1199
1215
|
//#endregion
|
|
1200
1216
|
//#region src/components/DetailsPanel.tsx
|
|
1201
|
-
var _tmpl$$1 =
|
|
1217
|
+
var _tmpl$$1 = /*#__PURE__*/ template(`<div>`);
|
|
1218
|
+
var _tmpl$2$1 = /*#__PURE__*/ template(`<div>Select a util from the left panel to view its state`);
|
|
1219
|
+
var _tmpl$3 = /*#__PURE__*/ template(`<div><div><div>Actions</div></div><div><div>State</div><div></div></div><div><div>Options</div><div>`);
|
|
1202
1220
|
function DetailsPanel(props) {
|
|
1203
1221
|
const styles = useStyles();
|
|
1204
1222
|
return (() => {
|
|
@@ -1265,7 +1283,8 @@ function DetailsPanel(props) {
|
|
|
1265
1283
|
}
|
|
1266
1284
|
//#endregion
|
|
1267
1285
|
//#region src/components/Shell.tsx
|
|
1268
|
-
var _tmpl$ =
|
|
1286
|
+
var _tmpl$ = /*#__PURE__*/ template(`<div><div style=min-width:150px;max-width:800px></div><div></div><div style=flex:1><div>Details`);
|
|
1287
|
+
var _tmpl$2 = /*#__PURE__*/ template(`<div>`);
|
|
1269
1288
|
function readResizeObserverBlockSize(entry) {
|
|
1270
1289
|
const [box] = entry.borderBoxSize;
|
|
1271
1290
|
if (box !== void 0) return box.blockSize;
|
|
@@ -1313,7 +1332,8 @@ function Shell() {
|
|
|
1313
1332
|
if (!isDragging()) return;
|
|
1314
1333
|
e.preventDefault();
|
|
1315
1334
|
const deltaX = e.clientX - dragStartX;
|
|
1316
|
-
|
|
1335
|
+
const newWidth = Math.max(150, Math.min(800, dragStartWidth + deltaX));
|
|
1336
|
+
setLeftPanelWidth(newWidth);
|
|
1317
1337
|
};
|
|
1318
1338
|
const handleMouseUp = () => {
|
|
1319
1339
|
setIsDragging(false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createComponent, escape, ssr, ssrAttribute, ssrStyle, ssrStyleProperty } from "solid-js/web";
|
|
2
|
-
import { Header, HeaderLogo, JsonTree, MainPanel, ThemeContextProvider,
|
|
2
|
+
import { Header, HeaderLogo, JsonTree, MainPanel, ThemeContextProvider, createTheme } from "@tanstack/devtools-ui";
|
|
3
3
|
import { createStore, produce } from "solid-js/store";
|
|
4
4
|
import { For, Show, createContext, createEffect, createMemo, createSignal, onCleanup, onMount, useContext } from "solid-js";
|
|
5
5
|
import { getPacerDevtoolsInstance, pacerEventClient } from "@tanstack/pacer/event-client";
|
|
@@ -778,7 +778,7 @@ const stylesFactory = (theme) => {
|
|
|
778
778
|
};
|
|
779
779
|
};
|
|
780
780
|
function useStyles() {
|
|
781
|
-
const { theme } =
|
|
781
|
+
const { theme } = createTheme();
|
|
782
782
|
const [styles, setStyles] = createSignal(stylesFactory(theme()));
|
|
783
783
|
createEffect(() => {
|
|
784
784
|
setStyles(stylesFactory(theme()));
|
|
@@ -845,13 +845,15 @@ var _tmpl$$4 = [
|
|
|
845
845
|
"<div",
|
|
846
846
|
">",
|
|
847
847
|
"</div>"
|
|
848
|
-
]
|
|
848
|
+
];
|
|
849
|
+
var _tmpl$2$3 = [
|
|
849
850
|
"<div",
|
|
850
851
|
"><div",
|
|
851
852
|
">",
|
|
852
853
|
"</div>",
|
|
853
854
|
"</div>"
|
|
854
|
-
]
|
|
855
|
+
];
|
|
856
|
+
var _tmpl$3$2 = [
|
|
855
857
|
"<div",
|
|
856
858
|
"><div",
|
|
857
859
|
">",
|
|
@@ -900,7 +902,8 @@ function getPacerUtilStoreState(instance) {
|
|
|
900
902
|
}
|
|
901
903
|
//#endregion
|
|
902
904
|
//#region src/components/ActionButtons.tsx
|
|
903
|
-
var _tmpl$$3 = ["<div", ">No actions available for this util</div>"]
|
|
905
|
+
var _tmpl$$3 = ["<div", ">No actions available for this util</div>"];
|
|
906
|
+
var _tmpl$2$2 = [
|
|
904
907
|
"<div",
|
|
905
908
|
">",
|
|
906
909
|
"",
|
|
@@ -909,26 +912,31 @@ var _tmpl$$3 = ["<div", ">No actions available for this util</div>"], _tmpl$2$2
|
|
|
909
912
|
"",
|
|
910
913
|
"",
|
|
911
914
|
"</div>"
|
|
912
|
-
]
|
|
915
|
+
];
|
|
916
|
+
var _tmpl$3$1 = [
|
|
913
917
|
"<button",
|
|
914
918
|
"><span",
|
|
915
919
|
"></span>",
|
|
916
920
|
"</button>"
|
|
917
|
-
]
|
|
921
|
+
];
|
|
922
|
+
var _tmpl$4 = [
|
|
918
923
|
"<button",
|
|
919
924
|
"",
|
|
920
925
|
"><span",
|
|
921
926
|
"></span>Flush</button>"
|
|
922
|
-
]
|
|
927
|
+
];
|
|
928
|
+
var _tmpl$5 = [
|
|
923
929
|
"<button",
|
|
924
930
|
"",
|
|
925
931
|
"><span",
|
|
926
932
|
"></span>Cancel</button>"
|
|
927
|
-
]
|
|
933
|
+
];
|
|
934
|
+
var _tmpl$6 = [
|
|
928
935
|
"<button",
|
|
929
936
|
"><span",
|
|
930
937
|
"></span>Reset</button>"
|
|
931
|
-
]
|
|
938
|
+
];
|
|
939
|
+
var _tmpl$7 = [
|
|
932
940
|
"<button",
|
|
933
941
|
"",
|
|
934
942
|
"><span",
|
|
@@ -968,6 +976,30 @@ function ActionButtons(props) {
|
|
|
968
976
|
return ssr(_tmpl$2$2, ssrAttribute("class", escape(styles().actionsRow, true), false), hasPending() && ssr(_tmpl$3$1, ssrAttribute("class", escape(styles().actionButton, true), false), ssrAttribute("class", escape(styles().actionDotBlue, true), false), isPending() ? "Restore Pending" : "Trigger Pending"), hasFlush && ssr(_tmpl$4, ssrAttribute("class", escape(styles().actionButton, true), false), ssrAttribute("disabled", utilNameLower.includes("debouncer") && !isPending() || utilNameLower.includes("throttler") && !isPending() || utilNameLower.includes("batcher") && isEmptyFlag() || utilNameLower.includes("queuer") && isEmptyFlag(), true), ssrAttribute("class", escape(styles().actionDotGreen, true), false)), hasCancel && ssr(_tmpl$5, ssrAttribute("class", escape(styles().actionButton, true), false), ssrAttribute("disabled", utilNameLower.includes("debouncer") && !isPending() || utilNameLower.includes("throttler") && !isPending() || utilNameLower.includes("batcher") && isEmptyFlag() || utilNameLower.includes("queuer") && isEmptyFlag(), true), ssrAttribute("class", escape(styles().actionDotRed, true), false)), hasReset && ssr(_tmpl$6, ssrAttribute("class", escape(styles().actionButton, true), false), ssrAttribute("class", escape(styles().actionDotYellow, true), false)), hasClear && ssr(_tmpl$7, ssrAttribute("class", escape(styles().actionButton, true), false), ssrAttribute("disabled", utilNameLower.includes("batcher") && isEmptyFlag() || utilNameLower.includes("queuer") && isEmptyFlag(), true), ssrAttribute("class", escape(styles().actionDotOrange, true), false)), hasStartStop && ssr(_tmpl$3$1, ssrAttribute("class", escape(styles().actionButton, true), false), ssrAttribute("class", escape(styles().actionDotPurple, true), false), isRunning() ? "Stop" : "Start"));
|
|
969
977
|
}
|
|
970
978
|
//#endregion
|
|
979
|
+
//#region src/utils/reduction-from-state.ts
|
|
980
|
+
/**
|
|
981
|
+
* Calculates the percentage of requests saved by a Pacer utility.
|
|
982
|
+
* Async batch totals include both successful and failed items because both
|
|
983
|
+
* outcomes contribute to the completed execution count.
|
|
984
|
+
*/
|
|
985
|
+
function reductionFromState(entry, state) {
|
|
986
|
+
if (!state) return 0;
|
|
987
|
+
const isAsync = entry.type.toLowerCase().includes("async");
|
|
988
|
+
const completedExecutions = isAsync ? Number(state.settleCount ?? state.settledCount) || 0 : Number(state.executionCount) || 0;
|
|
989
|
+
if (entry.type.toLowerCase().includes("batcher")) {
|
|
990
|
+
const totalItems = (Number(state.totalItemsProcessed) || 0) + (isAsync ? Number(state.totalItemsFailed) || 0 : 0);
|
|
991
|
+
if (totalItems === 0) return 0;
|
|
992
|
+
return Math.round((totalItems - completedExecutions) / totalItems * 100);
|
|
993
|
+
}
|
|
994
|
+
let requestCount = 0;
|
|
995
|
+
if (state.maybeExecuteCount !== void 0) requestCount = Number(state.maybeExecuteCount) || 0;
|
|
996
|
+
else if (state.addItemCount !== void 0) requestCount = Number(state.addItemCount) || 0;
|
|
997
|
+
else return 0;
|
|
998
|
+
if (requestCount === 0) return 0;
|
|
999
|
+
const reduction = requestCount - completedExecutions;
|
|
1000
|
+
return Math.round(reduction / requestCount * 100);
|
|
1001
|
+
}
|
|
1002
|
+
//#endregion
|
|
971
1003
|
//#region src/components/StateHeader.tsx
|
|
972
1004
|
var _tmpl$$2 = [
|
|
973
1005
|
"<div",
|
|
@@ -988,22 +1020,6 @@ var _tmpl$$2 = [
|
|
|
988
1020
|
"% reduction</div></div></div>"
|
|
989
1021
|
];
|
|
990
1022
|
dayjs.extend(relativeTime);
|
|
991
|
-
function reductionFromState(entry, state) {
|
|
992
|
-
if (!state) return 0;
|
|
993
|
-
const completedExecutions = entry.type.toLowerCase().includes("async") ? Number(state.settleCount) || 0 : Number(state.executionCount) || 0;
|
|
994
|
-
if (entry.type.toLowerCase().includes("batcher")) {
|
|
995
|
-
const totalItemsProcessed = Number(state.totalItemsProcessed) || 0;
|
|
996
|
-
if (totalItemsProcessed === 0) return 0;
|
|
997
|
-
return Math.round((totalItemsProcessed - completedExecutions) / totalItemsProcessed * 100);
|
|
998
|
-
}
|
|
999
|
-
let requestCount = 0;
|
|
1000
|
-
if (state.maybeExecuteCount !== void 0) requestCount = Number(state.maybeExecuteCount) || 0;
|
|
1001
|
-
else if (state.addItemCount !== void 0) requestCount = Number(state.addItemCount) || 0;
|
|
1002
|
-
else return 0;
|
|
1003
|
-
if (requestCount === 0) return 0;
|
|
1004
|
-
const reduction = requestCount - completedExecutions;
|
|
1005
|
-
return Math.round(reduction / requestCount * 100);
|
|
1006
|
-
}
|
|
1007
1023
|
function StateHeaderInner(props) {
|
|
1008
1024
|
const key = props.entry.instance.key;
|
|
1009
1025
|
const updatedAt = () => props.utilState().lastUpdatedByKey[key] ?? Date.now();
|
|
@@ -1073,7 +1089,9 @@ var _tmpl$$1 = [
|
|
|
1073
1089
|
"<div",
|
|
1074
1090
|
">",
|
|
1075
1091
|
"</div>"
|
|
1076
|
-
]
|
|
1092
|
+
];
|
|
1093
|
+
var _tmpl$2$1 = ["<div", ">Select a util from the left panel to view its state</div>"];
|
|
1094
|
+
var _tmpl$3 = [
|
|
1077
1095
|
"<div",
|
|
1078
1096
|
"><div",
|
|
1079
1097
|
"><div",
|
|
@@ -1127,7 +1145,8 @@ var _tmpl$ = [
|
|
|
1127
1145
|
"\"><div",
|
|
1128
1146
|
">Details</div>",
|
|
1129
1147
|
"</div></div>"
|
|
1130
|
-
]
|
|
1148
|
+
];
|
|
1149
|
+
var _tmpl$2 = [
|
|
1131
1150
|
"<div",
|
|
1132
1151
|
" style=\"",
|
|
1133
1152
|
"\">",
|
|
@@ -1171,7 +1190,8 @@ function Shell() {
|
|
|
1171
1190
|
if (!isDragging()) return;
|
|
1172
1191
|
e.preventDefault();
|
|
1173
1192
|
const deltaX = e.clientX - dragStartX;
|
|
1174
|
-
|
|
1193
|
+
const newWidth = Math.max(150, Math.min(800, dragStartWidth + deltaX));
|
|
1194
|
+
setLeftPanelWidth(newWidth);
|
|
1175
1195
|
};
|
|
1176
1196
|
const handleMouseUp = () => {
|
|
1177
1197
|
setIsDragging(false);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ClassType } from "@tanstack/devtools-utils/solid";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare namespace core_d_exports {
|
|
3
|
+
export { PacerDevtoolsCore$1 as PacerDevtoolsCore, PacerDevtoolsCoreNoOp, PacerDevtoolsInit };
|
|
4
|
+
}
|
|
4
5
|
interface PacerDevtoolsInit {}
|
|
5
6
|
declare const PacerDevtoolsCore$1: ClassType;
|
|
7
|
+
declare const PacerDevtoolsCoreNoOp: ClassType;
|
|
6
8
|
//#endregion
|
|
7
9
|
//#region src/index.d.ts
|
|
8
|
-
declare const PacerDevtoolsCore: typeof PacerDevtoolsCore$1;
|
|
10
|
+
export declare const PacerDevtoolsCore: typeof PacerDevtoolsCore$1;
|
|
9
11
|
//#endregion
|
|
10
|
-
export {
|
|
12
|
+
export type { PacerDevtoolsInit };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { constructCoreClass } from "@tanstack/devtools-utils/solid";
|
|
3
3
|
//#region src/core.tsx
|
|
4
|
-
const coreClasses = constructCoreClass(() => import("./components-
|
|
4
|
+
const coreClasses = constructCoreClass(() => import("./components-BwcTEJfm.js"));
|
|
5
5
|
const PacerDevtoolsCore$1 = coreClasses[0];
|
|
6
6
|
const PacerDevtoolsCoreNoOp = coreClasses[1];
|
|
7
7
|
//#endregion
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ClassType } from "@tanstack/devtools-utils/solid";
|
|
2
|
-
|
|
3
2
|
//#region src/core.d.ts
|
|
4
3
|
interface PacerDevtoolsInit {}
|
|
5
|
-
declare const PacerDevtoolsCore: ClassType;
|
|
4
|
+
export declare const PacerDevtoolsCore: ClassType;
|
|
6
5
|
//#endregion
|
|
7
|
-
export {
|
|
6
|
+
export type { PacerDevtoolsInit };
|
package/dist/production/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { constructCoreClass } from "@tanstack/devtools-utils/solid";
|
|
3
3
|
//#region src/core.tsx
|
|
4
|
-
const coreClasses = constructCoreClass(() => import("../components-
|
|
4
|
+
const coreClasses = constructCoreClass(() => import("../components-BwcTEJfm.js"));
|
|
5
5
|
const PacerDevtoolsCore = coreClasses[0];
|
|
6
6
|
coreClasses[1];
|
|
7
7
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { constructCoreClass } from "@tanstack/devtools-utils/solid";
|
|
3
3
|
//#region src/core.tsx
|
|
4
|
-
const coreClasses = constructCoreClass(() => import("../components-
|
|
4
|
+
const coreClasses = constructCoreClass(() => import("../components-D6zc5Wjw.js"));
|
|
5
5
|
const PacerDevtoolsCore = coreClasses[0];
|
|
6
6
|
coreClasses[1];
|
|
7
7
|
//#endregion
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { constructCoreClass } from "@tanstack/devtools-utils/solid";
|
|
3
3
|
//#region src/core.tsx
|
|
4
|
-
const coreClasses = constructCoreClass(() => import("./components-
|
|
4
|
+
const coreClasses = constructCoreClass(() => import("./components-D6zc5Wjw.js"));
|
|
5
5
|
const PacerDevtoolsCore$1 = coreClasses[0];
|
|
6
6
|
const PacerDevtoolsCoreNoOp = coreClasses[1];
|
|
7
7
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/pacer-devtools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Devtools for Pacer.",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,29 +61,28 @@
|
|
|
61
61
|
},
|
|
62
62
|
"sideEffects": false,
|
|
63
63
|
"engines": {
|
|
64
|
-
"node": ">=
|
|
64
|
+
"node": ">=20"
|
|
65
65
|
},
|
|
66
66
|
"files": [
|
|
67
|
-
"dist
|
|
68
|
-
"src"
|
|
67
|
+
"dist"
|
|
69
68
|
],
|
|
70
69
|
"peerDependencies": {
|
|
71
70
|
"@tanstack/pacer": ">=0.16.4"
|
|
72
71
|
},
|
|
73
72
|
"dependencies": {
|
|
74
|
-
"@tanstack/devtools-ui": "0.
|
|
75
|
-
"@tanstack/devtools-utils": "^0.
|
|
76
|
-
"@tanstack/solid-store": "^0.11.
|
|
73
|
+
"@tanstack/devtools-ui": "0.7.1",
|
|
74
|
+
"@tanstack/devtools-utils": "^0.7.0",
|
|
75
|
+
"@tanstack/solid-store": "^0.11.1",
|
|
77
76
|
"clsx": "^2.1.1",
|
|
78
77
|
"csstype": "^3.2.3",
|
|
79
|
-
"dayjs": "^1.11.
|
|
78
|
+
"dayjs": "^1.11.23",
|
|
80
79
|
"goober": "^2.1.19",
|
|
81
|
-
"solid-js": "^1.9.
|
|
80
|
+
"solid-js": "^1.9.15"
|
|
82
81
|
},
|
|
83
82
|
"devDependencies": {
|
|
84
83
|
"rolldown-plugin-solid": "^0.2.1",
|
|
85
|
-
"tsdown": "^0.
|
|
86
|
-
"vite-plugin-solid": "^2.11.
|
|
84
|
+
"tsdown": "^0.23.0",
|
|
85
|
+
"vite-plugin-solid": "^2.11.14"
|
|
87
86
|
},
|
|
88
87
|
"scripts": {
|
|
89
88
|
"clean": "premove ./build ./dist",
|
|
@@ -92,6 +91,7 @@
|
|
|
92
91
|
"test:lib": "vitest",
|
|
93
92
|
"test:lib:dev": "pnpm test:lib --watch",
|
|
94
93
|
"test:types": "tsc",
|
|
95
|
-
"build": "tsdown"
|
|
94
|
+
"build": "tsdown",
|
|
95
|
+
"test:build": "publint --strict && node ../../scripts/verify-package.ts"
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { createStore, produce } from 'solid-js/store'
|
|
2
|
-
import { createContext, createEffect, onCleanup, useContext } from 'solid-js'
|
|
3
|
-
import {
|
|
4
|
-
getPacerDevtoolsInstance,
|
|
5
|
-
pacerEventClient,
|
|
6
|
-
} from '@tanstack/pacer/event-client'
|
|
7
|
-
import type {
|
|
8
|
-
AsyncBatcher,
|
|
9
|
-
AsyncDebouncer,
|
|
10
|
-
AsyncQueuer,
|
|
11
|
-
AsyncRateLimiter,
|
|
12
|
-
AsyncThrottler,
|
|
13
|
-
Batcher,
|
|
14
|
-
Debouncer,
|
|
15
|
-
PacerEventName,
|
|
16
|
-
Queuer,
|
|
17
|
-
RateLimiter,
|
|
18
|
-
Throttler,
|
|
19
|
-
} from '@tanstack/pacer'
|
|
20
|
-
|
|
21
|
-
interface PacerDevtoolsContextType {
|
|
22
|
-
asyncBatchers: Array<AsyncBatcher<any>>
|
|
23
|
-
asyncDebouncers: Array<AsyncDebouncer<any>>
|
|
24
|
-
asyncQueuers: Array<AsyncQueuer<any>>
|
|
25
|
-
asyncRateLimiters: Array<AsyncRateLimiter<any>>
|
|
26
|
-
asyncThrottlers: Array<AsyncThrottler<any>>
|
|
27
|
-
batchers: Array<Batcher<any>>
|
|
28
|
-
debouncers: Array<Debouncer<any>>
|
|
29
|
-
queuers: Array<Queuer<any>>
|
|
30
|
-
rateLimiters: Array<RateLimiter<any>>
|
|
31
|
-
throttlers: Array<Throttler<any>>
|
|
32
|
-
lastUpdatedByKey: Record<string, number>
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const initialPacerDevtoolsStore = {
|
|
36
|
-
asyncBatchers: [],
|
|
37
|
-
asyncDebouncers: [],
|
|
38
|
-
asyncQueuers: [],
|
|
39
|
-
asyncRateLimiters: [],
|
|
40
|
-
asyncThrottlers: [],
|
|
41
|
-
batchers: [],
|
|
42
|
-
debouncers: [],
|
|
43
|
-
queuers: [],
|
|
44
|
-
rateLimiters: [],
|
|
45
|
-
throttlers: [],
|
|
46
|
-
lastUpdatedByKey: {},
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const PacerDevtoolsContext = createContext<
|
|
50
|
-
[
|
|
51
|
-
PacerDevtoolsContextType,
|
|
52
|
-
(newState: Partial<PacerDevtoolsContextType>) => void,
|
|
53
|
-
]
|
|
54
|
-
>([initialPacerDevtoolsStore, () => {}])
|
|
55
|
-
|
|
56
|
-
type UtilListKey = Exclude<keyof PacerDevtoolsContextType, 'lastUpdatedByKey'>
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Match TanStack Form devtools: subscribe with {@link pacerEventClient.on} per
|
|
60
|
-
* event suffix so the same `pacer:${suffix}` channel the library emits on is
|
|
61
|
-
* observed. `onAllPluginEvents` only sees `tanstack-devtools-global`, which is
|
|
62
|
-
* not always relayed the same way by the shell.
|
|
63
|
-
*
|
|
64
|
-
* `d-*` suffixes are used when the devtools panel pushes state back (see
|
|
65
|
-
* ActionButtons); those must update the panel store too.
|
|
66
|
-
*/
|
|
67
|
-
const PACER_DEVTOOLS_UTIL_EVENTS: Array<{
|
|
68
|
-
listKey: UtilListKey
|
|
69
|
-
suffixes: ReadonlyArray<PacerEventName>
|
|
70
|
-
}> = [
|
|
71
|
-
{
|
|
72
|
-
listKey: 'asyncBatchers',
|
|
73
|
-
suffixes: ['AsyncBatcher', 'd-AsyncBatcher'],
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
listKey: 'asyncDebouncers',
|
|
77
|
-
suffixes: ['AsyncDebouncer', 'd-AsyncDebouncer'],
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
listKey: 'asyncQueuers',
|
|
81
|
-
suffixes: ['AsyncQueuer', 'd-AsyncQueuer'],
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
listKey: 'asyncRateLimiters',
|
|
85
|
-
suffixes: ['AsyncRateLimiter', 'd-AsyncRateLimiter'],
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
listKey: 'asyncThrottlers',
|
|
89
|
-
suffixes: ['AsyncThrottler', 'd-AsyncThrottler'],
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
listKey: 'batchers',
|
|
93
|
-
suffixes: ['Batcher', 'd-Batcher'],
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
listKey: 'debouncers',
|
|
97
|
-
suffixes: ['Debouncer', 'd-Debouncer'],
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
listKey: 'queuers',
|
|
101
|
-
suffixes: ['Queuer', 'd-Queuer'],
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
listKey: 'rateLimiters',
|
|
105
|
-
suffixes: ['RateLimiter', 'd-RateLimiter'],
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
listKey: 'throttlers',
|
|
109
|
-
suffixes: ['Throttler', 'd-Throttler'],
|
|
110
|
-
},
|
|
111
|
-
]
|
|
112
|
-
|
|
113
|
-
export function PacerContextProvider(props: { children: any }) {
|
|
114
|
-
const [store, setStore] = createStore<PacerDevtoolsContextType>(
|
|
115
|
-
initialPacerDevtoolsStore,
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
createEffect(() => {
|
|
119
|
-
const cleanups: Array<() => void> = []
|
|
120
|
-
|
|
121
|
-
for (const { listKey, suffixes } of PACER_DEVTOOLS_UTIL_EVENTS) {
|
|
122
|
-
for (const suffix of suffixes) {
|
|
123
|
-
cleanups.push(
|
|
124
|
-
pacerEventClient.on(suffix, (e) => {
|
|
125
|
-
const payload = e.payload
|
|
126
|
-
const key = payload.key
|
|
127
|
-
if (!key) return
|
|
128
|
-
|
|
129
|
-
const instance = getPacerDevtoolsInstance(key)
|
|
130
|
-
if (!instance || typeof instance !== 'object') return
|
|
131
|
-
|
|
132
|
-
setStore(
|
|
133
|
-
produce((draft) => {
|
|
134
|
-
const list = draft[listKey] as Array<{ key: string }>
|
|
135
|
-
const index = list.findIndex((item) => item.key === key)
|
|
136
|
-
const inst = instance as { key: string }
|
|
137
|
-
if (index !== -1) {
|
|
138
|
-
list[index] = inst as (typeof list)[number]
|
|
139
|
-
} else {
|
|
140
|
-
list.push(inst as (typeof list)[number])
|
|
141
|
-
}
|
|
142
|
-
draft.lastUpdatedByKey[key] = Date.now()
|
|
143
|
-
}),
|
|
144
|
-
)
|
|
145
|
-
}),
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
onCleanup(() => {
|
|
151
|
-
for (const cleanup of cleanups) {
|
|
152
|
-
cleanup()
|
|
153
|
-
}
|
|
154
|
-
})
|
|
155
|
-
})
|
|
156
|
-
return (
|
|
157
|
-
<PacerDevtoolsContext.Provider value={[store, setStore]}>
|
|
158
|
-
{props.children}
|
|
159
|
-
</PacerDevtoolsContext.Provider>
|
|
160
|
-
)
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const usePacerDevtoolsContext = () => {
|
|
164
|
-
const context = useContext(PacerDevtoolsContext)
|
|
165
|
-
|
|
166
|
-
return context
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export const usePacerDevtoolsState = () => {
|
|
170
|
-
const [state] = usePacerDevtoolsContext()
|
|
171
|
-
return state
|
|
172
|
-
}
|