@sitecore/byoc
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -1,2 +0,2 @@ | ||
var K=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[d(o)]:e[o]}),{}),T=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[f(o)]:e[o]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return f(e).replace(t,function(o){return"-"+o.toLowerCase()})}function f(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,o)=>o===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function C(e,t={}){let o=e.properties||{};return{type:"object",...e,properties:Object.keys(o).reduce((r,n)=>Object.assign(r,{[n]:{...o[n],default:t.hasOwnProperty(n)?t[n]:o[n].default,title:o[n].title||d(n).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var y=(e,t)=>{let o={...e};return Object.keys(t).filter(n=>/(integer|number)/.test(t[n].type)).forEach(n=>{var i;!((i=o[n])===null||i===void 0)&&i["ui:widget"]||(o[n]={...o[n],"ui:widget":"updown"})}),o};function v(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function A(e,t){return Object.keys(t).reduce((o,r)=>{let n=t[r],i=f(r),s=e?.properties[i],c=s?.type,a=v(n,c);return a!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...o,[i]:a}:o},{})}function w(e,t){return{...B(e),...A(e,t)}}function B(e){return Object.keys(e.properties).reduce((t,o)=>{var r,n;return((r=e.properties[o])===null||r===void 0?void 0:r.default)!=null?{...t,[o]:(n=e.properties[o])===null||n===void 0?void 0:n.default}:t},{})}function D(e,t,o){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:n,id:i=e.name,group:s=null,ui:c,isHidden:a=!1,uiSchema:l,schema:g,...u}=e,E=g||u||{},_=l||c||{},p=C({description:"External component",...E,type:"object"},o),P=y(_,p.properties||{});return{component:t,name:n,schema:p,uiSchema:P,thumbnail:r,group:s,isHidden:a,id:i,title:p?.title||u?.title||n}}var x,m=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},S=m.BYOCWebComponent||(m.BYOCWebComponent=typeof HTMLElement>"u"?typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{}:HTMLElement),b=m.BYOCComponents||(m.BYOCComponents={});function J(e,t,o={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=D(t,e,o);b[r.id]=r,e&&"prototype"in e&&e.prototype instanceof S&&h.register("byoc-"+d(t.name),void 0,e),j()}function W(e,t={}){var o;let r=(o=O(e))===null||o===void 0?void 0:o.schema;return r?w(r,t):t}function I(e){let t=O(e);return Object.keys(t?.schema.properties||{}).filter(o=>{var r,n;return((n=(r=t?.uiSchema)===null||r===void 0?void 0:r[o])===null||n===void 0?void 0:n["ui:widget"])!="hidden"})}function O(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,o]=e.split("?");var r=b[t];if(o){let n=b[e];if(!n&&!r)return null;n&&(r={...r,...n,component:n.component||r?.component}),o.split(/\&/g).forEach(i=>{var s,c,a;let[l,g]=i.split("="),u=((s=r.schema.properties)===null||s===void 0?void 0:s[l])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[l]:{...u,default:v(decodeURIComponent(g),u.type)}}},uiSchema:{...r.uiSchema,[l]:{...r.uiSchema[l],"ui:widget":(a=(c=r.uiSchema[l])===null||c===void 0?void 0:c["ui:widget"])!==null&&a!==void 0?a:"hidden"}}}})}return r}function j(){clearTimeout(x),x=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(b)}),"*"))},30)}j();var h=class extends S{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{J(null,t)})}catch{}}static register(t,o,r=this){o==null&&(o=typeof window<"u"?window:void 0),o&&!o.customElements.get(t)&&o.customElements.define(t,r)}};h.register("byoc-registration");export{h as BYOCRegistration,S as WebComponent,O as getComponent,I as getComponentConfigurablePropertyNames,W as getComponentProperties,B as getSchemaDefaults,w as getSchemaProperties,D as normalizeOptions,T as objectKeysToCamelCase,K as objectKeysToKebabCase,A as parseSchemaProperties,v as parseValue,J as registerComponent,b as registered,j as setRegistrationCallback,f as toCamelCase,d as toKebabCase,C as transformSchema,y as transformUiSchema}; | ||
var T=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[d(o)]:e[o]}),{}),L=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[f(o)]:e[o]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return f(e).replace(t,function(o){return"-"+o.toLowerCase()})}function f(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,o)=>o===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function v(e,t={}){let o=e.properties||{};return{type:"object",...e,properties:Object.keys(o).reduce((n,r)=>Object.assign(n,{[r]:{...o[r],default:t.hasOwnProperty(r)?t[r]:o[r].default,title:o[r].title||d(r).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var y=(e,t)=>{let o={...e};return Object.keys(t).filter(r=>/(integer|number)/.test(t[r].type)).forEach(r=>{var i;!((i=o[r])===null||i===void 0)&&i["ui:widget"]||(o[r]={...o[r],"ui:widget":"updown"})}),o};function C(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function A(e,t){return Object.keys(t).reduce((o,n)=>{let r=t[n],i=f(n),s=e?.properties[i],c=s?.type,a=C(r,c);return a!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?{...o,[i]:a}:o},{})}function w(e,t){return{...P(e),...A(e,t)}}function P(e){return Object.keys(e.properties).reduce((t,o)=>{var n,r;return((n=e.properties[o])===null||n===void 0?void 0:n.default)!=null?{...t,[o]:(r=e.properties[o])===null||r===void 0?void 0:r.default}:t},{})}function B(e,t,o){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:r,id:i=e.name,group:s=null,ui:c,isHidden:a=!1,uiSchema:u,schema:g,...l}=e,j=g||l||{},E=u||c||{},p=v({description:"External component",...j,type:"object"},o),_=y(E,p.properties||{});return{component:t,name:r,schema:p,uiSchema:_,thumbnail:n,group:s,isHidden:a,id:i,title:p?.title||l?.title||r}}var x,m=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},D=m.BYOCWebComponent||(m.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),b=m.BYOCComponents||(m.BYOCComponents={});function J(e,t,o={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let n=B(t,e,o);b[n.id]=n,K(e)&&h.register("byoc-"+d(t.name),void 0,e),O()}function K(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function I(e,t={}){var o;let n=(o=S(e))===null||o===void 0?void 0:o.schema;return n?w(n,t):t}function N(e){let t=S(e);return Object.keys(t?.schema.properties||{}).filter(o=>{var n,r;return((r=(n=t?.uiSchema)===null||n===void 0?void 0:n[o])===null||r===void 0?void 0:r["ui:widget"])!="hidden"})}function S(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,o]=e.split("?");var n=b[t];if(o){let r=b[e];if(!r&&!n)return null;r&&(n={...n,...r,component:r.component||n?.component}),o.split(/\&/g).forEach(i=>{var s,c,a;let[u,g]=i.split("="),l=((s=n.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};n={...n,schema:{...n.schema,properties:{...n.schema.properties,[u]:{...l,default:C(decodeURIComponent(g),l.type)}}},uiSchema:{...n.uiSchema,[u]:{...n.uiSchema[u],"ui:widget":(a=(c=n.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&a!==void 0?a:"hidden"}}}})}return n}function O(){clearTimeout(x),x=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(b)}),"*"))},30)}O();var h=class extends D{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{J(null,t)})}catch{}}static register(t,o,n=this){o==null&&(o=typeof window<"u"?window:void 0),o&&!o.customElements.get(t)&&o.customElements.define(t,n)}};h.register("byoc-registration");export{h as BYOCRegistration,D as WebComponent,S as getComponent,N as getComponentConfigurablePropertyNames,I as getComponentProperties,P as getSchemaDefaults,w as getSchemaProperties,K as isWebComponent,B as normalizeOptions,L as objectKeysToCamelCase,T as objectKeysToKebabCase,A as parseSchemaProperties,C as parseValue,J as registerComponent,b as registered,O as setRegistrationCallback,f as toCamelCase,d as toKebabCase,v as transformSchema,y as transformUiSchema}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
var x=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[d(n)]:e[n]}),{}),U=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[g(n)]:e[n]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return g(e).replace(t,function(n){return"-"+n.toLowerCase()})}function g(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function j(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||d(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var _=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function w(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function B(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=g(r),s=e?.properties[i],c=s?.type,l=w(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function N(e,t){return{...J(e),...B(e,t)}}function J(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function k(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:u,schema:v,...p}=e,H=v||p||{},T=u||c||{},f=j({description:"External component",...H,type:"object"},n),A=_(T,f.properties||{});return{component:t,name:o,schema:f,uiSchema:A,thumbnail:r,group:s,isHidden:l,id:i,title:f?.title||p?.title||o}}var P,h=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},C=h.BYOCWebComponent||(h.BYOCWebComponent=typeof HTMLElement>"u"?typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{}:HTMLElement),m=h.BYOCComponents||(h.BYOCComponents={});function M(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=k(t,e,n);m[r.id]=r,e&&"prototype"in e&&e.prototype instanceof C&&y.register("byoc-"+d(t.name),void 0,e),W()}function K(e,t={}){var n;let r=(n=b(e))===null||n===void 0?void 0:n.schema;return r?N(r,t):t}function V(e){let t=b(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function b(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=m[t];if(n){let o=m[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[u,v]=i.split("="),p=((s=r.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[u]:{...p,default:w(decodeURIComponent(v),p.type)}}},uiSchema:{...r.uiSchema,[u]:{...r.uiSchema[u],"ui:widget":(l=(c=r.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function W(){clearTimeout(P),P=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(m)}),"*"))},30)}W();var y=class extends C{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{M(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};y.register("byoc-registration");import a from"react";var O=new Map,S=null,E=null;function L(e){var t;let{componentName:n,...r}=e,o=(t=b(n))===null||t===void 0?void 0:t.component;if(!O.get(n)){let s=E(()=>Promise.resolve(S),{ssr:!1,loading:()=>a.createElement(D,{...r,componentName:n})});O.set(n,s)}let i=O.get(n);return a.createElement(i,{...e,fallback:o?a.createElement(o,{...e}):null})}function re(e,t){return E=e,S=t,t}function oe(e){if(Object.keys(e).length!=0)return E?L(e):D(e)}function ie(){return a.createElement(a.Fragment,null,a.createElement("byoc-registration",{components:JSON.stringify(Object.values(m)),suppressHydrationWarning:!0}),a.createElement(S,null))}function D(e){let{componentName:t,fallback:n,...r}=e,o=b(t),i=o?.component;if(!i&&n||!t)return a.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=K(t,r);delete s.suppressHydrationWarning;var c=null;return o&&i&&i.prototype instanceof C?a.createElement("byoc-"+d(o.id),{...x(s),suppressHydrationWarning:!0}):a.createElement(a.Fragment,null,a.createElement("feaas-external",{...x(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.createElement(i,{...s})))}export{y as BYOCRegistration,ie as Bundle,oe as Component,L as NextComponent,D as RegularComponent,C as WebComponent,re as enableNextClientsideComponents,b as getComponent,V as getComponentConfigurablePropertyNames,K as getComponentProperties,J as getSchemaDefaults,N as getSchemaProperties,k as normalizeOptions,U as objectKeysToCamelCase,x as objectKeysToKebabCase,B as parseSchemaProperties,w as parseValue,M as registerComponent,m as registered,W as setRegistrationCallback,g as toCamelCase,d as toKebabCase,j as transformSchema,_ as transformUiSchema}; | ||
var v=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[d(n)]:e[n]}),{}),R=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[g(n)]:e[n]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return g(e).replace(t,function(n){return"-"+n.toLowerCase()})}function g(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function j(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||d(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var _=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function x(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function B(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=g(r),s=e?.properties[i],c=s?.type,l=x(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function N(e,t){return{...J(e),...B(e,t)}}function J(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function k(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:u,schema:y,...p}=e,D=y||p||{},H=u||c||{},f=j({description:"External component",...D,type:"object"},n),T=_(H,f.properties||{});return{component:t,name:o,schema:f,uiSchema:T,thumbnail:r,group:s,isHidden:l,id:i,title:f?.title||p?.title||o}}var P,h=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},w=h.BYOCWebComponent||(h.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),m=h.BYOCComponents||(h.BYOCComponents={});function M(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=k(t,e,n);m[r.id]=r,L(e)&&C.register("byoc-"+d(t.name),void 0,e),A()}function L(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function W(e,t={}){var n;let r=(n=b(e))===null||n===void 0?void 0:n.schema;return r?N(r,t):t}function q(e){let t=b(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function b(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=m[t];if(n){let o=m[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[u,y]=i.split("="),p=((s=r.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[u]:{...p,default:x(decodeURIComponent(y),p.type)}}},uiSchema:{...r.uiSchema,[u]:{...r.uiSchema[u],"ui:widget":(l=(c=r.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function A(){clearTimeout(P),P=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(m)}),"*"))},30)}A();var C=class extends w{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{M(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};C.register("byoc-registration");import a from"react";var O=new Map,S=null,E=null;function U(e){var t;let{componentName:n,...r}=e,o=(t=b(n))===null||t===void 0?void 0:t.component;if(!O.get(n)){let s=E(()=>Promise.resolve(S),{ssr:!1,loading:()=>a.createElement(K,{...r,componentName:n})});O.set(n,s)}let i=O.get(n);return a.createElement(i,{...e,fallback:o?a.createElement(o,{...e}):null})}function oe(e,t){return E=e,S=t,t}function ie(e){if(Object.keys(e).length!=0)return E?U(e):K(e)}function se(){return a.createElement(a.Fragment,null,a.createElement("byoc-registration",{components:JSON.stringify(Object.values(m)),suppressHydrationWarning:!0}),a.createElement(S,null))}function K(e){let{componentName:t,fallback:n,...r}=e,o=b(t),i=o?.component;if(!i&&n||!t)return a.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=W(t,r);delete s.suppressHydrationWarning;var c=null;return o&&i&&i.prototype instanceof w?a.createElement("byoc-"+d(o.id),{...v(s),suppressHydrationWarning:!0}):a.createElement(a.Fragment,null,a.createElement("feaas-external",{...v(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.createElement(i,{...s})))}export{C as BYOCRegistration,se as Bundle,ie as Component,U as NextComponent,K as RegularComponent,w as WebComponent,oe as enableNextClientsideComponents,b as getComponent,q as getComponentConfigurablePropertyNames,W as getComponentProperties,J as getSchemaDefaults,N as getSchemaProperties,L as isWebComponent,k as normalizeOptions,R as objectKeysToCamelCase,v as objectKeysToKebabCase,B as parseSchemaProperties,x as parseValue,M as registerComponent,m as registered,A as setRegistrationCallback,g as toCamelCase,d as toKebabCase,j as transformSchema,_ as transformUiSchema}; | ||
//# sourceMappingURL=react.esm.js.map |
@@ -1,2 +0,2 @@ | ||
var K=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[d(o)]:e[o]}),{}),T=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[f(o)]:e[o]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return f(e).replace(t,function(o){return"-"+o.toLowerCase()})}function f(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,o)=>o===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function C(e,t={}){let o=e.properties||{};return{type:"object",...e,properties:Object.keys(o).reduce((r,n)=>Object.assign(r,{[n]:{...o[n],default:t.hasOwnProperty(n)?t[n]:o[n].default,title:o[n].title||d(n).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var y=(e,t)=>{let o={...e};return Object.keys(t).filter(n=>/(integer|number)/.test(t[n].type)).forEach(n=>{var i;!((i=o[n])===null||i===void 0)&&i["ui:widget"]||(o[n]={...o[n],"ui:widget":"updown"})}),o};function v(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function A(e,t){return Object.keys(t).reduce((o,r)=>{let n=t[r],i=f(r),s=e?.properties[i],c=s?.type,a=v(n,c);return a!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...o,[i]:a}:o},{})}function w(e,t){return{...B(e),...A(e,t)}}function B(e){return Object.keys(e.properties).reduce((t,o)=>{var r,n;return((r=e.properties[o])===null||r===void 0?void 0:r.default)!=null?{...t,[o]:(n=e.properties[o])===null||n===void 0?void 0:n.default}:t},{})}function D(e,t,o){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:n,id:i=e.name,group:s=null,ui:c,isHidden:a=!1,uiSchema:l,schema:g,...u}=e,E=g||u||{},_=l||c||{},p=C({description:"External component",...E,type:"object"},o),P=y(_,p.properties||{});return{component:t,name:n,schema:p,uiSchema:P,thumbnail:r,group:s,isHidden:a,id:i,title:p?.title||u?.title||n}}var x,m=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},S=m.BYOCWebComponent||(m.BYOCWebComponent=typeof HTMLElement>"u"?typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{}:HTMLElement),b=m.BYOCComponents||(m.BYOCComponents={});function J(e,t,o={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=D(t,e,o);b[r.id]=r,e&&"prototype"in e&&e.prototype instanceof S&&h.register("byoc-"+d(t.name),void 0,e),j()}function W(e,t={}){var o;let r=(o=O(e))===null||o===void 0?void 0:o.schema;return r?w(r,t):t}function I(e){let t=O(e);return Object.keys(t?.schema.properties||{}).filter(o=>{var r,n;return((n=(r=t?.uiSchema)===null||r===void 0?void 0:r[o])===null||n===void 0?void 0:n["ui:widget"])!="hidden"})}function O(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,o]=e.split("?");var r=b[t];if(o){let n=b[e];if(!n&&!r)return null;n&&(r={...r,...n,component:n.component||r?.component}),o.split(/\&/g).forEach(i=>{var s,c,a;let[l,g]=i.split("="),u=((s=r.schema.properties)===null||s===void 0?void 0:s[l])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[l]:{...u,default:v(decodeURIComponent(g),u.type)}}},uiSchema:{...r.uiSchema,[l]:{...r.uiSchema[l],"ui:widget":(a=(c=r.uiSchema[l])===null||c===void 0?void 0:c["ui:widget"])!==null&&a!==void 0?a:"hidden"}}}})}return r}function j(){clearTimeout(x),x=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(b)}),"*"))},30)}j();var h=class extends S{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{J(null,t)})}catch{}}static register(t,o,r=this){o==null&&(o=typeof window<"u"?window:void 0),o&&!o.customElements.get(t)&&o.customElements.define(t,r)}};h.register("byoc-registration");export{h as BYOCRegistration,S as WebComponent,O as getComponent,I as getComponentConfigurablePropertyNames,W as getComponentProperties,B as getSchemaDefaults,w as getSchemaProperties,D as normalizeOptions,T as objectKeysToCamelCase,K as objectKeysToKebabCase,A as parseSchemaProperties,v as parseValue,J as registerComponent,b as registered,j as setRegistrationCallback,f as toCamelCase,d as toKebabCase,C as transformSchema,y as transformUiSchema}; | ||
var T=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[d(o)]:e[o]}),{}),L=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[f(o)]:e[o]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return f(e).replace(t,function(o){return"-"+o.toLowerCase()})}function f(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,o)=>o===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function v(e,t={}){let o=e.properties||{};return{type:"object",...e,properties:Object.keys(o).reduce((n,r)=>Object.assign(n,{[r]:{...o[r],default:t.hasOwnProperty(r)?t[r]:o[r].default,title:o[r].title||d(r).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var y=(e,t)=>{let o={...e};return Object.keys(t).filter(r=>/(integer|number)/.test(t[r].type)).forEach(r=>{var i;!((i=o[r])===null||i===void 0)&&i["ui:widget"]||(o[r]={...o[r],"ui:widget":"updown"})}),o};function C(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function A(e,t){return Object.keys(t).reduce((o,n)=>{let r=t[n],i=f(n),s=e?.properties[i],c=s?.type,a=C(r,c);return a!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?{...o,[i]:a}:o},{})}function w(e,t){return{...P(e),...A(e,t)}}function P(e){return Object.keys(e.properties).reduce((t,o)=>{var n,r;return((n=e.properties[o])===null||n===void 0?void 0:n.default)!=null?{...t,[o]:(r=e.properties[o])===null||r===void 0?void 0:r.default}:t},{})}function B(e,t,o){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:r,id:i=e.name,group:s=null,ui:c,isHidden:a=!1,uiSchema:u,schema:g,...l}=e,j=g||l||{},E=u||c||{},p=v({description:"External component",...j,type:"object"},o),_=y(E,p.properties||{});return{component:t,name:r,schema:p,uiSchema:_,thumbnail:n,group:s,isHidden:a,id:i,title:p?.title||l?.title||r}}var x,m=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},D=m.BYOCWebComponent||(m.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),b=m.BYOCComponents||(m.BYOCComponents={});function J(e,t,o={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let n=B(t,e,o);b[n.id]=n,K(e)&&h.register("byoc-"+d(t.name),void 0,e),O()}function K(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function I(e,t={}){var o;let n=(o=S(e))===null||o===void 0?void 0:o.schema;return n?w(n,t):t}function N(e){let t=S(e);return Object.keys(t?.schema.properties||{}).filter(o=>{var n,r;return((r=(n=t?.uiSchema)===null||n===void 0?void 0:n[o])===null||r===void 0?void 0:r["ui:widget"])!="hidden"})}function S(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,o]=e.split("?");var n=b[t];if(o){let r=b[e];if(!r&&!n)return null;r&&(n={...n,...r,component:r.component||n?.component}),o.split(/\&/g).forEach(i=>{var s,c,a;let[u,g]=i.split("="),l=((s=n.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};n={...n,schema:{...n.schema,properties:{...n.schema.properties,[u]:{...l,default:C(decodeURIComponent(g),l.type)}}},uiSchema:{...n.uiSchema,[u]:{...n.uiSchema[u],"ui:widget":(a=(c=n.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&a!==void 0?a:"hidden"}}}})}return n}function O(){clearTimeout(x),x=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(b)}),"*"))},30)}O();var h=class extends D{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{J(null,t)})}catch{}}static register(t,o,n=this){o==null&&(o=typeof window<"u"?window:void 0),o&&!o.customElements.get(t)&&o.customElements.define(t,n)}};h.register("byoc-registration");export{h as BYOCRegistration,D as WebComponent,S as getComponent,N as getComponentConfigurablePropertyNames,I as getComponentProperties,P as getSchemaDefaults,w as getSchemaProperties,K as isWebComponent,B as normalizeOptions,L as objectKeysToCamelCase,T as objectKeysToKebabCase,A as parseSchemaProperties,C as parseValue,J as registerComponent,b as registered,O as setRegistrationCallback,f as toCamelCase,d as toKebabCase,v as transformSchema,y as transformUiSchema}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
var x=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[d(n)]:e[n]}),{}),U=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[g(n)]:e[n]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return g(e).replace(t,function(n){return"-"+n.toLowerCase()})}function g(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function j(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||d(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var _=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function w(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function B(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=g(r),s=e?.properties[i],c=s?.type,l=w(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function N(e,t){return{...J(e),...B(e,t)}}function J(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function k(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:u,schema:v,...p}=e,H=v||p||{},T=u||c||{},f=j({description:"External component",...H,type:"object"},n),A=_(T,f.properties||{});return{component:t,name:o,schema:f,uiSchema:A,thumbnail:r,group:s,isHidden:l,id:i,title:f?.title||p?.title||o}}var P,h=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},C=h.BYOCWebComponent||(h.BYOCWebComponent=typeof HTMLElement>"u"?typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{}:HTMLElement),m=h.BYOCComponents||(h.BYOCComponents={});function M(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=k(t,e,n);m[r.id]=r,e&&"prototype"in e&&e.prototype instanceof C&&y.register("byoc-"+d(t.name),void 0,e),W()}function K(e,t={}){var n;let r=(n=b(e))===null||n===void 0?void 0:n.schema;return r?N(r,t):t}function V(e){let t=b(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function b(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=m[t];if(n){let o=m[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[u,v]=i.split("="),p=((s=r.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[u]:{...p,default:w(decodeURIComponent(v),p.type)}}},uiSchema:{...r.uiSchema,[u]:{...r.uiSchema[u],"ui:widget":(l=(c=r.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function W(){clearTimeout(P),P=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(m)}),"*"))},30)}W();var y=class extends C{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{M(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};y.register("byoc-registration");import a from"react";var O=new Map,S=null,E=null;function L(e){var t;let{componentName:n,...r}=e,o=(t=b(n))===null||t===void 0?void 0:t.component;if(!O.get(n)){let s=E(()=>Promise.resolve(S),{ssr:!1,loading:()=>a.createElement(D,{...r,componentName:n})});O.set(n,s)}let i=O.get(n);return a.createElement(i,{...e,fallback:o?a.createElement(o,{...e}):null})}function re(e,t){return E=e,S=t,t}function oe(e){if(Object.keys(e).length!=0)return E?L(e):D(e)}function ie(){return a.createElement(a.Fragment,null,a.createElement("byoc-registration",{components:JSON.stringify(Object.values(m)),suppressHydrationWarning:!0}),a.createElement(S,null))}function D(e){let{componentName:t,fallback:n,...r}=e,o=b(t),i=o?.component;if(!i&&n||!t)return a.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=K(t,r);delete s.suppressHydrationWarning;var c=null;return o&&i&&i.prototype instanceof C?a.createElement("byoc-"+d(o.id),{...x(s),suppressHydrationWarning:!0}):a.createElement(a.Fragment,null,a.createElement("feaas-external",{...x(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.createElement(i,{...s})))}export{y as BYOCRegistration,ie as Bundle,oe as Component,L as NextComponent,D as RegularComponent,C as WebComponent,re as enableNextClientsideComponents,b as getComponent,V as getComponentConfigurablePropertyNames,K as getComponentProperties,J as getSchemaDefaults,N as getSchemaProperties,k as normalizeOptions,U as objectKeysToCamelCase,x as objectKeysToKebabCase,B as parseSchemaProperties,w as parseValue,M as registerComponent,m as registered,W as setRegistrationCallback,g as toCamelCase,d as toKebabCase,j as transformSchema,_ as transformUiSchema}; | ||
var v=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[d(n)]:e[n]}),{}),R=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[g(n)]:e[n]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return g(e).replace(t,function(n){return"-"+n.toLowerCase()})}function g(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function j(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||d(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var _=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function x(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function B(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=g(r),s=e?.properties[i],c=s?.type,l=x(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function N(e,t){return{...J(e),...B(e,t)}}function J(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function k(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:u,schema:y,...p}=e,D=y||p||{},H=u||c||{},f=j({description:"External component",...D,type:"object"},n),T=_(H,f.properties||{});return{component:t,name:o,schema:f,uiSchema:T,thumbnail:r,group:s,isHidden:l,id:i,title:f?.title||p?.title||o}}var P,h=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},w=h.BYOCWebComponent||(h.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),m=h.BYOCComponents||(h.BYOCComponents={});function M(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=k(t,e,n);m[r.id]=r,L(e)&&C.register("byoc-"+d(t.name),void 0,e),A()}function L(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function W(e,t={}){var n;let r=(n=b(e))===null||n===void 0?void 0:n.schema;return r?N(r,t):t}function q(e){let t=b(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function b(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=m[t];if(n){let o=m[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[u,y]=i.split("="),p=((s=r.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[u]:{...p,default:x(decodeURIComponent(y),p.type)}}},uiSchema:{...r.uiSchema,[u]:{...r.uiSchema[u],"ui:widget":(l=(c=r.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function A(){clearTimeout(P),P=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(m)}),"*"))},30)}A();var C=class extends w{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{M(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};C.register("byoc-registration");import a from"react";var O=new Map,S=null,E=null;function U(e){var t;let{componentName:n,...r}=e,o=(t=b(n))===null||t===void 0?void 0:t.component;if(!O.get(n)){let s=E(()=>Promise.resolve(S),{ssr:!1,loading:()=>a.createElement(K,{...r,componentName:n})});O.set(n,s)}let i=O.get(n);return a.createElement(i,{...e,fallback:o?a.createElement(o,{...e}):null})}function oe(e,t){return E=e,S=t,t}function ie(e){if(Object.keys(e).length!=0)return E?U(e):K(e)}function se(){return a.createElement(a.Fragment,null,a.createElement("byoc-registration",{components:JSON.stringify(Object.values(m)),suppressHydrationWarning:!0}),a.createElement(S,null))}function K(e){let{componentName:t,fallback:n,...r}=e,o=b(t),i=o?.component;if(!i&&n||!t)return a.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=W(t,r);delete s.suppressHydrationWarning;var c=null;return o&&i&&i.prototype instanceof w?a.createElement("byoc-"+d(o.id),{...v(s),suppressHydrationWarning:!0}):a.createElement(a.Fragment,null,a.createElement("feaas-external",{...v(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.createElement(i,{...s})))}export{C as BYOCRegistration,se as Bundle,ie as Component,U as NextComponent,K as RegularComponent,w as WebComponent,oe as enableNextClientsideComponents,b as getComponent,q as getComponentConfigurablePropertyNames,W as getComponentProperties,J as getSchemaDefaults,N as getSchemaProperties,L as isWebComponent,k as normalizeOptions,R as objectKeysToCamelCase,v as objectKeysToKebabCase,B as parseSchemaProperties,x as parseValue,M as registerComponent,m as registered,A as setRegistrationCallback,g as toCamelCase,d as toKebabCase,j as transformSchema,_ as transformUiSchema}; | ||
//# sourceMappingURL=react.esm.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Bring-Your-Own-Components runtime to register and retrieve react components", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "test": "npx vitest", |
@@ -1,2 +0,2 @@ | ||
"use strict";var F=Object.create;var C=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var q=(e,t)=>{for(var n in t)C(e,n,{get:t[n],enumerable:!0})},H=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Y(t))!V.call(e,o)&&o!==n&&C(e,o,{get:()=>t[o],enumerable:!(r=I(t,o))||r.enumerable});return e};var G=(e,t,n)=>(n=e!=null?F(z(e)):{},H(t||!e||!e.__esModule?C(n,"default",{value:e,enumerable:!0}):n,e)),X=e=>H(C({},"__esModule",{value:!0}),e);var ne={};q(ne,{BYOCRegistration:()=>h,Bundle:()=>te,Component:()=>ee,NextComponent:()=>M,RegularComponent:()=>D,WebComponent:()=>y,enableNextClientsideComponents:()=>Q,getComponent:()=>f,getComponentConfigurablePropertyNames:()=>$,getComponentProperties:()=>_,getSchemaDefaults:()=>A,getSchemaProperties:()=>j,normalizeOptions:()=>J,objectKeysToCamelCase:()=>Z,objectKeysToKebabCase:()=>v,parseSchemaProperties:()=>T,parseValue:()=>x,registerComponent:()=>k,registered:()=>m,setRegistrationCallback:()=>N,toCamelCase:()=>g,toKebabCase:()=>u,transformSchema:()=>S,transformUiSchema:()=>E});module.exports=X(ne);var v=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[u(n)]:e[n]}),{}),Z=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[g(n)]:e[n]}),{});function u(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return g(e).replace(t,function(n){return"-"+n.toLowerCase()})}function g(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function S(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||u(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var E=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function x(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function T(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=g(r),s=e?.properties[i],c=s?.type,l=x(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function j(e,t){return{...A(e),...T(e,t)}}function A(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function J(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:p,schema:O,...d}=e,L=O||d||{},U=p||c||{},b=S({description:"External component",...L,type:"object"},n),R=E(U,b.properties||{});return{component:t,name:o,schema:b,uiSchema:R,thumbnail:r,group:s,isHidden:l,id:i,title:b?.title||d?.title||o}}var B,w=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},y=w.BYOCWebComponent||(w.BYOCWebComponent=typeof HTMLElement>"u"?typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{}:HTMLElement),m=w.BYOCComponents||(w.BYOCComponents={});function k(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=J(t,e,n);m[r.id]=r,e&&"prototype"in e&&e.prototype instanceof y&&h.register("byoc-"+u(t.name),void 0,e),N()}function _(e,t={}){var n;let r=(n=f(e))===null||n===void 0?void 0:n.schema;return r?j(r,t):t}function $(e){let t=f(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function f(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=m[t];if(n){let o=m[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[p,O]=i.split("="),d=((s=r.schema.properties)===null||s===void 0?void 0:s[p])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[p]:{...d,default:x(decodeURIComponent(O),d.type)}}},uiSchema:{...r.uiSchema,[p]:{...r.uiSchema[p],"ui:widget":(l=(c=r.uiSchema[p])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function N(){clearTimeout(B),B=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(m)}),"*"))},30)}N();var h=class extends y{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{k(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};h.register("byoc-registration");var a=G(require("react"),1);var P=new Map,K=null,W=null;function M(e){var t;let{componentName:n,...r}=e,o=(t=f(n))===null||t===void 0?void 0:t.component;if(!P.get(n)){let s=W(()=>Promise.resolve(K),{ssr:!1,loading:()=>a.default.createElement(D,{...r,componentName:n})});P.set(n,s)}let i=P.get(n);return a.default.createElement(i,{...e,fallback:o?a.default.createElement(o,{...e}):null})}function Q(e,t){return W=e,K=t,t}function ee(e){if(Object.keys(e).length!=0)return W?M(e):D(e)}function te(){return a.default.createElement(a.default.Fragment,null,a.default.createElement("byoc-registration",{components:JSON.stringify(Object.values(m)),suppressHydrationWarning:!0}),a.default.createElement(K,null))}function D(e){let{componentName:t,fallback:n,...r}=e,o=f(t),i=o?.component;if(!i&&n||!t)return a.default.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=_(t,r);delete s.suppressHydrationWarning;var c=null;return o&&i&&i.prototype instanceof y?a.default.createElement("byoc-"+u(o.id),{...v(s),suppressHydrationWarning:!0}):a.default.createElement(a.default.Fragment,null,a.default.createElement("feaas-external",{...v(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.default.createElement(i,{...s})))} | ||
"use strict";var I=Object.create;var C=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var G=(e,t)=>{for(var n in t)C(e,n,{get:t[n],enumerable:!0})},D=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of z(t))!q.call(e,o)&&o!==n&&C(e,o,{get:()=>t[o],enumerable:!(r=Y(t,o))||r.enumerable});return e};var X=(e,t,n)=>(n=e!=null?I(V(e)):{},D(t||!e||!e.__esModule?C(n,"default",{value:e,enumerable:!0}):n,e)),Z=e=>D(C({},"__esModule",{value:!0}),e);var re={};G(re,{BYOCRegistration:()=>h,Bundle:()=>ne,Component:()=>te,NextComponent:()=>L,RegularComponent:()=>K,WebComponent:()=>w,enableNextClientsideComponents:()=>ee,getComponent:()=>f,getComponentConfigurablePropertyNames:()=>Q,getComponentProperties:()=>_,getSchemaDefaults:()=>T,getSchemaProperties:()=>j,isWebComponent:()=>M,normalizeOptions:()=>J,objectKeysToCamelCase:()=>$,objectKeysToKebabCase:()=>y,parseSchemaProperties:()=>H,parseValue:()=>v,registerComponent:()=>k,registered:()=>m,setRegistrationCallback:()=>N,toCamelCase:()=>g,toKebabCase:()=>u,transformSchema:()=>S,transformUiSchema:()=>E});module.exports=Z(re);var y=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[u(n)]:e[n]}),{}),$=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[g(n)]:e[n]}),{});function u(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return g(e).replace(t,function(n){return"-"+n.toLowerCase()})}function g(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function S(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||u(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var E=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function v(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function H(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=g(r),s=e?.properties[i],c=s?.type,l=v(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function j(e,t){return{...T(e),...H(e,t)}}function T(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function J(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:p,schema:O,...d}=e,U=O||d||{},R=p||c||{},b=S({description:"External component",...U,type:"object"},n),F=E(R,b.properties||{});return{component:t,name:o,schema:b,uiSchema:F,thumbnail:r,group:s,isHidden:l,id:i,title:b?.title||d?.title||o}}var B,x=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},w=x.BYOCWebComponent||(x.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),m=x.BYOCComponents||(x.BYOCComponents={});function k(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=J(t,e,n);m[r.id]=r,M(e)&&h.register("byoc-"+u(t.name),void 0,e),N()}function M(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function _(e,t={}){var n;let r=(n=f(e))===null||n===void 0?void 0:n.schema;return r?j(r,t):t}function Q(e){let t=f(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function f(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=m[t];if(n){let o=m[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[p,O]=i.split("="),d=((s=r.schema.properties)===null||s===void 0?void 0:s[p])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[p]:{...d,default:v(decodeURIComponent(O),d.type)}}},uiSchema:{...r.uiSchema,[p]:{...r.uiSchema[p],"ui:widget":(l=(c=r.uiSchema[p])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function N(){clearTimeout(B),B=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(m)}),"*"))},30)}N();var h=class extends w{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{k(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};h.register("byoc-registration");var a=X(require("react"),1);var P=new Map,W=null,A=null;function L(e){var t;let{componentName:n,...r}=e,o=(t=f(n))===null||t===void 0?void 0:t.component;if(!P.get(n)){let s=A(()=>Promise.resolve(W),{ssr:!1,loading:()=>a.default.createElement(K,{...r,componentName:n})});P.set(n,s)}let i=P.get(n);return a.default.createElement(i,{...e,fallback:o?a.default.createElement(o,{...e}):null})}function ee(e,t){return A=e,W=t,t}function te(e){if(Object.keys(e).length!=0)return A?L(e):K(e)}function ne(){return a.default.createElement(a.default.Fragment,null,a.default.createElement("byoc-registration",{components:JSON.stringify(Object.values(m)),suppressHydrationWarning:!0}),a.default.createElement(W,null))}function K(e){let{componentName:t,fallback:n,...r}=e,o=f(t),i=o?.component;if(!i&&n||!t)return a.default.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=_(t,r);delete s.suppressHydrationWarning;var c=null;return o&&i&&i.prototype instanceof w?a.default.createElement("byoc-"+u(o.id),{...y(s),suppressHydrationWarning:!0}):a.default.createElement(a.default.Fragment,null,a.default.createElement("feaas-external",{...y(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.default.createElement(i,{...s})))} | ||
//# sourceMappingURL=react.js.map |
@@ -114,3 +114,2 @@ import { | ||
export function normalizeOptions<P>( | ||
@@ -167,11 +166,12 @@ options: ExternalComponentOptions<P>, | ||
// Shim in case it's required in node.js environment | ||
export const WebComponent = globalScope.BYOCWebComponent ||= | ||
(typeof HTMLElement == 'undefined' | ||
? // @ts-ignore | ||
typeof windowJSDOM != 'undefined' | ||
? // @ts-ignore | ||
(windowJSDOM.HTMLElement as typeof HTMLElement) | ||
: (class {} as unknown as typeof HTMLElement) | ||
: HTMLElement) as any as typeof HTMLElement | ||
// Shim in case it's required in node.js environment | ||
export const WebComponent = (globalScope.BYOCWebComponent ||= (typeof HTMLElement != 'undefined' | ||
? HTMLElement | ||
: // @ts-ignore | ||
typeof windowJSDOM != 'undefined' | ||
? // @ts-ignore | ||
(windowJSDOM.HTMLElement as typeof HTMLElement) | ||
: (class { | ||
setAttribute() {} | ||
} as unknown as typeof HTMLElement)) as any as typeof HTMLElement) | ||
@@ -255,4 +255,4 @@ // Store registered components in a global variable BYOCComponents | ||
registered[normalizedOptions.id] = normalizedOptions | ||
if (component && 'prototype' in component && component.prototype instanceof WebComponent) { | ||
BYOCRegistration.register('byoc-' + toKebabCase(options.name), undefined, component as WebComponent) | ||
if (isWebComponent(component)) { | ||
BYOCRegistration.register('byoc-' + toKebabCase(options.name), undefined, component) | ||
} | ||
@@ -262,2 +262,6 @@ setRegistrationCallback() | ||
export function isWebComponent(object: any): object is WebComponent { | ||
return object && 'prototype' in object && 'setAttribute' in object.prototype | ||
} | ||
export type RegisteredComponents = { | ||
@@ -355,3 +359,2 @@ [id: string]: ExternalComponent | ||
// Register schemas passed as <byoc-registration components=... /> | ||
@@ -358,0 +361,0 @@ export class BYOCRegistration extends WebComponent { |
@@ -164,2 +164,3 @@ /// <reference types="@types/react" /> | ||
export declare function registerComponent<T>(component: ExternalComponentHandler<T>, options: ExternalComponentOptions<T>, defaults?: any): void; | ||
export declare function isWebComponent(object: any): object is WebComponent; | ||
export type RegisteredComponents = { | ||
@@ -166,0 +167,0 @@ [id: string]: ExternalComponent; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
526638
1417