@feedlog-ai/webcomponents 0.0.9 → 0.0.11

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 (51) hide show
  1. package/dist/cjs/feedlog-badge.cjs.entry.js +21 -0
  2. package/dist/cjs/feedlog-button_2.cjs.entry.js +101 -0
  3. package/dist/cjs/feedlog-github-issues-client.cjs.entry.js +55 -5
  4. package/dist/cjs/feedlog-github-issues.cjs.entry.js +5 -2
  5. package/dist/cjs/feedlog-issues-list.cjs.entry.js +66 -0
  6. package/dist/cjs/feedlog-toolkit.cjs.js +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/collection/collection-manifest.json +1 -0
  9. package/dist/collection/components/feedlog-github-issues/feedlog-github-issues.css +36 -1
  10. package/dist/collection/components/feedlog-github-issues/feedlog-github-issues.js +7 -4
  11. package/dist/collection/components/feedlog-github-issues-client/feedlog-github-issues-client.js +55 -5
  12. package/dist/collection/components/feedlog-issue/feedlog-issue.css +205 -0
  13. package/dist/collection/components/feedlog-issue/feedlog-issue.js +137 -0
  14. package/dist/collection/components/feedlog-issue/feedlog-issue.stories.js +113 -0
  15. package/dist/collection/components/feedlog-issues-list/feedlog-issues-list.css +64 -55
  16. package/dist/collection/components/feedlog-issues-list/feedlog-issues-list.js +6 -6
  17. package/dist/collection/components/index.js +1 -0
  18. package/dist/components/feedlog-github-issues-client.js +1 -1
  19. package/dist/components/feedlog-github-issues.js +1 -1
  20. package/dist/components/feedlog-issue.d.ts +11 -0
  21. package/dist/components/feedlog-issue.js +1 -0
  22. package/dist/components/feedlog-issues-list.js +1 -1
  23. package/dist/components/p-5qPAHrMz.js +1 -0
  24. package/dist/components/p-DaNa3wCt.js +1 -0
  25. package/dist/esm/feedlog-badge.entry.js +19 -0
  26. package/dist/esm/feedlog-button_2.entry.js +98 -0
  27. package/dist/esm/feedlog-github-issues-client.entry.js +55 -5
  28. package/dist/esm/feedlog-github-issues.entry.js +5 -2
  29. package/dist/esm/feedlog-issues-list.entry.js +64 -0
  30. package/dist/esm/feedlog-toolkit.js +1 -1
  31. package/dist/esm/loader.js +1 -1
  32. package/dist/feedlog-toolkit/feedlog-toolkit.esm.js +1 -1
  33. package/dist/feedlog-toolkit/p-386ab9fb.entry.js +1 -0
  34. package/dist/feedlog-toolkit/p-5df44120.entry.js +1 -0
  35. package/dist/feedlog-toolkit/{p-964cfcd8.entry.js → p-767ecb94.entry.js} +1 -1
  36. package/dist/feedlog-toolkit/p-95fea2f4.entry.js +1 -0
  37. package/dist/feedlog-toolkit/p-f172074f.entry.js +1 -0
  38. package/dist/types/components/feedlog-github-issues/feedlog-github-issues.d.ts +4 -3
  39. package/dist/types/components/feedlog-github-issues-client/feedlog-github-issues-client.d.ts +9 -2
  40. package/dist/types/components/feedlog-issue/feedlog-issue.d.ts +31 -0
  41. package/dist/types/components/feedlog-issue/feedlog-issue.stories.d.ts +12 -0
  42. package/dist/types/components/feedlog-issues-list/feedlog-issues-list.d.ts +4 -4
  43. package/dist/types/components/index.d.ts +1 -0
  44. package/dist/types/components.d.ts +85 -11
  45. package/package.json +2 -2
  46. package/dist/cjs/feedlog-badge_3.cjs.entry.js +0 -119
  47. package/dist/components/p-C7AZiNqt.js +0 -1
  48. package/dist/components/p-rh0Uv7Ks.js +0 -1
  49. package/dist/esm/feedlog-badge_3.entry.js +0 -115
  50. package/dist/feedlog-toolkit/p-4874f7e8.entry.js +0 -1
  51. package/dist/feedlog-toolkit/p-f16f2491.entry.js +0 -1
