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 2.22 kB
{"version":3,"sources":["../runtime/jsx-runtime.ts"],"sourcesContent":["import ReactJSXRuntime from \"react/jsx-runtime\";\nimport type { ComponentStyles } from \"./mocks/cssLiteral.js\";\n\n// Only return the css prop if the \"className\" and \"style\" properties are present\n// This was inspired from emotion\n// https://github.com/emotion-js/emotion/blob/cce67ec6b2fc94261028b4f4778aae8c3d6c5fd6/packages/react/src/jsx-namespace.ts#L9C6-L9C28\ntype WithConditionalCSSProp<P> = \"className\" | \"style\" extends keyof P\n ? string extends P[\"className\" & keyof P]\n ? Record<string, any> extends P[\"style\" & keyof P]\n ? { css?: ComponentStyles<Record<keyof any, never>> }\n : {}\n : {}\n : {};\n\nconst Fragment = ReactJSXRuntime.Fragment;\nconst jsx = ReactJSXRuntime.jsx;\nconst jsxs = ReactJSXRuntime.jsxs;\n\nexport declare namespace YakJSX {\n export type Element = React.JSX.Element;\n export type ElementType = React.JSX.ElementType;\n export type ElementClass = React.JSX.ElementClass;\n export type ElementAttributesProperty = React.JSX.ElementAttributesProperty;\n export type ElementChildrenAttribute = React.JSX.ElementChildrenAttribute;\n\n // Add the CSS prop to all components that can receive \"className\" and \"style\"\n export type LibraryManagedAttributes<C, P> = P extends unknown\n ? WithConditionalCSSProp<P> & React.JSX.LibraryManagedAttributes<C, P>\n : never;\n\n export type IntrinsicAttributes = React.JSX.IntrinsicAttributes;\n export type IntrinsicClassAttributes<T> =\n React.JSX.IntrinsicClassAttributes<T>;\n\n export type IntrinsicElements = {\n [K in keyof React.JSX.IntrinsicElements]: React.JSX.IntrinsicElements[K] & {\n // Add the CSS prop to all native elements e.g. \"div\" or \"span\"\n css?: ComponentStyles<Record<keyof any, never>>;\n };\n };\n}\n\nexport { Fragment, jsx, jsxs, type YakJSX as JSX };\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,QAAAC,EAAA,SAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAA4B,kCActBJ,EAAW,EAAAK,QAAgB,SAC3BJ,EAAM,EAAAI,QAAgB,IACtBH,EAAO,EAAAG,QAAgB","names":["jsx_runtime_exports","__export","Fragment","jsx","jsxs","__toCommonJS","import_jsx_runtime","ReactJSXRuntime"]}