@dropins/tools 1.0.1-alpha04151330 → 1.0.1-alpha04151720

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.
Files changed (2) hide show
  1. package/lib.js +1 -1
  2. package/package.json +1 -1
package/lib.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{d as M,S as v}from"./chunks/deviceUtils.js";import{R as Z,V as x,c as ee,a as re,g as te,b as ne,i as oe}from"./chunks/deviceUtils.js";import{C as ie,I as le,i as de}from"./chunks/initializer.js";import{jsx as L}from"./preact-jsx-runtime.js";import{x as O,A as C,h as P,T as E,E as _,q as f,y as D,_ as V}from"./chunks/icons/Add.js";import{IntlContext as F}from"./i18n.js";import{g as ue,s as ce}from"./chunks/image-params-keymap.js";import"./signals.js";const A=r=>{const n=new FormData(r);return Object.fromEntries(n)},U=r=>{const n=new FormData(r),l=Object.fromEntries(n);return Object.entries(l).reduce((o,[d])=>{const i=r.elements[d];return i!=null&&i.validationMessage?{...o,[d]:i.validationMessage}:{...o}},{})},T={arrayMerge:(r,n,l)=>{const u=r.slice();return n.forEach((o,d)=>{typeof u[d]>"u"?u[d]=l.cloneUnlessOtherwiseSpecified(o,l):l.isMergeableObject(o)?u[d]=M(r[d],o,l):r.indexOf(o)===-1&&u.push(o)}),u}};function W(r,n){return n?M(r,n,T):r}const G=r=>r.replace("_","-");function q(r,n={},l,u,o){const d=O(v),i=C(null),c=C("pending"),w=C([]),[m,R]=P({children:[u]}),[I,$]=P({}),N=E(()=>({get:t=>I[t],set:(t,e)=>{$({...N,[t]:e})}}),[I]),{intl:j}=O(F);n.dictionary=j.dictionary,n._setProps=t=>{R(e=>{const s=typeof t=="function"?t(e):t;if(o){const a=_(o(e),{key:"render"}),S=e.children.findIndex(p=>(p==null?void 0:p.key)==="render");e.children[S]=a}return s})};const g=f(t=>{typeof t=="function"?w.current.push(t):console.warn("Skipped: Invalid _registerMethod",t)},[]);n._registerMethod=g;const h=f(t=>L("div",{"data-slot-html-element":t.tagName.toLowerCase(),ref:e=>{e==null||e.appendChild(t)}}),[]);n._htmlElementToVNode=h,n.getSlotElement=f(t=>{var s,a;const e=(s=i.current)==null?void 0:s.querySelector(`[data-slot-key="${t}"]`);if(y(`🟦 "${r}" Slot getSlotElement: ${t}`,(a=i.current)==null?void 0:a.cloneNode(!0),e==null?void 0:e.cloneNode(!0)),!!e)return{appendChild:S=>{e.appendChild(S)},prependChild:S=>{e.insertBefore(S,e.firstChild)},appendSibling:S=>{const p=e.parentNode;p==null||p.insertBefore(S,e.nextSibling)},prependSibling:S=>{const p=e.parentNode;p==null||p.insertBefore(S,e)}}},[r]),n.onRender=f(t=>{w.current.push(t)},[]),n.onChange=n.onRender,n.replaceWith=f(t=>{g(e=>{const s=h(t);e._setProps({children:[s]})})},[h,g]),n.appendChild=f(t=>{g(e=>{const s=h(t);e._setProps(a=>({...a,children:[...a.children,s]}))})},[h,g]),n.prependChild=f(t=>{g(e=>{const s=h(t);e._setProps(a=>({...a,children:[s,...a.children]}))})},[h,g]),n.appendSibling=f(t=>{g(()=>{var s,a;const e=(s=i.current)==null?void 0:s.parentNode;e==null||e.insertBefore(t,((a=i.current)==null?void 0:a.nextSibling)??null)})},[g]),n.prependSibling=f(t=>{g(()=>{var s;const e=(s=i.current)==null?void 0:s.parentNode;e==null||e.insertBefore(t,i.current)})},[g]);const b=f(async()=>{if(c.current==="loading")return;c.current="loading",y(`🟨 "${r}" Slot Rendered`);const t=o?_(o(m),{key:"render"}):null;R({children:[t??u]}),w.current.forEach(e=>{e(n,N)}),c.current="ready"},[u,n,r,m,o,N]),B=f(async()=>{if(l)try{c.current="loading",y(`🟩 "${r}" Slot Initialized`),await l(n,i.current)}catch(t){console.error(`Error in "${l.name}" Slot callback`,t)}finally{c.current="ready",await b()}},[l,n,b,r]);return D(()=>{B().finally(()=>{d&&(d.value.delete(r),d.value=new Set(d.value))})},[]),D(()=>{b()},[JSON.stringify(n),JSON.stringify(I)]),[i,m]}function H({name:r,context:n,slot:l,children:u,render:o,wrapperTag:d="div",...i}){const c=O(v),[w,m]=q(r,n,l,u,o);return E(()=>{if(!r)return console.warn('Slot "name" is required');c&&(c.value.add(r),c.value=new Set(c.value))},[r,c]),V(d,{...i,ref:w,"data-slot":r},m.children)}window.DROPINS=window.DROPINS||{};window.DROPINS.showSlots=async r=>{window.sessionStorage.setItem("dropin-debugger--show-slots",r.toString()),document.body.classList.toggle("dropin-debugger--show-slots",r)};let y=()=>{};window.DROPINS.logSlots=async r=>{window.sessionStorage.setItem("dropin-debugger--log-slots",r.toString()),y=r?(...n)=>console.log(...n):()=>{}};window.DROPINS.showSlots(window.sessionStorage.getItem("dropin-debugger--show-slots")==="true");window.DROPINS.logSlots(window.sessionStorage.getItem("dropin-debugger--log-slots")==="true");export{ie as Config,le as Initializer,Z as Render,H as Slot,v as SlotQueueContext,x as VComponent,ee as classes,re as debounce,M as deepmerge,te as generateSrcset,U as getFormErrors,A as getFormValues,ue as getImageParamsKeyMap,de as initializers,ne as isIOSMobileDevice,oe as isNumber,W as merge,ce as setImageParamsKeyMap,G as toLanguageTag,q as useSlot};
3
+ import{d as v,S as E}from"./chunks/deviceUtils.js";import{R as Z,V as x,c as ee,a as re,g as te,b as ne,i as oe}from"./chunks/deviceUtils.js";import{C as ie,I as le,i as de}from"./chunks/initializer.js";import{x as R,A as O,h as _,T as $,E as D,q as f,_ as B,y as M}from"./chunks/icons/Add.js";import{IntlContext as F}from"./i18n.js";import{g as ue,s as ce}from"./chunks/image-params-keymap.js";import"./preact-jsx-runtime.js";import"./signals.js";const A=r=>{const n=new FormData(r);return Object.fromEntries(n)},U=r=>{const n=new FormData(r),i=Object.fromEntries(n);return Object.entries(i).reduce((o,[a])=>{const u=r.elements[a];return u!=null&&u.validationMessage?{...o,[a]:u.validationMessage}:{...o}},{})},q={arrayMerge:(r,n,i)=>{const d=r.slice();return n.forEach((o,a)=>{typeof d[a]>"u"?d[a]=i.cloneUnlessOtherwiseSpecified(o,i):i.isMergeableObject(o)?d[a]=v(r[a],o,i):r.indexOf(o)===-1&&d.push(o)}),d}};function W(r,n){return n?v(r,n,q):r}const G=r=>r.replace("_","-");function z(r,n={},i,d,o,a="div"){const u=R(E),S=O(null),c=O("pending"),m=O([]),[y,P]=_({children:[d]}),[N,L]=_({}),b=$(()=>({get:t=>N[t],set:(t,e)=>{L({...b,[t]:e})}}),[N]),{intl:V}=R(F);n.dictionary=V.dictionary,n._setProps=t=>{P(e=>{const s=typeof t=="function"?t(e):t;if(o){const l=D(o(e),{key:"render"}),h=e.children.findIndex(p=>(p==null?void 0:p.key)==="render");e.children[h]=l}return s})};const g=f(t=>{typeof t=="function"?m.current.push(t):console.warn("Skipped: Invalid _registerMethod",t)},[]);n._registerMethod=g;const w=f(t=>B(a,{"data-slot-html-element":t.tagName.toLowerCase(),ref:e=>{e==null||e.appendChild(t)}},null),[a]);n._htmlElementToVNode=w,n.getSlotElement=f(t=>{var s,l;const e=(s=S.current)==null?void 0:s.querySelector(`[data-slot-key="${t}"]`);if(I(`🟦 "${r}" Slot getSlotElement: ${t}`,(l=S.current)==null?void 0:l.cloneNode(!0),e==null?void 0:e.cloneNode(!0)),!!e)return{appendChild:h=>{e.appendChild(h)},prependChild:h=>{e.insertBefore(h,e.firstChild)},appendSibling:h=>{const p=e.parentNode;p==null||p.insertBefore(h,e.nextSibling)},prependSibling:h=>{const p=e.parentNode;p==null||p.insertBefore(h,e)}}},[r]),n.onRender=f(t=>{m.current.push(t)},[]),n.onChange=n.onRender,n.replaceWith=f(t=>{g(e=>{const s=w(t);e._setProps({children:[s]})})},[w,g]),n.appendChild=f(t=>{g(e=>{const s=w(t);e._setProps(l=>({...l,children:[...l.children,s]}))})},[w,g]),n.prependChild=f(t=>{g(e=>{const s=w(t);e._setProps(l=>({...l,children:[s,...l.children]}))})},[w,g]),n.appendSibling=f(t=>{g(()=>{var s,l;const e=(s=S.current)==null?void 0:s.parentNode;e==null||e.insertBefore(t,((l=S.current)==null?void 0:l.nextSibling)??null)})},[g]),n.prependSibling=f(t=>{g(()=>{var s;const e=(s=S.current)==null?void 0:s.parentNode;e==null||e.insertBefore(t,S.current)})},[g]);const C=f(async()=>{if(c.current==="loading")return;c.current="loading",I(`🟨 "${r}" Slot Rendered`);const t=o?D(o(y),{key:"render"}):null;P({children:[t??d]}),m.current.forEach(e=>{e(n,b)}),c.current="ready"},[d,n,r,y,o,b]),j=f(async()=>{if(i)try{c.current="loading",I(`🟩 "${r}" Slot Initialized`),await i(n,S.current)}catch(t){console.error(`Error in "${i.name}" Slot callback`,t)}finally{c.current="ready",await C()}},[i,n,C,r]);return M(()=>{j().finally(()=>{u&&(u.value.delete(r),u.value=new Set(u.value))})},[]),M(()=>{C()},[JSON.stringify(n),JSON.stringify(N)]),[S,y]}function H({name:r,context:n,slot:i,children:d,render:o,slotTag:a="div",contentTag:u="div",...S}){const c=R(E),[m,y]=z(r,n,i,d,o,u);return $(()=>{if(!r)return console.warn('Slot "name" is required');c&&(c.value.add(r),c.value=new Set(c.value))},[r,c]),B(a,{...S,ref:m,"data-slot":r},y.children)}window.DROPINS=window.DROPINS||{};window.DROPINS.showSlots=async r=>{window.sessionStorage.setItem("dropin-debugger--show-slots",r.toString()),document.body.classList.toggle("dropin-debugger--show-slots",r)};let I=()=>{};window.DROPINS.logSlots=async r=>{window.sessionStorage.setItem("dropin-debugger--log-slots",r.toString()),I=r?(...n)=>console.log(...n):()=>{}};window.DROPINS.showSlots(window.sessionStorage.getItem("dropin-debugger--show-slots")==="true");window.DROPINS.logSlots(window.sessionStorage.getItem("dropin-debugger--log-slots")==="true");export{ie as Config,le as Initializer,Z as Render,H as Slot,E as SlotQueueContext,x as VComponent,ee as classes,re as debounce,v as deepmerge,te as generateSrcset,U as getFormErrors,A as getFormValues,ue as getImageParamsKeyMap,de as initializers,ne as isIOSMobileDevice,oe as isNumber,W as merge,ce as setImageParamsKeyMap,G as toLanguageTag,z as useSlot};
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/tools", "version": "1.0.1-alpha04151330", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/tools", "version": "1.0.1-alpha04151720", "license": "SEE LICENSE IN LICENSE.md"}