@feedlog-ai/webcomponents 0.0.22 → 0.0.24

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 (47) hide show
  1. package/README.md +12 -12
  2. package/dist/cjs/{feedlog-button_2.cjs.entry.js → feedlog-button_3.cjs.entry.js} +32 -0
  3. package/dist/cjs/{feedlog-github-issues-client.cjs.entry.js → feedlog-issues-client.cjs.entry.js} +3 -3
  4. package/dist/cjs/feedlog-issues.cjs.entry.js +71 -0
  5. package/dist/cjs/feedlog-toolkit.cjs.js +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/collection-manifest.json +2 -2
  8. package/dist/collection/components/{feedlog-github-issues/feedlog-github-issues.css → feedlog-issues/feedlog-issues.css} +6 -53
  9. package/dist/collection/components/{feedlog-github-issues/feedlog-github-issues.js → feedlog-issues/feedlog-issues.js} +9 -15
  10. package/dist/collection/components/{feedlog-github-issues/feedlog-github-issues.stories.js → feedlog-issues/feedlog-issues.stories.js} +17 -17
  11. package/dist/collection/components/{feedlog-github-issues-client/feedlog-github-issues-client.js → feedlog-issues-client/feedlog-issues-client.js} +7 -7
  12. package/dist/collection/components/feedlog-issues-list/feedlog-issues-list.css +36 -0
  13. package/dist/collection/components/feedlog-issues-list/feedlog-issues-list.js +42 -1
  14. package/dist/collection/components/index.js +2 -2
  15. package/dist/components/{feedlog-github-issues.d.ts → feedlog-issues-client.d.ts} +4 -4
  16. package/dist/components/feedlog-issues-client.js +1 -0
  17. package/dist/components/feedlog-issues-list.js +1 -1
  18. package/dist/components/feedlog-issues.d.ts +11 -0
  19. package/dist/components/feedlog-issues.js +1 -0
  20. package/dist/components/p-BR3ookRG.js +1 -0
  21. package/dist/components/p-DKGIKLzX.js +1 -0
  22. package/dist/esm/{feedlog-button_2.entry.js → feedlog-button_3.entry.js} +32 -1
  23. package/dist/esm/{feedlog-github-issues-client.entry.js → feedlog-issues-client.entry.js} +3 -3
  24. package/dist/esm/feedlog-issues.entry.js +69 -0
  25. package/dist/esm/feedlog-toolkit.js +1 -1
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/feedlog-toolkit/feedlog-toolkit.esm.js +1 -1
  28. package/dist/feedlog-toolkit/p-2fbb5aad.entry.js +1 -0
  29. package/dist/feedlog-toolkit/{p-9b515728.entry.js → p-6737a3f4.entry.js} +1 -1
  30. package/dist/feedlog-toolkit/{p-dad7b157.entry.js → p-f8e5e975.entry.js} +2 -2
  31. package/dist/types/components/{feedlog-github-issues/feedlog-github-issues.d.ts → feedlog-issues/feedlog-issues.d.ts} +4 -5
  32. package/dist/types/components/{feedlog-github-issues-client/feedlog-github-issues-client.d.ts → feedlog-issues-client/feedlog-issues-client.d.ts} +5 -5
  33. package/dist/types/components/feedlog-issues-list/feedlog-issues-list.d.ts +9 -0
  34. package/dist/types/components/index.d.ts +2 -2
  35. package/dist/types/components.d.ts +140 -124
  36. package/package.json +2 -2
  37. package/dist/cjs/feedlog-github-issues.cjs.entry.js +0 -77
  38. package/dist/cjs/feedlog-issues-list.cjs.entry.js +0 -33
  39. package/dist/components/feedlog-github-issues-client.d.ts +0 -11
  40. package/dist/components/feedlog-github-issues-client.js +0 -1
  41. package/dist/components/feedlog-github-issues.js +0 -1
  42. package/dist/components/p-cag4iyHV.js +0 -1
  43. package/dist/esm/feedlog-github-issues.entry.js +0 -75
  44. package/dist/esm/feedlog-issues-list.entry.js +0 -31
  45. package/dist/feedlog-toolkit/p-13773ed6.entry.js +0 -1
  46. package/dist/feedlog-toolkit/p-e5ba7dd7.entry.js +0 -1
  47. /package/dist/types/components/{feedlog-github-issues/feedlog-github-issues.stories.d.ts → feedlog-issues/feedlog-issues.stories.d.ts} +0 -0
@@ -1,10 +1,18 @@
1
1
  :host {
2
2
  display: block;
3
3
  --feedlog-muted-foreground: #64748b;
4
+ --feedlog-foreground: oklch(0.145 0 0);
5
+ --feedlog-empty-illustration-bg: oklch(0.96 0.01 260);
6
+ --feedlog-empty-illustration-stroke: oklch(0.75 0.02 260);
7
+ --feedlog-empty-illustration-muted: oklch(0.82 0.01 260);
4
8
  }
5
9
 
6
10
  :host(.dark) {
7
11
  --feedlog-muted-foreground: oklch(0.72 0.02 260);
12
+ --feedlog-foreground: oklch(0.985 0 0);
13
+ --feedlog-empty-illustration-bg: oklch(0.28 0.02 260);
14
+ --feedlog-empty-illustration-stroke: oklch(0.45 0.02 260);
15
+ --feedlog-empty-illustration-muted: oklch(0.38 0.01 260);
8
16
  }
9
17
 
10
18
  .issues-list {
@@ -19,3 +27,31 @@
19
27
  color: var(--feedlog-muted-foreground);
20
28
  font-size: 0.875rem;
21
29
  }
30
+
31
+ .empty-state-content {
32
+ display: flex;
33
+ flex-direction: column;
34
+ align-items: center;
35
+ text-align: center;
36
+ max-width: 20rem;
37
+ }
38
+
39
+ .empty-state-illustration {
40
+ margin-bottom: 1.5rem;
41
+ opacity: 0.9;
42
+ }
43
+
44
+ .empty-state-title {
45
+ margin: 0 0 0.5rem 0;
46
+ font-size: 1.125rem;
47
+ font-weight: 600;
48
+ color: var(--feedlog-foreground);
49
+ line-height: 1.4;
50
+ }
51
+
52
+ .empty-state-message {
53
+ margin: 0;
54
+ font-size: 0.875rem;
55
+ color: var(--feedlog-muted-foreground);
56
+ line-height: 1.5;
57
+ }
@@ -19,8 +19,11 @@ export class FeedlogIssuesList {
19
19
  this.feedlogUpvote.emit(event.detail);
20
20
  };
21
21
  }
