tekivex-ui 2.5.16 → 3.0.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/README.md +22 -8
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +14 -14
- package/dist/{chunk-B3ph66Zb.js → chunk-BHX35YDv.js} +1 -1
- package/dist/chunk-BpuJ3-K8.js +1 -0
- package/dist/{chunk-Bc16rJT-.js → chunk-C8Wy8P59.js} +1 -1
- package/dist/chunk-CDGrC2Wo.js +3 -0
- package/dist/chunk-D7-yknXg.js +1 -0
- package/dist/chunk-DcVMayoM.js +1 -0
- package/dist/chunk-DdHSYetV.js +1 -0
- package/dist/chunk-VUD-TF9j.js +1 -0
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +1 -1
- package/dist/i18n.cjs +1 -1
- package/dist/i18n.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +22 -3
- package/dist/index.js +514 -419
- package/dist/quantum.cjs +1 -1
- package/dist/quantum.js +17 -17
- package/dist/realtime.cjs +1 -1
- package/dist/realtime.js +1 -1
- package/dist/src/components/TkxAadhaarInput.d.ts +22 -0
- package/dist/src/components/TkxAddressInput.d.ts +32 -0
- package/dist/src/components/TkxCalendarLunar.d.ts +25 -0
- package/dist/src/components/TkxCaptcha.d.ts +23 -0
- package/dist/src/components/TkxCheckout.d.ts +26 -0
- package/dist/src/components/TkxConfetti.d.ts +21 -0
- package/dist/src/components/TkxCurrencyInput.d.ts +20 -0
- package/dist/src/components/TkxFontProvider.d.ts +12 -0
- package/dist/src/components/TkxImageEditor.d.ts +44 -0
- package/dist/src/components/TkxInput.d.ts +1 -0
- package/dist/src/components/TkxKycInputs.d.ts +59 -0
- package/dist/src/components/TkxOTP.d.ts +2 -1
- package/dist/src/components/TkxOrgChart.d.ts +32 -0
- package/dist/src/components/TkxPaymentButton.d.ts +61 -0
- package/dist/src/components/TkxPhoneInput.d.ts +34 -0
- package/dist/src/components/TkxSEO.d.ts +58 -0
- package/dist/src/components/TkxSignaturePad.d.ts +21 -0
- package/dist/src/components/TkxSortable.d.ts +18 -0
- package/dist/src/components/TkxSubscription.d.ts +42 -0
- package/dist/src/components/TkxWatermark.d.ts +8 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/engine/security.d.ts +45 -0
- package/dist/src/i18n/index.d.ts +51 -0
- package/dist/src/themes/index.d.ts +6 -1
- package/dist/tekivex-ui.css +1 -1
- package/package.json +20 -4
- package/dist/chunk-BiHAhNbu.js +0 -3
- package/dist/chunk-CVRuGUFA.js +0 -1
- package/dist/chunk-Dc4_ud5s.js +0 -1
- package/dist/chunk-Dj40UFcz.js +0 -1
- package/dist/chunk-DjxOP8W4.js +0 -1
- package/dist/chunk-PJ50l0JC.js +0 -1
package/dist/realtime.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./chunk-DmRB1Blb.js");const e=require("./chunk-DjxOP8W4.js"),t=require("./chunk-Dc4_ud5s.js");let n=require("react");var o=!1;function r({item:e,isNew:o,showTimestamps:r,onItemClick:i,renderItem:s,theme:a,style:l}){const c=function(e,t){switch(e){case"info":return t.info;case"success":return t.success;case"warning":return t.warning;case"error":return t.danger;default:return t.border}}(e.type,a);return s?(0,n.createElement)("div",{style:l,className:o?"tkx-feed-item-new":void 0},s(e)):(0,n.createElement)("div",{style:{...l,display:"flex",alignItems:"center",gap:10,padding:"0 12px",borderLeft:`3px solid ${c}`,cursor:i?"pointer":"default",boxSizing:"border-box",height:64,background:a.surface,transition:"background 0.15s"},className:o?"tkx-feed-item-new":void 0,onClick:i?()=>i(e):void 0,role:i?"button":void 0,tabIndex:i?0:void 0,onKeyDown:i?t=>{"Enter"!==t.key&&" "!==t.key||i(e)}:void 0},(0,n.createElement)("div",{style:{width:36,height:36,borderRadius:"50%",background:c,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:700,color:a.bg,flexShrink:0,overflow:"hidden"}},e.avatar?(0,n.createElement)("img",{src:e.avatar,alt:e.author??"",style:{width:"100%",height:"100%",objectFit:"cover"}}):(d=e.author)?d.split(" ").map(e=>e[0]??"").slice(0,2).join("").toUpperCase():"?"),(0,n.createElement)("div",{style:{flex:1,minWidth:0}},(0,n.createElement)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2}},e.author&&(0,n.createElement)("span",{style:{fontWeight:600,fontSize:13,color:a.text}},t.sanitizeString(e.author)),e.meta&&(0,n.createElement)("span",{style:{fontSize:11,color:a.textMuted,background:a.surfaceAlt,borderRadius:4,padding:"1px 5px"}},t.sanitizeString(e.meta))),(0,n.createElement)("div",{style:{fontSize:13,color:a.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.sanitizeString(e.content))),r&&(0,n.createElement)("div",{style:{fontSize:11,color:a.textMuted,flexShrink:0}},function(e){const t=Date.now()-e;return t<1e4?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}(e.timestamp)));var d}var i=!1;function s(e,t){if("string"==typeof e)return e;const n=e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Number.isInteger(e)?e:e.toFixed(2));return t?`${n}${t}`:n}function a({data:e,color:t}){if(e.length<2)return null;const o=Math.min(...e),r=Math.max(...e)-o||1,i=e.map((t,n)=>{const i=n/(e.length-1)*80,s=24-(t-o)/r*22-1;return`${i.toFixed(1)},${s.toFixed(1)}`});return(0,n.createElement)("svg",{width:80,height:24,viewBox:"0 0 80 24","aria-hidden":"true"},(0,n.createElement)("polyline",{points:i.join(" "),fill:"none",stroke:t,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}))}function l({trend:e,theme:t}){return"up"===e?(0,n.createElement)("span",{style:{color:t.success,fontSize:14,fontWeight:700}},"▲"):"down"===e?(0,n.createElement)("span",{style:{color:t.danger,fontSize:14,fontWeight:700}},"▼"):(0,n.createElement)("span",{style:{color:t.textMuted,fontSize:14}},"→")}function c({metric:e,animate:o,onMetricClick:r,theme:i}){const c=e.color??function(e,t){switch(e){case"warning":return t.warning;case"critical":return t.danger;default:return t.primary}}(e.status,i),d="number"==typeof e.value?e.value:NaN,u=function(e,t,o){const[r,i]=(0,n.useState)(e),s=(0,n.useRef)(e),a=(0,n.useRef)(null),l=(0,n.useRef)(null),c=function(){const[e,t]=(0,n.useState)(()=>"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,n.useEffect)(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}();return(0,n.useEffect)(()=>{if(!o||c)return i(e),void(s.current=e);const t=s.current;if(t===e)return;a.current=null;const n=o=>{null===a.current&&(a.current=o);const r=o-a.current,c=Math.min(r/600,1),d=1-Math.pow(1-c,3);i(t+(e-t)*d),c<1?l.current=requestAnimationFrame(n):s.current=e};return l.current=requestAnimationFrame(n),()=>{null!==l.current&&cancelAnimationFrame(l.current)}},[e,600,o,c]),r}(isNaN(d)?0:d,0,o&&!isNaN(d)),[f,h]=(0,n.useState)(!1),m=(0,n.useRef)(e.value);(0,n.useEffect)(()=>{if(m.current!==e.value){m.current=e.value,h(!0);const t=window.setTimeout(()=>h(!1),700);return()=>clearTimeout(t)}},[e.value]);const p=void 0!==e.previousValue&&e.previousValue!==d,g={background:i.surface,border:`1px solid ${i.border}`,borderLeft:`4px solid ${c}`,borderRadius:8,padding:"14px 16px",cursor:r?"pointer":"default",position:"relative",overflow:"hidden",boxSizing:"border-box"},y=f?{position:"absolute",inset:0,background:`linear-gradient(90deg, transparent 0%, ${c}22 50%, transparent 100%)`,backgroundSize:"200% 100%",animation:"tkx-metric-shimmer 0.6s ease-in-out",pointerEvents:"none"}:{},x=isNaN(d)?t.sanitizeString(String(e.value)):s(u,e.unit);return(0,n.createElement)("div",{style:g,className:f?"tkx-metric-shimmer":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0},f&&(0,n.createElement)("div",{style:y}),(0,n.createElement)("div",{style:{fontSize:12,color:i.textMuted,marginBottom:6,fontWeight:500,letterSpacing:"0.03em"}},t.sanitizeString(e.label)),(0,n.createElement)("div",{style:{display:"flex",alignItems:"flex-end",gap:6,marginBottom:6}},(0,n.createElement)("span",{style:{fontSize:28,fontWeight:700,color:i.text,lineHeight:1}},x),e.unit&&isNaN(d)&&(0,n.createElement)("span",{style:{fontSize:14,color:i.textMuted,marginBottom:2}},t.sanitizeString(e.unit))),(e.trend||e.trendValue)&&(0,n.createElement)("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:e.sparkline?8:0}},e.trend&&(0,n.createElement)(l,{trend:e.trend,theme:i}),e.trendValue&&(0,n.createElement)("span",{style:{fontSize:12,color:i.textMuted}},t.sanitizeString(e.trendValue))),p&&(0,n.createElement)("div",{style:{fontSize:11,color:i.textMuted,marginTop:2}},`was ${s(e.previousValue)}`),e.sparkline&&e.sparkline.length>=2&&(0,n.createElement)("div",{style:{marginTop:8}},(0,n.createElement)(a,{data:e.sparkline,color:c})))}function d(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}`}function u(e){return Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(2)}var f={debug:0,info:1,warn:2,error:3,fatal:4},h=!1;function m({entry:e,showLevel:o,showTimestamp:r,showSource:i,searchQuery:s,monospace:a,isExpanded:l,onToggle:c,onEntryClick:d,theme:u,style:f}){const h=function(e,t){switch(e){case"debug":default:return t.textMuted;case"info":return t.info;case"warn":return t.warning;case"error":case"fatal":return t.danger}}(e.level,u),m=function(e,t){return"fatal"===e?`${t.danger}22`:"transparent"}(e.level,u),p=e.metadata&&Object.keys(e.metadata).length>0,g={...f,display:"flex",alignItems:"center",gap:6,padding:"0 10px",fontSize:12,fontFamily:a?'"JetBrains Mono", "Fira Mono", Consolas, monospace':"inherit",cursor:p||d?"pointer":"default",background:m,boxSizing:"border-box",height:28,overflow:"hidden",whiteSpace:"nowrap",borderBottom:`1px solid ${u.border}22`};return(0,n.createElement)("div",{style:g,className:"tkx-log-row",onClick:()=>{p&&c(),d&&d(e)},role:p?"button":void 0,tabIndex:p?0:void 0,onKeyDown:p?e=>{"Enter"!==e.key&&" "!==e.key||c()}:void 0,"aria-expanded":p?l:void 0},r&&(0,n.createElement)("span",{style:{color:u.textMuted,flexShrink:0,minWidth:84}},function(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}(e.timestamp)),o&&(0,n.createElement)("span",{style:{color:h,flexShrink:0,fontWeight:"fatal"===e.level?700:500,minWidth:56}},`[${e.level.toUpperCase().padEnd(5)}]`),i&&e.source&&(0,n.createElement)("span",{style:{background:u.surfaceAlt,border:`1px solid ${u.border}`,borderRadius:10,padding:"0 5px",fontSize:10,color:u.textMuted,flexShrink:0,maxWidth:80,overflow:"hidden",textOverflow:"ellipsis"}},t.sanitizeString(e.source)),(0,n.createElement)("span",{style:{flex:1,color:u.text,overflow:"hidden",textOverflow:"ellipsis"}},...function(e,o){if(!o)return[e];const r=t.sanitizeString(e),i=t.sanitizeString(o);if(!i)return[r];try{const e=new RegExp(`(${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return r.split(e).map((t,o)=>e.test(t)?(0,n.createElement)("mark",{key:o,className:"tkx-log-highlight"},t):t)}catch{return[r]}}(e.message,s)),p&&(0,n.createElement)("span",{style:{color:u.textMuted,fontSize:10,flexShrink:0}},l?"▲":"▼"))}function p({metadata:e,theme:o,style:r}){return(0,n.createElement)("div",{style:{...r,background:o.surfaceAlt,borderBottom:`1px solid ${o.border}`,padding:"6px 10px 6px 56px",display:"flex",flexWrap:"wrap",gap:6,boxSizing:"border-box"}},...Object.entries(e).map(([e,r])=>(0,n.createElement)("span",{key:e,style:{fontSize:11,fontFamily:"monospace",color:o.textMuted,background:o.surface,border:`1px solid ${o.border}`,borderRadius:4,padding:"1px 6px"}},(0,n.createElement)("span",{style:{color:o.info}},`${t.sanitizeString(e)}: `),t.sanitizeString(String(r)))))}exports.TkxLiveFeed=function({items:i,maxItems:s=100,height:a=400,autoScroll:l=!0,showTimestamps:c=!0,onItemClick:d,emptyMessage:u="No activity yet.",pauseOnHover:f=!0,renderItem:h}){const m=e.useTheme();!function(){if(o||"undefined"==typeof document)return;o=!0;const e=document.createElement("style");e.id="tkx-live-feed-styles",e.textContent="\n@keyframes tkx-feed-slide-in {\n from { transform: translateY(-20px); opacity: 0; }\n to { transform: translateY(0); opacity: 1; }\n}\n.tkx-feed-item-new {\n animation: tkx-feed-slide-in 0.25s ease-out both;\n}\n ".trim(),document.head.appendChild(e)}();const p=(0,n.useRef)(null),[g,y]=(0,n.useState)(0),[x,b]=(0,n.useState)(!1),[k,v]=(0,n.useState)(new Set),w=(0,n.useRef)([]),S=(0,n.useMemo)(()=>i.slice(-s),[i,s]),$="number"==typeof a?a:400,M=64*S.length;(0,n.useEffect)(()=>{const e=new Set(w.current.map(e=>e.id)),t=S.filter(t=>!e.has(t.id)).map(e=>e.id);if(t.length>0){v(e=>{const n=new Set(e);return t.forEach(e=>n.add(e)),n});const e=window.setTimeout(()=>{v(e=>{const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},400);return()=>clearTimeout(e)}},[S]),(0,n.useEffect)(()=>{w.current=S},[S]);const z=l&&!(f&&x);(0,n.useEffect)(()=>{if(!z||!p.current)return;const e=p.current;(e.scrollHeight-e.scrollTop-e.clientHeight<192||S.length<=5)&&(e.scrollTop=e.scrollHeight)},[S.length,z]);const N=(0,n.useCallback)(()=>{p.current&&y(p.current.scrollTop)},[]),W=Math.max(0,Math.floor(g/64)-5),I=Math.min(S.length-1,Math.ceil((g+$)/64)+5),L={position:"relative",overflow:"auto",height:"number"==typeof a?`${a}px`:a,background:m.bg,border:`1px solid ${m.border}`,borderRadius:8,boxSizing:"border-box"},C={position:"relative",height:M,minHeight:"100%"};if(0===S.length)return(0,n.createElement)("div",{style:{...L,display:"flex",alignItems:"center",justifyContent:"center"}},(0,n.createElement)("span",{style:{color:m.textMuted,fontSize:14}},t.sanitizeString(u)));const j=[];for(let e=W;e<=I;e++){const t=S[e];t&&j.push((0,n.createElement)(r,{key:t.id,item:t,isNew:k.has(t.id),showTimestamps:c,onItemClick:d,renderItem:h,theme:m,style:{position:"absolute",top:64*e,left:0,right:0}}))}return(0,n.createElement)("div",{ref:p,style:L,onScroll:N,onMouseEnter:f?()=>b(!0):void 0,onMouseLeave:f?()=>b(!1):void 0,"aria-label":"Live feed",role:"feed"},(0,n.createElement)("div",{style:C},...j))},exports.TkxLiveLog=function({entries:t,maxEntries:o=500,height:r=400,autoScroll:i=!0,showLevel:s=!0,showTimestamp:a=!0,showSource:l=!0,filterLevel:c,searchQuery:d="",monospace:u=!0,onEntryClick:g}){const y=e.useTheme();!function(){if(h||"undefined"==typeof document)return;h=!0;const e=document.createElement("style");e.id="tkx-live-log-styles",e.textContent="\n.tkx-log-row:hover { filter: brightness(1.12); }\n.tkx-log-highlight { background: #ffbe0b55; border-radius: 2px; padding: 0 1px; }\n ".trim(),document.head.appendChild(e)}();const x=(0,n.useRef)(null),[b,k]=(0,n.useState)(0),[v,w]=(0,n.useState)(new Set),[S,$]=(0,n.useState)(!1),M=(0,n.useRef)(t.length),z=(0,n.useMemo)(()=>{let e=t.slice(-o);if(void 0!==c){const t=f[c];e=e.filter(e=>f[e.level]>=t)}if(d){const t=d.toLowerCase();e=e.filter(e=>e.message.toLowerCase().includes(t)||(e.source??"").toLowerCase().includes(t))}return e},[t,o,c,d]),N="number"==typeof r?r:400,W=(0,n.useMemo)(()=>{const e=[];let t=0;for(const n of z)e.push(t),t+=28+(v.has(n.id)?40:0);return e.push(t),e},[z,v]),I=W[W.length-1]??0;(0,n.useEffect)(()=>{i&&!S&&z.length!==M.current&&(M.current=z.length,x.current&&(x.current.scrollTop=x.current.scrollHeight))},[z.length,i,S]);const L=(0,n.useCallback)(()=>{if(!x.current)return;const e=x.current;$(!(e.scrollHeight-e.scrollTop-e.clientHeight<56)),k(e.scrollTop)},[]),C=(0,n.useCallback)(e=>{w(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),j=z.length>0?function(e){let t=0,n=z.length-1;for(;t<n;){const o=t+n>>1;(W[o+1]??0)<=e?t=o+1:n=o}return Math.max(0,t-8)}(b):0,T=z.length>0?function(e){let t=0,n=z.length-1;for(;t<n;){const o=t+n+1>>1;(W[o]??0)>=e+N?n=o-1:t=o}return Math.min(z.length-1,t+8)}(b):-1,E={position:"relative",overflow:"auto",height:"number"==typeof r?`${r}px`:r,background:y.bg,border:`1px solid ${y.border}`,borderRadius:8,boxSizing:"border-box"},R={position:"relative",height:I,minHeight:"100%"};if(0===z.length)return(0,n.createElement)("div",{style:{...E,display:"flex",alignItems:"center",justifyContent:"center"}},(0,n.createElement)("span",{style:{color:y.textMuted,fontSize:13,fontFamily:"monospace"}},"No log entries."));const B=[];for(let e=j;e<=T;e++){const t=z[e];if(!t)continue;const o=W[e]??0,r=v.has(t.id);B.push((0,n.createElement)(m,{key:t.id,entry:t,showLevel:s,showTimestamp:a,showSource:l,searchQuery:d,monospace:u,isExpanded:r,onToggle:()=>C(t.id),onEntryClick:g,theme:y,style:{position:"absolute",top:o,left:0,right:0}})),r&&t.metadata&&Object.keys(t.metadata).length>0&&B.push((0,n.createElement)(p,{key:`${t.id}-meta`,metadata:t.metadata,theme:y,style:{position:"absolute",top:o+28,left:0,right:0,height:40}}))}return(0,n.createElement)("div",{ref:x,style:E,onScroll:L,role:"log","aria-live":"polite","aria-label":"Log viewer"},(0,n.createElement)("div",{style:R},...B))},exports.TkxLiveMetrics=function({metrics:t,columns:o=3,animate:r=!0,onMetricClick:s}){const a=e.useTheme();return function(){if(i||"undefined"==typeof document)return;i=!0;const e=document.createElement("style");e.id="tkx-live-metrics-styles",e.textContent="\n@keyframes tkx-metric-pulse {\n 0% { opacity: 1; }\n 40% { opacity: 0.4; }\n 100% { opacity: 1; }\n}\n@keyframes tkx-metric-shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n.tkx-metric-shimmer {\n animation: tkx-metric-shimmer 0.6s ease-in-out;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-metric-shimmer { animation: none; }\n .tkx-metric-pulse { animation: none; }\n}\n ".trim(),document.head.appendChild(e)}(),(0,n.createElement)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`,gap:16}},...t.map(e=>(0,n.createElement)(c,{key:e.id,metric:e,animate:r,onMetricClick:s,theme:a})))},exports.TkxRealTimeChart=function({data:o,maxPoints:r=60,height:i=200,width:s="100%",color:a,fill:l=!0,showGrid:c=!0,showLabels:f=!0,showTooltip:h=!0,label:m,unit:p,animate:g=!0,yMin:y,yMax:x}){const b=e.useTheme(),k=a??b.primary,v=(0,n.useRef)(null),[w,S]=(0,n.useState)(600),[$,M]=(0,n.useState)(null),[z,N]=(0,n.useState)(0),W=(0,n.useRef)(o.length);(0,n.useEffect)(()=>{if(!v.current)return;const e=new ResizeObserver(e=>{const t=e[0];t&&S(t.contentRect.width)});return e.observe(v.current),S(v.current.offsetWidth),()=>e.disconnect()},[]);const I=(0,n.useMemo)(()=>o.slice(-r),[o,r]);(0,n.useEffect)(()=>{I.length>W.current&&N(e=>e+1),W.current=I.length},[I.length]);const L=f?48:12,C=m?28:12,j=Math.max(w-L-12,1),T=Math.max(i-C-28,1),E=I.length?Math.min(...I.map(e=>e.value)):0,R=I.length?Math.max(...I.map(e=>e.value)):1,B=R-E||1,O=void 0!==y?y:E-.1*B,F=(void 0!==x?x:R+.1*B)-O||1;function D(e){return I.length<2?j/2:e/(I.length-1)*j}function q(e){return T-(e-O)/F*T}const A=I.length>=2?I.map((e,t)=>`${0===t?"M":"L"}${D(t).toFixed(2)},${q(e.value).toFixed(2)}`).join(" "):"",H=A?`${A} L${D(I.length-1).toFixed(2)},${T} L${D(0).toFixed(2)},${T} Z`:"",P=[];for(let e=0;e<=4;e++)P.push(e);const Q=P.map(e=>{const t=O+e/4*F;return{y:q(t),text:u(t)}}),K=Math.min(4,I.length),Y=K>0?Array.from({length:K},(e,t)=>Math.round(t/Math.max(K-1,1)*(I.length-1))):[],G=(0,n.useCallback)(e=>{if(!h||0===I.length)return;const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-L;let o=0,r=1/0;I.forEach((e,t)=>{const i=Math.abs(D(t)-n);i<r&&(r=i,o=t)});const i=I[o];i&&M({x:D(o)+L,y:q(i.value)+C,point:i})},[I,h,L,C]),J=(0,n.useCallback)(()=>M(null),[]),Z=w,U=i,V=`tkx-chart-clip-${z}`;return(0,n.createElement)("div",{ref:v,style:{position:"relative",width:"number"==typeof s?`${s}px`:s,background:b.surface,border:`1px solid ${b.border}`,borderRadius:8,overflow:"hidden",boxSizing:"border-box"}},(0,n.createElement)("svg",{width:Z,height:U,viewBox:`0 0 ${Z} ${U}`,onMouseMove:G,onMouseLeave:J,style:{display:"block",userSelect:"none"},"aria-label":m?t.sanitizeString(m):"Real-time chart"},g&&I.length>=2&&(0,n.createElement)("defs",null,(0,n.createElement)("clipPath",{id:V},(0,n.createElement)("rect",{x:0,y:0,width:j,height:U},(0,n.createElement)("animate",{attributeName:"width",from:Math.max(0,j-j/Math.max(I.length-1,1)),to:j,dur:"0.3s",fill:"freeze"})))),m&&(0,n.createElement)("text",{x:L,y:18,fill:b.textMuted,fontSize:12,fontWeight:500},t.sanitizeString(m)),c&&P.map(e=>{const t=q(O+e/4*F)+C;return(0,n.createElement)("line",{key:`grid-${e}`,x1:L,y1:t,x2:L+j,y2:t,stroke:b.border,strokeWidth:1,strokeDasharray:"4 4"})}),f&&Q.map((e,t)=>(0,n.createElement)("text",{key:`yl-${t}`,x:L-4,y:e.y+C+4,fill:b.textMuted,fontSize:10,textAnchor:"end"},e.text)),p&&(0,n.createElement)("text",{x:4,y:C+10,fill:b.textMuted,fontSize:9},t.sanitizeString(p)),l&&H&&(0,n.createElement)("path",{d:H,fill:`${k}22`,clipPath:g?`url(#${V})`:void 0,transform:`translate(${L}, ${C})`}),A&&(0,n.createElement)("path",{d:A,fill:"none",stroke:k,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",clipPath:g?`url(#${V})`:void 0,transform:`translate(${L}, ${C})`}),Y.map(e=>{const t=I[e];return t?(0,n.createElement)("text",{key:`xl-${e}`,x:L+D(e),y:U-8,fill:b.textMuted,fontSize:9,textAnchor:"middle"},d(t.timestamp)):null}),$&&(0,n.createElement)("line",{x1:$.x,y1:C,x2:$.x,y2:C+T,stroke:k,strokeWidth:1,strokeDasharray:"3 3",opacity:.6}),$&&(0,n.createElement)("circle",{cx:$.x,cy:$.y,r:4,fill:k,stroke:b.surface,strokeWidth:2}),$&&(()=>{const e=Math.min($.x+8,Z-100),t=Math.max($.y-36,4),o=`${u($.point.value)}${p||""}`,r=d($.point.timestamp);return(0,n.createElement)("g",null,(0,n.createElement)("rect",{x:e-4,y:t-2,width:90,height:34,rx:4,fill:b.surfaceAlt,stroke:b.border,strokeWidth:1}),(0,n.createElement)("text",{x:e,y:t+11,fill:b.text,fontSize:12,fontWeight:700},o),(0,n.createElement)("text",{x:e,y:t+26,fill:b.textMuted,fontSize:10},r))})()))};
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./chunk-DmRB1Blb.js");const e=require("./chunk-BpuJ3-K8.js"),t=require("./chunk-D7-yknXg.js");let n=require("react");var o=!1;function r({item:e,isNew:o,showTimestamps:r,onItemClick:i,renderItem:s,theme:a,style:l}){const c=function(e,t){switch(e){case"info":return t.info;case"success":return t.success;case"warning":return t.warning;case"error":return t.danger;default:return t.border}}(e.type,a);return s?(0,n.createElement)("div",{style:l,className:o?"tkx-feed-item-new":void 0},s(e)):(0,n.createElement)("div",{style:{...l,display:"flex",alignItems:"center",gap:10,padding:"0 12px",borderLeft:`3px solid ${c}`,cursor:i?"pointer":"default",boxSizing:"border-box",height:64,background:a.surface,transition:"background 0.15s"},className:o?"tkx-feed-item-new":void 0,onClick:i?()=>i(e):void 0,role:i?"button":void 0,tabIndex:i?0:void 0,onKeyDown:i?t=>{"Enter"!==t.key&&" "!==t.key||i(e)}:void 0},(0,n.createElement)("div",{style:{width:36,height:36,borderRadius:"50%",background:c,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:700,color:a.bg,flexShrink:0,overflow:"hidden"}},e.avatar?(0,n.createElement)("img",{src:e.avatar,alt:e.author??"",style:{width:"100%",height:"100%",objectFit:"cover"}}):(d=e.author)?d.split(" ").map(e=>e[0]??"").slice(0,2).join("").toUpperCase():"?"),(0,n.createElement)("div",{style:{flex:1,minWidth:0}},(0,n.createElement)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2}},e.author&&(0,n.createElement)("span",{style:{fontWeight:600,fontSize:13,color:a.text}},t.sanitizeString(e.author)),e.meta&&(0,n.createElement)("span",{style:{fontSize:11,color:a.textMuted,background:a.surfaceAlt,borderRadius:4,padding:"1px 5px"}},t.sanitizeString(e.meta))),(0,n.createElement)("div",{style:{fontSize:13,color:a.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.sanitizeString(e.content))),r&&(0,n.createElement)("div",{style:{fontSize:11,color:a.textMuted,flexShrink:0}},function(e){const t=Date.now()-e;return t<1e4?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}(e.timestamp)));var d}var i=!1;function s(e,t){if("string"==typeof e)return e;const n=e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Number.isInteger(e)?e:e.toFixed(2));return t?`${n}${t}`:n}function a({data:e,color:t}){if(e.length<2)return null;const o=Math.min(...e),r=Math.max(...e)-o||1,i=e.map((t,n)=>{const i=n/(e.length-1)*80,s=24-(t-o)/r*22-1;return`${i.toFixed(1)},${s.toFixed(1)}`});return(0,n.createElement)("svg",{width:80,height:24,viewBox:"0 0 80 24","aria-hidden":"true"},(0,n.createElement)("polyline",{points:i.join(" "),fill:"none",stroke:t,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}))}function l({trend:e,theme:t}){return"up"===e?(0,n.createElement)("span",{style:{color:t.success,fontSize:14,fontWeight:700}},"▲"):"down"===e?(0,n.createElement)("span",{style:{color:t.danger,fontSize:14,fontWeight:700}},"▼"):(0,n.createElement)("span",{style:{color:t.textMuted,fontSize:14}},"→")}function c({metric:e,animate:o,onMetricClick:r,theme:i}){const c=e.color??function(e,t){switch(e){case"warning":return t.warning;case"critical":return t.danger;default:return t.primary}}(e.status,i),d="number"==typeof e.value?e.value:NaN,u=function(e,t,o){const[r,i]=(0,n.useState)(e),s=(0,n.useRef)(e),a=(0,n.useRef)(null),l=(0,n.useRef)(null),c=function(){const[e,t]=(0,n.useState)(()=>"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,n.useEffect)(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}();return(0,n.useEffect)(()=>{if(!o||c)return i(e),void(s.current=e);const t=s.current;if(t===e)return;a.current=null;const n=o=>{null===a.current&&(a.current=o);const r=o-a.current,c=Math.min(r/600,1),d=1-Math.pow(1-c,3);i(t+(e-t)*d),c<1?l.current=requestAnimationFrame(n):s.current=e};return l.current=requestAnimationFrame(n),()=>{null!==l.current&&cancelAnimationFrame(l.current)}},[e,600,o,c]),r}(isNaN(d)?0:d,0,o&&!isNaN(d)),[f,h]=(0,n.useState)(!1),m=(0,n.useRef)(e.value);(0,n.useEffect)(()=>{if(m.current!==e.value){m.current=e.value,h(!0);const t=window.setTimeout(()=>h(!1),700);return()=>clearTimeout(t)}},[e.value]);const p=void 0!==e.previousValue&&e.previousValue!==d,g={background:i.surface,border:`1px solid ${i.border}`,borderLeft:`4px solid ${c}`,borderRadius:8,padding:"14px 16px",cursor:r?"pointer":"default",position:"relative",overflow:"hidden",boxSizing:"border-box"},y=f?{position:"absolute",inset:0,background:`linear-gradient(90deg, transparent 0%, ${c}22 50%, transparent 100%)`,backgroundSize:"200% 100%",animation:"tkx-metric-shimmer 0.6s ease-in-out",pointerEvents:"none"}:{},x=isNaN(d)?t.sanitizeString(String(e.value)):s(u,e.unit);return(0,n.createElement)("div",{style:g,className:f?"tkx-metric-shimmer":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0},f&&(0,n.createElement)("div",{style:y}),(0,n.createElement)("div",{style:{fontSize:12,color:i.textMuted,marginBottom:6,fontWeight:500,letterSpacing:"0.03em"}},t.sanitizeString(e.label)),(0,n.createElement)("div",{style:{display:"flex",alignItems:"flex-end",gap:6,marginBottom:6}},(0,n.createElement)("span",{style:{fontSize:28,fontWeight:700,color:i.text,lineHeight:1}},x),e.unit&&isNaN(d)&&(0,n.createElement)("span",{style:{fontSize:14,color:i.textMuted,marginBottom:2}},t.sanitizeString(e.unit))),(e.trend||e.trendValue)&&(0,n.createElement)("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:e.sparkline?8:0}},e.trend&&(0,n.createElement)(l,{trend:e.trend,theme:i}),e.trendValue&&(0,n.createElement)("span",{style:{fontSize:12,color:i.textMuted}},t.sanitizeString(e.trendValue))),p&&(0,n.createElement)("div",{style:{fontSize:11,color:i.textMuted,marginTop:2}},`was ${s(e.previousValue)}`),e.sparkline&&e.sparkline.length>=2&&(0,n.createElement)("div",{style:{marginTop:8}},(0,n.createElement)(a,{data:e.sparkline,color:c})))}function d(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}`}function u(e){return Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(2)}var f={debug:0,info:1,warn:2,error:3,fatal:4},h=!1;function m({entry:e,showLevel:o,showTimestamp:r,showSource:i,searchQuery:s,monospace:a,isExpanded:l,onToggle:c,onEntryClick:d,theme:u,style:f}){const h=function(e,t){switch(e){case"debug":default:return t.textMuted;case"info":return t.info;case"warn":return t.warning;case"error":case"fatal":return t.danger}}(e.level,u),m=function(e,t){return"fatal"===e?`${t.danger}22`:"transparent"}(e.level,u),p=e.metadata&&Object.keys(e.metadata).length>0,g={...f,display:"flex",alignItems:"center",gap:6,padding:"0 10px",fontSize:12,fontFamily:a?'"JetBrains Mono", "Fira Mono", Consolas, monospace':"inherit",cursor:p||d?"pointer":"default",background:m,boxSizing:"border-box",height:28,overflow:"hidden",whiteSpace:"nowrap",borderBottom:`1px solid ${u.border}22`};return(0,n.createElement)("div",{style:g,className:"tkx-log-row",onClick:()=>{p&&c(),d&&d(e)},role:p?"button":void 0,tabIndex:p?0:void 0,onKeyDown:p?e=>{"Enter"!==e.key&&" "!==e.key||c()}:void 0,"aria-expanded":p?l:void 0},r&&(0,n.createElement)("span",{style:{color:u.textMuted,flexShrink:0,minWidth:84}},function(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}(e.timestamp)),o&&(0,n.createElement)("span",{style:{color:h,flexShrink:0,fontWeight:"fatal"===e.level?700:500,minWidth:56}},`[${e.level.toUpperCase().padEnd(5)}]`),i&&e.source&&(0,n.createElement)("span",{style:{background:u.surfaceAlt,border:`1px solid ${u.border}`,borderRadius:10,padding:"0 5px",fontSize:10,color:u.textMuted,flexShrink:0,maxWidth:80,overflow:"hidden",textOverflow:"ellipsis"}},t.sanitizeString(e.source)),(0,n.createElement)("span",{style:{flex:1,color:u.text,overflow:"hidden",textOverflow:"ellipsis"}},...function(e,o){if(!o)return[e];const r=t.sanitizeString(e),i=t.sanitizeString(o);if(!i)return[r];try{const e=new RegExp(`(${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return r.split(e).map((t,o)=>e.test(t)?(0,n.createElement)("mark",{key:o,className:"tkx-log-highlight"},t):t)}catch{return[r]}}(e.message,s)),p&&(0,n.createElement)("span",{style:{color:u.textMuted,fontSize:10,flexShrink:0}},l?"▲":"▼"))}function p({metadata:e,theme:o,style:r}){return(0,n.createElement)("div",{style:{...r,background:o.surfaceAlt,borderBottom:`1px solid ${o.border}`,padding:"6px 10px 6px 56px",display:"flex",flexWrap:"wrap",gap:6,boxSizing:"border-box"}},...Object.entries(e).map(([e,r])=>(0,n.createElement)("span",{key:e,style:{fontSize:11,fontFamily:"monospace",color:o.textMuted,background:o.surface,border:`1px solid ${o.border}`,borderRadius:4,padding:"1px 6px"}},(0,n.createElement)("span",{style:{color:o.info}},`${t.sanitizeString(e)}: `),t.sanitizeString(String(r)))))}exports.TkxLiveFeed=function({items:i,maxItems:s=100,height:a=400,autoScroll:l=!0,showTimestamps:c=!0,onItemClick:d,emptyMessage:u="No activity yet.",pauseOnHover:f=!0,renderItem:h}){const m=e.useTheme();!function(){if(o||"undefined"==typeof document)return;o=!0;const e=document.createElement("style");e.id="tkx-live-feed-styles",e.textContent="\n@keyframes tkx-feed-slide-in {\n from { transform: translateY(-20px); opacity: 0; }\n to { transform: translateY(0); opacity: 1; }\n}\n.tkx-feed-item-new {\n animation: tkx-feed-slide-in 0.25s ease-out both;\n}\n ".trim(),document.head.appendChild(e)}();const p=(0,n.useRef)(null),[g,y]=(0,n.useState)(0),[x,b]=(0,n.useState)(!1),[k,v]=(0,n.useState)(new Set),w=(0,n.useRef)([]),S=(0,n.useMemo)(()=>i.slice(-s),[i,s]),$="number"==typeof a?a:400,M=64*S.length;(0,n.useEffect)(()=>{const e=new Set(w.current.map(e=>e.id)),t=S.filter(t=>!e.has(t.id)).map(e=>e.id);if(t.length>0){v(e=>{const n=new Set(e);return t.forEach(e=>n.add(e)),n});const e=window.setTimeout(()=>{v(e=>{const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},400);return()=>clearTimeout(e)}},[S]),(0,n.useEffect)(()=>{w.current=S},[S]);const z=l&&!(f&&x);(0,n.useEffect)(()=>{if(!z||!p.current)return;const e=p.current;(e.scrollHeight-e.scrollTop-e.clientHeight<192||S.length<=5)&&(e.scrollTop=e.scrollHeight)},[S.length,z]);const N=(0,n.useCallback)(()=>{p.current&&y(p.current.scrollTop)},[]),W=Math.max(0,Math.floor(g/64)-5),I=Math.min(S.length-1,Math.ceil((g+$)/64)+5),L={position:"relative",overflow:"auto",height:"number"==typeof a?`${a}px`:a,background:m.bg,border:`1px solid ${m.border}`,borderRadius:8,boxSizing:"border-box"},C={position:"relative",height:M,minHeight:"100%"};if(0===S.length)return(0,n.createElement)("div",{style:{...L,display:"flex",alignItems:"center",justifyContent:"center"}},(0,n.createElement)("span",{style:{color:m.textMuted,fontSize:14}},t.sanitizeString(u)));const j=[];for(let e=W;e<=I;e++){const t=S[e];t&&j.push((0,n.createElement)(r,{key:t.id,item:t,isNew:k.has(t.id),showTimestamps:c,onItemClick:d,renderItem:h,theme:m,style:{position:"absolute",top:64*e,left:0,right:0}}))}return(0,n.createElement)("div",{ref:p,style:L,onScroll:N,onMouseEnter:f?()=>b(!0):void 0,onMouseLeave:f?()=>b(!1):void 0,"aria-label":"Live feed",role:"feed"},(0,n.createElement)("div",{style:C},...j))},exports.TkxLiveLog=function({entries:t,maxEntries:o=500,height:r=400,autoScroll:i=!0,showLevel:s=!0,showTimestamp:a=!0,showSource:l=!0,filterLevel:c,searchQuery:d="",monospace:u=!0,onEntryClick:g}){const y=e.useTheme();!function(){if(h||"undefined"==typeof document)return;h=!0;const e=document.createElement("style");e.id="tkx-live-log-styles",e.textContent="\n.tkx-log-row:hover { filter: brightness(1.12); }\n.tkx-log-highlight { background: #ffbe0b55; border-radius: 2px; padding: 0 1px; }\n ".trim(),document.head.appendChild(e)}();const x=(0,n.useRef)(null),[b,k]=(0,n.useState)(0),[v,w]=(0,n.useState)(new Set),[S,$]=(0,n.useState)(!1),M=(0,n.useRef)(t.length),z=(0,n.useMemo)(()=>{let e=t.slice(-o);if(void 0!==c){const t=f[c];e=e.filter(e=>f[e.level]>=t)}if(d){const t=d.toLowerCase();e=e.filter(e=>e.message.toLowerCase().includes(t)||(e.source??"").toLowerCase().includes(t))}return e},[t,o,c,d]),N="number"==typeof r?r:400,W=(0,n.useMemo)(()=>{const e=[];let t=0;for(const n of z)e.push(t),t+=28+(v.has(n.id)?40:0);return e.push(t),e},[z,v]),I=W[W.length-1]??0;(0,n.useEffect)(()=>{i&&!S&&z.length!==M.current&&(M.current=z.length,x.current&&(x.current.scrollTop=x.current.scrollHeight))},[z.length,i,S]);const L=(0,n.useCallback)(()=>{if(!x.current)return;const e=x.current;$(!(e.scrollHeight-e.scrollTop-e.clientHeight<56)),k(e.scrollTop)},[]),C=(0,n.useCallback)(e=>{w(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),j=z.length>0?function(e){let t=0,n=z.length-1;for(;t<n;){const o=t+n>>1;(W[o+1]??0)<=e?t=o+1:n=o}return Math.max(0,t-8)}(b):0,T=z.length>0?function(e){let t=0,n=z.length-1;for(;t<n;){const o=t+n+1>>1;(W[o]??0)>=e+N?n=o-1:t=o}return Math.min(z.length-1,t+8)}(b):-1,E={position:"relative",overflow:"auto",height:"number"==typeof r?`${r}px`:r,background:y.bg,border:`1px solid ${y.border}`,borderRadius:8,boxSizing:"border-box"},R={position:"relative",height:I,minHeight:"100%"};if(0===z.length)return(0,n.createElement)("div",{style:{...E,display:"flex",alignItems:"center",justifyContent:"center"}},(0,n.createElement)("span",{style:{color:y.textMuted,fontSize:13,fontFamily:"monospace"}},"No log entries."));const B=[];for(let e=j;e<=T;e++){const t=z[e];if(!t)continue;const o=W[e]??0,r=v.has(t.id);B.push((0,n.createElement)(m,{key:t.id,entry:t,showLevel:s,showTimestamp:a,showSource:l,searchQuery:d,monospace:u,isExpanded:r,onToggle:()=>C(t.id),onEntryClick:g,theme:y,style:{position:"absolute",top:o,left:0,right:0}})),r&&t.metadata&&Object.keys(t.metadata).length>0&&B.push((0,n.createElement)(p,{key:`${t.id}-meta`,metadata:t.metadata,theme:y,style:{position:"absolute",top:o+28,left:0,right:0,height:40}}))}return(0,n.createElement)("div",{ref:x,style:E,onScroll:L,role:"log","aria-live":"polite","aria-label":"Log viewer"},(0,n.createElement)("div",{style:R},...B))},exports.TkxLiveMetrics=function({metrics:t,columns:o=3,animate:r=!0,onMetricClick:s}){const a=e.useTheme();return function(){if(i||"undefined"==typeof document)return;i=!0;const e=document.createElement("style");e.id="tkx-live-metrics-styles",e.textContent="\n@keyframes tkx-metric-pulse {\n 0% { opacity: 1; }\n 40% { opacity: 0.4; }\n 100% { opacity: 1; }\n}\n@keyframes tkx-metric-shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n.tkx-metric-shimmer {\n animation: tkx-metric-shimmer 0.6s ease-in-out;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-metric-shimmer { animation: none; }\n .tkx-metric-pulse { animation: none; }\n}\n ".trim(),document.head.appendChild(e)}(),(0,n.createElement)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`,gap:16}},...t.map(e=>(0,n.createElement)(c,{key:e.id,metric:e,animate:r,onMetricClick:s,theme:a})))},exports.TkxRealTimeChart=function({data:o,maxPoints:r=60,height:i=200,width:s="100%",color:a,fill:l=!0,showGrid:c=!0,showLabels:f=!0,showTooltip:h=!0,label:m,unit:p,animate:g=!0,yMin:y,yMax:x}){const b=e.useTheme(),k=a??b.primary,v=(0,n.useRef)(null),[w,S]=(0,n.useState)(600),[$,M]=(0,n.useState)(null),[z,N]=(0,n.useState)(0),W=(0,n.useRef)(o.length);(0,n.useEffect)(()=>{if(!v.current)return;const e=new ResizeObserver(e=>{const t=e[0];t&&S(t.contentRect.width)});return e.observe(v.current),S(v.current.offsetWidth),()=>e.disconnect()},[]);const I=(0,n.useMemo)(()=>o.slice(-r),[o,r]);(0,n.useEffect)(()=>{I.length>W.current&&N(e=>e+1),W.current=I.length},[I.length]);const L=f?48:12,C=m?28:12,j=Math.max(w-L-12,1),T=Math.max(i-C-28,1),E=I.length?Math.min(...I.map(e=>e.value)):0,R=I.length?Math.max(...I.map(e=>e.value)):1,B=R-E||1,O=void 0!==y?y:E-.1*B,F=(void 0!==x?x:R+.1*B)-O||1;function D(e){return I.length<2?j/2:e/(I.length-1)*j}function q(e){return T-(e-O)/F*T}const A=I.length>=2?I.map((e,t)=>`${0===t?"M":"L"}${D(t).toFixed(2)},${q(e.value).toFixed(2)}`).join(" "):"",H=A?`${A} L${D(I.length-1).toFixed(2)},${T} L${D(0).toFixed(2)},${T} Z`:"",P=[];for(let e=0;e<=4;e++)P.push(e);const Q=P.map(e=>{const t=O+e/4*F;return{y:q(t),text:u(t)}}),K=Math.min(4,I.length),Y=K>0?Array.from({length:K},(e,t)=>Math.round(t/Math.max(K-1,1)*(I.length-1))):[],G=(0,n.useCallback)(e=>{if(!h||0===I.length)return;const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-L;let o=0,r=1/0;I.forEach((e,t)=>{const i=Math.abs(D(t)-n);i<r&&(r=i,o=t)});const i=I[o];i&&M({x:D(o)+L,y:q(i.value)+C,point:i})},[I,h,L,C]),J=(0,n.useCallback)(()=>M(null),[]),Z=w,U=i,V=`tkx-chart-clip-${z}`;return(0,n.createElement)("div",{ref:v,style:{position:"relative",width:"number"==typeof s?`${s}px`:s,background:b.surface,border:`1px solid ${b.border}`,borderRadius:8,overflow:"hidden",boxSizing:"border-box"}},(0,n.createElement)("svg",{width:Z,height:U,viewBox:`0 0 ${Z} ${U}`,onMouseMove:G,onMouseLeave:J,style:{display:"block",userSelect:"none"},"aria-label":m?t.sanitizeString(m):"Real-time chart"},g&&I.length>=2&&(0,n.createElement)("defs",null,(0,n.createElement)("clipPath",{id:V},(0,n.createElement)("rect",{x:0,y:0,width:j,height:U},(0,n.createElement)("animate",{attributeName:"width",from:Math.max(0,j-j/Math.max(I.length-1,1)),to:j,dur:"0.3s",fill:"freeze"})))),m&&(0,n.createElement)("text",{x:L,y:18,fill:b.textMuted,fontSize:12,fontWeight:500},t.sanitizeString(m)),c&&P.map(e=>{const t=q(O+e/4*F)+C;return(0,n.createElement)("line",{key:`grid-${e}`,x1:L,y1:t,x2:L+j,y2:t,stroke:b.border,strokeWidth:1,strokeDasharray:"4 4"})}),f&&Q.map((e,t)=>(0,n.createElement)("text",{key:`yl-${t}`,x:L-4,y:e.y+C+4,fill:b.textMuted,fontSize:10,textAnchor:"end"},e.text)),p&&(0,n.createElement)("text",{x:4,y:C+10,fill:b.textMuted,fontSize:9},t.sanitizeString(p)),l&&H&&(0,n.createElement)("path",{d:H,fill:`${k}22`,clipPath:g?`url(#${V})`:void 0,transform:`translate(${L}, ${C})`}),A&&(0,n.createElement)("path",{d:A,fill:"none",stroke:k,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",clipPath:g?`url(#${V})`:void 0,transform:`translate(${L}, ${C})`}),Y.map(e=>{const t=I[e];return t?(0,n.createElement)("text",{key:`xl-${e}`,x:L+D(e),y:U-8,fill:b.textMuted,fontSize:9,textAnchor:"middle"},d(t.timestamp)):null}),$&&(0,n.createElement)("line",{x1:$.x,y1:C,x2:$.x,y2:C+T,stroke:k,strokeWidth:1,strokeDasharray:"3 3",opacity:.6}),$&&(0,n.createElement)("circle",{cx:$.x,cy:$.y,r:4,fill:k,stroke:b.surface,strokeWidth:2}),$&&(()=>{const e=Math.min($.x+8,Z-100),t=Math.max($.y-36,4),o=`${u($.point.value)}${p||""}`,r=d($.point.timestamp);return(0,n.createElement)("g",null,(0,n.createElement)("rect",{x:e-4,y:t-2,width:90,height:34,rx:4,fill:b.surfaceAlt,stroke:b.border,strokeWidth:1}),(0,n.createElement)("text",{x:e,y:t+11,fill:b.text,fontSize:12,fontWeight:700},o),(0,n.createElement)("text",{x:e,y:t+26,fill:b.textMuted,fontSize:10},r))})()))};
|
package/dist/realtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e}from"./chunk-PJ50l0JC.js";import{m as t}from"./chunk-Dj40UFcz.js";import{createElement as n,useCallback as o,useEffect as i,useMemo as r,useRef as s,useState as a}from"react";var l=!1;function c({item:e,isNew:o,showTimestamps:i,onItemClick:r,renderItem:s,theme:a,style:l}){const c=function(e,t){switch(e){case"info":return t.info;case"success":return t.success;case"warning":return t.warning;case"error":return t.danger;default:return t.border}}(e.type,a);return s?n("div",{style:l,className:o?"tkx-feed-item-new":void 0},s(e)):n("div",{style:{...l,display:"flex",alignItems:"center",gap:10,padding:"0 12px",borderLeft:`3px solid ${c}`,cursor:r?"pointer":"default",boxSizing:"border-box",height:64,background:a.surface,transition:"background 0.15s"},className:o?"tkx-feed-item-new":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0,onKeyDown:r?t=>{"Enter"!==t.key&&" "!==t.key||r(e)}:void 0},n("div",{style:{width:36,height:36,borderRadius:"50%",background:c,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:700,color:a.bg,flexShrink:0,overflow:"hidden"}},e.avatar?n("img",{src:e.avatar,alt:e.author??"",style:{width:"100%",height:"100%",objectFit:"cover"}}):(d=e.author)?d.split(" ").map(e=>e[0]??"").slice(0,2).join("").toUpperCase():"?"),n("div",{style:{flex:1,minWidth:0}},n("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2}},e.author&&n("span",{style:{fontWeight:600,fontSize:13,color:a.text}},t(e.author)),e.meta&&n("span",{style:{fontSize:11,color:a.textMuted,background:a.surfaceAlt,borderRadius:4,padding:"1px 5px"}},t(e.meta))),n("div",{style:{fontSize:13,color:a.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t(e.content))),i&&n("div",{style:{fontSize:11,color:a.textMuted,flexShrink:0}},function(e){const t=Date.now()-e;return t<1e4?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}(e.timestamp)));var d}function d({items:d,maxItems:u=100,height:f=400,autoScroll:h=!0,showTimestamps:m=!0,onItemClick:p,emptyMessage:g="No activity yet.",pauseOnHover:y=!0,renderItem:x}){const b=e();!function(){if(l||"undefined"==typeof document)return;l=!0;const e=document.createElement("style");e.id="tkx-live-feed-styles",e.textContent="\n@keyframes tkx-feed-slide-in {\n from { transform: translateY(-20px); opacity: 0; }\n to { transform: translateY(0); opacity: 1; }\n}\n.tkx-feed-item-new {\n animation: tkx-feed-slide-in 0.25s ease-out both;\n}\n ".trim(),document.head.appendChild(e)}();const k=s(null),[v,w]=a(0),[S,$]=a(!1),[M,z]=a(/* @__PURE__ */new Set),N=s([]),W=r(()=>d.slice(-u),[d,u]),I="number"==typeof f?f:400,L=64*W.length;i(()=>{const e=new Set(N.current.map(e=>e.id)),t=W.filter(t=>!e.has(t.id)).map(e=>e.id);if(t.length>0){z(e=>{const n=new Set(e);return t.forEach(e=>n.add(e)),n});const e=window.setTimeout(()=>{z(e=>{const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},400);return()=>clearTimeout(e)}},[W]),i(()=>{N.current=W},[W]);const C=h&&!(y&&S);i(()=>{if(!C||!k.current)return;const e=k.current;(e.scrollHeight-e.scrollTop-e.clientHeight<192||W.length<=5)&&(e.scrollTop=e.scrollHeight)},[W.length,C]);const T=o(()=>{k.current&&w(k.current.scrollTop)},[]),j=Math.max(0,Math.floor(v/64)-5),E=Math.min(W.length-1,Math.ceil((v+I)/64)+5),R={position:"relative",overflow:"auto",height:"number"==typeof f?`${f}px`:f,background:b.bg,border:`1px solid ${b.border}`,borderRadius:8,boxSizing:"border-box"},B={position:"relative",height:L,minHeight:"100%"};if(0===W.length)return n("div",{style:{...R,display:"flex",alignItems:"center",justifyContent:"center"}},n("span",{style:{color:b.textMuted,fontSize:14}},t(g)));const F=[];for(let e=j;e<=E;e++){const t=W[e];t&&F.push(n(c,{key:t.id,item:t,isNew:M.has(t.id),showTimestamps:m,onItemClick:p,renderItem:x,theme:b,style:{position:"absolute",top:64*e,left:0,right:0}}))}return n("div",{ref:k,style:R,onScroll:T,onMouseEnter:y?()=>$(!0):void 0,onMouseLeave:y?()=>$(!1):void 0,"aria-label":"Live feed",role:"feed"},n("div",{style:B},...F))}var u=!1;function f(e,t){if("string"==typeof e)return e;const n=e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Number.isInteger(e)?e:e.toFixed(2));return t?`${n}${t}`:n}function h({data:e,color:t}){if(e.length<2)return null;const o=Math.min(...e),i=Math.max(...e)-o||1,r=e.map((t,n)=>{const r=n/(e.length-1)*80,s=24-(t-o)/i*22-1;return`${r.toFixed(1)},${s.toFixed(1)}`});return n("svg",{width:80,height:24,viewBox:"0 0 80 24","aria-hidden":"true"},n("polyline",{points:r.join(" "),fill:"none",stroke:t,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}))}function m({trend:e,theme:t}){return"up"===e?n("span",{style:{color:t.success,fontSize:14,fontWeight:700}},"▲"):"down"===e?n("span",{style:{color:t.danger,fontSize:14,fontWeight:700}},"▼"):n("span",{style:{color:t.textMuted,fontSize:14}},"→")}function p({metric:e,animate:o,onMetricClick:r,theme:l}){const c=e.color??function(e,t){switch(e){case"warning":return t.warning;case"critical":return t.danger;default:return t.primary}}(e.status,l),d="number"==typeof e.value?e.value:NaN,u=function(e,t,n){const[o,r]=a(e),l=s(e),c=s(null),d=s(null),u=function(){const[e,t]=a(()=>"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}();return i(()=>{if(!n||u)return r(e),void(l.current=e);const t=l.current;if(t===e)return;c.current=null;const o=n=>{null===c.current&&(c.current=n);const i=n-c.current,s=Math.min(i/600,1),a=1-Math.pow(1-s,3);r(t+(e-t)*a),s<1?d.current=requestAnimationFrame(o):l.current=e};return d.current=requestAnimationFrame(o),()=>{null!==d.current&&cancelAnimationFrame(d.current)}},[e,600,n,u]),o}(isNaN(d)?0:d,0,o&&!isNaN(d)),[p,g]=a(!1),y=s(e.value);i(()=>{if(y.current!==e.value){y.current=e.value,g(!0);const t=window.setTimeout(()=>g(!1),700);return()=>clearTimeout(t)}},[e.value]);const x=void 0!==e.previousValue&&e.previousValue!==d,b={background:l.surface,border:`1px solid ${l.border}`,borderLeft:`4px solid ${c}`,borderRadius:8,padding:"14px 16px",cursor:r?"pointer":"default",position:"relative",overflow:"hidden",boxSizing:"border-box"},k=p?{position:"absolute",inset:0,background:`linear-gradient(90deg, transparent 0%, ${c}22 50%, transparent 100%)`,backgroundSize:"200% 100%",animation:"tkx-metric-shimmer 0.6s ease-in-out",pointerEvents:"none"}:{},v=isNaN(d)?t(String(e.value)):f(u,e.unit);return n("div",{style:b,className:p?"tkx-metric-shimmer":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0},p&&n("div",{style:k}),n("div",{style:{fontSize:12,color:l.textMuted,marginBottom:6,fontWeight:500,letterSpacing:"0.03em"}},t(e.label)),n("div",{style:{display:"flex",alignItems:"flex-end",gap:6,marginBottom:6}},n("span",{style:{fontSize:28,fontWeight:700,color:l.text,lineHeight:1}},v),e.unit&&isNaN(d)&&n("span",{style:{fontSize:14,color:l.textMuted,marginBottom:2}},t(e.unit))),(e.trend||e.trendValue)&&n("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:e.sparkline?8:0}},e.trend&&n(m,{trend:e.trend,theme:l}),e.trendValue&&n("span",{style:{fontSize:12,color:l.textMuted}},t(e.trendValue))),x&&n("div",{style:{fontSize:11,color:l.textMuted,marginTop:2}},`was ${f(e.previousValue)}`),e.sparkline&&e.sparkline.length>=2&&n("div",{style:{marginTop:8}},n(h,{data:e.sparkline,color:c})))}function g({metrics:t,columns:o=3,animate:i=!0,onMetricClick:r}){const s=e();return function(){if(u||"undefined"==typeof document)return;u=!0;const e=document.createElement("style");e.id="tkx-live-metrics-styles",e.textContent="\n@keyframes tkx-metric-pulse {\n 0% { opacity: 1; }\n 40% { opacity: 0.4; }\n 100% { opacity: 1; }\n}\n@keyframes tkx-metric-shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n.tkx-metric-shimmer {\n animation: tkx-metric-shimmer 0.6s ease-in-out;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-metric-shimmer { animation: none; }\n .tkx-metric-pulse { animation: none; }\n}\n ".trim(),document.head.appendChild(e)}(),n("div",{style:{display:"grid",gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`,gap:16}},...t.map(e=>n(p,{key:e.id,metric:e,animate:i,onMetricClick:r,theme:s})))}function y(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}`}function x(e){return Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(2)}function b({data:l,maxPoints:c=60,height:d=200,width:u="100%",color:f,fill:h=!0,showGrid:m=!0,showLabels:p=!0,showTooltip:g=!0,label:b,unit:k,animate:v=!0,yMin:w,yMax:S}){const $=e(),M=f??$.primary,z=s(null),[N,W]=a(600),[I,L]=a(null),[C,T]=a(0),j=s(l.length);i(()=>{if(!z.current)return;const e=new ResizeObserver(e=>{const t=e[0];t&&W(t.contentRect.width)});return e.observe(z.current),W(z.current.offsetWidth),()=>e.disconnect()},[]);const E=r(()=>l.slice(-c),[l,c]);i(()=>{E.length>j.current&&T(e=>e+1),j.current=E.length},[E.length]);const R=p?48:12,B=b?28:12,F=Math.max(N-R-12,1),O=Math.max(d-B-28,1),D=E.length?Math.min(...E.map(e=>e.value)):0,A=E.length?Math.max(...E.map(e=>e.value)):1,H=A-D||1,P=void 0!==w?w:D-.1*H,Q=(void 0!==S?S:A+.1*H)-P||1;function q(e){return E.length<2?F/2:e/(E.length-1)*F}function K(e){return O-(e-P)/Q*O}const Y=E.length>=2?E.map((e,t)=>`${0===t?"M":"L"}${q(t).toFixed(2)},${K(e.value).toFixed(2)}`).join(" "):"",G=Y?`${Y} L${q(E.length-1).toFixed(2)},${O} L${q(0).toFixed(2)},${O} Z`:"",J=[];for(let e=0;e<=4;e++)J.push(e);const Z=J.map(e=>{const t=P+e/4*Q;return{y:K(t),text:x(t)}}),U=Math.min(4,E.length),V=U>0?Array.from({length:U},(e,t)=>Math.round(t/Math.max(U-1,1)*(E.length-1))):[],X=o(e=>{if(!g||0===E.length)return;const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-R;let o=0,i=1/0;E.forEach((e,t)=>{const r=Math.abs(q(t)-n);r<i&&(i=r,o=t)});const r=E[o];r&&L({x:q(o)+R,y:K(r.value)+B,point:r})},[E,g,R,B]),_=o(()=>L(null),[]),ee=N,te=d,ne=`tkx-chart-clip-${C}`;return n("div",{ref:z,style:{position:"relative",width:"number"==typeof u?`${u}px`:u,background:$.surface,border:`1px solid ${$.border}`,borderRadius:8,overflow:"hidden",boxSizing:"border-box"}},n("svg",{width:ee,height:te,viewBox:`0 0 ${ee} ${te}`,onMouseMove:X,onMouseLeave:_,style:{display:"block",userSelect:"none"},"aria-label":b?t(b):"Real-time chart"},v&&E.length>=2&&n("defs",null,n("clipPath",{id:ne},n("rect",{x:0,y:0,width:F,height:te},n("animate",{attributeName:"width",from:Math.max(0,F-F/Math.max(E.length-1,1)),to:F,dur:"0.3s",fill:"freeze"})))),b&&n("text",{x:R,y:18,fill:$.textMuted,fontSize:12,fontWeight:500},t(b)),m&&J.map(e=>{const t=K(P+e/4*Q)+B;return n("line",{key:`grid-${e}`,x1:R,y1:t,x2:R+F,y2:t,stroke:$.border,strokeWidth:1,strokeDasharray:"4 4"})}),p&&Z.map((e,t)=>n("text",{key:`yl-${t}`,x:R-4,y:e.y+B+4,fill:$.textMuted,fontSize:10,textAnchor:"end"},e.text)),k&&n("text",{x:4,y:B+10,fill:$.textMuted,fontSize:9},t(k)),h&&G&&n("path",{d:G,fill:`${M}22`,clipPath:v?`url(#${ne})`:void 0,transform:`translate(${R}, ${B})`}),Y&&n("path",{d:Y,fill:"none",stroke:M,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",clipPath:v?`url(#${ne})`:void 0,transform:`translate(${R}, ${B})`}),V.map(e=>{const t=E[e];return t?n("text",{key:`xl-${e}`,x:R+q(e),y:te-8,fill:$.textMuted,fontSize:9,textAnchor:"middle"},y(t.timestamp)):null}),I&&n("line",{x1:I.x,y1:B,x2:I.x,y2:B+O,stroke:M,strokeWidth:1,strokeDasharray:"3 3",opacity:.6}),I&&n("circle",{cx:I.x,cy:I.y,r:4,fill:M,stroke:$.surface,strokeWidth:2}),I&&(()=>{const e=Math.min(I.x+8,ee-100),t=Math.max(I.y-36,4),o=`${x(I.point.value)}${k||""}`,i=y(I.point.timestamp);return n("g",null,n("rect",{x:e-4,y:t-2,width:90,height:34,rx:4,fill:$.surfaceAlt,stroke:$.border,strokeWidth:1}),n("text",{x:e,y:t+11,fill:$.text,fontSize:12,fontWeight:700},o),n("text",{x:e,y:t+26,fill:$.textMuted,fontSize:10},i))})()))}var k={debug:0,info:1,warn:2,error:3,fatal:4},v=!1;function w({entry:e,showLevel:o,showTimestamp:i,showSource:r,searchQuery:s,monospace:a,isExpanded:l,onToggle:c,onEntryClick:d,theme:u,style:f}){const h=function(e,t){switch(e){case"debug":default:return t.textMuted;case"info":return t.info;case"warn":return t.warning;case"error":case"fatal":return t.danger}}(e.level,u),m=function(e,t){return"fatal"===e?`${t.danger}22`:"transparent"}(e.level,u),p=e.metadata&&Object.keys(e.metadata).length>0,g={...f,display:"flex",alignItems:"center",gap:6,padding:"0 10px",fontSize:12,fontFamily:a?'"JetBrains Mono", "Fira Mono", Consolas, monospace':"inherit",cursor:p||d?"pointer":"default",background:m,boxSizing:"border-box",height:28,overflow:"hidden",whiteSpace:"nowrap",borderBottom:`1px solid ${u.border}22`};return n("div",{style:g,className:"tkx-log-row",onClick:()=>{p&&c(),d&&d(e)},role:p?"button":void 0,tabIndex:p?0:void 0,onKeyDown:p?e=>{"Enter"!==e.key&&" "!==e.key||c()}:void 0,"aria-expanded":p?l:void 0},i&&n("span",{style:{color:u.textMuted,flexShrink:0,minWidth:84}},function(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}(e.timestamp)),o&&n("span",{style:{color:h,flexShrink:0,fontWeight:"fatal"===e.level?700:500,minWidth:56}},`[${e.level.toUpperCase().padEnd(5)}]`),r&&e.source&&n("span",{style:{background:u.surfaceAlt,border:`1px solid ${u.border}`,borderRadius:10,padding:"0 5px",fontSize:10,color:u.textMuted,flexShrink:0,maxWidth:80,overflow:"hidden",textOverflow:"ellipsis"}},t(e.source)),n("span",{style:{flex:1,color:u.text,overflow:"hidden",textOverflow:"ellipsis"}},...function(e,o){if(!o)return[e];const i=t(e),r=t(o);if(!r)return[i];try{const e=new RegExp(`(${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return i.split(e).map((t,o)=>e.test(t)?n("mark",{key:o,className:"tkx-log-highlight"},t):t)}catch{return[i]}}(e.message,s)),p&&n("span",{style:{color:u.textMuted,fontSize:10,flexShrink:0}},l?"▲":"▼"))}function S({metadata:e,theme:o,style:i}){return n("div",{style:{...i,background:o.surfaceAlt,borderBottom:`1px solid ${o.border}`,padding:"6px 10px 6px 56px",display:"flex",flexWrap:"wrap",gap:6,boxSizing:"border-box"}},...Object.entries(e).map(([e,i])=>n("span",{key:e,style:{fontSize:11,fontFamily:"monospace",color:o.textMuted,background:o.surface,border:`1px solid ${o.border}`,borderRadius:4,padding:"1px 6px"}},n("span",{style:{color:o.info}},`${t(e)}: `),t(String(i)))))}function $({entries:t,maxEntries:l=500,height:c=400,autoScroll:d=!0,showLevel:u=!0,showTimestamp:f=!0,showSource:h=!0,filterLevel:m,searchQuery:p="",monospace:g=!0,onEntryClick:y}){const x=e();!function(){if(v||"undefined"==typeof document)return;v=!0;const e=document.createElement("style");e.id="tkx-live-log-styles",e.textContent="\n.tkx-log-row:hover { filter: brightness(1.12); }\n.tkx-log-highlight { background: #ffbe0b55; border-radius: 2px; padding: 0 1px; }\n ".trim(),document.head.appendChild(e)}();const b=s(null),[$,M]=a(0),[z,N]=a(/* @__PURE__ */new Set),[W,I]=a(!1),L=s(t.length),C=r(()=>{let e=t.slice(-l);if(void 0!==m){const t=k[m];e=e.filter(e=>k[e.level]>=t)}if(p){const t=p.toLowerCase();e=e.filter(e=>e.message.toLowerCase().includes(t)||(e.source??"").toLowerCase().includes(t))}return e},[t,l,m,p]),T="number"==typeof c?c:400,j=r(()=>{const e=[];let t=0;for(const n of C)e.push(t),t+=28+(z.has(n.id)?40:0);return e.push(t),e},[C,z]),E=j[j.length-1]??0;i(()=>{d&&!W&&C.length!==L.current&&(L.current=C.length,b.current&&(b.current.scrollTop=b.current.scrollHeight))},[C.length,d,W]);const R=o(()=>{if(!b.current)return;const e=b.current;I(!(e.scrollHeight-e.scrollTop-e.clientHeight<56)),M(e.scrollTop)},[]),B=o(e=>{N(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),F=C.length>0?function(e){let t=0,n=C.length-1;for(;t<n;){const o=t+n>>1;(j[o+1]??0)<=e?t=o+1:n=o}return Math.max(0,t-8)}($):0,O=C.length>0?function(e){let t=0,n=C.length-1;for(;t<n;){const o=t+n+1>>1;(j[o]??0)>=e+T?n=o-1:t=o}return Math.min(C.length-1,t+8)}($):-1,D={position:"relative",overflow:"auto",height:"number"==typeof c?`${c}px`:c,background:x.bg,border:`1px solid ${x.border}`,borderRadius:8,boxSizing:"border-box"},A={position:"relative",height:E,minHeight:"100%"};if(0===C.length)return n("div",{style:{...D,display:"flex",alignItems:"center",justifyContent:"center"}},n("span",{style:{color:x.textMuted,fontSize:13,fontFamily:"monospace"}},"No log entries."));const H=[];for(let e=F;e<=O;e++){const t=C[e];if(!t)continue;const o=j[e]??0,i=z.has(t.id);H.push(n(w,{key:t.id,entry:t,showLevel:u,showTimestamp:f,showSource:h,searchQuery:p,monospace:g,isExpanded:i,onToggle:()=>B(t.id),onEntryClick:y,theme:x,style:{position:"absolute",top:o,left:0,right:0}})),i&&t.metadata&&Object.keys(t.metadata).length>0&&H.push(n(S,{key:`${t.id}-meta`,metadata:t.metadata,theme:x,style:{position:"absolute",top:o+28,left:0,right:0,height:40}}))}return n("div",{ref:b,style:D,onScroll:R,role:"log","aria-live":"polite","aria-label":"Log viewer"},n("div",{style:A},...H))}export{d as TkxLiveFeed,$ as TkxLiveLog,g as TkxLiveMetrics,b as TkxRealTimeChart};
|
|
1
|
+
import{p as e}from"./chunk-DdHSYetV.js";import{E as t}from"./chunk-DcVMayoM.js";import{createElement as n,useCallback as o,useEffect as i,useMemo as r,useRef as s,useState as a}from"react";var l=!1;function c({item:e,isNew:o,showTimestamps:i,onItemClick:r,renderItem:s,theme:a,style:l}){const c=function(e,t){switch(e){case"info":return t.info;case"success":return t.success;case"warning":return t.warning;case"error":return t.danger;default:return t.border}}(e.type,a);return s?n("div",{style:l,className:o?"tkx-feed-item-new":void 0},s(e)):n("div",{style:{...l,display:"flex",alignItems:"center",gap:10,padding:"0 12px",borderLeft:`3px solid ${c}`,cursor:r?"pointer":"default",boxSizing:"border-box",height:64,background:a.surface,transition:"background 0.15s"},className:o?"tkx-feed-item-new":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0,onKeyDown:r?t=>{"Enter"!==t.key&&" "!==t.key||r(e)}:void 0},n("div",{style:{width:36,height:36,borderRadius:"50%",background:c,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:700,color:a.bg,flexShrink:0,overflow:"hidden"}},e.avatar?n("img",{src:e.avatar,alt:e.author??"",style:{width:"100%",height:"100%",objectFit:"cover"}}):(d=e.author)?d.split(" ").map(e=>e[0]??"").slice(0,2).join("").toUpperCase():"?"),n("div",{style:{flex:1,minWidth:0}},n("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2}},e.author&&n("span",{style:{fontWeight:600,fontSize:13,color:a.text}},t(e.author)),e.meta&&n("span",{style:{fontSize:11,color:a.textMuted,background:a.surfaceAlt,borderRadius:4,padding:"1px 5px"}},t(e.meta))),n("div",{style:{fontSize:13,color:a.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t(e.content))),i&&n("div",{style:{fontSize:11,color:a.textMuted,flexShrink:0}},function(e){const t=Date.now()-e;return t<1e4?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}(e.timestamp)));var d}function d({items:d,maxItems:u=100,height:f=400,autoScroll:h=!0,showTimestamps:m=!0,onItemClick:p,emptyMessage:g="No activity yet.",pauseOnHover:y=!0,renderItem:x}){const b=e();!function(){if(l||"undefined"==typeof document)return;l=!0;const e=document.createElement("style");e.id="tkx-live-feed-styles",e.textContent="\n@keyframes tkx-feed-slide-in {\n from { transform: translateY(-20px); opacity: 0; }\n to { transform: translateY(0); opacity: 1; }\n}\n.tkx-feed-item-new {\n animation: tkx-feed-slide-in 0.25s ease-out both;\n}\n ".trim(),document.head.appendChild(e)}();const k=s(null),[v,w]=a(0),[S,$]=a(!1),[M,z]=a(/* @__PURE__ */new Set),N=s([]),W=r(()=>d.slice(-u),[d,u]),I="number"==typeof f?f:400,L=64*W.length;i(()=>{const e=new Set(N.current.map(e=>e.id)),t=W.filter(t=>!e.has(t.id)).map(e=>e.id);if(t.length>0){z(e=>{const n=new Set(e);return t.forEach(e=>n.add(e)),n});const e=window.setTimeout(()=>{z(e=>{const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},400);return()=>clearTimeout(e)}},[W]),i(()=>{N.current=W},[W]);const C=h&&!(y&&S);i(()=>{if(!C||!k.current)return;const e=k.current;(e.scrollHeight-e.scrollTop-e.clientHeight<192||W.length<=5)&&(e.scrollTop=e.scrollHeight)},[W.length,C]);const T=o(()=>{k.current&&w(k.current.scrollTop)},[]),j=Math.max(0,Math.floor(v/64)-5),E=Math.min(W.length-1,Math.ceil((v+I)/64)+5),R={position:"relative",overflow:"auto",height:"number"==typeof f?`${f}px`:f,background:b.bg,border:`1px solid ${b.border}`,borderRadius:8,boxSizing:"border-box"},B={position:"relative",height:L,minHeight:"100%"};if(0===W.length)return n("div",{style:{...R,display:"flex",alignItems:"center",justifyContent:"center"}},n("span",{style:{color:b.textMuted,fontSize:14}},t(g)));const F=[];for(let e=j;e<=E;e++){const t=W[e];t&&F.push(n(c,{key:t.id,item:t,isNew:M.has(t.id),showTimestamps:m,onItemClick:p,renderItem:x,theme:b,style:{position:"absolute",top:64*e,left:0,right:0}}))}return n("div",{ref:k,style:R,onScroll:T,onMouseEnter:y?()=>$(!0):void 0,onMouseLeave:y?()=>$(!1):void 0,"aria-label":"Live feed",role:"feed"},n("div",{style:B},...F))}var u=!1;function f(e,t){if("string"==typeof e)return e;const n=e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Number.isInteger(e)?e:e.toFixed(2));return t?`${n}${t}`:n}function h({data:e,color:t}){if(e.length<2)return null;const o=Math.min(...e),i=Math.max(...e)-o||1,r=e.map((t,n)=>{const r=n/(e.length-1)*80,s=24-(t-o)/i*22-1;return`${r.toFixed(1)},${s.toFixed(1)}`});return n("svg",{width:80,height:24,viewBox:"0 0 80 24","aria-hidden":"true"},n("polyline",{points:r.join(" "),fill:"none",stroke:t,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}))}function m({trend:e,theme:t}){return"up"===e?n("span",{style:{color:t.success,fontSize:14,fontWeight:700}},"▲"):"down"===e?n("span",{style:{color:t.danger,fontSize:14,fontWeight:700}},"▼"):n("span",{style:{color:t.textMuted,fontSize:14}},"→")}function p({metric:e,animate:o,onMetricClick:r,theme:l}){const c=e.color??function(e,t){switch(e){case"warning":return t.warning;case"critical":return t.danger;default:return t.primary}}(e.status,l),d="number"==typeof e.value?e.value:NaN,u=function(e,t,n){const[o,r]=a(e),l=s(e),c=s(null),d=s(null),u=function(){const[e,t]=a(()=>"undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return i(()=>{if("undefined"==typeof window)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}();return i(()=>{if(!n||u)return r(e),void(l.current=e);const t=l.current;if(t===e)return;c.current=null;const o=n=>{null===c.current&&(c.current=n);const i=n-c.current,s=Math.min(i/600,1),a=1-Math.pow(1-s,3);r(t+(e-t)*a),s<1?d.current=requestAnimationFrame(o):l.current=e};return d.current=requestAnimationFrame(o),()=>{null!==d.current&&cancelAnimationFrame(d.current)}},[e,600,n,u]),o}(isNaN(d)?0:d,0,o&&!isNaN(d)),[p,g]=a(!1),y=s(e.value);i(()=>{if(y.current!==e.value){y.current=e.value,g(!0);const t=window.setTimeout(()=>g(!1),700);return()=>clearTimeout(t)}},[e.value]);const x=void 0!==e.previousValue&&e.previousValue!==d,b={background:l.surface,border:`1px solid ${l.border}`,borderLeft:`4px solid ${c}`,borderRadius:8,padding:"14px 16px",cursor:r?"pointer":"default",position:"relative",overflow:"hidden",boxSizing:"border-box"},k=p?{position:"absolute",inset:0,background:`linear-gradient(90deg, transparent 0%, ${c}22 50%, transparent 100%)`,backgroundSize:"200% 100%",animation:"tkx-metric-shimmer 0.6s ease-in-out",pointerEvents:"none"}:{},v=isNaN(d)?t(String(e.value)):f(u,e.unit);return n("div",{style:b,className:p?"tkx-metric-shimmer":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0},p&&n("div",{style:k}),n("div",{style:{fontSize:12,color:l.textMuted,marginBottom:6,fontWeight:500,letterSpacing:"0.03em"}},t(e.label)),n("div",{style:{display:"flex",alignItems:"flex-end",gap:6,marginBottom:6}},n("span",{style:{fontSize:28,fontWeight:700,color:l.text,lineHeight:1}},v),e.unit&&isNaN(d)&&n("span",{style:{fontSize:14,color:l.textMuted,marginBottom:2}},t(e.unit))),(e.trend||e.trendValue)&&n("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:e.sparkline?8:0}},e.trend&&n(m,{trend:e.trend,theme:l}),e.trendValue&&n("span",{style:{fontSize:12,color:l.textMuted}},t(e.trendValue))),x&&n("div",{style:{fontSize:11,color:l.textMuted,marginTop:2}},`was ${f(e.previousValue)}`),e.sparkline&&e.sparkline.length>=2&&n("div",{style:{marginTop:8}},n(h,{data:e.sparkline,color:c})))}function g({metrics:t,columns:o=3,animate:i=!0,onMetricClick:r}){const s=e();return function(){if(u||"undefined"==typeof document)return;u=!0;const e=document.createElement("style");e.id="tkx-live-metrics-styles",e.textContent="\n@keyframes tkx-metric-pulse {\n 0% { opacity: 1; }\n 40% { opacity: 0.4; }\n 100% { opacity: 1; }\n}\n@keyframes tkx-metric-shimmer {\n 0% { background-position: -200% 0; }\n 100% { background-position: 200% 0; }\n}\n.tkx-metric-shimmer {\n animation: tkx-metric-shimmer 0.6s ease-in-out;\n}\n@media (prefers-reduced-motion: reduce) {\n .tkx-metric-shimmer { animation: none; }\n .tkx-metric-pulse { animation: none; }\n}\n ".trim(),document.head.appendChild(e)}(),n("div",{style:{display:"grid",gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`,gap:16}},...t.map(e=>n(p,{key:e.id,metric:e,animate:i,onMetricClick:r,theme:s})))}function y(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}`}function x(e){return Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(2)}function b({data:l,maxPoints:c=60,height:d=200,width:u="100%",color:f,fill:h=!0,showGrid:m=!0,showLabels:p=!0,showTooltip:g=!0,label:b,unit:k,animate:v=!0,yMin:w,yMax:S}){const $=e(),M=f??$.primary,z=s(null),[N,W]=a(600),[I,L]=a(null),[C,T]=a(0),j=s(l.length);i(()=>{if(!z.current)return;const e=new ResizeObserver(e=>{const t=e[0];t&&W(t.contentRect.width)});return e.observe(z.current),W(z.current.offsetWidth),()=>e.disconnect()},[]);const E=r(()=>l.slice(-c),[l,c]);i(()=>{E.length>j.current&&T(e=>e+1),j.current=E.length},[E.length]);const R=p?48:12,B=b?28:12,F=Math.max(N-R-12,1),O=Math.max(d-B-28,1),D=E.length?Math.min(...E.map(e=>e.value)):0,A=E.length?Math.max(...E.map(e=>e.value)):1,H=A-D||1,P=void 0!==w?w:D-.1*H,Q=(void 0!==S?S:A+.1*H)-P||1;function q(e){return E.length<2?F/2:e/(E.length-1)*F}function K(e){return O-(e-P)/Q*O}const Y=E.length>=2?E.map((e,t)=>`${0===t?"M":"L"}${q(t).toFixed(2)},${K(e.value).toFixed(2)}`).join(" "):"",G=Y?`${Y} L${q(E.length-1).toFixed(2)},${O} L${q(0).toFixed(2)},${O} Z`:"",J=[];for(let e=0;e<=4;e++)J.push(e);const Z=J.map(e=>{const t=P+e/4*Q;return{y:K(t),text:x(t)}}),U=Math.min(4,E.length),V=U>0?Array.from({length:U},(e,t)=>Math.round(t/Math.max(U-1,1)*(E.length-1))):[],X=o(e=>{if(!g||0===E.length)return;const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-R;let o=0,i=1/0;E.forEach((e,t)=>{const r=Math.abs(q(t)-n);r<i&&(i=r,o=t)});const r=E[o];r&&L({x:q(o)+R,y:K(r.value)+B,point:r})},[E,g,R,B]),_=o(()=>L(null),[]),ee=N,te=d,ne=`tkx-chart-clip-${C}`;return n("div",{ref:z,style:{position:"relative",width:"number"==typeof u?`${u}px`:u,background:$.surface,border:`1px solid ${$.border}`,borderRadius:8,overflow:"hidden",boxSizing:"border-box"}},n("svg",{width:ee,height:te,viewBox:`0 0 ${ee} ${te}`,onMouseMove:X,onMouseLeave:_,style:{display:"block",userSelect:"none"},"aria-label":b?t(b):"Real-time chart"},v&&E.length>=2&&n("defs",null,n("clipPath",{id:ne},n("rect",{x:0,y:0,width:F,height:te},n("animate",{attributeName:"width",from:Math.max(0,F-F/Math.max(E.length-1,1)),to:F,dur:"0.3s",fill:"freeze"})))),b&&n("text",{x:R,y:18,fill:$.textMuted,fontSize:12,fontWeight:500},t(b)),m&&J.map(e=>{const t=K(P+e/4*Q)+B;return n("line",{key:`grid-${e}`,x1:R,y1:t,x2:R+F,y2:t,stroke:$.border,strokeWidth:1,strokeDasharray:"4 4"})}),p&&Z.map((e,t)=>n("text",{key:`yl-${t}`,x:R-4,y:e.y+B+4,fill:$.textMuted,fontSize:10,textAnchor:"end"},e.text)),k&&n("text",{x:4,y:B+10,fill:$.textMuted,fontSize:9},t(k)),h&&G&&n("path",{d:G,fill:`${M}22`,clipPath:v?`url(#${ne})`:void 0,transform:`translate(${R}, ${B})`}),Y&&n("path",{d:Y,fill:"none",stroke:M,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",clipPath:v?`url(#${ne})`:void 0,transform:`translate(${R}, ${B})`}),V.map(e=>{const t=E[e];return t?n("text",{key:`xl-${e}`,x:R+q(e),y:te-8,fill:$.textMuted,fontSize:9,textAnchor:"middle"},y(t.timestamp)):null}),I&&n("line",{x1:I.x,y1:B,x2:I.x,y2:B+O,stroke:M,strokeWidth:1,strokeDasharray:"3 3",opacity:.6}),I&&n("circle",{cx:I.x,cy:I.y,r:4,fill:M,stroke:$.surface,strokeWidth:2}),I&&(()=>{const e=Math.min(I.x+8,ee-100),t=Math.max(I.y-36,4),o=`${x(I.point.value)}${k||""}`,i=y(I.point.timestamp);return n("g",null,n("rect",{x:e-4,y:t-2,width:90,height:34,rx:4,fill:$.surfaceAlt,stroke:$.border,strokeWidth:1}),n("text",{x:e,y:t+11,fill:$.text,fontSize:12,fontWeight:700},o),n("text",{x:e,y:t+26,fill:$.textMuted,fontSize:10},i))})()))}var k={debug:0,info:1,warn:2,error:3,fatal:4},v=!1;function w({entry:e,showLevel:o,showTimestamp:i,showSource:r,searchQuery:s,monospace:a,isExpanded:l,onToggle:c,onEntryClick:d,theme:u,style:f}){const h=function(e,t){switch(e){case"debug":default:return t.textMuted;case"info":return t.info;case"warn":return t.warning;case"error":case"fatal":return t.danger}}(e.level,u),m=function(e,t){return"fatal"===e?`${t.danger}22`:"transparent"}(e.level,u),p=e.metadata&&Object.keys(e.metadata).length>0,g={...f,display:"flex",alignItems:"center",gap:6,padding:"0 10px",fontSize:12,fontFamily:a?'"JetBrains Mono", "Fira Mono", Consolas, monospace':"inherit",cursor:p||d?"pointer":"default",background:m,boxSizing:"border-box",height:28,overflow:"hidden",whiteSpace:"nowrap",borderBottom:`1px solid ${u.border}22`};return n("div",{style:g,className:"tkx-log-row",onClick:()=>{p&&c(),d&&d(e)},role:p?"button":void 0,tabIndex:p?0:void 0,onKeyDown:p?e=>{"Enter"!==e.key&&" "!==e.key||c()}:void 0,"aria-expanded":p?l:void 0},i&&n("span",{style:{color:u.textMuted,flexShrink:0,minWidth:84}},function(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}(e.timestamp)),o&&n("span",{style:{color:h,flexShrink:0,fontWeight:"fatal"===e.level?700:500,minWidth:56}},`[${e.level.toUpperCase().padEnd(5)}]`),r&&e.source&&n("span",{style:{background:u.surfaceAlt,border:`1px solid ${u.border}`,borderRadius:10,padding:"0 5px",fontSize:10,color:u.textMuted,flexShrink:0,maxWidth:80,overflow:"hidden",textOverflow:"ellipsis"}},t(e.source)),n("span",{style:{flex:1,color:u.text,overflow:"hidden",textOverflow:"ellipsis"}},...function(e,o){if(!o)return[e];const i=t(e),r=t(o);if(!r)return[i];try{const e=new RegExp(`(${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return i.split(e).map((t,o)=>e.test(t)?n("mark",{key:o,className:"tkx-log-highlight"},t):t)}catch{return[i]}}(e.message,s)),p&&n("span",{style:{color:u.textMuted,fontSize:10,flexShrink:0}},l?"▲":"▼"))}function S({metadata:e,theme:o,style:i}){return n("div",{style:{...i,background:o.surfaceAlt,borderBottom:`1px solid ${o.border}`,padding:"6px 10px 6px 56px",display:"flex",flexWrap:"wrap",gap:6,boxSizing:"border-box"}},...Object.entries(e).map(([e,i])=>n("span",{key:e,style:{fontSize:11,fontFamily:"monospace",color:o.textMuted,background:o.surface,border:`1px solid ${o.border}`,borderRadius:4,padding:"1px 6px"}},n("span",{style:{color:o.info}},`${t(e)}: `),t(String(i)))))}function $({entries:t,maxEntries:l=500,height:c=400,autoScroll:d=!0,showLevel:u=!0,showTimestamp:f=!0,showSource:h=!0,filterLevel:m,searchQuery:p="",monospace:g=!0,onEntryClick:y}){const x=e();!function(){if(v||"undefined"==typeof document)return;v=!0;const e=document.createElement("style");e.id="tkx-live-log-styles",e.textContent="\n.tkx-log-row:hover { filter: brightness(1.12); }\n.tkx-log-highlight { background: #ffbe0b55; border-radius: 2px; padding: 0 1px; }\n ".trim(),document.head.appendChild(e)}();const b=s(null),[$,M]=a(0),[z,N]=a(/* @__PURE__ */new Set),[W,I]=a(!1),L=s(t.length),C=r(()=>{let e=t.slice(-l);if(void 0!==m){const t=k[m];e=e.filter(e=>k[e.level]>=t)}if(p){const t=p.toLowerCase();e=e.filter(e=>e.message.toLowerCase().includes(t)||(e.source??"").toLowerCase().includes(t))}return e},[t,l,m,p]),T="number"==typeof c?c:400,j=r(()=>{const e=[];let t=0;for(const n of C)e.push(t),t+=28+(z.has(n.id)?40:0);return e.push(t),e},[C,z]),E=j[j.length-1]??0;i(()=>{d&&!W&&C.length!==L.current&&(L.current=C.length,b.current&&(b.current.scrollTop=b.current.scrollHeight))},[C.length,d,W]);const R=o(()=>{if(!b.current)return;const e=b.current;I(!(e.scrollHeight-e.scrollTop-e.clientHeight<56)),M(e.scrollTop)},[]),B=o(e=>{N(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),F=C.length>0?function(e){let t=0,n=C.length-1;for(;t<n;){const o=t+n>>1;(j[o+1]??0)<=e?t=o+1:n=o}return Math.max(0,t-8)}($):0,O=C.length>0?function(e){let t=0,n=C.length-1;for(;t<n;){const o=t+n+1>>1;(j[o]??0)>=e+T?n=o-1:t=o}return Math.min(C.length-1,t+8)}($):-1,D={position:"relative",overflow:"auto",height:"number"==typeof c?`${c}px`:c,background:x.bg,border:`1px solid ${x.border}`,borderRadius:8,boxSizing:"border-box"},A={position:"relative",height:E,minHeight:"100%"};if(0===C.length)return n("div",{style:{...D,display:"flex",alignItems:"center",justifyContent:"center"}},n("span",{style:{color:x.textMuted,fontSize:13,fontFamily:"monospace"}},"No log entries."));const H=[];for(let e=F;e<=O;e++){const t=C[e];if(!t)continue;const o=j[e]??0,i=z.has(t.id);H.push(n(w,{key:t.id,entry:t,showLevel:u,showTimestamp:f,showSource:h,searchQuery:p,monospace:g,isExpanded:i,onToggle:()=>B(t.id),onEntryClick:y,theme:x,style:{position:"absolute",top:o,left:0,right:0}})),i&&t.metadata&&Object.keys(t.metadata).length>0&&H.push(n(S,{key:`${t.id}-meta`,metadata:t.metadata,theme:x,style:{position:"absolute",top:o+28,left:0,right:0,height:40}}))}return n("div",{ref:b,style:D,onScroll:R,role:"log","aria-live":"polite","aria-label":"Log viewer"},n("div",{style:A},...H))}export{d as TkxLiveFeed,$ as TkxLiveLog,g as TkxLiveMetrics,b as TkxRealTimeChart};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
export declare function isValidAadhaar(input: string): boolean;
|
|
3
|
+
export interface AadhaarChangePayload {
|
|
4
|
+
raw: string;
|
|
5
|
+
digits: string;
|
|
6
|
+
display: string;
|
|
7
|
+
valid: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface TkxAadhaarInputProps {
|
|
10
|
+
value?: string;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
onChange?: (payload: AadhaarChangePayload) => void;
|
|
13
|
+
label?: string;
|
|
14
|
+
mask?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
id?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
export declare const TkxAadhaarInput: import("react").ForwardRefExoticComponent<TkxAadhaarInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
export interface AddressValue {
|
|
3
|
+
pin: string;
|
|
4
|
+
postOffice?: string;
|
|
5
|
+
city?: string;
|
|
6
|
+
state?: string;
|
|
7
|
+
country?: string;
|
|
8
|
+
line1?: string;
|
|
9
|
+
line2?: string;
|
|
10
|
+
}
|
|
11
|
+
interface PostOffice {
|
|
12
|
+
Name: string;
|
|
13
|
+
District: string;
|
|
14
|
+
State: string;
|
|
15
|
+
Country: string;
|
|
16
|
+
Pincode: string;
|
|
17
|
+
}
|
|
18
|
+
interface PinLookupFn {
|
|
19
|
+
(pin: string, signal?: AbortSignal): Promise<PostOffice[]>;
|
|
20
|
+
}
|
|
21
|
+
export interface TkxAddressInputProps {
|
|
22
|
+
value: Partial<AddressValue>;
|
|
23
|
+
onChange: (value: AddressValue) => void;
|
|
24
|
+
lookup?: PinLookupFn;
|
|
25
|
+
label?: string;
|
|
26
|
+
showAddressLines?: boolean;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
}
|
|
31
|
+
export declare const TkxAddressInput: import("react").ForwardRefExoticComponent<TkxAddressInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
export type LunarCalendar = 'gregorian' | 'hindu' | 'hijri' | 'hebrew' | 'buddhist';
|
|
3
|
+
export interface LunarDate {
|
|
4
|
+
gregorian: Date;
|
|
5
|
+
display: string;
|
|
6
|
+
tithi?: number;
|
|
7
|
+
nakshatra?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface TkxCalendarLunarProps {
|
|
10
|
+
value: Date | null;
|
|
11
|
+
onChange: (value: LunarDate) => void;
|
|
12
|
+
calendar?: LunarCalendar;
|
|
13
|
+
locale?: string;
|
|
14
|
+
tithiResolver?: (gregorian: Date) => {
|
|
15
|
+
tithi: number;
|
|
16
|
+
nakshatra: number;
|
|
17
|
+
};
|
|
18
|
+
label?: string;
|
|
19
|
+
minDate?: Date;
|
|
20
|
+
maxDate?: Date;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
className?: string;
|
|
23
|
+
style?: CSSProperties;
|
|
24
|
+
}
|
|
25
|
+
export declare const TkxCalendarLunar: import("react").ForwardRefExoticComponent<TkxCalendarLunarProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type CaptchaProvider = 'turnstile' | 'hcaptcha' | 'recaptcha';
|
|
2
|
+
export type CaptchaTheme = 'light' | 'dark' | 'auto';
|
|
3
|
+
export type CaptchaSize = 'normal' | 'compact' | 'invisible' | 'flexible';
|
|
4
|
+
export interface TkxCaptchaProps {
|
|
5
|
+
provider?: CaptchaProvider;
|
|
6
|
+
sitekey: string;
|
|
7
|
+
theme?: CaptchaTheme;
|
|
8
|
+
size?: CaptchaSize;
|
|
9
|
+
language?: string;
|
|
10
|
+
execution?: 'render' | 'execute' | 'managed';
|
|
11
|
+
onVerify: (token: string) => void;
|
|
12
|
+
onExpire?: () => void;
|
|
13
|
+
onError?: (errorCode: string) => void;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
testMode?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface TkxCaptchaHandle {
|
|
19
|
+
reset: () => void;
|
|
20
|
+
execute: () => void;
|
|
21
|
+
getResponse: () => string | null;
|
|
22
|
+
}
|
|
23
|
+
export declare const TkxCaptcha: import("react").ForwardRefExoticComponent<TkxCaptchaProps & import("react").RefAttributes<TkxCaptchaHandle>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
import { type AddressValue } from './TkxAddressInput';
|
|
3
|
+
import { type PaymentConfig, type PaymentSuccessResult } from './TkxPaymentButton';
|
|
4
|
+
export interface CheckoutLineItem {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
quantity: number;
|
|
8
|
+
unitPrice: number;
|
|
9
|
+
}
|
|
10
|
+
export interface TkxCheckoutProps {
|
|
11
|
+
items: CheckoutLineItem[];
|
|
12
|
+
currency: string;
|
|
13
|
+
locale?: string;
|
|
14
|
+
taxRate?: number;
|
|
15
|
+
shipping?: number;
|
|
16
|
+
paymentConfigFor: (address: AddressValue) => Promise<PaymentConfig> | PaymentConfig;
|
|
17
|
+
onComplete: (result: {
|
|
18
|
+
address: AddressValue;
|
|
19
|
+
payment: PaymentSuccessResult;
|
|
20
|
+
}) => void;
|
|
21
|
+
onCancel?: () => void;
|
|
22
|
+
initialAddress?: Partial<AddressValue>;
|
|
23
|
+
className?: string;
|
|
24
|
+
style?: CSSProperties;
|
|
25
|
+
}
|
|
26
|
+
export declare const TkxCheckout: import("react").ForwardRefExoticComponent<TkxCheckoutProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
export interface TkxConfettiProps {
|
|
3
|
+
trigger?: unknown;
|
|
4
|
+
particleCount?: number;
|
|
5
|
+
spread?: number;
|
|
6
|
+
origin?: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
colors?: string[];
|
|
11
|
+
zIndex?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
}
|
|
15
|
+
export interface TkxConfettiHandle {
|
|
16
|
+
fire: (origin?: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const TkxConfetti: import("react").ForwardRefExoticComponent<TkxConfettiProps & import("react").RefAttributes<TkxConfettiHandle>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
export type CurrencyCode = 'INR' | 'USD' | 'EUR' | 'GBP' | 'JPY' | 'CNY' | 'AUD' | 'CAD' | 'CHF' | 'SGD' | 'HKD' | 'AED' | 'SAR' | 'BRL' | 'MXN' | 'KRW' | 'PKR' | 'BDT' | 'LKR' | 'NPR';
|
|
3
|
+
export interface TkxCurrencyInputProps {
|
|
4
|
+
value: number | null;
|
|
5
|
+
onChange: (value: number | null) => void;
|
|
6
|
+
currency?: CurrencyCode;
|
|
7
|
+
locale?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
precision?: number;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
showSymbol?: boolean;
|
|
15
|
+
id?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: CSSProperties;
|
|
19
|
+
}
|
|
20
|
+
export declare const TkxCurrencyInput: import("react").ForwardRefExoticComponent<TkxCurrencyInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type FontScript = 'latin' | 'latin-ext' | 'devanagari' | 'tamil' | 'telugu' | 'kannada' | 'malayalam' | 'bengali' | 'gujarati' | 'gurmukhi' | 'oriya' | 'sinhala' | 'arabic' | 'hebrew' | 'thai' | 'vietnamese' | 'cyrillic' | 'cyrillic-ext' | 'greek' | 'greek-ext' | 'jp' | 'kr' | 'sc' | 'tc';
|
|
3
|
+
export interface TkxFontProviderProps {
|
|
4
|
+
scripts?: FontScript[];
|
|
5
|
+
language?: string;
|
|
6
|
+
preconnect?: boolean;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function scriptsForLanguage(language: string): FontScript[];
|
|
10
|
+
export declare function TkxFontProvider({ scripts, language, preconnect, children, }: TkxFontProviderProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export declare function loadFontScript(script: FontScript): void;
|
|
12
|
+
export declare function unloadFontScript(script: FontScript): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
export type AspectRatio = 'free' | '1:1' | '3:4' | '4:5' | '16:9' | '4:3' | '3:2';
|
|
3
|
+
export interface ImageEditResult {
|
|
4
|
+
blob: Blob;
|
|
5
|
+
file: File;
|
|
6
|
+
url: string;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
export interface TkxImageEditorProps {
|
|
11
|
+
src?: string;
|
|
12
|
+
aspectRatio?: AspectRatio;
|
|
13
|
+
ratios?: AspectRatio[];
|
|
14
|
+
mimeType?: 'image/png' | 'image/jpeg' | 'image/webp';
|
|
15
|
+
quality?: number;
|
|
16
|
+
maxOutputSize?: number;
|
|
17
|
+
outputFilename?: string;
|
|
18
|
+
onChange?: (state: {
|
|
19
|
+
rotation: number;
|
|
20
|
+
brightness: number;
|
|
21
|
+
contrast: number;
|
|
22
|
+
}) => void;
|
|
23
|
+
onResult?: (result: ImageEditResult) => void;
|
|
24
|
+
onCancel?: () => void;
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
labels?: Partial<{
|
|
28
|
+
drop: string;
|
|
29
|
+
browse: string;
|
|
30
|
+
rotate: string;
|
|
31
|
+
apply: string;
|
|
32
|
+
cancel: string;
|
|
33
|
+
brightness: string;
|
|
34
|
+
contrast: string;
|
|
35
|
+
aspect: string;
|
|
36
|
+
free: string;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
export interface TkxImageEditorHandle {
|
|
40
|
+
getResult: () => Promise<ImageEditResult | null>;
|
|
41
|
+
reset: () => void;
|
|
42
|
+
loadSource: (src: string) => void;
|
|
43
|
+
}
|
|
44
|
+
export declare const TkxImageEditor: import("react").ForwardRefExoticComponent<TkxImageEditorProps & import("react").RefAttributes<TkxImageEditorHandle>>;
|
|
@@ -8,5 +8,6 @@ export interface TkxInputProps extends Omit<InputHTMLAttributes<HTMLInputElement
|
|
|
8
8
|
rightAddon?: ReactNode;
|
|
9
9
|
isInvalid?: boolean;
|
|
10
10
|
isRequired?: boolean;
|
|
11
|
+
unicodeSafe?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export declare const TkxInput: import("react").ForwardRefExoticComponent<TkxInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
export declare function isValidPan(input: string): boolean;
|
|
3
|
+
export interface PanChangePayload {
|
|
4
|
+
raw: string;
|
|
5
|
+
normalised: string;
|
|
6
|
+
valid: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface TkxPanInputProps {
|
|
9
|
+
value?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
onChange?: (payload: PanChangePayload) => void;
|
|
12
|
+
label?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
id?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: CSSProperties;
|
|
19
|
+
}
|
|
20
|
+
export declare const TkxPanInput: import("react").ForwardRefExoticComponent<TkxPanInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
21
|
+
export declare function isValidVoterId(input: string): boolean;
|
|
22
|
+
export interface VoterIdChangePayload {
|
|
23
|
+
raw: string;
|
|
24
|
+
normalised: string;
|
|
25
|
+
valid: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TkxVoterIdInputProps {
|
|
28
|
+
value?: string;
|
|
29
|
+
defaultValue?: string;
|
|
30
|
+
onChange?: (payload: VoterIdChangePayload) => void;
|
|
31
|
+
label?: string;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
required?: boolean;
|
|
34
|
+
id?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
style?: CSSProperties;
|
|
38
|
+
}
|
|
39
|
+
export declare const TkxVoterIdInput: import("react").ForwardRefExoticComponent<TkxVoterIdInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
40
|
+
export declare function isValidDrivingLicence(input: string): boolean;
|
|
41
|
+
export interface DrivingLicenceChangePayload {
|
|
42
|
+
raw: string;
|
|
43
|
+
normalised: string;
|
|
44
|
+
pretty: string;
|
|
45
|
+
valid: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface TkxDrivingLicenceInputProps {
|
|
48
|
+
value?: string;
|
|
49
|
+
defaultValue?: string;
|
|
50
|
+
onChange?: (payload: DrivingLicenceChangePayload) => void;
|
|
51
|
+
label?: string;
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
required?: boolean;
|
|
54
|
+
id?: string;
|
|
55
|
+
name?: string;
|
|
56
|
+
className?: string;
|
|
57
|
+
style?: CSSProperties;
|
|
58
|
+
}
|
|
59
|
+
export declare const TkxDrivingLicenceInput: import("react").ForwardRefExoticComponent<TkxDrivingLicenceInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -14,10 +14,11 @@ export interface TkxOTPProps {
|
|
|
14
14
|
size?: 'sm' | 'md' | 'lg';
|
|
15
15
|
separator?: ReactNode;
|
|
16
16
|
separatorPosition?: number;
|
|
17
|
+
webOTP?: boolean;
|
|
17
18
|
className?: string;
|
|
18
19
|
style?: CSSProperties;
|
|
19
20
|
}
|
|
20
|
-
export declare function TkxOTP({ length, value, onChange, onComplete, type, mask, autoFocus, isDisabled, isInvalid, errorMessage, hint, size, separator, separatorPosition, className, style, }: TkxOTPProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function TkxOTP({ length, value, onChange, onComplete, type, mask, autoFocus, isDisabled, isInvalid, errorMessage, hint, size, separator, separatorPosition, webOTP, className, style, }: TkxOTPProps): import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
export declare namespace TkxOTP {
|
|
22
23
|
var displayName: string;
|
|
23
24
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
export interface OrgNode {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
subLabel?: string;
|
|
6
|
+
badge?: string;
|
|
7
|
+
avatar?: string;
|
|
8
|
+
accent?: string;
|
|
9
|
+
children?: OrgNode[];
|
|
10
|
+
meta?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export interface TkxOrgChartProps {
|
|
13
|
+
data: OrgNode;
|
|
14
|
+
direction?: 'vertical' | 'horizontal';
|
|
15
|
+
interactive?: boolean;
|
|
16
|
+
initialZoom?: number;
|
|
17
|
+
nodeWidth?: number;
|
|
18
|
+
nodeHeight?: number;
|
|
19
|
+
siblingGap?: number;
|
|
20
|
+
levelGap?: number;
|
|
21
|
+
onNodeClick?: (node: OrgNode) => void;
|
|
22
|
+
renderNode?: (node: OrgNode, isActive: boolean) => ReactNode;
|
|
23
|
+
collapsedByDefault?: boolean;
|
|
24
|
+
height?: number | string;
|
|
25
|
+
ariaLabel?: string;
|
|
26
|
+
className?: string;
|
|
27
|
+
style?: CSSProperties;
|
|
28
|
+
}
|
|
29
|
+
export declare function TkxOrgChart({ data, direction, interactive, initialZoom, nodeWidth, nodeHeight, siblingGap, levelGap, onNodeClick, renderNode, collapsedByDefault, height, ariaLabel, className, style, }: TkxOrgChartProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare namespace TkxOrgChart {
|
|
31
|
+
var displayName: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
export type PaymentProvider = 'razorpay' | 'stripe' | 'square';
|
|
3
|
+
export interface PaymentSuccessResult {
|
|
4
|
+
provider: PaymentProvider;
|
|
5
|
+
paymentId: string;
|
|
6
|
+
orderId?: string;
|
|
7
|
+
signature?: string;
|
|
8
|
+
raw: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface PaymentFailureResult {
|
|
11
|
+
provider: PaymentProvider;
|
|
12
|
+
code: string;
|
|
13
|
+
message: string;
|
|
14
|
+
raw: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface RazorpayConfig {
|
|
17
|
+
provider: 'razorpay';
|
|
18
|
+
publicKey: string;
|
|
19
|
+
orderId: string;
|
|
20
|
+
amount: number;
|
|
21
|
+
currency: string;
|
|
22
|
+
prefill?: {
|
|
23
|
+
name?: string;
|
|
24
|
+
email?: string;
|
|
25
|
+
contact?: string;
|
|
26
|
+
};
|
|
27
|
+
notes?: Record<string, string>;
|
|
28
|
+
brand?: {
|
|
29
|
+
name?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
image?: string;
|
|
32
|
+
};
|
|
33
|
+
themeColor?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface StripeConfig {
|
|
36
|
+
provider: 'stripe';
|
|
37
|
+
publicKey: string;
|
|
38
|
+
sessionId: string;
|
|
39
|
+
}
|
|
40
|
+
export interface SquareConfig {
|
|
41
|
+
provider: 'square';
|
|
42
|
+
applicationId: string;
|
|
43
|
+
locationId: string;
|
|
44
|
+
orderId: string;
|
|
45
|
+
amount: number;
|
|
46
|
+
currency: string;
|
|
47
|
+
}
|
|
48
|
+
export type PaymentConfig = RazorpayConfig | StripeConfig | SquareConfig;
|
|
49
|
+
export interface TkxPaymentButtonProps {
|
|
50
|
+
config: PaymentConfig;
|
|
51
|
+
onSuccess: (result: PaymentSuccessResult) => void;
|
|
52
|
+
onFailure?: (result: PaymentFailureResult) => void;
|
|
53
|
+
onDismiss?: () => void;
|
|
54
|
+
children?: ReactNode;
|
|
55
|
+
variant?: 'primary' | 'outline';
|
|
56
|
+
size?: 'sm' | 'md' | 'lg';
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
className?: string;
|
|
59
|
+
style?: CSSProperties;
|
|
60
|
+
}
|
|
61
|
+
export declare const TkxPaymentButton: import("react").ForwardRefExoticComponent<TkxPaymentButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|