How to use the @remirror/core-helpers.clamp function in @remirror/core-helpers

To help you get started, we’ve selected a few @remirror/core-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifiokjr / remirror / packages / multishift / src / multishift-utils.ts View on Github external
export const getHighlightedIndexes = ({
  start,
  end,
  indexes,
  items,
  hoveredIndex,
}: GetHighlightedIndexesParams) => {
  const max = items.length - 1;
  const groupIndexes = isValidIndex(start)
    ? range(
        clamp({ min: 0, max, value: start }),
        clamp({ min: 0, max, value: isValidIndex(end) ? end : start }),
      )
    : [];

  const hoveredIndexes = isValidIndex(hoveredIndex) ? [hoveredIndex] : [];

  return uniqueArray([...hoveredIndexes, ...indexes, ...groupIndexes], true);
};
github ifiokjr / remirror / packages / multishift / src / multishift-utils.ts View on Github external
export const getHighlightedIndexes = ({
  start,
  end,
  indexes,
  items,
  hoveredIndex,
}: GetHighlightedIndexesParams) => {
  const max = items.length - 1;
  const groupIndexes = isValidIndex(start)
    ? range(
        clamp({ min: 0, max, value: start }),
        clamp({ min: 0, max, value: isValidIndex(end) ? end : start }),
      )
    : [];

  const hoveredIndexes = isValidIndex(hoveredIndex) ? [hoveredIndex] : [];

  return uniqueArray([...hoveredIndexes, ...indexes, ...groupIndexes], true);
};
github ifiokjr / remirror / @remirror / ui / src / ui-hsl.ts View on Github external
public rectangle(spacing = 60): [HSL, HSL, HSL, HSL] {
    spacing = clamp({ min: 0, max: 180, value: spacing });
    return [this, this.rotate(spacing), this.rotate(180), this.rotate(180 + spacing)];
  }