hermesbuttons 1.1.0 → 1.1.2
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/dist/{chunk-7JMZRFCQ.mjs → chunk-GK6K44OK.mjs} +34 -34
- package/dist/chunk-GK6K44OK.mjs.map +1 -0
- package/dist/{hermes-button-LIZ6A5MH.mjs → hermes-button-RRJ6D2US.mjs} +13 -13
- package/dist/hermes-button-RRJ6D2US.mjs.map +1 -0
- package/dist/{hermes-skill-button-AWROXEAX.mjs → hermes-skill-button-WZIOOH2O.mjs} +13 -13
- package/dist/hermes-skill-button-WZIOOH2O.mjs.map +1 -0
- package/dist/index.global.js +56 -56
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +75 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -75
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +49 -49
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -1
- package/dist/vue.js +97 -97
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +55 -55
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-7JMZRFCQ.mjs.map +0 -1
- package/dist/hermes-button-LIZ6A5MH.mjs.map +0 -1
- package/dist/hermes-skill-button-AWROXEAX.mjs.map +0 -1
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";"use client";var K=Object.defineProperty;var
|
|
1
|
+
"use strict";"use client";var K=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var pt=Object.prototype.hasOwnProperty;var R=(a,n)=>()=>(a&&(n=a(a=0)),n);var Y=(a,n)=>{for(var t in n)K(a,t,{get:n[t],enumerable:!0})},bt=(a,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of ct(n))!pt.call(a,e)&&e!==t&&K(a,e,{get:()=>n[e],enumerable:!(o=lt(n,e))||o.enumerable});return a};var ut=a=>bt(K({},"__esModule",{value:!0}),a);function et(){return typeof document<"u"}function mt(){if(!et())return null;let a=document.cookie.split(";").map(t=>t.trim()).find(t=>t.startsWith(`${Z}=`));if(!a)return null;let n=a.slice(Z.length+1);if(!n)return null;try{let t=decodeURIComponent(n),o=JSON.parse(t);return!o||typeof o!="object"||!Array.isArray(o.order)?null:{order:o.order.filter(r=>typeof r=="string"&&r.length>0)}}catch{return null}}function gt(a){if(!et())return;let n=a.order.slice(0,24),t=JSON.stringify({order:n}),o=new Date;o.setFullYear(o.getFullYear()+1),document.cookie=`${Z}=${encodeURIComponent(t)}; Path=/; SameSite=Lax; Expires=${o.toUTCString()}`}function L(a){if(!a||typeof a!="string")return;let t=mt()?.order.filter(o=>o!==a)??[];gt({order:[a,...t]})}var Z,J=R(()=>{"use strict";Z="agentpreferences"});var z,N,H,ot,at,P=R(()=>{"use strict";z=`<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon">
|
|
2
2
|
<!-- Wing helmet -->
|
|
3
3
|
<path d="M12 2C8.5 2 6 4.5 6 7c0 1.5.5 2.8 1.5 3.8L6 14h12l-1.5-3.2C17.5 9.8 18 8.5 18 7c0-2.5-2.5-5-6-5z" fill="currentColor" opacity="0.2"/>
|
|
4
4
|
<path d="M12 2C8.5 2 6 4.5 6 7c0 1.5.5 2.8 1.5 3.8L6 14h12l-1.5-3.2C17.5 9.8 18 8.5 18 7c0-2.5-2.5-5-6-5z" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linejoin="round"/>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<path d="M9.5 19c1.5 1 3.5 1 5 0" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" fill="none"/>
|
|
13
13
|
<!-- Eye -->
|
|
14
14
|
<circle cx="12" cy="7.5" r="1.5" fill="currentColor"/>
|
|
15
|
-
</svg>`,
|
|
15
|
+
</svg>`,N=`<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon">
|
|
16
16
|
<!-- Brain/memory symbol -->
|
|
17
17
|
<path d="M12 3C8 3 5 6 5 9c0 2 1 3.5 2 4.5V16a2 2 0 002 2h6a2 2 0 002-2v-2.5c1-1 2-2.5 2-4.5 0-3-3-6-7-6z" fill="currentColor" opacity="0.15"/>
|
|
18
18
|
<path d="M12 3C8 3 5 6 5 9c0 2 1 3.5 2 4.5V16a2 2 0 002 2h6a2 2 0 002-2v-2.5c1-1 2-2.5 2-4.5 0-3-3-6-7-6z" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linejoin="round"/>
|
|
@@ -23,25 +23,25 @@
|
|
|
23
23
|
<!-- Sparkle -->
|
|
24
24
|
<circle cx="8" cy="6" r="0.8" fill="currentColor"/>
|
|
25
25
|
<circle cx="16" cy="6" r="0.8" fill="currentColor"/>
|
|
26
|
-
</svg>`,
|
|
26
|
+
</svg>`,H=`<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon-sm">
|
|
27
27
|
<rect x="5" y="5" width="8" height="8" rx="1.5" stroke="currentColor" stroke-width="1.5" fill="none"/>
|
|
28
28
|
<path d="M3 10V3.5A1.5 1.5 0 014.5 2H10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
29
|
-
</svg>`,
|
|
29
|
+
</svg>`,ot=`<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon-sm">
|
|
30
30
|
<path d="M3 8.5l3.5 3.5L13 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31
|
-
</svg>`,
|
|
31
|
+
</svg>`,at=`<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon-sm">
|
|
32
32
|
<path d="M4 4l8 8m0-8l-8 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
33
|
-
</svg>`});function k(
|
|
34
|
-
--hb-bg: ${
|
|
35
|
-
--hb-text: ${
|
|
36
|
-
--hb-border: ${
|
|
37
|
-
--hb-surface: ${
|
|
38
|
-
--hb-surface-text: ${
|
|
39
|
-
--hb-muted: ${
|
|
40
|
-
--hb-primary: ${
|
|
41
|
-
--hb-primary-text: ${
|
|
42
|
-
--hb-code-bg: ${
|
|
43
|
-
--hb-code-text: ${
|
|
44
|
-
`}var d,T,
|
|
33
|
+
</svg>`});function k(a){return a!=="system"?D[a]:typeof window>"u"?D.light:window.matchMedia("(prefers-color-scheme: dark)").matches?D.dark:D.light}function O(a){return`
|
|
34
|
+
--hb-bg: ${a.bg};
|
|
35
|
+
--hb-text: ${a.text};
|
|
36
|
+
--hb-border: ${a.border};
|
|
37
|
+
--hb-surface: ${a.surface};
|
|
38
|
+
--hb-surface-text: ${a.surfaceText};
|
|
39
|
+
--hb-muted: ${a.muted};
|
|
40
|
+
--hb-primary: ${a.primary};
|
|
41
|
+
--hb-primary-text: ${a.primaryText};
|
|
42
|
+
--hb-code-bg: ${a.codeBg};
|
|
43
|
+
--hb-code-text: ${a.codeText};
|
|
44
|
+
`}var d,T,I,l,C,q,V,g,D,U,j,W=R(()=>{"use strict";d="#2B8CFF",T="#1E7AEB",I="#186BD4",l="43, 140, 255",C="#8FA3E8",q="#7B91DC",V="#6B82CC",g="143, 163, 232",D={branded:{bg:d,text:"#FFFFFF",border:"transparent",surface:"#FFFFFF",surfaceText:"#0F172A",muted:"#64748B",primary:d,primaryText:"#FFFFFF",codeBg:"#0F172A",codeText:"#F1F5F9"},"branded-alt":{bg:C,text:"#FFFFFF",border:"transparent",surface:"#FFFFFF",surfaceText:"#0F172A",muted:"#64748B",primary:C,primaryText:"#FFFFFF",codeBg:"#0F172A",codeText:"#F1F5F9"},dark:{bg:"#141C2E",text:"#F1F5F9",border:"#2A3F5C",surface:"#1A2740",surfaceText:"#F1F5F9",muted:"#94A3B8",primary:d,primaryText:"#FFFFFF",codeBg:"#0A0E18",codeText:"#F1F5F9"},light:{bg:"#FFFFFF",text:"#0F172A",border:"#CBD5E1",surface:"#F8FAFC",surfaceText:"#0F172A",muted:"#64748B",primary:d,primaryText:"#FFFFFF",codeBg:"#0F172A",codeText:"#F1F5F9"}};U={rounded:{sm:"0.375rem",md:"0.5rem",lg:"0.625rem"},pill:{sm:"999px",md:"999px",lg:"999px"},square:{sm:"0",md:"0",lg:"0"}},j={sm:{height:"2rem",fontSize:"0.75rem",iconSize:"0.875rem",padding:"0 0.75rem",ccPadding:"0 0.5rem",gap:"0.375rem",radius:"0.375rem"},md:{height:"2.5rem",fontSize:"0.875rem",iconSize:"1.125rem",padding:"0 1rem",ccPadding:"0 0.75rem",gap:"0.5rem",radius:"0.5rem"},lg:{height:"3rem",fontSize:"1rem",iconSize:"1.375rem",padding:"0 1.25rem",ccPadding:"0 1rem",gap:"0.625rem",radius:"0.625rem"}}});function G(a){let n=document.createElement("hermes-popup-dialog");return n.options=a,document.body.appendChild(n),n}var vt,X,Q=R(()=>{"use strict";P();W();vt=`
|
|
45
45
|
:host {
|
|
46
46
|
position: fixed;
|
|
47
47
|
inset: 0;
|
|
@@ -318,21 +318,21 @@
|
|
|
318
318
|
@supports (padding: env(safe-area-inset-bottom)) {
|
|
319
319
|
.hb-dialog-footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
|
|
320
320
|
}
|
|
321
|
-
`,
|
|
322
|
-
<style>${
|
|
323
|
-
<div style="${
|
|
321
|
+
`,X=class extends HTMLElement{constructor(){super();this._mqCleanup=null;this.attachShadow({mode:"open"})}set options(t){this._options=t,this.render()}get options(){return this._options}disconnectedCallback(){this._mqCleanup?.(),this._mqCleanup=null}resolvePopupTokens(){let{theme:t}=this._options;if(t==="dark"||t==="light")return k(t);let o=typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches;if(t==="system")return o?k("dark"):k("light");let e=o?k("dark"):k("light"),r=k(t);return{...e,primary:r.primary,primaryText:r.primaryText}}render(){if(!this.shadowRoot||!this._options)return;let{variant:t,title:o,description:e,command:r,fullCommand:i,skillUrl:h}=this._options,s=this.resolvePopupTokens(),p=t==="hermes"?z:N,b=t==="hermes",w=i||r;this.shadowRoot.innerHTML=`
|
|
322
|
+
<style>${vt}</style>
|
|
323
|
+
<div style="${O(s)}">
|
|
324
324
|
<div class="hb-backdrop" data-action="close"></div>
|
|
325
325
|
<div class="hb-dialog" role="dialog" aria-modal="true" aria-labelledby="hb-dialog-title">
|
|
326
326
|
<div class="hb-dialog-header">
|
|
327
327
|
<div class="hb-dialog-header-icon">${p}</div>
|
|
328
328
|
<div class="hb-dialog-header-text">
|
|
329
|
-
<div class="hb-dialog-title" id="hb-dialog-title">${
|
|
329
|
+
<div class="hb-dialog-title" id="hb-dialog-title">${o}</div>
|
|
330
330
|
${e?`<div class="hb-dialog-description">${e}</div>`:""}
|
|
331
331
|
</div>
|
|
332
|
-
<button class="hb-dialog-close" data-action="close" aria-label="Close">${
|
|
332
|
+
<button class="hb-dialog-close" data-action="close" aria-label="Close">${at}</button>
|
|
333
333
|
</div>
|
|
334
334
|
<div class="hb-dialog-body">
|
|
335
|
-
${b?this.renderHermesTerminalBody(w):this.renderHermesSkillBody(
|
|
335
|
+
${b?this.renderHermesTerminalBody(w):this.renderHermesSkillBody(r,h)}
|
|
336
336
|
</div>
|
|
337
337
|
<div class="hb-dialog-footer">
|
|
338
338
|
${b?`
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
<div class="hb-step-label">Copy this command to your clipboard</div>
|
|
351
351
|
<div class="hb-code-block">
|
|
352
352
|
<div class="hb-code-text"><span class="hb-code-prefix">$</span>${this.escapeHtml(t)}</div>
|
|
353
|
-
<button class="hb-copy-btn" data-action="copy" data-command="${this.escapeAttr(t)}">${
|
|
353
|
+
<button class="hb-copy-btn" data-action="copy" data-command="${this.escapeAttr(t)}">${H}<span>Copy</span></button>
|
|
354
354
|
</div>
|
|
355
355
|
</div>
|
|
356
356
|
</div>
|
|
@@ -360,14 +360,14 @@
|
|
|
360
360
|
<div class="hb-step-label">Paste and run in your terminal</div>
|
|
361
361
|
</div>
|
|
362
362
|
</div>
|
|
363
|
-
`}renderHermesSkillBody(t,
|
|
363
|
+
`}renderHermesSkillBody(t,o){let e="";if(o){let r=`Install the skill from ${o} and run ${t}`;e+=`
|
|
364
364
|
<div class="hb-step">
|
|
365
365
|
<div class="hb-step-num">1</div>
|
|
366
366
|
<div class="hb-step-content">
|
|
367
367
|
<div class="hb-step-label">Copy this prompt to your clipboard</div>
|
|
368
368
|
<div class="hb-code-block">
|
|
369
|
-
<div class="hb-code-text">${this.escapeHtml(
|
|
370
|
-
<button class="hb-copy-btn" data-action="copy" data-command="${this.escapeAttr(
|
|
369
|
+
<div class="hb-code-text">${this.escapeHtml(r)}</div>
|
|
370
|
+
<button class="hb-copy-btn" data-action="copy" data-command="${this.escapeAttr(r)}">${H}<span>Copy</span></button>
|
|
371
371
|
</div>
|
|
372
372
|
</div>
|
|
373
373
|
</div>
|
|
@@ -384,7 +384,7 @@
|
|
|
384
384
|
<div class="hb-step-label">Copy this command to your clipboard</div>
|
|
385
385
|
<div class="hb-code-block">
|
|
386
386
|
<div class="hb-code-text">${this.escapeHtml(t)}</div>
|
|
387
|
-
<button class="hb-copy-btn" data-action="copy" data-command="${this.escapeAttr(t)}">${
|
|
387
|
+
<button class="hb-copy-btn" data-action="copy" data-command="${this.escapeAttr(t)}">${H}<span>Copy</span></button>
|
|
388
388
|
</div>
|
|
389
389
|
</div>
|
|
390
390
|
</div>
|
|
@@ -394,7 +394,7 @@
|
|
|
394
394
|
<div class="hb-step-label">Paste and send in your Hermes session</div>
|
|
395
395
|
</div>
|
|
396
396
|
</div>
|
|
397
|
-
`;return e}setupListeners(){this.shadowRoot&&(this.shadowRoot.addEventListener("click",t=>{let
|
|
397
|
+
`;return e}setupListeners(){this.shadowRoot&&(this.shadowRoot.addEventListener("click",t=>{let o=t.target.closest("[data-action]");if(!o)return;let e=o.dataset.action;if(e==="close")this.close();else if(e==="copy"){let r=o.dataset.command||"";this.copyToClipboard(r,o)}}),this.shadowRoot.addEventListener("keydown",t=>{t.key==="Escape"&&this.close()}))}setupSystemThemeWatch(){this._mqCleanup?.(),this._mqCleanup=null;let t=this._options.theme;if(!(t==="system"||t==="branded"||t==="branded-alt")||typeof window>"u")return;let e=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>this.render();e.addEventListener("change",r),this._mqCleanup=()=>e.removeEventListener("change",r)}async copyToClipboard(t,o){try{await navigator.clipboard.writeText(t);let e=o.querySelector("span"),r=o;o.setAttribute("data-copied","true"),e&&(e.textContent="Copied!"),r.innerHTML=`${ot}<span>Copied!</span>`,this._options.onCopy?.(t),setTimeout(()=>{o.setAttribute("data-copied","false"),r.innerHTML=`${H}<span>Copy</span>`},2e3)}catch{let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),this._options.onCopy?.(t)}}close(){let t=this.shadowRoot?.querySelector(".hb-dialog"),o=this.shadowRoot?.querySelector(".hb-backdrop");t&&(t.style.animation="hb-scale-in 0.15s ease-in reverse"),o&&(o.style.animation="hb-fade-in 0.15s ease-in reverse"),setTimeout(()=>{this._options.onClose?.(),this.remove()},140)}escapeHtml(t){let o=document.createElement("div");return o.textContent=t,o.innerHTML}escapeAttr(t){return t.replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}};typeof customElements<"u"&&!customElements.get("hermes-popup-dialog")&&customElements.define("hermes-popup-dialog",X)});var nt={};Y(nt,{HermesButton:()=>B,createHermesButton:()=>xt,registerHermesButton:()=>rt});function rt(a="hermes-button"){typeof customElements>"u"||customElements.get(a)||customElements.define(a,B)}function xt(a){let n=document.createElement("hermes-button");return n.options=a,n}var ft,B,it=R(()=>{"use strict";J();P();W();Q();ft=`
|
|
398
398
|
:host {
|
|
399
399
|
display: inline-block;
|
|
400
400
|
vertical-align: middle;
|
|
@@ -443,15 +443,15 @@
|
|
|
443
443
|
box-shadow: 0 2px 8px rgba(${l}, 0.35);
|
|
444
444
|
}
|
|
445
445
|
:host([data-variant="filled"][data-theme="branded"]) .hb-btn:active {
|
|
446
|
-
background: ${
|
|
446
|
+
background: ${I};
|
|
447
447
|
transform: scale(0.98);
|
|
448
448
|
}
|
|
449
449
|
:host([data-variant="filled"][data-theme="branded-alt"]) .hb-btn:hover {
|
|
450
|
-
background: ${
|
|
450
|
+
background: ${q};
|
|
451
451
|
box-shadow: 0 2px 8px rgba(${g}, 0.35);
|
|
452
452
|
}
|
|
453
453
|
:host([data-variant="filled"][data-theme="branded-alt"]) .hb-btn:active {
|
|
454
|
-
background: ${
|
|
454
|
+
background: ${V};
|
|
455
455
|
transform: scale(0.98);
|
|
456
456
|
}
|
|
457
457
|
|
|
@@ -631,18 +631,18 @@
|
|
|
631
631
|
.hb-btn-label {
|
|
632
632
|
letter-spacing: -0.01em;
|
|
633
633
|
}
|
|
634
|
-
`,
|
|
635
|
-
<style>${
|
|
634
|
+
`,B=class extends HTMLElement{constructor(){super();this._options={command:"",theme:"branded",size:"md",variant:"filled",popup:!0,promptFlag:!0};this._mqCleanup=null;this._rendered=!1;this.attachShadow({mode:"open"})}connectedCallback(){this.syncFromAttributes(),this.render(),this.updateLightDOM()}disconnectedCallback(){this._mqCleanup?.(),this._mqCleanup=null}attributeChangedCallback(){this._rendered&&(this.syncFromAttributes(),this.render(),this.updateLightDOM())}set options(t){this._options={...this._options,...t},this.render(),this.updateLightDOM()}get options(){return this._options}syncFromAttributes(){let t=this.getAttribute("command"),o=this.getAttribute("theme"),e=this.getAttribute("size"),r=this.getAttribute("variant"),i=this.getAttribute("shape"),h=this.getAttribute("popup"),s=this.getAttribute("prompt-flag"),p=this.getAttribute("popup-title"),b=this.getAttribute("popup-description");t!==null&&(this._options.command=t),o&&(this._options.theme=o),e&&(this._options.size=e),r&&(this._options.variant=r),i&&(this._options.shape=i),h!==null&&(this._options.popup=h!=="false"),s!==null&&(this._options.promptFlag=s!=="false"),p!==null&&(this._options.popupTitle=p),b!==null&&(this._options.popupDescription=b)}updateLightDOM(){let{command:t}=this._options,o=this.getFullCommand();this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-label",`Run on Hermes: ${t}`),this._options.popup!==!1?this.setAttribute("aria-haspopup","dialog"):this.removeAttribute("aria-haspopup");let e=this.querySelector("a[data-hb-crawl]");e||(e=document.createElement("a"),e.setAttribute("data-hb-crawl",""),e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",this.appendChild(e)),e.href=`https://hermes.ai/run?command=${encodeURIComponent(o)}`,e.textContent=`Run on Hermes: ${t}`,e.setAttribute("data-platform","hermes"),e.setAttribute("data-command",t),e.setAttribute("data-full-command",o)}getResolvedTheme(){return this._options.theme||"branded"}getFullCommand(){let{command:t,promptFlag:o}=this._options;return o===!1?t:`hermes -p "${t}"`}render(){if(!this.shadowRoot)return;let t=this.getResolvedTheme(),o=t==="system"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,e=this._options.variant||"filled",r=k(t),i=this._options.size||"md",h=this._options.shape||"rounded",s=j[i],p=U[h][i];this.setAttribute("data-theme",o),this.setAttribute("data-variant",e);let b=e!=="filled"?"transparent":r.bg,w=e==="ghost"?"transparent":e==="outline"?r.primary:r.border,E=e!=="filled"?r.primary:r.text;this.shadowRoot.innerHTML=`
|
|
635
|
+
<style>${ft}</style>
|
|
636
636
|
<button
|
|
637
637
|
class="hb-btn"
|
|
638
638
|
type="button"
|
|
639
639
|
style="
|
|
640
|
-
${
|
|
640
|
+
${O(r)}
|
|
641
641
|
--hb-bg: ${b};
|
|
642
642
|
--hb-border: ${w};
|
|
643
643
|
--hb-text: ${E};
|
|
644
|
-
--hb-accent-color: ${
|
|
645
|
-
--hb-focus-color: ${
|
|
644
|
+
--hb-accent-color: ${r.primary};
|
|
645
|
+
--hb-focus-color: ${r.primary};
|
|
646
646
|
--hb-height: ${s.height};
|
|
647
647
|
--hb-font-size: ${s.fontSize};
|
|
648
648
|
--hb-icon-size: ${s.iconSize};
|
|
@@ -652,10 +652,10 @@
|
|
|
652
652
|
"
|
|
653
653
|
aria-label="Run on Hermes: ${this._options.command.replace(/"/g,""")}"
|
|
654
654
|
>
|
|
655
|
-
<span class="hb-btn-icon" aria-hidden="true">${
|
|
655
|
+
<span class="hb-btn-icon" aria-hidden="true">${z}</span>
|
|
656
656
|
<span class="hb-btn-label">Run on Hermes</span>
|
|
657
657
|
</button>
|
|
658
|
-
`;let f=this.shadowRoot.querySelector(".hb-btn");f.addEventListener("click",()=>this.handleClick()),f.addEventListener("keydown",v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),this.handleClick())}),this._rendered=!0,this.setupSystemThemeWatch()}handleClick(){let{popup:t,command:
|
|
658
|
+
`;let f=this.shadowRoot.querySelector(".hb-btn");f.addEventListener("click",()=>this.handleClick()),f.addEventListener("keydown",v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),this.handleClick())}),this._rendered=!0,this.setupSystemThemeWatch()}handleClick(){let{popup:t,command:o,popupTitle:e,popupDescription:r}=this._options,i=this.getFullCommand();if(this.dispatchEvent(new CustomEvent("hb-open",{bubbles:!0,composed:!0,detail:{command:o,fullCommand:i}})),t===!1){navigator.clipboard.writeText(i).then(()=>{this._options.onCopy?.(i),L("hermes"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:i}}))});return}G({variant:"hermes",theme:this.getResolvedTheme(),title:e||"Run on Hermes",description:r||"Execute this command in your terminal to get started with Hermes Agent.",command:o,fullCommand:i,onCopy:h=>{this._options.onCopy?.(h),L("hermes"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:h}}))},onClose:()=>{this.dispatchEvent(new CustomEvent("hb-close",{bubbles:!0,composed:!0}))}})}setupSystemThemeWatch(){if(this._mqCleanup?.(),this._mqCleanup=null,this.getResolvedTheme()!=="system"||typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>this.render();t.addEventListener("change",o),this._mqCleanup=()=>t.removeEventListener("change",o)}};B.observedAttributes=["command","theme","size","variant","shape","popup","prompt-flag","popup-title","popup-description"];rt()});var dt={};Y(dt,{HermesSkillButton:()=>M,createHermesSkillButton:()=>yt,registerHermesSkillButton:()=>st});function st(a="hermes-skill-button"){typeof customElements>"u"||customElements.get(a)||customElements.define(a,M)}function yt(a){let n=document.createElement("hermes-skill-button");return n.options=a,n}var kt,M,ht=R(()=>{"use strict";J();P();W();Q();kt=`
|
|
659
659
|
:host {
|
|
660
660
|
display: inline-block;
|
|
661
661
|
vertical-align: middle;
|
|
@@ -704,15 +704,15 @@
|
|
|
704
704
|
box-shadow: 0 2px 8px rgba(${l}, 0.35);
|
|
705
705
|
}
|
|
706
706
|
:host([data-variant="filled"][data-theme="branded"]) .hb-btn:active {
|
|
707
|
-
background: ${
|
|
707
|
+
background: ${I};
|
|
708
708
|
transform: scale(0.98);
|
|
709
709
|
}
|
|
710
710
|
:host([data-variant="filled"][data-theme="branded-alt"]) .hb-btn:hover {
|
|
711
|
-
background: ${
|
|
711
|
+
background: ${q};
|
|
712
712
|
box-shadow: 0 2px 8px rgba(${g}, 0.35);
|
|
713
713
|
}
|
|
714
714
|
:host([data-variant="filled"][data-theme="branded-alt"]) .hb-btn:active {
|
|
715
|
-
background: ${
|
|
715
|
+
background: ${V};
|
|
716
716
|
transform: scale(0.98);
|
|
717
717
|
}
|
|
718
718
|
|
|
@@ -892,18 +892,18 @@
|
|
|
892
892
|
.hb-btn-label {
|
|
893
893
|
letter-spacing: -0.01em;
|
|
894
894
|
}
|
|
895
|
-
`,
|
|
896
|
-
<style>${
|
|
895
|
+
`,M=class extends HTMLElement{constructor(){super();this._options={command:"",theme:"branded",size:"md",variant:"filled",popup:!0};this._mqCleanup=null;this._rendered=!1;this.attachShadow({mode:"open"})}connectedCallback(){this.syncFromAttributes(),this.render(),this.updateLightDOM()}disconnectedCallback(){this._mqCleanup?.(),this._mqCleanup=null}attributeChangedCallback(){this._rendered&&(this.syncFromAttributes(),this.render(),this.updateLightDOM())}set options(t){this._options={...this._options,...t},this.render(),this.updateLightDOM()}get options(){return this._options}syncFromAttributes(){let t=this.getAttribute("command"),o=this.getAttribute("skill-url"),e=this.getAttribute("theme"),r=this.getAttribute("size"),i=this.getAttribute("variant"),h=this.getAttribute("shape"),s=this.getAttribute("popup"),p=this.getAttribute("popup-title"),b=this.getAttribute("popup-description");t!==null&&(this._options.command=t),o!==null&&(this._options.skillUrl=o),e&&(this._options.theme=e),r&&(this._options.size=r),i&&(this._options.variant=i),h&&(this._options.shape=h),s!==null&&(this._options.popup=s!=="false"),p!==null&&(this._options.popupTitle=p),b!==null&&(this._options.popupDescription=b)}updateLightDOM(){let{command:t,skillUrl:o}=this._options;this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-label",`Run on Hermes Skills: ${t}`),this._options.popup!==!1?this.setAttribute("aria-haspopup","dialog"):this.removeAttribute("aria-haspopup");let e=this.querySelector("a[data-hb-crawl]");e||(e=document.createElement("a"),e.setAttribute("data-hb-crawl",""),e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",this.appendChild(e)),e.textContent=`Run on Hermes Skills: ${t}`,e.setAttribute("data-platform","hermes-skill"),e.setAttribute("data-command",t),o?(e.href=o,e.setAttribute("data-skill-url",o)):(e.href=`https://hermes.ai/skills?command=${encodeURIComponent(t)}`,e.removeAttribute("data-skill-url"))}getResolvedTheme(){return this._options.theme||"branded"}render(){if(!this.shadowRoot)return;let t=this.getResolvedTheme(),o=t==="system"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,e=this._options.variant||"filled",r=k(t),i=this._options.size||"md",h=this._options.shape||"rounded",s=j[i],p=U[h][i];this.setAttribute("data-theme",o),this.setAttribute("data-variant",e);let b=e!=="filled"?"transparent":r.bg,w=e==="ghost"?"transparent":e==="outline"?r.primary:r.border,E=e!=="filled"?r.primary:r.text;this.shadowRoot.innerHTML=`
|
|
896
|
+
<style>${kt}</style>
|
|
897
897
|
<button
|
|
898
898
|
class="hb-btn"
|
|
899
899
|
type="button"
|
|
900
900
|
style="
|
|
901
|
-
${
|
|
901
|
+
${O(r)}
|
|
902
902
|
--hb-bg: ${b};
|
|
903
903
|
--hb-border: ${w};
|
|
904
904
|
--hb-text: ${E};
|
|
905
|
-
--hb-accent-color: ${
|
|
906
|
-
--hb-focus-color: ${
|
|
905
|
+
--hb-accent-color: ${r.primary};
|
|
906
|
+
--hb-focus-color: ${r.primary};
|
|
907
907
|
--hb-height: ${s.height};
|
|
908
908
|
--hb-font-size: ${s.fontSize};
|
|
909
909
|
--hb-icon-size: ${s.iconSize};
|
|
@@ -913,8 +913,8 @@
|
|
|
913
913
|
"
|
|
914
914
|
aria-label="Run on Hermes Skills: ${this._options.command.replace(/"/g,""")}"
|
|
915
915
|
>
|
|
916
|
-
<span class="hb-btn-icon" aria-hidden="true">${
|
|
916
|
+
<span class="hb-btn-icon" aria-hidden="true">${N}</span>
|
|
917
917
|
<span class="hb-btn-label">Run on Hermes Skills</span>
|
|
918
918
|
</button>
|
|
919
|
-
`;let f=this.shadowRoot.querySelector(".hb-btn");f.addEventListener("click",()=>this.handleClick()),f.addEventListener("keydown",v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),this.handleClick())}),this._rendered=!0,this.setupSystemThemeWatch()}handleClick(){let{popup:t,command:
|
|
919
|
+
`;let f=this.shadowRoot.querySelector(".hb-btn");f.addEventListener("click",()=>this.handleClick()),f.addEventListener("keydown",v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),this.handleClick())}),this._rendered=!0,this.setupSystemThemeWatch()}handleClick(){let{popup:t,command:o,skillUrl:e,popupTitle:r,popupDescription:i}=this._options;if(this.dispatchEvent(new CustomEvent("hb-open",{bubbles:!0,composed:!0,detail:{command:o}})),t===!1){navigator.clipboard.writeText(o).then(()=>{this._options.onCopy?.(o),L("hermes-skill"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:o}}))});return}G({variant:"hermes-skill",theme:this.getResolvedTheme(),title:r||"Run on Hermes Skills",description:i||"Copy and paste into a Hermes session to get started.",command:o,skillUrl:e,onCopy:h=>{this._options.onCopy?.(h),L("hermes-skill"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:h}}))},onClose:()=>{this.dispatchEvent(new CustomEvent("hb-close",{bubbles:!0,composed:!0}))}})}setupSystemThemeWatch(){if(this._mqCleanup?.(),this._mqCleanup=null,this.getResolvedTheme()!=="system"||typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>this.render();t.addEventListener("change",o),this._mqCleanup=()=>t.removeEventListener("change",o)}};M.observedAttributes=["command","skill-url","theme","size","variant","shape","popup","popup-title","popup-description"];st()});var Et={};Y(Et,{HermesButton:()=>Ct,HermesSkillButton:()=>wt});module.exports=ut(Et);var c=require("react"),Ct=({command:a,theme:n="branded",size:t="md",variant:o="filled",shape:e="rounded",popup:r=!0,promptFlag:i=!0,onCopy:h,popupTitle:s,popupDescription:p,className:b,style:w,onHbCopy:E,onHbOpen:f,onHbClose:v})=>{let _=(0,c.useRef)(null),A=(0,c.useRef)(null),F=(0,c.useRef)(E);F.current=E;let $=(0,c.useRef)(f);$.current=f;let S=(0,c.useRef)(v);return S.current=v,(0,c.useEffect)(()=>{if(_.current)return Promise.resolve().then(()=>(it(),nt)).then(()=>{if(!_.current||A.current)return;let u=document.createElement("hermes-button");A.current=u,u.addEventListener("hb-copy",(x=>F.current?.(x))),u.addEventListener("hb-open",(x=>$.current?.(x))),u.addEventListener("hb-close",(x=>S.current?.(x))),_.current.appendChild(u)}),()=>{let u=A.current,x=_.current;u&&x?.contains(u)&&x.removeChild(u),A.current=null}},[]),(0,c.useEffect)(()=>{let u=A.current;!u||!("options"in u)||(u.options={command:a,theme:n,size:t,variant:o,shape:e,popup:r,promptFlag:i,onCopy:h,popupTitle:s,popupDescription:p})},[a,n,t,o,e,r,i,h,s,p]),(0,c.createElement)("div",{ref:_,className:b,style:{display:"inline-block",...w},suppressHydrationWarning:!0})},wt=({command:a,skillUrl:n,theme:t="branded",size:o="md",variant:e="filled",shape:r="rounded",popup:i=!0,onCopy:h,onDownload:s,popupTitle:p,popupDescription:b,className:w,style:E,onHbCopy:f,onHbDownload:v,onHbOpen:_,onHbClose:A})=>{let F=(0,c.useRef)(null),$=(0,c.useRef)(null),S=(0,c.useRef)(f);S.current=f;let u=(0,c.useRef)(v);u.current=v;let x=(0,c.useRef)(_);x.current=_;let tt=(0,c.useRef)(A);return tt.current=A,(0,c.useEffect)(()=>{if(F.current)return Promise.resolve().then(()=>(ht(),dt)).then(()=>{if(!F.current||$.current)return;let m=document.createElement("hermes-skill-button");$.current=m,m.addEventListener("hb-copy",(y=>S.current?.(y))),m.addEventListener("hb-download",(y=>u.current?.(y))),m.addEventListener("hb-open",(y=>x.current?.(y))),m.addEventListener("hb-close",(y=>tt.current?.(y))),F.current.appendChild(m)}),()=>{let m=$.current,y=F.current;m&&y?.contains(m)&&y.removeChild(m),$.current=null}},[]),(0,c.useEffect)(()=>{let m=$.current;!m||!("options"in m)||(m.options={command:a,skillUrl:n,theme:t,size:o,variant:e,shape:r,popup:i,onCopy:h,onDownload:s,popupTitle:p,popupDescription:b})},[a,n,t,o,e,r,i,h,s,p,b]),(0,c.createElement)("div",{ref:F,className:w,style:{display:"inline-block",...E},suppressHydrationWarning:!0})};0&&(module.exports={HermesButton,HermesSkillButton});
|
|
920
920
|
//# sourceMappingURL=react.js.map
|