@popmelt.com/core 0.27.1 → 0.28.1
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/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/ParticipantRuntime-JUOBT3CY.mjs +139 -0
- package/dist/PopmeltTasteConnectedPane-JO4QR6ZT.mjs +221 -0
- package/dist/PreviewRuntime-JAZLAGQE.mjs +2 -0
- package/dist/bridge-entry.mjs +2 -229
- package/dist/browser-runtime-6KNOQXAJ.mjs +2 -0
- package/dist/browser.mjs +1 -1
- package/dist/chunk-35UEAIRA.mjs +289 -0
- package/dist/chunk-3LBOX7HQ.mjs +3 -0
- package/dist/chunk-3NTTM74X.mjs +1 -0
- package/dist/chunk-3THBMCJW.mjs +369 -0
- package/dist/chunk-A2UXK7AS.mjs +77 -0
- package/dist/chunk-GL4I4MI6.mjs +3 -0
- package/dist/chunk-HGW2U6PD.mjs +2 -0
- package/dist/chunk-JQHZFDY5.mjs +2 -0
- package/dist/chunk-LVEMYZOA.mjs +2 -0
- package/dist/chunk-MP7S5ALD.mjs +2 -0
- package/dist/chunk-O4HZP3RP.mjs +2 -0
- package/dist/chunk-QUNV5PNI.mjs +2 -0
- package/dist/chunk-QXVMGZFP.mjs +1 -0
- package/dist/chunk-SWTSMLHA.mjs +2 -0
- package/dist/{chunk-CLDWTCKX.mjs → chunk-VRFM3TLR.mjs} +1 -1
- package/dist/chunk-W4VRK56P.mjs +347 -0
- package/dist/chunk-XOGBFVWI.mjs +2 -0
- package/dist/chunk-XTOCFTVW.mjs +2 -0
- package/dist/cli.mjs +169 -106
- package/dist/focus-inspection-2FPCQIN2.mjs +2 -0
- package/dist/index-CHp2bgs1.d.mts +565 -0
- package/dist/index.mjs +1 -1
- package/dist/memory-legacy.d.mts +1 -489
- package/dist/memory-legacy.mjs +1 -1
- package/dist/memory-store.d.mts +2 -660
- package/dist/memory-store.mjs +1 -3
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-nuxt.mjs +1 -1
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server.d.mts +3 -291
- package/dist/server.mjs +7 -234
- package/dist/taste-proposal-session-XU4N7RUV.mjs +2 -0
- package/dist/types-Bur49CLH.d.mts +349 -0
- package/dist/workspace-snapshot-EJQHHDQ4.mjs +2 -0
- package/package.json +1 -1
- package/dist/ParticipantRuntime-TWGYNKIS.mjs +0 -139
- package/dist/PopmeltTasteConnectedPane-WDF556E2.mjs +0 -81
- package/dist/PreviewRuntime-KGLZJGUN.mjs +0 -2
- package/dist/browser-runtime-PFJI3VEQ.mjs +0 -2
- package/dist/chunk-3PVLCKSV.mjs +0 -370
- package/dist/chunk-7MGWRICI.mjs +0 -77
- package/dist/chunk-7YCLSSQA.mjs +0 -2
- package/dist/chunk-D7HY2EDH.mjs +0 -2
- package/dist/chunk-TSY2K45H.mjs +0 -2
- package/dist/chunk-YC7B37F6.mjs +0 -1
- package/dist/chunk-YMCTJKYN.mjs +0 -345
- package/dist/server-J5NV3BMT.mjs +0 -241
package/dist/chunk-7YCLSSQA.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{c as P,d as g}from"./chunk-TSY2K45H.mjs";import{P as R,L as x,N as A,s as C,O as v,M as b,Q as y}from"./chunk-D7HY2EDH.mjs";var O="__popmelt_code_preview";function T(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 V(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,_=()=>{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)},h=()=>{R(t.domModifications),x(t.styleModifications),A(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(),h(),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),_())},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),_(),t=I,h(),p(),w=i}};return window.__POPMELT_CODE_PREVIEW__=f,p(),window.addEventListener("pagehide",f.dispose,{once:!0}),!0}export{T as a,V as b};
|
package/dist/chunk-D7HY2EDH.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
function c(e){try{let t=e.defaultView?.frameElement;return t?.localName==="iframe"?t:null}catch{return null}}function D(e){if(e.localName!=="iframe"||e.closest("[data-devtools],[data-popmelt-peer-surface]"))return null;try{let t=e.contentDocument;return t?.documentElement?t:null}catch{return null}}function V(e){let t=e.getBoundingClientRect(),r=e.offsetWidth?t.width/e.offsetWidth:1,n=e.offsetHeight?t.height/e.offsetHeight:1;return{x:t.left+e.clientLeft*r,y:t.top+e.clientTop*n,sx:r,sy:n}}function F(e,t){let{left:r,top:n,width:o,height:l}=e,i=c(t);for(;i;){let a=V(i);r=a.x+r*a.sx,n=a.y+n*a.sy,o*=a.sx,l*=a.sy,i=c(i.ownerDocument)}return new DOMRect(r,n,o,l)}function H(e){return F(e.getBoundingClientRect(),e.ownerDocument)}function O(e,t,r){let n=[],o=c(r);for(;o;)n.unshift(o),o=c(o.ownerDocument);for(let l of n){let i=V(l);e=(e-i.x)/i.sx,t=(t-i.y)/i.sy}return{x:e,y:t}}function gt(e){return e.ownerDocument.defaultView??window}function ht(e){return!!(e&&e.namespaceURI==="http://www.w3.org/1999/xhtml")}function T(e,t=document){if(e===t)return!0;let r=c(e);return!!(r?.isConnected&&r.contentDocument===e&&T(r.ownerDocument,t))}function pt(e,t){if(!T(t))return new DOMRect(0,0,0,0);let r=e.left,n=e.top,o=e.right,l=e.bottom;for(let i=c(t);i;i=c(i.ownerDocument)){let a=F({left:0,top:0,width:i.clientWidth,height:i.clientHeight},i.contentDocument);r=Math.max(r,a.left),n=Math.max(n,a.top),o=Math.min(o,a.right),l=Math.min(l,a.bottom)}return new DOMRect(r,n,Math.max(0,o-r),Math.max(0,l-n))}var v="@frame(";function yt(e,t){return`${v}${encodeURIComponent(JSON.stringify({selector:e,url:t.URL}))}) `}function z(e){if(!e.startsWith(v))return null;let t=e.indexOf(") ");if(t<0)return null;try{let r=JSON.parse(decodeURIComponent(e.slice(v.length,t)));return typeof r.selector!="string"||typeof r.url!="string"?null:{...r,rest:e.slice(t+2)}}catch{return null}}var W=" >>> ";function X(e){return Array.from(e.querySelectorAll("*")).flatMap(t=>t.shadowRoot?[t.shadowRoot]:[])}function R(e=document){let t=[e];for(let r of t)t.push(...X(r));return t}function h(e,t=document){if(e.startsWith(v)){let o=z(e);if(!o)return null;let l=o.selector.startsWith(v)||o.selector.includes(W)?[h(o.selector,t)].filter(u=>!!u):R(t).flatMap(u=>Array.from(u.querySelectorAll(o.selector))),i=l.length===1?l[0]:null,a=i&&D(i);return!a||a.URL!==o.url?null:h(o.rest,a)}let r=e.split(W);if(r.length>1){let o=t,l=null;for(let i=0;i<r.length;i+=1){if(l=o.querySelector(r[i]),!l)return null;if(i<r.length-1){if(!l.shadowRoot)return null;o=l.shadowRoot}}return l}let n=[t];for(let o of n){let l=o.querySelector(e);if(l)return l;n.push(...X(o))}return null}function p(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode();return"host"in t?t.host:null}function bt(e,t){return t.startsWith(v)||t.includes(W)?h(t)===e:e.matches(t)}function $(e,t){let r=e;for(;r;){if(r.matches(t))return r;r=p(r)}return null}function wt(e,t){let r=t;for(;r;){if(r===e)return!0;r=p(r)}return!1}function St(e,t,r,n=o=>[o]){let o=[];for(let l of e.querySelectorAll("iframe")){if(!D(l))continue;let i=l.getBoundingClientRect();if(t<i.left||t>i.right||r<i.top||r>i.bottom||l.ownerDocument.defaultView?.getComputedStyle(l).pointerEvents!=="none")continue;let a=l.style.getPropertyValue("pointer-events"),u=l.style.getPropertyPriority("pointer-events");l.style.setProperty("pointer-events","auto","important"),o.push(()=>a?l.style.setProperty("pointer-events",a,u):l.style.removeProperty("pointer-events"))}try{let l=typeof e.elementsFromPoint=="function"?e.elementsFromPoint(t,r):[],i=e.elementFromPoint?.(t,r)??null;return(i&&!l.includes(i)?[i,...l]:l).filter(a=>e.nodeType===9||a.getRootNode()===e).flatMap(n)}finally{o.forEach(l=>l())}}function P(e,t,r=document){let n=[],o=new Set,l=r.nodeType===9?r:r.ownerDocument,i=O(e,t,l);for(let a of R(r).reverse())for(let u of St(a,i.x,i.y,f=>{let s=D(f);return s?[...P(e,t,s),f]:[f]}))o.has(u)||(o.add(u),n.push(u));return n}function E(){return W}var vt=["id","data-testid","data-test","data-cy","data-popmelt-media-id","aria-label","name","href"],J=e=>e.replace(/\s+/g," ").trim();function A(e){return e==="id"||e==="data-popmelt-media-id"||/^data-(?:testid|test|cy)(?:-[a-z0-9_-]+)?$/.test(e)}function Z(e,t){return!!(t&&t.length<=200&&!(e==="id"&&/^(radix-|:|_r_)/.test(t)))}function G(e){let t={},r=new Set([...vt,...e.getAttributeNames().filter(A)]);for(let l of r){let i=e.getAttribute(l);i&&Z(l,i)&&(t[l]=i)}let n=J(e.querySelector("h1,h2,h3,h4,h5,h6")?.textContent??""),o=J(Array.from(e.childNodes).filter(l=>l.nodeType===3).map(l=>l.textContent).join(" "));return{tag:e.tagName.toLowerCase(),...Object.keys(t).length?{attributes:t}:{},...n&&n.length<=200?{heading:n}:{},...o&&o.length<=200?{text:o}:{}}}function K(e,t,r=document){let n=R(r),o=s=>{try{return n.flatMap(d=>Array.from(d.querySelectorAll(s)))}catch{return[]}},l=!!(t&&(t.heading||t.text||Object.keys(t.attributes??{}).length)),i=s=>{if(!t||!l)return!0;let d=G(s);return d.tag===t.tag&&(!t.heading||d.heading===t.heading)&&(!t.text||d.text===t.text)&&Object.entries(t.attributes??{}).every(([m,S])=>s.getAttribute(m)===S)};for(let s of e){if(s.includes(" >>> ")||s.startsWith("@frame(")){try{let m=h(s,r),S=z(s),U=Object.entries(t?.attributes??{}).filter(([L])=>A(L)),dt=S&&m&&(S.rest.startsWith("[data-pm=")||U.length>0&&m.tagName.toLowerCase()===t?.tag&&U.every(([L,mt])=>m.getAttribute(L)===mt));if(m&&(dt||i(m)))return{status:"matched",element:m}}catch{}continue}let d=o(s);if(d.length===1&&(/^\[data-pm=/.test(s)||!l))return{status:"matched",element:d[0]}}if(!l||e.some(s=>s.includes(" >>> ")||s.startsWith("@frame("))||!/^[a-z][a-z0-9-]*$/.test(t.tag))return{status:"missing"};let a=o(t.tag);if(a.length>500)return{status:"ambiguous"};let u=Object.entries(t.attributes??{}).filter(([s])=>A(s));if(u.length){let s=a.filter(d=>u.every(([m,S])=>d.getAttribute(m)===S));return s.length===1?{status:"matched",element:s[0]}:{status:s.length?"ambiguous":"missing"}}let f=a.filter(i);return f.length===1?{status:"matched",element:f[0]}:{status:f.length?"ambiguous":"missing"}}function At(e,t,r=document){let n={};if(t)for(let[a,u]of Object.entries({...t.dataAttributes,...t.id?{id:t.id}:{}}))A(a)&&Z(a,u)&&(n[a]=u);let o=t?.targetFingerprint?.tag??t?.tagName?.toLowerCase(),l=t&&o?{...t.targetFingerprint,tag:o,attributes:{...n,...t.targetFingerprint?.attributes}}:t?.targetFingerprint,i=K([e,t?.selector].filter(a=>!!a),l,r);return i.status==="matched"?i.element:null}var Nt=["data-popmelt-frame","data-popmelt-media-id","data-testid","data-test","data-cy"];function j(e){let t=e.getRootNode();if(!("querySelectorAll"in t))return null;let r=new Set([...Nt,...e.getAttributeNames().filter(n=>n!=="id"&&A(n))]);for(let n of r){let o=e.getAttribute(n);if(!o||o.length>200)continue;let l=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(o):Array.from(o,a=>{if(a==='"'||a==="\\")return`\\${a}`;let u=a.charCodeAt(0);return u<32||u===127?`\\${u.toString(16)} `:a}).join(""),i=`[${n}="${l}"]`;if(t.querySelectorAll(i).length===1)return i}return null}function I(e){if(c(e.ownerDocument))return y(e);let t=j(e);if(t)return t;if(e.id)return`#${e.id}`;let r=e.tagName.toLowerCase(),n=Array.from(e.classList).slice(0,3).join(".");return n?`${r}.${n}`:r}function y(e){return Q(Y(e),e.ownerDocument)}function Q(e,t){let r=c(t);if(r){!(r.id&&r.ownerDocument.querySelectorAll(`#${CSS.escape(r.id)}`).length===1)&&!j(r)&&r.setAttribute("data-popmelt-frame",globalThis.crypto?.randomUUID?.()??`frame-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`);let n=r.hasAttribute("data-popmelt-frame")?`[data-popmelt-frame="${r.getAttribute("data-popmelt-frame")}"]`:Y(r),o=c(r.ownerDocument)?y(r):n;return yt(o,t)+e}return e}function Y(e){if(e.getRootNode().nodeType===9&&e.id&&!e.id.startsWith("radix-")&&!e.id.startsWith(":")&&e.ownerDocument.querySelectorAll(`#${CSS.escape(e.id)}`).length===1)return`#${CSS.escape(e.id)}`;let t=[],r=e;for(;r&&r!==e.ownerDocument.documentElement;){let n=r.tagName.toLowerCase(),o=j(r);if(o?n=o:r.id&&!r.id.startsWith("radix-")&&!r.id.startsWith(":")&&r.getRootNode().querySelectorAll(`#${CSS.escape(r.id)}`).length===1&&(n=`#${CSS.escape(r.id)}`),!o&&!n.startsWith("#")){let a=Array.from(r.classList).filter(u=>!u.startsWith("_")&&u.length<30).slice(0,2);a.length>0&&(n+="."+a.map(u=>CSS.escape(u)).join("."))}let l=r.parentElement;if(l&&!o&&!n.startsWith("#")){let a=Array.from(l.children).filter(u=>u.tagName===r.tagName);if(a.length>1){let u=a.indexOf(r)+1;n+=`:nth-of-type(${u})`}}if(t.unshift(n),o||n.startsWith("#")){let a=r.getRootNode();if(a.nodeType===9)break;if("host"in a){t.unshift(E().trim()),r=a.host;continue}}if(l){r=l;continue}let i=r.getRootNode();if(!("host"in i))break;t.unshift(E().trim()),r=i.host}return t.join(" > ").replace(/ > >>> > /g,E())}function g(e){try{return h(e)}catch{return null}}function N(e){return!!(e&&(e.namespaceURI==="http://www.w3.org/1999/xhtml"||e.namespaceURI==="http://www.w3.org/2000/svg"))}var k=new WeakMap,x=new WeakMap;function xt(e,t){if(N(t))for(let[r,n]of x.get(e)??[])n.value?t.style.setProperty(r,n.value,n.priority):t.style.removeProperty(r)}function Ct(e,t){k.set(e,new Set(t))}function Dt(e){k.delete(e)}function tt(e,t){return N(e)&&(k.get(e)?.has(t)??!1)}function et(e){let t=e.sticker;return t?t.family==="padding"||t.family==="margin"?t.subproperty==="all"?10:t.subproperty==="x"||t.subproperty==="y"?20:30:t.family==="radius"||t.family==="border"?t.subproperty==="all"?10:20:10:0}function Wt(e){return e.changes.map((t,r)=>({change:t,index:r})).sort((t,r)=>et(t.change)-et(r.change)||t.index-r.index).map(({change:t})=>t)}function rt(e,t,r){if(N(e)){let n=x.get(e);n||(n=new Map,x.set(e,n)),n.has(t)||n.set(t,{value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)}),e.style.setProperty(t,r,"important")}}function Rt(e,t,r,n=!1){if(N(e)){let o=n?x.get(e)?.get(t):void 0;o?.value?e.style.setProperty(t,o.value,o.priority):e.style.removeProperty(t),x.get(e)?.delete(t)}}function nt(e){let t=g(e.selector);if(!t&&e.durableSelector&&(t=g(e.durableSelector),t)){let r=e.selector.match(/\[data-pm="([^"]+)"\]/)?.[1];r&&t.setAttribute("data-pm",r)}return t}function $t(e){for(let t of e){let r=nt(t);if(r)for(let n of Wt(t))tt(r,n.property)||rt(r,n.property,n.modified)}}function Pt(e,t=!1){for(let r of e){let n=g(r.selector);if(n)for(let o of r.changes)tt(n,o.property)||Rt(n,o.property,o.original,t)}}function ot(e){let t=g(e.selector);if(!t&&e.durableSelector&&(t=g(e.durableSelector),t)){let r=e.selector.match(/\[data-pm="([^"]+)"\]/)?.[1];r&&t.setAttribute("data-pm",r)}return t}function lt(e,t){let r=e;for(let n of t)r=r?.childNodes[n]??null;return r?.nodeType===Node.TEXT_NODE?r:null}function Et(e){for(let t of e){let r=ot(t);if(!r)continue;let n=lt(r,t.textNodePath);n&&(!t.selector.startsWith("@frame(")||n.nodeValue===t.original)&&n.nodeValue!==t.modified&&(n.nodeValue=t.modified)}}function Mt(e){for(let t of e){let r=ot(t);if(!r)continue;let n=lt(r,t.textNodePath);n&&(!t.selector.startsWith("@frame(")||n.nodeValue===t.modified)&&n.nodeValue!==t.original&&(n.nodeValue=t.original)}}function b(e,t){if(!e)return null;let r=g(e);if(!r&&t&&(r=g(t),r)){let n=e.match(/\[data-pm="([^"]+)"\]/)?.[1];n&&r.setAttribute("data-pm",n)}return r}function Lt(e){e.removeAttribute("data-pm"),e.querySelectorAll("[data-pm]").forEach(t=>t.removeAttribute("data-pm"))}function Ft(e,t){let r=t.match(/\[data-pm="([^"]+)"\]/)?.[1];r&&e.setAttribute("data-pm",r)}function _(e,t,r){let n=Array.from(e.children).filter(l=>l!==t),o=Math.max(0,Math.min(r,n.length));e.insertBefore(t,n[o]??null)}function Ot(e){for(let t of e){let r=b(t.targetParentSelector,t.targetParentDurableSelector);if(!r)continue;if(t.operation==="move"){let l=b(t.selector,t.durableSelector);if(!l||l===r||l.contains(r))continue;_(r,l,t.targetIndex);continue}if(b(t.selector,t.durableSelector))continue;let n=b(t.sourceSelector,t.sourceDurableSelector);if(!n)continue;let o=n.cloneNode(!0);o instanceof Element&&(Lt(o),Ft(o,t.selector),_(r,o,t.targetIndex))}}function Tt(e){for(let t of[...e].reverse()){if(t.operation==="copy"){b(t.selector,t.durableSelector)?.remove();continue}let r=b(t.selector,t.durableSelector),n=b(t.originalParentSelector,t.originalParentDurableSelector);!r||!n||r===n||r.contains(n)||_(n,r,t.originalIndex??n.children.length)}}function it(e){let t=Object.keys(e).find(l=>l.startsWith("__reactFiber$")||l.startsWith("__reactInternalInstance$"));if(!t)return null;let r=e[t],n=[],o=r?._debugSource;for(;r;){let l=r.type,i=l?.displayName||l?.name;i&&typeof i=="string"&&/^[A-Z]/.test(i)&&!i.startsWith("_")&&i!=="Fragment"&&n.unshift(i),r=r.return}return n.length>0?{name:n[n.length-1],path:n,...o?.fileName&&Number.isFinite(o.lineNumber)?{source:o}:{}}:null}function jt(e){let t=Object.keys(e).find(o=>o.startsWith("__reactFiber$")||o.startsWith("__reactInternalInstance$"));if(!t)return[];let r=e[t],n=[];for(;r;){let o=r.type,l=typeof o=="function"||typeof o=="object"?o?.displayName||o?.name:null;l&&typeof l=="string"&&/^[A-Z]/.test(l)&&!l.startsWith("_")&&l!=="Fragment"&&n.push({name:l,fiber:r}),r=r.return}return n.reverse(),n}function It(e){let t=e,r=new Set;for(;t&&!r.has(t);){if(r.add(t),t.stateNode instanceof Element)return t.stateNode;t.child?t=t.child:t=null}return null}var kt=900,M=80;function w(e){if(!e)return null;try{return h(e)}catch{return null}}function C(e){return(e??"").replace(/\s+/g," ").trim()}function at(e){let t=C(e.getAttribute("aria-label"));if(t)return t.slice(0,M);let r=C(e.getAttribute("aria-labelledby"));if(r){let o=r.split(/\s+/).map(l=>C(document.getElementById(l)?.textContent)).filter(Boolean).join(" ");if(o)return o.slice(0,M)}let n=C(e.getAttribute("title"));return n?n.slice(0,M):C(e.textContent).slice(0,M)}function _t(e){return e.id?Array.from(document.querySelectorAll("[aria-controls]")).find(t=>t.getAttribute("aria-controls")===e.id)??null:null}function qt(e){if(e instanceof HTMLDetailsElement){let n=Array.from(e.children).find(l=>l.tagName.toLowerCase()==="summary");if(!n)return null;let o=at(n);return o?{triggerSelector:y(n),targetSelector:y(e),label:o}:null}let t=_t(e);if(!t)return null;let r=at(t);return r?{triggerSelector:y(t),targetSelector:y(e),label:r}:null}function q(e){let t=[],r=new Set,n=p(e);for(;n&&n!==document.body&&n!==document.documentElement;){let l=qt(n);l&&!r.has(l.triggerSelector)&&(r.add(l.triggerSelector),t.push(l)),n=p(n)}if(t.length===0)return;let o=t.reverse();return{steps:o,location:o.map(l=>l.label)}}function ut(e){let t=e?.[0]?.revealRecipe;if(t?.steps.length)return t;let r=w(e?.[0]?.selector);return r?q(r):void 0}function Bt(e){let t=ut(e)?.location.filter(Boolean);return t?.length?`Inside: ${t.join(" \u203A ")}`:null}function B(e){if(!e?.isConnected)return!1;let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0||e.getClientRects().length===0)return!1;let r=e;for(;r;){let n=window.getComputedStyle(r);if(n.display==="none"||n.visibility==="hidden"||n.visibility==="collapse"||Number.parseFloat(n.opacity||"1")<=0)return!1;r=r.parentElement}return!0}function Ut(e,t,r){return t.getAttribute("aria-expanded")==="true"||t.getAttribute("data-state")==="open"?!0:r instanceof HTMLDetailsElement?r.open:B(r)}function st(e,t=kt){return e?new Promise(r=>{let n=performance.now(),o=()=>{let l=w(e);if(B(l)){r(l);return}if(performance.now()-n>=t){r(null);return}requestAnimationFrame(o)};o()}):Promise.resolve(null)}function Vt(e,t){return w(e)??w(t?.[0]?.selector)}async function Ht(e,t){let r=Vt(e,t);if(B(r))return r;let n=ut(t)??(r?q(r):void 0);if(!n)return null;for(let l of n.steps){let i=w(l.triggerSelector);if(!(i instanceof HTMLElement))return null;let a=w(l.targetSelector);if(!Ut(l,i,a)&&(i.click(),!await st(l.targetSelector)))return null}let o=e&&w(e)?e:t?.[0]?.selector;return st(o)}function zt(e){let t={targetFingerprint:G(e),selector:I(e),tagName:e.tagName.toLowerCase()},r=[],n=e.ownerDocument,o=c(n);for(;o;)r.unshift({url:n.URL,title:n.title,label:o.title||o.getAttribute("aria-label")||o.id||void 0}),n=o.ownerDocument,o=c(n);r.length&&(t.frameContext=r),e.id&&(t.id=e.id),e.classList.length>0&&(t.className=Array.from(e.classList).join(" "));let l=Xt(e)||e.matches('button, a, [role="button"], [role="tab"]')&&(e.getAttribute("aria-label")||e.getAttribute("title")||e.textContent?.trim())||"";l&&l.length>0&&l.length<200&&(t.textContent=l);let i={};for(let s of e.attributes)s.name.startsWith("data-")&&(i[s.name]=s.value);Object.keys(i).length>0&&(t.dataAttributes=i);let a=it(e);a&&(t.reactComponent=a.name,t.reactComponentPath=a.path,a.source&&(t.reactSource=a.source));let u=te(e);u&&(t.context=u);let f=q(e);return f&&(t.revealRecipe=f),t}function Xt(e){let t="";for(let r of e.childNodes)r.nodeType===Node.TEXT_NODE&&(t+=r.textContent||"");return t.trim()}function Jt(e,t,r){return ft(e,t,r)[0]??null}var Zt="[data-popmelt-canvas-block]";function ct(e,t){let r=P(e,t).find(n=>n.id!=="devtools-canvas"&&n.id!=="devtools-scrim");return!!(r&&$(r,Zt))}function Gt(e){return e.namespaceURI==="http://www.w3.org/2000/svg"?e.closest("svg")??e:e}function ft(e,t,r){if(ct(e,t))return[];let n=new Set,o=P(e,t),l=o.map(Gt).filter(i=>n.has(i)||(n.add(i),i.id==="devtools-canvas"||i.id==="devtools-toolbar"||i.id==="devtools-scrim")||$(i,"#devtools-toolbar")||i.hasAttribute("data-devtools")||$(i,"[data-devtools]")?!1:i!==i.ownerDocument.body&&i!==i.ownerDocument.documentElement);return l.length>0?l:r?.allowBodyFallback&&o.includes(document.body)?[document.body]:[]}function Kt(e,t,r){for(let n of e.childNodes){if(n.nodeType!==Node.TEXT_NODE||!n.textContent?.trim())continue;let o=e.ownerDocument.createRange();o.selectNodeContents(n);let l=o.getClientRects?.();if(l&&Array.from(l).some(i=>{let a=O(t,r,e.ownerDocument);return a.x>=i.left&&a.x<=i.right&&a.y>=i.top&&a.y<=i.bottom}))return!0}return!1}function Qt(e,t,r){if(Kt(e,t,r)||["button","canvas","embed","iframe","img","input","object","select","svg","textarea","video"].includes(e.tagName.toLowerCase()))return!0;let n=getComputedStyle(e);if(n.backgroundImage&&n.backgroundImage!=="none")return!0;let o=n.backgroundColor.trim();if(o&&o!=="transparent"&&!/rgba?\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(o))return!0;let l=H(e),i={top:Number.parseFloat(n.borderTopWidth)||0,right:Number.parseFloat(n.borderRightWidth)||0,bottom:Number.parseFloat(n.borderBottomWidth)||0,left:Number.parseFloat(n.borderLeftWidth)||0};return i.top>0&&r<=l.top+i.top||i.right>0&&t>=l.right-i.right||i.bottom>0&&r>=l.bottom-i.bottom||i.left>0&&t<=l.left+i.left}function Yt(e,t,r){let n=ft(e,t,r);return n.find(o=>Qt(o,e,t))??n.at(-1)??null}function te(e){let t=p(e),r=["section","article","nav","aside","header","footer","main"];for(;t&&t!==e.ownerDocument.body;){let n=t.tagName.toLowerCase();if(r.includes(n)&&t.id)return c(t.ownerDocument)?I(t):`${n}#${t.id}`;if(t.id&&!t.id.startsWith("radix-")&&!t.id.startsWith(":"))return c(t.ownerDocument)?I(t):`${n}#${t.id}`;t=p(t)}return null}export{It as A,zt as B,Jt as C,ct as D,Yt as E,N as F,xt as G,Ct as H,Dt as I,rt as J,nt as K,$t as L,Pt as M,Et as N,Mt as O,Ot as P,Tt as Q,c as a,D as b,F as c,H as d,O as e,gt as f,ht as g,T as h,pt as i,R as j,h as k,p as l,bt as m,$ as n,wt as o,P as p,E as q,K as r,At as s,y as t,Q as u,g as v,Bt as w,Ht as x,it as y,jt as z};
|
package/dist/chunk-TSY2K45H.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{t as S,B as g}from"./chunk-D7HY2EDH.mjs";function h(e){return Array.from(e,t=>{if(t==='"'||t==="\\")return`\\${t}`;let r=t.codePointAt(0);return r<32||r===127?`\\${r.toString(16)} `:t}).join("")}function f(e){return`[data-popmelt-subject-adapter="${h(e.adapter)}"][data-popmelt-subject-key="${h(e.key)}"]`}function y(e){let t=e?.getAttribute("data-popmelt-subject-adapter"),r=e?.getAttribute("data-popmelt-subject-key");return t&&r?{adapter:t,key:r}:void 0}function p(e,t){let r=!1;e.dataset.popmeltSubjectLabel!==t.label&&(e.dataset.popmeltSubjectLabel=t.label,r=!0);let{left:a,top:i,width:n,height:s}=t.bounds,u=o=>`${Math.round(o*2)/2}px`,b={left:u(a),top:u(i),width:u(Math.max(0,n)),height:u(Math.max(0,s))};for(let[o,c]of Object.entries(b)){let m=o;e.style[m]!==c&&(e.style[m]=c,r=!0)}let l=t.surfaceBounds,j={popmeltSubjectSurfaceLeft:l?String(l.left):void 0,popmeltSubjectSurfaceTop:l?String(l.top):void 0,popmeltSubjectSurfaceWidth:l?String(l.width):void 0,popmeltSubjectSurfaceHeight:l?String(l.height):void 0};for(let[o,c]of Object.entries(j))c===void 0?o in e.dataset&&(delete e.dataset[o],r=!0):e.dataset[o]!==c&&(e.dataset[o]=c,r=!0);let d=t.outline?.map(o=>`${o.x},${o.y}`).join(" ");return d?e.dataset.popmeltSubjectOutline!==d&&(e.dataset.popmeltSubjectOutline=d,r=!0):e.dataset.popmeltSubjectOutline!==void 0&&(delete e.dataset.popmeltSubjectOutline,r=!0),r}var k=class{constructor(e){this.adapters=e,this.projections=new Map,this.frameListeners=new Set,this.frame=null,this.lastProjectionFrameTime=0,this.adapterUnsubscribes=e.flatMap(t=>{let r=t.subscribe?.(()=>{for(let a of this.frameListeners)a()});return r?[r]:[]})}async whenReady(){await Promise.all(this.adapters.map(e=>e.whenReady?.()))}hitTest(e){return this.hitTestAll(e)[0]??null}hitTestAll(e){for(let t=this.adapters.length-1;t>=0;t-=1){let r=this.adapters[t];if(!r)continue;let a=(r.hitTestAll?.(e)??[r.hitTest(e)]).filter(i=>!!i).map(i=>this.project(r,i));if(a.length>0)return a}return[]}resolve(e){let t=this.adapters.find(a=>a.id===e.adapter);if(!t)return null;let r=t.resolve(e.key);return r?this.project(t,r):null}restore(e,t){let r=this.adapters.find(i=>i.id===e.adapter),a=r?.restoreSubject?.(e.key,t);return r&&a?this.project(r,a):null}async captureFeedback(e){let t=this.resolve(e);if(!t)return null;let{adapter:r,subject:a}=t,i={...t.elementInfo};if(a.sourceElement&&(i.sourceElement={...g(a.sourceElement),selector:S(a.sourceElement)}),!r.captureSubject)return{elementInfo:i};try{let n=await r.captureSubject(e.key);return n?{elementInfo:i,crop:n}:{elementInfo:i,warning:"Object crop unavailable; use the page screenshot and image coordinates."}}catch{return{elementInfo:i,warning:"Object crop unavailable (the image may block canvas access via CORS); use the page screenshot and image coordinates."}}}beginCreate(e){for(let t=this.adapters.length-1;t>=0;t-=1){let r=this.adapters[t],a=r?.beginCreate?.(e);if(r&&a)return{adapter:r,session:a}}return null}rename(e,t){let r=this.adapters.find(i=>i.id===e.adapter),a=r?.renameSubject?.(e.key,t);return r&&a?this.project(r,a):null}updateBounds(e,t){let r=this.adapters.find(i=>i.id===e.adapter),a=r?.updateSubjectBounds?.(e.key,t);return r&&a?this.project(r,a):null}updateTrackingAnchors(e,t){let r=this.adapters.find(i=>i.id===e.adapter),a=r?.updateSubjectTrackingAnchors?.(e.key,t);return r&&a?this.project(r,a):null}promote(e){let t=this.adapters.find(a=>a.id===e.adapter),r=t?.promoteSubject?.(e.key);return t&&r?this.project(t,r):null}remove(e){this.adapters.find(t=>t.id===e.adapter)?.removeSubject?.(e.key)}async captureSurfaces(){return(await Promise.all(this.adapters.map(async e=>e.captureSurfaces?.()??[]))).flat()}subscribeFrame(e){return this.frameListeners.add(e),()=>this.frameListeners.delete(e)}destroy(){this.frame!==null&&cancelAnimationFrame(this.frame),this.frame=null;for(let e of this.projections.values())e.element.remove();this.projections.clear();for(let e of this.adapterUnsubscribes)e();this.frameListeners.clear()}project(e,t){let r={adapter:e.id,key:t.key},a=`${e.id}\0${t.key}`,i=this.projections.get(a);if(i)return i.subject=t,i.elementInfo=this.elementInfo(e,t,i.selector),p(i.element,t),i;let n=f(r),s=document.createElement("div");s.dataset.popmeltSubjectAdapter=e.id,s.dataset.popmeltSubjectKey=t.key,s.dataset.popmeltSubjectLabel=t.label,s.dataset.popmeltSubjectProjection="true",s.setAttribute("aria-hidden","true"),Object.assign(s.style,{position:"fixed",pointerEvents:"none",opacity:"0",zIndex:"-1"}),p(s,t),document.body.appendChild(s);let u={adapter:e,subject:t,target:r,element:s,selector:n,elementInfo:this.elementInfo(e,t,n)};return this.projections.set(a,u),this.ensureFrame(),u}elementInfo(e,t,r){return{selector:r,tagName:e.id,subjectLabel:t.label,textContent:t.label,context:t.context,...t.imageObject?{imageObject:t.imageObject}:{},...t.videoObject?{videoObject:t.videoObject}:{},dataAttributes:{adapter:e.id,key:t.key,...t.data??{}}}}ensureFrame(){if(this.frame!==null||this.projections.size===0)return;let e=t=>{if(this.frame=null,this.lastProjectionFrameTime>0&&t-this.lastProjectionFrameTime<32){this.ensureFrame();return}this.lastProjectionFrameTime=t;let r=!1;for(let[a,i]of this.projections){let n=i.adapter.resolve(i.target.key);if(!n){i.element.remove(),this.projections.delete(a),r=!0;continue}i.subject=n,r=p(i.element,n)||r}if(r)for(let a of this.frameListeners)a();this.projections.size>0&&this.ensureFrame()};this.frame=requestAnimationFrame(e)}},v={isAnnotating:!1,activeTool:"inspector",activeColor:"oklch(0.628 0.258 29)",strokeWidth:3,annotations:[],undoStack:[],redoStack:[],selectedAnnotationIds:[],lastSelectedId:null,styleModifications:[],textModifications:[],domModifications:[],spacingTokenChanges:[],spacingTokenMods:[]};export{f as a,y as b,k as c,v as d};
|
package/dist/chunk-YC7B37F6.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as p}from"./chunk-NOHXTT24.mjs";import{request as c}from"http";function u(){let e=process.env.POPMELT_BRIDGE_URL;if(!e)return null;try{let t=new URL(e);return{port:t.port?Number.parseInt(t.port,10):null,projectId:process.env.POPMELT_PROJECT_ID||null,leaseEligible:!1}}catch{return null}}async function h(e,t,i){let r=u();if(e?.bridge===!1||r)return r??{port:null,projectId:null,leaseEligible:!1};try{let{startPopmelt:o}=await import("./server-J5NV3BMT.mjs"),n=t.config?.server?.host,l=n===!0?"0.0.0.0":n||"localhost",s=t.config?.server?.port??i,d=`http://${l==="0.0.0.0"?"localhost":l}:${s}`,a=await o({port:e?.port,projectRoot:e?.projectRoot,devOrigin:d,force:!0,detached:!0,manageLease:!1});return console.log(`[popmelt] bridge ready at http://localhost:${a.port}`),{port:a.port,projectId:a.projectId,leaseEligible:!0}}catch(o){let n=o instanceof Error?o.message:String(o);return console.warn("[popmelt] bridge failed to start:",n),{port:null,projectId:null,leaseEligible:!1}}}async function v(e,t,i=fetch){if(!e.leaseEligible||e.port===null)return null;let r=await p({port:e.port,projectId:e.projectId},i);if(!r)return null;let o=()=>{n()},n=async()=>{process.removeListener("beforeExit",o),await r.release()};return process.once("beforeExit",o),t.httpServer?.once("close",()=>{n()}),{id:r.id,release:n}}function g(e,t,i){if(i.port===null)return null;let r=new URL(t,"http://popmelt.local");if(r.pathname!==`${e}/status`)return null;let o=new URL("/status",`http://localhost:${i.port}`);return r.searchParams.forEach((n,l)=>o.searchParams.append(l,n)),i.projectId&&o.searchParams.set("projectId",i.projectId),o}function b(e,t){return(i,r,o)=>{let n=g(e,i.url||"",t());if(!n)return o();let l=c(n,{method:i.method,headers:{...i.headers,host:n.host}},s=>{r.writeHead(s.statusCode||502,s.headers),s.pipe(r)});l.on("error",()=>{r.writeHead(502,{"Content-Type":"text/plain"}),r.end(`Popmelt bridge not running on port ${t().port}`)}),i.pipe(l)}}function P(e){let t=e.port===null?null:`http://localhost:${e.port}`;return`window.__POPMELT_BRIDGE_URL__=${JSON.stringify(t)};window.__POPMELT_PROJECT_ID__=${JSON.stringify(e.projectId)};`}export{h as a,v as b,b as c,P as d};
|