@merkur/integration-custom-element 0.37.0 → 0.37.11

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/lib/index.cjs CHANGED
@@ -59,7 +59,7 @@ function registerCustomElement(options) {
59
59
  super._init();
60
60
  const customWidgetDefinition = deepMerge({}, widgetDefinition);
61
61
 
62
- (async () => {
62
+ this._widgetPromise = (async () => {
63
63
  this._shadow = this.attachShadow({ mode: 'open' });
64
64
 
65
65
  try {
@@ -132,7 +132,9 @@ function registerCustomElement(options) {
132
132
  }
133
133
  }
134
134
 
135
- connectedCallback() {
135
+ async connectedCallback() {
136
+ await this._widgetPromise;
137
+
136
138
  this._widget?.connectedCallback?.({
137
139
  shadow: this._shadow,
138
140
  customElement: this,
@@ -144,7 +146,9 @@ function registerCustomElement(options) {
144
146
  });
145
147
  }
146
148
 
147
- disconnectedCallback() {
149
+ async disconnectedCallback() {
150
+ await this._widgetPromise;
151
+
148
152
  this._widget?.disconnectedCallback?.({
149
153
  shadow: this._shadow,
150
154
  customElement: this,
@@ -156,7 +160,9 @@ function registerCustomElement(options) {
156
160
  });
157
161
  }
158
162
 
159
- adoptedCallback() {
163
+ async adoptedCallback() {
164
+ await this._widgetPromise;
165
+
160
166
  this._widget?.adoptedCallback?.({
161
167
  shadow: this._shadow,
162
168
  customElement: this,
@@ -168,7 +174,9 @@ function registerCustomElement(options) {
168
174
  });
169
175
  }
170
176
 
171
- attributeChangedCallback(name, oldValue, newValue) {
177
+ async attributeChangedCallback(name, oldValue, newValue) {
178
+ await this._widgetPromise;
179
+
172
180
  this._widget?.attributeChangedCallback?.(
173
181
  this._widget,
174
182
  name,
package/lib/index.es9.cjs CHANGED
@@ -52,7 +52,7 @@ function registerCustomElement(options) {
52
52
  try {
53
53
  super._init();
54
54
  const customWidgetDefinition = deepMerge({}, widgetDefinition);
55
- (async () => {
55
+ this._widgetPromise = (async () => {
56
56
  this._shadow = this.attachShadow({
57
57
  mode: 'open'
58
58
  });
@@ -111,8 +111,9 @@ function registerCustomElement(options) {
111
111
  console.error(error);
112
112
  }
113
113
  }
114
- connectedCallback() {
114
+ async connectedCallback() {
115
115
  var _this$_widget, _this$_widget$connect, _callbacks$connectedC;
116
+ await this._widgetPromise;
116
117
  (_this$_widget = this._widget) === null || _this$_widget === void 0 || (_this$_widget$connect = _this$_widget.connectedCallback) === null || _this$_widget$connect === void 0 || _this$_widget$connect.call(_this$_widget, {
117
118
  shadow: this._shadow,
118
119
  customElement: this
@@ -122,8 +123,9 @@ function registerCustomElement(options) {
122
123
  customElement: this
123
124
  });
124
125
  }
125
- disconnectedCallback() {
126
+ async disconnectedCallback() {
126
127
  var _this$_widget2, _this$_widget2$discon, _callbacks$disconnect;
128
+ await this._widgetPromise;
127
129
  (_this$_widget2 = this._widget) === null || _this$_widget2 === void 0 || (_this$_widget2$discon = _this$_widget2.disconnectedCallback) === null || _this$_widget2$discon === void 0 || _this$_widget2$discon.call(_this$_widget2, {
128
130
  shadow: this._shadow,
129
131
  customElement: this
@@ -133,8 +135,9 @@ function registerCustomElement(options) {
133
135
  customElement: this
134
136
  });
135
137
  }
136
- adoptedCallback() {
138
+ async adoptedCallback() {
137
139
  var _this$_widget3, _this$_widget3$adopte, _callbacks$adoptedCal;
140
+ await this._widgetPromise;
138
141
  (_this$_widget3 = this._widget) === null || _this$_widget3 === void 0 || (_this$_widget3$adopte = _this$_widget3.adoptedCallback) === null || _this$_widget3$adopte === void 0 || _this$_widget3$adopte.call(_this$_widget3, {
139
142
  shadow: this._shadow,
140
143
  customElement: this
@@ -144,8 +147,9 @@ function registerCustomElement(options) {
144
147
  customElement: this
145
148
  });
146
149
  }
147
- attributeChangedCallback(name, oldValue, newValue) {
150
+ async attributeChangedCallback(name, oldValue, newValue) {
148
151
  var _this$_widget4, _this$_widget4$attrib, _callbacks$attributeC;
152
+ await this._widgetPromise;
149
153
  (_this$_widget4 = this._widget) === null || _this$_widget4 === void 0 || (_this$_widget4$attrib = _this$_widget4.attributeChangedCallback) === null || _this$_widget4$attrib === void 0 || _this$_widget4$attrib.call(_this$_widget4, this._widget, name, oldValue, newValue, {
150
154
  shadow: this._shadow,
151
155
  customElement: this
package/lib/index.es9.mjs CHANGED
@@ -50,7 +50,7 @@ function registerCustomElement(options) {
50
50
  try {
51
51
  super._init();
52
52
  const customWidgetDefinition = deepMerge({}, widgetDefinition);
53
- (async () => {
53
+ this._widgetPromise = (async () => {
54
54
  this._shadow = this.attachShadow({
55
55
  mode: 'open'
56
56
  });
@@ -109,8 +109,9 @@ function registerCustomElement(options) {
109
109
  console.error(error);
110
110
  }
111
111
  }
112
- connectedCallback() {
112
+ async connectedCallback() {
113
113
  var _this$_widget, _this$_widget$connect, _callbacks$connectedC;
114
+ await this._widgetPromise;
114
115
  (_this$_widget = this._widget) === null || _this$_widget === void 0 || (_this$_widget$connect = _this$_widget.connectedCallback) === null || _this$_widget$connect === void 0 || _this$_widget$connect.call(_this$_widget, {
115
116
  shadow: this._shadow,
116
117
  customElement: this
@@ -120,8 +121,9 @@ function registerCustomElement(options) {
120
121
  customElement: this
121
122
  });
122
123
  }
123
- disconnectedCallback() {
124
+ async disconnectedCallback() {
124
125
  var _this$_widget2, _this$_widget2$discon, _callbacks$disconnect;
126
+ await this._widgetPromise;
125
127
  (_this$_widget2 = this._widget) === null || _this$_widget2 === void 0 || (_this$_widget2$discon = _this$_widget2.disconnectedCallback) === null || _this$_widget2$discon === void 0 || _this$_widget2$discon.call(_this$_widget2, {
126
128
  shadow: this._shadow,
127
129
  customElement: this
@@ -131,8 +133,9 @@ function registerCustomElement(options) {
131
133
  customElement: this
132
134
  });
133
135
  }
134
- adoptedCallback() {
136
+ async adoptedCallback() {
135
137
  var _this$_widget3, _this$_widget3$adopte, _callbacks$adoptedCal;
138
+ await this._widgetPromise;
136
139
  (_this$_widget3 = this._widget) === null || _this$_widget3 === void 0 || (_this$_widget3$adopte = _this$_widget3.adoptedCallback) === null || _this$_widget3$adopte === void 0 || _this$_widget3$adopte.call(_this$_widget3, {
137
140
  shadow: this._shadow,
138
141
  customElement: this
@@ -142,8 +145,9 @@ function registerCustomElement(options) {
142
145
  customElement: this
143
146
  });
144
147
  }
145
- attributeChangedCallback(name, oldValue, newValue) {
148
+ async attributeChangedCallback(name, oldValue, newValue) {
146
149
  var _this$_widget4, _this$_widget4$attrib, _callbacks$attributeC;
150
+ await this._widgetPromise;
147
151
  (_this$_widget4 = this._widget) === null || _this$_widget4 === void 0 || (_this$_widget4$attrib = _this$_widget4.attributeChangedCallback) === null || _this$_widget4$attrib === void 0 || _this$_widget4$attrib.call(_this$_widget4, this._widget, name, oldValue, newValue, {
148
152
  shadow: this._shadow,
149
153
  customElement: this
package/lib/index.js CHANGED
@@ -59,7 +59,7 @@ function registerCustomElement(options) {
59
59
  super._init();
60
60
  const customWidgetDefinition = deepMerge({}, widgetDefinition);
61
61
 
62
- (async () => {
62
+ this._widgetPromise = (async () => {
63
63
  this._shadow = this.attachShadow({ mode: 'open' });
64
64
 
65
65
  try {
@@ -132,7 +132,9 @@ function registerCustomElement(options) {
132
132
  }
133
133
  }
134
134
 
135
- connectedCallback() {
135
+ async connectedCallback() {
136
+ await this._widgetPromise;
137
+
136
138
  this._widget?.connectedCallback?.({
137
139
  shadow: this._shadow,
138
140
  customElement: this,
@@ -144,7 +146,9 @@ function registerCustomElement(options) {
144
146
  });
145
147
  }
146
148
 
147
- disconnectedCallback() {
149
+ async disconnectedCallback() {
150
+ await this._widgetPromise;
151
+
148
152
  this._widget?.disconnectedCallback?.({
149
153
  shadow: this._shadow,
150
154
  customElement: this,
@@ -156,7 +160,9 @@ function registerCustomElement(options) {
156
160
  });
157
161
  }
158
162
 
159
- adoptedCallback() {
163
+ async adoptedCallback() {
164
+ await this._widgetPromise;
165
+
160
166
  this._widget?.adoptedCallback?.({
161
167
  shadow: this._shadow,
162
168
  customElement: this,
@@ -168,7 +174,9 @@ function registerCustomElement(options) {
168
174
  });
169
175
  }
170
176
 
171
- attributeChangedCallback(name, oldValue, newValue) {
177
+ async attributeChangedCallback(name, oldValue, newValue) {
178
+ await this._widgetPromise;
179
+
172
180
  this._widget?.attributeChangedCallback?.(
173
181
  this._widget,
174
182
  name,
package/lib/index.mjs CHANGED
@@ -57,7 +57,7 @@ function registerCustomElement(options) {
57
57
  super._init();
58
58
  const customWidgetDefinition = deepMerge({}, widgetDefinition);
59
59
 
60
- (async () => {
60
+ this._widgetPromise = (async () => {
61
61
  this._shadow = this.attachShadow({ mode: 'open' });
62
62
 
63
63
  try {
@@ -130,7 +130,9 @@ function registerCustomElement(options) {
130
130
  }
131
131
  }
132
132
 
133
- connectedCallback() {
133
+ async connectedCallback() {
134
+ await this._widgetPromise;
135
+
134
136
  this._widget?.connectedCallback?.({
135
137
  shadow: this._shadow,
136
138
  customElement: this,
@@ -142,7 +144,9 @@ function registerCustomElement(options) {
142
144
  });
143
145
  }
144
146
 
145
- disconnectedCallback() {
147
+ async disconnectedCallback() {
148
+ await this._widgetPromise;
149
+
146
150
  this._widget?.disconnectedCallback?.({
147
151
  shadow: this._shadow,
148
152
  customElement: this,
@@ -154,7 +158,9 @@ function registerCustomElement(options) {
154
158
  });
155
159
  }
156
160
 
157
- adoptedCallback() {
161
+ async adoptedCallback() {
162
+ await this._widgetPromise;
163
+
158
164
  this._widget?.adoptedCallback?.({
159
165
  shadow: this._shadow,
160
166
  customElement: this,
@@ -166,7 +172,9 @@ function registerCustomElement(options) {
166
172
  });
167
173
  }
168
174
 
169
- attributeChangedCallback(name, oldValue, newValue) {
175
+ async attributeChangedCallback(name, oldValue, newValue) {
176
+ await this._widgetPromise;
177
+
170
178
  this._widget?.attributeChangedCallback?.(
171
179
  this._widget,
172
180
  name,
package/lib/index.umd.js CHANGED
@@ -1 +1 @@
1
- function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}!function(e,t){if("function"==typeof define&&define.amd)define("@merkur/integration-custom-element",["exports","@merkur/core","@merkur/integration"],t);else if("undefined"!=typeof exports)t(exports,require("@merkur/core"),require("@merkur/integration"));else{var n={exports:{}};t(n.exports,e.Merkur.Core,e.Merkur.Integration),e.merkurIntegrationCustomElement=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(t,n,r){function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(e,t,n){return(t=d(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(){return l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=m(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},l.apply(null,arguments)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,d(r.key),r)}}function s(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,n||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function f(e,t,n){return t=m(t),p(e,v()?Reflect.construct(t,n||[],m(e).constructor):t.apply(e,n))}function p(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}function h(e){var t="function"==typeof Map?new Map:void 0;return h=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(v())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&b(o,n.prototype),o}(e,arguments,m(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),b(n,e)},h(e)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(v=function(){return!!e})()}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function w(e,t,n,r,o,i,u){try{var l=e[i](u),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function g(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function u(e){w(i,r,o,u,l,"next",e)}function l(e){w(i,r,o,u,l,"throw",e)}u(void 0)}))}}function _(){return(_=g((function*(e,t){var o=i(i({},e),{},{createWidget:e.createWidget});return(0,n.getMerkur)().isRegistered(o.name+o.version)||(0,n.getMerkur)().register(o),yield O(),yield(0,r.loadAssets)(o.assets,t),yield(0,n.getMerkur)().create(o)}))).apply(this,arguments)}function O(){return new Promise((function(e){"undefined"!=typeof document?"loading"!==document.readyState?e():window.addEventListener("DOMContentLoaded",(function(){e()})):e()}))}Object.defineProperty(t,"__esModule",{value:!0}),t.deepMerge=j,t.registerCustomElement=function(e){var t=j({},e),n=t.widgetDefinition,o=t.callbacks,i=t.observedAttributes,u=function(e){function t(){var e;c(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var i=e=f(this,t,[].concat(r));return i._init(),p(e,i)}return y(t,e),s(t,[{key:"_init",value:function(){}}],[{key:"observedAttributes",get:function(){return null!=i?i:[]}}])}(h(HTMLElement)),a=function(e){function t(){return c(this,t),f(this,t,arguments)}return y(t,e),s(t,[{key:"_init",value:function(){var e,i,u,c,a,s=this;try{(e=t,i="_init",u=this,a=l(m(1&(c=3)?e.prototype:e),i,u),2&c&&"function"==typeof a?function(e){return a.apply(u,e)}:a)([]);var d=j({},n);g((function*(){s._shadow=s.attachShadow({mode:"open"});try{var e,t=yield null==o||null===(e=o.getInstance)||void 0===e?void 0:e.call(o);if(t&&t.name&&t.version){var n,i;if(s._widget=t,yield O(),yield(0,r.loadAssets)(t.assets,s._shadow),yield null==o||null===(n=o.reconstructor)||void 0===n?void 0:n.call(o,s._widget,{shadow:s._shadow,customElement:s}),"function"==typeof(null==o?void 0:o.remount))yield null==o||null===(i=o.remount)||void 0===i?void 0:i.call(o,s._widget,{shadow:s._shadow,customElement:s});else t.root=s._shadow,t.customElement=s,s._shadow.appendChild(t.container);return}}catch(e){return void console.error(e)}try{var u,l,c;d.root=s._shadow,d.customElement=s,d.container||(d.container=document.createElement("div"),d.container.setAttribute("id","merkur-container")),s._shadow.appendChild(d.container),s._widget=yield function(e,t){return _.apply(this,arguments)}(d,s._shadow),yield null==o||null===(u=o.constructor)||void 0===u?void 0:u.call(o,s._widget,{shadow:s._shadow,customElement:s}),null!==(l=yield null==o||null===(c=o.mount)||void 0===c?void 0:c.call(o,s._widget,{shadow:s._shadow,customElement:s}))&&void 0!==l||(yield s._widget.mount())}catch(e){console.error(e)}}))()}catch(e){console.error(e)}}},{key:"connectedCallback",value:function(){var e,t,n;null===(e=this._widget)||void 0===e||null===(t=e.connectedCallback)||void 0===t||t.call(e,{shadow:this._shadow,customElement:this}),null==o||null===(n=o.connectedCallback)||void 0===n||n.call(o,this._widget,{shadow:this._shadow,customElement:this})}},{key:"disconnectedCallback",value:function(){var e,t,n;null===(e=this._widget)||void 0===e||null===(t=e.disconnectedCallback)||void 0===t||t.call(e,{shadow:this._shadow,customElement:this}),null==o||null===(n=o.disconnectedCallback)||void 0===n||n.call(o,this._widget,{shadow:this._shadow,customElement:this})}},{key:"adoptedCallback",value:function(){var e,t,n;null===(e=this._widget)||void 0===e||null===(t=e.adoptedCallback)||void 0===t||t.call(e,{shadow:this._shadow,customElement:this}),null==o||null===(n=o.adoptedCallback)||void 0===n||n.call(o,this._widget,{shadow:this._shadow,customElement:this})}},{key:"attributeChangedCallback",value:function(e,t,n){var r,i,u;null===(r=this._widget)||void 0===r||null===(i=r.attributeChangedCallback)||void 0===i||i.call(r,this._widget,e,t,n,{shadow:this._shadow,customElement:this}),null==o||null===(u=o.attributeChangedCallback)||void 0===u||u.call(o,this._widget,e,t,n,{shadow:this._shadow,customElement:this})}}])}(u);void 0===customElements.get(n.name)&&customElements.define(n.name,a)};var k=["__proto__","prototype","constructor"];function j(e,t){var n=function(e){return!!e&&e.constructor===Object};return n(e)&&n(t)?(Object.keys(t).forEach((function(r){if(!k.includes(r)){var o=e[r],i=t[r];Array.isArray(o)&&Array.isArray(i)?e[r]=o.concat(i):n(o)&&n(i)?e[r]=j(Object.assign({},o),i):e[r]=i}})),e):t}}));
1
+ function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}!function(t,e){if("function"==typeof define&&define.amd)define("@merkur/integration-custom-element",["exports","@merkur/core","@merkur/integration"],e);else if("undefined"!=typeof exports)e(exports,require("@merkur/core"),require("@merkur/integration"));else{var n={exports:{}};e(n.exports,t.Merkur.Core,t.Merkur.Integration),t.merkurIntegrationCustomElement=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e,n,r){function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function u(t,e,n){return(e=d(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(){return l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=b(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},l.apply(null,arguments)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,d(r.key),r)}}function s(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function d(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==t(n)?n:n+""}function f(t,e,n){return e=b(e),p(t,v()?Reflect.construct(e,n||[],b(t).constructor):e.apply(t,n))}function p(e,n){if(n&&("object"==t(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(e)}function y(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&m(t,e)}function h(t){var e="function"==typeof Map?new Map:void 0;return h=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(v())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&m(o,n.prototype),o}(t,arguments,b(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),m(n,t)},h(t)}function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(v=function(){return!!t})()}function m(t,e){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},m(t,e)}function b(t){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},b(t)}function w(t,e,n,r,o,i,u){try{var l=t[i](u),c=l.value}catch(t){return void n(t)}l.done?e(c):Promise.resolve(c).then(r,o)}function g(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function u(t){w(i,r,o,u,l,"next",t)}function l(t){w(i,r,o,u,l,"throw",t)}u(void 0)}))}}function _(){return(_=g((function*(t,e){var o=i(i({},t),{},{createWidget:t.createWidget});return(0,n.getMerkur)().isRegistered(o.name+o.version)||(0,n.getMerkur)().register(o),yield O(),yield(0,r.loadAssets)(o.assets,e),yield(0,n.getMerkur)().create(o)}))).apply(this,arguments)}function O(){return new Promise((function(t){"undefined"!=typeof document?"loading"!==document.readyState?t():window.addEventListener("DOMContentLoaded",(function(){t()})):t()}))}Object.defineProperty(e,"__esModule",{value:!0}),e.deepMerge=j,e.registerCustomElement=function(t){var e=j({},t),n=e.widgetDefinition,o=e.callbacks,i=e.observedAttributes,u=function(t){function e(){var t;c(this,e);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var i=t=f(this,e,[].concat(r));return i._init(),p(t,i)}return y(e,t),s(e,[{key:"_init",value:function(){}}],[{key:"observedAttributes",get:function(){return null!=i?i:[]}}])}(h(HTMLElement)),a=function(t){function e(){return c(this,e),f(this,e,arguments)}return y(e,t),s(e,[{key:"_init",value:function(){var t,i,u,c,a,s=this;try{(t=e,i="_init",u=this,a=l(b(1&(c=3)?t.prototype:t),i,u),2&c&&"function"==typeof a?function(t){return a.apply(u,t)}:a)([]);var d=j({},n);this._widgetPromise=g((function*(){s._shadow=s.attachShadow({mode:"open"});try{var t,e=yield null==o||null===(t=o.getInstance)||void 0===t?void 0:t.call(o);if(e&&e.name&&e.version){var n,i;if(s._widget=e,yield O(),yield(0,r.loadAssets)(e.assets,s._shadow),yield null==o||null===(n=o.reconstructor)||void 0===n?void 0:n.call(o,s._widget,{shadow:s._shadow,customElement:s}),"function"==typeof(null==o?void 0:o.remount))yield null==o||null===(i=o.remount)||void 0===i?void 0:i.call(o,s._widget,{shadow:s._shadow,customElement:s});else e.root=s._shadow,e.customElement=s,s._shadow.appendChild(e.container);return}}catch(t){return void console.error(t)}try{var u,l,c;d.root=s._shadow,d.customElement=s,d.container||(d.container=document.createElement("div"),d.container.setAttribute("id","merkur-container")),s._shadow.appendChild(d.container),s._widget=yield function(t,e){return _.apply(this,arguments)}(d,s._shadow),yield null==o||null===(u=o.constructor)||void 0===u?void 0:u.call(o,s._widget,{shadow:s._shadow,customElement:s}),null!==(l=yield null==o||null===(c=o.mount)||void 0===c?void 0:c.call(o,s._widget,{shadow:s._shadow,customElement:s}))&&void 0!==l||(yield s._widget.mount())}catch(t){console.error(t)}}))()}catch(t){console.error(t)}}},{key:"connectedCallback",value:(d=g((function*(){var t,e,n;yield this._widgetPromise,null===(t=this._widget)||void 0===t||null===(e=t.connectedCallback)||void 0===e||e.call(t,{shadow:this._shadow,customElement:this}),null==o||null===(n=o.connectedCallback)||void 0===n||n.call(o,this._widget,{shadow:this._shadow,customElement:this})})),function(){return d.apply(this,arguments)})},{key:"disconnectedCallback",value:(a=g((function*(){var t,e,n;yield this._widgetPromise,null===(t=this._widget)||void 0===t||null===(e=t.disconnectedCallback)||void 0===e||e.call(t,{shadow:this._shadow,customElement:this}),null==o||null===(n=o.disconnectedCallback)||void 0===n||n.call(o,this._widget,{shadow:this._shadow,customElement:this})})),function(){return a.apply(this,arguments)})},{key:"adoptedCallback",value:(u=g((function*(){var t,e,n;yield this._widgetPromise,null===(t=this._widget)||void 0===t||null===(e=t.adoptedCallback)||void 0===e||e.call(t,{shadow:this._shadow,customElement:this}),null==o||null===(n=o.adoptedCallback)||void 0===n||n.call(o,this._widget,{shadow:this._shadow,customElement:this})})),function(){return u.apply(this,arguments)})},{key:"attributeChangedCallback",value:(i=g((function*(t,e,n){var r,i,u;yield this._widgetPromise,null===(r=this._widget)||void 0===r||null===(i=r.attributeChangedCallback)||void 0===i||i.call(r,this._widget,t,e,n,{shadow:this._shadow,customElement:this}),null==o||null===(u=o.attributeChangedCallback)||void 0===u||u.call(o,this._widget,t,e,n,{shadow:this._shadow,customElement:this})})),function(t,e,n){return i.apply(this,arguments)})}]);var i,u,a,d}(u);void 0===customElements.get(n.name)&&customElements.define(n.name,a)};var k=["__proto__","prototype","constructor"];function j(t,e){var n=function(t){return!!t&&t.constructor===Object};return n(t)&&n(e)?(Object.keys(e).forEach((function(r){if(!k.includes(r)){var o=t[r],i=e[r];Array.isArray(o)&&Array.isArray(i)?t[r]=o.concat(i):n(o)&&n(i)?t[r]=j(Object.assign({},o),i):t[r]=i}})),t):e}}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkur/integration-custom-element",
3
- "version": "0.37.0",
3
+ "version": "0.37.11",
4
4
  "description": "Merkur module for easy integration with other apps with custom element.",
5
5
  "main": "lib/index",
6
6
  "module": "lib/index",
@@ -52,11 +52,11 @@
52
52
  "homepage": "https://merkur.js.org/",
53
53
  "devDependencies": {
54
54
  "@merkur/core": "^0.37.0",
55
- "@merkur/integration": "^0.37.0"
55
+ "@merkur/integration": "^0.37.11"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@merkur/core": "*",
59
59
  "@merkur/integration": "*"
60
60
  },
61
- "gitHead": "af826493e5ed4b37602dd43ce89a59baeeb1bada"
61
+ "gitHead": "500328fbb5cabc0728bf50ca7a0ff6c3b7dd595c"
62
62
  }