pptx-vanilla-viewer 2.1.1 → 2.1.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/dist/styles.css CHANGED
@@ -170,9 +170,17 @@
170
170
  .pptxv-titlebar-dot { color: var(--pptx-muted-foreground); }
171
171
  .pptxv-titlebar-status.is-error { color: #dc2626; }
172
172
  .pptxv-titlebar-status.is-saving { color: #ca8a04; }
173
- .pptxv-titlebar-search { position: absolute; left: 50%; width: min(320px, 30vw); transform: translateX(-50%); }
174
- .pptxv-titlebar-spacer { flex: 1; min-width: 20px; }
175
- .pptxv-cmdsearch { position: relative; width: 100%; }
173
+ /*
174
+ * Flex-based centering (not position:absolute + left:50%): an absolutely
175
+ * positioned box centers on the FULL bar width regardless of how much room
176
+ * the file name / status text on the left actually uses, so a longer status
177
+ * message (e.g. "Saved to this PC") gets visually covered by the search box
178
+ * instead of the two ever sharing space. flex:1 here reserves the real
179
+ * remaining width between the file group and the bar's end, and centers the
180
+ * search box within that.
181
+ */
182
+ .pptxv-titlebar-search { flex: 1 1 auto; display: flex; justify-content: center; min-width: 20px; }
183
+ .pptxv-cmdsearch { position: relative; width: min(320px, 30vw); }
176
184
  .pptxv-cmdsearch-box { display: flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 1px solid var(--pptx-border); border-radius: 4px; background: var(--pptx-muted); color: var(--pptx-muted-foreground); }
177
185
  .pptxv-cmdsearch-box svg { width: 13px; height: 13px; flex: none; }
178
186
  .pptxv-cmdsearch-input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--pptx-foreground); font: inherit; }
@@ -181,7 +189,47 @@
181
189
  .pptxv-cmdsearch-item { cursor: pointer; }
182
190
  .pptxv-cmdsearch-item:hover { background: var(--pptx-accent); color: var(--pptx-accent-foreground); }
183
191
  .pptxv-cmdsearch-empty { color: var(--pptx-muted-foreground); }
