@atlaskit/css 0.0.1 → 0.0.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/css
2
2
 
3
+ ## 0.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#62648](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/62648) [`1902f30344b5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1902f30344b5) - Add a `StrictXCSSProp` to clarify the loose vs. strict implementation.
8
+
9
+ ## 0.0.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#63504](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63504) [`a48de33c8536`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a48de33c8536) - Uses codegen'd token schema type definition from the tokens package
14
+ - Updated dependencies
15
+
3
16
  ## 0.0.1
4
17
 
5
18
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -5,14 +5,74 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.cx = exports.cssMap = exports.css = exports.XCSSProp = void 0;
8
+ exports.cx = exports.cssMap = exports.css = void 0;
9
9
  var React = _interopRequireWildcard(require("react"));
10
10
  var _runtime = require("@compiled/react/runtime");
11
11
  var _react2 = require("@compiled/react");
12
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
14
  var _createStrictAPI = (0, _react2.createStrictAPI)(),
15
- XCSSProp = exports.XCSSProp = _createStrictAPI.XCSSProp,
15
+ XCSSProp = _createStrictAPI.XCSSProp,
16
16
  css = exports.css = _createStrictAPI.css,
17
17
  cssMap = exports.cssMap = _createStrictAPI.cssMap,
18
- cx = exports.cx = _createStrictAPI.cx;
18
+ cx = exports.cx = _createStrictAPI.cx;
19
+
20
+ /**
21
+ * ## StrictXCSSProp
22
+ *
23
+ * Declare styles your component takes with all other styles marked as violations
24
+ * by the TypeScript compiler. There are two primary use cases for xcss prop:
25
+ *
26
+ * - safe style overrides
27
+ * - inverting style declarations
28
+ *
29
+ * Interverting style declarations is interesting for platform teams as
30
+ * it means products only pay for styles they use as they're now the ones who declare
31
+ * the styles!
32
+ *
33
+ * The {@link StrictXCSSProp} type has generics two of which must be defined — use to explicitly
34
+ * set want you to maintain as API. Use {@link XCSSAllProperties} and {@link XCSSAllPseudos}
35
+ * to enable all properties and pseudos.
36
+ *
37
+ * The third generic is used to declare what properties and pseudos should be required.
38
+ *
39
+ * ```tsx
40
+ * interface MyComponentProps {
41
+ * // Color is accepted, all other properties / pseudos are considered violations.
42
+ * xcss?: StrictXCSSProp<'color', never>;
43
+ *
44
+ * // Only backgrond color and hover pseudo is accepted.
45
+ * xcss?: StrictXCSSProp<'backgroundColor', '&:hover'>;
46
+ *
47
+ * // All properties are accepted, all pseudos are considered violations.
48
+ * xcss?: StrictXCSSProp<XCSSAllProperties, never>;
49
+ *
50
+ * // All properties are accepted, only the hover pseudo is accepted.
51
+ * xcss?: StrictXCSSProp<XCSSAllProperties, '&:hover'>;
52
+ *
53
+ * // The xcss prop is required as well as the color property. No pseudos are required.
54
+ * xcss: StrictXCSSProp<
55
+ * XCSSAllProperties,
56
+ * '&:hover',
57
+ * { requiredProperties: 'color', requiredPseudos: never }
58
+ * >;
59
+ * }
60
+ *
61
+ * function MyComponent({ xcss }: MyComponentProps) {
62
+ * return <div css={{ color: 'var(--ds-text-danger)' }} className={xcss} />
63
+ * }
64
+ * ```
65
+ *
66
+ * The xcss prop works with static inline objects and the [cssMap](https://compiledcssinjs.com/docs/api-cssmap) API.
67
+ *
68
+ * ```jsx
69
+ * // Declared as an inline object
70
+ * <Component xcss={{ color: 'var(--ds-text)' }} />
71
+ *
72
+ * // Declared with the cssMap API
73
+ * const styles = cssMap({ text: { color: 'var(--ds-text)' } });
74
+ * <Component xcss={styles.text} />
75
+ * ```
76
+ *
77
+ * To concatenate and conditonally apply styles use the {@link cssMap} and {@link cx} functions.
78
+ */
@@ -8,4 +8,64 @@ const {
8
8
  cssMap,
9
9
  cx
10
10
  } = createStrictAPI();
