@atlaskit/editor-common 116.22.2 → 116.23.1

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,26 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 116.23.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`74b3e15fed77e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/74b3e15fed77e) -
8
+ Check editor text and highlight color accessibility against both light and dark theme variants.
9
+ - Updated dependencies
10
+
11
+ ## 116.23.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`eb60a9c5e949c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eb60a9c5e949c) -
16
+ Fix Confluence live doc table column-sort button being clickable only on its border — header
17
+ content overlapped the button body. The sort button is now elevated above header content, behind
18
+ the new `confluence_live_doc_table_sort_bugfix` experiment.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+
3
24
  ## 116.22.2
4
25
 
5
26
  ### Patch Changes
@@ -28,7 +28,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
28
28
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
29
29
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
30
30
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
31
- var packageVersion = "116.22.1";
31
+ var packageVersion = "116.23.0";
32
32
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
33
33
  // Remove URL as it has UGC
34
34
  // Ignored via go/ees007
@@ -32,6 +32,12 @@ var _templateObject, _templateObject2;
32
32
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
33
33
  var buttonStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tposition: absolute;\n\tdisplay: flex;\n\theight: 28px;\n\twidth: 28px;\n\tmargin: ", ";\n\tright: 0;\n\ttop: 0;\n\tborder: ", " solid ", ";\n\tborder-radius: ", ";\n\tbackground-color: ", ";\n\tjustify-content: center;\n\talign-items: center;\n\tcursor: pointer;\n\n\t&:hover {\n\t\tbackground-color: ", ";\n\t}\n\n\t&:active {\n\t\tbackground-color: ", ";\n\t}\n\n\t&.", "__not-allowed {\n\t\tcursor: not-allowed;\n\t}\n"])), "var(--ds-space-075, 6px)", "var(--ds-border-width-selected, 2px)", "var(--ds-border, #0B120E24)", "var(--ds-radius-small, 4px)", "var(--ds-surface-overlay, #FFFFFF)", "var(--ds-surface-overlay-hovered, #F0F1F2)", "var(--ds-surface-overlay-pressed, #DDDEE1)", _consts.SORTABLE_COLUMN_ICON_CLASSNAME);
34
34
 
35
+ // Keep the sort button above header content nodes that the editor's native-anchor DnD
36
+ // styles give a z-index in live docs, which otherwise cover the button's clickable body.
37
+ var sortButtonElevatedStyles = (0, _react.css)({
38
+ zIndex: 1
39
+ });
40
+
35
41
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
36
42
  var iconWrapperStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\twidth: 8px;\n\theight: 12px;\n\ttransition: transform 0.3s cubic-bezier(0.15, 1, 0.3, 1);\n\ttransform-origin: 50% 50%;\n\tdisplay: flex;\n\tjustify-content: center;\n\n\t&.", " {\n\t\ttransform: rotate(-180deg);\n\t}\n\n\t&.", "-inactive {\n\t\topacity: 0.7;\n\t}\n"])), _StatusClassNames.StatusClassNames.DESC, _consts.SORTABLE_COLUMN_ICON_CLASSNAME);
37
43
 
@@ -135,7 +141,7 @@ var SortingIcon = function SortingIcon(_ref) {
135
141
  content: content,
136
142
  position: "top"
137
143
  }, (0, _react.jsx)("div", {
138
- css: buttonStyles
144
+ css: [buttonStyles, (0, _expValEquals.expValEquals)('confluence_live_doc_table_sort_bugfix', 'isEnabled', true) && sortButtonElevatedStyles]
139
145
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
140
146
  ,
141
147
  className: buttonClassName,
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "116.22.1";
27
+ var packageVersion = "116.23.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -12,13 +13,57 @@ Object.defineProperty(exports, "getSelectedRowAndColumn", {
12
13
  }
13
14
  });
14
15
  exports.getSelectedRowAndColumnFromPalette = getSelectedRowAndColumnFromPalette;
15
- exports.getTokenCSSVariableValue = void 0;
16
+ exports.getTokenCSSVariableValueForNonActiveTheme = exports.getTokenCSSVariableValue = void 0;
17
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
18
+ var _palettesRaw = _interopRequireDefault(require("@atlaskit/tokens/palettes-raw"));
19
+ var _tokenNames = _interopRequireDefault(require("@atlaskit/tokens/token-names"));
20
+ var _tokensRaw = require("@atlaskit/tokens/tokens-raw");
16
21
  var _getSelectedRowAndColumn = require("./getSelectedRowAndColumn");
