@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.
- package/README.md +106 -21
- package/dist/cjs/index.cjs +247 -14
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/cjs/index.native.cjs +11 -11
- package/dist/cjs/index.native.cjs.map +3 -3
- package/dist/cjs/index.web.cjs +5 -5
- package/dist/cjs/index.web.cjs.map +2 -2
- package/dist/esm/index.js +248 -14
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/index.native.js +11 -11
- package/dist/esm/index.native.js.map +3 -3
- package/dist/esm/index.web.js +5 -5
- package/dist/esm/index.web.js.map +2 -2
- package/dist/types/components/ErrorBoundary.d.ts +159 -0
- package/dist/types/index.d.ts +5 -3
- package/dist/types/index.web.d.ts +2 -2
- package/dist/types/store.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/AnnotationInput.tsx +2 -2
- package/src/components/AnnotationList.tsx +2 -2
- package/src/components/ErrorBoundary.tsx +426 -0
- package/src/components/Highlighter.tsx +2 -2
- package/src/components/Toolbar.tsx +4 -3
- package/src/components/native/AnnotationInput.tsx +2 -2
- package/src/components/native/AnnotationList.tsx +2 -2
- package/src/components/native/Highlighter.tsx +2 -2
- package/src/components/native/Toolbar.tsx +2 -2
- package/src/components/web/AnnotationInput.tsx +2 -2
- package/src/components/web/AnnotationList.tsx +2 -2
- package/src/components/web/Highlighter.tsx +2 -2
- package/src/components/web/Toolbar.tsx +2 -2
- package/src/extension.tsx +1 -1
- package/src/index.native.tsx +4 -4
- package/src/index.tsx +6 -4
- package/src/index.web.tsx +3 -3
- package/src/store.tsx +3 -3
package/src/index.tsx
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AgentAnnotationProvider as Provider } from './store';
|
|
3
3
|
import { Toolbar } from './components/Toolbar';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface AgentAnnotationProviderProps {
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Web
|
|
10
|
+
* Web Agent Annotation Provider
|
|
11
11
|
* Wraps your app to provide annotation functionality
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
13
|
+
export function AgentAnnotationProvider({ children }: AgentAnnotationProviderProps) {
|
|
14
14
|
return (
|
|
15
15
|
<Provider>
|
|
16
16
|
{children}
|
|
@@ -28,6 +28,8 @@ export { Highlighter } from './components/Highlighter';
|
|
|
28
28
|
export { AnnotationInput } from './components/AnnotationInput';
|
|
29
29
|
export { AnnotationList } from './components/AnnotationList';
|
|
30
30
|
export { Draggable } from './components/Draggable';
|
|
31
|
+
export { ErrorBoundary } from './components/ErrorBoundary';
|
|
32
|
+
export type { ErrorBoundaryProps, ErrorInfo, FallbackProps, ErrorButtonConfig } from './components/ErrorBoundary';
|
|
31
33
|
|
|
32
34
|
// Export screenshot utility
|
|
33
35
|
export { captureScreenshot } from './utils/screenshot';
|
package/src/index.web.tsx
CHANGED
|
@@ -105,7 +105,7 @@ function reducer(state: State, action: Action): State {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
export function
|
|
108
|
+
export function AgentAnnotationProvider({ children }: { children: ReactNode }) {
|
|
109
109
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
110
110
|
|
|
111
111
|
return (
|
|
@@ -115,10 +115,10 @@ export function AiAnnotationProvider({ children }: { children: ReactNode }) {
|
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
export function
|
|
118
|
+
export function useAgentAnnotation() {
|
|
119
119
|
const context = useContext(AnnotationContext);
|
|
120
120
|
if (!context) {
|
|
121
|
-
throw new Error('
|
|
121
|
+
throw new Error('useAgentAnnotation must be used within an AgentAnnotationProvider');
|
|
122
122
|
}
|
|
123
123
|
return context;
|
|
124
124
|
}
|
package/src/store.tsx
CHANGED
|
@@ -101,7 +101,7 @@ function reducer(state: State, action: Action): State {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
export function
|
|
104
|
+
export function AgentAnnotationProvider({ children }: { children: ReactNode }) {
|
|
105
105
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
106
106
|
|
|
107
107
|
return (
|
|
@@ -111,10 +111,10 @@ export function AiAnnotationProvider({ children }: { children: ReactNode }) {
|
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
export function
|
|
114
|
+
export function useAgentAnnotation() {
|
|
115
115
|
const context = useContext(AnnotationContext);
|
|
116
116
|
if (!context) {
|
|
117
|
-
throw new Error('
|
|
117
|
+
throw new Error('useAgentAnnotation must be used within an AgentAnnotationProvider');
|
|
118
118
|
}
|
|
119
119
|
return context;
|
|
120
120
|
}
|