pptx-vanilla-viewer 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/styles.css CHANGED
@@ -391,6 +391,12 @@
391
391
  .pptxv-notes-textarea:disabled,
392
392
  .pptxv-notes-textarea:read-only { cursor: default; opacity: 0.85; }
393
393
  .pptxv.pptxv-presenting .pptxv-notes { display: none; }
394
+ /* On phones the collapsed strip is pure clutter: the mobile action sheet's
395
+ Notes button is the entry point, so hide the panel entirely until opened
396
+ (React parity). */
397
+ @media (max-width: 767px), (max-width: 1023px) and (max-height: 520px) {
398
+ .pptxv-notes[data-collapsed='true'] { display: none; }
399
+ }
394
400
 
395
401
  /* ── Bottom status bar ──────────────────────────────────────────────── */
396
402
  .pptxv-statusbar {
@@ -1533,6 +1539,43 @@
1533
1539
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
1534
1540
  }
1535
1541
 
1542
+ /* ── Remote-selection overlay ─────────────────────────────────────────── */
1543
+ .pptxv-remote-selections {
1544
+ position: absolute;
1545
+ inset: 0;
1546
+ pointer-events: none;
1547
+ overflow: visible;
1548
+ z-index: 19;
1549
+ }
1550
+ .pptxv-remote-selection {
1551
+ position: absolute;
1552
+ top: 0;
1553
+ left: 0;
1554
+ box-sizing: border-box;
1555
+ border: 2px solid currentcolor;
1556
+ border-radius: 2px;
1557
+ pointer-events: none;
1558
+ will-change: transform;
1559
+ transition: transform 90ms linear;
1560
+ }
1561
+ .pptxv-remote-selection-label {
1562
+ position: absolute;
1563
+ top: -18px;
1564
+ left: -2px;
1565
+ max-width: 150px;
1566
+ padding: 1px 5px;
1567
+ border-radius: 3px;
1568
+ color: #ffffff;
1569
+ font-size: 9px;
1570
+ font-weight: 500;
1571
+ line-height: 1.3;
1572
+ white-space: nowrap;
1573
+ overflow: hidden;
1574
+ text-overflow: ellipsis;
1575
+ pointer-events: none;
1576
+ box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
1577
+ }
1578
+
1536
1579
  /* ── Toolbar collaboration-status pill ───────────────────────────────── */