11
- export { XCSSProp, css, cssMap, cx };
11
+ export { css, cssMap, cx };
12
+
13
+ /**
14
+ * ## StrictXCSSProp
15
+ *
16
+ * Declare styles your component takes with all other styles marked as violations
17
+ * by the TypeScript compiler. There are two primary use cases for xcss prop:
18
+ *
19
+ * - safe style overrides
20
+ * - inverting style declarations
21
+ *
22
+ * Interverting style declarations is interesting for platform teams as
23
+ * it means products only pay for styles they use as they're now the ones who declare
24
+ * the styles!
25
+ *
26
+ * The {@link StrictXCSSProp} type has generics two of which must be defined — use to explicitly
27
+ * set want you to maintain as API. Use {@link XCSSAllProperties} and {@link XCSSAllPseudos}
28
+ * to enable all properties and pseudos.
29
+ *
30
+ * The third generic is used to declare what properties and pseudos should be required.
31
+ *
32
+ * ```tsx
33
+ * interface MyComponentProps {
34
+ * // Color is accepted, all other properties / pseudos are considered violations.
35
+ * xcss?: StrictXCSSProp<'color', never>;
36
+ *
37
+ * // Only backgrond color and hover pseudo is accepted.
38
+ * xcss?: StrictXCSSProp<'backgroundColor', '&:hover'>;
39
+ *
40
+ * // All properties are accepted, all pseudos are considered violations.
41
+ * xcss?: StrictXCSSProp<XCSSAllProperties, never>;
42
+ *
43
+ * // All properties are accepted, only the hover pseudo is accepted.
44
+ * xcss?: StrictXCSSProp<XCSSAllProperties, '&:hover'>;
45
+ *
46
+ * // The xcss prop is required as well as the color property. No pseudos are required.
47
+ * xcss: StrictXCSSProp<
48
+ * XCSSAllProperties,
49
+ * '&:hover',
50
+ * { requiredProperties: 'color', requiredPseudos: never }
51
+ * >;
52
+ * }
53
+ *
54
+ * function MyComponent({ xcss }: MyComponentProps) {
55
+ * return <div css={{ color: 'var(--ds-text-danger)' }} className={xcss} />
56
+ * }
57
+ * ```
58
+ *
59
+ * The xcss prop works with static inline objects and the [cssMap](https://compiledcssinjs.com/docs/api-cssmap) API.
60
+ *
61
+ * ```jsx
62
+ * // Declared as an inline object
63
+ * <Component xcss={{ color: 'var(--ds-text)' }} />
64
+ *
65
+ * // Declared with the cssMap API
66
+ * const styles = cssMap({ text: { color: 'var(--ds-text)' } });
67
+ * <Component xcss={styles.text} />
68
+ * ```
69
+ *
70
+ * To concatenate and conditonally apply styles use the {@link cssMap} and {@link cx} functions.
71
+ */
package/dist/esm/index.js CHANGED
@@ -7,4 +7,64 @@ var _createStrictAPI = createStrictAPI(),
7
7
  css = _createStrictAPI.css,
8
8
  cssMap = _createStrictAPI.cssMap,
9
9
  cx = _createStrictAPI.cx;
10
- export { XCSSProp, css, cssMap, cx };
10
+ export { css, cssMap, cx };
11
+
12
+ /**
13
+ * ## StrictXCSSProp
14
+ *
15
+ * Declare styles your component takes with all other styles marked as violations
16
+ * by the TypeScript compiler. There are two primary use cases for xcss prop:
17
+ *
18
+ * - safe style overrides
19
+ * - inverting style declarations
20
+ *
21
+ * Interverting style declarations is interesting for platform teams as
22
+ * it means products only pay for styles they use as they're now the ones who declare
23
+ * the styles!
24
+ *
25
+ * The {@link StrictXCSSProp} type has generics two of which must be defined — use to explicitly
26
+ * set want you to maintain as API. Use {@link XCSSAllProperties} and {@link XCSSAllPseudos}
27
+ * to enable all properties and pseudos.
28
+ *
29
+ * The third generic is used to declare what properties and pseudos should be required.
30
+ *
31
+ * ```tsx
32
+ * interface MyComponentProps {
33
+ * // Color is accepted, all other properties / pseudos are considered violations.
34
+ * xcss?: StrictXCSSProp<'color', never>;
35
+ *
36
+ * // Only backgrond color and hover pseudo is accepted.
37
+ * xcss?: StrictXCSSProp<'backgroundColor', '&:hover'>;
38
+ *
39
+ * // All properties are accepted, all pseudos are considered violations.
40
+ * xcss?: StrictXCSSProp<XCSSAllProperties, never>;
41
+ *
42
+ * // All properties are accepted, only the hover pseudo is accepted.
43
+ * xcss?: StrictXCSSProp<XCSSAllProperties, '&:hover'>;
44
+ *
45
+ * // The xcss prop is required as well as the color property. No pseudos are required.
46
+ * xcss: StrictXCSSProp<
47
+ * XCSSAllProperties,
48
+ * '&:hover',
49
+ * { requiredProperties: 'color', requiredPseudos: never }
50
+ * >;
51
+ * }
52
+ *
53
+ * function MyComponent({ xcss }: MyComponentProps) {
54
+ * return <div css={{ color: 'var(--ds-text-danger)' }} className={xcss} />
55
+ * }
56
+ * ```
57
+ *
58
+ * The xcss prop works with static inline objects and the [cssMap](https://compiledcssinjs.com/docs/api-cssmap) API.
59
+ *
60
+ * ```jsx
61
+ * // Declared as an inline object
62
+ * <Component xcss={{ color: 'var(--ds-text)' }} />
63
+ *
64
+ * // Declared with the cssMap API
65
+ * const styles = cssMap({ text: { color: 'var(--ds-text)' } });
66
+ * <Component xcss={styles.text} />
67
+ * ```
68
+ *
69
+ * To concatenate and conditonally apply styles use the {@link cssMap} and {@link cx} functions.
70
+ */