How to use the fela-utils.generateCSSSelector function in fela-utils

To help you get started, we’ve selected a few fela-utils 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 robinweser / fela / packages / fela-monolithic / src / index.js View on Github external
)
          } else {
            // TODO: warning
          }
        } else if (!isUndefinedValue(value)) {
          ruleset[property] = value
        }

        return ruleset
      },
      {}
    )

    if (Object.keys(ruleSet).length > 0) {
      const css = cssifyObject(ruleSet)
      const selector = generateCSSSelector(className, pseudo)

      const change = {
        type: RULE_TYPE,
        className,
        selector,
        declaration: css,
        media,
      }

      const declarationReference = selector + media + support
      renderer.cache[declarationReference] = change
      renderer._emitChange(change)
    }
  }
github robinweser / fela / packages / fela / src / createRenderer.js View on Github external
className: '',
              }
              /* eslint-disable no-continue */
              continue
              /* eslint-enable */
            }

            const className =
              renderer.selectorPrefix +
              generateClassName(
                renderer.getNextRuleIdentifier,
                renderer.filterClassName
              )

            const declaration = cssifyDeclaration(property, value)
            const selector = generateCSSSelector(className, pseudo)

            const change = {
              type: RULE_TYPE,
              className,
              selector,
              declaration,
              pseudo,
              media,
              support,
            }

            renderer.cache[declarationReference] = change
            renderer._emitChange(change)
          }

          const cachedClassName = renderer.cache[declarationReference].className
github robinweser / fela / packages / fela-dom / src / dom / rehydration / generateCacheEntry.js View on Github external
export default function generateCacheEntry(
  type: StyleType,
  className: string,
  property: string,
  value: any,
  pseudo?: string = '',
  media?: string = '',
  support?: string = ''
): Object {
  return {
    type,
    className,
    selector: generateCSSSelector(className, pseudo),
    declaration: property + ':' + value,
    pseudo,
    media,
    support,
  }
}