17
22
  var DEFAULT_COLOR_PICKER_COLUMNS = exports.DEFAULT_COLOR_PICKER_COLUMNS = 7;
18
-
19
23
  // Ignored via go/ees005
20
24
  // eslint-disable-next-line require-unicode-regexp
21
25
  var CSS_VAR_EXPRESSION_REGEX = /var\(([^,\)]+)(,.*)?\)/;
26
+ var getCSSVariableParts = function getCSSVariableParts(variableExpression) {
27
+ var matcher = variableExpression.match(CSS_VAR_EXPRESSION_REGEX);
28
+ if (!matcher) {
29
+ return undefined;
30
+ }
31
+ return {
32
+ fallback: matcher[2] ? matcher[2].replace(',', '').trim() : '',
33
+ variable: matcher[1].trim()
34
+ };
35
+ };
36
+
37
+ // Build the reverse lookup (CSS variable -> token name) once at module load so that
38
+ // each lookup is O(1) instead of O(n) with an extra array allocation per call.
39
+ var cssVariableToTokenName = new Map(Object.entries(_tokenNames.default).map(function (_ref) {
40
+ var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
41
+ tokenName = _ref2[0],
42
+ cssVariable = _ref2[1];
43
+ return [cssVariable, tokenName];
44
+ }));
45
+ var getTokenName = function getTokenName(cssVariable) {
46
+ return cssVariableToTokenName.get(cssVariable);
47
+ };
48
+ var resolveRawTokenValue = function resolveRawTokenValue(value) {
49
+ var _paletteRaw$find;
50
+ if (typeof value !== 'string') {
51
+ return undefined;
52
+ }
53
+ var paletteValue = (_paletteRaw$find = _palettesRaw.default.find(function (paletteToken) {
54
+ return paletteToken.path[paletteToken.path.length - 1] === value;
55
+ })) === null || _paletteRaw$find === void 0 ? void 0 : _paletteRaw$find.value;
56
+ return typeof paletteValue === 'string' ? paletteValue : value;
57
+ };
58
+ var getCurrentThemeMode = function getCurrentThemeMode() {
59
+ if (typeof document === 'undefined') {
60
+ return 'light';
61
+ }
62
+ return document.documentElement.getAttribute('data-color-mode') === 'dark' ? 'dark' : 'light';
63
+ };
64
+ var getNonActiveThemeMode = function getNonActiveThemeMode() {
65
+ return getCurrentThemeMode() === 'dark' ? 'light' : 'dark';
66
+ };
22
67
 
23
68
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
24
69
  function getColorsPerRowFromPalette(palette) {
@@ -52,4 +97,17 @@ var getTokenCSSVariableValue = exports.getTokenCSSVariableValue = function getTo
52
97
  }
53
98
  return '';
54
99
  };
100
+
101
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
102
+ var getTokenCSSVariableValueForNonActiveTheme = exports.getTokenCSSVariableValueForNonActiveTheme = function getTokenCSSVariableValueForNonActiveTheme(variableExpression, fallback) {
103
+ var cssVariableParts = getCSSVariableParts(variableExpression);
104
+ var tokenName = cssVariableParts ? getTokenName(cssVariableParts.variable) : undefined;
105
+ var rawToken = (getNonActiveThemeMode() === 'light' ? _tokensRaw.light : _tokensRaw.dark).find(function (token) {
106
+ return token.cleanName === tokenName;
107
+ });
108
+ if (rawToken) {
109
+ return resolveRawTokenValue(rawToken.value) || fallback;
110
+ }
111
+ return (cssVariableParts === null || cssVariableParts === void 0 ? void 0 : cssVariableParts.fallback) || fallback;
112
+ };
55
113
  // eslint-disable-next-line @atlaskit/editor/no-re-export
@@ -100,6 +100,12 @@ Object.defineProperty(exports, "getTokenCSSVariableValue", {
100
100
  return _utils.getTokenCSSVariableValue;
101
101
  }
102
102
  });
