How to use the inline-style-prefixer.prefix function in inline-style-prefixer

To help you get started, we’ve selected a few inline-style-prefixer 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 segmentio / ui-box / src / prefixer.ts View on Github external
export default function prefixer(property: string, value: string): Rule[] {
  const rules = prefix({[property]: value})
  const rulesArray: Rule[] = []
  const propertyNames = Object.keys(rules)

  // Convert rules object to an array
  for (let i = 0; i < propertyNames.length; i++) {
    const propertyName = propertyNames[i]
    // Add a dash in front of the prefixes
    const prefixedProp = propertyName.match(prefixRegex)
      ? `-${propertyName}`
      : propertyName
    const prop = decamelize(prefixedProp)
    const values = rules[propertyName]

    // Handle prefixed values
    if (Array.isArray(values)) {
      for (let j = 0; j < values.length; j++) {
github styletron / styletron / packages / styletron-engine-atomic / src / inject-style-prefixed.js View on Github external
validateValueType(originalVal, originalKey);
      }

      const propValPair = `${hyphenate(
        originalKey,
      )}:${((originalVal: any): string)}`;
      const key = `${pseudo}${propValPair}`;
      const cachedId = cache.cache[key];
      if (cachedId !== void 0) {
        // cache hit
        classString += " " + cachedId;
        continue;
      } else {
        // cache miss
        let block = "";
        const prefixed = prefix({[originalKey]: originalVal});
        for (const prefixedKey in prefixed) {
          const prefixedVal = prefixed[prefixedKey];
          const prefixedValType = typeof prefixedVal;
          if (prefixedValType === "string" || prefixedValType === "number") {
            const prefixedPair = `${hyphenate(prefixedKey)}:${prefixedVal}`;
            if (prefixedPair !== propValPair) {
              block += `${prefixedPair};`;
            }
          } else if (Array.isArray(prefixedVal)) {
            const hyphenated = hyphenate(prefixedKey);
            for (let i = 0; i < prefixedVal.length; i++) {
              const prefixedPair = `${hyphenated}:${prefixedVal[i]}`;
              if (prefixedPair !== propValPair) {
                block += `${prefixedPair};`;
              }
            }
github kalohq / ui / src / components / layout / utils.js View on Github external
render() {
      const {
        component: Component = DefaultComponent,
        elRef,
        style: propStyle,
        className,
        ...otherProps
      } = this.props;

      const {props, style} = parseStyleProps({
        ...otherProps,
      });

      const cleanedProps = cleanProps(props);
      const inlineStyle = prefix({...style, ...propStyle});

      return (
        
      );
    }
  }
github art-software / art-core / packages / art-lib-react / dist / components / pull-to-refresh / pull-to-refresh.jsx View on Github external
getRenderProps() {
        const { height, distance, ptrVisibility, refresh, loading, reset } = this.localState;
        const { pullTxt, releaseTxt, loadingTxt } = this.props;
        const { barProps, rate } = this.getProgressbarProps();
        const ptrTranslate = this.getTransformStyle(0, distance - height);
        const contentTranslate = this.getTransformStyle(0, distance);
        const vPullToRefresh = this.applyArgs('pull-to-refresh', this.classNames({ refresh, loading, reset }));
        const ptrStyle = prefix({
            transform: ptrTranslate,
            WebkitTransform: ptrTranslate,
            visibility: ptrVisibility
        });
        const contentStyle = prefix({
            transform: contentTranslate,
            WebkitTransform: contentTranslate
        });
        return {
            ptrStyle,
            contentStyle,
            vPullToRefresh,
            barProps,
            rate,
            refresh,
            pullTxt,
github giuseppeg / style-sheet / src / compile.js View on Github external
}
      default: {
        const cacheKey = key + value + descendants + media
        const cached = cache[cacheKey]
        if (cached) {
          Object.assign(rules, cached)
          break
        }
        let className = createClassName(key, value, descendants, media)
        if (rules[className]) {
          break
        }
        if (!unitless[key]) {
          value = normalizeValue(value)
        }
        const declaration = prefix({ [key]: value })
        let rule = createRule(className, declaration, descendants, media)

        if (opts.i18n) {
          const originalProp = key
          const originalValue = value
          key = toI18n(i18n.properties, originalProp)
          value = toI18n(i18n.values, originalValue)
          if (key !== null || value !== null) {
            key = key || originalProp
            value = value || originalValue
            const i18nClassName = createClassName(
              key,
              value,
              descendants,
              media
            )
github art-software / art-core / packages / art-lib-react / dist / components / pull-to-refresh / pull-to-refresh.jsx View on Github external
getRenderProps() {
        const { height, distance, ptrVisibility, refresh, loading, reset } = this.localState;
        const { pullTxt, releaseTxt, loadingTxt } = this.props;
        const { barProps, rate } = this.getProgressbarProps();
        const ptrTranslate = this.getTransformStyle(0, distance - height);
        const contentTranslate = this.getTransformStyle(0, distance);
        const vPullToRefresh = this.applyArgs('pull-to-refresh', this.classNames({ refresh, loading, reset }));
        const ptrStyle = prefix({
            transform: ptrTranslate,
            WebkitTransform: ptrTranslate,
            visibility: ptrVisibility
        });
        const contentStyle = prefix({
            transform: contentTranslate,
            WebkitTransform: contentTranslate
        });
        return {
            ptrStyle,
            contentStyle,
            vPullToRefresh,
            barProps,
            rate,
            refresh,
            pullTxt,
            releaseTxt,
            loadingTxt
        };
    }
    render() {
github art-software / art-core / packages / art-lib-react / dist / components / news-ticker / news-ticker.jsx View on Github external
constructor(props, context) {
        super(props, context);
        this.running = false;
        this.needUpdateItemSource = null;
        this.state = {
            items: [],
            start: false,
            style: prefix({ transform: this.getTransformStyle(0, 0) })
        };
        this.handleStep = (delta) => {
            const itemHeight = parseFloat(this.getItemHeight());
            const itemsOneRolling = this.props.itemsOneRolling;
            this.setState({
                style: prefix({
                    transform: this.getTransformStyle(0, -delta * itemHeight * itemsOneRolling)
                })
            });
        };
        this.handleDelta = (progress) => {
            const easing = this.props.easing;
            return easing(progress);
        };
        this.handleComplete = () => {
            this.running = false;
github art-software / art-core / packages / art-lib-react / dist / components / news-ticker / news-ticker.jsx View on Github external
this.handleComplete = () => {
            this.running = false;
            if (this.needUpdateItemSource !== null) {
                const items = this.convertItems(this.needUpdateItemSource || []);
                this.needUpdateItemSource = null;
                this.setState({
                    start: false,
                    style: prefix({ transform: this.getTransformStyle(0, 0) }),
                    items
                }, this.startAnimation);
            }
            else {
                const items = this.getNewSortedItems(this.state.items);
                this.setState({
                    start: false,
                    style: prefix({ transform: this.getTransformStyle(0, 0) }),
                    items
                }, this.startAnimation);
            }
        };
        this.startAnimation = () => {
github art-software / art-core / packages / art-lib-react / src / components / pull-to-refresh / pull-to-refresh.tsx View on Github external
private getRenderProps() {
    const { height, distance, ptrVisibility, refresh, loading, reset } = this.localState;
    const { pullTxt, releaseTxt, loadingTxt } = this.props;
    const { barProps, rate } = this.getProgressbarProps();
    const ptrTranslate = this.getTransformStyle(0, distance - height);
    const contentTranslate = this.getTransformStyle(0, distance);
    const vPullToRefresh = this.applyArgs('pull-to-refresh', this.classNames({ refresh, loading, reset }));

    const ptrStyle = prefix({
      transform: ptrTranslate,
      WebkitTransform: ptrTranslate,
      visibility: ptrVisibility
    });

    const contentStyle = prefix({
      transform: contentTranslate,
      WebkitTransform: contentTranslate
    });

    return {
      ptrStyle,
      contentStyle,
      vPullToRefresh,
      barProps,
      rate,