pptx-vanilla-viewer 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/ai-panel-M5OOMYEI.cjs +1 -0
- package/dist/{ai-panel-IT54ECVY.js → ai-panel-WFC3WMPW.js} +1 -1
- package/dist/{chunk-F3X63X7H.js → chunk-CWN3SBBP.js} +16 -16
- package/dist/{chunk-QOZR2M2P.cjs → chunk-JF3MUB63.cjs} +16 -16
- package/dist/index.cjs +80 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +78 -69
- package/dist/styles.css +15 -6
- package/package.json +3 -3
- package/dist/ai-panel-BMU7IXKB.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ A release listed with no entries carried no Conventional Commit in this package'
|
|
|
7
7
|
scope: scripts/release-plan.mjs re-releases a package whenever any of its files
|
|
8
8
|
change, not only on conventional ones.
|
|
9
9
|
|
|
10
|
+
## [2.0.2](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.0.2) - 2026-08-22
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **shared,angular:** Stop the stroke overlay inventing outlines, and finish the Angular whitespace fix (by @ChristopherVR) ([20d4d17](https://github.com/ChristopherVR/pptx-viewer/commit/20d4d177fee97b5f4452a0da739fd51ebaa9e183))
|
|
15
|
+
|
|
10
16
|
## [2.0.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.0.1) - 2026-08-22
|
|
11
17
|
|
|
12
18
|
### Bug Fixes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkJF3MUB63_cjs=require('./chunk-JF3MUB63.cjs');require('./chunk-4VDLQK6F.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkJF3MUB63_cjs.Pk(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkJF3MUB63_cjs._k(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-focus-row"),f=chunkJF3MUB63_cjs.Pk(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkJF3MUB63_cjs.Kk(p,o.getSlides())){let b=chunkJF3MUB63_cjs.Pk(t,"span","pptxv-ai-focus-chip");(m||l)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l){let r=chunkJF3MUB63_cjs.Pk(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-focus-actions"),d=chunkJF3MUB63_cjs.Lk(p,o.getSlides());if(d){let r=chunkJF3MUB63_cjs.Pk(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkJF3MUB63_cjs._k(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkJF3MUB63_cjs.Mk(d.slideIndex,d.elementIdA,d.elementIdB))),C.appendChild(r);}let y=h("crosshair",n("pptx.ai.pickElement"),()=>s?i.stopPicking():i.startPicking());if(y.setAttribute("aria-pressed",String(s)),y.classList.toggle("is-active",s),C.appendChild(y),m?C.appendChild(h("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):l?C.appendChild(h("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):C.appendChild(h("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),g.appendChild(C),a.appendChild(g),s){let r=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-focus-pick"),b=chunkJF3MUB63_cjs._k(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkJF3MUB63_cjs.Pk(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkJF3MUB63_cjs.Pk(t,"button","pptxv-ai-focus-pick-done");T.type="button",T.textContent=n("pptx.ai.pickDone"),T.addEventListener("click",()=>i.stopPicking()),r.append(b,k,T),a.appendChild(r);}},c=i.subscribe(x);return x(),{el:a,destroy(){c(),a.remove();}}}function O(o){let{doc:t,t:n}=o,i=chunkJF3MUB63_cjs.Pk(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkJF3MUB63_cjs._k(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-history-head"),x=chunkJF3MUB63_cjs.Pk(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkJF3MUB63_cjs.Pk(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkJF3MUB63_cjs._k(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-history-body"),m=chunkJF3MUB63_cjs.Pk(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkJF3MUB63_cjs.el({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=chunkJF3MUB63_cjs.Pk(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkJF3MUB63_cjs.Pk(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkJF3MUB63_cjs.Pk(t,"li","pptxv-ai-history-row"),r=chunkJF3MUB63_cjs.Pk(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkJF3MUB63_cjs.Pk(t,"span","pptxv-ai-history-text"),k=chunkJF3MUB63_cjs.Pk(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkJF3MUB63_cjs.Pk(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkJF3MUB63_cjs._k(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkJF3MUB63_cjs.Pk(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n("pptx.ai.deleteChat"),P.setAttribute("aria-label",n("pptx.ai.deleteChat")),P.appendChild(chunkJF3MUB63_cjs._k(t,"trash")),P.addEventListener("click",()=>{l.deleteChat(d.id);}),y.append(r,P),C.appendChild(y);}p.appendChild(C);}s(),i.addEventListener("click",()=>{a.hidden=!a.hidden;}),c.addEventListener("click",()=>{l.newChat(),a.hidden=true;});let g=f=>{a.hidden||!(f.target instanceof Node)||!a.contains(f.target)&&!i.contains(f.target)&&(a.hidden=true);};return t.addEventListener("mousedown",g),{button:i,el:a,notifyMessagesChanged:()=>l.notifyMessagesChanged(),destroy(){t.removeEventListener("mousedown",g),l.dispose(),i.remove(),a.remove();}}}var _={view:"eye",text:"text-box",shape:"shapes",theme:"font-color",table:"table",slide:"layout",chart:"chart",move:"move-right",delete:"trash",search:"search",nav:"move-right",animation:"play",notes:"sticky-note",tool:"wrench"};function W(o,t,n){let i=t.state==="output-error",a=t.state==="output-available",h=!i&&!a,x=chunkJF3MUB63_cjs.jl(t.toolName,t.input,h?"present":"past"),c=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-tool"),p=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-tool-head"),m=chunkJF3MUB63_cjs._k(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkJF3MUB63_cjs.Pk(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkJF3MUB63_cjs.Pk(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkJF3MUB63_cjs._k(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkJF3MUB63_cjs._k(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s.classList.add("is-running"),s.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s),c.appendChild(p),i&&t.errorText){let f=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkJF3MUB63_cjs.il(t.input);if(g){let f=chunkJF3MUB63_cjs.Pk(o,"details","pptxv-ai-tool-details"),C=chunkJF3MUB63_cjs.Pk(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkJF3MUB63_cjs.hl(t.toolName)}: ${g}`,f.append(C,d),c.appendChild(f);}return c}function q(o,t,n,i){t.replaceChildren();for(let a of n){if(a.role==="system")continue;let h=a.role==="user",x=chunkJF3MUB63_cjs.gl(a);if(x.length===0&&!h)continue;let c=chunkJF3MUB63_cjs.Pk(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkJF3MUB63_cjs._k(o,h?"comment":"sparkles"));let m=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-msg-text");s.textContent=l.text,m.appendChild(s);}else m.appendChild(W(o,l,i));c.append(p,m),t.appendChild(c);}}function G(o,t,n,i,a){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let h=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-proposals-header"),x=chunkJF3MUB63_cjs.Pk(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkJF3MUB63_cjs.Pk(o,"button","pptxv-ai-proposal-btn is-accept-all");c.type="button",c.textContent=i("pptx.ai.acceptAll"),c.addEventListener("click",()=>a.acceptAll()),h.appendChild(c);}t.appendChild(h);for(let c of n)t.appendChild(tt(o,c,i,a));}function tt(o,t,n,i){let a=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkJF3MUB63_cjs.Pk(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkJF3MUB63_cjs.Pk(o,"li");g.textContent=chunkJF3MUB63_cjs.al(s),l.appendChild(g);}a.appendChild(l);}let c=chunkJF3MUB63_cjs.Pk(o,"div","pptxv-ai-proposal-actions"),p=chunkJF3MUB63_cjs.Pk(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkJF3MUB63_cjs._k(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkJF3MUB63_cjs.Pk(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkJF3MUB63_cjs._k(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c.append(p,m),a.appendChild(c),a}async function wt(o){let{doc:t,host:n,t:i}=o;n.replaceChildren();let a=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-header"),h=chunkJF3MUB63_cjs.Pk(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkJF3MUB63_cjs.Pk(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkJF3MUB63_cjs._k(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkJF3MUB63_cjs._k(t,"sparkles"),h,x);let c,p=o.controller,m=p?K({doc:t,t:i,controller:p,getSlides:()=>o.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkJF3MUB63_cjs.Pk(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkJF3MUB63_cjs.Pk(t,"form","pptxv-ai-composer"),d=chunkJF3MUB63_cjs.Pk(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkJF3MUB63_cjs.Pk(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkJF3MUB63_cjs._k(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkJF3MUB63_cjs.fl)({bridge:o.bridge,config:o.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t,t:i,deckId:chunkJF3MUB63_cjs.dl(o.bridge),store:o.historyStore,getMessages:()=>r.getSnapshot().messages,setMessages:u=>r.setMessages(u)});a.insertBefore(b.button,x),n.appendChild(b.el);let k=r.subscribe(()=>b.notifyMessagesChanged()),T=new Set,P=u=>{if(!p)return;let A=u.messages.flatMap(Y=>chunkJF3MUB63_cjs.gl(Y).filter(Z=>Z.kind==="tool")).at(-1);if(!A||A.kind!=="tool"||A.state==="input-streaming"||T.has(A.toolCallId))return;T.add(A.toolCallId);let L=chunkJF3MUB63_cjs.kl(A.toolName,A.input);L&&L.slideIndex!==void 0&&o.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t,g,r.proposals.list(),i,{accept:A=>{p?.flashToolTarget(null),r.proposals.apply(A),M(r.getSnapshot());},reject:A=>{r.proposals.revert(A),M(r.getSnapshot());},acceptAll:()=>{p?.flashToolTarget(null),r.proposals.acceptAll(),M(r.getSnapshot());}});let w=u.status==="submitted"||u.status==="streaming";n.classList.toggle("is-busy",w),y.setAttribute("aria-label",i(w?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!u.error,f.textContent=u.error?i("pptx.ai.errorPrefix"):"",l.scrollTop=l.scrollHeight,P(u);},S=()=>{if(n.classList.contains("is-busy")){r.stop();return}let u=d.value.trim();u&&(d.value="",r.sendMessage(u));};C.addEventListener("submit",u=>{u.preventDefault(),S();}),d.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),S());});let I=p?.getPrefill().nonce??0,J=()=>{if(!p)return;let u=p.getPrefill();u.nonce!==I&&(I=u.nonce,d.value=u.text,d.focus());},Q=p?.subscribe(J),X=r.subscribe(M);return M(r.getSnapshot()),{changeAnimator:r.changeAnimator,destroy(){X(),k(),b.destroy(),Q?.(),m?.destroy(),n.replaceChildren();}}}exports.createAiPanel=wt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {Ok,Zk,el,cl,dl,fl,jl,Jk,Kk,Lk,il,hl,gl,$k}from'./chunk-F3X63X7H.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Ok(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Ok(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(Zk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=Ok(t,"div","pptxv-ai-focus-row"),f=Ok(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Jk(p,o.getSlides())){let b=Ok(t,"span","pptxv-ai-focus-chip");(m||l)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l){let r=Ok(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Ok(t,"div","pptxv-ai-focus-actions"),d=Kk(p,o.getSlides());if(d){let r=Ok(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(Zk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Lk(d.slideIndex,d.elementIdA,d.elementIdB))),C.appendChild(r);}let y=h("crosshair",n("pptx.ai.pickElement"),()=>s?i.stopPicking():i.startPicking());if(y.setAttribute("aria-pressed",String(s)),y.classList.toggle("is-active",s),C.appendChild(y),m?C.appendChild(h("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):l?C.appendChild(h("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):C.appendChild(h("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),g.appendChild(C),a.appendChild(g),s){let r=Ok(t,"div","pptxv-ai-focus-pick"),b=Zk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Ok(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Ok(t,"button","pptxv-ai-focus-pick-done");T.type="button",T.textContent=n("pptx.ai.pickDone"),T.addEventListener("click",()=>i.stopPicking()),r.append(b,k,T),a.appendChild(r);}},c=i.subscribe(x);return x(),{el:a,destroy(){c(),a.remove();}}}function O(o){let{doc:t,t:n}=o,i=Ok(t,"button","pptxv-ai-chats");i.type="button",i.append(Zk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Ok(t,"div","pptxv-ai-history");a.hidden=true;let h=Ok(t,"div","pptxv-ai-history-head"),x=Ok(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Ok(t,"button","pptxv-ai-history-new");c.type="button",c.append(Zk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Ok(t,"div","pptxv-ai-history-body"),m=Ok(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=dl({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=Ok(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Ok(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Ok(t,"li","pptxv-ai-history-row"),r=Ok(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Ok(t,"span","pptxv-ai-history-text"),k=Ok(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Ok(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(Zk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Ok(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n("pptx.ai.deleteChat"),P.setAttribute("aria-label",n("pptx.ai.deleteChat")),P.appendChild(Zk(t,"trash")),P.addEventListener("click",()=>{l.deleteChat(d.id);}),y.append(r,P),C.appendChild(y);}p.appendChild(C);}s(),i.addEventListener("click",()=>{a.hidden=!a.hidden;}),c.addEventListener("click",()=>{l.newChat(),a.hidden=true;});let g=f=>{a.hidden||!(f.target instanceof Node)||!a.contains(f.target)&&!i.contains(f.target)&&(a.hidden=true);};return t.addEventListener("mousedown",g),{button:i,el:a,notifyMessagesChanged:()=>l.notifyMessagesChanged(),destroy(){t.removeEventListener("mousedown",g),l.dispose(),i.remove(),a.remove();}}}var _={view:"eye",text:"text-box",shape:"shapes",theme:"font-color",table:"table",slide:"layout",chart:"chart",move:"move-right",delete:"trash",search:"search",nav:"move-right",animation:"play",notes:"sticky-note",tool:"wrench"};function W(o,t,n){let i=t.state==="output-error",a=t.state==="output-available",h=!i&&!a,x=il(t.toolName,t.input,h?"present":"past"),c=Ok(o,"div","pptxv-ai-tool"),p=Ok(o,"div","pptxv-ai-tool-head"),m=Zk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Ok(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Ok(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(Zk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(Zk(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s.classList.add("is-running"),s.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s),c.appendChild(p),i&&t.errorText){let f=Ok(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=hl(t.input);if(g){let f=Ok(o,"details","pptxv-ai-tool-details"),C=Ok(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Ok(o,"div","pptxv-ai-tool-raw");d.textContent=`${gl(t.toolName)}: ${g}`,f.append(C,d),c.appendChild(f);}return c}function q(o,t,n,i){t.replaceChildren();for(let a of n){if(a.role==="system")continue;let h=a.role==="user",x=fl(a);if(x.length===0&&!h)continue;let c=Ok(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Ok(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(Zk(o,h?"comment":"sparkles"));let m=Ok(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Ok(o,"div","pptxv-ai-msg-text");s.textContent=l.text,m.appendChild(s);}else m.appendChild(W(o,l,i));c.append(p,m),t.appendChild(c);}}function G(o,t,n,i,a){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let h=Ok(o,"div","pptxv-ai-proposals-header"),x=Ok(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Ok(o,"button","pptxv-ai-proposal-btn is-accept-all");c.type="button",c.textContent=i("pptx.ai.acceptAll"),c.addEventListener("click",()=>a.acceptAll()),h.appendChild(c);}t.appendChild(h);for(let c of n)t.appendChild(tt(o,c,i,a));}function tt(o,t,n,i){let a=Ok(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Ok(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Ok(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Ok(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Ok(o,"li");g.textContent=$k(s),l.appendChild(g);}a.appendChild(l);}let c=Ok(o,"div","pptxv-ai-proposal-actions"),p=Ok(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(Zk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Ok(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(Zk(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c.append(p,m),a.appendChild(c),a}async function wt(o){let{doc:t,host:n,t:i}=o;n.replaceChildren();let a=Ok(t,"div","pptxv-ai-header"),h=Ok(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Ok(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(Zk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(Zk(t,"sparkles"),h,x);let c,p=o.controller,m=p?K({doc:t,t:i,controller:p,getSlides:()=>o.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=Ok(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Ok(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Ok(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Ok(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Ok(t,"form","pptxv-ai-composer"),d=Ok(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Ok(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(Zk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??el)({bridge:o.bridge,config:o.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t,t:i,deckId:cl(o.bridge),store:o.historyStore,getMessages:()=>r.getSnapshot().messages,setMessages:u=>r.setMessages(u)});a.insertBefore(b.button,x),n.appendChild(b.el);let k=r.subscribe(()=>b.notifyMessagesChanged()),T=new Set,P=u=>{if(!p)return;let A=u.messages.flatMap(Y=>fl(Y).filter(Z=>Z.kind==="tool")).at(-1);if(!A||A.kind!=="tool"||A.state==="input-streaming"||T.has(A.toolCallId))return;T.add(A.toolCallId);let L=jl(A.toolName,A.input);L&&L.slideIndex!==void 0&&o.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t,g,r.proposals.list(),i,{accept:A=>{p?.flashToolTarget(null),r.proposals.apply(A),M(r.getSnapshot());},reject:A=>{r.proposals.revert(A),M(r.getSnapshot());},acceptAll:()=>{p?.flashToolTarget(null),r.proposals.acceptAll(),M(r.getSnapshot());}});let w=u.status==="submitted"||u.status==="streaming";n.classList.toggle("is-busy",w),y.setAttribute("aria-label",i(w?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!u.error,f.textContent=u.error?i("pptx.ai.errorPrefix"):"",l.scrollTop=l.scrollHeight,P(u);},S=()=>{if(n.classList.contains("is-busy")){r.stop();return}let u=d.value.trim();u&&(d.value="",r.sendMessage(u));};C.addEventListener("submit",u=>{u.preventDefault(),S();}),d.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),S());});let I=p?.getPrefill().nonce??0,J=()=>{if(!p)return;let u=p.getPrefill();u.nonce!==I&&(I=u.nonce,d.value=u.text,d.focus());},Q=p?.subscribe(J),X=r.subscribe(M);return M(r.getSnapshot()),{changeAnimator:r.changeAnimator,destroy(){X(),k(),b.destroy(),Q?.(),m?.destroy(),n.replaceChildren();}}}export{wt as createAiPanel};
|
|
1
|
+
import {Pk,_k,fl,dl,el,gl,kl,Kk,Lk,Mk,jl,il,hl,al}from'./chunk-CWN3SBBP.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Pk(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Pk(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(_k(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=Pk(t,"div","pptxv-ai-focus-row"),f=Pk(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Kk(p,o.getSlides())){let b=Pk(t,"span","pptxv-ai-focus-chip");(m||l)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l){let r=Pk(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Pk(t,"div","pptxv-ai-focus-actions"),d=Lk(p,o.getSlides());if(d){let r=Pk(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(_k(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Mk(d.slideIndex,d.elementIdA,d.elementIdB))),C.appendChild(r);}let y=h("crosshair",n("pptx.ai.pickElement"),()=>s?i.stopPicking():i.startPicking());if(y.setAttribute("aria-pressed",String(s)),y.classList.toggle("is-active",s),C.appendChild(y),m?C.appendChild(h("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):l?C.appendChild(h("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):C.appendChild(h("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),g.appendChild(C),a.appendChild(g),s){let r=Pk(t,"div","pptxv-ai-focus-pick"),b=_k(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Pk(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Pk(t,"button","pptxv-ai-focus-pick-done");T.type="button",T.textContent=n("pptx.ai.pickDone"),T.addEventListener("click",()=>i.stopPicking()),r.append(b,k,T),a.appendChild(r);}},c=i.subscribe(x);return x(),{el:a,destroy(){c(),a.remove();}}}function O(o){let{doc:t,t:n}=o,i=Pk(t,"button","pptxv-ai-chats");i.type="button",i.append(_k(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Pk(t,"div","pptxv-ai-history");a.hidden=true;let h=Pk(t,"div","pptxv-ai-history-head"),x=Pk(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Pk(t,"button","pptxv-ai-history-new");c.type="button",c.append(_k(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Pk(t,"div","pptxv-ai-history-body"),m=Pk(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=el({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=Pk(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Pk(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Pk(t,"li","pptxv-ai-history-row"),r=Pk(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Pk(t,"span","pptxv-ai-history-text"),k=Pk(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Pk(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(_k(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Pk(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n("pptx.ai.deleteChat"),P.setAttribute("aria-label",n("pptx.ai.deleteChat")),P.appendChild(_k(t,"trash")),P.addEventListener("click",()=>{l.deleteChat(d.id);}),y.append(r,P),C.appendChild(y);}p.appendChild(C);}s(),i.addEventListener("click",()=>{a.hidden=!a.hidden;}),c.addEventListener("click",()=>{l.newChat(),a.hidden=true;});let g=f=>{a.hidden||!(f.target instanceof Node)||!a.contains(f.target)&&!i.contains(f.target)&&(a.hidden=true);};return t.addEventListener("mousedown",g),{button:i,el:a,notifyMessagesChanged:()=>l.notifyMessagesChanged(),destroy(){t.removeEventListener("mousedown",g),l.dispose(),i.remove(),a.remove();}}}var _={view:"eye",text:"text-box",shape:"shapes",theme:"font-color",table:"table",slide:"layout",chart:"chart",move:"move-right",delete:"trash",search:"search",nav:"move-right",animation:"play",notes:"sticky-note",tool:"wrench"};function W(o,t,n){let i=t.state==="output-error",a=t.state==="output-available",h=!i&&!a,x=jl(t.toolName,t.input,h?"present":"past"),c=Pk(o,"div","pptxv-ai-tool"),p=Pk(o,"div","pptxv-ai-tool-head"),m=_k(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Pk(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Pk(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(_k(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(_k(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s.classList.add("is-running"),s.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s),c.appendChild(p),i&&t.errorText){let f=Pk(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=il(t.input);if(g){let f=Pk(o,"details","pptxv-ai-tool-details"),C=Pk(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Pk(o,"div","pptxv-ai-tool-raw");d.textContent=`${hl(t.toolName)}: ${g}`,f.append(C,d),c.appendChild(f);}return c}function q(o,t,n,i){t.replaceChildren();for(let a of n){if(a.role==="system")continue;let h=a.role==="user",x=gl(a);if(x.length===0&&!h)continue;let c=Pk(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Pk(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(_k(o,h?"comment":"sparkles"));let m=Pk(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Pk(o,"div","pptxv-ai-msg-text");s.textContent=l.text,m.appendChild(s);}else m.appendChild(W(o,l,i));c.append(p,m),t.appendChild(c);}}function G(o,t,n,i,a){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let h=Pk(o,"div","pptxv-ai-proposals-header"),x=Pk(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Pk(o,"button","pptxv-ai-proposal-btn is-accept-all");c.type="button",c.textContent=i("pptx.ai.acceptAll"),c.addEventListener("click",()=>a.acceptAll()),h.appendChild(c);}t.appendChild(h);for(let c of n)t.appendChild(tt(o,c,i,a));}function tt(o,t,n,i){let a=Pk(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Pk(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Pk(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Pk(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Pk(o,"li");g.textContent=al(s),l.appendChild(g);}a.appendChild(l);}let c=Pk(o,"div","pptxv-ai-proposal-actions"),p=Pk(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(_k(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Pk(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(_k(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c.append(p,m),a.appendChild(c),a}async function wt(o){let{doc:t,host:n,t:i}=o;n.replaceChildren();let a=Pk(t,"div","pptxv-ai-header"),h=Pk(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Pk(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(_k(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(_k(t,"sparkles"),h,x);let c,p=o.controller,m=p?K({doc:t,t:i,controller:p,getSlides:()=>o.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=Pk(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Pk(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Pk(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Pk(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Pk(t,"form","pptxv-ai-composer"),d=Pk(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Pk(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(_k(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??fl)({bridge:o.bridge,config:o.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t,t:i,deckId:dl(o.bridge),store:o.historyStore,getMessages:()=>r.getSnapshot().messages,setMessages:u=>r.setMessages(u)});a.insertBefore(b.button,x),n.appendChild(b.el);let k=r.subscribe(()=>b.notifyMessagesChanged()),T=new Set,P=u=>{if(!p)return;let A=u.messages.flatMap(Y=>gl(Y).filter(Z=>Z.kind==="tool")).at(-1);if(!A||A.kind!=="tool"||A.state==="input-streaming"||T.has(A.toolCallId))return;T.add(A.toolCallId);let L=kl(A.toolName,A.input);L&&L.slideIndex!==void 0&&o.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t,g,r.proposals.list(),i,{accept:A=>{p?.flashToolTarget(null),r.proposals.apply(A),M(r.getSnapshot());},reject:A=>{r.proposals.revert(A),M(r.getSnapshot());},acceptAll:()=>{p?.flashToolTarget(null),r.proposals.acceptAll(),M(r.getSnapshot());}});let w=u.status==="submitted"||u.status==="streaming";n.classList.toggle("is-busy",w),y.setAttribute("aria-label",i(w?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!u.error,f.textContent=u.error?i("pptx.ai.errorPrefix"):"",l.scrollTop=l.scrollHeight,P(u);},S=()=>{if(n.classList.contains("is-busy")){r.stop();return}let u=d.value.trim();u&&(d.value="",r.sendMessage(u));};C.addEventListener("submit",u=>{u.preventDefault(),S();}),d.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),S());});let I=p?.getPrefill().nonce??0,J=()=>{if(!p)return;let u=p.getPrefill();u.nonce!==I&&(I=u.nonce,d.value=u.text,d.focus());},Q=p?.subscribe(J),X=r.subscribe(M);return M(r.getSnapshot()),{changeAnimator:r.changeAnimator,destroy(){X(),k(),b.destroy(),Q?.(),m?.destroy(),n.replaceChildren();}}}export{wt as createAiPanel};
|