22
+ renderEmptyStateIllustration() {
23
+ return (h("svg", { class: "empty-state-illustration", xmlns: "http://www.w3.org/2000/svg", width: "120", height: "96", viewBox: "0 0 120 96", fill: "none", "aria-hidden": "true" }, h("path", { d: "M20 36h80v44c0 4.4-3.6 8-8 8H28c-4.4 0-8-3.6-8-8V36z", fill: "var(--feedlog-empty-illustration-bg)", stroke: "var(--feedlog-empty-illustration-stroke)", "stroke-width": "1.5", "stroke-linejoin": "round" }), h("path", { d: "M20 36l20-24h40l20 24", fill: "none", stroke: "var(--feedlog-empty-illustration-stroke)", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), h("path", { d: "M44 52h32M44 60h24M44 68h28", stroke: "var(--feedlog-empty-illustration-muted)", "stroke-width": "1.25", "stroke-linecap": "round" })));
24
+ }
22
25
  render() {
23
- return (h(Host, { key: '005de8cf99383128f6973be57d84499c8ca9afd3', class: this.theme === 'dark' ? 'dark' : '' }, h("div", { key: '60edc37014f6703b9400dc8bf06726c9a8428a3b', class: "issues-list" }, this.issues.length === 0 ? (h("div", { class: "empty-state" }, h("p", null, "No issues found"))) : (this.issues.map(issue => {
26
+ return (h(Host, { key: 'd797fd4978179c9081678e2fb3e7e2be756b4ea2', class: this.theme === 'dark' ? 'dark' : '' }, h("div", { key: '1fe373bbad55cf718d65279ae718f9b95e89e37f', class: "issues-list" }, this.issues.length === 0 ? (h("div", { class: "empty-state" }, this.emptyStateTitle && this.emptyStateMessage ? (h("div", { class: "empty-state-content" }, this.renderEmptyStateIllustration(), h("h2", { class: "empty-state-title" }, this.emptyStateTitle), h("p", { class: "empty-state-message" }, this.emptyStateMessage))) : (h("p", null, "No issues found")))) : (this.issues.map(issue => {
24
27
  var _a, _b;
25
28
  return (h("feedlog-issue", { key: issue.id, issue: issue, issueUrl: (_b = (_a = this.getIssueUrl) === null || _a === void 0 ? void 0 : _a.call(this, issue)) !== null && _b !== void 0 ? _b : undefined, theme: this.theme, onFeedlogUpvote: (e) => this.handleUpvote(e) }));
26
29
  })))));
@@ -105,6 +108,44 @@ export class FeedlogIssuesList {
105
108
  },
106
109
  "getter": false,
107
110
  "setter": false
111
+ },
112
+ "emptyStateTitle": {
113
+ "type": "string",
114
+ "mutable": false,
115
+ "complexType": {
116
+ "original": "string",
117
+ "resolved": "string | undefined",
118
+ "references": {}
119
+ },
120
+ "required": false,
121
+ "optional": true,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": "Empty state title. When provided with emptyStateMessage, shows a richer empty state with illustration."
125
+ },
126
+ "getter": false,
127
+ "setter": false,
128
+ "reflect": false,
129
+ "attribute": "empty-state-title"
130
+ },
131
+ "emptyStateMessage": {
132
+ "type": "string",
133
+ "mutable": false,
134
+ "complexType": {
135
+ "original": "string",
136
+ "resolved": "string | undefined",
137
+ "references": {}
138
+ },
139
+ "required": false,
140
+ "optional": true,
141
+ "docs": {
142
+ "tags": [],
143
+ "text": "Empty state message. When provided with emptyStateTitle, shows a richer empty state with illustration."
144
+ },
145
+ "getter": false,
146
+ "setter": false,
147
+ "reflect": false,
148
+ "attribute": "empty-state-message"
108
149
  }
109
150
  };
110
151
  }
@@ -1,7 +1,7 @@
1
1
  export * from './feedlog-card/feedlog-card';
2
2
  export * from './feedlog-badge/feedlog-badge';
3
3
  export * from './feedlog-button/feedlog-button';
4
- export * from './feedlog-github-issues/feedlog-github-issues';
5
- export * from './feedlog-github-issues-client/feedlog-github-issues-client';
4
+ export * from './feedlog-issues/feedlog-issues';
5
+ export * from './feedlog-issues-client/feedlog-issues-client';
6
6
  export * from './feedlog-issue/feedlog-issue';
7
7
  export * from './feedlog-issues-list/feedlog-issues-list';
@@ -1,9 +1,9 @@
1
1
  import type { Components, JSX } from "../types/components";
2
2
 
3
- interface FeedlogGithubIssues extends Components.FeedlogGithubIssues, HTMLElement {}
4
- export const FeedlogGithubIssues: {
5
- prototype: FeedlogGithubIssues;
6
- new (): FeedlogGithubIssues;
3
+ interface FeedlogIssuesClient extends Components.FeedlogIssuesClient, HTMLElement {}
4
+ export const FeedlogIssuesClient: {
5
+ prototype: FeedlogIssuesClient;
6
+ new (): FeedlogIssuesClient;
7
7
  };
8
8
  /**
9
9
  * Used to define this component and all nested components recursively.
@@ -0,0 +1 @@
1
+ import{t,p as e,H as s,c as i,h as o}from"./index.js";import{d as r}from"./p-Chc3XZ5Y.js";import{d as n}from"./p-DMdb-G26.js";import{d as h}from"./p-BBPFf6g7.js";import{d as a}from"./p-DKGIKLzX.js";import{d as u}from"./p-BR3ookRG.js";function c(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 l extends Error{constructor(t,e,s){super(t),this.statusCode=e,this.originalError=s,this.name="FeedlogError",Object.setPrototypeOf(this,l.prototype)}}class d extends l{constructor(t){super(t),this.name="FeedlogValidationError",Object.setPrototypeOf(this,d.prototype)}}class p extends l{constructor(t,e,s){super(t,e,s),this.name="FeedlogNetworkError",Object.setPrototypeOf(this,p.prototype)}}class f extends l{constructor(t="Request timed out"){super(t),this.name="FeedlogTimeoutError",Object.setPrototypeOf(this,f.prototype)}}class g{constructor(t){if(this.config={credentials:"include",...t},this.apiKey=this.config.apiKey,!this.apiKey)throw new d("apiKey is required in FeedlogSDKConfig");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 p("Failed to fetch issues: "+s.statusText,s.status);const i=await s.json();return this.validateIssuesResponse(i)}catch(t){if(t instanceof l)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new p("Network error: Unable to reach API",void 0,t);throw new l("Failed to fetch issues: "+(t instanceof Error?t.message:"Unknown error"),void 0,t)}}async toggleUpvote(t){if(!t||"string"!=typeof t)throw new d("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",body:JSON.stringify({})});if(404===s.status)throw new p("Issue not found",404);if(401===s.status)throw new p("Unauthorized",401);if(403===s.status)throw new p("Forbidden: Domain not allowed for this repository",403);if(!s.ok)throw new p("Failed to toggle upvote: "+s.statusText,s.status);const i=await s.json();return this.validateUpvoteResponse(i)}catch(t){if(t instanceof l)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new p("Network error: Unable to reach API",void 0,t);throw new l("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.sortBy&&e.searchParams.set("sortBy",t.sortBy),t.cursor&&e.searchParams.set("cursor",t.cursor),void 0!==t.limit&&e.searchParams.set("limit",""+t.limit),""+e}getAuthHeaders(){const t={"Content-Type":"application/json"};return this.apiKey&&(t["x-api-key"]=this.apiKey),t}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 f(`Request timed out after ${this.timeout}ms`);throw t}}validateIssuesResponse(t){if(!t||"object"!=typeof t)throw new d("Invalid API response: expected object");const e=t;if(!Array.isArray(e.issues))throw new d("Invalid API response: issues must be an array");if(!e.pagination||"object"!=typeof e.pagination)throw new d("Invalid API response: pagination is required");return{issues:e.issues.map((t=>this.validateIssue(t))),pagination:{cursor:e.pagination.cursor,hasMore:!!e.pagination.hasMore}}}validateIssue(t){if(!t||"object"!=typeof t)throw new d("Invalid issue: expected object");const e=t;if("string"!=typeof e.id)throw new d("Invalid issue: id is required and must be a string");if(!["bug","enhancement"].includes(e.type+""))throw new d('Invalid issue: type must be "bug" or "enhancement"');if(!["open","in_progress","closed"].includes(e.status+""))throw new d('Invalid issue: status must be "open", "in_progress", or "closed"');if(!e.repository||"object"!=typeof e.repository)throw new d("Invalid issue: repository is required");const s=e.repository;if("string"!=typeof s.id)throw new d("Invalid issue: repository must have id");const i=null!==e.githubIssueLink&&"string"==typeof e.githubIssueLink?e.githubIssueLink+"":null,o=e.title,r=null!=o&&""!==o?c(o+""):null,n=e.body,h=null!=n&&""!==n?c(n+""):null,a=s.name,u=null!=a&&""!==a?a+"":null,l=s.description,p=null!=l&&""!==l?c(l+""):null;return{id:e.id+"",githubIssueLink:i,type:e.type||"bug",status:e.status||"open",pinnedAt:e.pinnedAt?e.pinnedAt+"":null,revision:Number(e.revision)||1,title:r,body:h,repository:{id:s.id+"",name:u,description:p},updatedAt:e.updatedAt+""||(new Date).toISOString(),createdAt:e.createdAt+""||(new Date).toISOString(),upvoteCount:Number(e.upvoteCount)||0,hasUpvoted:!!e.hasUpvoted}}validateUpvoteResponse(t){if(!t||"object"!=typeof t)throw new d("Invalid upvote response: expected object");const e=t;if("boolean"!=typeof e.upvoted)throw new d("Invalid upvote response: upvoted must be a boolean");if("number"!=typeof e.upvoteCount)throw new d("Invalid upvote response: upvoteCount must be a number");if("string"!=typeof e.anonymousUserId)throw new d("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 m=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.feedlogUpvote=i(this,"feedlogUpvote"),this.feedlogError=i(this,"feedlogError"),this.maxWidth="42rem",this.theme="light",this.issues=[],this.loading=!0,this.error=null,this.cursor=null,this.hasMore=!1,this.isLoadingMore=!1,this.sdk=null,this.fetchRequestId=0,this.isDisconnected=!1,this.upvoteRequestIds=new Map,this.handleUpvote=async t=>{if(!this.sdk||this.isDisconnected)return;const{issueId:e,currentUpvoted:s,currentCount:i}=t.detail,o=(this.upvoteRequestIds.get(e)||0)+1;this.upvoteRequestIds.set(e,o),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);if(this.isDisconnected||this.upvoteRequestIds.get(e)!==o)return;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){if(this.isDisconnected||this.upvoteRequestIds.get(e)!==o)return;this.issues=this.issues.map((t=>t.id===e?Object.assign(Object.assign({},t),{hasUpvoted:s,upvoteCount:i}):t)),this.feedlogError.emit({error:t instanceof Error?t.message:"Failed to toggle upvote"})}}}componentWillLoad(){this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy,this.initializeSDK(),this.fetchIssues()}disconnectedCallback(){this.isDisconnected=!0,this.fetchRequestId++}componentDidUpdate(){(this.previousType!==this.type||this.previousLimit!==this.limit||this.previousSortBy!==this.sortBy)&&(this.fetchRequestId++,this.cursor=null,this.hasMore=!1,this.issues=[],this.fetchIssues(),this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy)}initializeSDK(){try{if(!this.apiKey)throw Error("API key is required for the Feedlog SDK");this.sdk=new g(Object.assign({apiKey:this.apiKey},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})}}async fetchIssues(){if(!this.sdk)return;const t=this.fetchRequestId;try{this.loading=!0,this.error=null;const e={};this.type&&(e.type=this.type),this.sortBy&&(e.sortBy=this.sortBy),this.limit&&(e.limit=this.limit),this.cursor&&(e.cursor=this.cursor);const s=await this.sdk.fetchIssues(e);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=s.issues,this.cursor=s.pagination.cursor,this.hasMore=s.pagination.hasMore}catch(e){if(this.isDisconnected||t!==this.fetchRequestId)return;const s=e instanceof Error?e.message:"Couldn't load updates";this.error=s,this.issues=[],this.feedlogError.emit({error:s,code:null==e?void 0:e.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.loading=!1,this.isLoadingMore=!1)}}async loadMore(){if(!this.sdk||!this.hasMore||this.isLoadingMore||this.loading)return;const t=this.fetchRequestId;this.isLoadingMore=!0;try{const e={};this.type&&(e.type=this.type),this.sortBy&&(e.sortBy=this.sortBy),this.limit&&(e.limit=this.limit),this.cursor&&(e.cursor=this.cursor);const s=await this.sdk.fetchIssues(e);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=[...this.issues,...s.issues],this.cursor=s.pagination.cursor,this.hasMore=s.pagination.hasMore}catch(e){if(this.isDisconnected||t!==this.fetchRequestId)return;this.feedlogError.emit({error:e instanceof Error?e.message:"Failed to load more issues",code:null==e?void 0:e.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.isLoadingMore=!1)}}render(){return o("feedlog-issues",{key:"8c8635788f390477f1e5217e423d79438c45858d",issues:this.issues,maxWidth:this.maxWidth,theme:this.theme,heading:this.heading,subtitle:this.subtitle,emptyStateTitle:this.emptyStateTitle,emptyStateMessage:this.emptyStateMessage,getIssueUrl:this.getIssueUrl,loading:this.loading,error:this.error,hasMore:this.hasMore,isLoadingMore:this.isLoadingMore,onFeedlogUpvote:this.handleUpvote,onFeedlogLoadMore:async()=>this.loadMore()})}},[1,"feedlog-issues-client",{apiKey:[1,"api-key"],type:[1],limit:[2],sortBy:[1,"sort-by"],endpoint:[1],maxWidth:[1,"max-width"],theme:[1],heading:[1],subtitle:[1],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"],getIssueUrl:[16],issues:[32],loading:[32],error:[32],cursor:[32],hasMore:[32],isLoadingMore:[32]}]);function w(){"undefined"!=typeof customElements&&["feedlog-issues-client","feedlog-badge","feedlog-button","feedlog-issue","feedlog-issues","feedlog-issues-list"].forEach((e=>{switch(e){case"feedlog-issues-client":customElements.get(t(e))||customElements.define(t(e),m);break;case"feedlog-badge":customElements.get(t(e))||r();break;case"feedlog-button":customElements.get(t(e))||n();break;case"feedlog-issue":customElements.get(t(e))||h();break;case"feedlog-issues":customElements.get(t(e))||a();break;case"feedlog-issues-list":customElements.get(t(e))||u()}}))}w();const y=m,b=w;export{y as FeedlogIssuesClient,b as defineCustomElement}
@@ -1 +1 @@
1
- import{t as e,p as s,H as t,c as o,h as i,a as d}from"./index.js";import{d as l}from"./p-Chc3XZ5Y.js";import{d as r}from"./p-BBPFf6g7.js";const u=s(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.feedlogUpvote=o(this,"feedlogUpvote"),this.issues=[],this.theme="light",this.handleUpvote=e=>{e.stopPropagation(),this.feedlogUpvote.emit(e.detail)}}render(){return i(d,{key:"005de8cf99383128f6973be57d84499c8ca9afd3",class:"dark"===this.theme?"dark":""},i("div",{key:"60edc37014f6703b9400dc8bf06726c9a8428a3b",class:"issues-list"},0===this.issues.length?i("div",{class:"empty-state"},i("p",null,"No issues found")):this.issues.map((e=>{var s,t;return i("feedlog-issue",{key:e.id,issue:e,issueUrl:null!==(t=null===(s=this.getIssueUrl)||void 0===s?void 0:s.call(this,e))&&void 0!==t?t:void 0,theme:this.theme,onFeedlogUpvote:e=>this.handleUpvote(e)})}))))}static get style(){return":host{display:block;--feedlog-muted-foreground:#64748b}:host(.dark){--feedlog-muted-foreground:oklch(0.72 0.02 260)}.issues-list{display:flex;flex-direction:column;gap:0.5rem}.empty-state{text-align:center;padding:3rem 1.5rem;color:var(--feedlog-muted-foreground);font-size:0.875rem}"}},[1,"feedlog-issues-list",{issues:[16],theme:[1],getIssueUrl:[16]}]);function a(){"undefined"!=typeof customElements&&["feedlog-issues-list","feedlog-badge","feedlog-issue"].forEach((s=>{switch(s){case"feedlog-issues-list":customElements.get(e(s))||customElements.define(e(s),u);break;case"feedlog-badge":customElements.get(e(s))||l();break;case"feedlog-issue":customElements.get(e(s))||r()}}))}a();const c=u,n=a;export{c as FeedlogIssuesList,n as defineCustomElement}
1
+ import{F as o,d as s}from"./p-BR3ookRG.js";const p=o,r=s;export{p as FeedlogIssuesList,r as defineCustomElement}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface FeedlogIssues extends Components.FeedlogIssues, HTMLElement {}
4
+ export const FeedlogIssues: {
5
+ prototype: FeedlogIssues;
6
+ new (): FeedlogIssues;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1 @@
1
+ import{F as o,d as s}from"./p-DKGIKLzX.js";const p=o,r=s;export{p as FeedlogIssues,r as defineCustomElement}
@@ -0,0 +1 @@
1
+ import{t as e,p as t,H as s,c as o,h as l,a as i}from"./index.js";import{d as r}from"./p-Chc3XZ5Y.js";import{d as a}from"./p-BBPFf6g7.js";const d=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.feedlogUpvote=o(this,"feedlogUpvote"),this.issues=[],this.theme="light",this.handleUpvote=e=>{e.stopPropagation(),this.feedlogUpvote.emit(e.detail)}}renderEmptyStateIllustration(){return l("svg",{class:"empty-state-illustration",xmlns:"http://www.w3.org/2000/svg",width:"120",height:"96",viewBox:"0 0 120 96",fill:"none","aria-hidden":"true"},l("path",{d:"M20 36h80v44c0 4.4-3.6 8-8 8H28c-4.4 0-8-3.6-8-8V36z",fill:"var(--feedlog-empty-illustration-bg)",stroke:"var(--feedlog-empty-illustration-stroke)","stroke-width":"1.5","stroke-linejoin":"round"}),l("path",{d:"M20 36l20-24h40l20 24",fill:"none",stroke:"var(--feedlog-empty-illustration-stroke)","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M44 52h32M44 60h24M44 68h28",stroke:"var(--feedlog-empty-illustration-muted)","stroke-width":"1.25","stroke-linecap":"round"}))}render(){return l(i,{key:"d797fd4978179c9081678e2fb3e7e2be756b4ea2",class:"dark"===this.theme?"dark":""},l("div",{key:"1fe373bbad55cf718d65279ae718f9b95e89e37f",class:"issues-list"},0===this.issues.length?l("div",{class:"empty-state"},this.emptyStateTitle&&this.emptyStateMessage?l("div",{class:"empty-state-content"},this.renderEmptyStateIllustration(),l("h2",{class:"empty-state-title"},this.emptyStateTitle),l("p",{class:"empty-state-message"},this.emptyStateMessage)):l("p",null,"No issues found")):this.issues.map((e=>{var t,s;return l("feedlog-issue",{key:e.id,issue:e,issueUrl:null!==(s=null===(t=this.getIssueUrl)||void 0===t?void 0:t.call(this,e))&&void 0!==s?s:void 0,theme:this.theme,onFeedlogUpvote:e=>this.handleUpvote(e)})}))))}static get style(){return":host{display:block;--feedlog-muted-foreground:#64748b;--feedlog-foreground:oklch(0.145 0 0);--feedlog-empty-illustration-bg:oklch(0.96 0.01 260);--feedlog-empty-illustration-stroke:oklch(0.75 0.02 260);--feedlog-empty-illustration-muted:oklch(0.82 0.01 260)}:host(.dark){--feedlog-muted-foreground:oklch(0.72 0.02 260);--feedlog-foreground:oklch(0.985 0 0);--feedlog-empty-illustration-bg:oklch(0.28 0.02 260);--feedlog-empty-illustration-stroke:oklch(0.45 0.02 260);--feedlog-empty-illustration-muted:oklch(0.38 0.01 260)}.issues-list{display:flex;flex-direction:column;gap:0.5rem}.empty-state{text-align:center;padding:3rem 1.5rem;color:var(--feedlog-muted-foreground);font-size:0.875rem}.empty-state-content{display:flex;flex-direction:column;align-items:center;text-align:center;max-width:20rem}.empty-state-illustration{margin-bottom:1.5rem;opacity:0.9}.empty-state-title{margin:0 0 0.5rem 0;font-size:1.125rem;font-weight:600;color:var(--feedlog-foreground);line-height:1.4}.empty-state-message{margin:0;font-size:0.875rem;color:var(--feedlog-muted-foreground);line-height:1.5}"}},[1,"feedlog-issues-list",{issues:[16],theme:[1],getIssueUrl:[16],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"]}]);function n(){"undefined"!=typeof customElements&&["feedlog-issues-list","feedlog-badge","feedlog-issue"].forEach((t=>{switch(t){case"feedlog-issues-list":customElements.get(e(t))||customElements.define(e(t),d);break;case"feedlog-badge":customElements.get(e(t))||r();break;case"feedlog-issue":customElements.get(e(t))||a()}}))}n();export{d as F,n as d}
@@ -0,0 +1 @@
1
+ import{t as e,p as o,H as t,c as s,h as d,a as r}from"./index.js";import{d as i}from"./p-Chc3XZ5Y.js";import{d as l}from"./p-DMdb-G26.js";import{d as a}from"./p-BBPFf6g7.js";import{d as n}from"./p-BR3ookRG.js";const c=o(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.feedlogUpvote=s(this,"feedlogUpvote"),this.feedlogLoadMore=s(this,"feedlogLoadMore"),this.issues=[],this.maxWidth="42rem",this.theme="light",this.loading=!1,this.error=null,this.hasMore=!1,this.isLoadingMore=!1,this.currentTheme="light",this.handleUpvote=e=>{e.stopPropagation(),this.feedlogUpvote.emit(e.detail)},this.handleLoadMore=()=>{this.feedlogLoadMore.emit()}}componentWillLoad(){this.currentTheme=this.theme}renderErrorIcon(){return d("svg",{class:"error-icon",xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},d("circle",{cx:"12",cy:"12",r:"10"}),d("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),d("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"}))}renderIssuesList(){var e,o;return d("feedlog-issues-list",{issues:this.issues,theme:this.currentTheme,getIssueUrl:this.getIssueUrl,emptyStateTitle:null!==(e=this.emptyStateTitle)&&void 0!==e?e:"No updates yet",emptyStateMessage:null!==(o=this.emptyStateMessage)&&void 0!==o?o:"Check back later for new updates.",onFeedlogUpvote:e=>this.handleUpvote(e)})}render(){return d(r,{key:"812719c5d6f25108834d1a422dee280c18033e36",class:"dark"===this.currentTheme?"dark":""},d("div",{key:"1e415969878bad8fb14ea9e648d2c2d2e0d492a1",class:"issues-container",style:{maxWidth:this.maxWidth}},(this.heading||this.subtitle)&&d("header",{key:"5bf1308396ff3bc04a57763317fa71a34d48cc95",class:"issues-header"},d("div",{key:"19494458a1bcd11c3d91c08e98887f9d6ed33314",class:"header-content"},this.heading&&d("h1",{key:"f89bd679a9dd9262c93573ef0bfbbb23bd892a87",class:"issues-title"},this.heading),this.subtitle&&d("p",{key:"2bcc73dfb95d7ae8971004522fe44cca5128701b",class:"issues-subtitle"},this.subtitle))),this.loading&&d("div",{key:"85c06c80b624cd16d532bea5f0ad6fb7cc06f692",class:"loading-state",role:"status","aria-label":"Loading issues"},d("div",{key:"766cd9e7c18586f937a1b864e7bcfce60fe79707",class:"loading-skeletons"},[1,2,3].map((e=>d("div",{key:e,class:"skeleton-card"},d("div",{class:"skeleton-content"},d("div",{class:"skeleton-header"},d("div",{class:"skeleton-badge"}),d("div",{class:"skeleton-timestamp"})),d("div",{class:"skeleton-main"},d("div",{class:"skeleton-title"}),d("div",{class:"skeleton-body"},d("div",{class:"skeleton-line"}),d("div",{class:"skeleton-line short"})),d("div",{class:"skeleton-repo"})),d("div",{class:"skeleton-footer"},d("div",{class:"skeleton-upvote"})))))))),this.error&&d("div",{key:"5ca08a9ddc95b4ef59d6c776a24e08b5ac65c0b3",class:"error-state",role:"alert"},d("div",{key:"93218f816564cff58f591b53d1aad6b6bc8a1c64",class:"error-state-content"},this.renderErrorIcon(),d("h2",{key:"f141f75b92164af3f4d139a17937b0533641bcc0",class:"error-state-title"},"Something went wrong"),d("p",{key:"61225c7f4f46944787d4a6448386c8209cdaf74c",class:"error-state-message"},this.error))),!this.loading&&!this.error&&d("div",{key:"5ac699f4c5d0e5b5d20f1546efe24f80cba70748"},this.renderIssuesList(),this.hasMore&&d("div",{key:"9ad22c48dac0d8874dfae9735c850b2ca52836e7",class:"load-more-container"},d("feedlog-button",{key:"de55c05ca8b80ec5df98051653ca135874edc98b",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-theme-bg:#ffffff;--feedlog-foreground:oklch(0.145 0 0);--feedlog-card:#ffffff;--feedlog-card-foreground:oklch(0.145 0 0);--feedlog-muted:#ececf0;--feedlog-muted-foreground:#717182;--feedlog-border:rgba(0, 0, 0, 0.1);--feedlog-accent-color:#2563eb;--feedlog-destructive:#d4183d;--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-100:oklch(0.932 0.032 255.585);--feedlog-red-100:#fce7f3;--feedlog-red-400:#f472b6;--feedlog-red-600:#db2777;--feedlog-radius:0.625rem;--feedlog-gap:0.5rem;--feedlog-padding:2rem;--feedlog-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08)}:host(.dark){--feedlog-theme-bg:oklch(0.18 0.01 260);--feedlog-foreground:oklch(0.985 0 0);--feedlog-card:oklch(0.24 0.01 260);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.32 0.01 260);--feedlog-muted-foreground:oklch(0.72 0.02 260);--feedlog-border:oklch(0.34 0.01 260);--feedlog-accent-color:#3b82f6;--feedlog-destructive:oklch(0.396 0.141 25.723);--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-900-30:color-mix(in oklab, oklch(0.379 0.146 265.522) 30%, transparent);--feedlog-red-900-30:color-mix(in oklab, oklch(0.396 0.141 25.723) 30%, transparent);--feedlog-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.3)}.issues-container{min-height:100vh;background-color:var(--feedlog-background, var(--feedlog-theme-bg, #ffffff));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{padding:0}.loading-skeletons{display:flex;flex-direction:column;gap:var(--feedlog-gap)}.skeleton-card{background-color:var(--feedlog-card);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);box-shadow:var(--feedlog-shadow);position:relative;overflow:hidden}.skeleton-card::before{content:'';position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--feedlog-muted)}.skeleton-content{padding:1.25rem;padding-left:calc(1.25rem + 3px);display:flex;flex-direction:column;gap:0.875rem}.skeleton-header{display:flex;align-items:center;justify-content:space-between;gap:0.75rem}.skeleton-badge{width:4.5rem;height:1.25rem;border-radius:0.375rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite}.skeleton-timestamp{width:3rem;height:0.75rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.2s}.skeleton-main{display:flex;flex-direction:column;gap:0.5rem}.skeleton-title{height:0.9375rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.1s;width:85%}.skeleton-body{display:flex;flex-direction:column;gap:0.375rem}.skeleton-line{height:0.8125rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.15s;width:100%}.skeleton-line.short{width:70%}.skeleton-repo{width:6rem;height:0.75rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.25s}.skeleton-footer{display:flex;justify-content:flex-end}.skeleton-upvote{width:2.5rem;height:2rem;border-radius:0.5rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.3s}@keyframes skeleton-pulse{0%,100%{opacity:1}50%{opacity:0.5}}.error-state{display:flex;align-items:center;justify-content:center;padding:3rem 2rem;min-height:12rem}.error-state-content{display:flex;flex-direction:column;align-items:center;text-align:center;max-width:20rem;padding:2rem}.error-icon{color:var(--feedlog-muted-foreground);opacity:0.8;margin-bottom:1rem}.error-state-title{margin:0 0 0.5rem 0;font-size:1.125rem;font-weight:600;color:var(--feedlog-foreground);line-height:1.4}.error-state-message{margin:0 0 1.25rem 0;font-size:0.875rem;color:var(--feedlog-muted-foreground);line-height:1.5}.load-more-container{display:flex;justify-content:center;padding:2rem 0;gap:1rem}"}},[1,"feedlog-issues",{issues:[16],maxWidth:[1,"max-width"],theme:[1025],heading:[1],subtitle:[1],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"],loading:[4],error:[1],hasMore:[4,"has-more"],isLoadingMore:[4,"is-loading-more"],getIssueUrl:[16],currentTheme:[32]}]);function f(){"undefined"!=typeof customElements&&["feedlog-issues","feedlog-badge","feedlog-button","feedlog-issue","feedlog-issues-list"].forEach((o=>{switch(o){case"feedlog-issues":customElements.get(e(o))||customElements.define(e(o),c);break;case"feedlog-badge":customElements.get(e(o))||i();break;case"feedlog-button":customElements.get(e(o))||l();break;case"feedlog-issue":customElements.get(e(o))||a();break;case"feedlog-issues-list":customElements.get(e(o))||n()}}))}f();export{c as F,f as d}
@@ -1635,4 +1635,35 @@ const FeedlogIssueComponent = class {
1635
1635
  };
1636
1636
  FeedlogIssueComponent.style = feedlogIssueCss();
1637
1637
 
1638
- export { FeedlogButton as feedlog_button, FeedlogIssueComponent as feedlog_issue };
1638
+ const feedlogIssuesListCss = () => `:host{display:block;--feedlog-muted-foreground:#64748b;--feedlog-foreground:oklch(0.145 0 0);--feedlog-empty-illustration-bg:oklch(0.96 0.01 260);--feedlog-empty-illustration-stroke:oklch(0.75 0.02 260);--feedlog-empty-illustration-muted:oklch(0.82 0.01 260)}:host(.dark){--feedlog-muted-foreground:oklch(0.72 0.02 260);--feedlog-foreground:oklch(0.985 0 0);--feedlog-empty-illustration-bg:oklch(0.28 0.02 260);--feedlog-empty-illustration-stroke:oklch(0.45 0.02 260);--feedlog-empty-illustration-muted:oklch(0.38 0.01 260)}.issues-list{display:flex;flex-direction:column;gap:0.5rem}.empty-state{text-align:center;padding:3rem 1.5rem;color:var(--feedlog-muted-foreground);font-size:0.875rem}.empty-state-content{display:flex;flex-direction:column;align-items:center;text-align:center;max-width:20rem}.empty-state-illustration{margin-bottom:1.5rem;opacity:0.9}.empty-state-title{margin:0 0 0.5rem 0;font-size:1.125rem;font-weight:600;color:var(--feedlog-foreground);line-height:1.4}.empty-state-message{margin:0;font-size:0.875rem;color:var(--feedlog-muted-foreground);line-height:1.5}`;
1639
+
1640
+ const FeedlogIssuesList = class {
1641
+ constructor(hostRef) {
1642
+ registerInstance(this, hostRef);
1643
+ this.feedlogUpvote = createEvent(this, "feedlogUpvote");
1644
+ /**
1645
+ * Array of issues to display
1646
+ */
1647
+ this.issues = [];
1648
+ /**
1649
+ * Theme variant: 'light' or 'dark'
1650
+ */
1651
+ this.theme = 'light';
1652
+ this.handleUpvote = (event) => {
1653
+ event.stopPropagation();
1654
+ this.feedlogUpvote.emit(event.detail);
1655
+ };
1656
+ }
1657
+ renderEmptyStateIllustration() {
1658
+ return (h("svg", { class: "empty-state-illustration", xmlns: "http://www.w3.org/2000/svg", width: "120", height: "96", viewBox: "0 0 120 96", fill: "none", "aria-hidden": "true" }, h("path", { d: "M20 36h80v44c0 4.4-3.6 8-8 8H28c-4.4 0-8-3.6-8-8V36z", fill: "var(--feedlog-empty-illustration-bg)", stroke: "var(--feedlog-empty-illustration-stroke)", "stroke-width": "1.5", "stroke-linejoin": "round" }), h("path", { d: "M20 36l20-24h40l20 24", fill: "none", stroke: "var(--feedlog-empty-illustration-stroke)", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), h("path", { d: "M44 52h32M44 60h24M44 68h28", stroke: "var(--feedlog-empty-illustration-muted)", "stroke-width": "1.25", "stroke-linecap": "round" })));
1659
+ }
1660
+ render() {
1661
+ return (h(Host, { key: 'd797fd4978179c9081678e2fb3e7e2be756b4ea2', class: this.theme === 'dark' ? 'dark' : '' }, h("div", { key: '1fe373bbad55cf718d65279ae718f9b95e89e37f', class: "issues-list" }, this.issues.length === 0 ? (h("div", { class: "empty-state" }, this.emptyStateTitle && this.emptyStateMessage ? (h("div", { class: "empty-state-content" }, this.renderEmptyStateIllustration(), h("h2", { class: "empty-state-title" }, this.emptyStateTitle), h("p", { class: "empty-state-message" }, this.emptyStateMessage))) : (h("p", null, "No issues found")))) : (this.issues.map(issue => {
1662
+ var _a, _b;
1663
+ return (h("feedlog-issue", { key: issue.id, issue: issue, issueUrl: (_b = (_a = this.getIssueUrl) === null || _a === void 0 ? void 0 : _a.call(this, issue)) !== null && _b !== void 0 ? _b : undefined, theme: this.theme, onFeedlogUpvote: (e) => this.handleUpvote(e) }));
1664
+ })))));
1665
+ }
1666
+ };
1667
+ FeedlogIssuesList.style = feedlogIssuesListCss();
1668
+
1669
+ export { FeedlogButton as feedlog_button, FeedlogIssueComponent as feedlog_issue, FeedlogIssuesList as feedlog_issues_list };
@@ -341,7 +341,7 @@ class FeedlogSDK {
341
341
  }
342
342
  }
343
343
 
344
- const FeedlogGithubIssuesClient = class {
344
+ const FeedlogIssuesClient = class {
345
345
  constructor(hostRef) {
346
346
  registerInstance(this, hostRef);
347
347
  this.feedlogUpvote = createEvent(this, "feedlogUpvote");
@@ -551,8 +551,8 @@ const FeedlogGithubIssuesClient = class {
551
551
  }
552
552
  }
553
553
  render() {
554
- return (h("feedlog-github-issues", { key: '4bc46e4f2622d4c2c5080835ae436ae9fc37c991', issues: this.issues, maxWidth: this.maxWidth, theme: this.theme, heading: this.heading, subtitle: this.subtitle, emptyStateTitle: this.emptyStateTitle, emptyStateMessage: this.emptyStateMessage, getIssueUrl: this.getIssueUrl, loading: this.loading, error: this.error, hasMore: this.hasMore, isLoadingMore: this.isLoadingMore, onFeedlogUpvote: this.handleUpvote, onFeedlogLoadMore: async () => this.loadMore() }));
554
+ return (h("feedlog-issues", { key: '8c8635788f390477f1e5217e423d79438c45858d', issues: this.issues, maxWidth: this.maxWidth, theme: this.theme, heading: this.heading, subtitle: this.subtitle, emptyStateTitle: this.emptyStateTitle, emptyStateMessage: this.emptyStateMessage, getIssueUrl: this.getIssueUrl, loading: this.loading, error: this.error, hasMore: this.hasMore, isLoadingMore: this.isLoadingMore, onFeedlogUpvote: this.handleUpvote, onFeedlogLoadMore: async () => this.loadMore() }));
555
555
  }
556
556
  };
557
557
 
558
- export { FeedlogGithubIssuesClient as feedlog_github_issues_client };
558
+ export { FeedlogIssuesClient as feedlog_issues_client };
@@ -0,0 +1,69 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-rs_66Oq4.js';
2
+
3
+ const feedlogIssuesCss = () => `:host{display:block;font-family:ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;--feedlog-theme-bg:#ffffff;--feedlog-foreground:oklch(0.145 0 0);--feedlog-card:#ffffff;--feedlog-card-foreground:oklch(0.145 0 0);--feedlog-muted:#ececf0;--feedlog-muted-foreground:#717182;--feedlog-border:rgba(0, 0, 0, 0.1);--feedlog-accent-color:#2563eb;--feedlog-destructive:#d4183d;--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-100:oklch(0.932 0.032 255.585);--feedlog-red-100:#fce7f3;--feedlog-red-400:#f472b6;--feedlog-red-600:#db2777;--feedlog-radius:0.625rem;--feedlog-gap:0.5rem;--feedlog-padding:2rem;--feedlog-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08)}:host(.dark){--feedlog-theme-bg:oklch(0.18 0.01 260);--feedlog-foreground:oklch(0.985 0 0);--feedlog-card:oklch(0.24 0.01 260);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.32 0.01 260);--feedlog-muted-foreground:oklch(0.72 0.02 260);--feedlog-border:oklch(0.34 0.01 260);--feedlog-accent-color:#3b82f6;--feedlog-destructive:oklch(0.396 0.141 25.723);--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-900-30:color-mix(in oklab, oklch(0.379 0.146 265.522) 30%, transparent);--feedlog-red-900-30:color-mix(in oklab, oklch(0.396 0.141 25.723) 30%, transparent);--feedlog-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.3)}.issues-container{min-height:100vh;background-color:var(--feedlog-background, var(--feedlog-theme-bg, #ffffff));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{padding:0}.loading-skeletons{display:flex;flex-direction:column;gap:var(--feedlog-gap)}.skeleton-card{background-color:var(--feedlog-card);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);box-shadow:var(--feedlog-shadow);position:relative;overflow:hidden}.skeleton-card::before{content:'';position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--feedlog-muted)}.skeleton-content{padding:1.25rem;padding-left:calc(1.25rem + 3px);display:flex;flex-direction:column;gap:0.875rem}.skeleton-header{display:flex;align-items:center;justify-content:space-between;gap:0.75rem}.skeleton-badge{width:4.5rem;height:1.25rem;border-radius:0.375rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite}.skeleton-timestamp{width:3rem;height:0.75rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.2s}.skeleton-main{display:flex;flex-direction:column;gap:0.5rem}.skeleton-title{height:0.9375rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.1s;width:85%}.skeleton-body{display:flex;flex-direction:column;gap:0.375rem}.skeleton-line{height:0.8125rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.15s;width:100%}.skeleton-line.short{width:70%}.skeleton-repo{width:6rem;height:0.75rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.25s}.skeleton-footer{display:flex;justify-content:flex-end}.skeleton-upvote{width:2.5rem;height:2rem;border-radius:0.5rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.3s}@keyframes skeleton-pulse{0%,100%{opacity:1}50%{opacity:0.5}}.error-state{display:flex;align-items:center;justify-content:center;padding:3rem 2rem;min-height:12rem}.error-state-content{display:flex;flex-direction:column;align-items:center;text-align:center;max-width:20rem;padding:2rem}.error-icon{color:var(--feedlog-muted-foreground);opacity:0.8;margin-bottom:1rem}.error-state-title{margin:0 0 0.5rem 0;font-size:1.125rem;font-weight:600;color:var(--feedlog-foreground);line-height:1.4}.error-state-message{margin:0 0 1.25rem 0;font-size:0.875rem;color:var(--feedlog-muted-foreground);line-height:1.5}.load-more-container{display:flex;justify-content:center;padding:2rem 0;gap:1rem}`;
4
+
5
+ const FeedlogIssues = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ this.feedlogUpvote = createEvent(this, "feedlogUpvote");
9
+ this.feedlogLoadMore = createEvent(this, "feedlogLoadMore");
10
+ /**
11
+ * Array of issues to display
12
+ */
13
+ this.issues = [];
14
+ /**
15
+ * Maximum width of the container
16
+ */
17
+ this.maxWidth = '42rem';
18
+ /**
19
+ * Theme variant: 'light' or 'dark'
20
+ */
21
+ this.theme = 'light';
22
+ /**
23
+ * Loading state - shows loading indicator when true
24
+ */
25
+ this.loading = false;
26
+ /**
27
+ * Error message - shows error state when set
28
+ */
29
+ this.error = null;
30
+ /**
31
+ * Whether there are more issues to load
32
+ */
33
+ this.hasMore = false;
34
+ /**
35
+ * Whether more issues are currently loading
36
+ */
37
+ this.isLoadingMore = false;
38
+ /**
39
+ * Internal state for theme
40
+ */
41
+ this.currentTheme = 'light';
42
+ this.handleUpvote = (event) => {
43
+ event.stopPropagation();
44
+ this.feedlogUpvote.emit(event.detail);
45
+ };
46
+ this.handleLoadMore = () => {
47
+ this.feedlogLoadMore.emit();
48
+ };
49
+ }
50
+ componentWillLoad() {
51
+ this.currentTheme = this.theme;
52
+ }
53
+ renderErrorIcon() {
54
+ return (h("svg", { class: "error-icon", xmlns: "http://www.w3.org/2000/svg", width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("circle", { cx: "12", cy: "12", r: "10" }), h("line", { x1: "12", y1: "8", x2: "12", y2: "12" }), h("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })));
55
+ }
56
+ renderIssuesList() {
57
+ var _a, _b;
58
+ return (h("feedlog-issues-list", { issues: this.issues, theme: this.currentTheme, getIssueUrl: this.getIssueUrl, emptyStateTitle: (_a = this.emptyStateTitle) !== null && _a !== void 0 ? _a : 'No updates yet', emptyStateMessage: (_b = this.emptyStateMessage) !== null && _b !== void 0 ? _b : 'Check back later for new updates.', onFeedlogUpvote: (e) => this.handleUpvote(e) }));
59
+ }
60
+ render() {
61
+ const containerStyle = {
62
+ maxWidth: this.maxWidth,
63
+ };
64
+ return (h(Host, { key: '812719c5d6f25108834d1a422dee280c18033e36', class: this.currentTheme === 'dark' ? 'dark' : '' }, h("div", { key: '1e415969878bad8fb14ea9e648d2c2d2e0d492a1', class: "issues-container", style: containerStyle }, (this.heading || this.subtitle) && (h("header", { key: '5bf1308396ff3bc04a57763317fa71a34d48cc95', class: "issues-header" }, h("div", { key: '19494458a1bcd11c3d91c08e98887f9d6ed33314', class: "header-content" }, this.heading && h("h1", { key: 'f89bd679a9dd9262c93573ef0bfbbb23bd892a87', class: "issues-title" }, this.heading), this.subtitle && h("p", { key: '2bcc73dfb95d7ae8971004522fe44cca5128701b', class: "issues-subtitle" }, this.subtitle)))), this.loading && (h("div", { key: '85c06c80b624cd16d532bea5f0ad6fb7cc06f692', class: "loading-state", role: "status", "aria-label": "Loading issues" }, h("div", { key: '766cd9e7c18586f937a1b864e7bcfce60fe79707', class: "loading-skeletons" }, [1, 2, 3].map(i => (h("div", { key: i, class: "skeleton-card" }, h("div", { class: "skeleton-content" }, h("div", { class: "skeleton-header" }, h("div", { class: "skeleton-badge" }), h("div", { class: "skeleton-timestamp" })), h("div", { class: "skeleton-main" }, h("div", { class: "skeleton-title" }), h("div", { class: "skeleton-body" }, h("div", { class: "skeleton-line" }), h("div", { class: "skeleton-line short" })), h("div", { class: "skeleton-repo" })), h("div", { class: "skeleton-footer" }, h("div", { class: "skeleton-upvote" }))))))))), this.error && (h("div", { key: '5ca08a9ddc95b4ef59d6c776a24e08b5ac65c0b3', class: "error-state", role: "alert" }, h("div", { key: '93218f816564cff58f591b53d1aad6b6bc8a1c64', class: "error-state-content" }, this.renderErrorIcon(), h("h2", { key: 'f141f75b92164af3f4d139a17937b0533641bcc0', class: "error-state-title" }, "Something went wrong"), h("p", { key: '61225c7f4f46944787d4a6448386c8209cdaf74c', class: "error-state-message" }, this.error)))), !this.loading && !this.error && (h("div", { key: '5ac699f4c5d0e5b5d20f1546efe24f80cba70748' }, this.renderIssuesList(), this.hasMore && (h("div", { key: '9ad22c48dac0d8874dfae9735c850b2ca52836e7', class: "load-more-container" }, h("feedlog-button", { key: 'de55c05ca8b80ec5df98051653ca135874edc98b', onFeedlogClick: this.handleLoadMore, disabled: this.isLoadingMore, variant: "outline" }, this.isLoadingMore ? 'Loading...' : 'Load More Issues'))))))));
65
+ }
66
+ };
67
+ FeedlogIssues.style = feedlogIssuesCss();
68
+
69
+ export { FeedlogIssues as feedlog_issues };
@@ -16,5 +16,5 @@ var patchBrowser = () => {
16
16
 
17
17
  patchBrowser().then(async (options) => {
18
18
  await globalScripts();
19
- return bootstrapLazy([["feedlog-issues-list",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1],"getIssueUrl":[16]}]]],["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge",[[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-button_2",[[257,"feedlog-button",{"variant":[1],"size":[1],"disabled":[4],"type":[1]}],[257,"feedlog-issue",{"issue":[16],"issueUrl":[1,"issue-url"],"theme":[1]}]]],["feedlog-github-issues",[[1,"feedlog-github-issues",{"issues":[16],"maxWidth":[1,"max-width"],"theme":[1025],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"error":[1],"hasMore":[4,"has-more"],"isLoadingMore":[4,"is-loading-more"],"getIssueUrl":[16],"currentTheme":[32]}]]],["feedlog-github-issues-client",[[1,"feedlog-github-issues-client",{"apiKey":[1,"api-key"],"type":[1],"limit":[2],"sortBy":[1,"sort-by"],"endpoint":[1],"maxWidth":[1,"max-width"],"theme":[1],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"getIssueUrl":[16],"issues":[32],"loading":[32],"error":[32],"cursor":[32],"hasMore":[32],"isLoadingMore":[32]}]]]], options);
19
+ return bootstrapLazy([["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge",[[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-button_3",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1],"getIssueUrl":[16],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"]}],[257,"feedlog-button",{"variant":[1],"size":[1],"disabled":[4],"type":[1]}],[257,"feedlog-issue",{"issue":[16],"issueUrl":[1,"issue-url"],"theme":[1]}]]],["feedlog-issues",[[1,"feedlog-issues",{"issues":[16],"maxWidth":[1,"max-width"],"theme":[1025],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"error":[1],"hasMore":[4,"has-more"],"isLoadingMore":[4,"is-loading-more"],"getIssueUrl":[16],"currentTheme":[32]}]]],["feedlog-issues-client",[[1,"feedlog-issues-client",{"apiKey":[1,"api-key"],"type":[1],"limit":[2],"sortBy":[1,"sort-by"],"endpoint":[1],"maxWidth":[1,"max-width"],"theme":[1],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"getIssueUrl":[16],"issues":[32],"loading":[32],"error":[32],"cursor":[32],"hasMore":[32],"isLoadingMore":[32]}]]]], options);
20
20
  });
@@ -4,7 +4,7 @@ export { s as setNonce } from './index-rs_66Oq4.js';
4
4
  const defineCustomElements = async (win, options) => {
5
5
  if (typeof window === 'undefined') return undefined;
6
6
  await globalScripts();
7
- return bootstrapLazy([["feedlog-issues-list",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1],"getIssueUrl":[16]}]]],["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge",[[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-button_2",[[257,"feedlog-button",{"variant":[1],"size":[1],"disabled":[4],"type":[1]}],[257,"feedlog-issue",{"issue":[16],"issueUrl":[1,"issue-url"],"theme":[1]}]]],["feedlog-github-issues",[[1,"feedlog-github-issues",{"issues":[16],"maxWidth":[1,"max-width"],"theme":[1025],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"error":[1],"hasMore":[4,"has-more"],"isLoadingMore":[4,"is-loading-more"],"getIssueUrl":[16],"currentTheme":[32]}]]],["feedlog-github-issues-client",[[1,"feedlog-github-issues-client",{"apiKey":[1,"api-key"],"type":[1],"limit":[2],"sortBy":[1,"sort-by"],"endpoint":[1],"maxWidth":[1,"max-width"],"theme":[1],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"getIssueUrl":[16],"issues":[32],"loading":[32],"error":[32],"cursor":[32],"hasMore":[32],"isLoadingMore":[32]}]]]], options);
7
+ return bootstrapLazy([["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge",[[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-button_3",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1],"getIssueUrl":[16],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"]}],[257,"feedlog-button",{"variant":[1],"size":[1],"disabled":[4],"type":[1]}],[257,"feedlog-issue",{"issue":[16],"issueUrl":[1,"issue-url"],"theme":[1]}]]],["feedlog-issues",[[1,"feedlog-issues",{"issues":[16],"maxWidth":[1,"max-width"],"theme":[1025],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"error":[1],"hasMore":[4,"has-more"],"isLoadingMore":[4,"is-loading-more"],"getIssueUrl":[16],"currentTheme":[32]}]]],["feedlog-issues-client",[[1,"feedlog-issues-client",{"apiKey":[1,"api-key"],"type":[1],"limit":[2],"sortBy":[1,"sort-by"],"endpoint":[1],"maxWidth":[1,"max-width"],"theme":[1],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"getIssueUrl":[16],"issues":[32],"loading":[32],"error":[32],"cursor":[32],"hasMore":[32],"isLoadingMore":[32]}]]]], options);
8
8
  };
9
9
 
10
10
  export { defineCustomElements };
@@ -1 +1 @@
1
- import{p as e,g as t,b as a}from"./p-rs_66Oq4.js";export{s as setNonce}from"./p-rs_66Oq4.js";(()=>{const s=import.meta.url,t={};return""!==s&&(t.resourcesUrl=new URL(".",s).href),e(t)})().then((async e=>(await t(),a([["p-13773ed6",[[1,"feedlog-issues-list",{issues:[16],theme:[1],getIssueUrl:[16]}]]],["p-4e90285c",[[257,"feedlog-card"]]],["p-da51c7fd",[[257,"feedlog-badge",{variant:[1]}]]],["p-dad7b157",[[257,"feedlog-button",{variant:[1],size:[1],disabled:[4],type:[1]}],[257,"feedlog-issue",{issue:[16],issueUrl:[1,"issue-url"],theme:[1]}]]],["p-e5ba7dd7",[[1,"feedlog-github-issues",{issues:[16],maxWidth:[1,"max-width"],theme:[1025],heading:[1],subtitle:[1],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"],loading:[4],error:[1],hasMore:[4,"has-more"],isLoadingMore:[4,"is-loading-more"],getIssueUrl:[16],currentTheme:[32]}]]],["p-9b515728",[[1,"feedlog-github-issues-client",{apiKey:[1,"api-key"],type:[1],limit:[2],sortBy:[1,"sort-by"],endpoint:[1],maxWidth:[1,"max-width"],theme:[1],heading:[1],subtitle:[1],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"],getIssueUrl:[16],issues:[32],loading:[32],error:[32],cursor:[32],hasMore:[32],isLoadingMore:[32]}]]]],e))));
1
+ import{p as e,g as t,b as a}from"./p-rs_66Oq4.js";export{s as setNonce}from"./p-rs_66Oq4.js";(()=>{const t=import.meta.url,s={};return""!==t&&(s.resourcesUrl=new URL(".",t).href),e(s)})().then((async e=>(await t(),a([["p-4e90285c",[[257,"feedlog-card"]]],["p-da51c7fd",[[257,"feedlog-badge",{variant:[1]}]]],["p-f8e5e975",[[1,"feedlog-issues-list",{issues:[16],theme:[1],getIssueUrl:[16],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"]}],[257,"feedlog-button",{variant:[1],size:[1],disabled:[4],type:[1]}],[257,"feedlog-issue",{issue:[16],issueUrl:[1,"issue-url"],theme:[1]}]]],["p-2fbb5aad",[[1,"feedlog-issues",{issues:[16],maxWidth:[1,"max-width"],theme:[1025],heading:[1],subtitle:[1],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"],loading:[4],error:[1],hasMore:[4,"has-more"],isLoadingMore:[4,"is-loading-more"],getIssueUrl:[16],currentTheme:[32]}]]],["p-6737a3f4",[[1,"feedlog-issues-client",{apiKey:[1,"api-key"],type:[1],limit:[2],sortBy:[1,"sort-by"],endpoint:[1],maxWidth:[1,"max-width"],theme:[1],heading:[1],subtitle:[1],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"],getIssueUrl:[16],issues:[32],loading:[32],error:[32],cursor:[32],hasMore:[32],isLoadingMore:[32]}]]]],e))));
@@ -0,0 +1 @@
1
+ import{r as e,c as o,h as t,H as s}from"./p-rs_66Oq4.js";const r=class{constructor(t){e(this,t),this.feedlogUpvote=o(this,"feedlogUpvote"),this.feedlogLoadMore=o(this,"feedlogLoadMore"),this.issues=[],this.maxWidth="42rem",this.theme="light",this.loading=!1,this.error=null,this.hasMore=!1,this.isLoadingMore=!1,this.currentTheme="light",this.handleUpvote=e=>{e.stopPropagation(),this.feedlogUpvote.emit(e.detail)},this.handleLoadMore=()=>{this.feedlogLoadMore.emit()}}componentWillLoad(){this.currentTheme=this.theme}renderErrorIcon(){return t("svg",{class:"error-icon",xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},t("circle",{cx:"12",cy:"12",r:"10"}),t("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),t("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"}))}renderIssuesList(){var e,o;return t("feedlog-issues-list",{issues:this.issues,theme:this.currentTheme,getIssueUrl:this.getIssueUrl,emptyStateTitle:null!==(e=this.emptyStateTitle)&&void 0!==e?e:"No updates yet",emptyStateMessage:null!==(o=this.emptyStateMessage)&&void 0!==o?o:"Check back later for new updates.",onFeedlogUpvote:e=>this.handleUpvote(e)})}render(){return t(s,{key:"812719c5d6f25108834d1a422dee280c18033e36",class:"dark"===this.currentTheme?"dark":""},t("div",{key:"1e415969878bad8fb14ea9e648d2c2d2e0d492a1",class:"issues-container",style:{maxWidth:this.maxWidth}},(this.heading||this.subtitle)&&t("header",{key:"5bf1308396ff3bc04a57763317fa71a34d48cc95",class:"issues-header"},t("div",{key:"19494458a1bcd11c3d91c08e98887f9d6ed33314",class:"header-content"},this.heading&&t("h1",{key:"f89bd679a9dd9262c93573ef0bfbbb23bd892a87",class:"issues-title"},this.heading),this.subtitle&&t("p",{key:"2bcc73dfb95d7ae8971004522fe44cca5128701b",class:"issues-subtitle"},this.subtitle))),this.loading&&t("div",{key:"85c06c80b624cd16d532bea5f0ad6fb7cc06f692",class:"loading-state",role:"status","aria-label":"Loading issues"},t("div",{key:"766cd9e7c18586f937a1b864e7bcfce60fe79707",class:"loading-skeletons"},[1,2,3].map((e=>t("div",{key:e,class:"skeleton-card"},t("div",{class:"skeleton-content"},t("div",{class:"skeleton-header"},t("div",{class:"skeleton-badge"}),t("div",{class:"skeleton-timestamp"})),t("div",{class:"skeleton-main"},t("div",{class:"skeleton-title"}),t("div",{class:"skeleton-body"},t("div",{class:"skeleton-line"}),t("div",{class:"skeleton-line short"})),t("div",{class:"skeleton-repo"})),t("div",{class:"skeleton-footer"},t("div",{class:"skeleton-upvote"})))))))),this.error&&t("div",{key:"5ca08a9ddc95b4ef59d6c776a24e08b5ac65c0b3",class:"error-state",role:"alert"},t("div",{key:"93218f816564cff58f591b53d1aad6b6bc8a1c64",class:"error-state-content"},this.renderErrorIcon(),t("h2",{key:"f141f75b92164af3f4d139a17937b0533641bcc0",class:"error-state-title"},"Something went wrong"),t("p",{key:"61225c7f4f46944787d4a6448386c8209cdaf74c",class:"error-state-message"},this.error))),!this.loading&&!this.error&&t("div",{key:"5ac699f4c5d0e5b5d20f1546efe24f80cba70748"},this.renderIssuesList(),this.hasMore&&t("div",{key:"9ad22c48dac0d8874dfae9735c850b2ca52836e7",class:"load-more-container"},t("feedlog-button",{key:"de55c05ca8b80ec5df98051653ca135874edc98b",onFeedlogClick:this.handleLoadMore,disabled:this.isLoadingMore,variant:"outline"},this.isLoadingMore?"Loading...":"Load More Issues")))))}};r.style=":host{display:block;font-family:ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;--feedlog-theme-bg:#ffffff;--feedlog-foreground:oklch(0.145 0 0);--feedlog-card:#ffffff;--feedlog-card-foreground:oklch(0.145 0 0);--feedlog-muted:#ececf0;--feedlog-muted-foreground:#717182;--feedlog-border:rgba(0, 0, 0, 0.1);--feedlog-accent-color:#2563eb;--feedlog-destructive:#d4183d;--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-100:oklch(0.932 0.032 255.585);--feedlog-red-100:#fce7f3;--feedlog-red-400:#f472b6;--feedlog-red-600:#db2777;--feedlog-radius:0.625rem;--feedlog-gap:0.5rem;--feedlog-padding:2rem;--feedlog-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08)}:host(.dark){--feedlog-theme-bg:oklch(0.18 0.01 260);--feedlog-foreground:oklch(0.985 0 0);--feedlog-card:oklch(0.24 0.01 260);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.32 0.01 260);--feedlog-muted-foreground:oklch(0.72 0.02 260);--feedlog-border:oklch(0.34 0.01 260);--feedlog-accent-color:#3b82f6;--feedlog-destructive:oklch(0.396 0.141 25.723);--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-900-30:color-mix(in oklab, oklch(0.379 0.146 265.522) 30%, transparent);--feedlog-red-900-30:color-mix(in oklab, oklch(0.396 0.141 25.723) 30%, transparent);--feedlog-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.3)}.issues-container{min-height:100vh;background-color:var(--feedlog-background, var(--feedlog-theme-bg, #ffffff));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{padding:0}.loading-skeletons{display:flex;flex-direction:column;gap:var(--feedlog-gap)}.skeleton-card{background-color:var(--feedlog-card);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);box-shadow:var(--feedlog-shadow);position:relative;overflow:hidden}.skeleton-card::before{content:'';position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--feedlog-muted)}.skeleton-content{padding:1.25rem;padding-left:calc(1.25rem + 3px);display:flex;flex-direction:column;gap:0.875rem}.skeleton-header{display:flex;align-items:center;justify-content:space-between;gap:0.75rem}.skeleton-badge{width:4.5rem;height:1.25rem;border-radius:0.375rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite}.skeleton-timestamp{width:3rem;height:0.75rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.2s}.skeleton-main{display:flex;flex-direction:column;gap:0.5rem}.skeleton-title{height:0.9375rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.1s;width:85%}.skeleton-body{display:flex;flex-direction:column;gap:0.375rem}.skeleton-line{height:0.8125rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.15s;width:100%}.skeleton-line.short{width:70%}.skeleton-repo{width:6rem;height:0.75rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.25s}.skeleton-footer{display:flex;justify-content:flex-end}.skeleton-upvote{width:2.5rem;height:2rem;border-radius:0.5rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.3s}@keyframes skeleton-pulse{0%,100%{opacity:1}50%{opacity:0.5}}.error-state{display:flex;align-items:center;justify-content:center;padding:3rem 2rem;min-height:12rem}.error-state-content{display:flex;flex-direction:column;align-items:center;text-align:center;max-width:20rem;padding:2rem}.error-icon{color:var(--feedlog-muted-foreground);opacity:0.8;margin-bottom:1rem}.error-state-title{margin:0 0 0.5rem 0;font-size:1.125rem;font-weight:600;color:var(--feedlog-foreground);line-height:1.4}.error-state-message{margin:0 0 1.25rem 0;font-size:0.875rem;color:var(--feedlog-muted-foreground);line-height:1.5}.load-more-container{display:flex;justify-content:center;padding:2rem 0;gap:1rem}";export{r as feedlog_issues}
@@ -1 +1 @@
1
- import{r as t,c as s,h as e}from"./p-rs_66Oq4.js";function i(t){if("string"!=typeof t)return"";let s=t.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");return s=s.replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi,""),s=s.replace(/\s*on\w+\s*=\s*[^\s>]*/gi,""),s=s.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,""),s=s.replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,""),s=s.replace(/<(embed|object)\b[^<]*>/gi,""),s=s.replace(/javascript:/gi,""),s=s.replace(/data:(?!image\/(?:png|jpg|jpeg|gif|webp);)/gi,""),s}class o extends Error{constructor(t,s,e){super(t),this.statusCode=s,this.originalError=e,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,s,e){super(t,s,e),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){if(this.config={credentials:"include",...t},this.apiKey=this.config.apiKey,!this.apiKey)throw new r("apiKey is required in FeedlogSDKConfig");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 s=this.buildIssuesUrl(t),e=await this.fetchWithTimeout(s,{method:"GET",headers:this.getAuthHeaders(),credentials:this.config.credentials||"include"});if(!e.ok)throw new n(`Failed to fetch issues: ${e.statusText}`,e.status);const i=await e.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 s=`${this.endpoint}/api/issues/${encodeURIComponent(t)}/upvote`,e=await this.fetchWithTimeout(s,{method:"POST",headers:this.getAuthHeaders(),credentials:this.config.credentials||"include",body:JSON.stringify({})});if(404===e.status)throw new n("Issue not found",404);if(401===e.status)throw new n("Unauthorized",401);if(403===e.status)throw new n("Forbidden: Domain not allowed for this repository",403);if(!e.ok)throw new n(`Failed to toggle upvote: ${e.statusText}`,e.status);const i=await e.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 s=new URL(`${this.endpoint}/api/issues`);if(t.repositoryIds){const e=Array.isArray(t.repositoryIds)?t.repositoryIds:[t.repositoryIds];for(const t of e)s.searchParams.append("repositoryIds",t)}return t.type&&s.searchParams.set("type",t.type),t.sortBy&&s.searchParams.set("sortBy",t.sortBy),t.cursor&&s.searchParams.set("cursor",t.cursor),void 0!==t.limit&&s.searchParams.set("limit",t.limit.toString()),s.toString()}getAuthHeaders(){const t={"Content-Type":"application/json"};return this.apiKey&&(t["x-api-key"]=this.apiKey),t}async fetchWithTimeout(t,s){const e=new AbortController,i=setTimeout((()=>e.abort()),this.timeout);try{const o=await fetch(t,{...s,signal:e.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 s=t;if(!Array.isArray(s.issues))throw new r("Invalid API response: issues must be an array");if(!s.pagination||"object"!=typeof s.pagination)throw new r("Invalid API response: pagination is required");return{issues:s.issues.map((t=>this.validateIssue(t))),pagination:{cursor:s.pagination.cursor,hasMore:Boolean(s.pagination.hasMore)}}}validateIssue(t){if(!t||"object"!=typeof t)throw new r("Invalid issue: expected object");const s=t;if("string"!=typeof s.id)throw new r("Invalid issue: id is required and must be a string");if(!["bug","enhancement"].includes(String(s.type)))throw new r('Invalid issue: type must be "bug" or "enhancement"');if(!["open","in_progress","closed"].includes(String(s.status)))throw new r('Invalid issue: status must be "open", "in_progress", or "closed"');if(!s.repository||"object"!=typeof s.repository)throw new r("Invalid issue: repository is required");const e=s.repository;if("string"!=typeof e.id)throw new r("Invalid issue: repository must have id");const o=null!==s.githubIssueLink&&"string"==typeof s.githubIssueLink?String(s.githubIssueLink):null,n=s.title,h=null!=n&&""!==n?i(String(n)):null,a=s.body,u=null!=a&&""!==a?i(String(a)):null,c=e.name,l=null!=c&&""!==c?String(c):null,d=e.description,p=null!=d&&""!==d?i(String(d)):null;return{id:String(s.id),githubIssueLink:o,type:s.type||"bug",status:s.status||"open",pinnedAt:s.pinnedAt?String(s.pinnedAt):null,revision:Number(s.revision)||1,title:h,body:u,repository:{id:String(e.id),name:l,description:p},updatedAt:String(s.updatedAt)||(new Date).toISOString(),createdAt:String(s.createdAt)||(new Date).toISOString(),upvoteCount:Number(s.upvoteCount)||0,hasUpvoted:Boolean(s.hasUpvoted)}}validateUpvoteResponse(t){if(!t||"object"!=typeof t)throw new r("Invalid upvote response: expected object");const s=t;if("boolean"!=typeof s.upvoted)throw new r("Invalid upvote response: upvoted must be a boolean");if("number"!=typeof s.upvoteCount)throw new r("Invalid upvote response: upvoteCount must be a number");if("string"!=typeof s.anonymousUserId)throw new r("Invalid upvote response: anonymousUserId must be a string");return{upvoted:s.upvoted,upvoteCount:s.upvoteCount,anonymousUserId:s.anonymousUserId}}getEndpoint(){return this.endpoint}getTimeout(){return this.timeout}}const u=class{constructor(e){t(this,e),this.feedlogUpvote=s(this,"feedlogUpvote"),this.feedlogError=s(this,"feedlogError"),this.maxWidth="42rem",this.theme="light",this.issues=[],this.loading=!0,this.error=null,this.cursor=null,this.hasMore=!1,this.isLoadingMore=!1,this.sdk=null,this.fetchRequestId=0,this.isDisconnected=!1,this.upvoteRequestIds=new Map,this.handleUpvote=async t=>{if(!this.sdk||this.isDisconnected)return;const{issueId:s,currentUpvoted:e,currentCount:i}=t.detail,o=(this.upvoteRequestIds.get(s)||0)+1;this.upvoteRequestIds.set(s,o),this.issues=this.issues.map((t=>t.id===s?Object.assign(Object.assign({},t),{hasUpvoted:!e,upvoteCount:e?i-1:i+1}):t));try{const t=await this.sdk.toggleUpvote(s);if(this.isDisconnected||this.upvoteRequestIds.get(s)!==o)return;this.issues=this.issues.map((e=>e.id===s?Object.assign(Object.assign({},e),{hasUpvoted:t.upvoted,upvoteCount:t.upvoteCount}):e)),this.feedlogUpvote.emit({issueId:s,upvoted:t.upvoted,upvoteCount:t.upvoteCount})}catch(t){if(this.isDisconnected||this.upvoteRequestIds.get(s)!==o)return;this.issues=this.issues.map((t=>t.id===s?Object.assign(Object.assign({},t),{hasUpvoted:e,upvoteCount:i}):t));const r=t instanceof Error?t.message:"Failed to toggle upvote";this.feedlogError.emit({error:r})}}}componentWillLoad(){this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy,this.initializeSDK(),this.fetchIssues()}disconnectedCallback(){this.isDisconnected=!0,this.fetchRequestId++}componentDidUpdate(){(this.previousType!==this.type||this.previousLimit!==this.limit||this.previousSortBy!==this.sortBy)&&(this.fetchRequestId++,this.cursor=null,this.hasMore=!1,this.issues=[],this.fetchIssues(),this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy)}initializeSDK(){try{if(!this.apiKey)throw new Error("API key is required for the Feedlog SDK");this.sdk=new a(Object.assign({apiKey:this.apiKey},this.endpoint&&{endpoint:this.endpoint})),this.error=null}catch(t){const s=t instanceof Error?t.message:"Failed to initialize SDK";this.error=s,this.feedlogError.emit({error:s})}}async fetchIssues(){if(!this.sdk)return;const t=this.fetchRequestId;try{this.loading=!0,this.error=null;const s={};this.type&&(s.type=this.type),this.sortBy&&(s.sortBy=this.sortBy),this.limit&&(s.limit=this.limit),this.cursor&&(s.cursor=this.cursor);const e=await this.sdk.fetchIssues(s);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=e.issues,this.cursor=e.pagination.cursor,this.hasMore=e.pagination.hasMore}catch(s){if(this.isDisconnected||t!==this.fetchRequestId)return;const e=s instanceof Error?s.message:"Couldn't load updates";this.error=e,this.issues=[],this.feedlogError.emit({error:e,code:null==s?void 0:s.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.loading=!1,this.isLoadingMore=!1)}}async loadMore(){if(!this.sdk||!this.hasMore||this.isLoadingMore||this.loading)return;const t=this.fetchRequestId;this.isLoadingMore=!0;try{const s={};this.type&&(s.type=this.type),this.sortBy&&(s.sortBy=this.sortBy),this.limit&&(s.limit=this.limit),this.cursor&&(s.cursor=this.cursor);const e=await this.sdk.fetchIssues(s);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=[...this.issues,...e.issues],this.cursor=e.pagination.cursor,this.hasMore=e.pagination.hasMore}catch(s){if(this.isDisconnected||t!==this.fetchRequestId)return;const e=s instanceof Error?s.message:"Failed to load more issues";this.feedlogError.emit({error:e,code:null==s?void 0:s.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.isLoadingMore=!1)}}render(){return e("feedlog-github-issues",{key:"4bc46e4f2622d4c2c5080835ae436ae9fc37c991",issues:this.issues,maxWidth:this.maxWidth,theme:this.theme,heading:this.heading,subtitle:this.subtitle,emptyStateTitle:this.emptyStateTitle,emptyStateMessage:this.emptyStateMessage,getIssueUrl:this.getIssueUrl,loading:this.loading,error:this.error,hasMore:this.hasMore,isLoadingMore:this.isLoadingMore,onFeedlogUpvote:this.handleUpvote,onFeedlogLoadMore:async()=>this.loadMore()})}};export{u as feedlog_github_issues_client}
1
+ import{r as t,c as s,h as e}from"./p-rs_66Oq4.js";function i(t){if("string"!=typeof t)return"";let s=t.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");return s=s.replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi,""),s=s.replace(/\s*on\w+\s*=\s*[^\s>]*/gi,""),s=s.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,""),s=s.replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,""),s=s.replace(/<(embed|object)\b[^<]*>/gi,""),s=s.replace(/javascript:/gi,""),s=s.replace(/data:(?!image\/(?:png|jpg|jpeg|gif|webp);)/gi,""),s}class o extends Error{constructor(t,s,e){super(t),this.statusCode=s,this.originalError=e,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,s,e){super(t,s,e),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){if(this.config={credentials:"include",...t},this.apiKey=this.config.apiKey,!this.apiKey)throw new r("apiKey is required in FeedlogSDKConfig");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 s=this.buildIssuesUrl(t),e=await this.fetchWithTimeout(s,{method:"GET",headers:this.getAuthHeaders(),credentials:this.config.credentials||"include"});if(!e.ok)throw new n(`Failed to fetch issues: ${e.statusText}`,e.status);const i=await e.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 s=`${this.endpoint}/api/issues/${encodeURIComponent(t)}/upvote`,e=await this.fetchWithTimeout(s,{method:"POST",headers:this.getAuthHeaders(),credentials:this.config.credentials||"include",body:JSON.stringify({})});if(404===e.status)throw new n("Issue not found",404);if(401===e.status)throw new n("Unauthorized",401);if(403===e.status)throw new n("Forbidden: Domain not allowed for this repository",403);if(!e.ok)throw new n(`Failed to toggle upvote: ${e.statusText}`,e.status);const i=await e.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 s=new URL(`${this.endpoint}/api/issues`);if(t.repositoryIds){const e=Array.isArray(t.repositoryIds)?t.repositoryIds:[t.repositoryIds];for(const t of e)s.searchParams.append("repositoryIds",t)}return t.type&&s.searchParams.set("type",t.type),t.sortBy&&s.searchParams.set("sortBy",t.sortBy),t.cursor&&s.searchParams.set("cursor",t.cursor),void 0!==t.limit&&s.searchParams.set("limit",t.limit.toString()),s.toString()}getAuthHeaders(){const t={"Content-Type":"application/json"};return this.apiKey&&(t["x-api-key"]=this.apiKey),t}async fetchWithTimeout(t,s){const e=new AbortController,i=setTimeout((()=>e.abort()),this.timeout);try{const o=await fetch(t,{...s,signal:e.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 s=t;if(!Array.isArray(s.issues))throw new r("Invalid API response: issues must be an array");if(!s.pagination||"object"!=typeof s.pagination)throw new r("Invalid API response: pagination is required");return{issues:s.issues.map((t=>this.validateIssue(t))),pagination:{cursor:s.pagination.cursor,hasMore:Boolean(s.pagination.hasMore)}}}validateIssue(t){if(!t||"object"!=typeof t)throw new r("Invalid issue: expected object");const s=t;if("string"!=typeof s.id)throw new r("Invalid issue: id is required and must be a string");if(!["bug","enhancement"].includes(String(s.type)))throw new r('Invalid issue: type must be "bug" or "enhancement"');if(!["open","in_progress","closed"].includes(String(s.status)))throw new r('Invalid issue: status must be "open", "in_progress", or "closed"');if(!s.repository||"object"!=typeof s.repository)throw new r("Invalid issue: repository is required");const e=s.repository;if("string"!=typeof e.id)throw new r("Invalid issue: repository must have id");const o=null!==s.githubIssueLink&&"string"==typeof s.githubIssueLink?String(s.githubIssueLink):null,n=s.title,h=null!=n&&""!==n?i(String(n)):null,a=s.body,u=null!=a&&""!==a?i(String(a)):null,c=e.name,l=null!=c&&""!==c?String(c):null,d=e.description,p=null!=d&&""!==d?i(String(d)):null;return{id:String(s.id),githubIssueLink:o,type:s.type||"bug",status:s.status||"open",pinnedAt:s.pinnedAt?String(s.pinnedAt):null,revision:Number(s.revision)||1,title:h,body:u,repository:{id:String(e.id),name:l,description:p},updatedAt:String(s.updatedAt)||(new Date).toISOString(),createdAt:String(s.createdAt)||(new Date).toISOString(),upvoteCount:Number(s.upvoteCount)||0,hasUpvoted:Boolean(s.hasUpvoted)}}validateUpvoteResponse(t){if(!t||"object"!=typeof t)throw new r("Invalid upvote response: expected object");const s=t;if("boolean"!=typeof s.upvoted)throw new r("Invalid upvote response: upvoted must be a boolean");if("number"!=typeof s.upvoteCount)throw new r("Invalid upvote response: upvoteCount must be a number");if("string"!=typeof s.anonymousUserId)throw new r("Invalid upvote response: anonymousUserId must be a string");return{upvoted:s.upvoted,upvoteCount:s.upvoteCount,anonymousUserId:s.anonymousUserId}}getEndpoint(){return this.endpoint}getTimeout(){return this.timeout}}const u=class{constructor(e){t(this,e),this.feedlogUpvote=s(this,"feedlogUpvote"),this.feedlogError=s(this,"feedlogError"),this.maxWidth="42rem",this.theme="light",this.issues=[],this.loading=!0,this.error=null,this.cursor=null,this.hasMore=!1,this.isLoadingMore=!1,this.sdk=null,this.fetchRequestId=0,this.isDisconnected=!1,this.upvoteRequestIds=new Map,this.handleUpvote=async t=>{if(!this.sdk||this.isDisconnected)return;const{issueId:s,currentUpvoted:e,currentCount:i}=t.detail,o=(this.upvoteRequestIds.get(s)||0)+1;this.upvoteRequestIds.set(s,o),this.issues=this.issues.map((t=>t.id===s?Object.assign(Object.assign({},t),{hasUpvoted:!e,upvoteCount:e?i-1:i+1}):t));try{const t=await this.sdk.toggleUpvote(s);if(this.isDisconnected||this.upvoteRequestIds.get(s)!==o)return;this.issues=this.issues.map((e=>e.id===s?Object.assign(Object.assign({},e),{hasUpvoted:t.upvoted,upvoteCount:t.upvoteCount}):e)),this.feedlogUpvote.emit({issueId:s,upvoted:t.upvoted,upvoteCount:t.upvoteCount})}catch(t){if(this.isDisconnected||this.upvoteRequestIds.get(s)!==o)return;this.issues=this.issues.map((t=>t.id===s?Object.assign(Object.assign({},t),{hasUpvoted:e,upvoteCount:i}):t));const r=t instanceof Error?t.message:"Failed to toggle upvote";this.feedlogError.emit({error:r})}}}componentWillLoad(){this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy,this.initializeSDK(),this.fetchIssues()}disconnectedCallback(){this.isDisconnected=!0,this.fetchRequestId++}componentDidUpdate(){(this.previousType!==this.type||this.previousLimit!==this.limit||this.previousSortBy!==this.sortBy)&&(this.fetchRequestId++,this.cursor=null,this.hasMore=!1,this.issues=[],this.fetchIssues(),this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy)}initializeSDK(){try{if(!this.apiKey)throw new Error("API key is required for the Feedlog SDK");this.sdk=new a(Object.assign({apiKey:this.apiKey},this.endpoint&&{endpoint:this.endpoint})),this.error=null}catch(t){const s=t instanceof Error?t.message:"Failed to initialize SDK";this.error=s,this.feedlogError.emit({error:s})}}async fetchIssues(){if(!this.sdk)return;const t=this.fetchRequestId;try{this.loading=!0,this.error=null;const s={};this.type&&(s.type=this.type),this.sortBy&&(s.sortBy=this.sortBy),this.limit&&(s.limit=this.limit),this.cursor&&(s.cursor=this.cursor);const e=await this.sdk.fetchIssues(s);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=e.issues,this.cursor=e.pagination.cursor,this.hasMore=e.pagination.hasMore}catch(s){if(this.isDisconnected||t!==this.fetchRequestId)return;const e=s instanceof Error?s.message:"Couldn't load updates";this.error=e,this.issues=[],this.feedlogError.emit({error:e,code:null==s?void 0:s.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.loading=!1,this.isLoadingMore=!1)}}async loadMore(){if(!this.sdk||!this.hasMore||this.isLoadingMore||this.loading)return;const t=this.fetchRequestId;this.isLoadingMore=!0;try{const s={};this.type&&(s.type=this.type),this.sortBy&&(s.sortBy=this.sortBy),this.limit&&(s.limit=this.limit),this.cursor&&(s.cursor=this.cursor);const e=await this.sdk.fetchIssues(s);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=[...this.issues,...e.issues],this.cursor=e.pagination.cursor,this.hasMore=e.pagination.hasMore}catch(s){if(this.isDisconnected||t!==this.fetchRequestId)return;const e=s instanceof Error?s.message:"Failed to load more issues";this.feedlogError.emit({error:e,code:null==s?void 0:s.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.isLoadingMore=!1)}}render(){return e("feedlog-issues",{key:"8c8635788f390477f1e5217e423d79438c45858d",issues:this.issues,maxWidth:this.maxWidth,theme:this.theme,heading:this.heading,subtitle:this.subtitle,emptyStateTitle:this.emptyStateTitle,emptyStateMessage:this.emptyStateMessage,getIssueUrl:this.getIssueUrl,loading:this.loading,error:this.error,hasMore:this.hasMore,isLoadingMore:this.isLoadingMore,onFeedlogUpvote:this.handleUpvote,onFeedlogLoadMore:async()=>this.loadMore()})}};export{u as feedlog_issues_client}