87fa0f9f75178067b4f6eda7b06e6a816abcf9c4477c719e3b7513c94269604309e065c7bb3112f990210dc60e1be8567e9ebbe665eae4bd739457deca7be3 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var core = require('@vueuse/core');
  4. const buildPopperOptions = (props, modifiers = []) => {
  5. const { placement, strategy, popperOptions } = props;
  6. const options = {
  7. placement,
  8. strategy,
  9. ...popperOptions,
  10. modifiers: [...genModifiers(props), ...modifiers]
  11. };
  12. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  13. return options;
  14. };
  15. const unwrapMeasurableEl = ($el) => {
  16. if (!core.isClient)
  17. return;
  18. return core.unrefElement($el);
  19. };
  20. function genModifiers(options) {
  21. const { offset, gpuAcceleration, fallbackPlacements } = options;
  22. return [
  23. {
  24. name: "offset",
  25. options: {
  26. offset: [0, offset != null ? offset : 12]
  27. }
  28. },
  29. {
  30. name: "preventOverflow",
  31. options: {
  32. padding: {
  33. top: 0,
  34. bottom: 0,
  35. left: 0,
  36. right: 0
  37. }
  38. }
  39. },
  40. {
  41. name: "flip",
  42. options: {
  43. padding: 5,
  44. fallbackPlacements
  45. }
  46. },
  47. {
  48. name: "computeStyles",
  49. options: {
  50. gpuAcceleration
  51. }
  52. }
  53. ];
  54. }
  55. function deriveExtraModifiers(options, modifiers) {
  56. if (modifiers) {
  57. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  58. }
  59. }
  60. exports.buildPopperOptions = buildPopperOptions;
  61. exports.unwrapMeasurableEl = unwrapMeasurableEl;
  62. //# sourceMappingURL=utils.js.map