@cicada/render
Advanced tools
Comparing version 1.1.3-alpha to 1.1.3-alpha1
@@ -96,3 +96,5 @@ 'use strict'; | ||
function updateAppearanceRef(id) { | ||
var ref = refCache[id]; | ||
var _ref = refCache[id] || {}, | ||
ref = _ref.ref; | ||
if (!ref) return; | ||
@@ -109,5 +111,21 @@ var _appearance$id = appearance[id], | ||
if (className) ref.className = className; | ||
if (children !== undefined) ref.innerHTML = children; | ||
if (children !== undefined) { | ||
refCache[id].children = ref.innerHTML; | ||
ref.innerHTML = children; | ||
} | ||
} | ||
function clearAppearanceRef(id) { | ||
var _ref2 = refCache[id] || {}, | ||
ref = _ref2.ref, | ||
children = _ref2.children; | ||
if (!ref) return; | ||
if (ref.className) ref.className = ref.className.split(/\s+/).filter(function (cls) { | ||
return cls && !prefixReg.test(cls); | ||
}).join(' '); | ||
if (children) ref.innerHTML = children; | ||
delete refCache[id]; | ||
} | ||
function injectExternalListenerArg(id, listener, props) { | ||
@@ -129,8 +147,8 @@ return function () { | ||
function updateRefById(id, ref) { | ||
clearAppearanceRef(id); | ||
ref = _reactDom2.default.findDOMNode(ref); | ||
if (!ref || !ref.classList) { | ||
delete refCache[id]; | ||
return; | ||
} | ||
refCache[id] = ref; | ||
refCache[id] = { ref: ref }; | ||
updateAppearanceRef(id); | ||
@@ -183,6 +201,6 @@ } | ||
return { | ||
register: function register(id, _ref, fn) { | ||
var componentPath = _ref.path, | ||
_ref$visible = _ref.visible, | ||
visible = _ref$visible === undefined ? true : _ref$visible; | ||
register: function register(id, _ref3, fn) { | ||
var componentPath = _ref3.path, | ||
_ref3$visible = _ref3.visible, | ||
visible = _ref3$visible === undefined ? true : _ref3$visible; | ||
@@ -202,3 +220,3 @@ var unsubscribe = (0, _util.concat)([subscribeById(id, fn), subscribeById(id, (0, _util.partial)(updateAppearanceRef, id))]); | ||
delete appearance[id]; | ||
delete refCache[id]; | ||
clearAppearanceRef(id); | ||
if (componentPathKey !== undefined) { | ||
@@ -205,0 +223,0 @@ stateIdByComponentPath.remove(componentPathKey, id); |
{ | ||
"name": "@cicada/render", | ||
"version": "1.1.3-alpha", | ||
"version": "1.1.3-alpha1", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
338308
8145
1