@feedlog-ai/webcomponents 0.0.6 → 0.0.8

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 CHANGED
@@ -41,6 +41,69 @@ The main component for displaying GitHub issues with built-in SDK integration.
41
41
  - `feedlogThemeChange`: Emitted when theme changes
42
42
  - `feedlogError`: Emitted on errors
43
43
 
44
+ ## Playground (Development & Testing)
45
+
46
+ For fast prototyping and debugging without publishing changes, use the interactive playground:
47
+
48
+ ### Quick Start
49
+
50
+ 1. **Build the components:**
51
+
52
+ ```bash
53
+ npm run build
54
+ ```
55
+
56
+ 2. **Open the playground:**
57
+ - **Option A**: Open `playground.html` directly in your browser (file://)
58
+ - **Option B**: Use a local server for better development experience:
59
+ ```bash
60
+ npx serve .
61
+ ```
62
+ Then visit `http://localhost:3000/playground.html`
63
+
64
+ 3. **Use the playground:**
65
+ - Enter your Feedlog API key in the "API Key" field
66
+ - Adjust filter settings (type, limit, theme, etc.)
67
+ - Click "Update Component" to render the component
68
+ - Monitor component events in the "Event Log & Debug Console"
69
+ - Your API key is automatically saved to localStorage for convenience
70
+
71
+ ### Development Workflow
72
+
73
+ For continuous development with live reloading:
74
+
75
+ ```bash
76
+ # Terminal 1: Watch and build components
77
+ npm run dev
78
+
79
+ # Terminal 2: Serve the package directory
80
+ npx serve .
81
+ ```
82
+
83
+ Then visit `http://localhost:3000/playground.html` and refresh after each build.
84
+
85
+ ### Features
86
+
87
+ - **Interactive Controls**: Change props in real-time without rebuilding
88
+ - **Event Log**: See all component events (upvotes, errors) with timestamps
89
+ - **Status Badge**: Visual feedback on component state
90
+ - **No Publishing Required**: Test changes instantly without npm publish
91
+ - **Persistent Settings**: API key is saved to browser localStorage
92
+ - **Light/Dark Theme**: Toggle themes to test both variants
93
+ - **Responsive Design**: Test on different screen sizes
94
+
95
+ ### Playground Props
96
+
97
+ The playground lets you configure:
98
+
99
+ - **API Key** (required): Feedlog authentication key
100
+ - **Type**: Filter issues by type (all/bug/enhancement)
101
+ - **Limit**: Number of issues to fetch (1-100)
102
+ - **Max Width**: Container width (CSS values)
103
+ - **Theme**: Light or dark theme
104
+ - **Heading**: Custom section heading
105
+ - **Subtitle**: Custom section subtitle
106
+
44
107
  ## Usage
45
108
 
46
109
  ### Vanilla HTML
@@ -485,7 +485,7 @@ const FeedlogGithubIssuesClient = class {
485
485
  }
486
486
  }
487
487
  render() {
488
- return (index.h("feedlog-github-issues", { key: '39ee74bee86db7ff47d921cd771e5ce7c7468bb5', issues: this.issues, maxWidth: this.maxWidth, theme: this.theme, heading: this.heading, subtitle: this.subtitle, loading: this.loading, error: this.error, hasMore: this.hasMore, isLoadingMore: this.isLoadingMore, onFeedlogUpvote: this.handleUpvote, onFeedlogLoadMore: async () => this.loadMore() }));
488
+ return (index.h("feedlog-github-issues", { key: 'fe6a4397654075ddef24a3c28b2b1b0c515cfed1', issues: this.issues, maxWidth: this.maxWidth, theme: this.theme, heading: this.heading, subtitle: this.subtitle, loading: this.loading, error: this.error, hasMore: this.hasMore, isLoadingMore: this.isLoadingMore, onFeedlogUpvote: this.handleUpvote, onFeedlogLoadMore: async () => this.loadMore() }));
489
489
  }
490
490
  };
491
491
 
