sgiant-ai-widget 1.6.0 → 1.6.1
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! sgiant-ai-widget 1.6.
|
|
1
|
+
/*! sgiant-ai-widget 1.6.1 — MIT — https://vedatugur.github.io/sgiant-ai-widget/ */
|
|
2
2
|
"use strict";var SgiantAiWidgetCharts=(()=>{var x=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var n in t)x(e,n,{get:t[n],enumerable:!0})},R=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of S(t))!v.call(e,o)&&o!==n&&x(e,o,{get:()=>t[o],enumerable:!(a=C(t,o))||a.enumerable});return e};var E=e=>R(x({},"__esModule",{value:!0}),e);var j={};$(j,{createChartFallback:()=>N});var M="http://www.w3.org/2000/svg";function u(e,t={}){let n=document.createElementNS(M,e);for(let[a,o]of Object.entries(t))n.setAttribute(a,String(o));return n}function m(e,t){if(t&&typeof e[t]=="number")return Number(e[t]);let n=Object.keys(e).filter(a=>typeof e[a]=="number");return n.length?Number(e[n[n.length-1]]):0}function A(e,t){let n=(t!==void 0&&e[t]!==void 0?e[t]:void 0)??e.label??Object.values(e)[0];return n==null?"":String(n)}function G(){try{return matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function b(e,t,n,a,o){e.appendChild(u("animate",{attributeName:t,from:n,to:a,dur:"0.6s",begin:`${o}s`,fill:"freeze"}))}function T(e,t,n,a,o){let l=Math.max(...e.map(r=>m(r,a)),1),s=u("svg",{viewBox:`0 0 320 ${t}`,width:"100%",role:"img"}),i=(320-22*2)/Math.max(e.length,1);return e.forEach((r,d)=>{let h=(t-44)*m(r,a)/l,f=22+d*i+4,p=Math.max(i-8,2),w=u("rect",{x:f,y:n?t-22:t-22-h,width:p,height:n?0:h,rx:3,fill:"var(--aiw-accent)"});n&&(b(w,"height",0,h,d*.07),b(w,"y",t-22,t-22-h,d*.07)),s.appendChild(w);let y=u("text",{x:f+p/2,y:t-6,"text-anchor":"middle","font-size":9,fill:"var(--aiw-muted)"});y.textContent=A(r,o).slice(0,9),s.appendChild(y)}),s}function k(e,t,n,a,o,c){return e.map((g,l)=>{let s=a+l*(t-a*2)/Math.max(e.length-1,1),i=n-a-(n-a*2)*m(g,c)/o;return`${s},${i}`}).join(" ")}function V(e,t,n,a,o){let l=Math.max(...[...e,...t??[]].map(r=>m(r,o)),1),s=u("svg",{viewBox:`0 0 320 ${n}`,width:"100%",role:"img"});t?.length&&s.appendChild(u("polyline",{points:k(t,320,n,22,l,o),fill:"none",stroke:"var(--aiw-muted)","stroke-width":1.5,"stroke-dasharray":"4 4",opacity:.7}));let i=u("polyline",{points:k(e,320,n,22,l,o),fill:"none",stroke:"var(--aiw-accent)","stroke-width":2.5,"stroke-linecap":"round","stroke-linejoin":"round"});return s.appendChild(i),a&&requestAnimationFrame(()=>{let r=typeof i.getTotalLength=="function"?i.getTotalLength():0;r&&(i.setAttribute("stroke-dasharray",String(r)),i.setAttribute("stroke-dashoffset",String(r)),b(i,"stroke-dashoffset",r,0,0))}),s}function W(e,t,n){let c=2*Math.PI*46,g=e.reduce((i,r)=>i+m(r,n),0)||1,l=u("svg",{viewBox:"0 0 140 140",width:"100%",height:150,role:"img"}),s=0;return e.forEach((i,r)=>{let d=m(i,n)/g,h=u("circle",{cx:140/2,cy:140/2,r:46,fill:"none",stroke:r===0?"var(--aiw-accent)":"var(--aiw-muted)",opacity:r===0?1:Math.max(.8-r*.22,.25),"stroke-width":16,"stroke-dasharray":t?`0 ${c}`:`${c*d} ${c}`,"stroke-dashoffset":-c*s,transform:`rotate(-90 ${140/2} ${140/2})`});t&&b(h,"stroke-dasharray",`0 ${c}`,`${c*d} ${c}`,r*.12),l.appendChild(h),s+=d}),l}var O={time_series:"line",line:"line",breakdown:"bars",bar:"bars",donut:"donut",pie:"donut"};function N(e={}){let{animate:t=!0,height:n=140}=e;return function(o,c,g,l){let s=c??{},i=Array.isArray(g)?g:[],r=O[String(s.chartType??"")];if(!r||!i.length)throw new Error(`sgiant-ai-widget/charts does not draw "${String(s.chartType)}" \u2014 falling through to the built-in renderer.`);let d=s.metrics?.[0],h=t&&!G(),f=document.createElement("div");if(s.title){let p=document.createElement("div");p.textContent=s.title,p.style.cssText="font-size:var(--aiw-font-xs,11px);font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--aiw-muted,#6e6e6e);margin-bottom:6px",f.appendChild(p)}f.appendChild(r==="line"?V(i,Array.isArray(l)?l:void 0,n,h,d):r==="donut"?W(i,h,d):T(i,n,h,d,s.dimension)),o.appendChild(f)}}return E(j);})();
|
|
3
3
|
//# sourceMappingURL=sgiant-ai-widget-charts.global.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! sgiant-ai-widget 1.6.
|
|
1
|
+
/*! sgiant-ai-widget 1.6.1 — MIT — https://vedatugur.github.io/sgiant-ai-widget/ */
|
|
2
2
|
"use strict";var SgiantAiWidget=(()=>{var fi=Object.defineProperty;var gs=Object.getOwnPropertyDescriptor;var hs=Object.getOwnPropertyNames;var fs=Object.prototype.hasOwnProperty;var ms=(t,a)=>{for(var o in a)fi(t,o,{get:a[o],enumerable:!0})},bs=(t,a,o,c)=>{if(a&&typeof a=="object"||typeof a=="function")for(let f of hs(a))!fs.call(t,f)&&f!==o&&fi(t,f,{get:()=>a[f],enumerable:!(c=gs(a,f))||c.enumerable});return t};var vs=t=>bs(fi({},"__esModule",{value:!0}),t);var Xs={};ms(Xs,{CHROME_LAUNCHER:()=>go,CHROME_MARK:()=>po,KNOWN_UI_STATUSES:()=>Ei,OPEN_ASSISTANT_EVENT:()=>Vs,OPERATE_ACTIONS:()=>bn,PREFIX:()=>e,STANDARD_ACTION_PATHS:()=>Bt,UI_CONTROL_ACTIONS:()=>mn,UI_SAY_ACTION:()=>_t,WIDGET_LABELS:()=>ut,broadcastAiChange:()=>Cr,buildThreadReplay:()=>oo,clearHighlight:()=>Pt,createAiChatWidget:()=>Gs,createHostActions:()=>hr,gateNavigationTarget:()=>Hn,genericProposalSummary:()=>Sn,isKnownNavTarget:()=>zt,isNavigationAction:()=>wn,isOperateAction:()=>Ve,isUiControlAction:()=>ot,makePageContext:()=>gr,matchManifest:()=>yi,normalizeUiSpec:()=>Cn,parseJsonDirective:()=>ue,resolveWidgetLabels:()=>io,scanAiTargets:()=>bi,subscribeAiChange:()=>Ln,subscribeLiveSync:()=>Tr,uiSpecMediaIds:()=>Tn});var mn=["highlight","scroll-to","focus-field"];function ot(t){return mn.includes(t)}function ws(t){return t.replace(/["\\]/g,"\\$&")}function rr(t){if(typeof document>"u")return null;let a=document.querySelector(`[data-ai-target="${ws(t)}"]`);return a&&a.isConnected?a:null}function xs(t){let a=t.getAttribute("aria-label"),o=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t.placeholder:"";return(a||t.textContent||o||"").trim().replace(/\s+/g," ").slice(0,60)}function bi(t=40){if(typeof document>"u")return[];let a=[],o=new Set,c=document.querySelectorAll("[data-ai-target]");for(let f of Array.from(c)){let d=f.getAttribute("data-ai-target");if(!(!d||o.has(d))){if(!f.isConnected||f.offsetParent===null){let r=f.getBoundingClientRect();if(r.width===0&&r.height===0)continue}if(o.add(d),a.push({id:d,label:xs(f)}),a.length>=t)break}}return a}var or="ai-bridge-highlight",ar="ai-bridge-highlight-kf";function ys(){if(typeof document>"u"||document.getElementById(ar))return;let t=document.createElement("style");t.id=ar,t.textContent=`@keyframes ai-bridge-pulse{
|
|
3
3
|
0%,100%{box-shadow:0 0 0 2px rgba(250,113,45,.9),0 0 0 6px rgba(250,113,45,.22)}
|
|
4
4
|
50%{box-shadow:0 0 0 2px rgba(250,113,45,1),0 0 0 10px rgba(250,113,45,.06)}
|
|
@@ -141,7 +141,19 @@ ${a}.${e}-advanced.${e}-pane-collapsed .${e}-chatcol{border-right:0}
|
|
|
141
141
|
reading survivable: a cream disc that ends up over white is 1.06:1 and
|
|
142
142
|
effectively gone, and the ground under a fixed launcher genuinely changes as
|
|
143
143
|
the reader scrolls. One pixel of navy is enough to keep it an object. */
|
|
144
|
-
|
|
144
|
+
/* SET THE TOKENS, NOT THE PROPERTIES. This declared background and
|
|
145
|
+
box-shadow outright, which beats any value a host puts in
|
|
146
|
+
--aiw-launcher-bg: a declaration on the element always wins over one that
|
|
147
|
+
merely feeds it. So a host asking for no disc at all (CHROME_LAUNCHER does
|
|
148
|
+
exactly that) got the disc back the moment the launcher sat on a dark
|
|
149
|
+
ground, and only there. Reported 2026-09-04: the container would not go
|
|
150
|
+
away, and the option looked like it did nothing.
|
|
151
|
+
|
|
152
|
+
Through the tokens the precedence comes out right on its own: this rule
|
|
153
|
+
beats the defaults, and an inline host override beats this rule. The ink
|
|
154
|
+
variant keeps its heavier shadow and its hairline for the reason above; it
|
|
155
|
+
just no longer insists on them. */
|
|
156
|
+
.${e}-bubble.${e}-on-ink{--aiw-launcher-bg:#FCF7E3;--aiw-launcher-fg:#151D2F;--aiw-launcher-shadow:0 8px 24px rgba(0,0,0,.45),0 0 0 1px rgba(21,29,47,.55)}
|
|
145
157
|
.${e}-bubble.${e}-on-ink .${e}-bubble-label{color:#151D2F}
|
|
146
158
|
.${e}-bubble.${e}-on-ink .${e}-bubble-dot{box-shadow:0 0 0 2px #FCF7E3}
|
|
147
159
|
.${e}-eyes{transform-origin:24px 23px;animation:${e}-blink2 5.5s ease-in-out infinite}
|