@critique.work/agentation 2.3.0 → 2.4.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/dist/index.d.mts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +46 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2156,6 +2156,32 @@ function getNearbyText(element) {
|
|
|
2156
2156
|
}
|
|
2157
2157
|
return texts.join(" ");
|
|
2158
2158
|
}
|
|
2159
|
+
var MIN_SIBLINGS = 3;
|
|
2160
|
+
function getSurroundingNodes(element, radius = 3) {
|
|
2161
|
+
let node = element;
|
|
2162
|
+
while (node) {
|
|
2163
|
+
const parent = node.parentElement;
|
|
2164
|
+
if (parent && parent.children.length >= MIN_SIBLINGS) break;
|
|
2165
|
+
node = node.parentElement;
|
|
2166
|
+
}
|
|
2167
|
+
if (!node) return null;
|
|
2168
|
+
const lineText = (node.textContent ?? "").replace(/\n/g, " ").trim();
|
|
2169
|
+
const contextBefore = [];
|
|
2170
|
+
let prev = node.previousElementSibling;
|
|
2171
|
+
for (let i3 = 0; i3 < radius && prev; i3++) {
|
|
2172
|
+
const text = (prev.textContent ?? "").replace(/\n/g, " ").trim();
|
|
2173
|
+
if (text) contextBefore.unshift(text);
|
|
2174
|
+
prev = prev.previousElementSibling;
|
|
2175
|
+
}
|
|
2176
|
+
const contextAfter = [];
|
|
2177
|
+
let next = node.nextElementSibling;
|
|
2178
|
+
for (let i3 = 0; i3 < radius && next; i3++) {
|
|
2179
|
+
const text = (next.textContent ?? "").replace(/\n/g, " ").trim();
|
|
2180
|
+
if (text) contextAfter.push(text);
|
|
2181
|
+
next = next.nextElementSibling;
|
|
2182
|
+
}
|
|
2183
|
+
return { lineText, contextBefore, contextAfter };
|
|
2184
|
+
}
|
|
2159
2185
|
function identifyAnimationElement(target) {
|
|
2160
2186
|
if (target.dataset.element) return target.dataset.element;
|
|
2161
2187
|
const tag = target.tagName.toLowerCase();
|
|
@@ -3936,7 +3962,8 @@ function PageFeedbackToolbarCSS({
|
|
|
3936
3962
|
nearbyElements: getNearbyElements(firstEl),
|
|
3937
3963
|
cssClasses: getElementClasses(firstEl),
|
|
3938
3964
|
nearbyText: getNearbyText(firstEl),
|
|
3939
|
-
reactComponents: firstItem.reactComponents
|
|
3965
|
+
reactComponents: firstItem.reactComponents,
|
|
3966
|
+
...getSurroundingNodes(firstEl)
|
|
3940
3967
|
});
|
|
3941
3968
|
} else {
|
|
3942
3969
|
const bounds = {
|
|
@@ -3983,7 +4010,8 @@ function PageFeedbackToolbarCSS({
|
|
|
3983
4010
|
computedStylesObj: getDetailedComputedStyles(firstEl),
|
|
3984
4011
|
nearbyElements: getNearbyElements(firstEl),
|
|
3985
4012
|
cssClasses: getElementClasses(firstEl),
|
|
3986
|
-
nearbyText: getNearbyText(firstEl)
|
|
4013
|
+
nearbyText: getNearbyText(firstEl),
|
|
4014
|
+
...getSurroundingNodes(firstEl)
|
|
3987
4015
|
});
|
|
3988
4016
|
}
|
|
3989
4017
|
setPendingMultiSelectElements([]);
|
|
@@ -4223,7 +4251,8 @@ function PageFeedbackToolbarCSS({
|
|
|
4223
4251
|
reactComponents: reactComponents2 ?? void 0,
|
|
4224
4252
|
targetElement: elementUnder2 ?? void 0,
|
|
4225
4253
|
drawingIndex: strokeIdx,
|
|
4226
|
-
strokeId: stroke.id
|
|
4254
|
+
strokeId: stroke.id,
|
|
4255
|
+
...elementUnder2 ? getSurroundingNodes(elementUnder2) : {}
|
|
4227
4256
|
});
|
|
4228
4257
|
setHoverInfo(null);
|
|
4229
4258
|
setHoveredDrawingIdx(null);
|
|
@@ -4325,8 +4354,9 @@ function PageFeedbackToolbarCSS({
|
|
|
4325
4354
|
computedStylesObj,
|
|
4326
4355
|
nearbyElements: getNearbyElements(elementUnder),
|
|
4327
4356
|
reactComponents: reactComponents ?? void 0,
|
|
4328
|
-
targetElement: elementUnder
|
|
4357
|
+
targetElement: elementUnder,
|
|
4329
4358
|
// Store for live position queries
|
|
4359
|
+
...getSurroundingNodes(elementUnder)
|
|
4330
4360
|
});
|
|
4331
4361
|
setHoverInfo(null);
|
|
4332
4362
|
};
|
|
@@ -4643,7 +4673,8 @@ function PageFeedbackToolbarCSS({
|
|
|
4643
4673
|
computedStylesObj: firstElementComputedStyles,
|
|
4644
4674
|
nearbyElements: getNearbyElements(firstElement),
|
|
4645
4675
|
cssClasses: getElementClasses(firstElement),
|
|
4646
|
-
nearbyText: getNearbyText(firstElement)
|
|
4676
|
+
nearbyText: getNearbyText(firstElement),
|
|
4677
|
+
...getSurroundingNodes(firstElement)
|
|
4647
4678
|
});
|
|
4648
4679
|
} else {
|
|
4649
4680
|
const width = Math.abs(right - left);
|
|
@@ -4847,7 +4878,8 @@ function PageFeedbackToolbarCSS({
|
|
|
4847
4878
|
reactComponents: reactComponents ?? void 0,
|
|
4848
4879
|
targetElement: elementUnder ?? void 0,
|
|
4849
4880
|
drawingIndex: strokeIdx,
|
|
4850
|
-
strokeId: stroke.id
|
|
4881
|
+
strokeId: stroke.id,
|
|
4882
|
+
...elementUnder ? getSurroundingNodes(elementUnder) : {}
|
|
4851
4883
|
});
|
|
4852
4884
|
setHoverInfo(null);
|
|
4853
4885
|
setHoveredDrawingIdx(null);
|
|
@@ -4950,7 +4982,8 @@ function PageFeedbackToolbarCSS({
|
|
|
4950
4982
|
reactComponents: reactComponents ?? void 0,
|
|
4951
4983
|
targetElement: centerEl ?? void 0,
|
|
4952
4984
|
drawingIndex: newStrokeIdx,
|
|
4953
|
-
strokeId: newStrokeId
|
|
4985
|
+
strokeId: newStrokeId,
|
|
4986
|
+
...centerEl ? getSurroundingNodes(centerEl) : {}
|
|
4954
4987
|
});
|
|
4955
4988
|
setHoverInfo(null);
|
|
4956
4989
|
}
|
|
@@ -5077,6 +5110,9 @@ function PageFeedbackToolbarCSS({
|
|
|
5077
5110
|
elementBoundingBoxes: pendingAnnotation.elementBoundingBoxes,
|
|
5078
5111
|
drawingIndex: pendingAnnotation.drawingIndex,
|
|
5079
5112
|
strokeId: pendingAnnotation.strokeId,
|
|
5113
|
+
lineText: pendingAnnotation.lineText,
|
|
5114
|
+
contextBefore: pendingAnnotation.contextBefore,
|
|
5115
|
+
contextAfter: pendingAnnotation.contextAfter,
|
|
5080
5116
|
// Protocol fields for server sync
|
|
5081
5117
|
...endpoint && currentSessionId ? {
|
|
5082
5118
|
sessionId: currentSessionId,
|
|
@@ -6035,7 +6071,7 @@ function PageFeedbackToolbarCSS({
|
|
|
6035
6071
|
] }),
|
|
6036
6072
|
/* @__PURE__ */ u3("span", { className: styles_module_default2.settingsVersion, children: [
|
|
6037
6073
|
"v",
|
|
6038
|
-
"2.
|
|
6074
|
+
"2.4.0"
|
|
6039
6075
|
] }),
|
|
6040
6076
|
/* @__PURE__ */ u3(
|
|
6041
6077
|
"button",
|
|
@@ -7027,6 +7063,7 @@ export {
|
|
|
7027
7063
|
getNearbyText,
|
|
7028
7064
|
getShadowHost,
|
|
7029
7065
|
getStorageKey,
|
|
7066
|
+
getSurroundingNodes,
|
|
7030
7067
|
identifyAnimationElement,
|
|
7031
7068
|
identifyElement,
|
|
7032
7069
|
isInShadowDOM,
|