agentation 2.1.1 → 2.2.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 +1 -1
- package/dist/index.js +224 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +224 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ The toolbar appears in the bottom-right corner. Click to activate, then click an
|
|
|
34
34
|
- **Text selection** – Select text to annotate specific content
|
|
35
35
|
- **Multi-select** – Drag to select multiple elements at once
|
|
36
36
|
- **Area selection** – Drag to annotate any region, even empty space
|
|
37
|
-
- **Animation pause** – Freeze
|
|
37
|
+
- **Animation pause** – Freeze all animations (CSS, JS, videos) to capture specific states
|
|
38
38
|
- **Structured output** – Copy markdown with selectors, positions, and context
|
|
39
39
|
- **Programmatic access** – Callback prop for direct integration with tools
|
|
40
40
|
- **Dark/light mode** – Toggle in settings, persists to localStorage
|
package/dist/index.js
CHANGED
|
@@ -1039,6 +1039,181 @@ var AnimatedBunny = ({
|
|
|
1039
1039
|
}
|
|
1040
1040
|
);
|
|
1041
1041
|
|
|
1042
|
+
// src/utils/freeze-animations.ts
|
|
1043
|
+
var EXCLUDE_ATTRS = [
|
|
1044
|
+
"data-feedback-toolbar",
|
|
1045
|
+
"data-annotation-popup",
|
|
1046
|
+
"data-annotation-marker"
|
|
1047
|
+
];
|
|
1048
|
+
var NOT_SELECTORS = EXCLUDE_ATTRS.flatMap((a) => [`:not([${a}])`, `:not([${a}] *)`]).join("");
|
|
1049
|
+
var STYLE_ID = "feedback-freeze-styles";
|
|
1050
|
+
var STATE_KEY = "__agentation_freeze";
|
|
1051
|
+
function getState() {
|
|
1052
|
+
if (typeof window === "undefined") {
|
|
1053
|
+
return {
|
|
1054
|
+
frozen: false,
|
|
1055
|
+
installed: true,
|
|
1056
|
+
// prevent patching on server
|
|
1057
|
+
origSetTimeout: setTimeout,
|
|
1058
|
+
origSetInterval: setInterval,
|
|
1059
|
+
origRAF: (cb) => 0,
|
|
1060
|
+
pausedAnimations: [],
|
|
1061
|
+
frozenTimeoutQueue: [],
|
|
1062
|
+
frozenRAFQueue: []
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
const w = window;
|
|
1066
|
+
if (!w[STATE_KEY]) {
|
|
1067
|
+
w[STATE_KEY] = {
|
|
1068
|
+
frozen: false,
|
|
1069
|
+
installed: false,
|
|
1070
|
+
origSetTimeout: null,
|
|
1071
|
+
origSetInterval: null,
|
|
1072
|
+
origRAF: null,
|
|
1073
|
+
pausedAnimations: [],
|
|
1074
|
+
frozenTimeoutQueue: [],
|
|
1075
|
+
frozenRAFQueue: []
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
return w[STATE_KEY];
|
|
1079
|
+
}
|
|
1080
|
+
var _s = getState();
|
|
1081
|
+
if (typeof window !== "undefined" && !_s.installed) {
|
|
1082
|
+
_s.origSetTimeout = window.setTimeout.bind(window);
|
|
1083
|
+
_s.origSetInterval = window.setInterval.bind(window);
|
|
1084
|
+
_s.origRAF = window.requestAnimationFrame.bind(window);
|
|
1085
|
+
window.setTimeout = (handler, timeout, ...args) => {
|
|
1086
|
+
if (typeof handler === "string") {
|
|
1087
|
+
return _s.origSetTimeout(handler, timeout);
|
|
1088
|
+
}
|
|
1089
|
+
return _s.origSetTimeout(
|
|
1090
|
+
(...a) => {
|
|
1091
|
+
if (_s.frozen) {
|
|
1092
|
+
_s.frozenTimeoutQueue.push(() => handler(...a));
|
|
1093
|
+
} else {
|
|
1094
|
+
handler(...a);
|
|
1095
|
+
}
|
|
1096
|
+
},
|
|
1097
|
+
timeout,
|
|
1098
|
+
...args
|
|
1099
|
+
);
|
|
1100
|
+
};
|
|
1101
|
+
window.setInterval = (handler, timeout, ...args) => {
|
|
1102
|
+
if (typeof handler === "string") {
|
|
1103
|
+
return _s.origSetInterval(handler, timeout);
|
|
1104
|
+
}
|
|
1105
|
+
return _s.origSetInterval(
|
|
1106
|
+
(...a) => {
|
|
1107
|
+
if (!_s.frozen) handler(...a);
|
|
1108
|
+
},
|
|
1109
|
+
timeout,
|
|
1110
|
+
...args
|
|
1111
|
+
);
|
|
1112
|
+
};
|
|
1113
|
+
window.requestAnimationFrame = (callback) => {
|
|
1114
|
+
return _s.origRAF((timestamp) => {
|
|
1115
|
+
if (_s.frozen) {
|
|
1116
|
+
_s.frozenRAFQueue.push(callback);
|
|
1117
|
+
} else {
|
|
1118
|
+
callback(timestamp);
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
};
|
|
1122
|
+
_s.installed = true;
|
|
1123
|
+
}
|
|
1124
|
+
var originalSetTimeout = _s.origSetTimeout;
|
|
1125
|
+
var originalSetInterval = _s.origSetInterval;
|
|
1126
|
+
function isAgentationElement(el) {
|
|
1127
|
+
if (!el) return false;
|
|
1128
|
+
return EXCLUDE_ATTRS.some((attr) => !!el.closest?.(`[${attr}]`));
|
|
1129
|
+
}
|
|
1130
|
+
function freeze() {
|
|
1131
|
+
if (typeof document === "undefined") return;
|
|
1132
|
+
if (_s.frozen) return;
|
|
1133
|
+
_s.frozen = true;
|
|
1134
|
+
_s.frozenTimeoutQueue = [];
|
|
1135
|
+
_s.frozenRAFQueue = [];
|
|
1136
|
+
let style = document.getElementById(STYLE_ID);
|
|
1137
|
+
if (!style) {
|
|
1138
|
+
style = document.createElement("style");
|
|
1139
|
+
style.id = STYLE_ID;
|
|
1140
|
+
}
|
|
1141
|
+
style.textContent = `
|
|
1142
|
+
*${NOT_SELECTORS},
|
|
1143
|
+
*${NOT_SELECTORS}::before,
|
|
1144
|
+
*${NOT_SELECTORS}::after {
|
|
1145
|
+
animation-play-state: paused !important;
|
|
1146
|
+
transition: none !important;
|
|
1147
|
+
}
|
|
1148
|
+
`;
|
|
1149
|
+
document.head.appendChild(style);
|
|
1150
|
+
_s.pausedAnimations = [];
|
|
1151
|
+
try {
|
|
1152
|
+
document.getAnimations().forEach((anim) => {
|
|
1153
|
+
if (anim.playState !== "running") return;
|
|
1154
|
+
const target = anim.effect?.target;
|
|
1155
|
+
if (!isAgentationElement(target)) {
|
|
1156
|
+
anim.pause();
|
|
1157
|
+
_s.pausedAnimations.push(anim);
|
|
1158
|
+
}
|
|
1159
|
+
});
|
|
1160
|
+
} catch {
|
|
1161
|
+
}
|
|
1162
|
+
document.querySelectorAll("video").forEach((video) => {
|
|
1163
|
+
if (!video.paused) {
|
|
1164
|
+
video.dataset.wasPaused = "false";
|
|
1165
|
+
video.pause();
|
|
1166
|
+
}
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
function unfreeze() {
|
|
1170
|
+
if (typeof document === "undefined") return;
|
|
1171
|
+
if (!_s.frozen) return;
|
|
1172
|
+
_s.frozen = false;
|
|
1173
|
+
const timeoutQueue = _s.frozenTimeoutQueue;
|
|
1174
|
+
_s.frozenTimeoutQueue = [];
|
|
1175
|
+
for (const cb of timeoutQueue) {
|
|
1176
|
+
_s.origSetTimeout(() => {
|
|
1177
|
+
if (_s.frozen) {
|
|
1178
|
+
_s.frozenTimeoutQueue.push(cb);
|
|
1179
|
+
return;
|
|
1180
|
+
}
|
|
1181
|
+
try {
|
|
1182
|
+
cb();
|
|
1183
|
+
} catch (e) {
|
|
1184
|
+
console.warn("[agentation] Error replaying queued timeout:", e);
|
|
1185
|
+
}
|
|
1186
|
+
}, 0);
|
|
1187
|
+
}
|
|
1188
|
+
const rafQueue = _s.frozenRAFQueue;
|
|
1189
|
+
_s.frozenRAFQueue = [];
|
|
1190
|
+
for (const cb of rafQueue) {
|
|
1191
|
+
_s.origRAF((ts) => {
|
|
1192
|
+
if (_s.frozen) {
|
|
1193
|
+
_s.frozenRAFQueue.push(cb);
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
cb(ts);
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
for (const anim of _s.pausedAnimations) {
|
|
1200
|
+
try {
|
|
1201
|
+
anim.play();
|
|
1202
|
+
} catch (e) {
|
|
1203
|
+
console.warn("[agentation] Error resuming animation:", e);
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
_s.pausedAnimations = [];
|
|
1207
|
+
document.getElementById(STYLE_ID)?.remove();
|
|
1208
|
+
document.querySelectorAll("video").forEach((video) => {
|
|
1209
|
+
if (video.dataset.wasPaused === "false") {
|
|
1210
|
+
video.play().catch(() => {
|
|
1211
|
+
});
|
|
1212
|
+
delete video.dataset.wasPaused;
|
|
1213
|
+
}
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1042
1217
|
// src/components/annotation-popup-css/index.tsx
|
|
1043
1218
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1044
1219
|
var AnnotationPopupCSS = (0, import_react.forwardRef)(
|
|
@@ -1065,19 +1240,21 @@ var AnnotationPopupCSS = (0, import_react.forwardRef)(
|
|
|
1065
1240
|
const [isStylesExpanded, setIsStylesExpanded] = (0, import_react.useState)(false);
|
|
1066
1241
|
const textareaRef = (0, import_react.useRef)(null);
|
|
1067
1242
|
const popupRef = (0, import_react.useRef)(null);
|
|
1243
|
+
const cancelTimerRef = (0, import_react.useRef)(null);
|
|
1244
|
+
const shakeTimerRef = (0, import_react.useRef)(null);
|
|
1068
1245
|
(0, import_react.useEffect)(() => {
|
|
1069
1246
|
if (isExiting && animState !== "exit") {
|
|
1070
1247
|
setAnimState("exit");
|
|
1071
1248
|
}
|
|
1072
1249
|
}, [isExiting, animState]);
|
|
1073
1250
|
(0, import_react.useEffect)(() => {
|
|
1074
|
-
|
|
1251
|
+
originalSetTimeout(() => {
|
|
1075
1252
|
setAnimState("enter");
|
|
1076
|
-
});
|
|
1077
|
-
const enterTimer =
|
|
1253
|
+
}, 0);
|
|
1254
|
+
const enterTimer = originalSetTimeout(() => {
|
|
1078
1255
|
setAnimState("entered");
|
|
1079
1256
|
}, 200);
|
|
1080
|
-
const focusTimer =
|
|
1257
|
+
const focusTimer = originalSetTimeout(() => {
|
|
1081
1258
|
const textarea = textareaRef.current;
|
|
1082
1259
|
if (textarea) {
|
|
1083
1260
|
textarea.focus();
|
|
@@ -1088,11 +1265,14 @@ var AnnotationPopupCSS = (0, import_react.forwardRef)(
|
|
|
1088
1265
|
return () => {
|
|
1089
1266
|
clearTimeout(enterTimer);
|
|
1090
1267
|
clearTimeout(focusTimer);
|
|
1268
|
+
if (cancelTimerRef.current) clearTimeout(cancelTimerRef.current);
|
|
1269
|
+
if (shakeTimerRef.current) clearTimeout(shakeTimerRef.current);
|
|
1091
1270
|
};
|
|
1092
1271
|
}, []);
|
|
1093
1272
|
const shake = (0, import_react.useCallback)(() => {
|
|
1273
|
+
if (shakeTimerRef.current) clearTimeout(shakeTimerRef.current);
|
|
1094
1274
|
setIsShaking(true);
|
|
1095
|
-
|
|
1275
|
+
shakeTimerRef.current = originalSetTimeout(() => {
|
|
1096
1276
|
setIsShaking(false);
|
|
1097
1277
|
textareaRef.current?.focus();
|
|
1098
1278
|
}, 250);
|
|
@@ -1102,7 +1282,7 @@ var AnnotationPopupCSS = (0, import_react.forwardRef)(
|
|
|
1102
1282
|
}), [shake]);
|
|
1103
1283
|
const handleCancel = (0, import_react.useCallback)(() => {
|
|
1104
1284
|
setAnimState("exit");
|
|
1105
|
-
|
|
1285
|
+
cancelTimerRef.current = originalSetTimeout(() => {
|
|
1106
1286
|
onCancel();
|
|
1107
1287
|
}, 150);
|
|
1108
1288
|
}, [onCancel]);
|
|
@@ -1149,7 +1329,7 @@ var AnnotationPopupCSS = (0, import_react.forwardRef)(
|
|
|
1149
1329
|
const wasExpanded = isStylesExpanded;
|
|
1150
1330
|
setIsStylesExpanded(!isStylesExpanded);
|
|
1151
1331
|
if (wasExpanded) {
|
|
1152
|
-
|
|
1332
|
+
originalSetTimeout(() => textareaRef.current?.focus(), 0);
|
|
1153
1333
|
}
|
|
1154
1334
|
},
|
|
1155
1335
|
type: "button",
|
|
@@ -2484,7 +2664,7 @@ function PageFeedbackToolbarCSS({
|
|
|
2484
2664
|
exitTimeoutRef.current = null;
|
|
2485
2665
|
}
|
|
2486
2666
|
updatePosition();
|
|
2487
|
-
timeoutRef.current =
|
|
2667
|
+
timeoutRef.current = originalSetTimeout(() => {
|
|
2488
2668
|
setVisible(true);
|
|
2489
2669
|
}, 500);
|
|
2490
2670
|
};
|
|
@@ -2495,7 +2675,7 @@ function PageFeedbackToolbarCSS({
|
|
|
2495
2675
|
timeoutRef.current = null;
|
|
2496
2676
|
}
|
|
2497
2677
|
setVisible(false);
|
|
2498
|
-
exitTimeoutRef.current =
|
|
2678
|
+
exitTimeoutRef.current = originalSetTimeout(() => {
|
|
2499
2679
|
setShouldRender(false);
|
|
2500
2680
|
}, 150);
|
|
2501
2681
|
};
|
|
@@ -2519,6 +2699,7 @@ function PageFeedbackToolbarCSS({
|
|
|
2519
2699
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2520
2700
|
"div",
|
|
2521
2701
|
{
|
|
2702
|
+
"data-feedback-toolbar": true,
|
|
2522
2703
|
style: {
|
|
2523
2704
|
position: "fixed",
|
|
2524
2705
|
top: position.top,
|
|
@@ -2588,13 +2769,13 @@ function PageFeedbackToolbarCSS({
|
|
|
2588
2769
|
} else {
|
|
2589
2770
|
setTooltipsHidden(false);
|
|
2590
2771
|
setSettingsPage("main");
|
|
2591
|
-
const timer =
|
|
2772
|
+
const timer = originalSetTimeout(() => setShowSettingsVisible(false), 0);
|
|
2592
2773
|
return () => clearTimeout(timer);
|
|
2593
2774
|
}
|
|
2594
2775
|
}, [showSettings]);
|
|
2595
2776
|
(0, import_react2.useEffect)(() => {
|
|
2596
2777
|
setIsTransitioning(true);
|
|
2597
|
-
const timer =
|
|
2778
|
+
const timer = originalSetTimeout(() => setIsTransitioning(false), 350);
|
|
2598
2779
|
return () => clearTimeout(timer);
|
|
2599
2780
|
}, [settingsPage]);
|
|
2600
2781
|
const shouldShowMarkers = isActive && showMarkers;
|
|
@@ -2603,7 +2784,7 @@ function PageFeedbackToolbarCSS({
|
|
|
2603
2784
|
setMarkersExiting(false);
|
|
2604
2785
|
setMarkersVisible(true);
|
|
2605
2786
|
setAnimatedMarkers(/* @__PURE__ */ new Set());
|
|
2606
|
-
const timer =
|
|
2787
|
+
const timer = originalSetTimeout(() => {
|
|
2607
2788
|
setAnimatedMarkers((prev) => {
|
|
2608
2789
|
const newSet = new Set(prev);
|
|
2609
2790
|
annotations.forEach((a) => newSet.add(a.id));
|
|
@@ -2613,7 +2794,7 @@ function PageFeedbackToolbarCSS({
|
|
|
2613
2794
|
return () => clearTimeout(timer);
|
|
2614
2795
|
} else if (markersVisible) {
|
|
2615
2796
|
setMarkersExiting(true);
|
|
2616
|
-
const timer =
|
|
2797
|
+
const timer = originalSetTimeout(() => {
|
|
2617
2798
|
setMarkersVisible(false);
|
|
2618
2799
|
setMarkersExiting(false);
|
|
2619
2800
|
}, 250);
|
|
@@ -2628,7 +2809,7 @@ function PageFeedbackToolbarCSS({
|
|
|
2628
2809
|
if (!hasPlayedEntranceAnimation) {
|
|
2629
2810
|
setShowEntranceAnimation(true);
|
|
2630
2811
|
hasPlayedEntranceAnimation = true;
|
|
2631
|
-
|
|
2812
|
+
originalSetTimeout(() => setShowEntranceAnimation(false), 750);
|
|
2632
2813
|
}
|
|
2633
2814
|
try {
|
|
2634
2815
|
const storedSettings = localStorage.getItem("feedback-toolbar-settings");
|
|
@@ -2844,7 +3025,7 @@ function PageFeedbackToolbarCSS({
|
|
|
2844
3025
|
}
|
|
2845
3026
|
};
|
|
2846
3027
|
checkHealth();
|
|
2847
|
-
const interval =
|
|
3028
|
+
const interval = originalSetInterval(checkHealth, 1e4);
|
|
2848
3029
|
return () => clearInterval(interval);
|
|
2849
3030
|
}, [endpoint, mounted]);
|
|
2850
3031
|
(0, import_react2.useEffect)(() => {
|
|
@@ -2859,7 +3040,7 @@ function PageFeedbackToolbarCSS({
|
|
|
2859
3040
|
if (removedStatuses.includes(event.payload?.status)) {
|
|
2860
3041
|
const id = event.payload.id;
|
|
2861
3042
|
setExitingMarkers((prev) => new Set(prev).add(id));
|
|
2862
|
-
|
|
3043
|
+
originalSetTimeout(() => {
|
|
2863
3044
|
setAnnotations((prev) => prev.filter((a) => a.id !== id));
|
|
2864
3045
|
setExitingMarkers((prev) => {
|
|
2865
3046
|
const next = new Set(prev);
|
|
@@ -2941,14 +3122,14 @@ function PageFeedbackToolbarCSS({
|
|
|
2941
3122
|
if (annotations.length > 0) return;
|
|
2942
3123
|
const timeoutIds = [];
|
|
2943
3124
|
timeoutIds.push(
|
|
2944
|
-
|
|
3125
|
+
originalSetTimeout(() => {
|
|
2945
3126
|
setIsActive(true);
|
|
2946
3127
|
}, demoDelay - 200)
|
|
2947
3128
|
);
|
|
2948
3129
|
demoAnnotations.forEach((demo, index) => {
|
|
2949
3130
|
const annotationDelay = demoDelay + index * 300;
|
|
2950
3131
|
timeoutIds.push(
|
|
2951
|
-
|
|
3132
|
+
originalSetTimeout(() => {
|
|
2952
3133
|
const element = document.querySelector(demo.selector);
|
|
2953
3134
|
if (!element) return;
|
|
2954
3135
|
const rect = element.getBoundingClientRect();
|
|
@@ -2986,7 +3167,7 @@ function PageFeedbackToolbarCSS({
|
|
|
2986
3167
|
if (scrollTimeoutRef.current) {
|
|
2987
3168
|
clearTimeout(scrollTimeoutRef.current);
|
|
2988
3169
|
}
|
|
2989
|
-
scrollTimeoutRef.current =
|
|
3170
|
+
scrollTimeoutRef.current = originalSetTimeout(() => {
|
|
2990
3171
|
setIsScrolling(false);
|
|
2991
3172
|
}, 150);
|
|
2992
3173
|
};
|
|
@@ -3011,35 +3192,12 @@ function PageFeedbackToolbarCSS({
|
|
|
3011
3192
|
}, [annotations, pathname, mounted, currentSessionId]);
|
|
3012
3193
|
const freezeAnimations = (0, import_react2.useCallback)(() => {
|
|
3013
3194
|
if (isFrozen) return;
|
|
3014
|
-
|
|
3015
|
-
style.id = "feedback-freeze-styles";
|
|
3016
|
-
style.textContent = `
|
|
3017
|
-
*:not([data-feedback-toolbar]):not([data-feedback-toolbar] *):not([data-annotation-popup]):not([data-annotation-popup] *):not([data-annotation-marker]):not([data-annotation-marker] *),
|
|
3018
|
-
*:not([data-feedback-toolbar]):not([data-feedback-toolbar] *):not([data-annotation-popup]):not([data-annotation-popup] *):not([data-annotation-marker]):not([data-annotation-marker] *)::before,
|
|
3019
|
-
*:not([data-feedback-toolbar]):not([data-feedback-toolbar] *):not([data-annotation-popup]):not([data-annotation-popup] *):not([data-annotation-marker]):not([data-annotation-marker] *)::after {
|
|
3020
|
-
animation-play-state: paused !important;
|
|
3021
|
-
transition: none !important;
|
|
3022
|
-
}
|
|
3023
|
-
`;
|
|
3024
|
-
document.head.appendChild(style);
|
|
3025
|
-
document.querySelectorAll("video").forEach((video) => {
|
|
3026
|
-
if (!video.paused) {
|
|
3027
|
-
video.dataset.wasPaused = "false";
|
|
3028
|
-
video.pause();
|
|
3029
|
-
}
|
|
3030
|
-
});
|
|
3195
|
+
freeze();
|
|
3031
3196
|
setIsFrozen(true);
|
|
3032
3197
|
}, [isFrozen]);
|
|
3033
3198
|
const unfreezeAnimations = (0, import_react2.useCallback)(() => {
|
|
3034
3199
|
if (!isFrozen) return;
|
|
3035
|
-
|
|
3036
|
-
if (style) style.remove();
|
|
3037
|
-
document.querySelectorAll("video").forEach((video) => {
|
|
3038
|
-
if (video.dataset.wasPaused === "false") {
|
|
3039
|
-
video.play();
|
|
3040
|
-
delete video.dataset.wasPaused;
|
|
3041
|
-
}
|
|
3042
|
-
});
|
|
3200
|
+
unfreeze();
|
|
3043
3201
|
setIsFrozen(false);
|
|
3044
3202
|
}, [isFrozen]);
|
|
3045
3203
|
const toggleFreeze = (0, import_react2.useCallback)(() => {
|
|
@@ -3148,6 +3306,11 @@ function PageFeedbackToolbarCSS({
|
|
|
3148
3306
|
}
|
|
3149
3307
|
}
|
|
3150
3308
|
}, [isActive, isFrozen, unfreezeAnimations]);
|
|
3309
|
+
(0, import_react2.useEffect)(() => {
|
|
3310
|
+
return () => {
|
|
3311
|
+
unfreeze();
|
|
3312
|
+
};
|
|
3313
|
+
}, []);
|
|
3151
3314
|
(0, import_react2.useEffect)(() => {
|
|
3152
3315
|
if (!isActive) return;
|
|
3153
3316
|
const style = document.createElement("style");
|
|
@@ -3733,16 +3896,16 @@ function PageFeedbackToolbarCSS({
|
|
|
3733
3896
|
};
|
|
3734
3897
|
setAnnotations((prev) => [...prev, newAnnotation]);
|
|
3735
3898
|
recentlyAddedIdRef.current = newAnnotation.id;
|
|
3736
|
-
|
|
3899
|
+
originalSetTimeout(() => {
|
|
3737
3900
|
recentlyAddedIdRef.current = null;
|
|
3738
3901
|
}, 300);
|
|
3739
|
-
|
|
3902
|
+
originalSetTimeout(() => {
|
|
3740
3903
|
setAnimatedMarkers((prev) => new Set(prev).add(newAnnotation.id));
|
|
3741
3904
|
}, 250);
|
|
3742
3905
|
onAnnotationAdd?.(newAnnotation);
|
|
3743
3906
|
fireWebhook("annotation.add", { annotation: newAnnotation });
|
|
3744
3907
|
setPendingExiting(true);
|
|
3745
|
-
|
|
3908
|
+
originalSetTimeout(() => {
|
|
3746
3909
|
setPendingAnnotation(null);
|
|
3747
3910
|
setPendingExiting(false);
|
|
3748
3911
|
}, 150);
|
|
@@ -3777,7 +3940,7 @@ function PageFeedbackToolbarCSS({
|
|
|
3777
3940
|
);
|
|
3778
3941
|
const cancelAnnotation = (0, import_react2.useCallback)(() => {
|
|
3779
3942
|
setPendingExiting(true);
|
|
3780
|
-
|
|
3943
|
+
originalSetTimeout(() => {
|
|
3781
3944
|
setPendingAnnotation(null);
|
|
3782
3945
|
setPendingExiting(false);
|
|
3783
3946
|
}, 150);
|
|
@@ -3788,7 +3951,7 @@ function PageFeedbackToolbarCSS({
|
|
|
3788
3951
|
const deletedAnnotation = annotations[deletedIndex];
|
|
3789
3952
|
if (editingAnnotation?.id === id) {
|
|
3790
3953
|
setEditExiting(true);
|
|
3791
|
-
|
|
3954
|
+
originalSetTimeout(() => {
|
|
3792
3955
|
setEditingAnnotation(null);
|
|
3793
3956
|
setEditingTargetElement(null);
|
|
3794
3957
|
setEditingTargetElements([]);
|
|
@@ -3809,7 +3972,7 @@ function PageFeedbackToolbarCSS({
|
|
|
3809
3972
|
);
|
|
3810
3973
|
});
|
|
3811
3974
|
}
|
|
3812
|
-
|
|
3975
|
+
originalSetTimeout(() => {
|
|
3813
3976
|
setAnnotations((prev) => prev.filter((a) => a.id !== id));
|
|
3814
3977
|
setExitingMarkers((prev) => {
|
|
3815
3978
|
const next = new Set(prev);
|
|
@@ -3819,7 +3982,7 @@ function PageFeedbackToolbarCSS({
|
|
|
3819
3982
|
setDeletingMarkerId(null);
|
|
3820
3983
|
if (deletedIndex < annotations.length - 1) {
|
|
3821
3984
|
setRenumberFrom(deletedIndex);
|
|
3822
|
-
|
|
3985
|
+
originalSetTimeout(() => setRenumberFrom(null), 200);
|
|
3823
3986
|
}
|
|
3824
3987
|
}, 150);
|
|
3825
3988
|
},
|
|
@@ -3932,7 +4095,7 @@ function PageFeedbackToolbarCSS({
|
|
|
3932
4095
|
});
|
|
3933
4096
|
}
|
|
3934
4097
|
setEditExiting(true);
|
|
3935
|
-
|
|
4098
|
+
originalSetTimeout(() => {
|
|
3936
4099
|
setEditingAnnotation(null);
|
|
3937
4100
|
setEditingTargetElement(null);
|
|
3938
4101
|
setEditingTargetElements([]);
|
|
@@ -3943,7 +4106,7 @@ function PageFeedbackToolbarCSS({
|
|
|
3943
4106
|
);
|
|
3944
4107
|
const cancelEditAnnotation = (0, import_react2.useCallback)(() => {
|
|
3945
4108
|
setEditExiting(true);
|
|
3946
|
-
|
|
4109
|
+
originalSetTimeout(() => {
|
|
3947
4110
|
setEditingAnnotation(null);
|
|
3948
4111
|
setEditingTargetElement(null);
|
|
3949
4112
|
setEditingTargetElements([]);
|
|
@@ -3970,13 +4133,13 @@ function PageFeedbackToolbarCSS({
|
|
|
3970
4133
|
setIsClearing(true);
|
|
3971
4134
|
setCleared(true);
|
|
3972
4135
|
const totalAnimationTime = count * 30 + 200;
|
|
3973
|
-
|
|
4136
|
+
originalSetTimeout(() => {
|
|
3974
4137
|
setAnnotations([]);
|
|
3975
4138
|
setAnimatedMarkers(/* @__PURE__ */ new Set());
|
|
3976
4139
|
localStorage.removeItem(getStorageKey(pathname));
|
|
3977
4140
|
setIsClearing(false);
|
|
3978
4141
|
}, totalAnimationTime);
|
|
3979
|
-
|
|
4142
|
+
originalSetTimeout(() => setCleared(false), 1500);
|
|
3980
4143
|
}, [pathname, annotations, onAnnotationsClear, fireWebhook, endpoint]);
|
|
3981
4144
|
const copyOutput = (0, import_react2.useCallback)(async () => {
|
|
3982
4145
|
const displayUrl = typeof window !== "undefined" ? window.location.pathname + window.location.search + window.location.hash : pathname;
|
|
@@ -3995,9 +4158,9 @@ function PageFeedbackToolbarCSS({
|
|
|
3995
4158
|
}
|
|
3996
4159
|
onCopy?.(output);
|
|
3997
4160
|
setCopied(true);
|
|
3998
|
-
|
|
4161
|
+
originalSetTimeout(() => setCopied(false), 2e3);
|
|
3999
4162
|
if (settings.autoClearAfterCopy) {
|
|
4000
|
-
|
|
4163
|
+
originalSetTimeout(() => clearAll(), 500);
|
|
4001
4164
|
}
|
|
4002
4165
|
}, [
|
|
4003
4166
|
annotations,
|
|
@@ -4022,12 +4185,12 @@ function PageFeedbackToolbarCSS({
|
|
|
4022
4185
|
onSubmit(output, annotations);
|
|
4023
4186
|
}
|
|
4024
4187
|
setSendState("sending");
|
|
4025
|
-
await new Promise((resolve) =>
|
|
4188
|
+
await new Promise((resolve) => originalSetTimeout(resolve, 150));
|
|
4026
4189
|
const success = await fireWebhook("submit", { output, annotations }, true);
|
|
4027
4190
|
setSendState(success ? "sent" : "failed");
|
|
4028
|
-
|
|
4191
|
+
originalSetTimeout(() => setSendState("idle"), 2500);
|
|
4029
4192
|
if (success && settings.autoClearAfterCopy) {
|
|
4030
|
-
|
|
4193
|
+
originalSetTimeout(() => clearAll(), 500);
|
|
4031
4194
|
}
|
|
4032
4195
|
}, [
|
|
4033
4196
|
onSubmit,
|
|
@@ -4502,7 +4665,7 @@ function PageFeedbackToolbarCSS({
|
|
|
4502
4665
|
] }),
|
|
4503
4666
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: styles_module_default2.settingsVersion, children: [
|
|
4504
4667
|
"v",
|
|
4505
|
-
"2.
|
|
4668
|
+
"2.2.0"
|
|
4506
4669
|
] }),
|
|
4507
4670
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4508
4671
|
"button",
|