103
+ Object.defineProperty(exports, "getTokenCSSVariableValueForNonActiveTheme", {
104
+ enumerable: true,
105
+ get: function get() {
106
+ return _utils.getTokenCSSVariableValueForNonActiveTheme;
107
+ }
108
+ });
103
109
  Object.defineProperty(exports, "highlightColorPalette", {
104
110
  enumerable: true,
105
111
  get: function get() {
@@ -14,7 +14,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
14
14
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
15
15
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
16
16
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
17
- const packageVersion = "116.22.1";
17
+ const packageVersion = "116.23.0";
18
18
  const sanitiseSentryEvents = (data, _hint) => {
19
19
  // Remove URL as it has UGC
20
20
  // Ignored via go/ees007
@@ -45,6 +45,12 @@ const buttonStyles = css`
45
45
  }
46
46
  `;
47
47
 
48
+ // Keep the sort button above header content nodes that the editor's native-anchor DnD
49
+ // styles give a z-index in live docs, which otherwise cover the button's clickable body.
50
+ const sortButtonElevatedStyles = css({
51
+ zIndex: 1
52
+ });
53
+
48
54
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
49
55
  const iconWrapperStyles = css`
50
56
  width: 8px;
@@ -168,7 +174,7 @@ const SortingIcon = ({
168
174
  content: content,
169
175
  position: "top"
170
176
  }, jsx("div", {
171
- css: buttonStyles
177
+ css: [buttonStyles, expValEquals('confluence_live_doc_table_sort_bugfix', 'isEnabled', true) && sortButtonElevatedStyles]
172
178
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
173
179
  ,
174
180
  className: buttonClassName,
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "116.22.1";
17
+ const packageVersion = "116.23.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -1,9 +1,41 @@
1
+ import paletteRaw from '@atlaskit/tokens/palettes-raw';
2
+ import tokenNames from '@atlaskit/tokens/token-names';
3
+ import { dark as darkTokensRaw, light as lightTokensRaw } from '@atlaskit/tokens/tokens-raw';
1
4
  import { getSelectedRowAndColumn } from './getSelectedRowAndColumn';
2
5
  export const DEFAULT_COLOR_PICKER_COLUMNS = 7;
3
-
4
6
  // Ignored via go/ees005
5
7
  // eslint-disable-next-line require-unicode-regexp
6
8
  const CSS_VAR_EXPRESSION_REGEX = /var\(([^,\)]+)(,.*)?\)/;
9
+ const getCSSVariableParts = variableExpression => {
10
+ const matcher = variableExpression.match(CSS_VAR_EXPRESSION_REGEX);
11
+ if (!matcher) {
12
+ return undefined;
13
+ }
14
+ return {
15
+ fallback: matcher[2] ? matcher[2].replace(',', '').trim() : '',
16
+ variable: matcher[1].trim()
17
+ };
18
+ };
19
+
20
+ // Build the reverse lookup (CSS variable -> token name) once at module load so that
21
+ // each lookup is O(1) instead of O(n) with an extra array allocation per call.
22
+ const cssVariableToTokenName = new Map(Object.entries(tokenNames).map(([tokenName, cssVariable]) => [cssVariable, tokenName]));
23
+ const getTokenName = cssVariable => cssVariableToTokenName.get(cssVariable);
24
+ const resolveRawTokenValue = value => {
25
+ var _paletteRaw$find;
26
+ if (typeof value !== 'string') {
27
+ return undefined;
28
+ }
29
+ const paletteValue = (_paletteRaw$find = paletteRaw.find(paletteToken => paletteToken.path[paletteToken.path.length - 1] === value)) === null || _paletteRaw$find === void 0 ? void 0 : _paletteRaw$find.value;
30
+ return typeof paletteValue === 'string' ? paletteValue : value;
31
+ };
32
+ const getCurrentThemeMode = () => {
33
+ if (typeof document === 'undefined') {
34
+ return 'light';
35
+ }
36
+ return document.documentElement.getAttribute('data-color-mode') === 'dark' ? 'dark' : 'light';
37
+ };
38
+ const getNonActiveThemeMode = () => getCurrentThemeMode() === 'dark' ? 'light' : 'dark';
7
39
 
8
40
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
9
41
  export function getColorsPerRowFromPalette(palette, cols = DEFAULT_COLOR_PICKER_COLUMNS) {
@@ -35,5 +67,16 @@ export const getTokenCSSVariableValue = variableExpression => {
35
67
  }
36
68
  return '';
37
69
  };
70
+
71
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
72
+ export const getTokenCSSVariableValueForNonActiveTheme = (variableExpression, fallback) => {
73
+ const cssVariableParts = getCSSVariableParts(variableExpression);
74
+ const tokenName = cssVariableParts ? getTokenName(cssVariableParts.variable) : undefined;
75
+ const rawToken = (getNonActiveThemeMode() === 'light' ? lightTokensRaw : darkTokensRaw).find(token => token.cleanName === tokenName);
76
+ if (rawToken) {
77
+ return resolveRawTokenValue(rawToken.value) || fallback;
78
+ }
79
+ return (cssVariableParts === null || cssVariableParts === void 0 ? void 0 : cssVariableParts.fallback) || fallback;
80
+ };
38
81
  // eslint-disable-next-line @atlaskit/editor/no-re-export
39
82
  export { getSelectedRowAndColumn } from './getSelectedRowAndColumn';
@@ -6,7 +6,7 @@ export { default as Color } from './ColorPalette/Color';
6
6
  export { SelectedTextColorProvider } from './ColorPalette/SelectedTextColorProvider';
7
7
  export { useSelectedTextColor } from './ColorPalette/useSelectedTextColor';
8
8
  export { getSelectedRowAndColumn } from './ColorPalette/getSelectedRowAndColumn';
9
- export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue } from './ColorPalette/utils';
9
+ export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue, getTokenCSSVariableValueForNonActiveTheme } from './ColorPalette/utils';
10
10
  export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/cellBackgroundColorPalette';
11
11
  export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
12
12
  export { panelBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
@@ -20,7 +20,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
20
20
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
21
21
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
22
22
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
23
- var packageVersion = "116.22.1";
23
+ var packageVersion = "116.23.0";
24
24
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
25
25
  // Remove URL as it has UGC
26
26
  // Ignored via go/ees007
@@ -21,6 +21,12 @@ import { StatusClassNames } from './StatusClassNames';
21
21
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
22
22
  var buttonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tposition: absolute;\n\tdisplay: flex;\n\theight: 28px;\n\twidth: 28px;\n\tmargin: ", ";\n\tright: 0;\n\ttop: 0;\n\tborder: ", " solid ", ";\n\tborder-radius: ", ";\n\tbackground-color: ", ";\n\tjustify-content: center;\n\talign-items: center;\n\tcursor: pointer;\n\n\t&:hover {\n\t\tbackground-color: ", ";\n\t}\n\n\t&:active {\n\t\tbackground-color: ", ";\n\t}\n\n\t&.", "__not-allowed {\n\t\tcursor: not-allowed;\n\t}\n"])), "var(--ds-space-075, 6px)", "var(--ds-border-width-selected, 2px)", "var(--ds-border, #0B120E24)", "var(--ds-radius-small, 4px)", "var(--ds-surface-overlay, #FFFFFF)", "var(--ds-surface-overlay-hovered, #F0F1F2)", "var(--ds-surface-overlay-pressed, #DDDEE1)", SORTABLE_COLUMN_ICON_CLASSNAME);
23
23
 
24
+ // Keep the sort button above header content nodes that the editor's native-anchor DnD
25
+ // styles give a z-index in live docs, which otherwise cover the button's clickable body.
26
+ var sortButtonElevatedStyles = css({
27
+ zIndex: 1
28
+ });
29
+
24
30
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
25
31
  var iconWrapperStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\twidth: 8px;\n\theight: 12px;\n\ttransition: transform 0.3s cubic-bezier(0.15, 1, 0.3, 1);\n\ttransform-origin: 50% 50%;\n\tdisplay: flex;\n\tjustify-content: center;\n\n\t&.", " {\n\t\ttransform: rotate(-180deg);\n\t}\n\n\t&.", "-inactive {\n\t\topacity: 0.7;\n\t}\n"])), StatusClassNames.DESC, SORTABLE_COLUMN_ICON_CLASSNAME);
26
32
 
@@ -124,7 +130,7 @@ var SortingIcon = function SortingIcon(_ref) {
124
130
  content: content,
125
131
  position: "top"
126
132
  }, jsx("div", {
127
- css: buttonStyles
133
+ css: [buttonStyles, expValEquals('confluence_live_doc_table_sort_bugfix', 'isEnabled', true) && sortButtonElevatedStyles]
128
134
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
129
135
  ,
130
136
  className: buttonClassName,
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "116.22.1";
24
+ var packageVersion = "116.23.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -1,9 +1,53 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import paletteRaw from '@atlaskit/tokens/palettes-raw';
3
+ import tokenNames from '@atlaskit/tokens/token-names';
4
+ import { dark as darkTokensRaw, light as lightTokensRaw } from '@atlaskit/tokens/tokens-raw';
1
5
  import { getSelectedRowAndColumn } from './getSelectedRowAndColumn';
2
6
  export var DEFAULT_COLOR_PICKER_COLUMNS = 7;
3
-
4
7
  // Ignored via go/ees005
5
8
  // eslint-disable-next-line require-unicode-regexp
6
9
  var CSS_VAR_EXPRESSION_REGEX = /var\(([^,\)]+)(,.*)?\)/;
10
+ var getCSSVariableParts = function getCSSVariableParts(variableExpression) {
11
+ var matcher = variableExpression.match(CSS_VAR_EXPRESSION_REGEX);
12
+ if (!matcher) {
13
+ return undefined;
14
+ }
15
+ return {
16
+ fallback: matcher[2] ? matcher[2].replace(',', '').trim() : '',
17
+ variable: matcher[1].trim()
18
+ };
19
+ };
20
+
21
+ // Build the reverse lookup (CSS variable -> token name) once at module load so that
22
+ // each lookup is O(1) instead of O(n) with an extra array allocation per call.
23
+ var cssVariableToTokenName = new Map(Object.entries(tokenNames).map(function (_ref) {
24
+ var _ref2 = _slicedToArray(_ref, 2),
25
+ tokenName = _ref2[0],
26
+ cssVariable = _ref2[1];
27
+ return [cssVariable, tokenName];
28
+ }));
29
+ var getTokenName = function getTokenName(cssVariable) {
30
+ return cssVariableToTokenName.get(cssVariable);
31
+ };
32
+ var resolveRawTokenValue = function resolveRawTokenValue(value) {
33
+ var _paletteRaw$find;
34
+ if (typeof value !== 'string') {
35
+ return undefined;
36
+ }
37
+ var paletteValue = (_paletteRaw$find = paletteRaw.find(function (paletteToken) {
38
+ return paletteToken.path[paletteToken.path.length - 1] === value;
39
+ })) === null || _paletteRaw$find === void 0 ? void 0 : _paletteRaw$find.value;
40
+ return typeof paletteValue === 'string' ? paletteValue : value;
41
+ };
42
+ var getCurrentThemeMode = function getCurrentThemeMode() {
43
+ if (typeof document === 'undefined') {
44
+ return 'light';
45
+ }
46
+ return document.documentElement.getAttribute('data-color-mode') === 'dark' ? 'dark' : 'light';
47
+ };
48
+ var getNonActiveThemeMode = function getNonActiveThemeMode() {
49
+ return getCurrentThemeMode() === 'dark' ? 'light' : 'dark';
50
+ };
7
51
 
8
52
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
9
53
  export function getColorsPerRowFromPalette(palette) {
@@ -37,5 +81,18 @@ export var getTokenCSSVariableValue = function getTokenCSSVariableValue(variable
37
81
  }
38
82
  return '';
39
83
  };
84
+
85
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
86
+ export var getTokenCSSVariableValueForNonActiveTheme = function getTokenCSSVariableValueForNonActiveTheme(variableExpression, fallback) {
87
+ var cssVariableParts = getCSSVariableParts(variableExpression);
88
+ var tokenName = cssVariableParts ? getTokenName(cssVariableParts.variable) : undefined;
89
+ var rawToken = (getNonActiveThemeMode() === 'light' ? lightTokensRaw : darkTokensRaw).find(function (token) {
90
+ return token.cleanName === tokenName;
91
+ });
92
+ if (rawToken) {
93
+ return resolveRawTokenValue(rawToken.value) || fallback;
94
+ }
95
+ return (cssVariableParts === null || cssVariableParts === void 0 ? void 0 : cssVariableParts.fallback) || fallback;
96
+ };
40
97
  // eslint-disable-next-line @atlaskit/editor/no-re-export
41
98
  export { getSelectedRowAndColumn } from './getSelectedRowAndColumn';
@@ -6,7 +6,7 @@ export { default as Color } from './ColorPalette/Color';
6
6
  export { SelectedTextColorProvider } from './ColorPalette/SelectedTextColorProvider';
7
7
  export { useSelectedTextColor } from './ColorPalette/useSelectedTextColor';
8
8
  export { getSelectedRowAndColumn } from './ColorPalette/getSelectedRowAndColumn';
9
- export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue } from './ColorPalette/utils';
9
+ export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue, getTokenCSSVariableValueForNonActiveTheme } from './ColorPalette/utils';
10
10
  export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/cellBackgroundColorPalette';
11
11
  export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
12
12
  export { panelBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
@@ -2,7 +2,18 @@ import type { JSONNode } from '@atlaskit/editor-json-transformer';
2
2
  export interface LongPressSelectionPluginOptions {
3
3
  useLongPressSelection?: boolean;
4
4
  }
5
+ export interface AdditionalNodeContextFragment {
6
+ /**
7
+ * Additional attributes for the node context fragment
8
+ */
9
+ [key: string]: unknown;
10
+ type: string;
11
+ }
5
12
  export type SelectionContext = {
13
+ /**
14
+ * Map of node local IDs to additional node context fragments
15
+ */
16
+ additionalNodeContext?: Record<string, AdditionalNodeContextFragment> | null;
6
17
  /**
7
18
  * End index of the selection inside the last node of the selection
8
19
  */
@@ -6,4 +6,5 @@ export declare function getSelectedRowAndColumnFromPalette(palette: PaletteColor
6
6
  selectedRowIndex: number;
7
7
  };
8
8
  export declare const getTokenCSSVariableValue: (variableExpression: string) => string;
9
+ export declare const getTokenCSSVariableValueForNonActiveTheme: (variableExpression: string, fallback: string) => string;
9
10
  export { getSelectedRowAndColumn } from './getSelectedRowAndColumn';
@@ -3,7 +3,7 @@ export { default as Color } from './ColorPalette/Color';
3
3
  export { SelectedTextColorProvider } from './ColorPalette/SelectedTextColorProvider';
4
4
  export { useSelectedTextColor } from './ColorPalette/useSelectedTextColor';
5
5
  export { getSelectedRowAndColumn } from './ColorPalette/getSelectedRowAndColumn';
6
- export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue, } from './ColorPalette/utils';
6
+ export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue, getTokenCSSVariableValueForNonActiveTheme, } from './ColorPalette/utils';
7
7
  export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/cellBackgroundColorPalette';
8
8
  export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
9
9
  export { panelBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "116.22.2",
3
+ "version": "116.23.1",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -57,10 +57,10 @@
57
57
  "@atlaskit/media-card": "^81.3.0",
58
58
  "@atlaskit/media-client": "^37.2.0",
59
59
  "@atlaskit/media-client-react": "^6.1.0",
60
- "@atlaskit/media-common": "^14.2.0",
60
+ "@atlaskit/media-common": "^14.3.0",
61
61
  "@atlaskit/media-file-preview": "^1.1.0",
62
62
  "@atlaskit/media-picker": "^72.1.0",
63
- "@atlaskit/media-ui": "^30.5.0",
63
+ "@atlaskit/media-ui": "^30.6.0",
64
64
  "@atlaskit/media-viewer": "^54.3.0",
65
65
  "@atlaskit/mention": "^27.5.0",
66
66
  "@atlaskit/menu": "^9.1.0",
@@ -68,7 +68,7 @@
68
68
  "@atlaskit/onboarding": "^15.1.0",
69
69
  "@atlaskit/platform-feature-flags": "^2.0.0",
70
70
  "@atlaskit/platform-feature-flags-react": "^1.1.0",
71
- "@atlaskit/primitives": "^20.3.0",
71
+ "@atlaskit/primitives": "^20.4.0",
72
72
  "@atlaskit/profilecard": "^26.8.0",
73
73
  "@atlaskit/prosemirror-history": "^1.0.0",
74
74
  "@atlaskit/react-compiler-gating": "^0.2.0",
@@ -80,7 +80,7 @@
80
80
  "@atlaskit/task-decision": "^21.4.0",
81
81
  "@atlaskit/teams-app-config": "^2.1.0",
82
82
  "@atlaskit/textfield": "^9.1.0",
83
- "@atlaskit/tmp-editor-statsig": "^121.1.0",
83
+ "@atlaskit/tmp-editor-statsig": "^121.2.0",
84
84
  "@atlaskit/tokens": "^15.4.0",
85
85
  "@atlaskit/tooltip": "^23.1.0",
86
86
  "@atlaskit/width-detector": "^6.1.0",
@@ -123,7 +123,7 @@
123
123
  "@atlaskit/media-core": "^38.0.0",
124
124
  "@atlassian/a11y-jest-testing": "^0.13.0",
125
125
  "@atlassian/feature-flags-test-utils": "^1.1.0",
126
- "@atlassian/testing-library": "^0.9.0",
126
+ "@atlassian/testing-library": "^0.10.0",
127
127
  "@testing-library/dom": "^10.1.0",
128
128
  "@testing-library/jest-dom": "^6.4.5",
129
129
  "@testing-library/react": "^16.3.0",