From d69f1418e8eafc69d5f1629cbe44675d68e58cfb Mon Sep 17 00:00:00 2001 From: cha0s Date: Sat, 13 Feb 2021 10:23:25 -0600 Subject: [PATCH] refactor: position --- packages/entity/src/traits/dom-node.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/entity/src/traits/dom-node.js b/packages/entity/src/traits/dom-node.js index 1e3c749..00764be 100644 --- a/packages/entity/src/traits/dom-node.js +++ b/packages/entity/src/traits/dom-node.js @@ -15,6 +15,14 @@ export default () => class DomNode extends decorate(Trait) { #scheduledRuleApplication = true; + static defaultParams() { + return { + style: { + position: 'absolute', + }, + }; + } + static defaultState() { return { parentNode: null, @@ -82,7 +90,9 @@ export default () => class DomNode extends decorate(Trait) { await super.load(json); if ('client' === process.env.SIDE) { this.entity.node = window.document.createElement('entity'); - this.entity.node.style.position = 'absolute'; + Object.entries(this.params.style).forEach(([key, value]) => { + this.entity.node.style[key] = value; + }); this.applyStyleRules(); } }