@compiled/react 0.17.0 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,16 +2,18 @@ import { createElement } from 'react';
2
2
  import type { CompiledJSX } from './jsx/jsx-local-namespace';
3
3
  export { ClassNames } from './class-names';
4
4
  export { createStrictAPI } from './create-strict-api';
5
+ export type { PseudosDeclarations, MediaQueries, AllowedStyles, ApplySchema, ApplySchemaMap, } from './create-strict-api/types';
5
6
  export { default as css } from './css';
6
7
  export { default as cssMap } from './css-map';
7
8
  export { keyframes } from './keyframes';
8
- export { styled } from './styled';
9
+ export { styled, StyledProps } from './styled';
9
10
  export type { CSSProperties, CSSProps, CSSPseudos, CssFunction, CssType, StrictCSSProperties, } from './types';
10
- export { type XCSSAllProperties, type XCSSAllPseudos, type XCSSProp, cx } from './xcss-prop';
11
+ export { type XCSSAllProperties, type XCSSAllPseudos, type XCSSProp, type CompiledStyles, type Internal$XCSSProp, cx, } from './xcss-prop';
11
12
  export declare const jsx: typeof createElement;
12
13
  export declare namespace jsx {
13
14
  namespace JSX {
14
15
  type Element = CompiledJSX.Element;
16
+ type ElementType = CompiledJSX.ElementType;
15
17
  type ElementClass = CompiledJSX.ElementClass;
16
18
  type ElementAttributesProperty = CompiledJSX.ElementAttributesProperty;
17
19
  type ElementChildrenAttribute = CompiledJSX.ElementChildrenAttribute;
@@ -5,7 +5,7 @@ export { default as css } from './css';
5
5
  export { default as cssMap } from './css-map';
6
6
  export { keyframes } from './keyframes';
7
7
  export { styled } from './styled';
8
- export { cx } from './xcss-prop';
8
+ export { cx, } from './xcss-prop';
9
9
  // Pass through the (classic) jsx runtime.
10
10
  // Compiled currently doesn't define its own and uses this purely to enable a local jsx namespace.
11
11
  export const jsx = createElement;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AASlC,OAAO,EAA8D,EAAE,EAAE,MAAM,aAAa,CAAC;AAE7F,0CAA0C;AAC1C,kGAAkG;AAClG,MAAM,CAAC,MAAM,GAAG,GAAG,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAQtD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAe,MAAM,UAAU,CAAC;AAS/C,OAAO,EAML,EAAE,GACH,MAAM,aAAa,CAAC;AAErB,0CAA0C;AAC1C,kGAAkG;AAClG,MAAM,CAAC,MAAM,GAAG,GAAG,aAAa,CAAC"}
@@ -2,16 +2,18 @@ import { createElement } from 'react';
2
2
  import type { CompiledJSX } from './jsx/jsx-local-namespace';
3
3
  export { ClassNames } from './class-names';
4
4
  export { createStrictAPI } from './create-strict-api';
5
+ export type { PseudosDeclarations, MediaQueries, AllowedStyles, ApplySchema, ApplySchemaMap, } from './create-strict-api/types';
5
6
  export { default as css } from './css';
6
7
  export { default as cssMap } from './css-map';
7
8
  export { keyframes } from './keyframes';
8
- export { styled } from './styled';
9
+ export { styled, StyledProps } from './styled';
9
10
  export type { CSSProperties, CSSProps, CSSPseudos, CssFunction, CssType, StrictCSSProperties, } from './types';
10
- export { type XCSSAllProperties, type XCSSAllPseudos, type XCSSProp, cx } from './xcss-prop';
11
+ export { type XCSSAllProperties, type XCSSAllPseudos, type XCSSProp, type CompiledStyles, type Internal$XCSSProp, cx, } from './xcss-prop';
11
12
  export declare const jsx: typeof createElement;
12
13
  export declare namespace jsx {
13
14
  namespace JSX {
14
15
  type Element = CompiledJSX.Element;
16
+ type ElementType = CompiledJSX.ElementType;
15
17
  type ElementClass = CompiledJSX.ElementClass;
16
18
  type ElementAttributesProperty = CompiledJSX.ElementAttributesProperty;
17
19
  type ElementChildrenAttribute = CompiledJSX.ElementChildrenAttribute;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAsC;AAItC,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AACxB,6BAAuC;AAA9B,2GAAA,OAAO,OAAO;AACvB,qCAA8C;AAArC,kHAAA,OAAO,OAAU;AAC1B,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AASf,yCAA6F;AAAxB,+FAAA,EAAE,OAAA;AAEvE,0CAA0C;AAC1C,kGAAkG;AACrF,QAAA,GAAG,GAAG,qBAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAsC;AAItC,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AAQxB,6BAAuC;AAA9B,2GAAA,OAAO,OAAO;AACvB,qCAA8C;AAArC,kHAAA,OAAO,OAAU;AAC1B,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,mCAA+C;AAAtC,gGAAA,MAAM,OAAA;AASf,yCAOqB;AADnB,+FAAA,EAAE,OAAA;AAGJ,0CAA0C;AAC1C,kGAAkG;AACrF,QAAA,GAAG,GAAG,qBAAa,CAAC"}
@@ -2,16 +2,18 @@ import { createElement } from 'react';
2
2
  import type { CompiledJSX } from './jsx/jsx-local-namespace';
3
3
  export { ClassNames } from './class-names';
4
4
  export { createStrictAPI } from './create-strict-api';
5
+ export type { PseudosDeclarations, MediaQueries, AllowedStyles, ApplySchema, ApplySchemaMap, } from './create-strict-api/types';
5
6
  export { default as css } from './css';
6
7
  export { default as cssMap } from './css-map';
7
8
  export { keyframes } from './keyframes';
8
- export { styled } from './styled';
9
+ export { styled, StyledProps } from './styled';
9
10
  export type { CSSProperties, CSSProps, CSSPseudos, CssFunction, CssType, StrictCSSProperties, } from './types';
10
- export { type XCSSAllProperties, type XCSSAllPseudos, type XCSSProp, cx } from './xcss-prop';
11
+ export { type XCSSAllProperties, type XCSSAllPseudos, type XCSSProp, type CompiledStyles, type Internal$XCSSProp, cx, } from './xcss-prop';
11
12
  export declare const jsx: typeof createElement;
12
13
  export declare namespace jsx {
13
14
  namespace JSX {
14
15
  type Element = CompiledJSX.Element;
16
+ type ElementType = CompiledJSX.ElementType;
15
17
  type ElementClass = CompiledJSX.ElementClass;
16
18
  type ElementAttributesProperty = CompiledJSX.ElementAttributesProperty;
17
19
  type ElementChildrenAttribute = CompiledJSX.ElementChildrenAttribute;
package/dist/esm/index.js CHANGED
@@ -5,7 +5,7 @@ export { default as css } from './css';
5
5
  export { default as cssMap } from './css-map';
6
6
  export { keyframes } from './keyframes';
7
7
  export { styled } from './styled';
8
- export { cx } from './xcss-prop';
8
+ export { cx, } from './xcss-prop';
9
9
  // Pass through the (classic) jsx runtime.
10
10
  // Compiled currently doesn't define its own and uses this purely to enable a local jsx namespace.
11
11
  export const jsx = createElement;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AASlC,OAAO,EAA8D,EAAE,EAAE,MAAM,aAAa,CAAC;AAE7F,0CAA0C;AAC1C,kGAAkG;AAClG,MAAM,CAAC,MAAM,GAAG,GAAG,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAQtD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAe,MAAM,UAAU,CAAC;AAS/C,OAAO,EAML,EAAE,GACH,MAAM,aAAa,CAAC;AAErB,0CAA0C;AAC1C,kGAAkG;AAClG,MAAM,CAAC,MAAM,GAAG,GAAG,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compiled/react",
3
- "version": "0.17.0",
3
+ "version": "0.17.2",
4
4
  "description": "A familiar and performant compile time CSS-in-JS library for React.",
5
5
  "keywords": [
6
6
  "compiled",
@@ -100,7 +100,7 @@ describe('browser', () => {
100
100
  <style nonce="k0Mp1lEd">._f8pjbf54:focus{color:green}</style>
101
101
  <style nonce="k0Mp1lEd">._30l31gy6:hover{color:yellow}</style>
102
102
  <style nonce="k0Mp1lEd">._9h8h13q2:active{color:blue}</style>
103
- <style nonce="k0Mp1lEd">@supports (display:grid){._1df61gy6:focus{color:yellow}._7okp11x8:active{color:black}}@media (max-width:800px){._1o8z1gy6:focus{color:yellow}._jbabtwqo:focus-visible, ._6146twqo:hover{color:grey}._1cld11x8:active{color:black}}</style>
103
+ <style nonce="k0Mp1lEd">@media (max-width:800px){._1o8z1gy6:focus{color:yellow}._jbabtwqo:focus-visible, ._6146twqo:hover{color:grey}._1cld11x8:active{color:black}}@supports (display:grid){._1df61gy6:focus{color:yellow}._7okp11x8:active{color:black}}</style>
104
104
  "
105
105
  `);
106
106
  });
@@ -1,7 +1,7 @@
1
1
  /** @jsxImportSource @compiled/react */
2
2
  // This test belongs in @compiled/jest - but can't be placed there due to a circular dependency.
3
3
  // eslint-disable-next-line import/no-extraneous-dependencies
4
- import { styled } from '@compiled/react';
4
+ import { cssMap, styled } from '@compiled/react';
5
5
  import { render } from '@testing-library/react';
6
6
 
7
7
  describe('toHaveCompliedCss', () => {
@@ -124,6 +124,22 @@ describe('toHaveCompliedCss', () => {
124
124
  expect(el).toHaveCompiledCss('color', 'blue', { target: ':active' });
125
125
  });
126
126
 
127
+ it('should match camelCase css vars', () => {
128
+ const styles = cssMap({ root: { '--myCamelVar': 'red' } });
129
+
130
+ const { getByText } = render(<div css={styles.root}>hello world</div>);
131
+
132
+ expect(getByText('hello world')).toHaveCompiledCss('--myCamelVar', 'red');
133
+ });
134
+
135
+ it('should match kebab-case css vars', () => {
136
+ const styles = cssMap({ root: { '--my-kebab-var': 'green' } });
137
+
138
+ const { getByText } = render(<div css={styles.root}>hello world</div>);
139
+
140
+ expect(getByText('hello world')).toHaveCompiledCss('--my-kebab-var', 'green');
141
+ });
142
+
127
143
  it('should match styles with media', () => {
128
144
  const { getByText } = render(
129
145
  <div
@@ -135,8 +135,8 @@ describe('SSR', () => {
135
135
  );
136
136
 
137
137
  expect(result.split('</style>').join('</style>\n')).toMatchInlineSnapshot(`
138
- "<style data-cmpld="true" nonce="k0Mp1lEd">._1e0c1txw{display:flex}._1wyb12am{font-size:50px}._syaz1cnh{color:purple}._ysv75scu:link{color:red}._105332ev:visited{color:pink}._f8pjbf54:focus{color:green}._30l31gy6:hover{color:yellow}._9h8h13q2:active{color:blue}@supports (display:grid){._1df61gy6:focus{color:yellow}._7okp11x8:active{color:black}}@media (max-width:800px){._1o8z1gy6:focus{color:yellow}._1cld11x8:active{color:black}}</style>
139
- <a href="https://atlassian.design" class="_1e0c1txw _1wyb12am _syaz1cnh _30l31gy6 _9h8h13q2 _ysv75scu _1df61gy6 _7okp11x8 _f8pjbf54 _105332ev _1o8z1gy6 _1cld11x8">Atlassian Design System</a>"
138
+ "<style data-cmpld="true" nonce="k0Mp1lEd">._1e0c1txw{display:flex}._1wyb12am{font-size:50px}._syaz1cnh{color:purple}._ysv75scu:link{color:red}._105332ev:visited{color:pink}._f8pjbf54:focus{color:green}._30l31gy6:hover{color:yellow}._9h8h13q2:active{color:blue}@media (max-width:800px){._1o8z1gy6:focus{color:yellow}._1cld11x8:active{color:black}}@supports (display:grid){._1df61gy6:focus{color:yellow}._7okp11x8:active{color:black}}</style>
139
+ <a href="https://atlassian.design" class="_1e0c1txw _1wyb12am _syaz1cnh _ysv75scu _105332ev _f8pjbf54 _30l31gy6 _9h8h13q2 _1o8z1gy6 _1cld11x8 _1df61gy6 _7okp11x8">Atlassian Design System</a>"
140
140
  `);
141
141
  });
142
142
 
package/src/index.ts CHANGED
@@ -4,10 +4,17 @@ import type { CompiledJSX } from './jsx/jsx-local-namespace';
4
4
 
5
5
  export { ClassNames } from './class-names';
6
6
  export { createStrictAPI } from './create-strict-api';
7
+ export type {
8
+ PseudosDeclarations,
9
+ MediaQueries,
10
+ AllowedStyles,
11
+ ApplySchema,
12
+ ApplySchemaMap,
13
+ } from './create-strict-api/types';
7
14
  export { default as css } from './css';
8
15
  export { default as cssMap } from './css-map';
9
16
  export { keyframes } from './keyframes';
10
- export { styled } from './styled';
17
+ export { styled, StyledProps } from './styled';
11
18
  export type {
12
19
  CSSProperties,
13
20
  CSSProps,
@@ -16,7 +23,14 @@ export type {
16
23
  CssType,
17
24
  StrictCSSProperties,
18
25
  } from './types';
19
- export { type XCSSAllProperties, type XCSSAllPseudos, type XCSSProp, cx } from './xcss-prop';
26
+ export {
27
+ type XCSSAllProperties,
28
+ type XCSSAllPseudos,
29
+ type XCSSProp,
30
+ type CompiledStyles,
31
+ type Internal$XCSSProp,
32
+ cx,
33
+ } from './xcss-prop';
20
34
 
21
35
  // Pass through the (classic) jsx runtime.
22
36
  // Compiled currently doesn't define its own and uses this purely to enable a local jsx namespace.
@@ -25,6 +39,7 @@ export const jsx = createElement;
25
39
  export namespace jsx {
26
40
  export namespace JSX {
27
41
  export type Element = CompiledJSX.Element;
42
+ export type ElementType = CompiledJSX.ElementType;
28
43
  export type ElementClass = CompiledJSX.ElementClass;
29
44
  export type ElementAttributesProperty = CompiledJSX.ElementAttributesProperty;
30
45
  export type ElementChildrenAttribute = CompiledJSX.ElementChildrenAttribute;