@aurigma/ui-framework
Version:
A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.
1 lines • 5.24 kB
JavaScript
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[32],{843:function(t,n){t.exports='<style>\n :host {\n width: 100%;\n height: 100%;\n display: block;\n }\n\n h1 {\n @apply --au-h1-font\n }\n\n h2 {\n @apply --au-h2-font\n }\n\n h3 {\n @apply --au-h3-font\n }\n\n h4 {\n @apply --au-h4-font\n }\n\n .subtitle1 {\n @apply --au-subtitle1-font\n }\n\n .subtitle2 {\n @apply --au-subtitle2-font\n }\n\n div,\n p,\n span {\n @apply --au-body2-font\n }\n\n .body1 {\n @apply --au-body1-font\n }\n\n .button {\n @apply --au-button-font\n }\n\n .caption {\n @apply --au-caption-font\n }\n\n .overline {\n @apply --au-overline-font\n }\n</style>\n<div class="html" id="container"></div>'},844:function(t,n){var m={transform:function(t,n,e){var i={events:[],html:""},e=m._extend({events:!1},e);return void 0===n&&void 0===t||(t="string"==typeof t?JSON.parse(t):t,i=m._transform(t,n,e)),e.events?i:i.html},_extend:function(t,n){var e,i={};for(e in t)i[e]=t[e];for(e in n)i[e]=n[e];return i},_append:function(t,n){var e={html:"",event:[]};return void 0!==t&&void 0!==n&&(e.html=t.html+n.html,e.events=t.events.concat(n.events)),e},_isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},_transform:function(t,n,e){var i={events:[],html:""};if(m._isArray(t))for(var a=t.length,r=0;r<a;++r)i=m._append(i,m._apply(t[r],n,r,e));else"object"==typeof t&&(i=m._append(i,m._apply(t,n,void 0,e)));return i},_apply:function(t,n,e,i){var a={events:[],html:""};if(m._isArray(n))for(var r=n.length,o=0;o<r;++o)a=m._append(a,m._apply(t,n[o],e,i));else if("object"==typeof n){var s="<>";if(void 0!==n[s=void 0===n[s]?"tag":s]){var l,c,s=m._getValue(t,n,s,e),p=(a.html+="<"+s,{events:[],html:""});for(c in n)switch(c){case"tag":case"<>":break;case"text":var u=n[c];if(!m._isArray(u))if("function"==typeof u){var d=u.call(t,t,e);if(!m._isArray(d))switch(typeof d){case"function":case"undefined":case"object":break;default:p.html+=m.toText(d)}}else l=m.toText(m._getValue(t,n,c,e));break;case"children":case"html":u=n[c];if(m._isArray(u))p=m._append(p,m._apply(t,u,e,i));else if("function"==typeof u){d=u.call(t,t,e);if(!m._isArray(d))switch(typeof d){case"object":void 0!==d.html&&void 0!==d.events&&(p=m._append(p,d));break;case"function":case"undefined":break;default:p.html+=d}}else l=m._getValue(t,n,c,e);break;default:var h,f,v=!1;2<c.length&&"on"==c.substring(0,2).toLowerCase()&&(i.events&&(h={action:n[c],obj:t,data:i.eventData,index:e},f=m._guid(),a.events[a.events.length]={id:f,type:c.substring(2),data:h},a.html+=" json2html-event-id-"+c.substring(2)+"='"+f+"'"),v=!0),v||void 0!==(h=m._getValue(t,n,c,e))&&(f="string"==typeof h?'"'+h.replace(/"/g,""")+'"':h,a.html+=" "+c+"="+f)}a.html+=">",l&&(a.html+=l),(a=m._append(a,p)).html+="</"+s+">"}}return a},_guid:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return t()+t()+"-"+t()+t()+"-"+t()+t()},_getValue:function(o,t,n,e){t=t[n],n=typeof t;return"function"==n?t.call(o,o,e):"string"==n?new m._tokenizer([/\$\{([^\}\{]+)\}/],function(t,n,e){return n?t.replace(e,function(t,n){for(var e=n.split("."),i=o,n="",a=e.length,r=0;r<a&&!(0<e[r].length&&null==(i=i[e[r]]));++r);return n=null!=i?i:n}):t}).parse(t).join(""):t},toText:function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\"/g,""").replace(/\'/g,"'").replace(/\//g,"/")},_tokenizer:function(t,n){if(!(this instanceof m._tokenizer))return new m._tokenizer(t,n);this.tokenizers=t.splice?t:[t],n&&(this.doBuild=n),this.parse=function(t){for(this.src=t,this.ended=!1,this.tokens=[];this.next(),!this.ended;);return this.tokens},this.build=function(t,n){t&&this.tokens.push(this.doBuild?this.doBuild(t,n,this.tkn):t)},this.next=function(){var t,n=this;n.findMin(),t=n.src.slice(0,n.min),n.build(t,!1),n.src=n.src.slice(n.min).replace(n.tkn,function(t){return n.build(t,!0),""}),n.src||(n.ended=!0)},this.findMin=function(){var t,n,e=this,i=0;for(e.min=-1,e.tkn="";void 0!==(t=e.tokenizers[i++]);)-1!=(n=e.src[t.test?"search":"indexOf"](t))&&(-1==e.min||n<e.min)&&(e.tkn=t,e.min=n);-1==e.min&&(e.min=e.src.length)}}};t.exports=m},901:function(t,n,e){e.r(n),e.d(n,"AuWidgetHtml",function(){return o}),e.d(n,"widget",function(){return o});var n=e(0),i=e(843),a=e(160),r=e(844),e=e(2);let o=class extends a.c{constructor(){super(...arguments),this._isRestoring=!1}updateParams(t){this.data=t.data||{},this.template=t.template,this.$.container.innerHTML=r.transform(this.data,this.template)}async exportWidgetData(t){return this.$&&this.$.container?{html:this.$.container.innerHTML}:null}async restoreWidgetFromData(t,n){t&&t.html!==this.$.container.innerHTML&&(this.$.container.innerHTML=t.html)}};Object(n.a)([Object(e.c)(),Object(n.b)("design:type",Object)],o.prototype,"params",void 0),Object(n.a)([Object(e.c)(),Object(n.b)("design:type",Object)],o.prototype,"data",void 0),Object(n.a)([Object(e.c)(),Object(n.b)("design:type",Object)],o.prototype,"template",void 0),o=Object(n.a)([Object(e.a)("au-widget-html",i)],o)}}]);