@@ -42,6 +42,7 @@ const FeedlogGithubIssues = class {
42
42
  */
43
43
  this.currentTheme = 'light';
44
44
  this.handleUpvote = (event) => {
45
+ event.stopPropagation();
45
46
  this.feedlogUpvote.emit(event.detail);
46
47
  };
47
48
  this.handleLoadMore = () => {
@@ -55,7 +56,7 @@ const FeedlogGithubIssues = class {
55
56
  const containerStyle = {
56
57
  maxWidth: this.maxWidth,
57
58
  };
58
- return (index.h(index.Host, { key: '473e30453d8b3a719bd977a361b7f669fdd88e48', class: this.currentTheme === 'dark' ? 'dark' : '' }, index.h("div", { key: 'ab91126edb301a1da6136f14441ec33833b6cd74', class: "github-issues-container", style: containerStyle }, (this.heading || this.subtitle) && (index.h("header", { key: '17494da495d2b2910e6f024f1c3971a945e0a1cc', class: "issues-header" }, index.h("div", { key: '95d5ac1c25ccfc864a863cafe1fa89d4ce04fce2', class: "header-content" }, this.heading && index.h("h1", { key: 'b37f9b9372e1b99da76c0fb9ee50d0a6cdbb0549', class: "issues-title" }, this.heading), this.subtitle && index.h("p", { key: '5edc92ca86f2dfd1afe640d77d65782e5ec27a8e', class: "issues-subtitle" }, this.subtitle)))), this.loading && (index.h("div", { key: 'f786656d24c8b88a57c7fa48f0d1877ac3565767', class: "loading-state" }, index.h("p", { key: 'fa97c2a05f52c2c1fbe0e907ac797cd6570d0a82' }, "Loading issues..."))), this.error && (index.h("div", { key: '798f3dc1ba004b2889aee6490b74240900ba3812', class: "error-state" }, index.h("p", { key: '03b996ab514027fce2e88a93901f3fe17d8da3e1' }, "Error: ", this.error))), !this.loading && !this.error && (index.h("div", { key: '67501ae1866122df2db6f97752d632013dbcd8a1' }, index.h("feedlog-issues-list", { key: 'c668c631f6ba6008df0a411bda7824bcce7318cd', issues: this.issues, theme: this.currentTheme, onFeedlogUpvote: this.handleUpvote }), this.hasMore && (index.h("div", { key: '28e1ea0600436f3ca8bf12e57e9764bf8899fa53', class: "load-more-container" }, index.h("feedlog-button", { key: 'f19576026d152e1b7f7957c83ccfee3c44727dd0', onFeedlogClick: this.handleLoadMore, disabled: this.isLoadingMore, variant: "outline" }, this.isLoadingMore ? 'Loading...' : 'Load More Issues'))))))));
59
+ return (index.h(index.Host, { key: '57a57d901c1c45d66e6fe3658b3fbcbce6282018', class: this.currentTheme === 'dark' ? 'dark' : '' }, index.h("div", { key: '7ffe5de2a145065f0e58f5d1525aee5e5770806c', class: "github-issues-container", style: containerStyle }, (this.heading || this.subtitle) && (index.h("header", { key: '413bf7d4c519f94f411ac9fc09e6776c14806871', class: "issues-header" }, index.h("div", { key: '481b2feb7b34089e9cd69e602d5a8a1dc4ce88ec', class: "header-content" }, this.heading && index.h("h1", { key: '267a0cde7d18ad560c59c2a80150b9a0d5b613d5', class: "issues-title" }, this.heading), this.subtitle && index.h("p", { key: '6f71de0f4ac2b7c0b89cd24b24196e9a9a6576b3', class: "issues-subtitle" }, this.subtitle)))), this.loading && (index.h("div", { key: '6f9c52861aca5b5bd2137cf0ad929b13e7d74539', class: "loading-state" }, index.h("p", { key: 'd2a82cb61df5595fd74c5c9f6bbae825a4b2397c' }, "Loading issues..."))), this.error && (index.h("div", { key: 'cd7ceea5eb432edc239ebf394661f659f04545d4', class: "error-state" }, index.h("p", { key: '09657cce843d286cee8bdcf5c05aa5ffc35267f6' }, "Error: ", this.error))), !this.loading && !this.error && (index.h("div", { key: '73310effa8344b29e21b473b8cb64fee053eae26' }, index.h("feedlog-issues-list", { key: '17183fa9301d1cdecaed3dcf9c21addd8871111b', issues: this.issues, theme: this.currentTheme, onFeedlogUpvote: this.handleUpvote }), this.hasMore && (index.h("div", { key: '9c7ef450db1b12f933f1ed83c6a5e7b8275b35b1', class: "load-more-container" }, index.h("feedlog-button", { key: '77d0bf2d339aaaabf8233752c923a224c120ae9d', onFeedlogClick: this.handleLoadMore, disabled: this.isLoadingMore, variant: "outline" }, this.isLoadingMore ? 'Loading...' : 'Load More Issues'))))))));
59
60
  }
60
61
  };
61
62
  FeedlogGithubIssues.style = feedlogGithubIssuesCss();
@@ -40,6 +40,7 @@ export class FeedlogGithubIssues {
40
40
  */
41
41
  this.currentTheme = 'light';
42
42
  this.handleUpvote = (event) => {
43
+ event.stopPropagation();
43
44
  this.feedlogUpvote.emit(event.detail);
44
45
  };
45
46
  this.handleLoadMore = () => {
@@ -53,7 +54,7 @@ export class FeedlogGithubIssues {
53
54
  const containerStyle = {
54
55
  maxWidth: this.maxWidth,
55
56
  };
56
- return (h(Host, { key: '473e30453d8b3a719bd977a361b7f669fdd88e48', class: this.currentTheme === 'dark' ? 'dark' : '' }, h("div", { key: 'ab91126edb301a1da6136f14441ec33833b6cd74', class: "github-issues-container", style: containerStyle }, (this.heading || this.subtitle) && (h("header", { key: '17494da495d2b2910e6f024f1c3971a945e0a1cc', class: "issues-header" }, h("div", { key: '95d5ac1c25ccfc864a863cafe1fa89d4ce04fce2', class: "header-content" }, this.heading && h("h1", { key: 'b37f9b9372e1b99da76c0fb9ee50d0a6cdbb0549', class: "issues-title" }, this.heading), this.subtitle && h("p", { key: '5edc92ca86f2dfd1afe640d77d65782e5ec27a8e', class: "issues-subtitle" }, this.subtitle)))), this.loading && (h("div", { key: 'f786656d24c8b88a57c7fa48f0d1877ac3565767', class: "loading-state" }, h("p", { key: 'fa97c2a05f52c2c1fbe0e907ac797cd6570d0a82' }, "Loading issues..."))), this.error && (h("div", { key: '798f3dc1ba004b2889aee6490b74240900ba3812', class: "error-state" }, h("p", { key: '03b996ab514027fce2e88a93901f3fe17d8da3e1' }, "Error: ", this.error))), !this.loading && !this.error && (h("div", { key: '67501ae1866122df2db6f97752d632013dbcd8a1' }, h("feedlog-issues-list", { key: 'c668c631f6ba6008df0a411bda7824bcce7318cd', issues: this.issues, theme: this.currentTheme, onFeedlogUpvote: this.handleUpvote }), this.hasMore && (h("div", { key: '28e1ea0600436f3ca8bf12e57e9764bf8899fa53', class: "load-more-container" }, h("feedlog-button", { key: 'f19576026d152e1b7f7957c83ccfee3c44727dd0', onFeedlogClick: this.handleLoadMore, disabled: this.isLoadingMore, variant: "outline" }, this.isLoadingMore ? 'Loading...' : 'Load More Issues'))))))));
57
+ return (h(Host, { key: '57a57d901c1c45d66e6fe3658b3fbcbce6282018', class: this.currentTheme === 'dark' ? 'dark' : '' }, h("div", { key: '7ffe5de2a145065f0e58f5d1525aee5e5770806c', class: "github-issues-container", style: containerStyle }, (this.heading || this.subtitle) && (h("header", { key: '413bf7d4c519f94f411ac9fc09e6776c14806871', class: "issues-header" }, h("div", { key: '481b2feb7b34089e9cd69e602d5a8a1dc4ce88ec', class: "header-content" }, this.heading && h("h1", { key: '267a0cde7d18ad560c59c2a80150b9a0d5b613d5', class: "issues-title" }, this.heading), this.subtitle && h("p", { key: '6f71de0f4ac2b7c0b89cd24b24196e9a9a6576b3', class: "issues-subtitle" }, this.subtitle)))), this.loading && (h("div", { key: '6f9c52861aca5b5bd2137cf0ad929b13e7d74539', class: "loading-state" }, h("p", { key: 'd2a82cb61df5595fd74c5c9f6bbae825a4b2397c' }, "Loading issues..."))), this.error && (h("div", { key: 'cd7ceea5eb432edc239ebf394661f659f04545d4', class: "error-state" }, h("p", { key: '09657cce843d286cee8bdcf5c05aa5ffc35267f6' }, "Error: ", this.error))), !this.loading && !this.error && (h("div", { key: '73310effa8344b29e21b473b8cb64fee053eae26' }, h("feedlog-issues-list", { key: '17183fa9301d1cdecaed3dcf9c21addd8871111b', issues: this.issues, theme: this.currentTheme, onFeedlogUpvote: this.handleUpvote }), this.hasMore && (h("div", { key: '9c7ef450db1b12f933f1ed83c6a5e7b8275b35b1', class: "load-more-container" }, h("feedlog-button", { key: '77d0bf2d339aaaabf8233752c923a224c120ae9d', onFeedlogClick: this.handleLoadMore, disabled: this.isLoadingMore, variant: "outline" }, this.isLoadingMore ? 'Loading...' : 'Load More Issues'))))))));
57
58
  }
58
59
  static get is() { return "feedlog-github-issues"; }
59
60
  static get encapsulation() { return "shadow"; }
@@ -154,7 +154,7 @@ export class FeedlogGithubIssuesClient {
154
154
  }
155
155
  }
156
156
  render() {
157
- return (h("feedlog-github-issues", { key: '39ee74bee86db7ff47d921cd771e5ce7c7468bb5', issues: this.issues, maxWidth: this.maxWidth, theme: this.theme, heading: this.heading, subtitle: this.subtitle, loading: this.loading, error: this.error, hasMore: this.hasMore, isLoadingMore: this.isLoadingMore, onFeedlogUpvote: this.handleUpvote, onFeedlogLoadMore: async () => this.loadMore() }));
157
+ return (h("feedlog-github-issues", { key: 'fe6a4397654075ddef24a3c28b2b1b0c515cfed1', issues: this.issues, maxWidth: this.maxWidth, theme: this.theme, heading: this.heading, subtitle: this.subtitle, loading: this.loading, error: this.error, hasMore: this.hasMore, isLoadingMore: this.isLoadingMore, onFeedlogUpvote: this.handleUpvote, onFeedlogLoadMore: async () => this.loadMore() }));
158
158
  }
159
159
  static get is() { return "feedlog-github-issues-client"; }
160
160
  static get encapsulation() { return "shadow"; }
@@ -1 +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-CHtSMTyP.js";import{d as n}from"./p-DMdb-G26.js";import{d as h}from"./p-Dhl83qnK.js";import{d as a}from"./p-BVUX_uVS.js";function u(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 c extends Error{constructor(t,e,s){super(t),this.statusCode=e,this.originalError=s,this.name="FeedlogError",Object.setPrototypeOf(this,c.prototype)}}class d extends c{constructor(t){super(t),this.name="FeedlogValidationError",Object.setPrototypeOf(this,d.prototype)}}class l extends c{constructor(t,e,s){super(t,e,s),this.name="FeedlogNetworkError",Object.setPrototypeOf(this,l.prototype)}}class p extends c{constructor(t="Request timed out"){super(t),this.name="FeedlogTimeoutError",Object.setPrototypeOf(this,p.prototype)}}class f{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 l("Failed to fetch issues: "+s.statusText,s.status);const i=await s.json();return this.validateIssuesResponse(i)}catch(t){if(t instanceof c)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new l("Network error: Unable to reach API",void 0,t);throw new c("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 l("Issue not found",404);if(401===s.status)throw new l("Unauthorized",401);if(403===s.status)throw new l("Forbidden: Domain not allowed for this repository",403);if(!s.ok)throw new l("Failed to toggle upvote: "+s.statusText,s.status);const i=await s.json();return this.validateUpvoteResponse(i)}catch(t){if(t instanceof c)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new l("Network error: Unable to reach API",void 0,t);throw new c("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),""+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 p(`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("string"!=typeof e.title)throw new d("Invalid issue: title 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","closed"].includes(e.status+""))throw new d('Invalid issue: status must be "open" 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||"string"!=typeof s.name||"string"!=typeof s.owner)throw new d("Invalid issue: repository must have id, name, and owner");const i=u(e.title+""),o=u((e.body||"")+"");return{id:e.id+"",type:e.type||"bug",status:e.status||"open",pinnedAt:e.pinnedAt?e.pinnedAt+"":null,revision:Number(e.revision)||1,title:i,body:o,repository:{id:s.id+"",name:s.name+"",owner:s.owner+""},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 w=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.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)),this.feedlogError.emit({error:t instanceof Error?t.message:"Failed to toggle upvote"})}}}componentWillLoad(){this.previousType=this.type,this.previousLimit=this.limit,this.initializeSDK(),this.fetchIssues()}componentDidUpdate(){(this.previousType!==this.type||this.previousLimit!==this.limit)&&(this.cursor=null,this.hasMore=!1,this.issues=[],this.fetchIssues(),this.previousType=this.type,this.previousLimit=this.limit)}initializeSDK(){try{if(!this.apiKey)throw Error("API key is required for the Feedlog SDK");this.sdk=new f(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)try{this.loading=!0,this.error=null;const t={};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=e.issues,this.cursor=e.pagination.cursor,this.hasMore=e.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={};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){this.feedlogError.emit({error:t instanceof Error?t.message:"Failed to load more issues",code:null==t?void 0:t.statusCode})}finally{this.isLoadingMore=!1}}}render(){return o("feedlog-github-issues",{key:"39ee74bee86db7ff47d921cd771e5ce7c7468bb5",issues:this.issues,maxWidth:this.maxWidth,theme:this.theme,heading:this.heading,subtitle:this.subtitle,loading:this.loading,error:this.error,hasMore:this.hasMore,isLoadingMore:this.isLoadingMore,onFeedlogUpvote:this.handleUpvote,onFeedlogLoadMore:async()=>this.loadMore()})}},[1,"feedlog-github-issues-client",{apiKey:[1,"api-key"],type:[1],limit:[2],endpoint:[1],maxWidth:[1,"max-width"],theme:[1],heading:[1],subtitle:[1],issues:[32],loading:[32],error:[32],cursor:[32],hasMore:[32],isLoadingMore:[32]}]);function g(){"undefined"!=typeof customElements&&["feedlog-github-issues-client","feedlog-badge","feedlog-button","feedlog-github-issues","feedlog-issues-list"].forEach((e=>{switch(e){case"feedlog-github-issues-client":customElements.get(t(e))||customElements.define(t(e),w);break;case"feedlog-badge":customElements.get(t(e))||r();break;case"feedlog-button":customElements.get(t(e))||n();break;case"feedlog-github-issues":customElements.get(t(e))||h();break;case"feedlog-issues-list":customElements.get(t(e))||a()}}))}g();const b=w,m=g;export{b as FeedlogGithubIssuesClient,m as defineCustomElement}
1
+ import{t,p as e,H as s,c as i,h as o}from"./index.js";import{d as r}from"./p-CHtSMTyP.js";import{d as n}from"./p-DMdb-G26.js";import{d as h}from"./p-DdMGlfRg.js";import{d as a}from"./p-BVUX_uVS.js";function u(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 c extends Error{constructor(t,e,s){super(t),this.statusCode=e,this.originalError=s,this.name="FeedlogError",Object.setPrototypeOf(this,c.prototype)}}class d extends c{constructor(t){super(t),this.name="FeedlogValidationError",Object.setPrototypeOf(this,d.prototype)}}class l extends c{constructor(t,e,s){super(t,e,s),this.name="FeedlogNetworkError",Object.setPrototypeOf(this,l.prototype)}}class p extends c{constructor(t="Request timed out"){super(t),this.name="FeedlogTimeoutError",Object.setPrototypeOf(this,p.prototype)}}class f{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 l("Failed to fetch issues: "+s.statusText,s.status);const i=await s.json();return this.validateIssuesResponse(i)}catch(t){if(t instanceof c)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new l("Network error: Unable to reach API",void 0,t);throw new c("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 l("Issue not found",404);if(401===s.status)throw new l("Unauthorized",401);if(403===s.status)throw new l("Forbidden: Domain not allowed for this repository",403);if(!s.ok)throw new l("Failed to toggle upvote: "+s.statusText,s.status);const i=await s.json();return this.validateUpvoteResponse(i)}catch(t){if(t instanceof c)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new l("Network error: Unable to reach API",void 0,t);throw new c("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),""+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 p(`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("string"!=typeof e.title)throw new d("Invalid issue: title 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","closed"].includes(e.status+""))throw new d('Invalid issue: status must be "open" 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||"string"!=typeof s.name||"string"!=typeof s.owner)throw new d("Invalid issue: repository must have id, name, and owner");const i=u(e.title+""),o=u((e.body||"")+"");return{id:e.id+"",type:e.type||"bug",status:e.status||"open",pinnedAt:e.pinnedAt?e.pinnedAt+"":null,revision:Number(e.revision)||1,title:i,body:o,repository:{id:s.id+"",name:s.name+"",owner:s.owner+""},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 w=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.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)),this.feedlogError.emit({error:t instanceof Error?t.message:"Failed to toggle upvote"})}}}componentWillLoad(){this.previousType=this.type,this.previousLimit=this.limit,this.initializeSDK(),this.fetchIssues()}componentDidUpdate(){(this.previousType!==this.type||this.previousLimit!==this.limit)&&(this.cursor=null,this.hasMore=!1,this.issues=[],this.fetchIssues(),this.previousType=this.type,this.previousLimit=this.limit)}initializeSDK(){try{if(!this.apiKey)throw Error("API key is required for the Feedlog SDK");this.sdk=new f(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)try{this.loading=!0,this.error=null;const t={};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=e.issues,this.cursor=e.pagination.cursor,this.hasMore=e.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={};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){this.feedlogError.emit({error:t instanceof Error?t.message:"Failed to load more issues",code:null==t?void 0:t.statusCode})}finally{this.isLoadingMore=!1}}}render(){return o("feedlog-github-issues",{key:"fe6a4397654075ddef24a3c28b2b1b0c515cfed1",issues:this.issues,maxWidth:this.maxWidth,theme:this.theme,heading:this.heading,subtitle:this.subtitle,loading:this.loading,error:this.error,hasMore:this.hasMore,isLoadingMore:this.isLoadingMore,onFeedlogUpvote:this.handleUpvote,onFeedlogLoadMore:async()=>this.loadMore()})}},[1,"feedlog-github-issues-client",{apiKey:[1,"api-key"],type:[1],limit:[2],endpoint:[1],maxWidth:[1,"max-width"],theme:[1],heading:[1],subtitle:[1],issues:[32],loading:[32],error:[32],cursor:[32],hasMore:[32],isLoadingMore:[32]}]);function g(){"undefined"!=typeof customElements&&["feedlog-github-issues-client","feedlog-badge","feedlog-button","feedlog-github-issues","feedlog-issues-list"].forEach((e=>{switch(e){case"feedlog-github-issues-client":customElements.get(t(e))||customElements.define(t(e),w);break;case"feedlog-badge":customElements.get(t(e))||r();break;case"feedlog-button":customElements.get(t(e))||n();break;case"feedlog-github-issues":customElements.get(t(e))||h();break;case"feedlog-issues-list":customElements.get(t(e))||a()}}))}g();const m=w,b=g;export{m as FeedlogGithubIssuesClient,b as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-Dhl83qnK.js";const p=o,r=s;export{p as FeedlogGithubIssues,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-DdMGlfRg.js";const p=o,r=s;export{p as FeedlogGithubIssues,r as defineCustomElement}
@@ -0,0 +1 @@
1
+ import{t as e,p as s,H as t,c as o,h as d,a as i}from"./index.js";import{d as a}from"./p-CHtSMTyP.js";import{d as r}from"./p-DMdb-G26.js";import{d as c}from"./p-BVUX_uVS.js";const l=s(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),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}render(){return d(i,{key:"57a57d901c1c45d66e6fe3658b3fbcbce6282018",class:"dark"===this.currentTheme?"dark":""},d("div",{key:"7ffe5de2a145065f0e58f5d1525aee5e5770806c",class:"github-issues-container",style:{maxWidth:this.maxWidth}},(this.heading||this.subtitle)&&d("header",{key:"413bf7d4c519f94f411ac9fc09e6776c14806871",class:"issues-header"},d("div",{key:"481b2feb7b34089e9cd69e602d5a8a1dc4ce88ec",class:"header-content"},this.heading&&d("h1",{key:"267a0cde7d18ad560c59c2a80150b9a0d5b613d5",class:"issues-title"},this.heading),this.subtitle&&d("p",{key:"6f71de0f4ac2b7c0b89cd24b24196e9a9a6576b3",class:"issues-subtitle"},this.subtitle))),this.loading&&d("div",{key:"6f9c52861aca5b5bd2137cf0ad929b13e7d74539",class:"loading-state"},d("p",{key:"d2a82cb61df5595fd74c5c9f6bbae825a4b2397c"},"Loading issues...")),this.error&&d("div",{key:"cd7ceea5eb432edc239ebf394661f659f04545d4",class:"error-state"},d("p",{key:"09657cce843d286cee8bdcf5c05aa5ffc35267f6"},"Error: ",this.error)),!this.loading&&!this.error&&d("div",{key:"73310effa8344b29e21b473b8cb64fee053eae26"},d("feedlog-issues-list",{key:"17183fa9301d1cdecaed3dcf9c21addd8871111b",issues:this.issues,theme:this.currentTheme,onFeedlogUpvote:this.handleUpvote}),this.hasMore&&d("div",{key:"9c7ef450db1b12f933f1ed83c6a5e7b8275b35b1",class:"load-more-container"},d("feedlog-button",{key:"77d0bf2d339aaaabf8233752c923a224c120ae9d",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],heading:[1],subtitle:[1],loading:[4],error:[1],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),l);break;case"feedlog-badge":customElements.get(e(s))||a();break;case"feedlog-button":customElements.get(e(s))||r();break;case"feedlog-issues-list":customElements.get(e(s))||c()}}))}f();export{l as F,f as d}
@@ -483,7 +483,7 @@ const FeedlogGithubIssuesClient = class {
483
483
  }
484
484
  }
485
485
  render() {
486
- return (h("feedlog-github-issues", { key: '39ee74bee86db7ff47d921cd771e5ce7c7468bb5', issues: this.issues, maxWidth: this.maxWidth, theme: this.theme, heading: this.heading, subtitle: this.subtitle, loading: this.loading, error: this.error, hasMore: this.hasMore, isLoadingMore: this.isLoadingMore, onFeedlogUpvote: this.handleUpvote, onFeedlogLoadMore: async () => this.loadMore() }));
486
+ return (h("feedlog-github-issues", { key: 'fe6a4397654075ddef24a3c28b2b1b0c515cfed1', issues: this.issues, maxWidth: this.maxWidth, theme: this.theme, heading: this.heading, subtitle: this.subtitle, loading: this.loading, error: this.error, hasMore: this.hasMore, isLoadingMore: this.isLoadingMore, onFeedlogUpvote: this.handleUpvote, onFeedlogLoadMore: async () => this.loadMore() }));
487
487
  }
488
488
  };
489
489
 
@@ -40,6 +40,7 @@ const FeedlogGithubIssues = class {
40
40
  */
41
41
  this.currentTheme = 'light';
42
42
  this.handleUpvote = (event) => {
43
+ event.stopPropagation();
43
44
  this.feedlogUpvote.emit(event.detail);
44
45
  };
45
46
  this.handleLoadMore = () => {
@@ -53,7 +54,7 @@ const FeedlogGithubIssues = class {
53
54
  const containerStyle = {
54
55
  maxWidth: this.maxWidth,
55
56
  };
56
- return (h(Host, { key: '473e30453d8b3a719bd977a361b7f669fdd88e48', class: this.currentTheme === 'dark' ? 'dark' : '' }, h("div", { key: 'ab91126edb301a1da6136f14441ec33833b6cd74', class: "github-issues-container", style: containerStyle }, (this.heading || this.subtitle) && (h("header", { key: '17494da495d2b2910e6f024f1c3971a945e0a1cc', class: "issues-header" }, h("div", { key: '95d5ac1c25ccfc864a863cafe1fa89d4ce04fce2', class: "header-content" }, this.heading && h("h1", { key: 'b37f9b9372e1b99da76c0fb9ee50d0a6cdbb0549', class: "issues-title" }, this.heading), this.subtitle && h("p", { key: '5edc92ca86f2dfd1afe640d77d65782e5ec27a8e', class: "issues-subtitle" }, this.subtitle)))), this.loading && (h("div", { key: 'f786656d24c8b88a57c7fa48f0d1877ac3565767', class: "loading-state" }, h("p", { key: 'fa97c2a05f52c2c1fbe0e907ac797cd6570d0a82' }, "Loading issues..."))), this.error && (h("div", { key: '798f3dc1ba004b2889aee6490b74240900ba3812', class: "error-state" }, h("p", { key: '03b996ab514027fce2e88a93901f3fe17d8da3e1' }, "Error: ", this.error))), !this.loading && !this.error && (h("div", { key: '67501ae1866122df2db6f97752d632013dbcd8a1' }, h("feedlog-issues-list", { key: 'c668c631f6ba6008df0a411bda7824bcce7318cd', issues: this.issues, theme: this.currentTheme, onFeedlogUpvote: this.handleUpvote }), this.hasMore && (h("div", { key: '28e1ea0600436f3ca8bf12e57e9764bf8899fa53', class: "load-more-container" }, h("feedlog-button", { key: 'f19576026d152e1b7f7957c83ccfee3c44727dd0', onFeedlogClick: this.handleLoadMore, disabled: this.isLoadingMore, variant: "outline" }, this.isLoadingMore ? 'Loading...' : 'Load More Issues'))))))));
57
+ return (h(Host, { key: '57a57d901c1c45d66e6fe3658b3fbcbce6282018', class: this.currentTheme === 'dark' ? 'dark' : '' }, h("div", { key: '7ffe5de2a145065f0e58f5d1525aee5e5770806c', class: "github-issues-container", style: containerStyle }, (this.heading || this.subtitle) && (h("header", { key: '413bf7d4c519f94f411ac9fc09e6776c14806871', class: "issues-header" }, h("div", { key: '481b2feb7b34089e9cd69e602d5a8a1dc4ce88ec', class: "header-content" }, this.heading && h("h1", { key: '267a0cde7d18ad560c59c2a80150b9a0d5b613d5', class: "issues-title" }, this.heading), this.subtitle && h("p", { key: '6f71de0f4ac2b7c0b89cd24b24196e9a9a6576b3', class: "issues-subtitle" }, this.subtitle)))), this.loading && (h("div", { key: '6f9c52861aca5b5bd2137cf0ad929b13e7d74539', class: "loading-state" }, h("p", { key: 'd2a82cb61df5595fd74c5c9f6bbae825a4b2397c' }, "Loading issues..."))), this.error && (h("div", { key: 'cd7ceea5eb432edc239ebf394661f659f04545d4', class: "error-state" }, h("p", { key: '09657cce843d286cee8bdcf5c05aa5ffc35267f6' }, "Error: ", this.error))), !this.loading && !this.error && (h("div", { key: '73310effa8344b29e21b473b8cb64fee053eae26' }, h("feedlog-issues-list", { key: '17183fa9301d1cdecaed3dcf9c21addd8871111b', issues: this.issues, theme: this.currentTheme, onFeedlogUpvote: this.handleUpvote }), this.hasMore && (h("div", { key: '9c7ef450db1b12f933f1ed83c6a5e7b8275b35b1', class: "load-more-container" }, h("feedlog-button", { key: '77d0bf2d339aaaabf8233752c923a224c120ae9d', onFeedlogClick: this.handleLoadMore, disabled: this.isLoadingMore, variant: "outline" }, this.isLoadingMore ? 'Loading...' : 'Load More Issues'))))))));
57
58
  }
58
59
  };
59
60
  FeedlogGithubIssues.style = feedlogGithubIssuesCss();
@@ -1 +1 @@
1
- import{p as e,g as i,b as a}from"./p-CkB6Yzeb.js";export{s as setNonce}from"./p-CkB6Yzeb.js";(()=>{const s=import.meta.url,i={};return""!==s&&(i.resourcesUrl=new URL(".",s).href),e(i)})().then((async e=>(await i(),a([["p-cdb2b098",[[257,"feedlog-card"]]],["p-125595a1",[[1,"feedlog-issues-list",{issues:[16],theme:[1]}],[257,"feedlog-button",{variant:[1],size:[1],disabled:[4],type:[1]}],[257,"feedlog-badge",{variant:[1]}]]],["p-5fc3d243",[[1,"feedlog-github-issues",{issues:[16],maxWidth:[1,"max-width"],theme:[1025],heading:[1],subtitle:[1],loading:[4],error:[1],hasMore:[4,"has-more"],isLoadingMore:[4,"is-loading-more"],currentTheme:[32]}]]],["p-ee48d93a",[[1,"feedlog-github-issues-client",{apiKey:[1,"api-key"],type:[1],limit:[2],endpoint:[1],maxWidth:[1,"max-width"],theme:[1],heading:[1],subtitle:[1],issues:[32],loading:[32],error:[32],cursor:[32],hasMore:[32],isLoadingMore:[32]}]]]],e))));
1
+ import{p as e,g as i,b as a}from"./p-CkB6Yzeb.js";export{s as setNonce}from"./p-CkB6Yzeb.js";(()=>{const s=import.meta.url,i={};return""!==s&&(i.resourcesUrl=new URL(".",s).href),e(i)})().then((async e=>(await i(),a([["p-cdb2b098",[[257,"feedlog-card"]]],["p-125595a1",[[1,"feedlog-issues-list",{issues:[16],theme:[1]}],[257,"feedlog-button",{variant:[1],size:[1],disabled:[4],type:[1]}],[257,"feedlog-badge",{variant:[1]}]]],["p-f16f2491",[[1,"feedlog-github-issues",{issues:[16],maxWidth:[1,"max-width"],theme:[1025],heading:[1],subtitle:[1],loading:[4],error:[1],hasMore:[4,"has-more"],isLoadingMore:[4,"is-loading-more"],currentTheme:[32]}]]],["p-964cfcd8",[[1,"feedlog-github-issues-client",{apiKey:[1,"api-key"],type:[1],limit:[2],endpoint:[1],maxWidth:[1,"max-width"],theme:[1],heading:[1],subtitle:[1],issues:[32],loading:[32],error:[32],cursor:[32],hasMore:[32],isLoadingMore:[32]}]]]],e))));
@@ -1 +1 @@
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){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 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",body:JSON.stringify({})});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(){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 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.feedlogError=e(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.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})}}}componentWillLoad(){this.previousType=this.type,this.previousLimit=this.limit,this.initializeSDK(),this.fetchIssues()}componentDidUpdate(){(this.previousType!==this.type||this.previousLimit!==this.limit)&&(this.cursor=null,this.hasMore=!1,this.issues=[],this.fetchIssues(),this.previousType=this.type,this.previousLimit=this.limit)}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 e=t instanceof Error?t.message:"Failed to initialize SDK";this.error=e,this.feedlogError.emit({error:e})}}async fetchIssues(){if(this.sdk)try{this.loading=!0,this.error=null;const t={};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=e.issues,this.cursor=e.pagination.cursor,this.hasMore=e.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={};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:"39ee74bee86db7ff47d921cd771e5ce7c7468bb5",issues:this.issues,maxWidth:this.maxWidth,theme:this.theme,heading:this.heading,subtitle:this.subtitle,loading:this.loading,error:this.error,hasMore:this.hasMore,isLoadingMore:this.isLoadingMore,onFeedlogUpvote:this.handleUpvote,onFeedlogLoadMore:async()=>this.loadMore()})}};export{c as feedlog_github_issues_client}
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){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 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",body:JSON.stringify({})});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(){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 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.feedlogError=e(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.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})}}}componentWillLoad(){this.previousType=this.type,this.previousLimit=this.limit,this.initializeSDK(),this.fetchIssues()}componentDidUpdate(){(this.previousType!==this.type||this.previousLimit!==this.limit)&&(this.cursor=null,this.hasMore=!1,this.issues=[],this.fetchIssues(),this.previousType=this.type,this.previousLimit=this.limit)}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 e=t instanceof Error?t.message:"Failed to initialize SDK";this.error=e,this.feedlogError.emit({error:e})}}async fetchIssues(){if(this.sdk)try{this.loading=!0,this.error=null;const t={};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=e.issues,this.cursor=e.pagination.cursor,this.hasMore=e.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={};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:"fe6a4397654075ddef24a3c28b2b1b0c515cfed1",issues:this.issues,maxWidth:this.maxWidth,theme:this.theme,heading:this.heading,subtitle:this.subtitle,loading:this.loading,error:this.error,hasMore:this.hasMore,isLoadingMore:this.isLoadingMore,onFeedlogUpvote:this.handleUpvote,onFeedlogLoadMore:async()=>this.loadMore()})}};export{c as feedlog_github_issues_client}
@@ -0,0 +1 @@
1
+ import{r as e,c as s,h as t,H as d}from"./p-CkB6Yzeb.js";const o=class{constructor(t){e(this,t),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}render(){return t(d,{key:"57a57d901c1c45d66e6fe3658b3fbcbce6282018",class:"dark"===this.currentTheme?"dark":""},t("div",{key:"7ffe5de2a145065f0e58f5d1525aee5e5770806c",class:"github-issues-container",style:{maxWidth:this.maxWidth}},(this.heading||this.subtitle)&&t("header",{key:"413bf7d4c519f94f411ac9fc09e6776c14806871",class:"issues-header"},t("div",{key:"481b2feb7b34089e9cd69e602d5a8a1dc4ce88ec",class:"header-content"},this.heading&&t("h1",{key:"267a0cde7d18ad560c59c2a80150b9a0d5b613d5",class:"issues-title"},this.heading),this.subtitle&&t("p",{key:"6f71de0f4ac2b7c0b89cd24b24196e9a9a6576b3",class:"issues-subtitle"},this.subtitle))),this.loading&&t("div",{key:"6f9c52861aca5b5bd2137cf0ad929b13e7d74539",class:"loading-state"},t("p",{key:"d2a82cb61df5595fd74c5c9f6bbae825a4b2397c"},"Loading issues...")),this.error&&t("div",{key:"cd7ceea5eb432edc239ebf394661f659f04545d4",class:"error-state"},t("p",{key:"09657cce843d286cee8bdcf5c05aa5ffc35267f6"},"Error: ",this.error)),!this.loading&&!this.error&&t("div",{key:"73310effa8344b29e21b473b8cb64fee053eae26"},t("feedlog-issues-list",{key:"17183fa9301d1cdecaed3dcf9c21addd8871111b",issues:this.issues,theme:this.currentTheme,onFeedlogUpvote:this.handleUpvote}),this.hasMore&&t("div",{key:"9c7ef450db1b12f933f1ed83c6a5e7b8275b35b1",class:"load-more-container"},t("feedlog-button",{key:"77d0bf2d339aaaabf8233752c923a224c120ae9d",onFeedlogClick:this.handleLoadMore,disabled:this.isLoadingMore,variant:"outline"},this.isLoadingMore?"Loading...":"Load More Issues")))))}};o.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{o as feedlog_github_issues}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedlog-ai/webcomponents",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
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",
@@ -19,12 +19,12 @@
19
19
  "test": "stencil test --spec",
20
20
  "test:watch": "stencil test --spec --watch",
21
21
  "test:coverage": "echo 'Webcomponents coverage skipped due to rollup issues'",
22
- "storybook": "storybook dev -p 6008 --no-open",
22
+ "storybook": "storybook dev -p 6010 --no-open",
23
23
  "build-storybook": "storybook build",
24
24
  "clean": "rm -rf dist loader"
25
25
  },
26
26
  "dependencies": {
27
- "@feedlog-ai/core": "*"
27
+ "@feedlog-ai/core": "^0.0.8"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@stencil/core": "^4.0.0",
@@ -1 +0,0 @@
1
- import{t as e,p as s,H as t,c as o,h as d,a}from"./index.js";import{d as i}from"./p-CHtSMTyP.js";import{d as r}from"./p-DMdb-G26.js";import{d as c}from"./p-BVUX_uVS.js";const l=s(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),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=>{this.feedlogUpvote.emit(e.detail)},this.handleLoadMore=()=>{this.feedlogLoadMore.emit()}}componentWillLoad(){this.currentTheme=this.theme}render(){return d(a,{key:"473e30453d8b3a719bd977a361b7f669fdd88e48",class:"dark"===this.currentTheme?"dark":""},d("div",{key:"ab91126edb301a1da6136f14441ec33833b6cd74",class:"github-issues-container",style:{maxWidth:this.maxWidth}},(this.heading||this.subtitle)&&d("header",{key:"17494da495d2b2910e6f024f1c3971a945e0a1cc",class:"issues-header"},d("div",{key:"95d5ac1c25ccfc864a863cafe1fa89d4ce04fce2",class:"header-content"},this.heading&&d("h1",{key:"b37f9b9372e1b99da76c0fb9ee50d0a6cdbb0549",class:"issues-title"},this.heading),this.subtitle&&d("p",{key:"5edc92ca86f2dfd1afe640d77d65782e5ec27a8e",class:"issues-subtitle"},this.subtitle))),this.loading&&d("div",{key:"f786656d24c8b88a57c7fa48f0d1877ac3565767",class:"loading-state"},d("p",{key:"fa97c2a05f52c2c1fbe0e907ac797cd6570d0a82"},"Loading issues...")),this.error&&d("div",{key:"798f3dc1ba004b2889aee6490b74240900ba3812",class:"error-state"},d("p",{key:"03b996ab514027fce2e88a93901f3fe17d8da3e1"},"Error: ",this.error)),!this.loading&&!this.error&&d("div",{key:"67501ae1866122df2db6f97752d632013dbcd8a1"},d("feedlog-issues-list",{key:"c668c631f6ba6008df0a411bda7824bcce7318cd",issues:this.issues,theme:this.currentTheme,onFeedlogUpvote:this.handleUpvote}),this.hasMore&&d("div",{key:"28e1ea0600436f3ca8bf12e57e9764bf8899fa53",class:"load-more-container"},d("feedlog-button",{key:"f19576026d152e1b7f7957c83ccfee3c44727dd0",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],heading:[1],subtitle:[1],loading:[4],error:[1],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),l);break;case"feedlog-badge":customElements.get(e(s))||i();break;case"feedlog-button":customElements.get(e(s))||r();break;case"feedlog-issues-list":customElements.get(e(s))||c()}}))}f();export{l as F,f as d}
@@ -1 +0,0 @@
1
- import{r as e,c as s,h as t,H as d}from"./p-CkB6Yzeb.js";const o=class{constructor(t){e(this,t),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=>{this.feedlogUpvote.emit(e.detail)},this.handleLoadMore=()=>{this.feedlogLoadMore.emit()}}componentWillLoad(){this.currentTheme=this.theme}render(){return t(d,{key:"473e30453d8b3a719bd977a361b7f669fdd88e48",class:"dark"===this.currentTheme?"dark":""},t("div",{key:"ab91126edb301a1da6136f14441ec33833b6cd74",class:"github-issues-container",style:{maxWidth:this.maxWidth}},(this.heading||this.subtitle)&&t("header",{key:"17494da495d2b2910e6f024f1c3971a945e0a1cc",class:"issues-header"},t("div",{key:"95d5ac1c25ccfc864a863cafe1fa89d4ce04fce2",class:"header-content"},this.heading&&t("h1",{key:"b37f9b9372e1b99da76c0fb9ee50d0a6cdbb0549",class:"issues-title"},this.heading),this.subtitle&&t("p",{key:"5edc92ca86f2dfd1afe640d77d65782e5ec27a8e",class:"issues-subtitle"},this.subtitle))),this.loading&&t("div",{key:"f786656d24c8b88a57c7fa48f0d1877ac3565767",class:"loading-state"},t("p",{key:"fa97c2a05f52c2c1fbe0e907ac797cd6570d0a82"},"Loading issues...")),this.error&&t("div",{key:"798f3dc1ba004b2889aee6490b74240900ba3812",class:"error-state"},t("p",{key:"03b996ab514027fce2e88a93901f3fe17d8da3e1"},"Error: ",this.error)),!this.loading&&!this.error&&t("div",{key:"67501ae1866122df2db6f97752d632013dbcd8a1"},t("feedlog-issues-list",{key:"c668c631f6ba6008df0a411bda7824bcce7318cd",issues:this.issues,theme:this.currentTheme,onFeedlogUpvote:this.handleUpvote}),this.hasMore&&t("div",{key:"28e1ea0600436f3ca8bf12e57e9764bf8899fa53",class:"load-more-container"},t("feedlog-button",{key:"f19576026d152e1b7f7957c83ccfee3c44727dd0",onFeedlogClick:this.handleLoadMore,disabled:this.isLoadingMore,variant:"outline"},this.isLoadingMore?"Loading...":"Load More Issues")))))}};o.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{o as feedlog_github_issues}