pptx-vanilla-viewer 1.21.2 → 1.21.4
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 +16 -0
- package/dist/ai-panel-IJVQVULP.cjs +1 -0
- package/dist/{ai-panel-2F6TT6PK.js → ai-panel-XPL4J6JM.js} +1 -1
- package/dist/{chunk-ISR7BSAD.js → chunk-3RIZ7ZZ6.js} +170 -170
- package/dist/{chunk-4OMYSRD3.cjs → chunk-FHNV5FVA.cjs} +170 -170
- package/dist/index.cjs +136 -85
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +135 -84
- package/dist/styles.css +56 -5
- package/package.json +1 -1
- package/dist/ai-panel-MM5OHX2R.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@ 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.3](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.21.3) - 2026-08-14
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **shared:** Run an in-place morph dissolve on the wrapper, not the element (by @ChristopherVR) ([d46d2ee](https://github.com/ChristopherVR/pptx-viewer/commit/d46d2eea5aeced925f1b51b4be2758f2b634ea3e))
|
|
15
|
+
|
|
16
|
+
## [1.21.2](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.21.2) - 2026-08-14
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
- **shared:** Sum a morph cross-dissolve instead of stacking two fades (by @ChristopherVR) ([86a9e7a](https://github.com/ChristopherVR/pptx-viewer/commit/86a9e7a2ab851d7b0005ab2d1c2267f668b308a8))
|
|
21
|
+
|
|
22
|
+
### Testing
|
|
23
|
+
|
|
24
|
+
- Mask the fields that legitimately move, and size two waits for CI (by @ChristopherVR) ([68bae19](https://github.com/ChristopherVR/pptx-viewer/commit/68bae19fe8cb3e283e2c87a90d31946c48be5e3a))
|
|
25
|
+
|
|
10
26
|
## [1.21.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.21.1) - 2026-08-14
|
|
11
27
|
|
|
12
28
|
### Bug Fixes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkFHNV5FVA_cjs=require('./chunk-FHNV5FVA.cjs');require('./chunk-4VDLQK6F.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkFHNV5FVA_cjs.Zj(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkFHNV5FVA_cjs.hk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-focus-row"),f=chunkFHNV5FVA_cjs.Zj(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkFHNV5FVA_cjs.Uj(p,o.getSlides())){let b=chunkFHNV5FVA_cjs.Zj(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=chunkFHNV5FVA_cjs.Zj(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-focus-actions"),d=chunkFHNV5FVA_cjs.Vj(p,o.getSlides());if(d){let r=chunkFHNV5FVA_cjs.Zj(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkFHNV5FVA_cjs.hk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkFHNV5FVA_cjs.Wj(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=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-focus-pick"),b=chunkFHNV5FVA_cjs.hk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkFHNV5FVA_cjs.Zj(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkFHNV5FVA_cjs.Zj(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=chunkFHNV5FVA_cjs.Zj(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkFHNV5FVA_cjs.hk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-history-head"),x=chunkFHNV5FVA_cjs.Zj(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkFHNV5FVA_cjs.Zj(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkFHNV5FVA_cjs.hk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-history-body"),m=chunkFHNV5FVA_cjs.Zj(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkFHNV5FVA_cjs.nk({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=chunkFHNV5FVA_cjs.Zj(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkFHNV5FVA_cjs.Zj(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkFHNV5FVA_cjs.Zj(t,"li","pptxv-ai-history-row"),r=chunkFHNV5FVA_cjs.Zj(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkFHNV5FVA_cjs.Zj(t,"span","pptxv-ai-history-text"),k=chunkFHNV5FVA_cjs.Zj(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkFHNV5FVA_cjs.Zj(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkFHNV5FVA_cjs.hk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkFHNV5FVA_cjs.Zj(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(chunkFHNV5FVA_cjs.hk(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=chunkFHNV5FVA_cjs.sk(t.toolName,t.input,h?"present":"past"),c=chunkFHNV5FVA_cjs.Zj(o,"div","pptxv-ai-tool"),p=chunkFHNV5FVA_cjs.Zj(o,"div","pptxv-ai-tool-head"),m=chunkFHNV5FVA_cjs.hk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkFHNV5FVA_cjs.Zj(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkFHNV5FVA_cjs.Zj(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkFHNV5FVA_cjs.hk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkFHNV5FVA_cjs.hk(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=chunkFHNV5FVA_cjs.Zj(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkFHNV5FVA_cjs.rk(t.input);if(g){let f=chunkFHNV5FVA_cjs.Zj(o,"details","pptxv-ai-tool-details"),C=chunkFHNV5FVA_cjs.Zj(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkFHNV5FVA_cjs.Zj(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkFHNV5FVA_cjs.qk(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=chunkFHNV5FVA_cjs.pk(a);if(x.length===0&&!h)continue;let c=chunkFHNV5FVA_cjs.Zj(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkFHNV5FVA_cjs.Zj(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkFHNV5FVA_cjs.hk(o,h?"comment":"sparkles"));let m=chunkFHNV5FVA_cjs.Zj(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkFHNV5FVA_cjs.Zj(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=chunkFHNV5FVA_cjs.Zj(o,"div","pptxv-ai-proposals-header"),x=chunkFHNV5FVA_cjs.Zj(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkFHNV5FVA_cjs.Zj(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=chunkFHNV5FVA_cjs.Zj(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkFHNV5FVA_cjs.Zj(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkFHNV5FVA_cjs.Zj(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkFHNV5FVA_cjs.Zj(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkFHNV5FVA_cjs.Zj(o,"li");g.textContent=chunkFHNV5FVA_cjs.jk(s),l.appendChild(g);}a.appendChild(l);}let c=chunkFHNV5FVA_cjs.Zj(o,"div","pptxv-ai-proposal-actions"),p=chunkFHNV5FVA_cjs.Zj(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkFHNV5FVA_cjs.hk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkFHNV5FVA_cjs.Zj(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkFHNV5FVA_cjs.hk(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=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-header"),h=chunkFHNV5FVA_cjs.Zj(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkFHNV5FVA_cjs.Zj(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkFHNV5FVA_cjs.hk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkFHNV5FVA_cjs.hk(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=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkFHNV5FVA_cjs.Zj(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkFHNV5FVA_cjs.Zj(t,"form","pptxv-ai-composer"),d=chunkFHNV5FVA_cjs.Zj(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkFHNV5FVA_cjs.Zj(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkFHNV5FVA_cjs.hk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkFHNV5FVA_cjs.ok)({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:chunkFHNV5FVA_cjs.mk(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=>chunkFHNV5FVA_cjs.pk(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=chunkFHNV5FVA_cjs.tk(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 {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};
|
|
1
|
+
import {Zj,hk,ok,mk,nk,pk,tk,Uj,Vj,Wj,sk,rk,qk,jk}from'./chunk-3RIZ7ZZ6.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Zj(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Zj(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(hk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=Zj(t,"div","pptxv-ai-focus-row"),f=Zj(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Uj(p,o.getSlides())){let b=Zj(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=Zj(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Zj(t,"div","pptxv-ai-focus-actions"),d=Vj(p,o.getSlides());if(d){let r=Zj(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(hk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Wj(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=Zj(t,"div","pptxv-ai-focus-pick"),b=hk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Zj(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Zj(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=Zj(t,"button","pptxv-ai-chats");i.type="button",i.append(hk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Zj(t,"div","pptxv-ai-history");a.hidden=true;let h=Zj(t,"div","pptxv-ai-history-head"),x=Zj(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Zj(t,"button","pptxv-ai-history-new");c.type="button",c.append(hk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Zj(t,"div","pptxv-ai-history-body"),m=Zj(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=nk({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=Zj(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Zj(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Zj(t,"li","pptxv-ai-history-row"),r=Zj(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Zj(t,"span","pptxv-ai-history-text"),k=Zj(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Zj(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(hk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Zj(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(hk(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=sk(t.toolName,t.input,h?"present":"past"),c=Zj(o,"div","pptxv-ai-tool"),p=Zj(o,"div","pptxv-ai-tool-head"),m=hk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Zj(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Zj(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(hk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(hk(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=Zj(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=rk(t.input);if(g){let f=Zj(o,"details","pptxv-ai-tool-details"),C=Zj(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Zj(o,"div","pptxv-ai-tool-raw");d.textContent=`${qk(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=pk(a);if(x.length===0&&!h)continue;let c=Zj(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Zj(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(hk(o,h?"comment":"sparkles"));let m=Zj(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Zj(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=Zj(o,"div","pptxv-ai-proposals-header"),x=Zj(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Zj(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=Zj(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Zj(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Zj(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Zj(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Zj(o,"li");g.textContent=jk(s),l.appendChild(g);}a.appendChild(l);}let c=Zj(o,"div","pptxv-ai-proposal-actions"),p=Zj(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(hk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Zj(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(hk(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=Zj(t,"div","pptxv-ai-header"),h=Zj(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Zj(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(hk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(hk(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=Zj(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Zj(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Zj(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Zj(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Zj(t,"form","pptxv-ai-composer"),d=Zj(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Zj(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(hk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??ok)({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:mk(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=>pk(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=tk(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};
|