@adecore/agents-react 0.46.1 → 0.46.3

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.
@@ -89,6 +89,29 @@ function languageOf(className) {
89
89
  return /language-([\w-]+)/.exec(className ?? '')?.[1] ?? 'text';
90
90
  }
91
91
  const INLINE_CODE = 'rounded-sm bg-surface-sunken px-1 py-px font-mono text-code box-decoration-clone';
92
+ /* A double-click selects a word, which ends at a hyphen or a dot, so a flag or a command would be copied in parts. */
93
+ function selectWholeCode(event) {
94
+ window.getSelection()?.selectAllChildren(event.currentTarget);
95
+ }
96
+ function PlainCode(t0) {
97
+ const $ = _c(2);
98
+ const {
99
+ text
100
+ } = t0;
101
+ let t1;
102
+ if ($[0] !== text) {
103
+ t1 = /*#__PURE__*/_jsx("code", {
104
+ className: INLINE_CODE,
105
+ onDoubleClick: selectWholeCode,
106
+ children: text
107
+ });
108
+ $[0] = text;
109
+ $[1] = t1;
110
+ } else {
111
+ t1 = $[1];
112
+ }
113
+ return t1;
114
+ }
92
115
  /*
93
116
  * A path an agent wrote down. It keeps the shape of the code chip it would otherwise be, so a sentence
94
117
  * full of them does not shift; `data-file-path` is what the thread's right-click menu reads.
@@ -165,9 +188,8 @@ function InlineCode(t0) {
165
188
  if (target === null) {
166
189
  let t1;
167
190
  if ($[0] !== text) {
168
- t1 = /*#__PURE__*/_jsx("code", {
169
- className: INLINE_CODE,
170
- children: text
191
+ t1 = /*#__PURE__*/_jsx(PlainCode, {
192
+ text: text
171
193
  });
172
194
  $[0] = text;
173
195
  $[1] = t1;
@@ -486,9 +508,8 @@ function MarkdownCode(t0) {
486
508
  }
487
509
  let t2;
488
510
  if ($[8] !== plain || $[9] !== text) {
489
- t2 = plain ? /*#__PURE__*/_jsx("code", {
490
- className: INLINE_CODE,
491
- children: text
511
+ t2 = plain ? /*#__PURE__*/_jsx(PlainCode, {
512
+ text: text
492
513
  }) : /*#__PURE__*/_jsx(InlineCode, {
493
514
  text: text
494
515
  });
package/dist/theme.css CHANGED
@@ -123,14 +123,16 @@
123
123
  .chat-diff { font-size: var(--text-code); --diffs-font-size: var(--text-code); --diffs-font-family: var(--font-mono); }
124
124
  .chat-diff + .chat-diff { border-top: 1px solid var(--border); }
125
125
 
126
- /* Live tool rows shine once across; a paused animation costs nothing. */
126
+ /* Live tool rows shine once across; a paused animation costs nothing. A background position is
127
+ painted on the main thread, so a smooth shine repaints the row every frame; 30 steps keep it
128
+ moving at a fraction of the paints. */
127
129
  .chat-live-text {
128
130
  background: linear-gradient(90deg, var(--text-muted) 0%, var(--text) 50%, var(--text-muted) 100%);
129
131
  background-size: 200% 100%;
130
132
  -webkit-background-clip: text;
131
133
  background-clip: text;
132
134
  color: transparent;
133
- animation: chat-shine 1.6s linear infinite;
135
+ animation: chat-shine 1.6s steps(30) infinite;
134
136
  }
135
137
  @keyframes chat-shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
136
138
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents-react",
3
- "version": "0.46.1",
3
+ "version": "0.46.3",
4
4
  "description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -72,11 +72,11 @@
72
72
  "test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
73
73
  },
74
74
  "dependencies": {
75
- "@adecore/agent-contracts": "0.46.1",
76
- "@adecore/editor": "0.46.1",
77
- "@adecore/editor-react": "0.46.1",
78
- "@adecore/intelligent-ui": "0.46.1",
79
- "@adecore/merge": "0.46.1",
75
+ "@adecore/agent-contracts": "0.46.3",
76
+ "@adecore/editor": "0.46.3",
77
+ "@adecore/editor-react": "0.46.3",
78
+ "@adecore/intelligent-ui": "0.46.3",
79
+ "@adecore/merge": "0.46.3",
80
80
  "@codemirror/commands": "^6.11.1",
81
81
  "@codemirror/language": "^6.13.1",
82
82
  "@codemirror/state": "^6.7.6",
@@ -100,14 +100,14 @@
100
100
  "zustand": "^5.0.16"
101
101
  },
102
102
  "peerDependencies": {
103
- "@adecore/ui": "^0.46.1",
103
+ "@adecore/ui": "^0.46.3",
104
104
  "i18next": "^26.4.2",
105
105
  "react": "^19.3.0",
106
106
  "react-dom": "^19.3.0",
107
107
  "react-i18next": "^17.0.15"
108
108
  },
109
109
  "devDependencies": {
110
- "@adecore/ui": "0.46.1",
110
+ "@adecore/ui": "0.46.3",
111
111
  "@types/bun": "^1.4.4",
112
112
  "@types/react": "^19.3.0",
113
113
  "@types/react-dom": "^19.3.0",
@@ -1,4 +1,4 @@
1
- import { createContext, memo, useContext, type ComponentProps, type ReactNode } from 'react';
1
+ import { createContext, memo, useContext, type ComponentProps, type MouseEvent, type ReactNode } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import { Zap } from 'lucide-react';
4
4
  import ReactMarkdown, { type Components, type ExtraProps, type Options } from 'react-markdown';
@@ -101,6 +101,19 @@ function languageOf(className: string | undefined): string {
101
101
 
102
102
  const INLINE_CODE = 'rounded-sm bg-surface-sunken px-1 py-px font-mono text-code box-decoration-clone';
103
103
 
104
+ /* A double-click selects a word, which ends at a hyphen or a dot, so a flag or a command would be copied in parts. */
105
+ function selectWholeCode(event: MouseEvent<HTMLElement>): void {
106
+ window.getSelection()?.selectAllChildren(event.currentTarget);
107
+ }
108
+
109
+ function PlainCode({ text }: { text: string }) {
110
+ return (
111
+ <code className={INLINE_CODE} onDoubleClick={selectWholeCode}>
112
+ {text}
113
+ </code>
114
+ );
115
+ }
116
+
104
117
  /*
105
118
  * A path an agent wrote down. It keeps the shape of the code chip it would otherwise be, so a sentence
106
119
  * full of them does not shift; `data-file-path` is what the thread's right-click menu reads.
@@ -134,7 +147,7 @@ function InlineCode({ text }: { text: string }) {
134
147
  const target = useFileLinkTarget(text);
135
148
 
136
149
  if (target === null) {
137
- return <code className={INLINE_CODE}>{text}</code>;
150
+ return <PlainCode text={text} />;
138
151
  }
139
152
 
140
153
  return (
@@ -244,7 +257,7 @@ function MarkdownCode({ className, children, plain = false }: { className?: stri
244
257
  return lang === 'mermaid' ? <Diagram code={code} /> : <CodeBlock code={code} lang={lang} />;
245
258
  }
246
259
 
247
- return plain ? <code className={INLINE_CODE}>{text}</code> : <InlineCode text={text} />;
260
+ return plain ? <PlainCode text={text} /> : <InlineCode text={text} />;
248
261
  }
249
262
 
250
263
  const components = {
package/src/theme.css CHANGED
@@ -123,14 +123,16 @@
123
123
  .chat-diff { font-size: var(--text-code); --diffs-font-size: var(--text-code); --diffs-font-family: var(--font-mono); }
124
124
  .chat-diff + .chat-diff { border-top: 1px solid var(--border); }
125
125
 
126
- /* Live tool rows shine once across; a paused animation costs nothing. */
126
+ /* Live tool rows shine once across; a paused animation costs nothing. A background position is
127
+ painted on the main thread, so a smooth shine repaints the row every frame; 30 steps keep it
128
+ moving at a fraction of the paints. */
127
129
  .chat-live-text {
128
130
  background: linear-gradient(90deg, var(--text-muted) 0%, var(--text) 50%, var(--text-muted) 100%);
129
131
  background-size: 200% 100%;
130
132
  -webkit-background-clip: text;
131
133
  background-clip: text;
132
134
  color: transparent;
133
- animation: chat-shine 1.6s linear infinite;
135
+ animation: chat-shine 1.6s steps(30) infinite;
134
136
  }
135
137
  @keyframes chat-shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
136
138