@np-dev/ui-ai-anotation 0.1.0 → 0.1.1

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.
Files changed (36) hide show
  1. package/README.md +106 -21
  2. package/dist/cjs/index.cjs +247 -14
  3. package/dist/cjs/index.cjs.map +4 -4
  4. package/dist/cjs/index.native.cjs +11 -11
  5. package/dist/cjs/index.native.cjs.map +3 -3
  6. package/dist/cjs/index.web.cjs +5 -5
  7. package/dist/cjs/index.web.cjs.map +2 -2
  8. package/dist/esm/index.js +248 -14
  9. package/dist/esm/index.js.map +4 -4
  10. package/dist/esm/index.native.js +11 -11
  11. package/dist/esm/index.native.js.map +3 -3
  12. package/dist/esm/index.web.js +5 -5
  13. package/dist/esm/index.web.js.map +2 -2
  14. package/dist/types/components/ErrorBoundary.d.ts +159 -0
  15. package/dist/types/index.d.ts +5 -3
  16. package/dist/types/index.web.d.ts +2 -2
  17. package/dist/types/store.d.ts +2 -2
  18. package/package.json +1 -1
  19. package/src/components/AnnotationInput.tsx +2 -2
  20. package/src/components/AnnotationList.tsx +2 -2
  21. package/src/components/ErrorBoundary.tsx +426 -0
  22. package/src/components/Highlighter.tsx +2 -2
  23. package/src/components/Toolbar.tsx +4 -3
  24. package/src/components/native/AnnotationInput.tsx +2 -2
  25. package/src/components/native/AnnotationList.tsx +2 -2
  26. package/src/components/native/Highlighter.tsx +2 -2
  27. package/src/components/native/Toolbar.tsx +2 -2
  28. package/src/components/web/AnnotationInput.tsx +2 -2
  29. package/src/components/web/AnnotationList.tsx +2 -2
  30. package/src/components/web/Highlighter.tsx +2 -2
  31. package/src/components/web/Toolbar.tsx +2 -2
  32. package/src/extension.tsx +1 -1
  33. package/src/index.native.tsx +4 -4
  34. package/src/index.tsx +6 -4
  35. package/src/index.web.tsx +3 -3
  36. package/src/store.tsx +3 -3
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # react-ai-anotation
1
+ # @np-dev/ui-ai-anotation
2
2
 
3
3
  AI-powered annotation toolkit for React and React Native apps. Enables component inspection, annotation, and screenshot capture for AI-assisted development workflows.
4
4
 
@@ -15,13 +15,13 @@ AI-powered annotation toolkit for React and React Native apps. Enables component
15
15
 
16
16
  ```bash
17
17
  # Using npm
18
- npm install react-ai-anotation
18
+ npm install @np-dev/ui-ai-anotation
19
19
 
20
20
  # Using yarn
21
- yarn add react-ai-anotation
21
+ yarn add @np-dev/ui-ai-anotation
22
22
 
23
23
  # Using bun
24
- bun add react-ai-anotation
24
+ bun add @np-dev/ui-ai-anotation
25
25
  ```
26
26
 
27
27
  ### Additional dependencies
@@ -47,13 +47,13 @@ npm install expo-media-library
47
47
  ### Web (React)
48
48
 
49
49
  ```tsx
50
- import { AiAnnotationProvider } from 'react-ai-anotation';
50
+ import { AgentAnnotationProvider } from '@np-dev/ui-ai-anotation';
51
51
 
52
52
  function App() {
53
53
  return (
54
- <AiAnnotationProvider>
54
+ <AgentAnnotationProvider>
55
55
  <YourApp />
56
- </AiAnnotationProvider>
56
+ </AgentAnnotationProvider>
57
57
  );
58
58
  }
59
59
  ```
