@salesforce/metadata-plugins 1.13.0 → 1.15.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 +16 -7
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/plugins/agent/ui/assets/{VibeEditComposer-D5GykTkw.js → VibeEditComposer-sSbOXosJ.js} +1 -1
- package/dist/plugins/agent/ui/assets/index-BIxtmvIY.js +72 -0
- package/dist/plugins/agent/ui/assets/index-DK6mLwjU.css +1 -0
- package/dist/plugins/agent/ui/index.html +2 -2
- package/dist/plugins/{flow/ui/assets/VibeEditComposer-C36-RsSl.js → flexipage/ui/assets/VibeEditComposer-2omfTQa8.js} +1 -1
- package/dist/plugins/flexipage/ui/assets/index-Ch0zZsHI.css +1 -0
- package/dist/plugins/flexipage/ui/assets/index-uJdxEdOM.js +49 -0
- package/dist/plugins/flexipage/ui/index.html +2 -2
- package/dist/plugins/{permissionset/ui/assets/VibeEditComposer-HYu9RPHQ.js → flow/ui/assets/VibeEditComposer-6VCphcxQ.js} +1 -1
- package/dist/plugins/flow/ui/assets/index-CQ3TDL7z.css +1 -0
- package/dist/plugins/flow/ui/assets/index-CpyTpkLI.js +49 -0
- package/dist/plugins/flow/ui/index.html +2 -2
- package/dist/plugins/flowintent/ui/assets/{index-CzlE9StJ.js → index-y2EUB92Z.js} +8 -8
- package/dist/plugins/flowintent/ui/index.html +1 -1
- package/dist/plugins/keyvaluetable/KeyValueTableParser.d.ts +36 -0
- package/dist/plugins/keyvaluetable/KeyValueTableParser.d.ts.map +1 -0
- package/dist/plugins/keyvaluetable/KeyValueTableParser.js +429 -0
- package/dist/plugins/keyvaluetable/KeyValueTableVisualizer.d.ts +29 -0
- package/dist/plugins/keyvaluetable/KeyValueTableVisualizer.d.ts.map +1 -0
- package/dist/plugins/keyvaluetable/KeyValueTableVisualizer.js +63 -0
- package/dist/plugins/keyvaluetable/humanize.d.ts +9 -0
- package/dist/plugins/keyvaluetable/humanize.d.ts.map +1 -0
- package/dist/plugins/keyvaluetable/humanize.js +15 -0
- package/dist/plugins/keyvaluetable/types/KeyValueTableData.d.ts +78 -0
- package/dist/plugins/keyvaluetable/types/KeyValueTableData.d.ts.map +1 -0
- package/dist/plugins/keyvaluetable/types/KeyValueTableData.js +7 -0
- package/dist/plugins/keyvaluetable/ui/assets/index-BFCI4_BV.js +50 -0
- package/dist/plugins/keyvaluetable/ui/assets/index-CxfJGu2l.css +1 -0
- package/dist/plugins/keyvaluetable/ui/index.html +14 -0
- package/dist/plugins/{flexipage/ui/assets/VibeEditComposer-CwNZdtC5.js → permissionset/ui/assets/VibeEditComposer-CIuLlA6k.js} +1 -1
- package/dist/plugins/permissionset/ui/assets/index-C30GA5Fg.js +49 -0
- package/dist/plugins/permissionset/ui/assets/index-DrM8dMi5.css +1 -0
- package/dist/plugins/permissionset/ui/index.html +2 -2
- package/dist/plugins/schema/ui/assets/VibeEditComposer-4dxANHzI.js +1 -0
- package/dist/plugins/schema/ui/assets/index-ByiBxce_.js +71 -0
- package/dist/plugins/schema/ui/assets/index-CkSyHqut.css +1 -0
- package/dist/plugins/schema/ui/index.html +2 -2
- package/package.json +3 -3
- package/dist/plugins/agent/ui/assets/index-CFqH429G.css +0 -1
- package/dist/plugins/agent/ui/assets/index-nYWtX5pm.js +0 -72
- package/dist/plugins/flexipage/ui/assets/index-C2upgZns.css +0 -1
- package/dist/plugins/flexipage/ui/assets/index-hFZPLB6p.js +0 -49
- package/dist/plugins/flow/ui/assets/index-CdpIq7gH.js +0 -49
- package/dist/plugins/flow/ui/assets/index-Ckw5Ej7p.css +0 -1
- package/dist/plugins/permissionset/ui/assets/index-DWBjNYzW.css +0 -1
- package/dist/plugins/permissionset/ui/assets/index-DilBd-cG.js +0 -49
- package/dist/plugins/schema/ui/assets/VibeEditComposer-Ce9dBbb3.js +0 -1
- package/dist/plugins/schema/ui/assets/index-DSSQ6K8b.js +0 -71
- package/dist/plugins/schema/ui/assets/index-Dsaw92BM.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,R as t,S as he,A as be}from"./index-hFZPLB6p.js";const k=12,re=12;function ce(o,u,c){const b=Math.max(c.left+k,c.left+c.width-u.width-k),a=Math.max(c.top+k,c.top+c.height-u.height-k);return{left:Math.min(Math.max(o.left,c.left+k),b),top:Math.min(Math.max(o.top,c.top+k),a)}}function ve(o,u,c){const b=o.left+o.width+re,a=o.left-u.width-re,m=b+u.width<=c.left+c.width-k;return ce({left:m?b:a,top:o.top},u,c)}function Ee(){return t.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true"},he.map(o=>t.createElement("path",{key:o,d:o,fill:"currentColor"})))}function ge(){return t.createElement("svg",{width:"40",height:"48",viewBox:"0 0 40 48.3291",preserveAspectRatio:"xMidYMid meet",overflow:"visible",fill:"none","aria-hidden":"true"},be.map(o=>t.createElement("path",{key:o,d:o,fill:"currentColor"})))}function O({size:o,className:u,children:c}){return t.createElement("svg",{className:u,width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},c)}const oe=t.createElement(t.Fragment,null,t.createElement("path",{d:"M18 6 6 18"}),t.createElement("path",{d:"m6 6 12 12"})),_e=t.createElement(t.Fragment,null,t.createElement("circle",{cx:"8",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"8",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"8",cy:"18",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"18",r:"1",fill:"currentColor",stroke:"none"}));function X(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function ie(){return{left:0,top:0,width:window.innerWidth,height:window.innerHeight}}function we({ids:o,nodeFor:u}){const[c,b]=r.useState([]);return r.useEffect(()=>{let a=0;const m=()=>{const f=[];for(const p of o){const h=u(p);if(!h)continue;const s=h.getBoundingClientRect();f.push({id:p,x:s.x,y:s.y,width:s.width,height:s.height})}b(p=>p.length===f.length&&p.every((h,s)=>h.id===f[s].id&&h.x===f[s].x&&h.y===f[s].y&&h.width===f[s].width&&h.height===f[s].height)?p:f),a=requestAnimationFrame(m)};return a=requestAnimationFrame(m),()=>cancelAnimationFrame(a)},[o,u]),c.length===0?null:t.createElement("div",{className:"vibe-edit-composer__pulse-layer","aria-hidden":"true"},c.map(a=>t.createElement("div",{key:a.id,className:"vibe-edit-composer__pulse",style:{left:a.x,top:a.y,width:a.width,height:a.height}})))}function ke({elements:o,nodeFor:u,onEdit:c,onDeselect:b,onSent:a,onClose:m,onDraftChange:f}){const[p,h]=r.useState(""),[s,I]=r.useState("idle"),[ae,z]=r.useState(""),[A,Y]=r.useState([]),[F,G]=r.useState(""),C=r.useRef(null),T=r.useRef(null),[L,P]=r.useState(null),v=r.useRef(null),[H,K]=r.useState(!1),W=r.useId(),g=r.useRef(!1),V=r.useRef(null),_=r.useRef(null),U=r.useRef(!1),M=r.useRef(null),$=r.useRef(!1),S=r.useRef(!0);r.useEffect(()=>(S.current=!0,()=>{S.current=!1}),[]);const x=o.length,y=x>0,R=s==="applying",q=y&&p.trim().length>0&&!R,j=y&&p.trim().length>0;r.useEffect(()=>{f==null||f(j)},[j,f]);const w=r.useCallback(e=>{const n=T.current;if(!n)return;const l=ce(e,X(n.getBoundingClientRect()),ie());v.current=l,P(i=>i&&i.left===l.left&&i.top===l.top?i:l)},[]);r.useLayoutEffect(()=>{if(!y){g.current=!1,v.current=null,P(null),K(!1);return}const e=T.current;if(!e)return;const n=o[0].id;V.current!==n&&(V.current=n,g.current=!1);const l=()=>{if(g.current){v.current&&w(v.current);return}const ne=u(o[0].id);if(!ne)return;const D=ve(X(ne.getBoundingClientRect()),X(e.getBoundingClientRect()),ie());v.current=D,P(B=>B&&B.left===D.left&&B.top===D.top?B:D)};l();let i=0;const d=()=>{i===0&&(i=requestAnimationFrame(()=>{i=0,l()}))};window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),window.addEventListener("pointermove",d,!0),window.addEventListener("wheel",d,!0);const E=typeof ResizeObserver>"u"?null:new ResizeObserver(l);return E==null||E.observe(e),E==null||E.observe(u(o[0].id)??e),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0),window.removeEventListener("pointermove",d,!0),window.removeEventListener("wheel",d,!0),E==null||E.disconnect()}},[o,y,u,w]);const N=r.useCallback((e,n)=>{g.current=!0;const l=v.current??{left:12,top:12};w({left:l.left+e,top:l.top+n})},[w]),se=r.useCallback(e=>{if(e.button!==0)return;const n=T.current;if(!n)return;const l=X(n.getBoundingClientRect()),i=g.current,d=v.current??{left:l.left,top:l.top};w(d),_.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,position:d,wasManuallyPositioned:i,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.focus(),e.preventDefault(),e.stopPropagation()},[w]),le=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(!n.moved&&Math.hypot(e.clientX-n.startX,e.clientY-n.startY)>3&&(g.current=!0,n.moved=!0),w({left:n.position.left+e.clientX-n.startX,top:n.position.top+e.clientY-n.startY}),e.preventDefault(),e.stopPropagation())},[w]),ue=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(_.current=null,U.current=n.moved,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),J=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(_.current=null,g.current=n.wasManuallyPositioned,v.current=n.position,P(n.position),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),de=r.useCallback(e=>{const n=e.shiftKey?32:16,i={ArrowLeft:{left:-n,top:0},ArrowRight:{left:n,top:0},ArrowUp:{left:0,top:-n},ArrowDown:{left:0,top:n}}[e.key];if(i)e.preventDefault(),N(i.left,i.top);else if(e.key==="Escape"){e.preventDefault(),e.stopPropagation();const d=_.current;d&&(g.current=d.wasManuallyPositioned,v.current=d.position,P(d.position),_.current=null),K(!1)}},[N]);r.useEffect(()=>{var e;y&&((e=C.current)==null||e.focus())},[y]);const Q=r.useCallback(()=>{h(""),C.current&&(C.current.textContent="")},[]),Z=r.useCallback(async()=>{if(!q||$.current)return;$.current=!0;const e=p.trim(),n=o.map(i=>i.id),l=M.current?{kind:"existing",id:M.current.id,label:M.current.label}:{kind:"new"};I("applying"),Y(n);try{const i=await c(n,e,l);i&&i.chatId&&(M.current={id:i.chatId,label:i.chatLabel??"Edits"}),S.current&&(Q(),I("idle"),z(""),G("Sent to Agentforce Vibes"),a==null||a())}catch(i){S.current&&(Y([]),z(i instanceof Error&&i.message.length>0?i.message:"That edit couldn’t be sent. Try again."),I("error"))}finally{$.current=!1}},[q,Q,p,o,c,a]);r.useEffect(()=>{var e;s==="error"&&((e=C.current)==null||e.focus())},[s]),r.useEffect(()=>{if(!F)return;const e=setTimeout(()=>G(""),4e3);return()=>clearTimeout(e)},[F]),r.useEffect(()=>{if(s!=="idle"||A.length===0)return;const e=setTimeout(()=>Y([]),1200);return()=>clearTimeout(e)},[s,A]);const ee=()=>{o.forEach(e=>b(e.id)),m==null||m()},te=e=>{b(e.id),G(`Removed ${e.label}, ${x-1} selected`),x===1&&(m==null||m())},fe=e=>{h(e.currentTarget.textContent??""),s==="error"&&(z(""),I("idle"))},pe=e=>{e.key==="Enter"&&!e.shiftKey&&!e.nativeEvent.isComposing?(e.preventDefault(),Z()):e.key==="Escape"?(e.preventDefault(),ee()):e.key==="Backspace"&&p.length===0&&x>0&&(e.preventDefault(),te(o[x-1]))},me=e=>{var n;e.target===e.currentTarget&&((n=C.current)==null||n.focus())};return t.createElement(t.Fragment,null,t.createElement("span",{className:"vibe-edit-composer__sr-only",role:"status","aria-live":"polite"},F),A.length>0&&t.createElement(we,{ids:A,nodeFor:u}),y&&t.createElement("div",{className:`vibe-edit-composer${L?" vibe-edit-composer--positioned":""}`,role:"dialog","aria-label":"Edit selected metadata with the agent",onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),style:L?{left:L.left,top:L.top}:void 0},t.createElement("div",{ref:T,className:"vibe-edit-composer__card"},t.createElement("div",{className:"vibe-edit-composer__header"},t.createElement("span",{className:"vibe-edit-composer__title"},t.createElement("span",{className:"vibe-edit-composer__title-icon"},t.createElement(Ee,null)),t.createElement("span",{className:"vibe-edit-composer__title-text"},x," selected")),t.createElement("span",{className:"vibe-edit-composer__header-actions"},t.createElement("button",{type:"button",className:"vibe-edit-composer__icon-button vibe-edit-composer__icon-button--sm vibe-edit-composer__move-handle","aria-label":"Move composer","aria-expanded":H,"aria-controls":H?W:void 0,title:"Drag to move composer. Arrow keys move it when focused.",onClick:()=>{if(U.current){U.current=!1;return}K(e=>!e)},onPointerDown:se,onPointerMove:le,onPointerUp:ue,onPointerCancel:J,onLostPointerCapture:J,onKeyDown:de,disabled:R},t.createElement(O,{size:16},_e)),t.createElement("button",{type:"button",className:"vibe-edit-composer__icon-button vibe-edit-composer__icon-button--sm","aria-label":"Exit select to edit",title:"Exit",onClick:ee,disabled:R},t.createElement(O,{size:16},oe)))),H&&t.createElement("div",{id:W,className:"vibe-edit-composer__move-controls",role:"group","aria-label":"Move composer controls"},t.createElement("button",{type:"button",onClick:()=>N(0,-16),"aria-label":"Move composer up"},"Up"),t.createElement("button",{type:"button",onClick:()=>N(-16,0),"aria-label":"Move composer left"},"Left"),t.createElement("button",{type:"button",onClick:()=>N(16,0),"aria-label":"Move composer right"},"Right"),t.createElement("button",{type:"button",onClick:()=>N(0,16),"aria-label":"Move composer down"},"Down")),s==="error"&&t.createElement("div",{className:"vibe-edit-composer__error",role:"alert"},ae),t.createElement("div",{className:"vibe-edit-composer__panel"},t.createElement("div",{className:"vibe-edit-composer__input-container"},t.createElement("div",{className:"vibe-edit-composer__editable",onClick:me},o.map(e=>t.createElement("span",{key:e.id,className:"vibe-edit-composer__chip",role:"group","aria-label":e.label,title:e.label},t.createElement("button",{type:"button",className:"vibe-edit-composer__chip-icon-wrap","aria-label":`Remove ${e.label} from selection`,onClick:()=>te(e),disabled:R},t.createElement(O,{size:12,className:"vibe-edit-composer__chip-icon"},t.createElement("path",{d:"M16 18l6-6-6-6"}),t.createElement("path",{d:"M8 6l-6 6 6 6"})),t.createElement(O,{size:12,className:"vibe-edit-composer__chip-x"},oe)),t.createElement("span",{className:"vibe-edit-composer__chip-label"},e.label))),t.createElement("span",{ref:C,className:"vibe-edit-composer__text",contentEditable:R?!1:"plaintext-only",suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":"Describe your edits…","aria-busy":R||void 0,onInput:fe,onKeyDown:pe}),p.length===0&&t.createElement("span",{className:"vibe-edit-composer__placeholder","aria-hidden":"true"},"Describe your edits…")),t.createElement("div",{className:"vibe-edit-composer__footer"},t.createElement("div",{className:"vibe-edit-composer__controls"},t.createElement("button",{type:"button",className:"vibe-edit-composer__send",disabled:!q,onClick:()=>void Z(),"aria-label":"Send to Agent",title:M.current?"Adds to the edits chat":"Opens in a new chat"},t.createElement("span",{className:"vibe-edit-composer__send-icon"},t.createElement(ge,null)),"Send to Agent"))))))))}export{ke as default};
|
|
1
|
+
import{r,R as t,S as he,A as be}from"./index-C30GA5Fg.js";const k=12,re=12;function ce(o,u,c){const b=Math.max(c.left+k,c.left+c.width-u.width-k),a=Math.max(c.top+k,c.top+c.height-u.height-k);return{left:Math.min(Math.max(o.left,c.left+k),b),top:Math.min(Math.max(o.top,c.top+k),a)}}function ve(o,u,c){const b=o.left+o.width+re,a=o.left-u.width-re,m=b+u.width<=c.left+c.width-k;return ce({left:m?b:a,top:o.top},u,c)}function Ee(){return t.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true"},he.map(o=>t.createElement("path",{key:o,d:o,fill:"currentColor"})))}function ge(){return t.createElement("svg",{width:"40",height:"48",viewBox:"0 0 40 48.3291",preserveAspectRatio:"xMidYMid meet",overflow:"visible",fill:"none","aria-hidden":"true"},be.map(o=>t.createElement("path",{key:o,d:o,fill:"currentColor"})))}function O({size:o,className:u,children:c}){return t.createElement("svg",{className:u,width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},c)}const oe=t.createElement(t.Fragment,null,t.createElement("path",{d:"M18 6 6 18"}),t.createElement("path",{d:"m6 6 12 12"})),_e=t.createElement(t.Fragment,null,t.createElement("circle",{cx:"8",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"8",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"8",cy:"18",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"18",r:"1",fill:"currentColor",stroke:"none"}));function X(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function ie(){return{left:0,top:0,width:window.innerWidth,height:window.innerHeight}}function we({ids:o,nodeFor:u}){const[c,b]=r.useState([]);return r.useEffect(()=>{let a=0;const m=()=>{const f=[];for(const p of o){const h=u(p);if(!h)continue;const s=h.getBoundingClientRect();f.push({id:p,x:s.x,y:s.y,width:s.width,height:s.height})}b(p=>p.length===f.length&&p.every((h,s)=>h.id===f[s].id&&h.x===f[s].x&&h.y===f[s].y&&h.width===f[s].width&&h.height===f[s].height)?p:f),a=requestAnimationFrame(m)};return a=requestAnimationFrame(m),()=>cancelAnimationFrame(a)},[o,u]),c.length===0?null:t.createElement("div",{className:"vibe-edit-composer__pulse-layer","aria-hidden":"true"},c.map(a=>t.createElement("div",{key:a.id,className:"vibe-edit-composer__pulse",style:{left:a.x,top:a.y,width:a.width,height:a.height}})))}function ke({elements:o,nodeFor:u,onEdit:c,onDeselect:b,onSent:a,onClose:m,onDraftChange:f}){const[p,h]=r.useState(""),[s,I]=r.useState("idle"),[ae,z]=r.useState(""),[A,Y]=r.useState([]),[F,G]=r.useState(""),C=r.useRef(null),T=r.useRef(null),[L,P]=r.useState(null),v=r.useRef(null),[H,K]=r.useState(!1),W=r.useId(),g=r.useRef(!1),V=r.useRef(null),_=r.useRef(null),U=r.useRef(!1),M=r.useRef(null),$=r.useRef(!1),S=r.useRef(!0);r.useEffect(()=>(S.current=!0,()=>{S.current=!1}),[]);const x=o.length,y=x>0,R=s==="applying",q=y&&p.trim().length>0&&!R,j=y&&p.trim().length>0;r.useEffect(()=>{f==null||f(j)},[j,f]);const w=r.useCallback(e=>{const n=T.current;if(!n)return;const l=ce(e,X(n.getBoundingClientRect()),ie());v.current=l,P(i=>i&&i.left===l.left&&i.top===l.top?i:l)},[]);r.useLayoutEffect(()=>{if(!y){g.current=!1,v.current=null,P(null),K(!1);return}const e=T.current;if(!e)return;const n=o[0].id;V.current!==n&&(V.current=n,g.current=!1);const l=()=>{if(g.current){v.current&&w(v.current);return}const ne=u(o[0].id);if(!ne)return;const D=ve(X(ne.getBoundingClientRect()),X(e.getBoundingClientRect()),ie());v.current=D,P(B=>B&&B.left===D.left&&B.top===D.top?B:D)};l();let i=0;const d=()=>{i===0&&(i=requestAnimationFrame(()=>{i=0,l()}))};window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),window.addEventListener("pointermove",d,!0),window.addEventListener("wheel",d,!0);const E=typeof ResizeObserver>"u"?null:new ResizeObserver(l);return E==null||E.observe(e),E==null||E.observe(u(o[0].id)??e),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0),window.removeEventListener("pointermove",d,!0),window.removeEventListener("wheel",d,!0),E==null||E.disconnect()}},[o,y,u,w]);const N=r.useCallback((e,n)=>{g.current=!0;const l=v.current??{left:12,top:12};w({left:l.left+e,top:l.top+n})},[w]),se=r.useCallback(e=>{if(e.button!==0)return;const n=T.current;if(!n)return;const l=X(n.getBoundingClientRect()),i=g.current,d=v.current??{left:l.left,top:l.top};w(d),_.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,position:d,wasManuallyPositioned:i,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.focus(),e.preventDefault(),e.stopPropagation()},[w]),le=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(!n.moved&&Math.hypot(e.clientX-n.startX,e.clientY-n.startY)>3&&(g.current=!0,n.moved=!0),w({left:n.position.left+e.clientX-n.startX,top:n.position.top+e.clientY-n.startY}),e.preventDefault(),e.stopPropagation())},[w]),ue=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(_.current=null,U.current=n.moved,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),J=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(_.current=null,g.current=n.wasManuallyPositioned,v.current=n.position,P(n.position),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),de=r.useCallback(e=>{const n=e.shiftKey?32:16,i={ArrowLeft:{left:-n,top:0},ArrowRight:{left:n,top:0},ArrowUp:{left:0,top:-n},ArrowDown:{left:0,top:n}}[e.key];if(i)e.preventDefault(),N(i.left,i.top);else if(e.key==="Escape"){e.preventDefault(),e.stopPropagation();const d=_.current;d&&(g.current=d.wasManuallyPositioned,v.current=d.position,P(d.position),_.current=null),K(!1)}},[N]);r.useEffect(()=>{var e;y&&((e=C.current)==null||e.focus())},[y]);const Q=r.useCallback(()=>{h(""),C.current&&(C.current.textContent="")},[]),Z=r.useCallback(async()=>{if(!q||$.current)return;$.current=!0;const e=p.trim(),n=o.map(i=>i.id),l=M.current?{kind:"existing",id:M.current.id,label:M.current.label}:{kind:"new"};I("applying"),Y(n);try{const i=await c(n,e,l);i&&i.chatId&&(M.current={id:i.chatId,label:i.chatLabel??"Edits"}),S.current&&(Q(),I("idle"),z(""),G("Sent to Agentforce Vibes"),a==null||a())}catch(i){S.current&&(Y([]),z(i instanceof Error&&i.message.length>0?i.message:"That edit couldn’t be sent. Try again."),I("error"))}finally{$.current=!1}},[q,Q,p,o,c,a]);r.useEffect(()=>{var e;s==="error"&&((e=C.current)==null||e.focus())},[s]),r.useEffect(()=>{if(!F)return;const e=setTimeout(()=>G(""),4e3);return()=>clearTimeout(e)},[F]),r.useEffect(()=>{if(s!=="idle"||A.length===0)return;const e=setTimeout(()=>Y([]),1200);return()=>clearTimeout(e)},[s,A]);const ee=()=>{o.forEach(e=>b(e.id)),m==null||m()},te=e=>{b(e.id),G(`Removed ${e.label}, ${x-1} selected`),x===1&&(m==null||m())},fe=e=>{h(e.currentTarget.textContent??""),s==="error"&&(z(""),I("idle"))},pe=e=>{e.key==="Enter"&&!e.shiftKey&&!e.nativeEvent.isComposing?(e.preventDefault(),Z()):e.key==="Escape"?(e.preventDefault(),ee()):e.key==="Backspace"&&p.length===0&&x>0&&(e.preventDefault(),te(o[x-1]))},me=e=>{var n;e.target===e.currentTarget&&((n=C.current)==null||n.focus())};return t.createElement(t.Fragment,null,t.createElement("span",{className:"vibe-edit-composer__sr-only",role:"status","aria-live":"polite"},F),A.length>0&&t.createElement(we,{ids:A,nodeFor:u}),y&&t.createElement("div",{className:`vibe-edit-composer${L?" vibe-edit-composer--positioned":""}`,role:"dialog","aria-label":"Edit selected metadata with the agent",onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),style:L?{left:L.left,top:L.top}:void 0},t.createElement("div",{ref:T,className:"vibe-edit-composer__card"},t.createElement("div",{className:"vibe-edit-composer__header"},t.createElement("span",{className:"vibe-edit-composer__title"},t.createElement("span",{className:"vibe-edit-composer__title-icon"},t.createElement(Ee,null)),t.createElement("span",{className:"vibe-edit-composer__title-text"},x," selected")),t.createElement("span",{className:"vibe-edit-composer__header-actions"},t.createElement("button",{type:"button",className:"vibe-edit-composer__icon-button vibe-edit-composer__icon-button--sm vibe-edit-composer__move-handle","aria-label":"Move composer","aria-expanded":H,"aria-controls":H?W:void 0,title:"Drag to move composer. Arrow keys move it when focused.",onClick:()=>{if(U.current){U.current=!1;return}K(e=>!e)},onPointerDown:se,onPointerMove:le,onPointerUp:ue,onPointerCancel:J,onLostPointerCapture:J,onKeyDown:de,disabled:R},t.createElement(O,{size:16},_e)),t.createElement("button",{type:"button",className:"vibe-edit-composer__icon-button vibe-edit-composer__icon-button--sm","aria-label":"Exit select to edit",title:"Exit",onClick:ee,disabled:R},t.createElement(O,{size:16},oe)))),H&&t.createElement("div",{id:W,className:"vibe-edit-composer__move-controls",role:"group","aria-label":"Move composer controls"},t.createElement("button",{type:"button",onClick:()=>N(0,-16),"aria-label":"Move composer up"},"Up"),t.createElement("button",{type:"button",onClick:()=>N(-16,0),"aria-label":"Move composer left"},"Left"),t.createElement("button",{type:"button",onClick:()=>N(16,0),"aria-label":"Move composer right"},"Right"),t.createElement("button",{type:"button",onClick:()=>N(0,16),"aria-label":"Move composer down"},"Down")),s==="error"&&t.createElement("div",{className:"vibe-edit-composer__error",role:"alert"},ae),t.createElement("div",{className:"vibe-edit-composer__panel"},t.createElement("div",{className:"vibe-edit-composer__input-container"},t.createElement("div",{className:"vibe-edit-composer__editable",onClick:me},o.map(e=>t.createElement("span",{key:e.id,className:"vibe-edit-composer__chip",role:"group","aria-label":e.label,title:e.label},t.createElement("button",{type:"button",className:"vibe-edit-composer__chip-icon-wrap","aria-label":`Remove ${e.label} from selection`,onClick:()=>te(e),disabled:R},t.createElement(O,{size:12,className:"vibe-edit-composer__chip-icon"},t.createElement("path",{d:"M16 18l6-6-6-6"}),t.createElement("path",{d:"M8 6l-6 6 6 6"})),t.createElement(O,{size:12,className:"vibe-edit-composer__chip-x"},oe)),t.createElement("span",{className:"vibe-edit-composer__chip-label"},e.label))),t.createElement("span",{ref:C,className:"vibe-edit-composer__text",contentEditable:R?!1:"plaintext-only",suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":"Describe your edits…","aria-busy":R||void 0,onInput:fe,onKeyDown:pe}),p.length===0&&t.createElement("span",{className:"vibe-edit-composer__placeholder","aria-hidden":"true"},"Describe your edits…")),t.createElement("div",{className:"vibe-edit-composer__footer"},t.createElement("div",{className:"vibe-edit-composer__controls"},t.createElement("button",{type:"button",className:"vibe-edit-composer__send",disabled:!q,onClick:()=>void Z(),"aria-label":"Send to Agent",title:M.current?"Adds to the edits chat":"Opens in a new chat"},t.createElement("span",{className:"vibe-edit-composer__send-icon"},t.createElement(ge,null)),"Send to Agent"))))))))}export{ke as default};
|