Sha256: 063754a381a05d730b83315393111bb9cc1cee78db672a271cf6f4b88d48c44f

Contents?: true

Size: 968 Bytes

Versions: 25

Compression:

Stored size: 968 Bytes

Contents

import { followCursor } from "@assets/js/base/tippy";

export default function tippyModifiers(modifiers) {
  if (modifiers.length === 0) return {};

  const config = {
    plugins: [],
  };

  const getModifierArgument = (modifier) => {
    return modifiers[modifiers.indexOf(modifier) + 1];
  };

  if (modifiers.includes("duration")) {
    config.duration = parseInt(getModifierArgument("duration"));
  }

  if (modifiers.includes("delay")) {
    const delay = getModifierArgument("delay");

    config.delay = delay.includes("-")
      ? delay.split("-").map((n) => parseInt(n))
      : parseInt(delay);
  }

  if (modifiers.includes("debounce") && config.interactive) {
    config.interactiveDebounce = parseInt(getModifierArgument("debounce"));
  }

  if (modifiers.includes("theme")) {
    config.theme = getModifierArgument("theme");
  }

  if (modifiers.includes("placement")) {
    config.placement = getModifierArgument("placement");
  }

  return config;
}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
coveragebook_components-0.19.8 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.19.7 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.19.6 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.19.5 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.19.4 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.19.3 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.19.2 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.19.1 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.19.0 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.18.8 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.18.7 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.18.0 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.17.7 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.17.6 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.17.5 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.17.4 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.17.3 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.17.2 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.17.1 app/assets/js/base/alpine/utils/tippy_modifiers.js
coveragebook_components-0.17.0 app/assets/js/base/alpine/utils/tippy_modifiers.js