@feedlog-ai/webcomponents 0.0.39 → 0.0.41

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 (62) hide show
  1. package/dist/cjs/feedlog-badge.cjs.entry.js +3 -3
  2. package/dist/cjs/feedlog-button_3.cjs.entry.js +8 -8
  3. package/dist/cjs/feedlog-card.cjs.entry.js +3 -3
  4. package/dist/cjs/feedlog-issues-client.cjs.entry.js +2 -2
  5. package/dist/cjs/feedlog-issues.cjs.entry.js +4 -4
  6. package/dist/cjs/feedlog-toolkit.cjs.js +2 -2
  7. package/dist/cjs/{index-prPyjPBk.js → index-CXKBwRlh.js} +1 -1
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/collection/components/feedlog-badge/feedlog-badge.css +45 -35
  10. package/dist/collection/components/feedlog-badge/feedlog-badge.js +1 -1
  11. package/dist/collection/components/feedlog-button/feedlog-button.css +66 -16
  12. package/dist/collection/components/feedlog-button/feedlog-button.js +1 -1
  13. package/dist/collection/components/feedlog-card/feedlog-card.css +24 -22
  14. package/dist/collection/components/feedlog-card/feedlog-card.js +1 -1
  15. package/dist/collection/components/feedlog-issue/feedlog-issue.css +187 -99
  16. package/dist/collection/components/feedlog-issue/feedlog-issue.js +1 -1
  17. package/dist/collection/components/feedlog-issues/feedlog-issues.css +63 -34
  18. package/dist/collection/components/feedlog-issues/feedlog-issues.js +2 -2
  19. package/dist/collection/components/feedlog-issues-client/feedlog-issues-client.js +1 -1
  20. package/dist/collection/components/feedlog-issues-list/feedlog-issues-list.js +3 -3
  21. package/dist/components/feedlog-badge.js +1 -1
  22. package/dist/components/feedlog-button.js +1 -1
  23. package/dist/components/feedlog-card.js +1 -1
  24. package/dist/components/feedlog-issue.js +1 -1
  25. package/dist/components/feedlog-issues-client.js +1 -1
  26. package/dist/components/feedlog-issues-list.js +1 -1
  27. package/dist/components/feedlog-issues.js +1 -1
  28. package/dist/components/index.js +1 -1
  29. package/dist/components/{p-CvIMO_S7.js → p-2RPRQcjh.js} +2 -2
  30. package/dist/components/p-CVEXMLCP.js +1 -0
  31. package/dist/components/p-DMdb-G26.js +1 -0
  32. package/dist/components/p-DsLDsYLY.js +1 -0
  33. package/dist/components/p-DzATWlAC.js +1 -0
  34. package/dist/esm/feedlog-badge.entry.js +3 -3
  35. package/dist/esm/feedlog-button_3.entry.js +8 -8
  36. package/dist/esm/feedlog-card.entry.js +3 -3
  37. package/dist/esm/feedlog-issues-client.entry.js +2 -2
  38. package/dist/esm/feedlog-issues.entry.js +4 -4
  39. package/dist/esm/feedlog-toolkit.js +3 -3
  40. package/dist/esm/{index-Cu1eYdKa.js → index-CgNWSmzU.js} +1 -1
  41. package/dist/esm/loader.js +3 -3
  42. package/dist/feedlog-toolkit/feedlog-toolkit.css +1 -1
  43. package/dist/feedlog-toolkit/feedlog-toolkit.esm.js +1 -1
  44. package/dist/feedlog-toolkit/p-2901a753.entry.js +1 -0
  45. package/dist/feedlog-toolkit/p-32663f65.entry.js +1 -0
  46. package/dist/feedlog-toolkit/{p-ca90ade9.entry.js → p-8ab2cdd9.entry.js} +1 -1
  47. package/dist/feedlog-toolkit/p-CgNWSmzU.js +2 -0
  48. package/dist/feedlog-toolkit/p-c1e83493.entry.js +1 -0
  49. package/dist/feedlog-toolkit/p-da0268a8.entry.js +1 -0
  50. package/dist/types/index.d.ts +1 -1
  51. package/hydrate/index.js +19 -19
  52. package/hydrate/index.mjs +19 -19
  53. package/package.json +7 -4
  54. package/dist/components/p-BoxVrJId.js +0 -1
  55. package/dist/components/p-DFD585IK.js +0 -1
  56. package/dist/components/p-I6NOP29P.js +0 -1
  57. package/dist/components/p-fDVosM5p.js +0 -1
  58. package/dist/feedlog-toolkit/p-001d7353.entry.js +0 -1
  59. package/dist/feedlog-toolkit/p-556062d0.entry.js +0 -1
  60. package/dist/feedlog-toolkit/p-62554649.entry.js +0 -1
  61. package/dist/feedlog-toolkit/p-Cu1eYdKa.js +0 -2
  62. package/dist/feedlog-toolkit/p-b558fc9f.entry.js +0 -1
@@ -1,30 +1,59 @@
1
1
  :host {
2
2
  display: block;
3
- font-family: var(--feedlog-font-family);
3
+ font-family:
4
+ ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
4
5
 
5
6
  /* Light theme defaults - use --feedlog-theme-bg so parent can override via --feedlog-background */
6
- --feedlog-theme-bg: var(--feedlog-background);
7
- --feedlog-gap: var(--feedlog-space-2);
8
- --feedlog-padding: var(--feedlog-space-8);
7
+ --feedlog-theme-bg: #ffffff;
8
+ --feedlog-foreground: oklch(0.145 0 0);
9
+ --feedlog-card: #ffffff;
10
+ --feedlog-card-foreground: oklch(0.145 0 0);
11
+ --feedlog-muted: #ececf0;
12
+ --feedlog-muted-foreground: #717182;
13
+ --feedlog-border: rgba(0, 0, 0, 0.1);
14
+ --feedlog-accent-color: #2563eb;
15
+ --feedlog-destructive: #d4183d;
16
+ --feedlog-blue-400: oklch(0.707 0.165 254.624);
17
+ --feedlog-blue-600: oklch(0.546 0.245 262.881);
18
+ --feedlog-blue-100: oklch(0.932 0.032 255.585);
19
+ --feedlog-red-100: #fce7f3;
20
+ --feedlog-red-400: #f472b6;
21
+ --feedlog-red-600: #db2777;
22
+ --feedlog-radius: 0.625rem;
23
+ --feedlog-gap: 0.5rem;
24
+ --feedlog-padding: 2rem;
9
25
  --feedlog-min-height: 100%;
26
+ --feedlog-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
10
27
  }
11
28
 
12
29
  :host(.dark) {
13
30
  /* Dark theme values */
14
- --feedlog-theme-bg: var(--feedlog-background);
31
+ --feedlog-theme-bg: oklch(0.18 0.01 260);
32
+ --feedlog-foreground: oklch(0.985 0 0);
33
+ --feedlog-card: oklch(0.24 0.01 260);
34
+ --feedlog-card-foreground: oklch(0.985 0 0);
35
+ --feedlog-muted: oklch(0.32 0.01 260);
36
+ --feedlog-muted-foreground: oklch(0.72 0.02 260);
37
+ --feedlog-border: oklch(0.34 0.01 260);
38
+ --feedlog-accent-color: #3b82f6;
39
+ --feedlog-destructive: oklch(0.396 0.141 25.723);
40
+ --feedlog-blue-400: oklch(0.707 0.165 254.624);
41
+ --feedlog-blue-600: oklch(0.546 0.245 262.881);
42
+ --feedlog-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
15
43
  }
