@spiffcommerce/theme-bridge 1.9.3 → 1.9.4

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/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
1
2
  var x_ = Object.defineProperty;
2
3
  var C_ = (_, e, t) => e in _ ? x_(_, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[e] = t;
3
4
  var q = (_, e, t) => (C_(_, typeof e != "symbol" ? e + "" : e, t), t);
@@ -1 +1,2 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
1
2
  (function(b,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(b=typeof globalThis<"u"?globalThis:b||self,k(b.theme={}))})(this,function(b){"use strict";var Z_=Object.defineProperty;var j_=(b,k,S)=>k in b?Z_(b,k,{enumerable:!0,configurable:!0,writable:!0,value:S}):b[k]=S;var Y=(b,k,S)=>(j_(b,typeof k!="symbol"?k+"":k,S),S);var k=(_=>(_.Javascript="Javascript",_.CSS="CSS",_))(k||{}),S=(_=>(_.Asset="Asset",_.Boolean="Boolean",_.Color="Color",_.Heading="Heading",_.MultiLineText="MultiLineText",_.Number="Number",_.Select="Select",_.SingleLineText="SingleLineText",_))(S||{}),__=(_=>(_.Color="Color",_.ColorProfile="ColorProfile",_.Data="Data",_.Environment="Environment",_.Font="Font",_.Frame="Frame",_.Illustration="Illustration",_.Image="Image",_.Material="Material",_.Model="Model",_.Video="Video",_))(__||{}),D,s,e_,H,t_,n_,Z,P={},o_=[],w_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,j=Array.isArray;function E(_,e){for(var t in e)_[t]=e[t];return _}function r_(_){var e=_.parentNode;e&&e.removeChild(_)}function H_(_,e,t){var n,r,i,u={};for(i in e)i=="key"?n=e[i]:i=="ref"?r=e[i]:u[i]=e[i];if(arguments.length>2&&(u.children=arguments.length>3?D.call(arguments,2):t),typeof _=="function"&&_.defaultProps!=null)for(i in _.defaultProps)u[i]===void 0&&(u[i]=_.defaultProps[i]);return N(_,u,n,r,null)}function N(_,e,t,n,r){var i={type:_,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r??++e_,__i:-1,__u:0};return r==null&&s.vnode!=null&&s.vnode(i),i}function L(_){return _.children}function I(_,e){this.props=_,this.context=e}function $(_,e){if(e==null)return _.__?$(_.__,_.__i+1):null;for(var t;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null)return t.__e;return typeof _.type=="function"?$(_):null}function i_(_){var e,t;if((_=_.__)!=null&&_.__c!=null){for(_.__e=_.__c.base=null,e=0;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null){_.__e=_.__c.base=t.__e;break}return i_(_)}}function l_(_){(!_.__d&&(_.__d=!0)&&H.push(_)&&!M.__r++||t_!==s.debounceRendering)&&((t_=s.debounceRendering)||n_)(M)}function M(){var _,e,t,n,r,i,u,l,c;for(H.sort(Z);_=H.shift();)_.__d&&(e=H.length,n=void 0,i=(r=(t=_).__v).__e,l=[],c=[],(u=t.__P)&&((n=E({},r)).__v=r.__v+1,s.vnode&&s.vnode(n),R(u,n,r,t.__n,u.ownerSVGElement!==void 0,32&r.__u?[i]:null,l,i??$(r),!!(32&r.__u),c),n.__.__k[n.__i]=n,d_(l,n,c),n.__e!=i&&i_(n)),H.length>e&&H.sort(Z));M.__r=0}function f_(_,e,t,n,r,i,u,l,c,f,d){var o,p,a,m,x,g=n&&n.__k||o_,h=e.length;for(t.__d=c,$_(t,e,g),c=t.__d,o=0;o<h;o++)(a=t.__k[o])!=null&&typeof a!="boolean"&&typeof a!="function"&&(p=a.__i===-1?P:g[a.__i]||P,a.__i=o,R(_,a,p,r,i,u,l,c,f,d),m=a.__e,a.ref&&p.ref!=a.ref&&(p.ref&&z(p.ref,null,a),d.push(a.ref,a.__c||m,a)),x==null&&m!=null&&(x=m),65536&a.__u||p.__k===a.__k?c=u_(a,c,_):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:m&&(c=m.nextSibling),a.__d=void 0,a.__u&=-196609);t.__d=c,t.__e=x}function $_(_,e,t){var n,r,i,u,l,c=e.length,f=t.length,d=f,o=0;for(_.__k=[],n=0;n<c;n++)(r=_.__k[n]=(r=e[n])==null||typeof r=="boolean"||typeof r=="function"?null:typeof r=="string"||typeof r=="number"||typeof r=="bigint"||r.constructor==String?N(null,r,null,null,r):j(r)?N(L,{children:r},null,null,null):r.constructor===void 0&&r.__b>0?N(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)!=null?(r.__=_,r.__b=_.__b+1,l=P_(r,t,u=n+o,d),r.__i=l,i=null,l!==-1&&(d--,(i=t[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&o--,typeof r.type!="function"&&(r.__u|=65536)):l!==u&&(l===u+1?o++:l>u?d>c-u?o+=l-u:o--:o=l<u&&l==u-1?l-u:0,l!==n+o&&(r.__u|=65536))):(i=t[n])&&i.key==null&&i.__e&&(i.__e==_.__d&&(_.__d=$(i)),G(i,i,!1),t[n]=null,d--);if(d)for(n=0;n<f;n++)(i=t[n])!=null&&!(131072&i.__u)&&(i.__e==_.__d&&(_.__d=$(i)),G(i,i))}function u_(_,e,t){var n,r;if(typeof _.type=="function"){for(n=_.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=_,e=u_(n[r],e,t));return e}return _.__e!=e&&(t.insertBefore(_.__e,e||null),e=_.__e),e&&e.nextSibling}function P_(_,e,t,n){var r=_.key,i=_.type,u=t-1,l=t+1,c=e[t];if(c===null||c&&r==c.key&&i===c.type)return t;if(n>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<e.length;){if(u>=0){if((c=e[u])&&!(131072&c.__u)&&r==c.key&&i===c.type)return u;u--}if(l<e.length){if((c=e[l])&&!(131072&c.__u)&&r==c.key&&i===c.type)return l;l++}}return-1}function c_(_,e,t){e[0]==="-"?_.setProperty(e,t??""):_[e]=t==null?"":typeof t!="number"||w_.test(e)?t:t+"px"}function U(_,e,t,n,r){var i;_:if(e==="style")if(typeof t=="string")_.style.cssText=t;else{if(typeof n=="string"&&(_.style.cssText=n=""),n)for(e in n)t&&e in t||c_(_.style,e,"");if(t)for(e in t)n&&t[e]===n[e]||c_(_.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")i=e!==(e=e.replace(/(PointerCapture)$|Capture$/,"$1")),e=e.toLowerCase()in _?e.toLowerCase().slice(2):e.slice(2),_.l||(_.l={}),_.l[e+i]=t,t?n?t.u=n.u:(t.u=Date.now(),_.addEventListener(e,i?s_:a_,i)):_.removeEventListener(e,i?s_:a_,i);else{if(r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in _)try{_[e]=t??"";break _}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!=="-"?_.removeAttribute(e):_.setAttribute(e,t))}}function a_(_){var e=this.l[_.type+!1];if(_.t){if(_.t<=e.u)return}else _.t=Date.now();return e(s.event?s.event(_):_)}function s_(_){return this.l[_.type+!0](s.event?s.event(_):_)}function R(_,e,t,n,r,i,u,l,c,f){var d,o,p,a,m,x,g,h,y,w,B,T,E_,O,X,C=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),i=[l=e.__e=t.__e]),(d=s.__b)&&d(e);_:if(typeof C=="function")try{if(h=e.props,y=(d=C.contextType)&&n[d.__c],w=d?y?y.props.value:d.__:n,t.__c?g=(o=e.__c=t.__c).__=o.__E:("prototype"in C&&C.prototype.render?e.__c=o=new C(h,w):(e.__c=o=new I(h,w),o.constructor=C,o.render=D_),y&&y.sub(o),o.props=h,o.state||(o.state={}),o.context=w,o.__n=n,p=o.__d=!0,o.__h=[],o._sb=[]),o.__s==null&&(o.__s=o.state),C.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=E({},o.__s)),E(o.__s,C.getDerivedStateFromProps(h,o.__s))),a=o.props,m=o.state,o.__v=e,p)C.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else{if(C.getDerivedStateFromProps==null&&h!==a&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(h,w),!o.__e&&(o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(h,o.__s,w)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(o.props=h,o.state=o.__s,o.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(q){q&&(q.__=e)}),B=0;B<o._sb.length;B++)o.__h.push(o._sb[B]);o._sb=[],o.__h.length&&u.push(o);break _}o.componentWillUpdate!=null&&o.componentWillUpdate(h,o.__s,w),o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(a,m,x)})}if(o.context=w,o.props=h,o.__P=_,o.__e=!1,T=s.__r,E_=0,"prototype"in C&&C.prototype.render){for(o.state=o.__s,o.__d=!1,T&&T(e),d=o.render(o.props,o.state,o.context),O=0;O<o._sb.length;O++)o.__h.push(o._sb[O]);o._sb=[]}else do o.__d=!1,T&&T(e),d=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++E_<25);o.state=o.__s,o.getChildContext!=null&&(n=E(E({},n),o.getChildContext())),p||o.getSnapshotBeforeUpdate==null||(x=o.getSnapshotBeforeUpdate(a,m)),f_(_,j(X=d!=null&&d.type===L&&d.key==null?d.props.children:d)?X:[X],e,t,n,r,i,u,l,c,f),o.base=e.__e,e.__u&=-161,o.__h.length&&u.push(o),g&&(o.__E=o.__=null)}catch(q){e.__v=null,c||i!=null?(e.__e=l,e.__u|=c?160:32,i[i.indexOf(l)]=null):(e.__e=t.__e,e.__k=t.__k),s.__e(q,e,t)}else i==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=T_(t.__e,e,t,n,r,i,u,c,f);(d=s.diffed)&&d(e)}function d_(_,e,t){e.__d=void 0;for(var n=0;n<t.length;n++)z(t[n],t[++n],t[++n]);s.__c&&s.__c(e,_),_.some(function(r){try{_=r.__h,r.__h=[],_.some(function(i){i.call(r)})}catch(i){s.__e(i,r.__v)}})}function T_(_,e,t,n,r,i,u,l,c){var f,d,o,p,a,m,x,g=t.props,h=e.props,y=e.type;if(y==="svg"&&(r=!0),i!=null){for(f=0;f<i.length;f++)if((a=i[f])&&"setAttribute"in a==!!y&&(y?a.localName===y:a.nodeType===3)){_=a,i[f]=null;break}}if(_==null){if(y===null)return document.createTextNode(h);_=r?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,h.is&&h),i=null,l=!1}if(y===null)g===h||l&&_.data===h||(_.data=h);else{if(i=i&&D.call(_.childNodes),g=t.props||P,!l&&i!=null)for(g={},f=0;f<_.attributes.length;f++)g[(a=_.attributes[f]).name]=a.value;for(f in g)a=g[f],f=="children"||(f=="dangerouslySetInnerHTML"?o=a:f==="key"||f in h||U(_,f,null,a,r));for(f in h)a=h[f],f=="children"?p=a:f=="dangerouslySetInnerHTML"?d=a:f=="value"?m=a:f=="checked"?x=a:f==="key"||l&&typeof a!="function"||g[f]===a||U(_,f,a,g[f],r);if(d)l||o&&(d.__html===o.__html||d.__html===_.innerHTML)||(_.innerHTML=d.__html),e.__k=[];else if(o&&(_.innerHTML=""),f_(_,j(p)?p:[p],e,t,n,r&&y!=="foreignObject",i,u,i?i[0]:t.__k&&$(t,0),l,c),i!=null)for(f=i.length;f--;)i[f]!=null&&r_(i[f]);l||(f="value",m!==void 0&&(m!==_[f]||y==="progress"&&!m||y==="option"&&m!==g[f])&&U(_,f,m,g[f],!1),f="checked",x!==void 0&&x!==_[f]&&U(_,f,x,g[f],!1))}return _}function z(_,e,t){try{typeof _=="function"?_(e):_.current=e}catch(n){s.__e(n,t)}}function G(_,e,t){var n,r;if(s.unmount&&s.unmount(_),(n=_.ref)&&(n.current&&n.current!==_.__e||z(n,null,e)),(n=_.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){s.__e(i,e)}n.base=n.__P=null,_.__c=void 0}if(n=_.__k)for(r=0;r<n.length;r++)n[r]&&G(n[r],e,t||typeof _.type!="function");t||_.__e==null||r_(_.__e),_.__=_.__e=_.__d=void 0}function D_(_,e,t){return this.constructor(_,t)}function N_(_,e,t){var n,r,i,u;s.__&&s.__(_,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,i=[],u=[],R(e,_=(!n&&t||e).__k=H_(L,null,[_]),r||P,P,e.ownerSVGElement!==void 0,!n&&t?[t]:r?null:e.firstChild?D.call(e.childNodes):null,i,!n&&t?t:r?r.__e:e.firstChild,n,u),d_(i,_,u)}D=o_.slice,s={__e:function(_,e,t,n){for(var r,i,u;e=e.__;)if((r=e.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(_)),u=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(_,n||{}),u=r.__d),u)return r.__E=r}catch(l){_=l}throw _}},e_=0,I.prototype.setState=function(_,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=E({},this.state),typeof _=="function"&&(_=_(E({},t),this.props)),_&&E(t,_),_!=null&&this.__v&&(e&&this._sb.push(e),l_(this))},I.prototype.forceUpdate=function(_){this.__v&&(this.__e=!0,_&&this.__h.push(_),l_(this))},I.prototype.render=L,H=[],n_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(_,e){return _.__v.__b-e.__v.__b},M.__r=0;var A,v,J,p_,K=0,h_=[],W=[],v_=s.__b,m_=s.__r,g_=s.diffed,y_=s.__c,b_=s.unmount;function k_(_,e){s.__h&&s.__h(v,_,K||e),K=0;var t=v.__H||(v.__H={__:[],__h:[]});return _>=t.__.length&&t.__.push({__V:W}),t.__[_]}function L_(_){return K=1,I_(x_,_)}function I_(_,e,t){var n=k_(A++,2);if(n.t=_,!n.__c&&(n.__=[t?t(e):x_(void 0,e),function(l){var c=n.__N?n.__N[0]:n.__[0],f=n.t(c,l);c!==f&&(n.__N=[f,n.__[1]],n.__c.setState({}))}],n.__c=v,!v.u)){var r=function(l,c,f){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(p){return p.__c});if(d.every(function(p){return!p.__N}))return!i||i.call(this,l,c,f);var o=!1;return d.forEach(function(p){if(p.__N){var a=p.__[0];p.__=p.__N,p.__N=void 0,a!==p.__[0]&&(o=!0)}}),!(!o&&n.__c.props===l)&&(!i||i.call(this,l,c,f))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,f){if(this.__e){var d=i;i=void 0,r(l,c,f),i=d}u&&u.call(this,l,c,f)},v.shouldComponentUpdate=r}return n.__N||n.__}function M_(_,e){var t=k_(A++,3);!s.__s&&W_(t.__H,e)&&(t.__=_,t.i=e,v.__H.__h.push(t))}function U_(){for(var _;_=h_.shift();)if(_.__P&&_.__H)try{_.__H.__h.forEach(F),_.__H.__h.forEach(Q),_.__H.__h=[]}catch(e){_.__H.__h=[],s.__e(e,_.__v)}}s.__b=function(_){v=null,v_&&v_(_)},s.__r=function(_){m_&&m_(_),A=0;var e=(v=_.__c).__H;e&&(J===v?(e.__h=[],v.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=W,t.__N=t.i=void 0})):(e.__h.forEach(F),e.__h.forEach(Q),e.__h=[],A=0)),J=v},s.diffed=function(_){g_&&g_(_);var e=_.__c;e&&e.__H&&(e.__H.__h.length&&(h_.push(e)!==1&&p_===s.requestAnimationFrame||((p_=s.requestAnimationFrame)||A_)(U_)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==W&&(t.__=t.__V),t.i=void 0,t.__V=W})),J=v=null},s.__c=function(_,e){e.some(function(t){try{t.__h.forEach(F),t.__h=t.__h.filter(function(n){return!n.__||Q(n)})}catch(n){e.some(function(r){r.__h&&(r.__h=[])}),e=[],s.__e(n,t.__v)}}),y_&&y_(_,e)},s.unmount=function(_){b_&&b_(_);var e,t=_.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{F(n)}catch(r){e=r}}),t.__H=void 0,e&&s.__e(e,t.__v))};var C_=typeof requestAnimationFrame=="function";function A_(_){var e,t=function(){clearTimeout(n),C_&&cancelAnimationFrame(e),setTimeout(_)},n=setTimeout(t,100);C_&&(e=requestAnimationFrame(t))}function F(_){var e=v,t=_.__c;typeof t=="function"&&(_.__c=void 0,t()),v=e}function Q(_){var e=v;_.__c=_.__(),v=e}function W_(_,e){return!_||_.length!==e.length||e.some(function(t,n){return t!==_[n]})}function x_(_,e){return typeof e=="function"?e(_):e}var F_=0;function S_(_,e,t,n,r,i){var u,l,c={};for(l in e)l=="ref"?u=e[l]:c[l]=e[l];var f={type:_,props:c,key:t,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--F_,__i:-1,__u:0,__source:r,__self:i};if(typeof _=="function"&&(u=_.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return s.vnode&&s.vnode(f),f}class V_{constructor(){Y(this,"_context");Y(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(e=>{this._getContextCallbacks.push(e)})}setContext(e){this._context=e,this._getContextCallbacks.forEach(t=>t(e)),this._getContextCallbacks=[]}configureClient(e){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(e){console.log("Add to cart",e)}}let V;const B_=({context:_})=>{const[e,t]=L_(null);return M_(()=>{if(e){if(V===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");V.setContext({..._,container:e})}},[e,_]),S_("div",{ref:t,id:"spiffThemeWrapper"})};function O_(_,e){V=new V_,window.SpiffThemeLoader=V;let t;typeof _=="string"?t=document.getElementById(_):t=_,N_(S_(B_,{context:e}),t)}function q_(_){return{id:"example",themeInstallId:(_==null?void 0:_.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],..._}}b.AssetType=__,b.FieldType=S,b.ThemeFileType=k,b.exampleThemeInstallConfig=q_,b.setSpiffDevOptions=O_,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/theme-bridge",
3
- "version": "1.9.3",
3
+ "version": "1.9.4",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "tsc && vite build",
@@ -32,6 +32,7 @@
32
32
  "tsup": "^8.0.1",
33
33
  "typescript": "^5.2.2",
34
34
  "vite": "^5.0.8",
35
+ "vite-plugin-css-injected-by-js": "^3.4.0",
35
36
  "vite-plugin-externalize-deps": "^0.8.0"
36
37
  }
37
38
  }
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
- #spiffThemeWrapper{width:100%;height:100%}