@atlaskit/editor-palette 1.5.3 → 1.6.0

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,11 @@
1
1
  # @atlaskit/editor-palette
2
2
 
3
+ ## 1.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#95631](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/95631) [`8514eacd7c0e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8514eacd7c0e) - [ED-23111] Add text background color palette to editor palettes
8
+
3
9
  ## 1.5.3
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "hexToEditorTableChartsPaletteRawValue", {
33
33
  return _tableCharts.hexToEditorTableChartsPaletteRawValue;
34
34
  }
35
35
  });
36
+ Object.defineProperty(exports, "hexToEditorTextBackgroundPaletteColor", {
37
+ enumerable: true,
38
+ get: function get() {
39
+ return _textBackgroundColor.hexToEditorTextBackgroundPaletteColor;
40
+ }
41
+ });
36
42
  Object.defineProperty(exports, "hexToEditorTextPaletteColor", {
37
43
  enumerable: true,
38
44
  get: function get() {
@@ -42,4 +48,5 @@ Object.defineProperty(exports, "hexToEditorTextPaletteColor", {
42
48
  var _background = require("./background");
43
49
  var _border = require("./border");
44
50
  var _text = require("./text");
45
- var _tableCharts = require("./table-charts");
51
+ var _tableCharts = require("./table-charts");
52
+ var _textBackgroundColor = require("./text-background-color");
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.hexToEditorTextBackgroundPaletteColor = hexToEditorTextBackgroundPaletteColor;
8
+ exports.textBackgroundColorPalette = void 0;
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _textBackgroundColorP;
11
+ // This import will be stripped on build
12
+
13
+ // Color tokens defined on https://hello.atlassian.net/wiki/spaces/EOU/pages/3587733210/Text+highlighting+-+designs#Colour-palette
14
+ // values are asserted to improve generated type declarations
15
+ var textBackgroundColorPalette = exports.textBackgroundColorPalette = (_textBackgroundColorP = {}, (0, _defineProperty2.default)(_textBackgroundColorP, '#DCDFE4', "var(--ds-background-accent-gray-subtler, #DCDFE4)"), (0, _defineProperty2.default)(_textBackgroundColorP, '#C6EDFB', "var(--ds-background-accent-teal-subtler, #C6EDFB)"), (0, _defineProperty2.default)(_textBackgroundColorP, '#D3F1A7', "var(--ds-background-accent-lime-subtler, #D3F1A7)"), (0, _defineProperty2.default)(_textBackgroundColorP, '#FEDEC8', "var(--ds-background-accent-orange-subtler, #FEDEC8)"), (0, _defineProperty2.default)(_textBackgroundColorP, '#FDD0EC', "var(--ds-background-accent-magenta-subtler, #FDD0EC)"), (0, _defineProperty2.default)(_textBackgroundColorP, '#DFD8FD', "var(--ds-background-accent-purple-subtler, #DFD8FD)"), _textBackgroundColorP);
16
+ /**
17
+ * This takes an ADF hex color and returns a matching text background palette color.
18
+ *
19
+ * By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
20
+ *
21
+ * Example usage
22
+ * ```tsx
23
+ * const cssValue = hexToEditorTextBackgroundPaletteColor('#D3F1A7');
24
+ *
25
+ * <span style={{backgroundColor: cssValue}} />
26
+ * ```
27
+ * The names of tokens can change over time, and the values of tokens will differ between themes.
28
+ * The exact output of this function is an implementation detail and should only be used when rendering
29
+ * content to the user, on a client with a matching major version of `@atlaskit/tokens`.
30
+ * - **DO NOT**: store the output of these functions in any user-generated content or back-end.
31
+ * - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
32
+ */
33
+ function hexToEditorTextBackgroundPaletteColor(hexColor) {
34
+ // Ts ignore was used to allow use of conditional return type
35
+ // (preferring better type on consumption over safety in implementation)
36
+ // @ts-ignore
37
+ return textBackgroundColorPalette[hexColor.toUpperCase()];
38
+ }
@@ -1,4 +1,5 @@
1
1
  export { hexToEditorBackgroundPaletteColor, hexToEditorBackgroundPaletteRawValue } from './background';
2
2
  export { hexToEditorBorderPaletteColor } from './border';
3
3
  export { hexToEditorTextPaletteColor } from './text';
4
- export { hexToEditorTableChartsPaletteColor, hexToEditorTableChartsPaletteRawValue } from './table-charts';
4
+ export { hexToEditorTableChartsPaletteColor, hexToEditorTableChartsPaletteRawValue } from './table-charts';
5
+ export { hexToEditorTextBackgroundPaletteColor } from './text-background-color';
@@ -0,0 +1,41 @@
1
+ // This import will be stripped on build
2
+
3
+ // Color tokens defined on https://hello.atlassian.net/wiki/spaces/EOU/pages/3587733210/Text+highlighting+-+designs#Colour-palette
4
+ // values are asserted to improve generated type declarations
5
+ export const textBackgroundColorPalette = {
6
+ /** Gray - light */
7
+ ['#DCDFE4']: "var(--ds-background-accent-gray-subtler, #DCDFE4)",
8
+ /** Teal - light */
9
+ ['#C6EDFB']: "var(--ds-background-accent-teal-subtler, #C6EDFB)",
10
+ /** Lime - light */
11
+ ['#D3F1A7']: "var(--ds-background-accent-lime-subtler, #D3F1A7)",
12
+ /** Orange - light */
13
+ ['#FEDEC8']: "var(--ds-background-accent-orange-subtler, #FEDEC8)",
14
+ /** Magenta - light */
15
+ ['#FDD0EC']: "var(--ds-background-accent-magenta-subtler, #FDD0EC)",
16
+ /** Purple - light */
17
+ ['#DFD8FD']: "var(--ds-background-accent-purple-subtler, #DFD8FD)"
18
+ };
19
+ /**
20
+ * This takes an ADF hex color and returns a matching text background palette color.
21
+ *
22
+ * By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
23
+ *
24
+ * Example usage
25
+ * ```tsx
26
+ * const cssValue = hexToEditorTextBackgroundPaletteColor('#D3F1A7');
27
+ *
28
+ * <span style={{backgroundColor: cssValue}} />
29
+ * ```
30
+ * The names of tokens can change over time, and the values of tokens will differ between themes.
31
+ * The exact output of this function is an implementation detail and should only be used when rendering
32
+ * content to the user, on a client with a matching major version of `@atlaskit/tokens`.
33
+ * - **DO NOT**: store the output of these functions in any user-generated content or back-end.
34
+ * - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
35
+ */
36
+ export function hexToEditorTextBackgroundPaletteColor(hexColor) {
37
+ // Ts ignore was used to allow use of conditional return type
38
+ // (preferring better type on consumption over safety in implementation)
39
+ // @ts-ignore
40
+ return textBackgroundColorPalette[hexColor.toUpperCase()];
41
+ }
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { hexToEditorBackgroundPaletteColor, hexToEditorBackgroundPaletteRawValue } from './background';
2
2
  export { hexToEditorBorderPaletteColor } from './border';
3
3
  export { hexToEditorTextPaletteColor } from './text';
4
- export { hexToEditorTableChartsPaletteColor, hexToEditorTableChartsPaletteRawValue } from './table-charts';
4
+ export { hexToEditorTableChartsPaletteColor, hexToEditorTableChartsPaletteRawValue } from './table-charts';
5
+ export { hexToEditorTextBackgroundPaletteColor } from './text-background-color';
@@ -0,0 +1,30 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ var _textBackgroundColorP;
3
+ // This import will be stripped on build
4
+
5
+ // Color tokens defined on https://hello.atlassian.net/wiki/spaces/EOU/pages/3587733210/Text+highlighting+-+designs#Colour-palette
6
+ // values are asserted to improve generated type declarations
7
+ export var textBackgroundColorPalette = (_textBackgroundColorP = {}, _defineProperty(_textBackgroundColorP, '#DCDFE4', "var(--ds-background-accent-gray-subtler, #DCDFE4)"), _defineProperty(_textBackgroundColorP, '#C6EDFB', "var(--ds-background-accent-teal-subtler, #C6EDFB)"), _defineProperty(_textBackgroundColorP, '#D3F1A7', "var(--ds-background-accent-lime-subtler, #D3F1A7)"), _defineProperty(_textBackgroundColorP, '#FEDEC8', "var(--ds-background-accent-orange-subtler, #FEDEC8)"), _defineProperty(_textBackgroundColorP, '#FDD0EC', "var(--ds-background-accent-magenta-subtler, #FDD0EC)"), _defineProperty(_textBackgroundColorP, '#DFD8FD', "var(--ds-background-accent-purple-subtler, #DFD8FD)"), _textBackgroundColorP);
8
+ /**
9
+ * This takes an ADF hex color and returns a matching text background palette color.
10
+ *
11
+ * By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
12
+ *
13
+ * Example usage
14
+ * ```tsx
15
+ * const cssValue = hexToEditorTextBackgroundPaletteColor('#D3F1A7');
16
+ *
17
+ * <span style={{backgroundColor: cssValue}} />
18
+ * ```
19
+ * The names of tokens can change over time, and the values of tokens will differ between themes.
20
+ * The exact output of this function is an implementation detail and should only be used when rendering
21
+ * content to the user, on a client with a matching major version of `@atlaskit/tokens`.
22
+ * - **DO NOT**: store the output of these functions in any user-generated content or back-end.
23
+ * - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
24
+ */
25
+ export function hexToEditorTextBackgroundPaletteColor(hexColor) {
26
+ // Ts ignore was used to allow use of conditional return type
27
+ // (preferring better type on consumption over safety in implementation)
28
+ // @ts-ignore
29
+ return textBackgroundColorPalette[hexColor.toUpperCase()];
30
+ }
@@ -2,3 +2,4 @@ export { hexToEditorBackgroundPaletteColor, hexToEditorBackgroundPaletteRawValue
2
2
  export { hexToEditorBorderPaletteColor } from './border';
3
3
  export { hexToEditorTextPaletteColor } from './text';
4
4
  export { hexToEditorTableChartsPaletteColor, hexToEditorTableChartsPaletteRawValue, } from './table-charts';
5
+ export { hexToEditorTextBackgroundPaletteColor } from './text-background-color';
@@ -0,0 +1,35 @@
1
+ export declare const textBackgroundColorPalette: {
2
+ /** Gray - light */
3
+ "#DCDFE4": "var(--ds-background-accent-gray-subtler, #DCDFE4)";
4
+ /** Teal - light */
5
+ "#C6EDFB": "var(--ds-background-accent-teal-subtler, #C6EDFB)";
6
+ /** Lime - light */
7
+ "#D3F1A7": "var(--ds-background-accent-lime-subtler, #D3F1A7)";
8
+ /** Orange - light */
9
+ "#FEDEC8": "var(--ds-background-accent-orange-subtler, #FEDEC8)";
10
+ /** Magenta - light */
11
+ "#FDD0EC": "var(--ds-background-accent-magenta-subtler, #FDD0EC)";
12
+ /** Purple - light */
13
+ "#DFD8FD": "var(--ds-background-accent-purple-subtler, #DFD8FD)";
14
+ };
15
+ type TextBackgroundColorPalette = typeof textBackgroundColorPalette;
16
+ export type TextBackgroundColorPaletteKey = keyof TextBackgroundColorPalette;
17
+ /**
18
+ * This takes an ADF hex color and returns a matching text background palette color.
19
+ *
20
+ * By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
21
+ *
22
+ * Example usage
23
+ * ```tsx
24
+ * const cssValue = hexToEditorTextBackgroundPaletteColor('#D3F1A7');
25
+ *
26
+ * <span style={{backgroundColor: cssValue}} />
27
+ * ```
28
+ * The names of tokens can change over time, and the values of tokens will differ between themes.
29
+ * The exact output of this function is an implementation detail and should only be used when rendering
30
+ * content to the user, on a client with a matching major version of `@atlaskit/tokens`.
31
+ * - **DO NOT**: store the output of these functions in any user-generated content or back-end.
32
+ * - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
33
+ */
34
+ export declare function hexToEditorTextBackgroundPaletteColor<HexColor extends string>(hexColor: HexColor): HexColor extends TextBackgroundColorPaletteKey ? TextBackgroundColorPalette[HexColor] : string | undefined;
35
+ export {};
@@ -2,3 +2,4 @@ export { hexToEditorBackgroundPaletteColor, hexToEditorBackgroundPaletteRawValue
2
2
  export { hexToEditorBorderPaletteColor } from './border';
3
3
  export { hexToEditorTextPaletteColor } from './text';
4
4
  export { hexToEditorTableChartsPaletteColor, hexToEditorTableChartsPaletteRawValue, } from './table-charts';
5
+ export { hexToEditorTextBackgroundPaletteColor } from './text-background-color';
@@ -0,0 +1,35 @@
1
+ export declare const textBackgroundColorPalette: {
2
+ /** Gray - light */
3
+ "#DCDFE4": "var(--ds-background-accent-gray-subtler, #DCDFE4)";
4
+ /** Teal - light */
5
+ "#C6EDFB": "var(--ds-background-accent-teal-subtler, #C6EDFB)";
6
+ /** Lime - light */
7
+ "#D3F1A7": "var(--ds-background-accent-lime-subtler, #D3F1A7)";
8
+ /** Orange - light */
9
+ "#FEDEC8": "var(--ds-background-accent-orange-subtler, #FEDEC8)";
10
+ /** Magenta - light */
11
+ "#FDD0EC": "var(--ds-background-accent-magenta-subtler, #FDD0EC)";
12
+ /** Purple - light */
13
+ "#DFD8FD": "var(--ds-background-accent-purple-subtler, #DFD8FD)";
14
+ };
15
+ type TextBackgroundColorPalette = typeof textBackgroundColorPalette;
16
+ export type TextBackgroundColorPaletteKey = keyof TextBackgroundColorPalette;
17
+ /**
18
+ * This takes an ADF hex color and returns a matching text background palette color.
19
+ *
20
+ * By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
21
+ *
22
+ * Example usage
23
+ * ```tsx
24
+ * const cssValue = hexToEditorTextBackgroundPaletteColor('#D3F1A7');
25
+ *
26
+ * <span style={{backgroundColor: cssValue}} />
27
+ * ```
28
+ * The names of tokens can change over time, and the values of tokens will differ between themes.
29
+ * The exact output of this function is an implementation detail and should only be used when rendering
30
+ * content to the user, on a client with a matching major version of `@atlaskit/tokens`.
31
+ * - **DO NOT**: store the output of these functions in any user-generated content or back-end.
32
+ * - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
33
+ */
34
+ export declare function hexToEditorTextBackgroundPaletteColor<HexColor extends string>(hexColor: HexColor): HexColor extends TextBackgroundColorPaletteKey ? TextBackgroundColorPalette[HexColor] : string | undefined;
35
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-palette",
3
- "version": "1.5.3",
3
+ "version": "1.6.0",
4
4
  "description": "The editor palette",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  ".": "./src/index.ts"
36
36
  },
37
37
  "dependencies": {
38
- "@atlaskit/tokens": "^1.42.0",
38
+ "@atlaskit/tokens": "^1.44.0",
39
39
  "@babel/runtime": "^7.0.0"
40
40
  },
41
41
  "devDependencies": {