@copilotkit/web-inspector 1.55.0-next.8 → 1.55.0-next.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/web-inspector",
3
- "version": "1.55.0-next.8",
3
+ "version": "1.55.0-next.9",
4
4
  "description": "Lit-based web component for the CopilotKit web inspector",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.cts",
@@ -22,7 +22,7 @@
22
22
  "lit": "^3.2.0",
23
23
  "lucide": "^0.525.0",
24
24
  "marked": "^12.0.2",
25
- "@copilotkit/core": "1.55.0-next.8"
25
+ "@copilotkit/core": "1.55.0-next.9"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@tailwindcss/cli": "^4.1.11",
@@ -33,8 +33,8 @@
33
33
  "tsdown": "^0.20.3",
34
34
  "typescript": "5.8.2",
35
35
  "vitest": "^3.0.5",
36
- "@copilotkit/eslint-config": "1.55.0-next.8",
37
- "@copilotkit/typescript-config": "1.55.0-next.8"
36
+ "@copilotkit/eslint-config": "1.55.0-next.9",
37
+ "@copilotkit/typescript-config": "1.55.0-next.9"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=18"
package/src/index.ts CHANGED
@@ -194,6 +194,8 @@ export class WebInspectorElement extends LitElement {
194
194
  private dockMode: DockMode = "floating";
195
195
  private previousBodyMargins: { left: string; bottom: string } | null = null;
196
196
  private transitionTimeoutId: ReturnType<typeof setTimeout> | null = null;
197
+ private bodyTransitionTimeoutIds: Set<ReturnType<typeof setTimeout>> =
198
+ new Set();
197
199
  private pendingSelectedContext: string | null = null;
198
200
  private autoAttachCore = true;
199
201
  private attemptedAutoAttach = false;
@@ -1195,7 +1197,16 @@ ${argsString}</pre
1195
1197
  this.handleGlobalPointerDown as EventListener,
1196
1198
  );
1197
1199
  }
1198
- this.removeDockStyles(); // Clean up any docking styles
1200
+ // Clear pending body-transition timers to prevent post-teardown errors
1201
+ for (const id of this.bodyTransitionTimeoutIds) {
1202
+ clearTimeout(id);
1203
+ }
1204
+ this.bodyTransitionTimeoutIds.clear();
1205
+ if (this.transitionTimeoutId !== null) {
1206
+ clearTimeout(this.transitionTimeoutId);
1207
+ this.transitionTimeoutId = null;
1208
+ }
1209
+ this.removeDockStyles(true); // Clean up any docking styles, skip transition
1199
1210
  this.detachFromCore();
1200
1211
  }
1201
1212
 
@@ -2032,21 +2043,23 @@ ${argsString}</pre
2032
2043
 
2033
2044
  // Remove transition after animation completes
2034
2045
  if (!this.isResizing && !skipTransition) {
2035
- setTimeout(() => {
2036
- if (document.body) {
2046
+ const id = setTimeout(() => {
2047
+ this.bodyTransitionTimeoutIds.delete(id);
2048
+ if (typeof document !== "undefined" && document.body) {
2037
2049
  document.body.style.transition = "";
2038
2050
  }
2039
2051
  }, 300);
2052
+ this.bodyTransitionTimeoutIds.add(id);
2040
2053
  }
2041
2054
  }
2042
2055
 
2043
- private removeDockStyles(): void {
2056
+ private removeDockStyles(skipTransition = false): void {
2044
2057
  if (typeof document === "undefined" || !document.body) {
2045
2058
  return;
2046
2059
  }
2047
2060
 
2048
- // Only add transition if not resizing
2049
- if (!this.isResizing) {
2061
+ // Only add transition if not resizing and not skipping
2062
+ if (!this.isResizing && !skipTransition) {
2050
2063
  document.body.style.transition = "margin 300ms ease";
2051
2064
  }
2052
2065
 
@@ -2062,11 +2075,17 @@ ${argsString}</pre
2062
2075
  }
2063
2076
 
2064
2077
  // Clean up transition after animation completes
2065
- setTimeout(() => {
2066
- if (document.body) {
2067
- document.body.style.transition = "";
2068
- }
2069
- }, 300);
2078
+ if (!skipTransition) {
2079
+ const id = setTimeout(() => {
2080
+ this.bodyTransitionTimeoutIds.delete(id);
2081
+ if (typeof document !== "undefined" && document.body) {
2082
+ document.body.style.transition = "";
2083
+ }
2084
+ }, 300);
2085
+ this.bodyTransitionTimeoutIds.add(id);
2086
+ } else {
2087
+ document.body.style.transition = "";
2088
+ }
2070
2089
  }
2071
2090
 
2072
2091
  private updateHostTransform(context: ContextKey = this.activeContext): void {