code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
createCSSMediaRule = (/** @type {string} */ sourceCssText, type) => { return /** @type {CSSMediaRule} */ ({ type, cssRules: [], insertRule(cssText, index) { this.cssRules.splice(index, 0, createCSSMediaRule(cssText, { import: 3, undefined: 1 }[(cssText.toLowerCase().match(/^...
@type {GroupName} Name of the group.
createCSSMediaRule
javascript
stitchesjs/stitches
packages/core/src/sheet.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/sheet.js
MIT
walk = ( /** @type {Style} Set of CSS styles */ style, /** @type {string[]} Selectors that define the elements to which a set of CSS styles apply. */ selectors, /** @type {string[]} Conditions that define the queries to which a set of CSS styles apply. */ conditions, ) => { /** @type {keyof style} Represents t...
Walks CSS styles and converts them into CSSOM-compatible rules.
walk
javascript
stitchesjs/stitches
packages/core/src/convert/toCssRules.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toCssRules.js
MIT
walk = ( /** @type {Style} Set of CSS styles */ style, /** @type {string[]} Selectors that define the elements to which a set of CSS styles apply. */ selectors, /** @type {string[]} Conditions that define the queries to which a set of CSS styles apply. */ conditions, ) => { /** @type {keyof style} Represents t...
Walks CSS styles and converts them into CSSOM-compatible rules.
walk
javascript
stitchesjs/stitches
packages/core/src/convert/toCssRules.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toCssRules.js
MIT
each = (style) => { for (name in style) { /** Whether the current name represents an at-rule. */ const isAtRuleLike = name.charCodeAt(0) === 64 const datas = isAtRuleLike && Array.isArray(style[name]) ? style[name] : [style[name]] for (data of datas) { const camelName = toCamelCase(name) ...
@type {style[keyof style]} Represents the right-side "data" for the property (the rule block, or declaration value).
each
javascript
stitchesjs/stitches
packages/core/src/convert/toCssRules.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toCssRules.js
MIT
each = (style) => { for (name in style) { /** Whether the current name represents an at-rule. */ const isAtRuleLike = name.charCodeAt(0) === 64 const datas = isAtRuleLike && Array.isArray(style[name]) ? style[name] : [style[name]] for (data of datas) { const camelName = toCamelCase(name) ...
@type {style[keyof style]} Represents the right-side "data" for the property (the rule block, or declaration value).
each
javascript
stitchesjs/stitches
packages/core/src/convert/toCssRules.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toCssRules.js
MIT
toCssString = (declarations, selectors, conditions) => ( `${conditions.map((condition) => `${condition}{`).join('')}${selectors.length ? `${selectors.join(',')}{` : ''}${declarations.join(';')}${selectors.length ? `}` : ''}${Array(conditions.length ? conditions.length + 1 : 0).join('}')}` )
CSS right-hand side value, which may be a specially-formatted custom property.
toCssString
javascript
stitchesjs/stitches
packages/core/src/convert/toCssRules.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toCssRules.js
MIT
toCssString = (declarations, selectors, conditions) => ( `${conditions.map((condition) => `${condition}{`).join('')}${selectors.length ? `${selectors.join(',')}{` : ''}${declarations.join(';')}${selectors.length ? `}` : ''}${Array(conditions.length ? conditions.length + 1 : 0).join('}')}` )
CSS right-hand side value, which may be a specially-formatted custom property.
toCssString
javascript
stitchesjs/stitches
packages/core/src/convert/toCssRules.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toCssRules.js
MIT
toHyphenCase = (/** @type {string} */ value) => ( // ignore kebab-like values value.includes('-') ? value // replace any upper-case letter with a dash and the lower-case variant : value.replace(/[A-Z]/g, (capital) => '-' + capital.toLowerCase()) )
Returns the given value converted to kebab-case.
toHyphenCase
javascript
stitchesjs/stitches
packages/core/src/convert/toHyphenCase.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toHyphenCase.js
MIT
toHyphenCase = (/** @type {string} */ value) => ( // ignore kebab-like values value.includes('-') ? value // replace any upper-case letter with a dash and the lower-case variant : value.replace(/[A-Z]/g, (capital) => '-' + capital.toLowerCase()) )
Returns the given value converted to kebab-case.
toHyphenCase
javascript
stitchesjs/stitches
packages/core/src/convert/toHyphenCase.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toHyphenCase.js
MIT
toResolvedMediaQueryRanges = ( /** @type {string} */ media ) => media.replace( /\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g, ( __, /** @type {string} 1st param, either the name or value in the query. */ p1, /** @type {string} 1st operator. */ o1, /** @type {string} 2nd ...
Returns a media query with polyfilled ranges.
toResolvedMediaQueryRanges
javascript
stitchesjs/stitches
packages/core/src/convert/toResolvedMediaQueryRanges.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toResolvedMediaQueryRanges.js
MIT
toResolvedMediaQueryRanges = ( /** @type {string} */ media ) => media.replace( /\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g, ( __, /** @type {string} 1st param, either the name or value in the query. */ p1, /** @type {string} 1st operator. */ o1, /** @type {string} 2nd ...
Returns a media query with polyfilled ranges.
toResolvedMediaQueryRanges
javascript
stitchesjs/stitches
packages/core/src/convert/toResolvedMediaQueryRanges.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toResolvedMediaQueryRanges.js
MIT
toResolvedSelectors = ( /** @type {string[]} Parent selectors (e.g. `["a", "button"]`). */ parentSelectors, /** @type {string[]} Nested selectors (e.g. `["&:hover", "&:focus"]`). */ nestedSelectors, ) => ( parentSelectors.length ? parentSelectors.reduce( (resolvedSelectors, parentSelector) => { resolvedSe...
Returns selectors resolved from parent selectors and nested selectors.
toResolvedSelectors
javascript
stitchesjs/stitches
packages/core/src/convert/toResolvedSelectors.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toResolvedSelectors.js
MIT
toResolvedSelectors = ( /** @type {string[]} Parent selectors (e.g. `["a", "button"]`). */ parentSelectors, /** @type {string[]} Nested selectors (e.g. `["&:hover", "&:focus"]`). */ nestedSelectors, ) => ( parentSelectors.length ? parentSelectors.reduce( (resolvedSelectors, parentSelector) => { resolvedSe...
Returns selectors resolved from parent selectors and nested selectors.
toResolvedSelectors
javascript
stitchesjs/stitches
packages/core/src/convert/toResolvedSelectors.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toResolvedSelectors.js
MIT
toSizingValue = (/** @type {string} */ declarationName, /** @type {string} */ declarationValue) => ( declarationName in sizeProps && typeof declarationValue === 'string' ? declarationValue.replace( /^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/, (data, lead, main, tail) => ( lead + ( main...
Returns a declaration sizing value with polyfilled sizing keywords.
toSizingValue
javascript
stitchesjs/stitches
packages/core/src/convert/toSizingValue.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toSizingValue.js
MIT
toSizingValue = (/** @type {string} */ declarationName, /** @type {string} */ declarationValue) => ( declarationName in sizeProps && typeof declarationValue === 'string' ? declarationValue.replace( /^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/, (data, lead, main, tail) => ( lead + ( main...
Returns a declaration sizing value with polyfilled sizing keywords.
toSizingValue
javascript
stitchesjs/stitches
packages/core/src/convert/toSizingValue.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toSizingValue.js
MIT
toTokenizedValue = ( /** @type {string} */ value, /** @type {string} */ prefix, /** @type {string} */ scale, ) => value.replace( /([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g, ($0, direction, multiplier, separator, token) => ( separator == "$" == !!multiplier ? $0 : ( direction...
Returns a declaration value with transformed token values.
toTokenizedValue
javascript
stitchesjs/stitches
packages/core/src/convert/toTokenizedValue.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toTokenizedValue.js
MIT
toTokenizedValue = ( /** @type {string} */ value, /** @type {string} */ prefix, /** @type {string} */ scale, ) => value.replace( /([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g, ($0, direction, multiplier, separator, token) => ( separator == "$" == !!multiplier ? $0 : ( direction...
Returns a declaration value with transformed token values.
toTokenizedValue
javascript
stitchesjs/stitches
packages/core/src/convert/toTokenizedValue.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/convert/toTokenizedValue.js
MIT
createCreateThemeFunction = ( config, sheet ) => ( createCreateThemeFunctionMap(config, () => (className, style) => { // theme is the first argument if it is an object, otherwise the second argument as an object style = typeof className === 'object' && className || Object(style) // class name is the first arg...
Returns a function that applies a theme and returns tokens of that theme.
createCreateThemeFunction
javascript
stitchesjs/stitches
packages/core/src/features/createTheme.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/createTheme.js
MIT
createCreateThemeFunction = ( config, sheet ) => ( createCreateThemeFunctionMap(config, () => (className, style) => { // theme is the first argument if it is an object, otherwise the second argument as an object style = typeof className === 'object' && className || Object(style) // class name is the first arg...
Returns a function that applies a theme and returns tokens of that theme.
createCreateThemeFunction
javascript
stitchesjs/stitches
packages/core/src/features/createTheme.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/createTheme.js
MIT
createCssFunction = (config, sheet) => createCssFunctionMap(config, () => { const _css = (args, componentConfig = {}) => { let internals = { type: null, composers: new Set(), } for (const arg of args) { // skip any void argument if (arg == null) continue ...
Returns a function that applies component styles.
createCssFunction
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
createCssFunction = (config, sheet) => createCssFunctionMap(config, () => { const _css = (args, componentConfig = {}) => { let internals = { type: null, composers: new Set(), } for (const arg of args) { // skip any void argument if (arg == null) continue ...
Returns a function that applies component styles.
createCssFunction
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
_css = (args, componentConfig = {}) => { let internals = { type: null, composers: new Set(), } for (const arg of args) { // skip any void argument if (arg == null) continue // conditionally extend the component if (arg[internal]) { if (intern...
Returns a function that applies component styles.
_css
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
_css = (args, componentConfig = {}) => { let internals = { type: null, composers: new Set(), } for (const arg of args) { // skip any void argument if (arg == null) continue // conditionally extend the component if (arg[internal]) { if (intern...
Returns a function that applies component styles.
_css
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
createRenderer = (config, internals, sheet, { shouldForwardStitchesProp }) => { const [ baseClassName, baseClassNames, prefilledVariants, undefinedVariants ] = getPreparedDataFromComposers(internals.composers) const deferredInjector = typeof internals.type === 'function' || !!internals.type.$$typeof ? creat...
@type {string} Composer Unique Identifier. @see `{CONFIG_PREFIX}-?c-{STYLE_HASH}`
createRenderer
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
createRenderer = (config, internals, sheet, { shouldForwardStitchesProp }) => { const [ baseClassName, baseClassNames, prefilledVariants, undefinedVariants ] = getPreparedDataFromComposers(internals.composers) const deferredInjector = typeof internals.type === 'function' || !!internals.type.$$typeof ? creat...
@type {string} Composer Unique Identifier. @see `{CONFIG_PREFIX}-?c-{STYLE_HASH}`
createRenderer
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
render = (props) => { props = typeof props === 'object' && props || empty // 1. we cannot mutate `props` // 2. we delete variant props // 3. we delete `css` prop // therefore: we must create a new props & css variables const { ...forwardProps } = props const variantProps = {} for (const name in prefi...
@type {string} Composer Unique Identifier. @see `{CONFIG_PREFIX}-?c-{STYLE_HASH}`
render
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
render = (props) => { props = typeof props === 'object' && props || empty // 1. we cannot mutate `props` // 2. we delete variant props // 3. we delete `css` prop // therefore: we must create a new props & css variables const { ...forwardProps } = props const variantProps = {} for (const name in prefi...
@type {string} Composer Unique Identifier. @see `{CONFIG_PREFIX}-?c-{STYLE_HASH}`
render
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
toString = () => { if (!sheet.rules.styled.cache.has(baseClassName)) render() return baseClassName }
@type {string} Inline Class Unique Identifier. @see `{COMPOSER_UUID}-i{VARIANT_UUID}-css`
toString
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
toString = () => { if (!sheet.rules.styled.cache.has(baseClassName)) render() return baseClassName }
@type {string} Inline Class Unique Identifier. @see `{COMPOSER_UUID}-i{VARIANT_UUID}-css`
toString
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
getPreparedDataFromComposers = (composers) => { /** Class name of the first composer. */ let baseClassName = '' /** @type {string[]} Combined class names for all composers. */ const baseClassNames = [] /** @type {PrefilledVariants} Combined variant pairings for all composers. */ const combinedPrefilledVariants ...
Returns useful data that can be known before rendering.
getPreparedDataFromComposers
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
getPreparedDataFromComposers = (composers) => { /** Class name of the first composer. */ let baseClassName = '' /** @type {string[]} Combined class names for all composers. */ const baseClassNames = [] /** @type {PrefilledVariants} Combined variant pairings for all composers. */ const combinedPrefilledVariants ...
Returns useful data that can be known before rendering.
getPreparedDataFromComposers
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
getTargetVariantsToAdd = ( targetVariants, variantProps, media, isCompoundVariant, ) => { const targetVariantsToAdd = [] targetVariants: for (let [vMatch, vStyle, vEmpty] of targetVariants) { // skip empty variants if (vEmpty) continue /** Position the variant should be inserted into. */ let vOrder = ...
@type {UndefinedVariants} List of variant names that can have an "undefined" pairing.
getTargetVariantsToAdd
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
getTargetVariantsToAdd = ( targetVariants, variantProps, media, isCompoundVariant, ) => { const targetVariantsToAdd = [] targetVariants: for (let [vMatch, vStyle, vEmpty] of targetVariants) { // skip empty variants if (vEmpty) continue /** Position the variant should be inserted into. */ let vOrder = ...
@type {UndefinedVariants} List of variant names that can have an "undefined" pairing.
getTargetVariantsToAdd
javascript
stitchesjs/stitches
packages/core/src/features/css.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/css.js
MIT
createGlobalCssFunction = ( config, sheet ) => createGlobalCssFunctionMap(config, () => ( ...styles ) => { const render = () => { for (let style of styles) { style = typeof style === 'object' && style || {} let uuid = toHash(style) if (!sheet.rules.global.cache.has(uuid)) { sheet.rules.global.ca...
Returns a function that applies global styles.
createGlobalCssFunction
javascript
stitchesjs/stitches
packages/core/src/features/globalCss.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/globalCss.js
MIT
createGlobalCssFunction = ( config, sheet ) => createGlobalCssFunctionMap(config, () => ( ...styles ) => { const render = () => { for (let style of styles) { style = typeof style === 'object' && style || {} let uuid = toHash(style) if (!sheet.rules.global.cache.has(uuid)) { sheet.rules.global.ca...
Returns a function that applies global styles.
createGlobalCssFunction
javascript
stitchesjs/stitches
packages/core/src/features/globalCss.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/globalCss.js
MIT
render = () => { for (let style of styles) { style = typeof style === 'object' && style || {} let uuid = toHash(style) if (!sheet.rules.global.cache.has(uuid)) { sheet.rules.global.cache.add(uuid) // support @import rules if ('@import' in style) { let importIndex = [].indexOf.call(sheet.s...
Returns a function that applies global styles.
render
javascript
stitchesjs/stitches
packages/core/src/features/globalCss.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/globalCss.js
MIT
render = () => { for (let style of styles) { style = typeof style === 'object' && style || {} let uuid = toHash(style) if (!sheet.rules.global.cache.has(uuid)) { sheet.rules.global.cache.add(uuid) // support @import rules if ('@import' in style) { let importIndex = [].indexOf.call(sheet.s...
Returns a function that applies global styles.
render
javascript
stitchesjs/stitches
packages/core/src/features/globalCss.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/globalCss.js
MIT
createKeyframesFunction = (/** @type {Config} */ config, /** @type {GroupSheet} */ sheet) => ( createKeyframesFunctionMap(config, () => (style) => { /** @type {string} Keyframes Unique Identifier. @see `{CONFIG_PREFIX}-?k-{KEYFRAME_UUID}` */ const name = `${toTailDashed(config.prefix)}k-${toHash(style)}` const ...
Returns a function that applies a keyframes rule.
createKeyframesFunction
javascript
stitchesjs/stitches
packages/core/src/features/keyframes.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/keyframes.js
MIT
createKeyframesFunction = (/** @type {Config} */ config, /** @type {GroupSheet} */ sheet) => ( createKeyframesFunctionMap(config, () => (style) => { /** @type {string} Keyframes Unique Identifier. @see `{CONFIG_PREFIX}-?k-{KEYFRAME_UUID}` */ const name = `${toTailDashed(config.prefix)}k-${toHash(style)}` const ...
Returns a function that applies a keyframes rule.
createKeyframesFunction
javascript
stitchesjs/stitches
packages/core/src/features/keyframes.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/keyframes.js
MIT
render = () => { if (!sheet.rules.global.cache.has(name)) { sheet.rules.global.cache.add(name) const cssRules = [] toCssRules(style, [], [], config, (cssText) => cssRules.push(cssText)) const cssText = `@keyframes ${name}{${cssRules.join('')}}` sheet.rules.global.apply(cssText) } retur...
@type {string} Keyframes Unique Identifier. @see `{CONFIG_PREFIX}-?k-{KEYFRAME_UUID}`
render
javascript
stitchesjs/stitches
packages/core/src/features/keyframes.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/keyframes.js
MIT
render = () => { if (!sheet.rules.global.cache.has(name)) { sheet.rules.global.cache.add(name) const cssRules = [] toCssRules(style, [], [], config, (cssText) => cssRules.push(cssText)) const cssText = `@keyframes ${name}{${cssRules.join('')}}` sheet.rules.global.apply(cssText) } retur...
@type {string} Keyframes Unique Identifier. @see `{CONFIG_PREFIX}-?k-{KEYFRAME_UUID}`
render
javascript
stitchesjs/stitches
packages/core/src/features/keyframes.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/keyframes.js
MIT
get name() { return render() }
@type {string} Keyframes Unique Identifier. @see `{CONFIG_PREFIX}-?k-{KEYFRAME_UUID}`
name
javascript
stitchesjs/stitches
packages/core/src/features/keyframes.js
https://github.com/stitchesjs/stitches/blob/master/packages/core/src/features/keyframes.js
MIT
createStyledFunction = ({ config, sheet }) => createCssFunctionMap(config, () => { const cssFunction = createCssFunction(config, sheet) const _styled = (args, css = cssFunction, { displayName, shouldForwardStitchesProp } = {}) => { const cssComponent = css(...args) const DefaultType = cssComponent[internal]...
Returns a function that applies component styles.
createStyledFunction
javascript
stitchesjs/stitches
packages/react/src/features/styled.js
https://github.com/stitchesjs/stitches/blob/master/packages/react/src/features/styled.js
MIT
createStyledFunction = ({ config, sheet }) => createCssFunctionMap(config, () => { const cssFunction = createCssFunction(config, sheet) const _styled = (args, css = cssFunction, { displayName, shouldForwardStitchesProp } = {}) => { const cssComponent = css(...args) const DefaultType = cssComponent[internal]...
Returns a function that applies component styles.
createStyledFunction
javascript
stitchesjs/stitches
packages/react/src/features/styled.js
https://github.com/stitchesjs/stitches/blob/master/packages/react/src/features/styled.js
MIT
_styled = (args, css = cssFunction, { displayName, shouldForwardStitchesProp } = {}) => { const cssComponent = css(...args) const DefaultType = cssComponent[internal].type const shouldForwardAs = shouldForwardStitchesProp?.('as') const styledComponent = React.forwardRef((props, ref) => { const Type = p...
Returns a function that applies component styles.
_styled
javascript
stitchesjs/stitches
packages/react/src/features/styled.js
https://github.com/stitchesjs/stitches/blob/master/packages/react/src/features/styled.js
MIT
_styled = (args, css = cssFunction, { displayName, shouldForwardStitchesProp } = {}) => { const cssComponent = css(...args) const DefaultType = cssComponent[internal].type const shouldForwardAs = shouldForwardStitchesProp?.('as') const styledComponent = React.forwardRef((props, ref) => { const Type = p...
Returns a function that applies component styles.
_styled
javascript
stitchesjs/stitches
packages/react/src/features/styled.js
https://github.com/stitchesjs/stitches/blob/master/packages/react/src/features/styled.js
MIT
getResolvedSelectors = ( /** @type {string[]} Parent selectors (e.g. `["a", "button"]`). */ parentSelectors, /** @type {string[]} Nested selectors (e.g. `["&:hover", "&:focus"]`). */ nestedSelectors, ) => ( parentSelectors.reduce( (resolvedSelectors, parentSelector) => { resolvedSelectors.push( ...nestedS...
Returns selectors resolved from parent selectors and nested selectors.
getResolvedSelectors
javascript
stitchesjs/stitches
packages/stringify/src/getResolvedSelectors.js
https://github.com/stitchesjs/stitches/blob/master/packages/stringify/src/getResolvedSelectors.js
MIT
getResolvedSelectors = ( /** @type {string[]} Parent selectors (e.g. `["a", "button"]`). */ parentSelectors, /** @type {string[]} Nested selectors (e.g. `["&:hover", "&:focus"]`). */ nestedSelectors, ) => ( parentSelectors.reduce( (resolvedSelectors, parentSelector) => { resolvedSelectors.push( ...nestedS...
Returns selectors resolved from parent selectors and nested selectors.
getResolvedSelectors
javascript
stitchesjs/stitches
packages/stringify/src/getResolvedSelectors.js
https://github.com/stitchesjs/stitches/blob/master/packages/stringify/src/getResolvedSelectors.js
MIT
stringify = ( /** Object representing the current CSS. */ value, /** Replacer function. */ replacer = undefined, ) => { /** Set used to manage the opened and closed state of rules. */ const used = new WeakSet() const parse = (style, selectors, conditions, prevName, prevData) => { let cssText = '' each: for...
Returns a string of CSS from an object of CSS.
stringify
javascript
stitchesjs/stitches
packages/stringify/src/index.js
https://github.com/stitchesjs/stitches/blob/master/packages/stringify/src/index.js
MIT
stringify = ( /** Object representing the current CSS. */ value, /** Replacer function. */ replacer = undefined, ) => { /** Set used to manage the opened and closed state of rules. */ const used = new WeakSet() const parse = (style, selectors, conditions, prevName, prevData) => { let cssText = '' each: for...
Returns a string of CSS from an object of CSS.
stringify
javascript
stitchesjs/stitches
packages/stringify/src/index.js
https://github.com/stitchesjs/stitches/blob/master/packages/stringify/src/index.js
MIT
parse = (style, selectors, conditions, prevName, prevData) => { let cssText = '' each: for (const name in style) { const isAtRuleLike = name.charCodeAt(0) === 64 for (const data of isAtRuleLike && isArray(style[name]) ? style[name] : [style[name]]) { if (replacer && (name !== prevName || data !== prevDa...
Set used to manage the opened and closed state of rules.
parse
javascript
stitchesjs/stitches
packages/stringify/src/index.js
https://github.com/stitchesjs/stitches/blob/master/packages/stringify/src/index.js
MIT
parse = (style, selectors, conditions, prevName, prevData) => { let cssText = '' each: for (const name in style) { const isAtRuleLike = name.charCodeAt(0) === 64 for (const data of isAtRuleLike && isArray(style[name]) ? style[name] : [style[name]]) { if (replacer && (name !== prevName || data !== prevDa...
Set used to manage the opened and closed state of rules.
parse
javascript
stitchesjs/stitches
packages/stringify/src/index.js
https://github.com/stitchesjs/stitches/blob/master/packages/stringify/src/index.js
MIT
toKebabCase = (/** @type {string} */ value) => ( // ignore kebab-like values value.includes('-') ? value // replace any upper-case letter with a dash and the lower-case variant : value.replace(/[A-Z]/g, (capital) => '-' + capital.toLowerCase()) )
Returns the given value converted to kebab-case.
toKebabCase
javascript
stitchesjs/stitches
packages/stringify/src/toCase.js
https://github.com/stitchesjs/stitches/blob/master/packages/stringify/src/toCase.js
MIT
toKebabCase = (/** @type {string} */ value) => ( // ignore kebab-like values value.includes('-') ? value // replace any upper-case letter with a dash and the lower-case variant : value.replace(/[A-Z]/g, (capital) => '-' + capital.toLowerCase()) )
Returns the given value converted to kebab-case.
toKebabCase
javascript
stitchesjs/stitches
packages/stringify/src/toCase.js
https://github.com/stitchesjs/stitches/blob/master/packages/stringify/src/toCase.js
MIT