- 5c04f896: Fix 'as const' expressions causing Compiled to crash at build time
-
83c47f85: [BREAKING] Add a deterministic sorting to media queries and other at-rules in Compiled. We use a simplified version of what the
sort-css-media-queries
package does - sortingmin-width
andmin-height
from smallest to largest, thenmax-width
andmax-height
from largest to smallest. If ranges or features involvingheight
andwidth
are not present in the at-rule, the at-rule will be sorted lexicographically / alphabetically.Situations you may need to be careful of:
- In situations where two at-rules with the same property apply at the same time, this may break your styles, as the order in which the styles are applied will change. (For example, overlapping
@media
queries) - Because all at-rules will now be sorted lexicographically / alphabetically,
@layer
blocks you pass to Compiled APIs may not be outputted in the same order, causing different CSS than expected.
This is turned on by default. If you do not want your at-rules to be sorted, set
sortAtRules
tofalse
in your configuration:- Webpack users: the
@compiled/webpack-loader
options in your Webpack configuration - Parcel users: your Compiled configuration, e.g.
.compiledcssrc
or similar - Babel users: the
@compiled/babel-plugin-strip-runtime
options in your.babelrc.json
or similar, if you have the@compiled/babel-plugin-strip-runtime
plugin enabled.
- In situations where two at-rules with the same property apply at the same time, this may break your styles, as the order in which the styles are applied will change. (For example, overlapping
- 4f5865a1: Fixes the parsing of custom properties (CSS variables) names in object syntax. The casing is now preserved instead of being converted to kebab-case.
- 4f5865a1: Fixes the parsing of custom properties (CSS variables) names in object syntax. The casing is now preserved instead of being converted to kebab-case.
- Updated dependencies [4f5865a1]
- Updated dependencies [83c47f85]
- @compiled/utils@0.11.1
- @compiled/css@0.14.0
- Updated dependencies [04cb7ae7]
- @compiled/utils@0.11.0
- @compiled/css@0.13.0
-
36c4f0b9: Fix handling of
content
property.- The value of the
content
property will no longer automatically have quotes erroneously added around it, if the value is one ofopen-quote
,counter(...)
,url(...)
,inherit
,none
, and so on. - The full regex used to check is as follows:
/^([A-Za-z\-]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)(\s|$)/
- The value of the
-
8ed3e9bf: The
@atlaskit/css
is now picked up as a default import source, meaning consumers of Compiled don't need to configure it to be picked up.
- Updated dependencies [e49b4f08]
- Updated dependencies [e49b4f08]
- @compiled/css@0.12.3
- @compiled/utils@0.10.0
- 1b1a94a5: Remove the invariant to fail on an empty cssMap object for easier iterative development.
- 4b2e5eeb: The CSS map transform now allows top level at rules to be defined.
-
7d3406c9: Previously, if you passed
props => ...
directly tostyled.div
orcss()
, and the return value of the arrow function was an object, you would cause@compiled/babel-plugin
to crash:import { styled } from '@compiled/react'; import React from 'react'; const Component = styled.div((props) => ({ color: `${props.customColor}`, background: props.background, }));
While at the same time, wrapping the return value inside a logical expression or ternary expression would make it work perfectly fine:
const Styles = styled.div((props) => props.isEditing ? {} : { backgroundColor: props.highlightColor } );
With this version, both of these forms will work without issue. :)
-
d5c6578c: Fix props (used by Compiled) being incorrectly forwarded to React when default values are used.
- 35675858: Fix the compiler throwing when multiple Compiled imports were used in the same module.
- 5bd1b492: Introduce a new config option
increaseSpecificity
that increases the specificity of all generated Compiled classes. This is useful when migrating between two or more other styling solutions to Compiled. - Updated dependencies [5bd1b492]
- @compiled/css@0.12.2
-
df91c60f: [BREAKING] Fix @compiled/babel-plugin handling of classic JSX pragma. Involves several breaking changes.
- Move the below @compiled/babel-plugin-strip-runtime behaviour to @compiled/babel-plugin
- Classic JSX pragma will no longer affect the Babel output: instead of seeing
jsx
function calls in the output, you will seeReact.createElement
calls again. (Added to @compiled/babel-plugin-strip-runtime in v0.27.0)
- Classic JSX pragma will no longer affect the Babel output: instead of seeing
- @compiled/babel-plugin: Due to the above behaviour change, a classic JSX pragma (
/** @jsx jsx */
) is used, React will always be imported regardless of the value ofimportReact
. - @compiled/babel-plugin: We don't support specifying the
pragma
option through@babel/preset-react
or@babel/plugin-transform-react-jsx
- we will now throw an error if this happens.
- Move the below @compiled/babel-plugin-strip-runtime behaviour to @compiled/babel-plugin
- 39714ae3: cssMap() no longer throws an invariant if no styles were generated.
- a9509cc0: Compiled runtime is no-longer inserted for non-Compiled xcss prop usage.
-
9857009f: Introduce new API
createStrictAPI
which returns a strict subset of Compiled APIs augmented by a type definition. This API does not change Compileds build time behavior — merely augmenting the returned API types which enforce:- all APIs use object types
- property values declared in the type definition must be used (else fallback to defaults)
- a strict subset of pseudo states/selectors
- unknown properties to be a type violation
To set up:
- Declare the API in a module (either local or in a package):
import { createStrictAPI } from '@compiled/react'; // ./foo.ts const { css, cssMap, XCSSProp, cx } = createStrictAPI<{ color: 'var(--ds-text)'; '&:hover': { color: 'var(--ds-text-hover)' }; }>(); // Expose APIs you want to support. export { css, cssMap, XCSSProp, cx };
- Configure Compiled to pick up this module:
// .compiledcssrc { + "importSources": ["./foo.ts"] }
- Use the module in your application code:
import { css } from './foo'; const styles = css({ color: 'var(--ds-text)' }); <div css={styles} />;
- 9860df38: Added error in development/debug mode when using 'innerRef' instead of 'ref'
-
52ea5aba: Fix xcss being incompatible with codebases that use Emotion and Compiled:
- Add
processXcss
option to@compiled/babel-plugin
. IfprocessXcss
is set to false,xcss
usages will be ignored, and will not be processed as Compiled. (Note thatxcss
is currently implemented in Atlassian Design System using Emotion.) Defaults totrue
. css
usages in a file will no longer be processed as Compiled ifxcss
is used in the same file, so long as there is not a@compiled/react
import specified in that file.
- Add
- Updated dependencies [fbc17ed3]
- @compiled/utils@0.9.0
- @compiled/css@0.12.1
-
be019f11: Add detectConflictWithOtherLibraries and onlyRunIfImportingCompiled config options to jsx-pragma ESLint rule. Both are set to true by default, hence the breaking change.
detectConflictWithOtherLibraries
raises a linting error ifcss
orjsx
is imported from@emotion/react
(or@emotion/core
) in the same file as a Compiled import. Set to true by default.onlyRunIfImportingCompiled
sets this rule to only suggest adding the JSX pragma if thecss
orcssMap
functions are imported from@compiled/react
, as opposed to whenever thecss
attribute is detected at all. Set to false by default.
-
4caa6784: The xcss prop is now available. Declare styles your component takes with all other styles marked as violations by the TypeScript compiler. There are two primary use cases for xcss prop:
- safe style overrides
- inverting style declarations
Interverting style declarations is interesting for platform teams as it means products only pay for styles they use as they're now the ones who declare the styles!
The
XCSSProp
type has generics which must be defined — of which should be what you explicitly want to maintain as API. UseXCSSAllProperties
andXCSSAllPseudos
types to enable all properties and pseudos.import { type XCSSProp } from '@compiled/react'; interface MyComponentProps { // Color is accepted, all other properties / pseudos are considered violations. xcss?: XCSSProp<'color', never>; // Only backgrond color and hover pseudo is accepted. xcss?: XCSSProp<'backgroundColor', '&:hover'>; // All properties are accepted, all pseudos are considered violations. xcss?: XCSSProp<XCSSAllProperties, never>; // All properties are accepted, only the hover pseudo is accepted. xcss?: XCSSProp<XCSSAllProperties, '&:hover'>; } function MyComponent({ xcss }: MyComponentProps) { return <div css={{ color: 'var(--ds-text-danger)' }} className={xcss} />; }
The xcss prop works with static inline objects and the cssMap API.
// Declared as an inline object <Component xcss={{ color: 'var(--ds-text)' }} />; // Declared with the cssMap API const styles = cssMap({ text: { color: 'var(--ds-text)' } }); <Component xcss={styles.text} />;
To concatenate and conditonally apply styles use the
cssMap
andcx
functions. -
dccb71e0: Adds third generic for XCSSProp type for declaring what properties and pseudos should be required.
- 4a11c5f4: Bugfix: handle memberExpression as CSS object property
- 809cc389: Update resolver to support module paths
- 4a2174c5: Implement the
cssMap
API to enable library users to dynamically choose a varied set of CSS rules.
- 487bbd46: Support default parameters in arrow functions, and explicitly throw error when using unsupported syntax in arrow function parameters
- a24c157c: Skip expansion of shorthand properties (e.g. padding, margin) if they have dynamic values (e.g. CSS variables, ternary expressions, arrow functions)
- Updated dependencies [a24c157c]
- @compiled/css@0.12.0
- 9aa6909a: Add error when expressionToString runs infinite loop ("Error: Maximum call stack size exceeded")
- c4e6b7c0: Introduce a new runtime class name library, which resolves the
ax
chaining issue. The new library is used only if class name compression is enabled. - c4e6b7c0: Change TypeScript compiler target from es5 to es6.
- 25779e3a: Statically evaluate variables inside nested template strings (excluding template strings inside functions)
- Updated dependencies [c4e6b7c0]
- @compiled/utils@0.8.0
- @compiled/css@0.11.0
- Updated dependencies [f9005e2b]
- Updated dependencies [488deaa6]
- @compiled/css@0.10.0
- a41e41e6: Update monorepo node version to v18, and drop support for node v12
- f9c957ef: Add an option to compress class names based on "classNameCompressionMap", which is provided by library consumers. Add a script to generate compressed class names.
- Updated dependencies [a41e41e6]
- Updated dependencies [f9c957ef]
- @compiled/css@0.9.0
- @compiled/utils@0.7.0
- e887c2b5: Clean up dependencies of packages
- 4877ec38: Bump babel versions
- Updated dependencies [e887c2b5]
- Updated dependencies [4877ec38]
- @compiled/css@0.8.8
- @compiled/utils@0.6.17
- 14f2091b: Handle member expression with css props
- 50b51724: Added option "addComponentName" to display styled component name on HTML on non-production environment
- 08a963fc: Bump flowgen types
- 99af4aa0: Fix babel-plugin adding a unwanted call expression in traverseCallExpression
- Updated dependencies [8a74fcd7]
- @compiled/css@0.8.6
- fcda0097: Fix bug where props are not forwarded when composing components in the styled API
- dcb333a2: Use less likely to clash variable names in styled template
- 5ee1a866: - Fixes bug where more than one import cannot be used in template literal object property key
- Support string binary operation in object property keys
- d2bd6305: - Normalize prop usage in styled API to make it easier to avoid name clashing
- Fix bug in styled API where destructuring can remove values out of props
- Ensure props are not displayed as HTML attributes, unless they are valid attributes
- 17de9d1f: Omit rules with empty values from stylesheet
- Updated dependencies [17de9d1f]
- @compiled/css@0.8.5
- 5272281a: Add configurable options to optimize CSS
- Updated dependencies [5272281a]
- @compiled/css@0.8.4
- 8912717: Revert "Bug - shadow variable clash with destructured props (#1193)"
- 6c1ea7f: Support Compiled in files with TypeScript as expressions
- e1ac2ed: Rename babelPlugins configuration option to parserBabelPlugins and add transformerBabelPlugins option
- 4f8f2aa: Fixed shadow variables clashing with destructured props
- d3b5fb9: Support template literals as a selector in an object
- Updated dependencies [ad4d257]
- Updated dependencies [8384893]
- @compiled/css@0.8.3
- 0b38c11: Optimize condtional expressions with object styles
- 2d24709: Statically evaluate unary expressions that convert to negative numbers
- 6d6b579: Fixed CSS property matching for conditional expression optimization
- 2ad385c: Optimize conditional expressions to create CSS classes per conditional branch where possible
- c96c562: Use fallback if babel evaluate throws error during evaluation
- 73821f2: Statically evaluate mathematical binary expressions
- 5e3ad5e: Fixed bug where negative and positive values were getting evaluated as the same
- 356b120: Apply react/jsx-filename-extension rule as needed
- 588cd4f: Use preserveLeadingComments util from @compiled/utils
- Updated dependencies [356b120]
- @compiled/css@0.8.2
- @compiled/utils@0.6.16
- 307bb83: Handle export named declarations with source when resolving modules
-
18dcdf8: Fix conditional rules not generating the expected output:
- classes should be generated instead of CSS variables
- style inside a pseudo class ( eg : hover) or pseudo element ( eg :before) should be applied to related element
- 63e14bd: Ensure that any leading comment is preserved at the top of the processed file before inserting additional imports
- f2cd347: Added a fix to statically evaluate deconstructed values from deeply nested objects
- f139218: Handle destructuring
property: value
pairs returned from arrow functions, and add support for nested and alias destructuring. - 858146c: Add babel plugins support
- b0adb8a: Added support for conditional expressions when passing an array to the
css
prop of an element
- b0adb8a: Fix support for CSS helper call expressions when used in conditional expressions (i.e. the
css(...)
function provided by compiled)
- 254a6f6: Added ESLint rule to prevent use of extraneous packages, and added these usages of these packages as dependencies. Added new namespace
@compiled-private
to prevent name clashes with existing npm packages. - c757259: Update type definition dependencies
- 63148ec: Support file importing in babel plugin and add configuration in loaders
- Updated dependencies [c757259]
- Updated dependencies [63148ec]
- @compiled/css@0.8.1
- 3b7c188: Refactor the way member expressions are statically evaluated and handle more combinations of expressions within a member
- c2ae4eb: Resolve css-what and nth-check to new versions in @compiled/css
- Updated dependencies [c2ae4eb]
- Updated dependencies [b345bf4]
- @compiled/css@0.8.0
- @compiled/utils@0.6.14
- 8c9ab8c: Update
homepage
and otherpackage.json
properties - Updated dependencies [8c9ab8c]
- Updated dependencies [1ca19be]
- @compiled/css@0.7.2
- @compiled/utils@0.6.13
- 79cfb08: Compiled will no longer try to traverse modules boundaries of its own.
- 14368bb: Fix issue where a styled value function using both object destructuring and a template literal in at least one branch resulted in a CSS error
- 68ebac3: Add support for namespace imports and export specifiers
- 427cead: Compiled now supports turning on the
css
prop using jsx pragmas (both with@jsx
and@jsxImportSource
). - 79cfb08: Internal refactor changing how the TypeScript compiler picks up source files.
- Updated dependencies [79cfb08]
- @compiled/css@0.7.1
- @compiled/utils@0.6.12
- fa6af90: Add support for nested ternary operators. Additionally, Compiled will no longer transform ternaries into logical statements unless one side is undefined.
- e015a3a: Add comment directive
// @compiled-disable(-next)-line) transform-css-prop
to disable Compiled processing on CSS prop
- 53a3d71: Breaking change: Ternary conditionals will no longer add falsy path styles when expression evaluates truthy
- b68411c: Fix styled path check
- 0b60ae1: Support custom
resolver
- 2092839: Allow inline strings and inline css mixins in conditional expressions. Fix ordering of styles in template literals.
- 53935b3: Add
ObjectExpression
support tocss
- bcb2a68: Add support for
keyframes
- a7ab8e1: Add support for conditional rules for
Styled
- e1dc346: Fix missing key prop on generated React elements
- 48805ec: Use the correct expression in the style prop, when an identifier is shadowed by a function argument
- 587e729: Generate CSS for rules defined before a mixin and ensure that mixins can be overriden
- Updated dependencies [bcb2a68]
- @compiled/css@0.7.0
- 30ddaf4: Adds a support of computed properties static evaluation in object styles.
-
40bc0d9: Package descriptions have been updated.
-
1b1c964: The
css
mixin API is now available, functioning similarly to the emotion equivalent.import { css } from '@compiled/react'; <div css={css` display: flex; font-size: 50px; color: blue; `}> blue text </div>;
For more help, read the docs: https://compiledcssinjs.com/docs/css.
-
Updated dependencies [40bc0d9]
-
Updated dependencies [1b1c964]
- @compiled/css@0.6.11
- @compiled/utils@0.6.11
- ca573d7: Styled APIs now have display names when running development builds.
- 37108e4: Compiled dependencies are now using carat range.
- Updated dependencies [992e401]
- Updated dependencies [37108e4]
- @compiled/utils@0.6.10
- @compiled/css@0.6.10
- Updated dependencies [0bb1c11]
- Updated dependencies [0bb1c11]
- @compiled/css@0.6.9
- @compiled/utils@0.6.9
- aea3504: Packages now released with changesets.
- Updated dependencies [aea3504]
- @compiled/css@0.6.8
- @compiled/utils@0.6.8