@@ -61,15 +61,15 @@ function App() {
61
61
  ### React Native
62
62
 
63
63
  ```tsx
64
- import { AiAnnotationProvider } from 'react-ai-anotation/native';
64
+ import { AgentAnnotationProvider } from '@np-dev/ui-ai-anotation/native';
65
65
  // or
66
- import { AiAnnotationProvider } from 'react-ai-anotation';
66
+ import { AgentAnnotationProvider } from '@np-dev/ui-ai-anotation';
67
67
 
68
68
  function App() {
69
69
  return (
70
- <AiAnnotationProvider>
70
+ <AgentAnnotationProvider>
71
71
  <YourApp />
72
- </AiAnnotationProvider>
72
+ </AgentAnnotationProvider>
73
73
  );
74
74
  }
75
75
  ```
@@ -78,14 +78,14 @@ function App() {
78
78
 
79
79
  ### Components
80
80
 
81
- #### `AiAnnotationProvider`
81
+ #### `AgentAnnotationProvider`
82
82
 
83
83
  Wraps your app to provide annotation functionality.
84
84
 
85
85
  ```tsx
86
- <AiAnnotationProvider>
86
+ <AgentAnnotationProvider>
87
87
  {children}
88
- </AiAnnotationProvider>
88
+ </AgentAnnotationProvider>
89
89
  ```
90
90
 
91
91
  #### `Toolbar`
@@ -106,14 +106,99 @@ interface HighlighterProps {
106
106
  }
107
107
  ```
108
108
 
109
+ #### `ErrorBoundary`
110
+
111
+ A customizable error boundary component with copy-to-clipboard functionality for error reports.
112
+
113
+ ```tsx
114
+ import { ErrorBoundary } from '@np-dev/ui-ai-anotation';
115
+
116
+ <ErrorBoundary>
117
+ <YourApp />
118
+ </ErrorBoundary>
119
+ ```
120
+
121
+ **Props:**
122
+
123
+ | Prop | Type | Default | Description |
124
+ |------|------|---------|-------------|
125
+ | `children` | `ReactNode` | - | Child components to wrap |
126
+ | `fallback` | `React.ComponentType<FallbackProps>` | - | Fully custom fallback component |
127
+ | `fallbackElement` | `ReactNode` | - | Simple static fallback element |
128
+ | `title` | `string` | `"Something went wrong"` | Error page title |
129
+ | `subtitle` | `string` | `"An unexpected error..."` | Error description |
130
+ | `showErrorDetails` | `boolean` | `true` | Show/hide error stack trace |
131
+ | `showCopyButton` | `boolean` | `true` | Show/hide copy error button |
132
+ | `showRetryButton` | `boolean` | `true` | Show/hide retry button |
133
+ | `retryButtonLabel` | `string` | `"Try Again"` | Retry button text |
134
+ | `copyButtonLabel` | `string` | `"Copy Error Details"` | Copy button text |
135
+ | `customButtons` | `ErrorButtonConfig[]` | - | Additional custom buttons |
136
+ | `containerStyle` | `CSSProperties` | - | Override container styles |
137
+ | `errorDetailsStyle` | `CSSProperties` | - | Override error details styles |
138
+ | `onError` | `(error, errorInfo) => void` | - | Callback when error occurs |
139
+ | `onReset` | `() => void` | - | Callback when reset/retry |
140
+
141
+ **Custom Fallback Example:**
142
+
143
+ ```tsx
144
+ <ErrorBoundary
145
+ fallback={({ error, errorInfo, reset, copyToClipboard, copied }) => (
146
+ <div>
147
+ <h1>Oops! {error.message}</h1>
148
+ <button onClick={reset}>Retry</button>
149
+ <button onClick={copyToClipboard}>
150
+ {copied ? 'Copied!' : 'Copy Error'}
151
+ </button>
152
+ </div>
153
+ )}
154
+ >
155
+ <App />
156
+ </ErrorBoundary>
157
+ ```
158
+
159
+ **Custom Buttons Example:**
160
+
161
+ ```tsx
162
+ <ErrorBoundary
163
+ title="Application Error"
164
+ subtitle="Please try again or contact support"
165
+ customButtons={[
166
+ {
167
+ label: 'Go Home',
168
+ onClick: () => window.location.href = '/',
169
+ style: { backgroundColor: '#4CAF50' }
170
+ },
171
+ {
172
+ label: 'Contact Support',
173
+ onClick: () => window.open('mailto:support@example.com')
174
+ }
175
+ ]}
176
+ >
177
+ <App />
178
+ </ErrorBoundary>
179
+ ```
180
+
181
+ **Minimal Error Page:**
182
+
183
+ ```tsx
184
+ <ErrorBoundary
185
+ showErrorDetails={false}
186
+ showCopyButton={false}
187
+ title="Oops!"
188
+ subtitle="Something went wrong. Please refresh the page."
189
+ >
190
+ <App />
191
+ </ErrorBoundary>
192
+ ```
193
+
109
194
  ### Hooks
110
195
 
111
- #### `useAiAnnotation()`
196
+ #### `useAgentAnnotation()`
112
197
 
113
198
  Access annotation state and dispatch actions.
114
199
 
115
200
  ```tsx
116
- const { state, dispatch } = useAiAnnotation();
201
+ const { state, dispatch } = useAgentAnnotation();
117
202
 
118
203
  // State shape
119
204
  interface State {
@@ -142,7 +227,7 @@ Capture a screenshot of an element/view.
142
227
 
143
228
  **Web:**
144
229
  ```tsx
145
- import { captureScreenshot } from 'react-ai-anotation';
230
+ import { captureScreenshot } from '@np-dev/ui-ai-anotation';
146
231
 
147
232
  const result = await captureScreenshot(htmlElement, {
148
233
  scale: 2,
@@ -153,7 +238,7 @@ const result = await captureScreenshot(htmlElement, {
153
238
 
154
239
  **Native:**
155
240
  ```tsx
156
- import { captureScreenshot } from 'react-ai-anotation/native';
241
+ import { captureScreenshot } from '@np-dev/ui-ai-anotation/native';
157
242
 
158
243
  const viewRef = useRef<View>(null);
159
244
 
@@ -168,7 +253,7 @@ const result = await captureScreenshot(viewRef, {
168
253
  #### Platform Detection
169
254
 
170
255
  ```tsx
171
- import { isWeb, isNative, getPlatform, isTauriEnv } from 'react-ai-anotation';
256
+ import { isWeb, isNative, getPlatform, isTauriEnv } from '@np-dev/ui-ai-anotation';
172
257
 
173
258
  if (isWeb) {
174
259
  // Web-specific code
@@ -204,7 +289,7 @@ const platform = getPlatform(); // 'web' | 'ios' | 'android' | 'native'
204
289
  The package includes special handling for Tauri apps (web apps running in Tauri):
205
290
 
206
291
  ```tsx
207
- import { isTauriEnv, captureScreenshot } from 'react-ai-anotation';
292
+ import { isTauriEnv, captureScreenshot } from '@np-dev/ui-ai-anotation';
208
293
 
209
294
  if (isTauriEnv()) {
210
295
  // Uses @tauri-apps/plugin-clipboard-manager for clipboard
@@ -218,7 +303,7 @@ Use the annotation toolkit on any website as a Chrome extension!
218
303
  ### Build the Extension
219
304
 
220
305
  ```bash
221
- cd packages/react-ai-anotation
306
+ cd packages/ui-ai-anotation
222
307
  bun install
223
308
  bun run build:extension
224
309
  ```
@@ -5,6 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
9
  var __export = (target, all) => {
9
10
  for (var name in all)
10
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -26,14 +27,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
27
  mod
27
28
  ));
28
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
29
31
 
30
32
  // src/index.tsx
31
33
  var index_exports = {};
32
34
  __export(index_exports, {
33
- AiAnnotationProvider: () => AiAnnotationProvider2,
35
+ AgentAnnotationProvider: () => AgentAnnotationProvider2,
34
36
  AnnotationInput: () => AnnotationInput,
35
37
  AnnotationList: () => AnnotationList,
36
38
  Draggable: () => Draggable,
39
+ ErrorBoundary: () => ErrorBoundary,
37
40
  Highlighter: () => Highlighter,
38
41
  Toolbar: () => Toolbar,
39
42
  captureScreenshot: () => captureScreenshot,
@@ -44,7 +47,7 @@ __export(index_exports, {
44
47
  isNative: () => isNative,
45
48
  isTauriEnv: () => isTauriEnv2,
46
49
  isWeb: () => isWeb,
47
- useAiAnnotation: () => useAiAnnotation
50
+ useAgentAnnotation: () => useAgentAnnotation
48
51
  });
49
52
  module.exports = __toCommonJS(index_exports);
50
53
 
@@ -93,14 +96,14 @@ function reducer(state, action) {
93
96
  return state;
94
97
  }
95
98
  }
96
- function AiAnnotationProvider({ children }) {
99
+ function AgentAnnotationProvider({ children }) {
97
100
  const [state, dispatch] = (0, import_react.useReducer)(reducer, initialState);
98
101
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnnotationContext.Provider, { value: { state, dispatch }, children });
99
102
  }
100
- function useAiAnnotation() {
103
+ function useAgentAnnotation() {
101
104
  const context = (0, import_react.useContext)(AnnotationContext);
102
105
  if (!context) {
103
- throw new Error("useAiAnnotation must be used within an AiAnnotationProvider");
106
+ throw new Error("useAgentAnnotation must be used within an AgentAnnotationProvider");
104
107
  }
105
108
  return context;
106
109
  }
@@ -220,7 +223,7 @@ function formatComponentDetails(details) {
220
223
  return lines.join("\n");
221
224
  }
222
225
  function AnnotationInput({ onClose, componentName, componentDetails }) {
223
- const { dispatch } = useAiAnnotation();
226
+ const { dispatch } = useAgentAnnotation();
224
227
  const [note, setNote] = (0, import_react3.useState)("");
225
228
  const [includeDetails, setIncludeDetails] = (0, import_react3.useState)(true);
226
229
  const [isVisible, setIsVisible] = (0, import_react3.useState)(false);
@@ -687,7 +690,7 @@ function getComponentDetails(element, options) {
687
690
  // src/components/Highlighter.tsx
688
691
  var import_jsx_runtime4 = require("react/jsx-runtime");
689
692
  function Highlighter() {
690
- const { state, dispatch } = useAiAnnotation();
693
+ const { state, dispatch } = useAgentAnnotation();
691
694
  const { hoveredElement, mode, hoveredComponentInfo } = state;
692
695
  const [rect, setRect] = (0, import_react4.useState)(null);
693
696
  const [showInput, setShowInput] = (0, import_react4.useState)(false);
@@ -1106,7 +1109,7 @@ var import_react5 = require("react");
1106
1109
  var import_lucide_react2 = require("lucide-react");
1107
1110
  var import_jsx_runtime5 = require("react/jsx-runtime");
1108
1111
  function AnnotationList() {
1109
- const { state, dispatch } = useAiAnnotation();
1112
+ const { state, dispatch } = useAgentAnnotation();
1110
1113
  const [expandedId, setExpandedId] = (0, import_react5.useState)(null);
1111
1114
  if (!state.showList) return null;
1112
1115
  const toggleExpand = (id) => {
@@ -1336,7 +1339,7 @@ function AnnotationList() {
1336
1339
  // src/components/Toolbar.tsx
1337
1340
  var import_jsx_runtime6 = require("react/jsx-runtime");
1338
1341
  function Toolbar() {
1339
- const { state, dispatch } = useAiAnnotation();
1342
+ const { state, dispatch } = useAgentAnnotation();
1340
1343
  const [showCopied, setShowCopied] = (0, import_react6.useState)(false);
1341
1344
  const [isAnimating, setIsAnimating] = (0, import_react6.useState)(false);
1342
1345
  const contentRef = (0, import_react6.useRef)(null);
@@ -1360,7 +1363,8 @@ function Toolbar() {
1360
1363
  const sections = state.annotations.map((a, index) => {
1361
1364
  const lines = [];
1362
1365
  lines.push(`${"=".repeat(50)}`);
1363
- lines.push(`Annotation ${index + 1}: ${a.componentName}`);
1366
+ lines.push(`Annotation ${index + 1}`);
1367
+ lines.push(`Component: ${a.componentName}`);
1364
1368
  lines.push(`${"=".repeat(50)}`);
1365
1369
  lines.push("");
1366
1370
  lines.push("## Instruction");
@@ -1521,6 +1525,235 @@ function Toolbar() {
1521
1525
  ] });
1522
1526
  }
1523
1527
 
1528
+ // src/components/ErrorBoundary.tsx
1529
+ var import_react7 = require("react");
1530
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1531
+ var defaultStyles = {
1532
+ container: {
1533
+ display: "flex",
1534
+ flexDirection: "column",
1535
+ alignItems: "center",
1536
+ justifyContent: "center",
1537
+ minHeight: "100vh",
1538
+ padding: "24px",
1539
+ backgroundColor: "#1e1e1e",
1540
+ color: "#e5e7eb",
1541
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
1542
+ },
1543
+ content: {
1544
+ maxWidth: "600px",
1545
+ width: "100%",
1546
+ textAlign: "center"
1547
+ },
1548
+ icon: {
1549
+ fontSize: "48px",
1550
+ marginBottom: "16px"
1551
+ },
1552
+ title: {
1553
+ fontSize: "24px",
1554
+ fontWeight: 600,
1555
+ marginBottom: "8px",
1556
+ color: "#f87171"
1557
+ },
1558
+ subtitle: {
1559
+ fontSize: "16px",
1560
+ color: "#9ca3af",
1561
+ marginBottom: "24px"
1562
+ },
1563
+ errorBox: {
1564
+ backgroundColor: "#2d2d2d",
1565
+ border: "1px solid #404040",
1566
+ borderRadius: "8px",
1567
+ padding: "16px",
1568
+ marginBottom: "24px",
1569
+ textAlign: "left",
1570
+ maxHeight: "200px",
1571
+ overflow: "auto"
1572
+ },
1573
+ errorText: {
1574
+ fontFamily: "monospace",
1575
+ fontSize: "12px",
1576
+ color: "#f87171",
1577
+ whiteSpace: "pre-wrap",
1578
+ wordBreak: "break-word",
1579
+ margin: 0
1580
+ },
1581
+ buttonContainer: {
1582
+ display: "flex",
1583
+ gap: "12px",
1584
+ justifyContent: "center",
1585
+ flexWrap: "wrap"
1586
+ },
1587
+ button: {
1588
+ padding: "10px 20px",
1589
+ borderRadius: "6px",
1590
+ border: "none",
1591
+ fontSize: "14px",
1592
+ fontWeight: 500,
1593
+ cursor: "pointer",
1594
+ transition: "all 0.2s"
1595
+ },
1596
+ primaryButton: {
1597
+ backgroundColor: "#3b82f6",
1598
+ color: "white"
1599
+ },
1600
+ secondaryButton: {
1601
+ backgroundColor: "#404040",
1602
+ color: "#e5e7eb"
1603
+ },
1604
+ successButton: {
1605
+ backgroundColor: "#22c55e",
1606
+ color: "white"
1607
+ }
1608
+ };
1609
+ var ErrorBoundary = class extends import_react7.Component {
1610
+ constructor(props) {
1611
+ super(props);
1612
+ __publicField(this, "handleReset", () => {
1613
+ this.props.onReset?.();
1614
+ this.setState({
1615
+ hasError: false,
1616
+ error: null,
1617
+ errorInfo: null,
1618
+ copied: false
1619
+ });
1620
+ });
1621
+ __publicField(this, "handleCopyToClipboard", async () => {
1622
+ const text = this.formatError();
1623
+ try {
1624
+ await navigator.clipboard.writeText(text);
1625
+ this.setState({ copied: true });
1626
+ setTimeout(() => this.setState({ copied: false }), 2e3);
1627
+ } catch (err) {
1628
+ console.error("Failed to copy error details:", err);
1629
+ }
1630
+ });
1631
+ this.state = {
1632
+ hasError: false,
1633
+ error: null,
1634
+ errorInfo: null,
1635
+ copied: false
1636
+ };
1637
+ }
1638
+ static getDerivedStateFromError(error) {
1639
+ return { hasError: true, error };
1640
+ }
1641
+ componentDidCatch(error, errorInfo) {
1642
+ this.setState({ errorInfo });
1643
+ this.props.onError?.(error, errorInfo);
1644
+ }
1645
+ formatError() {
1646
+ const { error, errorInfo } = this.state;
1647
+ if (!error) return "";
1648
+ const lines = [
1649
+ "=".repeat(50),
1650
+ "ERROR REPORT",
1651
+ "=".repeat(50),
1652
+ "",
1653
+ `Error: ${error.name}`,
1654
+ `Message: ${error.message}`,
1655
+ "",
1656
+ "Stack Trace:",
1657
+ error.stack || "No stack trace available"
1658
+ ];
1659
+ if (errorInfo?.componentStack) {
1660
+ lines.push("", "Component Stack:", errorInfo.componentStack);
1661
+ }
1662
+ lines.push("", `Timestamp: ${(/* @__PURE__ */ new Date()).toISOString()}`);
1663
+ lines.push(`User Agent: ${typeof navigator !== "undefined" ? navigator.userAgent : "N/A"}`);
1664
+ return lines.join("\n");
1665
+ }
1666
+ getErrorInfo() {
1667
+ return {
1668
+ error: this.state.error,
1669
+ errorInfo: this.state.errorInfo,
1670
+ formattedError: this.formatError(),
1671
+ reset: this.handleReset
1672
+ };
1673
+ }
1674
+ renderDefaultFallback() {
1675
+ const {
1676
+ title = "Something went wrong",
1677
+ subtitle = "An unexpected error occurred",
1678
+ showErrorDetails = true,
1679
+ showCopyButton = true,
1680
+ showRetryButton = true,
1681
+ retryButtonLabel = "Try Again",
1682
+ copyButtonLabel = "Copy Error Details",
1683
+ customButtons = [],
1684
+ containerStyle,
1685
+ errorDetailsStyle
1686
+ } = this.props;
1687
+ const { error, copied } = this.state;
1688
+ const errorInfo = this.getErrorInfo();
1689
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { ...defaultStyles.container, ...containerStyle }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: defaultStyles.content, children: [
1690
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: defaultStyles.icon, children: "\u26A0\uFE0F" }),
1691
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { style: defaultStyles.title, children: title }),
1692
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: defaultStyles.subtitle, children: subtitle }),
1693
+ showErrorDetails && error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { ...defaultStyles.errorBox, ...errorDetailsStyle }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("pre", { style: defaultStyles.errorText, children: [
1694
+ error.name,
1695
+ ": ",
1696
+ error.message,
1697
+ error.stack && `
1698
+
1699
+ ${error.stack.split("\n").slice(1, 5).join("\n")}`
1700
+ ] }) }),
1701
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: defaultStyles.buttonContainer, children: [
1702
+ showRetryButton && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1703
+ "button",
1704
+ {
1705
+ onClick: this.handleReset,
1706
+ style: { ...defaultStyles.button, ...defaultStyles.primaryButton },
1707
+ children: retryButtonLabel
1708
+ }
1709
+ ),
1710
+ showCopyButton && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1711
+ "button",
1712
+ {
1713
+ onClick: this.handleCopyToClipboard,
1714
+ style: {
1715
+ ...defaultStyles.button,
1716
+ ...copied ? defaultStyles.successButton : defaultStyles.secondaryButton
1717
+ },
1718
+ children: copied ? "\u2713 Copied!" : copyButtonLabel
1719
+ }
1720
+ ),
1721
+ customButtons.map((btn, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1722
+ "button",
1723
+ {
1724
+ onClick: () => btn.onClick(errorInfo),
1725
+ style: { ...defaultStyles.button, ...defaultStyles.secondaryButton, ...btn.style },
1726
+ className: btn.className,
1727
+ children: btn.label
1728
+ },
1729
+ index
1730
+ ))
1731
+ ] })
1732
+ ] }) });
1733
+ }
1734
+ render() {
1735
+ const { hasError } = this.state;
1736
+ const { children, fallback: FallbackComponent, fallbackElement } = this.props;
1737
+ if (hasError) {
1738
+ if (FallbackComponent) {
1739
+ const errorInfo = this.getErrorInfo();
1740
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1741
+ FallbackComponent,
1742
+ {
1743
+ ...errorInfo,
1744
+ copyToClipboard: this.handleCopyToClipboard
1745
+ }
1746
+ );
1747
+ }
1748
+ if (fallbackElement) {
1749
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: fallbackElement });
1750
+ }
1751
+ return this.renderDefaultFallback();
1752
+ }
1753
+ return children;
1754
+ }
1755
+ };
1756
+
1524
1757
  // src/utils/platform.ts
1525
1758
  var isWeb = typeof document !== "undefined" && typeof window !== "undefined";
1526
1759
  var isNative = !isWeb && typeof global !== "undefined";
@@ -1540,11 +1773,11 @@ function isTauriEnv2() {
1540
1773
  }
1541
1774
 
1542
1775
  // src/index.tsx
1543
- var import_jsx_runtime7 = require("react/jsx-runtime");
1544
- function AiAnnotationProvider2({ children }) {
1545
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(AiAnnotationProvider, { children: [
1776
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1777
+ function AgentAnnotationProvider2({ children }) {
1778
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(AgentAnnotationProvider, { children: [
1546
1779
  children,
1547
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Toolbar, {})
1780
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Toolbar, {})
1548
1781
  ] });
1549
1782
  }
1550
1783
  //# sourceMappingURL=index.cjs.map