@merkur/integration-custom-element 0.35.12 → 0.35.13
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 +17 -9
- package/lib/index.es9.cjs +18 -12
- package/lib/index.es9.mjs +18 -12
- package/lib/index.js +17 -9
- package/lib/index.mjs +17 -9
- package/lib/index.umd.js +1 -1
- package/package.json +2 -2
package/lib/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var integration = require('@merkur/integration');
|
|
|
6
6
|
async function createSPAWidget(widgetDefinition) {
|
|
7
7
|
const definition = {
|
|
8
8
|
...widgetDefinition,
|
|
9
|
-
createWidget: widgetDefinition.createWidget || core.createMerkurWidget,
|
|
9
|
+
createWidget: widgetDefinition.createWidget || core.createMerkurWidget, // TODO remove createMerkurWidget keep only one way
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
core.getMerkur().register(definition);
|
|
@@ -39,18 +39,20 @@ function registerCustomElement(options) {
|
|
|
39
39
|
constructor() {
|
|
40
40
|
super();
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
(async () => {
|
|
43
|
+
const shadow = this.attachShadow({ mode: 'open' });
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
// TODO allow same UI for two custom element
|
|
46
|
+
const widget = await callbacks?.getSingleton?.();
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
if (widget && widget.name && widget.version) {
|
|
49
|
+
this._widget = widget;
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
51
53
|
|
|
52
|
-
(async () => {
|
|
53
54
|
try {
|
|
55
|
+
// TODO widget root remove
|
|
54
56
|
widgetDefinition.root = shadow;
|
|
55
57
|
widgetDefinition.customElement = this;
|
|
56
58
|
|
|
@@ -62,9 +64,10 @@ function registerCustomElement(options) {
|
|
|
62
64
|
widgetDefinition.root.appendChild(widgetDefinition.container);
|
|
63
65
|
|
|
64
66
|
this._widget = await createSPAWidget(widgetDefinition);
|
|
65
|
-
this._widget.mount();
|
|
66
67
|
|
|
67
68
|
callbacks?.constructor?.(this._widget);
|
|
69
|
+
|
|
70
|
+
await this._widget.mount();
|
|
68
71
|
} catch (error) {
|
|
69
72
|
console.error(error);
|
|
70
73
|
}
|
|
@@ -98,6 +101,7 @@ function registerCustomElement(options) {
|
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
|
|
104
|
+
const PROTECTED_FIELDS = ['__proto__', 'prototype', 'constructor'];
|
|
101
105
|
function deepMerge(target, source) {
|
|
102
106
|
const isObject = (obj) => !!obj && obj.constructor === Object;
|
|
103
107
|
|
|
@@ -106,6 +110,10 @@ function deepMerge(target, source) {
|
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
Object.keys(source).forEach((key) => {
|
|
113
|
+
if (PROTECTED_FIELDS.includes(key)) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
109
117
|
const targetValue = target[key];
|
|
110
118
|
const sourceValue = source[key];
|
|
111
119
|
|
package/lib/index.es9.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var integration = require('@merkur/integration');
|
|
|
5
5
|
async function createSPAWidget(widgetDefinition) {
|
|
6
6
|
const definition = {
|
|
7
7
|
...widgetDefinition,
|
|
8
|
-
createWidget: widgetDefinition.createWidget || core.createMerkurWidget
|
|
8
|
+
createWidget: widgetDefinition.createWidget || core.createMerkurWidget // TODO remove createMerkurWidget keep only one way
|
|
9
9
|
};
|
|
10
10
|
core.getMerkur().register(definition);
|
|
11
11
|
await afterDOMLoad();
|
|
@@ -34,19 +34,21 @@ function registerCustomElement(options) {
|
|
|
34
34
|
} = deepMerge({}, options);
|
|
35
35
|
class WidgetElement extends HTMLElement {
|
|
36
36
|
constructor() {
|
|
37
|
-
var _callbacks$getSinglet;
|
|
38
37
|
super();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
(async _callbacks$getSinglet => {
|
|
39
|
+
const shadow = this.attachShadow({
|
|
40
|
+
mode: 'open'
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// TODO allow same UI for two custom element
|
|
44
|
+
const widget = await (callbacks === null || callbacks === void 0 || (_callbacks$getSinglet = callbacks.getSingleton) === null || _callbacks$getSinglet === void 0 ? void 0 : _callbacks$getSinglet.call(callbacks));
|
|
45
|
+
if (widget && widget.name && widget.version) {
|
|
46
|
+
this._widget = widget;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
48
49
|
try {
|
|
49
50
|
var _callbacks$constructo;
|
|
51
|
+
// TODO widget root remove
|
|
50
52
|
widgetDefinition.root = shadow;
|
|
51
53
|
widgetDefinition.customElement = this;
|
|
52
54
|
if (!widgetDefinition.container) {
|
|
@@ -55,8 +57,8 @@ function registerCustomElement(options) {
|
|
|
55
57
|
}
|
|
56
58
|
widgetDefinition.root.appendChild(widgetDefinition.container);
|
|
57
59
|
this._widget = await createSPAWidget(widgetDefinition);
|
|
58
|
-
this._widget.mount();
|
|
59
60
|
callbacks === null || callbacks === void 0 || (_callbacks$constructo = callbacks.constructor) === null || _callbacks$constructo === void 0 || _callbacks$constructo.call(callbacks, this._widget);
|
|
61
|
+
await this._widget.mount();
|
|
60
62
|
} catch (error) {
|
|
61
63
|
console.error(error);
|
|
62
64
|
}
|
|
@@ -83,12 +85,16 @@ function registerCustomElement(options) {
|
|
|
83
85
|
customElements.define(widgetDefinition.name, WidgetElement);
|
|
84
86
|
}
|
|
85
87
|
}
|
|
88
|
+
const PROTECTED_FIELDS = ['__proto__', 'prototype', 'constructor'];
|
|
86
89
|
function deepMerge(target, source) {
|
|
87
90
|
const isObject = obj => !!obj && obj.constructor === Object;
|
|
88
91
|
if (!isObject(target) || !isObject(source)) {
|
|
89
92
|
return source;
|
|
90
93
|
}
|
|
91
94
|
Object.keys(source).forEach(key => {
|
|
95
|
+
if (PROTECTED_FIELDS.includes(key)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
92
98
|
const targetValue = target[key];
|
|
93
99
|
const sourceValue = source[key];
|
|
94
100
|
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
|
package/lib/index.es9.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { loadAssets } from '@merkur/integration';
|
|
|
3
3
|
async function createSPAWidget(widgetDefinition) {
|
|
4
4
|
const definition = {
|
|
5
5
|
...widgetDefinition,
|
|
6
|
-
createWidget: widgetDefinition.createWidget || createMerkurWidget
|
|
6
|
+
createWidget: widgetDefinition.createWidget || createMerkurWidget // TODO remove createMerkurWidget keep only one way
|
|
7
7
|
};
|
|
8
8
|
getMerkur().register(definition);
|
|
9
9
|
await afterDOMLoad();
|
|
@@ -32,19 +32,21 @@ function registerCustomElement(options) {
|
|
|
32
32
|
} = deepMerge({}, options);
|
|
33
33
|
class WidgetElement extends HTMLElement {
|
|
34
34
|
constructor() {
|
|
35
|
-
var _callbacks$getSinglet;
|
|
36
35
|
super();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
(async _callbacks$getSinglet => {
|
|
37
|
+
const shadow = this.attachShadow({
|
|
38
|
+
mode: 'open'
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// TODO allow same UI for two custom element
|
|
42
|
+
const widget = await (callbacks === null || callbacks === void 0 || (_callbacks$getSinglet = callbacks.getSingleton) === null || _callbacks$getSinglet === void 0 ? void 0 : _callbacks$getSinglet.call(callbacks));
|
|
43
|
+
if (widget && widget.name && widget.version) {
|
|
44
|
+
this._widget = widget;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
46
47
|
try {
|
|
47
48
|
var _callbacks$constructo;
|
|
49
|
+
// TODO widget root remove
|
|
48
50
|
widgetDefinition.root = shadow;
|
|
49
51
|
widgetDefinition.customElement = this;
|
|
50
52
|
if (!widgetDefinition.container) {
|
|
@@ -53,8 +55,8 @@ function registerCustomElement(options) {
|
|
|
53
55
|
}
|
|
54
56
|
widgetDefinition.root.appendChild(widgetDefinition.container);
|
|
55
57
|
this._widget = await createSPAWidget(widgetDefinition);
|
|
56
|
-
this._widget.mount();
|
|
57
58
|
callbacks === null || callbacks === void 0 || (_callbacks$constructo = callbacks.constructor) === null || _callbacks$constructo === void 0 || _callbacks$constructo.call(callbacks, this._widget);
|
|
59
|
+
await this._widget.mount();
|
|
58
60
|
} catch (error) {
|
|
59
61
|
console.error(error);
|
|
60
62
|
}
|
|
@@ -81,12 +83,16 @@ function registerCustomElement(options) {
|
|
|
81
83
|
customElements.define(widgetDefinition.name, WidgetElement);
|
|
82
84
|
}
|
|
83
85
|
}
|
|
86
|
+
const PROTECTED_FIELDS = ['__proto__', 'prototype', 'constructor'];
|
|
84
87
|
function deepMerge(target, source) {
|
|
85
88
|
const isObject = obj => !!obj && obj.constructor === Object;
|
|
86
89
|
if (!isObject(target) || !isObject(source)) {
|
|
87
90
|
return source;
|
|
88
91
|
}
|
|
89
92
|
Object.keys(source).forEach(key => {
|
|
93
|
+
if (PROTECTED_FIELDS.includes(key)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
90
96
|
const targetValue = target[key];
|
|
91
97
|
const sourceValue = source[key];
|
|
92
98
|
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
|
package/lib/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var integration = require('@merkur/integration');
|
|
|
6
6
|
async function createSPAWidget(widgetDefinition) {
|
|
7
7
|
const definition = {
|
|
8
8
|
...widgetDefinition,
|
|
9
|
-
createWidget: widgetDefinition.createWidget || core.createMerkurWidget,
|
|
9
|
+
createWidget: widgetDefinition.createWidget || core.createMerkurWidget, // TODO remove createMerkurWidget keep only one way
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
core.getMerkur().register(definition);
|
|
@@ -39,18 +39,20 @@ function registerCustomElement(options) {
|
|
|
39
39
|
constructor() {
|
|
40
40
|
super();
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
(async () => {
|
|
43
|
+
const shadow = this.attachShadow({ mode: 'open' });
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
// TODO allow same UI for two custom element
|
|
46
|
+
const widget = await callbacks?.getSingleton?.();
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
if (widget && widget.name && widget.version) {
|
|
49
|
+
this._widget = widget;
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
51
53
|
|
|
52
|
-
(async () => {
|
|
53
54
|
try {
|
|
55
|
+
// TODO widget root remove
|
|
54
56
|
widgetDefinition.root = shadow;
|
|
55
57
|
widgetDefinition.customElement = this;
|
|
56
58
|
|
|
@@ -62,9 +64,10 @@ function registerCustomElement(options) {
|
|
|
62
64
|
widgetDefinition.root.appendChild(widgetDefinition.container);
|
|
63
65
|
|
|
64
66
|
this._widget = await createSPAWidget(widgetDefinition);
|
|
65
|
-
this._widget.mount();
|
|
66
67
|
|
|
67
68
|
callbacks?.constructor?.(this._widget);
|
|
69
|
+
|
|
70
|
+
await this._widget.mount();
|
|
68
71
|
} catch (error) {
|
|
69
72
|
console.error(error);
|
|
70
73
|
}
|
|
@@ -98,6 +101,7 @@ function registerCustomElement(options) {
|
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
|
|
104
|
+
const PROTECTED_FIELDS = ['__proto__', 'prototype', 'constructor'];
|
|
101
105
|
function deepMerge(target, source) {
|
|
102
106
|
const isObject = (obj) => !!obj && obj.constructor === Object;
|
|
103
107
|
|
|
@@ -106,6 +110,10 @@ function deepMerge(target, source) {
|
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
Object.keys(source).forEach((key) => {
|
|
113
|
+
if (PROTECTED_FIELDS.includes(key)) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
109
117
|
const targetValue = target[key];
|
|
110
118
|
const sourceValue = source[key];
|
|
111
119
|
|
package/lib/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { loadAssets } from '@merkur/integration';
|
|
|
4
4
|
async function createSPAWidget(widgetDefinition) {
|
|
5
5
|
const definition = {
|
|
6
6
|
...widgetDefinition,
|
|
7
|
-
createWidget: widgetDefinition.createWidget || createMerkurWidget,
|
|
7
|
+
createWidget: widgetDefinition.createWidget || createMerkurWidget, // TODO remove createMerkurWidget keep only one way
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
getMerkur().register(definition);
|
|
@@ -37,18 +37,20 @@ function registerCustomElement(options) {
|
|
|
37
37
|
constructor() {
|
|
38
38
|
super();
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
(async () => {
|
|
41
|
+
const shadow = this.attachShadow({ mode: 'open' });
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
// TODO allow same UI for two custom element
|
|
44
|
+
const widget = await callbacks?.getSingleton?.();
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
if (widget && widget.name && widget.version) {
|
|
47
|
+
this._widget = widget;
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
49
51
|
|
|
50
|
-
(async () => {
|
|
51
52
|
try {
|
|
53
|
+
// TODO widget root remove
|
|
52
54
|
widgetDefinition.root = shadow;
|
|
53
55
|
widgetDefinition.customElement = this;
|
|
54
56
|
|
|
@@ -60,9 +62,10 @@ function registerCustomElement(options) {
|
|
|
60
62
|
widgetDefinition.root.appendChild(widgetDefinition.container);
|
|
61
63
|
|
|
62
64
|
this._widget = await createSPAWidget(widgetDefinition);
|
|
63
|
-
this._widget.mount();
|
|
64
65
|
|
|
65
66
|
callbacks?.constructor?.(this._widget);
|
|
67
|
+
|
|
68
|
+
await this._widget.mount();
|
|
66
69
|
} catch (error) {
|
|
67
70
|
console.error(error);
|
|
68
71
|
}
|
|
@@ -96,6 +99,7 @@ function registerCustomElement(options) {
|
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
|
|
102
|
+
const PROTECTED_FIELDS = ['__proto__', 'prototype', 'constructor'];
|
|
99
103
|
function deepMerge(target, source) {
|
|
100
104
|
const isObject = (obj) => !!obj && obj.constructor === Object;
|
|
101
105
|
|
|
@@ -104,6 +108,10 @@ function deepMerge(target, source) {
|
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
Object.keys(source).forEach((key) => {
|
|
111
|
+
if (PROTECTED_FIELDS.includes(key)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
107
115
|
const targetValue = target[key];
|
|
108
116
|
const sourceValue = source[key];
|
|
109
117
|
|
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=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(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,a(r.key),r)}}function a(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 l(
|
|
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=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(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,a(r.key),r)}}function a(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 l(e){var t="function"==typeof Map?new Map:void 0;return l=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(f())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&s(o,n.prototype),o}(e,arguments,p(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},l(e)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(f=function(){return!!e})()}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function d(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){return void n(e)}c.done?t(a):Promise.resolve(a).then(r,o)}function y(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function u(e){d(i,r,o,u,c,"next",e)}function c(e){d(i,r,o,u,c,"throw",e)}u(void 0)}))}}function b(){return(b=y((function*(e){var t=i(i({},e),{},{createWidget:e.createWidget||n.createMerkurWidget});return(0,n.getMerkur)().register(t),yield new Promise((function(e){"undefined"!=typeof document?"loading"!==document.readyState?e():window.addEventListener("DOMContentLoaded",(function(){e()})):e()})),yield(0,r.loadAssets)(t.assets,t.root),yield(0,n.getMerkur)().create(t)}))).apply(this,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.deepMerge=m,t.registerCustomElement=function(t){var n=m({},t),r=n.widgetDefinition,o=n.callbacks,i=function(t){function n(){var t,i,u,c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),i=this,u=p(u=n),t=function(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)}(i,f()?Reflect.construct(u,c||[],p(i).constructor):u.apply(i,c)),y((function*(){var e,n=t.attachShadow({mode:"open"}),i=yield null==o||null===(e=o.getSingleton)||void 0===e?void 0:e.call(o);if(i&&i.name&&i.version)t._widget=i;else try{var u;r.root=n,r.customElement=t,r.container||(r.container=document.createElement("div"),r.container.setAttribute("id","merkur-container")),r.root.appendChild(r.container),t._widget=yield function(e){return b.apply(this,arguments)}(r),null==o||null===(u=o.constructor)||void 0===u||u.call(o,t._widget),yield t._widget.mount()}catch(e){console.error(e)}}))(),t}return function(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&&s(e,t)}(n,t),function(e,t,n){t&&c(e.prototype,t);n&&c(e,n);return Object.defineProperty(e,"prototype",{writable:!1}),e}(n,[{key:"connectedCallback",value:function(){var e;null==o||null===(e=o.connectedCallback)||void 0===e||e.call(o,this._widget)}},{key:"disconnectedCallback",value:function(){var e;null==o||null===(e=o.disconnectedCallback)||void 0===e||e.call(o,this._widget)}},{key:"adoptedCallback",value:function(){var e;null==o||null===(e=o.adoptedCallback)||void 0===e||e.call(o,this._widget)}},{key:"attributeChangedCallback",value:function(e,t,n){var r;null==o||null===(r=o.attributeChangedCallback)||void 0===r||r.call(o,this._widget,e,t,n)}}])}(l(HTMLElement));void 0===customElements.get(r.name)&&customElements.define(r.name,i)};var v=["__proto__","prototype","constructor"];function m(e,t){var n=function(e){return!!e&&e.constructor===Object};return n(e)&&n(t)?(Object.keys(t).forEach((function(r){if(!v.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]=m(Object.assign({},o),i):e[r]=i}})),e):t}}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkur/integration-custom-element",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.13",
|
|
4
4
|
"description": "Merkur module for easy integration with other apps with custom element.",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"module": "lib/index",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"@merkur/core": "*",
|
|
58
58
|
"@merkur/integration": "*"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "8bb24cc052179aef195e2dd1c4d1a500b9b5ae0f"
|
|
61
61
|
}
|