Refactor zapthreads embed bootstrap

This commit is contained in:
thePR0M3TH3AN committed 2025-10-13 11:04:19 -04:00
1 parent ad20f1d093
commit 6acdb3ea92
1 file changed
+8 -521
+8 -521
View File
@@ -42,7 +42,6 @@
<link rel="stylesheet" href="./css/tailwind.generated.css" />
<script src="./js/tracking.js" defer></script>
<script type="module" crossorigin>
import { initZapthreadsEmbed } from "./js/blog/zapthreadsEmbed.js";
var pv = Object.defineProperty;
var gv = (e, t, n) =>
@@ -14422,526 +14421,6 @@
function L6(e) {
return typeof e == "function" && e.toString().indexOf("class") === 0;
}
let Mu;
function B6(e, t) {
const n = Object.keys(t);
return class extends e {
static get observedAttributes() {
return n.map((o) => t[o].attribute);
}
constructor() {
super(),
(this.__initialized = !1),
(this.__released = !1),
(this.__releaseCallbacks = []),
(this.__propertyChangedCallbacks = []),
(this.__updating = {}),
(this.props = {});
}
connectedCallback() {
if (this.__initialized) return;
(this.__releaseCallbacks = []),
(this.__propertyChangedCallbacks = []),
(this.__updating = {}),
(this.props = x6(this, t));
const o = $6(this.props),
s = this.Component,
c = Mu;
try {
(Mu = this),
(this.__initialized = !0),
L6(s) ? new s(o, { element: this }) : s(o, { element: this });
} finally {
Mu = c;
}
}
async disconnectedCallback() {
if ((await Promise.resolve(), this.isConnected)) return;
this.__propertyChangedCallbacks.length = 0;
let o = null;
for (; (o = this.__releaseCallbacks.pop()); ) o(this);
delete this.__initialized, (this.__released = !0);
}
attributeChangedCallback(o, s, c) {
if (
this.__initialized &&
!this.__updating[o] &&
((o = this.lookupProp(o)), o in t)
) {
if (c == null && !this[o]) return;
this[o] = t[o].parse ? Aw(c) : c;
}
}
lookupProp(o) {
if (t) return n.find((s) => o === s || o === t[s].attribute);
}
get renderRoot() {
return this.shadowRoot || this.attachShadow({ mode: "open" });
}
addReleaseCallback(o) {
this.__releaseCallbacks.push(o);
}
addPropertyChangedCallback(o) {
this.__propertyChangedCallbacks.push(o);
}
};
}
function C6(e, t = {}, n = {}) {
const { BaseElement: r = HTMLElement, extension: o } = n;
return (s) => {
let c = customElements.get(e);
return c
? ((c.prototype.Component = s), c)
: ((c = B6(r, S6(t))),
(c.prototype.Component = s),
(c.prototype.registeredTag = e),
customElements.define(e, c, o),
c);
};
}
function I6(e) {
const t = Object.keys(e),
n = {};
for (let r = 0; r < t.length; r++) {
const [o, s] = dt(e[t[r]]);
Object.defineProperty(n, t[r], {
get: o,
set(c) {
s(() => c);
},
});
}
return n;
}
function O6(e) {
if (e.assignedSlot && e.assignedSlot._$owner)
return e.assignedSlot._$owner;
let t = e.parentNode;
for (; t && !t._$owner && !(t.assignedSlot && t.assignedSlot._$owner); )
t = t.parentNode;
return t && t.assignedSlot ? t.assignedSlot._$owner : e._$owner;
}
function N6(e) {
return (t, n) => {
const { element: r } = n;
return Il((o) => {
const s = I6(t);
r.addPropertyChangedCallback((f, d) => (s[f] = d)),
r.addReleaseCallback(() => {
(r.renderRoot.textContent = ""), o();
});
const c = e(s, n);
return xe(r.renderRoot, c);
}, O6(r));
};
}
function R6(e, t, n) {
return arguments.length === 2 && ((n = t), (t = {})), C6(e, t)(N6(n));
}
const z6 = `#ztr-content,
#ztr-content img {
max-width: 100%;
}
#ztr-root {
display: flex;
flex-direction: column;
font-family: var(--ztr-font);
font-size: var(--ztr-font-size);
color: var(--ztr-text-color);
border: 1px solid transparent;
word-wrap: break-word;
/* removes margin collapse */
margin-top: 4em;
line-height: 1.2em;
}
#ztr-subtitle {
font-size: 1.2em;
color: var(--color-blog-gray-500);
}
a {
color: var(--ztr-link-color);
text-decoration: none;
}
/* Comment */
.ztr-comment {
position: relative;
margin: 0;
padding: 0;
}
.ztr-comment,
.ztr-reply-button {
background-color: var(--ztr-background-color, rgba(0, 0, 0, 0.03));
}
.ztr-comment-body {
padding: 1em;
}
.ztr-comment:first-child {
border-top-left-radius: 0.3em;
border-top-right-radius: 0.3em;
}
.ztr-comment:last-child {
border-bottom-left-radius: 0.3em;
border-bottom-right-radius: 0.3em;
}
.ztr-comment-info-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
}
.ztr-comment-info {
display: flex;
align-items: center;
}
.ztr-comment-info-picture {
width: 3.5em;
}
ul.ztr-comment-info-items {
display: flex;
align-items: center;
list-style: none;
margin: 0;
padding: 0;
font-size: 0.9em;
}
ul.ztr-comment-info-items li {
display: inline-block;
cursor: default;
padding-right: 0.5em;
}
ul.ztr-comment-info-items li a {
font-weight: 600;
}
.ztr-comment-info-author a {
font-size: 1.2em;
padding-right: 0.2em;
}
.ztr-comment-info-dots {
cursor: pointer;
}
.ztr-comment-info-separator {
width: 0.5em;
}
.ztr-comment-info-picture img {
width: 2em;
height: 2em;
border-radius: 50%;
padding: 0.5em;
position: relative;
display: block;
object-fit: cover;
}
.ztr-comment-text,
#ztr-content {
margin-bottom: 0.75em;
padding: 0 0.8em 0 3.5em;
line-height: 1.5em;
line-break: loose;
word-break: break-word;
overflow: hidden;
max-width: 750px;
}
.ztr-comment-text p {
margin: 0 0 0.5em 0;
}
.ztr-comment-text code {
font-size: 1.1em;
margin: 0 0.2em;
}
.ztr-comment-text pre,
.ztr-info-pane pre {
white-space: pre-wrap;
white-space: -moz-pre-wrap;
word-wrap: break-word;
}
.ztr-comment-text a:hover {
text-decoration: underline;
}
.ztr-comment-text img {
max-width: 100%;
}
.ztr-comment-text .warning {
margin-top: 0em;
font-size: 0.8em;
display: flex;
align-items: center;
}
.ztr-comment-text .warning svg {
height: 1.2em;
fill: var(--color-blog-amber-500);
padding-right: 0.7em;
}
.ztr-comment-replies {
margin-left: 2em;
}
.highlight p {
background: var(--color-blog-amber-400);
color: var(--color-blog-gray-800);
display: inline;
padding: 0.2em;
}
/* Styling the reply to comment form */
.ztr-comment-expand {
display: flex;
justify-content: center;
}
.ztr-comment-expand span {
margin: 1em 0 1em 0.35em;
cursor: pointer;
}
ul.ztr-comment-actions,
.ztr-comment-expand {
display: flex;
align-items: center;
list-style: none;
margin: 0;
padding: 0 0 0 3.5em;
font-weight: 600;
user-select: none;
}
ul.ztr-comment-actions li {
display: inline-flex;
align-items: center;
text-align: center;
padding: 0 2em 0 0;
cursor: pointer;
}
ul.ztr-comment-actions li span {
padding: 0.25em 0.25em 0 0.25em;
color: var(--ztr-icon-color, var(--color-blog-gray-700));
}
svg {
fill: var(--ztr-icon-color, var(--color-blog-gray-700));
width: 1.1em;
height: 1.1em;
}
.ztr-comment-action-reply:hover svg {
fill: var(--color-blog-purple-accent);
}
.ztr-comment-action-reply:hover span {
color: var(--color-blog-purple-accent);
}
.ztr-comment-action-zap:hover svg {
fill: var(--color-blog-amber-500);
}
.ztr-comment-action-zap:hover span {
color: var(--color-blog-amber-500);
}
.ztr-comment-action-like:hover svg {
fill: var(--color-blog-orange-600);
}
.ztr-comment-action-like:hover span {
color: var(--color-blog-orange-600);
}
.ztr-reply-form {
padding: 0 0.5em 0 3.5em;
}
.ztr-reply-form textarea {
font-family: var(--ztr-font);
font-size: 1.1em;
line-height: 1.4;
color: var(--color-blog-gray-800);
background-color: var(--color-blog-neutral-50);
border: 1px solid var(--color-blog-gray-250);
outline: none;
width: calc(100% - 1.5em);
padding: 0.7em;
margin: 0.5em 0;
height: 4em;
border-radius: 0.2em;
min-height: 4em;
resize: vertical;
}
.ztr-reply-form:disabled {
opacity: 65%;
user-select: none;
}
.ztr-reply-controls {
display: flex;
align-items: center;
justify-content: flex-end;
}
.ztr-reply-controls span {
font-weight: bold;
font-size: 0.85em;
margin-right: 1em;
user-select: none;
cursor: default;
}
.ztr-reply-error {
color: var(--color-blog-error);
}
.ztr-reply-controls button {
font-family: var(--ztr-font);
appearance: none;
border: none;
padding: 0.5em 1em;
border-radius: 0.2em;
font-size: 0.85em;
font-weight: 600;
cursor: pointer;
}
.ztr-reply-login-button {
color: white;
background-color: var(--ztr-login-button-color, var(--color-blog-gray-800));
margin-left: 1em;
}
.ztr-reply-button {
color: var(--ztr-text-color);
display: flex;
align-items: center;
}
.ztr-info-pane {
padding: 0 0.5em 1em 3.5em;
}
.ztr-info-pane pre {
font-size: 0.8em;
}
.ztr-spinner {
width: 1.2em;
height: 1.2em;
padding: 0.9em;
animation: rotate 4s linear infinite;
}
.ztr-reply-button:disabled {
opacity: 65%;
pointer-events: none;
cursor: pointer;
user-select: none;
}
.ztr-spinner .path {
stroke: var(--ztr-text-color, var(--color-blog-gray-800));
stroke-linecap: round;
animation: dash 1.5s ease-in-out infinite;
}
@keyframes rotate {
100% {
transform: rotate(360deg);
}
}
@keyframes dash {
0% {
stroke-dasharray: 1, 150;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -35;
}
100% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -124;
}
}
/* new */
.ztr-comment-new .ztr-reply-form {
margin: 0.5em 0;
padding: 0;
}
.ztr-comment-new .ztr-comment-body {
padding: 0;
}
.ztr-comment-new .ztr-comment-actions {
font-size: 1.1em;
padding: 0;
}
/* Dark mode defaults */
@media (prefers-color-scheme: dark) {
.ztr-spinner .path {
stroke: var(--ztr-text-color, var(--color-blog-gray-200));
}
.ztr-comment,
.ztr-reply-button {
background-color: var(--ztr-background-color, rgba(255, 255, 255, 0.06));
}
.ztr-reply-login-button {
color: var(--color-blog-gray-800);
background-color: var(--ztr-login-button-color, var(--color-blog-gray-200));
}
svg {
fill: var(--ztr-icon-color, var(--color-blog-gray-200));
}
ul.ztr-comment-actions li span {
color: var(--ztr-icon-color);
}
.ztr-comment-action-reply:hover svg {
fill: var(--color-blog-purple-muted);
}
.ztr-comment-action-reply:hover span {
color: var(--color-blog-purple-muted);
}
}`;
function Ip(e) {
if (!Number.isSafeInteger(e) || e < 0)
throw new Error(`Wrong positive integer: ${e}`);
@@ -21533,6 +21012,13 @@ svg {
}
return options;
}
let zapthreadsModulePromise;
function loadZapthreadsModule() {
if (!zapthreadsModulePromise) {
zapthreadsModulePromise = import("./js/blog/zapthreadsEmbed.js");
}
return zapthreadsModulePromise;
}
const zapthreadsCleanupMap = new WeakMap();
async function initializeZapthreadsEmbed(element) {
if (!(element instanceof Element)) return;
@@ -21547,6 +21033,7 @@ svg {
}
if (!element.isConnected) return;
try {
const { initZapthreadsEmbed } = await loadZapthreadsModule();
const cleanup = await initZapthreadsEmbed({
root: element,
options: getZapthreadsOptions(element),