@feedlog-ai/webcomponents 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -5
- package/dist/cjs/feedlog-badge.cjs.entry.js +3 -3
- package/dist/cjs/feedlog-button_2.cjs.entry.js +1547 -8
- package/dist/cjs/feedlog-card.cjs.entry.js +1 -1
- package/dist/cjs/feedlog-github-issues-client.cjs.entry.js +24 -18
- package/dist/cjs/feedlog-github-issues.cjs.entry.js +14 -4
- package/dist/cjs/feedlog-issues-list.cjs.entry.js +8 -37
- package/dist/cjs/feedlog-toolkit.cjs.js +2 -2
- package/dist/cjs/{index-5lluu_3h.js → index-DnsqTPII.js} +0 -37
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/feedlog-badge/feedlog-badge.css +15 -3
- package/dist/collection/components/feedlog-badge/feedlog-badge.js +3 -3
- package/dist/collection/components/feedlog-github-issues/feedlog-github-issues.css +202 -13
- package/dist/collection/components/feedlog-github-issues/feedlog-github-issues.js +73 -2
- package/dist/collection/components/feedlog-github-issues/feedlog-github-issues.stories.js +56 -6
- package/dist/collection/components/feedlog-github-issues-client/feedlog-github-issues-client.js +63 -2
- package/dist/collection/components/feedlog-issue/feedlog-issue.css +196 -46
- package/dist/collection/components/feedlog-issue/feedlog-issue.js +71 -6
- package/dist/collection/components/feedlog-issue/feedlog-issue.stories.js +115 -3
- package/dist/collection/components/feedlog-issues-list/feedlog-issues-list.css +3 -209
- package/dist/collection/components/feedlog-issues-list/feedlog-issues-list.js +29 -35
- package/dist/collection/utils/markdown.js +48 -0
- package/dist/components/feedlog-badge.js +1 -1
- package/dist/components/feedlog-github-issues-client.js +1 -1
- package/dist/components/feedlog-github-issues.js +1 -1
- package/dist/components/feedlog-issue.js +1 -1
- package/dist/components/feedlog-issues-list.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/p-BBPFf6g7.js +3 -0
- package/dist/components/p-Chc3XZ5Y.js +1 -0
- package/dist/components/p-cag4iyHV.js +1 -0
- package/dist/esm/feedlog-badge.entry.js +3 -3
- package/dist/esm/feedlog-button_2.entry.js +1547 -8
- package/dist/esm/feedlog-card.entry.js +1 -1
- package/dist/esm/feedlog-github-issues-client.entry.js +24 -18
- package/dist/esm/feedlog-github-issues.entry.js +14 -4
- package/dist/esm/feedlog-issues-list.entry.js +8 -37
- package/dist/esm/feedlog-toolkit.js +3 -3
- package/dist/esm/{index-CkB6Yzeb.js → index-rs_66Oq4.js} +0 -37
- package/dist/esm/loader.js +3 -3
- package/dist/feedlog-toolkit/feedlog-toolkit.esm.js +1 -1
- package/dist/feedlog-toolkit/p-13773ed6.entry.js +1 -0
- package/dist/feedlog-toolkit/{p-cdb2b098.entry.js → p-4e90285c.entry.js} +1 -1
- package/dist/feedlog-toolkit/p-9b515728.entry.js +1 -0
- package/dist/feedlog-toolkit/p-da51c7fd.entry.js +1 -0
- package/dist/feedlog-toolkit/p-dad7b157.entry.js +3 -0
- package/dist/feedlog-toolkit/p-e5ba7dd7.entry.js +1 -0
- package/dist/feedlog-toolkit/p-rs_66Oq4.js +2 -0
- package/dist/types/components/feedlog-badge/feedlog-badge.d.ts +1 -1
- package/dist/types/components/feedlog-github-issues/feedlog-github-issues.d.ts +16 -1
- package/dist/types/components/feedlog-github-issues/feedlog-github-issues.stories.d.ts +1 -0
- package/dist/types/components/feedlog-github-issues-client/feedlog-github-issues-client.d.ts +14 -1
- package/dist/types/components/feedlog-issue/feedlog-issue.d.ts +19 -2
- package/dist/types/components/feedlog-issue/feedlog-issue.stories.d.ts +10 -0
- package/dist/types/components/feedlog-issues-list/feedlog-issues-list.d.ts +5 -5
- package/dist/types/components.d.ts +68 -4
- package/dist/types/utils/markdown.d.ts +5 -0
- package/package.json +4 -2
- package/dist/components/p-Bu_AsIay.js +0 -1
- package/dist/components/p-CHtSMTyP.js +0 -1
- package/dist/components/p-Cp7B8xwh.js +0 -1
- package/dist/feedlog-toolkit/p-2401f510.entry.js +0 -1
- package/dist/feedlog-toolkit/p-5df44120.entry.js +0 -1
- package/dist/feedlog-toolkit/p-95fea2f4.entry.js +0 -1
- package/dist/feedlog-toolkit/p-CkB6Yzeb.js +0 -2
- package/dist/feedlog-toolkit/p-b4b631f3.entry.js +0 -1
- package/dist/feedlog-toolkit/p-c19a4d1b.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-
|
|
1
|
+
import { r as registerInstance, h } from './index-rs_66Oq4.js';
|
|
2
2
|
|
|
3
3
|
const feedlogCardCss = () => `: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}`;
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-rs_66Oq4.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* HTML and XSS sanitization utilities
|
|
@@ -258,29 +258,35 @@ class FeedlogSDK {
|
|
|
258
258
|
if (typeof issue.id !== 'string') {
|
|
259
259
|
throw new FeedlogValidationError('Invalid issue: id is required and must be a string');
|
|
260
260
|
}
|
|
261
|
-
if (typeof issue.title !== 'string') {
|
|
262
|
-
throw new FeedlogValidationError('Invalid issue: title is required and must be a string');
|
|
263
|
-
}
|
|
264
261
|
if (!['bug', 'enhancement'].includes(String(issue.type))) {
|
|
265
262
|
throw new FeedlogValidationError('Invalid issue: type must be "bug" or "enhancement"');
|
|
266
263
|
}
|
|
267
|
-
if (!['open', 'closed'].includes(String(issue.status))) {
|
|
268
|
-
throw new FeedlogValidationError('Invalid issue: status must be "open" or "closed"');
|
|
264
|
+
if (!['open', 'in_progress', 'closed'].includes(String(issue.status))) {
|
|
265
|
+
throw new FeedlogValidationError('Invalid issue: status must be "open", "in_progress", or "closed"');
|
|
269
266
|
}
|
|
270
267
|
if (!issue.repository || typeof issue.repository !== 'object') {
|
|
271
268
|
throw new FeedlogValidationError('Invalid issue: repository is required');
|
|
272
269
|
}
|
|
273
270
|
const repo = issue.repository;
|
|
274
|
-
if (typeof repo.id !== 'string'
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
271
|
+
if (typeof repo.id !== 'string') {
|
|
272
|
+
throw new FeedlogValidationError('Invalid issue: repository must have id');
|
|
273
|
+
}
|
|
274
|
+
// githubIssueLink: string | null (null for private repos)
|
|
275
|
+
const githubIssueLink = issue.githubIssueLink !== null && typeof issue.githubIssueLink === 'string'
|
|
276
|
+
? String(issue.githubIssueLink)
|
|
277
|
+
: null;
|
|
278
|
+
// Sanitize string fields to prevent XSS (handle null)
|
|
279
|
+
const rawTitle = issue.title;
|
|
280
|
+
const sanitizedTitle = rawTitle != null && rawTitle !== '' ? sanitizeHtml(String(rawTitle)) : null;
|
|
281
|
+
const rawBody = issue.body;
|
|
282
|
+
const sanitizedBody = rawBody != null && rawBody !== '' ? sanitizeHtml(String(rawBody)) : null;
|
|
283
|
+
const rawRepoName = repo.name;
|
|
284
|
+
const repoName = rawRepoName != null && rawRepoName !== '' ? String(rawRepoName) : null;
|
|
285
|
+
const rawRepoDesc = repo.description;
|
|
286
|
+
const repoDescription = rawRepoDesc != null && rawRepoDesc !== '' ? sanitizeHtml(String(rawRepoDesc)) : null;
|
|
282
287
|
return {
|
|
283
288
|
id: String(issue.id),
|
|
289
|
+
githubIssueLink,
|
|
284
290
|
type: issue.type || 'bug',
|
|
285
291
|
status: issue.status || 'open',
|
|
286
292
|
pinnedAt: issue.pinnedAt ? String(issue.pinnedAt) : null,
|
|
@@ -289,8 +295,8 @@ class FeedlogSDK {
|
|
|
289
295
|
body: sanitizedBody,
|
|
290
296
|
repository: {
|
|
291
297
|
id: String(repo.id),
|
|
292
|
-
name:
|
|
293
|
-
|
|
298
|
+
name: repoName,
|
|
299
|
+
description: repoDescription,
|
|
294
300
|
},
|
|
295
301
|
updatedAt: String(issue.updatedAt) || new Date().toISOString(),
|
|
296
302
|
createdAt: String(issue.createdAt) || new Date().toISOString(),
|
|
@@ -480,7 +486,7 @@ const FeedlogGithubIssuesClient = class {
|
|
|
480
486
|
if (this.isDisconnected || currentRequestId !== this.fetchRequestId) {
|
|
481
487
|
return;
|
|
482
488
|
}
|
|
483
|
-
const errorMsg = err instanceof Error ? err.message : '
|
|
489
|
+
const errorMsg = err instanceof Error ? err.message : "Couldn't load updates";
|
|
484
490
|
this.error = errorMsg;
|
|
485
491
|
this.issues = [];
|
|
486
492
|
this.feedlogError.emit({
|
|
@@ -545,7 +551,7 @@ const FeedlogGithubIssuesClient = class {
|
|
|
545
551
|
}
|
|
546
552
|
}
|
|
547
553
|
render() {
|
|
548
|
-
return (h("feedlog-github-issues", { key: '
|
|
554
|
+
return (h("feedlog-github-issues", { key: '4bc46e4f2622d4c2c5080835ae436ae9fc37c991', issues: this.issues, maxWidth: this.maxWidth, theme: this.theme, heading: this.heading, subtitle: this.subtitle, emptyStateTitle: this.emptyStateTitle, emptyStateMessage: this.emptyStateMessage, getIssueUrl: this.getIssueUrl, loading: this.loading, error: this.error, hasMore: this.hasMore, isLoadingMore: this.isLoadingMore, onFeedlogUpvote: this.handleUpvote, onFeedlogLoadMore: async () => this.loadMore() }));
|
|
549
555
|
}
|
|
550
556
|
};
|
|
551
557
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-rs_66Oq4.js';
|
|
2
2
|
|
|
3
|
-
const feedlogGithubIssuesCss = () => `:host{display:block;font-family:ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;--feedlog-background:#ffffff;--feedlog-foreground:oklch(0.145 0 0);--feedlog-card:#ffffff;--feedlog-card-foreground:oklch(0.145 0 0);--feedlog-muted:#ececf0;--feedlog-muted-foreground:#717182;--feedlog-border:rgba(0, 0, 0, 0.1);--feedlog-accent-color:#2563eb;--feedlog-destructive:#d4183d;--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-100:oklch(0.932 0.032 255.585);--feedlog-red-100:#fce7f3;--feedlog-red-400:#f472b6;--feedlog-red-600:#db2777;--feedlog-radius:0.625rem;--feedlog-gap:0.5rem;--feedlog-padding:2rem}:host(.dark){--feedlog-background:oklch(0.
|
|
3
|
+
const feedlogGithubIssuesCss = () => `:host{display:block;font-family:ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;--feedlog-background:#ffffff;--feedlog-foreground:oklch(0.145 0 0);--feedlog-card:#ffffff;--feedlog-card-foreground:oklch(0.145 0 0);--feedlog-muted:#ececf0;--feedlog-muted-foreground:#717182;--feedlog-border:rgba(0, 0, 0, 0.1);--feedlog-accent-color:#2563eb;--feedlog-destructive:#d4183d;--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-100:oklch(0.932 0.032 255.585);--feedlog-red-100:#fce7f3;--feedlog-red-400:#f472b6;--feedlog-red-600:#db2777;--feedlog-radius:0.625rem;--feedlog-gap:0.5rem;--feedlog-padding:2rem;--feedlog-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);--feedlog-empty-illustration-bg:oklch(0.96 0.01 260);--feedlog-empty-illustration-stroke:oklch(0.75 0.02 260);--feedlog-empty-illustration-muted:oklch(0.82 0.01 260)}:host(.dark){--feedlog-background:oklch(0.18 0.01 260);--feedlog-foreground:oklch(0.985 0 0);--feedlog-card:oklch(0.24 0.01 260);--feedlog-card-foreground:oklch(0.985 0 0);--feedlog-muted:oklch(0.32 0.01 260);--feedlog-muted-foreground:oklch(0.72 0.02 260);--feedlog-border:oklch(0.34 0.01 260);--feedlog-accent-color:#3b82f6;--feedlog-destructive:oklch(0.396 0.141 25.723);--feedlog-blue-400:oklch(0.707 0.165 254.624);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-900-30:color-mix(in oklab, oklch(0.379 0.146 265.522) 30%, transparent);--feedlog-red-900-30:color-mix(in oklab, oklch(0.396 0.141 25.723) 30%, transparent);--feedlog-shadow:0 1px 3px 0 rgba(0, 0, 0, 0.3);--feedlog-empty-illustration-bg:oklch(0.28 0.02 260);--feedlog-empty-illustration-stroke:oklch(0.45 0.02 260);--feedlog-empty-illustration-muted:oklch(0.38 0.02 260)}.github-issues-container{min-height:100vh;background-color:var(--feedlog-background);padding:var(--feedlog-padding);margin:0 auto}.issues-header{margin-bottom:1.5rem;display:flex;align-items:flex-start;justify-content:space-between}.header-content{flex:1}.issues-title{color:var(--feedlog-foreground);margin:0 0 0.25rem 0;font-size:1.5rem;font-weight:500;line-height:1.5}.issues-subtitle{color:var(--feedlog-muted-foreground);font-size:0.875rem;margin:0}.loading-state{padding:0}.loading-skeletons{display:flex;flex-direction:column;gap:var(--feedlog-gap)}.skeleton-card{background-color:var(--feedlog-card);border:1px solid var(--feedlog-border);border-radius:var(--feedlog-radius);box-shadow:var(--feedlog-shadow);position:relative;overflow:hidden}.skeleton-card::before{content:'';position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--feedlog-muted)}.skeleton-content{padding:1.25rem;padding-left:calc(1.25rem + 3px);display:flex;flex-direction:column;gap:0.875rem}.skeleton-header{display:flex;align-items:center;justify-content:space-between;gap:0.75rem}.skeleton-badge{width:4.5rem;height:1.25rem;border-radius:0.375rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite}.skeleton-timestamp{width:3rem;height:0.75rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.2s}.skeleton-main{display:flex;flex-direction:column;gap:0.5rem}.skeleton-title{height:0.9375rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.1s;width:85%}.skeleton-body{display:flex;flex-direction:column;gap:0.375rem}.skeleton-line{height:0.8125rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.15s;width:100%}.skeleton-line.short{width:70%}.skeleton-repo{width:6rem;height:0.75rem;border-radius:0.25rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.25s}.skeleton-footer{display:flex;justify-content:flex-end}.skeleton-upvote{width:2.5rem;height:2rem;border-radius:0.5rem;background-color:var(--feedlog-muted);animation:skeleton-pulse 1.5s ease-in-out infinite 0.3s}@keyframes skeleton-pulse{0%,100%{opacity:1}50%{opacity:0.5}}.error-state{display:flex;align-items:center;justify-content:center;padding:3rem 2rem;min-height:12rem}.error-state-content{display:flex;flex-direction:column;align-items:center;text-align:center;max-width:20rem;padding:2rem}.error-icon{color:var(--feedlog-muted-foreground);opacity:0.8;margin-bottom:1rem}.error-state-title{margin:0 0 0.5rem 0;font-size:1.125rem;font-weight:600;color:var(--feedlog-foreground);line-height:1.4}.error-state-message{margin:0 0 1.25rem 0;font-size:0.875rem;color:var(--feedlog-muted-foreground);line-height:1.5}.issues-list{display:flex;flex-direction:column;gap:var(--feedlog-gap)}.empty-state{display:flex;align-items:center;justify-content:center;padding:4rem 2rem;min-height:16rem}.empty-state-content{display:flex;flex-direction:column;align-items:center;text-align:center;max-width:20rem}.empty-state-illustration{margin-bottom:1.5rem;opacity:0.9}.empty-state-title{margin:0 0 0.5rem 0;font-size:1.125rem;font-weight:600;color:var(--feedlog-foreground);line-height:1.4}.empty-state-message{margin:0;font-size:0.875rem;color:var(--feedlog-muted-foreground);line-height:1.5}.load-more-container{display:flex;justify-content:center;padding:2rem 0;gap:1rem}`;
|
|
4
4
|
|
|
5
5
|
const FeedlogGithubIssues = class {
|
|
6
6
|
constructor(hostRef) {
|
|
@@ -50,14 +50,24 @@ const FeedlogGithubIssues = class {
|
|
|
50
50
|
componentWillLoad() {
|
|
51
51
|
this.currentTheme = this.theme;
|
|
52
52
|
}
|
|
53
|
+
renderEmptyStateIllustration() {
|
|
54
|
+
return (h("svg", { class: "empty-state-illustration", xmlns: "http://www.w3.org/2000/svg", width: "120", height: "96", viewBox: "0 0 120 96", fill: "none", "aria-hidden": "true" }, h("path", { d: "M20 36h80v44c0 4.4-3.6 8-8 8H28c-4.4 0-8-3.6-8-8V36z", fill: "var(--feedlog-empty-illustration-bg)", stroke: "var(--feedlog-empty-illustration-stroke)", "stroke-width": "1.5", "stroke-linejoin": "round" }), h("path", { d: "M20 36l20-24h40l20 24", fill: "none", stroke: "var(--feedlog-empty-illustration-stroke)", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), h("path", { d: "M44 52h32M44 60h24M44 68h28", stroke: "var(--feedlog-empty-illustration-muted)", "stroke-width": "1.25", "stroke-linecap": "round" })));
|
|
55
|
+
}
|
|
56
|
+
renderErrorIcon() {
|
|
57
|
+
return (h("svg", { class: "error-icon", xmlns: "http://www.w3.org/2000/svg", width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("circle", { cx: "12", cy: "12", r: "10" }), h("line", { x1: "12", y1: "8", x2: "12", y2: "12" }), h("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })));
|
|
58
|
+
}
|
|
53
59
|
renderIssuesList() {
|
|
54
|
-
|
|
60
|
+
var _a, _b;
|
|
61
|
+
return (h("div", { class: "issues-list" }, this.issues.length === 0 ? (h("div", { class: "empty-state" }, h("div", { class: "empty-state-content" }, this.renderEmptyStateIllustration(), h("h2", { class: "empty-state-title" }, (_a = this.emptyStateTitle) !== null && _a !== void 0 ? _a : 'No updates yet'), h("p", { class: "empty-state-message" }, (_b = this.emptyStateMessage) !== null && _b !== void 0 ? _b : 'Check back later for new updates.')))) : (this.issues.map(issue => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
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.currentTheme, onFeedlogUpvote: (e) => this.handleUpvote(e) }));
|
|
64
|
+
}))));
|
|
55
65
|
}
|
|
56
66
|
render() {
|
|
57
67
|
const containerStyle = {
|
|
58
68
|
maxWidth: this.maxWidth,
|
|
59
69
|
};
|
|
60
|
-
return (h(Host, { key: '
|
|
70
|
+
return (h(Host, { key: 'fbd1890061b47db8b850a8d993e2ac5432c4b3f6', class: this.currentTheme === 'dark' ? 'dark' : '' }, h("div", { key: '5ce9267da314ebb69ed8ee00f28015fdad73ab8a', class: "github-issues-container", style: containerStyle }, (this.heading || this.subtitle) && (h("header", { key: '461c707df1e5dc7eaab15462de975fafdce872df', class: "issues-header" }, h("div", { key: 'e6972c2f0cfe5630cc73fb41a2103c9b0118179c', class: "header-content" }, this.heading && h("h1", { key: 'd74e89c1ad981da6c4287e5b75256bfb831f1172', class: "issues-title" }, this.heading), this.subtitle && h("p", { key: 'c820d8e3beaa57c0c193ceaace1d13e94a2a6290', class: "issues-subtitle" }, this.subtitle)))), this.loading && (h("div", { key: '959be24cb77b257fba5197302448f78af553817e', class: "loading-state", role: "status", "aria-label": "Loading issues" }, h("div", { key: 'e69594f18e3268208634a3ad82cb2ae0bc552c11', 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: '93e82b0beca0b96c23803b1abfc3d50fe099fa6a', class: "error-state", role: "alert" }, h("div", { key: '9276d85925d02bd4c81d5ee44a5d6a8af986c4c9', class: "error-state-content" }, this.renderErrorIcon(), h("h2", { key: '6f5762740f908712a46cddeafae675294d3bcc40', class: "error-state-title" }, "Something went wrong"), h("p", { key: 'f1587bd9a2abe250aa730d64498a5105a412d657', class: "error-state-message" }, this.error)))), !this.loading && !this.error && (h("div", { key: '22c68553352358a9a408ea763af1e63c9c84eabd' }, this.renderIssuesList(), this.hasMore && (h("div", { key: '231ec6f4680b4b114ba72c657f9801d84951a6d6', class: "load-more-container" }, h("feedlog-button", { key: '18fa475708fe233f3f9d0ec85bf0f8daea9a4a0a', onFeedlogClick: this.handleLoadMore, disabled: this.isLoadingMore, variant: "outline" }, this.isLoadingMore ? 'Loading...' : 'Load More Issues'))))))));
|
|
61
71
|
}
|
|
62
72
|
};
|
|
63
73
|
FeedlogGithubIssues.style = feedlogGithubIssuesCss();
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-rs_66Oq4.js';
|
|
2
2
|
|
|
3
|
-
const feedlogIssuesListCss = () => `:host{display:block
|
|
3
|
+
const feedlogIssuesListCss = () => `:host{display:block;--feedlog-muted-foreground:#64748b}:host(.dark){--feedlog-muted-foreground:oklch(0.72 0.02 260)}.issues-list{display:flex;flex-direction:column;gap:0.5rem}.empty-state{text-align:center;padding:3rem 1.5rem;color:var(--feedlog-muted-foreground);font-size:0.875rem}`;
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Heart icon SVG component - renders filled or outline based on prop
|
|
7
|
-
*/
|
|
8
|
-
const HeartIcon = ({ filled }) => (h("svg", { class: `upvote-icon ${filled ? 'filled' : 'outline'}`, xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: filled ? 'currentColor' : 'none', stroke: filled ? 'none' : 'currentColor', "stroke-width": filled ? undefined : '2', "stroke-linecap": filled ? undefined : 'round', "stroke-linejoin": filled ? undefined : 'round' }, h("path", { d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" })));
|
|
9
5
|
const FeedlogIssuesList = class {
|
|
10
6
|
constructor(hostRef) {
|
|
11
7
|
registerInstance(this, hostRef);
|
|
@@ -18,41 +14,16 @@ const FeedlogIssuesList = class {
|
|
|
18
14
|
* Theme variant: 'light' or 'dark'
|
|
19
15
|
*/
|
|
20
16
|
this.theme = 'light';
|
|
21
|
-
this.handleUpvote = (event
|
|
17
|
+
this.handleUpvote = (event) => {
|
|
22
18
|
event.stopPropagation();
|
|
23
|
-
this.feedlogUpvote.emit(
|
|
24
|
-
issueId: issue.id,
|
|
25
|
-
currentUpvoted: issue.hasUpvoted,
|
|
26
|
-
currentCount: issue.upvoteCount,
|
|
27
|
-
});
|
|
19
|
+
this.feedlogUpvote.emit(event.detail);
|
|
28
20
|
};
|
|
29
21
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Format an ISO date string to a relative time string
|
|
32
|
-
*/
|
|
33
|
-
formatDate(dateString) {
|
|
34
|
-
try {
|
|
35
|
-
const date = new Date(dateString);
|
|
36
|
-
const now = new Date();
|
|
37
|
-
const seconds = Math.floor((now.getTime() - date.getTime()) / 1000);
|
|
38
|
-
if (seconds < 60)
|
|
39
|
-
return 'just now';
|
|
40
|
-
if (seconds < 3600)
|
|
41
|
-
return `${Math.floor(seconds / 60)}m ago`;
|
|
42
|
-
if (seconds < 86400)
|
|
43
|
-
return `${Math.floor(seconds / 3600)}h ago`;
|
|
44
|
-
if (seconds < 604800)
|
|
45
|
-
return `${Math.floor(seconds / 86400)}d ago`;
|
|
46
|
-
if (seconds < 2592000)
|
|
47
|
-
return `${Math.floor(seconds / 604800)}w ago`;
|
|
48
|
-
return date.toLocaleDateString();
|
|
49
|
-
}
|
|
50
|
-
catch (_a) {
|
|
51
|
-
return 'unknown date';
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
22
|
render() {
|
|
55
|
-
return (h(Host, { key: '
|
|
23
|
+
return (h(Host, { key: '005de8cf99383128f6973be57d84499c8ca9afd3', class: this.theme === 'dark' ? 'dark' : '' }, h("div", { key: '60edc37014f6703b9400dc8bf06726c9a8428a3b', class: "issues-list" }, this.issues.length === 0 ? (h("div", { class: "empty-state" }, h("p", null, "No issues found"))) : (this.issues.map(issue => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
return (h("feedlog-issue", { key: issue.id, issue: issue, issueUrl: (_b = (_a = this.getIssueUrl) === null || _a === void 0 ? void 0 : _a.call(this, issue)) !== null && _b !== void 0 ? _b : undefined, theme: this.theme, onFeedlogUpvote: (e) => this.handleUpvote(e) }));
|
|
26
|
+
})))));
|
|
56
27
|
}
|
|
57
28
|
};
|
|
58
29
|
FeedlogIssuesList.style = feedlogIssuesListCss();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as promiseResolve, g as globalScripts, b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { p as promiseResolve, g as globalScripts, b as bootstrapLazy } from './index-rs_66Oq4.js';
|
|
2
|
+
export { s as setNonce } from './index-rs_66Oq4.js';
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
Stencil Client Patch Browser v4.40.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -16,5 +16,5 @@ var patchBrowser = () => {
|
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(async (options) => {
|
|
18
18
|
await globalScripts();
|
|
19
|
-
return bootstrapLazy([["feedlog-issues-list",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1]}]]],["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge",[[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-button_2",[[
|
|
19
|
+
return bootstrapLazy([["feedlog-issues-list",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1],"getIssueUrl":[16]}]]],["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge",[[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-button_2",[[257,"feedlog-button",{"variant":[1],"size":[1],"disabled":[4],"type":[1]}],[257,"feedlog-issue",{"issue":[16],"issueUrl":[1,"issue-url"],"theme":[1]}]]],["feedlog-github-issues",[[1,"feedlog-github-issues",{"issues":[16],"maxWidth":[1,"max-width"],"theme":[1025],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"error":[1],"hasMore":[4,"has-more"],"isLoadingMore":[4,"is-loading-more"],"getIssueUrl":[16],"currentTheme":[32]}]]],["feedlog-github-issues-client",[[1,"feedlog-github-issues-client",{"apiKey":[1,"api-key"],"type":[1],"limit":[2],"sortBy":[1,"sort-by"],"endpoint":[1],"maxWidth":[1,"max-width"],"theme":[1],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"getIssueUrl":[16],"issues":[32],"loading":[32],"error":[32],"cursor":[32],"hasMore":[32],"isLoadingMore":[32]}]]]], options);
|
|
20
20
|
});
|
|
@@ -2040,13 +2040,6 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
|
2040
2040
|
}
|
|
2041
2041
|
}
|
|
2042
2042
|
}
|
|
2043
|
-
if (typeof nodeName === "function") {
|
|
2044
|
-
return nodeName(
|
|
2045
|
-
vnodeData === null ? {} : vnodeData,
|
|
2046
|
-
vNodeChildren,
|
|
2047
|
-
vdomFnUtils
|
|
2048
|
-
);
|
|
2049
|
-
}
|
|
2050
2043
|
const vnode = newVNode(nodeName, null);
|
|
2051
2044
|
vnode.$attrs$ = vnodeData;
|
|
2052
2045
|
if (vNodeChildren.length > 0) {
|
|
@@ -2075,36 +2068,6 @@ var newVNode = (tag, text) => {
|
|
|
2075
2068
|
};
|
|
2076
2069
|
var Host = {};
|
|
2077
2070
|
var isHost = (node) => node && node.$tag$ === Host;
|
|
2078
|
-
var vdomFnUtils = {
|
|
2079
|
-
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
2080
|
-
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
|
|
2081
|
-
};
|
|
2082
|
-
var convertToPublic = (node) => ({
|
|
2083
|
-
vattrs: node.$attrs$,
|
|
2084
|
-
vchildren: node.$children$,
|
|
2085
|
-
vkey: node.$key$,
|
|
2086
|
-
vname: node.$name$,
|
|
2087
|
-
vtag: node.$tag$,
|
|
2088
|
-
vtext: node.$text$
|
|
2089
|
-
});
|
|
2090
|
-
var convertToPrivate = (node) => {
|
|
2091
|
-
if (typeof node.vtag === "function") {
|
|
2092
|
-
const vnodeData = { ...node.vattrs };
|
|
2093
|
-
if (node.vkey) {
|
|
2094
|
-
vnodeData.key = node.vkey;
|
|
2095
|
-
}
|
|
2096
|
-
if (node.vname) {
|
|
2097
|
-
vnodeData.name = node.vname;
|
|
2098
|
-
}
|
|
2099
|
-
return h(node.vtag, vnodeData, ...node.vchildren || []);
|
|
2100
|
-
}
|
|
2101
|
-
const vnode = newVNode(node.vtag, node.vtext);
|
|
2102
|
-
vnode.$attrs$ = node.vattrs;
|
|
2103
|
-
vnode.$children$ = node.vchildren;
|
|
2104
|
-
vnode.$key$ = node.vkey;
|
|
2105
|
-
vnode.$name$ = node.vname;
|
|
2106
|
-
return vnode;
|
|
2107
|
-
};
|
|
2108
2071
|
var createSupportsRuleRe = (selector) => {
|
|
2109
2072
|
const safeSelector2 = escapeRegExpSpecialCharacters(selector);
|
|
2110
2073
|
return new RegExp(
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { g as globalScripts, b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { g as globalScripts, b as bootstrapLazy } from './index-rs_66Oq4.js';
|
|
2
|
+
export { s as setNonce } from './index-rs_66Oq4.js';
|
|
3
3
|
|
|
4
4
|
const defineCustomElements = async (win, options) => {
|
|
5
5
|
if (typeof window === 'undefined') return undefined;
|
|
6
6
|
await globalScripts();
|
|
7
|
-
return bootstrapLazy([["feedlog-issues-list",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1]}]]],["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge",[[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-button_2",[[
|
|
7
|
+
return bootstrapLazy([["feedlog-issues-list",[[1,"feedlog-issues-list",{"issues":[16],"theme":[1],"getIssueUrl":[16]}]]],["feedlog-card",[[257,"feedlog-card"]]],["feedlog-badge",[[257,"feedlog-badge",{"variant":[1]}]]],["feedlog-button_2",[[257,"feedlog-button",{"variant":[1],"size":[1],"disabled":[4],"type":[1]}],[257,"feedlog-issue",{"issue":[16],"issueUrl":[1,"issue-url"],"theme":[1]}]]],["feedlog-github-issues",[[1,"feedlog-github-issues",{"issues":[16],"maxWidth":[1,"max-width"],"theme":[1025],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"loading":[4],"error":[1],"hasMore":[4,"has-more"],"isLoadingMore":[4,"is-loading-more"],"getIssueUrl":[16],"currentTheme":[32]}]]],["feedlog-github-issues-client",[[1,"feedlog-github-issues-client",{"apiKey":[1,"api-key"],"type":[1],"limit":[2],"sortBy":[1,"sort-by"],"endpoint":[1],"maxWidth":[1,"max-width"],"theme":[1],"heading":[1],"subtitle":[1],"emptyStateTitle":[1,"empty-state-title"],"emptyStateMessage":[1,"empty-state-message"],"getIssueUrl":[16],"issues":[32],"loading":[32],"error":[32],"cursor":[32],"hasMore":[32],"isLoadingMore":[32]}]]]], options);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { defineCustomElements };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,g as
|
|
1
|
+
import{p as e,g as t,b as a}from"./p-rs_66Oq4.js";export{s as setNonce}from"./p-rs_66Oq4.js";(()=>{const s=import.meta.url,t={};return""!==s&&(t.resourcesUrl=new URL(".",s).href),e(t)})().then((async e=>(await t(),a([["p-13773ed6",[[1,"feedlog-issues-list",{issues:[16],theme:[1],getIssueUrl:[16]}]]],["p-4e90285c",[[257,"feedlog-card"]]],["p-da51c7fd",[[257,"feedlog-badge",{variant:[1]}]]],["p-dad7b157",[[257,"feedlog-button",{variant:[1],size:[1],disabled:[4],type:[1]}],[257,"feedlog-issue",{issue:[16],issueUrl:[1,"issue-url"],theme:[1]}]]],["p-e5ba7dd7",[[1,"feedlog-github-issues",{issues:[16],maxWidth:[1,"max-width"],theme:[1025],heading:[1],subtitle:[1],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"],loading:[4],error:[1],hasMore:[4,"has-more"],isLoadingMore:[4,"is-loading-more"],getIssueUrl:[16],currentTheme:[32]}]]],["p-9b515728",[[1,"feedlog-github-issues-client",{apiKey:[1,"api-key"],type:[1],limit:[2],sortBy:[1,"sort-by"],endpoint:[1],maxWidth:[1,"max-width"],theme:[1],heading:[1],subtitle:[1],emptyStateTitle:[1,"empty-state-title"],emptyStateMessage:[1,"empty-state-message"],getIssueUrl:[16],issues:[32],loading:[32],error:[32],cursor:[32],hasMore:[32],isLoadingMore:[32]}]]]],e))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,c as e,h as t,H as i}from"./p-rs_66Oq4.js";const o=class{constructor(t){s(this,t),this.feedlogUpvote=e(this,"feedlogUpvote"),this.issues=[],this.theme="light",this.handleUpvote=s=>{s.stopPropagation(),this.feedlogUpvote.emit(s.detail)}}render(){return t(i,{key:"005de8cf99383128f6973be57d84499c8ca9afd3",class:"dark"===this.theme?"dark":""},t("div",{key:"60edc37014f6703b9400dc8bf06726c9a8428a3b",class:"issues-list"},0===this.issues.length?t("div",{class:"empty-state"},t("p",null,"No issues found")):this.issues.map((s=>{var e,i;return t("feedlog-issue",{key:s.id,issue:s,issueUrl:null!==(i=null===(e=this.getIssueUrl)||void 0===e?void 0:e.call(this,s))&&void 0!==i?i:void 0,theme:this.theme,onFeedlogUpvote:s=>this.handleUpvote(s)})}))))}};o.style=":host{display:block;--feedlog-muted-foreground:#64748b}:host(.dark){--feedlog-muted-foreground:oklch(0.72 0.02 260)}.issues-list{display:flex;flex-direction:column;gap:0.5rem}.empty-state{text-align:center;padding:3rem 1.5rem;color:var(--feedlog-muted-foreground);font-size:0.875rem}";export{o as feedlog_issues_list}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,h as e}from"./p-
|
|
1
|
+
import{r as o,h as e}from"./p-rs_66Oq4.js";const a=class{constructor(e){o(this,e)}render(){return e("div",{key:"293a80e66adedfc1af29daf72390a4f464321b96",class:"feedlog-card"},e("slot",{key:"b7e5a827f89035e791d9c756db0f66198e6c5a38",name:"header"}),e("slot",{key:"da89fee0a01068c8438564848f218faa9c5d849e",name:"content"}),e("slot",{key:"30b05e80e4189c0f73810a48f64e072dfac83267",name:"footer"}))}};a.style=':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}';export{a as feedlog_card}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as e}from"./p-rs_66Oq4.js";function i(t){if("string"!=typeof t)return"";let s=t.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");return s=s.replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi,""),s=s.replace(/\s*on\w+\s*=\s*[^\s>]*/gi,""),s=s.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,""),s=s.replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,""),s=s.replace(/<(embed|object)\b[^<]*>/gi,""),s=s.replace(/javascript:/gi,""),s=s.replace(/data:(?!image\/(?:png|jpg|jpeg|gif|webp);)/gi,""),s}class o extends Error{constructor(t,s,e){super(t),this.statusCode=s,this.originalError=e,this.name="FeedlogError",Object.setPrototypeOf(this,o.prototype)}}class r extends o{constructor(t){super(t),this.name="FeedlogValidationError",Object.setPrototypeOf(this,r.prototype)}}class n extends o{constructor(t,s,e){super(t,s,e),this.name="FeedlogNetworkError",Object.setPrototypeOf(this,n.prototype)}}class h extends o{constructor(t="Request timed out"){super(t),this.name="FeedlogTimeoutError",Object.setPrototypeOf(this,h.prototype)}}class a{constructor(t){if(this.config={credentials:"include",...t},this.apiKey=this.config.apiKey,!this.apiKey)throw new r("apiKey is required in FeedlogSDKConfig");this.endpoint=this.config.endpoint||"https://api.feedlog.app",this.timeout=this.config.timeout||3e4,this.endpoint=this.endpoint.replace(/\/$/,"")}async fetchIssues(t={}){try{const s=this.buildIssuesUrl(t),e=await this.fetchWithTimeout(s,{method:"GET",headers:this.getAuthHeaders(),credentials:this.config.credentials||"include"});if(!e.ok)throw new n(`Failed to fetch issues: ${e.statusText}`,e.status);const i=await e.json();return this.validateIssuesResponse(i)}catch(t){if(t instanceof o)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new n("Network error: Unable to reach API",void 0,t);throw new o(`Failed to fetch issues: ${t instanceof Error?t.message:"Unknown error"}`,void 0,t)}}async toggleUpvote(t){if(!t||"string"!=typeof t)throw new r("Issue ID is required");try{const s=`${this.endpoint}/api/issues/${encodeURIComponent(t)}/upvote`,e=await this.fetchWithTimeout(s,{method:"POST",headers:this.getAuthHeaders(),credentials:this.config.credentials||"include",body:JSON.stringify({})});if(404===e.status)throw new n("Issue not found",404);if(401===e.status)throw new n("Unauthorized",401);if(403===e.status)throw new n("Forbidden: Domain not allowed for this repository",403);if(!e.ok)throw new n(`Failed to toggle upvote: ${e.statusText}`,e.status);const i=await e.json();return this.validateUpvoteResponse(i)}catch(t){if(t instanceof o)throw t;if(t instanceof TypeError&&t.message.includes("fetch"))throw new n("Network error: Unable to reach API",void 0,t);throw new o(`Failed to toggle upvote: ${t instanceof Error?t.message:"Unknown error"}`,void 0,t)}}buildIssuesUrl(t){const s=new URL(`${this.endpoint}/api/issues`);if(t.repositoryIds){const e=Array.isArray(t.repositoryIds)?t.repositoryIds:[t.repositoryIds];for(const t of e)s.searchParams.append("repositoryIds",t)}return t.type&&s.searchParams.set("type",t.type),t.sortBy&&s.searchParams.set("sortBy",t.sortBy),t.cursor&&s.searchParams.set("cursor",t.cursor),void 0!==t.limit&&s.searchParams.set("limit",t.limit.toString()),s.toString()}getAuthHeaders(){const t={"Content-Type":"application/json"};return this.apiKey&&(t["x-api-key"]=this.apiKey),t}async fetchWithTimeout(t,s){const e=new AbortController,i=setTimeout((()=>e.abort()),this.timeout);try{const o=await fetch(t,{...s,signal:e.signal});return clearTimeout(i),o}catch(t){if(clearTimeout(i),t instanceof Error&&"AbortError"===t.name)throw new h(`Request timed out after ${this.timeout}ms`);throw t}}validateIssuesResponse(t){if(!t||"object"!=typeof t)throw new r("Invalid API response: expected object");const s=t;if(!Array.isArray(s.issues))throw new r("Invalid API response: issues must be an array");if(!s.pagination||"object"!=typeof s.pagination)throw new r("Invalid API response: pagination is required");return{issues:s.issues.map((t=>this.validateIssue(t))),pagination:{cursor:s.pagination.cursor,hasMore:Boolean(s.pagination.hasMore)}}}validateIssue(t){if(!t||"object"!=typeof t)throw new r("Invalid issue: expected object");const s=t;if("string"!=typeof s.id)throw new r("Invalid issue: id is required and must be a string");if(!["bug","enhancement"].includes(String(s.type)))throw new r('Invalid issue: type must be "bug" or "enhancement"');if(!["open","in_progress","closed"].includes(String(s.status)))throw new r('Invalid issue: status must be "open", "in_progress", or "closed"');if(!s.repository||"object"!=typeof s.repository)throw new r("Invalid issue: repository is required");const e=s.repository;if("string"!=typeof e.id)throw new r("Invalid issue: repository must have id");const o=null!==s.githubIssueLink&&"string"==typeof s.githubIssueLink?String(s.githubIssueLink):null,n=s.title,h=null!=n&&""!==n?i(String(n)):null,a=s.body,u=null!=a&&""!==a?i(String(a)):null,c=e.name,l=null!=c&&""!==c?String(c):null,d=e.description,p=null!=d&&""!==d?i(String(d)):null;return{id:String(s.id),githubIssueLink:o,type:s.type||"bug",status:s.status||"open",pinnedAt:s.pinnedAt?String(s.pinnedAt):null,revision:Number(s.revision)||1,title:h,body:u,repository:{id:String(e.id),name:l,description:p},updatedAt:String(s.updatedAt)||(new Date).toISOString(),createdAt:String(s.createdAt)||(new Date).toISOString(),upvoteCount:Number(s.upvoteCount)||0,hasUpvoted:Boolean(s.hasUpvoted)}}validateUpvoteResponse(t){if(!t||"object"!=typeof t)throw new r("Invalid upvote response: expected object");const s=t;if("boolean"!=typeof s.upvoted)throw new r("Invalid upvote response: upvoted must be a boolean");if("number"!=typeof s.upvoteCount)throw new r("Invalid upvote response: upvoteCount must be a number");if("string"!=typeof s.anonymousUserId)throw new r("Invalid upvote response: anonymousUserId must be a string");return{upvoted:s.upvoted,upvoteCount:s.upvoteCount,anonymousUserId:s.anonymousUserId}}getEndpoint(){return this.endpoint}getTimeout(){return this.timeout}}const u=class{constructor(e){t(this,e),this.feedlogUpvote=s(this,"feedlogUpvote"),this.feedlogError=s(this,"feedlogError"),this.maxWidth="42rem",this.theme="light",this.issues=[],this.loading=!0,this.error=null,this.cursor=null,this.hasMore=!1,this.isLoadingMore=!1,this.sdk=null,this.fetchRequestId=0,this.isDisconnected=!1,this.upvoteRequestIds=new Map,this.handleUpvote=async t=>{if(!this.sdk||this.isDisconnected)return;const{issueId:s,currentUpvoted:e,currentCount:i}=t.detail,o=(this.upvoteRequestIds.get(s)||0)+1;this.upvoteRequestIds.set(s,o),this.issues=this.issues.map((t=>t.id===s?Object.assign(Object.assign({},t),{hasUpvoted:!e,upvoteCount:e?i-1:i+1}):t));try{const t=await this.sdk.toggleUpvote(s);if(this.isDisconnected||this.upvoteRequestIds.get(s)!==o)return;this.issues=this.issues.map((e=>e.id===s?Object.assign(Object.assign({},e),{hasUpvoted:t.upvoted,upvoteCount:t.upvoteCount}):e)),this.feedlogUpvote.emit({issueId:s,upvoted:t.upvoted,upvoteCount:t.upvoteCount})}catch(t){if(this.isDisconnected||this.upvoteRequestIds.get(s)!==o)return;this.issues=this.issues.map((t=>t.id===s?Object.assign(Object.assign({},t),{hasUpvoted:e,upvoteCount:i}):t));const r=t instanceof Error?t.message:"Failed to toggle upvote";this.feedlogError.emit({error:r})}}}componentWillLoad(){this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy,this.initializeSDK(),this.fetchIssues()}disconnectedCallback(){this.isDisconnected=!0,this.fetchRequestId++}componentDidUpdate(){(this.previousType!==this.type||this.previousLimit!==this.limit||this.previousSortBy!==this.sortBy)&&(this.fetchRequestId++,this.cursor=null,this.hasMore=!1,this.issues=[],this.fetchIssues(),this.previousType=this.type,this.previousLimit=this.limit,this.previousSortBy=this.sortBy)}initializeSDK(){try{if(!this.apiKey)throw new Error("API key is required for the Feedlog SDK");this.sdk=new a(Object.assign({apiKey:this.apiKey},this.endpoint&&{endpoint:this.endpoint})),this.error=null}catch(t){const s=t instanceof Error?t.message:"Failed to initialize SDK";this.error=s,this.feedlogError.emit({error:s})}}async fetchIssues(){if(!this.sdk)return;const t=this.fetchRequestId;try{this.loading=!0,this.error=null;const s={};this.type&&(s.type=this.type),this.sortBy&&(s.sortBy=this.sortBy),this.limit&&(s.limit=this.limit),this.cursor&&(s.cursor=this.cursor);const e=await this.sdk.fetchIssues(s);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=e.issues,this.cursor=e.pagination.cursor,this.hasMore=e.pagination.hasMore}catch(s){if(this.isDisconnected||t!==this.fetchRequestId)return;const e=s instanceof Error?s.message:"Couldn't load updates";this.error=e,this.issues=[],this.feedlogError.emit({error:e,code:null==s?void 0:s.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.loading=!1,this.isLoadingMore=!1)}}async loadMore(){if(!this.sdk||!this.hasMore||this.isLoadingMore||this.loading)return;const t=this.fetchRequestId;this.isLoadingMore=!0;try{const s={};this.type&&(s.type=this.type),this.sortBy&&(s.sortBy=this.sortBy),this.limit&&(s.limit=this.limit),this.cursor&&(s.cursor=this.cursor);const e=await this.sdk.fetchIssues(s);if(this.isDisconnected||t!==this.fetchRequestId)return;this.issues=[...this.issues,...e.issues],this.cursor=e.pagination.cursor,this.hasMore=e.pagination.hasMore}catch(s){if(this.isDisconnected||t!==this.fetchRequestId)return;const e=s instanceof Error?s.message:"Failed to load more issues";this.feedlogError.emit({error:e,code:null==s?void 0:s.statusCode})}finally{this.isDisconnected||t!==this.fetchRequestId||(this.isLoadingMore=!1)}}render(){return e("feedlog-github-issues",{key:"4bc46e4f2622d4c2c5080835ae436ae9fc37c991",issues:this.issues,maxWidth:this.maxWidth,theme:this.theme,heading:this.heading,subtitle:this.subtitle,emptyStateTitle:this.emptyStateTitle,emptyStateMessage:this.emptyStateMessage,getIssueUrl:this.getIssueUrl,loading:this.loading,error:this.error,hasMore:this.hasMore,isLoadingMore:this.isLoadingMore,onFeedlogUpvote:this.handleUpvote,onFeedlogLoadMore:async()=>this.loadMore()})}};export{u as feedlog_github_issues_client}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,h as o}from"./p-rs_66Oq4.js";const d=class{constructor(o){e(this,o),this.variant="default"}render(){return o("span",{key:"22e5d49e033459b4e3e409ffa0e76641457ad740",class:`badge badge-${this.variant}`},o("slot",{key:"8f986c5150aa39034f090a258231e45363f9cac9"}))}};d.style=":host{display:inline-block;--feedlog-badge-font-size:0.75rem;--feedlog-badge-font-weight:500;--feedlog-badge-padding-x:0.5rem;--feedlog-badge-padding-y:0.125rem;--feedlog-badge-border-radius:calc(0.625rem - 2px);--feedlog-blue-500:oklch(0.623 0.214 259.815);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-blue-700:oklch(0.488 0.243 264.376);--feedlog-destructive:#d4183d;--feedlog-destructive-hover:#b91c1c}:host(.dark){--feedlog-blue-500:oklch(0.623 0.214 259.815);--feedlog-blue-600:oklch(0.546 0.245 262.881);--feedlog-destructive:oklch(0.396 0.141 25.723);--feedlog-destructive-hover:oklch(0.45 0.16 25.723)}.badge{display:inline-flex;align-items:center;justify-content:center;gap:0.25rem;font-size:var(--feedlog-badge-font-size);font-weight:var(--feedlog-badge-font-weight);padding:var(--feedlog-badge-padding-y) var(--feedlog-badge-padding-x);border-radius:var(--feedlog-badge-border-radius);white-space:nowrap;transition:background-color 0.15s ease;font-family:inherit}.badge-default{background-color:var(--feedlog-blue-600);color:#ffffff}.badge-default:hover{background-color:var(--feedlog-blue-700)}:host(.dark) .badge-default{background-color:var(--feedlog-blue-500)}:host(.dark) .badge-default:hover{background-color:var(--feedlog-blue-600)}.badge-enhancement{background-color:var(--feedlog-blue-600);color:#ffffff}.badge-enhancement:hover{background-color:var(--feedlog-blue-700)}:host(.dark) .badge-enhancement{background-color:var(--feedlog-blue-500)}:host(.dark) .badge-enhancement:hover{background-color:var(--feedlog-blue-600)}.badge-destructive{background-color:var(--feedlog-destructive);color:#ffffff}.badge-destructive:hover{background-color:var(--feedlog-destructive-hover)}.badge-secondary{background-color:var(--feedlog-muted, #f1f5f9);color:var(--feedlog-muted-foreground, #64748b)}:host(.dark) .badge-secondary{background-color:var(--feedlog-muted, oklch(0.32 0.01 260));color:var(--feedlog-muted-foreground, oklch(0.72 0.02 260))}";export{d as feedlog_badge}
|