@popgrids/embed 0.0.8 → 0.0.10
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/AGENTS.md +2 -1
- package/dist/components/pop-comment-icon.d.ts +1 -0
- package/dist/components/pop-comment-icon.d.ts.map +1 -1
- package/dist/components/pop-grid.d.ts.map +1 -1
- package/dist/components/pop-widget.d.ts.map +1 -1
- package/dist/embed.js +19 -8
- package/dist/embed.js.map +1 -1
- package/dist/index.cjs +15 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/loader.js +1 -1
- package/dist/store/grid-store.d.ts +6 -6
- package/dist/store/grid-store.d.ts.map +1 -1
- package/dist/types/models.d.ts +3 -0
- package/dist/types/models.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1285,17 +1285,23 @@ let e=require("@floating-ui/dom"),t=require("@preact/signals-core");function n(e
|
|
|
1285
1285
|
height: var(--pop-comment-icon-size);
|
|
1286
1286
|
}
|
|
1287
1287
|
|
|
1288
|
+
/* Hidden until it loads, so the plus shows while it loads or if it fails. */
|
|
1288
1289
|
.comment-icon__icon-image {
|
|
1289
|
-
display:
|
|
1290
|
+
display: none;
|
|
1290
1291
|
width: var(--pop-comment-icon-size);
|
|
1291
1292
|
height: var(--pop-comment-icon-size);
|
|
1293
|
+
object-fit: contain;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
.comment-icon__icon-image--loaded {
|
|
1297
|
+
display: flex;
|
|
1292
1298
|
}
|
|
1293
1299
|
|
|
1294
1300
|
.comment-icon__icon {
|
|
1295
1301
|
display: flex;
|
|
1296
1302
|
}
|
|
1297
1303
|
|
|
1298
|
-
.comment-icon__icon-image + .comment-icon__icon {
|
|
1304
|
+
.comment-icon__icon-image--loaded + .comment-icon__icon {
|
|
1299
1305
|
display: none;
|
|
1300
1306
|
}
|
|
1301
1307
|
|
|
@@ -1310,11 +1316,11 @@ let e=require("@floating-ui/dom"),t=require("@preact/signals-core");function n(e
|
|
|
1310
1316
|
transform: scale(var(--pop-comment-icon-scale-hover));
|
|
1311
1317
|
}
|
|
1312
1318
|
|
|
1313
|
-
.comment-icon:hover .comment-icon__icon-image {
|
|
1319
|
+
.comment-icon:hover .comment-icon__icon-image--loaded {
|
|
1314
1320
|
display: none;
|
|
1315
1321
|
}
|
|
1316
1322
|
|
|
1317
|
-
.comment-icon:hover .comment-icon__icon-image + .comment-icon__icon {
|
|
1323
|
+
.comment-icon:hover .comment-icon__icon-image--loaded + .comment-icon__icon {
|
|
1318
1324
|
display: flex;
|
|
1319
1325
|
}
|
|
1320
1326
|
}
|
|
@@ -1481,7 +1487,7 @@ let e=require("@floating-ui/dom"),t=require("@preact/signals-core");function n(e
|
|
|
1481
1487
|
stroke-linejoin="round"
|
|
1482
1488
|
/>
|
|
1483
1489
|
</svg>
|
|
1484
|
-
`)),e}getTemplate(){let e=this.disabled?`disabled`:``,t=[`comment-icon`,this.size?`comment-icon--size-${this.size}`:``,this.theme?`comment-icon--theme-${this.theme}`:``,this.variant?`comment-icon--variant-${this.variant}`:``].filter(Boolean).join(` `),n=this.iconUrl?`<img
|
|
1490
|
+
`)),e}render(){super.render();let e=this.getElement(`.comment-icon__icon-image`);if(!e||!this.iconUrl)return;let t=()=>{e.classList.add(`comment-icon__icon-image--loaded`);let t=this.getElement(`.comment-icon`);t?.classList.remove(`comment-icon--theme-${this.theme}`),t?.classList.add(`comment-icon--theme-brand`)};e.addEventListener(`load`,t,{once:!0}),e.addEventListener(`error`,()=>e.remove(),{once:!0}),e.src=this.iconUrl,e.complete&&e.naturalWidth>0&&t()}getTemplate(){let e=this.disabled?`disabled`:``,t=[`comment-icon`,this.size?`comment-icon--size-${this.size}`:``,this.theme?`comment-icon--theme-${this.theme}`:``,this.variant?`comment-icon--variant-${this.variant}`:``].filter(Boolean).join(` `),n=this.iconUrl?`<img alt="" class="comment-icon__icon-image" />
|
|
1485
1491
|
<slot class="comment-icon__icon" name="icon">${this.icon}</slot>`:`<slot class="comment-icon__icon" name="icon">${this.icon}</slot>`,r=this.ariaLabel?`aria-label="${this.ariaLabel}"`:``;return`
|
|
1486
1492
|
<button
|
|
1487
1493
|
class="${t}"
|
|
@@ -1897,7 +1903,7 @@ let e=require("@floating-ui/dom"),t=require("@preact/signals-core");function n(e
|
|
|
1897
1903
|
font-style: italic;
|
|
1898
1904
|
opacity: 0.8;
|
|
1899
1905
|
}
|
|
1900
|
-
`),X=class extends k{constructor(...e){super(...e),this.events={click:`onClick`},this._expanded=!1,this._dropdownOpen=!1,this._onOutsideClick=e=>{let t=e.composedPath(),n=this.getElement(A(`dropdown`)),r=this.getElement(A(`menu-trigger`));n&&r&&!t.includes(n)&&!t.includes(r)&&this.closeDropdown()},this._timeUpdateTimer=null}static get observedAttributes(){return[`data-size`,`comment-id`]}onDataSizeChanged(){this.render()}onCommentIdChanged(){this.render()}get size(){return this.getAttribute(`data-size`)||`sm`}get commentAvatarSize(){return this.size===`sm`?`xs`:`sm`}get styleSheets(){return[Xe]}toggleDropdown(){this._dropdownOpen?this.closeDropdown():this.openDropdown()}openDropdown(){this._dropdownOpen=!0;let t=this.getElement(A(`dropdown`)),n=this.getElement(A(`menu-trigger`));if(t&&n){t.classList.add(`is-open`);let r=()=>{(0,e.computePosition)(n,t,{placement:`bottom-end`,middleware:[(0,e.offset)(4),(0,e.flip)(),(0,e.shift)({padding:8})],strategy:`fixed`}).then(({x:e,y:n})=>{Object.assign(t.style,{left:`${e}px`,top:`${n}px`,position:`fixed`})})};this._floatingCleanup=(0,e.autoUpdate)(n,t,r),document.addEventListener(`mousedown`,this._onOutsideClick)}}closeDropdown(){this._dropdownOpen=!1;let e=this.getElement(A(`dropdown`));e&&e.classList.remove(`is-open`),this._floatingCleanup&&=(this._floatingCleanup(),void 0),document.removeEventListener(`mousedown`,this._onOutsideClick)}async deleteComment(){let e=this.getAttribute(`comment-id`);e&&confirm(`Are you sure you want to delete this comment?`)&&await this.gridStore.deleteComment(e)}async flagComment(){let e=this.getAttribute(`comment-id`);e&&(await this.gridStore.flagComment(e)?alert(`Comment flagged successfully.`):alert(`Failed to flag comment.`))}onClick(e){let t=e.target;if(t.closest(A(`menu-trigger`))){e.stopPropagation(),this.toggleDropdown();return}let n=t.closest(A(`dropdown-item`));if(n){e.stopPropagation();let t=n.getAttribute(`data-action`),r=this.getAttribute(`comment-id`);t===`edit`&&r?(this.gridStore.replyingTo.value=null,this.gridStore.editingCommentId.value=r):t===`delete`?this.deleteComment():t===`flag`&&this.flagComment(),this.closeDropdown();return}if(t.closest(A(`dropdown`))){e.stopPropagation();return}if(!this.authStore.currentUser.value)return;let r=this.getAttribute(`comment-id`);r&&this.gridStore.comments.value.find(e=>e.id===r)?.status!==`deleted`&&(this.gridStore.replyingTo.value===r?this.gridStore.replyingTo.value=null:this.gridStore.replyingTo.value=r,this.expandText())}expandText(){let e=this.getElement(A(`text`));if(!this._expanded&&e){let t=e.offsetHeight;this._expanded=!0,this.render();let n=this.getElement(A(`text`));if(n){let e=n.scrollHeight;n.style.height=`${t}px`,n.style.overflow=`hidden`,n.offsetHeight,n.style.transition=`height var(--pop-duration-quick) var(--pop-ease-quick)`,n.style.height=`${e}px`,setTimeout(()=>{n.style.height=``,n.style.overflow=``},300)}}}disconnectedCallback(){this.closeDropdown(),this.stopTimeUpdates(),super.disconnectedCallback()}startTimeUpdates(){this.stopTimeUpdates();let e=this.getAttribute(`comment-id`);if(!e)return;let t=this.gridStore.comments.value.find(t=>t.id===e);if(!t)return;let n=()=>{let e=this.getElement(A(`timestamp`));e&&(e.textContent=Y(t.createdAt));let r=Date.now()-(typeof t.createdAt==`number`?t.createdAt:Date.parse(String(t.createdAt))),i=6e4;i=r<6e4?5e3:r<36e5?6e4:18e5,this._timeUpdateTimer=setTimeout(n,i)},r=Date.now()-(typeof t.createdAt==`number`?t.createdAt:Date.parse(String(t.createdAt)))<6e4?5e3:6e4;this._timeUpdateTimer=setTimeout(n,r)}stopTimeUpdates(){this._timeUpdateTimer&&=(clearTimeout(this._timeUpdateTimer),null)}setupEffects(){this.addEffect(()=>{this.setAttribute(`data-size`,this.gridStore.commentSize.value)}),this.addEffect(()=>{let e=this.getAttribute(`comment-id`),t=this.authStore.currentUser.value,n=this.gridStore.replyingTo.value,r=this.gridStore.editingCommentId.value,i=this.gridStore.scrollingCommentId.value;this.classList.toggle(`is-signed-in`,t!==null),this.classList.toggle(`is-replying`,e!==null&&n===e),this.classList.toggle(`is-editing`,e!==null&&r===e),this.gridStore.comments.value,this.render(),this.startTimeUpdates(),e&&i===e&&setTimeout(()=>{let t=this.shadowRoot?.querySelector(`#comment-${e}`);t?t.scrollIntoView({behavior:`smooth`,block:`center`}):this.scrollIntoView({behavior:`smooth`,block:`center`}),this.gridStore.scrollingCommentId.value=null},50)})}getTemplate(){let e=this.getAttribute(`comment-id`);if(!e)return``;let t=this.gridStore.comments.value.find(t=>t.id===e);if(!t)return``;let r=t.status===`deleted`,i=t.authorDeleted===!0,a=r||i,o=a?``:t.author?.image?`<img src="${t.author.image}" alt="${t.author.name??`User avatar`}" />`:n(t.author?.name),s=this.gridStore.replyingTo.value,c=e!==null&&s===e,l=this.size,u=this.authStore.currentUser.value,d=u&&t.author&&u.id===t.author.id,f=u&&!r?`<div class="comment__menu">
|
|
1906
|
+
`),X=class extends k{constructor(...e){super(...e),this.events={click:`onClick`},this._expanded=!1,this._dropdownOpen=!1,this._onOutsideClick=e=>{let t=e.composedPath(),n=this.getElement(A(`dropdown`)),r=this.getElement(A(`menu-trigger`));n&&r&&!t.includes(n)&&!t.includes(r)&&this.closeDropdown()},this._timeUpdateTimer=null}static get observedAttributes(){return[`data-size`,`comment-id`]}onDataSizeChanged(){this.render()}onCommentIdChanged(){this.render()}get size(){return this.getAttribute(`data-size`)||`sm`}get commentAvatarSize(){return this.size===`sm`?`xs`:`sm`}get styleSheets(){return[Xe]}toggleDropdown(){this._dropdownOpen?this.closeDropdown():this.openDropdown()}openDropdown(){this._dropdownOpen=!0;let t=this.getElement(A(`dropdown`)),n=this.getElement(A(`menu-trigger`));if(t&&n){t.classList.add(`is-open`);let r=()=>{(0,e.computePosition)(n,t,{placement:`bottom-end`,middleware:[(0,e.offset)(4),(0,e.flip)(),(0,e.shift)({padding:8})],strategy:`fixed`}).then(({x:e,y:n})=>{Object.assign(t.style,{left:`${e}px`,top:`${n}px`,position:`fixed`})})};this._floatingCleanup=(0,e.autoUpdate)(n,t,r),document.addEventListener(`mousedown`,this._onOutsideClick)}}closeDropdown(){this._dropdownOpen=!1;let e=this.getElement(A(`dropdown`));e&&e.classList.remove(`is-open`),this._floatingCleanup&&=(this._floatingCleanup(),void 0),document.removeEventListener(`mousedown`,this._onOutsideClick)}async deleteComment(){let e=this.getAttribute(`comment-id`);e&&confirm(`Are you sure you want to delete this comment?`)&&await this.gridStore.deleteComment(e)}async flagComment(){let e=this.getAttribute(`comment-id`);e&&(await this.gridStore.flagComment(e)?alert(`Comment flagged successfully.`):alert(`Failed to flag comment.`))}onClick(e){let t=e.target;if(t.closest(A(`menu-trigger`))){e.stopPropagation(),this.toggleDropdown();return}let n=t.closest(A(`dropdown-item`));if(n){e.stopPropagation();let t=n.getAttribute(`data-action`),r=this.getAttribute(`comment-id`);t===`edit`&&r?(this.gridStore.replyingTo.value=null,this.gridStore.editingCommentId.value=r):t===`delete`?this.deleteComment():t===`flag`&&this.flagComment(),this.closeDropdown();return}if(t.closest(A(`dropdown`))){e.stopPropagation();return}if(!this.authStore.currentUser.value)return;let r=this.getAttribute(`comment-id`);r&&this.gridStore.comments.value.find(e=>e.id===r)?.status!==`deleted`&&(this.gridStore.replyingTo.value===r?this.gridStore.replyingTo.value=null:this.gridStore.replyingTo.value=r,this.expandText())}expandText(){let e=this.getElement(A(`text`));if(!this._expanded&&e){let t=e.offsetHeight;this._expanded=!0,this.render();let n=this.getElement(A(`text`));if(n){let e=n.scrollHeight;n.style.height=`${t}px`,n.style.overflow=`hidden`,n.offsetHeight,n.style.transition=`height var(--pop-duration-quick) var(--pop-ease-quick)`,n.style.height=`${e}px`,setTimeout(()=>{n.style.height=``,n.style.overflow=``},300)}}}disconnectedCallback(){this.closeDropdown(),this.stopTimeUpdates(),super.disconnectedCallback()}startTimeUpdates(){this.stopTimeUpdates();let e=this.getAttribute(`comment-id`);if(!e)return;let t=this.gridStore.comments.value.find(t=>t.id===e);if(!t)return;let n=()=>{let e=this.getElement(A(`timestamp`));e&&(e.textContent=Y(t.createdAt));let r=Date.now()-(typeof t.createdAt==`number`?t.createdAt:Date.parse(String(t.createdAt))),i=6e4;i=r<6e4?5e3:r<36e5?6e4:18e5,this._timeUpdateTimer=setTimeout(n,i)},r=Date.now()-(typeof t.createdAt==`number`?t.createdAt:Date.parse(String(t.createdAt)))<6e4?5e3:6e4;this._timeUpdateTimer=setTimeout(n,r)}stopTimeUpdates(){this._timeUpdateTimer&&=(clearTimeout(this._timeUpdateTimer),null)}setupEffects(){this.addEffect(()=>{this.setAttribute(`data-size`,this.gridStore.commentSize.value)}),this.addEffect(()=>{let e=this.getAttribute(`comment-id`),t=this.authStore.currentUser.value,n=this.gridStore.replyingTo.value,r=this.gridStore.editingCommentId.value,i=this.gridStore.scrollingCommentId.value;this.classList.toggle(`is-signed-in`,t!==null),this.classList.toggle(`is-replying`,e!==null&&n===e),this.classList.toggle(`is-editing`,e!==null&&r===e),this.gridStore.comments.value,this.render(),this.startTimeUpdates(),e&&i===e&&setTimeout(()=>{let t=this.shadowRoot?.querySelector(`#comment-${e}`);t?t.scrollIntoView({behavior:`smooth`,block:`center`}):this.scrollIntoView({behavior:`smooth`,block:`center`}),this.gridStore.scrollingCommentId.value=null},50)})}getTemplate(){let e=this.getAttribute(`comment-id`);if(!e)return``;let t=this.gridStore.comments.value.find(t=>t.id===e);if(!t)return``;let r=t.status===`deleted`,i=t.authorDeleted===!0,a=r||i,o=a?``:t.author?.image?`<img src="${t.author.image}" alt="${t.author.name??`User avatar`}" loading="lazy" />`:n(t.author?.name),s=this.gridStore.replyingTo.value,c=e!==null&&s===e,l=this.size,u=this.authStore.currentUser.value,d=u&&t.author&&u.id===t.author.id,f=u&&!r?`<div class="comment__menu">
|
|
1901
1907
|
<button class="comment__menu-trigger" data-ref="menu-trigger" type="button">
|
|
1902
1908
|
<svg
|
|
1903
1909
|
width="18"
|
|
@@ -2206,7 +2212,7 @@ let e=require("@floating-ui/dom"),t=require("@preact/signals-core");function n(e
|
|
|
2206
2212
|
.grid--align-end {
|
|
2207
2213
|
justify-content: flex-end;
|
|
2208
2214
|
}
|
|
2209
|
-
`),_t=class extends k{constructor(...e){super(...e),this._initialized=!1}get demo(){return this._demo}set demo(e){this._demo=e,this._store?.demo&&this._store.showDemo(e)}get open(){return this._store?.open.value??!1}set open(e){this._store&&(this._store.open.value=e)}get styleSheets(){return[gt]}static get observedAttributes(){return[`data-align`,`data-layout`,`data-position`,`data-icon`,`data-preview-count`]}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`data-key`)??this.getAttribute(`public-key`)??``,t=this.getAttribute(`data-api-url`)??this.getAttribute(`api-url`)??ft,n=this.getAttribute(`data-page-url`)??this.getAttribute(`page-url`)??location.href,r=this.getAttribute(`data-id`),i=this.hasAttribute(`data-demo`);if(this._authStore=new y({apiUrl:t,publicKey:e,demo:i}),le(this,this._authStore),this._store=new W({apiUrl:t,publicKey:e,pageUrl:n,externalId:r,demo:i,authStore:this._authStore}),le(this,this._store),super.connectedCallback(),this._store.setOverrides(this._readOverridesFromAttributes()),this._store.demo){this._demo&&this._store.showDemo(this._demo);return}this._store.load()}_readOverridesFromAttributes(){let e={},t=this.getAttribute(`data-align`);t&&pt.has(t)&&(e.align=t);let n=this.getAttribute(`data-layout`);n&&mt.has(n)&&(e.layout=n);let r=this.getAttribute(`data-position`);r&&ht.has(r)&&(e.position=r);let i=this.getAttribute(`data-icon`);i&&(e.
|
|
2215
|
+
`),_t=class extends k{constructor(...e){super(...e),this._initialized=!1}get demo(){return this._demo}set demo(e){this._demo=e,this._store?.demo&&this._store.showDemo(e)}get open(){return this._store?.open.value??!1}set open(e){this._store&&(this._store.open.value=e)}get styleSheets(){return[gt]}static get observedAttributes(){return[`data-align`,`data-layout`,`data-position`,`data-icon`,`data-preview-count`]}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`data-key`)??this.getAttribute(`public-key`)??``,t=this.getAttribute(`data-api-url`)??this.getAttribute(`api-url`)??ft,n=this.getAttribute(`data-page-url`)??this.getAttribute(`page-url`)??location.href,r=this.getAttribute(`data-id`),i=this.hasAttribute(`data-demo`);if(this._authStore=new y({apiUrl:t,publicKey:e,demo:i}),le(this,this._authStore),this._store=new W({apiUrl:t,publicKey:e,pageUrl:n,externalId:r,demo:i,authStore:this._authStore}),le(this,this._store),super.connectedCallback(),this._store.setOverrides(this._readOverridesFromAttributes()),this._store.demo){this._demo&&this._store.showDemo(this._demo);return}this._store.load()}_readOverridesFromAttributes(){let e={},t=this.getAttribute(`data-align`);t&&pt.has(t)&&(e.align=t);let n=this.getAttribute(`data-layout`);n&&mt.has(n)&&(e.layout=n);let r=this.getAttribute(`data-position`);r&&ht.has(r)&&(e.position=r);let i=this.getAttribute(`data-icon`);i&&(e.iconUrl=i);let a=this.getAttribute(`data-preview-count`);if(a!==null){let t=Number(a);Number.isInteger(t)&&t>0&&(e.previewCount=t)}return e}_applyOverridesFromAttributes(){this._store&&this._store.setOverrides(this._readOverridesFromAttributes())}onDataAlignChanged(){this._applyOverridesFromAttributes()}onDataLayoutChanged(){this._applyOverridesFromAttributes()}onDataPositionChanged(){this._applyOverridesFromAttributes()}onDataIconChanged(){this._applyOverridesFromAttributes()}onDataPreviewCountChanged(){this._applyOverridesFromAttributes()}disconnectedCallback(){this._floatingCleanup?.(),this._store.destroy(),this._authStore.destroy(),ue(this),super.disconnectedCallback()}setupEffects(){this.addEffect(()=>{let e=this._store.grid.value,t=this.getElement(A(`grid`));if(!t)return;let n=Array.from(t.classList).filter(e=>e.startsWith(`grid--`));if(n.length>0&&t.classList.remove(...n),e){e.align&&t.classList.add(`grid--align-${e.align}`),e.appearance&&t.classList.add(`grid--appearance-${e.appearance}`),e.layout&&t.classList.add(`grid--layout-${e.layout}`),e.position&&t.classList.add(`grid--position-${e.position}`);let n=e.previewCount??this._store.previewCount;t.classList.add(`grid--preview-${n}`)}}),this.addEffect(()=>{let e=this._store.open.value;if(this._floatingCleanup&&=(this._floatingCleanup(),void 0),!e)return;let t=this.getElement(`pop-widget`),n=this.getElement(`pop-feed`);if(!t||!n)return;let r=this._store.grid.value;r&&(this._floatingCleanup=dt(t,n,r.position))})}getTemplate(){return`
|
|
2210
2216
|
<div class="grid" data-ref="grid">
|
|
2211
2217
|
<pop-widget></pop-widget>
|
|
2212
2218
|
<pop-feed></pop-feed>
|
|
@@ -2353,7 +2359,7 @@ let e=require("@floating-ui/dom"),t=require("@preact/signals-core");function n(e
|
|
|
2353
2359
|
z-index: 20;
|
|
2354
2360
|
top: 1px;
|
|
2355
2361
|
}
|
|
2356
|
-
`),yt=class extends k{constructor(...e){super(...e),this.events={click:`onClick`}}get styleSheets(){return[vt]}onClick(){this.gridStore.error.value||(this.gridStore.open.value=!this.gridStore.open.value)}setupEffects(){this.addEffect(()=>{this.gridStore.loading.value,this.gridStore.error.value,this.gridStore.previewAvatars.value,this.gridStore.comments.value,this.gridStore.grid.value;let e=!!this.gridStore.error.value;this.toggleAttribute(`data-error`,e),e&&this.gridStore.open.value&&(this.gridStore.open.value=!1),this.render()})}getTemplate(){if(this.gridStore.loading.value)return`<div class="widget"><div class="skeleton mask mask-squircle"></div></div>`;if(this.gridStore.error.value)return`<div class="error-badge">Error: there was a problem loading the PopGrid</div>`;let e=this.gridStore.previewAvatars.value,t=this.gridStore.comments.value.length
|
|
2362
|
+
`),yt=class extends k{constructor(...e){super(...e),this.events={click:`onClick`}}get styleSheets(){return[vt]}onClick(){this.gridStore.error.value||(this.gridStore.open.value=!this.gridStore.open.value)}setupEffects(){this.addEffect(()=>{this.gridStore.loading.value,this.gridStore.error.value,this.gridStore.previewAvatars.value,this.gridStore.comments.value,this.gridStore.grid.value;let e=!!this.gridStore.error.value;this.toggleAttribute(`data-error`,e),e&&this.gridStore.open.value&&(this.gridStore.open.value=!1),this.render(),this.setAttr(`pop-comment-icon`,`icon-url`,this.gridStore.grid.value?.iconUrl??null)})}getTemplate(){if(this.gridStore.loading.value)return`<div class="widget"><div class="skeleton mask mask-squircle"></div></div>`;if(this.gridStore.error.value)return`<div class="error-badge">Error: there was a problem loading the PopGrid</div>`;let e=this.gridStore.previewAvatars.value,t=this.gridStore.comments.value.length;return`
|
|
2357
2363
|
<div class="widget">
|
|
2358
2364
|
${e.map((t,r)=>{let i=e.length+r,a=t?.id??t?.name??``;return t?.image?`<pop-comment-avatar size="xs" style="z-index: ${i}" data-color-key="${a}">
|
|
2359
2365
|
<img src="${t.image}" alt="${t.name??`User`}" />
|
|
@@ -2368,7 +2374,7 @@ let e=require("@floating-ui/dom"),t=require("@preact/signals-core");function n(e
|
|
|
2368
2374
|
</div>
|
|
2369
2375
|
</span>
|
|
2370
2376
|
</div>
|
|
2371
|
-
<pop-comment-icon variant="add" theme="
|
|
2377
|
+
<pop-comment-icon variant="add" theme="neutral" size="xs"></pop-comment-icon>
|
|
2372
2378
|
</div>
|
|
2373
2379
|
`}};if(j([x(W)],yt.prototype,`gridStore`,void 0),customElements.get(`pop-widget`)||customElements.define(`pop-widget`,yt),typeof document<`u`){let e=`https://rsms.me/inter/inter.css`;if(!document.querySelector(`link[href="${e}"]`)){let t=document.createElement(`link`);t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)}}
|
|
2374
2380
|
//# sourceMappingURL=index.cjs.map
|