UNPKG

next-yak

Version:

next-yak is a CSS-in-JS solution tailored for Next.js that seamlessly combines the expressive power of styled-components syntax with efficient build-time extraction of CSS using Next.js's built-in CSS configuration

1 lines 1.6 kB
{"version":3,"sources":["../../static/index.ts","../../static/staticCssLiteral.tsx"],"sourcesContent":["//\n// Utility function to be used inside .yak.ts or .yak.js\n// files to define static css mixings\n//\n//\nexport * as mixin from \"./staticCssLiteral.js\"","/**\n * A stub that allows us to use the `css()` (css literal function) inside of *.yak files.\n *\n * This is mainly used for tooling like stylelint and typechecking inside css of *.yak files.\n * It works similar to String.raw but filters out undefined, null and false values to allow for conditionals.\n *\n * @example\n * ```tsx\n * // inside of example.yak.ts\n * import { mixin } from \"next-yak/static\";\n *\n * const styles = mixin.css`\n * .foo {\n * color: red;\n * ${data.isBar && css`\n * background: blue;\n * `}\n * }\n * `\n * ```\n */\nexport const css = (\n strings: TemplateStringsArray,\n ...values: Array<string | number | boolean | null | undefined | Function>\n): string =>\n String.raw(\n strings,\n ...values.map((value) =>\n // filter out everything but strings and numbers\n typeof value === \"number\" || typeof value === \"string\" ? value : \"\"\n )\n ).trim();\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAA,GAAAC,EAAAD,EAAA,SAAAE,IAqBO,IAAMA,EAAM,CACjBC,KACGC,IAEH,OAAO,IACLD,EACA,GAAGC,EAAO,IAAKC,GAEb,OAAOA,GAAU,UAAY,OAAOA,GAAU,SAAWA,EAAQ,EACnE,CACF,EAAE,KAAK","names":["index_exports","__export","staticCssLiteral_exports","__toCommonJS","staticCssLiteral_exports","__export","css","strings","values","value"]}