__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import getNodeName from "../dom-utils/getNodeName.js";
import { isHTMLElement } from "../dom-utils/instanceOf.js"; // This modifier takes the styles prepared by the `computeStyles` modifier
// and applies them to the HTMLElements such as popper and arrow
function applyStyles(_ref) {
var state = _ref.state;
Object.keys(state.elements).forEach(function (name) {
var style = state.styles[name] || {};
var attributes = state.attributes[name] || {};
var element = state.elements[name];
// arrow is optional + virtual elements
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
}
// Flow doesn't support to extend this property, but it's the most
// effective way to apply styles to an HTMLElement
// $FlowFixMe[cannot-write]
Object.assign(element.style, style);
Object.keys(attributes).forEach(function (name) {
var value = attributes[name];
if (value === false) {
element.removeAttribute(name);
} else {
element.setAttribute(name, value === true ? '' : value);
}
});
});
}
function effect(_ref2) {
var state = _ref2.state;
var initialStyles = {
popper: {
position: state.options.strategy,
left: '0',
top: '0',
margin: '0'
},
arrow: {
position: 'absolute'
},
reference: {}
};
Object.assign(state.elements.popper.style, initialStyles.popper);
state.styles = initialStyles;
if (state.elements.arrow) {
Object.assign(state.elements.arrow.style, initialStyles.arrow);
}
return function () {
Object.keys(state.elements).forEach(function (name) {
var element = state.elements[name];
var attributes = state.attributes[name] || {};
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
// Set all values to an empty string to unset them
var style = styleProperties.reduce(function (style, property) {
style[property] = '';
return style;
}, {});
// arrow is optional + virtual elements
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
}
Object.assign(element.style, style);
Object.keys(attributes).forEach(function (attribute) {
element.removeAttribute(attribute);
});
});
};
}
// eslint-disable-next-line import/no-unused-modules
export default {
name: 'applyStyles',
enabled: true,
phase: 'write',
fn: applyStyles,
effect: effect,
requires: ['computeStyles']
};| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| applyStyles.d.ts | File | 175 B | 0644 |
|
| applyStyles.js | File | 2.48 KB | 0644 |
|
| arrow.d.ts | File | 419 B | 0644 |
|
| arrow.js | File | 3.83 KB | 0644 |
|
| computeStyles.d.ts | File | 1.17 KB | 0644 |
|
| computeStyles.js | File | 6.35 KB | 0644 |
|
| eventListeners.d.ts | File | 258 B | 0644 |
|
| eventListeners.js | File | 1.28 KB | 0644 |
|
| flip.d.ts | File | 527 B | 0644 |
|
| flip.js | File | 4.75 KB | 0644 |
|
| hide.d.ts | File | 154 B | 0644 |
|
| hide.js | File | 1.9 KB | 0644 |
|
| index.d.ts | File | 476 B | 0644 |
|
| index.js | File | 502 B | 0644 |
|
| offset.d.ts | File | 671 B | 0644 |
|
| offset.js | File | 1.56 KB | 0644 |
|
| popperOffsets.d.ts | File | 181 B | 0644 |
|
| popperOffsets.js | File | 703 B | 0644 |
|
| preventOverflow.d.ts | File | 838 B | 0644 |
|
| preventOverflow.js | File | 6.4 KB | 0644 |
|