@feedlog-ai/webcomponents 0.0.3 → 0.0.5
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 +246 -0
- package/dist/cjs/feedlog-badge_3.cjs.entry.js +1 -1
- package/dist/cjs/feedlog-github-issues-client.cjs.entry.js +18 -47
- package/dist/cjs/feedlog-github-issues.cjs.entry.js +1 -19
- package/dist/cjs/feedlog-toolkit.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/feedlog-badge/feedlog-badge.stories.js +1 -2
- package/dist/collection/components/feedlog-button/feedlog-button.stories.js +1 -2
- package/dist/collection/components/feedlog-card/feedlog-card.stories.js +1 -2
- package/dist/collection/components/feedlog-github-issues/feedlog-github-issues.js +38 -52
- package/dist/collection/components/feedlog-github-issues/feedlog-github-issues.stories.js +1 -2
- package/dist/collection/components/feedlog-github-issues-client/feedlog-github-issues-client.js +41 -74
- package/dist/collection/components/feedlog-issues-list/feedlog-issues-list.js +1 -1
- package/dist/components/feedlog-github-issues-client.js +1 -1
- package/dist/components/feedlog-github-issues.js +1 -1
- package/dist/components/feedlog-issues-list.js +1 -1
- package/dist/components/{p-DMcNh5Ys.js → p-BVUX_uVS.js} +1 -1
- package/dist/components/p-Dhl83qnK.js +1 -0
- package/dist/esm/feedlog-badge_3.entry.js +1 -1
- package/dist/esm/feedlog-github-issues-client.entry.js +18 -47
- package/dist/esm/feedlog-github-issues.entry.js +1 -19
- package/dist/esm/feedlog-toolkit.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/feedlog-toolkit/feedlog-toolkit.esm.js +1 -1
- package/dist/feedlog-toolkit/{p-2f7954f7.entry.js → p-125595a1.entry.js} +1 -1
- package/dist/feedlog-toolkit/p-352778fa.entry.js +1 -0
- package/dist/feedlog-toolkit/p-5fc3d243.entry.js +1 -0
- package/dist/types/components/feedlog-badge/feedlog-badge.stories.d.ts +2 -3
- package/dist/types/components/feedlog-button/feedlog-button.stories.d.ts +2 -3
- package/dist/types/components/feedlog-card/feedlog-card.stories.d.ts +2 -3
- package/dist/types/components/feedlog-github-issues/feedlog-github-issues.d.ts +8 -9
- package/dist/types/components/feedlog-github-issues/feedlog-github-issues.stories.d.ts +2 -3
- package/dist/types/components/feedlog-github-issues-client/feedlog-github-issues-client.d.ts +9 -12
- package/dist/types/components.d.ts +32 -30
- package/package.json +8 -5
- package/dist/components/p-CPOiBAxu.js +0 -1
- package/dist/feedlog-toolkit/p-399e0281.entry.js +0 -1
- package/dist/feedlog-toolkit/p-b3d26272.entry.js +0 -1
|
@@ -67,6 +67,10 @@ export namespace Components {
|
|
|
67
67
|
* @default false
|
|
68
68
|
*/
|
|
69
69
|
"hasMore": boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Custom heading for the issues section
|
|
72
|
+
*/
|
|
73
|
+
"heading"?: string;
|
|
70
74
|
/**
|
|
71
75
|
* Whether more issues are currently loading
|
|
72
76
|
* @default false
|
|
@@ -88,10 +92,9 @@ export namespace Components {
|
|
|
88
92
|
*/
|
|
89
93
|
"maxWidth": string;
|
|
90
94
|
/**
|
|
91
|
-
*
|
|
92
|
-
* @default true
|
|
95
|
+
* Custom subtitle for the issues section
|
|
93
96
|
*/
|
|
94
|
-
"
|
|
97
|
+
"subtitle"?: string;
|
|
95
98
|
/**
|
|
96
99
|
* Theme variant: 'light' or 'dark'
|
|
97
100
|
* @default 'light'
|
|
@@ -104,10 +107,18 @@ export namespace Components {
|
|
|
104
107
|
* This component uses the SDK internally to fetch data and delegates to feedlog-github-issues for rendering.
|
|
105
108
|
*/
|
|
106
109
|
interface FeedlogGithubIssuesClient {
|
|
110
|
+
/**
|
|
111
|
+
* API key for Feedlog authentication (required) The API key determines which repositories' issues are fetched
|
|
112
|
+
*/
|
|
113
|
+
"apiKey": string;
|
|
107
114
|
/**
|
|
108
115
|
* Custom API endpoint
|
|
109
116
|
*/
|
|
110
117
|
"endpoint"?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Custom heading for the issues section
|
|
120
|
+
*/
|
|
121
|
+
"heading"?: string;
|
|
111
122
|
/**
|
|
112
123
|
* Maximum number of issues to fetch (1-100, default 10)
|
|
113
124
|
*/
|
|
@@ -118,14 +129,9 @@ export namespace Components {
|
|
|
118
129
|
*/
|
|
119
130
|
"maxWidth": string;
|
|
120
131
|
/**
|
|
121
|
-
*
|
|
122
|
-
*/
|
|
123
|
-
"repos"?: string[] | string;
|
|
124
|
-
/**
|
|
125
|
-
* Whether to show the theme toggle button
|
|
126
|
-
* @default true
|
|
132
|
+
* Custom subtitle for the issues section
|
|
127
133
|
*/
|
|
128
|
-
"
|
|
134
|
+
"subtitle"?: string;
|
|
129
135
|
/**
|
|
130
136
|
* Theme variant: 'light' or 'dark'
|
|
131
137
|
* @default 'light'
|
|
@@ -217,7 +223,6 @@ declare global {
|
|
|
217
223
|
currentUpvoted: boolean;
|
|
218
224
|
currentCount: number;
|
|
219
225
|
};
|
|
220
|
-
"feedlogThemeChange": 'light' | 'dark';
|
|
221
226
|
"feedlogLoadMore": void;
|
|
222
227
|
}
|
|
223
228
|
/**
|
|
@@ -241,7 +246,6 @@ declare global {
|
|
|
241
246
|
};
|
|
242
247
|
interface HTMLFeedlogGithubIssuesClientElementEventMap {
|
|
243
248
|
"feedlogUpvote": { issueId: string; upvoted: boolean; upvoteCount: number };
|
|
244
|
-
"feedlogThemeChange": 'light' | 'dark';
|
|
245
249
|
"feedlogError": { error: string; code?: number };
|
|
246
250
|
}
|
|
247
251
|
/**
|
|
@@ -361,6 +365,10 @@ declare namespace LocalJSX {
|
|
|
361
365
|
* @default false
|
|
362
366
|
*/
|
|
363
367
|
"hasMore"?: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* Custom heading for the issues section
|
|
370
|
+
*/
|
|
371
|
+
"heading"?: string;
|
|
364
372
|
/**
|
|
365
373
|
* Whether more issues are currently loading
|
|
366
374
|
* @default false
|
|
@@ -385,10 +393,6 @@ declare namespace LocalJSX {
|
|
|
385
393
|
* Event emitted to load more issues
|
|
386
394
|
*/
|
|
387
395
|
"onFeedlogLoadMore"?: (event: FeedlogGithubIssuesCustomEvent<void>) => void;
|
|
388
|
-
/**
|
|
389
|
-
* Event emitted when theme changes
|
|
390
|
-
*/
|
|
391
|
-
"onFeedlogThemeChange"?: (event: FeedlogGithubIssuesCustomEvent<'light' | 'dark'>) => void;
|
|
392
396
|
/**
|
|
393
397
|
* Event emitted when an issue is upvoted
|
|
394
398
|
*/
|
|
@@ -398,10 +402,9 @@ declare namespace LocalJSX {
|
|
|
398
402
|
currentCount: number;
|
|
399
403
|
}>) => void;
|
|
400
404
|
/**
|
|
401
|
-
*
|
|
402
|
-
* @default true
|
|
405
|
+
* Custom subtitle for the issues section
|
|
403
406
|
*/
|
|
404
|
-
"
|
|
407
|
+
"subtitle"?: string;
|
|
405
408
|
/**
|
|
406
409
|
* Theme variant: 'light' or 'dark'
|
|
407
410
|
* @default 'light'
|
|
@@ -414,10 +417,18 @@ declare namespace LocalJSX {
|
|
|
414
417
|
* This component uses the SDK internally to fetch data and delegates to feedlog-github-issues for rendering.
|
|
415
418
|
*/
|
|
416
419
|
interface FeedlogGithubIssuesClient {
|
|
420
|
+
/**
|
|
421
|
+
* API key for Feedlog authentication (required) The API key determines which repositories' issues are fetched
|
|
422
|
+
*/
|
|
423
|
+
"apiKey": string;
|
|
417
424
|
/**
|
|
418
425
|
* Custom API endpoint
|
|
419
426
|
*/
|
|
420
427
|
"endpoint"?: string;
|
|
428
|
+
/**
|
|
429
|
+
* Custom heading for the issues section
|
|
430
|
+
*/
|
|
431
|
+
"heading"?: string;
|
|
421
432
|
/**
|
|
422
433
|
* Maximum number of issues to fetch (1-100, default 10)
|
|
423
434
|
*/
|
|
@@ -431,23 +442,14 @@ declare namespace LocalJSX {
|
|
|
431
442
|
* Event emitted on error
|
|
432
443
|
*/
|
|
433
444
|
"onFeedlogError"?: (event: FeedlogGithubIssuesClientCustomEvent<{ error: string; code?: number }>) => void;
|
|
434
|
-
/**
|
|
435
|
-
* Event emitted when theme changes
|
|
436
|
-
*/
|
|
437
|
-
"onFeedlogThemeChange"?: (event: FeedlogGithubIssuesClientCustomEvent<'light' | 'dark'>) => void;
|
|
438
445
|
/**
|
|
439
446
|
* Event emitted when an issue is upvoted
|
|
440
447
|
*/
|
|
441
448
|
"onFeedlogUpvote"?: (event: FeedlogGithubIssuesClientCustomEvent<{ issueId: string; upvoted: boolean; upvoteCount: number }>) => void;
|
|
442
449
|
/**
|
|
443
|
-
*
|
|
444
|
-
*/
|
|
445
|
-
"repos"?: string[] | string;
|
|
446
|
-
/**
|
|
447
|
-
* Whether to show the theme toggle button
|
|
448
|
-
* @default true
|
|
450
|
+
* Custom subtitle for the issues section
|
|
449
451
|
*/
|
|
450
|
-
"
|
|
452
|
+
"subtitle"?: string;
|
|
451
453
|
/**
|
|
452
454
|
* Theme variant: 'light' or 'dark'
|
|
453
455
|
* @default 'light'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feedlog-ai/webcomponents",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Stencil web components for Feedlog Toolkit - Data visualization components",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"clean": "rm -rf dist loader"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@feedlog-ai/core": "
|
|
27
|
+
"@feedlog-ai/core": "workspace:*"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@stencil/core": "^4.0.0",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@stencil/vue-output-target": "^0.8.0",
|
|
34
34
|
"@types/node": "^20.11.24",
|
|
35
35
|
"rollup": "^4.0.0",
|
|
36
|
-
"storybook": "^9.
|
|
36
|
+
"storybook": "^9.0.5",
|
|
37
37
|
"typescript": "^5.3.3",
|
|
38
|
-
"vite": "^
|
|
38
|
+
"vite": "^6.0.0",
|
|
39
39
|
"wsl-utils": "^0.1.0"
|
|
40
40
|
},
|
|
41
41
|
"license": "MIT",
|
|
@@ -44,5 +44,8 @@
|
|
|
44
44
|
"webcomponents",
|
|
45
45
|
"stencil",
|
|
46
46
|
"data-visualization"
|
|
47
|
-
]
|
|
47
|
+
],
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
}
|
|
48
51
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e,p as s,H as t,c as o,h as i,a}from"./index.js";import{d}from"./p-CHtSMTyP.js";import{d as r}from"./p-DMdb-G26.js";import{d as l}from"./p-DMcNh5Ys.js";const n=()=>i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"M12 2v2"}),i("path",{d:"M12 20v2"}),i("path",{d:"m4.93 4.93 1.41 1.41"}),i("path",{d:"m17.66 17.66 1.41 1.41"}),i("path",{d:"M2 12h2"}),i("path",{d:"M20 12h2"}),i("path",{d:"m6.34 17.66-1.41 1.41"}),i("path",{d:"m19.07 4.93-1.41 1.41"})),c=()=>i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},i("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})),h=s(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.feedlogUpvote=o(this,"feedlogUpvote"),this.feedlogThemeChange=o(this,"feedlogThemeChange"),this.feedlogLoadMore=o(this,"feedlogLoadMore"),this.issues=[],this.maxWidth="42rem",this.theme="light",this.loading=!1,this.error=null,this.showThemeToggle=!0,this.hasMore=!1,this.isLoadingMore=!1,this.currentTheme="light",this.handleUpvote=e=>{this.feedlogUpvote.emit(e.detail)},this.toggleTheme=()=>{this.currentTheme="dark"===this.currentTheme?"light":"dark",this.theme=this.currentTheme,this.feedlogThemeChange.emit(this.currentTheme)},this.handleLoadMore=()=>{this.feedlogLoadMore.emit()}}componentWillLoad(){this.currentTheme=this.theme}render(){return i(a,{key:"8f238ab41f45799062270c84188596d770d6bde0",class:"dark"===this.currentTheme?"dark":""},i("div",{key:"af0c2155ef3cdc12f228ec804ee906afd7d75477",class:"github-issues-container",style:{maxWidth:this.maxWidth}},i("header",{key:"ccf9a063df220f7a48e3600cb22df8203960a45b",class:"issues-header"},i("div",{key:"c261d6b0c8168a66faef9ec2fb381619f5175070",class:"header-content"},i("h1",{key:"19203aa63dab0648b0a2865fe812233bfbbc225a",class:"issues-title"},"GitHub Issues"),i("p",{key:"e717a4e64cc747c81ad7a9e1cec234c247bfc329",class:"issues-subtitle"},"Track bugs and enhancements for your project")),this.showThemeToggle&&i("feedlog-button",{key:"21057c7d384c53262e699e0384234077b0b36314",variant:"outline",size:"sm",onFeedlogClick:this.toggleTheme},i("dark"===this.currentTheme?n:c,null))),this.loading&&i("div",{key:"2059c491247e0a48a81d802d9757d9fa97ac1a72",class:"loading-state"},i("p",{key:"5654904e73b05bd5a05aa0243506e4bf074e5486"},"Loading issues...")),this.error&&i("div",{key:"7d2e09e0055e5d834aa870ed47bd4ebaba64dff1",class:"error-state"},i("p",{key:"d4cc2bb872c81234b4e81a4ec4ce21aff368ad74"},"Error: ",this.error)),!this.loading&&!this.error&&i("div",{key:"e25eb90f7098416837a26a44e5811888530220a4"},i("feedlog-issues-list",{key:"a8e7ec5c5861cb31456738107b93f6e7adebbbe9",issues:this.issues,theme:this.currentTheme,onFeedlogUpvote:this.handleUpvote}),this.hasMore&&i("div",{key:"0d935e9247f44bff0700fce487d0bc4ccd104f2a",class:"load-more-container"},i("feedlog-button",{key:"2858d701f5e3d219c39a6a28a7475c619464bc72",onFeedlogClick:this.handleLoadMore,disabled:this.isLoadingMore,variant:"outline"},this.isLoadingMore?"Loading...":"Load More Issues")))))}static get style(){return":host{display:block;font-family:ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;--feedlog-background:#ffffff;--feedlog-foreground:oklch(0.145 0 0);--feedlog-muted-foreground:#717182;--feedlog-destructive:#d4183d;--feedlog-padding:2rem}:host(.dark){--feedlog-background:oklch(0.145 0 0);--feedlog-foreground:oklch(0.985 0 0);--feedlog-muted-foreground:oklch(0.708 0 0);--feedlog-destructive:oklch(0.637 0.237 25.331)}.github-issues-container{min-height:100vh;background-color:var(--feedlog-background);padding:var(--feedlog-padding);margin:0 auto}.issues-header{margin-bottom:1.5rem;display:flex;align-items:flex-start;justify-content:space-between}.header-content{flex:1}.issues-title{color:var(--feedlog-foreground);margin:0 0 0.25rem 0;font-size:1.5rem;font-weight:500;line-height:1.5}.issues-subtitle{color:var(--feedlog-muted-foreground);font-size:0.875rem;margin:0}.loading-state,.error-state{padding:2rem;text-align:center;color:var(--feedlog-muted-foreground)}.error-state{color:var(--feedlog-destructive)}.load-more-container{display:flex;justify-content:center;padding:2rem 0;gap:1rem}"}},[1,"feedlog-github-issues",{issues:[16],maxWidth:[1,"max-width"],theme:[1025],loading:[4],error:[1],showThemeToggle:[4,"show-theme-toggle"],hasMore:[4,"has-more"],isLoadingMore:[4,"is-loading-more"],currentTheme:[32]}]);function f(){"undefined"!=typeof customElements&&["feedlog-github-issues","feedlog-badge","feedlog-button","feedlog-issues-list"].forEach((s=>{switch(s){case"feedlog-github-issues":customElements.get(e(s))||customElements.define(e(s),h);break;case"feedlog-badge":customElements.get(e(s))||d();break;case"feedlog-button":customElements.get(e(s))||r();break;case"feedlog-issues-list":customElements.get(e(s))||l()}}))}f();export{h as F,f as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as s}from"./p-CkB6Yzeb.js";function i(t){if("string"!=typeof t)return"";let e=t.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");return e=e.replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi,""),e=e.replace(/\s*on\w+\s*=\s*[^\s>]*/gi,""),e=e.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,""),e=e.replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,""),e=e.replace(/<(embed|object)\b[^<]*>/gi,""),e=e.replace(/javascript:/gi,""),e=e.replace(/data:(?!image\/(?:png|jpg|jpeg|gif|webp);)/gi,""),e}class o extends Error{constructor(t,e,s){super(t),this.statusCode=e,this.originalError=s,this.name="FeedlogError",Object.setPrototypeOf(this,o.prototype)}}class r extends o{constructor(t){super(t),this.name="FeedlogValidationError",Object.setPrototypeOf(this,r.prototype)}}class n extends o{constructor(t,e,s){super(t,e,s),this.name="FeedlogNetworkError",Object.setPrototypeOf(this,n.prototype)}}class h extends o{constructor(t="Request timed out"){super(t),this.name="FeedlogTimeoutError",Object.setPrototypeOf(this,h.prototype)}}class a{constructor(t={}){this.config={credentials:"include",...t},this.endpoint=this.config.endpoint||"https://api.feedlog.app",this.timeout=this.config.timeout||3e4,this.endpoint=this.endpoint.replace(/\/$/,"")}async fetchIssues(t={}){try{const e=this.buildIssuesUrl(t),s=await this.fetchWithTimeout(e,{method:"GET",headers:this.getAuthHeaders(),credentials:this.config.credentials||"include"});if(!s.ok)throw new n(`Failed to fetch issues: ${s.statusText}`,s.status);const i=await s.json();return this.validateIssuesResponse(i)}catch(t){if(t instanceof o)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new n("Network error: Unable to reach API",void 0,t);throw new o(`Failed to fetch issues: ${t instanceof Error?t.message:"Unknown error"}`,void 0,t)}}async toggleUpvote(t){if(!t||"string"!=typeof t)throw new r("Issue ID is required");try{const e=`${this.endpoint}/api/issues/${encodeURIComponent(t)}/upvote`,s=await this.fetchWithTimeout(e,{method:"POST",headers:this.getAuthHeaders(),credentials:this.config.credentials||"include"});if(404===s.status)throw new n("Issue not found",404);if(401===s.status)throw new n("Unauthorized",401);if(403===s.status)throw new n("Forbidden: Domain not allowed for this repository",403);if(!s.ok)throw new n(`Failed to toggle upvote: ${s.statusText}`,s.status);const i=await s.json();return this.validateUpvoteResponse(i)}catch(t){if(t instanceof o)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new n("Network error: Unable to reach API",void 0,t);throw new o(`Failed to toggle upvote: ${t instanceof Error?t.message:"Unknown error"}`,void 0,t)}}buildIssuesUrl(t){const e=new URL(`${this.endpoint}/api/issues`);if(t.repositoryIds){const s=Array.isArray(t.repositoryIds)?t.repositoryIds:[t.repositoryIds];for(const t of s)e.searchParams.append("repositoryIds",t)}return t.type&&e.searchParams.set("type",t.type),t.cursor&&e.searchParams.set("cursor",t.cursor),void 0!==t.limit&&e.searchParams.set("limit",t.limit.toString()),e.toString()}getAuthHeaders(){return{"Content-Type":"application/json"}}async fetchWithTimeout(t,e){const s=new AbortController,i=setTimeout((()=>s.abort()),this.timeout);try{const o=await fetch(t,{...e,signal:s.signal});return clearTimeout(i),o}catch(t){if(clearTimeout(i),t instanceof Error&&"AbortError"===t.name)throw new h(`Request timed out after ${this.timeout}ms`);throw t}}validateIssuesResponse(t){if(!t||"object"!=typeof t)throw new r("Invalid API response: expected object");const e=t;if(!Array.isArray(e.issues))throw new r("Invalid API response: issues must be an array");if(!e.pagination||"object"!=typeof e.pagination)throw new r("Invalid API response: pagination is required");return{issues:e.issues.map((t=>this.validateIssue(t))),pagination:{cursor:e.pagination.cursor,hasMore:Boolean(e.pagination.hasMore)}}}validateIssue(t){if(!t||"object"!=typeof t)throw new r("Invalid issue: expected object");const e=t;if("string"!=typeof e.id)throw new r("Invalid issue: id is required and must be a string");if("string"!=typeof e.title)throw new r("Invalid issue: title is required and must be a string");if(!["bug","enhancement"].includes(String(e.type)))throw new r('Invalid issue: type must be "bug" or "enhancement"');if(!["open","closed"].includes(String(e.status)))throw new r('Invalid issue: status must be "open" or "closed"');if(!e.repository||"object"!=typeof e.repository)throw new r("Invalid issue: repository is required");const s=e.repository;if("string"!=typeof s.id||"string"!=typeof s.name||"string"!=typeof s.owner)throw new r("Invalid issue: repository must have id, name, and owner");const o=i(String(e.title)),n=i(String(e.body||""));return{id:String(e.id),type:e.type||"bug",status:e.status||"open",pinnedAt:e.pinnedAt?String(e.pinnedAt):null,revision:Number(e.revision)||1,title:o,body:n,repository:{id:String(s.id),name:String(s.name),owner:String(s.owner)},updatedAt:String(e.updatedAt)||(new Date).toISOString(),createdAt:String(e.createdAt)||(new Date).toISOString(),upvoteCount:Number(e.upvoteCount)||0,hasUpvoted:Boolean(e.hasUpvoted)}}validateUpvoteResponse(t){if(!t||"object"!=typeof t)throw new r("Invalid upvote response: expected object");const e=t;if("boolean"!=typeof e.upvoted)throw new r("Invalid upvote response: upvoted must be a boolean");if("number"!=typeof e.upvoteCount)throw new r("Invalid upvote response: upvoteCount must be a number");if("string"!=typeof e.anonymousUserId)throw new r("Invalid upvote response: anonymousUserId must be a string");return{upvoted:e.upvoted,upvoteCount:e.upvoteCount,anonymousUserId:e.anonymousUserId}}getEndpoint(){return this.endpoint}getTimeout(){return this.timeout}}const c=class{constructor(s){t(this,s),this.feedlogUpvote=e(this,"feedlogUpvote"),this.feedlogThemeChange=e(this,"feedlogThemeChange"),this.feedlogError=e(this,"feedlogError"),this.maxWidth="42rem",this.theme="light",this.showThemeToggle=!0,this.issues=[],this.loading=!0,this.error=null,this.cursor=null,this.hasMore=!1,this.isLoadingMore=!1,this.sdk=null,this.handleUpvote=async t=>{if(!this.sdk)return;const{issueId:e,currentUpvoted:s,currentCount:i}=t.detail;this.issues=this.issues.map((t=>t.id===e?Object.assign(Object.assign({},t),{hasUpvoted:!s,upvoteCount:s?i-1:i+1}):t));try{const t=await this.sdk.toggleUpvote(e);this.issues=this.issues.map((s=>s.id===e?Object.assign(Object.assign({},s),{hasUpvoted:t.upvoted,upvoteCount:t.upvoteCount}):s)),this.feedlogUpvote.emit({issueId:e,upvoted:t.upvoted,upvoteCount:t.upvoteCount})}catch(t){this.issues=this.issues.map((t=>t.id===e?Object.assign(Object.assign({},t),{hasUpvoted:s,upvoteCount:i}):t));const o=t instanceof Error?t.message:"Failed to toggle upvote";this.feedlogError.emit({error:o})}},this.handleThemeChange=t=>{this.theme=t.detail,this.feedlogThemeChange.emit(t.detail)}}componentWillLoad(){this.previousRepos=this.repos,this.previousType=this.type,this.previousLimit=this.limit,this.initializeSDK(),this.fetchIssues()}componentDidUpdate(){(JSON.stringify(this.previousRepos)!==JSON.stringify(this.repos)||this.previousType!==this.type||this.previousLimit!==this.limit)&&(this.cursor=null,this.hasMore=!1,this.issues=[],this.fetchIssues(),this.previousRepos=this.repos,this.previousType=this.type,this.previousLimit=this.limit)}initializeSDK(){try{this.sdk=new a(Object.assign({},this.endpoint&&{endpoint:this.endpoint})),this.error=null}catch(t){const e=t instanceof Error?t.message:"Failed to initialize SDK";this.error=e,this.feedlogError.emit({error:e})}}parseRepos(){if(!this.repos)return[];if("string"==typeof this.repos)try{const t=JSON.parse(this.repos);return Array.isArray(t)?t:[this.repos]}catch(t){return[this.repos]}return Array.isArray(this.repos)?this.repos:[]}async fetchIssues(){if(!this.sdk)return;const t=this.parseRepos();if(0===t.length)return this.error="At least one repository is required",this.loading=!1,void this.feedlogError.emit({error:"At least one repository is required"});try{this.loading=!0,this.error=null;const e={repositoryIds:t};this.type&&(e.type=this.type),this.limit&&(e.limit=this.limit),this.cursor&&(e.cursor=this.cursor);const s=await this.sdk.fetchIssues(e);this.issues=s.issues,this.cursor=s.pagination.cursor,this.hasMore=s.pagination.hasMore}catch(t){const e=t instanceof Error?t.message:"Failed to fetch issues";this.error=e,this.issues=[],this.feedlogError.emit({error:e,code:null==t?void 0:t.statusCode})}finally{this.loading=!1,this.isLoadingMore=!1}}async loadMore(){if(this.sdk&&this.hasMore&&!this.isLoadingMore&&!this.loading){this.isLoadingMore=!0;try{const t={repositoryIds:this.parseRepos()};this.type&&(t.type=this.type),this.limit&&(t.limit=this.limit),this.cursor&&(t.cursor=this.cursor);const e=await this.sdk.fetchIssues(t);this.issues=[...this.issues,...e.issues],this.cursor=e.pagination.cursor,this.hasMore=e.pagination.hasMore}catch(t){const e=t instanceof Error?t.message:"Failed to load more issues";this.feedlogError.emit({error:e,code:null==t?void 0:t.statusCode})}finally{this.isLoadingMore=!1}}}render(){return s("feedlog-github-issues",{key:"38b9e7ec8a5473acbab39df1d0476fcb357866bf",issues:this.issues,maxWidth:this.maxWidth,theme:this.theme,showThemeToggle:this.showThemeToggle,loading:this.loading,error:this.error,hasMore:this.hasMore,isLoadingMore:this.isLoadingMore,onFeedlogUpvote:this.handleUpvote,onFeedlogThemeChange:this.handleThemeChange,onFeedlogLoadMore:async()=>this.loadMore()})}};export{c as feedlog_github_issues_client}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,h as s,H as o}from"./p-CkB6Yzeb.js";const i=()=>s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("circle",{cx:"12",cy:"12",r:"4"}),s("path",{d:"M12 2v2"}),s("path",{d:"M12 20v2"}),s("path",{d:"m4.93 4.93 1.41 1.41"}),s("path",{d:"m17.66 17.66 1.41 1.41"}),s("path",{d:"M2 12h2"}),s("path",{d:"M20 12h2"}),s("path",{d:"m6.34 17.66-1.41 1.41"}),s("path",{d:"m19.07 4.93-1.41 1.41"})),a=()=>s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})),d=class{constructor(s){e(this,s),this.feedlogUpvote=t(this,"feedlogUpvote"),this.feedlogThemeChange=t(this,"feedlogThemeChange"),this.feedlogLoadMore=t(this,"feedlogLoadMore"),this.issues=[],this.maxWidth="42rem",this.theme="light",this.loading=!1,this.error=null,this.showThemeToggle=!0,this.hasMore=!1,this.isLoadingMore=!1,this.currentTheme="light",this.handleUpvote=e=>{this.feedlogUpvote.emit(e.detail)},this.toggleTheme=()=>{this.currentTheme="dark"===this.currentTheme?"light":"dark",this.theme=this.currentTheme,this.feedlogThemeChange.emit(this.currentTheme)},this.handleLoadMore=()=>{this.feedlogLoadMore.emit()}}componentWillLoad(){this.currentTheme=this.theme}render(){return s(o,{key:"8f238ab41f45799062270c84188596d770d6bde0",class:"dark"===this.currentTheme?"dark":""},s("div",{key:"af0c2155ef3cdc12f228ec804ee906afd7d75477",class:"github-issues-container",style:{maxWidth:this.maxWidth}},s("header",{key:"ccf9a063df220f7a48e3600cb22df8203960a45b",class:"issues-header"},s("div",{key:"c261d6b0c8168a66faef9ec2fb381619f5175070",class:"header-content"},s("h1",{key:"19203aa63dab0648b0a2865fe812233bfbbc225a",class:"issues-title"},"GitHub Issues"),s("p",{key:"e717a4e64cc747c81ad7a9e1cec234c247bfc329",class:"issues-subtitle"},"Track bugs and enhancements for your project")),this.showThemeToggle&&s("feedlog-button",{key:"21057c7d384c53262e699e0384234077b0b36314",variant:"outline",size:"sm",onFeedlogClick:this.toggleTheme},s("dark"===this.currentTheme?i:a,null))),this.loading&&s("div",{key:"2059c491247e0a48a81d802d9757d9fa97ac1a72",class:"loading-state"},s("p",{key:"5654904e73b05bd5a05aa0243506e4bf074e5486"},"Loading issues...")),this.error&&s("div",{key:"7d2e09e0055e5d834aa870ed47bd4ebaba64dff1",class:"error-state"},s("p",{key:"d4cc2bb872c81234b4e81a4ec4ce21aff368ad74"},"Error: ",this.error)),!this.loading&&!this.error&&s("div",{key:"e25eb90f7098416837a26a44e5811888530220a4"},s("feedlog-issues-list",{key:"a8e7ec5c5861cb31456738107b93f6e7adebbbe9",issues:this.issues,theme:this.currentTheme,onFeedlogUpvote:this.handleUpvote}),this.hasMore&&s("div",{key:"0d935e9247f44bff0700fce487d0bc4ccd104f2a",class:"load-more-container"},s("feedlog-button",{key:"2858d701f5e3d219c39a6a28a7475c619464bc72",onFeedlogClick:this.handleLoadMore,disabled:this.isLoadingMore,variant:"outline"},this.isLoadingMore?"Loading...":"Load More Issues")))))}};d.style=":host{display:block;font-family:ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;--feedlog-background:#ffffff;--feedlog-foreground:oklch(0.145 0 0);--feedlog-muted-foreground:#717182;--feedlog-destructive:#d4183d;--feedlog-padding:2rem}:host(.dark){--feedlog-background:oklch(0.145 0 0);--feedlog-foreground:oklch(0.985 0 0);--feedlog-muted-foreground:oklch(0.708 0 0);--feedlog-destructive:oklch(0.637 0.237 25.331)}.github-issues-container{min-height:100vh;background-color:var(--feedlog-background);padding:var(--feedlog-padding);margin:0 auto}.issues-header{margin-bottom:1.5rem;display:flex;align-items:flex-start;justify-content:space-between}.header-content{flex:1}.issues-title{color:var(--feedlog-foreground);margin:0 0 0.25rem 0;font-size:1.5rem;font-weight:500;line-height:1.5}.issues-subtitle{color:var(--feedlog-muted-foreground);font-size:0.875rem;margin:0}.loading-state,.error-state{padding:2rem;text-align:center;color:var(--feedlog-muted-foreground)}.error-state{color:var(--feedlog-destructive)}.load-more-container{display:flex;justify-content:center;padding:2rem 0;gap:1rem}";export{d as feedlog_github_issues}
|