webmention-feed 0.1.1 → 0.2.0
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/webmention-feed.js +174 -112
- package/package.json +3 -2
- package/src/webmention-feed.ts +76 -3
- package/dist/webmention-feed.d.ts +0 -62
- package/dist/webmention-feed.d.ts.map +0 -1
package/dist/webmention-feed.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
6
|
+
const z = globalThis, Z = z.ShadowRoot && (z.ShadyCSS === void 0 || z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, F = Symbol(), G = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
let lt = class {
|
|
8
8
|
constructor(t, e, s) {
|
|
9
|
-
if (this._$cssResult$ = !0, s !==
|
|
9
|
+
if (this._$cssResult$ = !0, s !== F) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
10
|
this.cssText = t, this.t = e;
|
|
11
11
|
}
|
|
12
12
|
get styleSheet() {
|
|
13
13
|
let t = this.o;
|
|
14
14
|
const e = this.t;
|
|
15
|
-
if (
|
|
15
|
+
if (Z && t === void 0) {
|
|
16
16
|
const s = e !== void 0 && e.length === 1;
|
|
17
17
|
s && (t = G.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && G.set(e, t));
|
|
18
18
|
}
|
|
@@ -22,20 +22,20 @@ let lt = class {
|
|
|
22
22
|
return this.cssText;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
const ut = (i) => new lt(typeof i == "string" ? i : i + "", void 0,
|
|
25
|
+
const ut = (i) => new lt(typeof i == "string" ? i : i + "", void 0, F), $t = (i, ...t) => {
|
|
26
26
|
const e = i.length === 1 ? i[0] : t.reduce((s, r, o) => s + ((n) => {
|
|
27
27
|
if (n._$cssResult$ === !0) return n.cssText;
|
|
28
28
|
if (typeof n == "number") return n;
|
|
29
29
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
30
|
})(r) + i[o + 1], i[0]);
|
|
31
|
-
return new lt(e, i,
|
|
31
|
+
return new lt(e, i, F);
|
|
32
32
|
}, ft = (i, t) => {
|
|
33
|
-
if (
|
|
33
|
+
if (Z) i.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
34
34
|
else for (const e of t) {
|
|
35
|
-
const s = document.createElement("style"), r =
|
|
35
|
+
const s = document.createElement("style"), r = z.litNonce;
|
|
36
36
|
r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, i.appendChild(s);
|
|
37
37
|
}
|
|
38
|
-
}, Q =
|
|
38
|
+
}, Q = Z ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => {
|
|
39
39
|
let e = "";
|
|
40
40
|
for (const s of t.cssRules) e += s.cssText;
|
|
41
41
|
return ut(e);
|
|
@@ -45,10 +45,10 @@ const ut = (i) => new lt(typeof i == "string" ? i : i + "", void 0, Z), $t = (i,
|
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const { is: mt, defineProperty:
|
|
48
|
+
const { is: mt, defineProperty: gt, getOwnPropertyDescriptor: yt, getOwnPropertyNames: _t, getOwnPropertySymbols: bt, getPrototypeOf: vt } = Object, _ = globalThis, X = _.trustedTypes, At = X ? X.emptyScript : "", W = _.reactiveElementPolyfillSupport, C = (i, t) => i, D = { toAttribute(i, t) {
|
|
49
49
|
switch (t) {
|
|
50
50
|
case Boolean:
|
|
51
|
-
i = i ?
|
|
51
|
+
i = i ? At : null;
|
|
52
52
|
break;
|
|
53
53
|
case Object:
|
|
54
54
|
case Array:
|
|
@@ -73,8 +73,8 @@ const { is: mt, defineProperty: yt, getOwnPropertyDescriptor: gt, getOwnProperty
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return e;
|
|
76
|
-
} },
|
|
77
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
76
|
+
} }, J = (i, t) => !mt(i, t), Y = { attribute: !0, type: String, converter: D, reflect: !1, useDefault: !1, hasChanged: J };
|
|
77
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), _.litPropertyMetadata ?? (_.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
78
|
let E = class extends HTMLElement {
|
|
79
79
|
static addInitializer(t) {
|
|
80
80
|
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
@@ -85,11 +85,11 @@ let E = class extends HTMLElement {
|
|
|
85
85
|
static createProperty(t, e = Y) {
|
|
86
86
|
if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
|
|
87
87
|
const s = Symbol(), r = this.getPropertyDescriptor(t, s, e);
|
|
88
|
-
r !== void 0 &&
|
|
88
|
+
r !== void 0 && gt(this.prototype, t, r);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
static getPropertyDescriptor(t, e, s) {
|
|
92
|
-
const { get: r, set: o } =
|
|
92
|
+
const { get: r, set: o } = yt(this.prototype, t) ?? { get() {
|
|
93
93
|
return this[e];
|
|
94
94
|
}, set(n) {
|
|
95
95
|
this[e] = n;
|
|
@@ -103,14 +103,14 @@ let E = class extends HTMLElement {
|
|
|
103
103
|
return this.elementProperties.get(t) ?? Y;
|
|
104
104
|
}
|
|
105
105
|
static _$Ei() {
|
|
106
|
-
if (this.hasOwnProperty(
|
|
107
|
-
const t =
|
|
106
|
+
if (this.hasOwnProperty(C("elementProperties"))) return;
|
|
107
|
+
const t = vt(this);
|
|
108
108
|
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
109
109
|
}
|
|
110
110
|
static finalize() {
|
|
111
|
-
if (this.hasOwnProperty(
|
|
112
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
113
|
-
const e = this.properties, s = [..._t(e), ...
|
|
111
|
+
if (this.hasOwnProperty(C("finalized"))) return;
|
|
112
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(C("properties"))) {
|
|
113
|
+
const e = this.properties, s = [..._t(e), ...bt(e)];
|
|
114
114
|
for (const r of s) this.createProperty(r, e[r]);
|
|
115
115
|
}
|
|
116
116
|
const t = this[Symbol.metadata];
|
|
@@ -184,7 +184,7 @@ let E = class extends HTMLElement {
|
|
|
184
184
|
var o;
|
|
185
185
|
const s = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, s);
|
|
186
186
|
if (r !== void 0 && s.reflect === !0) {
|
|
187
|
-
const n = (((o = s.converter) == null ? void 0 : o.toAttribute) !== void 0 ? s.converter :
|
|
187
|
+
const n = (((o = s.converter) == null ? void 0 : o.toAttribute) !== void 0 ? s.converter : D).toAttribute(e, s.type);
|
|
188
188
|
this._$Em = t, n == null ? this.removeAttribute(r) : this.setAttribute(r, n), this._$Em = null;
|
|
189
189
|
}
|
|
190
190
|
}
|
|
@@ -192,7 +192,7 @@ let E = class extends HTMLElement {
|
|
|
192
192
|
var o, n;
|
|
193
193
|
const s = this.constructor, r = s._$Eh.get(t);
|
|
194
194
|
if (r !== void 0 && this._$Em !== r) {
|
|
195
|
-
const l = s.getPropertyOptions(r), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((o = l.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? l.converter :
|
|
195
|
+
const l = s.getPropertyOptions(r), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((o = l.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? l.converter : D;
|
|
196
196
|
this._$Em = r;
|
|
197
197
|
const d = a.fromAttribute(e, l.type);
|
|
198
198
|
this[r] = d ?? ((n = this._$Ej) == null ? void 0 : n.get(r)) ?? d, this._$Em = null;
|
|
@@ -202,7 +202,7 @@ let E = class extends HTMLElement {
|
|
|
202
202
|
var n;
|
|
203
203
|
if (t !== void 0) {
|
|
204
204
|
const l = this.constructor;
|
|
205
|
-
if (r === !1 && (o = this[t]), s ?? (s = l.getPropertyOptions(t)), !((s.hasChanged ??
|
|
205
|
+
if (r === !1 && (o = this[t]), s ?? (s = l.getPropertyOptions(t)), !((s.hasChanged ?? J)(o, e) || s.useDefault && s.reflect && o === ((n = this._$Ej) == null ? void 0 : n.get(t)) && !this.hasAttribute(l._$Eu(t, s)))) return;
|
|
206
206
|
this.C(t, e, s);
|
|
207
207
|
}
|
|
208
208
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
@@ -278,56 +278,56 @@ let E = class extends HTMLElement {
|
|
|
278
278
|
firstUpdated(t) {
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
|
-
E.elementStyles = [], E.shadowRootOptions = { mode: "open" }, E[
|
|
281
|
+
E.elementStyles = [], E.shadowRootOptions = { mode: "open" }, E[C("elementProperties")] = /* @__PURE__ */ new Map(), E[C("finalized")] = /* @__PURE__ */ new Map(), W == null || W({ ReactiveElement: E }), (_.reactiveElementVersions ?? (_.reactiveElementVersions = [])).push("2.1.2");
|
|
282
282
|
/**
|
|
283
283
|
* @license
|
|
284
284
|
* Copyright 2017 Google LLC
|
|
285
285
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
286
286
|
*/
|
|
287
|
-
const U = globalThis, tt = (i) => i, j = U.trustedTypes, et = j ? j.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, ht = "$lit$", y = `lit$${Math.random().toFixed(9).slice(2)}$`,
|
|
288
|
-
\f\r]`,
|
|
289
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, nt = /"/g,
|
|
287
|
+
const U = globalThis, tt = (i) => i, j = U.trustedTypes, et = j ? j.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, ht = "$lit$", y = `lit$${Math.random().toFixed(9).slice(2)}$`, pt = "?" + y, wt = `<${pt}>`, w = document, M = () => w.createComment(""), k = (i) => i === null || typeof i != "object" && typeof i != "function", K = Array.isArray, Et = (i) => K(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", B = `[
|
|
288
|
+
\f\r]`, x = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, st = /-->/g, rt = />/g, b = RegExp(`>|${B}(?:([^\\s"'>=/]+)(${B}*=${B}*(?:[^
|
|
289
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, nt = /"/g, ct = /^(?:script|style|textarea|title)$/i, St = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), u = St(1), S = Symbol.for("lit-noChange"), p = Symbol.for("lit-nothing"), ot = /* @__PURE__ */ new WeakMap(), v = w.createTreeWalker(w, 129);
|
|
290
290
|
function dt(i, t) {
|
|
291
|
-
if (!
|
|
291
|
+
if (!K(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
292
292
|
return et !== void 0 ? et.createHTML(t) : t;
|
|
293
293
|
}
|
|
294
|
-
const
|
|
294
|
+
const Pt = (i, t) => {
|
|
295
295
|
const e = i.length - 1, s = [];
|
|
296
|
-
let r, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n =
|
|
296
|
+
let r, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = x;
|
|
297
297
|
for (let l = 0; l < e; l++) {
|
|
298
298
|
const a = i[l];
|
|
299
|
-
let d, c, h = -1,
|
|
300
|
-
for (;
|
|
301
|
-
const
|
|
302
|
-
o += n ===
|
|
299
|
+
let d, c, h = -1, f = 0;
|
|
300
|
+
for (; f < a.length && (n.lastIndex = f, c = n.exec(a), c !== null); ) f = n.lastIndex, n === x ? c[1] === "!--" ? n = st : c[1] !== void 0 ? n = rt : c[2] !== void 0 ? (ct.test(c[2]) && (r = RegExp("</" + c[2], "g")), n = b) : c[3] !== void 0 && (n = b) : n === b ? c[0] === ">" ? (n = r ?? x, h = -1) : c[1] === void 0 ? h = -2 : (h = n.lastIndex - c[2].length, d = c[1], n = c[3] === void 0 ? b : c[3] === '"' ? nt : it) : n === nt || n === it ? n = b : n === st || n === rt ? n = x : (n = b, r = void 0);
|
|
301
|
+
const g = n === b && i[l + 1].startsWith("/>") ? " " : "";
|
|
302
|
+
o += n === x ? a + wt : h >= 0 ? (s.push(d), a.slice(0, h) + ht + a.slice(h) + y + g) : a + y + (h === -2 ? l : g);
|
|
303
303
|
}
|
|
304
304
|
return [dt(i, o + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
|
|
305
305
|
};
|
|
306
|
-
class
|
|
306
|
+
class H {
|
|
307
307
|
constructor({ strings: t, _$litType$: e }, s) {
|
|
308
308
|
let r;
|
|
309
309
|
this.parts = [];
|
|
310
310
|
let o = 0, n = 0;
|
|
311
|
-
const l = t.length - 1, a = this.parts, [d, c] =
|
|
312
|
-
if (this.el =
|
|
311
|
+
const l = t.length - 1, a = this.parts, [d, c] = Pt(t, e);
|
|
312
|
+
if (this.el = H.createElement(d, s), v.currentNode = this.el.content, e === 2 || e === 3) {
|
|
313
313
|
const h = this.el.content.firstChild;
|
|
314
314
|
h.replaceWith(...h.childNodes);
|
|
315
315
|
}
|
|
316
316
|
for (; (r = v.nextNode()) !== null && a.length < l; ) {
|
|
317
317
|
if (r.nodeType === 1) {
|
|
318
318
|
if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(ht)) {
|
|
319
|
-
const
|
|
320
|
-
a.push({ type: 1, index: o, name:
|
|
319
|
+
const f = c[n++], g = r.getAttribute(h).split(y), T = /([.?@])?(.*)/.exec(f);
|
|
320
|
+
a.push({ type: 1, index: o, name: T[2], strings: g, ctor: T[1] === "." ? Ct : T[1] === "?" ? Ut : T[1] === "@" ? Ot : L }), r.removeAttribute(h);
|
|
321
321
|
} else h.startsWith(y) && (a.push({ type: 6, index: o }), r.removeAttribute(h));
|
|
322
|
-
if (
|
|
323
|
-
const h = r.textContent.split(y),
|
|
324
|
-
if (
|
|
322
|
+
if (ct.test(r.tagName)) {
|
|
323
|
+
const h = r.textContent.split(y), f = h.length - 1;
|
|
324
|
+
if (f > 0) {
|
|
325
325
|
r.textContent = j ? j.emptyScript : "";
|
|
326
|
-
for (let
|
|
327
|
-
r.append(h[
|
|
326
|
+
for (let g = 0; g < f; g++) r.append(h[g], M()), v.nextNode(), a.push({ type: 2, index: ++o });
|
|
327
|
+
r.append(h[f], M());
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
} else if (r.nodeType === 8) if (r.data ===
|
|
330
|
+
} else if (r.nodeType === 8) if (r.data === pt) a.push({ type: 2, index: o });
|
|
331
331
|
else {
|
|
332
332
|
let h = -1;
|
|
333
333
|
for (; (h = r.data.indexOf(y, h + 1)) !== -1; ) a.push({ type: 7, index: o }), h += y.length - 1;
|
|
@@ -336,18 +336,18 @@ class k {
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
static createElement(t, e) {
|
|
339
|
-
const s =
|
|
339
|
+
const s = w.createElement("template");
|
|
340
340
|
return s.innerHTML = t, s;
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function P(i, t, e = i, s) {
|
|
344
344
|
var n, l;
|
|
345
345
|
if (t === S) return t;
|
|
346
346
|
let r = s !== void 0 ? (n = e._$Co) == null ? void 0 : n[s] : e._$Cl;
|
|
347
|
-
const o =
|
|
348
|
-
return (r == null ? void 0 : r.constructor) !== o && ((l = r == null ? void 0 : r._$AO) == null || l.call(r, !1), o === void 0 ? r = void 0 : (r = new o(i), r._$AT(i, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = r : e._$Cl = r), r !== void 0 && (t =
|
|
347
|
+
const o = k(t) ? void 0 : t._$litDirective$;
|
|
348
|
+
return (r == null ? void 0 : r.constructor) !== o && ((l = r == null ? void 0 : r._$AO) == null || l.call(r, !1), o === void 0 ? r = void 0 : (r = new o(i), r._$AT(i, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = r : e._$Cl = r), r !== void 0 && (t = P(i, r._$AS(i, t.values), r, s)), t;
|
|
349
349
|
}
|
|
350
|
-
class
|
|
350
|
+
class xt {
|
|
351
351
|
constructor(t, e) {
|
|
352
352
|
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
|
|
353
353
|
}
|
|
@@ -358,24 +358,24 @@ class Ct {
|
|
|
358
358
|
return this._$AM._$AU;
|
|
359
359
|
}
|
|
360
360
|
u(t) {
|
|
361
|
-
const { el: { content: e }, parts: s } = this._$AD, r = ((t == null ? void 0 : t.creationScope) ??
|
|
361
|
+
const { el: { content: e }, parts: s } = this._$AD, r = ((t == null ? void 0 : t.creationScope) ?? w).importNode(e, !0);
|
|
362
362
|
v.currentNode = r;
|
|
363
363
|
let o = v.nextNode(), n = 0, l = 0, a = s[0];
|
|
364
364
|
for (; a !== void 0; ) {
|
|
365
365
|
if (n === a.index) {
|
|
366
366
|
let d;
|
|
367
|
-
a.type === 2 ? d = new
|
|
367
|
+
a.type === 2 ? d = new R(o, o.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (d = new Mt(o, this, t)), this._$AV.push(d), a = s[++l];
|
|
368
368
|
}
|
|
369
369
|
n !== (a == null ? void 0 : a.index) && (o = v.nextNode(), n++);
|
|
370
370
|
}
|
|
371
|
-
return v.currentNode =
|
|
371
|
+
return v.currentNode = w, r;
|
|
372
372
|
}
|
|
373
373
|
p(t) {
|
|
374
374
|
let e = 0;
|
|
375
375
|
for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
class
|
|
378
|
+
class R {
|
|
379
379
|
get _$AU() {
|
|
380
380
|
var t;
|
|
381
381
|
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
@@ -395,7 +395,7 @@ class T {
|
|
|
395
395
|
return this._$AB;
|
|
396
396
|
}
|
|
397
397
|
_$AI(t, e = this) {
|
|
398
|
-
t =
|
|
398
|
+
t = P(this, t, e), k(t) ? t === p || t == null || t === "" ? (this._$AH !== p && this._$AR(), this._$AH = p) : t !== this._$AH && t !== S && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Et(t) ? this.k(t) : this._(t);
|
|
399
399
|
}
|
|
400
400
|
O(t) {
|
|
401
401
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -404,26 +404,26 @@ class T {
|
|
|
404
404
|
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
405
405
|
}
|
|
406
406
|
_(t) {
|
|
407
|
-
this._$AH !== p &&
|
|
407
|
+
this._$AH !== p && k(this._$AH) ? this._$AA.nextSibling.data = t : this.T(w.createTextNode(t)), this._$AH = t;
|
|
408
408
|
}
|
|
409
409
|
$(t) {
|
|
410
410
|
var o;
|
|
411
|
-
const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el =
|
|
411
|
+
const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = H.createElement(dt(s.h, s.h[0]), this.options)), s);
|
|
412
412
|
if (((o = this._$AH) == null ? void 0 : o._$AD) === r) this._$AH.p(e);
|
|
413
413
|
else {
|
|
414
|
-
const n = new
|
|
414
|
+
const n = new xt(r, this), l = n.u(this.options);
|
|
415
415
|
n.p(e), this.T(l), this._$AH = n;
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
_$AC(t) {
|
|
419
419
|
let e = ot.get(t.strings);
|
|
420
|
-
return e === void 0 && ot.set(t.strings, e = new
|
|
420
|
+
return e === void 0 && ot.set(t.strings, e = new H(t)), e;
|
|
421
421
|
}
|
|
422
422
|
k(t) {
|
|
423
|
-
|
|
423
|
+
K(this._$AH) || (this._$AH = [], this._$AR());
|
|
424
424
|
const e = this._$AH;
|
|
425
425
|
let s, r = 0;
|
|
426
|
-
for (const o of t) r === e.length ? e.push(s = new
|
|
426
|
+
for (const o of t) r === e.length ? e.push(s = new R(this.O(M()), this.O(M()), this, this.options)) : s = e[r], s._$AI(o), r++;
|
|
427
427
|
r < e.length && (this._$AR(s && s._$AB.nextSibling, r), e.length = r);
|
|
428
428
|
}
|
|
429
429
|
_$AR(t = this._$AA.nextSibling, e) {
|
|
@@ -438,7 +438,7 @@ class T {
|
|
|
438
438
|
this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
class
|
|
441
|
+
class L {
|
|
442
442
|
get tagName() {
|
|
443
443
|
return this.element.tagName;
|
|
444
444
|
}
|
|
@@ -451,11 +451,11 @@ class D {
|
|
|
451
451
|
_$AI(t, e = this, s, r) {
|
|
452
452
|
const o = this.strings;
|
|
453
453
|
let n = !1;
|
|
454
|
-
if (o === void 0) t =
|
|
454
|
+
if (o === void 0) t = P(this, t, e, 0), n = !k(t) || t !== this._$AH && t !== S, n && (this._$AH = t);
|
|
455
455
|
else {
|
|
456
456
|
const l = t;
|
|
457
457
|
let a, d;
|
|
458
|
-
for (t = o[0], a = 0; a < o.length - 1; a++) d =
|
|
458
|
+
for (t = o[0], a = 0; a < o.length - 1; a++) d = P(this, l[s + a], e, a), d === S && (d = this._$AH[a]), n || (n = !k(d) || d !== this._$AH[a]), d === p ? t = p : t !== p && (t += (d ?? "") + o[a + 1]), this._$AH[a] = d;
|
|
459
459
|
}
|
|
460
460
|
n && !r && this.j(t);
|
|
461
461
|
}
|
|
@@ -463,7 +463,7 @@ class D {
|
|
|
463
463
|
t === p ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
class
|
|
466
|
+
class Ct extends L {
|
|
467
467
|
constructor() {
|
|
468
468
|
super(...arguments), this.type = 3;
|
|
469
469
|
}
|
|
@@ -471,7 +471,7 @@ class Pt extends D {
|
|
|
471
471
|
this.element[this.name] = t === p ? void 0 : t;
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
class Ut extends
|
|
474
|
+
class Ut extends L {
|
|
475
475
|
constructor() {
|
|
476
476
|
super(...arguments), this.type = 4;
|
|
477
477
|
}
|
|
@@ -479,12 +479,12 @@ class Ut extends D {
|
|
|
479
479
|
this.element.toggleAttribute(this.name, !!t && t !== p);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
class Ot extends
|
|
482
|
+
class Ot extends L {
|
|
483
483
|
constructor(t, e, s, r, o) {
|
|
484
484
|
super(t, e, s, r, o), this.type = 5;
|
|
485
485
|
}
|
|
486
486
|
_$AI(t, e = this) {
|
|
487
|
-
if ((t =
|
|
487
|
+
if ((t = P(this, t, e, 0) ?? p) === S) return;
|
|
488
488
|
const s = this._$AH, r = t === p && s !== p || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, o = t !== p && (s === p || r);
|
|
489
489
|
r && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
490
490
|
}
|
|
@@ -501,17 +501,17 @@ class Mt {
|
|
|
501
501
|
return this._$AM._$AU;
|
|
502
502
|
}
|
|
503
503
|
_$AI(t) {
|
|
504
|
-
|
|
504
|
+
P(this, t);
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
const
|
|
507
|
+
const q = U.litHtmlPolyfillSupport;
|
|
508
|
+
q == null || q(H, R), (U.litHtmlVersions ?? (U.litHtmlVersions = [])).push("3.3.2");
|
|
509
|
+
const kt = (i, t, e) => {
|
|
510
510
|
const s = (e == null ? void 0 : e.renderBefore) ?? t;
|
|
511
511
|
let r = s._$litPart$;
|
|
512
512
|
if (r === void 0) {
|
|
513
513
|
const o = (e == null ? void 0 : e.renderBefore) ?? null;
|
|
514
|
-
s._$litPart$ = r = new
|
|
514
|
+
s._$litPart$ = r = new R(t.insertBefore(M(), o), o, void 0, e ?? {});
|
|
515
515
|
}
|
|
516
516
|
return r._$AI(i), r;
|
|
517
517
|
};
|
|
@@ -532,7 +532,7 @@ class O extends E {
|
|
|
532
532
|
}
|
|
533
533
|
update(t) {
|
|
534
534
|
const e = this.render();
|
|
535
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do =
|
|
535
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = kt(e, this.renderRoot, this.renderOptions);
|
|
536
536
|
}
|
|
537
537
|
connectedCallback() {
|
|
538
538
|
var t;
|
|
@@ -548,15 +548,15 @@ class O extends E {
|
|
|
548
548
|
}
|
|
549
549
|
var at;
|
|
550
550
|
O._$litElement$ = !0, O.finalized = !0, (at = A.litElementHydrateSupport) == null || at.call(A, { LitElement: O });
|
|
551
|
-
const
|
|
552
|
-
|
|
551
|
+
const V = A.litElementPolyfillSupport;
|
|
552
|
+
V == null || V({ LitElement: O });
|
|
553
553
|
(A.litElementVersions ?? (A.litElementVersions = [])).push("4.2.2");
|
|
554
554
|
/**
|
|
555
555
|
* @license
|
|
556
556
|
* Copyright 2017 Google LLC
|
|
557
557
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
558
558
|
*/
|
|
559
|
-
const
|
|
559
|
+
const Ht = (i) => (t, e) => {
|
|
560
560
|
e !== void 0 ? e.addInitializer(() => {
|
|
561
561
|
customElements.define(i, t);
|
|
562
562
|
}) : customElements.define(i, t);
|
|
@@ -566,7 +566,7 @@ const kt = (i) => (t, e) => {
|
|
|
566
566
|
* Copyright 2017 Google LLC
|
|
567
567
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
568
568
|
*/
|
|
569
|
-
const
|
|
569
|
+
const Rt = { attribute: !0, type: String, converter: D, reflect: !1, hasChanged: J }, Nt = (i = Rt, t, e) => {
|
|
570
570
|
const { kind: s, metadata: r } = e;
|
|
571
571
|
let o = globalThis.litPropertyMetadata.get(r);
|
|
572
572
|
if (o === void 0 && globalThis.litPropertyMetadata.set(r, o = /* @__PURE__ */ new Map()), s === "setter" && ((i = Object.create(i)).wrapped = !0), o.set(e.name, i), s === "accessor") {
|
|
@@ -587,8 +587,8 @@ const Tt = { attribute: !0, type: String, converter: z, reflect: !1, hasChanged:
|
|
|
587
587
|
}
|
|
588
588
|
throw Error("Unsupported decorator location: " + s);
|
|
589
589
|
};
|
|
590
|
-
function
|
|
591
|
-
return (t, e) => typeof e == "object" ?
|
|
590
|
+
function N(i) {
|
|
591
|
+
return (t, e) => typeof e == "object" ? Nt(i, t, e) : ((s, r, o) => {
|
|
592
592
|
const n = r.hasOwnProperty(o);
|
|
593
593
|
return r.constructor.createProperty(o, s), n ? Object.getOwnPropertyDescriptor(r, o) : void 0;
|
|
594
594
|
})(i, t, e);
|
|
@@ -598,23 +598,23 @@ function L(i) {
|
|
|
598
598
|
* Copyright 2017 Google LLC
|
|
599
599
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
600
600
|
*/
|
|
601
|
-
function
|
|
602
|
-
return
|
|
601
|
+
function I(i) {
|
|
602
|
+
return N({ ...i, state: !0, attribute: !1 });
|
|
603
603
|
}
|
|
604
|
-
var
|
|
604
|
+
var Tt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, m = (i, t, e, s) => {
|
|
605
605
|
for (var r = s > 1 ? void 0 : s ? zt(t, e) : t, o = i.length - 1, n; o >= 0; o--)
|
|
606
606
|
(n = i[o]) && (r = (s ? n(t, e, r) : n(r)) || r);
|
|
607
|
-
return s && r &&
|
|
607
|
+
return s && r && Tt(t, e, r), r;
|
|
608
608
|
};
|
|
609
|
-
let
|
|
609
|
+
let $ = class extends O {
|
|
610
610
|
constructor() {
|
|
611
|
-
super(...arguments), this.postUrl = "", this.endpoint = "", this.fetchEndpoint = "https://webmention.io/api/mentions.jf2", this.mentions = [], this.loading = !0, this.error = !1;
|
|
611
|
+
super(...arguments), this.postUrl = "", this.endpoint = "", this.fetchEndpoint = "https://webmention.io/api/mentions.jf2", this.perPage = 10, this.mentions = [], this.loading = !0, this.error = !1, this.currentPage = 1;
|
|
612
612
|
}
|
|
613
613
|
connectedCallback() {
|
|
614
614
|
super.connectedCallback(), this.postUrl && this.fetchMentions();
|
|
615
615
|
}
|
|
616
616
|
updated(i) {
|
|
617
|
-
i.has("postUrl") && this.postUrl && this.fetchMentions();
|
|
617
|
+
i.has("postUrl") && this.postUrl && (this.currentPage = 1, this.fetchMentions()), i.has("perPage") && (this.currentPage = 1);
|
|
618
618
|
}
|
|
619
619
|
async fetchMentions() {
|
|
620
620
|
this.loading = !0, this.error = !1;
|
|
@@ -646,6 +646,13 @@ let f = class extends O {
|
|
|
646
646
|
(i) => i["wm-property"] === "in-reply-to" || i["wm-property"] === "mention-of"
|
|
647
647
|
);
|
|
648
648
|
}
|
|
649
|
+
get totalPages() {
|
|
650
|
+
return Math.max(1, Math.ceil(this.replies.length / this.perPage));
|
|
651
|
+
}
|
|
652
|
+
get pagedReplies() {
|
|
653
|
+
const i = (this.currentPage - 1) * this.perPage;
|
|
654
|
+
return this.replies.slice(i, i + this.perPage);
|
|
655
|
+
}
|
|
649
656
|
renderReply(i) {
|
|
650
657
|
var s;
|
|
651
658
|
const t = i.author ?? {}, e = i.published ? new Date(i.published).toLocaleDateString("en-US", {
|
|
@@ -667,6 +674,35 @@ let f = class extends O {
|
|
|
667
674
|
</li>
|
|
668
675
|
`;
|
|
669
676
|
}
|
|
677
|
+
renderPagination() {
|
|
678
|
+
if (this.totalPages <= 1) return p;
|
|
679
|
+
const i = this.currentPage === 1, t = this.currentPage === this.totalPages;
|
|
680
|
+
return u`
|
|
681
|
+
<div class="pagination" part="pagination">
|
|
682
|
+
<button
|
|
683
|
+
class="page-button"
|
|
684
|
+
part="page-button page-button--prev ${i ? "page-button--disabled" : ""}"
|
|
685
|
+
?disabled=${i}
|
|
686
|
+
@click=${() => {
|
|
687
|
+
this.currentPage -= 1;
|
|
688
|
+
}}
|
|
689
|
+
><slot name="prev-label">← Prev</slot></button>
|
|
690
|
+
|
|
691
|
+
<span class="page-info" part="page-info">
|
|
692
|
+
${this.currentPage} / ${this.totalPages}
|
|
693
|
+
</span>
|
|
694
|
+
|
|
695
|
+
<button
|
|
696
|
+
class="page-button"
|
|
697
|
+
part="page-button page-button--next ${t ? "page-button--disabled" : ""}"
|
|
698
|
+
?disabled=${t}
|
|
699
|
+
@click=${() => {
|
|
700
|
+
this.currentPage += 1;
|
|
701
|
+
}}
|
|
702
|
+
><slot name="next-label">Next →</slot></button>
|
|
703
|
+
</div>
|
|
704
|
+
`;
|
|
705
|
+
}
|
|
670
706
|
render() {
|
|
671
707
|
return u`
|
|
672
708
|
<section part="base">
|
|
@@ -701,16 +737,19 @@ let f = class extends O {
|
|
|
701
737
|
</span>` : p}
|
|
702
738
|
</div>
|
|
703
739
|
` : p}
|
|
704
|
-
${this.replies.length > 0 ? u
|
|
705
|
-
|
|
706
|
-
|
|
740
|
+
${this.replies.length > 0 ? u`
|
|
741
|
+
<ol class="replies" part="replies">
|
|
742
|
+
${this.pagedReplies.map((i) => this.renderReply(i))}
|
|
743
|
+
</ol>
|
|
744
|
+
${this.renderPagination()}
|
|
745
|
+
` : p}
|
|
707
746
|
`}
|
|
708
747
|
</div>
|
|
709
748
|
</section>
|
|
710
749
|
`;
|
|
711
750
|
}
|
|
712
751
|
};
|
|
713
|
-
|
|
752
|
+
$.styles = $t`
|
|
714
753
|
:host {
|
|
715
754
|
--wm-text-color: inherit;
|
|
716
755
|
--wm-accent-color: #2563eb;
|
|
@@ -822,28 +861,51 @@ f.styles = $t`
|
|
|
822
861
|
opacity: 0.85;
|
|
823
862
|
line-height: 1.5;
|
|
824
863
|
}
|
|
864
|
+
|
|
865
|
+
.pagination {
|
|
866
|
+
display: flex;
|
|
867
|
+
align-items: center;
|
|
868
|
+
gap: 0.75rem;
|
|
869
|
+
margin-top: 1.5rem;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
.page-button:disabled {
|
|
873
|
+
opacity: 0.35;
|
|
874
|
+
cursor: not-allowed;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
.page-info {
|
|
878
|
+
font-size: 0.9rem;
|
|
879
|
+
opacity: 0.7;
|
|
880
|
+
}
|
|
825
881
|
`;
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
],
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
],
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
],
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
],
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
],
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
],
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
],
|
|
882
|
+
m([
|
|
883
|
+
N({ type: String, attribute: "post-url" })
|
|
884
|
+
], $.prototype, "postUrl", 2);
|
|
885
|
+
m([
|
|
886
|
+
N({ type: String, attribute: "endpoint" })
|
|
887
|
+
], $.prototype, "endpoint", 2);
|
|
888
|
+
m([
|
|
889
|
+
N({ type: String, attribute: "fetch-endpoint" })
|
|
890
|
+
], $.prototype, "fetchEndpoint", 2);
|
|
891
|
+
m([
|
|
892
|
+
N({ type: Number, attribute: "per-page" })
|
|
893
|
+
], $.prototype, "perPage", 2);
|
|
894
|
+
m([
|
|
895
|
+
I()
|
|
896
|
+
], $.prototype, "mentions", 2);
|
|
897
|
+
m([
|
|
898
|
+
I()
|
|
899
|
+
], $.prototype, "loading", 2);
|
|
900
|
+
m([
|
|
901
|
+
I()
|
|
902
|
+
], $.prototype, "error", 2);
|
|
903
|
+
m([
|
|
904
|
+
I()
|
|
905
|
+
], $.prototype, "currentPage", 2);
|
|
906
|
+
$ = m([
|
|
907
|
+
Ht("webmention-feed")
|
|
908
|
+
], $);
|
|
847
909
|
export {
|
|
848
|
-
|
|
910
|
+
$ as WebmentionFeed
|
|
849
911
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webmention-feed",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Lit web component for fetching and displaying webmentions",
|
|
6
6
|
"main": "./dist/webmention-feed.js",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "vite build && tsc --emitDeclarationOnly --outDir dist",
|
|
22
|
-
"dev": "vite
|
|
22
|
+
"dev": "vite",
|
|
23
|
+
"watch": "vite build --watch",
|
|
23
24
|
"clean": "rm -rf dist"
|
|
24
25
|
},
|
|
25
26
|
"license": "MIT",
|
package/src/webmention-feed.ts
CHANGED
|
@@ -21,9 +21,12 @@ interface Mention {
|
|
|
21
21
|
* @attr {string} post-url - Canonical URL of the page to fetch mentions for.
|
|
22
22
|
* @attr {string} endpoint - POST endpoint for submitting new webmentions.
|
|
23
23
|
* @attr {string} fetch-endpoint - GET endpoint for fetching mentions (JF2 format). Defaults to webmention.io.
|
|
24
|
+
* @attr {number} per-page - Number of replies to show per page. Default: 10.
|
|
24
25
|
*
|
|
25
26
|
* @slot like-icon - Icon before the like count. Default: ♥
|
|
26
27
|
* @slot repost-icon - Icon before the repost count. Default: ↩
|
|
28
|
+
* @slot prev-label - Label for the previous page button. Default: ← Prev
|
|
29
|
+
* @slot next-label - Label for the next page button. Default: Next →
|
|
27
30
|
*
|
|
28
31
|
* @cssvar --wm-accent-color
|
|
29
32
|
* @cssvar --wm-text-color
|
|
@@ -52,6 +55,12 @@ interface Mention {
|
|
|
52
55
|
* @csspart reply-link
|
|
53
56
|
* @csspart reply-content
|
|
54
57
|
* @csspart status
|
|
58
|
+
* @csspart pagination
|
|
59
|
+
* @csspart page-button
|
|
60
|
+
* @csspart page-button--prev
|
|
61
|
+
* @csspart page-button--next
|
|
62
|
+
* @csspart page-button--disabled
|
|
63
|
+
* @csspart page-info
|
|
55
64
|
*/
|
|
56
65
|
@customElement("webmention-feed")
|
|
57
66
|
export class WebmentionFeed extends LitElement {
|
|
@@ -59,10 +68,12 @@ export class WebmentionFeed extends LitElement {
|
|
|
59
68
|
@property({ type: String, attribute: "endpoint" }) endpoint = "";
|
|
60
69
|
@property({ type: String, attribute: "fetch-endpoint" })
|
|
61
70
|
fetchEndpoint = "https://webmention.io/api/mentions.jf2";
|
|
71
|
+
@property({ type: Number, attribute: "per-page" }) perPage = 10;
|
|
62
72
|
|
|
63
73
|
@state() private mentions: Mention[] = [];
|
|
64
74
|
@state() private loading = true;
|
|
65
75
|
@state() private error = false;
|
|
76
|
+
@state() private currentPage = 1;
|
|
66
77
|
|
|
67
78
|
connectedCallback() {
|
|
68
79
|
super.connectedCallback();
|
|
@@ -71,8 +82,12 @@ export class WebmentionFeed extends LitElement {
|
|
|
71
82
|
|
|
72
83
|
updated(changed: Map<string, unknown>) {
|
|
73
84
|
if (changed.has("postUrl") && this.postUrl) {
|
|
85
|
+
this.currentPage = 1;
|
|
74
86
|
this.fetchMentions();
|
|
75
87
|
}
|
|
88
|
+
if (changed.has("perPage")) {
|
|
89
|
+
this.currentPage = 1;
|
|
90
|
+
}
|
|
76
91
|
}
|
|
77
92
|
|
|
78
93
|
private async fetchMentions() {
|
|
@@ -125,6 +140,15 @@ export class WebmentionFeed extends LitElement {
|
|
|
125
140
|
);
|
|
126
141
|
}
|
|
127
142
|
|
|
143
|
+
private get totalPages() {
|
|
144
|
+
return Math.max(1, Math.ceil(this.replies.length / this.perPage));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private get pagedReplies() {
|
|
148
|
+
const start = (this.currentPage - 1) * this.perPage;
|
|
149
|
+
return this.replies.slice(start, start + this.perPage);
|
|
150
|
+
}
|
|
151
|
+
|
|
128
152
|
private renderReply(m: Mention) {
|
|
129
153
|
const author = m.author ?? {};
|
|
130
154
|
const date = m.published
|
|
@@ -156,6 +180,35 @@ export class WebmentionFeed extends LitElement {
|
|
|
156
180
|
`;
|
|
157
181
|
}
|
|
158
182
|
|
|
183
|
+
private renderPagination() {
|
|
184
|
+
if (this.totalPages <= 1) return nothing;
|
|
185
|
+
|
|
186
|
+
const prevDisabled = this.currentPage === 1;
|
|
187
|
+
const nextDisabled = this.currentPage === this.totalPages;
|
|
188
|
+
|
|
189
|
+
return html`
|
|
190
|
+
<div class="pagination" part="pagination">
|
|
191
|
+
<button
|
|
192
|
+
class="page-button"
|
|
193
|
+
part="page-button page-button--prev ${prevDisabled ? "page-button--disabled" : ""}"
|
|
194
|
+
?disabled=${prevDisabled}
|
|
195
|
+
@click=${() => { this.currentPage -= 1; }}
|
|
196
|
+
><slot name="prev-label">← Prev</slot></button>
|
|
197
|
+
|
|
198
|
+
<span class="page-info" part="page-info">
|
|
199
|
+
${this.currentPage} / ${this.totalPages}
|
|
200
|
+
</span>
|
|
201
|
+
|
|
202
|
+
<button
|
|
203
|
+
class="page-button"
|
|
204
|
+
part="page-button page-button--next ${nextDisabled ? "page-button--disabled" : ""}"
|
|
205
|
+
?disabled=${nextDisabled}
|
|
206
|
+
@click=${() => { this.currentPage += 1; }}
|
|
207
|
+
><slot name="next-label">Next →</slot></button>
|
|
208
|
+
</div>
|
|
209
|
+
`;
|
|
210
|
+
}
|
|
211
|
+
|
|
159
212
|
render() {
|
|
160
213
|
return html`
|
|
161
214
|
<section part="base">
|
|
@@ -203,9 +256,12 @@ export class WebmentionFeed extends LitElement {
|
|
|
203
256
|
`
|
|
204
257
|
: nothing}
|
|
205
258
|
${this.replies.length > 0
|
|
206
|
-
? html
|
|
207
|
-
|
|
208
|
-
|
|
259
|
+
? html`
|
|
260
|
+
<ol class="replies" part="replies">
|
|
261
|
+
${this.pagedReplies.map((m) => this.renderReply(m))}
|
|
262
|
+
</ol>
|
|
263
|
+
${this.renderPagination()}
|
|
264
|
+
`
|
|
209
265
|
: nothing}
|
|
210
266
|
`}
|
|
211
267
|
</div>
|
|
@@ -325,6 +381,23 @@ export class WebmentionFeed extends LitElement {
|
|
|
325
381
|
opacity: 0.85;
|
|
326
382
|
line-height: 1.5;
|
|
327
383
|
}
|
|
384
|
+
|
|
385
|
+
.pagination {
|
|
386
|
+
display: flex;
|
|
387
|
+
align-items: center;
|
|
388
|
+
gap: 0.75rem;
|
|
389
|
+
margin-top: 1.5rem;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.page-button:disabled {
|
|
393
|
+
opacity: 0.35;
|
|
394
|
+
cursor: not-allowed;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.page-info {
|
|
398
|
+
font-size: 0.9rem;
|
|
399
|
+
opacity: 0.7;
|
|
400
|
+
}
|
|
328
401
|
`;
|
|
329
402
|
}
|
|
330
403
|
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { LitElement } from "lit";
|
|
2
|
-
/**
|
|
3
|
-
* `<webmention-feed>` — fetches and displays webmentions for a given page.
|
|
4
|
-
*
|
|
5
|
-
* @attr {string} post-url - Canonical URL of the page to fetch mentions for.
|
|
6
|
-
* @attr {string} endpoint - POST endpoint for submitting new webmentions.
|
|
7
|
-
* @attr {string} fetch-endpoint - GET endpoint for fetching mentions (JF2 format). Defaults to webmention.io.
|
|
8
|
-
*
|
|
9
|
-
* @slot like-icon - Icon before the like count. Default: ♥
|
|
10
|
-
* @slot repost-icon - Icon before the repost count. Default: ↩
|
|
11
|
-
*
|
|
12
|
-
* @cssvar --wm-accent-color
|
|
13
|
-
* @cssvar --wm-text-color
|
|
14
|
-
* @cssvar --wm-border-color
|
|
15
|
-
* @cssvar --wm-reply-bg
|
|
16
|
-
* @cssvar --wm-reply-border-color
|
|
17
|
-
* @cssvar --wm-input-bg
|
|
18
|
-
* @cssvar --wm-input-border-color
|
|
19
|
-
* @cssvar --wm-avatar-bg
|
|
20
|
-
* @cssvar --wm-button-text-color
|
|
21
|
-
*
|
|
22
|
-
* @csspart base
|
|
23
|
-
* @csspart heading
|
|
24
|
-
* @csspart send-form
|
|
25
|
-
* @csspart input
|
|
26
|
-
* @csspart button
|
|
27
|
-
* @csspart list
|
|
28
|
-
* @csspart reactions
|
|
29
|
-
* @csspart stat
|
|
30
|
-
* @csspart replies
|
|
31
|
-
* @csspart reply
|
|
32
|
-
* @csspart reply-meta
|
|
33
|
-
* @csspart avatar
|
|
34
|
-
* @csspart reply-author
|
|
35
|
-
* @csspart reply-date
|
|
36
|
-
* @csspart reply-link
|
|
37
|
-
* @csspart reply-content
|
|
38
|
-
* @csspart status
|
|
39
|
-
*/
|
|
40
|
-
export declare class WebmentionFeed extends LitElement {
|
|
41
|
-
postUrl: string;
|
|
42
|
-
endpoint: string;
|
|
43
|
-
fetchEndpoint: string;
|
|
44
|
-
private mentions;
|
|
45
|
-
private loading;
|
|
46
|
-
private error;
|
|
47
|
-
connectedCallback(): void;
|
|
48
|
-
updated(changed: Map<string, unknown>): void;
|
|
49
|
-
private fetchMentions;
|
|
50
|
-
private get likes();
|
|
51
|
-
private get reposts();
|
|
52
|
-
private get replies();
|
|
53
|
-
private renderReply;
|
|
54
|
-
render(): import("lit").TemplateResult<1>;
|
|
55
|
-
static styles: import("lit").CSSResult;
|
|
56
|
-
}
|
|
57
|
-
declare global {
|
|
58
|
-
interface HTMLElementTagNameMap {
|
|
59
|
-
"webmention-feed": WebmentionFeed;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=webmention-feed.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webmention-feed.d.ts","sourceRoot":"","sources":["../src/webmention-feed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAiBrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBACa,cAAe,SAAQ,UAAU;IACO,OAAO,SAAM;IACb,QAAQ,SAAM;IAEjE,aAAa,SAA4C;IAEhD,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,KAAK,CAAS;IAE/B,iBAAiB;IAKjB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;YAMvB,aAAa;IAsC3B,OAAO,KAAK,KAAK,GAEhB;IACD,OAAO,KAAK,OAAO,GAElB;IACD,OAAO,KAAK,OAAO,GAIlB;IAED,OAAO,CAAC,WAAW;IA+BnB,MAAM;IAyDN,MAAM,CAAC,MAAM,0BAgHX;CACH;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,cAAc,CAAC;KACnC;CACF"}
|