@popmelt.com/core 0.24.2 → 0.26.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/README.md +34 -2
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/ParticipantRuntime-5WM2XJT7.mjs +139 -0
- package/dist/PopmeltTasteConnectedPane-IXJ2KAPX.mjs +81 -0
- package/dist/PreviewRuntime-ATSECGMB.mjs +2 -0
- package/dist/bridge-entry.mjs +84 -71
- package/dist/browser-runtime-O5GITMZB.mjs +2 -0
- package/dist/browser.mjs +1 -1
- package/dist/{chunk-NV55QGKG.mjs → chunk-7IVK4FEU.mjs} +1 -1
- package/dist/chunk-CWVRJOGB.mjs +370 -0
- package/dist/chunk-EH5Y2F4E.mjs +77 -0
- package/dist/chunk-FRHGK5ZV.mjs +2 -0
- package/dist/chunk-J2OX47QB.mjs +345 -0
- package/dist/{chunk-TJVWZRAF.mjs → chunk-MGIH5NQE.mjs} +1 -1
- package/dist/chunk-NXMPY7RX.mjs +2 -0
- package/dist/chunk-ZJPPZLXU.mjs +2 -0
- package/dist/cli.mjs +109 -96
- package/dist/index.mjs +1 -1
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-next.d.mts +6 -2
- package/dist/plugin-next.mjs +1 -1
- package/dist/plugin-nuxt.mjs +1 -1
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server-QHSVIUQW.mjs +241 -0
- package/dist/server.d.mts +7 -0
- package/dist/server.mjs +87 -74
- package/package.json +4 -1
- package/dist/ParticipantRuntime-6QPULJPO.mjs +0 -139
- package/dist/PreviewRuntime-NGTLOEX3.mjs +0 -2
- package/dist/browser-runtime-3UZPA2SA.mjs +0 -2
- package/dist/chunk-3XSTOVWX.mjs +0 -2
- package/dist/chunk-D4ZJC7OV.mjs +0 -301
- package/dist/chunk-ENERPQJN.mjs +0 -2
- package/dist/chunk-ZL4X7KBW.mjs +0 -413
- package/dist/server-M6OXW7FE.mjs +0 -228
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{c as P,d as g}from"./chunk-NXMPY7RX.mjs";import{D as A,z as R,B as x,h as C,C as v,A as b,E as y}from"./chunk-ZJPPZLXU.mjs";var O="__popmelt_code_preview";function D(a,r){let t=new URL(a,r);if(t.origin!==new URL(r).origin||!/^https?:$/.test(t.protocol))throw new Error("Code previews must use the same application origin");return t.hash="",t.searchParams.delete("popmelt"),t.searchParams.set(O,"1"),t.href}function T(a,r){if(!new URL(location.href).searchParams.has(O))return!1;if(parent===window)return!0;window.__POPMELT_CODE_PREVIEW__?.dispose();let t=g,w="",s=!1,u=0,d=new Map,h=()=>{for(let[e,i]of d)i===null?e.removeAttribute("data-pm"):e.setAttribute("data-pm",i);d.clear()},n=new P(r?.get()??[]),m=()=>{for(let e of t.annotations)e.target&&n.resolve(e.target)},_=()=>{A(t.domModifications),R(t.styleModifications),x(t.textModifications),m();for(let e of t.annotations){let i=e.linkedSelector?.match(/^\[data-pm="([^"]+)"\]$/)?.[1];if(!i)continue;let o=C(e.linkedSelector,e.elements?.[0]);o&&(d.has(o)||d.set(o,o.getAttribute("data-pm")),o.setAttribute("data-pm",i))}},c=new MutationObserver(e=>{e.some(i=>i.addedNodes.length)&&(cancelAnimationFrame(u),u=requestAnimationFrame(()=>{c.disconnect(),_(),p()}))}),p=()=>c.observe(document.body,{childList:!0,subtree:!0}),E=()=>{let e=n;e.whenReady().then(()=>{!s&&n===e&&(m(),document.dispatchEvent(new Event("popmelt-subjects-ready")))})},L=r?.subscribe(()=>{n.destroy(),n=new P(r.get()),m(),E()});E();let f={dispose(){s||(s=!0,c.disconnect(),L?.(),n.destroy(),cancelAnimationFrame(u),window.removeEventListener("pagehide",f.dispose),window.__POPMELT_CODE_PREVIEW__===f&&delete window.__POPMELT_CODE_PREVIEW__,v(t.textModifications),b(t.styleModifications,!0),y(t.domModifications),h())},source:a,getSubjects:()=>n,update(e){if(s)throw new Error("Preview runtime closed");if(e.draft.source&&e.draft.source.sourceId!==a.sourceId)throw new Error("This draft belongs to a different source");let i=JSON.stringify([e.planeId,e.draft.revision,e.draft.source?.sourceId,e.draft.source?.revision]);if(w===i)return;let o=structuredClone(e.draft.state??g),l=M=>!M.pathname||M.pathname===location.pathname,I={...o,annotations:o.annotations.filter(l),styleModifications:o.styleModifications.filter(l),textModifications:o.textModifications.filter(l),domModifications:o.domModifications.filter(l)};c.disconnect(),v(t.textModifications),b(t.styleModifications,!0),y(t.domModifications),h(),t=I,_(),p(),w=i}};return window.__POPMELT_CODE_PREVIEW__=f,p(),window.addEventListener("pagehide",f.dispose,{once:!0}),!0}export{D as a,T as b};
|