16
44
 
45
+
17
46
  .issues-container {
18
47
  min-height: var(--feedlog-min-height);
19
48
  /* Parent can override via --feedlog-background (e.g. transparent); fallback to theme default */
20
49
  background-color: var(--feedlog-background, var(--feedlog-theme-bg, #ffffff));
21
50
  padding: var(--feedlog-padding);
22
51
  margin: 0 auto;
23
- border-radius: var(--feedlog-radius-lg);
52
+ border-radius: var(--feedlog-radius);
24
53
  }
25
54
 
26
55
  .issues-header {
27
- margin-bottom: var(--feedlog-space-6);
56
+ margin-bottom: 1.5rem;
28
57
  display: flex;
29
58
  align-items: flex-start;
30
59
  justify-content: space-between;
@@ -36,15 +65,15 @@
36
65
 
37
66
  .issues-title {
38
67
  color: var(--feedlog-foreground);
39
- margin: 0 0 var(--feedlog-space-1) 0;
40
- font-size: var(--feedlog-text-xl);
41
- font-weight: var(--feedlog-font-semibold);
68
+ margin: 0 0 0.25rem 0;
69
+ font-size: 1.5rem;
70
+ font-weight: 500;
42
71
  line-height: 1.5;
43
72
  }
44
73
 
45
74
  .issues-subtitle {
46
75
  color: var(--feedlog-muted-foreground);
47
- font-size: var(--feedlog-text-sm);
76
+ font-size: 0.875rem;
48
77
  margin: 0;
49
78
  }
50
79
 
@@ -62,7 +91,7 @@
62
91
  background-color: var(--feedlog-card);
63
92
  border: 1px solid var(--feedlog-border);
64
93
  border-radius: var(--feedlog-radius);
65
- box-shadow: var(--feedlog-shadow-sm);
94
+ box-shadow: var(--feedlog-shadow);
66
95
  position: relative;
67
96
  overflow: hidden;
68
97
  }
@@ -78,24 +107,24 @@
78
107
  }
79
108
 
80
109
  .skeleton-content {
81
- padding: var(--feedlog-space-5);
82
- padding-left: calc(var(--feedlog-space-5) + 3px);
110
+ padding: 1.25rem;
111
+ padding-left: calc(1.25rem + 3px);
83
112
  display: flex;
84
113
  flex-direction: column;
85
- gap: var(--feedlog-space-3);
114
+ gap: 0.875rem;
86
115
  }
87
116
 
88
117
  .skeleton-header {
89
118
  display: flex;
90
119
  align-items: center;
91
120
  justify-content: space-between;
92
- gap: var(--feedlog-space-3);
121
+ gap: 0.75rem;
93
122
  }
94
123
 
95
124
  .skeleton-badge {
96
125
  width: 4.5rem;
97
126
  height: 1.25rem;
98
- border-radius: var(--feedlog-radius-sm);
127
+ border-radius: 0.375rem;
99
128
  background-color: var(--feedlog-muted);
100
129
  animation: skeleton-pulse 1.5s ease-in-out infinite;
101
130
  }
@@ -103,7 +132,7 @@
103
132
  .skeleton-timestamp {
104
133
  width: 3rem;
105
134
  height: 0.75rem;
106
- border-radius: var(--feedlog-radius-sm);
135
+ border-radius: 0.25rem;
107
136
  background-color: var(--feedlog-muted);
108
137
  animation: skeleton-pulse 1.5s ease-in-out infinite 0.2s;
109
138
  }
@@ -111,12 +140,12 @@
111
140
  .skeleton-main {
112
141
  display: flex;
113
142
  flex-direction: column;
114
- gap: var(--feedlog-space-2);
143
+ gap: 0.5rem;
115
144
  }
116
145
 
117
146
  .skeleton-title {
118
147
  height: 0.9375rem;
119
- border-radius: var(--feedlog-radius-sm);
148
+ border-radius: 0.25rem;
120
149
  background-color: var(--feedlog-muted);
121
150
  animation: skeleton-pulse 1.5s ease-in-out infinite 0.1s;
122
151
  width: 85%;
@@ -125,12 +154,12 @@
125
154
  .skeleton-body {
126
155
  display: flex;
127
156
  flex-direction: column;
128
- gap: var(--feedlog-space-1);
157
+ gap: 0.375rem;
129
158
  }
130
159
 
131
160
  .skeleton-line {
132
161
  height: 0.8125rem;
133
- border-radius: var(--feedlog-radius-sm);
162
+ border-radius: 0.25rem;
134
163
  background-color: var(--feedlog-muted);
135
164
  animation: skeleton-pulse 1.5s ease-in-out infinite 0.15s;
136
165
  width: 100%;
@@ -143,7 +172,7 @@
143
172
  .skeleton-repo {
144
173
  width: 6rem;
145
174
  height: 0.75rem;
146
- border-radius: var(--feedlog-radius-sm);
175
+ border-radius: 0.25rem;
147
176
  background-color: var(--feedlog-muted);
148
177
  animation: skeleton-pulse 1.5s ease-in-out infinite 0.25s;
149
178
  }
@@ -156,7 +185,7 @@
156
185
  .skeleton-upvote {
157
186
  width: 2.5rem;
158
187
  height: 2rem;
159
- border-radius: var(--feedlog-radius);
188
+ border-radius: 0.5rem;
160
189
  background-color: var(--feedlog-muted);
161
190
  animation: skeleton-pulse 1.5s ease-in-out infinite 0.3s;
162
191
  }
@@ -175,7 +204,7 @@
175
204
  display: flex;
176
205
  align-items: center;
177
206
  justify-content: center;
178
- padding: var(--feedlog-space-10) var(--feedlog-space-8);
207
+ padding: 3rem 2rem;
179
208
  min-height: 12rem;
180
209
  }
181
210
 
@@ -185,26 +214,26 @@
185
214
  align-items: center;
186
215
  text-align: center;
187
216
  max-width: 20rem;
188
- padding: var(--feedlog-space-8);
217
+ padding: 2rem;
189
218
  }
190
219
 
191
220
  .error-icon {
192
221
  color: var(--feedlog-muted-foreground);
193
222
  opacity: 0.8;
194
- margin-bottom: var(--feedlog-space-4);
223
+ margin-bottom: 1rem;
195
224
  }
196
225
 
197
226
  .error-state-title {
198
- margin: 0 0 var(--feedlog-space-2) 0;
199
- font-size: var(--feedlog-text-lg);
200
- font-weight: var(--feedlog-font-semibold);
227
+ margin: 0 0 0.5rem 0;
228
+ font-size: 1.125rem;
229
+ font-weight: 600;
201
230
  color: var(--feedlog-foreground);
202
231
  line-height: 1.4;
203
232
  }
204
233
 
205
234
  .error-state-message {
206
- margin: 0 0 var(--feedlog-space-5) 0;
207
- font-size: var(--feedlog-text-sm);
235
+ margin: 0 0 1.25rem 0;
236
+ font-size: 0.875rem;
208
237
  color: var(--feedlog-muted-foreground);
209
238
  line-height: 1.5;
210
239
  }
@@ -212,6 +241,6 @@
212
241
  .load-more-container {
213
242
  display: flex;
214
243
  justify-content: center;
215
- padding: var(--feedlog-space-8) 0;
216
- gap: var(--feedlog-space-4);
244
+ padding: 2rem 0;
245
+ gap: 1rem;
217
246
  }
@@ -48,13 +48,13 @@ export class FeedlogIssues {
48
48
  }
49
49
  renderIssuesList() {
50
50
  var _a, _b;
51
- return (h("feedlog-issues-list", { issues: this.issues, limit: this.limit, theme: this.theme, getIssueUrl: this.getIssueUrl, emptyStateTitle: (_a = this.emptyStateTitle) !== null && _a !== void 0 ? _a : 'No updates yet', emptyStateMessage: (_b = this.emptyStateMessage) !== null && _b !== void 0 ? _b : 'Check back later for new updates.', onFeedlogUpvote: (e) => this.handleUpvote(e), part: "issues-list" }, h("slot", { name: "empty-state", slot: "empty-state" })));
51
+ return (h("feedlog-issues-list", { issues: this.issues, limit: this.limit, theme: this.theme, getIssueUrl: this.getIssueUrl, emptyStateTitle: (_a = this.emptyStateTitle) !== null && _a !== void 0 ? _a : 'No updates yet', emptyStateMessage: (_b = this.emptyStateMessage) !== null && _b !== void 0 ? _b : 'Check back later for new updates.', onFeedlogUpvote: (e) => this.handleUpvote(e) }));
52
52
  }
53
53
  render() {
54
54
  const containerStyle = {
55
55
  maxWidth: this.maxWidth,
56
56
  };
57
- return (h(Host, { key: '79835dd61383b41124f48d204977951236a7f8ce', class: this.theme === 'dark' ? 'dark' : '' }, h("div", { key: '62228927cba9bd4cf58d8b4f3ec2751ba423dd67', class: "issues-container", style: containerStyle, part: "base" }, h("slot", { key: 'c57d46adc472c2b03857db3e07cc5b549bd110f1', name: "header" }, (this.heading || this.subtitle) && (h("header", { key: '080059a002a373d76bee863b368a12ffdba59384', class: "issues-header", part: "header" }, h("div", { key: 'db85f995fb6f1f9fe961ea6726cf82da17fc9c2d', class: "header-content", part: "header-content" }, this.heading && (h("h1", { key: 'e7b510ecd2039072b384d6dcb531ebf0b091010b', class: "issues-title", part: "title" }, this.heading)), this.subtitle && (h("p", { key: '323f9a635b6a1c2ca9d955d12dc1925c0be59cf8', class: "issues-subtitle", part: "subtitle" }, this.subtitle)))))), this.loading && (h("slot", { key: 'ba63923aa7cac4b3ab050b423d5f65dcbbe81677', name: "loading" }, h("div", { key: '4bf1fc0d367acb0285eb124875c42e541939d388', class: "loading-state", role: "status", "aria-label": "Loading issues", part: "loading-state" }, h("div", { key: 'fa369824bd1cb8e3b5c393613952611658e6919a', class: "loading-skeletons", part: "loading-skeletons" }, [1, 2, 3].map(i => (h("div", { key: i, class: "skeleton-card", part: "skeleton-card" }, h("div", { class: "skeleton-content", part: "skeleton-content" }, h("div", { class: "skeleton-header", part: "skeleton-header" }, h("div", { class: "skeleton-badge", part: "skeleton-badge" }), h("div", { class: "skeleton-timestamp", part: "skeleton-timestamp" })), h("div", { class: "skeleton-main", part: "skeleton-main" }, h("div", { class: "skeleton-title", part: "skeleton-title" }), h("div", { class: "skeleton-body", part: "skeleton-body" }, h("div", { class: "skeleton-line", part: "skeleton-line" }), h("div", { class: "skeleton-line short", part: "skeleton-line short" })), h("div", { class: "skeleton-repo", part: "skeleton-repo" })), h("div", { class: "skeleton-footer", part: "skeleton-footer" }, h("div", { class: "skeleton-upvote", part: "skeleton-upvote" })))))))))), this.error && (h("slot", { key: '5ad8c400e465213de6e9d1f2a4d5e70c86a7ca2d', name: "error" }, h("div", { key: '0a1a62f25e9ccac249ea7426cc7839e95a24b60f', class: "error-state", role: "alert", part: "error-state" }, h("div", { key: '3286f0ab99dbead8e7949317de510e643bfbc897', class: "error-state-content", part: "error-state-content" }, this.renderErrorIcon(), h("h2", { key: '78319f0bbc6cc972bb2a4478134194b0592c13ba', class: "error-state-title", part: "error-title" }, "Something went wrong"), h("p", { key: 'ba262bf4d991326d36a04667b1109fed008d7cfd', class: "error-state-message", part: "error-message" }, this.error))))), !this.loading && !this.error && (h("div", { key: 'adc09c9a78afb9c163d23813eebb23a4c031be52', part: "list-container" }, this.renderIssuesList(), this.hasMore && (h("slot", { key: '26010e848f5fc2976f0ab0c1d7f134efb023f173', name: "load-more" }, h("div", { key: 'adbfb37d368383405dc9edd136ed7c0003b8cb67', class: "load-more-container", part: "load-more-container" }, h("feedlog-button", { key: '8d00e17e29dd9148e71e86cb178b9e058f50ce32', onFeedlogClick: this.handleLoadMore, disabled: this.isLoadingMore, variant: "outline", part: "load-more-btn" }, this.isLoadingMore ? 'Loading...' : 'Load More Issues')))))))));
57
+ return (h(Host, { key: '15ca787d3e5b45331a6582ea908b35b94b3a528c', class: this.theme === 'dark' ? 'dark' : '' }, h("div", { key: '79d655ca18778660f0156fbdec54764491eaac49', class: "issues-container", style: containerStyle }, (this.heading || this.subtitle) && (h("header", { key: 'e9e1b05451f55db894a1b6248dde4d9d90a96068', class: "issues-header" }, h("div", { key: 'b2921e777986f9c6afc3ba1cbf8023311c868b34', class: "header-content" }, this.heading && h("h1", { key: 'e484da412ff1a92b876f3075489e60be273076b3', class: "issues-title" }, this.heading), this.subtitle && h("p", { key: '5030cbb2fdf2deab3681c1177a14e2b540d2ea33', class: "issues-subtitle" }, this.subtitle)))), this.loading && (h("div", { key: 'f3fb2c02af4637832c518714f670ca2ae2624d49', class: "loading-state", role: "status", "aria-label": "Loading issues" }, h("div", { key: '14e60e4174d22dd2474677a7ec6365d053fe40e7', class: "loading-skeletons" }, [1, 2, 3].map(i => (h("div", { key: i, class: "skeleton-card" }, h("div", { class: "skeleton-content" }, h("div", { class: "skeleton-header" }, h("div", { class: "skeleton-badge" }), h("div", { class: "skeleton-timestamp" })), h("div", { class: "skeleton-main" }, h("div", { class: "skeleton-title" }), h("div", { class: "skeleton-body" }, h("div", { class: "skeleton-line" }), h("div", { class: "skeleton-line short" })), h("div", { class: "skeleton-repo" })), h("div", { class: "skeleton-footer" }, h("div", { class: "skeleton-upvote" }))))))))), this.error && (h("div", { key: '0c301ece57faeee2c6bbf2a4e346a88b6bc535cc', class: "error-state", role: "alert" }, h("div", { key: 'bab84dcbca74730ba44162c57baf65454ffb78c0', class: "error-state-content" }, this.renderErrorIcon(), h("h2", { key: '247b25d17323d08ec9c527ebec1352600614f3be', class: "error-state-title" }, "Something went wrong"), h("p", { key: '45501981e34a2a163e20724881945a0b75ef57d1', class: "error-state-message" }, this.error)))), !this.loading && !this.error && (h("div", { key: 'ca5a2697c898b61121c16a9d1f4320ad35a0bf84' }, this.renderIssuesList(), this.hasMore && (h("div", { key: '1896d074714f083c3e171d0516d1d71155cbcd6a', class: "load-more-container" }, h("feedlog-button", { key: 'b34a2081a91b14e13aa4ace4d67b4d812f4a1d77', onFeedlogClick: this.handleLoadMore, disabled: this.isLoadingMore, variant: "outline" }, this.isLoadingMore ? 'Loading...' : 'Load More Issues'))))))));
58
58
  }
59
59
  static get is() { return "feedlog-issues"; }
60
60
  static get encapsulation() { return "shadow"; }
@@ -218,7 +218,7 @@ export class FeedlogIssuesClient {
218
218
  const style = hostBg
219
219
  ? { '--feedlog-background': hostBg }
220
220
  : undefined;
221
- return (h("feedlog-issues", { key: '2d9528bb33630664824ab584e10208359d579eb6', style: style, issues: this.issues, limit: this.limit, maxWidth: this.maxWidth, theme: this.theme, heading: this.heading, subtitle: this.subtitle, emptyStateTitle: this.emptyStateTitle, emptyStateMessage: this.emptyStateMessage, getIssueUrl: this.getIssueUrl, loading: this.loading, error: this.error, hasMore: this.hasMore, isLoadingMore: this.isLoadingMore, onFeedlogUpvote: this.handleUpvote, onFeedlogLoadMore: async () => this.loadMore(), part: "base" }, h("slot", { key: 'efe89b9fd0f337af7930823762296487ebcb758e', name: "header", slot: "header" }), h("slot", { key: 'ffebd688ebf25bb464ceefd6a161f7140e03933b', name: "loading", slot: "loading" }), h("slot", { key: 'b59010966b6f7768814ba838c05ffd62cfd1c26a', name: "error", slot: "error" }), h("slot", { key: '99b1abfcbb62703b3642fb02d79d8d1488421ee3', name: "empty-state", slot: "empty-state" }), h("slot", { key: 'c47c1dc83e8434b8f66d1b42b65e812aa5e1f8ee', name: "load-more", slot: "load-more" })));
221
+ return (h("feedlog-issues", { key: '4467ffabd5f18f9af6c8407622fb2554981b54bd', style: style, issues: this.issues, limit: this.limit, maxWidth: this.maxWidth, theme: this.theme, heading: this.heading, subtitle: this.subtitle, emptyStateTitle: this.emptyStateTitle, emptyStateMessage: this.emptyStateMessage, getIssueUrl: this.getIssueUrl, loading: this.loading, error: this.error, hasMore: this.hasMore, isLoadingMore: this.isLoadingMore, onFeedlogUpvote: this.handleUpvote, onFeedlogLoadMore: async () => this.loadMore() }));
222
222
  }
223
223
  static get is() { return "feedlog-issues-client"; }
224
224
  static get encapsulation() { return "shadow"; }
@@ -64,13 +64,13 @@ export class FeedlogIssuesList {
64
64
  return null;
65
65
  const totalPages = Math.ceil(this.issues.length / this.limit);
66
66
  const pageNumbers = this.getPageNumbers();
67
- return (h("nav", { class: "pagination", "aria-label": "Issues pagination", part: "pagination" }, h("button", { type: "button", class: "pagination-btn pagination-arrow", "aria-label": "Previous page", disabled: this.currentPage <= 1, onClick: () => this.goToPage(this.currentPage - 1), part: "pagination-btn pagination-arrow" }, "\u2039"), pageNumbers.map((p, i) => p === 'ellipsis' ? (h("span", { key: `ellipsis-${i}`, class: "pagination-ellipsis", "aria-hidden": "true", part: "pagination-ellipsis" }, "\u2026")) : (h("button", { key: `page-${p}`, type: "button", class: "pagination-btn", "aria-current": p === this.currentPage ? 'page' : undefined, onClick: () => this.goToPage(p), part: `pagination-btn ${p === this.currentPage ? 'pagination-btn-active' : ''}` }, p))), h("button", { type: "button", class: "pagination-btn pagination-arrow", "aria-label": "Next page", disabled: this.currentPage >= totalPages, onClick: () => this.goToPage(this.currentPage + 1), part: "pagination-btn pagination-arrow" }, "\u203A")));
67
+ return (h("nav", { class: "pagination", "aria-label": "Issues pagination" }, h("button", { type: "button", class: "pagination-btn pagination-arrow", "aria-label": "Previous page", disabled: this.currentPage <= 1, onClick: () => this.goToPage(this.currentPage - 1) }, "\u2039"), pageNumbers.map((p, i) => p === 'ellipsis' ? (h("span", { key: `ellipsis-${i}`, class: "pagination-ellipsis", "aria-hidden": "true" }, "\u2026")) : (h("button", { key: `page-${p}`, type: "button", class: "pagination-btn", "aria-current": p === this.currentPage ? 'page' : undefined, onClick: () => this.goToPage(p) }, p))), h("button", { type: "button", class: "pagination-btn pagination-arrow", "aria-label": "Next page", disabled: this.currentPage >= totalPages, onClick: () => this.goToPage(this.currentPage + 1) }, "\u203A")));
68
68
  }
69
69
  render() {
70
70
  const visibleIssues = this.getVisibleIssues();
71
- return (h(Host, { key: 'cfbc683e096ad29327539323e1db97aba4bba373', class: this.theme === 'dark' ? 'dark' : '' }, h("div", { key: 'fb342265514ab879e37136955cb0dc444f381646', class: "issues-list", part: "base" }, visibleIssues.length === 0 ? (h("div", { class: "empty-state", part: "empty-state" }, this.emptyStateTitle && this.emptyStateMessage ? (h("div", { class: "empty-state-content", part: "empty-state-content" }, this.renderEmptyStateIllustration(), h("h2", { class: "empty-state-title", part: "empty-state-title" }, this.emptyStateTitle), h("p", { class: "empty-state-message", part: "empty-state-message" }, this.emptyStateMessage))) : (h("slot", { name: "empty-state" }, h("p", null, "No issues found"))))) : (visibleIssues.map(issue => {
71
+ return (h(Host, { key: '7721ed64730cd8e6b508fc829767ea79b2531628', class: this.theme === 'dark' ? 'dark' : '' }, h("div", { key: '6a2d83f46ce2391294cef018ec243dd13d06a063', class: "issues-list" }, visibleIssues.length === 0 ? (h("div", { class: "empty-state" }, this.emptyStateTitle && this.emptyStateMessage ? (h("div", { class: "empty-state-content" }, this.renderEmptyStateIllustration(), h("h2", { class: "empty-state-title" }, this.emptyStateTitle), h("p", { class: "empty-state-message" }, this.emptyStateMessage))) : (h("p", null, "No issues found")))) : (visibleIssues.map(issue => {
72
72
  var _a, _b;
73
- return (h("feedlog-issue", { key: issue.id, issue: issue, issueUrl: (_b = (_a = this.getIssueUrl) === null || _a === void 0 ? void 0 : _a.call(this, issue)) !== null && _b !== void 0 ? _b : undefined, theme: this.theme, onFeedlogUpvote: (e) => this.handleUpvote(e), part: "issue" }));
73
+ return (h("feedlog-issue", { key: issue.id, issue: issue, issueUrl: (_b = (_a = this.getIssueUrl) === null || _a === void 0 ? void 0 : _a.call(this, issue)) !== null && _b !== void 0 ? _b : undefined, theme: this.theme, onFeedlogUpvote: (e) => this.handleUpvote(e) }));
74
74
  }))), this.renderPagination()));
75
75
  }
76
76
  static get is() { return "feedlog-issues-list"; }
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-DFD585IK.js";const p=o,r=s;export{p as FeedlogBadge,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-DzATWlAC.js";const p=o,r=s;export{p as FeedlogBadge,r as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-I6NOP29P.js";const p=o,r=s;export{p as FeedlogButton,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-DMdb-G26.js";const p=o,r=s;export{p as FeedlogButton,r as defineCustomElement}
@@ -1 +1 @@
1
- import{t as e,p as d,H as o,h as a}from"./index.js";const r=d(class extends o{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}render(){return a("div",{key:"c95d00e338fcf8d985407cda878f50d173c86c71",class:"feedlog-card",part:"base"},a("div",{key:"5001f2e08495d54abb59ddcada568c9ff4c6fb87",class:"feedlog-card-header",part:"header"},a("slot",{key:"b6c6f18a458249aedfb4a95679d4592cfcac4187",name:"header"})),a("div",{key:"99faa1bd9af52fb23cb304e0a87d35b8e14a6358",class:"feedlog-card-content",part:"content"},a("slot",{key:"44370b05b0c2335d6c7271f2807189a7a208be71",name:"content"})),a("div",{key:"e3876d4f589f9ecf917b5a9b5919363c19d08c93",class:"feedlog-card-footer",part:"footer"},a("slot",{key:"be69074d341c8e88f9227d2f035f22838469b035",name:"footer"})))}static get style(){return':host{display:block;font-family:var(--feedlog-font-family)}.feedlog-card{background-color:var(--feedlog-card);color:var(--feedlog-card-foreground);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);box-shadow:var(--feedlog-shadow-sm);transition:box-shadow 0.15s ease;position:relative;display:flex;flex-direction:column}.feedlog-card:hover{box-shadow:var(--feedlog-shadow)}.feedlog-card-header{padding:var(--feedlog-space-6);display:flex;flex-direction:column;gap:var(--feedlog-space-1)}.feedlog-card-content{padding:var(--feedlog-space-6);padding-top:0}.feedlog-card-footer{padding:var(--feedlog-space-6);padding-top:0;display:flex;align-items:center}::slotted([slot="header"]),::slotted([slot="content"]),::slotted([slot="footer"]){display:block}'}},[257,"feedlog-card"]);function t(){"undefined"!=typeof customElements&&["feedlog-card"].forEach((d=>{"feedlog-card"===d&&(customElements.get(e(d))||customElements.define(e(d),r))}))}t();const c=r,f=t;export{c as FeedlogCard,f as defineCustomElement}
1
+ import{t as e,p as o,H as d,h as a}from"./index.js";const r=o(class extends d{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}render(){return a("div",{key:"293a80e66adedfc1af29daf72390a4f464321b96",class:"feedlog-card"},a("slot",{key:"b7e5a827f89035e791d9c756db0f66198e6c5a38",name:"header"}),a("slot",{key:"da89fee0a01068c8438564848f218faa9c5d849e",name:"content"}),a("slot",{key:"30b05e80e4189c0f73810a48f64e072dfac83267",name:"footer"}))}static get style(){return':host{display:block;font-family:ui-monospace, SFMono-Regular, \'SF Mono\', Menlo, Consolas, \'Liberation Mono\', monospace;--feedlog-card:#ffffff;--feedlog-card-foreground:oklch(0.145 0 0);--feedlog-border:rgba(0, 0, 0, 0.1);--feedlog-radius:0.625rem;--feedlog-card-shadow:0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);--feedlog-card-hover-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)}:host(.dark){--feedlog-card:oklch(0.145 0 0);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-border:oklch(0.269 0 0);--feedlog-card-shadow:0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);--feedlog-card-hover-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3)}.feedlog-card{background-color:var(--feedlog-card);color:var(--feedlog-card-foreground);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);box-shadow:var(--feedlog-card-shadow);transition:box-shadow 0.15s ease;position:relative}.feedlog-card:hover{box-shadow:var(--feedlog-card-hover-shadow)}::slotted([slot="header"]){display:block}::slotted([slot="content"]){display:block}::slotted([slot="footer"]){display:block}'}},[257,"feedlog-card"]);function l(){"undefined"!=typeof customElements&&["feedlog-card"].forEach((o=>{"feedlog-card"===o&&(customElements.get(e(o))||customElements.define(e(o),r))}))}l();const s=r,f=l;export{s as FeedlogCard,f as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-CvIMO_S7.js";const p=o,r=s;export{p as FeedlogIssue,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-2RPRQcjh.js";const p=o,r=s;export{p as FeedlogIssue,r as defineCustomElement}
@@ -1 +1 @@
1
- import{t,p as e,H as s,c as i,h as o}from"./index.js";import{p as r,d as n}from"./p-CvIMO_S7.js";import{d as h}from"./p-DFD585IK.js";import{d as a}from"./p-I6NOP29P.js";import{d as u}from"./p-fDVosM5p.js";import{d as l}from"./p-BoxVrJId.js";function d(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function c(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var s=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};s.prototype=e.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(s,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),s}var f,p,b=c(r),m=d(p?f:(p=1,f=self.DOMPurify||(self.DOMPurify=b.default||b)));function g(t){return"string"!=typeof t?"":m.sanitize(t,{USE_PROFILES:{html:!0}})}class y extends Error{constructor(t,e,s){super(t),this.statusCode=e,this.originalError=s,this.name="FeedlogError",Object.setPrototypeOf(this,y.prototype)}}class w extends y{constructor(t){super(t),this.name="FeedlogValidationError",Object.setPrototypeOf(this,w.prototype)}}class v extends y{constructor(t,e,s){super(t,e,s),this.name="FeedlogNetworkError",Object.setPrototypeOf(this,v.prototype)}}class I extends y{constructor(t="Request timed out"){super(t),this.name="FeedlogTimeoutError",Object.setPrototypeOf(this,I.prototype)}}class j{constructor(t){if(this.config={credentials:"include",...t},this.apiKey=this.config.apiKey,!this.apiKey)throw new w("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 v("Failed to fetch issues: "+s.statusText,s.status);const i=await s.json();return this.validateIssuesResponse(i)}catch(t){this.wrapFetchError(t,"Failed to fetch issues")}}async toggleUpvote(t){if(!t||"string"!=typeof t)throw new w("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 v("Issue not found",404);if(401===s.status)throw new v("Unauthorized",401);if(403===s.status)throw new v("Forbidden: Domain not allowed for this repository",403);if(!s.ok)throw new v("Failed to toggle upvote: "+s.statusText,s.status);const i=await s.json();return this.validateUpvoteResponse(i)}catch(t){this.wrapFetchError(t,"Failed to toggle upvote")}}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)}if(t.type&&e.searchParams.set("type",t.type),t.sortBy&&e.searchParams.set("sortBy",t.sortBy),t.cursor&&e.searchParams.set("cursor",t.cursor),void 0!==t.limit){const s=Number(t.limit);e.searchParams.set("limit",(Number.isFinite(s)?Math.max(1,Math.min(100,Math.floor(s))):10)+"")}return""+e}getAuthHeaders(){return{"Content-Type":"application/json","x-api-key":this.apiKey}}wrapFetchError(t,e){if(t instanceof y)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new v("Network error: Unable to reach API",void 0,t);throw new y(`${e}: ${t instanceof Error?t.message:"Unknown error"}`,void 0,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 I(`Request timed out after ${this.timeout}ms`);throw t}}validateIssuesResponse(t){if(!t||"object"!=typeof t)throw new w("Invalid API response: expected object");const e=t;if(!Array.isArray(e.issues))throw new w("Invalid API response: issues must be an array");if(!e.pagination||"object"!=typeof e.pagination)throw new w("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 w("Invalid issue: expected object");const e=t;if("string"!=typeof e.id)throw new w("Invalid issue: id is required and must be a string");if(!["bug","enhancement"].includes(e.type+""))throw new w('Invalid issue: type must be "bug" or "enhancement"');if(!["open","in_progress","closed"].includes(e.status+""))throw new w('Invalid issue: status must be "open", "in_progress", or "closed"');if(!e.repository||"object"!=typeof e.repository)throw new w("Invalid issue: repository is required");const s=e.repository;if("string"!=typeof s.id)throw new w("Invalid issue: repository must have id");const i=null!==e.githubIssueLink&&"string"==typeof e.githubIssueLink?e.githubIssueLink+"":null,o=e.title,r=null!=o&&""!==o?g(o+""):null,n=e.body,h=null!=n&&""!==n?g(n+""):null,a=s.name,u=null!=a&&""!==a?a+"":null,l=s.description,d=null!=l&&""!==l?g(l+""):null,c="number"==typeof e.revision&&Number.isFinite(e.revision)?e.revision:1,f="number"==typeof e.upvoteCount&&Number.isFinite(e.upvoteCount)?e.upvoteCount:0,p="string"==typeof e.updatedAt&&e.updatedAt.length>0?e.updatedAt:(new Date).toISOString(),b="string"==typeof e.createdAt&&e.createdAt.length>0?e.createdAt:(new Date).toISOString();return{id:e.id+"",githubIssueLink:i,type:e.type||"bug",status:e.status||"open",pinnedAt:e.pinnedAt?e.pinnedAt+"":null,revision:c,title:r,body:h,repository:{id:s.id+"",name:u,description:d},updatedAt:p,createdAt:b,upvoteCount:f,hasUpvoted:!!e.hasUpvoted}}validateUpvoteResponse(t){if(!t||"object"!=typeof t)throw new w("Invalid upvote response: expected object");const e=t;if("boolean"!=typeof e.upvoted)throw new w("Invalid upvote response: upvoted must be a boolean");if("number"!=typeof e.upvoteCount)throw new w("Invalid upvote response: upvoteCount must be a number");if("string"!=typeof e.anonymousUserId)throw new w("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 E=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.feedlogUpvote=i(this,"feedlogUpvote"),this.feedlogError=i(this,"feedlogError"),this.maxWidth="42rem",this.theme="light",this.issues=[],this.loading=!0,this.error=null,this.cursor=null,this.hasMore=!1,this.isLoadingMore=!1,this.sdk=null,this.fetchRequestId=0,this.isDisconnected=!1,this.upvoteRequestIds=new Map,this.handleUpvote=async t=>{if(!this.sdk||this.isDisconnected)return;const{issueId:e,currentUpvoted:s,currentCount:i}=t.detail,o=(this.upvoteRequestIds.get(e)||0)+1;this.upvoteRequestIds.set(e,o),this.issues=this.issues.map((t=>t.id===e?Object.assign(Object.assign({},t),{hasUpvoted:!s,upvoteCount:s?i-1:i+1}):t));try{const t=await this.sdk.toggleUpvote(e);if(this.isDisconnected||this.upvoteRequestIds.get(e)!==o)return;this.issues=this.issues.map((s=>s.id===e?Object.assign(Object.assign({},s),{hasUpvoted:t.upvoted,upvoteCount:t.upvoteCount}):s)),this.feedlogUpvote.emit({issueId:e,upvoted:t.upvoted,upvoteCount:t.upvoteCount})}catch(t){if(this.isDisconnected||this.upvoteRequestIds.get(e)!==o)return;this.issues=this.issues.map((t=>t.id===e?Object.assign(Object.assign({},t),{hasUpvoted:s,upvoteCount:i}):t)),this.feedlogError.emit({error:t instanceof Error?t.message:"Failed to toggle upvote"})}}}componentWillLoad(){if(this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy,this.initializeSDK(),!(this.issues.length>0)||this.loading)return this.fetchIssues()}disconnectedCallback(){this.isDisconnected=!0,this.fetchRequestId++}componentDidUpdate(){(this.previousType!==this.type||this.previousLimit!==this.limit||this.previousSortBy!==this.sortBy)&&(this.fetchRequestId++,this.cursor=null,this.hasMore=!1,this.issues=[],this.fetchIssues().catch((()=>{})),this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy)}initializeSDK(){try{if(!this.apiKey)throw Error("API key is required for the Feedlog SDK");this.sdk=new j(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})}}buildFetchParams(){const t={};return this.type&&(t.type=this.type),this.sortBy&&(t.sortBy=this.sortBy),this.limit&&(t.limit=this.limit),this.cursor&&(t.cursor=this.cursor),t}async fetchIssues(){if(!this.sdk)return;const t=this.fetchRequestId;try{this.loading=!0,this.error=null;const e=this.buildFetchParams(),s=await this.sdk.fetchIssues(e);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=s.issues,this.cursor=s.pagination.cursor,this.hasMore=s.pagination.hasMore}catch(e){if(this.isDisconnected||t!==this.fetchRequestId)return;const s=e instanceof Error?e.message:"Couldn't load updates";this.error=s,this.issues=[],this.feedlogError.emit({error:s,code:null==e?void 0:e.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.loading=!1,this.isLoadingMore=!1)}}async loadMore(){if(!this.sdk||!this.hasMore||this.isLoadingMore||this.loading)return;const t=this.fetchRequestId;this.isLoadingMore=!0;try{const e=this.buildFetchParams(),s=await this.sdk.fetchIssues(e);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=[...this.issues,...s.issues],this.cursor=s.pagination.cursor,this.hasMore=s.pagination.hasMore}catch(e){if(this.isDisconnected||t!==this.fetchRequestId)return;this.feedlogError.emit({error:e instanceof Error?e.message:"Failed to load more issues",code:null==e?void 0:e.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.isLoadingMore=!1)}}render(){var t,e;const s=null===(e=null===(t=this.el)||void 0===t?void 0:t.style)||void 0===e?void 0:e.getPropertyValue("--feedlog-background");return o("feedlog-issues",{key:"2d9528bb33630664824ab584e10208359d579eb6",style:s?{"--feedlog-background":s}:void 0,issues:this.issues,limit:this.limit,maxWidth:this.maxWidth,theme:this.theme,heading:this.heading,subtitle:this.subtitle,emptyStateTitle:this.emptyStateTitle,emptyStateMessage:this.emptyStateMessage,getIssueUrl:this.getIssueUrl,loading:this.loading,error:this.error,hasMore:this.hasMore,isLoadingMore:this.isLoadingMore,onFeedlogUpvote:this.handleUpvote,onFeedlogLoadMore:async()=>this.loadMore(),part:"base"},o("slot",{key:"efe89b9fd0f337af7930823762296487ebcb758e",name:"header",slot:"header"}),o("slot",{key:"ffebd688ebf25bb464ceefd6a161f7140e03933b",name:"loading",slot:"loading"}),o("slot",{key:"b59010966b6f7768814ba838c05ffd62cfd1c26a",name:"error",slot:"error"}),o("slot",{key:"99b1abfcbb62703b3642fb02d79d8d1488421ee3",name:"empty-state",slot:"empty-state"}),o("slot",{key:"c47c1dc83e8434b8f66d1b42b65e812aa5e1f8ee",name:"load-more",slot:"load-more"}))}get el(){return this}},[257,"feedlog-issues-client",{apiKey:[1,"api-key"],type:[1],limit:[2],sortBy:[1,"sort-by"],endpoint:[1],maxWidth:[1,"max-width"],theme:[1],heading:[1],subtitle:[1],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"],getIssueUrl:[16],issues:[32],loading:[32],error:[32],cursor:[32],hasMore:[32],isLoadingMore:[32]}]);function k(){"undefined"!=typeof customElements&&["feedlog-issues-client","feedlog-badge","feedlog-button","feedlog-issue","feedlog-issues","feedlog-issues-list"].forEach((e=>{switch(e){case"feedlog-issues-client":customElements.get(t(e))||customElements.define(t(e),E);break;case"feedlog-badge":customElements.get(t(e))||h();break;case"feedlog-button":customElements.get(t(e))||a();break;case"feedlog-issue":customElements.get(t(e))||n();break;case"feedlog-issues":customElements.get(t(e))||u();break;case"feedlog-issues-list":customElements.get(t(e))||l()}}))}k();const O=E,U=k;export{O as FeedlogIssuesClient,U as defineCustomElement}
1
+ import{t,p as e,H as s,c as i,h as o}from"./index.js";import{p as r,d as n}from"./p-2RPRQcjh.js";import{d as h}from"./p-DzATWlAC.js";import{d as u}from"./p-DMdb-G26.js";import{d as a}from"./p-DsLDsYLY.js";import{d as l}from"./p-CVEXMLCP.js";function c(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function d(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var s=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};s.prototype=e.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(s,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),s}var p,f,m=d(r),g=c(f?p:(f=1,p=self.DOMPurify||(self.DOMPurify=m.default||m)));function b(t){return"string"!=typeof t?"":g.sanitize(t,{USE_PROFILES:{html:!0}})}class w extends Error{constructor(t,e,s){super(t),this.statusCode=e,this.originalError=s,this.name="FeedlogError",Object.setPrototypeOf(this,w.prototype)}}class y extends w{constructor(t){super(t),this.name="FeedlogValidationError",Object.setPrototypeOf(this,y.prototype)}}class v extends w{constructor(t,e,s){super(t,e,s),this.name="FeedlogNetworkError",Object.setPrototypeOf(this,v.prototype)}}class I extends w{constructor(t="Request timed out"){super(t),this.name="FeedlogTimeoutError",Object.setPrototypeOf(this,I.prototype)}}class j{constructor(t){if(this.config={credentials:"include",...t},this.apiKey=this.config.apiKey,!this.apiKey)throw new y("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 v("Failed to fetch issues: "+s.statusText,s.status);const i=await s.json();return this.validateIssuesResponse(i)}catch(t){this.wrapFetchError(t,"Failed to fetch issues")}}async toggleUpvote(t){if(!t||"string"!=typeof t)throw new y("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 v("Issue not found",404);if(401===s.status)throw new v("Unauthorized",401);if(403===s.status)throw new v("Forbidden: Domain not allowed for this repository",403);if(!s.ok)throw new v("Failed to toggle upvote: "+s.statusText,s.status);const i=await s.json();return this.validateUpvoteResponse(i)}catch(t){this.wrapFetchError(t,"Failed to toggle upvote")}}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)}if(t.type&&e.searchParams.set("type",t.type),t.sortBy&&e.searchParams.set("sortBy",t.sortBy),t.cursor&&e.searchParams.set("cursor",t.cursor),void 0!==t.limit){const s=Number(t.limit);e.searchParams.set("limit",(Number.isFinite(s)?Math.max(1,Math.min(100,Math.floor(s))):10)+"")}return""+e}getAuthHeaders(){return{"Content-Type":"application/json","x-api-key":this.apiKey}}wrapFetchError(t,e){if(t instanceof w)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new v("Network error: Unable to reach API",void 0,t);throw new w(`${e}: ${t instanceof Error?t.message:"Unknown error"}`,void 0,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 I(`Request timed out after ${this.timeout}ms`);throw t}}validateIssuesResponse(t){if(!t||"object"!=typeof t)throw new y("Invalid API response: expected object");const e=t;if(!Array.isArray(e.issues))throw new y("Invalid API response: issues must be an array");if(!e.pagination||"object"!=typeof e.pagination)throw new y("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 y("Invalid issue: expected object");const e=t;if("string"!=typeof e.id)throw new y("Invalid issue: id is required and must be a string");if(!["bug","enhancement"].includes(e.type+""))throw new y('Invalid issue: type must be "bug" or "enhancement"');if(!["open","in_progress","closed"].includes(e.status+""))throw new y('Invalid issue: status must be "open", "in_progress", or "closed"');if(!e.repository||"object"!=typeof e.repository)throw new y("Invalid issue: repository is required");const s=e.repository;if("string"!=typeof s.id)throw new y("Invalid issue: repository must have id");const i=null!==e.githubIssueLink&&"string"==typeof e.githubIssueLink?e.githubIssueLink+"":null,o=e.title,r=null!=o&&""!==o?b(o+""):null,n=e.body,h=null!=n&&""!==n?b(n+""):null,u=s.name,a=null!=u&&""!==u?u+"":null,l=s.description,c=null!=l&&""!==l?b(l+""):null,d="number"==typeof e.revision&&Number.isFinite(e.revision)?e.revision:1,p="number"==typeof e.upvoteCount&&Number.isFinite(e.upvoteCount)?e.upvoteCount:0,f="string"==typeof e.updatedAt&&e.updatedAt.length>0?e.updatedAt:(new Date).toISOString(),m="string"==typeof e.createdAt&&e.createdAt.length>0?e.createdAt:(new Date).toISOString();return{id:e.id+"",githubIssueLink:i,type:e.type||"bug",status:e.status||"open",pinnedAt:e.pinnedAt?e.pinnedAt+"":null,revision:d,title:r,body:h,repository:{id:s.id+"",name:a,description:c},updatedAt:f,createdAt:m,upvoteCount:p,hasUpvoted:!!e.hasUpvoted}}validateUpvoteResponse(t){if(!t||"object"!=typeof t)throw new y("Invalid upvote response: expected object");const e=t;if("boolean"!=typeof e.upvoted)throw new y("Invalid upvote response: upvoted must be a boolean");if("number"!=typeof e.upvoteCount)throw new y("Invalid upvote response: upvoteCount must be a number");if("string"!=typeof e.anonymousUserId)throw new y("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 E=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.feedlogUpvote=i(this,"feedlogUpvote"),this.feedlogError=i(this,"feedlogError"),this.maxWidth="42rem",this.theme="light",this.issues=[],this.loading=!0,this.error=null,this.cursor=null,this.hasMore=!1,this.isLoadingMore=!1,this.sdk=null,this.fetchRequestId=0,this.isDisconnected=!1,this.upvoteRequestIds=new Map,this.handleUpvote=async t=>{if(!this.sdk||this.isDisconnected)return;const{issueId:e,currentUpvoted:s,currentCount:i}=t.detail,o=(this.upvoteRequestIds.get(e)||0)+1;this.upvoteRequestIds.set(e,o),this.issues=this.issues.map((t=>t.id===e?Object.assign(Object.assign({},t),{hasUpvoted:!s,upvoteCount:s?i-1:i+1}):t));try{const t=await this.sdk.toggleUpvote(e);if(this.isDisconnected||this.upvoteRequestIds.get(e)!==o)return;this.issues=this.issues.map((s=>s.id===e?Object.assign(Object.assign({},s),{hasUpvoted:t.upvoted,upvoteCount:t.upvoteCount}):s)),this.feedlogUpvote.emit({issueId:e,upvoted:t.upvoted,upvoteCount:t.upvoteCount})}catch(t){if(this.isDisconnected||this.upvoteRequestIds.get(e)!==o)return;this.issues=this.issues.map((t=>t.id===e?Object.assign(Object.assign({},t),{hasUpvoted:s,upvoteCount:i}):t)),this.feedlogError.emit({error:t instanceof Error?t.message:"Failed to toggle upvote"})}}}componentWillLoad(){if(this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy,this.initializeSDK(),!(this.issues.length>0)||this.loading)return this.fetchIssues()}disconnectedCallback(){this.isDisconnected=!0,this.fetchRequestId++}componentDidUpdate(){(this.previousType!==this.type||this.previousLimit!==this.limit||this.previousSortBy!==this.sortBy)&&(this.fetchRequestId++,this.cursor=null,this.hasMore=!1,this.issues=[],this.fetchIssues().catch((()=>{})),this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy)}initializeSDK(){try{if(!this.apiKey)throw Error("API key is required for the Feedlog SDK");this.sdk=new j(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})}}buildFetchParams(){const t={};return this.type&&(t.type=this.type),this.sortBy&&(t.sortBy=this.sortBy),this.limit&&(t.limit=this.limit),this.cursor&&(t.cursor=this.cursor),t}async fetchIssues(){if(!this.sdk)return;const t=this.fetchRequestId;try{this.loading=!0,this.error=null;const e=this.buildFetchParams(),s=await this.sdk.fetchIssues(e);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=s.issues,this.cursor=s.pagination.cursor,this.hasMore=s.pagination.hasMore}catch(e){if(this.isDisconnected||t!==this.fetchRequestId)return;const s=e instanceof Error?e.message:"Couldn't load updates";this.error=s,this.issues=[],this.feedlogError.emit({error:s,code:null==e?void 0:e.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.loading=!1,this.isLoadingMore=!1)}}async loadMore(){if(!this.sdk||!this.hasMore||this.isLoadingMore||this.loading)return;const t=this.fetchRequestId;this.isLoadingMore=!0;try{const e=this.buildFetchParams(),s=await this.sdk.fetchIssues(e);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=[...this.issues,...s.issues],this.cursor=s.pagination.cursor,this.hasMore=s.pagination.hasMore}catch(e){if(this.isDisconnected||t!==this.fetchRequestId)return;this.feedlogError.emit({error:e instanceof Error?e.message:"Failed to load more issues",code:null==e?void 0:e.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.isLoadingMore=!1)}}render(){var t,e;const s=null===(e=null===(t=this.el)||void 0===t?void 0:t.style)||void 0===e?void 0:e.getPropertyValue("--feedlog-background");return o("feedlog-issues",{key:"4467ffabd5f18f9af6c8407622fb2554981b54bd",style:s?{"--feedlog-background":s}:void 0,issues:this.issues,limit:this.limit,maxWidth:this.maxWidth,theme:this.theme,heading:this.heading,subtitle:this.subtitle,emptyStateTitle:this.emptyStateTitle,emptyStateMessage:this.emptyStateMessage,getIssueUrl:this.getIssueUrl,loading:this.loading,error:this.error,hasMore:this.hasMore,isLoadingMore:this.isLoadingMore,onFeedlogUpvote:this.handleUpvote,onFeedlogLoadMore:async()=>this.loadMore()})}get el(){return this}},[1,"feedlog-issues-client",{apiKey:[1,"api-key"],type:[1],limit:[2],sortBy:[1,"sort-by"],endpoint:[1],maxWidth:[1,"max-width"],theme:[1],heading:[1],subtitle:[1],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"],getIssueUrl:[16],issues:[32],loading:[32],error:[32],cursor:[32],hasMore:[32],isLoadingMore:[32]}]);function U(){"undefined"!=typeof customElements&&["feedlog-issues-client","feedlog-badge","feedlog-button","feedlog-issue","feedlog-issues","feedlog-issues-list"].forEach((e=>{switch(e){case"feedlog-issues-client":customElements.get(t(e))||customElements.define(t(e),E);break;case"feedlog-badge":customElements.get(t(e))||h();break;case"feedlog-button":customElements.get(t(e))||u();break;case"feedlog-issue":customElements.get(t(e))||n();break;case"feedlog-issues":customElements.get(t(e))||a();break;case"feedlog-issues-list":customElements.get(t(e))||l()}}))}U();const F=E,O=U;export{F as FeedlogIssuesClient,O as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as r}from"./p-BoxVrJId.js";const s=o,p=r;export{s as FeedlogIssuesList,p as defineCustomElement}
1
+ import{F as o,d as s}from"./p-CVEXMLCP.js";const p=o,r=s;export{p as FeedlogIssuesList,r as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-fDVosM5p.js";const p=o,r=s;export{p as FeedlogIssues,r as defineCustomElement}
1
+ import{F as s,d as o}from"./p-DsLDsYLY.js";const p=s,r=o;export{p as FeedlogIssues,r as defineCustomElement}