@popgrids/embed 0.0.7 → 0.0.9
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 +9 -3
- 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 +18 -7
- package/dist/embed.js.map +1 -1
- package/dist/index.cjs +14 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -7
- 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}"
|
|
@@ -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
|