Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package/example/src/app/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ button {
-webkit-tap-highlight-color: transparent;

&:disabled {
pointer-events: none;
cursor: not-allowed;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
box-shadow:
0 4px 24px rgba(0, 0, 0, 0.3),
0 0 0 1px rgba(255, 255, 255, 0.08);
cursor: default;
z-index: 100001;
font-family:
system-ui,
Expand Down
60 changes: 16 additions & 44 deletions package/src/components/page-toolbar-css/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,6 @@ const [settings, setSettings] = useState<ToolbarSettings>(() => {
toolbarX: number;
toolbarY: number;
} | null>(null);
const [dragRotation, setDragRotation] = useState(0);
const justFinishedToolbarDragRef = useRef(false);

// For animations - track which markers have animated in and which are exiting
Expand Down Expand Up @@ -1480,46 +1479,29 @@ const [settings, setSettings] = useState<ToolbarSettings>(() => {
useEffect(() => {
if (!isActive) return;

const textElementsSelector = [
"p", "span", "h1", "h2", "h3", "h4", "h5", "h6",
"li", "td", "th", "label", "blockquote", "figcaption",
"caption", "legend", "dt", "dd", "pre", "code",
"em", "strong", "b", "i", "u", "s", "a",
"time", "address", "cite", "q", "abbr", "dfn",
"mark", "small", "sub", "sup", "[contenteditable]"
].join(", ");

const notAgentationSelector = `:not([data-agentation-root]):not([data-agentation-root] *)`;

const style = document.createElement("style");
style.id = "feedback-cursor-styles";
// Text elements get text cursor (higher specificity with body prefix)
// Everything else gets crosshair
style.textContent = `
body * {
body ${notAgentationSelector} {
cursor: crosshair !important;
}
body p, body span, body h1, body h2, body h3, body h4, body h5, body h6,
body li, body td, body th, body label, body blockquote, body figcaption,
body caption, body legend, body dt, body dd, body pre, body code,
body em, body strong, body b, body i, body u, body s, body a,
body time, body address, body cite, body q, body abbr, body dfn,
body mark, body small, body sub, body sup, body [contenteditable],
body p *, body span *, body h1 *, body h2 *, body h3 *, body h4 *,
body h5 *, body h6 *, body li *, body a *, body label *, body pre *,
body code *, body blockquote *, body [contenteditable] * {
cursor: text !important;
}
[data-feedback-toolbar], [data-feedback-toolbar] * {
cursor: auto !important;
}
[data-feedback-toolbar] textarea,
[data-feedback-toolbar] input[type="text"],
[data-feedback-toolbar] input[type="url"] {

body :is(${textElementsSelector})${notAgentationSelector} {
cursor: text !important;
}
[data-feedback-toolbar] button,
[data-feedback-toolbar] button *,
[data-feedback-toolbar] label,
[data-feedback-toolbar] label *,
[data-feedback-toolbar] a,
[data-feedback-toolbar] a *,
[data-feedback-toolbar] [role="button"],
[data-feedback-toolbar] [role="button"] * {
cursor: pointer !important;
}
[data-annotation-marker], [data-annotation-marker] * {
cursor: pointer !important;
}
`;
document.head.appendChild(style);

Expand Down Expand Up @@ -2775,10 +2757,6 @@ const [settings, setSettings] = useState<ToolbarSettings>(() => {
const currentX = toolbarPosition?.x ?? rect.left;
const currentY = toolbarPosition?.y ?? rect.top;

// Generate random rotation between -5 and 5 degrees
const randomRotation = (Math.random() - 0.5) * 10; // -5 to +5
setDragRotation(randomRotation);

setDragStartPos({
x: e.clientX,
y: e.clientY,
Expand Down Expand Up @@ -2998,7 +2976,7 @@ const [settings, setSettings] = useState<ToolbarSettings>(() => {
};

return createPortal(
<div ref={portalWrapperRef} style={{ display: "contents" }} data-agentation-theme={isDarkMode ? "dark" : "light"} data-agentation-accent={settings.annotationColorId}>
<div ref={portalWrapperRef} style={{ display: "contents" }} data-agentation-theme={isDarkMode ? "dark" : "light"} data-agentation-accent={settings.annotationColorId} data-agentation-root="">
{/* Toolbar */}
<div
className={`${styles.toolbar}${userClassName ? ` ${userClassName}` : ""}`}
Expand All @@ -3016,7 +2994,7 @@ const [settings, setSettings] = useState<ToolbarSettings>(() => {
>
{/* Morphing container */}
<div
className={`${styles.toolbarContainer} ${isActive ? styles.expanded : styles.collapsed} ${showEntranceAnimation ? styles.entrance : ""} ${isToolbarHiding ? styles.hiding : ""} ${isDraggingToolbar ? styles.dragging : ""} ${!settings.webhooksEnabled && (isValidUrl(settings.webhookUrl) || isValidUrl(webhookUrl || "")) ? styles.serverConnected : ""}`}
className={`${styles.toolbarContainer} ${isActive ? styles.expanded : styles.collapsed} ${showEntranceAnimation ? styles.entrance : ""} ${isToolbarHiding ? styles.hiding : ""} ${!settings.webhooksEnabled && (isValidUrl(settings.webhookUrl) || isValidUrl(webhookUrl || "")) ? styles.serverConnected : ""}`}
onClick={
!isActive
? (e) => {
Expand All @@ -3034,12 +3012,6 @@ const [settings, setSettings] = useState<ToolbarSettings>(() => {
role={!isActive ? "button" : undefined}
tabIndex={!isActive ? 0 : -1}
title={!isActive ? "Start feedback mode" : undefined}
style={{
...(isDraggingToolbar && {
transform: `scale(1.05) rotate(${dragRotation}deg)`,
cursor: "grabbing",
}),
}}
>
{/* Toggle content - visible when collapsed */}
<div
Expand Down
14 changes: 3 additions & 11 deletions package/src/components/page-toolbar-css/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,12 @@
0 2px 8px rgba(0, 0, 0, 0.2),
0 4px 16px rgba(0, 0, 0, 0.1);
pointer-events: auto;
cursor: grab;

// Animated properties
transition:
width 0.4s cubic-bezier(0.19, 1, 0.22, 1),
transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);

&.dragging {
// Remove transition while dragging for immediate feedback
transition: width 0.4s cubic-bezier(0.19, 1, 0.22, 1);
cursor: grabbing;
}

&.entrance {
animation: toolbarEnter 0.5s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}
Expand Down Expand Up @@ -406,7 +399,7 @@

.controlButton {
position: relative;
cursor: pointer !important;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
Expand Down Expand Up @@ -471,7 +464,7 @@

&[data-no-hover="true"],
&.statusShowing {
cursor: default !important;
cursor: default;
pointer-events: none;
background: transparent !important;
}
Expand Down Expand Up @@ -1033,6 +1026,7 @@
&.pending {
position: fixed;
background-color: var(--agentation-color-blue);
cursor: default;
}

&.fixed {
Expand Down Expand Up @@ -1501,7 +1495,6 @@
color: #fff;
outline: none;
resize: none;
cursor: text !important;
user-select: text;
transition:
border-color 0.15s ease,
Expand Down Expand Up @@ -2038,7 +2031,6 @@

&.disabled {
opacity: 0.4;
pointer-events: none;

.toggleSlider {
cursor: not-allowed;
Expand Down