184
- @media (max-width: 767px), (max-width: 1023px) and (max-height: 520px) { .pptxv-titlebar { display: none; } }
192
+ @media (max-width: 767px), (max-width: 1023px) and (max-height: 520px) { .pptxv-titlebar, .pptxv-qat-row { display: none; } }
193
+
194
+ /* Quick Access Toolbar docked below the Ribbon (Options > Quick Access
195
+ Toolbar > position); hidden and empty until the strip is moved in. */
196
+ .pptxv-qat-row {
197
+ display: flex;
198
+ align-items: center;
199
+ gap: 4px;
200
+ min-height: 36px;
201
+ padding: 0 8px;
202
+ border-bottom: 1px solid var(--pptx-border);
203
+ background: var(--pptx-card);
204
+ }
205
+ .pptxv-qat-row .pptxv-qat { display: flex; align-items: center; gap: 4px; }
206
+
207
+ /* Trust Center > Protected View banner: PowerPoint's persistent "this file
208
+ is read-only until you Enable Editing" bar under the Ribbon. */
209
+ .pptxv-protected-view {
210
+ display: flex;
211
+ align-items: center;
212
+ gap: 8px;
213
+ padding: 6px 8px;
214
+ background: #fef3c7;
215
+ color: #78350f;
216
+ border-bottom: 1px solid #fcd34d;
217
+ font-size: 11px;
218
+ }
219
+ .pptxv-protected-view svg { width: 16px; height: 16px; flex: none; }
220
+ .pptxv-protected-view-text { flex: 1 1 auto; }
221
+ .pptxv-protected-view-enable {
222
+ flex: none;
223
+ padding: 3px 10px;
224
+ border: 1px solid #b45309;
225
+ border-radius: 4px;
226
+ background: #fff;
227
+ color: #78350f;
228
+ font: inherit;
229
+ font-weight: 600;
230
+ cursor: pointer;
231
+ }
232
+ .pptxv-protected-view-enable:hover { background: #fde68a; }
185
233
 
186
234
  /* ── Body: thumbnail rail + viewport ─────────────────────────────────── */
187
235
  .pptxv-body { display: flex; flex: 1; min-height: 0; }
@@ -740,6 +788,8 @@
740
788
  /* ── Presentation (fullscreen) mode ──────────────────────────────────── */
741
789
  .pptxv.pptxv-presenting .pptxv-ribbon,
742
790
  .pptxv.pptxv-presenting .pptxv-thumbs,
791
+ .pptxv.pptxv-presenting .pptxv-qat-row,
792
+ .pptxv.pptxv-presenting .pptxv-protected-view,
743
793
  .pptxv.pptxv-presenting .pptxv-titlebar { display: none; }
744
794
  /* A show letterboxes the slide in the middle of the black, so the editing
745
795
  canvas's top alignment is overridden back to centred here. */
@@ -1315,7 +1365,7 @@
1315
1365
  .pptxv-ribbon-tab-content {
1316
1366
  display: flex;
1317
1367
  flex-wrap: nowrap;
1318
- align-items: stretch;
1368
+ align-items: center;
1319
1369
  gap: 0;
1320
1370
  min-height: 82px;
1321
1371
  padding: 2px 4px;
@@ -3051,6 +3101,10 @@ label.pptxv-options-row { cursor: pointer; }
3051
3101
  .pptxv.pptxv-no-show-popup .pptxv-presentation-touch-prev,
3052
3102
  .pptxv.pptxv-no-show-popup .pptxv-presentation-touch-next,
3053
3103
  .pptxv.pptxv-no-show-popup .pptxv-presentation-touch-counter { display: none !important; }
3104
+ /* The desktop hover toolbar (createPresentationToolbar) sets its own inline
3105
+ opacity/pointer-events on mousemove; !important here is required to win
3106
+ over that inline style regardless of the JS auto-show timer. */
3107
+ .pptxv.pptxv-no-show-popup .pptxv-present-toolbar-wrap { opacity: 0 !important; pointer-events: none !important; }
3054
3108
  @media (max-width: 767px) { .pptxv-options-body { flex-direction: column; } .pptxv-options-nav { flex-direction: row; width: 100%; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--pptx-border); } }
3055
3109
 
3056
3110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-vanilla-viewer",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Zero-framework PowerPoint viewer and editor: render, edit, present, and export PPTX slides with plain DOM, no React/Vue/Angular required.",
5
5
  "keywords": [
6
6
  "javascript",
@@ -1 +0,0 @@
1
- 'use strict';var chunkUWGSLLDO_cjs=require('./chunk-UWGSLLDO.cjs');require('./chunk-4VDLQK6F.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkUWGSLLDO_cjs.ql(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus-row"),f=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkUWGSLLDO_cjs.al(p,o.getSlides())){let b=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus-actions"),d=chunkUWGSLLDO_cjs.bl(p,o.getSlides());if(d){let r=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkUWGSLLDO_cjs.ql(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkUWGSLLDO_cjs.cl(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=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus-pick"),b=chunkUWGSLLDO_cjs.ql(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkUWGSLLDO_cjs.ql(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-history-head"),x=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkUWGSLLDO_cjs.ql(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-history-body"),m=chunkUWGSLLDO_cjs.fl(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkUWGSLLDO_cjs.wl({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=chunkUWGSLLDO_cjs.fl(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkUWGSLLDO_cjs.fl(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkUWGSLLDO_cjs.fl(t,"li","pptxv-ai-history-row"),r=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-text"),k=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkUWGSLLDO_cjs.ql(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkUWGSLLDO_cjs.fl(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(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.Bl(t.toolName,t.input,h?"present":"past"),c=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool"),p=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool-head"),m=chunkUWGSLLDO_cjs.ql(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkUWGSLLDO_cjs.fl(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkUWGSLLDO_cjs.fl(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkUWGSLLDO_cjs.ql(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkUWGSLLDO_cjs.Al(t.input);if(g){let f=chunkUWGSLLDO_cjs.fl(o,"details","pptxv-ai-tool-details"),C=chunkUWGSLLDO_cjs.fl(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkUWGSLLDO_cjs.zl(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=chunkUWGSLLDO_cjs.yl(a);if(x.length===0&&!h)continue;let c=chunkUWGSLLDO_cjs.fl(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkUWGSLLDO_cjs.ql(o,h?"comment":"sparkles"));let m=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposals-header"),x=chunkUWGSLLDO_cjs.fl(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkUWGSLLDO_cjs.fl(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkUWGSLLDO_cjs.fl(o,"li");g.textContent=chunkUWGSLLDO_cjs.sl(s),l.appendChild(g);}a.appendChild(l);}let c=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal-actions"),p=chunkUWGSLLDO_cjs.fl(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkUWGSLLDO_cjs.ql(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkUWGSLLDO_cjs.fl(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-header"),h=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkUWGSLLDO_cjs.ql(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkUWGSLLDO_cjs.fl(t,"form","pptxv-ai-composer"),d=chunkUWGSLLDO_cjs.fl(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkUWGSLLDO_cjs.ql(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkUWGSLLDO_cjs.xl)({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:chunkUWGSLLDO_cjs.vl(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=>chunkUWGSLLDO_cjs.yl(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=chunkUWGSLLDO_cjs.Cl(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;