pptx-vanilla-viewer 1.21.0 → 1.21.2
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 +17 -0
- package/dist/{ai-panel-PHC7UEPO.js → ai-panel-2F6TT6PK.js} +1 -1
- package/dist/ai-panel-MM5OHX2R.cjs +1 -0
- package/dist/{chunk-QMEIYRIV.cjs → chunk-4OMYSRD3.cjs} +179 -179
- package/dist/{chunk-6Z6L7UDA.js → chunk-ISR7BSAD.js} +179 -179
- package/dist/index.cjs +98 -64
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +97 -63
- package/dist/styles.css +34 -0
- package/package.json +1 -1
- package/dist/ai-panel-ERZ6WNY2.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,23 @@ 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
|
+
## [1.21.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.21.1) - 2026-08-14
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- Repair five regressions this review introduced (by @ChristopherVR) ([952063b](https://github.com/ChristopherVR/pptx-viewer/commit/952063b7c1a198aed9acc0696b2b326deba35e95))
|
|
15
|
+
|
|
16
|
+
## [1.21.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.21.0) - 2026-08-13
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
- **shared:** Take the last six chart kinds and the autosave policy (by @ChristopherVR) ([efe8438](https://github.com/ChristopherVR/pptx-viewer/commit/efe84381688dfb5f2a44a2990e76aa09b65e5fba))
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
- **core:** Repair the XML plumbing four separate defects were hiding behind (by @ChristopherVR) ([8beb664](https://github.com/ChristopherVR/pptx-viewer/commit/8beb66410975d492118120515bbae6cd070ef792))
|
|
25
|
+
- **bindings:** Stop read-only surfaces clobbering live state (by @ChristopherVR) ([e820984](https://github.com/ChristopherVR/pptx-viewer/commit/e8209842fad62819df1530944124f0bfc33e32ec))
|
|
26
|
+
|
|
10
27
|
## [1.20.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.20.0) - 2026-08-13
|
|
11
28
|
|
|
12
29
|
### Bug Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {Vj,ck,jk,hk,ik,kk,ok,Qj,Rj,Sj,nk,mk,lk,ek}from'./chunk-6Z6L7UDA.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Vj(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Vj(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(ck(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=Vj(t,"div","pptxv-ai-focus-row"),f=Vj(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Qj(p,o.getSlides())){let b=Vj(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=Vj(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Vj(t,"div","pptxv-ai-focus-actions"),d=Rj(p,o.getSlides());if(d){let r=Vj(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(ck(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Sj(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=Vj(t,"div","pptxv-ai-focus-pick"),b=ck(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Vj(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Vj(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=Vj(t,"button","pptxv-ai-chats");i.type="button",i.append(ck(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Vj(t,"div","pptxv-ai-history");a.hidden=true;let h=Vj(t,"div","pptxv-ai-history-head"),x=Vj(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Vj(t,"button","pptxv-ai-history-new");c.type="button",c.append(ck(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Vj(t,"div","pptxv-ai-history-body"),m=Vj(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=ik({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=Vj(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Vj(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Vj(t,"li","pptxv-ai-history-row"),r=Vj(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Vj(t,"span","pptxv-ai-history-text"),k=Vj(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Vj(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(ck(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Vj(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(ck(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=nk(t.toolName,t.input,h?"present":"past"),c=Vj(o,"div","pptxv-ai-tool"),p=Vj(o,"div","pptxv-ai-tool-head"),m=ck(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Vj(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Vj(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(ck(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(ck(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=Vj(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=mk(t.input);if(g){let f=Vj(o,"details","pptxv-ai-tool-details"),C=Vj(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Vj(o,"div","pptxv-ai-tool-raw");d.textContent=`${lk(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=kk(a);if(x.length===0&&!h)continue;let c=Vj(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Vj(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(ck(o,h?"comment":"sparkles"));let m=Vj(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Vj(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=Vj(o,"div","pptxv-ai-proposals-header"),x=Vj(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Vj(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=Vj(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Vj(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Vj(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Vj(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Vj(o,"li");g.textContent=ek(s),l.appendChild(g);}a.appendChild(l);}let c=Vj(o,"div","pptxv-ai-proposal-actions"),p=Vj(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(ck(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Vj(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(ck(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=Vj(t,"div","pptxv-ai-header"),h=Vj(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Vj(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(ck(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(ck(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=Vj(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Vj(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Vj(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Vj(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Vj(t,"form","pptxv-ai-composer"),d=Vj(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Vj(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(ck(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??jk)({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:hk(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=>kk(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=ok(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 {Yj,fk,mk,kk,lk,nk,rk,Tj,Uj,Vj,qk,pk,ok,hk}from'./chunk-ISR7BSAD.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Yj(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Yj(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(fk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=Yj(t,"div","pptxv-ai-focus-row"),f=Yj(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Tj(p,o.getSlides())){let b=Yj(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=Yj(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Yj(t,"div","pptxv-ai-focus-actions"),d=Uj(p,o.getSlides());if(d){let r=Yj(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(fk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Vj(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=Yj(t,"div","pptxv-ai-focus-pick"),b=fk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Yj(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Yj(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=Yj(t,"button","pptxv-ai-chats");i.type="button",i.append(fk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Yj(t,"div","pptxv-ai-history");a.hidden=true;let h=Yj(t,"div","pptxv-ai-history-head"),x=Yj(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Yj(t,"button","pptxv-ai-history-new");c.type="button",c.append(fk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Yj(t,"div","pptxv-ai-history-body"),m=Yj(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=lk({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=Yj(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Yj(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Yj(t,"li","pptxv-ai-history-row"),r=Yj(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Yj(t,"span","pptxv-ai-history-text"),k=Yj(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Yj(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(fk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Yj(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(fk(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=qk(t.toolName,t.input,h?"present":"past"),c=Yj(o,"div","pptxv-ai-tool"),p=Yj(o,"div","pptxv-ai-tool-head"),m=fk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Yj(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Yj(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(fk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(fk(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=Yj(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=pk(t.input);if(g){let f=Yj(o,"details","pptxv-ai-tool-details"),C=Yj(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Yj(o,"div","pptxv-ai-tool-raw");d.textContent=`${ok(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=nk(a);if(x.length===0&&!h)continue;let c=Yj(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Yj(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(fk(o,h?"comment":"sparkles"));let m=Yj(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Yj(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=Yj(o,"div","pptxv-ai-proposals-header"),x=Yj(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Yj(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=Yj(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Yj(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Yj(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Yj(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Yj(o,"li");g.textContent=hk(s),l.appendChild(g);}a.appendChild(l);}let c=Yj(o,"div","pptxv-ai-proposal-actions"),p=Yj(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(fk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Yj(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(fk(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=Yj(t,"div","pptxv-ai-header"),h=Yj(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Yj(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(fk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(fk(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=Yj(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Yj(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Yj(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Yj(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Yj(t,"form","pptxv-ai-composer"),d=Yj(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Yj(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(fk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??mk)({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:kk(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=>nk(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=rk(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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk4OMYSRD3_cjs=require('./chunk-4OMYSRD3.cjs');require('./chunk-4VDLQK6F.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunk4OMYSRD3_cjs.Yj(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunk4OMYSRD3_cjs.fk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-focus-row"),f=chunk4OMYSRD3_cjs.Yj(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunk4OMYSRD3_cjs.Tj(p,o.getSlides())){let b=chunk4OMYSRD3_cjs.Yj(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=chunk4OMYSRD3_cjs.Yj(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-focus-actions"),d=chunk4OMYSRD3_cjs.Uj(p,o.getSlides());if(d){let r=chunk4OMYSRD3_cjs.Yj(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunk4OMYSRD3_cjs.fk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunk4OMYSRD3_cjs.Vj(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=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-focus-pick"),b=chunk4OMYSRD3_cjs.fk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunk4OMYSRD3_cjs.Yj(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunk4OMYSRD3_cjs.Yj(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=chunk4OMYSRD3_cjs.Yj(t,"button","pptxv-ai-chats");i.type="button",i.append(chunk4OMYSRD3_cjs.fk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-history");a.hidden=true;let h=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-history-head"),x=chunk4OMYSRD3_cjs.Yj(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunk4OMYSRD3_cjs.Yj(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunk4OMYSRD3_cjs.fk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-history-body"),m=chunk4OMYSRD3_cjs.Yj(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunk4OMYSRD3_cjs.lk({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=chunk4OMYSRD3_cjs.Yj(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunk4OMYSRD3_cjs.Yj(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunk4OMYSRD3_cjs.Yj(t,"li","pptxv-ai-history-row"),r=chunk4OMYSRD3_cjs.Yj(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunk4OMYSRD3_cjs.Yj(t,"span","pptxv-ai-history-text"),k=chunk4OMYSRD3_cjs.Yj(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunk4OMYSRD3_cjs.Yj(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunk4OMYSRD3_cjs.fk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunk4OMYSRD3_cjs.Yj(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(chunk4OMYSRD3_cjs.fk(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=chunk4OMYSRD3_cjs.qk(t.toolName,t.input,h?"present":"past"),c=chunk4OMYSRD3_cjs.Yj(o,"div","pptxv-ai-tool"),p=chunk4OMYSRD3_cjs.Yj(o,"div","pptxv-ai-tool-head"),m=chunk4OMYSRD3_cjs.fk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunk4OMYSRD3_cjs.Yj(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunk4OMYSRD3_cjs.Yj(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunk4OMYSRD3_cjs.fk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunk4OMYSRD3_cjs.fk(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=chunk4OMYSRD3_cjs.Yj(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunk4OMYSRD3_cjs.pk(t.input);if(g){let f=chunk4OMYSRD3_cjs.Yj(o,"details","pptxv-ai-tool-details"),C=chunk4OMYSRD3_cjs.Yj(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunk4OMYSRD3_cjs.Yj(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunk4OMYSRD3_cjs.ok(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=chunk4OMYSRD3_cjs.nk(a);if(x.length===0&&!h)continue;let c=chunk4OMYSRD3_cjs.Yj(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunk4OMYSRD3_cjs.Yj(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunk4OMYSRD3_cjs.fk(o,h?"comment":"sparkles"));let m=chunk4OMYSRD3_cjs.Yj(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunk4OMYSRD3_cjs.Yj(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=chunk4OMYSRD3_cjs.Yj(o,"div","pptxv-ai-proposals-header"),x=chunk4OMYSRD3_cjs.Yj(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunk4OMYSRD3_cjs.Yj(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=chunk4OMYSRD3_cjs.Yj(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunk4OMYSRD3_cjs.Yj(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunk4OMYSRD3_cjs.Yj(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunk4OMYSRD3_cjs.Yj(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunk4OMYSRD3_cjs.Yj(o,"li");g.textContent=chunk4OMYSRD3_cjs.hk(s),l.appendChild(g);}a.appendChild(l);}let c=chunk4OMYSRD3_cjs.Yj(o,"div","pptxv-ai-proposal-actions"),p=chunk4OMYSRD3_cjs.Yj(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunk4OMYSRD3_cjs.fk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunk4OMYSRD3_cjs.Yj(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunk4OMYSRD3_cjs.fk(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=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-header"),h=chunk4OMYSRD3_cjs.Yj(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunk4OMYSRD3_cjs.Yj(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunk4OMYSRD3_cjs.fk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunk4OMYSRD3_cjs.fk(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=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunk4OMYSRD3_cjs.Yj(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunk4OMYSRD3_cjs.Yj(t,"form","pptxv-ai-composer"),d=chunk4OMYSRD3_cjs.Yj(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunk4OMYSRD3_cjs.Yj(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunk4OMYSRD3_cjs.fk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunk4OMYSRD3_cjs.mk)({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:chunk4OMYSRD3_cjs.kk(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=>chunk4OMYSRD3_cjs.nk(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=chunk4OMYSRD3_cjs.rk(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;
|