How to use the stylefire function in stylefire

To help you get started, we’ve selected a few stylefire 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 framer / motion / src / motion / functionality / layout.ts View on Github external
layoutSync.render(() => {
            // Reverse the layout delta of all newly laid-out layoutTransition components into their
            // prev visual state and then animate them into their new one using transforms.
            const prevLayout = compare.getLayout(prev)
            const nextLayout = compare.getLayout(next)
            const delta = calcDelta(prevLayout, nextLayout)
            const hasAnyChanged =
                delta.x || delta.y || delta.width || delta.height

            if (!hasAnyChanged) {
                // If layout hasn't changed, reapply the transform and get out of here.
                transform && (element.style.transform = transform)
                return
            }

            styler(element).set({
                originX: delta.originX,
                originY: delta.originY,
            })
            syncRenderSession.open()

            const target: TargetAndTransition = {}
            const transition: Transition = {}

            const transitionDefinition = isResolver(layoutTransition)
                ? layoutTransition({ delta })
                : layoutTransition

            function makeTransition(
                layoutKey: keyof Layout,
                transformKey: string,
                targetValue: number,
github framer / motion / src / motion / functionality / dom.tsx View on Github external
readValueFromSource: key =>
                    styler(ref.current as Element).get(key),
                // TODO: This is a good second source of plugins. This function contains the CSS variable
github framer / motion / src / motion / functionality / position.ts View on Github external
useLayoutEffect(() => {
        const target = getPosition()

        if (prev && target && hasMoved(prev, target)) {
            const delta = measureDelta(prev, target)

            const transitionDefinition = isResolver(positionTransition)
                ? positionTransition({ delta })
                : positionTransition

            const transition = createTransition(values, transitionDefinition)
            const x = transition("x", delta.x)
            const y = transition("y", delta.y)

            // Force a render now rather than waiting for the next render loop
            styler(ref.current as HTMLElement).render()

            if (transitionDefinition) {
                controls.start({ x: 0, y: 0, transition: { x, y } })
            }
        }
    })
}
github Popmotion / popmotion / packages / popmotion-pose / _src / index.js View on Github external
const pose = (element, props = {}) => {
  const elementStyler = styler(element, { preparseOutput: false });
  const poses = createPoses(props);
  const values = createValues({ poses, styler: elementStyler, ...props });
  const activeActions = new Map();
  const children = new Set();
  const dimensions = new Dimensions(element);
  const dragProps = props.draggable ? {
    bounds: props.dragBounds,
    onDragStart: props.onDragStart,
    onDragEnd: props.onDragEnd
  } : {};

  const set = createPoseSetter({
    element,
    elementStyler,
    poses,
    values,
github framer / motion / _src / utils / create-value.ts View on Github external
export const bindValuesToRef = (
    values: MotionValueMap,
    ref: RefObject<element>
) =&gt; {
    invariant(
        ref.current !== null,
        "No DOM reference found. Ensure custom components use `forwardRef` to forward the `ref` property to the host DOM component."
    )

    if (!ref.current) return

    const domStyler = styler(ref.current, { preparseOutput: false })

    values.forEach((value, key) =&gt; {
        if (!value.hasOnRender()) {
            value.setOnRender((v: any) =&gt; domStyler.set(key, v))
        }
    })
}
</element>
github Popmotion / popmotion / packages / popmotion / src / reactions / style.ts View on Github external
const createStyler = (node: HTMLElement | (SVGGraphicsElement & SVGPathElement)): Styler => styler(node);
github souporserious / react-measure / example / components / Collapse.js View on Github external
setRef = node => {
    if (node) {
      this.nodeStyler = styler(node)
      this.nodeStyler
        .set({
          width: this.props.width,
          height: this.props.height,
        })
        .render()
    }
  }
github framer / motion / src / motion / utils / Mount.tsx View on Github external
useEffect(() => {
        invariant(
            ref.current instanceof Element,
            "No `ref` found. Ensure components created with `motion.custom` forward refs using `React.forwardRef`"
        )

        const domStyler = styler(ref.current as Element, {
            preparseOutput: false,
            enableHardwareAcceleration: !isStatic,
        })

        values.mount((key, value) => {
            domStyler.set(key, value)

            if (syncRenderSession.isOpen()) {
                syncRenderSession.push(domStyler)
            }
        })

        return () => values.unmount()
    }, [])
github Popmotion / popmotion / playground / pointer.js View on Github external
setRef = dom => {
    if (!dom) return;
    this.box = styler(dom);
    this.x = value(0, v => this.box.set('x', v));
  };
github Popmotion / popmotion / packages / popmotion / src / index.ts View on Github external
const svg = (element: HTMLElement, props: Object): Styler => {
  warning(false, 'svg() is deprecated, use styler instead');
  return styler(element, props);
};
export { styler, css, svg };

stylefire

Performant, simplified stylers for CSS, SVG, path and DOM scroll.

MIT
Latest version published 5 years ago

Package Health Score

61 / 100
Full package analysis