@feedlog-ai/vue 0.0.1 → 0.0.4

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 (2) hide show
  1. package/README.md +330 -0
  2. package/package.json +5 -2
package/README.md ADDED
@@ -0,0 +1,330 @@
1
+ # @feedlog-ai/vue
2
+
3
+ Vue bindings for Feedlog Toolkit web components. Auto-generated from Stencil components with full TypeScript support.
4
+
5
+ ## Features
6
+
7
+ - **Vue Components**: Native Vue components with template syntax support
8
+ - **TypeScript Support**: Full type safety with TypeScript definitions
9
+ - **Auto-generated**: Generated from Stencil web components for consistency
10
+ - **Vue 2 & 3 Support**: Compatible with Vue >=2.6.0 and >=3.0.0
11
+ - **Event Handling**: Vue-friendly event handling with proper typing
12
+ - **Tree Shakeable**: Only import the components you need
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @feedlog-ai/vue
18
+ ```
19
+
20
+ ## Components
21
+
22
+ ### FeedlogGithubIssuesClient
23
+
24
+ The main component for displaying GitHub issues with built-in SDK integration.
25
+
26
+ **Props:**
27
+
28
+ - `apiKey`: API key for Feedlog authentication (required)
29
+ - `type?`: Filter by issue type - `'bug'` or `'enhancement'`
30
+ - `limit?`: Maximum issues to fetch (1-100, default: 10)
31
+ - `endpoint?`: Custom API endpoint
32
+ - `maxWidth?`: Container max width (default: `'42rem'`)
33
+ - `theme?`: Theme variant - `'light'` or `'dark'` (default: `'light'`)
34
+ - `showThemeToggle?`: Show theme toggle button (default: `true`)
35
+
36
+ **Events:**
37
+
38
+ - `@feedlog-upvote`: Emitted when an issue is upvoted
39
+ - `@feedlog-theme-change`: Emitted when theme changes
40
+ - `@feedlog-error`: Emitted on errors
41
+
42
+ ## Usage
43
+
44
+ ### Vue 3 (Composition API)
45
+
46
+ ```vue
47
+ <template>
48
+ <div>
49
+ <FeedlogGithubIssuesClient
50
+ api-key="your-api-key"
51
+ type="bug"
52
+ :limit="10"
53
+ theme="light"
54
+ max-width="42rem"
55
+ @feedlog-upvote="handleUpvote"
56
+ @feedlog-theme-change="handleThemeChange"
57
+ @feedlog-error="handleError"
58
+ />
59
+ </div>
60
+ </template>
61
+
62
+ <script setup lang="ts">
63
+ import { FeedlogGithubIssuesClient } from '@feedlog-ai/vue';
64
+
65
+ const handleUpvote = (event: CustomEvent) => {
66
+ console.log('Issue upvoted:', event.detail);
67
+ // event.detail: { issueId, upvoted, upvoteCount }
68
+ };
69
+
70
+ const handleThemeChange = (event: CustomEvent<'light' | 'dark'>) => {
71
+ console.log('Theme changed to:', event.detail);
72
+ };
73
+
74
+ const handleError = (event: CustomEvent) => {
75
+ console.error('Error:', event.detail);
76
+ // event.detail: { error, code? }
77
+ };
78
+ </script>
79
+ ```
80
+
81
+ ### Vue 3 (Options API)
82
+
83
+ ```vue
84
+ <template>
85
+ <FeedlogGithubIssuesClient
86
+ api-key="your-api-key"
87
+ @feedlog-upvote="onUpvote"
88
+ @feedlog-error="onError"
89
+ />
90
+ </template>
91
+
92
+ <script lang="ts">
93
+ import { FeedlogGithubIssuesClient } from '@feedlog-ai/vue';
94
+
95
+ export default {
96
+ components: {
97
+ FeedlogGithubIssuesClient,
98
+ },
99
+ methods: {
100
+ onUpvote(event: CustomEvent) {
101
+ console.log('Issue upvoted:', event.detail);
102
+ },
103
+ onError(event: CustomEvent) {
104
+ console.error('Error:', event.detail);
105
+ },
106
+ },
107
+ };
108
+ </script>
109
+ ```
110
+
111
+ ### Vue 2
112
+
113
+ ```vue
114
+ <template>
115
+ <feedlog-github-issues-client api-key="your-api-key" @feedlog-upvote="handleUpvote" />
116
+ </template>
117
+
118
+ <script>
119
+ import { FeedlogGithubIssuesClient } from '@feedlog-ai/vue';
120
+
121
+ export default {
122
+ components: {
123
+ FeedlogGithubIssuesClient,
124
+ },
125
+ methods: {
126
+ handleUpvote(event) {
127
+ console.log('Issue upvoted:', event.detail);
128
+ },
129
+ },
130
+ };
131
+ </script>
132
+ ```
133
+
134
+ ### With Reactive Data
135
+
136
+ ```vue
137
+ <template>
138
+ <div>
139
+ <div class="controls">
140
+ <select v-model="issueType">
141
+ <option value="bug">Bugs</option>
142
+ <option value="enhancement">Enhancements</option>
143
+ </select>
144
+
145
+ <button @click="toggleTheme">
146
+ Switch to {{ theme === 'light' ? 'dark' : 'light' }} theme
147
+ </button>
148
+ </div>
149
+
150
+ <FeedlogGithubIssuesClient
151
+ api-key="your-api-key"
152
+ :type="issueType"
153
+ :theme="theme"
154
+ @feedlog-theme-change="updateTheme"
155
+ />
156
+ </div>
157
+ </template>
158
+
159
+ <script setup lang="ts">
160
+ import { ref } from 'vue';
161
+ import { FeedlogGithubIssuesClient } from '@feedlog-ai/vue';
162
+
163
+ const issueType = ref<'bug' | 'enhancement'>('bug');
164
+ const theme = ref<'light' | 'dark'>('light');
165
+
166
+ const toggleTheme = () => {
167
+ theme.value = theme.value === 'light' ? 'dark' : 'light';
168
+ };
169
+
170
+ const updateTheme = (event: CustomEvent<'light' | 'dark'>) => {
171
+ theme.value = event.detail;
172
+ };
173
+ </script>
174
+ ```
175
+
176
+ ### Event Handling
177
+
178
+ ```vue
179
+ <template>
180
+ <FeedlogGithubIssuesClient
181
+ api-key="your-api-key"
182
+ @feedlog-upvote="onUpvote"
183
+ @feedlog-error="onError"
184
+ />
185
+ </template>
186
+
187
+ <script setup lang="ts">
188
+ const onUpvote = (
189
+ event: CustomEvent<{
190
+ issueId: string;
191
+ upvoted: boolean;
192
+ upvoteCount: number;
193
+ }>
194
+ ) => {
195
+ // Fully typed event detail
196
+ const { issueId, upvoted, upvoteCount } = event.detail;
197
+
198
+ if (upvoted) {
199
+ console.log(`User upvoted issue ${issueId}`);
200
+ } else {
201
+ console.log(`User removed upvote from issue ${issueId}`);
202
+ }
203
+
204
+ console.log(`Issue now has ${upvoteCount} upvotes`);
205
+ };
206
+
207
+ const onError = (
208
+ event: CustomEvent<{
209
+ error: string;
210
+ code?: number;
211
+ }>
212
+ ) => {
213
+ const { error, code } = event.detail;
214
+ console.error(`Feedlog error (${code || 'unknown'}):`, error);
215
+
216
+ // Handle error in your UI (show toast, etc.)
217
+ };
218
+ </script>
219
+ ```
220
+
221
+ ### Other Components
222
+
223
+ The package also includes Vue bindings for additional UI components:
224
+
225
+ ```vue
226
+ <template>
227
+ <div>
228
+ <!-- Badge component -->
229
+ <FeedlogBadge variant="primary">New</FeedlogBadge>
230
+
231
+ <!-- Button component -->
232
+ <FeedlogButton variant="primary" size="lg" @feedlog-click="handleClick">
233
+ Click me
234
+ </FeedlogButton>
235
+
236
+ <!-- Card component -->
237
+ <FeedlogCard>
238
+ <h3>Card Title</h3>
239
+ <p>Card content</p>
240
+ </FeedlogCard>
241
+ </div>
242
+ </template>
243
+
244
+ <script setup lang="ts">
245
+ import { FeedlogBadge, FeedlogButton, FeedlogCard } from '@feedlog-ai/vue';
246
+
247
+ const handleClick = (event: CustomEvent<MouseEvent>) => {
248
+ console.log('Button clicked:', event.detail);
249
+ };
250
+ </script>
251
+ ```
252
+
253
+ ## Global Registration
254
+
255
+ You can register components globally in your Vue app:
256
+
257
+ ```ts
258
+ // main.ts
259
+ import { createApp } from 'vue';
260
+ import { FeedlogGithubIssuesClient, FeedlogBadge } from '@feedlog-ai/vue';
261
+
262
+ const app = createApp(App);
263
+
264
+ // Register specific components
265
+ app.component('FeedlogGithubIssuesClient', FeedlogGithubIssuesClient);
266
+ app.component('FeedlogBadge', FeedlogBadge);
267
+
268
+ // Or use the install function (currently minimal but extensible)
269
+ import { install } from '@feedlog-ai/vue';
270
+ app.use(install);
271
+ ```
272
+
273
+ ## TypeScript Support
274
+
275
+ All components are fully typed. Import types from the core package if needed:
276
+
277
+ ```vue
278
+ <script setup lang="ts">
279
+ import type { FeedlogIssue } from '@feedlog-ai/core';
280
+
281
+ const handleUpvote = (
282
+ event: CustomEvent<{
283
+ issueId: string;
284
+ upvoted: boolean;
285
+ upvoteCount: number;
286
+ }>
287
+ ) => {
288
+ // Fully typed event detail
289
+ console.log(event.detail.issueId);
290
+ console.log(event.detail.upvoted);
291
+ console.log(event.detail.upvoteCount);
292
+ };
293
+ </script>
294
+ ```
295
+
296
+ ## Requirements
297
+
298
+ - Vue >= 2.6.0 or >= 3.0.0
299
+ - Modern browsers with Web Components support
300
+
301
+ ## Browser Support
302
+
303
+ Same as the underlying web components:
304
+
305
+ - Chrome 61+
306
+ - Firefox 63+
307
+ - Safari 11+
308
+ - Edge 79+
309
+
310
+ ## Migration from Direct Web Components
311
+
312
+ If you're migrating from using web components directly:
313
+
314
+ ```vue
315
+ <!-- Before (direct web component) -->
316
+ <feedlog-github-issues-client api-key="key" @feedlog-upvote="handleUpvote" />
317
+
318
+ <!-- After (Vue component) -->
319
+ <FeedlogGithubIssuesClient api-key="key" @feedlog-upvote="handleUpvote" />
320
+ ```
321
+
322
+ **Key differences:**
323
+
324
+ - Use PascalCase component names in templates
325
+ - Event names remain the same (kebab-case)
326
+ - All props and events are properly typed
327
+
328
+ ## License
329
+
330
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedlog-ai/vue",
3
- "version": "0.0.1",
3
+ "version": "0.0.4",
4
4
  "description": "Vue bindings for Feedlog Toolkit Web Components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -47,5 +47,8 @@
47
47
  "components",
48
48
  "data-visualization"
49
49
  ],
50
- "license": "MIT"
50
+ "license": "MIT",
51
+ "publishConfig": {
52
+ "access": "public"
53
+ }
51
54
  }