New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

remount

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remount - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

8

CHANGELOG.md
## Pre-v1.0.0 changes
[v0.9.2]
- Fix MutationObserver support for custom adapters
[v0.9.2]: https://github.com/rstacruz/remount/compare/v0.9.1...v0.9.2
[v0.9.1]

@@ -7,3 +13,3 @@

[v0.9.0]: https://github.com/rstacruz/remount/compare/v0.9.0...v0.9.1
[v0.9.1]: https://github.com/rstacruz/remount/compare/v0.9.0...v0.9.1

@@ -10,0 +16,0 @@ [v0.9.0]

6

dist/remount.es5.js

@@ -248,3 +248,3 @@ (function (global, factory) {

// It's a match!
events.onUpdate(node, node);
events.onMount(node, node);
observeForUpdates(node, events);

@@ -267,3 +267,3 @@ observeForRemoval(node, events);

) {
var onMount = _ref.onMount;
var onUpdate = _ref.onUpdate;

@@ -273,3 +273,3 @@ var observer = new window.MutationObserver(function (mutations) {

var node = mutation.target;
onMount(node, node);
onUpdate(node, node);
});

@@ -276,0 +276,0 @@ });

@@ -1,1 +0,1 @@

(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?b(exports,require('react'),require('react-dom')):'function'==typeof define&&define.amd?define(['exports','react','react-dom'],b):b(a.Remount={},a.React,a.ReactDOM)})(this,function(a,b,c){'use strict';function d(){if(!(window.HTMLElement&&window.HTMLElement._babelES5Adapter||void 0===window.Reflect||void 0===window.customElements||window.customElements.hasOwnProperty('polyfillWrapFlushCallback'))){var b=HTMLElement;window.HTMLElement=function(){return Reflect.construct(b,[],this.constructor)},HTMLElement.prototype=b.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,b),HTMLElement._babelES5Adapter=!0}}function e(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}function f(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function g(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function h(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function i(a,b){var c=b.shadow;if(c&&a.attachShadow){var d=document.createElement('span');return a.attachShadow({mode:'open'}).appendChild(d),d}return a}function j(a,b,c){a.nodeName.toLowerCase()===b?(c.onUpdate(a,a),k(a,c),l(a,c)):a.children&&a.children.length&&m(a.children,function(a){j(a,b,c)})}function k(a,b){var c=b.onMount,d=new window.MutationObserver(function(a){m(a,function(a){var b=a.target;c(b,b)})});d.observe(a,{attributes:!0})}function l(a,b){var c=b.onUnmount,d=a.parentNode,e=new window.MutationObserver(function(b){m(b,function(b){m(b.removedNodes,function(b){a!==b||(e.disconnect(d),c(a,a))})})});e.observe(d,{childList:!0,subtree:!0})}function m(a,b){for(var c=0,d=a.length;c<d;c++)b(a[c])}function n(a){return!!(-1!==a.indexOf('-')&&a.match(/^[a-z][a-z0-9-]*$/))}function o(a,d,e){var f=a.component,g=a.attributes,h=b.createElement(f,e);c.render(h,d)}function p(a,b){c.unmountComponentAtNode(b)}function q(){if(void 0!==q._result)return q._result;var a=[u,w].reduce(function(a,b){return a||b.isSupported()&&b},null);return a||console.warn('Remount: This browser doesn\'t support the MutationObserver API or the Custom Elements API. Including polyfills might fix this. Remount elements will not work. https://github.com/rstacruz/remount'),q._result=a,a}function r(a){return'object'===('undefined'==typeof a?'undefined':y(a))&&a.component?a:{component:a}}function s(a,b){var c=a.getAttribute('props-json');if(c)return JSON.parse(c);return(b||[]).reduce(function(b,c){return b[c]=a.getAttribute(c),b},{})}c=c&&c.hasOwnProperty('default')?c['default']:c;var t=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),u=Object.freeze({name:'CustomElements',defineElement:function(a,b,c){var j=c.onUpdate,k=c.onUnmount,l=c.onMount;d();var m=a.attributes||[],n=function(b){function c(){return f(this,c),g(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}return h(c,b),t(c,[{key:'connectedCallback',value:function(){this._mountPoint=i(this,a),l(this,this._mountPoint)}},{key:'disconnectedCallback',value:function(){this._mountPoint&&k(this,this._mountPoint)}},{key:'attributeChangedCallback',value:function(){this._mountPoint&&j(this,this._mountPoint)}}],[{key:'observedAttributes',get:function(){return['props-json'].concat(e(m))}}]),c}(window.HTMLElement);a.quiet&&window.customElements.get(b)||window.customElements.define(b,n)},isSupported:function(){return window.customElements&&window.customElements.define},supportsShadow:function(){return!!(document&&document.body&&document.body.attachShadow)}}),v={},w=Object.freeze({name:'MutationObserver',observers:v,isSupported:function(){return!!window.MutationObserver},defineElement:function(a,b,c){if(b=b.toLowerCase(),!n(b)){if(a.quiet)return;throw new Error('Remount: "'+b+'" is not a valid custom element name')}if(v[b]){if(a.quiet)return;throw new Error('Remount: "'+b+'" is already registered')}var d=new window.MutationObserver(function(a){m(a,function(a){m(a.addedNodes,function(a){j(a,b,c)})})});d.observe(document.body,{childList:!0,subtree:!0}),v[b]=!0},supportsShadow:function(){return!1}}),x=Object.freeze({mount:function(a,b,c){return o(a,b,c)},update:o,unmount:p}),y='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a};a.getStrategy=q,a.define=function(a,b){var c=q();c&&Object.keys(a).forEach(function(d){var e=Object.assign({},b,r(a[d])),f=e.adapter||x;c.defineElement(e,d,{onMount:function(a,b){var c=s(a,e.attributes);f.mount(e,b,c)},onUpdate:function(a,b){var c=s(a,e.attributes);f.update(e,b,c)},onUnmount:function(a,b){f.unmount(e,b)}})})},Object.defineProperty(a,'__esModule',{value:!0})});
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?b(exports,require('react'),require('react-dom')):'function'==typeof define&&define.amd?define(['exports','react','react-dom'],b):b(a.Remount={},a.React,a.ReactDOM)})(this,function(a,b,c){'use strict';function d(){if(!(window.HTMLElement&&window.HTMLElement._babelES5Adapter||void 0===window.Reflect||void 0===window.customElements||window.customElements.hasOwnProperty('polyfillWrapFlushCallback'))){var b=HTMLElement;window.HTMLElement=function(){return Reflect.construct(b,[],this.constructor)},HTMLElement.prototype=b.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,b),HTMLElement._babelES5Adapter=!0}}function e(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}function f(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function g(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function h(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function i(a,b){var c=b.shadow;if(c&&a.attachShadow){var d=document.createElement('span');return a.attachShadow({mode:'open'}).appendChild(d),d}return a}function j(a,b,c){a.nodeName.toLowerCase()===b?(c.onMount(a,a),k(a,c),l(a,c)):a.children&&a.children.length&&m(a.children,function(a){j(a,b,c)})}function k(a,b){var c=b.onUpdate,d=new window.MutationObserver(function(a){m(a,function(a){var b=a.target;c(b,b)})});d.observe(a,{attributes:!0})}function l(a,b){var c=b.onUnmount,d=a.parentNode,e=new window.MutationObserver(function(b){m(b,function(b){m(b.removedNodes,function(b){a!==b||(e.disconnect(d),c(a,a))})})});e.observe(d,{childList:!0,subtree:!0})}function m(a,b){for(var c=0,d=a.length;c<d;c++)b(a[c])}function n(a){return!!(-1!==a.indexOf('-')&&a.match(/^[a-z][a-z0-9-]*$/))}function o(a,d,e){var f=a.component,g=a.attributes,h=b.createElement(f,e);c.render(h,d)}function p(a,b){c.unmountComponentAtNode(b)}function q(){if(void 0!==q._result)return q._result;var a=[u,w].reduce(function(a,b){return a||b.isSupported()&&b},null);return a||console.warn('Remount: This browser doesn\'t support the MutationObserver API or the Custom Elements API. Including polyfills might fix this. Remount elements will not work. https://github.com/rstacruz/remount'),q._result=a,a}function r(a){return'object'===('undefined'==typeof a?'undefined':y(a))&&a.component?a:{component:a}}function s(a,b){var c=a.getAttribute('props-json');if(c)return JSON.parse(c);return(b||[]).reduce(function(b,c){return b[c]=a.getAttribute(c),b},{})}c=c&&c.hasOwnProperty('default')?c['default']:c;var t=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),u=Object.freeze({name:'CustomElements',defineElement:function(a,b,c){var j=c.onUpdate,k=c.onUnmount,l=c.onMount;d();var m=a.attributes||[],n=function(b){function c(){return f(this,c),g(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}return h(c,b),t(c,[{key:'connectedCallback',value:function(){this._mountPoint=i(this,a),l(this,this._mountPoint)}},{key:'disconnectedCallback',value:function(){this._mountPoint&&k(this,this._mountPoint)}},{key:'attributeChangedCallback',value:function(){this._mountPoint&&j(this,this._mountPoint)}}],[{key:'observedAttributes',get:function(){return['props-json'].concat(e(m))}}]),c}(window.HTMLElement);a.quiet&&window.customElements.get(b)||window.customElements.define(b,n)},isSupported:function(){return window.customElements&&window.customElements.define},supportsShadow:function(){return!!(document&&document.body&&document.body.attachShadow)}}),v={},w=Object.freeze({name:'MutationObserver',observers:v,isSupported:function(){return!!window.MutationObserver},defineElement:function(a,b,c){if(b=b.toLowerCase(),!n(b)){if(a.quiet)return;throw new Error('Remount: "'+b+'" is not a valid custom element name')}if(v[b]){if(a.quiet)return;throw new Error('Remount: "'+b+'" is already registered')}var d=new window.MutationObserver(function(a){m(a,function(a){m(a.addedNodes,function(a){j(a,b,c)})})});d.observe(document.body,{childList:!0,subtree:!0}),v[b]=!0},supportsShadow:function(){return!1}}),x=Object.freeze({mount:function(a,b,c){return o(a,b,c)},update:o,unmount:p}),y='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a};a.getStrategy=q,a.define=function(a,b){var c=q();c&&Object.keys(a).forEach(function(d){var e=Object.assign({},b,r(a[d])),f=e.adapter||x;c.defineElement(e,d,{onMount:function(a,b){var c=s(a,e.attributes);f.mount(e,b,c)},onUpdate:function(a,b){var c=s(a,e.attributes);f.update(e,b,c)},onUnmount:function(a,b){f.unmount(e,b)}})})},Object.defineProperty(a,'__esModule',{value:!0})});

@@ -226,3 +226,3 @@ (function (global, factory) {

// It's a match!
events.onUpdate(node, node);
events.onMount(node, node);
observeForUpdates(node, events);

@@ -244,3 +244,3 @@ observeForRemoval(node, events);

node /*: Element */,
{ onMount } /*: ElementEvents */
{ onUpdate } /*: ElementEvents */
) {

@@ -250,3 +250,3 @@ const observer = new window.MutationObserver(mutations => {

const node = mutation.target;
onMount(node, node);
onUpdate(node, node);
});

@@ -253,0 +253,0 @@ });

@@ -1,1 +0,1 @@

(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?b(exports,require('react'),require('react-dom')):'function'==typeof define&&define.amd?define(['exports','react','react-dom'],b):b(a.Remount={},a.React,a.ReactDOM)})(this,function(a,b,c){'use strict';function d(){if(window.HTMLElement&&window.HTMLElement._babelES5Adapter||void 0===window.Reflect||void 0===window.customElements||window.customElements.hasOwnProperty('polyfillWrapFlushCallback'))return;const b=HTMLElement;window.HTMLElement=function(){return Reflect.construct(b,[],this.constructor)},HTMLElement.prototype=b.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,b),HTMLElement._babelES5Adapter=!0}function e(a,{shadow:b}){if(b&&a.attachShadow){const b=document.createElement('span');return a.attachShadow({mode:'open'}).appendChild(b),b}return a}function f(a,b,c){a.nodeName.toLowerCase()===b?(c.onUpdate(a,a),g(a,c),h(a,c)):a.children&&a.children.length&&i(a.children,(a)=>{f(a,b,c)})}function g(a,{onMount:b}){const c=new window.MutationObserver(a=>{i(a,(a)=>{const c=a.target;b(c,c)})});c.observe(a,{attributes:!0})}function h(a,{onUnmount:b}){const c=a.parentNode,d=new window.MutationObserver(e=>{i(e,(e)=>{i(e.removedNodes,(e)=>{a!==e||(d.disconnect(c),b(a,a))})})});d.observe(c,{childList:!0,subtree:!0})}function i(a,b){for(let c=0,d=a.length;c<d;c++)b(a[c])}function j(a){return!!(-1!==a.indexOf('-')&&a.match(/^[a-z][a-z0-9-]*$/))}function k({component:a,attributes:d},e,f){const g=b.createElement(a,f);c.render(g,e)}function l(a,b){c.unmountComponentAtNode(b)}function m(){if(void 0!==m._result)return m._result;const a=[p,r].reduce((a,b)=>a||b.isSupported()&&b,null);return a||console.warn('Remount: This browser doesn\'t support the MutationObserver API or the Custom Elements API. Including polyfills might fix this. Remount elements will not work. https://github.com/rstacruz/remount'),m._result=a,a}function n(a){return'object'==typeof a&&a.component?a:{component:a}}function o(a,b){const c=a.getAttribute('props-json');if(c)return JSON.parse(c);return(b||[]).reduce((b,c)=>(b[c]=a.getAttribute(c),b),{})}c=c&&c.hasOwnProperty('default')?c['default']:c;var p=Object.freeze({name:'CustomElements',defineElement:function(a,b,{onUpdate:c,onUnmount:f,onMount:g}){d();const h=a.attributes||[];class i extends window.HTMLElement{static get observedAttributes(){return['props-json',...h]}connectedCallback(){this._mountPoint=e(this,a),g(this,this._mountPoint)}disconnectedCallback(){this._mountPoint&&f(this,this._mountPoint)}attributeChangedCallback(){this._mountPoint&&c(this,this._mountPoint)}}a.quiet&&window.customElements.get(b)||window.customElements.define(b,i)},isSupported:function(){return window.customElements&&window.customElements.define},supportsShadow:function(){return!!(document&&document.body&&document.body.attachShadow)}});const q={};var r=Object.freeze({name:'MutationObserver',observers:q,isSupported:function(){return!!window.MutationObserver},defineElement:function(a,b,c){if(b=b.toLowerCase(),!j(b)){if(a.quiet)return;throw new Error(`Remount: "${b}" is not a valid custom element name`)}if(q[b]){if(a.quiet)return;throw new Error(`Remount: "${b}" is already registered`)}const d=new window.MutationObserver(a=>{i(a,(a)=>{i(a.addedNodes,(a)=>{f(a,b,c)})})});d.observe(document.body,{childList:!0,subtree:!0}),q[b]=!0},supportsShadow:function(){return!1}}),s=Object.freeze({mount:function(a,b,c){return k(a,b,c)},update:k,unmount:l});a.getStrategy=m,a.define=function(a,b){const c=m();c&&Object.keys(a).forEach((d)=>{const e=Object.assign({},b,n(a[d])),f=e.adapter||s;c.defineElement(e,d,{onMount(a,b){const c=o(a,e.attributes);f.mount(e,b,c)},onUpdate(a,b){const c=o(a,e.attributes);f.update(e,b,c)},onUnmount(a,b){f.unmount(e,b)}})})},Object.defineProperty(a,'__esModule',{value:!0})});
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?b(exports,require('react'),require('react-dom')):'function'==typeof define&&define.amd?define(['exports','react','react-dom'],b):b(a.Remount={},a.React,a.ReactDOM)})(this,function(a,b,c){'use strict';function d(){if(window.HTMLElement&&window.HTMLElement._babelES5Adapter||void 0===window.Reflect||void 0===window.customElements||window.customElements.hasOwnProperty('polyfillWrapFlushCallback'))return;const b=HTMLElement;window.HTMLElement=function(){return Reflect.construct(b,[],this.constructor)},HTMLElement.prototype=b.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,b),HTMLElement._babelES5Adapter=!0}function e(a,{shadow:b}){if(b&&a.attachShadow){const b=document.createElement('span');return a.attachShadow({mode:'open'}).appendChild(b),b}return a}function f(a,b,c){a.nodeName.toLowerCase()===b?(c.onMount(a,a),g(a,c),h(a,c)):a.children&&a.children.length&&i(a.children,(a)=>{f(a,b,c)})}function g(a,{onUpdate:b}){const c=new window.MutationObserver(a=>{i(a,(a)=>{const c=a.target;b(c,c)})});c.observe(a,{attributes:!0})}function h(a,{onUnmount:b}){const c=a.parentNode,d=new window.MutationObserver(e=>{i(e,(e)=>{i(e.removedNodes,(e)=>{a!==e||(d.disconnect(c),b(a,a))})})});d.observe(c,{childList:!0,subtree:!0})}function i(a,b){for(let c=0,d=a.length;c<d;c++)b(a[c])}function j(a){return!!(-1!==a.indexOf('-')&&a.match(/^[a-z][a-z0-9-]*$/))}function k({component:a,attributes:d},e,f){const g=b.createElement(a,f);c.render(g,e)}function l(a,b){c.unmountComponentAtNode(b)}function m(){if(void 0!==m._result)return m._result;const a=[p,r].reduce((a,b)=>a||b.isSupported()&&b,null);return a||console.warn('Remount: This browser doesn\'t support the MutationObserver API or the Custom Elements API. Including polyfills might fix this. Remount elements will not work. https://github.com/rstacruz/remount'),m._result=a,a}function n(a){return'object'==typeof a&&a.component?a:{component:a}}function o(a,b){const c=a.getAttribute('props-json');if(c)return JSON.parse(c);return(b||[]).reduce((b,c)=>(b[c]=a.getAttribute(c),b),{})}c=c&&c.hasOwnProperty('default')?c['default']:c;var p=Object.freeze({name:'CustomElements',defineElement:function(a,b,{onUpdate:c,onUnmount:f,onMount:g}){d();const h=a.attributes||[];class i extends window.HTMLElement{static get observedAttributes(){return['props-json',...h]}connectedCallback(){this._mountPoint=e(this,a),g(this,this._mountPoint)}disconnectedCallback(){this._mountPoint&&f(this,this._mountPoint)}attributeChangedCallback(){this._mountPoint&&c(this,this._mountPoint)}}a.quiet&&window.customElements.get(b)||window.customElements.define(b,i)},isSupported:function(){return window.customElements&&window.customElements.define},supportsShadow:function(){return!!(document&&document.body&&document.body.attachShadow)}});const q={};var r=Object.freeze({name:'MutationObserver',observers:q,isSupported:function(){return!!window.MutationObserver},defineElement:function(a,b,c){if(b=b.toLowerCase(),!j(b)){if(a.quiet)return;throw new Error(`Remount: "${b}" is not a valid custom element name`)}if(q[b]){if(a.quiet)return;throw new Error(`Remount: "${b}" is already registered`)}const d=new window.MutationObserver(a=>{i(a,(a)=>{i(a.addedNodes,(a)=>{f(a,b,c)})})});d.observe(document.body,{childList:!0,subtree:!0}),q[b]=!0},supportsShadow:function(){return!1}}),s=Object.freeze({mount:function(a,b,c){return k(a,b,c)},update:k,unmount:l});a.getStrategy=m,a.define=function(a,b){const c=m();c&&Object.keys(a).forEach((d)=>{const e=Object.assign({},b,n(a[d])),f=e.adapter||s;c.defineElement(e,d,{onMount(a,b){const c=o(a,e.attributes);f.mount(e,b,c)},onUpdate(a,b){const c=o(a,e.attributes);f.update(e,b,c)},onUnmount(a,b){f.unmount(e,b)}})})},Object.defineProperty(a,'__esModule',{value:!0})});
{
"name": "remount",
"description": "Mount React components to the DOM using custom elements",
"version": "0.9.1",
"version": "0.9.2",
"author": "Rico Sta. Cruz <rstacruz@users.noreply.github.com>",

@@ -6,0 +6,0 @@ "bugs": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc