nostr-components 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +334 -0
- package/dist/assets/base-styles-CBypR3FR.js +145 -0
- package/dist/assets/base-styles-CBypR3FR.js.map +1 -0
- package/dist/assets/copy-delegation-C4uvRTVM.js +15 -0
- package/dist/assets/copy-delegation-C4uvRTVM.js.map +1 -0
- package/dist/assets/dialog-component-Dqg0QU9I.js +66 -0
- package/dist/assets/dialog-component-Dqg0QU9I.js.map +1 -0
- package/dist/assets/dialog-likers-BzTesCZa.js +238 -0
- package/dist/assets/dialog-likers-BzTesCZa.js.map +1 -0
- package/dist/assets/icons-Dr_d9MII.js +105 -0
- package/dist/assets/icons-Dr_d9MII.js.map +1 -0
- package/dist/assets/nip05-utils-BNBHUmkr.js +2 -0
- package/dist/assets/nip05-utils-BNBHUmkr.js.map +1 -0
- package/dist/assets/nostr-service-pr_crY62.js +78 -0
- package/dist/assets/nostr-service-pr_crY62.js.map +1 -0
- package/dist/assets/nostr-user-component-Q7GeeFyu.js +2 -0
- package/dist/assets/nostr-user-component-Q7GeeFyu.js.map +1 -0
- package/dist/assets/preload-helper-D7HrI6pR.js +2 -0
- package/dist/assets/preload-helper-D7HrI6pR.js.map +1 -0
- package/dist/assets/pure-jrVhRVpB.js +2 -0
- package/dist/assets/pure-jrVhRVpB.js.map +1 -0
- package/dist/assets/theme-C1r1Zw8r.js +2 -0
- package/dist/assets/theme-C1r1Zw8r.js.map +1 -0
- package/dist/assets/user-resolver-C-E6KdwY.js +2 -0
- package/dist/assets/user-resolver-C-E6KdwY.js.map +1 -0
- package/dist/assets/utils--bxLbhGF.js +2 -0
- package/dist/assets/utils--bxLbhGF.js.map +1 -0
- package/dist/assets/zap-utils-B1sz0Abx.js +2 -0
- package/dist/assets/zap-utils-B1sz0Abx.js.map +1 -0
- package/dist/components/nostr-comment.es.js +924 -0
- package/dist/components/nostr-comment.es.js.map +1 -0
- package/dist/components/nostr-dm.es.js +217 -0
- package/dist/components/nostr-dm.es.js.map +1 -0
- package/dist/components/nostr-follow-button.es.js +103 -0
- package/dist/components/nostr-follow-button.es.js.map +1 -0
- package/dist/components/nostr-like.es.js +296 -0
- package/dist/components/nostr-like.es.js.map +1 -0
- package/dist/components/nostr-live-chat.es.js +523 -0
- package/dist/components/nostr-live-chat.es.js.map +1 -0
- package/dist/components/nostr-post.es.js +441 -0
- package/dist/components/nostr-post.es.js.map +1 -0
- package/dist/components/nostr-profile-badge.es.js +100 -0
- package/dist/components/nostr-profile-badge.es.js.map +1 -0
- package/dist/components/nostr-profile.es.js +287 -0
- package/dist/components/nostr-profile.es.js.map +1 -0
- package/dist/components/nostr-zap.es.js +694 -0
- package/dist/components/nostr-zap.es.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/nostr-comment.d.ts +4 -0
- package/dist/nostr-components.es.js +2 -0
- package/dist/nostr-components.es.js.map +1 -0
- package/dist/nostr-components.umd.js +4200 -0
- package/dist/nostr-components.umd.js.map +1 -0
- package/dist/nostr-dm.d.ts +4 -0
- package/dist/nostr-follow-button.d.ts +4 -0
- package/dist/nostr-like.d.ts +4 -0
- package/dist/nostr-live-chat.d.ts +4 -0
- package/dist/nostr-post.d.ts +4 -0
- package/dist/nostr-profile-badge.d.ts +4 -0
- package/dist/nostr-profile.d.ts +4 -0
- package/dist/nostr-zap.d.ts +4 -0
- package/dist/src/base/base-component/nostr-base-component.d.ts +116 -0
- package/dist/src/base/copy-delegation.d.ts +5 -0
- package/dist/src/base/dialog-component/dialog-component.d.ts +67 -0
- package/dist/src/base/dialog-component/style.d.ts +5 -0
- package/dist/src/base/event-component/nostr-event-component.d.ts +53 -0
- package/dist/src/base/render-options.d.ts +5 -0
- package/dist/src/base/resolvers/event-resolver.d.ts +20 -0
- package/dist/src/base/resolvers/user-resolver.d.ts +19 -0
- package/dist/src/base/text-row/render-name.d.ts +7 -0
- package/dist/src/base/text-row/render-nip05.d.ts +1 -0
- package/dist/src/base/text-row/render-npub.d.ts +1 -0
- package/dist/src/base/text-row/render-text-row.d.ts +9 -0
- package/dist/src/base/user-component/nostr-user-component.d.ts +43 -0
- package/dist/src/common/base-styles.d.ts +44 -0
- package/dist/src/common/constants.d.ts +4 -0
- package/dist/src/common/date-utils.d.ts +9 -0
- package/dist/src/common/icons.d.ts +7 -0
- package/dist/src/common/nip05-utils.d.ts +13 -0
- package/dist/src/common/nostr-service.d.ts +40 -0
- package/dist/src/common/theme.d.ts +4 -0
- package/dist/src/common/types.d.ts +1 -0
- package/dist/src/common/utils.d.ts +34 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/nostr-comment/nostr-comment.d.ts +60 -0
- package/dist/src/nostr-comment/render.d.ts +15 -0
- package/dist/src/nostr-comment/utils.d.ts +81 -0
- package/dist/src/nostr-dm/nostr-dm.d.ts +34 -0
- package/dist/src/nostr-dm/render.d.ts +15 -0
- package/dist/src/nostr-follow-button/nostr-follow-button.d.ts +24 -0
- package/dist/src/nostr-follow-button/render.d.ts +11 -0
- package/dist/src/nostr-follow-button/style.d.ts +1 -0
- package/dist/src/nostr-like/dialog-help-style.d.ts +1 -0
- package/dist/src/nostr-like/dialog-help.d.ts +2 -0
- package/dist/src/nostr-like/dialog-likers-style.d.ts +1 -0
- package/dist/src/nostr-like/dialog-likers.d.ts +24 -0
- package/dist/src/nostr-like/like-utils.d.ts +52 -0
- package/dist/src/nostr-like/nostr-like.d.ts +49 -0
- package/dist/src/nostr-like/render.d.ts +10 -0
- package/dist/src/nostr-like/style.d.ts +1 -0
- package/dist/src/nostr-live-chat/nostr-live-chat.d.ts +65 -0
- package/dist/src/nostr-live-chat/render.d.ts +31 -0
- package/dist/src/nostr-post/nostr-post.d.ts +25 -0
- package/dist/src/nostr-post/parse-text.d.ts +8 -0
- package/dist/src/nostr-post/render-content.d.ts +5 -0
- package/dist/src/nostr-post/render.d.ts +19 -0
- package/dist/src/nostr-post/style.d.ts +1 -0
- package/dist/src/nostr-profile/nostr-profile.d.ts +24 -0
- package/dist/src/nostr-profile/render-stats.d.ts +1 -0
- package/dist/src/nostr-profile/render.d.ts +22 -0
- package/dist/src/nostr-profile/style.d.ts +1 -0
- package/dist/src/nostr-profile-badge/nostr-profile-badge.d.ts +34 -0
- package/dist/src/nostr-profile-badge/render.d.ts +11 -0
- package/dist/src/nostr-profile-badge/style.d.ts +1 -0
- package/dist/src/nostr-zap/dialog-help-style.d.ts +5 -0
- package/dist/src/nostr-zap/dialog-help.d.ts +2 -0
- package/dist/src/nostr-zap/dialog-zap-style.d.ts +6 -0
- package/dist/src/nostr-zap/dialog-zap.d.ts +31 -0
- package/dist/src/nostr-zap/dialog-zappers-style.d.ts +1 -0
- package/dist/src/nostr-zap/dialog-zappers.d.ts +25 -0
- package/dist/src/nostr-zap/nostr-zap.d.ts +45 -0
- package/dist/src/nostr-zap/render.d.ts +9 -0
- package/dist/src/nostr-zap/style.d.ts +1 -0
- package/dist/src/nostr-zap/zap-utils.d.ts +53 -0
- package/dist/themes/dark.css +10 -0
- package/dist/themes/light.css +10 -0
- package/dist/themes.css +52 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vite.config.esm.d.ts +2 -0
- package/dist/vite.config.umd.d.ts +2 -0
- package/package.json +95 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var d=Object.defineProperty;var c=(a,t,e)=>t in a?d(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var l=(a,t,e)=>c(a,typeof t!="symbol"?t+"":t,e);const h=()=>`
|
|
2
|
+
/* Base Dialog Styles */
|
|
3
|
+
.nostr-base-dialog {
|
|
4
|
+
width: 400px;
|
|
5
|
+
max-width: 90vw;
|
|
6
|
+
border: none;
|
|
7
|
+
border-radius: var(--nostrc-border-radius-lg, 10px);
|
|
8
|
+
padding: var(--nostrc-spacing-xl, 20px);
|
|
9
|
+
background: var(--nostrc-theme-bg, #ffffff);
|
|
10
|
+
color: var(--nostrc-theme-text-primary, #000000);
|
|
11
|
+
position: relative;
|
|
12
|
+
font-family: var(--nostrc-font-family-primary, ui-sans-serif, system-ui, sans-serif);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.nostr-base-dialog[open] {
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.nostr-base-dialog::backdrop {
|
|
20
|
+
background: rgba(0, 0, 0, 0.5);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.dialog-header {
|
|
24
|
+
position: relative;
|
|
25
|
+
margin-bottom: var(--nostrc-spacing-lg, 16px);
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.dialog-header h2 {
|
|
32
|
+
font-size: var(--nostrc-font-size-large, 1.25rem);
|
|
33
|
+
font-weight: var(--nostrc-font-weight-bold, 700);
|
|
34
|
+
margin: 0;
|
|
35
|
+
flex: 1;
|
|
36
|
+
text-align: left;
|
|
37
|
+
padding-top: 2px;
|
|
38
|
+
color: var(--nostrc-theme-text-primary, #000000);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.dialog-close-btn {
|
|
42
|
+
border: none;
|
|
43
|
+
background: var(--nostrc-theme-hover-bg, #f7fafc);
|
|
44
|
+
border-radius: var(--nostrc-border-radius-full, 50%);
|
|
45
|
+
width: 32px;
|
|
46
|
+
height: 32px;
|
|
47
|
+
min-width: 32px;
|
|
48
|
+
font-size: var(--nostrc-font-size-base, 16px);
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
color: var(--nostrc-theme-text-secondary, #666666);
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dialog-close-btn:hover {
|
|
57
|
+
background: var(--nostrc-theme-border, rgba(0, 0, 0, 0.05));
|
|
58
|
+
color: var(--nostrc-theme-text-primary, #000000);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.dialog-content {
|
|
62
|
+
line-height: 1.6;
|
|
63
|
+
color: var(--nostrc-theme-text-primary, #000000);
|
|
64
|
+
}
|
|
65
|
+
`;class g extends HTMLElement{constructor(){super();l(this,"dialog",null)}static get observedAttributes(){return["header","data-theme"]}injectStyles(){if(document.querySelector("style[data-dialog-component-styles]"))return;const e=document.createElement("style");e.setAttribute("data-dialog-component-styles","true"),e.textContent=h(),document.head.appendChild(e)}render(){this.injectStyles();const e=this.getAttribute("header")||"Dialog",o=this.getAttribute("data-theme");this.dialog=document.createElement("dialog"),this.dialog.className="nostr-base-dialog",o&&this.dialog.setAttribute("data-theme",o);const i=document.createElement("div");i.className="dialog-header";const s=document.createElement("h2");s.textContent=e;const n=document.createElement("button");n.className="dialog-close-btn",n.setAttribute("aria-label","Close dialog"),n.textContent="✕",i.appendChild(s),i.appendChild(n);const r=document.createElement("div");for(r.className="dialog-content";this.firstChild;)r.appendChild(this.firstChild);this.dialog.appendChild(i),this.dialog.appendChild(r),document.body.appendChild(this.dialog),this.setupEventListeners()}setupEventListeners(){if(!this.dialog)return;const e=this.dialog.querySelector(".dialog-close-btn");e==null||e.addEventListener("click",()=>{this.close()}),this.dialog.addEventListener("click",o=>{o.target===this.dialog&&this.close()}),this.dialog.addEventListener("cancel",o=>{o.preventDefault(),this.close()}),this.dialog.addEventListener("close",()=>{this.cleanup()})}show(){this.showModal()}showModal(){var e;this.dialog||this.render(),(e=this.dialog)==null||e.showModal()}close(){var e;(e=this.dialog)==null||e.close()}cleanup(){this.dialog&&this.dialog.isConnected&&this.dialog.remove(),this.isConnected&&this.remove(),this.dialog=null}disconnectedCallback(){this.cleanup()}attributeChangedCallback(e,o,i){if(e==="header"&&this.dialog){const s=this.dialog.querySelector(".dialog-header h2");s&&(s.textContent=i||"Dialog")}else e==="data-theme"&&this.dialog&&(i?this.dialog.setAttribute("data-theme",i):this.dialog.removeAttribute("data-theme"))}}customElements.get("dialog-component")||customElements.define("dialog-component",g);
|
|
66
|
+
//# sourceMappingURL=dialog-component-Dqg0QU9I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-component-Dqg0QU9I.js","sources":["../../src/base/dialog-component/style.ts","../../src/base/dialog-component/dialog-component.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n\n/**\n * Base dialog component styles\n * Provides common styling for all dialog components\n */\nexport const getDialogComponentStyles = (): string => {\n return `\n /* Base Dialog Styles */\n .nostr-base-dialog {\n width: 400px;\n max-width: 90vw;\n border: none;\n border-radius: var(--nostrc-border-radius-lg, 10px);\n padding: var(--nostrc-spacing-xl, 20px);\n background: var(--nostrc-theme-bg, #ffffff);\n color: var(--nostrc-theme-text-primary, #000000);\n position: relative;\n font-family: var(--nostrc-font-family-primary, ui-sans-serif, system-ui, sans-serif);\n }\n\n .nostr-base-dialog[open] {\n display: block;\n }\n\n .nostr-base-dialog::backdrop {\n background: rgba(0, 0, 0, 0.5);\n }\n\n .dialog-header {\n position: relative;\n margin-bottom: var(--nostrc-spacing-lg, 16px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .dialog-header h2 {\n font-size: var(--nostrc-font-size-large, 1.25rem);\n font-weight: var(--nostrc-font-weight-bold, 700);\n margin: 0;\n flex: 1;\n text-align: left;\n padding-top: 2px;\n color: var(--nostrc-theme-text-primary, #000000);\n }\n\n .dialog-close-btn {\n border: none;\n background: var(--nostrc-theme-hover-bg, #f7fafc);\n border-radius: var(--nostrc-border-radius-full, 50%);\n width: 32px;\n height: 32px;\n min-width: 32px;\n font-size: var(--nostrc-font-size-base, 16px);\n cursor: pointer;\n color: var(--nostrc-theme-text-secondary, #666666);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .dialog-close-btn:hover {\n background: var(--nostrc-theme-border, rgba(0, 0, 0, 0.05));\n color: var(--nostrc-theme-text-primary, #000000);\n }\n\n .dialog-content {\n line-height: 1.6;\n color: var(--nostrc-theme-text-primary, #000000);\n }\n `;\n};\n\n","// SPDX-License-Identifier: MIT\n\nimport { getDialogComponentStyles } from './style';\n\n/**\n * Base dialog component that extends HTMLElement\n * Provides common dialog functionality with header, close button, and content area\n * \n * Usage:\n * ```typescript\n * const dialog = document.createElement('dialog-component');\n * dialog.setAttribute('header', 'Dialog Title');\n * dialog.innerHTML = '<p>Your content goes here</p>';\n * dialog.showModal(); // Don't append to body, just call showModal()\n * ```\n * \n * Features:\n * - Header with customizable text\n * - Close button\n * - Click outside to close\n * - ESC key to close\n * - Automatic cleanup on close\n * \n * Important: Only one instance of this component should be added to the DOM at any time.\n * Multiple instances may cause conflicts with event listeners and cleanup behavior.\n */\nexport class DialogComponent extends HTMLElement {\n private dialog: HTMLDialogElement | null = null;\n\n constructor() {\n super();\n }\n\n /**\n * Observed attributes for the component\n */\n static get observedAttributes() {\n return ['header', 'data-theme'];\n }\n\n /**\n * Inject dialog styles into document head\n * Prevents duplicate injection by checking for existing styles\n */\n private injectStyles(): void {\n if (document.querySelector('style[data-dialog-component-styles]')) return;\n \n const style = document.createElement('style');\n style.setAttribute('data-dialog-component-styles', 'true');\n style.textContent = getDialogComponentStyles();\n document.head.appendChild(style);\n }\n\n /**\n * Render the dialog\n */\n private render(): void {\n this.injectStyles();\n\n const headerText = this.getAttribute('header') || 'Dialog';\n const theme = this.getAttribute('data-theme');\n\n this.dialog = document.createElement('dialog');\n this.dialog.className = 'nostr-base-dialog';\n if (theme) {\n this.dialog.setAttribute('data-theme', theme);\n }\n\n const headerDiv = document.createElement('div');\n headerDiv.className = 'dialog-header';\n \n const headerH2 = document.createElement('h2');\n headerH2.textContent = headerText;\n \n const closeBtn = document.createElement('button');\n closeBtn.className = 'dialog-close-btn';\n closeBtn.setAttribute('aria-label', 'Close dialog');\n closeBtn.textContent = '✕';\n \n headerDiv.appendChild(headerH2);\n headerDiv.appendChild(closeBtn);\n\n const contentDiv = document.createElement('div');\n contentDiv.className = 'dialog-content';\n \n // Safely move child nodes from component to dialog content\n // This preserves any existing DOM nodes without using innerHTML\n while (this.firstChild) {\n contentDiv.appendChild(this.firstChild);\n }\n\n this.dialog.appendChild(headerDiv);\n this.dialog.appendChild(contentDiv);\n\n document.body.appendChild(this.dialog);\n\n this.setupEventListeners();\n }\n\n /**\n * Setup event listeners for closing the dialog\n */\n private setupEventListeners(): void {\n if (!this.dialog) return;\n\n // Close button click\n const closeBtn = this.dialog.querySelector('.dialog-close-btn');\n closeBtn?.addEventListener('click', () => {\n this.close();\n });\n\n // Click outside dialog (on backdrop)\n this.dialog.addEventListener('click', (e) => {\n if (e.target === this.dialog) {\n this.close();\n }\n });\n\n // ESC key handler\n this.dialog.addEventListener('cancel', (e) => {\n e.preventDefault();\n this.close();\n });\n\n // Cleanup on close\n this.dialog.addEventListener('close', () => {\n this.cleanup();\n });\n }\n\n /**\n * Show the dialog (alias for showModal)\n */\n public show(): void {\n this.showModal();\n }\n\n /**\n * Show the dialog as modal\n */\n public showModal(): void {\n if (!this.dialog) {\n this.render();\n }\n this.dialog?.showModal();\n }\n\n /**\n * Close the dialog\n */\n public close(): void {\n this.dialog?.close();\n }\n\n /**\n * Cleanup when dialog is closed\n */\n private cleanup(): void {\n if (this.dialog && this.dialog.isConnected) {\n this.dialog.remove();\n }\n if (this.isConnected) {\n this.remove();\n }\n this.dialog = null;\n }\n\n /**\n * Called when component is removed from DOM\n */\n disconnectedCallback(): void {\n this.cleanup();\n }\n\n /**\n * Called when observed attributes change\n */\n attributeChangedCallback(name: string, _oldValue: string, newValue: string): void {\n if (name === 'header' && this.dialog) {\n const heading = this.dialog.querySelector('.dialog-header h2');\n if (heading) {\n heading.textContent = newValue || 'Dialog';\n }\n } else if (name === 'data-theme' && this.dialog) {\n if (newValue) {\n this.dialog.setAttribute('data-theme', newValue);\n } else {\n this.dialog.removeAttribute('data-theme');\n }\n }\n }\n}\n\n// Define custom element\nif (!customElements.get('dialog-component')) {\n customElements.define('dialog-component', DialogComponent);\n}\n\n"],"names":["getDialogComponentStyles","DialogCompon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KAAK,OAAO,cAAc,mBAAmB,EACzDA,IACFA,EAAQ,YAAcD,GAAY,SAE3B,MAAAF,IAAS,cAAgB,KAAK,SACnCE,EACG,KAAA,OAAO,aAAa,aAAcA,CAAQ,EAE1C,KAAA,OAAO,gBAAgB,YAAY,EAE5C,CAEJ,CAGK,eAAe,IAAI,kBAAkB,GACzB,eAAA,OAAO,mBAAoBb,CAAe"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/zap-utils-B1sz0Abx.js","assets/nostr-service-pr_crY62.js","assets/utils--bxLbhGF.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as y}from"./preload-helper-D7HrI6pR.js";import"./dialog-component-Dqg0QU9I.js";import{getBatchedProfileMetadata as x,extractProfileMetadataContent as k}from"./zap-utils-B1sz0Abx.js";import{h as p,e as g,f as b,c as v}from"./base-styles-CBypR3FR.js";import"./nostr-service-pr_crY62.js";import"./utils--bxLbhGF.js";function $(t="light"){const e=t==="dark";return`
|
|
3
|
+
.likers-dialog-content {
|
|
4
|
+
padding: 0;
|
|
5
|
+
max-height: 60vh;
|
|
6
|
+
overflow-y: auto;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.likers-list {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 12px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.like-entry {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
padding: 12px;
|
|
19
|
+
border-radius: 8px;
|
|
20
|
+
background: ${e?"#2a2a2a":"#f8f9fa"};
|
|
21
|
+
border: 1px solid ${e?"#3a3a3a":"#e9ecef"};
|
|
22
|
+
transition: background-color 0.2s ease;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.like-entry:hover {
|
|
26
|
+
background: ${e?"#3a3a3a":"#e9ecef"};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.like-author-info {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
gap: 12px;
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.like-author-picture {
|
|
37
|
+
width: 40px;
|
|
38
|
+
height: 40px;
|
|
39
|
+
border-radius: 50%;
|
|
40
|
+
object-fit: cover;
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.like-author-picture-default {
|
|
45
|
+
width: 40px;
|
|
46
|
+
height: 40px;
|
|
47
|
+
border-radius: 50%;
|
|
48
|
+
background: ${e?"#3a3a3a":"#e9ecef"};
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
font-size: 18px;
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.like-author-details {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
gap: 4px;
|
|
60
|
+
flex: 1;
|
|
61
|
+
min-width: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.like-author-link {
|
|
65
|
+
color: ${e?"#ffffff":"#000000"};
|
|
66
|
+
text-decoration: none;
|
|
67
|
+
font-weight: 500;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
transition: color 0.2s ease;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.like-author-link:hover {
|
|
73
|
+
color: ${e?"#4a9eff":"#1877f2"};
|
|
74
|
+
text-decoration: underline;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.like-date {
|
|
78
|
+
color: ${e?"#b0b0b0":"#65676b"};
|
|
79
|
+
font-size: 12px;
|
|
80
|
+
font-weight: 400;
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
gap: 8px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.like-status {
|
|
87
|
+
font-weight: 500;
|
|
88
|
+
font-size: 11px;
|
|
89
|
+
padding: 2px 6px;
|
|
90
|
+
border-radius: 4px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.like-status.liked {
|
|
94
|
+
color: ${e?"#4a9eff":"#1877f2"};
|
|
95
|
+
background: ${e?"rgba(74, 158, 255, 0.1)":"rgba(24, 119, 242, 0.1)"};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.like-status.disliked {
|
|
99
|
+
color: #d32f2f;
|
|
100
|
+
background: rgba(211, 47, 47, 0.1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.no-likes {
|
|
104
|
+
text-align: center;
|
|
105
|
+
color: ${e?"#b0b0b0":"#65676b"};
|
|
106
|
+
font-size: 14px;
|
|
107
|
+
padding: 40px 20px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Skeleton loading states */
|
|
111
|
+
.skeleton-entry {
|
|
112
|
+
opacity: 0.7;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.skeleton-picture {
|
|
116
|
+
width: 40px;
|
|
117
|
+
height: 40px;
|
|
118
|
+
border-radius: 50%;
|
|
119
|
+
background: linear-gradient(90deg,
|
|
120
|
+
${e?"#3a3a3a":"#f0f0f0"} 25%,
|
|
121
|
+
${e?"#4a4a4a":"#e0e0e0"} 50%,
|
|
122
|
+
${e?"#3a3a3a":"#f0f0f0"} 75%
|
|
123
|
+
);
|
|
124
|
+
background-size: 200% 100%;
|
|
125
|
+
animation: skeleton-loading 1.5s infinite;
|
|
126
|
+
flex-shrink: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.skeleton-name {
|
|
130
|
+
width: 120px;
|
|
131
|
+
height: 14px;
|
|
132
|
+
background: linear-gradient(90deg,
|
|
133
|
+
${e?"#3a3a3a":"#f0f0f0"} 25%,
|
|
134
|
+
${e?"#4a4a4a":"#e0e0e0"} 50%,
|
|
135
|
+
${e?"#3a3a3a":"#f0f0f0"} 75%
|
|
136
|
+
);
|
|
137
|
+
background-size: 200% 100%;
|
|
138
|
+
animation: skeleton-loading 1.5s infinite;
|
|
139
|
+
border-radius: 2px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@keyframes skeleton-loading {
|
|
143
|
+
0% {
|
|
144
|
+
background-position: -200% 0;
|
|
145
|
+
}
|
|
146
|
+
100% {
|
|
147
|
+
background-position: 200% 0;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Responsive */
|
|
152
|
+
@media (max-width: 480px) {
|
|
153
|
+
.likers-dialog-content {
|
|
154
|
+
max-height: 70vh;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.like-entry {
|
|
158
|
+
padding: 10px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.like-author-picture,
|
|
162
|
+
.like-author-picture-default,
|
|
163
|
+
.skeleton-picture {
|
|
164
|
+
width: 36px;
|
|
165
|
+
height: 36px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.like-author-link {
|
|
169
|
+
font-size: 13px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.like-date {
|
|
173
|
+
font-size: 11px;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* Scrollbar styling */
|
|
178
|
+
.likers-dialog-content::-webkit-scrollbar {
|
|
179
|
+
width: 6px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.likers-dialog-content::-webkit-scrollbar-track {
|
|
183
|
+
background: ${e?"#2a2a2a":"#f1f1f1"};
|
|
184
|
+
border-radius: 3px;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.likers-dialog-content::-webkit-scrollbar-thumb {
|
|
188
|
+
background: ${e?"#555":"#c1c1c1"};
|
|
189
|
+
border-radius: 3px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.likers-dialog-content::-webkit-scrollbar-thumb:hover {
|
|
193
|
+
background: ${e?"#777":"#a8a8a8"};
|
|
194
|
+
}
|
|
195
|
+
`}const w=(t="light")=>{document.querySelectorAll("style[data-likers-dialog-styles]").forEach(a=>a.remove());const r=document.createElement("style");r.setAttribute("data-likers-dialog-styles","true"),r.textContent=$(t),document.head.appendChild(r)};function m(t,e){const r=g(t.authorName||"Unknown liker"),n=`https://njump.me/${t.authorNpub||p(t.authorPubkey)}`,i=v(t.authorPicture||"")&&t.authorPicture||"",s=i?`<img src="${i}" alt="${r}" class="like-author-picture" />`:'<div class="like-author-picture-default">👤</div>',o=t.content==="-",l=o?"Disliked":"Liked",c=o?"disliked":"liked";return`
|
|
196
|
+
<div class="like-entry" data-like-index="${e}" data-author-pubkey="${t.authorPubkey}">
|
|
197
|
+
<div class="like-author-info">
|
|
198
|
+
${s}
|
|
199
|
+
<div class="like-author-details">
|
|
200
|
+
<a href="${n}" target="_blank" rel="noopener noreferrer" class="like-author-link">
|
|
201
|
+
${r}
|
|
202
|
+
</a>
|
|
203
|
+
<div class="like-date">
|
|
204
|
+
${b(Math.floor(t.date.getTime()/1e3))}
|
|
205
|
+
<span class="like-status ${c}">${l}</span>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
`}function P(t,e,r){const a=t.content==="-",n=a?"Disliked":"Liked",i=a?"disliked":"liked";return`
|
|
211
|
+
<div class="like-entry skeleton-entry" data-like-index="${r}" data-author-pubkey="${t.authorPubkey}">
|
|
212
|
+
<div class="like-author-info">
|
|
213
|
+
<div class="skeleton-picture"></div>
|
|
214
|
+
<div class="like-author-details">
|
|
215
|
+
<div class="like-author-link skeleton-name">
|
|
216
|
+
${g(e)}
|
|
217
|
+
</div>
|
|
218
|
+
<div class="like-date">
|
|
219
|
+
${b(Math.floor(t.date.getTime()/1e3))}
|
|
220
|
+
<span class="like-status ${i}">${n}</span>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
`}async function z(t){var o;const{likeDetails:e,theme:r="light"}=t;w(r),customElements.get("dialog-component")||await customElements.whenDefined("dialog-component");const a=document.createElement("dialog-component");a.setAttribute("header","Likers"),t.theme&&a.setAttribute("data-theme",t.theme);const n=await L(e);a.innerHTML=n,a.showModal();const i=a.querySelector(".nostr-base-dialog")||((o=a.shadowRoot)==null?void 0:o.querySelector(".nostr-base-dialog"))||document.body.querySelector(".nostr-base-dialog");if(!i)throw console.error("[openLikersDialog] Failed to find dialog element after showModal()"),new Error("Dialog element not found. The dialog may not have been created properly.");const s=i;return s&&e.length>0&&N(s,e),a}async function L(t){if(t.length===0)return`
|
|
226
|
+
<div class="likers-dialog-content">
|
|
227
|
+
<div class="likers-list">
|
|
228
|
+
<div class="no-likes">No likes yet</div>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
`;const e=t.map(a=>p(a.authorPubkey));return`
|
|
232
|
+
<div class="likers-dialog-content">
|
|
233
|
+
<div class="likers-list">
|
|
234
|
+
${t.map((a,n)=>P(a,e[n],n)).join("")}
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
`}async function N(t,e){const r=t.querySelector(".likers-list");if(!r)return;const a=[...new Set(e.map(n=>n.authorPubkey))];console.log("Nostr-Components: Likers dialog: Fetching profiles for",a.length,"unique authors");try{const n=await x(a),i=new Map;n.forEach(o=>{i.set(o.id,o.profile)});const s=new Map;a.forEach(o=>{s.set(o,p(o))});for(let o=0;o<e.length;o++){const l=e[o],c=i.get(l.authorPubkey),d=s.get(l.authorPubkey)||l.authorPubkey;let u;if(c){const h=k(c);u={...l,authorName:h.display_name||h.name||d,authorPicture:h.picture,authorNpub:d}}else u={...l,authorName:d,authorNpub:d};const f=r.querySelector(`[data-like-index="${o}"]`);if(f){const h=m(u,o);f.outerHTML=h}}console.log("Nostr-Components: Likers dialog: Progressive enhancement completed for",e.length,"like entries")}catch(n){console.error("Nostr-Components: Likers dialog: Error in batched profile enhancement",n),console.log("Nostr-Components: Likers dialog: Falling back to individual profile fetching"),await E(t,e)}}async function E(t,e){const r=t.querySelector(".likers-list");if(!r)return;const a=new Map,n=e.map(async(i,s)=>{if(a.has(i.authorPubkey)){const o=a.get(i.authorPubkey);return{index:s,enhanced:{...i,authorName:o.authorName,authorPicture:o.authorPicture,authorNpub:o.authorNpub}}}try{const{getProfileMetadata:o}=await y(async()=>{const{getProfileMetadata:f}=await import("./zap-utils-B1sz0Abx.js");return{getProfileMetadata:f}},__vite__mapDeps([0,1,2])),l=await o(i.authorPubkey),c=k(l),d=p(i.authorPubkey),u={...i,authorName:c.display_name||c.name||d,authorPicture:c.picture,authorNpub:d};return a.set(i.authorPubkey,u),{index:s,enhanced:u}}catch(o){console.error("Nostr-Components: Likers dialog: Error fetching profile for",i.authorPubkey,o);const l=p(i.authorPubkey),c={...i,authorName:l,authorNpub:l};return a.set(i.authorPubkey,c),{index:s,enhanced:c}}});for(const i of n)try{const{index:s,enhanced:o}=await i,l=r.querySelector(`[data-like-index="${s}"]`);if(l){const c=m(o,s);l.outerHTML=c}}catch(s){console.error("Nostr-Components: Likers dialog: Error processing profile enhancement",s)}}export{w as injectLikersDialogStyles,z as openLikersDialog};
|
|
238
|
+
//# sourceMappingURL=dialog-likers-BzTesCZa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";kUAEgB,SAAAA,EAAsBC,EAA0B,QAAiB,CAC/E,MAAMC,EAASD,IAAU,OAElB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAkBWC,EAAS,UAAY,SAAS;AAAA,0BACxBA,EAAS,UAAY,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKpCA,EAAS,UAAY,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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UAAYC,CAAA,QAErBC,EAAO,CACN,cAAM,wEAAyEA,CAAK,EAGlG","names":["getLikersDialogStyles","theme","isDark","injectLikersDialogStyles","style","renderLikeEntry","like","index","authorNameSafe","escapeHtml","njumpUrl","hexToNpub","profilePictureSafe","isValidUrl","profilePicture","isDislike","statusText","statusClass","formatRelativeTime","renderSkeletonLikeEntry","npub","openLikersDialog","params","likeDetails","dialogComponent","initialContent","renderInitialContent","dialogElement","_a","dialog","enhanceLikeDetailsProgressively","npubs","likersList","uniqueAuthorIds","profileResults","getBatchedProfileMetadata","profileMap","result","npubMap","pubkey","profile","enhanced","profileContent","extractProfileMetadataContent","skeletonEntry","enhancedEntry","error","enhanceLikeDetailsIndividually","profileCache","profilePromises","cachedProfile","getProfileMetadata","__vitePreload","profileMetadata","promise"],"ignoreList":[],"sources":["../../src/nostr-like/dialog-likers-style.ts","../../src/nostr-like/dialog-likers.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n\nexport function getLikersDialogStyles(theme: 'light' | 'dark' = 'light'): string {\n const isDark = theme === 'dark';\n \n return `\n .likers-dialog-content {\n padding: 0;\n max-height: 60vh;\n overflow-y: auto;\n }\n\n .likers-list {\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n .like-entry {\n display: flex;\n align-items: center;\n padding: 12px;\n border-radius: 8px;\n background: ${isDark ? '#2a2a2a' : '#f8f9fa'};\n border: 1px solid ${isDark ? '#3a3a3a' : '#e9ecef'};\n transition: background-color 0.2s ease;\n }\n\n .like-entry:hover {\n background: ${isDark ? '#3a3a3a' : '#e9ecef'};\n }\n\n .like-author-info {\n display: flex;\n align-items: center;\n gap: 12px;\n width: 100%;\n }\n\n .like-author-picture {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n object-fit: cover;\n flex-shrink: 0;\n }\n\n .like-author-picture-default {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n background: ${isDark ? '#3a3a3a' : '#e9ecef'};\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 18px;\n flex-shrink: 0;\n }\n\n .like-author-details {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1;\n min-width: 0;\n }\n\n .like-author-link {\n color: ${isDark ? '#ffffff' : '#000000'};\n text-decoration: none;\n font-weight: 500;\n font-size: 14px;\n transition: color 0.2s ease;\n }\n\n .like-author-link:hover {\n color: ${isDark ? '#4a9eff' : '#1877f2'};\n text-decoration: underline;\n }\n\n .like-date {\n color: ${isDark ? '#b0b0b0' : '#65676b'};\n font-size: 12px;\n font-weight: 400;\n display: flex;\n align-items: center;\n gap: 8px;\n }\n\n .like-status {\n font-weight: 500;\n font-size: 11px;\n padding: 2px 6px;\n border-radius: 4px;\n }\n\n .like-status.liked {\n color: ${isDark ? '#4a9eff' : '#1877f2'};\n background: ${isDark ? 'rgba(74, 158, 255, 0.1)' : 'rgba(24, 119, 242, 0.1)'};\n }\n\n .like-status.disliked {\n color: #d32f2f;\n background: rgba(211, 47, 47, 0.1);\n }\n\n .no-likes {\n text-align: center;\n color: ${isDark ? '#b0b0b0' : '#65676b'};\n font-size: 14px;\n padding: 40px 20px;\n }\n\n /* Skeleton loading states */\n .skeleton-entry {\n opacity: 0.7;\n }\n\n .skeleton-picture {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n background: linear-gradient(90deg, \n ${isDark ? '#3a3a3a' : '#f0f0f0'} 25%, \n ${isDark ? '#4a4a4a' : '#e0e0e0'} 50%, \n ${isDark ? '#3a3a3a' : '#f0f0f0'} 75%\n );\n background-size: 200% 100%;\n animation: skeleton-loading 1.5s infinite;\n flex-shrink: 0;\n }\n\n .skeleton-name {\n width: 120px;\n height: 14px;\n background: linear-gradient(90deg, \n ${isDark ? '#3a3a3a' : '#f0f0f0'} 25%, \n ${isDark ? '#4a4a4a' : '#e0e0e0'} 50%, \n ${isDark ? '#3a3a3a' : '#f0f0f0'} 75%\n );\n background-size: 200% 100%;\n animation: skeleton-loading 1.5s infinite;\n border-radius: 2px;\n }\n\n @keyframes skeleton-loading {\n 0% {\n background-position: -200% 0;\n }\n 100% {\n background-position: 200% 0;\n }\n }\n\n /* Responsive */\n @media (max-width: 480px) {\n .likers-dialog-content {\n max-height: 70vh;\n }\n\n .like-entry {\n padding: 10px;\n }\n\n .like-author-picture,\n .like-author-picture-default,\n .skeleton-picture {\n width: 36px;\n height: 36px;\n }\n\n .like-author-link {\n font-size: 13px;\n }\n\n .like-date {\n font-size: 11px;\n }\n }\n\n /* Scrollbar styling */\n .likers-dialog-content::-webkit-scrollbar {\n width: 6px;\n }\n\n .likers-dialog-content::-webkit-scrollbar-track {\n background: ${isDark ? '#2a2a2a' : '#f1f1f1'};\n border-radius: 3px;\n }\n\n .likers-dialog-content::-webkit-scrollbar-thumb {\n background: ${isDark ? '#555' : '#c1c1c1'};\n border-radius: 3px;\n }\n\n .likers-dialog-content::-webkit-scrollbar-thumb:hover {\n background: ${isDark ? '#777' : '#a8a8a8'};\n }\n `;\n}\n","// SPDX-License-Identifier: MIT\n\n// Import for side effects to register the custom element\nimport '../base/dialog-component/dialog-component';\nimport type { DialogComponent } from '../base/dialog-component/dialog-component';\nimport { getLikersDialogStyles } from './dialog-likers-style';\nimport { getBatchedProfileMetadata, extractProfileMetadataContent } from '../nostr-zap/zap-utils';\nimport { escapeHtml, formatRelativeTime, hexToNpub, isValidUrl } from '../common/utils';\nimport { LikeDetails } from './like-utils';\n\n/**\n * Modal dialog for displaying individual like details (likers).\n * \n * Shows a list of all users who liked a URL with:\n * - User's name\n * - User's profile picture\n * - Time of like (relative time)\n * - Clickable links to user profiles via njump.me\n */\n\nexport interface OpenLikersModalParams {\n likeDetails: LikeDetails[];\n theme?: 'light' | 'dark';\n}\n\n/**\n * Inject likers dialog content styles into document head\n * Prevents duplicate injection by checking for existing styles\n */\nexport const injectLikersDialogStyles = (theme: 'light' | 'dark' = 'light') => {\n // Remove existing likers dialog styles\n const existingStyles = document.querySelectorAll('style[data-likers-dialog-styles]');\n existingStyles.forEach(style => style.remove());\n \n const style = document.createElement('style');\n style.setAttribute('data-likers-dialog-styles', 'true');\n style.textContent = getLikersDialogStyles(theme);\n document.head.appendChild(style);\n}\n\ninterface EnhancedLikeDetails extends LikeDetails {\n authorName?: string;\n authorPicture?: string;\n authorNpub?: string;\n}\n\n/**\n * Render individual like entry HTML (with profile data)\n */\nfunction renderLikeEntry(like: EnhancedLikeDetails, index: number): string {\n const authorNameSafe = escapeHtml(like.authorName || 'Unknown liker');\n const npubSafe = like.authorNpub || hexToNpub(like.authorPubkey);\n const njumpUrl = `https://njump.me/${npubSafe}`;\n const profilePictureSafe = isValidUrl(like.authorPicture || '') ? like.authorPicture || '' : '';\n \n const profilePicture = profilePictureSafe \n ? `<img src=\"${profilePictureSafe}\" alt=\"${authorNameSafe}\" class=\"like-author-picture\" />`\n : `<div class=\"like-author-picture-default\">👤</div>`;\n \n const isDislike = like.content === '-';\n const statusText = isDislike ? 'Disliked' : 'Liked';\n const statusClass = isDislike ? 'disliked' : 'liked';\n \n return `\n <div class=\"like-entry\" data-like-index=\"${index}\" data-author-pubkey=\"${like.authorPubkey}\">\n <div class=\"like-author-info\">\n ${profilePicture}\n <div class=\"like-author-details\">\n <a href=\"${njumpUrl}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"like-author-link\">\n ${authorNameSafe}\n </a>\n <div class=\"like-date\">\n ${formatRelativeTime(Math.floor(like.date.getTime() / 1000))}\n <span class=\"like-status ${statusClass}\">${statusText}</span>\n </div>\n </div>\n </div>\n </div>\n `;\n}\n\n/**\n * Render skeleton like entry HTML (with npub)\n */\nfunction renderSkeletonLikeEntry(like: LikeDetails, npub: string, index: number): string {\n const isDislike = like.content === '-';\n const statusText = isDislike ? 'Disliked' : 'Liked';\n const statusClass = isDislike ? 'disliked' : 'liked';\n \n return `\n <div class=\"like-entry skeleton-entry\" data-like-index=\"${index}\" data-author-pubkey=\"${like.authorPubkey}\">\n <div class=\"like-author-info\">\n <div class=\"skeleton-picture\"></div>\n <div class=\"like-author-details\">\n <div class=\"like-author-link skeleton-name\">\n ${escapeHtml(npub)}\n </div>\n <div class=\"like-date\">\n ${formatRelativeTime(Math.floor(like.date.getTime() / 1000))}\n <span class=\"like-status ${statusClass}\">${statusText}</span>\n </div>\n </div>\n </div>\n </div>\n `;\n}\n\n/**\n * Opens the likers dialog showing individual like details\n */\nexport async function openLikersDialog(params: OpenLikersModalParams): Promise<DialogComponent> {\n const { likeDetails, theme = 'light' } = params;\n \n // Inject styles\n injectLikersDialogStyles(theme);\n \n // Ensure custom element is defined\n if (!customElements.get('dialog-component')) {\n await customElements.whenDefined('dialog-component');\n }\n \n // Create dialog component (not added to DOM)\n const dialogComponent = document.createElement('dialog-component') as DialogComponent;\n dialogComponent.setAttribute('header', 'Likers');\n if (params.theme) {\n dialogComponent.setAttribute('data-theme', params.theme);\n }\n \n // Initial content with skeleton loaders showing npubs\n const initialContent = await renderInitialContent(likeDetails);\n dialogComponent.innerHTML = initialContent;\n \n // Show the dialog (this will create and append the actual dialog element)\n dialogComponent.showModal();\n \n // Get the actual dialog element for progressive enhancement\n const dialogElement: HTMLDialogElement | null = \n dialogComponent.querySelector('.nostr-base-dialog') ||\n dialogComponent.shadowRoot?.querySelector('.nostr-base-dialog') ||\n document.body.querySelector('.nostr-base-dialog');\n \n if (!dialogElement) {\n console.error('[openLikersDialog] Failed to find dialog element after showModal()');\n throw new Error('Dialog element not found. The dialog may not have been created properly.');\n }\n \n // Type assertion: dialog is guaranteed to be non-null after the check above\n const dialog = dialogElement as HTMLDialogElement;\n \n // Start progressive enhancement\n if (dialog && likeDetails.length > 0) {\n enhanceLikeDetailsProgressively(dialog, likeDetails);\n }\n\n return dialogComponent;\n}\n\n/**\n * Render initial dialog content with skeleton loaders showing npubs\n */\nasync function renderInitialContent(likeDetails: LikeDetails[]): Promise<string> {\n if (likeDetails.length === 0) {\n return `\n <div class=\"likers-dialog-content\">\n <div class=\"likers-list\">\n <div class=\"no-likes\">No likes yet</div>\n </div>\n </div>\n `;\n }\n\n // Convert all pubkeys to npubs for immediate display\n const npubs = likeDetails.map(like => hexToNpub(like.authorPubkey));\n\n const skeletonEntries = likeDetails.map((like, index) => \n renderSkeletonLikeEntry(like, npubs[index], index)\n ).join('');\n\n return `\n <div class=\"likers-dialog-content\">\n <div class=\"likers-list\">\n ${skeletonEntries}\n </div>\n </div>\n `;\n}\n\n/**\n * Progressively enhance like details with profile information (batched approach)\n */\nasync function enhanceLikeDetailsProgressively(dialog: HTMLDialogElement, likeDetails: LikeDetails[]): Promise<void> {\n const likersList = dialog.querySelector('.likers-list') as HTMLElement;\n if (!likersList) return;\n\n // Get unique author IDs\n const uniqueAuthorIds = [...new Set(likeDetails.map(like => like.authorPubkey))];\n console.log(\"Nostr-Components: Likers dialog: Fetching profiles for\", uniqueAuthorIds.length, \"unique authors\");\n\n try {\n // Fetch all profiles in a single batched call\n const profileResults = await getBatchedProfileMetadata(uniqueAuthorIds);\n \n // Create a map for quick lookup\n const profileMap = new Map<string, any>();\n profileResults.forEach(result => {\n profileMap.set(result.id, result.profile);\n });\n\n // Convert all pubkeys to npubs for display\n const npubMap = new Map<string, string>();\n uniqueAuthorIds.forEach(pubkey => {\n npubMap.set(pubkey, hexToNpub(pubkey));\n });\n\n // Process each like entry\n for (let index = 0; index < likeDetails.length; index++) {\n const like = likeDetails[index];\n const profile = profileMap.get(like.authorPubkey);\n const npub = npubMap.get(like.authorPubkey) || like.authorPubkey;\n \n let enhanced: EnhancedLikeDetails;\n \n if (profile) {\n const profileContent = extractProfileMetadataContent(profile);\n enhanced = {\n ...like,\n authorName: profileContent.display_name || profileContent.name || npub,\n authorPicture: profileContent.picture,\n authorNpub: npub,\n };\n } else {\n // Fallback if profile not found\n enhanced = {\n ...like,\n authorName: npub,\n authorNpub: npub,\n };\n }\n\n // Find the corresponding skeleton entry by index and replace it\n const skeletonEntry = likersList.querySelector(`[data-like-index=\"${index}\"]`);\n if (skeletonEntry) {\n const enhancedEntry = renderLikeEntry(enhanced, index);\n skeletonEntry.outerHTML = enhancedEntry;\n }\n }\n\n console.log(\"Nostr-Components: Likers dialog: Progressive enhancement completed for\", likeDetails.length, \"like entries\");\n } catch (error) {\n console.error(\"Nostr-Components: Likers dialog: Error in batched profile enhancement\", error);\n \n // Fallback to individual processing if batched approach fails\n console.log(\"Nostr-Components: Likers dialog: Falling back to individual profile fetching\");\n await enhanceLikeDetailsIndividually(dialog, likeDetails);\n }\n}\n\n/**\n * Fallback: Enhance like details individually (original approach)\n */\nasync function enhanceLikeDetailsIndividually(dialog: HTMLDialogElement, likeDetails: LikeDetails[]): Promise<void> {\n const likersList = dialog.querySelector('.likers-list') as HTMLElement;\n if (!likersList) return;\n\n // Create a map to track which profiles we've already fetched\n const profileCache = new Map<string, EnhancedLikeDetails>();\n \n // Fetch all profile metadata in parallel\n const profilePromises = likeDetails.map(async (like, index) => {\n // Check if we already have this profile cached\n if (profileCache.has(like.authorPubkey)) {\n const cachedProfile = profileCache.get(like.authorPubkey)!;\n return {\n index,\n enhanced: {\n ...like,\n authorName: cachedProfile.authorName,\n authorPicture: cachedProfile.authorPicture,\n authorNpub: cachedProfile.authorNpub,\n }\n };\n }\n\n try {\n const { getProfileMetadata } = await import('../nostr-zap/zap-utils');\n const profileMetadata = await getProfileMetadata(like.authorPubkey);\n const profileContent = extractProfileMetadataContent(profileMetadata);\n const npub = hexToNpub(like.authorPubkey);\n \n const enhanced = {\n ...like,\n authorName: profileContent.display_name || profileContent.name || npub,\n authorPicture: profileContent.picture,\n authorNpub: npub,\n };\n\n // Cache the profile for other entries from the same author\n profileCache.set(like.authorPubkey, enhanced);\n \n return {\n index,\n enhanced\n };\n } catch (error) {\n console.error(\"Nostr-Components: Likers dialog: Error fetching profile for\", like.authorPubkey, error);\n // Fallback with just pubkey converted to npub\n const npub = hexToNpub(like.authorPubkey);\n const enhanced = {\n ...like,\n authorName: npub,\n authorNpub: npub,\n };\n \n // Cache the fallback profile\n profileCache.set(like.authorPubkey, enhanced);\n \n return {\n index,\n enhanced\n };\n }\n });\n\n // Process each profile as it becomes available\n for (const promise of profilePromises) {\n try {\n const { index, enhanced } = await promise;\n \n // Find the corresponding skeleton entry by index and replace it\n const skeletonEntry = likersList.querySelector(`[data-like-index=\"${index}\"]`);\n if (skeletonEntry) {\n const enhancedEntry = renderLikeEntry(enhanced, index);\n skeletonEntry.outerHTML = enhancedEntry;\n }\n } catch (error) {\n console.error(\"Nostr-Components: Likers dialog: Error processing profile enhancement\", error);\n }\n }\n}\n"],"file":"assets/dialog-likers-BzTesCZa.js"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const t=`
|
|
2
|
+
<svg width="18" height="18" fill="#00b3ff">
|
|
3
|
+
<path xmlns="http://www.w3.org/2000/svg" d="M12.2197 1.65717C7.73973 1.25408 5.14439 0.940234 3.12891 2.6623C0.948817 4.52502 0.63207 7.66213 2.35603 9.88052C3.01043 10.7226 4.28767 11.9877 5.51513 13.1462C6.75696 14.3184 7.99593 15.426 8.60692 15.9671C8.61074 15.9705 8.61463 15.9739 8.61859 15.9774C8.67603 16.0283 8.74753 16.0917 8.81608 16.1433C8.89816 16.2052 9.01599 16.2819 9.17334 16.3288C9.38253 16.3912 9.60738 16.3912 9.81656 16.3288C9.97391 16.2819 10.0917 16.2052 10.1738 16.1433C10.2424 16.0917 10.3139 16.0283 10.3713 15.9774C10.3753 15.9739 10.3792 15.9705 10.383 15.9671C10.994 15.426 12.2329 14.3184 13.4748 13.1462C14.7022 11.9877 15.9795 10.7226 16.6339 9.88052C18.3512 7.67065 18.0834 4.50935 15.8532 2.65572C13.8153 0.961905 11.2476 1.25349 9.49466 2.78774Z"/>
|
|
4
|
+
</svg>
|
|
5
|
+
`,r=`
|
|
6
|
+
<svg width="18" height="18">
|
|
7
|
+
<g xmlns="http://www.w3.org/2000/svg">
|
|
8
|
+
<path fill="#ff006d" d="M12.2197 1.65717C7.73973 1.25408 5.14439 0.940234 3.12891 2.6623C0.948817 4.52502 0.63207 7.66213 2.35603 9.88052C3.01043 10.7226 4.28767 11.9877 5.51513 13.1462C6.75696 14.3184 7.99593 15.426 8.60692 15.9671C8.61074 15.9705 8.61463 15.9739 8.61859 15.9774C8.67603 16.0283 8.74753 16.0917 8.81608 16.1433C8.89816 16.2052 9.01599 16.2819 9.17334 16.3288C9.38253 16.3912 9.60738 16.3912 9.81656 16.3288C9.97391 16.2819 10.0917 16.2052 10.1738 16.1433C10.2424 16.0917 10.3139 16.0283 10.3713 15.9774C10.3753 15.9739 10.3792 15.9705 10.383 15.9671C10.994 15.426 12.2329 14.3184 13.4748 13.1462C14.7022 11.9877 15.9795 10.7226 16.6339 9.88052C18.3512 7.67065 18.0834 4.50935 15.8532 2.65572C13.8153 0.961905 11.2476 1.25349 9.49466 2.78774Z"/>
|
|
9
|
+
</g>
|
|
10
|
+
</svg>
|
|
11
|
+
`,e=(C="dark")=>`
|
|
12
|
+
<svg
|
|
13
|
+
class="checkmark"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
viewBox="0 0 52 52"
|
|
16
|
+
role="img"
|
|
17
|
+
aria-label="Success checkmark"
|
|
18
|
+
>
|
|
19
|
+
<style>
|
|
20
|
+
.checkmark__circle {
|
|
21
|
+
stroke-dasharray: 166;
|
|
22
|
+
stroke-dashoffset: 166;
|
|
23
|
+
stroke-width: 2;
|
|
24
|
+
stroke-miterlimit: 10;
|
|
25
|
+
stroke: #4bb71b;
|
|
26
|
+
fill: none;
|
|
27
|
+
animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.checkmark {
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
display: block;
|
|
35
|
+
stroke-width: 3;
|
|
36
|
+
stroke: #4bb71b;
|
|
37
|
+
stroke-miterlimit: 10;
|
|
38
|
+
margin: 0 auto;
|
|
39
|
+
animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.checkmark__check {
|
|
43
|
+
transform-origin: 50% 50%;
|
|
44
|
+
stroke-dasharray: 48;
|
|
45
|
+
stroke-dashoffset: 48;
|
|
46
|
+
animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes stroke {
|
|
50
|
+
100% { stroke-dashoffset: 0; }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes scale {
|
|
54
|
+
0%, 100% { transform: none; }
|
|
55
|
+
50% { transform: scale3d(1.1, 1.1, 1); }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@keyframes fill {
|
|
59
|
+
100% { box-shadow: inset 0 0 0 30px ${C==="dark"?"#FFF":"#000"}; }
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
62
|
+
<circle class="checkmark__circle" cx="26" cy="26" r="25" fill="${C==="dark"?"#FFF":"#000"}"/>
|
|
63
|
+
<path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/>
|
|
64
|
+
</svg>
|
|
65
|
+
`,a=(C=21,s=24)=>`
|
|
66
|
+
<svg
|
|
67
|
+
width="${C}"
|
|
68
|
+
height="${s}"
|
|
69
|
+
viewBox="0 0 21 24"
|
|
70
|
+
fill="none"
|
|
71
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
72
|
+
role="img"
|
|
73
|
+
aria-label="Nostr logo"
|
|
74
|
+
>
|
|
75
|
+
<style>
|
|
76
|
+
.nostrich {
|
|
77
|
+
transform-origin: center;
|
|
78
|
+
}
|
|
79
|
+
</style>
|
|
80
|
+
<g class="nostrich">
|
|
81
|
+
<path d="M17.7084 10.1607C18.1683 13.3466 14.8705 14.0207 12.9733 13.9618C12.8515 13.958 12.7366 14.0173 12.6647 14.1157C12.4684 14.384 12.1547 14.7309 11.9125 14.7309C11.6405 14.7309 11.3957 15.254 11.284 15.5795C11.2723 15.6137 11.3059 15.6452 11.3403 15.634C14.345 14.6584 15.5241 14.3238 16.032 14.4178C16.4421 14.4937 17.209 15.8665 17.5413 16.5434C16.7155 16.5909 16.4402 15.8507 16.2503 15.7178C16.0985 15.6116 16.0415 16.0974 16.032 16.3536C15.8517 16.2587 15.6239 16.1259 15.6049 15.7178C15.5859 15.3098 15.3771 15.4142 15.2157 15.4332C15.0544 15.4521 12.5769 16.2493 12.2067 16.3536C11.8366 16.458 11.4094 16.6004 11.0582 16.8471C10.4697 17.1318 10.09 16.9325 9.98561 16.4485C9.90208 16.0614 10.4444 14.8701 10.726 14.3229C10.3779 14.4526 9.65529 14.7158 9.54898 14.7309C9.44588 14.7457 8.13815 15.7552 7.43879 16.3038C7.398 16.3358 7.37174 16.3827 7.36236 16.4336C7.25047 17.0416 6.89335 17.2118 6.27423 17.5303C5.77602 17.7867 4.036 20.4606 3.14127 21.9041C3.0794 22.0039 2.9886 22.0806 2.8911 22.1461C2.32279 22.5276 1.74399 23.4985 1.50923 23.9737C1.17511 23.0095 1.61048 22.1802 1.86993 21.886C1.75602 21.7873 1.49341 21.8449 1.37634 21.886C1.69907 20.7757 2.82862 20.7757 2.79066 20.7757C2.99948 20.5954 5.44842 17.0938 5.50538 16.9325C5.56187 16.7725 5.46892 16.0242 6.69975 15.6139C6.7193 15.6073 6.73868 15.5984 6.75601 15.5873C7.71493 14.971 8.43427 13.9774 8.67571 13.5542C7.39547 13.4662 5.92943 12.7525 5.16289 12.294C4.99765 12.1952 4.8224 12.1092 4.63108 12.0875C3.58154 11.9687 2.53067 12.6401 2.10723 13.0228C1.93258 12.7799 2.12938 12.0739 2.24961 11.7513C1.82437 11.6905 1.19916 12.308 0.939711 12.6243C0.658747 12.184 0.904907 11.397 1.06311 11.0585C0.501179 11.0737 0.120232 11.3306 0 11.4571C0.465109 7.99343 4.02275 9.00076 4.06259 9.04675C3.87275 8.84937 3.88857 8.59126 3.92021 8.48688C6.0749 8.54381 7.08105 8.18321 7.71702 7.81313C12.7288 5.01374 14.8882 6.73133 15.6856 7.1631C16.4829 7.59487 17.9304 7.77042 18.9318 7.37187C20.1278 6.83097 19.9478 5.43673 19.7054 4.90461C19.4397 4.32101 17.9399 3.51438 17.4084 2.49428C16.8768 1.47418 17.34 0.233672 17.9558 0.0607684C18.5425 -0.103972 18.9615 0.0876835 19.2831 0.378128C19.4974 0.571763 20.0994 0.710259 20.3509 0.800409C20.6024 0.890558 21.0201 1.00918 20.9964 1.08035C20.9726 1.15152 20.5699 1.14202 20.5075 1.14202C20.3794 1.14202 20.2275 1.161 20.3794 1.23217C20.5575 1.30439 20.8263 1.40936 20.955 1.47846C20.9717 1.48744 20.9683 1.51084 20.95 1.51577C20.0765 1.75085 19.2966 1.26578 18.7183 1.82526C18.1298 2.39463 19.3827 2.83114 20.0282 3.51438C20.6736 4.19762 21.3381 5.01372 20.8065 6.87365C20.395 8.31355 18.6703 9.53781 17.7795 10.0167C17.7282 10.0442 17.7001 10.1031 17.7084 10.1607Z"/>
|
|
82
|
+
</g>
|
|
83
|
+
</svg>
|
|
84
|
+
`,o=()=>`
|
|
85
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
86
|
+
<style>
|
|
87
|
+
@keyframes nostrich-run {
|
|
88
|
+
0% { transform: translateX(0) rotate(0deg); }
|
|
89
|
+
20% { transform: translateX(10px) rotate(5deg); }
|
|
90
|
+
40% { transform: translateX(0) rotate(0deg); }
|
|
91
|
+
60% { transform: translateX(-10px) rotate(-5deg); }
|
|
92
|
+
80% { transform: translateX(0) rotate(0deg); }
|
|
93
|
+
100% { transform: translateX(0) rotate(0deg); }
|
|
94
|
+
}
|
|
95
|
+
.nostrich {
|
|
96
|
+
animation: nostrich-run 1.5s infinite ease-in-out;
|
|
97
|
+
transform-origin: center;
|
|
98
|
+
}
|
|
99
|
+
</style>
|
|
100
|
+
<g class="nostrich">
|
|
101
|
+
<path d="M17.7084 10.1607C18.1683 13.3466 14.8705 14.0207 12.9733 13.9618C12.8515 13.958 12.7366 14.0173 12.6647 14.1157C12.4684 14.384 12.1547 14.7309 11.9125 14.7309C11.6405 14.7309 11.3957 15.254 11.284 15.5795C11.2723 15.6137 11.3059 15.6452 11.3403 15.634C14.345 14.6584 15.5241 14.3238 16.032 14.4178C16.4421 14.4937 17.209 15.8665 17.5413 16.5434C16.7155 16.5909 16.4402 15.8507 16.2503 15.7178C16.0985 15.6116 16.0415 16.0974 16.032 16.3536C15.8517 16.2587 15.6239 16.1259 15.6049 15.7178C15.5859 15.3098 15.3771 15.4142 15.2157 15.4332C15.0544 15.4521 12.5769 16.2493 12.2067 16.3536C11.8366 16.458 11.4094 16.6004 11.0582 16.8471C10.4697 17.1318 10.09 16.9325 9.98561 16.4485C9.90208 16.0614 10.4444 14.8701 10.726 14.3229C10.3779 14.4526 9.65529 14.7158 9.54898 14.7309C9.44588 14.7457 8.13815 15.7552 7.43879 16.3038C7.398 16.3358 7.37174 16.3827 7.36236 16.4336C7.25047 17.0416 6.89335 17.2118 6.27423 17.5303C5.77602 17.7867 4.036 20.4606 3.14127 21.9041C3.0794 22.0039 2.9886 22.0806 2.8911 22.1461C2.32279 22.5276 1.74399 23.4985 1.50923 23.9737C1.17511 23.0095 1.61048 22.1802 1.86993 21.886C1.75602 21.7873 1.49341 21.8449 1.37634 21.886C1.69907 20.7757 2.82862 20.7757 2.79066 20.7757C2.99948 20.5954 5.44842 17.0938 5.50538 16.9325C5.56187 16.7725 5.46892 16.0242 6.69975 15.6139C6.7193 15.6073 6.73868 15.5984 6.75601 15.5873C7.71493 14.971 8.43427 13.9774 8.67571 13.5542C7.39547 13.4662 5.92943 12.7525 5.16289 12.294C4.99765 12.1952 4.8224 12.1092 4.63108 12.0875C3.58154 11.9687 2.53067 12.6401 2.10723 13.0228C1.93258 12.7799 2.12938 12.0739 2.24961 11.7513C1.82437 11.6905 1.19916 12.308 0.939711 12.6243C0.658747 12.184 0.904907 11.397 1.06311 11.0585C0.501179 11.0737 0.120232 11.3306 0 11.4571C0.465109 7.99343 4.02275 9.00076 4.06259 9.04675C3.87275 8.84937 3.88857 8.59126 3.92021 8.48688C6.0749 8.54381 7.08105 8.18321 7.71702 7.81313C12.7288 5.01374 14.8882 6.73133 15.6856 7.1631C16.4829 7.59487 17.9304 7.77042 18.9318 7.37187C20.1278 6.83097 19.9478 5.43673 19.7054 4.90461C19.4397 4.32101 17.9399 3.51438 17.4084 2.49428C16.8768 1.47418 17.34 0.233672 17.9558 0.0607684C18.5425 -0.103972 18.9615 0.0876835 19.2831 0.378128C19.4974 0.571763 20.0994 0.710259 20.3509 0.800409C20.6024 0.890558 21.0201 1.00918 20.9964 1.08035C20.9726 1.15152 20.5699 1.14202 20.5075 1.14202C20.3794 1.14202 20.2275 1.161 20.3794 1.23217C20.5575 1.30439 20.8263 1.40936 20.955 1.47846C20.9717 1.48744 20.9683 1.51084 20.95 1.51577C20.0765 1.75085 19.2966 1.26578 18.7183 1.82526C18.1298 2.39463 19.3827 2.83114 20.0282 3.51438C20.6736 4.19762 21.3381 5.01372 20.8065 6.87365C20.395 8.31355 18.6703 9.53781 17.7795 10.0167C17.7282 10.0442 17.7001 10.1031 17.7084 10.1607Z"/>
|
|
102
|
+
</g>
|
|
103
|
+
</svg>
|
|
104
|
+
`;export{e as c,r as h,o as l,a as n,t as r};
|
|
105
|
+
//# sourceMappingURL=icons-Dr_d9MII.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons-Dr_d9MII.js","sources":["../../src/common/icons.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n\nimport { Theme } from \"./types\";\n\nexport const replyIcon = `\n <svg width=\"18\" height=\"18\" fill=\"#00b3ff\">\n <path xmlns=\"http://www.w3.org/2000/svg\" d=\"M12.2197 1.65717C7.73973 1.25408 5.14439 0.940234 3.12891 2.6623C0.948817 4.52502 0.63207 7.66213 2.35603 9.88052C3.01043 10.7226 4.28767 11.9877 5.51513 13.1462C6.75696 14.3184 7.99593 15.426 8.60692 15.9671C8.61074 15.9705 8.61463 15.9739 8.61859 15.9774C8.67603 16.0283 8.74753 16.0917 8.81608 16.1433C8.89816 16.2052 9.01599 16.2819 9.17334 16.3288C9.38253 16.3912 9.60738 16.3912 9.81656 16.3288C9.97391 16.2819 10.0917 16.2052 10.1738 16.1433C10.2424 16.0917 10.3139 16.0283 10.3713 15.9774C10.3753 15.9739 10.3792 15.9705 10.383 15.9671C10.994 15.426 12.2329 14.3184 13.4748 13.1462C14.7022 11.9877 15.9795 10.7226 16.6339 9.88052C18.3512 7.67065 18.0834 4.50935 15.8532 2.65572C13.8153 0.961905 11.2476 1.25349 9.49466 2.78774Z\"/>\n </svg>\n`;\n\nexport const heartIcon = `\n <svg width=\"18\" height=\"18\">\n <g xmlns=\"http://www.w3.org/2000/svg\">\n <path fill=\"#ff006d\" d=\"M12.2197 1.65717C7.73973 1.25408 5.14439 0.940234 3.12891 2.6623C0.948817 4.52502 0.63207 7.66213 2.35603 9.88052C3.01043 10.7226 4.28767 11.9877 5.51513 13.1462C6.75696 14.3184 7.99593 15.426 8.60692 15.9671C8.61074 15.9705 8.61463 15.9739 8.61859 15.9774C8.67603 16.0283 8.74753 16.0917 8.81608 16.1433C8.89816 16.2052 9.01599 16.2819 9.17334 16.3288C9.38253 16.3912 9.60738 16.3912 9.81656 16.3288C9.97391 16.2819 10.0917 16.2052 10.1738 16.1433C10.2424 16.0917 10.3139 16.0283 10.3713 15.9774C10.3753 15.9739 10.3792 15.9705 10.383 15.9671C10.994 15.426 12.2329 14.3184 13.4748 13.1462C14.7022 11.9877 15.9795 10.7226 16.6339 9.88052C18.3512 7.67065 18.0834 4.50935 15.8532 2.65572C13.8153 0.961905 11.2476 1.25349 9.49466 2.78774Z\"/>\n </g>\n </svg>\n`;\n\nexport const copyIcon = `\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"/>\n </svg>\n`;\n\nexport const checkmarkIcon = (\n theme: Theme = 'dark',\n) => `\n <svg \n class=\"checkmark\" \n xmlns=\"http://www.w3.org/2000/svg\" \n viewBox=\"0 0 52 52\"\n role=\"img\"\n aria-label=\"Success checkmark\"\n >\n <style>\n .checkmark__circle {\n stroke-dasharray: 166;\n stroke-dashoffset: 166;\n stroke-width: 2;\n stroke-miterlimit: 10;\n stroke: #4bb71b;\n fill: none;\n animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;\n }\n\n .checkmark {\n width: 100%;\n height: 100%;\n border-radius: 50%;\n display: block;\n stroke-width: 3;\n stroke: #4bb71b;\n stroke-miterlimit: 10;\n margin: 0 auto;\n animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;\n }\n\n .checkmark__check {\n transform-origin: 50% 50%;\n stroke-dasharray: 48;\n stroke-dashoffset: 48;\n animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;\n }\n\n @keyframes stroke {\n 100% { stroke-dashoffset: 0; }\n }\n\n @keyframes scale {\n 0%, 100% { transform: none; }\n 50% { transform: scale3d(1.1, 1.1, 1); }\n }\n\n @keyframes fill {\n 100% { box-shadow: inset 0 0 0 30px ${theme === 'dark' ? '#FFF' : '#000'}; }\n }\n </style>\n <circle class=\"checkmark__circle\" cx=\"26\" cy=\"26\" r=\"25\" fill=\"${theme === 'dark' ? '#FFF' : '#000'}\"/>\n <path class=\"checkmark__check\" fill=\"none\" d=\"M14.1 27.2l7.1 7.2 16.7-16.8\"/>\n </svg>\n`;\n\nexport const nostrLogo = (width: number = 21, height: number = 24) => `\n <svg \n width=\"${width}\" \n height=\"${height}\" \n viewBox=\"0 0 21 24\" \n fill=\"none\" \n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n aria-label=\"Nostr logo\"\n >\n <style>\n .nostrich {\n transform-origin: center;\n }\n </style>\n <g class=\"nostrich\">\n <path d=\"M17.7084 10.1607C18.1683 13.3466 14.8705 14.0207 12.9733 13.9618C12.8515 13.958 12.7366 14.0173 12.6647 14.1157C12.4684 14.384 12.1547 14.7309 11.9125 14.7309C11.6405 14.7309 11.3957 15.254 11.284 15.5795C11.2723 15.6137 11.3059 15.6452 11.3403 15.634C14.345 14.6584 15.5241 14.3238 16.032 14.4178C16.4421 14.4937 17.209 15.8665 17.5413 16.5434C16.7155 16.5909 16.4402 15.8507 16.2503 15.7178C16.0985 15.6116 16.0415 16.0974 16.032 16.3536C15.8517 16.2587 15.6239 16.1259 15.6049 15.7178C15.5859 15.3098 15.3771 15.4142 15.2157 15.4332C15.0544 15.4521 12.5769 16.2493 12.2067 16.3536C11.8366 16.458 11.4094 16.6004 11.0582 16.8471C10.4697 17.1318 10.09 16.9325 9.98561 16.4485C9.90208 16.0614 10.4444 14.8701 10.726 14.3229C10.3779 14.4526 9.65529 14.7158 9.54898 14.7309C9.44588 14.7457 8.13815 15.7552 7.43879 16.3038C7.398 16.3358 7.37174 16.3827 7.36236 16.4336C7.25047 17.0416 6.89335 17.2118 6.27423 17.5303C5.77602 17.7867 4.036 20.4606 3.14127 21.9041C3.0794 22.0039 2.9886 22.0806 2.8911 22.1461C2.32279 22.5276 1.74399 23.4985 1.50923 23.9737C1.17511 23.0095 1.61048 22.1802 1.86993 21.886C1.75602 21.7873 1.49341 21.8449 1.37634 21.886C1.69907 20.7757 2.82862 20.7757 2.79066 20.7757C2.99948 20.5954 5.44842 17.0938 5.50538 16.9325C5.56187 16.7725 5.46892 16.0242 6.69975 15.6139C6.7193 15.6073 6.73868 15.5984 6.75601 15.5873C7.71493 14.971 8.43427 13.9774 8.67571 13.5542C7.39547 13.4662 5.92943 12.7525 5.16289 12.294C4.99765 12.1952 4.8224 12.1092 4.63108 12.0875C3.58154 11.9687 2.53067 12.6401 2.10723 13.0228C1.93258 12.7799 2.12938 12.0739 2.24961 11.7513C1.82437 11.6905 1.19916 12.308 0.939711 12.6243C0.658747 12.184 0.904907 11.397 1.06311 11.0585C0.501179 11.0737 0.120232 11.3306 0 11.4571C0.465109 7.99343 4.02275 9.00076 4.06259 9.04675C3.87275 8.84937 3.88857 8.59126 3.92021 8.48688C6.0749 8.54381 7.08105 8.18321 7.71702 7.81313C12.7288 5.01374 14.8882 6.73133 15.6856 7.1631C16.4829 7.59487 17.9304 7.77042 18.9318 7.37187C20.1278 6.83097 19.9478 5.43673 19.7054 4.90461C19.4397 4.32101 17.9399 3.51438 17.4084 2.49428C16.8768 1.47418 17.34 0.233672 17.9558 0.0607684C18.5425 -0.103972 18.9615 0.0876835 19.2831 0.378128C19.4974 0.571763 20.0994 0.710259 20.3509 0.800409C20.6024 0.890558 21.0201 1.00918 20.9964 1.08035C20.9726 1.15152 20.5699 1.14202 20.5075 1.14202C20.3794 1.14202 20.2275 1.161 20.3794 1.23217C20.5575 1.30439 20.8263 1.40936 20.955 1.47846C20.9717 1.48744 20.9683 1.51084 20.95 1.51577C20.0765 1.75085 19.2966 1.26578 18.7183 1.82526C18.1298 2.39463 19.3827 2.83114 20.0282 3.51438C20.6736 4.19762 21.3381 5.01372 20.8065 6.87365C20.395 8.31355 18.6703 9.53781 17.7795 10.0167C17.7282 10.0442 17.7001 10.1031 17.7084 10.1607Z\"/>\n </g>\n </svg>\n`;\n\nexport const loadingNostrich = () => `\n <svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <style>\n @keyframes nostrich-run {\n 0% { transform: translateX(0) rotate(0deg); }\n 20% { transform: translateX(10px) rotate(5deg); }\n 40% { transform: translateX(0) rotate(0deg); }\n 60% { transform: translateX(-10px) rotate(-5deg); }\n 80% { transform: translateX(0) rotate(0deg); }\n 100% { transform: translateX(0) rotate(0deg); }\n }\n .nostrich {\n animation: nostrich-run 1.5s infinite ease-in-out;\n transform-origin: center;\n }\n </style>\n <g class=\"nostrich\">\n <path d=\"M17.7084 10.1607C18.1683 13.3466 14.8705 14.0207 12.9733 13.9618C12.8515 13.958 12.7366 14.0173 12.6647 14.1157C12.4684 14.384 12.1547 14.7309 11.9125 14.7309C11.6405 14.7309 11.3957 15.254 11.284 15.5795C11.2723 15.6137 11.3059 15.6452 11.3403 15.634C14.345 14.6584 15.5241 14.3238 16.032 14.4178C16.4421 14.4937 17.209 15.8665 17.5413 16.5434C16.7155 16.5909 16.4402 15.8507 16.2503 15.7178C16.0985 15.6116 16.0415 16.0974 16.032 16.3536C15.8517 16.2587 15.6239 16.1259 15.6049 15.7178C15.5859 15.3098 15.3771 15.4142 15.2157 15.4332C15.0544 15.4521 12.5769 16.2493 12.2067 16.3536C11.8366 16.458 11.4094 16.6004 11.0582 16.8471C10.4697 17.1318 10.09 16.9325 9.98561 16.4485C9.90208 16.0614 10.4444 14.8701 10.726 14.3229C10.3779 14.4526 9.65529 14.7158 9.54898 14.7309C9.44588 14.7457 8.13815 15.7552 7.43879 16.3038C7.398 16.3358 7.37174 16.3827 7.36236 16.4336C7.25047 17.0416 6.89335 17.2118 6.27423 17.5303C5.77602 17.7867 4.036 20.4606 3.14127 21.9041C3.0794 22.0039 2.9886 22.0806 2.8911 22.1461C2.32279 22.5276 1.74399 23.4985 1.50923 23.9737C1.17511 23.0095 1.61048 22.1802 1.86993 21.886C1.75602 21.7873 1.49341 21.8449 1.37634 21.886C1.69907 20.7757 2.82862 20.7757 2.79066 20.7757C2.99948 20.5954 5.44842 17.0938 5.50538 16.9325C5.56187 16.7725 5.46892 16.0242 6.69975 15.6139C6.7193 15.6073 6.73868 15.5984 6.75601 15.5873C7.71493 14.971 8.43427 13.9774 8.67571 13.5542C7.39547 13.4662 5.92943 12.7525 5.16289 12.294C4.99765 12.1952 4.8224 12.1092 4.63108 12.0875C3.58154 11.9687 2.53067 12.6401 2.10723 13.0228C1.93258 12.7799 2.12938 12.0739 2.24961 11.7513C1.82437 11.6905 1.19916 12.308 0.939711 12.6243C0.658747 12.184 0.904907 11.397 1.06311 11.0585C0.501179 11.0737 0.120232 11.3306 0 11.4571C0.465109 7.99343 4.02275 9.00076 4.06259 9.04675C3.87275 8.84937 3.88857 8.59126 3.92021 8.48688C6.0749 8.54381 7.08105 8.18321 7.71702 7.81313C12.7288 5.01374 14.8882 6.73133 15.6856 7.1631C16.4829 7.59487 17.9304 7.77042 18.9318 7.37187C20.1278 6.83097 19.9478 5.43673 19.7054 4.90461C19.4397 4.32101 17.9399 3.51438 17.4084 2.49428C16.8768 1.47418 17.34 0.233672 17.9558 0.0607684C18.5425 -0.103972 18.9615 0.0876835 19.2831 0.378128C19.4974 0.571763 20.0994 0.710259 20.3509 0.800409C20.6024 0.890558 21.0201 1.00918 20.9964 1.08035C20.9726 1.15152 20.5699 1.14202 20.5075 1.14202C20.3794 1.14202 20.2275 1.161 20.3794 1.23217C20.5575 1.30439 20.8263 1.40936 20.955 1.47846C20.9717 1.48744 20.9683 1.51084 20.95 1.51577C20.0765 1.75085 19.2966 1.26578 18.7183 1.82526C18.1298 2.39463 19.3827 2.83114 20.0282 3.51438C20.6736 4.19762 21.3381 5.01372 20.8065 6.87365C20.395 8.31355 18.6703 9.53781 17.7795 10.0167C17.7282 10.0442 17.7001 10.1031 17.7084 10.1607Z\"/>\n </g>\n </svg>\n`;\n"],"names":["replyIcon","heartIcon","checkmarkIcon","theme","nostrLogo","width","height","loadingNostrich"],"mappings":"AAIO,MAAMA,EAAY;AAAA;AAAA;AAAA;AAAA,EAMZC,EAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcZC,EAAgB,CAC3BC,EAAe,SACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8CAgDyCA,IAAU,OAAS,OAAS,MAAM;AAAA;AAAA;AAAA,qEAGXA,IAAU,OAAS,OAAS,MAAM;AAAA;AAAA;AAAA,EAK1FC,EAAY,CAACC,EAAgB,GAAIC,EAAiB,KAAO;AAAA;AAAA,aAEzDD,CAAK;AAAA,cACJC,CAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBPC,EAAkB,IAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
async function f(r,i=5e3){var a;if(!/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/.test(r))throw new Error("Invalid NIP-05 format");const[n,t]=r.split("@");if(!n||!t)throw new Error("Invalid NIP-05: missing name or domain");const c=`https://${t}/.well-known/nostr.json?name=${encodeURIComponent(n)}`,e=new AbortController,l=setTimeout(()=>e.abort(),i);try{const o=await fetch(c,{headers:{accept:"application/json"},signal:e.signal});if(!o.ok)throw new Error("Unable to resolve NIP-05");const s=(a=(await o.json()).names)==null?void 0:a[n];if(!s)throw new Error("NIP-05 not found");return s}catch(o){throw o instanceof Error&&o.name==="AbortError"?new Error("NIP-05 resolution timed out"):o}finally{clearTimeout(l)}}export{f as r};
|
|
2
|
+
//# sourceMappingURL=nip05-utils-BNBHUmkr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nip05-utils-BNBHUmkr.js","sources":["../../src/common/nip05-utils.ts"],"sourcesContent":["/**\n * NIP-05 utility functions for resolving nostr identifiers\n */\n\n/**\n * Resolves a NIP-05 identifier to a nostr public key\n * Includes input validation and request timeout for security\n * \n * @param nip05 - NIP-05 identifier in format username@domain.com\n * @param timeoutMs - Timeout in milliseconds (default: 5000)\n * @returns Resolved public key\n * @throws Error if validation fails, timeout occurs, or resolution fails\n */\nexport async function resolveNip05(nip05: string, timeoutMs: number = 5000): Promise<string> {\n // Validate NIP-05 format (contains exactly one @ with valid characters)\n const nip05Regex = /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/;\n if (!nip05Regex.test(nip05)) {\n throw new Error(\"Invalid NIP-05 format\");\n }\n\n const [name, domain] = nip05.split(\"@\");\n if (!name || !domain) {\n throw new Error(\"Invalid NIP-05: missing name or domain\");\n }\n\n const url = `https://${domain}/.well-known/nostr.json?name=${encodeURIComponent(name)}`;\n \n // Set up AbortController for timeout\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeoutMs);\n \n try {\n const res = await fetch(url, { \n headers: { accept: \"application/json\" },\n signal: controller.signal\n });\n \n if (!res.ok) {\n throw new Error(\"Unable to resolve NIP-05\");\n }\n \n const json = await res.json();\n const pubkey = json.names?.[name];\n \n if (!pubkey) {\n throw new Error(\"NIP-05 not found\");\n }\n \n return pubkey as string;\n } catch (error: unknown) {\n if (error instanceof Error && error.name === 'AbortError') {\n throw new Error(\"NIP-05 resolution timed out\");\n }\n throw error;\n } finally {\n clearTimeout(timeoutId);\n }\n}\n"],"names":["resolveNip05","nip05","timeoutMs","_a","name","domain","url","controller","timeoutId","res","pubkey","error"],"mappings":"AAasB,eAAAA,EAAaC,EAAeC,EAAoB,IAAuB,CAAvE,IAAAC,EAGpB,GAAI,CADe,mDACH,KAAKF,CAAK,EAClB,MAAA,IAAI,MAAM,uBAAuB,EAGzC,KAAM,CAACG,EAAMC,CAAM,EAAIJ,EAAM,MAAM,GAAG,EAClC,GAAA,CAACG,GAAQ,CAACC,EACN,MAAA,IAAI,MAAM,wCAAwC,EAG1D,MAAMC,EAAM,WAAWD,CAAM,gCAAgC,mBAAmBD,CAAI,CAAC,GAG/EG,EAAa,IAAI,gBACjBC,EAAY,WAAW,IAAMD,EAAW,MAAA,EAASL,CAAS,EAE5D,GAAA,CACI,MAAAO,EAAM,MAAM,MAAMH,EAAK,CAC3B,QAAS,CAAE,OAAQ,kBAAmB,EACtC,OAAQC,EAAW,MAAA,CACpB,EAEG,GAAA,CAACE,EAAI,GACD,MAAA,IAAI,MAAM,0BAA0B,EAItC,MAAAC,GAASP,GADF,MAAMM,EAAI,KAAK,GACR,QAAL,YAAAN,EAAaC,GAE5B,GAAI,CAACM,EACG,MAAA,IAAI,MAAM,kBAAkB,EAG7B,OAAAA,QACAC,EAAgB,CACvB,MAAIA,aAAiB,OAASA,EAAM,OAAS,aACrC,IAAI,MAAM,6BAA6B,EAEzCA,CAAA,QACN,CACA,aAAaH,CAAS,CAAA,CAE1B"}
|