@popgrids/embed 0.0.1 → 0.0.3
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 +141 -0
- package/LICENSE +21 -0
- package/README.md +60 -1
- package/dist/components/base-element.d.ts +33 -0
- package/dist/components/base-element.d.ts.map +1 -0
- package/dist/components/pop-auth-panel.d.ts +14 -0
- package/dist/components/pop-auth-panel.d.ts.map +1 -0
- package/dist/components/pop-comment-avatar.d.ts +16 -0
- package/dist/components/pop-comment-avatar.d.ts.map +1 -0
- package/dist/components/pop-comment-bar.d.ts +14 -0
- package/dist/components/pop-comment-bar.d.ts.map +1 -0
- package/dist/components/pop-comment-icon.d.ts +33 -0
- package/dist/components/pop-comment-icon.d.ts.map +1 -0
- package/dist/components/pop-comment-input.d.ts +19 -0
- package/dist/components/pop-comment-input.d.ts.map +1 -0
- package/dist/components/pop-comment-thread.d.ts +14 -0
- package/dist/components/pop-comment-thread.d.ts.map +1 -0
- package/dist/components/pop-comment.d.ts +32 -0
- package/dist/components/pop-comment.d.ts.map +1 -0
- package/dist/components/pop-feed.d.ts +17 -0
- package/dist/components/pop-feed.d.ts.map +1 -0
- package/dist/components/pop-grid.d.ts +12 -0
- package/dist/components/pop-grid.d.ts.map +1 -0
- package/dist/components/pop-widget.d.ts +13 -0
- package/dist/components/pop-widget.d.ts.map +1 -0
- package/dist/embed.js +2240 -0
- package/dist/embed.js.map +1 -0
- package/dist/helpers/author.d.ts +2 -0
- package/dist/helpers/author.d.ts.map +1 -0
- package/dist/helpers/color.d.ts +7 -0
- package/dist/helpers/color.d.ts.map +1 -0
- package/dist/helpers/theme.d.ts +3 -0
- package/dist/helpers/theme.d.ts.map +1 -0
- package/dist/helpers/time.d.ts +2 -0
- package/dist/helpers/time.d.ts.map +1 -0
- package/dist/index.cjs +1135 -741
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -989
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1246 -1045
- package/dist/index.js.map +1 -1
- package/dist/lib/popup-auth.d.ts +22 -0
- package/dist/lib/popup-auth.d.ts.map +1 -0
- package/dist/store/auth-store.d.ts +8 -0
- package/dist/store/auth-store.d.ts.map +1 -0
- package/dist/store/grid-store.d.ts +45 -0
- package/dist/store/grid-store.d.ts.map +1 -0
- package/dist/store/registry.d.ts +5 -0
- package/dist/store/registry.d.ts.map +1 -0
- package/dist/types/models.d.ts +47 -0
- package/dist/types/models.d.ts.map +1 -0
- package/package.json +55 -45
- package/dist/apple-IX52EWYN.png +0 -0
- package/dist/google-Q3MFTU5A.png +0 -0
- package/dist/index.d.cts +0 -989
- package/dist/swirling-ovals-ZDTHSA3L.gif +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,743 +1,876 @@
|
|
|
1
|
-
"use strict";var di=Object.create;var Z=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var pi=Object.getOwnPropertyNames;var gt=Object.getPrototypeOf,ci=Object.prototype.hasOwnProperty;var mi=Reflect.get;var ui=(n,a)=>{for(var t in a)Z(n,t,{get:a[t],enumerable:!0})},xt=(n,a,t,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of pi(a))!ci.call(n,r)&&r!==t&&Z(n,r,{get:()=>a[r],enumerable:!(e=ht(a,r))||e.enumerable});return n};var Q=(n,a,t)=>(t=n!=null?di(gt(n)):{},xt(a||!n||!n.__esModule?Z(t,"default",{value:n,enumerable:!0}):t,n)),fi=n=>xt(Z({},"__esModule",{value:!0}),n),i=(n,a,t,e)=>{for(var r=e>1?void 0:e?ht(a,t):a,s=n.length-1,o;s>=0;s--)(o=n[s])&&(r=(e?o(a,t,r):o(r))||r);return e&&r&&Z(a,t,r),r};var l=(n,a,t)=>mi(gt(n),t,a);var Di={};ui(Di,{PopApiProvider:()=>li,PopAuthJoin:()=>kt,PopAuthPanel:()=>Vt,PopAuthProvider:()=>zt,PopAuthSignIn:()=>Zt,PopAuthVerifyCode:()=>Ot,PopComment:()=>He,PopCommentBar:()=>se,PopCommentInput:()=>ve,PopCommentThread:()=>je,PopFeed:()=>Re,PopGrid:()=>Ge,PopGridProvider:()=>Ne,PopWidget:()=>ai});module.exports=fi(Di);var bt=require("@popgrids/ui"),Ct=require("lit"),wt=require("lit/decorators.js"),St=require("lit/directives/class-map.js");var X=require("lit");var vt="./swirling-ovals-ZDTHSA3L.gif";var yt=X.css`
|
|
1
|
+
let e=require("@preact/signals-core"),t=require("@floating-ui/dom");var n=`/embed/auth/login`,r=`popgrids-auth`,i=`popup,width=480,height=640`,a=300*1e3,o=250,s=class extends Error{constructor(e){super(e),this.name=`PopupAuthError`}},c=(e,t,r)=>{let i=new URL(n,e);return i.searchParams.set(`publicKey`,t),i.searchParams.set(`returnOrigin`,r),i.toString()},l=(e,t)=>{let n=window.open(c(e,t,window.location.origin),r,i);if(!n)throw new s(`Popup blocked. Allow popups for this site and try again.`);return n},u=(e,t)=>typeof e==`object`&&!!e&&`type`in e&&`source`in e&&e.type===t&&e.source===`popgrids-embed`,ee=e=>{if(typeof e!=`object`||!e||!(`user`in e))return null;let t=e.user;if(typeof t!=`object`||!t||!(`id`in t))return null;let n=t;return typeof n.id==`string`?{id:n.id,name:typeof n.name==`string`?n.name:``,email:typeof n.email==`string`?n.email:``,image:typeof n.image==`string`?n.image:null}:null},d=(e,t,n)=>new Promise((r,i)=>{let c=new URL(e).origin,l=!1,d=!1,f=!1,p=(e,t)=>{if(!l){if(l=!0,_(),e===`resolve`){r();return}i(t??new s(`Sign-in failed`))}},m=e=>{if(e.origin===c){if(u(e.data,`popgrids:auth:success`)){d=!0;let t=ee(e.data);t&&n?.onAuthUser?.(t),p(`resolve`);return}u(e.data,`popgrids:auth:error`)&&(d=!0,p(`reject`,new s(typeof e.data==`object`&&e.data!==null&&`error`in e.data&&typeof e.data.error==`string`?e.data.error:`Sign-in failed`)))}},h=window.setInterval(()=>{t.closed&&(f||(f=!0,(async()=>{if(await new Promise(e=>window.setTimeout(e,o)),!(d||l)){if(n?.verifySignedIn&&await n.verifySignedIn()){p(`resolve`);return}p(`reject`,new s(`Sign-in was cancelled`))}})()))},300),g=window.setTimeout(()=>{try{t.close()}catch{}p(`reject`,new s(`Sign-in timed out`))},a),_=()=>{window.removeEventListener(`message`,m),clearInterval(h),clearTimeout(g)};window.addEventListener(`message`,m)}),f=async(e,t,n)=>{await d(e,l(e,t),n)},p=(0,e.signal)(null),m=(0,e.signal)(null),h=(0,e.signal)(!1),g=[0,150,400],_=[0,100,200,400,800,1500,2500,4e3];async function v(e,t,n=g){if(!e||!t)return p.value=null,!1;let r=new URL(`/api/v1/embed/grids/${t}/session`,e);r.searchParams.set(`pageUrl`,window.location.href);for(let e=0;e<n.length;e++){let t=n[e]??0;t>0&&await new Promise(e=>window.setTimeout(e,t));try{let e=await fetch(r,{credentials:`include`});if(!e.ok)continue;if(p.value=(await e.json()).user??null,p.value!==null)return!0}catch{}}return p.value=null,!1}async function y(e,t){m.value=null,h.value=!0;try{return await f(e,t,{onAuthUser:e=>{p.value=e},verifySignedIn:()=>v(e,t,_)}),p.value?!0:await v(e,t,_)}catch(e){return m.value=e instanceof Error?e.message:`Sign-in failed`,!1}finally{h.value=!1}}function te(){m.value=null}var b=new WeakMap,x=(e,t,n=t.constructor)=>{let r=b.get(e);r||(r=new Map,b.set(e,r)),r.set(n,t)},ne=e=>{b.delete(e)},re=(e,t)=>{let n=e;for(;n;){let e=b.get(n)?.get(t);if(e)return e;let r=n.getRootNode();if(!(r instanceof ShadowRoot))break;n=r.host}return null};function S(e){return function(t,n){let r=Symbol(`context_`+(e.name||`store`));Object.defineProperty(t,n,{get(){if(this[r])return this[r];let t=re(this,e);if(!t)throw console.error(`[Context] resolveStore failed! isConnected: ${this.isConnected}`,this),Error(`[Context] Store for key "${e.name||e}" not resolved on <${this.localName}>.`);return this[r]=t,t},enumerable:!0,configurable:!0})}}var ie=3e4,C=3,w=e=>{let t=typeof e.createdAt==`number`?e.createdAt:Date.parse(String(e.createdAt));return Number.isFinite(t)?t:0},T=(e,t)=>{let n=e?.previewCount??t;return n>0?n:C},E=class{constructor(t){this.previewCount=C,this.grid=(0,e.signal)(null),this.comments=(0,e.signal)([]),this.loading=(0,e.signal)(!0),this.error=(0,e.signal)(null),this.open=(0,e.signal)(!1),this.replyingTo=(0,e.signal)(null),this.editingCommentId=(0,e.signal)(null),this.scrollingCommentId=(0,e.signal)(null),this.socket=null,this.reconnectAttempt=0,this.reconnectTimer=null,this.disposed=!1,this.topLevelComments=(0,e.computed)(()=>this.comments.value.filter(e=>e.parentCommentId===null).sort((e,t)=>String(e.sortKey).localeCompare(String(t.sortKey)))),this.replyingToComment=(0,e.computed)(()=>{let e=this.replyingTo.value;return e?this.comments.value.find(t=>t.id===e)??null:null}),this.editingComment=(0,e.computed)(()=>{let e=this.editingCommentId.value;return e?this.comments.value.find(t=>t.id===e)??null:null}),this.previewComments=(0,e.computed)(()=>this.topLevelComments.value.slice(0,T(this.grid.value,this.previewCount))),this.previewAvatars=(0,e.computed)(()=>{let e=T(this.grid.value,this.previewCount),t=new Set,n=[],r=[...this.comments.value].sort((e,t)=>w(t)-w(e));for(let i of r){let r=i.author;if(!(!r?.id||t.has(r.id))&&(t.add(r.id),n.push(r),n.length>=e))break}return n.reverse()}),this.apiUrl=t.apiUrl,this.publicKey=t.publicKey,this.pageUrl=t.pageUrl,this.externalId=t.externalId?.trim()||null}identityParams(){let e=new URLSearchParams({pageUrl:this.pageUrl});return this.externalId&&e.set(`externalId`,this.externalId),e.toString()}repliesFor(e){let t=this.comments.value.find(t=>t.id===e);return t?this.comments.value.filter(n=>n.id!==e&&(n.sortKey===t.sortKey||n.sortKey.startsWith(t.sortKey+`/`))).sort((e,t)=>String(e.sortKey).localeCompare(String(t.sortKey))):[]}async load(){this.loading.value=!0,this.error.value=null;try{let e=await fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}`,{credentials:`include`});if(!e.ok)return this.error.value=`There was a problem loading the PopGrid`,!1;let t=await e.json();this.grid.value=t.grid,this.connectRealtime();let n=await fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}/comments?${this.identityParams()}`,{credentials:`include`});if(n.ok){let e=await n.json();this.comments.value=e.comments}return!0}catch{return console.error(`Failed to load PopGrid`),this.error.value=`There was a problem loading the PopGrid`,!1}finally{this.loading.value=!1}}async postComment(e,t){let n=async()=>fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}/comments`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:e,pageUrl:this.pageUrl,externalId:this.externalId??void 0,parentCommentId:t})}),r=await n();if(r.status===401){if(!await y(this.apiUrl,this.publicKey))return null;r=await n()}if(!r.ok)return null;let i=await r.json();return this.upsertComment(i.comment),i.comment.author&&!p.value&&(p.value={id:i.comment.author.id,name:i.comment.author.name??``,email:``,image:i.comment.author.image}),i.comment}destroy(){this.disposed=!0,this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.socket&&=(this.socket.onopen=null,this.socket.onmessage=null,this.socket.onclose=null,this.socket.onerror=null,this.socket.close(),null)}connectRealtime(){let e=this.grid.value?.connectUrl;if(!e||this.disposed)return;this.socket&&=(this.socket.onopen=null,this.socket.onmessage=null,this.socket.onclose=null,this.socket.onerror=null,this.socket.close(),null);let t=new URL(e,this.apiUrl);t.protocol=t.protocol===`https:`?`wss:`:`ws:`,t.searchParams.set(`pageUrl`,this.pageUrl),this.externalId&&t.searchParams.set(`externalId`,this.externalId);let n=new WebSocket(t.toString());this.socket=n,n.onopen=()=>{this.reconnectAttempt=0},n.onmessage=e=>{try{let t=JSON.parse(String(e.data));t.type===`comment.created`&&t.comment?this.upsertComment(t.comment):t.type===`comment.updated`&&t.comment&&this.updateCommentInList(t.comment)}catch{}},n.onclose=()=>{this.disposed||this.scheduleReconnect()},n.onerror=()=>{n.close()}}scheduleReconnect(){if(this.disposed||this.reconnectTimer)return;let e=Math.min(1e3*2**this.reconnectAttempt,ie);this.reconnectAttempt+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connectRealtime()},e)}upsertComment(e){this.comments.value.some(t=>t.id===e.id)||(this.comments.value=[...this.comments.value,e])}async editComment(e,t){let n=async()=>fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}/comments/${e}`,{method:`PATCH`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({body:t,pageUrl:this.pageUrl,externalId:this.externalId??void 0})}),r=await n();if(r.status===401){if(!await y(this.apiUrl,this.publicKey))return null;r=await n()}if(!r.ok)return null;let i=await r.json();return this.updateCommentInList(i.comment),i.comment}async deleteComment(e){let t=async()=>fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}/comments/${e}?${this.identityParams()}`,{method:`DELETE`,credentials:`include`}),n=await t();if(n.status===401){if(!await y(this.apiUrl,this.publicKey))return null;n=await t()}if(!n.ok)return null;let r=await n.json();return this.updateCommentInList(r.comment),r.comment}async flagComment(e){let t=async()=>fetch(`${this.apiUrl}/api/v1/embed/grids/${this.publicKey}/comments/${e}/flag?${this.identityParams()}`,{method:`POST`,credentials:`include`}),n=await t();if(n.status===401){if(!await y(this.apiUrl,this.publicKey))return!1;n=await t()}return n.ok}updateCommentInList(e){this.comments.value=this.comments.value.map(t=>t.id===e.id?e:t)}},ae=`@layer base{:host{box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--pop-color-brand-midnight-100:oklch(96.58% .0161 262.75);--pop-color-brand-midnight-900:oklch(15% .03 255.43);--pop-color-brand-midnight-800:oklch(19% .05 255.43);--pop-color-brand-ocean-400:oklch(63% .19 255.43);--pop-color-brand-ocean-100:oklch(91% .05 255.43);--pop-color-brand-forest-900:oklch(38.66% .0698 180.75);--pop-color-brand-forest-700:oklch(45% .15 165.43);--pop-color-brand-forest-100:oklch(97% .04 165.43);--pop-color-brand-highlight-400:oklch(88% .25 105.43);--pop-color-brand-pumpkin-500:oklch(62% .18 45.43);--pop-color-brand-pumpkin-200:oklch(89% .08 45.43);--pop-color-brand-lemon-300:oklch(91% .12 85.43);--pop-color-brand-lemon-100:oklch(97% .04 85.43);--pop-duration-bouncy:1s;--pop-duration-card-highlight:.6s;--pop-duration-gentle:.833s;--pop-duration-menu:.4s;--pop-duration-pop-hover:.6s;--pop-duration-pop-text:.3s;--pop-duration-quick:.833s;--pop-duration-slow:1.167s;--pop-ease-bouncy:linear(0, .011, .045 1.3%, .184 2.7%, .911 7.4%, 1.153 9.4%, 1.301 11.2%, 1.342, 1.362 13%, 1.363, 1.355 14.4%, 1.306 16%, 1.028 21%, .939 23%, .89 24.7%, .876, .868 26.4%, .869, .882 29%, .907 30.5%, 1.014 35.9%, 1.038, 1.048 39.8% 41.1%, 1.043 42.5%, .995 49.3%, .987, .983 53.2%, .984 55.9%, 1.002 62.7%, 1.006 66.4%, .998 79.7%, 1);--pop-ease-card-highlight:linear(0, .008, .031 1.8%, .127 3.9%, .671 11.8%, .881 15.5%, .959, 1.02 19.2%, 1.064, 1.093 23.2%, 1.102, 1.108, 1.108, 1.104 28.7%, 1.089 31.4%, 1.038 38.1%, 1.016 41.5%, .999 45.4%, .99 49.6%, .989 55.3%, 1.001 74.9%, 1);--pop-ease-gentle:linear(0, .007, .026, .059 4.5%, .106 6.3%, .209 9.5%, .558 19.3%, .658, .742, .812, .87, .918, .957, .986 41.6%, 1.007 45.3%, 1.021 49.4%, 1.027 54% 60.9%, 1.007 83.2%, 1);--pop-ease-menu:linear(0, .0034 0.81%, .0278 2.42%, .097 4.84%, .5361 15.32%, .655 18.55%, .7314, .7964 23.39%, .8662, .9185, .9561, .9818, .9984, 1.0083 42.74%, 1.014 46.77%, 1.0145 53.22%, 1.0053 68.55%, 1.0019 77.42%, .9998 100%);--pop-ease-pop-hover:linear(0, .008, .031 1.8%, .127 3.9%, .671 11.8%, .881 15.5%, .959, 1.02 19.2%, 1.064, 1.093 23.2%, 1.102, 1.108, 1.108, 1.104 28.7%, 1.089 31.4%, 1.038 38.1%, 1.016 41.5%, .999 45.4%, .99 49.6%, .989 55.3%, 1.001 74.9%, 1);--pop-ease-pop-text:linear(0, .0051 0.99%, .0261, .0607 3.61%, .1192 5.26%, .2531 8.21%, .6509 16.1%, .7652 18.73%, .8512, .9232 23.33%, .9881 25.96%, 1.0305 28.26%, 1.0642 30.88%, 1.0782 32.53%, 1.089, 1.094 36.47%, 1.0942, 1.0896 41.07%, 1.0804 43.7%, 1.0354 53.23%, 1.0181 57.5%, 1.0061 61.44%, .9974 65.71%, .9925 70.31%, .991 75.9%, .9996 99.88%);--pop-ease-quick:linear(0, .008, .031 1.8%, .127 3.9%, .671 11.8%, .881 15.5%, .959, 1.02 19.2%, 1.064, 1.093 23.2%, 1.102, 1.108, 1.108, 1.104 28.7%, 1.089 31.4%, 1.038 38.1%, 1.016 41.5%, .999 45.4%, .99 49.6%, .989 55.3%, 1.001 74.9%, 1);--pop-ease-slow:linear(0, .005, .02 2%, .081 4.5%, .469 15.2%, .567, .65, .722 24.4%, .784, .835 31.1%, .878 34.9%, .914 39.1%, .942 43.8%, .964 49.1%, .979 55.4%, .989 62.4%, .995 71.1%, 1);--pop-shadow-xs:0px 1px 2px 0px #1018280d;--pop-shadow-sm:0px 1px 3px 0px #1018281a, 0px 1px 2px 0px #1018280f;--pop-shadow-md:0px 4px 8px -2px #1018281a, 0px 2px 4px -2px #1018280f;--pop-shadow-lg:0px 12px 16px -4px #10182814, 0px 4px 6px -2px #10182808;--pop-shadow-xl:0px 20px 24px -4px #10182814, 0px 8px 8px -4px #10182808;--pop-shadow-2xl:0px 24px 48px -12px #1018282e;--pop-shadow-3xl:0px 32px 48px -12px #10182852;--pop-shadow-4xl:0px 24px 32px -12px #10182847;--pop-radius-none:0;--pop-radius-xxs:.125rem;--pop-radius-xs:.25rem;--pop-radius-sm:.375rem;--pop-radius-md:.5rem;--pop-radius-lg:.625rem;--pop-radius-xl:.75rem;--pop-radius-2xl:1rem;--pop-radius-3xl:1.25rem;--pop-radius-4xl:1.5rem;--pop-radius-full:9999px;--pop-radius:.625rem;--pop-background:oklch(100% 0 0);--pop-foreground:oklch(0% 0 0);--pop-card:oklch(100% 0 0);--pop-card-foreground:oklch(14.5% 0 0);--pop-popover:oklch(100% 0 0);--pop-popover-foreground:oklch(0% 0 0);--pop-primary:oklch(20.5% 0 0);--pop-primary-foreground:oklch(98.5% 0 0);--pop-secondary:oklch(97% 0 0);--pop-secondary-foreground:oklch(20.5% 0 0);--pop-muted:oklch(97% 0 0);--pop-muted-foreground:oklch(71.52% .0233 256.76);--pop-accent:oklch(97% 0 0);--pop-accent-foreground:oklch(20.5% 0 0);--pop-destructive:var(--color-error-600);--pop-border:oklch(11.01% .0763 264.05/.102);--pop-input:oklch(92.2% 0 0);--pop-ring:oklch(62.3% .214 259.815);--pop-chart-1:oklch(64.6% .222 41.116);--pop-chart-2:oklch(60% .118 184.704);--pop-chart-3:oklch(39.8% .07 227.392);--pop-chart-4:oklch(82.8% .189 84.429);--pop-chart-5:oklch(76.9% .188 70.08);--pop-sidebar:oklch(98.5% 0 0);--pop-sidebar-foreground:oklch(14.5% 0 0);--pop-sidebar-primary:oklch(20.5% 0 0);--pop-sidebar-primary-foreground:oklch(98.5% 0 0);--pop-sidebar-accent:oklch(97% 0 0);--pop-sidebar-accent-foreground:oklch(20.5% 0 0);--pop-sidebar-border:oklch(92.2% 0 0);--pop-sidebar-ring:oklch(70.8% 0 0);font-family:Inter,sans-serif;font-size:16px}@media (prefers-color-scheme:dark){:host{--pop-background:oklch(15% .03 255.43);--pop-foreground:oklch(66% .006 255.43);--pop-card:oklch(20.5% 0 0);--pop-card-foreground:oklch(98.5% 0 0);--pop-popover:oklch(15% .03 255.43);--pop-popover-foreground:oklch(66% .006 255.43);--pop-primary:oklch(92.2% 0 0);--pop-primary-foreground:oklch(20.5% 0 0);--pop-secondary:oklch(26.9% 0 0);--pop-secondary-foreground:oklch(98.5% 0 0);--pop-muted:oklch(26.9% 0 0);--pop-muted-foreground:oklch(66% .006 255.43);--pop-accent:oklch(26.9% 0 0);--pop-accent-foreground:oklch(98.5% 0 0);--pop-destructive:var(--color-error-400);--pop-border:oklch(100% 0 0/.1);--pop-input:oklch(100% 0 0/.15);--pop-ring:oklch(62.3% .214 259.815);--pop-chart-1:oklch(48.8% .243 264.376);--pop-chart-2:oklch(69.6% .17 162.48);--pop-chart-3:oklch(76.9% .188 70.08);--pop-chart-4:oklch(62.7% .265 303.9);--pop-chart-5:oklch(64.5% .246 16.439);--pop-sidebar:oklch(20.5% 0 0);--pop-sidebar-foreground:oklch(98.5% 0 0);--pop-sidebar-primary:oklch(48.8% .243 264.376);--pop-sidebar-primary-foreground:oklch(98.5% 0 0);--pop-sidebar-accent:oklch(26.9% 0 0);--pop-sidebar-accent-foreground:oklch(98.5% 0 0);--pop-sidebar-border:oklch(100% 0 0/.1);--pop-sidebar-ring:oklch(55.6% 0 0)}}:host(.dark){--pop-background:oklch(15% .03 255.43);--pop-foreground:oklch(66% .006 255.43);--pop-card:oklch(20.5% 0 0);--pop-card-foreground:oklch(98.5% 0 0);--pop-popover:oklch(15% .03 255.43);--pop-popover-foreground:oklch(66% .006 255.43);--pop-primary:oklch(92.2% 0 0);--pop-primary-foreground:oklch(20.5% 0 0);--pop-secondary:oklch(26.9% 0 0);--pop-secondary-foreground:oklch(98.5% 0 0);--pop-muted:oklch(26.9% 0 0);--pop-muted-foreground:oklch(66% .006 255.43);--pop-accent:oklch(26.9% 0 0);--pop-accent-foreground:oklch(98.5% 0 0);--pop-destructive:var(--color-error-400);--pop-border:oklch(100% 0 0/.1);--pop-input:oklch(100% 0 0/.15);--pop-ring:oklch(62.3% .214 259.815);--pop-chart-1:oklch(48.8% .243 264.376);--pop-chart-2:oklch(69.6% .17 162.48);--pop-chart-3:oklch(76.9% .188 70.08);--pop-chart-4:oklch(62.7% .265 303.9);--pop-chart-5:oklch(64.5% .246 16.439);--pop-sidebar:oklch(20.5% 0 0);--pop-sidebar-foreground:oklch(98.5% 0 0);--pop-sidebar-primary:oklch(48.8% .243 264.376);--pop-sidebar-primary-foreground:oklch(98.5% 0 0);--pop-sidebar-accent:oklch(26.9% 0 0);--pop-sidebar-accent-foreground:oklch(98.5% 0 0);--pop-sidebar-border:oklch(100% 0 0/.1);--pop-sidebar-ring:oklch(55.6% 0 0)}*,:before,:after{box-sizing:inherit}html,body{margin:0;padding:0}svg{display:block}p{margin:0;padding:0}button{cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;margin:0;padding:0;display:flex}}`,oe=`@layer components{.btn{text-align:center;cursor:pointer;border:0;border-radius:4px;justify-content:center;align-items:center;gap:.625rem;height:auto;padding:.625rem 1.25rem;transition:background-color .2s,color .2s;display:flex}.btn-link{border-radius:var(--pop-radius-xs,4px);cursor:pointer;background-color:#0000;border-style:solid;border-color:#0000;justify-content:center;align-items:center;gap:2px;font-weight:500;text-decoration:none;transition:background-color .2s,border-color .2s,color .2s;display:inline-flex}.btn-link--size-sm{letter-spacing:-.08px;border-width:1px 2px;font-size:13px;line-height:18px}.btn-link--size-md{letter-spacing:0;border-width:1px 3px;font-size:14px;line-height:20px}.btn-link--size-lg{letter-spacing:0;border-width:1px 4px;font-size:16px;line-height:24px}.btn-link--theme-default{color:color-mix(in srgb, var(--pop-foreground) 50%, transparent)}.btn-link--theme-default.btn-link--primary{color:var(--pop-foreground)}.btn-link--theme-white{color:#fff}.btn-link--theme-black{color:#000}.btn-link--theme-default:hover,.btn-link--theme-black:hover{background-color:color-mix(in srgb, var(--pop-foreground) 10%, transparent);border-color:color-mix(in srgb, var(--pop-foreground) 10%, transparent)}.btn-link--theme-default:not(.btn-link--primary):hover{color:var(--pop-foreground)}.btn-link--theme-white:hover{background-color:#ffffff29;border-color:#ffffff29}.btn-link:active{background-color:#0000;border-color:#0000}.btn-link--theme-default:not(.btn-link--primary):active{color:color-mix(in srgb, var(--pop-foreground) 50%, transparent)}.btn-link:focus-visible{background-color:var(--pop-ring,#155eef);border-color:var(--pop-ring,#155eef);outline:none;color:#fff!important}.btn-link:disabled,.btn-link.is-disabled{cursor:not-allowed;pointer-events:none;color:color-mix(in srgb, var(--pop-foreground) 35%, transparent)!important;background-color:#0000!important;border-color:#0000!important}.btn:focus-visible{outline-offset:2px;outline:2px solid}}`,se=`@layer components{.mask{-webkit-mask-position:50%;mask-position:50%;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.mask-squircle{-webkit-mask-image:url("data:image/svg+xml,%3csvg width='160' height='160' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M 0 80 C 0 14.12 14.12 0 80 0 C 145.88 0 160 14.12 160 80 C 160 145.88 145.88 160 80 160 C 14.12 160 0 145.88 0 80 Z'/%3e%3c/svg%3e");mask-image:url("data:image/svg+xml,%3csvg width='160' height='160' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M 0 80 C 0 14.12 14.12 0 80 0 C 145.88 0 160 14.12 160 80 C 160 145.88 145.88 160 80 160 C 14.12 160 0 145.88 0 80 Z'/%3e%3c/svg%3e")}}`,D=!1,O=new Set,k=null,A=null;function j(){if(typeof window>`u`||typeof document>`u`)return!1;let e=document.documentElement.classList.contains(`dark`)||document.body.classList.contains(`dark`),t=document.documentElement.classList.contains(`light`)||document.body.classList.contains(`light`);return e?!0:t?!1:(A||=window.matchMedia(`(prefers-color-scheme: dark)`),A.matches)}function M(){let e=j();e!==D&&(D=e,O.forEach(e=>{let t=D||!!e.closest(`.dark`);e.classList.toggle(`dark`,t)}))}var N=()=>{M()};function ce(e){if(typeof window>`u`||typeof document>`u`)return;O.size===0&&(D=j(),k=new MutationObserver(()=>{M()}),k.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),k.observe(document.body,{attributes:!0,attributeFilter:[`class`]}),A=window.matchMedia(`(prefers-color-scheme: dark)`),A.addEventListener(`change`,N)),O.add(e);let t=D||!!e.closest(`.dark`);e.classList.toggle(`dark`,t)}function le(e){O.delete(e),O.size===0&&(k&&=(k.disconnect(),null),A&&=(A.removeEventListener(`change`,N),null))}function P(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var ue=P(ae),de=P(oe),fe=P(se),F=class extends HTMLElement{get styleSheets(){return[]}constructor(){super(),this.baseStyleSheets=[ue,de,fe],this._hasRendered=!1,this._disposables=[],this.events={},this.attachShadow({mode:`open`}),this.shadowRoot&&(this.shadowRoot.adoptedStyleSheets=this.styles)}attributeChangedCallback(e,t,n){if(t===n)return;let r=`on${e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}Changed`;typeof this[r]==`function`&&this[r](n,t)}addEffect(t){this._disposables.push((0,e.effect)(t))}connectedCallback(){ce(this),(0,e.untracked)(()=>{this.render(),this._bindEvents(),this.setupEffects()})}disconnectedCallback(){le(this),this._disposables.forEach(e=>e()),this._disposables=[]}_bindEvents(){let e=this.shadowRoot;e&&Object.keys(this.events).forEach(t=>{e.addEventListener(t,this)})}handleEvent(e){let t=this.events[e.type];t&&typeof this[t]==`function`&&this[t](e)}emit(e,t={}){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,...t}))}get styles(){return[...this.baseStyleSheets,...this.styleSheets]}setupEffects(){}render(){this.shadowRoot&&(this.shadowRoot.innerHTML=this.getTemplate(),this._hasRendered=!0)}hideElement(e,t,n=!0){if(!this.shadowRoot||!this._hasRendered)return;let r=this.shadowRoot.querySelector(e);if(!r){console.warn(`Element not found for selector: ${e}`);return}n?r.classList.toggle(`hidden`,t):r.classList.toggle(`invisible`,t)}setText(e,t){let n=this.shadowRoot?.querySelector(e);n&&n.textContent!==String(t)&&(n.textContent=String(t))}setAttr(e,t,n){let r=this.shadowRoot?.querySelector(e);r&&(n===null?r.removeAttribute(t):r.getAttribute(t)!==n&&r.setAttribute(t,n))}toggleClass(e,t,n){let r=this.shadowRoot?.querySelector(e);r&&r.classList.toggle(t,n)}getElement(e){return this.shadowRoot?.querySelector(e)??null}};function I(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var pe=P(`
|
|
2
2
|
:host {
|
|
3
|
-
display:
|
|
4
|
-
|
|
3
|
+
display: block;
|
|
4
|
+
position: relative;
|
|
5
|
+
|
|
6
|
+
--pop-auth-border: var(--pop-border, rgba(0, 0, 32, 0.04));
|
|
7
|
+
--pop-auth-watermark: rgba(0, 0, 32, 0.4);
|
|
8
|
+
--pop-auth-btn: #000000;
|
|
9
|
+
--pop-auth-logo: rgba(0, 0, 32, 0.35);
|
|
10
|
+
--pop-auth-error: #dc2626;
|
|
5
11
|
}
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
background-color: var(--color-surface-bg-default, #fff);
|
|
16
|
-
border: none;
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: flex-start;
|
|
19
|
-
flex-direction: column;
|
|
20
|
-
gap: var(--spacing-sm, 6px);
|
|
21
|
-
justify-content: flex-end;
|
|
22
|
-
padding: var(--spacing-xl, 16px) var(--spacing-md, 8px);
|
|
23
|
-
width: 100%;
|
|
13
|
+
@media (prefers-color-scheme: dark) {
|
|
14
|
+
:host {
|
|
15
|
+
--pop-auth-border: var(--pop-border, rgba(255, 255, 255, 0.1));
|
|
16
|
+
--pop-auth-watermark: rgba(255, 255, 255, 0.4);
|
|
17
|
+
--pop-auth-btn: #ffffff;
|
|
18
|
+
--pop-auth-logo: rgba(255, 255, 255, 0.35);
|
|
19
|
+
--pop-auth-error: var(--pop-destructive, #f87171);
|
|
20
|
+
}
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
:host(.dark) {
|
|
24
|
+
--pop-auth-border: var(--pop-border, rgba(255, 255, 255, 0.1));
|
|
25
|
+
--pop-auth-watermark: rgba(255, 255, 255, 0.4);
|
|
26
|
+
--pop-auth-btn: #ffffff;
|
|
27
|
+
--pop-auth-logo: rgba(255, 255, 255, 0.35);
|
|
28
|
+
--pop-auth-error: var(--pop-destructive, #f87171);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.panel {
|
|
32
|
+
position: relative;
|
|
33
|
+
border-top: 1px solid var(--pop-auth-border);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.watermark {
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: -16px;
|
|
39
|
+
left: 8px;
|
|
40
|
+
font-family: Inter, sans-serif;
|
|
41
|
+
font-size: 8px;
|
|
42
|
+
font-weight: 700;
|
|
43
|
+
letter-spacing: 1px;
|
|
44
|
+
color: var(--pop-auth-watermark);
|
|
45
|
+
text-transform: uppercase;
|
|
46
|
+
backdrop-filter: blur(4px);
|
|
47
|
+
border-radius: 9999px;
|
|
48
|
+
padding: 2px 6px;
|
|
49
|
+
pointer-events: none;
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
.
|
|
52
|
+
.actions {
|
|
43
53
|
display: flex;
|
|
44
|
-
width: 75px;
|
|
45
|
-
height: 12px;
|
|
46
|
-
padding: 0px var(--spacing-none, 0px);
|
|
47
|
-
flex-direction: column;
|
|
48
|
-
justify-content: center;
|
|
49
54
|
align-items: center;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
`;var _=class extends bt.PopElement{handleClick(){this.emit("pop-click")}render(){return Ct.html` <button
|
|
53
|
-
class=${(0,St.classMap)({"auth-join":!0})}
|
|
54
|
-
part="base"
|
|
55
|
-
type="button"
|
|
56
|
-
@click=${this.handleClick}
|
|
57
|
-
>
|
|
58
|
-
<div class="auth-join__actions">
|
|
59
|
-
Join the Conversation
|
|
60
|
-
<svg
|
|
61
|
-
class="auth-join__logo"
|
|
62
|
-
width="75"
|
|
63
|
-
height="12"
|
|
64
|
-
viewBox="0 0 75 12"
|
|
65
|
-
fill="none"
|
|
66
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
67
|
-
>
|
|
68
|
-
<path
|
|
69
|
-
d="M4.58333 0.265686C1.0463 0.265686 0 2.5714 0 5.47711C0 6.55283 0.115741 7.6114 0.25 8.67426C0.300926 9.08997 0.282407 9.54854 0.365741 9.96426C0.583333 11.0571 1.69444 11.5628 2.77315 11.5628C4.25 11.5628 5.23148 10.7014 5.23148 9.3214C5.23148 8.52426 4.94907 8.0014 4.13426 7.69283C4.08333 7.67569 4.03241 7.66283 4.03241 7.59854C4.03241 7.4914 4.21759 7.41426 4.33333 7.41426C4.73148 7.41426 5.36111 7.78283 5.91204 7.78283C8.06944 7.78283 9.26389 5.86283 9.26389 4.06283C9.26389 1.44854 7.18518 0.265686 4.58333 0.265686ZM4.56481 5.91854C4.43056 5.91854 4.31481 5.8114 4.31481 5.68711C4.31481 5.51997 4.56481 5.39569 4.64815 5.25854C4.8287 4.94997 4.87963 4.42711 4.87963 4.07569C4.87963 3.65997 4.76389 2.89283 4.48148 2.58426C4.39815 2.49426 4.28241 2.44711 4.28241 2.32283C4.28241 2.19854 4.41667 2.0914 4.5463 2.0914C5.11111 2.0914 5.39352 3.62997 5.39352 4.02854C5.39352 4.45711 5.24537 5.91854 4.56481 5.91854Z"
|
|
70
|
-
fill="currentColor"
|
|
71
|
-
/>
|
|
72
|
-
<path
|
|
73
|
-
d="M14.9259 0.527108C11.4074 0.527108 9.2963 2.83282 9.2963 5.99568C9.2963 9.15854 11.4028 11.4643 14.9259 11.4643C18.4491 11.4643 20.537 9.12854 20.537 5.99568C20.537 2.86282 18.412 0.527108 14.9259 0.527108ZM15.0787 9.89997C15.0232 9.96425 14.912 10.0843 14.7778 10.0843C14.6435 10.0843 14.5139 9.97711 14.5139 9.85282C14.5139 9.80568 14.9445 9.20568 15.0139 9.02139C15.2778 8.29711 15.3287 7.51282 15.3287 6.74568C15.3287 5.71711 15.1296 4.39282 14.4491 3.54854C14.3148 3.39425 13.9028 3.10282 13.9028 2.93568C13.9028 2.81139 14.0185 2.70425 14.1528 2.70425C14.2685 2.70425 14.3843 2.79854 14.4676 2.85854C15.5278 3.67282 15.8472 5.53282 15.8472 6.74568C15.8472 7.69711 15.8056 9.08568 15.0833 9.89568L15.0787 9.89997Z"
|
|
74
|
-
fill="currentColor"
|
|
75
|
-
/>
|
|
76
|
-
<path
|
|
77
|
-
d="M25.375 0.265686C21.838 0.265686 20.7917 2.5714 20.7917 5.47711C20.7917 6.55283 20.9074 7.6114 21.0417 8.67426C21.0926 9.08997 21.0741 9.54854 21.1574 9.96426C21.375 11.0571 22.4861 11.5628 23.5648 11.5628C25.0417 11.5628 26.0231 10.7014 26.0231 9.3214C26.0231 8.52426 25.7407 8.0014 24.9259 7.69283C24.875 7.67569 24.8241 7.66283 24.8241 7.59854C24.8241 7.4914 25.0092 7.41426 25.125 7.41426C25.5231 7.41426 26.1528 7.78283 26.7037 7.78283C28.8611 7.78283 30.0555 5.86283 30.0555 4.06283C30.0555 1.44854 27.9815 0.265686 25.375 0.265686ZM25.3611 5.91854C25.2268 5.91854 25.1111 5.8114 25.1111 5.68711C25.1111 5.51997 25.3611 5.39569 25.4444 5.25854C25.625 4.94997 25.6759 4.42711 25.6759 4.07569C25.6759 3.65997 25.5602 2.89283 25.2778 2.58426C25.1944 2.49426 25.0787 2.44711 25.0787 2.32283C25.0787 2.19854 25.213 2.0914 25.3426 2.0914C25.9074 2.0914 26.1898 3.62997 26.1898 4.02854C26.1898 4.45711 26.0417 5.91854 25.3611 5.91854Z"
|
|
78
|
-
fill="currentColor"
|
|
79
|
-
/>
|
|
80
|
-
<path
|
|
81
|
-
d="M37.3843 4.81284C36.1898 4.81284 34.5278 5.31855 34.5278 6.64284C34.5278 7.39713 35.125 8.5157 36.0741 8.5157C36.6713 8.5157 37.0556 8.08713 37.2546 8.08713C37.3056 8.08713 37.3519 8.11713 37.3519 8.16427C37.3519 8.60998 36.4213 8.81141 36.0556 8.81141C34.7778 8.81141 34.0972 7.7957 34.0972 6.71998C34.0972 5.39998 35.4398 4.38427 36.8009 4.38427C37.1991 4.38427 37.6158 4.49141 38.0139 4.49141C39.1945 4.49141 40.0371 3.50998 40.0371 2.46427C40.0371 0.728554 37.8148 0.329982 36.3333 0.329982C32.3982 0.329982 30.1065 2.6957 30.1065 6.29141C30.1065 9.61284 31.9676 11.73 35.6528 11.73C38.0417 11.73 40.6482 10.7786 40.6482 8.19427C40.6482 6.42855 39.4028 4.81284 37.3796 4.81284H37.3843Z"
|
|
82
|
-
fill="currentColor"
|
|
83
|
-
/>
|
|
84
|
-
<path
|
|
85
|
-
d="M48.3611 7.42711C48.0602 7.42711 47.8148 7.53426 47.5648 7.53426C47.5139 7.53426 47.5 7.48711 47.5 7.45712C47.5 7.34997 47.5509 7.30283 47.6342 7.27283C47.9167 7.18283 48.2176 7.11854 48.4954 6.99426C49.7592 6.4414 50.5046 5.45569 50.5046 4.15283C50.5046 1.79997 48.3287 0.372829 45.9398 0.372829C45.0741 0.372829 44.2315 0.604257 43.5 0.972829C41.5092 1.9714 41.125 3.40283 41.0092 5.35283C40.9583 6.11997 40.9583 6.8914 40.9583 7.65854V9.51854C40.9583 10.6843 41.787 11.6228 43.0972 11.6228C44.0416 11.6228 44.8889 10.9928 45.1065 10.1614C45.2222 9.66854 45.1574 9.08569 45.1574 8.60997C45.1574 8.56283 45.1759 8.54997 45.2222 8.54997C45.2685 8.54997 45.3241 8.57997 45.3565 8.59711C45.9398 9.90426 46.7361 11.5628 48.5417 11.5628C49.787 11.5628 50.8148 10.7485 50.8148 9.56569C50.8148 8.38283 49.6204 7.4314 48.3565 7.4314L48.3611 7.42711ZM45.6574 5.91854C45.5231 5.91854 45.4074 5.8114 45.4074 5.68711C45.4074 5.51997 45.6574 5.39569 45.7407 5.25854C45.9213 4.94997 45.9722 4.42711 45.9722 4.07569C45.9722 3.65997 45.8565 2.89283 45.5741 2.58426C45.4907 2.49426 45.3935 2.44711 45.3935 2.32283C45.3935 2.19854 45.5092 2.0914 45.6435 2.0914C46.2083 2.0914 46.4907 3.62997 46.4907 4.02854C46.4907 4.45711 46.3565 5.91854 45.662 5.91854H45.6574Z"
|
|
86
|
-
fill="currentColor"
|
|
87
|
-
/>
|
|
88
|
-
<path
|
|
89
|
-
d="M54.8056 0.865677C54.4074 0.621391 53.8426 0.497105 53.3611 0.497105C52.3148 0.497105 51.4167 1.26425 51.3009 2.21996C51.2685 2.49853 51.2824 2.75996 51.2824 3.05139V5.66139L51.2315 8.41282V9.77996C51.2315 10.8557 52.2269 11.7 53.375 11.7C54.2222 11.7 55.1528 11.2071 55.4676 10.47C55.6482 10.0542 55.6667 9.47139 55.6667 9.02568V7.82568L55.6852 5.42996V3.03425C55.6852 2.14282 55.6667 1.43568 54.8056 0.865677Z"
|
|
90
|
-
fill="currentColor"
|
|
91
|
-
/>
|
|
92
|
-
<path
|
|
93
|
-
d="M58.9445 0.402828C57.25 0.402828 56.4028 1.13997 56.4028 2.7214V3.3514L56.4213 4.59426V5.22426C56.4213 5.69997 56.4213 6.14568 56.4028 6.6214C56.3704 7.1914 56.287 7.75711 56.287 8.34426C56.287 10.4957 57.4815 11.5414 59.7917 11.5414C63.3426 11.5414 65.75 10.1271 65.75 6.60854C65.75 2.36568 63.5417 0.398542 58.9445 0.398542V0.402828ZM60.537 8.9014C60.4028 8.9014 60.287 8.79426 60.287 8.66997C60.287 8.62283 60.3056 8.59283 60.338 8.54568C60.7685 7.88568 60.8843 6.96426 60.8843 6.20997C60.8843 5.50283 60.8009 4.45711 60.3194 3.90426C60.2361 3.77997 60.0695 3.68997 60.0695 3.53569C60.0695 3.4114 60.1852 3.30426 60.3194 3.30426C60.5694 3.30426 60.9167 3.88711 61.0185 4.08854C61.3333 4.76569 61.3843 5.50283 61.3843 6.22283C61.3843 6.66854 61.1343 8.89711 60.537 8.89711V8.9014Z"
|
|
94
|
-
fill="currentColor"
|
|
95
|
-
/>
|
|
96
|
-
<path
|
|
97
|
-
d="M73.5046 5.85855C72.5417 5.78141 71.162 5.47284 70.4167 4.88998C70.3194 4.81284 70.1528 4.7057 70.1528 4.56855C70.1528 4.52141 70.1713 4.44427 70.2361 4.44427C70.4167 4.44427 71.5787 5.3057 72.5787 5.3057C73.8426 5.3057 75 4.39713 75 3.20141C75 1.23427 72.1806 0.437125 70.4676 0.437125C67.9259 0.437125 66.037 1.95855 66.037 4.37141C66.037 4.89427 66.1204 5.61427 66.537 6.01713C66.7361 6.21855 67.0694 6.21855 67.3333 6.21855C68.3287 6.21855 69.5926 6.50998 70.1204 7.35427C70.1713 7.43141 70.2176 7.5557 70.2176 7.6457C70.2176 7.6757 70.2176 7.72284 70.1852 7.7057C70.088 7.6757 70.0046 7.59855 69.9352 7.53855C69.3519 7.0157 68.5555 6.49284 67.713 6.49284C66.4491 6.49284 66.0046 7.6157 66.0046 8.59713C66.0046 10.5771 67.9306 11.67 69.8889 11.67C72.213 11.67 75 10.2557 75 7.84284C75 6.95141 74.5833 5.95284 73.5046 5.86284V5.85855Z"
|
|
98
|
-
fill="currentColor"
|
|
99
|
-
/>
|
|
100
|
-
</svg>
|
|
101
|
-
</div>
|
|
102
|
-
</button>`}};_.styles=[l(_,_,"styles"),yt],_=i([(0,wt.customElement)("pop-auth-join")],_);var kt=_;var _t=require("@lit/context"),Et=require("@popgrids/ui"),J=require("lit"),H=require("lit/decorators.js"),Tt=require("lit/directives/class-map.js"),Mt=require("lit/directives/if-defined.js");var jt=require("@lit/context"),E=(0,jt.createContext)(Symbol("pop-auth-context"));var Dt=require("lit"),At=Dt.css`
|
|
103
|
-
:host {
|
|
104
|
-
display: flex;
|
|
105
|
-
width: 100%;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
padding: 16px;
|
|
106
57
|
}
|
|
107
58
|
|
|
108
|
-
.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
overflow: hidden;
|
|
120
|
-
background-color: var(--color-surface-bg-default, #fff);
|
|
121
|
-
backdrop-filter: blur(var(--blur-2xl));
|
|
59
|
+
.join-btn {
|
|
60
|
+
font-family: Inter, sans-serif;
|
|
61
|
+
font-size: 13px;
|
|
62
|
+
font-weight: 600;
|
|
63
|
+
color: var(--pop-auth-btn);
|
|
64
|
+
background: none;
|
|
65
|
+
border: none;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
padding: 0;
|
|
68
|
+
letter-spacing: -0.08px;
|
|
69
|
+
line-height: 18px;
|
|
122
70
|
}
|
|
123
71
|
|
|
124
|
-
.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
max-height: 340px;
|
|
128
|
-
transition: height var(--duration-quick) var(--ease-quick);
|
|
72
|
+
.join-btn:disabled {
|
|
73
|
+
opacity: 0.6;
|
|
74
|
+
cursor: default;
|
|
129
75
|
}
|
|
130
76
|
|
|
131
|
-
.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
77
|
+
.logo {
|
|
78
|
+
font-family: Inter, sans-serif;
|
|
79
|
+
font-size: 9px;
|
|
80
|
+
font-weight: 700;
|
|
81
|
+
letter-spacing: 1.5px;
|
|
82
|
+
color: var(--pop-auth-logo);
|
|
83
|
+
text-transform: uppercase;
|
|
84
|
+
}
|
|
136
85
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
86
|
+
.error {
|
|
87
|
+
padding: 0 16px 12px;
|
|
88
|
+
font-family: Inter, sans-serif;
|
|
89
|
+
font-size: 12px;
|
|
90
|
+
line-height: 16px;
|
|
91
|
+
color: var(--pop-auth-error);
|
|
92
|
+
text-align: center;
|
|
140
93
|
}
|
|
141
|
-
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
<div
|
|
148
|
-
class=${(0,Tt.classMap)({"auth-panel":!0,"auth-panel--is-open":this._open})}
|
|
149
|
-
>
|
|
150
|
-
<div class="auth-panel__content">
|
|
151
|
-
${this.authContext?.isAuthenticated?this.renderAuthenticated():this.renderUnauthenticated()}
|
|
94
|
+
`),L=class extends F{constructor(...e){super(...e),this.events={click:`onClick`}}get styleSheets(){return[pe]}onClick(e){e.target.closest(`.join-btn`)&&this.handleJoin()}setupEffects(){this.addEffect(()=>{let e=h.value,t=m.value,n=this.getElement(`.join-btn`);n&&(n.disabled=e,n.textContent=e?`Signing in…`:`Join the Conversation`);let r=this.getElement(`.error`);r&&(t?(r.hidden=!1,r.textContent=t):(r.hidden=!0,r.textContent=``))})}async handleJoin(){te(),await y(this.gridStore.apiUrl,this.gridStore.publicKey)}getTemplate(){return`
|
|
95
|
+
<div class="panel">
|
|
96
|
+
<div class="watermark">Popgrids</div>
|
|
97
|
+
<div class="actions">
|
|
98
|
+
<button class="join-btn" type="button">Join the Conversation</button>
|
|
99
|
+
<span class="logo">POPGRIDS</span>
|
|
152
100
|
</div>
|
|
101
|
+
<div class="error" hidden></div>
|
|
153
102
|
</div>
|
|
154
|
-
`}};
|
|
155
|
-
:host {
|
|
156
|
-
display: block;
|
|
157
|
-
}
|
|
158
|
-
`;var st="popgrids_token",f=class extends $t.PopElement{constructor(){super(...arguments);this.error=null;this.isAuthenticated=!1;this.currentAccount=null;this.isVerifying=!1;this.token=null;this.verificationExpiresAt=null;this.contextData={currentAccount:null,error:null,isAuthenticated:!1,isVerifying:!1,signIn:this.signIn.bind(this),signOut:this.signOut.bind(this),token:null,verificationExpiresAt:null,verifyCode:this.verifyCode.bind(this)}}connectedCallback(){super.connectedCallback();let t=localStorage.getItem(st);t&&(this.token=t,this.fetchCurrentAccount())}async fetchCurrentAccount(){if(!(!this.token||!this.apiState?.client)){console.log("fetchCurrentAccount",this.token);try{let{data:t,error:e}=await this.apiState.client.GET("/api/v1/users/me",{headers:{Authorization:`Bearer ${this.token}`,"Content-Type":"application/json",Accept:"application/json"}});e&&this.signOut(),t?(this.currentAccount=t,this.isAuthenticated=!0,this.updateContextData()):this.signOut()}catch(t){console.error("Failed to fetch current account:",t),this.signOut()}}}async signIn(t){if(!this.apiState?.client)throw new Error("API client not available");try{let{data:e,error:r}=await this.apiState.client.POST("/api/v1/session",{params:{query:{email:t.email}}});if(r&&(this.error=r,this.updateContextData()),e)return this.isVerifying=!0,this.verificationExpiresAt=e.expires,this.updateContextData(),e;throw new Error("Authentication failed")}catch(e){throw console.error("Sign in failed:",e),e}}async verifyCode(t,e){if(this.apiState?.client)try{let{data:r,error:s}=await this.apiState.client.PUT("/api/v1/session",{params:{query:{code:t,email:e}}});if(s&&(this.error=s,this.updateContextData()),r)this.token=`${r.token}`,localStorage.setItem(st,this.token),this.isVerifying=!1,this.verificationExpiresAt=null,await this.fetchCurrentAccount();else throw new Error("Verification failed")}catch(r){throw console.error("Verification failed:",r),r}}signOut(){this.token=null,this.currentAccount=null,this.isAuthenticated=!1,this.isVerifying=!1,this.verificationExpiresAt=null,localStorage.removeItem(st),this.updateContextData()}updateContextData(){this.contextData={...this.contextData,error:this.error,isAuthenticated:this.isAuthenticated,isVerifying:this.isVerifying,currentAccount:this.currentAccount,token:this.token,verificationExpiresAt:this.verificationExpiresAt}}render(){return Bt.html`<slot part="base"></slot>`}};f.styles=[Ht],i([(0,O.consume)({context:$})],f.prototype,"apiState",2),i([(0,j.state)()],f.prototype,"error",2),i([(0,j.state)()],f.prototype,"isAuthenticated",2),i([(0,j.state)()],f.prototype,"currentAccount",2),i([(0,j.state)()],f.prototype,"isVerifying",2),i([(0,j.state)()],f.prototype,"token",2),i([(0,j.state)()],f.prototype,"verificationExpiresAt",2),i([(0,O.provide)({context:E}),(0,j.property)({attribute:!1})],f.prototype,"contextData",2),f=i([(0,j.customElement)("pop-auth-provider")],f);var zt=f;var Nt=require("@lit/context"),Qt=require("@popgrids/ui"),Jt=require("lit"),I=require("lit/decorators.js"),Ft=require("lit/directives/class-map.js");var It="./apple-IX52EWYN.png";var Rt="./google-Q3MFTU5A.png";var Ut=require("lit"),Kt=Ut.css`
|
|
103
|
+
`}};I([S(E)],L.prototype,`gridStore`,void 0),customElements.get(`pop-auth-panel`)||customElements.define(`pop-auth-panel`,L);var me=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD8AAABMCAYAAADa6W+wAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAUuSURBVHgB5ZyBceIwEEX3bq4AOsAdQAdxKggl+Co4rgKcCkgqgFRAUgGkAqACOxVAKvDpg+VRHEmWQSubuTezg8Ega7UrebWS+UG8jIXEQoZCovI9lcd1ciHHUnZCPsrXXflZ7xkISYSshByEFJ5kLWRO54bsHRGdK+dTYZNkQhbUg4aI6FyRoiNBQyQUGLj3jMJYuleNMC4v1gel67Ig/WCq5Qe144+QlM6Wb2QwGNB4PD7JaDQ6veIzKZLj8XiSPM9Pr/v9nna73UnwWUtyIb+FbMgjM3K0QBzHxXq9Lg6HQ3Et2+22WCwWpzJdr1/KjDzRqLiwZDGbzbwobCLLslNDRFEUrAEmTReBVVCxkLRohIsbICLLiA5roxJdAm9zaIAJXUBmKhCtHtraJjAuNHjBgVrcBcDsFhSXoD4NDbB2VTyyFNI7xSUODTB1UX5hKmA+nxd9Bl0AYxGZ3X9wkdWTJCluARjIYv2ULrG6T3eHhabT6SkY4sASFB1aWx23FJ+IULcqm6MBUKbF+rFO+ZQCje6qa6J8jsjQYv2FTvmMAvb1yWRSXePp6anwzWq1cnb9MQXo6yqwthyZ0Q04y9e5/k9F+VjnCpiGCrckDjCtFV51OpZTWN/lo/4Gxqryd7pvCNckTkS/rI7f39/JN5b6j1TltU10d3dHnKjl+7Y8sHhtpS+iHm3f4JyfS2RIytHvMV4ZdMt+1lvhS9OUaSdu5DUuSFk5l60hksoPWv7QK9I1kb/zjU2HRsuHIFQj17FanusWV4fD4i5I5Ye6k8PhkELAqbxlHDn2os9L5Tm6mUX5vBfKy/s7x/U+Pz9Np7q3/GazqY7VaI+j/Br7zpV/e3urjjmiSUvUWJ3QRkHcqAlHzL58g+iUzAmNLxOboGAgur+/rwYkjgnU6+ur6VROXVpezbLA6hw5A9dMTnDlZRoLinPk8CwTmm85vE76PCdIvRn0ympdQL8YGWI6y0GD1atVGzngaePLrmLua8FAaqEaBTsb7bl4fHy0hbTPdB7pv7AmjYtwraZw0eDu6OuRqrTV7T8+PuhWkHGDhUeqWV0qr43+b6XPI4RVAyYNGyHL+odS+Vz3i1tQ/vn5uUlxnPitO/FL+cL3XzEkFAFmWsjRY28eZnKXTKBQBgY3y6xN8pcM+km0O66wlhZiUMJ1lstlY1yB8y335KU2peUOTKRQtvWTyOGJypJv4FGwmlD42zl4Aq6rZnQhFyxnYYBLXb4YEemXpjlx2ENziSBaTaglncT3nhtgTS23nEkyXYEhdl417KJwtfaUrkCrPPbOhEDdqNBS6ZQcd4HbWOkugN0NIWhhfRhpQR4eM/mlHGujPEvq1ysNOXu4tHzaKidPqLO6XPcFrkCnDgIdy/IYUryYiubkEVV5bSwbSnlgW04mBhqVDxnfh16tVZXXhk8hLW9bVCQGemV5y7VyCkAnUR5APEHmezkL9RxeZ4Oey5qab5yUVxcTuXh5eTGd2lMgnkjjepg/c9JmdYWT2FQJjo3BEsusLqPAbHUV4VpMTNPUZvUFBSYxVMT7vvsGxWH1iDpgTYbbDjzg2i6AXBweMSH77C2hjsAUy/psPLwASce2OD4GuqIA2B4hxzRyrrzHbfBb8I2ZGJKODw8PVeJRxujysXDcw/FYOBKWDhFjLuSeAkV1NlJqn125RjLqqJ+bSOk/VVwSEe9fRSzJQx6Om4T8NgLKiunGSMh8O3QR/Damjmn7hyF14KpxKSM6d49IOa/7u6dX6snfPf0DiVL6IWhCmZ4AAAAASUVORK5CYII=`,R=`#DDD0BE.#E9DCBB.#E9DCBB.#C7D1B0.#C6D0CB.#E9DCBB.#C7D1B0.#E9DCBB.#DFC2C0.#CFD4C6.#D7E3E8.#CFD4C6.#D6B3B3.#E9DCBB.#CFCBDC.#BFD6D7.#E3D2C6.#D1E2E7.#D6B3B3.#BFD6D7.#E9DCBB.#C7D1B0.#DFC2C0.#D1E2E7.#CFD4C6.#E9DCBB.#D7E3E8.#CFD4C6.#C6D0CB.#E9DCBB.#C7D1B0.#E9DCBB.#CFCBDC.#E3D2C6.#E9DCBB`.split(`.`),z=e=>typeof e==`number`?R[e%R.length]??`#e5e7eb`:R[Math.floor(Math.random()*R.length)];function he(e){let t=new TextEncoder().encode(e),n=2166136261;for(let e=0;e<t.length;e++){let r=t[e]??0;n^=r,n=Math.imul(n,16777619)}return n>>>0}function ge(e){return R[he(e)%R.length]??`#e5e7eb`}var _e=P(`
|
|
159
104
|
:host {
|
|
160
105
|
display: block;
|
|
106
|
+
|
|
107
|
+
--comment-avatar-border-size: 1px;
|
|
108
|
+
--comment-avatar-border-color: var(--color-background, #fff);
|
|
109
|
+
--comment-avatar-size: 32px;
|
|
161
110
|
}
|
|
162
111
|
|
|
163
|
-
.
|
|
112
|
+
.comment-avatar {
|
|
113
|
+
align-items: center;
|
|
164
114
|
display: flex;
|
|
165
|
-
|
|
166
|
-
|
|
115
|
+
flex-shrink: 0;
|
|
116
|
+
isolation: isolate;
|
|
167
117
|
justify-content: center;
|
|
168
|
-
|
|
169
|
-
|
|
118
|
+
position: relative;
|
|
119
|
+
width: calc(var(--comment-avatar-size) + calc(var(--comment-avatar-border-size) * 2));
|
|
120
|
+
height: calc(var(--comment-avatar-size) + calc(var(--comment-avatar-border-size) * 2));
|
|
170
121
|
}
|
|
171
122
|
|
|
172
|
-
.
|
|
173
|
-
|
|
174
|
-
flex-direction: column;
|
|
175
|
-
gap: var(--spacing-xl, 16px);
|
|
176
|
-
font-size: var(--text-widget-base);
|
|
177
|
-
line-height: var(--text-widget-base--line-height);
|
|
178
|
-
letter-spacing: var(--text-widget-base--letter-spacing);
|
|
179
|
-
font-weight: 500;
|
|
123
|
+
.comment-avatar--size-xs {
|
|
124
|
+
--comment-avatar-size: 32px;
|
|
180
125
|
}
|
|
181
126
|
|
|
182
|
-
.
|
|
183
|
-
|
|
184
|
-
flex-direction: column;
|
|
185
|
-
gap: var(--spacing-xl, 16px);
|
|
186
|
-
justify-content: center;
|
|
187
|
-
align-items: center;
|
|
188
|
-
width: 100%;
|
|
127
|
+
.comment-avatar--size-sm {
|
|
128
|
+
--comment-avatar-size: 56px;
|
|
189
129
|
}
|
|
190
130
|
|
|
191
|
-
.
|
|
192
|
-
|
|
193
|
-
border: none;
|
|
194
|
-
background-color: transparent;
|
|
195
|
-
display: flex;
|
|
196
|
-
width: 32px;
|
|
197
|
-
height: 32px;
|
|
198
|
-
justify-content: center;
|
|
199
|
-
align-items: center;
|
|
200
|
-
transition: transform 300ms ease-out;
|
|
131
|
+
.comment-avatar--size-md {
|
|
132
|
+
--comment-avatar-size: 80px;
|
|
201
133
|
}
|
|
202
134
|
|
|
203
|
-
.
|
|
204
|
-
|
|
205
|
-
|
|
135
|
+
.comment-avatar--size-lg {
|
|
136
|
+
--comment-avatar-size: 120px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.comment-avatar--size-xl {
|
|
140
|
+
--comment-avatar-size: 140px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.comment-avatar__background {
|
|
144
|
+
background-color: var(--comment-avatar-border-color);
|
|
145
|
+
position: absolute;
|
|
146
|
+
top: 0;
|
|
147
|
+
left: 0;
|
|
148
|
+
z-index: 10;
|
|
149
|
+
width: 100%;
|
|
150
|
+
height: 100%;
|
|
206
151
|
}
|
|
207
152
|
|
|
208
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Content
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
.comment-avatar__content {
|
|
158
|
+
align-items: center;
|
|
159
|
+
background-color: var(--color-surface-bg-default);
|
|
209
160
|
display: flex;
|
|
210
|
-
padding: 0px var(--spacing-2xl, 20px);
|
|
211
161
|
justify-content: center;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
162
|
+
overflow: hidden;
|
|
163
|
+
position: relative;
|
|
164
|
+
height: var(--comment-avatar-size);
|
|
165
|
+
width: var(--comment-avatar-size);
|
|
166
|
+
z-index: 20;
|
|
216
167
|
|
|
217
|
-
|
|
218
|
-
font-
|
|
219
|
-
line-height: var(--text-widget-base--line-height);
|
|
220
|
-
letter-spacing: var(--text-widget-base--letter-spacing);
|
|
168
|
+
/* Initials styling */
|
|
169
|
+
font-family: Inter, sans-serif;
|
|
221
170
|
font-weight: 600;
|
|
171
|
+
color: #374151;
|
|
172
|
+
font-size: calc(var(--comment-avatar-size) * 0.35);
|
|
173
|
+
line-height: 1;
|
|
222
174
|
}
|
|
223
175
|
|
|
224
|
-
.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
176
|
+
.comment-avatar__content::slotted(img) {
|
|
177
|
+
-webkit-user-drag: none;
|
|
178
|
+
align-self: stretch;
|
|
179
|
+
flex: 1 0 0;
|
|
180
|
+
height: var(--comment-avatar-size);
|
|
181
|
+
object-fit: cover;
|
|
182
|
+
pointer-events: none;
|
|
183
|
+
position: absolute;
|
|
184
|
+
user-select: none;
|
|
185
|
+
width: var(--comment-avatar-size);
|
|
228
186
|
}
|
|
229
187
|
|
|
230
|
-
.
|
|
188
|
+
.comment-avatar__deleted-mark {
|
|
189
|
+
-webkit-user-drag: none;
|
|
190
|
+
bottom: -3px;
|
|
191
|
+
height: auto;
|
|
192
|
+
left: 0;
|
|
193
|
+
object-fit: cover;
|
|
194
|
+
pointer-events: none;
|
|
195
|
+
position: absolute;
|
|
196
|
+
user-select: none;
|
|
231
197
|
width: 100%;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
errorMessage=${this.emailError}
|
|
247
|
-
name="email"
|
|
248
|
-
type="email"
|
|
249
|
-
placeholder="Email"
|
|
250
|
-
pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+.[a-zA-Z]{2,}"
|
|
251
|
-
.value=${this.email}
|
|
252
|
-
.disabled=${this.isSubmitting}
|
|
253
|
-
?required=${!0}
|
|
254
|
-
?error=${!!this.emailError}
|
|
255
|
-
@input=${this.handleEmailChange}
|
|
256
|
-
@blur=${this.handleBlur}
|
|
257
|
-
@pop-invalid=${this.handleInvalid}
|
|
258
|
-
></pop-form-input-simple>
|
|
259
|
-
<pop-button
|
|
260
|
-
class="auth-sign-in__submit-button"
|
|
261
|
-
theme="brand"
|
|
262
|
-
variant="primary"
|
|
263
|
-
current
|
|
264
|
-
?disabled=${this.isSubmitting||!this.isValid}
|
|
265
|
-
>
|
|
266
|
-
${this.isSubmitting?"Submitting...":"Continue"}
|
|
267
|
-
</pop-button>
|
|
268
|
-
</form>
|
|
269
|
-
<div class="auth-sign-in__social-login">
|
|
270
|
-
<button class="auth-sign-in__google-icon" type="button">
|
|
271
|
-
<img src=${vi} alt="Google" />
|
|
272
|
-
</button>
|
|
273
|
-
<button class="auth-sign-in__apple-icon" type="button">
|
|
274
|
-
<img src=${yi} alt="Apple" />
|
|
275
|
-
</button>
|
|
276
|
-
</div>
|
|
277
|
-
<div class="auth-sign-in__footer">
|
|
278
|
-
<pop-button-link ?primary=${!0} size="sm">What's Popgrids?</pop-button-link>
|
|
198
|
+
transform: scale(0.57);
|
|
199
|
+
}
|
|
200
|
+
`),ve=class extends F{constructor(){super(),this._backgroundColor=z()??`#e5e7eb`}static get observedAttributes(){return[`size`,`data-color-key`,`deleted`]}onSizeChanged(){this.render()}onDataColorKeyChanged(){this.render()}onDeletedChanged(){this.render()}get styleSheets(){return[_e]}get size(){return this.getAttribute(`size`)||`md`}set size(e){this.setAttribute(`size`,e)}get deleted(){return this.hasAttribute(`deleted`)}set deleted(e){e?this.setAttribute(`deleted`,``):this.removeAttribute(`deleted`)}getTemplate(){let e=this.size,t=this.deleted,n=this.getAttribute(`data-color-key`),r=t?`var(--pop-muted-foreground, #e5e7eb)`:n?ge(n):this._backgroundColor;return`
|
|
201
|
+
<div class="comment-avatar comment-avatar--size-${e}" part="base">
|
|
202
|
+
<div class="comment-avatar__background mask mask-squircle" part="background"></div>
|
|
203
|
+
${t?`<div
|
|
204
|
+
class="comment-avatar__content mask mask-squircle"
|
|
205
|
+
part="content"
|
|
206
|
+
style="background-color: ${r}; opacity: 0.15"
|
|
207
|
+
><img class="comment-avatar__deleted-mark" src="${me}" alt="Deleted user" /></div>`:`<slot
|
|
208
|
+
class="comment-avatar__content mask mask-squircle"
|
|
209
|
+
part="content"
|
|
210
|
+
style="background-color: ${r};"
|
|
211
|
+
></slot>`}
|
|
279
212
|
</div>
|
|
280
|
-
|
|
213
|
+
`}};customElements.get(`pop-comment-avatar`)||customElements.define(`pop-comment-avatar`,ve);function B(e){return e?e.split(` `).map(e=>e[0]??``).join(``).toUpperCase().slice(0,2):`?`}var ye=P(`
|
|
281
214
|
:host {
|
|
215
|
+
background: var(--pop-background);
|
|
216
|
+
border-top: 1px solid var(--pop-bar-input-bg);
|
|
282
217
|
display: block;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
.auth-verify-code {
|
|
286
|
-
display: flex;
|
|
287
|
-
padding: var(--spacing-2xl, 20px) var(--spacing-3xl, 24px);
|
|
288
|
-
flex-direction: column;
|
|
289
|
-
justify-content: center;
|
|
290
|
-
align-items: center;
|
|
291
|
-
gap: var(--spacing-xl, 16px);
|
|
218
|
+
padding: 6px;
|
|
292
219
|
position: relative;
|
|
220
|
+
|
|
221
|
+
--pop-bar-avatar-bg: #e5e7eb;
|
|
222
|
+
--pop-bar-avatar-color: #374151;
|
|
223
|
+
--pop-bar-avatar-border: #ffffff;
|
|
224
|
+
--pop-bar-input-bg: rgba(0, 0, 32, 0.04);
|
|
225
|
+
--pop-bar-send-hover: rgba(0, 0, 32, 0.06);
|
|
226
|
+
--pop-bar-send-color: #000000;
|
|
227
|
+
--pop-bar-watermark: rgba(0, 0, 32, 0.1);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
@media (prefers-color-scheme: dark) {
|
|
231
|
+
:host {
|
|
232
|
+
--pop-bar-avatar-bg: #1f2937;
|
|
233
|
+
--pop-bar-avatar-color: #d1d5db;
|
|
234
|
+
--pop-bar-avatar-border: var(--pop-popover, #151d2a);
|
|
235
|
+
--pop-bar-input-bg: rgba(255, 255, 255, 0.05);
|
|
236
|
+
--pop-bar-send-hover: rgba(255, 255, 255, 0.08);
|
|
237
|
+
--pop-bar-send-color: #ffffff;
|
|
238
|
+
--pop-bar-watermark: rgba(255, 255, 255, 0.1);
|
|
239
|
+
}
|
|
293
240
|
}
|
|
294
241
|
|
|
295
|
-
.
|
|
296
|
-
|
|
242
|
+
:host(.dark) {
|
|
243
|
+
--pop-bar-avatar-bg: #1f2937;
|
|
244
|
+
--pop-bar-avatar-color: #d1d5db;
|
|
245
|
+
--pop-bar-avatar-border: var(--pop-popover, #151d2a);
|
|
246
|
+
--pop-bar-input-bg: rgba(255, 255, 255, 0.05);
|
|
247
|
+
--pop-bar-send-hover: rgba(255, 255, 255, 0.08);
|
|
248
|
+
--pop-bar-send-color: #ffffff;
|
|
249
|
+
--pop-bar-watermark: rgba(255, 255, 255, 0.1);
|
|
297
250
|
}
|
|
298
251
|
|
|
299
|
-
.
|
|
252
|
+
.bar {
|
|
300
253
|
display: flex;
|
|
301
|
-
flex-direction: column;
|
|
302
254
|
align-items: center;
|
|
303
|
-
gap:
|
|
304
|
-
align-self: stretch;
|
|
305
|
-
font-size: var(--text-xs);
|
|
306
|
-
line-height: var(--text-xs--line-height);
|
|
307
|
-
text-align: center;
|
|
255
|
+
gap: 4px;
|
|
308
256
|
}
|
|
309
257
|
|
|
310
|
-
.
|
|
311
|
-
|
|
258
|
+
.bar__user {
|
|
259
|
+
display: flex;
|
|
260
|
+
align-items: center;
|
|
261
|
+
align-self: flex-start;
|
|
262
|
+
flex-shrink: 0;
|
|
263
|
+
padding-top: 2px;
|
|
312
264
|
}
|
|
313
265
|
|
|
314
|
-
.
|
|
315
|
-
|
|
266
|
+
.bar__avatar {
|
|
267
|
+
flex-shrink: 0;
|
|
268
|
+
--comment-avatar-border-size: 0px;
|
|
316
269
|
}
|
|
317
270
|
|
|
318
|
-
.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
justify-content: center;
|
|
322
|
-
align-items: flex-start;
|
|
323
|
-
gap: var(--spacing-2xl, 20px);
|
|
271
|
+
.bar__avatar--reply {
|
|
272
|
+
margin-right: -4px;
|
|
273
|
+
z-index: 1;
|
|
324
274
|
}
|
|
325
275
|
|
|
326
|
-
.
|
|
327
|
-
|
|
328
|
-
flex-direction: column;
|
|
329
|
-
align-items: center;
|
|
330
|
-
gap: var(--spacing-xl, 16px);
|
|
276
|
+
.bar__avatar--user {
|
|
277
|
+
z-index: 2;
|
|
331
278
|
}
|
|
332
279
|
|
|
333
|
-
.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
align-items: center;
|
|
337
|
-
gap: var(--spacing-xl, 16px);
|
|
280
|
+
.bar__user.has-reply .bar__avatar--user {
|
|
281
|
+
--comment-avatar-border-size: 2px;
|
|
282
|
+
--comment-avatar-border-color: var(--pop-bar-avatar-border);
|
|
338
283
|
}
|
|
339
284
|
|
|
340
|
-
.
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
285
|
+
.bar__input-wrap {
|
|
286
|
+
flex: 1;
|
|
287
|
+
min-width: 0;
|
|
288
|
+
background: var(--pop-bar-input-bg);
|
|
289
|
+
border-radius: 18px;
|
|
290
|
+
overflow: hidden;
|
|
291
|
+
display: flex;
|
|
292
|
+
align-items: flex-end;
|
|
293
|
+
padding: 4px 8px 4px 12px;
|
|
294
|
+
max-height: 280px;
|
|
345
295
|
}
|
|
346
296
|
|
|
347
|
-
.
|
|
297
|
+
.bar__send {
|
|
298
|
+
align-items: center;
|
|
299
|
+
align-self: flex-end;
|
|
300
|
+
background: none;
|
|
301
|
+
border: none;
|
|
302
|
+
cursor: pointer;
|
|
348
303
|
display: flex;
|
|
349
304
|
justify-content: center;
|
|
350
|
-
|
|
351
|
-
gap: var(--spacing-xl, 16px);
|
|
352
|
-
margin-bottom: var(--spacing-xs, 4px);
|
|
305
|
+
padding-bottom: 2px;
|
|
353
306
|
}
|
|
354
307
|
|
|
355
|
-
.
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
@input=${this.handleInput}
|
|
404
|
-
@keydown=${this.handleKeyDown}
|
|
405
|
-
@focus=${this.handleFocus}
|
|
406
|
-
@paste=${this.handlePaste}
|
|
407
|
-
></pop-code-input-field>
|
|
408
|
-
<pop-code-input-field
|
|
409
|
-
name="code_5"
|
|
410
|
-
.disabled=${this.isSubmitting}
|
|
411
|
-
@input=${this.handleInput}
|
|
412
|
-
@keydown=${this.handleKeyDown}
|
|
413
|
-
@focus=${this.handleFocus}
|
|
414
|
-
@paste=${this.handlePaste}
|
|
415
|
-
></pop-code-input-field>
|
|
416
|
-
<pop-code-input-field
|
|
417
|
-
name="code_6"
|
|
418
|
-
.disabled=${this.isSubmitting}
|
|
419
|
-
@input=${this.handleInput}
|
|
420
|
-
@keydown=${this.handleKeyDown}
|
|
421
|
-
@focus=${this.handleFocus}
|
|
422
|
-
@paste=${this.handlePaste}
|
|
423
|
-
></pop-code-input-field>
|
|
424
|
-
</div>
|
|
425
|
-
</div>
|
|
308
|
+
.logo-watermark {
|
|
309
|
+
position: absolute;
|
|
310
|
+
top: -16px;
|
|
311
|
+
left: 8px;
|
|
312
|
+
font-family: Inter, sans-serif;
|
|
313
|
+
font-size: 8px;
|
|
314
|
+
font-weight: 700;
|
|
315
|
+
letter-spacing: 1px;
|
|
316
|
+
color: var(--pop-bar-watermark);
|
|
317
|
+
text-transform: uppercase;
|
|
318
|
+
border-radius: 9999px;
|
|
319
|
+
padding: 2px 6px;
|
|
320
|
+
pointer-events: none;
|
|
321
|
+
user-select: none;
|
|
322
|
+
}
|
|
323
|
+
`),be=`<svg width="64" height="11" viewBox="0 0 64 11" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
324
|
+
<path d="M3.91111 0C0.892839 0 0 2.11357 0 4.77714C0 5.76321 0.0987654 6.73357 0.213333 7.70786C0.25679 8.08893 0.240988 8.50929 0.312099 8.89036C0.497778 9.89214 1.44593 10.3557 2.36642 10.3557C3.62667 10.3557 4.4642 9.56607 4.4642 8.30107C4.4642 7.57036 4.22321 7.09107 3.5279 6.80821C3.48444 6.7925 3.44099 6.78071 3.44099 6.72179C3.44099 6.62357 3.59901 6.55286 3.69778 6.55286C4.03753 6.55286 4.57481 6.89071 5.04494 6.89071C6.88593 6.89071 7.90519 5.13071 7.90519 3.48071C7.90519 1.08429 6.13136 0 3.91111 0ZM3.89531 5.18179C3.78074 5.18179 3.68198 5.08357 3.68198 4.96964C3.68198 4.81643 3.89531 4.7025 3.96642 4.57679C4.12049 4.29393 4.16395 3.81464 4.16395 3.4925C4.16395 3.11143 4.06519 2.40821 3.8242 2.12536C3.75309 2.04286 3.65432 1.99964 3.65432 1.88571C3.65432 1.77179 3.76889 1.67357 3.87951 1.67357C4.36148 1.67357 4.60247 3.08393 4.60247 3.44929C4.60247 3.84214 4.47605 5.18179 3.89531 5.18179Z" fill="#000020" fill-opacity="0.1"/>
|
|
325
|
+
<path d="M12.7368 0.239637C9.73433 0.239637 7.93285 2.35321 7.93285 5.25249C7.93285 8.15178 9.73038 10.2654 12.7368 10.2654C15.7432 10.2654 17.5249 8.12428 17.5249 5.25249C17.5249 2.38071 15.7116 0.239637 12.7368 0.239637ZM12.8672 8.83142C12.8198 8.89035 12.7249 9.00035 12.6104 9.00035C12.4958 9.00035 12.3852 8.90214 12.3852 8.78821C12.3852 8.74499 12.7526 8.19499 12.8119 8.02607C13.037 7.36214 13.0805 6.64321 13.0805 5.93999C13.0805 4.99714 12.9106 3.78321 12.3299 3.00928C12.2153 2.86785 11.8637 2.60071 11.8637 2.44749C11.8637 2.33357 11.9625 2.23535 12.077 2.23535C12.1758 2.23535 12.2746 2.32178 12.3457 2.37678C13.2504 3.12321 13.523 4.82821 13.523 5.93999C13.523 6.81214 13.4874 8.08499 12.8711 8.82749L12.8672 8.83142Z" fill="#000020" fill-opacity="0.1"/>
|
|
326
|
+
<path d="M21.6533 0C18.6351 0 17.7422 2.11357 17.7422 4.77714C17.7422 5.76321 17.841 6.73357 17.9555 7.70786C17.999 8.08893 17.9832 8.50929 18.0543 8.89036C18.24 9.89214 19.1881 10.3557 20.1086 10.3557C21.3689 10.3557 22.2064 9.56607 22.2064 8.30107C22.2064 7.57036 21.9654 7.09107 21.2701 6.80821C21.2267 6.7925 21.1832 6.78071 21.1832 6.72179C21.1832 6.62357 21.3412 6.55286 21.44 6.55286C21.7797 6.55286 22.317 6.89071 22.7871 6.89071C24.6281 6.89071 25.6474 5.13071 25.6474 3.48071C25.6474 1.08429 23.8775 0 21.6533 0ZM21.6415 5.18179C21.5269 5.18179 21.4281 5.08357 21.4281 4.96964C21.4281 4.81643 21.6415 4.7025 21.7126 4.57679C21.8667 4.29393 21.9101 3.81464 21.9101 3.4925C21.9101 3.11143 21.8113 2.40821 21.5704 2.12536C21.4992 2.04286 21.4005 1.99964 21.4005 1.88571C21.4005 1.77179 21.5151 1.67357 21.6257 1.67357C22.1076 1.67357 22.3486 3.08393 22.3486 3.44929C22.3486 3.84214 22.2222 5.18179 21.6415 5.18179Z" fill="#000020" fill-opacity="0.1"/>
|
|
327
|
+
<path d="M31.9012 4.16822C30.882 4.16822 29.4637 4.6318 29.4637 5.84572C29.4637 6.53715 29.9733 7.56251 30.7832 7.56251C31.2929 7.56251 31.6208 7.16965 31.7906 7.16965C31.8341 7.16965 31.8736 7.19715 31.8736 7.24037C31.8736 7.64894 31.0795 7.83358 30.7674 7.83358C29.677 7.83358 29.0963 6.90251 29.0963 5.91644C29.0963 4.70644 30.242 3.77537 31.4035 3.77537C31.7432 3.77537 32.0988 3.87358 32.4385 3.87358C33.4459 3.87358 34.165 2.97394 34.165 2.01537C34.165 0.424295 32.2687 0.0589382 31.0045 0.0589382C27.6464 0.0589382 25.6909 2.22751 25.6909 5.52358C25.6909 8.56822 27.279 10.5089 30.4237 10.5089C32.4622 10.5089 34.6864 9.6368 34.6864 7.26787C34.6864 5.6493 33.6237 4.16822 31.8973 4.16822H31.9012Z" fill="#000020" fill-opacity="0.1"/>
|
|
328
|
+
<path d="M41.2681 6.56464C41.0113 6.56464 40.802 6.66286 40.5886 6.66286C40.5452 6.66286 40.5333 6.61964 40.5333 6.59214C40.5333 6.49393 40.5768 6.45071 40.6479 6.42321C40.8889 6.34071 41.1457 6.28179 41.3827 6.16786C42.4612 5.66107 43.0973 4.7575 43.0973 3.56321C43.0973 1.40643 41.2405 0.0982143 39.202 0.0982143C38.4632 0.0982143 37.7442 0.310357 37.12 0.648214C35.4212 1.56357 35.0933 2.87571 34.9946 4.66321C34.9511 5.36643 34.9511 6.07357 34.9511 6.77679V8.48179C34.9511 9.55036 35.6583 10.4107 36.7763 10.4107C37.5822 10.4107 38.3052 9.83321 38.4909 9.07107C38.5896 8.61929 38.5343 8.085 38.5343 7.64893C38.5343 7.60571 38.5501 7.59393 38.5896 7.59393C38.6291 7.59393 38.6765 7.62143 38.7042 7.63714C39.202 8.83536 39.8815 10.3557 41.4222 10.3557C42.4849 10.3557 43.362 9.60929 43.362 8.525C43.362 7.44071 42.3427 6.56857 41.2642 6.56857L41.2681 6.56464ZM38.961 5.18179C38.8464 5.18179 38.7476 5.08357 38.7476 4.96964C38.7476 4.81643 38.961 4.7025 39.0321 4.57679C39.1862 4.29393 39.2296 3.81464 39.2296 3.4925C39.2296 3.11143 39.1309 2.40821 38.8899 2.12536C38.8188 2.04286 38.7358 1.99964 38.7358 1.88571C38.7358 1.77179 38.8346 1.67357 38.9491 1.67357C39.4311 1.67357 39.6721 3.08393 39.6721 3.44929C39.6721 3.84214 39.5575 5.18179 38.9649 5.18179H38.961Z" fill="#000020" fill-opacity="0.1"/>
|
|
329
|
+
<path d="M46.7674 0.549991C46.4277 0.326063 45.9457 0.212134 45.5348 0.212134C44.642 0.212134 43.8756 0.915349 43.7768 1.79142C43.7491 2.04678 43.761 2.28642 43.761 2.55356V4.94606L43.7175 7.46821V8.72142C43.7175 9.70749 44.5669 10.4814 45.5467 10.4814C46.2696 10.4814 47.0637 10.0296 47.3324 9.35392C47.4864 8.97285 47.5022 8.43856 47.5022 8.02999V6.92999L47.518 4.73392V2.53785C47.518 1.72071 47.5022 1.07249 46.7674 0.549991Z" fill="#000020" fill-opacity="0.1"/>
|
|
330
|
+
<path d="M50.2993 0.125713C48.8533 0.125713 48.1304 0.801428 48.1304 2.25107V2.82857L48.1462 3.96786V4.54536C48.1462 4.98143 48.1462 5.39 48.1304 5.82607C48.1027 6.34857 48.0316 6.86714 48.0316 7.40536C48.0316 9.3775 49.0509 10.3361 51.0222 10.3361C54.0523 10.3361 56.1067 9.03964 56.1067 5.81429C56.1067 1.925 54.2222 0.121785 50.2993 0.121785V0.125713ZM51.6583 7.91607C51.5437 7.91607 51.4449 7.81786 51.4449 7.70393C51.4449 7.66071 51.4608 7.83352 51.4884 7.59C51.8558 6.985 51.9546 6.14036 51.9546 5.44893C51.9546 4.80071 51.8835 3.84214 51.4726 3.33536C51.4015 3.22143 51.2593 3.13893 51.2593 2.9975C51.2593 2.88357 51.358 2.78536 51.4726 2.78536C51.6859 2.78536 51.9822 3.31964 52.0691 3.50428C52.3378 4.125 52.3812 4.80071 52.3812 5.46071C52.3812 5.86928 52.1679 7.91214 51.6583 7.91214V7.91607Z" fill="#000020" fill-opacity="0.1"/>
|
|
331
|
+
<path d="M62.7239 5.1268C61.9022 5.05608 60.7249 4.77322 60.0889 4.23894C60.0059 4.16822 59.8637 4.07001 59.8637 3.9443C59.8637 3.90108 59.8795 3.83037 59.9348 3.83037C60.0889 3.83037 61.0805 4.62001 61.9338 4.62001C63.0123 4.62001 64 3.78715 64 2.69108C64 0.887867 61.5941 0.157152 60.1324 0.157152C57.9635 0.157152 56.3516 1.5518 56.3516 3.76358C56.3516 4.24287 56.4227 4.90287 56.7783 5.27215C56.9482 5.4568 57.2326 5.4568 57.4578 5.4568C58.3072 5.4568 59.3857 5.72394 59.836 6.49787C59.8795 6.56858 59.919 6.68251 59.919 6.76501C59.919 6.79251 59.919 6.83572 59.8914 6.82001C59.8084 6.79251 59.7373 6.7218 59.678 6.6668C59.1802 6.18751 58.5007 5.70822 57.7817 5.70822C56.7032 5.70822 56.324 6.73751 56.324 7.63715C56.324 9.45215 57.9674 10.4539 59.6385 10.4539C61.6217 10.4539 64 9.15751 64 6.94572C64 6.12858 63.6444 5.21322 62.7239 5.13072V5.1268Z" fill="#000020" fill-opacity="0.1"/>
|
|
332
|
+
</svg>`,V=class extends F{constructor(...e){super(...e),this.events={click:`onClick`}}get styleSheets(){return[ye]}onClick(e){e.target.closest(`.bar__send`)&&this.handleSend()}setupEffects(){let e=null,t=null;this.addEffect(()=>{let t=this.gridStore.replyingTo.value;if(t&&t!==e){let e=this.getElement(`pop-comment-input`);e&&setTimeout(()=>e.focus(),0)}e=t}),this.addEffect(()=>{let e=this.gridStore.editingComment.value;if(e&&e.id!==t){let t=this.getElement(`pop-comment-input`);t&&(t.setValue(e.body),setTimeout(()=>t.focus(),0))}else if(!e&&t){let e=this.getElement(`pop-comment-input`);e&&e.clear()}t=e?.id??null}),this.addEffect(()=>{let e=p.value,t=this.getElement(`.bar__user`);if(!t)return;let n=this.gridStore.replyingToComment.value?.author;if(this.gridStore.editingComment.value){t.classList.remove(`has-reply`);let n=e?.id??e?.name??``;t.innerHTML=e?.image?`<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${n}"><img src="${e.image}" alt="${e.name??`User`}'s avatar"></pop-comment-avatar>`:`<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${n}">${B(e?.name)}</pop-comment-avatar>`}else if(n){t.classList.add(`has-reply`);let r=n.id??n.name??``,i=e?.id??e?.name??``;t.innerHTML=(n.image?`<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--reply" data-color-key="${r}"><img src="${n.image}" alt="${n.name??`User`}'s avatar"></pop-comment-avatar>`:`<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--reply" data-color-key="${r}">${B(n.name)}</pop-comment-avatar>`)+(e?.image?`<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${i}"><img src="${e.image}" alt="${e.name??`User`}'s avatar"></pop-comment-avatar>`:`<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${i}">${B(e?.name)}</pop-comment-avatar>`)}else{t.classList.remove(`has-reply`);let n=e?.id??e?.name??``;t.innerHTML=e?.image?`<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${n}"><img src="${e.image}" alt="${e.name??`User`}'s avatar"></pop-comment-avatar>`:`<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user" data-color-key="${n}">${B(e?.name)}</pop-comment-avatar>`}})}async handleSend(){let e=this.getElement(`pop-comment-input`);if(!e)return;let t=e.getValue().trim();if(!t)return;let n=this.gridStore.editingCommentId.value;if(n)e.clear(),this.gridStore.editingCommentId.value=null,await this.gridStore.editComment(n,t);else{e.clear();let n=await this.gridStore.postComment(t,this.gridStore.replyingTo.value??void 0);this.gridStore.replyingTo.value=null,n&&(this.gridStore.scrollingCommentId.value=n.id)}}getTemplate(){return`
|
|
333
|
+
<div class="logo-watermark">${be}</div>
|
|
334
|
+
<div class="bar">
|
|
335
|
+
<div class="bar__user">
|
|
336
|
+
<pop-comment-avatar size="xs" class="bar__avatar bar__avatar--user">?</pop-comment-avatar>
|
|
337
|
+
</div>
|
|
338
|
+
<div class="bar__input-wrap">
|
|
339
|
+
<pop-comment-input></pop-comment-input>
|
|
340
|
+
</div>
|
|
341
|
+
<button class="bar__send" type="button" aria-label="Send comment">
|
|
342
|
+
<pop-comment-icon theme="neutral" variant="send"></pop-comment-icon>
|
|
343
|
+
</button>
|
|
344
|
+
</div>
|
|
345
|
+
`}};I([S(E)],V.prototype,`gridStore`,void 0),customElements.get(`pop-comment-bar`)||customElements.define(`pop-comment-bar`,V);var xe=P(`
|
|
346
|
+
:host {
|
|
347
|
+
/* Mode-level theme colors (defaults for light mode) */
|
|
348
|
+
--pop-comment-color-black: #000000;
|
|
349
|
+
--pop-comment-color-white: #ffffff;
|
|
350
|
+
--pop-comment-color-default: #000000;
|
|
351
|
+
--pop-comment-color-reversed: #ffffff;
|
|
352
|
+
--pop-comment-bg-singular-resting: #121926;
|
|
353
|
+
--pop-comment-bg-singular-hover: rgba(0, 0, 32, 0.08);
|
|
354
|
+
--pop-comment-bg-reversed: #121926;
|
|
355
|
+
--pop-comment-bg-blank-resting: #ffffff;
|
|
426
356
|
|
|
427
|
-
|
|
428
|
-
<p>A verification code has been sent to your email. Enter code to continue.</p>
|
|
429
|
-
<p>
|
|
430
|
-
Code expires in
|
|
431
|
-
<pop-timestamp-countdown>${this.authContext?.verificationExpiresAt}</pop-timestamp-countdown>.
|
|
432
|
-
</p>
|
|
433
|
-
</div>
|
|
357
|
+
display: flex;
|
|
434
358
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
359
|
+
--pop-comment-icon-scale: 1;
|
|
360
|
+
--pop-comment-icon-scale-hover: 1.1875;
|
|
361
|
+
--pop-comment-icon-scale-active: 0.9375;
|
|
362
|
+
--pop-comment-icon-size: 32px;
|
|
363
|
+
--pop-comment-icon-color: var(--pop-foreground, #000000);
|
|
364
|
+
--pop-comment-icon-color-hover: var(--pop-foreground, #000000);
|
|
365
|
+
--pop-comment-icon-color-active: var(--pop-foreground, #000000);
|
|
366
|
+
--pop-comment-icon-color-focused: var(--pop-foreground, #000000);
|
|
367
|
+
--pop-comment-icon-background: var(
|
|
368
|
+
--color-surface-buttons-singular-bg-launch-icon-hover,
|
|
369
|
+
rgba(0, 0, 32, 0.08)
|
|
370
|
+
);
|
|
371
|
+
--pop-comment-icon-background-hover: var(
|
|
372
|
+
--color-surface-buttons-singular-bg-launch-icon-hover,
|
|
373
|
+
rgba(0, 0, 32, 0.08)
|
|
374
|
+
);
|
|
375
|
+
--pop-comment-icon-background-active: var(
|
|
376
|
+
--color-surface-buttons-singular-bg-launch-icon-hover,
|
|
377
|
+
rgba(0, 0, 32, 0.08)
|
|
378
|
+
);
|
|
379
|
+
--pop-comment-icon-background-focused: var(
|
|
380
|
+
--color-surface-buttons-singular-bg-launch-icon-hover,
|
|
381
|
+
rgba(0, 0, 32, 0.08)
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
@media (prefers-color-scheme: dark) {
|
|
386
|
+
:host {
|
|
387
|
+
/* Overrides for dark mode */
|
|
388
|
+
--pop-comment-color-black: #ffffff;
|
|
389
|
+
--pop-comment-color-white: #000000;
|
|
390
|
+
--pop-comment-color-default: #ffffff;
|
|
391
|
+
--pop-comment-color-reversed: #000000;
|
|
392
|
+
--pop-comment-bg-singular-resting: #ffffff;
|
|
393
|
+
--pop-comment-bg-singular-hover: rgba(255, 255, 255, 0.15);
|
|
394
|
+
--pop-comment-bg-reversed: #ffffff;
|
|
395
|
+
--pop-comment-bg-blank-resting: #121926;
|
|
396
|
+
}
|
|
465
397
|
}
|
|
466
398
|
|
|
467
|
-
.
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
399
|
+
:host(.dark) {
|
|
400
|
+
/* Overrides for dark mode (.dark class on host) */
|
|
401
|
+
--pop-comment-color-black: #ffffff;
|
|
402
|
+
--pop-comment-color-white: #000000;
|
|
403
|
+
--pop-comment-color-default: #ffffff;
|
|
404
|
+
--pop-comment-color-reversed: #000000;
|
|
405
|
+
--pop-comment-bg-singular-resting: #ffffff;
|
|
406
|
+
--pop-comment-bg-singular-hover: rgba(255, 255, 255, 0.15);
|
|
407
|
+
--pop-comment-bg-reversed: #ffffff;
|
|
408
|
+
--pop-comment-bg-blank-resting: #121926;
|
|
474
409
|
}
|
|
475
410
|
|
|
476
|
-
.comment-
|
|
411
|
+
.comment-icon {
|
|
412
|
+
align-items: center;
|
|
413
|
+
background: transparent;
|
|
414
|
+
border: none;
|
|
415
|
+
display: inline-flex;
|
|
416
|
+
height: var(--pop-comment-icon-size);
|
|
417
|
+
justify-content: center;
|
|
418
|
+
padding: 0;
|
|
477
419
|
position: relative;
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
gap: 6px;
|
|
481
|
-
align-items: start;
|
|
482
|
-
transition: all var(--duration-quick) var(--ease-quick);
|
|
483
|
-
}
|
|
484
|
-
.comment-bar--has-content {
|
|
485
|
-
grid-template-columns: auto 1fr 32px;
|
|
420
|
+
transform-origin: center;
|
|
421
|
+
width: var(--pop-comment-icon-size);
|
|
486
422
|
}
|
|
487
423
|
|
|
488
|
-
.comment-
|
|
489
|
-
|
|
490
|
-
align-items: center;
|
|
491
|
-
padding-top: 2px;
|
|
424
|
+
.comment-icon--size-sm {
|
|
425
|
+
--pop-comment-icon-size: 24px;
|
|
492
426
|
}
|
|
493
427
|
|
|
494
|
-
.comment-
|
|
495
|
-
|
|
428
|
+
.comment-icon:disabled {
|
|
429
|
+
cursor: not-allowed;
|
|
430
|
+
opacity: 0.5;
|
|
496
431
|
}
|
|
497
432
|
|
|
498
|
-
.comment-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
transform:
|
|
433
|
+
.comment-icon__focus-indicator {
|
|
434
|
+
display: none;
|
|
435
|
+
height: calc(100% + 3px);
|
|
436
|
+
inset: -1.5px;
|
|
437
|
+
transform-origin: center;
|
|
438
|
+
transform: scale(var(--pop-comment-icon-scale));
|
|
439
|
+
transition: all 200ms ease-out;
|
|
440
|
+
width: calc(100% + 3px);
|
|
503
441
|
}
|
|
504
442
|
|
|
505
|
-
.comment-
|
|
506
|
-
|
|
507
|
-
right: 0;
|
|
508
|
-
bottom: 0.5px;
|
|
509
|
-
transition: opacity var(--duration-150) var(--ease-linear);
|
|
510
|
-
opacity: 0;
|
|
443
|
+
.comment-icon:focus-visible .comment-icon__focus-indicator {
|
|
444
|
+
display: flex;
|
|
511
445
|
}
|
|
512
|
-
|
|
513
|
-
|
|
446
|
+
|
|
447
|
+
.comment-icon:focus-visible {
|
|
448
|
+
outline: none;
|
|
514
449
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
<div class="comment-bar__actions">
|
|
521
|
-
<div>
|
|
522
|
-
<div class="comment-bar__avatars">
|
|
523
|
-
<pop-comment-avatar size="xs" style="--comment-avatar-border-size: 2px">
|
|
524
|
-
<img src="https://i.pravatar.cc/90" alt="User avatar" />
|
|
525
|
-
</pop-comment-avatar>
|
|
526
|
-
<pop-comment-avatar size="xs" style="--comment-avatar-border-size: 2px">
|
|
527
|
-
<img src="https://i.pravatar.cc/100" alt="User avatar" />
|
|
528
|
-
</pop-comment-avatar>
|
|
529
|
-
</div>
|
|
530
|
-
</div>
|
|
531
|
-
<pop-comment-input></pop-comment-input>
|
|
532
|
-
<pop-comment-icon class="comment-bar__send-icon" theme="neutral" variant="send" size="sm"></pop-comment-icon>
|
|
533
|
-
</div>
|
|
534
|
-
</div>
|
|
535
|
-
`}};T.styles=[l(T,T,"styles"),ee],T=i([(0,ae.customElement)("pop-comment-bar")],T);var se=T;var B=require("@floating-ui/dom"),lt=require("@lit/context"),pe=require("@popgrids/ui"),tt=require("@tiptap/core"),ce=Q(require("@tiptap/extension-document"),1),me=require("@tiptap/extension-mention"),ue=Q(require("@tiptap/extension-paragraph"),1),fe=Q(require("@tiptap/extension-placeholder"),1),he=Q(require("@tiptap/extension-text"),1),ge=Q(require("@tiptap/extension-typography"),1),dt=require("lit"),V=require("lit/decorators.js"),xe=require("lit/directives/class-map.js");var oe=require("@lit/context"),w=(0,oe.createContext)(Symbol("pop-grid-context"));var le=require("lit"),de=le.css`
|
|
536
|
-
:host {
|
|
450
|
+
|
|
451
|
+
.comment-icon__inner {
|
|
452
|
+
align-items: center;
|
|
453
|
+
background: var(--pop-comment-icon-background);
|
|
454
|
+
color: var(--pop-comment-icon-color);
|
|
537
455
|
display: flex;
|
|
538
|
-
|
|
456
|
+
flex-direction: column;
|
|
457
|
+
flex-shrink: 0;
|
|
458
|
+
height: var(--pop-comment-icon-size);
|
|
459
|
+
justify-content: center;
|
|
460
|
+
position: absolute;
|
|
461
|
+
transform-origin: center;
|
|
462
|
+
transition: all 200ms ease-out;
|
|
463
|
+
transform: scale(var(--pop-comment-icon-scale));
|
|
464
|
+
width: var(--pop-comment-icon-size);
|
|
539
465
|
}
|
|
540
466
|
|
|
541
|
-
.comment-
|
|
467
|
+
.comment-icon__icon-container {
|
|
468
|
+
align-items: center;
|
|
542
469
|
display: flex;
|
|
543
|
-
|
|
470
|
+
height: 100%;
|
|
544
471
|
justify-content: center;
|
|
545
|
-
|
|
472
|
+
transition: transform ease-out 150ms;
|
|
546
473
|
width: 100%;
|
|
547
|
-
padding-top: 4px;
|
|
548
|
-
padding-right: 8px;
|
|
549
|
-
padding-bottom: 4px;
|
|
550
|
-
padding-left: 12px;
|
|
551
|
-
background-color: var(--color-surface-alpha-singular-alpha-input-bar);
|
|
552
|
-
transition: all var(--duration-quick) var(--ease-quick);
|
|
553
|
-
border-radius: 18px;
|
|
554
|
-
min-height: 36px;
|
|
555
|
-
flex: 1 0 0;
|
|
556
474
|
}
|
|
557
475
|
|
|
558
|
-
.comment-
|
|
559
|
-
|
|
560
|
-
|
|
476
|
+
.comment-icon__icon-container svg {
|
|
477
|
+
width: calc(var(--pop-comment-icon-size) * 0.6875);
|
|
478
|
+
height: calc(var(--pop-comment-icon-size) * 0.6875);
|
|
561
479
|
}
|
|
562
480
|
|
|
563
|
-
.comment-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
align-items: flex-end;
|
|
567
|
-
gap: 2px;
|
|
568
|
-
flex: 1 0 0;
|
|
569
|
-
font-size: var(--text-widget-base);
|
|
570
|
-
line-height: var(--text-widget-base--line-height);
|
|
571
|
-
letter-spacing: var(--text-widget-base--letter-spacing);
|
|
572
|
-
white-space: pre-wrap;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
.tiptap__editor {
|
|
576
|
-
color: var(--color-text-text-default);
|
|
577
|
-
font-size: var(--text-widget-base);
|
|
578
|
-
line-height: var(--text-widget-base--line-height);
|
|
579
|
-
letter-spacing: var(--text-widget-base--letter-spacing);
|
|
580
|
-
max-height: 264px;
|
|
581
|
-
outline: none;
|
|
582
|
-
overflow-y: auto;
|
|
583
|
-
position: relative;
|
|
584
|
-
width: 100%;
|
|
481
|
+
.comment-icon--variant-close.comment-icon--theme-neutral .comment-icon__icon-container svg {
|
|
482
|
+
width: var(--pop-comment-icon-size);
|
|
483
|
+
height: var(--pop-comment-icon-size);
|
|
585
484
|
}
|
|
586
485
|
|
|
587
|
-
.
|
|
588
|
-
|
|
589
|
-
|
|
486
|
+
.comment-icon__icon-image {
|
|
487
|
+
display: flex;
|
|
488
|
+
width: var(--pop-comment-icon-size);
|
|
489
|
+
height: var(--pop-comment-icon-size);
|
|
590
490
|
}
|
|
591
491
|
|
|
592
|
-
.
|
|
593
|
-
|
|
594
|
-
border-radius: var(--radius-sm);
|
|
595
|
-
border: 1px solid var(--color-border-border-edge-strong);
|
|
596
|
-
box-shadow: var(--shadow-lg);
|
|
597
|
-
position: absolute;
|
|
598
|
-
z-index: 1000;
|
|
599
|
-
transition: opacity 0.1s ease-in-out;
|
|
492
|
+
.comment-icon__icon {
|
|
493
|
+
display: flex;
|
|
600
494
|
}
|
|
601
495
|
|
|
602
|
-
.
|
|
603
|
-
|
|
604
|
-
display: flex;
|
|
605
|
-
flex-direction: column;
|
|
606
|
-
list-style: none;
|
|
607
|
-
margin: 0;
|
|
608
|
-
padding: var(--spacing-sm);
|
|
496
|
+
.comment-icon__icon-image + .comment-icon__icon {
|
|
497
|
+
display: none;
|
|
609
498
|
}
|
|
610
499
|
|
|
611
|
-
|
|
612
|
-
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
font-weight: 400;
|
|
627
|
-
gap: 12px;
|
|
628
|
-
padding: 8px;
|
|
500
|
+
@media (hover: hover) and (pointer: fine) {
|
|
501
|
+
.comment-icon:hover .comment-icon__inner {
|
|
502
|
+
background: var(--pop-comment-icon-background-hover);
|
|
503
|
+
color: var(--pop-comment-icon-color-hover);
|
|
504
|
+
transition: transform var(--pop-ease-pop-hover) var(--pop-duration-pop-hover);
|
|
505
|
+
transform: scale(var(--pop-comment-icon-scale-hover));
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.comment-icon:hover .comment-icon__icon-image {
|
|
509
|
+
display: none;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.comment-icon:hover .comment-icon__icon-image + .comment-icon__icon {
|
|
513
|
+
display: flex;
|
|
514
|
+
}
|
|
629
515
|
}
|
|
630
516
|
|
|
631
|
-
.
|
|
632
|
-
background:
|
|
517
|
+
.comment-icon:active .comment-icon__inner {
|
|
518
|
+
background: var(--pop-comment-icon-background-active);
|
|
519
|
+
color: var(--pop-comment-icon-color-active);
|
|
520
|
+
transform: scale(var(--pop-comment-icon-scale-active));
|
|
521
|
+
transition-duration: 100ms;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.comment-icon:is(:focus-visible) .comment-icon__inner {
|
|
525
|
+
background: var(--pop-comment-icon-background-focused);
|
|
526
|
+
color: var(--pop-comment-icon-color-focused);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/* Brand / Add */
|
|
530
|
+
.comment-icon--theme-brand.comment-icon--variant-add {
|
|
531
|
+
--pop-comment-icon-color: var(--pop-comment-color-black);
|
|
532
|
+
--pop-comment-icon-color-hover: var(--pop-comment-color-black);
|
|
533
|
+
--pop-comment-icon-color-active: var(--pop-comment-color-black);
|
|
534
|
+
--pop-comment-icon-color-focused: var(--pop-comment-color-black);
|
|
535
|
+
--pop-comment-icon-background: transparent;
|
|
536
|
+
--pop-comment-icon-background-hover: var(--pop-comment-bg-singular-hover);
|
|
537
|
+
--pop-comment-icon-background-active: var(--pop-comment-bg-singular-hover);
|
|
538
|
+
--pop-comment-icon-background-focused: transparent;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/* Brand / Close */
|
|
542
|
+
.comment-icon--theme-brand.comment-icon--variant-close {
|
|
543
|
+
--pop-comment-icon-color: var(--pop-comment-color-white);
|
|
544
|
+
--pop-comment-icon-color-hover: var(--pop-comment-color-white);
|
|
545
|
+
--pop-comment-icon-color-active: var(--pop-comment-color-white);
|
|
546
|
+
--pop-comment-icon-color-focused: var(--pop-comment-color-white);
|
|
547
|
+
--pop-comment-icon-background: var(--pop-comment-bg-singular-resting);
|
|
548
|
+
--pop-comment-icon-background-hover: var(--pop-comment-bg-singular-resting);
|
|
549
|
+
--pop-comment-icon-background-active: var(--pop-comment-bg-singular-resting);
|
|
550
|
+
--pop-comment-icon-background-focused: var(--pop-comment-bg-singular-resting);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/* Neutral / Add */
|
|
554
|
+
.comment-icon--theme-neutral.comment-icon--variant-add {
|
|
555
|
+
--pop-comment-icon-color: var(--pop-comment-color-white);
|
|
556
|
+
--pop-comment-icon-color-hover: var(--pop-comment-color-black);
|
|
557
|
+
--pop-comment-icon-color-active: var(--pop-comment-color-black);
|
|
558
|
+
--pop-comment-icon-color-focused: var(--pop-comment-color-white);
|
|
559
|
+
--pop-comment-icon-background: var(--pop-comment-bg-singular-resting);
|
|
560
|
+
--pop-comment-icon-background-hover: var(--pop-comment-bg-singular-hover);
|
|
561
|
+
--pop-comment-icon-background-active: var(--pop-comment-bg-singular-hover);
|
|
562
|
+
--pop-comment-icon-background-focused: var(--pop-comment-bg-singular-resting);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/* Neutral / Close */
|
|
566
|
+
.comment-icon--theme-neutral.comment-icon--variant-close {
|
|
567
|
+
--pop-comment-icon-color: var(--pop-comment-color-white);
|
|
568
|
+
--pop-comment-icon-color-hover: var(--pop-comment-color-white);
|
|
569
|
+
--pop-comment-icon-color-active: var(--pop-comment-color-white);
|
|
570
|
+
--pop-comment-icon-color-focused: var(--pop-comment-color-white);
|
|
571
|
+
--pop-comment-icon-background: var(--pop-comment-bg-singular-resting);
|
|
572
|
+
--pop-comment-icon-background-hover: var(--pop-comment-bg-singular-resting);
|
|
573
|
+
--pop-comment-icon-background-active: var(--pop-comment-bg-singular-resting);
|
|
574
|
+
--pop-comment-icon-background-focused: var(--pop-comment-bg-singular-resting);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/* Neutral / Send */
|
|
578
|
+
.comment-icon--theme-neutral.comment-icon--variant-send {
|
|
579
|
+
--pop-comment-icon-color: var(--pop-comment-color-reversed);
|
|
580
|
+
--pop-comment-icon-color-hover: var(--pop-comment-color-reversed);
|
|
581
|
+
--pop-comment-icon-color-active: var(--pop-comment-color-reversed);
|
|
582
|
+
--pop-comment-icon-color-focused: var(--pop-comment-color-reversed);
|
|
583
|
+
--pop-comment-icon-background: var(--pop-comment-bg-reversed);
|
|
584
|
+
--pop-comment-icon-background-hover: var(--pop-comment-bg-reversed);
|
|
585
|
+
--pop-comment-icon-background-active: var(--pop-comment-bg-reversed);
|
|
586
|
+
--pop-comment-icon-background-focused: var(--pop-comment-bg-reversed);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/* Neutral / More */
|
|
590
|
+
.comment-icon--theme-neutral.comment-icon--variant-more {
|
|
591
|
+
--pop-comment-icon-color: var(--pop-comment-color-default);
|
|
592
|
+
--pop-comment-icon-color-hover: var(--pop-comment-color-reversed);
|
|
593
|
+
--pop-comment-icon-color-active: var(--pop-comment-color-default);
|
|
594
|
+
--pop-comment-icon-color-focused: var(--pop-comment-color-default);
|
|
595
|
+
--pop-comment-icon-background: var(--pop-comment-bg-blank-resting);
|
|
596
|
+
--pop-comment-icon-background-hover: var(--pop-comment-bg-reversed);
|
|
597
|
+
--pop-comment-icon-background-active: var(--pop-comment-bg-blank-resting);
|
|
598
|
+
--pop-comment-icon-background-focused: var(--pop-comment-bg-blank-resting);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/* Neutral / Cancel */
|
|
602
|
+
.comment-icon--theme-neutral.comment-icon--variant-cancel {
|
|
603
|
+
--pop-comment-icon-color: var(--pop-comment-color-default);
|
|
604
|
+
--pop-comment-icon-color-hover: var(--pop-comment-color-default);
|
|
605
|
+
--pop-comment-icon-color-active: var(--pop-comment-color-reversed);
|
|
606
|
+
--pop-comment-icon-color-focused: var(--pop-comment-color-default);
|
|
607
|
+
--pop-comment-icon-background: var(--pop-comment-bg-blank-resting);
|
|
608
|
+
--pop-comment-icon-background-hover: var(--pop-comment-bg-blank-resting);
|
|
609
|
+
--pop-comment-icon-background-active: var(--pop-comment-bg-reversed);
|
|
610
|
+
--pop-comment-icon-background-focused: var(--pop-comment-bg-blank-resting);
|
|
611
|
+
}
|
|
612
|
+
`),Se=class extends F{constructor(...e){super(...e),this.events={click:`onClick`}}get styleSheets(){return[xe]}static get observedAttributes(){return[`counter`,`icon-url`,`size`,`theme`,`variant`,`type`,`disabled`]}onCounterChanged(){this.render()}onIconUrlChanged(){this.render()}onSizeChanged(){this.render()}onThemeChanged(){this.render()}onVariantChanged(){this.render()}onTypeChanged(){this.render()}onDisabledChanged(){this.render()}get counter(){return Number(this.getAttribute(`counter`)||`0`)}set counter(e){this.setAttribute(`counter`,String(e))}get iconUrl(){return this.getAttribute(`icon-url`)||void 0}set iconUrl(e){e===void 0?this.removeAttribute(`icon-url`):this.setAttribute(`icon-url`,e)}get size(){return this.getAttribute(`size`)||`md`}set size(e){this.setAttribute(`size`,e)}get theme(){return this.getAttribute(`theme`)||`brand`}set theme(e){this.setAttribute(`theme`,e)}get variant(){return this.getAttribute(`variant`)||`add`}set variant(e){this.setAttribute(`variant`,e)}get type(){return this.getAttribute(`type`)||`button`}set type(e){this.setAttribute(`type`,e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}onClick(e){if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}this.emit(`pop-click`)}get icon(){let e=``;return this.theme===`brand`?this.variant===`add`?e=`
|
|
613
|
+
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
614
|
+
<path
|
|
615
|
+
d="M11 4.58331V17.4166M4.58333 11H17.4167"
|
|
616
|
+
stroke="currentColor"
|
|
617
|
+
stroke-width="1.5"
|
|
618
|
+
stroke-linecap="round"
|
|
619
|
+
stroke-linejoin="round"
|
|
620
|
+
/>
|
|
621
|
+
</svg>
|
|
622
|
+
`:this.variant===`close`&&(e=`
|
|
623
|
+
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
624
|
+
<path
|
|
625
|
+
d="M16.5 5.5L5.5 16.5M5.5 5.5L16.5 16.5"
|
|
626
|
+
stroke="currentColor"
|
|
627
|
+
stroke-width="1.5"
|
|
628
|
+
stroke-linecap="round"
|
|
629
|
+
stroke-linejoin="round"
|
|
630
|
+
/>
|
|
631
|
+
</svg>
|
|
632
|
+
`):this.theme===`neutral`&&(this.variant===`add`?e=`
|
|
633
|
+
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
634
|
+
<path
|
|
635
|
+
d="M11.0002 4.58301V17.4163M4.5835 10.9997H17.4168"
|
|
636
|
+
stroke="currentColor"
|
|
637
|
+
stroke-width="1.5"
|
|
638
|
+
stroke-linecap="round"
|
|
639
|
+
stroke-linejoin="round"
|
|
640
|
+
/>
|
|
641
|
+
</svg>
|
|
642
|
+
`:this.variant===`close`?e=`
|
|
643
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
644
|
+
<path
|
|
645
|
+
d="M11.4628 11.4627L20.5373 20.5373M11.4628 20.5373L20.5373 11.4627"
|
|
646
|
+
stroke="currentColor"
|
|
647
|
+
stroke-width="1.5"
|
|
648
|
+
stroke-linecap="round"
|
|
649
|
+
stroke-linejoin="round"
|
|
650
|
+
/>
|
|
651
|
+
</svg>
|
|
652
|
+
`:this.variant===`more`?e=`
|
|
653
|
+
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
654
|
+
<path
|
|
655
|
+
d="M12.8335 16.5L7.3335 11L12.8335 5.5"
|
|
656
|
+
stroke="currentColor"
|
|
657
|
+
stroke-width="1.5"
|
|
658
|
+
stroke-linecap="round"
|
|
659
|
+
stroke-linejoin="round"
|
|
660
|
+
/>
|
|
661
|
+
</svg>
|
|
662
|
+
`:this.variant===`send`?e=`
|
|
663
|
+
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
664
|
+
<path
|
|
665
|
+
d="M18.0394 3.68048C18.2139 3.61601 18.3837 3.78583 18.3193 3.96036L12.3858 20.0241C12.314 20.2185 12.0369 20.2123 11.9739 20.0149L9.89172 13.4908C9.86908 13.4199 9.88424 13.3423 9.93191 13.2851L14.4838 7.82287C14.6536 7.61906 14.3807 7.34616 14.1769 7.516L8.71467 12.0678C8.65746 12.1155 8.57987 12.1307 8.50893 12.108L1.98489 10.0259C1.78743 9.96287 1.78121 9.68575 1.97565 9.61393L18.0394 3.68048Z"
|
|
666
|
+
fill="currentColor"
|
|
667
|
+
/>
|
|
668
|
+
</svg>
|
|
669
|
+
`:this.variant===`cancel`&&(e=`
|
|
670
|
+
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
671
|
+
<path
|
|
672
|
+
d="M16.5 5.5L5.5 16.5M5.5 5.5L16.5 16.5"
|
|
673
|
+
stroke="currentColor"
|
|
674
|
+
stroke-width="1.5"
|
|
675
|
+
stroke-linecap="round"
|
|
676
|
+
stroke-linejoin="round"
|
|
677
|
+
/>
|
|
678
|
+
</svg>
|
|
679
|
+
`)),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 src="${this.iconUrl}" alt="" class="comment-icon__icon-image" />
|
|
680
|
+
<slot class="comment-icon__icon" name="icon">${this.icon}</slot>`:`<slot class="comment-icon__icon" name="icon">${this.icon}</slot>`;return`
|
|
681
|
+
<button
|
|
682
|
+
class="${t}"
|
|
683
|
+
part="base"
|
|
684
|
+
type="${this.type}"
|
|
685
|
+
${e}
|
|
686
|
+
>
|
|
687
|
+
<pop-focus-indicator class="comment-icon__focus-indicator"></pop-focus-indicator>
|
|
688
|
+
<div class="comment-icon__inner mask mask-squircle">
|
|
689
|
+
<div class="comment-icon__icon-container" part="icon">${n}</div>
|
|
690
|
+
</div>
|
|
691
|
+
</button>
|
|
692
|
+
`}};customElements.get(`pop-comment-icon`)||customElements.define(`pop-comment-icon`,Se);var Ce=P(`
|
|
693
|
+
:host {
|
|
694
|
+
display: flex;
|
|
695
|
+
flex: 1;
|
|
696
|
+
min-width: 0;
|
|
697
|
+
align-items: flex-end;
|
|
633
698
|
}
|
|
634
699
|
|
|
635
|
-
|
|
636
|
-
|
|
700
|
+
textarea {
|
|
701
|
+
flex: 1;
|
|
702
|
+
min-width: 0;
|
|
703
|
+
background: none;
|
|
704
|
+
border: none;
|
|
705
|
+
outline: none;
|
|
706
|
+
resize: none;
|
|
707
|
+
font-family: Inter, sans-serif;
|
|
708
|
+
font-size: 13px;
|
|
709
|
+
color: black;
|
|
710
|
+
line-height: 18px;
|
|
711
|
+
padding: 5px 0;
|
|
712
|
+
max-height: 200px;
|
|
713
|
+
overflow-y: auto;
|
|
714
|
+
width: 100%;
|
|
715
|
+
letter-spacing: -0.08px;
|
|
637
716
|
}
|
|
638
717
|
|
|
639
|
-
|
|
640
|
-
color:
|
|
641
|
-
content: attr(data-placeholder);
|
|
642
|
-
float: left;
|
|
643
|
-
height: 0;
|
|
644
|
-
pointer-events: none;
|
|
718
|
+
textarea::placeholder {
|
|
719
|
+
color: #697586;
|
|
645
720
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
>
|
|
650
|
-
<div class="comment-input__input"></div>
|
|
651
|
-
${this._error?dt.html`<div class="comment-input__error">${this._error.message}</div>`:""}
|
|
652
|
-
</div>`}};m.styles=[l(m,m,"styles"),de],i([(0,lt.consume)({context:$,subscribe:!0})],m.prototype,"apiState",2),i([(0,lt.consume)({context:w,subscribe:!0})],m.prototype,"gridContext",2),i([(0,V.property)({type:String})],m.prototype,"variant",2),i([(0,V.query)(".comment-input__input")],m.prototype,"_editor",2),i([(0,V.state)()],m.prototype,"_content",2),i([(0,V.state)()],m.prototype,"_error",2),m=i([(0,V.customElement)("pop-comment-input")],m);var ve=m;var Ce=require("@lit/context"),we=require("@popgrids/ui"),et=require("lit"),it=require("lit/decorators.js"),Se=require("lit/directives/class-map.js"),ke=require("lit/directives/when.js");var ye=require("lit"),be=ye.css`
|
|
721
|
+
`),H=class extends F{constructor(...e){super(...e),this.events={input:`onInput`,keydown:`onKeyDown`}}get styleSheets(){return[Ce]}onInput(e){let t=e.target;t.style.height=`auto`,t.style.height=`${t.scrollHeight}px`}onKeyDown(e){e.key===`Escape`&&(this.gridStore.editingCommentId.value||this.gridStore.replyingTo.value)&&(e.stopPropagation(),this.gridStore.editingCommentId.value=null,this.gridStore.replyingTo.value=null)}getValue(){return this.getElement(`textarea`)?.value??``}setValue(e){let t=this.getElement(`textarea`);t&&(t.value=e,t.style.height=`auto`,t.style.height=`${t.scrollHeight}px`)}clear(){let e=this.getElement(`textarea`);e&&(e.value=``,e.style.height=`auto`)}focus(){this.getElement(`textarea`)?.focus()}setupEffects(){this.addEffect(()=>{let e=this.gridStore.replyingToComment.value,t=this.gridStore.editingComment.value,n=`Comment`;t?n=`Edit comment...`:e?.author?.name&&(n=`Reply to ${e.author.name}`),this.setAttr(`textarea`,`placeholder`,n)})}getTemplate(){return`
|
|
722
|
+
<textarea rows="1" placeholder="Comment"></textarea>
|
|
723
|
+
`}};I([S(E)],H.prototype,`gridStore`,void 0),customElements.get(`pop-comment-input`)||customElements.define(`pop-comment-input`,H);var we=P(`
|
|
653
724
|
:host {
|
|
654
725
|
display: block;
|
|
726
|
+
|
|
727
|
+
--pop-thread-link: rgba(0, 0, 32, 0.5);
|
|
728
|
+
--pop-thread-link-hover: rgba(0, 0, 32, 0.8);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
@media (prefers-color-scheme: dark) {
|
|
732
|
+
:host {
|
|
733
|
+
--pop-thread-link: rgba(255, 255, 255, 0.5);
|
|
734
|
+
--pop-thread-link-hover: rgba(255, 255, 255, 0.8);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
:host(.dark) {
|
|
739
|
+
--pop-thread-link: rgba(255, 255, 255, 0.5);
|
|
740
|
+
--pop-thread-link-hover: rgba(255, 255, 255, 0.8);
|
|
655
741
|
}
|
|
656
742
|
|
|
657
|
-
.
|
|
743
|
+
.thread {
|
|
744
|
+
align-items: stretch;
|
|
745
|
+
display: flex;
|
|
746
|
+
flex-direction: column;
|
|
747
|
+
gap: 12px;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
.thread__replies {
|
|
751
|
+
align-items: center;
|
|
658
752
|
display: flex;
|
|
659
753
|
flex-direction: column;
|
|
660
|
-
align-items: stretch;
|
|
661
754
|
gap: 12px;
|
|
755
|
+
padding-left: 24px;
|
|
662
756
|
}
|
|
663
757
|
|
|
664
|
-
.
|
|
758
|
+
.thread__more {
|
|
759
|
+
display: flex;
|
|
760
|
+
align-items: center;
|
|
761
|
+
font-size: 13px;
|
|
762
|
+
gap: 6px;
|
|
763
|
+
padding-left: 30px;
|
|
764
|
+
transition: opacity 0.15s ease;
|
|
765
|
+
width: 100%;
|
|
665
766
|
}
|
|
666
767
|
|
|
667
|
-
.
|
|
768
|
+
.thread__more:hover {
|
|
769
|
+
opacity: 1;
|
|
668
770
|
}
|
|
669
771
|
|
|
670
|
-
.
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
772
|
+
.thread__more-dot {
|
|
773
|
+
width: 4px;
|
|
774
|
+
height: 4px;
|
|
775
|
+
border-radius: 50%;
|
|
776
|
+
background: var(--pop-muted-foreground);
|
|
777
|
+
flex-shrink: 0;
|
|
778
|
+
opacity: 0.1;
|
|
779
|
+
}
|
|
780
|
+
`),U=2,W=class extends F{constructor(...e){super(...e),this._showAll=!1,this.events={click:`onClick`}}get styleSheets(){return[we]}onClick(e){e.target.closest(`.thread__more-btn`)&&(this._showAll=!0,this.render())}setupEffects(){this.addEffect(()=>{let e=this.getAttribute(`comment-id`),t=this.gridStore.scrollingCommentId.value;e&&t&&this.gridStore.repliesFor(e).some(e=>e.id===t)&&(this._showAll=!0),this.gridStore.comments.value,this.render()})}getTemplate(){let e=this.getAttribute(`comment-id`);if(!e)return``;let t=this.gridStore.repliesFor(e),n=this._showAll||t.length<=U?t:t.slice(0,U),r=t.length-n.length,i=r>0?`<div class="thread__more">
|
|
781
|
+
<div class="thread__more-dot"></div>
|
|
782
|
+
<button class="thread__more-btn btn-link btn-link--size-sm btn-link--theme-default" type="button">
|
|
783
|
+
Show ${r} more ${r===1?`reply`:`replies`}
|
|
784
|
+
</button>
|
|
785
|
+
</div>`:``;return`
|
|
786
|
+
<div class="thread">
|
|
787
|
+
<pop-comment comment-id="${e}"></pop-comment>
|
|
788
|
+
${t.length>0?`<div class="thread__replies">
|
|
789
|
+
${n.map(e=>`<pop-comment comment-id="${e.id}"></pop-comment>`).join(``)}
|
|
790
|
+
${i}
|
|
791
|
+
</div>`:``}
|
|
687
792
|
</div>
|
|
688
|
-
`}};
|
|
793
|
+
`}};I([S(E)],W.prototype,`gridStore`,void 0),customElements.get(`pop-comment-thread`)||customElements.define(`pop-comment-thread`,W);function G(e){let t=e instanceof Date?e:new Date(e),n=(Date.now()-t.getTime())/1e3;return n<1?`now`:n<60?`${Math.floor(n)}s`:n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:n<604800?`${Math.floor(n/86400)}d`:`${Math.floor(n/604800)}w`}var Te=P(`
|
|
689
794
|
:host {
|
|
690
795
|
display: block;
|
|
796
|
+
width: 100%;
|
|
797
|
+
--pop-comment-hover: rgba(0, 0, 32, 0.04);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
@media (prefers-color-scheme: dark) {
|
|
801
|
+
:host {
|
|
802
|
+
--pop-comment-hover: rgba(255, 255, 255, 0.04);
|
|
803
|
+
}
|
|
691
804
|
}
|
|
692
805
|
|
|
693
806
|
.comment {
|
|
694
807
|
display: flex;
|
|
695
808
|
width: 100%;
|
|
809
|
+
gap: 8px;
|
|
696
810
|
align-items: center;
|
|
697
811
|
background-color: transparent;
|
|
698
|
-
|
|
699
812
|
border: none;
|
|
700
813
|
padding: 0;
|
|
701
|
-
border-radius: var(--radius-md);
|
|
814
|
+
border-radius: var(--pop-radius-md);
|
|
702
815
|
outline: 6px solid transparent;
|
|
816
|
+
text-align: left;
|
|
703
817
|
transition:
|
|
704
|
-
background-color
|
|
705
|
-
outline-color
|
|
818
|
+
background-color 150ms ease,
|
|
819
|
+
outline-color 150ms ease;
|
|
706
820
|
}
|
|
707
821
|
|
|
708
|
-
|
|
822
|
+
:host([data-size="sm"]) .comment,
|
|
823
|
+
:host:not([data-size]) .comment {
|
|
709
824
|
--avatar-size: 32px;
|
|
710
825
|
--width: 32px;
|
|
711
|
-
|
|
712
826
|
gap: 8px;
|
|
713
827
|
}
|
|
714
828
|
|
|
715
|
-
|
|
829
|
+
:host([data-size="lg"]) .comment {
|
|
716
830
|
--avatar-size: 56px;
|
|
717
831
|
--width: 56px;
|
|
718
|
-
|
|
719
832
|
gap: 12px;
|
|
720
833
|
}
|
|
721
834
|
|
|
722
835
|
.comment--is-selected {
|
|
723
|
-
background-color: var(--
|
|
724
|
-
outline-color: var(--
|
|
836
|
+
background-color: var(--pop-muted);
|
|
837
|
+
outline-color: var(--pop-muted);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
:host(.is-signed-in) .comment {
|
|
841
|
+
cursor: pointer;
|
|
725
842
|
}
|
|
726
843
|
|
|
727
844
|
@media (hover: hover) and (pointer: fine) {
|
|
728
845
|
.comment:hover .comment__avatar {
|
|
729
|
-
|
|
846
|
+
--avatar-translate-x: 2px;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
.comment__avatar:hover {
|
|
850
|
+
/* --avatar-scale: 1.06; */
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
.comment .comment__menu {
|
|
854
|
+
display: none;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
.comment:hover .comment__menu {
|
|
858
|
+
display: flex;
|
|
730
859
|
}
|
|
731
860
|
}
|
|
732
861
|
|
|
733
862
|
.comment--is-selected .comment__avatar {
|
|
734
|
-
|
|
863
|
+
--avatar-translate-x: 2px;
|
|
735
864
|
}
|
|
736
865
|
|
|
737
866
|
.comment__avatar {
|
|
738
|
-
--border-size: 0;
|
|
867
|
+
--comment-avatar-border-size: 0;
|
|
868
|
+
--avatar-translate-x: 0px;
|
|
869
|
+
--avatar-scale: 1;
|
|
739
870
|
width: var(--avatar-size);
|
|
740
871
|
height: var(--avatar-size);
|
|
872
|
+
transform: translateX(var(--avatar-translate-x)) scale(var(--avatar-scale));
|
|
873
|
+
transition: transform var(--pop-duration-quick) var(--pop-ease-quick);
|
|
741
874
|
}
|
|
742
875
|
|
|
743
876
|
.comment__user {
|
|
@@ -763,12 +896,45 @@
|
|
|
763
896
|
align-self: stretch;
|
|
764
897
|
}
|
|
765
898
|
|
|
899
|
+
.comment__menu {
|
|
900
|
+
display: flex;
|
|
901
|
+
justify-self: flex-end;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
.comment__menu-trigger {
|
|
905
|
+
background: none;
|
|
906
|
+
border: none;
|
|
907
|
+
cursor: pointer;
|
|
908
|
+
border-radius: 9999px;
|
|
909
|
+
aspect-ratio: 1;
|
|
910
|
+
position: relative;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
.comment__menu-trigger:before {
|
|
914
|
+
content: "";
|
|
915
|
+
height: 40px;
|
|
916
|
+
left: 50%;
|
|
917
|
+
position: absolute;
|
|
918
|
+
top: 50%;
|
|
919
|
+
transform: translate(-50%, -50%);
|
|
920
|
+
width: 40px;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
.comment__user-meta {
|
|
924
|
+
display: flex;
|
|
925
|
+
align-items: flex-start;
|
|
926
|
+
gap: 4px;
|
|
927
|
+
flex-shrink: 0;
|
|
928
|
+
align-self: stretch;
|
|
929
|
+
flex-grow: 1;
|
|
930
|
+
}
|
|
931
|
+
|
|
766
932
|
.comment__user-name {
|
|
767
|
-
color: var(--
|
|
933
|
+
color: var(--pop-foreground);
|
|
768
934
|
font-feature-settings:
|
|
769
935
|
"liga" off,
|
|
770
936
|
"clig" off;
|
|
771
|
-
font-family: Inter;
|
|
937
|
+
font-family: Inter, sans-serif;
|
|
772
938
|
font-size: var(--text-widget-base, 13px);
|
|
773
939
|
font-style: normal;
|
|
774
940
|
font-weight: 500;
|
|
@@ -777,31 +943,30 @@
|
|
|
777
943
|
}
|
|
778
944
|
|
|
779
945
|
.comment__timestamp {
|
|
780
|
-
color: var(--
|
|
946
|
+
color: var(--pop-muted-foreground);
|
|
781
947
|
font-feature-settings:
|
|
782
948
|
"liga" off,
|
|
783
949
|
"clig" off;
|
|
784
|
-
|
|
785
|
-
font-family: Inter;
|
|
950
|
+
font-family: Inter, sans-serif;
|
|
786
951
|
font-size: var(--text-widget-base, 13px);
|
|
787
952
|
font-style: normal;
|
|
788
953
|
font-weight: 400;
|
|
789
954
|
line-height: var(--text-widget-base--line-height, 18px);
|
|
790
955
|
letter-spacing: -0.08px;
|
|
956
|
+
opacity: 0.5;
|
|
791
957
|
}
|
|
792
958
|
|
|
793
959
|
.comment__text {
|
|
794
|
-
/* Base styles */
|
|
795
960
|
align-self: stretch;
|
|
796
|
-
color: var(--
|
|
961
|
+
color: var(--pop-foreground);
|
|
797
962
|
font-feature-settings:
|
|
798
963
|
"liga" off,
|
|
799
964
|
"clig" off;
|
|
800
|
-
font-family: Inter;
|
|
801
|
-
font-size:
|
|
965
|
+
font-family: Inter, sans-serif;
|
|
966
|
+
font-size: 13px;
|
|
802
967
|
font-style: normal;
|
|
803
968
|
font-weight: 400;
|
|
804
|
-
line-height:
|
|
969
|
+
line-height: 18px;
|
|
805
970
|
letter-spacing: -0.08px;
|
|
806
971
|
text-align: left;
|
|
807
972
|
|
|
@@ -812,85 +977,279 @@
|
|
|
812
977
|
overflow: hidden;
|
|
813
978
|
}
|
|
814
979
|
|
|
815
|
-
.comment__text.expanded
|
|
816
|
-
|
|
980
|
+
.comment__text.expanded,
|
|
981
|
+
.comment--is-selected .comment__text {
|
|
817
982
|
-webkit-line-clamp: initial;
|
|
818
983
|
display: block;
|
|
819
984
|
}
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
985
|
+
|
|
986
|
+
.comment__mention {
|
|
987
|
+
color: #155eef;
|
|
988
|
+
font-weight: 500;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
.comment__menu {
|
|
992
|
+
position: relative;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
.comment__dropdown {
|
|
996
|
+
background-color: var(--pop-background);
|
|
997
|
+
border-radius: 6px;
|
|
998
|
+
box-shadow: var(--pop-shadow-xl);
|
|
999
|
+
display: none;
|
|
1000
|
+
flex-direction: column;
|
|
1001
|
+
gap: 6px;
|
|
1002
|
+
padding: 6px;
|
|
1003
|
+
pointer-events: auto;
|
|
1004
|
+
position: fixed;
|
|
1005
|
+
width: 120px;
|
|
1006
|
+
z-index: 1000;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
.comment__dropdown.is-open {
|
|
1010
|
+
display: flex;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
.comment__dropdown-item {
|
|
1014
|
+
align-items: center;
|
|
1015
|
+
background: none;
|
|
1016
|
+
border-radius: 4px;
|
|
1017
|
+
border: none;
|
|
1018
|
+
color: var(--pop-foreground);
|
|
1019
|
+
cursor: pointer;
|
|
1020
|
+
display: flex;
|
|
1021
|
+
flex: 1 0 0;
|
|
1022
|
+
font-family: Inter, sans-serif;
|
|
1023
|
+
font-size: 14px;
|
|
1024
|
+
font-weight: 500;
|
|
1025
|
+
justify-content: center;
|
|
1026
|
+
min-height: 40px;
|
|
1027
|
+
padding: 0 12px;
|
|
1028
|
+
text-align: left;
|
|
1029
|
+
transition: background-color 100ms ease;
|
|
1030
|
+
width: 100%;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
.comment__dropdown-item:hover {
|
|
1034
|
+
background-color: var(--pop-comment-hover, rgba(0, 0, 0, 0.04));
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
.comment__dropdown-item--danger {
|
|
1038
|
+
color: #ef4444;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
.comment__edit-form {
|
|
1042
|
+
display: flex;
|
|
1043
|
+
flex-direction: column;
|
|
1044
|
+
width: 100%;
|
|
1045
|
+
gap: 8px;
|
|
1046
|
+
margin-top: 4px;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
.comment__edit-input {
|
|
1050
|
+
width: 100%;
|
|
1051
|
+
background: var(--pop-background, #ffffff);
|
|
1052
|
+
color: var(--pop-foreground, #000000);
|
|
1053
|
+
border: 1px solid var(--pop-border, #e4e4e7);
|
|
1054
|
+
border-radius: var(--pop-radius-sm, 4px);
|
|
1055
|
+
padding: 6px 8px;
|
|
1056
|
+
font-family: Inter, sans-serif;
|
|
1057
|
+
font-size: 13px;
|
|
1058
|
+
line-height: 18px;
|
|
1059
|
+
resize: vertical;
|
|
1060
|
+
outline: none;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
.comment__edit-input:focus {
|
|
1064
|
+
border-color: var(--pop-ring, #000020);
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
.comment__edit-actions {
|
|
1068
|
+
display: flex;
|
|
1069
|
+
gap: 8px;
|
|
1070
|
+
justify-content: flex-end;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
.comment__edit-save,
|
|
1074
|
+
.comment__edit-cancel {
|
|
1075
|
+
font-size: 12px;
|
|
1076
|
+
padding: 4px 8px;
|
|
1077
|
+
cursor: pointer;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
.comment--deleted .comment__text {
|
|
1081
|
+
color: var(--pop-muted-foreground, #697586);
|
|
1082
|
+
font-style: italic;
|
|
1083
|
+
opacity: 0.8;
|
|
1084
|
+
}
|
|
1085
|
+
`),K=class extends F{constructor(...e){super(...e),this.events={click:`onClick`},this._expanded=!1,this._dropdownOpen=!1,this._onOutsideClick=e=>{let t=e.composedPath(),n=this.getElement(`.comment__dropdown`),r=this.getElement(`.comment__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[Te]}toggleDropdown(){this._dropdownOpen?this.closeDropdown():this.openDropdown()}openDropdown(){this._dropdownOpen=!0;let e=this.getElement(`.comment__dropdown`),n=this.getElement(`.comment__menu-trigger`);if(e&&n){e.classList.add(`is-open`);let r=()=>{(0,t.computePosition)(n,e,{placement:`bottom-end`,middleware:[(0,t.offset)(4),(0,t.flip)(),(0,t.shift)({padding:8})],strategy:`fixed`}).then(({x:t,y:n})=>{Object.assign(e.style,{left:`${t}px`,top:`${n}px`,position:`fixed`})})};this._floatingCleanup=(0,t.autoUpdate)(n,e,r),document.addEventListener(`mousedown`,this._onOutsideClick)}}closeDropdown(){this._dropdownOpen=!1;let e=this.getElement(`.comment__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(`.comment__menu-trigger`)){e.stopPropagation(),this.toggleDropdown();return}let n=t.closest(`.comment__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(`.comment__dropdown`)){e.stopPropagation();return}if(!p.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(`.comment__text`);if(!this._expanded&&e){let t=e.offsetHeight;this._expanded=!0,this.render();let n=this.getElement(`.comment__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(`.comment__timestamp`);e&&(e.textContent=G(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(()=>{let e=this.getAttribute(`comment-id`),t=p.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 n=t.status===`deleted`,r=t.authorDeleted===!0,i=n||r,a=i?``:t.author?.image?`<img src="${t.author.image}" alt="${t.author.name??`User avatar`}" />`:B(t.author?.name),o=this.gridStore.replyingTo.value,s=e!==null&&o===e,c=this.size,l=p.value&&t.author&&p.value.id===t.author.id,u=p.value&&!n?`<div class="comment__menu">
|
|
1086
|
+
<button class="comment__menu-trigger" type="button">
|
|
1087
|
+
<svg
|
|
1088
|
+
width="18"
|
|
1089
|
+
height="18"
|
|
1090
|
+
viewBox="0 0 18 18"
|
|
1091
|
+
fill="none"
|
|
1092
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1093
|
+
>
|
|
1094
|
+
<path
|
|
1095
|
+
d="M9 9.5C9.27614 9.5 9.5 9.27614 9.5 9C9.5 8.72386 9.27614 8.5 9 8.5C8.72386 8.5 8.5 8.72386 8.5 9C8.5 9.27614 8.72386 9.5 9 9.5Z"
|
|
1096
|
+
fill="white"
|
|
1097
|
+
/>
|
|
1098
|
+
<path
|
|
1099
|
+
d="M12.5 9.5C12.7761 9.5 13 9.27614 13 9C13 8.72386 12.7761 8.5 12.5 8.5C12.2239 8.5 12 8.72386 12 9C12 9.27614 12.2239 9.5 12.5 9.5Z"
|
|
1100
|
+
fill="white"
|
|
1101
|
+
/>
|
|
1102
|
+
<path
|
|
1103
|
+
d="M5.5 9.5C5.77614 9.5 6 9.27614 6 9C6 8.72386 5.77614 8.5 5.5 8.5C5.22386 8.5 5 8.72386 5 9C5 9.27614 5.22386 9.5 5.5 9.5Z"
|
|
1104
|
+
fill="white"
|
|
1105
|
+
/>
|
|
1106
|
+
<path
|
|
1107
|
+
d="M9 9.5C9.27614 9.5 9.5 9.27614 9.5 9C9.5 8.72386 9.27614 8.5 9 8.5C8.72386 8.5 8.5 8.72386 8.5 9C8.5 9.27614 8.72386 9.5 9 9.5Z"
|
|
1108
|
+
stroke="#000020"
|
|
1109
|
+
stroke-opacity="0.5"
|
|
1110
|
+
stroke-linecap="round"
|
|
1111
|
+
stroke-linejoin="round"
|
|
1112
|
+
/>
|
|
1113
|
+
<path
|
|
1114
|
+
d="M12.5 9.5C12.7761 9.5 13 9.27614 13 9C13 8.72386 12.7761 8.5 12.5 8.5C12.2239 8.5 12 8.72386 12 9C12 9.27614 12.2239 9.5 12.5 9.5Z"
|
|
1115
|
+
stroke="#000020"
|
|
1116
|
+
stroke-opacity="0.5"
|
|
1117
|
+
stroke-linecap="round"
|
|
1118
|
+
stroke-linejoin="round"
|
|
1119
|
+
/>
|
|
1120
|
+
<path
|
|
1121
|
+
d="M5.5 9.5C5.77614 9.5 6 9.27614 6 9C6 8.72386 5.77614 8.5 5.5 8.5C5.22386 8.5 5 8.72386 5 9C5 9.27614 5.22386 9.5 5.5 9.5Z"
|
|
1122
|
+
stroke="#000020"
|
|
1123
|
+
stroke-opacity="0.5"
|
|
1124
|
+
stroke-linecap="round"
|
|
1125
|
+
stroke-linejoin="round"
|
|
1126
|
+
/>
|
|
1127
|
+
</svg>
|
|
1128
|
+
</button>
|
|
1129
|
+
<div class="comment__dropdown">
|
|
1130
|
+
${l?`<button class="comment__dropdown-item" type="button" data-action="edit">Edit</button>
|
|
1131
|
+
<button class="comment__dropdown-item comment__dropdown-item--danger" type="button" data-action="delete">Delete</button>`:``}
|
|
1132
|
+
<button class="comment__dropdown-item" type="button" data-action="flag">Flag</button>
|
|
1133
|
+
</div>
|
|
1134
|
+
</div>`:``;return`
|
|
1135
|
+
<div
|
|
1136
|
+
class="comment comment--size-${c}${s?` comment--is-selected`:``}${n?` comment--deleted`:``}"
|
|
1137
|
+
id="comment-${e}"
|
|
826
1138
|
>
|
|
827
1139
|
<div class="comment__user">
|
|
828
1140
|
<pop-comment-avatar
|
|
829
1141
|
class="comment__avatar"
|
|
830
|
-
size
|
|
831
|
-
|
|
1142
|
+
size="${this.commentAvatarSize}"
|
|
1143
|
+
data-color-key="${t.author?.id??t.author?.name??``}"
|
|
1144
|
+
${i?`deleted`:``}
|
|
832
1145
|
>
|
|
833
|
-
|
|
834
|
-
src=${(0,Le.ifDefined)(this.comment?.account?.avatar?.url)}
|
|
835
|
-
alt="${this.comment?.account?.name}'s avatar"
|
|
836
|
-
style=${(0,Ve.styleMap)({backgroundColor:this._randomColor})}
|
|
837
|
-
/>
|
|
1146
|
+
${a}
|
|
838
1147
|
</pop-comment-avatar>
|
|
839
1148
|
</div>
|
|
840
1149
|
<div class="comment__content">
|
|
841
1150
|
<div class="comment__info">
|
|
842
|
-
<div class="comment__user">
|
|
843
|
-
<div class="comment__user-name"
|
|
844
|
-
|
|
845
|
-
${this.comment?De(new Date(this.comment.createdAt??"")):""}
|
|
1151
|
+
<div class="comment__user-meta">
|
|
1152
|
+
<div class="comment__user-name">
|
|
1153
|
+
${n?`[Deleted]`:r?`[Deleted user]`:t.author?.name??``}
|
|
846
1154
|
</div>
|
|
1155
|
+
<div class="comment__timestamp">${G(t.createdAt)}</div>
|
|
847
1156
|
</div>
|
|
1157
|
+
${u}
|
|
848
1158
|
</div>
|
|
849
|
-
<div
|
|
850
|
-
class=${(0,pt.classMap)({comment__text:!0,expanded:this._expanded})}
|
|
851
|
-
>
|
|
852
|
-
${this.comment?.content}
|
|
853
|
-
</div>
|
|
1159
|
+
<div class="comment__text${this._expanded?` expanded`:``}">${t.body}</div>
|
|
854
1160
|
</div>
|
|
855
|
-
</
|
|
856
|
-
`}};
|
|
1161
|
+
</div>
|
|
1162
|
+
`}};I([S(E)],K.prototype,`gridStore`,void 0),customElements.get(`pop-comment`)||customElements.define(`pop-comment`,K);var Ee=P(`
|
|
857
1163
|
:host {
|
|
858
1164
|
display: flex;
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
border: 1px solid var(--color-border-singular-border-island, #fff);
|
|
866
|
-
box-shadow: var(--shadow-3xl);
|
|
867
|
-
display: grid;
|
|
868
|
-
grid-template-rows: 1fr 50px;
|
|
1165
|
+
background: var(--pop-background);
|
|
1166
|
+
border-radius: var(--pop-radius-2xl);
|
|
1167
|
+
border: 1px solid var(--pop-background);
|
|
1168
|
+
box-shadow: var(--pop-shadow-3xl);
|
|
1169
|
+
display: block;
|
|
1170
|
+
left: 0;
|
|
869
1171
|
max-height: 400px;
|
|
870
1172
|
max-width: 400px;
|
|
1173
|
+
min-width: 343px;
|
|
1174
|
+
opacity: 0;
|
|
871
1175
|
overflow: hidden;
|
|
872
|
-
|
|
1176
|
+
padding: 0 4px 0 0;
|
|
1177
|
+
pointer-events: none;
|
|
1178
|
+
position: fixed;
|
|
1179
|
+
top: 0;
|
|
1180
|
+
width: 100%;
|
|
1181
|
+
z-index: 9999;
|
|
1182
|
+
transform: scale(0.94);
|
|
1183
|
+
transition:
|
|
1184
|
+
opacity var(--pop-duration-quick) var(--pop-ease-quick),
|
|
1185
|
+
transform var(--pop-duration-quick) var(--pop-ease-quick),
|
|
1186
|
+
display var(--pop-duration-quick) allow-discrete;
|
|
873
1187
|
}
|
|
874
1188
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1189
|
+
:host([data-current-placement="top-start"]) {
|
|
1190
|
+
transform-origin: left bottom;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
:host([data-current-placement="bottom-start"]) {
|
|
1194
|
+
transform-origin: left top;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
:host([data-current-placement="top-end"]) {
|
|
1198
|
+
transform-origin: right bottom;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
:host([data-current-placement="bottom-end"]) {
|
|
1202
|
+
transform-origin: right top;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
:host([data-current-placement="top"]) {
|
|
1206
|
+
transform-origin: bottom;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
:host([data-current-placement="bottom"]) {
|
|
1210
|
+
transform-origin: top;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
:host([open]) {
|
|
1214
|
+
opacity: 1;
|
|
1215
|
+
pointer-events: auto;
|
|
1216
|
+
transform: scale(1);
|
|
1217
|
+
|
|
1218
|
+
@starting-style {
|
|
1219
|
+
display: flex;
|
|
1220
|
+
opacity: 0;
|
|
1221
|
+
transform: scale(0.94);
|
|
1222
|
+
}
|
|
880
1223
|
}
|
|
881
1224
|
|
|
882
|
-
.
|
|
1225
|
+
.feed {
|
|
1226
|
+
display: grid;
|
|
1227
|
+
grid-template-rows: 1fr 50px;
|
|
883
1228
|
}
|
|
884
1229
|
|
|
885
1230
|
.feed__content {
|
|
886
1231
|
align-items: flex-start;
|
|
887
1232
|
align-self: stretch;
|
|
888
1233
|
display: flex;
|
|
889
|
-
gap:
|
|
1234
|
+
gap: 8px;
|
|
890
1235
|
min-height: 80px;
|
|
891
1236
|
max-height: 290px;
|
|
892
|
-
|
|
893
|
-
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
.feed__empty {
|
|
1240
|
+
padding: 24px 16px 24px 8px;
|
|
1241
|
+
text-align: center;
|
|
1242
|
+
font-family: Inter, sans-serif;
|
|
1243
|
+
font-size: 13px;
|
|
1244
|
+
color: var(--pop-muted-foreground);
|
|
1245
|
+
line-height: 18px;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
.feed__footer {
|
|
1249
|
+
position: absolute;
|
|
1250
|
+
bottom: 0;
|
|
1251
|
+
min-height: 50px;
|
|
1252
|
+
width: 100%;
|
|
894
1253
|
}
|
|
895
1254
|
|
|
896
1255
|
.feed__main {
|
|
@@ -899,173 +1258,208 @@
|
|
|
899
1258
|
display: flex;
|
|
900
1259
|
flex-direction: column;
|
|
901
1260
|
flex: 1 0 0;
|
|
902
|
-
gap:
|
|
1261
|
+
gap: 16px;
|
|
903
1262
|
min-height: 100%;
|
|
1263
|
+
overflow: hidden auto;
|
|
1264
|
+
padding: 8px 10px 8px 8px;
|
|
904
1265
|
}
|
|
905
1266
|
|
|
906
|
-
.
|
|
907
|
-
|
|
1267
|
+
.feed__main::-webkit-scrollbar {
|
|
1268
|
+
width: 4px;
|
|
908
1269
|
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
1270
|
+
|
|
1271
|
+
.feed__main::-webkit-scrollbar-track {
|
|
1272
|
+
background: transparent;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
.feed__main::-webkit-scrollbar-thumb {
|
|
1276
|
+
background: var(--pop-border);
|
|
1277
|
+
border-radius: 100px;
|
|
1278
|
+
}
|
|
1279
|
+
`),q=class extends F{constructor(...e){super(...e),this._footerChild=null,this._wasOpen=!1}get styleSheets(){return[Ee]}connectedCallback(){super.connectedCallback(),document.addEventListener(`mousedown`,this),document.addEventListener(`keydown`,this)}disconnectedCallback(){document.removeEventListener(`mousedown`,this),document.removeEventListener(`keydown`,this),super.disconnectedCallback()}handleEvent(e){if(e.type===`mousedown`){this.onOutsideClick(e);return}if(e.type===`keydown`){this.onKeyDown(e);return}super.handleEvent(e)}onOutsideClick(e){if(!this.gridStore.open.value)return;let t=e.composedPath(),n=this.getRootNode(),r=n instanceof ShadowRoot?n.host:null;!t.includes(this)&&(!r||!t.includes(r))&&(this.gridStore.open.value=!1)}onKeyDown(e){e.key===`Escape`&&(this.gridStore.open.value=!1)}setupEffects(){this.addEffect(()=>{let e=this.gridStore.open.value;e&&!this._wasOpen&&this.gridStore.grid.value&&v(this.gridStore.apiUrl,this.gridStore.publicKey),this._wasOpen=e,this.update()})}update(){this.gridStore.open.value?this.setAttribute(`open`,``):this.removeAttribute(`open`);let e=this.getElement(`.feed__main`);if(e){let t=this.gridStore.topLevelComments.value;if(t.length===0)e.querySelector(`.feed__empty`)||(e.innerHTML=`<div class="feed__empty">Waiting for your thoughts…</div>`);else{let n=Array.from(e.querySelectorAll(`pop-comment-thread`)).map(e=>e.getAttribute(`comment-id`)),r=t.map(e=>e.id);(n.length!==r.length||n.some((e,t)=>e!==r[t]))&&(e.innerHTML=t.map(e=>`<pop-comment-thread comment-id="${e.id}"></pop-comment-thread>`).join(``))}}let t=this.getElement(`.feed__footer`);if(t){let e=p.value===null?`pop-auth-panel`:`pop-comment-bar`;this._footerChild!==e&&(this._footerChild=e,t.innerHTML=`<${e}></${e}>`)}}getTemplate(){return`
|
|
1280
|
+
<div class="feed">
|
|
914
1281
|
<div class="feed__content">
|
|
915
|
-
<div class="feed__main">
|
|
916
|
-
${this.gridContext.comments.map(t=>R.html`<pop-comment-thread id=${t.id}></pop-comment-thread> `)}
|
|
917
|
-
</div>
|
|
918
|
-
</div>
|
|
919
|
-
<div class="feed__footer">
|
|
920
|
-
${this.authContext?.isAuthenticated?R.html`<pop-comment-bar class="feed__comment-bar"></pop-comment-bar>`:R.html` <pop-auth-panel class="feed__auth-panel"></pop-auth-panel> `}
|
|
1282
|
+
<div class="feed__main"></div>
|
|
921
1283
|
</div>
|
|
1284
|
+
<div class="feed__footer"></div>
|
|
922
1285
|
</div>
|
|
923
|
-
|
|
924
|
-
:host {
|
|
925
|
-
display: flex;
|
|
926
|
-
align-items: center;
|
|
927
|
-
}
|
|
928
|
-
`;var C=class extends Fe.PopElement{constructor(){super(...arguments);this.apiUrl="https://api.popgrids.com";this.gridId=""}render(){return Ze.html`
|
|
929
|
-
<pop-api-provider api-url=${this.apiUrl}>
|
|
930
|
-
<pop-grid-provider id=${this.gridId}>
|
|
931
|
-
<pop-auth-provider>
|
|
932
|
-
<pop-widget></pop-widget>
|
|
933
|
-
</pop-auth-provider>
|
|
934
|
-
</pop-grid-provider>
|
|
935
|
-
</pop-api-provider>
|
|
936
|
-
`}};C.styles=[l(C,C,"styles"),Je],i([(0,P.property)({type:String,attribute:"api-url",reflect:!0})],C.prototype,"apiUrl",2),i([(0,P.property)({type:String,attribute:"data-grid-id"})],C.prototype,"gridId",2),C=i([(0,P.customElement)("pop-grid")],C);var Ge=C;customElements.get("pop-grid")||customElements.define("pop-grid",C);function Ye(){let n=document.querySelectorAll("pop-grid[grid-id]:not([initialized])");for(let a of Array.from(n)){let t=a.getAttribute("grid-id");t&&(a.setAttribute("data-grid-id",t),a.setAttribute("initialized","true"))}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ye):Ye();var D=require("@floating-ui/dom"),ei=require("@lit/context"),ii=require("@popgrids/ui");function bi(){return typeof window<"u"}function Pe(n){var a;return(n==null||(a=n.ownerDocument)==null?void 0:a.defaultView)||window}function Ci(n){return bi()?n instanceof Element||n instanceof Pe(n).Element:!1}function We(n){let a=wi(),t=Ci(n)?Si(n):n;return["transform","translate","scale","rotate","perspective"].some(e=>t[e]?t[e]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!a&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!a&&(t.filter?t.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(e=>(t.willChange||"").includes(e))||["paint","layout","strict","content"].some(e=>(t.contain||"").includes(e))}function wi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Si(n){return Pe(n).getComputedStyle(n)}function Xe(n){return ki(n)}function mt(n){return n.assignedSlot?n.assignedSlot:n.parentNode instanceof ShadowRoot?n.parentNode.host:n.parentNode}function ki(n){for(let a=n;a;a=mt(a))if(a instanceof Element&&getComputedStyle(a).display==="none")return null;for(let a=mt(n);a;a=mt(a)){if(!(a instanceof Element))continue;let t=getComputedStyle(a);if(t.display!=="contents"&&(t.position!=="static"||We(t)||a.tagName==="BODY"))return a}return null}var W=require("lit"),U=require("lit/decorators.js"),ut=require("lit/directives/class-map.js"),ri=require("lit/directives/if-defined.js");var Oe=require("lit"),ti=Oe.css`
|
|
1286
|
+
`}};I([S(E)],q.prototype,`gridStore`,void 0),customElements.get(`pop-feed`)||customElements.define(`pop-feed`,q);function De(){return typeof window<`u`}function J(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Oe(e){return De()?e instanceof Element||e instanceof J(e).Element:!1}var ke=/transform|translate|scale|rotate|perspective|filter/,Ae=/paint|layout|strict|content/,Y=e=>!!e&&e!==`none`,X;function je(e){let t=Oe(e)?Ne(e):e;return Y(t.transform)||Y(t.translate)||Y(t.scale)||Y(t.rotate)||Y(t.perspective)||!Me()&&(Y(t.backdropFilter)||Y(t.filter))||ke.test(t.willChange||``)||Ae.test(t.contain||``)}function Me(){return X??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),X}function Ne(e){return J(e).getComputedStyle(e)}function Pe(e){return Fe(e)}function Z(e){return e.assignedSlot?e.assignedSlot:e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode}function Fe(e){for(let t=e;t;t=Z(t))if(t instanceof Element&&getComputedStyle(t).display===`none`)return null;for(let t=Z(e);t;t=Z(t)){if(!(t instanceof Element))continue;let e=getComputedStyle(t);if(e.display!==`contents`&&(e.position!==`static`||je(e)||t.tagName===`BODY`))return t}return null}var Q=`https://www.popgrids.io`,Ie=P(`
|
|
937
1287
|
:host {
|
|
938
1288
|
display: block;
|
|
1289
|
+
position: relative;
|
|
939
1290
|
}
|
|
940
1291
|
|
|
941
|
-
.grid
|
|
1292
|
+
.grid {
|
|
942
1293
|
display: flex;
|
|
943
1294
|
height: 100%;
|
|
944
1295
|
position: relative;
|
|
945
1296
|
width: 100%;
|
|
946
1297
|
}
|
|
947
1298
|
|
|
948
|
-
.grid
|
|
1299
|
+
.grid--align-start {
|
|
949
1300
|
justify-content: flex-start;
|
|
950
1301
|
}
|
|
951
1302
|
|
|
952
|
-
.grid
|
|
1303
|
+
.grid--align-center {
|
|
953
1304
|
justify-content: center;
|
|
954
1305
|
}
|
|
955
1306
|
|
|
956
|
-
.grid
|
|
1307
|
+
.grid--align-end {
|
|
957
1308
|
justify-content: flex-end;
|
|
958
1309
|
}
|
|
1310
|
+
`),Le=class extends F{constructor(...e){super(...e),this._initialized=!1}get styleSheets(){return[Ie]}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`)??Q,n=this.getAttribute(`data-page-url`)??this.getAttribute(`page-url`)??location.href,r=this.getAttribute(`data-id`);this._store=new E({apiUrl:t,publicKey:e,pageUrl:n,externalId:r}),x(this,this._store),super.connectedCallback(),this._store.load().then(n=>{n&&v(t,e)})}disconnectedCallback(){this._floatingCleanup?.(),this._store.destroy(),ne(this),super.disconnectedCallback()}setupEffects(){this.addEffect(()=>{let e=this._store.grid.value,t=this.getElement(`.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.icon&&t.classList.add(`grid--icon-${e.icon}`),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 n=this.getElement(`pop-widget`),r=this.getElement(`pop-feed`);if(!n||!r)return;let i=this._store.grid.value;if(!i)return;let a=[];a=[(0,t.offset)({mainAxis:i.position===`down`?-16:-54,crossAxis:-18})],(!i.position||i.position===`auto`)&&a.push((0,t.flip)({fallbackPlacements:[`bottom-start`,`top-start`],fallbackStrategy:`bestFit`,padding:16}));let o=e=>t.platform.getOffsetParent(e,Pe),s=()=>{(0,t.computePosition)(n,r,{placement:i.position===`down`?`bottom-start`:`top-start`,middleware:a,strategy:`fixed`,platform:{...t.platform,getOffsetParent:o}}).then(({x:e,y:t,placement:n})=>{r.setAttribute(`data-current-placement`,n),Object.assign(r.style,{left:`${e}px`,top:`${t}px`})})};this._floatingCleanup=(0,t.autoUpdate)(n,r,s)})}getTemplate(){return`
|
|
1311
|
+
<div class="grid">
|
|
1312
|
+
<pop-widget></pop-widget>
|
|
1313
|
+
<pop-feed></pop-feed>
|
|
1314
|
+
</div>
|
|
1315
|
+
`}};customElements.get(`pop-grid`)||customElements.define(`pop-grid`,Le);var Re=P(`
|
|
1316
|
+
:host {
|
|
1317
|
+
--error-badge-bg: #fef2f2;
|
|
1318
|
+
--error-badge-text: #991b1b;
|
|
1319
|
+
--error-badge-border: #fecaca;
|
|
959
1320
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
display: none;
|
|
966
|
-
opacity: 0;
|
|
967
|
-
transform: scale(0.94);
|
|
968
|
-
transition:
|
|
969
|
-
opacity var(--duration-quick) var(--ease-quick),
|
|
970
|
-
transform var(--duration-quick) var(--ease-quick),
|
|
971
|
-
display var(--duration-quick) allow-discrete;
|
|
1321
|
+
display: inline-flex;
|
|
1322
|
+
align-items: center;
|
|
1323
|
+
cursor: pointer;
|
|
1324
|
+
user-select: none;
|
|
1325
|
+
-webkit-user-select: none;
|
|
972
1326
|
}
|
|
973
1327
|
|
|
974
|
-
|
|
975
|
-
|
|
1328
|
+
@media (prefers-color-scheme: dark) {
|
|
1329
|
+
:host {
|
|
1330
|
+
--error-badge-bg: #450a0a;
|
|
1331
|
+
--error-badge-text: #fca5a5;
|
|
1332
|
+
--error-badge-border: #7f1d1d;
|
|
1333
|
+
}
|
|
976
1334
|
}
|
|
977
1335
|
|
|
978
|
-
.
|
|
979
|
-
|
|
1336
|
+
:host(.dark) {
|
|
1337
|
+
--error-badge-bg: #450a0a;
|
|
1338
|
+
--error-badge-text: #fca5a5;
|
|
1339
|
+
--error-badge-border: #7f1d1d;
|
|
980
1340
|
}
|
|
981
1341
|
|
|
982
|
-
|
|
983
|
-
|
|
1342
|
+
:host([data-error]) {
|
|
1343
|
+
cursor: default;
|
|
984
1344
|
}
|
|
985
1345
|
|
|
986
|
-
.
|
|
987
|
-
|
|
1346
|
+
.error-badge {
|
|
1347
|
+
display: inline-flex;
|
|
1348
|
+
align-items: center;
|
|
1349
|
+
padding: 2px 10px;
|
|
1350
|
+
border-radius: var(--pop-radius-full);
|
|
1351
|
+
border: 1px solid var(--error-badge-border);
|
|
1352
|
+
background: var(--error-badge-bg);
|
|
1353
|
+
color: var(--error-badge-text);
|
|
1354
|
+
font-size: 12px;
|
|
1355
|
+
font-weight: 500;
|
|
1356
|
+
line-height: 16px;
|
|
1357
|
+
white-space: nowrap;
|
|
988
1358
|
}
|
|
989
1359
|
|
|
990
|
-
.
|
|
991
|
-
|
|
1360
|
+
.widget {
|
|
1361
|
+
display: inline-flex;
|
|
1362
|
+
align-items: flex-start;
|
|
992
1363
|
}
|
|
993
1364
|
|
|
994
|
-
.
|
|
995
|
-
|
|
1365
|
+
.widget > :not([hidden]) ~ :not([hidden]) {
|
|
1366
|
+
margin-left: -6px;
|
|
996
1367
|
}
|
|
997
1368
|
|
|
998
|
-
.
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1369
|
+
.skeleton {
|
|
1370
|
+
width: 32px;
|
|
1371
|
+
height: 32px;
|
|
1372
|
+
background: var(--pop-muted);
|
|
1373
|
+
animation: pulse 1.5s ease-in-out infinite;
|
|
1374
|
+
}
|
|
1002
1375
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1376
|
+
@keyframes pulse {
|
|
1377
|
+
0%,
|
|
1378
|
+
100% {
|
|
1379
|
+
opacity: 1;
|
|
1380
|
+
}
|
|
1381
|
+
50% {
|
|
1382
|
+
opacity: 0.5;
|
|
1007
1383
|
}
|
|
1008
1384
|
}
|
|
1009
1385
|
|
|
1010
|
-
.
|
|
1386
|
+
.count {
|
|
1387
|
+
--count-size: calc(32px + var(--count-border-size));
|
|
1388
|
+
--count-background: var(--pop-background);
|
|
1389
|
+
--count-border-color: rgba(0 0 32 / 16%);
|
|
1390
|
+
--count-border-size: 1px;
|
|
1391
|
+
--count-color: var(--pop-foreground);
|
|
1392
|
+
|
|
1011
1393
|
align-items: center;
|
|
1394
|
+
background-color: var(--pop-background);
|
|
1012
1395
|
display: flex;
|
|
1013
|
-
|
|
1014
|
-
|
|
1396
|
+
flex-shrink: 0;
|
|
1397
|
+
justify-content: center;
|
|
1398
|
+
padding: calc(var(--count-border-size) / 2);
|
|
1399
|
+
position: relative;
|
|
1400
|
+
z-index: 10;
|
|
1015
1401
|
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
align-items: flex-start;
|
|
1402
|
+
width: calc(var(--count-size) + (calc(var(--count-border-size))));
|
|
1403
|
+
height: calc(var(--count-size) + (calc(var(--count-border-size))));
|
|
1019
1404
|
}
|
|
1020
1405
|
|
|
1021
|
-
.
|
|
1022
|
-
|
|
1406
|
+
.count__background {
|
|
1407
|
+
background-color: var(--count-border-color);
|
|
1408
|
+
position: absolute;
|
|
1409
|
+
top: 0;
|
|
1410
|
+
left: 0;
|
|
1411
|
+
z-index: 10;
|
|
1412
|
+
width: 100%;
|
|
1413
|
+
height: 100%;
|
|
1023
1414
|
}
|
|
1024
1415
|
|
|
1025
|
-
.
|
|
1026
|
-
|
|
1027
|
-
|
|
1416
|
+
.count__content {
|
|
1417
|
+
align-items: center;
|
|
1418
|
+
background: var(--count-background);
|
|
1419
|
+
display: flex;
|
|
1420
|
+
justify-content: center;
|
|
1421
|
+
overflow: hidden;
|
|
1422
|
+
height: var(--count-size);
|
|
1423
|
+
width: var(--count-size);
|
|
1028
1424
|
}
|
|
1029
1425
|
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1426
|
+
.count__label {
|
|
1427
|
+
color: var(--count-color);
|
|
1428
|
+
font-size: 16px;
|
|
1429
|
+
font-style: normal;
|
|
1430
|
+
font-weight: 500;
|
|
1431
|
+
letter-spacing: -0.96px;
|
|
1432
|
+
line-height: 28px;
|
|
1433
|
+
text-align: center;
|
|
1434
|
+
user-select: none;
|
|
1036
1435
|
}
|
|
1037
1436
|
|
|
1038
|
-
.
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
<div
|
|
1064
|
-
class=${(0,ut.classMap)({"grid-widget__feed":!0,"grid-widget__feed--open":this._open})}
|
|
1065
|
-
part="feed"
|
|
1066
|
-
>
|
|
1067
|
-
<pop-feed ?open=${this._open}></pop-feed>
|
|
1437
|
+
.count__label-container {
|
|
1438
|
+
align-items: center;
|
|
1439
|
+
background: var(--pop-background);
|
|
1440
|
+
display: flex;
|
|
1441
|
+
height: calc(100% - calc(var(--count-border-size) * 2));
|
|
1442
|
+
justify-content: center;
|
|
1443
|
+
position: relative;
|
|
1444
|
+
text-indent: calc(calc(var(--count-border-size) * 2) * -1);
|
|
1445
|
+
width: calc(100% - calc(var(--count-border-size) * 2));
|
|
1446
|
+
z-index: 20;
|
|
1447
|
+
}
|
|
1448
|
+
`),$=class extends F{constructor(...e){super(...e),this.events={click:`onClick`}}get styleSheets(){return[Re]}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;return`
|
|
1449
|
+
<div class="widget">
|
|
1450
|
+
${e.map((t,n)=>{let r=e.length+n,i=t?.id??t?.name??``;return t?.image?`<pop-comment-avatar size="xs" style="z-index: ${r}" data-color-key="${i}">
|
|
1451
|
+
<img src="${t.image}" alt="${t.name??`User`}" />
|
|
1452
|
+
</pop-comment-avatar>`:`<pop-comment-avatar size="xs" style="z-index: ${r}" data-color-key="${i}">
|
|
1453
|
+
${B(t?.name)}
|
|
1454
|
+
</pop-comment-avatar>`}).join(``)}
|
|
1455
|
+
<div class="count mask mask-squircle">
|
|
1456
|
+
<span class="count__content mask mask-squircle">
|
|
1457
|
+
<div class="count__background mask mask-squircle"></div>
|
|
1458
|
+
<div class="count__label-container mask mask-squircle">
|
|
1459
|
+
<div class="count__label">${t}</div>
|
|
1460
|
+
</div>
|
|
1461
|
+
</span>
|
|
1068
1462
|
</div>
|
|
1069
1463
|
</div>
|
|
1070
|
-
|
|
1464
|
+
`}};if(I([S(E)],$.prototype,`gridStore`,void 0),customElements.get(`pop-widget`)||customElements.define(`pop-widget`,$),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)}}
|
|
1071
1465
|
//# sourceMappingURL=index.cjs.map
|