@merkur/integration-custom-element 0.36.0 → 0.36.2
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/cli/index.mjs +9 -0
- package/lib/index.cjs +10 -4
- package/lib/index.es9.cjs +12 -5
- package/lib/index.es9.mjs +12 -5
- package/lib/index.js +10 -4
- package/lib/index.mjs +10 -4
- package/lib/index.umd.js +1 -1
- package/package.json +2 -2
package/cli/index.mjs
CHANGED
|
@@ -34,6 +34,15 @@ export default function ({ emitter, EMITTER_EVENTS }) {
|
|
|
34
34
|
},
|
|
35
35
|
);
|
|
36
36
|
|
|
37
|
+
emitter.on(
|
|
38
|
+
EMITTER_EVENTS.MERKUR_CONFIG,
|
|
39
|
+
function turnOffHMR({ merkurConfig }) {
|
|
40
|
+
merkurConfig.HMR = false;
|
|
41
|
+
|
|
42
|
+
return merkurConfig;
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
37
46
|
emitter.on(EMITTER_EVENTS.CLI_CONFIG, function removeNodeTask({ cliConfig }) {
|
|
38
47
|
if (cliConfig.runTask.length === 0) {
|
|
39
48
|
cliConfig.runTask = ['es13', 'es9'];
|
package/lib/index.cjs
CHANGED
|
@@ -61,10 +61,16 @@ function registerCustomElement(options) {
|
|
|
61
61
|
customElement: this,
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
if (typeof callbacks?.remount === 'function') {
|
|
65
|
+
await callbacks?.remount?.(this._widget, {
|
|
66
|
+
shadow: this._shadow,
|
|
67
|
+
customElement: this,
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
widget.root = this._shadow;
|
|
71
|
+
widget.customElement = this;
|
|
72
|
+
this._shadow.appendChild(widget.container);
|
|
73
|
+
}
|
|
68
74
|
|
|
69
75
|
return;
|
|
70
76
|
}
|
package/lib/index.es9.cjs
CHANGED
|
@@ -47,7 +47,7 @@ function registerCustomElement(options) {
|
|
|
47
47
|
var _callbacks$getInstanc;
|
|
48
48
|
const widget = await (callbacks === null || callbacks === void 0 || (_callbacks$getInstanc = callbacks.getInstance) === null || _callbacks$getInstanc === void 0 ? void 0 : _callbacks$getInstanc.call(callbacks));
|
|
49
49
|
if (widget && widget.name && widget.version) {
|
|
50
|
-
var _callbacks$reconstruc
|
|
50
|
+
var _callbacks$reconstruc;
|
|
51
51
|
this._widget = widget;
|
|
52
52
|
await afterDOMLoad();
|
|
53
53
|
await integration.loadAssets(widget.assets, this._shadow);
|
|
@@ -55,10 +55,17 @@ function registerCustomElement(options) {
|
|
|
55
55
|
shadow: this._shadow,
|
|
56
56
|
customElement: this
|
|
57
57
|
}));
|
|
58
|
-
(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
if (typeof (callbacks === null || callbacks === void 0 ? void 0 : callbacks.remount) === 'function') {
|
|
59
|
+
var _callbacks$remount;
|
|
60
|
+
await (callbacks === null || callbacks === void 0 || (_callbacks$remount = callbacks.remount) === null || _callbacks$remount === void 0 ? void 0 : _callbacks$remount.call(callbacks, this._widget, {
|
|
61
|
+
shadow: this._shadow,
|
|
62
|
+
customElement: this
|
|
63
|
+
}));
|
|
64
|
+
} else {
|
|
65
|
+
widget.root = this._shadow;
|
|
66
|
+
widget.customElement = this;
|
|
67
|
+
this._shadow.appendChild(widget.container);
|
|
68
|
+
}
|
|
62
69
|
return;
|
|
63
70
|
}
|
|
64
71
|
} catch (error) {
|
package/lib/index.es9.mjs
CHANGED
|
@@ -45,7 +45,7 @@ function registerCustomElement(options) {
|
|
|
45
45
|
var _callbacks$getInstanc;
|
|
46
46
|
const widget = await (callbacks === null || callbacks === void 0 || (_callbacks$getInstanc = callbacks.getInstance) === null || _callbacks$getInstanc === void 0 ? void 0 : _callbacks$getInstanc.call(callbacks));
|
|
47
47
|
if (widget && widget.name && widget.version) {
|
|
48
|
-
var _callbacks$reconstruc
|
|
48
|
+
var _callbacks$reconstruc;
|
|
49
49
|
this._widget = widget;
|
|
50
50
|
await afterDOMLoad();
|
|
51
51
|
await loadAssets(widget.assets, this._shadow);
|
|
@@ -53,10 +53,17 @@ function registerCustomElement(options) {
|
|
|
53
53
|
shadow: this._shadow,
|
|
54
54
|
customElement: this
|
|
55
55
|
}));
|
|
56
|
-
(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
if (typeof (callbacks === null || callbacks === void 0 ? void 0 : callbacks.remount) === 'function') {
|
|
57
|
+
var _callbacks$remount;
|
|
58
|
+
await (callbacks === null || callbacks === void 0 || (_callbacks$remount = callbacks.remount) === null || _callbacks$remount === void 0 ? void 0 : _callbacks$remount.call(callbacks, this._widget, {
|
|
59
|
+
shadow: this._shadow,
|
|
60
|
+
customElement: this
|
|
61
|
+
}));
|
|
62
|
+
} else {
|
|
63
|
+
widget.root = this._shadow;
|
|
64
|
+
widget.customElement = this;
|
|
65
|
+
this._shadow.appendChild(widget.container);
|
|
66
|
+
}
|
|
60
67
|
return;
|
|
61
68
|
}
|
|
62
69
|
} catch (error) {
|
package/lib/index.js
CHANGED
|
@@ -61,10 +61,16 @@ function registerCustomElement(options) {
|
|
|
61
61
|
customElement: this,
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
if (typeof callbacks?.remount === 'function') {
|
|
65
|
+
await callbacks?.remount?.(this._widget, {
|
|
66
|
+
shadow: this._shadow,
|
|
67
|
+
customElement: this,
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
widget.root = this._shadow;
|
|
71
|
+
widget.customElement = this;
|
|
72
|
+
this._shadow.appendChild(widget.container);
|
|
73
|
+
}
|
|
68
74
|
|
|
69
75
|
return;
|
|
70
76
|
}
|
package/lib/index.mjs
CHANGED
|
@@ -59,10 +59,16 @@ function registerCustomElement(options) {
|
|
|
59
59
|
customElement: this,
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
if (typeof callbacks?.remount === 'function') {
|
|
63
|
+
await callbacks?.remount?.(this._widget, {
|
|
64
|
+
shadow: this._shadow,
|
|
65
|
+
customElement: this,
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
widget.root = this._shadow;
|
|
69
|
+
widget.customElement = this;
|
|
70
|
+
this._shadow.appendChild(widget.container);
|
|
71
|
+
}
|
|
66
72
|
|
|
67
73
|
return;
|
|
68
74
|
}
|
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,o){function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,c(o.key),o)}}function c(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var r=o.call(t,n||"default");if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function a(e){var t="function"==typeof Map?new Map:void 0;return a=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(s())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,t);var r=new(e.bind.apply(e,o));return n&&d(r,n.prototype),r}(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,e)},a(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(s=function(){return!!e})()}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function p(e,t,n,o,r,i,l){try{var u=e[i](l),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(o,r)}function y(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var i=e.apply(t,n);function l(e){p(i,o,r,l,u,"next",e)}function u(e){p(i,o,r,l,u,"throw",e)}l(void 0)}))}}function h(){return(h=y((function*(e,t){var r=i(i({},e),{},{createWidget:e.createWidget});return(0,n.getMerkur)().isRegistered(r.name+r.version)||(0,n.getMerkur)().register(r),yield
|
|
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,o){function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,c(o.key),o)}}function c(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var r=o.call(t,n||"default");if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function a(e){var t="function"==typeof Map?new Map:void 0;return a=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(s())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,t);var r=new(e.bind.apply(e,o));return n&&d(r,n.prototype),r}(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,e)},a(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(s=function(){return!!e})()}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function p(e,t,n,o,r,i,l){try{var u=e[i](l),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(o,r)}function y(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var i=e.apply(t,n);function l(e){p(i,o,r,l,u,"next",e)}function u(e){p(i,o,r,l,u,"throw",e)}l(void 0)}))}}function h(){return(h=y((function*(e,t){var r=i(i({},e),{},{createWidget:e.createWidget});return(0,n.getMerkur)().isRegistered(r.name+r.version)||(0,n.getMerkur)().register(r),yield m(),yield(0,o.loadAssets)(r.assets,t),yield(0,n.getMerkur)().create(r)}))).apply(this,arguments)}function m(){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=b,t.registerCustomElement=function(t){var n=b({},t),r=n.widgetDefinition,i=n.callbacks,l=function(t){function n(){var t,l,u,c;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),l=this,u=f(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)}(l,s()?Reflect.construct(u,c||[],f(l).constructor):u.apply(l,c));var a=b({},r);return y((function*(){t._shadow=t.attachShadow({mode:"open"});try{var e,n=yield null==i||null===(e=i.getInstance)||void 0===e?void 0:e.call(i);if(n&&n.name&&n.version){var r,l;if(t._widget=n,yield m(),yield(0,o.loadAssets)(n.assets,t._shadow),yield null==i||null===(r=i.reconstructor)||void 0===r?void 0:r.call(i,t._widget,{shadow:t._shadow,customElement:t}),"function"==typeof(null==i?void 0:i.remount))yield null==i||null===(l=i.remount)||void 0===l?void 0:l.call(i,t._widget,{shadow:t._shadow,customElement:t});else n.root=t._shadow,n.customElement=t,t._shadow.appendChild(n.container);return}}catch(e){return void console.error(e)}try{var u,c,s;a.root=t._shadow,a.customElement=t,a.container||(a.container=document.createElement("div"),a.container.setAttribute("id","merkur-container")),t._shadow.appendChild(a.container),t._widget=yield function(e,t){return h.apply(this,arguments)}(a,t._shadow),yield null==i||null===(u=i.constructor)||void 0===u?void 0:u.call(i,t._widget,{shadow:t._shadow,customElement:t}),null!==(c=yield null==i||null===(s=i.mount)||void 0===s?void 0:s.call(i,t._widget,{shadow:t._shadow,customElement:t}))&&void 0!==c||(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&&d(e,t)}(n,t),function(e,t,n){t&&u(e.prototype,t);n&&u(e,n);return Object.defineProperty(e,"prototype",{writable:!1}),e}(n,[{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==i||null===(n=i.connectedCallback)||void 0===n||n.call(i,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==i||null===(n=i.disconnectedCallback)||void 0===n||n.call(i,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==i||null===(n=i.adoptedCallback)||void 0===n||n.call(i,this._widget,{shadow:this._shadow,customElement:this})}},{key:"attributeChangedCallback",value:function(e,t,n){var o,r,l;null===(o=this._widget)||void 0===o||null===(r=o.attributeChangedCallback)||void 0===r||r.call(o,this._widget,e,t,n,{shadow:this._shadow,customElement:this}),null==i||null===(l=i.attributeChangedCallback)||void 0===l||l.call(i,this._widget,e,t,n,{shadow:this._shadow,customElement:this})}}])}(a(HTMLElement));void 0===customElements.get(r.name)&&customElements.define(r.name,l)};var v=["__proto__","prototype","constructor"];function b(e,t){var n=function(e){return!!e&&e.constructor===Object};return n(e)&&n(t)?(Object.keys(t).forEach((function(o){if(!v.includes(o)){var r=e[o],i=t[o];Array.isArray(r)&&Array.isArray(i)?e[o]=r.concat(i):n(r)&&n(i)?e[o]=b(Object.assign({},r),i):e[o]=i}})),e):t}}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkur/integration-custom-element",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.2",
|
|
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": "e12bdfa8ff7e8f927edd757d051a90ddf9a95b01"
|
|
61
61
|
}
|