PHP 8.2.30
Preview: applyStyles.js Size: 2.47 KB
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/@popperjs/core/lib/modifiers/applyStyles.js

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']
};

Directory Contents

Dirs: 0 × Files: 30

Name Size Perms Modified Actions
183 B lrw-r--r-- 2026-02-28 00:30:24
Edit Download
2.47 KB lrw-r--r-- 2026-02-28 00:30:26
Edit Download
2.66 KB lrw-r--r-- 2026-02-28 00:30:26
Edit Download
435 B lrw-r--r-- 2026-02-28 00:30:26
Edit Download
3.34 KB lrw-r--r-- 2026-02-28 00:30:28
Edit Download
3.57 KB lrw-r--r-- 2026-02-28 00:30:28
Edit Download
1.18 KB lrw-r--r-- 2026-02-28 00:30:28
Edit Download
5.58 KB lrw-r--r-- 2026-02-28 00:30:28
Edit Download
5.80 KB lrw-r--r-- 2026-02-28 00:30:28
Edit Download
274 B lrw-r--r-- 2026-02-28 00:30:28
Edit Download
1.30 KB lrw-r--r-- 2026-02-28 00:30:28
Edit Download
1.31 KB lrw-r--r-- 2026-02-28 00:30:30
Edit Download
543 B lrw-r--r-- 2026-02-28 00:30:30
Edit Download
4.79 KB lrw-r--r-- 2026-02-28 00:30:30
Edit Download
4.78 KB lrw-r--r-- 2026-02-28 00:30:30
Edit Download
162 B lrw-r--r-- 2026-02-28 00:30:30
Edit Download
1.91 KB lrw-r--r-- 2026-02-28 00:30:30
Edit Download
1.99 KB lrw-r--r-- 2026-02-28 00:30:32
Edit Download
476 B lrw-r--r-- 2026-02-28 00:30:32
Edit Download
502 B lrw-r--r-- 2026-02-28 00:30:32
Edit Download
485 B lrw-r--r-- 2026-02-28 00:30:32
Edit Download
703 B lrw-r--r-- 2026-02-28 00:30:34
Edit Download
1.58 KB lrw-r--r-- 2026-02-28 00:30:34
Edit Download
1.89 KB lrw-r--r-- 2026-02-28 00:30:34
Edit Download
189 B lrw-r--r-- 2026-02-28 00:30:34
Edit Download
706 B lrw-r--r-- 2026-02-28 00:30:34
Edit Download
855 B lrw-r--r-- 2026-02-28 00:30:34
Edit Download
862 B lrw-r--r-- 2026-02-28 00:30:36
Edit Download
6.43 KB lrw-r--r-- 2026-02-28 00:30:36
Edit Download
7.26 KB lrw-r--r-- 2026-02-28 00:30:38
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).