Sha256: e150b2680eeaac820f05e970f4970b6f776d6d15daad78616862abbce9ba5a9e

Contents?: true

Size: 968 Bytes

Versions: 48

Compression:

Stored size: 968 Bytes

Contents

import { followCursor } from "@assets/js/libs/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

48 entries across 48 versions & 1 rubygems

Version Path
coveragebook_components-0.12.2 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.12.1 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.12.0 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.11.0 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.10.1.beta.2 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.10.1.beta.1 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.10.1.beta.0 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.10.0 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.9.1 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.9.0 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.8.9 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.8.8 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.8.7 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.8.6 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.8.5 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.8.4 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.8.3 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.8.2 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.8.1 app/assets/js/libs/alpine/utils/tippy_modifiers.js
coveragebook_components-0.8.0 app/assets/js/libs/alpine/utils/tippy_modifiers.js