agentation 0.0.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 ADDED
@@ -0,0 +1,169 @@
1
+ # agentation
2
+
3
+ A floating toolbar for annotating web pages and collecting structured feedback.
4
+
5
+ ## Features
6
+
7
+ - Click anywhere to add annotations with smart element identification
8
+ - Select text to annotate specific passages
9
+ - Hover to see element names highlighted
10
+ - Pause CSS animations to capture specific states
11
+ - Copy structured markdown output
12
+ - Annotations persist in localStorage (7-day expiry)
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pnpm add agentation framer-motion
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```tsx
23
+ import { FeedbackToolbar } from 'agentation';
24
+
25
+ function App() {
26
+ return (
27
+ <>
28
+ <YourContent />
29
+ <FeedbackToolbar />
30
+ </>
31
+ );
32
+ }
33
+ ```
34
+
35
+ ## Development
36
+
37
+ ```bash
38
+ # Install dependencies
39
+ pnpm install
40
+
41
+ # Build the package
42
+ pnpm build
43
+
44
+ # Watch mode
45
+ pnpm dev
46
+
47
+ # Run the example app
48
+ cd example && pnpm install && pnpm dev
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Refactoring Checklist
54
+
55
+ This package was extracted from benji.org. The following items need to be addressed to make it fully standalone:
56
+
57
+ ### High Priority
58
+
59
+ - [ ] **Convert SCSS to CSS-in-JS or CSS variables**
60
+ - Currently uses SCSS modules which require consumer to have SCSS setup
61
+ - Options: vanilla-extract, CSS modules with plain CSS, or inline styles
62
+ - Files: `src/components/*/styles.module.scss`
63
+
64
+ - [ ] **Add configuration props to FeedbackToolbar**
65
+ ```tsx
66
+ interface FeedbackToolbarProps {
67
+ enabled?: boolean; // Control visibility (default: true)
68
+ theme?: {
69
+ primary?: string; // Default: #3c82f7
70
+ success?: string; // Default: #34C759
71
+ danger?: string; // Default: #ff3b30
72
+ };
73
+ zIndexBase?: number; // Default: 100000
74
+ retentionDays?: number; // Default: 7
75
+ onCopy?: (markdown: string) => void | Promise<void>;
76
+ }
77
+ ```
78
+
79
+ - [ ] **Abstract storage layer**
80
+ - Create `StorageAdapter` interface
81
+ - Provide default localStorage implementation
82
+ - Allow custom implementations (IndexedDB, API, etc.)
83
+
84
+ ### Medium Priority
85
+
86
+ - [ ] **Add CSS custom properties for theming**
87
+ ```css
88
+ :root {
89
+ --feedback-primary: #3c82f7;
90
+ --feedback-success: #34C759;
91
+ --feedback-danger: #ff3b30;
92
+ --feedback-z-index: 100000;
93
+ }
94
+ ```
95
+
96
+ - [ ] **Export TypeScript types**
97
+ - `Annotation`
98
+ - `FeedbackToolbarProps`
99
+ - `StorageAdapter`
100
+
101
+ - [ ] **Add position prop**
102
+ - Allow toolbar to be positioned in any corner
103
+ - `position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'`
104
+
105
+ ### Low Priority
106
+
107
+ - [ ] **Add tests**
108
+ - Unit tests for element identification
109
+ - Integration tests for toolbar interactions
110
+
111
+ - [ ] **Add Storybook or similar**
112
+ - Document all components
113
+ - Show different configurations
114
+
115
+ - [ ] **Consider removing framer-motion dependency**
116
+ - Could use CSS animations for simpler cases
117
+ - Would reduce bundle size significantly
118
+
119
+ ---
120
+
121
+ ## File Structure
122
+
123
+ ```
124
+ src/
125
+ ├── index.ts # Main exports
126
+ ├── types.ts # Shared TypeScript types
127
+ ├── components/
128
+ │ ├── icons.tsx # SVG icons with morph animations
129
+ │ ├── annotation-popup/ # Popup for entering feedback
130
+ │ │ ├── index.tsx
131
+ │ │ └── styles.module.scss
132
+ │ └── page-toolbar/ # Main floating toolbar
133
+ │ ├── index.tsx
134
+ │ └── styles.module.scss
135
+ └── utils/
136
+ ├── element-identification.ts # Smart DOM element naming
137
+ └── storage.ts # localStorage helpers
138
+
139
+ example/ # Next.js example app for testing
140
+ ├── src/app/
141
+ │ ├── layout.tsx
142
+ │ ├── page.tsx
143
+ │ └── globals.scss
144
+ └── package.json
145
+ ```
146
+
147
+ ## How Element Identification Works
148
+
149
+ The tool intelligently names elements based on:
150
+
151
+ 1. **data-element attribute** - Explicit naming (highest priority)
152
+ 2. **Interactive elements** - Button text, link text, input placeholders
153
+ 3. **Headings** - Tag + text content
154
+ 4. **Text elements** - Truncated content
155
+ 5. **Containers** - Meaningful class names (CSS module hashes stripped)
156
+ 6. **SVG elements** - Parent context
157
+
158
+ Example output:
159
+ ```
160
+ button "Submit Form"
161
+ link "Learn more"
162
+ h2 "Getting Started"
163
+ paragraph: "This is the first..."
164
+ container (from class name)
165
+ ```
166
+
167
+ ## License
168
+
169
+ MIT