html-squircle
Version:
Utilities for generating superellipse squircles in the form of SVG strings, to be used in clip-path and background inline styles.
20 lines • 600 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import * as React from "react";
import { LRUCache } from "../utils/LRUCache.js";
const CacheContext = /*#__PURE__*/React.createContext(null);
export const useCache = () => React.useContext(CacheContext);
/**
* Optional cache provider component for enabling global caching of computed
* squircle values.
*/
export const CacheProvider = ({
capacity = 20,
children
}) => {
const [cache] = React.useState(() => new LRUCache(capacity));
cache.setCapacity(capacity);
return _jsx(CacheContext, {
value: cache,
children: children
});
};