@feedlog-ai/webcomponents 0.0.38 → 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.
- package/dist/cjs/feedlog-badge.cjs.entry.js +3 -3
- package/dist/cjs/feedlog-button_3.cjs.entry.js +8 -8
- package/dist/cjs/feedlog-card.cjs.entry.js +3 -3
- package/dist/cjs/feedlog-issues-client.cjs.entry.js +2 -2
- package/dist/cjs/feedlog-issues.cjs.entry.js +4 -4
- package/dist/cjs/feedlog-toolkit.cjs.js +2 -2
- package/dist/cjs/{index-prPyjPBk.js → index-CXKBwRlh.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/feedlog-badge/feedlog-badge.css +45 -35
- package/dist/collection/components/feedlog-badge/feedlog-badge.js +1 -1
- package/dist/collection/components/feedlog-button/feedlog-button.css +66 -16
- package/dist/collection/components/feedlog-button/feedlog-button.js +1 -1
- package/dist/collection/components/feedlog-card/feedlog-card.css +24 -22
- package/dist/collection/components/feedlog-card/feedlog-card.js +1 -1
- package/dist/collection/components/feedlog-issue/feedlog-issue.css +187 -99
- package/dist/collection/components/feedlog-issue/feedlog-issue.js +1 -1
- package/dist/collection/components/feedlog-issues/feedlog-issues.css +63 -34
- package/dist/collection/components/feedlog-issues/feedlog-issues.js +2 -2
- package/dist/collection/components/feedlog-issues-client/feedlog-issues-client.js +1 -1
- package/dist/collection/components/feedlog-issues-list/feedlog-issues-list.js +3 -3
- package/dist/components/feedlog-badge.js +1 -1
- package/dist/components/feedlog-button.js +1 -1
- package/dist/components/feedlog-card.js +1 -1
- package/dist/components/feedlog-issue.js +1 -1
- package/dist/components/feedlog-issues-client.js +1 -1
- package/dist/components/feedlog-issues-list.js +1 -1
- package/dist/components/feedlog-issues.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-CvIMO_S7.js → p-2RPRQcjh.js} +2 -2
- package/dist/components/p-CVEXMLCP.js +1 -0
- package/dist/components/p-DMdb-G26.js +1 -0
- package/dist/components/p-DsLDsYLY.js +1 -0
- package/dist/components/p-DzATWlAC.js +1 -0
- package/dist/esm/feedlog-badge.entry.js +3 -3
- package/dist/esm/feedlog-button_3.entry.js +8 -8
- package/dist/esm/feedlog-card.entry.js +3 -3
- package/dist/esm/feedlog-issues-client.entry.js +2 -2
- package/dist/esm/feedlog-issues.entry.js +4 -4
- package/dist/esm/feedlog-toolkit.js +3 -3
- package/dist/esm/{index-Cu1eYdKa.js → index-CgNWSmzU.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/feedlog-toolkit/feedlog-toolkit.css +1 -1
- package/dist/feedlog-toolkit/feedlog-toolkit.esm.js +1 -1
- package/dist/feedlog-toolkit/p-2901a753.entry.js +1 -0
- package/dist/feedlog-toolkit/p-32663f65.entry.js +1 -0
- package/dist/feedlog-toolkit/{p-ca90ade9.entry.js → p-8ab2cdd9.entry.js} +1 -1
- package/dist/feedlog-toolkit/p-CgNWSmzU.js +2 -0
- package/dist/feedlog-toolkit/p-c1e83493.entry.js +1 -0
- package/dist/feedlog-toolkit/p-da0268a8.entry.js +1 -0
- package/dist/types/index.d.ts +1 -1
- package/hydrate/index.js +19 -19
- package/hydrate/index.mjs +19 -19
- package/package.json +7 -4
- package/dist/components/p-BoxVrJId.js +0 -1
- package/dist/components/p-DFD585IK.js +0 -1
- package/dist/components/p-I6NOP29P.js +0 -1
- package/dist/components/p-fDVosM5p.js +0 -1
- package/dist/feedlog-toolkit/p-001d7353.entry.js +0 -1
- package/dist/feedlog-toolkit/p-556062d0.entry.js +0 -1
- package/dist/feedlog-toolkit/p-62554649.entry.js +0 -1
- package/dist/feedlog-toolkit/p-Cu1eYdKa.js +0 -2
- package/dist/feedlog-toolkit/p-b558fc9f.entry.js +0 -1
|
@@ -1,30 +1,59 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: block;
|
|
3
|
-
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:
|
|
7
|
-
--feedlog-
|
|
8
|
-
--feedlog-
|
|
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:
|
|
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
|
|
52
|
+
border-radius: var(--feedlog-radius);
|
|
24
53
|
}
|
|
25
54
|
|
|
26
55
|
.issues-header {
|
|
27
|
-
margin-bottom:
|
|
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
|
|
40
|
-
font-size:
|
|
41
|
-
font-weight:
|
|
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:
|
|
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
|
|
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:
|
|
82
|
-
padding-left: calc(
|
|
110
|
+
padding: 1.25rem;
|
|
111
|
+
padding-left: calc(1.25rem + 3px);
|
|
83
112
|
display: flex;
|
|
84
113
|
flex-direction: column;
|
|
85
|
-
gap:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
143
|
+
gap: 0.5rem;
|
|
115
144
|
}
|
|
116
145
|
|
|
117
146
|
.skeleton-title {
|
|
118
147
|
height: 0.9375rem;
|
|
119
|
-
border-radius:
|
|
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:
|
|
157
|
+
gap: 0.375rem;
|
|
129
158
|
}
|
|
130
159
|
|
|
131
160
|
.skeleton-line {
|
|
132
161
|
height: 0.8125rem;
|
|
133
|
-
border-radius:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
223
|
+
margin-bottom: 1rem;
|
|
195
224
|
}
|
|
196
225
|
|
|
197
226
|
.error-state-title {
|
|
198
|
-
margin: 0 0
|
|
199
|
-
font-size:
|
|
200
|
-
font-weight:
|
|
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
|
|
207
|
-
font-size:
|
|
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:
|
|
216
|
-
gap:
|
|
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)
|
|
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: '
|
|
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: '
|
|
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"
|
|
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: '
|
|
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)
|
|
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-
|
|
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-
|
|
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
|
|
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-
|
|
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
|
|
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
|
|
1
|
+
import{F as s,d as o}from"./p-DsLDsYLY.js";const p=s,r=o;export{p as FeedlogIssues,r as defineCustomElement}
|