@@ -352,16 +352,29 @@ const FeedlogGithubIssuesClient = class {
352
352
  this.hasMore = false;
353
353
  this.isLoadingMore = false;
354
354
  this.sdk = null;
355
+ /** Counter to track fetch operations and prevent stale updates */
356
+ this.fetchRequestId = 0;
357
+ /** Flag to prevent state updates after component disconnect */
358
+ this.isDisconnected = false;
359
+ /** Map to track the latest upvote request ID for each issue to handle race conditions */
360
+ this.upvoteRequestIds = new Map();
355
361
  this.handleUpvote = async (event) => {
356
- if (!this.sdk) {
362
+ if (!this.sdk || this.isDisconnected) {
357
363
  return;
358
364
  }
359
365
  const { issueId, currentUpvoted, currentCount } = event.detail;
366
+ // Track request to handle race conditions
367
+ const requestId = (this.upvoteRequestIds.get(issueId) || 0) + 1;
368
+ this.upvoteRequestIds.set(issueId, requestId);
360
369
  // Optimistic update
361
370
  this.issues = this.issues.map(issue => issue.id === issueId
362
371
  ? Object.assign(Object.assign({}, issue), { hasUpvoted: !currentUpvoted, upvoteCount: currentUpvoted ? currentCount - 1 : currentCount + 1 }) : issue);
363
372
  try {
364
373
  const result = await this.sdk.toggleUpvote(issueId);
374
+ // Ignore if component disconnected or request is stale
375
+ if (this.isDisconnected || this.upvoteRequestIds.get(issueId) !== requestId) {
376
+ return;
377
+ }
365
378
  // Update with server response
366
379
  this.issues = this.issues.map(issue => issue.id === issueId
367
380
  ? Object.assign(Object.assign({}, issue), { hasUpvoted: result.upvoted, upvoteCount: result.upvoteCount }) : issue);
@@ -372,6 +385,10 @@ const FeedlogGithubIssuesClient = class {
372
385
  });
373
386
  }
374
387
  catch (err) {
388
+ // Ignore if component disconnected or request is stale
389
+ if (this.isDisconnected || this.upvoteRequestIds.get(issueId) !== requestId) {
390
+ return;
391
+ }
375
392
  // Revert optimistic update on error
376
393
  this.issues = this.issues.map(issue => issue.id === issueId
377
394
  ? Object.assign(Object.assign({}, issue), { hasUpvoted: currentUpvoted, upvoteCount: currentCount }) : issue);
@@ -386,11 +403,18 @@ const FeedlogGithubIssuesClient = class {
386
403
  this.initializeSDK();
387
404
  this.fetchIssues();
388
405
  }
406
+ disconnectedCallback() {
407
+ // Prevent any pending async operations from updating state
408
+ this.isDisconnected = true;
409
+ this.fetchRequestId++;
410
+ }
389
411
  componentDidUpdate() {
390
412
  // Re-fetch if any props changed
391
413
  const typeChanged = this.previousType !== this.type;
392
414
  const limitChanged = this.previousLimit !== this.limit;
393
415
  if (typeChanged || limitChanged) {
416
+ // Invalidate any in-flight requests
417
+ this.fetchRequestId++;
394
418
  // Reset pagination when filters change
395
419
  this.cursor = null;
396
420
  this.hasMore = false;
@@ -418,6 +442,8 @@ const FeedlogGithubIssuesClient = class {
418
442
  if (!this.sdk) {
419
443
  return;
420
444
  }
445
+ // Capture current request ID to detect stale responses
446
+ const currentRequestId = this.fetchRequestId;
421
447
  try {
422
448
  this.loading = true;
423
449
  this.error = null;
@@ -432,11 +458,19 @@ const FeedlogGithubIssuesClient = class {
432
458
  params.cursor = this.cursor;
433
459
  }
434
460
  const response = await this.sdk.fetchIssues(params);
461
+ // Ignore response if component disconnected or a newer request was made
462
+ if (this.isDisconnected || currentRequestId !== this.fetchRequestId) {
463
+ return;
464
+ }
435
465
  this.issues = response.issues;
436
466
  this.cursor = response.pagination.cursor;
437
467
  this.hasMore = response.pagination.hasMore;
438
468
  }
439
469
  catch (err) {
470
+ // Ignore errors from stale requests
471
+ if (this.isDisconnected || currentRequestId !== this.fetchRequestId) {
472
+ return;
473
+ }
440
474
  const errorMsg = err instanceof Error ? err.message : 'Failed to fetch issues';
441
475
  this.error = errorMsg;
442
476
  this.issues = [];
@@ -446,14 +480,19 @@ const FeedlogGithubIssuesClient = class {
446
480
  });
447
481
  }
448
482
  finally {
449
- this.loading = false;
450
- this.isLoadingMore = false;
483
+ // Only update loading state if this is still the current request
484
+ if (!this.isDisconnected && currentRequestId === this.fetchRequestId) {
485
+ this.loading = false;
486
+ this.isLoadingMore = false;
487
+ }
451
488
  }
452
489
  }
453
490
  async loadMore() {
454
491
  if (!this.sdk || !this.hasMore || this.isLoadingMore || this.loading) {
455
492
  return;
456
493
  }
494
+ // Capture current request ID to detect stale responses
495
+ const currentRequestId = this.fetchRequestId;
457
496
  this.isLoadingMore = true;
458
497
  try {
459
498
  const params = {};
@@ -467,11 +506,19 @@ const FeedlogGithubIssuesClient = class {
467
506
  params.cursor = this.cursor;
468
507
  }
469
508
  const response = await this.sdk.fetchIssues(params);
509
+ // Ignore response if component disconnected or a newer request was made
510
+ if (this.isDisconnected || currentRequestId !== this.fetchRequestId) {
511
+ return;
512
+ }
470
513
  this.issues = [...this.issues, ...response.issues];
471
514
  this.cursor = response.pagination.cursor;
472
515
  this.hasMore = response.pagination.hasMore;
473
516
  }
474
517
  catch (err) {
518
+ // Ignore errors from stale requests
519
+ if (this.isDisconnected || currentRequestId !== this.fetchRequestId) {
520
+ return;
521
+ }
475
522
  const errorMsg = err instanceof Error ? err.message : 'Failed to load more issues';
476
523
  this.feedlogError.emit({
477
524
  error: errorMsg,
@@ -479,11 +526,14 @@ const FeedlogGithubIssuesClient = class {
479
526
  });
480
527
  }
481
528
  finally {
482
- this.isLoadingMore = false;
529
+ // Only update loading state if this is still the current request
530
+ if (!this.isDisconnected && currentRequestId === this.fetchRequestId) {
531
+ this.isLoadingMore = false;
532
+ }
483
533
  }
484
534
  }
485
535
  render() {
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() }));
536
+ return (h("feedlog-github-issues", { key: 'bb63dd29e99dfd9418b6cb12a1f45dff086378ab', 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
537
  }
488
538
  };
489
539
 
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-CkB6Yzeb.js';
2
2
 
3
- const feedlogGithubIssuesCss = () => `: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}`;
3
+ const feedlogGithubIssuesCss = () => `: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-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}:host(.dark){--feedlog-background:oklch(0.145 0 0);--feedlog-foreground:oklch(0.985 0 0);--feedlog-card:oklch(0.145 0 0);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.269 0 0);--feedlog-muted-foreground:oklch(0.708 0 0);--feedlog-border:oklch(0.269 0 0);--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)}.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)}.issues-list{display:flex;flex-direction:column;gap:var(--feedlog-gap)}.empty-state{text-align:center;padding:3rem 1.5rem;color:var(--feedlog-muted-foreground);font-size:0.875rem}.load-more-container{display:flex;justify-content:center;padding:2rem 0;gap:1rem}`;
4
4
 
5
5
  const FeedlogGithubIssues = class {
6
6
  constructor(hostRef) {
@@ -50,11 +50,14 @@ const FeedlogGithubIssues = class {
50
50
  componentWillLoad() {
51
51
  this.currentTheme = this.theme;
52
52
  }
53
+ renderIssuesList() {
54
+ return (h("div", { class: "issues-list" }, this.issues.length === 0 ? (h("div", { class: "empty-state" }, h("p", null, "No issues found"))) : (this.issues.map(issue => (h("feedlog-issue", { key: issue.id, issue: issue, theme: this.currentTheme, onFeedlogUpvote: (e) => this.handleUpvote(e) }))))));
55
+ }
53
56
  render() {
54
57
  const containerStyle = {
55
58
  maxWidth: this.maxWidth,
56
59
  };
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'))))))));
60
+ return (h(Host, { key: '3d3f6aaaf7efc9bf81476e1ff793d68a8fc46db1', class: this.currentTheme === 'dark' ? 'dark' : '' }, h("div", { key: 'b3114878ce3b649bb1dbec9eb2502bad2c2dfe27', class: "github-issues-container", style: containerStyle }, (this.heading || this.subtitle) && (h("header", { key: '3effa7137e3138b8709f12442beaaf58f7873e91', class: "issues-header" }, h("div", { key: '7904676ced41f4c738c265a571d2a447155f13f3', class: "header-content" }, this.heading && h("h1", { key: 'f139c2087642ede74542be0064273d92f27938d7', class: "issues-title" }, this.heading), this.subtitle && h("p", { key: 'c3af89d4abfb48ba225f362031705a14833f0ab7', class: "issues-subtitle" }, this.subtitle)))), this.loading && (h("div", { key: '1ed8c88a52808bbfb3a1ac86c9535cb87f32773a', class: "loading-state" }, h("p", { key: 'd093c2edcfaba2c136c6915bfe183f7e8f25de8b' }, "Loading issues..."))), this.error && (h("div", { key: '05ab37ee5c061a321fc7a8c407af04cae269f304', class: "error-state" }, h("p", { key: '7388ef1b66265953f30b65618f2b96c519702bdb' }, "Error: ", this.error))), !this.loading && !this.error && (h("div", { key: '5968b7ad6c13c7d0edf0a497eb51bd88978def9c' }, this.renderIssuesList(), this.hasMore && (h("div", { key: '7cfe136735f497f239a5be2befa6c3add99c7bcb', class: "load-more-container" }, h("feedlog-button", { key: '6fcdaf69873d51518d58baa9c3f8dba8a705ad5f', onFeedlogClick: this.handleLoadMore, disabled: this.isLoadingMore, variant: "outline" }, this.isLoadingMore ? 'Loading...' : 'Load More Issues'))))))));
58
61
  }
59
62
  };
60
63
  FeedlogGithubIssues.style = feedlogGithubIssuesCss();
@@ -0,0 +1,64 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-CkB6Yzeb.js';
2
+
3
+ const feedlogIssuesListCss = () => `: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-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}:host(.dark){--feedlog-background:oklch(0.145 0 0);--feedlog-foreground:oklch(0.985 0 0);--feedlog-card:oklch(0.145 0 0);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.269 0 0);--feedlog-muted-foreground:oklch(0.708 0 0);--feedlog-border:oklch(0.269 0 0);--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)}.issues-list{display:flex;flex-direction:column;gap:var(--feedlog-gap)}.empty-state{text-align:center;padding:3rem 1.5rem;color:var(--feedlog-muted-foreground);font-size:0.875rem}.issue-card{background-color:var(--feedlog-card);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);box-shadow:0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);transition:box-shadow 0.15s ease;position:relative}.issue-card:hover{box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)}.issue-content{padding:1.5rem;display:flex;flex-direction:column;gap:1rem}.issue-header{display:flex;align-items:center;gap:0.5rem;justify-content:space-between}.issue-type-badge{width:fit-content}.pinned-indicator{font-size:1rem;opacity:0.7}.issue-main{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}.issue-details{flex:1;min-width:0}.issue-title{margin:0 0 0.5rem 0;font-size:1rem;font-weight:600;color:var(--feedlog-card-foreground);line-height:1.5;word-wrap:break-word}.issue-body{margin:0 0 0.75rem 0;font-size:0.875rem;color:var(--feedlog-muted-foreground);line-height:1.5;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;word-wrap:break-word}.issue-repository{display:flex;align-items:center;gap:0.5rem;font-size:0.75rem;color:var(--feedlog-muted-foreground)}.repo-name{font-weight:500}.github-number{background-color:var(--feedlog-muted);padding:0.125rem 0.375rem;border-radius:0.25rem;font-family:ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace}.upvote-button{display:flex;align-items:center;gap:0.375rem;padding:0.5rem 0.75rem;background-color:var(--feedlog-muted);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);color:var(--feedlog-muted-foreground);font-size:0.875rem;font-weight:500;cursor:pointer;transition:all 0.15s ease;white-space:nowrap}.upvote-button:hover{background-color:var(--feedlog-accent-color);color:white}.upvote-button.upvoted{background-color:var(--feedlog-destructive);color:white;border-color:var(--feedlog-destructive)}.upvote-button.upvoted:hover{background-color:var(--feedlog-red-600);border-color:var(--feedlog-red-600)}.upvote-icon{width:1rem;height:1rem;flex-shrink:0}.upvote-icon.filled{color:currentColor}.upvote-icon.outline{stroke:currentColor}.upvote-count{font-variant-numeric:tabular-nums}.issue-footer{display:flex;align-items:center;gap:1rem;font-size:0.75rem;color:var(--feedlog-muted-foreground)}.issue-date{white-space:nowrap}@media (max-width: 640px){.issue-content{padding:1rem;gap:0.75rem}.issue-main{flex-direction:column;align-items:stretch;gap:0.75rem}.upvote-button{align-self:flex-start}.issue-footer{flex-direction:column;align-items:flex-start;gap:0.25rem}}`;
4
+
5
+ /**
6
+ * Heart icon SVG component (filled)
7
+ */
8
+ const HeartFilledIcon = () => (h("svg", { class: "upvote-icon filled", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", stroke: "none" }, h("path", { d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" })));
9
+ /**
10
+ * Heart icon SVG component (outline)
11
+ */
12
+ const HeartOutlineIcon = () => (h("svg", { class: "upvote-icon outline", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" })));
13
+ const FeedlogIssuesList = class {
14
+ constructor(hostRef) {
15
+ registerInstance(this, hostRef);
16
+ this.feedlogUpvote = createEvent(this, "feedlogUpvote");
17
+ /**
18
+ * Array of issues to display
19
+ */
20
+ this.issues = [];
21
+ /**
22
+ * Theme variant: 'light' or 'dark'
23
+ */
24
+ this.theme = 'light';
25
+ this.handleUpvote = (event, issue) => {
26
+ event.stopPropagation();
27
+ this.feedlogUpvote.emit({
28
+ issueId: issue.id,
29
+ currentUpvoted: issue.hasUpvoted,
30
+ currentCount: issue.upvoteCount,
31
+ });
32
+ };
33
+ }
34
+ /**
35
+ * Format an ISO date string to a relative time string
36
+ */
37
+ formatDate(dateString) {
38
+ try {
39
+ const date = new Date(dateString);
40
+ const now = new Date();
41
+ const seconds = Math.floor((now.getTime() - date.getTime()) / 1000);
42
+ if (seconds < 60)
43
+ return 'just now';
44
+ if (seconds < 3600)
45
+ return `${Math.floor(seconds / 60)}m ago`;
46
+ if (seconds < 86400)
47
+ return `${Math.floor(seconds / 3600)}h ago`;
48
+ if (seconds < 604800)
49
+ return `${Math.floor(seconds / 86400)}d ago`;
50
+ if (seconds < 2592000)
51
+ return `${Math.floor(seconds / 604800)}w ago`;
52
+ return date.toLocaleDateString();
53
+ }
54
+ catch (_a) {
55
+ return 'unknown date';
56
+ }
57
+ }
58
+ render() {
59
+ return (h(Host, { key: 'a4085d69641f9c21255f556e9ba65cefc189fab6', class: this.theme === 'dark' ? 'dark' : '' }, h("div", { key: '8420abca5d206440a60d9e0840a35268ba698fee', class: "issues-list" }, this.issues.length === 0 ? (h("div", { class: "empty-state" }, h("p", null, "No issues found"))) : (this.issues.map(issue => (h("div", { key: issue.id, class: "issue-card" }, h("div", { class: "issue-content" }, h("div", { class: "issue-header" }, h("div", { class: "issue-type-badge" }, issue.type === 'bug' ? (h("feedlog-badge", { variant: "destructive" }, "Bug")) : (h("feedlog-badge", { variant: "enhancement" }, "Enhancement"))), issue.pinnedAt && (h("div", { class: "pinned-indicator", title: "Pinned issue" }, "\uD83D\uDCCC"))), h("div", { class: "issue-main" }, h("div", { class: "issue-details" }, h("h3", { class: "issue-title" }, issue.title), h("p", { class: "issue-body" }, issue.body), h("div", { class: "issue-repository" }, h("span", { class: "repo-name" }, issue.repository.owner, "/", issue.repository.name), issue.githubIssueNumber > 0 && (h("span", { class: "github-number" }, "#", issue.githubIssueNumber)))), h("button", { class: `upvote-button ${issue.hasUpvoted ? 'upvoted' : ''}`, onClick: e => this.handleUpvote(e, issue), title: issue.hasUpvoted ? 'Remove upvote' : 'Upvote this issue' }, issue.hasUpvoted ? h(HeartFilledIcon, null) : h(HeartOutlineIcon, null), h("span", { class: "upvote-count" }, issue.upvoteCount))), h("div", { class: "issue-footer" }, h("span", { class: "issue-date", title: `Updated: ${issue.updatedAt}` }, "Updated ", this.formatDate(issue.updatedAt)), h("span", { class: "issue-date", title: `Created: ${issue.createdAt}` }, "Created ", this.formatDate(issue.createdAt)))))))))));
60
+ }
61
+ };
62
+ FeedlogIssuesList.style = feedlogIssuesListCss();
63
+
64
+ export { FeedlogIssuesList as feedlog_issues_list };
@@ -16,5 +16,5 @@ var patchBrowser = () => {
16
16
 
17
17
  patchBrowser().then(async (options) => {
18
18
  await globalScripts();
19
- return bootstrapLazy([["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge_3",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1]}],[257,"feedlog-button",{"variant":[1],"size":[1],"disabled":[4],"type":[1]}],[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-github-issues",[[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]}]]],["feedlog-github-issues-client",[[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]}]]]], options);
19
+ return bootstrapLazy([["feedlog-issues-list",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1]}]]],["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge",[[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-button_2",[[1,"feedlog-issue",{"issue":[16],"theme":[1]}],[257,"feedlog-button",{"variant":[1],"size":[1],"disabled":[4],"type":[1]}]]],["feedlog-github-issues",[[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]}]]],["feedlog-github-issues-client",[[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]}]]]], options);
20
20
  });
@@ -4,7 +4,7 @@ export { s as setNonce } from './index-CkB6Yzeb.js';
4
4
  const defineCustomElements = async (win, options) => {
5
5
  if (typeof window === 'undefined') return undefined;
6
6
  await globalScripts();
7
- return bootstrapLazy([["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge_3",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1]}],[257,"feedlog-button",{"variant":[1],"size":[1],"disabled":[4],"type":[1]}],[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-github-issues",[[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]}]]],["feedlog-github-issues-client",[[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]}]]]], options);
7
+ return bootstrapLazy([["feedlog-issues-list",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1]}]]],["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge",[[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-button_2",[[1,"feedlog-issue",{"issue":[16],"theme":[1]}],[257,"feedlog-button",{"variant":[1],"size":[1],"disabled":[4],"type":[1]}]]],["feedlog-github-issues",[[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]}]]],["feedlog-github-issues-client",[[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]}]]]], options);
8
8
  };
9
9
 
10
10
  export { defineCustomElements };
@@ -1 +1 @@
1
- import{p as e,g as i,b as t}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(),t([["p-cdb2b098",[[257,"feedlog-card"]]],["p-4874f7e8",[[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
+ 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-f172074f",[[1,"feedlog-issues-list",{issues:[16],theme:[1]}]]],["p-cdb2b098",[[257,"feedlog-card"]]],["p-5df44120",[[257,"feedlog-badge",{variant:[1]}]]],["p-386ab9fb",[[1,"feedlog-issue",{issue:[16],theme:[1]}],[257,"feedlog-button",{variant:[1],size:[1],disabled:[4],type:[1]}]]],["p-95fea2f4",[[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-767ecb94",[[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))));
@@ -0,0 +1 @@
1
+ import{r as e,c as o,h as r,H as t}from"./p-CkB6Yzeb.js";const d=class{constructor(r){e(this,r),this.feedlogClick=o(this,"feedlogClick"),this.variant="default",this.size="default",this.disabled=!1,this.type="button",this.handleClick=e=>{this.disabled||this.feedlogClick.emit(e)}}render(){return r("button",{key:"6cdd8347def51592707b1fb9aab0dc565ca0f76f",type:this.type,class:`button button-${this.variant} ${"default"===this.size?"button-size-default":`button-size-${this.size}`}`,disabled:this.disabled,onClick:this.handleClick},r("slot",{key:"3f3845195fa4b8a551473ecf1d5702321a31763e"}))}};d.style=":host{display:inline-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-primary:#030213;--feedlog-primary-foreground:oklch(1 0 0);--feedlog-secondary:oklch(0.95 0.0058 264.53);--feedlog-secondary-foreground:#030213;--feedlog-muted:#ececf0;--feedlog-accent:#e9ebef;--feedlog-accent-foreground:#030213;--feedlog-border:rgba(0, 0, 0, 0.1);--feedlog-input:transparent;--feedlog-ring:oklch(0.708 0 0);--feedlog-destructive:#d4183d;--feedlog-radius:0.625rem}:host(.dark){--feedlog-background:oklch(0.145 0 0);--feedlog-foreground:oklch(0.985 0 0);--feedlog-primary:oklch(0.985 0 0);--feedlog-primary-foreground:oklch(0.205 0 0);--feedlog-secondary:oklch(0.269 0 0);--feedlog-secondary-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.269 0 0);--feedlog-accent:oklch(0.269 0 0);--feedlog-accent-foreground:oklch(0.985 0 0);--feedlog-border:oklch(0.269 0 0);--feedlog-input:oklch(0.269 0 0);--feedlog-ring:oklch(0.439 0 0);--feedlog-destructive:oklch(0.396 0.141 25.723)}button{display:inline-flex;align-items:center;justify-content:center;gap:0.5rem;white-space:nowrap;font-size:0.875rem;font-weight:500;border-radius:calc(var(--feedlog-radius) - 2px);border:1px solid transparent;cursor:pointer;transition:all 0.15s ease;outline:none;font-family:inherit}button:disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}button:focus-visible{border-color:var(--feedlog-ring);box-shadow:0 0 0 3px color-mix(in oklab, var(--feedlog-ring) 50%, transparent)}.button-default{background-color:var(--feedlog-primary);color:var(--feedlog-primary-foreground);border-color:transparent}.button-default:hover:not(:disabled){background-color:color-mix(in oklab, var(--feedlog-primary) 90%, transparent)}.button-outline{background-color:var(--feedlog-background);color:var(--feedlog-foreground);border-color:var(--feedlog-border)}.button-outline:hover:not(:disabled){background-color:var(--feedlog-accent);color:var(--feedlog-accent-foreground)}:host(.dark) .button-outline{background-color:transparent;border-color:var(--feedlog-input)}:host(.dark) .button-outline:hover:not(:disabled){background-color:color-mix(in oklab, var(--feedlog-accent) 50%, transparent)}.button-ghost{background-color:transparent;color:var(--feedlog-foreground);border-color:transparent}.button-ghost:hover:not(:disabled){background-color:var(--feedlog-accent);color:var(--feedlog-accent-foreground)}.button-destructive{background-color:var(--feedlog-destructive);color:#ffffff;border-color:transparent}.button-destructive:hover:not(:disabled){background-color:color-mix(in oklab, var(--feedlog-destructive) 90%, transparent)}:host(.dark) .button-destructive{background-color:color-mix(in oklab, var(--feedlog-destructive) 60%, transparent)}.button-size-sm{height:2rem;padding:0 0.75rem;font-size:0.75rem}.button-size-sm:has(svg:only-child){width:2rem;padding:0}.button-size-default{height:2.25rem;padding:0.5rem 1rem}.button-size-lg{height:2.5rem;padding:0.625rem 1.5rem;font-size:1rem}button svg{pointer-events:none;flex-shrink:0;width:1rem;height:1rem}";const l=()=>r("svg",{class:"upvote-icon filled",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"},r("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})),a=()=>r("svg",{class:"upvote-icon outline",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},r("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})),n=class{constructor(r){e(this,r),this.feedlogUpvote=o(this,"feedlogUpvote"),this.theme="light",this.handleUpvote=e=>{e.stopPropagation(),this.feedlogUpvote.emit({issueId:this.issue.id,currentUpvoted:this.issue.hasUpvoted,currentCount:this.issue.upvoteCount})}}formatDate(e){try{const o=new Date(e),r=new Date,t=Math.floor((r.getTime()-o.getTime())/1e3);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:t<604800?`${Math.floor(t/86400)}d ago`:t<2592e3?`${Math.floor(t/604800)}w ago`:o.toLocaleDateString()}catch(e){return"unknown date"}}render(){const{issue:e}=this;return e?r(t,{class:"dark"===this.theme?"dark":""},r("div",{class:"issue-card"},r("div",{class:"issue-content"},r("div",{class:"issue-header"},r("div",{class:"issue-type-badge"},"bug"===e.type?r("feedlog-badge",{variant:"destructive"},"Bug"):r("feedlog-badge",{variant:"enhancement"},"Enhancement")),e.pinnedAt&&r("div",{class:"pinned-indicator",title:"Pinned issue"},"📌")),r("div",{class:"issue-main"},r("div",{class:"issue-details"},r("h3",{class:"issue-title"},e.title),r("p",{class:"issue-body"},e.body),r("div",{class:"issue-repository"},r("span",{class:"repo-name"},e.repository.owner,"/",e.repository.name))),"bug"!==e.type&&r("button",{class:"upvote-button "+(e.hasUpvoted?"upvoted":""),onClick:e=>this.handleUpvote(e),title:e.hasUpvoted?"Remove upvote":"Upvote this issue"},r(e.hasUpvoted?l:a,null),r("span",{class:"upvote-count"},e.upvoteCount))),r("div",{class:"issue-footer"},r("span",{class:"issue-date",title:`Updated: ${e.updatedAt}`},"Updated ",this.formatDate(e.updatedAt)),r("span",{class:"issue-date",title:`Created: ${e.createdAt}`},"Created ",this.formatDate(e.createdAt)))))):null}};n.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-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}:host(.dark){--feedlog-background:oklch(0.145 0 0);--feedlog-foreground:oklch(0.985 0 0);--feedlog-card:oklch(0.145 0 0);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.269 0 0);--feedlog-muted-foreground:oklch(0.708 0 0);--feedlog-border:oklch(0.269 0 0);--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)}.issue-card{background-color:var(--feedlog-card);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);box-shadow:0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);transition:box-shadow 0.15s ease;position:relative}.issue-card:hover{box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)}.issue-content{padding:1.5rem;display:flex;flex-direction:column;gap:1rem}.issue-header{display:flex;align-items:center;gap:0.5rem;justify-content:space-between}.issue-type-badge{width:fit-content}.pinned-indicator{font-size:1rem;opacity:0.7}.issue-main{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}.issue-details{flex:1;min-width:0}.issue-title{color:var(--feedlog-card-foreground);font-size:0.875rem;font-weight:600;margin:0 0 0.375rem 0;line-height:1.4;word-break:break-word}.issue-body{color:var(--feedlog-muted-foreground);font-size:0.75rem;line-height:1.625;margin:0 0 0.75rem 0;word-break:break-word;white-space:pre-wrap}.issue-repository{display:flex;align-items:center;gap:0.5rem;font-size:0.75rem;color:var(--feedlog-muted-foreground);margin-bottom:0.5rem}.repo-name{font-weight:500}.github-number{color:var(--feedlog-blue-600);font-weight:600}:host(.dark) .github-number{color:var(--feedlog-blue-400)}.upvote-button{display:flex;flex-direction:column;align-items:center;gap:0.125rem;padding:0.5rem 0.75rem;border-radius:0.5rem;background-color:var(--feedlog-muted);border:1px solid transparent;cursor:pointer;transition:all 0.15s ease;flex-shrink:0;font-size:0.75rem;font-weight:600}.upvote-button:hover{background-color:var(--feedlog-blue-100);border-color:var(--feedlog-blue-400)}.upvote-button.upvoted{background-color:var(--feedlog-red-100);border-color:var(--feedlog-red-400)}.upvote-button.upvoted:hover{background-color:var(--feedlog-red-100);border-color:var(--feedlog-red-600)}:host(.dark) .upvote-button:hover{background-color:var(--feedlog-blue-900-30);border-color:var(--feedlog-blue-600)}:host(.dark) .upvote-button.upvoted{background-color:var(--feedlog-red-900-30);border-color:var(--feedlog-red-600)}.upvote-icon{width:1rem;height:1rem;stroke-width:2}.upvote-icon.filled{color:var(--feedlog-red-600)}.upvote-icon.outline{color:var(--feedlog-blue-600)}:host(.dark) .upvote-icon.outline{color:var(--feedlog-blue-400)}.upvote-count{font-size:0.75rem;font-weight:600;color:var(--feedlog-card-foreground)}.issue-footer{display:flex;flex-direction:column;gap:0.25rem;font-size:0.75rem}.issue-date{color:var(--feedlog-muted-foreground);cursor:help}";export{d as feedlog_button,n as feedlog_issue}
@@ -0,0 +1 @@
1
+ import{r as e,h as d}from"./p-CkB6Yzeb.js";const o=class{constructor(d){e(this,d),this.variant="default"}render(){return d("span",{key:"482a74feb8d254a75383c30c7b39790edd04a05b",class:`badge badge-${this.variant}`},d("slot",{key:"8d2db3fe0c2bc58e17829db4de7d0233189bb101"}))}};o.style=":host{display:inline-block;--feedlog-badge-font-size:0.75rem;--feedlog-badge-font-weight:500;--feedlog-badge-padding-x:0.5rem;--feedlog-badge-padding-y:0.125rem;--feedlog-badge-border-radius:calc(0.625rem - 2px);--feedlog-blue-500:oklch(0.623 0.214 259.815);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-700:oklch(0.488 0.243 264.376);--feedlog-destructive:#d4183d;--feedlog-destructive-hover:#b91c1c}:host(.dark){--feedlog-blue-500:oklch(0.623 0.214 259.815);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-destructive:oklch(0.396 0.141 25.723);--feedlog-destructive-hover:oklch(0.45 0.16 25.723)}.badge{display:inline-flex;align-items:center;justify-content:center;font-size:var(--feedlog-badge-font-size);font-weight:var(--feedlog-badge-font-weight);padding:var(--feedlog-badge-padding-y) var(--feedlog-badge-padding-x);border-radius:var(--feedlog-badge-border-radius);white-space:nowrap;transition:background-color 0.15s ease;font-family:inherit}.badge-default{background-color:var(--feedlog-blue-600);color:#ffffff}.badge-default:hover{background-color:var(--feedlog-blue-700)}:host(.dark) .badge-default{background-color:var(--feedlog-blue-500)}:host(.dark) .badge-default:hover{background-color:var(--feedlog-blue-600)}.badge-enhancement{background-color:var(--feedlog-blue-600);color:#ffffff}.badge-enhancement:hover{background-color:var(--feedlog-blue-700)}:host(.dark) .badge-enhancement{background-color:var(--feedlog-blue-500)}:host(.dark) .badge-enhancement:hover{background-color:var(--feedlog-blue-600)}.badge-destructive{background-color:var(--feedlog-destructive);color:#ffffff}.badge-destructive:hover{background-color:var(--feedlog-destructive-hover)}";export{o as feedlog_badge}
@@ -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:"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}
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 u=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.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));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.initializeSDK(),this.fetchIssues()}disconnectedCallback(){this.isDisconnected=!0,this.fetchRequestId++}componentDidUpdate(){(this.previousType!==this.type||this.previousLimit!==this.limit)&&(this.fetchRequestId++,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)return;const t=this.fetchRequestId;try{this.loading=!0,this.error=null;const e={};this.type&&(e.type=this.type),this.limit&&(e.limit=this.limit),this.cursor&&(e.cursor=this.cursor);const s=await this.sdk.fetchIssues(e);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:"Failed to fetch issues";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.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;const s=e instanceof Error?e.message:"Failed to load more issues";this.feedlogError.emit({error:s,code:null==e?void 0:e.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.isLoadingMore=!1)}}render(){return s("feedlog-github-issues",{key:"bb63dd29e99dfd9418b6cb12a1f45dff086378ab",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{u as feedlog_github_issues_client}
@@ -0,0 +1 @@
1
+ import{r as e,c as o,h as d,H as s}from"./p-CkB6Yzeb.js";const t=class{constructor(d){e(this,d),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}renderIssuesList(){return d("div",{class:"issues-list"},0===this.issues.length?d("div",{class:"empty-state"},d("p",null,"No issues found")):this.issues.map((e=>d("feedlog-issue",{key:e.id,issue:e,theme:this.currentTheme,onFeedlogUpvote:e=>this.handleUpvote(e)}))))}render(){return d(s,{key:"3d3f6aaaf7efc9bf81476e1ff793d68a8fc46db1",class:"dark"===this.currentTheme?"dark":""},d("div",{key:"b3114878ce3b649bb1dbec9eb2502bad2c2dfe27",class:"github-issues-container",style:{maxWidth:this.maxWidth}},(this.heading||this.subtitle)&&d("header",{key:"3effa7137e3138b8709f12442beaaf58f7873e91",class:"issues-header"},d("div",{key:"7904676ced41f4c738c265a571d2a447155f13f3",class:"header-content"},this.heading&&d("h1",{key:"f139c2087642ede74542be0064273d92f27938d7",class:"issues-title"},this.heading),this.subtitle&&d("p",{key:"c3af89d4abfb48ba225f362031705a14833f0ab7",class:"issues-subtitle"},this.subtitle))),this.loading&&d("div",{key:"1ed8c88a52808bbfb3a1ac86c9535cb87f32773a",class:"loading-state"},d("p",{key:"d093c2edcfaba2c136c6915bfe183f7e8f25de8b"},"Loading issues...")),this.error&&d("div",{key:"05ab37ee5c061a321fc7a8c407af04cae269f304",class:"error-state"},d("p",{key:"7388ef1b66265953f30b65618f2b96c519702bdb"},"Error: ",this.error)),!this.loading&&!this.error&&d("div",{key:"5968b7ad6c13c7d0edf0a497eb51bd88978def9c"},this.renderIssuesList(),this.hasMore&&d("div",{key:"7cfe136735f497f239a5be2befa6c3add99c7bcb",class:"load-more-container"},d("feedlog-button",{key:"6fcdaf69873d51518d58baa9c3f8dba8a705ad5f",onFeedlogClick:this.handleLoadMore,disabled:this.isLoadingMore,variant:"outline"},this.isLoadingMore?"Loading...":"Load More Issues")))))}};t.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-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}:host(.dark){--feedlog-background:oklch(0.145 0 0);--feedlog-foreground:oklch(0.985 0 0);--feedlog-card:oklch(0.145 0 0);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.269 0 0);--feedlog-muted-foreground:oklch(0.708 0 0);--feedlog-border:oklch(0.269 0 0);--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)}.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)}.issues-list{display:flex;flex-direction:column;gap:var(--feedlog-gap)}.empty-state{text-align:center;padding:3rem 1.5rem;color:var(--feedlog-muted-foreground);font-size:0.875rem}.load-more-container{display:flex;justify-content:center;padding:2rem 0;gap:1rem}";export{t as feedlog_github_issues}
@@ -0,0 +1 @@
1
+ import{r as e,c as o,h as r,H as t}from"./p-CkB6Yzeb.js";const s=()=>r("svg",{class:"upvote-icon filled",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"},r("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})),a=()=>r("svg",{class:"upvote-icon outline",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},r("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})),l=class{constructor(r){e(this,r),this.feedlogUpvote=o(this,"feedlogUpvote"),this.issues=[],this.theme="light",this.handleUpvote=(e,o)=>{e.stopPropagation(),this.feedlogUpvote.emit({issueId:o.id,currentUpvoted:o.hasUpvoted,currentCount:o.upvoteCount})}}formatDate(e){try{const o=new Date(e),r=new Date,t=Math.floor((r.getTime()-o.getTime())/1e3);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:t<604800?`${Math.floor(t/86400)}d ago`:t<2592e3?`${Math.floor(t/604800)}w ago`:o.toLocaleDateString()}catch(e){return"unknown date"}}render(){return r(t,{key:"a4085d69641f9c21255f556e9ba65cefc189fab6",class:"dark"===this.theme?"dark":""},r("div",{key:"8420abca5d206440a60d9e0840a35268ba698fee",class:"issues-list"},0===this.issues.length?r("div",{class:"empty-state"},r("p",null,"No issues found")):this.issues.map((e=>r("div",{key:e.id,class:"issue-card"},r("div",{class:"issue-content"},r("div",{class:"issue-header"},r("div",{class:"issue-type-badge"},"bug"===e.type?r("feedlog-badge",{variant:"destructive"},"Bug"):r("feedlog-badge",{variant:"enhancement"},"Enhancement")),e.pinnedAt&&r("div",{class:"pinned-indicator",title:"Pinned issue"},"📌")),r("div",{class:"issue-main"},r("div",{class:"issue-details"},r("h3",{class:"issue-title"},e.title),r("p",{class:"issue-body"},e.body),r("div",{class:"issue-repository"},r("span",{class:"repo-name"},e.repository.owner,"/",e.repository.name),e.githubIssueNumber>0&&r("span",{class:"github-number"},"#",e.githubIssueNumber))),r("button",{class:"upvote-button "+(e.hasUpvoted?"upvoted":""),onClick:o=>this.handleUpvote(o,e),title:e.hasUpvoted?"Remove upvote":"Upvote this issue"},r(e.hasUpvoted?s:a,null),r("span",{class:"upvote-count"},e.upvoteCount))),r("div",{class:"issue-footer"},r("span",{class:"issue-date",title:`Updated: ${e.updatedAt}`},"Updated ",this.formatDate(e.updatedAt)),r("span",{class:"issue-date",title:`Created: ${e.createdAt}`},"Created ",this.formatDate(e.createdAt)))))))))}};l.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-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}:host(.dark){--feedlog-background:oklch(0.145 0 0);--feedlog-foreground:oklch(0.985 0 0);--feedlog-card:oklch(0.145 0 0);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.269 0 0);--feedlog-muted-foreground:oklch(0.708 0 0);--feedlog-border:oklch(0.269 0 0);--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)}.issues-list{display:flex;flex-direction:column;gap:var(--feedlog-gap)}.empty-state{text-align:center;padding:3rem 1.5rem;color:var(--feedlog-muted-foreground);font-size:0.875rem}.issue-card{background-color:var(--feedlog-card);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);box-shadow:0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);transition:box-shadow 0.15s ease;position:relative}.issue-card:hover{box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)}.issue-content{padding:1.5rem;display:flex;flex-direction:column;gap:1rem}.issue-header{display:flex;align-items:center;gap:0.5rem;justify-content:space-between}.issue-type-badge{width:fit-content}.pinned-indicator{font-size:1rem;opacity:0.7}.issue-main{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}.issue-details{flex:1;min-width:0}.issue-title{margin:0 0 0.5rem 0;font-size:1rem;font-weight:600;color:var(--feedlog-card-foreground);line-height:1.5;word-wrap:break-word}.issue-body{margin:0 0 0.75rem 0;font-size:0.875rem;color:var(--feedlog-muted-foreground);line-height:1.5;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;word-wrap:break-word}.issue-repository{display:flex;align-items:center;gap:0.5rem;font-size:0.75rem;color:var(--feedlog-muted-foreground)}.repo-name{font-weight:500}.github-number{background-color:var(--feedlog-muted);padding:0.125rem 0.375rem;border-radius:0.25rem;font-family:ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace}.upvote-button{display:flex;align-items:center;gap:0.375rem;padding:0.5rem 0.75rem;background-color:var(--feedlog-muted);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);color:var(--feedlog-muted-foreground);font-size:0.875rem;font-weight:500;cursor:pointer;transition:all 0.15s ease;white-space:nowrap}.upvote-button:hover{background-color:var(--feedlog-accent-color);color:white}.upvote-button.upvoted{background-color:var(--feedlog-destructive);color:white;border-color:var(--feedlog-destructive)}.upvote-button.upvoted:hover{background-color:var(--feedlog-red-600);border-color:var(--feedlog-red-600)}.upvote-icon{width:1rem;height:1rem;flex-shrink:0}.upvote-icon.filled{color:currentColor}.upvote-icon.outline{stroke:currentColor}.upvote-count{font-variant-numeric:tabular-nums}.issue-footer{display:flex;align-items:center;gap:1rem;font-size:0.75rem;color:var(--feedlog-muted-foreground)}.issue-date{white-space:nowrap}@media (max-width: 640px){.issue-content{padding:1rem;gap:0.75rem}.issue-main{flex-direction:column;align-items:stretch;gap:0.75rem}.upvote-button{align-self:flex-start}.issue-footer{flex-direction:column;align-items:flex-start;gap:0.25rem}}";export{l as feedlog_issues_list}
@@ -1,16 +1,16 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
- import { FeedlogIssue } from '@feedlog-ai/core';
2
+ import type { FeedlogIssue as FeedlogIssueType } from '@feedlog-ai/core';
3
3
  /**
4
4
  * Feedlog GitHub Issues Component
5
5
  *
6
6
  * Component for displaying GitHub issues with support for bugs and enhancements.
7
- * This component handles the UI rendering and delegates to feedlog-issues-list for the actual list.
7
+ * Includes full list rendering, loading/error states, and pagination support.
8
8
  */
9
9
  export declare class FeedlogGithubIssues {
10
10
  /**
11
11
  * Array of issues to display
12
12
  */
13
- issues: FeedlogIssue[];
13
+ issues: FeedlogIssueType[];
14
14
  /**
15
15
  * Maximum width of the container
16
16
  */
@@ -62,5 +62,6 @@ export declare class FeedlogGithubIssues {
62
62
  componentWillLoad(): void;
63
63
  private handleUpvote;
64
64
  private handleLoadMore;
65
+ private renderIssuesList;
65
66
  render(): any;
66
67
  }
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
- import { FeedlogIssue } from '@feedlog-ai/core';
2
+ import type { FeedlogIssue as FeedlogIssueType } from '@feedlog-ai/core';
3
3
  /**
4
4
  * Feedlog GitHub Issues Client Component
5
5
  *
@@ -55,7 +55,7 @@ export declare class FeedlogGithubIssuesClient {
55
55
  error: string;
56
56
  code?: number;
57
57
  }>;
58
- issues: FeedlogIssue[];
58
+ issues: FeedlogIssueType[];
59
59
  loading: boolean;
60
60
  error: string | null;
61
61
  cursor: string | null;
@@ -64,7 +64,14 @@ export declare class FeedlogGithubIssuesClient {
64
64
  private sdk;
65
65
  private previousType?;
66
66
  private previousLimit?;
67
+ /** Counter to track fetch operations and prevent stale updates */
68
+ private fetchRequestId;
69
+ /** Flag to prevent state updates after component disconnect */
70
+ private isDisconnected;
71
+ /** Map to track the latest upvote request ID for each issue to handle race conditions */
72
+ private upvoteRequestIds;
67
73
  componentWillLoad(): void;
74
+ disconnectedCallback(): void;
68
75
  componentDidUpdate(): void;
69
76
  private initializeSDK;
70
77
  private fetchIssues;
@@ -0,0 +1,31 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ import type { FeedlogIssue as FeedlogIssueType } from '@feedlog-ai/core';
3
+ /**
4
+ * Feedlog Issue Component
5
+ *
6
+ * A component for displaying a single GitHub issue.
7
+ */
8
+ export declare class FeedlogIssueComponent {
9
+ /**
10
+ * The issue to display
11
+ */
12
+ issue: FeedlogIssueType;
13
+ /**
14
+ * Theme variant: 'light' or 'dark'
15
+ */
16
+ theme: 'light' | 'dark';
17
+ /**
18
+ * Event emitted when the issue is upvoted
19
+ */
20
+ feedlogUpvote: EventEmitter<{
21
+ issueId: string;
22
+ currentUpvoted: boolean;
23
+ currentCount: number;
24
+ }>;
25
+ private handleUpvote;
26
+ /**
27
+ * Format an ISO date string to a relative time string
28
+ */
29
+ private formatDate;
30
+ render(): any;
31
+ }
@@ -0,0 +1,12 @@
1
+ import type { Meta, StoryObj } from '@stencil/storybook-plugin';
2
+ declare const meta: Meta;
3
+ export default meta;
4
+ type Story = StoryObj;
5
+ export declare const Default: Story;
6
+ export declare const Bug: Story;
7
+ export declare const Upvoted: Story;
8
+ export declare const Pinned: Story;
9
+ export declare const DarkTheme: Story;
10
+ export declare const DarkThemeBug: Story;
11
+ export declare const DarkThemePinned: Story;
12
+ export declare const HighUpvoteCount: Story;
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
- import { FeedlogIssue } from '@feedlog-ai/core';
2
+ import type { FeedlogIssue as FeedlogIssueType } from '@feedlog-ai/core';
3
3
  /**
4
4
  * Feedlog Issues List Component
5
5
  *
@@ -9,13 +9,13 @@ export declare class FeedlogIssuesList {
9
9
  /**
10
10
  * Array of issues to display
11
11
  */
12
- issues: FeedlogIssue[];
12
+ issues: FeedlogIssueType[];
13
13
  /**
14
14
  * Theme variant: 'light' or 'dark'
15
15
  */
16
16
  theme: 'light' | 'dark';
17
17
  /**
18
- * Event emitted when an issue is upvoted
18
+ * Emitted when an issue is upvoted
19
19
  */
20
20
  feedlogUpvote: EventEmitter<{
21
21
  issueId: string;
@@ -23,9 +23,9 @@ export declare class FeedlogIssuesList {
23
23
  currentCount: number;
24
24
  }>;
25
25
  private handleUpvote;
26
- render(): any;
27
26
  /**
28
27
  * Format an ISO date string to a relative time string
29
28
  */
30
29
  private formatDate;
30
+ render(): any;
31
31
  }
@@ -3,4 +3,5 @@ export * from './feedlog-badge/feedlog-badge';
3
3
  export * from './feedlog-button/feedlog-button';
4
4
  export * from './feedlog-github-issues/feedlog-github-issues';
5
5
  export * from './feedlog-github-issues-client/feedlog-github-issues-client';
6
+ export * from './feedlog-issue/feedlog-issue';
6
7
  export * from './feedlog-issues-list/feedlog-issues-list';