hermesbuttons 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-GK6K44OK.mjs → chunk-5UWHHBVU.mjs} +28 -45
- package/dist/{chunk-GK6K44OK.mjs.map → chunk-5UWHHBVU.mjs.map} +1 -1
- package/dist/{hermes-button-RRJ6D2US.mjs → hermes-button-S6YLK72O.mjs} +2 -2
- package/dist/{hermes-skill-button-WZIOOH2O.mjs → hermes-skill-button-UHZHZUIU.mjs} +37 -37
- package/dist/hermes-skill-button-UHZHZUIU.mjs.map +1 -0
- package/dist/index.d.mts +0 -7
- package/dist/index.d.ts +0 -7
- package/dist/index.global.js +67 -84
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +82 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +82 -99
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +0 -7
- package/dist/react.d.ts +0 -7
- package/dist/react.js +63 -80
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -1
- package/dist/react.mjs.map +1 -1
- package/dist/vue.d.mts +0 -4
- package/dist/vue.d.ts +0 -4
- package/dist/vue.js +87 -104
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +71 -88
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/hermes-skill-button-WZIOOH2O.mjs.map +0 -1
- /package/dist/{hermes-button-RRJ6D2US.mjs.map → hermes-button-S6YLK72O.mjs.map} +0 -0
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var W=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ht=Object.prototype.hasOwnProperty;var F=(a,n)=>()=>(a&&(n=a(a=0)),n);var G=(a,n)=>{for(var t in n)W(a,t,{get:n[t],enumerable:!0})},lt=(a,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of dt(n))!ht.call(a,o)&&o!==t&&W(a,o,{get:()=>n[o],enumerable:!(e=st(n,o))||e.enumerable});return a};var ct=a=>lt(W({},"__esModule",{value:!0}),a);function X(){return typeof document<"u"}function pt(){if(!X())return null;let a=document.cookie.split(";").map(t=>t.trim()).find(t=>t.startsWith(`${K}=`));if(!a)return null;let n=a.slice(K.length+1);if(!n)return null;try{let t=decodeURIComponent(n),e=JSON.parse(t);return!e||typeof e!="object"||!Array.isArray(e.order)?null:{order:e.order.filter(r=>typeof r=="string"&&r.length>0)}}catch{return null}}function bt(a){if(!X())return;let n=a.order.slice(0,24),t=JSON.stringify({order:n}),e=new Date;e.setFullYear(e.getFullYear()+1),document.cookie=`${K}=${encodeURIComponent(t)}; Path=/; SameSite=Lax; Expires=${e.toUTCString()}`}function T(a){if(!a||typeof a!="string")return;let t=pt()?.order.filter(e=>e!==a)??[];bt({order:[a,...t]})}var K,Y=F(()=>{"use strict";K="agentpreferences"});var B,H,M,Q,tt,z=F(()=>{"use strict";B=`<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>`,H=`<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,14 +23,14 @@
|
|
|
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>`,M=`<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>`,Q=`<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>`,tt=`<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(a){return a!=="system"?
|
|
33
|
+
</svg>`});function k(a){return a!=="system"?N[a]:typeof window>"u"?N.light:window.matchMedia("(prefers-color-scheme: dark)").matches?N.dark:N.light}function $(a){return`
|
|
34
34
|
--hb-bg: ${a.bg};
|
|
35
35
|
--hb-text: ${a.text};
|
|
36
36
|
--hb-border: ${a.border};
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
--hb-primary-text: ${a.primaryText};
|
|
42
42
|
--hb-code-bg: ${a.codeBg};
|
|
43
43
|
--hb-code-text: ${a.codeText};
|
|
44
|
-
`}var d,
|
|
44
|
+
`}var d,A,P,l,y,D,I,g,N,q,V,U=F(()=>{"use strict";d="#2B8CFF",A="#1E7AEB",P="#186BD4",l="43, 140, 255",y="#8FA3E8",D="#7B91DC",I="#6B82CC",g="143, 163, 232",N={branded:{bg:d,text:"#FFFFFF",border:"transparent",surface:"#FFFFFF",surfaceText:"#0F172A",muted:"#64748B",primary:d,primaryText:"#FFFFFF",codeBg:"#0F172A",codeText:"#F1F5F9"},"branded-alt":{bg:y,text:"#FFFFFF",border:"transparent",surface:"#FFFFFF",surfaceText:"#0F172A",muted:"#64748B",primary:y,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"}};q={rounded:{sm:"0.375rem",md:"0.5rem",lg:"0.625rem"},pill:{sm:"999px",md:"999px",lg:"999px"},square:{sm:"0",md:"0",lg:"0"}},V={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 j(a){let n=document.createElement("hermes-popup-dialog");return n.options=a,document.body.appendChild(n),n}var ut,Z,J=F(()=>{"use strict";z();U();ut=`
|
|
45
45
|
:host {
|
|
46
46
|
position: fixed;
|
|
47
47
|
inset: 0;
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
white-space: nowrap;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
.hb-copy-btn:hover { background: ${
|
|
223
|
+
.hb-copy-btn:hover { background: ${A}; }
|
|
224
224
|
.hb-copy-btn:active { transform: scale(0.96); }
|
|
225
225
|
.hb-copy-btn svg { width: 14px; height: 14px; }
|
|
226
226
|
|
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
transition: background 0.15s, transform 0.1s;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
.hb-action-btn:hover { background: ${
|
|
256
|
+
.hb-action-btn:hover { background: ${A}; }
|
|
257
257
|
.hb-action-btn:active { transform: scale(0.98); }
|
|
258
258
|
.hb-action-btn svg { width: 16px; height: 16px; }
|
|
259
259
|
|
|
@@ -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
|
+
`,Z=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 e=typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches;if(t==="system")return e?k("dark"):k("light");let o=e?k("dark"):k("light"),r=k(t);return{...o,primary:r.primary,primaryText:r.primaryText}}render(){if(!this.shadowRoot||!this._options)return;let{variant:t,title:e,description:o,command:r,fullCommand:i}=this._options,c=this.resolvePopupTokens(),s=t==="hermes"?B:H,b=t==="hermes",v=i||r;this.shadowRoot.innerHTML=`
|
|
322
|
+
<style>${ut}</style>
|
|
323
|
+
<div style="${$(c)}">
|
|
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
|
-
<div class="hb-dialog-header-icon">${
|
|
327
|
+
<div class="hb-dialog-header-icon">${s}</div>
|
|
328
328
|
<div class="hb-dialog-header-text">
|
|
329
|
-
<div class="hb-dialog-title" id="hb-dialog-title">${
|
|
330
|
-
${
|
|
329
|
+
<div class="hb-dialog-title" id="hb-dialog-title">${e}</div>
|
|
330
|
+
${o?`<div class="hb-dialog-description">${o}</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">${tt}</button>
|
|
333
333
|
</div>
|
|
334
334
|
<div class="hb-dialog-body">
|
|
335
|
-
${b?this.renderHermesTerminalBody(
|
|
335
|
+
${b?this.renderHermesTerminalBody(v):this.renderHermesSkillBody(r)}
|
|
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)}">${M}<span>Copy</span></button>
|
|
354
354
|
</div>
|
|
355
355
|
</div>
|
|
356
356
|
</div>
|
|
@@ -360,41 +360,24 @@
|
|
|
360
360
|
<div class="hb-step-label">Paste and run in your terminal</div>
|
|
361
361
|
</div>
|
|
362
362
|
</div>
|
|
363
|
-
`}renderHermesSkillBody(t
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
</div>
|
|
372
|
-
</div>
|
|
373
|
-
</div>
|
|
374
|
-
<div class="hb-step">
|
|
375
|
-
<div class="hb-step-num">2</div>
|
|
376
|
-
<div class="hb-step-content">
|
|
377
|
-
<div class="hb-step-label">Paste into a Hermes session \u2014 the agent will fetch the skill and set it up for you</div>
|
|
378
|
-
</div>
|
|
379
|
-
</div>
|
|
380
|
-
`}else e+=`
|
|
381
|
-
<div class="hb-step">
|
|
382
|
-
<div class="hb-step-num">1</div>
|
|
383
|
-
<div class="hb-step-content">
|
|
384
|
-
<div class="hb-step-label">Copy this command to your clipboard</div>
|
|
385
|
-
<div class="hb-code-block">
|
|
386
|
-
<div class="hb-code-text">${this.escapeHtml(t)}</div>
|
|
387
|
-
<button class="hb-copy-btn" data-action="copy" data-command="${this.escapeAttr(t)}">${H}<span>Copy</span></button>
|
|
388
|
-
</div>
|
|
363
|
+
`}renderHermesSkillBody(t){return`
|
|
364
|
+
<div class="hb-step">
|
|
365
|
+
<div class="hb-step-num">1</div>
|
|
366
|
+
<div class="hb-step-content">
|
|
367
|
+
<div class="hb-step-label">Copy this command to your clipboard</div>
|
|
368
|
+
<div class="hb-code-block">
|
|
369
|
+
<div class="hb-code-text">${this.escapeHtml(t)}</div>
|
|
370
|
+
<button class="hb-copy-btn" data-action="copy" data-command="${this.escapeAttr(t)}">${M}<span>Copy</span></button>
|
|
389
371
|
</div>
|
|
390
372
|
</div>
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
</div>
|
|
373
|
+
</div>
|
|
374
|
+
<div class="hb-step">
|
|
375
|
+
<div class="hb-step-num">2</div>
|
|
376
|
+
<div class="hb-step-content">
|
|
377
|
+
<div class="hb-step-label">Paste and send in your Hermes session</div>
|
|
396
378
|
</div>
|
|
397
|
-
|
|
379
|
+
</div>
|
|
380
|
+
`}setupListeners(){this.shadowRoot&&(this.shadowRoot.addEventListener("click",t=>{let e=t.target.closest("[data-action]");if(!e)return;let o=e.dataset.action;if(o==="close")this.close();else if(o==="copy"){let r=e.dataset.command||"";this.copyToClipboard(r,e)}}),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 o=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>this.render();o.addEventListener("change",r),this._mqCleanup=()=>o.removeEventListener("change",r)}async copyToClipboard(t,e){try{await navigator.clipboard.writeText(t);let o=e.querySelector("span"),r=e;e.setAttribute("data-copied","true"),o&&(o.textContent="Copied!"),r.innerHTML=`${Q}<span>Copied!</span>`,this._options.onCopy?.(t),setTimeout(()=>{e.setAttribute("data-copied","false"),r.innerHTML=`${M}<span>Copy</span>`},2e3)}catch{let o=document.createElement("textarea");o.value=t,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o),this._options.onCopy?.(t)}}close(){let t=this.shadowRoot?.querySelector(".hb-dialog"),e=this.shadowRoot?.querySelector(".hb-backdrop");t&&(t.style.animation="hb-scale-in 0.15s ease-in reverse"),e&&(e.style.animation="hb-fade-in 0.15s ease-in reverse"),setTimeout(()=>{this._options.onClose?.(),this.remove()},140)}escapeHtml(t){let e=document.createElement("div");return e.textContent=t,e.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",Z)});var ot={};G(ot,{HermesButton:()=>O,createHermesButton:()=>gt,registerHermesButton:()=>et});function et(a="hermes-button"){typeof customElements>"u"||customElements.get(a)||customElements.define(a,O)}function gt(a){let n=document.createElement("hermes-button");return n.options=a,n}var mt,O,at=F(()=>{"use strict";Y();z();U();J();mt=`
|
|
398
381
|
:host {
|
|
399
382
|
display: inline-block;
|
|
400
383
|
vertical-align: middle;
|
|
@@ -439,19 +422,19 @@
|
|
|
439
422
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
|
|
440
423
|
}
|
|
441
424
|
:host([data-variant="filled"][data-theme="branded"]) .hb-btn:hover {
|
|
442
|
-
background: ${
|
|
425
|
+
background: ${A};
|
|
443
426
|
box-shadow: 0 2px 8px rgba(${l}, 0.35);
|
|
444
427
|
}
|
|
445
428
|
:host([data-variant="filled"][data-theme="branded"]) .hb-btn:active {
|
|
446
|
-
background: ${
|
|
429
|
+
background: ${P};
|
|
447
430
|
transform: scale(0.98);
|
|
448
431
|
}
|
|
449
432
|
:host([data-variant="filled"][data-theme="branded-alt"]) .hb-btn:hover {
|
|
450
|
-
background: ${
|
|
433
|
+
background: ${D};
|
|
451
434
|
box-shadow: 0 2px 8px rgba(${g}, 0.35);
|
|
452
435
|
}
|
|
453
436
|
:host([data-variant="filled"][data-theme="branded-alt"]) .hb-btn:active {
|
|
454
|
-
background: ${
|
|
437
|
+
background: ${I};
|
|
455
438
|
transform: scale(0.98);
|
|
456
439
|
}
|
|
457
440
|
|
|
@@ -498,8 +481,8 @@
|
|
|
498
481
|
|
|
499
482
|
:host([data-variant="outline"][data-theme="branded-alt"]) .hb-btn {
|
|
500
483
|
background: transparent;
|
|
501
|
-
border-color: ${
|
|
502
|
-
color: ${
|
|
484
|
+
border-color: ${y};
|
|
485
|
+
color: ${y};
|
|
503
486
|
}
|
|
504
487
|
:host([data-variant="outline"][data-theme="branded-alt"]) .hb-btn:hover {
|
|
505
488
|
background: rgba(${g}, 0.08);
|
|
@@ -557,7 +540,7 @@
|
|
|
557
540
|
}
|
|
558
541
|
|
|
559
542
|
:host([data-variant="ghost"][data-theme="branded-alt"]) .hb-btn {
|
|
560
|
-
color: ${
|
|
543
|
+
color: ${y};
|
|
561
544
|
}
|
|
562
545
|
:host([data-variant="ghost"][data-theme="branded-alt"]) .hb-btn:hover {
|
|
563
546
|
background: rgba(${g}, 0.1);
|
|
@@ -631,16 +614,16 @@
|
|
|
631
614
|
.hb-btn-label {
|
|
632
615
|
letter-spacing: -0.01em;
|
|
633
616
|
}
|
|
634
|
-
`,
|
|
635
|
-
<style>${
|
|
617
|
+
`,O=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"),e=this.getAttribute("theme"),o=this.getAttribute("size"),r=this.getAttribute("variant"),i=this.getAttribute("shape"),c=this.getAttribute("popup"),s=this.getAttribute("prompt-flag"),b=this.getAttribute("popup-title"),v=this.getAttribute("popup-description");t!==null&&(this._options.command=t),e&&(this._options.theme=e),o&&(this._options.size=o),r&&(this._options.variant=r),i&&(this._options.shape=i),c!==null&&(this._options.popup=c!=="false"),s!==null&&(this._options.promptFlag=s!=="false"),b!==null&&(this._options.popupTitle=b),v!==null&&(this._options.popupDescription=v)}updateLightDOM(){let{command:t}=this._options,e=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 o=this.querySelector("a[data-hb-crawl]");o||(o=document.createElement("a"),o.setAttribute("data-hb-crawl",""),o.setAttribute("aria-hidden","true"),o.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",this.appendChild(o)),o.href=`https://hermes.ai/run?command=${encodeURIComponent(e)}`,o.textContent=`Run on Hermes: ${t}`,o.setAttribute("data-platform","hermes"),o.setAttribute("data-command",t),o.setAttribute("data-full-command",e)}getResolvedTheme(){return this._options.theme||"branded"}getFullCommand(){let{command:t,promptFlag:e}=this._options;return e===!1?t:`hermes -p "${t}"`}render(){if(!this.shadowRoot)return;let t=this.getResolvedTheme(),e=t==="system"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,o=this._options.variant||"filled",r=k(t),i=this._options.size||"md",c=this._options.shape||"rounded",s=V[i],b=q[c][i];this.setAttribute("data-theme",e),this.setAttribute("data-variant",o);let v=o!=="filled"?"transparent":r.bg,w=o==="ghost"?"transparent":o==="outline"?r.primary:r.border,C=o!=="filled"?r.primary:r.text;this.shadowRoot.innerHTML=`
|
|
618
|
+
<style>${mt}</style>
|
|
636
619
|
<button
|
|
637
620
|
class="hb-btn"
|
|
638
621
|
type="button"
|
|
639
622
|
style="
|
|
640
|
-
${
|
|
641
|
-
--hb-bg: ${
|
|
623
|
+
${$(r)}
|
|
624
|
+
--hb-bg: ${v};
|
|
642
625
|
--hb-border: ${w};
|
|
643
|
-
--hb-text: ${
|
|
626
|
+
--hb-text: ${C};
|
|
644
627
|
--hb-accent-color: ${r.primary};
|
|
645
628
|
--hb-focus-color: ${r.primary};
|
|
646
629
|
--hb-height: ${s.height};
|
|
@@ -648,14 +631,14 @@
|
|
|
648
631
|
--hb-icon-size: ${s.iconSize};
|
|
649
632
|
--hb-padding: ${s.ccPadding};
|
|
650
633
|
--hb-gap: ${s.gap};
|
|
651
|
-
--hb-radius: ${
|
|
634
|
+
--hb-radius: ${b};
|
|
652
635
|
"
|
|
653
636
|
aria-label="Run on Hermes: ${this._options.command.replace(/"/g,""")}"
|
|
654
637
|
>
|
|
655
|
-
<span class="hb-btn-icon" aria-hidden="true">${
|
|
638
|
+
<span class="hb-btn-icon" aria-hidden="true">${B}</span>
|
|
656
639
|
<span class="hb-btn-label">Run on Hermes</span>
|
|
657
640
|
</button>
|
|
658
|
-
`;let f=this.shadowRoot.querySelector(".hb-btn");f.addEventListener("click",()=>this.handleClick()),f.addEventListener("keydown",
|
|
641
|
+
`;let f=this.shadowRoot.querySelector(".hb-btn");f.addEventListener("click",()=>this.handleClick()),f.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),this.handleClick())}),this._rendered=!0,this.setupSystemThemeWatch()}handleClick(){let{popup:t,command:e,popupTitle:o,popupDescription:r}=this._options,i=this.getFullCommand();if(this.dispatchEvent(new CustomEvent("hb-open",{bubbles:!0,composed:!0,detail:{command:e,fullCommand:i}})),t===!1){navigator.clipboard.writeText(i).then(()=>{this._options.onCopy?.(i),T("hermes"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:i}}))});return}j({variant:"hermes",theme:this.getResolvedTheme(),title:o||"Run on Hermes",description:r||"Execute this command in your terminal to get started with Hermes Agent.",command:e,fullCommand:i,onCopy:c=>{this._options.onCopy?.(c),T("hermes"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:c}}))},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)"),e=()=>this.render();t.addEventListener("change",e),this._mqCleanup=()=>t.removeEventListener("change",e)}};O.observedAttributes=["command","theme","size","variant","shape","popup","prompt-flag","popup-title","popup-description"];et()});var nt={};G(nt,{HermesSkillButton:()=>S,createHermesSkillButton:()=>ft,registerHermesSkillButton:()=>rt});function rt(a="hermes-skill-button"){typeof customElements>"u"||customElements.get(a)||customElements.define(a,S)}function ft(a){let n=document.createElement("hermes-skill-button");return n.options=a,n}var vt,S,it=F(()=>{"use strict";Y();z();U();J();vt=`
|
|
659
642
|
:host {
|
|
660
643
|
display: inline-block;
|
|
661
644
|
vertical-align: middle;
|
|
@@ -700,19 +683,19 @@
|
|
|
700
683
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
|
|
701
684
|
}
|
|
702
685
|
:host([data-variant="filled"][data-theme="branded"]) .hb-btn:hover {
|
|
703
|
-
background: ${
|
|
686
|
+
background: ${A};
|
|
704
687
|
box-shadow: 0 2px 8px rgba(${l}, 0.35);
|
|
705
688
|
}
|
|
706
689
|
:host([data-variant="filled"][data-theme="branded"]) .hb-btn:active {
|
|
707
|
-
background: ${
|
|
690
|
+
background: ${P};
|
|
708
691
|
transform: scale(0.98);
|
|
709
692
|
}
|
|
710
693
|
:host([data-variant="filled"][data-theme="branded-alt"]) .hb-btn:hover {
|
|
711
|
-
background: ${
|
|
694
|
+
background: ${D};
|
|
712
695
|
box-shadow: 0 2px 8px rgba(${g}, 0.35);
|
|
713
696
|
}
|
|
714
697
|
:host([data-variant="filled"][data-theme="branded-alt"]) .hb-btn:active {
|
|
715
|
-
background: ${
|
|
698
|
+
background: ${I};
|
|
716
699
|
transform: scale(0.98);
|
|
717
700
|
}
|
|
718
701
|
|
|
@@ -759,8 +742,8 @@
|
|
|
759
742
|
|
|
760
743
|
:host([data-variant="outline"][data-theme="branded-alt"]) .hb-btn {
|
|
761
744
|
background: transparent;
|
|
762
|
-
border-color: ${
|
|
763
|
-
color: ${
|
|
745
|
+
border-color: ${y};
|
|
746
|
+
color: ${y};
|
|
764
747
|
}
|
|
765
748
|
:host([data-variant="outline"][data-theme="branded-alt"]) .hb-btn:hover {
|
|
766
749
|
background: rgba(${g}, 0.08);
|
|
@@ -818,7 +801,7 @@
|
|
|
818
801
|
}
|
|
819
802
|
|
|
820
803
|
:host([data-variant="ghost"][data-theme="branded-alt"]) .hb-btn {
|
|
821
|
-
color: ${
|
|
804
|
+
color: ${y};
|
|
822
805
|
}
|
|
823
806
|
:host([data-variant="ghost"][data-theme="branded-alt"]) .hb-btn:hover {
|
|
824
807
|
background: rgba(${g}, 0.1);
|
|
@@ -892,16 +875,16 @@
|
|
|
892
875
|
.hb-btn-label {
|
|
893
876
|
letter-spacing: -0.01em;
|
|
894
877
|
}
|
|
895
|
-
`,
|
|
896
|
-
<style>${
|
|
878
|
+
`,S=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"),e=this.getAttribute("theme"),o=this.getAttribute("size"),r=this.getAttribute("variant"),i=this.getAttribute("shape"),c=this.getAttribute("popup"),s=this.getAttribute("popup-title"),b=this.getAttribute("popup-description");t!==null&&(this._options.command=t),e&&(this._options.theme=e),o&&(this._options.size=o),r&&(this._options.variant=r),i&&(this._options.shape=i),c!==null&&(this._options.popup=c!=="false"),s!==null&&(this._options.popupTitle=s),b!==null&&(this._options.popupDescription=b)}updateLightDOM(){let{command:t}=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),e.href=`https://hermes.ai/skills?command=${encodeURIComponent(t)}`}getResolvedTheme(){return this._options.theme||"branded"}render(){if(!this.shadowRoot)return;let t=this.getResolvedTheme(),e=t==="system"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,o=this._options.variant||"filled",r=k(t),i=this._options.size||"md",c=this._options.shape||"rounded",s=V[i],b=q[c][i];this.setAttribute("data-theme",e),this.setAttribute("data-variant",o);let v=o!=="filled"?"transparent":r.bg,w=o==="ghost"?"transparent":o==="outline"?r.primary:r.border,C=o!=="filled"?r.primary:r.text;this.shadowRoot.innerHTML=`
|
|
879
|
+
<style>${vt}</style>
|
|
897
880
|
<button
|
|
898
881
|
class="hb-btn"
|
|
899
882
|
type="button"
|
|
900
883
|
style="
|
|
901
|
-
${
|
|
902
|
-
--hb-bg: ${
|
|
884
|
+
${$(r)}
|
|
885
|
+
--hb-bg: ${v};
|
|
903
886
|
--hb-border: ${w};
|
|
904
|
-
--hb-text: ${
|
|
887
|
+
--hb-text: ${C};
|
|
905
888
|
--hb-accent-color: ${r.primary};
|
|
906
889
|
--hb-focus-color: ${r.primary};
|
|
907
890
|
--hb-height: ${s.height};
|
|
@@ -909,12 +892,12 @@
|
|
|
909
892
|
--hb-icon-size: ${s.iconSize};
|
|
910
893
|
--hb-padding: ${s.padding};
|
|
911
894
|
--hb-gap: ${s.gap};
|
|
912
|
-
--hb-radius: ${
|
|
895
|
+
--hb-radius: ${b};
|
|
913
896
|
"
|
|
914
897
|
aria-label="Run on Hermes Skills: ${this._options.command.replace(/"/g,""")}"
|
|
915
898
|
>
|
|
916
|
-
<span class="hb-btn-icon" aria-hidden="true">${
|
|
899
|
+
<span class="hb-btn-icon" aria-hidden="true">${H}</span>
|
|
917
900
|
<span class="hb-btn-label">Run on Hermes Skills</span>
|
|
918
901
|
</button>
|
|
919
|
-
`;let f=this.shadowRoot.querySelector(".hb-btn");f.addEventListener("click",()=>this.handleClick()),f.addEventListener("keydown",
|
|
902
|
+
`;let f=this.shadowRoot.querySelector(".hb-btn");f.addEventListener("click",()=>this.handleClick()),f.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),this.handleClick())}),this._rendered=!0,this.setupSystemThemeWatch()}handleClick(){let{popup:t,command:e,popupTitle:o,popupDescription:r}=this._options;if(this.dispatchEvent(new CustomEvent("hb-open",{bubbles:!0,composed:!0,detail:{command:e}})),t===!1){navigator.clipboard.writeText(e).then(()=>{this._options.onCopy?.(e),T("hermes-skill"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:e}}))});return}j({variant:"hermes-skill",theme:this.getResolvedTheme(),title:o||"Run on Hermes Skills",description:r||"Copy and paste into a Hermes session to get started.",command:e,onCopy:i=>{this._options.onCopy?.(i),T("hermes-skill"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:i}}))},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)"),e=()=>this.render();t.addEventListener("change",e),this._mqCleanup=()=>t.removeEventListener("change",e)}};S.observedAttributes=["command","theme","size","variant","shape","popup","popup-title","popup-description"];rt()});var yt={};G(yt,{HermesButton:()=>xt,HermesSkillButton:()=>kt});module.exports=ct(yt);var p=require("react"),xt=({command:a,theme:n="branded",size:t="md",variant:e="filled",shape:o="rounded",popup:r=!0,promptFlag:i=!0,onCopy:c,popupTitle:s,popupDescription:b,className:v,style:w,onHbCopy:C,onHbOpen:f,onHbClose:u})=>{let x=(0,p.useRef)(null),E=(0,p.useRef)(null),R=(0,p.useRef)(C);R.current=C;let L=(0,p.useRef)(f);L.current=f;let m=(0,p.useRef)(u);return m.current=u,(0,p.useEffect)(()=>{if(x.current)return Promise.resolve().then(()=>(at(),ot)).then(()=>{if(!x.current||E.current)return;let h=document.createElement("hermes-button");E.current=h,h.addEventListener("hb-copy",(_=>R.current?.(_))),h.addEventListener("hb-open",(_=>L.current?.(_))),h.addEventListener("hb-close",(_=>m.current?.(_))),x.current.appendChild(h)}),()=>{let h=E.current,_=x.current;h&&_?.contains(h)&&_.removeChild(h),E.current=null}},[]),(0,p.useEffect)(()=>{let h=E.current;!h||!("options"in h)||(h.options={command:a,theme:n,size:t,variant:e,shape:o,popup:r,promptFlag:i,onCopy:c,popupTitle:s,popupDescription:b})},[a,n,t,e,o,r,i,c,s,b]),(0,p.createElement)("div",{ref:x,className:v,style:{display:"inline-block",...w},suppressHydrationWarning:!0})},kt=({command:a,theme:n="branded",size:t="md",variant:e="filled",shape:o="rounded",popup:r=!0,onCopy:i,popupTitle:c,popupDescription:s,className:b,style:v,onHbCopy:w,onHbOpen:C,onHbClose:f})=>{let u=(0,p.useRef)(null),x=(0,p.useRef)(null),E=(0,p.useRef)(w);E.current=w;let R=(0,p.useRef)(C);R.current=C;let L=(0,p.useRef)(f);return L.current=f,(0,p.useEffect)(()=>{if(u.current)return Promise.resolve().then(()=>(it(),nt)).then(()=>{if(!u.current||x.current)return;let m=document.createElement("hermes-skill-button");x.current=m,m.addEventListener("hb-copy",(h=>E.current?.(h))),m.addEventListener("hb-open",(h=>R.current?.(h))),m.addEventListener("hb-close",(h=>L.current?.(h))),u.current.appendChild(m)}),()=>{let m=x.current,h=u.current;m&&h?.contains(m)&&h.removeChild(m),x.current=null}},[]),(0,p.useEffect)(()=>{let m=x.current;!m||!("options"in m)||(m.options={command:a,theme:n,size:t,variant:e,shape:o,popup:r,onCopy:i,popupTitle:c,popupDescription:s})},[a,n,t,e,o,r,i,c,s]),(0,p.createElement)("div",{ref:u,className:b,style:{display:"inline-block",...v},suppressHydrationWarning:!0})};0&&(module.exports={HermesButton,HermesSkillButton});
|
|
920
903
|
//# sourceMappingURL=react.js.map
|