1537
1580
  .pptxv-collab-status {
1538
1581
  display: inline-flex;
@@ -1564,11 +1607,15 @@
1564
1607
  .pptxv-collab-status-retry[hidden] { display: none; }
1565
1608
 
1566
1609
  /* ── Follow-mode bar ─────────────────────────────────────────────────── */
1610
+ /* Mounted on the position:relative .pptxv root (not the stage wrap): a
1611
+ top-centre pill under the toolbar, matching React's fixed top-2 z-[1100]
1612
+ placement, so it never floats over the slide on small viewports. */
1567
1613
  .pptxv-follow-bar {
1568
1614
  position: absolute;
1569
1615
  left: 50%;
1570
- bottom: 12px;
1571
- z-index: 15;
1616
+ top: 8px;
1617
+ bottom: auto;
1618
+ z-index: 1100;
1572
1619
  display: flex;
1573
1620
  flex-wrap: wrap;
1574
1621
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-vanilla-viewer",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
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 chunkDDUXNMDN_cjs=require('./chunk-DDUXNMDN.cjs');require('./chunk-EWJAZ6TW.cjs'),require('./chunk-4VDLQK6F.cjs');function j(e){let{doc:t,t:n,controller:i}=e,p=chunkDDUXNMDN_cjs.Fe(t,"div","pptxv-ai-focus"),m=(c,s,d)=>{let r=chunkDDUXNMDN_cjs.Fe(t,"button","pptxv-ai-focus-btn");return r.type="button",r.title=s,r.setAttribute("aria-label",s),r.appendChild(chunkDDUXNMDN_cjs.Oe(t,c)),r.addEventListener("click",d),r},x=()=>{p.replaceChildren();let c=i.getEffectiveTargets(),s=i.hasPicks(),d=i.isPinned(),r=i.isPicking(),f=chunkDDUXNMDN_cjs.Fe(t,"div","pptxv-ai-focus-row"),b=chunkDDUXNMDN_cjs.Fe(t,"span","pptxv-ai-focus-label");b.textContent=n("pptx.ai.focusScope"),f.appendChild(b);for(let h of chunkDDUXNMDN_cjs.Ae(c,e.getSlides())){let T=chunkDDUXNMDN_cjs.Fe(t,"span","pptxv-ai-focus-chip");(s||d)&&T.classList.add("is-strong"),T.title=h.title,T.textContent=h.label,f.appendChild(T);}if(d){let h=chunkDDUXNMDN_cjs.Fe(t,"span","pptxv-ai-focus-pinned");h.textContent=n("pptx.ai.pinnedFocus"),f.appendChild(h);}let u=chunkDDUXNMDN_cjs.Fe(t,"div","pptxv-ai-focus-actions"),C=chunkDDUXNMDN_cjs.Be(c,e.getSlides());if(C){let h=chunkDDUXNMDN_cjs.Fe(t,"button","pptxv-ai-focus-merge");h.type="button",h.append(chunkDDUXNMDN_cjs.Oe(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),h.addEventListener("click",()=>e.onSendDirective(chunkDDUXNMDN_cjs.Ce(C.slideIndex,C.elementIdA,C.elementIdB))),u.appendChild(h);}let v=m("crosshair",n("pptx.ai.pickElement"),()=>r?i.stopPicking():i.startPicking());if(v.setAttribute("aria-pressed",String(r)),v.classList.toggle("is-active",r),u.appendChild(v),s?u.appendChild(m("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):d?u.appendChild(m("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):u.appendChild(m("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),f.appendChild(u),p.appendChild(f),r){let h=chunkDDUXNMDN_cjs.Fe(t,"div","pptxv-ai-focus-pick"),T=chunkDDUXNMDN_cjs.Oe(t,"crosshair");T.classList.add("pptxv-ai-focus-pick-icon");let A=chunkDDUXNMDN_cjs.Fe(t,"span","pptxv-ai-focus-pick-hint");A.textContent=n("pptx.ai.pickElementHint");let P=chunkDDUXNMDN_cjs.Fe(t,"button","pptxv-ai-focus-pick-done");P.type="button",P.textContent=n("pptx.ai.pickDone"),P.addEventListener("click",()=>i.stopPicking()),h.append(T,A,P),p.appendChild(h);}},a=i.subscribe(x);return x(),{el:p,destroy(){a(),p.remove();}}}var J={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 R(e,t,n){let i=t.state==="output-error",p=t.state==="output-available",m=!i&&!p,x=chunkDDUXNMDN_cjs.Xe(t.toolName,t.input,m?"present":"past"),a=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-tool"),c=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-tool-head"),s=chunkDDUXNMDN_cjs.Oe(e,J[x.icon]??"wrench");s.classList.add("pptxv-ai-tool-icon");let d=chunkDDUXNMDN_cjs.Fe(e,"span","pptxv-ai-tool-name");d.textContent=x.label;let r=chunkDDUXNMDN_cjs.Fe(e,"span","pptxv-ai-tool-state");if(i?(r.classList.add("is-error"),r.append(chunkDDUXNMDN_cjs.Oe(e,"alert"),e.createTextNode(n("pptx.ai.toolFailed")))):p?(r.classList.add("is-done"),r.append(chunkDDUXNMDN_cjs.Oe(e,"check"),e.createTextNode(n("pptx.ai.toolDone")))):(r.classList.add("is-running"),r.textContent=n("pptx.ai.toolRunning")),c.append(s,d,r),a.appendChild(c),i&&t.errorText){let b=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-tool-error");b.textContent=t.errorText,a.appendChild(b);}let f=chunkDDUXNMDN_cjs.We(t.input);if(f){let b=chunkDDUXNMDN_cjs.Fe(e,"details","pptxv-ai-tool-details"),u=chunkDDUXNMDN_cjs.Fe(e,"summary");u.textContent=n("pptx.ai.toolDetails");let C=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-tool-raw");C.textContent=`${chunkDDUXNMDN_cjs.Ve(t.toolName)}: ${f}`,b.append(u,C),a.appendChild(b);}return a}function U(e,t,n,i){t.replaceChildren();for(let p of n){if(p.role==="system")continue;let m=p.role==="user",x=chunkDDUXNMDN_cjs.Ue(p);if(x.length===0&&!m)continue;let a=chunkDDUXNMDN_cjs.Fe(e,"div",`pptxv-ai-msg pptxv-ai-msg-${p.role}`),c=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-msg-avatar");c.setAttribute("aria-label",i(m?"pptx.ai.you":"pptx.ai.assistant")),c.appendChild(chunkDDUXNMDN_cjs.Oe(e,m?"comment":"sparkles"));let s=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-msg-body");for(let d of x)if(d.kind==="text"){let r=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-msg-text");r.textContent=d.text,s.appendChild(r);}else s.appendChild(R(e,d,i));a.append(c,s),t.appendChild(a);}}function $(e,t,n,i,p){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let m=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-proposals-header"),x=chunkDDUXNMDN_cjs.Fe(e,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),m.appendChild(x),n.length>1){let a=chunkDDUXNMDN_cjs.Fe(e,"button","pptxv-ai-proposal-btn is-accept-all");a.type="button",a.textContent=i("pptx.ai.acceptAll"),a.addEventListener("click",()=>p.acceptAll()),m.appendChild(a);}t.appendChild(m);for(let a of n)t.appendChild(Q(e,a,i,p));}function Q(e,t,n,i){let p=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-proposal");p.dataset.proposalId=t.id;let m=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-proposal-eyebrow");m.textContent=n("pptx.ai.proposedChange"),p.appendChild(m);let x=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,p.appendChild(x),t.summary.length>0){let d=chunkDDUXNMDN_cjs.Fe(e,"ul","pptxv-ai-proposal-summary");for(let r of t.summary){let f=chunkDDUXNMDN_cjs.Fe(e,"li");f.textContent=chunkDDUXNMDN_cjs.Qe(r),d.appendChild(f);}p.appendChild(d);}let a=chunkDDUXNMDN_cjs.Fe(e,"div","pptxv-ai-proposal-actions"),c=chunkDDUXNMDN_cjs.Fe(e,"button","pptxv-ai-proposal-btn is-accept");c.type="button",c.append(chunkDDUXNMDN_cjs.Oe(e,"check"),e.createTextNode(n("pptx.ai.accept"))),c.addEventListener("click",()=>i.accept(t.id));let s=chunkDDUXNMDN_cjs.Fe(e,"button","pptxv-ai-proposal-btn is-reject");return s.type="button",s.append(chunkDDUXNMDN_cjs.Oe(e,"close"),e.createTextNode(n("pptx.ai.reject"))),s.addEventListener("click",()=>i.reject(t.id)),a.append(c,s),p.appendChild(a),p}async function gt(e){let{doc:t,host:n,t:i}=e;n.replaceChildren();let p=chunkDDUXNMDN_cjs.Fe(t,"div","pptxv-ai-header"),m=chunkDDUXNMDN_cjs.Fe(t,"span","pptxv-ai-title");m.textContent=i("pptx.ai.title"),p.append(chunkDDUXNMDN_cjs.Oe(t,"sparkles"),m);let x,a=e.controller,c=a?j({doc:t,t:i,controller:a,getSlides:()=>e.bridge.getSlides(),onSendDirective:l=>{x?.sendMessage(l);}}):null,s=chunkDDUXNMDN_cjs.Fe(t,"div","pptxv-ai-messages");s.setAttribute("role","log"),s.setAttribute("aria-live","polite");let d=chunkDDUXNMDN_cjs.Fe(t,"div","pptxv-ai-empty");d.textContent=i("pptx.ai.emptyHint"),s.appendChild(d);let r=chunkDDUXNMDN_cjs.Fe(t,"div","pptxv-ai-proposals");r.hidden=true;let f=chunkDDUXNMDN_cjs.Fe(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let b=chunkDDUXNMDN_cjs.Fe(t,"form","pptxv-ai-composer"),u=chunkDDUXNMDN_cjs.Fe(t,"textarea","pptxv-ai-input");u.rows=2,u.placeholder=i("pptx.ai.placeholder");let C=chunkDDUXNMDN_cjs.Fe(t,"button","pptxv-ai-send");C.type="submit",C.setAttribute("aria-label",i("pptx.ai.send")),C.appendChild(chunkDDUXNMDN_cjs.Oe(t,"send")),b.append(u,C),n.append(p,...c?[c.el]:[],s,r,f,b);try{x=await(e.createChat??chunkDDUXNMDN_cjs.Te)({bridge:e.bridge,config:e.config});}catch{return d.textContent=i("pptx.ai.unavailableTitle"),u.disabled=true,C.disabled=true,c?.destroy(),{destroy:()=>n.replaceChildren()}}let v=x,h=new Set,T=l=>{if(!a)return;let y=l.messages.flatMap(q=>chunkDDUXNMDN_cjs.Ue(q).filter(G=>G.kind==="tool")).at(-1);if(!y||y.kind!=="tool"||y.state==="input-streaming"||h.has(y.toolCallId))return;h.add(y.toolCallId);let k=chunkDDUXNMDN_cjs.Ye(y.toolName,y.input);k&&k.slideIndex!==void 0&&e.goToSlide?.(k.slideIndex),a.flashToolTarget(k);},A=l=>{U(t,s,l.messages,i),d.hidden=l.messages.length>0,l.messages.length===0&&s.appendChild(d),$(t,r,v.proposals.list(),i,{accept:y=>{a?.flashToolTarget(null),v.proposals.apply(y),A(v.getSnapshot());},reject:y=>{v.proposals.revert(y),A(v.getSnapshot());},acceptAll:()=>{a?.flashToolTarget(null),v.proposals.acceptAll(),A(v.getSnapshot());}});let S=l.status==="submitted"||l.status==="streaming";n.classList.toggle("is-busy",S),C.setAttribute("aria-label",i(S?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!l.error,f.textContent=l.error?i("pptx.ai.errorPrefix"):"",s.scrollTop=s.scrollHeight,T(l);},P=()=>{if(n.classList.contains("is-busy")){v.stop();return}let l=u.value.trim();l&&(u.value="",v.sendMessage(l));};b.addEventListener("submit",l=>{l.preventDefault(),P();}),u.addEventListener("keydown",l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),P());});let w=a?.getPrefill().nonce??0,z=()=>{if(!a)return;let l=a.getPrefill();l.nonce!==w&&(w=l.nonce,u.value=l.text,u.focus());},K=a?.subscribe(z),O=v.subscribe(A);return A(v.getSnapshot()),{changeAnimator:v.changeAnimator,destroy(){O(),K?.(),c?.destroy(),n.replaceChildren();}}}exports.createAiPanel=gt;