12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- 'use strict';
- Object.defineProperty(exports, '__esModule', { value: true });
- var core = require('@vueuse/core');
- const buildPopperOptions = (props, arrowProps) => {
- const { placement, strategy, popperOptions } = props;
- const options = {
- placement,
- strategy,
- ...popperOptions,
- modifiers: genModifiers(props)
- };
- attachArrow(options, arrowProps);
- deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
- return options;
- };
- const unwrapMeasurableEl = ($el) => {
- if (!core.isClient)
- return;
- return core.unrefElement($el);
- };
- function genModifiers(options) {
- const { offset, gpuAcceleration, fallbackPlacements } = options;
- return [
- {
- name: "offset",
- options: {
- offset: [0, offset != null ? offset : 12]
- }
- },
- {
- name: "preventOverflow",
- options: {
- padding: {
- top: 2,
- bottom: 2,
- left: 5,
- right: 5
- }
- }
- },
- {
- name: "flip",
- options: {
- padding: 5,
- fallbackPlacements
- }
- },
- {
- name: "computeStyles",
- options: {
- gpuAcceleration
- }
- }
- ];
- }
- function attachArrow(options, { arrowEl, arrowOffset }) {
- options.modifiers.push({
- name: "arrow",
- options: {
- element: arrowEl,
- padding: arrowOffset != null ? arrowOffset : 5
- }
- });
- }
- function deriveExtraModifiers(options, modifiers) {
- if (modifiers) {
- options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
- }
- }
- exports.buildPopperOptions = buildPopperOptions;
- exports.unwrapMeasurableEl = unwrapMeasurableEl;
- //# sourceMappingURL=utils.js.map
|