@nimblebrain/synapse 0.17.1 → 0.18.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 +7 -5
- package/dist/{chunk-VYR6V47N.js → chunk-3YSXPBEQ.js} +3 -3
- package/dist/{chunk-VYR6V47N.js.map → chunk-3YSXPBEQ.js.map} +1 -1
- package/dist/{chunk-FDMRJZKT.cjs → chunk-FB7GPBEM.cjs} +10 -10
- package/dist/{chunk-FDMRJZKT.cjs.map → chunk-FB7GPBEM.cjs.map} +1 -1
- package/dist/{chunk-UPDBDXQB.js → chunk-HKRTDGXN.js} +5 -2
- package/dist/chunk-HKRTDGXN.js.map +1 -0
- package/dist/{chunk-TXJMGQYF.cjs → chunk-LPWEQCZV.cjs} +5 -2
- package/dist/chunk-LPWEQCZV.cjs.map +1 -0
- package/dist/{chunk-EHLQWCYV.cjs → chunk-VDQZQDU3.cjs} +6 -6
- package/dist/{chunk-EHLQWCYV.cjs.map → chunk-VDQZQDU3.cjs.map} +1 -1
- package/dist/{chunk-SRQNQ26I.js → chunk-ZLASWV4N.js} +3 -3
- package/dist/{chunk-SRQNQ26I.js.map → chunk-ZLASWV4N.js.map} +1 -1
- package/dist/connect.iife.global.js +1 -1
- package/dist/host/index.cjs +14 -14
- package/dist/host/index.js +2 -2
- package/dist/index.cjs +14 -14
- package/dist/index.js +3 -3
- package/dist/react/index.cjs +7 -7
- package/dist/react/index.js +2 -2
- package/dist/synapse-runtime.iife.global.js +1 -1
- package/dist/synapse-ui.iife.global.js +2 -2
- package/dist/ui/index.cjs +313 -87
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +29 -2
- package/dist/ui/index.d.ts +29 -2
- package/dist/ui/index.js +314 -89
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-TXJMGQYF.cjs.map +0 -1
- package/dist/chunk-UPDBDXQB.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(){'use strict';var be=new Set(["auto","block","swap","fallback","optional"]),ke={"--color-background-primary":"#ffffff","--color-background-secondary":"#fafafa","--color-background-tertiary":"#f3f4f6","--color-text-primary":"#111827","--color-text-secondary":"#6b7280","--color-text-tertiary":"#9ca3af","--color-text-accent":"#2563eb","--nb-color-accent-foreground":"#ffffff","--color-border-primary":"#e5e7eb","--color-border-secondary":"#d1d5db","--color-ring-primary":"#2563eb","--nb-color-danger":"#dc2626","--nb-color-success":"#059669","--nb-color-warning":"#f59e0b","--nb-color-processing":"#7c3aed","--nb-color-processing-light":"#f3eeff","--nb-color-info-light":"#eef4ff"},Pe={"--color-background-primary":"#18181b","--color-background-secondary":"#27272a","--color-background-tertiary":"#2f2f34","--color-text-primary":"#fafafa","--color-text-secondary":"#a1a1aa","--color-text-tertiary":"#71717a","--color-text-accent":"#818cf8","--nb-color-accent-foreground":"#ffffff","--color-border-primary":"#3f3f46","--color-border-secondary":"#52525b","--color-ring-primary":"#818cf8","--nb-color-danger":"#f87171","--nb-color-success":"#34d399","--nb-color-warning":"#fbbf24","--nb-color-processing":"#a78bfa","--nb-color-processing-light":"#2a2440","--nb-color-info-light":"#1e2a44"},Ee={light:ke,dark:Pe},Ie="synapse-defaults",G="synapse-theme-defaults",W=new Set;function ve(){return typeof document<"u"&&typeof document.getElementById=="function"&&typeof document.createElement=="function"&&typeof document.head?.prepend=="function"}function we(e){if(!ve())return;let o=Object.entries(Ee[e]).map(([a,p])=>` ${a}: ${p};`).join(`
|
|
1
|
+
(function(){'use strict';var be=new Set(["auto","block","swap","fallback","optional"]),ke={"--color-background-primary":"#ffffff","--color-background-secondary":"#fafafa","--color-background-tertiary":"#f3f4f6","--color-text-primary":"#111827","--color-text-secondary":"#6b7280","--color-text-tertiary":"#9ca3af","--color-text-accent":"#2563eb","--nb-color-accent-foreground":"#ffffff","--color-border-primary":"#e5e7eb","--color-border-secondary":"#d1d5db","--color-ring-primary":"#2563eb","--nb-color-danger":"#dc2626","--nb-color-danger-foreground":"#ffffff","--nb-color-success":"#059669","--nb-color-warning":"#f59e0b","--nb-color-processing":"#7c3aed","--nb-color-processing-light":"#f3eeff","--nb-color-info-light":"#eef4ff"},Pe={"--color-background-primary":"#18181b","--color-background-secondary":"#27272a","--color-background-tertiary":"#2f2f34","--color-text-primary":"#fafafa","--color-text-secondary":"#a1a1aa","--color-text-tertiary":"#71717a","--color-text-accent":"#818cf8","--nb-color-accent-foreground":"#ffffff","--color-border-primary":"#3f3f46","--color-border-secondary":"#52525b","--color-ring-primary":"#818cf8","--nb-color-danger":"#f87171","--nb-color-danger-foreground":"#18181b","--nb-color-success":"#34d399","--nb-color-warning":"#fbbf24","--nb-color-processing":"#a78bfa","--nb-color-processing-light":"#2a2440","--nb-color-info-light":"#1e2a44"},Ee={light:ke,dark:Pe},Ie="synapse-defaults",G="synapse-theme-defaults",W=new Set;function ve(){return typeof document<"u"&&typeof document.getElementById=="function"&&typeof document.createElement=="function"&&typeof document.head?.prepend=="function"}function we(e){if(!ve())return;let o=Object.entries(Ee[e]).map(([a,p])=>` ${a}: ${p};`).join(`
|
|
2
2
|
`),n=`@layer ${Ie} {
|
|
3
3
|
:root {
|
|
4
4
|
${o}
|
|
5
5
|
}
|
|
6
|
-
}`,s=document.getElementById(G);if(s){s.textContent!==n&&(s.textContent=n);return}let i=document.createElement("style");i.id=G,i.textContent=n,document.head.prepend(i);}function Ae(e,o){if(typeof document>"u")return;we(e);let n={};if(o&&typeof o=="object")for(let[i,a]of Object.entries(o))typeof i=="string"&&typeof a=="string"&&(n[i]=a);let s=document.documentElement.style;if(typeof s.removeProperty=="function")for(let i of W)i in n||s.removeProperty(i);for(let[i,a]of Object.entries(n))s.setProperty(i,a);W=new Set(Object.keys(n));}var F=new Set,Y="";function C(e){return Array.isArray(e)?JSON.stringify(e.map(o=>[o.family,o.src,o.weight,o.style,o.display])):""}function M(e){if(!Array.isArray(e))return;let o=e.filter(Oe);if(!(e.length>0&&o.length===0))return o}function Ce(e){let o=M(e);if(o===void 0||typeof document>"u"||!document.fonts||typeof FontFace>"u")return;let n=C(o);if(n!==Y){Y=n;for(let s of F)try{document.fonts.delete(s);}catch{}F.clear();for(let s of o)try{let i=new FontFace(s.family,s.src,{weight:s.weight,style:s.style,display:s.display&&be.has(s.display)?s.display:"swap"});document.fonts.add(i),F.add(i);}catch{}}}function Oe(e){if(!e||typeof e!="object")return false;let o=e;return typeof o.family=="string"&&typeof o.src=="string"}function V(e,o,n){Ae(e,o),Ce(n);}function R(e){typeof document<"u"&&document.documentElement.setAttribute("data-theme",e.mode),V(e.mode,e.tokens,e.fontFaces);}function O(e){try{if(e?.matchMedia?.("(prefers-color-scheme: dark)").matches)return "dark"}catch{}return "light"}function h(e,o){return e==="light"||e==="dark"?e:o}var T=class extends Error{constructor(o,n){super(`"${o}" is not supported by the "${n}" host`),this.name="HostUnsupportedError";}},_="synapse-ui-data",Z="ui-lifecycle-iframe-ready",$="ui-lifecycle-iframe-render-data",B="ui-size-change",q="link",Q="prompt",U="openai:set_globals",X="2026-01-26",J="ui/initialize",ee="ui/notifications/initialized",te="ui/notifications/tool-result",ne="ui/notifications/host-context-changed",oe="ui/notifications/size-changed",re="ui/open-link",se="ui/message",ie="ui/resource-teardown",ae="tools/call";function ce(e,o){let n=()=>e.openai,s=n()?.toolOutput??null,i={mode:h(n()?.theme,"light"),tokens:{}},a=new Set,p=new Set,f=false,m=c=>{if(f)return;let l=c.detail?.globals;if(l){if("toolOutput"in l&&l.toolOutput!=null){s=l.toolOutput;for(let u of a)u(s);}if("theme"in l&&l.theme!=null){let u=h(l.theme,i.mode);if(u!==i.mode){i={mode:u,tokens:{}};for(let b of p)b(i);}}}};return {host:"chatgpt",getData:()=>s,onData(c){return a.add(c),()=>a.delete(c)},getTheme:()=>i,onTheme(c){return p.add(c),()=>p.delete(c)},async callTool(c,l){let u=n()?.callTool;if(!u)throw new T("callTool","chatgpt");return await u(c,l??{})},sendPrompt(c){let l=n();(l?.sendFollowUpMessage??l?.sendFollowupMessage)?.({prompt:c});},openLink(c){let l=n()?.openExternal;l?l({href:c}):e.open(c,"_blank","noopener,noreferrer");},resize(){},capabilities(){let c=n();return {pull:typeof c?.callTool=="function",sendPrompt:typeof c?.sendFollowUpMessage=="function"||typeof c?.sendFollowupMessage=="function",openLink:true}},start(){e.addEventListener(U,m,{passive:true}),s=n()?.toolOutput??s;},destroy(){f||(f=true,e.removeEventListener(U,m),a.clear(),p.clear());}}}function x(e,o){if(!e)return null;let s=e.getElementById(o)?.textContent;if(!s)return null;try{return JSON.parse(s)??null}catch{return null}}function L(e){if(e==null||typeof e!="object")return null;let o=e,n=o.renderData,s=n!=null&&typeof n=="object"?n:o;return s.toolOutput!=null?s.toolOutput:s.structuredContent!=null?s.structuredContent:s}function le(e,o){let n=o.dataElementId??_,s=null,i={mode:O(e),tokens:{}},a=new Set,p=false,f=null,m=c=>{if(p)return;let l=h(c.matches?"dark":"light",i.mode);if(l!==i.mode){i={mode:l,tokens:{}};for(let u of a)u(i);}};return {host:"generic",getData:()=>s,onData(){return ()=>{}},getTheme:()=>i,onTheme(c){return a.add(c),()=>a.delete(c)},async callTool(c){throw new T("callTool","generic")},sendPrompt(){},openLink(c){e.open(c,"_blank","noopener,noreferrer");},resize(){},capabilities(){return {pull:false,sendPrompt:false,openLink:true}},start(){s=x(e.document,n);try{f=e.matchMedia?.("(prefers-color-scheme: dark)")??null,f?.addEventListener?.("change",m);}catch{f=null;}},destroy(){p||(p=true,f?.removeEventListener?.("change",m),f=null,a.clear());}}}var _e="synapse/fontFaces";function xe(e){return M(e?.[_e])}function de(e,o){return xe(o)??e}var De=3e4;function pe(e,o){let n=o.dataElementId??_,s=o.autoResize!==false,i=null,a={mode:O(e),tokens:{}},p=new Set,f=new Set,m=false,c=false,l=1,u=new Map,b=-1,v=null,k=null,H=()=>e.parent??e;function P(t){H().postMessage(t,"*");}function D(t){c||P(t);}function N(t,r){P({jsonrpc:"2.0",method:t,params:r??{}});}function w(t,r){let d=l++;return new Promise((y
|
|
6
|
+
}`,s=document.getElementById(G);if(s){s.textContent!==n&&(s.textContent=n);return}let i=document.createElement("style");i.id=G,i.textContent=n,document.head.prepend(i);}function Ae(e,o){if(typeof document>"u")return;we(e);let n={};if(o&&typeof o=="object")for(let[i,a]of Object.entries(o))typeof i=="string"&&typeof a=="string"&&(n[i]=a);let s=document.documentElement.style;if(typeof s.removeProperty=="function")for(let i of W)i in n||s.removeProperty(i);for(let[i,a]of Object.entries(n))s.setProperty(i,a);W=new Set(Object.keys(n));}var F=new Set,Y="";function C(e){return Array.isArray(e)?JSON.stringify(e.map(o=>[o.family,o.src,o.weight,o.style,o.display])):""}function M(e){if(!Array.isArray(e))return;let o=e.filter(Oe);if(!(e.length>0&&o.length===0))return o}function Ce(e){let o=M(e);if(o===void 0||typeof document>"u"||!document.fonts||typeof FontFace>"u")return;let n=C(o);if(n!==Y){Y=n;for(let s of F)try{document.fonts.delete(s);}catch{}F.clear();for(let s of o)try{let i=new FontFace(s.family,s.src,{weight:s.weight,style:s.style,display:s.display&&be.has(s.display)?s.display:"swap"});document.fonts.add(i),F.add(i);}catch{}}}function Oe(e){if(!e||typeof e!="object")return false;let o=e;return typeof o.family=="string"&&typeof o.src=="string"}function V(e,o,n){Ae(e,o),Ce(n);}function R(e){typeof document<"u"&&document.documentElement.setAttribute("data-theme",e.mode),V(e.mode,e.tokens,e.fontFaces);}function O(e){try{if(e?.matchMedia?.("(prefers-color-scheme: dark)").matches)return "dark"}catch{}return "light"}function h(e,o){return e==="light"||e==="dark"?e:o}var T=class extends Error{constructor(o,n){super(`"${o}" is not supported by the "${n}" host`),this.name="HostUnsupportedError";}},_="synapse-ui-data",Z="ui-lifecycle-iframe-ready",$="ui-lifecycle-iframe-render-data",B="ui-size-change",q="link",Q="prompt",U="openai:set_globals",X="2026-01-26",J="ui/initialize",ee="ui/notifications/initialized",te="ui/notifications/tool-result",ne="ui/notifications/host-context-changed",oe="ui/notifications/size-changed",re="ui/open-link",se="ui/message",ie="ui/resource-teardown",ae="tools/call";function ce(e,o){let n=()=>e.openai,s=n()?.toolOutput??null,i={mode:h(n()?.theme,"light"),tokens:{}},a=new Set,p=new Set,f=false,m=c=>{if(f)return;let l=c.detail?.globals;if(l){if("toolOutput"in l&&l.toolOutput!=null){s=l.toolOutput;for(let u of a)u(s);}if("theme"in l&&l.theme!=null){let u=h(l.theme,i.mode);if(u!==i.mode){i={mode:u,tokens:{}};for(let b of p)b(i);}}}};return {host:"chatgpt",getData:()=>s,onData(c){return a.add(c),()=>a.delete(c)},getTheme:()=>i,onTheme(c){return p.add(c),()=>p.delete(c)},async callTool(c,l){let u=n()?.callTool;if(!u)throw new T("callTool","chatgpt");return await u(c,l??{})},sendPrompt(c){let l=n();(l?.sendFollowUpMessage??l?.sendFollowupMessage)?.({prompt:c});},openLink(c){let l=n()?.openExternal;l?l({href:c}):e.open(c,"_blank","noopener,noreferrer");},resize(){},capabilities(){let c=n();return {pull:typeof c?.callTool=="function",sendPrompt:typeof c?.sendFollowUpMessage=="function"||typeof c?.sendFollowupMessage=="function",openLink:true}},start(){e.addEventListener(U,m,{passive:true}),s=n()?.toolOutput??s;},destroy(){f||(f=true,e.removeEventListener(U,m),a.clear(),p.clear());}}}function x(e,o){if(!e)return null;let s=e.getElementById(o)?.textContent;if(!s)return null;try{return JSON.parse(s)??null}catch{return null}}function L(e){if(e==null||typeof e!="object")return null;let o=e,n=o.renderData,s=n!=null&&typeof n=="object"?n:o;return s.toolOutput!=null?s.toolOutput:s.structuredContent!=null?s.structuredContent:s}function le(e,o){let n=o.dataElementId??_,s=null,i={mode:O(e),tokens:{}},a=new Set,p=false,f=null,m=c=>{if(p)return;let l=h(c.matches?"dark":"light",i.mode);if(l!==i.mode){i={mode:l,tokens:{}};for(let u of a)u(i);}};return {host:"generic",getData:()=>s,onData(){return ()=>{}},getTheme:()=>i,onTheme(c){return a.add(c),()=>a.delete(c)},async callTool(c){throw new T("callTool","generic")},sendPrompt(){},openLink(c){e.open(c,"_blank","noopener,noreferrer");},resize(){},capabilities(){return {pull:false,sendPrompt:false,openLink:true}},start(){s=x(e.document,n);try{f=e.matchMedia?.("(prefers-color-scheme: dark)")??null,f?.addEventListener?.("change",m);}catch{f=null;}},destroy(){p||(p=true,f?.removeEventListener?.("change",m),f=null,a.clear());}}}var _e="synapse/fontFaces";function xe(e){return M(e?.[_e])}function de(e,o){return xe(o)??e}var De=3e4;function pe(e,o){let n=o.dataElementId??_,s=o.autoResize!==false,i=null,a={mode:O(e),tokens:{}},p=new Set,f=new Set,m=false,c=false,l=1,u=new Map,b=-1,v=null,k=null,H=()=>e.parent??e;function P(t){H().postMessage(t,"*");}function D(t){c||P(t);}function N(t,r){P({jsonrpc:"2.0",method:t,params:r??{}});}function w(t,r){let d=l++;return new Promise((g,y)=>{let I=setTimeout(()=>{u.delete(d),y(new Error(`"${t}" timed out`));},De);u.set(d,{resolve:g,reject:y,timer:I}),P({jsonrpc:"2.0",id:d,method:t,params:r??{}});})}function z(t){if(t!=null){i=t;for(let r of p)r(t);}}function S(t){if(!t||typeof t!="object")return;let{mode:r,tokens:d,fontFaces:g}=a,y=false;if(t.theme!=null){let A=h(t.theme,r);A!==r&&(r=A,y=true);}let I=t.styles;I?.variables&&typeof I.variables=="object"&&(d={...d,...I.variables},y=true);let K=de(g,t);if(C(K)!==C(g)&&(g=K,y=true),y){a={mode:r,tokens:d,...g?{fontFaces:g}:{}};for(let A of f)A(a);}}function E(t){if(m)return;let r=typeof t=="number"?t:Math.ceil(e.document.body.scrollHeight);r!==b&&(b=r,N(oe,{height:r}),D({type:B,payload:{height:r}}));}function me(t){let r=Number(t.id),d=u.get(r);if(d)if(u.delete(r),clearTimeout(d.timer),t.error!=null){let g=t.error;d.reject(new Error(g.message??"request failed"));}else d.resolve(t.result);}function ge(t,r){if(t===te){let d=r.structuredContent;z(d??L(r));}else t===ne&&S(r);}function ye(t){t.method===ie&&P({jsonrpc:"2.0",id:t.id,result:{}});}function he(t){if(t.type===$||t.type==="renderData"){let{theme:r,...d}=t.payload??{};r!=null&&S({theme:r}),Object.keys(d).length>0&&z(L(d));}}let j=t=>{if(m||t.source&&t.source!==H())return;let r=t.data;if(!(!r||typeof r!="object")){if(r.jsonrpc!=="2.0"){he(r);return}r.id!=null&&("result"in r||"error"in r)?me(r):typeof r.method=="string"&&(r.id!=null?ye(r):ge(r.method,r.params??{}));}};function Te(){k=()=>E(),e.addEventListener("resize",k),typeof e.ResizeObserver<"u"&&(v=new e.ResizeObserver(()=>E()),v.observe(e.document.body));}return {host:"claude",getData:()=>i,onData(t){return p.add(t),()=>p.delete(t)},getTheme:()=>a,onTheme(t){return f.add(t),()=>f.delete(t)},async callTool(t,r){return await w(ae,{name:t,arguments:r??{}})},sendPrompt(t){w(se,{role:"user",content:[{type:"text",text:t}]}).catch(()=>{}),D({type:Q,payload:{prompt:t}});},openLink(t){w(re,{url:t}).catch(()=>{}),D({type:q,payload:{url:t}});},resize(t){E(t);},capabilities(){return {pull:true,sendPrompt:true,openLink:true}},start(){e.addEventListener("message",j),i=x(e.document,n),s&&Te(),P({type:Z}),w(J,{appInfo:{name:o.name??"synapse-ui",version:o.version??"0.0.0"},appCapabilities:{availableDisplayModes:["inline"]},protocolVersion:X}).then(t=>{m||(c=true,S(t?.hostContext),N(ee,{}),b=-1,E());}).catch(()=>{}),E();},destroy(){if(!m){m=true,e.removeEventListener("message",j),k&&e.removeEventListener("resize",k),k=null,v?.disconnect(),v=null;for(let t of u.values())clearTimeout(t.timer),t.reject(new Error("adapter destroyed"));u.clear(),p.clear(),f.clear();}}}}function Se(e){if(e.openai!=null)return "chatgpt";try{if(e.parent!=null&&e.parent!==e)return "claude"}catch{return "claude"}return "generic"}function Fe(e,o,n){switch(e){case "chatgpt":return ce(o);case "claude":case "nimblebrain":return pe(o,n);default:return le(o,n)}}function ue(e,o){let n=o.host??Se(e);return Fe(n,e,o)}function fe(e={}){let o=e.window??globalThis,n=ue(o,e);R(n.getTheme());let s=n.onTheme(R);n.start();let i=false;return {data:()=>n.getData(),onData:a=>n.onData(a),theme:()=>n.getTheme(),onTheme:a=>n.onTheme(a),callTool:(a,p)=>n.callTool(a,p),sendPrompt:a=>n.sendPrompt(a),openLink:a=>n.openLink(a),resize:a=>n.resize(a),capabilities:()=>n.capabilities(),host:()=>n.host,destroy(){i||(i=true,s(),n.destroy());}}}globalThis.SynapseUI={connect:fe};})();
|
package/dist/ui/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ var tokens = {
|
|
|
22
22
|
ring: "var(--color-ring-primary, #2563eb)",
|
|
23
23
|
// ── Status / brand semantics ──
|
|
24
24
|
danger: "var(--nb-color-danger, #dc2626)",
|
|
25
|
+
dangerFg: "var(--nb-color-danger-foreground, #ffffff)",
|
|
25
26
|
success: "var(--nb-color-success, #059669)",
|
|
26
27
|
warning: "var(--nb-color-warning, #f59e0b)",
|
|
27
28
|
processing: "var(--nb-color-processing, #7c3aed)",
|
|
@@ -294,6 +295,10 @@ function Button({
|
|
|
294
295
|
vars["--nb-btn-bg"] = tokens.accent;
|
|
295
296
|
vars["--nb-btn-bg-hover"] = `color-mix(in oklab, ${tokens.accent} 88%, black)`;
|
|
296
297
|
vars["--nb-btn-fg"] = tokens.accentFg;
|
|
298
|
+
} else if (variant === "danger") {
|
|
299
|
+
vars["--nb-btn-bg"] = tokens.danger;
|
|
300
|
+
vars["--nb-btn-bg-hover"] = `color-mix(in oklab, ${tokens.danger} 88%, black)`;
|
|
301
|
+
vars["--nb-btn-fg"] = tokens.dangerFg;
|
|
297
302
|
} else if (variant === "secondary") {
|
|
298
303
|
vars["--nb-btn-bg"] = tokens.bgSubtle;
|
|
299
304
|
vars["--nb-btn-bg-hover"] = tokens.bgRaised;
|
|
@@ -412,8 +417,283 @@ function Card({
|
|
|
412
417
|
}
|
|
413
418
|
);
|
|
414
419
|
}
|
|
415
|
-
|
|
420
|
+
function inClosedDetails(el) {
|
|
421
|
+
const details = el.closest("details:not([open])");
|
|
422
|
+
if (!details) return false;
|
|
423
|
+
const summary = details.querySelector("summary");
|
|
424
|
+
return !summary || !summary.contains(el);
|
|
425
|
+
}
|
|
426
|
+
var CANDIDATES = "a[href], button, input, select, textarea, summary, [tabindex]";
|
|
427
|
+
function tabbables(panel) {
|
|
428
|
+
return Array.from(panel.querySelectorAll(CANDIDATES)).filter(
|
|
429
|
+
(el) => el.tabIndex >= 0 && !el.matches(":disabled") && !el.closest("[hidden]") && !inClosedDetails(el) && el.type !== "hidden"
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
var openOverlays = [];
|
|
433
|
+
var lockedOverflow = "";
|
|
434
|
+
var handledEscapes = /* @__PURE__ */ new WeakSet();
|
|
435
|
+
function isInnermost(self) {
|
|
436
|
+
const selfAt = openOverlays.indexOf(self);
|
|
437
|
+
return openOverlays.every((other, at) => {
|
|
438
|
+
if (other === self || !other.panel || !self.panel) return true;
|
|
439
|
+
if (self.panel.contains(other.panel)) return false;
|
|
440
|
+
if (other.panel.contains(self.panel)) return true;
|
|
441
|
+
return at < selfAt;
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
function useModal(open, panelRef, { onEscape, initialFocus }) {
|
|
445
|
+
const escapeRef = react.useRef(onEscape);
|
|
446
|
+
escapeRef.current = onEscape;
|
|
447
|
+
const initialFocusRef = react.useRef(initialFocus);
|
|
448
|
+
initialFocusRef.current = initialFocus;
|
|
449
|
+
react.useEffect(() => {
|
|
450
|
+
if (!open) return;
|
|
451
|
+
const panel = panelRef.current;
|
|
452
|
+
const previouslyFocused = document.activeElement;
|
|
453
|
+
const entry = { panel, restoreTo: previouslyFocused };
|
|
454
|
+
const nested = openOverlays.filter((o) => panel && o.panel && panel.contains(o.panel)).at(-1);
|
|
455
|
+
if (nested) {
|
|
456
|
+
entry.restoreTo = nested.restoreTo;
|
|
457
|
+
nested.restoreTo = panel;
|
|
458
|
+
}
|
|
459
|
+
const { body } = document;
|
|
460
|
+
if (openOverlays.length === 0) lockedOverflow = body.style.overflow;
|
|
461
|
+
openOverlays.push(entry);
|
|
462
|
+
const innermost = () => isInnermost(entry);
|
|
463
|
+
if (!(panel && previouslyFocused && panel.contains(previouslyFocused))) {
|
|
464
|
+
(initialFocusRef.current?.() ?? panel)?.focus();
|
|
465
|
+
}
|
|
466
|
+
body.style.overflow = "hidden";
|
|
467
|
+
const onWindowKeyDown = (e) => {
|
|
468
|
+
if (e.key !== "Escape" || handledEscapes.has(e) || !innermost()) return;
|
|
469
|
+
handledEscapes.add(e);
|
|
470
|
+
e.preventDefault();
|
|
471
|
+
escapeRef.current();
|
|
472
|
+
};
|
|
473
|
+
window.addEventListener("keydown", onWindowKeyDown);
|
|
474
|
+
const onPanelKeyDown = (e) => {
|
|
475
|
+
if (e.key !== "Tab" || !panel || !innermost()) return;
|
|
476
|
+
const focusables = tabbables(panel);
|
|
477
|
+
if (focusables.length === 0) {
|
|
478
|
+
e.preventDefault();
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
const first = focusables[0];
|
|
482
|
+
const last = focusables[focusables.length - 1];
|
|
483
|
+
const active = document.activeElement;
|
|
484
|
+
if (e.shiftKey && (active === first || active === panel)) {
|
|
485
|
+
e.preventDefault();
|
|
486
|
+
last.focus();
|
|
487
|
+
} else if (!e.shiftKey && active === last) {
|
|
488
|
+
e.preventDefault();
|
|
489
|
+
first.focus();
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
panel?.addEventListener("keydown", onPanelKeyDown);
|
|
493
|
+
return () => {
|
|
494
|
+
window.removeEventListener("keydown", onWindowKeyDown);
|
|
495
|
+
panel?.removeEventListener("keydown", onPanelKeyDown);
|
|
496
|
+
const at = openOverlays.indexOf(entry);
|
|
497
|
+
if (at !== -1) openOverlays.splice(at, 1);
|
|
498
|
+
if (openOverlays.length === 0) body.style.overflow = lockedOverflow;
|
|
499
|
+
entry.restoreTo?.focus?.();
|
|
500
|
+
};
|
|
501
|
+
}, [open, panelRef]);
|
|
502
|
+
}
|
|
503
|
+
var STYLE_ID3 = "nb-synapse-confirm-dialog";
|
|
416
504
|
var RULES3 = `
|
|
505
|
+
/* border-box on both, because the kit cannot assume the host resets it: under
|
|
506
|
+
content-box a full-width panel is its padding wider than a phone screen. */
|
|
507
|
+
.nb-confirm-scrim {
|
|
508
|
+
box-sizing: border-box;
|
|
509
|
+
position: fixed; inset: 0; z-index: 1010;
|
|
510
|
+
display: flex; align-items: center; justify-content: center;
|
|
511
|
+
padding: 1rem;
|
|
512
|
+
background: rgba(0, 0, 0, 0.4);
|
|
513
|
+
animation: nb-confirm-fade 160ms ease;
|
|
514
|
+
}
|
|
515
|
+
.nb-confirm {
|
|
516
|
+
box-sizing: border-box;
|
|
517
|
+
width: 100%; max-width: 28rem; max-height: 100%;
|
|
518
|
+
overflow-y: auto;
|
|
519
|
+
outline: none;
|
|
520
|
+
animation: nb-confirm-in 160ms cubic-bezier(0.2, 0, 0, 1);
|
|
521
|
+
}
|
|
522
|
+
.nb-confirm__actions {
|
|
523
|
+
display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem;
|
|
524
|
+
}
|
|
525
|
+
@keyframes nb-confirm-fade { from { opacity: 0; } }
|
|
526
|
+
@keyframes nb-confirm-in { from { opacity: 0; transform: translateY(4px); } }
|
|
527
|
+
@media (pointer: coarse) {
|
|
528
|
+
.nb-confirm__actions .nb-btn { min-height: 44px; }
|
|
529
|
+
}
|
|
530
|
+
`;
|
|
531
|
+
function ConfirmDialog({
|
|
532
|
+
open,
|
|
533
|
+
onOpenChange,
|
|
534
|
+
title,
|
|
535
|
+
description,
|
|
536
|
+
children,
|
|
537
|
+
confirmLabel = "Confirm",
|
|
538
|
+
cancelLabel = "Cancel",
|
|
539
|
+
pendingLabel,
|
|
540
|
+
destructive = false,
|
|
541
|
+
onConfirm
|
|
542
|
+
}) {
|
|
543
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID3, RULES3);
|
|
544
|
+
const panelRef = react.useRef(null);
|
|
545
|
+
const titleId = react.useId();
|
|
546
|
+
const descriptionId = react.useId();
|
|
547
|
+
const [pending, setPending] = react.useState(false);
|
|
548
|
+
const [error, setError] = react.useState(null);
|
|
549
|
+
react.useEffect(() => {
|
|
550
|
+
if (open) {
|
|
551
|
+
setError(null);
|
|
552
|
+
setPending(false);
|
|
553
|
+
}
|
|
554
|
+
}, [open]);
|
|
555
|
+
const dismiss = () => {
|
|
556
|
+
if (!pending) onOpenChange(false);
|
|
557
|
+
};
|
|
558
|
+
const focusTarget = () => panelRef.current?.querySelector(
|
|
559
|
+
destructive ? "[data-nb-confirm-cancel]" : "[data-nb-confirm-confirm]"
|
|
560
|
+
);
|
|
561
|
+
useModal(open, panelRef, { onEscape: dismiss, initialFocus: focusTarget });
|
|
562
|
+
react.useEffect(() => {
|
|
563
|
+
if (error) focusTarget()?.focus();
|
|
564
|
+
}, [error]);
|
|
565
|
+
const confirm = async () => {
|
|
566
|
+
if (pending) return;
|
|
567
|
+
setPending(true);
|
|
568
|
+
setError(null);
|
|
569
|
+
try {
|
|
570
|
+
await onConfirm();
|
|
571
|
+
setPending(false);
|
|
572
|
+
onOpenChange(false);
|
|
573
|
+
} catch (err) {
|
|
574
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
575
|
+
setError(message || "That didn't go through. Try again.");
|
|
576
|
+
setPending(false);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
if (!open) return null;
|
|
580
|
+
const panelStyle = {
|
|
581
|
+
padding: "1.25rem",
|
|
582
|
+
borderRadius: tokens.radiusMd,
|
|
583
|
+
border: `${tokens.borderWidth} solid ${tokens.border}`,
|
|
584
|
+
background: tokens.bg,
|
|
585
|
+
color: tokens.fg,
|
|
586
|
+
boxShadow: tokens.shadowLg,
|
|
587
|
+
fontFamily: tokens.fontSans
|
|
588
|
+
};
|
|
589
|
+
return (
|
|
590
|
+
// biome-ignore lint/a11y/useKeyWithClickEvents: scrim click is a bonus mouse affordance; Escape and Cancel are the keyboard dismissal paths.
|
|
591
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: the scrim is a decorative dismissal backdrop; the panel below owns the alertdialog role/semantics.
|
|
592
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
593
|
+
"div",
|
|
594
|
+
{
|
|
595
|
+
className: "nb-confirm-scrim",
|
|
596
|
+
onClick: (e) => {
|
|
597
|
+
if (e.target === e.currentTarget) dismiss();
|
|
598
|
+
},
|
|
599
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
600
|
+
"div",
|
|
601
|
+
{
|
|
602
|
+
ref: panelRef,
|
|
603
|
+
role: "alertdialog",
|
|
604
|
+
"aria-modal": "true",
|
|
605
|
+
"aria-labelledby": titleId,
|
|
606
|
+
"aria-describedby": description != null ? descriptionId : void 0,
|
|
607
|
+
"aria-busy": pending || void 0,
|
|
608
|
+
tabIndex: -1,
|
|
609
|
+
className: "nb-confirm",
|
|
610
|
+
style: panelStyle,
|
|
611
|
+
children: [
|
|
612
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
613
|
+
"h2",
|
|
614
|
+
{
|
|
615
|
+
id: titleId,
|
|
616
|
+
style: {
|
|
617
|
+
margin: 0,
|
|
618
|
+
fontFamily: tokens.fontSans,
|
|
619
|
+
fontSize: tokens.textBaseSize,
|
|
620
|
+
lineHeight: tokens.textBaseLine,
|
|
621
|
+
fontWeight: tokens.weightSemibold,
|
|
622
|
+
color: tokens.fg
|
|
623
|
+
},
|
|
624
|
+
children: title
|
|
625
|
+
}
|
|
626
|
+
),
|
|
627
|
+
description != null ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
628
|
+
"p",
|
|
629
|
+
{
|
|
630
|
+
id: descriptionId,
|
|
631
|
+
style: {
|
|
632
|
+
margin: "0.25rem 0 0",
|
|
633
|
+
fontSize: tokens.textSmSize,
|
|
634
|
+
lineHeight: tokens.textSmLine,
|
|
635
|
+
color: tokens.fgMuted
|
|
636
|
+
},
|
|
637
|
+
children: description
|
|
638
|
+
}
|
|
639
|
+
) : null,
|
|
640
|
+
children != null ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
641
|
+
"div",
|
|
642
|
+
{
|
|
643
|
+
style: {
|
|
644
|
+
marginTop: "1rem",
|
|
645
|
+
fontSize: tokens.textSmSize,
|
|
646
|
+
lineHeight: tokens.textSmLine
|
|
647
|
+
},
|
|
648
|
+
children
|
|
649
|
+
}
|
|
650
|
+
) : null,
|
|
651
|
+
error ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
652
|
+
"p",
|
|
653
|
+
{
|
|
654
|
+
role: "alert",
|
|
655
|
+
style: {
|
|
656
|
+
margin: "0.75rem 0 0",
|
|
657
|
+
fontSize: tokens.textSmSize,
|
|
658
|
+
lineHeight: tokens.textSmLine,
|
|
659
|
+
color: tokens.danger
|
|
660
|
+
},
|
|
661
|
+
children: error
|
|
662
|
+
}
|
|
663
|
+
) : null,
|
|
664
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nb-confirm__actions", style: { marginTop: "1.25rem" }, children: [
|
|
665
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
666
|
+
Button,
|
|
667
|
+
{
|
|
668
|
+
variant: "secondary",
|
|
669
|
+
size: "sm",
|
|
670
|
+
"data-nb-confirm-cancel": "",
|
|
671
|
+
disabled: pending,
|
|
672
|
+
onClick: dismiss,
|
|
673
|
+
children: cancelLabel
|
|
674
|
+
}
|
|
675
|
+
),
|
|
676
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
677
|
+
Button,
|
|
678
|
+
{
|
|
679
|
+
variant: destructive ? "danger" : "primary",
|
|
680
|
+
size: "sm",
|
|
681
|
+
"data-nb-confirm-confirm": "",
|
|
682
|
+
disabled: pending,
|
|
683
|
+
onClick: () => void confirm(),
|
|
684
|
+
children: pending ? pendingLabel ?? confirmLabel : confirmLabel
|
|
685
|
+
}
|
|
686
|
+
)
|
|
687
|
+
] })
|
|
688
|
+
]
|
|
689
|
+
}
|
|
690
|
+
)
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
var STYLE_ID4 = "nb-synapse-drawer";
|
|
696
|
+
var RULES4 = `
|
|
417
697
|
.nb-drawer-scrim {
|
|
418
698
|
position: fixed; inset: 0; z-index: 1000;
|
|
419
699
|
display: flex; background: rgba(0, 0, 0, 0.32);
|
|
@@ -440,18 +720,6 @@ var RULES3 = `
|
|
|
440
720
|
.nb-drawer-iconbtn { min-width: 44px; min-height: 44px; }
|
|
441
721
|
}
|
|
442
722
|
`;
|
|
443
|
-
function inClosedDetails(el) {
|
|
444
|
-
const details = el.closest("details:not([open])");
|
|
445
|
-
if (!details) return false;
|
|
446
|
-
const summary = details.querySelector("summary");
|
|
447
|
-
return !summary || !summary.contains(el);
|
|
448
|
-
}
|
|
449
|
-
var CANDIDATES = "a[href], button, input, select, textarea, summary, [tabindex]";
|
|
450
|
-
function tabbables(panel) {
|
|
451
|
-
return Array.from(panel.querySelectorAll(CANDIDATES)).filter(
|
|
452
|
-
(el) => el.tabIndex >= 0 && !el.matches(":disabled") && !el.closest("[hidden]") && !inClosedDetails(el) && el.type !== "hidden"
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
723
|
var DrawerContext = react.createContext(null);
|
|
456
724
|
function DrawerRoot({
|
|
457
725
|
open,
|
|
@@ -463,54 +731,11 @@ function DrawerRoot({
|
|
|
463
731
|
children,
|
|
464
732
|
...rest
|
|
465
733
|
}) {
|
|
466
|
-
chunkRX6XCLFF_cjs.ensureStyle(
|
|
734
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID4, RULES4);
|
|
467
735
|
const panelRef = react.useRef(null);
|
|
468
736
|
const labelId = react.useId();
|
|
469
737
|
const [hasTitle, setHasTitle] = react.useState(false);
|
|
470
|
-
|
|
471
|
-
if (!open) return;
|
|
472
|
-
const onKey = (e) => {
|
|
473
|
-
if (e.key === "Escape") {
|
|
474
|
-
e.preventDefault();
|
|
475
|
-
(onEscape ?? onClose)();
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
|
-
window.addEventListener("keydown", onKey);
|
|
479
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
480
|
-
}, [open, onEscape, onClose]);
|
|
481
|
-
react.useEffect(() => {
|
|
482
|
-
if (!open) return;
|
|
483
|
-
const panel = panelRef.current;
|
|
484
|
-
const previouslyFocused = document.activeElement;
|
|
485
|
-
panel?.focus();
|
|
486
|
-
const { body } = document;
|
|
487
|
-
const prevOverflow = body.style.overflow;
|
|
488
|
-
body.style.overflow = "hidden";
|
|
489
|
-
const onKeyDown = (e) => {
|
|
490
|
-
if (e.key !== "Tab" || !panel) return;
|
|
491
|
-
const focusables = tabbables(panel);
|
|
492
|
-
if (focusables.length === 0) {
|
|
493
|
-
e.preventDefault();
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
const first = focusables[0];
|
|
497
|
-
const last = focusables[focusables.length - 1];
|
|
498
|
-
const active = document.activeElement;
|
|
499
|
-
if (e.shiftKey && (active === first || active === panel)) {
|
|
500
|
-
e.preventDefault();
|
|
501
|
-
last.focus();
|
|
502
|
-
} else if (!e.shiftKey && active === last) {
|
|
503
|
-
e.preventDefault();
|
|
504
|
-
first.focus();
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
panel?.addEventListener("keydown", onKeyDown);
|
|
508
|
-
return () => {
|
|
509
|
-
panel?.removeEventListener("keydown", onKeyDown);
|
|
510
|
-
body.style.overflow = prevOverflow;
|
|
511
|
-
previouslyFocused?.focus?.();
|
|
512
|
-
};
|
|
513
|
-
}, [open]);
|
|
738
|
+
useModal(open, panelRef, { onEscape: onEscape ?? onClose });
|
|
514
739
|
const ctxValue = react.useMemo(() => ({ labelId, setHasTitle }), [labelId]);
|
|
515
740
|
if (!open) return null;
|
|
516
741
|
const isBottom = side === "bottom";
|
|
@@ -742,8 +967,8 @@ function EmptyState({ icon, title, description, action, style, ...rest }) {
|
|
|
742
967
|
}
|
|
743
968
|
);
|
|
744
969
|
}
|
|
745
|
-
var
|
|
746
|
-
var
|
|
970
|
+
var STYLE_ID5 = "nb-synapse-listrow";
|
|
971
|
+
var RULES5 = `
|
|
747
972
|
.nb-listrow { transition: background 140ms ease; }
|
|
748
973
|
.nb-listrow--interactive { cursor: pointer; }
|
|
749
974
|
.nb-listrow--interactive:hover { background: var(--nb-listrow-hover); }
|
|
@@ -758,7 +983,7 @@ function ListRow({
|
|
|
758
983
|
className,
|
|
759
984
|
...rest
|
|
760
985
|
}) {
|
|
761
|
-
chunkRX6XCLFF_cjs.ensureStyle(
|
|
986
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID5, RULES5);
|
|
762
987
|
const rowStyle = {
|
|
763
988
|
"--nb-listrow-hover": tokens.bgSubtle,
|
|
764
989
|
display: "grid",
|
|
@@ -841,8 +1066,8 @@ function ListRow({
|
|
|
841
1066
|
}
|
|
842
1067
|
);
|
|
843
1068
|
}
|
|
844
|
-
var
|
|
845
|
-
var
|
|
1069
|
+
var STYLE_ID6 = "nb-synapse-page-header";
|
|
1070
|
+
var RULES6 = `
|
|
846
1071
|
.nb-page-header__desc {
|
|
847
1072
|
display: -webkit-box;
|
|
848
1073
|
-webkit-box-orient: vertical;
|
|
@@ -861,7 +1086,7 @@ function PageHeader({
|
|
|
861
1086
|
style,
|
|
862
1087
|
...rest
|
|
863
1088
|
}) {
|
|
864
|
-
chunkRX6XCLFF_cjs.ensureStyle(
|
|
1089
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID6, RULES6);
|
|
865
1090
|
const descVars = descriptionLines > 0 ? { "--nb-ph-desc-lines": String(descriptionLines) } : {};
|
|
866
1091
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
867
1092
|
"header",
|
|
@@ -947,8 +1172,8 @@ function Pagination({ page, pageCount, onChange, style, ...rest }) {
|
|
|
947
1172
|
}
|
|
948
1173
|
);
|
|
949
1174
|
}
|
|
950
|
-
var
|
|
951
|
-
var
|
|
1175
|
+
var STYLE_ID7 = "nb-synapse-prose";
|
|
1176
|
+
var RULES7 = `
|
|
952
1177
|
.nb-prose {
|
|
953
1178
|
font-family: ${tokens.fontSans};
|
|
954
1179
|
font-size: ${tokens.textBaseSize};
|
|
@@ -973,15 +1198,15 @@ var RULES6 = `
|
|
|
973
1198
|
.nb-prose strong { font-weight: ${tokens.weightSemibold}; }
|
|
974
1199
|
`;
|
|
975
1200
|
function Prose({ html, children, className, ...rest }) {
|
|
976
|
-
chunkRX6XCLFF_cjs.ensureStyle(
|
|
1201
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID7, RULES7);
|
|
977
1202
|
const cls = `nb-prose ${className ?? ""}`.trim();
|
|
978
1203
|
if (html !== void 0) {
|
|
979
1204
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, dangerouslySetInnerHTML: { __html: html }, ...rest });
|
|
980
1205
|
}
|
|
981
1206
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, ...rest, children });
|
|
982
1207
|
}
|
|
983
|
-
var
|
|
984
|
-
var
|
|
1208
|
+
var STYLE_ID8 = "nb-synapse-searchfield";
|
|
1209
|
+
var RULES8 = `
|
|
985
1210
|
.nb-search { font-family: var(--nb-search-font); color: var(--nb-search-fg); outline: none; }
|
|
986
1211
|
.nb-search::placeholder { color: var(--nb-search-placeholder); }
|
|
987
1212
|
.nb-search--underline {
|
|
@@ -1011,7 +1236,7 @@ function SearchField({
|
|
|
1011
1236
|
type = "search",
|
|
1012
1237
|
...rest
|
|
1013
1238
|
}) {
|
|
1014
|
-
chunkRX6XCLFF_cjs.ensureStyle(
|
|
1239
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID8, RULES8);
|
|
1015
1240
|
const fieldStyle = {
|
|
1016
1241
|
"--nb-search-font": tokens.fontSans,
|
|
1017
1242
|
"--nb-search-fg": tokens.fg,
|
|
@@ -1034,8 +1259,8 @@ function SearchField({
|
|
|
1034
1259
|
}
|
|
1035
1260
|
);
|
|
1036
1261
|
}
|
|
1037
|
-
var
|
|
1038
|
-
var
|
|
1262
|
+
var STYLE_ID9 = "nb-synapse-segmented";
|
|
1263
|
+
var RULES9 = `
|
|
1039
1264
|
.nb-seg {
|
|
1040
1265
|
display: inline-flex;
|
|
1041
1266
|
gap: 2px;
|
|
@@ -1070,7 +1295,7 @@ function SegmentedControl({
|
|
|
1070
1295
|
className,
|
|
1071
1296
|
...rest
|
|
1072
1297
|
}) {
|
|
1073
|
-
chunkRX6XCLFF_cjs.ensureStyle(
|
|
1298
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID9, RULES9);
|
|
1074
1299
|
const trackStyle = {
|
|
1075
1300
|
"--nb-seg-radius": tokens.radiusSm,
|
|
1076
1301
|
"--nb-seg-track": tokens.bgSubtle,
|
|
@@ -1099,14 +1324,14 @@ function SegmentedControl({
|
|
|
1099
1324
|
)) })
|
|
1100
1325
|
);
|
|
1101
1326
|
}
|
|
1102
|
-
var
|
|
1103
|
-
var
|
|
1327
|
+
var STYLE_ID10 = "nb-synapse-spinner";
|
|
1328
|
+
var RULES10 = `
|
|
1104
1329
|
@keyframes nb-spin { to { transform: rotate(360deg); } }
|
|
1105
1330
|
.nb-spinner { animation: nb-spin 0.7s linear infinite; }
|
|
1106
1331
|
@media (prefers-reduced-motion: reduce) { .nb-spinner { animation-duration: 1.6s; } }
|
|
1107
1332
|
`;
|
|
1108
1333
|
function Spinner({ size = 16, color, style, className, ...rest }) {
|
|
1109
|
-
chunkRX6XCLFF_cjs.ensureStyle(
|
|
1334
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID10, RULES10);
|
|
1110
1335
|
const spinnerStyle = {
|
|
1111
1336
|
display: "inline-block",
|
|
1112
1337
|
flexShrink: 0,
|
|
@@ -1135,7 +1360,7 @@ var COLOR = {
|
|
|
1135
1360
|
failed: tokens.danger,
|
|
1136
1361
|
idle: tokens.fgFaint
|
|
1137
1362
|
};
|
|
1138
|
-
var
|
|
1363
|
+
var STYLE_ID11 = "nb-synapse-statusdot";
|
|
1139
1364
|
var KEYFRAMES = `
|
|
1140
1365
|
@keyframes nb-statusdot-pulse {
|
|
1141
1366
|
0% { box-shadow: 0 0 0 0 var(--nb-statusdot-ring); transform: scale(1); }
|
|
@@ -1157,7 +1382,7 @@ function StatusDot({
|
|
|
1157
1382
|
className,
|
|
1158
1383
|
...rest
|
|
1159
1384
|
}) {
|
|
1160
|
-
chunkRX6XCLFF_cjs.ensureStyle(
|
|
1385
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID11, KEYFRAMES);
|
|
1161
1386
|
const dotColor = color ?? COLOR[status];
|
|
1162
1387
|
const working = status === "working";
|
|
1163
1388
|
const dotStyle = {
|
|
@@ -1180,8 +1405,8 @@ function StatusDot({
|
|
|
1180
1405
|
}
|
|
1181
1406
|
);
|
|
1182
1407
|
}
|
|
1183
|
-
var
|
|
1184
|
-
var
|
|
1408
|
+
var STYLE_ID12 = "nb-synapse-table";
|
|
1409
|
+
var RULES11 = `
|
|
1185
1410
|
.nb-table { width: 100%; border-collapse: collapse; font-family: var(--nb-table-font); }
|
|
1186
1411
|
.nb-table th, .nb-table td {
|
|
1187
1412
|
padding: 0.55rem 0.75rem;
|
|
@@ -1211,7 +1436,7 @@ function Table({
|
|
|
1211
1436
|
className,
|
|
1212
1437
|
...rest
|
|
1213
1438
|
}) {
|
|
1214
|
-
chunkRX6XCLFF_cjs.ensureStyle(
|
|
1439
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID12, RULES11);
|
|
1215
1440
|
const vars = {
|
|
1216
1441
|
"--nb-table-font": tokens.fontSans,
|
|
1217
1442
|
"--nb-table-fg": tokens.fg,
|
|
@@ -1277,8 +1502,8 @@ function Table({
|
|
|
1277
1502
|
}
|
|
1278
1503
|
);
|
|
1279
1504
|
}
|
|
1280
|
-
var
|
|
1281
|
-
var
|
|
1505
|
+
var STYLE_ID13 = "nb-synapse-tabs";
|
|
1506
|
+
var RULES12 = `
|
|
1282
1507
|
.nb-tabs {
|
|
1283
1508
|
display: flex;
|
|
1284
1509
|
align-items: stretch;
|
|
@@ -1336,7 +1561,7 @@ function Tabs({
|
|
|
1336
1561
|
onKeyDown: callerKeyDown,
|
|
1337
1562
|
...rest
|
|
1338
1563
|
}) {
|
|
1339
|
-
chunkRX6XCLFF_cjs.ensureStyle(
|
|
1564
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID13, RULES12);
|
|
1340
1565
|
const barRef = react.useRef(null);
|
|
1341
1566
|
const barStyle = {
|
|
1342
1567
|
"--nb-tabs-gap": "1.25rem",
|
|
@@ -1613,8 +1838,8 @@ function useSidebar() {
|
|
|
1613
1838
|
if (!ctx) throw new Error("useSidebar must be used within <SidebarLayout>");
|
|
1614
1839
|
return ctx;
|
|
1615
1840
|
}
|
|
1616
|
-
var
|
|
1617
|
-
var
|
|
1841
|
+
var STYLE_ID14 = "nb-synapse-sidebarlayout";
|
|
1842
|
+
var RULES13 = `
|
|
1618
1843
|
.nb-sidebar-drawer { transition: transform 220ms cubic-bezier(0.2, 0, 0, 1); }
|
|
1619
1844
|
.nb-sidebar-scrim { animation: nb-sidebar-fade 180ms ease; }
|
|
1620
1845
|
@keyframes nb-sidebar-fade { from { opacity: 0; } to { opacity: 1; } }
|
|
@@ -1664,7 +1889,7 @@ function SidebarLayoutRoot({
|
|
|
1664
1889
|
}
|
|
1665
1890
|
function Sidebar({ style, children, ...rest }) {
|
|
1666
1891
|
const { collapsed, mode, side, width, open, setOpen } = useSidebar();
|
|
1667
|
-
chunkRX6XCLFF_cjs.ensureStyle(
|
|
1892
|
+
chunkRX6XCLFF_cjs.ensureStyle(STYLE_ID14, RULES13);
|
|
1668
1893
|
if (!collapsed) {
|
|
1669
1894
|
const border = `${tokens.borderWidth} solid ${tokens.border}`;
|
|
1670
1895
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1795,6 +2020,7 @@ exports.Badge = Badge;
|
|
|
1795
2020
|
exports.Breadcrumb = Breadcrumb;
|
|
1796
2021
|
exports.Button = Button;
|
|
1797
2022
|
exports.Card = Card;
|
|
2023
|
+
exports.ConfirmDialog = ConfirmDialog;
|
|
1798
2024
|
exports.Divider = Divider;
|
|
1799
2025
|
exports.Drawer = Drawer;
|
|
1800
2026
|
exports.EmptyState = EmptyState;
|